@budibase/cli 3.23.4 → 3.23.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -3
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1266,8 +1266,9 @@ Column: `+$.column+`
|
|
|
1266
1266
|
Char: `+$.c),Y=new Error(Y),$.error=Y,J($,"onerror",Y),$}s(le,"error");function X($){return $.sawRoot&&!$.closedRoot&&F($,"Unclosed root tag"),$.state!==L.BEGIN&&$.state!==L.BEGIN_WHITESPACE&&$.state!==L.TEXT&&le($,"Unexpected end"),de($),$.c="",$.closed=!0,J($,"onend"),r.call($,$.strict,$.opt),$}s(X,"end");function F($,Y){if(typeof $!="object"||!($ instanceof r))throw new Error("bad call to strictFail");$.strict&&le($,Y)}s(F,"strictFail");function D($){$.strict||($.tagName=$.tagName[$.looseCase]());var Y=$.tags[$.tags.length-1]||$,ve=$.tag={name:$.tagName,attributes:{}};$.opt.xmlns&&(ve.ns=Y.ns),$.attribList.length=0,te($,"onopentagstart",ve)}s(D,"newTag");function be($,Y){var ve=$.indexOf(":"),he=ve<0?["",$]:$.split(":"),lt=he[0],Ve=he[1];return Y&&$==="xmlns"&&(lt="xmlns",Ve=""),{prefix:lt,local:Ve}}s(be,"qname");function ee($){if($.strict||($.attribName=$.attribName[$.looseCase]()),$.attribList.indexOf($.attribName)!==-1||$.tag.attributes.hasOwnProperty($.attribName)){$.attribName=$.attribValue="";return}if($.opt.xmlns){var Y=be($.attribName,!0),ve=Y.prefix,he=Y.local;if(ve==="xmlns")if(he==="xml"&&$.attribValue!==p)F($,"xml: prefix must be bound to "+p+`
|
|
1267
1267
|
Actual: `+$.attribValue);else if(he==="xmlns"&&$.attribValue!==h)F($,"xmlns: prefix must be bound to "+h+`
|
|
1268
1268
|
Actual: `+$.attribValue);else{var lt=$.tag,Ve=$.tags[$.tags.length-1]||$;lt.ns===Ve.ns&&(lt.ns=Object.create(Ve.ns)),lt.ns[he]=$.attribValue}$.attribList.push([$.attribName,$.attribValue])}else $.tag.attributes[$.attribName]=$.attribValue,te($,"onattribute",{name:$.attribName,value:$.attribValue});$.attribName=$.attribValue=""}s(ee,"attrib");function _e($,Y){if($.opt.xmlns){var ve=$.tag,he=be($.tagName);ve.prefix=he.prefix,ve.local=he.local,ve.uri=ve.ns[he.prefix]||"",ve.prefix&&!ve.uri&&(F($,"Unbound namespace prefix: "+JSON.stringify($.tagName)),ve.uri=he.prefix);var lt=$.tags[$.tags.length-1]||$;ve.ns&<.ns!==ve.ns&&Object.keys(ve.ns).forEach(function(Oi){te($,"onopennamespace",{prefix:Oi,uri:ve.ns[Oi]})});for(var Ve=0,It=$.attribList.length;Ve<It;Ve++){var er=$.attribList[Ve],mt=er[0],pr=er[1],pn=be(mt,!0),an=pn.prefix,Or=pn.local,xn=an===""?"":ve.ns[an]||"",Di={name:mt,value:pr,prefix:an,local:Or,uri:xn};an&&an!=="xmlns"&&!xn&&(F($,"Unbound namespace prefix: "+JSON.stringify(an)),Di.uri=an),$.tag.attributes[mt]=Di,te($,"onattribute",Di)}$.attribList.length=0}$.tag.isSelfClosing=!!Y,$.sawRoot=!0,$.tags.push($.tag),te($,"onopentag",$.tag),Y||(!$.noscript&&$.tagName.toLowerCase()==="script"?$.state=L.SCRIPT:$.state=L.TEXT,$.tag=null,$.tagName=""),$.attribName=$.attribValue="",$.attribList.length=0}s(_e,"openTag");function Le($){if(!$.tagName){F($,"Weird empty close tag."),$.textNode+="</>",$.state=L.TEXT;return}if($.script){if($.tagName!=="script"){$.script+="</"+$.tagName+">",$.tagName="",$.state=L.SCRIPT;return}te($,"onscript",$.script),$.script=""}var Y=$.tags.length,ve=$.tagName;$.strict||(ve=ve[$.looseCase]());for(var he=ve;Y--;){var lt=$.tags[Y];if(lt.name!==he)F($,"Unexpected close tag");else break}if(Y<0){F($,"Unmatched closing tag: "+$.tagName),$.textNode+="</"+$.tagName+">",$.state=L.TEXT;return}$.tagName=ve;for(var Ve=$.tags.length;Ve-- >Y;){var It=$.tag=$.tags.pop();$.tagName=$.tag.name,te($,"onclosetag",$.tagName);var er={};for(var mt in It.ns)er[mt]=It.ns[mt];var pr=$.tags[$.tags.length-1]||$;$.opt.xmlns&&It.ns!==pr.ns&&Object.keys(It.ns).forEach(function(pn){var an=It.ns[pn];te($,"onclosenamespace",{prefix:pn,uri:an})})}Y===0&&($.closedRoot=!0),$.tagName=$.attribValue=$.attribName="",$.attribList.length=0,$.state=L.TEXT}s(Le,"closeTag");function je($){var Y=$.entity,ve=Y.toLowerCase(),he,lt="";return $.ENTITIES[Y]?$.ENTITIES[Y]:$.ENTITIES[ve]?$.ENTITIES[ve]:(Y=ve,Y.charAt(0)==="#"&&(Y.charAt(1)==="x"?(Y=Y.slice(2),he=parseInt(Y,16),lt=he.toString(16)):(Y=Y.slice(1),he=parseInt(Y,10),lt=he.toString(10))),Y=Y.replace(/^0+/,""),isNaN(he)||lt.toLowerCase()!==Y?(F($,"Invalid character entity"),"&"+$.entity+";"):String.fromCodePoint(he))}s(je,"parseEntity");function fe($,Y){Y==="<"?($.state=L.OPEN_WAKA,$.startTagPosition=$.position):I(Y)||(F($,"Non-whitespace before first tag."),$.textNode=Y,$.state=L.TEXT)}s(fe,"beginWhiteSpace");function Ce($,Y){var ve="";return Y<$.length&&(ve=$.charAt(Y)),ve}s(Ce,"charAt");function Ie($){var Y=this;if(this.error)throw this.error;if(Y.closed)return le(Y,"Cannot write after close. Assign an onready handler.");if($===null)return X(Y);typeof $=="object"&&($=$.toString());for(var ve=0,he="";he=Ce($,ve++),Y.c=he,!!he;)switch(Y.trackPosition&&(Y.position++,he===`
|
|
1269
|
-
`?(Y.line++,Y.column=0):Y.column++),Y.state){case L.BEGIN:if(Y.state=L.BEGIN_WHITESPACE,he==="\uFEFF")continue;fe(Y,he);continue;case L.BEGIN_WHITESPACE:fe(Y,he);continue;case L.TEXT:if(Y.sawRoot&&!Y.closedRoot){for(var
|
|
1270
|
-
`?(Y.line++,Y.column=0):Y.column++);Y.textNode+=$.substring(lt,ve-1)}he==="<"&&!(Y.sawRoot&&Y.closedRoot&&!Y.strict)?(Y.state=L.OPEN_WAKA,Y.startTagPosition=Y.position):(!I(he)&&(!Y.sawRoot||Y.closedRoot)&&F(Y,"Text data outside of root node."),he==="&"?Y.state=L.TEXT_ENTITY:Y.textNode+=he);continue;case L.SCRIPT:he==="<"?Y.state=L.SCRIPT_ENDING:Y.script+=he;continue;case L.SCRIPT_ENDING:he==="/"?Y.state=L.CLOSE_TAG:(Y.script+="<"+he,Y.state=L.SCRIPT);continue;case L.OPEN_WAKA:if(he==="!")Y.state=L.SGML_DECL,Y.sgmlDecl="";else if(!I(he))if(B(y,he))Y.state=L.OPEN_TAG,Y.tagName=he;else if(he==="/")Y.state=L.CLOSE_TAG,Y.tagName="";else if(he==="?")Y.state=L.PROC_INST,Y.procInstName=Y.procInstBody="";else{if(F(Y,"Unencoded <"),Y.startTagPosition+1<Y.position){var Ve=Y.position-Y.startTagPosition;he=new Array(Ve).join(" ")+he}Y.textNode+="<"+he,Y.state=L.TEXT}continue;case L.SGML_DECL:if(Y.sgmlDecl+he==="--"){Y.state=L.COMMENT,Y.comment="",Y.sgmlDecl="";continue}Y.doctype&&Y.doctype!==!0&&Y.sgmlDecl?(Y.state=L.DOCTYPE_DTD,Y.doctype+="<!"+Y.sgmlDecl+he,Y.sgmlDecl=""):(Y.sgmlDecl+he).toUpperCase()===f?(te(Y,"onopencdata"),Y.state=L.CDATA,Y.sgmlDecl="",Y.cdata=""):(Y.sgmlDecl+he).toUpperCase()===d?(Y.state=L.DOCTYPE,(Y.doctype||Y.sawRoot)&&F(Y,"Inappropriately located doctype declaration"),Y.doctype="",Y.sgmlDecl=""):he===">"?(te(Y,"onsgmldeclaration",Y.sgmlDecl),Y.sgmlDecl="",Y.state=L.TEXT):(N(he)&&(Y.state=L.SGML_DECL_QUOTED),Y.sgmlDecl+=he);continue;case L.SGML_DECL_QUOTED:he===Y.q&&(Y.state=L.SGML_DECL,Y.q=""),Y.sgmlDecl+=he;continue;case L.DOCTYPE:he===">"?(Y.state=L.TEXT,te(Y,"ondoctype",Y.doctype),Y.doctype=!0):(Y.doctype+=he,he==="["?Y.state=L.DOCTYPE_DTD:N(he)&&(Y.state=L.DOCTYPE_QUOTED,Y.q=he));continue;case L.DOCTYPE_QUOTED:Y.doctype+=he,he===Y.q&&(Y.q="",Y.state=L.DOCTYPE);continue;case L.DOCTYPE_DTD:he==="]"?(Y.doctype+=he,Y.state=L.DOCTYPE):he==="<"?(Y.state=L.OPEN_WAKA,Y.startTagPosition=Y.position):N(he)?(Y.doctype+=he,Y.state=L.DOCTYPE_DTD_QUOTED,Y.q=he):Y.doctype+=he;continue;case L.DOCTYPE_DTD_QUOTED:Y.doctype+=he,he===Y.q&&(Y.state=L.DOCTYPE_DTD,Y.q="");continue;case L.COMMENT:he==="-"?Y.state=L.COMMENT_ENDING:Y.comment+=he;continue;case L.COMMENT_ENDING:he==="-"?(Y.state=L.COMMENT_ENDED,Y.comment=U(Y.opt,Y.comment),Y.comment&&te(Y,"oncomment",Y.comment),Y.comment=""):(Y.comment+="-"+he,Y.state=L.COMMENT);continue;case L.COMMENT_ENDED:he!==">"?(F(Y,"Malformed comment"),Y.comment+="--"+he,Y.state=L.COMMENT):Y.doctype&&Y.doctype!==!0?Y.state=L.DOCTYPE_DTD:Y.state=L.TEXT;continue;case L.CDATA:he==="]"?Y.state=L.CDATA_ENDING:Y.cdata+=he;continue;case L.CDATA_ENDING:he==="]"?Y.state=L.CDATA_ENDING_2:(Y.cdata+="]"+he,Y.state=L.CDATA);continue;case L.CDATA_ENDING_2:he===">"?(Y.cdata&&te(Y,"oncdata",Y.cdata),te(Y,"onclosecdata"),Y.cdata="",Y.state=L.TEXT):he==="]"?Y.cdata+="]":(Y.cdata+="]]"+he,Y.state=L.CDATA);continue;case L.PROC_INST:he==="?"?Y.state=L.PROC_INST_ENDING:I(he)?Y.state=L.PROC_INST_BODY:Y.procInstName+=he;continue;case L.PROC_INST_BODY:if(!Y.procInstBody&&I(he))continue;he==="?"?Y.state=L.PROC_INST_ENDING:Y.procInstBody+=he;continue;case L.PROC_INST_ENDING:he===">"?(te(Y,"onprocessinginstruction",{name:Y.procInstName,body:Y.procInstBody}),Y.procInstName=Y.procInstBody="",Y.state=L.TEXT):(Y.procInstBody+="?"+he,Y.state=L.PROC_INST_BODY);continue;case L.OPEN_TAG:B(b,he)?Y.tagName+=he:(D(Y),he===">"?_e(Y):he==="/"?Y.state=L.OPEN_TAG_SLASH:(I(he)||F(Y,"Invalid character in tag name"),Y.state=L.ATTRIB));continue;case L.OPEN_TAG_SLASH:he===">"?(_e(Y,!0),Le(Y)):(F(Y,"Forward-slash in opening tag not followed by >"),Y.state=L.ATTRIB);continue;case L.ATTRIB:if(I(he))continue;he===">"?_e(Y):he==="/"?Y.state=L.OPEN_TAG_SLASH:B(y,he)?(Y.attribName=he,Y.attribValue="",Y.state=L.ATTRIB_NAME):F(Y,"Invalid attribute name");continue;case L.ATTRIB_NAME:he==="="?Y.state=L.ATTRIB_VALUE:he===">"?(F(Y,"Attribute without value"),Y.attribValue=Y.attribName,ee(Y),_e(Y)):I(he)?Y.state=L.ATTRIB_NAME_SAW_WHITE:B(b,he)?Y.attribName+=he:F(Y,"Invalid attribute name");continue;case L.ATTRIB_NAME_SAW_WHITE:if(he==="=")Y.state=L.ATTRIB_VALUE;else{if(I(he))continue;F(Y,"Attribute without value"),Y.tag.attributes[Y.attribName]="",Y.attribValue="",te(Y,"onattribute",{name:Y.attribName,value:""}),Y.attribName="",he===">"?_e(Y):B(y,he)?(Y.attribName=he,Y.state=L.ATTRIB_NAME):(F(Y,"Invalid attribute name"),Y.state=L.ATTRIB)}continue;case L.ATTRIB_VALUE:if(I(he))continue;N(he)?(Y.q=he,Y.state=L.ATTRIB_VALUE_QUOTED):(Y.opt.unquotedAttributeValues||le(Y,"Unquoted attribute value"),Y.state=L.ATTRIB_VALUE_UNQUOTED,Y.attribValue=he);continue;case L.ATTRIB_VALUE_QUOTED:if(he!==Y.q){he==="&"?Y.state=L.ATTRIB_VALUE_ENTITY_Q:Y.attribValue+=he;continue}ee(Y),Y.q="",Y.state=L.ATTRIB_VALUE_CLOSED;continue;case L.ATTRIB_VALUE_CLOSED:I(he)?Y.state=L.ATTRIB:he===">"?_e(Y):he==="/"?Y.state=L.OPEN_TAG_SLASH:B(y,he)?(F(Y,"No whitespace between attributes"),Y.attribName=he,Y.attribValue="",Y.state=L.ATTRIB_NAME):F(Y,"Invalid attribute name");continue;case L.ATTRIB_VALUE_UNQUOTED:if(!T(he)){he==="&"?Y.state=L.ATTRIB_VALUE_ENTITY_U:Y.attribValue+=he;continue}ee(Y),he===">"?_e(Y):Y.state=L.ATTRIB;continue;case L.CLOSE_TAG:if(Y.tagName)he===">"?Le(Y):B(b,he)?Y.tagName+=he:Y.script?(Y.script+="</"+Y.tagName,Y.tagName="",Y.state=L.SCRIPT):(I(he)||F(Y,"Invalid tagname in closing tag"),Y.state=L.CLOSE_TAG_SAW_WHITE);else{if(I(he))continue;Q(y,he)?Y.script?(Y.script+="</"+he,Y.state=L.SCRIPT):F(Y,"Invalid tagname in closing tag."):Y.tagName=he}continue;case L.CLOSE_TAG_SAW_WHITE:if(I(he))continue;he===">"?Le(Y):F(Y,"Invalid characters in closing tag");continue;case L.TEXT_ENTITY:case L.ATTRIB_VALUE_ENTITY_Q:case L.ATTRIB_VALUE_ENTITY_U:var It,er;switch(Y.state){case L.TEXT_ENTITY:It=L.TEXT,er="textNode";break;case L.ATTRIB_VALUE_ENTITY_Q:It=L.ATTRIB_VALUE_QUOTED,er="attribValue";break;case L.ATTRIB_VALUE_ENTITY_U:It=L.ATTRIB_VALUE_UNQUOTED,er="attribValue";break}if(he===";"){var mt=je(Y);Y.opt.unparsedEntities&&!Object.values(e.XML_ENTITIES).includes(mt)?(Y.entity="",Y.state=It,Y.write(mt)):(Y[er]+=mt,Y.entity="",Y.state=It)}else B(Y.entity.length?C:v,he)?Y.entity+=he:(F(Y,"Invalid character in entity name"),Y[er]+="&"+Y.entity+he,Y.entity="",Y.state=It);continue;default:throw new Error(Y,"Unknown state: "+Y.state)}return Y.position>=Y.bufferCheckPosition&&n(Y),Y}s(Ie,"write");String.fromCodePoint||function(){var $=String.fromCharCode,Y=Math.floor,ve=s(function(){var he=16384,lt=[],Ve,It,er=-1,mt=arguments.length;if(!mt)return"";for(var pr="";++er<mt;){var pn=Number(arguments[er]);if(!isFinite(pn)||pn<0||pn>1114111||Y(pn)!==pn)throw RangeError("Invalid code point: "+pn);pn<=65535?lt.push(pn):(pn-=65536,Ve=(pn>>10)+55296,It=pn%1024+56320,lt.push(Ve,It)),(er+1===mt||lt.length>he)&&(pr+=$.apply(null,lt),lt.length=0)}return pr},"fromCodePoint");Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:ve,configurable:!0,writable:!0}):String.fromCodePoint=ve}()})(typeof S2e>"u"?S2e.sax={}:S2e)});var aki=A(Uj=>{"use strict";(function(){var e,t,r,n={}.hasOwnProperty,i=s(function(a,c){for(var u in c)n.call(c,u)&&(a[u]=c[u]);function l(){this.constructor=a}return s(l,"ctor"),l.prototype=c.prototype,a.prototype=new l,a.__super__=c.prototype,a},"__extends"),o=s(function(a,c){return function(){return a.apply(c,arguments)}},"__bind");r=oki(),e=require("events"),t=s(function(a){return typeof a=="object"&&a!=null&&Object.keys(a).length===0},"isEmpty"),Uj.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null}},Uj.ValidationError=function(a){i(c,a),c.name="ValidationError";function c(u){this.message=u}return s(c,"ValidationError"),c}(Error),Uj.Parser=function(a){i(c,a),c.name="Parser";function c(u){this.parseString=o(this.parseString,this),this.reset=o(this.reset,this);var l,f,d;this.options={},d=Uj.defaults["0.1"];for(l in d)n.call(d,l)&&(f=d[l],this.options[l]=f);for(l in u)n.call(u,l)&&(f=u[l],this.options[l]=f);this.reset()}return s(c,"Parser"),c.prototype.reset=function(){var u,l,f,d,p=this;return this.removeAllListeners(),this.saxParser=r.parser(!0,{trim:!1,normalize:!1}),f=!1,this.saxParser.onerror=function(h){if(!f)return f=!0,p.emit("error",h)},this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,d=[],u=this.options.attrkey,l=this.options.charkey,this.saxParser.onopentag=function(h){var g,y,b;if(y={},y[l]="",!p.options.ignoreAttrs){b=h.attributes;for(g in b)n.call(b,g)&&(!(u in y)&&!p.options.mergeAttrs&&(y[u]={}),p.options.mergeAttrs?y[g]=h.attributes[g]:y[u][g]=h.attributes[g])}return y["#name"]=h.name,d.push(y)},this.saxParser.onclosetag=function(){var h,g,y,b,v,C;return y=d.pop(),g=y["#name"],delete y["#name"],v=d[d.length-1],y[l].match(/^\s*$/)?delete y[l]:(p.options.trim&&(y[l]=y[l].trim()),p.options.normalize&&(y[l]=y[l].replace(/\s{2,}/g," ").trim()),Object.keys(y).length===1&&l in y&&!p.EXPLICIT_CHARKEY&&(y=y[l])),p.options.emptyTag!==void 0&&t(y)&&(y=p.options.emptyTag),p.options.validator!=null&&(C="/"+function(){var I,N,T;for(T=[],I=0,N=d.length;I<N;I++)h=d[I],T.push(h["#name"]);return T}().concat(g).join("/"),y=p.options.validator(C,v&&v[g],y)),d.length>0?p.options.explicitArray?(v[g]instanceof Array||(v[g]=[]),v[g].push(y)):g in v?(v[g]instanceof Array||(b=v[g],v[g]=[b]),v[g].push(y)):v[g]=y:(p.options.explicitRoot&&(b=y,y={},y[g]=b),p.resultObject=y,p.emit("end",p.resultObject))},this.saxParser.ontext=this.saxParser.oncdata=function(h){var g;if(g=d[d.length-1],g)return g[l]+=h}},c.prototype.parseString=function(u,l){if(l!=null&&typeof l=="function"&&(this.on("end",function(f){return this.reset(),l(null,f)}),this.on("error",function(f){return this.reset(),l(f)})),u.toString().trim()==="")return this.emit("end",null),!0;try{return this.saxParser.write(u.toString())}catch(f){if(f instanceof Uj.ValidationError)return this.emit("error",f.message);throw f}},c}(e.EventEmitter)}).call(Uj)});var dki=A(QW=>{"use strict";var Que=ski(),Afu=require("dns"),Uue=require("http"),FW=require("https"),yfu=aki(),Fue=require("url"),_fu=require("querystring"),Efu="application/json",bfu="application/xrd+xml",que=s(function(e,t){var r=s(function(o,a){var c,u;a.hasOwnProperty("@")&&(a["@"].hasOwnProperty("type")&&(c=a["@"].type),a["@"].hasOwnProperty("xsi:nil")&&a["@"]["xsi:nil"]=="true"?o[c]=null:a.hasOwnProperty("#")&&(o[c]=a["#"]))},"getProperty"),n=s(function(o,a){var c="default";typeof a=="string"?o[c]=a:(a.hasOwnProperty("@")&&a["@"].hasOwnProperty("xml:lang")&&(c=a["@"]["xml:lang"]),a.hasOwnProperty("#")&&(o[c]=a["#"]))},"getTitle"),i=s(function(o){var a,c,u,l,f,d,p;if(u={},o.hasOwnProperty("@"))for(a in o["@"])o["@"].hasOwnProperty(a)&&(u[a]=o["@"][a]);if(o.hasOwnProperty("Property"))if(u.properties={},Array.isArray(o.Property))for(c=0;c<o.Property.length;c++)r(u.properties,o.Property[c]);else r(u.properties,o.Property);if(o.hasOwnProperty("Title"))if(u.titles={},Array.isArray(o.Title))for(c=0;c<o.Title.length;c++)n(u.titles,o.Title[c]);else n(u.titles,o.Title);return u},"getLink");Que(function(){var o=new yfu.Parser;o.parseString(e,this)},function(o,a){var c,u={},l,f,d;if(o)t(o,null);else{if(a.hasOwnProperty("Subject")&&(Array.isArray(a.Subject)?u.subject=a.Subject[0]:u.subject=a.Subject),a.hasOwnProperty("Expires")&&(Array.isArray(a.Expires)?u.expires=a.Expires[0]:u.expires=a.Expires),a.hasOwnProperty("Alias")&&(Array.isArray(a.Alias)?u.aliases=a.Alias:u.aliases=[a.Alias]),a.hasOwnProperty("Property"))if(u.properties={},Array.isArray(a.Property))for(l=0;l<a.Property.length;l++)r(u.properties,a.Property[l]);else r(u.properties,a.Property);if(a.hasOwnProperty("Link"))if(c=a.Link,u.links=[],Array.isArray(c))for(l=0;l<c.length;l++)u.links.push(i(c[l]));else u.links.push(i(c));t(null,u)}})},"xrd2jrd"),qW=s(function(e,t){var r;try{r=JSON.parse(e),t(null,r)}catch(n){t(n,null)}},"jrd"),zB=s(function(e,t,r,n){var i=[],o;for(o in r)r.hasOwnProperty(o)&&i.push(o);var a=e.request(t,function(c){var u="";c.setEncoding("utf8"),c.on("data",function(l){u=u+l}),c.on("error",function(l){n(l,null)}),c.on("end",function(){var l,f,d,p;if(c.statusCode>300&&c.statusCode<400&&c.headers.location){if(p=Fue.parse(c.headers.location),t.httpsOnly&&p.protocol!="https:"){n(new Error("Refusing to redirect to non-HTTPS url: "+c.headers.location),null);return}p.httpsOnly=t.httpsOnly,zB(p.protocol=="https:"?FW:Uue,p,r,n);return}else if(c.statusCode!==200){n(new Error("Bad response code: "+c.statusCode+":"+u),null);return}if(!c.headers["content-type"]){n(new Error("No Content-Type header"),null);return}if(l=c.headers["content-type"],f=i.filter(function(h){return l.substr(0,h.length)==h}),f.length==0){n(new Error("Content-Type '"+l+"' does not match any expected types: "+i.join(",")),null);return}d=r[f],d(u,n)})});a.on("error",function(c){n(c,null)}),a.end()},"request"),vfu=s(function(e,t){var r={hostname:e,port:80,path:"/.well-known/host-meta",method:"GET",headers:{accept:"application/json, application/xrd+xml; q=0.5"}};zB(Uue,r,{"application/json":qW,"application/xrd+xml":que},t)},"httpHostMeta"),Sfu=s(function(e,t){var r={hostname:e,port:80,path:"/.well-known/host-meta.json",method:"GET"};zB(Uue,r,{"application/json":qW},t)},"httpHostMetaJSON"),wfu=s(function(e,t,r){var n={hostname:e,port:443,path:"/.well-known/host-meta",method:"GET",headers:{accept:"application/json, application/xrd+xml; q=0.5"},httpsOnly:t};zB(FW,n,{"application/json":qW,"application/xrd+xml":que},r)},"httpsHostMeta"),Tfu=s(function(e,t,r){var n={hostname:e,port:443,path:"/.well-known/host-meta.json",method:"GET",httpsOnly:t};zB(FW,n,{"application/json":qW},r)},"httpsHostMetaJSON"),uki=s(function(e){var t=["example.com","example.org","example.net"],r=["example","invalid"],n;return t.indexOf(e.toLowerCase())!=-1||(n=e.split("."),r.indexOf(n[n.length-1])!=-1)},"invalidHostname"),rjt=s(function(e,t,r){if(r||(r=t,t={}),uki(e)){r(new Error("Invalid hostname: "+e),null);return}Que(function(){Afu.lookup(e,this)},function(n,i,o){if(n){r(n,null);return}else Tfu(i,t.httpsOnly,this)},function(n,i){n?n.code=="ECONNREFUSED"?this(n,null):wfu(e,t.httpsOnly,this):r(null,i)},function(n,i){n?t.httpsOnly?r(new Error("No HTTPS endpoint worked"),null):Sfu(e,this):r(null,i)},function(n,i){n?n.code=="ECONNREFUSED"?this(n,null):vfu(e,this):r(null,i)},function(n,i){n?r(new Error("Unable to get host-meta or host-meta.json"),null):r(null,i)})},"hostmeta"),cki=s(function(e,t,r,n){var i,o,a;i={resource:t},r&&(i.rel=r),o=_fu.stringify(i),a={hostname:e,port:443,path:"/.well-known/webfinger?"+o,method:"GET",httpsOnly:!0},zB(FW,a,{"application/json":qW},n)},"httpsWebfinger"),tjt=s(function(e,t,r,n,i){Que(function(){var o=e.replace("{uri}",encodeURIComponent(t)),a=Fue.parse(o);a.httpsOnly=n,zB(a.protocol=="https:"?FW:Uue,a,r,this)},function(o,a){var c,u;if(o)if(t.substr(0,5)=="acct:")c=e.replace("{uri}",encodeURIComponent(t.substr(5))),u=Fue.parse(c),u.httpsOnly=n,zB(u.protocol=="https:"?FW:Uue,u,r,this);else throw o;else{i(null,a);return}},function(o,a){o?i(o,null):i(null,a)})},"template"),lki=s(function(e,t,r){var n,i;r||(r=t,t={}),e.indexOf(":")===-1&&e.indexOf("@")!==-1&&(e="acct:"+e),n=Fue.parse(e),i=n.hostname,Que(function(){rjt(i,t,this)},function(o,a){var c,u,l;if(o)throw o;if(!a.hasOwnProperty("links"))throw new Error("No links in host-meta");if(c=a.links.filter(function(f){return f.hasOwnProperty("rel")&&f.rel=="lrdd"&&f.hasOwnProperty("template")&&(!t.httpsOnly||f.template.substr(0,6)=="https:")}),!c||c.length===0)throw new Error("No lrdd links with templates in host-meta");if(u=c.filter(function(f){return f.hasOwnProperty("type")&&f.type==Efu}),u&&u.length>0){tjt(u[0].template,e,{"application/json":qW},t.httpsOnly,this);return}if(l=c.filter(function(f){return f.hasOwnProperty("type")&&f.type==bfu}),l&&l.length>0){tjt(l[0].template,e,{"application/xrd+xml":que},t.httpsOnly,this);return}if(l=c.filter(function(f){return!f.hasOwnProperty("type")}),l&&l.length>0){tjt(l[0].template,e,{"application/xrd+xml":que},t.httpsOnly,this);return}throw new Error("No lrdd links with templates and acceptable type in host-meta")},r)},"lrdd"),fki=s(function(e,t,r,n){var i,o;if(n||(n=r,r={}),n||(n=t,t=null),e.indexOf(":")===-1&&e.indexOf("@")!==-1&&(e="acct:"+e),i=Fue.parse(e),o=i.hostname,uki(o)){n(new Error("Invalid hostname: "+o),null);return}Que(function(){cki(o,e,t,this)},function(a,c){if(a)if(e.substr(0,5)=="acct:")cki(o,e.substr(5),t,this);else throw a;else{n(null,c);return}},function(a,c){if(!a){n(null,c);return}if(r.webfingerOnly)throw new Error("Unable to find webfinger");lki(e,r,this)},n)},"webfinger"),Cfu=s(function(e,t){e.indexOf("@")!==-1?fki(e,t):rjt(e,t)},"discover");QW.xrd2jrd=que;QW.webfinger=fki;QW.lrdd=lki;QW.hostmeta=rjt;QW.discover=Cfu});var mki=A((z$f,hki)=>{"use strict";function pki(e,t){this.name="NoOpenIDError",this.message=e,this.stack=new Error().stack,this.response=t}s(pki,"NoOpenIDError");pki.prototype=new Error;hki.exports=pki});var Eki=A((Y$f,_ki)=>{"use strict";var xfu=dki().webfinger,gki=mki(),Aki="http://openid.net/specs/connect/1.0/issuer";function yki(){}s(yki,"Resolver");yki.prototype.resolve=function(e,t){xfu(e,Aki,{webfingerOnly:!0},function(r,n){if(r)return t(r);if(!n.links)return t(new gki("No links in resource descriptor",n));for(var i,o=0;o<n.links.length;o++){var a=n.links[o];if(a.rel===Aki){i=a.href;break}}return i?t(null,i):t(new gki("No OpenID Connect issuer in resource descriptor",n))})};_ki.exports=yki});var Ski=A((J$f,vki)=>{"use strict";function bki(e){if(e=e||{},this._getClientCb=e.getClientCallback,!this._getClientCb)throw new Error("OpenID Connect authentication requires getClientCallback option")}s(bki,"Registrar");bki.prototype.resolve=function(e,t){this._getClientCb(e,function(r,n){return r?t(r):n?t(null,n):t(new Error("No client able to interact with OpenID provider: "+e))})};vki.exports=bki});var Cki=A((wki,Tki)=>{"use strict";var Ifu=iki(),Rfu=Eki(),Ofu=Ski(),njt,ijt;wki=Tki.exports=function(e){var t=e.resolver,r=e.registrar;return t||(njt=njt||new Rfu(e),t=njt),r||(ijt=ijt||new Ofu(e),r=ijt),s(function(i,o){t.resolve(i,function(a,c){if(a)return o(a);var u=c+"/.well-known/openid-configuration";Ifu.get(u,function(l,f,d){if(l)return o(l);if(f.statusCode!==200)return o(new Error("Unexpected status code from OpenID provider configuration: "+f.statusCode));var p={};try{var h=JSON.parse(d);p.issuer=h.issuer,p.authorizationURL=h.authorization_endpoint,p.tokenURL=h.token_endpoint,p.userInfoURL=h.userinfo_endpoint,p.registrationURL=h.registration_endpoint,p._raw=h}catch{return o(new Error("Failed to parse OpenID provider configuration"))}r.resolve(p.issuer,function(g,y){return g?o(null,g):(p.clientID=y.id,p.clientSecret=y.secret,y.redirectURIs&&(p.callbackURL=y.redirectURIs[0]),o(null,p))})})})},"dynamic")}});var Nki=A((e6f,kki)=>{"use strict";var Oki=vj(),jue=require("url"),kfu=require("querystring"),Nfu=require("util"),sjt=yFt(),Dfu=H2t().OAuth2,Pfu=fSi(),xki=pSi(),Iki=require("crypto"),Rki=X2t(),Bfu=gSi();function Fj(e,t){e=e||{},Oki.Strategy.call(this),this.name="openidconnect",this._verify=t,this._identifierField=e.identifierField||"openid_identifier",this._scope=e.scope,this._passReqToCallback=e.passReqToCallback,this._skipUserProfile=e.skipUserProfile===void 0?!1:e.skipUserProfile,this._setup=void 0,this._key=e.sessionKey||this.name+":"+jue.parse(e.authorizationURL).hostname,this._stateStore=e.store||new Pfu({key:this._key}),e.authorizationURL&&e.tokenURL?this.configure(_Si()(e)):this.configure(Cki()(e))}s(Fj,"Strategy");Nfu.inherits(Fj,Oki.Strategy);Fj.prototype.authenticate=function(e,t){t=t||{};var r=this;if(e.query&&e.query.error)return e.query.error=="access_denied"?this.fail({message:e.query.error_description}):this.error(new Bfu(e.query.error_description,e.query.error,e.query.error_uri));if(e.query&&e.query.code){let a=function(c,u,l){if(c)return r.error(c);if(!u)return r.fail(l,403);var f=e.query.code,d=l,p=d.callbackURL,h=r._getOAuth2Client(d),g={grant_type:"authorization_code",redirect_uri:p};l.pkce&&(g.code_verifier=l.params.verifier),h.getOAuthAccessToken(f,g,function(y,b,v,C){if(y)return r.error(new xki("failed to obtain access token",y));var I=C.id_token;if(!I)return r.error(new Error("ID Token not present in token response"));var N=I.split("."),T,B;try{T=new Buffer(N[1],"base64").toString(),B=JSON.parse(T)}catch(J){return r.error(J)}var Q=["iss","sub","aud","exp","iat"].filter(function(J){return!B[J]});if(Q.length)return r.error(new Error("id token is missing required parameter(s) - "+Q.join(", ")));if(B.iss!==d.issuer)return r.error(new Error("id token not issued by correct OpenID provider - expected: "+d.issuer+" | from: "+B.iss));if(typeof B.aud=="string"){if(B.aud!==d.clientID)return r.error(new Error("aud parameter does not include this client - is: "+B.aud+"| expected: "+d.clientID))}else if(Array.isArray(B.aud)){if(B.aud.indexOf(d.clientID)===-1)return r.error(new Error("aud parameter does not include this client - is: "+B.aud+" | expected to include: "+d.clientID));if(B.length>1&&!B.azp)return r.error(new Error("azp parameter required with multiple audiences"))}else return r.error(new Error("Invalid aud parameter type"));if(B.azp&&B.azp!==d.clientID)return r.error(new Error("this client is not the authorized party - expected: "+d.clientID+" | is: "+B.azp));if(B.exp<Date.now()/1e3)return r.error(new Error("id token has expired"));if(d.params.max_age&&(!B.auth_time||d.timestamp-d.params.max_age>B.auth_time))return r.error(new Error("auth_time in id_token not included or too old"));if(d.params.nonce&&(!B.nonce||B.nonce!==d.params.nonce))return r.error(new Error("Invalid nonce in id_token"));var L=B.iss,G=B.sub;G||(G=B.user_id),r._shouldLoadUserProfile(L,G,function(J,te){if(J)return r.error(J);if(te){var de=jue.parse(d.userInfoURL,!0);de.query.schema="openid",delete de.search;var U=jue.format(de);h._request("GET",U,{Authorization:"Bearer "+b,Accept:"application/json"},null,null,function(X,F,D){if(X)return r.error(new xki("failed to fetch user profile",X));var be={};try{var ee=JSON.parse(F);be.id=ee.sub,B&&B.oid&&(be.id=B.oid),be.id||(be.id=ee.user_id),be.displayName=ee.name,be.name={familyName:ee.family_name,givenName:ee.given_name,middleName:ee.middle_name},be._raw=F,be._json=ee,le(be)}catch(_e){return r.error(_e)}})}else le();function le(X){function F(be,ee,_e){if(be)return r.error(be);if(!ee)return r.fail(_e);_e=_e||{},l&&(_e.state=l),r.success(ee,_e)}if(s(F,"verified"),r._passReqToCallback){var D=r._verify.length;D==10?r._verify(e,L,G,X,B,b,v,I,C,F):D==9?r._verify(e,L,G,X,B,b,v,C,F):D==8?r._verify(e,L,G,X,b,v,C,F):D==7?r._verify(e,L,G,X,b,v,F):D==5?r._verify(e,L,G,X,F):r._verify(e,L,G,F)}else{var D=r._verify.length;D==9?r._verify(L,G,X,B,b,v,I,C,F):D==8?r._verify(L,G,X,B,b,v,C,F):D==7?r._verify(L,G,X,b,v,C,F):D==6?r._verify(L,G,X,b,v,F):D==4?r._verify(L,G,X,F):r._verify(L,G,F)}}s(le,"onProfileLoaded")})})};var o=a;s(a,"loaded");var n=e.query.state;try{r._stateStore.verify(e,n,a)}catch(c){return r.error(c)}}else{var i;e.body&&e.body[this._identifierField]?i=e.body[this._identifierField]:e.query&&e.query[this._identifierField]&&(i=e.query[this._identifierField]),this._setup(i,function(a,c){if(a)return r.error(a);var u=c,l=t.callbackURL||c.callbackURL;if(l){var f=jue.parse(l);f.protocol||(l=jue.resolve(sjt.originalURL(e),l))}u.callbackURL=l;var d=r.authorizationParams(t);d.response_type="code",d.client_id=c.clientID,l&&(d.redirect_uri=l);var p=t.scope||r._scope;Array.isArray(p)&&(p=p.join(" ")),p?d.scope="openid "+p:d.scope="openid";var h=["max_age","ui_locals","id_token_hint","login_hint","acr_values"];h.filter(v=>v in c).map(v=>{d[v]=c[v]}),c.display&&["page","popup","touch","wap"].indexOf(c.display)!==-1&&(d.display=c.display),c.prompt&&["none","login","consent","select_account"].indexOf(c.prompt)!==-1&&(d.prompt=c.prompt),c.nonce&&typeof c.nonce=="boolean"&&(d.nonce=sjt.uid(20)),c.nonce&&typeof c.nonce=="number"&&(d.nonce=sjt.uid(c.nonce)),c.nonce&&typeof c.nonce=="string"&&(d.nonce=c.nonce),d.max_age&&(u.timestamp=Math.floor(Date.now()/1e3)),u.params=d;for(param in d)u[param]&&delete u[param];if(c.pkce){var g=Rki(Iki.pseudoRandomBytes(32));switch(c.pkce){case"S256":d.code_challenge=Rki(Iki.createHash("sha256").update(g).digest());break;case"plain":d.code_challenge=g;break;default:return r.error(new Error("Unsupported code verifier transformation method: "+c.pkce))}d.code_challenge_method=c.pkce,d.verifier=g}function y(v,C){if(v)return r.error(v);if(!C)return r.error(new Error("Unable to generate required state parameter"));d.state=C;let I={...d};delete I.verifier;var N=c.authorizationURL+"?"+kfu.stringify(I);r.redirect(N)}s(y,"stored");try{var b=r._stateStore.store.length;b==3?r._stateStore.store(e,u,y):r._stateStore.store(e,y)}catch(v){return r.error(v)}})}};Fj.prototype.configure=function(e,t){this._setup=e};Fj.prototype.authorizationParams=function(e){return{}};Fj.prototype._shouldLoadUserProfile=function(e,t,r){if(typeof this._skipUserProfile=="function"&&this._skipUserProfile.length>1)this._skipUserProfile(e,t,function(i,o){return i?r(i):o?r(null,!1):r(null,!0)});else{var n=typeof this._skipUserProfile=="function"?this._skipUserProfile(e,t):this._skipUserProfile;return n?r(null,!1):r(null,!0)}};Fj.prototype._getOAuth2Client=function(e){return new Dfu(e.clientID,e.clientSecret,"",e.authorizationURL,e.tokenURL)};kki.exports=Fj});var Bki=A((ojt,Pki)=>{"use strict";var Dki=Nki();ojt=Pki.exports=Dki;ojt.Strategy=Dki});var w2e=A((Mki,Lki)=>{"use strict";var jW=Mki=Lki.exports={};jW.login=jW.logIn=function(e,t,r){typeof t=="function"&&(r=t,t={}),t=t||{};var n=this._userProperty||"user",i=t.session===void 0?!0:t.session;if(this[n]=e,i&&this._sessionManager){if(typeof r!="function")throw new Error("req#login requires a callback function");var o=this;this._sessionManager.logIn(this,e,t,function(a){if(a)return o[n]=null,r(a);r()})}else r&&r()};jW.logout=jW.logOut=function(e,t){typeof e=="function"&&(t=e,e={}),e=e||{};var r=this._userProperty||"user";if(this[r]=null,this._sessionManager){if(typeof t!="function")throw new Error("req#logout requires a callback function");this._sessionManager.logOut(this,e,t)}else t&&t()};jW.isAuthenticated=function(){var e=this._userProperty||"user";return!!this[e]};jW.isUnauthenticated=function(){return!this.isAuthenticated()}});var cjt=A((ozf,Uki)=>{"use strict";var T2e=w2e();Uki.exports=s(function(t,r){return r=r||{},s(function(i,o,a){i.login=i.logIn=i.logIn||T2e.logIn,i.logout=i.logOut=i.logOut||T2e.logOut,i.isAuthenticated=i.isAuthenticated||T2e.isAuthenticated,i.isUnauthenticated=i.isUnauthenticated||T2e.isUnauthenticated,i._sessionManager=t._sm,r.userProperty&&(i._userProperty=r.userProperty);var c=r.compat===void 0?!0:r.compat;c&&(t._userProperty=r.userProperty||"user",i._passport={},i._passport.instance=t),a()},"initialize")},"initialize")});var Qki=A((czf,qki)=>{"use strict";function Fki(e,t){Error.call(this),Error.captureStackTrace(this,arguments.callee),this.name="AuthenticationError",this.message=e,this.status=t||401}s(Fki,"AuthenticationError");Fki.prototype.__proto__=Error.prototype;qki.exports=Fki});var ujt=A((lzf,Hki)=>{"use strict";var jki=require("http"),C2e=w2e(),Yfu=Qki();Hki.exports=s(function(t,r,n,i){typeof n=="function"&&(i=n,n={}),n=n||{};var o=!0;return Array.isArray(r)||(r=[r],o=!1),s(function(c,u,l){c.login=c.logIn=c.logIn||C2e.logIn,c.logout=c.logOut=c.logOut||C2e.logOut,c.isAuthenticated=c.isAuthenticated||C2e.isAuthenticated,c.isUnauthenticated=c.isUnauthenticated||C2e.isUnauthenticated,c._sessionManager=t._sm;var f=[];function d(){if(i)if(o){var p=f.map(function(L){return L.challenge}),h=f.map(function(L){return L.status});return i(null,!1,p,h)}else return i(null,!1,f[0].challenge,f[0].status);var g=f[0]||{},y=g.challenge||{},b;if(n.failureFlash){var v=n.failureFlash;typeof v=="string"&&(v={type:"error",message:v}),v.type=v.type||"error";var C=v.type||y.type||"error";b=v.message||y.message||y,typeof b=="string"&&c.flash(C,b)}if(n.failureMessage&&(b=n.failureMessage,typeof b=="boolean"&&(b=y.message||y),typeof b=="string"&&(c.session.messages=c.session.messages||[],c.session.messages.push(b))),n.failureRedirect)return u.redirect(n.failureRedirect);for(var I=[],N,T,B=0,Q=f.length;B<Q;B++)g=f[B],y=g.challenge,T=g.status,N=N||T,typeof y=="string"&&I.push(y);if(u.statusCode=N||401,u.statusCode==401&&I.length&&u.setHeader("WWW-Authenticate",I),n.failWithError)return l(new Yfu(jki.STATUS_CODES[u.statusCode],N));u.end(jki.STATUS_CODES[u.statusCode])}s(d,"allFailed"),s(function p(h){var g=r[h];if(!g)return d();var y,b;if(typeof g.authenticate=="function")y=g;else{if(b=t._strategy(g),!b)return l(new Error('Unknown authentication strategy "'+g+'"'));y=Object.create(b)}y.success=function(v,C){if(i)return i(null,v,C);C=C||{};var I;if(n.successFlash){var N=n.successFlash;typeof N=="string"&&(N={type:"success",message:N}),N.type=N.type||"success";var T=N.type||C.type||"success";I=N.message||C.message||C,typeof I=="string"&&c.flash(T,I)}if(n.successMessage&&(I=n.successMessage,typeof I=="boolean"&&(I=C.message||C),typeof I=="string"&&(c.session.messages=c.session.messages||[],c.session.messages.push(I))),n.assignProperty)return c[n.assignProperty]=v,l();c.logIn(v,n,function(B){if(B)return l(B);function Q(){if(n.successReturnToOrRedirect){var L=n.successReturnToOrRedirect;return c.session&&c.session.returnTo&&(L=c.session.returnTo,delete c.session.returnTo),u.redirect(L)}if(n.successRedirect)return u.redirect(n.successRedirect);l()}s(Q,"complete"),n.authInfo!==!1?t.transformAuthInfo(C,c,function(L,G){if(L)return l(L);c.authInfo=G,Q()}):Q()})},y.fail=function(v,C){typeof v=="number"&&(C=v,v=void 0),f.push({challenge:v,status:C}),p(h+1)},y.redirect=function(v,C){u.statusCode=C||302,u.setHeader("Location",v),u.setHeader("Content-Length","0"),u.end()},y.pass=function(){l()},y.error=function(v){if(i)return i(v);l(v)},y.authenticate(c,n)},"attempt")(0)},"authenticate")},"authenticate")});var ljt=A((Gki,Vki)=>{"use strict";var Kfu=cjt(),Jfu=ujt();Gki=Vki.exports=function(){return{initialize:Kfu,authenticate:Jfu}}});var zki=A((dzf,$ki)=>{"use strict";$ki.exports=function(e){var t,r,n=[];return e.on("data",t=s(function(i,o){n.push(["data",i,o])},"onData")),e.on("end",r=s(function(i,o){n.push(["end",i,o])},"onEnd")),{end:function(){e.removeListener("data",t),e.removeListener("end",r)},resume:function(){this.end();for(var i=0,o=n.length;i<o;++i)e.emit.apply(e,n[i])}}}});var djt=A((hzf,Yki)=>{"use strict";var Xfu=zki(),Zfu=require("util"),Wki=vj();function fjt(e,t){typeof e=="function"&&(t=e,e=void 0),e=e||{},Wki.call(this),this.name="session",this._key=e.key||"passport",this._deserializeUser=t}s(fjt,"SessionStrategy");Zfu.inherits(fjt,Wki);fjt.prototype.authenticate=function(e,t){if(!e.session)return this.error(new Error("Login sessions require session support. Did you forget to use `express-session` middleware?"));t=t||{};var r=this,n;if(e.session[this._key]&&(n=e.session[this._key].user),n||n===0){var i=t.pauseStream?Xfu(e):null;this._deserializeUser(n,e,function(o,a){if(o)return r.error(o);if(!a)delete e.session[r._key].user;else{var c=e._userProperty||"user";e[c]=a}r.pass(),i&&i.resume()})}else r.pass()};Yki.exports=fjt});var Xki=A((gzf,Jki)=>{"use strict";var Kki=xLe();function pjt(e,t){typeof e=="function"&&(t=e,e=void 0),e=e||{},this._key=e.key||"passport",this._serializeUser=t}s(pjt,"SessionManager");pjt.prototype.logIn=function(e,t,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},!e.session)return n(new Error("Login sessions require session support. Did you forget to use `express-session` middleware?"));var i=this,o=e.session;e.session.regenerate(function(a){if(a)return n(a);i._serializeUser(t,e,function(c,u){if(c)return n(c);r.keepSessionInfo&&Kki(e.session,o),e.session[i._key]||(e.session[i._key]={}),e.session[i._key].user=u,e.session.save(function(l){if(l)return n(l);n()})})})};pjt.prototype.logOut=function(e,t,r){if(typeof t=="function"&&(r=t,t={}),t=t||{},!e.session)return r(new Error("Login sessions require session support. Did you forget to use `express-session` middleware?"));var n=this;e.session[this._key]&&delete e.session[this._key].user;var i=e.session;e.session.save(function(o){if(o)return r(o);e.session.regenerate(function(a){if(a)return r(a);t.keepSessionInfo&&Kki(e.session,i),r()})})};Jki.exports=pjt});var eNi=A((yzf,Zki)=>{"use strict";var edu=djt(),tdu=Xki();function z_(){this._key="passport",this._strategies={},this._serializers=[],this._deserializers=[],this._infoTransformers=[],this._framework=null,this.init()}s(z_,"Authenticator");z_.prototype.init=function(){this.framework(ljt()()),this.use(new edu({key:this._key},this.deserializeUser.bind(this))),this._sm=new tdu({key:this._key},this.serializeUser.bind(this))};z_.prototype.use=function(e,t){if(t||(t=e,e=t.name),!e)throw new Error("Authentication strategies must have a name");return this._strategies[e]=t,this};z_.prototype.unuse=function(e){return delete this._strategies[e],this};z_.prototype.framework=function(e){return this._framework=e,this};z_.prototype.initialize=function(e){return e=e||{},this._framework.initialize(this,e)};z_.prototype.authenticate=function(e,t,r){return this._framework.authenticate(this,e,t,r)};z_.prototype.authorize=function(e,t,r){t=t||{},t.assignProperty="account";var n=this._framework.authorize||this._framework.authenticate;return n(this,e,t,r)};z_.prototype.session=function(e){return this.authenticate("session",e)};z_.prototype.serializeUser=function(e,t,r){if(typeof e=="function")return this._serializers.push(e);var n=e;typeof t=="function"&&(r=t,t=void 0);var i=this._serializers;s(function o(a,c,u){if(c==="pass"&&(c=void 0),c||u||u===0)return r(c,u);var l=i[a];if(!l)return r(new Error("Failed to serialize user into session"));function f(p,h){o(a+1,p,h)}s(f,"serialized");try{var d=l.length;d==3?l(t,n,f):l(n,f)}catch(p){return r(p)}},"pass")(0)};z_.prototype.deserializeUser=function(e,t,r){if(typeof e=="function")return this._deserializers.push(e);var n=e;typeof t=="function"&&(r=t,t=void 0);var i=this._deserializers;s(function o(a,c,u){if(c==="pass"&&(c=void 0),c||u)return r(c,u);if(u===null||u===!1)return r(null,!1);var l=i[a];if(!l)return r(new Error("Failed to deserialize user out of session"));function f(p,h){o(a+1,p,h)}s(f,"deserialized");try{var d=l.length;d==3?l(t,n,f):l(n,f)}catch(p){return r(p)}},"pass")(0)};z_.prototype.transformAuthInfo=function(e,t,r){if(typeof e=="function")return this._infoTransformers.push(e);var n=e;typeof t=="function"&&(r=t,t=void 0);var i=this._infoTransformers;s(function o(a,c,u){if(c==="pass"&&(c=void 0),c||u)return r(c,u);var l=i[a];if(!l)return r(null,n);function f(h,g){o(a+1,h,g)}s(f,"transformed");try{var d=l.length;if(d==1){var p=l(n);f(null,p)}else d==3?l(t,n,f):l(n,f)}catch(h){return r(h)}},"pass")(0)};z_.prototype._strategy=function(e){return this._strategies[e]};Zki.exports=z_});var x2e=A((qj,rNi)=>{"use strict";var tNi=eNi(),rdu=djt();qj=rNi.exports=new tNi;qj.Passport=qj.Authenticator=tNi;qj.Strategy=vj();qj.strategies={};qj.strategies.SessionStrategy=rdu});var oNi=A(sNi=>{"use strict";var hjt=["_passport","authInfo","httpVersion","headers","trailers","setTimeout","method","url","statusCode","socket","connection","protocol","cookies","throw","ip","param","params","route","xhr","baseUrl","session","body","flash"];hjt=hjt.filter(function(e,t,r){return r.indexOf(e)===t});var iNi={app:{get:function(){let e=this.ctx;return{get:function(t){if(t==="trust proxy")return e.app.proxy}}}}};hjt.forEach(function(e){iNi[e]={get:function(){let t=nNi(this.ctx,e);if(t)return typeof t[e]=="function"?function(){return t[e].apply(t,arguments)}:t[e]},set:function(t){let r=nNi(this.ctx,e)||this.ctx.state;r[e]=t}}});function nNi(e,t){if(e.state&&t in e.state)return e.state;if(t in e.request)return e.request;if(t in e.req)return e.req;if(t in e)return e}s(nNi,"getObject");var HW=w2e();sNi.create=function(e,t){let r=Object.create(e.request,iNi);return Object.defineProperty(r,t,{enumerable:!0,get:function(){return e.state[t]},set:function(n){e.state[t]=n}}),Object.defineProperty(r,"ctx",{enumerable:!0,get:function(){return e}}),r.login=HW.logIn,r.logIn=HW.logIn,r.logout=HW.logOut,r.logOut=HW.logOut,r.isAuthenticated=HW.isAuthenticated,r.isUnauthenticated=HW.isUnauthenticated,r}});var fNi=A((Szf,lNi)=>{"use strict";var vzf=x2e(),ndu=cjt(),idu=ujt(),aNi=oNi().create;function sdu(e){let t=uNi(ndu(e));return s(function(n,i){let o=e._userProperty||"user";n.req.hasOwnProperty(o)||Object.defineProperty(n.req,o,{enumerable:!0,get:function(){return n.state[o]},set:function(l){n.state[o]=l}});let a=aNi(n,o),c=a.login;n.login=n.logIn=function(l,f){return new Promise((d,p)=>{c.call(a,l,f,h=>{h?p(h):d()})})};let u=a.logout;return n.logout=n.logOut=function(l){return new Promise((f,d)=>{u.call(a,l,p=>{p?d(p):f()})})},n.isAuthenticated=a.isAuthenticated.bind(a),n.isUnauthenticated=a.isUnauthenticated.bind(a),t(a,n).then(function(){return i()})},"passportInitialize")}s(sdu,"initialize");function cNi(e,t,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},n){let o=n;n=s(function(a,c,u,l){try{Promise.resolve(o(a,c,u,l)).then(()=>n.resolve(!1)).catch(f=>n.reject(f))}catch(f){n.reject(f)}},"callback")}let i=uNi(idu(e,t,r,n));return s(function(a,c){return new Promise((l,f)=>{let d=aNi(a,r.assignProperty||e._userProperty||"user");function p(g){g&&(a.body=g),l(!1)}s(p,"setBodyAndResolve");let h={redirect:function(g){a.redirect(g),l(!1)},set:a.set.bind(a),setHeader:a.set.bind(a),end:p,send:p,set statusCode(g){a.status=g},get statusCode(){return a.status}};d.res=h,n&&(n.resolve=l,n.reject=f),i(d,h).then(l,f)}).then(l=>{if(l!==!1)return c()})},"passportAuthenticate")}s(cNi,"authenticate");function odu(e,t,r,n){return r=r||{},r.assignProperty="account",cNi(e,t,r,n)}s(odu,"authorize");lNi.exports=function(){return{initialize:sdu,authenticate:cNi,authorize:odu}};function uNi(e){return function(t,r){return new Promise(function(n,i){e(t,r,function(o,a){o?i(o):n(a)})})}}s(uNi,"promisify")});var hNi=A((Tzf,gjt)=>{"use strict";var adu=ljt();adu.__monkeypatchNode=function(){};var dNi=x2e(),cdu=x2e().Passport,pNi=fNi()();dNi.framework(pNi);var mjt=class extends cdu{static{s(this,"KoaPassport")}constructor(){super(),this.framework(pNi)}};gjt.exports=dNi;gjt.exports.KoaPassport=mjt});var gNi=A(mNi=>{"use strict";mNi.lookup=function(e,t){if(!e)return null;for(var r=t.split("]").join("").split("["),n=0,i=r.length;n<i;n++){var o=e[r[n]];if(typeof o>"u")return null;if(typeof o!="object")return o;e=o}return null}});var _Ni=A((Izf,yNi)=>{"use strict";var ANi=vj(),udu=require("util"),I2e=gNi().lookup;function Ajt(e,t){if(typeof e=="function"&&(t=e,e={}),!t)throw new TypeError("LocalStrategy requires a verify callback");this._usernameField=e.usernameField||"username",this._passwordField=e.passwordField||"password",ANi.Strategy.call(this),this.name="local",this._verify=t,this._passReqToCallback=e.passReqToCallback}s(Ajt,"Strategy");udu.inherits(Ajt,ANi.Strategy);Ajt.prototype.authenticate=function(e,t){t=t||{};var r=I2e(e.body,this._usernameField)||I2e(e.query,this._usernameField),n=I2e(e.body,this._passwordField)||I2e(e.query,this._passwordField);if(!r||!n)return this.fail({message:t.badRequestMessage||"Missing credentials"},400);var i=this;function o(a,c,u){if(a)return i.error(a);if(!c)return i.fail(u);i.success(c,u)}s(o,"verified");try{i._passReqToCallback?this._verify(e,r,n,o):this._verify(r,n,o)}catch(a){return i.error(a)}};yNi.exports=Ajt});var vNi=A((yjt,bNi)=>{"use strict";var ENi=_Ni();yjt=bNi.exports=ENi;yjt.Strategy=ENi});var SNi=A((Ozf,_jt)=>{"use strict";var R2e=class{static{s(this,"AuthTokenRefresh")}constructor(){this._strategies={}}use(t,r,n){if(typeof t!="string"&&(n=r,r=t,t=r&&r.name),r==null)throw new Error("Cannot register: strategy is null");if(!t)throw new Error("Cannot register: name must be specified, or strategy must include name");n=n||{};let i;if(r._oauth2){let o=r._oauth2.constructor;i=new o(r._oauth2._clientId,r._oauth2._clientSecret,r._oauth2._baseSite,r._oauth2._authorizeUrl,r._refreshURL||r._oauth2._accessTokenUrl,r._oauth2._customHeaders),i.getOAuthAccessToken=r._oauth2.getOAuthAccessToken}if(typeof n.setRefreshOAuth2=="function"&&(i=n.setRefreshOAuth2({strategyOAuth2:r._oauth2,refreshOAuth2:i})),!i)throw new Error("The OAuth2 adapter used to refresh the token is not configured correctly. Use the setRefreshOAuth2 option to return a OAuth 2.0 adapter.");this._strategies[t]={strategy:r,refreshOAuth2:i}}has(t){return!!this._strategies[t]}requestNewAccessToken(t,r,n,i){arguments.length===3&&(i=n,n={});let o=this._strategies[t];if(!o)return i(new Error("Strategy was not registered to refresh a token"));n=n||{},n.grant_type="refresh_token",o.refreshOAuth2.getOAuthAccessToken(r,n,i)}};_jt.exports=new R2e;_jt.exports.AuthTokenRefresh=R2e});var Sjt=A(vjt=>{"use strict";Object.defineProperty(vjt,"__esModule",{value:!0});var bjt=class extends Error{static{s(this,"TimeoutError")}};vjt.TimeoutError=bjt});var CNi=A(Tjt=>{"use strict";Object.defineProperty(Tjt,"__esModule",{value:!0});var wjt=class{static{s(this,"PromiseInspection")}constructor(t){this._value=t.value,this._error=t.error}value(){return this._value}reason(){return this._error}isRejected(){return!!this._error}isFulfilled(){return!!this._value}};Tjt.PromiseInspection=wjt});var k2e=A(HC=>{"use strict";Object.defineProperty(HC,"__esModule",{value:!0});var xNi=CNi();function vdu(){let e=null,t=null;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}s(vdu,"defer");HC.defer=vdu;function Sdu(){return Date.now()}s(Sdu,"now");HC.now=Sdu;function wdu(e,t){return Math.abs(t-e)}s(wdu,"duration");HC.duration=wdu;function Tdu(e){return typeof e>"u"?!0:INi(e)}s(Tdu,"checkOptionalTime");HC.checkOptionalTime=Tdu;function INi(e){return typeof e=="number"&&e===Math.round(e)&&e>0}s(INi,"checkRequiredTime");HC.checkRequiredTime=INi;function Cdu(e){return new Promise(t=>setTimeout(t,e))}s(Cdu,"delay");HC.delay=Cdu;function xdu(e){return e.then(t=>new xNi.PromiseInspection({value:t})).catch(t=>new xNi.PromiseInspection({error:t}))}s(xdu,"reflect");HC.reflect=xdu;function Idu(e){try{let t=e();return Promise.resolve(t)}catch(t){return Promise.reject(t)}}s(Idu,"tryPromise");HC.tryPromise=Idu});var RNi=A(xjt=>{"use strict";Object.defineProperty(xjt,"__esModule",{value:!0});var N2e=Sjt(),Rdu=k2e(),Cjt=class{static{s(this,"PendingOperation")}constructor(t){this.timeoutMillis=t,this.deferred=Rdu.defer(),this.possibleTimeoutCause=null,this.isRejected=!1,this.promise=Odu(this.deferred.promise,t).catch(r=>(r instanceof N2e.TimeoutError&&(this.possibleTimeoutCause?r=new N2e.TimeoutError(this.possibleTimeoutCause.message):r=new N2e.TimeoutError("operation timed out for an unknown reason")),this.isRejected=!0,Promise.reject(r)))}abort(){this.reject(new Error("aborted"))}reject(t){this.deferred.reject(t)}resolve(t){this.deferred.resolve(t)}};xjt.PendingOperation=Cjt;function Odu(e,t){return new Promise((r,n)=>{let i=setTimeout(()=>n(new N2e.TimeoutError),t);e.then(o=>{clearTimeout(i),r(o)}).catch(o=>{clearTimeout(i),n(o)})})}s(Odu,"timeout")});var kNi=A(Rjt=>{"use strict";Object.defineProperty(Rjt,"__esModule",{value:!0});var ONi=k2e(),Ijt=class e{static{s(this,"Resource")}constructor(t){this.resource=t,this.resource=t,this.timestamp=ONi.now(),this.deferred=ONi.defer()}get promise(){return this.deferred.promise}resolve(){return this.deferred.resolve(void 0),new e(this.resource)}};Rjt.Resource=Ijt});var DNi=A(kjt=>{"use strict";Object.defineProperty(kjt,"__esModule",{value:!0});var D2e=RNi(),kdu=kNi(),rA=k2e(),Ndu=require("events"),NNi=require("timers"),Ojt=class{static{s(this,"Pool")}constructor(t){if(this.destroyed=!1,this.emitter=new Ndu.EventEmitter,t=t||{},!t.create)throw new Error("Tarn: opt.create function most be provided");if(!t.destroy)throw new Error("Tarn: opt.destroy function most be provided");if(typeof t.min!="number"||t.min<0||t.min!==Math.round(t.min))throw new Error("Tarn: opt.min must be an integer >= 0");if(typeof t.max!="number"||t.max<=0||t.max!==Math.round(t.max))throw new Error("Tarn: opt.max must be an integer > 0");if(t.min>t.max)throw new Error("Tarn: opt.max is smaller than opt.min");if(!rA.checkOptionalTime(t.acquireTimeoutMillis))throw new Error("Tarn: invalid opt.acquireTimeoutMillis "+JSON.stringify(t.acquireTimeoutMillis));if(!rA.checkOptionalTime(t.createTimeoutMillis))throw new Error("Tarn: invalid opt.createTimeoutMillis "+JSON.stringify(t.createTimeoutMillis));if(!rA.checkOptionalTime(t.destroyTimeoutMillis))throw new Error("Tarn: invalid opt.destroyTimeoutMillis "+JSON.stringify(t.destroyTimeoutMillis));if(!rA.checkOptionalTime(t.idleTimeoutMillis))throw new Error("Tarn: invalid opt.idleTimeoutMillis "+JSON.stringify(t.idleTimeoutMillis));if(!rA.checkOptionalTime(t.reapIntervalMillis))throw new Error("Tarn: invalid opt.reapIntervalMillis "+JSON.stringify(t.reapIntervalMillis));if(!rA.checkOptionalTime(t.createRetryIntervalMillis))throw new Error("Tarn: invalid opt.createRetryIntervalMillis "+JSON.stringify(t.createRetryIntervalMillis));let r={create:!0,validate:!0,destroy:!0,log:!0,min:!0,max:!0,acquireTimeoutMillis:!0,createTimeoutMillis:!0,destroyTimeoutMillis:!0,idleTimeoutMillis:!0,reapIntervalMillis:!0,createRetryIntervalMillis:!0,propagateCreateError:!0};for(let n of Object.keys(t))if(!r[n])throw new Error(`Tarn: unsupported option opt.${n}`);this.creator=t.create,this.destroyer=t.destroy,this.validate=typeof t.validate=="function"?t.validate:()=>!0,this.log=t.log||(()=>{}),this.acquireTimeoutMillis=t.acquireTimeoutMillis||3e4,this.createTimeoutMillis=t.createTimeoutMillis||3e4,this.destroyTimeoutMillis=t.destroyTimeoutMillis||5e3,this.idleTimeoutMillis=t.idleTimeoutMillis||3e4,this.reapIntervalMillis=t.reapIntervalMillis||1e3,this.createRetryIntervalMillis=t.createRetryIntervalMillis||200,this.propagateCreateError=!!t.propagateCreateError,this.min=t.min,this.max=t.max,this.used=[],this.free=[],this.pendingCreates=[],this.pendingAcquires=[],this.pendingDestroys=[],this.pendingValidations=[],this.destroyed=!1,this.interval=null,this.eventId=1}numUsed(){return this.used.length}numFree(){return this.free.length}numPendingAcquires(){return this.pendingAcquires.length}numPendingValidations(){return this.pendingValidations.length}numPendingCreates(){return this.pendingCreates.length}acquire(){let t=this.eventId++;this._executeEventHandlers("acquireRequest",t);let r=new D2e.PendingOperation(this.acquireTimeoutMillis);return this.pendingAcquires.push(r),r.promise=r.promise.then(n=>(this._executeEventHandlers("acquireSuccess",t,n),n)).catch(n=>(this._executeEventHandlers("acquireFail",t,n),GW(this.pendingAcquires,r),Promise.reject(n))),this._tryAcquireOrCreate(),r}release(t){this._executeEventHandlers("release",t);for(let r=0,n=this.used.length;r<n;++r){let i=this.used[r];if(i.resource===t)return this.used.splice(r,1),this.free.push(i.resolve()),this._tryAcquireOrCreate(),!0}return!1}isEmpty(){return[this.numFree(),this.numUsed(),this.numPendingAcquires(),this.numPendingValidations(),this.numPendingCreates()].reduce((t,r)=>t+r)===0}check(){let t=rA.now(),r=[],n=this.min-this.used.length,i=this.free.length-n,o=0;this.free.forEach(a=>{rA.duration(t,a.timestamp)>=this.idleTimeoutMillis&&o<i?(o++,this._destroy(a.resource)):r.push(a)}),this.free=r,this.isEmpty()&&this._stopReaping()}destroy(){let t=this.eventId++;return this._executeEventHandlers("poolDestroyRequest",t),this._stopReaping(),this.destroyed=!0,rA.reflect(Promise.all(this.pendingCreates.map(r=>rA.reflect(r.promise))).then(()=>new Promise((r,n)=>{if(this.numPendingValidations()===0){r();return}let i=setInterval(()=>{this.numPendingValidations()===0&&(NNi.clearInterval(i),r())},100)})).then(()=>Promise.all(this.used.map(r=>rA.reflect(r.promise)))).then(()=>Promise.all(this.pendingAcquires.map(r=>(r.abort(),rA.reflect(r.promise))))).then(()=>Promise.all(this.free.map(r=>rA.reflect(this._destroy(r.resource))))).then(()=>Promise.all(this.pendingDestroys.map(r=>r.promise))).then(()=>{this.free=[],this.pendingAcquires=[]})).then(r=>(this._executeEventHandlers("poolDestroySuccess",t),this.emitter.removeAllListeners(),r))}on(t,r){this.emitter.on(t,r)}removeListener(t,r){this.emitter.removeListener(t,r)}removeAllListeners(t){this.emitter.removeAllListeners(t)}_tryAcquireOrCreate(){this.destroyed||(this._hasFreeResources()?this._doAcquire():this._shouldCreateMoreResources()&&this._doCreate())}_hasFreeResources(){return this.free.length>0}_doAcquire(){for(;this._canAcquire();){let t=this.pendingAcquires.shift(),r=this.free.pop();if(r===void 0||t===void 0){let i="this.free was empty while trying to acquire resource";throw this.log(`Tarn: ${i}`,"warn"),new Error(`Internal error, should never happen. ${i}`)}this.pendingValidations.push(t),this.used.push(r);let n=new D2e.PendingOperation(this.acquireTimeoutMillis);t.promise.catch(i=>{n.abort()}),n.promise.catch(i=>(this.log("Tarn: resource validator threw an exception "+i.stack,"warn"),!1)).then(i=>{try{i&&!t.isRejected?(this._startReaping(),t.resolve(r.resource)):(GW(this.used,r),i?this.free.push(r):(this._destroy(r.resource),setTimeout(()=>{this._tryAcquireOrCreate()},0)),t.isRejected||this.pendingAcquires.unshift(t))}finally{GW(this.pendingValidations,t)}}),this._validateResource(r.resource).then(i=>{n.resolve(i)}).catch(i=>{n.reject(i)})}}_canAcquire(){return this.free.length>0&&this.pendingAcquires.length>0}_validateResource(t){try{return Promise.resolve(this.validate(t))}catch(r){return Promise.reject(r)}}_shouldCreateMoreResources(){return this.used.length+this.pendingCreates.length<this.max&&this.pendingCreates.length<this.pendingAcquires.length}_doCreate(){let t=this.pendingAcquires.slice();this._create().promise.then(()=>(this._tryAcquireOrCreate(),null)).catch(n=>{this.propagateCreateError&&this.pendingAcquires.length!==0&&this.pendingAcquires[0].reject(n),t.forEach(i=>{i.possibleTimeoutCause=n}),rA.delay(this.createRetryIntervalMillis).then(()=>this._tryAcquireOrCreate())})}_create(){let t=this.eventId++;this._executeEventHandlers("createRequest",t);let r=new D2e.PendingOperation(this.createTimeoutMillis);return r.promise=r.promise.catch(n=>{throw GW(this.pendingCreates,r)&&this._executeEventHandlers("createFail",t,n),n}),this.pendingCreates.push(r),Ddu(this.creator).then(n=>r.isRejected?(this.destroyer(n),null):(GW(this.pendingCreates,r),this.free.push(new kdu.Resource(n)),r.resolve(n),this._executeEventHandlers("createSuccess",t,n),null)).catch(n=>(r.isRejected||(GW(this.pendingCreates,r)&&this._executeEventHandlers("createFail",t,n),r.reject(n)),null)),r}_destroy(t){let r=this.eventId++;this._executeEventHandlers("destroyRequest",r,t);let n=new D2e.PendingOperation(this.destroyTimeoutMillis);return Promise.resolve().then(()=>this.destroyer(t)).then(()=>{n.resolve(t)}).catch(o=>{n.reject(o)}),this.pendingDestroys.push(n),n.promise.then(o=>(this._executeEventHandlers("destroySuccess",r,t),o)).catch(o=>this._logDestroyerError(r,t,o)).then(o=>{let a=this.pendingDestroys.findIndex(c=>c===n);return this.pendingDestroys.splice(a,1),o})}_logDestroyerError(t,r,n){this._executeEventHandlers("destroyFail",t,r,n),this.log("Tarn: resource destroyer threw an exception "+n.stack,"warn")}_startReaping(){this.interval||(this._executeEventHandlers("startReaping"),this.interval=setInterval(()=>this.check(),this.reapIntervalMillis))}_stopReaping(){this.interval!==null&&(this._executeEventHandlers("stopReaping"),NNi.clearInterval(this.interval)),this.interval=null}_executeEventHandlers(t,...r){this.emitter.listeners(t).forEach(i=>{try{i(...r)}catch(o){this.log(`Tarn: event handler "${t}" threw an exception ${o.stack}`,"warn")}})}};kjt.Pool=Ojt;function GW(e,t){let r=e.indexOf(t);return r===-1?!1:(e.splice(r,1),!0)}s(GW,"remove");function Ddu(e){return new Promise((t,r)=>{let n=s((i,o)=>{i?r(i):t(o)},"callback");rA.tryPromise(()=>e(n)).then(i=>{i&&t(i)}).catch(i=>{r(i)})})}s(Ddu,"callbackOrPromise")});var LNi=A((P2e,MNi)=>{"use strict";Object.defineProperty(P2e,"__esModule",{value:!0});var PNi=DNi();P2e.Pool=PNi.Pool;var BNi=Sjt();P2e.TimeoutError=BNi.TimeoutError;MNi.exports={Pool:PNi.Pool,TimeoutError:BNi.TimeoutError}});var M2e=A((e9f,jNi)=>{"use strict";var B2e=/[\0\b\t\n\r\x1a"'\\]/g,UNi={"\0":"\\0","\b":"\\b"," ":"\\t","\n":"\\n","\r":"\\r","":"\\Z",'"':'\\"',"'":"\\'","\\":"\\\\"};function Pdu(e){return s(function t(r,n={}){return e(r,t,n)},"finalEscape")}s(Pdu,"wrapEscape");function Bdu(e={}){let t=e.escapeDate||QNi,r=e.escapeArray||Njt,n=e.escapeBuffer||qNi,i=e.escapeString||Djt,o=e.escapeObject||FNi,a=e.wrap||Pdu;function c(u,l,f){if(u==null)return"NULL";switch(typeof u){case"boolean":return u?"true":"false";case"number":return u+"";case"object":if(u instanceof Date)u=t(u,l,f);else return Array.isArray(u)?r(u,l,f):Buffer.isBuffer(u)?n(u,l,f):o(u,l,f)}return i(u,l,f)}return s(c,"escapeFn"),a?a(c):c}s(Bdu,"makeEscape");function FNi(e,t,r){return e&&typeof e.toSQL=="function"?e.toSQL(r):JSON.stringify(e)}s(FNi,"escapeObject");function Njt(e,t,r){let n="";for(let i=0;i<e.length;i++){let o=e[i];Array.isArray(o)?n+=(i===0?"":", ")+"("+Njt(o,t,r)+")":n+=(i===0?"":", ")+t(o,r)}return n}s(Njt,"arrayToList");function qNi(e){return"X"+Djt(e.toString("hex"))}s(qNi,"bufferToString");function Djt(e,t,r){let n=B2e.lastIndex=0,i="",o;for(;o=B2e.exec(e);)i+=e.slice(n,o.index)+UNi[o[0]],n=B2e.lastIndex;return n===0?"'"+e+"'":n<e.length?"'"+i+e.slice(n)+"'":"'"+i+"'"}s(Djt,"escapeString");function QNi(e,t,r={}){let n=r.timeZone||"local",i=new Date(e),o,a,c,u,l,f,d;if(n==="local")o=i.getFullYear(),a=i.getMonth()+1,c=i.getDate(),u=i.getHours(),l=i.getMinutes(),f=i.getSeconds(),d=i.getMilliseconds();else{let p=Mdu(n);p!==!1&&p!==0&&i.setTime(i.getTime()+p*6e4),o=i.getUTCFullYear(),a=i.getUTCMonth()+1,c=i.getUTCDate(),u=i.getUTCHours(),l=i.getUTCMinutes(),f=i.getUTCSeconds(),d=i.getUTCMilliseconds()}return Qj(o,4)+"-"+Qj(a,2)+"-"+Qj(c,2)+" "+Qj(u,2)+":"+Qj(l,2)+":"+Qj(f,2)+"."+Qj(d,3)}s(QNi,"dateToString");function Qj(e,t){for(e=e.toString();e.length<t;)e="0"+e;return e}s(Qj,"zeroPad");function Mdu(e){if(e==="Z")return 0;let t=e.match(/([+\-\s])(\d\d):?(\d\d)?/);return t?(t[1]=="-"?-1:1)*(parseInt(t[2],10)+(t[3]?parseInt(t[3],10):0)/60)*60:!1}s(Mdu,"convertTimezone");jNi.exports={arrayToList:Njt,bufferToString:qNi,dateToString:QNi,escapeString:Djt,charsRegex:B2e,charsMap:UNi,escapeObject:FNi,makeEscape:Bdu}});var jj=A((r9f,HNi)=>{"use strict";var Ldu=Lh(),Udu=p8e(),Fdu=Ohe();function qdu(e,t){return Fdu(Udu(e,t,Ldu),e+"")}s(qdu,"baseRest");HNi.exports=qdu});var Hj=A((i9f,GNi)=>{"use strict";var Qdu=eN(),jdu=F0(),Hdu=FH(),Gdu=AA();function Vdu(e,t,r){if(!Gdu(r))return!1;var n=typeof t;return(n=="number"?jdu(r)&&Hdu(t,r.length):n=="string"&&t in r)?Qdu(r[t],e):!1}s(Vdu,"isIterateeCall");GNi.exports=Vdu});var Pjt=A((o9f,$Ni)=>{"use strict";var $du=jj(),zdu=eN(),Wdu=Hj(),Ydu=Ux(),VNi=Object.prototype,Kdu=VNi.hasOwnProperty,Jdu=$du(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&Wdu(t[0],t[1],i)&&(n=1);++r<n;)for(var o=t[r],a=Ydu(o),c=-1,u=a.length;++c<u;){var l=a[c],f=e[l];(f===void 0||zdu(f,VNi[l])&&!Kdu.call(e,l))&&(e[l]=o[l])}return e});$Ni.exports=Jdu});var Bjt=A((a9f,zNi)=>{"use strict";var Xdu=ZS(),Zdu=0;function epu(e){var t=++Zdu;return Xdu(e)+t}s(epu,"uniqueId");zNi.exports=epu});var Gj=A((u9f,Mjt)=>{"use strict";var L2e=class extends Error{static{s(this,"KnexTimeoutError")}constructor(t){super(t),this.name="KnexTimeoutError"}};function tpu(e,t){return new Promise(function(r,n){let i=setTimeout(function(){n(new L2e("operation timed out"))},t);function o(c){clearTimeout(i),r(c)}s(o,"wrappedResolve");function a(c){clearTimeout(i),n(c)}s(a,"wrappedReject"),e.then(o,a)})}s(tpu,"timeout");Mjt.exports.KnexTimeoutError=L2e;Mjt.exports.timeout=tpu});var YNi=A((f9f,WNi)=>{"use strict";function rpu(e){e.client.emit("start",e.builder),e.builder.emit("start",e.builder);let t=e.builder.toSQL();return e.builder._debug&&e.client.logger.debug(t),Array.isArray(t)?e.queryArray(t):e.query(t)}s(rpu,"ensureConnectionCallback");function npu(e,t){try{let r=e.builder.toSQL();if(Array.isArray(r)&&t.hasHandler)throw new Error("The stream may only be used with a single query statement.");return e.client.stream(e.connection,r,t.stream,t.options)}catch(r){throw t.stream.emit("error",r),r}}s(npu,"ensureConnectionStreamCallback");WNi.exports={ensureConnectionCallback:rpu,ensureConnectionStreamCallback:npu}});var XNi=A((p9f,JNi)=>{"use strict";var{KnexTimeoutError:KNi}=Gj(),{timeout:ipu}=Gj(),{ensureConnectionCallback:spu,ensureConnectionStreamCallback:opu}=YNi(),Ljt,Ujt=class e{static{s(this,"Runner")}constructor(t,r){this.client=t,this.builder=r,this.queries=[],this.connection=void 0}async run(){let t=this;try{let r=await this.ensureConnection(spu);return t.builder.emit("end"),r}catch(r){throw t.builder._events&&t.builder._events.error&&t.builder.emit("error",r),r}}stream(t,r){let n=typeof t=="function"&&arguments.length===1,i=n?{}:t,o=n?t:r,a=typeof o=="function";Ljt=Ljt||require("stream").Transform;let c=this.builder.queryContext(),u=new Ljt({objectMode:!0,transform:(f,d,p)=>{p(null,this.client.postProcessResponse(f,c))}});u.on("close",()=>{this.client.releaseConnection(this.connection)});let l=this.ensureConnection(opu,{options:i,hasHandler:a,stream:u}).catch(f=>{this.connection||u.emit("error",f)});return a?(o(u),l):u}pipe(t,r){return this.stream(r).pipe(t)}async query(t){let{__knexUid:r,__knexTxId:n}=this.connection;this.builder.emit("query",Object.assign({__knexUid:r,__knexTxId:n},t));let i=this,o=this.builder.queryContext();t!==null&&typeof t=="object"&&(t.queryContext=o);let a=this.client.query(this.connection,t);return t.timeout&&(a=ipu(a,t.timeout)),a.then(c=>this.client.processResponse(c,i)).then(c=>{let u=this.client.postProcessResponse(c,o);return this.builder.emit("query-response",u,Object.assign({__knexUid:r,__knexTxId:n},t),this.builder),this.client.emit("query-response",u,Object.assign({__knexUid:r,__knexTxId:n},t),this.builder),u}).catch(c=>{if(!(c instanceof KNi))return Promise.reject(c);let{timeout:u,sql:l,bindings:f}=t,d;return t.cancelOnTimeout?d=this.client.cancelQuery(this.connection):(this.connection.__knex__disposed=c,d=Promise.resolve()),d.catch(p=>{throw this.connection.__knex__disposed=c,Object.assign(p,{message:`After query timeout of ${u}ms exceeded, cancelling of query failed.`,sql:l,bindings:f,timeout:u})}).then(()=>{throw Object.assign(c,{message:`Defined query timeout of ${u}ms exceeded when running query.`,sql:l,bindings:f,timeout:u})})}).catch(c=>{throw this.builder.emit("query-error",c,Object.assign({__knexUid:r,__knexTxId:n,queryContext:o},t)),c})}async queryArray(t){if(t.length===1){let n=t[0];if(!n.statementsProducer)return this.query(n);let i=await n.statementsProducer(void 0,this.connection),o=i.sql.map(l=>({sql:l,bindings:n.bindings})),a=i.pre.map(l=>({sql:l,bindings:n.bindings})),c=i.post.map(l=>({sql:l,bindings:n.bindings})),u=[];await this.queryArray(a);try{await this.client.transaction(async l=>{let f=new e(l.client,this.builder);if(f.connection=this.connection,u=await f.queryArray(o),i.check&&(await l.raw(i.check)).length>0)throw new Error("FOREIGN KEY constraint failed")},{connection:this.connection})}finally{await this.queryArray(c)}return u}let r=[];for(let n of t)r.push(await this.queryArray([n]));return r}async ensureConnection(t,r){if(this.builder._connection&&(this.connection=this.builder._connection),this.connection)return t(this,r);let n;try{n=await this.client.acquireConnection()}catch(i){if(!(i instanceof KNi))return Promise.reject(i);throw this.builder&&(i.sql=this.builder.sql,i.bindings=this.builder.bindings),i}try{return this.connection=n,await t(this,r)}finally{await this.client.releaseConnection(n)}}};JNi.exports=Ujt});var e1i=A((m9f,ZNi)=>{"use strict";var VW=1e3,$W=VW*60,zW=$W*60,Vj=zW*24,apu=Vj*7,cpu=Vj*365.25;ZNi.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return upu(e);if(r==="number"&&isFinite(e))return t.long?fpu(e):lpu(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function upu(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*cpu;case"weeks":case"week":case"w":return r*apu;case"days":case"day":case"d":return r*Vj;case"hours":case"hour":case"hrs":case"hr":case"h":return r*zW;case"minutes":case"minute":case"mins":case"min":case"m":return r*$W;case"seconds":case"second":case"secs":case"sec":case"s":return r*VW;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}s(upu,"parse");function lpu(e){var t=Math.abs(e);return t>=Vj?Math.round(e/Vj)+"d":t>=zW?Math.round(e/zW)+"h":t>=$W?Math.round(e/$W)+"m":t>=VW?Math.round(e/VW)+"s":e+"ms"}s(lpu,"fmtShort");function fpu(e){var t=Math.abs(e);return t>=Vj?U2e(e,t,Vj,"day"):t>=zW?U2e(e,t,zW,"hour"):t>=$W?U2e(e,t,$W,"minute"):t>=VW?U2e(e,t,VW,"second"):e+" ms"}s(fpu,"fmtLong");function U2e(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}s(U2e,"plural")});var Fjt=A((A9f,t1i)=>{"use strict";function dpu(e){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=e1i(),r.destroy=l,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function t(f){let d=0;for(let p=0;p<f.length;p++)d=(d<<5)-d+f.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}s(t,"selectColor"),r.selectColor=t;function r(f){let d,p=null,h,g;function y(...b){if(!y.enabled)return;let v=y,C=Number(new Date),I=C-(d||C);v.diff=I,v.prev=d,v.curr=C,d=C,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let N=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(B,Q)=>{if(B==="%%")return"%";N++;let L=r.formatters[Q];if(typeof L=="function"){let G=b[N];B=L.call(v,G),b.splice(N,1),N--}return B}),r.formatArgs.call(v,b),(v.log||r.log).apply(v,b)}return s(y,"debug"),y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,g=r.enabled(f)),g),set:b=>{p=b}}),typeof r.init=="function"&&r.init(y),y}s(r,"createDebug");function n(f,d){let p=r(this.namespace+(typeof d>"u"?":":d)+f);return p.log=this.log,p}s(n,"extend");function i(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let d,p=(typeof f=="string"?f:"").split(/[\s,]+/),h=p.length;for(d=0;d<h;d++)p[d]&&(f=p[d].replace(/\*/g,".*?"),f[0]==="-"?r.skips.push(new RegExp("^"+f.slice(1)+"$")):r.names.push(new RegExp("^"+f+"$")))}s(i,"enable");function o(){let f=[...r.names.map(c),...r.skips.map(c).map(d=>"-"+d)].join(",");return r.enable(""),f}s(o,"disable");function a(f){if(f[f.length-1]==="*")return!0;let d,p;for(d=0,p=r.skips.length;d<p;d++)if(r.skips[d].test(f))return!1;for(d=0,p=r.names.length;d<p;d++)if(r.names[d].test(f))return!0;return!1}s(a,"enabled");function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}s(c,"toNamespace");function u(f){return f instanceof Error?f.stack||f.message:f}s(u,"coerce");function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return s(l,"destroy"),r.enable(r.load()),r}s(dpu,"setup");t1i.exports=dpu});var r1i=A((W_,F2e)=>{"use strict";W_.formatArgs=hpu;W_.save=mpu;W_.load=gpu;W_.useColors=ppu;W_.storage=Apu();W_.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();W_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ppu(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}s(ppu,"useColors");function hpu(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+F2e.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}s(hpu,"formatArgs");W_.log=console.debug||console.log||(()=>{});function mpu(e){try{e?W_.storage.setItem("debug",e):W_.storage.removeItem("debug")}catch{}}s(mpu,"save");function gpu(){let e;try{e=W_.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}s(gpu,"load");function Apu(){try{return localStorage}catch{}}s(Apu,"localstorage");F2e.exports=Fjt()(W_);var{formatters:ypu}=F2e.exports;ypu.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var i1i=A((yh,Q2e)=>{"use strict";var _pu=require("tty"),q2e=require("util");yh.init=Cpu;yh.log=Spu;yh.formatArgs=bpu;yh.save=wpu;yh.load=Tpu;yh.useColors=Epu;yh.destroy=q2e.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");yh.colors=[6,2,3,4,5,1];try{let e=A5e();e&&(e.stderr||e).level>=2&&(yh.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}yh.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function Epu(){return"colors"in yh.inspectOpts?!!yh.inspectOpts.colors:_pu.isatty(process.stderr.fd)}s(Epu,"useColors");function bpu(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${t} \x1B[0m`;e[0]=o+e[0].split(`
|
|
1269
|
+
`?(Y.line++,Y.column=0):Y.column++),Y.state){case L.BEGIN:if(Y.state=L.BEGIN_WHITESPACE,he==="\uFEFF")continue;fe(Y,he);continue;case L.BEGIN_WHITESPACE:fe(Y,he);continue;case L.TEXT:if(Y.sawRoot&&!Y.closedRoot){for(var Ve=ve-1;he&&he!=="<"&&he!=="&";)he=Ce($,ve++),he&&Y.trackPosition&&(Y.position++,he===`
|
|
1270
|
+
`?(Y.line++,Y.column=0):Y.column++);Y.textNode+=$.substring(Ve,ve-1)}he==="<"&&!(Y.sawRoot&&Y.closedRoot&&!Y.strict)?(Y.state=L.OPEN_WAKA,Y.startTagPosition=Y.position):(!I(he)&&(!Y.sawRoot||Y.closedRoot)&&F(Y,"Text data outside of root node."),he==="&"?Y.state=L.TEXT_ENTITY:Y.textNode+=he);continue;case L.SCRIPT:he==="<"?Y.state=L.SCRIPT_ENDING:Y.script+=he;continue;case L.SCRIPT_ENDING:he==="/"?Y.state=L.CLOSE_TAG:(Y.script+="<"+he,Y.state=L.SCRIPT);continue;case L.OPEN_WAKA:if(he==="!")Y.state=L.SGML_DECL,Y.sgmlDecl="";else if(!I(he))if(B(y,he))Y.state=L.OPEN_TAG,Y.tagName=he;else if(he==="/")Y.state=L.CLOSE_TAG,Y.tagName="";else if(he==="?")Y.state=L.PROC_INST,Y.procInstName=Y.procInstBody="";else{if(F(Y,"Unencoded <"),Y.startTagPosition+1<Y.position){var lt=Y.position-Y.startTagPosition;he=new Array(lt).join(" ")+he}Y.textNode+="<"+he,Y.state=L.TEXT}continue;case L.SGML_DECL:if(Y.sgmlDecl+he==="--"){Y.state=L.COMMENT,Y.comment="",Y.sgmlDecl="";continue}Y.doctype&&Y.doctype!==!0&&Y.sgmlDecl?(Y.state=L.DOCTYPE_DTD,Y.doctype+="<!"+Y.sgmlDecl+he,Y.sgmlDecl=""):(Y.sgmlDecl+he).toUpperCase()===f?(te(Y,"onopencdata"),Y.state=L.CDATA,Y.sgmlDecl="",Y.cdata=""):(Y.sgmlDecl+he).toUpperCase()===d?(Y.state=L.DOCTYPE,(Y.doctype||Y.sawRoot)&&F(Y,"Inappropriately located doctype declaration"),Y.doctype="",Y.sgmlDecl=""):he===">"?(te(Y,"onsgmldeclaration",Y.sgmlDecl),Y.sgmlDecl="",Y.state=L.TEXT):(N(he)&&(Y.state=L.SGML_DECL_QUOTED),Y.sgmlDecl+=he);continue;case L.SGML_DECL_QUOTED:he===Y.q&&(Y.state=L.SGML_DECL,Y.q=""),Y.sgmlDecl+=he;continue;case L.DOCTYPE:he===">"?(Y.state=L.TEXT,te(Y,"ondoctype",Y.doctype),Y.doctype=!0):(Y.doctype+=he,he==="["?Y.state=L.DOCTYPE_DTD:N(he)&&(Y.state=L.DOCTYPE_QUOTED,Y.q=he));continue;case L.DOCTYPE_QUOTED:Y.doctype+=he,he===Y.q&&(Y.q="",Y.state=L.DOCTYPE);continue;case L.DOCTYPE_DTD:he==="]"?(Y.doctype+=he,Y.state=L.DOCTYPE):he==="<"?(Y.state=L.OPEN_WAKA,Y.startTagPosition=Y.position):N(he)?(Y.doctype+=he,Y.state=L.DOCTYPE_DTD_QUOTED,Y.q=he):Y.doctype+=he;continue;case L.DOCTYPE_DTD_QUOTED:Y.doctype+=he,he===Y.q&&(Y.state=L.DOCTYPE_DTD,Y.q="");continue;case L.COMMENT:he==="-"?Y.state=L.COMMENT_ENDING:Y.comment+=he;continue;case L.COMMENT_ENDING:he==="-"?(Y.state=L.COMMENT_ENDED,Y.comment=U(Y.opt,Y.comment),Y.comment&&te(Y,"oncomment",Y.comment),Y.comment=""):(Y.comment+="-"+he,Y.state=L.COMMENT);continue;case L.COMMENT_ENDED:he!==">"?(F(Y,"Malformed comment"),Y.comment+="--"+he,Y.state=L.COMMENT):Y.doctype&&Y.doctype!==!0?Y.state=L.DOCTYPE_DTD:Y.state=L.TEXT;continue;case L.CDATA:for(var Ve=ve-1;he&&he!=="]";)he=Ce($,ve++),he&&Y.trackPosition&&(Y.position++,he===`
|
|
1271
|
+
`?(Y.line++,Y.column=0):Y.column++);Y.cdata+=$.substring(Ve,ve-1),he==="]"&&(Y.state=L.CDATA_ENDING);continue;case L.CDATA_ENDING:he==="]"?Y.state=L.CDATA_ENDING_2:(Y.cdata+="]"+he,Y.state=L.CDATA);continue;case L.CDATA_ENDING_2:he===">"?(Y.cdata&&te(Y,"oncdata",Y.cdata),te(Y,"onclosecdata"),Y.cdata="",Y.state=L.TEXT):he==="]"?Y.cdata+="]":(Y.cdata+="]]"+he,Y.state=L.CDATA);continue;case L.PROC_INST:he==="?"?Y.state=L.PROC_INST_ENDING:I(he)?Y.state=L.PROC_INST_BODY:Y.procInstName+=he;continue;case L.PROC_INST_BODY:if(!Y.procInstBody&&I(he))continue;he==="?"?Y.state=L.PROC_INST_ENDING:Y.procInstBody+=he;continue;case L.PROC_INST_ENDING:he===">"?(te(Y,"onprocessinginstruction",{name:Y.procInstName,body:Y.procInstBody}),Y.procInstName=Y.procInstBody="",Y.state=L.TEXT):(Y.procInstBody+="?"+he,Y.state=L.PROC_INST_BODY);continue;case L.OPEN_TAG:B(b,he)?Y.tagName+=he:(D(Y),he===">"?_e(Y):he==="/"?Y.state=L.OPEN_TAG_SLASH:(I(he)||F(Y,"Invalid character in tag name"),Y.state=L.ATTRIB));continue;case L.OPEN_TAG_SLASH:he===">"?(_e(Y,!0),Le(Y)):(F(Y,"Forward-slash in opening tag not followed by >"),Y.state=L.ATTRIB);continue;case L.ATTRIB:if(I(he))continue;he===">"?_e(Y):he==="/"?Y.state=L.OPEN_TAG_SLASH:B(y,he)?(Y.attribName=he,Y.attribValue="",Y.state=L.ATTRIB_NAME):F(Y,"Invalid attribute name");continue;case L.ATTRIB_NAME:he==="="?Y.state=L.ATTRIB_VALUE:he===">"?(F(Y,"Attribute without value"),Y.attribValue=Y.attribName,ee(Y),_e(Y)):I(he)?Y.state=L.ATTRIB_NAME_SAW_WHITE:B(b,he)?Y.attribName+=he:F(Y,"Invalid attribute name");continue;case L.ATTRIB_NAME_SAW_WHITE:if(he==="=")Y.state=L.ATTRIB_VALUE;else{if(I(he))continue;F(Y,"Attribute without value"),Y.tag.attributes[Y.attribName]="",Y.attribValue="",te(Y,"onattribute",{name:Y.attribName,value:""}),Y.attribName="",he===">"?_e(Y):B(y,he)?(Y.attribName=he,Y.state=L.ATTRIB_NAME):(F(Y,"Invalid attribute name"),Y.state=L.ATTRIB)}continue;case L.ATTRIB_VALUE:if(I(he))continue;N(he)?(Y.q=he,Y.state=L.ATTRIB_VALUE_QUOTED):(Y.opt.unquotedAttributeValues||le(Y,"Unquoted attribute value"),Y.state=L.ATTRIB_VALUE_UNQUOTED,Y.attribValue=he);continue;case L.ATTRIB_VALUE_QUOTED:if(he!==Y.q){he==="&"?Y.state=L.ATTRIB_VALUE_ENTITY_Q:Y.attribValue+=he;continue}ee(Y),Y.q="",Y.state=L.ATTRIB_VALUE_CLOSED;continue;case L.ATTRIB_VALUE_CLOSED:I(he)?Y.state=L.ATTRIB:he===">"?_e(Y):he==="/"?Y.state=L.OPEN_TAG_SLASH:B(y,he)?(F(Y,"No whitespace between attributes"),Y.attribName=he,Y.attribValue="",Y.state=L.ATTRIB_NAME):F(Y,"Invalid attribute name");continue;case L.ATTRIB_VALUE_UNQUOTED:if(!T(he)){he==="&"?Y.state=L.ATTRIB_VALUE_ENTITY_U:Y.attribValue+=he;continue}ee(Y),he===">"?_e(Y):Y.state=L.ATTRIB;continue;case L.CLOSE_TAG:if(Y.tagName)he===">"?Le(Y):B(b,he)?Y.tagName+=he:Y.script?(Y.script+="</"+Y.tagName,Y.tagName="",Y.state=L.SCRIPT):(I(he)||F(Y,"Invalid tagname in closing tag"),Y.state=L.CLOSE_TAG_SAW_WHITE);else{if(I(he))continue;Q(y,he)?Y.script?(Y.script+="</"+he,Y.state=L.SCRIPT):F(Y,"Invalid tagname in closing tag."):Y.tagName=he}continue;case L.CLOSE_TAG_SAW_WHITE:if(I(he))continue;he===">"?Le(Y):F(Y,"Invalid characters in closing tag");continue;case L.TEXT_ENTITY:case L.ATTRIB_VALUE_ENTITY_Q:case L.ATTRIB_VALUE_ENTITY_U:var It,er;switch(Y.state){case L.TEXT_ENTITY:It=L.TEXT,er="textNode";break;case L.ATTRIB_VALUE_ENTITY_Q:It=L.ATTRIB_VALUE_QUOTED,er="attribValue";break;case L.ATTRIB_VALUE_ENTITY_U:It=L.ATTRIB_VALUE_UNQUOTED,er="attribValue";break}if(he===";"){var mt=je(Y);Y.opt.unparsedEntities&&!Object.values(e.XML_ENTITIES).includes(mt)?(Y.entity="",Y.state=It,Y.write(mt)):(Y[er]+=mt,Y.entity="",Y.state=It)}else B(Y.entity.length?C:v,he)?Y.entity+=he:(F(Y,"Invalid character in entity name"),Y[er]+="&"+Y.entity+he,Y.entity="",Y.state=It);continue;default:throw new Error(Y,"Unknown state: "+Y.state)}return Y.position>=Y.bufferCheckPosition&&n(Y),Y}s(Ie,"write");String.fromCodePoint||function(){var $=String.fromCharCode,Y=Math.floor,ve=s(function(){var he=16384,lt=[],Ve,It,er=-1,mt=arguments.length;if(!mt)return"";for(var pr="";++er<mt;){var pn=Number(arguments[er]);if(!isFinite(pn)||pn<0||pn>1114111||Y(pn)!==pn)throw RangeError("Invalid code point: "+pn);pn<=65535?lt.push(pn):(pn-=65536,Ve=(pn>>10)+55296,It=pn%1024+56320,lt.push(Ve,It)),(er+1===mt||lt.length>he)&&(pr+=$.apply(null,lt),lt.length=0)}return pr},"fromCodePoint");Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:ve,configurable:!0,writable:!0}):String.fromCodePoint=ve}()})(typeof S2e>"u"?S2e.sax={}:S2e)});var aki=A(Uj=>{"use strict";(function(){var e,t,r,n={}.hasOwnProperty,i=s(function(a,c){for(var u in c)n.call(c,u)&&(a[u]=c[u]);function l(){this.constructor=a}return s(l,"ctor"),l.prototype=c.prototype,a.prototype=new l,a.__super__=c.prototype,a},"__extends"),o=s(function(a,c){return function(){return a.apply(c,arguments)}},"__bind");r=oki(),e=require("events"),t=s(function(a){return typeof a=="object"&&a!=null&&Object.keys(a).length===0},"isEmpty"),Uj.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null}},Uj.ValidationError=function(a){i(c,a),c.name="ValidationError";function c(u){this.message=u}return s(c,"ValidationError"),c}(Error),Uj.Parser=function(a){i(c,a),c.name="Parser";function c(u){this.parseString=o(this.parseString,this),this.reset=o(this.reset,this);var l,f,d;this.options={},d=Uj.defaults["0.1"];for(l in d)n.call(d,l)&&(f=d[l],this.options[l]=f);for(l in u)n.call(u,l)&&(f=u[l],this.options[l]=f);this.reset()}return s(c,"Parser"),c.prototype.reset=function(){var u,l,f,d,p=this;return this.removeAllListeners(),this.saxParser=r.parser(!0,{trim:!1,normalize:!1}),f=!1,this.saxParser.onerror=function(h){if(!f)return f=!0,p.emit("error",h)},this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,d=[],u=this.options.attrkey,l=this.options.charkey,this.saxParser.onopentag=function(h){var g,y,b;if(y={},y[l]="",!p.options.ignoreAttrs){b=h.attributes;for(g in b)n.call(b,g)&&(!(u in y)&&!p.options.mergeAttrs&&(y[u]={}),p.options.mergeAttrs?y[g]=h.attributes[g]:y[u][g]=h.attributes[g])}return y["#name"]=h.name,d.push(y)},this.saxParser.onclosetag=function(){var h,g,y,b,v,C;return y=d.pop(),g=y["#name"],delete y["#name"],v=d[d.length-1],y[l].match(/^\s*$/)?delete y[l]:(p.options.trim&&(y[l]=y[l].trim()),p.options.normalize&&(y[l]=y[l].replace(/\s{2,}/g," ").trim()),Object.keys(y).length===1&&l in y&&!p.EXPLICIT_CHARKEY&&(y=y[l])),p.options.emptyTag!==void 0&&t(y)&&(y=p.options.emptyTag),p.options.validator!=null&&(C="/"+function(){var I,N,T;for(T=[],I=0,N=d.length;I<N;I++)h=d[I],T.push(h["#name"]);return T}().concat(g).join("/"),y=p.options.validator(C,v&&v[g],y)),d.length>0?p.options.explicitArray?(v[g]instanceof Array||(v[g]=[]),v[g].push(y)):g in v?(v[g]instanceof Array||(b=v[g],v[g]=[b]),v[g].push(y)):v[g]=y:(p.options.explicitRoot&&(b=y,y={},y[g]=b),p.resultObject=y,p.emit("end",p.resultObject))},this.saxParser.ontext=this.saxParser.oncdata=function(h){var g;if(g=d[d.length-1],g)return g[l]+=h}},c.prototype.parseString=function(u,l){if(l!=null&&typeof l=="function"&&(this.on("end",function(f){return this.reset(),l(null,f)}),this.on("error",function(f){return this.reset(),l(f)})),u.toString().trim()==="")return this.emit("end",null),!0;try{return this.saxParser.write(u.toString())}catch(f){if(f instanceof Uj.ValidationError)return this.emit("error",f.message);throw f}},c}(e.EventEmitter)}).call(Uj)});var dki=A(QW=>{"use strict";var Que=ski(),Afu=require("dns"),Uue=require("http"),FW=require("https"),yfu=aki(),Fue=require("url"),_fu=require("querystring"),Efu="application/json",bfu="application/xrd+xml",que=s(function(e,t){var r=s(function(o,a){var c,u;a.hasOwnProperty("@")&&(a["@"].hasOwnProperty("type")&&(c=a["@"].type),a["@"].hasOwnProperty("xsi:nil")&&a["@"]["xsi:nil"]=="true"?o[c]=null:a.hasOwnProperty("#")&&(o[c]=a["#"]))},"getProperty"),n=s(function(o,a){var c="default";typeof a=="string"?o[c]=a:(a.hasOwnProperty("@")&&a["@"].hasOwnProperty("xml:lang")&&(c=a["@"]["xml:lang"]),a.hasOwnProperty("#")&&(o[c]=a["#"]))},"getTitle"),i=s(function(o){var a,c,u,l,f,d,p;if(u={},o.hasOwnProperty("@"))for(a in o["@"])o["@"].hasOwnProperty(a)&&(u[a]=o["@"][a]);if(o.hasOwnProperty("Property"))if(u.properties={},Array.isArray(o.Property))for(c=0;c<o.Property.length;c++)r(u.properties,o.Property[c]);else r(u.properties,o.Property);if(o.hasOwnProperty("Title"))if(u.titles={},Array.isArray(o.Title))for(c=0;c<o.Title.length;c++)n(u.titles,o.Title[c]);else n(u.titles,o.Title);return u},"getLink");Que(function(){var o=new yfu.Parser;o.parseString(e,this)},function(o,a){var c,u={},l,f,d;if(o)t(o,null);else{if(a.hasOwnProperty("Subject")&&(Array.isArray(a.Subject)?u.subject=a.Subject[0]:u.subject=a.Subject),a.hasOwnProperty("Expires")&&(Array.isArray(a.Expires)?u.expires=a.Expires[0]:u.expires=a.Expires),a.hasOwnProperty("Alias")&&(Array.isArray(a.Alias)?u.aliases=a.Alias:u.aliases=[a.Alias]),a.hasOwnProperty("Property"))if(u.properties={},Array.isArray(a.Property))for(l=0;l<a.Property.length;l++)r(u.properties,a.Property[l]);else r(u.properties,a.Property);if(a.hasOwnProperty("Link"))if(c=a.Link,u.links=[],Array.isArray(c))for(l=0;l<c.length;l++)u.links.push(i(c[l]));else u.links.push(i(c));t(null,u)}})},"xrd2jrd"),qW=s(function(e,t){var r;try{r=JSON.parse(e),t(null,r)}catch(n){t(n,null)}},"jrd"),zB=s(function(e,t,r,n){var i=[],o;for(o in r)r.hasOwnProperty(o)&&i.push(o);var a=e.request(t,function(c){var u="";c.setEncoding("utf8"),c.on("data",function(l){u=u+l}),c.on("error",function(l){n(l,null)}),c.on("end",function(){var l,f,d,p;if(c.statusCode>300&&c.statusCode<400&&c.headers.location){if(p=Fue.parse(c.headers.location),t.httpsOnly&&p.protocol!="https:"){n(new Error("Refusing to redirect to non-HTTPS url: "+c.headers.location),null);return}p.httpsOnly=t.httpsOnly,zB(p.protocol=="https:"?FW:Uue,p,r,n);return}else if(c.statusCode!==200){n(new Error("Bad response code: "+c.statusCode+":"+u),null);return}if(!c.headers["content-type"]){n(new Error("No Content-Type header"),null);return}if(l=c.headers["content-type"],f=i.filter(function(h){return l.substr(0,h.length)==h}),f.length==0){n(new Error("Content-Type '"+l+"' does not match any expected types: "+i.join(",")),null);return}d=r[f],d(u,n)})});a.on("error",function(c){n(c,null)}),a.end()},"request"),vfu=s(function(e,t){var r={hostname:e,port:80,path:"/.well-known/host-meta",method:"GET",headers:{accept:"application/json, application/xrd+xml; q=0.5"}};zB(Uue,r,{"application/json":qW,"application/xrd+xml":que},t)},"httpHostMeta"),Sfu=s(function(e,t){var r={hostname:e,port:80,path:"/.well-known/host-meta.json",method:"GET"};zB(Uue,r,{"application/json":qW},t)},"httpHostMetaJSON"),wfu=s(function(e,t,r){var n={hostname:e,port:443,path:"/.well-known/host-meta",method:"GET",headers:{accept:"application/json, application/xrd+xml; q=0.5"},httpsOnly:t};zB(FW,n,{"application/json":qW,"application/xrd+xml":que},r)},"httpsHostMeta"),Tfu=s(function(e,t,r){var n={hostname:e,port:443,path:"/.well-known/host-meta.json",method:"GET",httpsOnly:t};zB(FW,n,{"application/json":qW},r)},"httpsHostMetaJSON"),uki=s(function(e){var t=["example.com","example.org","example.net"],r=["example","invalid"],n;return t.indexOf(e.toLowerCase())!=-1||(n=e.split("."),r.indexOf(n[n.length-1])!=-1)},"invalidHostname"),rjt=s(function(e,t,r){if(r||(r=t,t={}),uki(e)){r(new Error("Invalid hostname: "+e),null);return}Que(function(){Afu.lookup(e,this)},function(n,i,o){if(n){r(n,null);return}else Tfu(i,t.httpsOnly,this)},function(n,i){n?n.code=="ECONNREFUSED"?this(n,null):wfu(e,t.httpsOnly,this):r(null,i)},function(n,i){n?t.httpsOnly?r(new Error("No HTTPS endpoint worked"),null):Sfu(e,this):r(null,i)},function(n,i){n?n.code=="ECONNREFUSED"?this(n,null):vfu(e,this):r(null,i)},function(n,i){n?r(new Error("Unable to get host-meta or host-meta.json"),null):r(null,i)})},"hostmeta"),cki=s(function(e,t,r,n){var i,o,a;i={resource:t},r&&(i.rel=r),o=_fu.stringify(i),a={hostname:e,port:443,path:"/.well-known/webfinger?"+o,method:"GET",httpsOnly:!0},zB(FW,a,{"application/json":qW},n)},"httpsWebfinger"),tjt=s(function(e,t,r,n,i){Que(function(){var o=e.replace("{uri}",encodeURIComponent(t)),a=Fue.parse(o);a.httpsOnly=n,zB(a.protocol=="https:"?FW:Uue,a,r,this)},function(o,a){var c,u;if(o)if(t.substr(0,5)=="acct:")c=e.replace("{uri}",encodeURIComponent(t.substr(5))),u=Fue.parse(c),u.httpsOnly=n,zB(u.protocol=="https:"?FW:Uue,u,r,this);else throw o;else{i(null,a);return}},function(o,a){o?i(o,null):i(null,a)})},"template"),lki=s(function(e,t,r){var n,i;r||(r=t,t={}),e.indexOf(":")===-1&&e.indexOf("@")!==-1&&(e="acct:"+e),n=Fue.parse(e),i=n.hostname,Que(function(){rjt(i,t,this)},function(o,a){var c,u,l;if(o)throw o;if(!a.hasOwnProperty("links"))throw new Error("No links in host-meta");if(c=a.links.filter(function(f){return f.hasOwnProperty("rel")&&f.rel=="lrdd"&&f.hasOwnProperty("template")&&(!t.httpsOnly||f.template.substr(0,6)=="https:")}),!c||c.length===0)throw new Error("No lrdd links with templates in host-meta");if(u=c.filter(function(f){return f.hasOwnProperty("type")&&f.type==Efu}),u&&u.length>0){tjt(u[0].template,e,{"application/json":qW},t.httpsOnly,this);return}if(l=c.filter(function(f){return f.hasOwnProperty("type")&&f.type==bfu}),l&&l.length>0){tjt(l[0].template,e,{"application/xrd+xml":que},t.httpsOnly,this);return}if(l=c.filter(function(f){return!f.hasOwnProperty("type")}),l&&l.length>0){tjt(l[0].template,e,{"application/xrd+xml":que},t.httpsOnly,this);return}throw new Error("No lrdd links with templates and acceptable type in host-meta")},r)},"lrdd"),fki=s(function(e,t,r,n){var i,o;if(n||(n=r,r={}),n||(n=t,t=null),e.indexOf(":")===-1&&e.indexOf("@")!==-1&&(e="acct:"+e),i=Fue.parse(e),o=i.hostname,uki(o)){n(new Error("Invalid hostname: "+o),null);return}Que(function(){cki(o,e,t,this)},function(a,c){if(a)if(e.substr(0,5)=="acct:")cki(o,e.substr(5),t,this);else throw a;else{n(null,c);return}},function(a,c){if(!a){n(null,c);return}if(r.webfingerOnly)throw new Error("Unable to find webfinger");lki(e,r,this)},n)},"webfinger"),Cfu=s(function(e,t){e.indexOf("@")!==-1?fki(e,t):rjt(e,t)},"discover");QW.xrd2jrd=que;QW.webfinger=fki;QW.lrdd=lki;QW.hostmeta=rjt;QW.discover=Cfu});var mki=A((z$f,hki)=>{"use strict";function pki(e,t){this.name="NoOpenIDError",this.message=e,this.stack=new Error().stack,this.response=t}s(pki,"NoOpenIDError");pki.prototype=new Error;hki.exports=pki});var Eki=A((Y$f,_ki)=>{"use strict";var xfu=dki().webfinger,gki=mki(),Aki="http://openid.net/specs/connect/1.0/issuer";function yki(){}s(yki,"Resolver");yki.prototype.resolve=function(e,t){xfu(e,Aki,{webfingerOnly:!0},function(r,n){if(r)return t(r);if(!n.links)return t(new gki("No links in resource descriptor",n));for(var i,o=0;o<n.links.length;o++){var a=n.links[o];if(a.rel===Aki){i=a.href;break}}return i?t(null,i):t(new gki("No OpenID Connect issuer in resource descriptor",n))})};_ki.exports=yki});var Ski=A((J$f,vki)=>{"use strict";function bki(e){if(e=e||{},this._getClientCb=e.getClientCallback,!this._getClientCb)throw new Error("OpenID Connect authentication requires getClientCallback option")}s(bki,"Registrar");bki.prototype.resolve=function(e,t){this._getClientCb(e,function(r,n){return r?t(r):n?t(null,n):t(new Error("No client able to interact with OpenID provider: "+e))})};vki.exports=bki});var Cki=A((wki,Tki)=>{"use strict";var Ifu=iki(),Rfu=Eki(),Ofu=Ski(),njt,ijt;wki=Tki.exports=function(e){var t=e.resolver,r=e.registrar;return t||(njt=njt||new Rfu(e),t=njt),r||(ijt=ijt||new Ofu(e),r=ijt),s(function(i,o){t.resolve(i,function(a,c){if(a)return o(a);var u=c+"/.well-known/openid-configuration";Ifu.get(u,function(l,f,d){if(l)return o(l);if(f.statusCode!==200)return o(new Error("Unexpected status code from OpenID provider configuration: "+f.statusCode));var p={};try{var h=JSON.parse(d);p.issuer=h.issuer,p.authorizationURL=h.authorization_endpoint,p.tokenURL=h.token_endpoint,p.userInfoURL=h.userinfo_endpoint,p.registrationURL=h.registration_endpoint,p._raw=h}catch{return o(new Error("Failed to parse OpenID provider configuration"))}r.resolve(p.issuer,function(g,y){return g?o(null,g):(p.clientID=y.id,p.clientSecret=y.secret,y.redirectURIs&&(p.callbackURL=y.redirectURIs[0]),o(null,p))})})})},"dynamic")}});var Nki=A((e6f,kki)=>{"use strict";var Oki=vj(),jue=require("url"),kfu=require("querystring"),Nfu=require("util"),sjt=yFt(),Dfu=H2t().OAuth2,Pfu=fSi(),xki=pSi(),Iki=require("crypto"),Rki=X2t(),Bfu=gSi();function Fj(e,t){e=e||{},Oki.Strategy.call(this),this.name="openidconnect",this._verify=t,this._identifierField=e.identifierField||"openid_identifier",this._scope=e.scope,this._passReqToCallback=e.passReqToCallback,this._skipUserProfile=e.skipUserProfile===void 0?!1:e.skipUserProfile,this._setup=void 0,this._key=e.sessionKey||this.name+":"+jue.parse(e.authorizationURL).hostname,this._stateStore=e.store||new Pfu({key:this._key}),e.authorizationURL&&e.tokenURL?this.configure(_Si()(e)):this.configure(Cki()(e))}s(Fj,"Strategy");Nfu.inherits(Fj,Oki.Strategy);Fj.prototype.authenticate=function(e,t){t=t||{};var r=this;if(e.query&&e.query.error)return e.query.error=="access_denied"?this.fail({message:e.query.error_description}):this.error(new Bfu(e.query.error_description,e.query.error,e.query.error_uri));if(e.query&&e.query.code){let a=function(c,u,l){if(c)return r.error(c);if(!u)return r.fail(l,403);var f=e.query.code,d=l,p=d.callbackURL,h=r._getOAuth2Client(d),g={grant_type:"authorization_code",redirect_uri:p};l.pkce&&(g.code_verifier=l.params.verifier),h.getOAuthAccessToken(f,g,function(y,b,v,C){if(y)return r.error(new xki("failed to obtain access token",y));var I=C.id_token;if(!I)return r.error(new Error("ID Token not present in token response"));var N=I.split("."),T,B;try{T=new Buffer(N[1],"base64").toString(),B=JSON.parse(T)}catch(J){return r.error(J)}var Q=["iss","sub","aud","exp","iat"].filter(function(J){return!B[J]});if(Q.length)return r.error(new Error("id token is missing required parameter(s) - "+Q.join(", ")));if(B.iss!==d.issuer)return r.error(new Error("id token not issued by correct OpenID provider - expected: "+d.issuer+" | from: "+B.iss));if(typeof B.aud=="string"){if(B.aud!==d.clientID)return r.error(new Error("aud parameter does not include this client - is: "+B.aud+"| expected: "+d.clientID))}else if(Array.isArray(B.aud)){if(B.aud.indexOf(d.clientID)===-1)return r.error(new Error("aud parameter does not include this client - is: "+B.aud+" | expected to include: "+d.clientID));if(B.length>1&&!B.azp)return r.error(new Error("azp parameter required with multiple audiences"))}else return r.error(new Error("Invalid aud parameter type"));if(B.azp&&B.azp!==d.clientID)return r.error(new Error("this client is not the authorized party - expected: "+d.clientID+" | is: "+B.azp));if(B.exp<Date.now()/1e3)return r.error(new Error("id token has expired"));if(d.params.max_age&&(!B.auth_time||d.timestamp-d.params.max_age>B.auth_time))return r.error(new Error("auth_time in id_token not included or too old"));if(d.params.nonce&&(!B.nonce||B.nonce!==d.params.nonce))return r.error(new Error("Invalid nonce in id_token"));var L=B.iss,G=B.sub;G||(G=B.user_id),r._shouldLoadUserProfile(L,G,function(J,te){if(J)return r.error(J);if(te){var de=jue.parse(d.userInfoURL,!0);de.query.schema="openid",delete de.search;var U=jue.format(de);h._request("GET",U,{Authorization:"Bearer "+b,Accept:"application/json"},null,null,function(X,F,D){if(X)return r.error(new xki("failed to fetch user profile",X));var be={};try{var ee=JSON.parse(F);be.id=ee.sub,B&&B.oid&&(be.id=B.oid),be.id||(be.id=ee.user_id),be.displayName=ee.name,be.name={familyName:ee.family_name,givenName:ee.given_name,middleName:ee.middle_name},be._raw=F,be._json=ee,le(be)}catch(_e){return r.error(_e)}})}else le();function le(X){function F(be,ee,_e){if(be)return r.error(be);if(!ee)return r.fail(_e);_e=_e||{},l&&(_e.state=l),r.success(ee,_e)}if(s(F,"verified"),r._passReqToCallback){var D=r._verify.length;D==10?r._verify(e,L,G,X,B,b,v,I,C,F):D==9?r._verify(e,L,G,X,B,b,v,C,F):D==8?r._verify(e,L,G,X,b,v,C,F):D==7?r._verify(e,L,G,X,b,v,F):D==5?r._verify(e,L,G,X,F):r._verify(e,L,G,F)}else{var D=r._verify.length;D==9?r._verify(L,G,X,B,b,v,I,C,F):D==8?r._verify(L,G,X,B,b,v,C,F):D==7?r._verify(L,G,X,b,v,C,F):D==6?r._verify(L,G,X,b,v,F):D==4?r._verify(L,G,X,F):r._verify(L,G,F)}}s(le,"onProfileLoaded")})})};var o=a;s(a,"loaded");var n=e.query.state;try{r._stateStore.verify(e,n,a)}catch(c){return r.error(c)}}else{var i;e.body&&e.body[this._identifierField]?i=e.body[this._identifierField]:e.query&&e.query[this._identifierField]&&(i=e.query[this._identifierField]),this._setup(i,function(a,c){if(a)return r.error(a);var u=c,l=t.callbackURL||c.callbackURL;if(l){var f=jue.parse(l);f.protocol||(l=jue.resolve(sjt.originalURL(e),l))}u.callbackURL=l;var d=r.authorizationParams(t);d.response_type="code",d.client_id=c.clientID,l&&(d.redirect_uri=l);var p=t.scope||r._scope;Array.isArray(p)&&(p=p.join(" ")),p?d.scope="openid "+p:d.scope="openid";var h=["max_age","ui_locals","id_token_hint","login_hint","acr_values"];h.filter(v=>v in c).map(v=>{d[v]=c[v]}),c.display&&["page","popup","touch","wap"].indexOf(c.display)!==-1&&(d.display=c.display),c.prompt&&["none","login","consent","select_account"].indexOf(c.prompt)!==-1&&(d.prompt=c.prompt),c.nonce&&typeof c.nonce=="boolean"&&(d.nonce=sjt.uid(20)),c.nonce&&typeof c.nonce=="number"&&(d.nonce=sjt.uid(c.nonce)),c.nonce&&typeof c.nonce=="string"&&(d.nonce=c.nonce),d.max_age&&(u.timestamp=Math.floor(Date.now()/1e3)),u.params=d;for(param in d)u[param]&&delete u[param];if(c.pkce){var g=Rki(Iki.pseudoRandomBytes(32));switch(c.pkce){case"S256":d.code_challenge=Rki(Iki.createHash("sha256").update(g).digest());break;case"plain":d.code_challenge=g;break;default:return r.error(new Error("Unsupported code verifier transformation method: "+c.pkce))}d.code_challenge_method=c.pkce,d.verifier=g}function y(v,C){if(v)return r.error(v);if(!C)return r.error(new Error("Unable to generate required state parameter"));d.state=C;let I={...d};delete I.verifier;var N=c.authorizationURL+"?"+kfu.stringify(I);r.redirect(N)}s(y,"stored");try{var b=r._stateStore.store.length;b==3?r._stateStore.store(e,u,y):r._stateStore.store(e,y)}catch(v){return r.error(v)}})}};Fj.prototype.configure=function(e,t){this._setup=e};Fj.prototype.authorizationParams=function(e){return{}};Fj.prototype._shouldLoadUserProfile=function(e,t,r){if(typeof this._skipUserProfile=="function"&&this._skipUserProfile.length>1)this._skipUserProfile(e,t,function(i,o){return i?r(i):o?r(null,!1):r(null,!0)});else{var n=typeof this._skipUserProfile=="function"?this._skipUserProfile(e,t):this._skipUserProfile;return n?r(null,!1):r(null,!0)}};Fj.prototype._getOAuth2Client=function(e){return new Dfu(e.clientID,e.clientSecret,"",e.authorizationURL,e.tokenURL)};kki.exports=Fj});var Bki=A((ojt,Pki)=>{"use strict";var Dki=Nki();ojt=Pki.exports=Dki;ojt.Strategy=Dki});var w2e=A((Mki,Lki)=>{"use strict";var jW=Mki=Lki.exports={};jW.login=jW.logIn=function(e,t,r){typeof t=="function"&&(r=t,t={}),t=t||{};var n=this._userProperty||"user",i=t.session===void 0?!0:t.session;if(this[n]=e,i&&this._sessionManager){if(typeof r!="function")throw new Error("req#login requires a callback function");var o=this;this._sessionManager.logIn(this,e,t,function(a){if(a)return o[n]=null,r(a);r()})}else r&&r()};jW.logout=jW.logOut=function(e,t){typeof e=="function"&&(t=e,e={}),e=e||{};var r=this._userProperty||"user";if(this[r]=null,this._sessionManager){if(typeof t!="function")throw new Error("req#logout requires a callback function");this._sessionManager.logOut(this,e,t)}else t&&t()};jW.isAuthenticated=function(){var e=this._userProperty||"user";return!!this[e]};jW.isUnauthenticated=function(){return!this.isAuthenticated()}});var cjt=A((ozf,Uki)=>{"use strict";var T2e=w2e();Uki.exports=s(function(t,r){return r=r||{},s(function(i,o,a){i.login=i.logIn=i.logIn||T2e.logIn,i.logout=i.logOut=i.logOut||T2e.logOut,i.isAuthenticated=i.isAuthenticated||T2e.isAuthenticated,i.isUnauthenticated=i.isUnauthenticated||T2e.isUnauthenticated,i._sessionManager=t._sm,r.userProperty&&(i._userProperty=r.userProperty);var c=r.compat===void 0?!0:r.compat;c&&(t._userProperty=r.userProperty||"user",i._passport={},i._passport.instance=t),a()},"initialize")},"initialize")});var Qki=A((czf,qki)=>{"use strict";function Fki(e,t){Error.call(this),Error.captureStackTrace(this,arguments.callee),this.name="AuthenticationError",this.message=e,this.status=t||401}s(Fki,"AuthenticationError");Fki.prototype.__proto__=Error.prototype;qki.exports=Fki});var ujt=A((lzf,Hki)=>{"use strict";var jki=require("http"),C2e=w2e(),Yfu=Qki();Hki.exports=s(function(t,r,n,i){typeof n=="function"&&(i=n,n={}),n=n||{};var o=!0;return Array.isArray(r)||(r=[r],o=!1),s(function(c,u,l){c.login=c.logIn=c.logIn||C2e.logIn,c.logout=c.logOut=c.logOut||C2e.logOut,c.isAuthenticated=c.isAuthenticated||C2e.isAuthenticated,c.isUnauthenticated=c.isUnauthenticated||C2e.isUnauthenticated,c._sessionManager=t._sm;var f=[];function d(){if(i)if(o){var p=f.map(function(L){return L.challenge}),h=f.map(function(L){return L.status});return i(null,!1,p,h)}else return i(null,!1,f[0].challenge,f[0].status);var g=f[0]||{},y=g.challenge||{},b;if(n.failureFlash){var v=n.failureFlash;typeof v=="string"&&(v={type:"error",message:v}),v.type=v.type||"error";var C=v.type||y.type||"error";b=v.message||y.message||y,typeof b=="string"&&c.flash(C,b)}if(n.failureMessage&&(b=n.failureMessage,typeof b=="boolean"&&(b=y.message||y),typeof b=="string"&&(c.session.messages=c.session.messages||[],c.session.messages.push(b))),n.failureRedirect)return u.redirect(n.failureRedirect);for(var I=[],N,T,B=0,Q=f.length;B<Q;B++)g=f[B],y=g.challenge,T=g.status,N=N||T,typeof y=="string"&&I.push(y);if(u.statusCode=N||401,u.statusCode==401&&I.length&&u.setHeader("WWW-Authenticate",I),n.failWithError)return l(new Yfu(jki.STATUS_CODES[u.statusCode],N));u.end(jki.STATUS_CODES[u.statusCode])}s(d,"allFailed"),s(function p(h){var g=r[h];if(!g)return d();var y,b;if(typeof g.authenticate=="function")y=g;else{if(b=t._strategy(g),!b)return l(new Error('Unknown authentication strategy "'+g+'"'));y=Object.create(b)}y.success=function(v,C){if(i)return i(null,v,C);C=C||{};var I;if(n.successFlash){var N=n.successFlash;typeof N=="string"&&(N={type:"success",message:N}),N.type=N.type||"success";var T=N.type||C.type||"success";I=N.message||C.message||C,typeof I=="string"&&c.flash(T,I)}if(n.successMessage&&(I=n.successMessage,typeof I=="boolean"&&(I=C.message||C),typeof I=="string"&&(c.session.messages=c.session.messages||[],c.session.messages.push(I))),n.assignProperty)return c[n.assignProperty]=v,l();c.logIn(v,n,function(B){if(B)return l(B);function Q(){if(n.successReturnToOrRedirect){var L=n.successReturnToOrRedirect;return c.session&&c.session.returnTo&&(L=c.session.returnTo,delete c.session.returnTo),u.redirect(L)}if(n.successRedirect)return u.redirect(n.successRedirect);l()}s(Q,"complete"),n.authInfo!==!1?t.transformAuthInfo(C,c,function(L,G){if(L)return l(L);c.authInfo=G,Q()}):Q()})},y.fail=function(v,C){typeof v=="number"&&(C=v,v=void 0),f.push({challenge:v,status:C}),p(h+1)},y.redirect=function(v,C){u.statusCode=C||302,u.setHeader("Location",v),u.setHeader("Content-Length","0"),u.end()},y.pass=function(){l()},y.error=function(v){if(i)return i(v);l(v)},y.authenticate(c,n)},"attempt")(0)},"authenticate")},"authenticate")});var ljt=A((Gki,Vki)=>{"use strict";var Kfu=cjt(),Jfu=ujt();Gki=Vki.exports=function(){return{initialize:Kfu,authenticate:Jfu}}});var zki=A((dzf,$ki)=>{"use strict";$ki.exports=function(e){var t,r,n=[];return e.on("data",t=s(function(i,o){n.push(["data",i,o])},"onData")),e.on("end",r=s(function(i,o){n.push(["end",i,o])},"onEnd")),{end:function(){e.removeListener("data",t),e.removeListener("end",r)},resume:function(){this.end();for(var i=0,o=n.length;i<o;++i)e.emit.apply(e,n[i])}}}});var djt=A((hzf,Yki)=>{"use strict";var Xfu=zki(),Zfu=require("util"),Wki=vj();function fjt(e,t){typeof e=="function"&&(t=e,e=void 0),e=e||{},Wki.call(this),this.name="session",this._key=e.key||"passport",this._deserializeUser=t}s(fjt,"SessionStrategy");Zfu.inherits(fjt,Wki);fjt.prototype.authenticate=function(e,t){if(!e.session)return this.error(new Error("Login sessions require session support. Did you forget to use `express-session` middleware?"));t=t||{};var r=this,n;if(e.session[this._key]&&(n=e.session[this._key].user),n||n===0){var i=t.pauseStream?Xfu(e):null;this._deserializeUser(n,e,function(o,a){if(o)return r.error(o);if(!a)delete e.session[r._key].user;else{var c=e._userProperty||"user";e[c]=a}r.pass(),i&&i.resume()})}else r.pass()};Yki.exports=fjt});var Xki=A((gzf,Jki)=>{"use strict";var Kki=xLe();function pjt(e,t){typeof e=="function"&&(t=e,e=void 0),e=e||{},this._key=e.key||"passport",this._serializeUser=t}s(pjt,"SessionManager");pjt.prototype.logIn=function(e,t,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},!e.session)return n(new Error("Login sessions require session support. Did you forget to use `express-session` middleware?"));var i=this,o=e.session;e.session.regenerate(function(a){if(a)return n(a);i._serializeUser(t,e,function(c,u){if(c)return n(c);r.keepSessionInfo&&Kki(e.session,o),e.session[i._key]||(e.session[i._key]={}),e.session[i._key].user=u,e.session.save(function(l){if(l)return n(l);n()})})})};pjt.prototype.logOut=function(e,t,r){if(typeof t=="function"&&(r=t,t={}),t=t||{},!e.session)return r(new Error("Login sessions require session support. Did you forget to use `express-session` middleware?"));var n=this;e.session[this._key]&&delete e.session[this._key].user;var i=e.session;e.session.save(function(o){if(o)return r(o);e.session.regenerate(function(a){if(a)return r(a);t.keepSessionInfo&&Kki(e.session,i),r()})})};Jki.exports=pjt});var eNi=A((yzf,Zki)=>{"use strict";var edu=djt(),tdu=Xki();function z_(){this._key="passport",this._strategies={},this._serializers=[],this._deserializers=[],this._infoTransformers=[],this._framework=null,this.init()}s(z_,"Authenticator");z_.prototype.init=function(){this.framework(ljt()()),this.use(new edu({key:this._key},this.deserializeUser.bind(this))),this._sm=new tdu({key:this._key},this.serializeUser.bind(this))};z_.prototype.use=function(e,t){if(t||(t=e,e=t.name),!e)throw new Error("Authentication strategies must have a name");return this._strategies[e]=t,this};z_.prototype.unuse=function(e){return delete this._strategies[e],this};z_.prototype.framework=function(e){return this._framework=e,this};z_.prototype.initialize=function(e){return e=e||{},this._framework.initialize(this,e)};z_.prototype.authenticate=function(e,t,r){return this._framework.authenticate(this,e,t,r)};z_.prototype.authorize=function(e,t,r){t=t||{},t.assignProperty="account";var n=this._framework.authorize||this._framework.authenticate;return n(this,e,t,r)};z_.prototype.session=function(e){return this.authenticate("session",e)};z_.prototype.serializeUser=function(e,t,r){if(typeof e=="function")return this._serializers.push(e);var n=e;typeof t=="function"&&(r=t,t=void 0);var i=this._serializers;s(function o(a,c,u){if(c==="pass"&&(c=void 0),c||u||u===0)return r(c,u);var l=i[a];if(!l)return r(new Error("Failed to serialize user into session"));function f(p,h){o(a+1,p,h)}s(f,"serialized");try{var d=l.length;d==3?l(t,n,f):l(n,f)}catch(p){return r(p)}},"pass")(0)};z_.prototype.deserializeUser=function(e,t,r){if(typeof e=="function")return this._deserializers.push(e);var n=e;typeof t=="function"&&(r=t,t=void 0);var i=this._deserializers;s(function o(a,c,u){if(c==="pass"&&(c=void 0),c||u)return r(c,u);if(u===null||u===!1)return r(null,!1);var l=i[a];if(!l)return r(new Error("Failed to deserialize user out of session"));function f(p,h){o(a+1,p,h)}s(f,"deserialized");try{var d=l.length;d==3?l(t,n,f):l(n,f)}catch(p){return r(p)}},"pass")(0)};z_.prototype.transformAuthInfo=function(e,t,r){if(typeof e=="function")return this._infoTransformers.push(e);var n=e;typeof t=="function"&&(r=t,t=void 0);var i=this._infoTransformers;s(function o(a,c,u){if(c==="pass"&&(c=void 0),c||u)return r(c,u);var l=i[a];if(!l)return r(null,n);function f(h,g){o(a+1,h,g)}s(f,"transformed");try{var d=l.length;if(d==1){var p=l(n);f(null,p)}else d==3?l(t,n,f):l(n,f)}catch(h){return r(h)}},"pass")(0)};z_.prototype._strategy=function(e){return this._strategies[e]};Zki.exports=z_});var x2e=A((qj,rNi)=>{"use strict";var tNi=eNi(),rdu=djt();qj=rNi.exports=new tNi;qj.Passport=qj.Authenticator=tNi;qj.Strategy=vj();qj.strategies={};qj.strategies.SessionStrategy=rdu});var oNi=A(sNi=>{"use strict";var hjt=["_passport","authInfo","httpVersion","headers","trailers","setTimeout","method","url","statusCode","socket","connection","protocol","cookies","throw","ip","param","params","route","xhr","baseUrl","session","body","flash"];hjt=hjt.filter(function(e,t,r){return r.indexOf(e)===t});var iNi={app:{get:function(){let e=this.ctx;return{get:function(t){if(t==="trust proxy")return e.app.proxy}}}}};hjt.forEach(function(e){iNi[e]={get:function(){let t=nNi(this.ctx,e);if(t)return typeof t[e]=="function"?function(){return t[e].apply(t,arguments)}:t[e]},set:function(t){let r=nNi(this.ctx,e)||this.ctx.state;r[e]=t}}});function nNi(e,t){if(e.state&&t in e.state)return e.state;if(t in e.request)return e.request;if(t in e.req)return e.req;if(t in e)return e}s(nNi,"getObject");var HW=w2e();sNi.create=function(e,t){let r=Object.create(e.request,iNi);return Object.defineProperty(r,t,{enumerable:!0,get:function(){return e.state[t]},set:function(n){e.state[t]=n}}),Object.defineProperty(r,"ctx",{enumerable:!0,get:function(){return e}}),r.login=HW.logIn,r.logIn=HW.logIn,r.logout=HW.logOut,r.logOut=HW.logOut,r.isAuthenticated=HW.isAuthenticated,r.isUnauthenticated=HW.isUnauthenticated,r}});var fNi=A((Szf,lNi)=>{"use strict";var vzf=x2e(),ndu=cjt(),idu=ujt(),aNi=oNi().create;function sdu(e){let t=uNi(ndu(e));return s(function(n,i){let o=e._userProperty||"user";n.req.hasOwnProperty(o)||Object.defineProperty(n.req,o,{enumerable:!0,get:function(){return n.state[o]},set:function(l){n.state[o]=l}});let a=aNi(n,o),c=a.login;n.login=n.logIn=function(l,f){return new Promise((d,p)=>{c.call(a,l,f,h=>{h?p(h):d()})})};let u=a.logout;return n.logout=n.logOut=function(l){return new Promise((f,d)=>{u.call(a,l,p=>{p?d(p):f()})})},n.isAuthenticated=a.isAuthenticated.bind(a),n.isUnauthenticated=a.isUnauthenticated.bind(a),t(a,n).then(function(){return i()})},"passportInitialize")}s(sdu,"initialize");function cNi(e,t,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},n){let o=n;n=s(function(a,c,u,l){try{Promise.resolve(o(a,c,u,l)).then(()=>n.resolve(!1)).catch(f=>n.reject(f))}catch(f){n.reject(f)}},"callback")}let i=uNi(idu(e,t,r,n));return s(function(a,c){return new Promise((l,f)=>{let d=aNi(a,r.assignProperty||e._userProperty||"user");function p(g){g&&(a.body=g),l(!1)}s(p,"setBodyAndResolve");let h={redirect:function(g){a.redirect(g),l(!1)},set:a.set.bind(a),setHeader:a.set.bind(a),end:p,send:p,set statusCode(g){a.status=g},get statusCode(){return a.status}};d.res=h,n&&(n.resolve=l,n.reject=f),i(d,h).then(l,f)}).then(l=>{if(l!==!1)return c()})},"passportAuthenticate")}s(cNi,"authenticate");function odu(e,t,r,n){return r=r||{},r.assignProperty="account",cNi(e,t,r,n)}s(odu,"authorize");lNi.exports=function(){return{initialize:sdu,authenticate:cNi,authorize:odu}};function uNi(e){return function(t,r){return new Promise(function(n,i){e(t,r,function(o,a){o?i(o):n(a)})})}}s(uNi,"promisify")});var hNi=A((Tzf,gjt)=>{"use strict";var adu=ljt();adu.__monkeypatchNode=function(){};var dNi=x2e(),cdu=x2e().Passport,pNi=fNi()();dNi.framework(pNi);var mjt=class extends cdu{static{s(this,"KoaPassport")}constructor(){super(),this.framework(pNi)}};gjt.exports=dNi;gjt.exports.KoaPassport=mjt});var gNi=A(mNi=>{"use strict";mNi.lookup=function(e,t){if(!e)return null;for(var r=t.split("]").join("").split("["),n=0,i=r.length;n<i;n++){var o=e[r[n]];if(typeof o>"u")return null;if(typeof o!="object")return o;e=o}return null}});var _Ni=A((Izf,yNi)=>{"use strict";var ANi=vj(),udu=require("util"),I2e=gNi().lookup;function Ajt(e,t){if(typeof e=="function"&&(t=e,e={}),!t)throw new TypeError("LocalStrategy requires a verify callback");this._usernameField=e.usernameField||"username",this._passwordField=e.passwordField||"password",ANi.Strategy.call(this),this.name="local",this._verify=t,this._passReqToCallback=e.passReqToCallback}s(Ajt,"Strategy");udu.inherits(Ajt,ANi.Strategy);Ajt.prototype.authenticate=function(e,t){t=t||{};var r=I2e(e.body,this._usernameField)||I2e(e.query,this._usernameField),n=I2e(e.body,this._passwordField)||I2e(e.query,this._passwordField);if(!r||!n)return this.fail({message:t.badRequestMessage||"Missing credentials"},400);var i=this;function o(a,c,u){if(a)return i.error(a);if(!c)return i.fail(u);i.success(c,u)}s(o,"verified");try{i._passReqToCallback?this._verify(e,r,n,o):this._verify(r,n,o)}catch(a){return i.error(a)}};yNi.exports=Ajt});var vNi=A((yjt,bNi)=>{"use strict";var ENi=_Ni();yjt=bNi.exports=ENi;yjt.Strategy=ENi});var SNi=A((Ozf,_jt)=>{"use strict";var R2e=class{static{s(this,"AuthTokenRefresh")}constructor(){this._strategies={}}use(t,r,n){if(typeof t!="string"&&(n=r,r=t,t=r&&r.name),r==null)throw new Error("Cannot register: strategy is null");if(!t)throw new Error("Cannot register: name must be specified, or strategy must include name");n=n||{};let i;if(r._oauth2){let o=r._oauth2.constructor;i=new o(r._oauth2._clientId,r._oauth2._clientSecret,r._oauth2._baseSite,r._oauth2._authorizeUrl,r._refreshURL||r._oauth2._accessTokenUrl,r._oauth2._customHeaders),i.getOAuthAccessToken=r._oauth2.getOAuthAccessToken}if(typeof n.setRefreshOAuth2=="function"&&(i=n.setRefreshOAuth2({strategyOAuth2:r._oauth2,refreshOAuth2:i})),!i)throw new Error("The OAuth2 adapter used to refresh the token is not configured correctly. Use the setRefreshOAuth2 option to return a OAuth 2.0 adapter.");this._strategies[t]={strategy:r,refreshOAuth2:i}}has(t){return!!this._strategies[t]}requestNewAccessToken(t,r,n,i){arguments.length===3&&(i=n,n={});let o=this._strategies[t];if(!o)return i(new Error("Strategy was not registered to refresh a token"));n=n||{},n.grant_type="refresh_token",o.refreshOAuth2.getOAuthAccessToken(r,n,i)}};_jt.exports=new R2e;_jt.exports.AuthTokenRefresh=R2e});var Sjt=A(vjt=>{"use strict";Object.defineProperty(vjt,"__esModule",{value:!0});var bjt=class extends Error{static{s(this,"TimeoutError")}};vjt.TimeoutError=bjt});var CNi=A(Tjt=>{"use strict";Object.defineProperty(Tjt,"__esModule",{value:!0});var wjt=class{static{s(this,"PromiseInspection")}constructor(t){this._value=t.value,this._error=t.error}value(){return this._value}reason(){return this._error}isRejected(){return!!this._error}isFulfilled(){return!!this._value}};Tjt.PromiseInspection=wjt});var k2e=A(HC=>{"use strict";Object.defineProperty(HC,"__esModule",{value:!0});var xNi=CNi();function vdu(){let e=null,t=null;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}s(vdu,"defer");HC.defer=vdu;function Sdu(){return Date.now()}s(Sdu,"now");HC.now=Sdu;function wdu(e,t){return Math.abs(t-e)}s(wdu,"duration");HC.duration=wdu;function Tdu(e){return typeof e>"u"?!0:INi(e)}s(Tdu,"checkOptionalTime");HC.checkOptionalTime=Tdu;function INi(e){return typeof e=="number"&&e===Math.round(e)&&e>0}s(INi,"checkRequiredTime");HC.checkRequiredTime=INi;function Cdu(e){return new Promise(t=>setTimeout(t,e))}s(Cdu,"delay");HC.delay=Cdu;function xdu(e){return e.then(t=>new xNi.PromiseInspection({value:t})).catch(t=>new xNi.PromiseInspection({error:t}))}s(xdu,"reflect");HC.reflect=xdu;function Idu(e){try{let t=e();return Promise.resolve(t)}catch(t){return Promise.reject(t)}}s(Idu,"tryPromise");HC.tryPromise=Idu});var RNi=A(xjt=>{"use strict";Object.defineProperty(xjt,"__esModule",{value:!0});var N2e=Sjt(),Rdu=k2e(),Cjt=class{static{s(this,"PendingOperation")}constructor(t){this.timeoutMillis=t,this.deferred=Rdu.defer(),this.possibleTimeoutCause=null,this.isRejected=!1,this.promise=Odu(this.deferred.promise,t).catch(r=>(r instanceof N2e.TimeoutError&&(this.possibleTimeoutCause?r=new N2e.TimeoutError(this.possibleTimeoutCause.message):r=new N2e.TimeoutError("operation timed out for an unknown reason")),this.isRejected=!0,Promise.reject(r)))}abort(){this.reject(new Error("aborted"))}reject(t){this.deferred.reject(t)}resolve(t){this.deferred.resolve(t)}};xjt.PendingOperation=Cjt;function Odu(e,t){return new Promise((r,n)=>{let i=setTimeout(()=>n(new N2e.TimeoutError),t);e.then(o=>{clearTimeout(i),r(o)}).catch(o=>{clearTimeout(i),n(o)})})}s(Odu,"timeout")});var kNi=A(Rjt=>{"use strict";Object.defineProperty(Rjt,"__esModule",{value:!0});var ONi=k2e(),Ijt=class e{static{s(this,"Resource")}constructor(t){this.resource=t,this.resource=t,this.timestamp=ONi.now(),this.deferred=ONi.defer()}get promise(){return this.deferred.promise}resolve(){return this.deferred.resolve(void 0),new e(this.resource)}};Rjt.Resource=Ijt});var DNi=A(kjt=>{"use strict";Object.defineProperty(kjt,"__esModule",{value:!0});var D2e=RNi(),kdu=kNi(),rA=k2e(),Ndu=require("events"),NNi=require("timers"),Ojt=class{static{s(this,"Pool")}constructor(t){if(this.destroyed=!1,this.emitter=new Ndu.EventEmitter,t=t||{},!t.create)throw new Error("Tarn: opt.create function most be provided");if(!t.destroy)throw new Error("Tarn: opt.destroy function most be provided");if(typeof t.min!="number"||t.min<0||t.min!==Math.round(t.min))throw new Error("Tarn: opt.min must be an integer >= 0");if(typeof t.max!="number"||t.max<=0||t.max!==Math.round(t.max))throw new Error("Tarn: opt.max must be an integer > 0");if(t.min>t.max)throw new Error("Tarn: opt.max is smaller than opt.min");if(!rA.checkOptionalTime(t.acquireTimeoutMillis))throw new Error("Tarn: invalid opt.acquireTimeoutMillis "+JSON.stringify(t.acquireTimeoutMillis));if(!rA.checkOptionalTime(t.createTimeoutMillis))throw new Error("Tarn: invalid opt.createTimeoutMillis "+JSON.stringify(t.createTimeoutMillis));if(!rA.checkOptionalTime(t.destroyTimeoutMillis))throw new Error("Tarn: invalid opt.destroyTimeoutMillis "+JSON.stringify(t.destroyTimeoutMillis));if(!rA.checkOptionalTime(t.idleTimeoutMillis))throw new Error("Tarn: invalid opt.idleTimeoutMillis "+JSON.stringify(t.idleTimeoutMillis));if(!rA.checkOptionalTime(t.reapIntervalMillis))throw new Error("Tarn: invalid opt.reapIntervalMillis "+JSON.stringify(t.reapIntervalMillis));if(!rA.checkOptionalTime(t.createRetryIntervalMillis))throw new Error("Tarn: invalid opt.createRetryIntervalMillis "+JSON.stringify(t.createRetryIntervalMillis));let r={create:!0,validate:!0,destroy:!0,log:!0,min:!0,max:!0,acquireTimeoutMillis:!0,createTimeoutMillis:!0,destroyTimeoutMillis:!0,idleTimeoutMillis:!0,reapIntervalMillis:!0,createRetryIntervalMillis:!0,propagateCreateError:!0};for(let n of Object.keys(t))if(!r[n])throw new Error(`Tarn: unsupported option opt.${n}`);this.creator=t.create,this.destroyer=t.destroy,this.validate=typeof t.validate=="function"?t.validate:()=>!0,this.log=t.log||(()=>{}),this.acquireTimeoutMillis=t.acquireTimeoutMillis||3e4,this.createTimeoutMillis=t.createTimeoutMillis||3e4,this.destroyTimeoutMillis=t.destroyTimeoutMillis||5e3,this.idleTimeoutMillis=t.idleTimeoutMillis||3e4,this.reapIntervalMillis=t.reapIntervalMillis||1e3,this.createRetryIntervalMillis=t.createRetryIntervalMillis||200,this.propagateCreateError=!!t.propagateCreateError,this.min=t.min,this.max=t.max,this.used=[],this.free=[],this.pendingCreates=[],this.pendingAcquires=[],this.pendingDestroys=[],this.pendingValidations=[],this.destroyed=!1,this.interval=null,this.eventId=1}numUsed(){return this.used.length}numFree(){return this.free.length}numPendingAcquires(){return this.pendingAcquires.length}numPendingValidations(){return this.pendingValidations.length}numPendingCreates(){return this.pendingCreates.length}acquire(){let t=this.eventId++;this._executeEventHandlers("acquireRequest",t);let r=new D2e.PendingOperation(this.acquireTimeoutMillis);return this.pendingAcquires.push(r),r.promise=r.promise.then(n=>(this._executeEventHandlers("acquireSuccess",t,n),n)).catch(n=>(this._executeEventHandlers("acquireFail",t,n),GW(this.pendingAcquires,r),Promise.reject(n))),this._tryAcquireOrCreate(),r}release(t){this._executeEventHandlers("release",t);for(let r=0,n=this.used.length;r<n;++r){let i=this.used[r];if(i.resource===t)return this.used.splice(r,1),this.free.push(i.resolve()),this._tryAcquireOrCreate(),!0}return!1}isEmpty(){return[this.numFree(),this.numUsed(),this.numPendingAcquires(),this.numPendingValidations(),this.numPendingCreates()].reduce((t,r)=>t+r)===0}check(){let t=rA.now(),r=[],n=this.min-this.used.length,i=this.free.length-n,o=0;this.free.forEach(a=>{rA.duration(t,a.timestamp)>=this.idleTimeoutMillis&&o<i?(o++,this._destroy(a.resource)):r.push(a)}),this.free=r,this.isEmpty()&&this._stopReaping()}destroy(){let t=this.eventId++;return this._executeEventHandlers("poolDestroyRequest",t),this._stopReaping(),this.destroyed=!0,rA.reflect(Promise.all(this.pendingCreates.map(r=>rA.reflect(r.promise))).then(()=>new Promise((r,n)=>{if(this.numPendingValidations()===0){r();return}let i=setInterval(()=>{this.numPendingValidations()===0&&(NNi.clearInterval(i),r())},100)})).then(()=>Promise.all(this.used.map(r=>rA.reflect(r.promise)))).then(()=>Promise.all(this.pendingAcquires.map(r=>(r.abort(),rA.reflect(r.promise))))).then(()=>Promise.all(this.free.map(r=>rA.reflect(this._destroy(r.resource))))).then(()=>Promise.all(this.pendingDestroys.map(r=>r.promise))).then(()=>{this.free=[],this.pendingAcquires=[]})).then(r=>(this._executeEventHandlers("poolDestroySuccess",t),this.emitter.removeAllListeners(),r))}on(t,r){this.emitter.on(t,r)}removeListener(t,r){this.emitter.removeListener(t,r)}removeAllListeners(t){this.emitter.removeAllListeners(t)}_tryAcquireOrCreate(){this.destroyed||(this._hasFreeResources()?this._doAcquire():this._shouldCreateMoreResources()&&this._doCreate())}_hasFreeResources(){return this.free.length>0}_doAcquire(){for(;this._canAcquire();){let t=this.pendingAcquires.shift(),r=this.free.pop();if(r===void 0||t===void 0){let i="this.free was empty while trying to acquire resource";throw this.log(`Tarn: ${i}`,"warn"),new Error(`Internal error, should never happen. ${i}`)}this.pendingValidations.push(t),this.used.push(r);let n=new D2e.PendingOperation(this.acquireTimeoutMillis);t.promise.catch(i=>{n.abort()}),n.promise.catch(i=>(this.log("Tarn: resource validator threw an exception "+i.stack,"warn"),!1)).then(i=>{try{i&&!t.isRejected?(this._startReaping(),t.resolve(r.resource)):(GW(this.used,r),i?this.free.push(r):(this._destroy(r.resource),setTimeout(()=>{this._tryAcquireOrCreate()},0)),t.isRejected||this.pendingAcquires.unshift(t))}finally{GW(this.pendingValidations,t)}}),this._validateResource(r.resource).then(i=>{n.resolve(i)}).catch(i=>{n.reject(i)})}}_canAcquire(){return this.free.length>0&&this.pendingAcquires.length>0}_validateResource(t){try{return Promise.resolve(this.validate(t))}catch(r){return Promise.reject(r)}}_shouldCreateMoreResources(){return this.used.length+this.pendingCreates.length<this.max&&this.pendingCreates.length<this.pendingAcquires.length}_doCreate(){let t=this.pendingAcquires.slice();this._create().promise.then(()=>(this._tryAcquireOrCreate(),null)).catch(n=>{this.propagateCreateError&&this.pendingAcquires.length!==0&&this.pendingAcquires[0].reject(n),t.forEach(i=>{i.possibleTimeoutCause=n}),rA.delay(this.createRetryIntervalMillis).then(()=>this._tryAcquireOrCreate())})}_create(){let t=this.eventId++;this._executeEventHandlers("createRequest",t);let r=new D2e.PendingOperation(this.createTimeoutMillis);return r.promise=r.promise.catch(n=>{throw GW(this.pendingCreates,r)&&this._executeEventHandlers("createFail",t,n),n}),this.pendingCreates.push(r),Ddu(this.creator).then(n=>r.isRejected?(this.destroyer(n),null):(GW(this.pendingCreates,r),this.free.push(new kdu.Resource(n)),r.resolve(n),this._executeEventHandlers("createSuccess",t,n),null)).catch(n=>(r.isRejected||(GW(this.pendingCreates,r)&&this._executeEventHandlers("createFail",t,n),r.reject(n)),null)),r}_destroy(t){let r=this.eventId++;this._executeEventHandlers("destroyRequest",r,t);let n=new D2e.PendingOperation(this.destroyTimeoutMillis);return Promise.resolve().then(()=>this.destroyer(t)).then(()=>{n.resolve(t)}).catch(o=>{n.reject(o)}),this.pendingDestroys.push(n),n.promise.then(o=>(this._executeEventHandlers("destroySuccess",r,t),o)).catch(o=>this._logDestroyerError(r,t,o)).then(o=>{let a=this.pendingDestroys.findIndex(c=>c===n);return this.pendingDestroys.splice(a,1),o})}_logDestroyerError(t,r,n){this._executeEventHandlers("destroyFail",t,r,n),this.log("Tarn: resource destroyer threw an exception "+n.stack,"warn")}_startReaping(){this.interval||(this._executeEventHandlers("startReaping"),this.interval=setInterval(()=>this.check(),this.reapIntervalMillis))}_stopReaping(){this.interval!==null&&(this._executeEventHandlers("stopReaping"),NNi.clearInterval(this.interval)),this.interval=null}_executeEventHandlers(t,...r){this.emitter.listeners(t).forEach(i=>{try{i(...r)}catch(o){this.log(`Tarn: event handler "${t}" threw an exception ${o.stack}`,"warn")}})}};kjt.Pool=Ojt;function GW(e,t){let r=e.indexOf(t);return r===-1?!1:(e.splice(r,1),!0)}s(GW,"remove");function Ddu(e){return new Promise((t,r)=>{let n=s((i,o)=>{i?r(i):t(o)},"callback");rA.tryPromise(()=>e(n)).then(i=>{i&&t(i)}).catch(i=>{r(i)})})}s(Ddu,"callbackOrPromise")});var LNi=A((P2e,MNi)=>{"use strict";Object.defineProperty(P2e,"__esModule",{value:!0});var PNi=DNi();P2e.Pool=PNi.Pool;var BNi=Sjt();P2e.TimeoutError=BNi.TimeoutError;MNi.exports={Pool:PNi.Pool,TimeoutError:BNi.TimeoutError}});var M2e=A((e9f,jNi)=>{"use strict";var B2e=/[\0\b\t\n\r\x1a"'\\]/g,UNi={"\0":"\\0","\b":"\\b"," ":"\\t","\n":"\\n","\r":"\\r","":"\\Z",'"':'\\"',"'":"\\'","\\":"\\\\"};function Pdu(e){return s(function t(r,n={}){return e(r,t,n)},"finalEscape")}s(Pdu,"wrapEscape");function Bdu(e={}){let t=e.escapeDate||QNi,r=e.escapeArray||Njt,n=e.escapeBuffer||qNi,i=e.escapeString||Djt,o=e.escapeObject||FNi,a=e.wrap||Pdu;function c(u,l,f){if(u==null)return"NULL";switch(typeof u){case"boolean":return u?"true":"false";case"number":return u+"";case"object":if(u instanceof Date)u=t(u,l,f);else return Array.isArray(u)?r(u,l,f):Buffer.isBuffer(u)?n(u,l,f):o(u,l,f)}return i(u,l,f)}return s(c,"escapeFn"),a?a(c):c}s(Bdu,"makeEscape");function FNi(e,t,r){return e&&typeof e.toSQL=="function"?e.toSQL(r):JSON.stringify(e)}s(FNi,"escapeObject");function Njt(e,t,r){let n="";for(let i=0;i<e.length;i++){let o=e[i];Array.isArray(o)?n+=(i===0?"":", ")+"("+Njt(o,t,r)+")":n+=(i===0?"":", ")+t(o,r)}return n}s(Njt,"arrayToList");function qNi(e){return"X"+Djt(e.toString("hex"))}s(qNi,"bufferToString");function Djt(e,t,r){let n=B2e.lastIndex=0,i="",o;for(;o=B2e.exec(e);)i+=e.slice(n,o.index)+UNi[o[0]],n=B2e.lastIndex;return n===0?"'"+e+"'":n<e.length?"'"+i+e.slice(n)+"'":"'"+i+"'"}s(Djt,"escapeString");function QNi(e,t,r={}){let n=r.timeZone||"local",i=new Date(e),o,a,c,u,l,f,d;if(n==="local")o=i.getFullYear(),a=i.getMonth()+1,c=i.getDate(),u=i.getHours(),l=i.getMinutes(),f=i.getSeconds(),d=i.getMilliseconds();else{let p=Mdu(n);p!==!1&&p!==0&&i.setTime(i.getTime()+p*6e4),o=i.getUTCFullYear(),a=i.getUTCMonth()+1,c=i.getUTCDate(),u=i.getUTCHours(),l=i.getUTCMinutes(),f=i.getUTCSeconds(),d=i.getUTCMilliseconds()}return Qj(o,4)+"-"+Qj(a,2)+"-"+Qj(c,2)+" "+Qj(u,2)+":"+Qj(l,2)+":"+Qj(f,2)+"."+Qj(d,3)}s(QNi,"dateToString");function Qj(e,t){for(e=e.toString();e.length<t;)e="0"+e;return e}s(Qj,"zeroPad");function Mdu(e){if(e==="Z")return 0;let t=e.match(/([+\-\s])(\d\d):?(\d\d)?/);return t?(t[1]=="-"?-1:1)*(parseInt(t[2],10)+(t[3]?parseInt(t[3],10):0)/60)*60:!1}s(Mdu,"convertTimezone");jNi.exports={arrayToList:Njt,bufferToString:qNi,dateToString:QNi,escapeString:Djt,charsRegex:B2e,charsMap:UNi,escapeObject:FNi,makeEscape:Bdu}});var jj=A((r9f,HNi)=>{"use strict";var Ldu=Lh(),Udu=p8e(),Fdu=Ohe();function qdu(e,t){return Fdu(Udu(e,t,Ldu),e+"")}s(qdu,"baseRest");HNi.exports=qdu});var Hj=A((i9f,GNi)=>{"use strict";var Qdu=eN(),jdu=F0(),Hdu=FH(),Gdu=AA();function Vdu(e,t,r){if(!Gdu(r))return!1;var n=typeof t;return(n=="number"?jdu(r)&&Hdu(t,r.length):n=="string"&&t in r)?Qdu(r[t],e):!1}s(Vdu,"isIterateeCall");GNi.exports=Vdu});var Pjt=A((o9f,$Ni)=>{"use strict";var $du=jj(),zdu=eN(),Wdu=Hj(),Ydu=Ux(),VNi=Object.prototype,Kdu=VNi.hasOwnProperty,Jdu=$du(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&Wdu(t[0],t[1],i)&&(n=1);++r<n;)for(var o=t[r],a=Ydu(o),c=-1,u=a.length;++c<u;){var l=a[c],f=e[l];(f===void 0||zdu(f,VNi[l])&&!Kdu.call(e,l))&&(e[l]=o[l])}return e});$Ni.exports=Jdu});var Bjt=A((a9f,zNi)=>{"use strict";var Xdu=ZS(),Zdu=0;function epu(e){var t=++Zdu;return Xdu(e)+t}s(epu,"uniqueId");zNi.exports=epu});var Gj=A((u9f,Mjt)=>{"use strict";var L2e=class extends Error{static{s(this,"KnexTimeoutError")}constructor(t){super(t),this.name="KnexTimeoutError"}};function tpu(e,t){return new Promise(function(r,n){let i=setTimeout(function(){n(new L2e("operation timed out"))},t);function o(c){clearTimeout(i),r(c)}s(o,"wrappedResolve");function a(c){clearTimeout(i),n(c)}s(a,"wrappedReject"),e.then(o,a)})}s(tpu,"timeout");Mjt.exports.KnexTimeoutError=L2e;Mjt.exports.timeout=tpu});var YNi=A((f9f,WNi)=>{"use strict";function rpu(e){e.client.emit("start",e.builder),e.builder.emit("start",e.builder);let t=e.builder.toSQL();return e.builder._debug&&e.client.logger.debug(t),Array.isArray(t)?e.queryArray(t):e.query(t)}s(rpu,"ensureConnectionCallback");function npu(e,t){try{let r=e.builder.toSQL();if(Array.isArray(r)&&t.hasHandler)throw new Error("The stream may only be used with a single query statement.");return e.client.stream(e.connection,r,t.stream,t.options)}catch(r){throw t.stream.emit("error",r),r}}s(npu,"ensureConnectionStreamCallback");WNi.exports={ensureConnectionCallback:rpu,ensureConnectionStreamCallback:npu}});var XNi=A((p9f,JNi)=>{"use strict";var{KnexTimeoutError:KNi}=Gj(),{timeout:ipu}=Gj(),{ensureConnectionCallback:spu,ensureConnectionStreamCallback:opu}=YNi(),Ljt,Ujt=class e{static{s(this,"Runner")}constructor(t,r){this.client=t,this.builder=r,this.queries=[],this.connection=void 0}async run(){let t=this;try{let r=await this.ensureConnection(spu);return t.builder.emit("end"),r}catch(r){throw t.builder._events&&t.builder._events.error&&t.builder.emit("error",r),r}}stream(t,r){let n=typeof t=="function"&&arguments.length===1,i=n?{}:t,o=n?t:r,a=typeof o=="function";Ljt=Ljt||require("stream").Transform;let c=this.builder.queryContext(),u=new Ljt({objectMode:!0,transform:(f,d,p)=>{p(null,this.client.postProcessResponse(f,c))}});u.on("close",()=>{this.client.releaseConnection(this.connection)});let l=this.ensureConnection(opu,{options:i,hasHandler:a,stream:u}).catch(f=>{this.connection||u.emit("error",f)});return a?(o(u),l):u}pipe(t,r){return this.stream(r).pipe(t)}async query(t){let{__knexUid:r,__knexTxId:n}=this.connection;this.builder.emit("query",Object.assign({__knexUid:r,__knexTxId:n},t));let i=this,o=this.builder.queryContext();t!==null&&typeof t=="object"&&(t.queryContext=o);let a=this.client.query(this.connection,t);return t.timeout&&(a=ipu(a,t.timeout)),a.then(c=>this.client.processResponse(c,i)).then(c=>{let u=this.client.postProcessResponse(c,o);return this.builder.emit("query-response",u,Object.assign({__knexUid:r,__knexTxId:n},t),this.builder),this.client.emit("query-response",u,Object.assign({__knexUid:r,__knexTxId:n},t),this.builder),u}).catch(c=>{if(!(c instanceof KNi))return Promise.reject(c);let{timeout:u,sql:l,bindings:f}=t,d;return t.cancelOnTimeout?d=this.client.cancelQuery(this.connection):(this.connection.__knex__disposed=c,d=Promise.resolve()),d.catch(p=>{throw this.connection.__knex__disposed=c,Object.assign(p,{message:`After query timeout of ${u}ms exceeded, cancelling of query failed.`,sql:l,bindings:f,timeout:u})}).then(()=>{throw Object.assign(c,{message:`Defined query timeout of ${u}ms exceeded when running query.`,sql:l,bindings:f,timeout:u})})}).catch(c=>{throw this.builder.emit("query-error",c,Object.assign({__knexUid:r,__knexTxId:n,queryContext:o},t)),c})}async queryArray(t){if(t.length===1){let n=t[0];if(!n.statementsProducer)return this.query(n);let i=await n.statementsProducer(void 0,this.connection),o=i.sql.map(l=>({sql:l,bindings:n.bindings})),a=i.pre.map(l=>({sql:l,bindings:n.bindings})),c=i.post.map(l=>({sql:l,bindings:n.bindings})),u=[];await this.queryArray(a);try{await this.client.transaction(async l=>{let f=new e(l.client,this.builder);if(f.connection=this.connection,u=await f.queryArray(o),i.check&&(await l.raw(i.check)).length>0)throw new Error("FOREIGN KEY constraint failed")},{connection:this.connection})}finally{await this.queryArray(c)}return u}let r=[];for(let n of t)r.push(await this.queryArray([n]));return r}async ensureConnection(t,r){if(this.builder._connection&&(this.connection=this.builder._connection),this.connection)return t(this,r);let n;try{n=await this.client.acquireConnection()}catch(i){if(!(i instanceof KNi))return Promise.reject(i);throw this.builder&&(i.sql=this.builder.sql,i.bindings=this.builder.bindings),i}try{return this.connection=n,await t(this,r)}finally{await this.client.releaseConnection(n)}}};JNi.exports=Ujt});var e1i=A((m9f,ZNi)=>{"use strict";var VW=1e3,$W=VW*60,zW=$W*60,Vj=zW*24,apu=Vj*7,cpu=Vj*365.25;ZNi.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return upu(e);if(r==="number"&&isFinite(e))return t.long?fpu(e):lpu(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function upu(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*cpu;case"weeks":case"week":case"w":return r*apu;case"days":case"day":case"d":return r*Vj;case"hours":case"hour":case"hrs":case"hr":case"h":return r*zW;case"minutes":case"minute":case"mins":case"min":case"m":return r*$W;case"seconds":case"second":case"secs":case"sec":case"s":return r*VW;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}s(upu,"parse");function lpu(e){var t=Math.abs(e);return t>=Vj?Math.round(e/Vj)+"d":t>=zW?Math.round(e/zW)+"h":t>=$W?Math.round(e/$W)+"m":t>=VW?Math.round(e/VW)+"s":e+"ms"}s(lpu,"fmtShort");function fpu(e){var t=Math.abs(e);return t>=Vj?U2e(e,t,Vj,"day"):t>=zW?U2e(e,t,zW,"hour"):t>=$W?U2e(e,t,$W,"minute"):t>=VW?U2e(e,t,VW,"second"):e+" ms"}s(fpu,"fmtLong");function U2e(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}s(U2e,"plural")});var Fjt=A((A9f,t1i)=>{"use strict";function dpu(e){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=e1i(),r.destroy=l,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function t(f){let d=0;for(let p=0;p<f.length;p++)d=(d<<5)-d+f.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}s(t,"selectColor"),r.selectColor=t;function r(f){let d,p=null,h,g;function y(...b){if(!y.enabled)return;let v=y,C=Number(new Date),I=C-(d||C);v.diff=I,v.prev=d,v.curr=C,d=C,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let N=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(B,Q)=>{if(B==="%%")return"%";N++;let L=r.formatters[Q];if(typeof L=="function"){let G=b[N];B=L.call(v,G),b.splice(N,1),N--}return B}),r.formatArgs.call(v,b),(v.log||r.log).apply(v,b)}return s(y,"debug"),y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,g=r.enabled(f)),g),set:b=>{p=b}}),typeof r.init=="function"&&r.init(y),y}s(r,"createDebug");function n(f,d){let p=r(this.namespace+(typeof d>"u"?":":d)+f);return p.log=this.log,p}s(n,"extend");function i(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let d,p=(typeof f=="string"?f:"").split(/[\s,]+/),h=p.length;for(d=0;d<h;d++)p[d]&&(f=p[d].replace(/\*/g,".*?"),f[0]==="-"?r.skips.push(new RegExp("^"+f.slice(1)+"$")):r.names.push(new RegExp("^"+f+"$")))}s(i,"enable");function o(){let f=[...r.names.map(c),...r.skips.map(c).map(d=>"-"+d)].join(",");return r.enable(""),f}s(o,"disable");function a(f){if(f[f.length-1]==="*")return!0;let d,p;for(d=0,p=r.skips.length;d<p;d++)if(r.skips[d].test(f))return!1;for(d=0,p=r.names.length;d<p;d++)if(r.names[d].test(f))return!0;return!1}s(a,"enabled");function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}s(c,"toNamespace");function u(f){return f instanceof Error?f.stack||f.message:f}s(u,"coerce");function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return s(l,"destroy"),r.enable(r.load()),r}s(dpu,"setup");t1i.exports=dpu});var r1i=A((W_,F2e)=>{"use strict";W_.formatArgs=hpu;W_.save=mpu;W_.load=gpu;W_.useColors=ppu;W_.storage=Apu();W_.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();W_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ppu(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}s(ppu,"useColors");function hpu(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+F2e.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}s(hpu,"formatArgs");W_.log=console.debug||console.log||(()=>{});function mpu(e){try{e?W_.storage.setItem("debug",e):W_.storage.removeItem("debug")}catch{}}s(mpu,"save");function gpu(){let e;try{e=W_.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}s(gpu,"load");function Apu(){try{return localStorage}catch{}}s(Apu,"localstorage");F2e.exports=Fjt()(W_);var{formatters:ypu}=F2e.exports;ypu.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var i1i=A((yh,Q2e)=>{"use strict";var _pu=require("tty"),q2e=require("util");yh.init=Cpu;yh.log=Spu;yh.formatArgs=bpu;yh.save=wpu;yh.load=Tpu;yh.useColors=Epu;yh.destroy=q2e.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");yh.colors=[6,2,3,4,5,1];try{let e=A5e();e&&(e.stderr||e).level>=2&&(yh.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}yh.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function Epu(){return"colors"in yh.inspectOpts?!!yh.inspectOpts.colors:_pu.isatty(process.stderr.fd)}s(Epu,"useColors");function bpu(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${t} \x1B[0m`;e[0]=o+e[0].split(`
|
|
1271
1272
|
`).join(`
|
|
1272
1273
|
`+o),e.push(i+"m+"+Q2e.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=vpu()+t+" "+e[0]}s(bpu,"formatArgs");function vpu(){return yh.inspectOpts.hideDate?"":new Date().toISOString()+" "}s(vpu,"getDate");function Spu(...e){return process.stderr.write(q2e.format(...e)+`
|
|
1273
1274
|
`)}s(Spu,"log");function wpu(e){e?process.env.DEBUG=e:delete process.env.DEBUG}s(wpu,"save");function Tpu(){return process.env.DEBUG}s(Tpu,"load");function Cpu(e){e.inspectOpts={};let t=Object.keys(yh.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=yh.inspectOpts[t[r]]}s(Cpu,"init");Q2e.exports=Fjt()(yh);var{formatters:n1i}=Q2e.exports;n1i.o=function(e){return this.inspectOpts.colors=this.useColors,q2e.inspect(e,this.inspectOpts).split(`
|
|
@@ -1546,7 +1547,7 @@ ${e}
|
|
|
1546
1547
|
</style>
|
|
1547
1548
|
`;na.default.writeFileSync(e,n);let i=Iy.default.join(Iy.default.dirname(e),"Boundary.js");if(na.default.existsSync(i))try{na.default.unlinkSync(i)}catch(o){console.log("Failed to delete legacy Boundary.js:",o instanceof Error?o.message:o)}return{changed:!0,before:t,after:n,message:`Updated ${e} to use <svelte:boundary> and $$restProps.`}}s($Xu,"migrateWrapper");function zXu(){let e=Iy.default.join(process.cwd(),"package.json");if(!na.default.existsSync(e))return{changed:!1,message:"package.json not found"};let t=na.default.readFileSync(e,"utf8"),r;try{r=JSON.parse(t)}catch(f){return{changed:!1,message:`Invalid package.json: ${f?.message||"parse error"}`}}let n=JSON.stringify(r,null,2),i=typeof r.version=="string"?r.version.trim():void 0,o=its(i);r.dependencies||(r.dependencies={}),r.dependencies.svelte="^5.0.0",r.peerDependencies={...r.peerDependencies||{},svelte:"^5.0.0"};let a=r.devDependencies||{};a.rollup="^4.21.0",a["@rollup/plugin-commonjs"]="^25.0.7",a["@rollup/plugin-node-resolve"]="^15.2.3",a["rollup-plugin-svelte"]="^7.2.3",a["npm-run-all"]&&delete a["npm-run-all"],r.devDependencies=a,r.scripts||(r.scripts={}),r.scripts.build="rollup -c rollup.config.mjs",r.scripts.watch="rollup -cw rollup.config.mjs",o&&(r.version=o);let c=JSON.stringify(r,null,2);if(n===c)return{changed:!1,message:"package.json already appears Svelte 5 ready. Skipping."};na.default.writeFileSync(`${e}.pre-svelte5`,t),na.default.writeFileSync(e,`${c}
|
|
1548
1549
|
`);let u=i&&o?` (version ${i} -> ${o})`:"",l=o?`Updated package.json for Svelte 5, Rollup 4, scripts, and version bump${u}.`:"Updated package.json for Svelte 5, Rollup 4, and scripts.";return{changed:!0,before:n,after:c,message:l}}s(zXu,"migratePackageJson");function WXu(){let e=Iy.default.join(process.cwd(),"schema.json");if(!na.default.existsSync(e))return{changed:!1,message:"schema.json not found - skipping schema metadata migration."};let t=na.default.readFileSync(e,"utf8"),r;try{r=JSON.parse(t)}catch(u){return{changed:!1,message:`Invalid schema.json: ${u?.message||"parse error"}`}}let n=r&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:{};if(!(n?.svelteMajor!==5))return{changed:!1,message:"schema.json metadata already includes svelteMajor: 5. Skipping."};let o=JSON.stringify(r,null,2),a={...n,svelteMajor:5};r.metadata=a;let c=JSON.stringify(r,null,2);return na.default.writeFileSync(`${e}.pre-svelte5`,t),na.default.writeFileSync(e,`${c}
|
|
1549
|
-
`),{changed:!0,before:o,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(WXu,"migrateSchemaJson");async function uts(){let e=[],t=na.default.readFileSync("package.json","utf8"),r=JSON.parse(t),n=r?.dependencies?.svelte?.startsWith("^5")||r?.peerDependencies?.svelte?.startsWith("^5"),i=typeof r?.version=="string"?r.version.trim():void 0,o=its(i);n?e.push("package.json appears to already depend on Svelte 5."):e.push("Will bump svelte to ^5.0.0 and align dev/peer dependencies."),o&&i&&o!==i&&e.push(`Will bump package.json version from ${i} to ${o}.`);let a=sts(),c="unknown";if(a){let p=na.default.readFileSync(a,"utf8");ots(p)?(c="looks-new",e.push(`Rollup config ${a} already looks Svelte 5-ready.`)):(c="needs-migration",e.push("Will write Rollup 4 / Svelte 5 config and rename to rollup.config.mjs."))}else c="unknown",e.push("No rollup config found - will create rollup.config.mjs.");let u=cts(),l="not-found";u?na.default.readFileSync(u,"utf8").includes("<svelte:boundary>")?(l="looks-new",e.push(`${u} already uses <svelte:boundary>.`)):(l="needs-migration",e.push(`Will update ${u} to use <svelte:boundary>, $$restProps, and error UI.`)):e.push("No wrapper.svelte found - skipping wrapper migration.");let f="unknown";if(na.default.existsSync("schema.json"))try{let p=na.default.readFileSync("schema.json","utf8"),h=JSON.parse(p);(h&&typeof h.metadata=="object"&&!Array.isArray(h.metadata)?h.metadata:{}).svelteMajor===5?(f="looks-new",e.push("schema.json metadata already declares svelteMajor: 5.")):(f="needs-migration",e.push("Will update schema.json metadata to set svelteMajor: 5."))}catch(p){f="unknown",e.push(`schema.json could not be parsed - please fix JSON before migration (${p?.message||"parse error"}).`)}else f="not-found",e.push("schema.json not found - cannot update metadata.");return{report:e,rollup:c,packageJson:n?"looks-new":"needs-migration",wrapper:l,schema:f,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}s(uts,"analysePluginForSvelte5");async function lts(){let e=zXu(),t=WXu(),r=await VXu(),n=$Xu();return{pkgRes:e,schemaRes:t,rollupRes:r,wrapperRes:n}}s(lts,"runSvelte5Migration");var fts=require("child_process");var YXu=require("find-free-port");function dts(){if(!AH.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!AH.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(dts,"checkInPlugin");async function KXu(e){return AH.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Ps(`By default the plugin will be created in the directory "${e}"`)),console.log(Ps("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),JS("Create top level directory?"))}s(KXu,"askAboutTopLevel");async function JXu(e){let t=e.init||e;if(!t||!BZt.includes(t)){console.log(Bc("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Ps("Lets get some details about your new plugin:"));let r=await sL("Name",`budibase-${t}`);if(AH.default.existsSync(r)){console.log(Bc("Directory by plugin name already exists, pick a new name."));return}let n=await sL("Description",`An amazing Budibase ${t}!`),i=await sL("Version","1.0.0"),o=await KXu(r);console.log(Ps("Retrieving project...")),await SGe(t,r),await Xes(t,r,n,i),console.log(Ps("Installing dependencies...")),await T7("install",(0,wGe.join)(process.cwd(),r)),o?console.log(Ps(`Plugin created in directory "${r}"`)):(xVe(r,process.cwd()),console.log(Ps("Plugin created in current directory."))),mhe(Cx.PluginInit,{type:t,name:r,description:n,version:i})}s(JXu,"init");async function DYt(){dts(),console.log(Ps("Verifying plugin..."));let e=AH.default.readFileSync("schema.json","utf8"),t=AH.default.readFileSync("package.json","utf8"),r,n;try{let i=JSON.parse(e),o=JSON.parse(t);if(!o.name||!o.version||!o.description)throw new Error("package.json is missing one of 'name', 'version' or 'description'.");return r=o.name,n=o.version,O2e.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Bc(`schema.json is not valid JSON: ${i.message}`)):console.log(Bc(`Invalid schema/package.json: ${i.message}`))}}s(DYt,"verify");async function XXu(){let e=await DYt();if(!e?.name)return;console.log(Mc("Verified!")),console.log(Ps("Building plugin...")),await T7("build");let t=(0,wGe.join)("dist",`${e.name}-${e.version}.tar.gz`);console.log(Mc(`Build complete - output in: ${t}`))}s(XXu,"build");async function ZXu(){let e=await DYt();if(!e?.name)return;let t=(0,wGe.join)("dist",`${e.name}-${e.version}.tar.gz`);console.log(Ps(`Watching - build in: ${t}`));try{await T7("watch")}catch{console.log(Mc("Watch exited."))}}s(ZXu,"watch");async function eZu(){let e=await sL("Directory to watch","./"),[t]=await YXu(1e4),r="admin";await Ehe({init:"quick",single:!0,watchPluginDir:e,genUser:r,port:t,silent:!0}),await PH(),console.log(Mc("Configuration has been written to docker-compose.yaml")),console.log(Mc("Development environment started successfully - connect at: ")+Ps(`http://localhost:${t}`)),console.log(Mc("Use the following credentials to login:")),console.log(Mc("Email: ")+Ps(HVe)),console.log(Mc("Password: ")+Ps(r))}s(eZu,"dev");async function tZu(){dts();let e=!1;try{e=!!(0,fts.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(e&&!process.argv.includes("--force")&&(console.log(Ps("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await JS("Proceed with migration anyway?"))){console.log(Ps("Migration aborted."));return}console.log(Ps("Analyzing plugin for Svelte 5 migration..."));let t=await uts();console.log(Ps("Proposed changes:"));for(let i of t.report)console.log(Ps(" - "+i));if(!process.argv.includes("--yes")&&!await JS("Apply these changes now?")){console.log(Ps("Migration aborted by user."));return}console.log(Ps("Applying migrations..."));let r=await lts();if(r.pkgRes?.message&&console.log(Ps(r.pkgRes.message)),r.schemaRes?.message&&console.log(Ps(r.schemaRes.message)),r.rollupRes?.message&&console.log(Ps(r.rollupRes.message)),r.wrapperRes?.message&&console.log(Ps(r.wrapperRes.message)),console.log(Ps("Installing updated dependencies...")),await T7("install"),console.log(Ps("Re-verifying plugin...")),!(await DYt())?.name){console.log(Bc("Verification failed after migration."));return}console.log(Ps("Attempting build..."));try{await T7("build"),console.log(Mc("Migration completed. Your plugin was migrated to Svelte 5 and built successfully."))}catch(i){console.log(Bc(`Build failed after migration. Please review the errors above. ${i?.message||""}`))}}s(tZu,"migrateSvelte5");var pts=new KS("plugins").addHelp("Custom plugins for Budibase, init, build and verify your components and datasources with this tool.").addSubOption("--init [type]","Init a new plugin project, with a type of either component or datasource.",JXu).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",XXu).addSubOption("--watch","Automatically build any changes to your plugin.",ZXu).addSubOption("--dev","Run a development environment which automatically watches the current directory.",eZu).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",tZu);function hts(){return[Gtr,_tr,CYi,pts]}s(hts,"getCommands");var gts=require("commander");Ud();var mts="3.23.
|
|
1550
|
+
`),{changed:!0,before:o,after:c,message:"Updated schema.json metadata to include svelteMajor: 5."}}s(WXu,"migrateSchemaJson");async function uts(){let e=[],t=na.default.readFileSync("package.json","utf8"),r=JSON.parse(t),n=r?.dependencies?.svelte?.startsWith("^5")||r?.peerDependencies?.svelte?.startsWith("^5"),i=typeof r?.version=="string"?r.version.trim():void 0,o=its(i);n?e.push("package.json appears to already depend on Svelte 5."):e.push("Will bump svelte to ^5.0.0 and align dev/peer dependencies."),o&&i&&o!==i&&e.push(`Will bump package.json version from ${i} to ${o}.`);let a=sts(),c="unknown";if(a){let p=na.default.readFileSync(a,"utf8");ots(p)?(c="looks-new",e.push(`Rollup config ${a} already looks Svelte 5-ready.`)):(c="needs-migration",e.push("Will write Rollup 4 / Svelte 5 config and rename to rollup.config.mjs."))}else c="unknown",e.push("No rollup config found - will create rollup.config.mjs.");let u=cts(),l="not-found";u?na.default.readFileSync(u,"utf8").includes("<svelte:boundary>")?(l="looks-new",e.push(`${u} already uses <svelte:boundary>.`)):(l="needs-migration",e.push(`Will update ${u} to use <svelte:boundary>, $$restProps, and error UI.`)):e.push("No wrapper.svelte found - skipping wrapper migration.");let f="unknown";if(na.default.existsSync("schema.json"))try{let p=na.default.readFileSync("schema.json","utf8"),h=JSON.parse(p);(h&&typeof h.metadata=="object"&&!Array.isArray(h.metadata)?h.metadata:{}).svelteMajor===5?(f="looks-new",e.push("schema.json metadata already declares svelteMajor: 5.")):(f="needs-migration",e.push("Will update schema.json metadata to set svelteMajor: 5."))}catch(p){f="unknown",e.push(`schema.json could not be parsed - please fix JSON before migration (${p?.message||"parse error"}).`)}else f="not-found",e.push("schema.json not found - cannot update metadata.");return{report:e,rollup:c,packageJson:n?"looks-new":"needs-migration",wrapper:l,schema:f,canBuildAfter:!0,rollupFile:a,wrapperFile:u,pkg:r}}s(uts,"analysePluginForSvelte5");async function lts(){let e=zXu(),t=WXu(),r=await VXu(),n=$Xu();return{pkgRes:e,schemaRes:t,rollupRes:r,wrapperRes:n}}s(lts,"runSvelte5Migration");var fts=require("child_process");var YXu=require("find-free-port");function dts(){if(!AH.default.existsSync("package.json"))throw new Error("Please run in a plugin directory - must contain package.json");if(!AH.default.existsSync("schema.json"))throw new Error("Please run in a plugin directory - must contain schema.json")}s(dts,"checkInPlugin");async function KXu(e){return AH.default.readdirSync(process.cwd()).find(r=>r===".git")?!1:(console.log(Ps(`By default the plugin will be created in the directory "${e}"`)),console.log(Ps("if you are already in an empty directory, such as a new Git repo, you can disable this functionality.")),JS("Create top level directory?"))}s(KXu,"askAboutTopLevel");async function JXu(e){let t=e.init||e;if(!t||!BZt.includes(t)){console.log(Bc("Please provide a type to init, either 'component', 'datasource' or 'automation'."));return}console.log(Ps("Lets get some details about your new plugin:"));let r=await sL("Name",`budibase-${t}`);if(AH.default.existsSync(r)){console.log(Bc("Directory by plugin name already exists, pick a new name."));return}let n=await sL("Description",`An amazing Budibase ${t}!`),i=await sL("Version","1.0.0"),o=await KXu(r);console.log(Ps("Retrieving project...")),await SGe(t,r),await Xes(t,r,n,i),console.log(Ps("Installing dependencies...")),await T7("install",(0,wGe.join)(process.cwd(),r)),o?console.log(Ps(`Plugin created in directory "${r}"`)):(xVe(r,process.cwd()),console.log(Ps("Plugin created in current directory."))),mhe(Cx.PluginInit,{type:t,name:r,description:n,version:i})}s(JXu,"init");async function DYt(){dts(),console.log(Ps("Verifying plugin..."));let e=AH.default.readFileSync("schema.json","utf8"),t=AH.default.readFileSync("package.json","utf8"),r,n;try{let i=JSON.parse(e),o=JSON.parse(t);if(!o.name||!o.version||!o.description)throw new Error("package.json is missing one of 'name', 'version' or 'description'.");return r=o.name,n=o.version,O2e.validate(i),{name:r,version:n}}catch(i){i&&i.message&&i.message.includes("not valid JSON")?console.log(Bc(`schema.json is not valid JSON: ${i.message}`)):console.log(Bc(`Invalid schema/package.json: ${i.message}`))}}s(DYt,"verify");async function XXu(){let e=await DYt();if(!e?.name)return;console.log(Mc("Verified!")),console.log(Ps("Building plugin...")),await T7("build");let t=(0,wGe.join)("dist",`${e.name}-${e.version}.tar.gz`);console.log(Mc(`Build complete - output in: ${t}`))}s(XXu,"build");async function ZXu(){let e=await DYt();if(!e?.name)return;let t=(0,wGe.join)("dist",`${e.name}-${e.version}.tar.gz`);console.log(Ps(`Watching - build in: ${t}`));try{await T7("watch")}catch{console.log(Mc("Watch exited."))}}s(ZXu,"watch");async function eZu(){let e=await sL("Directory to watch","./"),[t]=await YXu(1e4),r="admin";await Ehe({init:"quick",single:!0,watchPluginDir:e,genUser:r,port:t,silent:!0}),await PH(),console.log(Mc("Configuration has been written to docker-compose.yaml")),console.log(Mc("Development environment started successfully - connect at: ")+Ps(`http://localhost:${t}`)),console.log(Mc("Use the following credentials to login:")),console.log(Mc("Email: ")+Ps(HVe)),console.log(Mc("Password: ")+Ps(r))}s(eZu,"dev");async function tZu(){dts();let e=!1;try{e=!!(0,fts.execSync)("git status --porcelain",{encoding:"utf8"}).trim()}catch{}if(e&&!process.argv.includes("--force")&&(console.log(Ps("Your git working directory is not clean. Commit or stash changes, or re-run with --force.")),!await JS("Proceed with migration anyway?"))){console.log(Ps("Migration aborted."));return}console.log(Ps("Analyzing plugin for Svelte 5 migration..."));let t=await uts();console.log(Ps("Proposed changes:"));for(let i of t.report)console.log(Ps(" - "+i));if(!process.argv.includes("--yes")&&!await JS("Apply these changes now?")){console.log(Ps("Migration aborted by user."));return}console.log(Ps("Applying migrations..."));let r=await lts();if(r.pkgRes?.message&&console.log(Ps(r.pkgRes.message)),r.schemaRes?.message&&console.log(Ps(r.schemaRes.message)),r.rollupRes?.message&&console.log(Ps(r.rollupRes.message)),r.wrapperRes?.message&&console.log(Ps(r.wrapperRes.message)),console.log(Ps("Installing updated dependencies...")),await T7("install"),console.log(Ps("Re-verifying plugin...")),!(await DYt())?.name){console.log(Bc("Verification failed after migration."));return}console.log(Ps("Attempting build..."));try{await T7("build"),console.log(Mc("Migration completed. Your plugin was migrated to Svelte 5 and built successfully."))}catch(i){console.log(Bc(`Build failed after migration. Please review the errors above. ${i?.message||""}`))}}s(tZu,"migrateSvelte5");var pts=new KS("plugins").addHelp("Custom plugins for Budibase, init, build and verify your components and datasources with this tool.").addSubOption("--init [type]","Init a new plugin project, with a type of either component or datasource.",JXu).addSubOption("--build","Build your plugin, this will verify and produce a final tarball for your project.",XXu).addSubOption("--watch","Automatically build any changes to your plugin.",ZXu).addSubOption("--dev","Run a development environment which automatically watches the current directory.",eZu).addSubOption("--migrate-svelte5","Migrate this plugin to the Svelte 5-compatible Budibase plugin format.",tZu);function hts(){return[Gtr,_tr,CYi,pts]}s(hts,"getCommands");var gts=require("commander");Ud();var mts="3.23.5";async function nZu(){let e=new gts.Command().addHelpCommand("help",j7("Help with Budibase commands.")).helpOption(!1).version(mts);for(let t of hts())t.configure(e);await e.parseAsync(process.argv)}s(nZu,"init");var iZu=["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException"];iZu.forEach(e=>{process.on(e,t=>{t&&!isNaN(t)||t&&(console.error(Bc("Failed to run CLI command - please report with the following message:")),console.error(Bc(t)))})});nZu().catch(e=>{console.error("Unexpected error - ",e)});
|
|
1550
1551
|
/*! Bundled license information:
|
|
1551
1552
|
|
|
1552
1553
|
lodash/lodash.js:
|