w.valueOf():w.valueOf()9999?Mt(w,p?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Q(Date.prototype.toISOString)?p?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Mt(w,"Z")):Mt(w,p?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function OM(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var f="moment",p="",w,S,F,j;return this.isLocal()||(f=this.utcOffset()===0?"moment.utc":"moment.parseZone",p="Z"),w="["+f+'("]',S=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",F="-MM-DD[T]HH:mm:ss.SSS",j=p+'[")]',this.format(w+S+F+j)}function LM(f){f||(f=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var p=Mt(this,f);return this.localeData().postformat(p)}function PM(f,p){return this.isValid()&&(A(f)&&f.isValid()||Zt(f).isValid())?Zr({to:this,from:f}).locale(this.locale()).humanize(!p):this.localeData().invalidDate()}function NM(f){return this.from(Zt(),f)}function RM(f,p){return this.isValid()&&(A(f)&&f.isValid()||Zt(f).isValid())?Zr({from:this,to:f}).locale(this.locale()).humanize(!p):this.localeData().invalidDate()}function HM(f){return this.to(Zt(),f)}function zy(f){var p;return f===void 0?this._locale._abbr:(p=Ci(f),p!=null&&(this._locale=p),this)}var Ky=B("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(f){return f===void 0?this.localeData():this.locale(f)});function jy(){return this._locale}var su=1e3,Do=60*su,lu=60*Do,qy=(365*400+97)*24*lu;function So(f,p){return(f%p+p)%p}function Gy(f,p,w){return f<100&&f>=0?new Date(f+400,p,w)-qy:new Date(f,p,w).valueOf()}function Jy(f,p,w){return f<100&&f>=0?Date.UTC(f+400,p,w)-qy:Date.UTC(f,p,w)}function BM(f){var p,w;if(f=Vt(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?Jy:Gy,f){case"year":p=w(this.year(),0,1);break;case"quarter":p=w(this.year(),this.month()-this.month()%3,1);break;case"month":p=w(this.year(),this.month(),1);break;case"week":p=w(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":p=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":p=w(this.year(),this.month(),this.date());break;case"hour":p=this._d.valueOf(),p-=So(p+(this._isUTC?0:this.utcOffset()*Do),lu);break;case"minute":p=this._d.valueOf(),p-=So(p,Do);break;case"second":p=this._d.valueOf(),p-=So(p,su);break}return this._d.setTime(p),t.updateOffset(this,!0),this}function VM(f){var p,w;if(f=Vt(f),f===void 0||f==="millisecond"||!this.isValid())return this;switch(w=this._isUTC?Jy:Gy,f){case"year":p=w(this.year()+1,0,1)-1;break;case"quarter":p=w(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":p=w(this.year(),this.month()+1,1)-1;break;case"week":p=w(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":p=w(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":p=w(this.year(),this.month(),this.date()+1)-1;break;case"hour":p=this._d.valueOf(),p+=lu-So(p+(this._isUTC?0:this.utcOffset()*Do),lu)-1;break;case"minute":p=this._d.valueOf(),p+=Do-So(p,Do)-1;break;case"second":p=this._d.valueOf(),p+=su-So(p,su)-1;break}return this._d.setTime(p),t.updateOffset(this,!0),this}function $M(){return this._d.valueOf()-(this._offset||0)*6e4}function UM(){return Math.floor(this.valueOf()/1e3)}function WM(){return new Date(this.valueOf())}function YM(){var f=this;return[f.year(),f.month(),f.date(),f.hour(),f.minute(),f.second(),f.millisecond()]}function zM(){var f=this;return{years:f.year(),months:f.month(),date:f.date(),hours:f.hours(),minutes:f.minutes(),seconds:f.seconds(),milliseconds:f.milliseconds()}}function KM(){return this.isValid()?this.toISOString():null}function jM(){return v(this)}function qM(){return d({},g(this))}function GM(){return g(this).overflow}function JM(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}N("N",0,0,"eraAbbr"),N("NN",0,0,"eraAbbr"),N("NNN",0,0,"eraAbbr"),N("NNNN",0,0,"eraName"),N("NNNNN",0,0,"eraNarrow"),N("y",["y",1],"yo","eraYear"),N("y",["yy",2],0,"eraYear"),N("y",["yyy",3],0,"eraYear"),N("y",["yyyy",4],0,"eraYear"),ae("N",Af),ae("NN",Af),ae("NNN",Af),ae("NNNN",sT),ae("NNNNN",lT),We(["N","NN","NNN","NNNN","NNNNN"],function(f,p,w,S){var F=w._locale.erasParse(f,S,w._strict);F?g(w).era=F:g(w).invalidEra=f}),ae("y",ge),ae("yy",ge),ae("yyy",ge),ae("yyyy",ge),ae("yo",uT),We(["y","yy","yyy","yyyy"],Ot),We(["yo"],function(f,p,w,S){var F;w._locale._eraYearOrdinalRegex&&(F=f.match(w._locale._eraYearOrdinalRegex)),w._locale.eraYearOrdinalParse?p[Ot]=w._locale.eraYearOrdinalParse(f,F):p[Ot]=parseInt(f,10)});function ZM(f,p){var w,S,F,j=this._eras||Ci("en")._eras;for(w=0,S=j.length;w=0)return j[S]}function XM(f,p){var w=f.since<=f.until?1:-1;return p===void 0?t(f.since).year():t(f.since).year()+(p-f.offset)*w}function eT(){var f,p,w,S=this.localeData().eras();for(f=0,p=S.length;fj&&(p=j),gT.call(this,f,p,w,S,F))}function gT(f,p,w,S,F){var j=My(f,p,w,S,F),se=kr(j.year,0,j.dayOfYear);return this.year(se.getUTCFullYear()),this.month(se.getUTCMonth()),this.date(se.getUTCDate()),this}N("Q",0,"Qo","quarter"),Rt("quarter","Q"),Bt("quarter",7),ae("Q",_n),We("Q",function(f,p){p[or]=(Z(f)-1)*3});function yT(f){return f==null?Math.ceil((this.month()+1)/3):this.month((f-1)*3+this.month()%3)}N("D",["DD",2],"Do","date"),Rt("date","D"),Bt("date",9),ae("D",L),ae("DD",L,Ht),ae("Do",function(f,p){return f?p._dayOfMonthOrdinalParse||p._ordinalParse:p._dayOfMonthOrdinalParseLenient}),We(["D","DD"],sr),We("Do",function(f,p){p[sr]=Z(f.match(L)[0])});var Qy=me("Date",!0);N("DDD",["DDDD",3],"DDDo","dayOfYear"),Rt("dayOfYear","DDD"),Bt("dayOfYear",4),ae("DDD",ue),ae("DDDD",ar),We(["DDD","DDDD"],function(f,p,w){w._dayOfYear=Z(f)});function vT(f){var p=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return f==null?p:this.add(f-p,"d")}N("m",["mm",2],0,"minute"),Rt("minute","m"),Bt("minute",14),ae("m",L),ae("mm",L,Ht),We(["m","mm"],Bn);var wT=me("Minutes",!1);N("s",["ss",2],0,"second"),Rt("second","s"),Bt("second",15),ae("s",L),ae("ss",L,Ht),We(["s","ss"],Er);var bT=me("Seconds",!1);N("S",0,0,function(){return~~(this.millisecond()/100)}),N(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),N(0,["SSS",3],0,"millisecond"),N(0,["SSSS",4],0,function(){return this.millisecond()*10}),N(0,["SSSSS",5],0,function(){return this.millisecond()*100}),N(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),N(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),N(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),N(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Rt("millisecond","ms"),Bt("millisecond",16),ae("S",ue,_n),ae("SS",ue,Ht),ae("SSS",ue,ar);var ra,Xy;for(ra="SSSS";ra.length<=9;ra+="S")ae(ra,ge);function DT(f,p){p[Gr]=Z(("0."+f)*1e3)}for(ra="S";ra.length<=9;ra+="S")We(ra,DT);Xy=me("Milliseconds",!1),N("z",0,0,"zoneAbbr"),N("zz",0,0,"zoneName");function ST(){return this._isUTC?"UTC":""}function ET(){return this._isUTC?"Coordinated Universal Time":""}var we=O.prototype;we.add=pM,we.calendar=SM,we.clone=EM,we.diff=FM,we.endOf=VM,we.format=LM,we.from=PM,we.fromNow=NM,we.to=RM,we.toNow=HM,we.get=Dt,we.invalidAt=GM,we.isAfter=kM,we.isBefore=xM,we.isBetween=CM,we.isSame=_M,we.isSameOrAfter=MM,we.isSameOrBefore=TM,we.isValid=jM,we.lang=Ky,we.locale=zy,we.localeData=jy,we.max=j1,we.min=K1,we.parsingFlags=qM,we.set=Cn,we.startOf=BM,we.subtract=gM,we.toArray=YM,we.toObject=zM,we.toDate=WM,we.toISOString=AM,we.inspect=OM,typeof Symbol!="undefined"&&Symbol.for!=null&&(we[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),we.toJSON=KM,we.toString=IM,we.unix=UM,we.valueOf=$M,we.creationData=JM,we.eraName=eT,we.eraNarrow=tT,we.eraAbbr=nT,we.eraYear=rT,we.year=On,we.isLeapYear=Vn,we.weekYear=cT,we.isoWeekYear=dT,we.quarter=we.quarters=yT,we.month=ot,we.daysInMonth=qe,we.week=we.weeks=Z_,we.isoWeek=we.isoWeeks=Q_,we.weeksInYear=mT,we.weeksInWeekYear=pT,we.isoWeeksInYear=fT,we.isoWeeksInISOWeekYear=hT,we.date=Qy,we.day=we.days=d1,we.weekday=f1,we.isoWeekday=h1,we.dayOfYear=vT,we.hour=we.hours=b1,we.minute=we.minutes=wT,we.second=we.seconds=bT,we.millisecond=we.milliseconds=Xy,we.utcOffset=nM,we.utc=iM,we.local=aM,we.parseZone=oM,we.hasAlignedHourOffset=sM,we.isDST=lM,we.isLocal=cM,we.isUtcOffset=dM,we.isUtc=Vy,we.isUTC=Vy,we.zoneAbbr=ST,we.zoneName=ET,we.dates=B("dates accessor is deprecated. Use date instead.",Qy),we.months=B("months accessor is deprecated. Use month instead",ot),we.years=B("years accessor is deprecated. Use year instead",On),we.zone=B("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",rM),we.isDSTShifted=B("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",uM);function kT(f){return Zt(f*1e3)}function xT(){return Zt.apply(null,arguments).parseZone()}function ev(f){return f}var Lt=re.prototype;Lt.calendar=pe,Lt.longDateFormat=Wt,Lt.invalidDate=Jt,Lt.ordinal=yn,Lt.preparse=ev,Lt.postformat=ev,Lt.relativeTime=xn,Lt.pastFuture=jn,Lt.set=oe,Lt.eras=ZM,Lt.erasParse=QM,Lt.erasConvertYear=XM,Lt.erasAbbrRegex=aT,Lt.erasNameRegex=iT,Lt.erasNarrowRegex=oT,Lt.months=he,Lt.monthsShort=Me,Lt.monthsParse=Le,Lt.monthsRegex=st,Lt.monthsShortRegex=yt,Lt.week=j_,Lt.firstDayOfYear=J_,Lt.firstDayOfWeek=G_,Lt.weekdays=o1,Lt.weekdaysMin=l1,Lt.weekdaysShort=s1,Lt.weekdaysParse=c1,Lt.weekdaysRegex=m1,Lt.weekdaysShortRegex=p1,Lt.weekdaysMinRegex=g1,Lt.isPM=v1,Lt.meridiem=D1;function cu(f,p,w,S){var F=Ci(),j=m().set(S,p);return F[w](j,f)}function tv(f,p,w){if(u(f)&&(p=f,f=void 0),f=f||"",p!=null)return cu(f,p,w,"month");var S,F=[];for(S=0;S<12;S++)F[S]=cu(f,S,w,"month");return F}function Lf(f,p,w,S){typeof f=="boolean"?(u(p)&&(w=p,p=void 0),p=p||""):(p=f,w=p,f=!1,u(p)&&(w=p,p=void 0),p=p||"");var F=Ci(),j=f?F._week.dow:0,se,Pe=[];if(w!=null)return cu(p,(w+j)%7,S,"day");for(se=0;se<7;se++)Pe[se]=cu(p,(se+j)%7,S,"day");return Pe}function CT(f,p){return tv(f,p,"months")}function _T(f,p){return tv(f,p,"monthsShort")}function MT(f,p,w){return Lf(f,p,w,"weekdays")}function TT(f,p,w){return Lf(f,p,w,"weekdaysShort")}function FT(f,p,w){return Lf(f,p,w,"weekdaysMin")}na("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(f){var p=f%10,w=Z(f%100/10)===1?"th":p===1?"st":p===2?"nd":p===3?"rd":"th";return f+w}}),t.lang=B("moment.lang is deprecated. Use moment.locale instead.",na),t.langData=B("moment.langData is deprecated. Use moment.localeData instead.",Ci);var _i=Math.abs;function IT(){var f=this._data;return this._milliseconds=_i(this._milliseconds),this._days=_i(this._days),this._months=_i(this._months),f.milliseconds=_i(f.milliseconds),f.seconds=_i(f.seconds),f.minutes=_i(f.minutes),f.hours=_i(f.hours),f.months=_i(f.months),f.years=_i(f.years),this}function nv(f,p,w,S){var F=Zr(p,w);return f._milliseconds+=S*F._milliseconds,f._days+=S*F._days,f._months+=S*F._months,f._bubble()}function AT(f,p){return nv(this,f,p,1)}function OT(f,p){return nv(this,f,p,-1)}function rv(f){return f<0?Math.floor(f):Math.ceil(f)}function LT(){var f=this._milliseconds,p=this._days,w=this._months,S=this._data,F,j,se,Pe,ut;return f>=0&&p>=0&&w>=0||f<=0&&p<=0&&w<=0||(f+=rv(Pf(w)+p)*864e5,p=0,w=0),S.milliseconds=f%1e3,F=At(f/1e3),S.seconds=F%60,j=At(F/60),S.minutes=j%60,se=At(j/60),S.hours=se%24,p+=At(se/24),ut=At(iv(p)),w+=ut,p-=rv(Pf(ut)),Pe=At(w/12),w%=12,S.days=p,S.months=w,S.years=Pe,this}function iv(f){return f*4800/146097}function Pf(f){return f*146097/4800}function PT(f){if(!this.isValid())return NaN;var p,w,S=this._milliseconds;if(f=Vt(f),f==="month"||f==="quarter"||f==="year")switch(p=this._days+S/864e5,w=this._months+iv(p),f){case"month":return w;case"quarter":return w/3;case"year":return w/12}else switch(p=this._days+Math.round(Pf(this._months)),f){case"week":return p/7+S/6048e5;case"day":return p+S/864e5;case"hour":return p*24+S/36e5;case"minute":return p*1440+S/6e4;case"second":return p*86400+S/1e3;case"millisecond":return Math.floor(p*864e5)+S;default:throw new Error("Unknown unit "+f)}}function NT(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Z(this._months/12)*31536e6:NaN}function Mi(f){return function(){return this.as(f)}}var RT=Mi("ms"),HT=Mi("s"),BT=Mi("m"),VT=Mi("h"),$T=Mi("d"),UT=Mi("w"),WT=Mi("M"),YT=Mi("Q"),zT=Mi("y");function KT(){return Zr(this)}function jT(f){return f=Vt(f),this.isValid()?this[f+"s"]():NaN}function Ba(f){return function(){return this.isValid()?this._data[f]:NaN}}var qT=Ba("milliseconds"),GT=Ba("seconds"),JT=Ba("minutes"),ZT=Ba("hours"),QT=Ba("days"),XT=Ba("months"),eF=Ba("years");function tF(){return At(this.days()/7)}var Ti=Math.round,Eo={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function nF(f,p,w,S,F){return F.relativeTime(p||1,!!w,f,S)}function rF(f,p,w,S){var F=Zr(f).abs(),j=Ti(F.as("s")),se=Ti(F.as("m")),Pe=Ti(F.as("h")),ut=Ti(F.as("d")),$t=Ti(F.as("M")),lr=Ti(F.as("w")),Fi=Ti(F.as("y")),ia=j<=w.ss&&["s",j]||j0,ia[4]=S,nF.apply(null,ia)}function iF(f){return f===void 0?Ti:typeof f=="function"?(Ti=f,!0):!1}function aF(f,p){return Eo[f]===void 0?!1:p===void 0?Eo[f]:(Eo[f]=p,f==="s"&&(Eo.ss=p-1),!0)}function oF(f,p){if(!this.isValid())return this.localeData().invalidDate();var w=!1,S=Eo,F,j;return typeof f=="object"&&(p=f,f=!1),typeof f=="boolean"&&(w=f),typeof p=="object"&&(S=Object.assign({},Eo,p),p.s!=null&&p.ss==null&&(S.ss=p.s-1)),F=this.localeData(),j=rF(this,!w,S,F),w&&(j=F.pastFuture(+this,j)),F.postformat(j)}var Nf=Math.abs;function ko(f){return(f>0)-(f<0)||+f}function du(){if(!this.isValid())return this.localeData().invalidDate();var f=Nf(this._milliseconds)/1e3,p=Nf(this._days),w=Nf(this._months),S,F,j,se,Pe=this.asSeconds(),ut,$t,lr,Fi;return Pe?(S=At(f/60),F=At(S/60),f%=60,S%=60,j=At(w/12),w%=12,se=f?f.toFixed(3).replace(/\.?0+$/,""):"",ut=Pe<0?"-":"",$t=ko(this._months)!==ko(Pe)?"-":"",lr=ko(this._days)!==ko(Pe)?"-":"",Fi=ko(this._milliseconds)!==ko(Pe)?"-":"",ut+"P"+(j?$t+j+"Y":"")+(w?$t+w+"M":"")+(p?lr+p+"D":"")+(F||S||f?"T":"")+(F?Fi+F+"H":"")+(S?Fi+S+"M":"")+(f?Fi+se+"S":"")):"P0D"}var xt=iu.prototype;xt.isValid=Q1,xt.abs=IT,xt.add=AT,xt.subtract=OT,xt.as=PT,xt.asMilliseconds=RT,xt.asSeconds=HT,xt.asMinutes=BT,xt.asHours=VT,xt.asDays=$T,xt.asWeeks=UT,xt.asMonths=WT,xt.asQuarters=YT,xt.asYears=zT,xt.valueOf=NT,xt._bubble=LT,xt.clone=KT,xt.get=jT,xt.milliseconds=qT,xt.seconds=GT,xt.minutes=JT,xt.hours=ZT,xt.days=QT,xt.weeks=tF,xt.months=XT,xt.years=eF,xt.humanize=oF,xt.toISOString=du,xt.toString=du,xt.toJSON=du,xt.locale=zy,xt.localeData=jy,xt.toIsoString=B("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",du),xt.lang=Ky,N("X",0,0,"unix"),N("x",0,0,"valueOf"),ae("x",M),ae("X",ie),We("X",function(f,p,w){w._d=new Date(parseFloat(f)*1e3)}),We("x",function(f,p,w){w._d=new Date(Z(f))});return t.version="2.29.4",r(Zt),t.fn=we,t.min=q1,t.max=G1,t.now=J1,t.utc=m,t.unix=kT,t.months=CT,t.isDate=l,t.locale=na,t.invalid=D,t.duration=Zr,t.isMoment=A,t.weekdays=MT,t.parseZone=xT,t.localeData=Ci,t.isDuration=au,t.monthsShort=_T,t.weekdaysMin=FT,t.defineLocale=Ef,t.updateLocale=x1,t.locales=C1,t.weekdaysShort=TT,t.normalizeUnits=Vt,t.relativeTimeRounding=iF,t.relativeTimeThreshold=aF,t.calendarFormat=DM,t.prototype=we,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 dx=wn((Fd,_g)=>{(function(t,r){typeof Fd=="object"&&typeof _g=="object"?_g.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Fd=="object"?Fd.Choices=r():t.Choices=r()})(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:a})},r.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,i){if(i&1&&(n=r(n)),i&8||i&4&&typeof n=="object"&&n&&n.__esModule)return n;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:n}),i&2&&typeof n!="string")for(var o in n)r.d(a,o,function(s){return n[s]}.bind(null,o));return a},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="/public/assets/scripts/",r(r.s=4)}([function(e,t,r){"use strict";var n=function(x){return i(x)&&!a(x)};function i(C){return!!C&&typeof C=="object"}function a(C){var x=Object.prototype.toString.call(C);return x==="[object RegExp]"||x==="[object Date]"||u(C)}var o=typeof Symbol=="function"&&Symbol.for,s=o?Symbol.for("react.element"):60103;function u(C){return C.$$typeof===s}function l(C){return Array.isArray(C)?[]:{}}function c(C,x){return x.clone!==!1&&x.isMergeableObject(C)?D(l(C),C,x):C}function d(C,x,O){return C.concat(x).map(function(A){return c(A,O)})}function m(C,x){if(!x.customMerge)return D;var O=x.customMerge(C);return typeof O=="function"?O:D}function h(C){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(C).filter(function(x){return C.propertyIsEnumerable(x)}):[]}function g(C){return Object.keys(C).concat(h(C))}function y(C,x){try{return x in C&&!(Object.hasOwnProperty.call(C,x)&&Object.propertyIsEnumerable.call(C,x))}catch(O){return!1}}function v(C,x,O){var A={};return O.isMergeableObject(C)&&g(C).forEach(function(P){A[P]=c(C[P],O)}),g(x).forEach(function(P){y(C,P)||(!O.isMergeableObject(x[P])||!C[P]?A[P]=c(x[P],O):A[P]=m(P,O)(C[P],x[P],O))}),A}function D(C,x,O){O=O||{},O.arrayMerge=O.arrayMerge||d,O.isMergeableObject=O.isMergeableObject||n,O.cloneUnlessOtherwiseSpecified=c;var A=Array.isArray(x),P=Array.isArray(C),B=A===P;return B?A?O.arrayMerge(C,x,O):v(C,x,O):c(x,O)}D.all=function(x,O){if(!Array.isArray(x))throw new Error("first argument should be an array");return x.reduce(function(A,P){return D(A,P,O)},{})};var I=D;e.exports=I},function(e,t,r){"use strict";(function(n,i){var a=r(3),o;typeof self!="undefined"?o=self:typeof window!="undefined"?o=window:typeof n!="undefined"?o=n:o=i;var s=Object(a.a)(o);t.a=s}).call(this,r(5),r(6)(e))},function(e,t,r){(function(n,i){e.exports=i()})(this,function(){return function(n){var i={};function a(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=n,a.c=i,a.d=function(o,s,u){a.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:u})},a.r=function(o){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},a.t=function(o,s){if(1&s&&(o=a(o)),8&s||4&s&&typeof o=="object"&&o&&o.__esModule)return o;var u=Object.create(null);if(a.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:o}),2&s&&typeof o!="string")for(var l in o)a.d(u,l,function(c){return o[c]}.bind(null,l));return u},a.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(s,"a",s),s},a.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},a.p="",a(a.s=1)}([function(n,i){n.exports=function(a){return Array.isArray?Array.isArray(a):Object.prototype.toString.call(a)==="[object Array]"}},function(n,i,a){function o(m){return(o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h})(m)}function s(m,h){for(var g=0;g1&&arguments[1]!==void 0?arguments[1]:{limit:!1};this._log(`---------
+Search pattern: "`.concat(v,'"'));var I=this._prepareSearchers(v),C=I.tokenSearchers,x=I.fullSearcher,O=this._search(C,x),A=O.weights,P=O.results;return this._computeScore(A,P),this.options.shouldSort&&this._sort(P),D.limit&&typeof D.limit=="number"&&(P=P.slice(0,D.limit)),this._format(P)}},{key:"_prepareSearchers",value:function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",D=[];if(this.options.tokenize)for(var I=v.split(this.options.tokenSeparator),C=0,x=I.length;C0&&arguments[0]!==void 0?arguments[0]:[],D=arguments.length>1?arguments[1]:void 0,I=this.list,C={},x=[];if(typeof I[0]=="string"){for(var O=0,A=I.length;O1)throw new Error("Key weight has to be > 0 and <= 1");te=te.name}else P[te]={weight:1};this._analyze({key:te,value:this.options.getFn(J,te),record:J,index:B},{resultMap:C,results:x,tokenSearchers:v,fullSearcher:D})}return{weights:P,results:x}}},{key:"_analyze",value:function(v,D){var I=v.key,C=v.arrayIndex,x=C===void 0?-1:C,O=v.value,A=v.record,P=v.index,B=D.tokenSearchers,G=B===void 0?[]:B,J=D.fullSearcher,Q=J===void 0?[]:J,oe=D.resultMap,te=oe===void 0?{}:oe,re=D.results,ne=re===void 0?[]:re;if(O!=null){var be=!1,pe=-1,De=0;if(typeof O=="string"){this._log(`
+Key: `.concat(I===""?"-":I));var Ce=Q.search(O);if(this._log('Full text: "'.concat(O,'", score: ').concat(Ce.score)),this.options.tokenize){for(var U=O.split(this.options.tokenSeparator),Je=[],it=0;it-1&&(Jt=(Jt+pe)/2),this._log("Score average:",Jt);var en=!this.options.tokenize||!this.options.matchAllTokens||De>=G.length;if(this._log(`
+Check Matches: `.concat(en)),(be||Ce.isMatch)&&en){var gn=te[P];gn?gn.output.push({key:I,arrayIndex:x,value:O,score:Jt,matchedIndices:Ce.matchedIndices}):(te[P]={item:A,output:[{key:I,arrayIndex:x,value:O,score:Jt,matchedIndices:Ce.matchedIndices}]},ne.push(te[P]))}}else if(c(O))for(var yn=0,vn=O.length;yn-1&&(be.arrayIndex=ne.arrayIndex),Q.matches.push(be)}}}),this.options.includeScore&&C.push(function(J,Q){Q.score=J.score});for(var x=0,O=v.length;xD)return s(y,this.pattern,I);var C=this.options,x=C.location,O=C.distance,A=C.threshold,P=C.findAllMatches,B=C.minMatchCharLength;return u(y,this.pattern,this.patternAlphabet,{location:x,distance:O,threshold:A,findAllMatches:P,minMatchCharLength:B})}}])&&o(m.prototype,h),g&&o(m,g),d}();n.exports=c},function(n,i){var a=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;n.exports=function(o,s){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:/ +/g,l=new RegExp(s.replace(a,"\\$&").replace(u,"|")),c=o.match(l),d=!!c,m=[];if(d)for(var h=0,g=c.length;h=it;It-=1){var Mt=It-1,jt=c[u.charAt(Mt)];if(jt&&(Q[Mt]=1),Ze[It]=(Ze[It+1]<<1|1)&jt,Ce!==0&&(Ze[It]|=(ne[It+1]|ne[It])<<1|1|ne[It+1]),Ze[It]&De&&(be=o(l,{errors:Ce,currentLocation:Mt,expectedLocation:A,distance:y}))<=B){if(B=be,(G=Mt)<=A)break;it=Math.max(1,2*A-G)}}if(o(l,{errors:Ce+1,currentLocation:A,expectedLocation:A,distance:y})>B)break;ne=Ze}return{isMatch:G>=0,score:be===0?.001:be,matchedIndices:s(Q,O)}}},function(n,i){n.exports=function(a,o){var s=o.errors,u=s===void 0?0:s,l=o.currentLocation,c=l===void 0?0:l,d=o.expectedLocation,m=d===void 0?0:d,h=o.distance,g=h===void 0?100:h,y=u/a.length,v=Math.abs(m-c);return g?y+v/g:v?1:y}},function(n,i){n.exports=function(){for(var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=[],u=-1,l=-1,c=0,d=a.length;c=o&&s.push([u,l]),u=-1)}return a[c-1]&&c-u>=o&&s.push([u,c-1]),s}},function(n,i){n.exports=function(a){for(var o={},s=a.length,u=0;u0)return"Unexpected "+(Y.length>1?"keys":"key")+" "+('"'+Y.join('", "')+'" found in '+V+". ")+"Expected to find one of the known reducer keys instead: "+('"'+T.join('", "')+'". Unexpected keys will be ignored.')}function y(z){Object.keys(z).forEach(function(k){var _=z[k],b=_(void 0,{type:l.INIT});if(typeof b=="undefined")throw new Error('Reducer "'+k+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof _(void 0,{type:l.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+k+'" returned undefined when probed with a random type. '+("Don't try to handle "+l.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function v(z){for(var k=Object.keys(z),_={},b=0;b-1?z.map(function(_){var b=_;return b.id===parseInt(k.choiceId,10)&&(b.selected=!0),b}):z;case"REMOVE_ITEM":return k.choiceId>-1?z.map(function(_){var b=_;return b.id===parseInt(k.choiceId,10)&&(b.selected=!1),b}):z;case"FILTER_CHOICES":return z.map(function(_){var b=_;return b.active=k.results.some(function(T){var V=T.item,Y=T.score;return V.id===b.id?(b.score=Y,!0):!1}),b});case"ACTIVATE_CHOICES":return z.map(function(_){var b=_;return b.active=k.active,b});case"CLEAR_CHOICES":return te;default:return z}}var ne={loading:!1},be=function(k,_){switch(k===void 0&&(k=ne),_.type){case"SET_IS_LOADING":return{loading:_.isLoading};default:return k}},pe=be,De=function(k,_){return Math.floor(Math.random()*(_-k)+k)},Ce=function(k){return Array.from({length:k},function(){return De(0,36).toString(36)}).join("")},U=function(k,_){var b=k.id||k.name&&k.name+"-"+Ce(2)||Ce(4);return b=b.replace(/(:|\.|\[|\]|,)/g,""),b=_+"-"+b,b},Je=function(k){return Object.prototype.toString.call(k).slice(8,-1)},it=function(k,_){return _!=null&&Je(_)===k},N=function(k,_){return _===void 0&&(_=document.createElement("div")),k.nextSibling?k.parentNode.insertBefore(_,k.nextSibling):k.parentNode.appendChild(_),_.appendChild(k)},Ze=function(k,_,b){if(b===void 0&&(b=1),!(!(k instanceof Element)||typeof _!="string")){for(var T=(b>0?"next":"previous")+"ElementSibling",V=k[T];V;){if(V.matches(_))return V;V=V[T]}return V}},It=function(k,_,b){if(b===void 0&&(b=1),!k)return!1;var T;return b>0?T=_.scrollTop+_.offsetHeight>=k.offsetTop+k.offsetHeight:T=k.offsetTop>=_.scrollTop,T},Mt=function(k){return typeof k!="string"?k:k.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/"'+Mt(k)+'"'},maxItemText:function(k){return"Only "+k+" values can be added"},valueComparer:function(k,_){return k===_},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:Bt},rn={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"},At={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"},Z={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34},me="text",Ie="select-one",at="select-multiple",Dt=4,Cn=function(){function z(_){var b=_.element,T=_.type,V=_.classNames,Y=_.position;this.element=b,this.classNames=V,this.type=T,this.position=Y,this.isOpen=!1,this.isFlipped=!1,this.isFocussed=!1,this.isDisabled=!1,this.isLoading=!1,this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}var k=z.prototype;return k.addEventListeners=function(){this.element.addEventListener("focus",this._onFocus),this.element.addEventListener("blur",this._onBlur)},k.removeEventListeners=function(){this.element.removeEventListener("focus",this._onFocus),this.element.removeEventListener("blur",this._onBlur)},k.shouldFlip=function(b){if(typeof b!="number")return!1;var T=!1;return this.position==="auto"?T=!window.matchMedia("(min-height: "+(b+1)+"px)").matches:this.position==="top"&&(T=!0),T},k.setActiveDescendant=function(b){this.element.setAttribute("aria-activedescendant",b)},k.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},k.open=function(b){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(b)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)},k.close=function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)},k.focus=function(){this.isFocussed||this.element.focus()},k.addFocusState=function(){this.element.classList.add(this.classNames.focusState)},k.removeFocusState=function(){this.element.classList.remove(this.classNames.focusState)},k.enable=function(){this.element.classList.remove(this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===Ie&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},k.disable=function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===Ie&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},k.wrap=function(b){N(b,this.element)},k.unwrap=function(b){this.element.parentNode.insertBefore(b,this.element),this.element.parentNode.removeChild(this.element)},k.addLoadingState=function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},k.removeLoadingState=function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},k._onFocus=function(){this.isFocussed=!0},k._onBlur=function(){this.isFocussed=!1},z}();function _n(z,k){for(var _=0;_0?this.element.scrollTop+he-X:b.offsetTop;activeWindow.requestAnimationFrame(function(){V._animateScroll(Me,T)})}},k._scrollDown=function(b,T,V){var Y=(V-b)/T,X=Y>1?Y:1;this.element.scrollTop=b+X},k._scrollUp=function(b,T,V){var Y=(b-V)/T,X=Y>1?Y:1;this.element.scrollTop=b-X},k._animateScroll=function(b,T){var V=this,Y=Dt,X=this.element.scrollTop,le=!1;T>0?(this._scrollDown(X,Y,b),Xb&&(le=!0)),le&&activeWindow.requestAnimationFrame(function(){V._animateScroll(b,T)})},z}();function St(z,k){for(var _=0;_0?"treeitem":"option"),Object.assign(lt.dataset,{choice:"",id:Me,value:Ve,selectText:b}),qe?(lt.classList.add(le),lt.dataset.choiceDisabled="",lt.setAttribute("aria-disabled","true")):(lt.classList.add(Y),lt.dataset.choiceSelectable=""),lt},input:function(k,_){var b=k.input,T=k.inputCloned,V=Object.assign(document.createElement("input"),{type:"text",className:b+" "+T,autocomplete:"off",autocapitalize:"off",spellcheck:!1});return V.setAttribute("role","textbox"),V.setAttribute("aria-autocomplete","list"),V.setAttribute("aria-label",_),V},dropdown:function(k){var _=k.list,b=k.listDropdown,T=document.createElement("div");return T.classList.add(_,b),T.setAttribute("aria-expanded","false"),T},notice:function(k,_,b){var T=k.item,V=k.itemChoice,Y=k.noResults,X=k.noChoices;b===void 0&&(b="");var le=[T,V];return b==="no-choices"?le.push(X):b==="no-results"&&le.push(Y),Object.assign(document.createElement("div"),{innerHTML:_,className:le.join(" ")})},option:function(k){var _=k.label,b=k.value,T=k.customProperties,V=k.active,Y=k.disabled,X=new Option(_,b,!1,V);return T&&(X.dataset.customProperties=T),X.disabled=Y,X}},ye=ie,ce=function(k){var _=k.value,b=k.label,T=k.id,V=k.groupId,Y=k.disabled,X=k.elementId,le=k.customProperties,he=k.placeholder,Me=k.keyCode;return{type:At.ADD_CHOICE,value:_,label:b,id:T,groupId:V,disabled:Y,elementId:X,customProperties:le,placeholder:he,keyCode:Me}},ae=function(k){return{type:At.FILTER_CHOICES,results:k}},Se=function(k){return k===void 0&&(k=!0),{type:At.ACTIVATE_CHOICES,active:k}},nt=function(){return{type:At.CLEAR_CHOICES}},Te=function(k){var _=k.value,b=k.label,T=k.id,V=k.choiceId,Y=k.groupId,X=k.customProperties,le=k.placeholder,he=k.keyCode;return{type:At.ADD_ITEM,value:_,label:b,id:T,choiceId:V,groupId:Y,customProperties:X,placeholder:le,keyCode:he}},Ue=function(k,_){return{type:At.REMOVE_ITEM,id:k,choiceId:_}},We=function(k,_){return{type:At.HIGHLIGHT_ITEM,id:k,highlighted:_}},Ft=function(k){var _=k.value,b=k.id,T=k.active,V=k.disabled;return{type:At.ADD_GROUP,value:_,id:b,active:T,disabled:V}},Hn=function(){return{type:"CLEAR_ALL"}},Ot=function(k){return{type:"RESET_TO",state:k}},or=function(k){return{type:"SET_IS_LOADING",isLoading:k}};function sr(z,k){for(var _=0;_=0?this._store.getGroupById(X):null;return this._store.dispatch(We(V,!0)),T&&this.passedElement.triggerEvent(rn.highlightItem,{id:V,value:he,label:Ve,groupValue:Le&&Le.value?Le.value:null}),this},k.unhighlightItem=function(b){if(!b)return this;var T=b.id,V=b.groupId,Y=V===void 0?-1:V,X=b.value,le=X===void 0?"":X,he=b.label,Me=he===void 0?"":he,Ve=Y>=0?this._store.getGroupById(Y):null;return this._store.dispatch(We(T,!1)),this.passedElement.triggerEvent(rn.highlightItem,{id:T,value:le,label:Me,groupValue:Ve&&Ve.value?Ve.value:null}),this},k.highlightAll=function(){var b=this;return this._store.items.forEach(function(T){return b.highlightItem(T)}),this},k.unhighlightAll=function(){var b=this;return this._store.items.forEach(function(T){return b.unhighlightItem(T)}),this},k.removeActiveItemsByValue=function(b){var T=this;return this._store.activeItems.filter(function(V){return V.value===b}).forEach(function(V){return T._removeItem(V)}),this},k.removeActiveItems=function(b){var T=this;return this._store.activeItems.filter(function(V){var Y=V.id;return Y!==b}).forEach(function(V){return T._removeItem(V)}),this},k.removeHighlightedItems=function(b){var T=this;return b===void 0&&(b=!1),this._store.highlightedActiveItems.forEach(function(V){T._removeItem(V),b&&T._triggerChange(V.value)}),this},k.showDropdown=function(b){var T=this;return this.dropdown.isActive?this:(activeWindow.requestAnimationFrame(function(){T.dropdown.show(),T.containerOuter.open(T.dropdown.distanceFromTopWindow),!b&&T._canSearch&&T.input.focus(),T.passedElement.triggerEvent(rn.showDropdown,{})}),this)},k.hideDropdown=function(b){var T=this;return this.dropdown.isActive?(activeWindow.requestAnimationFrame(function(){T.dropdown.hide(),T.containerOuter.close(),!b&&T._canSearch&&(T.input.removeActiveDescendant(),T.input.blur()),T.passedElement.triggerEvent(rn.hideDropdown,{})}),this):this},k.getValue=function(b){b===void 0&&(b=!1);var T=this._store.activeItems.reduce(function(V,Y){var X=b?Y.value:Y;return V.push(X),V},[]);return this._isSelectOneElement?T[0]:T},k.setValue=function(b){var T=this;return this.initialised?(b.forEach(function(V){return T._setChoiceOrItem(V)}),this):this},k.setChoiceByValue=function(b){var T=this;if(!this.initialised||this._isTextElement)return this;var V=Array.isArray(b)?b:[b];return V.forEach(function(Y){return T._findAndSelectChoiceByValue(Y)}),this},k.setChoices=function(b,T,V,Y){var X=this;if(b===void 0&&(b=[]),T===void 0&&(T="value"),V===void 0&&(V="label"),Y===void 0&&(Y=!1),!this.initialised)throw new ReferenceError("setChoices was called on a non-initialized instance of Choices");if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if(typeof T!="string"||!T)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(Y&&this.clearChoices(),typeof b=="function"){var le=b(this);if(typeof Promise=="function"&&le instanceof Promise)return new Promise(function(he){return activeWindow.requestAnimationFrame(he)}).then(function(){return X._handleLoadingState(!0)}).then(function(){return le}).then(function(he){return X.setChoices(he,T,V,Y)}).catch(function(he){X.config.silent||console.error(he)}).then(function(){return X._handleLoadingState(!1)}).then(function(){return X});if(!Array.isArray(le))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: "+typeof le);return this.setChoices(le,T,V,!1)}if(!Array.isArray(b))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._startLoading(),b.forEach(function(he){he.choices?X._addGroup({id:parseInt(he.id,10)||null,group:he,valueKey:T,labelKey:V}):X._addChoice({value:he[T],label:he[V],isSelected:he.selected,isDisabled:he.disabled,customProperties:he.customProperties,placeholder:he.placeholder})}),this._stopLoading(),this},k.clearChoices=function(){return this._store.dispatch(nt()),this},k.clearStore=function(){return this._store.dispatch(Hn()),this},k.clearInput=function(){var b=!this._isSelectOneElement;return this.input.clear(b),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch(Se(!0))),this},k._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var b=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,T=this._isSelectElement,V=this._currentState.items!==this._prevState.items;b&&(T&&this._renderChoices(),V&&this._renderItems(),this._prevState=this._currentState)}},k._renderChoices=function(){var b=this,T=this._store,V=T.activeGroups,Y=T.activeChoices,X=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&activeWindow.requestAnimationFrame(function(){return b.choiceList.scrollToTop()}),V.length>=1&&!this._isSearching){var le=Y.filter(function(Qe){return Qe.placeholder===!0&&Qe.groupId===-1});le.length>=1&&(X=this._createChoicesFragment(le,X)),X=this._createGroupsFragment(V,Y,X)}else Y.length>=1&&(X=this._createChoicesFragment(Y,X));if(X.childNodes&&X.childNodes.length>0){var he=this._store.activeItems,Me=this._canAddItem(he,this.input.value);Me.response?(this.choiceList.append(X),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",Me.notice))}else{var Ve,Le;this._isSearching?(Le=typeof this.config.noResultsText=="function"?this.config.noResultsText():this.config.noResultsText,Ve=this._getTemplate("notice",Le,"no-results")):(Le=typeof this.config.noChoicesText=="function"?this.config.noChoicesText():this.config.noChoicesText,Ve=this._getTemplate("notice",Le,"no-choices")),this.choiceList.append(Ve)}},k._renderItems=function(){var b=this._store.activeItems||[];this.itemList.clear();var T=this._createItemsFragment(b);T.childNodes&&this.itemList.append(T)},k._createGroupsFragment=function(b,T,V){var Y=this;V===void 0&&(V=document.createDocumentFragment());var X=function(he){return T.filter(function(Me){return Y._isSelectOneElement?Me.groupId===he.id:Me.groupId===he.id&&(Y.config.renderSelectedChoices==="always"||!Me.selected)})};return this.config.shouldSort&&b.sort(this.config.sorter),b.forEach(function(le){var he=X(le);if(he.length>=1){var Me=Y._getTemplate("choiceGroup",le);V.appendChild(Me),Y._createChoicesFragment(he,V,!0)}}),V},k._createChoicesFragment=function(b,T,V){var Y=this;T===void 0&&(T=document.createDocumentFragment()),V===void 0&&(V=!1);var X=this.config,le=X.renderSelectedChoices,he=X.searchResultLimit,Me=X.renderChoiceLimit,Ve=this._isSearching?Wt:this.config.sorter,Le=function(Vn){var ki=le==="auto"?Y._isSelectOneElement||!Vn.selected:!0;if(ki){var kr=Y._getTemplate("choice",Vn,Y.config.itemSelectText);T.appendChild(kr)}},Qe=b;le==="auto"&&!this._isSelectOneElement&&(Qe=b.filter(function(On){return!On.selected}));var ot=Qe.reduce(function(On,Vn){return Vn.placeholder?On.placeholderChoices.push(Vn):On.normalChoices.push(Vn),On},{placeholderChoices:[],normalChoices:[]}),qe=ot.placeholderChoices,yt=ot.normalChoices;(this.config.shouldSort||this._isSearching)&&yt.sort(Ve);var st=Qe.length,lt=this._isSelectOneElement?[].concat(qe,yt):yt;this._isSearching?st=he:Me&&Me>0&&!V&&(st=Me);for(var qt=0;qt=Y){var he=X?this._searchChoices(b):0;this.passedElement.triggerEvent(rn.search,{value:b,resultCount:he})}else le&&(this._isSearching=!1,this._store.dispatch(Se(!0)))}},k._canAddItem=function(b,T){var V=!0,Y=typeof this.config.addItemText=="function"?this.config.addItemText(T):this.config.addItemText;if(!this._isSelectOneElement){var X=Jt(b,T);this.config.maxItemCount>0&&this.config.maxItemCount<=b.length&&(V=!1,Y=typeof this.config.maxItemText=="function"?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&X&&V&&(V=!1,Y=typeof this.config.uniqueItemText=="function"?this.config.uniqueItemText(T):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&V&&typeof this.config.addItemFilter=="function"&&!this.config.addItemFilter(T)&&(V=!1,Y=typeof this.config.customAddItemText=="function"?this.config.customAddItemText(T):this.config.customAddItemText)}return{response:V,notice:Y}},k._searchChoices=function(b){var T=typeof b=="string"?b.trim():b,V=typeof this._currentValue=="string"?this._currentValue.trim():this._currentValue;if(T.length<1&&T===V+" ")return 0;var Y=this._store.searchableChoices,X=T,le=[].concat(this.config.searchFields),he=Object.assign(this.config.fuseOptions,{keys:le}),Me=new i.a(Y,he),Ve=Me.search(X);return this._currentValue=T,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(ae(Ve)),Ve.length},k._addEventListeners=function(){var b=document,T=b.documentElement;T.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),T.addEventListener("click",this._onClick,{passive:!0}),T.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},k._removeEventListeners=function(){var b=document,T=b.documentElement;T.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),T.removeEventListener("click",this._onClick),T.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("keyup",this._onKeyUp),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},k._onKeyDown=function(b){var T,V=b.target,Y=b.keyCode,X=b.ctrlKey,le=b.metaKey,he=this._store.activeItems,Me=this.input.isFocussed,Ve=this.dropdown.isActive,Le=this.itemList.hasChildren(),Qe=String.fromCharCode(Y),ot=Z.BACK_KEY,qe=Z.DELETE_KEY,yt=Z.ENTER_KEY,st=Z.A_KEY,lt=Z.ESC_KEY,qt=Z.UP_KEY,On=Z.DOWN_KEY,Vn=Z.PAGE_UP_KEY,ki=Z.PAGE_DOWN_KEY,kr=X||le;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(Qe)&&this.showDropdown();var Jr=(T={},T[st]=this._onAKey,T[yt]=this._onEnterKey,T[lt]=this._onEscapeKey,T[qt]=this._onDirectionKey,T[Vn]=this._onDirectionKey,T[On]=this._onDirectionKey,T[ki]=this._onDirectionKey,T[qe]=this._onDeleteKey,T[ot]=this._onDeleteKey,T);Jr[Y]&&Jr[Y]({event:b,target:V,keyCode:Y,metaKey:le,activeItems:he,hasFocusedInput:Me,hasActiveDropdown:Ve,hasItems:Le,hasCtrlDownKeyPressed:kr})},k._onKeyUp=function(b){var T=b.target,V=b.keyCode,Y=this.input.value,X=this._store.activeItems,le=this._canAddItem(X,Y),he=Z.BACK_KEY,Me=Z.DELETE_KEY;if(this._isTextElement){var Ve=le.notice&&Y;if(Ve){var Le=this._getTemplate("notice",le.notice);this.dropdown.element.innerHTML=Le.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0)}else{var Qe=(V===he||V===Me)&&!T.value,ot=!this._isTextElement&&this._isSearching,qe=this._canSearch&&le.response;Qe&&ot?(this._isSearching=!1,this._store.dispatch(Se(!0))):qe&&this._handleSearch(this.input.value)}this._canSearch=this.config.searchEnabled},k._onAKey=function(b){var T=b.hasItems,V=b.hasCtrlDownKeyPressed;if(V&&T){this._canSearch=!1;var Y=this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement;Y&&this.highlightAll()}},k._onEnterKey=function(b){var T=b.event,V=b.target,Y=b.activeItems,X=b.hasActiveDropdown,le=Z.ENTER_KEY,he=V.hasAttribute("data-button");if(this._isTextElement&&V.value){var Me=this.input.value,Ve=this._canAddItem(Y,Me);Ve.response&&(this.hideDropdown(!0),this._addItem({value:Me}),this._triggerChange(Me),this.clearInput())}if(he&&(this._handleButtonAction(Y,V),T.preventDefault()),X){var Le=this.dropdown.getChild("."+this.config.classNames.highlightedState);Le&&(Y[0]&&(Y[0].keyCode=le),this._handleChoiceAction(Y,Le)),T.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),T.preventDefault())},k._onEscapeKey=function(b){var T=b.hasActiveDropdown;T&&(this.hideDropdown(!0),this.containerOuter.focus())},k._onDirectionKey=function(b){var T=b.event,V=b.hasActiveDropdown,Y=b.keyCode,X=b.metaKey,le=Z.DOWN_KEY,he=Z.PAGE_UP_KEY,Me=Z.PAGE_DOWN_KEY;if(V||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var Ve=Y===le||Y===Me?1:-1,Le=X||Y===Me||Y===he,Qe="[data-choice-selectable]",ot;if(Le)Ve>0?ot=this.dropdown.element.querySelector(Qe+":last-of-type"):ot=this.dropdown.element.querySelector(Qe);else{var qe=this.dropdown.element.querySelector("."+this.config.classNames.highlightedState);qe?ot=Ze(qe,Qe,Ve):ot=this.dropdown.element.querySelector(Qe)}ot&&(It(ot,this.choiceList.element,Ve)||this.choiceList.scrollToChildElement(ot,Ve),this._highlightChoice(ot)),T.preventDefault()}},k._onDeleteKey=function(b){var T=b.event,V=b.target,Y=b.hasFocusedInput,X=b.activeItems;Y&&!V.value&&!this._isSelectOneElement&&(this._handleBackspace(X),T.preventDefault())},k._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},k._onTouchEnd=function(b){var T=b||b.touches[0],V=T.target,Y=this._wasTap&&this.containerOuter.element.contains(V);if(Y){var X=V===this.containerOuter.element||V===this.containerInner.element;X&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),b.stopPropagation()}this._wasTap=!0},k._onMouseDown=function(b){var T=b.target;if(T instanceof HTMLElement){if(Bn&&this.choiceList.element.contains(T)){var V=this.choiceList.element.firstElementChild,Y=this._direction==="ltr"?b.offsetX>=V.offsetWidth:b.offsetX0;Y&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0)}},k._onFocus=function(b){var T=this,V,Y=b.target,X=this.containerOuter.element.contains(Y);if(X){var le=(V={},V[me]=function(){Y===T.input.element&&T.containerOuter.addFocusState()},V[Ie]=function(){T.containerOuter.addFocusState(),Y===T.input.element&&T.showDropdown(!0)},V[at]=function(){Y===T.input.element&&(T.showDropdown(!0),T.containerOuter.addFocusState())},V);le[this.passedElement.element.type]()}},k._onBlur=function(b){var T=this,V=b.target,Y=this.containerOuter.element.contains(V);if(Y&&!this._isScrollingOnIe){var X,le=this._store.activeItems,he=le.some(function(Ve){return Ve.highlighted}),Me=(X={},X[me]=function(){V===T.input.element&&(T.containerOuter.removeFocusState(),he&&T.unhighlightAll(),T.hideDropdown(!0))},X[Ie]=function(){T.containerOuter.removeFocusState(),(V===T.input.element||V===T.containerOuter.element&&!T._canSearch)&&T.hideDropdown(!0)},X[at]=function(){V===T.input.element&&(T.containerOuter.removeFocusState(),T.hideDropdown(!0),he&&T.unhighlightAll())},X);Me[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()},k._onFormReset=function(){this._store.dispatch(Ot(this._initialState))},k._highlightChoice=function(b){var T=this;b===void 0&&(b=null);var V=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(V.length){var Y=b,X=Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState));X.forEach(function(le){le.classList.remove(T.config.classNames.highlightedState),le.setAttribute("aria-selected","false")}),Y?this._highlightPosition=V.indexOf(Y):(V.length>this._highlightPosition?Y=V[this._highlightPosition]:Y=V[V.length-1],Y||(Y=V[0])),Y.classList.add(this.config.classNames.highlightedState),Y.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(rn.highlightChoice,{el:Y}),this.dropdown.isActive&&(this.input.setActiveDescendant(Y.id),this.containerOuter.setActiveDescendant(Y.id))}},k._addItem=function(b){var T=b.value,V=b.label,Y=V===void 0?null:V,X=b.choiceId,le=X===void 0?-1:X,he=b.groupId,Me=he===void 0?-1:he,Ve=b.customProperties,Le=Ve===void 0?null:Ve,Qe=b.placeholder,ot=Qe===void 0?!1:Qe,qe=b.keyCode,yt=qe===void 0?null:qe,st=typeof T=="string"?T.trim():T,lt=yt,qt=Le,On=this._store.items,Vn=Y||st,ki=le||-1,kr=Me>=0?this._store.getGroupById(Me):null,Jr=On?On.length+1:1;return this.config.prependValue&&(st=this.config.prependValue+st.toString()),this.config.appendValue&&(st+=this.config.appendValue.toString()),this._store.dispatch(Te({value:st,label:Vn,id:Jr,choiceId:ki,groupId:Me,customProperties:Le,placeholder:ot,keyCode:lt})),this._isSelectOneElement&&this.removeActiveItems(Jr),this.passedElement.triggerEvent(rn.addItem,{id:Jr,value:st,label:Vn,customProperties:qt,groupValue:kr&&kr.value?kr.value:void 0,keyCode:lt}),this},k._removeItem=function(b){if(!b||!it("Object",b))return this;var T=b.id,V=b.value,Y=b.label,X=b.choiceId,le=b.groupId,he=le>=0?this._store.getGroupById(le):null;return this._store.dispatch(Ue(T,X)),he&&he.value?this.passedElement.triggerEvent(rn.removeItem,{id:T,value:V,label:Y,groupValue:he.value}):this.passedElement.triggerEvent(rn.removeItem,{id:T,value:V,label:Y}),this},k._addChoice=function(b){var T=b.value,V=b.label,Y=V===void 0?null:V,X=b.isSelected,le=X===void 0?!1:X,he=b.isDisabled,Me=he===void 0?!1:he,Ve=b.groupId,Le=Ve===void 0?-1:Ve,Qe=b.customProperties,ot=Qe===void 0?null:Qe,qe=b.placeholder,yt=qe===void 0?!1:qe,st=b.keyCode,lt=st===void 0?null:st;if(!(typeof T=="undefined"||T===null)){var qt=this._store.choices,On=Y||T,Vn=qt?qt.length+1:1,ki=this._baseId+"-"+this._idNames.itemChoice+"-"+Vn;this._store.dispatch(ce({id:Vn,groupId:Le,elementId:ki,value:T,label:On,disabled:Me,customProperties:ot,placeholder:yt,keyCode:lt})),le&&this._addItem({value:T,label:On,choiceId:Vn,customProperties:ot,placeholder:yt,keyCode:lt})}},k._addGroup=function(b){var T=this,V=b.group,Y=b.id,X=b.valueKey,le=X===void 0?"value":X,he=b.labelKey,Me=he===void 0?"label":he,Ve=it("Object",V)?V.choices:Array.from(V.getElementsByTagName("OPTION")),Le=Y||Math.floor(new Date().valueOf()*Math.random()),Qe=V.disabled?V.disabled:!1;if(Ve){this._store.dispatch(Ft({value:V.label,id:Le,active:!0,disabled:Qe}));var ot=function(yt){var st=yt.disabled||yt.parentNode&&yt.parentNode.disabled;T._addChoice({value:yt[le],label:it("Object",yt)?yt[Me]:yt.innerHTML,isSelected:yt.selected,isDisabled:st,groupId:Le,customProperties:yt.customProperties,placeholder:yt.placeholder})};Ve.forEach(ot)}else this._store.dispatch(Ft({value:V.label,id:V.id,active:!1,disabled:V.disabled}))},k._getTemplate=function(b){var T;if(!b)return null;for(var V=this.config.classNames,Y=arguments.length,X=new Array(Y>1?Y-1:0),le=1;le{var IH=typeof Element!="undefined",AH=typeof Map=="function",OH=typeof Set=="function",LH=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function jd(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,i;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!jd(e[n],t[n]))return!1;return!0}var a;if(AH&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;for(a=e.entries();!(n=a.next()).done;)if(!jd(n.value[1],t.get(n.value[0])))return!1;return!0}if(OH&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(LH&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;if(IH&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((i[n]==="_owner"||i[n]==="__v"||i[n]==="__o")&&e.$$typeof)&&!jd(e[i[n]],t[i[n]]))return!1;return!0}return e!==e&&t!==t}pC.exports=function(t,r){try{return jd(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}});var S_=wn((Gne,Dy)=>{(function(){var e;typeof Dy!="undefined"?e=Dy.exports=n:e=function(){return this||(0,eval)("this")}(),e.format=n,e.vsprintf=r,typeof console!="undefined"&&typeof console.log=="function"&&(e.printf=t);function t(){console.log(n.apply(null,arguments))}function r(i,a){return n.apply(null,[i].concat(a))}function n(i){for(var a=1,o=[].slice.call(arguments),s=0,u=i.length,l="",c,d=!1,m,h,g=!1,y,v=function(){return o[a++]},D=function(){for(var I="";/\d/.test(i[s]);)I+=i[s++],c=i[s];return I.length>0?parseInt(I):null};swf});module.exports=ov(HB);function fu(e,t){let r=Object.keys(t).map(n=>mF(e,n,t[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function mF(e,t,r){let n=e[t],i=e.hasOwnProperty(t),a=r(n);return n&&Object.setPrototypeOf(a,n),Object.setPrototypeOf(o,a),e[t]=o,s;function o(...u){return a===n&&e[t]===o&&s(),a.apply(this,u)}function s(){e[t]===o&&(i?e[t]=n:delete e[t]),a!==n&&(a=n,Object.setPrototypeOf(o,n||Function))}}var Rn=require("obsidian");var Ws,Xe,cv,pF,Va,sv,dv,Hf,Wf,Bf,Vf,fv,Us={},hv=[],gF=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,pu=Array.isArray;function Ii(e,t){for(var r in t)e[r]=t[r];return e}function mv(e){var t=e.parentNode;t&&t.removeChild(e)}function xr(e,t,r){var n,i,a,o={};for(a in t)a=="key"?n=t[a]:a=="ref"?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?Ws.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return $s(e,o,n,i,null)}function $s(e,t,r,n,i){var a={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i==null?++cv:i,__i:-1,__u:0};return i==null&&Xe.vnode!=null&&Xe.vnode(a),a}function Yf(){return{current:null}}function ct(e){return e.children}function Br(e,t){this.props=e,this.context=t}function $a(e,t){if(t==null)return e.__?$a(e.__,e.__i+1):null;for(var r;tt&&Va.sort(Hf));mu.__r=0}function gv(e,t,r,n,i,a,o,s,u,l,c){var d,m,h,g,y,v=n&&n.__k||hv,D=t.length;for(r.__d=u,yF(r,t,v),u=r.__d,d=0;d0?$s(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,s=vF(i,r,o,c),i.__i=s,a=null,s!==-1&&(c--,(a=r[s])&&(a.__u|=131072)),a==null||a.__v===null?(s==-1&&d--,typeof i.type!="function"&&(i.__u|=65536)):s!==o&&(s===o+1?d++:s>o?c>u-o?d+=s-o:d--:s(u!=null&&!(131072&u.__u)?1:0))for(;o>=0||s=0){if((u=t[o])&&!(131072&u.__u)&&i==u.key&&a===u.type)return o;o--}if(s2&&(s.children=arguments.length>3?Ws.call(arguments,2):r),$s(e.type,s,n||e.key,i||e.ref,null)}function aa(e,t){var r={__c:t="__cC"+fv++,__:e,Consumer:function(n,i){return n.children(i)},Provider:function(n){var i,a;return this.getChildContext||(i=[],(a={})[t]=this,this.getChildContext=function(){return a},this.shouldComponentUpdate=function(o){this.props.value!==o.value&&i.some(function(s){s.__e=!0,$f(s)})},this.sub=function(o){i.push(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){i.splice(i.indexOf(o),1),s&&s.call(o)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}Ws=hv.slice,Xe={__e:function(e,t,r,n){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),o=i.__d),o)return i.__E=i}catch(s){e=s}throw e}},cv=0,pF=function(e){return e!=null&&e.constructor==null},Br.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Ii({},this.state),typeof e=="function"&&(e=e(Ii({},r),this.props)),e&&Ii(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),$f(this))},Br.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$f(this))},Br.prototype.render=ct,Va=[],dv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):activeWindow.setTimeout,Hf=function(e,t){return e.__v.__b-t.__v.__b},mu.__r=0,Wf=0,Bf=uv(!1),Vf=uv(!0),fv=0;var oa,Qt,qf,bv,Co=0,Mv=[],gu=[],an=Xe,Dv=an.__b,Sv=an.__r,Ev=an.diffed,kv=an.__c,xv=an.unmount,Cv=an.__;function _o(e,t){an.__h&&an.__h(Qt,e,Co||t),Co=0;var r=Qt.__H||(Qt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:gu}),r.__[e]}function Ne(e){return Co=1,Jf(Av,e)}function Jf(e,t,r){var n=_o(oa++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Av(void 0,t),function(s){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,s);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=Qt,!Qt.u)){var i=function(s,u,l){if(!n.__c.__H)return!0;var c=n.__c.__H.__.filter(function(m){return!!m.__c});if(c.every(function(m){return!m.__N}))return!a||a.call(this,s,u,l);var d=!1;return c.forEach(function(m){if(m.__N){var h=m.__[0];m.__=m.__N,m.__N=void 0,h!==m.__[0]&&(d=!0)}}),!(!d&&n.__c.props===s)&&(!a||a.call(this,s,u,l))};Qt.u=!0;var a=Qt.shouldComponentUpdate,o=Qt.componentWillUpdate;Qt.componentWillUpdate=function(s,u,l){if(this.__e){var c=a;a=void 0,i(s,u,l),a=c}o&&o.call(this,s,u,l)},Qt.shouldComponentUpdate=i}return n.__N||n.__}function Ae(e,t){var r=_o(oa++,3);!an.__s&&Zf(r.__H,t)&&(r.__=e,r.i=t,Qt.__H.__h.push(r))}function Ai(e,t){var r=_o(oa++,4);!an.__s&&Zf(r.__H,t)&&(r.__=e,r.i=t,Qt.__h.push(r))}function Fe(e){return Co=5,Re(function(){return{current:e}},[])}function Tv(e,t,r){Co=6,Ai(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function Re(e,t){var r=_o(oa++,7);return Zf(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function Ye(e,t){return Co=8,Re(function(){return e},t)}function Ee(e){var t=Qt.context[e.__c],r=_o(oa++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(Qt)),t.props.value):e.__}function Fv(e,t){an.useDebugValue&&an.useDebugValue(t?t(e):e)}function Iv(){var e=_o(oa++,11);if(!e.__){for(var t=Qt.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function DF(){for(var e;e=Mv.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(yu),e.__H.__h.forEach(Gf),e.__H.__h=[]}catch(t){e.__H.__h=[],an.__e(t,e.__v)}}an.__b=function(e){Qt=null,Dv&&Dv(e)},an.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Cv&&Cv(e,t)},an.__r=function(e){Sv&&Sv(e),oa=0;var t=(Qt=e.__c).__H;t&&(qf===Qt?(t.__h=[],Qt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=gu,r.__N=r.i=void 0})):(t.__h.forEach(yu),t.__h.forEach(Gf),t.__h=[],oa=0)),qf=Qt},an.diffed=function(e){Ev&&Ev(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Mv.push(t)!==1&&bv===an.requestAnimationFrame||((bv=an.requestAnimationFrame)||SF)(DF)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==gu&&(r.__=r.__V),r.i=void 0,r.__V=gu})),qf=Qt=null},an.__c=function(e,t){t.some(function(r){try{r.__h.forEach(yu),r.__h=r.__h.filter(function(n){return!n.__||Gf(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],an.__e(n,r.__v)}}),kv&&kv(e,t)},an.unmount=function(e){xv&&xv(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{yu(n)}catch(i){t=i}}),r.__H=void 0,t&&an.__e(t,r.__v))};var _v=typeof activeWindow.requestAnimationFrame=="function";function SF(e){var t,r=function(){activeWindow.clearTimeout(n),_v&&activeWindow.cancelAnimationFrame(t),activeWindow.setTimeout(e)},n=activeWindow.setTimeout(r,100);_v&&(t=activeWindow.requestAnimationFrame(r))}function yu(e){var t=Qt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Qt=t}function Gf(e){var t=Qt;e.__c=e.__(),Qt=t}function Zf(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Av(e,t){return typeof t=="function"?t(e):t}function $v(e,t){for(var r in t)e[r]=t[r];return e}function Xf(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function eh(e,t){this.props=e,this.context=t}function zt(e,t){function r(i){var a=this.props.ref,o=a==i.ref;return!o&&a&&(a.call?a(null):a.current=null),t?!t(this.props,i)||!o:Xf(this.props,i)}function n(i){return this.shouldComponentUpdate=r,xr(e,i)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}(eh.prototype=new Br).isPureReactComponent=!0,eh.prototype.shouldComponentUpdate=function(e,t){return Xf(this.props,e)||Xf(this.state,t)};var Ov=Xe.__b;Xe.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ov&&Ov(e)};var EF=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function kF(e){function t(r){var n=$v({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=EF,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Lv=function(e,t){return e==null?null:fi(fi(e).map(t))},xF={map:Lv,forEach:Lv,count:function(e){return e?fi(e).length:0},only:function(e){var t=fi(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:fi},CF=Xe.__e;Xe.__e=function(e,t,r,n){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t)}CF(e,t,r,n)};var Pv=Xe.unmount;function Uv(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=$v({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return Uv(n,t,r)})),e}function Wv(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Wv(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function vu(){this.__u=0,this.t=null,this.__b=null}function Yv(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function _F(e){var t,r,n;function i(a){if(t||(t=e()).then(function(o){r=o.default||o},function(o){n=o}),n)throw n;if(!r)throw t;return xr(r,a)}return i.displayName="Lazy",i.__f=!0,i}function Ys(){this.u=null,this.o=null}Xe.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Pv&&Pv(e)},(vu.prototype=new Br).__c=function(e,t){var r=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(r);var i=Yv(n.__v),a=!1,o=function(){a||(a=!0,r.__R=null,i?i(s):s())};r.__R=o;var s=function(){if(!--n.__u){if(n.state.__a){var u=n.state.__a;n.__v.__k[0]=Wv(u,u.__c.__P,u.__c.__O)}var l;for(n.setState({__a:n.__b=null});l=n.t.pop();)l.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(o,o)},vu.prototype.componentWillUnmount=function(){this.t=[]},vu.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=Uv(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&xr(ct,null,e.fallback);return i&&(i.__u&=-33),[xr(ct,null,t.__a?null:e.children),i]};var Nv=function(e,t,r){if(++r[1]===r[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(r=e.u;r;){for(;r.length>3;)r.pop()();if(r[1]>>1,1),t.i.removeChild(n)}}),xo(xr(MF,{context:t.context},e.__v),t.l)}function Oi(e,t){var r=xr(TF,{__v:e,i:t});return r.containerInfo=t,r}(Ys.prototype=new Br).__a=function(e){var t=this,r=Yv(t.__v),n=t.o.get(e);return n[0]++,function(i){var a=function(){t.props.revealOrder?(n.push(i),Nv(t,e,n)):i()};r?r(a):a()}},Ys.prototype.render=function(e){this.u=null,this.o=new Map;var t=fi(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.o.set(t[r],this.u=[1,0,this.u]);return e.children},Ys.prototype.componentDidUpdate=Ys.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,r){Nv(e,r,t)})};var zv=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,FF=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,IF=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,AF=/[A-Z0-9]/g,OF=typeof document!="undefined",LF=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Li(e,t,r){return t.__k==null&&(t.textContent=""),xo(e,t),typeof r=="function"&&r(),e?e.__c:null}function PF(e,t,r){return jf(e,t),typeof r=="function"&&r(),e?e.__c:null}Br.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Br.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Rv=Xe.event;function NF(){}function RF(){return this.cancelBubble}function HF(){return this.defaultPrevented}Xe.event=function(e){return Rv&&(e=Rv(e)),e.persist=NF,e.isPropagationStopped=RF,e.isDefaultPrevented=HF,e.nativeEvent=e};var th,BF={enumerable:!1,configurable:!0,get:function(){return this.class}},Hv=Xe.vnode;Xe.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={};for(var a in r){var o=r[a];if(!(a==="value"&&"defaultValue"in r&&o==null||OF&&a==="children"&&n==="noscript"||a==="class"||a==="className")){var s=a.toLowerCase();a==="defaultValue"&&"value"in r&&r.value==null?a="value":a==="download"&&o===!0?o="":s==="translate"&&o==="no"?o=!1:s==="ondoubleclick"?a="ondblclick":s!=="onchange"||n!=="input"&&n!=="textarea"||LF(r.type)?s==="onfocus"?a="onfocusin":s==="onblur"?a="onfocusout":IF.test(a)?a=s:n.indexOf("-")===-1&&FF.test(a)?a=a.replace(AF,"-$&").toLowerCase():o===null&&(o=void 0):s=a="oninput",s==="oninput"&&i[a=s]&&(a="oninputCapture"),i[a]=o}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=fi(r.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=fi(r.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value})),r.class&&!r.className?(i.class=r.class,Object.defineProperty(i,"className",BF)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=zv,Hv&&Hv(e)};var Bv=Xe.__r;Xe.__r=function(e){Bv&&Bv(e),th=e.__c};var Vv=Xe.diffed;Xe.diffed=function(e){Vv&&Vv(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),th=null};var VF={ReactCurrentDispatcher:{current:{readContext:function(e){return th.__n[e.__c].props.value}}}};function $F(e){return xr.bind(null,e)}function wu(e){return!!e&&e.$$typeof===zv}function UF(e){return wu(e)&&e.type===ct}function WF(e){return!!e&&!!e.displayName&&(typeof e.displayName=="string"||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function YF(e){return wu(e)?wv.apply(null,arguments):e}function Pi(e){return!!e.__k&&(xo(null,e),!0)}function zF(e){return e&&(e.base||e.nodeType===1&&e)||null}var KF=function(e,t){return e(t)},jF=function(e,t){return e(t)},qF=ct;function Kv(e){e()}function GF(e){return e}function JF(){return[!1,Kv]}var ZF=Ai,QF=wu;function XF(e,t){var r=t(),n=Ne({h:{__:r,v:t}}),i=n[0].h,a=n[1];return Ai(function(){i.__=r,i.v=t,Qf(i)&&a({h:i})},[e,r,t]),Ae(function(){return Qf(i)&&a({h:i}),e(function(){Qf(i)&&a({h:i})})},[e]),r}function Qf(e){var t,r,n=e.v,i=e.__;try{var a=n();return!((t=i)===(r=a)&&(t!==0||1/t==1/r)||t!=t&&r!=r)}catch(o){return!0}}var $e={useState:Ne,useId:Iv,useReducer:Jf,useEffect:Ae,useLayoutEffect:Ai,useInsertionEffect:ZF,useTransition:JF,useDeferredValue:GF,useSyncExternalStore:XF,startTransition:Kv,useRef:Fe,useImperativeHandle:Tv,useMemo:Re,useCallback:Ye,useContext:Ee,useDebugValue:Fv,version:"17.0.2",Children:xF,render:Li,hydrate:PF,unmountComponentAtNode:Pi,createPortal:Oi,createElement:xr,createContext:aa,createFactory:$F,cloneElement:YF,createRef:Yf,Fragment:ct,isValidElement:wu,isElement:QF,isFragment:UF,isMemo:WF,findDOMNode:zF,Component:Br,PureComponent:eh,memo:zt,forwardRef:kF,flushSync:jF,unstable_batchedUpdates:KF,StrictMode:qF,Suspense:vu,SuspenseList:Ys,lazy:_F,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:VF};function Ge(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,n;rn===i.length-1?r!==t[n]:r===t[n])}function SI(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function js(e,t){if(SI(e,t))return 2;if(!DI(e,t))return 3;let r=e.length-1;return e[r]=0;n--)r={children:{[e[n]]:r}};return r}function qs(e,t){let r=t;for(let n=e.length-2;n>=0;n--)r={children:{[e[n]]:r}};return r}function iw(e,t){let r=t?[e.last(),1,t]:[e.last(),1];return qs(e,{children:{$splice:[r]}})}function aw(e,t,r=0){return qs(e,{children:{$splice:[[e.last()+r,0,...t]]}})}function xI(e,t){return qs(e,{children:{$push:t}})}function CI(e,t){return qs(e,{children:{$unshift:t}})}function Ri(e,t,r,n,i){let a=n?n(un(e,t)):un(e,t),s=js(t,r)===1?-1:0,u=i==null?void 0:i(un(e,t)),l=iw(t,u),c=aw(r,Array.isArray(a)?a:[a],s),d=(0,rw.default)(l,c,{isMergeableObject:h=>Ni(h)||Array.isArray(h)});return(0,la.default)(e,d)}function mi(e,t,r){return(0,la.default)(e,iw(t,r))}function Xr(e,t,r){return(0,la.default)(e,aw(t,r))}function ah(e,t,r){return(0,la.default)(e,xI(t,r))}function ow(e,t,r){return(0,la.default)(e,CI(t,r))}function Du(e,t,r){return(0,la.default)(e,kI(t,r))}function oh(e,t,r){return(0,la.default)(e,qs(t,r))}var Gs=["MO","TU","WE","TH","FR","SA","SU"],Mn=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(Gs.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=Gs[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 Gt=function(e){return e!=null},Cr=function(e){return typeof e=="number"},sh=function(e){return typeof e=="string"&&Gs.includes(e)},$n=Array.isArray,$r=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+=wt(r,t/r.length)),r.slice(0,t)+String(n))}var lw=function(e,t,r){var n=e.split(t);return r?n.slice(0,r).concat([n.slice(r).join(t)]):n},qn=function(e,t){var r=e%t;return r*t<0?r+t:r},Su=function(e,t){return{div:Math.floor(e/t),mod:qn(e,t)}},_r=function(e){return!Gt(e)||e.length===0},bn=function(e){return!_r(e)},Et=function(e,t){return bn(e)&&e.indexOf(t)!==-1};var pi=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))},_I=[31,28,31,30,31,30,31,31,30,31,30,31],cw=1e3*60*60*24,Eu=9999,dw=pi(1970,1,1),MI=[6,0,1,2,3,4,5];var To=function(e){return e%4===0&&e%100!==0||e%400===0},lh=function(e){return e instanceof Date},Ya=function(e){return lh(e)&&!isNaN(e.getTime())};var TI=function(e,t){var r=e.getTime(),n=t.getTime(),i=r-n;return Math.round(i/cw)},Js=function(e){return TI(e,dw)},ku=function(e){return new Date(dw.getTime()+e*cw)},FI=function(e){var t=e.getUTCMonth();return t===1&&To(e.getUTCFullYear())?29:_I[t]},Hi=function(e){return MI[e.getUTCDay()]},uh=function(e,t){var r=pi(e,t+1,1);return[Hi(r),FI(r)]},xu=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()))},Cu=function(e){var t=new Date(e.getTime());return t},ch=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}(),Vi=II;var dh=function(e,t){return dh=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])},dh(e,t)};function Io(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");dh(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Un=function(){return Un=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0&&a[a.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[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 hw(){for(var e=[],t=0;tt[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 Qs(e,t){t===void 0&&(t=za);var r={},n=new HI(t.tokens);if(!n.start(e))return null;return i(),r;function i(){n.expect("every");var m=n.acceptNumber();if(m&&(r.interval=parseInt(m[0],10)),n.isDone())throw new Error("Unexpected end");switch(n.symbol){case"day(s)":r.freq=Oe.DAILY,n.nextSymbol()&&(o(),d());break;case"weekday(s)":r.freq=Oe.WEEKLY,r.byweekday=[Oe.MO,Oe.TU,Oe.WE,Oe.TH,Oe.FR],n.nextSymbol(),o(),d();break;case"week(s)":r.freq=Oe.WEEKLY,n.nextSymbol()&&(a(),o(),d());break;case"hour(s)":r.freq=Oe.HOURLY,n.nextSymbol()&&(a(),d());break;case"minute(s)":r.freq=Oe.MINUTELY,n.nextSymbol()&&(a(),d());break;case"month(s)":r.freq=Oe.MONTHLY,n.nextSymbol()&&(a(),d());break;case"year(s)":r.freq=Oe.YEARLY,n.nextSymbol()&&(a(),d());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":r.freq=Oe.WEEKLY;var h=n.symbol.substr(0,2).toUpperCase();if(r.byweekday=[Oe[h]],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var g=u();if(!g)throw new Error("Unexpected symbol "+n.symbol+", expected weekday");r.byweekday.push(Oe[g]),n.nextSymbol()}o(),c(),d();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=Oe.YEARLY,r.bymonth=[s()],!n.nextSymbol())return;for(;n.accept("comma");){if(n.isDone())throw new Error("Unexpected end");var y=s();if(!y)throw new Error("Unexpected symbol "+n.symbol+", expected month");r.bymonth.push(y),n.nextSymbol()}a(),d();break;default:throw new Error("Unknown symbol")}}function a(){var m=n.accept("on"),h=n.accept("the");if(m||h)do{var g=l(),y=u(),v=s();if(g)y?(n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Oe[y].nth(g))):(r.bymonthday||(r.bymonthday=[]),r.bymonthday.push(g),n.accept("day(s)"));else if(y)n.nextSymbol(),r.byweekday||(r.byweekday=[]),r.byweekday.push(Oe[y]);else if(n.symbol==="weekday(s)")n.nextSymbol(),r.byweekday||(r.byweekday=[Oe.MO,Oe.TU,Oe.WE,Oe.TH,Oe.FR]);else if(n.symbol==="week(s)"){n.nextSymbol();var D=n.acceptNumber();if(!D)throw new Error("Unexpected symbol "+n.symbol+", expected week number");for(r.byweekno=[parseInt(D[0],10)];n.accept("comma");){if(D=n.acceptNumber(),!D)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.byweekno.push(parseInt(D[0],10))}}else if(v)n.nextSymbol(),r.bymonth||(r.bymonth=[]),r.bymonth.push(v);else return}while(n.accept("comma")||n.accept("the")||n.accept("on"))}function o(){var m=n.accept("at");if(m)do{var h=n.acceptNumber();if(!h)throw new Error("Unexpected symbol "+n.symbol+", expected hour");for(r.byhour=[parseInt(h[0],10)];n.accept("comma");){if(h=n.acceptNumber(),!h)throw new Error("Unexpected symbol "+n.symbol+"; expected hour");r.byhour.push(parseInt(h[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 u(){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 l(){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 m=parseInt(n.value[1],10);if(m<-366||m>366)throw new Error("Nth out of range: "+m);return n.nextSymbol(),n.accept("last")?-m:m;default:return!1}}function c(){n.accept("on"),n.accept("the");var m=l();if(m)for(r.bymonthday=[m],n.nextSymbol();n.accept("comma");){if(m=l(),!m)throw new Error("Unexpected symbol "+n.symbol+"; expected monthday");r.bymonthday.push(m),n.nextSymbol()}}function d(){if(n.symbol==="until"){var m=Date.parse(n.text);if(!m)throw new Error("Cannot parse until date:"+n.text);r.until=new Date(m)}else n.accept("for")&&(r.count=parseInt(n.value[0],10),n.expect("number"))}}var pt;(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"})(pt||(pt={}));function Xs(e){return e12){var n=Math.floor(this.month/12),i=qn(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=Su(this.hour,24),o=a.div,s=a.mod;if(o&&(this.hour=s,this.addDaily(o)),_r(i)||Et(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=Su(this.minute,60),s=o.div,u=o.mod;if(s&&(this.minute=u,this.addHours(s,!1,i)),(_r(i)||Et(i,this.hour))&&(_r(a)||Et(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=Su(this.second,60),u=s.div,l=s.mod;if(u&&(this.second=l,this.addMinutes(u,!1,i,a)),(_r(i)||Et(i,this.hour))&&(_r(a)||Et(a,this.minute))&&(_r(o)||Et(o,this.second)))break}},t.prototype.fixDay=function(){if(!(this.day<=28)){var r=uh(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>Eu))return;r=uh(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,u=r.byminute,l=r.bysecond;switch(i){case pt.YEARLY:return this.addYears(a);case pt.MONTHLY:return this.addMonths(a);case pt.WEEKLY:return this.addWeekly(a,o);case pt.DAILY:return this.addDaily(a);case pt.HOURLY:return this.addHours(a,n,s);case pt.MINUTELY:return this.addMinutes(a,n,s,u);case pt.SECONDLY:return this.addSeconds(a,n,s,u,l)}},t}(Po);function hh(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(!(t.byweekno||bn(t.byweekno)||bn(t.byyearday)||t.bymonthday||bn(t.bymonthday)||Gt(t.byweekday)||Gt(t.byeaster)))switch(t.freq){case Oe.YEARLY:t.bymonth||(t.bymonth=t.dtstart.getUTCMonth()+1),t.bymonthday=t.dtstart.getUTCDate();break;case Oe.MONTHLY:t.bymonthday=t.dtstart.getUTCDate();break;case Oe.WEEKLY:t.byweekday=[Hi(t.dtstart)];break}if(Gt(t.bymonth)&&!$n(t.bymonth)&&(t.bymonth=[t.bymonth]),Gt(t.byyearday)&&!$n(t.byyearday)&&Cr(t.byyearday)&&(t.byyearday=[t.byyearday]),!Gt(t.bymonthday))t.bymonthday=[],t.bynmonthday=[];else if($n(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(Gt(t.byweekno)&&!$n(t.byweekno)&&(t.byweekno=[t.byweekno]),!Gt(t.byweekday))t.bynweekday=null;else if(Cr(t.byweekday))t.byweekday=[t.byweekday],t.bynweekday=null;else if(sh(t.byweekday))t.byweekday=[Mn.fromStr(t.byweekday).weekday],t.bynweekday=null;else if(t.byweekday instanceof Mn)!t.byweekday.n||t.freq>Oe.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;rOe.MONTHLY?o.push(u.weekday):s.push([u.weekday,u.n])}t.byweekday=bn(o)?o:null,t.bynweekday=bn(s)?s:null}return Gt(t.byhour)?Cr(t.byhour)&&(t.byhour=[t.byhour]):t.byhour=t.freq=4?(c=0,l=s.yearlen+qn(o-t.wkst,7)):l=n-c;for(var d=Math.floor(l/7),m=qn(l,7),h=Math.floor(d+m/4),g=0;g0&&y<=h){var v=void 0;y>1?(v=c+(y-1)*7,c!==u&&(v-=7-u)):v=c;for(var D=0;D<7&&(s.wnomask[v]=1,v++,s.wdaymask[v]!==t.wkst);D++);}}if(Et(t.byweekno,1)){var v=c+h*7;if(c!==u&&(v-=7-u),v=4?(x=0,A=O+qn(C-t.wkst,7)):A=n-c,I=Math.floor(52+qn(A,7)/4)}if(Et(t.byweekno,I))for(var v=0;va)return $i(e);if(I>=r){var C=Hw(I,t);if(!e.accept(C)||s&&(--s,!s))return $i(e)}}else for(var D=h;Da)return $i(e);if(I>=r){var C=Hw(I,t);if(!e.accept(C)||s&&(--s,!s))return $i(e)}}}if(t.interval===0||(u.add(t,y),u.year>Eu))return $i(e);Xs(n)||(c=l.gettimeset(n)(u.hour,u.minute,u.second,0)),l.rebuild(u.year,u.month)}}function JI(e,t,r){var n=r.bymonth,i=r.byweekno,a=r.byweekday,o=r.byeaster,s=r.bymonthday,u=r.bynmonthday,l=r.byyearday;return bn(n)&&!Et(n,e.mmask[t])||bn(i)&&!e.wnomask[t]||bn(a)&&!Et(a,e.wdaymask[t])||bn(e.nwdaymask)&&!e.nwdaymask[t]||o!==null&&!Et(e.eastermask,t)||(bn(s)||bn(u))&&!Et(s,e.mdaymask[t])&&!Et(u,e.nmdaymask[t])||bn(l)&&(t=e.yearlen&&!Et(l,t+1-e.yearlen)&&!Et(l,-e.nextyearlen+t-e.yearlen))}function Hw(e,t){return new Ka(e,t.tzid).rezonedDate()}function $i(e){return e.getValue()}function ZI(e,t,r,n,i){for(var a=!1,o=t;o=Oe.HOURLY&&bn(i)&&!Et(i,t.hour)||n>=Oe.MINUTELY&&bn(a)&&!Et(a,t.minute)||n>=Oe.SECONDLY&&bn(o)&&!Et(o,t.second)?[]:e.gettimeset(n)(t.hour,t.minute,t.second,t.millisecond)}var Ur={MO:new Mn(0),TU:new Mn(1),WE:new Mn(2),TH:new Mn(3),FR:new Mn(4),SA:new Mn(5),SU:new Mn(6)},el={freq:pt.YEARLY,dtstart:null,interval:1,wkst:Ur.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},Dw=Object.keys(el),Oe=function(){function e(t,r){t===void 0&&(t={}),r===void 0&&(r=!1),this._cache=r?null:new kw,this.origOptions=hh(t);var n=ww(t).parsedOptions;this.options=n}return e.parseText=function(t,r){return Qs(t,r)},e.fromText=function(t,r){return pw(t,r)},e.fromString=function(t){return new e(e.parseString(t)||void 0)},e.prototype._iter=function(t){return _u(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 fh("all",{},t));var r=this._cacheGet("all");return r===!1&&(r=this._iter(new Vi("all",{})),this._cacheAdd("all",r)),r},e.prototype.between=function(t,r,n,i){if(n===void 0&&(n=!1),!Ya(t)||!Ya(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 fh("between",a,i));var o=this._cacheGet("between",a);return o===!1&&(o=this._iter(new Vi("between",a)),this._cacheAdd("between",o,a)),o},e.prototype.before=function(t,r){if(r===void 0&&(r=!1),!Ya(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 Vi("before",n)),this._cacheAdd("before",i,n)),i},e.prototype.after=function(t,r){if(r===void 0&&(r=!1),!Ya(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 Vi("after",n)),this._cacheAdd("after",i,n)),i},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return rl(this.origOptions)},e.prototype.toText=function(t,r,n){return gw(this,t,r,n)},e.prototype.isFullyConvertibleToText=function(){return yw(this)},e.prototype.clone=function(){return new e(this.origOptions)},e.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],e.YEARLY=pt.YEARLY,e.MONTHLY=pt.MONTHLY,e.WEEKLY=pt.WEEKLY,e.DAILY=pt.DAILY,e.HOURLY=pt.HOURLY,e.MINUTELY=pt.MINUTELY,e.SECONDLY=pt.SECONDLY,e.MO=Ur.MO,e.TU=Ur.TU,e.WE=Ur.WE,e.TH=Ur.TH,e.FR=Ur.FR,e.SA=Ur.SA,e.SU=Ur.SU,e.parseString=nl,e.optionsToString=rl,e}();function Bw(e,t,r,n,i,a){var o={},s=e.accept;function u(m,h){r.forEach(function(g){g.between(m,h,!0).forEach(function(y){o[Number(y)]=!0})})}i.forEach(function(m){var h=new Ka(m,a).rezonedDate();o[Number(h)]=!0}),e.accept=function(m){var h=Number(m);return isNaN(h)?s.call(this,m):!o[h]&&(u(new Date(h-1),new Date(h+1)),!o[h])?(o[h]=!0,s.call(this,m)):!0},e.method==="between"&&(u(e.args.after,e.args.before),e.accept=function(m){var h=Number(m);return o[h]?!0:(o[h]=!0,s.call(this,m))});for(var l=0;l1||i.length||a.length||o.length){var c=new gh(l);return c.dtstart(s),c.tzid(u||void 0),n.forEach(function(m){c.rrule(new Oe(ph(m,s,u),l))}),i.forEach(function(m){c.rdate(m)}),a.forEach(function(m){c.exrule(new Oe(ph(m,s,u),l))}),o.forEach(function(m){c.exdate(m)}),t.compatible&&t.dtstart&&c.rdate(s),c}var d=n[0]||{};return new Oe(ph(d,d.dtstart||t.dtstart||s,d.tzid||t.tzid||u),l)}function Mu(e,t){return t===void 0&&(t={}),eA(e,tA(t))}function ph(e,t,r){return Un(Un({},e),{dtstart:t,tzid:r})}function tA(e){var t=[],r=Object.keys(e),n=Object.keys(Vw);if(r.forEach(function(i){Et(n,i)||t.push(i)}),t.length)throw new Error("Invalid options: "+t.join(", "));return Un(Un({},Vw),e)}function nA(e){if(e.indexOf(":")===-1)return{name:"RRULE",value:e};var t=lw(e,":",1),r=t[0],n=t[1];return{name:r,value:n}}function rA(e){var t=nA(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 iA(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 aA(e){e.forEach(function(t){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(t))throw new Error("unsupported RDATE/EXDATE parm: "+t)})}function $w(e,t){return aA(t),e.split(",").map(function(r){return Zs(r)})}function Uw(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;nt.settings&&t.settings.taskFormat))==null?void 0:e.settings}function Zn(){var n,i;let e=bh(),t=e==null?void 0:e.statusSettings;if(!t)return"x";let r=(n=t.coreStatuses)==null?void 0:n.find(a=>a.type==="DONE");return r||(r=(i=t.customStatuses)==null?void 0:i.find(a=>a.type==="DONE")),r?r.symbol:"x"}function Iu(){var i,a;let e=bh(),t=e==null?void 0:e.statusSettings;if(!t)return" ";let r=Zn(),n=(i=t.coreStatuses)==null?void 0:i.find(o=>o.nextStatusSymbol===r);return n||(n=(a=t.customStatuses)==null?void 0:a.find(o=>o.nextStatusSymbol===r)),n?n.symbol:" "}function pb(e,t){var n,i,a;let r=wh();return r&&(a=(i=(n=r.apiV1)==null?void 0:n.executeToggleTaskDoneCommand)==null?void 0:i.call(n,e,t.path))!=null?a:null}function Ro(e,t){var d,m;let r=wh();if(!r)return null;let n=`- [${e.data.checkChar}] `,i=e.data.titleRaw.split(/\n\r?/g),a=bh(),o=!!(a!=null&&a.recurrenceOnNextLine),s=0,u=(m=(d=r.apiV1)==null?void 0:d.executeToggleTaskDoneCommand)==null?void 0:m.call(d,n+i[0],t.path);if(!u)return null;let l=[];return[u.split(/\n/g).map((h,g)=>{(o&&g===0||!o&&g>0)&&(s=g);let y=h.match(/^- \[([^\]]+)\]/);return y!=null&&y[1]&&l.push(y[1]),[h.replace(/^- \[[^\]]+\] */,""),...i.slice(1)].join(`
+`)}),l,s]}var Fu=Object.freeze({"[":"]","(":")"});function AA(e,t){let r=e.indexOf("::",t);if(!(r<0))return{key:e.substring(t,r).trim(),valueIndex:r+2}}function OA(e,t,r,n){let i=0,a=!1;for(let o=t;o=0;){let u=LA(e,s);if(!u){s=e.indexOf(o,s+1);continue}i.push(u),s=e.indexOf(o,u.end)}}n&&t&&(i=i.concat(KA(e))),i.sort((o,s)=>o.start-s.start);let a=[];for(let o=0;o{O===D?I=n.getNewItem(x,v[O]):C=n.getNewItem(x,v[O])}),{next:I,replacement:C}}return{next:(0,Sh.default)(o,{data:{checked:{$set:c},checkChar:{$set:c?Zn():" "}}})}}function Ou(){let e=$e.useRef(!1);return{oncompositionstart:()=>{e.current=!0},oncompositionend:()=>{e.current=!1},getShouldIMEBlockAction:()=>e.current}}var jA=/<%/;async function yb(e,t){let r=t?e.app.vault.getAbstractFileByPath(t):null;if(r&&r instanceof da.TFile){let n=app.workspace.getActiveViewOfType(da.MarkdownView);try{(n==null?void 0:n.getMode())!=="source"&&await n.setState({...n.getState(),mode:"source"},{history:!1});let{templatesEnabled:i,templaterEnabled:a,templatesPlugin:o,templaterPlugin:s}=kh(e.app),u=await e.app.vault.read(r);if(i&&a)return jA.test(u)?await s.append_template_to_active_file(r):await o.instance.insertTemplate(r);if(i)return await o.instance.insertTemplate(r);if(a)return await s.append_template_to_active_file(r);await e.app.vault.modify(e.app.workspace.getActiveFile(),u)}catch(i){console.error(i),e.setError(i)}}}function ja(e){var s,u,l,c,d;let t=e.internalPlugins.plugins,r=(s=t["daily-notes"])==null?void 0:s.enabled,n=(u=t["daily-notes"])==null?void 0:u.instance.options.format,i=(l=e.plugins.plugins["nldates-obsidian"])==null?void 0:l.settings.format,a=(c=t.templates)==null?void 0:c.enabled,o=(d=t.templates)==null?void 0:d.instance.options.dateFormat;return r&&n||i||a&&o||"YYYY-MM-DD"}function Ho(e){var a,o,s;let t=e.internalPlugins.plugins,r=(a=e.plugins.plugins["nldates-obsidian"])==null?void 0:a.settings.timeFormat,n=(o=t.templates)==null?void 0:o.enabled,i=(s=t.templates)==null?void 0:s.instance.options.timeFormat;return r||n&&i||"HH:mm"}var vb=/[\\^$.*+?()[\]{}|]/g,qA=RegExp(vb.source);function Qn(e){return e&&qA.test(e)?e.replace(vb,"\\$&"):e||""}function kh(e){var s;let t=e.internalPlugins.plugins.templates,r=t.enabled,n=e.plugins.plugins["templater-obsidian"],i=e.plugins.enabledPlugins.has("templater-obsidian"),a=n&&((s=this.app.plugins.plugins["templater-obsidian"].settings)==null?void 0:s.empty_file_template),o=r?t.instance.options.folder:n?n.settings.template_folder:void 0;return{templatesPlugin:t,templatesEnabled:r,templaterPlugin:n==null?void 0:n.templater,templaterEnabled:i,templaterEmptyFileTemplate:a,templateFolder:o}}function GA(e){let t=(e||[]).reduce((r,n)=>(n.tagKey&&(r[n.tagKey]=n),r),{});return r=>t[r]?t[r]:null}function Lu(e){let t=e.useSetting("tag-colors");return Re(()=>GA(t),[t])}function xh(e){let t=(e||[]).map(n=>{if(n.isToday)return["today",n];if(n.isBefore)return["before",n];if(n.isAfter)return["after",n];let i=n.direction==="after"?1:-1,a=(0,da.moment)();return a.add(n.distance*i,n.unit),[a,n]}),r=(0,da.moment)();return t.sort((n,i)=>n[0]==="today"?typeof i[0]=="string"?-1:i[0].isSame(r,"day")?1:-1:i[0]==="today"?typeof n[0]=="string"?1:n[0].isSame(r,"day")?-1:1:n[0]==="after"||n[0]==="before"?1:i[0]==="after"||i[0]==="before"||n[0].isBefore(i[0])?-1:1),n=>{let i=(0,da.moment)(),a=t.find(o=>{let s=o[1];if(s.isToday)return n.isSame(i,"day");if(s.isAfter)return n.isAfter(i);if(s.isBefore)return n.isBefore(i);let u="days";return s.unit==="hours"&&(u="hours"),s.direction==="before"?n.isBetween(o[0],i,u,"[]"):n.isBetween(i,o[0],u,"[]")});return a?a[1]:null}}function fa(e){let t=e.useSetting("date-colors");return Re(()=>xh(t),[t])}function Pu(e,t){let r=t.find(n=>n.metadataKey===e.key);return r?{...r,value:e.value}:{containsMarkdown:!1,label:e.key,metadataKey:e.key,shouldHideLabel:!1,value:e.value}}function Nu(e,t,r){Ae(()=>{var o;let n=0,i=!1,a=()=>{i||++n===e.length&&t()};for(let s of e)(o=s.current)==null||o.onNodeInserted(a,!0);return()=>{i=!0,r()}},[])}function wb(e,t,r,n,i){return Re(()=>{t=t.trim().toLocaleLowerCase();let a=new Set,o=new Set;return t&&e.children.forEach(s=>{let u=!1;s.children.forEach(l=>{l.data.titleSearch.includes(t)&&(u=!0,o.add(l))}),u&&a.add(s)}),{lanes:a,items:o,query:t,search:(s,u)=>{s||(i(!1),r(""),n("")),i(!0),u?(r(s),n(s)):r(s)}}},[e,t,r,n])}var Sb=Ct(Db(),1);var Bo=Sb.default;var Tr={x:0,y:0,maxX:0,maxY:0},vi={x:0,y:0};function Dn(e){return e.win}function ha(e){return e.doc.body}var xb={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){}},Cb=[0,0,0,0];function Xt(e){return e===void 0?0:e}function Hu(e,t,r,n){return[e.left+Xt(t==null?void 0:t.x)+Xt(r==null?void 0:r.x)-Xt(n==null?void 0:n.x),e.top+Xt(t==null?void 0:t.y)+Xt(r==null?void 0:r.y)-Xt(n==null?void 0:n.y),e.left+e.width+Xt(t==null?void 0:t.x)+Xt(r==null?void 0:r.x)-Xt(n==null?void 0:n.x),e.top+e.height+Xt(t==null?void 0:t.y)+Xt(r==null?void 0:r.y)-Xt(n==null?void 0:n.y)]}function _h(e,t,r,n){let i=Hu(e,t,r,null);return n==="top"?(i[3]=i[1]+35,i):n==="right"?(i[0]=i[0]+e.width-35,i):n==="bottom"?(i[1]=i[1]+e.height-35,i):(i[2]=i[0]+35,i)}function Bu(e,t,r,n,i,a){return[e-Xt(i==null?void 0:i.x)-Xt(a==null?void 0:a.x),t-Xt(i==null?void 0:i.y)-Xt(a==null?void 0:a.y),r-Xt(i==null?void 0:i.x)-Xt(a==null?void 0:a.x),n-Xt(i==null?void 0:i.y)-Xt(a==null?void 0:a.y)]}var QA=e=>XA(e,(t,r)=>t{if(u.entityId===a)return 1/0;let l=u.getData(),c=l.acceptsSort,d=u.getHitbox(),m=kb(d);if(c&&!c.contains(r.getData().type))return qa(i,m);let h=Eb(d)[0],g=l.sortAxis==="horizontal"?"x":"y",y=m[g]>n[g]?1e3:0;return qa(h,n)+y}),s=QA(o);return e[s]?e[s]:null}function Th(e){let{scrollLeft:t,scrollTop:r,scrollWidth:n,scrollHeight:i,offsetWidth:a,offsetHeight:o}=e,s=t,u=r,l=n-a,c=i-o;return{x:s,y:u,maxX:Math.max(l,0),maxY:Math.max(c,0)}}function Mb(e,t,r){let n=Math.trunc((r.x-t.x)*100)/100,i=Math.trunc((r.y-t.y)*100)/100;return[e[0]+n,e[1]+i,e[2]+n,e[3]+i]}function Fh(e,t=[0,0,0,0]){let r=e[0]-t[0],n=e[1]-t[1],i=e[2]+t[2],o=e[3]+t[3]-n;return{width:i-r,height:o}}var Vu=class{constructor(t,r,n,i,a,o,s,u){this.isVisible=!1;this.mounted=!1;this.id=n,this.instanceId=et(),this.scopeId=r,this.entityId=`${r}-${n}`,this.emitter=new Bo,this.dndManager=t,this.index=i,this.children=new Map,this.parent=a,this.scrollParent=o,this.getEntityData=()=>u.current,this.sortManager=s}initNodes(t,r){var n,i;if(this.mounted=!0,this.entityNode=t,this.measureNode=r,r.dataset.hitboxid=this.entityId,(n=this.sortManager)==null||n.registerSortable(this.entityId,this.getEntity(xb),t,r),this.scrollParent)this.scrollParent.registerObserverHandler(this.entityId,r,a=>{var s,u;let o=Dn(a.target);if(a.isIntersecting){let l=this.getEntity(a.boundingClientRect);(s=this.parent)==null||s.children.set(this.entityId,{entity:l,manager:this}),this.dndManager.observeResize(r),(!this.parent||this.parent.isVisible)&&(this.dndManager.registerHitboxEntity(this.entityId,l,o),this.children.forEach((c,d)=>{this.dndManager.registerHitboxEntity(d,c.entity,o)}),this.setVisibility(!0))}else this.dndManager.unregisterHitboxEntity(this.entityId,o),this.children.forEach((l,c)=>{this.dndManager.unregisterHitboxEntity(c,o)}),(u=this.parent)==null||u.children.delete(this.entityId),this.dndManager.unobserveResize(r),this.setVisibility(!1)});else{let a=this.getEntity(r.getBoundingClientRect());this.dndManager.observeResize(r),this.dndManager.registerHitboxEntity(this.entityId,a,Dn(t)),(i=this.parent)==null||i.children.set(this.entityId,{entity:a,manager:this}),this.setVisibility(!0)}}setVisibility(t){this.emitter.emit("visibility-change",t),this.isVisible=t,this.children.forEach(r=>{r.manager.setVisibility(t)})}destroy(){var t,r,n;this.mounted&&(this.mounted=!0,this.dndManager.unobserveResize(this.measureNode),(t=this.sortManager)==null||t.unregisterSortable(this.entityId),(r=this.scrollParent)==null||r.unregisterObserverHandler(this.entityId,this.measureNode),this.entityNode&&this.dndManager.unregisterHitboxEntity(this.entityId,Dn(this.entityNode)),(n=this.parent)==null||n.children.delete(this.entityId))}getPath(){var t;return[...((t=this.parent)==null?void 0:t.getPath())||[],this.index]}getEntity(t){var n,i;let r=this;return{scopeId:this.scopeId,entityId:this.entityId,initial:Hu(t,((n=r.scrollParent)==null?void 0:n.scrollState)||Tr,((i=r.scrollParent)==null?void 0:i.getScrollShift())||vi,null),getParentScrollState(){var a;return((a=r.scrollParent)==null?void 0:a.scrollState)||Tr},getParentScrollShift(){var a;return((a=r.scrollParent)==null?void 0:a.getScrollShift())||vi},recalcInitial(){var a,o;this.initial=Hu(r.measureNode.getBoundingClientRect(),((a=r.scrollParent)==null?void 0:a.scrollState)||Tr,((o=r.scrollParent)==null?void 0:o.getScrollShift())||vi,null)},getHitbox(){return Bu(this.initial[0],this.initial[1],this.initial[2],this.initial[3],this.getParentScrollState(),this.getParentScrollShift())},getPath(){return r.getPath()},getData(){var a;return{...r.getEntityData(),sortAxis:(a=r.sortManager)==null?void 0:a.axis,win:Dn(r.measureNode)}}}}};var Vo=class{constructor(){this.scrollStates=new Map,this.idScopes=new Map}setScrollState(t,r,n){if(this.scrollStates.set(r,n),this.idScopes.has(r)){let i=this.idScopes.get(r);i.has(t)||i.add(t)}else this.idScopes.set(r,new Set([t]))}getScrollState(t){return this.scrollStates.has(t)?this.scrollStates.get(t):Tr}unmountScope(t){let r=[];this.idScopes.forEach((n,i)=>{n.has(t)&&(n.delete(t),n.size===0&&r.push(i))}),r.forEach(n=>{this.idScopes.delete(n),this.scrollStates.delete(n)})}};var cn=$e.createContext(null),ma=$e.createContext(""),ol=$e.createContext(null),sl=$e.createContext(new Vo),$u=$e.createContext(null),$o=$e.createContext(null),Uu=$e.createContext(null);var eO=0,ZU=Array.isArray;function E(e,t,r,n,i,a){var o,s,u={};for(s in t)s=="ref"?o=t[s]:u[s]=t[s];var l={type:e,props:u,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--eO,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(o=e.defaultProps))for(s in o)u[s]===void 0&&(u[s]=o[s]);return Xe.vnode&&Xe.vnode(l),l}function Tb(e){return E(ct,{children:e.children})}var ei=zt(function({id:t,index:r,elementRef:n,measureRef:i,children:a,data:o}){let s=Ee(cn),u=Ee($u),l=Ee(ma),c=Ee($o),d=Ee(ol),m=Fe(o),h=Fe();m.current=o;let g=Re(()=>{if(s){h.current&&h.current.destroy();let y=new Vu(s,l,t,r,c,d,u,m);return n.current&&i.current&&y.initNodes(n.current,i.current),h.current=y,y}return null},[t,r,s,l,c,d,u]);return Nu([n,i],()=>{var y;(y=h.current)==null||y.initNodes(n.current,i.current)},()=>{var y;(y=h.current)==null||y.destroy()}),g?E($o.Provider,{value:g,children:a}):null});function Ui(e){var i;let t=Ee($o),r=Ee(Uu),n=(i=r!=null?r:t==null?void 0:t.getPath())!=null?i:[];return e!==void 0&&n.push(e),Re(()=>n,n)}var pg=Ct(UD());var vL=new Map([["avi","video/avi"],["gif","image/gif"],["ico","image/x-icon"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["mkv","video/x-matroska"],["mov","video/quicktime"],["mp4","video/mp4"],["pdf","application/pdf"],["png","image/png"],["zip","application/zip"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]]);function ml(e,t){var r=wL(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 wL(e){var t=e.name,r=t&&t.lastIndexOf(".")!==-1;if(r&&!e.type){var n=t.split(".").pop().toLowerCase(),i=vL.get(n);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var bL=[".DS_Store","Thumbs.db"];function Jh(e){return Ao(this,void 0,void 0,function(){return Oo(this,function(t){return[2,DL(e)&&e.dataTransfer?kL(e.dataTransfer,e.type):SL(e)]})})}function DL(e){return!!e.dataTransfer}function SL(e){var t=EL(e.target)?e.target.files?Gh(e.target.files):[]:[];return t.map(function(r){return ml(r)})}function EL(e){return e!==null}function kL(e,t){return Ao(this,void 0,void 0,function(){var r,n;return Oo(this,function(i){switch(i.label){case 0:return e.items?(r=Gh(e.items).filter(function(a){return a.kind==="file"}),t!=="drop"?[2,r]:[4,Promise.all(r.map(xL))]):[3,2];case 1:return n=i.sent(),[2,WD(zD(n))];case 2:return[2,WD(Gh(e.files).map(function(a){return ml(a)}))]}})})}function WD(e){return e.filter(function(t){return bL.indexOf(t.name)===-1})}function Gh(e){for(var t=[],r=0;r{this.resolve=n=>{this.settled=!0,t(n)},this.reject=n=>{this.settled=!0,r(n)}})}},Ac=class{constructor(t){this.onComplete=t;this.queue=[];this.isRunning=!1}clear(){this.queue.length=0,this.isRunning=!1}add(t){this.queue.push(t),this.isRunning||this.run()}async run(){this.isRunning=!0;let{queue:t}=this,r=performance.now();for(;t.length;){let n=t.splice(0,5);try{await Promise.all(n.map(a=>a()))}catch(a){console.error(a)}if(!this.isRunning)return;let i=performance.now();i-r>50&&(await new Promise(a=>activeWindow.setTimeout(a)),r=i)}this.isRunning=!1,this.onComplete()}};var us=require("obsidian"),QP=/\u00A0/g;function Ym(e){let r=e.replace(QP," ").normalize("NFC").split(/\|(.*)/),n=r[0].split(/#(.*)/);return{root:n[0],subpath:n[1]?"#"+n[1]:"",alias:r[1]||""}}function BS(e){e.querySelectorAll(".task-list-item-checkbox").forEach((r,n)=>{r.dataset.checkboxIndex=n.toString()})}function VS(e){let{contentEl:t,app:r}=e,n=a=>{let o=a.getAttr("data-href")||a.getAttr("href");return o?{href:o,displayText:a.getText().trim()}:null},i=(a,o)=>{if(a.button!==0&&a.button!==1)return;let s=n(o);s&&(a.preventDefault(),r.workspace.openLinkText(s.href,e.file.path,us.Keymap.isModEvent(a)))};t.on("click","a.internal-link",i),t.on("auxclick","a.internal-link",i),t.on("dragstart","a.internal-link",a=>{a.preventDefault()}),t.on("contextmenu","a.internal-link",(a,o)=>{let s=n(o);if(!s)return;let u=new us.Menu;u.addSections(["title","open","action","view","info","","danger"]),r.workspace.handleLinkContextMenu(u,s.href,e.file.path),u.showAtMouseEvent(a)}),t.on("mouseover","a.internal-link",(a,o)=>{let s=n(o);s&&r.workspace.trigger("hover-link",{event:a,source:"preview",hoverParent:e,targetEl:o,linktext:s.href,sourcePath:e.file.path})}),t.on("click","a.external-link",(a,o)=>{let s=n(o);if(!s||(a.preventDefault(),!s.href||s.href.contains(" ")))return;try{new URL(s.href)}catch(c){return}let u=us.Keymap.isModEvent(a),l=typeof u=="boolean"?"":u;window.open(s.href,l)}),t.on("contextmenu","a.external-link",(a,o)=>{let s=n(o);if(!s)return;let u=new us.Menu;u.addSections(["title","open","selection","clipboard","action","view","info","","danger"]),r.workspace.handleExternalLinkContextMenu(u,s.href),u.showAtMouseEvent(a)}),t.on("click","a.tag",(a,o)=>{if(a.button!==0)return;let s=o.getText(),u=r.internalPlugins.getPluginById("global-search");e.plugin.getStateManager(e.file).getSetting("tag-action")==="kanban"?e.emitter.emit("hotkey",{commandId:"editor:open-search",data:s}):u&&u.instance.openGlobalSearch(`tag:${s}`)})}var tt=aa(null),zn=aa(null),Oc=aa(null),Lc=aa(null);function zm(e,t){if(!e)return;let r=e.querySelectorAll("a.tag");r!=null&&r.length&&r.forEach(n=>{let i=t(n.getAttr("href"));i&&n.setCssProps({"--tag-color":i.color,"--tag-background":i.backgroundColor})})}function Km(e,t){if(!e)return;let r=e.querySelectorAll("."+$("date"));r!=null&&r.length&&r.forEach(n=>{let i=n.dataset.date;if(!i)return;let a=(0,US.default)(i);if(!a.isValid())return;let o=t(a);n.toggleClass("has-background",!!(o!=null&&o.backgroundColor)),o&&n.setCssProps({"--date-color":o.color,"--date-background-color":o.backgroundColor})})}var Ll=class extends cs.Component{constructor(r,n){super();this.view=r;this.markdown=n;this.isVisible=!1;this.lastWidth=-1;this.lastHeight=-1;this.lastRefWidth=-1;this.lastRefHeight=-1;this.containerEl=createDiv("markdown-preview-view markdown-rendered "+$("markdown-preview-view")),this.mark=new $S.default(this.containerEl),this.renderCapability=new Ol}onload(){this.render()}async render(){var n;if(this.containerEl.empty(),await cs.MarkdownRenderer.render(this.view.app,this.markdown,this.containerEl,this.view.file.path,this),this.renderCapability.resolve(),!((n=this.view)!=null&&n._loaded)||!this._loaded)return;let{containerEl:r}=this;this.resolveLinks(),BS(r),this.observer=new ResizeObserver(i=>{if(!i.length)return;let a=i.first().contentBoxSize[0];if(a.blockSize!==0){if(this.wrapperEl){let o=this.wrapperEl.getBoundingClientRect();(this.lastRefHeight===-1||o.height>0)&&(this.lastRefHeight=o.height,this.lastRefWidth=o.width)}this.lastWidth=a.inlineSize,this.lastHeight=a.blockSize}}),r.win.setTimeout(()=>{this.observer.observe(r,{box:"border-box"})}),r.addEventListener("click",i=>{let{targetNode:a}=i;a.instanceOf(HTMLElement)&&a.hasClass("task-list-item-checkbox")&&!a.closest(".markdown-embed")&&(i.preventDefault(),i.stopPropagation())},{capture:!0}),r.addEventListener("contextmenu",i=>{let{targetNode:a}=i;a.instanceOf(HTMLElement)&&a.hasClass("task-list-item-checkbox")&&(i.preventDefault(),i.stopPropagation())},{capture:!0})}migrate(r){let{lastRefHeight:n,lastRefWidth:i,containerEl:a}=this;this.wrapperEl=r,n>0&&(r.style.width=`${i}px`,r.style.height=`${n}px`,r.win.setTimeout(()=>{r.style.width="",r.style.height=""},50)),a.parentElement!==r&&r.append(a),this.mark.unmark()}show(){let{wrapperEl:r,containerEl:n}=this;r&&(r.append(n),r.style.minHeight&&(r.style.minHeight=""),this.isVisible=!0)}hide(){let{containerEl:r,wrapperEl:n}=this;n&&(n.style.minHeight=this.lastRefHeight+"px",r.detach(),this.isVisible=!1)}set(r){this._loaded&&(this.markdown=r,this.renderCapability=new Ol,this.unload(),this.load())}resolveLinks(){let{containerEl:r,view:n}=this,i=r.findAll("a.internal-link");for(let a of i){let o=this.getInternalLinkHref(a);if(!o)continue;let s=(0,cs.getLinkpath)(o),u=n.app.metadataCache.getFirstLinkpathDest(s,n.file.path);a.toggleClass("is-unresolved",!u)}}getInternalLinkHref(r){let n=r.getAttr("data-href")||r.getAttr("href");return n||null}},Sa=zt(function({entityId:t,className:r,markdownString:n,searchQuery:i,...a}){let{view:o,stateManager:s}=Ee(tt),u=Ee($o),l=Ee(cn),c=Ee(Oc),d=Ee(Lc),m=Lu(s),h=fa(s),g=Fe(),y=Fe();Ae(()=>{var I;if(!u||!t||!g.current)return;let D=(I=u==null?void 0:u.scrollParent)==null?void 0:I.observer;D&&(D.unobserve(u.measureNode),D.observe(u.measureNode))},[c]),Ae(()=>{if(!(!d||!y.current))return d.registerHandler(y.current,D=>{var I,C;D.isIntersecting?(I=g.current)==null||I.show():(C=g.current)==null||C.hide()}),()=>{y.current&&(d==null||d.unregisterHandler(y.current))}},[]),Ae(()=>{let D=x=>{let O=g.current;if(!O||!(u!=null&&u.parent))return;let{dragManager:A}=l;A.dragEntityId!==u.entityId&&A.dragEntityId!==u.parent.entityId&&(O.isVisible&&!x?O.hide():!O.isVisible&&x&&O.show())};if(t&&o.previewCache.has(t)){let x=o.previewCache.get(t);return g.current=x,x.migrate(y.current),u==null||u.emitter.on("visibility-change",D),()=>u==null?void 0:u.emitter.off("visibility-change",D)}let I=new Ll(o,n);I.wrapperEl=y.current;let C=g.current=o.addChild(I);return t&&o.previewCache.set(t,C),y.current.empty(),y.current.append(C.containerEl),zm(y.current,m),Km(y.current,h),u==null||u.emitter.on("visibility-change",D),()=>{var x;(x=g.current)==null||x.renderCapability.resolve(),u==null||u.emitter.off("visibility-change",D)}},[o,t,u]),Ae(()=>{let D=g.current;!D||n===D.markdown||(D.renderCapability.resolve(),D.set(n),D.renderCapability.promise.then(()=>{zm(y.current,m),Km(y.current,h)}))},[n]),Ae(()=>{g.current&&(zm(y.current,m),Km(y.current,h))},[m,h]),Ae(()=>{let D=g.current;D&&(D.mark.unmark(),i&&i.trim()&&D.mark.mark(i))},[i]),Ae(()=>{let D=g.current;y.current&&D&&D.wrapperEl!==y.current&&D.migrate(y.current)},[]);let v;if(!g.current&&o.previewCache.has(t)){let D=o.previewCache.get(t);D.lastRefHeight>0&&(v={width:`${D.lastRefWidth}px`,height:`${D.lastRefHeight}px`})}return E("div",{style:v,ref:y,className:Ge([$("markdown-preview-wrapper"),r]),...a})}),WS=zt(function({entityId:t,className:r,...n}){let{view:i}=Ee(tt),a=Fe(),o=i.previewCache.get(t),s;return o&&o.lastRefHeight>0&&(s={width:`${o.lastRefWidth}px`,height:`${o.lastRefHeight}px`}),E("div",{style:s,ref:u=>{a.current=u,u&&o&&u.childElementCount===0&&u.append(o.containerEl.cloneNode(!0))},className:Ge([$("markdown-preview-wrapper"),r]),...n})});var ck=require("@codemirror/commands"),fs=require("@codemirror/state"),lo=require("@codemirror/view");var xa=require("obsidian");var ft={Item:"item",Lane:"lane",Board:"board",MetadataSetting:"metadata-setting",TagColorSetting:"tag-color",TagSortSetting:"tag-sort",DateColorSetting:"date-color"},Pc={accepts:[ft.Item],type:ft.Item,children:[]},Ea={accepts:[ft.Lane],type:ft.Lane},Nc={accepts:[],type:ft.Board},Rc={accepts:[ft.MetadataSetting],type:ft.MetadataSetting,children:[]},Hc={accepts:[ft.TagSortSetting],type:ft.TagSortSetting,children:[]},Bc={accepts:[],type:ft.TagColorSetting,children:[]},Vc={accepts:[],type:ft.DateColorSetting,children:[]};function kn(e){return!(e===null||typeof e=="number")}var YS=require("@codemirror/state"),si=require("@codemirror/view"),zS=require("obsidian");var Uc=YS.StateField.define({create(){return null},update(e){return e}}),jm=class extends si.WidgetType{constructor(t,r,n){super(),this.stateManager=t,this.type=n,this.date=r}eq(t){return this.date.isSame(t.date)}toDOM(){return createSpan({cls:`cm-kanban-${this.type}-wrapper`},t=>{t.createSpan({cls:`cm-kanban-${this.type}`,text:this.date.format(this.stateManager.getSetting(this.type==="time"?"time-format":"date-display-format"))})})}ignoreEvent(){return!1}};function XP(e){return(t,r,n,i,a)=>{let o=a.state.field(Uc);if(!o)return;let s=i[1],u=(0,zS.moment)(s,o.getSetting(e==="date"?"date-format":"time-format"));u.isValid()&&t(r,n,si.Decoration.replace({widget:new jm(o,u,e)}))}}var qm=class{constructor(t,r,n){this.decorator=new si.MatchDecorator({regexp:r,decorate:XP(n)}),this.decos=this.decorator.createDeco(t)}update(t){t.docChanged&&(this.decos=this.decorator.createDeco(t.view))}},eN={decorations:e=>e.decos,provide:e=>si.EditorView.atomicRanges.of(t=>{var r;return((r=t.plugin(e))==null?void 0:r.decos)||si.Decoration.none})};function $c(e,t){return si.ViewPlugin.define(r=>{let i=r.state.field(Uc).getSetting(e==="date"?"date-trigger":"time-trigger");return new qm(r,new RegExp(`${Qn(i)}${t}`,"g"),e)},eN)}var KS=[$c("time","{([^}]+)}"),$c("date","{([^}]+)}"),$c("date","\\[\\[([^\\]]+)\\]\\]"),$c("date","\\[([^\\]]+)\\]\\([^)]+\\)")];var Hl=require("obsidian");var ok=require("obsidian");var ek=require("obsidian");var jS=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Gm={weekdays:{shorthand:["\u0623\u062D\u062F","\u0627\u062B\u0646\u064A\u0646","\u062B\u0644\u0627\u062B\u0627\u0621","\u0623\u0631\u0628\u0639\u0627\u0621","\u062E\u0645\u064A\u0633","\u062C\u0645\u0639\u0629","\u0633\u0628\u062A"],longhand:["\u0627\u0644\u0623\u062D\u062F","\u0627\u0644\u0627\u062B\u0646\u064A\u0646","\u0627\u0644\u062B\u0644\u0627\u062B\u0627\u0621","\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621","\u0627\u0644\u062E\u0645\u064A\u0633","\u0627\u0644\u062C\u0645\u0639\u0629","\u0627\u0644\u0633\u0628\u062A"]},months:{shorthand:["1","2","3","4","5","6","7","8","9","10","11","12"],longhand:["\u064A\u0646\u0627\u064A\u0631","\u0641\u0628\u0631\u0627\u064A\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064A\u0644","\u0645\u0627\u064A\u0648","\u064A\u0648\u0646\u064A\u0648","\u064A\u0648\u0644\u064A\u0648","\u0623\u063A\u0633\u0637\u0633","\u0633\u0628\u062A\u0645\u0628\u0631","\u0623\u0643\u062A\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062F\u064A\u0633\u0645\u0628\u0631"]},firstDayOfWeek:6,rangeSeparator:" \u0625\u0644\u0649 ",weekAbbreviation:"Wk",scrollTitle:"\u0642\u0645 \u0628\u0627\u0644\u062A\u0645\u0631\u064A\u0631 \u0644\u0644\u0632\u064A\u0627\u062F\u0629",toggleTitle:"\u0627\u0636\u063A\u0637 \u0644\u0644\u062A\u0628\u062F\u064A\u0644",amPM:["\u0635","\u0645"],yearAriaLabel:"\u0633\u0646\u0629",monthAriaLabel:"\u0634\u0647\u0631",hourAriaLabel:"\u0633\u0627\u0639\u0629",minuteAriaLabel:"\u062F\u0642\u064A\u0642\u0629",time_24hr:!1};jS.l10ns.ar=Gm;var JW=jS.l10ns;var qS=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Jm={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["J\xE4n","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["J\xE4nner","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum \xC4ndern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};qS.l10ns.at=Jm;var QW=qS.l10ns;var GS=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Zm={weekdays:{shorthand:["B.","B.e.","\xC7.a.","\xC7.","C.a.","C.","\u015E."],longhand:["Bazar","Bazar ert\u0259si","\xC7\u0259r\u015F\u0259nb\u0259 ax\u015Fam\u0131","\xC7\u0259r\u015F\u0259nb\u0259","C\xFCm\u0259 ax\u015Fam\u0131","C\xFCm\u0259","\u015E\u0259nb\u0259"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","\u0130yn","\u0130yl","Avq","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","\u0130yun","\u0130yul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:()=>".",rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Art\u0131rmaq \xFC\xE7\xFCn s\xFCr\xFC\u015Fd\xFCr\xFCn",toggleTitle:"A\xE7 / Ba\u011Fla",amPM:["G\u018F","GS"],time_24hr:!0};GS.l10ns.az=Zm;var e4=GS.l10ns;var JS=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Qm={weekdays:{shorthand:["\u041D\u0434","\u041F\u043D","\u0410\u045E","\u0421\u0440","\u0427\u0446","\u041F\u0442","\u0421\u0431"],longhand:["\u041D\u044F\u0434\u0437\u0435\u043B\u044F","\u041F\u0430\u043D\u044F\u0434\u0437\u0435\u043B\u0430\u043A","\u0410\u045E\u0442\u043E\u0440\u0430\u043A","\u0421\u0435\u0440\u0430\u0434\u0430","\u0427\u0430\u0446\u0432\u0435\u0440","\u041F\u044F\u0442\u043D\u0456\u0446\u0430","\u0421\u0443\u0431\u043E\u0442\u0430"]},months:{shorthand:["\u0421\u0442\u0443","\u041B\u044E\u0442","\u0421\u0430\u043A","\u041A\u0440\u0430","\u0422\u0440\u0430","\u0427\u044D\u0440","\u041B\u0456\u043F","\u0416\u043D\u0456","\u0412\u0435\u0440","\u041A\u0430\u0441","\u041B\u0456\u0441","\u0421\u043D\u0435"],longhand:["\u0421\u0442\u0443\u0434\u0437\u0435\u043D\u044C","\u041B\u044E\u0442\u044B","\u0421\u0430\u043A\u0430\u0432\u0456\u043A","\u041A\u0440\u0430\u0441\u0430\u0432\u0456\u043A","\u0422\u0440\u0430\u0432\u0435\u043D\u044C","\u0427\u044D\u0440\u0432\u0435\u043D\u044C","\u041B\u0456\u043F\u0435\u043D\u044C","\u0416\u043D\u0456\u0432\u0435\u043D\u044C","\u0412\u0435\u0440\u0430\u0441\u0435\u043D\u044C","\u041A\u0430\u0441\u0442\u0440\u044B\u0447\u043D\u0456\u043A","\u041B\u0456\u0441\u0442\u0430\u043F\u0430\u0434","\u0421\u043D\u0435\u0436\u0430\u043D\u044C"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" \u2014 ",weekAbbreviation:"\u0422\u044B\u0434.",scrollTitle:"\u041F\u0440\u0430\u043A\u0440\u0443\u0446\u0456\u0446\u0435 \u0434\u043B\u044F \u043F\u0430\u0432\u0435\u043B\u0456\u0447\u044D\u043D\u043D\u044F",toggleTitle:"\u041D\u0430\u0446\u0456\u0441\u043D\u0456\u0446\u0435 \u0434\u043B\u044F \u043F\u0435\u0440\u0430\u043A\u043B\u044E\u0447\u044D\u043D\u043D\u044F",amPM:["\u0414\u041F","\u041F\u041F"],yearAriaLabel:"\u0413\u043E\u0434",time_24hr:!0};JS.l10ns.be=Qm;var n4=JS.l10ns;var ZS=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Xm={weekdays:{shorthand:["\u041D\u0434","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],longhand:["\u041D\u0435\u0434\u0435\u043B\u044F","\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u043D\u0438\u043A","\u0412\u0442\u043E\u0440\u043D\u0438\u043A","\u0421\u0440\u044F\u0434\u0430","\u0427\u0435\u0442\u0432\u044A\u0440\u0442\u044A\u043A","\u041F\u0435\u0442\u044A\u043A","\u0421\u044A\u0431\u043E\u0442\u0430"]},months:{shorthand:["\u042F\u043D\u0443","\u0424\u0435\u0432","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440","\u041C\u0430\u0439","\u042E\u043D\u0438","\u042E\u043B\u0438","\u0410\u0432\u0433","\u0421\u0435\u043F","\u041E\u043A\u0442","\u041D\u043E\u0435","\u0414\u0435\u043A"],longhand:["\u042F\u043D\u0443\u0430\u0440\u0438","\u0424\u0435\u0432\u0440\u0443\u0430\u0440\u0438","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440\u0438\u043B","\u041C\u0430\u0439","\u042E\u043D\u0438","\u042E\u043B\u0438","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043F\u0442\u0435\u043C\u0432\u0440\u0438","\u041E\u043A\u0442\u043E\u043C\u0432\u0440\u0438","\u041D\u043E\u0435\u043C\u0432\u0440\u0438","\u0414\u0435\u043A\u0435\u043C\u0432\u0440\u0438"]},time_24hr:!0,firstDayOfWeek:1};ZS.l10ns.bg=Xm;var i4=ZS.l10ns;var QS=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ep={weekdays:{shorthand:["\u09B0\u09AC\u09BF","\u09B8\u09CB\u09AE","\u09AE\u0999\u09CD\u0997\u09B2","\u09AC\u09C1\u09A7","\u09AC\u09C3\u09B9\u09B8\u09CD\u09AA\u09A4\u09BF","\u09B6\u09C1\u0995\u09CD\u09B0","\u09B6\u09A8\u09BF"],longhand:["\u09B0\u09AC\u09BF\u09AC\u09BE\u09B0","\u09B8\u09CB\u09AE\u09AC\u09BE\u09B0","\u09AE\u0999\u09CD\u0997\u09B2\u09AC\u09BE\u09B0","\u09AC\u09C1\u09A7\u09AC\u09BE\u09B0","\u09AC\u09C3\u09B9\u09B8\u09CD\u09AA\u09A4\u09BF\u09AC\u09BE\u09B0","\u09B6\u09C1\u0995\u09CD\u09B0\u09AC\u09BE\u09B0","\u09B6\u09A8\u09BF\u09AC\u09BE\u09B0"]},months:{shorthand:["\u099C\u09BE\u09A8\u09C1","\u09AB\u09C7\u09AC\u09CD\u09B0\u09C1","\u09AE\u09BE\u09B0\u09CD\u099A","\u098F\u09AA\u09CD\u09B0\u09BF\u09B2","\u09AE\u09C7","\u099C\u09C1\u09A8","\u099C\u09C1\u09B2\u09BE\u0987","\u0986\u0997","\u09B8\u09C7\u09AA\u09CD\u099F\u09C7","\u0985\u0995\u09CD\u099F\u09CB","\u09A8\u09AD\u09C7","\u09A1\u09BF\u09B8\u09C7"],longhand:["\u099C\u09BE\u09A8\u09C1\u09AF\u09BC\u09BE\u09B0\u09C0","\u09AB\u09C7\u09AC\u09CD\u09B0\u09C1\u09AF\u09BC\u09BE\u09B0\u09C0","\u09AE\u09BE\u09B0\u09CD\u099A","\u098F\u09AA\u09CD\u09B0\u09BF\u09B2","\u09AE\u09C7","\u099C\u09C1\u09A8","\u099C\u09C1\u09B2\u09BE\u0987","\u0986\u0997\u09B8\u09CD\u099F","\u09B8\u09C7\u09AA\u09CD\u099F\u09C7\u09AE\u09CD\u09AC\u09B0","\u0985\u0995\u09CD\u099F\u09CB\u09AC\u09B0","\u09A8\u09AD\u09C7\u09AE\u09CD\u09AC\u09B0","\u09A1\u09BF\u09B8\u09C7\u09AE\u09CD\u09AC\u09B0"]}};QS.l10ns.bn=ep;var o4=QS.l10ns;var XS=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},tp={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","\u010Cet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","\u010Cetvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Juni","Juli","Avgust","Septembar","Oktobar","Novembar","Decembar"]},time_24hr:!0};XS.l10ns.bs=tp;var l4=XS.l10ns;var np=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Wc={weekdays:{shorthand:["Dg","Dl","Dt","Dc","Dj","Dv","Ds"],longhand:["Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte"]},months:{shorthand:["Gen","Febr","Mar\xE7","Abr","Maig","Juny","Jul","Ag","Set","Oct","Nov","Des"],longhand:["Gener","Febrer","Mar\xE7","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"]},ordinal:e=>{let t=e%100;if(t>3&&t<21)return"\xE8";switch(t%10){case 1:return"r";case 2:return"n";case 3:return"r";case 4:return"t";default:return"\xE8"}},firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};np.l10ns.cat=np.l10ns.ca=Wc;var c4=np.l10ns;var eE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},rp={weekdays:{shorthand:["\u06CC\u06D5\u06A9\u0634\u06D5\u0645\u0645\u06D5","\u062F\u0648\u0648\u0634\u06D5\u0645\u0645\u06D5","\u0633\u06CE\u0634\u06D5\u0645\u0645\u06D5","\u0686\u0648\u0627\u0631\u0634\u06D5\u0645\u0645\u06D5","\u067E\u06CE\u0646\u062C\u0634\u06D5\u0645\u0645\u06D5","\u0647\u06D5\u06CC\u0646\u06CC","\u0634\u06D5\u0645\u0645\u06D5"],longhand:["\u06CC\u06D5\u06A9\u0634\u06D5\u0645\u0645\u06D5","\u062F\u0648\u0648\u0634\u06D5\u0645\u0645\u06D5","\u0633\u06CE\u0634\u06D5\u0645\u0645\u06D5","\u0686\u0648\u0627\u0631\u0634\u06D5\u0645\u0645\u06D5","\u067E\u06CE\u0646\u062C\u0634\u06D5\u0645\u0645\u06D5","\u0647\u06D5\u06CC\u0646\u06CC","\u0634\u06D5\u0645\u0645\u06D5"]},months:{shorthand:["\u0695\u06CE\u0628\u06D5\u0646\u062F\u0627\u0646","\u0695\u06D5\u0634\u06D5\u0645\u06D5","\u0646\u06D5\u0648\u0631\u06C6\u0632","\u06AF\u0648\u06B5\u0627\u0646","\u062C\u06C6\u0632\u06D5\u0631\u062F\u0627\u0646","\u067E\u0648\u0648\u0634\u067E\u06D5\u0695","\u06AF\u06D5\u0644\u0627\u0648\u06CE\u0698","\u062E\u06D5\u0631\u0645\u0627\u0646\u0627\u0646","\u0695\u06D5\u0632\u0628\u06D5\u0631","\u06AF\u06D5\u06B5\u0627\u0695\u06CE\u0632\u0627\u0646","\u0633\u06D5\u0631\u0645\u0627\u0648\u06D5\u0632","\u0628\u06D5\u0641\u0631\u0627\u0646\u0628\u0627\u0631"],longhand:["\u0695\u06CE\u0628\u06D5\u0646\u062F\u0627\u0646","\u0695\u06D5\u0634\u06D5\u0645\u06D5","\u0646\u06D5\u0648\u0631\u06C6\u0632","\u06AF\u0648\u06B5\u0627\u0646","\u062C\u06C6\u0632\u06D5\u0631\u062F\u0627\u0646","\u067E\u0648\u0648\u0634\u067E\u06D5\u0695","\u06AF\u06D5\u0644\u0627\u0648\u06CE\u0698","\u062E\u06D5\u0631\u0645\u0627\u0646\u0627\u0646","\u0695\u06D5\u0632\u0628\u06D5\u0631","\u06AF\u06D5\u06B5\u0627\u0695\u06CE\u0632\u0627\u0646","\u0633\u06D5\u0631\u0645\u0627\u0648\u06D5\u0632","\u0628\u06D5\u0641\u0631\u0627\u0646\u0628\u0627\u0631"]},firstDayOfWeek:6,ordinal:()=>""};eE.l10ns.ckb=rp;var f4=eE.l10ns;var tE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ip={weekdays:{shorthand:["Ne","Po","\xDAt","St","\u010Ct","P\xE1","So"],longhand:["Ned\u011Ble","Pond\u011Bl\xED","\xDAter\xFD","St\u0159eda","\u010Ctvrtek","P\xE1tek","Sobota"]},months:{shorthand:["Led","\xDAn","B\u0159e","Dub","Kv\u011B","\u010Cer","\u010Cvc","Srp","Z\xE1\u0159","\u0158\xEDj","Lis","Pro"],longhand:["Leden","\xDAnor","B\u0159ezen","Duben","Kv\u011Bten","\u010Cerven","\u010Cervenec","Srpen","Z\xE1\u0159\xED","\u0158\xEDjen","Listopad","Prosinec"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" do ",weekAbbreviation:"T\xFDd.",scrollTitle:"Rolujte pro zm\u011Bnu",toggleTitle:"P\u0159epnout dopoledne/odpoledne",amPM:["dop.","odp."],yearAriaLabel:"Rok",time_24hr:!0};tE.l10ns.cs=ip;var m4=tE.l10ns;var nE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ap={weekdays:{shorthand:["Sul","Llun","Maw","Mer","Iau","Gwe","Sad"],longhand:["Dydd Sul","Dydd Llun","Dydd Mawrth","Dydd Mercher","Dydd Iau","Dydd Gwener","Dydd Sadwrn"]},months:{shorthand:["Ion","Chwef","Maw","Ebr","Mai","Meh","Gorff","Awst","Medi","Hyd","Tach","Rhag"],longhand:["Ionawr","Chwefror","Mawrth","Ebrill","Mai","Mehefin","Gorffennaf","Awst","Medi","Hydref","Tachwedd","Rhagfyr"]},firstDayOfWeek:1,ordinal:e=>e===1?"af":e===2?"ail":e===3||e===4?"ydd":e===5||e===6?"ed":e>=7&&e<=10||e==12||e==15||e==18||e==20?"fed":e==11||e==13||e==14||e==16||e==17||e==19?"eg":e>=21&&e<=39?"ain":"",time_24hr:!0};nE.l10ns.cy=ap;var g4=nE.l10ns;var rE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},op={weekdays:{shorthand:["s\xF8n","man","tir","ons","tors","fre","l\xF8r"],longhand:["s\xF8ndag","mandag","tirsdag","onsdag","torsdag","fredag","l\xF8rdag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},ordinal:()=>".",firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"uge",time_24hr:!0};rE.l10ns.da=op;var v4=rE.l10ns;var iE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},sp={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["Jan","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["Januar","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum \xC4ndern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};iE.l10ns.de=sp;var b4=iE.l10ns;var so={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:e=>{let t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},Yc=so;var aE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},lp={firstDayOfWeek:1,rangeSeparator:" \u011Dis ",weekAbbreviation:"Sem",scrollTitle:"Rulumu por pligrandigi la valoron",toggleTitle:"Klaku por \u015Dalti",weekdays:{shorthand:["Dim","Lun","Mar","Mer","\u0134a\u016D","Ven","Sab"],longhand:["diman\u0109o","lundo","mardo","merkredo","\u0135a\u016Ddo","vendredo","sabato"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","A\u016Dg","Sep","Okt","Nov","Dec"],longhand:["januaro","februaro","marto","aprilo","majo","junio","julio","a\u016Dgusto","septembro","oktobro","novembro","decembro"]},ordinal:()=>"-a",time_24hr:!0};aE.l10ns.eo=lp;var E4=aE.l10ns;var oE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},up={weekdays:{shorthand:["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"],longhand:["Domingo","Lunes","Martes","Mi\xE9rcoles","Jueves","Viernes","S\xE1bado"]},months:{shorthand:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],longhand:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},ordinal:()=>"\xBA",firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};oE.l10ns.es=up;var x4=oE.l10ns;var sE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},cp={weekdays:{shorthand:["P","E","T","K","N","R","L"],longhand:["P\xFChap\xE4ev","Esmasp\xE4ev","Teisip\xE4ev","Kolmap\xE4ev","Neljap\xE4ev","Reede","Laup\xE4ev"]},months:{shorthand:["Jaan","Veebr","M\xE4rts","Apr","Mai","Juuni","Juuli","Aug","Sept","Okt","Nov","Dets"],longhand:["Jaanuar","Veebruar","M\xE4rts","Aprill","Mai","Juuni","Juuli","August","September","Oktoober","November","Detsember"]},firstDayOfWeek:1,ordinal:function(){return"."},weekAbbreviation:"N\xE4d",rangeSeparator:" kuni ",scrollTitle:"Keri, et suurendada",toggleTitle:"Kl\xF5psa, et vahetada",time_24hr:!0};sE.l10ns.et=cp;var _4=sE.l10ns;var lE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},dp={weekdays:{shorthand:["\u06CC\u06A9","\u062F\u0648","\u0633\u0647","\u0686\u0647\u0627\u0631","\u067E\u0646\u062C","\u062C\u0645\u0639\u0647","\u0634\u0646\u0628\u0647"],longhand:["\u06CC\u06A9\u200C\u0634\u0646\u0628\u0647","\u062F\u0648\u0634\u0646\u0628\u0647","\u0633\u0647\u200C\u0634\u0646\u0628\u0647","\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647","\u067E\u0646\u0686\u200C\u0634\u0646\u0628\u0647","\u062C\u0645\u0639\u0647","\u0634\u0646\u0628\u0647"]},months:{shorthand:["\u0698\u0627\u0646\u0648\u06CC\u0647","\u0641\u0648\u0631\u06CC\u0647","\u0645\u0627\u0631\u0633","\u0622\u0648\u0631\u06CC\u0644","\u0645\u0647","\u0698\u0648\u0626\u0646","\u0698\u0648\u0626\u06CC\u0647","\u0627\u0648\u062A","\u0633\u067E\u062A\u0627\u0645\u0628\u0631","\u0627\u06A9\u062A\u0628\u0631","\u0646\u0648\u0627\u0645\u0628\u0631","\u062F\u0633\u0627\u0645\u0628\u0631"],longhand:["\u0698\u0627\u0646\u0648\u06CC\u0647","\u0641\u0648\u0631\u06CC\u0647","\u0645\u0627\u0631\u0633","\u0622\u0648\u0631\u06CC\u0644","\u0645\u0647","\u0698\u0648\u0626\u0646","\u0698\u0648\u0626\u06CC\u0647","\u0627\u0648\u062A","\u0633\u067E\u062A\u0627\u0645\u0628\u0631","\u0627\u06A9\u062A\u0628\u0631","\u0646\u0648\u0627\u0645\u0628\u0631","\u062F\u0633\u0627\u0645\u0628\u0631"]},firstDayOfWeek:6,ordinal:()=>""};lE.l10ns.fa=dp;var T4=lE.l10ns;var uE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},fp={firstDayOfWeek:1,weekdays:{shorthand:["su","ma","ti","ke","to","pe","la"],longhand:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},months:{shorthand:["tammi","helmi","maalis","huhti","touko","kes\xE4","hein\xE4","elo","syys","loka","marras","joulu"],longhand:["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kes\xE4kuu","hein\xE4kuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"]},ordinal:()=>".",time_24hr:!0};uE.l10ns.fi=fp;var I4=uE.l10ns;var cE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},hp={weekdays:{shorthand:["Sun","M\xE1n","T\xFDs","Mik","H\xF3s","Fr\xED","Ley"],longhand:["Sunnudagur","M\xE1nadagur","T\xFDsdagur","Mikudagur","H\xF3sdagur","Fr\xEDggjadagur","Leygardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","Apr\xEDl","Mai","Juni","Juli","August","Septembur","Oktobur","Novembur","Desembur"]},ordinal:()=>".",firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",scrollTitle:"Rulla fyri at broyta",toggleTitle:"Tr\xFDst fyri at skifta",yearAriaLabel:"\xC1r",time_24hr:!0};cE.l10ns.fo=hp;var O4=cE.l10ns;var dE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},mp={firstDayOfWeek:1,weekdays:{shorthand:["dim","lun","mar","mer","jeu","ven","sam"],longhand:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},months:{shorthand:["janv","f\xE9vr","mars","avr","mai","juin","juil","ao\xFBt","sept","oct","nov","d\xE9c"],longhand:["janvier","f\xE9vrier","mars","avril","mai","juin","juillet","ao\xFBt","septembre","octobre","novembre","d\xE9cembre"]},ordinal:e=>e>1?"":"er",rangeSeparator:" au ",weekAbbreviation:"Sem",scrollTitle:"D\xE9filer pour augmenter la valeur",toggleTitle:"Cliquer pour basculer",time_24hr:!0};dE.l10ns.fr=mp;var P4=dE.l10ns;var fE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},pp={weekdays:{shorthand:["\u039A\u03C5","\u0394\u03B5","\u03A4\u03C1","\u03A4\u03B5","\u03A0\u03AD","\u03A0\u03B1","\u03A3\u03AC"],longhand:["\u039A\u03C5\u03C1\u03B9\u03B1\u03BA\u03AE","\u0394\u03B5\u03C5\u03C4\u03AD\u03C1\u03B1","\u03A4\u03C1\u03AF\u03C4\u03B7","\u03A4\u03B5\u03C4\u03AC\u03C1\u03C4\u03B7","\u03A0\u03AD\u03BC\u03C0\u03C4\u03B7","\u03A0\u03B1\u03C1\u03B1\u03C3\u03BA\u03B5\u03C5\u03AE","\u03A3\u03AC\u03B2\u03B2\u03B1\u03C4\u03BF"]},months:{shorthand:["\u0399\u03B1\u03BD","\u03A6\u03B5\u03B2","\u039C\u03AC\u03C1","\u0391\u03C0\u03C1","\u039C\u03AC\u03B9","\u0399\u03BF\u03CD\u03BD","\u0399\u03BF\u03CD\u03BB","\u0391\u03CD\u03B3","\u03A3\u03B5\u03C0","\u039F\u03BA\u03C4","\u039D\u03BF\u03AD","\u0394\u03B5\u03BA"],longhand:["\u0399\u03B1\u03BD\u03BF\u03C5\u03AC\u03C1\u03B9\u03BF\u03C2","\u03A6\u03B5\u03B2\u03C1\u03BF\u03C5\u03AC\u03C1\u03B9\u03BF\u03C2","\u039C\u03AC\u03C1\u03C4\u03B9\u03BF\u03C2","\u0391\u03C0\u03C1\u03AF\u03BB\u03B9\u03BF\u03C2","\u039C\u03AC\u03B9\u03BF\u03C2","\u0399\u03BF\u03CD\u03BD\u03B9\u03BF\u03C2","\u0399\u03BF\u03CD\u03BB\u03B9\u03BF\u03C2","\u0391\u03CD\u03B3\u03BF\u03C5\u03C3\u03C4\u03BF\u03C2","\u03A3\u03B5\u03C0\u03C4\u03AD\u03BC\u03B2\u03C1\u03B9\u03BF\u03C2","\u039F\u03BA\u03C4\u03CE\u03B2\u03C1\u03B9\u03BF\u03C2","\u039D\u03BF\u03AD\u03BC\u03B2\u03C1\u03B9\u03BF\u03C2","\u0394\u03B5\u03BA\u03AD\u03BC\u03B2\u03C1\u03B9\u03BF\u03C2"]},firstDayOfWeek:1,ordinal:function(){return""},weekAbbreviation:"\u0395\u03B2\u03B4",rangeSeparator:" \u03AD\u03C9\u03C2 ",scrollTitle:"\u039C\u03B5\u03C4\u03B1\u03BA\u03C5\u03BB\u03AE\u03C3\u03C4\u03B5 \u03B3\u03B9\u03B1 \u03C0\u03C1\u03BF\u03C3\u03B1\u03CD\u03BE\u03B7\u03C3\u03B7",toggleTitle:"\u039A\u03AC\u03BD\u03C4\u03B5 \u03BA\u03BB\u03B9\u03BA \u03B3\u03B9\u03B1 \u03B1\u03BB\u03BB\u03B1\u03B3\u03AE",amPM:["\u03A0\u039C","\u039C\u039C"],yearAriaLabel:"\u03C7\u03C1\u03CC\u03BD\u03BF\u03C2",monthAriaLabel:"\u03BC\u03AE\u03BD\u03B1\u03C2",hourAriaLabel:"\u03CE\u03C1\u03B1",minuteAriaLabel:"\u03BB\u03B5\u03C0\u03C4\u03CC"};fE.l10ns.gr=pp;var R4=fE.l10ns;var hE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},gp={weekdays:{shorthand:["\u05D0","\u05D1","\u05D2","\u05D3","\u05D4","\u05D5","\u05E9"],longhand:["\u05E8\u05D0\u05E9\u05D5\u05DF","\u05E9\u05E0\u05D9","\u05E9\u05DC\u05D9\u05E9\u05D9","\u05E8\u05D1\u05D9\u05E2\u05D9","\u05D7\u05DE\u05D9\u05E9\u05D9","\u05E9\u05D9\u05E9\u05D9","\u05E9\u05D1\u05EA"]},months:{shorthand:["\u05D9\u05E0\u05D5\u05F3","\u05E4\u05D1\u05E8\u05F3","\u05DE\u05E8\u05E5","\u05D0\u05E4\u05E8\u05F3","\u05DE\u05D0\u05D9","\u05D9\u05D5\u05E0\u05D9","\u05D9\u05D5\u05DC\u05D9","\u05D0\u05D5\u05D2\u05F3","\u05E1\u05E4\u05D8\u05F3","\u05D0\u05D5\u05E7\u05F3","\u05E0\u05D5\u05D1\u05F3","\u05D3\u05E6\u05DE\u05F3"],longhand:["\u05D9\u05E0\u05D5\u05D0\u05E8","\u05E4\u05D1\u05E8\u05D5\u05D0\u05E8","\u05DE\u05E8\u05E5","\u05D0\u05E4\u05E8\u05D9\u05DC","\u05DE\u05D0\u05D9","\u05D9\u05D5\u05E0\u05D9","\u05D9\u05D5\u05DC\u05D9","\u05D0\u05D5\u05D2\u05D5\u05E1\u05D8","\u05E1\u05E4\u05D8\u05DE\u05D1\u05E8","\u05D0\u05D5\u05E7\u05D8\u05D5\u05D1\u05E8","\u05E0\u05D5\u05D1\u05DE\u05D1\u05E8","\u05D3\u05E6\u05DE\u05D1\u05E8"]},rangeSeparator:" \u05D0\u05DC ",time_24hr:!0};hE.l10ns.he=gp;var B4=hE.l10ns;var mE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},yp={weekdays:{shorthand:["\u0930\u0935\u093F","\u0938\u094B\u092E","\u092E\u0902\u0917\u0932","\u092C\u0941\u0927","\u0917\u0941\u0930\u0941","\u0936\u0941\u0915\u094D\u0930","\u0936\u0928\u093F"],longhand:["\u0930\u0935\u093F\u0935\u093E\u0930","\u0938\u094B\u092E\u0935\u093E\u0930","\u092E\u0902\u0917\u0932\u0935\u093E\u0930","\u092C\u0941\u0927\u0935\u093E\u0930","\u0917\u0941\u0930\u0941\u0935\u093E\u0930","\u0936\u0941\u0915\u094D\u0930\u0935\u093E\u0930","\u0936\u0928\u093F\u0935\u093E\u0930"]},months:{shorthand:["\u091C\u0928","\u092B\u0930","\u092E\u093E\u0930\u094D\u091A","\u0905\u092A\u094D\u0930\u0947\u0932","\u092E\u0908","\u091C\u0942\u0928","\u091C\u0942\u0932\u093E\u0908","\u0905\u0917","\u0938\u093F\u0924","\u0905\u0915\u094D\u091F","\u0928\u0935","\u0926\u093F"],longhand:["\u091C\u0928\u0935\u0930\u0940 ","\u092B\u0930\u0935\u0930\u0940","\u092E\u093E\u0930\u094D\u091A","\u0905\u092A\u094D\u0930\u0947\u0932","\u092E\u0908","\u091C\u0942\u0928","\u091C\u0942\u0932\u093E\u0908","\u0905\u0917\u0938\u094D\u0924 ","\u0938\u093F\u0924\u092E\u094D\u092C\u0930","\u0905\u0915\u094D\u091F\u0942\u092C\u0930","\u0928\u0935\u092E\u094D\u092C\u0930","\u0926\u093F\u0938\u092E\u094D\u092C\u0930"]}};mE.l10ns.hi=yp;var $4=mE.l10ns;var pE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},vp={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","\u010Cet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","\u010Cetvrtak","Petak","Subota"]},months:{shorthand:["Sij","Velj","O\u017Eu","Tra","Svi","Lip","Srp","Kol","Ruj","Lis","Stu","Pro"],longhand:["Sije\u010Danj","Velja\u010Da","O\u017Eujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"]},time_24hr:!0};pE.l10ns.hr=vp;var W4=pE.l10ns;var gE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},wp={firstDayOfWeek:1,weekdays:{shorthand:["V","H","K","Sz","Cs","P","Szo"],longhand:["Vas\xE1rnap","H\xE9tf\u0151","Kedd","Szerda","Cs\xFCt\xF6rt\xF6k","P\xE9ntek","Szombat"]},months:{shorthand:["Jan","Feb","M\xE1r","\xC1pr","M\xE1j","J\xFAn","J\xFAl","Aug","Szep","Okt","Nov","Dec"],longhand:["Janu\xE1r","Febru\xE1r","M\xE1rcius","\xC1prilis","M\xE1jus","J\xFAnius","J\xFAlius","Augusztus","Szeptember","Okt\xF3ber","November","December"]},ordinal:function(){return"."},weekAbbreviation:"H\xE9t",scrollTitle:"G\xF6rgessen",toggleTitle:"Kattintson a v\xE1lt\xE1shoz",rangeSeparator:" - ",time_24hr:!0};gE.l10ns.hu=wp;var z4=gE.l10ns;var yE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},bp={weekdays:{shorthand:["\u053F\u056B\u0580","\u0535\u0580\u056F","\u0535\u0580\u0584","\u0549\u0580\u0584","\u0540\u0576\u0563","\u0548\u0582\u0580\u0562","\u0547\u0562\u0569"],longhand:["\u053F\u056B\u0580\u0561\u056F\u056B","\u0535\u056F\u0578\u0582\u0577\u0561\u0562\u0569\u056B","\u0535\u0580\u0565\u0584\u0577\u0561\u0562\u0569\u056B","\u0549\u0578\u0580\u0565\u0584\u0577\u0561\u0562\u0569\u056B","\u0540\u056B\u0576\u0563\u0577\u0561\u0562\u0569\u056B","\u0548\u0582\u0580\u0562\u0561\u0569","\u0547\u0561\u0562\u0561\u0569"]},months:{shorthand:["\u0540\u0576\u057E","\u0553\u057F\u0580","\u0544\u0561\u0580","\u0531\u057A\u0580","\u0544\u0561\u0575","\u0540\u0576\u057D","\u0540\u056C\u057D","\u0555\u0563\u057D","\u054D\u0565\u057A","\u0540\u0578\u056F","\u0546\u0574\u0562","\u0534\u0565\u056F"],longhand:["\u0540\u0578\u0582\u0576\u057E\u0561\u0580","\u0553\u0565\u057F\u0580\u057E\u0561\u0580","\u0544\u0561\u0580\u057F","\u0531\u057A\u0580\u056B\u056C","\u0544\u0561\u0575\u056B\u057D","\u0540\u0578\u0582\u0576\u056B\u057D","\u0540\u0578\u0582\u056C\u056B\u057D","\u0555\u0563\u0578\u057D\u057F\u0578\u057D","\u054D\u0565\u057A\u057F\u0565\u0574\u0562\u0565\u0580","\u0540\u0578\u056F\u057F\u0565\u0574\u0562\u0565\u0580","\u0546\u0578\u0575\u0565\u0574\u0562\u0565\u0580","\u0534\u0565\u056F\u057F\u0565\u0574\u0562\u0565\u0580"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" \u2014 ",weekAbbreviation:"\u0547\u0532\u054F",scrollTitle:"\u0548\u056C\u0578\u0580\u0565\u0584\u055D \u0574\u0565\u056E\u0561\u0581\u0576\u0565\u056C\u0578\u0582 \u0570\u0561\u0574\u0561\u0580",toggleTitle:"\u054D\u0565\u0572\u0574\u0565\u0584\u055D \u0583\u0578\u056D\u0565\u056C\u0578\u0582 \u0570\u0561\u0574\u0561\u0580",amPM:["\u0544\u053F","\u053F\u0540"],yearAriaLabel:"\u054F\u0561\u0580\u056B",monthAriaLabel:"\u0531\u0574\u056B\u057D",hourAriaLabel:"\u053A\u0561\u0574",minuteAriaLabel:"\u0550\u0578\u057A\u0565",time_24hr:!0};yE.l10ns.hy=bp;var j4=yE.l10ns;var vE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Dp={weekdays:{shorthand:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],longhand:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],longhand:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]},firstDayOfWeek:1,ordinal:()=>"",time_24hr:!0,rangeSeparator:" - "};vE.l10ns.id=Dp;var G4=vE.l10ns;var wE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Sp={weekdays:{shorthand:["Sun","M\xE1n","\xDEri","Mi\xF0","Fim","F\xF6s","Lau"],longhand:["Sunnudagur","M\xE1nudagur","\xDEri\xF0judagur","Mi\xF0vikudagur","Fimmtudagur","F\xF6studagur","Laugardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Ma\xED","J\xFAn","J\xFAl","\xC1g\xFA","Sep","Okt","N\xF3v","Des"],longhand:["Jan\xFAar","Febr\xFAar","Mars","Apr\xEDl","Ma\xED","J\xFAn\xED","J\xFAl\xED","\xC1g\xFAst","September","Okt\xF3ber","N\xF3vember","Desember"]},ordinal:()=>".",firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",yearAriaLabel:"\xC1r",time_24hr:!0};wE.l10ns.is=Sp;var Z4=wE.l10ns;var bE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ep={weekdays:{shorthand:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],longhand:["Domenica","Luned\xEC","Marted\xEC","Mercoled\xEC","Gioved\xEC","Venerd\xEC","Sabato"]},months:{shorthand:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],longhand:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},firstDayOfWeek:1,ordinal:()=>"\xB0",rangeSeparator:" al ",weekAbbreviation:"Se",scrollTitle:"Scrolla per aumentare",toggleTitle:"Clicca per cambiare",time_24hr:!0};bE.l10ns.it=Ep;var X4=bE.l10ns;var DE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},kp={weekdays:{shorthand:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],longhand:["\u65E5\u66DC\u65E5","\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5"]},months:{shorthand:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],longhand:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"]},time_24hr:!0,rangeSeparator:" \u304B\u3089 ",monthAriaLabel:"\u6708",amPM:["\u5348\u524D","\u5348\u5F8C"],yearAriaLabel:"\u5E74",hourAriaLabel:"\u6642\u9593",minuteAriaLabel:"\u5206"};DE.l10ns.ja=kp;var tY=DE.l10ns;var SE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},xp={weekdays:{shorthand:["\u10D9\u10D5","\u10DD\u10E0","\u10E1\u10D0","\u10DD\u10D7","\u10EE\u10E3","\u10DE\u10D0","\u10E8\u10D0"],longhand:["\u10D9\u10D5\u10D8\u10E0\u10D0","\u10DD\u10E0\u10E8\u10D0\u10D1\u10D0\u10D7\u10D8","\u10E1\u10D0\u10DB\u10E8\u10D0\u10D1\u10D0\u10D7\u10D8","\u10DD\u10D7\u10EE\u10E8\u10D0\u10D1\u10D0\u10D7\u10D8","\u10EE\u10E3\u10D7\u10E8\u10D0\u10D1\u10D0\u10D7\u10D8","\u10DE\u10D0\u10E0\u10D0\u10E1\u10D9\u10D4\u10D5\u10D8","\u10E8\u10D0\u10D1\u10D0\u10D7\u10D8"]},months:{shorthand:["\u10D8\u10D0\u10DC","\u10D7\u10D4\u10D1","\u10DB\u10D0\u10E0","\u10D0\u10DE\u10E0","\u10DB\u10D0\u10D8","\u10D8\u10D5\u10DC","\u10D8\u10D5\u10DA","\u10D0\u10D2\u10D5","\u10E1\u10D4\u10E5","\u10DD\u10E5\u10E2","\u10DC\u10DD\u10D4","\u10D3\u10D4\u10D9"],longhand:["\u10D8\u10D0\u10DC\u10D5\u10D0\u10E0\u10D8","\u10D7\u10D4\u10D1\u10D4\u10E0\u10D5\u10D0\u10DA\u10D8","\u10DB\u10D0\u10E0\u10E2\u10D8","\u10D0\u10DE\u10E0\u10D8\u10DA\u10D8","\u10DB\u10D0\u10D8\u10E1\u10D8","\u10D8\u10D5\u10DC\u10D8\u10E1\u10D8","\u10D8\u10D5\u10DA\u10D8\u10E1\u10D8","\u10D0\u10D2\u10D5\u10D8\u10E1\u10E2\u10DD","\u10E1\u10D4\u10E5\u10E2\u10D4\u10DB\u10D1\u10D4\u10E0\u10D8","\u10DD\u10E5\u10E2\u10DD\u10DB\u10D1\u10D4\u10E0\u10D8","\u10DC\u10DD\u10D4\u10DB\u10D1\u10D4\u10E0\u10D8","\u10D3\u10D4\u10D9\u10D4\u10DB\u10D1\u10D4\u10E0\u10D8"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" \u2014 ",weekAbbreviation:"\u10D9\u10D5.",scrollTitle:"\u10D3\u10D0\u10E1\u10E5\u10E0\u10DD\u10DA\u10D4\u10D7 \u10D2\u10D0\u10E1\u10D0\u10D3\u10D8\u10D3\u10D4\u10D1\u10DA\u10D0\u10D3",toggleTitle:"\u10D3\u10D0\u10D0\u10D9\u10DA\u10D8\u10D9\u10D4\u10D7 \u10D2\u10D0\u10D3\u10D0\u10E0\u10D7\u10D5\u10D8\u10E1\u10D7\u10D5\u10D8\u10E1",amPM:["AM","PM"],yearAriaLabel:"\u10EC\u10D4\u10DA\u10D8",time_24hr:!0};SE.l10ns.ka=xp;var rY=SE.l10ns;var EE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Cp={weekdays:{shorthand:["\u17A2\u17B6\u1791\u17B7\u178F\u17D2\u1799","\u1785\u1793\u17D2\u1791","\u17A2\u1784\u17D2\u1782\u17B6\u179A","\u1796\u17BB\u1792","\u1796\u17D2\u179A\u17A0\u179F.","\u179F\u17BB\u1780\u17D2\u179A","\u179F\u17C5\u179A\u17CD"],longhand:["\u17A2\u17B6\u1791\u17B7\u178F\u17D2\u1799","\u1785\u1793\u17D2\u1791","\u17A2\u1784\u17D2\u1782\u17B6\u179A","\u1796\u17BB\u1792","\u1796\u17D2\u179A\u17A0\u179F\u17D2\u1794\u178F\u17B7\u17CD","\u179F\u17BB\u1780\u17D2\u179A","\u179F\u17C5\u179A\u17CD"]},months:{shorthand:["\u1798\u1780\u179A\u17B6","\u1780\u17BB\u1798\u17D2\u1797\u17C7","\u1798\u17B8\u1793\u17B6","\u1798\u17C1\u179F\u17B6","\u17A7\u179F\u1797\u17B6","\u1798\u17B7\u1790\u17BB\u1793\u17B6","\u1780\u1780\u17D2\u1780\u178A\u17B6","\u179F\u17B8\u17A0\u17B6","\u1780\u1789\u17D2\u1789\u17B6","\u178F\u17BB\u179B\u17B6","\u179C\u17B7\u1785\u17D2\u1786\u17B7\u1780\u17B6","\u1792\u17D2\u1793\u17BC"],longhand:["\u1798\u1780\u179A\u17B6","\u1780\u17BB\u1798\u17D2\u1797\u17C7","\u1798\u17B8\u1793\u17B6","\u1798\u17C1\u179F\u17B6","\u17A7\u179F\u1797\u17B6","\u1798\u17B7\u1790\u17BB\u1793\u17B6","\u1780\u1780\u17D2\u1780\u178A\u17B6","\u179F\u17B8\u17A0\u17B6","\u1780\u1789\u17D2\u1789\u17B6","\u178F\u17BB\u179B\u17B6","\u179C\u17B7\u1785\u17D2\u1786\u17B7\u1780\u17B6","\u1792\u17D2\u1793\u17BC"]},ordinal:()=>"",firstDayOfWeek:1,rangeSeparator:" \u178A\u179B\u17CB ",weekAbbreviation:"\u179F\u1794\u17D2\u178F\u17B6\u17A0\u17CD",scrollTitle:"\u179A\u17C6\u1780\u17B7\u179B\u178A\u17BE\u1798\u17D2\u1794\u17B8\u1794\u1784\u17D2\u1780\u17BE\u1793",toggleTitle:"\u1785\u17BB\u1785\u178A\u17BE\u1798\u17D2\u1794\u17B8\u1795\u17D2\u179B\u17B6\u179F\u17CB\u1794\u17D2\u178A\u17BC\u179A",yearAriaLabel:"\u1786\u17D2\u1793\u17B6\u17C6",time_24hr:!0};EE.l10ns.km=Cp;var aY=EE.l10ns;var kE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_p={weekdays:{shorthand:["\uC77C","\uC6D4","\uD654","\uC218","\uBAA9","\uAE08","\uD1A0"],longhand:["\uC77C\uC694\uC77C","\uC6D4\uC694\uC77C","\uD654\uC694\uC77C","\uC218\uC694\uC77C","\uBAA9\uC694\uC77C","\uAE08\uC694\uC77C","\uD1A0\uC694\uC77C"]},months:{shorthand:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"],longhand:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"]},ordinal:()=>"\uC77C",rangeSeparator:" ~ ",amPM:["\uC624\uC804","\uC624\uD6C4"]};kE.l10ns.ko=_p;var sY=kE.l10ns;var xE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Mp={weekdays:{shorthand:["\u0416\u0441","\u0414\u0441","\u0421c","\u0421\u0440","\u0411\u0441","\u0416\u043C","\u0421\u0431"],longhand:["\u0416\u0435\u043A\u0441\u0435\u043D\u0431i","\u0414\u04AF\u0439\u0441\u0435\u043D\u0431i","\u0421\u0435\u0439\u0441\u0435\u043D\u0431i","\u0421\u04D9\u0440\u0441\u0435\u043D\u0431i","\u0411\u0435\u0439\u0441\u0435\u043D\u0431i","\u0416\u04B1\u043C\u0430","\u0421\u0435\u043D\u0431i"]},months:{shorthand:["\u049A\u0430\u04A3","\u0410\u049B\u043F","\u041D\u0430\u0443","\u0421\u04D9\u0443","\u041C\u0430\u043C","\u041C\u0430\u0443","\u0428i\u043B","\u0422\u0430\u043C","\u049A\u044B\u0440","\u049A\u0430\u0437","\u049A\u0430\u0440","\u0416\u0435\u043B"],longhand:["\u049A\u0430\u04A3\u0442\u0430\u0440","\u0410\u049B\u043F\u0430\u043D","\u041D\u0430\u0443\u0440\u044B\u0437","\u0421\u04D9\u0443i\u0440","\u041C\u0430\u043C\u044B\u0440","\u041C\u0430\u0443\u0441\u044B\u043C","\u0428i\u043B\u0434\u0435","\u0422\u0430\u043C\u044B\u0437","\u049A\u044B\u0440\u043A\u04AF\u0439\u0435\u043A","\u049A\u0430\u0437\u0430\u043D","\u049A\u0430\u0440\u0430\u0448\u0430","\u0416\u0435\u043B\u0442\u043E\u049B\u0441\u0430\u043D"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" \u2014 ",weekAbbreviation:"\u0410\u043F\u0442\u0430",scrollTitle:"\u04AE\u043B\u043A\u0435\u0439\u0442\u0443 \u04AF\u0448\u0456\u043D \u0430\u0439\u043D\u0430\u043B\u0434\u044B\u0440\u044B\u04A3\u044B\u0437",toggleTitle:"\u0410\u0443\u044B\u0441\u0442\u044B\u0440\u0443 \u04AF\u0448\u0456\u043D \u0431\u0430\u0441\u044B\u04A3\u044B\u0437",amPM:["\u0422\u0414","\u0422\u041A"],yearAriaLabel:"\u0416\u044B\u043B"};xE.l10ns.kz=Mp;var uY=xE.l10ns;var CE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Tp={weekdays:{shorthand:["S","Pr","A","T","K","Pn","\u0160"],longhand:["Sekmadienis","Pirmadienis","Antradienis","Tre\u010Diadienis","Ketvirtadienis","Penktadienis","\u0160e\u0161tadienis"]},months:{shorthand:["Sau","Vas","Kov","Bal","Geg","Bir","Lie","Rgp","Rgs","Spl","Lap","Grd"],longhand:["Sausis","Vasaris","Kovas","Balandis","Gegu\u017E\u0117","Bir\u017Eelis","Liepa","Rugpju\u0304tis","Rugse\u0307jis","Spalis","Lapkritis","Gruodis"]},firstDayOfWeek:1,ordinal:function(){return"-a"},rangeSeparator:" iki ",weekAbbreviation:"Sav",scrollTitle:"Keisti laik\u0105 pel\u0117s rateliu",toggleTitle:"Perjungti laiko format\u0105",time_24hr:!0};CE.l10ns.lt=Tp;var dY=CE.l10ns;var _E=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Fp={firstDayOfWeek:1,weekdays:{shorthand:["Sv","Pr","Ot","Tr","Ce","Pk","Se"],longhand:["Sv\u0113tdiena","Pirmdiena","Otrdiena","Tre\u0161diena","Ceturtdiena","Piektdiena","Sestdiena"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","J\u016Bn","J\u016Bl","Aug","Sep","Okt","Nov","Dec"],longhand:["Janv\u0101ris","Febru\u0101ris","Marts","Apr\u012Blis","Maijs","J\u016Bnijs","J\u016Blijs","Augusts","Septembris","Oktobris","Novembris","Decembris"]},rangeSeparator:" l\u012Bdz ",time_24hr:!0};_E.l10ns.lv=Fp;var hY=_E.l10ns;var ME=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ip={weekdays:{shorthand:["\u041D\u0435","\u041F\u043E","\u0412\u0442","\u0421\u0440","\u0427\u0435","\u041F\u0435","\u0421\u0430"],longhand:["\u041D\u0435\u0434\u0435\u043B\u0430","\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u043D\u0438\u043A","\u0412\u0442\u043E\u0440\u043D\u0438\u043A","\u0421\u0440\u0435\u0434\u0430","\u0427\u0435\u0442\u0432\u0440\u0442\u043E\u043A","\u041F\u0435\u0442\u043E\u043A","\u0421\u0430\u0431\u043E\u0442\u0430"]},months:{shorthand:["\u0408\u0430\u043D","\u0424\u0435\u0432","\u041C\u0430\u0440","\u0410\u043F\u0440","\u041C\u0430\u0458","\u0408\u0443\u043D","\u0408\u0443\u043B","\u0410\u0432\u0433","\u0421\u0435\u043F","\u041E\u043A\u0442","\u041D\u043E\u0435","\u0414\u0435\u043A"],longhand:["\u0408\u0430\u043D\u0443\u0430\u0440\u0438","\u0424\u0435\u0432\u0440\u0443\u0430\u0440\u0438","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440\u0438\u043B","\u041C\u0430\u0458","\u0408\u0443\u043D\u0438","\u0408\u0443\u043B\u0438","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043F\u0442\u0435\u043C\u0432\u0440\u0438","\u041E\u043A\u0442\u043E\u043C\u0432\u0440\u0438","\u041D\u043E\u0435\u043C\u0432\u0440\u0438","\u0414\u0435\u043A\u0435\u043C\u0432\u0440\u0438"]},firstDayOfWeek:1,weekAbbreviation:"\u041D\u0435\u0434.",rangeSeparator:" \u0434\u043E ",time_24hr:!0};ME.l10ns.mk=Ip;var pY=ME.l10ns;var TE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ap={firstDayOfWeek:1,weekdays:{shorthand:["\u0414\u0430","\u041C\u044F","\u041B\u0445","\u041F\u04AF","\u0411\u0430","\u0411\u044F","\u041D\u044F"],longhand:["\u0414\u0430\u0432\u0430\u0430","\u041C\u044F\u0433\u043C\u0430\u0440","\u041B\u0445\u0430\u0433\u0432\u0430","\u041F\u04AF\u0440\u044D\u0432","\u0411\u0430\u0430\u0441\u0430\u043D","\u0411\u044F\u043C\u0431\u0430","\u041D\u044F\u043C"]},months:{shorthand:["1-\u0440 \u0441\u0430\u0440","2-\u0440 \u0441\u0430\u0440","3-\u0440 \u0441\u0430\u0440","4-\u0440 \u0441\u0430\u0440","5-\u0440 \u0441\u0430\u0440","6-\u0440 \u0441\u0430\u0440","7-\u0440 \u0441\u0430\u0440","8-\u0440 \u0441\u0430\u0440","9-\u0440 \u0441\u0430\u0440","10-\u0440 \u0441\u0430\u0440","11-\u0440 \u0441\u0430\u0440","12-\u0440 \u0441\u0430\u0440"],longhand:["\u041D\u044D\u0433\u0434\u04AF\u0433\u044D\u044D\u0440 \u0441\u0430\u0440","\u0425\u043E\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0413\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0414\u04E9\u0440\u04E9\u0432\u0434\u04AF\u0433\u044D\u044D\u0440 \u0441\u0430\u0440","\u0422\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0417\u0443\u0440\u0433\u0430\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0414\u043E\u043B\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u041D\u0430\u0439\u043C\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0415\u0441\u0434\u04AF\u0433\u044D\u044D\u0440 \u0441\u0430\u0440","\u0410\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0410\u0440\u0432\u0430\u043D\u043D\u044D\u0433\u0434\u04AF\u0433\u044D\u044D\u0440 \u0441\u0430\u0440","\u0410\u0440\u0432\u0430\u043D\u0445\u043E\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440"]},rangeSeparator:"-\u0441 ",time_24hr:!0};TE.l10ns.mn=Ap;var yY=TE.l10ns;var tN=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},FE={weekdays:{shorthand:["Aha","Isn","Sel","Rab","Kha","Jum","Sab"],longhand:["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu"]},months:{shorthand:["Jan","Feb","Mac","Apr","Mei","Jun","Jul","Ogo","Sep","Okt","Nov","Dis"],longhand:["Januari","Februari","Mac","April","Mei","Jun","Julai","Ogos","September","Oktober","November","Disember"]},firstDayOfWeek:1,ordinal:()=>""},wY=tN.l10ns;var IE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Op={weekdays:{shorthand:["\u1014\u103D\u1031","\u101C\u102C","\u1002\u102B","\u101F\u1030\u1038","\u1000\u103C\u102C","\u101E\u1031\u102C","\u1014\u1031"],longhand:["\u1010\u1014\u1004\u103A\u1039\u1002\u1014\u103D\u1031","\u1010\u1014\u1004\u103A\u1039\u101C\u102C","\u1021\u1004\u103A\u1039\u1002\u102B","\u1017\u102F\u1012\u1039\u1013\u101F\u1030\u1038","\u1000\u103C\u102C\u101E\u1015\u1010\u1031\u1038","\u101E\u1031\u102C\u1000\u103C\u102C","\u1005\u1014\u1031"]},months:{shorthand:["\u1007\u1014\u103A","\u1016\u1031","\u1019\u1010\u103A","\u1015\u103C\u102E","\u1019\u1031","\u1007\u103D\u1014\u103A","\u101C\u102D\u102F\u1004\u103A","\u101E\u103C","\u1005\u1000\u103A","\u1021\u1031\u102C\u1000\u103A","\u1014\u102D\u102F","\u1012\u102E"],longhand:["\u1007\u1014\u103A\u1014\u101D\u102B\u101B\u102E","\u1016\u1031\u1016\u1031\u102C\u103A\u101D\u102B\u101B\u102E","\u1019\u1010\u103A","\u1027\u1015\u103C\u102E","\u1019\u1031","\u1007\u103D\u1014\u103A","\u1007\u1030\u101C\u102D\u102F\u1004\u103A","\u101E\u103C\u1002\u102F\u1010\u103A","\u1005\u1000\u103A\u1010\u1004\u103A\u1018\u102C","\u1021\u1031\u102C\u1000\u103A\u1010\u102D\u102F\u1018\u102C","\u1014\u102D\u102F\u101D\u1004\u103A\u1018\u102C","\u1012\u102E\u1007\u1004\u103A\u1018\u102C"]},firstDayOfWeek:1,ordinal:()=>"",time_24hr:!0};IE.l10ns.my=Op;var DY=IE.l10ns;var AE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Lp={weekdays:{shorthand:["zo","ma","di","wo","do","vr","za"],longhand:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},months:{shorthand:["jan","feb","mrt","apr","mei","jun","jul","aug","sept","okt","nov","dec"],longhand:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"]},firstDayOfWeek:1,weekAbbreviation:"wk",rangeSeparator:" t/m ",scrollTitle:"Scroll voor volgende / vorige",toggleTitle:"Klik om te wisselen",time_24hr:!0,ordinal:e=>e===1||e===8||e>=20?"ste":"de"};AE.l10ns.nl=Lp;var EY=AE.l10ns;var OE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Pp={weekdays:{shorthand:["S\xF8.","M\xE5.","Ty.","On.","To.","Fr.","La."],longhand:["S\xF8ndag","M\xE5ndag","Tysdag","Onsdag","Torsdag","Fredag","Laurdag"]},months:{shorthand:["Jan","Feb","Mars","Apr","Mai","Juni","Juli","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Veke",scrollTitle:"Scroll for \xE5 endre",toggleTitle:"Klikk for \xE5 veksle",time_24hr:!0,ordinal:()=>"."};OE.l10ns.nn=Pp;var xY=OE.l10ns;var LE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Np={weekdays:{shorthand:["S\xF8n","Man","Tir","Ons","Tor","Fre","L\xF8r"],longhand:["S\xF8ndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","L\xF8rdag"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Uke",scrollTitle:"Scroll for \xE5 endre",toggleTitle:"Klikk for \xE5 veksle",time_24hr:!0,ordinal:()=>"."};LE.l10ns.no=Np;var _Y=LE.l10ns;var PE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Rp={weekdays:{shorthand:["\u0A10\u0A24","\u0A38\u0A4B\u0A2E","\u0A2E\u0A70\u0A17\u0A32","\u0A2C\u0A41\u0A71\u0A27","\u0A35\u0A40\u0A30","\u0A38\u0A3C\u0A41\u0A71\u0A15\u0A30","\u0A38\u0A3C\u0A28\u0A3F\u0A71\u0A1A\u0A30"],longhand:["\u0A10\u0A24\u0A35\u0A3E\u0A30","\u0A38\u0A4B\u0A2E\u0A35\u0A3E\u0A30","\u0A2E\u0A70\u0A17\u0A32\u0A35\u0A3E\u0A30","\u0A2C\u0A41\u0A71\u0A27\u0A35\u0A3E\u0A30","\u0A35\u0A40\u0A30\u0A35\u0A3E\u0A30","\u0A38\u0A3C\u0A41\u0A71\u0A15\u0A30\u0A35\u0A3E\u0A30","\u0A38\u0A3C\u0A28\u0A3F\u0A71\u0A1A\u0A30\u0A35\u0A3E\u0A30"]},months:{shorthand:["\u0A1C\u0A28","\u0A2B\u0A3C\u0A30","\u0A2E\u0A3E\u0A30","\u0A05\u0A2A\u0A4D\u0A30\u0A48","\u0A2E\u0A08","\u0A1C\u0A42\u0A28","\u0A1C\u0A41\u0A32\u0A3E","\u0A05\u0A17","\u0A38\u0A24\u0A70","\u0A05\u0A15","\u0A28\u0A35\u0A70","\u0A26\u0A38\u0A70"],longhand:["\u0A1C\u0A28\u0A35\u0A30\u0A40","\u0A2B\u0A3C\u0A30\u0A35\u0A30\u0A40","\u0A2E\u0A3E\u0A30\u0A1A","\u0A05\u0A2A\u0A4D\u0A30\u0A48\u0A32","\u0A2E\u0A08","\u0A1C\u0A42\u0A28","\u0A1C\u0A41\u0A32\u0A3E\u0A08","\u0A05\u0A17\u0A38\u0A24","\u0A38\u0A24\u0A70\u0A2C\u0A30","\u0A05\u0A15\u0A24\u0A42\u0A2C\u0A30","\u0A28\u0A35\u0A70\u0A2C\u0A30","\u0A26\u0A38\u0A70\u0A2C\u0A30"]},time_24hr:!0};PE.l10ns.pa=Rp;var TY=PE.l10ns;var NE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Hp={weekdays:{shorthand:["Nd","Pn","Wt","\u015Ar","Cz","Pt","So"],longhand:["Niedziela","Poniedzia\u0142ek","Wtorek","\u015Aroda","Czwartek","Pi\u0105tek","Sobota"]},months:{shorthand:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Pa\u017A","Lis","Gru"],longhand:["Stycze\u0144","Luty","Marzec","Kwiecie\u0144","Maj","Czerwiec","Lipiec","Sierpie\u0144","Wrzesie\u0144","Pa\u017Adziernik","Listopad","Grudzie\u0144"]},rangeSeparator:" do ",weekAbbreviation:"tydz.",scrollTitle:"Przewi\u0144, aby zwi\u0119kszy\u0107",toggleTitle:"Kliknij, aby prze\u0142\u0105czy\u0107",firstDayOfWeek:1,time_24hr:!0,ordinal:()=>"."};NE.l10ns.pl=Hp;var IY=NE.l10ns;var RE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Bp={weekdays:{shorthand:["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"],longhand:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"]},months:{shorthand:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],longhand:["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"]},rangeSeparator:" at\xE9 ",time_24hr:!0};RE.l10ns.pt=Bp;var OY=RE.l10ns;var HE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Vp={weekdays:{shorthand:["Dum","Lun","Mar","Mie","Joi","Vin","S\xE2m"],longhand:["Duminic\u0103","Luni","Mar\u021Bi","Miercuri","Joi","Vineri","S\xE2mb\u0103t\u0103"]},months:{shorthand:["Ian","Feb","Mar","Apr","Mai","Iun","Iul","Aug","Sep","Oct","Noi","Dec"],longhand:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"]},firstDayOfWeek:1,time_24hr:!0,ordinal:()=>""};HE.l10ns.ro=Vp;var PY=HE.l10ns;var BE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},$p={weekdays:{shorthand:["\u0412\u0441","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],longhand:["\u0412\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435","\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A","\u0412\u0442\u043E\u0440\u043D\u0438\u043A","\u0421\u0440\u0435\u0434\u0430","\u0427\u0435\u0442\u0432\u0435\u0440\u0433","\u041F\u044F\u0442\u043D\u0438\u0446\u0430","\u0421\u0443\u0431\u0431\u043E\u0442\u0430"]},months:{shorthand:["\u042F\u043D\u0432","\u0424\u0435\u0432","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440","\u041C\u0430\u0439","\u0418\u044E\u043D\u044C","\u0418\u044E\u043B\u044C","\u0410\u0432\u0433","\u0421\u0435\u043D","\u041E\u043A\u0442","\u041D\u043E\u044F","\u0414\u0435\u043A"],longhand:["\u042F\u043D\u0432\u0430\u0440\u044C","\u0424\u0435\u0432\u0440\u0430\u043B\u044C","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440\u0435\u043B\u044C","\u041C\u0430\u0439","\u0418\u044E\u043D\u044C","\u0418\u044E\u043B\u044C","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C","\u041E\u043A\u0442\u044F\u0431\u0440\u044C","\u041D\u043E\u044F\u0431\u0440\u044C","\u0414\u0435\u043A\u0430\u0431\u0440\u044C"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" \u2014 ",weekAbbreviation:"\u041D\u0435\u0434.",scrollTitle:"\u041F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u0435 \u0434\u043B\u044F \u0443\u0432\u0435\u043B\u0438\u0447\u0435\u043D\u0438\u044F",toggleTitle:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0434\u043B\u044F \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F",amPM:["\u0414\u041F","\u041F\u041F"],yearAriaLabel:"\u0413\u043E\u0434",time_24hr:!0};BE.l10ns.ru=$p;var RY=BE.l10ns;var VE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Up={weekdays:{shorthand:["\u0D89","\u0DC3","\u0D85","\u0DB6","\u0DB6\u0DCA\u200D\u0DBB","\u0DC3\u0DD2","\u0DC3\u0DD9"],longhand:["\u0D89\u0DBB\u0DD2\u0DAF\u0DCF","\u0DC3\u0DB3\u0DD4\u0DAF\u0DCF","\u0D85\u0D9F\u0DC4\u0DBB\u0DD4\u0DC0\u0DCF\u0DAF\u0DCF","\u0DB6\u0DAF\u0DCF\u0DAF\u0DCF","\u0DB6\u0DCA\u200D\u0DBB\u0DC4\u0DC3\u0DCA\u0DB4\u0DAD\u0DD2\u0DB1\u0DCA\u0DAF\u0DCF","\u0DC3\u0DD2\u0D9A\u0DD4\u0DBB\u0DCF\u0DAF\u0DCF","\u0DC3\u0DD9\u0DB1\u0DC3\u0DD4\u0DBB\u0DCF\u0DAF\u0DCF"]},months:{shorthand:["\u0DA2\u0DB1","\u0DB4\u0DD9\u0DB6","\u0DB8\u0DCF\u0DBB\u0DCA","\u0D85\u0DB4\u0DCA\u200D\u0DBB\u0DDA","\u0DB8\u0DD0\u0DBA\u0DD2","\u0DA2\u0DD4\u0DB1\u0DD2","\u0DA2\u0DD6\u0DBD\u0DD2","\u0D85\u0D9C\u0DDD","\u0DC3\u0DD0\u0DB4\u0DCA","\u0D94\u0D9A\u0DCA","\u0DB1\u0DDC\u0DC0\u0DD0","\u0DAF\u0DD9\u0DC3\u0DD0"],longhand:["\u0DA2\u0DB1\u0DC0\u0DCF\u0DBB\u0DD2","\u0DB4\u0DD9\u0DB6\u0DBB\u0DC0\u0DCF\u0DBB\u0DD2","\u0DB8\u0DCF\u0DBB\u0DCA\u0DAD\u0DD4","\u0D85\u0DB4\u0DCA\u200D\u0DBB\u0DDA\u0DBD\u0DCA","\u0DB8\u0DD0\u0DBA\u0DD2","\u0DA2\u0DD4\u0DB1\u0DD2","\u0DA2\u0DD6\u0DBD\u0DD2","\u0D85\u0D9C\u0DDD\u0DC3\u0DCA\u0DAD\u0DD4","\u0DC3\u0DD0\u0DB4\u0DCA\u0DAD\u0DD0\u0DB8\u0DCA\u0DB6\u0DBB\u0DCA","\u0D94\u0D9A\u0DCA\u0DAD\u0DDD\u0DB6\u0DBB\u0DCA","\u0DB1\u0DDC\u0DC0\u0DD0\u0DB8\u0DCA\u0DB6\u0DBB\u0DCA","\u0DAF\u0DD9\u0DC3\u0DD0\u0DB8\u0DCA\u0DB6\u0DBB\u0DCA"]},time_24hr:!0};VE.l10ns.si=Up;var BY=VE.l10ns;var $E=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Wp={weekdays:{shorthand:["Ned","Pon","Ut","Str","\u0160tv","Pia","Sob"],longhand:["Nede\u013Ea","Pondelok","Utorok","Streda","\u0160tvrtok","Piatok","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","M\xE1j","J\xFAn","J\xFAl","Aug","Sep","Okt","Nov","Dec"],longhand:["Janu\xE1r","Febru\xE1r","Marec","Apr\xEDl","M\xE1j","J\xFAn","J\xFAl","August","September","Okt\xF3ber","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};$E.l10ns.sk=Wp;var $Y=$E.l10ns;var UE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Yp={weekdays:{shorthand:["Ned","Pon","Tor","Sre","\u010Cet","Pet","Sob"],longhand:["Nedelja","Ponedeljek","Torek","Sreda","\u010Cetrtek","Petek","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};UE.l10ns.sl=Yp;var WY=UE.l10ns;var WE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},zp={weekdays:{shorthand:["Di","H\xEB","Ma","M\xEB","En","Pr","Sh"],longhand:["E Diel","E H\xEBn\xEB","E Mart\xEB","E M\xEBrkur\xEB","E Enjte","E Premte","E Shtun\xEB"]},months:{shorthand:["Jan","Shk","Mar","Pri","Maj","Qer","Kor","Gus","Sht","Tet","N\xEBn","Dhj"],longhand:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","N\xEBntor","Dhjetor"]},firstDayOfWeek:1,rangeSeparator:" deri ",weekAbbreviation:"Java",yearAriaLabel:"Viti",monthAriaLabel:"Muaji",hourAriaLabel:"Ora",minuteAriaLabel:"Minuta",time_24hr:!0};WE.l10ns.sq=zp;var zY=WE.l10ns;var YE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Kp={weekdays:{shorthand:["Ned","Pon","Uto","Sre","\u010Cet","Pet","Sub"],longhand:["Nedelja","Ponedeljak","Utorak","Sreda","\u010Cetvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"]},firstDayOfWeek:1,weekAbbreviation:"Ned.",rangeSeparator:" do ",time_24hr:!0};YE.l10ns.sr=Kp;var jY=YE.l10ns;var zE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},jp={firstDayOfWeek:1,weekAbbreviation:"v",weekdays:{shorthand:["s\xF6n","m\xE5n","tis","ons","tor","fre","l\xF6r"],longhand:["s\xF6ndag","m\xE5ndag","tisdag","onsdag","torsdag","fredag","l\xF6rdag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},rangeSeparator:" till ",time_24hr:!0,ordinal:()=>"."};zE.l10ns.sv=jp;var GY=zE.l10ns;var KE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},qp={weekdays:{shorthand:["\u0E2D\u0E32","\u0E08","\u0E2D","\u0E1E","\u0E1E\u0E24","\u0E28","\u0E2A"],longhand:["\u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C","\u0E08\u0E31\u0E19\u0E17\u0E23\u0E4C","\u0E2D\u0E31\u0E07\u0E04\u0E32\u0E23","\u0E1E\u0E38\u0E18","\u0E1E\u0E24\u0E2B\u0E31\u0E2A\u0E1A\u0E14\u0E35","\u0E28\u0E38\u0E01\u0E23\u0E4C","\u0E40\u0E2A\u0E32\u0E23\u0E4C"]},months:{shorthand:["\u0E21.\u0E04.","\u0E01.\u0E1E.","\u0E21\u0E35.\u0E04.","\u0E40\u0E21.\u0E22.","\u0E1E.\u0E04.","\u0E21\u0E34.\u0E22.","\u0E01.\u0E04.","\u0E2A.\u0E04.","\u0E01.\u0E22.","\u0E15.\u0E04.","\u0E1E.\u0E22.","\u0E18.\u0E04."],longhand:["\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21","\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C","\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21","\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19","\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21","\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19","\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21","\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21","\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19","\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21","\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19","\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"]},firstDayOfWeek:1,rangeSeparator:" \u0E16\u0E36\u0E07 ",scrollTitle:"\u0E40\u0E25\u0E37\u0E48\u0E2D\u0E19\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E2B\u0E23\u0E37\u0E2D\u0E25\u0E14",toggleTitle:"\u0E04\u0E25\u0E34\u0E01\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19",time_24hr:!0,ordinal:()=>""};KE.l10ns.th=qp;var ZY=KE.l10ns;var jE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Gp={weekdays:{shorthand:["Paz","Pzt","Sal","\xC7ar","Per","Cum","Cmt"],longhand:["Pazar","Pazartesi","Sal\u0131","\xC7ar\u015Famba","Per\u015Fembe","Cuma","Cumartesi"]},months:{shorthand:["Oca","\u015Eub","Mar","Nis","May","Haz","Tem","A\u011Fu","Eyl","Eki","Kas","Ara"],longhand:["Ocak","\u015Eubat","Mart","Nisan","May\u0131s","Haziran","Temmuz","A\u011Fustos","Eyl\xFCl","Ekim","Kas\u0131m","Aral\u0131k"]},firstDayOfWeek:1,ordinal:()=>".",rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Art\u0131rmak i\xE7in kayd\u0131r\u0131n",toggleTitle:"A\xE7/Kapa",amPM:["\xD6\xD6","\xD6S"],time_24hr:!0};jE.l10ns.tr=Gp;var XY=jE.l10ns;var qE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Jp={firstDayOfWeek:1,weekdays:{shorthand:["\u041D\u0434","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],longhand:["\u041D\u0435\u0434\u0456\u043B\u044F","\u041F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A","\u0412\u0456\u0432\u0442\u043E\u0440\u043E\u043A","\u0421\u0435\u0440\u0435\u0434\u0430","\u0427\u0435\u0442\u0432\u0435\u0440","\u041F'\u044F\u0442\u043D\u0438\u0446\u044F","\u0421\u0443\u0431\u043E\u0442\u0430"]},months:{shorthand:["\u0421\u0456\u0447","\u041B\u044E\u0442","\u0411\u0435\u0440","\u041A\u0432\u0456","\u0422\u0440\u0430","\u0427\u0435\u0440","\u041B\u0438\u043F","\u0421\u0435\u0440","\u0412\u0435\u0440","\u0416\u043E\u0432","\u041B\u0438\u0441","\u0413\u0440\u0443"],longhand:["\u0421\u0456\u0447\u0435\u043D\u044C","\u041B\u044E\u0442\u0438\u0439","\u0411\u0435\u0440\u0435\u0437\u0435\u043D\u044C","\u041A\u0432\u0456\u0442\u0435\u043D\u044C","\u0422\u0440\u0430\u0432\u0435\u043D\u044C","\u0427\u0435\u0440\u0432\u0435\u043D\u044C","\u041B\u0438\u043F\u0435\u043D\u044C","\u0421\u0435\u0440\u043F\u0435\u043D\u044C","\u0412\u0435\u0440\u0435\u0441\u0435\u043D\u044C","\u0416\u043E\u0432\u0442\u0435\u043D\u044C","\u041B\u0438\u0441\u0442\u043E\u043F\u0430\u0434","\u0413\u0440\u0443\u0434\u0435\u043D\u044C"]},time_24hr:!0};qE.l10ns.uk=Jp;var tz=qE.l10ns;var GE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Zp={weekdays:{shorthand:["\u042F\u043A\u0448","\u0414\u0443\u0448","\u0421\u0435\u0448","\u0427\u043E\u0440","\u041F\u0430\u0439","\u0416\u0443\u043C","\u0428\u0430\u043D"],longhand:["\u042F\u043A\u0448\u0430\u043D\u0431\u0430","\u0414\u0443\u0448\u0430\u043D\u0431\u0430","\u0421\u0435\u0448\u0430\u043D\u0431\u0430","\u0427\u043E\u0440\u0448\u0430\u043D\u0431\u0430","\u041F\u0430\u0439\u0448\u0430\u043D\u0431\u0430","\u0416\u0443\u043C\u0430","\u0428\u0430\u043D\u0431\u0430"]},months:{shorthand:["\u042F\u043D\u0432","\u0424\u0435\u0432","\u041C\u0430\u0440","\u0410\u043F\u0440","\u041C\u0430\u0439","\u0418\u044E\u043D","\u0418\u044E\u043B","\u0410\u0432\u0433","\u0421\u0435\u043D","\u041E\u043A\u0442","\u041D\u043E\u044F","\u0414\u0435\u043A"],longhand:["\u042F\u043D\u0432\u0430\u0440","\u0424\u0435\u0432\u0440\u0430\u043B","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440\u0435\u043B","\u041C\u0430\u0439","\u0418\u044E\u043D","\u0418\u044E\u043B","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043D\u0442\u044F\u0431\u0440","\u041E\u043A\u0442\u044F\u0431\u0440","\u041D\u043E\u044F\u0431\u0440","\u0414\u0435\u043A\u0430\u0431\u0440"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" \u2014 ",weekAbbreviation:"\u04B2\u0430\u0444\u0442\u0430",scrollTitle:"\u041A\u0430\u0442\u0442\u0430\u043B\u0430\u0448\u0442\u0438\u0440\u0438\u0448 \u0443\u0447\u0443\u043D \u0430\u0439\u043B\u0430\u043D\u0442\u0438\u0440\u0438\u043D\u0433",toggleTitle:"\u040E\u0442\u0438\u0448 \u0443\u0447\u0443\u043D \u0431\u043E\u0441\u0438\u043D\u0433",amPM:["AM","PM"],yearAriaLabel:"\u0419\u0438\u043B",time_24hr:!0};GE.l10ns.uz=Zp;var rz=GE.l10ns;var JE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Qp={weekdays:{shorthand:["Ya","Du","Se","Cho","Pa","Ju","Sha"],longhand:["Yakshanba","Dushanba","Seshanba","Chorshanba","Payshanba","Juma","Shanba"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","Iyun","Iyul","Avg","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","Iyun","Iyul","Avgust","Sentabr","Oktabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" \u2014 ",weekAbbreviation:"Hafta",scrollTitle:"Kattalashtirish uchun aylantiring",toggleTitle:"O\u2018tish uchun bosing",amPM:["AM","PM"],yearAriaLabel:"Yil",time_24hr:!0};JE.l10ns.uz_latn=Qp;var az=JE.l10ns;var ZE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Xp={weekdays:{shorthand:["CN","T2","T3","T4","T5","T6","T7"],longhand:["Ch\u1EE7 nh\u1EADt","Th\u1EE9 hai","Th\u1EE9 ba","Th\u1EE9 t\u01B0","Th\u1EE9 n\u0103m","Th\u1EE9 s\xE1u","Th\u1EE9 b\u1EA3y"]},months:{shorthand:["Th1","Th2","Th3","Th4","Th5","Th6","Th7","Th8","Th9","Th10","Th11","Th12"],longhand:["Th\xE1ng m\u1ED9t","Th\xE1ng hai","Th\xE1ng ba","Th\xE1ng t\u01B0","Th\xE1ng n\u0103m","Th\xE1ng s\xE1u","Th\xE1ng b\u1EA3y","Th\xE1ng t\xE1m","Th\xE1ng ch\xEDn","Th\xE1ng m\u01B0\u1EDDi","Th\xE1ng m\u01B0\u1EDDi m\u1ED9t","Th\xE1ng m\u01B0\u1EDDi hai"]},firstDayOfWeek:1,rangeSeparator:" \u0111\u1EBFn "};ZE.l10ns.vn=Xp;var sz=ZE.l10ns;var QE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},eg={weekdays:{shorthand:["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"],longhand:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"]},months:{shorthand:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],longhand:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"]},rangeSeparator:" \u81F3 ",weekAbbreviation:"\u5468",scrollTitle:"\u6EDA\u52A8\u5207\u6362",toggleTitle:"\u70B9\u51FB\u5207\u6362 12/24 \u5C0F\u65F6\u65F6\u5236"};QE.l10ns.zh=eg;var uz=QE.l10ns;var XE=typeof window!="undefined"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},tg={weekdays:{shorthand:["\u9031\u65E5","\u9031\u4E00","\u9031\u4E8C","\u9031\u4E09","\u9031\u56DB","\u9031\u4E94","\u9031\u516D"],longhand:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"]},months:{shorthand:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],longhand:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"]},rangeSeparator:" \u81F3 ",weekAbbreviation:"\u9031",scrollTitle:"\u6EFE\u52D5\u5207\u63DB",toggleTitle:"\u9EDE\u64CA\u5207\u63DB 12/24 \u5C0F\u6642\u6642\u5236"};XE.l10ns.zh_tw=tg;var dz=XE.l10ns;var nN={ar:Gm,at:Jm,az:Zm,be:Qm,bg:Xm,bn:ep,bs:tp,ca:Wc,ckb:rp,cat:Wc,cs:ip,cy:ap,da:op,de:sp,default:{...so},en:so,eo:lp,es:up,et:cp,fa:dp,fi:fp,fo:hp,fr:mp,gr:pp,he:gp,hi:yp,hr:vp,hu:wp,hy:bp,id:Dp,is:Sp,it:Ep,ja:kp,ka:xp,ko:_p,km:Cp,kz:Mp,lt:Tp,lv:Fp,mk:Ip,mn:Ap,ms:FE,my:Op,nl:Lp,nn:Pp,no:Np,pa:Rp,pl:Hp,pt:Bp,ro:Vp,ru:$p,si:Up,sk:Wp,sl:Yp,sq:zp,sr:Kp,sv:jp,th:qp,tr:Gp,uk:Jp,vn:Xp,zh:eg,zh_tw:tg,uz:Zp,uz_latn:Qp},nn=nN;var tk={ar:nn.ar,cs:nn.cs,da:nn.da,de:nn.de,en:nn.en,"en-gb":nn.en,es:nn.es,fr:nn.fr,hi:nn.hi,id:nn.id,it:nn.it,ja:nn.ja,ko:nn.ko,nl:nn.nl,nn:nn.no,pl:nn.pl,pt:nn.pt,"pt-br":nn.pt,ro:nn.ro,ru:nn.ru,tr:nn.tr,"zh-cn":nn.zh,"zh-tw":nn.zh_tw},rN=tk[ek.moment.locale()];function zc(e){let t=e==null?void 0:e.getSetting("date-picker-week-start"),r=rN||tk.en;return t?{...r,firstDayOfWeek:t}:r}var Kc=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],ka={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:e=>typeof console!="undefined"&&console.warn(e),getWeek:e=>{let t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);let r=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-r.getTime())/864e5-3+(r.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1,win:window};var er=(e,t=2)=>`000${e}`.slice(t*-1),wr=e=>e===!0?1:0;function ng(e,t,r){let n;return function(){let i=arguments;r.clearTimeout(n),n=r.setTimeout(()=>e.apply(this,i),t)}}var jc=e=>Array.isArray(e)?e:[e];var rg=()=>{},Pl=(e,t,r)=>r.months[t?"shorthand":"longhand"][e],nk={D:rg,F:function(e,t,r){e.setMonth(r.months.longhand.indexOf(t))},G:(e,t)=>{e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},H:(e,t)=>{e.setHours(parseFloat(t))},J:(e,t)=>{e.setDate(parseFloat(t))},K:(e,t,r)=>{e.setHours(e.getHours()%12+12*wr(new RegExp(r.amPM[1],"i").test(t)))},M:function(e,t,r){e.setMonth(r.months.shorthand.indexOf(t))},S:(e,t)=>{e.setSeconds(parseFloat(t))},U:(e,t)=>new Date(parseFloat(t)*1e3),W:function(e,t,r){let n=parseInt(t),i=new Date(e.getFullYear(),0,2+(n-1)*7,0,0,0,0);return i.setDate(i.getDate()-i.getDay()+r.firstDayOfWeek),i},Y:(e,t)=>{e.setFullYear(parseFloat(t))},Z:(e,t)=>new Date(t),d:(e,t)=>{e.setDate(parseFloat(t))},h:(e,t)=>{e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},i:(e,t)=>{e.setMinutes(parseFloat(t))},j:(e,t)=>{e.setDate(parseFloat(t))},l:rg,m:(e,t)=>{e.setMonth(parseFloat(t)-1)},n:(e,t)=>{e.setMonth(parseFloat(t)-1)},s:(e,t)=>{e.setSeconds(parseFloat(t))},u:(e,t)=>new Date(parseFloat(t)),w:rg,y:(e,t)=>{e.setFullYear(2e3+parseFloat(t))}},Gi={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},ds={Z:e=>e.toISOString(),D:function(e,t,r){return t.weekdays.shorthand[ds.w(e,t,r)]},F:function(e,t,r){return Pl(ds.n(e,t,r)-1,!1,t)},G:function(e,t,r){return er(ds.h(e,t,r))},H:e=>er(e.getHours()),J:function(e,t){return t.ordinal!==void 0?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:(e,t)=>t.amPM[wr(e.getHours()>11)],M:function(e,t){return Pl(e.getMonth(),!0,t)},S:e=>er(e.getSeconds()),U:e=>e.getTime()/1e3,W:function(e,t,r){return r.getWeek(e)},Y:e=>er(e.getFullYear(),4),d:e=>er(e.getDate()),h:e=>e.getHours()%12?e.getHours()%12:12,i:e=>er(e.getMinutes()),j:e=>e.getDate(),l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:e=>er(e.getMonth()+1),n:e=>e.getMonth()+1,s:e=>e.getSeconds(),u:e=>e.getTime(),w:e=>e.getDay(),y:e=>String(e.getFullYear()).substring(2)};var ig=({config:e=ka,l10n:t=so,isMobile:r=!1})=>(n,i,a)=>{let o=a||t;return e.formatDate!==void 0&&!r?e.formatDate(n,i,o):i.split("").map((s,u,l)=>ds[s]&&l[u-1]!=="\\"?ds[s](n,o,e):s!=="\\"?s:"").join("")},qc=({config:e=ka,l10n:t=so})=>(r,n,i,a)=>{if(r!==0&&!r)return;let o=a||t,s,u=r;if(r.getDate)s=new Date(r.getTime());else if(typeof r!="string"&&r.toFixed!==void 0)s=new Date(r);else if(typeof r=="string"){let l=n||(e||ka).dateFormat,c=String(r).trim();if(c==="today")s=new Date,i=!0;else if(e&&e.parseDate)s=e.parseDate(r,l);else if(/Z$/.test(c)||/GMT$/.test(c))s=new Date(r);else{let d,m=[];for(let h=0,g=0,y="";hs=h(s,g,o)||s),s=d?s:void 0}}if(!(s.getDate&&!isNaN(s.getTime()))){e.errorHandler(new Error(`Invalid date provided: ${u}`));return}return i===!0&&s.setHours(0,0,0,0),s};function br(e,t,r=!0){return r!==!1?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}var rk=(e,t,r)=>e>Math.min(t,r)&&ee*3600+t*60+r,ik=e=>{let t=Math.floor(e/3600),r=(e-t*3600)/60;return[t,r,e-t*3600-r*60]},ak={DAY:864e5};function Jc(e){let t=e.defaultHour,r=e.defaultMinute,n=e.defaultSeconds;if(e.minDate!==void 0){let i=e.minDate.getHours(),a=e.minDate.getMinutes(),o=e.minDate.getSeconds();t=0?new Date:new Date(n.config.minDate.getTime()),ie=Jc(n.config);q.setHours(ie.hours,ie.minutes,ie.seconds,q.getMilliseconds()),n.selectedDates=[q],n.latestSelectedDateObj=q}M!==void 0&&M.type!=="blur"&&ge(M);let H=n._input.value;m(),de(),n._input.value!==H&&n._debouncedChange()}function c(M,H){return M%12+12*wr(H===n.l10n.amPM[1])}function d(M){switch(M%24){case 0:case 12:return 12;default:return M%12}}function m(){if(n.hourElement===void 0||n.minuteElement===void 0)return;let M=(parseInt(n.hourElement.value.slice(-2),10)||0)%24,H=(parseInt(n.minuteElement.value,10)||0)%60,q=n.secondElement!==void 0?(parseInt(n.secondElement.value,10)||0)%60:0;n.amPM!==void 0&&(M=c(M,n.amPM.textContent));let ie=n.config.minTime!==void 0||n.config.minDate&&n.minDateHasTime&&n.latestSelectedDateObj&&br(n.latestSelectedDateObj,n.config.minDate,!0)===0,ye=n.config.maxTime!==void 0||n.config.maxDate&&n.maxDateHasTime&&n.latestSelectedDateObj&&br(n.latestSelectedDateObj,n.config.maxDate,!0)===0;if(n.config.maxTime!==void 0&&n.config.minTime!==void 0&&n.config.minTime>n.config.maxTime){let ce=Gc(n.config.minTime.getHours(),n.config.minTime.getMinutes(),n.config.minTime.getSeconds()),ae=Gc(n.config.maxTime.getHours(),n.config.maxTime.getMinutes(),n.config.maxTime.getSeconds()),Se=Gc(M,H,q);if(Se>ae&&Se=12)]),n.secondElement!==void 0&&(n.secondElement.value=er(q)))}function y(M){let H=Dr(M),q=parseInt(H.value)+(M.delta||0);(q/1e3>1||M.key==="Enter"&&!/[^\d]/.test(q.toString()))&&vt(q)}function v(M,H,q,ie){if(Array.isArray(H))return H.forEach(ye=>v(M,ye,q,ie));if(Array.isArray(M))return M.forEach(ye=>v(ye,H,q,ie));M.addEventListener(H,q,ie),n._handlers.push({remove:()=>M.removeEventListener(H,q,ie)})}function D(){ht("onChange")}function I(){if(n.config.wrap&&["open","close","toggle","clear"].forEach(H=>{Array.prototype.forEach.call(n.element.querySelectorAll(`[data-${H}]`),q=>v(q,"click",n[H]))}),n.isMobile){Ht();return}let M=ng(yn,50,r);if(n._debouncedChange=ng(D,iN,r),n.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&v(n.daysContainer,"mouseover",H=>{n.config.mode==="range"&&gn(Dr(H))}),v(n._input,"keydown",en),n.calendarContainer!==void 0&&v(n.calendarContainer,"keydown",en),!n.config.inline&&!n.config.static&&v(r,"resize",M),r.ontouchstart!==void 0?v(r.document,"touchstart",jt):v(r.document,"mousedown",jt),v(r.document,"focus",jt,{capture:!0}),n.config.clickOpens===!0&&(v(n._input,"focus",n.open),v(n._input,"click",n.open)),n.daysContainer!==void 0&&(v(n.monthNav,"click",ve),v(n.monthNav,["keyup","increment"],y),v(n.daysContainer,"click",rn)),n.timeContainer!==void 0&&n.minuteElement!==void 0&&n.hourElement!==void 0){let H=q=>Dr(q).select();v(n.timeContainer,["increment"],l),v(n.timeContainer,"blur",l,{capture:!0}),v(n.timeContainer,"click",x),v([n.hourElement,n.minuteElement],["focus","click"],H),n.secondElement!==void 0&&v(n.secondElement,"focus",()=>n.secondElement&&n.secondElement.select()),n.amPM!==void 0&&v(n.amPM,"click",q=>{l(q)})}n.config.allowInput&&v(n._input,"blur",Jt)}function C(M,H){let q=M!==void 0?n.parseDate(M):n.latestSelectedDateObj||(n.config.minDate&&n.config.minDate>n.now?n.config.minDate:n.config.maxDate&&n.config.maxDate1),n.calendarContainer.appendChild(M);let H=n.config.appendTo!==void 0&&n.config.appendTo.nodeType!==void 0;if((n.config.inline||n.config.static)&&(n.calendarContainer.classList.add(n.config.inline?"inline":"static"),n.config.inline&&(!H&&n.element.parentNode?n.element.parentNode.insertBefore(n.calendarContainer,n._input.nextSibling):n.config.appendTo!==void 0&&n.config.appendTo.appendChild(n.calendarContainer)),n.config.static)){let q=Pt(r.document,"div","flatpickr-wrapper");n.element.parentNode&&n.element.parentNode.insertBefore(q,n.element),q.appendChild(n.element),n.altInput&&q.appendChild(n.altInput),q.appendChild(n.calendarContainer)}!n.config.static&&!n.config.inline&&(n.config.appendTo!==void 0?n.config.appendTo:r.document.body).appendChild(n.calendarContainer)}function P(M,H,q,ie){let ye=Wt(H,!0),ce=Pt(r.document,"span",M,H.getDate().toString());return ce.dateObj=H,ce.$i=ie,ce.setAttribute("aria-label",n.formatDate(H,n.config.ariaDateFormat)),M.indexOf("hidden")===-1&&br(H,n.now)===0&&(n.todayDateElem=ce,ce.classList.add("today"),ce.setAttribute("aria-current","date")),ye?(ce.tabIndex=-1,L(H)&&(ce.classList.add("selected"),n.selectedDateElem=ce,n.config.mode==="range"&&(tr(ce,"startRange",n.selectedDates[0]&&br(H,n.selectedDates[0],!0)===0),tr(ce,"endRange",n.selectedDates[1]&&br(H,n.selectedDates[1],!0)===0),M==="nextMonthDay"&&ce.classList.add("inRange")))):ce.classList.add("flatpickr-disabled"),n.config.mode==="range"&&K(H)&&!L(H)&&ce.classList.add("inRange"),n.weekNumbers&&n.config.showMonths===1&&M!=="prevMonthDay"&&ie%7===6&&n.weekNumbers.insertAdjacentHTML("beforeend",""+n.config.getWeek(H)+""),ht("onDayCreate",ce),ce}function B(M){M.focus(),n.config.mode==="range"&&gn(M)}function G(M){let H=M>0?0:n.config.showMonths-1,q=M>0?n.config.showMonths:-1;for(let ie=H;ie!=q;ie+=M){let ye=n.daysContainer.children[ie],ce=M>0?0:ye.children.length-1,ae=M>0?ye.children.length:-1;for(let Se=ce;Se!=ae;Se+=M){let nt=ye.children[Se];if(nt.className.indexOf("hidden")===-1&&Wt(nt.dateObj))return nt}}}function J(M,H){let q=M.className.indexOf("Month")===-1?M.dateObj.getMonth():n.currentMonth,ie=H>0?n.config.showMonths:-1,ye=H>0?1:-1;for(let ce=q-n.currentMonth;ce!=ie;ce+=ye){let ae=n.daysContainer.children[ce],Se=q-n.currentMonth===ce?M.$i+H:H<0?ae.children.length-1:0,nt=ae.children.length;for(let Te=Se;Te>=0&&Te0?nt:-1);Te+=ye){let Ue=ae.children[Te];if(Ue.className.indexOf("hidden")===-1&&Wt(Ue.dateObj)&&Math.abs(M.$i-Te)>=Math.abs(H))return B(Ue)}}n.changeMonth(ye),Q(G(ye),0)}function Q(M,H){let q=o(),ie=Tt(q||n.element.doc.body),ye=M!==void 0?M:ie?q:n.selectedDateElem!==void 0&&Tt(n.selectedDateElem)?n.selectedDateElem:n.todayDateElem!==void 0&&Tt(n.todayDateElem)?n.todayDateElem:G(H>0?1:-1);ye===void 0?n._input.focus():ie?J(ye,H):B(ye)}function oe(M,H){let q=(new Date(M,H,1).getDay()-n.l10n.firstDayOfWeek+7)%7,ie=n.utils.getDaysInMonth((H-1+12)%12,M),ye=n.utils.getDaysInMonth(H,M),ce=r.document.createDocumentFragment(),ae=n.config.showMonths>1,Se=ae?"prevMonthDay hidden":"prevMonthDay",nt=ae?"nextMonthDay hidden":"nextMonthDay",Te=ie+1-q,Ue=0;for(;Te<=ie;Te++,Ue++)ce.appendChild(P(`flatpickr-day ${Se}`,new Date(M,H-1,Te),Te,Ue));for(Te=1;Te<=ye;Te++,Ue++)ce.appendChild(P("flatpickr-day",new Date(M,H,Te),Te,Ue));for(let Ft=ye+1;Ft<=42-q&&(n.config.showMonths===1||Ue%7!==0);Ft++,Ue++)ce.appendChild(P(`flatpickr-day ${nt}`,new Date(M,H+1,Ft%ye),Ft,Ue));let We=Pt(r.document,"div","dayContainer");return We.appendChild(ce),We}function te(){if(n.daysContainer===void 0)return;Nl(n.daysContainer),n.weekNumbers&&Nl(n.weekNumbers);let M=n.element.doc.createDocumentFragment();for(let H=0;H1||n.config.monthSelectorType!=="dropdown")return;let M=function(H){return n.config.minDate!==void 0&&n.currentYear===n.config.minDate.getFullYear()&&Hn.config.maxDate.getMonth())};n.monthsDropdownContainer.tabIndex=-1,n.monthsDropdownContainer.innerHTML="";for(let H=0;H<12;H++){if(!M(H))continue;let q=Pt(r.document,"option","flatpickr-monthDropdown-month");q.value=new Date(n.currentYear,H).getMonth().toString(),q.textContent=Pl(H,n.config.shorthandCurrentMonth,n.l10n),q.tabIndex=-1,n.currentMonth===H&&(q.selected=!0),n.monthsDropdownContainer.appendChild(q)}}function ne(){let M=Pt(r.document,"div","flatpickr-month"),H=r.document.createDocumentFragment(),q;n.config.showMonths>1||n.config.monthSelectorType==="static"?q=Pt(r.document,"span","cur-month"):(n.monthsDropdownContainer=Pt(r.document,"select","flatpickr-monthDropdown-months"),n.monthsDropdownContainer.setAttribute("aria-label",n.l10n.monthAriaLabel),v(n.monthsDropdownContainer,"change",ae=>{let Se=Dr(ae),nt=parseInt(Se.value,10);n.changeMonth(nt-n.currentMonth),ht("onMonthChange")}),re(),q=n.monthsDropdownContainer);let ie=Rl(r.document,"cur-year",{tabindex:"-1"}),ye=ie.getElementsByTagName("input")[0];ye.setAttribute("aria-label",n.l10n.yearAriaLabel),n.config.minDate&&ye.setAttribute("min",n.config.minDate.getFullYear().toString()),n.config.maxDate&&(ye.setAttribute("max",n.config.maxDate.getFullYear().toString()),ye.disabled=!!n.config.minDate&&n.config.minDate.getFullYear()===n.config.maxDate.getFullYear());let ce=Pt(r.document,"div","flatpickr-current-month");return ce.appendChild(q),ce.appendChild(ie),H.appendChild(ce),M.appendChild(H),{container:M,yearElement:ye,monthElement:q}}function be(){Nl(n.monthNav),n.monthNav.appendChild(n.prevMonthNav),n.config.showMonths&&(n.yearElements=[],n.monthElements=[]);for(let M=n.config.showMonths;M--;){let H=ne();n.yearElements.push(H.yearElement),n.monthElements.push(H.monthElement),n.monthNav.appendChild(H.container)}n.monthNav.appendChild(n.nextMonthNav)}function pe(){return n.monthNav=Pt(r.document,"div","flatpickr-months"),n.yearElements=[],n.monthElements=[],n.prevMonthNav=Pt(r.document,"span","flatpickr-prev-month"),n.prevMonthNav.innerHTML=n.config.prevArrow,n.nextMonthNav=Pt(r.document,"span","flatpickr-next-month"),n.nextMonthNav.innerHTML=n.config.nextArrow,be(),Object.defineProperty(n,"_hidePrevMonthArrow",{get:()=>n.__hidePrevMonthArrow,set(M){n.__hidePrevMonthArrow!==M&&(tr(n.prevMonthNav,"flatpickr-disabled",M),n.__hidePrevMonthArrow=M)}}),Object.defineProperty(n,"_hideNextMonthArrow",{get:()=>n.__hideNextMonthArrow,set(M){n.__hideNextMonthArrow!==M&&(tr(n.nextMonthNav,"flatpickr-disabled",M),n.__hideNextMonthArrow=M)}}),n.currentYearElement=n.yearElements[0],ee(),n.monthNav}function De(){n.calendarContainer.classList.add("hasTime"),n.config.noCalendar&&n.calendarContainer.classList.add("noCalendar");let M=Jc(n.config);n.timeContainer=Pt(r.document,"div","flatpickr-time"),n.timeContainer.tabIndex=-1;let H=Pt(r.document,"span","flatpickr-time-separator",":"),q=Rl(r.document,"flatpickr-hour",{"aria-label":n.l10n.hourAriaLabel});n.hourElement=q.getElementsByTagName("input")[0];let ie=Rl(r.document,"flatpickr-minute",{"aria-label":n.l10n.minuteAriaLabel});if(n.minuteElement=ie.getElementsByTagName("input")[0],n.hourElement.tabIndex=n.minuteElement.tabIndex=-1,n.hourElement.value=er(n.latestSelectedDateObj?n.latestSelectedDateObj.getHours():n.config.time_24hr?M.hours:d(M.hours)),n.minuteElement.value=er(n.latestSelectedDateObj?n.latestSelectedDateObj.getMinutes():M.minutes),n.hourElement.setAttribute("step",n.config.hourIncrement.toString()),n.minuteElement.setAttribute("step",n.config.minuteIncrement.toString()),n.hourElement.setAttribute("min",n.config.time_24hr?"0":"1"),n.hourElement.setAttribute("max",n.config.time_24hr?"23":"12"),n.hourElement.setAttribute("maxlength","2"),n.minuteElement.setAttribute("min","0"),n.minuteElement.setAttribute("max","59"),n.minuteElement.setAttribute("maxlength","2"),n.timeContainer.appendChild(q),n.timeContainer.appendChild(H),n.timeContainer.appendChild(ie),n.config.time_24hr&&n.timeContainer.classList.add("time24hr"),n.config.enableSeconds){n.timeContainer.classList.add("hasSeconds");let ye=Rl(r.document,"flatpickr-second");n.secondElement=ye.getElementsByTagName("input")[0],n.secondElement.value=er(n.latestSelectedDateObj?n.latestSelectedDateObj.getSeconds():M.seconds),n.secondElement.setAttribute("step",n.minuteElement.getAttribute("step")),n.secondElement.setAttribute("min","0"),n.secondElement.setAttribute("max","59"),n.secondElement.setAttribute("maxlength","2"),n.timeContainer.appendChild(Pt(r.document,"span","flatpickr-time-separator",":")),n.timeContainer.appendChild(ye)}return n.config.time_24hr||(n.amPM=Pt(r.document,"span","flatpickr-am-pm",n.l10n.amPM[wr((n.latestSelectedDateObj?parseInt(n.hourElement.value):n.config.defaultHour)>11)]),n.amPM.title=n.l10n.toggleTitle,n.amPM.tabIndex=-1,n.timeContainer.appendChild(n.amPM)),n.timeContainer}function Ce(){n.weekdayContainer?Nl(n.weekdayContainer):n.weekdayContainer=Pt(r.document,"div","flatpickr-weekdays");for(let M=n.config.showMonths;M--;){let H=Pt(r.document,"div","flatpickr-weekdaycontainer");n.weekdayContainer.appendChild(H)}return U(),n.weekdayContainer}function U(){if(!n.weekdayContainer)return;let M=n.l10n.firstDayOfWeek,H=[...n.l10n.weekdays.shorthand];M>0&&M
+ ${H.join("")}
+
+ `}function Je(){n.calendarContainer.classList.add("hasWeeks");let M=Pt(r.document,"div","flatpickr-weekwrapper");M.appendChild(Pt(r.document,"span","flatpickr-weekday",n.l10n.weekAbbreviation));let H=Pt(r.document,"div","flatpickr-weeks");return M.appendChild(H),{weekWrapper:M,weekNumbers:H}}function it(M,H=!0){let q=H?M:M-n.currentMonth;q<0&&n._hidePrevMonthArrow===!0||q>0&&n._hideNextMonthArrow===!0||(n.currentMonth+=q,(n.currentMonth<0||n.currentMonth>11)&&(n.currentYear+=n.currentMonth>11?1:-1,n.currentMonth=(n.currentMonth+12)%12,ht("onYearChange"),re()),te(),ht("onMonthChange"),ee())}function N(M=!0,H=!0){if(n.input.value="",n.altInput!==void 0&&(n.altInput.value=""),n.mobileInput!==void 0&&(n.mobileInput.value=""),n.selectedDates=[],n.latestSelectedDateObj=void 0,H===!0&&(n.currentYear=n._initialDate.getFullYear(),n.currentMonth=n._initialDate.getMonth()),n.config.enableTime===!0){let{hours:q,minutes:ie,seconds:ye}=Jc(n.config);g(q,ie,ye)}n.redraw(),M&&ht("onChange")}function Ze(){n.isOpen=!1,n.isMobile||(n.calendarContainer!==void 0&&n.calendarContainer.classList.remove("open"),n._input!==void 0&&n._input.classList.remove("active")),ht("onClose")}function It(){n.config!==void 0&&ht("onDestroy");for(let M=n._handlers.length;M--;)n._handlers[M].remove();if(n._handlers=[],n.mobileInput)n.mobileInput.parentNode&&n.mobileInput.parentNode.removeChild(n.mobileInput),n.mobileInput=void 0;else if(n.calendarContainer&&n.calendarContainer.parentNode)if(n.config.static&&n.calendarContainer.parentNode){let M=n.calendarContainer.parentNode;if(M.lastChild&&M.removeChild(M.lastChild),M.parentNode){for(;M.firstChild;)M.parentNode.insertBefore(M.firstChild,M);M.parentNode.removeChild(M)}}else n.calendarContainer.parentNode.removeChild(n.calendarContainer);n.altInput&&(n.input.type="text",n.altInput.parentNode&&n.altInput.parentNode.removeChild(n.altInput),delete n.altInput),n.input&&(n.input.type=n.input._type,n.input.classList.remove("flatpickr-input"),n.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(M=>{try{delete n[M]}catch(H){}})}function Mt(M){return n.calendarContainer.contains(M)}function jt(M){if(n.isOpen&&!n.config.inline){let H=Dr(M),q=Mt(H),ye=!(H===n.input||H===n.altInput||n.element.contains(H)||M.path&&M.path.indexOf&&(~M.path.indexOf(n.input)||~M.path.indexOf(n.altInput)))&&!q&&!Mt(M.relatedTarget),ce=!n.config.ignoredFocusElements.some(ae=>ae.contains(H));ye&&ce&&(n.config.allowInput&&n.setDate(n._input.value,!1,n.config.altInput?n.config.altFormat:n.config.dateFormat),n.timeContainer!==void 0&&n.minuteElement!==void 0&&n.hourElement!==void 0&&n.input.value!==""&&n.input.value!==void 0&&l(),n.close(),n.config&&n.config.mode==="range"&&n.selectedDates.length===1&&n.clear(!1))}}function vt(M){if(!M||n.config.minDate&&Mn.config.maxDate.getFullYear())return;let H=M,q=n.currentYear!==H;n.currentYear=H||n.currentYear,n.config.maxDate&&n.currentYear===n.config.maxDate.getFullYear()?n.currentMonth=Math.min(n.config.maxDate.getMonth(),n.currentMonth):n.config.minDate&&n.currentYear===n.config.minDate.getFullYear()&&(n.currentMonth=Math.max(n.config.minDate.getMonth(),n.currentMonth)),q&&(n.redraw(),ht("onYearChange"),re())}function Wt(M,H=!0){var ce;let q=n.parseDate(M,void 0,H);if(n.config.minDate&&q&&br(q,n.config.minDate,H!==void 0?H:!n.minDateHasTime)<0||n.config.maxDate&&q&&br(q,n.config.maxDate,H!==void 0?H:!n.maxDateHasTime)>0)return!1;if(!n.config.enable&&n.config.disable.length===0)return!0;if(q===void 0)return!1;let ie=!!n.config.enable,ye=(ce=n.config.enable)!=null?ce:n.config.disable;for(let ae=0,Se;ae=Se.from.getTime()&&q.getTime()<=Se.to.getTime())return ie}return!ie}function Tt(M){return n.daysContainer!==void 0?M.className.indexOf("hidden")===-1&&M.className.indexOf("flatpickr-disabled")===-1&&n.daysContainer.contains(M):!1}function Jt(M){let H=M.target===n._input,q=n._input.value.trimEnd()!==ue();H&&q&&!(M.relatedTarget&&Mt(M.relatedTarget))&&n.setDate(n._input.value,!0,M.target===n.altInput?n.config.altFormat:n.config.dateFormat)}function en(M){let H=Dr(M),q=n.config.wrap?e.contains(H):H===n._input,ie=n.config.allowInput,ye=n.isOpen&&(!ie||!q),ce=n.config.inline&&q&&!ie;if(M.keyCode===13&&q){if(ie)return n.setDate(n._input.value,!0,H===n.altInput?n.config.altFormat:n.config.dateFormat),n.close(),H.blur();n.open()}else if(Mt(H)||ye||ce){let ae=!!n.timeContainer&&n.timeContainer.contains(H);switch(M.keyCode){case 13:ae?(M.preventDefault(),l(),Hr()):rn(M);break;case 27:M.preventDefault(),Hr();break;case 8:case 46:q&&!n.config.allowInput&&(M.preventDefault(),n.clear());break;case 37:case 39:if(!ae&&!q){M.preventDefault();let Se=o();if(n.daysContainer!==void 0&&(ie===!1||Se&&Tt(Se))){let nt=M.keyCode===39?1:-1;M.ctrlKey?(M.stopPropagation(),it(nt),Q(G(1),0)):Q(void 0,nt)}}else n.hourElement&&n.hourElement.focus();break;case 38:case 40:{M.preventDefault();let Se=M.keyCode===40?1:-1;n.daysContainer&&H.$i!==void 0||H===n.input||H===n.altInput?M.ctrlKey?(M.stopPropagation(),vt(n.currentYear-Se),Q(G(1),0)):ae||Q(void 0,Se*7):H===n.currentYearElement?vt(n.currentYear-Se):n.config.enableTime&&(!ae&&n.hourElement&&n.hourElement.focus(),l(M),n._debouncedChange());break}case 9:if(ae){let Se=[n.hourElement,n.minuteElement,n.secondElement,n.amPM].concat(n.pluginElements).filter(Te=>Te),nt=Se.indexOf(H);if(nt!==-1){let Te=Se[nt+(M.shiftKey?-1:1)];M.preventDefault(),(Te||n._input).focus()}}else!n.config.noCalendar&&n.daysContainer&&n.daysContainer.contains(H)&&M.shiftKey&&(M.preventDefault(),n._input.focus());break;default:break}}if(n.amPM!==void 0&&H===n.amPM)switch(M.key){case n.l10n.amPM[0].charAt(0):case n.l10n.amPM[0].charAt(0).toLowerCase():n.amPM.textContent=n.l10n.amPM[0],m(),de();break;case n.l10n.amPM[1].charAt(0):case n.l10n.amPM[1].charAt(0).toLowerCase():n.amPM.textContent=n.l10n.amPM[1],m(),de();break}(q||Mt(H))&&ht("onKeyDown",M)}function gn(M,H="flatpickr-day"){if(n.selectedDates.length!==1||M&&(!M.classList.contains(H)||M.classList.contains("flatpickr-disabled")))return;let q=M?M.dateObj.getTime():n.days.firstElementChild.dateObj.getTime(),ie=n.parseDate(n.selectedDates[0],void 0,!0).getTime(),ye=Math.min(q,n.selectedDates[0].getTime()),ce=Math.max(q,n.selectedDates[0].getTime()),ae=!1,Se=0,nt=0;for(let Ue=ye;Ueye&&UeSe)?Se=Ue:Ue>ie&&(!nt||Ue .${H}`)).forEach(Ue=>{let Ft=Ue.dateObj.getTime(),Hn=Se>0&&Ft0&&Ft>nt;if(Hn){Ue.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(Ot=>{Ue.classList.remove(Ot)});return}else if(ae&&!Hn)return;["startRange","inRange","endRange","notAllowed"].forEach(Ot=>{Ue.classList.remove(Ot)}),M!==void 0&&(M.classList.add(q<=n.selectedDates[0].getTime()?"startRange":"endRange"),ieq&&Ft===ie&&Ue.classList.add("endRange"),Ft>=Se&&(nt===0||Ft<=nt)&&rk(Ft,ie,q)&&Ue.classList.add("inRange"))})}function yn(){n.isOpen&&!n.config.static&&!n.config.inline&&Vt()}function vn(M,H=n._positionElement){if(n.isMobile===!0){if(M){M.preventDefault();let ie=Dr(M);ie&&ie.blur()}n.mobileInput!==void 0&&(n.mobileInput.focus(),n.mobileInput.click()),ht("onOpen");return}else if(n._input.disabled||n.config.inline)return;let q=n.isOpen;n.isOpen=!0,q||(n.calendarContainer.classList.add("open"),n._input.classList.add("active"),ht("onOpen"),Vt(H)),n.config.enableTime===!0&&n.config.noCalendar===!0&&n.config.allowInput===!1&&(M===void 0||!n.timeContainer.contains(M.relatedTarget))&&r.setTimeout(()=>n.hourElement.select(),50)}function xn(M){return H=>{let q=n.config[`_${M}Date`]=n.parseDate(H,n.config.dateFormat),ie=n.config[`_${M==="min"?"max":"min"}Date`];q!==void 0&&(n[M==="min"?"minDateHasTime":"maxDateHasTime"]=q.getHours()>0||q.getMinutes()>0||q.getSeconds()>0),n.selectedDates&&(n.selectedDates=n.selectedDates.filter(ye=>Wt(ye)),!n.selectedDates.length&&M==="min"&&h(q),de()),n.daysContainer&&(Bt(),q!==void 0?n.currentYearElement[M]=q.getFullYear().toString():n.currentYearElement.removeAttribute(M),n.currentYearElement.disabled=!!ie&&q!==void 0&&ie.getFullYear()===q.getFullYear())}}function jn(){let M=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],H={...JSON.parse(JSON.stringify(e.dataset||{})),...t},q={};n.config.parseDate=H.parseDate,n.config.formatDate=H.formatDate,Object.defineProperty(n.config,"enable",{get:()=>n.config._enable,set:ce=>{n.config._enable=at(ce)}}),Object.defineProperty(n.config,"disable",{get:()=>n.config._disable,set:ce=>{n.config._disable=at(ce)}});let ie=H.mode==="time";if(!H.dateFormat&&(H.enableTime||ie)){let ce=Fn.defaultConfig.dateFormat||ka.dateFormat;q.dateFormat=H.noCalendar||ie?"H:i"+(H.enableSeconds?":S":""):ce+" H:i"+(H.enableSeconds?":S":"")}if(H.altInput&&(H.enableTime||ie)&&!H.altFormat){let ce=Fn.defaultConfig.altFormat||ka.altFormat;q.altFormat=H.noCalendar||ie?"h:i"+(H.enableSeconds?":S K":" K"):ce+` h:i${H.enableSeconds?":S":""} K`}Object.defineProperty(n.config,"minDate",{get:()=>n.config._minDate,set:xn("min")}),Object.defineProperty(n.config,"maxDate",{get:()=>n.config._maxDate,set:xn("max")});let ye=ce=>ae=>{n.config[ce==="min"?"_minTime":"_maxTime"]=n.parseDate(ae,"H:i:S")};Object.defineProperty(n.config,"minTime",{get:()=>n.config._minTime,set:ye("min")}),Object.defineProperty(n.config,"maxTime",{get:()=>n.config._maxTime,set:ye("max")}),H.mode==="time"&&(n.config.noCalendar=!0,n.config.enableTime=!0),Object.assign(n.config,q,H);for(let ce=0;cen.config[ce]!==void 0).forEach(ce=>{n.config[ce]=jc(n.config[ce]||[]).map(s)}),n.isMobile=!n.config.disableMobile&&!n.config.inline&&n.config.mode==="single"&&!n.config.disable.length&&!n.config.enable&&!n.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(let ce=0;ce-1?n.config[Se]=jc(ae[Se]).map(s).concat(n.config[Se]):typeof H[Se]=="undefined"&&(n.config[Se]=ae[Se])}H.altInputClass||(n.config.altInputClass=sn().className+" "+n.config.altInputClass),ht("onParseConfig")}function sn(){return n.config.wrap?e.querySelector("[data-input]"):e}function Rt(){typeof n.config.locale!="object"&&typeof Fn.l10ns[n.config.locale]=="undefined"&&n.config.errorHandler(new Error(`flatpickr: invalid locale ${n.config.locale}`)),n.l10n={...Fn.l10ns.default,...typeof n.config.locale=="object"?n.config.locale:n.config.locale!=="default"?Fn.l10ns[n.config.locale]:void 0},Gi.D=`(${n.l10n.weekdays.shorthand.join("|")})`,Gi.l=`(${n.l10n.weekdays.longhand.join("|")})`,Gi.M=`(${n.l10n.months.shorthand.join("|")})`,Gi.F=`(${n.l10n.months.longhand.join("|")})`,Gi.K=`(${n.l10n.amPM[0]}|${n.l10n.amPM[1]}|${n.l10n.amPM[0].toLowerCase()}|${n.l10n.amPM[1].toLowerCase()})`,{...t,...JSON.parse(JSON.stringify(e.dataset||{}))}.time_24hr===void 0&&Fn.defaultConfig.time_24hr===void 0&&(n.config.time_24hr=n.l10n.time_24hr),n.formatDate=ig(n),n.parseDate=qc({config:n.config,l10n:n.l10n})}function Vt(M){if(typeof n.config.position=="function")return void n.config.position(n,M);if(n.calendarContainer===void 0)return;ht("onPreCalendarPosition");let H=M||n._positionElement,q=Array.prototype.reduce.call(n.calendarContainer.children,(Yt,Bn)=>Yt+Bn.offsetHeight,0),ie=n.calendarContainer.offsetWidth,ye=n.config.position.split(" "),ce=ye[0],ae=ye.length>1?ye[1]:null,Se=H.getBoundingClientRect(),nt=r.innerHeight-Se.bottom,Te=ce==="above"||ce!=="below"&&ntq,Ue=r.pageYOffset+Se.top+(Te?-q-2:H.offsetHeight+2);if(tr(n.calendarContainer,"arrowTop",!Te),tr(n.calendarContainer,"arrowBottom",Te),n.config.inline)return;let We=r.pageXOffset+Se.left,Ft=!1,Hn=!1;ae==="center"?(We-=(ie-Se.width)/2,Ft=!0):ae==="right"&&(We-=ie-Se.width,Hn=!0),tr(n.calendarContainer,"arrowLeft",!Ft&&!Hn),tr(n.calendarContainer,"arrowCenter",Ft),tr(n.calendarContainer,"arrowRight",Hn);let Ot=r.document.body.offsetWidth-(r.pageXOffset+Se.right),or=We+ie>r.document.body.offsetWidth,sr=Ot+ie>r.document.body.offsetWidth;if(tr(n.calendarContainer,"rightMost",or),!n.config.static)if(n.calendarContainer.style.top=`${Ue}px`,!or)n.calendarContainer.style.left=`${We}px`,n.calendarContainer.style.right="auto";else if(!sr)n.calendarContainer.style.left="auto",n.calendarContainer.style.right=`${Ot}px`;else{let Yt=Sr();if(Yt===void 0)return;let Bn=r.document.body.offsetWidth,Er=Math.max(0,Bn/2-ie/2),Gr=".flatpickr-calendar.centerMost:before",tu=".flatpickr-calendar.centerMost:after",z=Yt.cssRules.length,k=`{left:${Se.left}px;right:auto;}`;tr(n.calendarContainer,"rightMost",!1),tr(n.calendarContainer,"centerMost",!0),Yt.insertRule(`${Gr},${tu}${k}`,z),n.calendarContainer.style.left=`${Er}px`,n.calendarContainer.style.right="auto"}}function Sr(){let M=null;for(let H=0;Hae.classList&&ae.classList.contains("flatpickr-day")&&!ae.classList.contains("flatpickr-disabled")&&!ae.classList.contains("notAllowed"),q=ag(Dr(M),H);if(q===void 0)return;let ie=q,ye=n.latestSelectedDateObj=new Date(ie.dateObj.getTime()),ce=(ye.getMonth()n.currentMonth+n.config.showMonths-1)&&n.config.mode!=="range";if(n.selectedDateElem=ie,n.config.mode==="single")n.selectedDates=[ye];else if(n.config.mode==="multiple"){let ae=L(ye);ae?n.selectedDates.splice(parseInt(ae),1):n.selectedDates.push(ye)}else n.config.mode==="range"&&(n.selectedDates.length===2&&n.clear(!1,!1),n.latestSelectedDateObj=ye,n.selectedDates.push(ye),br(ye,n.selectedDates[0],!0)!==0&&n.selectedDates.sort((ae,Se)=>ae.getTime()-Se.getTime()));if(m(),ce){let ae=n.currentYear!==ye.getFullYear();n.currentYear=ye.getFullYear(),n.currentMonth=ye.getMonth(),ae&&(ht("onYearChange"),re()),ht("onMonthChange")}if(ee(),te(),de(),!ce&&n.config.mode!=="range"&&n.config.showMonths===1?B(ie):n.selectedDateElem!==void 0&&n.hourElement===void 0&&n.selectedDateElem&&n.selectedDateElem.focus(),n.hourElement!==void 0&&n.hourElement!==void 0&&n.hourElement.focus(),n.config.closeOnSelect){let ae=n.config.mode==="single"&&!n.config.enableTime,Se=n.config.mode==="range"&&n.selectedDates.length===2&&!n.config.enableTime;(ae||Se)&&Hr()}D()}let At={locale:[Rt,U],showMonths:[be,u,Ce],minDate:[C],maxDate:[C],positionElement:[_n],clickOpens:[()=>{n.config.clickOpens===!0?(v(n._input,"focus",n.open),v(n._input,"click",n.open)):(n._input.removeEventListener("focus",n.open),n._input.removeEventListener("click",n.open))}]};function Z(M,H){if(M!==null&&typeof M=="object"){Object.assign(n.config,M);for(let q in M)At[q]!==void 0&&At[q].forEach(ie=>ie())}else n.config[M]=H,At[M]!==void 0?At[M].forEach(q=>q()):Kc.indexOf(M)>-1&&(n.config[M]=jc(H));n.redraw(),de(!0)}function me(M,H){let q=[];if(Array.isArray(M))q=M.map(ie=>n.parseDate(ie,H));else if(M.getDate||typeof M=="number")q=[n.parseDate(M,H)];else if(typeof M=="string")switch(n.config.mode){case"single":case"time":q=[n.parseDate(M,H)];break;case"multiple":q=M.split(n.config.conjunction).map(ie=>n.parseDate(ie,H));break;case"range":q=M.split(n.l10n.rangeSeparator).map(ie=>n.parseDate(ie,H));break;default:break}else n.config.errorHandler(new Error(`Invalid date supplied: ${JSON.stringify(M)}`));n.selectedDates=n.config.allowInvalidPreload?q:q.filter(ie=>ie.getDate&&Wt(ie,!1)),n.config.mode==="range"&&n.selectedDates.sort((ie,ye)=>ie.getTime()-ye.getTime())}function Ie(M,H=!1,q=n.config.dateFormat){if(M!==0&&!M||Array.isArray(M)&&M.length===0)return n.clear(H);me(M,q),n.latestSelectedDateObj=n.selectedDates[n.selectedDates.length-1],n.redraw(),C(void 0,H),h(),n.selectedDates.length===0&&n.clear(!1),de(H),H&&ht("onChange")}function at(M){return M.slice().map(H=>typeof H=="string"||typeof H=="number"||H.getDate?n.parseDate(H,void 0,!0):H&&typeof H=="object"&&H.from&&H.to?{from:n.parseDate(H.from,void 0),to:n.parseDate(H.to,void 0)}:H).filter(H=>H)}function Dt(){n.selectedDates=[],n.now=n.parseDate(n.config.now)||new Date;let M=n.config.defaultDate||((n.input.nodeName==="INPUT"||n.input.nodeName==="TEXTAREA")&&n.input.placeholder&&n.input.value===n.input.placeholder?null:n.input.value);M&&me(M,n.config.dateFormat),n._initialDate=n.selectedDates.length>0?n.selectedDates[0]:n.config.minDate&&n.config.minDate.getTime()>n.now.getTime()?n.config.minDate:n.config.maxDate&&n.config.maxDate.getTime()0&&(n.latestSelectedDateObj=n.selectedDates[0]),n.config.minTime!==void 0&&(n.config.minTime=n.parseDate(n.config.minTime,"H:i")),n.config.maxTime!==void 0&&(n.config.maxTime=n.parseDate(n.config.maxTime,"H:i")),n.minDateHasTime=!!n.config.minDate&&(n.config.minDate.getHours()>0||n.config.minDate.getMinutes()>0||n.config.minDate.getSeconds()>0),n.maxDateHasTime=!!n.config.maxDate&&(n.config.maxDate.getHours()>0||n.config.maxDate.getMinutes()>0||n.config.maxDate.getSeconds()>0)}function Cn(){if(n.input=sn(),!n.input){n.config.errorHandler(new Error("Invalid input element specified"));return}n.input._type=n.input.type,n.input.type="text",n.input.classList.add("flatpickr-input"),n._input=n.input,n.config.altInput&&(n.altInput=Pt(r.document,n.input.nodeName,n.config.altInputClass),n._input=n.altInput,n.altInput.placeholder=n.input.placeholder,n.altInput.disabled=n.input.disabled,n.altInput.required=n.input.required,n.altInput.tabIndex=n.input.tabIndex,n.altInput.type="text",n.input.setAttribute("type","hidden"),!n.config.static&&n.input.parentNode&&n.input.parentNode.insertBefore(n.altInput,n.input.nextSibling)),n.config.allowInput||n._input.setAttribute("readonly","readonly"),_n()}function _n(){n._positionElement=n.config.positionElement||n._input}function Ht(){let M=n.config.enableTime?n.config.noCalendar?"time":"datetime-local":"date";n.mobileInput=Pt(r.document,"input",n.input.className+" flatpickr-mobile"),n.mobileInput.tabIndex=1,n.mobileInput.type=M,n.mobileInput.disabled=n.input.disabled,n.mobileInput.required=n.input.required,n.mobileInput.placeholder=n.input.placeholder,n.mobileFormatStr=M==="datetime-local"?"Y-m-d\\TH:i:S":M==="date"?"Y-m-d":"H:i:S",n.selectedDates.length>0&&(n.mobileInput.defaultValue=n.mobileInput.value=n.formatDate(n.selectedDates[0],n.mobileFormatStr)),n.config.minDate&&(n.mobileInput.min=n.formatDate(n.config.minDate,"Y-m-d")),n.config.maxDate&&(n.mobileInput.max=n.formatDate(n.config.maxDate,"Y-m-d")),n.input.getAttribute("step")&&(n.mobileInput.step=String(n.input.getAttribute("step"))),n.input.type="hidden",n.altInput!==void 0&&(n.altInput.type="hidden");try{n.input.parentNode&&n.input.parentNode.insertBefore(n.mobileInput,n.input.nextSibling)}catch(H){}v(n.mobileInput,"change",H=>{n.setDate(Dr(H).value,!1,n.mobileFormatStr),ht("onChange"),ht("onClose")})}function ar(M){if(n.isOpen===!0)return n.close();n.open(M)}function ht(M,H){if(n.config===void 0)return;let q=n.config[M];if(q!==void 0&&q.length>0)for(let ie=0;q[ie]&&ie=0&&br(M,n.selectedDates[1])<=0}function ee(){n.config.noCalendar||n.isMobile||!n.monthNav||(n.yearElements.forEach((M,H)=>{let q=new Date(n.currentYear,n.currentMonth,1);q.setMonth(n.currentMonth+H),n.config.showMonths>1||n.config.monthSelectorType==="static"?n.monthElements[H].textContent=Pl(q.getMonth(),n.config.shorthandCurrentMonth,n.l10n)+" ":n.monthsDropdownContainer.value=q.getMonth().toString(),M.value=q.getFullYear().toString()}),n._hidePrevMonthArrow=n.config.minDate!==void 0&&(n.currentYear===n.config.minDate.getFullYear()?n.currentMonth<=n.config.minDate.getMonth():n.currentYearn.config.maxDate.getMonth():n.currentYear>n.config.maxDate.getFullYear()))}function ue(M){let H=M||(n.config.altInput?n.config.altFormat:n.config.dateFormat);return n.selectedDates.map(q=>n.formatDate(q,H)).filter((q,ie,ye)=>n.config.mode!=="range"||n.config.enableTime||ye.indexOf(q)===ie).join(n.config.mode!=="range"?n.config.conjunction:n.l10n.rangeSeparator)}function de(M=!0){n.mobileInput!==void 0&&n.mobileFormatStr&&(n.mobileInput.value=n.latestSelectedDateObj!==void 0?n.formatDate(n.latestSelectedDateObj,n.mobileFormatStr):""),n.input.value=ue(n.config.dateFormat),n.altInput!==void 0&&(n.altInput.value=ue(n.config.altFormat)),M!==!1&&ht("onValueUpdate")}function ve(M){let H=Dr(M),q=n.prevMonthNav.contains(H),ie=n.nextMonthNav.contains(H);q||ie?it(q?-1:1):n.yearElements.indexOf(H)>=0?H.select():H.classList.contains("arrowUp")?n.changeYear(n.currentYear+1):H.classList.contains("arrowDown")&&n.changeYear(n.currentYear-1)}function ge(M){M.preventDefault();let H=M.type==="keydown",q=Dr(M),ie=q;n.amPM!==void 0&&q===n.amPM&&(n.amPM.textContent=n.l10n.amPM[wr(n.amPM.textContent===n.l10n.amPM[0])]);let ye=parseFloat(ie.getAttribute("min")),ce=parseFloat(ie.getAttribute("max")),ae=parseFloat(ie.getAttribute("step")),Se=parseInt(ie.value,10),nt=M.delta||(H?M.which===38?1:-1:0),Te=Se+ae*nt;if(typeof ie.value!="undefined"&&ie.value.length===2){let Ue=ie===n.hourElement,We=ie===n.minuteElement;Tece&&(Te=ie===n.hourElement?Te-ce-wr(!n.amPM):ye,We&&O(void 0,1,n.hourElement)),n.amPM&&Ue&&(ae===1?Te+Se===23:Math.abs(Te-Se)>ae)&&(n.amPM.textContent=n.l10n.amPM[wr(n.amPM.textContent===n.l10n.amPM[0])]),ie.value=er(Te)}}return a(),n}function Zc(e,t){let r=Array.prototype.slice.call(e).filter(i=>i.onClickEvent),n=[];for(let i=0;i{Fn.l10ns.default={...Fn.l10ns.default,...e}};Fn.setDefaults=e=>{Fn.defaultConfig={...Fn.defaultConfig,...e}};Fn.parseDate=qc({});Fn.formatDate=ig({});Fn.compareDates=br;typeof jQuery!="undefined"&&typeof jQuery.fn!="undefined"&&(jQuery.fn.flatpickr=function(e){return Zc(this,e)});Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof e=="string"?parseInt(e,10):e))};typeof window!="undefined"&&(window.flatpickr=Fn);var Qc=Fn;function Xc(e,t,r){let n=t.getSetting("date-format"),i=t.getSetting("date-trigger"),a=t.getSetting("link-date-to-daily-note"),o=(0,ok.moment)(r).format(n),s=a?ed(t.app,o):`{${o}} `,u={line:e.start.line,ch:e.start.ch+i.length};e.editor.replaceRange(s,u,e.end),e.editor.setCursor({line:u.line,ch:u.ch+s.length}),e.editor.focus()}function sk(e,t,r,n){r.createEl("input",{type:"text"},i=>{r.win.setTimeout(()=>n(Qc(i,{win:i.win,now:new Date,inline:!0,locale:zc(t),onChange:a=>Xc(e,t,a[0])})))})}function lk(e){let t=e.month(),r=e.clone().startOf("month").weekday(0),n=e.diff(r,"week");e.subtract(1,"month").startOf("month").weekday(6).add(n,"week");let i=e.month();for(;t===i;)e.subtract(1,"week"),i=e.month();return e}function uk(e){let t=e.month(),r=e.clone().startOf("month").weekday(6),n=e.diff(r,"week");e.add(1,"month").startOf("month").weekday(0).add(n,"week");let i=e.month();for(;t===i;)e.add(1,"week"),i=e.month();return e}function og(e,t,r){let n=(t.getLine(r.line)||"").slice(0,r.ch),i=new RegExp(`(?:^|\\s)${Qn(e)}{?([^}]*)$`);return n.match(i)}function sg(e,t,r){let n=(t.getLine(r.line)||"").slice(0,r.ch),i=new RegExp(`(?:^|\\s)${Qn(e)}{?([^}]*)$`);return n.match(i)}var td=class extends Hl.EditorSuggest{constructor(r,n){super(r);this.datepicker=null;this.app=r,this.plugin=n,[...this.scope.keys].forEach(a=>this.scope.unregister(a)),this.suggestEl.addClass($("date-suggest"));let i=a=>{let{datepicker:o}=this;if(!o)return;let s=(0,Hl.moment)(o.selectedDates[0]||new Date),u;if(a==="right"?s.weekday()===6?u=uk(s).toDate():u=s.add(1,"day").toDate():a==="left"?s.weekday()===0?u=lk(s).toDate():u=s.subtract(1,"day").toDate():a==="up"?u=s.subtract(1,"week").toDate():a==="down"&&(u=s.add(1,"week").toDate()),u)return o.setDate(u,!1),!1};this.scope.register([],"ArrowLeft",()=>i("left")),this.scope.register([],"ArrowRight",()=>i("right")),this.scope.register([],"ArrowDown",()=>i("down")),this.scope.register([],"ArrowUp",()=>i("up")),this.scope.register([],"Enter",()=>{let a=this.datepicker.selectedDates,o=this.context;return a.length?Xc(o,this.stateManager,a[0]):Xc(o,this.stateManager,new Date),this.close(),!1}),this.scope.register([],"Escape",()=>(this.close(),!1))}get stateManager(){return this.context?this.plugin.stateManagers.get(this.context.file):null}getSuggestions(){return[]}renderSuggestion(){}selectSuggestion(){}showSuggestions(){let{datepicker:r,suggestEl:n,context:i,stateManager:a}=this;!r&&a&&(n.empty(),n.addClasses([$("date-picker"),$("ignore-click-outside")]),sk(i,a,n,o=>{this.datepicker=o,this.updatePosition(!0)}))}onTrigger(r,n,i){let a=this.plugin.getStateManager(i);if(!a)return null;let o=a.getSetting("date-trigger");return sg(o,n,r)?{start:{line:r.line,ch:r.ch-o.length},end:r,query:o}:null}close(){super.close(),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null,this.suggestEl.empty())}},nd=class extends Hl.EditorSuggest{constructor(t,r){super(t),this.app=t,this.plugin=r}onTrigger(t,r,n){let i=this.plugin.getStateManager(n);if(!i)return null;let a=i.getSetting("time-trigger"),o=og(a,r,t);return o?(this.times=lg(i),{start:{line:t.line,ch:t.ch-o[1].length-a.length},end:t,query:o[1]}):null}getSuggestions(t){return this.plugin.getStateManager(t.file)?this.times.filter(n=>n.startsWith(t.query)||n.startsWith("0"+t.query)):[]}renderSuggestion(t,r){t.endsWith("00")?r.createEl("strong",{text:t}):r.setText(t)}selectSuggestion(t){let{context:r,plugin:n}=this,i=n.getStateManager(r.file);if(!i)return;let o=`${i.getSetting("time-trigger")}{${t}} `;r.editor.replaceRange(o,r.start,r.end),r.editor.setCursor({line:r.start.line,ch:r.start.ch+o.length}),r.editor.focus()}close(){super.close(),this.times=null}};function Ca(e,t,r){return xa.Platform.isMobile||e.getSetting("new-line-trigger")==="enter"?!(t||r):t||r}function oN(e){return new Proxy(e.app,{get(t,r,n){return r==="vault"?new Proxy(e.app.vault,{get(i,a,o){return a==="config"?new Proxy(e.app.vault.config,{get(s,u,l){return["showLineNumber","foldHeading","foldIndent"].includes(u)?!1:Reflect.get(s,u,l)}}):Reflect.get(i,a,o)}}):Reflect.get(t,r,n)}})}function sN(e,t){return{app:e.app,showSearch:Mr,toggleMode:Mr,onMarkdownScroll:Mr,getMode:()=>"source",scroll:0,editMode:null,get editor(){return t()},get file(){return e.file},get path(){return e.file.path}}}function lN(e){var r,n;let t=uN(e);t&&((n=(r=window.CodeMirrorAdapter)==null?void 0:r.Vim)==null||n.enterInsertMode(t))}function uN(e){var t,r,n;return(n=(r=(t=e==null?void 0:e.plugins)==null?void 0:t.find(i=>i!=null&&i.value?"useNextTextInput"in i.value&&"waitForCopy"in i.value:!1))==null?void 0:r.value)==null?void 0:n.cm}function _a({editorRef:e,onEnter:t,onEscape:r,onChange:n,onPaste:i,className:a,onSubmit:o,editState:s,value:u,placeholder:l}){let{view:c,stateManager:d}=Ee(tt),m=Fe(),h=Fe();Ae(()=>{class y extends c.plugin.MarkdownEditor{constructor(){super(...arguments);this.isKanbanEditor=!0}showTasksPluginAutoSuggest(P,B,G){if(og(d.getSetting("time-trigger"),B,P)||sg(d.getSetting("date-trigger"),B,P))return!1;if(G&&P.line===0)return!0}updateBottomPadding(){}onUpdate(P,B){super.onUpdate(P,B),n&&n(P)}buildLocalExtensions(){let P=super.buildLocalExtensions();P.push(Uc.init(()=>d)),P.push(KS),P.push(fs.Prec.highest(lo.EditorView.domEventHandlers({focus:G=>(c.activeEditor=this.owner,xa.Platform.isMobile&&c.contentEl.addClass("is-mobile-editing"),G.win.setTimeout(()=>{this.app.workspace.activeEditor=this.owner,xa.Platform.isMobile&&this.app.mobileToolbar.update()}),!0),blur:()=>(xa.Platform.isMobile&&(c.contentEl.removeClass("is-mobile-editing"),this.app.mobileToolbar.update()),!0)}))),l&&P.push((0,lo.placeholder)(l)),i&&P.push(fs.Prec.high(lo.EditorView.domEventHandlers({paste:i})));let B=(G,J)=>Q=>(t(Q,G,J)||(this.app.vault.getConfig("smartIndentList")?this.editor.newlineAndIndentContinueMarkdownList():(0,ck.insertBlankLine)(Q)),!0);return P.push(fs.Prec.highest(lo.keymap.of([{key:"Enter",run:B(!1,!1),shift:B(!1,!0),preventDefault:!0},{key:"Mod-Enter",run:B(!0,!1),shift:B(!0,!0),preventDefault:!0},{key:"Escape",run:G=>(r(G),!1),preventDefault:!0}]))),P}}let v=sN(c,()=>I.editor),D=oN(c),I=c.plugin.addChild(new y(D,m.current,v)),C=I.cm;h.current=C,e&&(e.current=C),v.editMode=I,I.set(u||""),kn(s)&&(C.dispatch({userEvent:"select.pointer",selection:fs.EditorSelection.single(C.posAtCoords(s,!1))}),C.dom.win.setTimeout(()=>{lN(C)}));let x=()=>{m.current.scrollIntoView({block:"end"})};return xa.Platform.isMobile&&C.dom.win.addEventListener("keyboardDidShow",x),()=>{xa.Platform.isMobile&&(C.dom.win.removeEventListener("keyboardDidShow",x),c.activeEditor===v&&(c.activeEditor=null),D.workspace.activeEditor===v&&(D.workspace.activeEditor=null,D.mobileToolbar.update(),c.contentEl.removeClass("is-mobile-editing"))),c.plugin.removeChild(I),h.current=null,e&&(e.current=null)}},[]);let g=["cm-table-widget"];return a&&g.push(a),E(ct,{children:[E("div",{className:Ge(g),ref:m}),xa.Platform.isMobile&&E("button",{onClick:()=>o(h.current),className:Ge([$("item-submit-button"),"mod-cta"]),children:R("Submit")})]})}var Bl=require("obsidian");function cN(e,t){if(t)return t.from((0,Bl.moment)());let r=(0,Bl.moment)().startOf("day");if(r.isSame(e,"day"))return R("today");let n=e.diff(r,"day");return n===-1?R("yesterday"):n===1?R("tomorrow"):e.from(r)}function rd({item:e,stateManager:t}){if(!t.useSetting("show-relative-date")||!e.data.metadata.date)return null;let n=cN(e.data.metadata.date,e.data.metadata.time);return E("span",{className:$("item-metadata-date-relative"),children:n})}function id({item:e,stateManager:t,filePath:r,onEditDate:n,onEditTime:i,getDateColor:a}){var A;let o=t.useSetting("move-dates"),s=t.useSetting("date-format"),u=t.useSetting("time-format"),l=t.useSetting("date-display-format"),c=t.useSetting("link-date-to-daily-note"),d=(A=e.data.metadata.time)!=null?A:e.data.metadata.date,m=Re(()=>d?a(d):null,[d,a]);if(!o||!d)return null;let h=d.format(s);if(!h)return null;let g=!!e.data.metadata.date,y=!!e.data.metadata.time,v=d.format(l),D=y?d.format(u):null,I=h?(0,Bl.getLinkpath)(h):null,C=h?t.app.metadataCache.getFirstLinkpathDest(I,r):null,x=I&&c?E("a",{href:I,"data-href":I,className:`internal-link ${C?"":"is-unresolved"}`,target:"blank",rel:"noopener",children:v}):v,O={};return c||(O["aria-label"]=R("Change date"),O.onClick=n),E("span",{style:m&&{"--date-color":m.color,"--date-background-color":m.backgroundColor},className:Ge([$("item-metadata-date-wrapper"),$("date"),{"has-background":!!(m!=null&&m.backgroundColor)}]),children:[g&&E(ct,{children:[E("span",{...O,className:`${$("item-metadata-date")} ${c?"":"is-button"}`,children:x})," "]}),y&&E("span",{onClick:i,className:`${$("item-metadata-time")} is-button`,"aria-label":R("Change time"),children:D})]})}function dk({item:e,stateManager:t}){let r=Ee(zn),n=t.getSetting("metadata-keys"),i=t.useSetting("inline-metadata-position")==="footer",a=t.useSetting("move-task-metadata"),{inlineMetadata:o}=e.data.metadata;if(!o||!i&&!a)return null;let s=il();return E("span",{className:$("item-task-metadata"),children:o.map((u,l)=>{var O,A;let c=Pu(u,n),{metadataKey:d,value:m,label:h}=c,g=yi.has(d);if(!a&&g||!i&&!g)return null;let y=u.wrapping==="emoji-shorthand",v=(A=(O=s==null?void 0:s.api)==null?void 0:O.parse(m))!=null?A:m,D=y&&d==="priority",I=!!(v!=null&&v.ts),C=d.replace(/[^a-zA-Z0-9_]/g,"-"),x="";return h&&!g?x=h:x=y?mb(d,m):No(d),y||(x+=": "),E("span",{className:Ge([$("item-task-inline-metadata-item"),$(`inline-metadata__${C}`),{"is-task-metadata":g,"is-emoji":y,"is-date":I}]),children:[!I&&E("span",{className:$("item-task-inline-metadata-item-key"),children:x}),!D&&E("span",{className:$("item-task-inline-metadata-item-value"),children:E(hs,{searchQuery:r==null?void 0:r.query,dateLabel:I?x:void 0,data:c})})]},l)})})}function ug(e,t){let{stateManager:r,boardModifiers:n}=Ee(tt),i=t||Ui();return Re(()=>({onEditDate:s=>{var u;od(s.view,r,{x:s.clientX,y:s.clientY},sd({stateManager:r,boardModifiers:n,item:e,hasDate:!0,path:i}),(u=e.data.metadata.date)==null?void 0:u.toDate())},onEditTime:s=>{ld(s.view,r,{x:s.clientX,y:s.clientY},ud({stateManager:r,boardModifiers:n,item:e,hasTime:!0,path:i}),e.data.metadata.time)}}),[n,i,e,r])}function dN(e,t,r){let n=0,i=t.split(/\n\r?/g),a=[];return i.forEach(o=>{var u,l,c;if(n>r){a.push(o);return}let s=o.match(/^(\s*>)*(\s*[-+*]\s+?\[)([^\]])(\]\s+)/);if(s){if(n===r){let d=pb(o,e.file);if(d)a.push(d);else{let m=s[3]===" "?Zn():" ",h=(u=s[1])!=null?u:"",g=(l=s[2])!=null?l:"",y=(c=s[4])!=null?c:"";a.push(h+g+m+y+o.slice(s[0].length))}}else a.push(o);n++;return}a.push(o)}),a.join(`
+`)}function ps({tags:e,searchQuery:t,alwaysShow:r}){let{stateManager:n}=Ee(tt),i=Lu(n),a=Ee(zn),o=n.useSetting("move-tags")||r;return!e.length||!o?null:E("div",{className:$("item-tags"),children:e.map((s,u)=>{let l=i(s);return E("a",{href:s,onClick:c=>{c.preventDefault();let d=n.getSetting("tag-action");if(a&&d==="kanban"){a.search(s,!0);return}n.app.internalPlugins.getPluginById("global-search").instance.openGlobalSearch(`tag:${s}`)},className:`tag ${$("item-tag")} ${t&&s.toLocaleLowerCase().contains(t)?"is-search-match":""}`,style:l&&{"--tag-color":l.color,"--tag-background":l.backgroundColor},children:[E("span",{children:s[0]}),s.slice(1)]},u)})})}var ad=zt(function({item:t,editState:r,setEditState:n,searchQuery:i,showMetadata:a=!0,isStatic:o}){let{stateManager:s,filePath:u,boardModifiers:l}=Ee(tt),c=fa(s),d=Fe(null);Ae(()=>{r===1?(d.current!==null&&l.updateItem(m,s.updateItemContent(t,d.current)),d.current=null):r===0&&(d.current=null)},[r,s,t]);let m=Ui(),{onEditDate:h,onEditTime:g}=ug(t),y=Ye((x,O,A)=>{if(!Ca(s,O,A))return n(1),!0},[s]),v=Ye(x=>{x.targetNode.instanceOf(HTMLElement)&&(x.targetNode.hasClass($("item-metadata-date"))?h(x):x.targetNode.hasClass($("item-metadata-time"))&&g(x))},[h,g]),D=Ye(()=>n(1),[]),I=Ye(()=>(n(0),!0),[t]),C=Ye(x=>{let O=x.target;if(O.hasClass("task-list-item-checkbox")){if(O.dataset.src)return;let A=parseInt(O.dataset.checkboxIndex,10),P=dN(s,t.data.titleRaw,A),B=s.updateItemContent(t,P);l.updateItem(m,B)}},[m,l,s,t]);return!o&&kn(r)?E("div",{className:$("item-input-wrapper"),children:E(_a,{editState:r,className:$("item-input"),onEnter:y,onEscape:I,onSubmit:D,value:t.data.titleRaw,onChange:x=>{x.docChanged&&(d.current=x.state.doc.toString().trim())}})}):E("div",{onClick:v,className:$("item-title"),children:[o?E(WS,{entityId:t.id,className:$("item-markdown"),markdownString:t.data.title,searchQuery:i,onPointerUp:C}):E(Sa,{entityId:t.id,className:$("item-markdown"),markdownString:t.data.title,searchQuery:i,onPointerUp:C}),a&&E("div",{className:$("item-metadata"),children:[E(rd,{item:t,stateManager:s}),E(id,{item:t,stateManager:s,filePath:u,getDateColor:c}),E(dk,{item:t,stateManager:s}),E(ps,{tags:t.data.metadata.tags,searchQuery:i})]})]})});function fN(e,t=[],r){return t.reduce((n,i)=>{if(yi.has(i.key))return n;let a=Pu(i,r);return n[i.key]=a,n},e||{})}function fk({item:e,searchQuery:t}){let{stateManager:r}=Ee(tt),n=r.useSetting("inline-metadata-position")==="metadata-table",i=r.useSetting("metadata-keys"),{fileMetadata:a,fileMetadataOrder:o,inlineMetadata:s}=e.data.metadata,u=Re(()=>{let c=n?fN(a,s,i||[]):a;return!c||!Object.keys(c).length?null:c},[a,s,i]),l=Re(()=>{let c=new Set(o||[]);return n&&(s!=null&&s.length)&&s.forEach(d=>{c.has(d.key)||c.add(d.key)}),Array.from(c)},[o,n,s]);return u?E("div",{className:$("item-metadata-wrapper"),children:E(gN,{metadata:u,order:l,searchQuery:t})}):null}function hN(e,t){let r;if(e.ts?r=(0,li.moment)(e.ts):li.moment.isMoment(e)?r=e:e instanceof Date&&(r=(0,li.moment)(e)),r){let n=t.getSetting(r.hours()===0?"date-display-format":"date-time-display-format");return r.format(n)}return null}function mN(e,t){if(typeof e!="object"||!e.path)return null;let r=app.vault.getAbstractFileByPath(e.path);if(r&&r instanceof li.TFile){let n=app.fileManager.generateMarkdownLink(r,t.file.path,e.subpath,e.display);return`${e.embed&&n[0]!=="!"?"!":""}${n}`}return`${e.embed?"!":""}[[${e.path}${e.display?`|${e.display}`:""}]]`}function hk(e){if(typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e)){let r=(0,li.moment)(e);if(r.isValid())return r}if(li.moment.isMoment(e))return e;if(e instanceof Date)return(0,li.moment)(e);let t=(0,cg.getAPI)();return t!=null&&t.value.isDate(e)?(0,li.moment)(e.ts):null}function In(e,t){Ni(e)&&e.value&&(e=e.value);let r=hk(e);if(r)return hN(r,t);if(typeof e=="string")return e;if(e instanceof li.TFile)return e.path;if(Array.isArray(e))return e.map(i=>In(i,t)).join(" ");if(e.rrule)return e.toText();let n=(0,cg.getAPI)();return n?n.value.toString(e):`${e}`}function pN(e,t){return In(e.value,t)}function hs({data:e,dateLabel:t,searchQuery:r}){let{view:n,stateManager:i}=Ee(tt),a=fa(i),o=(s,u)=>{let l=mN(s,n),c=hk(s),d=In(s,i),m=r&&d.toLocaleLowerCase().contains(r),h;if(l||e.containsMarkdown)h=E(Sa,{className:"inline",markdownString:l||d,searchQuery:r});else if(c){let g=a(c);h=E("span",{className:Ge({[$("date")]:!0,"is-search-match":m,"has-background":g==null?void 0:g.backgroundColor}),style:g&&{"--date-color":g.color,"--date-background-color":g.backgroundColor},children:[!!t&&E("span",{className:$("item-metadata-date-label"),children:t}),E("span",{className:$("item-metadata-date"),children:d})]})}else m?h=E("span",{className:"is-search-match",children:d}):h=d;return E(ct,{children:[h,u?E("span",{children:u}):null]})};return Array.isArray(e.value)?E("span",{className:Ge([$("meta-value"),"mod-array"]),children:e.value.map((s,u,l)=>o(s,u{let o=t[a];if(!o)return null;let s=(o.label||a).toLocaleLowerCase().contains(n);return E("tr",{className:$("meta-row"),children:[!o.shouldHideLabel&&E("td",{className:Ge([$("meta-key"),{"is-search-match":s}]),"data-key":a,children:E("span",{children:o.label||a})}),E("td",{colSpan:o.shouldHideLabel?2:1,className:$("meta-value-wrapper"),"data-value":pN(o,i),children:a==="tags"?E(ps,{searchQuery:n,tags:o.value,alwaysShow:!0}):E(hs,{data:o,searchQuery:n})})]},a)})})})):null});var _t="kanban-plugin";var gk=`**${R("Complete")}**`,yk="***",dg=["---","",`${_t}: board`,"","---","",""].join(`
+`);function vk(e){return["","","%% kanban:settings","```",JSON.stringify(e.data.settings),"```","%%"].join(`
+`)}function wk(e,t){let r=e.data.metadata.fileMetadata,{titleSearchRaw:n}=e.data,i=[n];if(r){let a=Object.keys(r).filter(o=>{var s;return(s=e.data.metadata.fileMetadataOrder)==null?void 0:s.includes(o)});if(a.length){let o=In(a,t),s=In(a.map(u=>r[u]),t);o&&i.push(o),s&&i.push(s)}}return e.data.metadata.time?(i.push(e.data.metadata.time.format("LLLL")),i.push(In(e.data.metadata.time,t))):e.data.metadata.date&&(i.push(e.data.metadata.date.format("LLLL")),i.push(In(e.data.metadata.date,t))),i.join(" ").toLocaleLowerCase()}function yN(e,t,r){var n,i,a;if(e.plugins.enabledPlugins.has("dataview")&&((a=(i=(n=e.plugins)==null?void 0:n.plugins)==null?void 0:i.dataview)!=null&&a.api))return e.plugins.plugins.dataview.api.page(t.path,r.path)}function mk(e,t){if(!e)return null;if(e[t])return e[t];let r=t.split("."),n=e;for(let i of r)if(typeof n=="object"&&i in n)n=n[i];else{n=null;break}return n}function fg(e,t){let r=e.getSetting("metadata-keys");if(!r.length)return{};if(!t)return{};let n=e.app.metadataCache.getFileCache(t),i=yN(e.app,t,e.file);if(!n&&!i)return{};let a={},o={},s={},u=[],l=!1;return r.forEach(c=>{var h;if(s[c.metadataKey])return;if(s[c.metadataKey]=!0,c.metadataKey==="tags"){let g=(n==null?void 0:n.tags)||[];if(Array.isArray((h=n==null?void 0:n.frontmatter)==null?void 0:h.tags)&&(g=[].concat(g,n.frontmatter.tags.map(y=>({tag:`#${y}`})))),(g==null?void 0:g.length)===0)return;u.push(c.metadataKey),a.tags={...c,value:g.map(y=>y.tag).filter(y=>o[y]?!1:(o[y]=!0,!0)).sort(fr)},l=!0;return}let d=mk(i,c.metadataKey),m=mk(n==null?void 0:n.frontmatter,c.metadataKey);if(m!=null&&m!==""&&!(Array.isArray(m)&&m.length===0)){if(typeof m=="string"){if(/^\d{4}-\d{2}-\d{2}/.test(m))m=(0,pk.moment)(m);else if(/^\[\[[^\]]+\]\]$/.test(m)){let g=(n.frontmatterLinks||[]).find(y=>y.key===c.metadataKey);if(g){let y=e.app.metadataCache.getFirstLinkpathDest(g.link,e.file.path);y&&(m=y)}}}else Array.isArray(m)&&(m=m.map((g,y)=>{if(typeof g=="string"&&/^\[\[[^\]]+\]\]$/.test(g)){let v=(n.frontmatterLinks||[]).find(D=>D.key===c.metadataKey+"."+y.toString());if(v){let D=e.app.metadataCache.getFirstLinkpathDest(v.link,e.file.path);if(D)return D}}return g}));u.push(c.metadataKey),a[c.metadataKey]={...c,value:m},l=!0}else if(d!=null&&d!==""&&!(Array.isArray(d)&&d.length===0)){let g=i[c.metadataKey];u.push(c.metadataKey),a[c.metadataKey]={...c,value:g},l=!0}}),{fileMetadata:l?a:void 0,fileMetadataOrder:u}}function bk(e,t){return!e&&t?!0:!["metadata-keys","date-trigger","time-trigger","link-date-to-daily-note","date-format","time-format","move-dates","move-tags","inline-metadata-position","move-task-metadata","hide-card-count","tag-colors","date-colors"].every(n=>e[n]===t[n])}function Dk(e,t){let r=(0,Vl.getDateFromFile)(t,"day");if(!r||!r.isValid())return;e.internalPlugins.plugins["daily-notes"].instance.gotoNextExisting(r)}function Sk(e,t){let r=(0,Vl.getDateFromFile)(t,"day");if(!r||!r.isValid())return;e.internalPlugins.plugins["daily-notes"].instance.gotoPreviousExisting(r)}function ed(e,t){let r=(0,Vl.getDailyNoteSettings)();return e.vault.getConfig("useMarkdownLinks")?`[${t}](${r.folder?`${encodeURIComponent(r.folder)}/`:""}${encodeURIComponent(t)}.md)`:`[[${t}]]`}function Ek(e){if(!e)return!1;let t=e.match(/---\s+([\w\W]+?)\s+---/);return!(!t||!t[1].contains(_t))}function hg(e){var r;if(!e)return!1;let t=app.metadataCache.getFileCache(e);return!!((r=t==null?void 0:t.frontmatter)!=null&&r[_t])}function cd(e,t){return t?`${e} (${t})`:e}function od(e,t,r,n,i){return e.document.body.createDiv({cls:`${$("date-picker")} ${$("ignore-click-outside")}`},a=>{a.style.left=`${r.x||0}px`,a.style.top=`${r.y||0}px`,a.createEl("input",{type:"text"},o=>{a.win.setTimeout(()=>{let s=null,u=d=>{d.target instanceof d.view.HTMLElement&&d.target.closest(`.${$("date-picker")}`)===null&&c()},l=d=>{d.key==="Escape"&&c()},c=()=>{s.destroy(),a.remove(),e.document.body.removeEventListener("click",u),e.document.removeEventListener("keydown",l)};s=Qc(o,{locale:zc(t),defaultDate:i,inline:!0,onChange:d=>{n(d),c()},win:e}),a.win.setTimeout(()=>{let d=a.clientHeight,m=a.clientWidth;r.y+d>e.innerHeight&&(a.style.top=`${(r.y||0)-d}px`),r.x+m>e.innerWidth&&(a.style.left=`${(r.x||0)-m}px`)}),e.document.body.addEventListener("click",u),e.document.addEventListener("keydown",l)})})})}function sd({stateManager:e,boardModifiers:t,item:r,hasDate:n,path:i}){let a=e.getSetting("date-format"),o=e.getSetting("link-date-to-daily-note"),s=e.getSetting("date-trigger"),u=o?"(?:\\[[^\\]]+\\]\\([^)]+\\)|\\[\\[[^\\]]+\\]\\])":"{[^}]+}",l=new RegExp(`(^|\\s)${Qn(s)}${u}`);return c=>{let d=c[0],m=(0,An.moment)(d).format(a),h=o?ed(e.app,m):`{${m}}`,g=r.data.titleRaw;n?g=r.data.titleRaw.replace(l,`$1${s}${h}`):g=`${r.data.titleRaw} ${s}${h}`,t.updateItem(i,e.updateItemContent(r,g))}}function lg(e){let t=e.getSetting("time-format"),r=[];for(let n=0;n<24;n++)r.push((0,An.moment)({hour:n}).format(t)),r.push((0,An.moment)({hour:n,minute:15}).format(t)),r.push((0,An.moment)({hour:n,minute:30}).format(t)),r.push((0,An.moment)({hour:n,minute:45}).format(t));return r}function ld(e,t,r,n,i){let a=$("time-picker"),o=t.getSetting("time-format"),s=i==null?void 0:i.format(o);e.document.body.createDiv({cls:`${a} ${$("ignore-click-outside")}`},u=>{let l=lg(t),c=v=>{v.target instanceof v.view.HTMLElement&&v.target.hasClass($("time-picker-item"))&&v.target.dataset.value&&(n(v.target.dataset.value),h())},d=v=>{v.target instanceof v.view.HTMLElement&&v.target.closest(`.${a}`)===null&&h()},m=v=>{v.key==="Escape"&&h()},h=()=>{u.remove(),u.removeEventListener("click",c),e.document.body.removeEventListener("click",d),e.document.removeEventListener("keydown",m)};u.style.left=`${r.x||0}px`,u.style.top=`${r.y||0}px`;let g=null,y=null;l.forEach((v,D)=>{let I=v===s;u.createDiv({cls:`${$("time-picker-item")} ${I?"is-selected":""}`,text:v},C=>{C.createEl("span",{cls:$("time-picker-check"),prepend:!0},x=>{(0,An.setIcon)(x,"lucide-check")}),D%4===0&&C.addClass("is-hour"),C.dataset.value=v,I&&(g=C),D===Math.floor(l.length/2)&&(y=C)})}),u.win.setTimeout(()=>{var I;let v=u.clientHeight,D=u.clientWidth;r.y+v>e.innerHeight&&(u.style.top=`${(r.y||0)-v}px`),r.x+D>e.innerWidth&&(u.style.left=`${(r.x||0)-D}px`),(I=g||y)==null||I.scrollIntoView({block:"center",inline:"nearest"}),u.addEventListener("click",c),e.document.body.addEventListener("click",d),e.document.addEventListener("keydown",m)})})}function ud({stateManager:e,boardModifiers:t,item:r,hasTime:n,path:i}){let a=e.getSetting("time-trigger"),o=new RegExp(`(^|\\s)${Qn(a)}{([^}]+)}`);return s=>{let u=r.data.titleRaw;n?u=r.data.titleRaw.replace(o,`$1${a}{${s}}`):u=`${r.data.titleRaw} ${a}{${s}}`,t.updateItem(i,e.updateItemContent(r,u))}}function xk(e){let t=e.data.metadata.date,r=[];t&&(t.isSame(new Date,"day")&&r.push("is-today"),t.isAfter(new Date,"day")&&r.push("is-future"),t.isBefore(new Date,"day")&&r.push("is-past")),e.data.checked&&e.data.checkChar===Zn()&&r.push("is-complete");for(let n of e.data.metadata.tags)r.push(`has-tag-${n.slice(1)}`);return r}function uo(e,t,r,n){return e.app.fileManager.generateMarkdownLink(t,r,n)}function vN(e){return(0,An.htmlToMarkdown)(e)}function wN(e){return e.replace(/^\[(.*)\]\(app:\/\/obsidian.md\/(.*)\)$/,"[$1]($2)")}function bN(e){var r;let t=e.require("electron").remote.clipboard;if(process.platform==="darwin"){if(t.has("NSFilenamesPboardType"))return((r=t.read("NSFilenamesPboardType").match(/.*<\/string>/g))==null?void 0:r.map(n=>n.replace(/|<\/string>/g,"")))||[];{let n=t.readImage("clipboard");return n.isEmpty()?[t.read("public.file-url").replace("file://","")].filter(i=>i):[{buffer:n.toPNG(),mimeType:"image/png",originalName:`Pasted image ${(0,An.moment)().format("YYYYMMDDHHmmss")}.png`}]}}else if(t.has("CF_HDROP")){let n=t.read("CF_HDROP")||"",i=[...n].filter((o,s)=>n.charCodeAt(s)!==0).join("").replace(/\\/g,"\\"),a=i.match(/[a-zA-Z]:\\/);if(a){let o=i.indexOf(a[0]);return o!==0&&(i=i.slice(o)),i.split(a[0]).filter(s=>s).map(s=>a+s)}}else{let n=t.readImage("clipboard");return n.isEmpty()?[t.readBuffer("FileNameW").toString("ucs2").replace(RegExp("\0","g"),"")].filter(i=>i):[{buffer:n.toPNG(),mimeType:"image/png",originalName:`Pasted image ${(0,An.moment)().format("YYYYMMDDHHmmss")}.png`}]}return null}function DN(e){return e.split("\\").pop().split("/").pop()}async function SN(e,t,r,n){let i=await e.app.vault.getAvailablePathForAttachments(t,r,e.file),a=await e.app.vault.createBinary(i,n);return uo(e,a,e.file.path)}async function EN(e,t){let r=bN(t);if(!r||r.length===0)return null;let n=t.require("fs/promises"),i=t.require("path");return(await Promise.all(r.map(async a=>{if(typeof a=="string"){let s=DN(a).split("."),u=s.pop(),l=s.join("."),c=await e.app.vault.getAvailablePathForAttachments(l,u,e.file),d=e.app.vault.adapter.basePath;await n.copyFile(a,i.join(d,c)),await new Promise(h=>t.setTimeout(h,50));let m=e.app.vault.getAbstractFileByPath(c);return uo(e,m,e.file.path)}else{let o=a.originalName.split("."),s=o.pop(),u=o.join(".");return await SN(e,u,s,a.buffer)}}))).filter(a=>a)}function kk(e,t,r){return Promise.all(t.map(n=>{let i=n.name.split("."),a=i.pop(),o=i.join(".");if(r){switch(n.type){case"text/jpg":a="jpg";break;case"text/jpeg":a="jpeg";break;case"text/png":a="png";break}o="Pasted image "+(0,An.moment)().format("YYYYMMDDHHmmss")}return new Promise((s,u)=>{let l=new FileReader;l.onload=async c=>{try{let d=await e.app.vault.getAvailablePathForAttachments(o,a,e.file),m=await e.app.vault.createBinary(d,c.target.result);s(uo(e,m,e.file.path))}catch(d){console.error(d),u(d)}},l.readAsArrayBuffer(n)})}))}async function kN(e,t,r){let n=!t.view,i=n?e.getAView().isShiftPressed:!1,a=n?t.clipboardData:t.dataTransfer,o=n&&An.Platform.isDesktopApp?r.require("electron").remote.clipboard:null,s=o?o.availableFormats():[];if(n){if(n&&!i&&!s.includes("text/rtf")){if(An.Platform.isDesktopApp){let g=await EN(e,r);if(g!=null&&g.length)return g}let m=[],h=t.clipboardData.items;for(let g in h){let y=h[g];y.kind==="file"&&m.push(y.getAsFile())}if(m.length)return await kk(e,m,!0)}}else{let m=await Jh(t);if(m.length)return await kk(e,m)}let u=a.getData("text/html"),l=a.getData("text/plain"),c=a.getData("text/uri-list"),d=i?l||u:vN(u);return[wN(d||c||l||u||"").trim()]}async function Ck(e,t,r){let n=e.app.dragManager.draggable,i=t.view?t.dataTransfer:t.clipboardData;switch(n==null?void 0:n.type){case"file":return[uo(e,n.file,e.file.path)];case"files":return n.files.map(a=>uo(e,a,e.file.path));case"folder":return n.file.children.map(a=>a instanceof An.TFolder?null:uo(e,a,e.file.path)).filter(a=>a);case"link":{let a=n.file?uo(e,n.file,(0,An.parseLinktext)(n.linktext).subpath):`[[${n.linktext}]]`,o=new DOMParser().parseFromString(i.getData("text/html"),"text/html").documentElement.textContent;return a=a.replace(/]]$/,`|${o}]]`).replace(/^\[[^\]].+]\(/,`[${o}](`),[a]}default:return await kN(e,t,r)}}function dd(e,t){let r,n,i=(...a)=>{r=a,!n&&(n=e.requestAnimationFrame(()=>{n=null,t(...r)}))};return i.cancel=()=>{n&&(e.cancelAnimationFrame(n),n=null)},i}var Tk={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"};var gs={outOfTheWay:200,minDropTime:330,maxDropTime:550},Ma=`${gs.outOfTheWay}ms ${Tk.outOfTheWay}`;var Lr={none:"none",fluid:`opacity ${Ma}`,snap:`transform ${Ma}, opacity ${Ma}`,drop:e=>{let t=`${e}ms ${Tk.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Ma}`,placeholder:`height ${Ma}, width ${Ma}, margin ${Ma}, border-color ${Ma}`},xN=(e,t)=>e.x===t.x&&e.y===t.y,CN={x:0,y:0},_k=e=>xN(e,CN)?void 0:`translate(${e.x}px, ${e.y}px)`,Fk={moveTo:_k,drop:e=>_k(e)},_N=gs.maxDropTime-gs.minDropTime,Mk=1500,MN=.6;function ys({position:e,destination:t,isCancel:r}){let n=qa(e,t);if(n<=0)return gs.minDropTime;if(n>=Mk)return gs.maxDropTime;let i=n/Mk,a=gs.minDropTime+_N*i,o=r?a*MN:a;return Math.round(o)}function ui(e,t,r){e.style.getPropertyValue(t)!==r&&e.style.setProperty(t,r)}function fd(e,t){e.style.getPropertyValue(t)&&e.style.removeProperty(t)}function mg(e,t,r,n,i){let a="htmldnd",o=et(),s=e-75,u=e+75,l=t-25,c=t+25;return{scopeId:a,entityId:`${a}-${o}`,initial:[s,l,u,c],getParentScrollState(){return Tr},getParentScrollShift(){return vi},recalcInitial(){},getHitbox(){return this.initial},getPath(){return[]},getData(){return{viewId:n,type:ft.Item,id:o,content:r,accepts:[],win:i}}}}var hd=class{constructor(t,r,n,i){this.isHTMLDragging=!1;this.dragOverTimeout=0;this.win=t,this.hitboxEntities=n,this.scrollEntities=i,this.emitter=r}getDragEventData(){return{dragEntity:this.dragEntity,dragEntityId:this.dragEntityId,dragEntityMargin:this.dragEntityMargin,dragOrigin:this.dragOrigin,dragOriginHitbox:this.dragOriginHitbox,dragPosition:this.dragPosition,primaryIntersection:this.primaryIntersection,scrollIntersection:this.scrollIntersection}}dragStart(t,r){var a;let n=(r==null?void 0:r.dataset.hitboxid)||t.currentTarget.dataset.hitboxid;if(!n)return;let i=getComputedStyle(r||t.currentTarget);this.dragEntityId=n,this.dragOrigin={x:t.pageX,y:t.pageY},this.dragPosition={x:t.pageX,y:t.pageY},this.dragEntity=this.hitboxEntities.get(n),this.dragOriginHitbox=(a=this.dragEntity)==null?void 0:a.getHitbox(),this.dragEntityMargin=[parseFloat(i.marginLeft)||0,parseFloat(i.marginTop)||0,parseFloat(i.marginRight)||0,parseFloat(i.marginBottom)||0],this.emitter.emit("dragStart",this.getDragEventData())}dragStartHTML(t,r){this.isHTMLDragging=!0;let n=mg(t.pageX,t.pageY,[],r,t.view);this.dragEntityId=n.entityId,this.dragOrigin={x:t.pageX,y:t.pageY},this.dragPosition={x:t.pageX,y:t.pageY},this.dragEntity=n,this.dragOriginHitbox=n.getHitbox(),this.dragEntityMargin=[0,0,0,0],this.emitter.emit("dragStart",this.getDragEventData())}dragMove(t){this.dragPosition={x:t.pageX,y:t.pageY},this.emitter.emit("dragMove",this.getDragEventData()),this.calculateDragIntersect()}dragMoveHTML(t){this.dragPosition={x:t.pageX,y:t.pageY},this.emitter.emit("dragMove",this.getDragEventData()),this.calculateDragIntersect()}dragEnd(t){this.emitter.emit("dragEnd",this.getDragEventData()),this.dragEntityMargin=void 0,this.dragEntity=void 0,this.dragEntityId=void 0,this.dragOrigin=void 0,this.dragOriginHitbox=void 0,this.dragPosition=void 0,this.scrollIntersection=void 0,this.primaryIntersection=void 0}dragEndHTML(t,r,n,i){this.isHTMLDragging=!1,i||(this.dragEntity=mg(t.pageX,t.pageY,n,r,t.view),this.emitter.emit("dragEnd",this.getDragEventData())),this.dragEntityMargin=void 0,this.dragEntity=void 0,this.dragEntityId=void 0,this.dragOrigin=void 0,this.dragOriginHitbox=void 0,this.dragPosition=void 0,this.scrollIntersection=void 0,this.primaryIntersection=void 0,i&&this.emitter.emit("dragEnd",this.getDragEventData())}onHTMLDragLeave(t){this.win.clearTimeout(this.dragOverTimeout),this.dragOverTimeout=this.win.setTimeout(t,351)}calculateDragIntersect(){if(!this.dragEntity||!this.dragPosition||!this.dragOrigin||!this.dragOriginHitbox)return;let{type:t,win:r}=this.dragEntity.getData(),n=[],i=[],a=[],o=[];if(this.hitboxEntities.forEach(l=>{var d;let c=l.getData();r===c.win&&(c.accepts.includes(t)||(d=c.acceptsSort)!=null&&d.includes(t))&&(n.push(l),i.push(l.getHitbox()))}),this.scrollEntities.forEach(l=>{let c=l.getData();r===c.win&&c.accepts.includes(t)&&(a.push(l),o.push(l.getHitbox()))}),n.length===0&&a.length===0)return;let s=Mb(this.dragOriginHitbox,this.dragOrigin,this.dragPosition);this.handleScrollIntersect(s,this.dragEntity,o,a)||this.handleHitboxIntersect(s,this.dragEntity,i,n)}handleScrollIntersect(t,r,n,i){let a=(0,pg.default)([t],n).map(s=>i[s[1]]),o=_b(a,t,r);if(this.scrollIntersection&&(!o||o[0]!==this.scrollIntersection[0])){let[s,u]=this.scrollIntersection,l=s.getData(),c=s.entityId,d=l.side;this.emitter.emit("endDragScroll",{...this.getDragEventData(),scrollEntity:s,scrollEntityId:c,scrollEntitySide:d,scrollStrength:u},c),this.scrollIntersection=void 0}if(o&&(!this.scrollIntersection||this.scrollIntersection[0]!==o[0])){let[s,u]=o,l=s.getData(),c=s.entityId,d=l.side;this.emitter.emit("beginDragScroll",{...this.getDragEventData(),scrollEntity:s,scrollEntityId:c,scrollEntitySide:d,scrollStrength:u},c),this.scrollIntersection=o}else if(o&&this.scrollIntersection&&o[0]===this.scrollIntersection[0]){let[s,u]=o,l=s.getData(),c=s.entityId,d=l.side;this.emitter.emit("updateDragScroll",{...this.getDragEventData(),scrollEntity:s,scrollEntityId:c,scrollEntitySide:d,scrollStrength:u},c),this.scrollIntersection=o}return!!o}handleHitboxIntersect(t,r,n,i){let a=(0,pg.default)([t],n).map(s=>i[s[1]]),o=Mh(a,t,r);this.primaryIntersection&&this.primaryIntersection!==o&&(this.emitter.emit("dragLeave",this.getDragEventData(),this.primaryIntersection.entityId),this.primaryIntersection=void 0),o&&this.primaryIntersection!==o&&(this.emitter.emit("dragEnter",{...this.getDragEventData(),primaryIntersection:o},o.entityId),this.primaryIntersection=o)}},vs=e=>{e.preventDefault(),e.stopPropagation()};function Ta(e,t){let r=Ee(cn),n=Fe(()=>{});return Ye(i=>{if(t.current!==i&&(n.current(),n.current=()=>{}),!i)return;let a=i,o=u=>{if(u.defaultPrevented||!r||!e.current)return;let l=e.current,c=u.targetNode;for(;c;){if(c.instanceOf(HTMLElement)&&c.dataset.ignoreDrag)return;c=c.parentElement}if(u.button!==0&&u.buttons!==1)return;let d=u.view,m=["pen","touch"].includes(u.pointerType),h=u.pointerId;m||(u.stopPropagation(),u.preventDefault());let g=u,y={x:u.pageX,y:u.pageY},v=!1,D=0;m&&(d.addEventListener("contextmenu",vs,!0),D=d.setTimeout(()=>{r.dragManager.dragStart(g,l),v=!0,d.addEventListener("touchmove",vs,{passive:!1})},500));let I=dd(d,x=>{x.pointerId===h&&(m?v?r.dragManager.dragMove(x):qa(y,{x:x.pageX,y:x.pageY})>5&&(d.clearTimeout(D),d.removeEventListener("touchmove",vs),d.removeEventListener("contextmenu",vs,!0),d.removeEventListener("pointermove",I),d.removeEventListener("pointerup",C),d.removeEventListener("pointercancel",C)):v?r.dragManager.dragMove(x):qa(y,{x:x.pageX,y:x.pageY})>5&&(r.dragManager.dragStart(g,l),v=!0))}),C=x=>{x.pointerId===h&&(d.clearTimeout(D),v=!1,r.dragManager.dragEnd(x),d.removeEventListener("pointermove",I),d.removeEventListener("pointerup",C),d.removeEventListener("pointercancel",C),m&&(d.removeEventListener("contextmenu",vs,!0),d.removeEventListener("touchmove",vs)))};d.addEventListener("pointermove",I),d.addEventListener("pointerup",C),d.addEventListener("pointercancel",C)},s=u=>{u.stopPropagation()};return a.addEventListener("pointerdown",o),a.addEventListener("touchstart",s),()=>{a.removeEventListener("pointerdown",o),a.removeEventListener("touchstart",s)}},[])}function Ik(e){let t=Ee(cn),r=Ye(i=>{t.dragManager.isHTMLDragging?(i.preventDefault(),t.dragManager.dragMoveHTML(i)):t.dragManager.dragStartHTML(i,e.getAView().id),t.dragManager.onHTMLDragLeave(()=>{t.dragManager.dragEndHTML(i,e.getAView().id,[],!0)})},[t,e]),n=Ye(async i=>{t.dragManager.dragEndHTML(i,e.getAView().id,await Ck(e,i,activeWindow),!1)},[t,e]);return{onDragOver:r,onDrop:n}}var Ok=Ct(ln());var Ak=require("obsidian");function Ut({name:e,className:t}){return E("span",{"data-icon":e,className:`${$("icon")} ${t||""}`,ref:r=>{r&&(0,Ak.setIcon)(r,e)}})}var md=zt(function({shouldMarkItemsComplete:t,path:r,item:n,stateManager:i,boardModifiers:a}){let o=i.useSetting("show-checkboxes"),[s,u]=Ne(!1),[l,c]=Ne(!1),d=Ye(()=>{let m=Ro(n,i.file);if(m){let[h,g,y]=m,v=h.map((D,I)=>{let C=i.getNewItem(D,g[I]);return I===y&&(C.id=n.id),C});a.replaceItem(r,v)}else a.updateItem(r,(0,Ok.default)(n,{data:{checkChar:{$apply:h=>h===" "?Zn():" "},$toggle:["checked"]}}))},[n,i,a,...r]);return Ae(()=>{if(l){let m=h=>{h.metaKey||h.ctrlKey?u(!0):u(!1)};return activeWindow.addEventListener("keydown",m),activeWindow.addEventListener("keyup",m),()=>{activeWindow.removeEventListener("keydown",m),activeWindow.removeEventListener("keyup",m)}}},[l]),t||o?E("div",{onMouseEnter:m=>{c(!0),(m.ctrlKey||m.metaKey)&&u(!0)},onMouseLeave:()=>{c(!1),s&&u(!1)},className:$("item-prefix-button-wrapper"),children:[o&&!s&&E("input",{onChange:d,type:"checkbox",className:"task-list-item-checkbox",checked:n.data.checked,"data-task":n.data.checkChar}),(s||!o&&t)&&E("a",{onClick:()=>{a.archiveItem(r)},className:`${$("item-prefix-button")} clickable-icon`,"aria-label":s?void 0:"Archive card",children:E(Ut,{name:"sheets-in-box"})})]}):null});var Lk=Ct(ln()),pd=require("obsidian");var TN=/[\\/:"*?<>|]+/g,FN=/!?\[\[([^\]]*)\.[^\]]+\]\]/g,IN=/!?\[\[([^\]]*)\]\]/g,AN=/!?\[([^\]]*)\]\([^)]*\)/g,ON=/#([^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~[\]\\\s\n\r]+)/g,LN=/\s+/g;function gd({setEditState:e,item:t,path:r,boardModifiers:n,stateManager:i}){return Ye(a=>{let o={x:a.clientX,y:a.clientY},s=!!t.data.metadata.date,u=!!t.data.metadata.time,l=new pd.Menu().addItem(d=>{d.setIcon("lucide-edit").setTitle(R("Edit card")).onClick(()=>e(o))});l.addItem(d=>{d.setIcon("lucide-file-plus-2").setTitle(R("New note from card")).onClick(async()=>{let m=t.data.titleRaw.split(`
+`)[0].trim(),h=m.replace(FN,"$1").replace(IN,"$1").replace(AN,"$1").replace(ON,"$1").replace(TN," ").trim().replace(LN," "),g=i.getSetting("new-note-folder"),y=i.getSetting("new-note-template"),v=g?i.app.vault.getAbstractFileByPath(g):i.app.fileManager.getNewFileParent(i.file.path),D=await i.app.fileManager.createNewMarkdownFile(v,h),I=i.app.workspace.splitActiveLeaf();await I.openFile(D),i.app.workspace.setActiveLeaf(I,!1,!0),await yb(i,y);let C=t.data.titleRaw.replace(m,i.app.fileManager.generateMarkdownLink(D,i.file.path));n.updateItem(r,i.updateItemContent(t,C))})}).addItem(d=>{d.setIcon("lucide-link").setTitle(R("Copy link to card")).onClick(()=>{if(t.data.blockId)navigator.clipboard.writeText(`${this.app.fileManager.generateMarkdownLink(i.file,"","#^"+t.data.blockId)}`);else{let m=et(6);navigator.clipboard.writeText(`${this.app.fileManager.generateMarkdownLink(i.file,"","#^"+m)}`),n.updateItem(r,i.updateItemContent((0,Lk.default)(t,{data:{blockId:{$set:m}}}),t.data.titleRaw))}})}).addSeparator(),/\n/.test(t.data.titleRaw)&&l.addItem(d=>{d.setIcon("lucide-wrap-text").setTitle(R("Split card")).onClick(async()=>{let m=t.data.titleRaw.split(/[\r\n]+/g).map(g=>g.trim()),h=await Promise.all(m.map(g=>i.getNewItem(g," ")));n.splitItem(r,h)})}),l.addItem(d=>{d.setIcon("lucide-copy").setTitle(R("Duplicate card")).onClick(()=>n.duplicateEntity(r))}).addItem(d=>{d.setIcon("lucide-list-start").setTitle(R("Insert card before")).onClick(()=>n.insertItems(r,[i.getNewItem(""," ",!0)]))}).addItem(d=>{d.setIcon("lucide-list-end").setTitle(R("Insert card after")).onClick(()=>{let m=[...r];m[m.length-1]=m[m.length-1]+1,n.insertItems(m,[i.getNewItem(""," ",!0)])})}).addItem(d=>{d.setIcon("lucide-arrow-up").setTitle(R("Move to top")).onClick(()=>n.moveItemToTop(r))}).addItem(d=>{d.setIcon("lucide-arrow-down").setTitle(R("Move to bottom")).onClick(()=>n.moveItemToBottom(r))}).addItem(d=>{d.setIcon("lucide-archive").setTitle(R("Archive card")).onClick(()=>n.archiveItem(r))}).addItem(d=>{d.setIcon("lucide-trash-2").setTitle(R("Delete card")).onClick(()=>n.deleteEntity(r))}).addSeparator().addItem(d=>{d.setIcon("lucide-calendar-check").setTitle(s?R("Edit date"):R("Add date")).onClick(()=>{var m;od(a.view,i,o,sd({stateManager:i,boardModifiers:n,item:t,hasDate:s,path:r}),(m=t.data.metadata.date)==null?void 0:m.toDate())})}),s&&(l.addItem(d=>{d.setIcon("lucide-x").setTitle(R("Remove date")).onClick(()=>{let m=i.getSetting("link-date-to-daily-note"),h=i.getSetting("date-trigger"),g=m?"(?:\\[[^\\]]+\\]\\([^\\)]+\\)|\\[\\[[^\\]]+\\]\\])":"{[^}]+}",y=new RegExp(`(^|\\s)${Qn(h)}${g}`),v=t.data.titleRaw.replace(y,"").trim();n.updateItem(r,i.updateItemContent(t,v))})}),l.addItem(d=>{d.setIcon("lucide-clock").setTitle(u?R("Edit time"):R("Add time")).onClick(()=>{ld(a.view,i,o,ud({stateManager:i,boardModifiers:n,item:t,hasTime:u,path:r}),t.data.metadata.time)})}),u&&l.addItem(d=>{d.setIcon("lucide-x").setTitle(R("Remove time")).onClick(()=>{let m=i.getSetting("time-trigger"),h=new RegExp(`(^|\\s)${Qn(m)}{([^}]+)}`),g=t.data.titleRaw.replace(h,"").trim();n.updateItem(r,i.updateItemContent(t,g))})})),l.addSeparator();let c=d=>{let m=i.state.children;if(!(m.length<=1))for(let h=0,g=m.length;hy.setIcon("lucide-square-kanban").setChecked(r[0]===h).setTitle(m[h].data.title).onClick(()=>{r[0]!==h&&i.setState(v=>Ri(v,r,[h,0]))}))};pd.Platform.isPhone?c(l):l.addItem(d=>{let m=d.setTitle(R("Move to list")).setIcon("lucide-square-kanban").setSubmenu();c(m)}),l.showAtPosition(o)},[e,t,r,n,i])}var Pk=$e.memo(function({editState:t,setEditState:r,showMenu:n}){let i=$e.useMemo(()=>t?{"data-ignore-drag":!0}:{},[t]);return E("div",{...i,className:$("item-postfix-button-wrapper"),children:kn(t)?E("a",{"data-ignore-drag":!0,onPointerDown:a=>a.preventDefault(),onClick:()=>r(0),className:`${$("item-postfix-button")} is-enabled clickable-icon`,"aria-label":R("Cancel"),children:E(Ut,{name:"lucide-x"})}):E("a",{"data-ignore-drag":!0,onPointerDown:a=>a.preventDefault(),onClick:n,className:`${$("item-postfix-button")} clickable-icon`,"aria-label":R("More options"),children:E(Ut,{name:"lucide-more-vertical"})})})});var Nk=zt(function({item:t,shouldMarkItemsComplete:r,isMatch:n,searchQuery:i,isStatic:a}){let{stateManager:o,boardModifiers:s}=Ee(tt),[u,l]=Ne(0),c=Ee(cn);Ae(()=>{let v=()=>{kn(u)&&l(0)};return c.dragManager.emitter.on("dragStart",v),()=>{c.dragManager.emitter.off("dragStart",v)}},[c,u]),Ae(()=>{t.data.forceEditMode&&l({x:0,y:0})},[t.data.forceEditMode]);let d=Ui(),m=gd({boardModifiers:s,item:t,setEditState:l,stateManager:o,path:d}),h=Ye(v=>{kn(u)||v.targetNode.instanceOf(HTMLAnchorElement)&&(v.targetNode.hasClass("internal-link")||v.targetNode.hasClass("external-link"))||m(v)},[m,u]),g=Ye(v=>l({x:v.clientX,y:v.clientY}),[l]),y=Re(()=>kn(u)?{"data-ignore-drag":!0}:{},[u]);return E("div",{onDblClick:g,onContextMenu:h,className:$("item-content-wrapper"),...y,children:[E("div",{className:$("item-title-wrapper"),...y,children:[E(md,{boardModifiers:s,item:t,path:d,shouldMarkItemsComplete:r,stateManager:o}),E(ad,{item:t,searchQuery:n?i:void 0,setEditState:l,editState:u,isStatic:a}),E(Pk,{editState:u,setEditState:l,showMenu:m})]}),E(fk,{searchQuery:n?i:void 0,item:t})]})}),gg=zt(function(t){let r=Fe(null),n=Fe(null),i=Ee(zn),{itemIndex:a,...o}=t,s=Ta(n,n),u=i!=null&&i.query?o.item.data.titleSearch.includes(i.query):!1,l=xk(o.item);return E("div",{ref:c=>{n.current=c,s(c)},className:$("item-wrapper"),children:E("div",{ref:r,className:Ge([$("item"),...l]),children:t.isStatic?E(Nk,{...o,isMatch:u,searchQuery:i==null?void 0:i.query,isStatic:!0}):E(ei,{elementRef:r,measureRef:n,id:t.item.id,index:a,data:t.item,children:E(Nk,{...o,isMatch:u,searchQuery:i==null?void 0:i.query})})})})}),Rk=zt(function({isStatic:t,items:r,shouldMarkItemsComplete:n}){let i=Ee(zn),{view:a}=Ee(tt),o=a.useViewState(_t);return E(ct,{children:r.map((s,u)=>i!=null&&i.query&&!i.items.has(s)?null:E(gg,{item:s,itemIndex:u,shouldMarkItemsComplete:n,isStatic:t},o+s.id))})});var PN=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(c){try{l(n.next(c))}catch(d){o(d)}}function u(c){try{l(n.throw(c))}catch(d){o(d)}}function l(c){c.done?a(c.value):i(c.value).then(s,u)}l((n=n.apply(e,t||[])).next())})};function yd(e){let t=0,r=0,n=e;do t+=n.offsetTop||0,r+=n.offsetLeft||0,n=n.offsetParent;while(n);return{top:t,left:r}}var yg=class{constructor(t){this.element=t}getHorizontalScroll(){return this.element.scrollLeft}getVerticalScroll(){return this.element.scrollTop}getMaxHorizontalScroll(){return this.element.scrollWidth-this.element.clientWidth}getMaxVerticalScroll(){return this.element.scrollHeight-this.element.clientHeight}getHorizontalElementScrollOffset(t,r){return yd(t).left-yd(r).left}getVerticalElementScrollOffset(t,r){return yd(t).top-yd(r).top}scrollTo(t,r){this.element.scrollLeft=t,this.element.scrollTop=r}},vg=class{constructor(){this.element=window}getHorizontalScroll(){return window.scrollX||document.documentElement.scrollLeft}getVerticalScroll(){return window.scrollY||document.documentElement.scrollTop}getMaxHorizontalScroll(){return Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth)-window.innerWidth}getMaxVerticalScroll(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)-window.innerHeight}getHorizontalElementScrollOffset(t){return(window.scrollX||document.documentElement.scrollLeft)+t.getBoundingClientRect().left}getVerticalElementScrollOffset(t){return(window.scrollY||document.documentElement.scrollTop)+t.getBoundingClientRect().top}scrollTo(t,r){window.scrollTo(t,r)}},Ji={elements:[],cancelMethods:[],add:(e,t)=>{Ji.elements.push(e),Ji.cancelMethods.push(t)},remove:(e,t)=>{let r=Ji.elements.indexOf(e);r>-1&&(t&&Ji.cancelMethods[r](),Ji.elements.splice(r,1),Ji.cancelMethods.splice(r,1))}},Hk=typeof window!="undefined",NN={cancelOnUserAction:!0,easing:e=>--e*e*e+1,elementToScroll:Hk?window:null,horizontalOffset:0,maxDuration:3e3,minDuration:250,speed:500,verticalOffset:0};function RN(e,t={}){return PN(this,void 0,void 0,function*(){if(Hk){if(!window.Promise)throw"Browser doesn't support Promises, and animated-scroll-to depends on it, please provide a polyfill."}else return new Promise(x=>{x(!1)});let r,n,i,a=Object.assign(Object.assign({},NN),t),o=a.elementToScroll===window,s=!!a.elementToScroll.nodeName;if(!o&&!s)throw"Element to scroll needs to be either window or DOM element.";let u=o?document.documentElement:a.elementToScroll;getComputedStyle(u).getPropertyValue("scroll-behavior")==="smooth"&&console.warn(`${u.tagName} has "scroll-behavior: smooth" which can mess up with animated-scroll-to's animations`);let c=o?new vg:new yg(a.elementToScroll);if(e instanceof Element){if(i=e,s&&(!a.elementToScroll.contains(i)||a.elementToScroll.isSameNode(i)))throw"options.elementToScroll has to be a parent of scrollToElement";r=c.getHorizontalElementScrollOffset(i,a.elementToScroll),n=c.getVerticalElementScrollOffset(i,a.elementToScroll)}else if(typeof e=="number")r=c.getHorizontalScroll(),n=e;else if(Array.isArray(e)&&e.length===2)r=e[0]===null?c.getHorizontalScroll():e[0],n=e[1]===null?c.getVerticalScroll():e[1];else throw`Wrong function signature. Check documentation.
+Available method signatures are:
+ animateScrollTo(y:number, options)
+ animateScrollTo([x:number | null, y:number | null], options)
+ animateScrollTo(scrollToElement:Element, options)`;r+=a.horizontalOffset,n+=a.verticalOffset;let d=c.getMaxHorizontalScroll(),m=c.getHorizontalScroll();r>d&&(r=d);let h=r-m,g=c.getMaxVerticalScroll(),y=c.getVerticalScroll();n>g&&(n=g);let v=n-y,D=Math.abs(Math.round(h/1e3*a.speed)),I=Math.abs(Math.round(v/1e3*a.speed)),C=D>I?D:I;return Ca.maxDuration&&(C=a.maxDuration),new Promise((x,O)=>{h===0&&v===0&&x(!0),Ji.remove(c.element,!0);let A,P=()=>{oe(),activeWindow.cancelAnimationFrame(A),x(!1)};Ji.add(c.element,P);let B=ne=>ne.preventDefault(),G=a.cancelOnUserAction?P:B,J=a.cancelOnUserAction?{passive:!0}:{passive:!1},Q=["wheel","touchstart","keydown","mousedown"],oe=()=>{Q.forEach(ne=>{c.element.removeEventListener(ne,G,J)})};Q.forEach(ne=>{c.element.addEventListener(ne,G,J)});let te=Date.now(),re=()=>{var ne=Date.now()-te,be=ne/C;let pe=Math.round(m+h*a.easing(be)),De=Math.round(y+v*a.easing(be));nenew Vo,[]);return E(sl.Provider,{value:t,children:e})}function Vk(e,t){let r=$e.useContext(ma),n=$e.useRef(null),i=$e.useContext(sl),a=o=>{n.current=o,n.current&&o.win.requestAnimationFrame(()=>{let s=i.getScrollState(e);s&&(s.x!==0||s.y!==0)&&(n.current.scrollLeft=s.x,n.current.scrollTop=s.y)})};return $e.useEffect(()=>{let o=n.current;if(!o)return;let s=dd(o.win,u=>{let l=u.target;i.setScrollState(r,e,{x:l.scrollLeft,y:l.scrollTop})});return o.addEventListener("scroll",s),()=>{o.removeEventListener("scroll",s)}},[i,e,t]),{setRef:a,scrollRef:n}}var HN="scroll-container",wd=8,bd=["top","right","bottom","left"],Dd=class{constructor(t,r,n,i){this.scrollFrame=0;this.observerQueue=[];this.onScroll=()=>{this.activeScroll.size===0&&(this.scrollState=Th(this.scrollEl),this.handleEntityRegistration())};this.onDragEnd=()=>{this.activeScroll.clear()};this.handleBeginDragScroll=({scrollEntitySide:t,scrollStrength:r})=>{this.isDoneScrolling(t)||(this.activeScroll.set(t,r),this.handleDragScroll())};this.handleUpdateDragScroll=({scrollEntitySide:t,scrollStrength:r})=>{this.isDoneScrolling(t)||this.activeScroll.set(t,r)};this.handleEndDragScroll=({scrollEntitySide:t})=>{this.activeScroll.delete(t)};this.dndManager=t,this.instanceId=et(),this.scopeId=r,this.triggerTypes=n,this.scrollState=Tr,this.parent=i,this.activeScroll=new Map,this.observerHandlers=new Map}initNodes(t){this.scrollEl=t,this.scrollEl.dataset.hitboxid=this.instanceId,this.scrollEl.dataset.scrollid=this.instanceId,this.top=this.createScrollEntity("top"),this.right=this.createScrollEntity("right"),this.bottom=this.createScrollEntity("bottom"),this.left=this.createScrollEntity("left"),this.bindScrollHandlers(),this.observer=new IntersectionObserver(n=>{n.forEach(i=>{var o;let a=(o=i.target.dataset)==null?void 0:o.hitboxid;if(a&&this.observerHandlers.has(a)){let s=this.observerHandlers.get(a);s&&s(i)}})},{root:t,threshold:.1});let{observerQueue:r}=this;this.observerQueue=[],r.forEach(([n,i,a])=>{this.observerHandlers.set(n,a),this.observer.observe(i)}),this.scrollEl.addEventListener("scroll",this.onScroll,{passive:!0,capture:!1}),this.dndManager.emitter.on("scrollResize",this.onScroll),this.scrollEl.win.setTimeout(()=>this.onScroll()),this.dndManager.observeResize(this.scrollEl),this.parent?this.parent.registerObserverHandler(this.instanceId,this.scrollEl,n=>{n.isIntersecting?this.handleEntityRegistration():this.handleEntityUnregistration()}):this.handleEntityRegistration()}destroy(){var t;!this.scrollEl&&!this.observer||(this.observerQueue.length=0,this.handleEntityUnregistration(),this.observer.disconnect(),this.unbindScrollHandlers(),this.scrollEl.removeEventListener("scroll",this.onScroll),this.dndManager.emitter.off("scrollResize",this.onScroll),(t=this.parent)==null||t.unregisterObserverHandler(this.instanceId,this.scrollEl),this.dndManager.unobserveResize(this.scrollEl))}handleEntityRegistration(){bd.forEach(t=>{let r=Dn(this.scrollEl),n=this.getId(t),i=this.dndManager.scrollEntities.has(n),a=this.isDoneScrolling(t);!a&&!i?this.dndManager.registerScrollEntity(n,this[t],r):a&&i&&this.dndManager.unregisterScrollEntity(n,r)})}handleEntityUnregistration(){bd.forEach(t=>{let r=Dn(this.scrollEl),n=this.getId(t);this.dndManager.unregisterScrollEntity(n,r)})}registerObserverHandler(t,r,n){this.observer?(this.observerHandlers.set(t,n),this.observer.observe(r)):this.observerQueue.push([t,r,n])}unregisterObserverHandler(t,r){this.observer?(this.observerHandlers.delete(t),this.observer.unobserve(r)):this.observerQueue=this.observerQueue.filter(n=>n[0]!==t)}bindScrollHandlers(){bd.forEach(t=>{let r=this.getId(t);this.dndManager.dragManager.emitter.on("beginDragScroll",this.handleBeginDragScroll,r),this.dndManager.dragManager.emitter.on("updateDragScroll",this.handleUpdateDragScroll,r),this.dndManager.dragManager.emitter.on("endDragScroll",this.handleEndDragScroll,r),this.dndManager.dragManager.emitter.on("dragEnd",this.onDragEnd)})}unbindScrollHandlers(){bd.forEach(t=>{let r=this.getId(t);this.dndManager.dragManager.emitter.off("beginDragScroll",this.handleBeginDragScroll,r),this.dndManager.dragManager.emitter.off("updateDragScroll",this.handleUpdateDragScroll,r),this.dndManager.dragManager.emitter.off("endDragScroll",this.handleEndDragScroll,r),this.dndManager.dragManager.emitter.off("dragEnd",this.onDragEnd)})}isDoneScrolling(t){switch(t){case"top":return this.scrollState.y===0;case"right":return this.scrollState.x===this.scrollState.maxX;case"bottom":return this.scrollState.y===this.scrollState.maxY;case"left":return this.scrollState.x===0}}handleDragScroll(){this.activeScroll.size!==0&&this.scrollEl.win.requestAnimationFrame(()=>{let t={left:0,top:0};this.activeScroll.forEach((r,n)=>{if(this.isDoneScrolling(n))return this.activeScroll.delete(n);let i=["left","right"].includes(n)?"left":"top",a=["right","bottom"].includes(n);t[i]=a?Math.max(wd-wd*r/35,0):Math.min(-wd+wd*r/35,0)}),this.scrollEl.scrollBy(t),this.scrollState=Th(this.scrollEl),this.handleEntityRegistration(),this.handleDragScroll()})}getId(t){return`${this.instanceId}-${t}`}getPath(t){var r,n,i,a;switch(t){case"right":return[...((r=this.parent)==null?void 0:r.getPath())||[],1];case"bottom":return[...((n=this.parent)==null?void 0:n.getPath())||[],2];case"left":return[...((i=this.parent)==null?void 0:i.getPath())||[],3]}return[...((a=this.parent)==null?void 0:a.getPath())||[],0]}getScrollShift(){var r,n,i;let t=(r=this.parent)==null?void 0:r.getScrollShift();return{x:Xt((n=this.parent)==null?void 0:n.scrollState.x)+Xt(t==null?void 0:t.x),y:Xt((i=this.parent)==null?void 0:i.scrollState.y)+Xt(t==null?void 0:t.y)}}createScrollEntity(t){var n,i;let r=this;return{scopeId:this.scopeId,entityId:r.getId(t),initial:_h(this.scrollEl.getBoundingClientRect(),((n=this.parent)==null?void 0:n.scrollState)||Tr,((i=this.parent)==null?void 0:i.getScrollShift())||vi,t),getParentScrollState(){var a;return((a=r.parent)==null?void 0:a.scrollState)||Tr},getParentScrollShift(){var a;return((a=r.parent)==null?void 0:a.getScrollShift())||vi},recalcInitial(){var a,o;this.initial=_h(r.scrollEl.getBoundingClientRect(),((a=r.parent)==null?void 0:a.scrollState)||Tr,((o=r.parent)==null?void 0:o.getScrollShift())||vi,t)},getHitbox(){return Bu(this.initial[0],this.initial[1],this.initial[2],this.initial[3],this.getParentScrollState(),this.getParentScrollShift())},getPath(){return r.getPath(t)},getData(){return{id:r.getId(t),type:HN,side:t,accepts:r.triggerTypes||[],scrollContainer:r.scrollEl,win:Dn(r.scrollEl)}}}}};function $k({scrollRef:e,triggerTypes:t,children:r}){let n=Ee(cn),i=Ee(ma),a=Ee(ol),o=Fe(),s=Re(()=>{if(n){o.current&&o.current.destroy();let u=new Dd(n,i,t||[],a);return o.current=u,u}return null},[n,i,e,t,a]);return Nu([e],()=>{var u;return(u=o.current)==null?void 0:u.initNodes(e.current)},()=>{var u;return(u=o.current)==null?void 0:u.destroy()}),s?E(ol.Provider,{value:s,children:r}):null}function Sd({className:e,children:t,triggerTypes:r,isStatic:n,id:i,index:a}){let{setRef:o,scrollRef:s}=Vk(i,a);return E("div",{ref:o,className:Ge([e,$("scroll-container")]),children:n?t:E($k,{scrollRef:s,triggerTypes:r,children:t})})}function Fa({index:e,accepts:t,className:r,isStatic:n,children:i}){let a=Fe(null),o=Fe(null),s=Re(()=>({id:et(),type:"placeholder",accepts:t}),t);return E("div",{ref:o,className:Ge([r,$("placeholder")]),children:E("div",{ref:a,children:n?i:E(ei,{elementRef:a,measureRef:o,id:s.id,index:e,data:s,children:i})})})}var wg={width:0,height:0},BN=100,Ed=class{constructor(t,r,n){this.hitboxDimensions=wg;this.handleDragStart=({dragEntity:t,dragEntityMargin:r,dragOriginHitbox:n})=>{let i=t==null?void 0:t.entityId,a=i?this.sortables.has(i):null;!t||!a||!n||(this.setSortState(!0),this.hitboxDimensions=Fh(n,r),this.activatePlaceholder(this.hitboxDimensions,Lr.none),this.sortables.forEach(([o,s,u])=>{let l=js(t.getPath(),o.getPath()),c=o.entityId;if(l===2)return this.hidden.add(c),this.hideDraggingEntity(u);l===1&&(this.shifted.has(c)||this.shifted.add(c),this.shiftEl(s,Lr.none,this.hitboxDimensions))}))};this.dragEndTimeout=0;this.handleDragEnd=({primaryIntersection:t,dragPosition:r,dragOriginHitbox:n,dragEntity:i})=>{let a=()=>{if(t&&i){let{acceptsSort:l}=t.getData();if(l&&!l.includes(i.getData().type)){let d=this.sortables.get(t.entityId);d&&d[2].removeClass("is-dropping")}}};if(!this.isSorting||!r||!n||!i){if(a(),!t&&i&&this.sortables.has(i.entityId))return this.resetSelf({maintainHidden:!1});if(t&&i){let l=(t==null?void 0:t.getHitbox())||n,c=ys({position:r,destination:{x:l[0],y:l[1]}});return this.dndManager.win.setTimeout(()=>{this.resetSelf({maintainHidden:!1})},c)}return this.resetSelf({maintainHidden:!0})}let{win:o}=this.dndManager;o.clearTimeout(this.dragEnterTimeout),o.clearTimeout(this.dragLeaveTimeout),o.clearTimeout(this.dragEndTimeout);let s=(t==null?void 0:t.getHitbox())||n,u=i.scopeId==="htmldnd"?0:ys({position:r,destination:{x:s[0],y:s[1]}});this.dragEndTimeout=o.setTimeout(()=>{let l=i.entityId.split(":::").pop(),c=t==null?void 0:t.entityId.split(":::").pop();a(),t&&this.sortables.has(t.entityId)&&c!==l&&this.dndManager.onDrop(i,t),this.resetSelf({maintainHidden:!1,shiftTransition:Lr.none,placeholderTransition:Lr.none})},u),this.hitboxDimensions=wg};this.dragEnterTimeout=0;this.handleDragEnter=({dragEntity:t,dragEntityMargin:r,dragOriginHitbox:n,primaryIntersection:i})=>{let a=i==null?void 0:i.entityId,o=a?this.sortables.has(a):null;if(!t||!i||!o||!n){!o&&this.isSorting&&this.resetSelf({maintainHidden:!0,maintainPlaceholder:!0});return}if(t.entityId===i.entityId)return;let{win:s}=this.dndManager;s.clearTimeout(this.dragLeaveTimeout),s.clearTimeout(this.dragEnterTimeout),this.dragEnterTimeout=s.setTimeout(()=>{let u=this.hitboxDimensions=Fh(n,r);this.setSortState(!0),this.activatePlaceholder(u,Lr.placeholder);let{acceptsSort:l}=i.getData();if(l&&!l.includes(t.getData().type)){let d=this.sortables.get(i.entityId);d&&d[2].addClass("is-dropping"),this.sortables.forEach(([m,h])=>{let g=m.entityId;this.shifted.has(g)&&(this.shifted.delete(g),this.resetEl(h))});return}this.sortables.forEach(([d,m])=>{let h=js(i.getPath(),d.getPath()),g=d.entityId;!this.hidden.has(g)&&(h===2||h===1)?this.shifted.has(g)||(this.shifted.add(g),this.shiftEl(m,Lr.outOfTheWay,u)):this.shifted.has(g)&&(this.shifted.delete(g),this.resetEl(m))})},10)};this.dragLeaveTimeout=0;this.handleDragLeave=({dragEntity:t,primaryIntersection:r})=>{if(!this.isSorting)return;let{acceptsSort:n}=r.getData();if(n&&!n.includes(t.getData().type)){let o=this.sortables.get(r.entityId);o&&o[2].removeClass("is-dropping")}let{win:a}=this.dndManager;a.clearTimeout(this.dragLeaveTimeout),a.clearTimeout(this.dragEnterTimeout),this.dragLeaveTimeout=a.setTimeout(()=>{this.resetSelf({maintainHidden:!0,maintainPlaceholder:!0})},BN),this.hitboxDimensions=wg};this.instanceId=et(),this.dndManager=t,this.sortables=new Map,this.shifted=new Set,this.hidden=new Set,this.isSorting=!1,this.axis=r,this.placeholder=null,this.sortListeners=n?[n]:[],t.dragManager.emitter.on("dragStart",this.handleDragStart),t.dragManager.emitter.on("dragEnd",this.handleDragEnd),t.dragManager.emitter.on("dragEnter",this.handleDragEnter),t.dragManager.emitter.on("dragLeave",this.handleDragLeave)}destroy(){this.dndManager.win.clearTimeout(this.dragLeaveTimeout),this.dndManager.win.clearTimeout(this.dragEndTimeout),this.dndManager.dragManager.emitter.off("dragStart",this.handleDragStart),this.dndManager.dragManager.emitter.off("dragEnd",this.handleDragEnd),this.dndManager.dragManager.emitter.off("dragEnter",this.handleDragEnter),this.dndManager.dragManager.emitter.off("dragLeave",this.handleDragLeave)}registerSortable(t,r,n,i){let a=r.getData().type;this.sortables.set(t,[r,n,i]),a==="placeholder"?(this.placeholder=[r,n,i],i.dataset.axis=this.axis,ui(i,"transition",Lr.none)):ui(n,"transition",Lr.none)}unregisterSortable(t){this.sortables.delete(t)}resetSelf({maintainHidden:t,maintainPlaceholder:r,shiftTransition:n,placeholderTransition:i}){this.isSorting&&this.setSortState(!1),this.isPlaceholderActive&&!r&&this.deactivatePlaceholder(i),this.shifted.size>0&&(this.shifted.forEach(a=>{if(this.sortables.has(a)){let[,o]=this.sortables.get(a);this.resetEl(o,n)}}),this.shifted.clear()),!t&&this.hidden.size>0&&(this.hidden.forEach(a=>{if(this.sortables.has(a)){let[,,o]=this.sortables.get(a);this.resetEl(o,n)}}),this.hidden.clear())}activatePlaceholder(t,r){if(this.placeholder){let n=this.axis==="horizontal",[,,i]=this.placeholder;ui(i,"transition",r),ui(i,n?"width":"height",`${n?t.width:t.height}px`),this.isPlaceholderActive=!0}}deactivatePlaceholder(t=Lr.placeholder){if(this.placeholder){let[,,r]=this.placeholder;ui(r,"transition",t),fd(r,"width"),fd(r,"height"),this.isPlaceholderActive=!1}}hideDraggingEntity(t){ui(t,"display","none")}shiftEl(t,r,n){let i=this.axis==="horizontal"?`translate3d(${n.width}px, 0, 0)`:`translate3d(0, ${n.height}px, 0)`;ui(t,"transition",r),ui(t,"transform",i)}resetEl(t,r=Lr.outOfTheWay){ui(t,"transition",r),ui(t,"transform","translate3d(0, 0, 0)"),fd(t,"display")}addSortNotifier(t){this.sortListeners.push(t)}removeSortNotifier(t){this.sortListeners=this.sortListeners.filter(r=>r!==t)}setSortState(t){this.isSorting!==t&&(this.isSorting=t,this.sortListeners.forEach(r=>r(t)))}};function Uk(e){return E(ct,{children:e.children})}function Ia({axis:e,children:t,onSortChange:r}){let n=Ee(cn),i=Fe(),a=Re(()=>{if(n){i.current&&i.current.destroy();let o=new Ed(n,e,r);return i.current=o,o}return null},[n,e,r]);return Ae(()=>()=>{var o;return(o=i.current)==null?void 0:o.destroy()},[]),a?E($u.Provider,{value:a,children:t}):null}var $N=function(){if(typeof window=="undefined"||typeof window.addEventListener!="function")return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),r=function(){return null};return window.addEventListener("test",r,t),window.removeEventListener("test",r,t),e},UN="ignore-onclickoutside",Wk=function(t,r){var n;return(n=t.classList)==null?void 0:n.contains(r)},Yk=function(t,r){for(var n=t.target||t;n;){if(Array.isArray(r)){if(r.some(function(i){return Wk(n,i)}))return!0}else if(Wk(n,r))return!0;n=n.parentElement}return!1},WN=function(t){return document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY},zk=function(t){return t.includes("touch")&&$N()?{passive:!0}:!1},YN=function(t,r){var n=r===void 0?{}:r,i=n.refs,a=n.disabled,o=n.eventTypes,s=o===void 0?["mousedown","touchstart"]:o,u=n.excludeScrollbar,l=n.ignoreClass,c=l===void 0?UN:l,d=n.detectIFrame,m=d===void 0?!0:d,h=Ne([]),g=h[0],y=h[1],v=Fe(t);v.current=t;var D=Ye(function(I){return y(function(C){return[].concat(C,[{current:I}])})},[]);return Ae(function(){if(!(!(i!=null&&i.length)&&!g.length)){var I=function(){var P=[];return(i||g).forEach(function(B){var G=B.current;return G&&P.push(G)}),P},C=function(P){!Yk(P,c)&&!(u&&WN(P))&&I().every(function(B){return!B.contains(P.target)})&&v.current(P)},x=function(P){return activeWindow.setTimeout(function(){var B=document,G=B.activeElement;(G==null?void 0:G.tagName)==="IFRAME"&&!Yk(G,c)&&!I().includes(G)&&v.current(P)},0)},O=function(){s.forEach(function(P){return document.removeEventListener(P,C,zk(P))}),m&&window.removeEventListener("blur",x)};if(a){O();return}return s.forEach(function(A){return document.addEventListener(A,C,zk(A))}),m&&window.addEventListener("blur",x),function(){return O()}}},[g,c,u,a,m,JSON.stringify(s)]),D},ws=YN;function kd(e,t){var r;if(t.types.includes("text/uri-list")||["file","files","link","folder"].includes((r=e.app.dragManager.draggable)==null?void 0:r.type))return"link";if(t.types.includes("text/html")||t.types.includes("text/plain"))return"copy"}function bg({addItems:e,editState:t,setEditState:r,hideButton:n}){let{stateManager:i}=Ee(tt),a=Fe(),o=()=>r(0),s=ws(o,{ignoreClass:[$("ignore-click-outside"),"mobile-toolbar","suggestion-container"]}),u=l=>{e([i.getNewItem(l," ")]);let c=a.current;c&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:""}})};return kn(t)?E("div",{className:$("item-form"),ref:s,children:E("div",{className:$("item-input-wrapper"),children:E(_a,{editorRef:a,editState:{x:0,y:0},className:$("item-input"),placeholder:R("Card title..."),onEnter:(l,c,d)=>{if(!Ca(i,c,d))return u(l.state.doc.toString()),!0},onSubmit:l=>{u(l.state.doc.toString())},onEscape:o})})}):n?null:E("div",{className:$("item-button-wrapper"),children:E("button",{className:$("new-item-button"),onClick:()=>r({x:0,y:0}),onDragOver:l=>{kd(i,l.dataTransfer)&&r({x:0,y:0})},children:[E("span",{className:$("item-button-plus"),children:"+"})," ",R("Add a card")]})})}var rx=Ct(ln());function xd(e,t){let r=e.length,n=t.start;for(;n>0&&e[n-1]===" ";)n--;let i=t.end;for(;i")}function Dg(e){return e.replace(/
/g,`
+`).trim()}function Cd(e){let t=app.vault.getConfig("useTab");return e.trim().replace(/(?:\r\n|\n)/g,t?`
+ `:`
+ `)}function Sg(e,t){if(!t.data.blockId)return e;let r=e.split(/(?:\r\n|\n)/g);return r[0]+=" ^"+t.data.blockId,r.join(`
+`)}function qk(e){let t=e.split(/(?:\r\n|\n)/g);return t[0]=t[0].replace(/\s+\^([a-zA-Z0-9-]+)$/,""),t.join(`
+`)}function Eg(e){return e.trim().replace(/(?:\r\n|\n)(?: {4}|\t)/g,`
+`)}function co(e){e=Dg(e);let t=e.match(/^(.*?)\s*\((\d+)\)$/);return t==null?{title:e,maxItems:0}:{title:t[1],maxItems:Number(t[2])}}function Gk(e){return E("svg",{...e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",children:E("path",{fill:"currentColor",d:"M5 3h2v2H5zm0 4h2v2H5zm0 4h2v2H5zm4-8h2v2H9zm0 4h2v2H9zm0 4h2v2H9z"})})}var $l=Ct(ln()),_d=require("obsidian");var Jk={delete:{description:R("Are you sure you want to delete this list and all its cards?"),confirm:R("Yes, delete list")},archive:{description:R("Are you sure you want to archive this list and all its cards?"),confirm:R("Yes, archive list")},"archive-items":{description:R("Are you sure you want to archive all cards in this list?"),confirm:R("Yes, archive cards")}};function Zk({action:e,cancel:t,onAction:r,lane:n}){return Ae(()=>{e&&n.children.length===0&&r()},[e,n.children.length]),!e||e&&n.children.length===0?null:E("div",{className:$("action-confirm-wrapper"),children:[E("div",{className:$("action-confirm-text"),children:Jk[e].description}),E("div",{children:[E("button",{onClick:r,className:$("confirm-action-button"),children:Jk[e].confirm}),E("button",{onClick:t,className:$("cancel-action-button"),children:"Cancel"})]})]})}function Qk({setEditState:e,path:t,lane:r}){let{stateManager:n,boardModifiers:i}=Ee(tt),[a,o]=Ne(null);return{settingsMenu:Re(()=>{let u=new Set,l=!1,c=!1;r.children.forEach(h=>{var y;let g=h.data.metadata.inlineMetadata;g&&g.forEach(v=>{v.key!=="repeat"&&(u.has(v.key)||u.add(v.key))}),!l&&h.data.metadata.date&&(l=!0),!c&&((y=h.data.metadata.tags)!=null&&y.length)&&(c=!0)});let d=new _d.Menu().addItem(h=>{h.setIcon("lucide-edit-3").setTitle(R("Edit list")).onClick(()=>e({x:0,y:0}))}).addItem(h=>{h.setIcon("lucide-archive").setTitle(R("Archive cards")).onClick(()=>o("archive-items"))}).addSeparator().addItem(h=>{h.setIcon("arrow-left-to-line").setTitle(R("Insert list before")).onClick(()=>i.insertLane(t,{...Ea,id:et(),children:[],data:{title:"",shouldMarkItemsComplete:!1,forceEditMode:!0}}))}).addItem(h=>{h.setIcon("arrow-right-to-line").setTitle(R("Insert list after")).onClick(()=>{let g=[...t];g[g.length-1]=g[g.length-1]+1,i.insertLane(g,{...Ea,id:et(),children:[],data:{title:"",shouldMarkItemsComplete:!1,forceEditMode:!0}})})}).addSeparator().addItem(h=>{h.setIcon("lucide-archive").setTitle(R("Archive list")).onClick(()=>o("archive"))}).addItem(h=>{h.setIcon("lucide-trash-2").setTitle(R("Delete list")).onClick(()=>o("delete"))}).addSeparator(),m=h=>{h.addItem(g=>{g.setIcon("arrow-down-up").setTitle(R("Sort by card text")).onClick(()=>{let y=r.children.slice(),v=r.data.sorted===0;y.sort((D,I)=>v?I.data.title.localeCompare(D.data.title):D.data.title.localeCompare(I.data.title)),i.updateLane(t,(0,$l.default)(r,{children:{$set:y},data:{sorted:{$set:r.data.sorted===0?1:0}}}))})}),l&&h.addItem(g=>{g.setIcon("arrow-down-up").setTitle(R("Sort by date")).onClick(()=>{let y=r.children.slice(),v=r.data.sorted===2?-1:1;y.sort((D,I)=>{let C=D.data.metadata.time||D.data.metadata.date,x=I.data.metadata.time||I.data.metadata.date;return C&&!x?-1*v:x&&!C?1*v:!C&&!x?0:(C.isBefore(x)?-1:1)*v}),i.updateLane(t,(0,$l.default)(r,{children:{$set:y},data:{sorted:{$set:r.data.sorted===2?3:2}}}))})}),c&&h.addItem(g=>{g.setIcon("arrow-down-up").setTitle(R("Sort by tags")).onClick(()=>{let y=n.getSetting("tag-sort"),v=r.children.slice(),D=r.data.sorted===4;v.sort((I,C)=>{var B,G;let x=I.data.metadata.tags,O=C.data.metadata.tags;if(!(x!=null&&x.length)&&!(O!=null&&O.length))return 0;if(!(x!=null&&x.length))return 1;if(!(O!=null&&O.length))return-1;let A=(B=y==null?void 0:y.findIndex(J=>x.includes(J.tag)))!=null?B:-1,P=(G=y==null?void 0:y.findIndex(J=>O.includes(J.tag)))!=null?G:-1;return A>-1&&P<0?D?1:-1:P>-1&&A<0?D?-1:1:A>-1&&P>-1?D?P-A:A-P:D?fr(O.join(""),x.join("")):fr(x.join(""),O.join(""))}),i.updateLane(t,(0,$l.default)(r,{children:{$set:v},data:{sorted:{$set:r.data.sorted===4?5:4}}}))})}),u.size&&u.forEach(g=>{h.addItem(y=>{y.setIcon("arrow-down-up").setTitle(R("Sort by")+" "+No(g).toLocaleLowerCase()).onClick(()=>{let v=r.children.slice(),D=r.data.sorted===g+"-asc";v.sort((I,C)=>{var A,P;let x=(A=I.data.metadata.inlineMetadata)==null?void 0:A.find(B=>B.key===g),O=(P=C.data.metadata.inlineMetadata)==null?void 0:P.find(B=>B.key===g);return x===void 0&&O===void 0?0:x===void 0?1:O===void 0?-1:D?fr(In(O.value,n),In(x.value,n)):fr(In(x.value,n),In(O.value,n))}),i.updateLane(t,(0,$l.default)(r,{children:{$set:v},data:{sorted:{$set:r.data.sorted===g+"-asc"?g+"-desc":g+"-asc"}}}))})})})};return _d.Platform.isPhone?m(d):d.addItem(h=>{let g=h.setTitle(R("Sort by")).setIcon("arrow-down-up").setSubmenu();m(g)}),d},[n,o,t,r]),confirmAction:a,setConfirmAction:o}}var Xk=Ct(ln());function ex({lane:e,lanePath:t,editState:r}){let{boardModifiers:n}=Ee(tt);return kn(r)?E("div",{className:$("lane-setting-wrapper"),children:E("div",{className:$("checkbox-wrapper"),children:[E("div",{className:$("checkbox-label"),children:R("Mark cards in this list as complete")}),E("div",{onClick:()=>n.updateLane(t,(0,Xk.default)(e,{data:{$toggle:["shouldMarkItemsComplete"]}})),className:`checkbox-container ${e.data.shouldMarkItemsComplete?"is-enabled":""}`})]})}):null}function tx({maxItems:e,itemCount:t,editState:r}){let{stateManager:n}=Ee(tt);return n.getSetting("hide-card-count")||kn(r)?null:E("div",{className:Ge([$("lane-title-count"),{"wip-exceeded":e&&e0&&E(ct,{children:[E("span",{className:$("lane-title-count-separator"),children:"/"}),E("span",{className:$("lane-title-count-limit"),children:e})]})]})}function nx({maxItems:e,editState:t,setEditState:r,title:n,onChange:i}){let{stateManager:a}=Ee(tt),o=Fe(null);Ae(()=>{t===1?(o.current!==null&&i(o.current),o.current=null):t===0&&o.current!==null&&(o.current=null)},[t]);let s=Ye(d=>{d.docChanged&&(o.current=d.state.doc.toString().trim())},[]),u=Ye((d,m,h)=>{if(!Ca(a,m,h))return r(1),!0},[r,a]),l=Ye(()=>r(1),[r]),c=Ye(()=>r(0),[r]);return E("div",{className:$("lane-title"),children:kn(t)?E(_a,{editState:t,className:$("lane-input"),onChange:s,onEnter:u,onEscape:c,onSubmit:l,value:cd(n,e)}):E("div",{className:$("lane-title-text"),children:E(Sa,{markdownString:n})})})}function zN({settingsMenu:e,editState:t,setEditState:r,setIsItemInputVisible:n}){let{stateManager:i}=Ee(tt);return E("div",{className:$("lane-settings-button-wrapper"),children:kn(t)?E("a",{onClick:()=>r(null),"aria-label":R("Close"),className:`${$("lane-settings-button")} is-enabled clickable-icon`,children:E(Ut,{name:"lucide-x"})}):E(ct,{children:[n&&E("a",{"aria-label":R("Add a card"),className:`${$("lane-settings-button")} clickable-icon`,onClick:()=>n({x:0,y:0}),onDragOver:a=>{kd(i,a.dataTransfer)&&n({x:0,y:0})},children:E(Ut,{name:"lucide-plus-circle"})}),E("a",{"aria-label":R("More options"),className:`${$("lane-settings-button")} clickable-icon`,onClick:a=>{e.showAtMouseEvent(a)},children:E(Ut,{name:"lucide-more-vertical"})})]})})}var ix=zt(function({lane:t,laneIndex:r,bindHandle:n,setIsItemInputVisible:i,isCollapsed:a,toggleIsCollapsed:o}){let[s,u]=Ne(0),l=Ui(r),{boardModifiers:c}=Ee(tt),{settingsMenu:d,confirmAction:m,setConfirmAction:h}=Qk({setEditState:u,path:l,lane:t});Ae(()=>{t.data.forceEditMode&&u(null)},[t.data.forceEditMode]);let g=Ye(v=>{let{title:D,maxItems:I}=co(v);c.updateLane(l,(0,rx.default)(t,{data:{title:{$set:D},maxItems:{$set:I}}}))},[c,t,l]),y=Ye(v=>{!a&&u({x:v.clientX,y:v.clientY})},[a,u]);return E(ct,{children:[E("div",{onDblClick:y,className:$("lane-header-wrapper"),children:[E("div",{className:$("lane-grip"),ref:n,children:E(Gk,{})}),E("div",{onClick:o,className:$("lane-collapse"),children:E(Ut,{name:"chevron-down"})}),E(nx,{id:t.id,editState:s,maxItems:t.data.maxItems,onChange:g,setEditState:u,title:t.data.title}),E(tx,{editState:s,itemCount:t.children.length,maxItems:t.data.maxItems}),E(zN,{editState:s,setEditState:u,setIsItemInputVisible:i,settingsMenu:d})]}),E(ex,{editState:s,lane:t,lanePath:l}),m&&E(Zk,{lane:t,action:m,onAction:()=>{switch(m){case"archive":c.archiveLane(l);break;case"archive-items":c.archiveLaneItems(l);break;case"delete":c.deleteEntity(l);break}h(null)},cancel:()=>h(null)})]})});var ax=[ft.Item];function KN({isStatic:e,lane:t,laneIndex:r,collapseDir:n,isCollapsed:i=!1}){var be;let[a,o]=Ne(0),[s,u]=Ne(!1),{stateManager:l,boardModifiers:c,view:d}=Ee(tt),m=Ee(zn),h=d.useViewState(_t),g=Ui(r),y=l.useSetting("lane-width"),v=h==="list"&&l.useSetting("full-list-lane-width"),D=l.useSetting("new-card-insertion-method"),I=Re(()=>!(i&&n==="horizontal")&&(v||y)?{width:v?"100%":`${y}px`}:void 0,[v,y,i]),C=Fe(null),x=Fe(null),O=Fe(null),A=Ta(x,O),P=!!t.data.shouldMarkItemsComplete,B=D==="prepend-compact",G=B||D==="prepend",J=Ye(()=>{l.setState(pe=>{let De=[...d.getViewState("list-collapse")];return De[r]=!De[r],d.setViewState("list-collapse",De),(0,kg.default)(pe,{data:{settings:{"list-collapse":{$set:De}}}})})},[l,r]),Q=Ye(pe=>{c[G?"prependItems":"appendItems"]([...g,t.children.length-1],pe.map(De=>(0,kg.default)(De,{data:{checked:{$set:P},checkChar:{$set:P?Zn():" "}}}))),d.getWindow().setTimeout(()=>{var Ce;let De=(Ce=C.current)==null?void 0:Ce.getElementsByClassName($("lane-items"));De.length&&vd([0,G?0:De[0].scrollHeight],{elementToScroll:De[0],speed:200,minDuration:150,easing:U=>U===1?1:1-Math.pow(2,-10*U)})})},[c,g,t,G]),oe=e?Tb:ei,te=e?Uk:Ia,re=!i||e?ct:ei,ne=Re(()=>{if(!i||e)return{};let pe={id:et(),type:"lane",accepts:[ft.Item],acceptsSort:[ft.Lane]};return{elementRef:C,measureRef:x,id:pe.id,index:r,data:pe}},[i,r,e]);return E(Oc.Provider,{value:(be=t.data.sorted)!=null?be:null,children:E("div",{ref:x,className:Ge([$("lane-wrapper"),{"is-sorting":s,"collapse-horizontal":i&&n==="horizontal","collapse-vertical":i&&n==="vertical"}]),style:I,children:E("div",{"data-count":t.children.length,ref:C,className:Ge([$("lane"),{"will-prepend":G}]),children:E(re,{...ne,children:[E(ix,{bindHandle:A,laneIndex:r,lane:t,setIsItemInputVisible:B?o:void 0,isCollapsed:i,toggleIsCollapsed:J}),!(m!=null&&m.query)&&!i&&G&&E(bg,{addItems:Q,hideButton:B,editState:a,setEditState:o}),!i&&E(oe,{elementRef:C,measureRef:x,id:t.id,index:r,data:t,children:E(Sd,{className:Ge([$("lane-items"),$("vertical")]),id:t.id,index:r,isStatic:e,triggerTypes:ax,children:E(te,{onSortChange:u,axis:"vertical",children:[E(Rk,{items:t.children,isStatic:e,shouldMarkItemsComplete:P}),E(Fa,{accepts:ax,index:t.children.length,isStatic:e})]})})}),!(m!=null&&m.query)&&!i&&!G&&E(bg,{addItems:Q,editState:a,setEditState:o})]})})})})}var xg=zt(KN);function jN({lanes:e,collapseDir:t}){let r=Ee(zn),{view:n}=Ee(tt),i=n.useViewState(_t)||"board",a=n.useViewState("list-collapse")||[];return E(ct,{children:e.map((o,s)=>E(xg,{collapseDir:t,isCollapsed:(r==null?void 0:r.query)&&!r.lanes.has(o)||!!a[s],lane:o,laneIndex:s},i+o.id))})}var ox=zt(jN);var sx=require("obsidian");var Md=class{constructor(t,r){this.scrollResizeDebounce=0;this.handleResize=t=>{let r=!1;t.forEach(n=>{let i=Dn(n.target);this.win===i&&(r=!0,n.target.dataset.scrollid&&(this.win.clearTimeout(this.scrollResizeDebounce),this.scrollResizeDebounce=this.win.setTimeout(()=>{this.emitter.listenerCount("scrollResize")&&this.emitter.emit("scrollResize",null)},50)))}),r&&(this.hitboxEntities.forEach(n=>{n.recalcInitial()}),this.scrollEntities.forEach(n=>{n.recalcInitial()}))};this.win=t,this.emitter=new Bo,this.hitboxEntities=new Map,this.scrollEntities=new Map,this.onDrop=r,this.resizeObserver=new ResizeObserver((0,sx.debounce)(this.handleResize,100,!0)),this.dragManager=new hd(t,this.emitter,this.hitboxEntities,this.scrollEntities)}destroy(){this.resizeObserver.disconnect()}observeResize(t){t.instanceOf(HTMLElement)&&this.resizeObserver.observe(t,{box:"border-box"})}unobserveResize(t){t.instanceOf(HTMLElement)&&this.resizeObserver.unobserve(t)}registerHitboxEntity(t,r,n){n===this.win&&this.hitboxEntities.set(t,r)}registerScrollEntity(t,r,n){n===this.win&&this.scrollEntities.set(t,r)}unregisterHitboxEntity(t,r){r===this.win&&this.hitboxEntities.delete(t)}unregisterScrollEntity(t,r){r===this.win&&this.scrollEntities.delete(t)}};function bs({win:e,children:t,onDrop:r}){let n=Fe(r);n.current=r;let i=Re(()=>new Md(e,(a,o)=>n.current(a,o)),[]);return Ae(()=>()=>{i.destroy()},[i]),E(cn.Provider,{value:i,children:E(Bk,{children:t})})}function Cg(e,t,r,n,i,a){let o=[r[0]-n[0],r[1]-n[1],r[2]+n[2],r[3]+n[3]];return{transform:a||`translate3d(${e.x-t.x+o[0]}px, ${e.y-t.y+o[1]}px, 0px)`,width:`${o[2]-o[0]}px`,height:`${o[3]-o[1]}px`,transition:i}}function Ds({children:e}){let t=Ee(cn),[r,n]=Ne(),[i,a]=Ne();return Ae(()=>{if(!t)return;let o=Cb,s=({dragEntity:d,dragOrigin:m,dragPosition:h,dragEntityMargin:g})=>{!d||!h||!m||(o=d.getHitbox(),n(d),a(Cg(h,m,o,g)))},u=({dragOrigin:d,dragPosition:m,dragEntityMargin:h})=>{!m||!d||a(Cg(m,d,o,h))},l=({dragOrigin:d,primaryIntersection:m,dragPosition:h,dragEntityMargin:g})=>{if(m&&h&&d){let y=m.getHitbox(),v={x:y[0],y:y[1]},D=ys({position:h,destination:v}),I=Lr.drop(D),C=Fk.drop(v);a(Cg(h,d,o,g,I,C)),activeWindow.setTimeout(()=>{n(void 0),a(void 0)},D)}else n(void 0),a(void 0)},{emitter:c}=t.dragManager;return c.on("dragStart",s),c.on("dragMove",u),c.on("dragEnd",l),()=>{c.off("dragStart",s),c.off("dragMove",u),c.off("dragEnd",l)}},[t]),!r||!i?null:Oi(e(r,i),r.getData().win.document.body)}function lx(){let e=Ee(cn),[t,r]=Ne(!1);return Ae(()=>{let n=()=>r(!0),i=({primaryIntersection:o,dragPosition:s})=>{let u=(o==null?void 0:o.getHitbox())||[0,0],l={x:u[0],y:u[1]},c=ys({position:s||l,destination:l});activeWindow.setTimeout(()=>r(!1),c)},{emitter:a}=e.dragManager;return a.on("dragStart",n),a.on("dragEnd",i),()=>{a.off("dragStart",n),a.off("dragEnd",i)}},[e]),t}var Zi=Ct(ln()),ux=require("obsidian");function Td(e,t){let r=n=>{let i=t.getSetting("archive-date-format"),a=t.getSetting("archive-date-separator"),o=t.getSetting("append-archive-date"),s=[(0,ux.moment)().format(i)];a&&s.push(a),s.push(n.data.titleRaw),o&&s.reverse();let u=s.join(" ");return t.updateItemContent(n,u)};return{appendItems:(n,i)=>{t.setState(a=>ah(a,n,i))},prependItems:(n,i)=>{t.setState(a=>ow(a,n,i))},insertItems:(n,i)=>{t.setState(a=>Xr(a,n,i))},replaceItem:(n,i)=>{t.setState(a=>Xr(mi(a,n),n,i))},splitItem:(n,i)=>{t.setState(a=>Xr(mi(a,n),n,i))},moveItemToTop:n=>{t.setState(i=>Ri(i,n,[n[0],0]))},moveItemToBottom:n=>{t.setState(i=>{let a=n[0],o=i.children[a];return Ri(i,n,[a,o.children.length])})},addLane:n=>{t.setState(i=>{let a=e.getViewState("list-collapse")||[],o=s=>{let u=[...s];return u.push(!1),u};return e.setViewState("list-collapse",void 0,o),(0,Zi.default)(ah(i,[],[n]),{data:{settings:{"list-collapse":{$set:o(a)}}}})})},insertLane:(n,i)=>{t.setState(a=>{let o=e.getViewState("list-collapse"),s=u=>{let l=[...u];return l.splice(n.last(),0,!1),l};return e.setViewState("list-collapse",void 0,s),(0,Zi.default)(Xr(a,n,[i]),{data:{settings:{"list-collapse":{$set:s(o)}}}})})},updateLane:(n,i)=>{t.setState(a=>oh(a,n,{children:{[n[n.length-1]]:{$set:i}}}))},archiveLane:n=>{t.setState(i=>{let o=un(i,n).children;try{let s=e.getViewState("list-collapse"),u=l=>{let c=[...l];return c.splice(n.last(),1),c};return e.setViewState("list-collapse",void 0,u),(0,Zi.default)(mi(i,n),{data:{settings:{"list-collapse":{$set:u(s)}},archive:{$unshift:t.getSetting("archive-with-date")?o.map(r):o}}})}catch(s){return t.setError(s),i}})},archiveLaneItems:n=>{t.setState(i=>{let o=un(i,n).children;try{return(0,Zi.default)(Du(i,n,{children:{$set:[]}}),{data:{archive:{$unshift:t.getSetting("archive-with-date")?o.map(r):o}}})}catch(s){return t.setError(s),i}})},deleteEntity:n=>{t.setState(i=>{if(un(i,n).type===ft.Lane){let o=e.getViewState("list-collapse"),s=u=>{let l=[...u];return l.splice(n.last(),1),l};return e.setViewState("list-collapse",void 0,s),(0,Zi.default)(mi(i,n),{data:{settings:{"list-collapse":{$set:s(o)}}}})}return mi(i,n)})},updateItem:(n,i)=>{t.setState(a=>oh(a,n,{children:{[n[n.length-1]]:{$set:i}}}))},archiveItem:n=>{t.setState(i=>{let a=un(i,n);try{return(0,Zi.default)(mi(i,n),{data:{archive:{$push:[t.getSetting("archive-with-date")?r(a):a]}}})}catch(o){return t.setError(o),i}})},duplicateEntity:n=>{t.setState(i=>{let a=un(i,n),o=(0,Zi.default)(a,{id:{$set:et()}});if(a.type===ft.Lane){let s=e.getViewState("list-collapse"),u=l=>{let c=[...l];return c.splice(n.last(),0,l[n.last()]),c};return e.setViewState("list-collapse",void 0,u),(0,Zi.default)(Xr(i,n,[o]),{data:{settings:{"list-collapse":{$set:u(s)}}}})}return Xr(i,n,[o])})}}}function cx(e,t){return E(GN,{win:e,plugin:t})}var qN=zt(function({view:t}){return Oi(t.getPortal(),t.contentEl)});function GN({win:e,plugin:t}){let r=t.useKanbanViews(e),n=r.map(a=>E(qN,{view:a},a.id)),i=Ye((a,o)=>{if(!a||!o)return;if(a.scopeId==="htmldnd"){let I=a.getData(),C=t.getStateManagerFromViewID(I.viewId,I.win),x=o.getPath(),O=un(C.state,x.slice(0,-1));try{let A=I.content.map(P=>{var J,Q,oe;let B=C.getNewItem(P," ");if(!!((J=O==null?void 0:O.data)!=null&&J.shouldMarkItemsComplete)){B=(0,Ss.default)(B,{data:{checkChar:{$set:Iu()}}});let te=Ro(B,C.file);if(te){let[re,ne,be]=te,pe=re[be],De=ne[be];return C.getNewItem(pe,De)}}return(0,Ss.default)(B,{data:{checked:{$set:!!((Q=O==null?void 0:O.data)!=null&&Q.shouldMarkItemsComplete)},checkChar:{$set:(oe=O==null?void 0:O.data)!=null&&oe.shouldMarkItemsComplete?Zn():" "}}})});return C.setState(P=>Xr(P,x,A))}catch(A){C.setError(A),console.error(A)}return}let s=a.getPath(),u=o.getPath(),l=a.getData(),c=o.getData(),[,d]=a.scopeId.split(":::"),[,m]=o.scopeId.split(":::"),h=c.acceptsSort&&!c.acceptsSort.includes(l.type);if(d===m){let I=t.getKanbanView(a.scopeId,l.win),C=t.stateManagers.get(I.file);return h&&u.push(0),C.setState(x=>{var G;let O=un(x,s),A=Ri(x,s,u,J=>{if(J.type===ft.Item){let{next:Q}=Au(C,x,s,C,x,u,J);return Q}return J},J=>{if(J.type===ft.Item){let{replacement:Q}=Au(C,x,s,C,x,u,J);return Q}});if(O.type===ft.Lane){let J=s.last(),Q=u.last();J{let ne=[...re];return ne.splice(Q,0,ne.splice(J,1)[0]),ne};return I.setViewState("list-collapse",void 0,te),(0,Ss.default)(A,{data:{settings:{"list-collapse":{$set:te(oe)}}}})}let P=u.slice(0,-1),B=un(x,P);return((G=B==null?void 0:B.data)==null?void 0:G.sorted)!==void 0?Du(A,P,{data:{$unset:["sorted"]}}):A})}let g=t.getKanbanView(a.scopeId,l.win),y=t.stateManagers.get(g.file),v=t.getKanbanView(o.scopeId,c.win),D=t.stateManagers.get(v.file);y.setState(I=>{let C=un(I,s),x;if(D.setState(O=>{if(h){let P=un(D.state,u);(D.getSetting("new-card-insertion-method")||"append")==="append"?u.push(P.children.length):u.push(0)}let A=[];if(C.type===ft.Item){let{next:P,replacement:B}=Au(y,I,s,D,O,u,C);x=B,A.push(P)}else A.push(C);if(C.type===ft.Lane){let P=v.getViewState("list-collapse"),B=g.getViewState("list-collapse")[s.last()],G=J=>{let Q=[...J];return Q.splice(u.last(),0,B),Q};return v.setViewState("list-collapse",void 0,G),(0,Ss.default)(Xr(O,u,A),{data:{settings:{"list-collapse":{$set:G(P)}}}})}else return Xr(O,u,A)}),C.type===ft.Lane){let O=g.getViewState("list-collapse"),A=P=>{let B=[...P];return B.splice(s.last(),1),B};return g.setViewState("list-collapse",void 0,A),(0,Ss.default)(mi(I,s),{data:{settings:{"list-collapse":{$set:A(O)}}}})}else return mi(I,s,x)})},[r]);if(n.length)return E(bs,{win:e,onDrop:i,children:[...n,E(Ds,{children:(a,o)=>{let[s,u]=Re(()=>{if(a.scopeId==="htmldnd")return[null,null];let l=a.getData(),c=t.getKanbanView(a.scopeId,l.win),d=t.stateManagers.get(c.file),m=un(d.state,a.getPath()),h=Td(c,d),g=c.file.path;return[m,{view:c,stateManager:d,boardModifiers:h,filePath:g}]},[a]);if((s==null?void 0:s.type)===ft.Lane){let l=(u==null?void 0:u.view.viewSettings[_t])||(u==null?void 0:u.stateManager.getSetting(_t)),c=(u==null?void 0:u.view.viewSettings["list-collapse"])||(u==null?void 0:u.stateManager.getSetting("list-collapse")),d=a.getPath().last();return E(tt.Provider,{value:u,children:E("div",{className:Ge([$("drag-container"),{[$("horizontal")]:l!=="list",[$("vertical")]:l==="list"}]),style:o,children:E(xg,{lane:s,laneIndex:d,isStatic:!0,isCollapsed:!!c[d],collapseDir:l==="list"?"vertical":"horizontal"})})})}return(s==null?void 0:s.type)===ft.Item?E(tt.Provider,{value:u,children:E("div",{className:$("drag-container"),style:o,children:E(gg,{item:s,itemIndex:0,isStatic:!0})})}):E("div",{})}})]})}var _C=Ct(ln()),ea=require("obsidian");var Wx=Ct(ln()),rt=require("obsidian");var fx=Ct(dx()),Id=Ct(ln()),Aa=require("obsidian");var Ad="@",Od="@@",Ul="body";function JN(e){let t=[];return Aa.Vault.recurseChildren(e.vault.getRoot(),r=>{r instanceof Aa.TFolder&&t.push({value:r.path,label:r.path,selected:!1,disabled:!1})}),t}function ZN(e,t){let r=[],n=t?e.vault.getAbstractFileByPath(t):null;return(!n||!(n instanceof Aa.TFolder))&&(n=e.vault.getRoot()),Aa.Vault.recurseChildren(n,i=>{i instanceof Aa.TFile&&r.push({value:i.path,label:i.basename,selected:!1,disabled:!1})}),r}function hx(e){let{templateFolder:t,templatesEnabled:r,templaterPlugin:n}=kh(e),i=ZN(e,t),a=JN(e),o="";return!r&&!n&&(o=R("Note: No template plugins are currently enabled.")),{templateFiles:i,vaultFolders:a,templateWarning:o}}function Mg({choices:e,key:t,warningText:r,local:n,placeHolderStr:i,manager:a}){return o=>{o.controlEl.createEl("select",{},s=>{s.win.setTimeout(()=>{let u=e,[l,c]=a.getSetting(t,n),d=!1;if(c){let g=u.findIndex(y=>y.value===c);if(g>-1){d=!0;let y=e[g];u=(0,Id.default)(u,{$splice:[[g,1]],$unshift:[(0,Id.default)(y,{placeholder:{$set:!0},value:{$set:""},label:{$apply:v=>`${v} (${R("default")})`}})]})}}d||(u=(0,Id.default)(u,{$unshift:[{placeholder:!0,value:"",label:i,selected:!1,disabled:!1}]}));let m=new fx.default(s,{placeholder:!0,position:"bottom",searchPlaceholderValue:R("Search..."),searchEnabled:u.length>10,choices:u}).setChoiceByValue("");l&&typeof l=="string"&&u.findIndex(g=>g.value===l)>-1&&m.setChoiceByValue(l);let h=g=>{let y=g.detail.value;y?a.applySettingsUpdate({[t]:{$set:y}}):a.applySettingsUpdate({$unset:[t]})};s.addEventListener("change",h),a.cleanupFns.push(()=>{m.destroy(),s.removeEventListener("change",h)})}),r&&o.descEl.createDiv({},u=>{u.createEl("strong",{text:r})})})}}var Hd=Ct(ln()),Hg=require("obsidian");var QN={grad:.9,turn:360,rad:360/(2*Math.PI)},Qi=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Nn=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=Math.pow(10,t)),Math.round(r*e)/r+0},jr=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=1),e>r?r:e>t?e:t},Sx=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},mx=function(e){return{r:jr(e.r,0,255),g:jr(e.g,0,255),b:jr(e.b,0,255),a:jr(e.a)}},Tg=function(e){return{r:Nn(e.r),g:Nn(e.g),b:Nn(e.b),a:Nn(e.a,3)}},XN=/^#([0-9a-f]{3,8})$/i,Ld=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ex=function(e){var t=e.r,r=e.g,n=e.b,i=e.a,a=Math.max(t,r,n),o=a-Math.min(t,r,n),s=o?a===t?(r-n)/o:a===r?2+(n-t)/o:4+(t-r)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},kx=function(e){var t=e.h,r=e.s,n=e.v,i=e.a;t=t/360*6,r/=100,n/=100;var a=Math.floor(t),o=n*(1-r),s=n*(1-(t-a)*r),u=n*(1-(1-t+a)*r),l=a%6;return{r:255*[n,s,o,o,u,n][l],g:255*[u,n,n,s,o,o][l],b:255*[o,o,u,n,n,s][l],a:i}},px=function(e){return{h:Sx(e.h),s:jr(e.s,0,100),l:jr(e.l,0,100),a:jr(e.a)}},gx=function(e){return{h:Nn(e.h),s:Nn(e.s),l:Nn(e.l),a:Nn(e.a,3)}},yx=function(e){return kx((r=(t=e).s,{h:t.h,s:(r*=((n=t.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:t.a}));var t,r,n},Wl=function(e){return{h:(t=Ex(e)).h,s:(i=(200-(r=t.s))*(n=t.v)/100)>0&&i<200?r*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,r,n,i},eR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vx={string:[[function(e){var t=XN.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Nn(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?Nn(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=nR.exec(e)||rR.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:mx({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=eR.exec(e)||tR.exec(e);if(!t)return null;var r,n,i=px({h:(r=t[1],n=t[2],n===void 0&&(n="deg"),Number(r)*(QN[n]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return yx(i)},"hsl"]],object:[[function(e){var t=e.r,r=e.g,n=e.b,i=e.a,a=i===void 0?1:i;return Qi(t)&&Qi(r)&&Qi(n)?mx({r:Number(t),g:Number(r),b:Number(n),a:Number(a)}):null},"rgb"],[function(e){var t=e.h,r=e.s,n=e.l,i=e.a,a=i===void 0?1:i;if(!Qi(t)||!Qi(r)||!Qi(n))return null;var o=px({h:Number(t),s:Number(r),l:Number(n),a:Number(a)});return yx(o)},"hsl"],[function(e){var t=e.h,r=e.s,n=e.v,i=e.a,a=i===void 0?1:i;if(!Qi(t)||!Qi(r)||!Qi(n))return null;var o=function(s){return{h:Sx(s.h),s:jr(s.s,0,100),v:jr(s.v,0,100),a:jr(s.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(a)});return kx(o)},"hsv"]]},wx=function(e,t){for(var r=0;r=.5},e.prototype.toHex=function(){return t=Tg(this.rgba),r=t.r,n=t.g,i=t.b,o=(a=t.a)<1?Ld(Nn(255*a)):"","#"+Ld(r)+Ld(n)+Ld(i)+o;var t,r,n,i,a,o},e.prototype.toRgb=function(){return Tg(this.rgba)},e.prototype.toRgbString=function(){return t=Tg(this.rgba),r=t.r,n=t.g,i=t.b,(a=t.a)<1?"rgba("+r+", "+n+", "+i+", "+a+")":"rgb("+r+", "+n+", "+i+")";var t,r,n,i,a},e.prototype.toHsl=function(){return gx(Wl(this.rgba))},e.prototype.toHslString=function(){return t=gx(Wl(this.rgba)),r=t.h,n=t.s,i=t.l,(a=t.a)<1?"hsla("+r+", "+n+"%, "+i+"%, "+a+")":"hsl("+r+", "+n+"%, "+i+"%)";var t,r,n,i,a},e.prototype.toHsv=function(){return t=Ex(this.rgba),{h:Nn(t.h),s:Nn(t.s),v:Nn(t.v),a:Nn(t.a,3)};var t},e.prototype.invert=function(){return ci({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),ci(Fg(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),ci(Fg(this.rgba,-t))},e.prototype.grayscale=function(){return ci(Fg(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),ci(bx(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),ci(bx(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?ci({r:(r=this.rgba).r,g:r.g,b:r.b,a:t}):Nn(this.rgba.a,3);var r},e.prototype.hue=function(t){var r=Wl(this.rgba);return typeof t=="number"?ci({h:t,s:r.s,l:r.l,a:r.a}):Nn(r.h)},e.prototype.isEqual=function(t){return this.toHex()===ci(t).toHex()},e}(),ci=function(e){return e instanceof Dx?e:new Dx(e)};var Rd=Ct(ln());function Pd(){return(Pd=Object.assign||function(e){for(var t=1;t=0||(i[r]=e[r]);return i}function Og(e){var t=Fe(e),r=Fe(function(n){t.current&&t.current(n)});return t.current=e,r.current}var Es=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=1),e>r?r:e0:v.buttons>0)&&i.current?a(xx(i.current,v,s.current)):y(!1)},g=function(){return y(!1)};function y(v){var D=u.current,I=Lg(i.current),C=v?I.addEventListener:I.removeEventListener;C(D?"touchmove":"mousemove",h),C(D?"touchend":"mouseup",g)}return[function(v){var D=v.nativeEvent,I=i.current;if(I&&(Cx(D),!function(x,O){return O&&!Yl(x)}(D,u.current)&&I)){if(Yl(D)){u.current=!0;var C=D.changedTouches||[];C.length&&(s.current=C[0].identifier)}I.focus(),a(xx(I,D,s.current)),y(!0)}},function(v){var D=v.which||v.keyCode;D<37||D>40||(v.preventDefault(),o({left:D===39?.05:D===37?-.05:0,top:D===40?.05:D===38?-.05:0}))},y]},[o,a]),c=l[0],d=l[1],m=l[2];return Ae(function(){return m},[m]),$e.createElement("div",Pd({},n,{onTouchStart:c,onMouseDown:c,className:"react-colorful__interactive",ref:i,onKeyDown:d,tabIndex:0,role:"slider"}))}),Nd=function(e){return e.filter(Boolean).join(" ")},Rg=function(e){var t=e.color,r=e.left,n=e.top,i=n===void 0?.5:n,a=Nd(["react-colorful__pointer",e.className]);return $e.createElement("div",{className:a,style:{top:100*i+"%",left:100*r+"%"}},$e.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},hr=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=Math.pow(10,t)),Math.round(r*e)/r},xG={grad:.9,turn:360,rad:360/(2*Math.PI)};var Tx=function(e){var t=e.s,r=e.v,n=e.a,i=(200-t)*r/100;return{h:hr(e.h),s:hr(i>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0),l:hr(i/2),a:hr(n,2)}},Pg=function(e){var t=Tx(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Ag=function(e){var t=Tx(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},aR=function(e){var t=e.h,r=e.s,n=e.v,i=e.a;t=t/360*6,r/=100,n/=100;var a=Math.floor(t),o=n*(1-r),s=n*(1-(t-a)*r),u=n*(1-(1-t+a)*r),l=a%6;return{r:hr(255*[n,s,o,o,u,n][l]),g:hr(255*[u,n,n,s,o,o][l]),b:hr(255*[o,o,u,n,n,s][l]),a:hr(i,2)}};var oR=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?sR({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}};var sR=function(e){var t=e.r,r=e.g,n=e.b,i=e.a,a=Math.max(t,r,n),o=a-Math.min(t,r,n),s=o?a===t?(r-n)/o:a===r?2+(n-t)/o:4+(t-r)/o:0;return{h:hr(60*(s<0?s+6:s)),s:hr(a?o/a*100:0),v:hr(a/255*100),a:i}};var lR=$e.memo(function(e){var t=e.hue,r=e.onChange,n=Nd(["react-colorful__hue",e.className]);return $e.createElement("div",{className:n},$e.createElement(Ng,{onMove:function(i){r({h:360*i.left})},onKey:function(i){r({h:Es(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":hr(t),"aria-valuemax":"360","aria-valuemin":"0"},$e.createElement(Rg,{className:"react-colorful__hue-pointer",left:t/360,color:Pg({h:t,s:100,v:100,a:1})})))}),uR=$e.memo(function(e){var t=e.hsva,r=e.onChange,n={backgroundColor:Pg({h:t.h,s:100,v:100,a:1})};return $e.createElement("div",{className:"react-colorful__saturation",style:n},$e.createElement(Ng,{onMove:function(i){r({s:100*i.left,v:100-100*i.top})},onKey:function(i){r({s:Es(t.s+100*i.left,0,100),v:Es(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+hr(t.s)+"%, Brightness "+hr(t.v)+"%"},$e.createElement(Rg,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Pg(t)})))}),cR=function(e,t){if(e===t)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0},dR=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function fR(e,t,r){var n=Og(r),i=Ne(function(){return e.toHsva(t)}),a=i[0],o=i[1],s=Fe({color:t,hsva:a});Ae(function(){if(!e.equal(t,s.current.color)){var l=e.toHsva(t);s.current={hsva:l,color:t},o(l)}},[t,e]),Ae(function(){var l;cR(a,s.current.hsva)||e.equal(l=e.fromHsva(a),s.current.color)||(s.current={hsva:a,color:l},n(l))},[a,e,n]);var u=Ye(function(l){o(function(c){return Object.assign({},c,l)})},[]);return[a,u]}var hR,mR=typeof window!="undefined"?Ai:Ae,pR=function(){return hR||(typeof __webpack_nonce__!="undefined"?__webpack_nonce__:void 0)};var _x=new Map,gR=function(e){mR(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!_x.has(t)){var r=t.createElement("style");r.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,_x.set(t,r);var n=pR();n&&r.setAttribute("nonce",n),t.head.appendChild(r)}},[])};var yR=function(e){var t=e.className,r=e.hsva,n=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+Ag(Object.assign({},r,{a:0}))+", "+Ag(Object.assign({},r,{a:1}))+")"},a=Nd(["react-colorful__alpha",t]),o=hr(100*r.a);return $e.createElement("div",{className:a},$e.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),$e.createElement(Ng,{onMove:function(s){n({a:s.left})},onKey:function(s){n({a:Es(r.a+s.left)})},"aria-label":"Alpha","aria-valuetext":o+"%","aria-valuenow":o,"aria-valuemin":"0","aria-valuemax":"100"},$e.createElement(Rg,{className:"react-colorful__alpha-pointer",left:r.a,color:Ag(r)})))},vR=function(e){var t=e.className,r=e.colorModel,n=e.color,i=n===void 0?r.defaultColor:n,a=e.onChange,o=Mx(e,["className","colorModel","color","onChange"]),s=Fe(null);gR(s);var u=fR(r,i,a),l=u[0],c=u[1],d=Nd(["react-colorful",t]);return $e.createElement("div",Pd({},o,{ref:s,className:d}),$e.createElement(uR,{hsva:l,onChange:c}),$e.createElement(lR,{hue:l.h,onChange:c}),$e.createElement(yR,{hsva:l,onChange:c,className:"react-colorful__last-control"}))};var wR={defaultColor:"rgba(0, 0, 0, 1)",toHsva:oR,fromHsva:function(e){var t=aR(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:dR},Fx=function(e){return $e.createElement(vR,Pd({},e,{colorModel:wR}))};function Ix(e){let t=ci(e);if(!t.isValid())return null;let r=t.toRgb();return{rgba:`rgba(${r.r}, ${r.g}, ${r.b}, ${r.a})`,hexa:t.toHex()}}function zl({color:e,setColor:t,defaultColor:r}){let[n,i]=Ne(e||r),[a,o]=Ne(e||r),[s,u]=Ne(!1),l=Ye(d=>{let m=Ix(d||r);m&&(o(m.hexa),i(m.rgba),t(m.rgba))},[t]);Ae(()=>{if(!e||!r)return;let d=Ix(e||r);d&&(i(d.rgba),o(d.hexa))},[]);let c=ws(()=>{u(!1)});return E("div",{ref:c,className:$("color-picker-wrapper"),children:[s&&E("div",{className:$("color-picker"),children:E(Fx,{color:n,onChange:l})}),E("input",{type:"text",value:a,onChange:d=>l(d.target.value),onFocus:()=>{u(!0)}})]})}function bR({tagColorKey:e,deleteKey:t,updateKey:r,defaultColors:n}){return E("div",{className:$("setting-item-wrapper"),children:E("div",{className:$("setting-item"),children:[E("div",{className:`${$("setting-controls-wrapper")} ${$("tag-color-input")}`,children:[E("div",{className:$("setting-input-wrapper"),children:[E("div",{children:[E("div",{className:$("setting-item-label"),children:R("Tag")}),E("input",{type:"text",placeholder:"#tag",value:e.tagKey,onChange:i=>{let a=i.currentTarget.value;r(a[0]==="#"?a:"#"+a,e.color,e.backgroundColor)}})]}),E("div",{children:[E("div",{className:$("setting-item-label"),children:R("Background color")}),E(zl,{color:e.backgroundColor,setColor:i=>{r(e.tagKey,e.color,i)},defaultColor:n.backgroundColor})]}),E("div",{children:[E("div",{className:$("setting-item-label"),children:R("Text color")}),E(zl,{color:e.color,setColor:i=>{r(e.tagKey,i,e.backgroundColor)},defaultColor:n.color})]})]}),E("div",{className:$("setting-toggle-wrapper"),children:E("div",{children:E("div",{className:$("item-tags"),children:[E("a",{className:`tag ${$("item-tag")}`,children:"#tag1"}),E("a",{className:`tag ${$("item-tag")}`,style:{"--tag-color":e.color,"--tag-background":e.backgroundColor},children:e.tagKey||"#tag"}),E("a",{className:`tag ${$("item-tag")}`,children:"#tag2"})]})})})]}),E("div",{className:$("setting-button-wrapper"),children:E("div",{className:"clickable-icon",onClick:t,"aria-label":R("Delete"),children:E(Ut,{name:"lucide-trash-2"})})})]})})}function DR({dataKeys:e,onChange:t}){let[r,n]=Ne(e),i=Re(()=>{let l=createDiv($("item-tags")),c=l.createEl("a",$("item-tag"));l.style.position="absolute",l.style.visibility="hidden",activeDocument.body.append(l);let d=activeWindow.getComputedStyle(c),m=d.getPropertyValue("color").trim(),h=d.getPropertyValue("background-color").trim();return l.remove(),{color:m,backgroundColor:h}},[]),a=l=>{t(l),n(l)},o=()=>{a((0,Rd.default)(r,{$push:[{...Bc,id:et(),data:{tagKey:"",color:"",backgroundColor:""}}]}))},s=l=>{a((0,Rd.default)(r,{$splice:[[l,1]]}))},u=l=>(c,d,m)=>{a((0,Rd.default)(r,{[l]:{data:{tagKey:{$set:c},color:{$set:d},backgroundColor:{$set:m}}}}))};return E("div",{className:$("tag-color-input-wrapper"),children:[E("div",{className:"setting-item-info",children:[E("div",{className:"setting-item-name",children:R("Tag colors")}),E("div",{className:"setting-item-description",children:R("Set colors for tags displayed in cards.")})]}),E("div",{children:r.map((l,c)=>E(bR,{tagColorKey:l.data,deleteKey:()=>s(c),updateKey:u(c),defaultColors:i},l.id))}),E("button",{className:$("add-tag-color-button"),onClick:()=>{o()},children:R("Add tag color")})]})}function Ax(e,t,r){Li(E(DR,{dataKeys:t,onChange:r,portalContainer:ha(e)}),e)}function Ox(e){Pi(e)}function SR({dateColorKey:e,deleteKey:t,updateKey:r,defaultColors:n,getTimeFormat:i,getDateFormat:a}){let o="between";return e.isToday&&(o="today"),e.isBefore&&(o="before"),e.isAfter&&(o="after"),E("div",{className:$("setting-item-wrapper"),children:E("div",{className:$("setting-item"),children:[E("div",{className:`${$("setting-controls-wrapper")} ${$("tag-color-input")}`,children:[E("div",{children:[E("div",{children:E("div",{className:$("setting-item-label"),children:R("Date is")})}),E("div",{className:$("date-color-config"),children:[E("select",{className:"dropdown",defaultValue:o,onChange:s=>{let u={...e};switch(delete u.isAfter,delete u.isBefore,delete u.isToday,s.target.value){case"today":u.isToday=!0;break;case"before":u.isBefore=!0;break;case"after":u.isAfter=!0;break}r(u)},children:[E("option",{value:"between",children:R("Between now and")}),E("option",{value:"today",children:R("Today")}),E("option",{value:"after",children:R("After now")}),E("option",{value:"before",children:R("Before now")})]}),!e.isToday&&!e.isAfter&&!e.isBefore&&E(ct,{children:[E("input",{type:"number",value:e.distance,onChange:s=>{r({...e,distance:parseInt(s.target.value)})}}),E("select",{className:"dropdown",defaultValue:e.unit,onChange:s=>{r({...e,unit:s.target.value})},children:[E("option",{value:"hours",children:"Hours"}),E("option",{value:"days",children:"Days"}),E("option",{value:"weeks",children:"Weeks"}),E("option",{value:"months",children:"Months"})]}),E("select",{className:"dropdown",defaultValue:e.direction,onChange:s=>{r({...e,direction:s.target.value})},children:[E("option",{value:"after",children:R("After now")}),E("option",{value:"before",children:R("Before now")})]})]})]}),E("div",{className:$("date-color-config"),children:[E("div",{children:[E("div",{className:$("setting-item-label"),children:R("Background color")}),E(zl,{color:e.backgroundColor,setColor:s=>{r({...e,backgroundColor:s})},defaultColor:n.backgroundColor})]}),E("div",{children:[E("div",{className:$("setting-item-label"),children:R("Text color")}),E(zl,{color:e.color,setColor:s=>{r({...e,color:s})},defaultColor:n.color})]})]})]}),E("div",{children:E("div",{className:$("date-color-wrapper"),children:E("div",{className:$("item-metadata"),children:E("span",{style:{"--date-color":e.color,"--date-background-color":e.backgroundColor},className:Ge([$("item-metadata-date-wrapper"),$("date"),{"has-background":!!(e!=null&&e.backgroundColor)}]),children:[E("span",{className:$("item-metadata-date is-button"),children:(0,Hg.moment)().format(a())})," ",E("span",{className:$("item-metadata-time is-button"),children:(0,Hg.moment)().format(i())})]})})})})]}),E("div",{className:$("setting-button-wrapper"),children:E("div",{className:"clickable-icon",onClick:t,"aria-label":R("Delete"),children:E(Ut,{name:"lucide-trash-2"})})})]})})}function ER({dataKeys:e,onChange:t,getTimeFormat:r,getDateFormat:n}){let[i,a]=$e.useState(e),o=$e.useMemo(()=>{let d=createDiv($("item-metadata")),m=d.createSpan($("item-metadata-date"));d.style.position="absolute",d.style.visibility="hidden",activeDocument.body.append(d);let h=activeWindow.getComputedStyle(m),g=h.getPropertyValue("color").trim(),y=h.getPropertyValue("background-color").trim();return d.remove(),{color:g,backgroundColor:y}},[]),s=d=>{t(d),a(d)},u=()=>{s((0,Hd.default)(i,{$push:[{...Vc,id:et(),data:{isToday:!1,distance:1,unit:"days",direction:"after"}}]}))},l=d=>{s((0,Hd.default)(i,{$splice:[[d,1]]}))},c=d=>m=>{s((0,Hd.default)(i,{[d]:{data:{$set:m}}}))};return E("div",{className:$("date-color-input-wrapper"),children:[E("div",{className:"setting-item-info",children:[E("div",{className:"setting-item-name",children:R("Display date colors")}),E("div",{className:"setting-item-description",children:R("Set colors for dates displayed in cards based on the rules below.")})]}),E("div",{children:i.map((d,m)=>E(SR,{dateColorKey:d.data,deleteKey:()=>l(m),updateKey:c(m),defaultColors:o,getTimeFormat:r,getDateFormat:n},d.id))}),E("button",{className:$("add-tag-color-button"),onClick:u,children:R("Add date color")})]})}function Lx(e,t,r,n,i){$e.render(E(ER,{dataKeys:t,onChange:r,portalContainer:ha(e),getDateFormat:n,getTimeFormat:i}),e)}function Px(e){$e.unmountComponentAtNode(e)}var fo=Ct(ln());function ks({id:e,children:t}){let r=$e.useContext(sl),n=$e.useMemo(()=>e||et(),[e]);return $e.useEffect(()=>()=>{r.unmountScope(e)},[e]),E(ma.Provider,{value:n,children:t})}function Nx({isStatic:e,itemIndex:t,item:r,toggleShouldHideLabel:n,toggleContainsMarkdown:i,deleteKey:a,updateKey:o,updateLabel:s}){let u=Fe(null),l=Fe(null),c=Fe(null),d=Ta(l,c),m=E("div",{className:$("setting-controls-wrapper"),children:[E("div",{className:$("setting-input-wrapper"),children:[E("div",{children:[E("div",{className:$("setting-item-label"),children:R("Metadata key")}),E("input",{type:"text",value:r.data.metadataKey,onChange:h=>o(h.target.value)})]}),E("div",{children:[E("div",{className:$("setting-item-label"),children:R("Display label")}),E("input",{type:"text",value:r.data.label,onChange:h=>s(h.target.value)})]})]}),E("div",{className:$("setting-toggle-wrapper"),children:[E("div",{children:[E("div",{className:`checkbox-container ${r.data.shouldHideLabel?"is-enabled":""}`,onClick:n,"aria-label":R("Hide label")}),E("div",{className:$("setting-item-label"),children:R("Hide label")})]}),E("div",{children:[E("div",{className:`checkbox-container ${r.data.containsMarkdown?"is-enabled":""}`,onClick:i,"aria-label":R("Field contains markdown")}),E("div",{className:$("setting-item-label"),children:R("Field contains markdown")})]})]})]});return E("div",{ref:l,className:$("setting-item-wrapper"),children:E("div",{ref:u,className:$("setting-item"),children:[e?m:E(ei,{elementRef:u,measureRef:l,id:r.id,index:t,data:r,children:m}),E("div",{className:$("setting-button-wrapper"),children:[E("div",{className:"clickable-icon",onClick:a,"aria-label":R("Delete"),children:E(Ut,{name:"lucide-trash-2"})}),E("div",{className:"mobile-option-setting-drag-icon clickable-icon","aria-label":R("Drag to rearrange"),ref:d,children:E(Ut,{name:"lucide-grip-horizontal"})})]})]})})}function kR({onChange:e,inputValue:t,keys:r,setKeys:n}){let i=a=>{e(a),n(a)};return{updateKey:a=>o=>{i((0,fo.default)(r,{[a]:{data:{metadataKey:{$set:o}}}}))},updateLabel:a=>o=>{i((0,fo.default)(r,{[a]:{data:{label:{$set:o}}}}))},toggleShouldHideLabel:a=>()=>{i((0,fo.default)(r,{[a]:{data:{$toggle:["shouldHideLabel"]}}}))},toggleContainsMarkdown:a=>()=>{i((0,fo.default)(r,{[a]:{data:{$toggle:["containsMarkdown"]}}}))},deleteKey:a=>()=>{i((0,fo.default)(r,{$splice:[[a,1]]}))},newKey:()=>{i((0,fo.default)(r,{$push:[{...Rc,id:et(),data:{metadataKey:t,label:"",shouldHideLabel:!1,containsMarkdown:!1}}]}))},moveKey:(a,o)=>{let s=a.getPath(),u=o.getPath(),l=s[s.length-1],c=u[u.length-1];if(l===c)return;let d=r.slice(),[m]=d.splice(l,1);d.splice(c,0,m),i(d)}}}var xR=[ft.MetadataSetting];function CR({keys:e,portalContainer:t}){return Oi(E(Ds,{children:(r,n)=>{let a=r.getPath()[0],o=e[a];return E("div",{className:$("drag-container"),style:n,children:E(Nx,{item:o,itemIndex:a,updateKey:Mr,updateLabel:Mr,toggleShouldHideLabel:Mr,toggleContainsMarkdown:Mr,deleteKey:Mr,isStatic:!0})})}}),t)}function _R({scrollEl:e}){let t=Ee(cn);return Ae(()=>{let r=0,n=()=>{e.win.clearTimeout(r),r=e.win.setTimeout(()=>{t.hitboxEntities.forEach(i=>{i.recalcInitial()})},100)};return e.addEventListener("scroll",n,{passive:!0,capture:!1}),()=>{e.removeEventListener("scroll",n)}},[e,t]),null}function MR(e){let[t,r]=Ne(e.dataKeys),[n,i]=Ne(""),{getShouldIMEBlockAction:a,...o}=Ou(),s=Dn(e.scrollEl),{updateKey:u,updateLabel:l,toggleShouldHideLabel:c,toggleContainsMarkdown:d,deleteKey:m,newKey:h,moveKey:g}=kR({onChange:e.onChange,inputValue:n,keys:t,setKeys:r,win:s});return E(ct,{children:[E(bs,{win:s,onDrop:g,children:[E(_R,{scrollEl:e.scrollEl}),E(ks,{children:E(Ia,{axis:"vertical",children:[t.map((y,v)=>E(Nx,{item:y,itemIndex:v,updateKey:u(v),updateLabel:l(v),toggleShouldHideLabel:c(v),toggleContainsMarkdown:d(v),deleteKey:m(v)},y.id)),E(Fa,{accepts:xR,index:t.length})]})}),E(CR,{keys:t,portalContainer:e.portalContainer})]}),E("div",{className:$("setting-key-input-wrapper"),children:[E("input",{placeholder:R("Metadata key"),type:"text",value:n,onChange:y=>i(y.target.value),onKeyDown:y=>{if(!a()){if(y.key==="Enter"){h(),i("");return}y.key==="Escape"&&(i(""),y.target.blur())}},...o}),E("button",{onClick:()=>{h(),i("")},children:R("Add key")})]})]})}function Rx(e,t,r,n){Li(E(MR,{dataKeys:r,scrollEl:t,onChange:n,portalContainer:ha(e)}),e)}function Hx(e){Pi(e)}var Bd=Ct(ln());function Bx({isStatic:e,tagIndex:t,tag:r,deleteTag:n,updateTag:i}){let a=Fe(null),o=Fe(null),s=Fe(null),u=Ta(o,s),l=E("div",{className:$("setting-controls-wrapper"),children:E("div",{className:$("setting-input-wrapper"),children:E("div",{children:E("input",{type:"text",value:r.data.tag,onChange:c=>i(c.target.value)})})})});return E("div",{ref:o,className:$("setting-item-wrapper"),children:E("div",{ref:a,className:$("setting-item"),children:[e?l:E(ei,{elementRef:a,measureRef:o,id:r.id,index:t,data:r,children:l}),E("div",{className:$("setting-button-wrapper"),children:[E("div",{className:"clickable-icon",onClick:n,"aria-label":R("Delete"),children:E(Ut,{name:"lucide-trash-2"})}),E("div",{className:"mobile-option-setting-drag-icon clickable-icon","aria-label":R("Drag to rearrange"),ref:u,children:E(Ut,{name:"lucide-grip-horizontal"})})]})]})})}function TR({onChange:e,inputValue:t,tags:r,setTags:n}){let i=a=>{e(a),n(a)};return{updateTag:a=>o=>{i((0,Bd.default)(r,{[a]:{data:{tag:{$set:o}}}}))},deleteTag:a=>()=>{i((0,Bd.default)(r,{$splice:[[a,1]]}))},newTag:()=>{i((0,Bd.default)(r,{$push:[{...Hc,id:et(),data:{tag:t}}]}))},moveTag:(a,o)=>{let s=a.getPath(),u=o.getPath(),l=s[s.length-1],c=u[u.length-1];if(l===c)return;let d=r.slice(),[m]=d.splice(l,1);d.splice(c,0,m),i(d)}}}var FR=[ft.TagSortSetting];function IR({keys:e,portalContainer:t}){return Oi(E(Ds,{children:(r,n)=>{let a=r.getPath()[0],o=e[a];return E("div",{className:Ge([$("drag-container"),$("tag-sort-input-wrapper")]),style:n,children:E(Bx,{tag:o,tagIndex:a,updateTag:Mr,deleteTag:Mr,isStatic:!0})})}}),t)}function AR({scrollEl:e}){let t=Ee(cn);return Ae(()=>{let r=0,n=()=>{e.win.clearTimeout(r),r=e.win.setTimeout(()=>{t==null||t.hitboxEntities.forEach(i=>{i.recalcInitial()})},100)};return e.addEventListener("scroll",n,{passive:!0,capture:!1}),()=>{e.removeEventListener("scroll",n)}},[e,t]),null}function OR(e){let[t,r]=Ne(e.tags),[n,i]=Ne(""),{getShouldIMEBlockAction:a,...o}=Ou(),s=Dn(e.scrollEl),{updateTag:u,deleteTag:l,newTag:c,moveTag:d}=TR({onChange:e.onChange,inputValue:n,tags:t,setTags:r,win:s});return E("div",{className:$("tag-sort-input-wrapper"),children:[E("div",{className:"setting-item-info",children:[E("div",{className:"setting-item-name",children:R("Tag sort order")}),E("div",{className:"setting-item-description",children:R("Set an explicit sort order for the specified tags.")})]}),E("div",{children:E(bs,{win:s,onDrop:d,children:[E(AR,{scrollEl:e.scrollEl}),E(ks,{children:E(Ia,{axis:"vertical",children:[t.map((m,h)=>E(Bx,{tag:m,tagIndex:h,updateTag:u(h),deleteTag:l(h)},m.id)),E(Fa,{accepts:FR,index:t.length})]})}),E(IR,{keys:t,portalContainer:e.portalContainer})]})}),E("div",{className:$("setting-key-input-wrapper"),children:[E("input",{placeholder:"#tag",type:"text",value:n,onChange:m=>{let h=m.target.value;i(h[0]==="#"?h:"#"+h)},onKeyDown:m=>{if(!a()){if(m.key==="Enter"){c(),i("");return}m.key==="Escape"&&(i(""),m.target.blur())}},...o}),E("button",{onClick:()=>{c(),i("")},children:R("Add tag")})]})]})}function Vx(e,t,r,n){Li(E(OR,{tags:r,scrollEl:t,onChange:n,portalContainer:ha(e)}),e)}function $x(e){Pi(e)}var Ux=/^\d+(?:\.\d+)?$/,Yx=new Set([_t,"append-archive-date","archive-date-format","archive-date-separator","archive-with-date","date-colors","date-display-format","date-format","date-picker-week-start","date-time-display-format","date-trigger","full-list-lane-width","hide-card-count","inline-metadata-position","lane-width","link-date-to-daily-note","list-collapse","max-archive-size","metadata-keys","move-dates","move-tags","move-task-metadata","new-card-insertion-method","new-line-trigger","new-note-folder","new-note-template","show-add-list","show-archive-all","show-board-settings","show-checkboxes","show-relative-date","show-search","show-set-view","show-view-as-markdown","table-sizing","tag-action","tag-colors","tag-sort","time-format","time-trigger"]),Vd=class{constructor(t,r,n){this.cleanupFns=[];this.applyDebounceTimer=0;this.app=t.app,this.plugin=t,this.config=r,this.settings=n}applySettingsUpdate(t){this.win.clearTimeout(this.applyDebounceTimer),this.applyDebounceTimer=this.win.setTimeout(()=>{this.settings=(0,Wx.default)(this.settings,t),this.config.onSettingsChange(this.settings)},1e3)}getSetting(t,r){return r?[this.settings[t],this.plugin.settings[t]]:[this.settings[t],null]}constructUI(t,r,n){this.win=t.win;let{templateFiles:i,vaultFolders:a,templateWarning:o}=hx(this.app);t.createEl("h3",{text:r}),n?t.createEl("p",{text:R("These settings will take precedence over the default Kanban board settings.")}):t.createEl("p",{text:R("Set the default Kanban board settings. Settings can be overridden on a board-by-board basis.")}),new rt.Setting(t).setName(R("Display card checkbox")).setDesc(R("When toggled, a checkbox will be displayed with each card")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-checkboxes",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"show-checkboxes":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-checkboxes",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-checkboxes"]})})})}),new rt.Setting(t).setName(R("New line trigger")).setDesc(R("Select whether Enter or Shift+Enter creates a new line. The opposite of what you choose will create and complete editing of cards and lists.")).addDropdown(s=>{s.addOption("shift-enter",R("Shift + Enter")),s.addOption("enter",R("Enter"));let[u,l]=this.getSetting("new-line-trigger",n);s.setValue(u||l||"shift-enter"),s.onChange(c=>{this.applySettingsUpdate({"new-line-trigger":{$set:c}})})}),new rt.Setting(t).setName(R("Prepend / append new cards")).setDesc(R("This setting controls whether new cards are added to the beginning or end of the list.")).addDropdown(s=>{s.addOption("prepend",R("Prepend")),s.addOption("prepend-compact",R("Prepend (compact)")),s.addOption("append",R("Append"));let[u,l]=this.getSetting("new-card-insertion-method",n);s.setValue(u||l||"append"),s.onChange(c=>{this.applySettingsUpdate({"new-card-insertion-method":{$set:c}})})}),new rt.Setting(t).setName(R("Hide card counts in list titles")).setDesc(R("When toggled, card counts are hidden from the list title")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("hide-card-count",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"hide-card-count":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("hide-card-count",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["hide-card-count"]})})})}),new rt.Setting(t).setName(R("List width")).setDesc(R("Enter a number to set the list width in pixels.")).addText(s=>{let[u,l]=this.getSetting("lane-width",n);s.inputEl.setAttr("type","number"),s.inputEl.placeholder=`${l||"272"} (default)`,s.inputEl.value=u?u.toString():"",s.onChange(c=>{if(c&&Ux.test(c)){s.inputEl.removeClass("error"),this.applySettingsUpdate({"lane-width":{$set:parseInt(c)}});return}c&&s.inputEl.addClass("error"),this.applySettingsUpdate({$unset:["lane-width"]})})}),new rt.Setting(t).setName(R("Expand lists to full width in list view")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("full-list-lane-width",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"full-list-lane-width":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("full-list-lane-width",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["full-list-lane-width"]})})})}),new rt.Setting(t).setName(R("Maximum number of archived cards")).setDesc(R("Archived cards can be viewed in markdown mode. This setting will begin removing old cards once the limit is reached. Setting this value to -1 will allow a board's archive to grow infinitely.")).addText(s=>{let[u,l]=this.getSetting("max-archive-size",n);s.inputEl.setAttr("type","number"),s.inputEl.placeholder=`${l||"-1"} (default)`,s.inputEl.value=u?u.toString():"",s.onChange(c=>{if(c&&Ux.test(c)){s.inputEl.removeClass("error"),this.applySettingsUpdate({"max-archive-size":{$set:parseInt(c)}});return}c&&s.inputEl.addClass("error"),this.applySettingsUpdate({$unset:["max-archive-size"]})})}),new rt.Setting(t).setName(R("Note template")).setDesc(R("This template will be used when creating new notes from Kanban cards.")).then(Mg({choices:i,key:"new-note-template",warningText:o,local:n,placeHolderStr:R("No template"),manager:this})),new rt.Setting(t).setName(R("Note folder")).setDesc(R("Notes created from Kanban cards will be placed in this folder. If blank, they will be placed in the default location for this vault.")).then(Mg({choices:a,key:"new-note-folder",local:n,placeHolderStr:R("Default folder"),manager:this})),t.createEl("h4",{text:R("Tags")}),new rt.Setting(t).setName(R("Move tags to card footer")).setDesc(R("When toggled, tags will be displayed in the card's footer instead of the card's body.")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("move-tags",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"move-tags":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("move-tags",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["move-tags"]})})})}),new rt.Setting(t).setName(R("Tag click action")).setDesc(R("This setting controls whether clicking the tags displayed below the card title opens the Obsidian search or the Kanban board search.")).addDropdown(s=>{s.addOption("kanban",R("Search Kanban Board")),s.addOption("obsidian",R("Search Obsidian Vault"));let[u,l]=this.getSetting("tag-action",n);s.setValue(u||l||"obsidian"),s.onChange(c=>{this.applySettingsUpdate({"tag-action":{$set:c}})})}),new rt.Setting(t).then(s=>{let[u,l]=this.getSetting("tag-sort",n),c=(u||l||[]).map(d=>({...Hc,id:et(),data:d}));Vx(s.settingEl,t,c,d=>this.applySettingsUpdate({"tag-sort":{$set:d.map(m=>m.data)}})),this.cleanupFns.push(()=>{s.settingEl&&$x(s.settingEl)})}),new rt.Setting(t).then(s=>{let[u]=this.getSetting("tag-colors",n),l=(u||[]).map(c=>({...Bc,id:et(),data:c}));Ax(s.settingEl,l,c=>this.applySettingsUpdate({"tag-colors":{$set:c.map(d=>d.data)}})),this.cleanupFns.push(()=>{s.settingEl&&Ox(s.settingEl)})}),t.createEl("h4",{text:R("Date & Time")}),new rt.Setting(t).setName(R("Move dates to card footer")).setDesc(R("When toggled, dates will be displayed in the card's footer instead of the card's body.")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("move-dates",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"move-dates":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("move-dates",n);u.setValue(c!=null?c:!0),this.applySettingsUpdate({$unset:["move-dates"]})})})}),new rt.Setting(t).setName(R("Date trigger")).setDesc(R("When this is typed, it will trigger the date selector")).addText(s=>{let[u,l]=this.getSetting("date-trigger",n);(u||l)&&s.setValue(u||l),s.setPlaceholder(l||Ad),s.onChange(c=>{c?this.applySettingsUpdate({"date-trigger":{$set:c}}):this.applySettingsUpdate({$unset:["date-trigger"]})})}),new rt.Setting(t).setName(R("Time trigger")).setDesc(R("When this is typed, it will trigger the time selector")).addText(s=>{let[u,l]=this.getSetting("time-trigger",n);(u||l)&&s.setValue(u||l),s.setPlaceholder(l||Od),s.onChange(c=>{c?this.applySettingsUpdate({"time-trigger":{$set:c}}):this.applySettingsUpdate({$unset:["time-trigger"]})})}),new rt.Setting(t).setName(R("Date format")).then(s=>{s.addMomentFormat(u=>{s.descEl.appendChild(createFragment(m=>{m.appendText(R("This format will be used when saving dates in markdown.")),m.createEl("br"),m.appendText(R("For more syntax, refer to")+" "),m.createEl("a",{text:R("format reference"),href:"https://momentjs.com/docs/#/displaying/format/"},h=>{h.setAttr("target","_blank")}),m.createEl("br"),m.appendText(R("Your current syntax looks like this")+": "),u.setSampleEl(m.createEl("b",{cls:"u-pop"})),m.createEl("br")}));let[l,c]=this.getSetting("date-format",n),d=ja(this.app);u.setPlaceholder(d),u.setDefaultFormat(d),(l||c)&&u.setValue(l||c),u.onChange(m=>{m?this.applySettingsUpdate({"date-format":{$set:m}}):this.applySettingsUpdate({$unset:["date-format"]})})})}),new rt.Setting(t).setName(R("Time format")).then(s=>{s.addMomentFormat(u=>{s.descEl.appendChild(createFragment(m=>{m.appendText(R("For more syntax, refer to")+" "),m.createEl("a",{text:R("format reference"),href:"https://momentjs.com/docs/#/displaying/format/"},h=>{h.setAttr("target","_blank")}),m.createEl("br"),m.appendText(R("Your current syntax looks like this")+": "),u.setSampleEl(m.createEl("b",{cls:"u-pop"})),m.createEl("br")}));let[l,c]=this.getSetting("time-format",n),d=Ho(this.app);u.setPlaceholder(d),u.setDefaultFormat(d),(l||c)&&u.setValue(l||c),u.onChange(m=>{m?this.applySettingsUpdate({"time-format":{$set:m}}):this.applySettingsUpdate({$unset:["time-format"]})})})}),new rt.Setting(t).setName(R("Date display format")).then(s=>{s.addMomentFormat(u=>{s.descEl.appendChild(createFragment(m=>{m.appendText(R("This format will be used when displaying dates in Kanban cards.")),m.createEl("br"),m.appendText(R("For more syntax, refer to")+" "),m.createEl("a",{text:R("format reference"),href:"https://momentjs.com/docs/#/displaying/format/"},h=>{h.setAttr("target","_blank")}),m.createEl("br"),m.appendText(R("Your current syntax looks like this")+": "),u.setSampleEl(m.createEl("b",{cls:"u-pop"})),m.createEl("br")}));let[l,c]=this.getSetting("date-display-format",n),d=ja(this.app);u.setPlaceholder(d),u.setDefaultFormat(d),(l||c)&&u.setValue(l||c),u.onChange(m=>{m?this.applySettingsUpdate({"date-display-format":{$set:m}}):this.applySettingsUpdate({$unset:["date-display-format"]})})})}),new rt.Setting(t).setName(R("Show relative date")).setDesc(R("When toggled, cards will display the distance between today and the card's date. eg. 'In 3 days', 'A month ago'. Relative dates will not be shown for dates from the Tasks and Dataview plugins.")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-relative-date",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"show-relative-date":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-relative-date",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-relative-date"]})})})}),new rt.Setting(t).setName(R("Link dates to daily notes")).setDesc(R("When toggled, dates will link to daily notes. Eg. [[2021-04-26]]")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("link-date-to-daily-note",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"link-date-to-daily-note":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("link-date-to-daily-note",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["link-date-to-daily-note"]})})})}),new rt.Setting(t).then(s=>{let[u]=this.getSetting("date-colors",n),l=(u||[]).map(c=>({...Vc,id:et(),data:c}));Lx(s.settingEl,l,c=>this.applySettingsUpdate({"date-colors":{$set:c.map(d=>d.data)}}),()=>{let[c,d]=this.getSetting("date-display-format",n),m=ja(this.app);return c||d||m},()=>{let[c,d]=this.getSetting("time-format",n),m=Ho(this.app);return c||d||m}),this.cleanupFns.push(()=>{s.settingEl&&Px(s.settingEl)})}),new rt.Setting(t).setName(R("Add date and time to archived cards")).setDesc(R("When toggled, the current date and time will be added to the card title when it is archived. Eg. - [ ] 2021-05-14 10:00am My card title")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("archive-with-date",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"archive-with-date":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("archive-with-date",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["archive-with-date"]})})})}),new rt.Setting(t).setName(R("Add archive date/time after card title")).setDesc(R("When toggled, the archived date/time will be added after the card title, e.g.- [ ] My card title 2021-05-14 10:00am. By default, it is inserted before the title.")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("append-archive-date",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"append-archive-date":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("append-archive-date",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["append-archive-date"]})})})}),new rt.Setting(t).setName(R("Archive date/time separator")).setDesc(R("This will be used to separate the archived date/time from the title")).addText(s=>{let[u,l]=this.getSetting("archive-date-separator",n);s.inputEl.placeholder=l?`${l} (default)`:"",s.inputEl.value=u||"",s.onChange(c=>{if(c){this.applySettingsUpdate({"archive-date-separator":{$set:c}});return}this.applySettingsUpdate({$unset:["archive-date-separator"]})})}),new rt.Setting(t).setName(R("Archive date/time format")).then(s=>{s.addMomentFormat(u=>{s.descEl.appendChild(createFragment(I=>{I.appendText(R("For more syntax, refer to")+" "),I.createEl("a",{text:R("format reference"),href:"https://momentjs.com/docs/#/displaying/format/"},C=>{C.setAttr("target","_blank")}),I.createEl("br"),I.appendText(R("Your current syntax looks like this")+": "),u.setSampleEl(I.createEl("b",{cls:"u-pop"})),I.createEl("br")}));let[l,c]=this.getSetting("archive-date-format",n),[d,m]=this.getSetting("date-format",n),h=d||m||ja(this.app),[g,y]=this.getSetting("time-format",n),v=g||y||Ho(this.app),D=`${h} ${v}`;u.setPlaceholder(D),u.setDefaultFormat(D),(l||c)&&u.setValue(l||c),u.onChange(I=>{I?this.applySettingsUpdate({"archive-date-format":{$set:I}}):this.applySettingsUpdate({$unset:["archive-date-format"]})})})}),new rt.Setting(t).setName(R("Calendar: first day of week")).setDesc(R("Override which day is used as the start of the week")).addDropdown(s=>{s.addOption("",R("default")),s.addOption("0",R("Sunday")),s.addOption("1",R("Monday")),s.addOption("2",R("Tuesday")),s.addOption("3",R("Wednesday")),s.addOption("4",R("Thursday")),s.addOption("5",R("Friday")),s.addOption("6",R("Saturday"));let[u,l]=this.getSetting("date-picker-week-start",n);s.setValue((u==null?void 0:u.toString())||(l==null?void 0:l.toString())||""),s.onChange(c=>{c?this.applySettingsUpdate({"date-picker-week-start":{$set:Number(c)}}):this.applySettingsUpdate({$unset:["date-picker-week-start"]})})}),t.createEl("br"),t.createEl("h4",{text:R("Inline Metadata")}),new rt.Setting(t).setName(R("Inline metadata position")).setDesc(R("Controls where the inline metadata (from the Dataview plugin) will be displayed.")).then(s=>{let u;s.addDropdown(l=>{u=l,l.addOption("body",R("Card body")),l.addOption("footer",R("Card footer")),l.addOption("metadata-table",R("Merge with linked page metadata"));let[c,d]=this.getSetting("inline-metadata-position",n);l.setValue((c==null?void 0:c.toString())||(d==null?void 0:d.toString())||Ul),l.onChange(m=>{m?this.applySettingsUpdate({"inline-metadata-position":{$set:m}}):this.applySettingsUpdate({$unset:["inline-metadata-position"]})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("inline-metadata-position",n);u.setValue(c||Ul),this.applySettingsUpdate({$unset:["inline-metadata-position"]})})})}),new rt.Setting(t).setName(R("Move task data to card footer")).setDesc(R("When toggled, task data (from the Tasks plugin) will be displayed in the card's footer instead of the card's body.")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("move-task-metadata",n);c!==void 0?l.setValue(c):d!==void 0&&l.setValue(d),l.onChange(m=>{this.applySettingsUpdate({"move-task-metadata":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("move-task-metadata",n);u.setValue(c!=null?c:!0),this.applySettingsUpdate({$unset:["move-task-metadata"]})})})}),t.createEl("br"),t.createEl("h4",{text:R("Linked Page Metadata")}),t.createEl("p",{cls:$("metadata-setting-desc"),text:R("Display metadata for the first note linked within a card. Specify which metadata keys to display below. An optional label can be provided, and labels can be hidden altogether.")}),new rt.Setting(t).then(s=>{s.settingEl.addClass($("draggable-setting-container"));let[u]=this.getSetting("metadata-keys",n),l=(u||[]).map(c=>({...Rc,id:et(),data:c,win:Dn(t)}));Rx(s.settingEl,t,l,c=>this.applySettingsUpdate({"metadata-keys":{$set:c.map(d=>d.data)}})),this.cleanupFns.push(()=>{s.settingEl&&Hx(s.settingEl)})}),t.createEl("h4",{text:R("Board Header Buttons")}),new rt.Setting(t).setName(R("Add a list")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-add-list",n);c!=null?l.setValue(c):d!=null?l.setValue(d):l.setValue(!0),l.onChange(m=>{this.applySettingsUpdate({"show-add-list":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-add-list",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-add-list"]})})})}),new rt.Setting(t).setName(R("Archive completed cards")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-archive-all",n);c!=null?l.setValue(c):d!=null?l.setValue(d):l.setValue(!0),l.onChange(m=>{this.applySettingsUpdate({"show-archive-all":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-archive-all",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-archive-all"]})})})}),new rt.Setting(t).setName(R("Open as markdown")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-view-as-markdown",n);c!=null?l.setValue(c):d!=null?l.setValue(d):l.setValue(!0),l.onChange(m=>{this.applySettingsUpdate({"show-view-as-markdown":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-view-as-markdown",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-view-as-markdown"]})})})}),new rt.Setting(t).setName(R("Open board settings")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-board-settings",n);c!=null?l.setValue(c):d!=null?l.setValue(d):l.setValue(!0),l.onChange(m=>{this.applySettingsUpdate({"show-board-settings":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-board-settings",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-board-settings"]})})})}),new rt.Setting(t).setName(R("Search...")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-search",n);c!=null?l.setValue(c):d!=null?l.setValue(d):l.setValue(!0),l.onChange(m=>{this.applySettingsUpdate({"show-search":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-search",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-search"]})})})}),new rt.Setting(t).setName(R("Board view")).then(s=>{let u;s.addToggle(l=>{u=l;let[c,d]=this.getSetting("show-set-view",n);c!=null?l.setValue(c):d!=null?l.setValue(d):l.setValue(!0),l.onChange(m=>{this.applySettingsUpdate({"show-set-view":{$set:m}})})}).addExtraButton(l=>{l.setIcon("lucide-rotate-ccw").setTooltip(R("Reset to default")).onClick(()=>{let[,c]=this.getSetting("show-set-view",n);u.setValue(!!c),this.applySettingsUpdate({$unset:["show-set-view"]})})})})}cleanUp(){this.win=null,this.cleanupFns.forEach(t=>t()),this.cleanupFns=[]}},$d=class extends rt.Modal{constructor(t,r,n){super(t.app),this.view=t,this.settingsManager=new Vd(t.plugin,r,n)}onOpen(){let{contentEl:t,modalEl:r}=this;r.addClass($("board-settings-modal")),this.settingsManager.constructUI(t,this.view.file.basename,!0)}onClose(){let{contentEl:t}=this;this.settingsManager.cleanUp(),t.empty()}},Ud=class extends rt.PluginSettingTab{constructor(t,r){super(t.app,t),this.plugin=t,this.settingsManager=new Vd(t,r,t.settings)}display(){let{containerEl:t}=this;t.empty(),t.addClass($("board-settings-modal")),this.settingsManager.constructUI(t,R("Kanban Plugin"),!1)}};var xC=Ct(ln());function zx({onNewLane:e,closeLaneForm:t}){let[r,n]=Ne(!1),i=Fe(),a=Fe(),o=ws(()=>t(),{ignoreClass:[$("ignore-click-outside"),"mobile-toolbar","suggestion-container"]}),{boardModifiers:s,stateManager:u}=Ee(tt);Ai(()=>{var h;(h=a.current)==null||h.focus()},[]);let l=Ye((h,g)=>{s.addLane({...Ea,id:et(),children:[],data:{...co(g),shouldMarkItemsComplete:r}}),h.dispatch({changes:{from:0,to:h.state.doc.length,insert:""}}),n(!1),e()},[e,n,s]),c=Re(()=>({x:0,y:0}),[]),d=Ye((h,g,y)=>{if(!Ca(u,g,y))return l(h,h.state.doc.toString()),!0},[l]),m=Ye(h=>l(h,h.state.doc.toString()),[l]);return E("div",{ref:o,className:$("lane-form-wrapper"),children:[E("div",{className:$("lane-input-wrapper"),children:E(_a,{className:$("lane-input"),editorRef:i,editState:c,onEnter:d,onEscape:t,onSubmit:m})}),E("div",{className:$("checkbox-wrapper"),children:[E("div",{className:$("checkbox-label"),children:R("Mark cards in this list as complete")}),E("div",{onClick:()=>n(!r),className:`checkbox-container ${r?"is-enabled":""}`})]}),E("div",{className:$("lane-input-actions"),children:[E("button",{className:$("lane-action-add"),onClick:()=>{i.current&&l(i.current,i.current.state.doc.toString())},children:R("Add list")}),E("button",{className:$("lane-action-cancel"),onClick:t,children:R("Done")})]})]})}function qx(){return{accessor:(e,t)=>typeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function Oa(e,t){return typeof e=="function"?e(t):e}function Pr(e,t){return r=>{t.setState(n=>({...n,[e]:Oa(r,n[e])}))}}function Kd(e){return e instanceof Function}function LR(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function PR(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 ze(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,d)=>n[d]!==c)))return i;n=s;let l;if(r.key&&r.debug&&(l=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,d=Math.round((Date.now()-l)*100)/100,m=d/16,h=(g,y)=>{for(g=String(g);g.length{var i;return(i=e==null?void 0:e.debugAll)!=null?i:e[t]},key:!1,onChange:n}}function NR(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:ze(()=>[e,r,t,a],(o,s,u,l)=>({table:o,column:s,row:u,cell:l,getValue:l.getValue,renderValue:l.renderValue}),Ke(e.options,"debugCells","cell.getContext"))};return e._features.forEach(o=>{o.createCell==null||o.createCell(a,r,t,e)},{}),a}function RR(e,t,r,n){var i,a;let s={...e._getDefaultColumnDef(),...t},u=s.accessorKey,l=(i=(a=s.id)!=null?a:u?u.replace(".","_"):void 0)!=null?i:typeof s.header=="string"?s.header:void 0,c;if(s.accessorFn?c=s.accessorFn:u&&(u.includes(".")?c=m=>{let h=m;for(let y of u.split(".")){var g;h=(g=h)==null?void 0:g[y]}return h}:c=m=>m[s.accessorKey]),!l)throw new Error;let d={id:`${String(l)}`,accessorFn:c,parent:n,depth:r,columnDef:s,columns:[],getFlatColumns:ze(()=>[!0],()=>{var m;return[d,...(m=d.columns)==null?void 0:m.flatMap(h=>h.getFlatColumns())]},Ke(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:ze(()=>[e._getOrderColumnsFn()],m=>{var h;if((h=d.columns)!=null&&h.length){let g=d.columns.flatMap(y=>y.getLeafColumns());return m(g)}return[d]},Ke(e.options,"debugColumns","column.getLeafColumns"))};for(let m of e._features)m.createColumn==null||m.createColumn(d,e);return d}var nr="debugHeaders";function Kx(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=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(s),o.push(u)};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 HR={createTable:e=>{e.getHeaderGroups=ze(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n,i)=>{var a,o;let s=(a=n==null?void 0:n.map(d=>r.find(m=>m.id===d)).filter(Boolean))!=null?a:[],u=(o=i==null?void 0:i.map(d=>r.find(m=>m.id===d)).filter(Boolean))!=null?o:[],l=r.filter(d=>!(n!=null&&n.includes(d.id))&&!(i!=null&&i.includes(d.id)));return Wd(t,[...s,...l,...u],e)},Ke(e.options,nr,"getHeaderGroups")),e.getCenterHeaderGroups=ze(()=>[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))),Wd(t,r,e,"center")),Ke(e.options,nr,"getCenterHeaderGroups")),e.getLeftHeaderGroups=ze(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,n)=>{var i;let a=(i=n==null?void 0:n.map(o=>r.find(s=>s.id===o)).filter(Boolean))!=null?i:[];return Wd(t,a,e,"left")},Ke(e.options,nr,"getLeftHeaderGroups")),e.getRightHeaderGroups=ze(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,n)=>{var i;let a=(i=n==null?void 0:n.map(o=>r.find(s=>s.id===o)).filter(Boolean))!=null?i:[];return Wd(t,a,e,"right")},Ke(e.options,nr,"getRightHeaderGroups")),e.getFooterGroups=ze(()=>[e.getHeaderGroups()],t=>[...t].reverse(),Ke(e.options,nr,"getFooterGroups")),e.getLeftFooterGroups=ze(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),Ke(e.options,nr,"getLeftFooterGroups")),e.getCenterFooterGroups=ze(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),Ke(e.options,nr,"getCenterFooterGroups")),e.getRightFooterGroups=ze(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),Ke(e.options,nr,"getRightFooterGroups")),e.getFlatHeaders=ze(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ke(e.options,nr,"getFlatHeaders")),e.getLeftFlatHeaders=ze(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ke(e.options,nr,"getLeftFlatHeaders")),e.getCenterFlatHeaders=ze(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ke(e.options,nr,"getCenterFlatHeaders")),e.getRightFlatHeaders=ze(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),Ke(e.options,nr,"getRightFlatHeaders")),e.getCenterLeafHeaders=ze(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Ke(e.options,nr,"getCenterLeafHeaders")),e.getLeftLeafHeaders=ze(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Ke(e.options,nr,"getLeftLeafHeaders")),e.getRightLeafHeaders=ze(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var n;return!((n=r.subHeaders)!=null&&n.length)}),Ke(e.options,nr,"getRightLeafHeaders")),e.getLeafHeaders=ze(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,n)=>{var i,a,o,s,u,l;return[...(i=(a=t[0])==null?void 0:a.headers)!=null?i:[],...(o=(s=r[0])==null?void 0:s.headers)!=null?o:[],...(u=(l=n[0])==null?void 0:l.headers)!=null?u:[]].map(c=>c.getLeafHeaders()).flat()},Ke(e.options,nr,"getLeafHeaders"))}};function Wd(e,t,r,n){var i,a;let o=0,s=function(m,h){h===void 0&&(h=1),o=Math.max(o,h),m.filter(g=>g.getIsVisible()).forEach(g=>{var y;(y=g.columns)!=null&&y.length&&s(g.columns,h+1)},0)};s(e);let u=[],l=(m,h)=>{let g={depth:h,id:[n,`${h}`].filter(Boolean).join("_"),headers:[]},y=[];m.forEach(v=>{let D=[...y].reverse()[0],I=v.column.depth===g.depth,C,x=!1;if(I&&v.column.parent?C=v.column.parent:(C=v.column,x=!0),D&&(D==null?void 0:D.column)===C)D.subHeaders.push(v);else{let O=Kx(r,C,{id:[n,h,C.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:x,placeholderId:x?`${y.filter(A=>A.column===C).length}`:void 0,depth:h,index:y.length});O.subHeaders.push(v),y.push(O)}g.headers.push(v),v.headerGroup=g}),u.push(g),h>0&&l(y,h-1)},c=t.map((m,h)=>Kx(r,m,{depth:o,index:h}));l(c,o-1),u.reverse();let d=m=>m.filter(g=>g.column.getIsVisible()).map(g=>{let y=0,v=0,D=[0];g.subHeaders&&g.subHeaders.length?(D=[],d(g.subHeaders).forEach(C=>{let{colSpan:x,rowSpan:O}=C;y+=x,D.push(O)})):y=1;let I=Math.min(...D);return v=v+I,g.colSpan=y,g.rowSpan=v,{colSpan:y,rowSpan:v}});return d((i=(a=u[0])==null?void 0:a.headers)!=null?i:[]),u}var Zg=(e,t,r,n,i,a,o)=>{let s={id:t,index:n,original:r,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(s._valuesCache.hasOwnProperty(u))return s._valuesCache[u];let l=e.getColumn(u);if(l!=null&&l.accessorFn)return s._valuesCache[u]=l.accessorFn(s.original,n),s._valuesCache[u]},getUniqueValues:u=>{if(s._uniqueValuesCache.hasOwnProperty(u))return s._uniqueValuesCache[u];let l=e.getColumn(u);if(l!=null&&l.accessorFn)return l.columnDef.getUniqueValues?(s._uniqueValuesCache[u]=l.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[u]):(s._uniqueValuesCache[u]=[s.getValue(u)],s._uniqueValuesCache[u])},renderValue:u=>{var l;return(l=s.getValue(u))!=null?l:e.options.renderFallbackValue},subRows:a!=null?a:[],getLeafRows:()=>PR(s.subRows,u=>u.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let u=[],l=s;for(;;){let c=l.getParentRow();if(!c)break;u.push(c),l=c}return u.reverse()},getAllCells:ze(()=>[e.getAllLeafColumns()],u=>u.map(l=>NR(e,s,l,l.id)),Ke(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:ze(()=>[s.getAllCells()],u=>u.reduce((l,c)=>(l[c.column.id]=c,l),{}),Ke(e.options,"debugRows","getAllCellsByColumnId"))};for(let u=0;u{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()}}},Gx=(e,t,r)=>{var n;let i=r.toLowerCase();return!!(!((n=e.getValue(t))==null||(n=n.toString())==null||(n=n.toLowerCase())==null)&&n.includes(i))};Gx.autoRemove=e=>di(e);var Jx=(e,t,r)=>{var n;return!!(!((n=e.getValue(t))==null||(n=n.toString())==null)&&n.includes(r))};Jx.autoRemove=e=>di(e);var Zx=(e,t,r)=>{var n;return((n=e.getValue(t))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(r==null?void 0:r.toLowerCase())};Zx.autoRemove=e=>di(e);var Qx=(e,t,r)=>{var n;return(n=e.getValue(t))==null?void 0:n.includes(r)};Qx.autoRemove=e=>di(e)||!(e!=null&&e.length);var Xx=(e,t,r)=>!r.some(n=>{var i;return!((i=e.getValue(t))!=null&&i.includes(n))});Xx.autoRemove=e=>di(e)||!(e!=null&&e.length);var eC=(e,t,r)=>r.some(n=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(n)});eC.autoRemove=e=>di(e)||!(e!=null&&e.length);var tC=(e,t,r)=>e.getValue(t)===r;tC.autoRemove=e=>di(e);var nC=(e,t,r)=>e.getValue(t)==r;nC.autoRemove=e=>di(e);var Qg=(e,t,r)=>{let[n,i]=r,a=e.getValue(t);return a>=n&&a<=i};Qg.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]};Qg.autoRemove=e=>di(e)||di(e[0])&&di(e[1]);var Xi={includesString:Gx,includesStringSensitive:Jx,equalsString:Zx,arrIncludes:Qx,arrIncludesAll:Xx,arrIncludesSome:eC,equals:tC,weakEquals:nC,inNumberRange:Qg};function di(e){return e==null||e===""}var VR={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Pr("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let r=t.getCoreRowModel().flatRows[0],n=r==null?void 0:r.getValue(e.id);return typeof n=="string"?Xi.includesString:typeof n=="number"?Xi.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?Xi.equals:Array.isArray(n)?Xi.arrIncludes:Xi.weakEquals},e.getFilterFn=()=>{var r,n;return Kd(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:Xi[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==null?void 0:n.find(c=>c.id===e.id),o=Oa(r,a?a.value:void 0);if(jx(i,o,e)){var s;return(s=n==null?void 0:n.filter(c=>c.id!==e.id))!=null?s:[]}let u={id:e.id,value:o};if(a){var l;return(l=n==null?void 0:n.map(c=>c.id===e.id?u:c))!=null?l:[]}return n!=null&&n.length?[...n,u]:[u]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let r=e.getAllLeafColumns(),n=i=>{var a;return(a=Oa(t,i))==null?void 0:a.filter(o=>{let s=r.find(u=>u.id===o.id);if(s){let u=s.getFilterFn();if(jx(u,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 jx(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t=="undefined"||typeof t=="string"&&!t}var $R=(e,t,r)=>r.reduce((n,i)=>{let a=i.getValue(e);return n+(typeof a=="number"?a:0)},0),UR=(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},WR=(e,t,r)=>{let n;return r.forEach(i=>{let a=i.getValue(e);a!=null&&(n=a)&&(n=a)}),n},YR=(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},KR=(e,t)=>{if(!t.length)return;let r=t.map(a=>a.getValue(e));if(!LR(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},jR=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),qR=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,GR=(e,t)=>t.length,Bg={sum:$R,min:UR,max:WR,extent:YR,mean:zR,median:KR,unique:jR,uniqueCount:qR,count:GR},JR={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:Pr("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!=null?r:[],e.id])},e.getCanGroup=()=>{var r,n;return((r=e.columnDef.enableGrouping)!=null?r:!0)&&((n=t.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},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==null?void 0:r.getValue(e.id);if(typeof n=="number")return Bg.sum;if(Object.prototype.toString.call(n)==="[object Date]")return Bg.extent},e.getAggregationFn=()=>{var r,n;if(!e)throw new Error;return Kd(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:Bg[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 ZR(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 QR={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Pr("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=ze(r=>[jl(t,r)],r=>r.findIndex(n=>n.id===e.id),Ke(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=r=>{var n;return((n=jl(t,r)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=r=>{var n;let i=jl(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=ze(()=>[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 u=o.shift(),l=s.findIndex(c=>c.id===u);l>-1&&a.push(s.splice(l,1)[0])}a=[...a,...s]}return ZR(a,r,n)},Ke(e.options,"debugTable","_getOrderColumnsFn"))}},Vg=()=>({left:[],right:[]}),XR={getInitialState:e=>({columnPinning:Vg(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Pr("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,u;return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(d=>!(n!=null&&n.includes(d))),right:[...((u=i==null?void 0:i.right)!=null?u:[]).filter(d=>!(n!=null&&n.includes(d))),...n]}}if(r==="left"){var l,c;return{left:[...((l=i==null?void 0:i.left)!=null?l:[]).filter(d=>!(n!=null&&n.includes(d))),...n],right:((c=i==null?void 0:i.right)!=null?c:[]).filter(d=>!(n!=null&&n.includes(d)))}}return{left:((a=i==null?void 0:i.left)!=null?a:[]).filter(d=>!(n!=null&&n.includes(d))),right:((o=i==null?void 0:i.right)!=null?o:[]).filter(d=>!(n!=null&&n.includes(d)))}})},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==null?void 0:n.includes(s)),o=r.some(s=>i==null?void 0: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=ze(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,n,i)=>{let a=[...n!=null?n:[],...i!=null?i:[]];return r.filter(o=>!a.includes(o.column.id))},Ke(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=ze(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(r,n)=>(n!=null?n:[]).map(a=>r.find(o=>o.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),Ke(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=ze(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,n)=>(n!=null?n:[]).map(a=>r.find(o=>o.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),Ke(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?Vg():(r=(n=e.initialState)==null?void 0:n.columnPinning)!=null?r:Vg())},e.getIsSomeColumnsPinned=t=>{var r;let n=e.getState().columnPinning;if(!t){var i,a;return!!((i=n.left)!=null&&i.length||(a=n.right)!=null&&a.length)}return!!((r=n[t])!=null&&r.length)},e.getLeftLeafColumns=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r!=null?r:[]).map(n=>t.find(i=>i.id===n)).filter(Boolean),Ke(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r!=null?r:[]).map(n=>t.find(i=>i.id===n)).filter(Boolean),Ke(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,n)=>{let i=[...r!=null?r:[],...n!=null?n:[]];return t.filter(a=>!i.includes(a.id))},Ke(e.options,"debugColumns","getCenterLeafColumns"))}},Yd={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},$g=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),eH={getDefaultColumnDef:()=>Yd,getInitialState:e=>({columnSizing:{},columnSizingInfo:$g(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Pr("columnSizing",e),onColumnSizingInfoChange:Pr("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:Yd.minSize,(n=a!=null?a:e.columnDef.size)!=null?n:Yd.size),(i=e.columnDef.maxSize)!=null?i:Yd.maxSize)},e.getStart=ze(r=>[r,jl(t,r),t.getState().columnSizing],(r,n)=>n.slice(0,e.getIndex(r)).reduce((i,a)=>i+a.getSize(),0),Ke(t.options,"debugColumns","getStart")),e.getAfter=ze(r=>[r,jl(t,r),t.getState().columnSizing],(r,n)=>n.slice(e.getIndex(r)+1).reduce((i,a)=>i+a.getSize(),0),Ke(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==null?void 0:n.getCanResize();return a=>{if(!n||!i||(a.persist==null||a.persist(),Ug(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(D=>[D.column.id,D.column.getSize()]):[[n.id,n.getSize()]],u=Ug(a)?Math.round(a.touches[0].clientX):a.clientX,l={},c=(D,I)=>{typeof I=="number"&&(t.setColumnSizingInfo(C=>{var x,O;let A=t.options.columnResizeDirection==="rtl"?-1:1,P=(I-((x=C==null?void 0:C.startOffset)!=null?x:0))*A,B=Math.max(P/((O=C==null?void 0:C.startSize)!=null?O:0),-.999999);return C.columnSizingStart.forEach(G=>{let[J,Q]=G;l[J]=Math.round(Math.max(Q+Q*B,0)*100)/100}),{...C,deltaOffset:P,deltaPercentage:B}}),(t.options.columnResizeMode==="onChange"||D==="end")&&t.setColumnSizing(C=>({...C,...l})))},d=D=>c("move",D),m=D=>{c("end",D),t.setColumnSizingInfo(I=>({...I,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=r||typeof document!="undefined"?document:null,g={moveHandler:D=>d(D.clientX),upHandler:D=>{h==null||h.removeEventListener("mousemove",g.moveHandler),h==null||h.removeEventListener("mouseup",g.upHandler),m(D.clientX)}},y={moveHandler:D=>(D.cancelable&&(D.preventDefault(),D.stopPropagation()),d(D.touches[0].clientX),!1),upHandler:D=>{var I;h==null||h.removeEventListener("touchmove",y.moveHandler),h==null||h.removeEventListener("touchend",y.upHandler),D.cancelable&&(D.preventDefault(),D.stopPropagation()),m((I=D.touches[0])==null?void 0:I.clientX)}},v=tH()?{passive:!1}:!1;Ug(a)?(h==null||h.addEventListener("touchmove",y.moveHandler,v),h==null||h.addEventListener("touchend",y.upHandler,v)):(h==null||h.addEventListener("mousemove",g.moveHandler,v),h==null||h.addEventListener("mouseup",g.upHandler,v)),t.setColumnSizingInfo(D=>({...D,startOffset:u,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?$g():(r=e.initialState.columnSizingInfo)!=null?r:$g())},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}}},zd=null;function tH(){if(typeof zd=="boolean")return zd;let e=!1;try{let t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch(t){e=!1}return zd=e,zd}function Ug(e){return e.type==="touchstart"}var nH={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Pr("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility(n=>({...n,[e.id]:r!=null?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=ze(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(n=>n.column.getIsVisible()),Ke(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=ze(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,n,i)=>[...r,...n,...i],Ke(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(r,n)=>ze(()=>[n(),n().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),Ke(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 jl(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var rH={createTable:e=>{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()}}},iH={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Pr("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=()=>Xi.includesString,e.getGlobalFilterFn=()=>{var t,r;let{globalFilterFn:n}=e.options;return Kd(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[n])!=null?t:Xi[n]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},aH={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Pr("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!=null?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,...u}=o;return u}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!=null&&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()}}}},Kg=0,jg=10,Wg=()=>({pageIndex:Kg,pageSize:jg}),oH={getInitialState:e=>({...e,pagination:{...Wg(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Pr("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=>Oa(n,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=n=>{var i;e.setPagination(n?Wg():(i=e.initialState.pagination)!=null?i:Wg())},e.setPageIndex=n=>{e.setPagination(i=>{let a=Oa(n,i.pageIndex),o=typeof e.options.pageCount=="undefined"||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?Kg:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?i:Kg)},e.resetPageSize=n=>{var i,a;e.setPageSize(n?jg:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?i:jg)},e.setPageSize=n=>{e.setPagination(i=>{let a=Math.max(1,Oa(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=Oa(n,(a=e.options.pageCount)!=null?a:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...i,pageCount:o}}),e.getPageOptions=ze(()=>[e.getPageCount()],n=>{let i=[];return n&&n>0&&(i=[...new Array(n)].fill(null).map((a,o)=>o)),i},Ke(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}}},Yg=()=>({top:[],bottom:[]}),sH={getInitialState:e=>({rowPinning:Yg(),...e}),getDefaultOptions:e=>({onRowPinningChange:Pr("rowPinning",e)}),createRow:(e,t)=>{e.pin=(r,n,i)=>{let a=n?e.getLeafRows().map(u=>{let{id:l}=u;return l}):[],o=i?e.getParentRows().map(u=>{let{id:l}=u;return l}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(u=>{var l,c;if(r==="bottom"){var d,m;return{top:((d=u==null?void 0:u.top)!=null?d:[]).filter(y=>!(s!=null&&s.has(y))),bottom:[...((m=u==null?void 0:u.bottom)!=null?m:[]).filter(y=>!(s!=null&&s.has(y))),...Array.from(s)]}}if(r==="top"){var h,g;return{top:[...((h=u==null?void 0:u.top)!=null?h:[]).filter(y=>!(s!=null&&s.has(y))),...Array.from(s)],bottom:((g=u==null?void 0:u.bottom)!=null?g:[]).filter(y=>!(s!=null&&s.has(y)))}}return{top:((l=u==null?void 0:u.top)!=null?l:[]).filter(y=>!(s!=null&&s.has(y))),bottom:((c=u==null?void 0:u.bottom)!=null?c:[]).filter(y=>!(s!=null&&s.has(y)))}})},e.getCanPin=()=>{var r;let{enableRowPinning:n,enablePinning:i}=t.options;return typeof n=="function"?n(e):(r=n!=null?n:i)!=null?r:!0},e.getIsPinned=()=>{let r=[e.id],{top:n,bottom:i}=t.getState().rowPinning,a=r.some(s=>n==null?void 0:n.includes(s)),o=r.some(s=>i==null?void 0: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==null?void 0: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?Yg():(r=(n=e.initialState)==null?void 0:n.rowPinning)!=null?r:Yg())},e.getIsSomeRowsPinned=t=>{var r;let n=e.getState().rowPinning;if(!t){var i,a;return!!((i=n.top)!=null&&i.length||(a=n.bottom)!=null&&a.length)}return!!((r=n[t])!=null&&r.length)},e._getPinnedRows=ze(t=>[e.getRowModel().rows,e.getState().rowPinning[t],t],(t,r,n)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(r!=null?r:[]).map(o=>{let s=e.getRow(o,!0);return s.getIsAllParentsExpanded()?s:null}):(r!=null?r:[]).map(o=>t.find(s=>s.id===o))).filter(Boolean).map(o=>({...o,position:n}))},Ke(e.options,"debugRows","_getPinnedRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=ze(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,r,n)=>{let i=new Set([...r!=null?r:[],...n!=null?n:[]]);return t.filter(a=>!i.has(a.id))},Ke(e.options,"debugRows","getCenterRows"))}},lH={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Pr("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!="undefined"?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!="undefined"?t:!e.getIsAllPageRowsSelected(),i={...r};return e.getRowModel().rows.forEach(a=>{qg(i,a.id,n,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?zg(e,r):{rows:[],flatRows:[],rowsById:{}},Ke(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?zg(e,r):{rows:[],flatRows:[],rowsById:{}},Ke(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?zg(e,r):{rows:[],flatRows:[],rowsById:{}},Ke(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState(),n=!!(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!="undefined"?r:!i,e.getCanSelect()&&i===r)return a;let s={...a};return qg(s,e.id,r,(o=n==null?void 0:n.selectChildren)!=null?o:!0,t),s})},e.getIsSelected=()=>{let{rowSelection:r}=t.getState();return Xg(e,r)},e.getIsSomeSelected=()=>{let{rowSelection:r}=t.getState();return Gg(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:r}=t.getState();return Gg(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)}}}},qg=(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=>qg(e,s.id,r,n,i))};function zg(e,t){let r=e.getState().rowSelection,n=[],i={},a=function(o,s){return o.map(u=>{var l;let c=Xg(u,r);if(c&&(n.push(u),i[u.id]=u),(l=u.subRows)!=null&&l.length&&(u={...u,subRows:a(u.subRows)}),c)return u}).filter(Boolean)};return{rows:a(t.rows),flatRows:n,rowsById:i}}function Xg(e,t){var r;return(r=t[e.id])!=null?r:!1}function Gg(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()&&(Xg(o,t)?a=!0:i=!1),o.subRows&&o.subRows.length)){let s=Gg(o,t);s==="all"?a=!0:(s==="some"&&(a=!0),i=!1)}}),i?"all":a?"some":!1}var Jg=/([0-9]+)/gm,uH=(e,t,r)=>rC(La(e.getValue(r)).toLowerCase(),La(t.getValue(r)).toLowerCase()),cH=(e,t,r)=>rC(La(e.getValue(r)),La(t.getValue(r))),dH=(e,t,r)=>ey(La(e.getValue(r)).toLowerCase(),La(t.getValue(r)).toLowerCase()),fH=(e,t,r)=>ey(La(e.getValue(r)),La(t.getValue(r))),hH=(e,t,r)=>{let n=e.getValue(r),i=t.getValue(r);return n>i?1:ney(e.getValue(r),t.getValue(r));function ey(e,t){return e===t?0:e>t?1:-1}function La(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function rC(e,t){let r=e.split(Jg).filter(Boolean),n=t.split(Jg).filter(Boolean);for(;r.length&&n.length;){let i=r.shift(),a=n.shift(),o=parseInt(i,10),s=parseInt(a,10),u=[o,s].sort();if(isNaN(u[0])){if(i>a)return 1;if(a>i)return-1;continue}if(isNaN(u[1]))return isNaN(o)?-1:1;if(o>s)return 1;if(s>o)return-1}return r.length-n.length}var Kl={alphanumeric:uH,alphanumericCaseSensitive:cH,text:dH,textCaseSensitive:fH,datetime:hH,basic:mH},pH={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Pr("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==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return Kl.datetime;if(typeof a=="string"&&(n=!0,a.split(Jg).length>1))return Kl.alphanumeric}return n?Kl.text:Kl.basic},e.getAutoSortDir=()=>{let r=t.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,n;if(!e)throw new Error;return Kd(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:Kl[e.columnDef.sortingFn]},e.toggleSorting=(r,n)=>{let i=e.getNextSortingOrder(),a=typeof r!="undefined"&&r!==null;t.setSorting(o=>{let s=o==null?void 0:o.find(h=>h.id===e.id),u=o==null?void 0:o.findIndex(h=>h.id===e.id),l=[],c,d=a?r:i==="desc";if(o!=null&&o.length&&e.getCanMultiSort()&&n?s?c="toggle":c="add":o!=null&&o.length&&u!==o.length-1?c="replace":s?c="toggle":c="replace",c==="toggle"&&(a||i||(c="remove")),c==="add"){var m;l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-((m=t.options.maxMultiSortColCount)!=null?m:Number.MAX_SAFE_INTEGER))}else c==="toggle"?l=o.map(h=>h.id===e.id?{...h,desc:d}:h):c==="remove"?l=o.filter(h=>h.id!==e.id):l=[{id:e.id,desc:d}];return l})},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)&&(!(r&&(i=t.options.enableMultiRemove)!=null)||i)?!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())}},gH=[HR,nH,QR,XR,BR,VR,rH,iH,pH,JR,aH,oH,sH,lH,eH];function iC(e){var t,r;let n=[...gH,...(t=e._features)!=null?t:[]],i={_features:n},a=i._features.reduce((m,h)=>Object.assign(m,h.getDefaultOptions==null?void 0:h.getDefaultOptions(i)),{}),o=m=>i.options.mergeOptions?i.options.mergeOptions(a,m):{...a,...m},u={...{},...(r=e.initialState)!=null?r:{}};i._features.forEach(m=>{var h;u=(h=m.getInitialState==null?void 0:m.getInitialState(u))!=null?h:u});let l=[],c=!1,d={_features:n,options:{...a,...e},initialState:u,_queue:m=>{l.push(m),c||(c=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();c=!1}).catch(h=>activeWindow.setTimeout(()=>{throw h})))},reset:()=>{i.setState(i.initialState)},setOptions:m=>{let h=Oa(m,i.options);i.options=o(h)},getState:()=>i.options.state,setState:m=>{i.options.onStateChange==null||i.options.onStateChange(m)},_getRowId:(m,h,g)=>{var y;return(y=i.options.getRowId==null?void 0:i.options.getRowId(m,h,g))!=null?y:`${g?[g.id,h].join("."):h}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(m,h)=>{let g=(h?i.getPrePaginationRowModel():i.getRowModel()).rowsById[m];if(!g&&(g=i.getCoreRowModel().rowsById[m],!g))throw new Error;return g},_getDefaultColumnDef:ze(()=>[i.options.defaultColumn],m=>{var h;return m=(h=m)!=null?h:{},{header:g=>{let y=g.header.column.columnDef;return y.accessorKey?y.accessorKey:y.accessorFn?y.id:null},cell:g=>{var y,v;return(y=(v=g.renderValue())==null||v.toString==null?void 0:v.toString())!=null?y:null},...i._features.reduce((g,y)=>Object.assign(g,y.getDefaultColumnDef==null?void 0:y.getDefaultColumnDef()),{}),...m}},Ke(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:ze(()=>[i._getColumnDefs()],m=>{let h=function(g,y,v){return v===void 0&&(v=0),g.map(D=>{let I=RR(i,D,v,y),C=D;return I.columns=C.columns?h(C.columns,I,v+1):[],I})};return h(m)},Ke(e,"debugColumns","getAllColumns")),getAllFlatColumns:ze(()=>[i.getAllColumns()],m=>m.flatMap(h=>h.getFlatColumns()),Ke(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:ze(()=>[i.getAllFlatColumns()],m=>m.reduce((h,g)=>(h[g.id]=g,h),{}),Ke(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:ze(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(m,h)=>{let g=m.flatMap(y=>y.getLeafColumns());return h(g)},Ke(e,"debugColumns","getAllLeafColumns")),getColumn:m=>i._getAllFlatColumnsById()[m]};Object.assign(i,d);for(let m=0;mze(()=>[e.options.data],t=>{let r={rows:[],flatRows:[],rowsById:{}},n=function(i,a,o){a===void 0&&(a=0);let s=[];for(let l=0;le._autoResetPageIndex()))}function yH(e,t,r){return r.options.filterFromLeafRows?vH(e,t,r):wH(e,t,r)}function vH(e,t,r){var n;let i=[],a={},o=(n=r.options.maxLeafRowFilterDepth)!=null?n:100,s=function(u,l){l===void 0&&(l=0);let c=[];for(let m=0;mze(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,r,n)=>{if(!t.rows.length||!(r!=null&&r.length)&&!n){for(let m=0;m{var h;let g=e.getColumn(m.id);if(!g)return;let y=g.getFilterFn();y&&i.push({id:m.id,filterFn:y,resolvedValue:(h=y.resolveFilterValue==null?void 0:y.resolveFilterValue(m.value))!=null?h:m.value})});let o=r.map(m=>m.id),s=e.getGlobalFilterFn(),u=e.getAllLeafColumns().filter(m=>m.getCanGlobalFilter());n&&s&&u.length&&(o.push("__global__"),u.forEach(m=>{var h;a.push({id:m.id,filterFn:s,resolvedValue:(h=s.resolveFilterValue==null?void 0:s.resolveFilterValue(n))!=null?h:n})}));let l,c;for(let m=0;m{h.columnFiltersMeta[y]=v})}if(a.length){for(let g=0;g{h.columnFiltersMeta[y]=v})){h.columnFilters.__global__=!0;break}}h.columnFilters.__global__!==!0&&(h.columnFilters.__global__=!1)}}let d=m=>{for(let h=0;he._autoResetPageIndex()))}function sC(){return e=>ze(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,r)=>{if(!r.rows.length||!(t!=null&&t.length))return r;let n=e.getState().sorting,i=[],a=n.filter(u=>{var l;return(l=e.getColumn(u.id))==null?void 0:l.getCanSort()}),o={};a.forEach(u=>{let l=e.getColumn(u.id);l&&(o[u.id]={sortUndefined:l.columnDef.sortUndefined,invertSorting:l.columnDef.invertSorting,sortingFn:l.getSortingFn()})});let s=u=>{let l=u.map(c=>({...c}));return l.sort((c,d)=>{for(let h=0;h{var d;i.push(c),(d=c.subRows)!=null&&d.length&&(c.subRows=s(c.subRows))}),l};return{rows:s(r.rows),flatRows:i,rowsById:r.rowsById}},Ke(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function ty(e,t){return e?bH(e)?xr(e,t):e:null}function bH(e){return DH(e)||typeof e=="function"||SH(e)}function DH(e){return typeof e=="function"&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function SH(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function lC(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=Ne(()=>({current:iC(t)})),[n,i]=Ne(()=>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 EC=Ct(ln());var fC={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u1EA4:"A",\u1EAE:"A",\u1EB2:"A",\u1EB4:"A",\u1EB6:"A",\u00C6:"AE",\u1EA6:"A",\u1EB0:"A",\u0202:"A",\u00C7:"C",\u1E08:"C",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u1EBE:"E",\u1E16:"E",\u1EC0:"E",\u1E14:"E",\u1E1C:"E",\u0206:"E",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u1E2E:"I",\u020A:"I",\u00D0:"D",\u00D1:"N",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u1ED0:"O",\u1E4C:"O",\u1E52:"O",\u020E:"O",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00DD:"Y",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u1EA5:"a",\u1EAF:"a",\u1EB3:"a",\u1EB5:"a",\u1EB7:"a",\u00E6:"ae",\u1EA7:"a",\u1EB1:"a",\u0203:"a",\u00E7:"c",\u1E09:"c",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u1EBF:"e",\u1E17:"e",\u1EC1:"e",\u1E15:"e",\u1E1D:"e",\u0207:"e",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u1E2F:"i",\u020B:"i",\u00F0:"d",\u00F1:"n",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u1ED1:"o",\u1E4D:"o",\u1E53:"o",\u020F:"o",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00FD:"y",\u00FF:"y",\u0100:"A",\u0101:"a",\u0102:"A",\u0103:"a",\u0104:"A",\u0105:"a",\u0106:"C",\u0107:"c",\u0108:"C",\u0109:"c",\u010A:"C",\u010B:"c",\u010C:"C",\u010D:"c",C\u0306:"C",c\u0306:"c",\u010E:"D",\u010F:"d",\u0110:"D",\u0111:"d",\u0112:"E",\u0113:"e",\u0114:"E",\u0115:"e",\u0116:"E",\u0117:"e",\u0118:"E",\u0119:"e",\u011A:"E",\u011B:"e",\u011C:"G",\u01F4:"G",\u011D:"g",\u01F5:"g",\u011E:"G",\u011F:"g",\u0120:"G",\u0121:"g",\u0122:"G",\u0123:"g",\u0124:"H",\u0125:"h",\u0126:"H",\u0127:"h",\u1E2A:"H",\u1E2B:"h",\u0128:"I",\u0129:"i",\u012A:"I",\u012B:"i",\u012C:"I",\u012D:"i",\u012E:"I",\u012F:"i",\u0130:"I",\u0131:"i",\u0132:"IJ",\u0133:"ij",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u1E30:"K",\u1E31:"k",K\u0306:"K",k\u0306:"k",\u0139:"L",\u013A:"l",\u013B:"L",\u013C:"l",\u013D:"L",\u013E:"l",\u013F:"L",\u0140:"l",\u0141:"l",\u0142:"l",\u1E3E:"M",\u1E3F:"m",M\u0306:"M",m\u0306:"m",\u0143:"N",\u0144:"n",\u0145:"N",\u0146:"n",\u0147:"N",\u0148:"n",\u0149:"n",N\u0306:"N",n\u0306:"n",\u014C:"O",\u014D:"o",\u014E:"O",\u014F:"o",\u0150:"O",\u0151:"o",\u0152:"OE",\u0153:"oe",P\u0306:"P",p\u0306:"p",\u0154:"R",\u0155:"r",\u0156:"R",\u0157:"r",\u0158:"R",\u0159:"r",R\u0306:"R",r\u0306:"r",\u0212:"R",\u0213:"r",\u015A:"S",\u015B:"s",\u015C:"S",\u015D:"s",\u015E:"S",\u0218:"S",\u0219:"s",\u015F:"s",\u0160:"S",\u0161:"s",\u0162:"T",\u0163:"t",\u021B:"t",\u021A:"T",\u0164:"T",\u0165:"t",\u0166:"T",\u0167:"t",T\u0306:"T",t\u0306:"t",\u0168:"U",\u0169:"u",\u016A:"U",\u016B:"u",\u016C:"U",\u016D:"u",\u016E:"U",\u016F:"u",\u0170:"U",\u0171:"u",\u0172:"U",\u0173:"u",\u0216:"U",\u0217:"u",V\u0306:"V",v\u0306:"v",\u0174:"W",\u0175:"w",\u1E82:"W",\u1E83:"w",X\u0306:"X",x\u0306:"x",\u0176:"Y",\u0177:"y",\u0178:"Y",Y\u0306:"Y",y\u0306:"y",\u0179:"Z",\u017A:"z",\u017B:"Z",\u017C:"z",\u017D:"Z",\u017E:"z",\u017F:"s",\u0192:"f",\u01A0:"O",\u01A1:"o",\u01AF:"U",\u01B0:"u",\u01CD:"A",\u01CE:"a",\u01CF:"I",\u01D0:"i",\u01D1:"O",\u01D2:"o",\u01D3:"U",\u01D4:"u",\u01D5:"U",\u01D6:"u",\u01D7:"U",\u01D8:"u",\u01D9:"U",\u01DA:"u",\u01DB:"U",\u01DC:"u",\u1EE8:"U",\u1EE9:"u",\u1E78:"U",\u1E79:"u",\u01FA:"A",\u01FB:"a",\u01FC:"AE",\u01FD:"ae",\u01FE:"O",\u01FF:"o",\u00DE:"TH",\u00FE:"th",\u1E54:"P",\u1E55:"p",\u1E64:"S",\u1E65:"s",X\u0301:"X",x\u0301:"x",\u0403:"\u0413",\u0453:"\u0433",\u040C:"\u041A",\u045C:"\u043A",A\u030B:"A",a\u030B:"a",E\u030B:"E",e\u030B:"e",I\u030B:"I",i\u030B:"i",\u01F8:"N",\u01F9:"n",\u1ED2:"O",\u1ED3:"o",\u1E50:"O",\u1E51:"o",\u1EEA:"U",\u1EEB:"u",\u1E80:"W",\u1E81:"w",\u1EF2:"Y",\u1EF3:"y",\u0200:"A",\u0201:"a",\u0204:"E",\u0205:"e",\u0208:"I",\u0209:"i",\u020C:"O",\u020D:"o",\u0210:"R",\u0211:"r",\u0214:"U",\u0215:"u",B\u030C:"B",b\u030C:"b",\u010C\u0323:"C",\u010D\u0323:"c",\u00CA\u030C:"E",\u00EA\u030C:"e",F\u030C:"F",f\u030C:"f",\u01E6:"G",\u01E7:"g",\u021E:"H",\u021F:"h",J\u030C:"J",\u01F0:"j",\u01E8:"K",\u01E9:"k",M\u030C:"M",m\u030C:"m",P\u030C:"P",p\u030C:"p",Q\u030C:"Q",q\u030C:"q",\u0158\u0329:"R",\u0159\u0329:"r",\u1E66:"S",\u1E67:"s",V\u030C:"V",v\u030C:"v",W\u030C:"W",w\u030C:"w",X\u030C:"X",x\u030C:"x",Y\u030C:"Y",y\u030C:"y",A\u0327:"A",a\u0327:"a",B\u0327:"B",b\u0327:"b",\u1E10:"D",\u1E11:"d",\u0228:"E",\u0229:"e",\u0190\u0327:"E",\u025B\u0327:"e",\u1E28:"H",\u1E29:"h",I\u0327:"I",i\u0327:"i",\u0197\u0327:"I",\u0268\u0327:"i",M\u0327:"M",m\u0327:"m",O\u0327:"O",o\u0327:"o",Q\u0327:"Q",q\u0327:"q",U\u0327:"U",u\u0327:"u",X\u0327:"X",x\u0327:"x",Z\u0327:"Z",z\u0327:"z"},EH=Object.keys(fC).join("|"),kH=new RegExp(EH,"g");function xH(e){return e.replace(kH,t=>fC[t])}var rr={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function hC(e,t,r){var n;if(r=r||{},r.threshold=(n=r.threshold)!=null?n:rr.MATCHES,!r.accessors){let o=uC(e,t,r);return{rankedValue:e,rank:o,accessorIndex:-1,accessorThreshold:r.threshold,passed:o>=r.threshold}}let i=TH(e,r.accessors),a={rankedValue:e,rank:rr.NO_MATCH,accessorIndex:-1,accessorThreshold:r.threshold,passed:!1};for(let o=0;o=rr.MATCHES?u=l:u>c&&(u=c),u=Math.min(u,c),u>=d&&u>a.rank&&(a.rank=u,a.passed=!0,a.accessorIndex=o,a.accessorThreshold=d,a.rankedValue=s.itemValue)}return a}function uC(e,t,r){return e=cC(e,r),t=cC(t,r),t.length>e.length?rr.NO_MATCH:e===t?rr.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?rr.EQUAL:e.startsWith(t)?rr.STARTS_WITH:e.includes(` ${t}`)?rr.WORD_STARTS_WITH:e.includes(t)?rr.CONTAINS:t.length===1?rr.NO_MATCH:CH(e).includes(t)?rr.ACRONYM:_H(e,t))}function CH(e){let t="";return e.split(" ").forEach(n=>{n.split("-").forEach(a=>{t+=a.substr(0,1)})}),t}function _H(e,t){let r=0,n=0;function i(u,l,c){for(let d=c,m=l.length;d-1))return rr.NO_MATCH}let s=n-o;return a(s)}function mC(e,t){return e.rank===t.rank?0:e.rank>t.rank?-1:1}function cC(e,t){let{keepDiacritics:r}=t;return e=`${e}`,r||(e=xH(e)),e}function MH(e,t){let r=t;typeof t=="object"&&(r=t.accessor);let n=r(e);return n==null?[]:Array.isArray(n)?n:[String(n)]}function TH(e,t){let r=[];for(let n=0,i=t.length;n{kn(s)||h.targetNode.instanceOf(HTMLAnchorElement)&&(h.targetNode.hasClass("internal-link")||h.targetNode.hasClass("external-link"))||c(h)},[c,s]),m=Ye(h=>{u({x:h.clientX,y:h.clientY})},[]);return E(Uu.Provider,{value:n,children:E("div",{onContextMenu:d,onDblClick:m,className:$("item-content-wrapper"),children:E("div",{className:$("item-title-wrapper"),children:[E(md,{boardModifiers:a,item:t,path:n,shouldMarkItemsComplete:l,stateManager:i}),E(ad,{editState:s,item:t,setEditState:u,showMetadata:!1,searchQuery:o==null?void 0:o.query,isStatic:!1})]})})})},(e,t)=>e.lane.data.shouldMarkItemsComplete===t.lane.data.shouldMarkItemsComplete&&(0,ny.default)(e.item,t.item)&&(0,ny.default)(e.path,t.path)),bC=zt(function({lane:t,path:r}){let{stateManager:n}=Ee(tt),i=Ee(zn);return E("div",{className:$("cell-flex-wrapper"),children:[E(Sa,{searchQuery:i==null?void 0:i.query,markdownString:t.data.title}),E("div",{onClick:a=>{let o=new yC.Menu,s=n.state.children;for(let u=0,l=s.length;ud.setChecked(t===c).setTitle(c.data.title).onClick(()=>{t!==c&&n.setState(m=>{let h=m.children[u];return Ri(m,r,[u,h.children.length])})}))}o.showAtMouseEvent(a)},className:Ge(["clickable-icon",$("icon-wrapper"),$("lane-menu")]),children:E(Ut,{name:"lucide-square-kanban"})})]})});var xs=qx(),DC=(e,t,r,n)=>{let i=e.getValue(t);if(i===null)return!1;let a=e.original.stateManager,o=i.value?In(i.value,a):In(i,a),s=hC(o,r,{threshold:rr.CONTAINS});return n({itemRank:s}),s.passed},Cs=(e,t,r)=>{var n,i;return!e.columnFiltersMeta[r]&&!t.columnFiltersMeta[r]?null:e.columnFiltersMeta[r]?t.columnFiltersMeta[r]?mC((n=e.columnFiltersMeta[r])==null?void 0:n.itemRank,(i=t.columnFiltersMeta[r])==null?void 0:i.itemRank):1:-1};function PH(e,t){return Re(()=>{var c;let r=[],n=new Set,i=new Set,a=new Set,o=new Map,s=(e==null?void 0:e.children)||[],u=t.getSetting("metadata-keys"),l=t.getSetting("inline-metadata-position")!=="body";for(let d=0,m=s.length;d{if(!a.has(O.key)&&(a.add(O.key),!o.has(O.key)))if(yi.has(O.key))o.set(O.key,No(O.key));else{let A=u.find(P=>P.metadataKey===O.key);o.set(O.key,(A==null?void 0:A.label)||O.key)}}),r.push({item:v,lane:h,path:[d,g],stateManager:t})}}return{items:r,metadataLabels:o,metadata:Array.from(n),fileMetadata:Array.from(i),inlineMetadata:Array.from(a)}},[e])}var NH=e=>[xs.accessor(t=>t.item.data.title,{id:"card",cell:t=>{let{lane:r,item:n,path:i}=t.row.original;return E(wC,{item:n,lane:r,path:i})},header:()=>R("Card"),sortingFn:(t,r,n)=>{let i=Cs(t,r,n);return i===null?fr(t.getValue(n),r.getValue(n)):i},size:e.card||272}),xs.accessor(t=>t.lane.data.title,{id:"lane",cell:t=>{let{lane:r,path:n}=t.row.original;return E(bC,{lane:r,path:n})},header:()=>R("List"),sortingFn:(t,r,n)=>{let i=Cs(t,r,n);return i===null?fr(t.getValue(n),r.getValue(n)):i},size:e.lane})];function SC(e,t){let r=Ee(zn),[n,i]=Ne([]),a=t.useSetting("show-relative-date"),o=t.useSetting("move-dates"),s=t.useSetting("move-tags"),u=t.useSetting("inline-metadata-position")!=="body",l=t.useSetting("move-task-metadata"),c=t.useSetting("table-sizing")||{},d=Fe(!1),m=Ye(A=>{i(P=>{let B=A(P);return B.length&&(d.current=B[0].desc),B})},[i]),h=Re(()=>({sorting:n,globalFilter:r==null?void 0:r.query}),[n,r==null?void 0:r.query]),{items:g,metadata:y,fileMetadata:v,inlineMetadata:D,metadataLabels:I}=PH(e,t),C=Re(()=>{let A=[...NH(c)];for(let P of y)switch(P){case"date":(a||o)&&A.push(xs.accessor(B=>{var G;return((G=B.item.data.metadata)==null?void 0:G.date)||null},{header:()=>R("Date"),id:"date",size:c.date,cell:B=>B.getValue()?E(vC,{item:B.row.original,shouldShowRelativeDate:a,hideDateDisplay:!o}):null,sortUndefined:!1,sortingFn:(B,G,J)=>{let Q=Cs(B,G,J);if(Q===null){let oe=B.getValue(J),te=G.getValue(J);return!oe&&!te?0:oe?te?oe.valueOf()-te.valueOf():d.current?1:-1:d.current?-1:1}return Q},sortDescFirst:!1}));break;case"tags":s&&A.push(xs.accessor(B=>{var G;return((G=B.item.data.metadata)==null?void 0:G.tags)||null},{header:()=>R("Tags"),id:"card-tags",size:c["card-tags"],cell:B=>{let G=B.table.getState().globalFilter,J=B.getValue();return J!=null&&J.length?E(ps,{tags:J,searchQuery:G}):null},sortUndefined:!1,sortingFn:(B,G,J)=>{var oe,te;let Q=Cs(B,G,J);if(Q===null){let re=B.getValue(J),ne=G.getValue(J);if(!(re!=null&&re.length)&&!(ne!=null&&ne.length))return 0;if(!(re!=null&&re.length))return d.current?-1:1;if(!(ne!=null&&ne.length))return d.current?1:-1;let be=t.getSetting("tag-sort"),pe=(oe=be==null?void 0:be.findIndex(Ce=>re.includes(Ce.tag)))!=null?oe:-1,De=(te=be==null?void 0:be.findIndex(Ce=>ne.includes(Ce.tag)))!=null?te:-1;return pe>-1&&De<0?-1:De>-1&&pe<0?1:pe>-1&&De>-1?pe-De:fr(re.join(""),ne.join(""))}return Q},sortDescFirst:!1}));break}return A},[a,o,s,...y]),x=Re(()=>{var P;let A=[...C];for(let B of D)A.push(xs.accessor(G=>{var Q;let J=(Q=G.item.data.metadata.inlineMetadata)==null?void 0:Q.find(oe=>oe.key===B);return J||null},{id:B,header:(P=I.get(B))!=null?P:B,cell:G=>{var be,pe,De;let J=G.getValue();if(!J)return null;let Q=yi.has(J.key);if(!l&&Q||!u&&!Q)return null;let oe=J.wrapping==="emoji-shorthand",te=(De=(pe=(be=il())==null?void 0:be.api)==null?void 0:pe.parse(J.value))!=null?De:J.value,re=oe&&J.key==="priority",ne=!!(te!=null&&te.ts);return E("span",{className:Ge([$("item-task-inline-metadata-item"),J.key.replace(/[^a-z0-9]/g,"-"),{"is-task-metadata":Q,"is-emoji":oe,"is-date":ne}]),children:!re&&E("span",{className:$("item-task-inline-metadata-item-value"),children:E(hs,{searchQuery:r==null?void 0:r.query,data:{value:te,label:"",metadataKey:J.key,shouldHideLabel:!1,containsMarkdown:!1}})})})},sortDescFirst:!1,sortingFn:(G,J,Q)=>{let oe=G.getValue(Q),te=J.getValue(Q);if(oe===null&&te===null)return 0;if(oe===null)return d.current?-1:1;if(te===null)return d.current?1:-1;let re=Cs(G,J,Q);return re===null?fr(In(oe.value,t),In(te.value,t)):re}}));return A},[C,...D,...I.values()]),O=Re(()=>{var P;let A=[...x];for(let B of v)A.push(xs.accessor(G=>{var Q;let J=(Q=G.item.data.metadata)==null?void 0:Q.fileMetadata;return J&&J[B]?J[B]:null},{id:B,header:(P=I.get(B))!=null?P:B,cell:G=>{let J=G.getValue();if(!J)return null;let Q=G.table.getState().globalFilter;return B==="tags"?E(ps,{searchQuery:Q,tags:J.value,alwaysShow:!0}):E(hs,{data:J,searchQuery:Q})},sortDescFirst:!1,sortingFn:(G,J,Q)=>{var ne,be;let oe=G.getValue(Q),te=J.getValue(Q);if(!(oe!=null&&oe.value)&&!(te!=null&&te.value))return 0;if(!(oe!=null&&oe.value))return d.current?-1:1;if(!(te!=null&&te.value))return d.current?1:-1;let re=Cs(G,J,Q);if(re===null){if(Q==="tags"){let pe=t.getSetting("tag-sort"),De=(ne=pe==null?void 0:pe.findIndex(U=>oe.value.includes(U.tag)))!=null?ne:-1,Ce=(be=pe==null?void 0:pe.findIndex(U=>te.value.includes(U.tag)))!=null?be:-1;if(De>-1&&Ce<0)return-1;if(Ce>-1&&De<0)return 1;if(De>-1&&Ce>-1)return De-Ce}return fr(In(oe.value,t),In(te.value,t))}return re}}));return A},[x,...v,...I.values()]);return{data:g,columns:O,state:h,setSorting:m}}function RH(){let e=Fe(),t=Fe(),r=Fe(new WeakMap),n=Fe([]);Ae(()=>()=>{var o;(o=e.current)==null||o.disconnect(),r.current=null,n.current.length=0},[]);let i=o=>{if(!o||t.current===o)return;e.current&&e.current.disconnect();let s=getComputedStyle(o);e.current=new IntersectionObserver(u=>{u.forEach(l=>{if(!r.current.has(l.target))return;r.current.get(l.target)(l)})},{root:o,threshold:.01,rootMargin:`${s.paddingTop} 0px ${s.paddingBottom} 0px`}),t.current=o,n.current.forEach(u=>e.current.observe(u)),n.current.length=0},a=Re(()=>({registerHandler:(o,s)=>{if(o){if(r.current.set(o,s),!e.current){n.current.push(o);return}e.current.observe(o)}},unregisterHandler:o=>{var s,u,l;o&&((s=r.current)==null||s.delete(o),(u=n.current)!=null&&u.length&&(n.current=n.current.filter(c=>c!==o)),(l=e.current)==null||l.unobserve(o))}}),[]);return{bindObserver:i,context:a}}function kC({boardData:e,stateManager:t}){let{bindObserver:r,context:n}=RH(),{data:i,columns:a,state:o,setSorting:s}=SC(e,t),u=lC({data:i,columns:a,state:o,globalFilterFn:DC,getColumnCanGlobalFilter:()=>!0,enableColumnResizing:!0,columnResizeMode:"onChange",columnResizeDirection:t.app.vault.getConfig("rightToLeft")?"rtl":"ltr",onSortingChange:s,getCoreRowModel:aC(),getSortedRowModel:sC(),getFilteredRowModel:oC()}),l=u.getState(),c=Fe(-1);Ae(()=>{if(c.current===-1){c.current=0;return}activeWindow.clearTimeout(c.current),c.current=activeWindow.setTimeout(()=>{t.getAView()&&t.setState(h=>(0,EC.default)(h,{data:{settings:{"table-sizing":{$set:l.columnSizing}}}}))},500)},[l.columnSizing]);let d=u.getCenterTotalSize(),m=Re(()=>({width:d}),[d]);return E("div",{className:`markdown-rendered ${$("table-wrapper")}`,ref:r,children:E(Lc.Provider,{value:n,children:E("table",{style:m,children:[E("thead",{children:u.getHeaderGroups().map(h=>E("tr",{children:h.headers.map(g=>{let y=g.column.getIsSorted();return E("th",{className:"mod-has-icon",children:E("div",{className:$("table-cell-wrapper"),style:{width:g.getSize()},children:[g.isPlaceholder?null:E("div",{className:$("table-header"),onClick:g.column.getToggleSortingHandler(),children:[E("div",{children:ty(g.column.columnDef.header,g.getContext())}),E("div",{className:$("table-header-sort"),children:y==="asc"?E(Ut,{name:"lucide-chevron-up"}):y==="desc"?E(Ut,{name:"lucide-chevron-down"}):E(Ut,{name:"lucide-chevrons-up-down"})})]}),E("div",{onDoubleClick:()=>g.column.resetSize(),onMouseDown:g.getResizeHandler(),onTouchStart:g.getResizeHandler(),className:`resizer ${u.options.columnResizeDirection} ${g.column.getIsResizing()?"isResizing":""}`})]})},g.id)})},h.id))}),E("tbody",{children:u.getRowModel().rows.map(h=>E("tr",{children:h.getVisibleCells().map(g=>E("td",{className:Ge({"mod-has-icon":g.column.id==="lane","mod-search-match":h.columnFiltersMeta[g.column.id]?h.columnFiltersMeta[g.column.id].itemRank.passed:!1}),children:E("div",{className:$("table-cell-wrapper"),style:{width:g.column.getSize()},children:ty(g.column.columnDef.cell,g.getContext())})},g.id))},h.id))})]})})})}var HH=[ft.Item,ft.Lane],BH=[ft.Lane];function VH(e){let t=[];return Array.isArray(e.cssclass)?t.push(...e.cssclass):typeof e.cssclass=="string"&&t.push(e.cssclass),Array.isArray(e.cssclasses)?t.push(...e.cssclasses):typeof e.cssclasses=="string"&&t.push(e.cssclasses),t}var CC=({view:e,stateManager:t})=>{let r=t.useState(),n=lx(),i=Fe(null),a=Fe(null),[o,s]=Ne(""),[u,l]=Ne(""),[c,d]=Ne(!1),[m,h]=Ne((r==null?void 0:r.children.length)===0),g=t.file.path,y=t.useSetting("max-archive-size"),v=t.useSetting("date-colors"),D=t.useSetting("tag-colors"),I=e.useViewState(_t),C=Ye(()=>{(r==null?void 0:r.children.length)>0&&h(!1)},[r==null?void 0:r.children.length]);Ae(()=>{(r==null?void 0:r.children.length)===0&&!t.hasError()&&h(!0)},[r==null?void 0:r.children.length,t]);let x=Ye(()=>{var J;(J=i.current)==null||J.win.setTimeout(()=>{var oe;let Q=(oe=i.current)==null?void 0:oe.getElementsByClassName($("board"));Q!=null&&Q.length&&vd([Q[0].scrollWidth,0],{elementToScroll:Q[0],speed:300,minDuration:150,easing:te=>te===1?1:1-Math.pow(2,-10*te)})})},[]);Ae(()=>{let J=oe=>{oe.commandId==="editor:open-search"&&(typeof oe.data=="string"?(d(!0),s(oe.data),l(oe.data)):d(te=>!te))},Q=()=>{h(!0)};return e.emitter.on("hotkey",J),e.emitter.on("showLaneForm",Q),()=>{e.emitter.off("hotkey",J),e.emitter.off("showLaneForm",Q)}},[e]),Ae(()=>{var J;c&&((J=a.current)==null||J.focus())},[c]),Ae(()=>{let J=e.getWindow(),Q=o.trim(),oe;return Q?oe=J.setTimeout(()=>{l(Q)},250):l(""),()=>{J.clearTimeout(oe)}},[o,e]),Ae(()=>{y===void 0||y===-1||typeof y=="number"&&(r==null?void 0:r.data.archive.length)>y&&t.setState(J=>(0,xC.default)(J,{data:{archive:{$set:J.data.archive.slice(y*-1)}}}))},[r==null?void 0:r.data.archive.length,y]);let O=Re(()=>Td(e,t),[t,e]),A=Re(()=>({view:e,stateManager:t,boardModifiers:O,filePath:g}),[e,t,O,g,v,D]),P=Ik(t);if(r==null)return E("div",{className:$("loading"),children:E("div",{className:"sk-pulse"})});if(r.data.errors.length>0)return E("div",{children:[E("div",{children:"Error:"}),r.data.errors.map((J,Q)=>E("div",{children:[E("div",{children:J.description}),E("pre",{children:J.stack})]},Q))]});let B=I==="list"?"vertical":"horizontal",G=wb(r,u,s,l,d);return E(ks,{id:e.id,children:E(tt.Provider,{value:A,children:E(zn.Provider,{value:G,children:E("div",{ref:i,className:Ge([Eh,{"something-is-dragging":n},...VH(r.data.frontmatter)]),...P,children:[(m||r.children.length===0)&&E(zx,{onNewLane:x,closeLaneForm:C}),c&&E("div",{className:$("search-wrapper"),children:[E("input",{ref:a,value:o,onChange:J=>{s(J.target.value)},onKeyDown:J=>{J.key==="Escape"&&(s(""),l(""),J.target.blur(),d(!1))},type:"text",className:$("filter-input"),placeholder:R("Search...")}),E("a",{className:`${$("search-cancel-button")} clickable-icon`,onClick:()=>{s(""),l(""),d(!1)},"aria-label":R("Cancel"),children:E(Ut,{name:"lucide-x"})})]}),I==="table"?E(kC,{boardData:r,stateManager:t}):E(Sd,{id:e.id,className:Ge([$("board"),{[$("horizontal")]:I!=="list",[$("vertical")]:I==="list","is-adding-lane":m}]),triggerTypes:HH,children:E("div",{children:E(Ia,{axis:B,children:[E(ox,{lanes:r.children,collapseDir:B}),E(Fa,{accepts:BH,className:$("lane-placeholder"),index:r.children.length})]})})})]})})})})};var qr="kanban",ho="lucide-trello",pn=class extends ea.TextFileView{constructor(r,n){super(r);this.actionButtons={};this.viewSettings={};this.initHeaderButtons=(0,ea.debounce)(()=>this._initHeaderButtons(),10,!0);this._initHeaderButtons=async()=>{if(ea.Platform.isPhone)return;let r=this.plugin.getStateManager(this.file);if(r)if(r.getSetting("show-board-settings")&&!this.actionButtons["show-board-settings"]?this.actionButtons["show-board-settings"]=this.addAction("lucide-settings",R("Open board settings"),()=>{this.getBoardSettings()}):!r.getSetting("show-board-settings")&&this.actionButtons["show-board-settings"]&&(this.actionButtons["show-board-settings"].remove(),delete this.actionButtons["show-board-settings"]),r.getSetting("show-set-view")&&!this.actionButtons["show-set-view"]?this.actionButtons["show-set-view"]=this.addAction("lucide-view",R("Board view"),n=>{let i=this.viewSettings[_t]||r.getSetting(_t);new ea.Menu().addItem(a=>a.setTitle(R("View as board")).setIcon("lucide-trello").setChecked(i==="basic"||i==="board").onClick(()=>this.setView("board"))).addItem(a=>a.setTitle(R("View as table")).setIcon("lucide-table").setChecked(i==="table").onClick(()=>this.setView("table"))).addItem(a=>a.setTitle(R("View as list")).setIcon("lucide-server").setChecked(i==="list").onClick(()=>this.setView("list"))).showAtMouseEvent(n)}):!r.getSetting("show-set-view")&&this.actionButtons["show-set-view"]&&(this.actionButtons["show-set-view"].remove(),delete this.actionButtons["show-set-view"]),r.getSetting("show-search")&&!this.actionButtons["show-search"]?this.actionButtons["show-search"]=this.addAction("lucide-search",R("Search..."),()=>{this.emitter.emit("hotkey",{commandId:"editor:open-search"})}):!r.getSetting("show-search")&&this.actionButtons["show-search"]&&(this.actionButtons["show-search"].remove(),delete this.actionButtons["show-search"]),r.getSetting("show-view-as-markdown")&&!this.actionButtons["show-view-as-markdown"]?this.actionButtons["show-view-as-markdown"]=this.addAction("lucide-file-text",R("Open as markdown"),()=>{this.plugin.kanbanFileModes[this.leaf.id||this.file.path]="markdown",this.plugin.setMarkdownView(this.leaf)}):!r.getSetting("show-view-as-markdown")&&this.actionButtons["show-view-as-markdown"]&&(this.actionButtons["show-view-as-markdown"].remove(),delete this.actionButtons["show-view-as-markdown"]),r.getSetting("show-archive-all")&&!this.actionButtons["show-archive-all"]?this.actionButtons["show-archive-all"]=this.addAction("lucide-archive",R("Archive completed cards"),()=>{this.plugin.stateManagers.get(this.file).archiveCompletedCards()}):!r.getSetting("show-archive-all")&&this.actionButtons["show-archive-all"]&&(this.actionButtons["show-archive-all"].remove(),delete this.actionButtons["show-archive-all"]),r.getSetting("show-add-list")&&!this.actionButtons["show-add-list"]){let n=this.addAction("lucide-plus-circle",R("Add a list"),()=>{this.emitter.emit("showLaneForm",void 0)});n.addClass($("ignore-click-outside")),this.actionButtons["show-add-list"]=n}else!r.getSetting("show-add-list")&&this.actionButtons["show-add-list"]&&(this.actionButtons["show-add-list"].remove(),delete this.actionButtons["show-add-list"])};this.plugin=n,this.emitter=new Bo,this.previewCache=new Map,this.previewQueue=new Ac(()=>this.emitter.emit("queueEmpty")),this.emitter.on("hotkey",({commandId:i})=>{switch(i){case"daily-notes:goto-prev":{Sk(this.app,this.file);break}case"daily-notes:goto-next":{Dk(this.app,this.file);break}}}),VS(this)}get isPrimary(){var r;return((r=this.plugin.getStateManager(this.file))==null?void 0:r.getAView())===this}get id(){var r;return`${this.leaf.id}:::${(r=this.file)==null?void 0:r.path}`}get isShiftPressed(){return this.plugin.isShiftPressed}async prerender(r){r.children.forEach(n=>{n.children.forEach(i=>{this.previewCache.has(i.id)||this.previewQueue.add(async()=>{let a=this.addChild(new Ll(this,i.data.title));this.previewCache.set(i.id,a),await a.renderCapability.promise})})}),this.previewQueue.isRunning&&await new Promise(n=>{this.emitter.once("queueEmpty",n)}),this.initHeaderButtons()}validatePreviewCache(r){let n=new Set;r.children.forEach(i=>{n.add(i.id),i.children.forEach(a=>{n.add(a.id)})});for(let i of this.previewCache.keys())n.has(i)||(this.removeChild(this.previewCache.get(i)),this.previewCache.delete(i))}setView(r){this.setViewState(_t,r),this.app.fileManager.processFrontMatter(this.file,n=>{n[_t]=r})}setBoard(r,n=!0){this.plugin.stateManagers.get(this.file).setState(r,n)}getBoard(){return this.plugin.stateManagers.get(this.file).state}getViewType(){return qr}getIcon(){return ho}getDisplayText(){var r;return((r=this.file)==null?void 0:r.basename)||"Kanban"}getWindow(){return Dn(this.containerEl)}async loadFile(r){return this.plugin.removeView(this),super.loadFile(r)}async onLoadFile(r){try{return await super.onLoadFile(r)}catch(n){let i=this.plugin.stateManagers.get(this.file);throw i==null||i.setError(n),n}}onload(){super.onload(),ea.Platform.isMobile&&this.containerEl.setCssProps({"--mobile-navbar-height":this.app.mobileNavbar.containerEl.clientHeight+"px"}),this.register(this.containerEl.onWindowMigrated(()=>{this.plugin.removeView(this),this.plugin.addView(this,this.data,this.isPrimary)}))}onunload(){super.onunload(),this.previewQueue.clear(),this.previewCache.clear(),this.emitter.emit("queueEmpty"),this.plugin.removeView(this),this.emitter.removeAllListeners(),this.activeEditor=null,this.actionButtons={}}handleRename(r,n){this.file.path===r&&this.plugin.handleViewFileRename(this,n)}requestSaveToDisk(r){this.data!==r&&this.isPrimary?(this.data=r,this.requestSave()):this.data=r}getViewData(){return this.data}setViewData(r,n){if(!Ek(r)){this.plugin.kanbanFileModes[this.leaf.id||this.file.path]="markdown",this.plugin.removeView(this),this.plugin.setMarkdownView(this.leaf,!1);return}n&&(this.activeEditor=null,this.previewQueue.clear(),this.previewCache.clear(),this.emitter.emit("queueEmpty"),Object.values(this.actionButtons).forEach(i=>i.remove()),this.actionButtons={}),this.plugin.addView(this,r,!n&&this.isPrimary)}async setState(r,n){this.viewSettings={...r.kanbanViewState},await super.setState(r,n)}getState(){let r=super.getState();return r.kanbanViewState={...this.viewSettings},r}setViewState(r,n,i){i?this.plugin.getStateManager(this.file).viewSet.forEach(o=>{o.viewSettings[r]=i(o.viewSettings[r])}):n&&(this.viewSettings[r]=n),this.app.workspace.requestSaveLayout()}populateViewState(r){var n,i,a,o;(i=(n=this.viewSettings)["kanban-plugin"])!=null||(n["kanban-plugin"]=r["kanban-plugin"]||"board"),(o=(a=this.viewSettings)["list-collapse"])!=null||(a["list-collapse"]=r["list-collapse"]||[])}getViewState(r){var a;let i=this.plugin.stateManagers.get(this.file).getSetting(r);return(a=this.viewSettings[r])!=null?a:i}useViewState(r){var a;let i=this.plugin.stateManagers.get(this.file).useSetting(r);return(a=this.viewSettings[r])!=null?a:i}getPortal(){let r=this.plugin.stateManagers.get(this.file);return E(CC,{stateManager:r,view:this})}getBoardSettings(){let r=this.plugin.stateManagers.get(this.file),n=r.state;new $d(this,{onSettingsChange:i=>{let a=(0,_C.default)(n,{data:{settings:{$set:i}}});r.setState(a)}},n.data.settings).open()}onPaneMenu(r,n,i=!0){if(n!=="more-options"){super.onPaneMenu(r,n);return}r.addItem(a=>{a.setTitle(R("Open as markdown")).setIcon("lucide-file-text").setSection("pane").onClick(()=>{this.plugin.kanbanFileModes[this.leaf.id||this.file.path]="markdown",this.plugin.setMarkdownView(this.leaf)})}).addItem(a=>{a.setTitle(R("Open board settings")).setIcon("lucide-settings").setSection("pane").onClick(()=>{this.getBoardSettings()})}).addItem(a=>{a.setTitle(R("Archive completed cards")).setIcon("lucide-archive").setSection("pane").onClick(()=>{this.plugin.stateManagers.get(this.file).archiveCompletedCards()})}),i&&super.onPaneMenu(r,n)}clear(){}};var Ps=Ct(ln()),K_=require("obsidian");var Y_=require("obsidian"),z_=Ct(Ic());var FC=Ct(Wm()),IC=Ct(Ic()),qd="remove",Gd="replace",AC="add";function mo(e){if(!e)return!1;if(Ni(e)||Array.isArray(e))return!0;let t=(0,IC.getAPI)();return!!(!FC.default.isMoment(e)&&(t!=null&&t.value.isObject(e)))}function OC(e,t,r=()=>!1,n=i=>String(i)){if(!mo(e)||!mo(t))throw new Error("both arguments must be objects or arrays");let i=LC(e,t,[],[],{remove:[],replace:[],add:[]},r,n);return i.remove.reverse().concat(i.replace).concat(i.add)}function LC(e,t,r,n,i,a,o){if(!mo(e)||!mo(t))return i;let s=Object.keys(e),u=Object.keys(t),l=u.length,c=e.length-t.length,d;if(UH(e,t)){for(let m of s){let h=Array.isArray(e)?Number(m):m;if(!(h in t)){if(d=n.concat(h),a(d))continue;i.remove.push({op:qd,path:d})}}for(let m of u){let h=Array.isArray(t)?Number(m):m;MC(h,e,t,r.concat(h),r.concat(h),i,a,o)}}else{for(let h=0;h0){let n=0,i=0;for(let a=0;a0&&String(e[a+r])===String(t[a]);a--)i++;return n>=i}return!0}function PC(e,t){if(!mo(e))throw new Error("base object must be an object or an array");if(!Array.isArray(t))throw new Error("diff must be an array");Array.isArray(e)?e=e.slice():e={...e};for(let r of t){let n=r.op,a=r.path.slice(),o=a.pop(),s=e;if(TC(o),o==null)return!1;let u;for(;(u=a.shift())!==null&&u!==void 0;)TC(u),u in s?Array.isArray(s[u])?s=s[u]=s[u].slice():Ni(s[u])?s=s[u]={...s[u]}:s=s[u]:s=s[u]={};if(n===qd||n===Gd){let l=r.path;if(!Object.prototype.hasOwnProperty.call(s,o))throw new Error(["expected to find property",l,"in object",e].join(" "))}n===qd&&typeof o=="number"&&(Array.isArray(s)?s.splice(o,1):delete s[o]),(n===Gd||n===AC)&&(s[o]=r.value)}return e}function TC(e){if(e==="__proto__"||e==="constructor"||e==="prototype")throw new Error("setting of prototype values not supported")}var pf=Ct(ln());var WH={};function _s(e,t){let r=t||WH,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return RC(e,n,i)}function RC(e,t,r){if(YH(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return NC(e.children,t,r)}return Array.isArray(e)?NC(e,t,r):""}function NC(e,t,r){let n=[],i=-1;for(;++i":""))+")"})}return d;function d(){let m=[],h,g,y;if((!t||i(s,u,l[l.length-1]||null))&&(m=GH(r(s,l)),m[0]===Qd))return m;if(s.children&&m[0]!==iy)for(g=(n?s.children.length:-1)+a,y=l.concat(s);g>-1&&g!0){for(let i=t+1,a=e.length;i{let h="";return c&&(c.backgroundColor?(m+=" has-background",h=` style="--date-color: ${c.color}; --date-background-color: ${c.backgroundColor};"`):h=` style="--date-color: ${c.color};"`),{wrapperClass:m,wrapperStyle:h}};return t=t.replace(new RegExp(`(^|\\s)${Qn(n)}\\[\\[([^\\]]+)\\]\\]`,"g"),(m,h,g)=>{var C,x;let y=(0,po.moment)(g,i);if(!y.isValid())return m;l=y;let v=u.metadataCache.getFirstLinkpathDest(g,e.file.path);c||(c=r(y));let{wrapperClass:D,wrapperStyle:I}=d($("preview-date-wrapper"));return`${h}${y.format(a)}`}),t=t.replace(new RegExp(`(^|\\s)${Qn(n)}\\[([^\\]]+)\\]\\([^)]+\\)`,"g"),(m,h,g)=>{var C,x;let y=(0,po.moment)(g,i);if(!y.isValid())return m;l=y;let v=u.metadataCache.getFirstLinkpathDest(g,e.file.path);c||(c=r(y));let{wrapperClass:D,wrapperStyle:I}=d($("preview-date-wrapper"));return`${h}${y.format(a)}`}),t=t.replace(new RegExp(`(^|\\s)${Qn(n)}{([^}]+)}`,"g"),(m,h,g)=>{let y=(0,po.moment)(g,i);if(!y.isValid())return m;l=y,c||(c=r(y));let{wrapperClass:v,wrapperStyle:D}=d($("preview-date-wrapper"));return`${h}${y.format(a)}`}),t=t.replace(new RegExp(`(^|\\s)${Qn(o)}{([^}]+)}`,"g"),(m,h,g)=>{let y=(0,po.moment)(g,s);if(!y.isValid())return m;l?(l.hour(y.hour()),l.minute(y.minute()),l.second(y.second())):(l=y,l.year(1970));let{wrapperClass:v,wrapperStyle:D}=d($("preview-time-wrapper"));return`${h}${y.format(s)}`}),t}function ql(e,t){let{dateStr:r,timeStr:n,fileAccessor:i}=t.data.metadata;if(r&&(t.data.metadata.date=(0,po.moment)(r,e.getSetting("date-format"))),n){let a=(0,po.moment)(n,e.getSetting("time-format"));if(t.data.metadata.date){let o=t.data.metadata.date;o.hour(a.hour()),o.minute(a.minute()),o.second(a.second()),a=o.clone()}t.data.metadata.time=a}if(i){let a=e.app.metadataCache.getFirstLinkpathDest(i.target,e.file.path);a&&(t.data.metadata.file=a)}return t.data.titleSearch=wk(t,e),t}function UC(e,t){try{t.children.map(r=>{VC(e,r),r.children.map(n=>ql(e,n))})}catch(r){throw e.setError(r),r}return t}function JH(e){return(e.op==="add"||e.op==="replace")&&["title","titleRaw","dateStr","timeStr",/\d$/,/\/fileAccessor\/.+$/].some(t=>typeof t=="string"?e.path.last().toString().endsWith(t):t.test(e.path.last().toString()))}function WC(e,t,r){let n={};return r.reduce((a,o)=>{if(!JH(o))return a;let s=o.path.reduce((l,c)=>(typeof c=="number"&&l.push(c),l),[]),u=s.join(",");return n[u]||(n[u]=!0,a.push(s)),a},[]).map(a=>{let o=un(t,a);if(o.type===ft.Lane)return VC(e,o);if(o.type===ft.Item)return ql(e,o)}),t}function Kn(e,t,r,n){let i=e.length,a=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);a0?(Kn(e,e.length,0,t),e):t}var YC={}.hasOwnProperty;function zC(e){let t={},r=-1;for(;++ro))return;let P=t.events.length,B=P,G,J;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(G){J=t.events[B][1].end;break}G=!0}for(D(n),A=P;AC;){let O=r[x];t.containerState=O[1],O[0].exit.call(t,e)}r.length=C}function I(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function t3(e,t,r){return je(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function sy(e){if(e===null||Kt(e)||ZC(e))return 1;if(JC(e))return 2}function Ms(e,t,r){let n=[],i=-1;for(;++i1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;let d=Object.assign({},e[n][1].end),m=Object.assign({},e[r][1].start);t_(d,-u),t_(m,u),o={type:u>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[n][1].end)},s={type:u>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[r][1].start),end:m},a={type:u>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[r][1].start)},i={type:u>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},e[n][1].end=Object.assign({},o.start),e[r][1].start=Object.assign({},s.end),l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=mr(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=mr(l,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",a,t]]),l=mr(l,Ms(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),l=mr(l,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(c=2,l=mr(l,[["enter",e[r][1],t],["exit",e[r][1],t]])):c=0,Kn(e,n-1,r-n+3,l),r=n+l.length-c-2;break}}for(r=-1;++r0&&Be(A)?je(e,I,"linePrefix",a+1)(A):I(A)}function I(A){return A===null||xe(A)?e.check(r_,y,x)(A):(e.enter("codeFlowValue"),C(A))}function C(A){return A===null||xe(A)?(e.exit("codeFlowValue"),I(A)):(e.consume(A),C)}function x(A){return e.exit("codeFenced"),t(A)}function O(A,P,B){let G=0;return J;function J(ne){return A.enter("lineEnding"),A.consume(ne),A.exit("lineEnding"),Q}function Q(ne){return A.enter("codeFencedFence"),Be(ne)?je(A,oe,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):oe(ne)}function oe(ne){return ne===s?(A.enter("codeFencedFenceSequence"),te(ne)):B(ne)}function te(ne){return ne===s?(G++,A.consume(ne),te):G>=o?(A.exit("codeFencedFenceSequence"),Be(ne)?je(A,re,"whitespace")(ne):re(ne)):B(ne)}function re(ne){return ne===null||xe(ne)?(A.exit("codeFencedFence"),P(ne)):B(ne)}}}function f3(e,t,r){let n=this;return i;function i(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}var Ql={name:"codeIndented",tokenize:m3},h3={tokenize:p3,partial:!0};function m3(e,t,r){let n=this;return i;function i(l){return e.enter("codeIndented"),je(e,a,"linePrefix",5)(l)}function a(l){let c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(l):r(l)}function o(l){return l===null?u(l):xe(l)?e.attempt(h3,o,u)(l):(e.enter("codeFlowValue"),s(l))}function s(l){return l===null||xe(l)?(e.exit("codeFlowValue"),o(l)):(e.consume(l),s)}function u(l){return e.exit("codeIndented"),t(l)}}function p3(e,t,r){let n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):je(e,a,"linePrefix",5)(o)}function a(o){let s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):xe(o)?i(o):r(o)}}var uy={name:"codeText",tokenize:v3,resolve:g3,previous:y3};function g3(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function sf(e,t,r,n,i,a,o,s,u){let l=u||Number.POSITIVE_INFINITY,c=0;return d;function d(D){return D===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(D),e.exit(a),m):D===null||D===32||D===41||Gl(D)?r(D):(e.enter(n),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),y(D))}function m(D){return D===62?(e.enter(a),e.consume(D),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(D))}function h(D){return D===62?(e.exit("chunkString"),e.exit(s),m(D)):D===null||D===60||xe(D)?r(D):(e.consume(D),D===92?g:h)}function g(D){return D===60||D===62||D===92?(e.consume(D),h):h(D)}function y(D){return!c&&(D===null||D===41||Kt(D))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(n),t(D)):c999||h===null||h===91||h===93&&!u||h===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?r(h):h===93?(e.exit(a),e.enter(i),e.consume(h),e.exit(i),e.exit(n),t):xe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||xe(h)||s++>999?(e.exit("chunkString"),c(h)):(e.consume(h),u||(u=!Be(h)),h===92?m:d)}function m(h){return h===91||h===92||h===93?(e.consume(h),s++,d):d(h)}}function uf(e,t,r,n,i,a){let o;return s;function s(m){return m===34||m===39||m===40?(e.enter(n),e.enter(i),e.consume(m),e.exit(i),o=m===40?41:m,u):r(m)}function u(m){return m===o?(e.enter(i),e.consume(m),e.exit(i),e.exit(n),t):(e.enter(a),l(m))}function l(m){return m===o?(e.exit(a),u(o)):m===null?r(m):xe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),je(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===o||m===null||xe(m)?(e.exit("chunkString"),l(m)):(e.consume(m),m===92?d:c)}function d(m){return m===o||m===92?(e.consume(m),c):c(m)}}function go(e,t){let r;return n;function n(i){return xe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):Be(i)?je(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}function ta(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var dy={name:"definition",tokenize:x3},k3={tokenize:C3,partial:!0};function x3(e,t,r){let n=this,i;return a;function a(h){return e.enter("definition"),o(h)}function o(h){return lf.call(n,e,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function s(h){return i=ta(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),u):r(h)}function u(h){return Kt(h)?go(e,l)(h):l(h)}function l(h){return sf(e,c,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(k3,d,d)(h)}function d(h){return Be(h)?je(e,m,"whitespace")(h):m(h)}function m(h){return h===null||xe(h)?(e.exit("definition"),n.parser.defined.push(i),t(h)):r(h)}}function C3(e,t,r){return n;function n(s){return Kt(s)?go(e,i)(s):r(s)}function i(s){return uf(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return Be(s)?je(e,o,"whitespace")(s):o(s)}function o(s){return s===null||xe(s)?t(s):r(s)}}var fy={name:"hardBreakEscape",tokenize:_3};function _3(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return xe(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}var hy={name:"headingAtx",tokenize:T3,resolve:M3};function M3(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Kn(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function T3(e,t,r){let n=0;return i;function i(c){return e.enter("atxHeading"),a(c)}function a(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&n++<6?(e.consume(c),o):c===null||Kt(c)?(e.exit("atxHeadingSequence"),s(c)):r(c)}function s(c){return c===35?(e.enter("atxHeadingSequence"),u(c)):c===null||xe(c)?(e.exit("atxHeading"),t(c)):Be(c)?je(e,s,"whitespace")(c):(e.enter("atxHeadingText"),l(c))}function u(c){return c===35?(e.consume(c),u):(e.exit("atxHeadingSequence"),s(c))}function l(c){return c===null||c===35||Kt(c)?(e.exit("atxHeadingText"),s(c)):(e.consume(c),l)}}var i_=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],my=["pre","script","style","textarea"];var py={name:"htmlFlow",tokenize:O3,resolveTo:A3,concrete:!0},F3={tokenize:P3,partial:!0},I3={tokenize:L3,partial:!0};function A3(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function O3(e,t,r){let n=this,i,a,o,s,u;return l;function l(N){return c(N)}function c(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),d}function d(N){return N===33?(e.consume(N),m):N===47?(e.consume(N),a=!0,y):N===63?(e.consume(N),i=3,n.interrupt?t:U):Nr(N)?(e.consume(N),o=String.fromCharCode(N),v):r(N)}function m(N){return N===45?(e.consume(N),i=2,h):N===91?(e.consume(N),i=5,s=0,g):Nr(N)?(e.consume(N),i=4,n.interrupt?t:U):r(N)}function h(N){return N===45?(e.consume(N),n.interrupt?t:U):r(N)}function g(N){let Ze="CDATA[";return N===Ze.charCodeAt(s++)?(e.consume(N),s===Ze.length?n.interrupt?t:oe:g):r(N)}function y(N){return Nr(N)?(e.consume(N),o=String.fromCharCode(N),v):r(N)}function v(N){if(N===null||N===47||N===62||Kt(N)){let Ze=N===47,It=o.toLowerCase();return!Ze&&!a&&my.includes(It)?(i=1,n.interrupt?t(N):oe(N)):i_.includes(o.toLowerCase())?(i=6,Ze?(e.consume(N),D):n.interrupt?t(N):oe(N)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(N):a?I(N):C(N))}return N===45||pr(N)?(e.consume(N),o+=String.fromCharCode(N),v):r(N)}function D(N){return N===62?(e.consume(N),n.interrupt?t:oe):r(N)}function I(N){return Be(N)?(e.consume(N),I):J(N)}function C(N){return N===47?(e.consume(N),J):N===58||N===95||Nr(N)?(e.consume(N),x):Be(N)?(e.consume(N),C):J(N)}function x(N){return N===45||N===46||N===58||N===95||pr(N)?(e.consume(N),x):O(N)}function O(N){return N===61?(e.consume(N),A):Be(N)?(e.consume(N),O):C(N)}function A(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),u=N,P):Be(N)?(e.consume(N),A):B(N)}function P(N){return N===u?(e.consume(N),u=null,G):N===null||xe(N)?r(N):(e.consume(N),P)}function B(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Kt(N)?O(N):(e.consume(N),B)}function G(N){return N===47||N===62||Be(N)?C(N):r(N)}function J(N){return N===62?(e.consume(N),Q):r(N)}function Q(N){return N===null||xe(N)?oe(N):Be(N)?(e.consume(N),Q):r(N)}function oe(N){return N===45&&i===2?(e.consume(N),be):N===60&&i===1?(e.consume(N),pe):N===62&&i===4?(e.consume(N),Je):N===63&&i===3?(e.consume(N),U):N===93&&i===5?(e.consume(N),Ce):xe(N)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(F3,it,te)(N)):N===null||xe(N)?(e.exit("htmlFlowData"),te(N)):(e.consume(N),oe)}function te(N){return e.check(I3,re,it)(N)}function re(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),ne}function ne(N){return N===null||xe(N)?te(N):(e.enter("htmlFlowData"),oe(N))}function be(N){return N===45?(e.consume(N),U):oe(N)}function pe(N){return N===47?(e.consume(N),o="",De):oe(N)}function De(N){if(N===62){let Ze=o.toLowerCase();return my.includes(Ze)?(e.consume(N),Je):oe(N)}return Nr(N)&&o.length<8?(e.consume(N),o+=String.fromCharCode(N),De):oe(N)}function Ce(N){return N===93?(e.consume(N),U):oe(N)}function U(N){return N===62?(e.consume(N),Je):N===45&&i===2?(e.consume(N),U):oe(N)}function Je(N){return N===null||xe(N)?(e.exit("htmlFlowData"),it(N)):(e.consume(N),Je)}function it(N){return e.exit("htmlFlow"),t(N)}}function L3(e,t,r){let n=this;return i;function i(o){return xe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):r(o)}function a(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function P3(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Na,t,r)}}var gy={name:"htmlText",tokenize:N3};function N3(e,t,r){let n=this,i,a,o;return s;function s(U){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(U),u}function u(U){return U===33?(e.consume(U),l):U===47?(e.consume(U),O):U===63?(e.consume(U),C):Nr(U)?(e.consume(U),B):r(U)}function l(U){return U===45?(e.consume(U),c):U===91?(e.consume(U),a=0,g):Nr(U)?(e.consume(U),I):r(U)}function c(U){return U===45?(e.consume(U),h):r(U)}function d(U){return U===null?r(U):U===45?(e.consume(U),m):xe(U)?(o=d,pe(U)):(e.consume(U),d)}function m(U){return U===45?(e.consume(U),h):d(U)}function h(U){return U===62?be(U):U===45?m(U):d(U)}function g(U){let Je="CDATA[";return U===Je.charCodeAt(a++)?(e.consume(U),a===Je.length?y:g):r(U)}function y(U){return U===null?r(U):U===93?(e.consume(U),v):xe(U)?(o=y,pe(U)):(e.consume(U),y)}function v(U){return U===93?(e.consume(U),D):y(U)}function D(U){return U===62?be(U):U===93?(e.consume(U),D):y(U)}function I(U){return U===null||U===62?be(U):xe(U)?(o=I,pe(U)):(e.consume(U),I)}function C(U){return U===null?r(U):U===63?(e.consume(U),x):xe(U)?(o=C,pe(U)):(e.consume(U),C)}function x(U){return U===62?be(U):C(U)}function O(U){return Nr(U)?(e.consume(U),A):r(U)}function A(U){return U===45||pr(U)?(e.consume(U),A):P(U)}function P(U){return xe(U)?(o=P,pe(U)):Be(U)?(e.consume(U),P):be(U)}function B(U){return U===45||pr(U)?(e.consume(U),B):U===47||U===62||Kt(U)?G(U):r(U)}function G(U){return U===47?(e.consume(U),be):U===58||U===95||Nr(U)?(e.consume(U),J):xe(U)?(o=G,pe(U)):Be(U)?(e.consume(U),G):be(U)}function J(U){return U===45||U===46||U===58||U===95||pr(U)?(e.consume(U),J):Q(U)}function Q(U){return U===61?(e.consume(U),oe):xe(U)?(o=Q,pe(U)):Be(U)?(e.consume(U),Q):G(U)}function oe(U){return U===null||U===60||U===61||U===62||U===96?r(U):U===34||U===39?(e.consume(U),i=U,te):xe(U)?(o=oe,pe(U)):Be(U)?(e.consume(U),oe):(e.consume(U),re)}function te(U){return U===i?(e.consume(U),i=void 0,ne):U===null?r(U):xe(U)?(o=te,pe(U)):(e.consume(U),te)}function re(U){return U===null||U===34||U===39||U===60||U===61||U===96?r(U):U===47||U===62||Kt(U)?G(U):(e.consume(U),re)}function ne(U){return U===47||U===62||Kt(U)?G(U):r(U)}function be(U){return U===62?(e.consume(U),e.exit("htmlTextData"),e.exit("htmlText"),t):r(U)}function pe(U){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),De}function De(U){return Be(U)?je(e,Ce,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):Ce(U)}function Ce(U){return e.enter("htmlTextData"),o(U)}}var yo={name:"labelEnd",tokenize:U3,resolveTo:$3,resolveAll:V3},R3={tokenize:W3},H3={tokenize:Y3},B3={tokenize:z3};function V3(e){let t=-1;for(;++t=3&&(l===null||xe(l))?(e.exit("thematicBreak"),t(l)):r(l)}function u(l){return l===i?(e.consume(l),n++,u):(e.exit("thematicBreakSequence"),Be(l)?je(e,s,"whitespace")(l):s(l))}}var ir={name:"list",tokenize:Q3,continuation:{tokenize:X3},exit:tB},J3={tokenize:nB,partial:!0},Z3={tokenize:eB,partial:!0};function Q3(e,t,r){let n=this,i=n.events[n.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(h){let g=n.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||h===n.containerState.marker:Jl(h)){if(n.containerState.type||(n.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(vo,r,l)(h):l(h);if(!n.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(h)}return r(h)}function u(h){return Jl(h)&&++o<10?(e.consume(h),u):(!n.interrupt||o<2)&&(n.containerState.marker?h===n.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),l(h)):r(h)}function l(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||h,e.check(Na,n.interrupt?r:c,e.attempt(J3,m,d))}function c(h){return n.containerState.initialBlankLine=!0,a++,m(h)}function d(h){return Be(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),m):r(h)}function m(h){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function X3(e,t,r){let n=this;return n.containerState._closeFlow=void 0,e.check(Na,i,a);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,je(e,t,"listItemIndent",n.containerState.size+1)(s)}function a(s){return n.containerState.furtherBlankLines||!Be(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(Z3,t,o)(s))}function o(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,je(e,e.attempt(ir,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function eB(e,t,r){let n=this;return je(e,i,"listItemIndent",n.containerState.size+1);function i(a){let o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(a):r(a)}}function tB(e){e.exit(this.containerState.type)}function nB(e,t,r){let n=this;return je(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let o=n.events[n.events.length-1];return!Be(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}var cf={name:"setextUnderline",tokenize:iB,resolveTo:rB};function rB(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);let o={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",o,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[a][1].end)):e[n][1]=o,e.push(["exit",o,t]),e}function iB(e,t,r){let n=this,i;return a;function a(l){let c=n.events.length,d;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){d=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(e.enter("setextHeadingLine"),i=l,o(l)):r(l)}function o(l){return e.enter("setextHeadingLineSequence"),s(l)}function s(l){return l===i?(e.consume(l),s):(e.exit("setextHeadingLineSequence"),Be(l)?je(e,u,"lineSuffix")(l):u(l))}function u(l){return l===null||xe(l)?(e.exit("setextHeadingLine"),t(l)):r(l)}}var a_={tokenize:aB};function aB(e){let t=this,r=e.attempt(Na,n,e.attempt(this.parser.constructs.flowInitial,i,je(e,e.attempt(this.parser.constructs.flow,i,e.attempt(cy,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}var o_={resolveAll:c_()},s_=u_("string"),l_=u_("text");function u_(e){return{tokenize:t,resolveAll:c_(e==="text"?oB:void 0)};function t(r){let n=this,i=this.parser.constructs[e],a=r.attempt(i,o,s);return o;function o(c){return l(c)?a(c):s(c)}function s(c){if(c===null){r.consume(c);return}return r.enter("data"),r.consume(c),u}function u(c){return l(c)?(r.exit("data"),a(c)):(r.consume(c),u)}function l(c){if(c===null)return!0;let d=i[c],m=-1;if(d)for(;++m-1){let s=o[0];typeof s=="string"?o[0]=s.slice(n):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function lB(e,t){let r=-1,n=[],i;for(;++rgB,contentInitial:()=>cB,disable:()=>yB,document:()=>uB,flow:()=>fB,flowInitial:()=>dB,insideSpan:()=>pB,string:()=>hB,text:()=>mB});var uB={42:ir,43:ir,45:ir,48:ir,49:ir,50:ir,51:ir,52:ir,53:ir,54:ir,55:ir,56:ir,57:ir,62:tf},cB={91:dy},dB={[-2]:Ql,[-1]:Ql,32:Ql},fB={35:hy,42:vo,45:[cf,vo],60:py,61:cf,95:vo,96:af,126:af},hB={38:rf,92:nf},mB={[-5]:Xl,[-4]:Xl,[-3]:Xl,33:yy,38:rf,42:Zl,60:[ly,gy],91:vy,92:[fy,nf],93:yo,95:Zl,96:uy},pB={null:[Zl,o_]},gB={null:[42,95]},yB={null:[]};function f_(e){let r=zC([wy,...(e||{}).extensions||[]]),n={defined:[],lazy:{},constructs:r,content:i(QC),document:i(e_),flow:i(a_),string:i(s_),text:i(l_)};return n;function i(a){return o;function o(s){return d_(n,a,s)}}}var h_=/[\0\t\n\r]/g;function m_(){let e=1,t="",r=!0,n;return i;function i(a,o,s){let u=[],l,c,d,m,h;for(a=t+a.toString(o),d=0,t="",r&&(a.charCodeAt(0)===65279&&d++,r=void 0);d13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"\uFFFD":String.fromCharCode(r)}var vB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function g_(e){return e.replace(vB,wB)}function wB(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){let i=r.charCodeAt(1),a=i===120||i===88;return df(r.slice(a?2:1),a?16:10)}return Ts(r)||e}function Fs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?y_(e.position):"start"in e||"end"in e?y_(e):"line"in e||"column"in e?by(e):""}function by(e){return v_(e&&e.line)+":"+v_(e&&e.column)}function y_(e){return by(e&&e.start)+"-"+by(e&&e.end)}function v_(e){return e&&typeof e=="number"?e:1}var b_={}.hasOwnProperty,ff=function(e,t,r){return typeof t!="string"&&(r=t,t=void 0),bB(r)(p_(f_(r).document().write(m_()(e,t,!0))))};function bB(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Vt),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:s(xn),blockQuote:s(Jt),characterEscape:Q,characterReference:Q,codeFenced:s(en),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:s(en,u),codeText:s(gn,u),codeTextData:Q,data:Q,codeFlowValue:Q,definition:s(yn),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:s(vn),hardBreakEscape:s(jn),hardBreakTrailing:s(jn),htmlFlow:s(sn,u),htmlFlowData:Q,htmlText:s(sn,u),htmlTextData:Q,image:s(Rt),label:u,link:s(Vt),listItem:s(Rr),listItemValue:g,listOrdered:s(Sr,h),listUnordered:s(Sr),paragraph:s(Bt),reference:It,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:s(xn),strong:s(Hr),thematicBreak:s(At)},exit:{atxHeading:c(),atxHeadingSequence:P,autolink:c(),autolinkEmail:Tt,autolinkProtocol:Wt,blockQuote:c(),characterEscapeValue:oe,characterReferenceMarkerHexadecimal:jt,characterReferenceMarkerNumeric:jt,characterReferenceValue:vt,codeFenced:c(I),codeFencedFence:D,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:oe,codeIndented:c(C),codeText:c(pe),codeTextData:oe,data:oe,definition:c(),definitionDestinationString:A,definitionLabelString:x,definitionTitleString:O,emphasis:c(),hardBreakEscape:c(re),hardBreakTrailing:c(re),htmlFlow:c(ne),htmlFlowData:oe,htmlText:c(be),htmlTextData:oe,image:c(Ce),label:Je,labelText:U,lineEnding:te,link:c(De),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Mt,resourceDestinationString:it,resourceTitleString:N,resource:Ze,setextHeading:c(J),setextHeadingLineSequence:G,setextHeadingText:B,strong:c(),thematicBreak:c()}};D_(t,(e||{}).mdastExtensions||[]);let r={};return n;function n(Z){let me={type:"root",children:[]},Ie={stack:[me],tokenStack:[],config:t,enter:l,exit:d,buffer:u,resume:m,setData:a,getData:o},at=[],Dt=-1;for(;++Dt0){let Cn=Ie.tokenStack[Ie.tokenStack.length-1];(Cn[1]||w_).call(Ie,void 0,Cn[0])}for(me.position={start:Ra(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Ra(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Dt=-1;++Dt?@^`{|}~[\]\\\s\n\r]/.test(String.fromCharCode(g))?s?(i.exit(`${e}Target`),i.exit(`${e}Data`),i.exit(e),a(g)):o(g):(s=!0,i.consume(g),h)}}return{text:{35:{tokenize:r}}}}function F_(){let e="hashtag";function t(i){this.enter({type:e,value:null},i)}function r(i){let a=this.sliceSerialize(i),o=Is(this.stack);o.value=a}function n(i){this.exit(i)}return{enter:{[e]:t},exit:{[`${e}Target`]:r,[e]:n}}}var Ls={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533};var xy={data:"data",whitespace:"whitespace",lineEnding:"lineEnding",lineEndingBlank:"lineEndingBlank",linePrefix:"linePrefix",lineSuffix:"lineSuffix",atxHeading:"atxHeading",atxHeadingSequence:"atxHeadingSequence",atxHeadingText:"atxHeadingText",autolink:"autolink",autolinkEmail:"autolinkEmail",autolinkMarker:"autolinkMarker",autolinkProtocol:"autolinkProtocol",characterEscape:"characterEscape",characterEscapeValue:"characterEscapeValue",characterReference:"characterReference",characterReferenceMarker:"characterReferenceMarker",characterReferenceMarkerNumeric:"characterReferenceMarkerNumeric",characterReferenceMarkerHexadecimal:"characterReferenceMarkerHexadecimal",characterReferenceValue:"characterReferenceValue",codeFenced:"codeFenced",codeFencedFence:"codeFencedFence",codeFencedFenceSequence:"codeFencedFenceSequence",codeFencedFenceInfo:"codeFencedFenceInfo",codeFencedFenceMeta:"codeFencedFenceMeta",codeFlowValue:"codeFlowValue",codeIndented:"codeIndented",codeText:"codeText",codeTextData:"codeTextData",codeTextPadding:"codeTextPadding",codeTextSequence:"codeTextSequence",content:"content",definition:"definition",definitionDestination:"definitionDestination",definitionDestinationLiteral:"definitionDestinationLiteral",definitionDestinationLiteralMarker:"definitionDestinationLiteralMarker",definitionDestinationRaw:"definitionDestinationRaw",definitionDestinationString:"definitionDestinationString",definitionLabel:"definitionLabel",definitionLabelMarker:"definitionLabelMarker",definitionLabelString:"definitionLabelString",definitionMarker:"definitionMarker",definitionTitle:"definitionTitle",definitionTitleMarker:"definitionTitleMarker",definitionTitleString:"definitionTitleString",emphasis:"emphasis",emphasisSequence:"emphasisSequence",emphasisText:"emphasisText",escapeMarker:"escapeMarker",hardBreakEscape:"hardBreakEscape",hardBreakTrailing:"hardBreakTrailing",htmlFlow:"htmlFlow",htmlFlowData:"htmlFlowData",htmlText:"htmlText",htmlTextData:"htmlTextData",image:"image",label:"label",labelText:"labelText",labelLink:"labelLink",labelImage:"labelImage",labelMarker:"labelMarker",labelImageMarker:"labelImageMarker",labelEnd:"labelEnd",link:"link",paragraph:"paragraph",reference:"reference",referenceMarker:"referenceMarker",referenceString:"referenceString",resource:"resource",resourceDestination:"resourceDestination",resourceDestinationLiteral:"resourceDestinationLiteral",resourceDestinationLiteralMarker:"resourceDestinationLiteralMarker",resourceDestinationRaw:"resourceDestinationRaw",resourceDestinationString:"resourceDestinationString",resourceMarker:"resourceMarker",resourceTitle:"resourceTitle",resourceTitleMarker:"resourceTitleMarker",resourceTitleString:"resourceTitleString",setextHeading:"setextHeading",setextHeadingText:"setextHeadingText",setextHeadingLine:"setextHeadingLine",setextHeadingLineSequence:"setextHeadingLineSequence",strong:"strong",strongSequence:"strongSequence",strongText:"strongText",thematicBreak:"thematicBreak",thematicBreakSequence:"thematicBreakSequence",blockQuote:"blockQuote",blockQuotePrefix:"blockQuotePrefix",blockQuoteMarker:"blockQuoteMarker",blockQuotePrefixWhitespace:"blockQuotePrefixWhitespace",listOrdered:"listOrdered",listUnordered:"listUnordered",listItemIndent:"listItemIndent",listItemMarker:"listItemMarker",listItemPrefix:"listItemPrefix",listItemPrefixWhitespace:"listItemPrefixWhitespace",listItemValue:"listItemValue",chunkDocument:"chunkDocument",chunkContent:"chunkContent",chunkFlow:"chunkFlow",chunkText:"chunkText",chunkString:"chunkString"};var _B={tokenize:MB},A_={text:{[Ls.leftSquareBracket]:_B}};function MB(e,t,r){let n=this;return i;function i(s){return n.previous!==Ls.eof||!n._gfmTasklistFirstContentOfListItem?r(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),a)}function a(s){return Be(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),o):s!==Ls.rightSquareBracket?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),o):r(s)}function o(s){return s===Ls.rightSquareBracket?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),e.check({tokenize:TB},t,r)):r(s)}}function TB(e,t,r){let n=this;return je(e,i,xy.whitespace);function i(a){let o=n.events[n.events.length-1];return o&&o[1].type===xy.whitespace&&a!==Ls.eof&&!Kt(a)?t(a):r(a)}}var O_={exit:{taskListCheckValueChecked:I_,taskListCheckValueUnchecked:I_,paragraph:FB}};function I_(e){let t=this.stack[this.stack.length-2];t.checked=e.type==="taskListCheckValueChecked",t.checkChar=this.sliceSerialize(e)}function FB(e){let t=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1],n=t.children,i=r.children[0],a=-1,o;if(t&&t.type==="listItem"&&typeof t.checked=="boolean"&&i&&i.type==="text"){for(;++a=0;i--){if(!t&&/[`%\n\r]/.test(e[i])){e[i]==="`"&&(r++,r===3&&(t=!0,n=i-1));continue}else if(!t)return{};if(e[i]==="`"&&e[i-1]==="`"&&e[i-2]==="`"&&/[\r\n]/.test(e[i-3]))return JSON.parse(e.slice(i+1,n).trim())}}function P_(e){return[A_,As("date",`${e.getSetting("date-trigger")}{`,"}"),As("dateLink",`${e.getSetting("date-trigger")}[[`,"]]"),As("time",`${e.getSetting("time-trigger")}{`,"}"),As("embedWikilink","![[","]]"),As("wikilink","[[","]]"),T_(),C_()]}function N_(e){return[O_,Os("date",(t,r)=>{t&&(r.date=t)}),Os("dateLink",(t,r)=>{t&&(r.date=t)}),Os("time",(t,r)=>{t&&(r.time=t)}),Os("embedWikilink",(t,r)=>{if(!t)return;let n=Ym(t),i=e.app.metadataCache.getFirstLinkpathDest(n.root,e.file.path);r.fileAccessor={target:n.root,isEmbed:!0,stats:i==null?void 0:i.stat}}),Os("wikilink",(t,r)=>{if(!t)return;let n=Ym(t),i=e.app.metadataCache.getFirstLinkpathDest(n.root,e.file.path);if(r.fileAccessor={target:n.root,isEmbed:!1},i){let a=fg(e,i);r.fileMetadata=a.fileMetadata,r.fileMetadataOrder=a.fileMetadataOrder}}),M_((t,r)=>{if(!t.url||/:\/\//.test(t.url)||!/.md$/.test(t.url))return;let n=e.app.metadataCache.getFirstLinkpathDest(decodeURIComponent(t.url),e.file.path);if(r)t.type="embedLink",t.fileAccessor={target:decodeURIComponent(t.url),isEmbed:!0,stats:n.stat};else if(t.fileAccessor={target:decodeURIComponent(t.url),isEmbed:!1},n){let i=fg(e,n);t.fileMetadata=i.fileMetadata,t.fileMetadataOrder=i.fileMetadataOrder}}),F_(),__()]}function R_(e,t){let r=IB(t),i={...AB(t)},a={};return Object.keys(r).forEach(o=>{if(o===_t){let s=r[o]==="basic"?"board":r[o];i[o]=s,a[o]=s}else Yx.has(o)?i[o]=r[o]:a[o]=r[o]}),e.compileSettings(i),{settings:i,frontmatter:a,ast:ff(t,{extensions:[ky(["yaml"]),...P_(e)],mdastExtensions:[Sy(["yaml"]),...N_(e)]})}}function Cy(e,t){return ff(t,{extensions:P_(e),mdastExtensions:N_(e)})}function gf(e,t,r){var v;let n=e.getSetting("move-tags"),i=e.getSetting("move-dates"),a=r.children.first(),o=r.children.last(),s=a.type==="paragraph"?ef(a).start:a.position.start.offset,u=o.type==="paragraph"?ef(o).end:o.position.end.offset,l={start:s,end:u},c=oy(t,l);c==="["+(r.checked?r.checkChar:" ")+"]"&&(c="");let d=c,m="";Xd(r,["text","wikilink","embedWikilink","image","inlineCode","code","hashtag"],(D,I,C)=>{var x,O;D.type==="hashtag"?(O=(x=C.children.first())==null?void 0:x.value)!=null&&O.startsWith("```")||(m+=" #"+D.value):m+=D.value||D.alt||""});let h={titleRaw:qk(Eg(Dg(c))),blockId:void 0,title:"",titleSearch:m,titleSearchRaw:m,metadata:{dateStr:void 0,date:void 0,time:void 0,timeStr:void 0,tags:[],fileAccessor:void 0,file:void 0,fileMetadata:void 0,fileMetadataOrder:void 0},checked:r.checked,checkChar:r.checked&&r.checkChar||" "};Xd(r,D=>D.type!=="paragraph",(D,I,C)=>{var O,A;let x=D;if(x.type==="blockid")return h.blockId=x.value,!0;if(x.type==="hashtag"&&!((A=(O=C.children.first())==null?void 0:O.value)!=null&&A.startsWith("```")))return h.metadata.tags||(h.metadata.tags=[]),h.metadata.tags.push("#"+x.value),n&&(d=xd(d,{start:D.position.start.offset-l.start,end:D.position.end.offset-l.start})),!0;if(x.type==="date"||x.type==="dateLink")return h.metadata.dateStr=x.date,i&&(d=xd(d,{start:D.position.start.offset-l.start,end:D.position.end.offset-l.start})),!0;if(x.type==="time")return h.metadata.timeStr=x.time,i&&(d=xd(d,{start:D.position.start.offset-l.start,end:D.position.end.offset-l.start})),!0;if(x.type==="embedWikilink")return h.metadata.fileAccessor=x.fileAccessor,!0;if(x.type==="wikilink"||x.type==="link"&&x.fileAccessor)return h.metadata.fileAccessor=x.fileAccessor,h.metadata.fileMetadata=x.fileMetadata,h.metadata.fileMetadataOrder=x.fileMetadataOrder,!0;if(x.type==="embedLink")return h.metadata.fileAccessor=x.fileAccessor,!0}),h.title=$C(e,Eg(Kk(d)));let g=h.title.indexOf(`
+`),y=gb(h.title,!0);if(y!=null&&y.length){let D=h.metadata.inlineMetadata=y.reduce((x,O)=>(yi.has(O.key)?(g<=0||O.end{if(s.type==="heading"){let l=OB(s,n.children,u),c=ef(s),d=oy(i,c),m=!1,h=BC(n.children,u,"list",g=>{if(g.type==="heading")return!1;if(g.type==="paragraph"){let y=_s(g);if(y.startsWith("%% kanban:settings"))return!1;if(y===R("Complete"))return m=!0,!0}return!0});if(l&&h){o.push(...h.children.map(g=>({...Pc,id:et(),data:gf(e,i,g)})));return}h?a.push({...Ea,children:h.children.map(g=>{let y=gf(e,i,g);return{...Pc,id:et(),data:y}}),id:et(),data:{...co(d),shouldMarkItemsComplete:m}}):a.push({...Ea,children:[],id:et(),data:{...co(d),shouldMarkItemsComplete:m}})}}),{...Nc,id:e.file.path,children:a,data:{settings:t,frontmatter:r,archive:o,isSearching:!1,errors:[]}}}function _y(e,t,r){let n=`- [${t.data.checkChar}] ${Sg(Cd(r),t)}`,i=Cy(e,n),a=gf(e,n,i.children[0].children[0]),o=(0,pf.default)(t,{data:{$set:a}});try{ql(e,o)}catch(s){console.error(s)}return o}function V_(e,t,r,n){let i=`- [${r}] ${Cd(t)}`,a=Cy(e,i),o=gf(e,i,a.children[0].children[0]);o.forceEditMode=!!n;let s={...Pc,id:et(),data:o};try{ql(e,s)}catch(u){console.error(u)}return s}function $_(e,t){try{return(0,pf.default)(t,{children:{$set:t.children.map(r=>(0,pf.default)(r,{children:{$set:r.children.map(n=>_y(e,n,n.data.titleRaw))}}))}})}catch(r){throw e.setError(r),r}}function U_(e){return`- [${e.data.checkChar}] ${Sg(Cd(e.data.titleRaw),e)}`}function LB(e){let t=[];return t.push(`## ${jk(cd(e.data.title,e.data.maxItems))}`),t.push(""),e.data.shouldMarkItemsComplete&&t.push(gk),e.children.forEach(r=>{t.push(U_(r))}),t.push(""),t.push(""),t.push(""),t.join(`
+`)}function PB(e){if(e.length){let t=[yk,"",`## ${R("Archive")}`,""];return e.forEach(r=>{t.push(U_(r))}),t.join(`
+`)}return""}function W_(e){let t=e.children.reduce((n,i)=>n+LB(i),"");return["---","",(0,H_.stringifyYaml)(e.data.frontmatter),"---","",""].join(`
+`)+t+PB(e.data.archive)+vk(e)}var NB=["id","date","time","titleSearch","titleSearchRaw","file"],yf=class{constructor(t){this.stateManager=t}newItem(t,r,n){return V_(this.stateManager,t,r,n)}updateItemContent(t,r){return _y(this.stateManager,t,r)}boardToMd(t){return W_(t)}mdToBoard(t){let{ast:r,settings:n,frontmatter:i}=R_(this.stateManager,t),a=B_(this.stateManager,n,i,r,t),{state:o}=this.stateManager,s=(0,z_.getAPI)();if(!this.stateManager.hasError()&&o){let u=OC(o,a,c=>NB.includes(c.last()),c=>c?c instanceof Y_.TFile?c.path:Ni(c)||Array.isArray(c)?String(c):s&&!s.value.isObject(c)?s.value.toString(c):String(c):String(c)),l=PC(o,u);return WC(this.stateManager,l,u)}return UC(this.stateManager,a)}reparseBoard(){return $_(this.stateManager,this.stateManager.state)}};var vf=class{constructor(t,r,n,i,a){this.stateReceivers=[];this.settingsNotifiers=new Map;this.viewSet=new Set;this.compiledSettings={};this.getSetting=(t,r)=>{var n;return(r==null?void 0:r[t])!==void 0?r[t]:((n=this.compiledSettings)==null?void 0:n[t])!==void 0?this.compiledSettings[t]:this.getSettingRaw(t)};this.getSettingRaw=(t,r)=>{var n,i,a;return(r==null?void 0:r[t])!==void 0?r[t]:((a=(i=(n=this.state)==null?void 0:n.data)==null?void 0:i.settings)==null?void 0:a[t])!==void 0?this.state.data.settings[t]:this.getGlobalSetting(t)};this.getGlobalSetting=t=>{let r=this.getGlobalSettings();return(r==null?void 0:r[t])!==void 0?r[t]:null};this.app=t,this.file=r.file,this.onEmpty=i,this.getGlobalSettings=a,this.parser=new yf(this),this.registerView(r,n,!0)}getAView(){return this.viewSet.values().next().value}hasError(){var t,r,n;return!!((n=(r=(t=this.state)==null?void 0:t.data)==null?void 0:r.errors)!=null&&n.length)}async registerView(t,r,n){this.viewSet.has(t)||this.viewSet.add(t),await new Promise(i=>activeWindow.setTimeout(i,10)),n?await this.newBoard(t,r):await t.prerender(this.state),t.populateViewState(this.state.data.settings)}unregisterView(t){this.viewSet.has(t)&&(this.viewSet.delete(t),this.viewSet.size===0&&this.onEmpty())}buildSettingRetrievers(){return{getGlobalSettings:this.getGlobalSettings,getGlobalSetting:this.getGlobalSetting,getSetting:this.getSetting}}async newBoard(t,r){try{let n=this.getParsedBoard(r);await t.prerender(n),this.setState(n,!1)}catch(n){this.setError(n)}}saveToDisk(){if(this.state.data.errors.length>0)return;let t=this.getAView();if(t){let r=this.parser.boardToMd(this.state);t.requestSaveToDisk(r),this.viewSet.forEach(n=>{n.data=r})}}softRefresh(){this.stateReceivers.forEach(t=>t({...this.state}))}forceRefresh(){if(this.state)try{this.compileSettings(),this.state=this.parser.reparseBoard(),this.stateReceivers.forEach(t=>t(this.state)),this.settingsNotifiers.forEach(t=>{t.forEach(r=>r())}),this.viewSet.forEach(t=>t.initHeaderButtons())}catch(t){console.error(t),this.setError(t)}}setState(t,r=!0){var n;try{let i=(n=this.state)==null?void 0:n.data.settings,a=typeof t=="function"?t(this.state):t,o=a==null?void 0:a.data.settings;i&&o&&bk(i,o)?(this.state=(0,Ps.default)(this.state,{data:{settings:{$set:o}}}),this.compileSettings(),this.state=this.parser.reparseBoard()):(this.state=a,this.compileSettings()),this.viewSet.forEach(s=>{s.initHeaderButtons(),s.validatePreviewCache(a)}),r&&this.saveToDisk(),this.stateReceivers.forEach(s=>s(this.state)),i!==o&&o&&this.settingsNotifiers.forEach((s,u)=>{(!i&&o||i[u]!==o[u])&&s.forEach(l=>l())})}catch(i){console.error(i),this.setError(i)}}useState(){let[t,r]=Ne(this.state);return Ae(()=>(this.stateReceivers.push(n=>r(n)),r(this.state),()=>{this.stateReceivers.remove(r)}),[]),t}useSetting(t){let[r,n]=Ne(this.getSetting(t));return Ae(()=>{let i=()=>n(this.getSetting(t));return this.settingsNotifiers.has(t)?this.settingsNotifiers.get(t).push(i):this.settingsNotifiers.set(t,[i]),()=>{this.settingsNotifiers.get(t).remove(i)}},[]),r}compileSettings(t){var l,c,d,m,h,g,y,v,D,I;let r=this.getGlobalSetting("metadata-keys")||[],n=this.getSettingRaw("metadata-keys",t)||[],i=Array.from(new Set([...r,...n])),a=this.getSettingRaw("date-format",t)||ja(this.app),o=this.getSettingRaw("date-display-format",t)||a,s=this.getSettingRaw("time-format",t)||Ho(this.app),u=this.getSettingRaw("archive-date-format",t)||`${a} ${s}`;this.compiledSettings={[_t]:this.getSettingRaw(_t,t)||"board","date-format":a,"date-display-format":o,"date-time-display-format":o+" "+s,"date-trigger":this.getSettingRaw("date-trigger",t)||Ad,"inline-metadata-position":this.getSettingRaw("inline-metadata-position",t)||Ul,"time-format":s,"time-trigger":this.getSettingRaw("time-trigger",t)||Od,"link-date-to-daily-note":this.getSettingRaw("link-date-to-daily-note",t),"move-dates":this.getSettingRaw("move-dates",t),"move-tags":this.getSettingRaw("move-tags",t),"move-task-metadata":this.getSettingRaw("move-task-metadata",t),"metadata-keys":i,"archive-date-separator":this.getSettingRaw("archive-date-separator")||"","archive-date-format":u,"show-add-list":(l=this.getSettingRaw("show-add-list",t))!=null?l:!0,"show-archive-all":(c=this.getSettingRaw("show-archive-all",t))!=null?c:!0,"show-view-as-markdown":(d=this.getSettingRaw("show-view-as-markdown",t))!=null?d:!0,"show-board-settings":(m=this.getSettingRaw("show-board-settings",t))!=null?m:!0,"show-search":(h=this.getSettingRaw("show-search",t))!=null?h:!0,"show-set-view":(g=this.getSettingRaw("show-set-view",t))!=null?g:!0,"tag-colors":(y=this.getSettingRaw("tag-colors",t))!=null?y:[],"tag-sort":(v=this.getSettingRaw("tag-sort",t))!=null?v:[],"date-colors":(D=this.getSettingRaw("date-colors",t))!=null?D:[],"tag-action":(I=this.getSettingRaw("tag-action",t))!=null?I:"obsidian"}}getParsedBoard(t){let r=t.trim(),n={...Nc,id:this.file.path,children:[],data:{archive:[],settings:{[_t]:"board"},frontmatter:{},isSearching:!1,errors:[]}};try{r&&(n=this.parser.mdToBoard(r))}catch(i){console.error(i),n=(0,Ps.default)(n,{data:{errors:{$push:[{description:i.toString(),stack:i.stack}]}}})}return n}setError(t){this.setState((0,Ps.default)(this.state,{data:{errors:{$push:[{description:t.toString(),stack:t.stack}]}}}),!1)}onFileMetadataChange(){this.reparseBoardFromMd()}async reparseBoardFromMd(){try{this.setState(this.getParsedBoard(this.getAView().data),!1)}catch(t){console.error(t),this.setError(t)}}async archiveCompletedCards(){let t=this.state,r=[],n=!!this.getSetting("archive-with-date"),i=this.getSetting("archive-date-separator"),a=this.getSetting("archive-date-format"),o=this.getSetting("append-archive-date"),s=l=>{let c=[(0,K_.moment)().format(a)];i&&c.push(i),c.push(l.data.titleRaw),o&&c.reverse();let d=c.join(" ");return this.parser.updateItemContent(l,d)},u=t.children.map(l=>(0,Ps.default)(l,{children:{$set:l.children.filter(c=>{let d=c.data.checked&&c.data.checkChar===Zn();return(l.data.shouldMarkItemsComplete||d)&&r.push(c),!d&&!l.data.shouldMarkItemsComplete})}}));try{this.setState((0,Ps.default)(t,{children:{$set:u},data:{archive:{$push:n?await Promise.all(r.map(l=>s(l))):r}}}))}catch(l){this.setError(l)}}getNewItem(t,r,n){return this.parser.newItem(t,r,n)}updateItemContent(t,r){return this.parser.updateItemContent(t,r)}};function RB(e){let t=e.embedRegistry.embedByExtension.md({app:e,containerEl:createDiv(),state:{}},null,"");t.load(),t.editable=!0,t.showEditor();let r=Object.getPrototypeOf(Object.getPrototypeOf(t.editMode)).constructor;return t.unload(),r}var wf=class extends Rn.Plugin{constructor(){super(...arguments);this.settings={};this.kanbanFileModes={};this.stateManagers=new Map;this.windowRegistry=new Map;this._loaded=!1;this.isShiftPressed=!1;this.handleShift=r=>{this.isShiftPressed=r.shiftKey}}async loadSettings(){this.settings=Object.assign({},await this.loadData())}async saveSettings(){await this.saveData(this.settings)}unload(){super.unload(),Promise.all(this.app.workspace.getLeavesOfType(qr).map(r=>(this.kanbanFileModes[r.id]="markdown",this.setMarkdownView(r))))}onunload(){this.MarkdownEditor=null,this.windowRegistry.forEach((r,n)=>{r.viewStateReceivers.forEach(i=>i([])),this.unmount(n)}),this.unmount(window),this.stateManagers.clear(),this.windowRegistry.clear(),this.kanbanFileModes={},this.app.workspace.unregisterHoverLinkSource(_t)}async onload(){var r,n;await this.loadSettings(),this.MarkdownEditor=RB(this.app),this.registerEditorSuggest(new nd(this.app,this)),this.registerEditorSuggest(new td(this.app,this)),this.registerEvent(this.app.workspace.on("window-open",(i,a)=>{this.mount(a)})),this.registerEvent(this.app.workspace.on("window-close",(i,a)=>{this.unmount(a)})),this.settingsTab=new Ud(this,{onSettingsChange:async i=>{this.settings=i,await this.saveSettings(),this.stateManagers.forEach(a=>{a.forceRefresh()})}}),this.addSettingTab(this.settingsTab),this.registerView(qr,i=>new pn(i,this)),this.registerMonkeyPatches(),this.registerCommands(),this.registerEvents(),this.mount(window),(n=(r=this.app.workspace.floatingSplit)==null?void 0:r.children)==null||n.forEach(i=>{this.mount(i.win)}),this.registerDomEvent(window,"keydown",this.handleShift),this.registerDomEvent(window,"keyup",this.handleShift),this.addRibbonIcon(ho,R("Create new board"),()=>{this.newKanban()})}getKanbanViews(r){let n=this.windowRegistry.get(r);return n?Array.from(n.viewMap.values()):[]}getKanbanView(r,n){let i=this.windowRegistry.get(n);if(i!=null&&i.viewMap.has(r))return i.viewMap.get(r);for(let a of this.windowRegistry.values())if(a.viewMap.has(r))return a.viewMap.get(r);return null}getStateManager(r){return this.stateManagers.get(r)}getStateManagerFromViewID(r,n){let i=this.getKanbanView(r,n);return i?this.stateManagers.get(i.file):null}useKanbanViews(r){let[n,i]=Ne(this.getKanbanViews(r));return Ae(()=>{let a=this.windowRegistry.get(r);return a==null||a.viewStateReceivers.push(i),()=>{a==null||a.viewStateReceivers.remove(i)}},[r]),n}addView(r,n,i){let a=r.getWindow(),o=this.windowRegistry.get(a);if(!o)return;o.viewMap.has(r.id)||o.viewMap.set(r.id,r);let s=r.file;this.stateManagers.has(s)?this.stateManagers.get(s).registerView(r,n,i):this.stateManagers.set(s,new vf(this.app,r,n,()=>this.stateManagers.delete(s),()=>this.settings)),o.viewStateReceivers.forEach(u=>u(this.getKanbanViews(a)))}removeView(r){let n=Array.from(this.windowRegistry.entries()).find(([,s])=>s.viewMap.has(r.id),[]);if(!n)return;let[i,a]=n,o=r.file;a.viewMap.has(r.id)&&a.viewMap.delete(r.id),this.stateManagers.has(o)&&(this.stateManagers.get(o).unregisterView(r),a.viewStateReceivers.forEach(s=>s(this.getKanbanViews(i))))}handleViewFileRename(r,n){let i=r.getWindow();if(!this.windowRegistry.has(i))return;let a=this.windowRegistry.get(i),o=`${r.leaf.id}:::${n}`;a.viewMap.has(o)&&a.viewMap.delete(o),a.viewMap.has(r.id)||a.viewMap.set(r.id,r),r.isPrimary&&this.getStateManager(r.file).softRefresh()}mount(r){if(this.windowRegistry.has(r))return;let n=r.document.body.createDiv();this.windowRegistry.set(r,{viewMap:new Map,viewStateReceivers:[],appRoot:n}),Li(cx(r,this),n)}unmount(r){if(!this.windowRegistry.has(r))return;let n=this.windowRegistry.get(r);for(let i of n.viewMap.values())this.removeView(i);Pi(n.appRoot),n.appRoot.remove(),n.viewMap.clear(),n.viewStateReceivers.length=0,n.appRoot=null,this.windowRegistry.delete(r)}async setMarkdownView(r,n=!0){await r.setViewState({type:"markdown",state:r.view.getState(),popstate:!0},{focus:n})}async setKanbanView(r){await r.setViewState({type:qr,state:r.view.getState(),popstate:!0})}async newKanban(r){var i;let n=r||this.app.fileManager.getNewFileParent(((i=app.workspace.getActiveFile())==null?void 0:i.path)||"");try{let a=await app.fileManager.createNewMarkdownFile(n,R("Untitled Kanban"));await this.app.vault.modify(a,dg),await this.app.workspace.getLeaf().setViewState({type:qr,state:{file:a.path}})}catch(a){console.error("Error creating kanban board:",a)}}registerEvents(){this.registerEvent(this.app.workspace.on("file-menu",(n,i,a,o)=>{if(a==="link-context-menu")return;let s=i instanceof Rn.TFile,u=i instanceof Rn.TFolder,l=(o==null?void 0:o.view)instanceof Rn.MarkdownView,c=(o==null?void 0:o.view)instanceof pn;if(u){n.addItem(d=>{d.setSection("action-primary").setTitle(R("New kanban board")).setIcon(ho).onClick(()=>this.newKanban(i))});return}if(!Rn.Platform.isMobile&&s&&o&&a==="sidebar-context-menu"&&hg(i)){let d=this.getKanbanViews(Dn(o.view.containerEl)),m=!1;for(let h of d)if(h.file===i){h.onPaneMenu(n,"more-options",!1),m=!0;break}if(!m){n.addItem(h=>{h.setTitle(R("Open as kanban board")).setIcon(ho).setSection("pane").onClick(()=>{this.kanbanFileModes[o.id||i.path]=qr,this.setKanbanView(o)})});return}}if(l&&s&&["more-options","pane-more-options","tab-header"].includes(a)&&hg(i)&&n.addItem(d=>{d.setTitle(R("Open as kanban board")).setIcon(ho).setSection("pane").onClick(()=>{this.kanbanFileModes[o.id||i.path]=qr,this.setKanbanView(o)})}),s&&c&&(["pane-more-options","tab-header"].includes(a)&&n.addItem(d=>{d.setTitle(R("Open as markdown")).setIcon(ho).setSection("pane").onClick(()=>{this.kanbanFileModes[o.id||i.path]="markdown",this.setMarkdownView(o)})}),Rn.Platform.isMobile)){let d=this.stateManagers.get(i),m=o.view,h=m.viewSettings[_t]||d.getSetting(_t);n.addItem(g=>{g.setTitle(R("Add a list")).setIcon("lucide-plus-circle").setSection("pane").onClick(()=>{m.emitter.emit("showLaneForm",void 0)})}).addItem(g=>{g.setTitle(R("Archive completed cards")).setIcon("lucide-archive").setSection("pane").onClick(()=>{d.archiveCompletedCards()})}).addItem(g=>{g.setTitle(R("Archive completed cards")).setIcon("lucide-archive").setSection("pane").onClick(()=>{this.stateManagers.get(i).archiveCompletedCards()})}).addItem(g=>g.setTitle(R("View as board")).setSection("pane").setIcon("lucide-trello").setChecked(h==="basic"||h==="board").onClick(()=>m.setView("board"))).addItem(g=>g.setTitle(R("View as table")).setSection("pane").setIcon("lucide-table").setChecked(h==="table").onClick(()=>m.setView("table"))).addItem(g=>g.setTitle(R("View as list")).setSection("pane").setIcon("lucide-server").setChecked(h==="list").onClick(()=>m.setView("list"))).addItem(g=>g.setTitle(R("Open board settings")).setSection("pane").setIcon("lucide-settings").onClick(()=>m.getBoardSettings()))}})),this.registerEvent(app.vault.on("rename",(n,i)=>{app.workspace.getLeavesOfType(qr).forEach(o=>{o.view.handleRename(n.path,i)})}));let r=(0,Rn.debounce)(n=>{this.stateManagers.forEach(i=>{i.file!==n&&i.onFileMetadataChange()})},2e3,!0);this.registerEvent(app.vault.on("modify",n=>{n instanceof Rn.TFile&&r(n)})),this.registerEvent(app.metadataCache.on("changed",n=>{r(n)})),this.registerEvent(app.metadataCache.on("dataview:metadata-change",(n,i)=>{r(i)})),this.registerEvent(app.metadataCache.on("dataview:api-ready",()=>{this.stateManagers.forEach(n=>{n.forceRefresh()})})),app.workspace.registerHoverLinkSource(_t,{display:"Kanban",defaultMod:!0})}registerCommands(){this.addCommand({id:"create-new-kanban-board",name:R("Create new board"),callback:()=>this.newKanban()}),this.addCommand({id:"archive-completed-cards",name:R("Archive completed cards in active board"),checkCallback:r=>{let n=app.workspace.getActiveViewOfType(pn);if(!n)return!1;if(r)return!0;this.stateManagers.get(n.file).archiveCompletedCards()}}),this.addCommand({id:"toggle-kanban-view",name:R("Toggle between Kanban and markdown mode"),checkCallback:r=>{let n=app.workspace.getActiveFile();if(!n)return!1;let i=app.metadataCache.getFileCache(n),a=!!(i!=null&&i.frontmatter)&&!!i.frontmatter[_t];if(r)return a;let o=app.workspace.getActiveViewOfType(pn);if(o)this.kanbanFileModes[o.leaf.id||n.path]="markdown",this.setMarkdownView(o.leaf);else if(a){let s=app.workspace.getActiveViewOfType(Rn.MarkdownView);s&&(this.kanbanFileModes[s.leaf.id||n.path]=qr,this.setKanbanView(s.leaf))}}}),this.addCommand({id:"convert-to-kanban",name:R("Convert empty note to Kanban"),checkCallback:r=>{let n=app.workspace.getActiveViewOfType(Rn.MarkdownView);if(!n)return!1;let i=n.file.stat.size===0;if(r)return i;i&&app.vault.modify(n.file,dg).then(()=>{this.setKanbanView(n.leaf)}).catch(a=>console.error(a))}}),this.addCommand({id:"add-kanban-lane",name:R("Add a list"),checkCallback:r=>{let n=app.workspace.getActiveViewOfType(pn);if(r)return n&&n instanceof pn;n&&n instanceof pn&&n.emitter.emit("showLaneForm",void 0)}}),this.addCommand({id:"view-board",name:R("View as board"),checkCallback:r=>{let n=app.workspace.getActiveViewOfType(pn);if(r)return n&&n instanceof pn;n&&n instanceof pn&&n.setView("board")}}),this.addCommand({id:"view-table",name:R("View as table"),checkCallback:r=>{let n=app.workspace.getActiveViewOfType(pn);if(r)return n&&n instanceof pn;n&&n instanceof pn&&n.setView("table")}}),this.addCommand({id:"view-list",name:R("View as list"),checkCallback:r=>{let n=app.workspace.getActiveViewOfType(pn);if(r)return n&&n instanceof pn;n&&n instanceof pn&&n.setView("list")}}),this.addCommand({id:"open-board-settings",name:R("Open board settings"),checkCallback:r=>{let n=app.workspace.getActiveViewOfType(pn);if(!n)return!1;if(r)return!0;n.getBoardSettings()}})}registerMonkeyPatches(){let r=this;this.app.workspace.onLayoutReady(()=>{this.register(fu(app.commands,{executeCommand(n){return function(i){let a=app.workspace.getActiveViewOfType(pn);return a&&(i!=null&&i.id)&&a.emitter.emit("hotkey",{commandId:i.id}),n.call(this,i)}}}))}),this.register(fu(this.app.workspace,{setActiveLeaf(n){return function(...i){n.apply(this,i);let a=this.getActiveViewOfType(pn);a!=null&&a.activeEditor&&(this.activeEditor=a.activeEditor)}}})),this.register(fu(Rn.WorkspaceLeaf.prototype,{detach(n){return function(){var a;let i=(a=this.view)==null?void 0:a.getState();return i!=null&&i.file&&r.kanbanFileModes[this.id||i.file]&&delete r.kanbanFileModes[this.id||i.file],n.apply(this)}},setViewState(n){return function(i,...a){var o;if(r._loaded&&i.type==="markdown"&&((o=i.state)!=null&&o.file)&&r.kanbanFileModes[this.id||i.state.file]!=="markdown"){let s=r.app.metadataCache.getCache(i.state.file);if(s!=null&&s.frontmatter&&s.frontmatter[_t]){let u={...i,type:qr};return r.kanbanFileModes[i.state.file]=qr,n.apply(this,[u,...a])}}return n.apply(this,[i,...a])}}}))}};
+/*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ */
+/*! Bundled license information:
+
+mark.js/dist/mark.js:
+ (*!***************************************************
+ * mark.js v8.11.1
+ * https://markjs.io/
+ * Copyright (c) 2014–2018, Julian Kühnel
+ * Released under the MIT license https://git.io/vwTVl
+ *****************************************************)
+
+moment/moment.js:
+ (*! moment.js *)
+ (*! version : 2.29.4 *)
+ (*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
+ (*! license : MIT *)
+ (*! momentjs.com *)
+
+choices.js/public/assets/scripts/choices.js:
+ (*! choices.js v9.0.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme *)
+ (*!
+ * Fuse.js v3.4.5 - Lightweight fuzzy-search (http://fusejs.io)
+ *
+ * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
+ * All Rights Reserved. Apache Software License 2.0
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *)
+
+is-plain-object/dist/is-plain-object.mjs:
+ (*!
+ * is-plain-object
+ *
+ * Copyright (c) 2014-2017, Jon Schlinkert.
+ * Released under the MIT License.
+ *)
+
+@tanstack/table-core/build/lib/index.mjs:
+ (**
+ * table-core
+ *
+ * Copyright (c) TanStack
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ *)
+
+@tanstack/react-table/build/lib/index.mjs:
+ (**
+ * react-table
+ *
+ * Copyright (c) TanStack
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ *)
+
+@tanstack/match-sorter-utils/build/lib/index.mjs:
+ (**
+ * match-sorter-utils
+ *
+ * Copyright (c) TanStack
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ *)
+ (**
+ * @name match-sorter
+ * @license MIT license.
+ * @copyright (c) 2099 Kent C. Dodds
+ * @author Kent C. Dodds (https://kentcdodds.com)
+ *)
+*/
diff --git a/docs/.obsidian/plugins/obsidian-kanban/manifest.json b/docs/.obsidian/plugins/obsidian-kanban/manifest.json
new file mode 100644
index 0000000..68e9654
--- /dev/null
+++ b/docs/.obsidian/plugins/obsidian-kanban/manifest.json
@@ -0,0 +1,11 @@
+{
+ "id": "obsidian-kanban",
+ "name": "Kanban",
+ "version": "2.0.51",
+ "minAppVersion": "1.0.0",
+ "description": "Create markdown-backed Kanban boards in Obsidian.",
+ "author": "mgmeyers",
+ "authorUrl": "https://github.com/mgmeyers/obsidian-kanban",
+ "helpUrl": "https://publish.obsidian.md/kanban/Obsidian+Kanban+Plugin",
+ "isDesktopOnly": false
+}
diff --git a/docs/.obsidian/plugins/obsidian-kanban/styles.css b/docs/.obsidian/plugins/obsidian-kanban/styles.css
new file mode 100644
index 0000000..8a1eaf4
--- /dev/null
+++ b/docs/.obsidian/plugins/obsidian-kanban/styles.css
@@ -0,0 +1 @@
+.choices{position:relative;margin-bottom:24px;font-size:16px}.choices:focus{outline:none}.choices:last-child{margin-bottom:0}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;-ms-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices [hidden]{display:none!important}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:7.5px}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:10px;border-bottom:1px solid #dddddd;background-color:#fff;margin:0}.choices[data-type*=select-one] .choices__button{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.5}.choices[data-type*=select-one] .choices__button:hover,.choices[data-type*=select-one] .choices__button:focus{opacity:1}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px #00bcd4}.choices[data-type*=select-one] .choices__item[data-value=""] .choices__button{display:none}.choices[data-type*=select-one]:after{content:"";height:0;width:0;border-style:solid;border-color:#333333 transparent transparent transparent;border-width:5px;position:absolute;right:11.5px;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-one].is-open:after{border-color:transparent transparent #333333 transparent;margin-top:-7.5px}.choices[data-type*=select-one][dir=rtl]:after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices[data-type*=select-multiple] .choices__button,.choices[data-type*=text] .choices__button{position:relative;display:inline-block;margin:0 -4px 0 8px;padding-left:16px;border-left:1px solid #008fa1;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);background-size:8px;width:8px;line-height:1;opacity:.75;border-radius:0}.choices[data-type*=select-multiple] .choices__button:hover,.choices[data-type*=select-multiple] .choices__button:focus,.choices[data-type*=text] .choices__button:hover,.choices[data-type*=text] .choices__button:focus{opacity:1}.choices__inner{display:inline-block;vertical-align:top;width:100%;background-color:#f9f9f9;padding:7.5px 7.5px 3.75px;border:1px solid #dddddd;border-radius:2.5px;font-size:14px;min-height:44px;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:2.5px 2.5px 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 2.5px 2.5px}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:4px 16px 4px 4px;width:100%}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single .choices__item{width:100%}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:20px;padding:4px 10px;font-size:12px;font-weight:500;margin-right:3.75px;margin-bottom:3.75px;background-color:#00bcd4;border:1px solid #00a5bb;color:#fff;word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:3.75px}.choices__list--multiple .choices__item.is-highlighted{background-color:#00a5bb;border:1px solid #008fa1}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown{visibility:hidden;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #dddddd;top:100%;margin-top:-1px;border-bottom-left-radius:2.5px;border-bottom-right-radius:2.5px;overflow:hidden;word-break:break-all;will-change:visibility}.choices__list--dropdown.is-active{visibility:visible}.is-open .choices__list--dropdown{border-color:#b7b7b7}.is-flipped .choices__list--dropdown{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item{position:relative;padding:10px;font-size:14px}[dir=rtl] .choices__list--dropdown .choices__item{text-align:right}@media (min-width: 640px){.choices__list--dropdown .choices__item--selectable{padding-right:100px}.choices__list--dropdown .choices__item--selectable:after{content:attr(data-select-text);font-size:12px;opacity:0;position:absolute;right:10px;top:50%;transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable:after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-highlighted{background-color:#f2f2f2}.choices__list--dropdown .choices__item--selectable.is-highlighted:after{opacity:.5}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;-ms-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid #f7f7f7;color:gray}.choices__button{text-indent:-9999px;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus{outline:none}.choices__input{display:inline-block;vertical-align:baseline;background-color:#f9f9f9;font-size:14px;margin-bottom:5px;border:0;border-radius:0;max-width:100%;padding:4px 0 4px 2px}.choices__input:focus{outline:0}[dir=rtl] .choices__input{padding-right:2px;padding-left:0}.choices__placeholder{opacity:.5}.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,.08);box-shadow:1px 0 #e6e6e6,-1px 0 #e6e6e6,0 1px #e6e6e6,0 -1px #e6e6e6,0 3px 13px #00000014}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown .3s cubic-bezier(.23,1,.32,1);animation:fpFadeInDown .3s cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px)}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none!important;box-shadow:none!important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 #e6e6e6,5px 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:"";height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-months .flatpickr-month{background:transparent;color:#000000e6;fill:#000000e6;height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:#000000e6;fill:#000000e6}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{left:0}.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{right:0}.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper input::-webkit-outer-spin-button,.numInputWrapper input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,.15);-webkit-box-sizing:border-box;box-sizing:border-box}.numInputWrapper span:hover{background:#0000001a}.numInputWrapper span:active{background:#0003}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,.6);top:26%}.numInputWrapper span.arrowDown{top:50%}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto}.numInputWrapper span svg path{fill:#00000080}.numInputWrapper:hover{background:#0000000d}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:7.48px 0 0;line-height:1;height:34px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0}.flatpickr-current-month span.cur-month:hover{background:#0000000d}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\fffd;display:inline-block}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:#000000e6}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:#000000e6}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:#00000080;background:transparent;pointer-events:none}.flatpickr-current-month .flatpickr-monthDropdown-months{appearance:menulist;background:transparent;border:none;border-radius:0;box-sizing:border-box;color:inherit;cursor:pointer;font-size:inherit;font-family:inherit;font-weight:300;height:auto;line-height:inherit;margin:-1px 0 0;outline:none;padding:0 0 0 .5ch;position:relative;vertical-align:initial;-webkit-box-sizing:border-box;-webkit-appearance:menulist;-moz-appearance:menulist;width:auto}.flatpickr-current-month .flatpickr-monthDropdown-months:focus,.flatpickr-current-month .flatpickr-monthDropdown-months:active{outline:none}.flatpickr-current-month .flatpickr-monthDropdown-months:hover{background:#0000000d}.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month{background-color:transparent;outline:none;padding:0}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:#0000008a;line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translateZ(0);opacity:1}.dayContainer+.dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange+.endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 #e6e6e6,5px 0 #e6e6e6}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:#3939394d;background:transparent;border-color:transparent;cursor:default}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover{cursor:not-allowed;color:#3939391a}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 #569ff7,5px 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{float:left}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:#3939394d;background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-time input.flatpickr-hour{font-weight:700}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;float:left;line-height:inherit;color:#393939;font-weight:700;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400}.flatpickr-time input:hover,.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time input:focus,.flatpickr-time .flatpickr-am-pm:focus{background:#eee}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes fpFadeInDown{0%{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.workspace-leaf-content[data-type=kanban] .view-content{padding:0}.workspace-leaf-content[data-type=kanban]>.view-header{display:flex!important}.kanban-plugin{--lane-width: 272px}.kanban-plugin{contain:content;height:100%;width:100%;position:relative;display:flex;flex-direction:column}.kanban-plugin a.tag,.kanban-plugin__drag-container a.tag{padding-inline:var(--tag-padding-x);padding-block:var(--tag-padding-y)}.kanban-plugin__table-wrapper{height:100%;width:100%;overflow:auto;padding-block-end:40px;--table-column-first-border-width: 0;--table-column-last-border-width: 0;--table-row-last-border-width: 0}.kanban-plugin__table-wrapper table{width:fit-content;margin-block:0;margin-inline:auto;box-shadow:0 0 0 var(--table-border-width) var(--table-border-color)}.kanban-plugin__table-wrapper tr{width:fit-content}.kanban-plugin__table-wrapper th,.kanban-plugin__table-wrapper td{text-align:start;vertical-align:top;font-size:.875rem;padding:0!important;height:1px}.kanban-plugin__table-wrapper th.mod-has-icon .kanban-plugin__table-cell-wrapper,.kanban-plugin__table-wrapper td.mod-has-icon .kanban-plugin__table-cell-wrapper{padding-inline-end:var(--size-2-2)}.kanban-plugin__table-wrapper th .kanban-plugin__table-cell-wrapper,.kanban-plugin__table-wrapper td .kanban-plugin__table-cell-wrapper{height:100%;padding-inline:var(--size-4-2);padding-block:var(--size-2-2)}.kanban-plugin__table-wrapper th .kanban-plugin__item-prefix-button-wrapper input[type=checkbox],.kanban-plugin__table-wrapper td .kanban-plugin__item-prefix-button-wrapper input[type=checkbox]{margin-block:2px}.kanban-plugin__table-wrapper th:has(.markdown-source-view),.kanban-plugin__table-wrapper td:has(.markdown-source-view){--background-primary: var(--background-primary-alt);background:var(--background-primary);outline:2px solid var(--background-modifier-border-focus)}.kanban-plugin__table-wrapper thead tr>th{height:1px;background-color:var(--background-primary);position:sticky;top:0;z-index:1;overflow:visible}.kanban-plugin__table-wrapper thead tr>th:nth-child(2n+2){background-color:var(--background-primary)}.kanban-plugin__table-wrapper thead tr>th .kanban-plugin__table-cell-wrapper{height:100%;padding-block:var(--size-2-2);padding-inline:var(--size-4-2) var(--size-2-2);box-shadow:0 0 0 var(--table-border-width) var(--table-border-color)}.kanban-plugin__table-wrapper .resizer{position:absolute;top:0;height:100%;width:5px;background:var(--table-selection-border-color);cursor:col-resize;user-select:none;touch-action:none}.kanban-plugin__table-wrapper .resizer.ltr{right:0}.kanban-plugin__table-wrapper .resizer.rtl{left:0}.kanban-plugin__table-wrapper .resizer.isResizing{opacity:1}@media (hover: hover){.kanban-plugin__table-wrapper .resizer{opacity:0}.kanban-plugin__table-wrapper .resizer:hover{opacity:1}}.kanban-plugin__table-wrapper .kanban-plugin__item-tags:not(:empty){margin-block-start:-5px}.kanban-plugin__table-wrapper .kanban-plugin__item-metadata-date-relative{display:block}.kanban-plugin__table-wrapper .kanban-plugin__item-input-wrapper,.kanban-plugin__table-wrapper .cm-table-widget,.kanban-plugin__table-wrapper .kanban-plugin__item-title,.kanban-plugin__table-wrapper .kanban-plugin__item-title-wrapper,.kanban-plugin__table-wrapper .kanban-plugin__item-content-wrapper{height:100%}.kanban-plugin__table-wrapper .kanban-plugin__item-title-wrapper{padding:0}.kanban-plugin .markdown-source-view.mod-cm6{display:block;font-size:.875rem}.kanban-plugin .markdown-source-view.mod-cm6 .cm-scroller{overflow:visible}.kanban-plugin__table-header{display:flex;gap:var(--size-4-2);align-items:center;justify-content:space-between}.kanban-plugin__table-header-sort{line-height:1;color:var(--text-faint);padding:2px;border-radius:4px}.kanban-plugin__table-header-sort>span{display:flex}div:hover>.kanban-plugin__table-header-sort{background-color:var(--background-modifier-hover)}.kanban-plugin__cell-flex-wrapper{display:flex;gap:8px;align-items:flex-start;justify-content:space-between}.kanban-plugin__cell-flex-wrapper .lucide-more-vertical{transform:none}.kanban-plugin__icon-wrapper{display:flex;line-height:1}.kanban-plugin__icon-wrapper>.kanban-plugin__icon{display:flex}.kanban-plugin.something-is-dragging{cursor:grabbing;cursor:-webkit-grabbing}.kanban-plugin.something-is-dragging *{pointer-events:none}.kanban-plugin__item button,.kanban-plugin__lane button,.kanban-plugin button{line-height:1;margin:0;transition:.1s color,.1s background-color}.kanban-plugin__search-wrapper{width:100%;position:sticky;top:0;left:0;padding-block:10px;padding-inline:13px;display:flex;justify-content:flex-end;align-items:center;z-index:2;background-color:var(--background-primary)}button.kanban-plugin__search-cancel-button{display:flex;line-height:1;padding:6px;border:1px solid var(--background-modifier-border);background:var(--background-secondary-alt);color:var(--text-muted);margin-block:0;margin-inline:5px 0;font-size:16px}button.kanban-plugin__search-cancel-button .kanban-plugin__icon{display:flex}.kanban-plugin__icon{display:inline-block;line-height:1;--icon-size: 1em}.kanban-plugin__board{display:flex;width:100%;height:100%}.kanban-plugin__board>div{display:flex;align-items:flex-start;justify-content:flex-start;padding:1rem;width:fit-content;height:100%}.kanban-plugin__board.kanban-plugin__vertical>div{height:fit-content;width:100%;flex-direction:column}.is-mobile .view-content:not(.is-mobile-editing) .kanban-plugin__board>div{padding-bottom:calc(1rem + var(--mobile-navbar-height))}.kanban-plugin__board.is-adding-lane>div{padding-inline-end:calc(250px + 1rem)}.kanban-plugin__lane-wrapper{display:flex;flex-shrink:0;margin-inline-end:10px;max-height:100%;width:var(--lane-width)}.kanban-plugin__vertical .kanban-plugin__lane-wrapper{margin-block-end:10px;margin-inline-end:0}.kanban-plugin__lane{width:100%;display:flex;flex-direction:column;background-color:var(--background-secondary);border-radius:6px;border:1px solid var(--background-modifier-border)}.is-dropping>.kanban-plugin__lane{background-color:hsla(var(--interactive-accent-hsl),.15);border-color:hsla(var(--interactive-accent-hsl),1);outline:1px solid hsla(var(--interactive-accent-hsl),1)}.kanban-plugin__placeholder.kanban-plugin__lane-placeholder{height:100%;flex-grow:1;margin-inline-end:5px}.kanban-plugin__lane.is-hidden{display:none}.kanban-plugin__lane button{padding-block:8px;padding-inline:10px}.kanban-plugin__lane-form-wrapper{position:absolute;top:1rem;right:1rem;width:250px;background-color:var(--background-secondary);border-radius:6px;border:2px solid hsla(var(--interactive-accent-hsl),.7);z-index:var(--layer-popover);box-shadow:0 .5px 1px .5px #0000001a,0 2px 10px #0000001a,0 10px 20px #0000001a}.kanban-plugin__lane-input{--font-text-size: var(--font-ui-small);padding-block:var(--size-4-1);padding-inline:var(--size-4-2);background-color:var(--background-primary);border-radius:var(--radius-s)}.kanban-plugin__lane-input-wrapper{padding:10px}.kanban-plugin__item-input-actions,.kanban-plugin__lane-input-actions{display:flex;align-items:flex-start;justify-content:flex-start;padding-block:0 10px;padding-inline:10px}.kanban-plugin__item-input-actions button,.kanban-plugin__lane-input-actions button{display:block;margin-inline-end:5px}button.kanban-plugin__item-action-add,button.kanban-plugin__lane-action-add{background-color:var(--interactive-accent);color:var(--text-on-accent)}button.kanban-plugin__item-action-add:hover,button.kanban-plugin__lane-action-add:hover{background-color:var(--interactive-accent-hover)}.kanban-plugin__lane-header-wrapper{padding-block:8px;padding-inline:8px 12px;display:flex;align-items:center;gap:var(--size-4-1);flex-shrink:0;flex-grow:0;border-bottom:1px solid var(--background-modifier-border)}.collapse-horizontal .kanban-plugin__lane-header-wrapper,.collapse-vertical .kanban-plugin__lane-header-wrapper,.will-prepend .kanban-plugin__lane-header-wrapper{border-bottom:none}.kanban-plugin__lane-wrapper.collapse-horizontal{width:auto}.kanban-plugin__lane-wrapper.collapse-horizontal .kanban-plugin__lane-header-wrapper{writing-mode:vertical-lr}.kanban-plugin__lane-wrapper.collapse-horizontal .kanban-plugin__lane-header-wrapper{gap:var(--size-4-2)}.kanban-plugin__lane-wrapper.collapse-horizontal .kanban-plugin__lane-title-count,.kanban-plugin__lane-wrapper.collapse-horizontal .kanban-plugin__lane-title-text{transform:rotate(180deg)}.kanban-plugin__lane-wrapper.collapse-horizontal .kanban-plugin__lane-settings-button-wrapper{display:none}.kanban-plugin__lane-wrapper.collapse-vertical .kanban-plugin__lane-settings-button-wrapper{visibility:hidden}.kanban-plugin__lane-collapse{flex-grow:0;color:var(--text-faint)}.kanban-plugin__lane-collapse>span{display:flex}.collapse-vertical .kanban-plugin__lane-collapse>span{transform:rotate(-90deg)}.kanban-plugin__lane-grip{cursor:grab;flex-grow:0;color:var(--text-faint)}.kanban-plugin__lane-grip:active{cursor:grabbing}.kanban-plugin__lane-collapse svg{--icon-size: 1rem}.kanban-plugin__lane-grip>svg{height:1rem;display:block}.kanban-plugin__lane-title{font-weight:600;font-size:.875rem;flex-grow:1;width:100%;display:flex;flex-direction:column}.kanban-plugin__lane-title-text{flex-grow:1}div.kanban-plugin__lane-title-count{border-radius:3px;color:var(--text-muted);display:block;font-size:13px;line-height:1;padding:4px}div.kanban-plugin__lane-title-count.wip-exceeded{font-weight:700;color:var(--text-normal);background-color:rgba(var(--background-modifier-error-rgb),.25)}.kanban-plugin__table-cell-wrapper .kanban-plugin__lane-menu,.kanban-plugin__table-cell-wrapper .kanban-plugin__item-prefix-button,.kanban-plugin__item .kanban-plugin__item-prefix-button,.kanban-plugin__item .kanban-plugin__item-postfix-button,.kanban-plugin__lane .kanban-plugin__lane-settings-button{--icon-stroke: 2.5px;font-size:13px;line-height:1;color:var(--text-muted);padding:4px;display:flex;margin-inline-end:-4px}.kanban-plugin__table-cell-wrapper .kanban-plugin__lane-menu.is-enabled,.kanban-plugin__table-cell-wrapper .kanban-plugin__item-prefix-button.is-enabled,.kanban-plugin__item .kanban-plugin__item-prefix-button.is-enabled,.kanban-plugin__item .kanban-plugin__item-postfix-button.is-enabled,.kanban-plugin__lane .kanban-plugin__lane-settings-button.is-enabled{color:var(--text-accent)}.kanban-plugin__table-cell-wrapper .kanban-plugin__lane-menu{color:var(--text-faint);margin-inline-start:2px;margin-inline-end:0px}.kanban-plugin__table-cell-wrapper .kanban-plugin__item-prefix-button,.kanban-plugin__item .kanban-plugin__item-prefix-button{margin-inline-end:4px;margin-inline-start:-4px}.kanban-plugin__table-cell-wrapper button.kanban-plugin__item-prefix-button,.kanban-plugin__item button.kanban-plugin__item-prefix-button{margin-block:4px;margin-inline:0 7px;padding:0}.kanban-plugin__lane-action-wrapper,.kanban-plugin__item-edit-archive-button,.kanban-plugin__item-settings-actions .kanban-plugin__icon,.kanban-plugin__item-edit-archive-button>.kanban-plugin__icon,.kanban-plugin__item-prefix-button>.kanban-plugin__icon,.kanban-plugin__item-postfix-button>.kanban-plugin__icon,.kanban-plugin__lane-settings-button>.kanban-plugin__icon{display:flex}.kanban-plugin__lane-settings-button-wrapper{display:flex;gap:4px}button.kanban-plugin__lane-settings-button+button.kanban-plugin__lane-settings-button{margin-inline-start:2px}.kanban-plugin__lane-settings-button svg{width:1em;height:1em}.kanban-plugin__lane-items-wrapper{margin:4px;height:100%}.kanban-plugin__lane-items{padding:4px;margin-block:0;margin-inline:4px;display:flex;flex-direction:column}.kanban-plugin__lane-items>div{margin-block-start:4px}.kanban-plugin__lane-items>.kanban-plugin__placeholder{flex-grow:1}.kanban-plugin__lane-items>.kanban-plugin__placeholder:only-child{height:2.55em;border:3px dashed rgba(var(--text-muted-rgb),.1);margin-block-end:4px;border-radius:6px;transition:border .2s ease}.is-sorting .kanban-plugin__lane-items>.kanban-plugin__placeholder:only-child{border-color:hsla(var(--interactive-accent-hsl),.6)}.kanban-plugin__item-button-wrapper{border-top:1px solid var(--background-modifier-border);padding:8px;flex-shrink:0;flex-grow:0}.kanban-plugin__item-button-wrapper>button{text-align:left;width:100%}.kanban-plugin__lane-header-wrapper+.kanban-plugin__item-button-wrapper{border-top:none;border-bottom:1px solid var(--background-modifier-border);padding-block:4px 8px;padding-inline:8px}.kanban-plugin__item-form{border-top:1px solid var(--background-modifier-border);padding:8px}.kanban-plugin__item-form .kanban-plugin__item-input-wrapper{padding-block:6px;padding-inline:8px;border:1px solid var(--background-modifier-border);background-color:var(--background-primary);border-radius:var(--input-radius);min-height:var(--input-height)}.kanban-plugin__lane-header-wrapper+.kanban-plugin__item-form{border-top:none;border-bottom:1px solid var(--background-modifier-border);padding-block:4px 8px;padding-inline:8px}.kanban-plugin__item-input-wrapper{--line-height-normal: var(--line-height-tight);display:flex;flex-direction:column;flex-grow:1}.kanban-plugin button.kanban-plugin__item-submit-button{flex-grow:0;flex-shrink:1;font-size:14px;height:auto;line-height:1;margin-block-start:5px;width:auto}.is-mobile .kanban-plugin button.kanban-plugin__item-submit-button{font-size:12px}.is-mobile .kanban-plugin__lane-form-wrapper{--input-height: auto}.is-mobile .kanban-plugin__lane-form-wrapper button{padding-block:var(--size-4-2)}.is-mobile .kanban-plugin__lane-form-wrapper .markdown-source-view.mod-cm6{font-size:var(--font-ui-medium)}.is-mobile .kanban-plugin .kanban-plugin__lane-input-wrapper button.kanban-plugin__item-submit-button{display:none}button.kanban-plugin__new-item-button{background-color:transparent;color:var(--text-muted)}.kanban-plugin__new-item-button:hover{color:var(--text-on-accent);background-color:var(--interactive-accent-hover)}.kanban-plugin__drag-container>.kanban-plugin__item-wrapper .kanban-plugin__item{border-color:var(--interactive-accent);box-shadow:var(--shadow-s),0 0 0 2px hsla(var(--interactive-accent-hsl),.7)}.kanban-plugin__item{font-size:.875rem;border:1px solid var(--background-modifier-border);border-radius:var(--input-radius);overflow:hidden;transition:.3s opacity cubic-bezier(.25,1,.5,1)}.kanban-plugin__item:has(.markdown-source-view){outline:1px solid var(--background-modifier-border-focus);border-color:var(--background-modifier-border-focus)}.kanban-plugin__item-content-wrapper{background:var(--background-primary)}.kanban-plugin__item-title-wrapper{background:var(--background-primary);display:flex;padding-block:6px;padding-inline:8px}.kanban-plugin__item-title-wrapper:not(:only-child){border-bottom:1px solid var(--background-modifier-border)}.kanban-plugin__item-title{width:100%;line-height:var(--line-height-tight);margin-block-start:1px}.kanban-plugin__meta-value,.kanban-plugin__markdown-preview-wrapper{white-space:pre-wrap;white-space:break-spaces;word-break:break-word;overflow-wrap:anywhere;--font-text-size: .875rem;--line-height-normal: var(--line-height-tight);--p-spacing: var(--size-4-2);--list-indent: 1.75em}.kanban-plugin__meta-value .markdown-preview-view,.kanban-plugin__markdown-preview-wrapper .markdown-preview-view{--file-margins: 0}.kanban-plugin__meta-value.inline,.kanban-plugin__markdown-preview-wrapper.inline{display:inline-block}.kanban-plugin__meta-value .kanban-plugin__markdown-preview-view>*:first-child,.kanban-plugin__markdown-preview-wrapper .kanban-plugin__markdown-preview-view>*:first-child{margin-block-start:0}.kanban-plugin__meta-value .kanban-plugin__markdown-preview-view>*:last-child,.kanban-plugin__markdown-preview-wrapper .kanban-plugin__markdown-preview-view>*:last-child{margin-block-end:0}.kanban-plugin__meta-value .markdown-preview-view,.kanban-plugin__markdown-preview-wrapper .markdown-preview-view{width:unset;height:unset;position:unset;overflow-y:unset;overflow-wrap:unset;color:unset;user-select:unset;-webkit-user-select:unset;white-space:normal}.kanban-plugin__meta-value .markdown-preview-view .markdown-embed,.kanban-plugin__markdown-preview-wrapper .markdown-preview-view .markdown-embed,.kanban-plugin__meta-value .markdown-preview-view blockquote,.kanban-plugin__markdown-preview-wrapper .markdown-preview-view blockquote{padding-inline:var(--size-4-2) 0;padding-block:var(--size-4-1);margin-block-start:var(--p-spacing);margin-block-end:var(--p-spacing)}.kanban-plugin__meta-value .kanban-plugin__markdown-preview-view{display:inline-flex}.kanban-plugin__meta-value .kanban-plugin__markdown-preview-view>div:first-child>*:first-child{margin-block-start:0}.kanban-plugin__meta-value .kanban-plugin__markdown-preview-view>div:last-child>*:last-child{margin-block-end:0}.kanban-plugin__embed-link-wrapper{padding:2px;float:right}.kanban-plugin__item-metadata-wrapper:not(:empty){background-color:var(--background-primary-alt);padding-inline:8px;padding-block:6px}.kanban-plugin__item-metadata:not(:empty){padding-block-start:5px;font-size:12px}.kanban-plugin__item-metadata:not(:empty) .markdown-preview-view{line-height:var(--line-height-tight);font-size:inherit}.kanban-plugin__item-metadata>span{display:block}.kanban-plugin__item-metadata>span.kanban-plugin__item-metadata-date-wrapper{display:inline-block}.kanban-plugin__item-metadata .is-button{cursor:var(--cursor)}.kanban-plugin__item-metadata .is-button:hover{color:var(--text-normal)}.kanban-plugin__item-metadata-date-relative:first-letter{text-transform:uppercase}.kanban-plugin__item-metadata a{text-decoration:none}.kanban-plugin__item-task-inline-metadata-item,.kanban-plugin__item-task-metadata-item{display:inline-flex;margin-block:3px 0;margin-inline:0 6px;gap:4px}.kanban-plugin__item-task-inline-metadata-item{padding-inline:2px;background-color:var(--background-secondary);border-radius:var(--radius-s)}.kanban-plugin__table-cell-wrapper .kanban-plugin__item-task-inline-metadata-item{background-color:unset;padding-inline:unset;border-radius:unset}.kanban-plugin__item-tags:not(:empty){padding-block-start:2px}.kanban-plugin__item-tag{display:inline-block;margin-inline-end:4px}.kanban-plugin__item-tags .kanban-plugin__item-tag{font-size:12px;background-color:var(--tag-background, hsla(var(--interactive-accent-hsl), .1));color:var(--tag-color, var(--text-accent));margin-block:3px 0;margin-inline:0 3px}.kanban-plugin__item-tag.is-search-match,.kanban-plugin__item-tags .kanban-plugin__item-tag.is-search-match{background-color:var(--text-highlight-bg);color:var(--text-normal)}.kanban-plugin__meta-table{width:100%;margin:0;line-height:var(--line-height-tight);font-size:.75rem}.kanban-plugin__meta-table .markdown-preview-view{font-size:.75rem}.kanban-plugin__meta-table .kanban-plugin__item-tags .kanban-plugin__item-tag{position:relative;inset-block-start:-2px;margin-block:0 3px}.kanban-plugin__meta-table td{vertical-align:top;padding-block:3px 0;padding-inline:0;width:10%}.kanban-plugin__meta-table td+td{width:90%}.kanban-plugin__meta-table td:only-child{width:100%}.kanban-plugin__meta-table td.kanban-plugin__meta-key{white-space:nowrap;padding-inline-end:5px;color:var(--text-muted)}.kanban-plugin__meta-table td.kanban-plugin__meta-key.is-search-match>span{background-color:var(--text-highlight-bg);color:var(--text-normal)}.kanban-plugin__meta-value:not(.mod-array){white-space:pre-wrap;display:flex}.kanban-plugin__meta-value>.is-search-match,.kanban-plugin__meta-value.is-search-match{background-color:var(--text-highlight-bg);color:var(--text-normal)}.kanban-plugin__item-prefix-button-wrapper,.kanban-plugin__item-postfix-button-wrapper{display:flex;flex-grow:0;flex-shrink:0;align-self:start}.kanban-plugin__item-prefix-button-wrapper>div,.kanban-plugin__item-postfix-button-wrapper>div{display:flex;flex-direction:column;gap:var(--size-4-1)}.kanban-plugin__item-prefix-button-wrapper{flex-direction:column}.kanban-plugin__item-prefix-button-wrapper .kanban-plugin__item-prefix-button{width:var(--checkbox-size);height:var(--checkbox-size)}.kanban-plugin__item-prefix-button-wrapper .kanban-plugin__item-prefix-button,.kanban-plugin__item-prefix-button-wrapper input[type=checkbox]{margin-block:2px;margin-inline:0px 7px}.kanban-plugin__item-prefix-button-wrapper .kanban-plugin__item-prefix-button+button,.kanban-plugin__item-prefix-button-wrapper input[type=checkbox]+button{margin-block-start:10px}button.kanban-plugin__item-postfix-button{visibility:hidden;opacity:0;transition:.1s opacity;display:flex;align-self:flex-start}button.kanban-plugin__item-postfix-button.is-enabled,.kanban-plugin__item:hover button.kanban-plugin__item-postfix-button{visibility:visible;opacity:1}.kanban-plugin__item-settings-actions{padding:5px;display:flex}.kanban-plugin__item-settings-actions>button{line-height:1;display:flex;align-items:center;justify-content:center;font-size:.75rem;width:100%}.kanban-plugin__lane-action-wrapper button>.kanban-plugin__icon,.kanban-plugin__item-settings-actions button>.kanban-plugin__icon{margin-inline-end:5px}.kanban-plugin__item-settings-actions>button:first-child,.kanban-plugin__lane-action-wrapper>button:first-child{margin-inline-end:2.5px}.kanban-plugin__item-settings-actions>button:last-child,.kanban-plugin__lane-action-wrapper>button:last-child{margin-inline-start:2.5px}.kanban-plugin__archive-lane-button,.kanban-plugin__item-button-archive{color:var(--text-muted);border:1px solid var(--background-modifier-border)}.kanban-plugin__archive-lane-button:hover,.kanban-plugin__item-button-archive:hover{color:var(--text-normal)}.kanban-plugin__item-button-delete{border:1px solid rgba(var(--background-modifier-error-rgb),.15);color:rgba(var(--background-modifier-error-rgb),1)}.kanban-plugin__item-button-delete:hover{background-color:rgba(var(--background-modifier-error-rgb),.2);color:var(--text-error)}.theme-dark .kanban-plugin__item-button-delete{background-color:transparent;border:1px solid rgba(var(--background-modifier-error-rgb),1);color:var(--text-error)}.theme-dark .kanban-plugin__item-button-delete:hover{background-color:rgba(var(--background-modifier-error-rgb),1);color:var(--text-error)}.kanban-plugin__checkbox-wrapper{border-top:1px solid var(--background-modifier-border);border-bottom:1px solid var(--background-modifier-border);padding:10px;margin-block-end:10px;display:flex;align-items:center}.kanban-plugin__checkbox-wrapper .checkbox-container{flex-shrink:0;flex-grow:0;margin-inline-start:15px}.kanban-plugin__checkbox-label{font-size:.8125rem;line-height:var(--line-height-tight)}.kanban-plugin__lane-setting-wrapper>div{border-top:none;border-bottom:none;padding-block:10px;padding-inline:15px;margin-block-end:0}.kanban-plugin__lane-setting-wrapper>div:last-child{border-bottom:1px solid var(--background-modifier-border);margin-block-end:10px}.kanban-plugin__action-confirm-wrapper{border:1px solid rgba(var(--background-modifier-error-rgb),.2);background-color:rgba(var(--background-modifier-error-rgb),.1);border-radius:4px;padding:10px;margin-block:5px;margin-inline:10px}.theme-dark .kanban-plugin__action-confirm-wrapper{border:1px solid rgba(var(--background-modifier-error-rgb),1)}.kanban-plugin__delete-lane-button,.kanban-plugin__archive-lane-button{display:flex;align-items:center;justify-content:center;font-size:.75rem;width:50%}.kanban-plugin__delete-lane-button{border:1px solid rgba(var(--background-modifier-error-rgb),.15);color:rgba(var(--background-modifier-error-rgb),1)}.kanban-plugin__delete-lane-button:hover{background-color:rgba(var(--background-modifier-error-rgb),.2);color:var(--text-error)}.theme-dark .kanban-plugin__delete-lane-button{background-color:transparent;border:1px solid rgba(var(--background-modifier-error-rgb),1);color:var(--text-error)}.theme-dark .kanban-plugin__delete-lane-button:hover{background-color:rgba(var(--background-modifier-error-rgb),1);color:var(--text-error)}.kanban-plugin__action-confirm-text{font-size:.875rem;color:var(--text-error);margin-block-end:10px;line-height:var(--line-height-tight)}button.kanban-plugin__confirm-action-button{border:1px solid rgba(var(--background-modifier-error-rgb),.2);margin-inline-end:5px;color:var(--text-error)}button.kanban-plugin__confirm-action-button:hover{background-color:rgba(var(--background-modifier-error-rgb),.5)}button.kanban-plugin__cancel-action-button{border:1px solid var(--background-modifier-border)}.modal.kanban-plugin__board-settings-modal{width:var(--modal-width);height:var(--modal-height);max-height:var(--modal-max-height);max-width:var(--modal-max-width);padding:0;display:flex;flex-direction:column}.modal.kanban-plugin__board-settings-modal .modal-content{padding-block:30px;padding-inline:50px;height:100%;overflow-y:auto;overflow-x:hidden;margin:0}.kanban-plugin__board-settings-modal .setting-item{flex-wrap:wrap;justify-content:space-between}.kanban-plugin__board-settings-modal .setting-item-info{max-width:400px;min-width:300px;width:50%}.kanban-plugin__board-settings-modal .setting-item-control{min-width:300px;flex-shrink:0}.kanban-plugin__board-settings-modal .choices{width:100%;text-align:left}.kanban-plugin__board-settings-modal .choices[data-type*=select-one] .choices__inner{background-color:var(--background-primary);border-color:var(--background-modifier-border);padding:0;min-height:0}.kanban-plugin__board-settings-modal .choices[data-type*=select-one] .choices__input{background-color:var(--background-primary);border-bottom-color:var(--background-modifier-border);font-size:14px}.kanban-plugin__board-settings-modal .choices__input{border-radius:0;border-top:none;border-left:none;border-right:none}.kanban-plugin__board-settings-modal .choices__list[role=listbox]{overflow-x:hidden}.kanban-plugin__board-settings-modal .choices__list--single{padding-block:4px;padding-inline:6px 20px}.kanban-plugin__board-settings-modal .is-open .choices__list--dropdown,.kanban-plugin__board-settings-modal .choices__list--dropdown{background-color:var(--background-primary);border-color:var(--background-modifier-border);word-break:normal;max-height:200px;display:flex;flex-direction:column}.kanban-plugin__board-settings-modal .choices__list--dropdown .choices__item--selectable:after{display:none}.kanban-plugin__board-settings-modal .choices__list--dropdown .choices__item--selectable{padding-block:4px;padding-inline:6px}.kanban-plugin__board-settings-modal .choices__list--dropdown .choices__item.is-highlighted{background-color:var(--background-primary-alt)}.kanban-plugin__board-settings-modal .choices__placeholder{opacity:1;color:var(--text-muted)}.kanban-plugin__board-settings-modal .error{border-color:var(--background-modifier-error-hover)!important}.kanban-plugin__date-picker{position:absolute;z-index:var(--layer-popover);--cell-size: 2.4em}.kanban-plugin__date-picker .flatpickr-input{width:0;height:0;opacity:0;border:none;padding:0;display:block;margin-block-end:-1px}.kanban-plugin__date-picker .flatpickr-current-month{color:var(--text-normal);font-weight:600;font-size:inherit;width:100%;position:static;height:auto;display:flex;align-items:center;justify-content:center;padding:0}.kanban-plugin__date-picker .flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:var(--text-normal)}.kanban-plugin__date-picker .flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:var(--text-normal)}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{fill:currentColor}.kanban-plugin__date-picker .flatpickr-calendar{border-radius:var(--radius-m);font-size:13px;overflow:hidden;background-color:var(--background-primary);width:calc(var(--cell-size) * 7 + 8px);box-shadow:0 0 0 1px var(--background-modifier-border),0 15px 25px #0003}.kanban-plugin__date-picker .flatpickr-calendar.inline{top:0}.kanban-plugin__date-picker .flatpickr-months{font-size:13px;padding-block:2px 4px;padding-inline:2px;align-items:center}.kanban-plugin__date-picker .flatpickr-months .flatpickr-current-month input.cur-year,.kanban-plugin__date-picker .flatpickr-months select{border-radius:4px;padding:4px}.kanban-plugin__date-picker .flatpickr-months .numInputWrapper{border-radius:4px}.kanban-plugin__date-picker .flatpickr-months .flatpickr-month{width:100%;height:auto}.kanban-plugin__date-picker .flatpickr-months .flatpickr-prev-month,.kanban-plugin__date-picker .flatpickr-months .flatpickr-next-month{color:var(--text-normal);fill:currentColor;border-radius:4px;display:flex;align-items:center;justify-content:center;line-height:1;height:auto;padding:5px;position:static;flex-shrink:0}.kanban-plugin__date-picker .flatpickr-months .flatpickr-prev-month:hover,.kanban-plugin__date-picker .flatpickr-months .flatpickr-next-month:hover{background-color:var(--background-primary-alt);color:var(--text-normal)}.kanban-plugin__date-picker .flatpickr-months .flatpickr-prev-month:hover svg,.kanban-plugin__date-picker .flatpickr-months .flatpickr-next-month:hover svg{fill:currentColor}.kanban-plugin__date-picker .flatpickr-current-month .flatpickr-monthDropdown-months{box-shadow:none;color:var(--text-normal);font-weight:inherit;margin-inline-end:5px}.kanban-plugin__date-picker .flatpickr-current-month input.cur-year{color:var(--text-normal);font-weight:inherit}.kanban-plugin__date-picker .flatpickr-weekdays{height:auto;padding-block:8px 12px;padding-inline:0}.kanban-plugin__date-picker span.flatpickr-weekday{font-weight:400;color:var(--text-muted)}.kanban-plugin__date-picker .flatpickr-innerContainer{padding:4px}.kanban-plugin__date-picker .flatpickr-day{color:var(--text-normal);display:inline-flex;align-items:center;justify-content:center;width:var(--cell-size);height:var(--cell-size);line-height:1;border-radius:6px}.kanban-plugin__date-picker .flatpickr-day.today{border-color:var(--interactive-accent)}.kanban-plugin__date-picker .flatpickr-day.today:hover{color:var(--text-normal);border-color:var(--interactive-accent);background-color:var(--background-primary-alt)}.kanban-plugin__date-picker .flatpickr-day.selected{border-color:var(--interactive-accent);background-color:var(--interactive-accent);color:var(--text-on-accent)}.kanban-plugin__date-picker .flatpickr-day.selected:hover{border-color:var(--interactive-accent);background-color:var(--interactive-accent)}.kanban-plugin__date-picker .flatpickr-days{width:calc(var(--cell-size) * 7)}.kanban-plugin__date-picker .dayContainer{width:calc(var(--cell-size) * 7);min-width:calc(var(--cell-size) * 7);max-width:calc(var(--cell-size) * 7)}.kanban-plugin__date-picker .flatpickr-day.inRange,.kanban-plugin__date-picker .flatpickr-day.prevMonthDay.inRange,.kanban-plugin__date-picker .flatpickr-day.nextMonthDay.inRange,.kanban-plugin__date-picker .flatpickr-day.today.inRange,.kanban-plugin__date-picker .flatpickr-day.prevMonthDay.today.inRange,.kanban-plugin__date-picker .flatpickr-day.nextMonthDay.today.inRange,.kanban-plugin__date-picker .flatpickr-day:hover,.kanban-plugin__date-picker .flatpickr-day.prevMonthDay:hover,.kanban-plugin__date-picker .flatpickr-day.nextMonthDay:hover,.kanban-plugin__date-picker .flatpickr-day:focus,.kanban-plugin__date-picker .flatpickr-day.prevMonthDay:focus,.kanban-plugin__date-picker .flatpickr-day.nextMonthDay:focus{background-color:var(--background-primary-alt);border-color:var(--background-primary-alt)}.kanban-plugin__date-picker .flatpickr-day.flatpickr-disabled,.kanban-plugin__date-picker .flatpickr-day.flatpickr-disabled:hover,.kanban-plugin__date-picker .flatpickr-day.prevMonthDay,.kanban-plugin__date-picker .flatpickr-day.nextMonthDay,.kanban-plugin__date-picker .flatpickr-day.notAllowed,.kanban-plugin__date-picker .flatpickr-day.notAllowed.prevMonthDay,.kanban-plugin__date-picker .flatpickr-day.notAllowed.nextMonthDay{color:var(--text-faint)}.kanban-plugin__time-picker{position:absolute;max-height:250px;overflow:auto;border-radius:4px;border:1px solid var(--background-modifier-border);box-shadow:0 2px 8px var(--background-modifier-box-shadow);background:var(--background-primary);color:var(--text-normal);font-size:14px;z-index:var(--layer-menu)}.kanban-plugin__time-picker-item{display:flex;align-items:center;color:var(--text-muted);cursor:var(--cursor);line-height:1;padding-block:6px;padding-inline:8px}.kanban-plugin__time-picker-check{visibility:hidden;display:inline-flex;margin-inline-end:5px}.kanban-plugin__time-picker-item.is-hour{color:var(--text-normal);font-weight:600}.kanban-plugin__time-picker-item.is-selected .kanban-plugin__time-picker-check{visibility:visible}.kanban-plugin__time-picker-item:hover,.kanban-plugin__time-picker-item.is-selected{background:var(--background-secondary)}.kanban-plugin mark{background-color:var(--text-highlight-bg)}.kanban-plugin__draggable-setting-container{border-top:0;padding:0;flex-direction:column}.kanban-plugin__draggable-setting-container>div{width:100%;margin-inline-end:0!important}.kanban-plugin__setting-item-wrapper{border-top:1px solid var(--background-modifier-border)}.kanban-plugin__draggable-setting-container>.kanban-plugin__placeholder{border-top:1px solid var(--background-modifier-border)}.kanban-plugin__setting-item{background-color:var(--background-secondary);width:100%;font-size:16px;display:flex;align-items:flex-start;padding:12px;color:var(--text-muted)}.kanban-plugin__drag-container .kanban-plugin__setting-item{border:1px solid hsla(var(--interactive-accent-hsl),.8);box-shadow:0 15px 25px #0003,0 0 0 2px hsla(var(--interactive-accent-hsl),.8)}.kanban-plugin__setting-controls-wrapper{flex-grow:1;flex-shrink:1}.kanban-plugin__setting-input-wrapper{display:flex;flex-wrap:wrap;margin-block-end:1rem}.kanban-plugin__setting-input-wrapper>div{margin-inline-end:10px}.kanban-plugin__setting-toggle-wrapper>div{display:flex;align-items:center;line-height:1;margin-block-end:10px}.kanban-plugin__setting-toggle-wrapper .checkbox-container{margin-inline-end:10px}.kanban-plugin__setting-button-wrapper{display:flex;justify-content:flex-end;flex-grow:1;flex-shrink:0;max-width:25px}.kanban-plugin__setting-button-wrapper>div{margin-inline-start:12px}.kanban-plugin__setting-key-input-wrapper{margin-block:1rem;margin-inline:0}.kanban-plugin__setting-key-input-wrapper>input{margin-inline-end:10px}.kanban-plugin__date-color-input-wrapper,.kanban-plugin__tag-sort-input-wrapper,.kanban-plugin__tag-color-input-wrapper{display:flex;flex-direction:column;flex-grow:1;gap:1rem}.kanban-plugin__tag-sort-input-wrapper .kanban-plugin__setting-key-input-wrapper{margin-block-start:0}.kanban-plugin__tag-sort-input-wrapper .kanban-plugin__setting-input-wrapper{margin:0}.kanban-plugin__add-tag-color-button{align-self:baseline;margin:0}.kanban-plugin__date-color-wrapper,.kanban-plugin__tag-color-input .kanban-plugin__item-tags{background-color:var(--background-primary);padding:10px;margin:0;border-radius:4px}.kanban-plugin__tag-color-input .kanban-plugin__item-tag{margin-block-start:0;font-size:13px;font-weight:500;line-height:1.5}.kanban-plugin__date-color-input-wrapper input[type=number]{width:75px;padding-block:.6em;padding-inline:.8em;height:auto;border-radius:.5em}.kanban-plugin__date-color-input-wrapper .kanban-plugin__setting-item-label{margin-block-end:0}.kanban-plugin__date-color-config{padding-block:0 10px;padding-inline:0;display:flex;flex-wrap:wrap;gap:5px;align-items:center}.kanban-plugin__date-color-wrapper{display:inline-block;margin-block-start:10px}.kanban-plugin__date-color-wrapper .kanban-plugin__item-metadata{padding:0}.kanban-plugin__metadata-setting-desc{font-size:14px}.kanban-plugin__setting-button-spacer{visibility:hidden}.kanban-plugin__setting-item-label{font-size:12px;font-weight:700;margin-block-end:5px}.kanban-plugin__setting-toggle-wrapper .kanban-plugin__setting-item-label{margin-block-end:0}.kanban-plugin__hitbox{border:2px dashed tomato}.kanban-plugin__placeholder{flex-grow:0;flex-shrink:0;width:0;height:0;pointer-events:none}.kanban-plugin__placeholder[data-axis=horizontal]{height:100%}.kanban-plugin__placeholder[data-axis=vertical]{width:100%}body:not(.native-scrollbars) .kanban-plugin__scroll-container::-webkit-scrollbar{background-color:transparent;width:16px;height:16px}body:not(.native-scrollbars) .kanban-plugin__scroll-container::-webkit-scrollbar-thumb{border:4px solid transparent;background-clip:content-box}.kanban-plugin__scroll-container{will-change:transform}.kanban-plugin__scroll-container.kanban-plugin__horizontal{overflow-y:hidden;overflow-x:auto}.kanban-plugin__scroll-container.kanban-plugin__vertical{overflow-y:auto;overflow-x:hidden}.kanban-plugin__drag-container{contain:layout size;z-index:10000;pointer-events:none;position:fixed;top:0;left:0}.kanban-plugin__loading{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.sk-pulse{width:60px;height:60px;background-color:var(--text-faint);border-radius:100%;animation:sk-pulse 1.2s infinite cubic-bezier(.455,.03,.515,.955)}@keyframes sk-pulse{0%{transform:scale(0)}to{transform:scale(1);opacity:0}}.kanban-plugin__color-picker-wrapper{position:relative}.kanban-plugin__color-picker{position:absolute;top:-5px;left:0;transform:translateY(-100%)}.kanban-plugin__date,.cm-kanban-time-wrapper,.cm-kanban-date-wrapper{display:inline-block;color:var(--date-color);border-radius:var(--radius-s);background-color:var(--date-background-color, rgba(var(--mono-rgb-100), .05))}.kanban-plugin__date:hover,.cm-kanban-time-wrapper:hover,.cm-kanban-date-wrapper:hover{background-color:var(--date-background-color, rgba(var(--mono-rgb-100), .1))}.kanban-plugin__date.kanban-plugin__preview-date-link,.cm-kanban-time-wrapper.kanban-plugin__preview-date-link,.cm-kanban-date-wrapper.kanban-plugin__preview-date-link{--link-decoration: none;--link-unresolved-decoration-style: unset}.kanban-plugin__date>span,.cm-kanban-time-wrapper>span,.cm-kanban-date-wrapper>span,.kanban-plugin__date>a,.cm-kanban-time-wrapper>a,.cm-kanban-date-wrapper>a{padding-inline:var(--size-2-1)}.completion .kanban-plugin__date.has-background{color:inherit;background-color:transparent}.completion .kanban-plugin__date.has-background:hover{background-color:transparent}.is-date .kanban-plugin__date:not(.has-background){background-color:transparent}.is-date .kanban-plugin__date:not(.has-background):hover{background-color:transparent}.kanban-plugin__meta-value .kanban-plugin__date:hover{background-color:var(--date-background-color, rgba(var(--mono-rgb-100), .05))}
diff --git a/docs/.obsidian/plugins/table-editor-obsidian/data.json b/docs/.obsidian/plugins/table-editor-obsidian/data.json
new file mode 100644
index 0000000..9009465
--- /dev/null
+++ b/docs/.obsidian/plugins/table-editor-obsidian/data.json
@@ -0,0 +1,6 @@
+{
+ "formatType": "normal",
+ "showRibbonIcon": true,
+ "bindEnter": true,
+ "bindTab": true
+}
\ No newline at end of file
diff --git a/docs/.obsidian/plugins/table-editor-obsidian/main.js b/docs/.obsidian/plugins/table-editor-obsidian/main.js
new file mode 100644
index 0000000..c24025b
--- /dev/null
+++ b/docs/.obsidian/plugins/table-editor-obsidian/main.js
@@ -0,0 +1,29167 @@
+'use strict';
+
+var obsidian = require('obsidian');
+var state = require('@codemirror/state');
+var view = require('@codemirror/view');
+
+/******************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+/* global Reflect, Promise, SuppressedError, Symbol */
+
+var extendStatics = function(d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+};
+
+function __extends(d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+
+function __awaiter(thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+}
+
+function __generator(thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+}
+
+typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
+ var e = new Error(message);
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
+};
+
+var icons = {
+ spreadsheet: "\n",
+ alignLeft: "\n",
+ alignCenter: "\n",
+ alignRight: "\n",
+ deleteColumn: "\n",
+ deleteRow: "\n",
+ insertColumn: "\n",
+ insertRow: "\n",
+ moveColumnLeft: "\n",
+ moveColumnRight: "\n",
+ moveRowDown: "\n",
+ moveRowUp: "\n",
+ sortAsc: "\n",
+ sortDesc: "\n",
+ formula: "\n",
+ help: "\n",
+ csv: "\n",
+ arrowenter: "\n",
+ arrowtab: "\n",
+};
+var addIcons = function () {
+ Object.keys(icons).forEach(function (key) {
+ // Don't add the 'help' icon here as it will overwrite the native one.
+ if (key !== 'help') {
+ obsidian.addIcon(key, icons[key]);
+ }
+ });
+};
+
+var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+function getAugmentedNamespace(n) {
+ if (n.__esModule) return n;
+ var f = n.default;
+ if (typeof f == "function") {
+ var a = function a () {
+ if (this instanceof a) {
+ return Reflect.construct(f, arguments, this.constructor);
+ }
+ return f.apply(this, arguments);
+ };
+ a.prototype = f.prototype;
+ } else a = {};
+ Object.defineProperty(a, '__esModule', {value: true});
+ Object.keys(n).forEach(function (k) {
+ var d = Object.getOwnPropertyDescriptor(n, k);
+ Object.defineProperty(a, k, d.get ? d : {
+ enumerable: true,
+ get: function () {
+ return n[k];
+ }
+ });
+ });
+ return a;
+}
+
+var lib$1 = {};
+
+var point = {};
+
+Object.defineProperty(point, "__esModule", { value: true });
+point.Point = void 0;
+/**
+ * A `Point` represents a point in the text editor.
+ */
+class Point {
+ /**
+ * Creates a new `Point` object.
+ *
+ * @param row - Row of the point, starts from 0.
+ * @param column - Column of the point, starts from 0.
+ */
+ constructor(row, column) {
+ this.row = row;
+ this.column = column;
+ }
+ /**
+ * Checks if the point is equal to another point.
+ */
+ equals(point) {
+ return this.row === point.row && this.column === point.column;
+ }
+}
+point.Point = Point;
+
+var range$1 = {};
+
+Object.defineProperty(range$1, "__esModule", { value: true });
+range$1.Range = void 0;
+/**
+ * A `Range` object represents a range in the text editor.
+ */
+let Range$1 = class Range {
+ /**
+ * Creates a new `Range` object.
+ *
+ * @param start - The start point of the range.
+ * @param end - The end point of the range.
+ */
+ constructor(start, end) {
+ this.start = start;
+ this.end = end;
+ }
+};
+range$1.Range = Range$1;
+
+var focus = {};
+
+Object.defineProperty(focus, "__esModule", { value: true });
+focus.Focus = void 0;
+/**
+ * A `Focus` object represents which cell is focused in the table.
+ *
+ * Note that `row` and `column` properties specifiy a cell's position in the
+ * table, not the cursor's position in the text editor as {@link Point} class.
+ *
+ * @private
+ */
+class Focus {
+ /**
+ * Creates a new `Focus` object.
+ *
+ * @param row - Row of the focused cell.
+ * @param column - Column of the focused cell.
+ * @param offset - Raw offset in the cell.
+ */
+ constructor(row, column, offset) {
+ this.row = row;
+ this.column = column;
+ this.offset = offset;
+ }
+ /**
+ * Checks if two focuses point the same cell.
+ * Offsets are ignored.
+ */
+ posEquals(focus) {
+ return this.row === focus.row && this.column === focus.column;
+ }
+ /**
+ * Creates a copy of the focus object by setting its row to the specified value.
+ *
+ * @param row - Row of the focused cell.
+ * @returns A new focus object with the specified row.
+ */
+ setRow(row) {
+ return new Focus(row, this.column, this.offset);
+ }
+ /**
+ * Creates a copy of the focus object by setting its column to the specified value.
+ *
+ * @param column - Column of the focused cell.
+ * @returns A new focus object with the specified column.
+ */
+ setColumn(column) {
+ return new Focus(this.row, column, this.offset);
+ }
+ /**
+ * Creates a copy of the focus object by setting its offset to the specified value.
+ *
+ * @param offset - Offset in the focused cell.
+ * @returns A new focus object with the specified offset.
+ */
+ setOffset(offset) {
+ return new Focus(this.row, this.column, offset);
+ }
+}
+focus.Focus = Focus;
+
+var alignment = {};
+
+Object.defineProperty(alignment, "__esModule", { value: true });
+alignment.HeaderAlignment = alignment.DefaultAlignment = alignment.Alignment = void 0;
+/**
+ * Represents column alignment.
+ *
+ * - `Alignment.NONE` - Use default alignment.
+ * - `Alignment.LEFT` - Align left.
+ * - `Alignment.RIGHT` - Align right.
+ * - `Alignment.CENTER` - Align center.
+ *
+ */
+var Alignment;
+(function (Alignment) {
+ Alignment["NONE"] = "none";
+ Alignment["LEFT"] = "left";
+ Alignment["RIGHT"] = "right";
+ Alignment["CENTER"] = "center";
+})(Alignment || (alignment.Alignment = Alignment = {}));
+/**
+ * Represents default column alignment
+ *
+ * - `DefaultAlignment.LEFT` - Align left.
+ * - `DefaultAlignment.RIGHT` - Align right.
+ * - `DefaultAlignment.CENTER` - Align center.
+ *
+ */
+var DefaultAlignment;
+(function (DefaultAlignment) {
+ DefaultAlignment["LEFT"] = "left";
+ DefaultAlignment["RIGHT"] = "right";
+ DefaultAlignment["CENTER"] = "center";
+})(DefaultAlignment || (alignment.DefaultAlignment = DefaultAlignment = {}));
+/**
+ * Represents alignment of header cells.
+ *
+ * - `HeaderAlignment.FOLLOW` - Follow column's alignment.
+ * - `HeaderAlignment.LEFT` - Align left.
+ * - `HeaderAlignment.RIGHT` - Align right.
+ * - `HeaderAlignment.CENTER` - Align center.
+ *
+ */
+var HeaderAlignment;
+(function (HeaderAlignment) {
+ HeaderAlignment["FOLLOW"] = "follow";
+ HeaderAlignment["LEFT"] = "left";
+ HeaderAlignment["RIGHT"] = "right";
+ HeaderAlignment["CENTER"] = "center";
+})(HeaderAlignment || (alignment.HeaderAlignment = HeaderAlignment = {}));
+
+var tableCell = {};
+
+Object.defineProperty(tableCell, "__esModule", { value: true });
+tableCell.TableCell = void 0;
+const alignment_1 = alignment;
+/**
+ * A `TableCell` object represents a table cell.
+ *
+ * @private
+ */
+class TableCell {
+ /**
+ * Creates a new `TableCell` object.
+ *
+ * @param rawContent - Raw content of the cell.
+ */
+ constructor(rawContent) {
+ this.rawContent = rawContent;
+ this.content = rawContent.trim();
+ this.paddingLeft =
+ this.content === ''
+ ? this.rawContent === ''
+ ? 0
+ : 1
+ : this.rawContent.length - this.rawContent.trimLeft().length;
+ this.paddingRight =
+ this.rawContent.length - this.content.length - this.paddingLeft;
+ }
+ /**
+ * Convers the cell to a text representation.
+ *
+ * @returns The raw content of the cell.
+ */
+ toText() {
+ return this.rawContent;
+ }
+ /**
+ * Checks if the cell is a delimiter i.e. it only contains hyphens `-` with optional one
+ * leading and trailing colons `:`.
+ *
+ * @returns `true` if the cell is a delimiter.
+ */
+ isDelimiter() {
+ return /^\s*:?-+:?\s*$/.test(this.rawContent);
+ }
+ /**
+ * Returns the alignment the cell represents.
+ *
+ * @returns The alignment the cell represents; `undefined` if the cell is not a delimiter.
+ */
+ getAlignment() {
+ if (!this.isDelimiter()) {
+ return undefined;
+ }
+ if (this.content[0] === ':') {
+ if (this.content[this.content.length - 1] === ':') {
+ return alignment_1.Alignment.CENTER;
+ }
+ return alignment_1.Alignment.LEFT;
+ }
+ if (this.content[this.content.length - 1] === ':') {
+ return alignment_1.Alignment.RIGHT;
+ }
+ return alignment_1.Alignment.NONE;
+ }
+ /**
+ * Computes a relative position in the trimmed content from that in the raw content.
+ *
+ * @param rawOffset - Relative position in the raw content.
+ * @returns - Relative position in the trimmed content.
+ */
+ computeContentOffset(rawOffset) {
+ if (this.content === '') {
+ return 0;
+ }
+ if (rawOffset < this.paddingLeft) {
+ return 0;
+ }
+ if (rawOffset < this.paddingLeft + this.content.length) {
+ return rawOffset - this.paddingLeft;
+ }
+ return this.content.length;
+ }
+ /**
+ * Computes a relative position in the raw content from that in the trimmed content.
+ *
+ * @param contentOffset - Relative position in the trimmed content.
+ * @returns - Relative position in the raw content.
+ */
+ computeRawOffset(contentOffset) {
+ return contentOffset + this.paddingLeft;
+ }
+}
+tableCell.TableCell = TableCell;
+
+var tableRow = {};
+
+Object.defineProperty(tableRow, "__esModule", { value: true });
+tableRow.TableRow = void 0;
+const table_cell_1 = tableCell;
+/**
+ * A `TableRow` object represents a table row.
+ *
+ * @private
+ */
+class TableRow {
+ /**
+ * Creates a new `TableRow` objec.
+ *
+ * @param cells - Cells that the row contains.
+ * @param marginLeft - Margin string at the left of the row.
+ * @param marginRight - Margin string at the right of the row.
+ */
+ constructor(cells, marginLeft, marginRight) {
+ this._cells = cells.slice();
+ this.marginLeft = marginLeft;
+ this.marginRight = marginRight;
+ }
+ /**
+ * Gets the number of the cells in the row.
+ */
+ getWidth() {
+ return this._cells.length;
+ }
+ /**
+ * Returns the cells that the row contains.
+ */
+ getCells() {
+ return this._cells.slice();
+ }
+ /**
+ * Gets a cell at the specified index.
+ *
+ * @param index - Index.
+ * @returns The cell at the specified index if exists; `undefined` if no cell is found.
+ */
+ getCellAt(index) {
+ return this._cells[index];
+ }
+ /**
+ * Sets a cell in the row to a new value, returning a copy of the row
+ * with the modified value.
+ *
+ * If an invalid index is provided, the row will be unchanged.
+ */
+ setCellAt(index, value) {
+ const cells = this.getCells(); // a copy
+ cells[index] = new table_cell_1.TableCell(value);
+ return new TableRow(cells, this.marginLeft, this.marginRight);
+ }
+ /**
+ * Convers the row to a text representation.
+ */
+ toText() {
+ if (this._cells.length === 0) {
+ return this.marginLeft;
+ }
+ const cells = this._cells.map((cell) => cell.toText()).join('|');
+ return `${this.marginLeft}|${cells}|${this.marginRight}`;
+ }
+ /**
+ * Checks if the row is a delimiter or not.
+ *
+ * @returns `true` if the row is a delimiter i.e. all the cells contained are delimiters.
+ */
+ isDelimiter() {
+ return this._cells.every((cell) => cell.isDelimiter());
+ }
+}
+tableRow.TableRow = TableRow;
+
+var table = {};
+
+var calc = {};
+
+var neverthrow = {};
+
+(function (exports) {
+ /**
+ * Retrieved from
+ * https://github.com/supermacro/neverthrow
+ *
+ * MIT License
+ * Copyright (c) 2019 Giorgio Delgado
+ */
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.Err = exports.Ok = exports.err = exports.ok = void 0;
+ const ok = (value) => new Ok(value);
+ exports.ok = ok;
+ const err = (err) => new Err(err);
+ exports.err = err;
+ class Ok {
+ constructor(value) {
+ this.value = value;
+ this.match = (ok, _err) => ok(this.value);
+ }
+ isOk() {
+ return true;
+ }
+ isErr() {
+ return !this.isOk();
+ }
+ map(f) {
+ return (0, exports.ok)(f(this.value));
+ }
+ mapErr(_f) {
+ return (0, exports.ok)(this.value);
+ }
+ // add info on how this is really useful for converting a
+ // Result, E1>
+ // into a Result
+ andThen(f) {
+ return f(this.value);
+ }
+ unwrapOr(_v) {
+ return this.value;
+ }
+ _unsafeUnwrap() {
+ return this.value;
+ }
+ _unsafeUnwrapErr() {
+ throw new Error('Called `_unsafeUnwrapErr` on an Ok');
+ }
+ }
+ exports.Ok = Ok;
+ class Err {
+ constructor(error) {
+ this.error = error;
+ this.match = (_ok, err) => err(this.error);
+ }
+ isOk() {
+ return false;
+ }
+ isErr() {
+ return !this.isOk();
+ }
+ map(_f) {
+ return (0, exports.err)(this.error);
+ }
+ mapErr(f) {
+ return (0, exports.err)(f(this.error));
+ }
+ andThen(_f) {
+ return (0, exports.err)(this.error);
+ }
+ unwrapOr(v) {
+ return v;
+ }
+ _unsafeUnwrap() {
+ throw new Error('Called `_unsafeUnwrap` on an Err');
+ }
+ _unsafeUnwrapErr() {
+ return this.error;
+ }
+ }
+ exports.Err = Err;
+} (neverthrow));
+
+var algebraic_operation = {};
+
+var ast_utils = {};
+
+(function (exports) {
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.prettyPrintAST = exports.checkChildLength = exports.checkType = exports.errRelativeReferenceIndex = exports.errIndex0 = void 0;
+ exports.errIndex0 = new Error('Index 0 used to create a reference');
+ exports.errRelativeReferenceIndex = new Error('Can not use relative reference where absolute reference is required');
+ const checkType = (ast, ...expectedTypes) => {
+ if (expectedTypes.indexOf(ast.type) >= 0) {
+ return;
+ }
+ return new Error(`Formula element '${ast.text}' is a ${ast.type} but expected ` +
+ `one of ${expectedTypes} in this position.`);
+ };
+ exports.checkType = checkType;
+ const checkChildLength = (ast, len) => {
+ if (ast.children.length === len) {
+ return;
+ }
+ return new Error(`Formula element '${ast.text}' was expected to have ${len} ` +
+ `elements, but had ${ast.children.length}`);
+ };
+ exports.checkChildLength = checkChildLength;
+ const prettyPrintAST = (token, level = 0) => {
+ console.log(' '.repeat(level) +
+ `|-${token.type}${token.children.length === 0 ? '=' + token.text : ''}`);
+ if (token.children) {
+ token.children.forEach((c) => {
+ (0, exports.prettyPrintAST)(c, level + 1);
+ });
+ }
+ };
+ exports.prettyPrintAST = prettyPrintAST;
+} (ast_utils));
+
+var results = {};
+
+var decimal = {exports: {}};
+
+(function (module) {
+(function (globalScope) {
+
+
+ /*!
+ * decimal.js v10.4.3
+ * An arbitrary-precision Decimal type for JavaScript.
+ * https://github.com/MikeMcl/decimal.js
+ * Copyright (c) 2022 Michael Mclaughlin
+ * MIT Licence
+ */
+
+
+ // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
+
+
+ // The maximum exponent magnitude.
+ // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
+ var EXP_LIMIT = 9e15, // 0 to 9e15
+
+ // The limit on the value of `precision`, and on the value of the first argument to
+ // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
+ MAX_DIGITS = 1e9, // 0 to 1e9
+
+ // Base conversion alphabet.
+ NUMERALS = '0123456789abcdef',
+
+ // The natural logarithm of 10 (1025 digits).
+ LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
+
+ // Pi (1025 digits).
+ PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
+
+
+ // The initial configuration properties of the Decimal constructor.
+ DEFAULTS = {
+
+ // These values must be integers within the stated ranges (inclusive).
+ // Most of these values can be changed at run-time using the `Decimal.config` method.
+
+ // The maximum number of significant digits of the result of a calculation or base conversion.
+ // E.g. `Decimal.config({ precision: 20 });`
+ precision: 20, // 1 to MAX_DIGITS
+
+ // The rounding mode used when rounding to `precision`.
+ //
+ // ROUND_UP 0 Away from zero.
+ // ROUND_DOWN 1 Towards zero.
+ // ROUND_CEIL 2 Towards +Infinity.
+ // ROUND_FLOOR 3 Towards -Infinity.
+ // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
+ // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
+ // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
+ // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
+ // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
+ //
+ // E.g.
+ // `Decimal.rounding = 4;`
+ // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
+ rounding: 4, // 0 to 8
+
+ // The modulo mode used when calculating the modulus: a mod n.
+ // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
+ // The remainder (r) is calculated as: r = a - n * q.
+ //
+ // UP 0 The remainder is positive if the dividend is negative, else is negative.
+ // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
+ // FLOOR 3 The remainder has the same sign as the divisor (Python %).
+ // HALF_EVEN 6 The IEEE 754 remainder function.
+ // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
+ //
+ // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
+ // division (9) are commonly used for the modulus operation. The other rounding modes can also
+ // be used, but they may not give useful results.
+ modulo: 1, // 0 to 9
+
+ // The exponent value at and beneath which `toString` returns exponential notation.
+ // JavaScript numbers: -7
+ toExpNeg: -7, // 0 to -EXP_LIMIT
+
+ // The exponent value at and above which `toString` returns exponential notation.
+ // JavaScript numbers: 21
+ toExpPos: 21, // 0 to EXP_LIMIT
+
+ // The minimum exponent value, beneath which underflow to zero occurs.
+ // JavaScript numbers: -324 (5e-324)
+ minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
+
+ // The maximum exponent value, above which overflow to Infinity occurs.
+ // JavaScript numbers: 308 (1.7976931348623157e+308)
+ maxE: EXP_LIMIT, // 1 to EXP_LIMIT
+
+ // Whether to use cryptographically-secure random number generation, if available.
+ crypto: false // true/false
+ },
+
+
+ // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
+
+
+ Decimal, inexact, noConflict, quadrant,
+ external = true,
+
+ decimalError = '[DecimalError] ',
+ invalidArgument = decimalError + 'Invalid argument: ',
+ precisionLimitExceeded = decimalError + 'Precision limit exceeded',
+ cryptoUnavailable = decimalError + 'crypto unavailable',
+ tag = '[object Decimal]',
+
+ mathfloor = Math.floor,
+ mathpow = Math.pow,
+
+ isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
+ isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
+ isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
+ isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
+
+ BASE = 1e7,
+ LOG_BASE = 7,
+ MAX_SAFE_INTEGER = 9007199254740991,
+
+ LN10_PRECISION = LN10.length - 1,
+ PI_PRECISION = PI.length - 1,
+
+ // Decimal.prototype object
+ P = { toStringTag: tag };
+
+
+ // Decimal prototype methods
+
+
+ /*
+ * absoluteValue abs
+ * ceil
+ * clampedTo clamp
+ * comparedTo cmp
+ * cosine cos
+ * cubeRoot cbrt
+ * decimalPlaces dp
+ * dividedBy div
+ * dividedToIntegerBy divToInt
+ * equals eq
+ * floor
+ * greaterThan gt
+ * greaterThanOrEqualTo gte
+ * hyperbolicCosine cosh
+ * hyperbolicSine sinh
+ * hyperbolicTangent tanh
+ * inverseCosine acos
+ * inverseHyperbolicCosine acosh
+ * inverseHyperbolicSine asinh
+ * inverseHyperbolicTangent atanh
+ * inverseSine asin
+ * inverseTangent atan
+ * isFinite
+ * isInteger isInt
+ * isNaN
+ * isNegative isNeg
+ * isPositive isPos
+ * isZero
+ * lessThan lt
+ * lessThanOrEqualTo lte
+ * logarithm log
+ * [maximum] [max]
+ * [minimum] [min]
+ * minus sub
+ * modulo mod
+ * naturalExponential exp
+ * naturalLogarithm ln
+ * negated neg
+ * plus add
+ * precision sd
+ * round
+ * sine sin
+ * squareRoot sqrt
+ * tangent tan
+ * times mul
+ * toBinary
+ * toDecimalPlaces toDP
+ * toExponential
+ * toFixed
+ * toFraction
+ * toHexadecimal toHex
+ * toNearest
+ * toNumber
+ * toOctal
+ * toPower pow
+ * toPrecision
+ * toSignificantDigits toSD
+ * toString
+ * truncated trunc
+ * valueOf toJSON
+ */
+
+
+ /*
+ * Return a new Decimal whose value is the absolute value of this Decimal.
+ *
+ */
+ P.absoluteValue = P.abs = function () {
+ var x = new this.constructor(this);
+ if (x.s < 0) x.s = 1;
+ return finalise(x);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
+ * direction of positive Infinity.
+ *
+ */
+ P.ceil = function () {
+ return finalise(new this.constructor(this), this.e + 1, 2);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal clamped to the range
+ * delineated by `min` and `max`.
+ *
+ * min {number|string|Decimal}
+ * max {number|string|Decimal}
+ *
+ */
+ P.clampedTo = P.clamp = function (min, max) {
+ var k,
+ x = this,
+ Ctor = x.constructor;
+ min = new Ctor(min);
+ max = new Ctor(max);
+ if (!min.s || !max.s) return new Ctor(NaN);
+ if (min.gt(max)) throw Error(invalidArgument + max);
+ k = x.cmp(min);
+ return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x);
+ };
+
+
+ /*
+ * Return
+ * 1 if the value of this Decimal is greater than the value of `y`,
+ * -1 if the value of this Decimal is less than the value of `y`,
+ * 0 if they have the same value,
+ * NaN if the value of either Decimal is NaN.
+ *
+ */
+ P.comparedTo = P.cmp = function (y) {
+ var i, j, xdL, ydL,
+ x = this,
+ xd = x.d,
+ yd = (y = new x.constructor(y)).d,
+ xs = x.s,
+ ys = y.s;
+
+ // Either NaN or ±Infinity?
+ if (!xd || !yd) {
+ return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
+ }
+
+ // Either zero?
+ if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
+
+ // Signs differ?
+ if (xs !== ys) return xs;
+
+ // Compare exponents.
+ if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
+
+ xdL = xd.length;
+ ydL = yd.length;
+
+ // Compare digit by digit.
+ for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
+ if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
+ }
+
+ // Compare lengths.
+ return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-1, 1]
+ *
+ * cos(0) = 1
+ * cos(-0) = 1
+ * cos(Infinity) = NaN
+ * cos(-Infinity) = NaN
+ * cos(NaN) = NaN
+ *
+ */
+ P.cosine = P.cos = function () {
+ var pr, rm,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.d) return new Ctor(NaN);
+
+ // cos(0) = cos(-0) = 1
+ if (!x.d[0]) return new Ctor(1);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
+ Ctor.rounding = 1;
+
+ x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
+
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
+ };
+
+
+ /*
+ *
+ * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
+ * `precision` significant digits using rounding mode `rounding`.
+ *
+ * cbrt(0) = 0
+ * cbrt(-0) = -0
+ * cbrt(1) = 1
+ * cbrt(-1) = -1
+ * cbrt(N) = N
+ * cbrt(-I) = -I
+ * cbrt(I) = I
+ *
+ * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
+ *
+ */
+ P.cubeRoot = P.cbrt = function () {
+ var e, m, n, r, rep, s, sd, t, t3, t3plusx,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.isFinite() || x.isZero()) return new Ctor(x);
+ external = false;
+
+ // Initial estimate.
+ s = x.s * mathpow(x.s * x, 1 / 3);
+
+ // Math.cbrt underflow/overflow?
+ // Pass x to Math.pow as integer, then adjust the exponent of the result.
+ if (!s || Math.abs(s) == 1 / 0) {
+ n = digitsToString(x.d);
+ e = x.e;
+
+ // Adjust n exponent so it is a multiple of 3 away from x exponent.
+ if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');
+ s = mathpow(n, 1 / 3);
+
+ // Rarely, e may be one less than the result exponent value.
+ e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
+
+ if (s == 1 / 0) {
+ n = '5e' + e;
+ } else {
+ n = s.toExponential();
+ n = n.slice(0, n.indexOf('e') + 1) + e;
+ }
+
+ r = new Ctor(n);
+ r.s = x.s;
+ } else {
+ r = new Ctor(s.toString());
+ }
+
+ sd = (e = Ctor.precision) + 3;
+
+ // Halley's method.
+ // TODO? Compare Newton's method.
+ for (;;) {
+ t = r;
+ t3 = t.times(t).times(t);
+ t3plusx = t3.plus(x);
+ r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
+
+ // TODO? Replace with for-loop and checkRoundingDigits.
+ if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
+ n = n.slice(sd - 3, sd + 1);
+
+ // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
+ // , i.e. approaching a rounding boundary, continue the iteration.
+ if (n == '9999' || !rep && n == '4999') {
+
+ // On the first iteration only, check to see if rounding up gives the exact result as the
+ // nines may infinitely repeat.
+ if (!rep) {
+ finalise(t, e + 1, 0);
+
+ if (t.times(t).times(t).eq(x)) {
+ r = t;
+ break;
+ }
+ }
+
+ sd += 4;
+ rep = 1;
+ } else {
+
+ // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
+ // If not, then there are further digits and m will be truthy.
+ if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
+
+ // Truncate to the first rounding digit.
+ finalise(r, e + 1, 1);
+ m = !r.times(r).times(r).eq(x);
+ }
+
+ break;
+ }
+ }
+ }
+
+ external = true;
+
+ return finalise(r, e, Ctor.rounding, m);
+ };
+
+
+ /*
+ * Return the number of decimal places of the value of this Decimal.
+ *
+ */
+ P.decimalPlaces = P.dp = function () {
+ var w,
+ d = this.d,
+ n = NaN;
+
+ if (d) {
+ w = d.length - 1;
+ n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
+
+ // Subtract the number of trailing zeros of the last word.
+ w = d[w];
+ if (w) for (; w % 10 == 0; w /= 10) n--;
+ if (n < 0) n = 0;
+ }
+
+ return n;
+ };
+
+
+ /*
+ * n / 0 = I
+ * n / N = N
+ * n / I = 0
+ * 0 / n = 0
+ * 0 / 0 = N
+ * 0 / N = N
+ * 0 / I = 0
+ * N / n = N
+ * N / 0 = N
+ * N / N = N
+ * N / I = N
+ * I / n = I
+ * I / 0 = I
+ * I / N = N
+ * I / I = N
+ *
+ * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
+ * `precision` significant digits using rounding mode `rounding`.
+ *
+ */
+ P.dividedBy = P.div = function (y) {
+ return divide(this, new this.constructor(y));
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
+ * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
+ *
+ */
+ P.dividedToIntegerBy = P.divToInt = function (y) {
+ var x = this,
+ Ctor = x.constructor;
+ return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
+ *
+ */
+ P.equals = P.eq = function (y) {
+ return this.cmp(y) === 0;
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
+ * direction of negative Infinity.
+ *
+ */
+ P.floor = function () {
+ return finalise(new this.constructor(this), this.e + 1, 3);
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
+ * false.
+ *
+ */
+ P.greaterThan = P.gt = function (y) {
+ return this.cmp(y) > 0;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is greater than or equal to the value of `y`,
+ * otherwise return false.
+ *
+ */
+ P.greaterThanOrEqualTo = P.gte = function (y) {
+ var k = this.cmp(y);
+ return k == 1 || k === 0;
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
+ * Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [1, Infinity]
+ *
+ * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
+ *
+ * cosh(0) = 1
+ * cosh(-0) = 1
+ * cosh(Infinity) = Infinity
+ * cosh(-Infinity) = Infinity
+ * cosh(NaN) = NaN
+ *
+ * x time taken (ms) result
+ * 1000 9 9.8503555700852349694e+433
+ * 10000 25 4.4034091128314607936e+4342
+ * 100000 171 1.4033316802130615897e+43429
+ * 1000000 3817 1.5166076984010437725e+434294
+ * 10000000 abandoned after 2 minute wait
+ *
+ * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
+ *
+ */
+ P.hyperbolicCosine = P.cosh = function () {
+ var k, n, pr, rm, len,
+ x = this,
+ Ctor = x.constructor,
+ one = new Ctor(1);
+
+ if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
+ if (x.isZero()) return one;
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
+ Ctor.rounding = 1;
+ len = x.d.length;
+
+ // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
+ // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
+
+ // Estimate the optimum number of times to use the argument reduction.
+ // TODO? Estimation reused from cosine() and may not be optimal here.
+ if (len < 32) {
+ k = Math.ceil(len / 3);
+ n = (1 / tinyPow(4, k)).toString();
+ } else {
+ k = 16;
+ n = '2.3283064365386962890625e-10';
+ }
+
+ x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
+
+ // Reverse argument reduction
+ var cosh2_x,
+ i = k,
+ d8 = new Ctor(8);
+ for (; i--;) {
+ cosh2_x = x.times(x);
+ x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
+ }
+
+ return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
+ * Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-Infinity, Infinity]
+ *
+ * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
+ *
+ * sinh(0) = 0
+ * sinh(-0) = -0
+ * sinh(Infinity) = Infinity
+ * sinh(-Infinity) = -Infinity
+ * sinh(NaN) = NaN
+ *
+ * x time taken (ms)
+ * 10 2 ms
+ * 100 5 ms
+ * 1000 14 ms
+ * 10000 82 ms
+ * 100000 886 ms 1.4033316802130615897e+43429
+ * 200000 2613 ms
+ * 300000 5407 ms
+ * 400000 8824 ms
+ * 500000 13026 ms 8.7080643612718084129e+217146
+ * 1000000 48543 ms
+ *
+ * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
+ *
+ */
+ P.hyperbolicSine = P.sinh = function () {
+ var k, pr, rm, len,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.isFinite() || x.isZero()) return new Ctor(x);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
+ Ctor.rounding = 1;
+ len = x.d.length;
+
+ if (len < 3) {
+ x = taylorSeries(Ctor, 2, x, x, true);
+ } else {
+
+ // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
+ // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
+ // 3 multiplications and 1 addition
+
+ // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
+ // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
+ // 4 multiplications and 2 additions
+
+ // Estimate the optimum number of times to use the argument reduction.
+ k = 1.4 * Math.sqrt(len);
+ k = k > 16 ? 16 : k | 0;
+
+ x = x.times(1 / tinyPow(5, k));
+ x = taylorSeries(Ctor, 2, x, x, true);
+
+ // Reverse argument reduction
+ var sinh2_x,
+ d5 = new Ctor(5),
+ d16 = new Ctor(16),
+ d20 = new Ctor(20);
+ for (; k--;) {
+ sinh2_x = x.times(x);
+ x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
+ }
+ }
+
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return finalise(x, pr, rm, true);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
+ * Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-1, 1]
+ *
+ * tanh(x) = sinh(x) / cosh(x)
+ *
+ * tanh(0) = 0
+ * tanh(-0) = -0
+ * tanh(Infinity) = 1
+ * tanh(-Infinity) = -1
+ * tanh(NaN) = NaN
+ *
+ */
+ P.hyperbolicTangent = P.tanh = function () {
+ var pr, rm,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.isFinite()) return new Ctor(x.s);
+ if (x.isZero()) return new Ctor(x);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + 7;
+ Ctor.rounding = 1;
+
+ return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
+ * this Decimal.
+ *
+ * Domain: [-1, 1]
+ * Range: [0, pi]
+ *
+ * acos(x) = pi/2 - asin(x)
+ *
+ * acos(0) = pi/2
+ * acos(-0) = pi/2
+ * acos(1) = 0
+ * acos(-1) = pi
+ * acos(1/2) = pi/3
+ * acos(-1/2) = 2*pi/3
+ * acos(|x| > 1) = NaN
+ * acos(NaN) = NaN
+ *
+ */
+ P.inverseCosine = P.acos = function () {
+ var halfPi,
+ x = this,
+ Ctor = x.constructor,
+ k = x.abs().cmp(1),
+ pr = Ctor.precision,
+ rm = Ctor.rounding;
+
+ if (k !== -1) {
+ return k === 0
+ // |x| is 1
+ ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
+ // |x| > 1 or x is NaN
+ : new Ctor(NaN);
+ }
+
+ if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
+
+ // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
+
+ Ctor.precision = pr + 6;
+ Ctor.rounding = 1;
+
+ x = x.asin();
+ halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
+
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return halfPi.minus(x);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
+ * value of this Decimal.
+ *
+ * Domain: [1, Infinity]
+ * Range: [0, Infinity]
+ *
+ * acosh(x) = ln(x + sqrt(x^2 - 1))
+ *
+ * acosh(x < 1) = NaN
+ * acosh(NaN) = NaN
+ * acosh(Infinity) = Infinity
+ * acosh(-Infinity) = NaN
+ * acosh(0) = NaN
+ * acosh(-0) = NaN
+ * acosh(1) = 0
+ * acosh(-1) = NaN
+ *
+ */
+ P.inverseHyperbolicCosine = P.acosh = function () {
+ var pr, rm,
+ x = this,
+ Ctor = x.constructor;
+
+ if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
+ if (!x.isFinite()) return new Ctor(x);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
+ Ctor.rounding = 1;
+ external = false;
+
+ x = x.times(x).minus(1).sqrt().plus(x);
+
+ external = true;
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return x.ln();
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
+ * of this Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-Infinity, Infinity]
+ *
+ * asinh(x) = ln(x + sqrt(x^2 + 1))
+ *
+ * asinh(NaN) = NaN
+ * asinh(Infinity) = Infinity
+ * asinh(-Infinity) = -Infinity
+ * asinh(0) = 0
+ * asinh(-0) = -0
+ *
+ */
+ P.inverseHyperbolicSine = P.asinh = function () {
+ var pr, rm,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.isFinite() || x.isZero()) return new Ctor(x);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
+ Ctor.rounding = 1;
+ external = false;
+
+ x = x.times(x).plus(1).sqrt().plus(x);
+
+ external = true;
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return x.ln();
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
+ * value of this Decimal.
+ *
+ * Domain: [-1, 1]
+ * Range: [-Infinity, Infinity]
+ *
+ * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
+ *
+ * atanh(|x| > 1) = NaN
+ * atanh(NaN) = NaN
+ * atanh(Infinity) = NaN
+ * atanh(-Infinity) = NaN
+ * atanh(0) = 0
+ * atanh(-0) = -0
+ * atanh(1) = Infinity
+ * atanh(-1) = -Infinity
+ *
+ */
+ P.inverseHyperbolicTangent = P.atanh = function () {
+ var pr, rm, wpr, xsd,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.isFinite()) return new Ctor(NaN);
+ if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ xsd = x.sd();
+
+ if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
+
+ Ctor.precision = wpr = xsd - x.e;
+
+ x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
+
+ Ctor.precision = pr + 4;
+ Ctor.rounding = 1;
+
+ x = x.ln();
+
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return x.times(0.5);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
+ * Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-pi/2, pi/2]
+ *
+ * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
+ *
+ * asin(0) = 0
+ * asin(-0) = -0
+ * asin(1/2) = pi/6
+ * asin(-1/2) = -pi/6
+ * asin(1) = pi/2
+ * asin(-1) = -pi/2
+ * asin(|x| > 1) = NaN
+ * asin(NaN) = NaN
+ *
+ * TODO? Compare performance of Taylor series.
+ *
+ */
+ P.inverseSine = P.asin = function () {
+ var halfPi, k,
+ pr, rm,
+ x = this,
+ Ctor = x.constructor;
+
+ if (x.isZero()) return new Ctor(x);
+
+ k = x.abs().cmp(1);
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+
+ if (k !== -1) {
+
+ // |x| is 1
+ if (k === 0) {
+ halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
+ halfPi.s = x.s;
+ return halfPi;
+ }
+
+ // |x| > 1 or x is NaN
+ return new Ctor(NaN);
+ }
+
+ // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
+
+ Ctor.precision = pr + 6;
+ Ctor.rounding = 1;
+
+ x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
+
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return x.times(2);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
+ * of this Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-pi/2, pi/2]
+ *
+ * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
+ *
+ * atan(0) = 0
+ * atan(-0) = -0
+ * atan(1) = pi/4
+ * atan(-1) = -pi/4
+ * atan(Infinity) = pi/2
+ * atan(-Infinity) = -pi/2
+ * atan(NaN) = NaN
+ *
+ */
+ P.inverseTangent = P.atan = function () {
+ var i, j, k, n, px, t, r, wpr, x2,
+ x = this,
+ Ctor = x.constructor,
+ pr = Ctor.precision,
+ rm = Ctor.rounding;
+
+ if (!x.isFinite()) {
+ if (!x.s) return new Ctor(NaN);
+ if (pr + 4 <= PI_PRECISION) {
+ r = getPi(Ctor, pr + 4, rm).times(0.5);
+ r.s = x.s;
+ return r;
+ }
+ } else if (x.isZero()) {
+ return new Ctor(x);
+ } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
+ r = getPi(Ctor, pr + 4, rm).times(0.25);
+ r.s = x.s;
+ return r;
+ }
+
+ Ctor.precision = wpr = pr + 10;
+ Ctor.rounding = 1;
+
+ // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
+
+ // Argument reduction
+ // Ensure |x| < 0.42
+ // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
+
+ k = Math.min(28, wpr / LOG_BASE + 2 | 0);
+
+ for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));
+
+ external = false;
+
+ j = Math.ceil(wpr / LOG_BASE);
+ n = 1;
+ x2 = x.times(x);
+ r = new Ctor(x);
+ px = x;
+
+ // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
+ for (; i !== -1;) {
+ px = px.times(x2);
+ t = r.minus(px.div(n += 2));
+
+ px = px.times(x2);
+ r = t.plus(px.div(n += 2));
+
+ if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);
+ }
+
+ if (k) r = r.times(2 << (k - 1));
+
+ external = true;
+
+ return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is a finite number, otherwise return false.
+ *
+ */
+ P.isFinite = function () {
+ return !!this.d;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is an integer, otherwise return false.
+ *
+ */
+ P.isInteger = P.isInt = function () {
+ return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is NaN, otherwise return false.
+ *
+ */
+ P.isNaN = function () {
+ return !this.s;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is negative, otherwise return false.
+ *
+ */
+ P.isNegative = P.isNeg = function () {
+ return this.s < 0;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is positive, otherwise return false.
+ *
+ */
+ P.isPositive = P.isPos = function () {
+ return this.s > 0;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is 0 or -0, otherwise return false.
+ *
+ */
+ P.isZero = function () {
+ return !!this.d && this.d[0] === 0;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is less than `y`, otherwise return false.
+ *
+ */
+ P.lessThan = P.lt = function (y) {
+ return this.cmp(y) < 0;
+ };
+
+
+ /*
+ * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
+ *
+ */
+ P.lessThanOrEqualTo = P.lte = function (y) {
+ return this.cmp(y) < 1;
+ };
+
+
+ /*
+ * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * If no base is specified, return log[10](arg).
+ *
+ * log[base](arg) = ln(arg) / ln(base)
+ *
+ * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
+ * otherwise:
+ *
+ * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
+ * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
+ * between the result and the correctly rounded result will be one ulp (unit in the last place).
+ *
+ * log[-b](a) = NaN
+ * log[0](a) = NaN
+ * log[1](a) = NaN
+ * log[NaN](a) = NaN
+ * log[Infinity](a) = NaN
+ * log[b](0) = -Infinity
+ * log[b](-0) = -Infinity
+ * log[b](-a) = NaN
+ * log[b](1) = 0
+ * log[b](Infinity) = Infinity
+ * log[b](NaN) = NaN
+ *
+ * [base] {number|string|Decimal} The base of the logarithm.
+ *
+ */
+ P.logarithm = P.log = function (base) {
+ var isBase10, d, denominator, k, inf, num, sd, r,
+ arg = this,
+ Ctor = arg.constructor,
+ pr = Ctor.precision,
+ rm = Ctor.rounding,
+ guard = 5;
+
+ // Default base is 10.
+ if (base == null) {
+ base = new Ctor(10);
+ isBase10 = true;
+ } else {
+ base = new Ctor(base);
+ d = base.d;
+
+ // Return NaN if base is negative, or non-finite, or is 0 or 1.
+ if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
+
+ isBase10 = base.eq(10);
+ }
+
+ d = arg.d;
+
+ // Is arg negative, non-finite, 0 or 1?
+ if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
+ return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
+ }
+
+ // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
+ // integer power of 10.
+ if (isBase10) {
+ if (d.length > 1) {
+ inf = true;
+ } else {
+ for (k = d[0]; k % 10 === 0;) k /= 10;
+ inf = k !== 1;
+ }
+ }
+
+ external = false;
+ sd = pr + guard;
+ num = naturalLogarithm(arg, sd);
+ denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
+
+ // The result will have 5 rounding digits.
+ r = divide(num, denominator, sd, 1);
+
+ // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
+ // calculate 10 further digits.
+ //
+ // If the result is known to have an infinite decimal expansion, repeat this until it is clear
+ // that the result is above or below the boundary. Otherwise, if after calculating the 10
+ // further digits, the last 14 are nines, round up and assume the result is exact.
+ // Also assume the result is exact if the last 14 are zero.
+ //
+ // Example of a result that will be incorrectly rounded:
+ // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
+ // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
+ // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
+ // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
+ // place is still 2.6.
+ if (checkRoundingDigits(r.d, k = pr, rm)) {
+
+ do {
+ sd += 10;
+ num = naturalLogarithm(arg, sd);
+ denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
+ r = divide(num, denominator, sd, 1);
+
+ if (!inf) {
+
+ // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
+ if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
+ r = finalise(r, pr + 1, 0);
+ }
+
+ break;
+ }
+ } while (checkRoundingDigits(r.d, k += 10, rm));
+ }
+
+ external = true;
+
+ return finalise(r, pr, rm);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
+ *
+ * arguments {number|string|Decimal}
+ *
+ P.max = function () {
+ Array.prototype.push.call(arguments, this);
+ return maxOrMin(this.constructor, arguments, 'lt');
+ };
+ */
+
+
+ /*
+ * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
+ *
+ * arguments {number|string|Decimal}
+ *
+ P.min = function () {
+ Array.prototype.push.call(arguments, this);
+ return maxOrMin(this.constructor, arguments, 'gt');
+ };
+ */
+
+
+ /*
+ * n - 0 = n
+ * n - N = N
+ * n - I = -I
+ * 0 - n = -n
+ * 0 - 0 = 0
+ * 0 - N = N
+ * 0 - I = -I
+ * N - n = N
+ * N - 0 = N
+ * N - N = N
+ * N - I = N
+ * I - n = I
+ * I - 0 = I
+ * I - N = N
+ * I - I = N
+ *
+ * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ */
+ P.minus = P.sub = function (y) {
+ var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,
+ x = this,
+ Ctor = x.constructor;
+
+ y = new Ctor(y);
+
+ // If either is not finite...
+ if (!x.d || !y.d) {
+
+ // Return NaN if either is NaN.
+ if (!x.s || !y.s) y = new Ctor(NaN);
+
+ // Return y negated if x is finite and y is ±Infinity.
+ else if (x.d) y.s = -y.s;
+
+ // Return x if y is finite and x is ±Infinity.
+ // Return x if both are ±Infinity with different signs.
+ // Return NaN if both are ±Infinity with the same sign.
+ else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
+
+ return y;
+ }
+
+ // If signs differ...
+ if (x.s != y.s) {
+ y.s = -y.s;
+ return x.plus(y);
+ }
+
+ xd = x.d;
+ yd = y.d;
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+
+ // If either is zero...
+ if (!xd[0] || !yd[0]) {
+
+ // Return y negated if x is zero and y is non-zero.
+ if (yd[0]) y.s = -y.s;
+
+ // Return x if y is zero and x is non-zero.
+ else if (xd[0]) y = new Ctor(x);
+
+ // Return zero if both are zero.
+ // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
+ else return new Ctor(rm === 3 ? -0 : 0);
+
+ return external ? finalise(y, pr, rm) : y;
+ }
+
+ // x and y are finite, non-zero numbers with the same sign.
+
+ // Calculate base 1e7 exponents.
+ e = mathfloor(y.e / LOG_BASE);
+ xe = mathfloor(x.e / LOG_BASE);
+
+ xd = xd.slice();
+ k = xe - e;
+
+ // If base 1e7 exponents differ...
+ if (k) {
+ xLTy = k < 0;
+
+ if (xLTy) {
+ d = xd;
+ k = -k;
+ len = yd.length;
+ } else {
+ d = yd;
+ e = xe;
+ len = xd.length;
+ }
+
+ // Numbers with massively different exponents would result in a very high number of
+ // zeros needing to be prepended, but this can be avoided while still ensuring correct
+ // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
+ i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
+
+ if (k > i) {
+ k = i;
+ d.length = 1;
+ }
+
+ // Prepend zeros to equalise exponents.
+ d.reverse();
+ for (i = k; i--;) d.push(0);
+ d.reverse();
+
+ // Base 1e7 exponents equal.
+ } else {
+
+ // Check digits to determine which is the bigger number.
+
+ i = xd.length;
+ len = yd.length;
+ xLTy = i < len;
+ if (xLTy) len = i;
+
+ for (i = 0; i < len; i++) {
+ if (xd[i] != yd[i]) {
+ xLTy = xd[i] < yd[i];
+ break;
+ }
+ }
+
+ k = 0;
+ }
+
+ if (xLTy) {
+ d = xd;
+ xd = yd;
+ yd = d;
+ y.s = -y.s;
+ }
+
+ len = xd.length;
+
+ // Append zeros to `xd` if shorter.
+ // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
+ for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
+
+ // Subtract yd from xd.
+ for (i = yd.length; i > k;) {
+
+ if (xd[--i] < yd[i]) {
+ for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;
+ --xd[j];
+ xd[i] += BASE;
+ }
+
+ xd[i] -= yd[i];
+ }
+
+ // Remove trailing zeros.
+ for (; xd[--len] === 0;) xd.pop();
+
+ // Remove leading zeros and adjust exponent accordingly.
+ for (; xd[0] === 0; xd.shift()) --e;
+
+ // Zero?
+ if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
+
+ y.d = xd;
+ y.e = getBase10Exponent(xd, e);
+
+ return external ? finalise(y, pr, rm) : y;
+ };
+
+
+ /*
+ * n % 0 = N
+ * n % N = N
+ * n % I = n
+ * 0 % n = 0
+ * -0 % n = -0
+ * 0 % 0 = N
+ * 0 % N = N
+ * 0 % I = 0
+ * N % n = N
+ * N % 0 = N
+ * N % N = N
+ * N % I = N
+ * I % n = N
+ * I % 0 = N
+ * I % N = N
+ * I % I = N
+ *
+ * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
+ * `precision` significant digits using rounding mode `rounding`.
+ *
+ * The result depends on the modulo mode.
+ *
+ */
+ P.modulo = P.mod = function (y) {
+ var q,
+ x = this,
+ Ctor = x.constructor;
+
+ y = new Ctor(y);
+
+ // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
+ if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
+
+ // Return x if y is ±Infinity or x is ±0.
+ if (!y.d || x.d && !x.d[0]) {
+ return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
+ }
+
+ // Prevent rounding of intermediate calculations.
+ external = false;
+
+ if (Ctor.modulo == 9) {
+
+ // Euclidian division: q = sign(y) * floor(x / abs(y))
+ // result = x - q * y where 0 <= result < abs(y)
+ q = divide(x, y.abs(), 0, 3, 1);
+ q.s *= y.s;
+ } else {
+ q = divide(x, y, 0, Ctor.modulo, 1);
+ }
+
+ q = q.times(y);
+
+ external = true;
+
+ return x.minus(q);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
+ * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ */
+ P.naturalExponential = P.exp = function () {
+ return naturalExponential(this);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
+ * rounded to `precision` significant digits using rounding mode `rounding`.
+ *
+ */
+ P.naturalLogarithm = P.ln = function () {
+ return naturalLogarithm(this);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
+ * -1.
+ *
+ */
+ P.negated = P.neg = function () {
+ var x = new this.constructor(this);
+ x.s = -x.s;
+ return finalise(x);
+ };
+
+
+ /*
+ * n + 0 = n
+ * n + N = N
+ * n + I = I
+ * 0 + n = n
+ * 0 + 0 = 0
+ * 0 + N = N
+ * 0 + I = I
+ * N + n = N
+ * N + 0 = N
+ * N + N = N
+ * N + I = N
+ * I + n = I
+ * I + 0 = I
+ * I + N = N
+ * I + I = I
+ *
+ * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ */
+ P.plus = P.add = function (y) {
+ var carry, d, e, i, k, len, pr, rm, xd, yd,
+ x = this,
+ Ctor = x.constructor;
+
+ y = new Ctor(y);
+
+ // If either is not finite...
+ if (!x.d || !y.d) {
+
+ // Return NaN if either is NaN.
+ if (!x.s || !y.s) y = new Ctor(NaN);
+
+ // Return x if y is finite and x is ±Infinity.
+ // Return x if both are ±Infinity with the same sign.
+ // Return NaN if both are ±Infinity with different signs.
+ // Return y if x is finite and y is ±Infinity.
+ else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
+
+ return y;
+ }
+
+ // If signs differ...
+ if (x.s != y.s) {
+ y.s = -y.s;
+ return x.minus(y);
+ }
+
+ xd = x.d;
+ yd = y.d;
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+
+ // If either is zero...
+ if (!xd[0] || !yd[0]) {
+
+ // Return x if y is zero.
+ // Return y if y is non-zero.
+ if (!yd[0]) y = new Ctor(x);
+
+ return external ? finalise(y, pr, rm) : y;
+ }
+
+ // x and y are finite, non-zero numbers with the same sign.
+
+ // Calculate base 1e7 exponents.
+ k = mathfloor(x.e / LOG_BASE);
+ e = mathfloor(y.e / LOG_BASE);
+
+ xd = xd.slice();
+ i = k - e;
+
+ // If base 1e7 exponents differ...
+ if (i) {
+
+ if (i < 0) {
+ d = xd;
+ i = -i;
+ len = yd.length;
+ } else {
+ d = yd;
+ e = k;
+ len = xd.length;
+ }
+
+ // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
+ k = Math.ceil(pr / LOG_BASE);
+ len = k > len ? k + 1 : len + 1;
+
+ if (i > len) {
+ i = len;
+ d.length = 1;
+ }
+
+ // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
+ d.reverse();
+ for (; i--;) d.push(0);
+ d.reverse();
+ }
+
+ len = xd.length;
+ i = yd.length;
+
+ // If yd is longer than xd, swap xd and yd so xd points to the longer array.
+ if (len - i < 0) {
+ i = len;
+ d = yd;
+ yd = xd;
+ xd = d;
+ }
+
+ // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
+ for (carry = 0; i;) {
+ carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
+ xd[i] %= BASE;
+ }
+
+ if (carry) {
+ xd.unshift(carry);
+ ++e;
+ }
+
+ // Remove trailing zeros.
+ // No need to check for zero, as +x + +y != 0 && -x + -y != 0
+ for (len = xd.length; xd[--len] == 0;) xd.pop();
+
+ y.d = xd;
+ y.e = getBase10Exponent(xd, e);
+
+ return external ? finalise(y, pr, rm) : y;
+ };
+
+
+ /*
+ * Return the number of significant digits of the value of this Decimal.
+ *
+ * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
+ *
+ */
+ P.precision = P.sd = function (z) {
+ var k,
+ x = this;
+
+ if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
+
+ if (x.d) {
+ k = getPrecision(x.d);
+ if (z && x.e + 1 > k) k = x.e + 1;
+ } else {
+ k = NaN;
+ }
+
+ return k;
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
+ * rounding mode `rounding`.
+ *
+ */
+ P.round = function () {
+ var x = this,
+ Ctor = x.constructor;
+
+ return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-1, 1]
+ *
+ * sin(x) = x - x^3/3! + x^5/5! - ...
+ *
+ * sin(0) = 0
+ * sin(-0) = -0
+ * sin(Infinity) = NaN
+ * sin(-Infinity) = NaN
+ * sin(NaN) = NaN
+ *
+ */
+ P.sine = P.sin = function () {
+ var pr, rm,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.isFinite()) return new Ctor(NaN);
+ if (x.isZero()) return new Ctor(x);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
+ Ctor.rounding = 1;
+
+ x = sine(Ctor, toLessThanHalfPi(Ctor, x));
+
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * sqrt(-n) = N
+ * sqrt(N) = N
+ * sqrt(-I) = N
+ * sqrt(I) = I
+ * sqrt(0) = 0
+ * sqrt(-0) = -0
+ *
+ */
+ P.squareRoot = P.sqrt = function () {
+ var m, n, sd, r, rep, t,
+ x = this,
+ d = x.d,
+ e = x.e,
+ s = x.s,
+ Ctor = x.constructor;
+
+ // Negative/NaN/Infinity/zero?
+ if (s !== 1 || !d || !d[0]) {
+ return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
+ }
+
+ external = false;
+
+ // Initial estimate.
+ s = Math.sqrt(+x);
+
+ // Math.sqrt underflow/overflow?
+ // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
+ if (s == 0 || s == 1 / 0) {
+ n = digitsToString(d);
+
+ if ((n.length + e) % 2 == 0) n += '0';
+ s = Math.sqrt(n);
+ e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
+
+ if (s == 1 / 0) {
+ n = '5e' + e;
+ } else {
+ n = s.toExponential();
+ n = n.slice(0, n.indexOf('e') + 1) + e;
+ }
+
+ r = new Ctor(n);
+ } else {
+ r = new Ctor(s.toString());
+ }
+
+ sd = (e = Ctor.precision) + 3;
+
+ // Newton-Raphson iteration.
+ for (;;) {
+ t = r;
+ r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
+
+ // TODO? Replace with for-loop and checkRoundingDigits.
+ if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
+ n = n.slice(sd - 3, sd + 1);
+
+ // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
+ // 4999, i.e. approaching a rounding boundary, continue the iteration.
+ if (n == '9999' || !rep && n == '4999') {
+
+ // On the first iteration only, check to see if rounding up gives the exact result as the
+ // nines may infinitely repeat.
+ if (!rep) {
+ finalise(t, e + 1, 0);
+
+ if (t.times(t).eq(x)) {
+ r = t;
+ break;
+ }
+ }
+
+ sd += 4;
+ rep = 1;
+ } else {
+
+ // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
+ // If not, then there are further digits and m will be truthy.
+ if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
+
+ // Truncate to the first rounding digit.
+ finalise(r, e + 1, 1);
+ m = !r.times(r).eq(x);
+ }
+
+ break;
+ }
+ }
+ }
+
+ external = true;
+
+ return finalise(r, e, Ctor.rounding, m);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-Infinity, Infinity]
+ *
+ * tan(0) = 0
+ * tan(-0) = -0
+ * tan(Infinity) = NaN
+ * tan(-Infinity) = NaN
+ * tan(NaN) = NaN
+ *
+ */
+ P.tangent = P.tan = function () {
+ var pr, rm,
+ x = this,
+ Ctor = x.constructor;
+
+ if (!x.isFinite()) return new Ctor(NaN);
+ if (x.isZero()) return new Ctor(x);
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+ Ctor.precision = pr + 10;
+ Ctor.rounding = 1;
+
+ x = x.sin();
+ x.s = 1;
+ x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
+
+ Ctor.precision = pr;
+ Ctor.rounding = rm;
+
+ return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
+ };
+
+
+ /*
+ * n * 0 = 0
+ * n * N = N
+ * n * I = I
+ * 0 * n = 0
+ * 0 * 0 = 0
+ * 0 * N = N
+ * 0 * I = N
+ * N * n = N
+ * N * 0 = N
+ * N * N = N
+ * N * I = N
+ * I * n = I
+ * I * 0 = N
+ * I * N = N
+ * I * I = I
+ *
+ * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ */
+ P.times = P.mul = function (y) {
+ var carry, e, i, k, r, rL, t, xdL, ydL,
+ x = this,
+ Ctor = x.constructor,
+ xd = x.d,
+ yd = (y = new Ctor(y)).d;
+
+ y.s *= x.s;
+
+ // If either is NaN, ±Infinity or ±0...
+ if (!xd || !xd[0] || !yd || !yd[0]) {
+
+ return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
+
+ // Return NaN if either is NaN.
+ // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
+ ? NaN
+
+ // Return ±Infinity if either is ±Infinity.
+ // Return ±0 if either is ±0.
+ : !xd || !yd ? y.s / 0 : y.s * 0);
+ }
+
+ e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
+ xdL = xd.length;
+ ydL = yd.length;
+
+ // Ensure xd points to the longer array.
+ if (xdL < ydL) {
+ r = xd;
+ xd = yd;
+ yd = r;
+ rL = xdL;
+ xdL = ydL;
+ ydL = rL;
+ }
+
+ // Initialise the result array with zeros.
+ r = [];
+ rL = xdL + ydL;
+ for (i = rL; i--;) r.push(0);
+
+ // Multiply!
+ for (i = ydL; --i >= 0;) {
+ carry = 0;
+ for (k = xdL + i; k > i;) {
+ t = r[k] + yd[i] * xd[k - i - 1] + carry;
+ r[k--] = t % BASE | 0;
+ carry = t / BASE | 0;
+ }
+
+ r[k] = (r[k] + carry) % BASE | 0;
+ }
+
+ // Remove trailing zeros.
+ for (; !r[--rL];) r.pop();
+
+ if (carry) ++e;
+ else r.shift();
+
+ y.d = r;
+ y.e = getBase10Exponent(r, e);
+
+ return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal in base 2, round to `sd` significant
+ * digits using rounding mode `rm`.
+ *
+ * If the optional `sd` argument is present then return binary exponential notation.
+ *
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ */
+ P.toBinary = function (sd, rm) {
+ return toStringBinary(this, 2, sd, rm);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
+ * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
+ *
+ * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
+ *
+ * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ */
+ P.toDecimalPlaces = P.toDP = function (dp, rm) {
+ var x = this,
+ Ctor = x.constructor;
+
+ x = new Ctor(x);
+ if (dp === void 0) return x;
+
+ checkInt32(dp, 0, MAX_DIGITS);
+
+ if (rm === void 0) rm = Ctor.rounding;
+ else checkInt32(rm, 0, 8);
+
+ return finalise(x, dp + x.e + 1, rm);
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal in exponential notation rounded to
+ * `dp` fixed decimal places using rounding mode `rounding`.
+ *
+ * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ */
+ P.toExponential = function (dp, rm) {
+ var str,
+ x = this,
+ Ctor = x.constructor;
+
+ if (dp === void 0) {
+ str = finiteToString(x, true);
+ } else {
+ checkInt32(dp, 0, MAX_DIGITS);
+
+ if (rm === void 0) rm = Ctor.rounding;
+ else checkInt32(rm, 0, 8);
+
+ x = finalise(new Ctor(x), dp + 1, rm);
+ str = finiteToString(x, true, dp + 1);
+ }
+
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal in normal (fixed-point) notation to
+ * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
+ * omitted.
+ *
+ * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
+ *
+ * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
+ * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
+ * (-0).toFixed(3) is '0.000'.
+ * (-0.5).toFixed(0) is '-0'.
+ *
+ */
+ P.toFixed = function (dp, rm) {
+ var str, y,
+ x = this,
+ Ctor = x.constructor;
+
+ if (dp === void 0) {
+ str = finiteToString(x);
+ } else {
+ checkInt32(dp, 0, MAX_DIGITS);
+
+ if (rm === void 0) rm = Ctor.rounding;
+ else checkInt32(rm, 0, 8);
+
+ y = finalise(new Ctor(x), dp + x.e + 1, rm);
+ str = finiteToString(y, false, dp + y.e + 1);
+ }
+
+ // To determine whether to add the minus sign look at the value before it was rounded,
+ // i.e. look at `x` rather than `y`.
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
+ };
+
+
+ /*
+ * Return an array representing the value of this Decimal as a simple fraction with an integer
+ * numerator and an integer denominator.
+ *
+ * The denominator will be a positive non-zero value less than or equal to the specified maximum
+ * denominator. If a maximum denominator is not specified, the denominator will be the lowest
+ * value necessary to represent the number exactly.
+ *
+ * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
+ *
+ */
+ P.toFraction = function (maxD) {
+ var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,
+ x = this,
+ xd = x.d,
+ Ctor = x.constructor;
+
+ if (!xd) return new Ctor(x);
+
+ n1 = d0 = new Ctor(1);
+ d1 = n0 = new Ctor(0);
+
+ d = new Ctor(d1);
+ e = d.e = getPrecision(xd) - x.e - 1;
+ k = e % LOG_BASE;
+ d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
+
+ if (maxD == null) {
+
+ // d is 10**e, the minimum max-denominator needed.
+ maxD = e > 0 ? d : n1;
+ } else {
+ n = new Ctor(maxD);
+ if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
+ maxD = n.gt(d) ? (e > 0 ? d : n1) : n;
+ }
+
+ external = false;
+ n = new Ctor(digitsToString(xd));
+ pr = Ctor.precision;
+ Ctor.precision = e = xd.length * LOG_BASE * 2;
+
+ for (;;) {
+ q = divide(n, d, 0, 1, 1);
+ d2 = d0.plus(q.times(d1));
+ if (d2.cmp(maxD) == 1) break;
+ d0 = d1;
+ d1 = d2;
+ d2 = n1;
+ n1 = n0.plus(q.times(d2));
+ n0 = d2;
+ d2 = d;
+ d = n.minus(q.times(d2));
+ n = d2;
+ }
+
+ d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
+ n0 = n0.plus(d2.times(n1));
+ d0 = d0.plus(d2.times(d1));
+ n0.s = n1.s = x.s;
+
+ // Determine which fraction is closer to x, n0/d0 or n1/d1?
+ r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1
+ ? [n1, d1] : [n0, d0];
+
+ Ctor.precision = pr;
+ external = true;
+
+ return r;
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal in base 16, round to `sd` significant
+ * digits using rounding mode `rm`.
+ *
+ * If the optional `sd` argument is present then return binary exponential notation.
+ *
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ */
+ P.toHexadecimal = P.toHex = function (sd, rm) {
+ return toStringBinary(this, 16, sd, rm);
+ };
+
+
+ /*
+ * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
+ * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
+ *
+ * The return value will always have the same sign as this Decimal, unless either this Decimal
+ * or `y` is NaN, in which case the return value will be also be NaN.
+ *
+ * The return value is not affected by the value of `precision`.
+ *
+ * y {number|string|Decimal} The magnitude to round to a multiple of.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * 'toNearest() rounding mode not an integer: {rm}'
+ * 'toNearest() rounding mode out of range: {rm}'
+ *
+ */
+ P.toNearest = function (y, rm) {
+ var x = this,
+ Ctor = x.constructor;
+
+ x = new Ctor(x);
+
+ if (y == null) {
+
+ // If x is not finite, return x.
+ if (!x.d) return x;
+
+ y = new Ctor(1);
+ rm = Ctor.rounding;
+ } else {
+ y = new Ctor(y);
+ if (rm === void 0) {
+ rm = Ctor.rounding;
+ } else {
+ checkInt32(rm, 0, 8);
+ }
+
+ // If x is not finite, return x if y is not NaN, else NaN.
+ if (!x.d) return y.s ? x : y;
+
+ // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
+ if (!y.d) {
+ if (y.s) y.s = x.s;
+ return y;
+ }
+ }
+
+ // If y is not zero, calculate the nearest multiple of y to x.
+ if (y.d[0]) {
+ external = false;
+ x = divide(x, y, 0, rm, 1).times(y);
+ external = true;
+ finalise(x);
+
+ // If y is zero, return zero with the sign of x.
+ } else {
+ y.s = x.s;
+ x = y;
+ }
+
+ return x;
+ };
+
+
+ /*
+ * Return the value of this Decimal converted to a number primitive.
+ * Zero keeps its sign.
+ *
+ */
+ P.toNumber = function () {
+ return +this;
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal in base 8, round to `sd` significant
+ * digits using rounding mode `rm`.
+ *
+ * If the optional `sd` argument is present then return binary exponential notation.
+ *
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ */
+ P.toOctal = function (sd, rm) {
+ return toStringBinary(this, 8, sd, rm);
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
+ * to `precision` significant digits using rounding mode `rounding`.
+ *
+ * ECMAScript compliant.
+ *
+ * pow(x, NaN) = NaN
+ * pow(x, ±0) = 1
+
+ * pow(NaN, non-zero) = NaN
+ * pow(abs(x) > 1, +Infinity) = +Infinity
+ * pow(abs(x) > 1, -Infinity) = +0
+ * pow(abs(x) == 1, ±Infinity) = NaN
+ * pow(abs(x) < 1, +Infinity) = +0
+ * pow(abs(x) < 1, -Infinity) = +Infinity
+ * pow(+Infinity, y > 0) = +Infinity
+ * pow(+Infinity, y < 0) = +0
+ * pow(-Infinity, odd integer > 0) = -Infinity
+ * pow(-Infinity, even integer > 0) = +Infinity
+ * pow(-Infinity, odd integer < 0) = -0
+ * pow(-Infinity, even integer < 0) = +0
+ * pow(+0, y > 0) = +0
+ * pow(+0, y < 0) = +Infinity
+ * pow(-0, odd integer > 0) = -0
+ * pow(-0, even integer > 0) = +0
+ * pow(-0, odd integer < 0) = -Infinity
+ * pow(-0, even integer < 0) = +Infinity
+ * pow(finite x < 0, finite non-integer) = NaN
+ *
+ * For non-integer or very large exponents pow(x, y) is calculated using
+ *
+ * x^y = exp(y*ln(x))
+ *
+ * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
+ * probability of an incorrectly rounded result
+ * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
+ * i.e. 1 in 250,000,000,000,000
+ *
+ * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
+ *
+ * y {number|string|Decimal} The power to which to raise this Decimal.
+ *
+ */
+ P.toPower = P.pow = function (y) {
+ var e, k, pr, r, rm, s,
+ x = this,
+ Ctor = x.constructor,
+ yn = +(y = new Ctor(y));
+
+ // Either ±Infinity, NaN or ±0?
+ if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
+
+ x = new Ctor(x);
+
+ if (x.eq(1)) return x;
+
+ pr = Ctor.precision;
+ rm = Ctor.rounding;
+
+ if (y.eq(1)) return finalise(x, pr, rm);
+
+ // y exponent
+ e = mathfloor(y.e / LOG_BASE);
+
+ // If y is a small integer use the 'exponentiation by squaring' algorithm.
+ if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
+ r = intPow(Ctor, x, k, pr);
+ return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
+ }
+
+ s = x.s;
+
+ // if x is negative
+ if (s < 0) {
+
+ // if y is not an integer
+ if (e < y.d.length - 1) return new Ctor(NaN);
+
+ // Result is positive if x is negative and the last digit of integer y is even.
+ if ((y.d[e] & 1) == 0) s = 1;
+
+ // if x.eq(-1)
+ if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
+ x.s = s;
+ return x;
+ }
+ }
+
+ // Estimate result exponent.
+ // x^y = 10^e, where e = y * log10(x)
+ // log10(x) = log10(x_significand) + x_exponent
+ // log10(x_significand) = ln(x_significand) / ln(10)
+ k = mathpow(+x, yn);
+ e = k == 0 || !isFinite(k)
+ ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))
+ : new Ctor(k + '').e;
+
+ // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
+
+ // Overflow/underflow?
+ if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
+
+ external = false;
+ Ctor.rounding = x.s = 1;
+
+ // Estimate the extra guard digits needed to ensure five correct rounding digits from
+ // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
+ // new Decimal(2.32456).pow('2087987436534566.46411')
+ // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
+ k = Math.min(12, (e + '').length);
+
+ // r = x^y = exp(y*ln(x))
+ r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
+
+ // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
+ if (r.d) {
+
+ // Truncate to the required precision plus five rounding digits.
+ r = finalise(r, pr + 5, 1);
+
+ // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
+ // the result.
+ if (checkRoundingDigits(r.d, pr, rm)) {
+ e = pr + 10;
+
+ // Truncate to the increased precision plus five rounding digits.
+ r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
+
+ // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
+ if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
+ r = finalise(r, pr + 1, 0);
+ }
+ }
+ }
+
+ r.s = s;
+ external = true;
+ Ctor.rounding = rm;
+
+ return finalise(r, pr, rm);
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal rounded to `sd` significant digits
+ * using rounding mode `rounding`.
+ *
+ * Return exponential notation if `sd` is less than the number of digits necessary to represent
+ * the integer part of the value in normal notation.
+ *
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ */
+ P.toPrecision = function (sd, rm) {
+ var str,
+ x = this,
+ Ctor = x.constructor;
+
+ if (sd === void 0) {
+ str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
+ } else {
+ checkInt32(sd, 1, MAX_DIGITS);
+
+ if (rm === void 0) rm = Ctor.rounding;
+ else checkInt32(rm, 0, 8);
+
+ x = finalise(new Ctor(x), sd, rm);
+ str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
+ }
+
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
+ * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
+ * omitted.
+ *
+ * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
+ * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+ *
+ * 'toSD() digits out of range: {sd}'
+ * 'toSD() digits not an integer: {sd}'
+ * 'toSD() rounding mode not an integer: {rm}'
+ * 'toSD() rounding mode out of range: {rm}'
+ *
+ */
+ P.toSignificantDigits = P.toSD = function (sd, rm) {
+ var x = this,
+ Ctor = x.constructor;
+
+ if (sd === void 0) {
+ sd = Ctor.precision;
+ rm = Ctor.rounding;
+ } else {
+ checkInt32(sd, 1, MAX_DIGITS);
+
+ if (rm === void 0) rm = Ctor.rounding;
+ else checkInt32(rm, 0, 8);
+ }
+
+ return finalise(new Ctor(x), sd, rm);
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal.
+ *
+ * Return exponential notation if this Decimal has a positive exponent equal to or greater than
+ * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
+ *
+ */
+ P.toString = function () {
+ var x = this,
+ Ctor = x.constructor,
+ str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
+
+ return x.isNeg() && !x.isZero() ? '-' + str : str;
+ };
+
+
+ /*
+ * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
+ *
+ */
+ P.truncated = P.trunc = function () {
+ return finalise(new this.constructor(this), this.e + 1, 1);
+ };
+
+
+ /*
+ * Return a string representing the value of this Decimal.
+ * Unlike `toString`, negative zero will include the minus sign.
+ *
+ */
+ P.valueOf = P.toJSON = function () {
+ var x = this,
+ Ctor = x.constructor,
+ str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
+
+ return x.isNeg() ? '-' + str : str;
+ };
+
+
+ // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
+
+
+ /*
+ * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
+ * finiteToString, naturalExponential, naturalLogarithm
+ * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
+ * P.toPrecision, P.toSignificantDigits, toStringBinary, random
+ * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
+ * convertBase toStringBinary, parseOther
+ * cos P.cos
+ * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
+ * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
+ * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
+ * taylorSeries, atan2, parseOther
+ * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
+ * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
+ * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
+ * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
+ * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
+ * P.truncated, divide, getLn10, getPi, naturalExponential,
+ * naturalLogarithm, ceil, floor, round, trunc
+ * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
+ * toStringBinary
+ * getBase10Exponent P.minus, P.plus, P.times, parseOther
+ * getLn10 P.logarithm, naturalLogarithm
+ * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
+ * getPrecision P.precision, P.toFraction
+ * getZeroString digitsToString, finiteToString
+ * intPow P.toPower, parseOther
+ * isOdd toLessThanHalfPi
+ * maxOrMin max, min
+ * naturalExponential P.naturalExponential, P.toPower
+ * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
+ * P.toPower, naturalExponential
+ * nonFiniteToString finiteToString, toStringBinary
+ * parseDecimal Decimal
+ * parseOther Decimal
+ * sin P.sin
+ * taylorSeries P.cosh, P.sinh, cos, sin
+ * toLessThanHalfPi P.cos, P.sin
+ * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
+ * truncate intPow
+ *
+ * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
+ * naturalLogarithm, config, parseOther, random, Decimal
+ */
+
+
+ function digitsToString(d) {
+ var i, k, ws,
+ indexOfLastWord = d.length - 1,
+ str = '',
+ w = d[0];
+
+ if (indexOfLastWord > 0) {
+ str += w;
+ for (i = 1; i < indexOfLastWord; i++) {
+ ws = d[i] + '';
+ k = LOG_BASE - ws.length;
+ if (k) str += getZeroString(k);
+ str += ws;
+ }
+
+ w = d[i];
+ ws = w + '';
+ k = LOG_BASE - ws.length;
+ if (k) str += getZeroString(k);
+ } else if (w === 0) {
+ return '0';
+ }
+
+ // Remove trailing zeros of last w.
+ for (; w % 10 === 0;) w /= 10;
+
+ return str + w;
+ }
+
+
+ function checkInt32(i, min, max) {
+ if (i !== ~~i || i < min || i > max) {
+ throw Error(invalidArgument + i);
+ }
+ }
+
+
+ /*
+ * Check 5 rounding digits if `repeating` is null, 4 otherwise.
+ * `repeating == null` if caller is `log` or `pow`,
+ * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
+ */
+ function checkRoundingDigits(d, i, rm, repeating) {
+ var di, k, r, rd;
+
+ // Get the length of the first word of the array d.
+ for (k = d[0]; k >= 10; k /= 10) --i;
+
+ // Is the rounding digit in the first word of d?
+ if (--i < 0) {
+ i += LOG_BASE;
+ di = 0;
+ } else {
+ di = Math.ceil((i + 1) / LOG_BASE);
+ i %= LOG_BASE;
+ }
+
+ // i is the index (0 - 6) of the rounding digit.
+ // E.g. if within the word 3487563 the first rounding digit is 5,
+ // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
+ k = mathpow(10, LOG_BASE - i);
+ rd = d[di] % k | 0;
+
+ if (repeating == null) {
+ if (i < 3) {
+ if (i == 0) rd = rd / 100 | 0;
+ else if (i == 1) rd = rd / 10 | 0;
+ r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
+ } else {
+ r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&
+ (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||
+ (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
+ }
+ } else {
+ if (i < 4) {
+ if (i == 0) rd = rd / 1000 | 0;
+ else if (i == 1) rd = rd / 100 | 0;
+ else if (i == 2) rd = rd / 10 | 0;
+ r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
+ } else {
+ r = ((repeating || rm < 4) && rd + 1 == k ||
+ (!repeating && rm > 3) && rd + 1 == k / 2) &&
+ (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
+ }
+ }
+
+ return r;
+ }
+
+
+ // Convert string of `baseIn` to an array of numbers of `baseOut`.
+ // Eg. convertBase('255', 10, 16) returns [15, 15].
+ // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
+ function convertBase(str, baseIn, baseOut) {
+ var j,
+ arr = [0],
+ arrL,
+ i = 0,
+ strL = str.length;
+
+ for (; i < strL;) {
+ for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;
+ arr[0] += NUMERALS.indexOf(str.charAt(i++));
+ for (j = 0; j < arr.length; j++) {
+ if (arr[j] > baseOut - 1) {
+ if (arr[j + 1] === void 0) arr[j + 1] = 0;
+ arr[j + 1] += arr[j] / baseOut | 0;
+ arr[j] %= baseOut;
+ }
+ }
+ }
+
+ return arr.reverse();
+ }
+
+
+ /*
+ * cos(x) = 1 - x^2/2! + x^4/4! - ...
+ * |x| < pi/2
+ *
+ */
+ function cosine(Ctor, x) {
+ var k, len, y;
+
+ if (x.isZero()) return x;
+
+ // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
+ // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
+
+ // Estimate the optimum number of times to use the argument reduction.
+ len = x.d.length;
+ if (len < 32) {
+ k = Math.ceil(len / 3);
+ y = (1 / tinyPow(4, k)).toString();
+ } else {
+ k = 16;
+ y = '2.3283064365386962890625e-10';
+ }
+
+ Ctor.precision += k;
+
+ x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
+
+ // Reverse argument reduction
+ for (var i = k; i--;) {
+ var cos2x = x.times(x);
+ x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
+ }
+
+ Ctor.precision -= k;
+
+ return x;
+ }
+
+
+ /*
+ * Perform division in the specified base.
+ */
+ var divide = (function () {
+
+ // Assumes non-zero x and k, and hence non-zero result.
+ function multiplyInteger(x, k, base) {
+ var temp,
+ carry = 0,
+ i = x.length;
+
+ for (x = x.slice(); i--;) {
+ temp = x[i] * k + carry;
+ x[i] = temp % base | 0;
+ carry = temp / base | 0;
+ }
+
+ if (carry) x.unshift(carry);
+
+ return x;
+ }
+
+ function compare(a, b, aL, bL) {
+ var i, r;
+
+ if (aL != bL) {
+ r = aL > bL ? 1 : -1;
+ } else {
+ for (i = r = 0; i < aL; i++) {
+ if (a[i] != b[i]) {
+ r = a[i] > b[i] ? 1 : -1;
+ break;
+ }
+ }
+ }
+
+ return r;
+ }
+
+ function subtract(a, b, aL, base) {
+ var i = 0;
+
+ // Subtract b from a.
+ for (; aL--;) {
+ a[aL] -= i;
+ i = a[aL] < b[aL] ? 1 : 0;
+ a[aL] = i * base + a[aL] - b[aL];
+ }
+
+ // Remove leading zeros.
+ for (; !a[0] && a.length > 1;) a.shift();
+ }
+
+ return function (x, y, pr, rm, dp, base) {
+ var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,
+ yL, yz,
+ Ctor = x.constructor,
+ sign = x.s == y.s ? 1 : -1,
+ xd = x.d,
+ yd = y.d;
+
+ // Either NaN, Infinity or 0?
+ if (!xd || !xd[0] || !yd || !yd[0]) {
+
+ return new Ctor(// Return NaN if either NaN, or both Infinity or 0.
+ !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
+
+ // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
+ xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
+ }
+
+ if (base) {
+ logBase = 1;
+ e = x.e - y.e;
+ } else {
+ base = BASE;
+ logBase = LOG_BASE;
+ e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
+ }
+
+ yL = yd.length;
+ xL = xd.length;
+ q = new Ctor(sign);
+ qd = q.d = [];
+
+ // Result exponent may be one less than e.
+ // The digit array of a Decimal from toStringBinary may have trailing zeros.
+ for (i = 0; yd[i] == (xd[i] || 0); i++);
+
+ if (yd[i] > (xd[i] || 0)) e--;
+
+ if (pr == null) {
+ sd = pr = Ctor.precision;
+ rm = Ctor.rounding;
+ } else if (dp) {
+ sd = pr + (x.e - y.e) + 1;
+ } else {
+ sd = pr;
+ }
+
+ if (sd < 0) {
+ qd.push(1);
+ more = true;
+ } else {
+
+ // Convert precision in number of base 10 digits to base 1e7 digits.
+ sd = sd / logBase + 2 | 0;
+ i = 0;
+
+ // divisor < 1e7
+ if (yL == 1) {
+ k = 0;
+ yd = yd[0];
+ sd++;
+
+ // k is the carry.
+ for (; (i < xL || k) && sd--; i++) {
+ t = k * base + (xd[i] || 0);
+ qd[i] = t / yd | 0;
+ k = t % yd | 0;
+ }
+
+ more = k || i < xL;
+
+ // divisor >= 1e7
+ } else {
+
+ // Normalise xd and yd so highest order digit of yd is >= base/2
+ k = base / (yd[0] + 1) | 0;
+
+ if (k > 1) {
+ yd = multiplyInteger(yd, k, base);
+ xd = multiplyInteger(xd, k, base);
+ yL = yd.length;
+ xL = xd.length;
+ }
+
+ xi = yL;
+ rem = xd.slice(0, yL);
+ remL = rem.length;
+
+ // Add zeros to make remainder as long as divisor.
+ for (; remL < yL;) rem[remL++] = 0;
+
+ yz = yd.slice();
+ yz.unshift(0);
+ yd0 = yd[0];
+
+ if (yd[1] >= base / 2) ++yd0;
+
+ do {
+ k = 0;
+
+ // Compare divisor and remainder.
+ cmp = compare(yd, rem, yL, remL);
+
+ // If divisor < remainder.
+ if (cmp < 0) {
+
+ // Calculate trial digit, k.
+ rem0 = rem[0];
+ if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
+
+ // k will be how many times the divisor goes into the current remainder.
+ k = rem0 / yd0 | 0;
+
+ // Algorithm:
+ // 1. product = divisor * trial digit (k)
+ // 2. if product > remainder: product -= divisor, k--
+ // 3. remainder -= product
+ // 4. if product was < remainder at 2:
+ // 5. compare new remainder and divisor
+ // 6. If remainder > divisor: remainder -= divisor, k++
+
+ if (k > 1) {
+ if (k >= base) k = base - 1;
+
+ // product = divisor * trial digit.
+ prod = multiplyInteger(yd, k, base);
+ prodL = prod.length;
+ remL = rem.length;
+
+ // Compare product and remainder.
+ cmp = compare(prod, rem, prodL, remL);
+
+ // product > remainder.
+ if (cmp == 1) {
+ k--;
+
+ // Subtract divisor from product.
+ subtract(prod, yL < prodL ? yz : yd, prodL, base);
+ }
+ } else {
+
+ // cmp is -1.
+ // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
+ // to avoid it. If k is 1 there is a need to compare yd and rem again below.
+ if (k == 0) cmp = k = 1;
+ prod = yd.slice();
+ }
+
+ prodL = prod.length;
+ if (prodL < remL) prod.unshift(0);
+
+ // Subtract product from remainder.
+ subtract(rem, prod, remL, base);
+
+ // If product was < previous remainder.
+ if (cmp == -1) {
+ remL = rem.length;
+
+ // Compare divisor and new remainder.
+ cmp = compare(yd, rem, yL, remL);
+
+ // If divisor < new remainder, subtract divisor from remainder.
+ if (cmp < 1) {
+ k++;
+
+ // Subtract divisor from remainder.
+ subtract(rem, yL < remL ? yz : yd, remL, base);
+ }
+ }
+
+ remL = rem.length;
+ } else if (cmp === 0) {
+ k++;
+ rem = [0];
+ } // if cmp === 1, k will be 0
+
+ // Add the next digit, k, to the result array.
+ qd[i++] = k;
+
+ // Update the remainder.
+ if (cmp && rem[0]) {
+ rem[remL++] = xd[xi] || 0;
+ } else {
+ rem = [xd[xi]];
+ remL = 1;
+ }
+
+ } while ((xi++ < xL || rem[0] !== void 0) && sd--);
+
+ more = rem[0] !== void 0;
+ }
+
+ // Leading zero?
+ if (!qd[0]) qd.shift();
+ }
+
+ // logBase is 1 when divide is being used for base conversion.
+ if (logBase == 1) {
+ q.e = e;
+ inexact = more;
+ } else {
+
+ // To calculate q.e, first get the number of digits of qd[0].
+ for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;
+ q.e = i + e * logBase - 1;
+
+ finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
+ }
+
+ return q;
+ };
+ })();
+
+
+ /*
+ * Round `x` to `sd` significant digits using rounding mode `rm`.
+ * Check for over/under-flow.
+ */
+ function finalise(x, sd, rm, isTruncated) {
+ var digits, i, j, k, rd, roundUp, w, xd, xdi,
+ Ctor = x.constructor;
+
+ // Don't round if sd is null or undefined.
+ out: if (sd != null) {
+ xd = x.d;
+
+ // Infinity/NaN.
+ if (!xd) return x;
+
+ // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
+ // w: the word of xd containing rd, a base 1e7 number.
+ // xdi: the index of w within xd.
+ // digits: the number of digits of w.
+ // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
+ // they had leading zeros)
+ // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
+
+ // Get the length of the first word of the digits array xd.
+ for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
+ i = sd - digits;
+
+ // Is the rounding digit in the first word of xd?
+ if (i < 0) {
+ i += LOG_BASE;
+ j = sd;
+ w = xd[xdi = 0];
+
+ // Get the rounding digit at index j of w.
+ rd = w / mathpow(10, digits - j - 1) % 10 | 0;
+ } else {
+ xdi = Math.ceil((i + 1) / LOG_BASE);
+ k = xd.length;
+ if (xdi >= k) {
+ if (isTruncated) {
+
+ // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
+ for (; k++ <= xdi;) xd.push(0);
+ w = rd = 0;
+ digits = 1;
+ i %= LOG_BASE;
+ j = i - LOG_BASE + 1;
+ } else {
+ break out;
+ }
+ } else {
+ w = k = xd[xdi];
+
+ // Get the number of digits of w.
+ for (digits = 1; k >= 10; k /= 10) digits++;
+
+ // Get the index of rd within w.
+ i %= LOG_BASE;
+
+ // Get the index of rd within w, adjusted for leading zeros.
+ // The number of leading zeros of w is given by LOG_BASE - digits.
+ j = i - LOG_BASE + digits;
+
+ // Get the rounding digit at index j of w.
+ rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
+ }
+ }
+
+ // Are there any non-zero digits after the rounding digit?
+ isTruncated = isTruncated || sd < 0 ||
+ xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
+
+ // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
+ // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
+ // will give 714.
+
+ roundUp = rm < 4
+ ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
+ : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
+
+ // Check whether the digit to the left of the rounding digit is odd.
+ ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||
+ rm == (x.s < 0 ? 8 : 7));
+
+ if (sd < 1 || !xd[0]) {
+ xd.length = 0;
+ if (roundUp) {
+
+ // Convert sd to decimal places.
+ sd -= x.e + 1;
+
+ // 1, 0.1, 0.01, 0.001, 0.0001 etc.
+ xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
+ x.e = -sd || 0;
+ } else {
+
+ // Zero.
+ xd[0] = x.e = 0;
+ }
+
+ return x;
+ }
+
+ // Remove excess digits.
+ if (i == 0) {
+ xd.length = xdi;
+ k = 1;
+ xdi--;
+ } else {
+ xd.length = xdi + 1;
+ k = mathpow(10, LOG_BASE - i);
+
+ // E.g. 56700 becomes 56000 if 7 is the rounding digit.
+ // j > 0 means i > number of leading zeros of w.
+ xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
+ }
+
+ if (roundUp) {
+ for (;;) {
+
+ // Is the digit to be rounded up in the first word of xd?
+ if (xdi == 0) {
+
+ // i will be the length of xd[0] before k is added.
+ for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
+ j = xd[0] += k;
+ for (k = 1; j >= 10; j /= 10) k++;
+
+ // if i != k the length has increased.
+ if (i != k) {
+ x.e++;
+ if (xd[0] == BASE) xd[0] = 1;
+ }
+
+ break;
+ } else {
+ xd[xdi] += k;
+ if (xd[xdi] != BASE) break;
+ xd[xdi--] = 0;
+ k = 1;
+ }
+ }
+ }
+
+ // Remove trailing zeros.
+ for (i = xd.length; xd[--i] === 0;) xd.pop();
+ }
+
+ if (external) {
+
+ // Overflow?
+ if (x.e > Ctor.maxE) {
+
+ // Infinity.
+ x.d = null;
+ x.e = NaN;
+
+ // Underflow?
+ } else if (x.e < Ctor.minE) {
+
+ // Zero.
+ x.e = 0;
+ x.d = [0];
+ // Ctor.underflow = true;
+ } // else Ctor.underflow = false;
+ }
+
+ return x;
+ }
+
+
+ function finiteToString(x, isExp, sd) {
+ if (!x.isFinite()) return nonFiniteToString(x);
+ var k,
+ e = x.e,
+ str = digitsToString(x.d),
+ len = str.length;
+
+ if (isExp) {
+ if (sd && (k = sd - len) > 0) {
+ str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
+ } else if (len > 1) {
+ str = str.charAt(0) + '.' + str.slice(1);
+ }
+
+ str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
+ } else if (e < 0) {
+ str = '0.' + getZeroString(-e - 1) + str;
+ if (sd && (k = sd - len) > 0) str += getZeroString(k);
+ } else if (e >= len) {
+ str += getZeroString(e + 1 - len);
+ if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
+ } else {
+ if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
+ if (sd && (k = sd - len) > 0) {
+ if (e + 1 === len) str += '.';
+ str += getZeroString(k);
+ }
+ }
+
+ return str;
+ }
+
+
+ // Calculate the base 10 exponent from the base 1e7 exponent.
+ function getBase10Exponent(digits, e) {
+ var w = digits[0];
+
+ // Add the number of digits of the first word of the digits array.
+ for ( e *= LOG_BASE; w >= 10; w /= 10) e++;
+ return e;
+ }
+
+
+ function getLn10(Ctor, sd, pr) {
+ if (sd > LN10_PRECISION) {
+
+ // Reset global state in case the exception is caught.
+ external = true;
+ if (pr) Ctor.precision = pr;
+ throw Error(precisionLimitExceeded);
+ }
+ return finalise(new Ctor(LN10), sd, 1, true);
+ }
+
+
+ function getPi(Ctor, sd, rm) {
+ if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
+ return finalise(new Ctor(PI), sd, rm, true);
+ }
+
+
+ function getPrecision(digits) {
+ var w = digits.length - 1,
+ len = w * LOG_BASE + 1;
+
+ w = digits[w];
+
+ // If non-zero...
+ if (w) {
+
+ // Subtract the number of trailing zeros of the last word.
+ for (; w % 10 == 0; w /= 10) len--;
+
+ // Add the number of digits of the first word.
+ for (w = digits[0]; w >= 10; w /= 10) len++;
+ }
+
+ return len;
+ }
+
+
+ function getZeroString(k) {
+ var zs = '';
+ for (; k--;) zs += '0';
+ return zs;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
+ * integer of type number.
+ *
+ * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
+ *
+ */
+ function intPow(Ctor, x, n, pr) {
+ var isTruncated,
+ r = new Ctor(1),
+
+ // Max n of 9007199254740991 takes 53 loop iterations.
+ // Maximum digits array length; leaves [28, 34] guard digits.
+ k = Math.ceil(pr / LOG_BASE + 4);
+
+ external = false;
+
+ for (;;) {
+ if (n % 2) {
+ r = r.times(x);
+ if (truncate(r.d, k)) isTruncated = true;
+ }
+
+ n = mathfloor(n / 2);
+ if (n === 0) {
+
+ // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
+ n = r.d.length - 1;
+ if (isTruncated && r.d[n] === 0) ++r.d[n];
+ break;
+ }
+
+ x = x.times(x);
+ truncate(x.d, k);
+ }
+
+ external = true;
+
+ return r;
+ }
+
+
+ function isOdd(n) {
+ return n.d[n.d.length - 1] & 1;
+ }
+
+
+ /*
+ * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
+ */
+ function maxOrMin(Ctor, args, ltgt) {
+ var y,
+ x = new Ctor(args[0]),
+ i = 0;
+
+ for (; ++i < args.length;) {
+ y = new Ctor(args[i]);
+ if (!y.s) {
+ x = y;
+ break;
+ } else if (x[ltgt](y)) {
+ x = y;
+ }
+ }
+
+ return x;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
+ * digits.
+ *
+ * Taylor/Maclaurin series.
+ *
+ * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
+ *
+ * Argument reduction:
+ * Repeat x = x / 32, k += 5, until |x| < 0.1
+ * exp(x) = exp(x / 2^k)^(2^k)
+ *
+ * Previously, the argument was initially reduced by
+ * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
+ * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
+ * found to be slower than just dividing repeatedly by 32 as above.
+ *
+ * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
+ * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
+ * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
+ *
+ * exp(Infinity) = Infinity
+ * exp(-Infinity) = 0
+ * exp(NaN) = NaN
+ * exp(±0) = 1
+ *
+ * exp(x) is non-terminating for any finite, non-zero x.
+ *
+ * The result will always be correctly rounded.
+ *
+ */
+ function naturalExponential(x, sd) {
+ var denominator, guard, j, pow, sum, t, wpr,
+ rep = 0,
+ i = 0,
+ k = 0,
+ Ctor = x.constructor,
+ rm = Ctor.rounding,
+ pr = Ctor.precision;
+
+ // 0/NaN/Infinity?
+ if (!x.d || !x.d[0] || x.e > 17) {
+
+ return new Ctor(x.d
+ ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0
+ : x.s ? x.s < 0 ? 0 : x : 0 / 0);
+ }
+
+ if (sd == null) {
+ external = false;
+ wpr = pr;
+ } else {
+ wpr = sd;
+ }
+
+ t = new Ctor(0.03125);
+
+ // while abs(x) >= 0.1
+ while (x.e > -2) {
+
+ // x = x / 2^5
+ x = x.times(t);
+ k += 5;
+ }
+
+ // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
+ // necessary to ensure the first 4 rounding digits are correct.
+ guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
+ wpr += guard;
+ denominator = pow = sum = new Ctor(1);
+ Ctor.precision = wpr;
+
+ for (;;) {
+ pow = finalise(pow.times(x), wpr, 1);
+ denominator = denominator.times(++i);
+ t = sum.plus(divide(pow, denominator, wpr, 1));
+
+ if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
+ j = k;
+ while (j--) sum = finalise(sum.times(sum), wpr, 1);
+
+ // Check to see if the first 4 rounding digits are [49]999.
+ // If so, repeat the summation with a higher precision, otherwise
+ // e.g. with precision: 18, rounding: 1
+ // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
+ // `wpr - guard` is the index of first rounding digit.
+ if (sd == null) {
+
+ if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
+ Ctor.precision = wpr += 10;
+ denominator = pow = t = new Ctor(1);
+ i = 0;
+ rep++;
+ } else {
+ return finalise(sum, Ctor.precision = pr, rm, external = true);
+ }
+ } else {
+ Ctor.precision = pr;
+ return sum;
+ }
+ }
+
+ sum = t;
+ }
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
+ * digits.
+ *
+ * ln(-n) = NaN
+ * ln(0) = -Infinity
+ * ln(-0) = -Infinity
+ * ln(1) = 0
+ * ln(Infinity) = Infinity
+ * ln(-Infinity) = NaN
+ * ln(NaN) = NaN
+ *
+ * ln(n) (n != 1) is non-terminating.
+ *
+ */
+ function naturalLogarithm(y, sd) {
+ var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,
+ n = 1,
+ guard = 10,
+ x = y,
+ xd = x.d,
+ Ctor = x.constructor,
+ rm = Ctor.rounding,
+ pr = Ctor.precision;
+
+ // Is x negative or Infinity, NaN, 0 or 1?
+ if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
+ return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
+ }
+
+ if (sd == null) {
+ external = false;
+ wpr = pr;
+ } else {
+ wpr = sd;
+ }
+
+ Ctor.precision = wpr += guard;
+ c = digitsToString(xd);
+ c0 = c.charAt(0);
+
+ if (Math.abs(e = x.e) < 1.5e15) {
+
+ // Argument reduction.
+ // The series converges faster the closer the argument is to 1, so using
+ // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
+ // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
+ // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
+ // later be divided by this number, then separate out the power of 10 using
+ // ln(a*10^b) = ln(a) + b*ln(10).
+
+ // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
+ //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
+ // max n is 6 (gives 0.7 - 1.3)
+ while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
+ x = x.times(y);
+ c = digitsToString(x.d);
+ c0 = c.charAt(0);
+ n++;
+ }
+
+ e = x.e;
+
+ if (c0 > 1) {
+ x = new Ctor('0.' + c);
+ e++;
+ } else {
+ x = new Ctor(c0 + '.' + c.slice(1));
+ }
+ } else {
+
+ // The argument reduction method above may result in overflow if the argument y is a massive
+ // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
+ // function using ln(x*10^e) = ln(x) + e*ln(10).
+ t = getLn10(Ctor, wpr + 2, pr).times(e + '');
+ x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
+ Ctor.precision = pr;
+
+ return sd == null ? finalise(x, pr, rm, external = true) : x;
+ }
+
+ // x1 is x reduced to a value near 1.
+ x1 = x;
+
+ // Taylor series.
+ // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
+ // where x = (y - 1)/(y + 1) (|x| < 1)
+ sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
+ x2 = finalise(x.times(x), wpr, 1);
+ denominator = 3;
+
+ for (;;) {
+ numerator = finalise(numerator.times(x2), wpr, 1);
+ t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
+
+ if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
+ sum = sum.times(2);
+
+ // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
+ // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
+ if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
+ sum = divide(sum, new Ctor(n), wpr, 1);
+
+ // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
+ // been repeated previously) and the first 4 rounding digits 9999?
+ // If so, restart the summation with a higher precision, otherwise
+ // e.g. with precision: 12, rounding: 1
+ // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
+ // `wpr - guard` is the index of first rounding digit.
+ if (sd == null) {
+ if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
+ Ctor.precision = wpr += guard;
+ t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
+ x2 = finalise(x.times(x), wpr, 1);
+ denominator = rep = 1;
+ } else {
+ return finalise(sum, Ctor.precision = pr, rm, external = true);
+ }
+ } else {
+ Ctor.precision = pr;
+ return sum;
+ }
+ }
+
+ sum = t;
+ denominator += 2;
+ }
+ }
+
+
+ // ±Infinity, NaN.
+ function nonFiniteToString(x) {
+ // Unsigned.
+ return String(x.s * x.s / 0);
+ }
+
+
+ /*
+ * Parse the value of a new Decimal `x` from string `str`.
+ */
+ function parseDecimal(x, str) {
+ var e, i, len;
+
+ // Decimal point?
+ if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
+
+ // Exponential form?
+ if ((i = str.search(/e/i)) > 0) {
+
+ // Determine exponent.
+ if (e < 0) e = i;
+ e += +str.slice(i + 1);
+ str = str.substring(0, i);
+ } else if (e < 0) {
+
+ // Integer.
+ e = str.length;
+ }
+
+ // Determine leading zeros.
+ for (i = 0; str.charCodeAt(i) === 48; i++);
+
+ // Determine trailing zeros.
+ for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
+ str = str.slice(i, len);
+
+ if (str) {
+ len -= i;
+ x.e = e = e - i - 1;
+ x.d = [];
+
+ // Transform base
+
+ // e is the base 10 exponent.
+ // i is where to slice str to get the first word of the digits array.
+ i = (e + 1) % LOG_BASE;
+ if (e < 0) i += LOG_BASE;
+
+ if (i < len) {
+ if (i) x.d.push(+str.slice(0, i));
+ for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));
+ str = str.slice(i);
+ i = LOG_BASE - str.length;
+ } else {
+ i -= len;
+ }
+
+ for (; i--;) str += '0';
+ x.d.push(+str);
+
+ if (external) {
+
+ // Overflow?
+ if (x.e > x.constructor.maxE) {
+
+ // Infinity.
+ x.d = null;
+ x.e = NaN;
+
+ // Underflow?
+ } else if (x.e < x.constructor.minE) {
+
+ // Zero.
+ x.e = 0;
+ x.d = [0];
+ // x.constructor.underflow = true;
+ } // else x.constructor.underflow = false;
+ }
+ } else {
+
+ // Zero.
+ x.e = 0;
+ x.d = [0];
+ }
+
+ return x;
+ }
+
+
+ /*
+ * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
+ */
+ function parseOther(x, str) {
+ var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
+
+ if (str.indexOf('_') > -1) {
+ str = str.replace(/(\d)_(?=\d)/g, '$1');
+ if (isDecimal.test(str)) return parseDecimal(x, str);
+ } else if (str === 'Infinity' || str === 'NaN') {
+ if (!+str) x.s = NaN;
+ x.e = NaN;
+ x.d = null;
+ return x;
+ }
+
+ if (isHex.test(str)) {
+ base = 16;
+ str = str.toLowerCase();
+ } else if (isBinary.test(str)) {
+ base = 2;
+ } else if (isOctal.test(str)) {
+ base = 8;
+ } else {
+ throw Error(invalidArgument + str);
+ }
+
+ // Is there a binary exponent part?
+ i = str.search(/p/i);
+
+ if (i > 0) {
+ p = +str.slice(i + 1);
+ str = str.substring(2, i);
+ } else {
+ str = str.slice(2);
+ }
+
+ // Convert `str` as an integer then divide the result by `base` raised to a power such that the
+ // fraction part will be restored.
+ i = str.indexOf('.');
+ isFloat = i >= 0;
+ Ctor = x.constructor;
+
+ if (isFloat) {
+ str = str.replace('.', '');
+ len = str.length;
+ i = len - i;
+
+ // log[10](16) = 1.2041... , log[10](88) = 1.9444....
+ divisor = intPow(Ctor, new Ctor(base), i, i * 2);
+ }
+
+ xd = convertBase(str, base, BASE);
+ xe = xd.length - 1;
+
+ // Remove trailing zeros.
+ for (i = xe; xd[i] === 0; --i) xd.pop();
+ if (i < 0) return new Ctor(x.s * 0);
+ x.e = getBase10Exponent(xd, xe);
+ x.d = xd;
+ external = false;
+
+ // At what precision to perform the division to ensure exact conversion?
+ // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
+ // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
+ // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
+ // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
+ // Therefore using 4 * the number of digits of str will always be enough.
+ if (isFloat) x = divide(x, divisor, len * 4);
+
+ // Multiply by the binary exponent part if present.
+ if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));
+ external = true;
+
+ return x;
+ }
+
+
+ /*
+ * sin(x) = x - x^3/3! + x^5/5! - ...
+ * |x| < pi/2
+ *
+ */
+ function sine(Ctor, x) {
+ var k,
+ len = x.d.length;
+
+ if (len < 3) {
+ return x.isZero() ? x : taylorSeries(Ctor, 2, x, x);
+ }
+
+ // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
+ // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
+ // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
+
+ // Estimate the optimum number of times to use the argument reduction.
+ k = 1.4 * Math.sqrt(len);
+ k = k > 16 ? 16 : k | 0;
+
+ x = x.times(1 / tinyPow(5, k));
+ x = taylorSeries(Ctor, 2, x, x);
+
+ // Reverse argument reduction
+ var sin2_x,
+ d5 = new Ctor(5),
+ d16 = new Ctor(16),
+ d20 = new Ctor(20);
+ for (; k--;) {
+ sin2_x = x.times(x);
+ x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
+ }
+
+ return x;
+ }
+
+
+ // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
+ function taylorSeries(Ctor, n, x, y, isHyperbolic) {
+ var j, t, u, x2,
+ pr = Ctor.precision,
+ k = Math.ceil(pr / LOG_BASE);
+
+ external = false;
+ x2 = x.times(x);
+ u = new Ctor(y);
+
+ for (;;) {
+ t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
+ u = isHyperbolic ? y.plus(t) : y.minus(t);
+ y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
+ t = u.plus(y);
+
+ if (t.d[k] !== void 0) {
+ for (j = k; t.d[j] === u.d[j] && j--;);
+ if (j == -1) break;
+ }
+
+ j = u;
+ u = y;
+ y = t;
+ t = j;
+ }
+
+ external = true;
+ t.d.length = k + 1;
+
+ return t;
+ }
+
+
+ // Exponent e must be positive and non-zero.
+ function tinyPow(b, e) {
+ var n = b;
+ while (--e) n *= b;
+ return n;
+ }
+
+
+ // Return the absolute value of `x` reduced to less than or equal to half pi.
+ function toLessThanHalfPi(Ctor, x) {
+ var t,
+ isNeg = x.s < 0,
+ pi = getPi(Ctor, Ctor.precision, 1),
+ halfPi = pi.times(0.5);
+
+ x = x.abs();
+
+ if (x.lte(halfPi)) {
+ quadrant = isNeg ? 4 : 1;
+ return x;
+ }
+
+ t = x.divToInt(pi);
+
+ if (t.isZero()) {
+ quadrant = isNeg ? 3 : 2;
+ } else {
+ x = x.minus(t.times(pi));
+
+ // 0 <= x < pi
+ if (x.lte(halfPi)) {
+ quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);
+ return x;
+ }
+
+ quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);
+ }
+
+ return x.minus(pi).abs();
+ }
+
+
+ /*
+ * Return the value of Decimal `x` as a string in base `baseOut`.
+ *
+ * If the optional `sd` argument is present include a binary exponent suffix.
+ */
+ function toStringBinary(x, baseOut, sd, rm) {
+ var base, e, i, k, len, roundUp, str, xd, y,
+ Ctor = x.constructor,
+ isExp = sd !== void 0;
+
+ if (isExp) {
+ checkInt32(sd, 1, MAX_DIGITS);
+ if (rm === void 0) rm = Ctor.rounding;
+ else checkInt32(rm, 0, 8);
+ } else {
+ sd = Ctor.precision;
+ rm = Ctor.rounding;
+ }
+
+ if (!x.isFinite()) {
+ str = nonFiniteToString(x);
+ } else {
+ str = finiteToString(x);
+ i = str.indexOf('.');
+
+ // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
+ // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
+ // minBinaryExponent = floor(decimalExponent * log[2](10))
+ // log[2](10) = 3.321928094887362347870319429489390175864
+
+ if (isExp) {
+ base = 2;
+ if (baseOut == 16) {
+ sd = sd * 4 - 3;
+ } else if (baseOut == 8) {
+ sd = sd * 3 - 2;
+ }
+ } else {
+ base = baseOut;
+ }
+
+ // Convert the number as an integer then divide the result by its base raised to a power such
+ // that the fraction part will be restored.
+
+ // Non-integer.
+ if (i >= 0) {
+ str = str.replace('.', '');
+ y = new Ctor(1);
+ y.e = str.length - i;
+ y.d = convertBase(finiteToString(y), 10, base);
+ y.e = y.d.length;
+ }
+
+ xd = convertBase(str, 10, base);
+ e = len = xd.length;
+
+ // Remove trailing zeros.
+ for (; xd[--len] == 0;) xd.pop();
+
+ if (!xd[0]) {
+ str = isExp ? '0p+0' : '0';
+ } else {
+ if (i < 0) {
+ e--;
+ } else {
+ x = new Ctor(x);
+ x.d = xd;
+ x.e = e;
+ x = divide(x, y, sd, rm, 0, base);
+ xd = x.d;
+ e = x.e;
+ roundUp = inexact;
+ }
+
+ // The rounding digit, i.e. the digit after the digit that may be rounded up.
+ i = xd[sd];
+ k = base / 2;
+ roundUp = roundUp || xd[sd + 1] !== void 0;
+
+ roundUp = rm < 4
+ ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))
+ : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||
+ rm === (x.s < 0 ? 8 : 7));
+
+ xd.length = sd;
+
+ if (roundUp) {
+
+ // Rounding up may mean the previous digit has to be rounded up and so on.
+ for (; ++xd[--sd] > base - 1;) {
+ xd[sd] = 0;
+ if (!sd) {
+ ++e;
+ xd.unshift(1);
+ }
+ }
+ }
+
+ // Determine trailing zeros.
+ for (len = xd.length; !xd[len - 1]; --len);
+
+ // E.g. [4, 11, 15] becomes 4bf.
+ for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);
+
+ // Add binary exponent suffix?
+ if (isExp) {
+ if (len > 1) {
+ if (baseOut == 16 || baseOut == 8) {
+ i = baseOut == 16 ? 4 : 3;
+ for (--len; len % i; len++) str += '0';
+ xd = convertBase(str, base, baseOut);
+ for (len = xd.length; !xd[len - 1]; --len);
+
+ // xd[0] will always be be 1
+ for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);
+ } else {
+ str = str.charAt(0) + '.' + str.slice(1);
+ }
+ }
+
+ str = str + (e < 0 ? 'p' : 'p+') + e;
+ } else if (e < 0) {
+ for (; ++e;) str = '0' + str;
+ str = '0.' + str;
+ } else {
+ if (++e > len) for (e -= len; e-- ;) str += '0';
+ else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
+ }
+ }
+
+ str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
+ }
+
+ return x.s < 0 ? '-' + str : str;
+ }
+
+
+ // Does not strip trailing zeros.
+ function truncate(arr, len) {
+ if (arr.length > len) {
+ arr.length = len;
+ return true;
+ }
+ }
+
+
+ // Decimal methods
+
+
+ /*
+ * abs
+ * acos
+ * acosh
+ * add
+ * asin
+ * asinh
+ * atan
+ * atanh
+ * atan2
+ * cbrt
+ * ceil
+ * clamp
+ * clone
+ * config
+ * cos
+ * cosh
+ * div
+ * exp
+ * floor
+ * hypot
+ * ln
+ * log
+ * log2
+ * log10
+ * max
+ * min
+ * mod
+ * mul
+ * pow
+ * random
+ * round
+ * set
+ * sign
+ * sin
+ * sinh
+ * sqrt
+ * sub
+ * sum
+ * tan
+ * tanh
+ * trunc
+ */
+
+
+ /*
+ * Return a new Decimal whose value is the absolute value of `x`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function abs(x) {
+ return new this(x).abs();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the arccosine in radians of `x`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function acos(x) {
+ return new this(x).acos();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
+ * `precision` significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function acosh(x) {
+ return new this(x).acosh();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ * y {number|string|Decimal}
+ *
+ */
+ function add(x, y) {
+ return new this(x).plus(y);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function asin(x) {
+ return new this(x).asin();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
+ * `precision` significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function asinh(x) {
+ return new this(x).asinh();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function atan(x) {
+ return new this(x).atan();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
+ * `precision` significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function atanh(x) {
+ return new this(x).atanh();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
+ * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
+ *
+ * Domain: [-Infinity, Infinity]
+ * Range: [-pi, pi]
+ *
+ * y {number|string|Decimal} The y-coordinate.
+ * x {number|string|Decimal} The x-coordinate.
+ *
+ * atan2(±0, -0) = ±pi
+ * atan2(±0, +0) = ±0
+ * atan2(±0, -x) = ±pi for x > 0
+ * atan2(±0, x) = ±0 for x > 0
+ * atan2(-y, ±0) = -pi/2 for y > 0
+ * atan2(y, ±0) = pi/2 for y > 0
+ * atan2(±y, -Infinity) = ±pi for finite y > 0
+ * atan2(±y, +Infinity) = ±0 for finite y > 0
+ * atan2(±Infinity, x) = ±pi/2 for finite x
+ * atan2(±Infinity, -Infinity) = ±3*pi/4
+ * atan2(±Infinity, +Infinity) = ±pi/4
+ * atan2(NaN, x) = NaN
+ * atan2(y, NaN) = NaN
+ *
+ */
+ function atan2(y, x) {
+ y = new this(y);
+ x = new this(x);
+ var r,
+ pr = this.precision,
+ rm = this.rounding,
+ wpr = pr + 4;
+
+ // Either NaN
+ if (!y.s || !x.s) {
+ r = new this(NaN);
+
+ // Both ±Infinity
+ } else if (!y.d && !x.d) {
+ r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
+ r.s = y.s;
+
+ // x is ±Infinity or y is ±0
+ } else if (!x.d || y.isZero()) {
+ r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
+ r.s = y.s;
+
+ // y is ±Infinity or x is ±0
+ } else if (!y.d || x.isZero()) {
+ r = getPi(this, wpr, 1).times(0.5);
+ r.s = y.s;
+
+ // Both non-zero and finite
+ } else if (x.s < 0) {
+ this.precision = wpr;
+ this.rounding = 1;
+ r = this.atan(divide(y, x, wpr, 1));
+ x = getPi(this, wpr, 1);
+ this.precision = pr;
+ this.rounding = rm;
+ r = y.s < 0 ? r.minus(x) : r.plus(x);
+ } else {
+ r = this.atan(divide(y, x, wpr, 1));
+ }
+
+ return r;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function cbrt(x) {
+ return new this(x).cbrt();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function ceil(x) {
+ return finalise(x = new this(x), x.e + 1, 2);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`.
+ *
+ * x {number|string|Decimal}
+ * min {number|string|Decimal}
+ * max {number|string|Decimal}
+ *
+ */
+ function clamp(x, min, max) {
+ return new this(x).clamp(min, max);
+ }
+
+
+ /*
+ * Configure global settings for a Decimal constructor.
+ *
+ * `obj` is an object with one or more of the following properties,
+ *
+ * precision {number}
+ * rounding {number}
+ * toExpNeg {number}
+ * toExpPos {number}
+ * maxE {number}
+ * minE {number}
+ * modulo {number}
+ * crypto {boolean|number}
+ * defaults {true}
+ *
+ * E.g. Decimal.config({ precision: 20, rounding: 4 })
+ *
+ */
+ function config(obj) {
+ if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');
+ var i, p, v,
+ useDefaults = obj.defaults === true,
+ ps = [
+ 'precision', 1, MAX_DIGITS,
+ 'rounding', 0, 8,
+ 'toExpNeg', -EXP_LIMIT, 0,
+ 'toExpPos', 0, EXP_LIMIT,
+ 'maxE', 0, EXP_LIMIT,
+ 'minE', -EXP_LIMIT, 0,
+ 'modulo', 0, 9
+ ];
+
+ for (i = 0; i < ps.length; i += 3) {
+ if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
+ if ((v = obj[p]) !== void 0) {
+ if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
+ else throw Error(invalidArgument + p + ': ' + v);
+ }
+ }
+
+ if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
+ if ((v = obj[p]) !== void 0) {
+ if (v === true || v === false || v === 0 || v === 1) {
+ if (v) {
+ if (typeof crypto != 'undefined' && crypto &&
+ (crypto.getRandomValues || crypto.randomBytes)) {
+ this[p] = true;
+ } else {
+ throw Error(cryptoUnavailable);
+ }
+ } else {
+ this[p] = false;
+ }
+ } else {
+ throw Error(invalidArgument + p + ': ' + v);
+ }
+ }
+
+ return this;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function cos(x) {
+ return new this(x).cos();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function cosh(x) {
+ return new this(x).cosh();
+ }
+
+
+ /*
+ * Create and return a Decimal constructor with the same configuration properties as this Decimal
+ * constructor.
+ *
+ */
+ function clone(obj) {
+ var i, p, ps;
+
+ /*
+ * The Decimal constructor and exported function.
+ * Return a new Decimal instance.
+ *
+ * v {number|string|Decimal} A numeric value.
+ *
+ */
+ function Decimal(v) {
+ var e, i, t,
+ x = this;
+
+ // Decimal called without new.
+ if (!(x instanceof Decimal)) return new Decimal(v);
+
+ // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
+ // which points to Object.
+ x.constructor = Decimal;
+
+ // Duplicate.
+ if (isDecimalInstance(v)) {
+ x.s = v.s;
+
+ if (external) {
+ if (!v.d || v.e > Decimal.maxE) {
+
+ // Infinity.
+ x.e = NaN;
+ x.d = null;
+ } else if (v.e < Decimal.minE) {
+
+ // Zero.
+ x.e = 0;
+ x.d = [0];
+ } else {
+ x.e = v.e;
+ x.d = v.d.slice();
+ }
+ } else {
+ x.e = v.e;
+ x.d = v.d ? v.d.slice() : v.d;
+ }
+
+ return;
+ }
+
+ t = typeof v;
+
+ if (t === 'number') {
+ if (v === 0) {
+ x.s = 1 / v < 0 ? -1 : 1;
+ x.e = 0;
+ x.d = [0];
+ return;
+ }
+
+ if (v < 0) {
+ v = -v;
+ x.s = -1;
+ } else {
+ x.s = 1;
+ }
+
+ // Fast path for small integers.
+ if (v === ~~v && v < 1e7) {
+ for (e = 0, i = v; i >= 10; i /= 10) e++;
+
+ if (external) {
+ if (e > Decimal.maxE) {
+ x.e = NaN;
+ x.d = null;
+ } else if (e < Decimal.minE) {
+ x.e = 0;
+ x.d = [0];
+ } else {
+ x.e = e;
+ x.d = [v];
+ }
+ } else {
+ x.e = e;
+ x.d = [v];
+ }
+
+ return;
+
+ // Infinity, NaN.
+ } else if (v * 0 !== 0) {
+ if (!v) x.s = NaN;
+ x.e = NaN;
+ x.d = null;
+ return;
+ }
+
+ return parseDecimal(x, v.toString());
+
+ } else if (t !== 'string') {
+ throw Error(invalidArgument + v);
+ }
+
+ // Minus sign?
+ if ((i = v.charCodeAt(0)) === 45) {
+ v = v.slice(1);
+ x.s = -1;
+ } else {
+ // Plus sign?
+ if (i === 43) v = v.slice(1);
+ x.s = 1;
+ }
+
+ return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
+ }
+
+ Decimal.prototype = P;
+
+ Decimal.ROUND_UP = 0;
+ Decimal.ROUND_DOWN = 1;
+ Decimal.ROUND_CEIL = 2;
+ Decimal.ROUND_FLOOR = 3;
+ Decimal.ROUND_HALF_UP = 4;
+ Decimal.ROUND_HALF_DOWN = 5;
+ Decimal.ROUND_HALF_EVEN = 6;
+ Decimal.ROUND_HALF_CEIL = 7;
+ Decimal.ROUND_HALF_FLOOR = 8;
+ Decimal.EUCLID = 9;
+
+ Decimal.config = Decimal.set = config;
+ Decimal.clone = clone;
+ Decimal.isDecimal = isDecimalInstance;
+
+ Decimal.abs = abs;
+ Decimal.acos = acos;
+ Decimal.acosh = acosh; // ES6
+ Decimal.add = add;
+ Decimal.asin = asin;
+ Decimal.asinh = asinh; // ES6
+ Decimal.atan = atan;
+ Decimal.atanh = atanh; // ES6
+ Decimal.atan2 = atan2;
+ Decimal.cbrt = cbrt; // ES6
+ Decimal.ceil = ceil;
+ Decimal.clamp = clamp;
+ Decimal.cos = cos;
+ Decimal.cosh = cosh; // ES6
+ Decimal.div = div;
+ Decimal.exp = exp;
+ Decimal.floor = floor;
+ Decimal.hypot = hypot; // ES6
+ Decimal.ln = ln;
+ Decimal.log = log;
+ Decimal.log10 = log10; // ES6
+ Decimal.log2 = log2; // ES6
+ Decimal.max = max;
+ Decimal.min = min;
+ Decimal.mod = mod;
+ Decimal.mul = mul;
+ Decimal.pow = pow;
+ Decimal.random = random;
+ Decimal.round = round;
+ Decimal.sign = sign; // ES6
+ Decimal.sin = sin;
+ Decimal.sinh = sinh; // ES6
+ Decimal.sqrt = sqrt;
+ Decimal.sub = sub;
+ Decimal.sum = sum;
+ Decimal.tan = tan;
+ Decimal.tanh = tanh; // ES6
+ Decimal.trunc = trunc; // ES6
+
+ if (obj === void 0) obj = {};
+ if (obj) {
+ if (obj.defaults !== true) {
+ ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
+ for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
+ }
+ }
+
+ Decimal.config(obj);
+
+ return Decimal;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ * y {number|string|Decimal}
+ *
+ */
+ function div(x, y) {
+ return new this(x).div(y);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} The power to which to raise the base of the natural log.
+ *
+ */
+ function exp(x) {
+ return new this(x).exp();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function floor(x) {
+ return finalise(x = new this(x), x.e + 1, 3);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
+ * rounded to `precision` significant digits using rounding mode `rounding`.
+ *
+ * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
+ *
+ * arguments {number|string|Decimal}
+ *
+ */
+ function hypot() {
+ var i, n,
+ t = new this(0);
+
+ external = false;
+
+ for (i = 0; i < arguments.length;) {
+ n = new this(arguments[i++]);
+ if (!n.d) {
+ if (n.s) {
+ external = true;
+ return new this(1 / 0);
+ }
+ t = n;
+ } else if (t.d) {
+ t = t.plus(n.times(n));
+ }
+ }
+
+ external = true;
+
+ return t.sqrt();
+ }
+
+
+ /*
+ * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
+ * otherwise return false.
+ *
+ */
+ function isDecimalInstance(obj) {
+ return obj instanceof Decimal || obj && obj.toStringTag === tag || false;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function ln(x) {
+ return new this(x).ln();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
+ * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
+ *
+ * log[y](x)
+ *
+ * x {number|string|Decimal} The argument of the logarithm.
+ * y {number|string|Decimal} The base of the logarithm.
+ *
+ */
+ function log(x, y) {
+ return new this(x).log(y);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function log2(x) {
+ return new this(x).log(2);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function log10(x) {
+ return new this(x).log(10);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the maximum of the arguments.
+ *
+ * arguments {number|string|Decimal}
+ *
+ */
+ function max() {
+ return maxOrMin(this, arguments, 'lt');
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the minimum of the arguments.
+ *
+ * arguments {number|string|Decimal}
+ *
+ */
+ function min() {
+ return maxOrMin(this, arguments, 'gt');
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
+ * using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ * y {number|string|Decimal}
+ *
+ */
+ function mod(x, y) {
+ return new this(x).mod(y);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ * y {number|string|Decimal}
+ *
+ */
+ function mul(x, y) {
+ return new this(x).mul(y);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} The base.
+ * y {number|string|Decimal} The exponent.
+ *
+ */
+ function pow(x, y) {
+ return new this(x).pow(y);
+ }
+
+
+ /*
+ * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
+ * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
+ * are produced).
+ *
+ * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
+ *
+ */
+ function random(sd) {
+ var d, e, k, n,
+ i = 0,
+ r = new this(1),
+ rd = [];
+
+ if (sd === void 0) sd = this.precision;
+ else checkInt32(sd, 1, MAX_DIGITS);
+
+ k = Math.ceil(sd / LOG_BASE);
+
+ if (!this.crypto) {
+ for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;
+
+ // Browsers supporting crypto.getRandomValues.
+ } else if (crypto.getRandomValues) {
+ d = crypto.getRandomValues(new Uint32Array(k));
+
+ for (; i < k;) {
+ n = d[i];
+
+ // 0 <= n < 4294967296
+ // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
+ if (n >= 4.29e9) {
+ d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
+ } else {
+
+ // 0 <= n <= 4289999999
+ // 0 <= (n % 1e7) <= 9999999
+ rd[i++] = n % 1e7;
+ }
+ }
+
+ // Node.js supporting crypto.randomBytes.
+ } else if (crypto.randomBytes) {
+
+ // buffer
+ d = crypto.randomBytes(k *= 4);
+
+ for (; i < k;) {
+
+ // 0 <= n < 2147483648
+ n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
+
+ // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
+ if (n >= 2.14e9) {
+ crypto.randomBytes(4).copy(d, i);
+ } else {
+
+ // 0 <= n <= 2139999999
+ // 0 <= (n % 1e7) <= 9999999
+ rd.push(n % 1e7);
+ i += 4;
+ }
+ }
+
+ i = k / 4;
+ } else {
+ throw Error(cryptoUnavailable);
+ }
+
+ k = rd[--i];
+ sd %= LOG_BASE;
+
+ // Convert trailing digits to zeros according to sd.
+ if (k && sd) {
+ n = mathpow(10, LOG_BASE - sd);
+ rd[i] = (k / n | 0) * n;
+ }
+
+ // Remove trailing words which are zero.
+ for (; rd[i] === 0; i--) rd.pop();
+
+ // Zero?
+ if (i < 0) {
+ e = 0;
+ rd = [0];
+ } else {
+ e = -1;
+
+ // Remove leading words which are zero and adjust exponent accordingly.
+ for (; rd[0] === 0; e -= LOG_BASE) rd.shift();
+
+ // Count the digits of the first word of rd to determine leading zeros.
+ for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;
+
+ // Adjust the exponent for leading zeros of the first word of rd.
+ if (k < LOG_BASE) e -= LOG_BASE - k;
+ }
+
+ r.e = e;
+ r.d = rd;
+
+ return r;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
+ *
+ * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function round(x) {
+ return finalise(x = new this(x), x.e + 1, this.rounding);
+ }
+
+
+ /*
+ * Return
+ * 1 if x > 0,
+ * -1 if x < 0,
+ * 0 if x is 0,
+ * -0 if x is -0,
+ * NaN otherwise
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function sign(x) {
+ x = new this(x);
+ return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
+ * using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function sin(x) {
+ return new this(x).sin();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function sinh(x) {
+ return new this(x).sinh();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function sqrt(x) {
+ return new this(x).sqrt();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
+ * using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal}
+ * y {number|string|Decimal}
+ *
+ */
+ function sub(x, y) {
+ return new this(x).sub(y);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the sum of the arguments, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * Only the result is rounded, not the intermediate calculations.
+ *
+ * arguments {number|string|Decimal}
+ *
+ */
+ function sum() {
+ var i = 0,
+ args = arguments,
+ x = new this(args[i]);
+
+ external = false;
+ for (; x.s && ++i < args.length;) x = x.plus(args[i]);
+ external = true;
+
+ return finalise(x, this.precision, this.rounding);
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
+ * digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function tan(x) {
+ return new this(x).tan();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
+ * significant digits using rounding mode `rounding`.
+ *
+ * x {number|string|Decimal} A value in radians.
+ *
+ */
+ function tanh(x) {
+ return new this(x).tanh();
+ }
+
+
+ /*
+ * Return a new Decimal whose value is `x` truncated to an integer.
+ *
+ * x {number|string|Decimal}
+ *
+ */
+ function trunc(x) {
+ return finalise(x = new this(x), x.e + 1, 1);
+ }
+
+
+ // Create and configure initial Decimal constructor.
+ Decimal = clone(DEFAULTS);
+ Decimal.prototype.constructor = Decimal;
+ Decimal['default'] = Decimal.Decimal = Decimal;
+
+ // Create the internal constants from their string values.
+ LN10 = new Decimal(LN10);
+ PI = new Decimal(PI);
+
+
+ // Export.
+
+
+ // AMD.
+ if (module.exports) {
+ if (typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol') {
+ P[Symbol['for']('nodejs.util.inspect.custom')] = P.toString;
+ P[Symbol.toStringTag] = 'Decimal';
+ }
+
+ module.exports = Decimal;
+
+ // Browser.
+ } else {
+ if (!globalScope) {
+ globalScope = typeof self != 'undefined' && self && self.self == self ? self : window;
+ }
+
+ noConflict = globalScope.Decimal;
+ Decimal.noConflict = function () {
+ globalScope.Decimal = noConflict;
+ return Decimal;
+ };
+
+ globalScope.Decimal = Decimal;
+ }
+ })(commonjsGlobal);
+} (decimal));
+
+var decimalExports = decimal.exports;
+
+var lodash = {exports: {}};
+
+/**
+ * @license
+ * Lodash
+ * Copyright OpenJS Foundation and other contributors
+ * Released under MIT license
+ * Based on Underscore.js 1.8.3
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */
+lodash.exports;
+
+(function (module, exports) {
+(function() {
+
+ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
+ var undefined$1;
+
+ /** Used as the semantic version number. */
+ var VERSION = '4.17.21';
+
+ /** Used as the size to enable large array optimizations. */
+ var LARGE_ARRAY_SIZE = 200;
+
+ /** Error message constants. */
+ var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
+ FUNC_ERROR_TEXT = 'Expected a function',
+ INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
+
+ /** Used to stand-in for `undefined` hash values. */
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
+
+ /** Used as the maximum memoize cache size. */
+ var MAX_MEMOIZE_SIZE = 500;
+
+ /** Used as the internal argument placeholder. */
+ var PLACEHOLDER = '__lodash_placeholder__';
+
+ /** Used to compose bitmasks for cloning. */
+ var CLONE_DEEP_FLAG = 1,
+ CLONE_FLAT_FLAG = 2,
+ CLONE_SYMBOLS_FLAG = 4;
+
+ /** Used to compose bitmasks for value comparisons. */
+ var COMPARE_PARTIAL_FLAG = 1,
+ COMPARE_UNORDERED_FLAG = 2;
+
+ /** Used to compose bitmasks for function metadata. */
+ var WRAP_BIND_FLAG = 1,
+ WRAP_BIND_KEY_FLAG = 2,
+ WRAP_CURRY_BOUND_FLAG = 4,
+ WRAP_CURRY_FLAG = 8,
+ WRAP_CURRY_RIGHT_FLAG = 16,
+ WRAP_PARTIAL_FLAG = 32,
+ WRAP_PARTIAL_RIGHT_FLAG = 64,
+ WRAP_ARY_FLAG = 128,
+ WRAP_REARG_FLAG = 256,
+ WRAP_FLIP_FLAG = 512;
+
+ /** Used as default options for `_.truncate`. */
+ var DEFAULT_TRUNC_LENGTH = 30,
+ DEFAULT_TRUNC_OMISSION = '...';
+
+ /** Used to detect hot functions by number of calls within a span of milliseconds. */
+ var HOT_COUNT = 800,
+ HOT_SPAN = 16;
+
+ /** Used to indicate the type of lazy iteratees. */
+ var LAZY_FILTER_FLAG = 1,
+ LAZY_MAP_FLAG = 2,
+ LAZY_WHILE_FLAG = 3;
+
+ /** Used as references for various `Number` constants. */
+ var INFINITY = 1 / 0,
+ MAX_SAFE_INTEGER = 9007199254740991,
+ MAX_INTEGER = 1.7976931348623157e+308,
+ NAN = 0 / 0;
+
+ /** Used as references for the maximum length and index of an array. */
+ var MAX_ARRAY_LENGTH = 4294967295,
+ MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
+ HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
+
+ /** Used to associate wrap methods with their bit flags. */
+ var wrapFlags = [
+ ['ary', WRAP_ARY_FLAG],
+ ['bind', WRAP_BIND_FLAG],
+ ['bindKey', WRAP_BIND_KEY_FLAG],
+ ['curry', WRAP_CURRY_FLAG],
+ ['curryRight', WRAP_CURRY_RIGHT_FLAG],
+ ['flip', WRAP_FLIP_FLAG],
+ ['partial', WRAP_PARTIAL_FLAG],
+ ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
+ ['rearg', WRAP_REARG_FLAG]
+ ];
+
+ /** `Object#toString` result references. */
+ var argsTag = '[object Arguments]',
+ arrayTag = '[object Array]',
+ asyncTag = '[object AsyncFunction]',
+ boolTag = '[object Boolean]',
+ dateTag = '[object Date]',
+ domExcTag = '[object DOMException]',
+ errorTag = '[object Error]',
+ funcTag = '[object Function]',
+ genTag = '[object GeneratorFunction]',
+ mapTag = '[object Map]',
+ numberTag = '[object Number]',
+ nullTag = '[object Null]',
+ objectTag = '[object Object]',
+ promiseTag = '[object Promise]',
+ proxyTag = '[object Proxy]',
+ regexpTag = '[object RegExp]',
+ setTag = '[object Set]',
+ stringTag = '[object String]',
+ symbolTag = '[object Symbol]',
+ undefinedTag = '[object Undefined]',
+ weakMapTag = '[object WeakMap]',
+ weakSetTag = '[object WeakSet]';
+
+ var arrayBufferTag = '[object ArrayBuffer]',
+ dataViewTag = '[object DataView]',
+ float32Tag = '[object Float32Array]',
+ float64Tag = '[object Float64Array]',
+ int8Tag = '[object Int8Array]',
+ int16Tag = '[object Int16Array]',
+ int32Tag = '[object Int32Array]',
+ uint8Tag = '[object Uint8Array]',
+ uint8ClampedTag = '[object Uint8ClampedArray]',
+ uint16Tag = '[object Uint16Array]',
+ uint32Tag = '[object Uint32Array]';
+
+ /** Used to match empty string literals in compiled template source. */
+ var reEmptyStringLeading = /\b__p \+= '';/g,
+ reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+ reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+
+ /** Used to match HTML entities and HTML characters. */
+ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
+ reUnescapedHtml = /[&<>"']/g,
+ reHasEscapedHtml = RegExp(reEscapedHtml.source),
+ reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
+
+ /** Used to match template delimiters. */
+ var reEscape = /<%-([\s\S]+?)%>/g,
+ reEvaluate = /<%([\s\S]+?)%>/g,
+ reInterpolate = /<%=([\s\S]+?)%>/g;
+
+ /** Used to match property names within property paths. */
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
+ reIsPlainProp = /^\w*$/,
+ rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
+
+ /**
+ * Used to match `RegExp`
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
+ */
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
+ reHasRegExpChar = RegExp(reRegExpChar.source);
+
+ /** Used to match leading whitespace. */
+ var reTrimStart = /^\s+/;
+
+ /** Used to match a single whitespace character. */
+ var reWhitespace = /\s/;
+
+ /** Used to match wrap detail comments. */
+ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
+ reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
+ reSplitDetails = /,? & /;
+
+ /** Used to match words composed of alphanumeric characters. */
+ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
+
+ /**
+ * Used to validate the `validate` option in `_.template` variable.
+ *
+ * Forbids characters which could potentially change the meaning of the function argument definition:
+ * - "()," (modification of function parameters)
+ * - "=" (default value)
+ * - "[]{}" (destructuring of function parameters)
+ * - "/" (beginning of a comment)
+ * - whitespace
+ */
+ var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
+
+ /** Used to match backslashes in property paths. */
+ var reEscapeChar = /\\(\\)?/g;
+
+ /**
+ * Used to match
+ * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
+ */
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+
+ /** Used to match `RegExp` flags from their coerced string values. */
+ var reFlags = /\w*$/;
+
+ /** Used to detect bad signed hexadecimal string values. */
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+
+ /** Used to detect binary string values. */
+ var reIsBinary = /^0b[01]+$/i;
+
+ /** Used to detect host constructors (Safari). */
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
+
+ /** Used to detect octal string values. */
+ var reIsOctal = /^0o[0-7]+$/i;
+
+ /** Used to detect unsigned integer values. */
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+ /** Used to match Latin Unicode letters (excluding mathematical operators). */
+ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
+
+ /** Used to ensure capturing order of template delimiters. */
+ var reNoMatch = /($^)/;
+
+ /** Used to match unescaped characters in compiled string literals. */
+ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
+
+ /** Used to compose unicode character classes. */
+ var rsAstralRange = '\\ud800-\\udfff',
+ rsComboMarksRange = '\\u0300-\\u036f',
+ reComboHalfMarksRange = '\\ufe20-\\ufe2f',
+ rsComboSymbolsRange = '\\u20d0-\\u20ff',
+ rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
+ rsDingbatRange = '\\u2700-\\u27bf',
+ rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
+ rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
+ rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
+ rsPunctuationRange = '\\u2000-\\u206f',
+ rsSpaceRange = ' \\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',
+ rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
+ rsVarRange = '\\ufe0e\\ufe0f',
+ rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
+
+ /** Used to compose unicode capture groups. */
+ var rsApos = "['\u2019]",
+ rsAstral = '[' + rsAstralRange + ']',
+ rsBreak = '[' + rsBreakRange + ']',
+ rsCombo = '[' + rsComboRange + ']',
+ rsDigits = '\\d+',
+ rsDingbat = '[' + rsDingbatRange + ']',
+ rsLower = '[' + rsLowerRange + ']',
+ rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
+ rsFitz = '\\ud83c[\\udffb-\\udfff]',
+ rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
+ rsNonAstral = '[^' + rsAstralRange + ']',
+ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
+ rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
+ rsUpper = '[' + rsUpperRange + ']',
+ rsZWJ = '\\u200d';
+
+ /** Used to compose unicode regexes. */
+ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
+ rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
+ rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
+ rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
+ reOptMod = rsModifier + '?',
+ rsOptVar = '[' + rsVarRange + ']?',
+ rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
+ rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
+ rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
+ rsSeq = rsOptVar + reOptMod + rsOptJoin,
+ rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
+ rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+
+ /** Used to match apostrophes. */
+ var reApos = RegExp(rsApos, 'g');
+
+ /**
+ * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
+ * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
+ */
+ var reComboMark = RegExp(rsCombo, 'g');
+
+ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
+ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
+
+ /** Used to match complex or compound words. */
+ var reUnicodeWord = RegExp([
+ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
+ rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
+ rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
+ rsUpper + '+' + rsOptContrUpper,
+ rsOrdUpper,
+ rsOrdLower,
+ rsDigits,
+ rsEmoji
+ ].join('|'), 'g');
+
+ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
+ var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
+
+ /** Used to detect strings that need a more robust regexp to match words. */
+ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
+
+ /** Used to assign default `context` object properties. */
+ var contextProps = [
+ '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'
+ ];
+
+ /** Used to make template sourceURLs easier to identify. */
+ var templateCounter = -1;
+
+ /** Used to identify `toStringTag` values of typed arrays. */
+ var typedArrayTags = {};
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
+ typedArrayTags[uint32Tag] = true;
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
+ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
+ typedArrayTags[weakMapTag] = false;
+
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
+ var cloneableTags = {};
+ cloneableTags[argsTag] = cloneableTags[arrayTag] =
+ cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
+ cloneableTags[boolTag] = cloneableTags[dateTag] =
+ cloneableTags[float32Tag] = cloneableTags[float64Tag] =
+ cloneableTags[int8Tag] = cloneableTags[int16Tag] =
+ cloneableTags[int32Tag] = cloneableTags[mapTag] =
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
+ cloneableTags[regexpTag] = cloneableTags[setTag] =
+ cloneableTags[stringTag] = cloneableTags[symbolTag] =
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
+ cloneableTags[errorTag] = cloneableTags[funcTag] =
+ cloneableTags[weakMapTag] = false;
+
+ /** Used to map Latin Unicode letters to basic Latin letters. */
+ var deburredLetters = {
+ // Latin-1 Supplement block.
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+ '\xc7': 'C', '\xe7': 'c',
+ '\xd0': 'D', '\xf0': 'd',
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+ '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+ '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
+ '\xd1': 'N', '\xf1': 'n',
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
+ '\xc6': 'Ae', '\xe6': 'ae',
+ '\xde': 'Th', '\xfe': 'th',
+ '\xdf': 'ss',
+ // Latin Extended-A block.
+ '\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'
+ };
+
+ /** Used to map characters to HTML entities. */
+ var htmlEscapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ };
+
+ /** Used to map HTML entities to characters. */
+ var htmlUnescapes = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ ''': "'"
+ };
+
+ /** Used to escape characters for inclusion in compiled string literals. */
+ var stringEscapes = {
+ '\\': '\\',
+ "'": "'",
+ '\n': 'n',
+ '\r': 'r',
+ '\u2028': 'u2028',
+ '\u2029': 'u2029'
+ };
+
+ /** Built-in method references without a dependency on `root`. */
+ var freeParseFloat = parseFloat,
+ freeParseInt = parseInt;
+
+ /** Detect free variable `global` from Node.js. */
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
+
+ /** Detect free variable `self`. */
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+ /** Used as a reference to the global object. */
+ var root = freeGlobal || freeSelf || Function('return this')();
+
+ /** Detect free variable `exports`. */
+ var freeExports = exports && !exports.nodeType && exports;
+
+ /** Detect free variable `module`. */
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
+
+ /** Detect the popular CommonJS extension `module.exports`. */
+ var moduleExports = freeModule && freeModule.exports === freeExports;
+
+ /** Detect free variable `process` from Node.js. */
+ var freeProcess = moduleExports && freeGlobal.process;
+
+ /** Used to access faster Node.js helpers. */
+ var nodeUtil = (function() {
+ try {
+ // Use `util.types` for Node.js 10+.
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
+
+ if (types) {
+ return types;
+ }
+
+ // Legacy `process.binding('util')` for Node.js < 10.
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
+ } catch (e) {}
+ }());
+
+ /* Node.js helper references. */
+ var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
+ nodeIsDate = nodeUtil && nodeUtil.isDate,
+ nodeIsMap = nodeUtil && nodeUtil.isMap,
+ nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
+ nodeIsSet = nodeUtil && nodeUtil.isSet,
+ nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * A faster alternative to `Function#apply`, this function invokes `func`
+ * with the `this` binding of `thisArg` and the arguments of `args`.
+ *
+ * @private
+ * @param {Function} func The function to invoke.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {Array} args The arguments to invoke `func` with.
+ * @returns {*} Returns the result of `func`.
+ */
+ function apply(func, thisArg, args) {
+ switch (args.length) {
+ case 0: return func.call(thisArg);
+ case 1: return func.call(thisArg, args[0]);
+ case 2: return func.call(thisArg, args[0], args[1]);
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
+ }
+ return func.apply(thisArg, args);
+ }
+
+ /**
+ * A specialized version of `baseAggregator` for arrays.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} setter The function to set `accumulator` values.
+ * @param {Function} iteratee The iteratee to transform keys.
+ * @param {Object} accumulator The initial aggregated object.
+ * @returns {Function} Returns `accumulator`.
+ */
+ function arrayAggregator(array, setter, iteratee, accumulator) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ var value = array[index];
+ setter(accumulator, value, iteratee(value), array);
+ }
+ return accumulator;
+ }
+
+ /**
+ * A specialized version of `_.forEach` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEach(array, iteratee) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (iteratee(array[index], index, array) === false) {
+ break;
+ }
+ }
+ return array;
+ }
+
+ /**
+ * A specialized version of `_.forEachRight` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEachRight(array, iteratee) {
+ var length = array == null ? 0 : array.length;
+
+ while (length--) {
+ if (iteratee(array[length], length, array) === false) {
+ break;
+ }
+ }
+ return array;
+ }
+
+ /**
+ * A specialized version of `_.every` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
+ */
+ function arrayEvery(array, predicate) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (!predicate(array[index], index, array)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * A specialized version of `_.filter` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {Array} Returns the new filtered array.
+ */
+ function arrayFilter(array, predicate) {
+ var index = -1,
+ length = array == null ? 0 : array.length,
+ resIndex = 0,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index];
+ if (predicate(value, index, array)) {
+ result[resIndex++] = value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * A specialized version of `_.includes` for arrays without support for
+ * specifying an index to search from.
+ *
+ * @private
+ * @param {Array} [array] The array to inspect.
+ * @param {*} target The value to search for.
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
+ */
+ function arrayIncludes(array, value) {
+ var length = array == null ? 0 : array.length;
+ return !!length && baseIndexOf(array, value, 0) > -1;
+ }
+
+ /**
+ * This function is like `arrayIncludes` except that it accepts a comparator.
+ *
+ * @private
+ * @param {Array} [array] The array to inspect.
+ * @param {*} target The value to search for.
+ * @param {Function} comparator The comparator invoked per element.
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
+ */
+ function arrayIncludesWith(array, value, comparator) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (comparator(value, array[index])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * A specialized version of `_.map` for arrays without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+ function arrayMap(array, iteratee) {
+ var index = -1,
+ length = array == null ? 0 : array.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = iteratee(array[index], index, array);
+ }
+ return result;
+ }
+
+ /**
+ * Appends the elements of `values` to `array`.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to append.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayPush(array, values) {
+ var index = -1,
+ length = values.length,
+ offset = array.length;
+
+ while (++index < length) {
+ array[offset + index] = values[index];
+ }
+ return array;
+ }
+
+ /**
+ * A specialized version of `_.reduce` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
+ * the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+ function arrayReduce(array, iteratee, accumulator, initAccum) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ if (initAccum && length) {
+ accumulator = array[++index];
+ }
+ while (++index < length) {
+ accumulator = iteratee(accumulator, array[index], index, array);
+ }
+ return accumulator;
+ }
+
+ /**
+ * A specialized version of `_.reduceRight` for arrays without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @param {boolean} [initAccum] Specify using the last element of `array` as
+ * the initial value.
+ * @returns {*} Returns the accumulated value.
+ */
+ function arrayReduceRight(array, iteratee, accumulator, initAccum) {
+ var length = array == null ? 0 : array.length;
+ if (initAccum && length) {
+ accumulator = array[--length];
+ }
+ while (length--) {
+ accumulator = iteratee(accumulator, array[length], length, array);
+ }
+ return accumulator;
+ }
+
+ /**
+ * A specialized version of `_.some` for arrays without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} [array] The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
+ */
+ function arraySome(array, predicate) {
+ var index = -1,
+ length = array == null ? 0 : array.length;
+
+ while (++index < length) {
+ if (predicate(array[index], index, array)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Gets the size of an ASCII `string`.
+ *
+ * @private
+ * @param {string} string The string inspect.
+ * @returns {number} Returns the string size.
+ */
+ var asciiSize = baseProperty('length');
+
+ /**
+ * Converts an ASCII `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function asciiToArray(string) {
+ return string.split('');
+ }
+
+ /**
+ * Splits an ASCII `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+ function asciiWords(string) {
+ return string.match(reAsciiWord) || [];
+ }
+
+ /**
+ * The base implementation of methods like `_.findKey` and `_.findLastKey`,
+ * without support for iteratee shorthands, which iterates over `collection`
+ * using `eachFunc`.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to inspect.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {Function} eachFunc The function to iterate over `collection`.
+ * @returns {*} Returns the found element or its key, else `undefined`.
+ */
+ function baseFindKey(collection, predicate, eachFunc) {
+ var result;
+ eachFunc(collection, function(value, key, collection) {
+ if (predicate(value, key, collection)) {
+ result = key;
+ return false;
+ }
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
+ * support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {number} fromIndex The index to search from.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
+ var length = array.length,
+ index = fromIndex + (fromRight ? 1 : -1);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ if (predicate(array[index], index, array)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseIndexOf(array, value, fromIndex) {
+ return value === value
+ ? strictIndexOf(array, value, fromIndex)
+ : baseFindIndex(array, baseIsNaN, fromIndex);
+ }
+
+ /**
+ * This function is like `baseIndexOf` except that it accepts a comparator.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @param {Function} comparator The comparator invoked per element.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseIndexOfWith(array, value, fromIndex, comparator) {
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (comparator(array[index], value)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * The base implementation of `_.isNaN` without support for number objects.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ */
+ function baseIsNaN(value) {
+ return value !== value;
+ }
+
+ /**
+ * The base implementation of `_.mean` and `_.meanBy` without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the mean.
+ */
+ function baseMean(array, iteratee) {
+ var length = array == null ? 0 : array.length;
+ return length ? (baseSum(array, iteratee) / length) : NAN;
+ }
+
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined$1 : object[key];
+ };
+ }
+
+ /**
+ * The base implementation of `_.propertyOf` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function basePropertyOf(object) {
+ return function(key) {
+ return object == null ? undefined$1 : object[key];
+ };
+ }
+
+ /**
+ * The base implementation of `_.reduce` and `_.reduceRight`, without support
+ * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {*} accumulator The initial value.
+ * @param {boolean} initAccum Specify using the first or last element of
+ * `collection` as the initial value.
+ * @param {Function} eachFunc The function to iterate over `collection`.
+ * @returns {*} Returns the accumulated value.
+ */
+ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
+ eachFunc(collection, function(value, index, collection) {
+ accumulator = initAccum
+ ? (initAccum = false, value)
+ : iteratee(accumulator, value, index, collection);
+ });
+ return accumulator;
+ }
+
+ /**
+ * The base implementation of `_.sortBy` which uses `comparer` to define the
+ * sort order of `array` and replaces criteria objects with their corresponding
+ * values.
+ *
+ * @private
+ * @param {Array} array The array to sort.
+ * @param {Function} comparer The function to define sort order.
+ * @returns {Array} Returns `array`.
+ */
+ function baseSortBy(array, comparer) {
+ var length = array.length;
+
+ array.sort(comparer);
+ while (length--) {
+ array[length] = array[length].value;
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.sum` and `_.sumBy` without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the sum.
+ */
+ function baseSum(array, iteratee) {
+ var result,
+ index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ var current = iteratee(array[index]);
+ if (current !== undefined$1) {
+ result = result === undefined$1 ? current : (result + current);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.times` without support for iteratee shorthands
+ * or max array length checks.
+ *
+ * @private
+ * @param {number} n The number of times to invoke `iteratee`.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the array of results.
+ */
+ function baseTimes(n, iteratee) {
+ var index = -1,
+ result = Array(n);
+
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
+ * of key-value pairs for `object` corresponding to the property names of `props`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} props The property names to get values for.
+ * @returns {Object} Returns the key-value pairs.
+ */
+ function baseToPairs(object, props) {
+ return arrayMap(props, function(key) {
+ return [key, object[key]];
+ });
+ }
+
+ /**
+ * The base implementation of `_.trim`.
+ *
+ * @private
+ * @param {string} string The string to trim.
+ * @returns {string} Returns the trimmed string.
+ */
+ function baseTrim(string) {
+ return string
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
+ : string;
+ }
+
+ /**
+ * The base implementation of `_.unary` without support for storing metadata.
+ *
+ * @private
+ * @param {Function} func The function to cap arguments for.
+ * @returns {Function} Returns the new capped function.
+ */
+ function baseUnary(func) {
+ return function(value) {
+ return func(value);
+ };
+ }
+
+ /**
+ * The base implementation of `_.values` and `_.valuesIn` which creates an
+ * array of `object` property values corresponding to the property names
+ * of `props`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} props The property names to get values for.
+ * @returns {Object} Returns the array of property values.
+ */
+ function baseValues(object, props) {
+ return arrayMap(props, function(key) {
+ return object[key];
+ });
+ }
+
+ /**
+ * Checks if a `cache` value for `key` exists.
+ *
+ * @private
+ * @param {Object} cache The cache to query.
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function cacheHas(cache, key) {
+ return cache.has(key);
+ }
+
+ /**
+ * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
+ * that is not found in the character symbols.
+ *
+ * @private
+ * @param {Array} strSymbols The string symbols to inspect.
+ * @param {Array} chrSymbols The character symbols to find.
+ * @returns {number} Returns the index of the first unmatched string symbol.
+ */
+ function charsStartIndex(strSymbols, chrSymbols) {
+ var index = -1,
+ length = strSymbols.length;
+
+ while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+ return index;
+ }
+
+ /**
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
+ * that is not found in the character symbols.
+ *
+ * @private
+ * @param {Array} strSymbols The string symbols to inspect.
+ * @param {Array} chrSymbols The character symbols to find.
+ * @returns {number} Returns the index of the last unmatched string symbol.
+ */
+ function charsEndIndex(strSymbols, chrSymbols) {
+ var index = strSymbols.length;
+
+ while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
+ return index;
+ }
+
+ /**
+ * Gets the number of `placeholder` occurrences in `array`.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} placeholder The placeholder to search for.
+ * @returns {number} Returns the placeholder count.
+ */
+ function countHolders(array, placeholder) {
+ var length = array.length,
+ result = 0;
+
+ while (length--) {
+ if (array[length] === placeholder) {
+ ++result;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
+ * letters to basic Latin letters.
+ *
+ * @private
+ * @param {string} letter The matched letter to deburr.
+ * @returns {string} Returns the deburred letter.
+ */
+ var deburrLetter = basePropertyOf(deburredLetters);
+
+ /**
+ * Used by `_.escape` to convert characters to HTML entities.
+ *
+ * @private
+ * @param {string} chr The matched character to escape.
+ * @returns {string} Returns the escaped character.
+ */
+ var escapeHtmlChar = basePropertyOf(htmlEscapes);
+
+ /**
+ * Used by `_.template` to escape characters for inclusion in compiled string literals.
+ *
+ * @private
+ * @param {string} chr The matched character to escape.
+ * @returns {string} Returns the escaped character.
+ */
+ function escapeStringChar(chr) {
+ return '\\' + stringEscapes[chr];
+ }
+
+ /**
+ * Gets the value at `key` of `object`.
+ *
+ * @private
+ * @param {Object} [object] The object to query.
+ * @param {string} key The key of the property to get.
+ * @returns {*} Returns the property value.
+ */
+ function getValue(object, key) {
+ return object == null ? undefined$1 : object[key];
+ }
+
+ /**
+ * Checks if `string` contains Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
+ */
+ function hasUnicode(string) {
+ return reHasUnicode.test(string);
+ }
+
+ /**
+ * Checks if `string` contains a word composed of Unicode symbols.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {boolean} Returns `true` if a word is found, else `false`.
+ */
+ function hasUnicodeWord(string) {
+ return reHasUnicodeWord.test(string);
+ }
+
+ /**
+ * Converts `iterator` to an array.
+ *
+ * @private
+ * @param {Object} iterator The iterator to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function iteratorToArray(iterator) {
+ var data,
+ result = [];
+
+ while (!(data = iterator.next()).done) {
+ result.push(data.value);
+ }
+ return result;
+ }
+
+ /**
+ * Converts `map` to its key-value pairs.
+ *
+ * @private
+ * @param {Object} map The map to convert.
+ * @returns {Array} Returns the key-value pairs.
+ */
+ function mapToArray(map) {
+ var index = -1,
+ result = Array(map.size);
+
+ map.forEach(function(value, key) {
+ result[++index] = [key, value];
+ });
+ return result;
+ }
+
+ /**
+ * Creates a unary function that invokes `func` with its argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+ function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+ }
+
+ /**
+ * Replaces all `placeholder` elements in `array` with an internal placeholder
+ * and returns an array of their indexes.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {*} placeholder The placeholder to replace.
+ * @returns {Array} Returns the new array of placeholder indexes.
+ */
+ function replaceHolders(array, placeholder) {
+ var index = -1,
+ length = array.length,
+ resIndex = 0,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index];
+ if (value === placeholder || value === PLACEHOLDER) {
+ array[index] = PLACEHOLDER;
+ result[resIndex++] = index;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Converts `set` to an array of its values.
+ *
+ * @private
+ * @param {Object} set The set to convert.
+ * @returns {Array} Returns the values.
+ */
+ function setToArray(set) {
+ var index = -1,
+ result = Array(set.size);
+
+ set.forEach(function(value) {
+ result[++index] = value;
+ });
+ return result;
+ }
+
+ /**
+ * Converts `set` to its value-value pairs.
+ *
+ * @private
+ * @param {Object} set The set to convert.
+ * @returns {Array} Returns the value-value pairs.
+ */
+ function setToPairs(set) {
+ var index = -1,
+ result = Array(set.size);
+
+ set.forEach(function(value) {
+ result[++index] = [value, value];
+ });
+ return result;
+ }
+
+ /**
+ * A specialized version of `_.indexOf` which performs strict equality
+ * comparisons of values, i.e. `===`.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function strictIndexOf(array, value, fromIndex) {
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * A specialized version of `_.lastIndexOf` which performs strict equality
+ * comparisons of values, i.e. `===`.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function strictLastIndexOf(array, value, fromIndex) {
+ var index = fromIndex + 1;
+ while (index--) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return index;
+ }
+
+ /**
+ * Gets the number of symbols in `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the string size.
+ */
+ function stringSize(string) {
+ return hasUnicode(string)
+ ? unicodeSize(string)
+ : asciiSize(string);
+ }
+
+ /**
+ * Converts `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function stringToArray(string) {
+ return hasUnicode(string)
+ ? unicodeToArray(string)
+ : asciiToArray(string);
+ }
+
+ /**
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
+ * character of `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the index of the last non-whitespace character.
+ */
+ function trimmedEndIndex(string) {
+ var index = string.length;
+
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
+ return index;
+ }
+
+ /**
+ * Used by `_.unescape` to convert HTML entities to characters.
+ *
+ * @private
+ * @param {string} chr The matched character to unescape.
+ * @returns {string} Returns the unescaped character.
+ */
+ var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
+
+ /**
+ * Gets the size of a Unicode `string`.
+ *
+ * @private
+ * @param {string} string The string inspect.
+ * @returns {number} Returns the string size.
+ */
+ function unicodeSize(string) {
+ var result = reUnicode.lastIndex = 0;
+ while (reUnicode.test(string)) {
+ ++result;
+ }
+ return result;
+ }
+
+ /**
+ * Converts a Unicode `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function unicodeToArray(string) {
+ return string.match(reUnicode) || [];
+ }
+
+ /**
+ * Splits a Unicode `string` into an array of its words.
+ *
+ * @private
+ * @param {string} The string to inspect.
+ * @returns {Array} Returns the words of `string`.
+ */
+ function unicodeWords(string) {
+ return string.match(reUnicodeWord) || [];
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Create a new pristine `lodash` function using the `context` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.1.0
+ * @category Util
+ * @param {Object} [context=root] The context object.
+ * @returns {Function} Returns a new `lodash` function.
+ * @example
+ *
+ * _.mixin({ 'foo': _.constant('foo') });
+ *
+ * var lodash = _.runInContext();
+ * lodash.mixin({ 'bar': lodash.constant('bar') });
+ *
+ * _.isFunction(_.foo);
+ * // => true
+ * _.isFunction(_.bar);
+ * // => false
+ *
+ * lodash.isFunction(lodash.foo);
+ * // => false
+ * lodash.isFunction(lodash.bar);
+ * // => true
+ *
+ * // Create a suped-up `defer` in Node.js.
+ * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
+ */
+ var runInContext = (function runInContext(context) {
+ context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
+
+ /** Built-in constructor references. */
+ var Array = context.Array,
+ Date = context.Date,
+ Error = context.Error,
+ Function = context.Function,
+ Math = context.Math,
+ Object = context.Object,
+ RegExp = context.RegExp,
+ String = context.String,
+ TypeError = context.TypeError;
+
+ /** Used for built-in method references. */
+ var arrayProto = Array.prototype,
+ funcProto = Function.prototype,
+ objectProto = Object.prototype;
+
+ /** Used to detect overreaching core-js shims. */
+ var coreJsData = context['__core-js_shared__'];
+
+ /** Used to resolve the decompiled source of functions. */
+ var funcToString = funcProto.toString;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /** Used to generate unique IDs. */
+ var idCounter = 0;
+
+ /** Used to detect methods masquerading as native. */
+ var maskSrcKey = (function() {
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
+ return uid ? ('Symbol(src)_1.' + uid) : '';
+ }());
+
+ /**
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var nativeObjectToString = objectProto.toString;
+
+ /** Used to infer the `Object` constructor. */
+ var objectCtorString = funcToString.call(Object);
+
+ /** Used to restore the original `_` reference in `_.noConflict`. */
+ var oldDash = root._;
+
+ /** Used to detect if a method is native. */
+ var reIsNative = RegExp('^' +
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
+ );
+
+ /** Built-in value references. */
+ var Buffer = moduleExports ? context.Buffer : undefined$1,
+ Symbol = context.Symbol,
+ Uint8Array = context.Uint8Array,
+ allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1,
+ getPrototype = overArg(Object.getPrototypeOf, Object),
+ objectCreate = Object.create,
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
+ splice = arrayProto.splice,
+ spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined$1,
+ symIterator = Symbol ? Symbol.iterator : undefined$1,
+ symToStringTag = Symbol ? Symbol.toStringTag : undefined$1;
+
+ var defineProperty = (function() {
+ try {
+ var func = getNative(Object, 'defineProperty');
+ func({}, '', {});
+ return func;
+ } catch (e) {}
+ }());
+
+ /** Mocked built-ins. */
+ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
+ ctxNow = Date && Date.now !== root.Date.now && Date.now,
+ ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
+
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeCeil = Math.ceil,
+ nativeFloor = Math.floor,
+ nativeGetSymbols = Object.getOwnPropertySymbols,
+ nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined$1,
+ nativeIsFinite = context.isFinite,
+ nativeJoin = arrayProto.join,
+ nativeKeys = overArg(Object.keys, Object),
+ nativeMax = Math.max,
+ nativeMin = Math.min,
+ nativeNow = Date.now,
+ nativeParseInt = context.parseInt,
+ nativeRandom = Math.random,
+ nativeReverse = arrayProto.reverse;
+
+ /* Built-in method references that are verified to be native. */
+ var DataView = getNative(context, 'DataView'),
+ Map = getNative(context, 'Map'),
+ Promise = getNative(context, 'Promise'),
+ Set = getNative(context, 'Set'),
+ WeakMap = getNative(context, 'WeakMap'),
+ nativeCreate = getNative(Object, 'create');
+
+ /** Used to store function metadata. */
+ var metaMap = WeakMap && new WeakMap;
+
+ /** Used to lookup unminified function names. */
+ var realNames = {};
+
+ /** Used to detect maps, sets, and weakmaps. */
+ var dataViewCtorString = toSource(DataView),
+ mapCtorString = toSource(Map),
+ promiseCtorString = toSource(Promise),
+ setCtorString = toSource(Set),
+ weakMapCtorString = toSource(WeakMap);
+
+ /** Used to convert symbols to primitives and strings. */
+ var symbolProto = Symbol ? Symbol.prototype : undefined$1,
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1,
+ symbolToString = symbolProto ? symbolProto.toString : undefined$1;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a `lodash` object which wraps `value` to enable implicit method
+ * chain sequences. Methods that operate on and return arrays, collections,
+ * and functions can be chained together. Methods that retrieve a single value
+ * or may return a primitive value will automatically end the chain sequence
+ * and return the unwrapped value. Otherwise, the value must be unwrapped
+ * with `_#value`.
+ *
+ * Explicit chain sequences, which must be unwrapped with `_#value`, may be
+ * enabled using `_.chain`.
+ *
+ * The execution of chained methods is lazy, that is, it's deferred until
+ * `_#value` is implicitly or explicitly called.
+ *
+ * Lazy evaluation allows several methods to support shortcut fusion.
+ * Shortcut fusion is an optimization to merge iteratee calls; this avoids
+ * the creation of intermediate arrays and can greatly reduce the number of
+ * iteratee executions. Sections of a chain sequence qualify for shortcut
+ * fusion if the section is applied to an array and iteratees accept only
+ * one argument. The heuristic for whether a section qualifies for shortcut
+ * fusion is subject to change.
+ *
+ * Chaining is supported in custom builds as long as the `_#value` method is
+ * directly or indirectly included in the build.
+ *
+ * In addition to lodash methods, wrappers have `Array` and `String` methods.
+ *
+ * The wrapper `Array` methods are:
+ * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
+ *
+ * The wrapper `String` methods are:
+ * `replace` and `split`
+ *
+ * The wrapper methods that support shortcut fusion are:
+ * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
+ * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
+ * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
+ *
+ * The chainable wrapper methods are:
+ * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
+ * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
+ * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
+ * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
+ * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
+ * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
+ * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
+ * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
+ * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
+ * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
+ * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
+ * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
+ * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
+ * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
+ * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
+ * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
+ * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
+ * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
+ * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
+ * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
+ * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
+ * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
+ * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
+ * `zipObject`, `zipObjectDeep`, and `zipWith`
+ *
+ * The wrapper methods that are **not** chainable by default are:
+ * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
+ * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+ * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
+ * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
+ * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
+ * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
+ * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
+ * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
+ * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
+ * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
+ * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
+ * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
+ * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
+ * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
+ * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
+ * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
+ * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
+ * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
+ * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
+ * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
+ * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
+ * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
+ * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
+ * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
+ * `upperFirst`, `value`, and `words`
+ *
+ * @name _
+ * @constructor
+ * @category Seq
+ * @param {*} value The value to wrap in a `lodash` instance.
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * var wrapped = _([1, 2, 3]);
+ *
+ * // Returns an unwrapped value.
+ * wrapped.reduce(_.add);
+ * // => 6
+ *
+ * // Returns a wrapped value.
+ * var squares = wrapped.map(square);
+ *
+ * _.isArray(squares);
+ * // => false
+ *
+ * _.isArray(squares.value());
+ * // => true
+ */
+ function lodash(value) {
+ if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
+ if (value instanceof LodashWrapper) {
+ return value;
+ }
+ if (hasOwnProperty.call(value, '__wrapped__')) {
+ return wrapperClone(value);
+ }
+ }
+ return new LodashWrapper(value);
+ }
+
+ /**
+ * The base implementation of `_.create` without support for assigning
+ * properties to the created object.
+ *
+ * @private
+ * @param {Object} proto The object to inherit from.
+ * @returns {Object} Returns the new object.
+ */
+ var baseCreate = (function() {
+ function object() {}
+ return function(proto) {
+ if (!isObject(proto)) {
+ return {};
+ }
+ if (objectCreate) {
+ return objectCreate(proto);
+ }
+ object.prototype = proto;
+ var result = new object;
+ object.prototype = undefined$1;
+ return result;
+ };
+ }());
+
+ /**
+ * The function whose prototype chain sequence wrappers inherit from.
+ *
+ * @private
+ */
+ function baseLodash() {
+ // No operation performed.
+ }
+
+ /**
+ * The base constructor for creating `lodash` wrapper objects.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ * @param {boolean} [chainAll] Enable explicit method chain sequences.
+ */
+ function LodashWrapper(value, chainAll) {
+ this.__wrapped__ = value;
+ this.__actions__ = [];
+ this.__chain__ = !!chainAll;
+ this.__index__ = 0;
+ this.__values__ = undefined$1;
+ }
+
+ /**
+ * By default, the template delimiters used by lodash are like those in
+ * embedded Ruby (ERB) as well as ES2015 template strings. Change the
+ * following template settings to use alternative delimiters.
+ *
+ * @static
+ * @memberOf _
+ * @type {Object}
+ */
+ lodash.templateSettings = {
+
+ /**
+ * Used to detect `data` property values to be HTML-escaped.
+ *
+ * @memberOf _.templateSettings
+ * @type {RegExp}
+ */
+ 'escape': reEscape,
+
+ /**
+ * Used to detect code to be evaluated.
+ *
+ * @memberOf _.templateSettings
+ * @type {RegExp}
+ */
+ 'evaluate': reEvaluate,
+
+ /**
+ * Used to detect `data` property values to inject.
+ *
+ * @memberOf _.templateSettings
+ * @type {RegExp}
+ */
+ 'interpolate': reInterpolate,
+
+ /**
+ * Used to reference the data object in the template text.
+ *
+ * @memberOf _.templateSettings
+ * @type {string}
+ */
+ 'variable': '',
+
+ /**
+ * Used to import variables into the compiled template.
+ *
+ * @memberOf _.templateSettings
+ * @type {Object}
+ */
+ 'imports': {
+
+ /**
+ * A reference to the `lodash` function.
+ *
+ * @memberOf _.templateSettings.imports
+ * @type {Function}
+ */
+ '_': lodash
+ }
+ };
+
+ // Ensure wrappers are instances of `baseLodash`.
+ lodash.prototype = baseLodash.prototype;
+ lodash.prototype.constructor = lodash;
+
+ LodashWrapper.prototype = baseCreate(baseLodash.prototype);
+ LodashWrapper.prototype.constructor = LodashWrapper;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
+ *
+ * @private
+ * @constructor
+ * @param {*} value The value to wrap.
+ */
+ function LazyWrapper(value) {
+ this.__wrapped__ = value;
+ this.__actions__ = [];
+ this.__dir__ = 1;
+ this.__filtered__ = false;
+ this.__iteratees__ = [];
+ this.__takeCount__ = MAX_ARRAY_LENGTH;
+ this.__views__ = [];
+ }
+
+ /**
+ * Creates a clone of the lazy wrapper object.
+ *
+ * @private
+ * @name clone
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the cloned `LazyWrapper` object.
+ */
+ function lazyClone() {
+ var result = new LazyWrapper(this.__wrapped__);
+ result.__actions__ = copyArray(this.__actions__);
+ result.__dir__ = this.__dir__;
+ result.__filtered__ = this.__filtered__;
+ result.__iteratees__ = copyArray(this.__iteratees__);
+ result.__takeCount__ = this.__takeCount__;
+ result.__views__ = copyArray(this.__views__);
+ return result;
+ }
+
+ /**
+ * Reverses the direction of lazy iteration.
+ *
+ * @private
+ * @name reverse
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the new reversed `LazyWrapper` object.
+ */
+ function lazyReverse() {
+ if (this.__filtered__) {
+ var result = new LazyWrapper(this);
+ result.__dir__ = -1;
+ result.__filtered__ = true;
+ } else {
+ result = this.clone();
+ result.__dir__ *= -1;
+ }
+ return result;
+ }
+
+ /**
+ * Extracts the unwrapped value from its lazy wrapper.
+ *
+ * @private
+ * @name value
+ * @memberOf LazyWrapper
+ * @returns {*} Returns the unwrapped value.
+ */
+ function lazyValue() {
+ var array = this.__wrapped__.value(),
+ dir = this.__dir__,
+ isArr = isArray(array),
+ isRight = dir < 0,
+ arrLength = isArr ? array.length : 0,
+ view = getView(0, arrLength, this.__views__),
+ start = view.start,
+ end = view.end,
+ length = end - start,
+ index = isRight ? end : (start - 1),
+ iteratees = this.__iteratees__,
+ iterLength = iteratees.length,
+ resIndex = 0,
+ takeCount = nativeMin(length, this.__takeCount__);
+
+ if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
+ return baseWrapperValue(array, this.__actions__);
+ }
+ var result = [];
+
+ outer:
+ while (length-- && resIndex < takeCount) {
+ index += dir;
+
+ var iterIndex = -1,
+ value = array[index];
+
+ while (++iterIndex < iterLength) {
+ var data = iteratees[iterIndex],
+ iteratee = data.iteratee,
+ type = data.type,
+ computed = iteratee(value);
+
+ if (type == LAZY_MAP_FLAG) {
+ value = computed;
+ } else if (!computed) {
+ if (type == LAZY_FILTER_FLAG) {
+ continue outer;
+ } else {
+ break outer;
+ }
+ }
+ }
+ result[resIndex++] = value;
+ }
+ return result;
+ }
+
+ // Ensure `LazyWrapper` is an instance of `baseLodash`.
+ LazyWrapper.prototype = baseCreate(baseLodash.prototype);
+ LazyWrapper.prototype.constructor = LazyWrapper;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a hash object.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function Hash(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the hash.
+ *
+ * @private
+ * @name clear
+ * @memberOf Hash
+ */
+ function hashClear() {
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
+ this.size = 0;
+ }
+
+ /**
+ * Removes `key` and its value from the hash.
+ *
+ * @private
+ * @name delete
+ * @memberOf Hash
+ * @param {Object} hash The hash to modify.
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function hashDelete(key) {
+ var result = this.has(key) && delete this.__data__[key];
+ this.size -= result ? 1 : 0;
+ return result;
+ }
+
+ /**
+ * Gets the hash value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf Hash
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function hashGet(key) {
+ var data = this.__data__;
+ if (nativeCreate) {
+ var result = data[key];
+ return result === HASH_UNDEFINED ? undefined$1 : result;
+ }
+ return hasOwnProperty.call(data, key) ? data[key] : undefined$1;
+ }
+
+ /**
+ * Checks if a hash value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf Hash
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function hashHas(key) {
+ var data = this.__data__;
+ return nativeCreate ? (data[key] !== undefined$1) : hasOwnProperty.call(data, key);
+ }
+
+ /**
+ * Sets the hash `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf Hash
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the hash instance.
+ */
+ function hashSet(key, value) {
+ var data = this.__data__;
+ this.size += this.has(key) ? 0 : 1;
+ data[key] = (nativeCreate && value === undefined$1) ? HASH_UNDEFINED : value;
+ return this;
+ }
+
+ // Add methods to `Hash`.
+ Hash.prototype.clear = hashClear;
+ Hash.prototype['delete'] = hashDelete;
+ Hash.prototype.get = hashGet;
+ Hash.prototype.has = hashHas;
+ Hash.prototype.set = hashSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an list cache object.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function ListCache(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the list cache.
+ *
+ * @private
+ * @name clear
+ * @memberOf ListCache
+ */
+ function listCacheClear() {
+ this.__data__ = [];
+ this.size = 0;
+ }
+
+ /**
+ * Removes `key` and its value from the list cache.
+ *
+ * @private
+ * @name delete
+ * @memberOf ListCache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function listCacheDelete(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ return false;
+ }
+ var lastIndex = data.length - 1;
+ if (index == lastIndex) {
+ data.pop();
+ } else {
+ splice.call(data, index, 1);
+ }
+ --this.size;
+ return true;
+ }
+
+ /**
+ * Gets the list cache value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf ListCache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function listCacheGet(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ return index < 0 ? undefined$1 : data[index][1];
+ }
+
+ /**
+ * Checks if a list cache value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf ListCache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function listCacheHas(key) {
+ return assocIndexOf(this.__data__, key) > -1;
+ }
+
+ /**
+ * Sets the list cache `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf ListCache
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the list cache instance.
+ */
+ function listCacheSet(key, value) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ ++this.size;
+ data.push([key, value]);
+ } else {
+ data[index][1] = value;
+ }
+ return this;
+ }
+
+ // Add methods to `ListCache`.
+ ListCache.prototype.clear = listCacheClear;
+ ListCache.prototype['delete'] = listCacheDelete;
+ ListCache.prototype.get = listCacheGet;
+ ListCache.prototype.has = listCacheHas;
+ ListCache.prototype.set = listCacheSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a map cache object to store key-value pairs.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function MapCache(entries) {
+ var index = -1,
+ length = entries == null ? 0 : entries.length;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the map.
+ *
+ * @private
+ * @name clear
+ * @memberOf MapCache
+ */
+ function mapCacheClear() {
+ this.size = 0;
+ this.__data__ = {
+ 'hash': new Hash,
+ 'map': new (Map || ListCache),
+ 'string': new Hash
+ };
+ }
+
+ /**
+ * Removes `key` and its value from the map.
+ *
+ * @private
+ * @name delete
+ * @memberOf MapCache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function mapCacheDelete(key) {
+ var result = getMapData(this, key)['delete'](key);
+ this.size -= result ? 1 : 0;
+ return result;
+ }
+
+ /**
+ * Gets the map value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf MapCache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function mapCacheGet(key) {
+ return getMapData(this, key).get(key);
+ }
+
+ /**
+ * Checks if a map value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf MapCache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function mapCacheHas(key) {
+ return getMapData(this, key).has(key);
+ }
+
+ /**
+ * Sets the map `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf MapCache
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the map cache instance.
+ */
+ function mapCacheSet(key, value) {
+ var data = getMapData(this, key),
+ size = data.size;
+
+ data.set(key, value);
+ this.size += data.size == size ? 0 : 1;
+ return this;
+ }
+
+ // Add methods to `MapCache`.
+ MapCache.prototype.clear = mapCacheClear;
+ MapCache.prototype['delete'] = mapCacheDelete;
+ MapCache.prototype.get = mapCacheGet;
+ MapCache.prototype.has = mapCacheHas;
+ MapCache.prototype.set = mapCacheSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ *
+ * Creates an array cache object to store unique values.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [values] The values to cache.
+ */
+ function SetCache(values) {
+ var index = -1,
+ length = values == null ? 0 : values.length;
+
+ this.__data__ = new MapCache;
+ while (++index < length) {
+ this.add(values[index]);
+ }
+ }
+
+ /**
+ * Adds `value` to the array cache.
+ *
+ * @private
+ * @name add
+ * @memberOf SetCache
+ * @alias push
+ * @param {*} value The value to cache.
+ * @returns {Object} Returns the cache instance.
+ */
+ function setCacheAdd(value) {
+ this.__data__.set(value, HASH_UNDEFINED);
+ return this;
+ }
+
+ /**
+ * Checks if `value` is in the array cache.
+ *
+ * @private
+ * @name has
+ * @memberOf SetCache
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `true` if `value` is found, else `false`.
+ */
+ function setCacheHas(value) {
+ return this.__data__.has(value);
+ }
+
+ // Add methods to `SetCache`.
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
+ SetCache.prototype.has = setCacheHas;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a stack cache object to store key-value pairs.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function Stack(entries) {
+ var data = this.__data__ = new ListCache(entries);
+ this.size = data.size;
+ }
+
+ /**
+ * Removes all key-value entries from the stack.
+ *
+ * @private
+ * @name clear
+ * @memberOf Stack
+ */
+ function stackClear() {
+ this.__data__ = new ListCache;
+ this.size = 0;
+ }
+
+ /**
+ * Removes `key` and its value from the stack.
+ *
+ * @private
+ * @name delete
+ * @memberOf Stack
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function stackDelete(key) {
+ var data = this.__data__,
+ result = data['delete'](key);
+
+ this.size = data.size;
+ return result;
+ }
+
+ /**
+ * Gets the stack value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf Stack
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function stackGet(key) {
+ return this.__data__.get(key);
+ }
+
+ /**
+ * Checks if a stack value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf Stack
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function stackHas(key) {
+ return this.__data__.has(key);
+ }
+
+ /**
+ * Sets the stack `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf Stack
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the stack cache instance.
+ */
+ function stackSet(key, value) {
+ var data = this.__data__;
+ if (data instanceof ListCache) {
+ var pairs = data.__data__;
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
+ pairs.push([key, value]);
+ this.size = ++data.size;
+ return this;
+ }
+ data = this.__data__ = new MapCache(pairs);
+ }
+ data.set(key, value);
+ this.size = data.size;
+ return this;
+ }
+
+ // Add methods to `Stack`.
+ Stack.prototype.clear = stackClear;
+ Stack.prototype['delete'] = stackDelete;
+ Stack.prototype.get = stackGet;
+ Stack.prototype.has = stackHas;
+ Stack.prototype.set = stackSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an array of the enumerable property names of the array-like `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @param {boolean} inherited Specify returning inherited property names.
+ * @returns {Array} Returns the array of property names.
+ */
+ function arrayLikeKeys(value, inherited) {
+ var isArr = isArray(value),
+ isArg = !isArr && isArguments(value),
+ isBuff = !isArr && !isArg && isBuffer(value),
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
+ skipIndexes = isArr || isArg || isBuff || isType,
+ result = skipIndexes ? baseTimes(value.length, String) : [],
+ length = result.length;
+
+ for (var key in value) {
+ if ((inherited || hasOwnProperty.call(value, key)) &&
+ !(skipIndexes && (
+ // Safari 9 has enumerable `arguments.length` in strict mode.
+ key == 'length' ||
+ // Node.js 0.10 has enumerable non-index properties on buffers.
+ (isBuff && (key == 'offset' || key == 'parent')) ||
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
+ // Skip index properties.
+ isIndex(key, length)
+ ))) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * A specialized version of `_.sample` for arrays.
+ *
+ * @private
+ * @param {Array} array The array to sample.
+ * @returns {*} Returns the random element.
+ */
+ function arraySample(array) {
+ var length = array.length;
+ return length ? array[baseRandom(0, length - 1)] : undefined$1;
+ }
+
+ /**
+ * A specialized version of `_.sampleSize` for arrays.
+ *
+ * @private
+ * @param {Array} array The array to sample.
+ * @param {number} n The number of elements to sample.
+ * @returns {Array} Returns the random elements.
+ */
+ function arraySampleSize(array, n) {
+ return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
+ }
+
+ /**
+ * A specialized version of `_.shuffle` for arrays.
+ *
+ * @private
+ * @param {Array} array The array to shuffle.
+ * @returns {Array} Returns the new shuffled array.
+ */
+ function arrayShuffle(array) {
+ return shuffleSelf(copyArray(array));
+ }
+
+ /**
+ * This function is like `assignValue` except that it doesn't assign
+ * `undefined` values.
+ *
+ * @private
+ * @param {Object} object The object to modify.
+ * @param {string} key The key of the property to assign.
+ * @param {*} value The value to assign.
+ */
+ function assignMergeValue(object, key, value) {
+ if ((value !== undefined$1 && !eq(object[key], value)) ||
+ (value === undefined$1 && !(key in object))) {
+ baseAssignValue(object, key, value);
+ }
+ }
+
+ /**
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * @private
+ * @param {Object} object The object to modify.
+ * @param {string} key The key of the property to assign.
+ * @param {*} value The value to assign.
+ */
+ function assignValue(object, key, value) {
+ var objValue = object[key];
+ if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
+ (value === undefined$1 && !(key in object))) {
+ baseAssignValue(object, key, value);
+ }
+ }
+
+ /**
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {*} key The key to search for.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function assocIndexOf(array, key) {
+ var length = array.length;
+ while (length--) {
+ if (eq(array[length][0], key)) {
+ return length;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Aggregates elements of `collection` on `accumulator` with keys transformed
+ * by `iteratee` and values set by `setter`.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} setter The function to set `accumulator` values.
+ * @param {Function} iteratee The iteratee to transform keys.
+ * @param {Object} accumulator The initial aggregated object.
+ * @returns {Function} Returns `accumulator`.
+ */
+ function baseAggregator(collection, setter, iteratee, accumulator) {
+ baseEach(collection, function(value, key, collection) {
+ setter(accumulator, value, iteratee(value), collection);
+ });
+ return accumulator;
+ }
+
+ /**
+ * The base implementation of `_.assign` without support for multiple sources
+ * or `customizer` functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @returns {Object} Returns `object`.
+ */
+ function baseAssign(object, source) {
+ return object && copyObject(source, keys(source), object);
+ }
+
+ /**
+ * The base implementation of `_.assignIn` without support for multiple sources
+ * or `customizer` functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @returns {Object} Returns `object`.
+ */
+ function baseAssignIn(object, source) {
+ return object && copyObject(source, keysIn(source), object);
+ }
+
+ /**
+ * The base implementation of `assignValue` and `assignMergeValue` without
+ * value checks.
+ *
+ * @private
+ * @param {Object} object The object to modify.
+ * @param {string} key The key of the property to assign.
+ * @param {*} value The value to assign.
+ */
+ function baseAssignValue(object, key, value) {
+ if (key == '__proto__' && defineProperty) {
+ defineProperty(object, key, {
+ 'configurable': true,
+ 'enumerable': true,
+ 'value': value,
+ 'writable': true
+ });
+ } else {
+ object[key] = value;
+ }
+ }
+
+ /**
+ * The base implementation of `_.at` without support for individual paths.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {string[]} paths The property paths to pick.
+ * @returns {Array} Returns the picked elements.
+ */
+ function baseAt(object, paths) {
+ var index = -1,
+ length = paths.length,
+ result = Array(length),
+ skip = object == null;
+
+ while (++index < length) {
+ result[index] = skip ? undefined$1 : get(object, paths[index]);
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.clamp` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {number} number The number to clamp.
+ * @param {number} [lower] The lower bound.
+ * @param {number} upper The upper bound.
+ * @returns {number} Returns the clamped number.
+ */
+ function baseClamp(number, lower, upper) {
+ if (number === number) {
+ if (upper !== undefined$1) {
+ number = number <= upper ? number : upper;
+ }
+ if (lower !== undefined$1) {
+ number = number >= lower ? number : lower;
+ }
+ }
+ return number;
+ }
+
+ /**
+ * The base implementation of `_.clone` and `_.cloneDeep` which tracks
+ * traversed objects.
+ *
+ * @private
+ * @param {*} value The value to clone.
+ * @param {boolean} bitmask The bitmask flags.
+ * 1 - Deep clone
+ * 2 - Flatten inherited properties
+ * 4 - Clone symbols
+ * @param {Function} [customizer] The function to customize cloning.
+ * @param {string} [key] The key of `value`.
+ * @param {Object} [object] The parent object of `value`.
+ * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
+ * @returns {*} Returns the cloned value.
+ */
+ function baseClone(value, bitmask, customizer, key, object, stack) {
+ var result,
+ isDeep = bitmask & CLONE_DEEP_FLAG,
+ isFlat = bitmask & CLONE_FLAT_FLAG,
+ isFull = bitmask & CLONE_SYMBOLS_FLAG;
+
+ if (customizer) {
+ result = object ? customizer(value, key, object, stack) : customizer(value);
+ }
+ if (result !== undefined$1) {
+ return result;
+ }
+ if (!isObject(value)) {
+ return value;
+ }
+ var isArr = isArray(value);
+ if (isArr) {
+ result = initCloneArray(value);
+ if (!isDeep) {
+ return copyArray(value, result);
+ }
+ } else {
+ var tag = getTag(value),
+ isFunc = tag == funcTag || tag == genTag;
+
+ if (isBuffer(value)) {
+ return cloneBuffer(value, isDeep);
+ }
+ if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
+ result = (isFlat || isFunc) ? {} : initCloneObject(value);
+ if (!isDeep) {
+ return isFlat
+ ? copySymbolsIn(value, baseAssignIn(result, value))
+ : copySymbols(value, baseAssign(result, value));
+ }
+ } else {
+ if (!cloneableTags[tag]) {
+ return object ? value : {};
+ }
+ result = initCloneByTag(value, tag, isDeep);
+ }
+ }
+ // Check for circular references and return its corresponding clone.
+ stack || (stack = new Stack);
+ var stacked = stack.get(value);
+ if (stacked) {
+ return stacked;
+ }
+ stack.set(value, result);
+
+ if (isSet(value)) {
+ value.forEach(function(subValue) {
+ result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
+ });
+ } else if (isMap(value)) {
+ value.forEach(function(subValue, key) {
+ result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
+ });
+ }
+
+ var keysFunc = isFull
+ ? (isFlat ? getAllKeysIn : getAllKeys)
+ : (isFlat ? keysIn : keys);
+
+ var props = isArr ? undefined$1 : keysFunc(value);
+ arrayEach(props || value, function(subValue, key) {
+ if (props) {
+ key = subValue;
+ subValue = value[key];
+ }
+ // Recursively populate clone (susceptible to call stack limits).
+ assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.conforms` which doesn't clone `source`.
+ *
+ * @private
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {Function} Returns the new spec function.
+ */
+ function baseConforms(source) {
+ var props = keys(source);
+ return function(object) {
+ return baseConformsTo(object, source, props);
+ };
+ }
+
+ /**
+ * The base implementation of `_.conformsTo` which accepts `props` to check.
+ *
+ * @private
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+ */
+ function baseConformsTo(object, source, props) {
+ var length = props.length;
+ if (object == null) {
+ return !length;
+ }
+ object = Object(object);
+ while (length--) {
+ var key = props[length],
+ predicate = source[key],
+ value = object[key];
+
+ if ((value === undefined$1 && !(key in object)) || !predicate(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * The base implementation of `_.delay` and `_.defer` which accepts `args`
+ * to provide to `func`.
+ *
+ * @private
+ * @param {Function} func The function to delay.
+ * @param {number} wait The number of milliseconds to delay invocation.
+ * @param {Array} args The arguments to provide to `func`.
+ * @returns {number|Object} Returns the timer id or timeout object.
+ */
+ function baseDelay(func, wait, args) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ return setTimeout(function() { func.apply(undefined$1, args); }, wait);
+ }
+
+ /**
+ * The base implementation of methods like `_.difference` without support
+ * for excluding multiple arrays or iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Array} values The values to exclude.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new array of filtered values.
+ */
+ function baseDifference(array, values, iteratee, comparator) {
+ var index = -1,
+ includes = arrayIncludes,
+ isCommon = true,
+ length = array.length,
+ result = [],
+ valuesLength = values.length;
+
+ if (!length) {
+ return result;
+ }
+ if (iteratee) {
+ values = arrayMap(values, baseUnary(iteratee));
+ }
+ if (comparator) {
+ includes = arrayIncludesWith;
+ isCommon = false;
+ }
+ else if (values.length >= LARGE_ARRAY_SIZE) {
+ includes = cacheHas;
+ isCommon = false;
+ values = new SetCache(values);
+ }
+ outer:
+ while (++index < length) {
+ var value = array[index],
+ computed = iteratee == null ? value : iteratee(value);
+
+ value = (comparator || value !== 0) ? value : 0;
+ if (isCommon && computed === computed) {
+ var valuesIndex = valuesLength;
+ while (valuesIndex--) {
+ if (values[valuesIndex] === computed) {
+ continue outer;
+ }
+ }
+ result.push(value);
+ }
+ else if (!includes(values, computed, comparator)) {
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.forEach` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array|Object} Returns `collection`.
+ */
+ var baseEach = createBaseEach(baseForOwn);
+
+ /**
+ * The base implementation of `_.forEachRight` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array|Object} Returns `collection`.
+ */
+ var baseEachRight = createBaseEach(baseForOwnRight, true);
+
+ /**
+ * The base implementation of `_.every` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`
+ */
+ function baseEvery(collection, predicate) {
+ var result = true;
+ baseEach(collection, function(value, index, collection) {
+ result = !!predicate(value, index, collection);
+ return result;
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of methods like `_.max` and `_.min` which accepts a
+ * `comparator` to determine the extremum value.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The iteratee invoked per iteration.
+ * @param {Function} comparator The comparator used to compare values.
+ * @returns {*} Returns the extremum value.
+ */
+ function baseExtremum(array, iteratee, comparator) {
+ var index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ var value = array[index],
+ current = iteratee(value);
+
+ if (current != null && (computed === undefined$1
+ ? (current === current && !isSymbol(current))
+ : comparator(current, computed)
+ )) {
+ var computed = current,
+ result = value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.fill` without an iteratee call guard.
+ *
+ * @private
+ * @param {Array} array The array to fill.
+ * @param {*} value The value to fill `array` with.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns `array`.
+ */
+ function baseFill(array, value, start, end) {
+ var length = array.length;
+
+ start = toInteger(start);
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = (end === undefined$1 || end > length) ? length : toInteger(end);
+ if (end < 0) {
+ end += length;
+ }
+ end = start > end ? 0 : toLength(end);
+ while (start < end) {
+ array[start++] = value;
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.filter` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {Array} Returns the new filtered array.
+ */
+ function baseFilter(collection, predicate) {
+ var result = [];
+ baseEach(collection, function(value, index, collection) {
+ if (predicate(value, index, collection)) {
+ result.push(value);
+ }
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.flatten` with support for restricting flattening.
+ *
+ * @private
+ * @param {Array} array The array to flatten.
+ * @param {number} depth The maximum recursion depth.
+ * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
+ * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
+ * @param {Array} [result=[]] The initial result value.
+ * @returns {Array} Returns the new flattened array.
+ */
+ function baseFlatten(array, depth, predicate, isStrict, result) {
+ var index = -1,
+ length = array.length;
+
+ predicate || (predicate = isFlattenable);
+ result || (result = []);
+
+ while (++index < length) {
+ var value = array[index];
+ if (depth > 0 && predicate(value)) {
+ if (depth > 1) {
+ // Recursively flatten arrays (susceptible to call stack limits).
+ baseFlatten(value, depth - 1, predicate, isStrict, result);
+ } else {
+ arrayPush(result, value);
+ }
+ } else if (!isStrict) {
+ result[result.length] = value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `baseForOwn` which iterates over `object`
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
+ */
+ var baseFor = createBaseFor();
+
+ /**
+ * This function is like `baseFor` except that it iterates over properties
+ * in the opposite order.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
+ */
+ var baseForRight = createBaseFor(true);
+
+ /**
+ * The base implementation of `_.forOwn` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+ function baseForOwn(object, iteratee) {
+ return object && baseFor(object, iteratee, keys);
+ }
+
+ /**
+ * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+ function baseForOwnRight(object, iteratee) {
+ return object && baseForRight(object, iteratee, keys);
+ }
+
+ /**
+ * The base implementation of `_.functions` which creates an array of
+ * `object` function property names filtered from `props`.
+ *
+ * @private
+ * @param {Object} object The object to inspect.
+ * @param {Array} props The property names to filter.
+ * @returns {Array} Returns the function names.
+ */
+ function baseFunctions(object, props) {
+ return arrayFilter(props, function(key) {
+ return isFunction(object[key]);
+ });
+ }
+
+ /**
+ * The base implementation of `_.get` without support for default values.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the property to get.
+ * @returns {*} Returns the resolved value.
+ */
+ function baseGet(object, path) {
+ path = castPath(path, object);
+
+ var index = 0,
+ length = path.length;
+
+ while (object != null && index < length) {
+ object = object[toKey(path[index++])];
+ }
+ return (index && index == length) ? object : undefined$1;
+ }
+
+ /**
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
+ * symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
+ var result = keysFunc(object);
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
+ }
+
+ /**
+ * The base implementation of `getTag` without fallbacks for buggy environments.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
+ */
+ function baseGetTag(value) {
+ if (value == null) {
+ return value === undefined$1 ? undefinedTag : nullTag;
+ }
+ return (symToStringTag && symToStringTag in Object(value))
+ ? getRawTag(value)
+ : objectToString(value);
+ }
+
+ /**
+ * The base implementation of `_.gt` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is greater than `other`,
+ * else `false`.
+ */
+ function baseGt(value, other) {
+ return value > other;
+ }
+
+ /**
+ * The base implementation of `_.has` without support for deep paths.
+ *
+ * @private
+ * @param {Object} [object] The object to query.
+ * @param {Array|string} key The key to check.
+ * @returns {boolean} Returns `true` if `key` exists, else `false`.
+ */
+ function baseHas(object, key) {
+ return object != null && hasOwnProperty.call(object, key);
+ }
+
+ /**
+ * The base implementation of `_.hasIn` without support for deep paths.
+ *
+ * @private
+ * @param {Object} [object] The object to query.
+ * @param {Array|string} key The key to check.
+ * @returns {boolean} Returns `true` if `key` exists, else `false`.
+ */
+ function baseHasIn(object, key) {
+ return object != null && key in Object(object);
+ }
+
+ /**
+ * The base implementation of `_.inRange` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {number} number The number to check.
+ * @param {number} start The start of the range.
+ * @param {number} end The end of the range.
+ * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
+ */
+ function baseInRange(number, start, end) {
+ return number >= nativeMin(start, end) && number < nativeMax(start, end);
+ }
+
+ /**
+ * The base implementation of methods like `_.intersection`, without support
+ * for iteratee shorthands, that accepts an array of arrays to inspect.
+ *
+ * @private
+ * @param {Array} arrays The arrays to inspect.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new array of shared values.
+ */
+ function baseIntersection(arrays, iteratee, comparator) {
+ var includes = comparator ? arrayIncludesWith : arrayIncludes,
+ length = arrays[0].length,
+ othLength = arrays.length,
+ othIndex = othLength,
+ caches = Array(othLength),
+ maxLength = Infinity,
+ result = [];
+
+ while (othIndex--) {
+ var array = arrays[othIndex];
+ if (othIndex && iteratee) {
+ array = arrayMap(array, baseUnary(iteratee));
+ }
+ maxLength = nativeMin(array.length, maxLength);
+ caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
+ ? new SetCache(othIndex && array)
+ : undefined$1;
+ }
+ array = arrays[0];
+
+ var index = -1,
+ seen = caches[0];
+
+ outer:
+ while (++index < length && result.length < maxLength) {
+ var value = array[index],
+ computed = iteratee ? iteratee(value) : value;
+
+ value = (comparator || value !== 0) ? value : 0;
+ if (!(seen
+ ? cacheHas(seen, computed)
+ : includes(result, computed, comparator)
+ )) {
+ othIndex = othLength;
+ while (--othIndex) {
+ var cache = caches[othIndex];
+ if (!(cache
+ ? cacheHas(cache, computed)
+ : includes(arrays[othIndex], computed, comparator))
+ ) {
+ continue outer;
+ }
+ }
+ if (seen) {
+ seen.push(computed);
+ }
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.invert` and `_.invertBy` which inverts
+ * `object` with values transformed by `iteratee` and set by `setter`.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} setter The function to set `accumulator` values.
+ * @param {Function} iteratee The iteratee to transform values.
+ * @param {Object} accumulator The initial inverted object.
+ * @returns {Function} Returns `accumulator`.
+ */
+ function baseInverter(object, setter, iteratee, accumulator) {
+ baseForOwn(object, function(value, key, object) {
+ setter(accumulator, iteratee(value), key, object);
+ });
+ return accumulator;
+ }
+
+ /**
+ * The base implementation of `_.invoke` without support for individual
+ * method arguments.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the method to invoke.
+ * @param {Array} args The arguments to invoke the method with.
+ * @returns {*} Returns the result of the invoked method.
+ */
+ function baseInvoke(object, path, args) {
+ path = castPath(path, object);
+ object = parent(object, path);
+ var func = object == null ? object : object[toKey(last(path))];
+ return func == null ? undefined$1 : apply(func, object, args);
+ }
+
+ /**
+ * The base implementation of `_.isArguments`.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+ */
+ function baseIsArguments(value) {
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
+ }
+
+ /**
+ * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
+ */
+ function baseIsArrayBuffer(value) {
+ return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
+ }
+
+ /**
+ * The base implementation of `_.isDate` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ */
+ function baseIsDate(value) {
+ return isObjectLike(value) && baseGetTag(value) == dateTag;
+ }
+
+ /**
+ * The base implementation of `_.isEqual` which supports partial comparisons
+ * and tracks traversed objects.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @param {boolean} bitmask The bitmask flags.
+ * 1 - Unordered comparison
+ * 2 - Partial comparison
+ * @param {Function} [customizer] The function to customize comparisons.
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ */
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
+ if (value === other) {
+ return true;
+ }
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
+ return value !== value && other !== other;
+ }
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
+ }
+
+ /**
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
+ * deep comparisons and tracks traversed objects enabling objects with circular
+ * references to be compared.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+ * @param {Function} customizer The function to customize comparisons.
+ * @param {Function} equalFunc The function to determine equivalents of values.
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
+ var objIsArr = isArray(object),
+ othIsArr = isArray(other),
+ objTag = objIsArr ? arrayTag : getTag(object),
+ othTag = othIsArr ? arrayTag : getTag(other);
+
+ objTag = objTag == argsTag ? objectTag : objTag;
+ othTag = othTag == argsTag ? objectTag : othTag;
+
+ var objIsObj = objTag == objectTag,
+ othIsObj = othTag == objectTag,
+ isSameTag = objTag == othTag;
+
+ if (isSameTag && isBuffer(object)) {
+ if (!isBuffer(other)) {
+ return false;
+ }
+ objIsArr = true;
+ objIsObj = false;
+ }
+ if (isSameTag && !objIsObj) {
+ stack || (stack = new Stack);
+ return (objIsArr || isTypedArray(object))
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
+ }
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
+
+ if (objIsWrapped || othIsWrapped) {
+ var objUnwrapped = objIsWrapped ? object.value() : object,
+ othUnwrapped = othIsWrapped ? other.value() : other;
+
+ stack || (stack = new Stack);
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
+ }
+ }
+ if (!isSameTag) {
+ return false;
+ }
+ stack || (stack = new Stack);
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
+ }
+
+ /**
+ * The base implementation of `_.isMap` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
+ */
+ function baseIsMap(value) {
+ return isObjectLike(value) && getTag(value) == mapTag;
+ }
+
+ /**
+ * The base implementation of `_.isMatch` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property values to match.
+ * @param {Array} matchData The property names, values, and compare flags to match.
+ * @param {Function} [customizer] The function to customize comparisons.
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+ */
+ function baseIsMatch(object, source, matchData, customizer) {
+ var index = matchData.length,
+ length = index,
+ noCustomizer = !customizer;
+
+ if (object == null) {
+ return !length;
+ }
+ object = Object(object);
+ while (index--) {
+ var data = matchData[index];
+ if ((noCustomizer && data[2])
+ ? data[1] !== object[data[0]]
+ : !(data[0] in object)
+ ) {
+ return false;
+ }
+ }
+ while (++index < length) {
+ data = matchData[index];
+ var key = data[0],
+ objValue = object[key],
+ srcValue = data[1];
+
+ if (noCustomizer && data[2]) {
+ if (objValue === undefined$1 && !(key in object)) {
+ return false;
+ }
+ } else {
+ var stack = new Stack;
+ if (customizer) {
+ var result = customizer(objValue, srcValue, key, object, source, stack);
+ }
+ if (!(result === undefined$1
+ ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
+ : result
+ )) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * The base implementation of `_.isNative` without bad shim checks.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a native function,
+ * else `false`.
+ */
+ function baseIsNative(value) {
+ if (!isObject(value) || isMasked(value)) {
+ return false;
+ }
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
+ return pattern.test(toSource(value));
+ }
+
+ /**
+ * The base implementation of `_.isRegExp` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+ */
+ function baseIsRegExp(value) {
+ return isObjectLike(value) && baseGetTag(value) == regexpTag;
+ }
+
+ /**
+ * The base implementation of `_.isSet` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
+ */
+ function baseIsSet(value) {
+ return isObjectLike(value) && getTag(value) == setTag;
+ }
+
+ /**
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+ */
+ function baseIsTypedArray(value) {
+ return isObjectLike(value) &&
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
+ }
+
+ /**
+ * The base implementation of `_.iteratee`.
+ *
+ * @private
+ * @param {*} [value=_.identity] The value to convert to an iteratee.
+ * @returns {Function} Returns the iteratee.
+ */
+ function baseIteratee(value) {
+ // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
+ // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
+ if (typeof value == 'function') {
+ return value;
+ }
+ if (value == null) {
+ return identity;
+ }
+ if (typeof value == 'object') {
+ return isArray(value)
+ ? baseMatchesProperty(value[0], value[1])
+ : baseMatches(value);
+ }
+ return property(value);
+ }
+
+ /**
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+ function baseKeys(object) {
+ if (!isPrototype(object)) {
+ return nativeKeys(object);
+ }
+ var result = [];
+ for (var key in Object(object)) {
+ if (hasOwnProperty.call(object, key) && key != 'constructor') {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+ function baseKeysIn(object) {
+ if (!isObject(object)) {
+ return nativeKeysIn(object);
+ }
+ var isProto = isPrototype(object),
+ result = [];
+
+ for (var key in object) {
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.lt` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is less than `other`,
+ * else `false`.
+ */
+ function baseLt(value, other) {
+ return value < other;
+ }
+
+ /**
+ * The base implementation of `_.map` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+ function baseMap(collection, iteratee) {
+ var index = -1,
+ result = isArrayLike(collection) ? Array(collection.length) : [];
+
+ baseEach(collection, function(value, key, collection) {
+ result[++index] = iteratee(value, key, collection);
+ });
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.matches` which doesn't clone `source`.
+ *
+ * @private
+ * @param {Object} source The object of property values to match.
+ * @returns {Function} Returns the new spec function.
+ */
+ function baseMatches(source) {
+ var matchData = getMatchData(source);
+ if (matchData.length == 1 && matchData[0][2]) {
+ return matchesStrictComparable(matchData[0][0], matchData[0][1]);
+ }
+ return function(object) {
+ return object === source || baseIsMatch(object, source, matchData);
+ };
+ }
+
+ /**
+ * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
+ *
+ * @private
+ * @param {string} path The path of the property to get.
+ * @param {*} srcValue The value to match.
+ * @returns {Function} Returns the new spec function.
+ */
+ function baseMatchesProperty(path, srcValue) {
+ if (isKey(path) && isStrictComparable(srcValue)) {
+ return matchesStrictComparable(toKey(path), srcValue);
+ }
+ return function(object) {
+ var objValue = get(object, path);
+ return (objValue === undefined$1 && objValue === srcValue)
+ ? hasIn(object, path)
+ : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
+ };
+ }
+
+ /**
+ * The base implementation of `_.merge` without support for multiple sources.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @param {number} srcIndex The index of `source`.
+ * @param {Function} [customizer] The function to customize merged values.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
+ */
+ function baseMerge(object, source, srcIndex, customizer, stack) {
+ if (object === source) {
+ return;
+ }
+ baseFor(source, function(srcValue, key) {
+ stack || (stack = new Stack);
+ if (isObject(srcValue)) {
+ baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
+ }
+ else {
+ var newValue = customizer
+ ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
+ : undefined$1;
+
+ if (newValue === undefined$1) {
+ newValue = srcValue;
+ }
+ assignMergeValue(object, key, newValue);
+ }
+ }, keysIn);
+ }
+
+ /**
+ * A specialized version of `baseMerge` for arrays and objects which performs
+ * deep merges and tracks traversed objects enabling objects with circular
+ * references to be merged.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @param {string} key The key of the value to merge.
+ * @param {number} srcIndex The index of `source`.
+ * @param {Function} mergeFunc The function to merge values.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
+ */
+ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
+ var objValue = safeGet(object, key),
+ srcValue = safeGet(source, key),
+ stacked = stack.get(srcValue);
+
+ if (stacked) {
+ assignMergeValue(object, key, stacked);
+ return;
+ }
+ var newValue = customizer
+ ? customizer(objValue, srcValue, (key + ''), object, source, stack)
+ : undefined$1;
+
+ var isCommon = newValue === undefined$1;
+
+ if (isCommon) {
+ var isArr = isArray(srcValue),
+ isBuff = !isArr && isBuffer(srcValue),
+ isTyped = !isArr && !isBuff && isTypedArray(srcValue);
+
+ newValue = srcValue;
+ if (isArr || isBuff || isTyped) {
+ if (isArray(objValue)) {
+ newValue = objValue;
+ }
+ else if (isArrayLikeObject(objValue)) {
+ newValue = copyArray(objValue);
+ }
+ else if (isBuff) {
+ isCommon = false;
+ newValue = cloneBuffer(srcValue, true);
+ }
+ else if (isTyped) {
+ isCommon = false;
+ newValue = cloneTypedArray(srcValue, true);
+ }
+ else {
+ newValue = [];
+ }
+ }
+ else if (isPlainObject(srcValue) || isArguments(srcValue)) {
+ newValue = objValue;
+ if (isArguments(objValue)) {
+ newValue = toPlainObject(objValue);
+ }
+ else if (!isObject(objValue) || isFunction(objValue)) {
+ newValue = initCloneObject(srcValue);
+ }
+ }
+ else {
+ isCommon = false;
+ }
+ }
+ if (isCommon) {
+ // Recursively merge objects and arrays (susceptible to call stack limits).
+ stack.set(srcValue, newValue);
+ mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
+ stack['delete'](srcValue);
+ }
+ assignMergeValue(object, key, newValue);
+ }
+
+ /**
+ * The base implementation of `_.nth` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {Array} array The array to query.
+ * @param {number} n The index of the element to return.
+ * @returns {*} Returns the nth element of `array`.
+ */
+ function baseNth(array, n) {
+ var length = array.length;
+ if (!length) {
+ return;
+ }
+ n += n < 0 ? length : 0;
+ return isIndex(n, length) ? array[n] : undefined$1;
+ }
+
+ /**
+ * The base implementation of `_.orderBy` without param guards.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
+ * @param {string[]} orders The sort orders of `iteratees`.
+ * @returns {Array} Returns the new sorted array.
+ */
+ function baseOrderBy(collection, iteratees, orders) {
+ if (iteratees.length) {
+ iteratees = arrayMap(iteratees, function(iteratee) {
+ if (isArray(iteratee)) {
+ return function(value) {
+ return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
+ }
+ }
+ return iteratee;
+ });
+ } else {
+ iteratees = [identity];
+ }
+
+ var index = -1;
+ iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
+
+ var result = baseMap(collection, function(value, key, collection) {
+ var criteria = arrayMap(iteratees, function(iteratee) {
+ return iteratee(value);
+ });
+ return { 'criteria': criteria, 'index': ++index, 'value': value };
+ });
+
+ return baseSortBy(result, function(object, other) {
+ return compareMultiple(object, other, orders);
+ });
+ }
+
+ /**
+ * The base implementation of `_.pick` without support for individual
+ * property identifiers.
+ *
+ * @private
+ * @param {Object} object The source object.
+ * @param {string[]} paths The property paths to pick.
+ * @returns {Object} Returns the new object.
+ */
+ function basePick(object, paths) {
+ return basePickBy(object, paths, function(value, path) {
+ return hasIn(object, path);
+ });
+ }
+
+ /**
+ * The base implementation of `_.pickBy` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Object} object The source object.
+ * @param {string[]} paths The property paths to pick.
+ * @param {Function} predicate The function invoked per property.
+ * @returns {Object} Returns the new object.
+ */
+ function basePickBy(object, paths, predicate) {
+ var index = -1,
+ length = paths.length,
+ result = {};
+
+ while (++index < length) {
+ var path = paths[index],
+ value = baseGet(object, path);
+
+ if (predicate(value, path)) {
+ baseSet(result, castPath(path, object), value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * A specialized version of `baseProperty` which supports deep paths.
+ *
+ * @private
+ * @param {Array|string} path The path of the property to get.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function basePropertyDeep(path) {
+ return function(object) {
+ return baseGet(object, path);
+ };
+ }
+
+ /**
+ * The base implementation of `_.pullAllBy` without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to remove.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns `array`.
+ */
+ function basePullAll(array, values, iteratee, comparator) {
+ var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
+ index = -1,
+ length = values.length,
+ seen = array;
+
+ if (array === values) {
+ values = copyArray(values);
+ }
+ if (iteratee) {
+ seen = arrayMap(array, baseUnary(iteratee));
+ }
+ while (++index < length) {
+ var fromIndex = 0,
+ value = values[index],
+ computed = iteratee ? iteratee(value) : value;
+
+ while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
+ if (seen !== array) {
+ splice.call(seen, fromIndex, 1);
+ }
+ splice.call(array, fromIndex, 1);
+ }
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.pullAt` without support for individual
+ * indexes or capturing the removed elements.
+ *
+ * @private
+ * @param {Array} array The array to modify.
+ * @param {number[]} indexes The indexes of elements to remove.
+ * @returns {Array} Returns `array`.
+ */
+ function basePullAt(array, indexes) {
+ var length = array ? indexes.length : 0,
+ lastIndex = length - 1;
+
+ while (length--) {
+ var index = indexes[length];
+ if (length == lastIndex || index !== previous) {
+ var previous = index;
+ if (isIndex(index)) {
+ splice.call(array, index, 1);
+ } else {
+ baseUnset(array, index);
+ }
+ }
+ }
+ return array;
+ }
+
+ /**
+ * The base implementation of `_.random` without support for returning
+ * floating-point numbers.
+ *
+ * @private
+ * @param {number} lower The lower bound.
+ * @param {number} upper The upper bound.
+ * @returns {number} Returns the random number.
+ */
+ function baseRandom(lower, upper) {
+ return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
+ }
+
+ /**
+ * The base implementation of `_.range` and `_.rangeRight` which doesn't
+ * coerce arguments.
+ *
+ * @private
+ * @param {number} start The start of the range.
+ * @param {number} end The end of the range.
+ * @param {number} step The value to increment or decrement by.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Array} Returns the range of numbers.
+ */
+ function baseRange(start, end, step, fromRight) {
+ var index = -1,
+ length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
+ result = Array(length);
+
+ while (length--) {
+ result[fromRight ? length : ++index] = start;
+ start += step;
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.repeat` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {string} string The string to repeat.
+ * @param {number} n The number of times to repeat the string.
+ * @returns {string} Returns the repeated string.
+ */
+ function baseRepeat(string, n) {
+ var result = '';
+ if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
+ return result;
+ }
+ // Leverage the exponentiation by squaring algorithm for a faster repeat.
+ // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
+ do {
+ if (n % 2) {
+ result += string;
+ }
+ n = nativeFloor(n / 2);
+ if (n) {
+ string += string;
+ }
+ } while (n);
+
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
+ *
+ * @private
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
+ */
+ function baseRest(func, start) {
+ return setToString(overRest(func, start, identity), func + '');
+ }
+
+ /**
+ * The base implementation of `_.sample`.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to sample.
+ * @returns {*} Returns the random element.
+ */
+ function baseSample(collection) {
+ return arraySample(values(collection));
+ }
+
+ /**
+ * The base implementation of `_.sampleSize` without param guards.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to sample.
+ * @param {number} n The number of elements to sample.
+ * @returns {Array} Returns the random elements.
+ */
+ function baseSampleSize(collection, n) {
+ var array = values(collection);
+ return shuffleSelf(array, baseClamp(n, 0, array.length));
+ }
+
+ /**
+ * The base implementation of `_.set`.
+ *
+ * @private
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to set.
+ * @param {*} value The value to set.
+ * @param {Function} [customizer] The function to customize path creation.
+ * @returns {Object} Returns `object`.
+ */
+ function baseSet(object, path, value, customizer) {
+ if (!isObject(object)) {
+ return object;
+ }
+ path = castPath(path, object);
+
+ var index = -1,
+ length = path.length,
+ lastIndex = length - 1,
+ nested = object;
+
+ while (nested != null && ++index < length) {
+ var key = toKey(path[index]),
+ newValue = value;
+
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
+ return object;
+ }
+
+ if (index != lastIndex) {
+ var objValue = nested[key];
+ newValue = customizer ? customizer(objValue, key, nested) : undefined$1;
+ if (newValue === undefined$1) {
+ newValue = isObject(objValue)
+ ? objValue
+ : (isIndex(path[index + 1]) ? [] : {});
+ }
+ }
+ assignValue(nested, key, newValue);
+ nested = nested[key];
+ }
+ return object;
+ }
+
+ /**
+ * The base implementation of `setData` without support for hot loop shorting.
+ *
+ * @private
+ * @param {Function} func The function to associate metadata with.
+ * @param {*} data The metadata.
+ * @returns {Function} Returns `func`.
+ */
+ var baseSetData = !metaMap ? identity : function(func, data) {
+ metaMap.set(func, data);
+ return func;
+ };
+
+ /**
+ * The base implementation of `setToString` without support for hot loop shorting.
+ *
+ * @private
+ * @param {Function} func The function to modify.
+ * @param {Function} string The `toString` result.
+ * @returns {Function} Returns `func`.
+ */
+ var baseSetToString = !defineProperty ? identity : function(func, string) {
+ return defineProperty(func, 'toString', {
+ 'configurable': true,
+ 'enumerable': false,
+ 'value': constant(string),
+ 'writable': true
+ });
+ };
+
+ /**
+ * The base implementation of `_.shuffle`.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to shuffle.
+ * @returns {Array} Returns the new shuffled array.
+ */
+ function baseShuffle(collection) {
+ return shuffleSelf(values(collection));
+ }
+
+ /**
+ * The base implementation of `_.slice` without an iteratee call guard.
+ *
+ * @private
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
+ */
+ function baseSlice(array, start, end) {
+ var index = -1,
+ length = array.length;
+
+ if (start < 0) {
+ start = -start > length ? 0 : (length + start);
+ }
+ end = end > length ? length : end;
+ if (end < 0) {
+ end += length;
+ }
+ length = start > end ? 0 : ((end - start) >>> 0);
+ start >>>= 0;
+
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = array[index + start];
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.some` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
+ */
+ function baseSome(collection, predicate) {
+ var result;
+
+ baseEach(collection, function(value, index, collection) {
+ result = predicate(value, index, collection);
+ return !result;
+ });
+ return !!result;
+ }
+
+ /**
+ * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
+ * performs a binary search of `array` to determine the index at which `value`
+ * should be inserted into `array` in order to maintain its sort order.
+ *
+ * @private
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ */
+ function baseSortedIndex(array, value, retHighest) {
+ var low = 0,
+ high = array == null ? low : array.length;
+
+ if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
+ while (low < high) {
+ var mid = (low + high) >>> 1,
+ computed = array[mid];
+
+ if (computed !== null && !isSymbol(computed) &&
+ (retHighest ? (computed <= value) : (computed < value))) {
+ low = mid + 1;
+ } else {
+ high = mid;
+ }
+ }
+ return high;
+ }
+ return baseSortedIndexBy(array, value, identity, retHighest);
+ }
+
+ /**
+ * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
+ * which invokes `iteratee` for `value` and each element of `array` to compute
+ * their sort ranking. The iteratee is invoked with one argument; (value).
+ *
+ * @private
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {Function} iteratee The iteratee invoked per element.
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ */
+ function baseSortedIndexBy(array, value, iteratee, retHighest) {
+ var low = 0,
+ high = array == null ? 0 : array.length;
+ if (high === 0) {
+ return 0;
+ }
+
+ value = iteratee(value);
+ var valIsNaN = value !== value,
+ valIsNull = value === null,
+ valIsSymbol = isSymbol(value),
+ valIsUndefined = value === undefined$1;
+
+ while (low < high) {
+ var mid = nativeFloor((low + high) / 2),
+ computed = iteratee(array[mid]),
+ othIsDefined = computed !== undefined$1,
+ othIsNull = computed === null,
+ othIsReflexive = computed === computed,
+ othIsSymbol = isSymbol(computed);
+
+ if (valIsNaN) {
+ var setLow = retHighest || othIsReflexive;
+ } else if (valIsUndefined) {
+ setLow = othIsReflexive && (retHighest || othIsDefined);
+ } else if (valIsNull) {
+ setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
+ } else if (valIsSymbol) {
+ setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
+ } else if (othIsNull || othIsSymbol) {
+ setLow = false;
+ } else {
+ setLow = retHighest ? (computed <= value) : (computed < value);
+ }
+ if (setLow) {
+ low = mid + 1;
+ } else {
+ high = mid;
+ }
+ }
+ return nativeMin(high, MAX_ARRAY_INDEX);
+ }
+
+ /**
+ * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
+ * support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @returns {Array} Returns the new duplicate free array.
+ */
+ function baseSortedUniq(array, iteratee) {
+ var index = -1,
+ length = array.length,
+ resIndex = 0,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index],
+ computed = iteratee ? iteratee(value) : value;
+
+ if (!index || !eq(computed, seen)) {
+ var seen = computed;
+ result[resIndex++] = value === 0 ? 0 : value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.toNumber` which doesn't ensure correct
+ * conversions of binary, hexadecimal, or octal string values.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {number} Returns the number.
+ */
+ function baseToNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
+ return +value;
+ }
+
+ /**
+ * The base implementation of `_.toString` which doesn't convert nullish
+ * values to empty strings.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ */
+ function baseToString(value) {
+ // Exit early for strings to avoid a performance hit in some environments.
+ if (typeof value == 'string') {
+ return value;
+ }
+ if (isArray(value)) {
+ // Recursively convert values (susceptible to call stack limits).
+ return arrayMap(value, baseToString) + '';
+ }
+ if (isSymbol(value)) {
+ return symbolToString ? symbolToString.call(value) : '';
+ }
+ var result = (value + '');
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+ }
+
+ /**
+ * The base implementation of `_.uniqBy` without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new duplicate free array.
+ */
+ function baseUniq(array, iteratee, comparator) {
+ var index = -1,
+ includes = arrayIncludes,
+ length = array.length,
+ isCommon = true,
+ result = [],
+ seen = result;
+
+ if (comparator) {
+ isCommon = false;
+ includes = arrayIncludesWith;
+ }
+ else if (length >= LARGE_ARRAY_SIZE) {
+ var set = iteratee ? null : createSet(array);
+ if (set) {
+ return setToArray(set);
+ }
+ isCommon = false;
+ includes = cacheHas;
+ seen = new SetCache;
+ }
+ else {
+ seen = iteratee ? [] : result;
+ }
+ outer:
+ while (++index < length) {
+ var value = array[index],
+ computed = iteratee ? iteratee(value) : value;
+
+ value = (comparator || value !== 0) ? value : 0;
+ if (isCommon && computed === computed) {
+ var seenIndex = seen.length;
+ while (seenIndex--) {
+ if (seen[seenIndex] === computed) {
+ continue outer;
+ }
+ }
+ if (iteratee) {
+ seen.push(computed);
+ }
+ result.push(value);
+ }
+ else if (!includes(seen, computed, comparator)) {
+ if (seen !== result) {
+ seen.push(computed);
+ }
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.unset`.
+ *
+ * @private
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The property path to unset.
+ * @returns {boolean} Returns `true` if the property is deleted, else `false`.
+ */
+ function baseUnset(object, path) {
+ path = castPath(path, object);
+ object = parent(object, path);
+ return object == null || delete object[toKey(last(path))];
+ }
+
+ /**
+ * The base implementation of `_.update`.
+ *
+ * @private
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to update.
+ * @param {Function} updater The function to produce the updated value.
+ * @param {Function} [customizer] The function to customize path creation.
+ * @returns {Object} Returns `object`.
+ */
+ function baseUpdate(object, path, updater, customizer) {
+ return baseSet(object, path, updater(baseGet(object, path)), customizer);
+ }
+
+ /**
+ * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
+ * without support for iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to query.
+ * @param {Function} predicate The function invoked per iteration.
+ * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Array} Returns the slice of `array`.
+ */
+ function baseWhile(array, predicate, isDrop, fromRight) {
+ var length = array.length,
+ index = fromRight ? length : -1;
+
+ while ((fromRight ? index-- : ++index < length) &&
+ predicate(array[index], index, array)) {}
+
+ return isDrop
+ ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
+ : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
+ }
+
+ /**
+ * The base implementation of `wrapperValue` which returns the result of
+ * performing a sequence of actions on the unwrapped `value`, where each
+ * successive action is supplied the return value of the previous.
+ *
+ * @private
+ * @param {*} value The unwrapped value.
+ * @param {Array} actions Actions to perform to resolve the unwrapped value.
+ * @returns {*} Returns the resolved value.
+ */
+ function baseWrapperValue(value, actions) {
+ var result = value;
+ if (result instanceof LazyWrapper) {
+ result = result.value();
+ }
+ return arrayReduce(actions, function(result, action) {
+ return action.func.apply(action.thisArg, arrayPush([result], action.args));
+ }, result);
+ }
+
+ /**
+ * The base implementation of methods like `_.xor`, without support for
+ * iteratee shorthands, that accepts an array of arrays to inspect.
+ *
+ * @private
+ * @param {Array} arrays The arrays to inspect.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new array of values.
+ */
+ function baseXor(arrays, iteratee, comparator) {
+ var length = arrays.length;
+ if (length < 2) {
+ return length ? baseUniq(arrays[0]) : [];
+ }
+ var index = -1,
+ result = Array(length);
+
+ while (++index < length) {
+ var array = arrays[index],
+ othIndex = -1;
+
+ while (++othIndex < length) {
+ if (othIndex != index) {
+ result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
+ }
+ }
+ }
+ return baseUniq(baseFlatten(result, 1), iteratee, comparator);
+ }
+
+ /**
+ * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
+ *
+ * @private
+ * @param {Array} props The property identifiers.
+ * @param {Array} values The property values.
+ * @param {Function} assignFunc The function to assign values.
+ * @returns {Object} Returns the new object.
+ */
+ function baseZipObject(props, values, assignFunc) {
+ var index = -1,
+ length = props.length,
+ valsLength = values.length,
+ result = {};
+
+ while (++index < length) {
+ var value = index < valsLength ? values[index] : undefined$1;
+ assignFunc(result, props[index], value);
+ }
+ return result;
+ }
+
+ /**
+ * Casts `value` to an empty array if it's not an array like object.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {Array|Object} Returns the cast array-like object.
+ */
+ function castArrayLikeObject(value) {
+ return isArrayLikeObject(value) ? value : [];
+ }
+
+ /**
+ * Casts `value` to `identity` if it's not a function.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {Function} Returns cast function.
+ */
+ function castFunction(value) {
+ return typeof value == 'function' ? value : identity;
+ }
+
+ /**
+ * Casts `value` to a path array if it's not one.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @param {Object} [object] The object to query keys on.
+ * @returns {Array} Returns the cast property path array.
+ */
+ function castPath(value, object) {
+ if (isArray(value)) {
+ return value;
+ }
+ return isKey(value, object) ? [value] : stringToPath(toString(value));
+ }
+
+ /**
+ * A `baseRest` alias which can be replaced with `identity` by module
+ * replacement plugins.
+ *
+ * @private
+ * @type {Function}
+ * @param {Function} func The function to apply a rest parameter to.
+ * @returns {Function} Returns the new function.
+ */
+ var castRest = baseRest;
+
+ /**
+ * Casts `array` to a slice if it's needed.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {number} start The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the cast slice.
+ */
+ function castSlice(array, start, end) {
+ var length = array.length;
+ end = end === undefined$1 ? length : end;
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
+ }
+
+ /**
+ * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
+ *
+ * @private
+ * @param {number|Object} id The timer id or timeout object of the timer to clear.
+ */
+ var clearTimeout = ctxClearTimeout || function(id) {
+ return root.clearTimeout(id);
+ };
+
+ /**
+ * Creates a clone of `buffer`.
+ *
+ * @private
+ * @param {Buffer} buffer The buffer to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Buffer} Returns the cloned buffer.
+ */
+ function cloneBuffer(buffer, isDeep) {
+ if (isDeep) {
+ return buffer.slice();
+ }
+ var length = buffer.length,
+ result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
+
+ buffer.copy(result);
+ return result;
+ }
+
+ /**
+ * Creates a clone of `arrayBuffer`.
+ *
+ * @private
+ * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
+ */
+ function cloneArrayBuffer(arrayBuffer) {
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
+ return result;
+ }
+
+ /**
+ * Creates a clone of `dataView`.
+ *
+ * @private
+ * @param {Object} dataView The data view to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned data view.
+ */
+ function cloneDataView(dataView, isDeep) {
+ var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
+ }
+
+ /**
+ * Creates a clone of `regexp`.
+ *
+ * @private
+ * @param {Object} regexp The regexp to clone.
+ * @returns {Object} Returns the cloned regexp.
+ */
+ function cloneRegExp(regexp) {
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
+ result.lastIndex = regexp.lastIndex;
+ return result;
+ }
+
+ /**
+ * Creates a clone of the `symbol` object.
+ *
+ * @private
+ * @param {Object} symbol The symbol object to clone.
+ * @returns {Object} Returns the cloned symbol object.
+ */
+ function cloneSymbol(symbol) {
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
+ }
+
+ /**
+ * Creates a clone of `typedArray`.
+ *
+ * @private
+ * @param {Object} typedArray The typed array to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned typed array.
+ */
+ function cloneTypedArray(typedArray, isDeep) {
+ var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
+ }
+
+ /**
+ * Compares values to sort them in ascending order.
+ *
+ * @private
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {number} Returns the sort order indicator for `value`.
+ */
+ function compareAscending(value, other) {
+ if (value !== other) {
+ var valIsDefined = value !== undefined$1,
+ valIsNull = value === null,
+ valIsReflexive = value === value,
+ valIsSymbol = isSymbol(value);
+
+ var othIsDefined = other !== undefined$1,
+ othIsNull = other === null,
+ othIsReflexive = other === other,
+ othIsSymbol = isSymbol(other);
+
+ if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
+ (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
+ (valIsNull && othIsDefined && othIsReflexive) ||
+ (!valIsDefined && othIsReflexive) ||
+ !valIsReflexive) {
+ return 1;
+ }
+ if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
+ (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
+ (othIsNull && valIsDefined && valIsReflexive) ||
+ (!othIsDefined && valIsReflexive) ||
+ !othIsReflexive) {
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * Used by `_.orderBy` to compare multiple properties of a value to another
+ * and stable sort them.
+ *
+ * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
+ * specify an order of "desc" for descending or "asc" for ascending sort order
+ * of corresponding values.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {boolean[]|string[]} orders The order to sort by for each property.
+ * @returns {number} Returns the sort order indicator for `object`.
+ */
+ function compareMultiple(object, other, orders) {
+ var index = -1,
+ objCriteria = object.criteria,
+ othCriteria = other.criteria,
+ length = objCriteria.length,
+ ordersLength = orders.length;
+
+ while (++index < length) {
+ var result = compareAscending(objCriteria[index], othCriteria[index]);
+ if (result) {
+ if (index >= ordersLength) {
+ return result;
+ }
+ var order = orders[index];
+ return result * (order == 'desc' ? -1 : 1);
+ }
+ }
+ // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+ // that causes it, under certain circumstances, to provide the same value for
+ // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
+ // for more details.
+ //
+ // This also ensures a stable sort in V8 and other engines.
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
+ return object.index - other.index;
+ }
+
+ /**
+ * Creates an array that is the composition of partially applied arguments,
+ * placeholders, and provided arguments into a single array of arguments.
+ *
+ * @private
+ * @param {Array} args The provided arguments.
+ * @param {Array} partials The arguments to prepend to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
+ * @params {boolean} [isCurried] Specify composing for a curried function.
+ * @returns {Array} Returns the new array of composed arguments.
+ */
+ function composeArgs(args, partials, holders, isCurried) {
+ var argsIndex = -1,
+ argsLength = args.length,
+ holdersLength = holders.length,
+ leftIndex = -1,
+ leftLength = partials.length,
+ rangeLength = nativeMax(argsLength - holdersLength, 0),
+ result = Array(leftLength + rangeLength),
+ isUncurried = !isCurried;
+
+ while (++leftIndex < leftLength) {
+ result[leftIndex] = partials[leftIndex];
+ }
+ while (++argsIndex < holdersLength) {
+ if (isUncurried || argsIndex < argsLength) {
+ result[holders[argsIndex]] = args[argsIndex];
+ }
+ }
+ while (rangeLength--) {
+ result[leftIndex++] = args[argsIndex++];
+ }
+ return result;
+ }
+
+ /**
+ * This function is like `composeArgs` except that the arguments composition
+ * is tailored for `_.partialRight`.
+ *
+ * @private
+ * @param {Array} args The provided arguments.
+ * @param {Array} partials The arguments to append to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
+ * @params {boolean} [isCurried] Specify composing for a curried function.
+ * @returns {Array} Returns the new array of composed arguments.
+ */
+ function composeArgsRight(args, partials, holders, isCurried) {
+ var argsIndex = -1,
+ argsLength = args.length,
+ holdersIndex = -1,
+ holdersLength = holders.length,
+ rightIndex = -1,
+ rightLength = partials.length,
+ rangeLength = nativeMax(argsLength - holdersLength, 0),
+ result = Array(rangeLength + rightLength),
+ isUncurried = !isCurried;
+
+ while (++argsIndex < rangeLength) {
+ result[argsIndex] = args[argsIndex];
+ }
+ var offset = argsIndex;
+ while (++rightIndex < rightLength) {
+ result[offset + rightIndex] = partials[rightIndex];
+ }
+ while (++holdersIndex < holdersLength) {
+ if (isUncurried || argsIndex < argsLength) {
+ result[offset + holders[holdersIndex]] = args[argsIndex++];
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Copies the values of `source` to `array`.
+ *
+ * @private
+ * @param {Array} source The array to copy values from.
+ * @param {Array} [array=[]] The array to copy values to.
+ * @returns {Array} Returns `array`.
+ */
+ function copyArray(source, array) {
+ var index = -1,
+ length = source.length;
+
+ array || (array = Array(length));
+ while (++index < length) {
+ array[index] = source[index];
+ }
+ return array;
+ }
+
+ /**
+ * Copies properties of `source` to `object`.
+ *
+ * @private
+ * @param {Object} source The object to copy properties from.
+ * @param {Array} props The property identifiers to copy.
+ * @param {Object} [object={}] The object to copy properties to.
+ * @param {Function} [customizer] The function to customize copied values.
+ * @returns {Object} Returns `object`.
+ */
+ function copyObject(source, props, object, customizer) {
+ var isNew = !object;
+ object || (object = {});
+
+ var index = -1,
+ length = props.length;
+
+ while (++index < length) {
+ var key = props[index];
+
+ var newValue = customizer
+ ? customizer(object[key], source[key], key, object, source)
+ : undefined$1;
+
+ if (newValue === undefined$1) {
+ newValue = source[key];
+ }
+ if (isNew) {
+ baseAssignValue(object, key, newValue);
+ } else {
+ assignValue(object, key, newValue);
+ }
+ }
+ return object;
+ }
+
+ /**
+ * Copies own symbols of `source` to `object`.
+ *
+ * @private
+ * @param {Object} source The object to copy symbols from.
+ * @param {Object} [object={}] The object to copy symbols to.
+ * @returns {Object} Returns `object`.
+ */
+ function copySymbols(source, object) {
+ return copyObject(source, getSymbols(source), object);
+ }
+
+ /**
+ * Copies own and inherited symbols of `source` to `object`.
+ *
+ * @private
+ * @param {Object} source The object to copy symbols from.
+ * @param {Object} [object={}] The object to copy symbols to.
+ * @returns {Object} Returns `object`.
+ */
+ function copySymbolsIn(source, object) {
+ return copyObject(source, getSymbolsIn(source), object);
+ }
+
+ /**
+ * Creates a function like `_.groupBy`.
+ *
+ * @private
+ * @param {Function} setter The function to set accumulator values.
+ * @param {Function} [initializer] The accumulator object initializer.
+ * @returns {Function} Returns the new aggregator function.
+ */
+ function createAggregator(setter, initializer) {
+ return function(collection, iteratee) {
+ var func = isArray(collection) ? arrayAggregator : baseAggregator,
+ accumulator = initializer ? initializer() : {};
+
+ return func(collection, setter, getIteratee(iteratee, 2), accumulator);
+ };
+ }
+
+ /**
+ * Creates a function like `_.assign`.
+ *
+ * @private
+ * @param {Function} assigner The function to assign values.
+ * @returns {Function} Returns the new assigner function.
+ */
+ function createAssigner(assigner) {
+ return baseRest(function(object, sources) {
+ var index = -1,
+ length = sources.length,
+ customizer = length > 1 ? sources[length - 1] : undefined$1,
+ guard = length > 2 ? sources[2] : undefined$1;
+
+ customizer = (assigner.length > 3 && typeof customizer == 'function')
+ ? (length--, customizer)
+ : undefined$1;
+
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+ customizer = length < 3 ? undefined$1 : customizer;
+ length = 1;
+ }
+ object = Object(object);
+ while (++index < length) {
+ var source = sources[index];
+ if (source) {
+ assigner(object, source, index, customizer);
+ }
+ }
+ return object;
+ });
+ }
+
+ /**
+ * Creates a `baseEach` or `baseEachRight` function.
+ *
+ * @private
+ * @param {Function} eachFunc The function to iterate over a collection.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+ function createBaseEach(eachFunc, fromRight) {
+ return function(collection, iteratee) {
+ if (collection == null) {
+ return collection;
+ }
+ if (!isArrayLike(collection)) {
+ return eachFunc(collection, iteratee);
+ }
+ var length = collection.length,
+ index = fromRight ? length : -1,
+ iterable = Object(collection);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ if (iteratee(iterable[index], index, iterable) === false) {
+ break;
+ }
+ }
+ return collection;
+ };
+ }
+
+ /**
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+ function createBaseFor(fromRight) {
+ return function(object, iteratee, keysFunc) {
+ var index = -1,
+ iterable = Object(object),
+ props = keysFunc(object),
+ length = props.length;
+
+ while (length--) {
+ var key = props[fromRight ? length : ++index];
+ if (iteratee(iterable[key], key, iterable) === false) {
+ break;
+ }
+ }
+ return object;
+ };
+ }
+
+ /**
+ * Creates a function that wraps `func` to invoke it with the optional `this`
+ * binding of `thisArg`.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createBind(func, bitmask, thisArg) {
+ var isBind = bitmask & WRAP_BIND_FLAG,
+ Ctor = createCtor(func);
+
+ function wrapper() {
+ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+ return fn.apply(isBind ? thisArg : this, arguments);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Creates a function like `_.lowerFirst`.
+ *
+ * @private
+ * @param {string} methodName The name of the `String` case method to use.
+ * @returns {Function} Returns the new case function.
+ */
+ function createCaseFirst(methodName) {
+ return function(string) {
+ string = toString(string);
+
+ var strSymbols = hasUnicode(string)
+ ? stringToArray(string)
+ : undefined$1;
+
+ var chr = strSymbols
+ ? strSymbols[0]
+ : string.charAt(0);
+
+ var trailing = strSymbols
+ ? castSlice(strSymbols, 1).join('')
+ : string.slice(1);
+
+ return chr[methodName]() + trailing;
+ };
+ }
+
+ /**
+ * Creates a function like `_.camelCase`.
+ *
+ * @private
+ * @param {Function} callback The function to combine each word.
+ * @returns {Function} Returns the new compounder function.
+ */
+ function createCompounder(callback) {
+ return function(string) {
+ return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
+ };
+ }
+
+ /**
+ * Creates a function that produces an instance of `Ctor` regardless of
+ * whether it was invoked as part of a `new` expression or by `call` or `apply`.
+ *
+ * @private
+ * @param {Function} Ctor The constructor to wrap.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createCtor(Ctor) {
+ return function() {
+ // Use a `switch` statement to work with class constructors. See
+ // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
+ // for more details.
+ var args = arguments;
+ switch (args.length) {
+ case 0: return new Ctor;
+ case 1: return new Ctor(args[0]);
+ case 2: return new Ctor(args[0], args[1]);
+ case 3: return new Ctor(args[0], args[1], args[2]);
+ case 4: return new Ctor(args[0], args[1], args[2], args[3]);
+ case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
+ case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
+ case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+ }
+ var thisBinding = baseCreate(Ctor.prototype),
+ result = Ctor.apply(thisBinding, args);
+
+ // Mimic the constructor's `return` behavior.
+ // See https://es5.github.io/#x13.2.2 for more details.
+ return isObject(result) ? result : thisBinding;
+ };
+ }
+
+ /**
+ * Creates a function that wraps `func` to enable currying.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @param {number} arity The arity of `func`.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createCurry(func, bitmask, arity) {
+ var Ctor = createCtor(func);
+
+ function wrapper() {
+ var length = arguments.length,
+ args = Array(length),
+ index = length,
+ placeholder = getHolder(wrapper);
+
+ while (index--) {
+ args[index] = arguments[index];
+ }
+ var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
+ ? []
+ : replaceHolders(args, placeholder);
+
+ length -= holders.length;
+ if (length < arity) {
+ return createRecurry(
+ func, bitmask, createHybrid, wrapper.placeholder, undefined$1,
+ args, holders, undefined$1, undefined$1, arity - length);
+ }
+ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+ return apply(fn, this, args);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Creates a `_.find` or `_.findLast` function.
+ *
+ * @private
+ * @param {Function} findIndexFunc The function to find the collection index.
+ * @returns {Function} Returns the new find function.
+ */
+ function createFind(findIndexFunc) {
+ return function(collection, predicate, fromIndex) {
+ var iterable = Object(collection);
+ if (!isArrayLike(collection)) {
+ var iteratee = getIteratee(predicate, 3);
+ collection = keys(collection);
+ predicate = function(key) { return iteratee(iterable[key], key, iterable); };
+ }
+ var index = findIndexFunc(collection, predicate, fromIndex);
+ return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined$1;
+ };
+ }
+
+ /**
+ * Creates a `_.flow` or `_.flowRight` function.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new flow function.
+ */
+ function createFlow(fromRight) {
+ return flatRest(function(funcs) {
+ var length = funcs.length,
+ index = length,
+ prereq = LodashWrapper.prototype.thru;
+
+ if (fromRight) {
+ funcs.reverse();
+ }
+ while (index--) {
+ var func = funcs[index];
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
+ var wrapper = new LodashWrapper([], true);
+ }
+ }
+ index = wrapper ? index : length;
+ while (++index < length) {
+ func = funcs[index];
+
+ var funcName = getFuncName(func),
+ data = funcName == 'wrapper' ? getData(func) : undefined$1;
+
+ if (data && isLaziable(data[0]) &&
+ data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
+ !data[4].length && data[9] == 1
+ ) {
+ wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
+ } else {
+ wrapper = (func.length == 1 && isLaziable(func))
+ ? wrapper[funcName]()
+ : wrapper.thru(func);
+ }
+ }
+ return function() {
+ var args = arguments,
+ value = args[0];
+
+ if (wrapper && args.length == 1 && isArray(value)) {
+ return wrapper.plant(value).value();
+ }
+ var index = 0,
+ result = length ? funcs[index].apply(this, args) : value;
+
+ while (++index < length) {
+ result = funcs[index].call(this, result);
+ }
+ return result;
+ };
+ });
+ }
+
+ /**
+ * Creates a function that wraps `func` to invoke it with optional `this`
+ * binding of `thisArg`, partial application, and currying.
+ *
+ * @private
+ * @param {Function|string} func The function or method name to wrap.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {Array} [partials] The arguments to prepend to those provided to
+ * the new function.
+ * @param {Array} [holders] The `partials` placeholder indexes.
+ * @param {Array} [partialsRight] The arguments to append to those provided
+ * to the new function.
+ * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} [ary] The arity cap of `func`.
+ * @param {number} [arity] The arity of `func`.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
+ var isAry = bitmask & WRAP_ARY_FLAG,
+ isBind = bitmask & WRAP_BIND_FLAG,
+ isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
+ isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
+ isFlip = bitmask & WRAP_FLIP_FLAG,
+ Ctor = isBindKey ? undefined$1 : createCtor(func);
+
+ function wrapper() {
+ var length = arguments.length,
+ args = Array(length),
+ index = length;
+
+ while (index--) {
+ args[index] = arguments[index];
+ }
+ if (isCurried) {
+ var placeholder = getHolder(wrapper),
+ holdersCount = countHolders(args, placeholder);
+ }
+ if (partials) {
+ args = composeArgs(args, partials, holders, isCurried);
+ }
+ if (partialsRight) {
+ args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
+ }
+ length -= holdersCount;
+ if (isCurried && length < arity) {
+ var newHolders = replaceHolders(args, placeholder);
+ return createRecurry(
+ func, bitmask, createHybrid, wrapper.placeholder, thisArg,
+ args, newHolders, argPos, ary, arity - length
+ );
+ }
+ var thisBinding = isBind ? thisArg : this,
+ fn = isBindKey ? thisBinding[func] : func;
+
+ length = args.length;
+ if (argPos) {
+ args = reorder(args, argPos);
+ } else if (isFlip && length > 1) {
+ args.reverse();
+ }
+ if (isAry && ary < length) {
+ args.length = ary;
+ }
+ if (this && this !== root && this instanceof wrapper) {
+ fn = Ctor || createCtor(fn);
+ }
+ return fn.apply(thisBinding, args);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Creates a function like `_.invertBy`.
+ *
+ * @private
+ * @param {Function} setter The function to set accumulator values.
+ * @param {Function} toIteratee The function to resolve iteratees.
+ * @returns {Function} Returns the new inverter function.
+ */
+ function createInverter(setter, toIteratee) {
+ return function(object, iteratee) {
+ return baseInverter(object, setter, toIteratee(iteratee), {});
+ };
+ }
+
+ /**
+ * Creates a function that performs a mathematical operation on two values.
+ *
+ * @private
+ * @param {Function} operator The function to perform the operation.
+ * @param {number} [defaultValue] The value used for `undefined` arguments.
+ * @returns {Function} Returns the new mathematical operation function.
+ */
+ function createMathOperation(operator, defaultValue) {
+ return function(value, other) {
+ var result;
+ if (value === undefined$1 && other === undefined$1) {
+ return defaultValue;
+ }
+ if (value !== undefined$1) {
+ result = value;
+ }
+ if (other !== undefined$1) {
+ if (result === undefined$1) {
+ return other;
+ }
+ if (typeof value == 'string' || typeof other == 'string') {
+ value = baseToString(value);
+ other = baseToString(other);
+ } else {
+ value = baseToNumber(value);
+ other = baseToNumber(other);
+ }
+ result = operator(value, other);
+ }
+ return result;
+ };
+ }
+
+ /**
+ * Creates a function like `_.over`.
+ *
+ * @private
+ * @param {Function} arrayFunc The function to iterate over iteratees.
+ * @returns {Function} Returns the new over function.
+ */
+ function createOver(arrayFunc) {
+ return flatRest(function(iteratees) {
+ iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
+ return baseRest(function(args) {
+ var thisArg = this;
+ return arrayFunc(iteratees, function(iteratee) {
+ return apply(iteratee, thisArg, args);
+ });
+ });
+ });
+ }
+
+ /**
+ * Creates the padding for `string` based on `length`. The `chars` string
+ * is truncated if the number of characters exceeds `length`.
+ *
+ * @private
+ * @param {number} length The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the padding for `string`.
+ */
+ function createPadding(length, chars) {
+ chars = chars === undefined$1 ? ' ' : baseToString(chars);
+
+ var charsLength = chars.length;
+ if (charsLength < 2) {
+ return charsLength ? baseRepeat(chars, length) : chars;
+ }
+ var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
+ return hasUnicode(chars)
+ ? castSlice(stringToArray(result), 0, length).join('')
+ : result.slice(0, length);
+ }
+
+ /**
+ * Creates a function that wraps `func` to invoke it with the `this` binding
+ * of `thisArg` and `partials` prepended to the arguments it receives.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {Array} partials The arguments to prepend to those provided to
+ * the new function.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createPartial(func, bitmask, thisArg, partials) {
+ var isBind = bitmask & WRAP_BIND_FLAG,
+ Ctor = createCtor(func);
+
+ function wrapper() {
+ var argsIndex = -1,
+ argsLength = arguments.length,
+ leftIndex = -1,
+ leftLength = partials.length,
+ args = Array(leftLength + argsLength),
+ fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
+
+ while (++leftIndex < leftLength) {
+ args[leftIndex] = partials[leftIndex];
+ }
+ while (argsLength--) {
+ args[leftIndex++] = arguments[++argsIndex];
+ }
+ return apply(fn, isBind ? thisArg : this, args);
+ }
+ return wrapper;
+ }
+
+ /**
+ * Creates a `_.range` or `_.rangeRight` function.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new range function.
+ */
+ function createRange(fromRight) {
+ return function(start, end, step) {
+ if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
+ end = step = undefined$1;
+ }
+ // Ensure the sign of `-0` is preserved.
+ start = toFinite(start);
+ if (end === undefined$1) {
+ end = start;
+ start = 0;
+ } else {
+ end = toFinite(end);
+ }
+ step = step === undefined$1 ? (start < end ? 1 : -1) : toFinite(step);
+ return baseRange(start, end, step, fromRight);
+ };
+ }
+
+ /**
+ * Creates a function that performs a relational operation on two values.
+ *
+ * @private
+ * @param {Function} operator The function to perform the operation.
+ * @returns {Function} Returns the new relational operation function.
+ */
+ function createRelationalOperation(operator) {
+ return function(value, other) {
+ if (!(typeof value == 'string' && typeof other == 'string')) {
+ value = toNumber(value);
+ other = toNumber(other);
+ }
+ return operator(value, other);
+ };
+ }
+
+ /**
+ * Creates a function that wraps `func` to continue currying.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @param {Function} wrapFunc The function to create the `func` wrapper.
+ * @param {*} placeholder The placeholder value.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {Array} [partials] The arguments to prepend to those provided to
+ * the new function.
+ * @param {Array} [holders] The `partials` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} [ary] The arity cap of `func`.
+ * @param {number} [arity] The arity of `func`.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
+ var isCurry = bitmask & WRAP_CURRY_FLAG,
+ newHolders = isCurry ? holders : undefined$1,
+ newHoldersRight = isCurry ? undefined$1 : holders,
+ newPartials = isCurry ? partials : undefined$1,
+ newPartialsRight = isCurry ? undefined$1 : partials;
+
+ bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
+ bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
+
+ if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
+ bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
+ }
+ var newData = [
+ func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
+ newHoldersRight, argPos, ary, arity
+ ];
+
+ var result = wrapFunc.apply(undefined$1, newData);
+ if (isLaziable(func)) {
+ setData(result, newData);
+ }
+ result.placeholder = placeholder;
+ return setWrapToString(result, func, bitmask);
+ }
+
+ /**
+ * Creates a function like `_.round`.
+ *
+ * @private
+ * @param {string} methodName The name of the `Math` method to use when rounding.
+ * @returns {Function} Returns the new round function.
+ */
+ function createRound(methodName) {
+ var func = Math[methodName];
+ return function(number, precision) {
+ number = toNumber(number);
+ precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
+ if (precision && nativeIsFinite(number)) {
+ // Shift with exponential notation to avoid floating-point issues.
+ // See [MDN](https://mdn.io/round#Examples) for more details.
+ var pair = (toString(number) + 'e').split('e'),
+ value = func(pair[0] + 'e' + (+pair[1] + precision));
+
+ pair = (toString(value) + 'e').split('e');
+ return +(pair[0] + 'e' + (+pair[1] - precision));
+ }
+ return func(number);
+ };
+ }
+
+ /**
+ * Creates a set object of `values`.
+ *
+ * @private
+ * @param {Array} values The values to add to the set.
+ * @returns {Object} Returns the new set.
+ */
+ var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
+ return new Set(values);
+ };
+
+ /**
+ * Creates a `_.toPairs` or `_.toPairsIn` function.
+ *
+ * @private
+ * @param {Function} keysFunc The function to get the keys of a given object.
+ * @returns {Function} Returns the new pairs function.
+ */
+ function createToPairs(keysFunc) {
+ return function(object) {
+ var tag = getTag(object);
+ if (tag == mapTag) {
+ return mapToArray(object);
+ }
+ if (tag == setTag) {
+ return setToPairs(object);
+ }
+ return baseToPairs(object, keysFunc(object));
+ };
+ }
+
+ /**
+ * Creates a function that either curries or invokes `func` with optional
+ * `this` binding and partially applied arguments.
+ *
+ * @private
+ * @param {Function|string} func The function or method name to wrap.
+ * @param {number} bitmask The bitmask flags.
+ * 1 - `_.bind`
+ * 2 - `_.bindKey`
+ * 4 - `_.curry` or `_.curryRight` of a bound function
+ * 8 - `_.curry`
+ * 16 - `_.curryRight`
+ * 32 - `_.partial`
+ * 64 - `_.partialRight`
+ * 128 - `_.rearg`
+ * 256 - `_.ary`
+ * 512 - `_.flip`
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {Array} [partials] The arguments to be partially applied.
+ * @param {Array} [holders] The `partials` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} [ary] The arity cap of `func`.
+ * @param {number} [arity] The arity of `func`.
+ * @returns {Function} Returns the new wrapped function.
+ */
+ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
+ var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
+ if (!isBindKey && typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ var length = partials ? partials.length : 0;
+ if (!length) {
+ bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
+ partials = holders = undefined$1;
+ }
+ ary = ary === undefined$1 ? ary : nativeMax(toInteger(ary), 0);
+ arity = arity === undefined$1 ? arity : toInteger(arity);
+ length -= holders ? holders.length : 0;
+
+ if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
+ var partialsRight = partials,
+ holdersRight = holders;
+
+ partials = holders = undefined$1;
+ }
+ var data = isBindKey ? undefined$1 : getData(func);
+
+ var newData = [
+ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
+ argPos, ary, arity
+ ];
+
+ if (data) {
+ mergeData(newData, data);
+ }
+ func = newData[0];
+ bitmask = newData[1];
+ thisArg = newData[2];
+ partials = newData[3];
+ holders = newData[4];
+ arity = newData[9] = newData[9] === undefined$1
+ ? (isBindKey ? 0 : func.length)
+ : nativeMax(newData[9] - length, 0);
+
+ if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
+ bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
+ }
+ if (!bitmask || bitmask == WRAP_BIND_FLAG) {
+ var result = createBind(func, bitmask, thisArg);
+ } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
+ result = createCurry(func, bitmask, arity);
+ } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
+ result = createPartial(func, bitmask, thisArg, partials);
+ } else {
+ result = createHybrid.apply(undefined$1, newData);
+ }
+ var setter = data ? baseSetData : setData;
+ return setWrapToString(setter(result, newData), func, bitmask);
+ }
+
+ /**
+ * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
+ * of source objects to the destination object for all destination properties
+ * that resolve to `undefined`.
+ *
+ * @private
+ * @param {*} objValue The destination value.
+ * @param {*} srcValue The source value.
+ * @param {string} key The key of the property to assign.
+ * @param {Object} object The parent object of `objValue`.
+ * @returns {*} Returns the value to assign.
+ */
+ function customDefaultsAssignIn(objValue, srcValue, key, object) {
+ if (objValue === undefined$1 ||
+ (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
+ return srcValue;
+ }
+ return objValue;
+ }
+
+ /**
+ * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
+ * objects into destination objects that are passed thru.
+ *
+ * @private
+ * @param {*} objValue The destination value.
+ * @param {*} srcValue The source value.
+ * @param {string} key The key of the property to merge.
+ * @param {Object} object The parent object of `objValue`.
+ * @param {Object} source The parent object of `srcValue`.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
+ * @returns {*} Returns the value to assign.
+ */
+ function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
+ if (isObject(objValue) && isObject(srcValue)) {
+ // Recursively merge objects and arrays (susceptible to call stack limits).
+ stack.set(srcValue, objValue);
+ baseMerge(objValue, srcValue, undefined$1, customDefaultsMerge, stack);
+ stack['delete'](srcValue);
+ }
+ return objValue;
+ }
+
+ /**
+ * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
+ * objects.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @param {string} key The key of the property to inspect.
+ * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
+ */
+ function customOmitClone(value) {
+ return isPlainObject(value) ? undefined$1 : value;
+ }
+
+ /**
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
+ * partial deep comparisons.
+ *
+ * @private
+ * @param {Array} array The array to compare.
+ * @param {Array} other The other array to compare.
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+ * @param {Function} customizer The function to customize comparisons.
+ * @param {Function} equalFunc The function to determine equivalents of values.
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
+ */
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
+ arrLength = array.length,
+ othLength = other.length;
+
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
+ return false;
+ }
+ // Check that cyclic values are equal.
+ var arrStacked = stack.get(array);
+ var othStacked = stack.get(other);
+ if (arrStacked && othStacked) {
+ return arrStacked == other && othStacked == array;
+ }
+ var index = -1,
+ result = true,
+ seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined$1;
+
+ stack.set(array, other);
+ stack.set(other, array);
+
+ // Ignore non-index properties.
+ while (++index < arrLength) {
+ var arrValue = array[index],
+ othValue = other[index];
+
+ if (customizer) {
+ var compared = isPartial
+ ? customizer(othValue, arrValue, index, other, array, stack)
+ : customizer(arrValue, othValue, index, array, other, stack);
+ }
+ if (compared !== undefined$1) {
+ if (compared) {
+ continue;
+ }
+ result = false;
+ break;
+ }
+ // Recursively compare arrays (susceptible to call stack limits).
+ if (seen) {
+ if (!arraySome(other, function(othValue, othIndex) {
+ if (!cacheHas(seen, othIndex) &&
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
+ return seen.push(othIndex);
+ }
+ })) {
+ result = false;
+ break;
+ }
+ } else if (!(
+ arrValue === othValue ||
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
+ )) {
+ result = false;
+ break;
+ }
+ }
+ stack['delete'](array);
+ stack['delete'](other);
+ return result;
+ }
+
+ /**
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
+ * the same `toStringTag`.
+ *
+ * **Note:** This function only supports comparing values with tags of
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {string} tag The `toStringTag` of the objects to compare.
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+ * @param {Function} customizer The function to customize comparisons.
+ * @param {Function} equalFunc The function to determine equivalents of values.
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
+ switch (tag) {
+ case dataViewTag:
+ if ((object.byteLength != other.byteLength) ||
+ (object.byteOffset != other.byteOffset)) {
+ return false;
+ }
+ object = object.buffer;
+ other = other.buffer;
+
+ case arrayBufferTag:
+ if ((object.byteLength != other.byteLength) ||
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
+ return false;
+ }
+ return true;
+
+ case boolTag:
+ case dateTag:
+ case numberTag:
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
+ // Invalid dates are coerced to `NaN`.
+ return eq(+object, +other);
+
+ case errorTag:
+ return object.name == other.name && object.message == other.message;
+
+ case regexpTag:
+ case stringTag:
+ // Coerce regexes to strings and treat strings, primitives and objects,
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
+ // for more details.
+ return object == (other + '');
+
+ case mapTag:
+ var convert = mapToArray;
+
+ case setTag:
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
+ convert || (convert = setToArray);
+
+ if (object.size != other.size && !isPartial) {
+ return false;
+ }
+ // Assume cyclic values are equal.
+ var stacked = stack.get(object);
+ if (stacked) {
+ return stacked == other;
+ }
+ bitmask |= COMPARE_UNORDERED_FLAG;
+
+ // Recursively compare objects (susceptible to call stack limits).
+ stack.set(object, other);
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
+ stack['delete'](object);
+ return result;
+
+ case symbolTag:
+ if (symbolValueOf) {
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * A specialized version of `baseIsEqualDeep` for objects with support for
+ * partial deep comparisons.
+ *
+ * @private
+ * @param {Object} object The object to compare.
+ * @param {Object} other The other object to compare.
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
+ * @param {Function} customizer The function to customize comparisons.
+ * @param {Function} equalFunc The function to determine equivalents of values.
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
+ */
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
+ objProps = getAllKeys(object),
+ objLength = objProps.length,
+ othProps = getAllKeys(other),
+ othLength = othProps.length;
+
+ if (objLength != othLength && !isPartial) {
+ return false;
+ }
+ var index = objLength;
+ while (index--) {
+ var key = objProps[index];
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
+ return false;
+ }
+ }
+ // Check that cyclic values are equal.
+ var objStacked = stack.get(object);
+ var othStacked = stack.get(other);
+ if (objStacked && othStacked) {
+ return objStacked == other && othStacked == object;
+ }
+ var result = true;
+ stack.set(object, other);
+ stack.set(other, object);
+
+ var skipCtor = isPartial;
+ while (++index < objLength) {
+ key = objProps[index];
+ var objValue = object[key],
+ othValue = other[key];
+
+ if (customizer) {
+ var compared = isPartial
+ ? customizer(othValue, objValue, key, other, object, stack)
+ : customizer(objValue, othValue, key, object, other, stack);
+ }
+ // Recursively compare objects (susceptible to call stack limits).
+ if (!(compared === undefined$1
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
+ : compared
+ )) {
+ result = false;
+ break;
+ }
+ skipCtor || (skipCtor = key == 'constructor');
+ }
+ if (result && !skipCtor) {
+ var objCtor = object.constructor,
+ othCtor = other.constructor;
+
+ // Non `Object` object instances with different constructors are not equal.
+ if (objCtor != othCtor &&
+ ('constructor' in object && 'constructor' in other) &&
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
+ result = false;
+ }
+ }
+ stack['delete'](object);
+ stack['delete'](other);
+ return result;
+ }
+
+ /**
+ * A specialized version of `baseRest` which flattens the rest array.
+ *
+ * @private
+ * @param {Function} func The function to apply a rest parameter to.
+ * @returns {Function} Returns the new function.
+ */
+ function flatRest(func) {
+ return setToString(overRest(func, undefined$1, flatten), func + '');
+ }
+
+ /**
+ * Creates an array of own enumerable property names and symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+ function getAllKeys(object) {
+ return baseGetAllKeys(object, keys, getSymbols);
+ }
+
+ /**
+ * Creates an array of own and inherited enumerable property names and
+ * symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+ function getAllKeysIn(object) {
+ return baseGetAllKeys(object, keysIn, getSymbolsIn);
+ }
+
+ /**
+ * Gets metadata for `func`.
+ *
+ * @private
+ * @param {Function} func The function to query.
+ * @returns {*} Returns the metadata for `func`.
+ */
+ var getData = !metaMap ? noop : function(func) {
+ return metaMap.get(func);
+ };
+
+ /**
+ * Gets the name of `func`.
+ *
+ * @private
+ * @param {Function} func The function to query.
+ * @returns {string} Returns the function name.
+ */
+ function getFuncName(func) {
+ var result = (func.name + ''),
+ array = realNames[result],
+ length = hasOwnProperty.call(realNames, result) ? array.length : 0;
+
+ while (length--) {
+ var data = array[length],
+ otherFunc = data.func;
+ if (otherFunc == null || otherFunc == func) {
+ return data.name;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the argument placeholder value for `func`.
+ *
+ * @private
+ * @param {Function} func The function to inspect.
+ * @returns {*} Returns the placeholder value.
+ */
+ function getHolder(func) {
+ var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
+ return object.placeholder;
+ }
+
+ /**
+ * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
+ * this function returns the custom method, otherwise it returns `baseIteratee`.
+ * If arguments are provided, the chosen function is invoked with them and
+ * its result is returned.
+ *
+ * @private
+ * @param {*} [value] The value to convert to an iteratee.
+ * @param {number} [arity] The arity of the created iteratee.
+ * @returns {Function} Returns the chosen function or its result.
+ */
+ function getIteratee() {
+ var result = lodash.iteratee || iteratee;
+ result = result === iteratee ? baseIteratee : result;
+ return arguments.length ? result(arguments[0], arguments[1]) : result;
+ }
+
+ /**
+ * Gets the data for `map`.
+ *
+ * @private
+ * @param {Object} map The map to query.
+ * @param {string} key The reference key.
+ * @returns {*} Returns the map data.
+ */
+ function getMapData(map, key) {
+ var data = map.__data__;
+ return isKeyable(key)
+ ? data[typeof key == 'string' ? 'string' : 'hash']
+ : data.map;
+ }
+
+ /**
+ * Gets the property names, values, and compare flags of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the match data of `object`.
+ */
+ function getMatchData(object) {
+ var result = keys(object),
+ length = result.length;
+
+ while (length--) {
+ var key = result[length],
+ value = object[key];
+
+ result[length] = [key, value, isStrictComparable(value)];
+ }
+ return result;
+ }
+
+ /**
+ * Gets the native function at `key` of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {string} key The key of the method to get.
+ * @returns {*} Returns the function if it's native, else `undefined`.
+ */
+ function getNative(object, key) {
+ var value = getValue(object, key);
+ return baseIsNative(value) ? value : undefined$1;
+ }
+
+ /**
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the raw `toStringTag`.
+ */
+ function getRawTag(value) {
+ var isOwn = hasOwnProperty.call(value, symToStringTag),
+ tag = value[symToStringTag];
+
+ try {
+ value[symToStringTag] = undefined$1;
+ var unmasked = true;
+ } catch (e) {}
+
+ var result = nativeObjectToString.call(value);
+ if (unmasked) {
+ if (isOwn) {
+ value[symToStringTag] = tag;
+ } else {
+ delete value[symToStringTag];
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Creates an array of the own enumerable symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of symbols.
+ */
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
+ if (object == null) {
+ return [];
+ }
+ object = Object(object);
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
+ return propertyIsEnumerable.call(object, symbol);
+ });
+ };
+
+ /**
+ * Creates an array of the own and inherited enumerable symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of symbols.
+ */
+ var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
+ var result = [];
+ while (object) {
+ arrayPush(result, getSymbols(object));
+ object = getPrototype(object);
+ }
+ return result;
+ };
+
+ /**
+ * Gets the `toStringTag` of `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
+ */
+ var getTag = baseGetTag;
+
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
+ (Map && getTag(new Map) != mapTag) ||
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
+ (Set && getTag(new Set) != setTag) ||
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
+ getTag = function(value) {
+ var result = baseGetTag(value),
+ Ctor = result == objectTag ? value.constructor : undefined$1,
+ ctorString = Ctor ? toSource(Ctor) : '';
+
+ if (ctorString) {
+ switch (ctorString) {
+ case dataViewCtorString: return dataViewTag;
+ case mapCtorString: return mapTag;
+ case promiseCtorString: return promiseTag;
+ case setCtorString: return setTag;
+ case weakMapCtorString: return weakMapTag;
+ }
+ }
+ return result;
+ };
+ }
+
+ /**
+ * Gets the view, applying any `transforms` to the `start` and `end` positions.
+ *
+ * @private
+ * @param {number} start The start of the view.
+ * @param {number} end The end of the view.
+ * @param {Array} transforms The transformations to apply to the view.
+ * @returns {Object} Returns an object containing the `start` and `end`
+ * positions of the view.
+ */
+ function getView(start, end, transforms) {
+ var index = -1,
+ length = transforms.length;
+
+ while (++index < length) {
+ var data = transforms[index],
+ size = data.size;
+
+ switch (data.type) {
+ case 'drop': start += size; break;
+ case 'dropRight': end -= size; break;
+ case 'take': end = nativeMin(end, start + size); break;
+ case 'takeRight': start = nativeMax(start, end - size); break;
+ }
+ }
+ return { 'start': start, 'end': end };
+ }
+
+ /**
+ * Extracts wrapper details from the `source` body comment.
+ *
+ * @private
+ * @param {string} source The source to inspect.
+ * @returns {Array} Returns the wrapper details.
+ */
+ function getWrapDetails(source) {
+ var match = source.match(reWrapDetails);
+ return match ? match[1].split(reSplitDetails) : [];
+ }
+
+ /**
+ * Checks if `path` exists on `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path to check.
+ * @param {Function} hasFunc The function to check properties.
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
+ */
+ function hasPath(object, path, hasFunc) {
+ path = castPath(path, object);
+
+ var index = -1,
+ length = path.length,
+ result = false;
+
+ while (++index < length) {
+ var key = toKey(path[index]);
+ if (!(result = object != null && hasFunc(object, key))) {
+ break;
+ }
+ object = object[key];
+ }
+ if (result || ++index != length) {
+ return result;
+ }
+ length = object == null ? 0 : object.length;
+ return !!length && isLength(length) && isIndex(key, length) &&
+ (isArray(object) || isArguments(object));
+ }
+
+ /**
+ * Initializes an array clone.
+ *
+ * @private
+ * @param {Array} array The array to clone.
+ * @returns {Array} Returns the initialized clone.
+ */
+ function initCloneArray(array) {
+ var length = array.length,
+ result = new array.constructor(length);
+
+ // Add properties assigned by `RegExp#exec`.
+ if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
+ result.index = array.index;
+ result.input = array.input;
+ }
+ return result;
+ }
+
+ /**
+ * Initializes an object clone.
+ *
+ * @private
+ * @param {Object} object The object to clone.
+ * @returns {Object} Returns the initialized clone.
+ */
+ function initCloneObject(object) {
+ return (typeof object.constructor == 'function' && !isPrototype(object))
+ ? baseCreate(getPrototype(object))
+ : {};
+ }
+
+ /**
+ * Initializes an object clone based on its `toStringTag`.
+ *
+ * **Note:** This function only supports cloning values with tags of
+ * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
+ *
+ * @private
+ * @param {Object} object The object to clone.
+ * @param {string} tag The `toStringTag` of the object to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the initialized clone.
+ */
+ function initCloneByTag(object, tag, isDeep) {
+ var Ctor = object.constructor;
+ switch (tag) {
+ case arrayBufferTag:
+ return cloneArrayBuffer(object);
+
+ case boolTag:
+ case dateTag:
+ return new Ctor(+object);
+
+ case dataViewTag:
+ return cloneDataView(object, isDeep);
+
+ case float32Tag: case float64Tag:
+ case int8Tag: case int16Tag: case int32Tag:
+ case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
+ return cloneTypedArray(object, isDeep);
+
+ case mapTag:
+ return new Ctor;
+
+ case numberTag:
+ case stringTag:
+ return new Ctor(object);
+
+ case regexpTag:
+ return cloneRegExp(object);
+
+ case setTag:
+ return new Ctor;
+
+ case symbolTag:
+ return cloneSymbol(object);
+ }
+ }
+
+ /**
+ * Inserts wrapper `details` in a comment at the top of the `source` body.
+ *
+ * @private
+ * @param {string} source The source to modify.
+ * @returns {Array} details The details to insert.
+ * @returns {string} Returns the modified source.
+ */
+ function insertWrapDetails(source, details) {
+ var length = details.length;
+ if (!length) {
+ return source;
+ }
+ var lastIndex = length - 1;
+ details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
+ details = details.join(length > 2 ? ', ' : ' ');
+ return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
+ }
+
+ /**
+ * Checks if `value` is a flattenable `arguments` object or array.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+ */
+ function isFlattenable(value) {
+ return isArray(value) || isArguments(value) ||
+ !!(spreadableSymbol && value && value[spreadableSymbol]);
+ }
+
+ /**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+ function isIndex(value, length) {
+ var type = typeof value;
+ length = length == null ? MAX_SAFE_INTEGER : length;
+
+ return !!length &&
+ (type == 'number' ||
+ (type != 'symbol' && reIsUint.test(value))) &&
+ (value > -1 && value % 1 == 0 && value < length);
+ }
+
+ /**
+ * Checks if the given arguments are from an iteratee call.
+ *
+ * @private
+ * @param {*} value The potential iteratee value argument.
+ * @param {*} index The potential iteratee index or key argument.
+ * @param {*} object The potential iteratee object argument.
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
+ * else `false`.
+ */
+ function isIterateeCall(value, index, object) {
+ if (!isObject(object)) {
+ return false;
+ }
+ var type = typeof index;
+ if (type == 'number'
+ ? (isArrayLike(object) && isIndex(index, object.length))
+ : (type == 'string' && index in object)
+ ) {
+ return eq(object[index], value);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if `value` is a property name and not a property path.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {Object} [object] The object to query keys on.
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
+ */
+ function isKey(value, object) {
+ if (isArray(value)) {
+ return false;
+ }
+ var type = typeof value;
+ if (type == 'number' || type == 'symbol' || type == 'boolean' ||
+ value == null || isSymbol(value)) {
+ return true;
+ }
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
+ (object != null && value in Object(object));
+ }
+
+ /**
+ * Checks if `value` is suitable for use as unique object key.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
+ */
+ function isKeyable(value) {
+ var type = typeof value;
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
+ ? (value !== '__proto__')
+ : (value === null);
+ }
+
+ /**
+ * Checks if `func` has a lazy counterpart.
+ *
+ * @private
+ * @param {Function} func The function to check.
+ * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
+ * else `false`.
+ */
+ function isLaziable(func) {
+ var funcName = getFuncName(func),
+ other = lodash[funcName];
+
+ if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
+ return false;
+ }
+ if (func === other) {
+ return true;
+ }
+ var data = getData(other);
+ return !!data && func === data[0];
+ }
+
+ /**
+ * Checks if `func` has its source masked.
+ *
+ * @private
+ * @param {Function} func The function to check.
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
+ */
+ function isMasked(func) {
+ return !!maskSrcKey && (maskSrcKey in func);
+ }
+
+ /**
+ * Checks if `func` is capable of being masked.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
+ */
+ var isMaskable = coreJsData ? isFunction : stubFalse;
+
+ /**
+ * Checks if `value` is likely a prototype object.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
+ */
+ function isPrototype(value) {
+ var Ctor = value && value.constructor,
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
+
+ return value === proto;
+ }
+
+ /**
+ * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` if suitable for strict
+ * equality comparisons, else `false`.
+ */
+ function isStrictComparable(value) {
+ return value === value && !isObject(value);
+ }
+
+ /**
+ * A specialized version of `matchesProperty` for source values suitable
+ * for strict equality comparisons, i.e. `===`.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @param {*} srcValue The value to match.
+ * @returns {Function} Returns the new spec function.
+ */
+ function matchesStrictComparable(key, srcValue) {
+ return function(object) {
+ if (object == null) {
+ return false;
+ }
+ return object[key] === srcValue &&
+ (srcValue !== undefined$1 || (key in Object(object)));
+ };
+ }
+
+ /**
+ * A specialized version of `_.memoize` which clears the memoized function's
+ * cache when it exceeds `MAX_MEMOIZE_SIZE`.
+ *
+ * @private
+ * @param {Function} func The function to have its output memoized.
+ * @returns {Function} Returns the new memoized function.
+ */
+ function memoizeCapped(func) {
+ var result = memoize(func, function(key) {
+ if (cache.size === MAX_MEMOIZE_SIZE) {
+ cache.clear();
+ }
+ return key;
+ });
+
+ var cache = result.cache;
+ return result;
+ }
+
+ /**
+ * Merges the function metadata of `source` into `data`.
+ *
+ * Merging metadata reduces the number of wrappers used to invoke a function.
+ * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
+ * may be applied regardless of execution order. Methods like `_.ary` and
+ * `_.rearg` modify function arguments, making the order in which they are
+ * executed important, preventing the merging of metadata. However, we make
+ * an exception for a safe combined case where curried functions have `_.ary`
+ * and or `_.rearg` applied.
+ *
+ * @private
+ * @param {Array} data The destination metadata.
+ * @param {Array} source The source metadata.
+ * @returns {Array} Returns `data`.
+ */
+ function mergeData(data, source) {
+ var bitmask = data[1],
+ srcBitmask = source[1],
+ newBitmask = bitmask | srcBitmask,
+ isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
+
+ var isCombo =
+ ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
+ ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
+ ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
+
+ // Exit early if metadata can't be merged.
+ if (!(isCommon || isCombo)) {
+ return data;
+ }
+ // Use source `thisArg` if available.
+ if (srcBitmask & WRAP_BIND_FLAG) {
+ data[2] = source[2];
+ // Set when currying a bound function.
+ newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
+ }
+ // Compose partial arguments.
+ var value = source[3];
+ if (value) {
+ var partials = data[3];
+ data[3] = partials ? composeArgs(partials, value, source[4]) : value;
+ data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
+ }
+ // Compose partial right arguments.
+ value = source[5];
+ if (value) {
+ partials = data[5];
+ data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
+ data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
+ }
+ // Use source `argPos` if available.
+ value = source[7];
+ if (value) {
+ data[7] = value;
+ }
+ // Use source `ary` if it's smaller.
+ if (srcBitmask & WRAP_ARY_FLAG) {
+ data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
+ }
+ // Use source `arity` if one is not provided.
+ if (data[9] == null) {
+ data[9] = source[9];
+ }
+ // Use source `func` and merge bitmasks.
+ data[0] = source[0];
+ data[1] = newBitmask;
+
+ return data;
+ }
+
+ /**
+ * This function is like
+ * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+ * except that it includes inherited enumerable properties.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+ function nativeKeysIn(object) {
+ var result = [];
+ if (object != null) {
+ for (var key in Object(object)) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Converts `value` to a string using `Object.prototype.toString`.
+ *
+ * @private
+ * @param {*} value The value to convert.
+ * @returns {string} Returns the converted string.
+ */
+ function objectToString(value) {
+ return nativeObjectToString.call(value);
+ }
+
+ /**
+ * A specialized version of `baseRest` which transforms the rest array.
+ *
+ * @private
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @param {Function} transform The rest array transform.
+ * @returns {Function} Returns the new function.
+ */
+ function overRest(func, start, transform) {
+ start = nativeMax(start === undefined$1 ? (func.length - 1) : start, 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ array = Array(length);
+
+ while (++index < length) {
+ array[index] = args[start + index];
+ }
+ index = -1;
+ var otherArgs = Array(start + 1);
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = transform(array);
+ return apply(func, this, otherArgs);
+ };
+ }
+
+ /**
+ * Gets the parent value at `path` of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} path The path to get the parent value of.
+ * @returns {*} Returns the parent value.
+ */
+ function parent(object, path) {
+ return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
+ }
+
+ /**
+ * Reorder `array` according to the specified indexes where the element at
+ * the first index is assigned as the first element, the element at
+ * the second index is assigned as the second element, and so on.
+ *
+ * @private
+ * @param {Array} array The array to reorder.
+ * @param {Array} indexes The arranged array indexes.
+ * @returns {Array} Returns `array`.
+ */
+ function reorder(array, indexes) {
+ var arrLength = array.length,
+ length = nativeMin(indexes.length, arrLength),
+ oldArray = copyArray(array);
+
+ while (length--) {
+ var index = indexes[length];
+ array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined$1;
+ }
+ return array;
+ }
+
+ /**
+ * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {string} key The key of the property to get.
+ * @returns {*} Returns the property value.
+ */
+ function safeGet(object, key) {
+ if (key === 'constructor' && typeof object[key] === 'function') {
+ return;
+ }
+
+ if (key == '__proto__') {
+ return;
+ }
+
+ return object[key];
+ }
+
+ /**
+ * Sets metadata for `func`.
+ *
+ * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
+ * period of time, it will trip its breaker and transition to an identity
+ * function to avoid garbage collection pauses in V8. See
+ * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
+ * for more details.
+ *
+ * @private
+ * @param {Function} func The function to associate metadata with.
+ * @param {*} data The metadata.
+ * @returns {Function} Returns `func`.
+ */
+ var setData = shortOut(baseSetData);
+
+ /**
+ * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
+ *
+ * @private
+ * @param {Function} func The function to delay.
+ * @param {number} wait The number of milliseconds to delay invocation.
+ * @returns {number|Object} Returns the timer id or timeout object.
+ */
+ var setTimeout = ctxSetTimeout || function(func, wait) {
+ return root.setTimeout(func, wait);
+ };
+
+ /**
+ * Sets the `toString` method of `func` to return `string`.
+ *
+ * @private
+ * @param {Function} func The function to modify.
+ * @param {Function} string The `toString` result.
+ * @returns {Function} Returns `func`.
+ */
+ var setToString = shortOut(baseSetToString);
+
+ /**
+ * Sets the `toString` method of `wrapper` to mimic the source of `reference`
+ * with wrapper details in a comment at the top of the source body.
+ *
+ * @private
+ * @param {Function} wrapper The function to modify.
+ * @param {Function} reference The reference function.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @returns {Function} Returns `wrapper`.
+ */
+ function setWrapToString(wrapper, reference, bitmask) {
+ var source = (reference + '');
+ return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
+ }
+
+ /**
+ * Creates a function that'll short out and invoke `identity` instead
+ * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
+ * milliseconds.
+ *
+ * @private
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new shortable function.
+ */
+ function shortOut(func) {
+ var count = 0,
+ lastCalled = 0;
+
+ return function() {
+ var stamp = nativeNow(),
+ remaining = HOT_SPAN - (stamp - lastCalled);
+
+ lastCalled = stamp;
+ if (remaining > 0) {
+ if (++count >= HOT_COUNT) {
+ return arguments[0];
+ }
+ } else {
+ count = 0;
+ }
+ return func.apply(undefined$1, arguments);
+ };
+ }
+
+ /**
+ * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
+ *
+ * @private
+ * @param {Array} array The array to shuffle.
+ * @param {number} [size=array.length] The size of `array`.
+ * @returns {Array} Returns `array`.
+ */
+ function shuffleSelf(array, size) {
+ var index = -1,
+ length = array.length,
+ lastIndex = length - 1;
+
+ size = size === undefined$1 ? length : size;
+ while (++index < size) {
+ var rand = baseRandom(index, lastIndex),
+ value = array[rand];
+
+ array[rand] = array[index];
+ array[index] = value;
+ }
+ array.length = size;
+ return array;
+ }
+
+ /**
+ * Converts `string` to a property path array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the property path array.
+ */
+ var stringToPath = memoizeCapped(function(string) {
+ var result = [];
+ if (string.charCodeAt(0) === 46 /* . */) {
+ result.push('');
+ }
+ string.replace(rePropName, function(match, number, quote, subString) {
+ result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
+ });
+ return result;
+ });
+
+ /**
+ * Converts `value` to a string key if it's not a string or symbol.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {string|symbol} Returns the key.
+ */
+ function toKey(value) {
+ if (typeof value == 'string' || isSymbol(value)) {
+ return value;
+ }
+ var result = (value + '');
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
+ }
+
+ /**
+ * Converts `func` to its source code.
+ *
+ * @private
+ * @param {Function} func The function to convert.
+ * @returns {string} Returns the source code.
+ */
+ function toSource(func) {
+ if (func != null) {
+ try {
+ return funcToString.call(func);
+ } catch (e) {}
+ try {
+ return (func + '');
+ } catch (e) {}
+ }
+ return '';
+ }
+
+ /**
+ * Updates wrapper `details` based on `bitmask` flags.
+ *
+ * @private
+ * @returns {Array} details The details to modify.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @returns {Array} Returns `details`.
+ */
+ function updateWrapDetails(details, bitmask) {
+ arrayEach(wrapFlags, function(pair) {
+ var value = '_.' + pair[0];
+ if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
+ details.push(value);
+ }
+ });
+ return details.sort();
+ }
+
+ /**
+ * Creates a clone of `wrapper`.
+ *
+ * @private
+ * @param {Object} wrapper The wrapper to clone.
+ * @returns {Object} Returns the cloned wrapper.
+ */
+ function wrapperClone(wrapper) {
+ if (wrapper instanceof LazyWrapper) {
+ return wrapper.clone();
+ }
+ var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
+ result.__actions__ = copyArray(wrapper.__actions__);
+ result.__index__ = wrapper.__index__;
+ result.__values__ = wrapper.__values__;
+ return result;
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an array of elements split into groups the length of `size`.
+ * If `array` can't be split evenly, the final chunk will be the remaining
+ * elements.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to process.
+ * @param {number} [size=1] The length of each chunk
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the new array of chunks.
+ * @example
+ *
+ * _.chunk(['a', 'b', 'c', 'd'], 2);
+ * // => [['a', 'b'], ['c', 'd']]
+ *
+ * _.chunk(['a', 'b', 'c', 'd'], 3);
+ * // => [['a', 'b', 'c'], ['d']]
+ */
+ function chunk(array, size, guard) {
+ if ((guard ? isIterateeCall(array, size, guard) : size === undefined$1)) {
+ size = 1;
+ } else {
+ size = nativeMax(toInteger(size), 0);
+ }
+ var length = array == null ? 0 : array.length;
+ if (!length || size < 1) {
+ return [];
+ }
+ var index = 0,
+ resIndex = 0,
+ result = Array(nativeCeil(length / size));
+
+ while (index < length) {
+ result[resIndex++] = baseSlice(array, index, (index += size));
+ }
+ return result;
+ }
+
+ /**
+ * Creates an array with all falsey values removed. The values `false`, `null`,
+ * `0`, `""`, `undefined`, and `NaN` are falsey.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to compact.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.compact([0, 1, false, 2, '', 3]);
+ * // => [1, 2, 3]
+ */
+ function compact(array) {
+ var index = -1,
+ length = array == null ? 0 : array.length,
+ resIndex = 0,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index];
+ if (value) {
+ result[resIndex++] = value;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Creates a new array concatenating `array` with any additional arrays
+ * and/or values.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to concatenate.
+ * @param {...*} [values] The values to concatenate.
+ * @returns {Array} Returns the new concatenated array.
+ * @example
+ *
+ * var array = [1];
+ * var other = _.concat(array, 2, [3], [[4]]);
+ *
+ * console.log(other);
+ * // => [1, 2, 3, [4]]
+ *
+ * console.log(array);
+ * // => [1]
+ */
+ function concat() {
+ var length = arguments.length;
+ if (!length) {
+ return [];
+ }
+ var args = Array(length - 1),
+ array = arguments[0],
+ index = length;
+
+ while (index--) {
+ args[index - 1] = arguments[index];
+ }
+ return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
+ }
+
+ /**
+ * Creates an array of `array` values not included in the other given arrays
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons. The order and references of result values are
+ * determined by the first array.
+ *
+ * **Note:** Unlike `_.pullAll`, this method returns a new array.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {...Array} [values] The values to exclude.
+ * @returns {Array} Returns the new array of filtered values.
+ * @see _.without, _.xor
+ * @example
+ *
+ * _.difference([2, 1], [2, 3]);
+ * // => [1]
+ */
+ var difference = baseRest(function(array, values) {
+ return isArrayLikeObject(array)
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
+ : [];
+ });
+
+ /**
+ * This method is like `_.difference` except that it accepts `iteratee` which
+ * is invoked for each element of `array` and `values` to generate the criterion
+ * by which they're compared. The order and references of result values are
+ * determined by the first array. The iteratee is invoked with one argument:
+ * (value).
+ *
+ * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {...Array} [values] The values to exclude.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
+ * // => [1.2]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
+ * // => [{ 'x': 2 }]
+ */
+ var differenceBy = baseRest(function(array, values) {
+ var iteratee = last(values);
+ if (isArrayLikeObject(iteratee)) {
+ iteratee = undefined$1;
+ }
+ return isArrayLikeObject(array)
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
+ : [];
+ });
+
+ /**
+ * This method is like `_.difference` except that it accepts `comparator`
+ * which is invoked to compare elements of `array` to `values`. The order and
+ * references of result values are determined by the first array. The comparator
+ * is invoked with two arguments: (arrVal, othVal).
+ *
+ * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {...Array} [values] The values to exclude.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+ *
+ * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
+ * // => [{ 'x': 2, 'y': 1 }]
+ */
+ var differenceWith = baseRest(function(array, values) {
+ var comparator = last(values);
+ if (isArrayLikeObject(comparator)) {
+ comparator = undefined$1;
+ }
+ return isArrayLikeObject(array)
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined$1, comparator)
+ : [];
+ });
+
+ /**
+ * Creates a slice of `array` with `n` elements dropped from the beginning.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.5.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to drop.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.drop([1, 2, 3]);
+ * // => [2, 3]
+ *
+ * _.drop([1, 2, 3], 2);
+ * // => [3]
+ *
+ * _.drop([1, 2, 3], 5);
+ * // => []
+ *
+ * _.drop([1, 2, 3], 0);
+ * // => [1, 2, 3]
+ */
+ function drop(array, n, guard) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return [];
+ }
+ n = (guard || n === undefined$1) ? 1 : toInteger(n);
+ return baseSlice(array, n < 0 ? 0 : n, length);
+ }
+
+ /**
+ * Creates a slice of `array` with `n` elements dropped from the end.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to drop.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.dropRight([1, 2, 3]);
+ * // => [1, 2]
+ *
+ * _.dropRight([1, 2, 3], 2);
+ * // => [1]
+ *
+ * _.dropRight([1, 2, 3], 5);
+ * // => []
+ *
+ * _.dropRight([1, 2, 3], 0);
+ * // => [1, 2, 3]
+ */
+ function dropRight(array, n, guard) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return [];
+ }
+ n = (guard || n === undefined$1) ? 1 : toInteger(n);
+ n = length - n;
+ return baseSlice(array, 0, n < 0 ? 0 : n);
+ }
+
+ /**
+ * Creates a slice of `array` excluding elements dropped from the end.
+ * Elements are dropped until `predicate` returns falsey. The predicate is
+ * invoked with three arguments: (value, index, array).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': false }
+ * ];
+ *
+ * _.dropRightWhile(users, function(o) { return !o.active; });
+ * // => objects for ['barney']
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
+ * // => objects for ['barney', 'fred']
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.dropRightWhile(users, ['active', false]);
+ * // => objects for ['barney']
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.dropRightWhile(users, 'active');
+ * // => objects for ['barney', 'fred', 'pebbles']
+ */
+ function dropRightWhile(array, predicate) {
+ return (array && array.length)
+ ? baseWhile(array, getIteratee(predicate, 3), true, true)
+ : [];
+ }
+
+ /**
+ * Creates a slice of `array` excluding elements dropped from the beginning.
+ * Elements are dropped until `predicate` returns falsey. The predicate is
+ * invoked with three arguments: (value, index, array).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': false },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': true }
+ * ];
+ *
+ * _.dropWhile(users, function(o) { return !o.active; });
+ * // => objects for ['pebbles']
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.dropWhile(users, { 'user': 'barney', 'active': false });
+ * // => objects for ['fred', 'pebbles']
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.dropWhile(users, ['active', false]);
+ * // => objects for ['pebbles']
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.dropWhile(users, 'active');
+ * // => objects for ['barney', 'fred', 'pebbles']
+ */
+ function dropWhile(array, predicate) {
+ return (array && array.length)
+ ? baseWhile(array, getIteratee(predicate, 3), true)
+ : [];
+ }
+
+ /**
+ * Fills elements of `array` with `value` from `start` up to, but not
+ * including, `end`.
+ *
+ * **Note:** This method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.2.0
+ * @category Array
+ * @param {Array} array The array to fill.
+ * @param {*} value The value to fill `array` with.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = [1, 2, 3];
+ *
+ * _.fill(array, 'a');
+ * console.log(array);
+ * // => ['a', 'a', 'a']
+ *
+ * _.fill(Array(3), 2);
+ * // => [2, 2, 2]
+ *
+ * _.fill([4, 6, 8, 10], '*', 1, 3);
+ * // => [4, '*', '*', 10]
+ */
+ function fill(array, value, start, end) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return [];
+ }
+ if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
+ start = 0;
+ end = length;
+ }
+ return baseFill(array, value, start, end);
+ }
+
+ /**
+ * This method is like `_.find` except that it returns the index of the first
+ * element `predicate` returns truthy for instead of the element itself.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.1.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @returns {number} Returns the index of the found element, else `-1`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': false },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': true }
+ * ];
+ *
+ * _.findIndex(users, function(o) { return o.user == 'barney'; });
+ * // => 0
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.findIndex(users, { 'user': 'fred', 'active': false });
+ * // => 1
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.findIndex(users, ['active', false]);
+ * // => 0
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.findIndex(users, 'active');
+ * // => 2
+ */
+ function findIndex(array, predicate, fromIndex) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return -1;
+ }
+ var index = fromIndex == null ? 0 : toInteger(fromIndex);
+ if (index < 0) {
+ index = nativeMax(length + index, 0);
+ }
+ return baseFindIndex(array, getIteratee(predicate, 3), index);
+ }
+
+ /**
+ * This method is like `_.findIndex` except that it iterates over elements
+ * of `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @param {number} [fromIndex=array.length-1] The index to search from.
+ * @returns {number} Returns the index of the found element, else `-1`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': false }
+ * ];
+ *
+ * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
+ * // => 2
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.findLastIndex(users, { 'user': 'barney', 'active': true });
+ * // => 0
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.findLastIndex(users, ['active', false]);
+ * // => 2
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.findLastIndex(users, 'active');
+ * // => 0
+ */
+ function findLastIndex(array, predicate, fromIndex) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return -1;
+ }
+ var index = length - 1;
+ if (fromIndex !== undefined$1) {
+ index = toInteger(fromIndex);
+ index = fromIndex < 0
+ ? nativeMax(length + index, 0)
+ : nativeMin(index, length - 1);
+ }
+ return baseFindIndex(array, getIteratee(predicate, 3), index, true);
+ }
+
+ /**
+ * Flattens `array` a single level deep.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to flatten.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * _.flatten([1, [2, [3, [4]], 5]]);
+ * // => [1, 2, [3, [4]], 5]
+ */
+ function flatten(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? baseFlatten(array, 1) : [];
+ }
+
+ /**
+ * Recursively flattens `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to flatten.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * _.flattenDeep([1, [2, [3, [4]], 5]]);
+ * // => [1, 2, 3, 4, 5]
+ */
+ function flattenDeep(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? baseFlatten(array, INFINITY) : [];
+ }
+
+ /**
+ * Recursively flatten `array` up to `depth` times.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.4.0
+ * @category Array
+ * @param {Array} array The array to flatten.
+ * @param {number} [depth=1] The maximum recursion depth.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * var array = [1, [2, [3, [4]], 5]];
+ *
+ * _.flattenDepth(array, 1);
+ * // => [1, 2, [3, [4]], 5]
+ *
+ * _.flattenDepth(array, 2);
+ * // => [1, 2, 3, [4], 5]
+ */
+ function flattenDepth(array, depth) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return [];
+ }
+ depth = depth === undefined$1 ? 1 : toInteger(depth);
+ return baseFlatten(array, depth);
+ }
+
+ /**
+ * The inverse of `_.toPairs`; this method returns an object composed
+ * from key-value `pairs`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} pairs The key-value pairs.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * _.fromPairs([['a', 1], ['b', 2]]);
+ * // => { 'a': 1, 'b': 2 }
+ */
+ function fromPairs(pairs) {
+ var index = -1,
+ length = pairs == null ? 0 : pairs.length,
+ result = {};
+
+ while (++index < length) {
+ var pair = pairs[index];
+ result[pair[0]] = pair[1];
+ }
+ return result;
+ }
+
+ /**
+ * Gets the first element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @alias first
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {*} Returns the first element of `array`.
+ * @example
+ *
+ * _.head([1, 2, 3]);
+ * // => 1
+ *
+ * _.head([]);
+ * // => undefined
+ */
+ function head(array) {
+ return (array && array.length) ? array[0] : undefined$1;
+ }
+
+ /**
+ * Gets the index at which the first occurrence of `value` is found in `array`
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons. If `fromIndex` is negative, it's used as the
+ * offset from the end of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.indexOf([1, 2, 1, 2], 2);
+ * // => 1
+ *
+ * // Search from the `fromIndex`.
+ * _.indexOf([1, 2, 1, 2], 2, 2);
+ * // => 3
+ */
+ function indexOf(array, value, fromIndex) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return -1;
+ }
+ var index = fromIndex == null ? 0 : toInteger(fromIndex);
+ if (index < 0) {
+ index = nativeMax(length + index, 0);
+ }
+ return baseIndexOf(array, value, index);
+ }
+
+ /**
+ * Gets all but the last element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.initial([1, 2, 3]);
+ * // => [1, 2]
+ */
+ function initial(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? baseSlice(array, 0, -1) : [];
+ }
+
+ /**
+ * Creates an array of unique values that are included in all given arrays
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons. The order and references of result values are
+ * determined by the first array.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @returns {Array} Returns the new array of intersecting values.
+ * @example
+ *
+ * _.intersection([2, 1], [2, 3]);
+ * // => [2]
+ */
+ var intersection = baseRest(function(arrays) {
+ var mapped = arrayMap(arrays, castArrayLikeObject);
+ return (mapped.length && mapped[0] === arrays[0])
+ ? baseIntersection(mapped)
+ : [];
+ });
+
+ /**
+ * This method is like `_.intersection` except that it accepts `iteratee`
+ * which is invoked for each element of each `arrays` to generate the criterion
+ * by which they're compared. The order and references of result values are
+ * determined by the first array. The iteratee is invoked with one argument:
+ * (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {Array} Returns the new array of intersecting values.
+ * @example
+ *
+ * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
+ * // => [2.1]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+ * // => [{ 'x': 1 }]
+ */
+ var intersectionBy = baseRest(function(arrays) {
+ var iteratee = last(arrays),
+ mapped = arrayMap(arrays, castArrayLikeObject);
+
+ if (iteratee === last(mapped)) {
+ iteratee = undefined$1;
+ } else {
+ mapped.pop();
+ }
+ return (mapped.length && mapped[0] === arrays[0])
+ ? baseIntersection(mapped, getIteratee(iteratee, 2))
+ : [];
+ });
+
+ /**
+ * This method is like `_.intersection` except that it accepts `comparator`
+ * which is invoked to compare elements of `arrays`. The order and references
+ * of result values are determined by the first array. The comparator is
+ * invoked with two arguments: (arrVal, othVal).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new array of intersecting values.
+ * @example
+ *
+ * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+ * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+ *
+ * _.intersectionWith(objects, others, _.isEqual);
+ * // => [{ 'x': 1, 'y': 2 }]
+ */
+ var intersectionWith = baseRest(function(arrays) {
+ var comparator = last(arrays),
+ mapped = arrayMap(arrays, castArrayLikeObject);
+
+ comparator = typeof comparator == 'function' ? comparator : undefined$1;
+ if (comparator) {
+ mapped.pop();
+ }
+ return (mapped.length && mapped[0] === arrays[0])
+ ? baseIntersection(mapped, undefined$1, comparator)
+ : [];
+ });
+
+ /**
+ * Converts all elements in `array` into a string separated by `separator`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to convert.
+ * @param {string} [separator=','] The element separator.
+ * @returns {string} Returns the joined string.
+ * @example
+ *
+ * _.join(['a', 'b', 'c'], '~');
+ * // => 'a~b~c'
+ */
+ function join(array, separator) {
+ return array == null ? '' : nativeJoin.call(array, separator);
+ }
+
+ /**
+ * Gets the last element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {*} Returns the last element of `array`.
+ * @example
+ *
+ * _.last([1, 2, 3]);
+ * // => 3
+ */
+ function last(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? array[length - 1] : undefined$1;
+ }
+
+ /**
+ * This method is like `_.indexOf` except that it iterates over elements of
+ * `array` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} [fromIndex=array.length-1] The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.lastIndexOf([1, 2, 1, 2], 2);
+ * // => 3
+ *
+ * // Search from the `fromIndex`.
+ * _.lastIndexOf([1, 2, 1, 2], 2, 2);
+ * // => 1
+ */
+ function lastIndexOf(array, value, fromIndex) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return -1;
+ }
+ var index = length;
+ if (fromIndex !== undefined$1) {
+ index = toInteger(fromIndex);
+ index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
+ }
+ return value === value
+ ? strictLastIndexOf(array, value, index)
+ : baseFindIndex(array, baseIsNaN, index, true);
+ }
+
+ /**
+ * Gets the element at index `n` of `array`. If `n` is negative, the nth
+ * element from the end is returned.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.11.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=0] The index of the element to return.
+ * @returns {*} Returns the nth element of `array`.
+ * @example
+ *
+ * var array = ['a', 'b', 'c', 'd'];
+ *
+ * _.nth(array, 1);
+ * // => 'b'
+ *
+ * _.nth(array, -2);
+ * // => 'c';
+ */
+ function nth(array, n) {
+ return (array && array.length) ? baseNth(array, toInteger(n)) : undefined$1;
+ }
+
+ /**
+ * Removes all given values from `array` using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
+ * to remove elements from an array by predicate.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {...*} [values] The values to remove.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
+ *
+ * _.pull(array, 'a', 'c');
+ * console.log(array);
+ * // => ['b', 'b']
+ */
+ var pull = baseRest(pullAll);
+
+ /**
+ * This method is like `_.pull` except that it accepts an array of values to remove.
+ *
+ * **Note:** Unlike `_.difference`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to remove.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
+ *
+ * _.pullAll(array, ['a', 'c']);
+ * console.log(array);
+ * // => ['b', 'b']
+ */
+ function pullAll(array, values) {
+ return (array && array.length && values && values.length)
+ ? basePullAll(array, values)
+ : array;
+ }
+
+ /**
+ * This method is like `_.pullAll` except that it accepts `iteratee` which is
+ * invoked for each element of `array` and `values` to generate the criterion
+ * by which they're compared. The iteratee is invoked with one argument: (value).
+ *
+ * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to remove.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
+ *
+ * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
+ * console.log(array);
+ * // => [{ 'x': 2 }]
+ */
+ function pullAllBy(array, values, iteratee) {
+ return (array && array.length && values && values.length)
+ ? basePullAll(array, values, getIteratee(iteratee, 2))
+ : array;
+ }
+
+ /**
+ * This method is like `_.pullAll` except that it accepts `comparator` which
+ * is invoked to compare elements of `array` to `values`. The comparator is
+ * invoked with two arguments: (arrVal, othVal).
+ *
+ * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.6.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {Array} values The values to remove.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
+ *
+ * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
+ * console.log(array);
+ * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
+ */
+ function pullAllWith(array, values, comparator) {
+ return (array && array.length && values && values.length)
+ ? basePullAll(array, values, undefined$1, comparator)
+ : array;
+ }
+
+ /**
+ * Removes elements from `array` corresponding to `indexes` and returns an
+ * array of removed elements.
+ *
+ * **Note:** Unlike `_.at`, this method mutates `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {...(number|number[])} [indexes] The indexes of elements to remove.
+ * @returns {Array} Returns the new array of removed elements.
+ * @example
+ *
+ * var array = ['a', 'b', 'c', 'd'];
+ * var pulled = _.pullAt(array, [1, 3]);
+ *
+ * console.log(array);
+ * // => ['a', 'c']
+ *
+ * console.log(pulled);
+ * // => ['b', 'd']
+ */
+ var pullAt = flatRest(function(array, indexes) {
+ var length = array == null ? 0 : array.length,
+ result = baseAt(array, indexes);
+
+ basePullAt(array, arrayMap(indexes, function(index) {
+ return isIndex(index, length) ? +index : index;
+ }).sort(compareAscending));
+
+ return result;
+ });
+
+ /**
+ * Removes all elements from `array` that `predicate` returns truthy for
+ * and returns an array of the removed elements. The predicate is invoked
+ * with three arguments: (value, index, array).
+ *
+ * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
+ * to pull elements from an array by value.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the new array of removed elements.
+ * @example
+ *
+ * var array = [1, 2, 3, 4];
+ * var evens = _.remove(array, function(n) {
+ * return n % 2 == 0;
+ * });
+ *
+ * console.log(array);
+ * // => [1, 3]
+ *
+ * console.log(evens);
+ * // => [2, 4]
+ */
+ function remove(array, predicate) {
+ var result = [];
+ if (!(array && array.length)) {
+ return result;
+ }
+ var index = -1,
+ indexes = [],
+ length = array.length;
+
+ predicate = getIteratee(predicate, 3);
+ while (++index < length) {
+ var value = array[index];
+ if (predicate(value, index, array)) {
+ result.push(value);
+ indexes.push(index);
+ }
+ }
+ basePullAt(array, indexes);
+ return result;
+ }
+
+ /**
+ * Reverses `array` so that the first element becomes the last, the second
+ * element becomes the second to last, and so on.
+ *
+ * **Note:** This method mutates `array` and is based on
+ * [`Array#reverse`](https://mdn.io/Array/reverse).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to modify.
+ * @returns {Array} Returns `array`.
+ * @example
+ *
+ * var array = [1, 2, 3];
+ *
+ * _.reverse(array);
+ * // => [3, 2, 1]
+ *
+ * console.log(array);
+ * // => [3, 2, 1]
+ */
+ function reverse(array) {
+ return array == null ? array : nativeReverse.call(array);
+ }
+
+ /**
+ * Creates a slice of `array` from `start` up to, but not including, `end`.
+ *
+ * **Note:** This method is used instead of
+ * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
+ * returned.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to slice.
+ * @param {number} [start=0] The start position.
+ * @param {number} [end=array.length] The end position.
+ * @returns {Array} Returns the slice of `array`.
+ */
+ function slice(array, start, end) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return [];
+ }
+ if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
+ start = 0;
+ end = length;
+ }
+ else {
+ start = start == null ? 0 : toInteger(start);
+ end = end === undefined$1 ? length : toInteger(end);
+ }
+ return baseSlice(array, start, end);
+ }
+
+ /**
+ * Uses a binary search to determine the lowest index at which `value`
+ * should be inserted into `array` in order to maintain its sort order.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ * @example
+ *
+ * _.sortedIndex([30, 50], 40);
+ * // => 1
+ */
+ function sortedIndex(array, value) {
+ return baseSortedIndex(array, value);
+ }
+
+ /**
+ * This method is like `_.sortedIndex` except that it accepts `iteratee`
+ * which is invoked for `value` and each element of `array` to compute their
+ * sort ranking. The iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ * @example
+ *
+ * var objects = [{ 'x': 4 }, { 'x': 5 }];
+ *
+ * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
+ * // => 0
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
+ * // => 0
+ */
+ function sortedIndexBy(array, value, iteratee) {
+ return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
+ }
+
+ /**
+ * This method is like `_.indexOf` except that it performs a binary
+ * search on a sorted `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
+ * // => 1
+ */
+ function sortedIndexOf(array, value) {
+ var length = array == null ? 0 : array.length;
+ if (length) {
+ var index = baseSortedIndex(array, value);
+ if (index < length && eq(array[index], value)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * This method is like `_.sortedIndex` except that it returns the highest
+ * index at which `value` should be inserted into `array` in order to
+ * maintain its sort order.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ * @example
+ *
+ * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
+ * // => 4
+ */
+ function sortedLastIndex(array, value) {
+ return baseSortedIndex(array, value, true);
+ }
+
+ /**
+ * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
+ * which is invoked for `value` and each element of `array` to compute their
+ * sort ranking. The iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The sorted array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ * @example
+ *
+ * var objects = [{ 'x': 4 }, { 'x': 5 }];
+ *
+ * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
+ * // => 1
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
+ * // => 1
+ */
+ function sortedLastIndexBy(array, value, iteratee) {
+ return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
+ }
+
+ /**
+ * This method is like `_.lastIndexOf` except that it performs a binary
+ * search on a sorted `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
+ * // => 3
+ */
+ function sortedLastIndexOf(array, value) {
+ var length = array == null ? 0 : array.length;
+ if (length) {
+ var index = baseSortedIndex(array, value, true) - 1;
+ if (eq(array[index], value)) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * This method is like `_.uniq` except that it's designed and optimized
+ * for sorted arrays.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @returns {Array} Returns the new duplicate free array.
+ * @example
+ *
+ * _.sortedUniq([1, 1, 2]);
+ * // => [1, 2]
+ */
+ function sortedUniq(array) {
+ return (array && array.length)
+ ? baseSortedUniq(array)
+ : [];
+ }
+
+ /**
+ * This method is like `_.uniqBy` except that it's designed and optimized
+ * for sorted arrays.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @returns {Array} Returns the new duplicate free array.
+ * @example
+ *
+ * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
+ * // => [1.1, 2.3]
+ */
+ function sortedUniqBy(array, iteratee) {
+ return (array && array.length)
+ ? baseSortedUniq(array, getIteratee(iteratee, 2))
+ : [];
+ }
+
+ /**
+ * Gets all but the first element of `array`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.tail([1, 2, 3]);
+ * // => [2, 3]
+ */
+ function tail(array) {
+ var length = array == null ? 0 : array.length;
+ return length ? baseSlice(array, 1, length) : [];
+ }
+
+ /**
+ * Creates a slice of `array` with `n` elements taken from the beginning.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to take.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.take([1, 2, 3]);
+ * // => [1]
+ *
+ * _.take([1, 2, 3], 2);
+ * // => [1, 2]
+ *
+ * _.take([1, 2, 3], 5);
+ * // => [1, 2, 3]
+ *
+ * _.take([1, 2, 3], 0);
+ * // => []
+ */
+ function take(array, n, guard) {
+ if (!(array && array.length)) {
+ return [];
+ }
+ n = (guard || n === undefined$1) ? 1 : toInteger(n);
+ return baseSlice(array, 0, n < 0 ? 0 : n);
+ }
+
+ /**
+ * Creates a slice of `array` with `n` elements taken from the end.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {number} [n=1] The number of elements to take.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * _.takeRight([1, 2, 3]);
+ * // => [3]
+ *
+ * _.takeRight([1, 2, 3], 2);
+ * // => [2, 3]
+ *
+ * _.takeRight([1, 2, 3], 5);
+ * // => [1, 2, 3]
+ *
+ * _.takeRight([1, 2, 3], 0);
+ * // => []
+ */
+ function takeRight(array, n, guard) {
+ var length = array == null ? 0 : array.length;
+ if (!length) {
+ return [];
+ }
+ n = (guard || n === undefined$1) ? 1 : toInteger(n);
+ n = length - n;
+ return baseSlice(array, n < 0 ? 0 : n, length);
+ }
+
+ /**
+ * Creates a slice of `array` with elements taken from the end. Elements are
+ * taken until `predicate` returns falsey. The predicate is invoked with
+ * three arguments: (value, index, array).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': false }
+ * ];
+ *
+ * _.takeRightWhile(users, function(o) { return !o.active; });
+ * // => objects for ['fred', 'pebbles']
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
+ * // => objects for ['pebbles']
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.takeRightWhile(users, ['active', false]);
+ * // => objects for ['fred', 'pebbles']
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.takeRightWhile(users, 'active');
+ * // => []
+ */
+ function takeRightWhile(array, predicate) {
+ return (array && array.length)
+ ? baseWhile(array, getIteratee(predicate, 3), false, true)
+ : [];
+ }
+
+ /**
+ * Creates a slice of `array` with elements taken from the beginning. Elements
+ * are taken until `predicate` returns falsey. The predicate is invoked with
+ * three arguments: (value, index, array).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Array
+ * @param {Array} array The array to query.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the slice of `array`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': false },
+ * { 'user': 'fred', 'active': false },
+ * { 'user': 'pebbles', 'active': true }
+ * ];
+ *
+ * _.takeWhile(users, function(o) { return !o.active; });
+ * // => objects for ['barney', 'fred']
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.takeWhile(users, { 'user': 'barney', 'active': false });
+ * // => objects for ['barney']
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.takeWhile(users, ['active', false]);
+ * // => objects for ['barney', 'fred']
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.takeWhile(users, 'active');
+ * // => []
+ */
+ function takeWhile(array, predicate) {
+ return (array && array.length)
+ ? baseWhile(array, getIteratee(predicate, 3))
+ : [];
+ }
+
+ /**
+ * Creates an array of unique values, in order, from all given arrays using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @returns {Array} Returns the new array of combined values.
+ * @example
+ *
+ * _.union([2], [1, 2]);
+ * // => [2, 1]
+ */
+ var union = baseRest(function(arrays) {
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
+ });
+
+ /**
+ * This method is like `_.union` except that it accepts `iteratee` which is
+ * invoked for each element of each `arrays` to generate the criterion by
+ * which uniqueness is computed. Result values are chosen from the first
+ * array in which the value occurs. The iteratee is invoked with one argument:
+ * (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {Array} Returns the new array of combined values.
+ * @example
+ *
+ * _.unionBy([2.1], [1.2, 2.3], Math.floor);
+ * // => [2.1, 1.2]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+ * // => [{ 'x': 1 }, { 'x': 2 }]
+ */
+ var unionBy = baseRest(function(arrays) {
+ var iteratee = last(arrays);
+ if (isArrayLikeObject(iteratee)) {
+ iteratee = undefined$1;
+ }
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
+ });
+
+ /**
+ * This method is like `_.union` except that it accepts `comparator` which
+ * is invoked to compare elements of `arrays`. Result values are chosen from
+ * the first array in which the value occurs. The comparator is invoked
+ * with two arguments: (arrVal, othVal).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new array of combined values.
+ * @example
+ *
+ * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+ * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+ *
+ * _.unionWith(objects, others, _.isEqual);
+ * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
+ */
+ var unionWith = baseRest(function(arrays) {
+ var comparator = last(arrays);
+ comparator = typeof comparator == 'function' ? comparator : undefined$1;
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined$1, comparator);
+ });
+
+ /**
+ * Creates a duplicate-free version of an array, using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons, in which only the first occurrence of each element
+ * is kept. The order of result values is determined by the order they occur
+ * in the array.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @returns {Array} Returns the new duplicate free array.
+ * @example
+ *
+ * _.uniq([2, 1, 2]);
+ * // => [2, 1]
+ */
+ function uniq(array) {
+ return (array && array.length) ? baseUniq(array) : [];
+ }
+
+ /**
+ * This method is like `_.uniq` except that it accepts `iteratee` which is
+ * invoked for each element in `array` to generate the criterion by which
+ * uniqueness is computed. The order of result values is determined by the
+ * order they occur in the array. The iteratee is invoked with one argument:
+ * (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {Array} Returns the new duplicate free array.
+ * @example
+ *
+ * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
+ * // => [2.1, 1.2]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+ * // => [{ 'x': 1 }, { 'x': 2 }]
+ */
+ function uniqBy(array, iteratee) {
+ return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
+ }
+
+ /**
+ * This method is like `_.uniq` except that it accepts `comparator` which
+ * is invoked to compare elements of `array`. The order of result values is
+ * determined by the order they occur in the array.The comparator is invoked
+ * with two arguments: (arrVal, othVal).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new duplicate free array.
+ * @example
+ *
+ * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
+ *
+ * _.uniqWith(objects, _.isEqual);
+ * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
+ */
+ function uniqWith(array, comparator) {
+ comparator = typeof comparator == 'function' ? comparator : undefined$1;
+ return (array && array.length) ? baseUniq(array, undefined$1, comparator) : [];
+ }
+
+ /**
+ * This method is like `_.zip` except that it accepts an array of grouped
+ * elements and creates an array regrouping the elements to their pre-zip
+ * configuration.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.2.0
+ * @category Array
+ * @param {Array} array The array of grouped elements to process.
+ * @returns {Array} Returns the new array of regrouped elements.
+ * @example
+ *
+ * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
+ * // => [['a', 1, true], ['b', 2, false]]
+ *
+ * _.unzip(zipped);
+ * // => [['a', 'b'], [1, 2], [true, false]]
+ */
+ function unzip(array) {
+ if (!(array && array.length)) {
+ return [];
+ }
+ var length = 0;
+ array = arrayFilter(array, function(group) {
+ if (isArrayLikeObject(group)) {
+ length = nativeMax(group.length, length);
+ return true;
+ }
+ });
+ return baseTimes(length, function(index) {
+ return arrayMap(array, baseProperty(index));
+ });
+ }
+
+ /**
+ * This method is like `_.unzip` except that it accepts `iteratee` to specify
+ * how regrouped values should be combined. The iteratee is invoked with the
+ * elements of each group: (...group).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.8.0
+ * @category Array
+ * @param {Array} array The array of grouped elements to process.
+ * @param {Function} [iteratee=_.identity] The function to combine
+ * regrouped values.
+ * @returns {Array} Returns the new array of regrouped elements.
+ * @example
+ *
+ * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
+ * // => [[1, 10, 100], [2, 20, 200]]
+ *
+ * _.unzipWith(zipped, _.add);
+ * // => [3, 30, 300]
+ */
+ function unzipWith(array, iteratee) {
+ if (!(array && array.length)) {
+ return [];
+ }
+ var result = unzip(array);
+ if (iteratee == null) {
+ return result;
+ }
+ return arrayMap(result, function(group) {
+ return apply(iteratee, undefined$1, group);
+ });
+ }
+
+ /**
+ * Creates an array excluding all given values using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * for equality comparisons.
+ *
+ * **Note:** Unlike `_.pull`, this method returns a new array.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {...*} [values] The values to exclude.
+ * @returns {Array} Returns the new array of filtered values.
+ * @see _.difference, _.xor
+ * @example
+ *
+ * _.without([2, 1, 2, 3], 1, 2);
+ * // => [3]
+ */
+ var without = baseRest(function(array, values) {
+ return isArrayLikeObject(array)
+ ? baseDifference(array, values)
+ : [];
+ });
+
+ /**
+ * Creates an array of unique values that is the
+ * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
+ * of the given arrays. The order of result values is determined by the order
+ * they occur in the arrays.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.4.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @returns {Array} Returns the new array of filtered values.
+ * @see _.difference, _.without
+ * @example
+ *
+ * _.xor([2, 1], [2, 3]);
+ * // => [1, 3]
+ */
+ var xor = baseRest(function(arrays) {
+ return baseXor(arrayFilter(arrays, isArrayLikeObject));
+ });
+
+ /**
+ * This method is like `_.xor` except that it accepts `iteratee` which is
+ * invoked for each element of each `arrays` to generate the criterion by
+ * which by which they're compared. The order of result values is determined
+ * by the order they occur in the arrays. The iteratee is invoked with one
+ * argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
+ * // => [1.2, 3.4]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+ * // => [{ 'x': 2 }]
+ */
+ var xorBy = baseRest(function(arrays) {
+ var iteratee = last(arrays);
+ if (isArrayLikeObject(iteratee)) {
+ iteratee = undefined$1;
+ }
+ return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
+ });
+
+ /**
+ * This method is like `_.xor` except that it accepts `comparator` which is
+ * invoked to compare elements of `arrays`. The order of result values is
+ * determined by the order they occur in the arrays. The comparator is invoked
+ * with two arguments: (arrVal, othVal).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to inspect.
+ * @param {Function} [comparator] The comparator invoked per element.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+ * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+ *
+ * _.xorWith(objects, others, _.isEqual);
+ * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
+ */
+ var xorWith = baseRest(function(arrays) {
+ var comparator = last(arrays);
+ comparator = typeof comparator == 'function' ? comparator : undefined$1;
+ return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined$1, comparator);
+ });
+
+ /**
+ * Creates an array of grouped elements, the first of which contains the
+ * first elements of the given arrays, the second of which contains the
+ * second elements of the given arrays, and so on.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to process.
+ * @returns {Array} Returns the new array of grouped elements.
+ * @example
+ *
+ * _.zip(['a', 'b'], [1, 2], [true, false]);
+ * // => [['a', 1, true], ['b', 2, false]]
+ */
+ var zip = baseRest(unzip);
+
+ /**
+ * This method is like `_.fromPairs` except that it accepts two arrays,
+ * one of property identifiers and one of corresponding values.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.4.0
+ * @category Array
+ * @param {Array} [props=[]] The property identifiers.
+ * @param {Array} [values=[]] The property values.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * _.zipObject(['a', 'b'], [1, 2]);
+ * // => { 'a': 1, 'b': 2 }
+ */
+ function zipObject(props, values) {
+ return baseZipObject(props || [], values || [], assignValue);
+ }
+
+ /**
+ * This method is like `_.zipObject` except that it supports property paths.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.1.0
+ * @category Array
+ * @param {Array} [props=[]] The property identifiers.
+ * @param {Array} [values=[]] The property values.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
+ * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
+ */
+ function zipObjectDeep(props, values) {
+ return baseZipObject(props || [], values || [], baseSet);
+ }
+
+ /**
+ * This method is like `_.zip` except that it accepts `iteratee` to specify
+ * how grouped values should be combined. The iteratee is invoked with the
+ * elements of each group: (...group).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.8.0
+ * @category Array
+ * @param {...Array} [arrays] The arrays to process.
+ * @param {Function} [iteratee=_.identity] The function to combine
+ * grouped values.
+ * @returns {Array} Returns the new array of grouped elements.
+ * @example
+ *
+ * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
+ * return a + b + c;
+ * });
+ * // => [111, 222]
+ */
+ var zipWith = baseRest(function(arrays) {
+ var length = arrays.length,
+ iteratee = length > 1 ? arrays[length - 1] : undefined$1;
+
+ iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined$1;
+ return unzipWith(arrays, iteratee);
+ });
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a `lodash` wrapper instance that wraps `value` with explicit method
+ * chain sequences enabled. The result of such sequences must be unwrapped
+ * with `_#value`.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.3.0
+ * @category Seq
+ * @param {*} value The value to wrap.
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36 },
+ * { 'user': 'fred', 'age': 40 },
+ * { 'user': 'pebbles', 'age': 1 }
+ * ];
+ *
+ * var youngest = _
+ * .chain(users)
+ * .sortBy('age')
+ * .map(function(o) {
+ * return o.user + ' is ' + o.age;
+ * })
+ * .head()
+ * .value();
+ * // => 'pebbles is 1'
+ */
+ function chain(value) {
+ var result = lodash(value);
+ result.__chain__ = true;
+ return result;
+ }
+
+ /**
+ * This method invokes `interceptor` and returns `value`. The interceptor
+ * is invoked with one argument; (value). The purpose of this method is to
+ * "tap into" a method chain sequence in order to modify intermediate results.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Seq
+ * @param {*} value The value to provide to `interceptor`.
+ * @param {Function} interceptor The function to invoke.
+ * @returns {*} Returns `value`.
+ * @example
+ *
+ * _([1, 2, 3])
+ * .tap(function(array) {
+ * // Mutate input array.
+ * array.pop();
+ * })
+ * .reverse()
+ * .value();
+ * // => [2, 1]
+ */
+ function tap(value, interceptor) {
+ interceptor(value);
+ return value;
+ }
+
+ /**
+ * This method is like `_.tap` except that it returns the result of `interceptor`.
+ * The purpose of this method is to "pass thru" values replacing intermediate
+ * results in a method chain sequence.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Seq
+ * @param {*} value The value to provide to `interceptor`.
+ * @param {Function} interceptor The function to invoke.
+ * @returns {*} Returns the result of `interceptor`.
+ * @example
+ *
+ * _(' abc ')
+ * .chain()
+ * .trim()
+ * .thru(function(value) {
+ * return [value];
+ * })
+ * .value();
+ * // => ['abc']
+ */
+ function thru(value, interceptor) {
+ return interceptor(value);
+ }
+
+ /**
+ * This method is the wrapper version of `_.at`.
+ *
+ * @name at
+ * @memberOf _
+ * @since 1.0.0
+ * @category Seq
+ * @param {...(string|string[])} [paths] The property paths to pick.
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
+ *
+ * _(object).at(['a[0].b.c', 'a[1]']).value();
+ * // => [3, 4]
+ */
+ var wrapperAt = flatRest(function(paths) {
+ var length = paths.length,
+ start = length ? paths[0] : 0,
+ value = this.__wrapped__,
+ interceptor = function(object) { return baseAt(object, paths); };
+
+ if (length > 1 || this.__actions__.length ||
+ !(value instanceof LazyWrapper) || !isIndex(start)) {
+ return this.thru(interceptor);
+ }
+ value = value.slice(start, +start + (length ? 1 : 0));
+ value.__actions__.push({
+ 'func': thru,
+ 'args': [interceptor],
+ 'thisArg': undefined$1
+ });
+ return new LodashWrapper(value, this.__chain__).thru(function(array) {
+ if (length && !array.length) {
+ array.push(undefined$1);
+ }
+ return array;
+ });
+ });
+
+ /**
+ * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
+ *
+ * @name chain
+ * @memberOf _
+ * @since 0.1.0
+ * @category Seq
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36 },
+ * { 'user': 'fred', 'age': 40 }
+ * ];
+ *
+ * // A sequence without explicit chaining.
+ * _(users).head();
+ * // => { 'user': 'barney', 'age': 36 }
+ *
+ * // A sequence with explicit chaining.
+ * _(users)
+ * .chain()
+ * .head()
+ * .pick('user')
+ * .value();
+ * // => { 'user': 'barney' }
+ */
+ function wrapperChain() {
+ return chain(this);
+ }
+
+ /**
+ * Executes the chain sequence and returns the wrapped result.
+ *
+ * @name commit
+ * @memberOf _
+ * @since 3.2.0
+ * @category Seq
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var array = [1, 2];
+ * var wrapped = _(array).push(3);
+ *
+ * console.log(array);
+ * // => [1, 2]
+ *
+ * wrapped = wrapped.commit();
+ * console.log(array);
+ * // => [1, 2, 3]
+ *
+ * wrapped.last();
+ * // => 3
+ *
+ * console.log(array);
+ * // => [1, 2, 3]
+ */
+ function wrapperCommit() {
+ return new LodashWrapper(this.value(), this.__chain__);
+ }
+
+ /**
+ * Gets the next value on a wrapped object following the
+ * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
+ *
+ * @name next
+ * @memberOf _
+ * @since 4.0.0
+ * @category Seq
+ * @returns {Object} Returns the next iterator value.
+ * @example
+ *
+ * var wrapped = _([1, 2]);
+ *
+ * wrapped.next();
+ * // => { 'done': false, 'value': 1 }
+ *
+ * wrapped.next();
+ * // => { 'done': false, 'value': 2 }
+ *
+ * wrapped.next();
+ * // => { 'done': true, 'value': undefined }
+ */
+ function wrapperNext() {
+ if (this.__values__ === undefined$1) {
+ this.__values__ = toArray(this.value());
+ }
+ var done = this.__index__ >= this.__values__.length,
+ value = done ? undefined$1 : this.__values__[this.__index__++];
+
+ return { 'done': done, 'value': value };
+ }
+
+ /**
+ * Enables the wrapper to be iterable.
+ *
+ * @name Symbol.iterator
+ * @memberOf _
+ * @since 4.0.0
+ * @category Seq
+ * @returns {Object} Returns the wrapper object.
+ * @example
+ *
+ * var wrapped = _([1, 2]);
+ *
+ * wrapped[Symbol.iterator]() === wrapped;
+ * // => true
+ *
+ * Array.from(wrapped);
+ * // => [1, 2]
+ */
+ function wrapperToIterator() {
+ return this;
+ }
+
+ /**
+ * Creates a clone of the chain sequence planting `value` as the wrapped value.
+ *
+ * @name plant
+ * @memberOf _
+ * @since 3.2.0
+ * @category Seq
+ * @param {*} value The value to plant.
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * var wrapped = _([1, 2]).map(square);
+ * var other = wrapped.plant([3, 4]);
+ *
+ * other.value();
+ * // => [9, 16]
+ *
+ * wrapped.value();
+ * // => [1, 4]
+ */
+ function wrapperPlant(value) {
+ var result,
+ parent = this;
+
+ while (parent instanceof baseLodash) {
+ var clone = wrapperClone(parent);
+ clone.__index__ = 0;
+ clone.__values__ = undefined$1;
+ if (result) {
+ previous.__wrapped__ = clone;
+ } else {
+ result = clone;
+ }
+ var previous = clone;
+ parent = parent.__wrapped__;
+ }
+ previous.__wrapped__ = value;
+ return result;
+ }
+
+ /**
+ * This method is the wrapper version of `_.reverse`.
+ *
+ * **Note:** This method mutates the wrapped array.
+ *
+ * @name reverse
+ * @memberOf _
+ * @since 0.1.0
+ * @category Seq
+ * @returns {Object} Returns the new `lodash` wrapper instance.
+ * @example
+ *
+ * var array = [1, 2, 3];
+ *
+ * _(array).reverse().value()
+ * // => [3, 2, 1]
+ *
+ * console.log(array);
+ * // => [3, 2, 1]
+ */
+ function wrapperReverse() {
+ var value = this.__wrapped__;
+ if (value instanceof LazyWrapper) {
+ var wrapped = value;
+ if (this.__actions__.length) {
+ wrapped = new LazyWrapper(this);
+ }
+ wrapped = wrapped.reverse();
+ wrapped.__actions__.push({
+ 'func': thru,
+ 'args': [reverse],
+ 'thisArg': undefined$1
+ });
+ return new LodashWrapper(wrapped, this.__chain__);
+ }
+ return this.thru(reverse);
+ }
+
+ /**
+ * Executes the chain sequence to resolve the unwrapped value.
+ *
+ * @name value
+ * @memberOf _
+ * @since 0.1.0
+ * @alias toJSON, valueOf
+ * @category Seq
+ * @returns {*} Returns the resolved unwrapped value.
+ * @example
+ *
+ * _([1, 2, 3]).value();
+ * // => [1, 2, 3]
+ */
+ function wrapperValue() {
+ return baseWrapperValue(this.__wrapped__, this.__actions__);
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an object composed of keys generated from the results of running
+ * each element of `collection` thru `iteratee`. The corresponding value of
+ * each key is the number of times the key was returned by `iteratee`. The
+ * iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.5.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
+ * @returns {Object} Returns the composed aggregate object.
+ * @example
+ *
+ * _.countBy([6.1, 4.2, 6.3], Math.floor);
+ * // => { '4': 1, '6': 2 }
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.countBy(['one', 'two', 'three'], 'length');
+ * // => { '3': 2, '5': 1 }
+ */
+ var countBy = createAggregator(function(result, value, key) {
+ if (hasOwnProperty.call(result, key)) {
+ ++result[key];
+ } else {
+ baseAssignValue(result, key, 1);
+ }
+ });
+
+ /**
+ * Checks if `predicate` returns truthy for **all** elements of `collection`.
+ * Iteration is stopped once `predicate` returns falsey. The predicate is
+ * invoked with three arguments: (value, index|key, collection).
+ *
+ * **Note:** This method returns `true` for
+ * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
+ * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
+ * elements of empty collections.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
+ * @example
+ *
+ * _.every([true, 1, null, 'yes'], Boolean);
+ * // => false
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': false }
+ * ];
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.every(users, { 'user': 'barney', 'active': false });
+ * // => false
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.every(users, ['active', false]);
+ * // => true
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.every(users, 'active');
+ * // => false
+ */
+ function every(collection, predicate, guard) {
+ var func = isArray(collection) ? arrayEvery : baseEvery;
+ if (guard && isIterateeCall(collection, predicate, guard)) {
+ predicate = undefined$1;
+ }
+ return func(collection, getIteratee(predicate, 3));
+ }
+
+ /**
+ * Iterates over elements of `collection`, returning an array of all elements
+ * `predicate` returns truthy for. The predicate is invoked with three
+ * arguments: (value, index|key, collection).
+ *
+ * **Note:** Unlike `_.remove`, this method returns a new array.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the new filtered array.
+ * @see _.reject
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false }
+ * ];
+ *
+ * _.filter(users, function(o) { return !o.active; });
+ * // => objects for ['fred']
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.filter(users, { 'age': 36, 'active': true });
+ * // => objects for ['barney']
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.filter(users, ['active', false]);
+ * // => objects for ['fred']
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.filter(users, 'active');
+ * // => objects for ['barney']
+ *
+ * // Combining several predicates using `_.overEvery` or `_.overSome`.
+ * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
+ * // => objects for ['fred', 'barney']
+ */
+ function filter(collection, predicate) {
+ var func = isArray(collection) ? arrayFilter : baseFilter;
+ return func(collection, getIteratee(predicate, 3));
+ }
+
+ /**
+ * Iterates over elements of `collection`, returning the first element
+ * `predicate` returns truthy for. The predicate is invoked with three
+ * arguments: (value, index|key, collection).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to inspect.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @returns {*} Returns the matched element, else `undefined`.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false },
+ * { 'user': 'pebbles', 'age': 1, 'active': true }
+ * ];
+ *
+ * _.find(users, function(o) { return o.age < 40; });
+ * // => object for 'barney'
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.find(users, { 'age': 1, 'active': true });
+ * // => object for 'pebbles'
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.find(users, ['active', false]);
+ * // => object for 'fred'
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.find(users, 'active');
+ * // => object for 'barney'
+ */
+ var find = createFind(findIndex);
+
+ /**
+ * This method is like `_.find` except that it iterates over elements of
+ * `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to inspect.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @param {number} [fromIndex=collection.length-1] The index to search from.
+ * @returns {*} Returns the matched element, else `undefined`.
+ * @example
+ *
+ * _.findLast([1, 2, 3, 4], function(n) {
+ * return n % 2 == 1;
+ * });
+ * // => 3
+ */
+ var findLast = createFind(findLastIndex);
+
+ /**
+ * Creates a flattened array of values by running each element in `collection`
+ * thru `iteratee` and flattening the mapped results. The iteratee is invoked
+ * with three arguments: (value, index|key, collection).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * function duplicate(n) {
+ * return [n, n];
+ * }
+ *
+ * _.flatMap([1, 2], duplicate);
+ * // => [1, 1, 2, 2]
+ */
+ function flatMap(collection, iteratee) {
+ return baseFlatten(map(collection, iteratee), 1);
+ }
+
+ /**
+ * This method is like `_.flatMap` except that it recursively flattens the
+ * mapped results.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * function duplicate(n) {
+ * return [[[n, n]]];
+ * }
+ *
+ * _.flatMapDeep([1, 2], duplicate);
+ * // => [1, 1, 2, 2]
+ */
+ function flatMapDeep(collection, iteratee) {
+ return baseFlatten(map(collection, iteratee), INFINITY);
+ }
+
+ /**
+ * This method is like `_.flatMap` except that it recursively flattens the
+ * mapped results up to `depth` times.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {number} [depth=1] The maximum recursion depth.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * function duplicate(n) {
+ * return [[[n, n]]];
+ * }
+ *
+ * _.flatMapDepth([1, 2], duplicate, 2);
+ * // => [[1, 1], [2, 2]]
+ */
+ function flatMapDepth(collection, iteratee, depth) {
+ depth = depth === undefined$1 ? 1 : toInteger(depth);
+ return baseFlatten(map(collection, iteratee), depth);
+ }
+
+ /**
+ * Iterates over elements of `collection` and invokes `iteratee` for each element.
+ * The iteratee is invoked with three arguments: (value, index|key, collection).
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
+ *
+ * **Note:** As with other "Collections" methods, objects with a "length"
+ * property are iterated like arrays. To avoid this behavior use `_.forIn`
+ * or `_.forOwn` for object iteration.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @alias each
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Array|Object} Returns `collection`.
+ * @see _.forEachRight
+ * @example
+ *
+ * _.forEach([1, 2], function(value) {
+ * console.log(value);
+ * });
+ * // => Logs `1` then `2`.
+ *
+ * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
+ * console.log(key);
+ * });
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
+ */
+ function forEach(collection, iteratee) {
+ var func = isArray(collection) ? arrayEach : baseEach;
+ return func(collection, getIteratee(iteratee, 3));
+ }
+
+ /**
+ * This method is like `_.forEach` except that it iterates over elements of
+ * `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @alias eachRight
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Array|Object} Returns `collection`.
+ * @see _.forEach
+ * @example
+ *
+ * _.forEachRight([1, 2], function(value) {
+ * console.log(value);
+ * });
+ * // => Logs `2` then `1`.
+ */
+ function forEachRight(collection, iteratee) {
+ var func = isArray(collection) ? arrayEachRight : baseEachRight;
+ return func(collection, getIteratee(iteratee, 3));
+ }
+
+ /**
+ * Creates an object composed of keys generated from the results of running
+ * each element of `collection` thru `iteratee`. The order of grouped values
+ * is determined by the order they occur in `collection`. The corresponding
+ * value of each key is an array of elements responsible for generating the
+ * key. The iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
+ * @returns {Object} Returns the composed aggregate object.
+ * @example
+ *
+ * _.groupBy([6.1, 4.2, 6.3], Math.floor);
+ * // => { '4': [4.2], '6': [6.1, 6.3] }
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.groupBy(['one', 'two', 'three'], 'length');
+ * // => { '3': ['one', 'two'], '5': ['three'] }
+ */
+ var groupBy = createAggregator(function(result, value, key) {
+ if (hasOwnProperty.call(result, key)) {
+ result[key].push(value);
+ } else {
+ baseAssignValue(result, key, [value]);
+ }
+ });
+
+ /**
+ * Checks if `value` is in `collection`. If `collection` is a string, it's
+ * checked for a substring of `value`, otherwise
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * is used for equality comparisons. If `fromIndex` is negative, it's used as
+ * the offset from the end of `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to inspect.
+ * @param {*} value The value to search for.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
+ * @example
+ *
+ * _.includes([1, 2, 3], 1);
+ * // => true
+ *
+ * _.includes([1, 2, 3], 1, 2);
+ * // => false
+ *
+ * _.includes({ 'a': 1, 'b': 2 }, 1);
+ * // => true
+ *
+ * _.includes('abcd', 'bc');
+ * // => true
+ */
+ function includes(collection, value, fromIndex, guard) {
+ collection = isArrayLike(collection) ? collection : values(collection);
+ fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
+
+ var length = collection.length;
+ if (fromIndex < 0) {
+ fromIndex = nativeMax(length + fromIndex, 0);
+ }
+ return isString(collection)
+ ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
+ : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
+ }
+
+ /**
+ * Invokes the method at `path` of each element in `collection`, returning
+ * an array of the results of each invoked method. Any additional arguments
+ * are provided to each invoked method. If `path` is a function, it's invoked
+ * for, and `this` bound to, each element in `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Array|Function|string} path The path of the method to invoke or
+ * the function invoked per iteration.
+ * @param {...*} [args] The arguments to invoke each method with.
+ * @returns {Array} Returns the array of results.
+ * @example
+ *
+ * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
+ * // => [[1, 5, 7], [1, 2, 3]]
+ *
+ * _.invokeMap([123, 456], String.prototype.split, '');
+ * // => [['1', '2', '3'], ['4', '5', '6']]
+ */
+ var invokeMap = baseRest(function(collection, path, args) {
+ var index = -1,
+ isFunc = typeof path == 'function',
+ result = isArrayLike(collection) ? Array(collection.length) : [];
+
+ baseEach(collection, function(value) {
+ result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
+ });
+ return result;
+ });
+
+ /**
+ * Creates an object composed of keys generated from the results of running
+ * each element of `collection` thru `iteratee`. The corresponding value of
+ * each key is the last element responsible for generating the key. The
+ * iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
+ * @returns {Object} Returns the composed aggregate object.
+ * @example
+ *
+ * var array = [
+ * { 'dir': 'left', 'code': 97 },
+ * { 'dir': 'right', 'code': 100 }
+ * ];
+ *
+ * _.keyBy(array, function(o) {
+ * return String.fromCharCode(o.code);
+ * });
+ * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+ *
+ * _.keyBy(array, 'dir');
+ * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+ */
+ var keyBy = createAggregator(function(result, value, key) {
+ baseAssignValue(result, key, value);
+ });
+
+ /**
+ * Creates an array of values by running each element in `collection` thru
+ * `iteratee`. The iteratee is invoked with three arguments:
+ * (value, index|key, collection).
+ *
+ * Many lodash methods are guarded to work as iteratees for methods like
+ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
+ *
+ * The guarded methods are:
+ * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
+ * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
+ * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
+ * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ * @example
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * _.map([4, 8], square);
+ * // => [16, 64]
+ *
+ * _.map({ 'a': 4, 'b': 8 }, square);
+ * // => [16, 64] (iteration order is not guaranteed)
+ *
+ * var users = [
+ * { 'user': 'barney' },
+ * { 'user': 'fred' }
+ * ];
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.map(users, 'user');
+ * // => ['barney', 'fred']
+ */
+ function map(collection, iteratee) {
+ var func = isArray(collection) ? arrayMap : baseMap;
+ return func(collection, getIteratee(iteratee, 3));
+ }
+
+ /**
+ * This method is like `_.sortBy` except that it allows specifying the sort
+ * orders of the iteratees to sort by. If `orders` is unspecified, all values
+ * are sorted in ascending order. Otherwise, specify an order of "desc" for
+ * descending or "asc" for ascending sort order of corresponding values.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
+ * The iteratees to sort by.
+ * @param {string[]} [orders] The sort orders of `iteratees`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
+ * @returns {Array} Returns the new sorted array.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'fred', 'age': 48 },
+ * { 'user': 'barney', 'age': 34 },
+ * { 'user': 'fred', 'age': 40 },
+ * { 'user': 'barney', 'age': 36 }
+ * ];
+ *
+ * // Sort by `user` in ascending order and by `age` in descending order.
+ * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
+ */
+ function orderBy(collection, iteratees, orders, guard) {
+ if (collection == null) {
+ return [];
+ }
+ if (!isArray(iteratees)) {
+ iteratees = iteratees == null ? [] : [iteratees];
+ }
+ orders = guard ? undefined$1 : orders;
+ if (!isArray(orders)) {
+ orders = orders == null ? [] : [orders];
+ }
+ return baseOrderBy(collection, iteratees, orders);
+ }
+
+ /**
+ * Creates an array of elements split into two groups, the first of which
+ * contains elements `predicate` returns truthy for, the second of which
+ * contains elements `predicate` returns falsey for. The predicate is
+ * invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the array of grouped elements.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
+ * ];
+ *
+ * _.partition(users, function(o) { return o.active; });
+ * // => objects for [['fred'], ['barney', 'pebbles']]
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.partition(users, { 'age': 1, 'active': false });
+ * // => objects for [['pebbles'], ['barney', 'fred']]
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.partition(users, ['active', false]);
+ * // => objects for [['barney', 'pebbles'], ['fred']]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.partition(users, 'active');
+ * // => objects for [['fred'], ['barney', 'pebbles']]
+ */
+ var partition = createAggregator(function(result, value, key) {
+ result[key ? 0 : 1].push(value);
+ }, function() { return [[], []]; });
+
+ /**
+ * Reduces `collection` to a value which is the accumulated result of running
+ * each element in `collection` thru `iteratee`, where each successive
+ * invocation is supplied the return value of the previous. If `accumulator`
+ * is not given, the first element of `collection` is used as the initial
+ * value. The iteratee is invoked with four arguments:
+ * (accumulator, value, index|key, collection).
+ *
+ * Many lodash methods are guarded to work as iteratees for methods like
+ * `_.reduce`, `_.reduceRight`, and `_.transform`.
+ *
+ * The guarded methods are:
+ * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
+ * and `sortBy`
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @returns {*} Returns the accumulated value.
+ * @see _.reduceRight
+ * @example
+ *
+ * _.reduce([1, 2], function(sum, n) {
+ * return sum + n;
+ * }, 0);
+ * // => 3
+ *
+ * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
+ * (result[value] || (result[value] = [])).push(key);
+ * return result;
+ * }, {});
+ * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
+ */
+ function reduce(collection, iteratee, accumulator) {
+ var func = isArray(collection) ? arrayReduce : baseReduce,
+ initAccum = arguments.length < 3;
+
+ return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
+ }
+
+ /**
+ * This method is like `_.reduce` except that it iterates over elements of
+ * `collection` from right to left.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [accumulator] The initial value.
+ * @returns {*} Returns the accumulated value.
+ * @see _.reduce
+ * @example
+ *
+ * var array = [[0, 1], [2, 3], [4, 5]];
+ *
+ * _.reduceRight(array, function(flattened, other) {
+ * return flattened.concat(other);
+ * }, []);
+ * // => [4, 5, 2, 3, 0, 1]
+ */
+ function reduceRight(collection, iteratee, accumulator) {
+ var func = isArray(collection) ? arrayReduceRight : baseReduce,
+ initAccum = arguments.length < 3;
+
+ return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
+ }
+
+ /**
+ * The opposite of `_.filter`; this method returns the elements of `collection`
+ * that `predicate` does **not** return truthy for.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {Array} Returns the new filtered array.
+ * @see _.filter
+ * @example
+ *
+ * var users = [
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
+ * ];
+ *
+ * _.reject(users, function(o) { return !o.active; });
+ * // => objects for ['fred']
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.reject(users, { 'age': 40, 'active': true });
+ * // => objects for ['barney']
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.reject(users, ['active', false]);
+ * // => objects for ['fred']
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.reject(users, 'active');
+ * // => objects for ['barney']
+ */
+ function reject(collection, predicate) {
+ var func = isArray(collection) ? arrayFilter : baseFilter;
+ return func(collection, negate(getIteratee(predicate, 3)));
+ }
+
+ /**
+ * Gets a random element from `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to sample.
+ * @returns {*} Returns the random element.
+ * @example
+ *
+ * _.sample([1, 2, 3, 4]);
+ * // => 2
+ */
+ function sample(collection) {
+ var func = isArray(collection) ? arraySample : baseSample;
+ return func(collection);
+ }
+
+ /**
+ * Gets `n` random elements at unique keys from `collection` up to the
+ * size of `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to sample.
+ * @param {number} [n=1] The number of elements to sample.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Array} Returns the random elements.
+ * @example
+ *
+ * _.sampleSize([1, 2, 3], 2);
+ * // => [3, 1]
+ *
+ * _.sampleSize([1, 2, 3], 4);
+ * // => [2, 3, 1]
+ */
+ function sampleSize(collection, n, guard) {
+ if ((guard ? isIterateeCall(collection, n, guard) : n === undefined$1)) {
+ n = 1;
+ } else {
+ n = toInteger(n);
+ }
+ var func = isArray(collection) ? arraySampleSize : baseSampleSize;
+ return func(collection, n);
+ }
+
+ /**
+ * Creates an array of shuffled values, using a version of the
+ * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to shuffle.
+ * @returns {Array} Returns the new shuffled array.
+ * @example
+ *
+ * _.shuffle([1, 2, 3, 4]);
+ * // => [4, 1, 3, 2]
+ */
+ function shuffle(collection) {
+ var func = isArray(collection) ? arrayShuffle : baseShuffle;
+ return func(collection);
+ }
+
+ /**
+ * Gets the size of `collection` by returning its length for array-like
+ * values or the number of own enumerable string keyed properties for objects.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object|string} collection The collection to inspect.
+ * @returns {number} Returns the collection size.
+ * @example
+ *
+ * _.size([1, 2, 3]);
+ * // => 3
+ *
+ * _.size({ 'a': 1, 'b': 2 });
+ * // => 2
+ *
+ * _.size('pebbles');
+ * // => 7
+ */
+ function size(collection) {
+ if (collection == null) {
+ return 0;
+ }
+ if (isArrayLike(collection)) {
+ return isString(collection) ? stringSize(collection) : collection.length;
+ }
+ var tag = getTag(collection);
+ if (tag == mapTag || tag == setTag) {
+ return collection.size;
+ }
+ return baseKeys(collection).length;
+ }
+
+ /**
+ * Checks if `predicate` returns truthy for **any** element of `collection`.
+ * Iteration is stopped once `predicate` returns truthy. The predicate is
+ * invoked with three arguments: (value, index|key, collection).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
+ * @example
+ *
+ * _.some([null, 0, 'yes', false], Boolean);
+ * // => true
+ *
+ * var users = [
+ * { 'user': 'barney', 'active': true },
+ * { 'user': 'fred', 'active': false }
+ * ];
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.some(users, { 'user': 'barney', 'active': false });
+ * // => false
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.some(users, ['active', false]);
+ * // => true
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.some(users, 'active');
+ * // => true
+ */
+ function some(collection, predicate, guard) {
+ var func = isArray(collection) ? arraySome : baseSome;
+ if (guard && isIterateeCall(collection, predicate, guard)) {
+ predicate = undefined$1;
+ }
+ return func(collection, getIteratee(predicate, 3));
+ }
+
+ /**
+ * Creates an array of elements, sorted in ascending order by the results of
+ * running each element in a collection thru each iteratee. This method
+ * performs a stable sort, that is, it preserves the original sort order of
+ * equal elements. The iteratees are invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {...(Function|Function[])} [iteratees=[_.identity]]
+ * The iteratees to sort by.
+ * @returns {Array} Returns the new sorted array.
+ * @example
+ *
+ * var users = [
+ * { 'user': 'fred', 'age': 48 },
+ * { 'user': 'barney', 'age': 36 },
+ * { 'user': 'fred', 'age': 30 },
+ * { 'user': 'barney', 'age': 34 }
+ * ];
+ *
+ * _.sortBy(users, [function(o) { return o.user; }]);
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
+ *
+ * _.sortBy(users, ['user', 'age']);
+ * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
+ */
+ var sortBy = baseRest(function(collection, iteratees) {
+ if (collection == null) {
+ return [];
+ }
+ var length = iteratees.length;
+ if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
+ iteratees = [];
+ } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
+ iteratees = [iteratees[0]];
+ }
+ return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
+ });
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Gets the timestamp of the number of milliseconds that have elapsed since
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
+ *
+ * @static
+ * @memberOf _
+ * @since 2.4.0
+ * @category Date
+ * @returns {number} Returns the timestamp.
+ * @example
+ *
+ * _.defer(function(stamp) {
+ * console.log(_.now() - stamp);
+ * }, _.now());
+ * // => Logs the number of milliseconds it took for the deferred invocation.
+ */
+ var now = ctxNow || function() {
+ return root.Date.now();
+ };
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * The opposite of `_.before`; this method creates a function that invokes
+ * `func` once it's called `n` or more times.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {number} n The number of calls before `func` is invoked.
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * var saves = ['profile', 'settings'];
+ *
+ * var done = _.after(saves.length, function() {
+ * console.log('done saving!');
+ * });
+ *
+ * _.forEach(saves, function(type) {
+ * asyncSave({ 'type': type, 'complete': done });
+ * });
+ * // => Logs 'done saving!' after the two async saves have completed.
+ */
+ function after(n, func) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ n = toInteger(n);
+ return function() {
+ if (--n < 1) {
+ return func.apply(this, arguments);
+ }
+ };
+ }
+
+ /**
+ * Creates a function that invokes `func`, with up to `n` arguments,
+ * ignoring any additional arguments.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Function
+ * @param {Function} func The function to cap arguments for.
+ * @param {number} [n=func.length] The arity cap.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Function} Returns the new capped function.
+ * @example
+ *
+ * _.map(['6', '8', '10'], _.ary(parseInt, 1));
+ * // => [6, 8, 10]
+ */
+ function ary(func, n, guard) {
+ n = guard ? undefined$1 : n;
+ n = (func && n == null) ? func.length : n;
+ return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n);
+ }
+
+ /**
+ * Creates a function that invokes `func`, with the `this` binding and arguments
+ * of the created function, while it's called less than `n` times. Subsequent
+ * calls to the created function return the result of the last `func` invocation.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Function
+ * @param {number} n The number of calls at which `func` is no longer invoked.
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * jQuery(element).on('click', _.before(5, addContactToList));
+ * // => Allows adding up to 4 contacts to the list.
+ */
+ function before(n, func) {
+ var result;
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ n = toInteger(n);
+ return function() {
+ if (--n > 0) {
+ result = func.apply(this, arguments);
+ }
+ if (n <= 1) {
+ func = undefined$1;
+ }
+ return result;
+ };
+ }
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of `thisArg`
+ * and `partials` prepended to the arguments it receives.
+ *
+ * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
+ * may be used as a placeholder for partially applied arguments.
+ *
+ * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
+ * property of bound functions.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to bind.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new bound function.
+ * @example
+ *
+ * function greet(greeting, punctuation) {
+ * return greeting + ' ' + this.user + punctuation;
+ * }
+ *
+ * var object = { 'user': 'fred' };
+ *
+ * var bound = _.bind(greet, object, 'hi');
+ * bound('!');
+ * // => 'hi fred!'
+ *
+ * // Bound with placeholders.
+ * var bound = _.bind(greet, object, _, '!');
+ * bound('hi');
+ * // => 'hi fred!'
+ */
+ var bind = baseRest(function(func, thisArg, partials) {
+ var bitmask = WRAP_BIND_FLAG;
+ if (partials.length) {
+ var holders = replaceHolders(partials, getHolder(bind));
+ bitmask |= WRAP_PARTIAL_FLAG;
+ }
+ return createWrap(func, bitmask, thisArg, partials, holders);
+ });
+
+ /**
+ * Creates a function that invokes the method at `object[key]` with `partials`
+ * prepended to the arguments it receives.
+ *
+ * This method differs from `_.bind` by allowing bound functions to reference
+ * methods that may be redefined or don't yet exist. See
+ * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
+ * for more details.
+ *
+ * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for partially applied arguments.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.10.0
+ * @category Function
+ * @param {Object} object The object to invoke the method on.
+ * @param {string} key The key of the method.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new bound function.
+ * @example
+ *
+ * var object = {
+ * 'user': 'fred',
+ * 'greet': function(greeting, punctuation) {
+ * return greeting + ' ' + this.user + punctuation;
+ * }
+ * };
+ *
+ * var bound = _.bindKey(object, 'greet', 'hi');
+ * bound('!');
+ * // => 'hi fred!'
+ *
+ * object.greet = function(greeting, punctuation) {
+ * return greeting + 'ya ' + this.user + punctuation;
+ * };
+ *
+ * bound('!');
+ * // => 'hiya fred!'
+ *
+ * // Bound with placeholders.
+ * var bound = _.bindKey(object, 'greet', _, '!');
+ * bound('hi');
+ * // => 'hiya fred!'
+ */
+ var bindKey = baseRest(function(object, key, partials) {
+ var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
+ if (partials.length) {
+ var holders = replaceHolders(partials, getHolder(bindKey));
+ bitmask |= WRAP_PARTIAL_FLAG;
+ }
+ return createWrap(key, bitmask, object, partials, holders);
+ });
+
+ /**
+ * Creates a function that accepts arguments of `func` and either invokes
+ * `func` returning its result, if at least `arity` number of arguments have
+ * been provided, or returns a function that accepts the remaining `func`
+ * arguments, and so on. The arity of `func` may be specified if `func.length`
+ * is not sufficient.
+ *
+ * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
+ * may be used as a placeholder for provided arguments.
+ *
+ * **Note:** This method doesn't set the "length" property of curried functions.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Function
+ * @param {Function} func The function to curry.
+ * @param {number} [arity=func.length] The arity of `func`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Function} Returns the new curried function.
+ * @example
+ *
+ * var abc = function(a, b, c) {
+ * return [a, b, c];
+ * };
+ *
+ * var curried = _.curry(abc);
+ *
+ * curried(1)(2)(3);
+ * // => [1, 2, 3]
+ *
+ * curried(1, 2)(3);
+ * // => [1, 2, 3]
+ *
+ * curried(1, 2, 3);
+ * // => [1, 2, 3]
+ *
+ * // Curried with placeholders.
+ * curried(1)(_, 3)(2);
+ * // => [1, 2, 3]
+ */
+ function curry(func, arity, guard) {
+ arity = guard ? undefined$1 : arity;
+ var result = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
+ result.placeholder = curry.placeholder;
+ return result;
+ }
+
+ /**
+ * This method is like `_.curry` except that arguments are applied to `func`
+ * in the manner of `_.partialRight` instead of `_.partial`.
+ *
+ * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for provided arguments.
+ *
+ * **Note:** This method doesn't set the "length" property of curried functions.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Function
+ * @param {Function} func The function to curry.
+ * @param {number} [arity=func.length] The arity of `func`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Function} Returns the new curried function.
+ * @example
+ *
+ * var abc = function(a, b, c) {
+ * return [a, b, c];
+ * };
+ *
+ * var curried = _.curryRight(abc);
+ *
+ * curried(3)(2)(1);
+ * // => [1, 2, 3]
+ *
+ * curried(2, 3)(1);
+ * // => [1, 2, 3]
+ *
+ * curried(1, 2, 3);
+ * // => [1, 2, 3]
+ *
+ * // Curried with placeholders.
+ * curried(3)(1, _)(2);
+ * // => [1, 2, 3]
+ */
+ function curryRight(func, arity, guard) {
+ arity = guard ? undefined$1 : arity;
+ var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
+ result.placeholder = curryRight.placeholder;
+ return result;
+ }
+
+ /**
+ * Creates a debounced function that delays invoking `func` until after `wait`
+ * milliseconds have elapsed since the last time the debounced function was
+ * invoked. The debounced function comes with a `cancel` method to cancel
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
+ * Provide `options` to indicate whether `func` should be invoked on the
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
+ * with the last arguments provided to the debounced function. Subsequent
+ * calls to the debounced function return the result of the last `func`
+ * invocation.
+ *
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
+ * invoked on the trailing edge of the timeout only if the debounced function
+ * is invoked more than once during the `wait` timeout.
+ *
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
+ *
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
+ * for details over the differences between `_.debounce` and `_.throttle`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to debounce.
+ * @param {number} [wait=0] The number of milliseconds to delay.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.leading=false]
+ * Specify invoking on the leading edge of the timeout.
+ * @param {number} [options.maxWait]
+ * The maximum time `func` is allowed to be delayed before it's invoked.
+ * @param {boolean} [options.trailing=true]
+ * Specify invoking on the trailing edge of the timeout.
+ * @returns {Function} Returns the new debounced function.
+ * @example
+ *
+ * // Avoid costly calculations while the window size is in flux.
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
+ *
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
+ * 'leading': true,
+ * 'trailing': false
+ * }));
+ *
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
+ * var source = new EventSource('/stream');
+ * jQuery(source).on('message', debounced);
+ *
+ * // Cancel the trailing debounced invocation.
+ * jQuery(window).on('popstate', debounced.cancel);
+ */
+ function debounce(func, wait, options) {
+ var lastArgs,
+ lastThis,
+ maxWait,
+ result,
+ timerId,
+ lastCallTime,
+ lastInvokeTime = 0,
+ leading = false,
+ maxing = false,
+ trailing = true;
+
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ wait = toNumber(wait) || 0;
+ if (isObject(options)) {
+ leading = !!options.leading;
+ maxing = 'maxWait' in options;
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
+ }
+
+ function invokeFunc(time) {
+ var args = lastArgs,
+ thisArg = lastThis;
+
+ lastArgs = lastThis = undefined$1;
+ lastInvokeTime = time;
+ result = func.apply(thisArg, args);
+ return result;
+ }
+
+ function leadingEdge(time) {
+ // Reset any `maxWait` timer.
+ lastInvokeTime = time;
+ // Start the timer for the trailing edge.
+ timerId = setTimeout(timerExpired, wait);
+ // Invoke the leading edge.
+ return leading ? invokeFunc(time) : result;
+ }
+
+ function remainingWait(time) {
+ var timeSinceLastCall = time - lastCallTime,
+ timeSinceLastInvoke = time - lastInvokeTime,
+ timeWaiting = wait - timeSinceLastCall;
+
+ return maxing
+ ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
+ : timeWaiting;
+ }
+
+ function shouldInvoke(time) {
+ var timeSinceLastCall = time - lastCallTime,
+ timeSinceLastInvoke = time - lastInvokeTime;
+
+ // Either this is the first call, activity has stopped and we're at the
+ // trailing edge, the system time has gone backwards and we're treating
+ // it as the trailing edge, or we've hit the `maxWait` limit.
+ return (lastCallTime === undefined$1 || (timeSinceLastCall >= wait) ||
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
+ }
+
+ function timerExpired() {
+ var time = now();
+ if (shouldInvoke(time)) {
+ return trailingEdge(time);
+ }
+ // Restart the timer.
+ timerId = setTimeout(timerExpired, remainingWait(time));
+ }
+
+ function trailingEdge(time) {
+ timerId = undefined$1;
+
+ // Only invoke if we have `lastArgs` which means `func` has been
+ // debounced at least once.
+ if (trailing && lastArgs) {
+ return invokeFunc(time);
+ }
+ lastArgs = lastThis = undefined$1;
+ return result;
+ }
+
+ function cancel() {
+ if (timerId !== undefined$1) {
+ clearTimeout(timerId);
+ }
+ lastInvokeTime = 0;
+ lastArgs = lastCallTime = lastThis = timerId = undefined$1;
+ }
+
+ function flush() {
+ return timerId === undefined$1 ? result : trailingEdge(now());
+ }
+
+ function debounced() {
+ var time = now(),
+ isInvoking = shouldInvoke(time);
+
+ lastArgs = arguments;
+ lastThis = this;
+ lastCallTime = time;
+
+ if (isInvoking) {
+ if (timerId === undefined$1) {
+ return leadingEdge(lastCallTime);
+ }
+ if (maxing) {
+ // Handle invocations in a tight loop.
+ clearTimeout(timerId);
+ timerId = setTimeout(timerExpired, wait);
+ return invokeFunc(lastCallTime);
+ }
+ }
+ if (timerId === undefined$1) {
+ timerId = setTimeout(timerExpired, wait);
+ }
+ return result;
+ }
+ debounced.cancel = cancel;
+ debounced.flush = flush;
+ return debounced;
+ }
+
+ /**
+ * Defers invoking the `func` until the current call stack has cleared. Any
+ * additional arguments are provided to `func` when it's invoked.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to defer.
+ * @param {...*} [args] The arguments to invoke `func` with.
+ * @returns {number} Returns the timer id.
+ * @example
+ *
+ * _.defer(function(text) {
+ * console.log(text);
+ * }, 'deferred');
+ * // => Logs 'deferred' after one millisecond.
+ */
+ var defer = baseRest(function(func, args) {
+ return baseDelay(func, 1, args);
+ });
+
+ /**
+ * Invokes `func` after `wait` milliseconds. Any additional arguments are
+ * provided to `func` when it's invoked.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to delay.
+ * @param {number} wait The number of milliseconds to delay invocation.
+ * @param {...*} [args] The arguments to invoke `func` with.
+ * @returns {number} Returns the timer id.
+ * @example
+ *
+ * _.delay(function(text) {
+ * console.log(text);
+ * }, 1000, 'later');
+ * // => Logs 'later' after one second.
+ */
+ var delay = baseRest(function(func, wait, args) {
+ return baseDelay(func, toNumber(wait) || 0, args);
+ });
+
+ /**
+ * Creates a function that invokes `func` with arguments reversed.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Function
+ * @param {Function} func The function to flip arguments for.
+ * @returns {Function} Returns the new flipped function.
+ * @example
+ *
+ * var flipped = _.flip(function() {
+ * return _.toArray(arguments);
+ * });
+ *
+ * flipped('a', 'b', 'c', 'd');
+ * // => ['d', 'c', 'b', 'a']
+ */
+ function flip(func) {
+ return createWrap(func, WRAP_FLIP_FLAG);
+ }
+
+ /**
+ * Creates a function that memoizes the result of `func`. If `resolver` is
+ * provided, it determines the cache key for storing the result based on the
+ * arguments provided to the memoized function. By default, the first argument
+ * provided to the memoized function is used as the map cache key. The `func`
+ * is invoked with the `this` binding of the memoized function.
+ *
+ * **Note:** The cache is exposed as the `cache` property on the memoized
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
+ * constructor with one whose instances implement the
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to have its output memoized.
+ * @param {Function} [resolver] The function to resolve the cache key.
+ * @returns {Function} Returns the new memoized function.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2 };
+ * var other = { 'c': 3, 'd': 4 };
+ *
+ * var values = _.memoize(_.values);
+ * values(object);
+ * // => [1, 2]
+ *
+ * values(other);
+ * // => [3, 4]
+ *
+ * object.a = 2;
+ * values(object);
+ * // => [1, 2]
+ *
+ * // Modify the result cache.
+ * values.cache.set(object, ['a', 'b']);
+ * values(object);
+ * // => ['a', 'b']
+ *
+ * // Replace `_.memoize.Cache`.
+ * _.memoize.Cache = WeakMap;
+ */
+ function memoize(func, resolver) {
+ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ var memoized = function() {
+ var args = arguments,
+ key = resolver ? resolver.apply(this, args) : args[0],
+ cache = memoized.cache;
+
+ if (cache.has(key)) {
+ return cache.get(key);
+ }
+ var result = func.apply(this, args);
+ memoized.cache = cache.set(key, result) || cache;
+ return result;
+ };
+ memoized.cache = new (memoize.Cache || MapCache);
+ return memoized;
+ }
+
+ // Expose `MapCache`.
+ memoize.Cache = MapCache;
+
+ /**
+ * Creates a function that negates the result of the predicate `func`. The
+ * `func` predicate is invoked with the `this` binding and arguments of the
+ * created function.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Function
+ * @param {Function} predicate The predicate to negate.
+ * @returns {Function} Returns the new negated function.
+ * @example
+ *
+ * function isEven(n) {
+ * return n % 2 == 0;
+ * }
+ *
+ * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
+ * // => [1, 3, 5]
+ */
+ function negate(predicate) {
+ if (typeof predicate != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ return function() {
+ var args = arguments;
+ switch (args.length) {
+ case 0: return !predicate.call(this);
+ case 1: return !predicate.call(this, args[0]);
+ case 2: return !predicate.call(this, args[0], args[1]);
+ case 3: return !predicate.call(this, args[0], args[1], args[2]);
+ }
+ return !predicate.apply(this, args);
+ };
+ }
+
+ /**
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
+ * to the function return the value of the first invocation. The `func` is
+ * invoked with the `this` binding and arguments of the created function.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * var initialize = _.once(createApplication);
+ * initialize();
+ * initialize();
+ * // => `createApplication` is invoked once
+ */
+ function once(func) {
+ return before(2, func);
+ }
+
+ /**
+ * Creates a function that invokes `func` with its arguments transformed.
+ *
+ * @static
+ * @since 4.0.0
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to wrap.
+ * @param {...(Function|Function[])} [transforms=[_.identity]]
+ * The argument transforms.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * function doubled(n) {
+ * return n * 2;
+ * }
+ *
+ * function square(n) {
+ * return n * n;
+ * }
+ *
+ * var func = _.overArgs(function(x, y) {
+ * return [x, y];
+ * }, [square, doubled]);
+ *
+ * func(9, 3);
+ * // => [81, 6]
+ *
+ * func(10, 5);
+ * // => [100, 10]
+ */
+ var overArgs = castRest(function(func, transforms) {
+ transforms = (transforms.length == 1 && isArray(transforms[0]))
+ ? arrayMap(transforms[0], baseUnary(getIteratee()))
+ : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
+
+ var funcsLength = transforms.length;
+ return baseRest(function(args) {
+ var index = -1,
+ length = nativeMin(args.length, funcsLength);
+
+ while (++index < length) {
+ args[index] = transforms[index].call(this, args[index]);
+ }
+ return apply(func, this, args);
+ });
+ });
+
+ /**
+ * Creates a function that invokes `func` with `partials` prepended to the
+ * arguments it receives. This method is like `_.bind` except it does **not**
+ * alter the `this` binding.
+ *
+ * The `_.partial.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for partially applied arguments.
+ *
+ * **Note:** This method doesn't set the "length" property of partially
+ * applied functions.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.2.0
+ * @category Function
+ * @param {Function} func The function to partially apply arguments to.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new partially applied function.
+ * @example
+ *
+ * function greet(greeting, name) {
+ * return greeting + ' ' + name;
+ * }
+ *
+ * var sayHelloTo = _.partial(greet, 'hello');
+ * sayHelloTo('fred');
+ * // => 'hello fred'
+ *
+ * // Partially applied with placeholders.
+ * var greetFred = _.partial(greet, _, 'fred');
+ * greetFred('hi');
+ * // => 'hi fred'
+ */
+ var partial = baseRest(function(func, partials) {
+ var holders = replaceHolders(partials, getHolder(partial));
+ return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders);
+ });
+
+ /**
+ * This method is like `_.partial` except that partially applied arguments
+ * are appended to the arguments it receives.
+ *
+ * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
+ * builds, may be used as a placeholder for partially applied arguments.
+ *
+ * **Note:** This method doesn't set the "length" property of partially
+ * applied functions.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.0.0
+ * @category Function
+ * @param {Function} func The function to partially apply arguments to.
+ * @param {...*} [partials] The arguments to be partially applied.
+ * @returns {Function} Returns the new partially applied function.
+ * @example
+ *
+ * function greet(greeting, name) {
+ * return greeting + ' ' + name;
+ * }
+ *
+ * var greetFred = _.partialRight(greet, 'fred');
+ * greetFred('hi');
+ * // => 'hi fred'
+ *
+ * // Partially applied with placeholders.
+ * var sayHelloTo = _.partialRight(greet, 'hello', _);
+ * sayHelloTo('fred');
+ * // => 'hello fred'
+ */
+ var partialRight = baseRest(function(func, partials) {
+ var holders = replaceHolders(partials, getHolder(partialRight));
+ return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders);
+ });
+
+ /**
+ * Creates a function that invokes `func` with arguments arranged according
+ * to the specified `indexes` where the argument value at the first index is
+ * provided as the first argument, the argument value at the second index is
+ * provided as the second argument, and so on.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Function
+ * @param {Function} func The function to rearrange arguments for.
+ * @param {...(number|number[])} indexes The arranged argument indexes.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var rearged = _.rearg(function(a, b, c) {
+ * return [a, b, c];
+ * }, [2, 0, 1]);
+ *
+ * rearged('b', 'c', 'a')
+ * // => ['a', 'b', 'c']
+ */
+ var rearg = flatRest(function(func, indexes) {
+ return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes);
+ });
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of the
+ * created function and arguments from `start` and beyond provided as
+ * an array.
+ *
+ * **Note:** This method is based on the
+ * [rest parameter](https://mdn.io/rest_parameters).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Function
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var say = _.rest(function(what, names) {
+ * return what + ' ' + _.initial(names).join(', ') +
+ * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
+ * });
+ *
+ * say('hello', 'fred', 'barney', 'pebbles');
+ * // => 'hello fred, barney, & pebbles'
+ */
+ function rest(func, start) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ start = start === undefined$1 ? start : toInteger(start);
+ return baseRest(func, start);
+ }
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of the
+ * create function and an array of arguments much like
+ * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
+ *
+ * **Note:** This method is based on the
+ * [spread operator](https://mdn.io/spread_operator).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.2.0
+ * @category Function
+ * @param {Function} func The function to spread arguments over.
+ * @param {number} [start=0] The start position of the spread.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var say = _.spread(function(who, what) {
+ * return who + ' says ' + what;
+ * });
+ *
+ * say(['fred', 'hello']);
+ * // => 'fred says hello'
+ *
+ * var numbers = Promise.all([
+ * Promise.resolve(40),
+ * Promise.resolve(36)
+ * ]);
+ *
+ * numbers.then(_.spread(function(x, y) {
+ * return x + y;
+ * }));
+ * // => a Promise of 76
+ */
+ function spread(func, start) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ start = start == null ? 0 : nativeMax(toInteger(start), 0);
+ return baseRest(function(args) {
+ var array = args[start],
+ otherArgs = castSlice(args, 0, start);
+
+ if (array) {
+ arrayPush(otherArgs, array);
+ }
+ return apply(func, this, otherArgs);
+ });
+ }
+
+ /**
+ * Creates a throttled function that only invokes `func` at most once per
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
+ * method to cancel delayed `func` invocations and a `flush` method to
+ * immediately invoke them. Provide `options` to indicate whether `func`
+ * should be invoked on the leading and/or trailing edge of the `wait`
+ * timeout. The `func` is invoked with the last arguments provided to the
+ * throttled function. Subsequent calls to the throttled function return the
+ * result of the last `func` invocation.
+ *
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
+ * invoked on the trailing edge of the timeout only if the throttled function
+ * is invoked more than once during the `wait` timeout.
+ *
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
+ *
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
+ * for details over the differences between `_.throttle` and `_.debounce`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {Function} func The function to throttle.
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.leading=true]
+ * Specify invoking on the leading edge of the timeout.
+ * @param {boolean} [options.trailing=true]
+ * Specify invoking on the trailing edge of the timeout.
+ * @returns {Function} Returns the new throttled function.
+ * @example
+ *
+ * // Avoid excessively updating the position while scrolling.
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
+ *
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
+ * jQuery(element).on('click', throttled);
+ *
+ * // Cancel the trailing throttled invocation.
+ * jQuery(window).on('popstate', throttled.cancel);
+ */
+ function throttle(func, wait, options) {
+ var leading = true,
+ trailing = true;
+
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ if (isObject(options)) {
+ leading = 'leading' in options ? !!options.leading : leading;
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
+ }
+ return debounce(func, wait, {
+ 'leading': leading,
+ 'maxWait': wait,
+ 'trailing': trailing
+ });
+ }
+
+ /**
+ * Creates a function that accepts up to one argument, ignoring any
+ * additional arguments.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Function
+ * @param {Function} func The function to cap arguments for.
+ * @returns {Function} Returns the new capped function.
+ * @example
+ *
+ * _.map(['6', '8', '10'], _.unary(parseInt));
+ * // => [6, 8, 10]
+ */
+ function unary(func) {
+ return ary(func, 1);
+ }
+
+ /**
+ * Creates a function that provides `value` to `wrapper` as its first
+ * argument. Any additional arguments provided to the function are appended
+ * to those provided to the `wrapper`. The wrapper is invoked with the `this`
+ * binding of the created function.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Function
+ * @param {*} value The value to wrap.
+ * @param {Function} [wrapper=identity] The wrapper function.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var p = _.wrap(_.escape, function(func, text) {
+ * return '' + func(text) + '
';
+ * });
+ *
+ * p('fred, barney, & pebbles');
+ * // => 'fred, barney, & pebbles
'
+ */
+ function wrap(value, wrapper) {
+ return partial(castFunction(wrapper), value);
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Casts `value` as an array if it's not one.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.4.0
+ * @category Lang
+ * @param {*} value The value to inspect.
+ * @returns {Array} Returns the cast array.
+ * @example
+ *
+ * _.castArray(1);
+ * // => [1]
+ *
+ * _.castArray({ 'a': 1 });
+ * // => [{ 'a': 1 }]
+ *
+ * _.castArray('abc');
+ * // => ['abc']
+ *
+ * _.castArray(null);
+ * // => [null]
+ *
+ * _.castArray(undefined);
+ * // => [undefined]
+ *
+ * _.castArray();
+ * // => []
+ *
+ * var array = [1, 2, 3];
+ * console.log(_.castArray(array) === array);
+ * // => true
+ */
+ function castArray() {
+ if (!arguments.length) {
+ return [];
+ }
+ var value = arguments[0];
+ return isArray(value) ? value : [value];
+ }
+
+ /**
+ * Creates a shallow clone of `value`.
+ *
+ * **Note:** This method is loosely based on the
+ * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
+ * and supports cloning arrays, array buffers, booleans, date objects, maps,
+ * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
+ * arrays. The own enumerable properties of `arguments` objects are cloned
+ * as plain objects. An empty object is returned for uncloneable values such
+ * as error objects, functions, DOM nodes, and WeakMaps.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to clone.
+ * @returns {*} Returns the cloned value.
+ * @see _.cloneDeep
+ * @example
+ *
+ * var objects = [{ 'a': 1 }, { 'b': 2 }];
+ *
+ * var shallow = _.clone(objects);
+ * console.log(shallow[0] === objects[0]);
+ * // => true
+ */
+ function clone(value) {
+ return baseClone(value, CLONE_SYMBOLS_FLAG);
+ }
+
+ /**
+ * This method is like `_.clone` except that it accepts `customizer` which
+ * is invoked to produce the cloned value. If `customizer` returns `undefined`,
+ * cloning is handled by the method instead. The `customizer` is invoked with
+ * up to four arguments; (value [, index|key, object, stack]).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to clone.
+ * @param {Function} [customizer] The function to customize cloning.
+ * @returns {*} Returns the cloned value.
+ * @see _.cloneDeepWith
+ * @example
+ *
+ * function customizer(value) {
+ * if (_.isElement(value)) {
+ * return value.cloneNode(false);
+ * }
+ * }
+ *
+ * var el = _.cloneWith(document.body, customizer);
+ *
+ * console.log(el === document.body);
+ * // => false
+ * console.log(el.nodeName);
+ * // => 'BODY'
+ * console.log(el.childNodes.length);
+ * // => 0
+ */
+ function cloneWith(value, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined$1;
+ return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
+ }
+
+ /**
+ * This method is like `_.clone` except that it recursively clones `value`.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.0.0
+ * @category Lang
+ * @param {*} value The value to recursively clone.
+ * @returns {*} Returns the deep cloned value.
+ * @see _.clone
+ * @example
+ *
+ * var objects = [{ 'a': 1 }, { 'b': 2 }];
+ *
+ * var deep = _.cloneDeep(objects);
+ * console.log(deep[0] === objects[0]);
+ * // => false
+ */
+ function cloneDeep(value) {
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
+ }
+
+ /**
+ * This method is like `_.cloneWith` except that it recursively clones `value`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to recursively clone.
+ * @param {Function} [customizer] The function to customize cloning.
+ * @returns {*} Returns the deep cloned value.
+ * @see _.cloneWith
+ * @example
+ *
+ * function customizer(value) {
+ * if (_.isElement(value)) {
+ * return value.cloneNode(true);
+ * }
+ * }
+ *
+ * var el = _.cloneDeepWith(document.body, customizer);
+ *
+ * console.log(el === document.body);
+ * // => false
+ * console.log(el.nodeName);
+ * // => 'BODY'
+ * console.log(el.childNodes.length);
+ * // => 20
+ */
+ function cloneDeepWith(value, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined$1;
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
+ }
+
+ /**
+ * Checks if `object` conforms to `source` by invoking the predicate
+ * properties of `source` with the corresponding property values of `object`.
+ *
+ * **Note:** This method is equivalent to `_.conforms` when `source` is
+ * partially applied.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.14.0
+ * @category Lang
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2 };
+ *
+ * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
+ * // => true
+ *
+ * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
+ * // => false
+ */
+ function conformsTo(object, source) {
+ return source == null || baseConformsTo(object, source, keys(source));
+ }
+
+ /**
+ * Performs a
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
+ * comparison between two values to determine if they are equivalent.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @example
+ *
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
+ *
+ * _.eq(object, object);
+ * // => true
+ *
+ * _.eq(object, other);
+ * // => false
+ *
+ * _.eq('a', 'a');
+ * // => true
+ *
+ * _.eq('a', Object('a'));
+ * // => false
+ *
+ * _.eq(NaN, NaN);
+ * // => true
+ */
+ function eq(value, other) {
+ return value === other || (value !== value && other !== other);
+ }
+
+ /**
+ * Checks if `value` is greater than `other`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.9.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is greater than `other`,
+ * else `false`.
+ * @see _.lt
+ * @example
+ *
+ * _.gt(3, 1);
+ * // => true
+ *
+ * _.gt(3, 3);
+ * // => false
+ *
+ * _.gt(1, 3);
+ * // => false
+ */
+ var gt = createRelationalOperation(baseGt);
+
+ /**
+ * Checks if `value` is greater than or equal to `other`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.9.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is greater than or equal to
+ * `other`, else `false`.
+ * @see _.lte
+ * @example
+ *
+ * _.gte(3, 1);
+ * // => true
+ *
+ * _.gte(3, 3);
+ * // => true
+ *
+ * _.gte(1, 3);
+ * // => false
+ */
+ var gte = createRelationalOperation(function(value, other) {
+ return value >= other;
+ });
+
+ /**
+ * Checks if `value` is likely an `arguments` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+ * else `false`.
+ * @example
+ *
+ * _.isArguments(function() { return arguments; }());
+ * // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
+ */
+ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
+ return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
+ !propertyIsEnumerable.call(value, 'callee');
+ };
+
+ /**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(document.body.children);
+ * // => false
+ *
+ * _.isArray('abc');
+ * // => false
+ *
+ * _.isArray(_.noop);
+ * // => false
+ */
+ var isArray = Array.isArray;
+
+ /**
+ * Checks if `value` is classified as an `ArrayBuffer` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.3.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
+ * @example
+ *
+ * _.isArrayBuffer(new ArrayBuffer(2));
+ * // => true
+ *
+ * _.isArrayBuffer(new Array(2));
+ * // => false
+ */
+ var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
+
+ /**
+ * Checks if `value` is array-like. A value is considered array-like if it's
+ * not a function and has a `value.length` that's an integer greater than or
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+ * @example
+ *
+ * _.isArrayLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLike(document.body.children);
+ * // => true
+ *
+ * _.isArrayLike('abc');
+ * // => true
+ *
+ * _.isArrayLike(_.noop);
+ * // => false
+ */
+ function isArrayLike(value) {
+ return value != null && isLength(value.length) && !isFunction(value);
+ }
+
+ /**
+ * This method is like `_.isArrayLike` except that it also checks if `value`
+ * is an object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
+ * else `false`.
+ * @example
+ *
+ * _.isArrayLikeObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLikeObject(document.body.children);
+ * // => true
+ *
+ * _.isArrayLikeObject('abc');
+ * // => false
+ *
+ * _.isArrayLikeObject(_.noop);
+ * // => false
+ */
+ function isArrayLikeObject(value) {
+ return isObjectLike(value) && isArrayLike(value);
+ }
+
+ /**
+ * Checks if `value` is classified as a boolean primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
+ * @example
+ *
+ * _.isBoolean(false);
+ * // => true
+ *
+ * _.isBoolean(null);
+ * // => false
+ */
+ function isBoolean(value) {
+ return value === true || value === false ||
+ (isObjectLike(value) && baseGetTag(value) == boolTag);
+ }
+
+ /**
+ * Checks if `value` is a buffer.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.3.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
+ * @example
+ *
+ * _.isBuffer(new Buffer(2));
+ * // => true
+ *
+ * _.isBuffer(new Uint8Array(2));
+ * // => false
+ */
+ var isBuffer = nativeIsBuffer || stubFalse;
+
+ /**
+ * Checks if `value` is classified as a `Date` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ * @example
+ *
+ * _.isDate(new Date);
+ * // => true
+ *
+ * _.isDate('Mon April 23 2012');
+ * // => false
+ */
+ var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
+
+ /**
+ * Checks if `value` is likely a DOM element.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
+ * @example
+ *
+ * _.isElement(document.body);
+ * // => true
+ *
+ * _.isElement('');
+ * // => false
+ */
+ function isElement(value) {
+ return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
+ }
+
+ /**
+ * Checks if `value` is an empty object, collection, map, or set.
+ *
+ * Objects are considered empty if they have no own enumerable string keyed
+ * properties.
+ *
+ * Array-like values such as `arguments` objects, arrays, buffers, strings, or
+ * jQuery-like collections are considered empty if they have a `length` of `0`.
+ * Similarly, maps and sets are considered empty if they have a `size` of `0`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is empty, else `false`.
+ * @example
+ *
+ * _.isEmpty(null);
+ * // => true
+ *
+ * _.isEmpty(true);
+ * // => true
+ *
+ * _.isEmpty(1);
+ * // => true
+ *
+ * _.isEmpty([1, 2, 3]);
+ * // => false
+ *
+ * _.isEmpty({ 'a': 1 });
+ * // => false
+ */
+ function isEmpty(value) {
+ if (value == null) {
+ return true;
+ }
+ if (isArrayLike(value) &&
+ (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
+ isBuffer(value) || isTypedArray(value) || isArguments(value))) {
+ return !value.length;
+ }
+ var tag = getTag(value);
+ if (tag == mapTag || tag == setTag) {
+ return !value.size;
+ }
+ if (isPrototype(value)) {
+ return !baseKeys(value).length;
+ }
+ for (var key in value) {
+ if (hasOwnProperty.call(value, key)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Performs a deep comparison between two values to determine if they are
+ * equivalent.
+ *
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
+ * by their own, not inherited, enumerable properties. Functions and DOM
+ * nodes are compared by strict equality, i.e. `===`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @example
+ *
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
+ *
+ * _.isEqual(object, other);
+ * // => true
+ *
+ * object === other;
+ * // => false
+ */
+ function isEqual(value, other) {
+ return baseIsEqual(value, other);
+ }
+
+ /**
+ * This method is like `_.isEqual` except that it accepts `customizer` which
+ * is invoked to compare values. If `customizer` returns `undefined`, comparisons
+ * are handled by the method instead. The `customizer` is invoked with up to
+ * six arguments: (objValue, othValue [, index|key, object, other, stack]).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @param {Function} [customizer] The function to customize comparisons.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @example
+ *
+ * function isGreeting(value) {
+ * return /^h(?:i|ello)$/.test(value);
+ * }
+ *
+ * function customizer(objValue, othValue) {
+ * if (isGreeting(objValue) && isGreeting(othValue)) {
+ * return true;
+ * }
+ * }
+ *
+ * var array = ['hello', 'goodbye'];
+ * var other = ['hi', 'goodbye'];
+ *
+ * _.isEqualWith(array, other, customizer);
+ * // => true
+ */
+ function isEqualWith(value, other, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined$1;
+ var result = customizer ? customizer(value, other) : undefined$1;
+ return result === undefined$1 ? baseIsEqual(value, other, undefined$1, customizer) : !!result;
+ }
+
+ /**
+ * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
+ * `SyntaxError`, `TypeError`, or `URIError` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
+ * @example
+ *
+ * _.isError(new Error);
+ * // => true
+ *
+ * _.isError(Error);
+ * // => false
+ */
+ function isError(value) {
+ if (!isObjectLike(value)) {
+ return false;
+ }
+ var tag = baseGetTag(value);
+ return tag == errorTag || tag == domExcTag ||
+ (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
+ }
+
+ /**
+ * Checks if `value` is a finite primitive number.
+ *
+ * **Note:** This method is based on
+ * [`Number.isFinite`](https://mdn.io/Number/isFinite).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
+ * @example
+ *
+ * _.isFinite(3);
+ * // => true
+ *
+ * _.isFinite(Number.MIN_VALUE);
+ * // => true
+ *
+ * _.isFinite(Infinity);
+ * // => false
+ *
+ * _.isFinite('3');
+ * // => false
+ */
+ function isFinite(value) {
+ return typeof value == 'number' && nativeIsFinite(value);
+ }
+
+ /**
+ * Checks if `value` is classified as a `Function` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
+ * @example
+ *
+ * _.isFunction(_);
+ * // => true
+ *
+ * _.isFunction(/abc/);
+ * // => false
+ */
+ function isFunction(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+ // The use of `Object#toString` avoids issues with the `typeof` operator
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
+ var tag = baseGetTag(value);
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
+ }
+
+ /**
+ * Checks if `value` is an integer.
+ *
+ * **Note:** This method is based on
+ * [`Number.isInteger`](https://mdn.io/Number/isInteger).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
+ * @example
+ *
+ * _.isInteger(3);
+ * // => true
+ *
+ * _.isInteger(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isInteger(Infinity);
+ * // => false
+ *
+ * _.isInteger('3');
+ * // => false
+ */
+ function isInteger(value) {
+ return typeof value == 'number' && value == toInteger(value);
+ }
+
+ /**
+ * Checks if `value` is a valid array-like length.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ * @example
+ *
+ * _.isLength(3);
+ * // => true
+ *
+ * _.isLength(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isLength(Infinity);
+ * // => false
+ *
+ * _.isLength('3');
+ * // => false
+ */
+ function isLength(value) {
+ return typeof value == 'number' &&
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
+ }
+
+ /**
+ * Checks if `value` is the
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(_.noop);
+ * // => true
+ *
+ * _.isObject(null);
+ * // => false
+ */
+ function isObject(value) {
+ var type = typeof value;
+ return value != null && (type == 'object' || type == 'function');
+ }
+
+ /**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+ function isObjectLike(value) {
+ return value != null && typeof value == 'object';
+ }
+
+ /**
+ * Checks if `value` is classified as a `Map` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.3.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
+ * @example
+ *
+ * _.isMap(new Map);
+ * // => true
+ *
+ * _.isMap(new WeakMap);
+ * // => false
+ */
+ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
+
+ /**
+ * Performs a partial deep comparison between `object` and `source` to
+ * determine if `object` contains equivalent property values.
+ *
+ * **Note:** This method is equivalent to `_.matches` when `source` is
+ * partially applied.
+ *
+ * Partial comparisons will match empty array and empty object `source`
+ * values against any array or object value, respectively. See `_.isEqual`
+ * for a list of supported value comparisons.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Lang
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property values to match.
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2 };
+ *
+ * _.isMatch(object, { 'b': 2 });
+ * // => true
+ *
+ * _.isMatch(object, { 'b': 1 });
+ * // => false
+ */
+ function isMatch(object, source) {
+ return object === source || baseIsMatch(object, source, getMatchData(source));
+ }
+
+ /**
+ * This method is like `_.isMatch` except that it accepts `customizer` which
+ * is invoked to compare values. If `customizer` returns `undefined`, comparisons
+ * are handled by the method instead. The `customizer` is invoked with five
+ * arguments: (objValue, srcValue, index|key, object, source).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property values to match.
+ * @param {Function} [customizer] The function to customize comparisons.
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
+ * @example
+ *
+ * function isGreeting(value) {
+ * return /^h(?:i|ello)$/.test(value);
+ * }
+ *
+ * function customizer(objValue, srcValue) {
+ * if (isGreeting(objValue) && isGreeting(srcValue)) {
+ * return true;
+ * }
+ * }
+ *
+ * var object = { 'greeting': 'hello' };
+ * var source = { 'greeting': 'hi' };
+ *
+ * _.isMatchWith(object, source, customizer);
+ * // => true
+ */
+ function isMatchWith(object, source, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined$1;
+ return baseIsMatch(object, source, getMatchData(source), customizer);
+ }
+
+ /**
+ * Checks if `value` is `NaN`.
+ *
+ * **Note:** This method is based on
+ * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
+ * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
+ * `undefined` and other non-number values.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ * @example
+ *
+ * _.isNaN(NaN);
+ * // => true
+ *
+ * _.isNaN(new Number(NaN));
+ * // => true
+ *
+ * isNaN(undefined);
+ * // => true
+ *
+ * _.isNaN(undefined);
+ * // => false
+ */
+ function isNaN(value) {
+ // An `NaN` primitive is the only value that is not equal to itself.
+ // Perform the `toStringTag` check first to avoid errors with some
+ // ActiveX objects in IE.
+ return isNumber(value) && value != +value;
+ }
+
+ /**
+ * Checks if `value` is a pristine native function.
+ *
+ * **Note:** This method can't reliably detect native functions in the presence
+ * of the core-js package because core-js circumvents this kind of detection.
+ * Despite multiple requests, the core-js maintainer has made it clear: any
+ * attempt to fix the detection will be obstructed. As a result, we're left
+ * with little choice but to throw an error. Unfortunately, this also affects
+ * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
+ * which rely on core-js.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a native function,
+ * else `false`.
+ * @example
+ *
+ * _.isNative(Array.prototype.push);
+ * // => true
+ *
+ * _.isNative(_);
+ * // => false
+ */
+ function isNative(value) {
+ if (isMaskable(value)) {
+ throw new Error(CORE_ERROR_TEXT);
+ }
+ return baseIsNative(value);
+ }
+
+ /**
+ * Checks if `value` is `null`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
+ * @example
+ *
+ * _.isNull(null);
+ * // => true
+ *
+ * _.isNull(void 0);
+ * // => false
+ */
+ function isNull(value) {
+ return value === null;
+ }
+
+ /**
+ * Checks if `value` is `null` or `undefined`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
+ * @example
+ *
+ * _.isNil(null);
+ * // => true
+ *
+ * _.isNil(void 0);
+ * // => true
+ *
+ * _.isNil(NaN);
+ * // => false
+ */
+ function isNil(value) {
+ return value == null;
+ }
+
+ /**
+ * Checks if `value` is classified as a `Number` primitive or object.
+ *
+ * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
+ * classified as numbers, use the `_.isFinite` method.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a number, else `false`.
+ * @example
+ *
+ * _.isNumber(3);
+ * // => true
+ *
+ * _.isNumber(Number.MIN_VALUE);
+ * // => true
+ *
+ * _.isNumber(Infinity);
+ * // => true
+ *
+ * _.isNumber('3');
+ * // => false
+ */
+ function isNumber(value) {
+ return typeof value == 'number' ||
+ (isObjectLike(value) && baseGetTag(value) == numberTag);
+ }
+
+ /**
+ * Checks if `value` is a plain object, that is, an object created by the
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.8.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * _.isPlainObject(new Foo);
+ * // => false
+ *
+ * _.isPlainObject([1, 2, 3]);
+ * // => false
+ *
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
+ * // => true
+ *
+ * _.isPlainObject(Object.create(null));
+ * // => true
+ */
+ function isPlainObject(value) {
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
+ return false;
+ }
+ var proto = getPrototype(value);
+ if (proto === null) {
+ return true;
+ }
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
+ return typeof Ctor == 'function' && Ctor instanceof Ctor &&
+ funcToString.call(Ctor) == objectCtorString;
+ }
+
+ /**
+ * Checks if `value` is classified as a `RegExp` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.1.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+ * @example
+ *
+ * _.isRegExp(/abc/);
+ * // => true
+ *
+ * _.isRegExp('/abc/');
+ * // => false
+ */
+ var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
+
+ /**
+ * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
+ * double precision number which isn't the result of a rounded unsafe integer.
+ *
+ * **Note:** This method is based on
+ * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
+ * @example
+ *
+ * _.isSafeInteger(3);
+ * // => true
+ *
+ * _.isSafeInteger(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isSafeInteger(Infinity);
+ * // => false
+ *
+ * _.isSafeInteger('3');
+ * // => false
+ */
+ function isSafeInteger(value) {
+ return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
+ }
+
+ /**
+ * Checks if `value` is classified as a `Set` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.3.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
+ * @example
+ *
+ * _.isSet(new Set);
+ * // => true
+ *
+ * _.isSet(new WeakSet);
+ * // => false
+ */
+ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
+
+ /**
+ * Checks if `value` is classified as a `String` primitive or object.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
+ * @example
+ *
+ * _.isString('abc');
+ * // => true
+ *
+ * _.isString(1);
+ * // => false
+ */
+ function isString(value) {
+ return typeof value == 'string' ||
+ (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
+ }
+
+ /**
+ * Checks if `value` is classified as a `Symbol` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
+ * @example
+ *
+ * _.isSymbol(Symbol.iterator);
+ * // => true
+ *
+ * _.isSymbol('abc');
+ * // => false
+ */
+ function isSymbol(value) {
+ return typeof value == 'symbol' ||
+ (isObjectLike(value) && baseGetTag(value) == symbolTag);
+ }
+
+ /**
+ * Checks if `value` is classified as a typed array.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+ * @example
+ *
+ * _.isTypedArray(new Uint8Array);
+ * // => true
+ *
+ * _.isTypedArray([]);
+ * // => false
+ */
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
+
+ /**
+ * Checks if `value` is `undefined`.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
+ * @example
+ *
+ * _.isUndefined(void 0);
+ * // => true
+ *
+ * _.isUndefined(null);
+ * // => false
+ */
+ function isUndefined(value) {
+ return value === undefined$1;
+ }
+
+ /**
+ * Checks if `value` is classified as a `WeakMap` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.3.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
+ * @example
+ *
+ * _.isWeakMap(new WeakMap);
+ * // => true
+ *
+ * _.isWeakMap(new Map);
+ * // => false
+ */
+ function isWeakMap(value) {
+ return isObjectLike(value) && getTag(value) == weakMapTag;
+ }
+
+ /**
+ * Checks if `value` is classified as a `WeakSet` object.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.3.0
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
+ * @example
+ *
+ * _.isWeakSet(new WeakSet);
+ * // => true
+ *
+ * _.isWeakSet(new Set);
+ * // => false
+ */
+ function isWeakSet(value) {
+ return isObjectLike(value) && baseGetTag(value) == weakSetTag;
+ }
+
+ /**
+ * Checks if `value` is less than `other`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.9.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is less than `other`,
+ * else `false`.
+ * @see _.gt
+ * @example
+ *
+ * _.lt(1, 3);
+ * // => true
+ *
+ * _.lt(3, 3);
+ * // => false
+ *
+ * _.lt(3, 1);
+ * // => false
+ */
+ var lt = createRelationalOperation(baseLt);
+
+ /**
+ * Checks if `value` is less than or equal to `other`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.9.0
+ * @category Lang
+ * @param {*} value The value to compare.
+ * @param {*} other The other value to compare.
+ * @returns {boolean} Returns `true` if `value` is less than or equal to
+ * `other`, else `false`.
+ * @see _.gte
+ * @example
+ *
+ * _.lte(1, 3);
+ * // => true
+ *
+ * _.lte(3, 3);
+ * // => true
+ *
+ * _.lte(3, 1);
+ * // => false
+ */
+ var lte = createRelationalOperation(function(value, other) {
+ return value <= other;
+ });
+
+ /**
+ * Converts `value` to an array.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {Array} Returns the converted array.
+ * @example
+ *
+ * _.toArray({ 'a': 1, 'b': 2 });
+ * // => [1, 2]
+ *
+ * _.toArray('abc');
+ * // => ['a', 'b', 'c']
+ *
+ * _.toArray(1);
+ * // => []
+ *
+ * _.toArray(null);
+ * // => []
+ */
+ function toArray(value) {
+ if (!value) {
+ return [];
+ }
+ if (isArrayLike(value)) {
+ return isString(value) ? stringToArray(value) : copyArray(value);
+ }
+ if (symIterator && value[symIterator]) {
+ return iteratorToArray(value[symIterator]());
+ }
+ var tag = getTag(value),
+ func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
+
+ return func(value);
+ }
+
+ /**
+ * Converts `value` to a finite number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.12.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted number.
+ * @example
+ *
+ * _.toFinite(3.2);
+ * // => 3.2
+ *
+ * _.toFinite(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toFinite(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toFinite('3.2');
+ * // => 3.2
+ */
+ function toFinite(value) {
+ if (!value) {
+ return value === 0 ? value : 0;
+ }
+ value = toNumber(value);
+ if (value === INFINITY || value === -INFINITY) {
+ var sign = (value < 0 ? -1 : 1);
+ return sign * MAX_INTEGER;
+ }
+ return value === value ? value : 0;
+ }
+
+ /**
+ * Converts `value` to an integer.
+ *
+ * **Note:** This method is loosely based on
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.toInteger(3.2);
+ * // => 3
+ *
+ * _.toInteger(Number.MIN_VALUE);
+ * // => 0
+ *
+ * _.toInteger(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toInteger('3.2');
+ * // => 3
+ */
+ function toInteger(value) {
+ var result = toFinite(value),
+ remainder = result % 1;
+
+ return result === result ? (remainder ? result - remainder : result) : 0;
+ }
+
+ /**
+ * Converts `value` to an integer suitable for use as the length of an
+ * array-like object.
+ *
+ * **Note:** This method is based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.toLength(3.2);
+ * // => 3
+ *
+ * _.toLength(Number.MIN_VALUE);
+ * // => 0
+ *
+ * _.toLength(Infinity);
+ * // => 4294967295
+ *
+ * _.toLength('3.2');
+ * // => 3
+ */
+ function toLength(value) {
+ return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
+ }
+
+ /**
+ * Converts `value` to a number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {number} Returns the number.
+ * @example
+ *
+ * _.toNumber(3.2);
+ * // => 3.2
+ *
+ * _.toNumber(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toNumber(Infinity);
+ * // => Infinity
+ *
+ * _.toNumber('3.2');
+ * // => 3.2
+ */
+ function toNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
+ if (isObject(value)) {
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
+ value = isObject(other) ? (other + '') : other;
+ }
+ if (typeof value != 'string') {
+ return value === 0 ? value : +value;
+ }
+ value = baseTrim(value);
+ var isBinary = reIsBinary.test(value);
+ return (isBinary || reIsOctal.test(value))
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
+ : (reIsBadHex.test(value) ? NAN : +value);
+ }
+
+ /**
+ * Converts `value` to a plain object flattening inherited enumerable string
+ * keyed properties of `value` to own properties of the plain object.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {Object} Returns the converted plain object.
+ * @example
+ *
+ * function Foo() {
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.assign({ 'a': 1 }, new Foo);
+ * // => { 'a': 1, 'b': 2 }
+ *
+ * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
+ * // => { 'a': 1, 'b': 2, 'c': 3 }
+ */
+ function toPlainObject(value) {
+ return copyObject(value, keysIn(value));
+ }
+
+ /**
+ * Converts `value` to a safe integer. A safe integer can be compared and
+ * represented correctly.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.toSafeInteger(3.2);
+ * // => 3
+ *
+ * _.toSafeInteger(Number.MIN_VALUE);
+ * // => 0
+ *
+ * _.toSafeInteger(Infinity);
+ * // => 9007199254740991
+ *
+ * _.toSafeInteger('3.2');
+ * // => 3
+ */
+ function toSafeInteger(value) {
+ return value
+ ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
+ : (value === 0 ? value : 0);
+ }
+
+ /**
+ * Converts `value` to a string. An empty string is returned for `null`
+ * and `undefined` values. The sign of `-0` is preserved.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {string} Returns the converted string.
+ * @example
+ *
+ * _.toString(null);
+ * // => ''
+ *
+ * _.toString(-0);
+ * // => '-0'
+ *
+ * _.toString([1, 2, 3]);
+ * // => '1,2,3'
+ */
+ function toString(value) {
+ return value == null ? '' : baseToString(value);
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Assigns own enumerable string keyed properties of source objects to the
+ * destination object. Source objects are applied from left to right.
+ * Subsequent sources overwrite property assignments of previous sources.
+ *
+ * **Note:** This method mutates `object` and is loosely based on
+ * [`Object.assign`](https://mdn.io/Object/assign).
+ *
+ * @static
+ * @memberOf _
+ * @since 0.10.0
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @returns {Object} Returns `object`.
+ * @see _.assignIn
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * function Bar() {
+ * this.c = 3;
+ * }
+ *
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
+ *
+ * _.assign({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'c': 3 }
+ */
+ var assign = createAssigner(function(object, source) {
+ if (isPrototype(source) || isArrayLike(source)) {
+ copyObject(source, keys(source), object);
+ return;
+ }
+ for (var key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ assignValue(object, key, source[key]);
+ }
+ }
+ });
+
+ /**
+ * This method is like `_.assign` except that it iterates over own and
+ * inherited source properties.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @alias extend
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @returns {Object} Returns `object`.
+ * @see _.assign
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * }
+ *
+ * function Bar() {
+ * this.c = 3;
+ * }
+ *
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
+ *
+ * _.assignIn({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
+ */
+ var assignIn = createAssigner(function(object, source) {
+ copyObject(source, keysIn(source), object);
+ });
+
+ /**
+ * This method is like `_.assignIn` except that it accepts `customizer`
+ * which is invoked to produce the assigned values. If `customizer` returns
+ * `undefined`, assignment is handled by the method instead. The `customizer`
+ * is invoked with five arguments: (objValue, srcValue, key, object, source).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @alias extendWith
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} sources The source objects.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ * @see _.assignWith
+ * @example
+ *
+ * function customizer(objValue, srcValue) {
+ * return _.isUndefined(objValue) ? srcValue : objValue;
+ * }
+ *
+ * var defaults = _.partialRight(_.assignInWith, customizer);
+ *
+ * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+ * // => { 'a': 1, 'b': 2 }
+ */
+ var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
+ copyObject(source, keysIn(source), object, customizer);
+ });
+
+ /**
+ * This method is like `_.assign` except that it accepts `customizer`
+ * which is invoked to produce the assigned values. If `customizer` returns
+ * `undefined`, assignment is handled by the method instead. The `customizer`
+ * is invoked with five arguments: (objValue, srcValue, key, object, source).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} sources The source objects.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ * @see _.assignInWith
+ * @example
+ *
+ * function customizer(objValue, srcValue) {
+ * return _.isUndefined(objValue) ? srcValue : objValue;
+ * }
+ *
+ * var defaults = _.partialRight(_.assignWith, customizer);
+ *
+ * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+ * // => { 'a': 1, 'b': 2 }
+ */
+ var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
+ copyObject(source, keys(source), object, customizer);
+ });
+
+ /**
+ * Creates an array of values corresponding to `paths` of `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.0.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {...(string|string[])} [paths] The property paths to pick.
+ * @returns {Array} Returns the picked values.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
+ *
+ * _.at(object, ['a[0].b.c', 'a[1]']);
+ * // => [3, 4]
+ */
+ var at = flatRest(baseAt);
+
+ /**
+ * Creates an object that inherits from the `prototype` object. If a
+ * `properties` object is given, its own enumerable string keyed properties
+ * are assigned to the created object.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.3.0
+ * @category Object
+ * @param {Object} prototype The object to inherit from.
+ * @param {Object} [properties] The properties to assign to the object.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * function Shape() {
+ * this.x = 0;
+ * this.y = 0;
+ * }
+ *
+ * function Circle() {
+ * Shape.call(this);
+ * }
+ *
+ * Circle.prototype = _.create(Shape.prototype, {
+ * 'constructor': Circle
+ * });
+ *
+ * var circle = new Circle;
+ * circle instanceof Circle;
+ * // => true
+ *
+ * circle instanceof Shape;
+ * // => true
+ */
+ function create(prototype, properties) {
+ var result = baseCreate(prototype);
+ return properties == null ? result : baseAssign(result, properties);
+ }
+
+ /**
+ * Assigns own and inherited enumerable string keyed properties of source
+ * objects to the destination object for all destination properties that
+ * resolve to `undefined`. Source objects are applied from left to right.
+ * Once a property is set, additional values of the same property are ignored.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @returns {Object} Returns `object`.
+ * @see _.defaultsDeep
+ * @example
+ *
+ * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+ * // => { 'a': 1, 'b': 2 }
+ */
+ var defaults = baseRest(function(object, sources) {
+ object = Object(object);
+
+ var index = -1;
+ var length = sources.length;
+ var guard = length > 2 ? sources[2] : undefined$1;
+
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
+ length = 1;
+ }
+
+ while (++index < length) {
+ var source = sources[index];
+ var props = keysIn(source);
+ var propsIndex = -1;
+ var propsLength = props.length;
+
+ while (++propsIndex < propsLength) {
+ var key = props[propsIndex];
+ var value = object[key];
+
+ if (value === undefined$1 ||
+ (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
+ object[key] = source[key];
+ }
+ }
+ }
+
+ return object;
+ });
+
+ /**
+ * This method is like `_.defaults` except that it recursively assigns
+ * default properties.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.10.0
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @returns {Object} Returns `object`.
+ * @see _.defaults
+ * @example
+ *
+ * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
+ * // => { 'a': { 'b': 2, 'c': 3 } }
+ */
+ var defaultsDeep = baseRest(function(args) {
+ args.push(undefined$1, customDefaultsMerge);
+ return apply(mergeWith, undefined$1, args);
+ });
+
+ /**
+ * This method is like `_.find` except that it returns the key of the first
+ * element `predicate` returns truthy for instead of the element itself.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.1.0
+ * @category Object
+ * @param {Object} object The object to inspect.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {string|undefined} Returns the key of the matched element,
+ * else `undefined`.
+ * @example
+ *
+ * var users = {
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
+ * };
+ *
+ * _.findKey(users, function(o) { return o.age < 40; });
+ * // => 'barney' (iteration order is not guaranteed)
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.findKey(users, { 'age': 1, 'active': true });
+ * // => 'pebbles'
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.findKey(users, ['active', false]);
+ * // => 'fred'
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.findKey(users, 'active');
+ * // => 'barney'
+ */
+ function findKey(object, predicate) {
+ return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
+ }
+
+ /**
+ * This method is like `_.findKey` except that it iterates over elements of
+ * a collection in the opposite order.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Object
+ * @param {Object} object The object to inspect.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
+ * @returns {string|undefined} Returns the key of the matched element,
+ * else `undefined`.
+ * @example
+ *
+ * var users = {
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
+ * };
+ *
+ * _.findLastKey(users, function(o) { return o.age < 40; });
+ * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
+ *
+ * // The `_.matches` iteratee shorthand.
+ * _.findLastKey(users, { 'age': 36, 'active': true });
+ * // => 'barney'
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.findLastKey(users, ['active', false]);
+ * // => 'fred'
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.findLastKey(users, 'active');
+ * // => 'pebbles'
+ */
+ function findLastKey(object, predicate) {
+ return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
+ }
+
+ /**
+ * Iterates over own and inherited enumerable string keyed properties of an
+ * object and invokes `iteratee` for each property. The iteratee is invoked
+ * with three arguments: (value, key, object). Iteratee functions may exit
+ * iteration early by explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.3.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ * @see _.forInRight
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forIn(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
+ */
+ function forIn(object, iteratee) {
+ return object == null
+ ? object
+ : baseFor(object, getIteratee(iteratee, 3), keysIn);
+ }
+
+ /**
+ * This method is like `_.forIn` except that it iterates over properties of
+ * `object` in the opposite order.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ * @see _.forIn
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forInRight(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
+ */
+ function forInRight(object, iteratee) {
+ return object == null
+ ? object
+ : baseForRight(object, getIteratee(iteratee, 3), keysIn);
+ }
+
+ /**
+ * Iterates over own enumerable string keyed properties of an object and
+ * invokes `iteratee` for each property. The iteratee is invoked with three
+ * arguments: (value, key, object). Iteratee functions may exit iteration
+ * early by explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.3.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ * @see _.forOwnRight
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forOwn(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
+ */
+ function forOwn(object, iteratee) {
+ return object && baseForOwn(object, getIteratee(iteratee, 3));
+ }
+
+ /**
+ * This method is like `_.forOwn` except that it iterates over properties of
+ * `object` in the opposite order.
+ *
+ * @static
+ * @memberOf _
+ * @since 2.0.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ * @see _.forOwn
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forOwnRight(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
+ */
+ function forOwnRight(object, iteratee) {
+ return object && baseForOwnRight(object, getIteratee(iteratee, 3));
+ }
+
+ /**
+ * Creates an array of function property names from own enumerable properties
+ * of `object`.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns the function names.
+ * @see _.functionsIn
+ * @example
+ *
+ * function Foo() {
+ * this.a = _.constant('a');
+ * this.b = _.constant('b');
+ * }
+ *
+ * Foo.prototype.c = _.constant('c');
+ *
+ * _.functions(new Foo);
+ * // => ['a', 'b']
+ */
+ function functions(object) {
+ return object == null ? [] : baseFunctions(object, keys(object));
+ }
+
+ /**
+ * Creates an array of function property names from own and inherited
+ * enumerable properties of `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns the function names.
+ * @see _.functions
+ * @example
+ *
+ * function Foo() {
+ * this.a = _.constant('a');
+ * this.b = _.constant('b');
+ * }
+ *
+ * Foo.prototype.c = _.constant('c');
+ *
+ * _.functionsIn(new Foo);
+ * // => ['a', 'b', 'c']
+ */
+ function functionsIn(object) {
+ return object == null ? [] : baseFunctions(object, keysIn(object));
+ }
+
+ /**
+ * Gets the value at `path` of `object`. If the resolved value is
+ * `undefined`, the `defaultValue` is returned in its place.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.7.0
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the property to get.
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
+ * @returns {*} Returns the resolved value.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+ *
+ * _.get(object, 'a[0].b.c');
+ * // => 3
+ *
+ * _.get(object, ['a', '0', 'b', 'c']);
+ * // => 3
+ *
+ * _.get(object, 'a.b.c', 'default');
+ * // => 'default'
+ */
+ function get(object, path, defaultValue) {
+ var result = object == null ? undefined$1 : baseGet(object, path);
+ return result === undefined$1 ? defaultValue : result;
+ }
+
+ /**
+ * Checks if `path` is a direct property of `object`.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path to check.
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
+ * @example
+ *
+ * var object = { 'a': { 'b': 2 } };
+ * var other = _.create({ 'a': _.create({ 'b': 2 }) });
+ *
+ * _.has(object, 'a');
+ * // => true
+ *
+ * _.has(object, 'a.b');
+ * // => true
+ *
+ * _.has(object, ['a', 'b']);
+ * // => true
+ *
+ * _.has(other, 'a');
+ * // => false
+ */
+ function has(object, path) {
+ return object != null && hasPath(object, path, baseHas);
+ }
+
+ /**
+ * Checks if `path` is a direct or inherited property of `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path to check.
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
+ * @example
+ *
+ * var object = _.create({ 'a': _.create({ 'b': 2 }) });
+ *
+ * _.hasIn(object, 'a');
+ * // => true
+ *
+ * _.hasIn(object, 'a.b');
+ * // => true
+ *
+ * _.hasIn(object, ['a', 'b']);
+ * // => true
+ *
+ * _.hasIn(object, 'b');
+ * // => false
+ */
+ function hasIn(object, path) {
+ return object != null && hasPath(object, path, baseHasIn);
+ }
+
+ /**
+ * Creates an object composed of the inverted keys and values of `object`.
+ * If `object` contains duplicate values, subsequent values overwrite
+ * property assignments of previous values.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.7.0
+ * @category Object
+ * @param {Object} object The object to invert.
+ * @returns {Object} Returns the new inverted object.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2, 'c': 1 };
+ *
+ * _.invert(object);
+ * // => { '1': 'c', '2': 'b' }
+ */
+ var invert = createInverter(function(result, value, key) {
+ if (value != null &&
+ typeof value.toString != 'function') {
+ value = nativeObjectToString.call(value);
+ }
+
+ result[value] = key;
+ }, constant(identity));
+
+ /**
+ * This method is like `_.invert` except that the inverted object is generated
+ * from the results of running each element of `object` thru `iteratee`. The
+ * corresponding inverted value of each inverted key is an array of keys
+ * responsible for generating the inverted value. The iteratee is invoked
+ * with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.1.0
+ * @category Object
+ * @param {Object} object The object to invert.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
+ * @returns {Object} Returns the new inverted object.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2, 'c': 1 };
+ *
+ * _.invertBy(object);
+ * // => { '1': ['a', 'c'], '2': ['b'] }
+ *
+ * _.invertBy(object, function(value) {
+ * return 'group' + value;
+ * });
+ * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
+ */
+ var invertBy = createInverter(function(result, value, key) {
+ if (value != null &&
+ typeof value.toString != 'function') {
+ value = nativeObjectToString.call(value);
+ }
+
+ if (hasOwnProperty.call(result, value)) {
+ result[value].push(key);
+ } else {
+ result[value] = [key];
+ }
+ }, getIteratee);
+
+ /**
+ * Invokes the method at `path` of `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the method to invoke.
+ * @param {...*} [args] The arguments to invoke the method with.
+ * @returns {*} Returns the result of the invoked method.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
+ *
+ * _.invoke(object, 'a[0].b.c.slice', 1, 3);
+ * // => [2, 3]
+ */
+ var invoke = baseRest(baseInvoke);
+
+ /**
+ * Creates an array of the own enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects. See the
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
+ * for more details.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keys(new Foo);
+ * // => ['a', 'b'] (iteration order is not guaranteed)
+ *
+ * _.keys('hi');
+ * // => ['0', '1']
+ */
+ function keys(object) {
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
+ }
+
+ /**
+ * Creates an array of the own and inherited enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keysIn(new Foo);
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
+ */
+ function keysIn(object) {
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
+ }
+
+ /**
+ * The opposite of `_.mapValues`; this method creates an object with the
+ * same values as `object` and keys generated by running each own enumerable
+ * string keyed property of `object` thru `iteratee`. The iteratee is invoked
+ * with three arguments: (value, key, object).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.8.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Object} Returns the new mapped object.
+ * @see _.mapValues
+ * @example
+ *
+ * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
+ * return key + value;
+ * });
+ * // => { 'a1': 1, 'b2': 2 }
+ */
+ function mapKeys(object, iteratee) {
+ var result = {};
+ iteratee = getIteratee(iteratee, 3);
+
+ baseForOwn(object, function(value, key, object) {
+ baseAssignValue(result, iteratee(value, key, object), value);
+ });
+ return result;
+ }
+
+ /**
+ * Creates an object with the same keys as `object` and values generated
+ * by running each own enumerable string keyed property of `object` thru
+ * `iteratee`. The iteratee is invoked with three arguments:
+ * (value, key, object).
+ *
+ * @static
+ * @memberOf _
+ * @since 2.4.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Object} Returns the new mapped object.
+ * @see _.mapKeys
+ * @example
+ *
+ * var users = {
+ * 'fred': { 'user': 'fred', 'age': 40 },
+ * 'pebbles': { 'user': 'pebbles', 'age': 1 }
+ * };
+ *
+ * _.mapValues(users, function(o) { return o.age; });
+ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.mapValues(users, 'age');
+ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
+ */
+ function mapValues(object, iteratee) {
+ var result = {};
+ iteratee = getIteratee(iteratee, 3);
+
+ baseForOwn(object, function(value, key, object) {
+ baseAssignValue(result, key, iteratee(value, key, object));
+ });
+ return result;
+ }
+
+ /**
+ * This method is like `_.assign` except that it recursively merges own and
+ * inherited enumerable string keyed properties of source objects into the
+ * destination object. Source properties that resolve to `undefined` are
+ * skipped if a destination value exists. Array and plain object properties
+ * are merged recursively. Other objects and value types are overridden by
+ * assignment. Source objects are applied from left to right. Subsequent
+ * sources overwrite property assignments of previous sources.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.5.0
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} [sources] The source objects.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = {
+ * 'a': [{ 'b': 2 }, { 'd': 4 }]
+ * };
+ *
+ * var other = {
+ * 'a': [{ 'c': 3 }, { 'e': 5 }]
+ * };
+ *
+ * _.merge(object, other);
+ * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
+ */
+ var merge = createAssigner(function(object, source, srcIndex) {
+ baseMerge(object, source, srcIndex);
+ });
+
+ /**
+ * This method is like `_.merge` except that it accepts `customizer` which
+ * is invoked to produce the merged values of the destination and source
+ * properties. If `customizer` returns `undefined`, merging is handled by the
+ * method instead. The `customizer` is invoked with six arguments:
+ * (objValue, srcValue, key, object, source, stack).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} sources The source objects.
+ * @param {Function} customizer The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * function customizer(objValue, srcValue) {
+ * if (_.isArray(objValue)) {
+ * return objValue.concat(srcValue);
+ * }
+ * }
+ *
+ * var object = { 'a': [1], 'b': [2] };
+ * var other = { 'a': [3], 'b': [4] };
+ *
+ * _.mergeWith(object, other, customizer);
+ * // => { 'a': [1, 3], 'b': [2, 4] }
+ */
+ var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
+ baseMerge(object, source, srcIndex, customizer);
+ });
+
+ /**
+ * The opposite of `_.pick`; this method creates an object composed of the
+ * own and inherited enumerable property paths of `object` that are not omitted.
+ *
+ * **Note:** This method is considerably slower than `_.pick`.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The source object.
+ * @param {...(string|string[])} [paths] The property paths to omit.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': '2', 'c': 3 };
+ *
+ * _.omit(object, ['a', 'c']);
+ * // => { 'b': '2' }
+ */
+ var omit = flatRest(function(object, paths) {
+ var result = {};
+ if (object == null) {
+ return result;
+ }
+ var isDeep = false;
+ paths = arrayMap(paths, function(path) {
+ path = castPath(path, object);
+ isDeep || (isDeep = path.length > 1);
+ return path;
+ });
+ copyObject(object, getAllKeysIn(object), result);
+ if (isDeep) {
+ result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
+ }
+ var length = paths.length;
+ while (length--) {
+ baseUnset(result, paths[length]);
+ }
+ return result;
+ });
+
+ /**
+ * The opposite of `_.pickBy`; this method creates an object composed of
+ * the own and inherited enumerable string keyed properties of `object` that
+ * `predicate` doesn't return truthy for. The predicate is invoked with two
+ * arguments: (value, key).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The source object.
+ * @param {Function} [predicate=_.identity] The function invoked per property.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': '2', 'c': 3 };
+ *
+ * _.omitBy(object, _.isNumber);
+ * // => { 'b': '2' }
+ */
+ function omitBy(object, predicate) {
+ return pickBy(object, negate(getIteratee(predicate)));
+ }
+
+ /**
+ * Creates an object composed of the picked `object` properties.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The source object.
+ * @param {...(string|string[])} [paths] The property paths to pick.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': '2', 'c': 3 };
+ *
+ * _.pick(object, ['a', 'c']);
+ * // => { 'a': 1, 'c': 3 }
+ */
+ var pick = flatRest(function(object, paths) {
+ return object == null ? {} : basePick(object, paths);
+ });
+
+ /**
+ * Creates an object composed of the `object` properties `predicate` returns
+ * truthy for. The predicate is invoked with two arguments: (value, key).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The source object.
+ * @param {Function} [predicate=_.identity] The function invoked per property.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': '2', 'c': 3 };
+ *
+ * _.pickBy(object, _.isNumber);
+ * // => { 'a': 1, 'c': 3 }
+ */
+ function pickBy(object, predicate) {
+ if (object == null) {
+ return {};
+ }
+ var props = arrayMap(getAllKeysIn(object), function(prop) {
+ return [prop];
+ });
+ predicate = getIteratee(predicate);
+ return basePickBy(object, props, function(value, path) {
+ return predicate(value, path[0]);
+ });
+ }
+
+ /**
+ * This method is like `_.get` except that if the resolved value is a
+ * function it's invoked with the `this` binding of its parent object and
+ * its result is returned.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the property to resolve.
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
+ * @returns {*} Returns the resolved value.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
+ *
+ * _.result(object, 'a[0].b.c1');
+ * // => 3
+ *
+ * _.result(object, 'a[0].b.c2');
+ * // => 4
+ *
+ * _.result(object, 'a[0].b.c3', 'default');
+ * // => 'default'
+ *
+ * _.result(object, 'a[0].b.c3', _.constant('default'));
+ * // => 'default'
+ */
+ function result(object, path, defaultValue) {
+ path = castPath(path, object);
+
+ var index = -1,
+ length = path.length;
+
+ // Ensure the loop is entered when path is empty.
+ if (!length) {
+ length = 1;
+ object = undefined$1;
+ }
+ while (++index < length) {
+ var value = object == null ? undefined$1 : object[toKey(path[index])];
+ if (value === undefined$1) {
+ index = length;
+ value = defaultValue;
+ }
+ object = isFunction(value) ? value.call(object) : value;
+ }
+ return object;
+ }
+
+ /**
+ * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
+ * it's created. Arrays are created for missing index properties while objects
+ * are created for all other missing properties. Use `_.setWith` to customize
+ * `path` creation.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.7.0
+ * @category Object
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+ *
+ * _.set(object, 'a[0].b.c', 4);
+ * console.log(object.a[0].b.c);
+ * // => 4
+ *
+ * _.set(object, ['x', '0', 'y', 'z'], 5);
+ * console.log(object.x[0].y.z);
+ * // => 5
+ */
+ function set(object, path, value) {
+ return object == null ? object : baseSet(object, path, value);
+ }
+
+ /**
+ * This method is like `_.set` except that it accepts `customizer` which is
+ * invoked to produce the objects of `path`. If `customizer` returns `undefined`
+ * path creation is handled by the method instead. The `customizer` is invoked
+ * with three arguments: (nsValue, key, nsObject).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to set.
+ * @param {*} value The value to set.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = {};
+ *
+ * _.setWith(object, '[0][1]', 'a', Object);
+ * // => { '0': { '1': 'a' } }
+ */
+ function setWith(object, path, value, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined$1;
+ return object == null ? object : baseSet(object, path, value, customizer);
+ }
+
+ /**
+ * Creates an array of own enumerable string keyed-value pairs for `object`
+ * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
+ * entries are returned.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @alias entries
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the key-value pairs.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.toPairs(new Foo);
+ * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
+ */
+ var toPairs = createToPairs(keys);
+
+ /**
+ * Creates an array of own and inherited enumerable string keyed-value pairs
+ * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
+ * or set, its entries are returned.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @alias entriesIn
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the key-value pairs.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.toPairsIn(new Foo);
+ * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
+ */
+ var toPairsIn = createToPairs(keysIn);
+
+ /**
+ * An alternative to `_.reduce`; this method transforms `object` to a new
+ * `accumulator` object which is the result of running each of its own
+ * enumerable string keyed properties thru `iteratee`, with each invocation
+ * potentially mutating the `accumulator` object. If `accumulator` is not
+ * provided, a new object with the same `[[Prototype]]` will be used. The
+ * iteratee is invoked with four arguments: (accumulator, value, key, object).
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.3.0
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @param {*} [accumulator] The custom accumulator value.
+ * @returns {*} Returns the accumulated value.
+ * @example
+ *
+ * _.transform([2, 3, 4], function(result, n) {
+ * result.push(n *= n);
+ * return n % 2 == 0;
+ * }, []);
+ * // => [4, 9]
+ *
+ * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
+ * (result[value] || (result[value] = [])).push(key);
+ * }, {});
+ * // => { '1': ['a', 'c'], '2': ['b'] }
+ */
+ function transform(object, iteratee, accumulator) {
+ var isArr = isArray(object),
+ isArrLike = isArr || isBuffer(object) || isTypedArray(object);
+
+ iteratee = getIteratee(iteratee, 4);
+ if (accumulator == null) {
+ var Ctor = object && object.constructor;
+ if (isArrLike) {
+ accumulator = isArr ? new Ctor : [];
+ }
+ else if (isObject(object)) {
+ accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
+ }
+ else {
+ accumulator = {};
+ }
+ }
+ (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
+ return iteratee(accumulator, value, index, object);
+ });
+ return accumulator;
+ }
+
+ /**
+ * Removes the property at `path` of `object`.
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Object
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to unset.
+ * @returns {boolean} Returns `true` if the property is deleted, else `false`.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 7 } }] };
+ * _.unset(object, 'a[0].b.c');
+ * // => true
+ *
+ * console.log(object);
+ * // => { 'a': [{ 'b': {} }] };
+ *
+ * _.unset(object, ['a', '0', 'b', 'c']);
+ * // => true
+ *
+ * console.log(object);
+ * // => { 'a': [{ 'b': {} }] };
+ */
+ function unset(object, path) {
+ return object == null ? true : baseUnset(object, path);
+ }
+
+ /**
+ * This method is like `_.set` except that accepts `updater` to produce the
+ * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
+ * is invoked with one argument: (value).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.6.0
+ * @category Object
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to set.
+ * @param {Function} updater The function to produce the updated value.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
+ *
+ * _.update(object, 'a[0].b.c', function(n) { return n * n; });
+ * console.log(object.a[0].b.c);
+ * // => 9
+ *
+ * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
+ * console.log(object.x[0].y.z);
+ * // => 0
+ */
+ function update(object, path, updater) {
+ return object == null ? object : baseUpdate(object, path, castFunction(updater));
+ }
+
+ /**
+ * This method is like `_.update` except that it accepts `customizer` which is
+ * invoked to produce the objects of `path`. If `customizer` returns `undefined`
+ * path creation is handled by the method instead. The `customizer` is invoked
+ * with three arguments: (nsValue, key, nsObject).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.6.0
+ * @category Object
+ * @param {Object} object The object to modify.
+ * @param {Array|string} path The path of the property to set.
+ * @param {Function} updater The function to produce the updated value.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * var object = {};
+ *
+ * _.updateWith(object, '[0][1]', _.constant('a'), Object);
+ * // => { '0': { '1': 'a' } }
+ */
+ function updateWith(object, path, updater, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined$1;
+ return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
+ }
+
+ /**
+ * Creates an array of the own enumerable string keyed property values of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property values.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.values(new Foo);
+ * // => [1, 2] (iteration order is not guaranteed)
+ *
+ * _.values('hi');
+ * // => ['h', 'i']
+ */
+ function values(object) {
+ return object == null ? [] : baseValues(object, keys(object));
+ }
+
+ /**
+ * Creates an array of the own and inherited enumerable string keyed property
+ * values of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property values.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.valuesIn(new Foo);
+ * // => [1, 2, 3] (iteration order is not guaranteed)
+ */
+ function valuesIn(object) {
+ return object == null ? [] : baseValues(object, keysIn(object));
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Clamps `number` within the inclusive `lower` and `upper` bounds.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Number
+ * @param {number} number The number to clamp.
+ * @param {number} [lower] The lower bound.
+ * @param {number} upper The upper bound.
+ * @returns {number} Returns the clamped number.
+ * @example
+ *
+ * _.clamp(-10, -5, 5);
+ * // => -5
+ *
+ * _.clamp(10, -5, 5);
+ * // => 5
+ */
+ function clamp(number, lower, upper) {
+ if (upper === undefined$1) {
+ upper = lower;
+ lower = undefined$1;
+ }
+ if (upper !== undefined$1) {
+ upper = toNumber(upper);
+ upper = upper === upper ? upper : 0;
+ }
+ if (lower !== undefined$1) {
+ lower = toNumber(lower);
+ lower = lower === lower ? lower : 0;
+ }
+ return baseClamp(toNumber(number), lower, upper);
+ }
+
+ /**
+ * Checks if `n` is between `start` and up to, but not including, `end`. If
+ * `end` is not specified, it's set to `start` with `start` then set to `0`.
+ * If `start` is greater than `end` the params are swapped to support
+ * negative ranges.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.3.0
+ * @category Number
+ * @param {number} number The number to check.
+ * @param {number} [start=0] The start of the range.
+ * @param {number} end The end of the range.
+ * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
+ * @see _.range, _.rangeRight
+ * @example
+ *
+ * _.inRange(3, 2, 4);
+ * // => true
+ *
+ * _.inRange(4, 8);
+ * // => true
+ *
+ * _.inRange(4, 2);
+ * // => false
+ *
+ * _.inRange(2, 2);
+ * // => false
+ *
+ * _.inRange(1.2, 2);
+ * // => true
+ *
+ * _.inRange(5.2, 4);
+ * // => false
+ *
+ * _.inRange(-3, -2, -6);
+ * // => true
+ */
+ function inRange(number, start, end) {
+ start = toFinite(start);
+ if (end === undefined$1) {
+ end = start;
+ start = 0;
+ } else {
+ end = toFinite(end);
+ }
+ number = toNumber(number);
+ return baseInRange(number, start, end);
+ }
+
+ /**
+ * Produces a random number between the inclusive `lower` and `upper` bounds.
+ * If only one argument is provided a number between `0` and the given number
+ * is returned. If `floating` is `true`, or either `lower` or `upper` are
+ * floats, a floating-point number is returned instead of an integer.
+ *
+ * **Note:** JavaScript follows the IEEE-754 standard for resolving
+ * floating-point values which can produce unexpected results.
+ *
+ * @static
+ * @memberOf _
+ * @since 0.7.0
+ * @category Number
+ * @param {number} [lower=0] The lower bound.
+ * @param {number} [upper=1] The upper bound.
+ * @param {boolean} [floating] Specify returning a floating-point number.
+ * @returns {number} Returns the random number.
+ * @example
+ *
+ * _.random(0, 5);
+ * // => an integer between 0 and 5
+ *
+ * _.random(5);
+ * // => also an integer between 0 and 5
+ *
+ * _.random(5, true);
+ * // => a floating-point number between 0 and 5
+ *
+ * _.random(1.2, 5.2);
+ * // => a floating-point number between 1.2 and 5.2
+ */
+ function random(lower, upper, floating) {
+ if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
+ upper = floating = undefined$1;
+ }
+ if (floating === undefined$1) {
+ if (typeof upper == 'boolean') {
+ floating = upper;
+ upper = undefined$1;
+ }
+ else if (typeof lower == 'boolean') {
+ floating = lower;
+ lower = undefined$1;
+ }
+ }
+ if (lower === undefined$1 && upper === undefined$1) {
+ lower = 0;
+ upper = 1;
+ }
+ else {
+ lower = toFinite(lower);
+ if (upper === undefined$1) {
+ upper = lower;
+ lower = 0;
+ } else {
+ upper = toFinite(upper);
+ }
+ }
+ if (lower > upper) {
+ var temp = lower;
+ lower = upper;
+ upper = temp;
+ }
+ if (floating || lower % 1 || upper % 1) {
+ var rand = nativeRandom();
+ return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
+ }
+ return baseRandom(lower, upper);
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the camel cased string.
+ * @example
+ *
+ * _.camelCase('Foo Bar');
+ * // => 'fooBar'
+ *
+ * _.camelCase('--foo-bar--');
+ * // => 'fooBar'
+ *
+ * _.camelCase('__FOO_BAR__');
+ * // => 'fooBar'
+ */
+ var camelCase = createCompounder(function(result, word, index) {
+ word = word.toLowerCase();
+ return result + (index ? capitalize(word) : word);
+ });
+
+ /**
+ * Converts the first character of `string` to upper case and the remaining
+ * to lower case.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to capitalize.
+ * @returns {string} Returns the capitalized string.
+ * @example
+ *
+ * _.capitalize('FRED');
+ * // => 'Fred'
+ */
+ function capitalize(string) {
+ return upperFirst(toString(string).toLowerCase());
+ }
+
+ /**
+ * Deburrs `string` by converting
+ * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+ * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
+ * letters to basic Latin letters and removing
+ * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to deburr.
+ * @returns {string} Returns the deburred string.
+ * @example
+ *
+ * _.deburr('déjà vu');
+ * // => 'deja vu'
+ */
+ function deburr(string) {
+ string = toString(string);
+ return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
+ }
+
+ /**
+ * Checks if `string` ends with the given target string.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to inspect.
+ * @param {string} [target] The string to search for.
+ * @param {number} [position=string.length] The position to search up to.
+ * @returns {boolean} Returns `true` if `string` ends with `target`,
+ * else `false`.
+ * @example
+ *
+ * _.endsWith('abc', 'c');
+ * // => true
+ *
+ * _.endsWith('abc', 'b');
+ * // => false
+ *
+ * _.endsWith('abc', 'b', 2);
+ * // => true
+ */
+ function endsWith(string, target, position) {
+ string = toString(string);
+ target = baseToString(target);
+
+ var length = string.length;
+ position = position === undefined$1
+ ? length
+ : baseClamp(toInteger(position), 0, length);
+
+ var end = position;
+ position -= target.length;
+ return position >= 0 && string.slice(position, end) == target;
+ }
+
+ /**
+ * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
+ * corresponding HTML entities.
+ *
+ * **Note:** No other characters are escaped. To escape additional
+ * characters use a third-party library like [_he_](https://mths.be/he).
+ *
+ * Though the ">" character is escaped for symmetry, characters like
+ * ">" and "/" don't need escaping in HTML and have no special meaning
+ * unless they're part of a tag or unquoted attribute value. See
+ * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
+ * (under "semi-related fun fact") for more details.
+ *
+ * When working with HTML you should always
+ * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
+ * XSS vectors.
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The string to escape.
+ * @returns {string} Returns the escaped string.
+ * @example
+ *
+ * _.escape('fred, barney, & pebbles');
+ * // => 'fred, barney, & pebbles'
+ */
+ function escape(string) {
+ string = toString(string);
+ return (string && reHasUnescapedHtml.test(string))
+ ? string.replace(reUnescapedHtml, escapeHtmlChar)
+ : string;
+ }
+
+ /**
+ * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
+ * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to escape.
+ * @returns {string} Returns the escaped string.
+ * @example
+ *
+ * _.escapeRegExp('[lodash](https://lodash.com/)');
+ * // => '\[lodash\]\(https://lodash\.com/\)'
+ */
+ function escapeRegExp(string) {
+ string = toString(string);
+ return (string && reHasRegExpChar.test(string))
+ ? string.replace(reRegExpChar, '\\$&')
+ : string;
+ }
+
+ /**
+ * Converts `string` to
+ * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the kebab cased string.
+ * @example
+ *
+ * _.kebabCase('Foo Bar');
+ * // => 'foo-bar'
+ *
+ * _.kebabCase('fooBar');
+ * // => 'foo-bar'
+ *
+ * _.kebabCase('__FOO_BAR__');
+ * // => 'foo-bar'
+ */
+ var kebabCase = createCompounder(function(result, word, index) {
+ return result + (index ? '-' : '') + word.toLowerCase();
+ });
+
+ /**
+ * Converts `string`, as space separated words, to lower case.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the lower cased string.
+ * @example
+ *
+ * _.lowerCase('--Foo-Bar--');
+ * // => 'foo bar'
+ *
+ * _.lowerCase('fooBar');
+ * // => 'foo bar'
+ *
+ * _.lowerCase('__FOO_BAR__');
+ * // => 'foo bar'
+ */
+ var lowerCase = createCompounder(function(result, word, index) {
+ return result + (index ? ' ' : '') + word.toLowerCase();
+ });
+
+ /**
+ * Converts the first character of `string` to lower case.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the converted string.
+ * @example
+ *
+ * _.lowerFirst('Fred');
+ * // => 'fred'
+ *
+ * _.lowerFirst('FRED');
+ * // => 'fRED'
+ */
+ var lowerFirst = createCaseFirst('toLowerCase');
+
+ /**
+ * Pads `string` on the left and right sides if it's shorter than `length`.
+ * Padding characters are truncated if they can't be evenly divided by `length`.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to pad.
+ * @param {number} [length=0] The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the padded string.
+ * @example
+ *
+ * _.pad('abc', 8);
+ * // => ' abc '
+ *
+ * _.pad('abc', 8, '_-');
+ * // => '_-abc_-_'
+ *
+ * _.pad('abc', 3);
+ * // => 'abc'
+ */
+ function pad(string, length, chars) {
+ string = toString(string);
+ length = toInteger(length);
+
+ var strLength = length ? stringSize(string) : 0;
+ if (!length || strLength >= length) {
+ return string;
+ }
+ var mid = (length - strLength) / 2;
+ return (
+ createPadding(nativeFloor(mid), chars) +
+ string +
+ createPadding(nativeCeil(mid), chars)
+ );
+ }
+
+ /**
+ * Pads `string` on the right side if it's shorter than `length`. Padding
+ * characters are truncated if they exceed `length`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to pad.
+ * @param {number} [length=0] The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the padded string.
+ * @example
+ *
+ * _.padEnd('abc', 6);
+ * // => 'abc '
+ *
+ * _.padEnd('abc', 6, '_-');
+ * // => 'abc_-_'
+ *
+ * _.padEnd('abc', 3);
+ * // => 'abc'
+ */
+ function padEnd(string, length, chars) {
+ string = toString(string);
+ length = toInteger(length);
+
+ var strLength = length ? stringSize(string) : 0;
+ return (length && strLength < length)
+ ? (string + createPadding(length - strLength, chars))
+ : string;
+ }
+
+ /**
+ * Pads `string` on the left side if it's shorter than `length`. Padding
+ * characters are truncated if they exceed `length`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to pad.
+ * @param {number} [length=0] The padding length.
+ * @param {string} [chars=' '] The string used as padding.
+ * @returns {string} Returns the padded string.
+ * @example
+ *
+ * _.padStart('abc', 6);
+ * // => ' abc'
+ *
+ * _.padStart('abc', 6, '_-');
+ * // => '_-_abc'
+ *
+ * _.padStart('abc', 3);
+ * // => 'abc'
+ */
+ function padStart(string, length, chars) {
+ string = toString(string);
+ length = toInteger(length);
+
+ var strLength = length ? stringSize(string) : 0;
+ return (length && strLength < length)
+ ? (createPadding(length - strLength, chars) + string)
+ : string;
+ }
+
+ /**
+ * Converts `string` to an integer of the specified radix. If `radix` is
+ * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
+ * hexadecimal, in which case a `radix` of `16` is used.
+ *
+ * **Note:** This method aligns with the
+ * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
+ *
+ * @static
+ * @memberOf _
+ * @since 1.1.0
+ * @category String
+ * @param {string} string The string to convert.
+ * @param {number} [radix=10] The radix to interpret `value` by.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.parseInt('08');
+ * // => 8
+ *
+ * _.map(['6', '08', '10'], _.parseInt);
+ * // => [6, 8, 10]
+ */
+ function parseInt(string, radix, guard) {
+ if (guard || radix == null) {
+ radix = 0;
+ } else if (radix) {
+ radix = +radix;
+ }
+ return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
+ }
+
+ /**
+ * Repeats the given string `n` times.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to repeat.
+ * @param {number} [n=1] The number of times to repeat the string.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {string} Returns the repeated string.
+ * @example
+ *
+ * _.repeat('*', 3);
+ * // => '***'
+ *
+ * _.repeat('abc', 2);
+ * // => 'abcabc'
+ *
+ * _.repeat('abc', 0);
+ * // => ''
+ */
+ function repeat(string, n, guard) {
+ if ((guard ? isIterateeCall(string, n, guard) : n === undefined$1)) {
+ n = 1;
+ } else {
+ n = toInteger(n);
+ }
+ return baseRepeat(toString(string), n);
+ }
+
+ /**
+ * Replaces matches for `pattern` in `string` with `replacement`.
+ *
+ * **Note:** This method is based on
+ * [`String#replace`](https://mdn.io/String/replace).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to modify.
+ * @param {RegExp|string} pattern The pattern to replace.
+ * @param {Function|string} replacement The match replacement.
+ * @returns {string} Returns the modified string.
+ * @example
+ *
+ * _.replace('Hi Fred', 'Fred', 'Barney');
+ * // => 'Hi Barney'
+ */
+ function replace() {
+ var args = arguments,
+ string = toString(args[0]);
+
+ return args.length < 3 ? string : string.replace(args[1], args[2]);
+ }
+
+ /**
+ * Converts `string` to
+ * [snake case](https://en.wikipedia.org/wiki/Snake_case).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the snake cased string.
+ * @example
+ *
+ * _.snakeCase('Foo Bar');
+ * // => 'foo_bar'
+ *
+ * _.snakeCase('fooBar');
+ * // => 'foo_bar'
+ *
+ * _.snakeCase('--FOO-BAR--');
+ * // => 'foo_bar'
+ */
+ var snakeCase = createCompounder(function(result, word, index) {
+ return result + (index ? '_' : '') + word.toLowerCase();
+ });
+
+ /**
+ * Splits `string` by `separator`.
+ *
+ * **Note:** This method is based on
+ * [`String#split`](https://mdn.io/String/split).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category String
+ * @param {string} [string=''] The string to split.
+ * @param {RegExp|string} separator The separator pattern to split by.
+ * @param {number} [limit] The length to truncate results to.
+ * @returns {Array} Returns the string segments.
+ * @example
+ *
+ * _.split('a-b-c', '-', 2);
+ * // => ['a', 'b']
+ */
+ function split(string, separator, limit) {
+ if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
+ separator = limit = undefined$1;
+ }
+ limit = limit === undefined$1 ? MAX_ARRAY_LENGTH : limit >>> 0;
+ if (!limit) {
+ return [];
+ }
+ string = toString(string);
+ if (string && (
+ typeof separator == 'string' ||
+ (separator != null && !isRegExp(separator))
+ )) {
+ separator = baseToString(separator);
+ if (!separator && hasUnicode(string)) {
+ return castSlice(stringToArray(string), 0, limit);
+ }
+ }
+ return string.split(separator, limit);
+ }
+
+ /**
+ * Converts `string` to
+ * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
+ *
+ * @static
+ * @memberOf _
+ * @since 3.1.0
+ * @category String
+ * @param {string} [string=''] The string to convert.
+ * @returns {string} Returns the start cased string.
+ * @example
+ *
+ * _.startCase('--foo-bar--');
+ * // => 'Foo Bar'
+ *
+ * _.startCase('fooBar');
+ * // => 'Foo Bar'
+ *
+ * _.startCase('__FOO_BAR__');
+ * // => 'FOO BAR'
+ */
+ var startCase = createCompounder(function(result, word, index) {
+ return result + (index ? ' ' : '') + upperFirst(word);
+ });
+
+ /**
+ * Checks if `string` starts with the given target string.
+ *
+ * @static
+ * @memberOf _
+ * @since 3.0.0
+ * @category String
+ * @param {string} [string=''] The string to inspect.
+ * @param {string} [target] The string to search for.
+ * @param {number} [position=0] The position to search from.
+ * @returns {boolean} Returns `true` if `string` starts with `target`,
+ * else `false`.
+ * @example
+ *
+ * _.startsWith('abc', 'a');
+ * // => true
+ *
+ * _.startsWith('abc', 'b');
+ * // => false
+ *
+ * _.startsWith('abc', 'b', 1);
+ * // => true
+ */
+ function startsWith(string, target, position) {
+ string = toString(string);
+ position = position == null
+ ? 0
+ : baseClamp(toInteger(position), 0, string.length);
+
+ target = baseToString(target);
+ return string.slice(position, position + target.length) == target;
+ }
+
+ /**
+ * Creates a compiled template function that can interpolate data properties
+ * in "interpolate" delimiters, HTML-escape interpolated data properties in
+ * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
+ * properties may be accessed as free variables in the template. If a setting
+ * object is given, it takes precedence over `_.templateSettings` values.
+ *
+ * **Note:** In the development build `_.template` utilizes
+ * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
+ * for easier debugging.
+ *
+ * For more information on precompiling templates see
+ * [lodash's custom builds documentation](https://lodash.com/custom-builds).
+ *
+ * For more information on Chrome extension sandboxes see
+ * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
+ *
+ * @static
+ * @since 0.1.0
+ * @memberOf _
+ * @category String
+ * @param {string} [string=''] The template string.
+ * @param {Object} [options={}] The options object.
+ * @param {RegExp} [options.escape=_.templateSettings.escape]
+ * The HTML "escape" delimiter.
+ * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
+ * The "evaluate" delimiter.
+ * @param {Object} [options.imports=_.templateSettings.imports]
+ * An object to import into the template as free variables.
+ * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
+ * The "interpolate" delimiter.
+ * @param {string} [options.sourceURL='lodash.templateSources[n]']
+ * The sourceURL of the compiled template.
+ * @param {string} [options.variable='obj']
+ * The data object variable name.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {Function} Returns the compiled template function.
+ * @example
+ *
+ * // Use the "interpolate" delimiter to create a compiled template.
+ * var compiled = _.template('hello <%= user %>!');
+ * compiled({ 'user': 'fred' });
+ * // => 'hello fred!'
+ *
+ * // Use the HTML "escape" delimiter to escape data property values.
+ * var compiled = _.template('<%- value %>');
+ * compiled({ 'value': '