@devvit/public-api 0.11.0 → 0.11.1-next-2024-10-10-bd1f66fbc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/public-api.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var yS=Object.create;var Cm=Object.defineProperty;var bS=Object.getOwnPropertyDescriptor;var kS=Object.getOwnPropertyNames;var SS=Object.getPrototypeOf,PS=Object.prototype.hasOwnProperty;var wm=r=>{throw TypeError(r)};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var CS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of kS(e))!PS.call(r,n)&&n!==t&&Cm(r,n,{get:()=>e[n],enumerable:!(i=bS(e,n))||i.enumerable});return r};var Mn=(r,e,t)=>(t=r!=null?yS(SS(r)):{},CS(e||!r||!r.__esModule?Cm(t,"default",{value:r,enumerable:!0}):t,r));var tl=(r,e,t)=>e.has(r)||wm("Cannot "+t);var s=(r,e,t)=>(tl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?wm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(tl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(tl(r,e,"access private method"),t);var ae=h((eO,xm)=>{xm.exports=function(r){try{return!!r()}catch{return!0}}});var oa=h((tO,Fm)=>{var wS=ae();Fm.exports=!wS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var X=h((rO,Am)=>{var Im=oa(),Tm=Function.prototype,rl=Tm.call,xS=Im&&Tm.bind.bind(rl,rl);Am.exports=Im?xS:function(r){return function(){return rl.apply(r,arguments)}}});var Rm=h((iO,Em)=>{var FS=Math.ceil,IS=Math.floor;Em.exports=Math.trunc||function(e){var t=+e;return(t>0?IS:FS)(t)}});var aa=h((nO,Om)=>{var TS=Rm();Om.exports=function(r){var e=+r;return e!==e||e===0?0:TS(e)}});var pe=h((sO,Bm)=>{var da=function(r){return r&&r.Math==Math&&r};Bm.exports=da(typeof globalThis=="object"&&globalThis)||da(typeof window=="object"&&window)||da(typeof self=="object"&&self)||da(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=h((oO,Mm)=>{Mm.exports=!1});var la=h((aO,Lm)=>{var Um=pe(),AS=Object.defineProperty;Lm.exports=function(r,e){try{AS(Um,r,{value:e,configurable:!0,writable:!0})}catch{Um[r]=e}return e}});var ua=h((dO,Nm)=>{var ES=pe(),RS=la(),Dm="__core-js_shared__",OS=ES[Dm]||RS(Dm,{});Nm.exports=OS});var il=h((lO,Hm)=>{var BS=Wr(),_m=ua();(Hm.exports=function(r,e){return _m[r]||(_m[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:BS?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"})});var ca=h((uO,qm)=>{qm.exports=function(r){return r==null}});var ma=h((cO,jm)=>{var MS=ca(),US=TypeError;jm.exports=function(r){if(MS(r))throw US("Can't call method on "+r);return r}});var Un=h((mO,Wm)=>{var LS=ma(),DS=Object;Wm.exports=function(r){return DS(LS(r))}});var Pe=h((pO,Gm)=>{var NS=X(),_S=Un(),HS=NS({}.hasOwnProperty);Gm.exports=Object.hasOwn||function(e,t){return HS(_S(e),t)}});var nl=h((gO,Vm)=>{var qS=X(),jS=0,WS=Math.random(),GS=qS(1 .toString);Vm.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+GS(++jS+WS,36)}});var Jm=h((hO,zm)=>{zm.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var ep=h((fO,Ym)=>{var Qm=pe(),sl=Jm(),$m=Qm.process,Km=Qm.Deno,Xm=$m&&$m.versions||Km&&Km.version,Zm=Xm&&Xm.v8,qe,pa;Zm&&(qe=Zm.split("."),pa=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!pa&&sl&&(qe=sl.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=sl.match(/Chrome\/(\d+)/),qe&&(pa=+qe[1])));Ym.exports=pa});var ol=h((vO,rp)=>{var tp=ep(),VS=ae();rp.exports=!!Object.getOwnPropertySymbols&&!VS(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&tp&&tp<41})});var al=h((yO,ip)=>{var zS=ol();ip.exports=zS&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ce=h((bO,sp)=>{var JS=pe(),$S=il(),np=Pe(),KS=nl(),XS=ol(),ZS=al(),Gr=JS.Symbol,dl=$S("wks"),QS=ZS?Gr.for||Gr:Gr&&Gr.withoutSetter||KS;sp.exports=function(r){return np(dl,r)||(dl[r]=XS&&np(Gr,r)?Gr[r]:QS("Symbol."+r)),dl[r]}});var dp=h((kO,ap)=>{var YS=Ce(),eP=YS("toStringTag"),op={};op[eP]="z";ap.exports=String(op)==="[object z]"});var ul=h((SO,lp)=>{var ll=typeof document=="object"&&document.all,tP=typeof ll>"u"&&ll!==void 0;lp.exports={all:ll,IS_HTMLDDA:tP}});var Z=h((PO,cp)=>{var up=ul(),rP=up.all;cp.exports=up.IS_HTMLDDA?function(r){return typeof r=="function"||r===rP}:function(r){return typeof r=="function"}});var ga=h((CO,pp)=>{var mp=X(),iP=mp({}.toString),nP=mp("".slice);pp.exports=function(r){return nP(iP(r),8,-1)}});var Ln=h((wO,gp)=>{var sP=dp(),oP=Z(),ha=ga(),aP=Ce(),dP=aP("toStringTag"),lP=Object,uP=ha(function(){return arguments}())=="Arguments",cP=function(r,e){try{return r[e]}catch{}};gp.exports=sP?ha:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=cP(e=lP(r),dP))=="string"?t:uP?ha(e):(i=ha(e))=="Object"&&oP(e.callee)?"Arguments":i}});var Dn=h((xO,hp)=>{var mP=Ln(),pP=String;hp.exports=function(r){if(mP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return pP(r)}});var ml=h((FO,yp)=>{var cl=X(),gP=aa(),hP=Dn(),fP=ma(),vP=cl("".charAt),fp=cl("".charCodeAt),yP=cl("".slice),vp=function(r){return function(e,t){var i=hP(fP(e)),n=gP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=fp(i,n),a<55296||a>56319||n+1===o||(c=fp(i,n+1))<56320||c>57343?r?vP(i,n):a:r?yP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};yp.exports={codeAt:vp(!1),charAt:vp(!0)}});var Sp=h((IO,kp)=>{var bP=pe(),kP=Z(),bp=bP.WeakMap;kp.exports=kP(bp)&&/native code/.test(String(bp))});var St=h((TO,wp)=>{var Pp=Z(),Cp=ul(),SP=Cp.all;wp.exports=Cp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Pp(r)||r===SP}:function(r){return typeof r=="object"?r!==null:Pp(r)}});var ge=h((AO,xp)=>{var PP=ae();xp.exports=!PP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var gl=h((EO,Ip)=>{var CP=pe(),Fp=St(),pl=CP.document,wP=Fp(pl)&&Fp(pl.createElement);Ip.exports=function(r){return wP?pl.createElement(r):{}}});var hl=h((RO,Tp)=>{var xP=ge(),FP=ae(),IP=gl();Tp.exports=!xP&&!FP(function(){return Object.defineProperty(IP("div"),"a",{get:function(){return 7}}).a!=7})});var fl=h((OO,Ap)=>{var TP=ge(),AP=ae();Ap.exports=TP&&AP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=h((BO,Ep)=>{var EP=St(),RP=String,OP=TypeError;Ep.exports=function(r){if(EP(r))return r;throw OP(RP(r)+" is not an object")}});var je=h((MO,Rp)=>{var BP=oa(),fa=Function.prototype.call;Rp.exports=BP?fa.bind(fa):function(){return fa.apply(fa,arguments)}});var Nn=h((UO,Op)=>{var vl=pe(),MP=Z(),UP=function(r){return MP(r)?r:void 0};Op.exports=function(r,e){return arguments.length<2?UP(vl[r]):vl[r]&&vl[r][e]}});var yl=h((LO,Bp)=>{var LP=X();Bp.exports=LP({}.isPrototypeOf)});var bl=h((DO,Mp)=>{var DP=Nn(),NP=Z(),_P=yl(),HP=al(),qP=Object;Mp.exports=HP?function(r){return typeof r=="symbol"}:function(r){var e=DP("Symbol");return NP(e)&&_P(e.prototype,qP(r))}});var kl=h((NO,Up)=>{var jP=String;Up.exports=function(r){try{return jP(r)}catch{return"Object"}}});var va=h((_O,Lp)=>{var WP=Z(),GP=kl(),VP=TypeError;Lp.exports=function(r){if(WP(r))return r;throw VP(GP(r)+" is not a function")}});var ya=h((HO,Dp)=>{var zP=va(),JP=ca();Dp.exports=function(r,e){var t=r[e];return JP(t)?void 0:zP(t)}});var _p=h((qO,Np)=>{var Sl=je(),Pl=Z(),Cl=St(),$P=TypeError;Np.exports=function(r,e){var t,i;if(e==="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r))||Pl(t=r.valueOf)&&!Cl(i=Sl(t,r))||e!=="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r)))return i;throw $P("Can't convert object to primitive value")}});var Wp=h((jO,jp)=>{var KP=je(),Hp=St(),qp=bl(),XP=ya(),ZP=_p(),QP=Ce(),YP=TypeError,eC=QP("toPrimitive");jp.exports=function(r,e){if(!Hp(r)||qp(r))return r;var t=XP(r,eC),i;if(t){if(e===void 0&&(e="default"),i=KP(t,r,e),!Hp(i)||qp(i))return i;throw YP("Can't convert object to primitive value")}return e===void 0&&(e="number"),ZP(r,e)}});var ba=h((WO,Gp)=>{var tC=Wp(),rC=bl();Gp.exports=function(r){var e=tC(r,"string");return rC(e)?e:e+""}});var Qe=h(zp=>{var iC=ge(),nC=hl(),sC=fl(),ka=Ze(),Vp=ba(),oC=TypeError,wl=Object.defineProperty,aC=Object.getOwnPropertyDescriptor,xl="enumerable",Fl="configurable",Il="writable";zp.f=iC?sC?function(e,t,i){if(ka(e),t=Vp(t),ka(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Il in i&&!i[Il]){var n=aC(e,t);n&&n[Il]&&(e[t]=i.value,i={configurable:Fl in i?i[Fl]:n[Fl],enumerable:xl in i?i[xl]:n[xl],writable:!1})}return wl(e,t,i)}:wl:function(e,t,i){if(ka(e),t=Vp(t),ka(i),nC)try{return wl(e,t,i)}catch{}if("get"in i||"set"in i)throw oC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=h((VO,Jp)=>{Jp.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Sa=h((zO,$p)=>{var dC=ge(),lC=Qe(),uC=Vr();$p.exports=dC?function(r,e,t){return lC.f(r,e,uC(1,t))}:function(r,e,t){return r[e]=t,r}});var Pa=h((JO,Xp)=>{var cC=il(),mC=nl(),Kp=cC("keys");Xp.exports=function(r){return Kp[r]||(Kp[r]=mC(r))}});var Ca=h(($O,Zp)=>{Zp.exports={}});var zr=h((KO,eg)=>{var pC=Sp(),Yp=pe(),gC=St(),hC=Sa(),Tl=Pe(),Al=ua(),fC=Pa(),vC=Ca(),Qp="Object already initialized",El=Yp.TypeError,yC=Yp.WeakMap,wa,_n,xa,bC=function(r){return xa(r)?_n(r):wa(r,{})},kC=function(r){return function(e){var t;if(!gC(e)||(t=_n(e)).type!==r)throw El("Incompatible receiver, "+r+" required");return t}};pC||Al.state?(We=Al.state||(Al.state=new yC),We.get=We.get,We.has=We.has,We.set=We.set,wa=function(r,e){if(We.has(r))throw El(Qp);return e.facade=r,We.set(r,e),e},_n=function(r){return We.get(r)||{}},xa=function(r){return We.has(r)}):(sr=fC("state"),vC[sr]=!0,wa=function(r,e){if(Tl(r,sr))throw El(Qp);return e.facade=r,hC(r,sr,e),e},_n=function(r){return Tl(r,sr)?r[sr]:{}},xa=function(r){return Tl(r,sr)});var We,sr;eg.exports={set:wa,get:_n,has:xa,enforce:bC,getterFor:kC}});var Rl=h(ig=>{"use strict";var tg={}.propertyIsEnumerable,rg=Object.getOwnPropertyDescriptor,SC=rg&&!tg.call({1:2},1);ig.f=SC?function(e){var t=rg(this,e);return!!t&&t.enumerable}:tg});var Bl=h((ZO,ng)=>{var PC=X(),CC=ae(),wC=ga(),Ol=Object,xC=PC("".split);ng.exports=CC(function(){return!Ol("z").propertyIsEnumerable(0)})?function(r){return wC(r)=="String"?xC(r,""):Ol(r)}:Ol});var Jr=h((QO,sg)=>{var FC=Bl(),IC=ma();sg.exports=function(r){return FC(IC(r))}});var Ml=h(ag=>{var TC=ge(),AC=je(),EC=Rl(),RC=Vr(),OC=Jr(),BC=ba(),MC=Pe(),UC=hl(),og=Object.getOwnPropertyDescriptor;ag.f=TC?og:function(e,t){if(e=OC(e),t=BC(t),UC)try{return og(e,t)}catch{}if(MC(e,t))return RC(!AC(EC.f,e,t),e[t])}});var Dl=h((eB,lg)=>{var Ul=ge(),LC=Pe(),dg=Function.prototype,DC=Ul&&Object.getOwnPropertyDescriptor,Ll=LC(dg,"name"),NC=Ll&&function(){}.name==="something",_C=Ll&&(!Ul||Ul&&DC(dg,"name").configurable);lg.exports={EXISTS:Ll,PROPER:NC,CONFIGURABLE:_C}});var _l=h((tB,ug)=>{var HC=X(),qC=Z(),Nl=ua(),jC=HC(Function.toString);qC(Nl.inspectSource)||(Nl.inspectSource=function(r){return jC(r)});ug.exports=Nl.inspectSource});var jl=h((rB,pg)=>{var ql=X(),WC=ae(),GC=Z(),Fa=Pe(),Hl=ge(),VC=Dl().CONFIGURABLE,zC=_l(),mg=zr(),JC=mg.enforce,$C=mg.get,cg=String,Ia=Object.defineProperty,KC=ql("".slice),XC=ql("".replace),ZC=ql([].join),QC=Hl&&!WC(function(){return Ia(function(){},"length",{value:8}).length!==8}),YC=String(String).split("String"),e0=pg.exports=function(r,e,t){KC(cg(e),0,7)==="Symbol("&&(e="["+XC(cg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Fa(r,"name")||VC&&r.name!==e)&&(Hl?Ia(r,"name",{value:e,configurable:!0}):r.name=e),QC&&t&&Fa(t,"arity")&&r.length!==t.arity&&Ia(r,"length",{value:t.arity});try{t&&Fa(t,"constructor")&&t.constructor?Hl&&Ia(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=JC(r);return Fa(i,"source")||(i.source=ZC(YC,typeof e=="string"?e:"")),r};Function.prototype.toString=e0(function(){return GC(this)&&$C(this).source||zC(this)},"toString")});var or=h((iB,gg)=>{var t0=Z(),r0=Qe(),i0=jl(),n0=la();gg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(t0(t)&&i0(t,o,i),i.global)n?r[e]=t:n0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:r0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Wl=h((nB,hg)=>{var s0=aa(),o0=Math.max,a0=Math.min;hg.exports=function(r,e){var t=s0(r);return t<0?o0(t+e,0):a0(t,e)}});var vg=h((sB,fg)=>{var d0=aa(),l0=Math.min;fg.exports=function(r){return r>0?l0(d0(r),9007199254740991):0}});var Ta=h((oB,yg)=>{var u0=vg();yg.exports=function(r){return u0(r.length)}});var Sg=h((aB,kg)=>{var c0=Jr(),m0=Wl(),p0=Ta(),bg=function(r){return function(e,t,i){var n=c0(e),o=p0(n),a=m0(i,o),c;if(r&&t!=t){for(;o>a;)if(c=n[a++],c!=c)return!0}else for(;o>a;a++)if((r||a in n)&&n[a]===t)return r||a||0;return!r&&-1}};kg.exports={includes:bg(!0),indexOf:bg(!1)}});var Vl=h((dB,Cg)=>{var g0=X(),Gl=Pe(),h0=Jr(),f0=Sg().indexOf,v0=Ca(),Pg=g0([].push);Cg.exports=function(r,e){var t=h0(r),i=0,n=[],o;for(o in t)!Gl(v0,o)&&Gl(t,o)&&Pg(n,o);for(;e.length>i;)Gl(t,o=e[i++])&&(~f0(n,o)||Pg(n,o));return n}});var Aa=h((lB,wg)=>{wg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Fg=h(xg=>{var y0=Vl(),b0=Aa(),k0=b0.concat("length","prototype");xg.f=Object.getOwnPropertyNames||function(e){return y0(e,k0)}});var zl=h(Ig=>{Ig.f=Object.getOwnPropertySymbols});var Ag=h((mB,Tg)=>{var S0=Nn(),P0=X(),C0=Fg(),w0=zl(),x0=Ze(),F0=P0([].concat);Tg.exports=S0("Reflect","ownKeys")||function(e){var t=C0.f(x0(e)),i=w0.f;return i?F0(t,i(e)):t}});var Og=h((pB,Rg)=>{var Eg=Pe(),I0=Ag(),T0=Ml(),A0=Qe();Rg.exports=function(r,e,t){for(var i=I0(e),n=A0.f,o=T0.f,a=0;a<i.length;a++){var c=i[a];!Eg(r,c)&&!(t&&Eg(t,c))&&n(r,c,o(e,c))}}});var Mg=h((gB,Bg)=>{var E0=ae(),R0=Z(),O0=/#|\.prototype\./,Hn=function(r,e){var t=M0[B0(r)];return t==L0?!0:t==U0?!1:R0(e)?E0(e):!!e},B0=Hn.normalize=function(r){return String(r).replace(O0,".").toLowerCase()},M0=Hn.data={},U0=Hn.NATIVE="N",L0=Hn.POLYFILL="P";Bg.exports=Hn});var qn=h((hB,Ug)=>{var Jl=pe(),D0=Ml().f,N0=Sa(),_0=or(),H0=la(),q0=Og(),j0=Mg();Ug.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,f;if(i?a=Jl:n?a=Jl[t]||H0(t,{}):a=(Jl[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(f=D0(a,c),p=f&&f.value):p=a[c],o=j0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;q0(g,p)}(r.sham||p&&p.sham)&&N0(g,"sham",!0),_0(a,c,g,r)}}});var $l=h((fB,Lg)=>{var W0=Vl(),G0=Aa();Lg.exports=Object.keys||function(e){return W0(e,G0)}});var Ng=h(Dg=>{var V0=ge(),z0=fl(),J0=Qe(),$0=Ze(),K0=Jr(),X0=$l();Dg.f=V0&&!z0?Object.defineProperties:function(e,t){$0(e);for(var i=K0(t),n=X0(t),o=n.length,a=0,c;o>a;)J0.f(e,c=n[a++],i[c]);return e}});var Hg=h((yB,_g)=>{var Z0=Nn();_g.exports=Z0("document","documentElement")});var jn=h((bB,Jg)=>{var Q0=Ze(),Y0=Ng(),qg=Aa(),ew=Ca(),tw=Hg(),rw=gl(),iw=Pa(),jg=">",Wg="<",Xl="prototype",Zl="script",Vg=iw("IE_PROTO"),Kl=function(){},zg=function(r){return Wg+Zl+jg+r+Wg+"/"+Zl+jg},Gg=function(r){r.write(zg("")),r.close();var e=r.parentWindow.Object;return r=null,e},nw=function(){var r=rw("iframe"),e="java"+Zl+":",t;return r.style.display="none",tw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(zg("document.F=Object")),t.close(),t.F},Ea,Ra=function(){try{Ea=new ActiveXObject("htmlfile")}catch{}Ra=typeof document<"u"?document.domain&&Ea?Gg(Ea):nw():Gg(Ea);for(var r=qg.length;r--;)delete Ra[Xl][qg[r]];return Ra()};ew[Vg]=!0;Jg.exports=Object.create||function(e,t){var i;return e!==null?(Kl[Xl]=Q0(e),i=new Kl,Kl[Xl]=null,i[Vg]=e):i=Ra(),t===void 0?i:Y0.f(i,t)}});var Kg=h((kB,$g)=>{var sw=ae();$g.exports=!sw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Yl=h((SB,Zg)=>{var ow=Pe(),aw=Z(),dw=Un(),lw=Pa(),uw=Kg(),Xg=lw("IE_PROTO"),Ql=Object,cw=Ql.prototype;Zg.exports=uw?Ql.getPrototypeOf:function(r){var e=dw(r);if(ow(e,Xg))return e[Xg];var t=e.constructor;return aw(t)&&e instanceof t?t.prototype:e instanceof Ql?cw:null}});var iu=h((PB,eh)=>{"use strict";var mw=ae(),pw=Z(),gw=St(),hw=jn(),Qg=Yl(),fw=or(),vw=Ce(),yw=Wr(),ru=vw("iterator"),Yg=!1,lt,eu,tu;[].keys&&(tu=[].keys(),"next"in tu?(eu=Qg(Qg(tu)),eu!==Object.prototype&&(lt=eu)):Yg=!0);var bw=!gw(lt)||mw(function(){var r={};return lt[ru].call(r)!==r});bw?lt={}:yw&&(lt=hw(lt));pw(lt[ru])||fw(lt,ru,function(){return this});eh.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:Yg}});var Wn=h((CB,rh)=>{var kw=Qe().f,Sw=Pe(),Pw=Ce(),th=Pw("toStringTag");rh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Sw(r,th)&&kw(r,th,{configurable:!0,value:e})}});var $r=h((wB,ih)=>{ih.exports={}});var nu=h((xB,nh)=>{"use strict";var Cw=iu().IteratorPrototype,ww=jn(),xw=Vr(),Fw=Wn(),Iw=$r(),Tw=function(){return this};nh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=ww(Cw,{next:xw(+!i,t)}),Fw(r,n,!1,!0),Iw[n]=Tw,r}});var oh=h((FB,sh)=>{var Aw=Z(),Ew=String,Rw=TypeError;sh.exports=function(r){if(typeof r=="object"||Aw(r))return r;throw Rw("Can't set "+Ew(r)+" as a prototype")}});var dh=h((IB,ah)=>{var Ow=X(),Bw=Ze(),Mw=oh();ah.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Ow(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Bw(n),Mw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var ou=h((TB,yh)=>{"use strict";var Uw=qn(),Lw=je(),Oa=Wr(),fh=Dl(),Dw=Z(),Nw=nu(),lh=Yl(),uh=dh(),_w=Wn(),Hw=Sa(),su=or(),qw=Ce(),ch=$r(),vh=iu(),jw=fh.PROPER,Ww=fh.CONFIGURABLE,mh=vh.IteratorPrototype,Ba=vh.BUGGY_SAFARI_ITERATORS,Gn=qw("iterator"),ph="keys",Vn="values",gh="entries",hh=function(){return this};yh.exports=function(r,e,t,i,n,o,a){Nw(t,e,i);var c=function(B){if(B===n&&b)return b;if(!Ba&&B in f)return f[B];switch(B){case ph:return function(){return new t(this,B)};case Vn:return function(){return new t(this,B)};case gh:return function(){return new t(this,B)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,f=r.prototype,m=f[Gn]||f["@@iterator"]||n&&f[n],b=!Ba&&m||c(n),y=e=="Array"&&f.entries||m,P,C,T;if(y&&(P=lh(y.call(new r)),P!==Object.prototype&&P.next&&(!Oa&&lh(P)!==mh&&(uh?uh(P,mh):Dw(P[Gn])||su(P,Gn,hh)),_w(P,p,!0,!0),Oa&&(ch[p]=hh))),jw&&n==Vn&&m&&m.name!==Vn&&(!Oa&&Ww?Hw(f,"name",Vn):(g=!0,b=function(){return Lw(m,this)})),n)if(C={values:c(Vn),keys:o?b:c(ph),entries:c(gh)},a)for(T in C)(Ba||g||!(T in f))&&su(f,T,C[T]);else Uw({target:e,proto:!0,forced:Ba||g},C);return(!Oa||a)&&f[Gn]!==b&&su(f,Gn,b,{name:n}),ch[e]=b,C}});var au=h((AB,bh)=>{bh.exports=function(r,e){return{value:r,done:e}}});var Ch=h(()=>{"use strict";var Gw=ml().charAt,Vw=Dn(),Sh=zr(),zw=ou(),kh=au(),Ph="String Iterator",Jw=Sh.set,$w=Sh.getterFor(Ph);zw(String,"String",function(r){Jw(this,{type:Ph,string:Vw(r),index:0})},function(){var e=$w(this),t=e.string,i=e.index,n;return i>=t.length?kh(void 0,!0):(n=Gw(t,i),e.index+=n.length,kh(n,!1))})});var du=h((OB,wh)=>{var Kw=ae(),Xw=Ce(),Zw=Wr(),Qw=Xw("iterator");wh.exports=!Kw(function(){var r=new URL("b?a=1&b=2&c=3","http://a"),e=r.searchParams,t="";return r.pathname="c%20d",e.forEach(function(i,n){e.delete("b"),t+=n+i}),Zw&&!r.toJSON||!e.sort||r.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[Qw]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var Fh=h((BB,xh)=>{var Yw=ga(),ex=X();xh.exports=function(r){if(Yw(r)==="Function")return ex(r)}});var Ma=h((MB,Th)=>{var Ih=Fh(),tx=va(),rx=oa(),ix=Ih(Ih.bind);Th.exports=function(r,e){return tx(r),e===void 0?r:rx?ix(r,e):function(){return r.apply(e,arguments)}}});var Rh=h((UB,Eh)=>{var Ah=jl(),nx=Qe();Eh.exports=function(r,e,t){return t.get&&Ah(t.get,e,{getter:!0}),t.set&&Ah(t.set,e,{setter:!0}),nx.f(r,e,t)}});var lu=h((LB,Oh)=>{var sx=yl(),ox=TypeError;Oh.exports=function(r,e){if(sx(e,r))return r;throw ox("Incorrect invocation")}});var Lh=h((DB,Uh)=>{"use strict";var Bh=ge(),ax=X(),dx=je(),lx=ae(),uu=$l(),ux=zl(),cx=Rl(),mx=Un(),px=Bl(),Kr=Object.assign,Mh=Object.defineProperty,gx=ax([].concat);Uh.exports=!Kr||lx(function(){if(Bh&&Kr({b:1},Kr(Mh({},"a",{enumerable:!0,get:function(){Mh(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},e={},t=Symbol(),i="abcdefghijklmnopqrst";return r[t]=7,i.split("").forEach(function(n){e[n]=n}),Kr({},r)[t]!=7||uu(Kr({},e)).join("")!=i})?function(e,t){for(var i=mx(e),n=arguments.length,o=1,a=ux.f,c=cx.f;n>o;)for(var p=px(arguments[o++]),g=a?gx(uu(p),a(p)):uu(p),f=g.length,m=0,b;f>m;)b=g[m++],(!Bh||dx(c,p,b))&&(i[b]=p[b]);return i}:Kr});var _h=h((NB,Nh)=>{var hx=je(),Dh=Ze(),fx=ya();Nh.exports=function(r,e,t){var i,n;Dh(r);try{if(i=fx(r,"return"),!i){if(e==="throw")throw t;return t}i=hx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Dh(i),t}});var qh=h((_B,Hh)=>{var vx=Ze(),yx=_h();Hh.exports=function(r,e,t,i){try{return i?e(vx(t)[0],t[1]):e(t)}catch(n){yx(r,"throw",n)}}});var Wh=h((HB,jh)=>{var bx=Ce(),kx=$r(),Sx=bx("iterator"),Px=Array.prototype;jh.exports=function(r){return r!==void 0&&(kx.Array===r||Px[Sx]===r)}});var Kh=h((qB,$h)=>{var Cx=X(),wx=ae(),Gh=Z(),xx=Ln(),Fx=Nn(),Ix=_l(),Vh=function(){},Tx=[],zh=Fx("Reflect","construct"),cu=/^\s*(?:class|function)\b/,Ax=Cx(cu.exec),Ex=!cu.exec(Vh),zn=function(e){if(!Gh(e))return!1;try{return zh(Vh,Tx,e),!0}catch{return!1}},Jh=function(e){if(!Gh(e))return!1;switch(xx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ex||!!Ax(cu,Ix(e))}catch{return!0}};Jh.sham=!0;$h.exports=!zh||wx(function(){var r;return zn(zn.call)||!zn(Object)||!zn(function(){r=!0})||r})?Jh:zn});var mu=h((jB,Xh)=>{"use strict";var Rx=ba(),Ox=Qe(),Bx=Vr();Xh.exports=function(r,e,t){var i=Rx(e);i in r?Ox.f(r,i,Bx(0,t)):r[i]=t}});var Ua=h((WB,Qh)=>{var Mx=Ln(),Zh=ya(),Ux=ca(),Lx=$r(),Dx=Ce(),Nx=Dx("iterator");Qh.exports=function(r){if(!Ux(r))return Zh(r,Nx)||Zh(r,"@@iterator")||Lx[Mx(r)]}});var pu=h((GB,Yh)=>{var _x=je(),Hx=va(),qx=Ze(),jx=kl(),Wx=Ua(),Gx=TypeError;Yh.exports=function(r,e){var t=arguments.length<2?Wx(r):e;if(Hx(t))return qx(_x(t,r));throw Gx(jx(r)+" is not iterable")}});var nf=h((VB,rf)=>{"use strict";var Vx=Ma(),zx=je(),Jx=Un(),$x=qh(),Kx=Wh(),Xx=Kh(),Zx=Ta(),ef=mu(),Qx=pu(),Yx=Ua(),tf=Array;rf.exports=function(e){var t=Jx(e),i=Xx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=Vx(o,n>2?arguments[2]:void 0));var c=Yx(t),p=0,g,f,m,b,y,P;if(c&&!(this===tf&&Kx(c)))for(b=Qx(t,c),y=b.next,f=i?new this:[];!(m=zx(y,b)).done;p++)P=a?$x(b,o,[m.value,p],!0):m.value,ef(f,p,P);else for(g=Zx(t),f=i?new this(g):tf(g);g>p;p++)P=a?o(t[p],p):t[p],ef(f,p,P);return f.length=p,f}});var gu=h((zB,of)=>{var sf=Wl(),eF=Ta(),tF=mu(),rF=Array,iF=Math.max;of.exports=function(r,e,t){for(var i=eF(r),n=sf(e,i),o=sf(t===void 0?i:t,i),a=rF(iF(o-n,0)),c=0;n<o;n++,c++)tF(a,c,r[n]);return a.length=c,a}});var hf=h((JB,gf)=>{var ar=X(),hu=2147483647,Jn=36,cf=1,yu=26,nF=38,sF=700,oF=72,aF=128,dF="-",lF=/[^\0-\u007E]/,mf=/[.\u3002\uFF0E\uFF61]/g,af="Overflow: input needs wider integers to process",fu=Jn-cf,df=RangeError,uF=ar(mf.exec),Xr=Math.floor,vu=String.fromCharCode,lf=ar("".charCodeAt),pf=ar([].join),Pt=ar([].push),cF=ar("".replace),mF=ar("".split),pF=ar("".toLowerCase),gF=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=lf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=lf(r,t++);(o&64512)==56320?Pt(e,((n&1023)<<10)+(o&1023)+65536):(Pt(e,n),t--)}else Pt(e,n)}return e},uf=function(r){return r+22+75*(r<26)},hF=function(r,e,t){var i=0;for(r=t?Xr(r/sF):r>>1,r+=Xr(r/e);r>fu*yu>>1;)r=Xr(r/fu),i+=Jn;return Xr(i+(fu+1)*r/(r+nF))},fF=function(r){var e=[];r=gF(r);var t=r.length,i=aF,n=0,o=oF,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&Pt(e,vu(c));var p=e.length,g=p;for(p&&Pt(e,dF);g<t;){var f=hu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<f&&(f=c);var m=g+1;if(f-i>Xr((hu-n)/m))throw df(af);for(n+=(f-i)*m,i=f,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>hu)throw df(af);if(c==i){for(var b=n,y=Jn;;){var P=y<=o?cf:y>=o+yu?yu:y-o;if(b<P)break;var C=b-P,T=Jn-P;Pt(e,vu(uf(P+C%T))),b=Xr(C/T),y+=Jn}Pt(e,vu(uf(b))),o=hF(n,m,g==p),n=0,g++}}n++,i++}return pf(e,"")};gf.exports=function(r){var e=[],t=mF(cF(pF(r),mf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],Pt(e,uF(lF,n)?"xn--"+fF(n):n);return pf(e,".")}});var bu=h(($B,ff)=>{var vF=TypeError;ff.exports=function(r,e){if(r<e)throw vF("Not enough arguments");return r}});var yf=h((KB,vf)=>{var yF=Ce(),bF=jn(),kF=Qe().f,ku=yF("unscopables"),Su=Array.prototype;Su[ku]==null&&kF(Su,ku,{configurable:!0,value:bF(null)});vf.exports=function(r){Su[ku][r]=!0}});var wf=h((XB,Cf)=>{"use strict";var SF=Jr(),Pu=yf(),bf=$r(),Sf=zr(),PF=Qe().f,CF=ou(),La=au(),wF=Wr(),xF=ge(),Pf="Array Iterator",FF=Sf.set,IF=Sf.getterFor(Pf);Cf.exports=CF(Array,"Array",function(r,e){FF(this,{type:Pf,target:SF(r),index:0,kind:e})},function(){var r=IF(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,La(void 0,!0)):t=="keys"?La(i,!1):t=="values"?La(e[i],!1):La([i,e[i]],!1)},"values");var kf=bf.Arguments=bf.Array;Pu("keys");Pu("values");Pu("entries");if(!wF&&xF&&kf.name!=="values")try{PF(kf,"name",{value:"values"})}catch{}});var Ff=h((ZB,xf)=>{var TF=or();xf.exports=function(r,e,t){for(var i in e)TF(r,i,e[i],t);return r}});var Af=h((QB,Tf)=>{var If=gu(),AF=Math.floor,Cu=function(r,e){var t=r.length,i=AF(t/2);return t<8?EF(r,e):RF(r,Cu(If(r,0,i),e),Cu(If(r,i),e),e)},EF=function(r,e){for(var t=r.length,i=1,n,o;i<t;){for(o=i,n=r[i];o&&e(r[o-1],n)>0;)r[o]=r[--o];o!==i++&&(r[o]=n)}return r},RF=function(r,e,t,i){for(var n=e.length,o=t.length,a=0,c=0;a<n||c<o;)r[a+c]=a<n&&c<o?i(e[a],t[c])<=0?e[a++]:t[c++]:a<n?e[a++]:t[c++];return r};Tf.exports=Cu});var Bu=h((YB,Kf)=>{"use strict";wf();var Tu=qn(),Qr=pe(),Da=je(),Ye=X(),OF=ge(),qf=du(),jf=or(),BF=Ff(),MF=Wn(),UF=nu(),Ru=zr(),Wf=lu(),wu=Z(),LF=Pe(),DF=Ma(),NF=Ln(),_F=Ze(),Gf=St(),he=Dn(),HF=jn(),Ef=Vr(),Au=pu(),qF=Ua(),Zr=bu(),jF=Ce(),WF=Af(),GF=jF("iterator"),Xn="URLSearchParams",Vf=Xn+"Iterator",zf=Ru.set,Ge=Ru.getterFor(Xn),VF=Ru.getterFor(Vf),zF=Object.getOwnPropertyDescriptor,Ou=function(r){if(!OF)return Qr[r];var e=zF(Qr,r);return e&&e.value},Rf=Ou("fetch"),_a=Ou("Request"),$n=Ou("Headers"),xu=_a&&_a.prototype,Of=$n&&$n.prototype,JF=Qr.RegExp,$F=Qr.TypeError,Jf=Qr.decodeURIComponent,KF=Qr.encodeURIComponent,XF=Ye("".charAt),Bf=Ye([].join),dr=Ye([].push),Eu=Ye("".replace),ZF=Ye([].shift),Mf=Ye([].splice),Uf=Ye("".split),QF=Ye("".slice),YF=/\+/g,Lf=Array(4),eI=function(r){return Lf[r-1]||(Lf[r-1]=JF("((?:%[\\da-f]{2}){"+r+"})","gi"))},tI=function(r){try{return Jf(r)}catch{return r}},Df=function(r){var e=Eu(r,YF," "),t=4;try{return Jf(e)}catch{for(;t;)e=Eu(e,eI(t--),tI);return e}},rI=/[!'()~]|%20/g,iI={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},nI=function(r){return iI[r]},Nf=function(r){return Eu(KF(r),rI,nI)},Fu=UF(function(e,t){zf(this,{type:Vf,iterator:Au(Ge(e).entries),kind:t})},"Iterator",function(){var e=VF(this),t=e.kind,i=e.iterator.next(),n=i.value;return i.done||(i.value=t==="keys"?n.key:t==="values"?n.value:[n.key,n.value]),i},!0),$f=function(r){this.entries=[],this.url=null,r!==void 0&&(Gf(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?XF(r,0)==="?"?QF(r,1):r:he(r)))};$f.prototype={type:Xn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=qF(r),t,i,n,o,a,c,p;if(e)for(t=Au(r,e),i=t.next;!(n=Da(i,t)).done;){if(o=Au(_F(n.value)),a=o.next,(c=Da(a,o)).done||(p=Da(a,o)).done||!Da(a,o).done)throw $F("Expected sequence with length 2");dr(this.entries,{key:he(c.value),value:he(p.value)})}else for(var g in r)LF(r,g)&&dr(this.entries,{key:g,value:he(r[g])})},parseQuery:function(r){if(r)for(var e=Uf(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Uf(i,"="),dr(this.entries,{key:Df(ZF(n)),value:Df(Bf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],dr(e,Nf(i.key)+"="+Nf(i.value));return Bf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Ha=function(){Wf(this,Kn);var e=arguments.length>0?arguments[0]:void 0;zf(this,new $f(e))},Kn=Ha.prototype;BF(Kn,{append:function(e,t){Zr(arguments.length,2);var i=Ge(this);dr(i.entries,{key:he(e),value:he(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=he(r),n=0;n<t.length;)t[n].key===i?Mf(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=he(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=he(e),n=[],o=0;o<t.length;o++)t[o].key===i&&dr(n,t[o].value);return n},has:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=he(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Zr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=he(e),c=he(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?Mf(n,p--,1):(o=!0,g.value=c));o||dr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ge(this);WF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=DF(e,arguments.length>1?arguments[1]:void 0),n=0,o;n<t.length;)o=t[n++],i(o.value,o.key,this)},keys:function(){return new Fu(this,"keys")},values:function(){return new Fu(this,"values")},entries:function(){return new Fu(this,"entries")}},{enumerable:!0});jf(Kn,GF,Kn.entries,{name:"entries"});jf(Kn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});MF(Ha,Xn);Tu({global:!0,constructor:!0,forced:!qf},{URLSearchParams:Ha});!qf&&wu($n)&&(_f=Ye(Of.has),Hf=Ye(Of.set),Iu=function(r){if(Gf(r)){var e=r.body,t;if(NF(e)===Xn)return t=r.headers?new $n(r.headers):new $n,_f(t,"content-type")||Hf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),HF(r,{body:Ef(0,he(e)),headers:Ef(0,t)})}return r},wu(Rf)&&Tu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Rf(e,arguments.length>1?Iu(arguments[1]):{})}}),wu(_a)&&(Na=function(e){return Wf(this,xu),new _a(e,arguments.length>1?Iu(arguments[1]):{})},xu.constructor=Na,Na.prototype=xu,Tu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Na})));var _f,Hf,Iu,Na;Kf.exports={URLSearchParams:Ha,getState:Ge}});var gv=h(()=>{"use strict";Ch();var sI=qn(),Ku=ge(),oI=du(),Xu=pe(),Xf=Ma(),Te=X(),Va=or(),we=Rh(),aI=lu(),zu=Pe(),Zu=Lh(),Yr=nf(),Ve=gu(),dI=ml().codeAt,lI=hf(),ct=Dn(),uI=Wn(),cI=bu(),dv=Bu(),lv=zr(),mI=lv.set,za=lv.getterFor("URL"),pI=dv.URLSearchParams,gI=dv.getState,Zn=Xu.URL,Ju=Xu.TypeError,Ja=Xu.parseInt,hI=Math.floor,Zf=Math.pow,Ie=Te("".charAt),ze=Te(/./.exec),Yn=Te([].join),fI=Te(1 .toString),vI=Te([].pop),ti=Te([].push),Qf=Te("".replace),yI=Te([].shift),bI=Te("".split),ts=Te("".slice),$a=Te("".toLowerCase),kI=Te([].unshift),SI="Invalid authority",Mu="Invalid scheme",lr="Invalid host",Yf="Invalid port",uv=/[a-z]/i,PI=/[\d+-.a-z]/i,$u=/\d/,CI=/^0x/i,wI=/^[0-7]+$/,xI=/^\d+$/,cv=/^[\da-f]+$/i,FI=/[\0\t\n\r #%/:<>?@[\\\]^|]/,II=/[\0\t\n\r #/:<>?@[\\\]^|]/,TI=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,AI=/[\t\n\r]/g,xe,EI=function(r){var e=bI(r,"."),t,i,n,o,a,c,p;if(e.length&&e[e.length-1]==""&&e.length--,t=e.length,t>4)return r;for(i=[],n=0;n<t;n++){if(o=e[n],o=="")return r;if(a=10,o.length>1&&Ie(o,0)=="0"&&(a=ze(CI,o)?16:8,o=ts(o,a==8?1:2)),o==="")c=0;else{if(!ze(a==10?xI:a==8?wI:cv,o))return r;c=Ja(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=Zf(256,5-t))return null}else if(c>255)return null;for(p=vI(i),n=0;n<i.length;n++)p+=i[n]*Zf(256,3-n);return p},RI=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,f,m,b=function(){return Ie(r,n)};if(b()==":"){if(Ie(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(cv,b());)o=o*16+Ja(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!ze($u,b()))return;for(;ze($u,b());){if(g=Ja(b(),10),p===null)p=g;else{if(p==0)return;p=p*10+g}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(f=t-i,t=7;t!=0&&f>0;)m=e[t],e[t--]=e[i+f-1],e[i+--f]=m;else if(t!=8)return;return e},OI=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},Qn=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)kI(e,r%256),r=hI(r/256);return Yn(e,".")}else if(typeof r=="object"){for(e="",i=OI(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=fI(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},Ga={},mv=Zu({},Ga,{" ":1,'"':1,"<":1,">":1,"`":1}),pv=Zu({},mv,{"#":1,"?":1,"{":1,"}":1}),Uu=Zu({},pv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ct=function(r,e){var t=dI(r,0);return t>32&&t<127&&!zu(e,r)?r:encodeURIComponent(r)},qa={ftp:21,file:null,http:80,https:443,ws:80,wss:443},es=function(r,e){var t;return r.length==2&&ze(uv,Ie(r,0))&&((t=Ie(r,1))==":"||!e&&t=="|")},ev=function(r){var e;return r.length>1&&es(ts(r,0,2))&&(r.length==2||(e=Ie(r,2))==="/"||e==="\\"||e==="?"||e==="#")},BI=function(r){return r==="."||$a(r)==="%2e"},MI=function(r){return r=$a(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Lu={},tv={},Du={},rv={},iv={},Nu={},nv={},sv={},ja={},Wa={},_u={},Hu={},qu={},ju={},ov={},Wu={},ei={},et={},av={},ur={},ut={},Qu=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw Ju(o);this.searchParams=null}else{if(t!==void 0&&(n=new Qu(t,!0)),o=this.parse(i,null,n),o)throw Ju(o);a=gI(new pI),a.bindURL(this),this.searchParams=a}};Qu.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Lu,o=0,a="",c=!1,p=!1,g=!1,f,m,b,y;for(r=ct(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=Qf(r,TI,"")),r=Qf(r,AI,""),f=Yr(r);o<=f.length;){switch(m=f[o],n){case Lu:if(m&&ze(uv,m))a+=$a(m),n=tv;else{if(e)return Mu;n=Du;continue}break;case tv:if(m&&(ze(PI,m)||m=="+"||m=="-"||m=="."))a+=$a(m);else if(m==":"){if(e&&(i.isSpecial()!=zu(qa,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&qa[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=ju:i.isSpecial()&&t&&t.scheme==i.scheme?n=rv:i.isSpecial()?n=sv:f[o+1]=="/"?(n=iv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=av)}else{if(e)return Mu;a="",n=Du,o=0;continue}break;case Du:if(!t||t.cannotBeABaseURL&&m!="#")return Mu;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Ve(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?ju:Nu;continue;case rv:if(m=="/"&&f[o+1]=="/")n=ja,o++;else{n=Nu;continue}break;case iv:if(m=="/"){n=Wa;break}else{n=et;continue}case Nu:if(i.scheme=t.scheme,m==xe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=nv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query="",n=ur;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.path.length--,n=et;continue}break;case nv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=ja;else if(m=="/")n=Wa;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case sv:if(n=ja,m!="/"||Ie(a,o+1)!="/")continue;o++;break;case ja:if(m!="/"&&m!="\\"){n=Wa;continue}break;case Wa:if(m=="@"){c&&(a="%40"+a),c=!0,b=Yr(a);for(var P=0;P<b.length;P++){var C=b[P];if(C==":"&&!g){g=!0;continue}var T=Ct(C,Uu);g?i.password+=T:i.username+=T}a=""}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return SI;o-=Yr(a).length+1,a="",n=_u}else a+=m;break;case _u:case Hu:if(e&&i.scheme=="file"){n=Wu;continue}else if(m==":"&&!p){if(a=="")return lr;if(y=i.parseHost(a),y)return y;if(a="",n=qu,e==Hu)return}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return lr;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=ei,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case qu:if(ze($u,m))a+=m;else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var B=Ja(a,10);if(B>65535)return Yf;i.port=i.isSpecial()&&B===qa[i.scheme]?null:B,a=""}if(e)return;n=ei;continue}else return Yf;break;case ju:if(i.scheme="file",m=="/"||m=="\\")n=ov;else if(t&&t.scheme=="file")if(m==xe)i.host=t.host,i.path=Ve(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Ve(t.path),i.query="",n=ur;else if(m=="#")i.host=t.host,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{ev(Yn(Ve(f,o),""))||(i.host=t.host,i.path=Ve(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case ov:if(m=="/"||m=="\\"){n=Wu;break}t&&t.scheme=="file"&&!ev(Yn(Ve(f,o),""))&&(es(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=et;continue;case Wu:if(m==xe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&es(a))n=et;else if(a==""){if(i.host="",e)return;n=ei}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ei}continue}else a+=m;break;case ei:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=ur;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=xe&&(n=et,m!="/"))continue;break;case et:if(m==xe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(MI(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):BI(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&es(a)&&(i.host&&(i.host=""),a=Ie(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==xe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)yI(i.path);m=="?"?(i.query="",n=ur):m=="#"&&(i.fragment="",n=ut)}else a+=Ct(m,pv);break;case av:m=="?"?(i.query="",n=ur):m=="#"?(i.fragment="",n=ut):m!=xe&&(i.path[0]+=Ct(m,Ga));break;case ur:!e&&m=="#"?(i.fragment="",n=ut):m!=xe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=Ct(m,Ga));break;case ut:m!=xe&&(i.fragment+=Ct(m,mv));break}o++}},parseHost:function(r){var e,t,i;if(Ie(r,0)=="["){if(Ie(r,r.length-1)!="]"||(e=RI(ts(r,1,-1)),!e))return lr;this.host=e}else if(this.isSpecial()){if(r=lI(r),ze(FI,r)||(e=EI(r),e===null))return lr;this.host=e}else{if(ze(II,r))return lr;for(e="",t=Yr(r),i=0;i<t.length;i++)e+=Ct(t[i],Ga);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return zu(qa,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!es(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,g=e+":";return n!==null?(g+="//",r.includesCredentials()&&(g+=t+(i?":"+i:"")+"@"),g+=Qn(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+Yn(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw Ju(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ri(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+Qn(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",Lu)},getUsername:function(){return this.username},setUsername:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=Ct(e[t],Uu)}},getPassword:function(){return this.password},setPassword:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=Ct(e[t],Uu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?Qn(r):Qn(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,_u)},getHostname:function(){var r=this.host;return r===null?"":Qn(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Hu)},getPort:function(){var r=this.port;return r===null?"":ct(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ct(r),r==""?this.port=null:this.parse(r,qu))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+Yn(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ei))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ie(r,0)=="?"&&(r=ts(r,1)),this.query="",this.parse(r,ur)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=ct(r),r==""){this.fragment=null;return}Ie(r,0)=="#"&&(r=ts(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=aI(this,re),i=cI(arguments.length,1)>1?arguments[1]:void 0,n=mI(t,new Qu(e,!1,i));Ku||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},re=ri.prototype,Fe=function(r,e){return{get:function(){return za(this)[r]()},set:e&&function(t){return za(this)[e](t)},configurable:!0,enumerable:!0}};Ku&&(we(re,"href",Fe("serialize","setHref")),we(re,"origin",Fe("getOrigin")),we(re,"protocol",Fe("getProtocol","setProtocol")),we(re,"username",Fe("getUsername","setUsername")),we(re,"password",Fe("getPassword","setPassword")),we(re,"host",Fe("getHost","setHost")),we(re,"hostname",Fe("getHostname","setHostname")),we(re,"port",Fe("getPort","setPort")),we(re,"pathname",Fe("getPathname","setPathname")),we(re,"search",Fe("getSearch","setSearch")),we(re,"searchParams",Fe("getSearchParams")),we(re,"hash",Fe("getHash","setHash")));Va(re,"toJSON",function(){return za(this).serialize()},{enumerable:!0});Va(re,"toString",function(){return za(this).serialize()},{enumerable:!0});Zn&&(Gu=Zn.createObjectURL,Vu=Zn.revokeObjectURL,Gu&&Va(ri,"createObjectURL",Xf(Gu,Zn)),Vu&&Va(ri,"revokeObjectURL",Xf(Vu,Zn)));var Gu,Vu;uI(ri,"URL");sI({global:!0,constructor:!0,forced:!oI,sham:!Ku},{URL:ri})});var hv=h(()=>{gv()});var fv=h(()=>{"use strict";var UI=qn(),LI=je();UI({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return LI(URL.prototype.toString,this)}})});var vv=h(()=>{Bu()});var bv=h((dM,yv)=>{var DI=pe();yv.exports=DI});var Sv=h((lM,kv)=>{hv();fv();vv();var NI=bv();kv.exports=NI.URL});var Fc=h((BD,Ey)=>{var QT=Object.prototype.toString;Ey.exports=function(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;if(t==="boolean")return"boolean";if(t==="string")return"string";if(t==="number")return"number";if(t==="symbol")return"symbol";if(t==="function")return iA(e)?"generatorfunction":"function";if(YT(e))return"array";if(oA(e))return"buffer";if(sA(e))return"arguments";if(tA(e))return"date";if(eA(e))return"error";if(rA(e))return"regexp";switch(Ay(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(nA(e))return"generator";switch(t=QT.call(e),t){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function Ay(r){return typeof r.constructor=="function"?r.constructor.name:null}function YT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function eA(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function tA(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function rA(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function iA(r,e){return Ay(r)==="GeneratorFunction"}function nA(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function sA(r){try{if(typeof r.length=="number"&&typeof r.callee=="function")return!0}catch(e){if(e.message.indexOf("callee")!==-1)return!0}return!1}function oA(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var By=h((MD,Oy)=>{"use strict";var Ry=Symbol.prototype.valueOf,aA=Fc();function dA(r,e){switch(aA(r)){case"array":return r.slice();case"object":return Object.assign({},r);case"date":return new r.constructor(Number(r));case"map":return new Map(r);case"set":return new Set(r);case"buffer":return mA(r);case"symbol":return pA(r);case"arraybuffer":return uA(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return cA(r);case"regexp":return lA(r);case"error":return Object.create(r);default:return r}}function lA(r){let e=r.flags!==void 0?r.flags:/\w+$/.exec(r)||void 0,t=new r.constructor(r.source,e);return t.lastIndex=r.lastIndex,t}function uA(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function cA(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function mA(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function pA(r){return Ry?Object(Ry.call(r)):{}}Oy.exports=dA});var Uy=h((UD,My)=>{"use strict";My.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Ny=h((LD,Dy)=>{"use strict";var gA=Uy();function Ly(r){return gA(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Dy.exports=function(e){var t,i;return!(Ly(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ly(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Hy=h((DD,_y)=>{"use strict";var hA=By(),fA=Fc(),vA=Ny();function Ic(r,e){switch(fA(r)){case"object":return yA(r,e);case"array":return bA(r,e);default:return hA(r)}}function yA(r,e){if(typeof e=="function")return e(r);if(e||vA(r)){let t=new r.constructor;for(let i in r)t[i]=Ic(r[i],e);return t}return r}function bA(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Ic(r[i],e);return t}_y.exports=Ic});var _c=h((ps,Fi)=>{var kA=200,Nc="__lodash_hash_undefined__",yd=1,Qy=2,Yy=9007199254740991,cd="[object Arguments]",Rc="[object Array]",SA="[object AsyncFunction]",eb="[object Boolean]",tb="[object Date]",rb="[object Error]",ib="[object Function]",PA="[object GeneratorFunction]",md="[object Map]",nb="[object Number]",CA="[object Null]",xi="[object Object]",qy="[object Promise]",wA="[object Proxy]",sb="[object RegExp]",pd="[object Set]",ob="[object String]",xA="[object Symbol]",FA="[object Undefined]",Oc="[object WeakMap]",ab="[object ArrayBuffer]",gd="[object DataView]",IA="[object Float32Array]",TA="[object Float64Array]",AA="[object Int8Array]",EA="[object Int16Array]",RA="[object Int32Array]",OA="[object Uint8Array]",BA="[object Uint8ClampedArray]",MA="[object Uint16Array]",UA="[object Uint32Array]",LA=/[\\^$.*+?()[\]{}|]/g,DA=/^\[object .+?Constructor\]$/,NA=/^(?:0|[1-9]\d*)$/,j={};j[IA]=j[TA]=j[AA]=j[EA]=j[RA]=j[OA]=j[BA]=j[MA]=j[UA]=!0;j[cd]=j[Rc]=j[ab]=j[eb]=j[gd]=j[tb]=j[rb]=j[ib]=j[md]=j[nb]=j[xi]=j[sb]=j[pd]=j[ob]=j[Oc]=!1;var db=typeof global=="object"&&global&&global.Object===Object&&global,_A=typeof self=="object"&&self&&self.Object===Object&&self,ht=db||_A||Function("return this")(),lb=typeof ps=="object"&&ps&&!ps.nodeType&&ps,jy=lb&&typeof Fi=="object"&&Fi&&!Fi.nodeType&&Fi,ub=jy&&jy.exports===lb,Tc=ub&&db.process,Wy=function(){try{return Tc&&Tc.binding&&Tc.binding("util")}catch{}}(),Gy=Wy&&Wy.isTypedArray;function HA(r,e){for(var t=-1,i=r==null?0:r.length,n=0,o=[];++t<i;){var a=r[t];e(a,t,r)&&(o[n++]=a)}return o}function qA(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function jA(r,e){for(var t=-1,i=r==null?0:r.length;++t<i;)if(e(r[t],t,r))return!0;return!1}function WA(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function GA(r){return function(e){return r(e)}}function VA(r,e){return r.has(e)}function zA(r,e){return r?.[e]}function JA(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function $A(r,e){return function(t){return r(e(t))}}function KA(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var XA=Array.prototype,ZA=Function.prototype,bd=Object.prototype,Ac=ht["__core-js_shared__"],cb=ZA.toString,rt=bd.hasOwnProperty,Vy=function(){var r=/[^.]+$/.exec(Ac&&Ac.keys&&Ac.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),mb=bd.toString,QA=RegExp("^"+cb.call(rt).replace(LA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zy=ub?ht.Buffer:void 0,hd=ht.Symbol,Jy=ht.Uint8Array,pb=bd.propertyIsEnumerable,YA=XA.splice,br=hd?hd.toStringTag:void 0,$y=Object.getOwnPropertySymbols,eE=zy?zy.isBuffer:void 0,tE=$A(Object.keys,Object),Bc=Ii(ht,"DataView"),gs=Ii(ht,"Map"),Mc=Ii(ht,"Promise"),Uc=Ii(ht,"Set"),Lc=Ii(ht,"WeakMap"),hs=Ii(Object,"create"),rE=Pr(Bc),iE=Pr(gs),nE=Pr(Mc),sE=Pr(Uc),oE=Pr(Lc),Ky=hd?hd.prototype:void 0,Ec=Ky?Ky.valueOf:void 0;function kr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function aE(){this.__data__=hs?hs(null):{},this.size=0}function dE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function lE(r){var e=this.__data__;if(hs){var t=e[r];return t===Nc?void 0:t}return rt.call(e,r)?e[r]:void 0}function uE(r){var e=this.__data__;return hs?e[r]!==void 0:rt.call(e,r)}function cE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=hs&&e===void 0?Nc:e,this}kr.prototype.clear=aE;kr.prototype.delete=dE;kr.prototype.get=lE;kr.prototype.has=uE;kr.prototype.set=cE;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function mE(){this.__data__=[],this.size=0}function pE(r){var e=this.__data__,t=kd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():YA.call(e,t,1),--this.size,!0}function gE(r){var e=this.__data__,t=kd(e,r);return t<0?void 0:e[t][1]}function hE(r){return kd(this.__data__,r)>-1}function fE(r,e){var t=this.__data__,i=kd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=mE;ft.prototype.delete=pE;ft.prototype.get=gE;ft.prototype.has=hE;ft.prototype.set=fE;function Sr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function vE(){this.size=0,this.__data__={hash:new kr,map:new(gs||ft),string:new kr}}function yE(r){var e=Sd(this,r).delete(r);return this.size-=e?1:0,e}function bE(r){return Sd(this,r).get(r)}function kE(r){return Sd(this,r).has(r)}function SE(r,e){var t=Sd(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Sr.prototype.clear=vE;Sr.prototype.delete=yE;Sr.prototype.get=bE;Sr.prototype.has=kE;Sr.prototype.set=SE;function fd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Sr;++e<t;)this.add(r[e])}function PE(r){return this.__data__.set(r,Nc),this}function CE(r){return this.__data__.has(r)}fd.prototype.add=fd.prototype.push=PE;fd.prototype.has=CE;function Bt(r){var e=this.__data__=new ft(r);this.size=e.size}function wE(){this.__data__=new ft,this.size=0}function xE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function FE(r){return this.__data__.get(r)}function IE(r){return this.__data__.has(r)}function TE(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!gs||i.length<kA-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new Sr(i)}return t.set(r,e),this.size=t.size,this}Bt.prototype.clear=wE;Bt.prototype.delete=xE;Bt.prototype.get=FE;Bt.prototype.has=IE;Bt.prototype.set=TE;function AE(r,e){var t=vd(r),i=!t&&GE(r),n=!t&&!i&&Dc(r),o=!t&&!i&&!n&&kb(r),a=t||i||n||o,c=a?WA(r.length,String):[],p=c.length;for(var g in r)(e||rt.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||_E(g,p)))&&c.push(g);return c}function kd(r,e){for(var t=r.length;t--;)if(fb(r[t][0],e))return t;return-1}function EE(r,e,t){var i=e(r);return vd(r)?i:qA(i,t(r))}function vs(r){return r==null?r===void 0?FA:CA:br&&br in Object(r)?DE(r):WE(r)}function Xy(r){return fs(r)&&vs(r)==cd}function gb(r,e,t,i,n){return r===e?!0:r==null||e==null||!fs(r)&&!fs(e)?r!==r&&e!==e:RE(r,e,t,i,gb,n)}function RE(r,e,t,i,n,o){var a=vd(r),c=vd(e),p=a?Rc:Ot(r),g=c?Rc:Ot(e);p=p==cd?xi:p,g=g==cd?xi:g;var f=p==xi,m=g==xi,b=p==g;if(b&&Dc(r)){if(!Dc(e))return!1;a=!0,f=!1}if(b&&!f)return o||(o=new Bt),a||kb(r)?hb(r,e,t,i,n,o):UE(r,e,p,t,i,n,o);if(!(t&yd)){var y=f&&rt.call(r,"__wrapped__"),P=m&&rt.call(e,"__wrapped__");if(y||P){var C=y?r.value():r,T=P?e.value():e;return o||(o=new Bt),n(C,T,t,i,o)}}return b?(o||(o=new Bt),LE(r,e,t,i,n,o)):!1}function OE(r){if(!bb(r)||qE(r))return!1;var e=vb(r)?QA:DA;return e.test(Pr(r))}function BE(r){return fs(r)&&yb(r.length)&&!!j[vs(r)]}function ME(r){if(!jE(r))return tE(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function hb(r,e,t,i,n,o){var a=t&yd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var g=o.get(r);if(g&&o.get(e))return g==e;var f=-1,m=!0,b=t&Qy?new fd:void 0;for(o.set(r,e),o.set(e,r);++f<c;){var y=r[f],P=e[f];if(i)var C=a?i(P,y,f,e,r,o):i(y,P,f,r,e,o);if(C!==void 0){if(C)continue;m=!1;break}if(b){if(!jA(e,function(T,B){if(!VA(b,B)&&(y===T||n(y,T,t,i,o)))return b.push(B)})){m=!1;break}}else if(!(y===P||n(y,P,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function UE(r,e,t,i,n,o,a){switch(t){case gd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case ab:return!(r.byteLength!=e.byteLength||!o(new Jy(r),new Jy(e)));case eb:case tb:case nb:return fb(+r,+e);case rb:return r.name==e.name&&r.message==e.message;case sb:case ob:return r==e+"";case md:var c=JA;case pd:var p=i&yd;if(c||(c=KA),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=Qy,a.set(r,e);var f=hb(c(r),c(e),i,n,o,a);return a.delete(r),f;case xA:if(Ec)return Ec.call(r)==Ec.call(e)}return!1}function LE(r,e,t,i,n,o){var a=t&yd,c=Zy(r),p=c.length,g=Zy(e),f=g.length;if(p!=f&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:rt.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var P=!0;o.set(r,e),o.set(e,r);for(var C=a;++m<p;){b=c[m];var T=r[b],B=e[b];if(i)var me=a?i(B,T,b,e,r,o):i(T,B,b,r,e,o);if(!(me===void 0?T===B||n(T,B,t,i,o):me)){P=!1;break}C||(C=b=="constructor")}if(P&&!C){var Bn=r.constructor,sa=e.constructor;Bn!=sa&&"constructor"in r&&"constructor"in e&&!(typeof Bn=="function"&&Bn instanceof Bn&&typeof sa=="function"&&sa instanceof sa)&&(P=!1)}return o.delete(r),o.delete(e),P}function Zy(r){return EE(r,JE,NE)}function Sd(r,e){var t=r.__data__;return HE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ii(r,e){var t=zA(r,e);return OE(t)?t:void 0}function DE(r){var e=rt.call(r,br),t=r[br];try{r[br]=void 0;var i=!0}catch{}var n=mb.call(r);return i&&(e?r[br]=t:delete r[br]),n}var NE=$y?function(r){return r==null?[]:(r=Object(r),HA($y(r),function(e){return pb.call(r,e)}))}:$E,Ot=vs;(Bc&&Ot(new Bc(new ArrayBuffer(1)))!=gd||gs&&Ot(new gs)!=md||Mc&&Ot(Mc.resolve())!=qy||Uc&&Ot(new Uc)!=pd||Lc&&Ot(new Lc)!=Oc)&&(Ot=function(r){var e=vs(r),t=e==xi?r.constructor:void 0,i=t?Pr(t):"";if(i)switch(i){case rE:return gd;case iE:return md;case nE:return qy;case sE:return pd;case oE:return Oc}return e});function _E(r,e){return e=e??Yy,!!e&&(typeof r=="number"||NA.test(r))&&r>-1&&r%1==0&&r<e}function HE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function qE(r){return!!Vy&&Vy in r}function jE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||bd;return r===t}function WE(r){return mb.call(r)}function Pr(r){if(r!=null){try{return cb.call(r)}catch{}try{return r+""}catch{}}return""}function fb(r,e){return r===e||r!==r&&e!==e}var GE=Xy(function(){return arguments}())?Xy:function(r){return fs(r)&&rt.call(r,"callee")&&!pb.call(r,"callee")},vd=Array.isArray;function VE(r){return r!=null&&yb(r.length)&&!vb(r)}var Dc=eE||KE;function zE(r,e){return gb(r,e)}function vb(r){if(!bb(r))return!1;var e=vs(r);return e==ib||e==PA||e==SA||e==wA}function yb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Yy}function bb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function fs(r){return r!=null&&typeof r=="object"}var kb=Gy?GA(Gy):BE;function JE(r){return VE(r)?AE(r):ME(r)}function $E(){return[]}function KE(){return!1}Fi.exports=zE});var aS=h(Dd=>{"use strict";Dd.byteLength=FR;Dd.toByteArray=TR;Dd.fromByteArray=RR;var st=[],_e=[],xR=typeof Uint8Array<"u"?Uint8Array:Array,vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Lr=0,sS=vm.length;Lr<sS;++Lr)st[Lr]=vm[Lr],_e[vm.charCodeAt(Lr)]=Lr;var Lr,sS;_e[45]=62;_e[95]=63;function oS(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function FR(r){var e=oS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function IR(r,e,t){return(e+t)*3/4-t}function TR(r){var e,t=oS(r),i=t[0],n=t[1],o=new xR(IR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=_e[r.charCodeAt(p)]<<18|_e[r.charCodeAt(p+1)]<<12|_e[r.charCodeAt(p+2)]<<6|_e[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=_e[r.charCodeAt(p)]<<2|_e[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=_e[r.charCodeAt(p)]<<10|_e[r.charCodeAt(p+1)]<<4|_e[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function AR(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function ER(r,e,t){for(var i,n=[],o=e;o<t;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(AR(i));return n.join("")}function RR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(ER(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(st[e>>2]+st[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),n.join("")}});var eq=Mn(Sv(),1);function v(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function cr(r,e){if(!r)throw Error(e)}var ie;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(ie||(ie={}));function wt(r){return r.startsWith(ie.COMMENT)}function Ka(r){return r.startsWith(ie.ACCOUNT)}function mr(r){return r.startsWith(ie.LINK)}function Pv(r){return r.startsWith(ie.MESSAGE)}function Cv(r){return r.startsWith(ie.SUBREDDIT)}function wv(r){return r.startsWith(ie.AWARD)}function _I(r){cr(wt(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function HI(r){cr(Ka(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function qI(r){cr(mr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function jI(r){cr(Pv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function WI(r){cr(Cv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function GI(r){cr(wv(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ii(r){return _I(r),r}function ne(r){return HI(r),r}function fe(r){return qI(r),r}function VI(r){return jI(r),r}function Ae(r){return WI(r),r}function zI(r){return GI(r),r}function Ee(r){if(wt(r))return ii(r);if(Ka(r))return ne(r);if(mr(r))return fe(r);if(Pv(r))return VI(r);if(Cv(r))return Ae(r);if(wv(r))return zI(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function Yu(r){return wt(r)}import*as w from"@devvit/protos";var Xa=class{constructor(e){}};var ec=(t=>(t.Installation="installation",t.App="app",t))(ec||{});function pr(r,e=new Set){for(let t of r){if(t.type==="group"){pr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}JI(r)}function JI(r){for(let e of r)if(e.type==="string"&&e.isSecret&&e.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${e.name}"`}var xt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var bM=["3rd-party","activity","add-emoji","add","add-media","add-to-feed","admin","ads","ai","align-center","align-left","align-right","all","ama","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audience","audio","author","automod","avatar-style","award","back","backup","ban","best","block","blockchain","bold","boost","bot","bounce","brand-awareness","browse","browser","cake","calendar","camera","campaign","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","chat-private","checkbox-dismiss","checkbox","checkmark","chrome","clear","client-list","close","closed-captioning","code-block","code-inline","coins-color-old","coins","collapse-left","collapse-right","collectible-expressions","collection","comment","comments","communities","community","confidence","contest","controversial","conversion","copy-clipboard","crop","crosspost","crowd-control","custom-feed","customize","dashboard","day","delete-column","delete","delete-row","devvit","discover","dismiss-all","distinguish","down-arrow","down","download","downvote","downvotes","drag","drugs","duplicate","edit","effect","embed","emoji","end-live-chat","error","expand-left","expand-right","external","feed-video","filter","format","forward","funnel","gif-post","gold","hashtag","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","insert-column-left","insert-column-right","insert-row-above","insert-row-below","internet","invite","italic","join","joined","jump-down","jump-up","karma","keyboard","kick","language","leave","left","link","link-post","list-bulleted","list-numbered","live-chat","live","load","location","lock","logout","loop","macro","mark-read","marketplace","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","mute","new","night","no-internet","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","official","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","play","poll-post","popular","posts","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radar","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","recovery-phrase","refresh","removal-reasons","remove","reply","report","reverse","rich-text","right","rising","rotate","rotate-image","rpan","rules","safari","save","save-view","saved","saved-response","search","self","send","settings","severity","share","share-new","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","spreadsheet","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","text","text-post","text-size","toggle","tools","top","topic-activism","topic-addictionsupport","topic-advice","topic-animals","topic-anime","topic-art","topic-beauty","topic-business","topic-careers","topic-cars","topic-celebrity","topic-craftsdiy","topic-crypto","topic-culture","topic-diy","topic-entertainment","topic-ethics","topic-family","topic-fashion","topic","topic-fitness","topic-food","topic-funny","topic-gender","topic-health","topic-help","topic-history","topic-hobbies","topic-homegarden","topic-internet","topic-law","topic-learning","topic-lifestyle","topic-marketplace","topic-mature","topic-mensfashion","topic-menshealth","topic-meta","topic-military","topic-movies","topic-music","topic-news","topic-other","topic-outdoors","topic-pets","topic-photography","topic-places","topic-podcasts","topic-politics","topic-programming","topic-reading","topic-religion","topic-science","topic-sexorientation","topic-sports","topic-style","topic-tabletop","topic-technology","topic-television","topic-traumasupport","topic-travel","topic-videogaming","topic-womensfashion","topic-womenshealth","translate","translation-off","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unstar","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","view-sort","views","volume","wallet","warning","webhook","whale","wiki-ban","wiki","wiki-unban","world","coins-color","powerup-color","powerup-fill-color","share-android","share-ios","video-live-1","video-live-fill-1","video-live","volume-mute","binoculars","caret-updown","planet","telescope"];import{AppSettingsDefinition as lT,GetFieldsResponse as uT}from"@devvit/protos";import{FormField as gr,FormFieldType as Re}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return $I(e);case"image":return KI(e);case"paragraph":return XI(e);case"number":return ZI(e);case"select":return QI(e);case"boolean":return YI(e);case"group":return eT(e);default:throw new Error("Unknown field type.")}})}function $I(r){return gr.fromPartial({defaultValue:{fieldType:Re.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Re.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function KI(r){return gr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Re.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function XI(r){return gr.fromPartial({defaultValue:{fieldType:Re.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Re.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function ZI(r){return gr.fromPartial({defaultValue:{fieldType:Re.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Re.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function QI(r){return gr.fromPartial({defaultValue:{fieldType:Re.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Re.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function YI(r){return gr.fromPartial({defaultValue:{fieldType:Re.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Re.BOOLEAN,helpText:r.helpText,label:r.label})}function eT(r){return gr.fromPartial({fieldType:Re.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as dT}from"@devvit/protos";import{RealtimeSubscriptionStatus as Fv}from"@devvit/protos";var L=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",Post:"devvit-post",PostAuthor:"devvit-post-author",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",SubredditName:"devvit-subreddit-name",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),xv;(function(r){r.Blocks="blocks",r.EmitSnapshots="emitSnapshots",r.EmitState="emitState",r.Realtime="realtime",r.Runtime="runtime",r.Surface="surface",r.UseAsync="useAsync",r.Payments="payments",r.Bootstrap="bootstrap"})(xv||(xv={}));function Iv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[L.App]?.values[0];v(c,"useChannel - app is missing from Context");let p=r.metadata[L.Installation]?.values[0];v(p,"useChannel - installation is missing from Context");async function g(T){let B=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(B,T);else throw Error(`Failed to send to channel '${B}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${B}`)}function f(){if(!o[n].active){let T=o[n].channel;o[n].active=!0,r.addRealtimeChannel(T)}}function m(){if(o[n].active){let T=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(T)}}function b(T){return async()=>{let B;switch(T.status){case Fv.REALTIME_SUBSCRIBED:o[n].connected=!0,B=t.onSubscribed?.();break;case Fv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,B=t.onUnsubscribed?.();break;default:B=t.onMessage(T.event?.data?.msg);break}await B}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:xt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let P=r.realtimeEvent;r.isInitialRender?y.active=!1:P&&y.active&&P.event.channel===y.channel&&(y.preventCallback||r.runHook(b(P)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let C=0;return y.active&&y.connected?C=2:y.active&&!y.connected?C=1:!y.active&&y.connected?C=3:!y.active&&!y.connected&&(C=4),{subscribe:f,unsubscribe:m,send:g,status:C}}return e}import{FormFieldType as ni}from"@devvit/protos";function tc(r){switch(r.fieldType){case ni.STRING:return r.stringValue;case ni.IMAGE:return r.stringValue;case ni.PARAGRAPH:return r.stringValue;case ni.NUMBER:return r.numberValue;case ni.BOOLEAN:return r.boolValue;case ni.SELECTION:return r.selectionValue?.values??[];default:return}}function Ft(r){return Object.keys(r).reduce((e,t)=>{let i=tc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Tv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,g={formKey:p,preventSubmit:!1,type:xt.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let f=r.formSubmittedEvent;return f&&!g.preventSubmit&&f.formId===p&&r.runHook(async()=>{let m=i(Ft(f.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function Av(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),g={lastRun:void 0,running:!1,preventCallback:!1,type:xt.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function f(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,y]of Object.entries(o))if(b!==n.toString()&&y?.type===xt.INTERVAL&&y?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:o[n]?.lastRun??Date.now(),preventCallback:!1,type:xt.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&g.running&&(g.preventCallback||(g.lastRun===void 0||g.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:f,stop:m}}return e}function Ev(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState();if(i in n)return r.currentHookIndex++,[n[i],a];if(r.isInitialRender||!(i in o)){let c=t instanceof Function?t():t;if(c instanceof Promise)throw(async()=>{n[i]=await c,r.currentHookIndex=0})();n[i]=c}else n[i]=o[i];function a(c){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=c instanceof Function?c(n[i]):c}return r.currentHookIndex++,[n[i],a]}return e}var sc={now(){return new Date}};function Rv(r){return`__autocache__${r}`}function Ov(r){return`__lock__${r}`}var rT=300,iT=1e3,Za=5e3,rc=3,Bv=.1,Mv=1e3,nT=3e4;function Uv(r){if(r.error)throw new Error(r.error);return r.value}var It,Tt,Oe,si,$,Lv,Dv,Nv,ic,_v,Hv,nc,qv,Qa=class{constructor(e,t,i=sc){l(this,$);l(this,It);l(this,Tt,{});l(this,Oe);l(this,si);d(this,It,e),d(this,si,t),d(this,Oe,i)}async cache(e,t){d(this,Tt,s(this,si).__cache=s(this,si).__cache??{}),S(this,$,qv).call(this,t);let i=S(this,$,Lv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,nc).call(this,t.key),o=await S(this,$,Dv).call(this,t,n,e);return Uv(o)}};It=new WeakMap,Tt=new WeakMap,Oe=new WeakMap,si=new WeakMap,$=new WeakSet,Lv=function(e){let t=s(this,Tt)[e];if(t){let i=s(this,Oe).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<rc&&Math.random()<Bv&&t.errorTime+Mv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Mv<i||n){delete s(this,Tt)[e];return}else return Uv(t)}},Dv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Hv).call(this,n):1;return!t||t?.error&&t.errorCount<rc&&Bv>Math.random()||o>Math.random()?S(this,$,Nv).call(this,e,t,i):t},Nv=async function(e,t,i){let n=Ov(e.key),o=s(this,Oe).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,It).set(n,"1",{expiration:a,nx:!0}))return S(this,$,_v).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Oe).now();return S(this,$,ic).call(this,p,e.key,e.ttl)}},ic=async function(e,t,i){let n=Math.min(i,iT),o=await S(this,$,nc).call(this,t);if(o)return o;if(s(this,Oe).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,rT)),S(this,$,ic).call(this,e,t,i)},_v=async function(e,t,i,n){let o=s(this,Oe).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Oe).now().getTime(),t.errorCount++}return s(this,Tt)[e]=t,await s(this,It).set(Rv(e),JSON.stringify(t),{expiration:new Date(o+nT)}),t.error&&t.errorCount<rc&&await s(this,It).del(Ov(e)),t},Hv=function(e){let t=s(this,Oe).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},nc=async function(e){let t=await s(this,It).get(Rv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Oe).now().getTime(),s(this,Tt)[e]=i,i}},qv=function(e){e.ttl<Za&&(console.warn(`Cache TTL cannot be less than ${Za} milliseconds! Updating ttl value of ${e.ttl} to ${Za}.`),e.ttl=Za)};function jv(r,e,t=sc){let i=new Qa(r,e,t);return i.cache.bind(i)}function Wv(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,Gv,Vv,di=class{constructor(){l(this,li);l(this,oi,{});l(this,ai,{});d(this,oi,u.assets),d(this,ai,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,li,Gv).call(this,e,t??{webview:!1}):S(this,li,Vv).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,Gv=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return Wv(e),encodeURI(e)}catch{return""}},Vv=function(e,t){let i={},n=[],o=t.webview?s(this,ai):s(this,oi);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{Wv(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var At,ui=class{constructor(e){l(this,At);d(this,At,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,At));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await u.kvStorePlugin.Put({messages:i},s(this,At))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,At))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,At));return e}};At=new WeakMap;var rs,ci=class{constructor(e){l(this,rs);d(this,rs,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,rs));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};rs=new WeakMap;var is,mi=class{constructor(e){l(this,is);d(this,is,e)}async add(e){await u.modLogPlugin.Add(e,s(this,is))}};is=new WeakMap;var ns,pi=class{constructor(e){l(this,ns);d(this,ns,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:{msg:t}},s(this,ns))}};ns=new WeakMap;var k,ss,gi=class{constructor(e){l(this,k);l(this,ss);d(this,k,e),d(this,ss,new ed(e))}get modMail(){return s(this,ss)}getSubredditById(e){return ve.getById(Ee(e),s(this,k))}getSubredditInfoById(e){return Jv(e,s(this,k))}getSubredditByName(e){return ve.getByName(e,s(this,k))}getSubredditInfoByName(e){return $v(e,s(this,k))}addSubredditRemovalReason(e,t){return ve.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ve.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ve.getFromMetadata(s(this,k))}getPostById(e){return z.getById(Ee(e),s(this,k))}submitPost(e){return z.submit(e,s(this,k))}crosspost(e){return z.crosspost(e,s(this,k))}getUserById(e){return x.getById(Ee(e),s(this,k))}getUserByUsername(e){return x.getByUsername(e,s(this,k))}getCurrentUser(){return x.getFromMetadata(L.User,s(this,k))}getAppUser(){return x.getFromMetadata(L.AppUser,s(this,k))}getSnoovatarUrl(e){return x.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return ee.getById(Ee(e),s(this,k))}getComments(e){return ee.getComments(e,s(this,k))}getCommentsByUser(e){return ee.getCommentsByUser(e,s(this,k))}submitComment(e){return ee.submit({...e,id:Ee(e.id)},s(this,k))}getControversialPosts(e){return z.getControversialPosts(e,s(this,k))}getTopPosts(e){return z.getTopPosts(e,s(this,k))}getHotPosts(e){return z.getHotPosts(e,s(this,k))}getNewPosts(e){return z.getNewPosts(e,s(this,k))}getRisingPosts(e){return z.getRisingPosts(e,s(this,k))}getPostsByUser(e){return z.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return x.getOverview(e,s(this,k))}getModerationLog(e){return Ya(e,s(this,k))}getApprovedUsers(e){return x.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return x.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return x.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return x.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return x.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return x.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,k))}unbanUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return x.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return x.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return x.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return x.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.username,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return x.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return x.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return x.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return x.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return x.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Be.get(e,s(this,k))}deleteModNote(e){return Be.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?Ee(e.redditId):void 0};return Be.add(t,s(this,k))}addRemovalNote(e){return Be.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return hr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return hr.sendAsSubreddit(e,s(this,k))}async approve(e){if(wt(e))return ee.approve(e,s(this,k));if(mr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(wt(e))return ee.remove(e,t,s(this,k));if(mr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Me.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Me.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Me.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Me.removePostFlair(e,fe(t),s(this,k))}async getWidgets(e){return se.getWidgets(e,s(this,k))}async deleteWidget(e,t){return se.delete(e,t,s(this,k))}async addWidget(e){return se.add(e,s(this,k))}async reorderWidgets(e,t){return se.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ye.getPage(e,t,s(this,k))}async getWikiPages(e){return ye.getPages(e,s(this,k))}async createWikiPage(e){return ye.createPage(e,s(this,k))}async updateWikiPage(e){return ye.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ye.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ye.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ye.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ye.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ye.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ye.removeEditor(e,t,i,s(this,k))}getMessages(e){return hr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return hr.markAllAsRead(s(this,k))}report(e,t){return u.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,k))}getModQueue(e){return ve.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ve.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ve.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ve.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ve.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return Zv(e,s(this,k))}getVaultByUserId(e){return Qv(Ee(e),s(this,k))}getSubredditLeaderboard(e){return Kv(e,s(this,k))}getSubredditStyles(e){return Xv(e,s(this,k))}};k=new WeakMap,ss=new WeakMap;import{RedisKeyScope as oc}from"@devvit/protos";function td(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var E,R,O,ac=class{constructor(e,t,i){l(this,E);l(this,R);l(this,O);d(this,E,e),d(this,R,t),d(this,O,i)}async get(e){return await s(this,E).Get({key:e,transactionId:s(this,R)},s(this,O)),this}async multi(){await s(this,E).Multi(s(this,R),s(this,O))}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),await s(this,E).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,R)},s(this,O)),this}async del(...e){return await s(this,E).Del({keys:e,transactionId:s(this,R)},s(this,O)),this}async type(e){return await s(this,E).Type({key:e,transactionId:s(this,R)},s(this,O)),this}async exec(){let e=await s(this,E).Exec(s(this,R),s(this,O)),t=[];for(let i of e.response)i.members?t.push(i.members):i.nil!==void 0?t.push(null):i.num!==void 0?t.push(i.num):i.values!==void 0?t.push(i.values.values):i.str!==void 0&&t.push(i.str);return t}async discard(){await s(this,E).Discard(s(this,R),s(this,O))}async watch(...e){return await s(this,E).Watch({keys:e,transactionId:s(this,R)},s(this,O)),this}async unwatch(){return await s(this,E).Unwatch(s(this,R),s(this,O)),this}async getRange(e,t,i){return await s(this,E).GetRange({key:e,start:t,end:i,transactionId:s(this,R)},s(this,O)),this}async setRange(e,t,i){return await s(this,E).SetRange({key:e,offset:t,value:i,transactionId:s(this,R)},s(this,O)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,E).Strlen({key:e,transactionId:s(this,R)},s(this,O)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,E).MGet({keys:e,transactionId:s(this,R)},s(this,O)),this}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));return await s(this,E).MSet({kv:t,transactionId:s(this,R)},s(this,O)),this}async incrBy(e,t){return await s(this,E).IncrBy({key:e,value:t,transactionId:s(this,R)},s(this,O)),this}async expire(e,t){return await s(this,E).Expire({key:e,seconds:t,transactionId:s(this,R)},s(this,O)),this}async expireTime(e){return await s(this,E).ExpireTime({key:e,transactionId:s(this,R)},s(this,O)),this}async zAdd(e,...t){return await s(this,E).ZAdd({key:e,members:t,transactionId:s(this,R)},s(this,O)),this}async zScore(e,t){return await s(this,E).ZScore({key:{key:e,transactionId:s(this,R)},member:t},s(this,O)),this}async zRank(e,t){return await s(this,E).ZRank({key:{key:e,transactionId:s(this,R)},member:t},s(this,O)),this}async zIncrBy(e,t,i){return await s(this,E).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,R)},s(this,O)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,R)};return await s(this,E).ZScan(o,s(this,O)),this}async zCard(e){return await s(this,E).ZCard({key:e,transactionId:s(this,R)},s(this,O)),this}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"&&(o.byScore=!0),await s(this,E).ZRange({key:{key:e,transactionId:s(this,R)},start:t+"",stop:i+"",...o},s(this,O)),this}async zRem(e,t){return await s(this,E).ZRem({key:{key:e,transactionId:s(this,R)},members:t},s(this,O)),this}async zRemRangeByLex(e,t,i){return await s(this,E).ZRemRangeByLex({key:{key:e,transactionId:s(this,R)},min:t,max:i},s(this,O)),this}async zRemRangeByRank(e,t,i){return await s(this,E).ZRemRangeByRank({key:{key:e,transactionId:s(this,R)},start:t,stop:i},s(this,O)),this}async zRemRangeByScore(e,t,i){return await s(this,E).ZRemRangeByScore({key:{key:e,transactionId:s(this,R)},min:t,max:i},s(this,O)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,E).HGetAll({key:e,transactionId:s(this,R)},s(this,O)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,E).HGet({key:e,field:t,transactionId:s(this,R)},s(this,O)),this}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([n,o])=>({field:n,value:o}));return await s(this,E).HSet({key:e,fv:i,transactionId:s(this,R)},s(this,O)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,E).HIncrBy({key:e,field:t,value:i,transactionId:s(this,R)},s(this,O)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,E).HDel({key:e,fields:t,transactionId:s(this,R)},s(this,O)),this}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,R)};return await s(this,E).HScan(o,s(this,O)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,E).HKeys({key:e,transactionId:s(this,R)},s(this,O)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,E).HLen({key:e,transactionId:s(this,R)},s(this,O)),this}};E=new WeakMap,R=new WeakMap,O=new WeakMap;var M,hi,dc=class dc{constructor(e,t=void 0,i=oc.INSTALLATION){l(this,M);l(this,hi);d(this,M,e),d(this,hi,t),this.scope=i,this.global=i===oc.INSTALLATION?new dc(s(this,M),s(this,hi),oc.GLOBAL):this}get storage(){return s(this,hi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new ac(this.storage,t,s(this,M))}async get(e){try{let t=await this.storage.Get({key:e,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return t!==null?t.value??void 0:t}catch(t){if(td(t))return;throw t}}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,M))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,M))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,M))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,M));return n!==null?n.value:n}async setRange(e,t,i){return(await this.storage.SetRange({key:e,offset:t,value:i,scope:this.scope},s(this,M))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,M))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,M))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,M))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,M))).value}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"?o.byScore=!0:(o.offset=0,o.count=0),(await this.storage.ZRange({key:{key:e},start:t+"",stop:i+"",...o,scope:this.scope},s(this,M))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,M))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,M))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,M))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,M))).value}async zScore(e,t){try{let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zRank(e,t){try{let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,M));return n!==null?n.value:n}async mget(e){return this.mGet(e)}async mGet(e){let t=await this.storage.MGet({keys:e,scope:this.scope},s(this,M));return t!==null?t.values.map(i=>i||null):t}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));await this.storage.MSet({kv:t,scope:this.scope},s(this,M))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,M));return t!==null?t.value:t}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.ZScan(o,s(this,M))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,M));return t!==null?t.value:t}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){try{let i=await this.storage.HGet({key:e,field:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value??void 0:i}catch(i){if(td(i))return;throw i}}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([o,a])=>({field:o,value:a}));return(await this.storage.HSet({key:e,fv:i,scope:this.scope},s(this,M))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,M));return t!==null?t.fieldValues:t}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return(await this.storage.HDel({key:e,fields:t,scope:this.scope},s(this,M))).value}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.HScan(o,s(this,M))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,M));return t!==null?t.keys:t}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return(await this.storage.HIncrBy({key:e,field:t,value:i,scope:this.scope},s(this,M))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};M=new WeakMap,hi=new WeakMap;var fi=dc;var fr,vi=class{constructor(e){l(this,fr);d(this,fr,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,fr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,fr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,fr))).actions.map(t=>(v(t.request?.action,"Scheduled job is malformed"),"when"in t.request&&t.request.when!=null?{id:t.id,name:t.request.action.type,runAt:t.request.when,data:t.request.action.data}:{id:t.id,name:t.request.action.type,cron:t.request.cron??"",data:t.request.action}))}};fr=new WeakMap;var os,yi=class{constructor(e){l(this,os);d(this,os,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,os));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...Yv(t.installationSettings.settings,u.installationSettings),...Yv(t.appSettings.settings,u.appSettings)}}};os=new WeakMap;function Yv(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=tc(r[n]),i),{});return e&&ey(t,e),t}function ey(r,e){for(let t of e)t.type==="group"?ey(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as lc,Form as sT,ToastAppearance as ty}from"@devvit/protos";var vr,bi,rd=class{constructor(e){l(this,vr,[]);l(this,bi);d(this,bi,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,bi)){let a=s(this,bi).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=sT.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});pr(n.fields),o.fields=mt(n.fields),s(this,vr).push({type:lc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?ty.SUCCESS:ty.NEUTRAL}:t={text:e},s(this,vr).push({type:lc.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,vr).push({type:lc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,vr)}};vr=new WeakMap,bi=new WeakMap;function Ue({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new fi(r),c=jv(a,i?i.state:{}),p=new gi(r),g=new vi(r),f=new yi(r),m=e?new rd(i):void 0,b=new ci(r),y=new di,P=new pi(r),C=t&&i?Ev(i):void 0,T=t&&i?Av(i):void 0,B=t&&i?Tv(i):void 0,me=t&&i?Iv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:f,media:b,assets:y,realtime:P,get useForm(){return B??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return C??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return T??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return me??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var ry={name:"@devvit/public-api",version:"0.11.0-dev",license:"BSD-3-Clause",repository:{type:"git",url:"https://developers.reddit.com/"},type:"module",exports:{".":"./dist/index.js","./package.json":"./package.json","./*":"./dist/*"},main:"./dist/index.js",files:["dist/**"],scripts:{build:"yarn build:icon-types && yarn build:semantic-colors && tsc && cp -af devvit.tsconfig.json dist/ && yarn build:types && yarn build:min && yarn build:unmin","build:icon-types":"make-icons src/types/icons.ts","build:min":"esbuild --bundle --sourcemap=linked --target=es2020 --format=esm --metafile=dist/meta.min.json --outfile=dist/public-api.min.js --external:@devvit/protos --minify src/index.ts","build:semantic-colors":"node scripts/make-semantic-colors.js","build:types":"api-extractor run && sed -ne '/declare global {/,$ p' src/devvit/Devvit.ts >> dist/public-api.d.ts","build:unmin":"esbuild --bundle --sourcemap=inline --target=es2020 --format=iife --metafile=dist/meta.json --outfile=dist/public-api.iife.js --global-name=devvitPublicAPI src/index.ts",clean:"rm -rf .turbo api-extractor coverage dist src/devvit/internals/semanticColors.ts src/types/icons.ts || :",clobber:"yarn clean && rm -rf node_modules",dev:"tsc -w","dev:build":"chokidar ./src --command 'yarn build' --ignore './src/types/icons.ts' --ignore './src/devvit/internals/semanticColors.ts'",lint:"redlint .","lint:fix":"yarn lint --fix",prepublishOnly:"publish-package-json",test:"yarn test:unit && yarn test:types && yarn test:size","test:size":"filesize","test:types":"tsc --noEmit","test:unit":"vitest run","test:unit-with-coverage":"vitest run --coverage"},types:"./dist/index.d.ts",dependencies:{"@devvit/protos":"0.11.0-dev","@devvit/shared-types":"0.11.0-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/repo-tools":"0.11.0-dev","@devvit/tsconfig":"0.11.0-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"18.0.1","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"9.11.1",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"77 KB",none:"253 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[L.Subreddit]?.values[0];v(i,"subreddit is missing from Context");let n=r[L.SubredditName]?.values[0],o=r[L.AppUser]?.values[0],a=r[L.App]?.values[0],c=r[L.Version]?.values[0],p=r[L.User]?.values[0],g=aT(r);return{get appAccountId(){return v(o,"appAccountId is missing from Context"),o},subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,appName:a,appVersion:c,debug:g,toJSON(){return{appAccountId:o,appName:a,appVersion:c,subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,debug:g}}}}function aT(r){let e={blocks:void 0,emitSnapshots:void 0,emitState:void 0,realtime:void 0,runtime:void 0,surface:void 0,useAsync:void 0,payments:void 0,bootstrap:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[L.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||"true"))}return r[L.Debug]&&console.info(`[api] @devvit/public-api v${ry.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function iy(r){return r.flatMap(e=>e.type==="group"?iy(e.fields):e)}async function id(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Ft(r.fieldValues),o=iy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,f=Object.assign(Ue({metadata:t}),le(t)),m=await g({value:p,isEditing:r.editing},f);m&&(i.success=!1,i.errors[c]=m)}})),dT.fromJSON(i)}async function cT(){if(!u.appSettings)throw new Error("App settings were not defined.");return uT.fromJSON({fields:{fields:mt(u.appSettings)}})}async function mT(r,e){return id(r,u.appSettings,e)}function ny(r){r.provides(lT),U("GetAppSettingsFields",cT),U("ValidateAppForm",mT)}import{CustomPostDefinition as bT,RenderPostResponse as kT}from"@devvit/protos";import{BlockRenderEventType as Cc,EffectType as by}from"@devvit/protos";function ki(r){return r.__effects}function sy(){let r=new Set;return e=>{let t=e,i=1;for(;r.has(t);)t=`${e}.${i++}`;return r.add(t),t}}import{BlockActionType as Pc,BlockAvatarBackground as hy,BlockAvatarFacing as fy,BlockAvatarSize as Et,BlockBorderWidth as ad,BlockButtonAppearance as Rt,BlockButtonSize as gc,BlockGap as dd,BlockHorizontalAlignment as hc,BlockIconSize as ld,BlockImageResizeMode as as,BlockPadding as ds,BlockRadius as ls,BlockSpacerShape as fc,BlockSpacerSize as ud,BlockStackDirection as vc,BlockTextOutline as yc,BlockTextOverflow as bc,BlockTextSize as Pi,BlockTextStyle as kc,BlockTextWeight as vy,BlockType as tt,BlockVerticalAlignment as Sc}from"@devvit/protos";var uc={"alienblue-100":"#DCE2FB","alienblue-200":"#B8C5FC","alienblue-25":"#F7F8FD","alienblue-300":"#90A9FD","alienblue-400":"#648EFC","alienblue-50":"#EEF0FB","alienblue-500":"#1870F4","alienblue-600":"#115BCA","alienblue-700":"#0A449B","alienblue-75":"#E6E9FB","alienblue-800":"#0A2F6C","alienblue-900":"#0A1A3F","alienblue-950":"#07102B","berrypurple-100":"#F3DAFB","berrypurple-200":"#EAB3FD","berrypurple-25":"#FBF6FD","berrypurple-300":"#DE8BFF","berrypurple-400":"#CF5FFF","berrypurple-50":"#F8EDFC","berrypurple-500":"#BC0EFF","berrypurple-600":"#9B00D4","berrypurple-700":"#7600A3","berrypurple-75":"#F6E4FB","berrypurple-800":"#520472","berrypurple-900":"#300643","berrypurple-950":"#20042A",black:"#000000","black-opacity-0":"#00000000","black-opacity-10":"#00000019","black-opacity-15":"#00000026","black-opacity-20":"#00000033","black-opacity-25":"#0000003F","black-opacity-33":"#00000054","black-opacity-5":"#0000000C","black-opacity-50":"#0000007F","black-opacity-60":"#00000099","black-opacity-67":"#000000AA","black-opacity-80":"#000000CC","black-opacity-90":"#000000E5","brown-100":"#F1DFCF","brown-200":"#E9BE95","brown-25":"#FBF7F4","brown-300":"#DC9D5D","brown-400":"#BA854E","brown-50":"#F7EFE9","brown-500":"#9A6D3F","brown-600":"#7B5631","brown-700":"#5D4023","brown-75":"#F4E7DC","brown-800":"#3F2C19","brown-900":"#221A11","brown-950":"#15100A","coolgray-100":"#DBE4E9","coolgray-150":"#C9D7DE","coolgray-200":"#B7CAD4","coolgray-25":"#F6F8F9","coolgray-250":"#A4BDCA","coolgray-300":"#97AFBC","coolgray-350":"#8BA2AD","coolgray-400":"#7F949F","coolgray-450":"#748791","coolgray-50":"#EEF1F3","coolgray-500":"#667780","coolgray-525":"#576F76","coolgray-550":"#5C6C74","coolgray-600":"#536168","coolgray-650":"#48545B","coolgray-700":"#3D494E","coolgray-75":"#E5EBEE","coolgray-750":"#333D42","coolgray-800":"#2A3236","coolgray-850":"#21272A","coolgray-900":"#181C1F","coolgray-950":"#0E1113","global-black":{light:"#000000",dark:"#000000"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-white":{light:"#FFFFFF",dark:"#FFFFFF"},"kiwigreen-100":"#A8F5A0","kiwigreen-200":"#58E15B","kiwigreen-25":"#EBFDE7","kiwigreen-300":"#00C61C","kiwigreen-400":"#01A816","kiwigreen-50":"#DDF8D7","kiwigreen-500":"#008A10","kiwigreen-600":"#016E0B","kiwigreen-700":"#005306","kiwigreen-75":"#CAF5C2","kiwigreen-800":"#033902","kiwigreen-900":"#0D2005","kiwigreen-950":"#081404","lightblue-100":"#CAE7FB","lightblue-200":"#87D0FD","lightblue-25":"#F3F9FD","lightblue-300":"#02B9FB","lightblue-400":"#029DD5","lightblue-50":"#E6F3FC","lightblue-500":"#007FAE","lightblue-600":"#01668D","lightblue-700":"#014D6B","lightblue-75":"#D9EDFB","lightblue-800":"#03354B","lightblue-900":"#051E2B","lightblue-950":"#04131A","lime-100":"#B7F28E","lime-200":"#90DA58","lime-25":"#EEFDDC","lime-300":"#6DBF01","lime-400":"#5BA200","lime-50":"#E0F8C8","lime-500":"#4A8500","lime-600":"#3A6A00","lime-700":"#2A5000","lime-75":"#CEF5AD","lime-800":"#1E3702","lime-900":"#151E05","lime-950":"#0D1304","mintgreen-100":"#9BF5D9","mintgreen-200":"#00E2B7","mintgreen-25":"#E7FDF5","mintgreen-300":"#00C29D","mintgreen-400":"#01A484","mintgreen-50":"#D7F8EC","mintgreen-500":"#01876D","mintgreen-600":"#006C56","mintgreen-700":"#015140","mintgreen-75":"#C0F5E3","mintgreen-800":"#00382B","mintgreen-900":"#032019","mintgreen-950":"#03140F","orangered-100":"#FCDBCF","orangered-200":"#FDB498","orangered-25":"#FDF6F4","orangered-300":"#FF895D","orangered-400":"#FF4500","orangered-50":"#FCEEE8","orangered-500":"#D93900","orangered-600":"#AE2C00","orangered-700":"#842100","orangered-75":"#FBE5DC","orangered-800":"#591B02","orangered-900":"#2F1405","orangered-950":"#1C0D04","periwinkle-100":"#E6DFFB","periwinkle-200":"#CDBEFD","periwinkle-25":"#F9F7FD","periwinkle-300":"#B29FFF","periwinkle-400":"#9580FF","periwinkle-50":"#F2EFFC","periwinkle-500":"#6A5CFF","periwinkle-600":"#523DFF","periwinkle-700":"#4001EA","periwinkle-75":"#ECE7FB","periwinkle-800":"#250AA6","periwinkle-900":"#160E5B","periwinkle-950":"#0C083F","poopbrown-100":"#FEEEDD","poopbrown-200":"#F6DDC3","poopbrown-300":"#EECCAA","poopbrown-400":"#CAA075","poopbrown-50":"#FEF7EE","poopbrown-500":"#9A6D3F","poopbrown-600":"#6E4924","poopbrown-700":"#54371A","poopbrown-800":"#3B2510","poopbrown-900":"#29190A","poopbrown-950":"#110B04","puregray-100":"#F2F2F2","puregray-150":"#EBEBEB","puregray-200":"#E4E4E4","puregray-250":"#DDDDDD","puregray-300":"#D6D6D6","puregray-350":"#C3C3C3","puregray-400":"#ACACAC","puregray-450":"#919191","puregray-50":"#F8F8F8","puregray-500":"#767676","puregray-550":"#5C5C5C","puregray-600":"#434343","puregray-650":"#393939","puregray-700":"#303030","puregray-750":"#272727","puregray-800":"#1E1E1E","puregray-850":"#181818","puregray-900":"#131313","puregray-950":"#080808","red-100":"#FBDBD4","red-200":"#FDB3A4","red-25":"#FDF6F5","red-300":"#FF8773","red-400":"#FF4F40","red-50":"#FCEEEA","red-500":"#EB001F","red-600":"#BC0117","red-700":"#90000F","red-75":"#FBE4DF","red-800":"#650405","red-900":"#340F05","red-950":"#1F0B04","sakurapink-100":"#FBD9EB","sakurapink-200":"#FDAEDA","sakurapink-25":"#FDF6F9","sakurapink-300":"#FF7ECA","sakurapink-400":"#FF38BB","sakurapink-50":"#FCEDF4","sakurapink-500":"#DE019F","sakurapink-600":"#B2007F","sakurapink-700":"#880060","sakurapink-75":"#FBE3EF","sakurapink-800":"#5F0443","sakurapink-900":"#380626","sakurapink-950":"#250419",transparent:"transparent",white:"#ffffff","white-opacity-0":"#FFFFFF00","white-opacity-10":"#FFFFFF19","white-opacity-15":"#FFFFFF26","white-opacity-20":"#FFFFFF33","white-opacity-25":"#FFFFFF3F","white-opacity-5":"#FFFFFF0C","white-opacity-50":"#FFFFFF7F","yellow-100":"#FFE284","yellow-200":"#FFBF0B","yellow-25":"#FFF9E0","yellow-300":"#D8A100","yellow-400":"#B78800","yellow-50":"#FFF3C0","yellow-500":"#977000","yellow-600":"#785800","yellow-700":"#5B4200","yellow-75":"#FFEAA2","yellow-800":"#3F2D00","yellow-900":"#231A03","yellow-950":"#161003","yelloworange-100":"#FCDCC8","yelloworange-200":"#FDB586","yelloworange-25":"#FDF7F3","yelloworange-300":"#FF8A35","yelloworange-400":"#E46C00","yelloworange-50":"#FCEEE6","yelloworange-500":"#BD5800","yelloworange-600":"#974500","yelloworange-700":"#733300","yelloworange-75":"#FBE5D7","yelloworange-800":"#4E2402","yelloworange-900":"#2A1705","yelloworange-950":"#1A0E04","action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"action-upvote":{light:"#D93900",dark:"#D93900"},"ai-background-weaker":{light:"#E7FDF5",dark:"#00382B"},"ai-plain":{light:"#006C56",dark:"#01A484"},"ai-plain-hover":{light:"#015140",dark:"#00C29D"},"alert-caution":{light:"#977000",dark:"#977000"},"avatar-gradient":{light:"",dark:""},"brand-background":{light:"#D93900",dark:"#D93900"},"brand-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"category-live":{light:"#D93900",dark:"#D93900"},"category-nsfw":{light:"#DE019F",dark:"#DE019F"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"caution-background":{light:"#FFBF0B",dark:"#D8A100"},"caution-background-hover":{light:"#D8A100",dark:"#FFBF0B"},"caution-onBackground":{light:"#000000",dark:"#000000"},"caution-plain":{light:"#785800",dark:"#FFBF0B"},"caution-plain-hover":{light:"#5B4200",dark:"#FFE284"},"danger-background":{light:"#EB001F",dark:"#BC0117"},"danger-background-disabled":{light:"#FDB3A4",dark:"#340F05"},"danger-background-hover":{light:"#BC0117",dark:"#EB001F"},"danger-background-weaker":{light:"#FBDBD4",dark:"#650405"},"danger-content":{light:"#BC0117",dark:"#FF4F40"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"danger-content-hover":{light:"#90000F",dark:"#FF8773"},"danger-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"danger-plain":{light:"#BC0117",dark:"#FF8773"},"danger-plain-hover":{light:"#90000F",dark:"#FDB3A4"},"downvote-background":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-background-disabled":{light:"#6a5cff4d",dark:"#6a5cff4d"},"downvote-background-hover":{light:"#523DFF",dark:"#523DFF"},"downvote-content":{light:"#523DFF",dark:"#9580FF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#523DFF4c",dark:"#9580FF4c"},"downvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"downvote-onStrongScrim":{light:"#B29FFF",dark:"#B29FFF"},"downvote-onStrongScrim-disabled":{light:"#b29fff4d",dark:"#b29fff4d"},"downvote-onStrongScrim-weaker":{light:"#9580FF",dark:"#9580FF"},"downvote-plain":{light:"#523DFF",dark:"#9580FF"},"downvote-plain-disabled":{light:"#523dff4d",dark:"#9580ff4d"},"downvote-plain-weaker":{light:"#6A5CFF",dark:"#6A5CFF"},"elevation-large1":{light:"#0000003F",dark:"#0000007F"},"elevation-large2":{light:"#00000026",dark:"#00000033"},"elevation-medium1":{light:"#0000003F",dark:"#0000007F"},"elevation-medium2":{light:"#00000019",dark:"#00000033"},"elevation-small":{light:"#00000026",dark:"#00000054"},"elevation-xsmall":{light:"#0000003F",dark:"#000000AA"},favorite:{light:"#977000",dark:"#B78800"},"global-admin":{light:"#D93900",dark:"#D93900"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#2A3236",dark:"#2A3236"},"global-focus":{light:"#029DD5",dark:"#007FAE"},"global-gold":{light:"#B78800",dark:"#D8A100"},"global-moderator":{light:"#008A10",dark:"#008A10"},"global-nsfw":{light:"#DE019F",dark:"#DE019F"},"global-offline":{light:"#667780",dark:"#667780"},"global-online":{light:"#00C61C",dark:"#00C61C"},"global-orangered":{light:"#FF4500",dark:"#FF4500"},"global-stars":{light:"#977000",dark:"#D8A100"},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"identity-admin":{light:"#D93900",dark:"#D93900"},"identity-coins":{light:"#B78800",dark:"#B78800"},"identity-moderator":{light:"#008A10",dark:"#008A10"},"identity-self":{light:"#01876D",dark:"#01876D"},"interactive-background-disabled":{light:"#0000000C",dark:"#FFFFFF0C"},"interactive-content-disabled":{light:"#0000003F",dark:"#FFFFFF3F"},"interactive-focused":{light:"#007FAE",dark:"#007FAE"},"interactive-pressed":{light:"#00000026",dark:"#FFFFFF26"},"inverted-interactive-background-disabled":{light:"#FFFFFF0C",dark:"#0000000C"},"inverted-interactive-content-disabled":{light:"#FFFFFF3F",dark:"#0000003F"},"inverted-interactive-pressed":{light:"#FFFFFF26",dark:"#00000026"},"inverted-neutral-background":{light:"#0E1113",dark:"#FFFFFF"},"inverted-neutral-background-hover":{light:"#181C1F",dark:"#F6F8F9"},"inverted-neutral-border":{light:"#FFFFFF33",dark:"#00000033"},"inverted-neutral-content":{light:"#B7CAD4",dark:"#333D42"},"inverted-neutral-content-strong":{light:"#EEF1F3",dark:"#181C1F"},"inverted-secondary-background":{light:"#2A3236",dark:"#E5EBEE"},"inverted-secondary-background-hover":{light:"#333D42",dark:"#DBE4E9"},"inverted-secondary-background-selected":{light:"#3D494E",dark:"#C9D7DE"},"inverted-secondary-onBackground":{light:"#FFFFFF",dark:"#000000"},"inverted-secondary-plain":{light:"#DBE4E9",dark:"#181C1F"},"inverted-secondary-plain-hover":{light:"#FFFFFF",dark:"#000000"},"media-background":{light:"#00000099",dark:"#00000099"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"media-border-selected":{light:"#FFFFFF",dark:"#FFFFFF"},"media-border-weak":{light:"#FFFFFF19",dark:"#FFFFFF19"},"media-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"media-onBackground-disabled":{light:"#FFFFFF3F",dark:"#FFFFFF3F"},"media-onBackground-weak":{light:"#E5EBEE",dark:"#E5EBEE"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-onbackground-weak":{light:"#B7CAD4",dark:"#B7CAD4"},"neutral-background":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-container":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-container-hover":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong-hover":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-gilded":{light:"#FFF9E0",dark:"#181C1F"},"neutral-background-gilded-hover":{light:"#FFF3C0",dark:"#21272A"},"neutral-background-hover":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-pinned":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-selected":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-strong":{light:"#FFFFFF",dark:"#181C1F"},"neutral-background-strong-hover":{light:"#F6F8F9",dark:"#21272A"},"neutral-background-weak":{light:"#F6F8F9",dark:"#000000"},"neutral-background-weak-hover":{light:"#EEF1F3",dark:"#0E1113"},"neutral-border":{light:"#00000033",dark:"#FFFFFF33"},"neutral-border-medium":{light:"#0000007F",dark:"#FFFFFF7F"},"neutral-border-strong":{light:"#181C1F",dark:"#F6F8F9"},"neutral-border-weak":{light:"#00000019",dark:"#FFFFFF19"},"neutral-content":{light:"#333D42",dark:"#B7CAD4"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-strong":{light:"#181C1F",dark:"#EEF1F3"},"neutral-content-weak":{light:"#5C6C74",dark:"#8BA2AD"},offline:{light:"#767676",dark:"#767676"},online:{light:"#01A816",dark:"#01A816"},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},"opacity-highlight":{light:"",dark:""},pizzaRed:{light:"#ef5350",dark:"#c62828"},primary:{light:"#115BCA",dark:"#648EFC"},"primary-background":{light:"#0A449B",dark:"#115BCA"},"primary-background-hover":{light:"#0A2F6C",dark:"#1870F4"},"primary-background-selected":{light:"#0A1A3F",dark:"#648EFC"},"primary-border":{light:"#0A449B",dark:"#648EFC"},"primary-border-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-hover":{light:"#0A449B",dark:"#90A9FD"},"primary-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"primary-onBackground-selected":{light:"#FFFFFF",dark:"#000000"},"primary-plain":{light:"#0A449B",dark:"#648EFC"},"primary-plain-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-plain-visited":{light:"#7600A3",dark:"#CF5FFF"},"primary-visited":{light:"#9B00D4",dark:"#CF5FFF"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-background":{light:"#00000099",dark:"#00000099"},"scrim-background-strong":{light:"#000000CC",dark:"#000000CC"},"scrim-gradient":{light:"",dark:""},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},secondary:{light:"#21272A",dark:"#DBE4E9"},"secondary-background":{light:"#E5EBEE",dark:"#2A3236"},"secondary-background-hover":{light:"#DBE4E9",dark:"#333D42"},"secondary-background-selected":{light:"#C9D7DE",dark:"#3D494E"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-onBackground":{light:"#000000",dark:"#FFFFFF"},"secondary-plain":{light:"#181C1F",dark:"#DBE4E9"},"secondary-plain-hover":{light:"#000000",dark:"#FFFFFF"},"secondary-plain-weak":{light:"#5C6C74",dark:"#8BA2AD"},"secondary-weak":{light:"#576F76",dark:"#748791"},"success-background":{light:"#008A10",dark:"#016E0B"},"success-background-hover":{light:"#016E0B",dark:"#008A10"},"success-content":{light:"#016E0B",dark:"#01A816"},"success-hover":{light:"#005306",dark:"#00C61C"},"success-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"success-plain":{light:"#016E0B",dark:"#00C61C"},"success-plain-hover":{light:"#005306",dark:"#58E15B"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"transparent-background-hover":{light:"#74879119",dark:"#66778019"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#FFFFFF",dark:"#181C1F"},"upvote-background":{light:"#D93900",dark:"#D93900"},"upvote-background-disabled":{light:"#d939004d",dark:"#d939004d"},"upvote-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"upvote-content":{light:"#AE2C00",dark:"#FF4500"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#AE2C004c",dark:"#FF45004c"},"upvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"upvote-onStrongScrim":{light:"#FF895D",dark:"#FF895D"},"upvote-onStrongScrim-disabled":{light:"#ff895d4d",dark:"#ff895d4d"},"upvote-onStrongScrim-weaker":{light:"#FF4500",dark:"#FF4500"},"upvote-plain":{light:"#AE2C00",dark:"#FF895D"},"upvote-plain-disabled":{light:"#ae2c004d",dark:"#ff895d4d"},"upvote-plain-weaker":{light:"#FF4500",dark:"#FF4500"},"warning-background":{light:"#B78800",dark:"#B78800"},"warning-background-hover":{light:"#977000",dark:"#D8A100"},"warning-content":{light:"#785800",dark:"#B78800"},"warning-content-hover":{light:"#5B4200",dark:"#D8A100"},"warning-onBackground":{light:"#000000",dark:"#000000"}};var oy={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",transparent:"#FFFFFF00",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},ay=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),dy=r=>r in uc,cc=r=>r in oy,ly=r=>!!r.match(/^rgba?\(.*/),uy=r=>!!r.match(/^hsla?\(.*/),cy=(r,e="light")=>{if(cc(r))return nd(r);let i=uc[r];return typeof i=="string"?i:i[e]},nd=r=>oy[r]??r,my=r=>{let[e,t,i,n]=r.replace(/^rgba?\(|\s+|\)$/g,"").split(",");if(!e||!t||!i)return r;let a=[...[e,t,i].map(p=>parseFloat(p))];if(n){let p=parseFloat(n),g=Math.round(p*255);a.push(g)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as sd}from"@devvit/protos";var mc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:sd.UNRECOGNIZED,alignment:void 0}};function gy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=pT(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||py(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||py(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function py(r,e,t,i){return e===r&&i||t===r&&i}function pT(r,e,t){let i=e===sd.STACK_VERTICAL||e===sd.UNRECOGNIZED,n=e===sd.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,g=0;return n&&p?g=2:i&&p&&(g=1),{growDirection:o,stretchDirection:g}}import{BlockSizeUnit as yr,BlockStackDirection as od}from"@devvit/protos";function Si(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:yr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=yr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=yr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function gT(r,e){return(r.width?.value?.unit===yr.SIZE_UNIT_PERCENT||r.width?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_HORIZONTAL||e.direction===od.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===yr.SIZE_UNIT_PERCENT||r.height?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_VERTICAL||e.direction===od.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function pc(r,e){if(r){let t=r.width!=null||r.minWidth!=null||r.maxWidth!=null,i=r.height!=null||r.minHeight!=null||r.maxHeight!=null;if(t||i||r.grow!=null){let n={width:t?{value:Si(r.width),min:Si(r.minWidth),max:Si(r.maxWidth)}:void 0,height:i?{value:Si(r.height),min:Si(r.minHeight),max:Si(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=gT(n,e.stackParentLayout)),n}}}var yy="data-",hT=new Set(["onPress","onMessage"]),fT=new Map([["onPress",Pc.ACTION_CLICK],["onMessage",Pc.ACTION_WEBVIEW]]),us,Ci=class{constructor(e=()=>{}){l(this,us);d(this,us,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},mc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return ds.PADDING_NONE;case"xsmall":return ds.PADDING_XSMALL;case"small":return ds.PADDING_SMALL;case"medium":return ds.PADDING_MEDIUM;case"large":return ds.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return ls.RADIUS_NONE;case"small":return ls.RADIUS_SMALL;case"medium":return ls.RADIUS_MEDIUM;case"large":return ls.RADIUS_LARGE;case"full":return ls.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return dd.GAP_NONE;case"small":return dd.GAP_SMALL;case"medium":return dd.GAP_MEDIUM;case"large":return dd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Sc.ALIGN_TOP:e.includes("middle")?t=Sc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Sc.ALIGN_BOTTOM),e.includes("start")?i=hc.ALIGN_START:e.includes("center")?i=hc.ALIGN_CENTER:e.includes("end")&&(i=hc.ALIGN_END),t!==void 0||i!==void 0)return{vertical:t,horizontal:i}}makeBlockBorder(e,t,i,n){if(!e&&!t)return;let o;switch(e){case"none":o=ad.BORDER_WIDTH_NONE;break;case"thin":o=ad.BORDER_WIDTH_THIN;break;case"thick":o=ad.BORDER_WIDTH_THICK;break;default:o=ad.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",c=this.getThemedColors(a,i,n);return{width:o,color:c?.light,colors:c}}makeBlockTextSize(e){switch(e){case"xsmall":return Pi.TEXT_SIZE_XSMALL;case"small":return Pi.TEXT_SIZE_SMALL;case"medium":return Pi.TEXT_SIZE_MEDIUM;case"large":return Pi.TEXT_SIZE_LARGE;case"xlarge":return Pi.TEXT_SIZE_XLARGE;case"xxlarge":return Pi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return kc.TEXT_STYLE_BODY;case"metadata":return kc.TEXT_STYLE_METADATA;case"heading":return kc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return yc.TEXT_OUTLINE_NONE;case"thin":return yc.TEXT_OUTLINE_THIN;case"thick":return yc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return vy.TEXT_WEIGHT_REGULAR;case"bold":return vy.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return bc.TEXT_OVERFLOW_CLIP;case"ellipsis":return bc.TEXT_OVERFLOW_ELLIPSE}return bc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Rt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Rt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Rt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Rt.BUTTON_APPEARANCE_BORDERED;case"media":return Rt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Rt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Rt.BUTTON_APPEARANCE_CAUTION;case"success":return Rt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return gc.BUTTON_SIZE_SMALL;case"medium":return gc.BUTTON_SIZE_MEDIUM;case"large":return gc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return as.IMAGE_RESIZE_NONE;case"fit":return as.IMAGE_RESIZE_FIT;case"fill":return as.IMAGE_RESIZE_FILL;case"cover":return as.IMAGE_RESIZE_COVER;case"scale-down":return as.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return ud.SPACER_XSMALL;case"small":return ud.SPACER_SMALL;case"medium":return ud.SPACER_MEDIUM;case"large":return ud.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return fc.SPACER_INVISIBLE;case"thin":return fc.SPACER_THIN;case"square":return fc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return ld.ICON_SIZE_XSMALL;case"small":return ld.ICON_SIZE_SMALL;case"medium":return ld.ICON_SIZE_MEDIUM;case"large":return ld.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Et.AVATAR_SIZE_XXSMALL;case"xsmall":return Et.AVATAR_SIZE_XSMALL;case"small":return Et.AVATAR_SIZE_SMALL;case"medium":return Et.AVATAR_SIZE_MEDIUM;case"large":return Et.AVATAR_SIZE_LARGE;case"xlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Et.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return fy.AVATAR_FACING_LEFT;case"right":return fy.AVATAR_FACING_RIGHT}}makeBlockAvatarBackground(e){switch(e){case"dark":return hy.AVATAR_BG_DARK;case"light":return hy.AVATAR_BG_LIGHT}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(yy)).reduce((t,i)=>(t[i.substring(yy.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return hT.forEach(o=>{if(o in t){let a=t[o];i.push({type:fT.get(o)??Pc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),ay(e)?e:dy(e)?cy(e,t):cc(e)?nd(e):ly(e)?my(e):uy(e)?e:(console.warn(`Could not parse color: ${e}.`),nd("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,us).call(this)?.getURL(e,t)??e}childrenToString(e){return e.map(t=>t.toString()).join("")}makeRoot(e,...t){return this.wrapRoot(e,this.childrenToBlocks(t,mc))}wrapRoot(e,t){return this.makeBlock(tt.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=pc(t,i),p=gy(t,i.stackParentLayout,c);return this.makeBlock(tt.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(vc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(vc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(vc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(tt.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(tt.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(tt.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(tt.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(tt.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(tt.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeWebView(e,t){return e&&this.makeBlock(tt.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:pc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===tt.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};us=new WeakMap;function ky(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Sy=r=>{let e="",t=r.props?Object.keys(r.props).map(i=>i==="onPress"?"":`${i}="${r.props[i]}"`).join(" "):"";e+=`<${r.type}${t?" "+t:""}>`;for(let i of r.children)typeof i=="string"?e+=i:e+=Sy(i);return e+=`</${r.type}>`,e};function vT(r){return" ".repeat(r)}function yT(r){let e="",t=0,i=r.split(/>\s*</);for(let n=0;n<i.length;n++){let o=i[n];n===0&&(o=o.trim()),n===i.length-1&&(o=o.trim());let a=o.charAt(0)==="/";a&&t--,e+=vT(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
1
+ var yS=Object.create;var Cm=Object.defineProperty;var bS=Object.getOwnPropertyDescriptor;var kS=Object.getOwnPropertyNames;var SS=Object.getPrototypeOf,PS=Object.prototype.hasOwnProperty;var wm=r=>{throw TypeError(r)};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var CS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of kS(e))!PS.call(r,n)&&n!==t&&Cm(r,n,{get:()=>e[n],enumerable:!(i=bS(e,n))||i.enumerable});return r};var Mn=(r,e,t)=>(t=r!=null?yS(SS(r)):{},CS(e||!r||!r.__esModule?Cm(t,"default",{value:r,enumerable:!0}):t,r));var tl=(r,e,t)=>e.has(r)||wm("Cannot "+t);var s=(r,e,t)=>(tl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?wm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(tl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(tl(r,e,"access private method"),t);var ae=h((eO,xm)=>{xm.exports=function(r){try{return!!r()}catch{return!0}}});var oa=h((tO,Fm)=>{var wS=ae();Fm.exports=!wS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var X=h((rO,Am)=>{var Im=oa(),Tm=Function.prototype,rl=Tm.call,xS=Im&&Tm.bind.bind(rl,rl);Am.exports=Im?xS:function(r){return function(){return rl.apply(r,arguments)}}});var Rm=h((iO,Em)=>{var FS=Math.ceil,IS=Math.floor;Em.exports=Math.trunc||function(e){var t=+e;return(t>0?IS:FS)(t)}});var aa=h((nO,Om)=>{var TS=Rm();Om.exports=function(r){var e=+r;return e!==e||e===0?0:TS(e)}});var pe=h((sO,Bm)=>{var da=function(r){return r&&r.Math==Math&&r};Bm.exports=da(typeof globalThis=="object"&&globalThis)||da(typeof window=="object"&&window)||da(typeof self=="object"&&self)||da(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=h((oO,Mm)=>{Mm.exports=!1});var la=h((aO,Lm)=>{var Um=pe(),AS=Object.defineProperty;Lm.exports=function(r,e){try{AS(Um,r,{value:e,configurable:!0,writable:!0})}catch{Um[r]=e}return e}});var ua=h((dO,Nm)=>{var ES=pe(),RS=la(),Dm="__core-js_shared__",OS=ES[Dm]||RS(Dm,{});Nm.exports=OS});var il=h((lO,Hm)=>{var BS=Wr(),_m=ua();(Hm.exports=function(r,e){return _m[r]||(_m[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:BS?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"})});var ca=h((uO,qm)=>{qm.exports=function(r){return r==null}});var ma=h((cO,jm)=>{var MS=ca(),US=TypeError;jm.exports=function(r){if(MS(r))throw US("Can't call method on "+r);return r}});var Un=h((mO,Wm)=>{var LS=ma(),DS=Object;Wm.exports=function(r){return DS(LS(r))}});var Pe=h((pO,Gm)=>{var NS=X(),_S=Un(),HS=NS({}.hasOwnProperty);Gm.exports=Object.hasOwn||function(e,t){return HS(_S(e),t)}});var nl=h((gO,Vm)=>{var qS=X(),jS=0,WS=Math.random(),GS=qS(1 .toString);Vm.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+GS(++jS+WS,36)}});var Jm=h((hO,zm)=>{zm.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var ep=h((fO,Ym)=>{var Qm=pe(),sl=Jm(),$m=Qm.process,Km=Qm.Deno,Xm=$m&&$m.versions||Km&&Km.version,Zm=Xm&&Xm.v8,qe,pa;Zm&&(qe=Zm.split("."),pa=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!pa&&sl&&(qe=sl.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=sl.match(/Chrome\/(\d+)/),qe&&(pa=+qe[1])));Ym.exports=pa});var ol=h((vO,rp)=>{var tp=ep(),VS=ae();rp.exports=!!Object.getOwnPropertySymbols&&!VS(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&tp&&tp<41})});var al=h((yO,ip)=>{var zS=ol();ip.exports=zS&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ce=h((bO,sp)=>{var JS=pe(),$S=il(),np=Pe(),KS=nl(),XS=ol(),ZS=al(),Gr=JS.Symbol,dl=$S("wks"),QS=ZS?Gr.for||Gr:Gr&&Gr.withoutSetter||KS;sp.exports=function(r){return np(dl,r)||(dl[r]=XS&&np(Gr,r)?Gr[r]:QS("Symbol."+r)),dl[r]}});var dp=h((kO,ap)=>{var YS=Ce(),eP=YS("toStringTag"),op={};op[eP]="z";ap.exports=String(op)==="[object z]"});var ul=h((SO,lp)=>{var ll=typeof document=="object"&&document.all,tP=typeof ll>"u"&&ll!==void 0;lp.exports={all:ll,IS_HTMLDDA:tP}});var Z=h((PO,cp)=>{var up=ul(),rP=up.all;cp.exports=up.IS_HTMLDDA?function(r){return typeof r=="function"||r===rP}:function(r){return typeof r=="function"}});var ga=h((CO,pp)=>{var mp=X(),iP=mp({}.toString),nP=mp("".slice);pp.exports=function(r){return nP(iP(r),8,-1)}});var Ln=h((wO,gp)=>{var sP=dp(),oP=Z(),ha=ga(),aP=Ce(),dP=aP("toStringTag"),lP=Object,uP=ha(function(){return arguments}())=="Arguments",cP=function(r,e){try{return r[e]}catch{}};gp.exports=sP?ha:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=cP(e=lP(r),dP))=="string"?t:uP?ha(e):(i=ha(e))=="Object"&&oP(e.callee)?"Arguments":i}});var Dn=h((xO,hp)=>{var mP=Ln(),pP=String;hp.exports=function(r){if(mP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return pP(r)}});var ml=h((FO,yp)=>{var cl=X(),gP=aa(),hP=Dn(),fP=ma(),vP=cl("".charAt),fp=cl("".charCodeAt),yP=cl("".slice),vp=function(r){return function(e,t){var i=hP(fP(e)),n=gP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=fp(i,n),a<55296||a>56319||n+1===o||(c=fp(i,n+1))<56320||c>57343?r?vP(i,n):a:r?yP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};yp.exports={codeAt:vp(!1),charAt:vp(!0)}});var Sp=h((IO,kp)=>{var bP=pe(),kP=Z(),bp=bP.WeakMap;kp.exports=kP(bp)&&/native code/.test(String(bp))});var St=h((TO,wp)=>{var Pp=Z(),Cp=ul(),SP=Cp.all;wp.exports=Cp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Pp(r)||r===SP}:function(r){return typeof r=="object"?r!==null:Pp(r)}});var ge=h((AO,xp)=>{var PP=ae();xp.exports=!PP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var gl=h((EO,Ip)=>{var CP=pe(),Fp=St(),pl=CP.document,wP=Fp(pl)&&Fp(pl.createElement);Ip.exports=function(r){return wP?pl.createElement(r):{}}});var hl=h((RO,Tp)=>{var xP=ge(),FP=ae(),IP=gl();Tp.exports=!xP&&!FP(function(){return Object.defineProperty(IP("div"),"a",{get:function(){return 7}}).a!=7})});var fl=h((OO,Ap)=>{var TP=ge(),AP=ae();Ap.exports=TP&&AP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=h((BO,Ep)=>{var EP=St(),RP=String,OP=TypeError;Ep.exports=function(r){if(EP(r))return r;throw OP(RP(r)+" is not an object")}});var je=h((MO,Rp)=>{var BP=oa(),fa=Function.prototype.call;Rp.exports=BP?fa.bind(fa):function(){return fa.apply(fa,arguments)}});var Nn=h((UO,Op)=>{var vl=pe(),MP=Z(),UP=function(r){return MP(r)?r:void 0};Op.exports=function(r,e){return arguments.length<2?UP(vl[r]):vl[r]&&vl[r][e]}});var yl=h((LO,Bp)=>{var LP=X();Bp.exports=LP({}.isPrototypeOf)});var bl=h((DO,Mp)=>{var DP=Nn(),NP=Z(),_P=yl(),HP=al(),qP=Object;Mp.exports=HP?function(r){return typeof r=="symbol"}:function(r){var e=DP("Symbol");return NP(e)&&_P(e.prototype,qP(r))}});var kl=h((NO,Up)=>{var jP=String;Up.exports=function(r){try{return jP(r)}catch{return"Object"}}});var va=h((_O,Lp)=>{var WP=Z(),GP=kl(),VP=TypeError;Lp.exports=function(r){if(WP(r))return r;throw VP(GP(r)+" is not a function")}});var ya=h((HO,Dp)=>{var zP=va(),JP=ca();Dp.exports=function(r,e){var t=r[e];return JP(t)?void 0:zP(t)}});var _p=h((qO,Np)=>{var Sl=je(),Pl=Z(),Cl=St(),$P=TypeError;Np.exports=function(r,e){var t,i;if(e==="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r))||Pl(t=r.valueOf)&&!Cl(i=Sl(t,r))||e!=="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r)))return i;throw $P("Can't convert object to primitive value")}});var Wp=h((jO,jp)=>{var KP=je(),Hp=St(),qp=bl(),XP=ya(),ZP=_p(),QP=Ce(),YP=TypeError,eC=QP("toPrimitive");jp.exports=function(r,e){if(!Hp(r)||qp(r))return r;var t=XP(r,eC),i;if(t){if(e===void 0&&(e="default"),i=KP(t,r,e),!Hp(i)||qp(i))return i;throw YP("Can't convert object to primitive value")}return e===void 0&&(e="number"),ZP(r,e)}});var ba=h((WO,Gp)=>{var tC=Wp(),rC=bl();Gp.exports=function(r){var e=tC(r,"string");return rC(e)?e:e+""}});var Qe=h(zp=>{var iC=ge(),nC=hl(),sC=fl(),ka=Ze(),Vp=ba(),oC=TypeError,wl=Object.defineProperty,aC=Object.getOwnPropertyDescriptor,xl="enumerable",Fl="configurable",Il="writable";zp.f=iC?sC?function(e,t,i){if(ka(e),t=Vp(t),ka(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Il in i&&!i[Il]){var n=aC(e,t);n&&n[Il]&&(e[t]=i.value,i={configurable:Fl in i?i[Fl]:n[Fl],enumerable:xl in i?i[xl]:n[xl],writable:!1})}return wl(e,t,i)}:wl:function(e,t,i){if(ka(e),t=Vp(t),ka(i),nC)try{return wl(e,t,i)}catch{}if("get"in i||"set"in i)throw oC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=h((VO,Jp)=>{Jp.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Sa=h((zO,$p)=>{var dC=ge(),lC=Qe(),uC=Vr();$p.exports=dC?function(r,e,t){return lC.f(r,e,uC(1,t))}:function(r,e,t){return r[e]=t,r}});var Pa=h((JO,Xp)=>{var cC=il(),mC=nl(),Kp=cC("keys");Xp.exports=function(r){return Kp[r]||(Kp[r]=mC(r))}});var Ca=h(($O,Zp)=>{Zp.exports={}});var zr=h((KO,eg)=>{var pC=Sp(),Yp=pe(),gC=St(),hC=Sa(),Tl=Pe(),Al=ua(),fC=Pa(),vC=Ca(),Qp="Object already initialized",El=Yp.TypeError,yC=Yp.WeakMap,wa,_n,xa,bC=function(r){return xa(r)?_n(r):wa(r,{})},kC=function(r){return function(e){var t;if(!gC(e)||(t=_n(e)).type!==r)throw El("Incompatible receiver, "+r+" required");return t}};pC||Al.state?(We=Al.state||(Al.state=new yC),We.get=We.get,We.has=We.has,We.set=We.set,wa=function(r,e){if(We.has(r))throw El(Qp);return e.facade=r,We.set(r,e),e},_n=function(r){return We.get(r)||{}},xa=function(r){return We.has(r)}):(sr=fC("state"),vC[sr]=!0,wa=function(r,e){if(Tl(r,sr))throw El(Qp);return e.facade=r,hC(r,sr,e),e},_n=function(r){return Tl(r,sr)?r[sr]:{}},xa=function(r){return Tl(r,sr)});var We,sr;eg.exports={set:wa,get:_n,has:xa,enforce:bC,getterFor:kC}});var Rl=h(ig=>{"use strict";var tg={}.propertyIsEnumerable,rg=Object.getOwnPropertyDescriptor,SC=rg&&!tg.call({1:2},1);ig.f=SC?function(e){var t=rg(this,e);return!!t&&t.enumerable}:tg});var Bl=h((ZO,ng)=>{var PC=X(),CC=ae(),wC=ga(),Ol=Object,xC=PC("".split);ng.exports=CC(function(){return!Ol("z").propertyIsEnumerable(0)})?function(r){return wC(r)=="String"?xC(r,""):Ol(r)}:Ol});var Jr=h((QO,sg)=>{var FC=Bl(),IC=ma();sg.exports=function(r){return FC(IC(r))}});var Ml=h(ag=>{var TC=ge(),AC=je(),EC=Rl(),RC=Vr(),OC=Jr(),BC=ba(),MC=Pe(),UC=hl(),og=Object.getOwnPropertyDescriptor;ag.f=TC?og:function(e,t){if(e=OC(e),t=BC(t),UC)try{return og(e,t)}catch{}if(MC(e,t))return RC(!AC(EC.f,e,t),e[t])}});var Dl=h((eB,lg)=>{var Ul=ge(),LC=Pe(),dg=Function.prototype,DC=Ul&&Object.getOwnPropertyDescriptor,Ll=LC(dg,"name"),NC=Ll&&function(){}.name==="something",_C=Ll&&(!Ul||Ul&&DC(dg,"name").configurable);lg.exports={EXISTS:Ll,PROPER:NC,CONFIGURABLE:_C}});var _l=h((tB,ug)=>{var HC=X(),qC=Z(),Nl=ua(),jC=HC(Function.toString);qC(Nl.inspectSource)||(Nl.inspectSource=function(r){return jC(r)});ug.exports=Nl.inspectSource});var jl=h((rB,pg)=>{var ql=X(),WC=ae(),GC=Z(),Fa=Pe(),Hl=ge(),VC=Dl().CONFIGURABLE,zC=_l(),mg=zr(),JC=mg.enforce,$C=mg.get,cg=String,Ia=Object.defineProperty,KC=ql("".slice),XC=ql("".replace),ZC=ql([].join),QC=Hl&&!WC(function(){return Ia(function(){},"length",{value:8}).length!==8}),YC=String(String).split("String"),e0=pg.exports=function(r,e,t){KC(cg(e),0,7)==="Symbol("&&(e="["+XC(cg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Fa(r,"name")||VC&&r.name!==e)&&(Hl?Ia(r,"name",{value:e,configurable:!0}):r.name=e),QC&&t&&Fa(t,"arity")&&r.length!==t.arity&&Ia(r,"length",{value:t.arity});try{t&&Fa(t,"constructor")&&t.constructor?Hl&&Ia(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=JC(r);return Fa(i,"source")||(i.source=ZC(YC,typeof e=="string"?e:"")),r};Function.prototype.toString=e0(function(){return GC(this)&&$C(this).source||zC(this)},"toString")});var or=h((iB,gg)=>{var t0=Z(),r0=Qe(),i0=jl(),n0=la();gg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(t0(t)&&i0(t,o,i),i.global)n?r[e]=t:n0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:r0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Wl=h((nB,hg)=>{var s0=aa(),o0=Math.max,a0=Math.min;hg.exports=function(r,e){var t=s0(r);return t<0?o0(t+e,0):a0(t,e)}});var vg=h((sB,fg)=>{var d0=aa(),l0=Math.min;fg.exports=function(r){return r>0?l0(d0(r),9007199254740991):0}});var Ta=h((oB,yg)=>{var u0=vg();yg.exports=function(r){return u0(r.length)}});var Sg=h((aB,kg)=>{var c0=Jr(),m0=Wl(),p0=Ta(),bg=function(r){return function(e,t,i){var n=c0(e),o=p0(n),a=m0(i,o),c;if(r&&t!=t){for(;o>a;)if(c=n[a++],c!=c)return!0}else for(;o>a;a++)if((r||a in n)&&n[a]===t)return r||a||0;return!r&&-1}};kg.exports={includes:bg(!0),indexOf:bg(!1)}});var Vl=h((dB,Cg)=>{var g0=X(),Gl=Pe(),h0=Jr(),f0=Sg().indexOf,v0=Ca(),Pg=g0([].push);Cg.exports=function(r,e){var t=h0(r),i=0,n=[],o;for(o in t)!Gl(v0,o)&&Gl(t,o)&&Pg(n,o);for(;e.length>i;)Gl(t,o=e[i++])&&(~f0(n,o)||Pg(n,o));return n}});var Aa=h((lB,wg)=>{wg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Fg=h(xg=>{var y0=Vl(),b0=Aa(),k0=b0.concat("length","prototype");xg.f=Object.getOwnPropertyNames||function(e){return y0(e,k0)}});var zl=h(Ig=>{Ig.f=Object.getOwnPropertySymbols});var Ag=h((mB,Tg)=>{var S0=Nn(),P0=X(),C0=Fg(),w0=zl(),x0=Ze(),F0=P0([].concat);Tg.exports=S0("Reflect","ownKeys")||function(e){var t=C0.f(x0(e)),i=w0.f;return i?F0(t,i(e)):t}});var Og=h((pB,Rg)=>{var Eg=Pe(),I0=Ag(),T0=Ml(),A0=Qe();Rg.exports=function(r,e,t){for(var i=I0(e),n=A0.f,o=T0.f,a=0;a<i.length;a++){var c=i[a];!Eg(r,c)&&!(t&&Eg(t,c))&&n(r,c,o(e,c))}}});var Mg=h((gB,Bg)=>{var E0=ae(),R0=Z(),O0=/#|\.prototype\./,Hn=function(r,e){var t=M0[B0(r)];return t==L0?!0:t==U0?!1:R0(e)?E0(e):!!e},B0=Hn.normalize=function(r){return String(r).replace(O0,".").toLowerCase()},M0=Hn.data={},U0=Hn.NATIVE="N",L0=Hn.POLYFILL="P";Bg.exports=Hn});var qn=h((hB,Ug)=>{var Jl=pe(),D0=Ml().f,N0=Sa(),_0=or(),H0=la(),q0=Og(),j0=Mg();Ug.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,f;if(i?a=Jl:n?a=Jl[t]||H0(t,{}):a=(Jl[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(f=D0(a,c),p=f&&f.value):p=a[c],o=j0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;q0(g,p)}(r.sham||p&&p.sham)&&N0(g,"sham",!0),_0(a,c,g,r)}}});var $l=h((fB,Lg)=>{var W0=Vl(),G0=Aa();Lg.exports=Object.keys||function(e){return W0(e,G0)}});var Ng=h(Dg=>{var V0=ge(),z0=fl(),J0=Qe(),$0=Ze(),K0=Jr(),X0=$l();Dg.f=V0&&!z0?Object.defineProperties:function(e,t){$0(e);for(var i=K0(t),n=X0(t),o=n.length,a=0,c;o>a;)J0.f(e,c=n[a++],i[c]);return e}});var Hg=h((yB,_g)=>{var Z0=Nn();_g.exports=Z0("document","documentElement")});var jn=h((bB,Jg)=>{var Q0=Ze(),Y0=Ng(),qg=Aa(),ew=Ca(),tw=Hg(),rw=gl(),iw=Pa(),jg=">",Wg="<",Xl="prototype",Zl="script",Vg=iw("IE_PROTO"),Kl=function(){},zg=function(r){return Wg+Zl+jg+r+Wg+"/"+Zl+jg},Gg=function(r){r.write(zg("")),r.close();var e=r.parentWindow.Object;return r=null,e},nw=function(){var r=rw("iframe"),e="java"+Zl+":",t;return r.style.display="none",tw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(zg("document.F=Object")),t.close(),t.F},Ea,Ra=function(){try{Ea=new ActiveXObject("htmlfile")}catch{}Ra=typeof document<"u"?document.domain&&Ea?Gg(Ea):nw():Gg(Ea);for(var r=qg.length;r--;)delete Ra[Xl][qg[r]];return Ra()};ew[Vg]=!0;Jg.exports=Object.create||function(e,t){var i;return e!==null?(Kl[Xl]=Q0(e),i=new Kl,Kl[Xl]=null,i[Vg]=e):i=Ra(),t===void 0?i:Y0.f(i,t)}});var Kg=h((kB,$g)=>{var sw=ae();$g.exports=!sw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Yl=h((SB,Zg)=>{var ow=Pe(),aw=Z(),dw=Un(),lw=Pa(),uw=Kg(),Xg=lw("IE_PROTO"),Ql=Object,cw=Ql.prototype;Zg.exports=uw?Ql.getPrototypeOf:function(r){var e=dw(r);if(ow(e,Xg))return e[Xg];var t=e.constructor;return aw(t)&&e instanceof t?t.prototype:e instanceof Ql?cw:null}});var iu=h((PB,eh)=>{"use strict";var mw=ae(),pw=Z(),gw=St(),hw=jn(),Qg=Yl(),fw=or(),vw=Ce(),yw=Wr(),ru=vw("iterator"),Yg=!1,lt,eu,tu;[].keys&&(tu=[].keys(),"next"in tu?(eu=Qg(Qg(tu)),eu!==Object.prototype&&(lt=eu)):Yg=!0);var bw=!gw(lt)||mw(function(){var r={};return lt[ru].call(r)!==r});bw?lt={}:yw&&(lt=hw(lt));pw(lt[ru])||fw(lt,ru,function(){return this});eh.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:Yg}});var Wn=h((CB,rh)=>{var kw=Qe().f,Sw=Pe(),Pw=Ce(),th=Pw("toStringTag");rh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Sw(r,th)&&kw(r,th,{configurable:!0,value:e})}});var $r=h((wB,ih)=>{ih.exports={}});var nu=h((xB,nh)=>{"use strict";var Cw=iu().IteratorPrototype,ww=jn(),xw=Vr(),Fw=Wn(),Iw=$r(),Tw=function(){return this};nh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=ww(Cw,{next:xw(+!i,t)}),Fw(r,n,!1,!0),Iw[n]=Tw,r}});var oh=h((FB,sh)=>{var Aw=Z(),Ew=String,Rw=TypeError;sh.exports=function(r){if(typeof r=="object"||Aw(r))return r;throw Rw("Can't set "+Ew(r)+" as a prototype")}});var dh=h((IB,ah)=>{var Ow=X(),Bw=Ze(),Mw=oh();ah.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Ow(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Bw(n),Mw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var ou=h((TB,yh)=>{"use strict";var Uw=qn(),Lw=je(),Oa=Wr(),fh=Dl(),Dw=Z(),Nw=nu(),lh=Yl(),uh=dh(),_w=Wn(),Hw=Sa(),su=or(),qw=Ce(),ch=$r(),vh=iu(),jw=fh.PROPER,Ww=fh.CONFIGURABLE,mh=vh.IteratorPrototype,Ba=vh.BUGGY_SAFARI_ITERATORS,Gn=qw("iterator"),ph="keys",Vn="values",gh="entries",hh=function(){return this};yh.exports=function(r,e,t,i,n,o,a){Nw(t,e,i);var c=function(B){if(B===n&&b)return b;if(!Ba&&B in f)return f[B];switch(B){case ph:return function(){return new t(this,B)};case Vn:return function(){return new t(this,B)};case gh:return function(){return new t(this,B)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,f=r.prototype,m=f[Gn]||f["@@iterator"]||n&&f[n],b=!Ba&&m||c(n),y=e=="Array"&&f.entries||m,P,C,T;if(y&&(P=lh(y.call(new r)),P!==Object.prototype&&P.next&&(!Oa&&lh(P)!==mh&&(uh?uh(P,mh):Dw(P[Gn])||su(P,Gn,hh)),_w(P,p,!0,!0),Oa&&(ch[p]=hh))),jw&&n==Vn&&m&&m.name!==Vn&&(!Oa&&Ww?Hw(f,"name",Vn):(g=!0,b=function(){return Lw(m,this)})),n)if(C={values:c(Vn),keys:o?b:c(ph),entries:c(gh)},a)for(T in C)(Ba||g||!(T in f))&&su(f,T,C[T]);else Uw({target:e,proto:!0,forced:Ba||g},C);return(!Oa||a)&&f[Gn]!==b&&su(f,Gn,b,{name:n}),ch[e]=b,C}});var au=h((AB,bh)=>{bh.exports=function(r,e){return{value:r,done:e}}});var Ch=h(()=>{"use strict";var Gw=ml().charAt,Vw=Dn(),Sh=zr(),zw=ou(),kh=au(),Ph="String Iterator",Jw=Sh.set,$w=Sh.getterFor(Ph);zw(String,"String",function(r){Jw(this,{type:Ph,string:Vw(r),index:0})},function(){var e=$w(this),t=e.string,i=e.index,n;return i>=t.length?kh(void 0,!0):(n=Gw(t,i),e.index+=n.length,kh(n,!1))})});var du=h((OB,wh)=>{var Kw=ae(),Xw=Ce(),Zw=Wr(),Qw=Xw("iterator");wh.exports=!Kw(function(){var r=new URL("b?a=1&b=2&c=3","http://a"),e=r.searchParams,t="";return r.pathname="c%20d",e.forEach(function(i,n){e.delete("b"),t+=n+i}),Zw&&!r.toJSON||!e.sort||r.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[Qw]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var Fh=h((BB,xh)=>{var Yw=ga(),ex=X();xh.exports=function(r){if(Yw(r)==="Function")return ex(r)}});var Ma=h((MB,Th)=>{var Ih=Fh(),tx=va(),rx=oa(),ix=Ih(Ih.bind);Th.exports=function(r,e){return tx(r),e===void 0?r:rx?ix(r,e):function(){return r.apply(e,arguments)}}});var Rh=h((UB,Eh)=>{var Ah=jl(),nx=Qe();Eh.exports=function(r,e,t){return t.get&&Ah(t.get,e,{getter:!0}),t.set&&Ah(t.set,e,{setter:!0}),nx.f(r,e,t)}});var lu=h((LB,Oh)=>{var sx=yl(),ox=TypeError;Oh.exports=function(r,e){if(sx(e,r))return r;throw ox("Incorrect invocation")}});var Lh=h((DB,Uh)=>{"use strict";var Bh=ge(),ax=X(),dx=je(),lx=ae(),uu=$l(),ux=zl(),cx=Rl(),mx=Un(),px=Bl(),Kr=Object.assign,Mh=Object.defineProperty,gx=ax([].concat);Uh.exports=!Kr||lx(function(){if(Bh&&Kr({b:1},Kr(Mh({},"a",{enumerable:!0,get:function(){Mh(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},e={},t=Symbol(),i="abcdefghijklmnopqrst";return r[t]=7,i.split("").forEach(function(n){e[n]=n}),Kr({},r)[t]!=7||uu(Kr({},e)).join("")!=i})?function(e,t){for(var i=mx(e),n=arguments.length,o=1,a=ux.f,c=cx.f;n>o;)for(var p=px(arguments[o++]),g=a?gx(uu(p),a(p)):uu(p),f=g.length,m=0,b;f>m;)b=g[m++],(!Bh||dx(c,p,b))&&(i[b]=p[b]);return i}:Kr});var _h=h((NB,Nh)=>{var hx=je(),Dh=Ze(),fx=ya();Nh.exports=function(r,e,t){var i,n;Dh(r);try{if(i=fx(r,"return"),!i){if(e==="throw")throw t;return t}i=hx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Dh(i),t}});var qh=h((_B,Hh)=>{var vx=Ze(),yx=_h();Hh.exports=function(r,e,t,i){try{return i?e(vx(t)[0],t[1]):e(t)}catch(n){yx(r,"throw",n)}}});var Wh=h((HB,jh)=>{var bx=Ce(),kx=$r(),Sx=bx("iterator"),Px=Array.prototype;jh.exports=function(r){return r!==void 0&&(kx.Array===r||Px[Sx]===r)}});var Kh=h((qB,$h)=>{var Cx=X(),wx=ae(),Gh=Z(),xx=Ln(),Fx=Nn(),Ix=_l(),Vh=function(){},Tx=[],zh=Fx("Reflect","construct"),cu=/^\s*(?:class|function)\b/,Ax=Cx(cu.exec),Ex=!cu.exec(Vh),zn=function(e){if(!Gh(e))return!1;try{return zh(Vh,Tx,e),!0}catch{return!1}},Jh=function(e){if(!Gh(e))return!1;switch(xx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ex||!!Ax(cu,Ix(e))}catch{return!0}};Jh.sham=!0;$h.exports=!zh||wx(function(){var r;return zn(zn.call)||!zn(Object)||!zn(function(){r=!0})||r})?Jh:zn});var mu=h((jB,Xh)=>{"use strict";var Rx=ba(),Ox=Qe(),Bx=Vr();Xh.exports=function(r,e,t){var i=Rx(e);i in r?Ox.f(r,i,Bx(0,t)):r[i]=t}});var Ua=h((WB,Qh)=>{var Mx=Ln(),Zh=ya(),Ux=ca(),Lx=$r(),Dx=Ce(),Nx=Dx("iterator");Qh.exports=function(r){if(!Ux(r))return Zh(r,Nx)||Zh(r,"@@iterator")||Lx[Mx(r)]}});var pu=h((GB,Yh)=>{var _x=je(),Hx=va(),qx=Ze(),jx=kl(),Wx=Ua(),Gx=TypeError;Yh.exports=function(r,e){var t=arguments.length<2?Wx(r):e;if(Hx(t))return qx(_x(t,r));throw Gx(jx(r)+" is not iterable")}});var nf=h((VB,rf)=>{"use strict";var Vx=Ma(),zx=je(),Jx=Un(),$x=qh(),Kx=Wh(),Xx=Kh(),Zx=Ta(),ef=mu(),Qx=pu(),Yx=Ua(),tf=Array;rf.exports=function(e){var t=Jx(e),i=Xx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=Vx(o,n>2?arguments[2]:void 0));var c=Yx(t),p=0,g,f,m,b,y,P;if(c&&!(this===tf&&Kx(c)))for(b=Qx(t,c),y=b.next,f=i?new this:[];!(m=zx(y,b)).done;p++)P=a?$x(b,o,[m.value,p],!0):m.value,ef(f,p,P);else for(g=Zx(t),f=i?new this(g):tf(g);g>p;p++)P=a?o(t[p],p):t[p],ef(f,p,P);return f.length=p,f}});var gu=h((zB,of)=>{var sf=Wl(),eF=Ta(),tF=mu(),rF=Array,iF=Math.max;of.exports=function(r,e,t){for(var i=eF(r),n=sf(e,i),o=sf(t===void 0?i:t,i),a=rF(iF(o-n,0)),c=0;n<o;n++,c++)tF(a,c,r[n]);return a.length=c,a}});var hf=h((JB,gf)=>{var ar=X(),hu=2147483647,Jn=36,cf=1,yu=26,nF=38,sF=700,oF=72,aF=128,dF="-",lF=/[^\0-\u007E]/,mf=/[.\u3002\uFF0E\uFF61]/g,af="Overflow: input needs wider integers to process",fu=Jn-cf,df=RangeError,uF=ar(mf.exec),Xr=Math.floor,vu=String.fromCharCode,lf=ar("".charCodeAt),pf=ar([].join),Pt=ar([].push),cF=ar("".replace),mF=ar("".split),pF=ar("".toLowerCase),gF=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=lf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=lf(r,t++);(o&64512)==56320?Pt(e,((n&1023)<<10)+(o&1023)+65536):(Pt(e,n),t--)}else Pt(e,n)}return e},uf=function(r){return r+22+75*(r<26)},hF=function(r,e,t){var i=0;for(r=t?Xr(r/sF):r>>1,r+=Xr(r/e);r>fu*yu>>1;)r=Xr(r/fu),i+=Jn;return Xr(i+(fu+1)*r/(r+nF))},fF=function(r){var e=[];r=gF(r);var t=r.length,i=aF,n=0,o=oF,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&Pt(e,vu(c));var p=e.length,g=p;for(p&&Pt(e,dF);g<t;){var f=hu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<f&&(f=c);var m=g+1;if(f-i>Xr((hu-n)/m))throw df(af);for(n+=(f-i)*m,i=f,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>hu)throw df(af);if(c==i){for(var b=n,y=Jn;;){var P=y<=o?cf:y>=o+yu?yu:y-o;if(b<P)break;var C=b-P,T=Jn-P;Pt(e,vu(uf(P+C%T))),b=Xr(C/T),y+=Jn}Pt(e,vu(uf(b))),o=hF(n,m,g==p),n=0,g++}}n++,i++}return pf(e,"")};gf.exports=function(r){var e=[],t=mF(cF(pF(r),mf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],Pt(e,uF(lF,n)?"xn--"+fF(n):n);return pf(e,".")}});var bu=h(($B,ff)=>{var vF=TypeError;ff.exports=function(r,e){if(r<e)throw vF("Not enough arguments");return r}});var yf=h((KB,vf)=>{var yF=Ce(),bF=jn(),kF=Qe().f,ku=yF("unscopables"),Su=Array.prototype;Su[ku]==null&&kF(Su,ku,{configurable:!0,value:bF(null)});vf.exports=function(r){Su[ku][r]=!0}});var wf=h((XB,Cf)=>{"use strict";var SF=Jr(),Pu=yf(),bf=$r(),Sf=zr(),PF=Qe().f,CF=ou(),La=au(),wF=Wr(),xF=ge(),Pf="Array Iterator",FF=Sf.set,IF=Sf.getterFor(Pf);Cf.exports=CF(Array,"Array",function(r,e){FF(this,{type:Pf,target:SF(r),index:0,kind:e})},function(){var r=IF(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,La(void 0,!0)):t=="keys"?La(i,!1):t=="values"?La(e[i],!1):La([i,e[i]],!1)},"values");var kf=bf.Arguments=bf.Array;Pu("keys");Pu("values");Pu("entries");if(!wF&&xF&&kf.name!=="values")try{PF(kf,"name",{value:"values"})}catch{}});var Ff=h((ZB,xf)=>{var TF=or();xf.exports=function(r,e,t){for(var i in e)TF(r,i,e[i],t);return r}});var Af=h((QB,Tf)=>{var If=gu(),AF=Math.floor,Cu=function(r,e){var t=r.length,i=AF(t/2);return t<8?EF(r,e):RF(r,Cu(If(r,0,i),e),Cu(If(r,i),e),e)},EF=function(r,e){for(var t=r.length,i=1,n,o;i<t;){for(o=i,n=r[i];o&&e(r[o-1],n)>0;)r[o]=r[--o];o!==i++&&(r[o]=n)}return r},RF=function(r,e,t,i){for(var n=e.length,o=t.length,a=0,c=0;a<n||c<o;)r[a+c]=a<n&&c<o?i(e[a],t[c])<=0?e[a++]:t[c++]:a<n?e[a++]:t[c++];return r};Tf.exports=Cu});var Bu=h((YB,Kf)=>{"use strict";wf();var Tu=qn(),Qr=pe(),Da=je(),Ye=X(),OF=ge(),qf=du(),jf=or(),BF=Ff(),MF=Wn(),UF=nu(),Ru=zr(),Wf=lu(),wu=Z(),LF=Pe(),DF=Ma(),NF=Ln(),_F=Ze(),Gf=St(),he=Dn(),HF=jn(),Ef=Vr(),Au=pu(),qF=Ua(),Zr=bu(),jF=Ce(),WF=Af(),GF=jF("iterator"),Xn="URLSearchParams",Vf=Xn+"Iterator",zf=Ru.set,Ge=Ru.getterFor(Xn),VF=Ru.getterFor(Vf),zF=Object.getOwnPropertyDescriptor,Ou=function(r){if(!OF)return Qr[r];var e=zF(Qr,r);return e&&e.value},Rf=Ou("fetch"),_a=Ou("Request"),$n=Ou("Headers"),xu=_a&&_a.prototype,Of=$n&&$n.prototype,JF=Qr.RegExp,$F=Qr.TypeError,Jf=Qr.decodeURIComponent,KF=Qr.encodeURIComponent,XF=Ye("".charAt),Bf=Ye([].join),dr=Ye([].push),Eu=Ye("".replace),ZF=Ye([].shift),Mf=Ye([].splice),Uf=Ye("".split),QF=Ye("".slice),YF=/\+/g,Lf=Array(4),eI=function(r){return Lf[r-1]||(Lf[r-1]=JF("((?:%[\\da-f]{2}){"+r+"})","gi"))},tI=function(r){try{return Jf(r)}catch{return r}},Df=function(r){var e=Eu(r,YF," "),t=4;try{return Jf(e)}catch{for(;t;)e=Eu(e,eI(t--),tI);return e}},rI=/[!'()~]|%20/g,iI={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},nI=function(r){return iI[r]},Nf=function(r){return Eu(KF(r),rI,nI)},Fu=UF(function(e,t){zf(this,{type:Vf,iterator:Au(Ge(e).entries),kind:t})},"Iterator",function(){var e=VF(this),t=e.kind,i=e.iterator.next(),n=i.value;return i.done||(i.value=t==="keys"?n.key:t==="values"?n.value:[n.key,n.value]),i},!0),$f=function(r){this.entries=[],this.url=null,r!==void 0&&(Gf(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?XF(r,0)==="?"?QF(r,1):r:he(r)))};$f.prototype={type:Xn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=qF(r),t,i,n,o,a,c,p;if(e)for(t=Au(r,e),i=t.next;!(n=Da(i,t)).done;){if(o=Au(_F(n.value)),a=o.next,(c=Da(a,o)).done||(p=Da(a,o)).done||!Da(a,o).done)throw $F("Expected sequence with length 2");dr(this.entries,{key:he(c.value),value:he(p.value)})}else for(var g in r)LF(r,g)&&dr(this.entries,{key:g,value:he(r[g])})},parseQuery:function(r){if(r)for(var e=Uf(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Uf(i,"="),dr(this.entries,{key:Df(ZF(n)),value:Df(Bf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],dr(e,Nf(i.key)+"="+Nf(i.value));return Bf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Ha=function(){Wf(this,Kn);var e=arguments.length>0?arguments[0]:void 0;zf(this,new $f(e))},Kn=Ha.prototype;BF(Kn,{append:function(e,t){Zr(arguments.length,2);var i=Ge(this);dr(i.entries,{key:he(e),value:he(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=he(r),n=0;n<t.length;)t[n].key===i?Mf(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=he(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=he(e),n=[],o=0;o<t.length;o++)t[o].key===i&&dr(n,t[o].value);return n},has:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=he(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Zr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=he(e),c=he(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?Mf(n,p--,1):(o=!0,g.value=c));o||dr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ge(this);WF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=DF(e,arguments.length>1?arguments[1]:void 0),n=0,o;n<t.length;)o=t[n++],i(o.value,o.key,this)},keys:function(){return new Fu(this,"keys")},values:function(){return new Fu(this,"values")},entries:function(){return new Fu(this,"entries")}},{enumerable:!0});jf(Kn,GF,Kn.entries,{name:"entries"});jf(Kn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});MF(Ha,Xn);Tu({global:!0,constructor:!0,forced:!qf},{URLSearchParams:Ha});!qf&&wu($n)&&(_f=Ye(Of.has),Hf=Ye(Of.set),Iu=function(r){if(Gf(r)){var e=r.body,t;if(NF(e)===Xn)return t=r.headers?new $n(r.headers):new $n,_f(t,"content-type")||Hf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),HF(r,{body:Ef(0,he(e)),headers:Ef(0,t)})}return r},wu(Rf)&&Tu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Rf(e,arguments.length>1?Iu(arguments[1]):{})}}),wu(_a)&&(Na=function(e){return Wf(this,xu),new _a(e,arguments.length>1?Iu(arguments[1]):{})},xu.constructor=Na,Na.prototype=xu,Tu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Na})));var _f,Hf,Iu,Na;Kf.exports={URLSearchParams:Ha,getState:Ge}});var gv=h(()=>{"use strict";Ch();var sI=qn(),Ku=ge(),oI=du(),Xu=pe(),Xf=Ma(),Te=X(),Va=or(),we=Rh(),aI=lu(),zu=Pe(),Zu=Lh(),Yr=nf(),Ve=gu(),dI=ml().codeAt,lI=hf(),ct=Dn(),uI=Wn(),cI=bu(),dv=Bu(),lv=zr(),mI=lv.set,za=lv.getterFor("URL"),pI=dv.URLSearchParams,gI=dv.getState,Zn=Xu.URL,Ju=Xu.TypeError,Ja=Xu.parseInt,hI=Math.floor,Zf=Math.pow,Ie=Te("".charAt),ze=Te(/./.exec),Yn=Te([].join),fI=Te(1 .toString),vI=Te([].pop),ti=Te([].push),Qf=Te("".replace),yI=Te([].shift),bI=Te("".split),ts=Te("".slice),$a=Te("".toLowerCase),kI=Te([].unshift),SI="Invalid authority",Mu="Invalid scheme",lr="Invalid host",Yf="Invalid port",uv=/[a-z]/i,PI=/[\d+-.a-z]/i,$u=/\d/,CI=/^0x/i,wI=/^[0-7]+$/,xI=/^\d+$/,cv=/^[\da-f]+$/i,FI=/[\0\t\n\r #%/:<>?@[\\\]^|]/,II=/[\0\t\n\r #/:<>?@[\\\]^|]/,TI=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,AI=/[\t\n\r]/g,xe,EI=function(r){var e=bI(r,"."),t,i,n,o,a,c,p;if(e.length&&e[e.length-1]==""&&e.length--,t=e.length,t>4)return r;for(i=[],n=0;n<t;n++){if(o=e[n],o=="")return r;if(a=10,o.length>1&&Ie(o,0)=="0"&&(a=ze(CI,o)?16:8,o=ts(o,a==8?1:2)),o==="")c=0;else{if(!ze(a==10?xI:a==8?wI:cv,o))return r;c=Ja(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=Zf(256,5-t))return null}else if(c>255)return null;for(p=vI(i),n=0;n<i.length;n++)p+=i[n]*Zf(256,3-n);return p},RI=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,f,m,b=function(){return Ie(r,n)};if(b()==":"){if(Ie(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(cv,b());)o=o*16+Ja(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!ze($u,b()))return;for(;ze($u,b());){if(g=Ja(b(),10),p===null)p=g;else{if(p==0)return;p=p*10+g}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(f=t-i,t=7;t!=0&&f>0;)m=e[t],e[t--]=e[i+f-1],e[i+--f]=m;else if(t!=8)return;return e},OI=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},Qn=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)kI(e,r%256),r=hI(r/256);return Yn(e,".")}else if(typeof r=="object"){for(e="",i=OI(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=fI(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},Ga={},mv=Zu({},Ga,{" ":1,'"':1,"<":1,">":1,"`":1}),pv=Zu({},mv,{"#":1,"?":1,"{":1,"}":1}),Uu=Zu({},pv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ct=function(r,e){var t=dI(r,0);return t>32&&t<127&&!zu(e,r)?r:encodeURIComponent(r)},qa={ftp:21,file:null,http:80,https:443,ws:80,wss:443},es=function(r,e){var t;return r.length==2&&ze(uv,Ie(r,0))&&((t=Ie(r,1))==":"||!e&&t=="|")},ev=function(r){var e;return r.length>1&&es(ts(r,0,2))&&(r.length==2||(e=Ie(r,2))==="/"||e==="\\"||e==="?"||e==="#")},BI=function(r){return r==="."||$a(r)==="%2e"},MI=function(r){return r=$a(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Lu={},tv={},Du={},rv={},iv={},Nu={},nv={},sv={},ja={},Wa={},_u={},Hu={},qu={},ju={},ov={},Wu={},ei={},et={},av={},ur={},ut={},Qu=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw Ju(o);this.searchParams=null}else{if(t!==void 0&&(n=new Qu(t,!0)),o=this.parse(i,null,n),o)throw Ju(o);a=gI(new pI),a.bindURL(this),this.searchParams=a}};Qu.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Lu,o=0,a="",c=!1,p=!1,g=!1,f,m,b,y;for(r=ct(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=Qf(r,TI,"")),r=Qf(r,AI,""),f=Yr(r);o<=f.length;){switch(m=f[o],n){case Lu:if(m&&ze(uv,m))a+=$a(m),n=tv;else{if(e)return Mu;n=Du;continue}break;case tv:if(m&&(ze(PI,m)||m=="+"||m=="-"||m=="."))a+=$a(m);else if(m==":"){if(e&&(i.isSpecial()!=zu(qa,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&qa[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=ju:i.isSpecial()&&t&&t.scheme==i.scheme?n=rv:i.isSpecial()?n=sv:f[o+1]=="/"?(n=iv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=av)}else{if(e)return Mu;a="",n=Du,o=0;continue}break;case Du:if(!t||t.cannotBeABaseURL&&m!="#")return Mu;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Ve(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?ju:Nu;continue;case rv:if(m=="/"&&f[o+1]=="/")n=ja,o++;else{n=Nu;continue}break;case iv:if(m=="/"){n=Wa;break}else{n=et;continue}case Nu:if(i.scheme=t.scheme,m==xe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=nv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query="",n=ur;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.path.length--,n=et;continue}break;case nv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=ja;else if(m=="/")n=Wa;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case sv:if(n=ja,m!="/"||Ie(a,o+1)!="/")continue;o++;break;case ja:if(m!="/"&&m!="\\"){n=Wa;continue}break;case Wa:if(m=="@"){c&&(a="%40"+a),c=!0,b=Yr(a);for(var P=0;P<b.length;P++){var C=b[P];if(C==":"&&!g){g=!0;continue}var T=Ct(C,Uu);g?i.password+=T:i.username+=T}a=""}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return SI;o-=Yr(a).length+1,a="",n=_u}else a+=m;break;case _u:case Hu:if(e&&i.scheme=="file"){n=Wu;continue}else if(m==":"&&!p){if(a=="")return lr;if(y=i.parseHost(a),y)return y;if(a="",n=qu,e==Hu)return}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return lr;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=ei,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case qu:if(ze($u,m))a+=m;else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var B=Ja(a,10);if(B>65535)return Yf;i.port=i.isSpecial()&&B===qa[i.scheme]?null:B,a=""}if(e)return;n=ei;continue}else return Yf;break;case ju:if(i.scheme="file",m=="/"||m=="\\")n=ov;else if(t&&t.scheme=="file")if(m==xe)i.host=t.host,i.path=Ve(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Ve(t.path),i.query="",n=ur;else if(m=="#")i.host=t.host,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{ev(Yn(Ve(f,o),""))||(i.host=t.host,i.path=Ve(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case ov:if(m=="/"||m=="\\"){n=Wu;break}t&&t.scheme=="file"&&!ev(Yn(Ve(f,o),""))&&(es(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=et;continue;case Wu:if(m==xe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&es(a))n=et;else if(a==""){if(i.host="",e)return;n=ei}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ei}continue}else a+=m;break;case ei:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=ur;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=xe&&(n=et,m!="/"))continue;break;case et:if(m==xe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(MI(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):BI(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&es(a)&&(i.host&&(i.host=""),a=Ie(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==xe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)yI(i.path);m=="?"?(i.query="",n=ur):m=="#"&&(i.fragment="",n=ut)}else a+=Ct(m,pv);break;case av:m=="?"?(i.query="",n=ur):m=="#"?(i.fragment="",n=ut):m!=xe&&(i.path[0]+=Ct(m,Ga));break;case ur:!e&&m=="#"?(i.fragment="",n=ut):m!=xe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=Ct(m,Ga));break;case ut:m!=xe&&(i.fragment+=Ct(m,mv));break}o++}},parseHost:function(r){var e,t,i;if(Ie(r,0)=="["){if(Ie(r,r.length-1)!="]"||(e=RI(ts(r,1,-1)),!e))return lr;this.host=e}else if(this.isSpecial()){if(r=lI(r),ze(FI,r)||(e=EI(r),e===null))return lr;this.host=e}else{if(ze(II,r))return lr;for(e="",t=Yr(r),i=0;i<t.length;i++)e+=Ct(t[i],Ga);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return zu(qa,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!es(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,g=e+":";return n!==null?(g+="//",r.includesCredentials()&&(g+=t+(i?":"+i:"")+"@"),g+=Qn(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+Yn(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw Ju(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ri(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+Qn(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",Lu)},getUsername:function(){return this.username},setUsername:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=Ct(e[t],Uu)}},getPassword:function(){return this.password},setPassword:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=Ct(e[t],Uu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?Qn(r):Qn(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,_u)},getHostname:function(){var r=this.host;return r===null?"":Qn(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Hu)},getPort:function(){var r=this.port;return r===null?"":ct(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ct(r),r==""?this.port=null:this.parse(r,qu))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+Yn(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ei))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ie(r,0)=="?"&&(r=ts(r,1)),this.query="",this.parse(r,ur)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=ct(r),r==""){this.fragment=null;return}Ie(r,0)=="#"&&(r=ts(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=aI(this,re),i=cI(arguments.length,1)>1?arguments[1]:void 0,n=mI(t,new Qu(e,!1,i));Ku||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},re=ri.prototype,Fe=function(r,e){return{get:function(){return za(this)[r]()},set:e&&function(t){return za(this)[e](t)},configurable:!0,enumerable:!0}};Ku&&(we(re,"href",Fe("serialize","setHref")),we(re,"origin",Fe("getOrigin")),we(re,"protocol",Fe("getProtocol","setProtocol")),we(re,"username",Fe("getUsername","setUsername")),we(re,"password",Fe("getPassword","setPassword")),we(re,"host",Fe("getHost","setHost")),we(re,"hostname",Fe("getHostname","setHostname")),we(re,"port",Fe("getPort","setPort")),we(re,"pathname",Fe("getPathname","setPathname")),we(re,"search",Fe("getSearch","setSearch")),we(re,"searchParams",Fe("getSearchParams")),we(re,"hash",Fe("getHash","setHash")));Va(re,"toJSON",function(){return za(this).serialize()},{enumerable:!0});Va(re,"toString",function(){return za(this).serialize()},{enumerable:!0});Zn&&(Gu=Zn.createObjectURL,Vu=Zn.revokeObjectURL,Gu&&Va(ri,"createObjectURL",Xf(Gu,Zn)),Vu&&Va(ri,"revokeObjectURL",Xf(Vu,Zn)));var Gu,Vu;uI(ri,"URL");sI({global:!0,constructor:!0,forced:!oI,sham:!Ku},{URL:ri})});var hv=h(()=>{gv()});var fv=h(()=>{"use strict";var UI=qn(),LI=je();UI({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return LI(URL.prototype.toString,this)}})});var vv=h(()=>{Bu()});var bv=h((dM,yv)=>{var DI=pe();yv.exports=DI});var Sv=h((lM,kv)=>{hv();fv();vv();var NI=bv();kv.exports=NI.URL});var Fc=h((BD,Ey)=>{var QT=Object.prototype.toString;Ey.exports=function(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;if(t==="boolean")return"boolean";if(t==="string")return"string";if(t==="number")return"number";if(t==="symbol")return"symbol";if(t==="function")return iA(e)?"generatorfunction":"function";if(YT(e))return"array";if(oA(e))return"buffer";if(sA(e))return"arguments";if(tA(e))return"date";if(eA(e))return"error";if(rA(e))return"regexp";switch(Ay(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(nA(e))return"generator";switch(t=QT.call(e),t){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function Ay(r){return typeof r.constructor=="function"?r.constructor.name:null}function YT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function eA(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function tA(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function rA(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function iA(r,e){return Ay(r)==="GeneratorFunction"}function nA(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function sA(r){try{if(typeof r.length=="number"&&typeof r.callee=="function")return!0}catch(e){if(e.message.indexOf("callee")!==-1)return!0}return!1}function oA(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var By=h((MD,Oy)=>{"use strict";var Ry=Symbol.prototype.valueOf,aA=Fc();function dA(r,e){switch(aA(r)){case"array":return r.slice();case"object":return Object.assign({},r);case"date":return new r.constructor(Number(r));case"map":return new Map(r);case"set":return new Set(r);case"buffer":return mA(r);case"symbol":return pA(r);case"arraybuffer":return uA(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return cA(r);case"regexp":return lA(r);case"error":return Object.create(r);default:return r}}function lA(r){let e=r.flags!==void 0?r.flags:/\w+$/.exec(r)||void 0,t=new r.constructor(r.source,e);return t.lastIndex=r.lastIndex,t}function uA(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function cA(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function mA(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function pA(r){return Ry?Object(Ry.call(r)):{}}Oy.exports=dA});var Uy=h((UD,My)=>{"use strict";My.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Ny=h((LD,Dy)=>{"use strict";var gA=Uy();function Ly(r){return gA(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Dy.exports=function(e){var t,i;return!(Ly(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ly(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Hy=h((DD,_y)=>{"use strict";var hA=By(),fA=Fc(),vA=Ny();function Ic(r,e){switch(fA(r)){case"object":return yA(r,e);case"array":return bA(r,e);default:return hA(r)}}function yA(r,e){if(typeof e=="function")return e(r);if(e||vA(r)){let t=new r.constructor;for(let i in r)t[i]=Ic(r[i],e);return t}return r}function bA(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Ic(r[i],e);return t}_y.exports=Ic});var _c=h((ps,Fi)=>{var kA=200,Nc="__lodash_hash_undefined__",yd=1,Qy=2,Yy=9007199254740991,cd="[object Arguments]",Rc="[object Array]",SA="[object AsyncFunction]",eb="[object Boolean]",tb="[object Date]",rb="[object Error]",ib="[object Function]",PA="[object GeneratorFunction]",md="[object Map]",nb="[object Number]",CA="[object Null]",xi="[object Object]",qy="[object Promise]",wA="[object Proxy]",sb="[object RegExp]",pd="[object Set]",ob="[object String]",xA="[object Symbol]",FA="[object Undefined]",Oc="[object WeakMap]",ab="[object ArrayBuffer]",gd="[object DataView]",IA="[object Float32Array]",TA="[object Float64Array]",AA="[object Int8Array]",EA="[object Int16Array]",RA="[object Int32Array]",OA="[object Uint8Array]",BA="[object Uint8ClampedArray]",MA="[object Uint16Array]",UA="[object Uint32Array]",LA=/[\\^$.*+?()[\]{}|]/g,DA=/^\[object .+?Constructor\]$/,NA=/^(?:0|[1-9]\d*)$/,j={};j[IA]=j[TA]=j[AA]=j[EA]=j[RA]=j[OA]=j[BA]=j[MA]=j[UA]=!0;j[cd]=j[Rc]=j[ab]=j[eb]=j[gd]=j[tb]=j[rb]=j[ib]=j[md]=j[nb]=j[xi]=j[sb]=j[pd]=j[ob]=j[Oc]=!1;var db=typeof global=="object"&&global&&global.Object===Object&&global,_A=typeof self=="object"&&self&&self.Object===Object&&self,ht=db||_A||Function("return this")(),lb=typeof ps=="object"&&ps&&!ps.nodeType&&ps,jy=lb&&typeof Fi=="object"&&Fi&&!Fi.nodeType&&Fi,ub=jy&&jy.exports===lb,Tc=ub&&db.process,Wy=function(){try{return Tc&&Tc.binding&&Tc.binding("util")}catch{}}(),Gy=Wy&&Wy.isTypedArray;function HA(r,e){for(var t=-1,i=r==null?0:r.length,n=0,o=[];++t<i;){var a=r[t];e(a,t,r)&&(o[n++]=a)}return o}function qA(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function jA(r,e){for(var t=-1,i=r==null?0:r.length;++t<i;)if(e(r[t],t,r))return!0;return!1}function WA(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function GA(r){return function(e){return r(e)}}function VA(r,e){return r.has(e)}function zA(r,e){return r?.[e]}function JA(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function $A(r,e){return function(t){return r(e(t))}}function KA(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var XA=Array.prototype,ZA=Function.prototype,bd=Object.prototype,Ac=ht["__core-js_shared__"],cb=ZA.toString,rt=bd.hasOwnProperty,Vy=function(){var r=/[^.]+$/.exec(Ac&&Ac.keys&&Ac.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),mb=bd.toString,QA=RegExp("^"+cb.call(rt).replace(LA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zy=ub?ht.Buffer:void 0,hd=ht.Symbol,Jy=ht.Uint8Array,pb=bd.propertyIsEnumerable,YA=XA.splice,br=hd?hd.toStringTag:void 0,$y=Object.getOwnPropertySymbols,eE=zy?zy.isBuffer:void 0,tE=$A(Object.keys,Object),Bc=Ii(ht,"DataView"),gs=Ii(ht,"Map"),Mc=Ii(ht,"Promise"),Uc=Ii(ht,"Set"),Lc=Ii(ht,"WeakMap"),hs=Ii(Object,"create"),rE=Pr(Bc),iE=Pr(gs),nE=Pr(Mc),sE=Pr(Uc),oE=Pr(Lc),Ky=hd?hd.prototype:void 0,Ec=Ky?Ky.valueOf:void 0;function kr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function aE(){this.__data__=hs?hs(null):{},this.size=0}function dE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function lE(r){var e=this.__data__;if(hs){var t=e[r];return t===Nc?void 0:t}return rt.call(e,r)?e[r]:void 0}function uE(r){var e=this.__data__;return hs?e[r]!==void 0:rt.call(e,r)}function cE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=hs&&e===void 0?Nc:e,this}kr.prototype.clear=aE;kr.prototype.delete=dE;kr.prototype.get=lE;kr.prototype.has=uE;kr.prototype.set=cE;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function mE(){this.__data__=[],this.size=0}function pE(r){var e=this.__data__,t=kd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():YA.call(e,t,1),--this.size,!0}function gE(r){var e=this.__data__,t=kd(e,r);return t<0?void 0:e[t][1]}function hE(r){return kd(this.__data__,r)>-1}function fE(r,e){var t=this.__data__,i=kd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=mE;ft.prototype.delete=pE;ft.prototype.get=gE;ft.prototype.has=hE;ft.prototype.set=fE;function Sr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function vE(){this.size=0,this.__data__={hash:new kr,map:new(gs||ft),string:new kr}}function yE(r){var e=Sd(this,r).delete(r);return this.size-=e?1:0,e}function bE(r){return Sd(this,r).get(r)}function kE(r){return Sd(this,r).has(r)}function SE(r,e){var t=Sd(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Sr.prototype.clear=vE;Sr.prototype.delete=yE;Sr.prototype.get=bE;Sr.prototype.has=kE;Sr.prototype.set=SE;function fd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Sr;++e<t;)this.add(r[e])}function PE(r){return this.__data__.set(r,Nc),this}function CE(r){return this.__data__.has(r)}fd.prototype.add=fd.prototype.push=PE;fd.prototype.has=CE;function Bt(r){var e=this.__data__=new ft(r);this.size=e.size}function wE(){this.__data__=new ft,this.size=0}function xE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function FE(r){return this.__data__.get(r)}function IE(r){return this.__data__.has(r)}function TE(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!gs||i.length<kA-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new Sr(i)}return t.set(r,e),this.size=t.size,this}Bt.prototype.clear=wE;Bt.prototype.delete=xE;Bt.prototype.get=FE;Bt.prototype.has=IE;Bt.prototype.set=TE;function AE(r,e){var t=vd(r),i=!t&&GE(r),n=!t&&!i&&Dc(r),o=!t&&!i&&!n&&kb(r),a=t||i||n||o,c=a?WA(r.length,String):[],p=c.length;for(var g in r)(e||rt.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||_E(g,p)))&&c.push(g);return c}function kd(r,e){for(var t=r.length;t--;)if(fb(r[t][0],e))return t;return-1}function EE(r,e,t){var i=e(r);return vd(r)?i:qA(i,t(r))}function vs(r){return r==null?r===void 0?FA:CA:br&&br in Object(r)?DE(r):WE(r)}function Xy(r){return fs(r)&&vs(r)==cd}function gb(r,e,t,i,n){return r===e?!0:r==null||e==null||!fs(r)&&!fs(e)?r!==r&&e!==e:RE(r,e,t,i,gb,n)}function RE(r,e,t,i,n,o){var a=vd(r),c=vd(e),p=a?Rc:Ot(r),g=c?Rc:Ot(e);p=p==cd?xi:p,g=g==cd?xi:g;var f=p==xi,m=g==xi,b=p==g;if(b&&Dc(r)){if(!Dc(e))return!1;a=!0,f=!1}if(b&&!f)return o||(o=new Bt),a||kb(r)?hb(r,e,t,i,n,o):UE(r,e,p,t,i,n,o);if(!(t&yd)){var y=f&&rt.call(r,"__wrapped__"),P=m&&rt.call(e,"__wrapped__");if(y||P){var C=y?r.value():r,T=P?e.value():e;return o||(o=new Bt),n(C,T,t,i,o)}}return b?(o||(o=new Bt),LE(r,e,t,i,n,o)):!1}function OE(r){if(!bb(r)||qE(r))return!1;var e=vb(r)?QA:DA;return e.test(Pr(r))}function BE(r){return fs(r)&&yb(r.length)&&!!j[vs(r)]}function ME(r){if(!jE(r))return tE(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function hb(r,e,t,i,n,o){var a=t&yd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var g=o.get(r);if(g&&o.get(e))return g==e;var f=-1,m=!0,b=t&Qy?new fd:void 0;for(o.set(r,e),o.set(e,r);++f<c;){var y=r[f],P=e[f];if(i)var C=a?i(P,y,f,e,r,o):i(y,P,f,r,e,o);if(C!==void 0){if(C)continue;m=!1;break}if(b){if(!jA(e,function(T,B){if(!VA(b,B)&&(y===T||n(y,T,t,i,o)))return b.push(B)})){m=!1;break}}else if(!(y===P||n(y,P,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function UE(r,e,t,i,n,o,a){switch(t){case gd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case ab:return!(r.byteLength!=e.byteLength||!o(new Jy(r),new Jy(e)));case eb:case tb:case nb:return fb(+r,+e);case rb:return r.name==e.name&&r.message==e.message;case sb:case ob:return r==e+"";case md:var c=JA;case pd:var p=i&yd;if(c||(c=KA),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=Qy,a.set(r,e);var f=hb(c(r),c(e),i,n,o,a);return a.delete(r),f;case xA:if(Ec)return Ec.call(r)==Ec.call(e)}return!1}function LE(r,e,t,i,n,o){var a=t&yd,c=Zy(r),p=c.length,g=Zy(e),f=g.length;if(p!=f&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:rt.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var P=!0;o.set(r,e),o.set(e,r);for(var C=a;++m<p;){b=c[m];var T=r[b],B=e[b];if(i)var me=a?i(B,T,b,e,r,o):i(T,B,b,r,e,o);if(!(me===void 0?T===B||n(T,B,t,i,o):me)){P=!1;break}C||(C=b=="constructor")}if(P&&!C){var Bn=r.constructor,sa=e.constructor;Bn!=sa&&"constructor"in r&&"constructor"in e&&!(typeof Bn=="function"&&Bn instanceof Bn&&typeof sa=="function"&&sa instanceof sa)&&(P=!1)}return o.delete(r),o.delete(e),P}function Zy(r){return EE(r,JE,NE)}function Sd(r,e){var t=r.__data__;return HE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ii(r,e){var t=zA(r,e);return OE(t)?t:void 0}function DE(r){var e=rt.call(r,br),t=r[br];try{r[br]=void 0;var i=!0}catch{}var n=mb.call(r);return i&&(e?r[br]=t:delete r[br]),n}var NE=$y?function(r){return r==null?[]:(r=Object(r),HA($y(r),function(e){return pb.call(r,e)}))}:$E,Ot=vs;(Bc&&Ot(new Bc(new ArrayBuffer(1)))!=gd||gs&&Ot(new gs)!=md||Mc&&Ot(Mc.resolve())!=qy||Uc&&Ot(new Uc)!=pd||Lc&&Ot(new Lc)!=Oc)&&(Ot=function(r){var e=vs(r),t=e==xi?r.constructor:void 0,i=t?Pr(t):"";if(i)switch(i){case rE:return gd;case iE:return md;case nE:return qy;case sE:return pd;case oE:return Oc}return e});function _E(r,e){return e=e??Yy,!!e&&(typeof r=="number"||NA.test(r))&&r>-1&&r%1==0&&r<e}function HE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function qE(r){return!!Vy&&Vy in r}function jE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||bd;return r===t}function WE(r){return mb.call(r)}function Pr(r){if(r!=null){try{return cb.call(r)}catch{}try{return r+""}catch{}}return""}function fb(r,e){return r===e||r!==r&&e!==e}var GE=Xy(function(){return arguments}())?Xy:function(r){return fs(r)&&rt.call(r,"callee")&&!pb.call(r,"callee")},vd=Array.isArray;function VE(r){return r!=null&&yb(r.length)&&!vb(r)}var Dc=eE||KE;function zE(r,e){return gb(r,e)}function vb(r){if(!bb(r))return!1;var e=vs(r);return e==ib||e==PA||e==SA||e==wA}function yb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Yy}function bb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function fs(r){return r!=null&&typeof r=="object"}var kb=Gy?GA(Gy):BE;function JE(r){return VE(r)?AE(r):ME(r)}function $E(){return[]}function KE(){return!1}Fi.exports=zE});var aS=h(Dd=>{"use strict";Dd.byteLength=FR;Dd.toByteArray=TR;Dd.fromByteArray=RR;var st=[],_e=[],xR=typeof Uint8Array<"u"?Uint8Array:Array,vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Lr=0,sS=vm.length;Lr<sS;++Lr)st[Lr]=vm[Lr],_e[vm.charCodeAt(Lr)]=Lr;var Lr,sS;_e[45]=62;_e[95]=63;function oS(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function FR(r){var e=oS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function IR(r,e,t){return(e+t)*3/4-t}function TR(r){var e,t=oS(r),i=t[0],n=t[1],o=new xR(IR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=_e[r.charCodeAt(p)]<<18|_e[r.charCodeAt(p+1)]<<12|_e[r.charCodeAt(p+2)]<<6|_e[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=_e[r.charCodeAt(p)]<<2|_e[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=_e[r.charCodeAt(p)]<<10|_e[r.charCodeAt(p+1)]<<4|_e[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function AR(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function ER(r,e,t){for(var i,n=[],o=e;o<t;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(AR(i));return n.join("")}function RR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(ER(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(st[e>>2]+st[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),n.join("")}});var eq=Mn(Sv(),1);function v(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function cr(r,e){if(!r)throw Error(e)}var ie;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(ie||(ie={}));function wt(r){return r.startsWith(ie.COMMENT)}function Ka(r){return r.startsWith(ie.ACCOUNT)}function mr(r){return r.startsWith(ie.LINK)}function Pv(r){return r.startsWith(ie.MESSAGE)}function Cv(r){return r.startsWith(ie.SUBREDDIT)}function wv(r){return r.startsWith(ie.AWARD)}function _I(r){cr(wt(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function HI(r){cr(Ka(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function qI(r){cr(mr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function jI(r){cr(Pv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function WI(r){cr(Cv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function GI(r){cr(wv(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ii(r){return _I(r),r}function ne(r){return HI(r),r}function fe(r){return qI(r),r}function VI(r){return jI(r),r}function Ae(r){return WI(r),r}function zI(r){return GI(r),r}function Ee(r){if(wt(r))return ii(r);if(Ka(r))return ne(r);if(mr(r))return fe(r);if(Pv(r))return VI(r);if(Cv(r))return Ae(r);if(wv(r))return zI(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function Yu(r){return wt(r)}import*as w from"@devvit/protos";var Xa=class{constructor(e){}};var ec=(t=>(t.Installation="installation",t.App="app",t))(ec||{});function pr(r,e=new Set){for(let t of r){if(t.type==="group"){pr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}JI(r)}function JI(r){for(let e of r)if(e.type==="string"&&e.isSecret&&e.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${e.name}"`}var xt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var bM=["3rd-party","activity","add-emoji","add","add-media","add-to-feed","admin","ads","ai","align-center","align-left","align-right","all","ama","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audience","audio","author","automod","avatar-style","award","back","backup","ban","best","block","blockchain","bold","boost","bot","bounce","brand-awareness","browse","browser","cake","calendar","camera","campaign","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","chat-private","checkbox-dismiss","checkbox","checkmark","chrome","clear","client-list","close","closed-captioning","code-block","code-inline","coins-color-old","coins","collapse-left","collapse-right","collectible-expressions","collection","comment","comments","communities","community","confidence","contest","controversial","conversion","copy-clipboard","crop","crosspost","crowd-control","custom-feed","customize","dashboard","day","delete-column","delete","delete-row","devvit","discover","dismiss-all","distinguish","down-arrow","down","download","downvote","downvotes","drag","drugs","duplicate","edit","effect","embed","emoji","end-live-chat","error","expand-left","expand-right","external","feed-video","filter","format","forward","funnel","gif-post","gold","hashtag","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","insert-column-left","insert-column-right","insert-row-above","insert-row-below","internet","invite","italic","join","joined","jump-down","jump-up","karma","keyboard","kick","language","leave","left","link","link-post","list-bulleted","list-numbered","live-chat","live","load","location","lock","logout","loop","macro","mark-read","marketplace","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","mute","new","night","no-internet","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","official","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","play","poll-post","popular","posts","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radar","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","recovery-phrase","refresh","removal-reasons","remove","reply","report","reverse","rich-text","right","rising","rotate","rotate-image","rpan","rules","safari","save","save-view","saved","saved-response","search","self","send","settings","severity","share","share-new","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","spreadsheet","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","text","text-post","text-size","toggle","tools","top","topic-activism","topic-addictionsupport","topic-advice","topic-animals","topic-anime","topic-art","topic-beauty","topic-business","topic-careers","topic-cars","topic-celebrity","topic-craftsdiy","topic-crypto","topic-culture","topic-diy","topic-entertainment","topic-ethics","topic-family","topic-fashion","topic","topic-fitness","topic-food","topic-funny","topic-gender","topic-health","topic-help","topic-history","topic-hobbies","topic-homegarden","topic-internet","topic-law","topic-learning","topic-lifestyle","topic-marketplace","topic-mature","topic-mensfashion","topic-menshealth","topic-meta","topic-military","topic-movies","topic-music","topic-news","topic-other","topic-outdoors","topic-pets","topic-photography","topic-places","topic-podcasts","topic-politics","topic-programming","topic-reading","topic-religion","topic-science","topic-sexorientation","topic-sports","topic-style","topic-tabletop","topic-technology","topic-television","topic-traumasupport","topic-travel","topic-videogaming","topic-womensfashion","topic-womenshealth","translate","translation-off","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unstar","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","view-sort","views","volume","wallet","warning","webhook","whale","wiki-ban","wiki","wiki-unban","world","coins-color","powerup-color","powerup-fill-color","share-android","share-ios","video-live-1","video-live-fill-1","video-live","volume-mute","binoculars","caret-updown","planet","telescope"];import{AppSettingsDefinition as lT,GetFieldsResponse as uT}from"@devvit/protos";import{FormField as gr,FormFieldType as Re}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return $I(e);case"image":return KI(e);case"paragraph":return XI(e);case"number":return ZI(e);case"select":return QI(e);case"boolean":return YI(e);case"group":return eT(e);default:throw new Error("Unknown field type.")}})}function $I(r){return gr.fromPartial({defaultValue:{fieldType:Re.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Re.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function KI(r){return gr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Re.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function XI(r){return gr.fromPartial({defaultValue:{fieldType:Re.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Re.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function ZI(r){return gr.fromPartial({defaultValue:{fieldType:Re.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Re.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function QI(r){return gr.fromPartial({defaultValue:{fieldType:Re.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Re.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function YI(r){return gr.fromPartial({defaultValue:{fieldType:Re.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Re.BOOLEAN,helpText:r.helpText,label:r.label})}function eT(r){return gr.fromPartial({fieldType:Re.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as dT}from"@devvit/protos";import{RealtimeSubscriptionStatus as Fv}from"@devvit/protos";var L=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",Post:"devvit-post",PostAuthor:"devvit-post-author",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",SubredditName:"devvit-subreddit-name",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),xv;(function(r){r.Blocks="blocks",r.EmitSnapshots="emitSnapshots",r.EmitState="emitState",r.Realtime="realtime",r.Runtime="runtime",r.Surface="surface",r.UseAsync="useAsync",r.Payments="payments",r.Bootstrap="bootstrap"})(xv||(xv={}));function Iv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[L.App]?.values[0];v(c,"useChannel - app is missing from Context");let p=r.metadata[L.Installation]?.values[0];v(p,"useChannel - installation is missing from Context");async function g(T){let B=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(B,T);else throw Error(`Failed to send to channel '${B}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${B}`)}function f(){if(!o[n].active){let T=o[n].channel;o[n].active=!0,r.addRealtimeChannel(T)}}function m(){if(o[n].active){let T=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(T)}}function b(T){return async()=>{let B;switch(T.status){case Fv.REALTIME_SUBSCRIBED:o[n].connected=!0,B=t.onSubscribed?.();break;case Fv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,B=t.onUnsubscribed?.();break;default:B=t.onMessage(T.event?.data?.msg);break}await B}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:xt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let P=r.realtimeEvent;r.isInitialRender?y.active=!1:P&&y.active&&P.event.channel===y.channel&&(y.preventCallback||r.runHook(b(P)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let C=0;return y.active&&y.connected?C=2:y.active&&!y.connected?C=1:!y.active&&y.connected?C=3:!y.active&&!y.connected&&(C=4),{subscribe:f,unsubscribe:m,send:g,status:C}}return e}import{FormFieldType as ni}from"@devvit/protos";function tc(r){switch(r.fieldType){case ni.STRING:return r.stringValue;case ni.IMAGE:return r.stringValue;case ni.PARAGRAPH:return r.stringValue;case ni.NUMBER:return r.numberValue;case ni.BOOLEAN:return r.boolValue;case ni.SELECTION:return r.selectionValue?.values??[];default:return}}function Ft(r){return Object.keys(r).reduce((e,t)=>{let i=tc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Tv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,g={formKey:p,preventSubmit:!1,type:xt.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let f=r.formSubmittedEvent;return f&&!g.preventSubmit&&f.formId===p&&r.runHook(async()=>{let m=i(Ft(f.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function Av(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),g={lastRun:void 0,running:!1,preventCallback:!1,type:xt.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function f(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,y]of Object.entries(o))if(b!==n.toString()&&y?.type===xt.INTERVAL&&y?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:o[n]?.lastRun??Date.now(),preventCallback:!1,type:xt.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&g.running&&(g.preventCallback||(g.lastRun===void 0||g.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:f,stop:m}}return e}function Ev(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState();if(i in n)return r.currentHookIndex++,[n[i],a];if(r.isInitialRender||!(i in o)){let c=t instanceof Function?t():t;if(c instanceof Promise)throw(async()=>{n[i]=await c,r.currentHookIndex=0})();n[i]=c}else n[i]=o[i];function a(c){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=c instanceof Function?c(n[i]):c}return r.currentHookIndex++,[n[i],a]}return e}var sc={now(){return new Date}};function Rv(r){return`__autocache__${r}`}function Ov(r){return`__lock__${r}`}var rT=300,iT=1e3,Za=5e3,rc=3,Bv=.1,Mv=1e3,nT=3e4;function Uv(r){if(r.error)throw new Error(r.error);return r.value}var It,Tt,Oe,si,$,Lv,Dv,Nv,ic,_v,Hv,nc,qv,Qa=class{constructor(e,t,i=sc){l(this,$);l(this,It);l(this,Tt,{});l(this,Oe);l(this,si);d(this,It,e),d(this,si,t),d(this,Oe,i)}async cache(e,t){d(this,Tt,s(this,si).__cache=s(this,si).__cache??{}),S(this,$,qv).call(this,t);let i=S(this,$,Lv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,nc).call(this,t.key),o=await S(this,$,Dv).call(this,t,n,e);return Uv(o)}};It=new WeakMap,Tt=new WeakMap,Oe=new WeakMap,si=new WeakMap,$=new WeakSet,Lv=function(e){let t=s(this,Tt)[e];if(t){let i=s(this,Oe).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<rc&&Math.random()<Bv&&t.errorTime+Mv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Mv<i||n){delete s(this,Tt)[e];return}else return Uv(t)}},Dv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Hv).call(this,n):1;return!t||t?.error&&t.errorCount<rc&&Bv>Math.random()||o>Math.random()?S(this,$,Nv).call(this,e,t,i):t},Nv=async function(e,t,i){let n=Ov(e.key),o=s(this,Oe).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,It).set(n,"1",{expiration:a,nx:!0}))return S(this,$,_v).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Oe).now();return S(this,$,ic).call(this,p,e.key,e.ttl)}},ic=async function(e,t,i){let n=Math.min(i,iT),o=await S(this,$,nc).call(this,t);if(o)return o;if(s(this,Oe).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,rT)),S(this,$,ic).call(this,e,t,i)},_v=async function(e,t,i,n){let o=s(this,Oe).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Oe).now().getTime(),t.errorCount++}return s(this,Tt)[e]=t,await s(this,It).set(Rv(e),JSON.stringify(t),{expiration:new Date(o+nT)}),t.error&&t.errorCount<rc&&await s(this,It).del(Ov(e)),t},Hv=function(e){let t=s(this,Oe).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},nc=async function(e){let t=await s(this,It).get(Rv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Oe).now().getTime(),s(this,Tt)[e]=i,i}},qv=function(e){e.ttl<Za&&(console.warn(`Cache TTL cannot be less than ${Za} milliseconds! Updating ttl value of ${e.ttl} to ${Za}.`),e.ttl=Za)};function jv(r,e,t=sc){let i=new Qa(r,e,t);return i.cache.bind(i)}function Wv(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,Gv,Vv,di=class{constructor(){l(this,li);l(this,oi,{});l(this,ai,{});d(this,oi,u.assets),d(this,ai,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,li,Gv).call(this,e,t??{webview:!1}):S(this,li,Vv).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,Gv=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return Wv(e),encodeURI(e)}catch{return""}},Vv=function(e,t){let i={},n=[],o=t.webview?s(this,ai):s(this,oi);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{Wv(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var At,ui=class{constructor(e){l(this,At);d(this,At,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,At));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await u.kvStorePlugin.Put({messages:i},s(this,At))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,At))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,At));return e}};At=new WeakMap;var rs,ci=class{constructor(e){l(this,rs);d(this,rs,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,rs));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};rs=new WeakMap;var is,mi=class{constructor(e){l(this,is);d(this,is,e)}async add(e){await u.modLogPlugin.Add(e,s(this,is))}};is=new WeakMap;var ns,pi=class{constructor(e){l(this,ns);d(this,ns,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:{msg:t}},s(this,ns))}};ns=new WeakMap;var k,ss,gi=class{constructor(e){l(this,k);l(this,ss);d(this,k,e),d(this,ss,new ed(e))}get modMail(){return s(this,ss)}getSubredditById(e){return ve.getById(Ee(e),s(this,k))}getSubredditInfoById(e){return Jv(e,s(this,k))}getSubredditByName(e){return ve.getByName(e,s(this,k))}getSubredditInfoByName(e){return $v(e,s(this,k))}addSubredditRemovalReason(e,t){return ve.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ve.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ve.getFromMetadata(s(this,k))}getPostById(e){return z.getById(Ee(e),s(this,k))}submitPost(e){return z.submit(e,s(this,k))}crosspost(e){return z.crosspost(e,s(this,k))}getUserById(e){return x.getById(Ee(e),s(this,k))}getUserByUsername(e){return x.getByUsername(e,s(this,k))}getCurrentUser(){return x.getFromMetadata(L.User,s(this,k))}getAppUser(){return x.getFromMetadata(L.AppUser,s(this,k))}getSnoovatarUrl(e){return x.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return ee.getById(Ee(e),s(this,k))}getComments(e){return ee.getComments(e,s(this,k))}getCommentsByUser(e){return ee.getCommentsByUser(e,s(this,k))}submitComment(e){return ee.submit({...e,id:Ee(e.id)},s(this,k))}getControversialPosts(e){return z.getControversialPosts(e,s(this,k))}getTopPosts(e){return z.getTopPosts(e,s(this,k))}getHotPosts(e){return z.getHotPosts(e,s(this,k))}getNewPosts(e){return z.getNewPosts(e,s(this,k))}getRisingPosts(e){return z.getRisingPosts(e,s(this,k))}getPostsByUser(e){return z.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return x.getOverview(e,s(this,k))}getModerationLog(e){return Ya(e,s(this,k))}getApprovedUsers(e){return x.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return x.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return x.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return x.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return x.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return x.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,k))}unbanUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return x.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return x.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return x.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return x.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.username,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return x.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return x.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return x.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return x.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return x.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Be.get(e,s(this,k))}deleteModNote(e){return Be.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?Ee(e.redditId):void 0};return Be.add(t,s(this,k))}addRemovalNote(e){return Be.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return hr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return hr.sendAsSubreddit(e,s(this,k))}async approve(e){if(wt(e))return ee.approve(e,s(this,k));if(mr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(wt(e))return ee.remove(e,t,s(this,k));if(mr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Me.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Me.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Me.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Me.removePostFlair(e,fe(t),s(this,k))}async getWidgets(e){return se.getWidgets(e,s(this,k))}async deleteWidget(e,t){return se.delete(e,t,s(this,k))}async addWidget(e){return se.add(e,s(this,k))}async reorderWidgets(e,t){return se.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ye.getPage(e,t,s(this,k))}async getWikiPages(e){return ye.getPages(e,s(this,k))}async createWikiPage(e){return ye.createPage(e,s(this,k))}async updateWikiPage(e){return ye.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ye.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ye.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ye.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ye.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ye.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ye.removeEditor(e,t,i,s(this,k))}getMessages(e){return hr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return hr.markAllAsRead(s(this,k))}report(e,t){return u.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,k))}getModQueue(e){return ve.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ve.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ve.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ve.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ve.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return Zv(e,s(this,k))}getVaultByUserId(e){return Qv(Ee(e),s(this,k))}getSubredditLeaderboard(e){return Kv(e,s(this,k))}getSubredditStyles(e){return Xv(e,s(this,k))}};k=new WeakMap,ss=new WeakMap;import{RedisKeyScope as oc}from"@devvit/protos";function td(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var E,R,O,ac=class{constructor(e,t,i){l(this,E);l(this,R);l(this,O);d(this,E,e),d(this,R,t),d(this,O,i)}async get(e){return await s(this,E).Get({key:e,transactionId:s(this,R)},s(this,O)),this}async multi(){await s(this,E).Multi(s(this,R),s(this,O))}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),await s(this,E).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,R)},s(this,O)),this}async del(...e){return await s(this,E).Del({keys:e,transactionId:s(this,R)},s(this,O)),this}async type(e){return await s(this,E).Type({key:e,transactionId:s(this,R)},s(this,O)),this}async exec(){let e=await s(this,E).Exec(s(this,R),s(this,O)),t=[];for(let i of e.response)i.members?t.push(i.members):i.nil!==void 0?t.push(null):i.num!==void 0?t.push(i.num):i.values!==void 0?t.push(i.values.values):i.str!==void 0&&t.push(i.str);return t}async discard(){await s(this,E).Discard(s(this,R),s(this,O))}async watch(...e){return await s(this,E).Watch({keys:e,transactionId:s(this,R)},s(this,O)),this}async unwatch(){return await s(this,E).Unwatch(s(this,R),s(this,O)),this}async getRange(e,t,i){return await s(this,E).GetRange({key:e,start:t,end:i,transactionId:s(this,R)},s(this,O)),this}async setRange(e,t,i){return await s(this,E).SetRange({key:e,offset:t,value:i,transactionId:s(this,R)},s(this,O)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,E).Strlen({key:e,transactionId:s(this,R)},s(this,O)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,E).MGet({keys:e,transactionId:s(this,R)},s(this,O)),this}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));return await s(this,E).MSet({kv:t,transactionId:s(this,R)},s(this,O)),this}async incrBy(e,t){return await s(this,E).IncrBy({key:e,value:t,transactionId:s(this,R)},s(this,O)),this}async expire(e,t){return await s(this,E).Expire({key:e,seconds:t,transactionId:s(this,R)},s(this,O)),this}async expireTime(e){return await s(this,E).ExpireTime({key:e,transactionId:s(this,R)},s(this,O)),this}async zAdd(e,...t){return await s(this,E).ZAdd({key:e,members:t,transactionId:s(this,R)},s(this,O)),this}async zScore(e,t){return await s(this,E).ZScore({key:{key:e,transactionId:s(this,R)},member:t},s(this,O)),this}async zRank(e,t){return await s(this,E).ZRank({key:{key:e,transactionId:s(this,R)},member:t},s(this,O)),this}async zIncrBy(e,t,i){return await s(this,E).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,R)},s(this,O)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,R)};return await s(this,E).ZScan(o,s(this,O)),this}async zCard(e){return await s(this,E).ZCard({key:e,transactionId:s(this,R)},s(this,O)),this}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"&&(o.byScore=!0),await s(this,E).ZRange({key:{key:e,transactionId:s(this,R)},start:t+"",stop:i+"",...o},s(this,O)),this}async zRem(e,t){return await s(this,E).ZRem({key:{key:e,transactionId:s(this,R)},members:t},s(this,O)),this}async zRemRangeByLex(e,t,i){return await s(this,E).ZRemRangeByLex({key:{key:e,transactionId:s(this,R)},min:t,max:i},s(this,O)),this}async zRemRangeByRank(e,t,i){return await s(this,E).ZRemRangeByRank({key:{key:e,transactionId:s(this,R)},start:t,stop:i},s(this,O)),this}async zRemRangeByScore(e,t,i){return await s(this,E).ZRemRangeByScore({key:{key:e,transactionId:s(this,R)},min:t,max:i},s(this,O)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,E).HGetAll({key:e,transactionId:s(this,R)},s(this,O)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,E).HGet({key:e,field:t,transactionId:s(this,R)},s(this,O)),this}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([n,o])=>({field:n,value:o}));return await s(this,E).HSet({key:e,fv:i,transactionId:s(this,R)},s(this,O)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,E).HIncrBy({key:e,field:t,value:i,transactionId:s(this,R)},s(this,O)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,E).HDel({key:e,fields:t,transactionId:s(this,R)},s(this,O)),this}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,R)};return await s(this,E).HScan(o,s(this,O)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,E).HKeys({key:e,transactionId:s(this,R)},s(this,O)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,E).HLen({key:e,transactionId:s(this,R)},s(this,O)),this}};E=new WeakMap,R=new WeakMap,O=new WeakMap;var M,hi,dc=class dc{constructor(e,t=void 0,i=oc.INSTALLATION){l(this,M);l(this,hi);d(this,M,e),d(this,hi,t),this.scope=i,this.global=i===oc.INSTALLATION?new dc(s(this,M),s(this,hi),oc.GLOBAL):this}get storage(){return s(this,hi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new ac(this.storage,t,s(this,M))}async get(e){try{let t=await this.storage.Get({key:e,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return t!==null?t.value??void 0:t}catch(t){if(td(t))return;throw t}}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,M))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,M))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,M))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,M));return n!==null?n.value:n}async setRange(e,t,i){return(await this.storage.SetRange({key:e,offset:t,value:i,scope:this.scope},s(this,M))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,M))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,M))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,M))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,M))).value}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"?o.byScore=!0:(o.offset=0,o.count=0),(await this.storage.ZRange({key:{key:e},start:t+"",stop:i+"",...o,scope:this.scope},s(this,M))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,M))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,M))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,M))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,M))).value}async zScore(e,t){try{let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zRank(e,t){try{let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,M));return n!==null?n.value:n}async mget(e){return this.mGet(e)}async mGet(e){let t=await this.storage.MGet({keys:e,scope:this.scope},s(this,M));return t!==null?t.values.map(i=>i||null):t}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));await this.storage.MSet({kv:t,scope:this.scope},s(this,M))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,M));return t!==null?t.value:t}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.ZScan(o,s(this,M))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,M));return t!==null?t.value:t}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){try{let i=await this.storage.HGet({key:e,field:t,scope:this.scope},{...s(this,M),"throw-redis-nil":{values:["true"]}});return i!==null?i.value??void 0:i}catch(i){if(td(i))return;throw i}}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([o,a])=>({field:o,value:a}));return(await this.storage.HSet({key:e,fv:i,scope:this.scope},s(this,M))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,M));return t!==null?t.fieldValues:t}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return(await this.storage.HDel({key:e,fields:t,scope:this.scope},s(this,M))).value}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.HScan(o,s(this,M))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,M));return t!==null?t.keys:t}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return(await this.storage.HIncrBy({key:e,field:t,value:i,scope:this.scope},s(this,M))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};M=new WeakMap,hi=new WeakMap;var fi=dc;var fr,vi=class{constructor(e){l(this,fr);d(this,fr,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,fr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,fr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,fr))).actions.map(t=>(v(t.request?.action,"Scheduled job is malformed"),"when"in t.request&&t.request.when!=null?{id:t.id,name:t.request.action.type,runAt:t.request.when,data:t.request.action.data}:{id:t.id,name:t.request.action.type,cron:t.request.cron??"",data:t.request.action}))}};fr=new WeakMap;var os,yi=class{constructor(e){l(this,os);d(this,os,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,os));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...Yv(t.installationSettings.settings,u.installationSettings),...Yv(t.appSettings.settings,u.appSettings)}}};os=new WeakMap;function Yv(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=tc(r[n]),i),{});return e&&ey(t,e),t}function ey(r,e){for(let t of e)t.type==="group"?ey(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as lc,Form as sT,ToastAppearance as ty}from"@devvit/protos";var vr,bi,rd=class{constructor(e){l(this,vr,[]);l(this,bi);d(this,bi,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,bi)){let a=s(this,bi).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=sT.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});pr(n.fields),o.fields=mt(n.fields),s(this,vr).push({type:lc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?ty.SUCCESS:ty.NEUTRAL}:t={text:e},s(this,vr).push({type:lc.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,vr).push({type:lc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,vr)}};vr=new WeakMap,bi=new WeakMap;function Ue({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new fi(r),c=jv(a,i?i.state:{}),p=new gi(r),g=new vi(r),f=new yi(r),m=e?new rd(i):void 0,b=new ci(r),y=new di,P=new pi(r),C=t&&i?Ev(i):void 0,T=t&&i?Av(i):void 0,B=t&&i?Tv(i):void 0,me=t&&i?Iv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:f,media:b,assets:y,realtime:P,get useForm(){return B??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return C??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return T??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return me??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var ry={name:"@devvit/public-api",version:"0.11.1-dev",license:"BSD-3-Clause",repository:{type:"git",url:"https://developers.reddit.com/"},type:"module",exports:{".":"./dist/index.js","./package.json":"./package.json","./*":"./dist/*"},main:"./dist/index.js",files:["dist/**"],scripts:{build:"yarn build:icon-types && yarn build:semantic-colors && tsc && cp -af devvit.tsconfig.json dist/ && yarn build:types && yarn build:min && yarn build:unmin","build:icon-types":"make-icons src/types/icons.ts","build:min":"esbuild --bundle --sourcemap=linked --target=es2020 --format=esm --metafile=dist/meta.min.json --outfile=dist/public-api.min.js --external:@devvit/protos --minify src/index.ts","build:semantic-colors":"node scripts/make-semantic-colors.js","build:types":"api-extractor run && sed -ne '/declare global {/,$ p' src/devvit/Devvit.ts >> dist/public-api.d.ts","build:unmin":"esbuild --bundle --sourcemap=inline --target=es2020 --format=iife --metafile=dist/meta.json --outfile=dist/public-api.iife.js --global-name=devvitPublicAPI src/index.ts",clean:"rm -rf .turbo api-extractor coverage dist src/devvit/internals/semanticColors.ts src/types/icons.ts || :",clobber:"yarn clean && rm -rf node_modules",dev:"tsc -w","dev:build":"chokidar ./src --command 'yarn build' --ignore './src/types/icons.ts' --ignore './src/devvit/internals/semanticColors.ts'",lint:"redlint .","lint:fix":"yarn lint --fix",prepublishOnly:"publish-package-json",test:"yarn test:unit && yarn test:types && yarn test:size","test:size":"filesize","test:types":"tsc --noEmit","test:unit":"vitest run","test:unit-with-coverage":"vitest run --coverage"},types:"./dist/index.d.ts",dependencies:{"@devvit/protos":"0.11.1-dev","@devvit/shared-types":"0.11.1-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/repo-tools":"0.11.1-dev","@devvit/tsconfig":"0.11.1-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"18.0.1","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"9.11.1",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"77 KB",none:"253 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[L.Subreddit]?.values[0];v(i,"subreddit is missing from Context");let n=r[L.SubredditName]?.values[0],o=r[L.AppUser]?.values[0],a=r[L.App]?.values[0],c=r[L.Version]?.values[0],p=r[L.User]?.values[0],g=aT(r);return{get appAccountId(){return v(o,"appAccountId is missing from Context"),o},subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,appName:a,appVersion:c,debug:g,toJSON(){return{appAccountId:o,appName:a,appVersion:c,subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,debug:g}}}}function aT(r){let e={blocks:void 0,emitSnapshots:void 0,emitState:void 0,realtime:void 0,runtime:void 0,surface:void 0,useAsync:void 0,payments:void 0,bootstrap:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[L.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||"true"))}return r[L.Debug]&&console.info(`[api] @devvit/public-api v${ry.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function iy(r){return r.flatMap(e=>e.type==="group"?iy(e.fields):e)}async function id(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Ft(r.fieldValues),o=iy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,f=Object.assign(Ue({metadata:t}),le(t)),m=await g({value:p,isEditing:r.editing},f);m&&(i.success=!1,i.errors[c]=m)}})),dT.fromJSON(i)}async function cT(){if(!u.appSettings)throw new Error("App settings were not defined.");return uT.fromJSON({fields:{fields:mt(u.appSettings)}})}async function mT(r,e){return id(r,u.appSettings,e)}function ny(r){r.provides(lT),U("GetAppSettingsFields",cT),U("ValidateAppForm",mT)}import{CustomPostDefinition as bT,RenderPostResponse as kT}from"@devvit/protos";import{BlockRenderEventType as Cc,EffectType as by}from"@devvit/protos";function ki(r){return r.__effects}function sy(){let r=new Set;return e=>{let t=e,i=1;for(;r.has(t);)t=`${e}.${i++}`;return r.add(t),t}}import{BlockActionType as Pc,BlockAvatarBackground as hy,BlockAvatarFacing as fy,BlockAvatarSize as Et,BlockBorderWidth as ad,BlockButtonAppearance as Rt,BlockButtonSize as gc,BlockGap as dd,BlockHorizontalAlignment as hc,BlockIconSize as ld,BlockImageResizeMode as as,BlockPadding as ds,BlockRadius as ls,BlockSpacerShape as fc,BlockSpacerSize as ud,BlockStackDirection as vc,BlockTextOutline as yc,BlockTextOverflow as bc,BlockTextSize as Pi,BlockTextStyle as kc,BlockTextWeight as vy,BlockType as tt,BlockVerticalAlignment as Sc}from"@devvit/protos";var uc={"alienblue-100":"#DCE2FB","alienblue-200":"#B8C5FC","alienblue-25":"#F7F8FD","alienblue-300":"#90A9FD","alienblue-400":"#648EFC","alienblue-50":"#EEF0FB","alienblue-500":"#1870F4","alienblue-600":"#115BCA","alienblue-700":"#0A449B","alienblue-75":"#E6E9FB","alienblue-800":"#0A2F6C","alienblue-900":"#0A1A3F","alienblue-950":"#07102B","berrypurple-100":"#F3DAFB","berrypurple-200":"#EAB3FD","berrypurple-25":"#FBF6FD","berrypurple-300":"#DE8BFF","berrypurple-400":"#CF5FFF","berrypurple-50":"#F8EDFC","berrypurple-500":"#BC0EFF","berrypurple-600":"#9B00D4","berrypurple-700":"#7600A3","berrypurple-75":"#F6E4FB","berrypurple-800":"#520472","berrypurple-900":"#300643","berrypurple-950":"#20042A",black:"#000000","black-opacity-0":"#00000000","black-opacity-10":"#00000019","black-opacity-15":"#00000026","black-opacity-20":"#00000033","black-opacity-25":"#0000003F","black-opacity-33":"#00000054","black-opacity-5":"#0000000C","black-opacity-50":"#0000007F","black-opacity-60":"#00000099","black-opacity-67":"#000000AA","black-opacity-80":"#000000CC","black-opacity-90":"#000000E5","brown-100":"#F1DFCF","brown-200":"#E9BE95","brown-25":"#FBF7F4","brown-300":"#DC9D5D","brown-400":"#BA854E","brown-50":"#F7EFE9","brown-500":"#9A6D3F","brown-600":"#7B5631","brown-700":"#5D4023","brown-75":"#F4E7DC","brown-800":"#3F2C19","brown-900":"#221A11","brown-950":"#15100A","coolgray-100":"#DBE4E9","coolgray-150":"#C9D7DE","coolgray-200":"#B7CAD4","coolgray-25":"#F6F8F9","coolgray-250":"#A4BDCA","coolgray-300":"#97AFBC","coolgray-350":"#8BA2AD","coolgray-400":"#7F949F","coolgray-450":"#748791","coolgray-50":"#EEF1F3","coolgray-500":"#667780","coolgray-525":"#576F76","coolgray-550":"#5C6C74","coolgray-600":"#536168","coolgray-650":"#48545B","coolgray-700":"#3D494E","coolgray-75":"#E5EBEE","coolgray-750":"#333D42","coolgray-800":"#2A3236","coolgray-850":"#21272A","coolgray-900":"#181C1F","coolgray-950":"#0E1113","global-black":{light:"#000000",dark:"#000000"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-white":{light:"#FFFFFF",dark:"#FFFFFF"},"kiwigreen-100":"#A8F5A0","kiwigreen-200":"#58E15B","kiwigreen-25":"#EBFDE7","kiwigreen-300":"#00C61C","kiwigreen-400":"#01A816","kiwigreen-50":"#DDF8D7","kiwigreen-500":"#008A10","kiwigreen-600":"#016E0B","kiwigreen-700":"#005306","kiwigreen-75":"#CAF5C2","kiwigreen-800":"#033902","kiwigreen-900":"#0D2005","kiwigreen-950":"#081404","lightblue-100":"#CAE7FB","lightblue-200":"#87D0FD","lightblue-25":"#F3F9FD","lightblue-300":"#02B9FB","lightblue-400":"#029DD5","lightblue-50":"#E6F3FC","lightblue-500":"#007FAE","lightblue-600":"#01668D","lightblue-700":"#014D6B","lightblue-75":"#D9EDFB","lightblue-800":"#03354B","lightblue-900":"#051E2B","lightblue-950":"#04131A","lime-100":"#B7F28E","lime-200":"#90DA58","lime-25":"#EEFDDC","lime-300":"#6DBF01","lime-400":"#5BA200","lime-50":"#E0F8C8","lime-500":"#4A8500","lime-600":"#3A6A00","lime-700":"#2A5000","lime-75":"#CEF5AD","lime-800":"#1E3702","lime-900":"#151E05","lime-950":"#0D1304","mintgreen-100":"#9BF5D9","mintgreen-200":"#00E2B7","mintgreen-25":"#E7FDF5","mintgreen-300":"#00C29D","mintgreen-400":"#01A484","mintgreen-50":"#D7F8EC","mintgreen-500":"#01876D","mintgreen-600":"#006C56","mintgreen-700":"#015140","mintgreen-75":"#C0F5E3","mintgreen-800":"#00382B","mintgreen-900":"#032019","mintgreen-950":"#03140F","orangered-100":"#FCDBCF","orangered-200":"#FDB498","orangered-25":"#FDF6F4","orangered-300":"#FF895D","orangered-400":"#FF4500","orangered-50":"#FCEEE8","orangered-500":"#D93900","orangered-600":"#AE2C00","orangered-700":"#842100","orangered-75":"#FBE5DC","orangered-800":"#591B02","orangered-900":"#2F1405","orangered-950":"#1C0D04","periwinkle-100":"#E6DFFB","periwinkle-200":"#CDBEFD","periwinkle-25":"#F9F7FD","periwinkle-300":"#B29FFF","periwinkle-400":"#9580FF","periwinkle-50":"#F2EFFC","periwinkle-500":"#6A5CFF","periwinkle-600":"#523DFF","periwinkle-700":"#4001EA","periwinkle-75":"#ECE7FB","periwinkle-800":"#250AA6","periwinkle-900":"#160E5B","periwinkle-950":"#0C083F","poopbrown-100":"#FEEEDD","poopbrown-200":"#F6DDC3","poopbrown-300":"#EECCAA","poopbrown-400":"#CAA075","poopbrown-50":"#FEF7EE","poopbrown-500":"#9A6D3F","poopbrown-600":"#6E4924","poopbrown-700":"#54371A","poopbrown-800":"#3B2510","poopbrown-900":"#29190A","poopbrown-950":"#110B04","puregray-100":"#F2F2F2","puregray-150":"#EBEBEB","puregray-200":"#E4E4E4","puregray-250":"#DDDDDD","puregray-300":"#D6D6D6","puregray-350":"#C3C3C3","puregray-400":"#ACACAC","puregray-450":"#919191","puregray-50":"#F8F8F8","puregray-500":"#767676","puregray-550":"#5C5C5C","puregray-600":"#434343","puregray-650":"#393939","puregray-700":"#303030","puregray-750":"#272727","puregray-800":"#1E1E1E","puregray-850":"#181818","puregray-900":"#131313","puregray-950":"#080808","red-100":"#FBDBD4","red-200":"#FDB3A4","red-25":"#FDF6F5","red-300":"#FF8773","red-400":"#FF4F40","red-50":"#FCEEEA","red-500":"#EB001F","red-600":"#BC0117","red-700":"#90000F","red-75":"#FBE4DF","red-800":"#650405","red-900":"#340F05","red-950":"#1F0B04","sakurapink-100":"#FBD9EB","sakurapink-200":"#FDAEDA","sakurapink-25":"#FDF6F9","sakurapink-300":"#FF7ECA","sakurapink-400":"#FF38BB","sakurapink-50":"#FCEDF4","sakurapink-500":"#DE019F","sakurapink-600":"#B2007F","sakurapink-700":"#880060","sakurapink-75":"#FBE3EF","sakurapink-800":"#5F0443","sakurapink-900":"#380626","sakurapink-950":"#250419",transparent:"transparent",white:"#ffffff","white-opacity-0":"#FFFFFF00","white-opacity-10":"#FFFFFF19","white-opacity-15":"#FFFFFF26","white-opacity-20":"#FFFFFF33","white-opacity-25":"#FFFFFF3F","white-opacity-5":"#FFFFFF0C","white-opacity-50":"#FFFFFF7F","yellow-100":"#FFE284","yellow-200":"#FFBF0B","yellow-25":"#FFF9E0","yellow-300":"#D8A100","yellow-400":"#B78800","yellow-50":"#FFF3C0","yellow-500":"#977000","yellow-600":"#785800","yellow-700":"#5B4200","yellow-75":"#FFEAA2","yellow-800":"#3F2D00","yellow-900":"#231A03","yellow-950":"#161003","yelloworange-100":"#FCDCC8","yelloworange-200":"#FDB586","yelloworange-25":"#FDF7F3","yelloworange-300":"#FF8A35","yelloworange-400":"#E46C00","yelloworange-50":"#FCEEE6","yelloworange-500":"#BD5800","yelloworange-600":"#974500","yelloworange-700":"#733300","yelloworange-75":"#FBE5D7","yelloworange-800":"#4E2402","yelloworange-900":"#2A1705","yelloworange-950":"#1A0E04","action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"action-upvote":{light:"#D93900",dark:"#D93900"},"ai-background-weaker":{light:"#E7FDF5",dark:"#00382B"},"ai-plain":{light:"#006C56",dark:"#01A484"},"ai-plain-hover":{light:"#015140",dark:"#00C29D"},"alert-caution":{light:"#977000",dark:"#977000"},"avatar-gradient":{light:"",dark:""},"brand-background":{light:"#D93900",dark:"#D93900"},"brand-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"category-live":{light:"#D93900",dark:"#D93900"},"category-nsfw":{light:"#DE019F",dark:"#DE019F"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"caution-background":{light:"#FFBF0B",dark:"#D8A100"},"caution-background-hover":{light:"#D8A100",dark:"#FFBF0B"},"caution-onBackground":{light:"#000000",dark:"#000000"},"caution-plain":{light:"#785800",dark:"#FFBF0B"},"caution-plain-hover":{light:"#5B4200",dark:"#FFE284"},"danger-background":{light:"#EB001F",dark:"#BC0117"},"danger-background-disabled":{light:"#FDB3A4",dark:"#340F05"},"danger-background-hover":{light:"#BC0117",dark:"#EB001F"},"danger-background-weaker":{light:"#FBDBD4",dark:"#650405"},"danger-content":{light:"#BC0117",dark:"#FF4F40"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"danger-content-hover":{light:"#90000F",dark:"#FF8773"},"danger-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"danger-plain":{light:"#BC0117",dark:"#FF8773"},"danger-plain-hover":{light:"#90000F",dark:"#FDB3A4"},"downvote-background":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-background-disabled":{light:"#6a5cff4d",dark:"#6a5cff4d"},"downvote-background-hover":{light:"#523DFF",dark:"#523DFF"},"downvote-content":{light:"#523DFF",dark:"#9580FF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#523DFF4c",dark:"#9580FF4c"},"downvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"downvote-onStrongScrim":{light:"#B29FFF",dark:"#B29FFF"},"downvote-onStrongScrim-disabled":{light:"#b29fff4d",dark:"#b29fff4d"},"downvote-onStrongScrim-weaker":{light:"#9580FF",dark:"#9580FF"},"downvote-plain":{light:"#523DFF",dark:"#9580FF"},"downvote-plain-disabled":{light:"#523dff4d",dark:"#9580ff4d"},"downvote-plain-weaker":{light:"#6A5CFF",dark:"#6A5CFF"},"elevation-large1":{light:"#0000003F",dark:"#0000007F"},"elevation-large2":{light:"#00000026",dark:"#00000033"},"elevation-medium1":{light:"#0000003F",dark:"#0000007F"},"elevation-medium2":{light:"#00000019",dark:"#00000033"},"elevation-small":{light:"#00000026",dark:"#00000054"},"elevation-xsmall":{light:"#0000003F",dark:"#000000AA"},favorite:{light:"#977000",dark:"#B78800"},"global-admin":{light:"#D93900",dark:"#D93900"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#2A3236",dark:"#2A3236"},"global-focus":{light:"#029DD5",dark:"#007FAE"},"global-gold":{light:"#B78800",dark:"#D8A100"},"global-moderator":{light:"#008A10",dark:"#008A10"},"global-nsfw":{light:"#DE019F",dark:"#DE019F"},"global-offline":{light:"#667780",dark:"#667780"},"global-online":{light:"#00C61C",dark:"#00C61C"},"global-orangered":{light:"#FF4500",dark:"#FF4500"},"global-stars":{light:"#977000",dark:"#D8A100"},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"identity-admin":{light:"#D93900",dark:"#D93900"},"identity-coins":{light:"#B78800",dark:"#B78800"},"identity-moderator":{light:"#008A10",dark:"#008A10"},"identity-self":{light:"#01876D",dark:"#01876D"},"interactive-background-disabled":{light:"#0000000C",dark:"#FFFFFF0C"},"interactive-content-disabled":{light:"#0000003F",dark:"#FFFFFF3F"},"interactive-focused":{light:"#007FAE",dark:"#007FAE"},"interactive-pressed":{light:"#00000026",dark:"#FFFFFF26"},"inverted-interactive-background-disabled":{light:"#FFFFFF0C",dark:"#0000000C"},"inverted-interactive-content-disabled":{light:"#FFFFFF3F",dark:"#0000003F"},"inverted-interactive-pressed":{light:"#FFFFFF26",dark:"#00000026"},"inverted-neutral-background":{light:"#0E1113",dark:"#FFFFFF"},"inverted-neutral-background-hover":{light:"#181C1F",dark:"#F6F8F9"},"inverted-neutral-border":{light:"#FFFFFF33",dark:"#00000033"},"inverted-neutral-content":{light:"#B7CAD4",dark:"#333D42"},"inverted-neutral-content-strong":{light:"#EEF1F3",dark:"#181C1F"},"inverted-secondary-background":{light:"#2A3236",dark:"#E5EBEE"},"inverted-secondary-background-hover":{light:"#333D42",dark:"#DBE4E9"},"inverted-secondary-background-selected":{light:"#3D494E",dark:"#C9D7DE"},"inverted-secondary-onBackground":{light:"#FFFFFF",dark:"#000000"},"inverted-secondary-plain":{light:"#DBE4E9",dark:"#181C1F"},"inverted-secondary-plain-hover":{light:"#FFFFFF",dark:"#000000"},"media-background":{light:"#00000099",dark:"#00000099"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"media-border-selected":{light:"#FFFFFF",dark:"#FFFFFF"},"media-border-weak":{light:"#FFFFFF19",dark:"#FFFFFF19"},"media-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"media-onBackground-disabled":{light:"#FFFFFF3F",dark:"#FFFFFF3F"},"media-onBackground-weak":{light:"#E5EBEE",dark:"#E5EBEE"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-onbackground-weak":{light:"#B7CAD4",dark:"#B7CAD4"},"neutral-background":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-container":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-container-hover":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong-hover":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-gilded":{light:"#FFF9E0",dark:"#181C1F"},"neutral-background-gilded-hover":{light:"#FFF3C0",dark:"#21272A"},"neutral-background-hover":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-pinned":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-selected":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-strong":{light:"#FFFFFF",dark:"#181C1F"},"neutral-background-strong-hover":{light:"#F6F8F9",dark:"#21272A"},"neutral-background-weak":{light:"#F6F8F9",dark:"#000000"},"neutral-background-weak-hover":{light:"#EEF1F3",dark:"#0E1113"},"neutral-border":{light:"#00000033",dark:"#FFFFFF33"},"neutral-border-medium":{light:"#0000007F",dark:"#FFFFFF7F"},"neutral-border-strong":{light:"#181C1F",dark:"#F6F8F9"},"neutral-border-weak":{light:"#00000019",dark:"#FFFFFF19"},"neutral-content":{light:"#333D42",dark:"#B7CAD4"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-strong":{light:"#181C1F",dark:"#EEF1F3"},"neutral-content-weak":{light:"#5C6C74",dark:"#8BA2AD"},offline:{light:"#767676",dark:"#767676"},online:{light:"#01A816",dark:"#01A816"},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},"opacity-highlight":{light:"",dark:""},pizzaRed:{light:"#ef5350",dark:"#c62828"},primary:{light:"#115BCA",dark:"#648EFC"},"primary-background":{light:"#0A449B",dark:"#115BCA"},"primary-background-hover":{light:"#0A2F6C",dark:"#1870F4"},"primary-background-selected":{light:"#0A1A3F",dark:"#648EFC"},"primary-border":{light:"#0A449B",dark:"#648EFC"},"primary-border-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-hover":{light:"#0A449B",dark:"#90A9FD"},"primary-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"primary-onBackground-selected":{light:"#FFFFFF",dark:"#000000"},"primary-plain":{light:"#0A449B",dark:"#648EFC"},"primary-plain-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-plain-visited":{light:"#7600A3",dark:"#CF5FFF"},"primary-visited":{light:"#9B00D4",dark:"#CF5FFF"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-background":{light:"#00000099",dark:"#00000099"},"scrim-background-strong":{light:"#000000CC",dark:"#000000CC"},"scrim-gradient":{light:"",dark:""},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},secondary:{light:"#21272A",dark:"#DBE4E9"},"secondary-background":{light:"#E5EBEE",dark:"#2A3236"},"secondary-background-hover":{light:"#DBE4E9",dark:"#333D42"},"secondary-background-selected":{light:"#C9D7DE",dark:"#3D494E"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-onBackground":{light:"#000000",dark:"#FFFFFF"},"secondary-plain":{light:"#181C1F",dark:"#DBE4E9"},"secondary-plain-hover":{light:"#000000",dark:"#FFFFFF"},"secondary-plain-weak":{light:"#5C6C74",dark:"#8BA2AD"},"secondary-weak":{light:"#576F76",dark:"#748791"},"success-background":{light:"#008A10",dark:"#016E0B"},"success-background-hover":{light:"#016E0B",dark:"#008A10"},"success-content":{light:"#016E0B",dark:"#01A816"},"success-hover":{light:"#005306",dark:"#00C61C"},"success-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"success-plain":{light:"#016E0B",dark:"#00C61C"},"success-plain-hover":{light:"#005306",dark:"#58E15B"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"transparent-background-hover":{light:"#74879119",dark:"#66778019"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#FFFFFF",dark:"#181C1F"},"upvote-background":{light:"#D93900",dark:"#D93900"},"upvote-background-disabled":{light:"#d939004d",dark:"#d939004d"},"upvote-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"upvote-content":{light:"#AE2C00",dark:"#FF4500"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#AE2C004c",dark:"#FF45004c"},"upvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"upvote-onStrongScrim":{light:"#FF895D",dark:"#FF895D"},"upvote-onStrongScrim-disabled":{light:"#ff895d4d",dark:"#ff895d4d"},"upvote-onStrongScrim-weaker":{light:"#FF4500",dark:"#FF4500"},"upvote-plain":{light:"#AE2C00",dark:"#FF895D"},"upvote-plain-disabled":{light:"#ae2c004d",dark:"#ff895d4d"},"upvote-plain-weaker":{light:"#FF4500",dark:"#FF4500"},"warning-background":{light:"#B78800",dark:"#B78800"},"warning-background-hover":{light:"#977000",dark:"#D8A100"},"warning-content":{light:"#785800",dark:"#B78800"},"warning-content-hover":{light:"#5B4200",dark:"#D8A100"},"warning-onBackground":{light:"#000000",dark:"#000000"}};var oy={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",transparent:"#FFFFFF00",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},ay=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),dy=r=>r in uc,cc=r=>r in oy,ly=r=>!!r.match(/^rgba?\(.*/),uy=r=>!!r.match(/^hsla?\(.*/),cy=(r,e="light")=>{if(cc(r))return nd(r);let i=uc[r];return typeof i=="string"?i:i[e]},nd=r=>oy[r]??r,my=r=>{let[e,t,i,n]=r.replace(/^rgba?\(|\s+|\)$/g,"").split(",");if(!e||!t||!i)return r;let a=[...[e,t,i].map(p=>parseFloat(p))];if(n){let p=parseFloat(n),g=Math.round(p*255);a.push(g)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as sd}from"@devvit/protos";var mc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:sd.UNRECOGNIZED,alignment:void 0}};function gy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=pT(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||py(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||py(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function py(r,e,t,i){return e===r&&i||t===r&&i}function pT(r,e,t){let i=e===sd.STACK_VERTICAL||e===sd.UNRECOGNIZED,n=e===sd.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,g=0;return n&&p?g=2:i&&p&&(g=1),{growDirection:o,stretchDirection:g}}import{BlockSizeUnit as yr,BlockStackDirection as od}from"@devvit/protos";function Si(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:yr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=yr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=yr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function gT(r,e){return(r.width?.value?.unit===yr.SIZE_UNIT_PERCENT||r.width?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_HORIZONTAL||e.direction===od.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===yr.SIZE_UNIT_PERCENT||r.height?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_VERTICAL||e.direction===od.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function pc(r,e){if(r){let t=r.width!=null||r.minWidth!=null||r.maxWidth!=null,i=r.height!=null||r.minHeight!=null||r.maxHeight!=null;if(t||i||r.grow!=null){let n={width:t?{value:Si(r.width),min:Si(r.minWidth),max:Si(r.maxWidth)}:void 0,height:i?{value:Si(r.height),min:Si(r.minHeight),max:Si(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=gT(n,e.stackParentLayout)),n}}}var yy="data-",hT=new Set(["onPress","onMessage"]),fT=new Map([["onPress",Pc.ACTION_CLICK],["onMessage",Pc.ACTION_WEBVIEW]]),us,Ci=class{constructor(e=()=>{}){l(this,us);d(this,us,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},mc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return ds.PADDING_NONE;case"xsmall":return ds.PADDING_XSMALL;case"small":return ds.PADDING_SMALL;case"medium":return ds.PADDING_MEDIUM;case"large":return ds.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return ls.RADIUS_NONE;case"small":return ls.RADIUS_SMALL;case"medium":return ls.RADIUS_MEDIUM;case"large":return ls.RADIUS_LARGE;case"full":return ls.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return dd.GAP_NONE;case"small":return dd.GAP_SMALL;case"medium":return dd.GAP_MEDIUM;case"large":return dd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Sc.ALIGN_TOP:e.includes("middle")?t=Sc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Sc.ALIGN_BOTTOM),e.includes("start")?i=hc.ALIGN_START:e.includes("center")?i=hc.ALIGN_CENTER:e.includes("end")&&(i=hc.ALIGN_END),t!==void 0||i!==void 0)return{vertical:t,horizontal:i}}makeBlockBorder(e,t,i,n){if(!e&&!t)return;let o;switch(e){case"none":o=ad.BORDER_WIDTH_NONE;break;case"thin":o=ad.BORDER_WIDTH_THIN;break;case"thick":o=ad.BORDER_WIDTH_THICK;break;default:o=ad.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",c=this.getThemedColors(a,i,n);return{width:o,color:c?.light,colors:c}}makeBlockTextSize(e){switch(e){case"xsmall":return Pi.TEXT_SIZE_XSMALL;case"small":return Pi.TEXT_SIZE_SMALL;case"medium":return Pi.TEXT_SIZE_MEDIUM;case"large":return Pi.TEXT_SIZE_LARGE;case"xlarge":return Pi.TEXT_SIZE_XLARGE;case"xxlarge":return Pi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return kc.TEXT_STYLE_BODY;case"metadata":return kc.TEXT_STYLE_METADATA;case"heading":return kc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return yc.TEXT_OUTLINE_NONE;case"thin":return yc.TEXT_OUTLINE_THIN;case"thick":return yc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return vy.TEXT_WEIGHT_REGULAR;case"bold":return vy.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return bc.TEXT_OVERFLOW_CLIP;case"ellipsis":return bc.TEXT_OVERFLOW_ELLIPSE}return bc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Rt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Rt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Rt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Rt.BUTTON_APPEARANCE_BORDERED;case"media":return Rt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Rt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Rt.BUTTON_APPEARANCE_CAUTION;case"success":return Rt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return gc.BUTTON_SIZE_SMALL;case"medium":return gc.BUTTON_SIZE_MEDIUM;case"large":return gc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return as.IMAGE_RESIZE_NONE;case"fit":return as.IMAGE_RESIZE_FIT;case"fill":return as.IMAGE_RESIZE_FILL;case"cover":return as.IMAGE_RESIZE_COVER;case"scale-down":return as.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return ud.SPACER_XSMALL;case"small":return ud.SPACER_SMALL;case"medium":return ud.SPACER_MEDIUM;case"large":return ud.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return fc.SPACER_INVISIBLE;case"thin":return fc.SPACER_THIN;case"square":return fc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return ld.ICON_SIZE_XSMALL;case"small":return ld.ICON_SIZE_SMALL;case"medium":return ld.ICON_SIZE_MEDIUM;case"large":return ld.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Et.AVATAR_SIZE_XXSMALL;case"xsmall":return Et.AVATAR_SIZE_XSMALL;case"small":return Et.AVATAR_SIZE_SMALL;case"medium":return Et.AVATAR_SIZE_MEDIUM;case"large":return Et.AVATAR_SIZE_LARGE;case"xlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxlarge":return Et.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Et.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return fy.AVATAR_FACING_LEFT;case"right":return fy.AVATAR_FACING_RIGHT}}makeBlockAvatarBackground(e){switch(e){case"dark":return hy.AVATAR_BG_DARK;case"light":return hy.AVATAR_BG_LIGHT}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(yy)).reduce((t,i)=>(t[i.substring(yy.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return hT.forEach(o=>{if(o in t){let a=t[o];i.push({type:fT.get(o)??Pc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),ay(e)?e:dy(e)?cy(e,t):cc(e)?nd(e):ly(e)?my(e):uy(e)?e:(console.warn(`Could not parse color: ${e}.`),nd("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,us).call(this)?.getURL(e,t)??e}childrenToString(e){return e.map(t=>t.toString()).join("")}makeRoot(e,...t){return this.wrapRoot(e,this.childrenToBlocks(t,mc))}wrapRoot(e,t){return this.makeBlock(tt.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=pc(t,i),p=gy(t,i.stackParentLayout,c);return this.makeBlock(tt.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(vc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(vc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(vc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(tt.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(tt.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(tt.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(tt.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(tt.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(tt.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeWebView(e,t){return e&&this.makeBlock(tt.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:pc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===tt.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};us=new WeakMap;function ky(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Sy=r=>{let e="",t=r.props?Object.keys(r.props).map(i=>i==="onPress"?"":`${i}="${r.props[i]}"`).join(" "):"";e+=`<${r.type}${t?" "+t:""}>`;for(let i of r.children)typeof i=="string"?e+=i:e+=Sy(i);return e+=`</${r.type}>`,e};function vT(r){return" ".repeat(r)}function yT(r){let e="",t=0,i=r.split(/>\s*</);for(let n=0;n<i.length;n++){let o=i[n];n===0&&(o=o.trim()),n===i.length-1&&(o=o.trim());let a=o.charAt(0)==="/";a&&t--,e+=vT(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
2
  `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var Le,Py,cs,wc,ms,pt=class{constructor(e,t,i,n,o){l(this,Le);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new Ci(()=>this.assets);this.effects=[];l(this,ms,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Ue({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,Le,cs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(ky(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,Le,Py).call(this)}async buildBlocksUI(){let e=S(this,Le,cs).call(this),t={type:this.component,props:e,children:[]},i=await this.renderElement(e,t);return this.transformer.ensureRootBlock(i)}async renderElement(e,t){let i=await this.processBlock(t);return ky(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(yT(Sy(i))),(u.debug.emitState||e.debug.emitState)&&console.debug(JSON.stringify(this.state,void 0,2)),this.transformer.createBlocksElementOrThrow(i)}async processProps(e){let t=e.props??{},i=["onPress","onMessage"];for(let n of i)if(n in t){let o=t[n],a=o?.name,c=this.makeUniqueActionID(`${e.type}.${a??n}`);this.actions.set(c,o),t[n]=c}}async processBlock(e,t=sy(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let b=n.children[m];b!=null&&c.push(await this.processBlock(b,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),g=S(this,Le,wc).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:g}}if(typeof n.type=="function"){let c=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(c),this.renderState[c]||(this.renderState[c]={});let p=n.children.flatMap(m=>m),g={...S(this,Le,cs).call(this),...n.props,children:p},f;for(;f===void 0;)try{f=await n.type(g,S(this,Le,cs).call(this))}catch(m){if(m instanceof Promise)f=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof f=="object")return this.processBlock(f,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===Cc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Cc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Cc.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,ms)||(d(this,ms,!0),this.effects.push({type:by.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:e/1e3}}))}addRealtimeChannel(e){this.realtimeChannels.push(e),this.realtimeUpdated=!0}removeRealtimeChannel(e){this.realtimeChannels=this.realtimeChannels.filter(t=>t!==e),this.realtimeUpdated=!0}get realtimeEffect(){return this.realtimeUpdated&&this.realtimeChannels.length>0?[{type:by.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...ki(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};Le=new WeakSet,Py=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},cs=function(){let e={...le(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[L.Timezone]?.values[0],locale:this.metadata[L.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},wc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,Le,wc).call(this,i.children)):t.push(i);return t},ms=new WeakMap;async function ST(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new pt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return kT.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function Cy(r){r.provides(bT),U("RenderPost",ST)}import{GetFieldsResponse as PT,InstallationSettingsDefinition as CT}from"@devvit/protos";async function wT(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return PT.fromJSON({fields:{fields:mt(u.installationSettings)}})}async function xT(r,e){return id(r,u.installationSettings,e)}function wy(r){r.provides(CT),U("GetSettingsFields",wT),U("ValidateForm",xT)}import{ContextActionDefinition as FT,ContextActionList as IT,ContextActionResponse as TT}from"@devvit/protos";var xy=r=>`menuItem.${r}`;function xc(r){return u.menuItems.find((e,t)=>xy(t)===r)}async function AT(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:xy(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),member:n.forUserType?.includes("member"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}));return IT.fromJSON({actions:i})}async function ET(r,e){let t=xc(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;v(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Ue({ui:!0,metadata:e}),le(e,n,i),{uiEnvironment:{timezone:e[L.Timezone]?.values[0],locale:e[L.Language]?.values[0]}});return await t.onPress(c,p),TT.fromJSON({effects:ki(p.ui)})}function Fy(r){r.provides(FT),U("GetActions",AT),U("OnAction",ET)}function gt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as RT}from"@devvit/protos";async function OT(r,e){let t=r.type,i=u.scheduledJobHandlers.get(t);if(!i)throw new Error(`Job ${t} not found`);let n={name:t,data:r.data},o=Object.assign(Ue({metadata:e}),le(e));await i(n,o)}function Iy(r){r.provides(RT),U("HandleScheduledAction",OT)}import{HandlerResult as BT,OnAppInstallDefinition as MT,OnAppUpgradeDefinition as UT,OnCommentCreateDefinition as LT,OnCommentDeleteDefinition as DT,OnCommentReportDefinition as NT,OnCommentSubmitDefinition as _T,OnCommentUpdateDefinition as HT,OnModActionDefinition as qT,OnModMailDefinition as jT,OnPostCreateDefinition as WT,OnPostDeleteDefinition as GT,OnPostFlairUpdateDefinition as VT,OnPostNsfwUpdateDefinition as zT,OnPostReportDefinition as JT,OnPostSpoilerUpdateDefinition as $T,OnPostSubmitDefinition as KT,OnPostUpdateDefinition as XT}from"@devvit/protos";var wi;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o,a="stack"){return o instanceof Error?`${o[a]||o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(wi||(wi={}));function te(r,e){return v(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Ue({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=ZT(a);if(c)throw c.err;return BT.fromPartial({})}}function Ty(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(KT),U("OnPostSubmit",te("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(WT),U("OnPostCreate",te("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(XT),U("OnPostUpdate",te("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(JT),U("OnPostReport",te("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(GT),U("OnPostDelete",te("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(VT),U("OnPostFlairUpdate",te("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(_T),U("OnCommentSubmit",te("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(LT),U("OnCommentCreate",te("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(HT),U("OnCommentUpdate",te("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(NT),U("OnCommentReport",te("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(DT),U("OnCommentDelete",te("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(MT),U("OnAppInstall",te("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(UT),U("OnAppUpgrade",te("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(qT),U("OnModAction",te("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(jT),U("OnModMail",te("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(zT),U("OnPostNsfwUpdate",te("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides($T),U("OnPostSpoilerUpdate",te("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function ZT(r){let e=r.reduce((t,i)=>i.status==="rejected"?[...t,i.reason]:t,[]);if(e.length!==0)return e.length===1?{err:e[0]}:{err:new Error(e.map(t=>wi.caughtToString(t)).join(`
3
3
  `))}}import{EffectType as XE,HandleUIEventResponse as Hc,UIEventHandlerDefinition as ZE}from"@devvit/protos";var Sb=Mn(Hy(),1),Pb=Mn(_c(),1);async function QE(r,e){let t=r.state??{},i=(0,Sb.default)(t),n=Ue({ui:!0,metadata:e});if(r.event?.formSubmitted&&r.event.formSubmitted.formId){let p=r.event.formSubmitted.formId;if(p.includes("form.hook.")&&u.customPostType){let y=new pt((P,C)=>u.customPostType?.render(C)??null,r.event,r.state,e,void 0);return await y.reconcile(),Hc.fromJSON({state:y.state,effects:y.getEffects()})}let g=u.formDefinitions.get(p);if(!g)throw new Error(`Form with key ${p} not found`);let f,m;if(i.__contextAction){let{actionId:y,thingId:P}=i.__contextAction,C=xc(y);C?.location==="post"?f=P:C?.location==="comment"&&(m=P)}let b=Object.assign(n,le(e,f,m),{uiEnvironment:{timezone:e[L.Timezone]?.values[0],locale:e[L.Language]?.values[0]}});await g.onSubmit({values:Ft(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new pt((g,f)=>u.customPostType?.render(f)??null,r.event,r.state,e,void 0);return await p.reconcile(),Hc.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Pb.default)(t,i),a=ki(n.ui),c=o?[...a,{type:XE.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return Hc.fromJSON({state:i,effects:c})}function Cb(r){r.provides(ZE),U("HandleUIEvent",QE)}import{CustomPostDefinition as Rd,UIResponse as Zb}from"@devvit/protos";import{UIEventScope as aR}from"@devvit/protos";var qc="ServerCallRequired";function Pd(r){return r?.message===qc}var Vc={now(){return new Date}};function wb(r){return`__autocache__${r}`}function xb(r){return`__lock__${r}`}var YE=300,eR=1e3,Cd=5e3,jc=3,Fb=.1,Ib=1e3,tR=3e4;function Tb(r){if(r.error)throw new Error(r.error);return r.value}var Mt,Ut,De,Ti,K,Ab,Eb,Rb,Wc,Ob,Bb,Gc,Mb,wd=class{constructor(e,t,i=Vc){l(this,K);l(this,Mt);l(this,Ut,{});l(this,De);l(this,Ti);d(this,Mt,e),d(this,Ti,t),d(this,De,i)}async cache(e,t){var a;(a=s(this,Ti)).__cache??(a.__cache={}),d(this,Ut,s(this,Ti).__cache),S(this,K,Mb).call(this,t);let i=S(this,K,Ab).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,Gc).call(this,t.key),o=await S(this,K,Eb).call(this,t,n,e);return Tb(o)}};Mt=new WeakMap,Ut=new WeakMap,De=new WeakMap,Ti=new WeakMap,K=new WeakSet,Ab=function(e){let t=s(this,Ut)[e];if(t){let i=s(this,De).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<jc&&Math.random()<Fb&&t.errorTime+Ib<i;if(t?.expires&&t.expires<i&&t.checkedAt+Ib<i||n){delete s(this,Ut)[e];return}else return Tb(t)}},Eb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,Bb).call(this,n):1;return!t||t?.error&&t.errorCount<jc&&Fb>Math.random()||o>Math.random()?S(this,K,Rb).call(this,e,t,i):t},Rb=async function(e,t,i){let n=xb(e.key),o=s(this,De).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Mt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Ob).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,De).now();return S(this,K,Wc).call(this,p,e.key,e.ttl)}},Wc=async function(e,t,i){let n=Math.min(i,eR),o=await S(this,K,Gc).call(this,t);if(o)return o;if(s(this,De).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,YE)),S(this,K,Wc).call(this,e,t,i)},Ob=async function(e,t,i,n){let o=s(this,De).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,De).now().getTime(),t.errorCount++}return s(this,Ut)[e]=t,await s(this,Mt).set(wb(e),JSON.stringify(t),{expiration:new Date(o+tR)}),t.error&&t.errorCount<jc&&await s(this,Mt).del(xb(e)),t},Bb=function(e){let t=s(this,De).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},Gc=async function(e){let t=await s(this,Mt).get(wb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,De).now().getTime(),s(this,Ut)[e]=i,i}},Mb=function(e){e.ttl<Cd&&(console.warn(`Cache TTL cannot be less than ${Cd} milliseconds! Updating ttl value of ${e.ttl} to ${Cd}.`),e.ttl=Cd)};function Ub(r,e,t=Vc){let i=new wd(r,e,t);return i.cache.bind(i)}import{EffectType as $c,Form as iR,ToastAppearance as Nb}from"@devvit/protos";function Lb(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var zc=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Ft(n.formSubmitted.results))}}};function Jc(r,e){let t=Je({namespace:"useForm",initializer:i=>new zc(i,r,e)});return rR({id:t.hookId})}function rR(r){return`form.hook.${r.id}.0`}function Db(r,e){let t=Lb(e);return r.getHook({id:t})}var Lt,xd=class{constructor(e){l(this,Lt);d(this,Lt,e)}showForm(e,t){let i=Db(s(this,Lt),e);if(!i)throw new Error("Form does not exist. Make sure you have added it using useForm.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=iR.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});pr(n.fields),o.fields=mt(n.fields),s(this,Lt).emitEffect(e,{type:$c.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Nb.SUCCESS:Nb.NEUTRAL}:t={text:e},s(this,Lt).emitEffect(e.toString(),{type:$c.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Lt).emitEffect(t,{type:$c.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Lt=new WeakMap;import{EffectType as nR,RealtimeSubscriptionStatus as _b}from"@devvit/protos";var Dt,it,Nt,Cr,ys,Xc,Fd=class Fd{constructor(e,t){l(this,ys);l(this,Dt);l(this,it);l(this,Nt);l(this,Cr);d(this,Dt,t.context),d(this,it,!!t.context._devvitContext?.debug.realtime),d(this,Cr,e),d(this,Nt,t.invalidate);let i=t.context.meta[L.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[L.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,Dt)._hooks).filter(c=>c instanceof Fd).some(c=>c.state.channel===o))throw Error(`useChannel channel names must be unique; "${o}" duplicated`);this.state={channel:o,connected:!1,subscribed:!1}}async onUIEvent(e){let t=e.realtimeEvent;if(!(!t||!this.state.subscribed))switch(t.status){case _b.REALTIME_SUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Nt).call(this),await s(this,Cr).onSubscribed?.();break;case _b.REALTIME_UNSUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Nt).call(this),await s(this,Cr).onUnsubscribed?.();break;default:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Cr).onMessage(t.event?.data?.msg);break}}async send(e){if(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" send message: ${JSON.stringify(e,void 0,2)}`),!this.state.subscribed||!this.state.connected)throw console.debug(`[realtime] "${this.state.channel}" send failed; channel not connected`),Error(`useChannel send failed; "${this.state.channel}" channel not connected`);await s(this,Dt).devvitContext.realtime.send(this.state.channel,e)}get status(){return this.state.subscribed&&this.state.connected?2:this.state.subscribed&&!this.state.connected?1:!this.state.subscribed&&this.state.connected?3:4}subscribe(){this.state.subscribed||(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,Nt).call(this),S(this,ys,Xc).call(this))}unsubscribe(){this.state.subscribed&&(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Nt).call(this),S(this,ys,Xc).call(this))}};Dt=new WeakMap,it=new WeakMap,Nt=new WeakMap,Cr=new WeakMap,ys=new WeakSet,Xc=function(){let e=Object.values(s(this,Dt)._hooks).filter(t=>t instanceof Fd&&t.state.subscribed).map(t=>t.state.channel);s(this,Dt).emitEffect(this.state.channel,{type:nR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var Kc=Fd;function Zc(r){if(!r.name||/[^a-zA-Z0-9_]/.test(r.name))throw Error(`useChannel error: The name "${r.name}" you provided for the hook is invalid. Valid names can only contain letters, numbers, and underscores (_).`);let e=`useChannel:${r.name}`;return Je({id:e,namespace:e,initializer:t=>new Kc(r,t)})}import{EffectType as Qc}from"@devvit/protos";function Hb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var wr,_t,Ai=class Ai{constructor(e,t){l(this,wr);this._segments=[];l(this,_t,{});this._prevHooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,d(this,wr,e.state??{__cache:{}}),this._rootProps=e.props??{}}get devvitContext(){if(!this._devvitContext)throw new Error("Devvit context not available");return this._devvitContext}set devvitContext(e){this._devvitContext=e}get _changedState(){let e={__cache:s(this,wr).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(s(this,_t)).forEach(i=>{i!=="__cache"&&t.delete(i)}),t.forEach(i=>{if(i==="__cache")return;let n={__deleted:!0};this._state[i]=e[i]=n}),e}get _hooks(){return s(this,_t)}set _hooks(e){this._prevHooks=s(this,_t),d(this,_t,e)}get _state(){return s(this,wr)}set _state(e){d(this,wr,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ai.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,_t)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ai._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ai._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}addToRequeueEvents(...e){this._devvitContext?.debug.blocks&&console.debug("[blocks] requeueing events",e);let t=e.reduce((i,n)=>(n.retry?i.retry.push(n):i.normal.push(n),i),{retry:[],normal:[]});this._requeueEvents=[...t.retry,...this._requeueEvents,...t.normal]}get effects(){return Object.values(this._effects)}nextHookId(e){e.key===void 0&&(e.key=this._segments[this._segments.length-1].next+++""),this.push(e);try{let t=[];for(let n=this._segments.length-1;n>=0;n--){let o=this._segments[n];if(o.id){t.unshift(o.id);break}let a=[];o.namespace&&a.push(o.namespace),o.key!==void 0&&o.key!==!1&&a.push(o.key),t.unshift(a.join("-"))}let i=t.join(".");if(this._generated[i]&&!e.shared)throw new Error(`Hook id ${i} already used, cannot register another hook with the same id`);return this._generated[i]=!0,this._prevHookId=i,i}finally{this.pop()}}};wr=new WeakMap,_t=new WeakMap,Ai._staticUndeliveredHandlers={};var Ei=Ai;var Ht={};Ei.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Ht[r.hook],e.emitEffect("timers",{type:Qc.EFFECT_SET_INTERVALS,interval:{intervals:Ht}}))});var qt,Ri,bs,Oi,Yc=class{constructor(e,t,i){l(this,qt);l(this,Ri);l(this,bs);l(this,Oi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Ri,i.invalidate),d(this,qt,i.hookId),d(this,bs,e),d(this,Oi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?Ht[s(this,qt)]={duration:this.state.duration}:delete Ht[s(this,qt)]}async onUIEvent(e){await s(this,bs).call(this)}start(){Ht[s(this,qt)]={duration:this.state.duration},this.state.running=!0,s(this,Ri).call(this),s(this,Oi).emitEffect("timers",{type:Qc.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}stop(){delete Ht[s(this,qt)],this.state.running=!1,s(this,Ri).call(this),s(this,Oi).emitEffect("timers",{type:Qc.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}};qt=new WeakMap,Ri=new WeakMap,bs=new WeakMap,Oi=new WeakMap;function em(r,e){let t=Je({namespace:"useInterval",initializer:i=>new Yc(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}import{UIEventScope as oR}from"@devvit/protos";var xr=class extends Error{};import{UIEventScope as qb}from"@devvit/protos";var jb=Mn(_c(),1);function rm(r){if(r instanceof Error){if(r.message===qc)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:wi.caughtToString(r)}}var $e,nt,Bi,ks,tm=class{constructor(e,t,i){l(this,$e);l(this,nt);l(this,Bi);l(this,ks);d(this,$e,!!i.context.devvitContext.debug.useAsync),s(this,$e)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,nt,i.hookId),this.initializer=e,d(this,Bi,i.invalidate),d(this,ks,i.context),this.localDepends=t.depends??null}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,$e)&&console.debug("[useAsync] async onLoad ",s(this,nt),this.state),s(this,$e)&&console.debug("[useAsync] async onLoad have ",this.localDepends,"and",this.state.depends),!(0,jb.default)(this.localDepends,this.state.depends)||this.state.load_state==="initial")){s(this,$e)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,nt)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Bi).call(this);let e={scope:qb.ALL,hook:s(this,nt),async:!0,asyncRequest:{requestId:s(this,nt)+"-"+JSON.stringify(this.state.depends)}};s(this,$e)&&console.debug("[useAsync] onLoad requeue"),s(this,ks).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await this.initializer()}}catch(o){i.error=rm(o)}let n={scope:qb.ALL,asyncResponse:i,hook:s(this,nt)};s(this,$e)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,nt)+"-"+JSON.stringify(this.state.depends);e.asyncResponse.requestId===i?(this.state={...this.state,data:e.asyncResponse.data?.value,error:e.asyncResponse.error??null,load_state:e.asyncResponse.error?"error":"loaded"},s(this,Bi).call(this)):s(this,$e)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};$e=new WeakMap,nt=new WeakMap,Bi=new WeakMap,ks=new WeakMap;function sR(r,e={}){let t=Je({namespace:"useAsync",initializer:i=>new tm(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var vt,Mi,Fr,Ir,im=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,vt);l(this,Mi);l(this,Fr);l(this,Ir);d(this,Fr,e),d(this,Ir,t.hookId),d(this,vt,t.invalidate),d(this,Mi,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&this._promise){try{this.state.value=await this._promise,this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=rm(e)}s(this,vt).call(this)}else console.warn("Invalid state: ",this.state.load_state,this._promise)}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,vt).call(this)}onStateLoaded(){if(this._promise=s(this,Mi)._prevHooks[s(this,Ir)]?._promise,this.state.load_state==="loading")throw new xr;if(this.state.load_state==="error")throw new Error(this.state.error?.message??"Unknown error");if(this.state.load_state==="initial"){let e;try{e=s(this,Fr)instanceof Function?s(this,Fr).call(this):s(this,Fr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,vt).call(this);return}if(e instanceof Promise){this._promise=e,this.state.load_state="loading";let t={scope:oR.ALL,asyncRequest:{requestId:s(this,Ir)},hook:s(this,Ir)};throw s(this,Mi).addToRequeueEvents(t),s(this,vt).call(this),new xr}else this.state.value=e,this.state.load_state="loaded";s(this,vt).call(this)}}};vt=new WeakMap,Mi=new WeakMap,Fr=new WeakMap,Ir=new WeakMap;function nm(r){let e=Je({namespace:"useState",initializer:t=>new im(r,t)});return[e.state.value,e.setter.bind(e)]}var Id=class{buildContext(e,t,i){let n=new mi(i),o=new ui(i),a=new fi(i),c=new gi(i),p=new vi(i),g=new yi(i),f=new xd(e),m=new ci(i),b=new di,y=new pi(i),P=Ub(a,e._state),C={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:b,realtime:y,ui:f,useState:nm,useChannel:Zc,useInterval:em,useForm:Jc,cache:P,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[L.Timezone]?.values[0],locale:i[L.Language]?.values[0],dimensions:t.env?.dimensions}},T=le(i,t.props?.postId);return T.debug.effects=e,{...T,...C}}};var be=null;function Wb(r){return JSON.parse(JSON.stringify(r))}function dR(r){if(!(r!==""&&!/[-.]/.test(r)))throw new Error(`Hook with namespace '${r}' is invalid. Hook namespaces cannot be empty string or contain dashes/dots because they are used as delimiters internally. Please update the hook namespace and try again.`)}function Je({initializer:r,...e}){if(!be)throw new Error("Hooks can only be declared at the top of a component. You cannot declare hooks outside of components or inside of event handlers. It's almost always a mistake to declare hooks inside of loops or conditionals.");dR(e.namespace);let t=be.nextHookId(e),i=be,n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:be},o=be._state[t]===void 0||Hb(be._state[t]);be._hooks[t]=be._hooks[t]??r(n);let a=be._hooks[t];return o||(a.state=be._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var lR=null,Ui,Ed,Ps,F,ue,Td,Gb,sm,Vb,om,am,Ad,dm,zb,Ss=class{constructor(e){l(this,F);l(this,Ui);l(this,Ed,new Id);l(this,Ps,new Ci(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,F,ue)&&console.debug("[blocks] BlocksHandler v1"),d(this,Ui,e),lR=this}async handle(e,t){let i=new Ei(e,t),n=s(this,Ed).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(y=>!y.async),g=a.some(y=>y.blocking),f,m,b=[...a];for(a.length===0&&a.push({scope:aR.ALL}),s(this,F,ue)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,F,ue)&&console.debug("[blocks] processing events loop iteration",a.length);let y=[];if(!a[0].async)y.push(a.shift());else for(;a[0]?.async;)y.push(a.shift());if(!y.length)throw Error("batch must have at least one event");try{if(y[0].async){let C=Wb(i._state);await S(this,F,Gb).call(this,i,...y),i._state=C}else await S(this,F,Vb).call(this,i,...y)}catch(C){if(!Pd(C))throw C;if(s(this,F,ue)&&console.debug("[blocks] caught in handler",C),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=f,i._effects=m._effects;let T=b.map(B=>{let me={...B};return me.retry=!0,me});i.addToRequeueEvents(...T);break}else throw Pd(C)||console.error("[blocks] unhandled error in handler",C),C}s(this,F,ue)&&console.debug("[blocks] remaining events",i._requeueEvents);let P=[];for(let C of i._requeueEvents){if(!p&&!C.async){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",C),P.push(C);continue}if(p&&C.async&&!g){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",C),P.push(C);continue}s(this,F,ue)&&console.debug("[blocks] reprocessing event in BlocksHandler",C),a.push(C)}i._requeueEvents=P,a.length>0&&(f={...i._changed},m={_state:Wb(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,F,om).call(this,s(this,Ui),i.request.props??{},i));let y=i._latestRenderContent;y&&(o=s(this,Ps).createBlocksElementOrThrow(y),o=s(this,Ps).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Ui=new WeakMap,Ed=new WeakMap,Ps=new WeakMap,F=new WeakSet,ue=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Td=function(e,...t){e._hooks={},S(this,F,om).call(this,s(this,Ui),e.request.props??{},e)},Gb=async function(e,...t){S(this,F,Td).call(this,e,...t),await Promise.all(t.map(async i=>{if(!i.async)throw new Error("You can't mix main and other queues in one batch. This is likely a platform bug. Please file an issue in the Discord for someone to help! https://discord.com/channels/1050224141732687912/1115441897079574620");await S(this,F,sm).call(this,e,i)}))},sm=async function(e,t){let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw Pd(n)?s(this,F,ue)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},Vb=async function(e,...t){for(let i of t)s(this,F,ue)&&console.log("[blocks] handling main queue event",i),s(this,F,ue)&&console.log("[blocks] before",e._state),S(this,F,Td).call(this,e,i),await S(this,F,sm).call(this,e,i),s(this,F,ue)&&console.log("[blocks] after",e._state);S(this,F,Td).call(this,e)},om=function(e,t,i){s(this,F,ue)&&console.debug("[blocks] renderRoot"),i._generated={},be=i,this._latestRenderContext=i;try{let n=S(this,F,am).call(this,e,t,i);if(n.length!==1)throw new Error(`There can only be one root element, received: ${n.length}. Please wrap these elements in a <vstack></vstack> or <hstack></hstack> to continue. Fragments cannot be used as a root element.`);let o=n[0];if(o==="[object Promise]")throw new Error('Root elements cannot be async. To use data from an async endpoint, please use "const [data] = useState(async () => {/** your async code */})".');if(typeof o=="string")throw new Error("The root element must return a valid block, not a string. Try wrapping the element in a <text>your content</text> tag to continue.");return i._latestRenderContent=o,o}catch(n){if(n instanceof xr)return;throw n}finally{be=null}},am=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);if(n instanceof Promise)throw new Error(`Components (found: ${e.name??"unknown component"}) cannot be async. To use data from an async endpoint, please use "const [data] = useState(async () => {/** your async code */})".`);return S(this,F,dm).call(this,n,i)}finally{i.pop()}},Ad=function(e,t){return e=e.flat(1/0),e.flatMap((i,n)=>(i&&typeof i=="object"&&"props"in i&&(i.props?.key||(i.props=i.props??{},i.props.key=`${n}`)),S(this,F,dm).call(this,i,t)))},dm=function(e,t){if(Array.isArray(e))return S(this,F,Ad).call(this,e,t);if(uR(e))if(e.type===void 0)try{return t.push({namespace:"fragment",...e.props}),S(this,F,Ad).call(this,e.children,t)}finally{t.pop()}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,F,am).call(this,e.type,i,t)}else try{t.push({namespace:e.type,...e.props});let i=S(this,F,Ad).call(this,e.children,t),n=S(this,F,zb).call(this,e.props??{});return[{type:e.type,children:i,props:n}]}finally{t.pop()}else return[(e??"").toString()]},zb=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Je({namespace:i,key:!1,initializer:({hookId:o})=>({hookId:o,state:null,onUIEvent:a=>e[i](a.userAction?.data)})});t[i]=n.hookId,"captureHookRef"in e[i]&&e[i].captureHookRef()}else{let n=JSON.parse(JSON.stringify(e[i]));n!=null&&(t[i]=n)}return t};function uR(r){return typeof r=="object"&&r!=null&&"type"in r}var Jb=r=>{let e=Number(r.trim().split(".").pop());return isNaN(e)?void 0:e},$b=r=>{let[e,t,i]=r.trim().split(";");if(!e||!t||!i){console.warn(`Received a malformed devvit-user-agent! Received: '${r}'`);return}if(e!=="Reddit"){console.warn(`Received unknown company name in user agent! Received: '${r}'`);return}if(t==="iOS"){let n=Jb(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"iOS",rawVersion:i,versionNumber:n}}if(t==="Android"){let n=Jb(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"Android",rawVersion:i,versionNumber:n}}if(t==="Shreddit")return{company:"Reddit",platform:"Shreddit",rawVersion:i};if(t==="Play")return{company:"Reddit",platform:"Play",rawVersion:i};console.warn("Received unknown platform:",t)},Kb=r=>r?r.platform==="Android"?r.versionNumber<1875012:r.platform==="iOS"?r.versionNumber<614973:!1:(console.warn(`Could not parse devvit-user-agent! Received: '${JSON.stringify(r)}'`),!1),cR=r=>{switch(r){case"Android":return"https://play.google.com/store/apps/details?id=com.reddit.frontpage";case"iOS":return"https://apps.apple.com/us/app/reddit/id1064216828";case"Play":case"Shreddit":break;default:console.error(`No upgrade link for platform: ${r}`)}},mR=({platform:r},e)=>u.createElement("blocks",null,u.createElement("vstack",{alignment:"middle center",height:100,width:100},u.createElement("vstack",{maxWidth:"300px",gap:"large",alignment:"middle center"},u.createElement("vstack",{gap:"medium",alignment:"middle center"},u.createElement("image",{imageHeight:100,imageWidth:100,url:"https://i.redd.it/p1vmc5ulmpib1.png"}),u.createElement("text",{size:"large",weight:"bold",wrap:!0,alignment:"center"},"Uh oh, the app you're trying to use requires the latest version of Reddit. Please upgrade your app to continue.")),u.createElement("hstack",{alignment:"middle center"},u.createElement("button",{onPress:()=>{let t=cR(r);t?e.ui.navigateTo(t):console.warn("No upgrade link found for platform:",r)}},"Upgrade"))))),Xb=r=>()=>u.createElement(mR,{platform:r});var pR=()=>u.createElement("vstack",{alignment:"center middle",width:"100%",height:"100%"},u.createElement("text",null,"This feature is not available yet")),gR=[[Rd,Rd.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null],[Rd,Rd.methods.renderPostComposer,(r,e)=>u.createElement(pR,null)]];function hR(r){return async(e,t)=>{let i=$b(t["devvit-user-agent"]?.values?.[0]??"");if(i&&Kb(i)){let o=new Ss(Xb(i.platform));return Zb.fromJSON(await o.handle(e,t))}let n=new Ss(r);return Zb.fromJSON(await n.handle(e,t))}}function Qb(r){for(let[e,t,i]of gR)r.provides(e),U(t.name,hR(i))}var Li,Cs,Di,Tr,Ar,Ni,_i,Er,jt,ws,xs,Rr,W,D=class D extends Xa{static configure(e){d(this,Di,{...s(this,Di),...e}),gt(e.http)&&this.use(w.HTTPDefinition),(gt(e.kvStore)||gt(e.redis))&&(this.use(w.KVStoreDefinition),this.use(w.RedisAPIDefinition)),gt(e.media)&&this.use(w.MediaServiceDefinition),gt(e.modLog)&&this.use(w.ModlogDefinition),gt(e.redditAPI)&&(this.use(w.FlairDefinition),this.use(w.GraphQLDefinition),this.use(w.LinksAndCommentsDefinition),this.use(w.ListingsDefinition),this.use(w.ModerationDefinition),this.use(w.ModNoteDefinition),this.use(w.NewModmailDefinition),this.use(w.PrivateMessagesDefinition),this.use(w.SubredditsDefinition),this.use(w.UsersDefinition),this.use(w.WidgetsDefinition),this.use(w.WikiDefinition)),gt(e.realtime)&&this.use(w.RealtimeDefinition)}static addMenuItem(e){s(this,_i).push(e)}static addCustomPostType(e){d(this,Tr,e)}static createForm(e,t){let i=`form.${s(this,Ar).size}`;return s(this,Ar).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,W)[w.SchedulerDefinition.fullName]||this.use(w.SchedulerDefinition),s(this,Er).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,Er).set(e.name,e.onRun)}static addSettings(e){pr(e);let t=e.filter(n=>n.type==="group"||!n.scope||n.scope==="installation"),i=e.filter(n=>n.type!=="group"&&n.scope==="app");t.length>0&&d(this,Ni,t),i.length>0&&d(this,Li,i),s(this,W)[w.SettingsDefinition.fullName]||this.use(w.SettingsDefinition)}static addTrigger(e){if("events"in e){for(let t of e.events)this.addTrigger({event:t,onEvent:(i,n)=>e.onEvent(i,n)});return this}return s(this,jt).has(e.event)?s(this,jt).get(e.event)?.push(e.onEvent):s(this,jt).set(e.event,[e.onEvent]),D}static provide(e){s(this,xs).push(e)}static use(e,t){s(this,Rr)[e.fullName]={def:e,options:t??{},handler:void 0};let i={};for(let n of Object.values(e.methods))i[n.name]=(o,a)=>s(this,Rr)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,W)[e.fullName]=i,i}static get redditAPIPlugins(){if(!gt(s(this,Di).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,W)[w.FlairDefinition.fullName],GraphQL:s(this,W)[w.GraphQLDefinition.fullName],LinksAndComments:s(this,W)[w.LinksAndCommentsDefinition.fullName],Listings:s(this,W)[w.ListingsDefinition.fullName],Moderation:s(this,W)[w.ModerationDefinition.fullName],ModNote:s(this,W)[w.ModNoteDefinition.fullName],NewModmail:s(this,W)[w.NewModmailDefinition.fullName],PrivateMessages:s(this,W)[w.PrivateMessagesDefinition.fullName],Subreddits:s(this,W)[w.SubredditsDefinition.fullName],Users:s(this,W)[w.UsersDefinition.fullName],Widgets:s(this,W)[w.WidgetsDefinition.fullName],Wiki:s(this,W)[w.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,W)[w.ModlogDefinition.fullName];if(!e)throw new Error("ModLog is not enabled. You can enable it by passing `modLog: true` to `Devvit.configure`");return e}static get schedulerPlugin(){let e=s(this,W)[w.SchedulerDefinition.fullName];if(!e)throw new Error("Scheduler is not enabled. You can enable it by calling `Devvit.addSchedulerJob` at the top level of your app.");return e}static get kvStorePlugin(){let e=s(this,W)[w.KVStoreDefinition.fullName];if(!e)throw new Error("Key Value Store is not enabled. You can enable it by passing `kvStore: true` to `Devvit.configure`");return e}static get redisPlugin(){let e=s(this,W)[w.RedisAPIDefinition.fullName];if(!e)throw new Error("Redis is not enabled. You can enable it by passing `redis: true` to `Devvit.configure`");return e}static get mediaPlugin(){let e=s(this,W)[w.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,W)[w.SettingsDefinition.fullName];if(!e)throw new Error("Settings must first be configured with `Devvit.addSettings()` before they can be accessed");return e}static get realtimePlugin(){let e=s(this,W)[w.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,_i)}static get customPostType(){return s(this,Tr)}static get formDefinitions(){return s(this,Ar)}static get scheduledJobHandlers(){return s(this,Er)}static get installationSettings(){return s(this,Ni)}static get appSettings(){return s(this,Li)}static get triggerOnEventHandlers(){return s(this,jt)}static get assets(){return s(this,Cs)}static get webviewAssets(){return s(this,ws)}constructor(e){super(e),d(D,Cs,e.assets??{}),d(D,ws,e.webviewAssets??{});for(let t in s(D,Rr)){let i=s(D,Rr)[t];i.handler=e.use(i.def,i.options)}s(D,_i).length>0&&Fy(e),s(D,Er).size>0&&Iy(e),s(D,Tr)&&(Cy(e),Qb(e)),(s(D,Tr)||s(D,Ar).size>0)&&Cb(e),s(D,Ni)&&wy(e),s(D,Li)&&ny(e),s(D,jt).size>0&&Ty(e);for(let t of s(D,xs))e.provides(t)}};Li=new WeakMap,Cs=new WeakMap,Di=new WeakMap,Tr=new WeakMap,Ar=new WeakMap,Ni=new WeakMap,_i=new WeakMap,Er=new WeakMap,jt=new WeakMap,ws=new WeakMap,xs=new WeakMap,Rr=new WeakMap,W=new WeakMap,D.debug={},l(D,Li),l(D,Cs,{}),l(D,Di,{}),l(D,Tr),l(D,Ar,new Map),l(D,Ni),l(D,_i,[]),l(D,Er,new Map),l(D,jt,new Map),l(D,ws,{}),l(D,xs,[]),l(D,Rr,{}),l(D,W,{});var u=D;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function Q(r){let e=Object.getOwnPropertyDescriptors(r.constructor.prototype);for(let[t,i]of Object.entries(e))i.get&&Object.defineProperty(r,t,{...i,enumerable:!0})}var lm;(function(r){r[r.bold=1]="bold",r[r.italic=2]="italic",r[r.underline=4]="underline",r[r.strikethrough=8]="strikethrough",r[r.subscript=16]="subscript",r[r.superscript=32]="superscript",r[r.monospace=64]="monospace"})(lm||(lm={}));var Yb="text",ek="raw",tk="br",rk="link",ik="c/",nk="p/",sk="r/",ok="u/",ak="@",dk="spoilertext",lk="par",uk="h",ck="hr",mk="blockquote",pk="code",gk="li",hk="list",fk="L",vk="R",yk="C",bk="table",kk="embed",Sk="img",Pk="gif",Ck="video";function wk(r){return{e:Pk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function xk(r,e){let t={},i=[];return Object.assign(t,Fs(t,i),Is(t,i),Ts(t,i),Rs(t,i),Os(t,i),Bs(t,i)),e(t),{e:mk,c:i,...r.author&&{a:r.author}}}function Fk(r,e){let t={},i=[];return Object.assign(t,cm(t,i)),e(t),{e:pk,c:i,...r.language&&{l:r.language}}}function Ik(r){return{e:ik,t:r.permalink}}function Tk(r,e){let t={},i=[];return Object.assign(t,cm(t,i),Es(t,i)),e(t),{e:uk,l:r.level,c:i}}function Ak(r){return{e:kk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Ek(){return{e:ck}}function Rk(r){return{e:Sk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Ok(){return{e:tk}}function Bk(r){return{e:rk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function Mk(r,e){let t={},i=[];return Object.assign(t,Xk(t,i)),e(t),{e:hk,o:r.ordered,c:i}}function Uk(r){let e={},t=[];return Object.assign(e,Fs(e,t),Is(e,t),Ts(e,t),Od(e,t),Rs(e,t),Os(e,t),Bs(e,t)),r(e),{e:gk,c:t}}function Lk(r){let e={},t=[];return Object.assign(e,Bd(e,t),Es(e,t),um(e,t),mm(e,t),As(e,t)),r(e),{e:lk,c:t}}function Dk(r){return{e:nk,t:r.permalink}}function Nk(r){return{e:ek,t:r}}function _k(r){let e={},t=[];return Object.assign(e,Bd(e,t),Es(e,t),um(e,t)),r(e),{e:dk,c:t}}function Hk(r){return{e:sk,t:r.subredditName,l:r.showPrefix}}function qk(r){let e={},t=[],i=[];return Object.assign(e,Zk(e,t,i)),r(e),{e:bk,h:t,c:i}}function jk(r){let[e,t]=Kk();return r(e),{c:t}}function Wk(r,e){let[t,i]=Kk();e(t);let n;switch(r.columnAlignment){case"left":n=fk;break;case"right":n=vk;break;case"center":n=yk;break}return{...n&&{a:n},...i&&{c:i}}}function Gk(r){let e={},t=[];return Object.assign(e,Qk(e,t)),r(e),t}function Vk(r){return{e:Yb,t:r.text,...r.formatting&&{f:r.formatting}}}function zk(r){return{e:ok,t:r.username,l:r.showPrefix}}function Jk(r){return{e:ak,t:r.username,l:r.showPrefix}}function $k(r){return{e:Ck,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function Kk(){let r={},e=[];return Object.assign(r,Bd(r,e),Es(r,e),mm(r,e),As(r,e)),[r,e]}function Fs(r,e){return{blockQuote(t,i){return e.push(xk(t,i)),r}}}function Is(r,e){return{codeBlock(t,i){return e.push(Fk(t,i)),r}}}function Yk(r,e){return{embed(t){return e.push(Ak(t)),r}}}function Ts(r,e){return{heading(t,i){return e.push(Tk(t,i)),r}}}function Od(r,e){return{horizontalRule(){return e.push(Ek()),r}}}function As(r,e){return{image(t){return e.push(Rk(t)),r},animatedImage(t){return e.push(wk(t)),r}}}function um(r,e){return{linebreak(){return e.push(Ok()),r}}}function Es(r,e){return{link(t){return e.push(Bk(t)),r},commentLink(t){return e.push(Ik(t)),r},postLink(t){return e.push(Dk(t)),r},subredditLink(t){return e.push(Hk(t)),r},userLink(t){return e.push(zk(t)),r},userMention(t){return e.push(Jk(t)),r}}}function Rs(r,e){return{list(t,i){return e.push(Mk(t,i)),r}}}function Xk(r,e){return{item(t){return e.push(Uk(t)),r}}}function Os(r,e){return{paragraph(t){return e.push(Lk(t)),r}}}function cm(r,e){return{rawText(t){return e.push(Nk(t)),r}}}function mm(r,e){return{spoiler(t){return e.push(_k(t)),r}}}function Zk(r,e,t){return{headerCell(i,n){return e.push(Wk(i,n)),r},row(i){return t.push(Gk(i)),r}}}function Bs(r,e){return{table(t){return e.push(qk(t)),r}}}function Qk(r,e){return{cell(t){return e.push(jk(t)),r}}}function Bd(r,e){return{text(t){return e.push(Vk(t)),r}}}function eS(r,e){return{video(t){return e.push($k(t)),r}}}var fR=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},vR=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Md,Wt=class{constructor(){Md.set(this,void 0);let e=[];Object.assign(this,Os(this,e),Ts(this,e),Od(this,e),Fs(this,e),Is(this,e),Yk(this,e),Rs(this,e),Bs(this,e),As(this,e),eS(this,e)),fR(this,Md,{document:e},"f")}build(){return JSON.stringify(vR(this,Md,"f"))}paragraph(e){return this}heading(e,t){return this}horizontalRule(){return this}blockQuote(e,t){return this}codeBlock(e,t){return this}embed(e){return this}list(e,t){return this}table(e){return this}image(e){return this}animatedImage(e){return this}video(e){return this}};Md=new WeakMap;function Hi(r){let e;return r instanceof Wt?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var tS=100,rS=1/0,Or,Br,Gt,qi,ji,Ud,G=class{constructor(e){l(this,ji);l(this,Or);l(this,Br);l(this,Gt);l(this,qi,!1);this.pageSize=tS;this.limit=rS;this.children=[];Q(this),this._fetch=e.fetch,this.pageSize=e.pageSize??tS,this.limit=e.limit??rS,d(this,Br,e.after),d(this,Or,e.before),d(this,Gt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,qi)||!!(s(this,Br)||s(this,Or)||s(this,Gt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,ji,Ud).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,Gt,e)}preventInitialFetch(){d(this,qi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,ji,Ud).call(this);return this.children.slice(0,this.limit)}async get(e){let t=e<=this.limit?e:this.limit;for(;this.hasMore&&this.children.length<t;)await S(this,ji,Ud).call(this);return this.children.slice(0,t)}};Or=new WeakMap,Br=new WeakMap,Gt=new WeakMap,qi=new WeakMap,ji=new WeakSet,Ud=async function(){if(!this.hasMore)throw new Error("This listing does not have any more items to load.");let{children:e,before:t,after:i,more:n}=await this._fetch({before:s(this,Or),after:s(this,Br),limit:this.pageSize,more:s(this,Gt)});return this.children.push(...e),d(this,Or,t),d(this,Br,i),d(this,Gt,n),d(this,qi,!0),e};function yR(r){try{return!0}catch{return!1}}function bR(r){try{return!0}catch{return!1}}var Ms,pm,Be=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new G({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>S(this,Ms,pm).call(this,a))||[],before:o.hasNextPage?o.endCursor:void 0,hasMore:o.hasNextPage}}})}static async delete(e,t){let i=u.redditAPIPlugins.ModNote,{deleted:n}=await i.DeleteNotes(e,t);return!!n}static async add(e,t){let n=await u.redditAPIPlugins.ModNote.PostNotes(e,t);if(!n?.created)throw new Error("Failed to create mod note");return S(this,Ms,pm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Ms=new WeakSet,pm=function(e){if(v(e.id,"Mod note ID is null or undefined"),v(e.createdAt,"Mod note createdAt is null or undefined"),v(e.type,"Mod note type is null or undefined"),v(e.subreddit,"Mod note subreddit is null or undefined"),v(e.subredditId,"Mod note subredditId is null or undefined"),v(e.operator,"Mod note operator is null or undefined"),v(e.operatorId,"Mod note operatorId is null or undefined"),v(e.user,"Mod note user is null or undefined"),v(e.userId,"Mod note userId is null or undefined"),v(e.userNoteData,"Mod note userNote is null or undefined"),v(e.modActionData,"Mod note modAction is null or undefined"),!yR(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!bR(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ne(e.userId??""),name:e.user},subreddit:{id:Ae(e.subredditId??""),name:e.subreddit},operator:{id:ne(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:e.userNoteData?.redditId?Ee(e.userNoteData?.redditId):void 0,label:e.userNoteData?.label},type:e.type}},l(Be,Ms);var Ne=class{static queryWithQueryString(e,t){return u.redditAPIPlugins.GraphQL.Query({query:e},t)}static query(e,t,i,n){return u.redditAPIPlugins.GraphQL.PersistedQuery({operationName:e,id:t,variables:i},n)}};var iS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_operator","community_chat"];function kR(r,e){return e.map(t=>(r.includes(t)?"+":"-")+t).join(",")}function gm(r){return kR(r,iS)}function nS(r){return r.filter(e=>iS.includes(e))}var SR=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(SR||{}),Ur,Wi,Gi,Vi,zi,Ji,$i,Ki,Xi,Zi,Qi,Ld,Ke=class Ke{constructor(e,t,i){l(this,Ur);l(this,Wi);l(this,Gi);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);Q(this),v(e.id),v(e.text),d(this,Ur,e.id),d(this,Wi,t),d(this,Gi,e.text),d(this,Vi,PR(e.textColor)),d(this,zi,CR(e.backgroundColor)),d(this,Ji,wR(e.allowableContent)),d(this,$i,e.modOnly),d(this,Ki,e.maxEmojis),d(this,Xi,e.textEditable),d(this,Zi,i)}get id(){return s(this,Ur)}get text(){return s(this,Gi)}get textColor(){return s(this,Vi)}get backgroundColor(){return s(this,zi)}get allowableContent(){return s(this,Ji)}get modOnly(){return s(this,$i)}get maxEmojis(){return s(this,Ki)}get allowUserEdits(){return s(this,Xi)}async delete(){return Ke.deleteFlairTemplate(s(this,Ur),s(this,Wi),s(this,Zi))}async edit(e){return Ke.editFlairTemplate({id:s(this,Ur),subredditName:s(this,Wi),text:e.text??s(this,Gi),allowableContent:e.allowableContent??s(this,Ji),backgroundColor:e.backgroundColor??s(this,zi),maxEmojis:e.maxEmojis??s(this,Ki),modOnly:e.modOnly??s(this,$i),textColor:e.textColor??s(this,Vi),allowUserEdits:e.allowUserEdits??s(this,Xi)},s(this,Zi))}static async createPostFlairTemplate(e,t){var i;return S(i=Ke,Qi,Ld).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ke,Qi,Ld).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ke,Qi,Ld).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Ur=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Qi=new WeakSet,Ld=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,textColor:f="dark",allowUserEdits:m=!1,id:b=""}=e;if(p&&m)throw new Error("Cannot have a mod only flair that is editable by users");let P=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:g,textColor:f,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ke(P,i,t)},l(Ke,Qi);var de=Ke;function Us(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Vt,hm,fm,Mr=class Mr{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=Mr,Vt,hm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Mr,Vt,hm).call(i,{...e,postId:fe(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Mr,Vt,fm).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Mr,Vt,fm).call(n,e,void 0,t,i)}};Vt=new WeakSet,hm=async function(e,t){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e.subredditName,flairTemplateId:e.flairTemplateId??"",text:e.text??"",name:e.username,link:e.postId,backgroundColor:e.backgroundColor??"",textColor:e.textColor??"dark",cssClass:e.cssClass??"",returnRtjson:"none"},t)},fm=async function(e,t,i,n){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e,name:i??"",link:t??"",flairTemplateId:"",backgroundColor:"",text:"",textColor:"",cssClass:"",returnRtjson:"none"},n)},l(Mr,Vt);var Me=Mr;function PR(r){if(v(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function CR(r){if(!r||r.length===0||r==="transparent")return"transparent";if(/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function wR(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as MR}from"@devvit/protos";var dS=Mn(aS(),1);var ym=r=>"text"in r?OR(r.text):BR(r.richtext),OR=r=>new Wt().paragraph(e=>{e.text({text:r})}).build(),BR=r=>r instanceof Wt?r.build():typeof r=="object"?JSON.stringify(r):r;var Yi,Ds,en,Ns,_s,Hs,qs,js,Dr,Ws,Gs,Vs,zs,Js,$s,zt,Ks,Xs,Nr,tn,Jt,rn,nn,sn,$t,Kt,Xt,on,Zt,Qt,Yt,yt,Zs,Qs,an,dn,N,_=class _{constructor(e,t){l(this,Yi);l(this,Ds);l(this,en);l(this,Ns);l(this,_s);l(this,Hs);l(this,qs);l(this,js);l(this,Dr);l(this,Ws);l(this,Gs);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,zt);l(this,Ks);l(this,Xs);l(this,Nr);l(this,tn);l(this,Jt);l(this,rn);l(this,nn);l(this,sn);l(this,$t);l(this,Kt);l(this,Xt);l(this,on);l(this,Zt);l(this,Qt);l(this,Yt);l(this,yt);l(this,Zs);l(this,Qs);l(this,an);l(this,dn);l(this,N);Q(this),v(e.id,"Post is missing id"),v(e.title,"Post is missing title"),v(e.createdUtc,"Post is missing created date"),v(e.author,"Post is missing author name"),v(e.subreddit,"Post is missing subreddit name"),v(e.subredditId,"Post is missing subreddit id"),v(e.url,"Post is missing url"),v(e.permalink,"Post is missing permalink"),d(this,Yi,fe(`t3_${e.id}`)),d(this,en,e.author),d(this,Ds,e.authorFullname?ne(e.authorFullname):void 0),d(this,_s,Ae(e.subredditId)),d(this,Hs,e.subreddit),d(this,Vs,e.score??0),d(this,zs,e.numComments??0),d(this,Js,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ns,i),d(this,js,e.title),d(this,Dr,e.selftext),d(this,Ws,e.selftextHtml),d(this,Gs,e.url),d(this,qs,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,$s,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,zt,e.approved??!1),d(this,Ks,e.approvedAtUtc??0),d(this,Xs,e.bannedAtUtc??0),d(this,Jt,e.removed??!1),d(this,rn,e.removedBy),d(this,nn,e.removedByCategory),d(this,Nr,e.spam??!1),d(this,tn,e.stickied??!1),d(this,sn,e.archived??!1),d(this,$t,e.edited??!1),d(this,Kt,e.locked??!1),d(this,Xt,e.over18??!1),d(this,on,e.quarantine??!1),d(this,Zt,e.spoiler),d(this,Qt,e.hidden??!1),d(this,Yt,e.ignoreReports??!1),d(this,yt,e.distinguished),d(this,Qs,e.secureMedia),d(this,an,(e.modReports??[]).map(([n])=>n)),d(this,dn,(e.userReports??[]).map(([n])=>n)),d(this,N,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,Zs,{backgroundColor:e.linkFlairBackgroundColor,cssClass:e.linkFlairCssClass,text:e.linkFlairText,type:e.linkFlairType,templateId:e.linkFlairTemplateId,richtext:(e.linkFlairRichtext??[]).map(({e:n,t:o,a,u:c})=>({elementType:n,text:o,emojiRef:a,url:c})),textColor:e.linkFlairTextColor})}get id(){return s(this,Yi)}get authorId(){return s(this,Ds)}get authorName(){return s(this,en)}get subredditId(){return s(this,_s)}get subredditName(){return s(this,Hs)}get permalink(){return s(this,qs)}get title(){return s(this,js)}get body(){return s(this,Dr)}get bodyHtml(){return s(this,Ws)}get url(){return s(this,Gs)}get thumbnail(){return s(this,$s)}get createdAt(){return s(this,Ns)}get score(){return s(this,Vs)}get numberOfComments(){return s(this,zs)}get numberOfReports(){return s(this,Js)}get approved(){return s(this,zt)}get approvedAtUtc(){return s(this,Ks)}get bannedAtUtc(){return s(this,Xs)}get spam(){return s(this,Nr)}get stickied(){return s(this,tn)}get removed(){return s(this,Jt)}get removedBy(){return s(this,rn)}get removedByCategory(){return s(this,nn)}get archived(){return s(this,sn)}get edited(){return s(this,$t)}get locked(){return s(this,Kt)}get nsfw(){return s(this,Xt)}get quarantined(){return s(this,on)}get spoiler(){return s(this,Zt)}get hidden(){return s(this,Qt)}get ignoringReports(){return s(this,Yt)}get distinguishedBy(){return s(this,yt)}get comments(){return ee.getComments({postId:this.id},s(this,N))}get flair(){return s(this,Zs)}get secureMedia(){return s(this,Qs)}get userReportReasons(){return s(this,dn)}get modReportReasons(){return s(this,an)}toJSON(){return{id:this.id,authorId:this.authorId,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,permalink:this.permalink,title:this.title,body:this.body,bodyHtml:this.bodyHtml,url:this.url,thumbnail:this.thumbnail,score:this.score,numberOfComments:this.numberOfComments,numberOfReports:this.numberOfReports,createdAt:this.createdAt,approved:this.approved,spam:this.spam,stickied:this.stickied,removed:this.removed,removedBy:s(this,rn),removedByCategory:s(this,nn),archived:this.archived,edited:this.edited,locked:this.locked,nsfw:this.nsfw,quarantined:this.quarantined,spoiler:this.spoiler,hidden:this.hidden,ignoringReports:this.ignoringReports,distinguishedBy:this.distinguishedBy,flair:this.flair,secureMedia:this.secureMedia,modReportReasons:s(this,an),userReportReasons:s(this,dn)}}isApproved(){return s(this,zt)}isSpam(){return s(this,Nr)}isStickied(){return s(this,tn)}isRemoved(){return s(this,Jt)}isArchived(){return s(this,sn)}isEdited(){return s(this,$t)}isLocked(){return s(this,Kt)}isNsfw(){return s(this,Xt)}isQuarantined(){return s(this,on)}isSpoiler(){return s(this,Zt)}isHidden(){return s(this,Qt)}isIgnoringReports(){return s(this,Yt)}isDistinguishedBy(){return s(this,yt)}async edit(e){let t=await _.edit({id:this.id,...e},s(this,N));d(this,Dr,t.body),d(this,$t,t.edited)}async setTextFallback(e){let t=await _.setTextFallback(e,this.id,s(this,N));d(this,Dr,t.body),d(this,$t,t.edited)}async addComment(e){return ee.submit({id:this.id,...e},s(this,N))}async delete(){return _.delete(this.id,s(this,N))}async approve(){await _.approve(this.id,s(this,N)),d(this,zt,!0),d(this,Jt,!1)}async remove(e=!1){await _.remove(this.id,e,s(this,N)),d(this,Jt,!0),d(this,Nr,e),d(this,zt,!1)}async lock(){await _.lock(this.id,s(this,N)),d(this,Kt,!0)}async unlock(){await _.unlock(this.id,s(this,N)),d(this,Kt,!1)}async hide(){await _.hide(this.id,s(this,N)),d(this,Qt,!0)}async unhide(){await _.unhide(this.id,s(this,N)),d(this,Qt,!1)}async markAsNsfw(){await _.markAsNsfw(this.id,s(this,N)),d(this,Xt,!0)}async unmarkAsNsfw(){await _.unmarkAsNsfw(this.id,s(this,N)),d(this,Xt,!1)}async markAsSpoiler(){await _.markAsSpoiler(this.id,s(this,N)),d(this,Zt,!0)}async unmarkAsSpoiler(){await _.unmarkAsSpoiler(this.id,s(this,N)),d(this,Zt,!1)}async sticky(e){await _.sticky(this.id,e,s(this,N))}async unsticky(){await _.unsticky(this.id,s(this,N))}async distinguish(){let{distinguishedBy:e}=await _.distinguish(this.id,!1,s(this,N));d(this,yt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await _.distinguish(this.id,!0,s(this,N));d(this,yt,e)}async undistinguish(){let{distinguishedBy:e}=await _.undistinguish(this.id,s(this,N));d(this,yt,e)}async ignoreReports(){await _.ignoreReports(this.id,s(this,N)),d(this,Yt,!0)}async unignoreReports(){await _.unignoreReports(this.id,s(this,N)),d(this,Yt,!1)}async getAuthor(){return x.getByUsername(s(this,en),s(this,N))}async crosspost(e){return _.crosspost({...e,postId:this.id},s(this,N))}addRemovalNote(e){return Be.addRemovalNote({itemIds:[s(this,Yi)],...e},s(this,N))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=mr(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new _(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){v(t,"Missing metadata in `SubmitPostOptions`");let c=await new pt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=MR.encode(c).finish(),{textFallback:g,...f}=e,m=g?ym(g):"",b={kind:"custom",sr:e.subredditName,richtextJson:(0,dS.fromByteArray)(p),richtextFallback:m,...f};n=await i.SubmitCustomPost(b,t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?Hi(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return _.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=u.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,c=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:fe(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return _.getById(`t3_${c.json.data.id}`,t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=Hi(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return _.getById(n,t)}static async setTextFallback(e,t,i){if(!("text"in e)&&!("richtext"in e))throw new Error(`No text fallback provided for post ${t}.`);let n=u.redditAPIPlugins.LinksAndComments,o=ym(e);if((await n.EditCustomPost({thingId:t,richtextFallback:o},i)).json?.errors?.length)throw new Error("Failed to set post text fallback");return _.getById(t,i)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await u.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await u.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:t?"admin":"yes",sticky:!1},i)).json?.data?.things?.[0]?.data;return v(a),{distinguishedBy:a.distinguished}}static async undistinguish(e,t){let o=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return v(o),{distinguishedBy:o.distinguished}}static async ignoreReports(e,t){await u.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await u.redditAPIPlugins.Moderation.UnignoreReports({id:e},t)}static getControversialPosts(e={},t){return this.getSortedPosts({...e,sort:"controversial"},t)}static getTopPosts(e={},t){return this.getSortedPosts({...e,sort:"top"},t)}static getSortedPosts(e,t){let i=u.redditAPIPlugins.Listings;return new G({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new G({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new G({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new G({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new G({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ls(o,t)}})}};Yi=new WeakMap,Ds=new WeakMap,en=new WeakMap,Ns=new WeakMap,_s=new WeakMap,Hs=new WeakMap,qs=new WeakMap,js=new WeakMap,Dr=new WeakMap,Ws=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,zt=new WeakMap,Ks=new WeakMap,Xs=new WeakMap,Nr=new WeakMap,tn=new WeakMap,Jt=new WeakMap,rn=new WeakMap,nn=new WeakMap,sn=new WeakMap,$t=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,on=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Yt=new WeakMap,yt=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,an=new WeakMap,dn=new WeakMap,N=new WeakMap;var z=_;function Ls(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new z(i.data,e)),before:r.data.before,after:r.data.after}}var UR=(H=>(H.Custom="CUSTOM",H.Reddit="REDDIT",H.Instagram="INSTAGRAM",H.Twitter="TWITTER",H.Tiktok="TIKTOK",H.Twitch="TWITCH",H.Facebook="FACEBOOK",H.Youtube="YOUTUBE",H.Tumblr="TUMBLR",H.Spotify="SPOTIFY",H.Soundcloud="SOUNDCLOUD",H.Beacons="BEACONS",H.Linktree="LINKTREE",H.Discord="DISCORD",H.Venmo="VENMO",H.CashApp="CASH_APP",H.Patreon="PATREON",H.Kofi="KOFI",H.Paypal="PAYPAL",H.Cameo="CAMEO",H.Onlyfans="ONLYFANS",H.Substack="SUBSTACK",H.Kickstarter="KICKSTARTER",H.Indiegogo="INDIEGOGO",H.BuyMeACoffee="BUY_ME_A_COFFEE",H.Shopify="SHOPIFY",H))(UR||{}),Ys,ln,eo,to,ro,io,no,er,so,oo,ot,_r=class _r{constructor(e,t){l(this,Ys);l(this,ln);l(this,eo);l(this,to);l(this,ro);l(this,io);l(this,no);l(this,er,new Map);l(this,so);l(this,oo);l(this,ot);Q(this),v(e.id,"User ID is missing or undefined"),v(e.name,"Username is missing or undefined"),v(e.createdUtc,"User is missing created date"),d(this,Ys,ne(Ka(e.id)?e.id:`t2_${e.id}`)),d(this,ln,e.name),d(this,io,e.over18??!1),d(this,no,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,eo,i),d(this,to,e.linkKarma??0),d(this,ro,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,er).set(n,nS(o));d(this,so,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,oo,e.subreddit?.url??""),d(this,ot,t)}get id(){return s(this,Ys)}get username(){return s(this,ln)}get createdAt(){return s(this,eo)}get linkKarma(){return s(this,to)}get commentKarma(){return s(this,ro)}get nsfw(){return s(this,io)}get isAdmin(){return s(this,no)}get modPermissions(){return s(this,er)}get url(){return s(this,so)}get permalink(){return s(this,oo)}toJSON(){return{id:this.id,username:this.username,createdAt:this.createdAt,linkKarma:this.linkKarma,commentKarma:this.commentKarma,nsfw:this.nsfw,modPermissionsBySubreddit:Object.fromEntries(this.modPermissions)}}async getModPermissionsForSubreddit(e){if(s(this,er).has(e))return s(this,er).get(e);let t=await _r.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ot)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,er).set(e,i),i}getComments(e){return ee.getCommentsByUser({username:this.username,...e},s(this,ot))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,ot))}async getUserFlairBySubreddit(e){let t=await Me.getUserFlairBySubreddit({subreddit:e,name:s(this,ln)},s(this,ot));return t.users[0]?Us(t.users[0]):void 0}getSnoovatarUrl(){return _r.getSnoovatarUrl(this.username,s(this,ot))}async getSocialLinks(){let i=await Ne.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,ot));return i.data?.user?.profile?.socialLinks?i.data.user.profile.socialLinks.map(n=>({...n,handle:n.handle??void 0})):[]}static async getById(e,t){let o=(await u.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return o==null?void 0:_r.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new _r(n.data,t)}static async getFromMetadata(e,t){v(t);let i=t?.[e]?.values[0];return i?_r.getById(ne(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new G({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return DR(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,g=await i.Friend({type:n,subreddit:o,name:a,permissions:c?gm(c):void 0,...p},t);if(g.json?.errors?.length)throw new Error(g.json.errors.join(`
4
4
  `))}static async removeRelationship(e,t){await u.redditAPIPlugins.Users.Unfriend({type:e.type,subreddit:e.subredditName,name:e.username},t)}static async setModeratorPermissions(e,t,i,n){let a=await u.redditAPIPlugins.Users.SetPermissions({subreddit:t,name:e,type:"moderator",permissions:gm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`