@sap/generator-fiori
Version:
Create an SAPUI5 application using SAP Fiori elements or a freestyle approach
28 lines • 237 kB
JavaScript
const __esmImportMetaUrl = require('node:url').pathToFileURL(__filename).href;
var xh=Object.create;var Ct=Object.defineProperty;var Ph=Object.getOwnPropertyDescriptor;var Nh=Object.getOwnPropertyNames;var Oh=Object.getPrototypeOf,Ih=Object.prototype.hasOwnProperty;var n=(e,t)=>Ct(e,"name",{value:t,configurable:!0});var p=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},qh=(e,t)=>{for(var r in t)Ct(e,r,{get:t[r],enumerable:!0})},is=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Nh(t))!Ih.call(e,s)&&s!==r&&Ct(e,s,{get:()=>t[s],enumerable:!(i=Ph(t,s))||i.enumerable});return e};var Et=(e,t,r)=>(r=e!=null?xh(Oh(e)):{},is(t||!e||!e.__esModule?Ct(r,"default",{value:e,enumerable:!0}):r,e)),Mh=e=>is(Ct({},"__esModule",{value:!0}),e);var cr=p((RN,ns)=>{function Fh(e){return e}n(Fh,"identity");ns.exports=Fh});var as=p((UN,ss)=>{function Rh(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}n(Rh,"apply");ss.exports=Rh});var us=p((DN,cs)=>{var Lh=as(),os=Math.max;function Uh(e,t,r){return t=os(t===void 0?e.length-1:t,0),function(){for(var i=arguments,s=-1,a=os(i.length-t,0),c=Array(a);++s<a;)c[s]=i[t+s];s=-1;for(var o=Array(t+1);++s<t;)o[s]=i[s];return o[t]=r(c),Lh(e,this,o)}}n(Uh,"overRest");cs.exports=Uh});var ds=p(($N,ls)=>{function kh(e){return function(){return e}}n(kh,"constant");ls.exports=kh});var pi=p((GN,fs)=>{var Dh=typeof global=="object"&&global&&global.Object===Object&&global;fs.exports=Dh});var se=p((VN,ps)=>{var jh=pi(),$h=typeof self=="object"&&self&&self.Object===Object&&self,Bh=jh||$h||Function("return this")();ps.exports=Bh});var $e=p((HN,hs)=>{var Gh=se(),Vh=Gh.Symbol;hs.exports=Vh});var vs=p((WN,ys)=>{var ms=$e(),gs=Object.prototype,Hh=gs.hasOwnProperty,Wh=gs.toString,At=ms?ms.toStringTag:void 0;function Qh(e){var t=Hh.call(e,At),r=e[At];try{e[At]=void 0;var i=!0}catch{}var s=Wh.call(e);return i&&(t?e[At]=r:delete e[At]),s}n(Qh,"getRawTag");ys.exports=Qh});var Ss=p((KN,bs)=>{var Kh=Object.prototype,zh=Kh.toString;function Yh(e){return zh.call(e)}n(Yh,"objectToString");bs.exports=Yh});var Be=p((YN,_s)=>{var ws=$e(),Xh=vs(),Jh=Ss(),Zh="[object Null]",em="[object Undefined]",Ts=ws?ws.toStringTag:void 0;function tm(e){return e==null?e===void 0?em:Zh:Ts&&Ts in Object(e)?Xh(e):Jh(e)}n(tm,"baseGetTag");_s.exports=tm});var ye=p((JN,Cs)=>{function rm(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}n(rm,"isObject");Cs.exports=rm});var hi=p((e0,Es)=>{var im=Be(),nm=ye(),sm="[object AsyncFunction]",am="[object Function]",om="[object GeneratorFunction]",cm="[object Proxy]";function um(e){if(!nm(e))return!1;var t=im(e);return t==am||t==om||t==sm||t==cm}n(um,"isFunction");Es.exports=um});var xs=p((r0,As)=>{var lm=se(),dm=lm["__core-js_shared__"];As.exports=dm});var Os=p((i0,Ns)=>{var mi=xs(),Ps=(function(){var e=/[^.]+$/.exec(mi&&mi.keys&&mi.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function fm(e){return!!Ps&&Ps in e}n(fm,"isMasked");Ns.exports=fm});var gi=p((s0,Is)=>{var pm=Function.prototype,hm=pm.toString;function mm(e){if(e!=null){try{return hm.call(e)}catch{}try{return e+""}catch{}}return""}n(mm,"toSource");Is.exports=mm});var Ms=p((o0,qs)=>{var gm=hi(),ym=Os(),vm=ye(),bm=gi(),Sm=/[\\^$.*+?()[\]{}|]/g,wm=/^\[object .+?Constructor\]$/,Tm=Function.prototype,_m=Object.prototype,Cm=Tm.toString,Em=_m.hasOwnProperty,Am=RegExp("^"+Cm.call(Em).replace(Sm,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xm(e){if(!vm(e)||ym(e))return!1;var t=gm(e)?Am:wm;return t.test(bm(e))}n(xm,"baseIsNative");qs.exports=xm});var Rs=p((u0,Fs)=>{function Pm(e,t){return e?.[t]}n(Pm,"getValue");Fs.exports=Pm});var ve=p((d0,Ls)=>{var Nm=Ms(),Om=Rs();function Im(e,t){var r=Om(e,t);return Nm(r)?r:void 0}n(Im,"getNative");Ls.exports=Im});var yi=p((p0,Us)=>{var qm=ve(),Mm=(function(){try{var e=qm(Object,"defineProperty");return e({},"",{}),e}catch{}})();Us.exports=Mm});var js=p((h0,Ds)=>{var Fm=ds(),ks=yi(),Rm=cr(),Lm=ks?function(e,t){return ks(e,"toString",{configurable:!0,enumerable:!1,value:Fm(t),writable:!0})}:Rm;Ds.exports=Lm});var Bs=p((m0,$s)=>{var Um=800,km=16,Dm=Date.now;function jm(e){var t=0,r=0;return function(){var i=Dm(),s=km-(i-r);if(r=i,s>0){if(++t>=Um)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}n(jm,"shortOut");$s.exports=jm});var Vs=p((y0,Gs)=>{var $m=js(),Bm=Bs(),Gm=Bm($m);Gs.exports=Gm});var Ws=p((v0,Hs)=>{var Vm=cr(),Hm=us(),Wm=Vs();function Qm(e,t){return Wm(Hm(e,t,Vm),e+"")}n(Qm,"baseRest");Hs.exports=Qm});var Ge=p((S0,Qs)=>{function Km(e,t){return e===t||e!==e&&t!==t}n(Km,"eq");Qs.exports=Km});var ur=p((T0,Ks)=>{var zm=9007199254740991;function Ym(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=zm}n(Ym,"isLength");Ks.exports=Ym});var Ve=p((C0,zs)=>{var Xm=hi(),Jm=ur();function Zm(e){return e!=null&&Jm(e.length)&&!Xm(e)}n(Zm,"isArrayLike");zs.exports=Zm});var lr=p((A0,Ys)=>{var eg=9007199254740991,tg=/^(?:0|[1-9]\d*)$/;function rg(e,t){var r=typeof e;return t=t??eg,!!t&&(r=="number"||r!="symbol"&&tg.test(e))&&e>-1&&e%1==0&&e<t}n(rg,"isIndex");Ys.exports=rg});var Js=p((P0,Xs)=>{var ig=Ge(),ng=Ve(),sg=lr(),ag=ye();function og(e,t,r){if(!ag(r))return!1;var i=typeof t;return(i=="number"?ng(r)&&sg(t,r.length):i=="string"&&t in r)?ig(r[t],e):!1}n(og,"isIterateeCall");Xs.exports=og});var ea=p((O0,Zs)=>{function cg(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}n(cg,"baseTimes");Zs.exports=cg});var be=p((q0,ta)=>{function ug(e){return e!=null&&typeof e=="object"}n(ug,"isObjectLike");ta.exports=ug});var ia=p((F0,ra)=>{var lg=Be(),dg=be(),fg="[object Arguments]";function pg(e){return dg(e)&&lg(e)==fg}n(pg,"baseIsArguments");ra.exports=pg});var vi=p((L0,aa)=>{var na=ia(),hg=be(),sa=Object.prototype,mg=sa.hasOwnProperty,gg=sa.propertyIsEnumerable,yg=na((function(){return arguments})())?na:function(e){return hg(e)&&mg.call(e,"callee")&&!gg.call(e,"callee")};aa.exports=yg});var re=p((U0,oa)=>{var vg=Array.isArray;oa.exports=vg});var ua=p((k0,ca)=>{function bg(){return!1}n(bg,"stubFalse");ca.exports=bg});var dr=p((xt,He)=>{var Sg=se(),wg=ua(),fa=typeof xt=="object"&&xt&&!xt.nodeType&&xt,la=fa&&typeof He=="object"&&He&&!He.nodeType&&He,Tg=la&&la.exports===fa,da=Tg?Sg.Buffer:void 0,_g=da?da.isBuffer:void 0,Cg=_g||wg;He.exports=Cg});var ha=p((j0,pa)=>{var Eg=Be(),Ag=ur(),xg=be(),Pg="[object Arguments]",Ng="[object Array]",Og="[object Boolean]",Ig="[object Date]",qg="[object Error]",Mg="[object Function]",Fg="[object Map]",Rg="[object Number]",Lg="[object Object]",Ug="[object RegExp]",kg="[object Set]",Dg="[object String]",jg="[object WeakMap]",$g="[object ArrayBuffer]",Bg="[object DataView]",Gg="[object Float32Array]",Vg="[object Float64Array]",Hg="[object Int8Array]",Wg="[object Int16Array]",Qg="[object Int32Array]",Kg="[object Uint8Array]",zg="[object Uint8ClampedArray]",Yg="[object Uint16Array]",Xg="[object Uint32Array]",F={};F[Gg]=F[Vg]=F[Hg]=F[Wg]=F[Qg]=F[Kg]=F[zg]=F[Yg]=F[Xg]=!0;F[Pg]=F[Ng]=F[$g]=F[Og]=F[Bg]=F[Ig]=F[qg]=F[Mg]=F[Fg]=F[Rg]=F[Lg]=F[Ug]=F[kg]=F[Dg]=F[jg]=!1;function Jg(e){return xg(e)&&Ag(e.length)&&!!F[Eg(e)]}n(Jg,"baseIsTypedArray");pa.exports=Jg});var fr=p((B0,ma)=>{function Zg(e){return function(t){return e(t)}}n(Zg,"baseUnary");ma.exports=Zg});var pr=p((Pt,We)=>{var ey=pi(),ga=typeof Pt=="object"&&Pt&&!Pt.nodeType&&Pt,Nt=ga&&typeof We=="object"&&We&&!We.nodeType&&We,ty=Nt&&Nt.exports===ga,bi=ty&&ey.process,ry=(function(){try{var e=Nt&&Nt.require&&Nt.require("util").types;return e||bi&&bi.binding&&bi.binding("util")}catch{}})();We.exports=ry});var Si=p((V0,ba)=>{var iy=ha(),ny=fr(),ya=pr(),va=ya&&ya.isTypedArray,sy=va?ny(va):iy;ba.exports=sy});var wi=p((H0,Sa)=>{var ay=ea(),oy=vi(),cy=re(),uy=dr(),ly=lr(),dy=Si(),fy=Object.prototype,py=fy.hasOwnProperty;function hy(e,t){var r=cy(e),i=!r&&oy(e),s=!r&&!i&&uy(e),a=!r&&!i&&!s&&dy(e),c=r||i||s||a,o=c?ay(e.length,String):[],u=o.length;for(var l in e)(t||py.call(e,l))&&!(c&&(l=="length"||s&&(l=="offset"||l=="parent")||a&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||ly(l,u)))&&o.push(l);return o}n(hy,"arrayLikeKeys");Sa.exports=hy});var hr=p((Q0,wa)=>{var my=Object.prototype;function gy(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||my;return e===r}n(gy,"isPrototype");wa.exports=gy});var _a=p((z0,Ta)=>{function yy(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}n(yy,"nativeKeysIn");Ta.exports=yy});var Ea=p((X0,Ca)=>{var vy=ye(),by=hr(),Sy=_a(),wy=Object.prototype,Ty=wy.hasOwnProperty;function _y(e){if(!vy(e))return Sy(e);var t=by(e),r=[];for(var i in e)i=="constructor"&&(t||!Ty.call(e,i))||r.push(i);return r}n(_y,"baseKeysIn");Ca.exports=_y});var Ot=p((Z0,Aa)=>{var Cy=wi(),Ey=Ea(),Ay=Ve();function xy(e){return Ay(e)?Cy(e,!0):Ey(e)}n(xy,"keysIn");Aa.exports=xy});var Na=p((tO,Pa)=>{var Py=Ws(),Ny=Ge(),Oy=Js(),Iy=Ot(),xa=Object.prototype,qy=xa.hasOwnProperty,My=Py(function(e,t){e=Object(e);var r=-1,i=t.length,s=i>2?t[2]:void 0;for(s&&Oy(t[0],t[1],s)&&(i=1);++r<i;)for(var a=t[r],c=Iy(a),o=-1,u=c.length;++o<u;){var l=c[o],d=e[l];(d===void 0||Ny(d,xa[l])&&!qy.call(e,l))&&(e[l]=a[l])}return e});Pa.exports=My});var Ia=p((rO,Oa)=>{function Fy(){this.__data__=[],this.size=0}n(Fy,"listCacheClear");Oa.exports=Fy});var It=p((nO,qa)=>{var Ry=Ge();function Ly(e,t){for(var r=e.length;r--;)if(Ry(e[r][0],t))return r;return-1}n(Ly,"assocIndexOf");qa.exports=Ly});var Fa=p((aO,Ma)=>{var Uy=It(),ky=Array.prototype,Dy=ky.splice;function jy(e){var t=this.__data__,r=Uy(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():Dy.call(t,r,1),--this.size,!0}n(jy,"listCacheDelete");Ma.exports=jy});var La=p((cO,Ra)=>{var $y=It();function By(e){var t=this.__data__,r=$y(t,e);return r<0?void 0:t[r][1]}n(By,"listCacheGet");Ra.exports=By});var ka=p((lO,Ua)=>{var Gy=It();function Vy(e){return Gy(this.__data__,e)>-1}n(Vy,"listCacheHas");Ua.exports=Vy});var ja=p((fO,Da)=>{var Hy=It();function Wy(e,t){var r=this.__data__,i=Hy(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}n(Wy,"listCacheSet");Da.exports=Wy});var qt=p((hO,$a)=>{var Qy=Ia(),Ky=Fa(),zy=La(),Yy=ka(),Xy=ja();function Qe(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}n(Qe,"ListCache");Qe.prototype.clear=Qy;Qe.prototype.delete=Ky;Qe.prototype.get=zy;Qe.prototype.has=Yy;Qe.prototype.set=Xy;$a.exports=Qe});var Ga=p((gO,Ba)=>{var Jy=qt();function Zy(){this.__data__=new Jy,this.size=0}n(Zy,"stackClear");Ba.exports=Zy});var Ha=p((vO,Va)=>{function ev(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}n(ev,"stackDelete");Va.exports=ev});var Qa=p((SO,Wa)=>{function tv(e){return this.__data__.get(e)}n(tv,"stackGet");Wa.exports=tv});var za=p((TO,Ka)=>{function rv(e){return this.__data__.has(e)}n(rv,"stackHas");Ka.exports=rv});var mr=p((CO,Ya)=>{var iv=ve(),nv=se(),sv=iv(nv,"Map");Ya.exports=sv});var Mt=p((EO,Xa)=>{var av=ve(),ov=av(Object,"create");Xa.exports=ov});var eo=p((AO,Za)=>{var Ja=Mt();function cv(){this.__data__=Ja?Ja(null):{},this.size=0}n(cv,"hashClear");Za.exports=cv});var ro=p((PO,to)=>{function uv(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}n(uv,"hashDelete");to.exports=uv});var no=p((OO,io)=>{var lv=Mt(),dv="__lodash_hash_undefined__",fv=Object.prototype,pv=fv.hasOwnProperty;function hv(e){var t=this.__data__;if(lv){var r=t[e];return r===dv?void 0:r}return pv.call(t,e)?t[e]:void 0}n(hv,"hashGet");io.exports=hv});var ao=p((qO,so)=>{var mv=Mt(),gv=Object.prototype,yv=gv.hasOwnProperty;function vv(e){var t=this.__data__;return mv?t[e]!==void 0:yv.call(t,e)}n(vv,"hashHas");so.exports=vv});var co=p((FO,oo)=>{var bv=Mt(),Sv="__lodash_hash_undefined__";function wv(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=bv&&t===void 0?Sv:t,this}n(wv,"hashSet");oo.exports=wv});var lo=p((LO,uo)=>{var Tv=eo(),_v=ro(),Cv=no(),Ev=ao(),Av=co();function Ke(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}n(Ke,"Hash");Ke.prototype.clear=Tv;Ke.prototype.delete=_v;Ke.prototype.get=Cv;Ke.prototype.has=Ev;Ke.prototype.set=Av;uo.exports=Ke});var ho=p((kO,po)=>{var fo=lo(),xv=qt(),Pv=mr();function Nv(){this.size=0,this.__data__={hash:new fo,map:new(Pv||xv),string:new fo}}n(Nv,"mapCacheClear");po.exports=Nv});var go=p((jO,mo)=>{function Ov(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}n(Ov,"isKeyable");mo.exports=Ov});var Ft=p((BO,yo)=>{var Iv=go();function qv(e,t){var r=e.__data__;return Iv(t)?r[typeof t=="string"?"string":"hash"]:r.map}n(qv,"getMapData");yo.exports=qv});var bo=p((VO,vo)=>{var Mv=Ft();function Fv(e){var t=Mv(this,e).delete(e);return this.size-=t?1:0,t}n(Fv,"mapCacheDelete");vo.exports=Fv});var wo=p((WO,So)=>{var Rv=Ft();function Lv(e){return Rv(this,e).get(e)}n(Lv,"mapCacheGet");So.exports=Lv});var _o=p((KO,To)=>{var Uv=Ft();function kv(e){return Uv(this,e).has(e)}n(kv,"mapCacheHas");To.exports=kv});var Eo=p((YO,Co)=>{var Dv=Ft();function jv(e,t){var r=Dv(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}n(jv,"mapCacheSet");Co.exports=jv});var gr=p((JO,Ao)=>{var $v=ho(),Bv=bo(),Gv=wo(),Vv=_o(),Hv=Eo();function ze(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}n(ze,"MapCache");ze.prototype.clear=$v;ze.prototype.delete=Bv;ze.prototype.get=Gv;ze.prototype.has=Vv;ze.prototype.set=Hv;Ao.exports=ze});var Po=p((eI,xo)=>{var Wv=qt(),Qv=mr(),Kv=gr(),zv=200;function Yv(e,t){var r=this.__data__;if(r instanceof Wv){var i=r.__data__;if(!Qv||i.length<zv-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Kv(i)}return r.set(e,t),this.size=r.size,this}n(Yv,"stackSet");xo.exports=Yv});var yr=p((rI,No)=>{var Xv=qt(),Jv=Ga(),Zv=Ha(),eb=Qa(),tb=za(),rb=Po();function Ye(e){var t=this.__data__=new Xv(e);this.size=t.size}n(Ye,"Stack");Ye.prototype.clear=Jv;Ye.prototype.delete=Zv;Ye.prototype.get=eb;Ye.prototype.has=tb;Ye.prototype.set=rb;No.exports=Ye});var Io=p((nI,Oo)=>{function ib(e,t){for(var r=-1,i=e==null?0:e.length;++r<i&&t(e[r],r,e)!==!1;);return e}n(ib,"arrayEach");Oo.exports=ib});var Ti=p((aI,Mo)=>{var qo=yi();function nb(e,t,r){t=="__proto__"&&qo?qo(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}n(nb,"baseAssignValue");Mo.exports=nb});var _i=p((cI,Fo)=>{var sb=Ti(),ab=Ge(),ob=Object.prototype,cb=ob.hasOwnProperty;function ub(e,t,r){var i=e[t];(!(cb.call(e,t)&&ab(i,r))||r===void 0&&!(t in e))&&sb(e,t,r)}n(ub,"assignValue");Fo.exports=ub});var Rt=p((lI,Ro)=>{var lb=_i(),db=Ti();function fb(e,t,r,i){var s=!r;r||(r={});for(var a=-1,c=t.length;++a<c;){var o=t[a],u=i?i(r[o],e[o],o,r,e):void 0;u===void 0&&(u=e[o]),s?db(r,o,u):lb(r,o,u)}return r}n(fb,"copyObject");Ro.exports=fb});var Ci=p((fI,Lo)=>{function pb(e,t){return function(r){return e(t(r))}}n(pb,"overArg");Lo.exports=pb});var ko=p((hI,Uo)=>{var hb=Ci(),mb=hb(Object.keys,Object);Uo.exports=mb});var jo=p((mI,Do)=>{var gb=hr(),yb=ko(),vb=Object.prototype,bb=vb.hasOwnProperty;function Sb(e){if(!gb(e))return yb(e);var t=[];for(var r in Object(e))bb.call(e,r)&&r!="constructor"&&t.push(r);return t}n(Sb,"baseKeys");Do.exports=Sb});var Xe=p((yI,$o)=>{var wb=wi(),Tb=jo(),_b=Ve();function Cb(e){return _b(e)?wb(e):Tb(e)}n(Cb,"keys");$o.exports=Cb});var Go=p((bI,Bo)=>{var Eb=Rt(),Ab=Xe();function xb(e,t){return e&&Eb(t,Ab(t),e)}n(xb,"baseAssign");Bo.exports=xb});var Ho=p((wI,Vo)=>{var Pb=Rt(),Nb=Ot();function Ob(e,t){return e&&Pb(t,Nb(t),e)}n(Ob,"baseAssignIn");Vo.exports=Ob});var Yo=p((Lt,Je)=>{var Ib=se(),zo=typeof Lt=="object"&&Lt&&!Lt.nodeType&&Lt,Wo=zo&&typeof Je=="object"&&Je&&!Je.nodeType&&Je,qb=Wo&&Wo.exports===zo,Qo=qb?Ib.Buffer:void 0,Ko=Qo?Qo.allocUnsafe:void 0;function Mb(e,t){if(t)return e.slice();var r=e.length,i=Ko?Ko(r):new e.constructor(r);return e.copy(i),i}n(Mb,"cloneBuffer");Je.exports=Mb});var Jo=p((CI,Xo)=>{function Fb(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r<i;)t[r]=e[r];return t}n(Fb,"copyArray");Xo.exports=Fb});var Ei=p((AI,Zo)=>{function Rb(e,t){for(var r=-1,i=e==null?0:e.length,s=0,a=[];++r<i;){var c=e[r];t(c,r,e)&&(a[s++]=c)}return a}n(Rb,"arrayFilter");Zo.exports=Rb});var Ai=p((PI,ec)=>{function Lb(){return[]}n(Lb,"stubArray");ec.exports=Lb});var vr=p((OI,rc)=>{var Ub=Ei(),kb=Ai(),Db=Object.prototype,jb=Db.propertyIsEnumerable,tc=Object.getOwnPropertySymbols,$b=tc?function(e){return e==null?[]:(e=Object(e),Ub(tc(e),function(t){return jb.call(e,t)}))}:kb;rc.exports=$b});var nc=p((II,ic)=>{var Bb=Rt(),Gb=vr();function Vb(e,t){return Bb(e,Gb(e),t)}n(Vb,"copySymbols");ic.exports=Vb});var xi=p((MI,sc)=>{function Hb(e,t){for(var r=-1,i=t.length,s=e.length;++r<i;)e[s+r]=t[r];return e}n(Hb,"arrayPush");sc.exports=Hb});var Pi=p((RI,ac)=>{var Wb=Ci(),Qb=Wb(Object.getPrototypeOf,Object);ac.exports=Qb});var Ni=p((LI,oc)=>{var Kb=xi(),zb=Pi(),Yb=vr(),Xb=Ai(),Jb=Object.getOwnPropertySymbols,Zb=Jb?function(e){for(var t=[];e;)Kb(t,Yb(e)),e=zb(e);return t}:Xb;oc.exports=Zb});var uc=p((UI,cc)=>{var eS=Rt(),tS=Ni();function rS(e,t){return eS(e,tS(e),t)}n(rS,"copySymbolsIn");cc.exports=rS});var Oi=p((DI,lc)=>{var iS=xi(),nS=re();function sS(e,t,r){var i=t(e);return nS(e)?i:iS(i,r(e))}n(sS,"baseGetAllKeys");lc.exports=sS});var Ii=p(($I,dc)=>{var aS=Oi(),oS=vr(),cS=Xe();function uS(e){return aS(e,cS,oS)}n(uS,"getAllKeys");dc.exports=uS});var pc=p((GI,fc)=>{var lS=Oi(),dS=Ni(),fS=Ot();function pS(e){return lS(e,fS,dS)}n(pS,"getAllKeysIn");fc.exports=pS});var mc=p((HI,hc)=>{var hS=ve(),mS=se(),gS=hS(mS,"DataView");hc.exports=gS});var yc=p((WI,gc)=>{var yS=ve(),vS=se(),bS=yS(vS,"Promise");gc.exports=bS});var bc=p((QI,vc)=>{var SS=ve(),wS=se(),TS=SS(wS,"Set");vc.exports=TS});var wc=p((KI,Sc)=>{var _S=ve(),CS=se(),ES=_S(CS,"WeakMap");Sc.exports=ES});var Ut=p((zI,Pc)=>{var qi=mc(),Mi=mr(),Fi=yc(),Ri=bc(),Li=wc(),xc=Be(),Ze=gi(),Tc="[object Map]",AS="[object Object]",_c="[object Promise]",Cc="[object Set]",Ec="[object WeakMap]",Ac="[object DataView]",xS=Ze(qi),PS=Ze(Mi),NS=Ze(Fi),OS=Ze(Ri),IS=Ze(Li),xe=xc;(qi&&xe(new qi(new ArrayBuffer(1)))!=Ac||Mi&&xe(new Mi)!=Tc||Fi&&xe(Fi.resolve())!=_c||Ri&&xe(new Ri)!=Cc||Li&&xe(new Li)!=Ec)&&(xe=n(function(e){var t=xc(e),r=t==AS?e.constructor:void 0,i=r?Ze(r):"";if(i)switch(i){case xS:return Ac;case PS:return Tc;case NS:return _c;case OS:return Cc;case IS:return Ec}return t},"getTag"));Pc.exports=xe});var Oc=p((XI,Nc)=>{var qS=Object.prototype,MS=qS.hasOwnProperty;function FS(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&MS.call(e,"index")&&(r.index=e.index,r.input=e.input),r}n(FS,"initCloneArray");Nc.exports=FS});var Ui=p((ZI,Ic)=>{var RS=se(),LS=RS.Uint8Array;Ic.exports=LS});var br=p((eq,Mc)=>{var qc=Ui();function US(e){var t=new e.constructor(e.byteLength);return new qc(t).set(new qc(e)),t}n(US,"cloneArrayBuffer");Mc.exports=US});var Rc=p((rq,Fc)=>{var kS=br();function DS(e,t){var r=t?kS(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}n(DS,"cloneDataView");Fc.exports=DS});var Uc=p((nq,Lc)=>{var jS=/\w*$/;function $S(e){var t=new e.constructor(e.source,jS.exec(e));return t.lastIndex=e.lastIndex,t}n($S,"cloneRegExp");Lc.exports=$S});var Bc=p((aq,$c)=>{var kc=$e(),Dc=kc?kc.prototype:void 0,jc=Dc?Dc.valueOf:void 0;function BS(e){return jc?Object(jc.call(e)):{}}n(BS,"cloneSymbol");$c.exports=BS});var Vc=p((cq,Gc)=>{var GS=br();function VS(e,t){var r=t?GS(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}n(VS,"cloneTypedArray");Gc.exports=VS});var Wc=p((lq,Hc)=>{var HS=br(),WS=Rc(),QS=Uc(),KS=Bc(),zS=Vc(),YS="[object Boolean]",XS="[object Date]",JS="[object Map]",ZS="[object Number]",ew="[object RegExp]",tw="[object Set]",rw="[object String]",iw="[object Symbol]",nw="[object ArrayBuffer]",sw="[object DataView]",aw="[object Float32Array]",ow="[object Float64Array]",cw="[object Int8Array]",uw="[object Int16Array]",lw="[object Int32Array]",dw="[object Uint8Array]",fw="[object Uint8ClampedArray]",pw="[object Uint16Array]",hw="[object Uint32Array]";function mw(e,t,r){var i=e.constructor;switch(t){case nw:return HS(e);case YS:case XS:return new i(+e);case sw:return WS(e,r);case aw:case ow:case cw:case uw:case lw:case dw:case fw:case pw:case hw:return zS(e,r);case JS:return new i;case ZS:case rw:return new i(e);case ew:return QS(e);case tw:return new i;case iw:return KS(e)}}n(mw,"initCloneByTag");Hc.exports=mw});var zc=p((fq,Kc)=>{var gw=ye(),Qc=Object.create,yw=(function(){function e(){}return n(e,"object"),function(t){if(!gw(t))return{};if(Qc)return Qc(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();Kc.exports=yw});var Xc=p((hq,Yc)=>{var vw=zc(),bw=Pi(),Sw=hr();function ww(e){return typeof e.constructor=="function"&&!Sw(e)?vw(bw(e)):{}}n(ww,"initCloneObject");Yc.exports=ww});var Zc=p((gq,Jc)=>{var Tw=Ut(),_w=be(),Cw="[object Map]";function Ew(e){return _w(e)&&Tw(e)==Cw}n(Ew,"baseIsMap");Jc.exports=Ew});var iu=p((vq,ru)=>{var Aw=Zc(),xw=fr(),eu=pr(),tu=eu&&eu.isMap,Pw=tu?xw(tu):Aw;ru.exports=Pw});var su=p((bq,nu)=>{var Nw=Ut(),Ow=be(),Iw="[object Set]";function qw(e){return Ow(e)&&Nw(e)==Iw}n(qw,"baseIsSet");nu.exports=qw});var uu=p((wq,cu)=>{var Mw=su(),Fw=fr(),au=pr(),ou=au&&au.isSet,Rw=ou?Fw(ou):Mw;cu.exports=Rw});var hu=p((Tq,pu)=>{var Lw=yr(),Uw=Io(),kw=_i(),Dw=Go(),jw=Ho(),$w=Yo(),Bw=Jo(),Gw=nc(),Vw=uc(),Hw=Ii(),Ww=pc(),Qw=Ut(),Kw=Oc(),zw=Wc(),Yw=Xc(),Xw=re(),Jw=dr(),Zw=iu(),eT=ye(),tT=uu(),rT=Xe(),iT=Ot(),nT=1,sT=2,aT=4,lu="[object Arguments]",oT="[object Array]",cT="[object Boolean]",uT="[object Date]",lT="[object Error]",du="[object Function]",dT="[object GeneratorFunction]",fT="[object Map]",pT="[object Number]",fu="[object Object]",hT="[object RegExp]",mT="[object Set]",gT="[object String]",yT="[object Symbol]",vT="[object WeakMap]",bT="[object ArrayBuffer]",ST="[object DataView]",wT="[object Float32Array]",TT="[object Float64Array]",_T="[object Int8Array]",CT="[object Int16Array]",ET="[object Int32Array]",AT="[object Uint8Array]",xT="[object Uint8ClampedArray]",PT="[object Uint16Array]",NT="[object Uint32Array]",M={};M[lu]=M[oT]=M[bT]=M[ST]=M[cT]=M[uT]=M[wT]=M[TT]=M[_T]=M[CT]=M[ET]=M[fT]=M[pT]=M[fu]=M[hT]=M[mT]=M[gT]=M[yT]=M[AT]=M[xT]=M[PT]=M[NT]=!0;M[lT]=M[du]=M[vT]=!1;function Sr(e,t,r,i,s,a){var c,o=t&nT,u=t&sT,l=t&aT;if(r&&(c=s?r(e,i,s,a):r(e)),c!==void 0)return c;if(!eT(e))return e;var d=Xw(e);if(d){if(c=Kw(e),!o)return Bw(e,c)}else{var h=Qw(e),m=h==du||h==dT;if(Jw(e))return $w(e,o);if(h==fu||h==lu||m&&!s){if(c=u||m?{}:Yw(e),!o)return u?Vw(e,jw(c,e)):Gw(e,Dw(c,e))}else{if(!M[h])return s?e:{};c=zw(e,h,o)}}a||(a=new Lw);var S=a.get(e);if(S)return S;a.set(e,c),tT(e)?e.forEach(function(C){c.add(Sr(C,t,r,C,e,a))}):Zw(e)&&e.forEach(function(C,x){c.set(x,Sr(C,t,r,x,e,a))});var E=l?u?Ww:Hw:u?iT:rT,w=d?void 0:E(e);return Uw(w||e,function(C,x){w&&(x=C,C=e[x]),kw(c,x,Sr(C,t,r,x,e,a))}),c}n(Sr,"baseClone");pu.exports=Sr});var gu=p((Cq,mu)=>{var OT=hu(),IT=4;function qT(e){return OT(e,IT)}n(qT,"clone");mu.exports=qT});var vu=p((Aq,yu)=>{function MT(e){return function(t,r,i){for(var s=-1,a=Object(t),c=i(t),o=c.length;o--;){var u=c[e?o:++s];if(r(a[u],u,a)===!1)break}return t}}n(MT,"createBaseFor");yu.exports=MT});var Su=p((Pq,bu)=>{var FT=vu(),RT=FT();bu.exports=RT});var Tu=p((Nq,wu)=>{var LT=Su(),UT=Xe();function kT(e,t){return e&<(e,t,UT)}n(kT,"baseForOwn");wu.exports=kT});var Cu=p((Iq,_u)=>{var DT=Ve();function jT(e,t){return function(r,i){if(r==null)return r;if(!DT(r))return e(r,i);for(var s=r.length,a=t?s:-1,c=Object(r);(t?a--:++a<s)&&i(c[a],a,c)!==!1;);return r}}n(jT,"createBaseEach");_u.exports=jT});var ki=p((Mq,Eu)=>{var $T=Tu(),BT=Cu(),GT=BT($T);Eu.exports=GT});var xu=p((Fq,Au)=>{var VT=ki();function HT(e,t){var r=[];return VT(e,function(i,s,a){t(i,s,a)&&r.push(i)}),r}n(HT,"baseFilter");Au.exports=HT});var Nu=p((Lq,Pu)=>{var WT="__lodash_hash_undefined__";function QT(e){return this.__data__.set(e,WT),this}n(QT,"setCacheAdd");Pu.exports=QT});var Iu=p((kq,Ou)=>{function KT(e){return this.__data__.has(e)}n(KT,"setCacheHas");Ou.exports=KT});var Mu=p((jq,qu)=>{var zT=gr(),YT=Nu(),XT=Iu();function wr(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new zT;++t<r;)this.add(e[t])}n(wr,"SetCache");wr.prototype.add=wr.prototype.push=YT;wr.prototype.has=XT;qu.exports=wr});var Ru=p((Bq,Fu)=>{function JT(e,t){for(var r=-1,i=e==null?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}n(JT,"arraySome");Fu.exports=JT});var Uu=p((Vq,Lu)=>{function ZT(e,t){return e.has(t)}n(ZT,"cacheHas");Lu.exports=ZT});var Di=p((Wq,ku)=>{var e_=Mu(),t_=Ru(),r_=Uu(),i_=1,n_=2;function s_(e,t,r,i,s,a){var c=r&i_,o=e.length,u=t.length;if(o!=u&&!(c&&u>o))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var h=-1,m=!0,S=r&n_?new e_:void 0;for(a.set(e,t),a.set(t,e);++h<o;){var E=e[h],w=t[h];if(i)var C=c?i(w,E,h,t,e,a):i(E,w,h,e,t,a);if(C!==void 0){if(C)continue;m=!1;break}if(S){if(!t_(t,function(x,L){if(!r_(S,L)&&(E===x||s(E,x,r,i,a)))return S.push(L)})){m=!1;break}}else if(!(E===w||s(E,w,r,i,a))){m=!1;break}}return a.delete(e),a.delete(t),m}n(s_,"equalArrays");ku.exports=s_});var ju=p((Kq,Du)=>{function a_(e){var t=-1,r=Array(e.size);return e.forEach(function(i,s){r[++t]=[s,i]}),r}n(a_,"mapToArray");Du.exports=a_});var Bu=p((Yq,$u)=>{function o_(e){var t=-1,r=Array(e.size);return e.forEach(function(i){r[++t]=i}),r}n(o_,"setToArray");$u.exports=o_});var Qu=p((Jq,Wu)=>{var Gu=$e(),Vu=Ui(),c_=Ge(),u_=Di(),l_=ju(),d_=Bu(),f_=1,p_=2,h_="[object Boolean]",m_="[object Date]",g_="[object Error]",y_="[object Map]",v_="[object Number]",b_="[object RegExp]",S_="[object Set]",w_="[object String]",T_="[object Symbol]",__="[object ArrayBuffer]",C_="[object DataView]",Hu=Gu?Gu.prototype:void 0,ji=Hu?Hu.valueOf:void 0;function E_(e,t,r,i,s,a,c){switch(r){case C_:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case __:return!(e.byteLength!=t.byteLength||!a(new Vu(e),new Vu(t)));case h_:case m_:case v_:return c_(+e,+t);case g_:return e.name==t.name&&e.message==t.message;case b_:case w_:return e==t+"";case y_:var o=l_;case S_:var u=i&f_;if(o||(o=d_),e.size!=t.size&&!u)return!1;var l=c.get(e);if(l)return l==t;i|=p_,c.set(e,t);var d=u_(o(e),o(t),i,s,a,c);return c.delete(e),d;case T_:if(ji)return ji.call(e)==ji.call(t)}return!1}n(E_,"equalByTag");Wu.exports=E_});var Yu=p((eM,zu)=>{var Ku=Ii(),A_=1,x_=Object.prototype,P_=x_.hasOwnProperty;function N_(e,t,r,i,s,a){var c=r&A_,o=Ku(e),u=o.length,l=Ku(t),d=l.length;if(u!=d&&!c)return!1;for(var h=u;h--;){var m=o[h];if(!(c?m in t:P_.call(t,m)))return!1}var S=a.get(e),E=a.get(t);if(S&&E)return S==t&&E==e;var w=!0;a.set(e,t),a.set(t,e);for(var C=c;++h<u;){m=o[h];var x=e[m],L=t[m];if(i)var H=c?i(L,x,m,t,e,a):i(x,L,m,e,t,a);if(!(H===void 0?x===L||s(x,L,r,i,a):H)){w=!1;break}C||(C=m=="constructor")}if(w&&!C){var ce=e.constructor,te=t.constructor;ce!=te&&"constructor"in e&&"constructor"in t&&!(typeof ce=="function"&&ce instanceof ce&&typeof te=="function"&&te instanceof te)&&(w=!1)}return a.delete(e),a.delete(t),w}n(N_,"equalObjects");zu.exports=N_});var nl=p((rM,il)=>{var $i=yr(),O_=Di(),I_=Qu(),q_=Yu(),Xu=Ut(),Ju=re(),Zu=dr(),M_=Si(),F_=1,el="[object Arguments]",tl="[object Array]",Tr="[object Object]",R_=Object.prototype,rl=R_.hasOwnProperty;function L_(e,t,r,i,s,a){var c=Ju(e),o=Ju(t),u=c?tl:Xu(e),l=o?tl:Xu(t);u=u==el?Tr:u,l=l==el?Tr:l;var d=u==Tr,h=l==Tr,m=u==l;if(m&&Zu(e)){if(!Zu(t))return!1;c=!0,d=!1}if(m&&!d)return a||(a=new $i),c||M_(e)?O_(e,t,r,i,s,a):I_(e,t,u,r,i,s,a);if(!(r&F_)){var S=d&&rl.call(e,"__wrapped__"),E=h&&rl.call(t,"__wrapped__");if(S||E){var w=S?e.value():e,C=E?t.value():t;return a||(a=new $i),s(w,C,r,i,a)}}return m?(a||(a=new $i),q_(e,t,r,i,s,a)):!1}n(L_,"baseIsEqualDeep");il.exports=L_});var Bi=p((nM,ol)=>{var U_=nl(),sl=be();function al(e,t,r,i,s){return e===t?!0:e==null||t==null||!sl(e)&&!sl(t)?e!==e&&t!==t:U_(e,t,r,i,al,s)}n(al,"baseIsEqual");ol.exports=al});var ul=p((aM,cl)=>{var k_=yr(),D_=Bi(),j_=1,$_=2;function B_(e,t,r,i){var s=r.length,a=s,c=!i;if(e==null)return!a;for(e=Object(e);s--;){var o=r[s];if(c&&o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++s<a;){o=r[s];var u=o[0],l=e[u],d=o[1];if(c&&o[2]){if(l===void 0&&!(u in e))return!1}else{var h=new k_;if(i)var m=i(l,d,u,e,t,h);if(!(m===void 0?D_(d,l,j_|$_,i,h):m))return!1}}return!0}n(B_,"baseIsMatch");cl.exports=B_});var Gi=p((cM,ll)=>{var G_=ye();function V_(e){return e===e&&!G_(e)}n(V_,"isStrictComparable");ll.exports=V_});var fl=p((lM,dl)=>{var H_=Gi(),W_=Xe();function Q_(e){for(var t=W_(e),r=t.length;r--;){var i=t[r],s=e[i];t[r]=[i,s,H_(s)]}return t}n(Q_,"getMatchData");dl.exports=Q_});var Vi=p((fM,pl)=>{function K_(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}n(K_,"matchesStrictComparable");pl.exports=K_});var ml=p((hM,hl)=>{var z_=ul(),Y_=fl(),X_=Vi();function J_(e){var t=Y_(e);return t.length==1&&t[0][2]?X_(t[0][0],t[0][1]):function(r){return r===e||z_(r,e,t)}}n(J_,"baseMatches");hl.exports=J_});var _r=p((gM,gl)=>{var Z_=Be(),eC=be(),tC="[object Symbol]";function rC(e){return typeof e=="symbol"||eC(e)&&Z_(e)==tC}n(rC,"isSymbol");gl.exports=rC});var Cr=p((vM,yl)=>{var iC=re(),nC=_r(),sC=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,aC=/^\w*$/;function oC(e,t){if(iC(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||nC(e)?!0:aC.test(e)||!sC.test(e)||t!=null&&e in Object(t)}n(oC,"isKey");yl.exports=oC});var Sl=p((SM,bl)=>{var vl=gr(),cC="Expected a function";function Hi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(cC);var r=n(function(){var i=arguments,s=t?t.apply(this,i):i[0],a=r.cache;if(a.has(s))return a.get(s);var c=e.apply(this,i);return r.cache=a.set(s,c)||a,c},"memoized");return r.cache=new(Hi.Cache||vl),r}n(Hi,"memoize");Hi.Cache=vl;bl.exports=Hi});var Tl=p((TM,wl)=>{var uC=Sl(),lC=500;function dC(e){var t=uC(e,function(i){return r.size===lC&&r.clear(),i}),r=t.cache;return t}n(dC,"memoizeCapped");wl.exports=dC});var Cl=p((CM,_l)=>{var fC=Tl(),pC=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hC=/\\(\\)?/g,mC=fC(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(pC,function(r,i,s,a){t.push(s?a.replace(hC,"$1"):i||r)}),t});_l.exports=mC});var Wi=p((EM,El)=>{function gC(e,t){for(var r=-1,i=e==null?0:e.length,s=Array(i);++r<i;)s[r]=t(e[r],r,e);return s}n(gC,"arrayMap");El.exports=gC});var Il=p((xM,Ol)=>{var Al=$e(),yC=Wi(),vC=re(),bC=_r(),SC=1/0,xl=Al?Al.prototype:void 0,Pl=xl?xl.toString:void 0;function Nl(e){if(typeof e=="string")return e;if(vC(e))return yC(e,Nl)+"";if(bC(e))return Pl?Pl.call(e):"";var t=e+"";return t=="0"&&1/e==-SC?"-0":t}n(Nl,"baseToString");Ol.exports=Nl});var Ml=p((NM,ql)=>{var wC=Il();function TC(e){return e==null?"":wC(e)}n(TC,"toString");ql.exports=TC});var Qi=p((IM,Fl)=>{var _C=re(),CC=Cr(),EC=Cl(),AC=Ml();function xC(e,t){return _C(e)?e:CC(e,t)?[e]:EC(AC(e))}n(xC,"castPath");Fl.exports=xC});var kt=p((MM,Rl)=>{var PC=_r(),NC=1/0;function OC(e){if(typeof e=="string"||PC(e))return e;var t=e+"";return t=="0"&&1/e==-NC?"-0":t}n(OC,"toKey");Rl.exports=OC});var Ki=p((RM,Ll)=>{var IC=Qi(),qC=kt();function MC(e,t){t=IC(t,e);for(var r=0,i=t.length;e!=null&&r<i;)e=e[qC(t[r++])];return r&&r==i?e:void 0}n(MC,"baseGet");Ll.exports=MC});var kl=p((UM,Ul)=>{var FC=Ki();function RC(e,t,r){var i=e==null?void 0:FC(e,t);return i===void 0?r:i}n(RC,"get");Ul.exports=RC});var jl=p((DM,Dl)=>{function LC(e,t){return e!=null&&t in Object(e)}n(LC,"baseHasIn");Dl.exports=LC});var Bl=p(($M,$l)=>{var UC=Qi(),kC=vi(),DC=re(),jC=lr(),$C=ur(),BC=kt();function GC(e,t,r){t=UC(t,e);for(var i=-1,s=t.length,a=!1;++i<s;){var c=BC(t[i]);if(!(a=e!=null&&r(e,c)))break;e=e[c]}return a||++i!=s?a:(s=e==null?0:e.length,!!s&&$C(s)&&jC(c,s)&&(DC(e)||kC(e)))}n(GC,"hasPath");$l.exports=GC});var Vl=p((GM,Gl)=>{var VC=jl(),HC=Bl();function WC(e,t){return e!=null&&HC(e,t,VC)}n(WC,"hasIn");Gl.exports=WC});var Wl=p((HM,Hl)=>{var QC=Bi(),KC=kl(),zC=Vl(),YC=Cr(),XC=Gi(),JC=Vi(),ZC=kt(),eE=1,tE=2;function rE(e,t){return YC(e)&&XC(t)?JC(ZC(e),t):function(r){var i=KC(r,e);return i===void 0&&i===t?zC(r,e):QC(t,i,eE|tE)}}n(rE,"baseMatchesProperty");Hl.exports=rE});var Kl=p((QM,Ql)=>{function iE(e){return function(t){return t?.[e]}}n(iE,"baseProperty");Ql.exports=iE});var Yl=p((zM,zl)=>{var nE=Ki();function sE(e){return function(t){return nE(t,e)}}n(sE,"basePropertyDeep");zl.exports=sE});var Jl=p((XM,Xl)=>{var aE=Kl(),oE=Yl(),cE=Cr(),uE=kt();function lE(e){return cE(e)?aE(uE(e)):oE(e)}n(lE,"property");Xl.exports=lE});var zi=p((ZM,Zl)=>{var dE=ml(),fE=Wl(),pE=cr(),hE=re(),mE=Jl();function gE(e){return typeof e=="function"?e:e==null?pE:typeof e=="object"?hE(e)?fE(e[0],e[1]):dE(e):mE(e)}n(gE,"baseIteratee");Zl.exports=gE});var td=p((t1,ed)=>{var yE=Ei(),vE=xu(),bE=zi(),SE=re();function wE(e,t){var r=SE(e)?yE:vE;return r(e,bE(t,3))}n(wE,"filter");ed.exports=wE});var id=p((i1,rd)=>{var TE=ki(),_E=Ve();function CE(e,t){var r=-1,i=_E(e)?Array(e.length):[];return TE(e,function(s,a,c){i[++r]=t(s,a,c)}),i}n(CE,"baseMap");rd.exports=CE});var sd=p((s1,nd)=>{var EE=Wi(),AE=zi(),xE=id(),PE=re();function NE(e,t){var r=PE(e)?EE:xE;return r(e,AE(t,3))}n(NE,"map");nd.exports=NE});var od=p((o1,ad)=>{"use strict";var OE=require("../../commonlibs/chalk/index.js"),IE=require("../../commonlibs/figures/index.js"),Er=class{static{n(this,"Separator")}constructor(t){this.type="separator",this.line=OE.dim(t||new Array(15).join(IE.line))}toString(){return this.line}};Er.exclude=function(e){return e.type!=="separator"};ad.exports=Er});var ld=p((u1,ud)=>{"use strict";ud.exports=class cd{static{n(this,"Choice")}constructor(t,r){if(t instanceof cd||t.type==="separator")return t;typeof t=="string"||typeof t=="number"?(this.name=String(t),this.value=t,this.short=String(t)):Object.assign(this,t,{name:t.name||t.value,value:"value"in t?t.value:t.name,short:t.short||t.name||t.value}),typeof t.disabled=="function"?this.disabled=t.disabled(r):this.disabled=t.disabled}}});var Yi=p((f1,hd)=>{"use strict";var dd=require("assert"),fd={filter:td(),map:sd()},Ar=od(),pd=ld();hd.exports=class{static{n(this,"Choices")}constructor(t,r){this.choices=t.map(i=>i.type==="separator"?(i instanceof Ar||(i=new Ar(i.line)),i):new pd(i,r)),this.realChoices=this.choices.filter(Ar.exclude).filter(i=>!i.disabled),Object.defineProperty(this,"length",{get(){return this.choices.length},set(i){this.choices.length=i}}),Object.defineProperty(this,"realLength",{get(){return this.realChoices.length},set(){throw new Error("Cannot set `realLength` of a Choices collection")}})}getChoice(t){return dd(typeof t=="number"),this.realChoices[t]}get(t){return dd(typeof t=="number"),this.choices[t]}where(t){return fd.filter(this.realChoices,t)}pluck(t){return fd.map(this.realChoices,t)}indexOf(...t){return this.choices.indexOf(...t)}forEach(...t){return this.choices.forEach(...t)}filter(...t){return this.choices.filter(...t)}reduce(...t){return this.choices.reduce(...t)}find(t){return this.choices.find(t)}push(...t){let r=t.map(i=>new pd(i));return this.choices.push(...r),this.realChoices=this.choices.filter(Ar.exclude).filter(i=>!i.disabled),this.choices}}});var Xi=p(et=>{"use strict";var Dt=require("../../commonlibs/ansi-escapes/index.js");et.left=function(e,t){e.output.write(Dt.cursorBackward(t))};et.right=function(e,t){e.output.write(Dt.cursorForward(t))};et.up=function(e,t){e.output.write(Dt.cursorUp(t))};et.down=function(e,t){e.output.write(Dt.cursorDown(t))};et.clearLine=function(e,t){e.output.write(Dt.eraseLines(t))}});var yd=p((md,gd)=>{"use strict";md=gd.exports=ME;function qE(e){let t={defaultWidth:0,output:process.stdout,tty:require("tty")};return e?(Object.keys(t).forEach(function(r){e[r]||(e[r]=t[r])}),e):t}n(qE,"normalizeOpts");function ME(e){let t=qE(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let r=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(r)&&r!==0)return r}return t.defaultWidth}n(ME,"cliWidth")});var Td=p((g1,wd)=>{"use strict";var tt=Xi(),FE=yd(),RE=require("../../commonlibs/wrap-ansi/index.js"),LE=require("../../commonlibs/strip-ansi/index.js"),UE=require("../../commonlibs/string-width/index.js"),vd=require("../../commonlibs/ora/index.js");function bd(e){return e.split(`
`).length}n(bd,"height");function Sd(e){return e.split(`
`).pop()}n(Sd,"lastLine");var Ji=class{static{n(this,"ScreenManager")}constructor(t){this.height=0,this.extraLinesUnderPrompt=0,this.rl=t}renderWithSpinner(t,r){this.spinnerId&&clearInterval(this.spinnerId);let i,s,a;r?(i=vd(r),s=n(()=>t,"contentFunc"),a=n(()=>i.frame(),"bottomContentFunc")):(i=vd(t),s=n(()=>i.frame(),"contentFunc"),a=n(()=>"","bottomContentFunc")),this.spinnerId=setInterval(()=>this.render(s(),a(),!0),i.interval)}render(t,r,i=!1){this.spinnerId&&!i&&clearInterval(this.spinnerId),this.rl.output.unmute(),this.clean(this.extraLinesUnderPrompt);let s=Sd(t),a=LE(s),c=a;this.rl.line.length&&(c=c.slice(0,-this.rl.line.length)),this.rl.setPrompt(c);let o=this.rl._getCursorPos(),u=this.normalizedCliWidth();t=this.forceLineReturn(t,u),r&&(r=this.forceLineReturn(r,u)),a.length%u===0&&(t+=`
`);let l=t+(r?`
`+r:"");this.rl.output.write(l);let h=Math.floor(a.length/u)-o.rows+(r?bd(r):0);h>0&&tt.up(this.rl,h),tt.left(this.rl,UE(Sd(l))),o.cols>0&&tt.right(this.rl,o.cols),this.extraLinesUnderPrompt=h,this.height=bd(l),this.rl.output.mute()}clean(t){t>0&&tt.down(this.rl,t),tt.clearLine(this.rl,this.height)}done(){this.rl.setPrompt(""),this.rl.output.unmute(),this.rl.output.write(`
`)}releaseCursor(){this.extraLinesUnderPrompt>0&&tt.down(this.rl,this.extraLinesUnderPrompt)}normalizedCliWidth(){return FE({defaultWidth:80,output:this.rl.output})}breakLines(t,r=this.normalizedCliWidth()){return t.map(i=>RE(i,r,{trim:!1,hard:!0}).split(`
`))}forceLineReturn(t,r=this.normalizedCliWidth()){return this.breakLines(t.split(`
`),r).flat().join(`
`)}};wd.exports=Ji});var xd=p((v1,Ad)=>{"use strict";var _d={defaults:Na(),clone:gu()},jt=require("../../commonlibs/chalk/index.js"),Cd=require("../../commonlibs/run-async/index.js"),{filter:Ed,flatMap:kE,share:DE,take:jE,takeUntil:$E}=require("../../commonlibs/rxjs/operators/index.js"),BE=Yi(),GE=Td(),Zi=class{static{n(this,"Prompt")}constructor(t,r,i){Object.assign(this,{answers:i,status:"pending"}),this.opt=_d.defaults(_d.clone(t),{validate:n(()=>!0,"validate"),validatingText:"",filter:n(s=>s,"filter"),filteringText:"",when:n(()=>!0,"when"),suffix:"",prefix:jt.green("?")}),this.opt.name||this.throwParamError("name"),this.opt.message||(this.opt.message=this.opt.name+":"),Array.isArray(this.opt.choices)&&(this.opt.choices=new BE(this.opt.choices,i)),this.rl=r,this.screen=new GE(this.rl)}run(){return new Promise((t,r)=>{this._run(i=>t(i),i=>r(i))})}_run(t){t()}throwParamError(t){throw new Error("You must provide a `"+t+"` parameter")}close(){this.screen.releaseCursor()}handleSubmitEvents(t){let r=this,i=Cd(this.opt.validate),s=Cd(this.opt.filter),a=t.pipe(kE(u=>(this.startSpinner(u,this.opt.filteringText),s(u,r.answers).then(l=>(this.startSpinner(l,this.opt.validatingText),i(l,r.answers).then(d=>({isValid:d,value:l}),d=>({isValid:d,value:l}))),l=>({isValid:l})))),DE()),c=a.pipe(Ed(u=>u.isValid===!0),jE(1)),o=a.pipe(Ed(u=>u.isValid!==!0),$E(c));return{success:c,error:o}}startSpinner(t,r){t=this.getSpinningValue(t);let i=r?this.getQuestion()+t:this.getQuestion().slice(this.opt.prefix.length+1)+t;this.screen.renderWithSpinner(i,r)}getSpinningValue(t){return t}getQuestion(){let t=(this.opt.prefix?this.opt.prefix+" ":"")+jt.bold(this.opt.message)+this.opt.suffix+jt.reset(" ");return this.opt.default!=null&&this.status!=="touched"&&this.status!=="answered"&&(this.opt.type==="password"?t+=jt.italic.dim("[hidden] "):t+=jt.dim("("+this.opt.default+") ")),t}};Ad.exports=Zi});var Nd=p((S1,Pd)=>{"use strict";var{fromEvent:en}=require("../../commonlibs/rxjs/index.js"),{filter:Pe,map:VE,share:rt,takeUntil:HE}=require("../../commonlibs/rxjs/operators/index.js");function WE(e,t){return{value:e,key:t||{}}}n(WE,"normalizeKeypressEvents");Pd.exports=function(e){let t=en(e.input,"keypress",WE).pipe(HE(en(e,"close"))).pipe(Pe(({key:r})=>r.name!=="enter"&&r.name!=="return"));return{line:en(e,"line"),keypress:t,normalizedUpKey:t.pipe(Pe(({key:r})=>r.name==="up"||r.name==="k"||r.name==="p"&&r.ctrl),rt()),normalizedDownKey:t.pipe(Pe(({key:r})=>r.name==="down"||r.name==="j"||r.name==="n"&&r.ctrl),rt()),numberKey:t.pipe(Pe(r=>r.value&&"123456789".indexOf(r.value)>=0),VE(r=>Number(r.value)),rt()),spaceKey:t.pipe(Pe(({key:r})=>r&&r.name==="space"),rt()),aKey:t.pipe(Pe(({key:r})=>r&&r.name==="a"),rt()),iKey:t.pipe(Pe(({key:r})=>r&&r.name==="i"),rt())}}});var Id=p((T1,Od)=>{"use strict";var QE=require("../../commonlibs/chalk/index.js"),tn=class{static{n(this,"Paginator")}constructor(t,r={}){let{isInfinite:i=!0}=r;this.lastIndex=0,this.screen=t,this.isInfinite=i}paginate(t,r,i){i=i||7;let s=t.split(`
`);if(this.screen&&(s=this.screen.breakLines(s),r=s.map(c=>c.length).splice(0,r).reduce((c,o)=>c+o,0),s=s.flat()),s.length<=i)return t;let a=this.isInfinite?this.getInfiniteLines(s,r,i):this.getFiniteLines(s,r,i);return this.lastIndex=r,a.join(`
`)+`
`+QE.dim("(Move up and down to reveal more choices)")}getInfiniteLines(t,r,i){this.pointer===void 0&&(this.pointer=0);let s=Math.floor(i/2);this.pointer<s&&this.lastIndex<r&&r-this.lastIndex<i&&(this.pointer=Math.min(s,this.pointer+r-this.lastIndex));let a=[t,t,t].flat(),c=Math.max(0,r+t.length-this.pointer);return a.splice(c,i)}getFiniteLines(t,r,i){let s=r-i/2;return s<0?s=0:s+i>t.length&&(s=t.length-i),t.splice(s,i)}};Od.exports=tn});var Fd=p((C1,rn)=>{var KE=require("tty"),zE=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||KE.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),U=n((e,t,r=e)=>i=>{let s=""+i,a=s.indexOf(t,e.length);return~a?e+qd(s,t,r,a)+t:e+s+t},"formatter"),qd=n((e,t,r,i)=>{let s=e.substring(0,i)+r,a=e.substring(i+t.length),c=a.indexOf(t);return~c?s+qd(a,t,r,c):s+a},"replaceClose"),Md=n((e=zE)=>({isColorSupported:e,reset:e?t=>`\x1B[0m${t}\x1B[0m`:String,bold:e?U("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:e?U("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:e?U("\x1B[3m","\x1B[23m"):String,underline:e?U("\x1B[4m","\x1B[24m"):String,inverse:e?U("\x1B[7m","\x1B[27m"):String,hidden:e?U("\x1B[8m","\x1B[28m"):String,strikethrough:e?U("\x1B[9m","\x1B[29m"):String,black:e?U("\x1B[30m","\x1B[39m"):String,red:e?U("\x1B[31m","\x1B[39m"):String,green:e?U("\x1B[32m","\x1B[39m"):String,yellow:e?U("\x1B[33m","\x1B[39m"):String,blue:e?U("\x1B[34m","\x1B[39m"):String,magenta:e?U("\x1B[35m","\x1B[39m"):String,cyan:e?U("\x1B[36m","\x1B[39m"):String,white:e?U("\x1B[37m","\x1B[39m"):String,gray:e?U("\x1B[90m","\x1B[39m"):String,bgBlack:e?U("\x1B[40m","\x1B[49m"):String,bgRed:e?U("\x1B[41m","\x1B[49m"):String,bgGreen:e?U("\x1B[42m","\x1B[49m"):String,bgYellow:e?U("\x1B[43m","\x1B[49m"):String,bgBlue:e?U("\x1B[44m","\x1B[49m"):String,bgMagenta:e?U("\x1B[45m","\x1B[49m"):String,bgCyan:e?U("\x1B[46m","\x1B[49m"):String,bgWhite:e?U("\x1B[47m","\x1B[49m"):String}),"createColors");rn.exports=Md();rn.exports.createColors=Md});var kd=p((A1,Ud)=>{"use strict";var Rd=require("../../commonlibs/ansi-escapes/index.js"),YE=require("../../commonlibs/figures/index.js"),XE=xd(),nn=Yi(),JE=Nd(),ZE=Xi(),eA=Id(),it=Fd(),tA=require("../../commonlibs/run-async/index.js"),{takeWhile:Ld}=require("../../commonlibs/rxjs/operators/index.js"),rA=n(e=>e.type!=="separator"&&!e.disabled,"isSelectable"),sn=class extends XE{static{n(this,"AutocompletePrompt")}constructor(t,r,i){super(t,r,i),this.opt.source||this.throwParamError("source"),this.currentChoices=new nn([]),this.firstRender=!0,this.selected=0,this.initialValue=this.opt.default,this.opt.suggestOnly||(this.opt.default=null);let s=this.opt.loop===void 0?!0:this.opt.loop;this.paginator=new eA(this.screen,{isInfinite:s})}_run(t){this.done=t,Array.isArray(this.rl.history)&&(this.rl.history=[]);let r=JE(this.rl),i=n(()=>this.answer===void 0,"dontHaveAnswer");return r.line.pipe(Ld(i)).forEach(this.onSubmit.bind(this)),r.keypress.pipe(Ld(i)).forEach(this.onKeypress.bind(this)),this.search(void 0),this}render(t){let r=this.getQuestion(),i="";if(this.firstRender){let s=this.opt.suggestOnly?", tab to autocomplete":"";r+=it.dim("(Use arrow keys or type to search"+s+")")}if(this.status==="answered")r+=it.cyan(this.shortAnswer||this.answerName||this.answer);else if(this.searching)r+=this.rl.line,i+=" "+it.dim(this.opt.searchText||"Searching...");else if(this.nbChoices){let s=iA(this.currentChoices,this.selected);r+=this.rl.line;let a=this.selected,c=0;this.currentChoices.choices.every((o,u)=>{if(u>a)return!1;let l=o.name;return c+=l?l.split(`
`).length:0,!0}),i+=this.paginator.paginate(s,c,this.opt.pageSize)}else r+=this.rl.line,i+=" "+it.yellow(this.opt.emptyText||"No results...");t&&(i+=`
`+it.red(">> ")+t),this.firstRender=!1,this.screen.render(r,i)}onSubmit(t){let r=t||this.rl.line;if(this.opt.suggestOnly&&!r&&(r=this.opt.default===null?"":this.opt.default),typeof this.opt.validate=="function"){let i=n(a=>{a!==!0?this.render(a||"Enter something, tab to autocomplete!"):this.onSubmitAfterValidation(r)},"checkValidationResult"),s;if(this.opt.suggestOnly)s=this.opt.validate(r,this.answers);else{let a=this.currentChoices.getChoice(this.selected);s=this.opt.validate(a,this.answers)}nA(s)?s.then(i):i(s)}else this.onSubmitAfterValidation(r)}onSubmitAfterValidation(t){let r={};if(this.nbChoices<=this.selected&&!this.opt.suggestOnly){this.rl.write(t),this.search(t);return}if(this.opt.suggestOnly)r.value=t||this.rl.line,this.answer=t||this.rl.line,this.answerName=t||this.rl.line,this.shortAnswer=t||this.rl.line,this.rl.line="";else if(this.nbChoices)r=this.currentChoices.getChoice(this.selected),this.answer=r.value,this.answerName=r.name,this.shortAnswer=r.short;else{this.rl.write(t),this.search(t);return}tA(this.opt.filter,(i,s)=>{r.value=s,this.answer=s,this.opt.suggestOnly&&(this.shortAnswer=s),this.status="answered",this.render(),this.screen.done(),this.done(r.value)})(r.value)}search(t){this.selected=0,this.searchedOnce?(this.searching=!0,this.currentChoices=new nn([]),this.render()):this.searchedOnce=!0,this.lastSearchTerm=t;let r;try{let i=this.opt.source(this.answers,t);r=Promise.resolve(i)}catch(i){r=Promise.reject(i)}return this.lastPromise=r,r.then(i=>{if(r!==this.lastPromise)return;this.currentChoices=new nn(i);let s=i.filter(c=>rA(c));this.nbChoices=s.length;let a=s.findIndex(c=>c===this.initialValue||c.value===this.initialValue);a>=0&&(this.selected=a),this.searching=!1,this.render()})}ensureSelectedInRange(){let t=Math.min(this.selected,this.nbChoices);this.selected=Math.max(t,0)}onKeypress(t){let r,i=t.key&&t.key.name||void 0;if(i==="tab"&&this.opt.suggestOnly){if(this.currentChoices.getChoice(this.selected)){this.rl.write(Rd.cursorLeft);let s=this.currentChoices.getChoice(this.selected).value;this.rl.write(Rd.cursorForward(s.length)),this.rl.line=s,this.render()}}else i==="down"||i==="n"&&t.key.ctrl?(r=this.nbChoices,this.selected=this.selected<r-1?this.selected+1:0,this.ensureSelectedInRange(),this.render(),ZE.up(this.rl,2)):i==="up"||i==="p"&&t.key.ctrl?(r=this.nbChoices,this.selected=this.selected>0?this.selected-1:r-1,this.ensureSelectedInRange(),this.render()):(this.render(),this.lastSearchTerm!==this.rl.line&&this.search(this.rl.line))}};function iA(e,t){let r="",i=0;return e.forEach((s,a)=>{if(s.type==="separator"){i++,r+=" "+s+`
`;return}if(s.disabled){i++,r+=" - "+s.name,r+=" ("+(typeof s.disabled=="string"?s.disabled:"Disabled")+")",r+=`
`;return}let c=a-i===t,o=(c?YE.pointer+" ":" ")+s.name;c&&(o=it.cyan(o)),r+=o+`
`}),r.replace(/\n$/,"")}n(iA,"listRender");function nA(e){return typeof e=="object"&&typeof e.then=="function"}n(nA,"isPromise");Ud.exports=sn});var Kt=p(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.assembleBuildConfig=cx;Qt.getGlobalConfig=ax;Qt.setGlobalConfig=ox;function Sf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}n(Sf,"ownKeys");function qr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sf(Object(r),!0).forEach(function(i){ix(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sf(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}n(qr,"_objectSpread");function ix(e,t,r){return t=nx(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}n(ix,"_defineProperty");function nx(e){var t=sx(e,"string");return typeof t=="symbol"?t:String(t)}n(nx,"_toPropertyKey");function sx(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}n(sx,"_toPrimitive");var Mr={method:!0,url:!0,params:!1,data:!0,status:!0,statusText:!0,logger:console.log,prefixText:"Axios",dateFormat:!1,headers:!1};function ax(){return Mr}n(ax,"getGlobalConfig");function ox(e){Mr=qr(qr({},Mr),e)}n(ox,"setGlobalConfig");function cx(e){return qr(qr({},Mr),e)}n(cx,"assembleBuildConfig")});var Tf=p((Tn,wf)=>{(function(e){"use strict";var t=(function(){var c=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|"[^"]*"|'[^']*'/g,o=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,u=/[^-+\dA-Z]/g;return function(l,d,h,m){if(arguments.length===1&&a(l)==="string"&&!/\d/.test(l)&&(d=l,l=void 0),l=l||new Date,l instanceof Date||(l=new Date(l)),isNaN(l))throw TypeError("Invalid date");d=String(t.masks[d]||d||t.masks.default);var S=d.slice(0,4);(S==="UTC:"||S==="GMT:")&&(d=d.slice(4),h=!0,S==="GMT:"&&(m=!0));var E=h?"getUTC":"get",w=l[E+"Date"](),C=l[E+"Day"](),x=l[E+"Month"](),L=l[E+"FullYear"](),H=l[E+"Hours"](),ce=l[E+"Minutes"](),te=l[E+"Seconds"](),$=l[E+"Milliseconds"](),Ae=h?0:l.getTimezoneOffset(),_t=i(l),Ah=s(l),rs={d:w,dd:r(w),ddd:t.i18n.dayNames[C],dddd:t.i18n.dayNames[C+7],m:x+1,mm:r(x+1),mmm:t.i18n.monthNames[x],mmmm:t.i18n.monthNames[x+12],yy:String(L).slice(2),yyyy:L,h:H%12||12,hh:r(H%12||12),H,HH:r(H),M:ce,MM:r(ce),s:te,ss:r(te),l:r($,3),L:r(Math.round($/10)),t:H<12?t.i18n.timeNames[0]:t.i18n.timeNames[1],tt:H<12?t.i18n.timeNames[2]:t.i18n.timeNames[3],T:H<12?t.i18n.timeNames[4]:t.i18n.timeNames[5],TT:H<12?t.i18n.timeNames[6]:t.i18n.timeNames[7],Z:m?"GMT":h?"UTC":(String(l).match(o)||[""]).pop().replace(u,""),o:(Ae>0?"-":"+")+r(Math.floor(Math.abs(Ae)/60)*100+Math.abs(Ae)%60,4),S:["th","st","nd","rd"][w%10>3?0:(w%100-w%10!=10)*w%10],W:_t,N:Ah};return d.replace(c,function(or){return or in rs?rs[or]:or.slice(1,or.length-1)})}})();t.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},t.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]};function r(c,o){for(c=String(c),o=o||2;c.length<o;)c="0"+c;return c}n(r,"pad");function i(c){var o=new Date(c.getFullYear(),c.getMonth(),c.getDate());o.setDate(o.getDate()-(o.getDay()+6)%7+3);var u=new Date(o.getFullYear(),0,4);u.setDate(u.getDate()-(u.getDay()+6)%7+3);var l=o.getTimezoneOffset()-u.getTimezoneOffset();o.setHours(o.getHours()-l);var d=(o-u)/(864e5*7);return 1+Math.floor(d)}n(i,"getWeek");function s(c){var o=c.getDay();return o===0&&(o=7),o}n(s,"getDayOfWeek");function a(c){return c===null?"null":c===void 0?"undefined":typeof c!="object"?typeof c:Array.isArray(c)?"array":{}.toString.call(c).slice(8,-1).toLowerCase()}n(a,"kindOf"),typeof define=="function"&&define.amd?define(function(){return t}):typeof Tn=="object"?wf.exports=t:e.dateFormat=t})(Tn)});var _f=p(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.join=ux;function ux(...e){return e.map((t,r)=>(r>0&&(t=t.replace(/^\//,"")),r<e.length-1&&(t=t.replace(/\/$/,"")),t)).join("/").replace(/\/+/g,"/")}n(ux,"join")});var Rr=p(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.default=void 0;var lx=Ef(Tf()),Cf=Ef(require("../../commonlibs/chalk/index.js")),dx=_f();function Ef(e){return e&&e.__esModule?e:{default:e}}n(Ef,"_interopRequireDefault");function Cn(e,t,r){return t=fx(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}n(Cn,"_defineProperty");function fx(e){var t=px(e,"string");return typeof t=="symbol"?t:String(t)}n(fx,"_toPropertyKey");function px(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}n(px,"_toPrimitive");var En=class{static{n(this,"StringBuilder")}constructor(t){Cn(this,"config",void 0),Cn(this,"printQueue",void 0),Cn(this,"filteredHeaderList",void 0),this.config=t,this.printQueue=[],this.filteredHeaderList=["common","delete","get","head","post","put","patch","content-type","content-length","vary","date","connection","content-security-policy"]}makeLogTypeWithPrefix(t){let r=this.config.prefixText===!1?`[${t}]`:`[${this.config.prefixText||"Axios"}][${t}]`;return this.printQueue.push(Cf.default.green(r)),this}makeDateFormat(t){if(this.config.dateFormat!==!1){let r=(0,lx.default)(t,this.config.dateFormat||"isoDateTime");this.printQueue.push(r)}return this}makeHeader(t){if(this.config.headers&&t){let r={};for(let i in t)this.filteredHeaderList.includes(i)||(r[i]=t[i]);this.printQueue.push(JSON.stringify(r))}return this}makeUrl(t,r){return this.config.url&&t&&(r&&(t=this.combineURLs(r,t)),this.printQueue.push(t)),this}makeParams(t){return this.config.params&&t&&this.printQueue.push(JSON.stringify(t)),this}makeMethod(t){return this.config.method&&t&&this.printQueue.push(Cf.default.yellow(t.toUpperCase())),this}makeData(t){if(this.config.data&&t){let r=typeof t=="string"?t:JSON.stringify(t);this.printQueue.push(r)}return this}makeStatus(t,r){return this.config.status&&this.config.statusText&&t&&r?this.printQueue.push(`${t}:${r}`):this.config.status&&t?this.printQueue.push(`${t}`):this.config.statusText&&r&&this.printQueue.push(r),this}build(){return this.printQueue.join(" ")}combineURLs(t,r){let i=n(u=>{try{return new URL(u)}catch{return null}},"checkURLContainHost");if(!(r&&r!==""))return t;if(!!(r&&i(r)))return r;let c=t!==""?new URL(t):null;return!!(c&&c.pathname!=="")&&c?new URL((0,dx.join)(c.pathname,r),t).toString():new URL(r,t).toString()}},hx=En;Fr.default=hx});var Af=p(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.default=void 0;var mx=Kt(),gx=yx(Rr());function yx(e){return e&&e.__esModule?e:{default:e}}n(yx,"_interopRequireDefault");function vx(e,t={}){let{baseURL:r,url:i,params:s,method:a,data:c,headers:o}=e,u=(0,mx.assembleBuildConfig)(t),d=new gx.default(u).makeLogTypeWithPrefix("Request").makeDateFormat(new Date).makeMethod(a).makeUrl(i,r).makeParams(s).makeHeader(o).makeData(c).build();return u.logger(d),e}n(vx,"requestLogger");var bx=vx;Lr.default=bx});var xf=p(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.default=void 0;var Sx=Kt(),wx=Tx(Rr());function Tx(e){return e&&e.__esModule?e:{default:e}}n(Tx,"_interopRequireDefault");function _x(e,t={}){let{config:{baseURL:r,url:i,method:s,params:a},status:c,statusText:o,data:u,headers:l}=e,d=(0,Sx.assembleBuildConfig)(t),m=new wx.default(d).makeLogTypeWithPrefix("Response").makeDateFormat(new Date).makeMethod(s).makeUrl(i,r).makeParams(a).makeStatus(c,o).makeHeader(l).makeData(u).build();return d.logger(m),e}n(_x,"responseLogger");var Cx=_x;Ur.default=Cx});var Nf=p(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.errorLogger=Px;kr.errorLoggerWithoutPromise=Pf;var Ex=Kt(),Ax=xx(Rr());function xx(e){return e&&e.__esModule?e:{default:e}}n(xx,"_interopRequireDefault");function Pf(e,t={}){if(!e.config)return e;let{config:{method:r,baseURL:i,params:s,url:a},response:c}=e,o,u,l,d;c&&(o=c.status,u=c.statusText,l=c.data,d=c.headers);let h=(0,Ex.assembleBuildConfig)(t),S=new Ax.default(h).makeLogTypeWithPrefix("Error").makeDateFormat(new Date).makeMethod(r).makeUrl(a,i).makeParams(s).makeStatus(o,u).makeHeader(d).makeData(l).build();return h.logger(S),e}n(Pf,"errorLoggerWithoutPromise");function Px(e,t){return Promise.reject(Pf(e,t))}n(Px,"errorLogger")});var If=p(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});Object.defineProperty(lt,"errorLogger",{enumerable:!0,get:n(function(){return qx.errorLogger},"get")});Object.defineProperty(lt,"requestLogger",{enumerable:!0,get:n(function(){return Ox.default},"get")});Object.defineProperty(lt,"responseLogger",{enumerable:!0,get:n(function(){return Ix.default},"get")});Object.defineProperty(lt,"setGlobalConfig",{enumerable:!0,get:n(function(){return Nx.setGlobalConfig},"get")});var Nx=Kt(),Ox=Of(Af()),Ix=Of(xf()),qx=Nf();function Of(e){return e&&e.__esModule?e:{default:e}}n(Of,"_interopRequireDefault")});var Ff=p(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.removeSync=dt.remove=void 0;function Mx(e,t){return e===void 0?Promise.resolve(void 0):e===null?Promise.resolve(null):new Promise(r=>{setTimeout(()=>{r(Mf(e,t))},0)})}n(Mx,"remove");dt.remove=Mx;function Fx(e,t){if(e!==void 0)return e===null?null:Mf(e,t)}n(Fx,"removeSync");dt.removeSync=Fx;function Mf(e,t){let r=new WeakRef(t&&t.setUndefined?{value:void 0}:{value:null});function i(s,a,c){for(let o in a){let u=a[o];if(typeof u!="object"){s[o]=u;continue}else{let l=!1;for(let d of c)if(d===u){s[o]=r.deref().value,l=!0;break}if(!l)if(u instanceof Map){let d=Array.from(u);s[o]=d,i(d,d,[...c,d])}else s[o]=Object.assign({},u),i(s[o],u,[...c,u])}}return s}return n(i,"internalRemover"),i({},e,[e])}n(Mf,"referenceRemover")});var Lf=p(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.removeSync=ft.remove=void 0;var Rf=Ff();Object.defineProperty(ft,"remove",{enumerable:!0,get:n(function(){return Rf.remove},"get")});Object.defineProperty(ft,"removeSync",{enumerable:!0,get:n(function(){return Rf.removeSync},"get")})});var mt=p(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.eServiceTypes=R.eOrderDirection=R.eOperation=R.eFilters=R.CF_CMD_EXIT_CODE=R.DEFAULT_TARGET=R.CF_PAGE_SIZE=R.NEW_LINE=R.OK=void 0;R.OK="OK";R.NEW_LINE=`
`;R.CF_PAGE_SIZE=297;R.DEFAULT_TARGET="Default (no targets)";var kx;(function(e){e[e.OK=0]="OK",e[e.ERROR=-1]="ERROR",e[e.CANCEL_REQ=-2]="CANCEL_REQ",e[e.CANCELED=-3]="CANCELED"})(kx=R.CF_CMD_EXIT_CODE||(R.CF_CMD_EXIT_CODE={}));var Dx;(function(e){e.type="type",e.names="names",e.guids="guids",e.app_guids="app_guids",e.app_names="app_names",e.space_guids="space_guids",e.available="available",e.broker_catalog_ids="broker_catalog_ids",e.service_broker_guids="service_broker_guids",e.service_broker_names="service_broker_names",e.service_plan_guids="service_plan_guids",e.organization_guids="organization_guids",e.service_plan_names="service_plan_names",e.service_plan="service_plan",e.service_instance_guids="service_instance_guids",e.service_instance_names="service_instance_names",e.service_offering_guids="service_offering_guids",e.service_offering_names="service_offering_names",e.label_selector="label_selector",e.page="page",e.per_page="per_page",e.oder_by="order_by",e.created_ats="created_ats",e.updated_ats="updated_ats",e.status="status",e.include="include"})(Dx=R.eFilters||(R.eFilters={}));var jx;(function(e){e.gte="gte",e.lte="lte",e.lt="lt",e.gt="gt",e.not="not",e.fields="fields"})(jx=R.eOperation||(R.eOperation={}));var $x;(function(e){e[e.asc=0]="asc",e[e.desc=1]="desc"})($x=R.eOrderDirection||(R.eOrderDirection={}));var Bx;(function(e){e.managed="managed",e.user_provided="user-provided"})(Bx=R.eServiceTypes||(R.eServiceTypes={}))});var Hr=p(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.Cli=void 0;var Gx=require("child_process"),up=require("../../commonlibs/comment-json/index.js"),gt=require("../../commonlibs/lodash/index.js"),Me=mt(),Xt=class e{static{n(this,"Cli")}static execute(t,r,i){return i=i||{isCancellationRequested:!1,onCancellationRequested:n(()=>{},"onCancellationRequested")},e.updateSpawnOptions(r),new Promise(s=>{let a="",c="";if(i.isCancellationRequested){e.cliResultOnExit(c,s,a,Me.CF_CMD_EXIT_CODE.CANCEL_REQ);return}let o=(0,Gx.spawn)(e.CF_CMD,t,r);o.stdin.end(),o.stdout.on("data",u=>{c=c.concat(u)}),o.stderr.on("data",u=>{a=a.concat(u)}),o.on("exit",u=>{e.cliResultOnExit(c,s,a,u)}),o.on("error",u=>{let l=gt.get(u,"code")==="ENOENT"?`${e.CF_CMD}: command not found`:gt.get(u,"message");s({stdout:c,stderr:a,error:l,exitCode:Me.CF_CMD_EXIT_CODE.ERROR})}),i.onCancellationRequested(()=>{o.kill(),e.cliResultOnExit("",s,"",Me.CF_CMD_EXIT_CODE.CANCELED)})})}static cliResultOnExit(t,r,i,s){if(t){if(t.indexOf("error_code")>0)try{let a=(0,up.parse)(t),c=gt.get(a,"code")===10002?e.CF_LOGIN_ERROR:gt.get(a,"description","Internal error occured");r({stdout:t,stderr:i,exitCode:Me.CF_CMD_EXIT_CODE.ERROR,error:c});return}catch{}else if(t.startsWith("FAILED")&&t.indexOf("Error creating request")>0){r({stdout:t,stderr:i,error:e.CF_LOGIN_ERROR,exitCode:Me.CF_CMD_EXIT_CODE.ERROR});return}else if(/failed.*\bError\b:/g.test(t))try{(0,up.parse)(t)}catch{r({stdout:t,stderr:i,error:t,exitCode:Me.CF_CMD_EXIT_CODE.ERROR});return}else if(t.startsWith("FAILED")&&t.indexOf("No API endpoint set")>0){r({stdout:t,stderr:i,error:t,exitCode:Me.CF_CMD_EXIT_CODE.ERROR});return}}r({stdout:t,stderr:i,exitCode:s})}static updateSpawnOptions(t){t&&(t.env=Object.assign(Object.assign(Object.assign({},process.env),{NODE_VERSION:process.versions.node}),t.env),gt.defaults(t,{cwd:gt.get(t,"cmd",__dirname)}))}};Vr.Cli=Xt;Xt.CF_LOGIN_ERROR="Not logged in. Use 'cf login' to log in.";Xt.CF_CMD="cf"});var Qr=p(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.messages=void 0;Wr.messages={space_not_set:"The selected action failed because there is no Cloud Foundry space assigned.",service_creation_started:"Service instance creation started, waiting for 'Ready' state...",create_service_canceled_by_requester:"The service instance creation was cancelled by the requester. The service may have been partially created, consider deleting it using the 'cf delete-service' command.",cf_setting_not_set:"Could not find the Cloud Foundry settings. Make sure you have assigned an org and space in Cloud Foundry.",no_valid_filters:"Could not find any valid filters.",failed_creating_entity:n((e,t)=>`Could not create the entity since ${e}, consider deleting it using the 'cf delete-service ${t} command'.`,"failed_creating_entity"),exceed_number_of_attempts:n(e=>`Could not verify the service instance creation. Check its status using the 'cf service ${e}' command.`,"exceed_number_of_attempts"),service_not_found:n(e=>`Could not find the '${e}' service instance.`,"service_not_found"),service_creation_failed:n(e=>`Service instance creation failed: ${e}`,"service_creation_failed"),not_allowed_filter:n((e,t)=>`The '${e}' parameter is not allowed in the '${t}' query.`,"not_allowed_filter")}});var qn=p(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.parseRawDictData=I.padQuerySpace=I.getSpaceGuidThrowIfUndefined=I.cfGetConfigFileField=I.cfGetConfigFileJson=I.isUpsType=I.cfGetConfigFilePath=I.getTags=I.getOrgGUID=I.getSpaceFieldGUID=I.getDescription=I.getLabel=I.getName=I.getGuid=I.padQuery=I.ensureQuery=I.dataContentAsObject=void 0;var O=require("../../commonlibs/lodash/index.js"),lp=require("os"),dp=require("fs"),Vx=require("path"),Hx=require("../../commonlibs/comment-json/index.js"),Wx=Qr(),Jt=mt();async function Qx(e){try{return O.reduce(O.split(await dp.promises.readFile(e,{encoding:"utf8"}),lp.EOL),(t,r)=>{let i=O.split(r,"=");return O.size(i)>1&&(t[O.trim(i[0])]=O.trim(i[1])),t},{})}catch{return{}}}n(Qx,"dataContentAsObject");I.dataContentAsObject=Qx;function fp(e){return e=e||{},O.defaults(e,{filters:[]}),O.defaults(e,{per_page:Jt.CF_PAGE_SIZE}),e}n(fp,"ensureQuery");I.ensureQuery=fp;function pp(e,t){return e=fp(e),O.each(t,r=>{let i=O.find(e.filters,["key",r.key]);O.size(i?.value)||(e.filters=O.concat(e.filters,[r]))}),e}n(pp,"padQuery");I.padQuery=pp;function Kx(e){return O.get(e,"guid","")}n(Kx,"getGuid");I.getGuid=Kx;function zx(e){return O.get(e,"name","")}n(zx,"getName");I.getName=zx;function Yx(e){return O.get(e,"label","")}n(Yx,"getLabel");I.getLabel=Yx;function Xx(e){return O.get(e,"description","")}n(Xx,"getDescription");I.getDescription=Xx;function hp(e){return O.get(e,"GUID","")}n(hp,"getSpaceFieldGUID");I.getSpaceFieldGUID=hp;function Jx(e){return O.get(e,["relationships","organization","data","guid"],"")}n(Jx,"getOrgGUID");I.getOrgGUID=Jx;function Zx(e){return O.get(e,"tags",[])}n(Zx,"getTags");I.getTags=Zx;function mp(e){let t=e?["targets",`${e}.config.json`]:["config.json"];return Vx.join(O.get(process,"env.CF_HOME",lp.homedir()),".cf",...t)}n(mp,"cfGetConfigFilePath");I.cfGetConfigFilePath=mp;function eP(e){return O.get(e,"type",Jt.eServiceTypes.managed)===Jt.eServiceTypes.user_provided}n(eP,"isUpsType");I.isUpsType=eP;async function gp(e){try{return(0,Hx.parse)(await dp.promises.readFile(mp(e),{encoding:"utf8"}))}catch{}}n(gp,"cfGetConfigFileJson");I.cfGetConfigFileJson=gp;async function yp(e,t){return O.get(await gp(t),`${e}`)}n(yp,"cfGetConfigFileField");I.cfGetConfigFileField=yp;async function vp(){let e=hp(await yp("SpaceFields"));if(!e)throw new Error(Wx.messages.cf_setting_not_set);return e}n(vp,"getSpaceGuidThrowIfUndefined");I.getSpaceGuidThrowIfUndefined=vp;async function tP(e,t){e=pp(e,t);let r=O.find(e.filters,["key",Jt.eFilters.space_guids]);return O.size(r?.value)||(e.filters=O.concat(e.filters,[{key:Jt.eFilters.space_guids,value:await vp()}])),e}n(tP,"padQuerySpace");I.padQuerySpace=tP;function rP(e){let t={};return O.each(O.compact(O.split(e,`
`)),r=>{r=O.replace(O.trim(r),/^['"]|['"]$/g,"");let i=O.indexOf(r,":");if(i>-1){let s=O.toLower(O.trim(O.join(O.slice(r,0,i),""))),a=O.trim(O.join(O.slice(r,i+1),""));t[`${s}`]=a}}),t}n(rP,"parseRawDictData");I.parseRawDictData=rP});var Ln=p(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.cfApi=T.cfGetApps=T.cfGetServiceInstancesList=T.cfGetInstanceKeyParameters=T.cfGetInstanceCredentials=T.cfGetServiceKeys=T.cfLogout=T.cfGetServicePlans=T.cfGetTarget=T.cfGetAuthToken=T.cfGetInstanceMetadata=T.cfBindLocalUps=T.cfBindLocalServices=T.cfGetSpaceServices=T.cfGetServices=T.cfGetTargets=T.cfSetOrgSpace=T.cfGetManagedServiceInstances=T.cfGetServiceInstances=T.cfGetServicePlansList=T.cfGetAvailableSpaces=T.cfGetAvailableOrgs=T.cfLogin=T.cfCreateUpsInstance=T.cfCreateService=T.cfGetUpsInstances=T.clearCacheServiceInstances=T.resolveEndpoint=void 0;var Fe=require("../../commonlibs/comment-json/index.js"),g=require("../../commonlibs/lodash/index.js"),Sp=Hr(),ue=Qr(),b=mt(),_=qn(),iP=require("url"),Re=[b.eFilters.page,b.eFilters.per_page,b.eFilters.oder_by,b.eFilters.label_selector,b.eFilters.created_ats,b.eFilters.updated_ats],Yr={name:"service_instances",params:g.uniq(g.concat(Re,[b.eFilters.names,b.eFilters.type,b.eFilters.space_guids,b.eFilters.organization_guids,b.eFilters.service_plan_guids,b.eFilters.service_plan,b.eFilters.service_plan_names]))},nP={name:"organizations",params:g.uniq(g.concat(Re,[b.eFilters.names,b.eFilters.guids]))},sP={name:"spaces",params:g.uniq(g.concat(Re,[b.eFilters.names,b.eFilters.guids,b.eFilters.organization_guids,b.eFilters.include]))},aP={name:"service_plan",params:g.uniq(g.concat(Re,[b.eFilters.names,b.eFilters.guids,b.eFilters.available,b.eFilters.broker_catalog_ids,b.eFilters.space_guids,b.eFilters.organization_guids,b.eFilters.service_broker_guids,b.eFilters.service_broker_names,b.eFilters.service_offering_guids,b.eFilters.service_offering_names,b.eFilters.service_instance_guids,b.eFilters.include]))},oP={name:"service_offerings",params:g.uniq(g.concat(Re,[b.eFilters.names,b.eFilters.available,b.eFilters.service_broker_guids,b.eFilters.service_broker_names,b.eFilters.space_guids,b.eFilters.organization_guids]))},cP={name:"service_credential_bindings",params:g.uniq(g.concat(Re,[b.eFilters.names,b.eFilters.guids,b.eFilters.include,b.eFilters.service_instance_guids,b.eFilters.broker_catalog_ids,b.eFilters.space_guids,b.eFilters.service_instance_names,b.eFilters.app_guids,b.eFilters.app_names,b.eFilters.service_plan_names,b.eFilters.service_offering_guids,b.eFilters.service_offering_names,b.eFilters.type]))},uP={name:"apps",params:g.uniq(g.concat(Re,[b.eFilters.names,b.eFilters.space_guids,b.eFilters.organization_guids,b.eFilters.guids,b.eFilters.include]))};function wp(e){if(g.size(g.get(e,"errors")))throw new Error(`${g.get(e,["errors","0","detail"])} [code: ${g.get(e,["errors","0","code"])} title: ${g.get(e,["errors","0","title"])}]`);return e}n(wp,"evaluateResponse");async function Tp(e){try{return/http/.test(new iP.URL(e).protocol)?g.replace(e,(await Np(!0))["api endpoint"],""):e}catch{return e}}n(Tp,"resolveEndpoint");T.resolveEndpoint=Tp;var Kr={};function _p(){Kr={}}n(_p,"clearCacheServiceInstances");T.clearCacheServiceInstances=_p;function le(e,t){g.each(e?.filters,r=>{if(!t.params.includes(r.key))throw new Error(ue.messages.not_allowed_filter(r.key,t.name))})}n(le,"evaluateQueryFilters");var bp="in progress",lP="failed";function de(e){e=(0,_.ensureQuery)(e);function t(s){let a=g.get(s,"value");if(a)return s.op===b.eOperation.fields?`${s.op}[${s.key}]=${a}`:`${s.key}`+(s.op?`[${s.op}]`:"")+`=${a}`}n(t,"_generate_statement");function r(s){return g.compact(g.values(g.map(s,t)))}n(r,"_queryFilters");function i(s){return g.compact(g.map(g.keys(s),a=>{let c=g.get(s,a);if(c)return`${a}=${c}`}))}return n(i,"_queryParams"),g.compact(g.concat(r(e.filters).join("&"),i(g.omit(e,"filters")))).join("&")}n(de,"composeQuery");function Cp(e,t,r,i,s,a,c){if(g.size(g.get(r,"errors"))){t(new Error(ue.messages.service_creation_failed(g.get(r,["errors","0","detail"]))));return}if(i<s){if(c.cancelToken.isCancellationRequested){t(new Error(ue.messages.create_service_canceled_by_requester));return}let o=g.get(r,"last_operation.state",bp);o===bp?(c.progress.report({message:`
${ue.messages.service_creation_started}`,increment:Math.floor(1/s*100)}),setTimeout(()=>{a().then(u=>{Cp(e,t,u,i+1,s,a,c)}).catch(u=>{t(u)})},2e3)):o===lP?t(new Error(ue.messages.failed_creating_entity(g.get(r,"last_operation.description"),(0,_.getName)(r)))):(c.progress.report({message:`
${ue.messages.service_creation_started}`,increment:100}),e(r))}else t(new Error(ue.messages.exceed_number_of_attempts((0,_.getName)(r))))}n(Cp,"waitForEntity");async function V(e,t,r){let i=await Sp.Cli.execute(e.query,e.options,e.token);if(i.exitCode!==0)throw new Error(r?i.stdout||i.stderr||i.error:i.error||i.stderr||i.stdout);return t?await t(wp((0,Fe.parse)(i.stdout))):i.stdout||i.stderr}n(V,"execQuery");async function oe(e,t){let r=[],i=e.query;for(;i;){let s=(0,Fe.parse)(await V({query:["curl",await Tp(i)],options:e.options,token:e.token}));for(let a of g.get(s,"resources",[]))r.push(t?await t(a,g.get(s,"included")):a);i=g.get(s,["pagination","next","href"])}return g.compact(r)}n(oe,"execTotal");async function Ep(e,t){le(e,Yr),e=await(0,_.padQuerySpace)(e,[{key:b.eFilters.type,value:b.eServiceTypes.managed}]);let r=await oe({query:`/v3/service_instances?${de(e)}`,token:t});if(g.size(r)>=1)return g.head(r);throw new Error(ue.messages.service_not_found(decodeURIComponent(g.get(g.find(e.filters,["key",b.eFilters.names]),"value"))||"unknown"))}n(Ep,"getServiceInstance");async function dP(e,t){return V({query:["curl",`/v3/service_instances/${e}/credentials`],token:t},r=>r)}n(dP,"getUpsCredentials");function fP(e,t){return g.merge({name:(0,_.getName)(e),guid:(0,_.getGuid)(e),description:(0,_.getDescription)(e)},t?{service_offering:{guid:(0,_.getGuid)(t),description:(0,_.getDescription)(t),name:(0,_.getName)(t)}}:{})}n(fP,"resolveCfResource");function pP(e){return Kr[e.guid]||(Kr[e.guid]=V({query:["curl",`/v3/service_plans/${e.guid}?include=service_offering`]},t=>Promise.resolve(fP(t,g.find(g.get(t,["included","service_offerings"]),["guid",g.get(t,["relationships","service_offering","data","guid"])]))))),Kr[e.guid]}n(pP,"getCachedServicePlan");function Mn(e){let t=g.get(e,["relationships","service_plan","data","guid"]);return Promise.resolve({guid:(0,_.getGuid)(e),label:(0,_.getName)(e),tags:(0,_.getTags)(e),serviceName:(0,_.isUpsType)(e)?Promise.resolve({service_offering:{name:b.eServiceTypes.user_provided},name:""}):pP({guid:t}).then(r=>r).catch(()=>({})),plan_guid:t,credentials:(0,_.isUpsType)(e)?dP((0,_.getGuid)(e)).then(r=>r).catch(()=>({})):Promise.resolve()})}n(Mn,"getServiceInstanceItem");async function Fn(e){let t=g.concat(g.map(e,"serviceName"),g.map(e,"credentials"));return g.size(t)?Promise.all(t).then(async()=>{let r=[];for(let i of e){let s=await g.get(i,"serviceName");r.push({guid:(0,_.getGuid)(i),label:(0,_.getLabel)(i),serviceName:g.get(s,["service_offering","name"],"unknown"),plan_guid:g.get(i,"plan_guid"),plan:g.get(s,"name","unknown"),tags:g.get(i,"tags"),credentials:await i.credentials})}return g.compact(r)}):[]}n(Fn,"resolveServiceInstances");async function hP(e,t){return le(e,Yr),e=await(0,_.padQuerySpace)(e,[{key:b.eFilters.type,value:b.eServiceTypes.user_provided}]),Fn(await oe({query:`/v3/service_instances?${de(e)}`,token:t},async r=>Mn(r)))}n(hP,"cfGetUpsInstances");T.cfGetUpsInstances=hP;async function mP(e,t,r,i,s,a){let c=await(0,_.getSpaceGuidThrowIfUndefined)();a=g.isNil(a)?45:a,s=g.defaults(s,{progress:{report:n(()=>"","report")}},{cancelToken:{isCancellationRequested:!1,onCancellationRequested:n(()=>"","onCancellationRequested")}});let o={type:b.eServiceTypes.managed,name:t,relationships:{space:{data:{guid:c}},service_plan:{data:{guid:e}}},parameters:r,tags:i},u=await V({query:["curl","/v3/service_instances","-d",(0,Fe.stringify)(o),"-X","POST"],token:s.cancelToken});s.progress.report({message:`
${ue.messages.service_creation_started}`,increment:1});let l={filters:[{key:b.eFilters.names,value:encodeURIComponent(t)},{key:b.eFilters.space_guids,value:c}]};return new Promise((d,h)=>{Cp(d,h,g.isEmpty(g.replace(u,`
`,""))?u:(0,Fe.parse)(u),0,a,()=>Ep(l,s.cancelToken),s)})}n(mP,"cfCreateService");T.cfCreateService=mP;async function gP(e){let t=e.space_guid;return t||(t=await(0,_.getSpaceGuidThrowIfUndefined)()),wp((0,Fe.parse)(await V({query:["curl","/v3/service_instances","-d",(0,Fe.stringify)(g.merge({name:e.instanceName,type:b.eServiceTypes.user_provided,relationships:{space:{data:{guid:t}}}},e.credentials?{credentials:e.credentials}:{},e.route_service_url?{route_service_url:e.route_service_url}:{},e.syslog_drain_url?{syslog_drain_url:e.syslog_drain_url}:{},e.tags?{tags:e.tags}:{})),"-X","POST"]})))}n(gP,"cfCreateUpsInstance");T.cfCreateUpsInstance=gP;async function yP(e){let t;try{let r=["login","-a"];r="ssoPasscode"in e?g.concat(r,[e.endpoint,"--sso-passcode",e.ssoPasscode,"-o","no-org-for-now","-s","no-space-for-now"]):g.concat(r,[e.endpoint,"-u",e.user,"-p",e.password,"-o","no-org-for-now","-s","no-space-for-now"]),r=g.concat(r,e.origin?["--origin",e.origin]:[]),t=await V({query:r,options:{env:{CF_COLOR:"false"}}},void 0,!0)}catch(r){t=g.get(r,"message","")}return t.includes(`Authenticating...${b.NEW_LINE}${b.OK}`)?b.OK:t}n(yP,"cfLogin");T.cfLogin=yP;async function vP(e){return le(e,nP),oe({query:`/v3/organizations?${de(e)}`},r=>Promise.resolve({label:(0,_.getName)(r),guid:(0,_.getGuid)(r)}))}n(vP,"cfGetAvailableOrgs");T.cfGetAvailableOrgs=vP;async function bP(e){let t=(0,_.ensureQuery)();return e&&g.merge(t.filters,[{key:b.eFilters.organization_guids,value:e}]),le(t,sP),oe({query:`/v3/spaces?${de(t)}`},i=>Promise.resolve({label:(0,_.getName)(i),guid:(0,_.getGuid)(i),orgGUID:(0,_.getOrgGUID)(i)}))}n(bP,"cfGetAvailableSpaces");T.cfGetAvailableSpaces=bP;function SP(e,t){return g.merge({label:(0,_.getName)(e),guid:(0,_.getGuid)(e),description:(0,_.getDescription)(e)},t?{service_offering:{guid:(0,_.getGuid)(t),description:(0,_.getDescription)(t),name:(0,_.getName)(t)}}:{})}n(SP,"resolvePlanInfo");async function wP(e,t){return e=await(0,_.padQuerySpace)(e,[{key:b.eFilters.include,value:"service_offering"}]),le(e,aP),oe({query:`/v3/service_plans?${de(e)}`,token:t},(r,i)=>Promise.resolve(SP(r,g.find(g.get(i,"service_offerings"),["guid",g.get(r,["relationships","service_offering","data","guid"])]))))}n(wP,"cfGetServicePlansList");T.cfGetServicePlansList=wP;async function Rn(e,t){return e=await(0,_.padQuerySpace)(e,[{key:b.eFilters.service_plan,value:"guid,name",op:b.eOperation.fields},{key:b.eFilters.type,value:b.eServiceTypes.managed}]),le(e,Yr),Fn(await oe({query:`/v3/service_instances?${de(e)}`,token:t},r=>Mn(r)))}n(Rn,"cfGetServiceInstances");T.cfGetServiceInstances=Rn;async function Ap(e,t){return Rn(e,t)}n(Ap,"cfGetManagedServiceInstances");T.cfGetManagedServiceInstances=Ap;async function TP(e,t){await V({query:g.concat(["target","-o",e],t?["-s",t]:[])}),_p(),Ap()}n(TP,"cfSetOrgSpace");T.cfSetOrgSpace=TP;async function _P(){let e=await V({query:["targets"]});if(g.includes(e,"No targets have been saved yet")||g.includes(e,"is not a registered command"))return[{label:b.DEFAULT_TARGET,isCurrent:!0,isDirty:!1}];let t=g.compact(g.map(e.split(b.NEW_LINE),r=>r.trim()));return g.map(t,r=>{let i=r.indexOf("(current");return i>0?(r=r.substring(0,i),{label:r.trim(),isCurrent:!0,isDirty:r.includes("modified")}):{label:r,isCurrent:!1,isDirty:!1}})}n(_P,"cfGetTargets");T.cfGetTargets=_P;async function xp(e,t){return le(e,oP),oe({query:`/v3/service_offerings?${de(await(0,_.padQuerySpace)(e))}`,token:t},r=>Promise.resolve({label:(0,_.getName)(r),service_plans_url:g.get(r,["links","service_plans","href"]),guid:(0,_.getGuid)(r),description:(0,_.getDescription)(r)}))}n(xp,"cfGetServices");T.cfGetServices=xp;async function CP(e,t,r){return xp((0,_.padQuery)(e,[{key:b.eFilters.space_guids,value:t}]),r)}n(CP,"cfGetSpaceServices");T.cfGetSpaceServices=CP;async function EP(e,t,r,i,s,a){await V({query:["bind-local","-path",e,"-service-names",...t,...g.size(r)?g.concat(["-tags"],r):[],...g.size(i)?g.concat(["-service-keys"],i):[],...g.size(s)?g.concat(["-params"],g.map(s,c=>(0,Fe.stringify)(c))):[],...a?["-quote-vcap"]:[]]})}n(EP,"cfBindLocalServices");T.cfBindLocalServices=EP;async function AP(e,t,r,i){await V({query:g.concat(["bind-local-ups","-path",e],g.reduce(t,(s,a)=>(s=g.concat(s,["-service-names",`${a}`]),s),[]),g.reduce(r,(s,a)=>(s=g.concat(s,["-tags",`${a}`]),s),[]),i?["-quote-vcap"]:[])})}n(AP,"cfBindLocalUps");T.cfBindLocalUps=AP;async function xP(e){let t=await Rn(await(0,_.padQuerySpace)({filters:[{key:b.eFilters.names,value:encodeURIComponent(e)},{key:b.eFilters.type,value:b.eServiceTypes.managed}]}));if(!g.size(t))throw new Error(ue.messages.service_not_found(e));let r=g.head(t);return{serviceName:(0,_.getLabel)(r),plan:g.get(r,"plan"),plan_guid:g.get(r,"plan_guid"),service:g.get(r,"serviceName")}}n(xP,"cfGetInstanceMetadata");T.cfGetInstanceMetadata=xP;async function Pp(){return await V({query:["oauth-token"]})}n(Pp,"cfGetAuthToken");T.cfGetAuthToken=Pp;async function Np(e){return e||await Pp(),(0,_.parseRawDictData)(await V({query:["target"],options:{env:{CF_COLOR:"false"}}}))}n(Np,"cfGetTarget");T.cfGetTarget=Np;async function PP(e){return oe({query:e},t=>Promise.resolve({label:(0,_.getName)(t),guid:(0,_.getGuid)(t),description:(0,_.getDescription)(t)}))}n(PP,"cfGetServicePlans");T.cfGetServicePlans=PP;async function NP(){await V({query:["logout"]})}n(NP,"cfLogout");T.cfLogout=NP;async function zr(e,t){return le(e,cP),oe({query:`/v3/service_credential_bindings?${de((0,_.padQuery)(e,[{key:b.eFilters.type,value:"key"}]))}`,token:t})}n(zr,"cfGetServiceKeys");T.cfGetServiceKeys=zr;async function OP(e,t){let r=g.map(await zr(e,t),i=>V({query:["curl",`/v3/service_credential_bindings/${(0,_.getGuid)(i)}/details`],token:t},s=>s).then(s=>s).catch(()=>({})));return Promise.all(g.compact(r))}n(OP,"cfGetInstanceCredentials");T.cfGetInstanceCredentials=OP;async function IP(e){let t=await Ep({filters:[{key:b.eFilters.names,value:encodeURIComponent(e)}]}),r={filters:[{key:b.eFilters.service_instance_guids,value:(0,_.getGuid)(t)}]},i=await zr(r);return g.size(i)||(await Sp.Cli.execute(["create-service-key",encodeURIComponent(e),"key","--wait"]),i=await zr((0,_.padQuery)(r,[{key:b.eFilters.names,value:"key"}]))),V({query:["curl",`/v3/service_credential_bindings/${(0,_.getGuid)(g.head(i))}/details`]},s=>s).then(s=>s).catch(()=>({}))}n(IP,"cfGetInstanceKeyParameters");T.cfGetInstanceKeyParameters=IP;async function qP(e,t){return e=await(0,_.padQuerySpace)(e,[{key:b.eFilters.service_plan,value:"guid,name",op:b.eOperation.fields}]),le(e,Yr),Fn(await oe({query:`/v3/service_instances?${de(e)}`,token:t},r=>Mn(r)))}n(qP,"cfGetServiceInstancesList");T.cfGetServiceInstancesList=qP;async function MP(e,t){return le(e,uP),oe({query:`/v3/apps?${de(await(0,_.padQuerySpace)(e))}`,token:t})}n(MP,"cfGetApps");T.cfGetApps=MP;async function FP(e){let t=["api"];return e?.url&&t.push(e.url),e?.skip_ssl_validation&&t.push("--skip-ssl-validation"),e?.unset&&t.push("--unset"),(0,_.parseRawDictData)(await V({query:[...t]}))}n(FP,"cfApi");T.cfApi=FP});var Ip=p(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.isTargetSet=ie.getInstanceMetadata=ie.createServiceInstance=ie.getInstanceCredentials=ie.getServicesInstancesFilteredByType=void 0;var RP=Hr(),Le=require("../../commonlibs/lodash/index.js"),Op=mt(),Zt=Ln();async function LP(e){let t=Le.map(await(0,Zt.cfGetServicePlansList)({filters:[{key:Op.eFilters.service_offering_names,value:Le.join(Le.map(e,encodeURIComponent))}]}),"guid");return Le.size(t)?(0,Zt.cfGetManagedServiceInstances)({filters:[{key:Op.eFilters.service_plan_guids,value:Le.join(t)}]}):[]}n(LP,"getServicesInstancesFilteredByType");ie.getServicesInstancesFilteredByType=LP;function UP(e){return(0,Zt.cfGetInstanceKeyParameters)(e)}n(UP,"getInstanceCredentials");ie.getInstanceCredentials=UP;function kP(e,t,r,i,s){let a=["create-service",e,t,r];return i&&(a=a.concat(["-c",i])),s!==!0&&a.push("--wait"),RP.Cli.execute(a)}n(kP,"createServiceInstance");ie.createServiceInstance=kP;function DP(e){return(0,Zt.cfGetInstanceMetadata)(e)}n(DP,"getInstanceMetadata");ie.getInstanceMetadata=DP;async function jP(){let e=await(0,Zt.cfGetTarget)();return!Le.isEmpty(e.org)&&!Le.isEmpty(e.space)}n(jP,"isTargetSet");ie.isTargetSet=jP});var qp=p(j=>{"use strict";var $P=j&&j.__createBinding||(Object.create?(function(e,t,r,i){i===void 0&&(i=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:n(function(){return t[r]},"get")}),Object.defineProperty(e,i,s)}):(function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]})),er=j&&j.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&$P(t,e,r)};Object.defineProperty(j,"__esModule",{value:!0});j.apiGetInstanceMetadata=j.apiCreateServiceInstance=j.apiGetInstanceCredentials=j.apiGetServicesInstancesFilteredByType=void 0;er(mt(),j);er(Hr(),j);er(Ln(),j);er(Qr(),j);er(qn(),j);var Xr=Ip();async function BP(e){return Xr.getServicesInstancesFilteredByType(e)}n(BP,"apiGetServicesInstancesFilteredByType");j.apiGetServicesInstancesFilteredByType=BP;async function GP(e){return Xr.getInstanceCredentials(e)}n(GP,"apiGetInstanceCredentials");j.apiGetInstanceCredentials=GP;async function VP(e,t,r,i){return Xr.createServiceInstance(e,t,r,i)}n(VP,"apiCreateServiceInstance");j.apiCreateServiceInstance=VP;async function HP(e){return Xr.getInstanceMetadata(e)}n(HP,"apiGetInstanceMetadata");j.apiGetInstanceMetadata=HP});var MN={};qh(MN,{CfAbapEnvServiceChoice:()=>ir,DatasourceType:()=>W,ERROR_TYPE:()=>pe.ERROR_TYPE,ErrorHandler:()=>pe.ErrorHandler,NewSystemChoice:()=>oi,OdataVersion:()=>_h.OdataVersion,default:()=>qN,getEntityRelatedPrompts:()=>ON,getPrompts:()=>Eh,getSystemSelectionQuestions:()=>NN,prompt:()=>IN,promptNames:()=>P});module.exports=Mh(MN);var pe=require("../../open-ux-shared/inquirer-common/index.js"),_h=require("../../odata-service-writer/dist/index.js"),Ch=Et(kd(),1);var jd=require("../../open-ux-shared/inquirer-common/index.js"),$d=require("../../open-ux-shared/project-input-validator/index.js"),Bd=Et(require("../../commonlibs/i18next/index.js"),1);var Dd={prompts:{datasourceType:{message:"Data Source",projectSpecificDestName:"Project Specific Destination",businessHubName:"SAP Business Accelerator Hub",sapSystemName:"System",odataServiceUrlName:"OData Service",capProjectName:"Local CAP Project",metadataFileName:"Metadata Document",choiceNone:"$t(texts.choiceNameNone)",projectSpecificDestChoiceText:"Connect to a $t(prompts.datasourceType.projectSpecificDestName)",businessHubChoiceText:"Connect to $t(prompts.datasourceType.businessHubName)",sapSystemChoiceText:"Connect to a $t(prompts.datasourceType.sapSystemName)",odataServiceUrlChoiceText:"Connect to an $t(prompts.datasourceType.odataServiceUrlName)",capProjectChoiceText:"Use a $t(prompts.datasourceType.capProjectName)",metadataFileChoiceText:"Upload a $t(prompts.datasourceType.metadataFileName)",notYetImplementedWarningMessage:"The selected data source type: {{ datasourceType }} is not yet implemented."},metadataFile:{message:"Metadata File Path",description:"Upload a metadata file",placeholder_odata_service_url:"/here/goes/your/serviceurl/"},capProject:{message:"Choose a CAP Project",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capProjectPath:{message:"CAP Project Folder Path",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capService:{message:"OData Service",description:"Select a local CAP service",breadcrumb:"CAP Service",enterCapPathChoiceName:"Manually select CAP service folder path"},odataServiceUrl:{message:"OData{{odataVersion, odataVersionFormatter}} service URL"},ignoreCertErrors:{message:"Do you want to continue generation with the untrusted certificate?"},serviceUsername:{message:"Service username"},servicePassword:{message:"Service password"},validationMessages:{odataVersionMismatch:"The template you have chosen supports V{{requiredOdataVersion}} OData services only. The provided version is V{{providedOdataVersion}}.",metadataInvalid:"The service metadata is invalid.",metadataFilePathNotValid:"The metadata file does not exist or is not accessible. Please specify a valid file path.",capProjectNotFound:"The folder you have selected does not contain a valid CAP project. Please check and try again.",warningCertificateValidationDisabled:"Certificate validation has been disabled by the user.",annotationsNotFound:"Annotations not found for the specified service.",backendSystemExistsWarning:'A saved system connection entry: "{{- backendName}}" already exists with the same URL and client. Please reuse the existing entry or remove it, using the systems panel, before adding a new connection.',systemUrlOriginOnlyWarning:"System URLs must only contain the hostname and may also include the port, for example, 'https://abc.com:123/'."},warnings:{nonUIServiceTypeWarningMessage:"Services of service type: {{serviceType}} or without a service type are not intended to be used for generating SAP Fiori UI applications.",noServicesAvailable:"There are no services available for the selected system. For more information, see the logs.",noServicesAvailableForOdataVersion:"There are no OData V{{odataVersion}} services available from the selected system and the template you have chosen only supports OData V{{odataVersion}} services.",noAnnotations:"No back-end annotations associated with this service were retrieved. This can result in an invalid application.",collaborativeDraftMessage:"The selected service is draft-enabled but does not support collaborative draft."},systemUrl:{message:"System URL",description:"Enter the URL of the SAP System",placeholder:"https://<host>:<port>"},sapClient:{message:"SAP client (leave empty for default)",breadcrumb:"SAP Client"},systemUsername:{message:"Username"},systemPassword:{message:"Password"},storeSystemCredentials:{message:"Do you want to store the system credentials?",breadcrumb:"Store Credentials"},systemService:{message:"Service",breadcrumb:"Service",noServicesWarning:"No services available for the selected system. For more information, see the logs."},newSystemType:{choiceAbapOnPrem:"ABAP On Premise",choiceAbapOnBtp:"ABAP Environment on SAP Business Technology Platform",choiceCFAbapEnvServiceOnBtp:"Cloud Foundry ABAP environment on SAP Business Technology Platform",message:"System Type",notYetImplementedWarningMessage:"The selected system type: {{ systemType }} is not yet implemented."},systemName:{message:"System name",hint:"Entering a system name will save the connection for re-use.",systemNameExistsWarning:"A system with that name already exists in the secure storage. Please try a different name.",reservedSystemNameWarning:"'{{ systemName }}' is a reserved system name. Please try a different name.",emptySystemNameWarning:"System name cannot be empty."},systemSelection:{newSystemChoiceLabel:"New System",hint:"Select a system configuration.",message:"System",authenticationFailedUpdateCredentials:"$t(texts.authenticationFailed). Please try updating the credentials."},abapOnBTPType:{message:"ABAP environment definition source",choiceReentranceTicket:"Use Reentrance Ticket",choiceServiceKey:"Upload a Service Key File",choiceCloudFoundry:"Discover a Cloud Foundry Service"},serviceKey:{message:"Service Key File Path",hint:"Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",incompleteServiceKeyInfo:"The service keys file does not contain the required information. Check the file is valid and try again.",unparseableServiceKey:"The service keys file does not contain a valid JSON format. Check the formatting and try again."},cloudFoundryAbapSystem:{message:"ABAP environment",hint:"Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."},destinationServicePath:{message:"Service Path",hint:"Enter the path to the OData service relative to the selected destination URL.",invalidServicePathWarning:"Please enter a valid service path"},mainEntitySelection:{message:"Main Entity",defaultEntityNameNotFoundWarning:"The supplied entity cannot be found in the service. Please choose from the list above.",noDraftEnabledEntitiesError:"The CAP service you have chosen does not have any entities that are draft enabled. To generate an OData V4 SAP Fiori application using this floorplan for a CAP project, the entity selected must be draft enabled.",mainEntityParameterFoundInfo:"The selected entity '{{entityName}}' requires a parameter which is set by the application filters. Navigation entities are not supported.",noEntitiesError:"$t(errors.noRelevantEntities)",noEntitiesAlpV4Error:"The OData V4 service you have provided is not suitable for use in an analytical list page application. The service must contain aggregate-based entities for this template.",requiredError:"Please select a main entity to continue."},navigationEntitySelection:{message:"Navigation Entity",choiceNone:"$t(texts.choiceNameNone)"},filterEntitySet:{message:"Filter Entity",noEntitiesError:"$t(errors.noRelevantEntities)"},pageBuildingBlock:{message:"Add a Page Building Block to the Application?",tooltip:"The Page building block is supported from SAPUI5 version 1.136. By choosing this option, you will be restricting the minimum SAPUI5 versions available for the application to be 1.136 and above.",warning:"The Page building block is supported with SAPUI5 version 1.136 and above.",titleMessage:"Page Title"},tableType:{message:"Table Type",hint:"Defines the table type for the list report page.",requiredError:"Please select a table type to continue.",choiceNone:"$t(texts.choiceNameNone)",choiceGrid:"Grid",choiceAnalytical:"Analytical",choiceResponsive:"Responsive",choiceTree:"Tree",analyticalTableDefault:"The 'Analytical' table type is chosen by default because the selected entity supports it.",treeTableDefault:"The 'Tree' table type is chosen by default because the selected entity supports it.",responsiveTableInfo:"Only use the responsive table if the total number of items in the table doesn't exceed 200."},hierarchyQualifier:{message:"Hierarchy Qualifier",hint:"Leading property that decides between either a recursive hierarchy or data aggregation.",qualifierRequiredForV4Warning:"Hierarchy qualifier is required for OData V4 services."},addFEOPAnnotations:{message:"Automatically add a form to the generated application if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations"},addLineItemAnnotations:{message:"Automatically add table columns to the list page and a section to the object page if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations",valueHelpsAnnotationsInfoMessage:"Basic value helps will also be created."},presentationQualifier:{message:"Qualifier",hint:"Represents the qualifier of the `SelectionPresentationVariant`. The analytical list page looks for a `SelectionPresentationVariant` with this qualifier and if not found, it looks for a `PresentationVariant` with this qualifier."},tableSelectionMode:{message:"Selection Mode",hint:"Defines different selection modes for the `SmartTable` in the analytical list page.",choiceNone:"$t(texts.choiceNameNone)",choiceSingle:"Single",choiceAuto:"Auto",choiceMulti:"Multi"},tableMultiSelect:{message:"Allow Multi Select",hint:"Allows you to show a checkbox for selecting multiple items in a table. This setting comes into effect only if there are actions defined either by using an annotation or a setting in the `manifest.json` file."},tableAutoHide:{message:"Auto Hide",hint:"Determines the chart or table interaction. If set to `true`, the chart acts as a filter for the table. If set to `false`, the matching table rows are highlighted but the table is not filtered."},smartVariantManagement:{message:"Enable Smart Variant Management",hint:"Enables page level variant."},valueHelpDownload:{message:"The service contains references to value help services. Do you want to download the associated metadata during generation? This may increase generation time.",hint:"Download metadata for value help to improve the user experience with dropdowns and search."}},errors:{destination:{authError:"The selected system: {{systemName}} returned an authentication error: {{- error}}.",listDestinations:"An error occurred when retrieving the list of destinations: {{- error}}."},cannotReadCapServiceMetadata:"An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails).",capModelAndServicesLoadError:"An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",capServiceUrlPathNotDefined:"An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",unknownError:"An error occurred: {{- error, addMsgWithColonFormatter}}.",authenticationFailed:"$t(texts.authenticationFailed): {{error}}.",authenticationFailedSpecificCatalog:"{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",authenticationFailedAllCatalogs:"{{authFailType}}: Unable to access any service catalogs",invalidUrl:"Invalid URL: {{-input, addMsgWithColonFormatter}}.",connectionError:"A connection error occurred. Ensure the target host is available on the network: {{- error}}",urlNotFound:"URL not found.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",abapEnvsUnavailable:"ABAP environments unavailable.",systemOrServiceUrlNotFound:"Please verify the URL: {{- url}}, target system configuration and network connectivity.",urlRedirect:"The service URL is redirecting.",certValidationRequired:"Certificate validation is required to continue.",exitingGeneration:"Exiting generation. Exit: {{exitReason}}.",serviceMetadataError:"An error occurred when reading the service metadata for service: {{- servicePath}}. Error: {{errorText}}",serviceMetadataErrorUI:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" }) $t(texts.seeLogForDetails)',serviceMetadataErrorLog:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" })',serviceTypeRequestError:"An error occurred when retrieving the service type: {{- error}}.",abapServiceAuthenticationFailed:"ABAP environment authentication using UAA failed.",serviceCatalogRequest:"An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}: {{error}}.",storedSystemConnectionError:"An error occurred when validating the stored system connection info. System Name: {{-systemName}}. Error: {{- error}}.",noCatalogOrServiceAvailable:"No active system or OData service endpoint connection available to retrieve the server.",allCatalogServiceRequestsFailed:"All catalog service requests failed for the selected system. OData version: V{{version}}.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata.",unparseableXML:"Unparseable XML was specified: {{-error}}.",noRelevantEntities:"The template and service selected have no relevant entities that you can use.",cfInstanceCredentialsNotReturned:"Cannot not retrieve credentials to access: {{serviceInstanceName}}.",v2CatalogServiceNoAnnotations:"An error occurred when creating an OData V2 catalog service object. Annotations will not be available: {{-error}}",backendSystemRetrieval:"An error occurred when retrieving the backend systems from the store: {{-error}}"},warnings:{largeMetadataDocument:"The metadata for this OData service is very large. It may take some time before this operation completes.",warningCertificateValidationDisabled:"User has disabled certificate validation",nonUIServiceTypeWarningMessage:"Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",noServicesAvailable:"No services available for the selected system, see logs for further details.",noServicesAvailableForOdataVersion:"There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",noAnnotations:"No backend annotations associated with this service were retrieved and may result in an invalid application being created",collaborativeDraftMessage:"The selected service is draft enabled but does not support collaborative draft.",certificateErrors:"A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",allowingUnauthorizedCertsNode:"Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",certErrorIgnoredByNodeSetting:"An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",noExternalServiceMetdataFetched:"No external service metadata was fetched. $t(texts.seeLogForDetails)",missingServices:"OData V{{odataVersion}} services are not available.",specifiedServicesNotAvailable_one:"The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",specifiedServicesNotAvailable_other:"The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)",storedSystemUrlPathNotSupported:"The stored cloud system URL '{{- systemUrl}}' contains a path which is not supported for reentrance ticket authentication. The path is ignored for this connection."},texts:{suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, view the logs.",forUserName:"(for user [{{username}}])",httpStatus:"HTTP Status {{httpStatus}}",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration.",choiceNameNone:"None",passwordStoreWarning:"Passwords are stored in your operating system's credential manager and are protected by its security policies.",authorizationFailed:"Authorization failed",authenticationFailed:"Authentication failed"}};var Gd="odata-service-inquirer";var an=Bd.default.createInstance();async function on(){await an.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:n(()=>"","missingInterpolationHandler"),interpolation:{format:n(function(e,t){return t==="odataVersionFormatter"?e?` V${e}`:"":t==="addMsgWithColonFormatter"?e?`: ${e}`:"":e},"format")},showSupportNotice:!1}),an.addResourceBundle("en",Gd,Dd),(0,jd.addi18nResourceBundle)(),(0,$d.addi18nResourceBundle)()}n(on,"initI18nOdataServiceInquirer");function f(e,t){return t?.ns||(t=Object.assign(t??{},{ns:Gd})),an.t(e,t)}n(f,"t");on().catch(()=>{});var ar=require("../../open-ux-shared/inquirer-common/index.js");var W;(function(e){e.sapSystem="sapSystem",e.capProject="capProject",e.odataServiceUrl="odataServiceUrl",e.none="none",e.metadataFile="metadataFile",e.projectSpecificDestination="projectSpecificDestination",e.businessHub="businessHub"})(W||(W={}));var nt="sap-client",Vd=1e3,P;(function(e){e.datasourceType="datasourceType",e.metadataFilePath="metadataFilePath",e.capProject="capProject",e.capService="capService",e.serviceUrl="serviceUrl",e.serviceUrlPassword="serviceUrlPassword",e.serviceSelection="serviceSelection",e.userSystemName="userSystemName",e.systemSelection="systemSelection",e.valueHelpDownload="valueHelpDownload"})(P||(P={}));var G={mainEntity:"mainEntity",navigationEntity:"navigationEntity",filterEntitySet:"filterEntitySet",addPageBuildingBlock:"addPageBuildingBlock",pageBuildingBlockTitle:"pageBuildingBlockTitle",tableType:"tableType",hierarchyQualifier:"hierarchyQualifier",addFEOPAnnotations:"addFEOPAnnotations",addLineItemAnnotations:"addLineItemAnnotations",presentationQualifier:"presentationQualifier",tableSelectionMode:"tableSelectionMode",tableMultiSelect:"tableMultiSelect",tableAutoHide:"tableAutoHide",smartVariantManagement:"smartVariantManagement"};var Zf=require("../../open-ux-shared/inquirer-common/index.js"),In=require("../../odata-service-writer/dist/index.js"),ep=require("../../open-ux-shared/project-access/index.js"),tp=require("../../fiori-generator-shared/dist/index.js");var An=require("../../open-ux-shared/axios-extension/index.js"),Uf=require("../../open-ux-shared/btp-utils/index.js"),Dr=require("../../fiori-generator-shared/dist/index.js"),jr=require("../../odata-service-writer/dist/index.js");var Hd=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",aA=Hd+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",oA="["+Hd+"]["+aA+"]*",cA=new RegExp("^"+oA+"$");function xr(e,t){let r=[],i=t.exec(e);for(;i;){let s=[];s.startIndex=t.lastIndex-i[0].length;let a=i.length;for(let c=0;c<a;c++)s.push(i[c]);r.push(s),i=t.exec(e)}return r}n(xr,"getAllMatches");var cn=n(function(e){let t=cA.exec(e);return!(t===null||typeof t>"u")},"isName");function Wd(e){return typeof e<"u"}n(Wd,"isExist");var $t=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],Pr=["__proto__","constructor","prototype"];var uA={allowBooleanAttributes:!1,unpairedTags:[]};function Xd(e,t){t=Object.assign({},uA,t);let r=[],i=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let a=0;a<e.length;a++)if(e[a]==="<"&&e[a+1]==="?"){if(a+=2,a=Kd(e,a),a.err)return a}else if(e[a]==="<"){let c=a;if(a++,e[a]==="!"){a=zd(e,a);continue}else{let o=!1;e[a]==="/"&&(o=!0,a++);let u="";for(;a<e.length&&e[a]!==">"&&e[a]!==" "&&e[a]!==" "&&e[a]!==`
`&&e[a]!=="\r";a++)u+=e[a];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),a--),!yA(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",k("InvalidTag",h,Q(e,a))}let l=fA(e,a);if(l===!1)return k("InvalidAttr","Attributes for '"+u+"' have open quote.",Q(e,a));let d=l.value;if(a=l.index,d[d.length-1]==="/"){let h=a-d.length;d=d.substring(0,d.length-1);let m=Yd(d,t);if(m===!0)i=!0;else return k(m.err.code,m.err.msg,Q(e,h+m.err.line))}else if(o)if(l.tagClosed){if(d.trim().length>0)return k("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Q(e,c));if(r.length===0)return k("InvalidTag","Closing tag '"+u+"' has not been opened.",Q(e,c));{let h=r.pop();if(u!==h.tagName){let m=Q(e,h.tagStartPos);return k("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+m.line+", col "+m.col+") instead of closing tag '"+u+"'.",Q(e,c))}r.length==0&&(s=!0)}}else return k("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Q(e,a));else{let h=Yd(d,t);if(h!==!0)return k(h.err.code,h.err.msg,Q(e,a-d.length+h.err.line));if(s===!0)return k("InvalidXml","Multiple possible root nodes found.",Q(e,a));t.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:c}),i=!0}for(a++;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="!"){a++,a=zd(e,a);continue}else if(e[a+1]==="?"){if(a=Kd(e,++a),a.err)return a}else break;else if(e[a]==="&"){let h=mA(e,a);if(h==-1)return k("InvalidChar","char '&' is not expected.",Q(e,a));a=h}else if(s===!0&&!Qd(e[a]))return k("InvalidXml","Extra text at the end",Q(e,a));e[a]==="<"&&a--}}else{if(Qd(e[a]))continue;return k("InvalidChar","char '"+e[a]+"' is not expected.",Q(e,a))}if(i){if(r.length==1)return k("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Q(e,r[0].tagStartPos));if(r.length>0)return k("InvalidXml","Invalid '"+JSON.stringify(r.map(a=>a.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return k("InvalidXml","Start tag expected.",1);return!0}n(Xd,"validate");function Qd(e){return e===" "||e===" "||e===`
`||e==="\r"}n(Qd,"isWhiteSpace");function Kd(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let i=e.substr(r,t-r);if(t>5&&i==="xml")return k("InvalidXml","XML declaration allowed only at the start of the document.",Q(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}n(Kd,"readPI");function zd(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}n(zd,"readCommentAndCDATA");var lA='"',dA="'";function fA(e,t){let r="",i="",s=!1;for(;t<e.length;t++){if(e[t]===lA||e[t]===dA)i===""?i=e[t]:i!==e[t]||(i="");else if(e[t]===">"&&i===""){s=!0;break}r+=e[t]}return i!==""?!1:{value:r,index:t,tagClosed:s}}n(fA,"readAttributeStr");var pA=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Yd(e,t){let r=xr(e,pA),i={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return k("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",Bt(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return k("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",Bt(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return k("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",Bt(r[s]));let a=r[s][2];if(!gA(a))return k("InvalidAttr","Attribute '"+a+"' is an invalid name.",Bt(r[s]));if(!Object.prototype.hasOwnProperty.call(i,a))i[a]=1;else return k("InvalidAttr","Attribute '"+a+"' is repeated.",Bt(r[s]))}return!0}n(Yd,"validateAttributeString");function hA(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}n(hA,"validateNumberAmpersand");function mA(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,hA(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}n(mA,"validateAmpersand");function k(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}n(k,"getErrorObject");function gA(e){return cn(e)}n(gA,"validateAttrName");function yA(e){return cn(e)}n(yA,"validateTagName");function Q(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}n(Q,"getLineNumberForPosition");function Bt(e){return e.startIndex+e[1].length}n(Bt,"getPositionFromMatch");var Jd={amp:"&",AMP:"&",lt:"<",LT:"<",gt:">",GT:">",quot:'"',QUOT:'"',apos:"'",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",lsquor:"\u201A",rsquor:"\u2019",ldquor:"\u201E",bdquo:"\u201E",comma:",",period:".",colon:":",semi:";",excl:"!",quest:"?",num:"#",dollar:"$",percent:"%",amp:"&",ast:"*",commat:"@",lowbar:"_",verbar:"|",vert:"|",sol:"/",bsol:"\\",lbrace:"{",rbrace:"}",lbrack:"[",rbrack:"]",lpar:"(",rpar:")",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",COPY:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",REG:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",half:"\xBD",frac34:"\xBE",iquest:"\xBF",times:"\xD7",div:"\xF7",divide:"\xF7"},Zd={Agrave:"\xC0",agrave:"\xE0",Aacute:"\xC1",aacute:"\xE1",Acirc:"\xC2",acirc:"\xE2",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",Aring:"\xC5",aring:"\xE5",AElig:"\xC6",aelig:"\xE6",Ccedil:"\xC7",ccedil:"\xE7",Egrave:"\xC8",egrave:"\xE8",Eacute:"\xC9",eacute:"\xE9",Ecirc:"\xCA",ecirc:"\xEA",Euml:"\xCB",euml:"\xEB",Igrave:"\xCC",igrave:"\xEC",Iacute:"\xCD",iacute:"\xED",Icirc:"\xCE",icirc:"\xEE",Iuml:"\xCF",iuml:"\xEF",ETH:"\xD0",eth:"\xF0",Ntilde:"\xD1",ntilde:"\xF1",Ograve:"\xD2",ograve:"\xF2",Oacute:"\xD3",oacute:"\xF3",Ocirc:"\xD4",ocirc:"\xF4",Otilde:"\xD5",otilde:"\xF5",Ouml:"\xD6",ouml:"\xF6",Oslash:"\xD8",oslash:"\xF8",Ugrave:"\xD9",ugrave:"\xF9",Uacute:"\xDA",uacute:"\xFA",Ucirc:"\xDB",ucirc:"\xFB",Uuml:"\xDC",uuml:"\xFC",Yacute:"\xDD",yacute:"\xFD",THORN:"\xDE",thorn:"\xFE",szlig:"\xDF",yuml:"\xFF",Yuml:"\u0178"},ef={Amacr:"\u0100",amacr:"\u0101",Abreve:"\u0102",abreve:"\u0103",Aogon:"\u0104",aogon:"\u0105",Cacute:"\u0106",cacute:"\u0107",Ccirc:"\u0108",ccirc:"\u0109",Cdot:"\u010A",cdot:"\u010B",Ccaron:"\u010C",ccaron:"\u010D",Dcaron:"\u010E",dcaron:"\u010F",Dstrok:"\u0110",dstrok:"\u0111",Emacr:"\u0112",emacr:"\u0113",Ecaron:"\u011A",ecaron:"\u011B",Edot:"\u0116",edot:"\u0117",Eogon:"\u0118",eogon:"\u0119",Gcirc:"\u011C",gcirc:"\u011D",Gbreve:"\u011E",gbreve:"\u011F",Gdot:"\u0120",gdot:"\u0121",Gcedil:"\u0122",Hcirc:"\u0124",hcirc:"\u0125",Hstrok:"\u0126",hstrok:"\u0127",Itilde:"\u0128",itilde:"\u0129",Imacr:"\u012A",imacr:"\u012B",Iogon:"\u012E",iogon:"\u012F",Idot:"\u0130",IJlig:"\u0132",ijlig:"\u0133",Jcirc:"\u0134",jcirc:"\u0135",Kcedil:"\u0136",kcedil:"\u0137",kgreen:"\u0138",Lacute:"\u0139",lacute:"\u013A",Lcedil:"\u013B",lcedil:"\u013C",Lcaron:"\u013D",lcaron:"\u013E",Lmidot:"\u013F",lmidot:"\u0140",Lstrok:"\u0141",lstrok:"\u0142",Nacute:"\u0143",nacute:"\u0144",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ENG:"\u014A",eng:"\u014B",Omacr:"\u014C",omacr:"\u014D",Odblac:"\u0150",odblac:"\u0151",OElig:"\u0152",oelig:"\u0153",Racute:"\u0154",racute:"\u0155",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",Sacute:"\u015A",sacute:"\u015B",Scirc:"\u015C",scirc:"\u015D",Scedil:"\u015E",scedil:"\u015F",Scaron:"\u0160",scaron:"\u0161",Tcedil:"\u0162",tcedil:"\u0163",Tcaron:"\u0164",tcaron:"\u0165",Tstrok:"\u0166",tstrok:"\u0167",Utilde:"\u0168",utilde:"\u0169",Umacr:"\u016A",umacr:"\u016B",Ubreve:"\u016C",ubreve:"\u016D",Uring:"\u016E",uring:"\u016F",Udblac:"\u0170",udblac:"\u0171",Uogon:"\u0172",uogon:"\u0173",Wcirc:"\u0174",wcirc:"\u0175",Ycirc:"\u0176",ycirc:"\u0177",Zacute:"\u0179",zacute:"\u017A",Zdot:"\u017B",zdot:"\u017C",Zcaron:"\u017D",zcaron:"\u017E"},tf={Alpha:"\u0391",alpha:"\u03B1",Beta:"\u0392",beta:"\u03B2",Gamma:"\u0393",gamma:"\u03B3",Delta:"\u0394",delta:"\u03B4",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",varepsilon:"\u03F5",Zeta:"\u0396",zeta:"\u03B6",Eta:"\u0397",eta:"\u03B7",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",vartheta:"\u03D1",Iota:"\u0399",iota:"\u03B9",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",varkappa:"\u03F0",Lambda:"\u039B",lambda:"\u03BB",Mu:"\u039C",mu:"\u03BC",Nu:"\u039D",nu:"\u03BD",Xi:"\u039E",xi:"\u03BE",Omicron:"\u039F",omicron:"\u03BF",Pi:"\u03A0",pi:"\u03C0",piv:"\u03D6",varpi:"\u03D6",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",varrho:"\u03F1",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",varsigma:"\u03C2",Tau:"\u03A4",tau:"\u03C4",Upsilon:"\u03A5",upsilon:"\u03C5",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",varphi:"\u03D5",Chi:"\u03A7",chi:"\u03C7",Psi:"\u03A8",psi:"\u03C8",Omega:"\u03A9",omega:"\u03C9",ohm:"\u03A9",Gammad:"\u03DC",gammad:"\u03DD",digamma:"\u03DD"},rf={Afr:"\u{1D504}",afr:"\u{1D51E}",Acy:"\u0410",acy:"\u0430",Bcy:"\u0411",bcy:"\u0431",Vcy:"\u0412",vcy:"\u0432",Gcy:"\u0413",gcy:"\u0433",Dcy:"\u0414",dcy:"\u0434",IEcy:"\u0415",iecy:"\u0435",IOcy:"\u0401",iocy:"\u0451",ZHcy:"\u0416",zhcy:"\u0436",Zcy:"\u0417",zcy:"\u0437",Icy:"\u0418",icy:"\u0438",Jcy:"\u0419",jcy:"\u0439",Kcy:"\u041A",kcy:"\u043A",Lcy:"\u041B",lcy:"\u043B",Mcy:"\u041C",mcy:"\u043C",Ncy:"\u041D",ncy:"\u043D",Ocy:"\u041E",ocy:"\u043E",Pcy:"\u041F",pcy:"\u043F",Rcy:"\u0420",rcy:"\u0440",Scy:"\u0421",scy:"\u0441",Tcy:"\u0422",tcy:"\u0442",Ucy:"\u0423",ucy:"\u0443",Fcy:"\u0424",fcy:"\u0444",KHcy:"\u0425",khcy:"\u0445",TScy:"\u0426",tscy:"\u0446",CHcy:"\u0427",chcy:"\u0447",SHcy:"\u0428",shcy:"\u0448",SHCHcy:"\u0429",shchcy:"\u0449",HARDcy:"\u042A",hardcy:"\u044A",Ycy:"\u042B",ycy:"\u044B",SOFTcy:"\u042C",softcy:"\u044C",Ecy:"\u042D",ecy:"\u044D",YUcy:"\u042E",yucy:"\u044E",YAcy:"\u042F",yacy:"\u044F",DJcy:"\u0402",djcy:"\u0452",GJcy:"\u0403",gjcy:"\u0453",Jukcy:"\u0404",jukcy:"\u0454",DScy:"\u0405",dscy:"\u0455",Iukcy:"\u0406",iukcy:"\u0456",YIcy:"\u0407",yicy:"\u0457",Jsercy:"\u0408",jsercy:"\u0458",LJcy:"\u0409",ljcy:"\u0459",NJcy:"\u040A",njcy:"\u045A",TSHcy:"\u040B",tshcy:"\u045B",KJcy:"\u040C",kjcy:"\u045C",Ubrcy:"\u040E",ubrcy:"\u045E",DZcy:"\u040F",dzcy:"\u045F"},nf={plus:"+",minus:"\u2212",mnplus:"\u2213",mp:"\u2213",pm:"\xB1",times:"\xD7",div:"\xF7",divide:"\xF7",sdot:"\u22C5",star:"\u2606",starf:"\u2605",bigstar:"\u2605",lowast:"\u2217",ast:"*",midast:"*",compfn:"\u2218",smallcircle:"\u2218",bullet:"\u2022",bull:"\u2022",nbsp:"\xA0",hellip:"\u2026",mldr:"\u2026",prime:"\u2032",Prime:"\u2033",tprime:"\u2034",bprime:"\u2035",backprime:"\u2035",minus:"\u2212",minusd:"\u2238",dotminus:"\u2238",plusdo:"\u2214",dotplus:"\u2214",plusmn:"\xB1",minusplus:"\u2213",mnplus:"\u2213",mp:"\u2213",setminus:"\u2216",smallsetminus:"\u2216",Backslash:"\u2216",setmn:"\u2216",ssetmn:"\u2216",lowbar:"_",verbar:"|",vert:"|",VerticalLine:"|",colon:":",Colon:"\u2237",Proportion:"\u2237",ratio:"\u2236",equals:"=",ne:"\u2260",nequiv:"\u2262",equiv:"\u2261",Congruent:"\u2261",sim:"\u223C",thicksim:"\u223C",thksim:"\u223C",sime:"\u2243",simeq:"\u2243",TildeEqual:"\u2243",asymp:"\u2248",approx:"\u2248",thickapprox:"\u2248",thkap:"\u2248",TildeTilde:"\u2248",ncong:"\u2247",cong:"\u2245",TildeFullEqual:"\u2245",asympeq:"\u224D",CupCap:"\u224D",bump:"\u224E",Bumpeq:"\u224E",HumpDownHump:"\u224E",bumpe:"\u224F",bumpeq:"\u224F",HumpEqual:"\u224F",dotminus:"\u2238",minusd:"\u2238",plusdo:"\u2214",dotplus:"\u2214",le:"\u2264",LessEqual:"\u2264",ge:"\u2265",GreaterEqual:"\u2265",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",greater:">",less:"<"},sf={alefsym:"\u2135",aleph:"\u2135",beth:"\u2136",gimel:"\u2137",daleth:"\u2138",forall:"\u2200",ForAll:"\u2200",part:"\u2202",PartialD:"\u2202",exist:"\u2203",Exists:"\u2203",nexist:"\u2204",nexists:"\u2204",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",varnothing:"\u2205",nabla:"\u2207",Del:"\u2207",isin:"\u2208",isinv:"\u2208",in:"\u2208",Element:"\u2208",notin:"\u2209",notinva:"\u2209",ni:"\u220B",niv:"\u220B",SuchThat:"\u220B",ReverseElement:"\u220B",notni:"\u220C",notniva:"\u220C",prod:"\u220F",Product:"\u220F",coprod:"\u2210",Coproduct:"\u2210",sum:"\u2211",Sum:"\u2211",minus:"\u2212",mp:"\u2213",plusdo:"\u2214",dotplus:"\u2214",setminus:"\u2216",lowast:"\u2217",radic:"\u221A",Sqrt:"\u221A",prop:"\u221D",propto:"\u221D",Proportional:"\u221D",varpropto:"\u221D",infin:"\u221E",infintie:"\u29DD",ang:"\u2220",angle:"\u2220",angmsd:"\u2221",measuredangle:"\u2221",angsph:"\u2222",mid:"\u2223",VerticalBar:"\u2223",nmid:"\u2224",nsmid:"\u2224",npar:"\u2226",parallel:"\u2225",spar:"\u2225",nparallel:"\u2226",nspar:"\u2226",and:"\u2227",wedge:"\u2227",or:"\u2228",vee:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",Integral:"\u222B",conint:"\u222E",ContourIntegral:"\u222E",Conint:"\u222F",DoubleContourIntegral:"\u222F",Cconint:"\u2230",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",becaus:"\u2235",because:"\u2235",Because:"\u2235",ratio:"\u2236",Proportion:"\u2237",minusd:"\u2238",dotminus:"\u2238",mDDot:"\u223A",homtht:"\u223B",sim:"\u223C",bsimg:"\u223D",backsim:"\u223D",ac:"\u223E",mstpos:"\u223E",acd:"\u223F",VerticalTilde:"\u2240",wr:"\u2240",wreath:"\u2240",nsime:"\u2244",nsimeq:"\u2244",nsimeq:"\u2244",ncong:"\u2247",simne:"\u2246",ncongdot:"\u2A6D\u0338",ngsim:"\u2275",nsim:"\u2241",napprox:"\u2249",nap:"\u2249",ngeq:"\u2271",nge:"\u2271",nleq:"\u2270",nle:"\u2270",ngtr:"\u226F",ngt:"\u226F",nless:"\u226E",nlt:"\u226E",nprec:"\u2280",npr:"\u2280",nsucc:"\u2281",nsc:"\u2281"},af={larr:"\u2190",leftarrow:"\u2190",LeftArrow:"\u2190",uarr:"\u2191",uparrow:"\u2191",UpArrow:"\u2191",rarr:"\u2192",rightarrow:"\u2192",RightArrow:"\u2192",darr:"\u2193",downarrow:"\u2193",DownArrow:"\u2193",harr:"\u2194",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",varr:"\u2195",updownarrow:"\u2195",UpDownArrow:"\u2195",nwarr:"\u2196",nwarrow:"\u2196",UpperLeftArrow:"\u2196",nearr:"\u2197",nearrow:"\u2197",UpperRightArrow:"\u2197",searr:"\u2198",searrow:"\u2198",LowerRightArrow:"\u2198",swarr:"\u2199",swarrow:"\u2199",LowerLeftArrow:"\u2199",lArr:"\u21D0",Leftarrow:"\u21D0",uArr:"\u21D1",Uparrow:"\u21D1",rArr:"\u21D2",Rightarrow:"\u21D2",dArr:"\u21D3",Downarrow:"\u21D3",hArr:"\u21D4",Leftrightarrow:"\u21D4",iff:"\u21D4",vArr:"\u21D5",Updownarrow:"\u21D5",lAarr:"\u21DA",Lleftarrow:"\u21DA",rAarr:"\u21DB",Rrightarrow:"\u21DB",lrarr:"\u21C6",leftrightarrows:"\u21C6",rlarr:"\u21C4",rightleftarrows:"\u21C4",lrhar:"\u21CB",leftrightharpoons:"\u21CB",ReverseEquilibrium:"\u21CB",rlhar:"\u21CC",rightleftharpoons:"\u21CC",Equilibrium:"\u21CC",udarr:"\u21C5",UpArrowDownArrow:"\u21C5",duarr:"\u21F5",DownArrowUpArrow:"\u21F5",llarr:"\u21C7",leftleftarrows:"\u21C7",rrarr:"\u21C9",rightrightarrows:"\u21C9",ddarr:"\u21CA",downdownarrows:"\u21CA",har:"\u21BD",lhard:"\u21BD",leftharpoondown:"\u21BD",lharu:"\u21BC",leftharpoonup:"\u21BC",rhard:"\u21C1",rightharpoondown:"\u21C1",rharu:"\u21C0",rightharpoonup:"\u21C0",lsh:"\u21B0",Lsh:"\u21B0",rsh:"\u21B1",Rsh:"\u21B1",ldsh:"\u21B2",rdsh:"\u21B3",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",mapstoleft:"\u21A4",mapstoup:"\u21A5",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",crarr:"\u21B5",nwarrow:"\u2196",nearrow:"\u2197",searrow:"\u2198",swarrow:"\u2199",nleftarrow:"\u219A",nleftrightarrow:"\u21AE",nrightarrow:"\u219B",nrarr:"\u219B",larrtl:"\u21A2",rarrtl:"\u21A3",leftarrowtail:"\u21A2",rightarrowtail:"\u21A3",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Larr:"\u219E",Rarr:"\u21A0",larrhk:"\u21A9",rarrhk:"\u21AA",larrlp:"\u21AB",looparrowleft:"\u21AB",rarrlp:"\u21AC",looparrowright:"\u21AC",harrw:"\u21AD",leftrightsquigarrow:"\u21AD",nrarrw:"\u219D\u0338",rarrw:"\u219D",rightsquigarrow:"\u219D",larrbfs:"\u291F",rarrbfs:"\u2920",nvHarr:"\u2904",nvlArr:"\u2902",nvrArr:"\u2903",larrfs:"\u291D",rarrfs:"\u291E",Map:"\u2905",larrsim:"\u2973",rarrsim:"\u2974",harrcir:"\u2948",Uarrocir:"\u2949",lurdshar:"\u294A",ldrdhar:"\u2967",ldrushar:"\u294B",rdldhar:"\u2969",lrhard:"\u296D",rlhar:"\u21CC",uharr:"\u21BE",uharl:"\u21BF",dharr:"\u21C2",dharl:"\u21C3",Uarr:"\u219F",Darr:"\u21A1",zigrarr:"\u21DD",nwArr:"\u21D6",neArr:"\u21D7",seArr:"\u21D8",swArr:"\u21D9",nharr:"\u21AE",nhArr:"\u21CE",nlarr:"\u219A",nlArr:"\u21CD",nrarr:"\u219B",nrArr:"\u21CF",larrb:"\u21E4",LeftArrowBar:"\u21E4",rarrb:"\u21E5",RightArrowBar:"\u21E5"},of={square:"\u25A1",Square:"\u25A1",squ:"\u25A1",squf:"\u25AA",squarf:"\u25AA",blacksquar:"\u25AA",blacksquare:"\u25AA",FilledVerySmallSquare:"\u25AA",blk34:"\u2593",blk12:"\u2592",blk14:"\u2591",block:"\u2588",srect:"\u25AD",rect:"\u25AD",sdot:"\u22C5",sdotb:"\u22A1",dotsquare:"\u22A1",triangle:"\u25B5",tri:"\u25B5",trine:"\u25B5",utri:"\u25B5",triangledown:"\u25BF",dtri:"\u25BF",tridown:"\u25BF",triangleleft:"\u25C3",ltri:"\u25C3",triangleright:"\u25B9",rtri:"\u25B9",blacktriangle:"\u25B4",utrif:"\u25B4",blacktriangledown:"\u25BE",dtrif:"\u25BE",blacktriangleleft:"\u25C2",ltrif:"\u25C2",blacktriangleright:"\u25B8",rtrif:"\u25B8",loz:"\u25CA",lozenge:"\u25CA",blacklozenge:"\u29EB",lozf:"\u29EB",bigcirc:"\u25EF",xcirc:"\u25EF",circ:"\u02C6",Circle:"\u25CB",cir:"\u25CB",o:"\u25CB",bullet:"\u2022",bull:"\u2022",hellip:"\u2026",mldr:"\u2026",nldr:"\u2025",boxh:"\u2500",HorizontalLine:"\u2500",boxv:"\u2502",boxdr:"\u250C",boxdl:"\u2510",boxur:"\u2514",boxul:"\u2518",boxvr:"\u251C",boxvl:"\u2524",boxhd:"\u252C",boxhu:"\u2534",boxvh:"\u253C",boxH:"\u2550",boxV:"\u2551",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxDl:"\u2555",boxdL:"\u2556",boxDL:"\u2557",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxUl:"\u255C",boxuL:"\u255B",boxUL:"\u255D",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",boxVl:"\u2562",boxvL:"\u2561",boxVL:"\u2563",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C"},cf={excl:"!",iexcl:"\xA1",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",nbsp:"\xA0",comma:",",period:".",colon:":",semi:";",vert:"|",Verbar:"\u2016",verbar:"|",dblac:"\u02DD",circ:"\u02C6",caron:"\u02C7",breve:"\u02D8",dot:"\u02D9",ring:"\u02DA",ogon:"\u02DB",tilde:"\u02DC",DiacriticalGrave:"`",DiacriticalAcute:"\xB4",DiacriticalTilde:"\u02DC",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",grave:"`",acute:"\xB4"},Nr={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",euro:"\u20AC",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},uf={frac12:"\xBD",half:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044"},lf={trade:"\u2122",TRADE:"\u2122",telrec:"\u2315",target:"\u2316",ulcorn:"\u231C",ulcorner:"\u231C",urcorn:"\u231D",urcorner:"\u231D",dlcorn:"\u231E",llcorner:"\u231E",drcorn:"\u231F",lrcorner:"\u231F",intercal:"\u22BA",intcal:"\u22BA",oplus:"\u2295",CirclePlus:"\u2295",ominus:"\u2296",CircleMinus:"\u2296",otimes:"\u2297",CircleTimes:"\u2297",osol:"\u2298",odot:"\u2299",CircleDot:"\u2299",oast:"\u229B",circledast:"\u229B",odash:"\u229D",circleddash:"\u229D",ocirc:"\u229A",circledcirc:"\u229A",boxplus:"\u229E",plusb:"\u229E",boxminus:"\u229F",minusb:"\u229F",boxtimes:"\u22A0",timesb:"\u22A0",boxdot:"\u22A1",sdotb:"\u22A1",veebar:"\u22BB",vee:"\u2228",barvee:"\u22BD",and:"\u2227",wedge:"\u2227",Cap:"\u22D2",Cup:"\u22D3",Fork:"\u22D4",pitchfork:"\u22D4",epar:"\u22D5",ltlarr:"\u2976",nvap:"\u224D\u20D2",nvsim:"\u223C\u20D2",nvge:"\u2265\u20D2",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvgt:">\u20D2",nvltrie:"\u22B4\u20D2",nvrtrie:"\u22B5\u20D2",Vdash:"\u22A9",dashv:"\u22A3",vDash:"\u22A8",Vdash:"\u22A9",Vvdash:"\u22AA",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF"},vA={...Jd,...Zd,...ef,...tf,...rf,...nf,...sf,...af,...of,...cf,...Nr,...uf,...lf},Gt={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},un={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"};var bA=new Set("!?\\\\/[]$%{}^&*()<>|+");function df(e){if(e[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if(bA.has(t))throw new Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}n(df,"validateEntityName");function ln(...e){let t=Object.create(null);for(let r of e)if(r)for(let i of Object.keys(r)){let s=r[i];if(typeof s=="string")t[i]=s;else if(s&&typeof s=="object"&&s.val!==void 0){let a=s.val;typeof a=="string"&&(t[i]=a)}}return t}n(ln,"mergeEntityMaps");var Ne="external",Or="base",dn="all";function SA(e){return!e||e===Ne?new Set([Ne]):e===dn?new Set([dn]):e===Or?new Set([Or]):Array.isArray(e)?new Set(e):new Set([Ne])}n(SA,"parseLimitTiers");var K=Object.freeze({allow:0,leave:1,remove:2,throw:3}),wA=new Set([9,10,13]);function TA(e){if(!e)return{xmlVersion:1,onLevel:K.allow,nullLevel:K.remove};let t=e.xmlVersion===1.1?1.1:1,r=K[e.onNCR]??K.allow,i=K[e.nullNCR]??K.remove,s=Math.max(i,K.remove);return{xmlVersion:t,onLevel:r,nullLevel:s}}n(TA,"parseNCRConfig");var st=class{static{n(this,"EntityDecoder")}constructor(t={}){this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof t.postCheck=="function"?t.postCheck:i=>i,this._limitTiers=SA(this._limit.applyLimitsTo??Ne),this._numericAllowed=t.numericAllowed??!0,this._baseMap=ln(Gt,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);let r=TA(t.ncr);this._ncrXmlVersion=r.xmlVersion,this._ncrOnLevel=r.onLevel,this._ncrNullLevel=r.nullLevel}setExternalEntities(t){if(t)for(let r of Object.keys(t))df(r);this._externalMap=ln(t)}addExternalEntity(t,r){df(t),typeof r=="string"&&r.indexOf("&")===-1&&(this._externalMap[t]=r)}addInputEntities(t){this._totalExpansions=0,this._expandedLength=0,this._inputMap=ln(t)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(t){this._ncrXmlVersion=t===1.1?1.1:1}decode(t){if(typeof t!="string"||t.length===0)return t;let r=t,i=[],s=t.length,a=0,c=0,o=this._maxTotalExpansions>0,u=this._maxExpandedLength>0,l=o||u;for(;c<s;){if(t.charCodeAt(c)!==38){c++;continue}let h=c+1;for(;h<s&&t.charCodeAt(h)!==59&&h-c<=32;)h++;if(h>=s||t.charCodeAt(h)!==59){c++;continue}let m=t.slice(c+1,h);if(m.length===0){c++;continue}let S,E;if(this._removeSet.has(m))S="",E===void 0&&(E=Ne);else if(this._leaveSet.has(m)){c++;continue}else if(m.charCodeAt(0)===35){let w=this._resolveNCR(m);if(w===void 0){c++;continue}S=w,E=Or}else{let w=this._resolveName(m);S=w?.value,E=w?.tier}if(S===void 0){c++;continue}if(c>a&&i.push(t.slice(a,c)),i.push(S),a=h+1,c=a,l&&this._tierCounts(E)){if(o&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(u){let w=S.length-(m.length+2);if(w>0&&(this._expandedLength+=w,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}a<s&&i.push(t.slice(a));let d=i.length===0?t:i.join("");return this._postCheck(d,r)}_tierCounts(t){return this._limitTiers.has(dn)?!0:this._limitTiers.has(t)}_resolveName(t){if(t in this._inputMap)return{value:this._inputMap[t],tier:Ne};if(t in this._externalMap)return{value:this._externalMap[t],tier:Ne};if(t in this._baseMap)return{value:this._baseMap[t],tier:Or}}_classifyNCR(t){return t===0?this._ncrNullLevel:t>=55296&&t<=57343||this._ncrXmlVersion===1&&t>=1&&t<=31&&!wA.has(t)?K.remove:-1}_applyNCRAction(t,r,i){switch(t){case K.allow:return String.fromCodePoint(i);case K.remove:return"";case K.leave:return;case K.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${r}; (U+${i.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(i)}}_resolveNCR(t){let r=t.charCodeAt(1),i;if(r===120||r===88?i=parseInt(t.slice(2),16):i=parseInt(t.slice(1),10),Number.isNaN(i)||i<0||i>1114111)return;let s=this._classifyNCR(i);if(!this._numericAllowed&&s<K.remove)return;let a=s===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,s);return this._applyNCRAction(a,t,i)}};var ff=n(e=>$t.includes(e)?"__"+e:e,"defaultOnDangerousProperty"),_A={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:n(function(e,t){return t},"tagValueProcessor"),attributeValueProcessor:n(function(e,t){return t},"attributeValueProcessor"),stopNodes:[],alwaysCreateTextNode:!1,isArray:n(()=>!1,"isArray"),commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:n(function(e,t,r){return e},"updateTag"),captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:ff};function CA(e,t){if(typeof e!="string")return;let r=e.toLowerCase();if($t.some(i=>r===i.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);if(Pr.some(i=>r===i.toLowerCase()))throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}n(CA,"validatePropertyName");function pf(e,t){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof e=="object"&&e!==null?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??"all"}:pf(!0)}n(pf,"normalizeProcessEntities");var hf=n(function(e){let t=Object.assign({},_A,e),r=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(let{value:i,name:s}of r)i&&CA(i,s);return t.onDangerousProperty===null&&(t.onDangerousProperty=ff),t.processEntities=pf(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(i=>typeof i=="string"&&i.startsWith("*.")?".."+i.substring(2):i)),t},"buildOptions");var Ir;typeof Symbol!="function"?Ir="@@xmlMetadata":Ir=Symbol("XML Node Metadata");var z=class{static{n(this,"XmlNode")}constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t,r){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),r!==void 0&&(this.child[this.child.length-1][Ir]={startIndex:r})}static getMetaDataSymbol(){return Ir}};var mf=":A-Za-z_\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",EA=mf+"\\-\\.\\d\xB7\u0300-\u036F\u203F-\u2040",gf=":A-Za-z_\xC0-\u02FF\u0370-\u037D\u037F-\u0486\u0488-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}",AA=gf+"\\-\\.\\d\xB7\u0300-\u036F\u0487\u203F-\u2040",yf=n((e,t,r="")=>{let i=e.replace(":",""),s=t.replace(":",""),a=`[${i}][${s}]*`;return{name:new RegExp(`^[${e}][${t}]*$`,r),ncName:new RegExp(`^${a}$`,r),qName:new RegExp(`^${a}(?::${a})?$`,r),nmToken:new RegExp(`^[${t}]+$`,r),nmTokens:new RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,r)}},"buildRegexes"),xA=yf(mf,EA),PA=yf(gf,AA,"u"),NA=n((e="1.0")=>e==="1.1"?PA:xA,"getRegexes");var fn=n((e,{xmlVersion:t="1.0"}={})=>NA(t).qName.test(e),"qName");var Ht=class{static{n(this,"DocTypeReader")}constructor(t,r){this.suppressValidationErr=!t,this.options=t,this.xmlVersion=r||1}setXmlVersion(t=1){this.xmlVersion=t}readDocType(t,r){let i=Object.create(null),s=0;if(t[r+3]==="O"&&t[r+4]==="C"&&t[r+5]==="T"&&t[r+6]==="Y"&&t[r+7]==="P"&&t[r+8]==="E"){r=r+9;let a=1,c=!1,o=!1,u="";for(;r<t.length;r++)if(t[r]==="<"&&!o){if(c&&Oe(t,"!ENTITY",r)){r+=7;let l,d;if([l,d,r]=this.readEntityExp(t,r+1,this.suppressValidationErr),d.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);i[l]=d,s++}}else if(c&&Oe(t,"!ELEMENT",r)){r+=8;let{index:l}=this.readElementExp(t,r+1);r=l}else if(c&&Oe(t,"!ATTLIST",r))r+=8;else if(c&&Oe(t,"!NOTATION",r)){r+=9;let{index:l}=this.readNotationExp(t,r+1,this.suppressValidationErr);r=l}else if(Oe(t,"!--",r))o=!0;else throw new Error("Invalid DOCTYPE");a++,u=""}else if(t[r]===">"){if(o?t[r-1]==="-"&&t[r-2]==="-"&&(o=!1,a--):a--,a===0)break}else t[r]==="["?c=!0:u+=t[r];if(a!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:r}}readEntityExp(t,r){r=Y(t,r);let i=r;for(;r<t.length&&!/\s/.test(t[r])&&t[r]!=='"'&&t[r]!=="'";)r++;let s=t.substring(i,r);if(Vt(s,{xmlVersion:this.xmlVersion}),r=Y(t,r),!this.suppressValidationErr){if(t.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[r]==="%")throw new Error("Parameter entities are not supported")}let a="";if([r,a]=this.readIdentifierVal(t,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&a.length>this.options.maxEntitySize)throw new Error(`Entity "${s}" size (${a.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[s,a,r]}readNotationExp(t,r){r=Y(t,r);let i=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(i,r);!this.suppressValidationErr&&Vt(s,{xmlVersion:this.xmlVersion}),r=Y(t,r);let a=t.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&a!=="SYSTEM"&&a!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${a}"`);r+=a.length,r=Y(t,r);let c=null,o=null;if(a==="PUBLIC")[r,c]=this.readIdentifierVal(t,r,"publicIdentifier"),r=Y(t,r),(t[r]==='"'||t[r]==="'")&&([r,o]=this.readIdentifierVal(t,r,"systemIdentifier"));else if(a==="SYSTEM"&&([r,o]=this.readIdentifierVal(t,r,"systemIdentifier"),!this.suppressValidationErr&&!o))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:c,systemIdentifier:o,index:--r}}readIdentifierVal(t,r,i){let s="",a=t[r];if(a!=='"'&&a!=="'")throw new Error(`Expected quoted string, found "${a}"`);r++;let c=r;for(;r<t.length&&t[r]!==a;)r++;if(s=t.substring(c,r),t[r]!==a)throw new Error(`Unterminated ${i} value`);return r++,[r,s]}readElementExp(t,r){r=Y(t,r);let i=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(i,r);if(!this.suppressValidationErr&&!fn(s,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${s}"`);r=Y(t,r);let a="";if(t[r]==="E"&&Oe(t,"MPTY",r))r+=4;else if(t[r]==="A"&&Oe(t,"NY",r))r+=2;else if(t[r]==="("){r++;let c=r;for(;r<t.length&&t[r]!==")";)r++;if(a=t.substring(c,r),t[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[r]}"`);return{elementName:s,contentModel:a.trim(),index:r}}readAttlistExp(t,r){r=Y(t,r);let i=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let s=t.substring(i,r);for(Vt(s,{xmlVersion:this.xmlVersion}),r=Y(t,r),i=r;r<t.length&&!/\s/.test(t[r]);)r++;let a=t.substring(i,r);if(!Vt(a,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${a}"`);r=Y(t,r);let c="";if(t.substring(r,r+8).toUpperCase()==="NOTATION"){if(c="NOTATION",r+=8,r=Y(t,r),t[r]!=="(")throw new Error(`Expected '(', found "${t[r]}"`);r++;let u=[];for(;r<t.length&&t[r]!==")";){let l=r;for(;r<t.length&&t[r]!=="|"&&t[r]!==")";)r++;let d=t.substring(l,r);if(d=d.trim(),!Vt(d,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${d}"`);u.push(d),t[r]==="|"&&(r++,r=Y(t,r))}if(t[r]!==")")throw new Error("Unterminated list of notations");r++,c+=" ("+u.join("|")+")"}else{let u=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;c+=t.substring(u,r);let l=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!l.includes(c.toUpperCase()))throw new Error(`Invalid attribute type: "${c}"`)}r=Y(t,r);let o="";return t.substring(r,r+8).toUpperCase()==="#REQUIRED"?(o="#REQUIRED",r+=8):t.substring(r,r+7).toUpperCase()==="#IMPLIED"?(o="#IMPLIED",r+=7):[r,o]=this.readIdentifierVal(t,r,"ATTLIST"),{elementName:s,attributeName:a,attributeType:c,defaultValue:o,index:r}}},Y=n((e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t},"skipWhitespace");function Oe(e,t,r){for(let i=0;i<t.length;i++)if(t[i]!==e[r+i+1])return!1;return!0}n(Oe,"hasSeq");function Vt(e,t){if(fn(e,{xmlVersion:t}))return e;throw new Error(`Invalid entity name ${e}`)}n(Vt,"validateEntityName");var OA=/^[-+]?0x[a-fA-F0-9]+$/,IA=/^0b[01]+$/,qA=/^0o[0-7]+$/,MA=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,FA={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function hn(e,t={}){if(t=Object.assign({},FA,t),!e||typeof e!="string")return e;let r=e.trim();if(r.length===0)return e;if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(r==="0")return 0;if(t.hex&&OA.test(r))return pn(r,16);if(t.binary&&IA.test(r))return pn(r,2);if(t.octal&&qA.test(r))return pn(r,8);if(isFinite(r)){if(r.includes("e")||r.includes("E"))return LA(e,r,t);{let i=MA.exec(r);if(i){let s=i[1]||"",a=i[2],c=UA(i[3]),o=s?e[a.length+1]===".":e[a.length]===".";if(!t.leadingZeros&&(a.length>1||a.length===1&&!o))return e;{let u=Number(r),l=String(u);if(u===0)return u;if(l.search(/[eE]/)!==-1)return t.eNotation?u:e;if(r.indexOf(".")!==-1)return l==="0"||l===c||l===`${s}${c}`?u:e;let d=a?c:r;return a?d===l||s+d===l?u:e:d===l||d===s+l?u:e}}else return e}}else return kA(e,Number(r),t)}n(hn,"toNumber");var RA=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function LA(e,t,r){if(!r.eNotation)return e;let i=t.match(RA);if(i){let s=i[1]||"",a=i[3].indexOf("e")===-1?"E":"e",c=i[2],o=s?e[c.length+1]===a:e[c.length]===a;return c.length>1&&o?e:c.length===1&&(i[3].startsWith(`.${a}`)||i[3][0]===a)?Number(t):c.length>0?r.leadingZeros&&!o?(t=(i[1]||"")+i[3],Number(t)):e:Number(t)}else return e}n(LA,"resolveEnotation");function UA(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}n(UA,"trimZeros");function pn(e,t){let r=e.trim();if((t===2||t===8)&&(e=r.substring(2)),parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}n(pn,"parse_int");function kA(e,t,r){let i=t===1/0;switch(r.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return i?"Infinity":"-Infinity";default:return e}}n(kA,"handleInfinity");function mn(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(let r of e)if(typeof r=="string"&&t===r||r instanceof RegExp&&r.test(t))return!0}:()=>!1}n(mn,"getIgnoreAttributesFn");var Ie=class{static{n(this,"Expression")}constructor(t,r={},i){this.pattern=t,this.separator=r.separator||".",this.segments=this._parse(t),this.data=i,this._hasDeepWildcard=this.segments.some(s=>s.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(s=>s.attrName!==void 0),this._hasPositionSelector=this.segments.some(s=>s.position!==void 0)}_parse(t){let r=[],i=0,s="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(s.trim()&&(r.push(this._parseSegment(s.trim())),s=""),r.push({type:"deep-wildcard"}),i+=2):(s.trim()&&r.push(this._parseSegment(s.trim())),s="",i++):(s+=t[i],i++);return s.trim()&&r.push(this._parseSegment(s.trim())),r}_parseSegment(t){let r={type:"tag"},i=null,s=t,a=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(a&&(s=a[1]+a[3],a[2])){let d=a[2].slice(1,-1);d&&(i=d)}let c,o=s;if(s.includes("::")){let d=s.indexOf("::");if(c=s.substring(0,d).trim(),o=s.substring(d+2).trim(),!c)throw new Error(`Invalid namespace in pattern: ${t}`)}let u,l=null;if(o.includes(":")){let d=o.lastIndexOf(":"),h=o.substring(0,d).trim(),m=o.substring(d+1).trim();["first","last","odd","even"].includes(m)||/^nth\(\d+\)$/.test(m)?(u=h,l=m):u=o}else u=o;if(!u)throw new Error(`Invalid segment pattern: ${t}`);if(r.tag=u,c&&(r.namespace=c),i)if(i.includes("=")){let d=i.indexOf("=");r.attrName=i.substring(0,d).trim(),r.attrValue=i.substring(d+1).trim()}else r.attrName=i.trim();if(l){let d=l.match(/^nth\((\d+)\)$/);d?(r.position="nth",r.positionValue=parseInt(d[1],10)):r.position=l}return r}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var at=class{static{n(this,"ExpressionSet")}constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(t){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(t.pattern))return this;if(this._patterns.add(t.pattern),t.hasDeepWildcard())return this._deepWildcards.push(t),this;let r=t.length,s=t.segments[t.segments.length-1]?.tag;if(!s||s==="*")this._wildcardByDepth.has(r)||this._wildcardByDepth.set(r,[]),this._wildcardByDepth.get(r).push(t);else{let a=`${r}:${s}`;this._byDepthAndTag.has(a)||this._byDepthAndTag.set(a,[]),this._byDepthAndTag.get(a).push(t)}return this}addAll(t){for(let r of t)this.add(r);return this}has(t){return this._patterns.has(t.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(t){return this.findMatch(t)!==null}findMatch(t){let r=t.getDepth(),i=t.getCurrentTag(),s=`${r}:${i}`,a=this._byDepthAndTag.get(s);if(a){for(let o=0;o<a.length;o++)if(t.matches(a[o]))return a[o]}let c=this._wildcardByDepth.get(r);if(c){for(let o=0;o<c.length;o++)if(t.matches(c[o]))return c[o]}for(let o=0;o<this._deepWildcards.length;o++)if(t.matches(this._deepWildcards[o]))return this._deepWildcards[o];return null}};var gn=class{static{n(this,"MatcherView")}constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){let t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){let t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){let r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[t]}hasAttr(t){let r=this._matcher.path;if(r.length===0)return!1;let i=r[r.length-1];return i.values!==void 0&&t in i.values}getPosition(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].position??0}getCounter(){let t=this._matcher.path;return t.length===0?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,r=!0){return this._matcher.toString(t,r)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}},ot=class{static{n(this,"Matcher")}constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new gn(this)}push(t,r=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let s=this.path.length;this.siblingStacks[s]||(this.siblingStacks[s]=new Map);let a=this.siblingStacks[s],c=i?`${i}:${t}`:t,o=a.get(c)||0,u=0;for(let d of a.values())u+=d;a.set(c,o+1);let l={tag:t,position:u,counter:o};i!=null&&(l.namespace=i),r!=null&&(l.values=r),this.path.push(l)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){let r=this.path[this.path.length-1];t!=null&&(r.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(this.path.length!==0)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;let r=this.path[this.path.length-1];return r.values!==void 0&&t in r.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,r=!0){let i=t||this.separator;if(i===this.separator&&r===!0){if(this._pathStringCache!==null)return this._pathStringCache;let a=this.path.map(c=>c.namespace?`${c.namespace}:${c.tag}`:c.tag).join(i);return this._pathStringCache=a,a}return this.path.map(a=>r&&a.namespace?`${a.namespace}:${a.tag}`:a.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(t){let r=t.segments;return r.length===0?!1:t.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let r=0;r<t.length;r++)if(!this._matchSegment(t[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let r=this.path.length-1,i=t.length-1;for(;i>=0&&r>=0;){let s=t[i];if(s.type==="deep-wildcard"){if(i--,i<0)return!0;let a=t[i],c=!1;for(let o=r;o>=0;o--)if(this._matchSegment(a,this.path[o],o===this.path.length-1)){r=o-1,i--,c=!0;break}if(!c)return!1}else{if(!this._matchSegment(s,this.path[r],r===this.path.length-1))return!1;r--,i--}}return i<0}_matchSegment(t,r,i){if(t.tag!=="*"&&t.tag!==r.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==r.namespace||t.attrName!==void 0&&(!i||!r.values||!(t.attrName in r.values)||t.attrValue!==void 0&&String(r.values[t.attrName])!==String(t.attrValue)))return!1;if(t.position!==void 0){if(!i)return!1;let s=r.counter??0;if(t.position==="first"&&s!==0)return!1;if(t.position==="odd"&&s%2!==1)return!1;if(t.position==="even"&&s%2!==0)return!1;if(t.position==="nth"&&s!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this._pathStringCache=null,this.path=t.path.map(r=>({...r})),this.siblingStacks=t.siblingStacks.map(r=>new Map(r))}readOnly(){return this._view}};function DA(e,t){if(!e)return{};let r=t.attributesGroupName?e[t.attributesGroupName]:e;if(!r)return{};let i={};for(let s in r)if(s.startsWith(t.attributeNamePrefix)){let a=s.substring(t.attributeNamePrefix.length);i[a]=r[s]}else i[s]=r[s];return i}n(DA,"extractRawAttributes");function jA(e){if(!e||typeof e!="string")return;let t=e.indexOf(":");if(t!==-1&&t>0){let r=e.substring(0,t);if(r!=="xmlns")return r}}n(jA,"extractNamespace");var Wt=class{static{n(this,"OrderedObjParser")}constructor(t,r){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=HA,this.parseTextData=$A,this.resolveNameSpace=BA,this.buildAttributesMap=VA,this.isItStopNode=zA,this.replaceEntitiesValue=QA,this.readStopNodeData=JA,this.saveTextToParentTag=KA,this.addChild=WA,this.ignoreAttributesFn=mn(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let i={...Gt};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?i=this.options.htmlEntities:this.options.htmlEntities===!0&&(i={...un,...Nr}),this.entityDecoder=new st({namedEntities:{...i,...r},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new ot,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new at;let s=this.options.stopNodes;if(s&&s.length>0){for(let a=0;a<s.length;a++){let c=s[a];typeof c=="string"?this.stopNodeExpressionsSet.add(new Ie(c)):c instanceof Ie&&this.stopNodeExpressionsSet.add(c)}this.stopNodeExpressionsSet.seal()}}};function $A(e,t,r,i,s,a,c){let o=this.options;if(e!==void 0&&(o.trimValues&&!i&&(e=e.trim()),e.length>0)){c||(e=this.replaceEntitiesValue(e,t,r));let u=o.jPath?r.toString():r,l=o.tagValueProcessor(t,e,u,s,a);return l==null?e:typeof l!=typeof e||l!==e?l:o.trimValues||e.trim()===e?bn(e,o.parseTagValue,o.numberParseOptions):e}}n($A,"parseTextData");function BA(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}n(BA,"resolveNameSpace");var GA=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function VA(e,t,r,i=!1){let s=this.options;if(i===!0||s.ignoreAttributes!==!0&&typeof e=="string"){let a=xr(e,GA),c=a.length,o={},u=new Array(c),l=!1,d={};for(let S=0;S<c;S++){let E=this.resolveNameSpace(a[S][1]),w=a[S][4];if(E.length&&w!==void 0){let C=w;s.trimValues&&(C=C.trim()),C=this.replaceEntitiesValue(C,r,this.readonlyMatcher),u[S]=C,d[E]=C,l=!0}}l&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(d);let h=s.jPath?t.toString():this.readonlyMatcher,m=!1;for(let S=0;S<c;S++){let E=this.resolveNameSpace(a[S][1]);if(this.ignoreAttributesFn(E,h))continue;let w=s.attributeNamePrefix+E;if(E.length)if(s.transformAttributeName&&(w=s.transformAttributeName(w)),w=vf(w,s),a[S][4]!==void 0){let C=u[S],x=s.attributeValueProcessor(E,C,h);x==null?o[w]=C:typeof x!=typeof C||x!==C?o[w]=x:o[w]=bn(C,s.parseAttributeValue,s.numberParseOptions),m=!0}else s.allowBooleanAttributes&&(o[w]=!0,m=!0)}if(!m)return;if(s.attributesGroupName&&!s.preserveOrder){let S={};return S[s.attributesGroupName]=o,S}return o}}n(VA,"buildAttributesMap");var HA=n(function(e){e=e.replace(/\r\n?/g,`
`);let t=new z("!xml"),r=t,i="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let s=this.options,a=new Ht(s.processEntities),c=e.length;for(let o=0;o<c;o++)if(e[o]==="<"){let l=e.charCodeAt(o+1);if(l===47){let d=ct(e,">",o,"Closing Tag is not closed."),h=e.substring(o+2,d).trim();if(s.removeNSPrefix){let S=h.indexOf(":");S!==-1&&(h=h.substr(S+1))}h=yn(s.transformTagName,h,"",s).tagName,r&&(i=this.saveTextToParentTag(i,r,this.readonlyMatcher));let m=this.matcher.getCurrentTag();if(h&&s.unpairedTagsSet.has(h))throw new Error(`Unpaired tag can not be used as closing tag: </${h}>`);m&&s.unpairedTagsSet.has(m)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop(),i="",o=d}else if(l===63){let d=vn(e,o,!1,"?>");if(!d)throw new Error("Pi Tag is not closed.");i=this.saveTextToParentTag(i,r,this.readonlyMatcher);let h=this.buildAttributesMap(d.tagExp,this.matcher,d.tagName,!0);if(h){let m=h[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(m)||1),a.setXmlVersion(Number(m)||1)}if(!(s.ignoreDeclaration&&d.tagName==="?xml"||s.ignorePiTags)){let m=new z(d.tagName);m.add(s.textNodeName,""),d.tagName!==d.tagExp&&d.attrExpPresent&&s.ignoreAttributes!==!0&&(m[":@"]=h),this.addChild(r,m,this.readonlyMatcher,o)}o=d.closeIndex+1}else if(l===33&&e.charCodeAt(o+2)===45&&e.charCodeAt(o+3)===45){let d=ct(e,"-->",o+4,"Comment is not closed.");if(s.commentPropName){let h=e.substring(o+4,d-2);i=this.saveTextToParentTag(i,r,this.readonlyMatcher),r.add(s.commentPropName,[{[s.textNodeName]:h}])}o=d}else if(l===33&&e.charCodeAt(o+2)===68){let d=a.readDocType(e,o);this.entityDecoder.addInputEntities(d.entities),o=d.i}else if(l===33&&e.charCodeAt(o+2)===91){let d=ct(e,"]]>",o,"CDATA is not closed.")-2,h=e.substring(o+9,d);i=this.saveTextToParentTag(i,r,this.readonlyMatcher);let m=this.parseTextData(h,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);m==null&&(m=""),s.cdataPropName?r.add(s.cdataPropName,[{[s.textNodeName]:h}]):r.add(s.textNodeName,m),o=d+2}else{let d=vn(e,o,s.removeNSPrefix);if(!d){let $=e.substring(Math.max(0,o-50),Math.min(c,o+50));throw new Error(`readTagExp returned undefined at position ${o}. Context: "${$}"`)}let h=d.tagName,m=d.rawTagName,S=d.tagExp,E=d.attrExpPresent,w=d.closeIndex;if({tagName:h,tagExp:S}=yn(s.transformTagName,h,S,s),s.strictReservedNames&&(h===s.commentPropName||h===s.cdataPropName||h===s.textNodeName||h===s.attributesGroupName))throw new Error(`Invalid tag name: ${h}`);r&&i&&r.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,r,this.readonlyMatcher,!1));let C=r;C&&s.unpairedTagsSet.has(C.tagname)&&(r=this.tagsNodeStack.pop(),this.matcher.pop());let x=!1;S.length>0&&S.lastIndexOf("/")===S.length-1&&(x=!0,h[h.length-1]==="/"?(h=h.substr(0,h.length-1),S=h):S=S.substr(0,S.length-1),E=h!==S);let L=null,H={},ce;ce=jA(m),h!==t.tagname&&this.matcher.push(h,{},ce),h!==S&&E&&(L=this.buildAttributesMap(S,this.matcher,h),L&&(H=DA(L,s))),h!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let te=o;if(this.isCurrentNodeStopNode){let $="";if(x)o=d.closeIndex;else if(s.unpairedTagsSet.has(h))o=d.closeIndex;else{let _t=this.readStopNodeData(e,m,w+1);if(!_t)throw new Error(`Unexpected end of ${m}`);o=_t.i,$=_t.tagContent}let Ae=new z(h);L&&(Ae[":@"]=L),Ae.add(s.textNodeName,$),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,Ae,this.readonlyMatcher,te)}else{if(x){({tagName:h,tagExp:S}=yn(s.transformTagName,h,S,s));let $=new z(h);L&&($[":@"]=L),this.addChild(r,$,this.readonlyMatcher,te),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(s.unpairedTagsSet.has(h)){let $=new z(h);L&&($[":@"]=L),this.addChild(r,$,this.readonlyMatcher,te),this.matcher.pop(),this.isCurrentNodeStopNode=!1,o=d.closeIndex;continue}else{let $=new z(h);if(this.tagsNodeStack.length>s.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),L&&($[":@"]=L),this.addChild(r,$,this.readonlyMatcher,te),r=$}i="",o=w}}}else i+=e[o];return t.child},"parseXml");function WA(e,t,r,i){this.options.captureMetaData||(i=void 0);let s=this.options.jPath?r.toString():r,a=this.options.updateTag(t.tagname,s,t[":@"]);a===!1||(typeof a=="string"&&(t.tagname=a),e.addChild(t,i))}n(WA,"addChild");function QA(e,t,r){let i=this.options.processEntities;if(!i||!i.enabled)return e;if(i.allowedTags){let s=this.options.jPath?r.toString():r;if(!(Array.isArray(i.allowedTags)?i.allowedTags.includes(t):i.allowedTags(t,s)))return e}if(i.tagFilter){let s=this.options.jPath?r.toString():r;if(!i.tagFilter(t,s))return e}return this.entityDecoder.decode(e)}n(QA,"replaceEntitiesValue");function KA(e,t,r,i){return e&&(i===void 0&&(i=t.child.length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,i),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}n(KA,"saveTextToParentTag");function zA(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}n(zA,"isItStopNode");function YA(e,t,r=">"){let i=0,s=e.length,a=r.charCodeAt(0),c=r.length>1?r.charCodeAt(1):-1,o="",u=t;for(let l=t;l<s;l++){let d=e.charCodeAt(l);if(i)d===i&&(i=0);else if(d===34||d===39)i=d;else if(d===a)if(c!==-1){if(e.charCodeAt(l+1)===c)return o+=e.substring(u,l),{data:o,index:l}}else return o+=e.substring(u,l),{data:o,index:l};else d===9&&!i&&(o+=e.substring(u,l)+" ",u=l+1)}}n(YA,"tagExpWithClosingIndex");function ct(e,t,r,i){let s=e.indexOf(t,r);if(s===-1)throw new Error(i);return s+t.length-1}n(ct,"findClosingIndex");function XA(e,t,r,i){let s=e.indexOf(t,r);if(s===-1)throw new Error(i);return s}n(XA,"findClosingChar");function vn(e,t,r,i=">"){let s=YA(e,t+1,i);if(!s)return;let a=s.data,c=s.index,o=a.search(/\s/),u=a,l=!0;o!==-1&&(u=a.substring(0,o),a=a.substring(o+1).trimStart());let d=u;if(r){let h=u.indexOf(":");h!==-1&&(u=u.substr(h+1),l=u!==s.data.substr(h+1))}return{tagName:u,tagExp:a,closeIndex:c,attrExpPresent:l,rawTagName:d}}n(vn,"readTagExp");function JA(e,t,r){let i=r,s=1,a=e.length;for(;r<a;r++)if(e[r]==="<"){let c=e.charCodeAt(r+1);if(c===47){let o=XA(e,">",r,`${t} is not closed`);if(e.substring(r+2,o).trim()===t&&(s--,s===0))return{tagContent:e.substring(i,r),i:o};r=o}else if(c===63)r=ct(e,"?>",r+1,"StopNode is not closed.");else if(c===33&&e.charCodeAt(r+2)===45&&e.charCodeAt(r+3)===45)r=ct(e,"-->",r+3,"StopNode is not closed.");else if(c===33&&e.charCodeAt(r+2)===91)r=ct(e,"]]>",r,"StopNode is not closed.")-2;else{let o=vn(e,r,!1);o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,r=o.closeIndex)}}}n(JA,"readStopNodeData");function bn(e,t,r){if(t&&typeof e=="string"){let i=e.trim();return i==="true"?!0:i==="false"?!1:hn(e,r)}else return Wd(e)?e:""}n(bn,"parseValue");function yn(e,t,r,i){if(e){let s=e(t);r===t&&(r=s),t=s}return t=vf(t,i),{tagName:t,tagExp:r}}n(yn,"transformTagName");function vf(e,t){if(Pr.includes(e))throw new Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return $t.includes(e)?t.onDangerousProperty(e):e}n(vf,"sanitizeName");var Sn=z.getMetaDataSymbol();function ZA(e,t){if(!e||typeof e!="object")return{};if(!t)return e;let r={};for(let i in e)if(i.startsWith(t)){let s=i.substring(t.length);r[s]=e[i]}else r[i]=e[i];return r}n(ZA,"stripAttributePrefix");function wn(e,t,r,i){return bf(e,t,r,i)}n(wn,"prettify");function bf(e,t,r,i){let s,a={};for(let c=0;c<e.length;c++){let o=e[c],u=ex(o);if(u!==void 0&&u!==t.textNodeName){let l=ZA(o[":@"]||{},t.attributeNamePrefix);r.push(u,l)}if(u===t.textNodeName)s===void 0?s=o[u]:s+=""+o[u];else{if(u===void 0)continue;if(o[u]){let l=bf(o[u],t,r,i),d=rx(l,t);if(Object.keys(l).length===0&&t.alwaysCreateTextNode&&(l[t.textNodeName]=""),o[":@"]?tx(l,o[":@"],i,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),o[Sn]!==void 0&&typeof l=="object"&&l!==null&&(l[Sn]=o[Sn]),a[u]!==void 0&&Object.prototype.hasOwnProperty.call(a,u))Array.isArray(a[u])||(a[u]=[a[u]]),a[u].push(l);else{let h=t.jPath?i.toString():i;t.isArray(u,h,d)?a[u]=[l]:a[u]=l}u!==void 0&&u!==t.textNodeName&&r.pop()}}}return typeof s=="string"?s.length>0&&(a[t.textNodeName]=s):s!==void 0&&(a[t.textNodeName]=s),a}n(bf,"compress");function ex(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let i=t[r];if(i!==":@")return i}}n(ex,"propName");function tx(e,t,r,i){if(t){let s=Object.keys(t),a=s.length;for(let c=0;c<a;c++){let o=s[c],u=o.startsWith(i.attributeNamePrefix)?o.substring(i.attributeNamePrefix.length):o,l=i.jPath?r.toString()+"."+u:r;i.isArray(o,l,!0,!0)?e[o]=[t[o]]:e[o]=t[o]}}}n(tx,"assignAttributes");function rx(e,t){let{textNodeName:r}=t,i=Object.keys(e).length;return!!(i===0||i===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}n(rx,"isLeafTag");var ut=class{static{n(this,"XMLParser")}constructor(t){this.externalEntities={},this.options=hf(t)}parse(t,r){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let a=Xd(t,r);if(a!==!0)throw Error(`${a.err.msg}:${a.err.line}:${a.err.col}`)}let i=new Wt(this.options,this.externalEntities),s=i.parseXml(t);return this.options.preserveOrder||s===void 0?s:wn(s,this.options,i.matcher,i.readonlyMatcher)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}static getMetaDataSymbol(){return z.getMetaDataSymbol()}};var qf=require("../../open-ux-shared/logger/index.js"),qe=Et(If(),1);var y=class e{static{n(this,"LoggerHelper")}static _logger=new qf.ToolsLogger({logPrefix:"@sap-ux/odata-service-inquirer"});static get logger(){return e._logger}static set logger(t){e._logger=t}static attachAxiosLogger(t){let r=typeof e.logger.getLogLevel=="function"&&e.logger.getLogLevel()==="trace",i=e.logger.debug.bind(e.logger);t.request.use(s=>(s.url||i(`Request URL: ${s.baseURL}`),qe.requestLogger(s,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:i})),s=>qe.errorLogger(s,{logger:i})),t.response.use(s=>qe.responseLogger(s,{data:r,status:!0,headers:!0,logger:i}),s=>qe.errorLogger(s,{logger:i}))}};var v=class e{static{n(this,"PromptState")}static odataService={};static isYUI=!1;static backendSystemsCache=[];static reset(){Object.keys(e.odataService).forEach(t=>{e.odataService[t]=void 0})}static resetConnectedSystem(){e.odataService.connectedSystem=void 0}};var kf=require("../../open-ux-shared/annotation-converter/index.js"),Df=require("../../open-ux-shared/edmx-parser/index.js"),xn=Et(Lf(),1),Pn=require("../../open-ux-shared/store/index.js");function D(){return v.isYUI?(0,Uf.isAppStudio)()?Dr.hostEnvironment.bas:Dr.hostEnvironment.vscode:Dr.hostEnvironment.cli}n(D,"getPromptHostEnvironment");function jf(e){try{let t=(0,kf.convert)((0,Df.parse)(e)),r=Number.parseInt(t?.version,10);if(Number.isNaN(r))throw y.logger.error(f("errors.unparseableOdataVersion")),new Error(f("errors.unparseableOdataVersion"));return{odataVersion:r===4?jr.OdataVersion.v4:jr.OdataVersion.v2,convertedMetadata:t}}catch(t){throw y.logger.error(t),new Error(f("prompts.validationMessages.metadataInvalid"))}}n(jf,"parseOdataVersion");function $f(e){let t={attributeNamePrefix:"",ignoreAttributes:!1,ignoreNameSpace:!0,parseAttributeValue:!0,removeNSPrefix:!0};try{return new ut(t).parse(e,!0)}catch(r){throw new Error(f("error.unparseableXML",{error:r}))}}n($f,"xmlToJson");function Bf(e){return e.replace(new RegExp(/(Uri=")(http|https):\/{2}(.*?)(\/)(sap\/opu\/(odata\/|odata4\/))/,"g"),(t,...r)=>`${r[0]}./${r[4]}`)}n(Bf,"originToRelative");function he(e){if(e)return e===jr.OdataVersion.v2?An.ODataVersion.v2:An.ODataVersion.v4}n(he,"convertODataVersionType");function $r(e){if(e?.length===1)return 0}n($r,"getDefaultChoiceIndex");function me(e){for(let t in e.services)e.services?.[t].log&&(e.services[t].log=(0,xn.removeSync)(e.services[t]?.log,{setUndefined:!0}));return e.log&&(e.log=(0,xn.removeSync)(e.log,{setUndefined:!0})),e}n(me,"removeCircularFromServiceProvider");function pt(e,t,r){let i=new Pn.BackendSystemKey({url:t,client:r}).getId();return e.find(s=>Pn.BackendSystemKey.from(s).getId()===i)}n(pt,"isBackendSystemKeyExisting");function Gf(e,t){return!e&&!t||e?.length===0&&t?.length===0||e===t?!0:!e||!t?!1:[...e].sort().toString()===[...t].sort().toString()}n(Gf,"areArraysEquivalent");var Vf=require("../../open-ux-shared/inquirer-common/index.js");var N=new Vf.ErrorHandler(void 0,void 0,"@sap-ux/odata-service-inquirer");function Hf({includeNone:e=!1}={}){let t=[{name:f("prompts.datasourceType.sapSystemChoiceText"),value:W.sapSystem},{name:f("prompts.datasourceType.odataServiceUrlChoiceText"),value:W.odataServiceUrl}];return t.push({name:f("prompts.datasourceType.capProjectChoiceText"),value:W.capProject}),t.push({name:f("prompts.datasourceType.metadataFileChoiceText"),value:W.metadataFile}),e&&t.unshift({name:f("prompts.datasourceType.choiceNone"),value:W.none}),t}n(Hf,"getDatasourceTypeChoices");var ae=require("../../open-ux-shared/project-access/index.js"),ge=require("node:path");var Wf=require("../../open-ux-shared/inquirer-common/index.js"),Qf=require("node:fs/promises"),Br=require("../../fiori-generator-shared/dist/index.js"),Kf=require("node:process");var Nn="enterCapPath";async function Rx(e){let t=await(0,ae.findCapProjects)({wsFolders:e});if(t.length===0&&(0,Br.getHostEnvironment)()===Br.hostEnvironment.cli){let s=(0,ge.dirname)((0,Kf.cwd)()),a=(0,ge.dirname)(s),c=await(0,ae.findCapProjects)({wsFolders:[s,a],noTraversal:!0});c.length>0&&t.push(c[0])}let r=[],i=new Map;for(let s of t){let a=(0,ge.basename)(s);r.push({folderName:a,path:process.platform==="win32"?await(0,Qf.realpath)(s):s}),i.set(a,(i.get(a)??0)+1)}return r.sort((s,a)=>s.folderName.localeCompare(a.folderName)),{capProjectPaths:r,folderCounts:i}}n(Rx,"getCapProjectPaths");async function zf(e){let{capProjectPaths:t,folderCounts:r}=await Rx(e),i=[];for(let s of t){let a=await(0,ae.getCapCustomPaths)(s.path),c=r.get(s.folderName)??1;i.push({name:`${s.folderName}${c>1?" ("+s.path+")":""}`,value:Object.assign(s,a)})}return[...i,{name:f("prompts.capProject.enterCapPathChoiceName"),value:Nn}]}n(zf,"getCapProjectChoices");function Lx(e,t,r,i,s){let a=e.definitions?.[t.name],c=a?.$location?.file;y.logger.debug(`Cap service def: ${JSON.stringify(a)}`),y.logger.debug(`Cap service def $location.file: ${JSON.stringify(c)}`);let o=e.$sources?.find(u=>u.indexOf(c.replace(/\.\.\\\\|\.\.\\|\.\.\//g,""))>-1);if(y.logger.debug(`Source file path for service: ${t.name}: ${o}`),o&&(0,ge.isAbsolute)(o)){let u=(0,ge.relative)(r,o);u=u.substring(0,u.lastIndexOf(".cds")),y.logger.debug(`serviceCdsFilePath: ${u}`);let l={serviceName:t.name,urlPath:t.urlPath.startsWith("/")?t.urlPath:`/${t.urlPath}`,serviceCdsPath:u,projectPath:r,appPath:i,capType:t.runtime?t.runtime:"Node.js",cdsVersionInfo:s};return{name:l.capType?l.serviceName+" ("+l.capType+")":l.serviceName,value:l}}y.logger.error(`Path for cds service file : ${t.name} not found in cds model, $sources, or is not an absolute path`)}n(Lx,"createCapServiceChoice");async function Yf(e){if(y.logger.debug(`getCapServiceChoices: ${JSON.stringify(e)}`),!e)return[];try{let t=[],r,i;try{await(0,ae.getCdsRoots)(e.path,!0);let{model:o,services:u,cdsVersionInfo:l}=await(0,ae.getCapModelAndServices)({projectRoot:e.path,logger:y.logger});t=u,r=o,i=l}catch(o){let u=f("errors.capModelAndServicesLoadError",{error:o?.message});return N.logErrorMsgs(Wf.ERROR_TYPE.UNKNOWN,u),y.logger.error(u),[]}let s=e.path,a=e.app;return y.logger.debug(`CDS model source paths: ${JSON.stringify(r.$sources)}`),t.map(o=>Lx(r,o,s,a,i)).filter(o=>!!o)??[]}catch(t){N.logErrorMsgs(t)}return[]}n(Yf,"getCapServiceChoices");async function On(e){if(!e.urlPath){let t=f("errors.capServiceUrlPathNotDefined",{serviceName:e.serviceName});N.logErrorMsgs(t);return}try{return await(0,ae.readCapServiceMetadataEdmx)(e.projectPath,e.urlPath,"v4")}catch(t){N.logErrorMsgs(f("errors.cannotReadCapServiceMetadata",{serviceName:e.serviceName})),y.logger.error(t)}}n(On,"getCapEdmx");var zt;(function(e){e.capProjectPath="capProjectPath",e.capCliStateSetter="capCliStateSetter"})(zt||(zt={}));var Xf=require("../../open-ux-shared/project-access/index.js");async function Jf(e){if(e)try{return!!await(0,Xf.getCapProjectType)(e)||f("prompts.validationMessages.capProjectNotFound")}catch{return f("prompts.validationMessages.capProjectNotFound")}return!1}n(Jf,"validateCapPath");var rp=require("node:fs/promises"),Gr=require("node:path");function Ux(e,t){return t?e.findIndex(r=>typeof r.value=="string"?r.value===t:r.value.path===t):e.length===2?0:-1}n(Ux,"getDefaultCapChoice");function ip(e){let t=[],r=e?.[P.capProject]?.defaultChoice,i=e?.[P.capService]?.defaultChoice,s,a,c=0,o=!1;v.reset();let u=[{when:n(async()=>(t=await zf(e?.[P.capProject]?.capSearchPaths??[]),t?.length>1),"when"),type:e?.[P.capProject]?.useAutoComplete?"autocomplete":"list",name:P.capProject,message:f("prompts.capProject.message"),default:n(()=>Ux(t,r),"default"),source:n((l,d)=>(0,Zf.searchChoices)(d,t),"source"),choices:n(()=>t,"choices"),guiOptions:{applyDefaultWhenDirty:!0,mandatory:!0,breadcrumb:f("prompts.capProject.breadcrumb")}},{when:n(l=>t.length===1||l?.capProject===Nn,"when"),type:"input",guiType:"folder-browser",name:zt.capProjectPath,message:f("prompts.capProjectPath.message"),default:n(()=>{if(r)return r},"default"),guiOptions:{mandatory:!0,breadcrumb:f("prompts.capProject.breadcrumb")},filter:n(l=>v.isYUI?l:l&&!(0,Gr.isAbsolute)(l)?(0,Gr.resolve)(l):l,"filter"),validate:n(async l=>(o=await Jf(l),o===!0?(process.platform==="win32"&&(l=await(0,rp.realpath)(l)),s=Object.assign({path:l},await(0,ep.getCapCustomPaths)(l)),!0):(s=void 0,o)),"validate")},{when:n(async l=>(typeof l?.capProject=="object"&&(s=l.capProject),s?(a=await Yf(s),!0):!1),"when"),type:"list",name:P.capService,message:f("prompts.capService.message"),choices:n(()=>(i&&(c=a?.findIndex(l=>l.value?.projectPath===i?.projectPath&&l.value?.serviceName===i?.serviceName)),a),"choices"),guiOptions:{applyDefaultWhenDirty:!0,mandatory:!0,breadcrumb:!0},showOutputTabLink:"validationMessageOverflow",default:n(()=>a?.length>1?c:0,"default"),validate:n(async l=>{let d=N.getErrorMsg(void 0,!0);return d||(l?(v.odataService.metadata=await On(l),v.odataService.servicePath=l.urlPath,v.odataService.odataVersion=In.OdataVersion.v4,v.odataService.metadata!==void 0?!0:f("prompts.validationMessages.metadataInvalid")):!1)},"validate")}];return D()===tp.hostEnvironment.cli&&u.push({when:n(async l=>(l?.capService&&(v.odataService.metadata=await On(l?.capService),v.odataService.servicePath=l?.capService.urlPath,v.odataService.odataVersion=In.OdataVersion.v4),!1),"when"),name:zt.capCliStateSetter}),u}n(ip,"getLocalCapProjectPrompts");var np=require("../../odata-service-writer/dist/index.js"),sp=require("node:fs/promises");function ht(e,t){try{let{convertedMetadata:r,odataVersion:i}=jf(e);if(t&&t!==i){let s=f("prompts.validationMessages.odataVersionMismatch",{providedOdataVersion:i,requiredOdataVersion:t});return y.logger.error(s),{validationMsg:s}}return{version:i,convertedMetadata:r}}catch(r){return{validationMsg:r.message}}}n(ht,"validateODataVersion");var ap=n(async(e,t)=>{if(!e)return!1;try{let r=await(0,sp.readFile)(e,"utf-8");r=r.replace(/ & /g," & ");let{validationMsg:i,version:s}=ht(r,t);return i||{version:s??np.OdataVersion.v4,metadata:r}}catch{return f("prompts.validationMessages.metadataFilePathNotValid")}},"validateMetadataFile");function op(e){return{type:"input",guiType:"file-browser",name:P.metadataFilePath,guiOptions:{mandatory:!0,breadcrumb:!0},message:f("prompts.metadataFile.message"),validate:n(async r=>{v.reset();let i=await ap(r,e?.requiredOdataVersion);return typeof i=="string"||typeof i=="boolean"?i:(i.metadata&&(v.odataService.odataVersion=i.version,v.odataService.metadata=i.metadata,v.odataService.servicePath=f("prompts.metadataFile.placeholder_odata_service_url")),!0)},"validate")}}n(op,"getMetadataFileQuestion");var Yn=require("../../commonlibs/yeoman-ui-types/index.js"),wt=require("../../open-ux-shared/btp-utils/index.js"),hh=require("../../fiori-generator-shared/dist/index.js"),St=require("../../open-ux-shared/inquirer-common/index.js"),mh=require("../../open-ux-shared/store/index.js");var q=require("../../open-ux-shared/axios-extension/index.js"),J=require("../../open-ux-shared/btp-utils/index.js"),Yt=require("../../open-ux-shared/nodejs-utils/index.js"),A=require("../../open-ux-shared/inquirer-common/index.js");var cp=new Set([A.ERROR_TYPE.CERT_SELF_SIGNED,A.ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN,A.ERROR_TYPE.CERT_EXPIRED,A.ERROR_TYPE.CERT_UKNOWN_OR_INVALID,A.ERROR_TYPE.INVALID_SSL_CERTIFICATE]),Z=class{static{n(this,"ConnectionValidator")}validity={};_validatedUrl;_destinationUrl;_destination;_validatedClient;_odataService;_serviceProvider;_axiosConfig;_catalogV2;_catalogV4;_systemAuthType;_serviceInfo;_connectedUserName;_connectedSystemName;_refreshToken;_ignoreCertError;_connectType="abap_catalog";get ignoreCertError(){return this._ignoreCertError}get axiosConfig(){return this._axiosConfig}get odataService(){return this._odataService}get catalogs(){return{[q.ODataVersion.v2]:this._catalogV2,[q.ODataVersion.v4]:this._catalogV4}}get serviceProvider(){return this._serviceProvider}get systemAuthType(){return this._systemAuthType}set systemAuthType(t){this._systemAuthType=t}get validatedUrl(){return this._validatedUrl}get validatedClient(){return this._validatedClient}get serviceInfo(){return this._serviceInfo}set serviceInfo(t){this._serviceInfo=t}get connectedUserName(){return this._connectedUserName}get refreshToken(){return this._refreshToken}get destinationUrl(){return this._destinationUrl}get destination(){return this._destination}get connectType(){return this._connectType}get connectedSystemName(){return this._connectedSystemName?this._connectedSystemName:this.systemAuthType==="serviceKey"?this.serviceInfo?.systemid:this.validatedUrl}set connectedSystemName(t){this._connectedSystemName=t}setConnectedSystem({serviceProvider:t,backendSystem:r}){if(!t.catalog){y.logger.debug("ConnectionValidator.setConnectedSystem(): Use of a cached connected system is only supported for AbapServiceProviders. Re-authorization will be required.");return}this._serviceProvider=t,this._catalogV2=this._serviceProvider.catalog(q.ODataVersion.v2),this._catalogV4=this._serviceProvider.catalog(q.ODataVersion.v4),this._validatedUrl=r?.serviceKeys?.url??r?.url,this._connectedUserName=r?.userDisplayName,this._validatedClient=r?.client,this._refreshToken=r?.refreshToken,this._serviceInfo=r?.serviceKeys,this.validity.authenticated=!0,this.validity.reachable=!0,this.validity.urlFormat=!0,this.validity.authRequired=!0,r?.authenticationType==="reentranceTicket"?this.systemAuthType="reentranceTicket":r?.serviceKeys?this.systemAuthType="serviceKey":this.systemAuthType="basic"}async checkUrl(t,r,i,{ignoreCertError:s=!1,isSystem:a=!1,odataVersion:c,connectType:o}={}){let u=(0,J.isAppStudio)();try{t.pathname=t.pathname?.endsWith("/")?t.pathname:`${t.pathname}/`,s===!0&&(0,Yt.setGlobalRejectUnauthorized)(!s),u&&t.searchParams.append("saml2","disabled");let l=this.createAxiosConfig(t,s,r,i);if(a){if(await this.createSystemConnection({axiosConfig:l,url:t,odataVersion:c,connectType:o}),o!=="odata_path"){let d=await this.serviceProvider.getSystemInfo();this._connectedUserName=d?.userName,this._connectedSystemName=d?.systemID}}else await this.createOdataServiceConnection(l,t.pathname);return this._validatedClient=t.searchParams.get(nt)??void 0,200}catch(l){if(y.logger.debug(`ConnectionValidator.checkUrl() - error: ${l.message}`),l?.isAxiosError){if(l?.response?.status.toString().match(/5\d\d/)&&u)throw l;return l?.response?.status||l?.code}else throw l}}createAxiosConfig(t,r,i,s){let a={params:Object.fromEntries(t.searchParams),ignoreCertErrors:r,cookies:"",baseURL:t.origin,url:t.pathname,logger:y.logger};return i&&s&&(a=Object.assign(a,{auth:{username:i,password:s}})),a}async createOdataServiceConnection(t,r){await this.shouldIgnoreCertError(t)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,(0,Yt.setGlobalRejectUnauthorized)(!1)),this._axiosConfig=t,this._serviceProvider=(0,q.create)(this._axiosConfig),this._odataService=this._serviceProvider.service(r),this._connectType="odata_path",y.attachAxiosLogger(this._serviceProvider.interceptors),await this._odataService.get("")}resetConnectionState(t=!1){this._serviceProvider=void 0,this._odataService=void 0,this._catalogV2=void 0,this._catalogV4=void 0,this._serviceInfo=void 0,this._connectedUserName=void 0,this._refreshToken=void 0,this._connectedSystemName=void 0,this._ignoreCertError=void 0,this._connectType="abap_catalog",t&&this.resetValidity(),N.resetErrorState()}async shouldIgnoreCertError(t,r){y.logger.debug(`ConnectionValidator.shouldIgnoreCertError() - url: ${t.baseURL}`);let i=!1;if(process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")try{let a=!r||r===q.ODataVersion.v2?q.ODataVersion.v2:q.ODataVersion.v4,c=(0,q.createForAbap)(t);y.attachAxiosLogger(c.interceptors),await c.catalog(a).listServices()}catch(a){let c=A.ErrorHandler.getErrorType(a?.response?.status??a?.code);a?.isAxiosError&&cp.has(c)&&(y.logger.warn(f("warnings.certificateErrors",{url:t?.baseURL,error:c})),y.logger.warn(f("warnings.allowingUnauthorizedCertsNode")),i=!0)}return i}async createSystemConnection({axiosConfig:t,url:r,serviceInfo:i,destination:s,odataVersion:a,connectType:c=this._connectType}){if(this.resetConnectionState(!0),this.systemAuthType==="reentranceTicket"||this.systemAuthType==="serviceKey")this._serviceProvider=this.getAbapOnCloudServiceProvider(r,i);else if(s){let o=r?r.pathname:void 0;this._validatedUrl=(0,J.getDestinationUrlForAppStudio)(s.Name,o),this._destinationUrl=o?this._validatedUrl.replace(`https://${s.Name.toLowerCase()}.dest`,s.Host.replace(/\/{1,10}$/,"")):s.Host,this._serviceProvider=(0,q.createForDestination)({},s)}else t&&(await this.shouldIgnoreCertError(t,a)&&(this._ignoreCertError=!0,t.ignoreCertErrors=!0,(0,Yt.setGlobalRejectUnauthorized)(!1)),this._axiosConfig=t,this._serviceProvider=(0,q.createForAbap)(t));if(this._serviceProvider&&y.attachAxiosLogger(this._serviceProvider.interceptors),c==="abap_catalog"){(!a||a===q.ODataVersion.v2)&&(this._catalogV2=this._serviceProvider.catalog(q.ODataVersion.v2)),(!a||a===q.ODataVersion.v4)&&(this._catalogV4=this._serviceProvider.catalog(q.ODataVersion.v4));let o=!1;try{this._catalogV2?await this._catalogV2?.listServices():this._catalogV4&&(o=!0,await this._catalogV4?.listServices())}catch(u){await this.handleCatalogError(u,o)}}else c==="odata_path"&&r&&(y.logger.debug(`Using provided url path: ${r.pathname} to validate authentication.`),this._connectType="odata_path",this._odataService=this._serviceProvider.service(`${r?.pathname}`),await this._odataService.get(""))}async handleCatalogError(t,r){let i=t.response?.status,s=i?A.ErrorHandler.getErrorType(i):void 0,a=i&&!r&&(s===A.ERROR_TYPE.NOT_FOUND||s===A.ERROR_TYPE.AUTH);if(this._catalogV4&&a){this._axiosConfig&&await this.shouldIgnoreCertError(this._axiosConfig,q.ODataVersion.v4)&&(this._ignoreCertError=!0,(0,Yt.setGlobalRejectUnauthorized)(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=(0,q.createForAbap)(this._axiosConfig),this._catalogV4=this._serviceProvider.catalog(q.ODataVersion.v4),y.attachAxiosLogger(this._serviceProvider.interceptors));try{await this._catalogV4.listServices()}catch(c){throw s===A.ERROR_TYPE.AUTH?t:c}}else throw t}async refreshTokenChangedCb(t){y.logger.debug("ConnectionValidator.refreshTokenChangedCb()"),this._refreshToken=t}getAbapOnCloudServiceProvider(t,r,i){if(this.systemAuthType==="reentranceTicket"&&t)return(0,q.createForAbapOnCloud)({environment:q.AbapCloudEnvironment.EmbeddedSteampunk,url:t.origin,logger:y.logger});if(this.systemAuthType==="serviceKey"&&r)return(0,q.createForAbapOnCloud)({environment:q.AbapCloudEnvironment.Standalone,service:r,refreshToken:i,refreshTokenChangedCb:this.refreshTokenChangedCb.bind(this),logger:y.logger});throw new Error("Invalid system auth type")}async validateServiceInfo(t,r){if(!t)return!1;if(t.url===this.validatedUrl&&JSON.stringify(t.uaa)===JSON.stringify(this.serviceInfo?.uaa))return this.getValidationResultFromStatusCode(200);try{return this.systemAuthType="serviceKey",await this.createSystemConnection({serviceInfo:t,odataVersion:r}),this._connectedUserName=await this.serviceProvider.user(),this._serviceInfo=t,this._validatedUrl=t.url,this.getValidationResultFromStatusCode(200)}catch(i){return y.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${i.message}`),i?.isAxiosError&&this.getValidationResultFromStatusCode(i?.response?.status||i?.code),N.getErrorMsg(i)??!1}}async validateDestination(t,r,i){try{if(this.systemAuthType=t.Authentication===J.Authentication.NO_AUTHENTICATION?"basic":"unknown",(0,J.isFullUrlDestination)(t)||(0,J.isPartialUrlDestination)(t))return await this.validateOdataServiceDestination(t,i);{let s;if(i){let a=(0,J.getDestinationUrlForAppStudio)(t.Name.toLowerCase(),i);s=new URL(a)}await this.createSystemConnection({destination:t,odataVersion:r,url:s,connectType:s?"odata_path":void 0})}return{valResult:this.getValidationResultFromStatusCode(200)}}catch(s){s?.isAxiosError&&this.getValidationResultFromStatusCode(s?.response?.status||s?.code);let a=N.logErrorMsgs(s);return{valResult:N.getValidationErrorHelp(s,!1,t)??a,errorType:N.getCurrentErrorType()??A.ERROR_TYPE.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(t,r,i){this.resetConnectionState(!0);let s=(0,J.getDestinationUrlForAppStudio)(t.Name.toLowerCase(),r);this._destinationUrl=r?s.replace(`https://${t.Name.toLowerCase()}.dest`,t.Host.replace(/\/{1,10}$/,"")):t.Host,this._destination=t;let a=await this.checkUrl(new URL(s),void 0,void 0,{odataVersion:i}),c=this.getValidationResultFromStatusCode(a);if(this.validity.reachable&&(this._validatedUrl=s),!this.validity.reachable){let o=N.logErrorMsgs(a);return{valResult:N.getValidationErrorHelp(a,!1,t)??o,errorType:N.getCurrentErrorType()??A.ERROR_TYPE.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:A.ErrorHandler.getErrorMsgFromType(A.ERROR_TYPE.AUTH,t.Authentication!==J.Authentication.NO_AUTHENTICATION?f("texts.checkDestinationAuthConfig"):void 0),errorType:A.ERROR_TYPE.AUTH}:{valResult:c}}async validateUrl(t,{ignoreCertError:r=!1,forceReValidation:i=!1,isSystem:s=!1,odataVersion:a,systemAuthType:c,connectType:o}={}){if(this.isEmptyString(t))return this.resetValidity(),this.validity.urlFormat=!1,!1;c&&(this.systemAuthType=c);let u;try{if(u=new URL(t),u.origin==="null")return f("errors.invalidUrl",{input:t});if(o!=="odata_path"&&(this.systemAuthType==="reentranceTicket"||s)&&!(u.pathname.length===0||u.pathname==="/"))return f("prompts.validationMessages.systemUrlOriginOnlyWarning")}catch{return f("errors.invalidUrl",{input:t})}try{if(!i&&this.isUrlValidated(t))return this.validity.reachable??!1;this.resetValidity();let l=await this.checkUrl(u,void 0,void 0,{ignoreCertError:r,isSystem:s,odataVersion:a,connectType:o});return y.logger.debug(`ConnectionValidator.validateUrl() - status: ${l}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t,this.getValidationResultFromStatusCode(l)}catch(l){return this.resetValidity(),A.ErrorHandler.getErrorType(l)===A.ERROR_TYPE.CONNECTION?(this.validity.reachable=!1,N.logErrorMsgs(f("errors.systemOrServiceUrlNotFound",{url:t}))):N.getErrorMsg(l)??l.message}}getValidationResultFromStatusCode(t){return t===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):A.ErrorHandler.getErrorType(t)===A.ERROR_TYPE.NOT_FOUND?(this.validity.reachable=!1,A.ErrorHandler.getErrorMsgFromType(A.ERROR_TYPE.NOT_FOUND)??!1):A.ErrorHandler.isCertError(t)?(this.validity.reachable=!0,this.validity.canSkipCertError=cp.has(A.ErrorHandler.getErrorType(t)),this.validity.authenticated=!1,N.getValidationErrorHelp(t,!1)??!1):A.ErrorHandler.getErrorType(t)===A.ERROR_TYPE.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):A.ErrorHandler.getErrorType(t)===A.ERROR_TYPE.REDIRECT?(this.validity.reachable=!0,f("errors.urlRedirect")):A.ErrorHandler.getErrorType(t)===A.ERROR_TYPE.CONNECTION?(this.validity.reachable=!1,A.ErrorHandler.getErrorMsgFromType(A.ERROR_TYPE.CONNECTION,f("texts.httpStatus",{httpStatus:t}))??!1):A.ErrorHandler.getErrorType(t)===A.ERROR_TYPE.BAD_REQUEST?(this.validity.reachable=!0,A.ErrorHandler.getErrorMsgFromType(A.ERROR_TYPE.BAD_REQUEST,f("texts.httpStatus",{httpStatus:t}))??!1):A.ErrorHandler.getErrorType(t)===A.ERROR_TYPE.BAD_GATEWAY?(this.validity.reachable=!1,A.ErrorHandler.getErrorMsgFromType(A.ERROR_TYPE.BAD_GATEWAY,f("texts.httpStatus",{httpStatus:t}))??!1):(this.validity.reachable=!0,A.ErrorHandler.getErrorMsgFromType(A.ErrorHandler.getErrorType(t),f("texts.httpStatus",{httpStatus:t}))??!0)}isEmptyString(t){return!t||t.trim().length===0}isUrlValidated(t){return this._validatedUrl===t}async isAuthRequired(){return y.logger.debug(`ConnectionValidator.isAuthRequired() - validity: ${JSON.stringify(this.validity)}`),!this._validatedUrl||this.validity.authenticated?!1:this.validity.authRequired}async validateAuth(t,r,i,{ignoreCertError:s=!1,sapClient:a,odataVersion:c,isSystem:o=!1,connectType:u}={}){if(!t)return{valResult:!1};try{let l=new URL(t);a&&l.searchParams.append(nt,a),this.systemAuthType="basic";let d=await this.checkUrl(l,r,i,{ignoreCertError:s,isSystem:o,odataVersion:c,connectType:u});y.logger.debug(`ConnectionValidator.validateAuth() - status: ${d}; url: ${t}`),this.validity.urlFormat=!0,this._validatedUrl=t;let h=this.getValidationResultFromStatusCode(d);if(h===!0){if(this.validity.authenticated===!0)return this._connectedUserName=r,{valResult:!0};if(this.validity.authenticated===!1)return{valResult:this.getAuthFailureReasonText(d,c),errorType:A.ERROR_TYPE.AUTH}}return{valResult:h}}catch(l){return{valResult:N.getValidationErrorHelp(l,!1,this.destination)??N.getErrorMsg(l)??f("errors.unknownError"),errorType:N.getCurrentErrorType()??void 0}}}resetValidity(){delete this.validity.urlFormat,delete this.validity.reachable,delete this.validity.authRequired,delete this.validity.authenticated,delete this.validity.canSkipCertError,this._validatedUrl=void 0,this._destinationUrl=void 0,this._destination=void 0}getAuthFailureReasonText(t,r){let i;[403,"403"].includes(t)?i=f("texts.authorizationFailed"):[401,"401"].includes(t)&&(i=f("texts.authenticationFailed"));let s;return r?s=f("errors.authenticationFailedSpecificCatalog",{odataVersion:r,authFailType:i}):s=f("errors.authenticationFailedAllCatalogs",{authFailType:i}),s}};var bt=require("../../open-ux-shared/btp-utils/index.js"),vt=require("../../fiori-generator-shared/dist/index.js"),Ce=require("../../open-ux-shared/inquirer-common/index.js"),sh=Et(qp(),1);var Se={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var ri=require("../../open-ux-shared/axios-extension/index.js"),Yp=require("../../fiori-generator-shared/dist/index.js"),ne=require("../../open-ux-shared/inquirer-common/index.js"),$n=require("../../odata-service-writer/dist/index.js");var Jr=require("../../open-ux-shared/inquirer-common/index.js");var Fp=require("../../open-ux-shared/axios-extension/index.js"),Rp=require("../../odata-service-writer/dist/index.js");var tr=require("../../fiori-generator-shared/dist/index.js"),Lp=require("../../open-ux-shared/telemetry/index.js");var WP="VALUE_HELP_DOWNLOAD_PROMPTED",QP="VALUE_HELP_DOWNLOAD_SUCCESS",KP="VALUE_HELP_DOWNLOAD_FAILED";async function Un(e,t,r){let i=tr.TelemetryHelper.createTelemetryData(t)??{};if(r&&Object.keys(r).length>0){let s=(0,Jr.getTelemetryClient)();s&&await s.reportEvent({eventName:e,properties:i,measurements:r},Lp.SampleRate.NoSampling)}else(0,Jr.sendTelemetryEvent)(e,i)}n(Un,"sendValueHelpTelemetry");async function Mp(e,t,r){if(delete v.odataService.valueListMetadata,await Un(WP,{userChoseToDownload:e}),e&&t.serviceProvider instanceof Fp.AbapServiceProvider){let i=Date.now();try{let s=await t.serviceProvider.fetchExternalServices(r),a=Date.now()-i;s.length>0?v.odataService.valueListMetadata=s:y.logger.info(f("warnings.noExternalServiceMetdataFetched")),await Un(QP,{userChoseToDownload:!0,valueHelpCount:s.length},{downloadTimeMs:a})}catch(s){let a=Date.now()-i;y.logger.error(`Failed to fetch external service metadata: ${s}`),await Un(KP,{userChoseToDownload:!0,error:s instanceof Error?s.message:"Unknown error"},{downloadTimeMs:a})}}}n(Mp,"performValueHelpDownload");function Up(e,t,r){let i=`${t?t+":":""}`,s=`${i}${P.valueHelpDownload}`,a=`${i}${P.serviceSelection}`,c=`${i}cliValueHelpDownload`,o,l=[{when:n(d=>{let m=d?.[a]?.servicePath;return m&&r?.convertedMetadata?(o=(0,Rp.getExternalServiceReferences)(m,r?.convertedMetadata),o.length>0):!1},"when"),name:s,type:"confirm",message:f("prompts.valueHelpDownload.message"),validate:n(async d=>(D()!==tr.hostEnvironment.cli&&await Mp(d,e,o),!0),"validate")}];return D()===tr.hostEnvironment.cli&&l.push({when:n(async d=>{let h=d?.[s];return h!==void 0&&o&&await Mp(h,e,o),!1},"when"),name:c,type:"input"}),l}n(Up,"getValueHelpDownloadPrompt");var we=require("../../commonlibs/yeoman-ui-types/index.js"),B=require("../../open-ux-shared/axios-extension/index.js"),Wp=require("../../fiori-generator-shared/dist/index.js"),ti=require("../../open-ux-shared/inquirer-common/index.js"),ei=require("../../odata-service-writer/dist/index.js");var kp=require("../../open-ux-shared/annotation-converter/index.js"),Dp=require("../../open-ux-shared/edmx-parser/index.js"),Ue=require("../../odata-service-writer/dist/index.js");var ke=require("../../open-ux-shared/inquirer-common/index.js"),jp=require("../../open-ux-shared/project-access/index.js");function zP(e,t){if(!!!e?.entityType?.annotations?.Common?.ResultContext)return;let i=e?.entityType?.navigationProperties??[];for(let s of i)if(s.containsTarget===!0&&s.partner&&t?.filter(c=>c.fullyQualifiedName===s.targetTypeName))return s.name}n(zP,"getNavigationPropertyForParameterisedEntity");function $p(e,{entitySetFilter:t,defaultMainEntityName:r}={}){let i=[],s,a,c,o;try{c=(0,kp.convert)((0,Dp.parse)(e));let u=Number.parseInt(c?.version,10);if(Number.isNaN(u))throw y.logger.error(f("errors.unparseableOdataVersion")),new Error(f("errors.unparseableOdataVersion"));o=u===4?Ue.OdataVersion.v4:Ue.OdataVersion.v2;let l=[];t==="filterDraftEnabled"?l=kn(c.entitySets)??[]:t==="filterAggregateTransformationsOnly"&&o===Ue.OdataVersion.v4?l=(0,ke.filterAggregateTransformations)(c.entitySets):l=c.entitySets,l.forEach((d,h)=>{let m=zP(d,c?.entityTypes),S={name:d.name,value:{entitySetName:d.name,entitySetType:d.entityTypeName,...m&&{mainEntityParameterName:m}}};i.push(S),!s&&d.annotations?.Common?.DraftRoot&&(s=h),r&&d.name===r&&(a=h)})}catch(u){y.logger.error(f("errors.unparseableMetadata",{error:u.message}))}return{choices:i,draftRootIndex:s,defaultMainEntityIndex:a,convertedMetadata:c,odataVersion:o}}n($p,"getEntityChoices");function YP(e,t){let r=e.find(i=>i.entityTypeName===t);return r?r.name:void 0}n(YP,"findEntitySetName");function Bp(e,t,r){let i=[],s=(0,ke.findEntitySetByName)(e,r),a=[];return t===Ue.OdataVersion.v4?a=s?.entityType.navigationProperties.filter(c=>c.isCollection)??[]:a=s?.entityType.navigationProperties??[],a.forEach(c=>{i.push({name:c.name,value:{navigationPropertyName:c.name,entitySetName:YP(e.entitySets,c.targetTypeName)}})}),i.length>0&&i.unshift({name:f("prompts.navigationEntitySelection.choiceNone"),value:{}}),i}n(Bp,"getNavigationEntityChoices");function kn(e){return e.filter(t=>!!t.entityType.entityProperties.find(i=>i.name==="HasDraftEntity"))}n(kn,"filterDraftEnabledEntities");function Gp(e,t,r,i,s){let a=s?(0,ke.findEntitySetByName)(t,s):void 0;if(e==="alp"&&r===Ue.OdataVersion.v2)return"AnalyticalTable";if(r===Ue.OdataVersion.v4&&a){let c=e==="lrop"||e==="worklist"||e==="alp",{hasRecursiveHierarchyForEntitySet:o,hasAggregateTransformations:u}=(0,jp.getTableCapabilitiesByEntitySet)(a);if(c&&u&&(0,ke.shouldUseAnalyticalTable)(a,!i))return"AnalyticalTable";if((e==="lrop"||e==="worklist")&&o)return"TreeTable"}return"ResponsiveTable"}n(Gp,"getDefaultTableType");var Vp=require("../../open-ux-shared/annotation-converter/index.js"),Hp=require("../../open-ux-shared/edmx-parser/index.js");function XP(e){return!!e.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}n(XP,"hasCollaborativeDraft");function Zr(e){let t=!1;try{let r;typeof e=="string"?r=(0,Vp.convert)((0,Hp.parse)(e)):r=e;let i=kn(r.entitySets)??[];i?.length>0&&(t=!XP(i))}catch(r){y.logger.error(f("errors.unparseableMetadata",{error:r.message}))}return t}n(Zr,"showCollabDraftWarning");var JP=["/IWBEP/COMMON"],ZP="SERVICE_INQUIRER_BAS_SUCCESS",eN=n(e=>{let t=[],r=!1;return typeof y.logger.getLogLevel=="function"&&(r=y.logger.getLogLevel()==="trace"),e?.filter(i=>!JP.some(s=>i.id.includes(s))).forEach(i=>{let s=i.name,a=i.path;s=`${s} (${i.serviceVersion}) - OData V${i.odataVersion}`,r&&(s=`${s} Service Type: ${i.serviceType}`),t.push({name:s,value:{servicePath:a,serviceODataVersion:i.odataVersion,toString:n(()=>s,"toString"),serviceType:i.serviceType,serviceId:i.id}})}),y.logger.debug(`Number of unique service choices: ${t.length}`),t.sort((i,s)=>i.name?i.name.localeCompare(s.name??""):0)},"createServiceChoices");function tN(e,t){let r=Object.entries(e);r.forEach(([i,s])=>{N.logErrorMsgs(s,f("warnings.missingServices",{odataVersion:i}))}),t===r.length&&N.logErrorMsgs(f("errors.allCatalogServiceRequestsFailed",{version:Object.keys(e).join(", ")}))}n(tN,"logServiceCatalogErrorsForHelp");async function Qp(e,t){let r={},i={},s=[];for(let c of e){let o=c instanceof B.V2CatalogService?B.ODataVersion.v2:B.ODataVersion.v4;try{let u=Date.now(),l=await c.listServices(),d=Date.now(),h=d-u===0?"<1 ms":`${d-u}ms`;i[`v${o}`]={serviceCount:l.length,duration:h},y.logger.debug(`Number of service${o===B.ODataVersion.v4?" groups":"s"}: ${l.length} returned in: ${h}}`),s.push(l)}catch(u){y.logger.error(f("errors.serviceCatalogRequest",{catalogRequestUri:c.getUri(),entitySet:c.entitySet,error:u})),Object.assign(r,{[o]:u}),s.push([])}}y.logger.debug(`Service catalog request times: ${JSON.stringify(i,void 0," ")}`);let a=s?.flat()??[];return y.logger.debug(`Number of services available: ${a.length}`),(a.length===0||Object.keys(r).length>0)&&tN(r,e.length),t&&(a=a.filter(c=>t.includes(c.id)||t.includes(c.path))),eN(a)}n(Qp,"getServiceChoices");function Dn(e){let t=Wp.TelemetryHelper.createTelemetryData({destODataType:(0,ti.getTelemPropertyDestinationType)(e)})??{};(0,ti.sendTelemetryEvent)(ZP,t)}n(Dn,"sendDestinationServiceSuccessTelemetryEvent");async function rN(e,t,r,i,s){let a=[];try{let c=await t.metadata(),{validationMsg:o,version:u,convertedMetadata:l}=ht(c,s);if(o)return{validationMsg:o};if(!r&&u===ei.OdataVersion.v2&&i)try{y.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=(0,B.createForAbap)(i).catalog(B.ODataVersion.v2),y.attachAxiosLogger(r.interceptors)}catch(d){y.logger.warn(f("error.v2CatalogServiceNoAnnotations",d))}if(r)try{a=await r.getAnnotations({path:e})}catch{y.logger.info(f("prompts.validationMessages.noAnnotations"))}return{annotations:a,metadata:c,version:u,convertedMetadata:l}}catch(c){let o=N.getErrorMsg(c);return y.logger.error(f("errors.serviceMetadataErrorLog",{servicePath:e,errorText:o})),{validationMsg:f("errors.serviceMetadataErrorUI",{servicePath:e,errorText:o})}}}n(rN,"getServiceMetadataAndValidate");async function iN(e,t,r){let i;if(t===B.ServiceType.NotDetermined)try{i=await r.getServiceType(e)??B.ServiceType.NotDetermined}catch(s){y.logger.error(f("errors.serviceTypeRequestError",{error:s.message}))}return i??t}n(iN,"getServiceType");async function jn(e,t,r){let i=t.catalogs?.[e.serviceODataVersion];if(!t.serviceProvider)return y.logger.error("ConnectionValidator connection is not initialized"),{validationResult:!1};let s=t.odataService;s||(s=t.serviceProvider.service(e.servicePath));let{validationMsg:a,version:c,convertedMetadata:o,annotations:u,metadata:l}=await rN(e.servicePath,s,i,t.axiosConfig,r);if(a)return{validationResult:a};let d=t.destinationUrl??t.validatedUrl,h;return d&&(h=new URL(d).origin),v.odataService.annotations=u,v.odataService.metadata=l,v.odataService.odataVersion=c??(e.serviceODataVersion===B.ODataVersion.v2?ei.OdataVersion.v2:ei.OdataVersion.v4),v.odataService.servicePath=e.servicePath,v.odataService.serviceId=e.serviceId,v.odataService.origin=h,v.odataService.sapClient=t.validatedClient,v.odataService.ignoreCertError=t.ignoreCertError,{validationResult:!0,hasAnnotations:!!v.odataService.annotations&&v.odataService.annotations.length>0,convertedMetadata:o}}n(jn,"validateService");function Kp(e){let t=f("prompts.systemService.message");return e&&(t=t.concat(` ${f("texts.forUserName",{username:e})}`)),t}n(Kp,"getSelectedServiceLabel");async function zp(e,t,r,{requiredOdataVersion:i,hasAnnotations:s=!0,showCollabDraftWarnOptions:a,serviceFilter:c}){if(e?.length===0)return c&&c.length>0?{message:f("warnings.specifiedServicesNotAvailable",{odataVersion:i?`V${i} `:void 0,service:c[0],count:c.length}),severity:we.Severity.warning}:i?{message:f("warnings.noServicesAvailableForOdataVersion",{odataVersion:i}),severity:we.Severity.warning}:{message:f("warnings.noServicesAvailable"),severity:we.Severity.warning};if(t){let o=t.serviceType;if(t.serviceODataVersion===B.ODataVersion.v2){if(!s)return{message:f("warnings.noAnnotations"),severity:we.Severity.warning};o=await iN(t.servicePath,t.serviceType,r.catalogs[B.ODataVersion.v2])}else if(a?.showCollabDraftWarning&&t.serviceODataVersion===B.ODataVersion.v4&&Zr(a.edmx))return{message:f("warnings.collaborativeDraftMessage"),severity:we.Severity.warning};if(o&&o!==B.ServiceType.UI)return{message:f("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:we.Severity.warning}}else if(N.getErrorMsg())return{message:`${N.getErrorMsg()} ${f("texts.seeLogForDetails")}`,severity:we.Severity.information}}n(zp,"getSelectedServiceMessage");var nN="cliServiceSelection";function Te(e,t,r,i=!0){let s=[],a,c,o,u,l,d={convertedMetadata:void 0},h=r?.requiredOdataVersion,m=`${t}:${P.serviceSelection}`,S={when:n(()=>e.validity.authenticated||e.validity.authRequired===!1,"when"),name:m,type:r?.useAutoComplete?"autocomplete":"list",message:n(()=>Kp(e.connectedUserName),"message"),guiOptions:{breadcrumb:f("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:n((w,C)=>(0,ne.searchChoices)(C,s),"source"),choices:n(async w=>{if(s.length===0||a!==e.validatedUrl||c!==e.validatedClient||!Gf(u,r?.serviceFilter))if(e.catalogs[$n.OdataVersion.v2]||e.catalogs[$n.OdataVersion.v4])s=await sN(e.catalogs,h,r?.serviceFilter),a=e.validatedUrl,c=e.validatedClient,u=r?.serviceFilter?[...r.serviceFilter]:void 0,w?.[`${P.systemSelection}`]?.type==="destination"&&Dn(w?.[`${P.systemSelection}`]?.system);else if(e.odataService&&e.validatedUrl&&!await e.isAuthRequired()){let C=new URL(e.destinationUrl??e.validatedUrl);s=[{name:C.toString(),value:{servicePath:C.pathname}}],w?.[`${P.systemSelection}`]?.type==="destination"&&Dn(w?.[`${P.systemSelection}`]?.system)}else y.logger.error(f("errors.noCatalogOrServiceAvailable"));return s},"choices"),additionalMessages:n(w=>zp(s,w,e,{requiredOdataVersion:h,hasAnnotations:l,showCollabDraftWarnOptions:d.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:d.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),"additionalMessages"),default:n(()=>$r(s),"default"),validate:n(async w=>{let C=w;if(r?.useAutoComplete&&w.value&&(C=w.value),!e.validatedUrl)return!1;if(s.length===0&&N.hasError())return ne.ErrorHandler.getHelpForError(ne.ERROR_TYPE.SERVICES_UNAVAILABLE)??!1;if(C&&(o?.servicePath!==C.servicePath||o?.servicePath!==v.odataService.servicePath)){l=void 0,d.convertedMetadata=void 0,o=C;let x=await jn(C,e,h);return l=x.hasAnnotations,d.convertedMetadata=x.convertedMetadata,x.validationResult}return!0},"validate")};if(r?.additionalMessages){let w={[m]:{additionalMessages:r.additionalMessages}};S=(0,ne.extendWithOptions)([S],w,v.odataService)[0]}let E=[S];return D()===Yp.hostEnvironment.cli&&!r?.useAutoComplete&&E.push({when:n(async w=>{let C=w?.[`${t}:${P.serviceSelection}`];if(C&&e.validatedUrl){let{validationResult:x,hasAnnotations:L,convertedMetadata:H}=await jn(C,e);if(typeof x=="string")throw y.logger.error(x),new Error(x);l=L,d.convertedMetadata=H}if(s.length===0&&N.hasError()){let x=ne.ErrorHandler.getHelpForError(ne.ERROR_TYPE.SERVICES_UNAVAILABLE).toString();throw new Error(x)}return!1},"when"),name:`${t}:${nN}`}),i||E.push(...(0,ne.withCondition)(Up(e,t,d),w=>e.serviceProvider instanceof ri.AbapServiceProvider&&!!d.convertedMetadata&&w?.[m]?.serviceODataVersion===ri.ODataVersion.v4)),E}n(Te,"getSystemServiceQuestion");async function sN(e,t,r){let i=[];return t&&e[t]?i.push(e[t]):i=Object.values(e).filter(s=>s!==void 0),await Qp(i,r)}n(sN,"createServiceChoicesFromCatalog");var eh=require("../../commonlibs/yeoman-ui-types/index.js"),_e=require("../../open-ux-shared/store/index.js");var Bn=require("../../commonlibs/yeoman-ui-types/index.js"),yt=require("../../open-ux-shared/btp-utils/index.js");var ee;(function(e){e.systemUsername="systemUsername",e.systemPassword="systemPassword",e.storeSystemCredentials="storeSystemCredentials"})(ee||(ee={}));function ii(e,t,r,i){let s=`${t?t+":":""}${ee.systemUsername}`,a=`${t?t+":":""}${ee.systemPassword}`,c=`${t?t+":":""}${ee.storeSystemCredentials}`,o,u=[{when:n(async()=>(o=await e.isAuthRequired(),e.systemAuthType==="basic"&&o&&(!r||r.isValid)),"when"),type:"input",name:s,message:f("prompts.systemUsername.message"),guiOptions:{mandatory:!0},default:"",validate:n(d=>d?.length>0,"validate")},{when:n(()=>!!(e.systemAuthType==="basic"&&o&&(!r||r.isValid)),"when"),type:"password",guiOptions:{mandatory:!0,applyDefaultWhenDirty:!0},guiType:"login",showOutputTabLink:"validationMessageOverflow",name:a,message:f("prompts.systemPassword.message"),mask:"*",default:"",validate:n(async(d,h)=>{if(!(e.validatedUrl&&h?.[s]&&d&&(!r||r.isValid)))return!1;let m=h?.[P.systemSelection],S,E=!0;if(m?.type==="backendSystem")S=m.system?.client;else if(m?.type==="destination"){let C=m.system;((0,yt.isFullUrlDestination)(C)||(0,yt.isPartialUrlDestination)(C))&&(E=!1)}let{valResult:w}=await e.validateAuth(e.validatedUrl,h?.[s],d,{sapClient:r?.sapClient||S,isSystem:E,odataVersion:he(i)});return w===!0&&e.serviceProvider?(aN(e.serviceProvider,m,{username:h?.[s],password:d}),!0):w},"validate"),additionalMessages:n((d,h)=>{if(e.ignoreCertError&&h?.newSystemType!=="abapOnPrem")return{message:f("warnings.certErrorIgnoredByNodeSetting"),severity:Bn.Severity.warning}},"additionalMessages")}],l={when:n(d=>!!(e.systemAuthType==="basic"&&o&&e.validity.authenticated&&d[a]),"when"),type:"confirm",name:c,message:f("prompts.storeSystemCredentials.message"),default:!1,guiOptions:{breadcrumb:f("prompts.storeSystemCredentials.breadcrumb")},validate:n(async d=>{if(v.odataService.connectedSystem?.backendSystem){let h=v.odataService.connectedSystem.backendSystem;v.odataService.connectedSystem.backendSystem=Object.assign(h,{newOrUpdated:d})}return!0},"validate"),additionalMessages:n(d=>{if(d===!0)return{message:f("texts.passwordStoreWarning"),severity:Bn.Severity.warning}},"additionalMessages")};return(0,yt.isAppStudio)()||u.push(l),u}n(ii,"getCredentialsPrompts");function aN(e,t,{username:r,password:i}){if(v.odataService.connectedSystem={serviceProvider:me(e)},t?.type==="backendSystem"){let s=t.system;(s.username!==r||s.password!==i)&&(v.odataService.connectedSystem.backendSystem=Object.assign(s,{username:r,password:i,userDisplayName:r}))}else t?.type==="destination"&&(v.odataService.connectedSystem.destination=t.system)}n(aN,"updatePromptStateWithConnectedSystem");var Xp=require("../../open-ux-shared/store/index.js");async function Gn(){return await(0,Xp.getService)({entityName:"system"})}n(Gn,"getBackendSystemService");async function ni(e=!1){let t=[];try{t=await(await Gn()).getAll({includeSensitiveData:e,backendSystemFilter:{connectionType:["abap_catalog","odata_service"]}})}catch(r){y.logger.error(f("errors.backendSystemRetrieval",{error:r.message}))}return t}n(ni,"getAllBackendSystems");async function oN(e){return!!(await ni(!1)).find(r=>r.name===e)}n(oN,"isSystemNameInUse");async function rr(e){return e?await oN(e)?f("prompts.systemName.systemNameExistsWarning"):!0:f("prompts.systemName.emptySystemNameWarning")}n(rr,"validateSystemName");function Jp(e,t){try{return new URL(t,e),!0}catch{return f("errors.invalidUrl",{input:`${e}${t}`})}}n(Jp,"validateServiceUrl");async function Zp(e,t){let r=e+(t?f("texts.suggestedSystemNameClient",{client:t}):"");return await rr(r)===!0?r:cN(r)}n(Zp,"suggestSystemName");async function cN(e){let t=1,r=`${e} (${t})`;for(;await rr(r)!==!0;)r=`${e} (${t})`,t++;return r}n(cN,"appendSuffix");function uN(e){switch(e){case"serviceKey":return _e.AuthenticationType.ReentranceTicket;case"reentranceTicket":return _e.AuthenticationType.ReentranceTicket;case"basic":return _e.AuthenticationType.Basic;default:return}}n(uN,"systemAuthTypeToAuthenticationType");function si(e,t,r,i,s=!0){return{type:"input",name:`${t?t+":":""}${Se.newSystemUrl}`,message:f("prompts.systemUrl.message"),guiOptions:{hint:f("prompts.systemUrl.description"),mandatory:!0,breadcrumb:!0},validate:n(async o=>{if(v.resetConnectedSystem(),i&&i.backendSystem?.url===o&&i.backendSystem?.authenticationType==="reentranceTicket")e.setConnectedSystem(i);else if(s){let l=pt(v.backendSystemsCache,o);if(l)return f("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}let u=await e.validateUrl(o,{isSystem:!0,odataVersion:he(r),forceReValidation:!0});return u===!0&&(e.validity.authenticated&&e.serviceProvider?v.odataService.connectedSystem={serviceProvider:me(e.serviceProvider)}:e.systemAuthType="basic"),u},"validate"),additionalMessages:n(()=>{if(e.ignoreCertError)return{message:f("warnings.certErrorIgnoredByNodeSetting"),severity:eh.Severity.warning}},"additionalMessages")}}n(si,"getSystemUrlQuestion");function ai(e,t){let r,i=!1,s=`${t?t+":":""}`,a=`${s}${P.userSystemName}`;return{type:"input",guiOptions:{hint:f("prompts.systemName.hint"),applyDefaultWhenDirty:!0,breadcrumb:!0,mandatory:!0},name:a,message:f("prompts.systemName.message"),default:n(async()=>{let o=e.connectedSystemName;return o&&!i&&(r=await Zp(o,e.validatedClient)),r},"default"),validate:n(async(o,u)=>{if(!o)return!1;let l=!1;o===r?l=!0:(i=!0,r=o,l=await rr(o));let d=!!u?.[`${s}${ee.storeSystemCredentials}`];if(l===!0&&e.validatedUrl&&v.odataService.connectedSystem){let h=new _e.BackendSystem({authenticationType:uN(e.systemAuthType),name:o,url:e.validatedUrl,client:e.validatedClient,username:d?e.axiosConfig?.auth?.username:void 0,password:d?e.axiosConfig?.auth?.password:void 0,serviceKeys:e.serviceInfo,userDisplayName:e.connectedUserName,systemType:(0,_e.getBackendSystemType)({serviceKeys:e.serviceInfo,authenticationType:e.systemAuthType}),connectionType:"abap_catalog"});v.odataService.connectedSystem.backendSystem=h,v.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return l},"validate")}}n(ai,"getUserSystemNameQuestion");var X=require("../../open-ux-shared/btp-utils/index.js"),Vn=require("../../open-ux-shared/inquirer-common/index.js");var th=require("../../fiori-generator-shared/dist/index.js");var oi="!@\xA3*&937newSystem*X~qy^",ir="cfAbapEnvService";async function rh(e,t,r,i,s){v.resetConnectedSystem();let a=!1,o=await(await Gn()).read(e);if(o){i&&i.backendSystem?.url===o.url&&t.setConnectedSystem(i);let u=new URL(o.url),l=u.origin;if(s&&(l=new URL(s,u.origin).toString()),o.authenticationType==="reentranceTicket")u.pathname!=="/"&&y.logger.warn(f("warnings.storedSystemUrlPathNotSupported",{systemUrl:o.url})),a=await t.validateUrl(l,{isSystem:!0,odataVersion:he(r),systemAuthType:"reentranceTicket",connectType:s?"odata_path":"abap_catalog"});else if(o.serviceKeys)a=await t.validateServiceInfo(o.serviceKeys,he(r));else if(o.authenticationType==="basic"||!o.authenticationType){let d;if({valResult:a,errorType:d}=await t.validateAuth(l,o.username,o.password,{isSystem:!0,odataVersion:he(r),sapClient:o.client,connectType:s?"odata_path":"abap_catalog"}),d===Vn.ERROR_TYPE.AUTH)return y.logger.error(f("errors.storedSystemConnectionError",{systemName:o.name,error:a})),!0}a===!0&&t.serviceProvider&&(v.odataService.connectedSystem={serviceProvider:me(t.serviceProvider),backendSystem:o})}return a}n(rh,"connectWithBackendSystem");async function nr(e,t,r,i){v.resetConnectedSystem();let{valResult:s,errorType:a}=await t.validateDestination(e,he(r),i);return a===Vn.ERROR_TYPE.AUTH&&t.systemAuthType==="basic"?(y.logger.error(f("errors.destination.authError",{systemName:e.Name,error:s})),!0):(s===!0&&t.serviceProvider&&(v.odataService.connectedSystem={serviceProvider:me(t.serviceProvider),destination:e}),s)}n(nr,"connectWithDestination");function lN(e,t){return!t||t.odata_abap&&(0,X.isAbapODataDestination)(e)||t.odata_generic&&(0,X.isGenericODataDestination)(e)||t.full_service_url&&(0,X.isFullUrlDestination)(e)||t.partial_service_url&&(0,X.isPartialUrlDestination)(e)?!0:(y.logger.debug(`Destination: ${e.Name} does not match any filters and will be excluded as a prompt choice. Destination configuration: ${JSON.stringify(e)}`),!1)}n(lN,"matchesFilters");async function ih(e,t=!1,r=!1){let i=[],s;if((0,X.isAppStudio)()){let a={};try{a=await(0,X.listDestinations)({stripS4HCApiHosts:!0})}catch(c){y.logger.error(f("errors.destination.listDestinations",{error:c.message}))}i=Object.values(a).filter(c=>lN(c,e)).map(c=>({name:(0,X.getDisplayName)(c),value:{type:"destination",system:c}})),t&&(s={name:f("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:ir,system:ir}})}else{let a=await ni(!1);v.backendSystemsCache=a,i=a.map(c=>({name:(0,th.getBackendSystemDisplayName)(c),value:{system:c,type:"backendSystem"}})),r||(s={name:f("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:oi}})}return i.sort(({name:a},{name:c})=>a.localeCompare(c,void 0,{numeric:!0,caseFirst:"lower"})),s&&i.unshift(s),i}n(ih,"createSystemChoices");function Hn(e,t){let r=typeof t=="string"?t:t?.value;return r?e.findIndex(s=>{let{type:a,system:c}=s.value;if(a==="destination")return c.Name===r;if(a==="backendSystem")return c.name===r;if(a==="newSystemChoice")return r===oi;if(a==="cfAbapEnvService")return r===ir}):-1}n(Hn,"findDefaultSystemSelectionIndex");var ci="abapOnBtp",DU=`${ci}:${Se.newSystemUrl}`,dN="cliCfAbapService",Wn={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function ah(e,t){v.reset();let r=new Z,i=[];return i.push({type:"list",name:Wn.abapOnBtpAuthType,choices:[{name:f("prompts.abapOnBTPType.choiceCloudFoundry"),value:"cloudFoundry"},{name:f("prompts.abapOnBTPType.choiceReentranceTicket"),value:"reentranceTicket"}],message:f("prompts.abapOnBTPType.message"),validate:n(()=>(r.resetConnectionState(!0),v.resetConnectedSystem(),!0),"validate")}),i.push((0,Ce.withCondition)([si(r,ci,e?.serviceSelection?.requiredOdataVersion,t)],s=>s?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=s.abapOnBtpAuthType,!0):!1)[0],...(0,Ce.withCondition)([...Qn(r,void 0,void 0,t)],s=>s?.abapOnBtpAuthType==="cloudFoundry")),e?.userSystemName?.hide!==!0&&i.push((0,Ce.withCondition)([ai(r,ci)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),i.push(...Te(r,ci,e?.serviceSelection,e?.valueHelpDownload?.hide)),i}n(ah,"getAbapOnBTPSystemQuestions");async function nh(e,t,r,i=!1,s){v.resetConnectedSystem();let a=e.label,c=await(0,sh.apiGetInstanceCredentials)(a);if(!c?.credentials?.uaa)return f("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:a});let o=!0,u;if(D()===vt.hostEnvironment.bas)try{u=await(0,bt.createOAuth2UserTokenExchangeDest)(a,{uaaCredentials:c.credentials.uaa,hostUrl:c.credentials.url},y.logger),o=await nr(u,t,r)}catch(l){o=l.message}else s&&s.backendSystem?.url===c.credentials.url&&JSON.stringify(s.backendSystem.serviceKeys?.uaa)===JSON.stringify(c.credentials.uaa)&&t.setConnectedSystem(s),o=await t.validateServiceInfo(c.credentials);if(!i&&o!==!0)return o;if(i&&typeof o=="string")throw y.logger.error(o),new Error(o);if(i&&o===!1)throw y.logger.error(N.getErrorMsg()??f("errors.abapServiceAuthenticationFailed")),new Error(f("errors.abapServiceAuthenticationFailed"));return t.serviceProvider&&D()!==vt.hostEnvironment.bas&&(t.connectedSystemName=await(0,bt.generateABAPCloudDestinationName)(a),v.odataService.connectedSystem={serviceProvider:me(t.serviceProvider)}),!0}n(nh,"validateCFServiceInfo");function Qn(e,t,r,i){let s=[],c=[{type:"list",name:`${t?t+":":""}${Wn.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:n(async()=>{if(s=await(0,Ce.getCFAbapInstanceChoices)(N),s.length===0&&D()===vt.hostEnvironment.cli)throw new Error(f("errors.abapEnvsUnavailable"));return s},"choices"),default:n(()=>$r(s),"default"),message:f("prompts.cloudFoundryAbapSystem.message"),validate:n(async o=>{if(o){let l=await nh(o,e,r,D()===vt.hostEnvironment.cli,i);if(!(0,bt.isAppStudio)()&&l===!0&&e.validatedUrl){let d=pt(v.backendSystemsCache,e.validatedUrl,e.validatedClient);if(d)return e.resetConnectionState(!0),f("prompts.validationMessages.backendSystemExistsWarning",{backendName:d.name})}return l}if(N.getCurrentErrorType()===Ce.ERROR_TYPE.NO_ABAP_ENVS){let l=N.getErrorMsg(!0),d=f("texts.seeLogForDetails");return`${l} ${d}`}return!1},"validate")}];return D()===vt.hostEnvironment.cli&&c.push({when:n(async o=>{let u=o?.[Wn.cloudFoundryAbapSystem];return u&&await nh(u,e,r,!0),!1},"when"),name:dN}),c}n(Qn,"getCFDiscoverPrompts");function oh(e){let t="cfAbapBas",r=new Z;return[...Qn(r,t,e?.serviceSelection?.requiredOdataVersion),...Te(r,t,e?.serviceSelection,e?.valueHelpDownload?.hide)]}n(oh,"getCfAbapBASQuestions");var zn=require("../../open-ux-shared/inquirer-common/index.js");var ch=require("../../open-ux-shared/inquirer-common/index.js"),uh=require("../../open-ux-shared/project-input-validator/index.js");var De="abapOnPrem",Kn=`${De}:${Se.newSystemUrl}`,ek=`${De}:${ee.systemUsername}`,tk=`${De}:${ee.systemPassword}`,fN={sapClient:"sapClient"};function lh(e){v.reset();let t=new Z,r=e?.serviceSelection?.requiredOdataVersion,i=pN(e?.userSystemName,t,r);return i.push(...Te(t,De,e?.serviceSelection,e?.valueHelpDownload?.hide)),i}n(lh,"getAbapOnPremQuestions");function pN(e,t,r){let i=t??new Z,s={sapClient:void 0,isValid:!0},a=[si(i,De,r,void 0,!1),{type:"input",name:fN.sapClient,message:f("prompts.sapClient.message"),guiOptions:{breadcrumb:f("prompts.sapClient.breadcrumb")},validate:n((c,o)=>{let u=(0,uh.validateClient)(c);if(u===!0){if(s.sapClient=c,s.isValid=!0,o?.[Kn]){let l=pt(v.backendSystemsCache,o[Kn],c);if(l)return s.isValid=!1,f("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return!0}return s.sapClient=void 0,s.isValid=!1,u},"validate")},...ii(i,De,s,r)];return e?.hide!==!0&&a.push((0,ch.withCondition)([ai(i,De)],c=>!!c?.[Kn]&&i.validity.reachable===!0&&(i.validity.authenticated||i.validity.authRequired===!1))[0]),a}n(pN,"getAbapOnPremSystemQuestions");function dh(e,t){let r=[{type:"list",name:Se.newSystemType,choices:[{name:f("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:f("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:f("prompts.newSystemType.message")}];return r.push(...(0,zn.withCondition)(lh(e),i=>i.newSystemType==="abapOnPrem")),r.push(...(0,zn.withCondition)(ah(e,t),i=>i.newSystemType==="abapOnBtp")),r}n(dh,"getNewSystemQuestions");var ui="systemSelection",wk=`${ui}:${ee.systemUsername}`,Tk=`${ui}:${ee.systemPassword}`,fh={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function ph(e,t,r,i,s){if(v.reset(),e.type==="newSystemChoice"||e.type==="cfAbapEnvService")return t.resetConnectionState(!0),!0;let a=!1;if(e.type==="backendSystem"){e.system.connectionType==="odata_service"&&(s=e.system.url);let c=mh.BackendSystemKey.from(e.system);a=await rh(c,t,r,i,s)}else if(e.type==="destination"){if((0,wt.isPartialUrlDestination)(e.system))return!0;a=await nr(e.system,t,r,s)}return a}n(ph,"validateSystemSelection");async function li(e,t){v.reset();let r=new Z,i=await hN(r,e,t);return e?.serviceSelection?.hide||i.push(...(0,St.withCondition)(Te(r,ui,e?.serviceSelection,e?.valueHelpDownload?.hide),s=>s.systemSelection?.type!=="newSystemChoice")),(0,wt.isAppStudio)()?i.push(...(0,St.withCondition)(oh(e),s=>s.systemSelection?.type==="cfAbapEnvService")):i.push(...(0,St.withCondition)(dh(e,t),s=>s.systemSelection?.type==="newSystemChoice")),i}n(li,"getSystemSelectionQuestions");async function hN(e,t,r){let i=t?.serviceSelection?.requiredOdataVersion,s=t?.systemSelection?.destinationFilters,a=await ih(s,t?.systemSelection?.includeCloudFoundryAbapEnvChoice,t?.systemSelection?.hideNewSystem),c=Hn(a,t?.systemSelection?.defaultChoice),o=t?.systemSelection?.connectPath,u=t?.systemSelection?.onlyShowDefaultChoice&&t?.systemSelection?.defaultChoice,l=[{type:t?.systemSelection?.useAutoComplete?"autocomplete":"list",name:P.systemSelection,message:f("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:f("prompts.systemSelection.hint")},source:n((d,h)=>(0,St.searchChoices)(h,a),"source"),choices:u?[a[c]]:a,default:n(()=>u?0:(c=Hn(a,t?.systemSelection?.defaultChoice),typeof t?.systemSelection?.connectPath=="object"&&(o=t?.systemSelection.connectPath),c),"default"),validate:n(async d=>{if(!d)return!1;let h=d;return t?.systemSelection?.useAutoComplete&&d.value&&(h=d.value),ph(h,e,i,r,o?.value)??!1},"validate"),additionalMessages:n(async d=>{if(d.type==="backendSystem"&&e.systemAuthType==="basic"&&await e.isAuthRequired())return{message:f("prompts.systemSelection.authenticationFailedUpdateCredentials"),severity:Yn.Severity.information};if(e.ignoreCertError)return{message:f("warnings.certErrorIgnoredByNodeSetting"),severity:Yn.Severity.warning}},"additionalMessages")}];if((0,wt.isAppStudio)()){let d={when:n(h=>{let m=h?.[P.systemSelection];return m?.type==="destination"?(0,wt.isPartialUrlDestination)(m.system):!1},"when"),type:"input",name:fh.destinationServicePath,message:f("prompts.destinationServicePath.message"),guiOptions:{hint:f("prompts.destinationServicePath.hint"),mandatory:!0,breadcrumb:!0,applyDefaultWhenDirty:!0},default:"",validate:n(async(h,m)=>{if(!h||h.trim().length<2||h.startsWith("//"))return e.resetConnectionState(!0),f("prompts.destinationServicePath.invalidServicePathWarning");let S=m?.[P.systemSelection]?.system,E=Jp(S.Host,h);return E!==!0?(e.resetConnectionState(!0),E):await nr(S,e,i,h)},"validate")};l.push(d)}return D()===hh.hostEnvironment.cli&&!t?.systemSelection?.useAutoComplete&&l.push({when:n(async d=>{let h=d?.[P.systemSelection];if(!h)return!1;let m=await ph(h,e,i,void 0,o?.value);if(m!==!0)throw y.logger.error(m.toString),new Error(m.toString());return!1},"when"),name:`${fh.systemSelectionCli}`}),l.push(...ii(e,ui,void 0,i)),l}n(hN,"getSystemConnectionQuestions");var di=require("../../commonlibs/yeoman-ui-types/index.js"),yh=require("../../fiori-generator-shared/dist/index.js"),vh=require("../../open-ux-shared/inquirer-common/index.js");var je;(function(e){e.ignoreCertError="ignoreCertError",e.username="username",e.cliIgnoreCertValidate="cliIgnoreCertValidate"})(je||(je={}));var gh=require("../../open-ux-shared/axios-extension/index.js"),Tt=require("../../open-ux-shared/inquirer-common/index.js"),Xn=require("../../open-ux-shared/nodejs-utils/index.js"),Jn=require("../../odata-service-writer/dist/index.js");async function sr(e,{odataService:t,axiosConfig:r},i=void 0,s=!1){try{s===!0&&(0,Xn.setGlobalRejectUnauthorized)(!s);let a=await t.metadata(),c=ht(a,i);if(c.validationMsg)return{validationResult:c.validationMsg};let o=c.version;v.odataService.metadata=Bf(a),v.odataService.odataVersion=o,v.odataService.ignoreCertError=s;let u=new URL(e),l=u.searchParams.get(nt)??void 0;u.searchParams.delete(nt),v.odataService.servicePath=`${u.pathname}${u.search}`,v.odataService.origin=u.origin,v.odataService.sapClient=l;let d=!1;try{let m=(0,gh.createForAbap)(r).catalog(o);y.attachAxiosLogger(m.interceptors),y.logger.debug("Getting annotations for service");let S=await m.getAnnotations({path:u.pathname});y.logger.debug(`Annotations array of length: ${S?.length} returned`),(S?.length===0||!S)&&(y.logger.info(f("prompts.validationMessages.annotationsNotFound")),d=c.version===Jn.OdataVersion.v2),v.odataService.annotations=S}catch{y.logger.info(f("prompts.validationMessages.annotationsNotFound")),d=c.version===Jn.OdataVersion.v2}return{validationResult:!0,showAnnotationWarning:d,convertedMetadata:c.convertedMetadata}}catch(a){return delete v.odataService.metadata,Tt.ErrorHandler.getErrorType(a)===Tt.ERROR_TYPE.NOT_FOUND?{validationResult:Tt.ErrorHandler.getErrorMsgFromType(Tt.ERROR_TYPE.ODATA_URL_NOT_FOUND)??!1}:{validationResult:N.logErrorMsgs(a)}}finally{(0,Xn.setGlobalRejectUnauthorized)(!0)}}n(sr,"validateService");function mN(e,t,r){let i=!1,s;return{type:"input",name:P.serviceUrl,guiOptions:{hint:"https://<hostname>:<port>/path/to/odata/service/",mandatory:!0,breadcrumb:!0},showOutputTabLink:"validationMessageOverflow",message:f("prompts.odataServiceUrl.message",{odataVersion:t}),validate:n(async a=>{i=!1;let c=await e.validateUrl(a);if(e.validity.canSkipCertError)return!0;if(c===!0){if(!e.validity.authRequired&&e.odataService){i=!1,s=void 0;let o=await sr(a,{odataService:e.odataService,axiosConfig:e.axiosConfig},t,e.ignoreCertError);return i=!!o.showAnnotationWarning,s=o.convertedMetadata,o.validationResult}return!0}return c},"validate"),additionalMessages:n(()=>Zn(i,r,s,e.ignoreCertError),"additionalMessages")}}n(mN,"getServiceUrlPrompt");function Zn(e,t,r,i){if(i)return{message:f("warnings.certErrorIgnoredByNodeSetting"),severity:di.Severity.warning};if(e)return{message:f("warnings.noAnnotations"),severity:di.Severity.warning};if(r&&t&&Zr(r))return{message:f("warnings.collaborativeDraftMessage"),severity:di.Severity.warning}}n(Zn,"getAdditionalMessages");function gN(e,t,r){let i=!1,s;return{when:n(({serviceUrl:a})=>!!(a&&e.validity.canSkipCertError&&!e.ignoreCertError),"when"),type:"confirm",name:je.ignoreCertError,message:f("prompts.ignoreCertErrors.message"),default:!1,validate:n(async(a,{serviceUrl:c})=>{if(i=!1,!c)return!1;a&&y.logger.warn(f("warnings.warningCertificateValidationDisabled"));let o=await e.validateUrl(c,{ignoreCertError:a,forceReValidation:!0});if(o===!0){if(!e.validity.authRequired&&e.odataService){let u=await sr(c,{odataService:e.odataService,axiosConfig:e.axiosConfig},t,a);return i=!!u.showAnnotationWarning,s=u.convertedMetadata,u.validationResult}return!0}return o},"validate"),additionalMessages:n(()=>Zn(i,r,s),"additionalMessages")}}n(gN,"getIgnoreCertErrorsPrompt");function yN(e,t){return{when:n(async({serviceUrl:r,ignoreCertError:i})=>{if(r&&e.validity.canSkipCertError){if(!i)throw new Error(f("errors.exitingGeneration",{exitReason:f("errors.certValidationRequired")}));y.logger.warn(f("warnings.warningCertificateValidationDisabled"));let s=await e.validateUrl(r,{ignoreCertError:i,forceReValidation:!0});if(s!==!0)throw new Error(s.toString());if(!e.validity.authRequired&&e.odataService){let{validationResult:a}=await sr(r,{odataService:e.odataService,axiosConfig:e.axiosConfig},t,!0);if(a!==!0)throw new Error(f("errors.exitingGeneration",{exitReason:a.toString()}))}}return!1},"when"),name:je.cliIgnoreCertValidate}}n(yN,"getCliIgnoreCertValidatePrompt");function vN(e){return{when:n(()=>e.validity.reachable?e.validity.authRequired===!0:!1,"when"),type:"input",name:je.username,message:f("prompts.serviceUsername.message"),guiOptions:{mandatory:!0},validate:n(t=>t?.length>0,"validate")}}n(vN,"getUsernamePrompt");function bN(e,t,r){let i=!1,s;return{when:n(()=>e.validity.reachable?e.validity.authRequired===!0:!1,"when"),type:"password",guiOptions:{applyDefaultWhenDirty:!0,mandatory:!0},guiType:"login",name:P.serviceUrlPassword,message:f("prompts.servicePassword.message"),mask:"*",validate:n(async(a,{username:c,serviceUrl:o,ignoreCertError:u,sapClient:l})=>{if(!o||!c||!a)return!1;let{valResult:d}=await e.validateAuth(o,c,a,{ignoreCertError:u,sapClient:l});if(d===!0&&e.odataService){i=!1,s=void 0;let h=await sr(o,{odataService:e.odataService,axiosConfig:e.axiosConfig},t,u||e.ignoreCertError);return i=!!h.showAnnotationWarning,s=h.convertedMetadata,h.validationResult}return d},"validate"),additionalMessages:n(()=>Zn(i,r,s),"additionalMessages")}}n(bN,"getPasswordPrompt");function bh(e={}){let t=new Z,r=e?.requiredOdataVersion;v.reset();let i=[mN(t,r,e?.showCollaborativeDraftWarning),gN(t,r,e?.showCollaborativeDraftWarning)];D()===yh.hostEnvironment.cli&&i.push(yN(t,r)),i.push(vN(t),bN(t,r,e?.showCollaborativeDraftWarning));let s={};return e?.additionalMessages&&(s={[P.serviceUrl]:e,[P.serviceUrlPassword]:{additionalMessages:e?.additionalMessages},[je.ignoreCertError]:{additionalMessages:e?.additionalMessages}}),s&&(i=(0,vh.extendWithOptions)(i,s,v.odataService)),i}n(bh,"getServiceUrlQuestions");async function Sh(e,t){let r=[SN(e?.datasourceType)];return r.push(...await wN(e,t)),r}n(Sh,"getQuestions");function SN(e){let t=Hf(e);return{type:"list",name:P.datasourceType,guiOptions:{breadcrumb:!0},default:e?.default??-1,message:f("prompts.datasourceType.message"),choices:t}}n(SN,"getDatasourceTypeQuestion");async function wN(e,t){let r=[];return r.push(...(0,ar.withCondition)(await li(e,t),i=>i.datasourceType===W.sapSystem)),r.push(...(0,ar.withCondition)([op(e?.metadataFilePath)],i=>i.datasourceType===W.metadataFile)),r.push(...(0,ar.withCondition)(ip(e),i=>i.datasourceType===W.capProject)),r.push(...(0,ar.withCondition)(bh(e?.serviceUrl),i=>i.datasourceType===W.odataServiceUrl)),r}n(wN,"getDatasourceTypeConditionalQuestions");var fe=require("../../commonlibs/yeoman-ui-types/index.js"),Ee=require("../../open-ux-shared/inquirer-common/index.js"),fi=require("../../odata-service-writer/dist/index.js");var es=require("../../odata-service-writer/dist/index.js");function TN(e,t){let r=[{name:f("texts.choiceNameNone"),value:""}],s=($f(e?.Definitions)||{}).Edmx.DataServices.Schema?.Annotations,a=[];if(Array.isArray(s)?a=s:typeof s=="object"&&a.push(s),a=a.filter(c=>c.Target===t),a.length>0){let c="UI.SelectionPresentationVariant",o=a[0]?.Annotation;Array.isArray(o)?o.filter(u=>u.Term===c).forEach(u=>{u.Qualifier&&r.push({name:u.Qualifier,value:u.Qualifier})}):o.Term===c&&(o=[],r.push({name:o.Qualifier,value:o.Qualifier}))}return r}n(TN,"getQualifierChoices");function wh(e,t,r=!1){let i=[];if(t&&e===es.OdataVersion.v2){let s=[];i.push({when:n(a=>(a.mainEntity&&(s=TN(t,a.mainEntity?.entitySetType)),s.length>1),"when"),type:"list",name:G.presentationQualifier,message:f("prompts.presentationQualifier.message"),guiOptions:{hint:f("prompts.presentationQualifier.hint"),breadcrumb:!0},choices:n(()=>s,"choices"),default:0})}return r||(e===es.OdataVersion.v4?i.push({when:n(s=>!!s.mainEntity,"when"),type:"list",name:G.tableSelectionMode,message:f("prompts.tableSelectionMode.message"),guiOptions:{hint:f("prompts.tableSelectionMode.hint"),breadcrumb:!0},choices:n(()=>[{name:f("prompts.tableSelectionMode.choiceNone"),value:"None"},{name:f("prompts.tableSelectionMode.choiceAuto"),value:"Auto"},{name:f("prompts.tableSelectionMode.choiceMulti"),value:"Multi"},{name:f("prompts.tableSelectionMode.choiceSingle"),value:"Single"}],"choices")}):i.push({type:"confirm",name:G.tableMultiSelect,message:f("prompts.tableMultiSelect.message"),guiOptions:{hint:f("prompts.tableMultiSelect.hint"),breadcrumb:!0},default:!1},{type:"confirm",name:G.tableAutoHide,message:f("prompts.tableAutoHide.message"),guiOptions:{hint:f("prompts.tableAutoHide.hint"),breadcrumb:!0},default:!0},{type:"confirm",name:G.smartVariantManagement,message:f("prompts.smartVariantManagement.message"),guiOptions:{hint:f("prompts.smartVariantManagement.hint"),breadcrumb:!0},default:!1})),i}n(wh,"getAnalyticListPageQuestions");function _N(e,t,r,i){let s;if(e.length===0&&(t==="feop"&&i?s=f("prompts.mainEntitySelection.noDraftEnabledEntitiesError"):t==="alp"&&r===fi.OdataVersion.v4?s=f("prompts.mainEntitySelection.noEntitiesAlpV4Error"):s=f("prompts.mainEntitySelection.noEntitiesError")),!v.isYUI&&s)throw y.logger.debug(`Exiting due to validation error: ${s}`),new Error(f("errors.exitingGeneration",{exitReason:s}));return s??!0}n(_N,"validateEntityChoices");function Th(e,t,r=!1,i,s){let a=i?.useAutoComplete,c;t==="feop"&&r?c="filterDraftEnabled":t==="alp"&&(c="filterAggregateTransformationsOnly");let o=$p(e,{defaultMainEntityName:i?.defaultMainEntityName,entitySetFilter:c});if(!o.convertedMetadata||!o.odataVersion)return[];let u=o.odataVersion,l=[];if(t==="ovp")return l.push(PN(o,a)),l;l.push({type:a?"autocomplete":"list",name:G.mainEntity,message:f("prompts.mainEntitySelection.message"),guiOptions:{breadcrumb:!0,mandatory:!0},choices:o.choices,source:n((h,m)=>(0,Ee.searchChoices)(m,o.choices),"source"),default:o.defaultMainEntityIndex??o.draftRootIndex??0,validate:n(h=>{let m=_N(o.choices,t,u,r);return m!==!0?m:h?!0:f("prompts.mainEntitySelection.requiredError")},"validate"),additionalMessages:n(h=>{if(i?.defaultMainEntityName&&o.defaultMainEntityIndex===void 0)return{message:f("prompts.mainEntitySelection.defaultEntityNameNotFoundWarning"),severity:fe.Severity.warning};if(h?.mainEntityParameterName)return{message:f("prompts.mainEntitySelection.mainEntityParameterFoundInfo"),severity:fe.Severity.information}},"additionalMessages")});let d=o.convertedMetadata;if(t!=="fpm"){let h;l.push({when:n(m=>m.mainEntity&&!m.mainEntity.mainEntityParameterName?(h=Bp(d,u,m.mainEntity.entitySetName),h.length>0):!1,"when"),type:a?"autocomplete":"list",name:G.navigationEntity,message:f("prompts.navigationEntitySelection.message"),guiOptions:{applyDefaultWhenDirty:!0,breadcrumb:!0},choices:n(()=>h,"choices"),source:n((m,S)=>(0,Ee.searchChoices)(S,h),"source"),default:0})}return i?.displayPageBuildingBlockPrompt&&l.push(...CN()),l.push(...xN(e,t,u,r)),i?.hideTableLayoutPrompts||l.push(...EN(t,u,r,d)),t==="alp"&&l.push(...wh(u,s,i?.hideTableLayoutPrompts)),l}n(Th,"getEntitySelectionQuestions");function CN(){let e=[];return e.push({type:"confirm",name:G.addPageBuildingBlock,message:f("prompts.pageBuildingBlock.message"),default:!1,guiOptions:{breadcrumb:!0,hint:f("prompts.pageBuildingBlock.tooltip")},additionalMessages:n(t=>{if(t)return{message:f("prompts.pageBuildingBlock.warning"),severity:fe.Severity.warning}},"additionalMessages")}),e.push({when:n(t=>t.addPageBuildingBlock===!0,"when"),type:"input",name:G.pageBuildingBlockTitle,message:f("prompts.pageBuildingBlock.titleMessage"),guiOptions:{breadcrumb:!0,mandatory:!0},validate:n(t=>!!t,"validate")}),e}n(CN,"getPageBuildingBlockQuestions");function EN(e,t,r,i){let s=[{name:f("prompts.tableType.choiceAnalytical"),value:"AnalyticalTable"},{name:f("prompts.tableType.choiceGrid"),value:"GridTable"},{name:f("prompts.tableType.choiceResponsive"),value:"ResponsiveTable"}];e!=="alp"&&!r&&s.push({name:f("prompts.tableType.choiceTree"),value:"TreeTable"});let a=[];if(e==="lrop"||e==="worklist"||e==="alp"){let c,o;a.push({when:n(u=>!!u.mainEntity,"when"),type:"list",name:G.tableType,message:f("prompts.tableType.message"),guiOptions:{hint:f("prompts.tableType.hint"),breadcrumb:!0,mandatory:!0,applyDefaultWhenDirty:!0},validate:n(u=>u?!0:f("prompts.tableType.requiredError"),"validate"),choices:s,default:n(u=>{let l=u?.mainEntity;return l?.entitySetName!==c?.entitySetName||!u?.tableType?(o=Gp(e,i,t,r,l?.entitySetName),c=l,o):(o=void 0,u.tableType)},"default"),additionalMessages:n(u=>{if(u==="ResponsiveTable")return{message:f("prompts.tableType.responsiveTableInfo"),severity:fe.Severity.information};if(o==="AnalyticalTable"&&u==="AnalyticalTable")return{message:f("prompts.tableType.analyticalTableDefault"),severity:fe.Severity.information};if(o==="TreeTable"&&u==="TreeTable")return{message:f("prompts.tableType.treeTableDefault"),severity:fe.Severity.information}},"additionalMessages")}),a.push({when:n(u=>u?.tableType==="TreeTable"&&t===fi.OdataVersion.v4,"when"),type:"input",name:G.hierarchyQualifier,message:f("prompts.hierarchyQualifier.message"),guiOptions:{hint:f("prompts.hierarchyQualifier.hint"),breadcrumb:!0,mandatory:!0},default:n(u=>{if(u?.mainEntity?.entitySetName){let l=(0,Ee.findEntitySetByName)(i,u.mainEntity.entitySetName);return l?(0,Ee.getRecursiveHierarchyQualifierForEntitySet)(l):""}return""},"default"),validate:n(u=>u?!0:f("prompts.hierarchyQualifier.qualifierRequiredForV4Warning"),"validate")})}return a}n(EN,"getTableLayoutQuestions");function AN(e){return e?Buffer.byteLength(e)/1024:0}n(AN,"getEdmxSizeInKb");function xN(e,t,r,i){let s=AN(e)>Vd,a=[];return t==="feop"?(a.push({type:"confirm",name:G.addFEOPAnnotations,guiOptions:{breadcrumb:f("prompts.addFEOPAnnotations.breadcrumb")},message:f("prompts.addFEOPAnnotations.message"),additionalMessages:n(c=>{if(c&&s)return{message:f("warnings.largeMetadataDocument"),severity:fe.Severity.warning}},"additionalMessages"),default:!s}),a):((t==="lrop"||t==="worklist")&&r===fi.OdataVersion.v4&&a.push({type:"confirm",name:G.addLineItemAnnotations,guiOptions:{breadcrumb:f("prompts.addLineItemAnnotations.breadcrumb")},message:f("prompts.addLineItemAnnotations.message"),additionalMessages:n(c=>{if(c){if(s)return{message:f("warnings.largeMetadataDocument"),severity:fe.Severity.warning};if(i)return{message:f("prompts.addLineItemAnnotations.valueHelpsAnnotationsInfoMessage"),severity:fe.Severity.information}}},"additionalMessages"),default:!s}),a)}n(xN,"getAddAnnotationQuestions");function PN(e,t=!1){return{type:t?"autocomplete":"list",name:G.filterEntitySet,message:f("prompts.filterEntitySet.message"),guiOptions:{breadcrumb:!0},choices:e.choices,source:n((r,i)=>(0,Ee.searchChoices)(i,e.choices),"source"),default:e.defaultMainEntityIndex??e.draftRootIndex??0,validate:n(()=>e.choices.length===0?f("prompts.filterEntitySet.noEntitiesError"):!0,"validate")}}n(PN,"getFilterEntitySetQuestions");async function Eh(e,t,r=!1,i,s=!1,a){return await on(),t&&(y.logger=t),pe.ErrorHandler.logger=y.logger,pe.ErrorHandler.guidedAnswersEnabled=r,pe.ErrorHandler.platform=D().technical,pe.ErrorHandler.guidedAnswersTrigger="@sap-ux/odata-service-inquirer",v.isYUI=s,(0,pe.setTelemetryClient)(i),{prompts:await Sh(e,a),answers:v.odataService}}n(Eh,"getPrompts");async function NN(e,t,r){return t!==void 0&&(v.isYUI=t),r&&(y.logger=r),{prompts:await li(e),answers:v.odataService}}n(NN,"getSystemSelectionQuestions");function ON(e,t,r=!1,i,s,a,c=!1){return a&&(y.logger=a),v.isYUI=c,Th(e,t,r,i,s)}n(ON,"getEntityRelatedPrompts");async function IN(e,t,r,i,s,a=!1,c){e?.promptModule&&(t?.serviceSelection?.useAutoComplete??t?.capProject?.useAutoComplete)&&e.promptModule.registerPrompt("autocomplete",Ch.default);let o=(await Eh(t,r,i,s,a,c)).prompts,u=await e.prompt(o);return Object.assign(u,v.odataService),u}n(IN,"prompt");var qN=void 0;0&&(module.exports={CfAbapEnvServiceChoice,DatasourceType,ERROR_TYPE,ErrorHandler,NewSystemChoice,OdataVersion,getEntityRelatedPrompts,getPrompts,getSystemSelectionQuestions,prompt,promptNames});