UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

69 lines 135 kB
var Gs=Object.create;var bt=Object.defineProperty;var zs=Object.getOwnPropertyDescriptor;var Ws=Object.getOwnPropertyNames;var Hs=Object.getPrototypeOf,Qs=Object.prototype.hasOwnProperty;var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Js=(t,e)=>{for(var r in e)bt(t,r,{get:e[r],enumerable:!0})},wn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ws(e))!Qs.call(t,i)&&i!==r&&bt(t,i,{get:()=>e[i],enumerable:!(n=zs(e,i))||n.enumerable});return t};var ue=(t,e,r)=>(r=t!=null?Gs(Hs(t)):{},wn(e||!t||!t.__esModule?bt(r,"default",{value:t,enumerable:!0}):r,t)),Xs=t=>wn(bt({},"__esModule",{value:!0}),t);var Ze=L((rr,nr)=>{(function(t,e){typeof rr=="object"&&typeof nr<"u"?nr.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(rr,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",a="minute",s="hour",o="day",u="week",l="month",c="quarter",m="year",f="date",d="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(E){var b=["th","st","nd","rd"],v=E%100;return"["+E+(b[(v-20)%10]||b[v]||b[0])+"]"}},y=function(E,b,v){var _=String(E);return!_||_.length>=b?E:""+Array(b+1-_.length).join(v)+E},R={s:y,z:function(E){var b=-E.utcOffset(),v=Math.abs(b),_=Math.floor(v/60),S=v%60;return(b<=0?"+":"-")+y(_,2,"0")+":"+y(S,2,"0")},m:function E(b,v){if(b.date()<v.date())return-E(v,b);var _=12*(v.year()-b.year())+(v.month()-b.month()),S=b.clone().add(_,l),p=v-S<0,w=b.clone().add(_+(p?-1:1),l);return+(-(_+(v-S)/(p?S-w:w-S))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:l,y:m,w:u,d:o,D:f,h:s,m:a,s:i,ms:n,Q:c}[E]||String(E||"").toLowerCase().replace(/s$/,"")},u:function(E){return E===void 0}},I="en",O={};O[I]=k;var x="$isDayjsObject",j=function(E){return E instanceof U||!(!E||!E[x])},P=function E(b,v,_){var S;if(!b)return I;if(typeof b=="string"){var p=b.toLowerCase();O[p]&&(S=p),v&&(O[p]=v,S=p);var w=b.split("-");if(!S&&w.length>1)return E(w[0])}else{var D=b.name;O[D]=b,S=D}return!_&&S&&(I=S),S||!_&&I},$=function(E,b){if(j(E))return E.clone();var v=typeof b=="object"?b:{};return v.date=E,v.args=arguments,new U(v)},C=R;C.l=P,C.i=j,C.w=function(E,b){return $(E,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var U=function(){function E(v){this.$L=P(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[x]=!0}var b=E.prototype;return b.parse=function(v){this.$d=function(_){var S=_.date,p=_.utc;if(S===null)return new Date(NaN);if(C.u(S))return new Date;if(S instanceof Date)return new Date(S);if(typeof S=="string"&&!/Z$/i.test(S)){var w=S.match(h);if(w){var D=w[2]-1||0,T=(w[7]||"0").substring(0,3);return p?new Date(Date.UTC(w[1],D,w[3]||1,w[4]||0,w[5]||0,w[6]||0,T)):new Date(w[1],D,w[3]||1,w[4]||0,w[5]||0,w[6]||0,T)}}return new Date(S)}(v),this.init()},b.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},b.$utils=function(){return C},b.isValid=function(){return this.$d.toString()!==d},b.isSame=function(v,_){var S=$(v);return this.startOf(_)<=S&&S<=this.endOf(_)},b.isAfter=function(v,_){return $(v)<this.startOf(_)},b.isBefore=function(v,_){return this.endOf(_)<$(v)},b.$g=function(v,_,S){return C.u(v)?this[_]:this.set(S,v)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(v,_){var S=this,p=!!C.u(_)||_,w=C.p(v),D=function(ce,W){var se=C.w(S.$u?Date.UTC(S.$y,W,ce):new Date(S.$y,W,ce),S);return p?se:se.endOf(o)},T=function(ce,W){return C.w(S.toDate()[ce].apply(S.toDate("s"),(p?[0,0,0,0]:[23,59,59,999]).slice(W)),S)},F=this.$W,Y=this.$M,ee=this.$D,be="set"+(this.$u?"UTC":"");switch(w){case m:return p?D(1,0):D(31,11);case l:return p?D(1,Y):D(0,Y+1);case u:var me=this.$locale().weekStart||0,Oe=(F<me?F+7:F)-me;return D(p?ee-Oe:ee+(6-Oe),Y);case o:case f:return T(be+"Hours",0);case s:return T(be+"Minutes",1);case a:return T(be+"Seconds",2);case i:return T(be+"Milliseconds",3);default:return this.clone()}},b.endOf=function(v){return this.startOf(v,!1)},b.$set=function(v,_){var S,p=C.p(v),w="set"+(this.$u?"UTC":""),D=(S={},S[o]=w+"Date",S[f]=w+"Date",S[l]=w+"Month",S[m]=w+"FullYear",S[s]=w+"Hours",S[a]=w+"Minutes",S[i]=w+"Seconds",S[n]=w+"Milliseconds",S)[p],T=p===o?this.$D+(_-this.$W):_;if(p===l||p===m){var F=this.clone().set(f,1);F.$d[D](T),F.init(),this.$d=F.set(f,Math.min(this.$D,F.daysInMonth())).$d}else D&&this.$d[D](T);return this.init(),this},b.set=function(v,_){return this.clone().$set(v,_)},b.get=function(v){return this[C.p(v)]()},b.add=function(v,_){var S,p=this;v=Number(v);var w=C.p(_),D=function(Y){var ee=$(p);return C.w(ee.date(ee.date()+Math.round(Y*v)),p)};if(w===l)return this.set(l,this.$M+v);if(w===m)return this.set(m,this.$y+v);if(w===o)return D(1);if(w===u)return D(7);var T=(S={},S[a]=e,S[s]=r,S[i]=t,S)[w]||1,F=this.$d.getTime()+v*T;return C.w(F,this)},b.subtract=function(v,_){return this.add(-1*v,_)},b.format=function(v){var _=this,S=this.$locale();if(!this.isValid())return S.invalidDate||d;var p=v||"YYYY-MM-DDTHH:mm:ssZ",w=C.z(this),D=this.$H,T=this.$m,F=this.$M,Y=S.weekdays,ee=S.months,be=S.meridiem,me=function(W,se,pe,De){return W&&(W[se]||W(_,p))||pe[se].slice(0,De)},Oe=function(W){return C.s(D%12||12,W,"0")},ce=be||function(W,se,pe){var De=W<12?"AM":"PM";return pe?De.toLowerCase():De};return p.replace(g,function(W,se){return se||function(pe){switch(pe){case"YY":return String(_.$y).slice(-2);case"YYYY":return C.s(_.$y,4,"0");case"M":return F+1;case"MM":return C.s(F+1,2,"0");case"MMM":return me(S.monthsShort,F,ee,3);case"MMMM":return me(ee,F);case"D":return _.$D;case"DD":return C.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return me(S.weekdaysMin,_.$W,Y,2);case"ddd":return me(S.weekdaysShort,_.$W,Y,3);case"dddd":return Y[_.$W];case"H":return String(D);case"HH":return C.s(D,2,"0");case"h":return Oe(1);case"hh":return Oe(2);case"a":return ce(D,T,!0);case"A":return ce(D,T,!1);case"m":return String(T);case"mm":return C.s(T,2,"0");case"s":return String(_.$s);case"ss":return C.s(_.$s,2,"0");case"SSS":return C.s(_.$ms,3,"0");case"Z":return w}return null}(W)||w.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(v,_,S){var p,w=this,D=C.p(_),T=$(v),F=(T.utcOffset()-this.utcOffset())*e,Y=this-T,ee=function(){return C.m(w,T)};switch(D){case m:p=ee()/12;break;case l:p=ee();break;case c:p=ee()/3;break;case u:p=(Y-F)/6048e5;break;case o:p=(Y-F)/864e5;break;case s:p=Y/r;break;case a:p=Y/e;break;case i:p=Y/t;break;default:p=Y}return S?p:C.a(p)},b.daysInMonth=function(){return this.endOf(l).$D},b.$locale=function(){return O[this.$L]},b.locale=function(v,_){if(!v)return this.$L;var S=this.clone(),p=P(v,_,!0);return p&&(S.$L=p),S},b.clone=function(){return C.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},E}(),M=U.prototype;return $.prototype=M,[["$ms",n],["$s",i],["$m",a],["$H",s],["$W",o],["$M",l],["$y",m],["$D",f]].forEach(function(E){M[E[1]]=function(b){return this.$g(b,E[0],E[1])}}),$.extend=function(E,b){return E.$i||(E(b,U,$),E.$i=!0),$},$.locale=P,$.isDayjs=j,$.unix=function(E){return $(1e3*E)},$.en=O[I],$.Ls=O,$.p={},$})});var Dt=L((ir,ar)=>{(function(t,e){typeof ir=="object"&&typeof ar<"u"?ar.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(ir,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},o=function(h){return(h=+h)+(h>68?1900:2e3)},u=function(h){return function(g){this[h]=+g}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(h){(this.zone||(this.zone={})).offset=function(g){if(!g||g==="Z")return 0;var k=g.match(/([+-]|\d\d)/g),y=60*k[1]+(+k[2]||0);return y===0?0:k[0]==="+"?-y:y}(h)}],c=function(h){var g=s[h];return g&&(g.indexOf?g:g.s.concat(g.f))},m=function(h,g){var k,y=s.meridiem;if(y){for(var R=1;R<=24;R+=1)if(h.indexOf(y(R,0,g))>-1){k=R>12;break}}else k=h===(g?"pm":"PM");return k},f={A:[a,function(h){this.afternoon=m(h,!1)}],a:[a,function(h){this.afternoon=m(h,!0)}],Q:[r,function(h){this.month=3*(h-1)+1}],S:[r,function(h){this.milliseconds=100*+h}],SS:[n,function(h){this.milliseconds=10*+h}],SSS:[/\d{3}/,function(h){this.milliseconds=+h}],s:[i,u("seconds")],ss:[i,u("seconds")],m:[i,u("minutes")],mm:[i,u("minutes")],H:[i,u("hours")],h:[i,u("hours")],HH:[i,u("hours")],hh:[i,u("hours")],D:[i,u("day")],DD:[n,u("day")],Do:[a,function(h){var g=s.ordinal,k=h.match(/\d+/);if(this.day=k[0],g)for(var y=1;y<=31;y+=1)g(y).replace(/\[|\]/g,"")===h&&(this.day=y)}],w:[i,u("week")],ww:[n,u("week")],M:[i,u("month")],MM:[n,u("month")],MMM:[a,function(h){var g=c("months"),k=(c("monthsShort")||g.map(function(y){return y.slice(0,3)})).indexOf(h)+1;if(k<1)throw new Error;this.month=k%12||k}],MMMM:[a,function(h){var g=c("months").indexOf(h)+1;if(g<1)throw new Error;this.month=g%12||g}],Y:[/[+-]?\d+/,u("year")],YY:[n,function(h){this.year=o(h)}],YYYY:[/\d{4}/,u("year")],Z:l,ZZ:l};function d(h){var g,k;g=h,k=s&&s.formats;for(var y=(h=g.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function($,C,U){var M=U&&U.toUpperCase();return C||k[U]||t[U]||k[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(E,b,v){return b||v.slice(1)})})).match(e),R=y.length,I=0;I<R;I+=1){var O=y[I],x=f[O],j=x&&x[0],P=x&&x[1];y[I]=P?{regex:j,parser:P}:O.replace(/^\[|\]$/g,"")}return function($){for(var C={},U=0,M=0;U<R;U+=1){var E=y[U];if(typeof E=="string")M+=E.length;else{var b=E.regex,v=E.parser,_=$.slice(M),S=b.exec(_)[0];v.call(C,S),$=$.replace(S,"")}}return function(p){var w=p.afternoon;if(w!==void 0){var D=p.hours;w?D<12&&(p.hours+=12):D===12&&(p.hours=0),delete p.afternoon}}(C),C}}return function(h,g,k){k.p.customParseFormat=!0,h&&h.parseTwoDigitYear&&(o=h.parseTwoDigitYear);var y=g.prototype,R=y.parse;y.parse=function(I){var O=I.date,x=I.utc,j=I.args;this.$u=x;var P=j[1];if(typeof P=="string"){var $=j[2]===!0,C=j[3]===!0,U=$||C,M=j[2];C&&(M=j[2]),s=this.$locale(),!$&&M&&(s=k.Ls[M]),this.$d=function(_,S,p,w){try{if(["x","X"].indexOf(S)>-1)return new Date((S==="X"?1e3:1)*_);var D=d(S)(_),T=D.year,F=D.month,Y=D.day,ee=D.hours,be=D.minutes,me=D.seconds,Oe=D.milliseconds,ce=D.zone,W=D.week,se=new Date,pe=Y||(T||F?1:se.getDate()),De=T||se.getFullYear(),St=0;T&&!F||(St=F>0?F-1:se.getMonth());var wt,Zt=ee||0,Kt=be||0,er=me||0,tr=Oe||0;return ce?new Date(Date.UTC(De,St,pe,Zt,Kt,er,tr+60*ce.offset*1e3)):p?new Date(Date.UTC(De,St,pe,Zt,Kt,er,tr)):(wt=new Date(De,St,pe,Zt,Kt,er,tr),W&&(wt=w(wt).week(W).toDate()),wt)}catch{return new Date("")}}(O,P,x,k),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),U&&O!=this.format(P)&&(this.$d=new Date("")),s={}}else if(P instanceof Array)for(var E=P.length,b=1;b<=E;b+=1){j[1]=P[b-1];var v=k.apply(this,j);if(v.isValid()){this.$d=v.$d,this.$L=v.$L,this.init();break}b===E&&(this.$d=new Date(""))}else R.call(this,I)}}})});var _n=L((ec,sr)=>{var Zs=Object.prototype.hasOwnProperty;function bn(t){return"[Throws: "+(t?t.message:"?")+"]"}function Ks(t,e){if(Zs.call(t,e))try{return t[e]}catch(r){return bn(r)}return t[e]}function Dn(t){var e=[];function r(n){if(n===null||typeof n!="object")return n;if(e.indexOf(n)!==-1)return"[Circular]";if(e.push(n),typeof n.toJSON=="function")try{var i=r(n.toJSON());return e.pop(),i}catch(o){return bn(o)}if(Array.isArray(n)){var a=n.map(r);return e.pop(),a}var s=Object.keys(n).reduce(function(o,u){return o[u]=r(Ks(n,u)),o},{});return e.pop(),s}return r(t)}sr.exports=function(t,e,r){return JSON.stringify(Dn(t),e,r)};sr.exports.ensureProperties=Dn});var En=L((tc,Rn)=>{var K=require("fs"),Ke=require("path");Rn.exports=_t;_t.ncp=_t;function _t(t,e,r,n){var i=n;n||(i=r,r={});var a=process.cwd(),s=Ke.resolve(a,t),o=Ke.resolve(a,e),u=r.filter,l=r.rename,c=r.transform,m=r.clobber!==!1,f=r.modified,d=r.dereference,h=null,g=0,k=0,y=0,R=r.limit||_t.limit||16;R=R<1?1:R>512?512:R,I(s);function I(p){if(g++,u){if(u instanceof RegExp){if(!u.test(p))return S(!0)}else if(typeof u=="function"&&!u(p))return S(!0)}return O(p)}function O(p){var w=d?K.stat:K.lstat;if(y>=R)return setImmediate(function(){O(p)});y++,w(p,function(D,T){var F={};if(D)return _(D);if(F.name=p,F.mode=T.mode,F.mtime=T.mtime,F.atime=T.atime,T.isDirectory())return $(F);if(T.isFile())return x(F);if(T.isSymbolicLink())return M(p)})}function x(p){var w=p.name.replace(s,o);l&&(w=l(w)),v(w,function(D){if(D)return j(p,w);if(m&&P(w,function(){j(p,w)}),f){var T=d?K.stat:K.lstat;T(w,function(F,Y){if(p.mtime.getTime()>Y.mtime.getTime())j(p,w);else return S()})}else return S()})}function j(p,w){var D=K.createReadStream(p.name),T=K.createWriteStream(w,{mode:p.mode});D.on("error",_),T.on("error",_),c?c(D,T,p):T.on("open",function(){D.pipe(T)}),T.once("finish",function(){f&&K.utimesSync(w,p.atime,p.mtime),S()})}function P(p,w){K.unlink(p,function(D){return D?_(D):w()})}function $(p){var w=p.name.replace(s,o);v(w,function(D){if(D)return C(p,w);U(p.name)})}function C(p,w){K.mkdir(w,p.mode,function(D){if(D)return _(D);U(p.name)})}function U(p){K.readdir(p,function(w,D){return w?_(w):(D.forEach(function(T){I(Ke.join(p,T))}),S())})}function M(p){var w=p.replace(s,o);K.readlink(p,function(D,T){if(D)return _(D);E(T,w)})}function E(p,w){d&&(p=Ke.resolve(a,p)),v(w,function(D){if(D)return b(p,w);K.readlink(w,function(T,F){return T?_(T):(d&&(F=Ke.resolve(a,F)),F===p?S():P(w,function(){b(p,w)}))})})}function b(p,w){K.symlink(p,w,function(D){return D?_(D):S()})}function v(p,w){K.lstat(p,function(D){return D&&D.code==="ENOENT"?w(!0):w(!1)})}function _(p){return r.stopOnError?i(p):(!h&&r.errs?h=K.createWriteStream(r.errs):h||(h=[]),typeof h.write>"u"?h.push(p):h.write(p.stack+`

`),S())}function S(p){if(p||y--,k++,g===k&&y===0&&i!==void 0)return i(h||null)}}});var An=L((rc,kn)=>{kn.exports=function(t,e){for(var r=[],n=0;n<t.length;n++){var i=e(t[n],n);eo(i)?r.push.apply(r,i):r.push(i)}return r};var eo=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"}});var In=L((nc,Tn)=>{"use strict";Tn.exports=Cn;function Cn(t,e,r){t instanceof RegExp&&(t=On(t,r)),e instanceof RegExp&&(e=On(e,r));var n=Mn(t,e,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+t.length,n[1]),post:r.slice(n[1]+e.length)}}function On(t,e){var r=e.match(t);return r?r[0]:null}Cn.range=Mn;function Mn(t,e,r){var n,i,a,s,o,u=r.indexOf(t),l=r.indexOf(e,u+1),c=u;if(u>=0&&l>0){if(t===e)return[u,l];for(n=[],a=r.length;c>=0&&!o;)c==u?(n.push(c),u=r.indexOf(t,c+1)):n.length==1?o=[n.pop(),l]:(i=n.pop(),i<a&&(a=i,s=l),l=r.indexOf(e,c+1)),c=u<l&&u>=0?u:l;n.length&&(o=[a,s])}return o}});var Un=L((ic,Pn)=>{var to=An(),Ln=In();Pn.exports=io;var xn="\0SLASH"+Math.random()+"\0",$n="\0OPEN"+Math.random()+"\0",ur="\0CLOSE"+Math.random()+"\0",Fn="\0COMMA"+Math.random()+"\0",Nn="\0PERIOD"+Math.random()+"\0";function or(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function ro(t){return t.split("\\\\").join(xn).split("\\{").join($n).split("\\}").join(ur).split("\\,").join(Fn).split("\\.").join(Nn)}function no(t){return t.split(xn).join("\\").split($n).join("{").split(ur).join("}").split(Fn).join(",").split(Nn).join(".")}function qn(t){if(!t)return[""];var e=[],r=Ln("{","}",t);if(!r)return t.split(",");var n=r.pre,i=r.body,a=r.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var o=qn(a);return a.length&&(s[s.length-1]+=o.shift(),s.push.apply(s,o)),e.push.apply(e,s),e}function io(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Ne(ro(t),!0).map(no)):[]}function ao(t){return"{"+t+"}"}function so(t){return/^-?0\d/.test(t)}function oo(t,e){return t<=e}function uo(t,e){return t>=e}function Ne(t,e){var r=[],n=Ln("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=i||a,o=n.body.indexOf(",")>=0;if(!s&&!o)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+ur+n.post,Ne(t)):[t];var u;if(s)u=n.body.split(/\.\./);else if(u=qn(n.body),u.length===1&&(u=Ne(u[0],!1).map(ao),u.length===1)){var c=n.post.length?Ne(n.post,!1):[""];return c.map(function(M){return n.pre+u[0]+M})}var l=n.pre,c=n.post.length?Ne(n.post,!1):[""],m;if(s){var f=or(u[0]),d=or(u[1]),h=Math.max(u[0].length,u[1].length),g=u.length==3?Math.abs(or(u[2])):1,k=oo,y=d<f;y&&(g*=-1,k=uo);var R=u.some(so);m=[];for(var I=f;k(I,d);I+=g){var O;if(a)O=String.fromCharCode(I),O==="\\"&&(O="");else if(O=String(I),R){var x=h-O.length;if(x>0){var j=new Array(x+1).join("0");I<0?O="-"+j+O.slice(1):O=j+O}}m.push(O)}}else m=to(u,function(U){return Ne(U,!1)});for(var P=0;P<m.length;P++)for(var $=0;$<c.length;$++){var C=l+m[P]+c[$];(!e||s||C)&&r.push(C)}return r}});var kt=L((ac,Gn)=>{Gn.exports=re;re.Minimatch=H;var et=function(){try{return require("path")}catch{}}()||{sep:"/"};re.sep=et.sep;var fr=re.GLOBSTAR=H.GLOBSTAR={},lo=Un(),jn={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},lr="[^/]",cr=lr+"*?",co="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",fo="(?:(?!(?:\\/|^)\\.).)*?",Bn=ho("().*{}+?[]^$\\!");function ho(t){return t.split("").reduce(function(e,r){return e[r]=!0,e},{})}var Vn=/\/+/;re.filter=mo;function mo(t,e){return e=e||{},function(r,n,i){return re(r,t,e)}}function _e(t,e){e=e||{};var r={};return Object.keys(t).forEach(function(n){r[n]=t[n]}),Object.keys(e).forEach(function(n){r[n]=e[n]}),r}re.defaults=function(t){if(!t||typeof t!="object"||!Object.keys(t).length)return re;var e=re,r=function(i,a,s){return e(i,a,_e(t,s))};return r.Minimatch=function(i,a){return new e.Minimatch(i,_e(t,a))},r.Minimatch.defaults=function(i){return e.defaults(_e(t,i)).Minimatch},r.filter=function(i,a){return e.filter(i,_e(t,a))},r.defaults=function(i){return e.defaults(_e(t,i))},r.makeRe=function(i,a){return e.makeRe(i,_e(t,a))},r.braceExpand=function(i,a){return e.braceExpand(i,_e(t,a))},r.match=function(n,i,a){return e.match(n,i,_e(t,a))},r};H.defaults=function(t){return re.defaults(t).Minimatch};function re(t,e,r){return Et(e),r||(r={}),!r.nocomment&&e.charAt(0)==="#"?!1:new H(e,r).match(t)}function H(t,e){if(!(this instanceof H))return new H(t,e);Et(t),e||(e={}),t=t.trim(),!e.allowWindowsEscape&&et.sep!=="/"&&(t=t.split(et.sep).join("/")),this.options=e,this.set=[],this.pattern=t,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.make()}H.prototype.debug=function(){};H.prototype.make=po;function po(){var t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate();var r=this.globSet=this.braceExpand();e.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,r),r=this.globParts=r.map(function(n){return n.split(Vn)}),this.debug(this.pattern,r),r=r.map(function(n,i,a){return n.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(n){return n.indexOf(!1)===-1}),this.debug(this.pattern,r),this.set=r}H.prototype.parseNegate=go;function go(){var t=this.pattern,e=!1,r=this.options,n=0;if(!r.nonegate){for(var i=0,a=t.length;i<a&&t.charAt(i)==="!";i++)e=!e,n++;n&&(this.pattern=t.substr(n)),this.negate=e}}re.braceExpand=function(t,e){return Yn(t,e)};H.prototype.braceExpand=Yn;function Yn(t,e){return e||(this instanceof H?e=this.options:e={}),t=typeof t>"u"?this.pattern:t,Et(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:lo(t)}var vo=1024*64,Et=function(t){if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>vo)throw new TypeError("pattern is too long")};H.prototype.parse=yo;var Rt={};function yo(t,e){Et(t);var r=this.options;if(t==="**")if(r.noglobstar)t="*";else return fr;if(t==="")return"";var n="",i=!!r.nocase,a=!1,s=[],o=[],u,l=!1,c=-1,m=-1,f=t.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",d=this;function h(){if(u){switch(u){case"*":n+=cr,i=!0;break;case"?":n+=lr,i=!0;break;default:n+="\\"+u;break}d.debug("clearStateChar %j %j",u,n),u=!1}}for(var g=0,k=t.length,y;g<k&&(y=t.charAt(g));g++){if(this.debug("%s	%s %s %j",t,g,n,y),a&&Bn[y]){n+="\\"+y,a=!1;continue}switch(y){case"/":return!1;case"\\":h(),a=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s	%s %s %j <-- stateChar",t,g,n,y),l){this.debug("  in class"),y==="!"&&g===m+1&&(y="^"),n+=y;continue}d.debug("call clearStateChar %j",u),h(),u=y,r.noext&&h();continue;case"(":if(l){n+="(";continue}if(!u){n+="\\(";continue}s.push({type:u,start:g-1,reStart:n.length,open:jn[u].open,close:jn[u].close}),n+=u==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",u,n),u=!1;continue;case")":if(l||!s.length){n+="\\)";continue}h(),i=!0;var R=s.pop();n+=R.close,R.type==="!"&&o.push(R),R.reEnd=n.length;continue;case"|":if(l||!s.length||a){n+="\\|",a=!1;continue}h(),n+="|";continue;case"[":if(h(),l){n+="\\"+y;continue}l=!0,m=g,c=n.length,n+=y;continue;case"]":if(g===m+1||!l){n+="\\"+y,a=!1;continue}var I=t.substring(m+1,g);try{RegExp("["+I+"]")}catch{var O=this.parse(I,Rt);n=n.substr(0,c)+"\\["+O[0]+"\\]",i=i||O[1],l=!1;continue}i=!0,l=!1,n+=y;continue;default:h(),a?a=!1:Bn[y]&&!(y==="^"&&l)&&(n+="\\"),n+=y}}for(l&&(I=t.substr(m+1),O=this.parse(I,Rt),n=n.substr(0,c)+"\\["+O[0],i=i||O[1]),R=s.pop();R;R=s.pop()){var x=n.slice(R.reStart+R.open.length);this.debug("setting tail",n,R),x=x.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(T,F,Y){return Y||(Y="\\"),F+F+Y+"|"}),this.debug(`tail=%j
   %s`,x,x,R,n);var j=R.type==="*"?cr:R.type==="?"?lr:"\\"+R.type;i=!0,n=n.slice(0,R.reStart)+j+"\\("+x}h(),a&&(n+="\\\\");var P=!1;switch(n.charAt(0)){case"[":case".":case"(":P=!0}for(var $=o.length-1;$>-1;$--){var C=o[$],U=n.slice(0,C.reStart),M=n.slice(C.reStart,C.reEnd-8),E=n.slice(C.reEnd-8,C.reEnd),b=n.slice(C.reEnd);E+=b;var v=U.split("(").length-1,_=b;for(g=0;g<v;g++)_=_.replace(/\)[+*?]?/,"");b=_;var S="";b===""&&e!==Rt&&(S="$");var p=U+M+b+S+E;n=p}if(n!==""&&i&&(n="(?=.)"+n),P&&(n=f+n),e===Rt)return[n,i];if(!i)return wo(t);var w=r.nocase?"i":"";try{var D=new RegExp("^"+n+"$",w)}catch{return new RegExp("$.")}return D._glob=t,D._src=n,D}re.makeRe=function(t,e){return new H(t,e||{}).makeRe()};H.prototype.makeRe=So;function So(){if(this.regexp||this.regexp===!1)return this.regexp;var t=this.set;if(!t.length)return this.regexp=!1,this.regexp;var e=this.options,r=e.noglobstar?cr:e.dot?co:fo,n=e.nocase?"i":"",i=t.map(function(a){return a.map(function(s){return s===fr?r:typeof s=="string"?bo(s):s._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch{this.regexp=!1}return this.regexp}re.match=function(t,e,r){r=r||{};var n=new H(e,r);return t=t.filter(function(i){return n.match(i)}),n.options.nonull&&!t.length&&t.push(e),t};H.prototype.match=function(e,r){if(typeof r>"u"&&(r=this.partial),this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;var n=this.options;et.sep!=="/"&&(e=e.split(et.sep).join("/")),e=e.split(Vn),this.debug(this.pattern,"split",e);var i=this.set;this.debug(this.pattern,"set",i);var a,s;for(s=e.length-1;s>=0&&(a=e[s],!a);s--);for(s=0;s<i.length;s++){var o=i[s],u=e;n.matchBase&&o.length===1&&(u=[a]);var l=this.matchOne(u,o,r);if(l)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate};H.prototype.matchOne=function(t,e,r){var n=this.options;this.debug("matchOne",{this:this,file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var i=0,a=0,s=t.length,o=e.length;i<s&&a<o;i++,a++){this.debug("matchOne loop");var u=e[a],l=t[i];if(this.debug(e,u,l),u===!1)return!1;if(u===fr){this.debug("GLOBSTAR",[e,u,l]);var c=i,m=a+1;if(m===o){for(this.debug("** at the end");i<s;i++)if(t[i]==="."||t[i]===".."||!n.dot&&t[i].charAt(0)===".")return!1;return!0}for(;c<s;){var f=t[c];if(this.debug(`
globstar while`,t,c,e,m,f),this.matchOne(t.slice(c),e.slice(m),r))return this.debug("globstar found match!",c,s,f),!0;if(f==="."||f===".."||!n.dot&&f.charAt(0)==="."){this.debug("dot detected!",t,c,e,m);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(r&&(this.debug(`
>>> no match, partial?`,t,c,e,m),c===s))}var d;if(typeof u=="string"?(d=l===u,this.debug("string match",u,l,d)):(d=l.match(u),this.debug("pattern match",u,l,d)),!d)return!1}if(i===s&&a===o)return!0;if(i===s)return r;if(a===o)return i===s-1&&t[i]==="";throw new Error("wtf?")};function wo(t){return t.replace(/\\(.)/g,"$1")}function bo(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var zn=L((sc,hr)=>{typeof Object.create=="function"?hr.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:hr.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Wn=L((oc,mr)=>{try{if(dr=require("util"),typeof dr.inherits!="function")throw"";mr.exports=dr.inherits}catch{mr.exports=zn()}var dr});var Ot=L((uc,At)=>{"use strict";function Hn(t){return t.charAt(0)==="/"}function Qn(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=e.exec(t),n=r[1]||"",i=!!(n&&n.charAt(1)!==":");return!!(r[2]||i)}At.exports=process.platform==="win32"?Qn:Hn;At.exports.posix=Hn;At.exports.win32=Qn});var vr=L(fe=>{fe.alphasort=Zn;fe.alphasorti=Xn;fe.setopts=ko;fe.ownProp=Jn;fe.makeAbs=gr;fe.finish=Ao;fe.mark=Oo;fe.isIgnored=Kn;fe.childrenIgnored=Co;function Jn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var qe=require("path"),Do=kt(),_o=Ot(),pr=Do.Minimatch;function Xn(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())}function Zn(t,e){return t.localeCompare(e)}function Ro(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(Eo))}function Eo(t){var e=null;if(t.slice(-3)==="/**"){var r=t.replace(/(\/\*\*)+$/,"");e=new pr(r,{dot:!0})}return{matcher:new pr(t,{dot:!0}),gmatcher:e}}function ko(t,e,r){if(r||(r={}),r.matchBase&&e.indexOf("/")===-1){if(r.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}t.silent=!!r.silent,t.pattern=e,t.strict=r.strict!==!1,t.realpath=!!r.realpath,t.realpathCache=r.realpathCache||Object.create(null),t.follow=!!r.follow,t.dot=!!r.dot,t.mark=!!r.mark,t.nodir=!!r.nodir,t.nodir&&(t.mark=!0),t.sync=!!r.sync,t.nounique=!!r.nounique,t.nonull=!!r.nonull,t.nosort=!!r.nosort,t.nocase=!!r.nocase,t.stat=!!r.stat,t.noprocess=!!r.noprocess,t.maxLength=r.maxLength||1/0,t.cache=r.cache||Object.create(null),t.statCache=r.statCache||Object.create(null),t.symlinks=r.symlinks||Object.create(null),Ro(t,r),t.changedCwd=!1;var n=process.cwd();Jn(r,"cwd")?(t.cwd=r.cwd,t.changedCwd=qe.resolve(r.cwd)!==n):t.cwd=n,t.root=r.root||qe.resolve(t.cwd,"/"),t.root=qe.resolve(t.root),process.platform==="win32"&&(t.root=t.root.replace(/\\/g,"/")),t.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,t.minimatch=new pr(e,r),t.options=t.minimatch.options}function Ao(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;n<i;n++){var a=t.matches[n];if(!a||Object.keys(a).length===0){if(t.nonull){var s=t.minimatch.globSet[n];e?r.push(s):r[s]=!0}}else{var o=Object.keys(a);e?r.push.apply(r,o):o.forEach(function(u){r[u]=!0})}}if(e||(r=Object.keys(r)),t.nosort||(r=r.sort(t.nocase?Xn:Zn)),t.mark){for(var n=0;n<r.length;n++)r[n]=t._mark(r[n]);t.nodir&&(r=r.filter(function(u){return!/\/$/.test(u)}))}t.ignore.length&&(r=r.filter(function(u){return!Kn(t,u)})),t.found=r}function Oo(t,e){var r=gr(t,e),n=t.cache[r],i=e;if(n){var a=n==="DIR"||Array.isArray(n),s=e.slice(-1)==="/";if(a&&!s?i+="/":!a&&s&&(i=i.slice(0,-1)),i!==e){var o=gr(t,i);t.statCache[o]=t.statCache[r],t.cache[o]=t.cache[r]}}return i}function gr(t,e){var r=e;return e.charAt(0)==="/"?r=qe.join(t.root,e):_o(e)||e===""?r=e:t.changedCwd?r=qe.resolve(t.cwd,e):r=qe.resolve(e),r}function Kn(t,e){return t.ignore.length?t.ignore.some(function(r){return r.matcher.match(e)||!!(r.gmatcher&&r.gmatcher.match(e))}):!1}function Co(t,e){return t.ignore.length?t.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(e))}):!1}});var ii=L((pc,ni)=>{ni.exports=ri;ri.GlobSync=z;var tt=require("fs"),ei=kt(),cc=ei.Minimatch,fc=wr().Glob,hc=require("util"),yr=require("path"),ti=require("assert"),Ct=Ot(),Re=vr(),dc=Re.alphasort,mc=Re.alphasorti,Mo=Re.setopts,Sr=Re.ownProp,To=Re.childrenIgnored;function ri(t,e){if(typeof e=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);return new z(t,e).found}function z(t,e){if(!t)throw new Error("must provide pattern");if(typeof e=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof z))return new z(t,e);if(Mo(this,t,e),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}z.prototype._finish=function(){if(ti(this instanceof z),this.realpath){var t=this;this.matches.forEach(function(e,r){var n=t.matches[r]=Object.create(null);for(var i in e)try{i=t._makeAbs(i);var a=tt.realpathSync(i,t.realpathCache);n[a]=!0}catch(s){if(s.syscall==="stat")n[t._makeAbs(i)]=!0;else throw s}})}Re.finish(this)};z.prototype._process=function(t,e,r){ti(this instanceof z);for(var n=0;typeof t[n]=="string";)n++;var i;switch(n){case t.length:this._processSimple(t.join("/"),e);return;case 0:i=null;break;default:i=t.slice(0,n).join("/");break}var a=t.slice(n),s;i===null?s=".":((Ct(i)||Ct(t.join("/")))&&(!i||!Ct(i))&&(i="/"+i),s=i);var o=this._makeAbs(s);if(!To(this,s)){var u=a[0]===ei.GLOBSTAR;u?this._processGlobStar(i,s,o,a,e,r):this._processReaddir(i,s,o,a,e,r)}};z.prototype._processReaddir=function(t,e,r,n,i,a){var s=this._readdir(r,a);if(s){for(var o=n[0],u=!!this.minimatch.negate,l=o._glob,c=this.dot||l.charAt(0)===".",m=[],f=0;f<s.length;f++){var d=s[f];if(d.charAt(0)!=="."||c){var h;u&&!t?h=!d.match(o):h=d.match(o),h&&m.push(d)}}var g=m.length;if(g!==0){if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var f=0;f<g;f++){var d=m[f];t&&(t.slice(-1)!=="/"?d=t+"/"+d:d=t+d),d.charAt(0)==="/"&&!this.nomount&&(d=yr.join(this.root,d)),this.matches[i][d]=!0}return}n.shift();for(var f=0;f<g;f++){var d=m[f],k;t?k=[t,d]:k=[d],this._process(k.concat(n),i,a)}}}};z.prototype._emitMatch=function(t,e){var r=this._makeAbs(e);if(this.mark&&(e=this._mark(e)),!this.matches[t][e]){if(this.nodir){var n=this.cache[this._makeAbs(e)];if(n==="DIR"||Array.isArray(n))return}this.matches[t][e]=!0,this.stat&&this._stat(e)}};z.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var e,r,n;try{r=tt.lstatSync(t)}catch{return null}var i=r.isSymbolicLink();return this.symlinks[t]=i,!i&&!r.isDirectory()?this.cache[t]="FILE":e=this._readdir(t,!1),e};z.prototype._readdir=function(t,e){var r;if(e&&!Sr(this.symlinks,t))return this._readdirInGlobStar(t);if(Sr(this.cache,t)){var n=this.cache[t];if(!n||n==="FILE")return null;if(Array.isArray(n))return n}try{return this._readdirEntries(t,tt.readdirSync(t))}catch(i){return this._readdirError(t,i),null}};z.prototype._readdirEntries=function(t,e){if(!this.mark&&!this.stat)for(var r=0;r<e.length;r++){var n=e[r];t==="/"?n=t+n:n=t+"/"+n,this.cache[n]=!0}return this.cache[t]=e,e};z.prototype._readdirError=function(t,e){switch(e.code){case"ENOTSUP":case"ENOTDIR":this.cache[this._makeAbs(t)]="FILE";break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw e;this.silent||console.error("glob error",e);break}};z.prototype._processGlobStar=function(t,e,r,n,i,a){var s=this._readdir(r,a);if(s){var o=n.slice(1),u=t?[t]:[],l=u.concat(o);this._process(l,i,!1);var c=s.length,m=this.symlinks[r];if(!(m&&a))for(var f=0;f<c;f++){var d=s[f];if(!(d.charAt(0)==="."&&!this.dot)){var h=u.concat(s[f],o);this._process(h,i,!0);var g=u.concat(s[f],n);this._process(g,i,!0)}}}};z.prototype._processSimple=function(t,e){var r=this._stat(t);if(this.matches[e]||(this.matches[e]=Object.create(null)),!!r){if(t&&Ct(t)&&!this.nomount){var n=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=yr.join(this.root,t):(t=yr.resolve(this.root,t),n&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this.matches[e][t]=!0}};z.prototype._stat=function(t){var e=this._makeAbs(t),r=t.slice(-1)==="/";if(t.length>this.maxLength)return!1;if(!this.stat&&Sr(this.cache,e)){var s=this.cache[e];if(Array.isArray(s)&&(s="DIR"),!r||s==="DIR")return s;if(r&&s==="FILE")return!1}var n,i=this.statCache[e];if(!i){var a;try{a=tt.lstatSync(e)}catch{return!1}if(a.isSymbolicLink())try{i=tt.statSync(e)}catch{i=a}else i=a}this.statCache[e]=i;var s=i.isDirectory()?"DIR":"FILE";return this.cache[e]=this.cache[e]||s,r&&s!=="DIR"?!1:s};z.prototype._mark=function(t){return Re.mark(this,t)};z.prototype._makeAbs=function(t){return Re.makeAbs(this,t)}});var br=L((gc,si)=>{si.exports=ai;function ai(t,e){if(t&&e)return ai(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(n){r[n]=t[n]}),r;function r(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var a=t.apply(this,n),s=n[n.length-1];return typeof a=="function"&&a!==s&&Object.keys(s).forEach(function(o){a[o]=s[o]}),a}}});var _r=L((vc,Dr)=>{var oi=br();Dr.exports=oi(Mt);Dr.exports.strict=oi(ui);Mt.proto=Mt(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Mt(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return ui(this)},configurable:!0})});function Mt(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function ui(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}});var ci=L((yc,li)=>{var Io=br(),rt=Object.create(null),Lo=_r();li.exports=Io(xo);function xo(t,e){return rt[t]?(rt[t].push(e),null):(rt[t]=[e],$o(t))}function $o(t){return Lo(function e(){var r=rt[t],n=r.length,i=Fo(arguments);try{for(var a=0;a<n;a++)r[a].apply(null,i)}finally{r.length>n?(r.splice(0,n),process.nextTick(function(){e.apply(null,i)})):delete rt[t]}})}function Fo(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n]=t[n];return r}});var wr=L((_c,hi)=>{hi.exports=Ce;var nt=require("fs"),fi=kt(),Sc=fi.Minimatch,No=Wn(),qo=require("events").EventEmitter,Rr=require("path"),Er=require("assert"),Tt=Ot(),Ar=ii(),ge=vr(),wc=ge.alphasort,bc=ge.alphasorti,Po=ge.setopts,kr=ge.ownProp,Or=ci(),Dc=require("util"),Uo=ge.childrenIgnored,jo=ge.isIgnored,Bo=_r();function Ce(t,e,r){if(typeof e=="function"&&(r=e,e={}),e||(e={}),e.sync){if(r)throw new TypeError("callback provided to sync glob");return Ar(t,e)}return new q(t,e,r)}Ce.sync=Ar;var Vo=Ce.GlobSync=Ar.GlobSync;Ce.glob=Ce;function Yo(t,e){if(e===null||typeof e!="object")return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}Ce.hasMagic=function(t,e){var r=Yo({},e);r.noprocess=!0;var n=new q(t,r),i=n.minimatch.set;if(i.length>1)return!0;for(var a=0;a<i[0].length;a++)if(typeof i[0][a]!="string")return!0;return!1};Ce.Glob=q;No(q,qo);function q(t,e,r){if(typeof e=="function"&&(r=e,e=null),e&&e.sync){if(r)throw new TypeError("callback provided to sync glob");return new Vo(t,e)}if(!(this instanceof q))return new q(t,e,r);Po(this,t,e),this._didRealPath=!1;var i=this.minimatch.set.length;this.matches=new Array(i),typeof r=="function"&&(r=Bo(r),this.on("error",r),this.on("end",function(o){r(null,o)}));var n=this,i=this.minimatch.set.length;if(this._processing=0,this.matches=new Array(i),this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(i===0)return s();for(var a=0;a<i;a++)this._process(this.minimatch.set[a],a,!1,s);function s(){--n._processing,n._processing<=0&&n._finish()}}q.prototype._finish=function(){if(Er(this instanceof q),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();ge.finish(this),this.emit("end",this.found)}};q.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var t=this.matches.length;if(t===0)return this._finish();for(var e=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n);function n(){--t===0&&e._finish()}};q.prototype._realpathSet=function(t,e){var r=this.matches[t];if(!r)return e();var n=Object.keys(r),i=this,a=n.length;if(a===0)return e();var s=this.matches[t]=Object.create(null);n.forEach(function(o,u){o=i._makeAbs(o),nt.realpath(o,i.realpathCache,function(l,c){l?l.syscall==="stat"?s[o]=!0:i.emit("error",l):s[c]=!0,--a===0&&(i.matches[t]=s,e())})})};q.prototype._mark=function(t){return ge.mark(this,t)};q.prototype._makeAbs=function(t){return ge.makeAbs(this,t)};q.prototype.abort=function(){this.aborted=!0,this.emit("abort")};q.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};q.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var e=0;e<t.length;e++){var r=t[e];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var e=0;e<n.length;e++){var i=n[e];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}};q.prototype._process=function(t,e,r,n){if(Er(this instanceof q),Er(typeof n=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([t,e,r,n]);return}for(var i=0;typeof t[i]=="string";)i++;var a;switch(i){case t.length:this._processSimple(t.join("/"),e,n);return;case 0:a=null;break;default:a=t.slice(0,i).join("/");break}var s=t.slice(i),o;a===null?o=".":((Tt(a)||Tt(t.join("/")))&&(!a||!Tt(a))&&(a="/"+a),o=a);var u=this._makeAbs(o);if(Uo(this,o))return n();var l=s[0]===fi.GLOBSTAR;l?this._processGlobStar(a,o,u,s,e,r,n):this._processReaddir(a,o,u,s,e,r,n)}};q.prototype._processReaddir=function(t,e,r,n,i,a,s){var o=this;this._readdir(r,a,function(u,l){return o._processReaddir2(t,e,r,n,i,a,l,s)})};q.prototype._processReaddir2=function(t,e,r,n,i,a,s,o){if(!s)return o();for(var u=n[0],l=!!this.minimatch.negate,c=u._glob,m=this.dot||c.charAt(0)===".",f=[],d=0;d<s.length;d++){var h=s[d];if(h.charAt(0)!=="."||m){var g;l&&!t?g=!h.match(u):g=h.match(u),g&&f.push(h)}}var k=f.length;if(k===0)return o();if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var d=0;d<k;d++){var h=f[d];t&&(t!=="/"?h=t+"/"+h:h=t+h),h.charAt(0)==="/"&&!this.nomount&&(h=Rr.join(this.root,h)),this._emitMatch(i,h)}return o()}n.shift();for(var d=0;d<k;d++){var h=f[d],y;t&&(t!=="/"?h=t+"/"+h:h=t+h),this._process([h].concat(n),i,a,o)}o()};q.prototype._emitMatch=function(t,e){if(!this.aborted&&!this.matches[t][e]&&!jo(this,e)){if(this.paused){this._emitQueue.push([t,e]);return}var r=this._makeAbs(e);if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.mark&&(e=this._mark(e)),this.matches[t][e]=!0;var i=this.statCache[r];i&&this.emit("stat",e,i),this.emit("match",e)}};q.prototype._readdirInGlobStar=function(t,e){if(this.aborted)return;if(this.follow)return this._readdir(t,!1,e);var r="lstat\0"+t,n=this,i=Or(r,a);i&&nt.lstat(t,i);function a(s,o){if(s)return e();var u=o.isSymbolicLink();n.symlinks[t]=u,!u&&!o.isDirectory()?(n.cache[t]="FILE",e()):n._readdir(t,!1,e)}};q.prototype._readdir=function(t,e,r){if(!this.aborted&&(r=Or("readdir\0"+t+"\0"+e,r),!!r)){if(e&&!kr(this.symlinks,t))return this._readdirInGlobStar(t,r);if(kr(this.cache,t)){var n=this.cache[t];if(!n||n==="FILE")return r();if(Array.isArray(n))return r(null,n)}var i=this;nt.readdir(t,Go(this,t,r))}};function Go(t,e,r){return function(n,i){n?t._readdirError(e,n,r):t._readdirEntries(e,i,r)}}q.prototype._readdirEntries=function(t,e,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<e.length;n++){var i=e[n];t==="/"?i=t+i:i=t+"/"+i,this.cache[i]=!0}return this.cache[t]=e,r(null,e)}};q.prototype._readdirError=function(t,e,r){if(!this.aborted){switch(e.code){case"ENOTSUP":case"ENOTDIR":this.cache[this._makeAbs(t)]="FILE";break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",e),this.abort()),this.silent||console.error("glob error",e);break}return r()}};q.prototype._processGlobStar=function(t,e,r,n,i,a,s){var o=this;this._readdir(r,a,function(u,l){o._processGlobStar2(t,e,r,n,i,a,l,s)})};q.prototype._processGlobStar2=function(t,e,r,n,i,a,s,o){if(!s)return o();var u=n.slice(1),l=t?[t]:[],c=l.concat(u);this._process(c,i,!1,o);var m=this.symlinks[r],f=s.length;if(m&&a)return o();for(var d=0;d<f;d++){var h=s[d];if(!(h.charAt(0)==="."&&!this.dot)){var g=l.concat(s[d],u);this._process(g,i,!0,o);var k=l.concat(s[d],n);this._process(k,i,!0,o)}}o()};q.prototype._processSimple=function(t,e,r){var n=this;this._stat(t,function(i,a){n._processSimple2(t,e,i,a,r)})};q.prototype._processSimple2=function(t,e,r,n,i){if(this.matches[e]||(this.matches[e]=Object.create(null)),!n)return i();if(t&&Tt(t)&&!this.nomount){var a=/[\/\\]$/.test(t);t.charAt(0)==="/"?t=Rr.join(this.root,t):(t=Rr.resolve(this.root,t),a&&(t+="/"))}process.platform==="win32"&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t),i()};q.prototype._stat=function(t,e){var r=this._makeAbs(t),n=t.slice(-1)==="/";if(t.length>this.maxLength)return e();if(!this.stat&&kr(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||i==="DIR")return e(null,i);if(n&&i==="FILE")return e()}var a,s=this.statCache[r];if(s!==void 0){if(s===!1)return e(null,s);var o=s.isDirectory()?"DIR":"FILE";return n&&o==="FILE"?e():e(null,o,s)}var u=this,l=Or("stat\0"+r,c);l&&nt.lstat(r,l);function c(m,f){if(f&&f.isSymbolicLink())return nt.stat(r,function(d,h){d?u._stat2(t,r,null,f,e):u._stat2(t,r,d,h,e)});u._stat2(t,r,m,f,e)}};q.prototype._stat2=function(t,e,r,n,i){if(r)return this.statCache[e]=!1,i();var a=t.slice(-1)==="/";if(this.statCache[e]=n,e.slice(-1)==="/"&&!n.isDirectory())return i(null,!1,n);var s=n.isDirectory()?"DIR":"FILE";return this.cache[e]=this.cache[e]||s,a&&s!=="DIR"?i():i(null,s,n)}});var yi=L((Rc,vi)=>{vi.exports=Ir;Ir.sync=gi;var N=require("assert"),di=require("path"),xt=require("fs"),$t=wr(),mi={nosort:!0,nocomment:!0,nonegate:!0,silent:!0},Cr=0,Tr=process.platform==="win32";function pi(t){var e=["unlink","chmod","stat","lstat","rmdir","readdir"];e.forEach(function(r){t[r]=t[r]||xt[r],r=r+"Sync",t[r]=t[r]||xt[r]}),t.maxBusyTries=t.maxBusyTries||3,t.emfileWait=t.emfileWait||1e3,t.disableGlob=t.disableGlob||!1}function Ir(t,e,r){typeof e=="function"&&(r=e,e={}),N(t,"rimraf: missing path"),N.equal(typeof t,"string","rimraf: path should be a string"),N(e,"rimraf: missing options"),N.equal(typeof e,"object","rimraf: options should be object"),N.equal(typeof r,"function","rimraf: callback function required"),pi(e);var n=0,i=null,a=0;if(e.disableGlob||!$t.hasMagic(t))return o(null,[t]);xt.lstat(t,function(u,l){if(!u)return o(null,[t]);$t(t,mi,o)});function s(u){i=i||u,--a===0&&r(i)}function o(u,l){if(u)return r(u);if(a=l.length,a===0)return r();l.forEach(function(c){Mr(c,e,function m(f){if(f){if(Tr&&(f.code==="EBUSY"||f.code==="ENOTEMPTY"||f.code==="EPERM")&&n<e.maxBusyTries){n++;var d=n*100;return setTimeout(function(){Mr(c,e,m)},d)}if(f.code==="EMFILE"&&Cr<e.emfileWait)return setTimeout(function(){Mr(c,e,m)},Cr++);f.code==="ENOENT"&&(f=null)}Cr=0,s(f)})})}}function Mr(t,e,r){N(t),N(e),N(typeof r=="function"),e.lstat(t,function(n,i){if(n&&n.code==="ENOENT")return r(null);if(i&&i.isDirectory())return It(t,e,n,r);e.unlink(t,function(a){if(a){if(a.code==="ENOENT")return r(null);if(a.code==="EPERM")return Tr?zo(t,e,a,r):It(t,e,a,r);if(a.code==="EISDIR")return It(t,e,a,r)}return r(a)})})}function zo(t,e,r,n){N(t),N(e),N(typeof n=="function"),r&&N(r instanceof Error),e.chmod(t,666,function(i){i?n(i.code==="ENOENT"?null:r):e.stat(t,function(a,s){a?n(a.code==="ENOENT"?null:r):s.isDirectory()?It(t,e,r,n):e.unlink(t,n)})})}function Wo(t,e,r){N(t),N(e),r&&N(r instanceof Error);try{e.chmodSync(t,666)}catch(i){if(i.code==="ENOENT")return;throw r}try{var n=e.statSync(t)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?Lt(t,e,r):e.unlinkSync(t)}function It(t,e,r,n){N(t),N(e),r&&N(r instanceof Error),N(typeof n=="function"),e.rmdir(t,function(i){i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?Ho(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function Ho(t,e,r){N(t),N(e),N(typeof r=="function"),e.readdir(t,function(n,i){if(n)return r(n);var a=i.length;if(a===0)return e.rmdir(t,r);var s;i.forEach(function(o){Ir(di.join(t,o),e,function(u){if(!s){if(u)return r(s=u);--a===0&&e.rmdir(t,r)}})})})}function gi(t,e){e=e||{},pi(e),N(t,"rimraf: missing path"),N.equal(typeof t,"string","rimraf: path should be a string"),N(e,"rimraf: missing options"),N.equal(typeof e,"object","rimraf: options should be object");var r;if(e.disableGlob||!$t.hasMagic(t))r=[t];else try{xt.lstatSync(t),r=[t]}catch{r=$t.sync(t,mi)}if(r.length)for(var n=0;n<r.length;n++){var t=r[n];try{var i=e.lstatSync(t)}catch(s){if(s.code==="ENOENT")return}try{i&&i.isDirectory()?Lt(t,e,null):e.unlinkSync(t)}catch(s){if(s.code==="ENOENT")return;if(s.code==="EPERM")return Tr?Wo(t,e,s):Lt(t,e,s);if(s.code!=="EISDIR")throw s;Lt(t,e,s)}}}function Lt(t,e,r){N(t),N(e),r&&N(r instanceof Error);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="ENOTDIR")throw r;(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")&&Qo(t,e)}}function Qo(t,e){N(t),N(e),e.readdirSync(t).forEach(function(r){gi(di.join(t,r),e)}),e.rmdirSync(t,e)}});var Di=L((Ec,bi)=>{var it=require("path"),Si=require("fs"),wi=parseInt("0777",8);bi.exports=Pe.mkdirp=Pe.mkdirP=Pe;function Pe(t,e,r,n){typeof e=="function"?(r=e,e={}):(!e||typeof e!="object")&&(e={mode:e});var i=e.mode,a=e.fs||Si;i===void 0&&(i=wi),n||(n=null);var s=r||function(){};t=it.resolve(t),a.mkdir(t,i,function(o){if(!o)return n=n||t,s(null,n);switch(o.code){case"ENOENT":if(it.dirname(t)===t)return s(o);Pe(it.dirname(t),e,function(u,l){u?s(u,l):Pe(t,e,s,l)});break;default:a.stat(t,function(u,l){u||!l.isDirectory()?s(o,n):s(null,n)});break}})}Pe.sync=function t(e,r,n){(!r||typeof r!="object")&&(r={mode:r});var i=r.mode,a=r.fs||Si;i===void 0&&(i=wi),n||(n=null),e=it.resolve(e);try{a.mkdirSync(e,i),n=n||e}catch(o){switch(o.code){case"ENOENT":n=t(it.dirname(e),r,n),t(e,r,n);break;default:var s;try{s=a.statSync(e)}catch{throw o}if(!s.isDirectory())throw o;break}}return n}});var Ai=L((kc,ki)=>{var Ue=require("fs"),Jo=En().ncp,Xo=require("path"),_i=yi(),Zo=Di();ki.exports=Ko;function Ko(t,e,r,n){typeof r=="function"&&(n=r,r={});var i=!!r.mkdirp,a=r.clobber!==!1,s=r.limit||16;i?o():u();function o(){Zo(Xo.dirname(e),function(l){if(l)return n(l);u()})}function u(){a?Ue.rename(t,e,function(l){if(!l)return n();if(l.code!=="EXDEV")return n(l);Ri(t,e,a,s,n)}):Ue.link(t,e,function(l){if(l){if(l.code==="EXDEV"){Ri(t,e,a,s,n);return}if(l.code==="EISDIR"||l.code==="EPERM"){Ei(t,e,a,s,n);return}n(l);return}Ue.unlink(t,n)})}}function Ri(t,e,r,n,i){var a=r?"w":"wx",s=Ue.createReadStream(t),o=Ue.createWriteStream(e,{flags:a});s.on("error",function(l){s.destroy(),o.destroy(),o.removeListener("close",u),l.code==="EISDIR"||l.code==="EPERM"?Ei(t,e,r,n,i):i(l)}),o.on("error",function(l){s.destroy(),o.destroy(),o.removeListener("close",u),i(l)}),o.once("close",u),s.pipe(o);function u(){Ue.unlink(t,i)}}function Ei(t,e,r,n,i){var a={stopOnErr:!0,clobber:!1,limit:n};r?_i(e,{disableGlob:!0},function(o){if(o)return i(o);s()}):s();function s(){Jo(t,e,a,function(o){if(o)return i(o[0]);_i(t,{disableGlob:!0},i)})}}});var Ci=L(Lr=>{var Oi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Lr.encode=function(t){if(0<=t&&t<Oi.length)return Oi[t];throw new TypeError("Must be between 0 and 63: "+t)};Lr.decode=function(t){var e=65,r=90,n=97,i=122,a=48,s=57,o=43,u=47,l=26,c=52;return e<=t&&t<=r?t-e:n<=t&&t<=i?t-n+l:a<=t&&t<=s?t-a+c:t==o?62:t==u?63:-1}});var Fr=L($r=>{var Mi=Ci(),xr=5,Ti=1<<xr,Ii=Ti-1,Li=Ti;function eu(t){return t<0?(-t<<1)+1:(t<<1)+0}function tu(t){var e=(t&1)===1,r=t>>1;return e?-r:r}$r.encode=function(e){var r="",n,i=eu(e);do n=i&Ii,i>>>=xr,i>0&&(n|=Li),r+=Mi.encode(n);while(i>0);return r};$r.decode=function(e,r,n){var i=e.length,a=0,s=0,o,u;do{if(r>=i)throw new Error("Expected more digits in base 64 VLQ value.");if(u=Mi.decode(e.charCodeAt(r++)),u===-1)throw new Error("Invalid base64 digit: "+e.charAt(r-1));o=!!(u&Li),u&=Ii,a=a+(u<<s),s+=xr}while(o);n.value=tu(a),n.rest=r}});var Ve=L(Z=>{function ru(t,e,r){if(e in t)return t[e];if(arguments.length===3)return r;throw new Error('"'+e+'" is a required argument.')}Z.getArg=ru;var xi=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,nu=/^data:.+\,.+$/;function at(t){var e=t.match(xi);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}Z.urlParse=at;function je(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}Z.urlGenerate=je;function Nr(t){var e=t,r=at(t);if(r){if(!r.path)return t;e=r.path}for(var n=Z.isAbsolute(e),i=e.split(/\/+/),a,s=0,o=i.length-1;o>=0;o--)a=i[o],a==="."?i.splice(o,1):a===".."?s++:s>0&&(a===""?(i.splice(o+1,s),s=0):(i.splice(o,2),s--));return e=i.join("/"),e===""&&(e=n?"/":"."),r?(r.path=e,je(r)):e}Z.normalize=Nr;function $i(t,e){t===""&&(t="."),e===""&&(e=".");var r=at(e),n=at(t);if(n&&(t=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),je(r);if(r||e.match(nu))return e;if(n&&!n.host&&!n.path)return n.host=e,je(n);var i=e.charAt(0)==="/"?e:Nr(t.replace(/\/+$/,"")+"/"+e);return n?(n.path=i,je(n)):i}Z.join=$i;Z.isAbsolute=function(t){return t.charAt(0)==="/"||xi.test(t)};function iu(t,e){t===""&&(t="."),t=t.replace(/\/$/,"");for(var r=0;e.indexOf(t+"/")!==0;){var n=t.lastIndexOf("/");if(n<0||(t=t.slice(0,n),t.match(/^([^\/]+:\/)?\/*$/)))return e;++r}return Array(r+1).join("../")+e.substr(t.length+1)}Z.relative=iu;var Fi=function(){var t=Object.create(null);return!("__proto__"in t)}();function Ni(t){return t}function au(t){return qi(t)?"$"+t:t}Z.toSetString=Fi?Ni:au;function su(t){return qi(t)?t.slice(1):t}Z.fromSetString=Fi?Ni:su;function qi(t){if(!t)return!1;var e=t.length;if(e<9||t.charCodeAt(e-1)!==95||t.charCodeAt(e-2)!==95||t.charCodeAt(e-3)!==111||t.charCodeAt(e-4)!==116||t.charCodeAt(e-5)!==111||t.charCodeAt(e-6)!==114||t.charCodeAt(e-7)!==112||t.charCodeAt(e-8)!==95||t.charCodeAt(e-9)!==95)return!1;for(var r=e-10;r>=0;r--)if(t.charCodeAt(r)!==36)return!1;return!0}function ou(t,e,r){var n=Be(t.source,e.source);return n!==0||(n=t.originalLine-e.originalLine,n!==0)||(n=t.originalColumn-e.originalColumn,n!==0||r)||(n=t.generatedColumn-e.generatedColumn,n!==0)||(n=t.generatedLine-e.generatedLine,n!==0)?n:Be(t.name,e.name)}Z.compareByOriginalPositions=ou;function uu(t,e,r){var n=t.generatedLine-e.generatedLine;return n!==0||(n=t.generatedColumn-e.generatedColumn,n!==0||r)||(n=Be(t.source,e.source),n!==0)||(n=t.originalLine-e.originalLine,n!==0)||(n=t.originalColumn-e.originalColumn,n!==0)?n:Be(t.name,e.name)}Z.compareByGeneratedPositionsDeflated=uu;function Be(t,e){return t===e?0:t===null?1:e===null?-1:t>e?1:-1}function lu(t,e){var r=t.generatedLine-e.generatedLine;return r!==0||(r=t.generatedColumn-e.generatedColumn,r!==0)||(r=Be(t.source,e.source),r!==0)||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0)?r:Be(t.name,e.name)}Z.compareByGeneratedPositionsInflated=lu;function cu(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))}Z.parseSourceMapInput=cu;function fu(t,e,r){if(e=e||"",t&&(t[t.length-1]!=="/"&&e[0]!=="/"&&(t+="/"),e=t+e),r){var n=at(r);if(!n)throw new Error("sourceMapURL could not be parsed");if(n.path){var i=n.path.lastIndexOf("/");i>=0&&(n.path=n.path.substring(0,i+1))}e=$i(je(n),e)}return Nr(e)}Z.computeSourceURL=fu});var Ur=L(Pi=>{var qr=Ve(),Pr=Object.prototype.hasOwnProperty,Me=typeof Map<"u";function ve(){this._array=[],this._set=Me?new Map:Object.create(null)}ve.fromArray=function(e,r){for(var n=new ve,i=0,a=e.length;i<a;i++)n.add(e[i],r);return n};ve.prototype.size=function(){return Me?this._set.size:Object.getOwnPropertyNames(this._set).length};ve.prototype.add=function(e,r){var n=Me?e:qr.toSetString(e),i=Me?this.has(e):Pr.call(this._set,n),a=this._array.length;(!i||r)&&this._array.push(e),i||(Me?this._set.set(e,a):this._set[n]=a)};ve.prototype.has=function(e){if(Me)return this._set.has(e);var r=qr.toSetString(e);return Pr.call(this._set,r)};ve.prototype.indexOf=function(e){if(Me){var r=this._set.get(e);if(r>=0)return r}else{var n=qr.toSetString(e);if(Pr.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')};ve.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)};ve.prototype.toArray=function(){return this._array.slice()};Pi.ArraySet=ve});var Bi=L(ji=>{var Ui=Ve();function hu(t,e){var r=t.generatedLine,n=e.generatedLine,i=t.generatedColumn,a=e.generatedColumn;return n>r||n==r&&a>=i||Ui.compareByGeneratedPositionsInflated(t,e)<=0}function Ft(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}Ft.prototype.unsortedForEach=function(e,r){this._array.forEach(e,r)};Ft.prototype.add=function(e){hu(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};Ft.prototype.toArray=function(){return this._sorted||(this._array.sort(Ui.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};ji.MappingList=Ft});var jr=L(Vi=>{var st=Fr(),G=Ve(),Nt=Ur().ArraySet,du=Bi().MappingList;function oe(t){t||(t={}),this._file=G.getArg(t,"file",null),this._sourceRoot=G.getArg(t,"sourceRoot",null),this._skipValidation=G.getArg(t,"skipValidation",!1),this._sources=new Nt,this._names=new Nt,this._mappings=new du,this._sourcesContents=null}oe.prototype._version=3;oe.fromSourceMap=function(e){var r=e.sourceRoot,n=new oe({file:e.file,sourceRoot:r});return e.eachMapping(function(i){var a={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(a.source=i.source,r!=null&&(a.source=G.relative(r,a.source)),a.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(a.name=i.name)),n.addMapping(a)}),e.sources.forEach(function(i){var a=i;r!==null&&(a=G.relative(r,i)),n._sources.has(a)||n._sources.add(a);var s=e.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n};oe.prototype.addMapping=function(e){var r=G.getArg(e,"generated"),n=G.getArg(e,"original",null),i=G.getArg(e,"source",null),a=G.getArg(e,"name",null);this._skipValidation||this._validateMapping(r,n,i,a),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:i,name:a})};oe.prototype.setSourceContent=function(e,r){var n=e;this._sourceRoot!=null&&(n=G.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[G.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[G.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};oe.prototype.applySourceMap=function(e,r,n){var i=r;if(r==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=e.file}var a=this._sourceRoot;a!=null&&(i=G.relative(a,i));var s=new Nt,o=new Nt;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){var l=e.originalPositionFor({line:u.originalLine,column:u.originalColumn});l.source!=null&&(u.source=l.source,n!=null&&(u.source=G.join(n,u.source)),a!=null&&(u.source=G.relative(a,u.source)),u.originalLine=l.line,u.originalColumn=l.column,l.name!=null&&(u.name=l.name))}var c=u.source;c!=null&&!s.has(c)&&s.add(c);var m=u.name;m!=null&&!o.has(m)&&o.add(m)},this),this._sources=s,this._names=o,e.sources.forEach(function(u){var l=e.sourceContentFor(u);l!=null&&(n!=null&&(u=G.join(n,u)),a!=null&&(u=G.relative(a,u)),this.setSourceContent(u,l))},this)};oe.prototype._validateMapping=function(e,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!n&&!i)){if(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:r,name:i}))}};oe.prototype._serializeMappings=function(){for(var e=0,r=1,n=0,i=0,a=0,s=0,o="",u,l,c,m,f=this._mappings.toArray(),d=0,h=f.length;d<h;d++){if(l=f[d],u="",l.generatedLine!==r)for(e=0;l.generatedLine!==r;)u+=";",r++;else if(d>0){if(!G.compareByGeneratedPositionsInflated(l,f[d-1]))continue;u+=","}u+=st.encode(l.generatedColumn-e),e=l.generatedColumn,l.source!=null&&(m=this._sources.indexOf(l.source),u+=st.encode(m-s),s=m,u+=st.encode(l.originalLine-1-i),i=l.originalLine-1,u+=st.encode(l.originalColumn-n),n=l.originalColumn,l.name!=null&&(c=this._names.indexOf(l.name),u+=st.encode(c-a),a=c)),o+=u}return o};oe.prototype._generateSourcesContent=function(e,r){return e.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=G.relative(r,n));var i=G.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)};oe.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e};oe.prototype.toString=function(){return JSON.stringify(this.toJSON())};Vi.SourceMapGenerator=oe});var Yi=L(Te=>{Te.GREATEST_LOWER_BOUND=1;Te.LEAST_UPPER_BOUND=2;function Br(t,e,r,n,i,a){var s=Math.floor((e-t)/2)+t,o=i(r,n[s],!0);return o===0?s:o>0?e-s>1?Br(s,e,r,n,i,a):a==Te.LEAST_UPPER_BOUND?e<n.length?e:-1:s:s-t>1?Br(t,s,r,n,i,a):a==Te.LEAST_UPPER_BOUND?s:t<0?-1:t}Te.search=function(e,r,n,i){if(r.length===0)return-1;var a=Br(-1,r.length,e,r,n,i||Te.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&n(r[a],r[a-1],!0)===0;)--a;return a}});var zi=L(Gi=>{function Vr(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function mu(t,e){return Math.round(t+Math.random()*(e-t))}function Yr(t,e,r,n){if(r<n){var i=mu(r,n),a=r-1;Vr(t,i,n);for(var s=t[n],o=r;o<n;o++)e(t[o],s)<=0&&(a+=1,Vr(t,a,o));Vr(t,a+1,o);var u=a+1;Yr(t,e,r,u-1),Yr(t,e,u+1,n)}}Gi.quickSort=function(t,e){Yr(t,e,0,t.length-1)}});var Hi=L(qt=>{var A=Ve(),Gr=Yi(),Ye=Ur().ArraySet,pu=Fr(),ot=zi().quickSort;function B(t,e){var r=t;return typeof t=="string"&&(r=A.parseSourceMapInput(t)),r.sections!=null?new le(r,e):new Q(r,e)}B.fromSourceMap=function(t,e){return Q.fromSourceMap(t,e)};B.prototype._version=3;B.prototype.__generatedMappings=null;Object.defineProperty(B.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});B.prototype.__originalMappings=null;Object.defineProperty(B.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});B.prototype._charIsMappingSeparator=function(e,r){var n=e.charAt(r);return n===";"||n===","};B.prototype._parseMappings=function(e,r){throw new Error("Subclasses must implement _parseMappings")};B.GENERATED_ORDER=1;B.ORIGINAL_ORDER=2;B.GREATEST_LOWER_BOUND=1;B.LEAST_UPPER_BOUND=2;B.prototype.eachMapping=function(e,r,n){var i=r||null,a=n||B.GENERATED_ORDER,s;switch(a){case B.GENERATED_ORDER:s=this._generatedMappings;break;case B.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var o=this.sourceRoot;s.map(function(u){var l=u.source===null?null:this._sources.at(u.source);return l=A.computeSourceURL(o,l,this._sourceMapURL),{source:l,generatedLine:u.generatedLine,generatedColumn:u.generatedColumn,originalLine:u.originalLine,originalColumn:u.originalColumn,name:u.name===null?null:this._names.at(u.name)}},this).forEach(e,i)};B.prototype.allGeneratedPositionsFor=function(e){var r=A.getArg(e,"line"),n={source:A.getArg(e,"source"),originalLine:r,originalColumn:A.getArg(e,"column",0)};if(n.source=this._findSourceIndex(n.source),n.source<0)return[];var i=[],a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",A.compareByOriginalPositions,Gr.LEAST_UPPER_BOUND);if(a>=0){var s=this._originalMappings[a];if(e.column===void 0)for(var o=s.originalLine;s&&s.originalLine===o;)i.push({line:A.getArg(s,"generatedLine",null),column:A.getArg(s,"generatedColumn",null),lastColumn:A.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var u=s.originalColumn;s&&s.originalLine===r&&s.originalColumn==u;)i.push({line:A.getArg(s,"generatedLine",null),column:A.getArg(s,"generatedColumn",null),lastColumn:A.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return i};qt.SourceMapConsumer=B;function Q(t,e){var r=t;typeof t=="string"&&(r=A.parseSourceMapInput(t));var n=A.getArg(r,"version"),i=A.getArg(r,"sources"),a=A.getArg(r,"names",[]),s=A.getArg(r,"sourceRoot",null),o=A.getArg(r,"sourcesContent",null),u=A.getArg(r,"mappings"),l=A.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);s&&(s=A.normalize(s)),i=i.map(String).map(A.normalize).map(function(c){return s&&A.isAbsolute(s)&&A.isAbsolute(c)?A.relative(s,c):c}),this._names=Ye.fromArray(a.map(String),!0),this._sources=Ye.fromArray(i,!0),this._absoluteSources=this._sources.toArray().map(function(c){return A.computeSourceURL(s,c,e)}),this.sourceRoot=s,this.sourcesContent=o,this._mappings=u,this._sourceMapURL=e,this.file=l}Q.prototype=Object.create(B.prototype);Q.prototype.consumer=B;Q.prototype._findSourceIndex=function(t){var e=t;if(this.sourceRoot!=null&&(e=A.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var r;for(r=0;r<this._absoluteSources.length;++r)if(this._absoluteSources[r]==t)return r;return-1};Q.fromSourceMap=function(e,r){var n=Object.create(Q.prototype),i=n._names=Ye.fromArray(e._names.toArray(),!0),a=n._sources=Ye.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file,n._sourceMapURL=r,n._absoluteSources=n._sources.toArray().map(function(d){return A.computeSourceURL(n.sourceRoot,d,r)});for(var s=e._mappings.toArray().slice(),o=n.__generatedMappings=[],u=n.__originalMappings=[],l=0,c=s.length;l<c;l++){var m=s[l],f=new Wi;f.generatedLine=m.generatedLine,f.generatedColumn=m.generatedColumn,m.source&&(f.source=a.indexOf(m.source),f.originalLine=m.originalLine,f.originalColumn=m.originalColumn,m.name&&(f.name=i.indexOf(m.name)),u.push(f)),o.push(f)}return ot(n.__originalMappings,A.compareByOriginalPositions),n};Q.prototype._version=3;Object.defineProperty(Q.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function Wi(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}Q.prototype._parseMappings=function(e,r){for(var n=1,i=0,a=0,s=0,o=0,u=0,l=e.length,c=0,m={},f={},d=[],h=[],g,k,y,R,I;c<l;)if(e.charAt(c)===";")n++,c++,i=0;else if(e.charAt(c)===",")c++;else{for(g=new Wi,g.generatedLine=n,R=c;R<l&&!this._charIsMappingSeparator(e,R);R++);if(k=e.slice(c,R),y=m[k],y)c+=k.length;else{for(y=[];c<R;)pu.decode(e,c,f),I=f.value,c=f.rest,y.push(I);if(y.length===2)throw new Error("Found a source, but no line and column");if(y.length===3)throw new Error("Found a source and line, but no column");m[k]=y}g.generatedColumn=i+y[0],i=g.generatedColumn,y.length>1&&(g.source=o+y[1],o+=y[1],g.originalLine=a+y[2],a=g.originalLine,g.originalLine+=1,g.originalColumn=s+y[3],s=g.originalColumn,y.length>4&&(g.name=u+y[4],u+=y[4])),h.push(g),typeof g.originalLine=="number"&&d.push(g)}ot(h,A.compareByGeneratedPositionsDeflated),this.__generatedMappings=h,ot(d,A.compareByOriginalPositions),this.__originalMappings=d};Q.prototype._findMapping=function(e,r,n,i,a,s){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[i]);return Gr.search(e,r,a,s)};Q.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var r=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(r.generatedLine===n.generatedLine){r.lastGeneratedColumn=n.generatedColumn-1;continue}}r.lastGeneratedColumn=1/0}};Q.prototype.originalPositionFor=function(e){var r={generatedLine:A.getArg(e,"line"),generatedColumn:A.getArg(e,"column")},n=this._findMapping(r,this._generatedMappings,"generatedLine","generatedColumn",A.compareByGeneratedPositionsDeflated,A.getArg(e,"bias",B.GREATEST_LOWER_BOUND));if(n>=0){var i=this._generatedMappings[n];if(i.generatedLine===r.generatedLine){var a=A.getArg(i,"source",null);a!==null&&(a=this._sources.at(a),a=A.computeSourceURL(this.sourceRoot,a,this._sourceMapURL));var s=A.getArg(i,"name",null);return s!==null&&(s=this._names.at(s)),{source:a,line:A.getArg(i,"originalLine",null),column:A.getArg(i,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}};Q.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};Q.prototype.sourceContentFor=function(e,r){if(!this.sourcesContent)return null;var n=this._findSourceIndex(e);if(n>=0)return this.sourcesContent[n];var i=e;this.sourceRoot!=null&&(i=A.relative(this.sourceRoot,i));var a;if(this.sourceRoot!=null&&(a=A.urlParse(this.sourceRoot))){var s=i.replace(/^file:\/\//,"");if(a.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!a.path||a.path=="/")&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(r)return null;throw new Error('"'+i+'" is not in the SourceMap.')};Q.prototype.generatedPositionFor=function(e){var r=A.getArg(e,"source");if(r=this._findSourceIndex(r),r<0)return{line:null,column:null,lastColumn:null};var n={source:r,originalLine:A.getArg(e,"line"),originalColumn:A.getArg(e,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",A.compareByOriginalPositions,A.getArg(e,"bias",B.GREATEST_LOWER_BOUND));if(i>=0){var a=this._originalMappings[i];if(a.source===n.source)return{line:A.getArg(a,"generatedLine",null),column:A.getArg(a,"generatedColumn",null),lastColumn:A.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};qt.BasicSourceMapConsumer=Q;function le(t,e){var r=t;typeof t=="string"&&(r=A.parseSourceMapInput(t));var n=A.getArg(r,"version"),i=A.getArg(r,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new Ye,this._names=new Ye;var a={line:-1,column:0};this._sections=i.map(function(s){if(s.url)throw new Error("Support for url field in sections not implemented.");var o=A.getArg(s,"offset"),u=A.getArg(o,"line"),l=A.getArg(o,"column");if(u<a.line||u===a.line&&l<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=o,{generatedOffset:{generatedLine:u+1,generatedColumn:l+1},consumer:new B(A.getArg(s,"map"),e)}})}le.prototype=Object.create(B.prototype);le.prototype.constructor=B;le.prototype._version=3;Object.defineProperty(le.prototype,"sources",{get:function(){for(var t=[],e=0;e<this._sections.length;e++)for(var r=0;r<this._sections[e].consumer.sources.length;r++)t.push(this._sections[e].consumer.sources[r]);return t}});le.prototype.originalPositionFor=function(e){var r={generatedLine:A.getArg(e,"line"),generatedColumn:A.getArg(e,"column")},n=Gr.search(r,this._sections,function(a,s){var o=a.generatedLine-s.generatedOffset.generatedLine;return o||a.generatedColumn-s.generatedOffset.generatedColumn}),i=this._sections[n];return i?i.consumer.originalPositionFor({line:r.generatedLine-(i.generatedOffset.generatedLine-1),column:r.generatedColumn-(i.generatedOffset.generatedLine===r.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}};le.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})};le.prototype.sourceContentFor=function(e,r){for(var n=0;n<this._sections.length;n++){var i=this._sections[n],a=i.consumer.sourceContentFor(e,!0);if(a)return a}if(r)return null;throw new Error('"'+e+'" is not in the SourceMap.')};le.prototype.generatedPositionFor=function(e){for(var r=0;r<this._sections.length;r++){var n=this._sections[r];if(n.consumer._findSourceIndex(A.getArg(e,"source"))!==-1){var i=n.consumer.generatedPositionFor(e);if(i){var a={line:i.line+(n.generatedOffset.generatedLine-1),column:i.column+(n.generatedOffset.generatedLine===i.line?n.generatedOffset.generatedColumn-1:0)};return a}}}return{line:null,column:null}};le.prototype._parseMappings=function(e,r){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var i=this._sections[n],a=i.consumer._generatedMappings,s=0;s<a.length;s++){var o=a[s],u=i.consumer._sources.at(o.source);u=A.computeSourceURL(i.consumer.sourceRoot,u,this._sourceMapURL),this._sources.add(u),u=this._sources.indexOf(u);var l=null;o.name&&(l=i.consumer._names.at(o.name),this._names.add(l),l=this._names.indexOf(l));var c={source:u,generatedLine:o.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:o.generatedColumn+(i.generatedOffset.generatedLine===o.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:o.originalLine,originalColumn:o.originalColumn,name:l};this.__generatedMappings.push(c),typeof c.originalLine=="number"&&this.__originalMappings.push(c)}ot(this.__generatedMappings,A.compareByGeneratedPositionsDeflated),ot(this.__originalMappings,A.compareByOriginalPositions)};qt.IndexedSourceMapConsumer=le});var Ji=L(Qi=>{var gu=jr().SourceMapGenerator,Pt=Ve(),vu=/(\r?\n)/,yu=10,Ge="$$$isSourceNode$$$";function ne(t,e,r,n,i){this.children=[],this.sourceContents={},this.line=t??null,this.column=e??null,this.source=r??null,this.name=i??null,this[Ge]=!0,n!=null&&this.add(n)}ne.fromStringWithSourceMap=function(e,r,n){var i=new ne,a=e.split(vu),s=0,o=function(){var f=h(),d=h()||"";return f+d;function h(){return s<a.length?a[s++]:void 0}},u=1,l=0,c=null;return r.eachMapping(function(f){if(c!==null)if(u<f.generatedLine)m(c,o()),u++,l=0;else{var d=a[s]||"",h=d.substr(0,f.generatedColumn-l);a[s]=d.substr(f.generatedColumn-l),l=f.generatedColumn,m(c,h),c=f;return}for(;u<f.generatedLine;)i.add(o()),u++;if(l<f.generatedColumn){var d=a[s]||"";i.add(d.substr(0,f.generatedColumn)),a[s]=d.substr(f.generatedColumn),l=f.generatedColumn}c=f},this),s<a.length&&(c&&m(c,o()),i.add(a.splice(s).join(""))),r.sources.forEach(function(f){var d=r.sourceContentFor(f);d!=null&&(n!=null&&(f=Pt.join(n,f)),i.setSourceContent(f,d))}),i;function m(f,d){if(f===null||f.source===void 0)i.add(d);else{var h=n?Pt.join(n,f.source):f.source;i.add(new ne(f.originalLine,f.originalColumn,h,d,f.name))}}};ne.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(r){this.add(r)},this);else if(e[Ge]||typeof e=="string")e&&this.children.push(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};ne.prototype.prepend=function(e){if(Array.isArray(e))for(var r=e.length-1;r>=0;r--)this.prepend(e[r]);else if(e[Ge]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};ne.prototype.walk=function(e){for(var r,n=0,i=this.children.length;n<i;n++)r=this.children[n],r[Ge]?r.walk(e):r!==""&&e(r,{source:this.source,line:this.line,column:this.column,name:this.name})};ne.prototype.join=function(e){var r,n,i=this.children.length;if(i>0){for(r=[],n=0;n<i-1;n++)r.push(this.children[n]),r.push(e);r.push(this.children[n]),this.children=r}return this};ne.prototype.replaceRight=function(e,r){var n=this.children[this.children.length-1];return n[Ge]?n.replaceRight(e,r):typeof n=="string"?this.children[this.children.length-1]=n.replace(e,r):this.children.push("".replace(e,r)),this};ne.prototype.setSourceContent=function(e,r){this.sourceContents[Pt.toSetString(e)]=r};ne.prototype.walkSourceContents=function(e){for(var r=0,n=this.children.length;r<n;r++)this.children[r][Ge]&&this.children[r].walkSourceContents(e);for(var i=Object.keys(this.sourceContents),r=0,n=i.length;r<n;r++)e(Pt.fromSetString(i[r]),this.sourceContents[i[r]])};ne.prototype.toString=function(){var e="";return this.walk(function(r){e+=r}),e};ne.prototype.toStringWithSourceMap=function(e){var r={code:"",line:1,column:0},n=new gu(e),i=!1,a=null,s=null,o=null,u=null;return this.walk(function(l,c){r.code+=l,c.source!==null&&c.line!==null&&c.column!==null?((a!==c.source||s!==c.line||o!==c.column||u!==c.name)&&n.addMapping({source:c.source,original:{line:c.line,column:c.column},generated:{line:r.line,column:r.column},name:c.name}),a=c.source,s=c.line,o=c.column,u=c.name,i=!0):i&&(n.addMapping({generated:{line:r.line,column:r.column}}),a=null,i=!1);for(var m=0,f=l.length;m<f;m++)l.charCodeAt(m)===yu?(r.line++,r.column=0,m+1===f?(a=null,i=!1):i&&n.addMapping({source:c.source,original:{line:c.line,column:c.column},generated:{line:r.line,column:r.column},name:c.name})):r.column++}),this.walkSourceContents(function(l,c){n.setSourceContent(l,c)}),{code:r.code,map:n}};Qi.SourceNode=ne});var Xi=L(Ut=>{Ut.SourceMapGenerator=jr().SourceMapGenerator;Ut.SourceMapConsumer=Hi().SourceMapConsumer;Ut.SourceNode=Ji().SourceNode});var Ki=L((qc,Zi)=>{var Su=Object.prototype.toString,zr=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function wu(t){return Su.call(t).slice(8,-1)==="ArrayBuffer"}function bu(t,e,r){e>>>=0;var n=t.byteLength-e;if(n<0)throw new RangeError("'offset' is out of bounds");if(r===void 0)r=n;else if(r>>>=0,r>n)throw new RangeError("'length' is out of bounds");return zr?Buffer.from(t.slice(e,e+r)):new Buffer(new Uint8Array(t.slice(e,e+r)))}function Du(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return zr?Buffer.from(t,e):new Buffer(t,e)}function _u(t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return wu(t)?bu(t,e,r):typeof t=="string"?Du(t,e):zr?Buffer.from(t):new Buffer(t)}Zi.exports=_u});var oa=L((Le,Jr)=>{var Ru=Xi().SourceMapConsumer,Wr=require("path"),he;try{he=require("fs"),(!he.existsSync||!he.readFileSync)&&(he=null)}catch{}var Eu=Ki();function ea(t,e){return t.require(e)}var ta=!1,ra=!1,Hr=!1,ut="auto",Ie={},lt={},ku=/^data:application\/json[^,]+base64,/,Ee=[],ke=[];function Xr(){return ut==="browser"?!0:ut==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function Au(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Ou(){return typeof process=="object"&&process!==null?process.version:""}function Cu(){if(typeof process=="object"&&process!==null)return process.stderr}function Mu(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function jt(t){return function(e){for(var r=0;r<t.length;r++){var n=t[r](e);if(n)return n}return null}}var Zr=jt(Ee);Ee.push(function(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(n,i){return i?"":"/"})),t in Ie)return Ie[t];var e="";try{if(he)he.existsSync(t)&&(e=he.readFileSync(t,"utf8"));else{var r=new XMLHttpRequest;r.open("GET",t,!1),r.send(null),r.readyState===4&&r.status===200&&(e=r.responseText)}}catch{}return Ie[t]=e});function Qr(t,e){if(!t)return e;var r=Wr.dirname(t),n=/^\w+:\/\/[^\/]*/.exec(r),i=n?n[0]:"",a=r.slice(i.length);return i&&/^\/\w\:/.test(a)?(i+="/",i+Wr.resolve(r.slice(i.length),e).replace(/\\/g,"/")):i+Wr.resolve(r.slice(i.length),e)}function Tu(t){var e;if(Xr())try{var r=new XMLHttpRequest;r.open("GET",t,!1),r.send(null),e=r.readyState===4?r.responseText:null;var n=r.getResponseHeader("SourceMap")||r.getResponseHeader("X-SourceMap");if(n)return n}catch{}e=Zr(t);for(var i=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,a,s;s=i.exec(e);)a=s;return a?a[1]:null}var Kr=jt(ke);ke.push(function(t){var e=Tu(t);if(!e)return null;var r;if(ku.test(e)){var n=e.slice(e.indexOf(",")+1);r=Eu(n,"base64").toString(),e=t}else e=Qr(t,e),r=Zr(e);return r?{url:e,map:r}:null});function en(t){var e=lt[t.source];if(!e){var r=Kr(t.source);r?(e=lt[t.source]={url:r.url,map:new Ru(r.map)},e.map.sourcesContent&&e.map.sources.forEach(function(i,a){var s=e.map.sourcesContent[a];if(s){var o=Qr(e.url,i);Ie[o]=s}})):e=lt[t.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var n=e.map.originalPositionFor(t);if(n.source!==null)return n.source=Qr(e.url,n.source),n}return t}function ia(t){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t);if(e){var r=en({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+r.source+":"+r.line+":"+(r.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(t),e?"eval at "+e[1]+" ("+ia(e[2])+")":t}function Iu(){var t,e="";if(this.isNative())e="native";else{t=this.getScriptNameOrSourceURL(),!t&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),t?e+=t:e+="<anonymous>";var r=this.getLineNumber();if(r!=null){e+=":"+r;var n=this.getColumnNumber();n&&(e+=":"+n)}}var i="",a=this.getFunctionName(),s=!0,o=this.isConstructor(),u=!(this.isToplevel()||o);if(u){var l=this.getTypeName();l==="[object Object]"&&(l="null");var c=this.getMethodName();a?(l&&a.indexOf(l)!=0&&(i+=l+"."),i+=a,c&&a.indexOf("."+c)!=a.length-c.length-1&&(i+=" [as "+c+"]")):i+=l+"."+(c||"<anonymous>")}else o?i+="new "+(a||"<anonymous>"):a?i+=a:(i+=e,s=!1);return s&&(i+=" ("+e+")"),i}function na(t){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(r){e[r]=/^(?:is|get)/.test(r)?function(){return t[r].call(t)}:t[r]}),e.toString=Iu,e}function aa(t,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),t.isNative())return e.curPosition=null,t;var r=t.getFileName()||t.getScriptNameOrSourceURL();if(r){var n=t.getLineNumber(),i=t.getColumnNumber()-1,a=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,s=a.test(Ou())?0:62;n===1&&i>s&&!Xr()&&!t.isEval()&&(i-=s);var o=en({source:r,line:n,column:i});e.curPosition=o,t=na(t);var u=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?u():e.nextPosition.name||u()},t.getFileName=function(){return o.source},t.getLineNumber=function(){return o.line},t.getColumnNumber=function(){return o.column+1},t.getScriptNameOrSourceURL=function(){return o.source},t}var l=t.isEval()&&t.getEvalOrigin();return l&&(l=ia(l),t=na(t),t.getEvalOrigin=function(){return l}),t}function Lu(t,e){Hr&&(Ie={},lt={});for(var r=t.name||"Error",n=t.message||"",i=r+": "+n,a={nextPosition:null,curPosition:null},s=[],o=e.length-1;o>=0;o--)s.push(`
    at `+aa(e[o],a)),a.nextPosition=a.curPosition;return a.curPosition=a.nextPosition=null,i+s.reverse().join("")}function sa(t){var e=/\n    at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var r=e[1],n=+e[2],i=+e[3],a=Ie[r];if(!a&&he&&he.existsSync(r))try{a=he.readFileSync(r,"utf8")}catch{a=""}if(a){var s=a.split(/(?:\r\n|\r|\n)/)[n-1];if(s)return r+":"+n+`
`+s+`
`+new Array(i).join(" ")+"^"}}return null}function xu(t){var e=sa(t),r=Cu();r&&r._handle&&r._handle.setBlocking&&r._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),Mu(1)}function $u(){var t=process.emit;process.emit=function(e){if(e==="uncaughtException"){var r=arguments[1]&&arguments[1].stack,n=this.listeners(e).length>0;if(r&&!n)return xu(arguments[1])}return t.apply(this,arguments)}}var Fu=Ee.slice(0),Nu=ke.slice(0);Le.wrapCallSite=aa;Le.getErrorSource=sa;Le.mapSourcePosition=en;Le.retrieveSourceMap=Kr;Le.install=function(t){if(t=t||{},t.environment&&(ut=t.environment,["node","browser","auto"].indexOf(ut)===-1))throw new Error("environment "+ut+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(Ee.length=0),Ee.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(ke.length=0),ke.unshift(t.retrieveSourceMap)),t.hookRequire&&!Xr()){var e=ea(Jr,"module"),r=e.prototype._compile;r.__sourceMapSupport||(e.prototype._compile=function(a,s){return Ie[s]=a,lt[s]=void 0,r.call(this,a,s)},e.prototype._compile.__sourceMapSupport=!0)}if(Hr||(Hr="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),ta||(ta=!0,Error.prepareStackTrace=Lu),!ra){var n="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var i=ea(Jr,"worker_threads");i.isMainThread===!1&&(n=!1)}catch{}n&&Au()&&(ra=!0,$u())}};Le.resetRetrieveHandlers=function(){Ee.length=0,ke.length=0,Ee=Fu.slice(0),ke=Nu.slice(0),Kr=jt(ke),Zr=jt(Ee)}});var ga=L((Uc,X)=>{var qu="1.8.15",la=0,We=function(e){var r=["XXX: "+e].concat(Array.prototype.slice.call(arguments,1));console.error.apply(this,r)},We=function(){},$e;typeof process<"u"&&process.versions&&(process.versions.nw?$e="nw":process.versions.node&&($e="node"));!$e&&typeof window<"u"&&window.window===window&&($e="browser");if(!$e)throw new Error("unknown runtime environment");var Bt,ye,ze;if($e==="browser")Bt={hostname:function(){return window.location.host}},ye={},ze=null;else{Bt=require("os"),ye=require("fs");try{ze=require("dtrace-provider")}catch{ze=null}}var we=require("util"),Se=require("assert"),mt=require("events").EventEmitter,Pu=require("stream");try{ft=_n()}catch{ft=null}var ft;process.env.BUNYAN_TEST_NO_SAFE_JSON_STRINGIFY&&(ft=null);try{ht=Ai()}catch{ht=null}var ht;try{Vt=oa()}catch{Vt=null}var Vt;function xe(t){if(t==null)return t;if(Array.isArray(t))return t.slice();if(typeof t=="object"){var e={};return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}else return t}var J=we.format;J||(tn=we.inspect,ua=/%[sdj%]/g,J=function(e){if(typeof e!="string"){for(var r=[],n=0;n<arguments.length;n++)r.push(tn(arguments[n]));return r.join(" ")}for(var n=1,i=arguments,a=i.length,s=String(e).replace(ua,function(u){if(n>=a)return u;switch(u){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":return pa(i[n++]);case"%%":return"%";default:return u}}),o=i[n];n<a;o=i[++n])o===null||typeof o!="object"?s+=" "+o:s+=" "+tn(o);return s});var tn,ua;function an(){if(this!==void 0){var t={},e=Error.stackTraceLimit,r=Error.prepareStackTrace;return Error.stackTraceLimit=3,Error.prepareStackTrace=function(n,i){var a=i[2];Vt&&(a=Vt.wrapCallSite(a)),t.file=a.getFileName(),t.line=a.getLineNumber();var s=a.getFunctionName();s&&(t.func=s)},Error.captureStackTrace(this,an),this.stack,Error.stackTraceLimit=e,Error.prepareStackTrace=r,t}}function Uu(t,e){e||(e="    ");var r=t.split(/\r?\n/g);return e+r.join(`
`+e)}function sn(t,e){if(Se.ok(t),e){if(rn[e])return;rn[e]=!0}process.stderr.write(t+`
`)}function ju(t){return rn[t]}var rn={};function ca(){}ca.prototype.write=function(t){t.level<pt?console.log(t):t.level<Yt?console.info(t):t.level<Gt?console.warn(t):console.error(t)};var on=10,un=20,pt=30,Yt=40,Gt=50,ln=60,He={trace:on,debug:un,info:pt,warn:Yt,error:Gt,fatal:ln},fa={};Object.keys(He).forEach(function(t){fa[He[t]]=t});var ct=void 0,nn=ze&&{};function dt(t){var e,r=typeof t;if(r==="string"){if(e=He[t.toLowerCase()],!e)throw new Error(J('unknown level name: "%s"',t))}else{if(r!=="number")throw new TypeError(J("cannot resolve level: invalid arg (%s):",r,t));if(t<0||Math.floor(t)!==t)throw new TypeError(J("level is not a positive integer: %s",t));e=t}return e}function Bu(t){return t instanceof Pu.Writable?!0:typeof t.write=="function"}function V(t,e,r){if(We("Logger start:",t),!(this instanceof V))return new V(t,e);var n;if(e!==void 0&&(n=t,t=e,!(n instanceof V)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!t)throw new TypeError("options (object) is required");if(n){if(t.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!t.name)throw new TypeError("options.name (string) is required");if(t.stream&&t.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(t.streams&&!Array.isArray(t.streams))throw new TypeError("invalid options.streams: must be an array");if(t.serializers&&(typeof t.serializers!="object"||Array.isArray(t.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(mt.call(this),n&&r){this._isSimpleChild=!0,this._level=n._level,this.streams=n.streams,this.serializers=n.serializers,this.src=n.src;for(var f=this.fields={},i=Object.keys(n.fields),a=0;a<i.length;a++){var s=i[a];f[s]=n.fields[s]}for(var o=Object.keys(t),a=0;a<o.length;a++){var s=o[a];f[s]=t[s]}return}var u=this;if(n){this._level=n._level,this.streams=[];for(var a=0;a<n.streams.length;a++){var l=xe(n.streams[a]);l.closeOnExit=!1,this.streams.push(l)}this.serializers=xe(n.serializers),this.src=n.src,this.fields=xe(n.fields),t.level&&this.level(t.level)}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};if(!ct&&ze){ct=ze.createDTraceProvider("bunyan");for(var c in He){var m;nn[He[c]]=m=ct.addProbe("log-"+c,"char *"),m.dtp=ct}ct.enable()}t.stream?u.addStream({type:"stream",stream:t.stream,closeOnExit:!1,level:t.level}):t.streams?t.streams.forEach(function(d){u.addStream(d,t.level)}):n&&t.level?this.level(t.level):n||($e==="browser"?u.addStream({type:"raw",stream:new ca,closeOnExit:!1,level:t.level}):u.addStream({type:"stream",stream:process.stdout,closeOnExit:!1,level:t.level})),t.serializers&&u.addSerializers(t.serializers),t.src&&(this.src=!0),We("Logger: ",u);var f=xe(t);delete f.stream,delete f.level,delete f.streams,delete f.serializers,delete f.src,this.serializers&&this._applySerializers(f),!f.hostname&&!u.fields.hostname&&(f.hostname=Bt.hostname()),f.pid||(f.pid=process.pid),Object.keys(f).forEach(function(d){u.fields[d]=f[d]})}we.inherits(V,mt);V.prototype.addStream=function(e,r){var n=this;switch(r==null&&(r=pt),e=xe(e),e.type||(e.stream?e.type="stream":e.path&&(e.type="file")),e.raw=e.type==="raw",e.level!==void 0?e.level=dt(e.level):e.level=dt(r),e.level<n._level&&(n._level=e.level),e.type){case"stream":Se.ok(Bu(e.stream),'"stream" stream is not writable: '+we.inspect(e.stream)),e.closeOnExit||(e.closeOnExit=!1);break;case"file":e.reemitErrorEvents===void 0&&(e.reemitErrorEvents=!0),e.stream?e.closeOnExit||(e.closeOnExit=!1):(e.stream=ye.createWriteStream(e.path,{flags:"a",encoding:"utf8"}),e.closeOnExit||(e.closeOnExit=!0));break;case"rotating-file":Se.ok(!e.stream,'"rotating-file" stream should not give a "stream"'),Se.ok(e.path),Se.ok(ht,'"rotating-file" stream type is not supported: missing "mv" module'),e.stream=new ie(e),e.closeOnExit||(e.closeOnExit=!0);break;case"raw":e.closeOnExit||(e.closeOnExit=!1);break;default:throw new TypeError('unknown stream type "'+e.type+'"')}e.reemitErrorEvents&&typeof e.stream.on=="function"&&e.stream.on("error",function(a){n.emit("error",a,e)}),n.streams.push(e),delete n.haveNonRawStreams};V.prototype.addSerializers=function(e){var r=this;r.serializers||(r.serializers={}),Object.keys(e).forEach(function(n){var i=e[n];if(typeof i!="function")throw new TypeError(J('invalid serializer for "%s" field: must be a function',n));r.serializers[n]=i})};V.prototype.child=function(t,e){return new this.constructor(this,t||{},e)};V.prototype.reopenFileStreams=function(){var t=this;t.streams.forEach(function(e){e.type==="file"&&(e.stream&&(e.stream.end(),e.stream.destroySoon(),delete e.stream),e.stream=ye.createWriteStream(e.path,{flags:"a",encoding:"utf8"}),e.stream.on("error",function(r){t.emit("error",r,e)}))})};V.prototype.level=function(e){if(e===void 0)return this._level;for(var r=dt(e),n=this.streams.length,i=0;i<n;i++)this.streams[i].level=r;this._level=r};V.prototype.levels=function(e,r){if(e===void 0)return Se.equal(r,void 0),this.streams.map(function(u){return u.level});var n;if(typeof e=="number"){if(n=this.streams[e],n===void 0)throw new Error("invalid stream index: "+e)}else{for(var i=this.streams.length,a=0;a<i;a++){var s=this.streams[a];if(s.name===e){n=s;break}}if(!n)throw new Error(J('no stream with name "%s"',e))}if(r===void 0)return n.level;var o=dt(r);n.level=o,o<this._level&&(this._level=o)};V.prototype._applySerializers=function(t,e){var r=this;We("_applySerializers: excludeFields",e),Object.keys(this.serializers).forEach(function(n){if(!(t[n]===void 0||e&&e[n])){We('_applySerializers; apply to "%s" key',n);try{t[n]=r.serializers[n](t[n])}catch(i){sn(J(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bug in that serializer function.
%s`,n,i.stack||i)),t[n]=J('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',n)}}})};V.prototype._emit=function(t,e){var r;if(this.haveNonRawStreams===void 0){for(this.haveNonRawStreams=!1,r=0;r<this.streams.length;r++)if(!this.streams[r].raw){this.haveNonRawStreams=!0;break}}var n;if((e||this.haveNonRawStreams)&&(n=pa(t)+Bt.EOL),e)return n;var i=t.level;for(r=0;r<this.streams.length;r++){var a=this.streams[r];a.level<=i&&(We('writing log rec "%s" to "%s" stream (%d <= %d): %j',t.msg,a.type,a.level,i,t),a.stream.write(a.raw?t:n))}return n};function ha(t,e,r){var n,i,a;r[0]instanceof Error?(i={err:t.serializers&&t.serializers.err?t.serializers.err(r[0]):V.stdSerializers.err(r[0])},n={err:!0},r.length===1?a=[i.err.message]:a=r.slice(1)):typeof r[0]!="object"||Array.isArray(r[0])?(i=null,a=r.slice()):Buffer.isBuffer(r[0])?(i=null,a=r.slice(),a[0]=we.inspect(a[0])):(i=r[0],i&&r.length===1&&i.err&&i.err instanceof Error?a=[i.err.message]:a=r.slice(1));var s=xe(t.fields),o=s.level=e,u=i?xe(i):null;return u&&(t.serializers&&t._applySerializers(u,n),Object.keys(u).forEach(function(l){s[l]=u[l]})),s.msg=J.apply(t,a),s.time||(s.time=new Date),t.src&&!s.src&&(s.src=an()),s.v=la,s}function Vu(t,e,r,n){return[t||e._emit(ha(e,r,n),!0)]}function Qe(t){return function(){var e=this,r=null,n=null;if(this._emit){if(arguments.length===0)return this._level<=t}else{var i="unbound";if(!ju[i]){var a=an();sn(J("bunyan usage error: %s:%s: attempt to log with an unbound log method: `this` is: %s",a.file,a.line,we.inspect(this)),i)}return}for(var s=new Array(arguments.length),o=0;o<s.length;++o)s[o]=arguments[o];this._level<=t&&(n=ha(e,t,s),r=this._emit(n)),nn&&nn[t].fire(Vu,r,e,t,s)}}V.prototype.trace=Qe(on);V.prototype.debug=Qe(un);V.prototype.info=Qe(pt);V.prototype.warn=Qe(Yt);V.prototype.error=Qe(Gt);V.prototype.fatal=Qe(ln);V.stdSerializers={};V.stdSerializers.req=function(t){return!t||!t.connection?t:{method:t.method,url:t.originalUrl||t.url,headers:t.headers,remoteAddress:t.connection.remoteAddress,remotePort:t.connection.remotePort}};V.stdSerializers.res=function(t){return!t||!t.statusCode?t:{statusCode:t.statusCode,header:t._header}};function da(t){var e=t.stack||t.toString();if(t.cause&&typeof t.cause=="function"){var r=t.cause();r&&(e+=`
Caused by: `+da(r))}return e}var Pc=V.stdSerializers.err=function(t){if(!t||!t.stack)return t;var e={message:t.message,name:t.name,stack:da(t),code:t.code,signal:t.signal};return e};function Yu(){var t=new Set;return function(e,r){return!r||typeof r!="object"?r:t.has(r)?"[Circular]":(t.add(r),r)}}function Gu(){var t=[];return function(e,r){return!r||typeof r!="object"?r:t.indexOf(r)!==-1?"[Circular]":(t.push(r),r)}}var ma=typeof Set<"u"?Yu:Gu;function pa(t){try{return JSON.stringify(t)}catch{try{return JSON.stringify(t,ma())}catch(n){if(ft)return ft(t);var e=n.stack.split(/\n/g,3).join(`
`);return sn('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+Uu(J(`%s
%s`,we.inspect(t),n.stack)),e),J("(Exception in JSON.stringify(rec): %j. See stderr for details.)",n.message)}}}var ie=null;ht&&(ie=function(e){if(this.path=e.path,this.count=e.count==null?10:e.count,Se.equal(typeof this.count,"number",J('rotating-file stream "count" is not a number: %j (%s) in %j',this.count,typeof this.count,this)),Se.ok(this.count>=0,J('rotating-file stream "count" is not >= 0: %j in %j',this.count,this)),e.period){var r={hourly:"1h",daily:"1d",weekly:"1w",monthly:"1m",yearly:"1y"}[e.period]||e.period,n=/^([1-9][0-9]*)([hdwmy]|ms)$/.exec(r);if(!n)throw new Error(J('invalid period: "%s"',e.period));this.periodNum=Number(n[1]),this.periodScope=n[2]}else this.periodNum=1,this.periodScope="d";var i=null;try{var a=ye.statSync(this.path);i=a.mtime.getTime()}catch{}var s=!1;if(i){var o=this._calcRotTime(0);i<o&&(s=!0)}this.stream=ye.createWriteStream(this.path,{flags:"a",encoding:"utf8"}),this.rotQueue=[],this.rotating=!1,s?(this._debug("rotateAfterOpen -> call rotate()"),this.rotate()):this._setupNextRot()},we.inherits(ie,mt),ie.prototype._debug=function(){if(0)var t;else return!1},ie.prototype._setupNextRot=function(){this.rotAt=this._calcRotTime(1),this._setRotationTimer()},ie.prototype._setRotationTimer=function(){var t=this,e=this.rotAt-Date.now(),r=2147483647;e>r&&(e=r),this.timeout=setTimeout(function(){t._debug("_setRotationTimer timeout -> call rotate()"),t.rotate()},e),typeof this.timeout.unref=="function"&&this.timeout.unref()},ie.prototype._calcRotTime=function(e){this._debug("_calcRotTime: %s%s",this.periodNum,this.periodScope);var r=new Date;this._debug("  now local: %s",r),this._debug("    now utc: %s",r.toISOString());var n;switch(this.periodScope){case"ms":this.rotAt?n=this.rotAt+this.periodNum*e:n=Date.now()+this.periodNum*e;break;case"h":this.rotAt?n=this.rotAt+this.periodNum*60*60*1e3*e:n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),r.getUTCHours()+e);break;case"d":this.rotAt?n=this.rotAt+this.periodNum*24*60*60*1e3*e:n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()+e);break;case"w":if(this.rotAt)n=this.rotAt+this.periodNum*7*24*60*60*1e3*e;else{var i=7-r.getUTCDay();e<1&&(i=-r.getUTCDay()),(e>1||e<-1)&&(i+=7*e),n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()+i)}break;case"m":this.rotAt?n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+this.periodNum*e,1):n=Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+e,1);break;case"y":this.rotAt?n=Date.UTC(r.getUTCFullYear()+this.periodNum*e,0,1):n=Date.UTC(r.getUTCFullYear()+e,0,1);break;default:Se.fail(J('invalid period scope: "%s"',this.periodScope))}if(this._debug()){this._debug("  **rotAt**: %s (utc: %s)",n,new Date(n).toUTCString());var a=Date.now();this._debug("        now: %s (%sms == %smin == %sh to go)",a,n-a,(n-a)/1e3/60,(n-a)/1e3/60/60)}return n},ie.prototype.rotate=function(){var e=this;if(e.rotAt&&e.rotAt>Date.now())return e._setRotationTimer();if(this._debug("rotate"),e.rotating)throw new TypeError("cannot start a rotation when already rotating");e.rotating=!0,e.stream.end();function r(){var s=e.path+"."+String(a-1);a===0&&(s=e.path),a-=1,e._debug("  rm %s",s),ye.unlink(s,function(o){n()})}function n(){if(e.count===0||a<0)return i();var s=e.path,o=e.path+"."+String(a);a>0&&(s+="."+String(a-1)),a-=1,ye.exists(s,function(u){u?(e._debug("  mv %s %s",s,o),ht(s,o,function(l){l?(e.emit("error",l),i()):n()})):n()})}function i(){e._debug("  open %s",e.path),e.stream=ye.createWriteStream(e.path,{flags:"a",encoding:"utf8"});for(var s=e.rotQueue,o=s.length,u=0;u<o;u++)e.stream.write(s[u]);e.rotQueue=[],e.rotating=!1,e.emit("drain"),e._setupNextRot()}var a=this.count;r()},ie.prototype.write=function(e){return this.rotating?(this.rotQueue.push(e),!1):this.stream.write(e)},ie.prototype.end=function(e){this.stream.end()},ie.prototype.destroy=function(e){this.stream.destroy()},ie.prototype.destroySoon=function(e){this.stream.destroySoon()});function Je(t){this.limit=t&&t.limit?t.limit:100,this.writable=!0,this.records=[],mt.call(this)}we.inherits(Je,mt);Je.prototype.write=function(t){if(!this.writable)throw new Error("RingBuffer has been ended already");return this.records.push(t),this.records.length>this.limit&&this.records.shift(),!0};Je.prototype.end=function(){arguments.length>0&&this.write.apply(this,Array.prototype.slice.call(arguments)),this.writable=!1};Je.prototype.destroy=function(){this.writable=!1,this.emit("close")};Je.prototype.destroySoon=function(){this.destroy()};X.exports=V;X.exports.TRACE=on;X.exports.DEBUG=un;X.exports.INFO=pt;X.exports.WARN=Yt;X.exports.ERROR=Gt;X.exports.FATAL=ln;X.exports.resolveLevel=dt;X.exports.levelFromName=He;X.exports.nameFromLevel=fa;X.exports.VERSION=qu;X.exports.LOG_VERSION=la;X.exports.createLogger=function(e){return new V(e)};X.exports.RingBuffer=Je;X.exports.RotatingFileStream=ie;X.exports.safeCycles=ma});var ya=L((jc,va)=>{var zu=Object.prototype.hasOwnProperty,Wu=Object.prototype.toString,Hu=function(t){var e=typeof t=="function"&&!(t instanceof RegExp)||Wu.call(t)==="[object Function]";return!e&&typeof window<"u"&&(e=t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt),e};va.exports=function(e,r){if(!Hu(r))throw new TypeError("iterator must be a function");var n,i,a=typeof e=="string",s=e.length,o=arguments.length>2?arguments[2]:null;if(s===+s)for(n=0;n<s;n++)o===null?r(a?e.charAt(n):e[n],n,e):r.call(o,a?e.charAt(n):e[n],n,e);else for(i in e)zu.call(e,i)&&(o===null?r(e[i],i,e):r.call(o,e[i],i,e))}});var ba=L((Bc,wa)=>{var Sa=Object.prototype.toString;wa.exports=function(e){var r=Sa.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Sa.call(e.callee)==="[object Function]"),n}});var _a=L((Vc,Da)=>{(function(){"use strict";var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=ya(),n=ba(),i=!{toString:null}.propertyIsEnumerable("toString"),a=function(){}.propertyIsEnumerable("prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o;o=function(l){var c=l!==null&&typeof l=="object",m=e.call(l)==="[object Function]",f=n(l),d=[];if(!c&&!m&&!f)throw new TypeError("Object.keys called on a non-object");if(f)r(l,function(R){d.push(R)});else{var h,g=a&&m;for(h in l)!(g&&h==="prototype")&&t.call(l,h)&&d.push(h)}if(i){var k=l.constructor,y=k&&k.prototype===l;r(s,function(R){!(y&&R==="constructor")&&t.call(l,R)&&d.push(R)})}return d},Da.exports=o})()});var Ea=L((Yc,Ra)=>{Ra.exports=Object.keys||_a()});var Aa=L((Gc,ka)=>{ka.exports=Qu;function Qu(t){return t!==null&&(typeof t=="object"||typeof t=="function")}});var cn=L((zc,Oa)=>{var Ju=Ea(),Xu=Aa();Oa.exports=Zu;function Zu(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];if(Xu(r))for(var n=Ju(r),i=0;i<n.length;i++){var a=n[i];t[a]=r[a]}}return t}});var Ia=L((Wc,Ta)=>{"use strict";var Ca={white:37,black:30,blue:34,cyan:36,green:32,magenta:35,red:31,yellow:33,brightBlack:90,brightRed:91,brightGreen:92,brightYellow:93,brightBlue:94,brightMagenta:95,brightCyan:96,brightWhite:97},Ma={bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,bgBrightBlack:100,bgBrightRed:101,bgBrightGreen:102,bgBrightYellow:103,bgBrightBlue:104,bgBrightMagenta:105,bgBrightCyan:106,bgBrightWhite:107},fn={};Object.keys(Ca).forEach(function(t){fn[t]=function(e){return"\x1B["+Ca[t]+"m"+e+"\x1B[39m"}});Object.keys(Ma).forEach(function(t){fn[t]=function(e){return"\x1B["+Ma[t]+"m"+e+"\x1B[49m"}});Ta.exports=fn});var $a=L((Hc,xa)=>{"use strict";var hn={reset:[0,22],bright:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],blink:[5,25],inverse:[7,27]},La={};Object.keys(hn).forEach(function(t){La[t]=function(e){var r=hn[t][0],n=hn[t][1];return"\x1B["+r+"m"+e+"\x1B["+n+"m"}});xa.exports=La});var ts=L((Qc,es)=>{"use strict";var Pa=require("util"),Ae=Pa.format,Ku=require("http"),el=cn(),tl=Ia(),rl=$a(),nl=el(rl,tl),Ua=1,ja=2,Ba=3,Va=4,Ya=5,Ga=6,il={long:Ua,json:ja,inspect:Ba,simple:Va,short:Ya,bunyan:Ga},za=10,Wa=20,Ha=30,Qa=40,Ja=50,Xa=60,Fa={trace:za,debug:Wa,info:Ha,warn:Qa,error:Ja,fatal:Xa},al={},Za={},Ka={};Object.keys(Fa).forEach(function(t){var e=Fa[t];al[e]=t,Za[e]=t.toUpperCase(),Ka[e]=(t.length===4?" ":"")+t.toUpperCase()});function Na(t){return!(t.v===null||t.level===null||t.name===null||t.hostname===null||t.pid===null||t.time===null||t.msg===null)}function Xe(t){return"  "+t.split(/\r?\n/).join(`
  `)}function sl(t,e){if(!t)return"";var r=nl[e];return r?r(t):t}function ol(t,e){return t}function qa(t){switch(t){case za:return"TRACE";case Wa:return"DEBUG";case Ha:return"INFO";case Qa:return"WARN";case Ja:return"ERROR";case Xa:return"FATAL"}}es.exports=function(e,r){function n(M){var E="";if(M.header)E+=M.header.trimRight();else if(M.headers){M.statusCode&&(E+=Ae(`HTTP/1.1 %s %s
`,M.statusCode,Ku.STATUS_CODES[M.statusCode]));var b=M.headers;E+=Object.keys(b).map(function(v){return v+": "+b[v]}).join(`
`)}delete M.header,delete M.headers,delete M.statusCode,M.body&&(E+=`

`+(typeof M.body=="object"?JSON.stringify(M.body,null,2):M.body),delete M.body),M.trailer&&(E+=`
`+M.trailer),delete M.trailer,E&&R.push(Xe(E)),Object.keys(M).forEach(function(v){e["res."+v]=M[v]})}var i=!1,a,s=e.line,o=r.color?sl:ol,u=isNaN(r.outputMode)?il[r.outputMode]:r.outputMode;switch(u){case Ya:i=!0;case Ua:if(!Na(e))return s+`
`;delete e.v,i&&e.time[10]=="T"?(a=e.time.substr(11),a=o(a,"brightBlack")):a=o("["+e.time+"]","brightBlack"),delete e.time;var l=e.name;delete e.name,e.component&&(l+="/"+e.component),delete e.component,i||(l+="/"+e.pid),delete e.pid;var c=Ka[e.level]||"LVL"+e.level;if(r.color){var m=r.colorFromLevel||{10:"brightBlack",20:"brightBlack",30:"cyan",40:"magenta",50:"red",60:"inverse"};c=o(c,m[e.level])}delete e.level;var f="",d,h,g="";e.src&&e.src.file&&(d=e.src,d.func?f=Ae(" (%s:%d in %s)",d.file,d.line,d.func):f=Ae(" (%s:%d)",d.file,d.line),f=o(f,"green")),delete e.src;var k=e.hostname;delete e.hostname;var y=[],R=[];e.req_id&&y.push("req_id="+e.req_id),delete e.req_id;var I;if(e.msg.indexOf(`
`)!==-1?(I="",R.push(Xe(o(e.msg,"cyan")))):I=" "+o(e.msg,"cyan"),delete e.msg,e.req&&typeof e.req=="object"){var O=e.req;delete e.req,h=O.headers,d=Ae("%s %s HTTP/%s%s",O.method,O.url,O.httpVersion||"1.1",h?`
`+Object.keys(h).map(function(M){return M+": "+h[M]}).join(`
`):""),delete O.url,delete O.method,delete O.httpVersion,delete O.headers,O.body&&(d+=`

`+(typeof O.body=="object"?JSON.stringify(O.body,null,2):O.body),delete O.body),O.trailers&&Object.keys(O.trailers)>0&&(d+=`
`+Object.keys(O.trailers).map(function(M){return M+": "+O.trailers[M]}).join(`
`)),delete O.trailers,R.push(Xe(d)),Object.keys(O).forEach(function(M){e["req."+M]=O[M]})}if(e.client_req&&typeof e.client_req=="object"){var x=e.client_req;delete e.client_req,h=x.headers,d="",x.address&&(g="Host: "+x.address,x.port&&(g+=":"+x.port),g+=`
`),delete x.headers,delete x.address,delete x.port,d+=Ae(`%s %s HTTP/%s
%s%s`,x.method,x.url,x.httpVersion||"1.1",g,h?Object.keys(h).map(function(M){return M+": "+h[M]}).join(`
`):""),delete x.method,delete x.url,delete x.httpVersion,x.body&&(d+=`

`+(typeof x.body=="object"?JSON.stringify(x.body,null,2):x.body),delete x.body),Object.keys(x).forEach(function(M){e["client_req."+M]=x[M]}),R.push(Xe(d))}e.res&&typeof e.res=="object"&&(n(e.res),delete e.res),e.client_res&&typeof e.client_res=="object"&&(n(e.client_res),delete e.res),e.err&&e.err.stack&&(R.push(Xe(e.err.stack)),delete e.err);for(var j=Object.keys(e),P=0;P<j.length;P++){var $=j[P],C=e[$],U=!1;typeof C!="string"&&(C=JSON.stringify(C,null,2),U=!0),C.indexOf(`
`)!==-1||C.length>50?R.push(Xe($+": "+C)):!U&&(C.indexOf(" ")!=-1||C.length===0)?y.push($+"="+JSON.stringify(C)):y.push($+"="+C)}return y=o(y.length?" ("+y.join(", ")+")":"","brightBlack"),R=o(R.length?R.join(`
  --
`)+`
`:"","brightBlack"),i?Ae(`%s %s %s:%s%s
%s`,a,c,l,I,y,R):Ae(`%s %s: %s on %s%s:%s%s
%s`,a,c,l,k||"<no-hostname>",f,I,y,R);case Ba:return Pa.inspect(e,!1,1/0,!0)+`
`;case Ga:return r.levelInString&&(e.level=qa(e.level)),JSON.stringify(e,null,0)+`
`;case ja:return r.levelInString&&(e.level=qa(e.level)),JSON.stringify(e,null,r.jsonIndent)+`
`;case Va:return Na(e)?Ae(`%s - %s
`,Za[e.level]||"LVL"+e.level,e.msg):s+`
`;default:throw new Error("unknown output mode: "+r.outputMode)}}});var is=L((Jc,ns)=>{"use strict";var ul=require("stream"),ll=require("util"),cl=ts(),fl=cn(),rs=ul.Writable;ns.exports=gt;ll.inherits(gt,rs);function gt(t,e){if(!(this instanceof gt))return new gt(t,e);t=t||{},t.objectMode=!0,rs.call(this,t),this.opts=fl({outputMode:"short",color:!0,colorFromLevel:{10:"brightBlack",20:"brightBlack",30:"green",40:"magenta",50:"red",60:"brightRed"}},t),this.out=e||process.stdout}gt.prototype._write=function(t,e,r){var n;try{n=JSON.parse(t),this.out.write(cl(n,this.opts))}catch{this.out.write(t)}r()}});var fs=L((mn,pn)=>{(function(t,e){typeof mn=="object"&&typeof pn<"u"?pn.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isBetween=e()})(mn,function(){"use strict";return function(t,e,r){e.prototype.isBetween=function(n,i,a,s){var o=r(n),u=r(i),l=(s=s||"()")[0]==="(",c=s[1]===")";return(l?this.isAfter(o,a):!this.isBefore(o,a))&&(c?this.isBefore(u,a):!this.isAfter(u,a))||(l?this.isBefore(o,a):!this.isAfter(o,a))&&(c?this.isAfter(u,a):!this.isBefore(u,a))}}})});var Us=L((xf,yn)=>{"use strict";var Fs=require("url"),$s=Fs.parse,Jt=Fs.Url;yn.exports=Ns;yn.exports.original=Bl;function Ns(t){var e=t.url;if(e!==void 0){var r=t._parsedUrl;return Ps(e,r)?r:(r=qs(e),r._raw=e,t._parsedUrl=r)}}function Bl(t){var e=t.originalUrl;if(typeof e!="string")return Ns(t);var r=t._parsedOriginalUrl;return Ps(e,r)?r:(r=qs(e),r._raw=e,t._parsedOriginalUrl=r)}function qs(t){if(typeof t!="string"||t.charCodeAt(0)!==47)return $s(t);for(var e=t,r=null,n=null,i=1;i<t.length;i++)switch(t.charCodeAt(i)){case 63:n===null&&(e=t.substring(0,i),r=t.substring(i+1),n=t.substring(i));break;case 9:case 10:case 12:case 13:case 32:case 35:case 160:case 65279:return $s(t)}var a=Jt!==void 0?new Jt:{};return a.path=t,a.href=t,a.pathname=e,n!==null&&(a.query=r,a.search=n),a}function Ps(t,e){return typeof e=="object"&&e!==null&&(Jt===void 0||e instanceof Jt)&&e._raw===t}});var Jl={};Js(Jl,{default:()=>Xt});module.exports=Xs(Jl);var Vs=ue(Ze());var zt=ue(Ze()),os=ue(Dt());var as=ue(ga()),ss=ue(is()),hl=(0,ss.default)({outputMode:"short",color:!1}),dl=as.default.createLogger({name:"Digital Prison Reporting:",stream:hl,level:"debug"}),de=dl;var ml=t=>{let e=t.locals.csrfToken||"csrfToken",r=t.locals.user?.uuid?t.locals.user.uuid:"userId",n=t.locals.user?.token?t.locals.user.token:"token",i=t.locals.user?.activeCaseLoadId||"",a=t.locals.pathSuffix||"",s=t.locals.routePrefix||"",o=t.locals.definitions||[],u=t.locals.requestedReports||[],l=t.locals.recentlyViewedReports||[],c=t.locals.bookmarks||[],{bookmarkingEnabled:m,downloadingEnabled:f,definitionsPath:d,dpdPathFromQuery:h,dpdPathFromConfig:g,nestedBaseUrl:k}=t.locals;return{csrfToken:e,userId:r,token:n,definitions:o,requestedReports:u,recentlyViewedReports:l,bookmarks:c,bookmarkingEnabled:m,downloadingEnabled:f,dpdPathFromQuery:h,dpdPathFromConfig:g,definitionsPath:d,pathSuffix:a,routePrefix:s,activeCaseLoadId:i,nestedBaseUrl:k}},pl=(t,e)=>(e&&(t.query={...t.query,dataProductDefinitionsPath:e}),t.query),te={getValues:ml,setDdpPathToReqQuery:pl};zt.default.extend(os.default);var gl=["ABORTED","FAILED","EXPIRED"],vl=["SUBMITTED","STARTED","PICKED"];function yl(t){return Promise.all(t).then(e=>{let r=e.find(i=>typeof i.status=="number"||gl.includes(i.status));if(r)return r;let n=e.find(i=>vl.includes(i.status));return n||e[0]})}var us=async(t,e,r,n,i)=>{let{definitionsPath:a}=te.getValues(r),{type:s,reportId:o,executionId:u,id:l,tableId:c}=e.body,f=(await t.requestedReportService.getReportByExecutionId(u,i)).childExecutionData??[];s==="report"&&f.push({executionId:u,tableId:c,variantId:l});let d=f.map(g=>t.reportingService.getAsyncReportStatus(n,o,g.variantId,g.executionId,a,g.tableId));s==="dashboard"&&d.push(t.dashboardService.getAsyncStatus(n,o,l,u,a,c));let h=await yl(d);return{status:h.status,statusResponse:h}},ls=async({req:t,res:e,services:r})=>{let{token:n,userId:i}=te.getValues(e),{status:a,requestedAt:s}=t.body,o=["READY","EXPIRED","FAILED"],u,l,c;try{if({status:u,statusResponse:c}=await us(r,t,e,n,i),Sl({requestedAt:s,compareTime:new Date,durationMins:15})&&!o.includes(u))throw new Error("Request taking too long. Request Halted");if(u==="FAILED"){de.error(`Error: ${JSON.stringify(c.error)}`);let{userMessage:m,developerMessage:f}=c.error;m||f?l=c.error:l={developerMessage:c.error}}}catch(m){de.error(`Error: ${JSON.stringify(m)}`);let{data:f}=m;l=f||{userMessage:m.message},u=a==="FINISHED"?"EXPIRED":"FAILED"}return typeof u=="number"&&(u="FAILED"),{status:u,...l&&{errorMessage:l}}},cs=async({req:t,res:e,services:r})=>{let{token:n,userId:i}=te.getValues(e),{executionId:a,status:s}=t.body,o,u;try{({status:u}=await us(r,t,e,n,i))}catch(c){let{data:m}=c;o=(m??{}).userMessage,u=s==="READY"||s==="FINISHED"?"EXPIRED":"FAILED"}return{isExpired:{status:u,...o&&{errorMessage:o}}.status==="EXPIRED",executionId:a}},Sl=({requestedAt:t,compareTime:e,durationMins:r})=>{let n=(0,zt.default)(e),i=(0,zt.default)(t);return n.diff(i,"minutes")>=r};var ae=ue(Ze()),ps=ue(Dt()),gs=ue(fs());var gn=(t,e,r)=>{let{min:n,max:i}=t,a;n?a=hs(n,e):a=e;let s;return i?s=ds(i,r):s=r,{start:a,end:s}},hs=(t,e)=>{let r=new Date(t);return new Date(e)<r?t:e},ds=(t,e)=>{let r=new Date(t);return new Date(e)>r?t:e},wl=t=>{let{min:e,max:r,defaultValue:n}=t,i,a;e&&(i=e),r&&(a=r);let s=/^\d{1,4}-\d{1,2}-\d{2,2} - \d{1,4}-\d{1,2}-\d{1,2}$/,o;return n&&n.match(s)?([i,a]=n.split(" - "),o=gn(t,i,a)):n?o=n:o=gn(t,i,a),o};function bl(t){return t.start!==void 0||t.end!==void 0}var ms={compareMax:ds,compareMin:hs,isDateRange:bl,setDateRangeValuesWithinMinMax:gn,getStartAndEndValueFromDefinition:wl};ae.default.extend(ps.default);var Dl=(t,e,r,n)=>{ae.default.extend(gs.default);let i=(0,ae.default)(r),a=(0,ae.default)(n),s=t?t.isBetween(i,a,"day","[]"):!0,o=e?e.isBetween(i,a,"day","[]"):!0;return s&&o},vs=t=>{let e,r;switch(t){case"none":e="",r="";break;case"yesterday":e=(0,ae.default)(),r=e.subtract(1,"day");break;case"tomorrow":r=(0,ae.default)(),e=r.add(1,"day");break;case"last-week":e=(0,ae.default)(),r=e.subtract(1,"week");break;case"next-week":r=(0,ae.default)(),e=r.add(1,"week");break;case"last-month":e=(0,ae.default)(),r=e.subtract(1,"month");break;case"next-month":r=(0,ae.default)(),e=r.add(1,"month");break;default:break}return{endDate:e,startDate:r}},_l=(t,e,r)=>{let n=e.query[`${r}${t.name}.start`],i=e.query[`${r}${t.name}.end`],a=e.query[`${r}${t.name}.relative-duration`];return{start:n||t.min,end:i||t.max,...a&&{relative:a}}},Rl=(t,e)=>{let r=e.split(".")[0],n=Object.keys(t.body).filter(a=>a.includes(r)).map(a=>({name:a,value:t.body[a]})),i={start:"",end:""};return n.forEach(a=>{a.name.includes("start")&&(i.start=a.value),a.name.includes("end")&&(i.end=a.value)}),{value:i,name:r}},El=(t,e)=>{let r={start:"",end:""},{start:n,end:i}=t.value;return n&&(r.start=(0,ae.default)(n,"D/M/YYYY").format("YYYY-MM-DD").toString()),i&&(r.end=(0,ae.default)(i,"D/M/YYYY").format("YYYY-MM-DD").toString()),{...e,value:r}},ys=(t,e)=>{t||(t="1977-05-25"),e||(e="9999-01-01");let r=Ss();return r.forEach(n=>{if(n.value){let{endDate:i,startDate:a}=vs(n.value);Dl(a,i,t,e)||(n.disabled=!0)}}),r.filter(n=>n.value!=="none").every(n=>n.value===null||n.disabled)&&(r=[]),r},kl=t=>{let r=Ss().find(n=>n.value===t);return r?r.text:""},Ss=()=>[{value:"none",text:"None"},{value:"yesterday",text:"Yesterday"},{value:"tomorrow",text:"Tomorrow"},{value:"last-week",text:"Last week"},{value:"next-week",text:"Next week"},{value:"last-month",text:"Last month"},{value:"next-month",text:"Next month"}],Al=(t,e)=>{let r=ms.getStartAndEndValueFromDefinition(t),n=ys(t.min,t.max);return{...e,min:t.min,max:t.max,relativeOptions:n,value:r}},Ol=(t,e,r)=>{let n=t.defaultValue.split(" - "),i;return n.length>=1&&(i=`${r}${e}.start=${n[0]}`,n.length>=2&&(i=`${i}&${r}${e}.end=${n[1]}`)),i},ws={calcDates:vs,getRelativeDateOptions:ys,getFilterFromDefinition:Al,setValueFromRequest:_l,getQueryFromDefinition:Ol,mapRelativeValue:kl,setDefaultValue:Rl,setFilterValueFromDefault:El};var Ml=(t,e)=>{let r=[void 0,null,""];return t.filter(n=>n.value&&Object.prototype.hasOwnProperty.call(n.value,"start")&&!r.includes(n.value.start)||n.value&&Object.prototype.hasOwnProperty.call(n.value,"end")&&!r.includes(n.value.end)||n.value&&!Object.prototype.hasOwnProperty.call(n.value,"start")&&!Object.prototype.hasOwnProperty.call(n.value,"end")).filter(n=>n.value&&n.value!=="no-filter").map(n=>{let i=`${n.value}`,a=[`"${i}"`],s=[`${e}${n.name}`],o="",u=!1,l;n.type.toLowerCase()==="DateRange".toLowerCase()&&({key:s,value:a,disabled:u,cantRemoveClass:o,displayValue:i,constraints:l}=bs(n,e)),n.type.toLowerCase()==="GranularDateRange".toLowerCase()&&({key:s,value:a,disabled:u,cantRemoveClass:o,displayValue:i,constraints:l}=Rs(n,e)),n.type.toLowerCase()==="Date".toLowerCase()&&({key:s,value:a,disabled:u,cantRemoveClass:o,displayValue:i,constraints:l}=Tl(n,e)),(n.type.toLowerCase()==="Autocomplete".toLowerCase()||n.type.toLowerCase()==="Radio".toLowerCase()||n.type.toLowerCase()==="Select".toLowerCase())&&({key:s,value:a,displayValue:i}=Ds(n,e)),n.type.toLowerCase()==="Multiselect".toLowerCase()&&({key:s,value:a,displayValue:i}=_s(n,e));let c;return u?c=`Selected Filter: ${n.text}: ${i}. This filter cant be removed. Update the filter input to change the value`:c=`Selected Filter: ${n.text}: ${i}. Click to clear this filter`,{text:n.text,displayValue:i,key:JSON.stringify(s),value:a,disabled:u,constraints:l,classes:`interactive-remove-filter-button${o}`,attributes:{"aria-label":c}}})},bs=(t,e)=>{let r=t.value.start||"Open start",n=t.value.end||"Open end",i=`${e}${t.name}`,a=[`${i}.start`,`${i}.end`],s=[`"${r}"`,`"${n}"`],o=`${r} - ${n}`;t.value.relative&&(a.push(`${i}.relative-duration`),s.push(`"${t.value.relative}"`),o=ws.mapRelativeValue(t.value.relative));let u=vn(t,a),{disabled:l,cantRemoveClass:c,displayValue:m}=Es(t,s,o);return{key:a,value:s,displayValue:m||o,disabled:l,cantRemoveClass:c,constraints:u}},vn=(t,e,r=!1)=>{let n=[],{min:i,max:a}=t;return i&&n.push({key:e[0],value:i}),a&&!r&&n.push({key:e[1],value:a}),n.length?n:void 0},Ds=(t,e)=>{let n=t.options.find(s=>s.value===t.value).text,i=[`${e}${t.name}`],a=[`"${t.value}"`];return{key:i,value:a,displayValue:n}},_s=(t,e)=>{let n=t.value.split(","),i=n.map(o=>t.options.find(l=>l.value===o).text).filter((o,u)=>u<3).join(", ");i=n.length>3?`${i} + ${n.length-3} more`:i;let a=n.map(o=>`"${o}"`);return{key:[`${e}${t.name}`],value:a,displayValue:i}},Rs=(t,e)=>{let r=t.value.start||"Open start",n=t.value.end||"Open end",i=t.value.quickFilter?.value,a=`${e}${t.name}`,s=[`${a}.start`,`${a}.end`,`${a}.granularity`],o=[`"${r}"`,`"${n}"`,`"${t.value.granularity.value}"`],u=vn(t,s),l,c=t.value.granularity.display;i&&i!=="none"?(s.push(`${a}.quick-filter`),o.push(`"${t.value.quickFilter.value}"`),l=`${t.value.quickFilter.display}: ${c}`):l=`${r} - ${n}: ${c}`;let{disabled:m,cantRemoveClass:f,displayValue:d}=Es(t,o,l);return{key:s,value:o,displayValue:d||l,disabled:m,constraints:u,cantRemoveClass:f}},Tl=(t,e)=>{let r=[`${e}${t.name}`],n=`${t.value}`,i=[`"${n}"`],a=vn(t,r,!0),{disabled:s,cantRemoveClass:o,displayValue:u}=Il(t,i,n);return{key:r,value:i,displayValue:u||n,disabled:s,constraints:a,cantRemoveClass:o}},Es=(t,e,r)=>{let{min:n,max:i}=t;return n&&e[0].includes(n)&&i&&e[1].includes(i)?{disabled:!0,cantRemoveClass:" interactive-remove-filter-button--disabled",displayValue:`${r} (maximum range)`}:{disabled:!1,cantRemoveClass:"",displayValue:r}},Il=(t,e,r)=>{let{min:n,max:i}=t;if(n&&e[0].includes(n)||i&&e[0].includes(i)){let a;return e[0].includes(n)&&(a="min"),e[0].includes(i)&&(a="max"),{disabled:!0,cantRemoveClass:" interactive-remove-filter-button--disabled",displayValue:`${r} (${a} date)`}}return{disabled:!1,cantRemoveClass:"",displayValue:r}},Ll=(t,e)=>{let{query:r}=t,n="filters.";return e.filter(i=>r[`filters.${i.name}`]||r[`filters.${i.name}.start`]||r[`filters.${i.name}.end`]).map(i=>{let{value:a}=i;return i.type.toLowerCase()==="Multiselect".toLowerCase()&&(a=_s(i,"filters").displayValue),(i.type.toLowerCase()==="Autocomplete".toLowerCase()||i.type.toLowerCase()==="Radio".toLowerCase()||i.type.toLowerCase()==="Select".toLowerCase())&&(a=Ds(i,n).displayValue),i.type.toLowerCase()==="DateRange".toLowerCase()&&(a=bs(i,n).displayValue),i.type.toLowerCase()==="GranularDateRange".toLowerCase()&&(a=Rs(i,n).displayValue),{id:i.name,name:i.text,value:a}})},ks={getSelectedFilters:Ml,getQuerySummary:Ll};var Ht=(t,e,r,n)=>{let i=n==="EXPIRED"?"Refresh":"Retry";return`<div class="dpr-icon-wrapper__item-actions">
      <a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1' href="${t}">${i}</a>
      <a class="dpr-user-list-action govuk-link--no-visited-state dpr-remove-${r}-report-button"" href="#" data-execution-id='${e}'>Remove</a>
    </div>`},$l=t=>{let e="";switch(t){case"dashboard":e="govuk-tag--purple";break;case"unavailable":e="govuk-tag--grey";break;default:e="";break}return e},Qt=(t,e,r,n)=>{let i=n?"":"dpr-display-none",a=$l(r),s=Fl(r);return`<div>
  <p class="govuk-body govuk-!-margin-bottom-1"><strong>${e}</strong></p>
  <p class="govuk-body-s govuk-!-margin-bottom-3">${t}</p>
  <strong class="govuk-tag ${a} dpr-request-status-tag--small govuk-!-margin-bottom-4'">${s}</strong>
  <p class="govuk-body-xs govuk-!-margin-bottom-0 govuk-!-margin-top-3 ${i}">${n}</p>
</div>`};var As=(t,e,r,n,i=!0)=>{if(!i)return'<strong class="govuk-tag govuk-tag--red dpr-request-status-tag dpr-request-status-tag--small dpr-unauthorised-report" aria-label="You are unauthorised to view this report">Unauthorised</strong>';let a,s;return e==="unavailable"?(s="Request missing report",a=`<a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1 dpr-missing-report' href="${t}">${s}</a>`):(s=`Request ${e}`,r&&r==="sync"&&(s=`Load ${e}`),a=`<a class='dpr-user-list-action govuk-link--no-visited-state govuk-!-margin-bottom-1 dpr-live-report dpr-type__${e}' href="${t}">${s}</a>`,n&&(a=`${a}${n}`)),a},Fl=t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase(),Os=(t,e,r,n,i)=>{let a="";if(e==="unavailable")a=`dpr/request-missing-report/${r}/${n}/form`;else{let{pathSuffix:s,dpdPathFromQuery:o}=te.getValues(i),u=o?s:"";a=`dpr/request-report/${e}/${r}/${n}/filters${u}`,t&&t==="sync"&&(a=`dpr/view-report/sync/${e}/${r}/${n}/load-report${u}`)}return a};var Cs={getRequestStatus:async({req:t,res:e,services:r})=>{let{executionId:n,status:i}=t.body,a=e.locals.user?.uuid?e.locals.user.uuid:"userId",s=await ls({req:t,res:e,services:r});return i!==s.status&&(await r.requestedReportService.updateStatus(n,a,s.status,s.errorMessage),s.reportData=await r.requestedReportService.getReportByExecutionId(n,a)),s},filterReports:t=>!t.timestamp.lastViewed};var Ms={filterReports:t=>t.status==="READY"||t.executionId?.length&&t.status==="EXPIRED"};var Ts={createShowMoreHtml:(t,e)=>{let r=t?t.replace(/"/g,"'"):"";return`<div class="dpr-show-more" data-content="${r}" data-dpr-module="show-more" data-length="${e||100}">
      <div class='dpr-show-more-content'>${r}</div><a class="dpr-show-hide-button govuk-link--no-visited-state" href="#">show more</a>
  </div>`}};var Is={getCurrentVariantDefinition:(t,e,r)=>{if(!t){de.info("No definitions");return}let n,i=t.find(a=>a.id===e);return i&&(n=i.variants.find(a=>r===a.id)),n||void 0},getFieldDisplayName:(t,e)=>{let r=e.split("."),n=t.find(i=>i.name===r[0]);return n?r[1]?`${n.display} ${r[1]}`:n.display:e},getField:(t,e)=>t.find(r=>r.name===e),getReportSummary:async(t,e,r,n)=>(await e.getDefinitions(r,n)).find(a=>a.id===t)};var Nl=async t=>t.map(e=>ql(e)).sort((e,r)=>e.text.localeCompare(r.text)),ql=t=>{let e=JSON.parse(JSON.stringify(t)),{id:r,name:n,description:i,href:a,reportName:s,type:o}=e;return{id:r,reportName:s,text:n,description:i,href:a,type:o}},Pl=async(t,e,r,n,i)=>{let a=await Promise.all(t.sort((s,o)=>s.name.localeCompare(o.name)).map(async s=>Ul(s,e,r,n)));return{rows:i?a.slice(0,i):a,head:[{text:"Product",classes:"dpr-req-product-head"},{text:"Description",classes:"dpr-bm-description-head"},{text:"Actions",classes:"dpr-bm-actions-head"}]}},Ul=async(t,e,r,n)=>{let{description:i,reportName:a,reportId:s,id:o,href:u,name:l,type:c,loadType:m}=t,f=await e.createBookMarkToggleHtml({userId:n,reportId:s,id:o,csrfToken:r,ctxId:"bookmark-list",reportType:c});return[{html:Qt(a,l,c)},{html:Ts.createShowMoreHtml(i),classes:"dpr-req-cell"},{html:As(u,c,m,f),classes:"dpr-req-cell dpr-req-cell__status"}]},jl=async(t,e,r,n,i)=>{let a=[],{definitionsPath:s}=te.getValues(r);return await Promise.all(t.map(async o=>{let u,{reportId:l,variantId:c,id:m,automatic:f,type:d}=o,h=c||m,g=d||"report";try{let k,y,R,I="async",O=`/async/${g}/${l}/${h}/request`;if(g==="report"&&(u=await i.reportingService.getDefinition(n,l,h,s),R=u.name,k=u.variant.name,y=u.variant.description||u.description,I=u.variant.loadType||I,O=Os(I,g,l,h,r)),g==="dashboard"){let x=await Is.getReportSummary(l,i.reportingService,n,s);u=await i.dashboardService.getDefinition(n,l,h,s),k=u.name,R=x.name,y=u.description}u&&a.push({reportId:l,id:h,reportName:R,name:k,description:y,type:g,href:O,loadType:I,automatic:f})}catch{de.warn(`Failed to map bookmark for: Report ${l}, variant ${h}`);let y=r.locals.user?.uuid?r.locals.user.uuid:"userId";await i.bookmarkService.removeBookmark(y,h,l)}})),a},Ls={renderBookmarkList:async({services:t,maxRows:e,res:r,req:n})=>{let{token:i,csrfToken:a,userId:s,bookmarks:o}=te.getValues(r),u=await jl(o,n,r,i,t),l=await Nl(u),c=l.length;e&&(l=l.slice(0,e));let m=await Pl(u,t.bookmarkService,a,s,e),f={...l.length&&{href:"/dpr/my-reports/bookmarks/list"},...!l.length&&{emptyMessage:"You have 0 bookmarked reports"}},d={amount:c,shown:c>e?e:c,max:e};return{head:f,tableData:m,total:d,csrfToken:a,type:"bookmark"}}};var Fe=ue(Ze()),xs=ue(Dt());var vt=class{constructor(){this.isoDateRegEx=/^(\d{4}[/-](0?[1-9]|1[012])[/-](0?[1-9]|[12][0-9]|3[01]))/;this.localDateRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{4}$/;this.localDateShortYearRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{2}$/;this.localDateTimeRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{4} [0-2]\d:[0-5]\d$/;this.localDateTimeShortYearRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{2} [0-2]\d:[0-5]\d$/;this.isoFormat="YYYY-MM-DD";this.localDateFormatInput="D/M/YYYY";this.localDateFormatOutput="DD/MM/YYYY";this.localDateShortYearFormatInput="D/M/YY";this.localDateShortYearFormatOutput="DD/MM/YY";this.localDateTimeFormatInput="D/M/YYYY HH:mm";this.localDateTimeFormatOutput="DD/MM/YYYY HH:mm";this.localDateTimeShortYearFormatInput="D/M/YY HH:mm";this.localDateTimeShortYearFormatOutput="DD/MM/YY HH:mm"}getDateType(e){if(e&&e.match){if(e.match(this.isoDateRegEx))return"iso";if(e.match(this.localDateRegEx))return"local-date";if(e.match(this.localDateShortYearRegEx))return"local-date-short-year";if(e.match(this.localDateTimeRegEx))return"local-datetime";if(e.match(this.localDateTimeShortYearRegEx))return"local-datetime-short-year"}return"none"}getDateWrapper(e){switch(Fe.default.extend(xs.default),this.getDateType(e)){case"iso":return(0,Fe.default)(e);case"local-date":return(0,Fe.default)(e,this.localDateFormatInput);case"local-date-short-year":return(0,Fe.default)(e,this.localDateShortYearFormatInput);case"local-datetime":return(0,Fe.default)(e,this.localDateTimeFormatInput);case"local-datetime-short-year":return(0,Fe.default)(e,this.localDateTimeShortYearFormatInput);default:return null}}isDate(e){return this.getDateType(e)!=="none"}toDateString(e,r){let n=this.getDateWrapper(e);if(n)switch(r){case"iso":return n.format(this.isoFormat);case"local-date":return n.format(this.localDateFormatOutput);case"local-date-short-year":return n.format(this.localDateShortYearFormatOutput);case"local-datetime":return n.format(this.localDateTimeFormatOutput);case"local-datetime-short-year":return n.format(this.localDateTimeShortYearFormatOutput);default:return de.warn(`Invalid date type: ${r}`),null}return e&&de.warn(`Could not map non-date value : ${e}`),null}};var Bs=ue(Us());var js=t=>t&&t!==""?`?dataProductDefinitionsPath=${t}`:"";var yt=class{constructor(e){this.build=()=>this.userStoreItem;this.initialiseItem=()=>this.addReportData({type:this.requestFormData.type,reportId:this.requestFormData.reportId,reportName:this.requestFormData.reportName,description:this.requestFormData.description,id:this.requestFormData.id,name:this.requestFormData.name});this.addReportData=({type:e,reportId:r,reportName:n,description:i,id:a,name:s})=>(this.userStoreItem={type:e,reportId:r,reportName:n,description:i,id:a,name:s,timestamp:{}},this);this.addExecutionData=e=>(this.userStoreItem={...this.userStoreItem,...e},this);this.addChildExecutionData=e=>(this.userStoreItem={...this.userStoreItem,childExecutionData:e},this);this.addFilters=e=>{let r=new URLSearchParams(e).toString();return this.userStoreItem={...this.userStoreItem,filters:{data:e,queryString:r}},this};this.addSortData=e=>{let r=new URLSearchParams(e).toString();return this.userStoreItem={...this.userStoreItem,sortBy:{data:e,queryString:r}},this};this.addRequestUrls=e=>{let{origin:r,pathname:n,search:i,href:a,defaultInteractiveQueryString:s}=this.requestFormData,{executionId:o,dataProductDefinitionsPath:u,dpdPathFromQuery:l}=this.userStoreItem,c=l?`${js(u)}`:"",m=e.baseUrl.replace("/filters",`/${o}/status`),f=`${r}${m}`;return this.userStoreItem={...this.userStoreItem,url:{origin:r,request:{fullUrl:a,pathname:n,search:i},polling:{fullUrl:f,pathname:m},report:{...s?.length&&{search:c.length?`${c}&${s}`:`?${s}`,default:`?${s}`}}}},this};this.addAsyncUrls=e=>(this.userStoreItem={...this.userStoreItem,url:e},this);this.addReportUrls=e=>{let r=e.get("host"),n=`${e.protocol}://${e.get("host")}${e.originalUrl}`,i=(0,Bs.default)(e);return this.userStoreItem={...this.userStoreItem,url:{origin:r||this.userStoreItem.url.origin,...this.userStoreItem.url?.request&&{request:this.userStoreItem.url.request},...this.userStoreItem.url?.polling&&{polling:this.userStoreItem.url.polling},report:{...this.userStoreItem.url?.report&&this.userStoreItem.url.report,fullUrl:n,...i.search&&{search:i.search}}}},this};this.addLoadType=e=>(this.userStoreItem={...this.userStoreItem,loadType:e},this);this.addQuery=e=>(this.userStoreItem={...this.userStoreItem,query:{data:e.query,summary:e.querySummary}},this);this.addInteractiveQuery=e=>(e&&(this.userStoreItem={...this.userStoreItem,interactiveQuery:{data:e.query,summary:e.querySummary}}),this);this.addStatus=e=>(this.userStoreItem={...this.userStoreItem,status:e},this);this.addMetrics=e=>(this.userStoreItem={...this.userStoreItem,metrics:e.map(r=>({name:r.display}))},this);this.addTimestamp=()=>{let{status:e}=this.userStoreItem,r=new Date;switch(e){case"FAILED":this.userStoreItem.timestamp.failed=r;break;case"EXPIRED":this.userStoreItem.timestamp.expired=r;break;case"ABORTED":this.userStoreItem.timestamp.aborted=r;break;case"FINISHED":this.userStoreItem.timestamp.completed=r;break;case"SUBMITTED":this.userStoreItem.timestamp.requested=r;break;case"STARTED":case"PICKED":break;default:this.userStoreItem.timestamp.lastViewed=r;break}return this};this.addDefinitionsPath=(e,r)=>(e&&(this.userStoreItem={...this.userStoreItem,dataProductDefinitionsPath:e,dpdPathFromQuery:r}),this);this.requestFormData=e,this.requestFormData&&this.initialiseItem()}};var Vl=t=>{let e=JSON.parse(JSON.stringify(t)),{executionId:r,tableId:n,variantName:i,name:a,reportId:s,variantId:o,id:u,description:l,query:c,interactiveQuery:m,status:f,timestamp:d,reportName:h,dataProductDefinitionsPath:g,type:k,url:y}=e,R=[];c&&(R=c.summary);let I=[];m&&(I=m.summary);let O=k||"report";return{id:r,text:a||i,reportName:h,description:l,tag:"MIS",summary:R,interactiveSummary:I,timestamp:d,status:f,type:O,...Ql(f,e),meta:{reportId:s,id:o||u,executionId:r,tableId:n,status:f,type:O,dataProductDefinitionsPath:g,pollingUrl:y.polling?.pathname,reportUrl:y.report?.pathname}}},Yl=(t,e)=>({rows:t.map(n=>Gl(n,e)),head:[{text:"Product",classes:"dpr-req-product-head"},{text:"Filters",classes:"dpr-req-filters-head"},{text:"Status",classes:"dpr-req-status-head"},{text:"Actions",classes:"dpr-req-actions-head"}]}),Gl=(t,e)=>{let r,n="",{href:i,id:a,reportName:s,text:o,timestamp:u,type:l,status:c}=t;switch(c){case"FAILED":r="govuk-tag--red",n=Ht(i,a,e,c);break;case"EXPIRED":r="govuk-tag--grey",n=Ht(i,a,e,c);break;case"ABORTED":r="govuk-tag--orange",n=Ht(i,a,e,c);break;case"READY":case"FINISHED":n=`<a class=govuk-link govuk-link--no-visited-state dpr-type__${l}' href="${i}">Go to ${l}</a>`,r="govuk-tag--green";break;case"PICKED":case"SUBMITTED":case"STARTED":n=`<a class='govuk-link govuk-link--no-visited-state dpr-type__${l}' href="${i}">Go to status</a>`;break;default:break}let m="";return(t.summary||t.interactiveSummary)&&(m=Wl(t)),[{html:Qt(s,o,l,u)},{html:m},{html:`<strong class="govuk-tag dpr-request-status-tag ${r}">${c}</strong>`,classes:"dpr-req-cell dpr-req-cell__status"},{html:`${n}`,classes:"dpr-req-cell dpr-req-cell__status"}]},zl=(t,e)=>({amount:t,shown:t>e?e:t,max:e}),Wl=t=>{let e=t.summary.map(n=>`<li class="govuk-body-s dpr-query-summary"><strong>${n.name}</strong>: ${n.value}</li>`).join(""),r=t.interactiveSummary.map(n=>`<li class="govuk-body-s dpr-interactive-query-summary"><strong>${n.name}</strong>: ${n.value}</li>`).join("");return`<ul class="dpr-card-group__item__filters-list govuk-!-margin-top-0 govuk-!-margin-bottom-0">${e}${r}</ul>`},Hl=(t,e)=>{let{nestedBaseUrl:r}=te.getValues(e);return t.map(n=>({reportId:n.meta.reportId,id:n.meta.id,executionId:n.meta.executionId,tableId:n.meta.tableId,status:n.meta.status,requestedAt:n.meta.requestedAt,type:n.meta.type,dataProductDefinitionsPath:n.meta.dataProductDefinitionsPath,pollingUrl:n.meta.pollingUrl,reportUrl:n.meta.reportUrl,nestedBaseUrl:r}))},Ql=(t,e)=>{let r,n,i,{url:a,timestamp:s}=e,o=new vt;switch(t){case"FAILED":{i=s.failed?o.toDateString(s.failed,"local-date"):(0,Vs.default)().format("DD/MM/YYYY"),n=`${a.polling.fullUrl}`,r=`Failed at: ${i}`;break}case"ABORTED":{n=`${a.request.fullUrl}`,i=o.toDateString(s.aborted,"local-date"),r=`Aborted at: ${i}`;break}case"FINISHED":n=a.report.fullUrl,i=o.toDateString(s.completed,"local-date"),r=`Ready at: ${i}`;break;case"EXPIRED":{n=`${a.request.fullUrl}`,i=o.toDateString(s.expired,"local-date"),r=`Expired at: ${i}`;break}case"READY":{n=`${a.report.fullUrl}`,i=o.toDateString(s.lastViewed,"local-date"),r=`Last viewed: ${i}`;break}case"SUBMITTED":case"STARTED":case"PICKED":n=a.polling.fullUrl,i=o.toDateString(s.requested,"local-date"),r=`Requested at: ${i}`;break;default:i=o.toDateString(s.lastViewed,"local-date"),r=`Last viewed: ${i}`;break}return{timestamp:r,href:n}},Sn=async({res:t,reportsData:e,maxRows:r,filterFunction:n,type:i})=>{let{csrfToken:a}=te.getValues(t),s=e.filter(n).map(Vl),o=s.length;r&&(s=s.slice(0,r));let u=Yl(s,i),l=i==="requested"?"requested-reports":"recently-viewed";return{head:{...s.length&&{href:`dpr/my-reports/${l}/list`},...!s.length&&{emptyMessage:`You have 0 ${i} reports`}},tableData:u,total:zl(o,r),meta:Hl(s,t),csrfToken:a,maxRows:r}},Ys={renderList:Sn,updateExpiredStatus:async({req:t,res:e,services:r})=>{let{userId:n}=te.getValues(e),i=await cs({req:t,res:e,services:r});return i&&i.isExpired&&(await r.recentlyViewedService.setToExpired(i.executionId,n),await r.requestedReportService.setToExpired(i.executionId,n)),i?i.isExpired:!1},init:async({services:t,res:e,req:r,maxRows:n=6})=>{let{requestedReports:i,recentlyViewedReports:a,bookmarkingEnabled:s}=te.getValues(e),o=await Sn({res:e,reportsData:i,filterFunction:Cs.filterReports,maxRows:n,type:"requested"}),u=await Sn({res:e,reportsData:a,filterFunction:Ms.filterReports,maxRows:n,type:"viewed"}),l;return s&&(l=await Ls.renderBookmarkList({res:e,req:r,services:t,maxRows:n})),{requestedReports:o,viewedReports:u,bookmarks:l}},updateLastViewed:async({req:t,services:e,reportStateData:r,userId:n,filters:i})=>{let{type:a,reportId:s,reportName:o,description:u,id:l,name:c,executionId:m,tableId:f,query:d,url:h}=r,g={type:a,reportId:s,reportName:o,description:u,id:l,name:c},k={executionId:m,tableId:f},y=d?{query:d.data,querySummary:d.summary}:{query:{},querySummary:[]},R={query:t.query,querySummary:ks.getQuerySummary(t,i)},I=new yt().addReportData(g).addExecutionData(k).addQuery(y).addInteractiveQuery(R).addStatus("READY").addTimestamp().addAsyncUrls(h).addReportUrls(t).build();await e.requestedReportService.updateLastViewed(r.executionId,n),await e.recentlyViewedService.setRecentlyViewed(I,n)}};var Xt=class{constructor(e,r){this.POST=async(e,r,n)=>{try{let i=await Ys.updateExpiredStatus({req:e,res:r,services:this.services});r.send({isExpired:i})}catch{r.send({status:"FAILED"})}};this.layoutPath=e,this.services=r}};
/*! Bundled license information:

parseurl/index.js:
  (*!
   * parseurl
   * Copyright(c) 2014 Jonathan Ong
   * Copyright(c) 2014-2017 Douglas Christopher Wilson
   * MIT Licensed
   *)
*/
//# sourceMappingURL=controller.js.map