@devvit/public-api 0.11.0-next-2024-08-19-689d51fc5.0 → 0.11.0-next-2024-08-20-c3829a8bb.0

Sign up to get free protection for your applications and to get access to all the features.
package/public-api.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var PS=Object.create;var Lm=Object.defineProperty;var CS=Object.getOwnPropertyDescriptor;var wS=Object.getOwnPropertyNames;var IS=Object.getPrototypeOf,FS=Object.prototype.hasOwnProperty;var Dm=r=>{throw TypeError(r)};var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var xS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of wS(e))!FS.call(r,n)&&n!==t&&Lm(r,n,{get:()=>e[n],enumerable:!(i=CS(e,n))||i.enumerable});return r};var Nn=(r,e,t)=>(t=r!=null?PS(IS(r)):{},xS(e||!r||!r.__esModule?Lm(t,"default",{value:r,enumerable:!0}):t,r));var gl=(r,e,t)=>e.has(r)||Dm("Cannot "+t);var s=(r,e,t)=>(gl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Dm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(gl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(gl(r,e,"access private method"),t);var ae=f((tO,_m)=>{_m.exports=function(r){try{return!!r()}catch{return!0}}});var ba=f((rO,Nm)=>{var AS=ae();Nm.exports=!AS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=f((iO,jm)=>{var qm=ba(),Hm=Function.prototype,hl=Hm.call,TS=qm&&Hm.bind.bind(hl,hl);jm.exports=qm?TS:function(r){return function(){return hl.apply(r,arguments)}}});var Gm=f((nO,Wm)=>{var ES=Math.ceil,RS=Math.floor;Wm.exports=Math.trunc||function(e){var t=+e;return(t>0?RS:ES)(t)}});var ka=f((sO,Vm)=>{var OS=Gm();Vm.exports=function(r){var e=+r;return e!==e||e===0?0:OS(e)}});var pe=f((oO,zm)=>{var Sa=function(r){return r&&r.Math==Math&&r};zm.exports=Sa(typeof globalThis=="object"&&globalThis)||Sa(typeof window=="object"&&window)||Sa(typeof self=="object"&&self)||Sa(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=f((aO,Jm)=>{Jm.exports=!1});var Pa=f((dO,Km)=>{var $m=pe(),BS=Object.defineProperty;Km.exports=function(r,e){try{BS($m,r,{value:e,configurable:!0,writable:!0})}catch{$m[r]=e}return e}});var Ca=f((lO,Zm)=>{var MS=pe(),US=Pa(),Xm="__core-js_shared__",LS=MS[Xm]||US(Xm,{});Zm.exports=LS});var fl=f((uO,Qm)=>{var DS=Wr(),Ym=Ca();(Qm.exports=function(r,e){return Ym[r]||(Ym[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:DS?"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 wa=f((cO,ep)=>{ep.exports=function(r){return r==null}});var Ia=f((mO,tp)=>{var _S=wa(),NS=TypeError;tp.exports=function(r){if(_S(r))throw NS("Can't call method on "+r);return r}});var qn=f((pO,rp)=>{var qS=Ia(),HS=Object;rp.exports=function(r){return HS(qS(r))}});var we=f((gO,ip)=>{var jS=Z(),WS=qn(),GS=jS({}.hasOwnProperty);ip.exports=Object.hasOwn||function(e,t){return GS(WS(e),t)}});var vl=f((hO,np)=>{var VS=Z(),zS=0,JS=Math.random(),$S=VS(1 .toString);np.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+$S(++zS+JS,36)}});var op=f((fO,sp)=>{sp.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var pp=f((vO,mp)=>{var cp=pe(),yl=op(),ap=cp.process,dp=cp.Deno,lp=ap&&ap.versions||dp&&dp.version,up=lp&&lp.v8,We,Fa;up&&(We=up.split("."),Fa=We[0]>0&&We[0]<4?1:+(We[0]+We[1]));!Fa&&yl&&(We=yl.match(/Edge\/(\d+)/),(!We||We[1]>=74)&&(We=yl.match(/Chrome\/(\d+)/),We&&(Fa=+We[1])));mp.exports=Fa});var bl=f((yO,hp)=>{var gp=pp(),KS=ae();hp.exports=!!Object.getOwnPropertySymbols&&!KS(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&gp&&gp<41})});var kl=f((bO,fp)=>{var XS=bl();fp.exports=XS&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=f((kO,yp)=>{var ZS=pe(),YS=fl(),vp=we(),QS=vl(),eP=bl(),tP=kl(),Gr=ZS.Symbol,Sl=YS("wks"),rP=tP?Gr.for||Gr:Gr&&Gr.withoutSetter||QS;yp.exports=function(r){return vp(Sl,r)||(Sl[r]=eP&&vp(Gr,r)?Gr[r]:rP("Symbol."+r)),Sl[r]}});var Sp=f((SO,kp)=>{var iP=Ie(),nP=iP("toStringTag"),bp={};bp[nP]="z";kp.exports=String(bp)==="[object z]"});var Cl=f((PO,Pp)=>{var Pl=typeof document=="object"&&document.all,sP=typeof Pl>"u"&&Pl!==void 0;Pp.exports={all:Pl,IS_HTMLDDA:sP}});var Y=f((CO,wp)=>{var Cp=Cl(),oP=Cp.all;wp.exports=Cp.IS_HTMLDDA?function(r){return typeof r=="function"||r===oP}:function(r){return typeof r=="function"}});var xa=f((wO,Fp)=>{var Ip=Z(),aP=Ip({}.toString),dP=Ip("".slice);Fp.exports=function(r){return dP(aP(r),8,-1)}});var Hn=f((IO,xp)=>{var lP=Sp(),uP=Y(),Aa=xa(),cP=Ie(),mP=cP("toStringTag"),pP=Object,gP=Aa(function(){return arguments}())=="Arguments",hP=function(r,e){try{return r[e]}catch{}};xp.exports=lP?Aa:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=hP(e=pP(r),mP))=="string"?t:gP?Aa(e):(i=Aa(e))=="Object"&&uP(e.callee)?"Arguments":i}});var jn=f((FO,Ap)=>{var fP=Hn(),vP=String;Ap.exports=function(r){if(fP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return vP(r)}});var Il=f((xO,Rp)=>{var wl=Z(),yP=ka(),bP=jn(),kP=Ia(),SP=wl("".charAt),Tp=wl("".charCodeAt),PP=wl("".slice),Ep=function(r){return function(e,t){var i=bP(kP(e)),n=yP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Tp(i,n),a<55296||a>56319||n+1===o||(c=Tp(i,n+1))<56320||c>57343?r?SP(i,n):a:r?PP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Rp.exports={codeAt:Ep(!1),charAt:Ep(!0)}});var Mp=f((AO,Bp)=>{var CP=pe(),wP=Y(),Op=CP.WeakMap;Bp.exports=wP(Op)&&/native code/.test(String(Op))});var It=f((TO,Dp)=>{var Up=Y(),Lp=Cl(),IP=Lp.all;Dp.exports=Lp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Up(r)||r===IP}:function(r){return typeof r=="object"?r!==null:Up(r)}});var ge=f((EO,_p)=>{var FP=ae();_p.exports=!FP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var xl=f((RO,qp)=>{var xP=pe(),Np=It(),Fl=xP.document,AP=Np(Fl)&&Np(Fl.createElement);qp.exports=function(r){return AP?Fl.createElement(r):{}}});var Al=f((OO,Hp)=>{var TP=ge(),EP=ae(),RP=xl();Hp.exports=!TP&&!EP(function(){return Object.defineProperty(RP("div"),"a",{get:function(){return 7}}).a!=7})});var Tl=f((BO,jp)=>{var OP=ge(),BP=ae();jp.exports=OP&&BP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Qe=f((MO,Wp)=>{var MP=It(),UP=String,LP=TypeError;Wp.exports=function(r){if(MP(r))return r;throw LP(UP(r)+" is not an object")}});var Ge=f((UO,Gp)=>{var DP=ba(),Ta=Function.prototype.call;Gp.exports=DP?Ta.bind(Ta):function(){return Ta.apply(Ta,arguments)}});var Wn=f((LO,Vp)=>{var El=pe(),_P=Y(),NP=function(r){return _P(r)?r:void 0};Vp.exports=function(r,e){return arguments.length<2?NP(El[r]):El[r]&&El[r][e]}});var Rl=f((DO,zp)=>{var qP=Z();zp.exports=qP({}.isPrototypeOf)});var Ol=f((_O,Jp)=>{var HP=Wn(),jP=Y(),WP=Rl(),GP=kl(),VP=Object;Jp.exports=GP?function(r){return typeof r=="symbol"}:function(r){var e=HP("Symbol");return jP(e)&&WP(e.prototype,VP(r))}});var Bl=f((NO,$p)=>{var zP=String;$p.exports=function(r){try{return zP(r)}catch{return"Object"}}});var Ea=f((qO,Kp)=>{var JP=Y(),$P=Bl(),KP=TypeError;Kp.exports=function(r){if(JP(r))return r;throw KP($P(r)+" is not a function")}});var Ra=f((HO,Xp)=>{var XP=Ea(),ZP=wa();Xp.exports=function(r,e){var t=r[e];return ZP(t)?void 0:XP(t)}});var Yp=f((jO,Zp)=>{var Ml=Ge(),Ul=Y(),Ll=It(),YP=TypeError;Zp.exports=function(r,e){var t,i;if(e==="string"&&Ul(t=r.toString)&&!Ll(i=Ml(t,r))||Ul(t=r.valueOf)&&!Ll(i=Ml(t,r))||e!=="string"&&Ul(t=r.toString)&&!Ll(i=Ml(t,r)))return i;throw YP("Can't convert object to primitive value")}});var rg=f((WO,tg)=>{var QP=Ge(),Qp=It(),eg=Ol(),eC=Ra(),tC=Yp(),rC=Ie(),iC=TypeError,nC=rC("toPrimitive");tg.exports=function(r,e){if(!Qp(r)||eg(r))return r;var t=eC(r,nC),i;if(t){if(e===void 0&&(e="default"),i=QP(t,r,e),!Qp(i)||eg(i))return i;throw iC("Can't convert object to primitive value")}return e===void 0&&(e="number"),tC(r,e)}});var Oa=f((GO,ig)=>{var sC=rg(),oC=Ol();ig.exports=function(r){var e=sC(r,"string");return oC(e)?e:e+""}});var et=f(sg=>{var aC=ge(),dC=Al(),lC=Tl(),Ba=Qe(),ng=Oa(),uC=TypeError,Dl=Object.defineProperty,cC=Object.getOwnPropertyDescriptor,_l="enumerable",Nl="configurable",ql="writable";sg.f=aC?lC?function(e,t,i){if(Ba(e),t=ng(t),Ba(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ql in i&&!i[ql]){var n=cC(e,t);n&&n[ql]&&(e[t]=i.value,i={configurable:Nl in i?i[Nl]:n[Nl],enumerable:_l in i?i[_l]:n[_l],writable:!1})}return Dl(e,t,i)}:Dl:function(e,t,i){if(Ba(e),t=ng(t),Ba(i),dC)try{return Dl(e,t,i)}catch{}if("get"in i||"set"in i)throw uC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=f((zO,og)=>{og.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ma=f((JO,ag)=>{var mC=ge(),pC=et(),gC=Vr();ag.exports=mC?function(r,e,t){return pC.f(r,e,gC(1,t))}:function(r,e,t){return r[e]=t,r}});var Ua=f(($O,lg)=>{var hC=fl(),fC=vl(),dg=hC("keys");lg.exports=function(r){return dg[r]||(dg[r]=fC(r))}});var La=f((KO,ug)=>{ug.exports={}});var zr=f((XO,pg)=>{var vC=Mp(),mg=pe(),yC=It(),bC=Ma(),Hl=we(),jl=Ca(),kC=Ua(),SC=La(),cg="Object already initialized",Wl=mg.TypeError,PC=mg.WeakMap,Da,Gn,_a,CC=function(r){return _a(r)?Gn(r):Da(r,{})},wC=function(r){return function(e){var t;if(!yC(e)||(t=Gn(e)).type!==r)throw Wl("Incompatible receiver, "+r+" required");return t}};vC||jl.state?(Ve=jl.state||(jl.state=new PC),Ve.get=Ve.get,Ve.has=Ve.has,Ve.set=Ve.set,Da=function(r,e){if(Ve.has(r))throw Wl(cg);return e.facade=r,Ve.set(r,e),e},Gn=function(r){return Ve.get(r)||{}},_a=function(r){return Ve.has(r)}):(sr=kC("state"),SC[sr]=!0,Da=function(r,e){if(Hl(r,sr))throw Wl(cg);return e.facade=r,bC(r,sr,e),e},Gn=function(r){return Hl(r,sr)?r[sr]:{}},_a=function(r){return Hl(r,sr)});var Ve,sr;pg.exports={set:Da,get:Gn,has:_a,enforce:CC,getterFor:wC}});var Gl=f(fg=>{"use strict";var gg={}.propertyIsEnumerable,hg=Object.getOwnPropertyDescriptor,IC=hg&&!gg.call({1:2},1);fg.f=IC?function(e){var t=hg(this,e);return!!t&&t.enumerable}:gg});var zl=f((YO,vg)=>{var FC=Z(),xC=ae(),AC=xa(),Vl=Object,TC=FC("".split);vg.exports=xC(function(){return!Vl("z").propertyIsEnumerable(0)})?function(r){return AC(r)=="String"?TC(r,""):Vl(r)}:Vl});var Jr=f((QO,yg)=>{var EC=zl(),RC=Ia();yg.exports=function(r){return EC(RC(r))}});var Jl=f(kg=>{var OC=ge(),BC=Ge(),MC=Gl(),UC=Vr(),LC=Jr(),DC=Oa(),_C=we(),NC=Al(),bg=Object.getOwnPropertyDescriptor;kg.f=OC?bg:function(e,t){if(e=LC(e),t=DC(t),NC)try{return bg(e,t)}catch{}if(_C(e,t))return UC(!BC(MC.f,e,t),e[t])}});var Xl=f((tB,Pg)=>{var $l=ge(),qC=we(),Sg=Function.prototype,HC=$l&&Object.getOwnPropertyDescriptor,Kl=qC(Sg,"name"),jC=Kl&&function(){}.name==="something",WC=Kl&&(!$l||$l&&HC(Sg,"name").configurable);Pg.exports={EXISTS:Kl,PROPER:jC,CONFIGURABLE:WC}});var Yl=f((rB,Cg)=>{var GC=Z(),VC=Y(),Zl=Ca(),zC=GC(Function.toString);VC(Zl.inspectSource)||(Zl.inspectSource=function(r){return zC(r)});Cg.exports=Zl.inspectSource});var tu=f((iB,Fg)=>{var eu=Z(),JC=ae(),$C=Y(),Na=we(),Ql=ge(),KC=Xl().CONFIGURABLE,XC=Yl(),Ig=zr(),ZC=Ig.enforce,YC=Ig.get,wg=String,qa=Object.defineProperty,QC=eu("".slice),e0=eu("".replace),t0=eu([].join),r0=Ql&&!JC(function(){return qa(function(){},"length",{value:8}).length!==8}),i0=String(String).split("String"),n0=Fg.exports=function(r,e,t){QC(wg(e),0,7)==="Symbol("&&(e="["+e0(wg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Na(r,"name")||KC&&r.name!==e)&&(Ql?qa(r,"name",{value:e,configurable:!0}):r.name=e),r0&&t&&Na(t,"arity")&&r.length!==t.arity&&qa(r,"length",{value:t.arity});try{t&&Na(t,"constructor")&&t.constructor?Ql&&qa(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=ZC(r);return Na(i,"source")||(i.source=t0(i0,typeof e=="string"?e:"")),r};Function.prototype.toString=n0(function(){return $C(this)&&YC(this).source||XC(this)},"toString")});var or=f((nB,xg)=>{var s0=Y(),o0=et(),a0=tu(),d0=Pa();xg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(s0(t)&&a0(t,o,i),i.global)n?r[e]=t:d0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:o0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var ru=f((sB,Ag)=>{var l0=ka(),u0=Math.max,c0=Math.min;Ag.exports=function(r,e){var t=l0(r);return t<0?u0(t+e,0):c0(t,e)}});var Eg=f((oB,Tg)=>{var m0=ka(),p0=Math.min;Tg.exports=function(r){return r>0?p0(m0(r),9007199254740991):0}});var Ha=f((aB,Rg)=>{var g0=Eg();Rg.exports=function(r){return g0(r.length)}});var Mg=f((dB,Bg)=>{var h0=Jr(),f0=ru(),v0=Ha(),Og=function(r){return function(e,t,i){var n=h0(e),o=v0(n),a=f0(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}};Bg.exports={includes:Og(!0),indexOf:Og(!1)}});var nu=f((lB,Lg)=>{var y0=Z(),iu=we(),b0=Jr(),k0=Mg().indexOf,S0=La(),Ug=y0([].push);Lg.exports=function(r,e){var t=b0(r),i=0,n=[],o;for(o in t)!iu(S0,o)&&iu(t,o)&&Ug(n,o);for(;e.length>i;)iu(t,o=e[i++])&&(~k0(n,o)||Ug(n,o));return n}});var ja=f((uB,Dg)=>{Dg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Ng=f(_g=>{var P0=nu(),C0=ja(),w0=C0.concat("length","prototype");_g.f=Object.getOwnPropertyNames||function(e){return P0(e,w0)}});var su=f(qg=>{qg.f=Object.getOwnPropertySymbols});var jg=f((pB,Hg)=>{var I0=Wn(),F0=Z(),x0=Ng(),A0=su(),T0=Qe(),E0=F0([].concat);Hg.exports=I0("Reflect","ownKeys")||function(e){var t=x0.f(T0(e)),i=A0.f;return i?E0(t,i(e)):t}});var Vg=f((gB,Gg)=>{var Wg=we(),R0=jg(),O0=Jl(),B0=et();Gg.exports=function(r,e,t){for(var i=R0(e),n=B0.f,o=O0.f,a=0;a<i.length;a++){var c=i[a];!Wg(r,c)&&!(t&&Wg(t,c))&&n(r,c,o(e,c))}}});var Jg=f((hB,zg)=>{var M0=ae(),U0=Y(),L0=/#|\.prototype\./,Vn=function(r,e){var t=_0[D0(r)];return t==q0?!0:t==N0?!1:U0(e)?M0(e):!!e},D0=Vn.normalize=function(r){return String(r).replace(L0,".").toLowerCase()},_0=Vn.data={},N0=Vn.NATIVE="N",q0=Vn.POLYFILL="P";zg.exports=Vn});var zn=f((fB,$g)=>{var ou=pe(),H0=Jl().f,j0=Ma(),W0=or(),G0=Pa(),V0=Vg(),z0=Jg();$g.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,v;if(i?a=ou:n?a=ou[t]||G0(t,{}):a=(ou[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(v=H0(a,c),p=v&&v.value):p=a[c],o=z0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;V0(g,p)}(r.sham||p&&p.sham)&&j0(g,"sham",!0),W0(a,c,g,r)}}});var au=f((vB,Kg)=>{var J0=nu(),$0=ja();Kg.exports=Object.keys||function(e){return J0(e,$0)}});var Zg=f(Xg=>{var K0=ge(),X0=Tl(),Z0=et(),Y0=Qe(),Q0=Jr(),ew=au();Xg.f=K0&&!X0?Object.defineProperties:function(e,t){Y0(e);for(var i=Q0(t),n=ew(t),o=n.length,a=0,c;o>a;)Z0.f(e,c=n[a++],i[c]);return e}});var Qg=f((bB,Yg)=>{var tw=Wn();Yg.exports=tw("document","documentElement")});var Jn=f((kB,oh)=>{var rw=Qe(),iw=Zg(),eh=ja(),nw=La(),sw=Qg(),ow=xl(),aw=Ua(),th=">",rh="<",lu="prototype",uu="script",nh=aw("IE_PROTO"),du=function(){},sh=function(r){return rh+uu+th+r+rh+"/"+uu+th},ih=function(r){r.write(sh("")),r.close();var e=r.parentWindow.Object;return r=null,e},dw=function(){var r=ow("iframe"),e="java"+uu+":",t;return r.style.display="none",sw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(sh("document.F=Object")),t.close(),t.F},Wa,Ga=function(){try{Wa=new ActiveXObject("htmlfile")}catch{}Ga=typeof document<"u"?document.domain&&Wa?ih(Wa):dw():ih(Wa);for(var r=eh.length;r--;)delete Ga[lu][eh[r]];return Ga()};nw[nh]=!0;oh.exports=Object.create||function(e,t){var i;return e!==null?(du[lu]=rw(e),i=new du,du[lu]=null,i[nh]=e):i=Ga(),t===void 0?i:iw.f(i,t)}});var dh=f((SB,ah)=>{var lw=ae();ah.exports=!lw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var mu=f((PB,uh)=>{var uw=we(),cw=Y(),mw=qn(),pw=Ua(),gw=dh(),lh=pw("IE_PROTO"),cu=Object,hw=cu.prototype;uh.exports=gw?cu.getPrototypeOf:function(r){var e=mw(r);if(uw(e,lh))return e[lh];var t=e.constructor;return cw(t)&&e instanceof t?t.prototype:e instanceof cu?hw:null}});var fu=f((CB,ph)=>{"use strict";var fw=ae(),vw=Y(),yw=It(),bw=Jn(),ch=mu(),kw=or(),Sw=Ie(),Pw=Wr(),hu=Sw("iterator"),mh=!1,ut,pu,gu;[].keys&&(gu=[].keys(),"next"in gu?(pu=ch(ch(gu)),pu!==Object.prototype&&(ut=pu)):mh=!0);var Cw=!yw(ut)||fw(function(){var r={};return ut[hu].call(r)!==r});Cw?ut={}:Pw&&(ut=bw(ut));vw(ut[hu])||kw(ut,hu,function(){return this});ph.exports={IteratorPrototype:ut,BUGGY_SAFARI_ITERATORS:mh}});var $n=f((wB,hh)=>{var ww=et().f,Iw=we(),Fw=Ie(),gh=Fw("toStringTag");hh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Iw(r,gh)&&ww(r,gh,{configurable:!0,value:e})}});var $r=f((IB,fh)=>{fh.exports={}});var vu=f((FB,vh)=>{"use strict";var xw=fu().IteratorPrototype,Aw=Jn(),Tw=Vr(),Ew=$n(),Rw=$r(),Ow=function(){return this};vh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Aw(xw,{next:Tw(+!i,t)}),Ew(r,n,!1,!0),Rw[n]=Ow,r}});var bh=f((xB,yh)=>{var Bw=Y(),Mw=String,Uw=TypeError;yh.exports=function(r){if(typeof r=="object"||Bw(r))return r;throw Uw("Can't set "+Mw(r)+" as a prototype")}});var Sh=f((AB,kh)=>{var Lw=Z(),Dw=Qe(),_w=bh();kh.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Lw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Dw(n),_w(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var bu=f((TB,Rh)=>{"use strict";var Nw=zn(),qw=Ge(),Va=Wr(),Th=Xl(),Hw=Y(),jw=vu(),Ph=mu(),Ch=Sh(),Ww=$n(),Gw=Ma(),yu=or(),Vw=Ie(),wh=$r(),Eh=fu(),zw=Th.PROPER,Jw=Th.CONFIGURABLE,Ih=Eh.IteratorPrototype,za=Eh.BUGGY_SAFARI_ITERATORS,Kn=Vw("iterator"),Fh="keys",Xn="values",xh="entries",Ah=function(){return this};Rh.exports=function(r,e,t,i,n,o,a){jw(t,e,i);var c=function(B){if(B===n&&b)return b;if(!za&&B in v)return v[B];switch(B){case Fh:return function(){return new t(this,B)};case Xn:return function(){return new t(this,B)};case xh:return function(){return new t(this,B)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,v=r.prototype,m=v[Kn]||v["@@iterator"]||n&&v[n],b=!za&&m||c(n),y=e=="Array"&&v.entries||m,C,w,A;if(y&&(C=Ph(y.call(new r)),C!==Object.prototype&&C.next&&(!Va&&Ph(C)!==Ih&&(Ch?Ch(C,Ih):Hw(C[Kn])||yu(C,Kn,Ah)),Ww(C,p,!0,!0),Va&&(wh[p]=Ah))),zw&&n==Xn&&m&&m.name!==Xn&&(!Va&&Jw?Gw(v,"name",Xn):(g=!0,b=function(){return qw(m,this)})),n)if(w={values:c(Xn),keys:o?b:c(Fh),entries:c(xh)},a)for(A in w)(za||g||!(A in v))&&yu(v,A,w[A]);else Nw({target:e,proto:!0,forced:za||g},w);return(!Va||a)&&v[Kn]!==b&&yu(v,Kn,b,{name:n}),wh[e]=b,w}});var ku=f((EB,Oh)=>{Oh.exports=function(r,e){return{value:r,done:e}}});var Lh=f(()=>{"use strict";var $w=Il().charAt,Kw=jn(),Mh=zr(),Xw=bu(),Bh=ku(),Uh="String Iterator",Zw=Mh.set,Yw=Mh.getterFor(Uh);Xw(String,"String",function(r){Zw(this,{type:Uh,string:Kw(r),index:0})},function(){var e=Yw(this),t=e.string,i=e.index,n;return i>=t.length?Bh(void 0,!0):(n=$w(t,i),e.index+=n.length,Bh(n,!1))})});var Su=f((BB,Dh)=>{var Qw=ae(),eI=Ie(),tI=Wr(),rI=eI("iterator");Dh.exports=!Qw(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}),tI&&!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[rI]||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 Nh=f((MB,_h)=>{var iI=xa(),nI=Z();_h.exports=function(r){if(iI(r)==="Function")return nI(r)}});var Ja=f((UB,Hh)=>{var qh=Nh(),sI=Ea(),oI=ba(),aI=qh(qh.bind);Hh.exports=function(r,e){return sI(r),e===void 0?r:oI?aI(r,e):function(){return r.apply(e,arguments)}}});var Gh=f((LB,Wh)=>{var jh=tu(),dI=et();Wh.exports=function(r,e,t){return t.get&&jh(t.get,e,{getter:!0}),t.set&&jh(t.set,e,{setter:!0}),dI.f(r,e,t)}});var Pu=f((DB,Vh)=>{var lI=Rl(),uI=TypeError;Vh.exports=function(r,e){if(lI(e,r))return r;throw uI("Incorrect invocation")}});var Kh=f((_B,$h)=>{"use strict";var zh=ge(),cI=Z(),mI=Ge(),pI=ae(),Cu=au(),gI=su(),hI=Gl(),fI=qn(),vI=zl(),Kr=Object.assign,Jh=Object.defineProperty,yI=cI([].concat);$h.exports=!Kr||pI(function(){if(zh&&Kr({b:1},Kr(Jh({},"a",{enumerable:!0,get:function(){Jh(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||Cu(Kr({},e)).join("")!=i})?function(e,t){for(var i=fI(e),n=arguments.length,o=1,a=gI.f,c=hI.f;n>o;)for(var p=vI(arguments[o++]),g=a?yI(Cu(p),a(p)):Cu(p),v=g.length,m=0,b;v>m;)b=g[m++],(!zh||mI(c,p,b))&&(i[b]=p[b]);return i}:Kr});var Yh=f((NB,Zh)=>{var bI=Ge(),Xh=Qe(),kI=Ra();Zh.exports=function(r,e,t){var i,n;Xh(r);try{if(i=kI(r,"return"),!i){if(e==="throw")throw t;return t}i=bI(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Xh(i),t}});var ef=f((qB,Qh)=>{var SI=Qe(),PI=Yh();Qh.exports=function(r,e,t,i){try{return i?e(SI(t)[0],t[1]):e(t)}catch(n){PI(r,"throw",n)}}});var rf=f((HB,tf)=>{var CI=Ie(),wI=$r(),II=CI("iterator"),FI=Array.prototype;tf.exports=function(r){return r!==void 0&&(wI.Array===r||FI[II]===r)}});var lf=f((jB,df)=>{var xI=Z(),AI=ae(),nf=Y(),TI=Hn(),EI=Wn(),RI=Yl(),sf=function(){},OI=[],of=EI("Reflect","construct"),wu=/^\s*(?:class|function)\b/,BI=xI(wu.exec),MI=!wu.exec(sf),Zn=function(e){if(!nf(e))return!1;try{return of(sf,OI,e),!0}catch{return!1}},af=function(e){if(!nf(e))return!1;switch(TI(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return MI||!!BI(wu,RI(e))}catch{return!0}};af.sham=!0;df.exports=!of||AI(function(){var r;return Zn(Zn.call)||!Zn(Object)||!Zn(function(){r=!0})||r})?af:Zn});var Iu=f((WB,uf)=>{"use strict";var UI=Oa(),LI=et(),DI=Vr();uf.exports=function(r,e,t){var i=UI(e);i in r?LI.f(r,i,DI(0,t)):r[i]=t}});var $a=f((GB,mf)=>{var _I=Hn(),cf=Ra(),NI=wa(),qI=$r(),HI=Ie(),jI=HI("iterator");mf.exports=function(r){if(!NI(r))return cf(r,jI)||cf(r,"@@iterator")||qI[_I(r)]}});var Fu=f((VB,pf)=>{var WI=Ge(),GI=Ea(),VI=Qe(),zI=Bl(),JI=$a(),$I=TypeError;pf.exports=function(r,e){var t=arguments.length<2?JI(r):e;if(GI(t))return VI(WI(t,r));throw $I(zI(r)+" is not iterable")}});var vf=f((zB,ff)=>{"use strict";var KI=Ja(),XI=Ge(),ZI=qn(),YI=ef(),QI=rf(),eF=lf(),tF=Ha(),gf=Iu(),rF=Fu(),iF=$a(),hf=Array;ff.exports=function(e){var t=ZI(e),i=eF(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=KI(o,n>2?arguments[2]:void 0));var c=iF(t),p=0,g,v,m,b,y,C;if(c&&!(this===hf&&QI(c)))for(b=rF(t,c),y=b.next,v=i?new this:[];!(m=XI(y,b)).done;p++)C=a?YI(b,o,[m.value,p],!0):m.value,gf(v,p,C);else for(g=tF(t),v=i?new this(g):hf(g);g>p;p++)C=a?o(t[p],p):t[p],gf(v,p,C);return v.length=p,v}});var xu=f((JB,bf)=>{var yf=ru(),nF=Ha(),sF=Iu(),oF=Array,aF=Math.max;bf.exports=function(r,e,t){for(var i=nF(r),n=yf(e,i),o=yf(t===void 0?i:t,i),a=oF(aF(o-n,0)),c=0;n<o;n++,c++)sF(a,c,r[n]);return a.length=c,a}});var Af=f(($B,xf)=>{var ar=Z(),Au=2147483647,Yn=36,wf=1,Ru=26,dF=38,lF=700,uF=72,cF=128,mF="-",pF=/[^\0-\u007E]/,If=/[.\u3002\uFF0E\uFF61]/g,kf="Overflow: input needs wider integers to process",Tu=Yn-wf,Sf=RangeError,gF=ar(If.exec),Xr=Math.floor,Eu=String.fromCharCode,Pf=ar("".charCodeAt),Ff=ar([].join),Ft=ar([].push),hF=ar("".replace),fF=ar("".split),vF=ar("".toLowerCase),yF=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=Pf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=Pf(r,t++);(o&64512)==56320?Ft(e,((n&1023)<<10)+(o&1023)+65536):(Ft(e,n),t--)}else Ft(e,n)}return e},Cf=function(r){return r+22+75*(r<26)},bF=function(r,e,t){var i=0;for(r=t?Xr(r/lF):r>>1,r+=Xr(r/e);r>Tu*Ru>>1;)r=Xr(r/Tu),i+=Yn;return Xr(i+(Tu+1)*r/(r+dF))},kF=function(r){var e=[];r=yF(r);var t=r.length,i=cF,n=0,o=uF,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&Ft(e,Eu(c));var p=e.length,g=p;for(p&&Ft(e,mF);g<t;){var v=Au;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=g+1;if(v-i>Xr((Au-n)/m))throw Sf(kf);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Au)throw Sf(kf);if(c==i){for(var b=n,y=Yn;;){var C=y<=o?wf:y>=o+Ru?Ru:y-o;if(b<C)break;var w=b-C,A=Yn-C;Ft(e,Eu(Cf(C+w%A))),b=Xr(w/A),y+=Yn}Ft(e,Eu(Cf(b))),o=bF(n,m,g==p),n=0,g++}}n++,i++}return Ff(e,"")};xf.exports=function(r){var e=[],t=fF(hF(vF(r),If,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],Ft(e,gF(pF,n)?"xn--"+kF(n):n);return Ff(e,".")}});var Ou=f((KB,Tf)=>{var SF=TypeError;Tf.exports=function(r,e){if(r<e)throw SF("Not enough arguments");return r}});var Rf=f((XB,Ef)=>{var PF=Ie(),CF=Jn(),wF=et().f,Bu=PF("unscopables"),Mu=Array.prototype;Mu[Bu]==null&&wF(Mu,Bu,{configurable:!0,value:CF(null)});Ef.exports=function(r){Mu[Bu][r]=!0}});var Df=f((ZB,Lf)=>{"use strict";var IF=Jr(),Uu=Rf(),Of=$r(),Mf=zr(),FF=et().f,xF=bu(),Ka=ku(),AF=Wr(),TF=ge(),Uf="Array Iterator",EF=Mf.set,RF=Mf.getterFor(Uf);Lf.exports=xF(Array,"Array",function(r,e){EF(this,{type:Uf,target:IF(r),index:0,kind:e})},function(){var r=RF(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Ka(void 0,!0)):t=="keys"?Ka(i,!1):t=="values"?Ka(e[i],!1):Ka([i,e[i]],!1)},"values");var Bf=Of.Arguments=Of.Array;Uu("keys");Uu("values");Uu("entries");if(!AF&&TF&&Bf.name!=="values")try{FF(Bf,"name",{value:"values"})}catch{}});var Nf=f((YB,_f)=>{var OF=or();_f.exports=function(r,e,t){for(var i in e)OF(r,i,e[i],t);return r}});var jf=f((QB,Hf)=>{var qf=xu(),BF=Math.floor,Lu=function(r,e){var t=r.length,i=BF(t/2);return t<8?MF(r,e):UF(r,Lu(qf(r,0,i),e),Lu(qf(r,i),e),e)},MF=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},UF=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};Hf.exports=Lu});var zu=f((eM,dv)=>{"use strict";Df();var Hu=zn(),Yr=pe(),Xa=Ge(),tt=Z(),LF=ge(),ev=Su(),tv=or(),DF=Nf(),_F=$n(),NF=vu(),Gu=zr(),rv=Pu(),Du=Y(),qF=we(),HF=Ja(),jF=Hn(),WF=Qe(),iv=It(),he=jn(),GF=Jn(),Wf=Vr(),ju=Fu(),VF=$a(),Zr=Ou(),zF=Ie(),JF=jf(),$F=zF("iterator"),ts="URLSearchParams",nv=ts+"Iterator",sv=Gu.set,ze=Gu.getterFor(ts),KF=Gu.getterFor(nv),XF=Object.getOwnPropertyDescriptor,Vu=function(r){if(!LF)return Yr[r];var e=XF(Yr,r);return e&&e.value},Gf=Vu("fetch"),Ya=Vu("Request"),Qn=Vu("Headers"),_u=Ya&&Ya.prototype,Vf=Qn&&Qn.prototype,ZF=Yr.RegExp,YF=Yr.TypeError,ov=Yr.decodeURIComponent,QF=Yr.encodeURIComponent,ex=tt("".charAt),zf=tt([].join),dr=tt([].push),Wu=tt("".replace),tx=tt([].shift),Jf=tt([].splice),$f=tt("".split),rx=tt("".slice),ix=/\+/g,Kf=Array(4),nx=function(r){return Kf[r-1]||(Kf[r-1]=ZF("((?:%[\\da-f]{2}){"+r+"})","gi"))},sx=function(r){try{return ov(r)}catch{return r}},Xf=function(r){var e=Wu(r,ix," "),t=4;try{return ov(e)}catch{for(;t;)e=Wu(e,nx(t--),sx);return e}},ox=/[!'()~]|%20/g,ax={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},dx=function(r){return ax[r]},Zf=function(r){return Wu(QF(r),ox,dx)},Nu=NF(function(e,t){sv(this,{type:nv,iterator:ju(ze(e).entries),kind:t})},"Iterator",function(){var e=KF(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),av=function(r){this.entries=[],this.url=null,r!==void 0&&(iv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?ex(r,0)==="?"?rx(r,1):r:he(r)))};av.prototype={type:ts,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=VF(r),t,i,n,o,a,c,p;if(e)for(t=ju(r,e),i=t.next;!(n=Xa(i,t)).done;){if(o=ju(WF(n.value)),a=o.next,(c=Xa(a,o)).done||(p=Xa(a,o)).done||!Xa(a,o).done)throw YF("Expected sequence with length 2");dr(this.entries,{key:he(c.value),value:he(p.value)})}else for(var g in r)qF(r,g)&&dr(this.entries,{key:g,value:he(r[g])})},parseQuery:function(r){if(r)for(var e=$f(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=$f(i,"="),dr(this.entries,{key:Xf(tx(n)),value:Xf(zf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],dr(e,Zf(i.key)+"="+Zf(i.value));return zf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Qa=function(){rv(this,es);var e=arguments.length>0?arguments[0]:void 0;sv(this,new av(e))},es=Qa.prototype;DF(es,{append:function(e,t){Zr(arguments.length,2);var i=ze(this);dr(i.entries,{key:he(e),value:he(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=ze(this),t=e.entries,i=he(r),n=0;n<t.length;)t[n].key===i?Jf(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=ze(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=ze(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=ze(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=ze(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?Jf(n,p--,1):(o=!0,g.value=c));o||dr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=ze(this);JF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=ze(this).entries,i=HF(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 Nu(this,"keys")},values:function(){return new Nu(this,"values")},entries:function(){return new Nu(this,"entries")}},{enumerable:!0});tv(es,$F,es.entries,{name:"entries"});tv(es,"toString",function(){return ze(this).serialize()},{enumerable:!0});_F(Qa,ts);Hu({global:!0,constructor:!0,forced:!ev},{URLSearchParams:Qa});!ev&&Du(Qn)&&(Yf=tt(Vf.has),Qf=tt(Vf.set),qu=function(r){if(iv(r)){var e=r.body,t;if(jF(e)===ts)return t=r.headers?new Qn(r.headers):new Qn,Yf(t,"content-type")||Qf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),GF(r,{body:Wf(0,he(e)),headers:Wf(0,t)})}return r},Du(Gf)&&Hu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Gf(e,arguments.length>1?qu(arguments[1]):{})}}),Du(Ya)&&(Za=function(e){return rv(this,_u),new Ya(e,arguments.length>1?qu(arguments[1]):{})},_u.constructor=Za,Za.prototype=_u,Hu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Za})));var Yf,Qf,qu,Za;dv.exports={URLSearchParams:Qa,getState:ze}});var xv=f(()=>{"use strict";Lh();var lx=zn(),dc=ge(),ux=Su(),lc=pe(),lv=Ja(),Ee=Z(),nd=or(),Fe=Gh(),cx=Pu(),sc=we(),uc=Kh(),Qr=vf(),Je=xu(),mx=Il().codeAt,px=Af(),mt=jn(),gx=$n(),hx=Ou(),Sv=zu(),Pv=zr(),fx=Pv.set,sd=Pv.getterFor("URL"),vx=Sv.URLSearchParams,yx=Sv.getState,rs=lc.URL,oc=lc.TypeError,od=lc.parseInt,bx=Math.floor,uv=Math.pow,Te=Ee("".charAt),$e=Ee(/./.exec),ns=Ee([].join),kx=Ee(1 .toString),Sx=Ee([].pop),ti=Ee([].push),cv=Ee("".replace),Px=Ee([].shift),Cx=Ee("".split),os=Ee("".slice),ad=Ee("".toLowerCase),wx=Ee([].unshift),Ix="Invalid authority",Ju="Invalid scheme",lr="Invalid host",mv="Invalid port",Cv=/[a-z]/i,Fx=/[\d+-.a-z]/i,ac=/\d/,xx=/^0x/i,Ax=/^[0-7]+$/,Tx=/^\d+$/,wv=/^[\da-f]+$/i,Ex=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Rx=/[\0\t\n\r #/:<>?@[\\\]^|]/,Ox=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,Bx=/[\t\n\r]/g,xe,Mx=function(r){var e=Cx(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&&Te(o,0)=="0"&&(a=$e(xx,o)?16:8,o=os(o,a==8?1:2)),o==="")c=0;else{if(!$e(a==10?Tx:a==8?Ax:wv,o))return r;c=od(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=uv(256,5-t))return null}else if(c>255)return null;for(p=Sx(i),n=0;n<i.length;n++)p+=i[n]*uv(256,3-n);return p},Ux=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,v,m,b=function(){return Te(r,n)};if(b()==":"){if(Te(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&&$e(wv,b());)o=o*16+od(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(!$e(ac,b()))return;for(;$e(ac,b());){if(g=od(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(v=t-i,t=7;t!=0&&v>0;)m=e[t],e[t--]=e[i+v-1],e[i+--v]=m;else if(t!=8)return;return e},Lx=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},is=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)wx(e,r%256),r=bx(r/256);return ns(e,".")}else if(typeof r=="object"){for(e="",i=Lx(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=kx(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},id={},Iv=uc({},id,{" ":1,'"':1,"<":1,">":1,"`":1}),Fv=uc({},Iv,{"#":1,"?":1,"{":1,"}":1}),$u=uc({},Fv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=mx(r,0);return t>32&&t<127&&!sc(e,r)?r:encodeURIComponent(r)},ed={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ss=function(r,e){var t;return r.length==2&&$e(Cv,Te(r,0))&&((t=Te(r,1))==":"||!e&&t=="|")},pv=function(r){var e;return r.length>1&&ss(os(r,0,2))&&(r.length==2||(e=Te(r,2))==="/"||e==="\\"||e==="?"||e==="#")},Dx=function(r){return r==="."||ad(r)==="%2e"},_x=function(r){return r=ad(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Ku={},gv={},Xu={},hv={},fv={},Zu={},vv={},yv={},td={},rd={},Yu={},Qu={},ec={},tc={},bv={},rc={},ei={},rt={},kv={},ur={},ct={},cc=function(r,e,t){var i=mt(r),n,o,a;if(e){if(o=this.parse(i),o)throw oc(o);this.searchParams=null}else{if(t!==void 0&&(n=new cc(t,!0)),o=this.parse(i,null,n),o)throw oc(o);a=yx(new vx),a.bindURL(this),this.searchParams=a}};cc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Ku,o=0,a="",c=!1,p=!1,g=!1,v,m,b,y;for(r=mt(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=cv(r,Ox,"")),r=cv(r,Bx,""),v=Qr(r);o<=v.length;){switch(m=v[o],n){case Ku:if(m&&$e(Cv,m))a+=ad(m),n=gv;else{if(e)return Ju;n=Xu;continue}break;case gv:if(m&&($e(Fx,m)||m=="+"||m=="-"||m=="."))a+=ad(m);else if(m==":"){if(e&&(i.isSpecial()!=sc(ed,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&ed[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=tc:i.isSpecial()&&t&&t.scheme==i.scheme?n=hv:i.isSpecial()?n=yv:v[o+1]=="/"?(n=fv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=kv)}else{if(e)return Ju;a="",n=Xu,o=0;continue}break;case Xu:if(!t||t.cannotBeABaseURL&&m!="#")return Ju;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Je(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ct;break}n=t.scheme=="file"?tc:Zu;continue;case hv:if(m=="/"&&v[o+1]=="/")n=td,o++;else{n=Zu;continue}break;case fv:if(m=="/"){n=rd;break}else{n=rt;continue}case Zu: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=Je(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=vv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(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=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.path.length--,n=rt;continue}break;case vv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=td;else if(m=="/")n=rd;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=rt;continue}break;case yv:if(n=td,m!="/"||Te(a,o+1)!="/")continue;o++;break;case td:if(m!="/"&&m!="\\"){n=rd;continue}break;case rd:if(m=="@"){c&&(a="%40"+a),c=!0,b=Qr(a);for(var C=0;C<b.length;C++){var w=b[C];if(w==":"&&!g){g=!0;continue}var A=xt(w,$u);g?i.password+=A:i.username+=A}a=""}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return Ix;o-=Qr(a).length+1,a="",n=Yu}else a+=m;break;case Yu:case Qu:if(e&&i.scheme=="file"){n=rc;continue}else if(m==":"&&!p){if(a=="")return lr;if(y=i.parseHost(a),y)return y;if(a="",n=ec,e==Qu)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 ec:if($e(ac,m))a+=m;else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var B=od(a,10);if(B>65535)return mv;i.port=i.isSpecial()&&B===ed[i.scheme]?null:B,a=""}if(e)return;n=ei;continue}else return mv;break;case tc:if(i.scheme="file",m=="/"||m=="\\")n=bv;else if(t&&t.scheme=="file")if(m==xe)i.host=t.host,i.path=Je(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Je(t.path),i.query="",n=ur;else if(m=="#")i.host=t.host,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{pv(ns(Je(v,o),""))||(i.host=t.host,i.path=Je(t.path),i.shortenPath()),n=rt;continue}else{n=rt;continue}break;case bv:if(m=="/"||m=="\\"){n=rc;break}t&&t.scheme=="file"&&!pv(ns(Je(v,o),""))&&(ss(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=rt;continue;case rc:if(m==xe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&ss(a))n=rt;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=rt,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=ur;else if(!e&&m=="#")i.fragment="",n=ct;else if(m!=xe&&(n=rt,m!="/"))continue;break;case rt:if(m==xe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(_x(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):Dx(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&ss(a)&&(i.host&&(i.host=""),a=Te(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==xe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)Px(i.path);m=="?"?(i.query="",n=ur):m=="#"&&(i.fragment="",n=ct)}else a+=xt(m,Fv);break;case kv:m=="?"?(i.query="",n=ur):m=="#"?(i.fragment="",n=ct):m!=xe&&(i.path[0]+=xt(m,id));break;case ur:!e&&m=="#"?(i.fragment="",n=ct):m!=xe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,id));break;case ct:m!=xe&&(i.fragment+=xt(m,Iv));break}o++}},parseHost:function(r){var e,t,i;if(Te(r,0)=="["){if(Te(r,r.length-1)!="]"||(e=Ux(os(r,1,-1)),!e))return lr;this.host=e}else if(this.isSpecial()){if(r=px(r),$e(Ex,r)||(e=Mx(r),e===null))return lr;this.host=e}else{if($e(Rx,r))return lr;for(e="",t=Qr(r),i=0;i<t.length;i++)e+=xt(t[i],id);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return sc(ed,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!ss(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+=is(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ns(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw oc(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+"://"+is(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(mt(r)+":",Ku)},getUsername:function(){return this.username},setUsername:function(r){var e=Qr(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],$u)}},getPassword:function(){return this.password},setPassword:function(r){var e=Qr(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],$u)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?is(r):is(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Yu)},getHostname:function(){var r=this.host;return r===null?"":is(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Qu)},getPort:function(){var r=this.port;return r===null?"":mt(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=mt(r),r==""?this.port=null:this.parse(r,ec))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ns(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=mt(r),r==""?this.query=null:(Te(r,0)=="?"&&(r=os(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=mt(r),r==""){this.fragment=null;return}Te(r,0)=="#"&&(r=os(r,1)),this.fragment="",this.parse(r,ct)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=cx(this,re),i=hx(arguments.length,1)>1?arguments[1]:void 0,n=fx(t,new cc(e,!1,i));dc||(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,Ae=function(r,e){return{get:function(){return sd(this)[r]()},set:e&&function(t){return sd(this)[e](t)},configurable:!0,enumerable:!0}};dc&&(Fe(re,"href",Ae("serialize","setHref")),Fe(re,"origin",Ae("getOrigin")),Fe(re,"protocol",Ae("getProtocol","setProtocol")),Fe(re,"username",Ae("getUsername","setUsername")),Fe(re,"password",Ae("getPassword","setPassword")),Fe(re,"host",Ae("getHost","setHost")),Fe(re,"hostname",Ae("getHostname","setHostname")),Fe(re,"port",Ae("getPort","setPort")),Fe(re,"pathname",Ae("getPathname","setPathname")),Fe(re,"search",Ae("getSearch","setSearch")),Fe(re,"searchParams",Ae("getSearchParams")),Fe(re,"hash",Ae("getHash","setHash")));nd(re,"toJSON",function(){return sd(this).serialize()},{enumerable:!0});nd(re,"toString",function(){return sd(this).serialize()},{enumerable:!0});rs&&(ic=rs.createObjectURL,nc=rs.revokeObjectURL,ic&&nd(ri,"createObjectURL",lv(ic,rs)),nc&&nd(ri,"revokeObjectURL",lv(nc,rs)));var ic,nc;gx(ri,"URL");lx({global:!0,constructor:!0,forced:!ux,sham:!dc},{URL:ri})});var Av=f(()=>{xv()});var Tv=f(()=>{"use strict";var Nx=zn(),qx=Ge();Nx({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return qx(URL.prototype.toString,this)}})});var Ev=f(()=>{zu()});var Ov=f((lM,Rv)=>{var Hx=pe();Rv.exports=Hx});var Mv=f((uM,Bv)=>{Av();Tv();Ev();var jx=Ov();Bv.exports=jx.URL});var Nc=f((MD,Wy)=>{var rT=Object.prototype.toString;Wy.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 aT(e)?"generatorfunction":"function";if(iT(e))return"array";if(uT(e))return"buffer";if(lT(e))return"arguments";if(sT(e))return"date";if(nT(e))return"error";if(oT(e))return"regexp";switch(jy(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(dT(e))return"generator";switch(t=rT.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 jy(r){return typeof r.constructor=="function"?r.constructor.name:null}function iT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function nT(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function sT(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function oT(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function aT(r,e){return jy(r)==="GeneratorFunction"}function dT(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function lT(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 uT(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var zy=f((UD,Vy)=>{"use strict";var Gy=Symbol.prototype.valueOf,cT=Nc();function mT(r,e){switch(cT(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 fT(r);case"symbol":return vT(r);case"arraybuffer":return gT(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return hT(r);case"regexp":return pT(r);case"error":return Object.create(r);default:return r}}function pT(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 gT(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function hT(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function fT(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function vT(r){return Gy?Object(Gy.call(r)):{}}Vy.exports=mT});var $y=f((LD,Jy)=>{"use strict";Jy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Zy=f((DD,Xy)=>{"use strict";var yT=$y();function Ky(r){return yT(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Xy.exports=function(e){var t,i;return!(Ky(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ky(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Qy=f((_D,Yy)=>{"use strict";var bT=zy(),kT=Nc(),ST=Zy();function qc(r,e){switch(kT(r)){case"object":return PT(r,e);case"array":return CT(r,e);default:return bT(r)}}function PT(r,e){if(typeof e=="function")return e(r);if(e||ST(r)){let t=new r.constructor;for(let i in r)t[i]=qc(r[i],e);return t}return r}function CT(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=qc(r[i],e);return t}Yy.exports=qc});var Yc=f((ys,Ai)=>{var wT=200,Zc="__lodash_hash_undefined__",Rd=1,cb=2,mb=9007199254740991,wd="[object Arguments]",Gc="[object Array]",IT="[object AsyncFunction]",pb="[object Boolean]",gb="[object Date]",hb="[object Error]",fb="[object Function]",FT="[object GeneratorFunction]",Id="[object Map]",vb="[object Number]",xT="[object Null]",xi="[object Object]",eb="[object Promise]",AT="[object Proxy]",yb="[object RegExp]",Fd="[object Set]",bb="[object String]",TT="[object Symbol]",ET="[object Undefined]",Vc="[object WeakMap]",kb="[object ArrayBuffer]",xd="[object DataView]",RT="[object Float32Array]",OT="[object Float64Array]",BT="[object Int8Array]",MT="[object Int16Array]",UT="[object Int32Array]",LT="[object Uint8Array]",DT="[object Uint8ClampedArray]",_T="[object Uint16Array]",NT="[object Uint32Array]",qT=/[\\^$.*+?()[\]{}|]/g,HT=/^\[object .+?Constructor\]$/,jT=/^(?:0|[1-9]\d*)$/,j={};j[RT]=j[OT]=j[BT]=j[MT]=j[UT]=j[LT]=j[DT]=j[_T]=j[NT]=!0;j[wd]=j[Gc]=j[kb]=j[pb]=j[xd]=j[gb]=j[hb]=j[fb]=j[Id]=j[vb]=j[xi]=j[yb]=j[Fd]=j[bb]=j[Vc]=!1;var Sb=typeof global=="object"&&global&&global.Object===Object&&global,WT=typeof self=="object"&&self&&self.Object===Object&&self,ft=Sb||WT||Function("return this")(),Pb=typeof ys=="object"&&ys&&!ys.nodeType&&ys,tb=Pb&&typeof Ai=="object"&&Ai&&!Ai.nodeType&&Ai,Cb=tb&&tb.exports===Pb,Hc=Cb&&Sb.process,rb=function(){try{return Hc&&Hc.binding&&Hc.binding("util")}catch{}}(),ib=rb&&rb.isTypedArray;function GT(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 VT(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function zT(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 JT(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function $T(r){return function(e){return r(e)}}function KT(r,e){return r.has(e)}function XT(r,e){return r?.[e]}function ZT(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function YT(r,e){return function(t){return r(e(t))}}function QT(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var eE=Array.prototype,tE=Function.prototype,Od=Object.prototype,jc=ft["__core-js_shared__"],wb=tE.toString,it=Od.hasOwnProperty,nb=function(){var r=/[^.]+$/.exec(jc&&jc.keys&&jc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Ib=Od.toString,rE=RegExp("^"+wb.call(it).replace(qT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sb=Cb?ft.Buffer:void 0,Ad=ft.Symbol,ob=ft.Uint8Array,Fb=Od.propertyIsEnumerable,iE=eE.splice,br=Ad?Ad.toStringTag:void 0,ab=Object.getOwnPropertySymbols,nE=sb?sb.isBuffer:void 0,sE=YT(Object.keys,Object),zc=Ti(ft,"DataView"),bs=Ti(ft,"Map"),Jc=Ti(ft,"Promise"),$c=Ti(ft,"Set"),Kc=Ti(ft,"WeakMap"),ks=Ti(Object,"create"),oE=Pr(zc),aE=Pr(bs),dE=Pr(Jc),lE=Pr($c),uE=Pr(Kc),db=Ad?Ad.prototype:void 0,Wc=db?db.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 cE(){this.__data__=ks?ks(null):{},this.size=0}function mE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function pE(r){var e=this.__data__;if(ks){var t=e[r];return t===Zc?void 0:t}return it.call(e,r)?e[r]:void 0}function gE(r){var e=this.__data__;return ks?e[r]!==void 0:it.call(e,r)}function hE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=ks&&e===void 0?Zc:e,this}kr.prototype.clear=cE;kr.prototype.delete=mE;kr.prototype.get=pE;kr.prototype.has=gE;kr.prototype.set=hE;function vt(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 fE(){this.__data__=[],this.size=0}function vE(r){var e=this.__data__,t=Bd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():iE.call(e,t,1),--this.size,!0}function yE(r){var e=this.__data__,t=Bd(e,r);return t<0?void 0:e[t][1]}function bE(r){return Bd(this.__data__,r)>-1}function kE(r,e){var t=this.__data__,i=Bd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}vt.prototype.clear=fE;vt.prototype.delete=vE;vt.prototype.get=yE;vt.prototype.has=bE;vt.prototype.set=kE;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 SE(){this.size=0,this.__data__={hash:new kr,map:new(bs||vt),string:new kr}}function PE(r){var e=Md(this,r).delete(r);return this.size-=e?1:0,e}function CE(r){return Md(this,r).get(r)}function wE(r){return Md(this,r).has(r)}function IE(r,e){var t=Md(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Sr.prototype.clear=SE;Sr.prototype.delete=PE;Sr.prototype.get=CE;Sr.prototype.has=wE;Sr.prototype.set=IE;function Td(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Sr;++e<t;)this.add(r[e])}function FE(r){return this.__data__.set(r,Zc),this}function xE(r){return this.__data__.has(r)}Td.prototype.add=Td.prototype.push=FE;Td.prototype.has=xE;function Dt(r){var e=this.__data__=new vt(r);this.size=e.size}function AE(){this.__data__=new vt,this.size=0}function TE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function EE(r){return this.__data__.get(r)}function RE(r){return this.__data__.has(r)}function OE(r,e){var t=this.__data__;if(t instanceof vt){var i=t.__data__;if(!bs||i.length<wT-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}Dt.prototype.clear=AE;Dt.prototype.delete=TE;Dt.prototype.get=EE;Dt.prototype.has=RE;Dt.prototype.set=OE;function BE(r,e){var t=Ed(r),i=!t&&$E(r),n=!t&&!i&&Xc(r),o=!t&&!i&&!n&&Bb(r),a=t||i||n||o,c=a?JT(r.length,String):[],p=c.length;for(var g in r)(e||it.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||WE(g,p)))&&c.push(g);return c}function Bd(r,e){for(var t=r.length;t--;)if(Tb(r[t][0],e))return t;return-1}function ME(r,e,t){var i=e(r);return Ed(r)?i:VT(i,t(r))}function Ps(r){return r==null?r===void 0?ET:xT:br&&br in Object(r)?HE(r):JE(r)}function lb(r){return Ss(r)&&Ps(r)==wd}function xb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Ss(r)&&!Ss(e)?r!==r&&e!==e:UE(r,e,t,i,xb,n)}function UE(r,e,t,i,n,o){var a=Ed(r),c=Ed(e),p=a?Gc:Lt(r),g=c?Gc:Lt(e);p=p==wd?xi:p,g=g==wd?xi:g;var v=p==xi,m=g==xi,b=p==g;if(b&&Xc(r)){if(!Xc(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Dt),a||Bb(r)?Ab(r,e,t,i,n,o):NE(r,e,p,t,i,n,o);if(!(t&Rd)){var y=v&&it.call(r,"__wrapped__"),C=m&&it.call(e,"__wrapped__");if(y||C){var w=y?r.value():r,A=C?e.value():e;return o||(o=new Dt),n(w,A,t,i,o)}}return b?(o||(o=new Dt),qE(r,e,t,i,n,o)):!1}function LE(r){if(!Ob(r)||VE(r))return!1;var e=Eb(r)?rE:HT;return e.test(Pr(r))}function DE(r){return Ss(r)&&Rb(r.length)&&!!j[Ps(r)]}function _E(r){if(!zE(r))return sE(r);var e=[];for(var t in Object(r))it.call(r,t)&&t!="constructor"&&e.push(t);return e}function Ab(r,e,t,i,n,o){var a=t&Rd,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 v=-1,m=!0,b=t&cb?new Td:void 0;for(o.set(r,e),o.set(e,r);++v<c;){var y=r[v],C=e[v];if(i)var w=a?i(C,y,v,e,r,o):i(y,C,v,r,e,o);if(w!==void 0){if(w)continue;m=!1;break}if(b){if(!zT(e,function(A,B){if(!KT(b,B)&&(y===A||n(y,A,t,i,o)))return b.push(B)})){m=!1;break}}else if(!(y===C||n(y,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function NE(r,e,t,i,n,o,a){switch(t){case xd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case kb:return!(r.byteLength!=e.byteLength||!o(new ob(r),new ob(e)));case pb:case gb:case vb:return Tb(+r,+e);case hb:return r.name==e.name&&r.message==e.message;case yb:case bb:return r==e+"";case Id:var c=ZT;case Fd:var p=i&Rd;if(c||(c=QT),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=cb,a.set(r,e);var v=Ab(c(r),c(e),i,n,o,a);return a.delete(r),v;case TT:if(Wc)return Wc.call(r)==Wc.call(e)}return!1}function qE(r,e,t,i,n,o){var a=t&Rd,c=ub(r),p=c.length,g=ub(e),v=g.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:it.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var C=!0;o.set(r,e),o.set(e,r);for(var w=a;++m<p;){b=c[m];var A=r[b],B=e[b];if(i)var me=a?i(B,A,b,e,r,o):i(A,B,b,r,e,o);if(!(me===void 0?A===B||n(A,B,t,i,o):me)){C=!1;break}w||(w=b=="constructor")}if(C&&!w){var _n=r.constructor,ya=e.constructor;_n!=ya&&"constructor"in r&&"constructor"in e&&!(typeof _n=="function"&&_n instanceof _n&&typeof ya=="function"&&ya instanceof ya)&&(C=!1)}return o.delete(r),o.delete(e),C}function ub(r){return ME(r,ZE,jE)}function Md(r,e){var t=r.__data__;return GE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ti(r,e){var t=XT(r,e);return LE(t)?t:void 0}function HE(r){var e=it.call(r,br),t=r[br];try{r[br]=void 0;var i=!0}catch{}var n=Ib.call(r);return i&&(e?r[br]=t:delete r[br]),n}var jE=ab?function(r){return r==null?[]:(r=Object(r),GT(ab(r),function(e){return Fb.call(r,e)}))}:YE,Lt=Ps;(zc&&Lt(new zc(new ArrayBuffer(1)))!=xd||bs&&Lt(new bs)!=Id||Jc&&Lt(Jc.resolve())!=eb||$c&&Lt(new $c)!=Fd||Kc&&Lt(new Kc)!=Vc)&&(Lt=function(r){var e=Ps(r),t=e==xi?r.constructor:void 0,i=t?Pr(t):"";if(i)switch(i){case oE:return xd;case aE:return Id;case dE:return eb;case lE:return Fd;case uE:return Vc}return e});function WE(r,e){return e=e??mb,!!e&&(typeof r=="number"||jT.test(r))&&r>-1&&r%1==0&&r<e}function GE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function VE(r){return!!nb&&nb in r}function zE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Od;return r===t}function JE(r){return Ib.call(r)}function Pr(r){if(r!=null){try{return wb.call(r)}catch{}try{return r+""}catch{}}return""}function Tb(r,e){return r===e||r!==r&&e!==e}var $E=lb(function(){return arguments}())?lb:function(r){return Ss(r)&&it.call(r,"callee")&&!Fb.call(r,"callee")},Ed=Array.isArray;function KE(r){return r!=null&&Rb(r.length)&&!Eb(r)}var Xc=nE||QE;function XE(r,e){return xb(r,e)}function Eb(r){if(!Ob(r))return!1;var e=Ps(r);return e==fb||e==FT||e==IT||e==AT}function Rb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=mb}function Ob(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Ss(r){return r!=null&&typeof r=="object"}var Bb=ib?$T(ib):DE;function ZE(r){return KE(r)?BE(r):_E(r)}function YE(){return[]}function QE(){return!1}Ai.exports=XE});var hS=f(Kd=>{"use strict";Kd.byteLength=xR;Kd.toByteArray=TR;Kd.fromByteArray=OR;var ot=[],qe=[],FR=typeof Uint8Array<"u"?Uint8Array:Array,Rm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Lr=0,pS=Rm.length;Lr<pS;++Lr)ot[Lr]=Rm[Lr],qe[Rm.charCodeAt(Lr)]=Lr;var Lr,pS;qe[45]=62;qe[95]=63;function gS(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 xR(r){var e=gS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function AR(r,e,t){return(e+t)*3/4-t}function TR(r){var e,t=gS(r),i=t[0],n=t[1],o=new FR(AR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=qe[r.charCodeAt(p)]<<18|qe[r.charCodeAt(p+1)]<<12|qe[r.charCodeAt(p+2)]<<6|qe[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=qe[r.charCodeAt(p)]<<2|qe[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=qe[r.charCodeAt(p)]<<10|qe[r.charCodeAt(p+1)]<<4|qe[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function ER(r){return ot[r>>18&63]+ot[r>>12&63]+ot[r>>6&63]+ot[r&63]}function RR(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(ER(i));return n.join("")}function OR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(RR(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(ot[e>>2]+ot[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ot[e>>10]+ot[e>>4&63]+ot[e<<2&63]+"=")),n.join("")}});var Yq=Nn(Mv(),1);function h(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 At(r){return r.startsWith(ie.COMMENT)}function dd(r){return r.startsWith(ie.ACCOUNT)}function mr(r){return r.startsWith(ie.LINK)}function Uv(r){return r.startsWith(ie.MESSAGE)}function Lv(r){return r.startsWith(ie.SUBREDDIT)}function Dv(r){return r.startsWith(ie.AWARD)}function Wx(r){cr(At(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function Gx(r){cr(dd(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function Vx(r){cr(mr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function zx(r){cr(Uv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function Jx(r){cr(Lv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function $x(r){cr(Dv(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ii(r){return Wx(r),r}function ne(r){return Gx(r),r}function fe(r){return Vx(r),r}function Kx(r){return zx(r),r}function Re(r){return Jx(r),r}function Xx(r){return $x(r),r}function ve(r){if(At(r))return ii(r);if(dd(r))return ne(r);if(mr(r))return fe(r);if(Uv(r))return Kx(r);if(Lv(r))return Re(r);if(Dv(r))return Xx(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function mc(r){return At(r)}import*as P from"@devvit/protos";var ld=class{constructor(e){}};var pc=(t=>(t.Installation="installation",t.App="app",t))(pc||{});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)}Zx(r)}function Zx(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 Tt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var kM=["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","planet","telescope","caret-updown"];import{AppSettingsDefinition as pA,GetFieldsResponse as gA}from"@devvit/protos";import{FormField as gr,FormFieldType as Oe}from"@devvit/protos";function pt(r){return r.map(e=>{switch(e.type){case"string":return Yx(e);case"image":return Qx(e);case"paragraph":return eA(e);case"number":return tA(e);case"select":return rA(e);case"boolean":return iA(e);case"group":return nA(e);default:throw new Error("Unknown field type.")}})}function Yx(r){return gr.fromPartial({defaultValue:{fieldType:Oe.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function Qx(r){return gr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function eA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function tA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Oe.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function rA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Oe.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function iA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label})}function nA(r){return gr.fromPartial({fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:pt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as mA}from"@devvit/protos";import{RealtimeSubscriptionStatus as Nv}from"@devvit/protos";var D=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",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"}),_v;(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"})(_v||(_v={}));function qv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];h(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];h(p,"useChannel - installation is missing from Context");async function g(A){let B=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(B,A);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 v(){if(!o[n].active){let A=o[n].channel;o[n].active=!0,r.addRealtimeChannel(A)}}function m(){if(o[n].active){let A=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(A)}}function b(A){return async()=>{let B;switch(A.status){case Nv.REALTIME_SUBSCRIBED:o[n].connected=!0,B=t.onSubscribed?.();break;case Nv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,B=t.onUnsubscribed?.();break;default:B=t.onMessage(A.event?.data??{});break}await B}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Tt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let C=r.realtimeEvent;r.isInitialRender?y.active=!1:C&&y.active&&C.event.channel===y.channel&&(y.preventCallback||r.runHook(b(C)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let w=0;return y.active&&y.connected?w=2:y.active&&!y.connected?w=1:!y.active&&y.connected?w=3:!y.active&&!y.connected&&(w=4),{subscribe:v,unsubscribe:m,send:g,status:w}}return e}import{FormFieldType as ni}from"@devvit/protos";function gc(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 Et(r){return Object.keys(r).reduce((e,t)=>{let i=gc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Hv(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:Tt.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!g.preventSubmit&&v.formId===p&&r.runHook(async()=>{let m=i(Et(v.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function jv(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:Tt.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function v(){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===Tt.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:Tt.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:v,stop:m}}return e}function Wv(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 yc={now(){return new Date}};function Gv(r){return`__autocache__${r}`}function Vv(r){return`__lock__${r}`}var oA=300,aA=1e3,ud=5e3,hc=3,zv=.1,Jv=1e3,dA=3e4;function $v(r){if(r.error)throw new Error(r.error);return r.value}var Rt,Ot,Be,si,$,Kv,Xv,Zv,fc,Yv,Qv,vc,ey,cd=class{constructor(e,t,i=yc){l(this,$);l(this,Rt);l(this,Ot,{});l(this,Be);l(this,si);d(this,Rt,e),d(this,si,t),d(this,Be,i)}async cache(e,t){d(this,Ot,s(this,si).__cache=s(this,si).__cache??{}),S(this,$,ey).call(this,t);let i=S(this,$,Kv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,vc).call(this,t.key),o=await S(this,$,Xv).call(this,t,n,e);return $v(o)}};Rt=new WeakMap,Ot=new WeakMap,Be=new WeakMap,si=new WeakMap,$=new WeakSet,Kv=function(e){let t=s(this,Ot)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<hc&&Math.random()<zv&&t.errorTime+Jv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Jv<i||n){delete s(this,Ot)[e];return}else return $v(t)}},Xv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Qv).call(this,n):1;return!t||t?.error&&t.errorCount<hc&&zv>Math.random()||o>Math.random()?S(this,$,Zv).call(this,e,t,i):t},Zv=async function(e,t,i){let n=Vv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Rt).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Yv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,fc).call(this,p,e.key,e.ttl)}},fc=async function(e,t,i){let n=Math.min(i,aA),o=await S(this,$,vc).call(this,t);if(o)return o;if(s(this,Be).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,oA)),S(this,$,fc).call(this,e,t,i)},Yv=async function(e,t,i,n){let o=s(this,Be).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,Be).now().getTime(),t.errorCount++}return s(this,Ot)[e]=t,await s(this,Rt).set(Gv(e),JSON.stringify(t),{expiration:new Date(o+dA)}),t.error&&t.errorCount<hc&&await s(this,Rt).del(Vv(e)),t},Qv=function(e){let t=s(this,Be).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},vc=async function(e){let t=await s(this,Rt).get(Gv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Ot)[e]=i,i}},ey=function(e){e.ttl<ud&&(console.warn(`Cache TTL cannot be less than ${ud} milliseconds! Updating ttl value of ${e.ttl} to ${ud}.`),e.ttl=ud)};function ty(r,e,t=yc){let i=new cd(r,e,t);return i.cache.bind(i)}function ry(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,iy,ny,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,iy).call(this,e,t??{webview:!1}):S(this,li,ny).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,iy=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return ry(e),encodeURI(e)}catch{return""}},ny=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{ry(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 Bt,ui=class{constructor(e){l(this,Bt);d(this,Bt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Bt));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,Bt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Bt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Bt));return e}};Bt=new WeakMap;var as,ci=class{constructor(e){l(this,as);d(this,as,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,as));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};as=new WeakMap;var ds,mi=class{constructor(e){l(this,ds);d(this,ds,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ds))}};ds=new WeakMap;var ls,pi=class{constructor(e){l(this,ls);d(this,ls,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,ls))}};ls=new WeakMap;var k,us,hi=class{constructor(e){l(this,k);l(this,us);d(this,k,e),d(this,us,new pd(e))}get modMail(){return s(this,us)}getSubredditById(e){return ye.getById(ve(e),s(this,k))}getSubredditByName(e){return ye.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return ye.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ye.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ye.getFromMetadata(s(this,k))}getPostById(e){return z.getById(ve(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 I.getById(ve(e),s(this,k))}getCollectionById(e){return gi.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return gi.create(e,s(this,k))}getCollectionsForSubreddit(e){return gi.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return I.getByUsername(e,s(this,k))}getCurrentUser(){return I.getFromMetadata(D.User,s(this,k))}getAppUser(){return I.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return I.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return Q.getById(ve(e),s(this,k))}getComments(e){return Q.getComments(e,s(this,k))}getCommentsByUser(e){return Q.getCommentsByUser(e,s(this,k))}submitComment(e){return Q.submit({...e,id:ve(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 I.getOverview(e,s(this,k))}getModerationLog(e){return md(e,s(this,k))}getApprovedUsers(e){return I.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return I.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return I.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return I.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return I.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return I.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return I.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return I.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 I.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return I.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return I.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return I.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return I.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return I.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return I.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return I.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return I.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return I.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return I.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return I.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?ve(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.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(At(e))return Q.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(At(e))return Q.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 Ue.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Ue.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 be.getPage(e,t,s(this,k))}async getWikiPages(e){return be.getPages(e,s(this,k))}async createWikiPage(e){return be.createPage(e,s(this,k))}async updateWikiPage(e){return be.updatePage(e,s(this,k))}getWikiPageRevisions(e){return be.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return be.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return be.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return be.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return be.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return be.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 ye.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ye.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ye.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ye.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ye.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return ay(e,s(this,k))}getVaultByUserId(e){return dy(ve(e),s(this,k))}getSubredditLeaderboard(e){return oy(e,s(this,k))}};k=new WeakMap,us=new WeakMap;import{RedisKeyScope as bc}from"@devvit/protos";function gd(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,kc=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,fi,Sc=class Sc{constructor(e,t=void 0,i=bc.INSTALLATION){l(this,M);l(this,fi);d(this,M,e),d(this,fi,t),this.scope=i,this.global=i===bc.INSTALLATION?new Sc(s(this,M),s(this,fi),bc.GLOBAL):this}get storage(){return s(this,fi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new kc(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(gd(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(gd(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(gd(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(gd(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,fi=new WeakMap;var vi=Sc;var fr,yi=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=>(h(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 cs,bi=class{constructor(e){l(this,cs);d(this,cs,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,cs));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...ly(t.installationSettings.settings,u.installationSettings),...ly(t.appSettings.settings,u.appSettings)}}};cs=new WeakMap;function ly(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=gc(r[n]),i),{});return e&&uy(t,e),t}function uy(r,e){for(let t of e)t.type==="group"?uy(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Pc,Form as lA,ToastAppearance as cy}from"@devvit/protos";var vr,ki,hd=class{constructor(e){l(this,vr,[]);l(this,ki);d(this,ki,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,ki)){let a=s(this,ki).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=lA.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});pr(n.fields),o.fields=pt(n.fields),s(this,vr).push({type:Pc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?cy.SUCCESS:cy.NEUTRAL}:t={text:e},s(this,vr).push({type:Pc.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:Pc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,vr)}};vr=new WeakMap,ki=new WeakMap;function Le({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new vi(r),c=ty(a,i?i.state:{}),p=new hi(r),g=new yi(r),v=new bi(r),m=e?new hd(i):void 0,b=new ci(r),y=new di,C=new pi(r),w=t&&i?Wv(i):void 0,A=t&&i?jv(i):void 0,B=t&&i?Hv(i):void 0,me=t&&i?qv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:v,media:b,assets:y,realtime:C,get useForm(){return B??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return w??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return A??(()=>{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 my={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/eslint-config":"0.11.0-dev","@devvit/repo-tools":"0.11.0-dev","@devvit/tsconfig":"0.11.0-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"16.1.0","@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:"8.9.0",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"255 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[D.Subreddit]?.values[0];h(i,"subreddit is missing from Context");let n=r[D.AppUser]?.values[0],o=r[D.User]?.values[0],a=cA(r);return{get appAccountId(){return h(n,"appAccountId is missing from Context"),n},subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}function cA(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[D.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[D.Debug]&&console.info(`[api] @devvit/public-api v${my.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function py(r){return r.flatMap(e=>e.type==="group"?py(e.fields):e)}async function fd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Et(r.fieldValues),o=py(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,v=Object.assign(Le({metadata:t}),le(t)),m=await g({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),mA.fromJSON(i)}async function hA(){if(!u.appSettings)throw new Error("App settings were not defined.");return gA.fromJSON({fields:{fields:pt(u.appSettings)}})}async function fA(r,e){return fd(r,u.appSettings,e)}function gy(r){r.provides(pA),U("GetAppSettingsFields",hA),U("ValidateAppForm",fA)}import{CustomPostDefinition as CA,RenderPostResponse as wA}from"@devvit/protos";import{BlockRenderEventType as Lc,EffectType as Oy}from"@devvit/protos";function Si(r){return r.__effects}function hy(){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 Uc,BlockAnimationDirection as Iy,BlockAnimationLoopMode as Fy,BlockAnimationType as xy,BlockAvatarBackground as Ay,BlockAvatarFacing as Ty,BlockAvatarSize as Mt,BlockBorderWidth as kd,BlockButtonAppearance as Ut,BlockButtonSize as xc,BlockFullSnooSize as Ci,BlockGap as Sd,BlockHorizontalAlignment as Ac,BlockIconSize as Pd,BlockImageResizeMode as ms,BlockPadding as ps,BlockRadius as gs,BlockSpacerShape as Tc,BlockSpacerSize as Cd,BlockStackDirection as Ec,BlockTextOutline as Rc,BlockTextOverflow as Oc,BlockTextSize as wi,BlockTextStyle as Bc,BlockTextWeight as Ey,BlockType as De,BlockVerticalAlignment as Mc}from"@devvit/protos";var Cc={"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 fy={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"},vy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),yy=r=>r in Cc,wc=r=>r in fy,by=r=>!!r.match(/^rgba?\(.*/),ky=r=>!!r.match(/^hsla?\(.*/),Sy=(r,e="light")=>{if(wc(r))return vd(r);let i=Cc[r];return typeof i=="string"?i:i[e]},vd=r=>fy[r]??r,Py=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 yd}from"@devvit/protos";var Ic={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:yd.UNRECOGNIZED,alignment:void 0}};function wy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=vA(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||Cy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||Cy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function Cy(r,e,t,i){return e===r&&i||t===r&&i}function vA(r,e,t){let i=e===yd.STACK_VERTICAL||e===yd.UNRECOGNIZED,n=e===yd.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 bd}from"@devvit/protos";function Pi(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 yA(r,e){return(r.width?.value?.unit===yr.SIZE_UNIT_PERCENT||r.width?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===bd.STACK_HORIZONTAL||e.direction===bd.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===bd.STACK_VERTICAL||e.direction===bd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Fc(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:Pi(r.width),min:Pi(r.minWidth),max:Pi(r.maxWidth)}:void 0,height:i?{value:Pi(r.height),min:Pi(r.minHeight),max:Pi(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=yA(n,e.stackParentLayout)),n}}}var Ry="data-",bA=new Set(["onPress","onMessage"]),kA=new Map([["onPress",Uc.ACTION_CLICK],["onMessage",Uc.ACTION_WEBVIEW]]),hs,Ii=class{constructor(e=()=>{}){l(this,hs);d(this,hs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},Ic);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"fullsnoo":return this.makeFullSnoo(t,n);case"animation":return this.makeAnimation(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 ps.PADDING_NONE;case"xsmall":return ps.PADDING_XSMALL;case"small":return ps.PADDING_SMALL;case"medium":return ps.PADDING_MEDIUM;case"large":return ps.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return gs.RADIUS_NONE;case"small":return gs.RADIUS_SMALL;case"medium":return gs.RADIUS_MEDIUM;case"large":return gs.RADIUS_LARGE;case"full":return gs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return Sd.GAP_NONE;case"small":return Sd.GAP_SMALL;case"medium":return Sd.GAP_MEDIUM;case"large":return Sd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Mc.ALIGN_TOP:e.includes("middle")?t=Mc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Mc.ALIGN_BOTTOM),e.includes("start")?i=Ac.ALIGN_START:e.includes("center")?i=Ac.ALIGN_CENTER:e.includes("end")&&(i=Ac.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=kd.BORDER_WIDTH_NONE;break;case"thin":o=kd.BORDER_WIDTH_THIN;break;case"thick":o=kd.BORDER_WIDTH_THICK;break;default:o=kd.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 wi.TEXT_SIZE_XSMALL;case"small":return wi.TEXT_SIZE_SMALL;case"medium":return wi.TEXT_SIZE_MEDIUM;case"large":return wi.TEXT_SIZE_LARGE;case"xlarge":return wi.TEXT_SIZE_XLARGE;case"xxlarge":return wi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Bc.TEXT_STYLE_BODY;case"metadata":return Bc.TEXT_STYLE_METADATA;case"heading":return Bc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Rc.TEXT_OUTLINE_NONE;case"thin":return Rc.TEXT_OUTLINE_THIN;case"thick":return Rc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Ey.TEXT_WEIGHT_REGULAR;case"bold":return Ey.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Oc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Oc.TEXT_OVERFLOW_ELLIPSE}return Oc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Ut.BUTTON_APPEARANCE_SECONDARY;case"primary":return Ut.BUTTON_APPEARANCE_PRIMARY;case"plain":return Ut.BUTTON_APPEARANCE_PLAIN;case"bordered":return Ut.BUTTON_APPEARANCE_BORDERED;case"media":return Ut.BUTTON_APPEARANCE_MEDIA;case"destructive":return Ut.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Ut.BUTTON_APPEARANCE_CAUTION;case"success":return Ut.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return xc.BUTTON_SIZE_SMALL;case"medium":return xc.BUTTON_SIZE_MEDIUM;case"large":return xc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ms.IMAGE_RESIZE_NONE;case"fit":return ms.IMAGE_RESIZE_FIT;case"fill":return ms.IMAGE_RESIZE_FILL;case"cover":return ms.IMAGE_RESIZE_COVER;case"scale-down":return ms.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return Cd.SPACER_XSMALL;case"small":return Cd.SPACER_SMALL;case"medium":return Cd.SPACER_MEDIUM;case"large":return Cd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Tc.SPACER_INVISIBLE;case"thin":return Tc.SPACER_THIN;case"square":return Tc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Pd.ICON_SIZE_XSMALL;case"small":return Pd.ICON_SIZE_SMALL;case"medium":return Pd.ICON_SIZE_MEDIUM;case"large":return Pd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Mt.AVATAR_SIZE_XXSMALL;case"xsmall":return Mt.AVATAR_SIZE_XSMALL;case"small":return Mt.AVATAR_SIZE_SMALL;case"medium":return Mt.AVATAR_SIZE_MEDIUM;case"large":return Mt.AVATAR_SIZE_LARGE;case"xlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Mt.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Ty.AVATAR_FACING_LEFT;case"right":return Ty.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return Ci.FULLSNOO_XSMALL;case"small":return Ci.FULLSNOO_SMALL;case"medium":return Ci.FULLSNOO_MEDIUM;case"large":return Ci.FULLSNOO_LARGE;case"xlarge":return Ci.FULLSNOO_XLARGE;case"xxlarge":return Ci.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ay.AVATAR_BG_DARK;case"light":return Ay.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?xy.ANIM_LOTTIE:xy.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return Iy.ANIM_DIR_BACKWARD;case"forward":return Iy.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return Fy.ANIM_LOOP_REPEAT;case"bounce":return Fy.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Ry)).reduce((t,i)=>(t[i.substring(Ry.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return bA.forEach(o=>{if(o in t){let a=t[o];i.push({type:kA.get(o)??Uc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),vy(e)?e:yy(e)?Sy(e,t):wc(e)?vd(e):by(e)?Py(e):ky(e)?e:(console.warn(`Could not parse color: ${e}.`),vd("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,hs).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,Ic))}wrapRoot(e,t){return this.makeBlock(De.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=Fc(t,i),p=wy(t,i.stackParentLayout,c);return this.makeBlock(De.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(Ec.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(Ec.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(Ec.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(De.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(De.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(De.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(De.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(De.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(De.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e,t){return e&&this.makeBlock(De.BLOCK_FULLSNOO,e,t,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}makeAnimation(e,t){return e&&this.makeBlock(De.BLOCK_ANIMATION,e,t,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:this.resolveAssetUrl(e.url),loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e,t){return e&&this.makeBlock(De.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Fc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===De.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}};hs=new WeakMap;function By(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var My=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+=My(i);return e+=`</${r.type}>`,e};function SA(r){return" ".repeat(r)}function PA(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+=SA(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
- `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var _e,Uy,fs,Dc,vs,gt=class{constructor(e,t,i,n,o){l(this,_e);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 Ii(()=>this.assets);this.effects=[];l(this,vs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Le({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,_e,fs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(By(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,_e,Uy).call(this)}async buildBlocksUI(){let e=S(this,_e,fs).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 By(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(PA(My(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=hy(),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,_e,Dc).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,_e,fs).call(this),...n.props,children:p},v;for(;v===void 0;)try{v=await n.type(g,S(this,_e,fs).call(this))}catch(m){if(m instanceof Promise)v=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 v=="object")return this.processBlock(v,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===Lc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Lc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Lc.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,vs)||(d(this,vs,!0),this.effects.push({type:Oy.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:Oy.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...Si(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}:{}}}};_e=new WeakSet,Uy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},fs=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[D.Timezone]?.values[0],locale:this.metadata[D.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},Dc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,_e,Dc).call(this,i.children)):t.push(i);return t},vs=new WeakMap;async function IA(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new gt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return wA.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function Ly(r){r.provides(CA),U("RenderPost",IA)}import{GetFieldsResponse as FA,InstallationSettingsDefinition as xA}from"@devvit/protos";async function AA(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return FA.fromJSON({fields:{fields:pt(u.installationSettings)}})}async function TA(r,e){return fd(r,u.installationSettings,e)}function Dy(r){r.provides(xA),U("GetSettingsFields",AA),U("ValidateForm",TA)}import{ContextActionDefinition as EA,ContextActionList as RA,ContextActionResponse as OA}from"@devvit/protos";var _y=r=>`menuItem.${r}`;function _c(r){return u.menuItems.find((e,t)=>_y(t)===r)}async function BA(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:_y(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 RA.fromJSON({actions:i})}async function MA(r,e){let t=_c(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;h(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Le({ui:!0,metadata:e}),le(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),OA.fromJSON({effects:Si(p.ui)})}function Ny(r){r.provides(EA),U("GetActions",BA),U("OnAction",MA)}function ht(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as UA}from"@devvit/protos";async function LA(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(Le({metadata:e}),le(e));await i(n,o)}function qy(r){r.provides(UA),U("HandleScheduledAction",LA)}import{HandlerResult as DA,OnAppInstallDefinition as _A,OnAppUpgradeDefinition as NA,OnCommentCreateDefinition as qA,OnCommentDeleteDefinition as HA,OnCommentReportDefinition as jA,OnCommentSubmitDefinition as WA,OnCommentUpdateDefinition as GA,OnModActionDefinition as VA,OnModMailDefinition as zA,OnPostCreateDefinition as JA,OnPostDeleteDefinition as $A,OnPostFlairUpdateDefinition as KA,OnPostReportDefinition as XA,OnPostSubmitDefinition as ZA,OnPostUpdateDefinition as YA,OnPostNsfwUpdateDefinition as QA,OnPostSpoilerUpdateDefinition as eT}from"@devvit/protos";var Fi;(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){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(Fi||(Fi={}));function ee(r,e){return h(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Le({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=tT(a);if(c)throw c.err;return DA.fromPartial({})}}function Hy(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(ZA),U("OnPostSubmit",ee("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(JA),U("OnPostCreate",ee("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(YA),U("OnPostUpdate",ee("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(XA),U("OnPostReport",ee("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides($A),U("OnPostDelete",ee("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(KA),U("OnPostFlairUpdate",ee("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(WA),U("OnCommentSubmit",ee("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(qA),U("OnCommentCreate",ee("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(GA),U("OnCommentUpdate",ee("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(jA),U("OnCommentReport",ee("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(HA),U("OnCommentDelete",ee("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(_A),U("OnAppInstall",ee("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(NA),U("OnAppUpgrade",ee("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(VA),U("OnModAction",ee("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(zA),U("OnModMail",ee("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(QA),U("OnPostNsfwUpdate",ee("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(eT),U("OnPostSpoilerUpdate",ee("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function tT(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=>Fi.caughtToString(t)).join(`
3
- `))}}var Mb=Nn(Qy(),1),Ub=Nn(Yc(),1);import{EffectType as eR,HandleUIEventResponse as Qc,UIEventHandlerDefinition as tR}from"@devvit/protos";async function rR(r,e){let t=r.state??{},i=(0,Mb.default)(t),n=Le({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 gt((C,w)=>u.customPostType?.render(w)??null,r.event,r.state,e,void 0);return await y.reconcile(),Qc.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 v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,w=_c(y);w?.location==="post"?v=C:w?.location==="comment"&&(m=C)}let b=Object.assign(n,le(e,v,m),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});await g.onSubmit({values:Et(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new gt((g,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),Qc.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Ub.default)(t,i),a=Si(n.ui),c=o?[...a,{type:eR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return Qc.fromJSON({state:i,effects:c})}function Lb(r){r.provides(tR),U("HandleUIEvent",rR)}import{CustomPostDefinition as sk,UIResponse as gR}from"@devvit/protos";import{EffectType as rm,Form as nR,ToastAppearance as Nb}from"@devvit/protos";function Db(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var em=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(Et(n.formSubmitted.results))}}};function tm(r,e){let t=Ke({namespace:"useForm",initializer:i=>new em(i,r,e)});return iR({id:t.hookId})}function iR(r){return`form.hook.${r.id}.0`}function _b(r,e){let t=Db(e);return r.getHook({id:t})}var _t,Ud=class{constructor(e){l(this,_t);d(this,_t,e)}showForm(e,t){let i=_b(s(this,_t),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=nR.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});pr(n.fields),o.fields=pt(n.fields),s(this,_t).emitEffect(e,{type:rm.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,_t).emitEffect(e.toString(),{type:rm.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,_t).emitEffect(t,{type:rm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};_t=new WeakMap;import{EffectType as sR,RealtimeSubscriptionStatus as qb}from"@devvit/protos";var Nt,nt,qt,Cr,Cs,nm,Ld=class Ld{constructor(e,t){l(this,Cs);l(this,Nt);l(this,nt);l(this,qt);l(this,Cr);d(this,Nt,t.context),d(this,nt,!!t.context._devvitContext?.debug.realtime),d(this,Cr,e),d(this,qt,t.invalidate);let i=t.context.meta[D.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[D.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,Nt)._hooks).filter(c=>c instanceof Ld).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 qb.REALTIME_SUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,qt).call(this),await s(this,Cr).onSubscribed?.();break;case qb.REALTIME_UNSUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,qt).call(this),await s(this,Cr).onUnsubscribed?.();break;default:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Cr).onMessage(t.event?.data??{});break}}async send(e){if(s(this,nt)&&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,Nt).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,nt)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,qt).call(this),S(this,Cs,nm).call(this))}unsubscribe(){this.state.subscribed&&(s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,qt).call(this),S(this,Cs,nm).call(this))}};Nt=new WeakMap,nt=new WeakMap,qt=new WeakMap,Cr=new WeakMap,Cs=new WeakSet,nm=function(){let e=Object.values(s(this,Nt)._hooks).filter(t=>t instanceof Ld&&t.state.subscribed).map(t=>t.state.channel);s(this,Nt).emitEffect(this.state.channel,{type:sR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var im=Ld;function sm(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 Ke({id:e,namespace:e,initializer:t=>new im(r,t)})}import{EffectType as om}from"@devvit/protos";function Hb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var wr,yt,Ei=class Ei{constructor(e,t){l(this,wr);this._segments=[];l(this,yt,{});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,yt)).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,yt)}set _hooks(e){this._prevHooks=s(this,yt),d(this,yt,e)}get _state(){return s(this,wr)}set _state(e){d(this,yt,{}),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){Ei.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,yt)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ei._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ei._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,yt=new WeakMap,Ei._staticUndeliveredHandlers={};var Ri=Ei;var Ht={};Ri.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Ht[r.hook],e.emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:Ht}}))});var jt,Oi,ws,Bi,am=class{constructor(e,t,i){l(this,jt);l(this,Oi);l(this,ws);l(this,Bi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Oi,i.invalidate),d(this,jt,i.hookId),d(this,ws,e),d(this,Bi,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,jt)]={duration:this.state.duration}:delete Ht[s(this,jt)]}async onUIEvent(e){await s(this,ws).call(this)}start(){Ht[s(this,jt)]={duration:this.state.duration},this.state.running=!0,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}stop(){delete Ht[s(this,jt)],this.state.running=!1,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}};jt=new WeakMap,Oi=new WeakMap,ws=new WeakMap,Bi=new WeakMap;function dm(r,e){let t=Ke({namespace:"useInterval",initializer:i=>new am(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}var Ir=class extends Error{};var lm="ServerCallRequired";function um(r){return r?.message===lm}var jb=Nn(Yc(),1);function mm(r){if(r instanceof Error){if(r.message===lm)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:Fi.caughtToString(r)}}var Xe,st,Mi,Is,cm=class{constructor(e,t,i){l(this,Xe);l(this,st);l(this,Mi);l(this,Is);d(this,Xe,!!i.context.devvitContext.debug.useAsync),s(this,Xe)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,st,i.hookId),this.initializer=e,d(this,Mi,i.invalidate),d(this,Is,i.context),this.localDepends=t.depends??null}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,Xe)&&console.debug("[useAsync] async onLoad ",s(this,st),this.state),s(this,Xe)&&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,Xe)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,st)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Mi).call(this);let e={hook:s(this,st),async:!0,asyncRequest:{requestId:s(this,st)+"-"+JSON.stringify(this.state.depends)}};s(this,Xe)&&console.debug("[useAsync] onLoad requeue"),s(this,Is).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=mm(o)}let n={asyncResponse:i,hook:s(this,st)};s(this,Xe)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,st)+"-"+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,Mi).call(this)):s(this,Xe)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};Xe=new WeakMap,st=new WeakMap,Mi=new WeakMap,Is=new WeakMap;function oR(r,e={}){let t=Ke({namespace:"useAsync",initializer:i=>new cm(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var bt,Ui,Fr,xr,pm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,bt);l(this,Ui);l(this,Fr);l(this,xr);d(this,Fr,e),d(this,xr,t.hookId),d(this,bt,t.invalidate),d(this,Ui,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=mm(e)}s(this,bt).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,bt).call(this)}onStateLoaded(){if(this._promise=s(this,Ui)._prevHooks[s(this,xr)]?._promise,this.state.load_state==="loading")throw new Ir;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,bt).call(this);return}if(e instanceof Promise){this._promise=e,this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,xr)},hook:s(this,xr)};throw s(this,Ui).addToRequeueEvents(t),s(this,bt).call(this),new Ir}else this.state.value=e,this.state.load_state="loaded";s(this,bt).call(this)}}};bt=new WeakMap,Ui=new WeakMap,Fr=new WeakMap,xr=new WeakMap;function gm(r){let e=Ke({namespace:"useState",initializer:t=>new pm(r,t)});return[e.state.value,e.setter.bind(e)]}var ym={now(){return new Date}};function Wb(r){return`__autocache__${r}`}function Gb(r){return`__lock__${r}`}var aR=300,dR=1e3,Dd=5e3,hm=3,Vb=.1,zb=1e3,lR=3e4;function Jb(r){if(r.error)throw new Error(r.error);return r.value}var Wt,Gt,Ne,Li,K,$b,Kb,Xb,fm,Zb,Yb,vm,Qb,_d=class{constructor(e,t,i=ym){l(this,K);l(this,Wt);l(this,Gt,{});l(this,Ne);l(this,Li);d(this,Wt,e),d(this,Li,t),d(this,Ne,i)}async cache(e,t){var a;(a=s(this,Li)).__cache??(a.__cache={}),d(this,Gt,s(this,Li).__cache),S(this,K,Qb).call(this,t);let i=S(this,K,$b).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,vm).call(this,t.key),o=await S(this,K,Kb).call(this,t,n,e);return Jb(o)}};Wt=new WeakMap,Gt=new WeakMap,Ne=new WeakMap,Li=new WeakMap,K=new WeakSet,$b=function(e){let t=s(this,Gt)[e];if(t){let i=s(this,Ne).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<hm&&Math.random()<Vb&&t.errorTime+zb<i;if(t?.expires&&t.expires<i&&t.checkedAt+zb<i||n){delete s(this,Gt)[e];return}else return Jb(t)}},Kb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,Yb).call(this,n):1;return!t||t?.error&&t.errorCount<hm&&Vb>Math.random()||o>Math.random()?S(this,K,Xb).call(this,e,t,i):t},Xb=async function(e,t,i){let n=Gb(e.key),o=s(this,Ne).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Wt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Zb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Ne).now();return S(this,K,fm).call(this,p,e.key,e.ttl)}},fm=async function(e,t,i){let n=Math.min(i,dR),o=await S(this,K,vm).call(this,t);if(o)return o;if(s(this,Ne).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,aR)),S(this,K,fm).call(this,e,t,i)},Zb=async function(e,t,i,n){let o=s(this,Ne).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,Ne).now().getTime(),t.errorCount++}return s(this,Gt)[e]=t,await s(this,Wt).set(Wb(e),JSON.stringify(t),{expiration:new Date(o+lR)}),t.error&&t.errorCount<hm&&await s(this,Wt).del(Gb(e)),t},Yb=function(e){let t=s(this,Ne).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},vm=async function(e){let t=await s(this,Wt).get(Wb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Ne).now().getTime(),s(this,Gt)[e]=i,i}},Qb=function(e){e.ttl<Dd&&(console.warn(`Cache TTL cannot be less than ${Dd} milliseconds! Updating ttl value of ${e.ttl} to ${Dd}.`),e.ttl=Dd)};function ek(r,e,t=ym){let i=new _d(r,e,t);return i.cache.bind(i)}var Nd=class{buildContext(e,t,i){let n=new mi(i),o=new ui(i),a=new vi(i),c=new hi(i),p=new yi(i),g=new bi(i),v=new Ud(e),m=new ci(i),b=new di,y=new pi(i),C=ek(a,e._state),w={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:b,realtime:y,ui:v,useState:gm,useChannel:sm,useInterval:dm,useForm:tm,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[D.Timezone]?.values[0],locale:i[D.Language]?.values[0],dimensions:t.env?.dimensions}},A=le(i,t.props?.postId);return A.debug.effects=e,{...A,...w}}};var ke=null;function tk(r){return JSON.parse(JSON.stringify(r))}function uR(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 cR(r){return r.blocking||r.resize?!1:!r.hook}function Ke({initializer:r,...e}){if(!ke)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.");uR(e.namespace);let t=ke.nextHookId(e),i=ke,n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:ke},o=ke._state[t]===void 0||Hb(ke._state[t]);ke._hooks[t]=ke._hooks[t]??r(n);let a=ke._hooks[t];return o||(a.state=ke._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var mR=null,Di,Wd,Fs,F,ue,qd,rk,bm,ik,km,Sm,Hd,Pm,nk,jd=class{constructor(e){l(this,F);l(this,Di);l(this,Wd,new Nd);l(this,Fs,new Ii(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,F,ue)&&console.debug("[blocks] BlocksHandler v1"),d(this,Di,e),mR=this}async handle(e,t){let i=new Ri(e,t),n=s(this,Wd).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),v,m,b=[...a];for(a.length===0&&a.push({}),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 w=tk(i._state);await S(this,F,rk).call(this,i,...y),i._state=w}else await S(this,F,ik).call(this,i,...y)}catch(w){if(!um(w))throw w;if(s(this,F,ue)&&console.debug("[blocks] caught in handler",w),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let A=b.map(B=>{let me={...B};return me.retry=!0,me});i.addToRequeueEvents(...A);break}else throw console.error("[blocks] unhandled error in handler",w),w}s(this,F,ue)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let w of i._requeueEvents){if(!p&&!w.async){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",w),C.push(w);continue}if(p&&w.async&&!g){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",w),C.push(w);continue}s(this,F,ue)&&console.debug("[blocks] reprocessing event in BlocksHandler",w),a.push(w)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:tk(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,F,km).call(this,s(this,Di),i.request.props??{},i));let y=i._latestRenderContent;y&&(o=s(this,Fs).createBlocksElementOrThrow(y),o=s(this,Fs).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Di=new WeakMap,Wd=new WeakMap,Fs=new WeakMap,F=new WeakSet,ue=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},qd=function(e,...t){e._hooks={},S(this,F,km).call(this,s(this,Di),e.request.props??{},e)},rk=async function(e,...t){S(this,F,qd).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,bm).call(this,e,i)}))},bm=async function(e,t){cR(t)&&console.warn("Received an event in #attemptHook that does not have an associated hook. This will cause the event to be undelivered and may cause bugs. Make sure that event passes a hook field. Event:",{event:t});let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw um(n)?s(this,F,ue)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},ik=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,qd).call(this,e,i),await S(this,F,bm).call(this,e,i),s(this,F,ue)&&console.log("[blocks] after",e._state);S(this,F,qd).call(this,e)},km=function(e,t,i){s(this,F,ue)&&console.debug("[blocks] renderRoot"),i._generated={},ke=i,this._latestRenderContext=i;try{let n=S(this,F,Sm).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] = context.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 Ir)return;throw n}finally{ke=null}},Sm=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] = context.useState(async () => {/** your async code */})".`);return S(this,F,Pm).call(this,n,i)}finally{i.pop()}},Hd=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,Pm).call(this,i,t)))},Pm=function(e,t){if(Array.isArray(e))return S(this,F,Hd).call(this,e,t);if(pR(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=S(this,F,Hd).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,F,Sm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=S(this,F,Hd).call(this,e.children,t),n=S(this,F,nk).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},nk=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Ke({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 pR(r){return typeof r=="object"&&r!=null&&"type"in r}var hR=[[sk,sk.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null]];function fR(r){return async(e,t)=>{let i=new jd(r);return gR.fromJSON(await i.handle(e,t))}}function ok(r){for(let[e,t,i]of hR)r.provides(e),U(t.name,fR(i))}var _i,xs,Ni,Ar,Tr,qi,Hi,Er,Vt,As,Ts,Rr,N,L=class L extends ld{static configure(e){d(this,Ni,{...s(this,Ni),...e}),ht(e.http)&&this.use(P.HTTPDefinition),(ht(e.kvStore)||ht(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),ht(e.media)&&this.use(P.MediaServiceDefinition),ht(e.modLog)&&this.use(P.ModlogDefinition),ht(e.redditAPI)&&(this.use(P.FlairDefinition),this.use(P.GraphQLDefinition),this.use(P.LinksAndCommentsDefinition),this.use(P.ListingsDefinition),this.use(P.ModerationDefinition),this.use(P.ModNoteDefinition),this.use(P.NewModmailDefinition),this.use(P.PrivateMessagesDefinition),this.use(P.SubredditsDefinition),this.use(P.PostCollectionsDefinition),this.use(P.UsersDefinition),this.use(P.WidgetsDefinition),this.use(P.WikiDefinition),this.use(P.RedditAPIV2Definition)),ht(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,Hi).push(e)}static addCustomPostType(e){d(this,Ar,e)}static createForm(e,t){let i=`form.${s(this,Tr).size}`;return s(this,Tr).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,N)[P.SchedulerDefinition.fullName]||this.use(P.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,qi,t),i.length>0&&d(this,_i,i),s(this,N)[P.SettingsDefinition.fullName]||this.use(P.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,Vt).has(e.event)?s(this,Vt).get(e.event)?.push(e.onEvent):s(this,Vt).set(e.event,[e.onEvent]),L}static provide(e){s(this,Ts).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,N)[e.fullName]=i,i}static get redditAPIPlugins(){if(!ht(s(this,Ni).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,N)[P.FlairDefinition.fullName],GraphQL:s(this,N)[P.GraphQLDefinition.fullName],LinksAndComments:s(this,N)[P.LinksAndCommentsDefinition.fullName],Listings:s(this,N)[P.ListingsDefinition.fullName],Moderation:s(this,N)[P.ModerationDefinition.fullName],ModNote:s(this,N)[P.ModNoteDefinition.fullName],NewModmail:s(this,N)[P.NewModmailDefinition.fullName],PrivateMessages:s(this,N)[P.PrivateMessagesDefinition.fullName],Subreddits:s(this,N)[P.SubredditsDefinition.fullName],PostCollections:s(this,N)[P.PostCollectionsDefinition.fullName],Users:s(this,N)[P.UsersDefinition.fullName],Widgets:s(this,N)[P.WidgetsDefinition.fullName],Wiki:s(this,N)[P.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,N)[P.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,N)[P.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,N)[P.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,N)[P.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,N)[P.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 redditapiv2Plugin(){let e=s(this,N)[P.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,N)[P.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,N)[P.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,Hi)}static get customPostType(){return s(this,Ar)}static get formDefinitions(){return s(this,Tr)}static get scheduledJobHandlers(){return s(this,Er)}static get installationSettings(){return s(this,qi)}static get appSettings(){return s(this,_i)}static get triggerOnEventHandlers(){return s(this,Vt)}static get assets(){return s(this,xs)}static get webviewAssets(){return s(this,As)}constructor(e){super(e),d(L,xs,e.assets??{}),d(L,As,e.webviewAssets??{});for(let t in s(L,Rr)){let i=s(L,Rr)[t];i.handler=e.use(i.def,i.options)}s(L,Hi).length>0&&Ny(e),s(L,Er).size>0&&qy(e),s(L,Ar)&&(Ly(e),ok(e)),(s(L,Ar)||s(L,Tr).size>0)&&Lb(e),s(L,qi)&&Dy(e),s(L,_i)&&gy(e),s(L,Vt).size>0&&Hy(e);for(let t of s(L,Ts))e.provides(t)}};_i=new WeakMap,xs=new WeakMap,Ni=new WeakMap,Ar=new WeakMap,Tr=new WeakMap,qi=new WeakMap,Hi=new WeakMap,Er=new WeakMap,Vt=new WeakMap,As=new WeakMap,Ts=new WeakMap,Rr=new WeakMap,N=new WeakMap,L.debug={},l(L,_i),l(L,xs,{}),l(L,Ni,{}),l(L,Ar),l(L,Tr,new Map),l(L,qi),l(L,Hi,[]),l(L,Er,new Map),l(L,Vt,new Map),l(L,As,{}),l(L,Ts,[]),l(L,Rr,{}),l(L,N,{});var u=L;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function X(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 Cm;(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"})(Cm||(Cm={}));var ak="text",dk="raw",lk="br",uk="link",ck="c/",mk="p/",pk="r/",gk="u/",hk="@",fk="spoilertext",vk="par",yk="h",bk="hr",kk="blockquote",Sk="code",Pk="li",Ck="list",wk="L",Ik="R",Fk="C",xk="table",Ak="embed",Tk="img",Ek="gif",Rk="video";function Ok(r){return{e:Ek,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Bk(r,e){let t={},i=[];return Object.assign(t,Es(t,i),Rs(t,i),Os(t,i),Us(t,i),Ls(t,i),Ds(t,i)),e(t),{e:kk,c:i,...r.author&&{a:r.author}}}function Mk(r,e){let t={},i=[];return Object.assign(t,Im(t,i)),e(t),{e:Sk,c:i,...r.language&&{l:r.language}}}function Uk(r){return{e:ck,t:r.permalink}}function Lk(r,e){let t={},i=[];return Object.assign(t,Im(t,i),Ms(t,i)),e(t),{e:yk,l:r.level,c:i}}function Dk(r){return{e:Ak,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function _k(){return{e:bk}}function Nk(r){return{e:Tk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function qk(){return{e:lk}}function Hk(r){return{e:uk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function jk(r,e){let t={},i=[];return Object.assign(t,nS(t,i)),e(t),{e:Ck,o:r.ordered,c:i}}function Wk(r){let e={},t=[];return Object.assign(e,Es(e,t),Rs(e,t),Os(e,t),Gd(e,t),Us(e,t),Ls(e,t),Ds(e,t)),r(e),{e:Pk,c:t}}function Gk(r){let e={},t=[];return Object.assign(e,Vd(e,t),Ms(e,t),wm(e,t),Fm(e,t),Bs(e,t)),r(e),{e:vk,c:t}}function Vk(r){return{e:mk,t:r.permalink}}function zk(r){return{e:dk,t:r}}function Jk(r){let e={},t=[];return Object.assign(e,Vd(e,t),Ms(e,t),wm(e,t)),r(e),{e:fk,c:t}}function $k(r){return{e:pk,t:r.subredditName,l:r.showPrefix}}function Kk(r){let e={},t=[],i=[];return Object.assign(e,sS(e,t,i)),r(e),{e:xk,h:t,c:i}}function Xk(r){let[e,t]=iS();return r(e),{c:t}}function Zk(r,e){let[t,i]=iS();e(t);let n;switch(r.columnAlignment){case"left":n=wk;break;case"right":n=Ik;break;case"center":n=Fk;break}return{...n&&{a:n},...i&&{c:i}}}function Yk(r){let e={},t=[];return Object.assign(e,oS(e,t)),r(e),t}function Qk(r){return{e:ak,t:r.text,...r.formatting&&{f:r.formatting}}}function eS(r){return{e:gk,t:r.username,l:r.showPrefix}}function tS(r){return{e:hk,t:r.username,l:r.showPrefix}}function rS(r){return{e:Rk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function iS(){let r={},e=[];return Object.assign(r,Vd(r,e),Ms(r,e),Fm(r,e),Bs(r,e)),[r,e]}function Es(r,e){return{blockQuote(t,i){return e.push(Bk(t,i)),r}}}function Rs(r,e){return{codeBlock(t,i){return e.push(Mk(t,i)),r}}}function aS(r,e){return{embed(t){return e.push(Dk(t)),r}}}function Os(r,e){return{heading(t,i){return e.push(Lk(t,i)),r}}}function Gd(r,e){return{horizontalRule(){return e.push(_k()),r}}}function Bs(r,e){return{image(t){return e.push(Nk(t)),r},animatedImage(t){return e.push(Ok(t)),r}}}function wm(r,e){return{linebreak(){return e.push(qk()),r}}}function Ms(r,e){return{link(t){return e.push(Hk(t)),r},commentLink(t){return e.push(Uk(t)),r},postLink(t){return e.push(Vk(t)),r},subredditLink(t){return e.push($k(t)),r},userLink(t){return e.push(eS(t)),r},userMention(t){return e.push(tS(t)),r}}}function Us(r,e){return{list(t,i){return e.push(jk(t,i)),r}}}function nS(r,e){return{item(t){return e.push(Wk(t)),r}}}function Ls(r,e){return{paragraph(t){return e.push(Gk(t)),r}}}function Im(r,e){return{rawText(t){return e.push(zk(t)),r}}}function Fm(r,e){return{spoiler(t){return e.push(Jk(t)),r}}}function sS(r,e,t){return{headerCell(i,n){return e.push(Zk(i,n)),r},row(i){return t.push(Yk(i)),r}}}function Ds(r,e){return{table(t){return e.push(Kk(t)),r}}}function oS(r,e){return{cell(t){return e.push(Xk(t)),r}}}function Vd(r,e){return{text(t){return e.push(Qk(t)),r}}}function dS(r,e){return{video(t){return e.push(rS(t)),r}}}var vR=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},yR=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)},zd,_s=class{constructor(){zd.set(this,void 0);let e=[];Object.assign(this,Ls(this,e),Os(this,e),Gd(this,e),Es(this,e),Rs(this,e),aS(this,e),Us(this,e),Ds(this,e),Bs(this,e),dS(this,e)),vR(this,zd,{document:e},"f")}build(){return JSON.stringify(yR(this,zd,"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}};zd=new WeakMap;function ji(r){let e;return r instanceof _s?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var lS=100,uS=1/0,Or,Br,zt,Wi,Gi,Jd,W=class{constructor(e){l(this,Gi);l(this,Or);l(this,Br);l(this,zt);l(this,Wi,!1);this.pageSize=lS;this.limit=uS;this.children=[];X(this),this._fetch=e.fetch,this.pageSize=e.pageSize??lS,this.limit=e.limit??uS,d(this,Br,e.after),d(this,Or,e.before),d(this,zt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Wi)||!!(s(this,Br)||s(this,Or)||s(this,zt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Gi,Jd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,zt,e)}preventInitialFetch(){d(this,Wi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Gi,Jd).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,Gi,Jd).call(this);return this.children.slice(0,t)}};Or=new WeakMap,Br=new WeakMap,zt=new WeakMap,Wi=new WeakMap,Gi=new WeakSet,Jd=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,zt)});return this.children.push(...e),d(this,Or,t),d(this,Br,i),d(this,zt,n),d(this,Wi,!0),e};function bR(r){try{return!0}catch{return!1}}function kR(r){try{return!0}catch{return!1}}var Ns,xm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new W({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,Ns,xm).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,Ns,xm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Ns=new WeakSet,xm=function(e){if(h(e.id,"Mod note ID is null or undefined"),h(e.createdAt,"Mod note createdAt is null or undefined"),h(e.type,"Mod note type is null or undefined"),h(e.subreddit,"Mod note subreddit is null or undefined"),h(e.subredditId,"Mod note subredditId is null or undefined"),h(e.operator,"Mod note operator is null or undefined"),h(e.operatorId,"Mod note operatorId is null or undefined"),h(e.user,"Mod note user is null or undefined"),h(e.userId,"Mod note userId is null or undefined"),h(e.userNoteData,"Mod note userNote is null or undefined"),h(e.modActionData,"Mod note modAction is null or undefined"),!bR(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!kR(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:Re(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:ve(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Me,Ns);var kt=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 cS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_community","chat_operator"];function SR(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function Am(r){return SR(r,cS,!0)}function mS(r){return r.filter(e=>cS.includes(e))}var PR=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(PR||{}),Ur,Vi,zi,Ji,$i,Ki,Xi,Zi,Yi,Qi,en,$d,Ze=class Ze{constructor(e,t,i){l(this,Ur);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Yi);l(this,Qi);X(this),h(e.id),h(e.text),d(this,Ur,e.id),d(this,Vi,t),d(this,zi,e.text),d(this,Ji,CR(e.textColor)),d(this,$i,wR(e.backgroundColor)),d(this,Ki,IR(e.allowableContent)),d(this,Xi,e.modOnly),d(this,Zi,e.maxEmojis),d(this,Yi,e.textEditable),d(this,Qi,i)}get id(){return s(this,Ur)}get text(){return s(this,zi)}get textColor(){return s(this,Ji)}get backgroundColor(){return s(this,$i)}get allowableContent(){return s(this,Ki)}get modOnly(){return s(this,Xi)}get maxEmojis(){return s(this,Zi)}get allowUserEdits(){return s(this,Yi)}async delete(){return Ze.deleteFlairTemplate(s(this,Ur),s(this,Vi),s(this,Qi))}async edit(e){return Ze.editFlairTemplate({id:s(this,Ur),subredditName:s(this,Vi),text:e.text??s(this,zi),allowableContent:e.allowableContent??s(this,Ki),backgroundColor:e.backgroundColor??s(this,$i),maxEmojis:e.maxEmojis??s(this,Zi),modOnly:e.modOnly??s(this,Xi),textColor:e.textColor??s(this,Ji),allowUserEdits:e.allowUserEdits??s(this,Yi)},s(this,Qi))}static async createPostFlairTemplate(e,t){var i;return S(i=Ze,en,$d).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ze,en,$d).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ze,en,$d).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Ze(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Ze(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Ur=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,en=new WeakSet,$d=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,textColor:v="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 C=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:g,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ze(C,i,t)},l(Ze,en);var de=Ze;function qs(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Jt,Tm,Em,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,Jt,Tm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Mr,Jt,Tm).call(i,{...e,postId:fe(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Mr,Jt,Em).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Mr,Jt,Em).call(n,e,void 0,t,i)}};Jt=new WeakSet,Tm=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)},Em=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,Jt);var Ue=Mr;function CR(r){if(h(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function wR(r){if(h(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function IR(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as BR}from"@devvit/protos";var fS=Nn(hS(),1);var tn,js,rn,Ws,Gs,Vs,zs,Js,nn,$s,Ks,Xs,Zs,Ys,Qs,$t,eo,to,Dr,sn,Kt,on,an,dn,_r,Xt,Zt,ln,Yt,Qt,er,St,ro,io,un,cn,_,H=class H{constructor(e,t){l(this,tn);l(this,js);l(this,rn);l(this,Ws);l(this,Gs);l(this,Vs);l(this,zs);l(this,Js);l(this,nn);l(this,$s);l(this,Ks);l(this,Xs);l(this,Zs);l(this,Ys);l(this,Qs);l(this,$t);l(this,eo);l(this,to);l(this,Dr);l(this,sn);l(this,Kt);l(this,on);l(this,an);l(this,dn);l(this,_r);l(this,Xt);l(this,Zt);l(this,ln);l(this,Yt);l(this,Qt);l(this,er);l(this,St);l(this,ro);l(this,io);l(this,un);l(this,cn);l(this,_);X(this),h(e.id,"Post is missing id"),h(e.title,"Post is missing title"),h(e.createdUtc,"Post is missing created date"),h(e.author,"Post is missing author name"),h(e.subreddit,"Post is missing subreddit name"),h(e.subredditId,"Post is missing subreddit id"),h(e.url,"Post is missing url"),h(e.permalink,"Post is missing permalink"),d(this,tn,fe(`t3_${e.id}`)),d(this,rn,e.author),d(this,js,e.authorFullname?ne(e.authorFullname):void 0),d(this,Gs,Re(e.subredditId)),d(this,Vs,e.subreddit),d(this,Xs,e.score??0),d(this,Zs,e.numComments??0),d(this,Ys,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ws,i),d(this,Js,e.title),d(this,nn,e.selftext),d(this,$s,e.selftextHtml),d(this,Ks,e.url),d(this,zs,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,Qs,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,$t,e.approved??!1),d(this,eo,e.approvedAtUtc??0),d(this,to,e.bannedAtUtc??0),d(this,Kt,e.removed??!1),d(this,on,e.removedBy),d(this,an,e.removedByCategory),d(this,Dr,e.spam??!1),d(this,sn,e.stickied??!1),d(this,dn,e.archived??!1),d(this,_r,e.edited??!1),d(this,Xt,e.locked??!1),d(this,Zt,e.over18??!1),d(this,ln,e.quarantine??!1),d(this,Yt,e.spoiler),d(this,Qt,e.hidden??!1),d(this,er,e.ignoreReports??!1),d(this,St,e.distinguished),d(this,io,e.secureMedia),d(this,un,(e.modReports??[]).map(([n])=>n)),d(this,cn,(e.userReports??[]).map(([n])=>n)),d(this,_,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,ro,{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,tn)}get authorId(){return s(this,js)}get authorName(){return s(this,rn)}get subredditId(){return s(this,Gs)}get subredditName(){return s(this,Vs)}get permalink(){return s(this,zs)}get title(){return s(this,Js)}get body(){return s(this,nn)}get bodyHtml(){return s(this,$s)}get url(){return s(this,Ks)}get thumbnail(){return s(this,Qs)}get createdAt(){return s(this,Ws)}get score(){return s(this,Xs)}get numberOfComments(){return s(this,Zs)}get numberOfReports(){return s(this,Ys)}get approved(){return s(this,$t)}get approvedAtUtc(){return s(this,eo)}get bannedAtUtc(){return s(this,to)}get spam(){return s(this,Dr)}get stickied(){return s(this,sn)}get removed(){return s(this,Kt)}get removedBy(){return s(this,on)}get removedByCategory(){return s(this,an)}get archived(){return s(this,dn)}get edited(){return s(this,_r)}get locked(){return s(this,Xt)}get nsfw(){return s(this,Zt)}get quarantined(){return s(this,ln)}get spoiler(){return s(this,Yt)}get hidden(){return s(this,Qt)}get ignoringReports(){return s(this,er)}get distinguishedBy(){return s(this,St)}get comments(){return Q.getComments({postId:this.id},s(this,_))}get flair(){return s(this,ro)}get secureMedia(){return s(this,io)}get userReportReasons(){return s(this,cn)}get modReportReasons(){return s(this,un)}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,on),removedByCategory:s(this,an),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,un),userReportReasons:s(this,cn)}}isApproved(){return s(this,$t)}isSpam(){return s(this,Dr)}isStickied(){return s(this,sn)}isRemoved(){return s(this,Kt)}isArchived(){return s(this,dn)}isEdited(){return s(this,_r)}isLocked(){return s(this,Xt)}isNsfw(){return s(this,Zt)}isQuarantined(){return s(this,ln)}isSpoiler(){return s(this,Yt)}isHidden(){return s(this,Qt)}isIgnoringReports(){return s(this,er)}isDistinguishedBy(){return s(this,St)}async edit(e){let t=await H.edit({id:this.id,...e},s(this,_));d(this,nn,t.body),d(this,_r,t.edited)}async addComment(e){return Q.submit({id:this.id,...e},s(this,_))}async delete(){return H.delete(this.id,s(this,_))}async approve(){await H.approve(this.id,s(this,_)),d(this,$t,!0),d(this,Kt,!1)}async remove(e=!1){await H.remove(this.id,e,s(this,_)),d(this,Kt,!0),d(this,Dr,e),d(this,$t,!1)}async lock(){await H.lock(this.id,s(this,_)),d(this,Xt,!0)}async unlock(){await H.unlock(this.id,s(this,_)),d(this,Xt,!1)}async hide(){await H.hide(this.id,s(this,_)),d(this,Qt,!0)}async unhide(){await H.unhide(this.id,s(this,_)),d(this,Qt,!1)}async markAsNsfw(){await H.markAsNsfw(this.id,s(this,_)),d(this,Zt,!0)}async unmarkAsNsfw(){await H.unmarkAsNsfw(this.id,s(this,_)),d(this,Zt,!1)}async markAsSpoiler(){await H.markAsSpoiler(this.id,s(this,_)),d(this,Yt,!0)}async unmarkAsSpoiler(){await H.unmarkAsSpoiler(this.id,s(this,_)),d(this,Yt,!1)}async sticky(e){await H.sticky(this.id,e,s(this,_))}async unsticky(){await H.unsticky(this.id,s(this,_))}async distinguish(){let{distinguishedBy:e}=await H.distinguish(this.id,!1,s(this,_));d(this,St,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await H.distinguish(this.id,!0,s(this,_));d(this,St,e)}async undistinguish(){let{distinguishedBy:e}=await H.undistinguish(this.id,s(this,_));d(this,St,e)}async ignoreReports(){await H.ignoreReports(this.id,s(this,_)),d(this,er,!0)}async unignoreReports(){await H.unignoreReports(this.id,s(this,_)),d(this,er,!1)}async getAuthor(){return I.getByUsername(s(this,rn),s(this,_))}async crosspost(e){return H.crosspost({...e,postId:this.id},s(this,_))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,tn)],...e},s(this,_))}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 H(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){h(t,"Missing metadata in `SubmitPostOptions`");let c=await new gt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=BR.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,fS.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?ji(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 H.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 H.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=ji(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 H.getById(n,t)}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 h(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 h(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 W({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 Hs(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new W({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 Hs(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({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 Hs(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({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 Hs(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({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 Hs(o,t)}})}};tn=new WeakMap,js=new WeakMap,rn=new WeakMap,Ws=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,nn=new WeakMap,$s=new WeakMap,Ks=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,$t=new WeakMap,eo=new WeakMap,to=new WeakMap,Dr=new WeakMap,sn=new WeakMap,Kt=new WeakMap,on=new WeakMap,an=new WeakMap,dn=new WeakMap,_r=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,ln=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,er=new WeakMap,St=new WeakMap,ro=new WeakMap,io=new WeakMap,un=new WeakMap,cn=new WeakMap,_=new WeakMap;var z=H;function Hs(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 MR=(q=>(q.Custom="CUSTOM",q.Reddit="REDDIT",q.Instagram="INSTAGRAM",q.Twitter="TWITTER",q.Tiktok="TIKTOK",q.Twitch="TWITCH",q.Facebook="FACEBOOK",q.Youtube="YOUTUBE",q.Tumblr="TUMBLR",q.Spotify="SPOTIFY",q.Soundcloud="SOUNDCLOUD",q.Beacons="BEACONS",q.Linktree="LINKTREE",q.Discord="DISCORD",q.Venmo="VENMO",q.CashApp="CASH_APP",q.Patreon="PATREON",q.Kofi="KOFI",q.Paypal="PAYPAL",q.Cameo="CAMEO",q.Onlyfans="ONLYFANS",q.Substack="SUBSTACK",q.Kickstarter="KICKSTARTER",q.Indiegogo="INDIEGOGO",q.BuyMeACoffee="BUY_ME_A_COFFEE",q.Shopify="SHOPIFY",q))(MR||{}),no,mn,so,oo,ao,lo,uo,tr,co,mo,at,Nr=class Nr{constructor(e,t){l(this,no);l(this,mn);l(this,so);l(this,oo);l(this,ao);l(this,lo);l(this,uo);l(this,tr,new Map);l(this,co);l(this,mo);l(this,at);X(this),h(e.id,"User ID is missing or undefined"),h(e.name,"Username is missing or undefined"),h(e.createdUtc,"User is missing created date"),d(this,no,ne(dd(e.id)?e.id:`t2_${e.id}`)),d(this,mn,e.name),d(this,lo,e.over18??!1),d(this,uo,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,so,i),d(this,oo,e.linkKarma??0),d(this,ao,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,tr).set(n,mS(o));d(this,co,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,mo,e.subreddit?.url??""),d(this,at,t)}get id(){return s(this,no)}get username(){return s(this,mn)}get createdAt(){return s(this,so)}get linkKarma(){return s(this,oo)}get commentKarma(){return s(this,ao)}get nsfw(){return s(this,lo)}get isAdmin(){return s(this,uo)}get modPermissions(){return s(this,tr)}get url(){return s(this,co)}get permalink(){return s(this,mo)}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,tr).has(e))return s(this,tr).get(e);let t=await Nr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,at)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,tr).set(e,i),i}getComments(e){return Q.getCommentsByUser({username:this.username,...e},s(this,at))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,at))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,mn)},s(this,at));return t.users[0]?qs(t.users[0]):void 0}getSnoovatarUrl(){return Nr.getSnoovatarUrl(this.username,s(this,at))}async getSocialLinks(){let i=await kt.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,at));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:Nr.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new Nr(n.data,t)}static async getFromMetadata(e,t){h(t);let i=t?.[e]?.values[0];return i?Nr.getById(ne(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new W({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 LR(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?Am(c):void 0,...p},t);if(g.json?.errors?.length)throw new Error(g.json.errors.join(`
1
+ var xS=Object.create;var Lm=Object.defineProperty;var AS=Object.getOwnPropertyDescriptor;var TS=Object.getOwnPropertyNames;var ES=Object.getPrototypeOf,RS=Object.prototype.hasOwnProperty;var Dm=r=>{throw TypeError(r)};var f=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var OS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of TS(e))!RS.call(r,n)&&n!==t&&Lm(r,n,{get:()=>e[n],enumerable:!(i=AS(e,n))||i.enumerable});return r};var _n=(r,e,t)=>(t=r!=null?xS(ES(r)):{},OS(e||!r||!r.__esModule?Lm(t,"default",{value:r,enumerable:!0}):t,r));var gl=(r,e,t)=>e.has(r)||Dm("Cannot "+t);var s=(r,e,t)=>(gl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Dm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(gl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(gl(r,e,"access private method"),t);var ae=f((aO,Nm)=>{Nm.exports=function(r){try{return!!r()}catch{return!0}}});var ka=f((dO,_m)=>{var BS=ae();_m.exports=!BS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=f((lO,jm)=>{var qm=ka(),Hm=Function.prototype,hl=Hm.call,MS=qm&&Hm.bind.bind(hl,hl);jm.exports=qm?MS:function(r){return function(){return hl.apply(r,arguments)}}});var Gm=f((uO,Wm)=>{var US=Math.ceil,LS=Math.floor;Wm.exports=Math.trunc||function(e){var t=+e;return(t>0?LS:US)(t)}});var Sa=f((cO,Vm)=>{var DS=Gm();Vm.exports=function(r){var e=+r;return e!==e||e===0?0:DS(e)}});var pe=f((mO,zm)=>{var Pa=function(r){return r&&r.Math==Math&&r};zm.exports=Pa(typeof globalThis=="object"&&globalThis)||Pa(typeof window=="object"&&window)||Pa(typeof self=="object"&&self)||Pa(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=f((pO,Jm)=>{Jm.exports=!1});var Ca=f((gO,Km)=>{var $m=pe(),NS=Object.defineProperty;Km.exports=function(r,e){try{NS($m,r,{value:e,configurable:!0,writable:!0})}catch{$m[r]=e}return e}});var wa=f((hO,Zm)=>{var _S=pe(),qS=Ca(),Xm="__core-js_shared__",HS=_S[Xm]||qS(Xm,{});Zm.exports=HS});var fl=f((fO,Qm)=>{var jS=Wr(),Ym=wa();(Qm.exports=function(r,e){return Ym[r]||(Ym[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:jS?"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 Ia=f((vO,ep)=>{ep.exports=function(r){return r==null}});var Fa=f((yO,tp)=>{var WS=Ia(),GS=TypeError;tp.exports=function(r){if(WS(r))throw GS("Can't call method on "+r);return r}});var qn=f((bO,rp)=>{var VS=Fa(),zS=Object;rp.exports=function(r){return zS(VS(r))}});var we=f((kO,ip)=>{var JS=Z(),$S=qn(),KS=JS({}.hasOwnProperty);ip.exports=Object.hasOwn||function(e,t){return KS($S(e),t)}});var vl=f((SO,np)=>{var XS=Z(),ZS=0,YS=Math.random(),QS=XS(1 .toString);np.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+QS(++ZS+YS,36)}});var op=f((PO,sp)=>{sp.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var pp=f((CO,mp)=>{var cp=pe(),yl=op(),ap=cp.process,dp=cp.Deno,lp=ap&&ap.versions||dp&&dp.version,up=lp&&lp.v8,We,xa;up&&(We=up.split("."),xa=We[0]>0&&We[0]<4?1:+(We[0]+We[1]));!xa&&yl&&(We=yl.match(/Edge\/(\d+)/),(!We||We[1]>=74)&&(We=yl.match(/Chrome\/(\d+)/),We&&(xa=+We[1])));mp.exports=xa});var bl=f((wO,hp)=>{var gp=pp(),eP=ae();hp.exports=!!Object.getOwnPropertySymbols&&!eP(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&gp&&gp<41})});var kl=f((IO,fp)=>{var tP=bl();fp.exports=tP&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ie=f((FO,yp)=>{var rP=pe(),iP=fl(),vp=we(),nP=vl(),sP=bl(),oP=kl(),Gr=rP.Symbol,Sl=iP("wks"),aP=oP?Gr.for||Gr:Gr&&Gr.withoutSetter||nP;yp.exports=function(r){return vp(Sl,r)||(Sl[r]=sP&&vp(Gr,r)?Gr[r]:aP("Symbol."+r)),Sl[r]}});var Sp=f((xO,kp)=>{var dP=Ie(),lP=dP("toStringTag"),bp={};bp[lP]="z";kp.exports=String(bp)==="[object z]"});var Cl=f((AO,Pp)=>{var Pl=typeof document=="object"&&document.all,uP=typeof Pl>"u"&&Pl!==void 0;Pp.exports={all:Pl,IS_HTMLDDA:uP}});var Y=f((TO,wp)=>{var Cp=Cl(),cP=Cp.all;wp.exports=Cp.IS_HTMLDDA?function(r){return typeof r=="function"||r===cP}:function(r){return typeof r=="function"}});var Aa=f((EO,Fp)=>{var Ip=Z(),mP=Ip({}.toString),pP=Ip("".slice);Fp.exports=function(r){return pP(mP(r),8,-1)}});var Hn=f((RO,xp)=>{var gP=Sp(),hP=Y(),Ta=Aa(),fP=Ie(),vP=fP("toStringTag"),yP=Object,bP=Ta(function(){return arguments}())=="Arguments",kP=function(r,e){try{return r[e]}catch{}};xp.exports=gP?Ta:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=kP(e=yP(r),vP))=="string"?t:bP?Ta(e):(i=Ta(e))=="Object"&&hP(e.callee)?"Arguments":i}});var jn=f((OO,Ap)=>{var SP=Hn(),PP=String;Ap.exports=function(r){if(SP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return PP(r)}});var Il=f((BO,Rp)=>{var wl=Z(),CP=Sa(),wP=jn(),IP=Fa(),FP=wl("".charAt),Tp=wl("".charCodeAt),xP=wl("".slice),Ep=function(r){return function(e,t){var i=wP(IP(e)),n=CP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Tp(i,n),a<55296||a>56319||n+1===o||(c=Tp(i,n+1))<56320||c>57343?r?FP(i,n):a:r?xP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Rp.exports={codeAt:Ep(!1),charAt:Ep(!0)}});var Mp=f((MO,Bp)=>{var AP=pe(),TP=Y(),Op=AP.WeakMap;Bp.exports=TP(Op)&&/native code/.test(String(Op))});var It=f((UO,Dp)=>{var Up=Y(),Lp=Cl(),EP=Lp.all;Dp.exports=Lp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Up(r)||r===EP}:function(r){return typeof r=="object"?r!==null:Up(r)}});var ge=f((LO,Np)=>{var RP=ae();Np.exports=!RP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var xl=f((DO,qp)=>{var OP=pe(),_p=It(),Fl=OP.document,BP=_p(Fl)&&_p(Fl.createElement);qp.exports=function(r){return BP?Fl.createElement(r):{}}});var Al=f((NO,Hp)=>{var MP=ge(),UP=ae(),LP=xl();Hp.exports=!MP&&!UP(function(){return Object.defineProperty(LP("div"),"a",{get:function(){return 7}}).a!=7})});var Tl=f((_O,jp)=>{var DP=ge(),NP=ae();jp.exports=DP&&NP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Qe=f((qO,Wp)=>{var _P=It(),qP=String,HP=TypeError;Wp.exports=function(r){if(_P(r))return r;throw HP(qP(r)+" is not an object")}});var Ge=f((HO,Gp)=>{var jP=ka(),Ea=Function.prototype.call;Gp.exports=jP?Ea.bind(Ea):function(){return Ea.apply(Ea,arguments)}});var Wn=f((jO,Vp)=>{var El=pe(),WP=Y(),GP=function(r){return WP(r)?r:void 0};Vp.exports=function(r,e){return arguments.length<2?GP(El[r]):El[r]&&El[r][e]}});var Rl=f((WO,zp)=>{var VP=Z();zp.exports=VP({}.isPrototypeOf)});var Ol=f((GO,Jp)=>{var zP=Wn(),JP=Y(),$P=Rl(),KP=kl(),XP=Object;Jp.exports=KP?function(r){return typeof r=="symbol"}:function(r){var e=zP("Symbol");return JP(e)&&$P(e.prototype,XP(r))}});var Bl=f((VO,$p)=>{var ZP=String;$p.exports=function(r){try{return ZP(r)}catch{return"Object"}}});var Ra=f((zO,Kp)=>{var YP=Y(),QP=Bl(),eC=TypeError;Kp.exports=function(r){if(YP(r))return r;throw eC(QP(r)+" is not a function")}});var Oa=f((JO,Xp)=>{var tC=Ra(),rC=Ia();Xp.exports=function(r,e){var t=r[e];return rC(t)?void 0:tC(t)}});var Yp=f(($O,Zp)=>{var Ml=Ge(),Ul=Y(),Ll=It(),iC=TypeError;Zp.exports=function(r,e){var t,i;if(e==="string"&&Ul(t=r.toString)&&!Ll(i=Ml(t,r))||Ul(t=r.valueOf)&&!Ll(i=Ml(t,r))||e!=="string"&&Ul(t=r.toString)&&!Ll(i=Ml(t,r)))return i;throw iC("Can't convert object to primitive value")}});var rg=f((KO,tg)=>{var nC=Ge(),Qp=It(),eg=Ol(),sC=Oa(),oC=Yp(),aC=Ie(),dC=TypeError,lC=aC("toPrimitive");tg.exports=function(r,e){if(!Qp(r)||eg(r))return r;var t=sC(r,lC),i;if(t){if(e===void 0&&(e="default"),i=nC(t,r,e),!Qp(i)||eg(i))return i;throw dC("Can't convert object to primitive value")}return e===void 0&&(e="number"),oC(r,e)}});var Ba=f((XO,ig)=>{var uC=rg(),cC=Ol();ig.exports=function(r){var e=uC(r,"string");return cC(e)?e:e+""}});var et=f(sg=>{var mC=ge(),pC=Al(),gC=Tl(),Ma=Qe(),ng=Ba(),hC=TypeError,Dl=Object.defineProperty,fC=Object.getOwnPropertyDescriptor,Nl="enumerable",_l="configurable",ql="writable";sg.f=mC?gC?function(e,t,i){if(Ma(e),t=ng(t),Ma(i),typeof e=="function"&&t==="prototype"&&"value"in i&&ql in i&&!i[ql]){var n=fC(e,t);n&&n[ql]&&(e[t]=i.value,i={configurable:_l in i?i[_l]:n[_l],enumerable:Nl in i?i[Nl]:n[Nl],writable:!1})}return Dl(e,t,i)}:Dl:function(e,t,i){if(Ma(e),t=ng(t),Ma(i),pC)try{return Dl(e,t,i)}catch{}if("get"in i||"set"in i)throw hC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=f((YO,og)=>{og.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ua=f((QO,ag)=>{var vC=ge(),yC=et(),bC=Vr();ag.exports=vC?function(r,e,t){return yC.f(r,e,bC(1,t))}:function(r,e,t){return r[e]=t,r}});var La=f((eB,lg)=>{var kC=fl(),SC=vl(),dg=kC("keys");lg.exports=function(r){return dg[r]||(dg[r]=SC(r))}});var Da=f((tB,ug)=>{ug.exports={}});var zr=f((rB,pg)=>{var PC=Mp(),mg=pe(),CC=It(),wC=Ua(),Hl=we(),jl=wa(),IC=La(),FC=Da(),cg="Object already initialized",Wl=mg.TypeError,xC=mg.WeakMap,Na,Gn,_a,AC=function(r){return _a(r)?Gn(r):Na(r,{})},TC=function(r){return function(e){var t;if(!CC(e)||(t=Gn(e)).type!==r)throw Wl("Incompatible receiver, "+r+" required");return t}};PC||jl.state?(Ve=jl.state||(jl.state=new xC),Ve.get=Ve.get,Ve.has=Ve.has,Ve.set=Ve.set,Na=function(r,e){if(Ve.has(r))throw Wl(cg);return e.facade=r,Ve.set(r,e),e},Gn=function(r){return Ve.get(r)||{}},_a=function(r){return Ve.has(r)}):(sr=IC("state"),FC[sr]=!0,Na=function(r,e){if(Hl(r,sr))throw Wl(cg);return e.facade=r,wC(r,sr,e),e},Gn=function(r){return Hl(r,sr)?r[sr]:{}},_a=function(r){return Hl(r,sr)});var Ve,sr;pg.exports={set:Na,get:Gn,has:_a,enforce:AC,getterFor:TC}});var Gl=f(fg=>{"use strict";var gg={}.propertyIsEnumerable,hg=Object.getOwnPropertyDescriptor,EC=hg&&!gg.call({1:2},1);fg.f=EC?function(e){var t=hg(this,e);return!!t&&t.enumerable}:gg});var zl=f((nB,vg)=>{var RC=Z(),OC=ae(),BC=Aa(),Vl=Object,MC=RC("".split);vg.exports=OC(function(){return!Vl("z").propertyIsEnumerable(0)})?function(r){return BC(r)=="String"?MC(r,""):Vl(r)}:Vl});var Jr=f((sB,yg)=>{var UC=zl(),LC=Fa();yg.exports=function(r){return UC(LC(r))}});var Jl=f(kg=>{var DC=ge(),NC=Ge(),_C=Gl(),qC=Vr(),HC=Jr(),jC=Ba(),WC=we(),GC=Al(),bg=Object.getOwnPropertyDescriptor;kg.f=DC?bg:function(e,t){if(e=HC(e),t=jC(t),GC)try{return bg(e,t)}catch{}if(WC(e,t))return qC(!NC(_C.f,e,t),e[t])}});var Xl=f((aB,Pg)=>{var $l=ge(),VC=we(),Sg=Function.prototype,zC=$l&&Object.getOwnPropertyDescriptor,Kl=VC(Sg,"name"),JC=Kl&&function(){}.name==="something",$C=Kl&&(!$l||$l&&zC(Sg,"name").configurable);Pg.exports={EXISTS:Kl,PROPER:JC,CONFIGURABLE:$C}});var Yl=f((dB,Cg)=>{var KC=Z(),XC=Y(),Zl=wa(),ZC=KC(Function.toString);XC(Zl.inspectSource)||(Zl.inspectSource=function(r){return ZC(r)});Cg.exports=Zl.inspectSource});var tu=f((lB,Fg)=>{var eu=Z(),YC=ae(),QC=Y(),qa=we(),Ql=ge(),e0=Xl().CONFIGURABLE,t0=Yl(),Ig=zr(),r0=Ig.enforce,i0=Ig.get,wg=String,Ha=Object.defineProperty,n0=eu("".slice),s0=eu("".replace),o0=eu([].join),a0=Ql&&!YC(function(){return Ha(function(){},"length",{value:8}).length!==8}),d0=String(String).split("String"),l0=Fg.exports=function(r,e,t){n0(wg(e),0,7)==="Symbol("&&(e="["+s0(wg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!qa(r,"name")||e0&&r.name!==e)&&(Ql?Ha(r,"name",{value:e,configurable:!0}):r.name=e),a0&&t&&qa(t,"arity")&&r.length!==t.arity&&Ha(r,"length",{value:t.arity});try{t&&qa(t,"constructor")&&t.constructor?Ql&&Ha(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=r0(r);return qa(i,"source")||(i.source=o0(d0,typeof e=="string"?e:"")),r};Function.prototype.toString=l0(function(){return QC(this)&&i0(this).source||t0(this)},"toString")});var or=f((uB,xg)=>{var u0=Y(),c0=et(),m0=tu(),p0=Ca();xg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(u0(t)&&m0(t,o,i),i.global)n?r[e]=t:p0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:c0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var ru=f((cB,Ag)=>{var g0=Sa(),h0=Math.max,f0=Math.min;Ag.exports=function(r,e){var t=g0(r);return t<0?h0(t+e,0):f0(t,e)}});var Eg=f((mB,Tg)=>{var v0=Sa(),y0=Math.min;Tg.exports=function(r){return r>0?y0(v0(r),9007199254740991):0}});var ja=f((pB,Rg)=>{var b0=Eg();Rg.exports=function(r){return b0(r.length)}});var Mg=f((gB,Bg)=>{var k0=Jr(),S0=ru(),P0=ja(),Og=function(r){return function(e,t,i){var n=k0(e),o=P0(n),a=S0(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}};Bg.exports={includes:Og(!0),indexOf:Og(!1)}});var nu=f((hB,Lg)=>{var C0=Z(),iu=we(),w0=Jr(),I0=Mg().indexOf,F0=Da(),Ug=C0([].push);Lg.exports=function(r,e){var t=w0(r),i=0,n=[],o;for(o in t)!iu(F0,o)&&iu(t,o)&&Ug(n,o);for(;e.length>i;)iu(t,o=e[i++])&&(~I0(n,o)||Ug(n,o));return n}});var Wa=f((fB,Dg)=>{Dg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var _g=f(Ng=>{var x0=nu(),A0=Wa(),T0=A0.concat("length","prototype");Ng.f=Object.getOwnPropertyNames||function(e){return x0(e,T0)}});var su=f(qg=>{qg.f=Object.getOwnPropertySymbols});var jg=f((bB,Hg)=>{var E0=Wn(),R0=Z(),O0=_g(),B0=su(),M0=Qe(),U0=R0([].concat);Hg.exports=E0("Reflect","ownKeys")||function(e){var t=O0.f(M0(e)),i=B0.f;return i?U0(t,i(e)):t}});var Vg=f((kB,Gg)=>{var Wg=we(),L0=jg(),D0=Jl(),N0=et();Gg.exports=function(r,e,t){for(var i=L0(e),n=N0.f,o=D0.f,a=0;a<i.length;a++){var c=i[a];!Wg(r,c)&&!(t&&Wg(t,c))&&n(r,c,o(e,c))}}});var Jg=f((SB,zg)=>{var _0=ae(),q0=Y(),H0=/#|\.prototype\./,Vn=function(r,e){var t=W0[j0(r)];return t==V0?!0:t==G0?!1:q0(e)?_0(e):!!e},j0=Vn.normalize=function(r){return String(r).replace(H0,".").toLowerCase()},W0=Vn.data={},G0=Vn.NATIVE="N",V0=Vn.POLYFILL="P";zg.exports=Vn});var zn=f((PB,$g)=>{var ou=pe(),z0=Jl().f,J0=Ua(),$0=or(),K0=Ca(),X0=Vg(),Z0=Jg();$g.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,v;if(i?a=ou:n?a=ou[t]||K0(t,{}):a=(ou[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(v=z0(a,c),p=v&&v.value):p=a[c],o=Z0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;X0(g,p)}(r.sham||p&&p.sham)&&J0(g,"sham",!0),$0(a,c,g,r)}}});var au=f((CB,Kg)=>{var Y0=nu(),Q0=Wa();Kg.exports=Object.keys||function(e){return Y0(e,Q0)}});var Zg=f(Xg=>{var ew=ge(),tw=Tl(),rw=et(),iw=Qe(),nw=Jr(),sw=au();Xg.f=ew&&!tw?Object.defineProperties:function(e,t){iw(e);for(var i=nw(t),n=sw(t),o=n.length,a=0,c;o>a;)rw.f(e,c=n[a++],i[c]);return e}});var Qg=f((IB,Yg)=>{var ow=Wn();Yg.exports=ow("document","documentElement")});var Jn=f((FB,oh)=>{var aw=Qe(),dw=Zg(),eh=Wa(),lw=Da(),uw=Qg(),cw=xl(),mw=La(),th=">",rh="<",lu="prototype",uu="script",nh=mw("IE_PROTO"),du=function(){},sh=function(r){return rh+uu+th+r+rh+"/"+uu+th},ih=function(r){r.write(sh("")),r.close();var e=r.parentWindow.Object;return r=null,e},pw=function(){var r=cw("iframe"),e="java"+uu+":",t;return r.style.display="none",uw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(sh("document.F=Object")),t.close(),t.F},Ga,Va=function(){try{Ga=new ActiveXObject("htmlfile")}catch{}Va=typeof document<"u"?document.domain&&Ga?ih(Ga):pw():ih(Ga);for(var r=eh.length;r--;)delete Va[lu][eh[r]];return Va()};lw[nh]=!0;oh.exports=Object.create||function(e,t){var i;return e!==null?(du[lu]=aw(e),i=new du,du[lu]=null,i[nh]=e):i=Va(),t===void 0?i:dw.f(i,t)}});var dh=f((xB,ah)=>{var gw=ae();ah.exports=!gw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var mu=f((AB,uh)=>{var hw=we(),fw=Y(),vw=qn(),yw=La(),bw=dh(),lh=yw("IE_PROTO"),cu=Object,kw=cu.prototype;uh.exports=bw?cu.getPrototypeOf:function(r){var e=vw(r);if(hw(e,lh))return e[lh];var t=e.constructor;return fw(t)&&e instanceof t?t.prototype:e instanceof cu?kw:null}});var fu=f((TB,ph)=>{"use strict";var Sw=ae(),Pw=Y(),Cw=It(),ww=Jn(),ch=mu(),Iw=or(),Fw=Ie(),xw=Wr(),hu=Fw("iterator"),mh=!1,ut,pu,gu;[].keys&&(gu=[].keys(),"next"in gu?(pu=ch(ch(gu)),pu!==Object.prototype&&(ut=pu)):mh=!0);var Aw=!Cw(ut)||Sw(function(){var r={};return ut[hu].call(r)!==r});Aw?ut={}:xw&&(ut=ww(ut));Pw(ut[hu])||Iw(ut,hu,function(){return this});ph.exports={IteratorPrototype:ut,BUGGY_SAFARI_ITERATORS:mh}});var $n=f((EB,hh)=>{var Tw=et().f,Ew=we(),Rw=Ie(),gh=Rw("toStringTag");hh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Ew(r,gh)&&Tw(r,gh,{configurable:!0,value:e})}});var $r=f((RB,fh)=>{fh.exports={}});var vu=f((OB,vh)=>{"use strict";var Ow=fu().IteratorPrototype,Bw=Jn(),Mw=Vr(),Uw=$n(),Lw=$r(),Dw=function(){return this};vh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Bw(Ow,{next:Mw(+!i,t)}),Uw(r,n,!1,!0),Lw[n]=Dw,r}});var bh=f((BB,yh)=>{var Nw=Y(),_w=String,qw=TypeError;yh.exports=function(r){if(typeof r=="object"||Nw(r))return r;throw qw("Can't set "+_w(r)+" as a prototype")}});var Sh=f((MB,kh)=>{var Hw=Z(),jw=Qe(),Ww=bh();kh.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Hw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return jw(n),Ww(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var bu=f((UB,Rh)=>{"use strict";var Gw=zn(),Vw=Ge(),za=Wr(),Th=Xl(),zw=Y(),Jw=vu(),Ph=mu(),Ch=Sh(),$w=$n(),Kw=Ua(),yu=or(),Xw=Ie(),wh=$r(),Eh=fu(),Zw=Th.PROPER,Yw=Th.CONFIGURABLE,Ih=Eh.IteratorPrototype,Ja=Eh.BUGGY_SAFARI_ITERATORS,Kn=Xw("iterator"),Fh="keys",Xn="values",xh="entries",Ah=function(){return this};Rh.exports=function(r,e,t,i,n,o,a){Jw(t,e,i);var c=function(B){if(B===n&&b)return b;if(!Ja&&B in v)return v[B];switch(B){case Fh:return function(){return new t(this,B)};case Xn:return function(){return new t(this,B)};case xh:return function(){return new t(this,B)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,v=r.prototype,m=v[Kn]||v["@@iterator"]||n&&v[n],b=!Ja&&m||c(n),y=e=="Array"&&v.entries||m,C,w,A;if(y&&(C=Ph(y.call(new r)),C!==Object.prototype&&C.next&&(!za&&Ph(C)!==Ih&&(Ch?Ch(C,Ih):zw(C[Kn])||yu(C,Kn,Ah)),$w(C,p,!0,!0),za&&(wh[p]=Ah))),Zw&&n==Xn&&m&&m.name!==Xn&&(!za&&Yw?Kw(v,"name",Xn):(g=!0,b=function(){return Vw(m,this)})),n)if(w={values:c(Xn),keys:o?b:c(Fh),entries:c(xh)},a)for(A in w)(Ja||g||!(A in v))&&yu(v,A,w[A]);else Gw({target:e,proto:!0,forced:Ja||g},w);return(!za||a)&&v[Kn]!==b&&yu(v,Kn,b,{name:n}),wh[e]=b,w}});var ku=f((LB,Oh)=>{Oh.exports=function(r,e){return{value:r,done:e}}});var Lh=f(()=>{"use strict";var Qw=Il().charAt,eI=jn(),Mh=zr(),tI=bu(),Bh=ku(),Uh="String Iterator",rI=Mh.set,iI=Mh.getterFor(Uh);tI(String,"String",function(r){rI(this,{type:Uh,string:eI(r),index:0})},function(){var e=iI(this),t=e.string,i=e.index,n;return i>=t.length?Bh(void 0,!0):(n=Qw(t,i),e.index+=n.length,Bh(n,!1))})});var Su=f((_B,Dh)=>{var nI=ae(),sI=Ie(),oI=Wr(),aI=sI("iterator");Dh.exports=!nI(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}),oI&&!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[aI]||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 _h=f((qB,Nh)=>{var dI=Aa(),lI=Z();Nh.exports=function(r){if(dI(r)==="Function")return lI(r)}});var $a=f((HB,Hh)=>{var qh=_h(),uI=Ra(),cI=ka(),mI=qh(qh.bind);Hh.exports=function(r,e){return uI(r),e===void 0?r:cI?mI(r,e):function(){return r.apply(e,arguments)}}});var Gh=f((jB,Wh)=>{var jh=tu(),pI=et();Wh.exports=function(r,e,t){return t.get&&jh(t.get,e,{getter:!0}),t.set&&jh(t.set,e,{setter:!0}),pI.f(r,e,t)}});var Pu=f((WB,Vh)=>{var gI=Rl(),hI=TypeError;Vh.exports=function(r,e){if(gI(e,r))return r;throw hI("Incorrect invocation")}});var Kh=f((GB,$h)=>{"use strict";var zh=ge(),fI=Z(),vI=Ge(),yI=ae(),Cu=au(),bI=su(),kI=Gl(),SI=qn(),PI=zl(),Kr=Object.assign,Jh=Object.defineProperty,CI=fI([].concat);$h.exports=!Kr||yI(function(){if(zh&&Kr({b:1},Kr(Jh({},"a",{enumerable:!0,get:function(){Jh(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||Cu(Kr({},e)).join("")!=i})?function(e,t){for(var i=SI(e),n=arguments.length,o=1,a=bI.f,c=kI.f;n>o;)for(var p=PI(arguments[o++]),g=a?CI(Cu(p),a(p)):Cu(p),v=g.length,m=0,b;v>m;)b=g[m++],(!zh||vI(c,p,b))&&(i[b]=p[b]);return i}:Kr});var Yh=f((VB,Zh)=>{var wI=Ge(),Xh=Qe(),II=Oa();Zh.exports=function(r,e,t){var i,n;Xh(r);try{if(i=II(r,"return"),!i){if(e==="throw")throw t;return t}i=wI(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Xh(i),t}});var ef=f((zB,Qh)=>{var FI=Qe(),xI=Yh();Qh.exports=function(r,e,t,i){try{return i?e(FI(t)[0],t[1]):e(t)}catch(n){xI(r,"throw",n)}}});var rf=f((JB,tf)=>{var AI=Ie(),TI=$r(),EI=AI("iterator"),RI=Array.prototype;tf.exports=function(r){return r!==void 0&&(TI.Array===r||RI[EI]===r)}});var lf=f(($B,df)=>{var OI=Z(),BI=ae(),nf=Y(),MI=Hn(),UI=Wn(),LI=Yl(),sf=function(){},DI=[],of=UI("Reflect","construct"),wu=/^\s*(?:class|function)\b/,NI=OI(wu.exec),_I=!wu.exec(sf),Zn=function(e){if(!nf(e))return!1;try{return of(sf,DI,e),!0}catch{return!1}},af=function(e){if(!nf(e))return!1;switch(MI(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _I||!!NI(wu,LI(e))}catch{return!0}};af.sham=!0;df.exports=!of||BI(function(){var r;return Zn(Zn.call)||!Zn(Object)||!Zn(function(){r=!0})||r})?af:Zn});var Iu=f((KB,uf)=>{"use strict";var qI=Ba(),HI=et(),jI=Vr();uf.exports=function(r,e,t){var i=qI(e);i in r?HI.f(r,i,jI(0,t)):r[i]=t}});var Ka=f((XB,mf)=>{var WI=Hn(),cf=Oa(),GI=Ia(),VI=$r(),zI=Ie(),JI=zI("iterator");mf.exports=function(r){if(!GI(r))return cf(r,JI)||cf(r,"@@iterator")||VI[WI(r)]}});var Fu=f((ZB,pf)=>{var $I=Ge(),KI=Ra(),XI=Qe(),ZI=Bl(),YI=Ka(),QI=TypeError;pf.exports=function(r,e){var t=arguments.length<2?YI(r):e;if(KI(t))return XI($I(t,r));throw QI(ZI(r)+" is not iterable")}});var vf=f((YB,ff)=>{"use strict";var eF=$a(),tF=Ge(),rF=qn(),iF=ef(),nF=rf(),sF=lf(),oF=ja(),gf=Iu(),aF=Fu(),dF=Ka(),hf=Array;ff.exports=function(e){var t=rF(e),i=sF(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=eF(o,n>2?arguments[2]:void 0));var c=dF(t),p=0,g,v,m,b,y,C;if(c&&!(this===hf&&nF(c)))for(b=aF(t,c),y=b.next,v=i?new this:[];!(m=tF(y,b)).done;p++)C=a?iF(b,o,[m.value,p],!0):m.value,gf(v,p,C);else for(g=oF(t),v=i?new this(g):hf(g);g>p;p++)C=a?o(t[p],p):t[p],gf(v,p,C);return v.length=p,v}});var xu=f((QB,bf)=>{var yf=ru(),lF=ja(),uF=Iu(),cF=Array,mF=Math.max;bf.exports=function(r,e,t){for(var i=lF(r),n=yf(e,i),o=yf(t===void 0?i:t,i),a=cF(mF(o-n,0)),c=0;n<o;n++,c++)uF(a,c,r[n]);return a.length=c,a}});var Af=f((eM,xf)=>{var ar=Z(),Au=2147483647,Yn=36,wf=1,Ru=26,pF=38,gF=700,hF=72,fF=128,vF="-",yF=/[^\0-\u007E]/,If=/[.\u3002\uFF0E\uFF61]/g,kf="Overflow: input needs wider integers to process",Tu=Yn-wf,Sf=RangeError,bF=ar(If.exec),Xr=Math.floor,Eu=String.fromCharCode,Pf=ar("".charCodeAt),Ff=ar([].join),Ft=ar([].push),kF=ar("".replace),SF=ar("".split),PF=ar("".toLowerCase),CF=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=Pf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=Pf(r,t++);(o&64512)==56320?Ft(e,((n&1023)<<10)+(o&1023)+65536):(Ft(e,n),t--)}else Ft(e,n)}return e},Cf=function(r){return r+22+75*(r<26)},wF=function(r,e,t){var i=0;for(r=t?Xr(r/gF):r>>1,r+=Xr(r/e);r>Tu*Ru>>1;)r=Xr(r/Tu),i+=Yn;return Xr(i+(Tu+1)*r/(r+pF))},IF=function(r){var e=[];r=CF(r);var t=r.length,i=fF,n=0,o=hF,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&Ft(e,Eu(c));var p=e.length,g=p;for(p&&Ft(e,vF);g<t;){var v=Au;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=g+1;if(v-i>Xr((Au-n)/m))throw Sf(kf);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Au)throw Sf(kf);if(c==i){for(var b=n,y=Yn;;){var C=y<=o?wf:y>=o+Ru?Ru:y-o;if(b<C)break;var w=b-C,A=Yn-C;Ft(e,Eu(Cf(C+w%A))),b=Xr(w/A),y+=Yn}Ft(e,Eu(Cf(b))),o=wF(n,m,g==p),n=0,g++}}n++,i++}return Ff(e,"")};xf.exports=function(r){var e=[],t=SF(kF(PF(r),If,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],Ft(e,bF(yF,n)?"xn--"+IF(n):n);return Ff(e,".")}});var Ou=f((tM,Tf)=>{var FF=TypeError;Tf.exports=function(r,e){if(r<e)throw FF("Not enough arguments");return r}});var Rf=f((rM,Ef)=>{var xF=Ie(),AF=Jn(),TF=et().f,Bu=xF("unscopables"),Mu=Array.prototype;Mu[Bu]==null&&TF(Mu,Bu,{configurable:!0,value:AF(null)});Ef.exports=function(r){Mu[Bu][r]=!0}});var Df=f((iM,Lf)=>{"use strict";var EF=Jr(),Uu=Rf(),Of=$r(),Mf=zr(),RF=et().f,OF=bu(),Xa=ku(),BF=Wr(),MF=ge(),Uf="Array Iterator",UF=Mf.set,LF=Mf.getterFor(Uf);Lf.exports=OF(Array,"Array",function(r,e){UF(this,{type:Uf,target:EF(r),index:0,kind:e})},function(){var r=LF(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Xa(void 0,!0)):t=="keys"?Xa(i,!1):t=="values"?Xa(e[i],!1):Xa([i,e[i]],!1)},"values");var Bf=Of.Arguments=Of.Array;Uu("keys");Uu("values");Uu("entries");if(!BF&&MF&&Bf.name!=="values")try{RF(Bf,"name",{value:"values"})}catch{}});var _f=f((nM,Nf)=>{var DF=or();Nf.exports=function(r,e,t){for(var i in e)DF(r,i,e[i],t);return r}});var jf=f((sM,Hf)=>{var qf=xu(),NF=Math.floor,Lu=function(r,e){var t=r.length,i=NF(t/2);return t<8?_F(r,e):qF(r,Lu(qf(r,0,i),e),Lu(qf(r,i),e),e)},_F=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},qF=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};Hf.exports=Lu});var zu=f((oM,dv)=>{"use strict";Df();var Hu=zn(),Yr=pe(),Za=Ge(),tt=Z(),HF=ge(),ev=Su(),tv=or(),jF=_f(),WF=$n(),GF=vu(),Gu=zr(),rv=Pu(),Du=Y(),VF=we(),zF=$a(),JF=Hn(),$F=Qe(),iv=It(),he=jn(),KF=Jn(),Wf=Vr(),ju=Fu(),XF=Ka(),Zr=Ou(),ZF=Ie(),YF=jf(),QF=ZF("iterator"),ts="URLSearchParams",nv=ts+"Iterator",sv=Gu.set,ze=Gu.getterFor(ts),ex=Gu.getterFor(nv),tx=Object.getOwnPropertyDescriptor,Vu=function(r){if(!HF)return Yr[r];var e=tx(Yr,r);return e&&e.value},Gf=Vu("fetch"),Qa=Vu("Request"),Qn=Vu("Headers"),Nu=Qa&&Qa.prototype,Vf=Qn&&Qn.prototype,rx=Yr.RegExp,ix=Yr.TypeError,ov=Yr.decodeURIComponent,nx=Yr.encodeURIComponent,sx=tt("".charAt),zf=tt([].join),dr=tt([].push),Wu=tt("".replace),ox=tt([].shift),Jf=tt([].splice),$f=tt("".split),ax=tt("".slice),dx=/\+/g,Kf=Array(4),lx=function(r){return Kf[r-1]||(Kf[r-1]=rx("((?:%[\\da-f]{2}){"+r+"})","gi"))},ux=function(r){try{return ov(r)}catch{return r}},Xf=function(r){var e=Wu(r,dx," "),t=4;try{return ov(e)}catch{for(;t;)e=Wu(e,lx(t--),ux);return e}},cx=/[!'()~]|%20/g,mx={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},px=function(r){return mx[r]},Zf=function(r){return Wu(nx(r),cx,px)},_u=GF(function(e,t){sv(this,{type:nv,iterator:ju(ze(e).entries),kind:t})},"Iterator",function(){var e=ex(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),av=function(r){this.entries=[],this.url=null,r!==void 0&&(iv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?sx(r,0)==="?"?ax(r,1):r:he(r)))};av.prototype={type:ts,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=XF(r),t,i,n,o,a,c,p;if(e)for(t=ju(r,e),i=t.next;!(n=Za(i,t)).done;){if(o=ju($F(n.value)),a=o.next,(c=Za(a,o)).done||(p=Za(a,o)).done||!Za(a,o).done)throw ix("Expected sequence with length 2");dr(this.entries,{key:he(c.value),value:he(p.value)})}else for(var g in r)VF(r,g)&&dr(this.entries,{key:g,value:he(r[g])})},parseQuery:function(r){if(r)for(var e=$f(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=$f(i,"="),dr(this.entries,{key:Xf(ox(n)),value:Xf(zf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],dr(e,Zf(i.key)+"="+Zf(i.value));return zf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ed=function(){rv(this,es);var e=arguments.length>0?arguments[0]:void 0;sv(this,new av(e))},es=ed.prototype;jF(es,{append:function(e,t){Zr(arguments.length,2);var i=ze(this);dr(i.entries,{key:he(e),value:he(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=ze(this),t=e.entries,i=he(r),n=0;n<t.length;)t[n].key===i?Jf(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=ze(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=ze(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=ze(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=ze(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?Jf(n,p--,1):(o=!0,g.value=c));o||dr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=ze(this);YF(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=ze(this).entries,i=zF(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 _u(this,"keys")},values:function(){return new _u(this,"values")},entries:function(){return new _u(this,"entries")}},{enumerable:!0});tv(es,QF,es.entries,{name:"entries"});tv(es,"toString",function(){return ze(this).serialize()},{enumerable:!0});WF(ed,ts);Hu({global:!0,constructor:!0,forced:!ev},{URLSearchParams:ed});!ev&&Du(Qn)&&(Yf=tt(Vf.has),Qf=tt(Vf.set),qu=function(r){if(iv(r)){var e=r.body,t;if(JF(e)===ts)return t=r.headers?new Qn(r.headers):new Qn,Yf(t,"content-type")||Qf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),KF(r,{body:Wf(0,he(e)),headers:Wf(0,t)})}return r},Du(Gf)&&Hu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Gf(e,arguments.length>1?qu(arguments[1]):{})}}),Du(Qa)&&(Ya=function(e){return rv(this,Nu),new Qa(e,arguments.length>1?qu(arguments[1]):{})},Nu.constructor=Ya,Ya.prototype=Nu,Hu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ya})));var Yf,Qf,qu,Ya;dv.exports={URLSearchParams:ed,getState:ze}});var xv=f(()=>{"use strict";Lh();var gx=zn(),dc=ge(),hx=Su(),lc=pe(),lv=$a(),Ee=Z(),sd=or(),Fe=Gh(),fx=Pu(),sc=we(),uc=Kh(),Qr=vf(),Je=xu(),vx=Il().codeAt,yx=Af(),mt=jn(),bx=$n(),kx=Ou(),Sv=zu(),Pv=zr(),Sx=Pv.set,od=Pv.getterFor("URL"),Px=Sv.URLSearchParams,Cx=Sv.getState,rs=lc.URL,oc=lc.TypeError,ad=lc.parseInt,wx=Math.floor,uv=Math.pow,Te=Ee("".charAt),$e=Ee(/./.exec),ns=Ee([].join),Ix=Ee(1 .toString),Fx=Ee([].pop),ti=Ee([].push),cv=Ee("".replace),xx=Ee([].shift),Ax=Ee("".split),os=Ee("".slice),dd=Ee("".toLowerCase),Tx=Ee([].unshift),Ex="Invalid authority",Ju="Invalid scheme",lr="Invalid host",mv="Invalid port",Cv=/[a-z]/i,Rx=/[\d+-.a-z]/i,ac=/\d/,Ox=/^0x/i,Bx=/^[0-7]+$/,Mx=/^\d+$/,wv=/^[\da-f]+$/i,Ux=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Lx=/[\0\t\n\r #/:<>?@[\\\]^|]/,Dx=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,Nx=/[\t\n\r]/g,xe,_x=function(r){var e=Ax(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&&Te(o,0)=="0"&&(a=$e(Ox,o)?16:8,o=os(o,a==8?1:2)),o==="")c=0;else{if(!$e(a==10?Mx:a==8?Bx:wv,o))return r;c=ad(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=uv(256,5-t))return null}else if(c>255)return null;for(p=Fx(i),n=0;n<i.length;n++)p+=i[n]*uv(256,3-n);return p},qx=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,v,m,b=function(){return Te(r,n)};if(b()==":"){if(Te(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&&$e(wv,b());)o=o*16+ad(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(!$e(ac,b()))return;for(;$e(ac,b());){if(g=ad(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(v=t-i,t=7;t!=0&&v>0;)m=e[t],e[t--]=e[i+v-1],e[i+--v]=m;else if(t!=8)return;return e},Hx=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},is=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)Tx(e,r%256),r=wx(r/256);return ns(e,".")}else if(typeof r=="object"){for(e="",i=Hx(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=Ix(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},nd={},Iv=uc({},nd,{" ":1,'"':1,"<":1,">":1,"`":1}),Fv=uc({},Iv,{"#":1,"?":1,"{":1,"}":1}),$u=uc({},Fv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=vx(r,0);return t>32&&t<127&&!sc(e,r)?r:encodeURIComponent(r)},td={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ss=function(r,e){var t;return r.length==2&&$e(Cv,Te(r,0))&&((t=Te(r,1))==":"||!e&&t=="|")},pv=function(r){var e;return r.length>1&&ss(os(r,0,2))&&(r.length==2||(e=Te(r,2))==="/"||e==="\\"||e==="?"||e==="#")},jx=function(r){return r==="."||dd(r)==="%2e"},Wx=function(r){return r=dd(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Ku={},gv={},Xu={},hv={},fv={},Zu={},vv={},yv={},rd={},id={},Yu={},Qu={},ec={},tc={},bv={},rc={},ei={},rt={},kv={},ur={},ct={},cc=function(r,e,t){var i=mt(r),n,o,a;if(e){if(o=this.parse(i),o)throw oc(o);this.searchParams=null}else{if(t!==void 0&&(n=new cc(t,!0)),o=this.parse(i,null,n),o)throw oc(o);a=Cx(new Px),a.bindURL(this),this.searchParams=a}};cc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Ku,o=0,a="",c=!1,p=!1,g=!1,v,m,b,y;for(r=mt(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=cv(r,Dx,"")),r=cv(r,Nx,""),v=Qr(r);o<=v.length;){switch(m=v[o],n){case Ku:if(m&&$e(Cv,m))a+=dd(m),n=gv;else{if(e)return Ju;n=Xu;continue}break;case gv:if(m&&($e(Rx,m)||m=="+"||m=="-"||m=="."))a+=dd(m);else if(m==":"){if(e&&(i.isSpecial()!=sc(td,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&td[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=tc:i.isSpecial()&&t&&t.scheme==i.scheme?n=hv:i.isSpecial()?n=yv:v[o+1]=="/"?(n=fv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=kv)}else{if(e)return Ju;a="",n=Xu,o=0;continue}break;case Xu:if(!t||t.cannotBeABaseURL&&m!="#")return Ju;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Je(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ct;break}n=t.scheme=="file"?tc:Zu;continue;case hv:if(m=="/"&&v[o+1]=="/")n=rd,o++;else{n=Zu;continue}break;case fv:if(m=="/"){n=id;break}else{n=rt;continue}case Zu: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=Je(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=vv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(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=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.path.length--,n=rt;continue}break;case vv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=rd;else if(m=="/")n=id;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=rt;continue}break;case yv:if(n=rd,m!="/"||Te(a,o+1)!="/")continue;o++;break;case rd:if(m!="/"&&m!="\\"){n=id;continue}break;case id:if(m=="@"){c&&(a="%40"+a),c=!0,b=Qr(a);for(var C=0;C<b.length;C++){var w=b[C];if(w==":"&&!g){g=!0;continue}var A=xt(w,$u);g?i.password+=A:i.username+=A}a=""}else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return Ex;o-=Qr(a).length+1,a="",n=Yu}else a+=m;break;case Yu:case Qu:if(e&&i.scheme=="file"){n=rc;continue}else if(m==":"&&!p){if(a=="")return lr;if(y=i.parseHost(a),y)return y;if(a="",n=ec,e==Qu)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 ec:if($e(ac,m))a+=m;else if(m==xe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var B=ad(a,10);if(B>65535)return mv;i.port=i.isSpecial()&&B===td[i.scheme]?null:B,a=""}if(e)return;n=ei;continue}else return mv;break;case tc:if(i.scheme="file",m=="/"||m=="\\")n=bv;else if(t&&t.scheme=="file")if(m==xe)i.host=t.host,i.path=Je(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Je(t.path),i.query="",n=ur;else if(m=="#")i.host=t.host,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ct;else{pv(ns(Je(v,o),""))||(i.host=t.host,i.path=Je(t.path),i.shortenPath()),n=rt;continue}else{n=rt;continue}break;case bv:if(m=="/"||m=="\\"){n=rc;break}t&&t.scheme=="file"&&!pv(ns(Je(v,o),""))&&(ss(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=rt;continue;case rc:if(m==xe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&ss(a))n=rt;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=rt,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=ur;else if(!e&&m=="#")i.fragment="",n=ct;else if(m!=xe&&(n=rt,m!="/"))continue;break;case rt:if(m==xe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(Wx(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):jx(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&ss(a)&&(i.host&&(i.host=""),a=Te(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==xe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)xx(i.path);m=="?"?(i.query="",n=ur):m=="#"&&(i.fragment="",n=ct)}else a+=xt(m,Fv);break;case kv:m=="?"?(i.query="",n=ur):m=="#"?(i.fragment="",n=ct):m!=xe&&(i.path[0]+=xt(m,nd));break;case ur:!e&&m=="#"?(i.fragment="",n=ct):m!=xe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,nd));break;case ct:m!=xe&&(i.fragment+=xt(m,Iv));break}o++}},parseHost:function(r){var e,t,i;if(Te(r,0)=="["){if(Te(r,r.length-1)!="]"||(e=qx(os(r,1,-1)),!e))return lr;this.host=e}else if(this.isSpecial()){if(r=yx(r),$e(Ux,r)||(e=_x(r),e===null))return lr;this.host=e}else{if($e(Lx,r))return lr;for(e="",t=Qr(r),i=0;i<t.length;i++)e+=xt(t[i],nd);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return sc(td,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!ss(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+=is(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ns(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw oc(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+"://"+is(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(mt(r)+":",Ku)},getUsername:function(){return this.username},setUsername:function(r){var e=Qr(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],$u)}},getPassword:function(){return this.password},setPassword:function(r){var e=Qr(mt(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],$u)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?is(r):is(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Yu)},getHostname:function(){var r=this.host;return r===null?"":is(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Qu)},getPort:function(){var r=this.port;return r===null?"":mt(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=mt(r),r==""?this.port=null:this.parse(r,ec))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ns(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=mt(r),r==""?this.query=null:(Te(r,0)=="?"&&(r=os(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=mt(r),r==""){this.fragment=null;return}Te(r,0)=="#"&&(r=os(r,1)),this.fragment="",this.parse(r,ct)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=fx(this,re),i=kx(arguments.length,1)>1?arguments[1]:void 0,n=Sx(t,new cc(e,!1,i));dc||(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,Ae=function(r,e){return{get:function(){return od(this)[r]()},set:e&&function(t){return od(this)[e](t)},configurable:!0,enumerable:!0}};dc&&(Fe(re,"href",Ae("serialize","setHref")),Fe(re,"origin",Ae("getOrigin")),Fe(re,"protocol",Ae("getProtocol","setProtocol")),Fe(re,"username",Ae("getUsername","setUsername")),Fe(re,"password",Ae("getPassword","setPassword")),Fe(re,"host",Ae("getHost","setHost")),Fe(re,"hostname",Ae("getHostname","setHostname")),Fe(re,"port",Ae("getPort","setPort")),Fe(re,"pathname",Ae("getPathname","setPathname")),Fe(re,"search",Ae("getSearch","setSearch")),Fe(re,"searchParams",Ae("getSearchParams")),Fe(re,"hash",Ae("getHash","setHash")));sd(re,"toJSON",function(){return od(this).serialize()},{enumerable:!0});sd(re,"toString",function(){return od(this).serialize()},{enumerable:!0});rs&&(ic=rs.createObjectURL,nc=rs.revokeObjectURL,ic&&sd(ri,"createObjectURL",lv(ic,rs)),nc&&sd(ri,"revokeObjectURL",lv(nc,rs)));var ic,nc;bx(ri,"URL");gx({global:!0,constructor:!0,forced:!hx,sham:!dc},{URL:ri})});var Av=f(()=>{xv()});var Tv=f(()=>{"use strict";var Gx=zn(),Vx=Ge();Gx({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Vx(URL.prototype.toString,this)}})});var Ev=f(()=>{zu()});var Ov=f((hM,Rv)=>{var zx=pe();Rv.exports=zx});var Mv=f((fM,Bv)=>{Av();Tv();Ev();var Jx=Ov();Bv.exports=Jx.URL});var _c=f((qD,Wy)=>{var aT=Object.prototype.toString;Wy.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 mT(e)?"generatorfunction":"function";if(dT(e))return"array";if(hT(e))return"buffer";if(gT(e))return"arguments";if(uT(e))return"date";if(lT(e))return"error";if(cT(e))return"regexp";switch(jy(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(pT(e))return"generator";switch(t=aT.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 jy(r){return typeof r.constructor=="function"?r.constructor.name:null}function dT(r){return Array.isArray?Array.isArray(r):r instanceof Array}function lT(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function uT(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function cT(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function mT(r,e){return jy(r)==="GeneratorFunction"}function pT(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function gT(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 hT(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var zy=f((HD,Vy)=>{"use strict";var Gy=Symbol.prototype.valueOf,fT=_c();function vT(r,e){switch(fT(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 ST(r);case"symbol":return PT(r);case"arraybuffer":return bT(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return kT(r);case"regexp":return yT(r);case"error":return Object.create(r);default:return r}}function yT(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 bT(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function kT(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function ST(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function PT(r){return Gy?Object(Gy.call(r)):{}}Vy.exports=vT});var $y=f((jD,Jy)=>{"use strict";Jy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Zy=f((WD,Xy)=>{"use strict";var CT=$y();function Ky(r){return CT(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Xy.exports=function(e){var t,i;return!(Ky(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ky(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Qy=f((GD,Yy)=>{"use strict";var wT=zy(),IT=_c(),FT=Zy();function qc(r,e){switch(IT(r)){case"object":return xT(r,e);case"array":return AT(r,e);default:return wT(r)}}function xT(r,e){if(typeof e=="function")return e(r);if(e||FT(r)){let t=new r.constructor;for(let i in r)t[i]=qc(r[i],e);return t}return r}function AT(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=qc(r[i],e);return t}Yy.exports=qc});var Yc=f((ys,Ai)=>{var TT=200,Zc="__lodash_hash_undefined__",Od=1,cb=2,mb=9007199254740991,Id="[object Arguments]",Gc="[object Array]",ET="[object AsyncFunction]",pb="[object Boolean]",gb="[object Date]",hb="[object Error]",fb="[object Function]",RT="[object GeneratorFunction]",Fd="[object Map]",vb="[object Number]",OT="[object Null]",xi="[object Object]",eb="[object Promise]",BT="[object Proxy]",yb="[object RegExp]",xd="[object Set]",bb="[object String]",MT="[object Symbol]",UT="[object Undefined]",Vc="[object WeakMap]",kb="[object ArrayBuffer]",Ad="[object DataView]",LT="[object Float32Array]",DT="[object Float64Array]",NT="[object Int8Array]",_T="[object Int16Array]",qT="[object Int32Array]",HT="[object Uint8Array]",jT="[object Uint8ClampedArray]",WT="[object Uint16Array]",GT="[object Uint32Array]",VT=/[\\^$.*+?()[\]{}|]/g,zT=/^\[object .+?Constructor\]$/,JT=/^(?:0|[1-9]\d*)$/,j={};j[LT]=j[DT]=j[NT]=j[_T]=j[qT]=j[HT]=j[jT]=j[WT]=j[GT]=!0;j[Id]=j[Gc]=j[kb]=j[pb]=j[Ad]=j[gb]=j[hb]=j[fb]=j[Fd]=j[vb]=j[xi]=j[yb]=j[xd]=j[bb]=j[Vc]=!1;var Sb=typeof global=="object"&&global&&global.Object===Object&&global,$T=typeof self=="object"&&self&&self.Object===Object&&self,ft=Sb||$T||Function("return this")(),Pb=typeof ys=="object"&&ys&&!ys.nodeType&&ys,tb=Pb&&typeof Ai=="object"&&Ai&&!Ai.nodeType&&Ai,Cb=tb&&tb.exports===Pb,Hc=Cb&&Sb.process,rb=function(){try{return Hc&&Hc.binding&&Hc.binding("util")}catch{}}(),ib=rb&&rb.isTypedArray;function KT(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 XT(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function ZT(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 YT(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function QT(r){return function(e){return r(e)}}function eE(r,e){return r.has(e)}function tE(r,e){return r?.[e]}function rE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function iE(r,e){return function(t){return r(e(t))}}function nE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var sE=Array.prototype,oE=Function.prototype,Bd=Object.prototype,jc=ft["__core-js_shared__"],wb=oE.toString,it=Bd.hasOwnProperty,nb=function(){var r=/[^.]+$/.exec(jc&&jc.keys&&jc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Ib=Bd.toString,aE=RegExp("^"+wb.call(it).replace(VT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sb=Cb?ft.Buffer:void 0,Td=ft.Symbol,ob=ft.Uint8Array,Fb=Bd.propertyIsEnumerable,dE=sE.splice,br=Td?Td.toStringTag:void 0,ab=Object.getOwnPropertySymbols,lE=sb?sb.isBuffer:void 0,uE=iE(Object.keys,Object),zc=Ti(ft,"DataView"),bs=Ti(ft,"Map"),Jc=Ti(ft,"Promise"),$c=Ti(ft,"Set"),Kc=Ti(ft,"WeakMap"),ks=Ti(Object,"create"),cE=Pr(zc),mE=Pr(bs),pE=Pr(Jc),gE=Pr($c),hE=Pr(Kc),db=Td?Td.prototype:void 0,Wc=db?db.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 fE(){this.__data__=ks?ks(null):{},this.size=0}function vE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function yE(r){var e=this.__data__;if(ks){var t=e[r];return t===Zc?void 0:t}return it.call(e,r)?e[r]:void 0}function bE(r){var e=this.__data__;return ks?e[r]!==void 0:it.call(e,r)}function kE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=ks&&e===void 0?Zc:e,this}kr.prototype.clear=fE;kr.prototype.delete=vE;kr.prototype.get=yE;kr.prototype.has=bE;kr.prototype.set=kE;function vt(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 SE(){this.__data__=[],this.size=0}function PE(r){var e=this.__data__,t=Md(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():dE.call(e,t,1),--this.size,!0}function CE(r){var e=this.__data__,t=Md(e,r);return t<0?void 0:e[t][1]}function wE(r){return Md(this.__data__,r)>-1}function IE(r,e){var t=this.__data__,i=Md(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}vt.prototype.clear=SE;vt.prototype.delete=PE;vt.prototype.get=CE;vt.prototype.has=wE;vt.prototype.set=IE;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 FE(){this.size=0,this.__data__={hash:new kr,map:new(bs||vt),string:new kr}}function xE(r){var e=Ud(this,r).delete(r);return this.size-=e?1:0,e}function AE(r){return Ud(this,r).get(r)}function TE(r){return Ud(this,r).has(r)}function EE(r,e){var t=Ud(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Sr.prototype.clear=FE;Sr.prototype.delete=xE;Sr.prototype.get=AE;Sr.prototype.has=TE;Sr.prototype.set=EE;function Ed(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Sr;++e<t;)this.add(r[e])}function RE(r){return this.__data__.set(r,Zc),this}function OE(r){return this.__data__.has(r)}Ed.prototype.add=Ed.prototype.push=RE;Ed.prototype.has=OE;function Dt(r){var e=this.__data__=new vt(r);this.size=e.size}function BE(){this.__data__=new vt,this.size=0}function ME(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function UE(r){return this.__data__.get(r)}function LE(r){return this.__data__.has(r)}function DE(r,e){var t=this.__data__;if(t instanceof vt){var i=t.__data__;if(!bs||i.length<TT-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}Dt.prototype.clear=BE;Dt.prototype.delete=ME;Dt.prototype.get=UE;Dt.prototype.has=LE;Dt.prototype.set=DE;function NE(r,e){var t=Rd(r),i=!t&&QE(r),n=!t&&!i&&Xc(r),o=!t&&!i&&!n&&Bb(r),a=t||i||n||o,c=a?YT(r.length,String):[],p=c.length;for(var g in r)(e||it.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 Md(r,e){for(var t=r.length;t--;)if(Tb(r[t][0],e))return t;return-1}function _E(r,e,t){var i=e(r);return Rd(r)?i:XT(i,t(r))}function Ps(r){return r==null?r===void 0?UT:OT:br&&br in Object(r)?zE(r):YE(r)}function lb(r){return Ss(r)&&Ps(r)==Id}function xb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Ss(r)&&!Ss(e)?r!==r&&e!==e:qE(r,e,t,i,xb,n)}function qE(r,e,t,i,n,o){var a=Rd(r),c=Rd(e),p=a?Gc:Lt(r),g=c?Gc:Lt(e);p=p==Id?xi:p,g=g==Id?xi:g;var v=p==xi,m=g==xi,b=p==g;if(b&&Xc(r)){if(!Xc(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Dt),a||Bb(r)?Ab(r,e,t,i,n,o):GE(r,e,p,t,i,n,o);if(!(t&Od)){var y=v&&it.call(r,"__wrapped__"),C=m&&it.call(e,"__wrapped__");if(y||C){var w=y?r.value():r,A=C?e.value():e;return o||(o=new Dt),n(w,A,t,i,o)}}return b?(o||(o=new Dt),VE(r,e,t,i,n,o)):!1}function HE(r){if(!Ob(r)||XE(r))return!1;var e=Eb(r)?aE:zT;return e.test(Pr(r))}function jE(r){return Ss(r)&&Rb(r.length)&&!!j[Ps(r)]}function WE(r){if(!ZE(r))return uE(r);var e=[];for(var t in Object(r))it.call(r,t)&&t!="constructor"&&e.push(t);return e}function Ab(r,e,t,i,n,o){var a=t&Od,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 v=-1,m=!0,b=t&cb?new Ed:void 0;for(o.set(r,e),o.set(e,r);++v<c;){var y=r[v],C=e[v];if(i)var w=a?i(C,y,v,e,r,o):i(y,C,v,r,e,o);if(w!==void 0){if(w)continue;m=!1;break}if(b){if(!ZT(e,function(A,B){if(!eE(b,B)&&(y===A||n(y,A,t,i,o)))return b.push(B)})){m=!1;break}}else if(!(y===C||n(y,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function GE(r,e,t,i,n,o,a){switch(t){case Ad:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case kb:return!(r.byteLength!=e.byteLength||!o(new ob(r),new ob(e)));case pb:case gb:case vb:return Tb(+r,+e);case hb:return r.name==e.name&&r.message==e.message;case yb:case bb:return r==e+"";case Fd:var c=rE;case xd:var p=i&Od;if(c||(c=nE),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=cb,a.set(r,e);var v=Ab(c(r),c(e),i,n,o,a);return a.delete(r),v;case MT:if(Wc)return Wc.call(r)==Wc.call(e)}return!1}function VE(r,e,t,i,n,o){var a=t&Od,c=ub(r),p=c.length,g=ub(e),v=g.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:it.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var C=!0;o.set(r,e),o.set(e,r);for(var w=a;++m<p;){b=c[m];var A=r[b],B=e[b];if(i)var me=a?i(B,A,b,e,r,o):i(A,B,b,r,e,o);if(!(me===void 0?A===B||n(A,B,t,i,o):me)){C=!1;break}w||(w=b=="constructor")}if(C&&!w){var Nn=r.constructor,ba=e.constructor;Nn!=ba&&"constructor"in r&&"constructor"in e&&!(typeof Nn=="function"&&Nn instanceof Nn&&typeof ba=="function"&&ba instanceof ba)&&(C=!1)}return o.delete(r),o.delete(e),C}function ub(r){return _E(r,rR,JE)}function Ud(r,e){var t=r.__data__;return KE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ti(r,e){var t=tE(r,e);return HE(t)?t:void 0}function zE(r){var e=it.call(r,br),t=r[br];try{r[br]=void 0;var i=!0}catch{}var n=Ib.call(r);return i&&(e?r[br]=t:delete r[br]),n}var JE=ab?function(r){return r==null?[]:(r=Object(r),KT(ab(r),function(e){return Fb.call(r,e)}))}:iR,Lt=Ps;(zc&&Lt(new zc(new ArrayBuffer(1)))!=Ad||bs&&Lt(new bs)!=Fd||Jc&&Lt(Jc.resolve())!=eb||$c&&Lt(new $c)!=xd||Kc&&Lt(new Kc)!=Vc)&&(Lt=function(r){var e=Ps(r),t=e==xi?r.constructor:void 0,i=t?Pr(t):"";if(i)switch(i){case cE:return Ad;case mE:return Fd;case pE:return eb;case gE:return xd;case hE:return Vc}return e});function $E(r,e){return e=e??mb,!!e&&(typeof r=="number"||JT.test(r))&&r>-1&&r%1==0&&r<e}function KE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function XE(r){return!!nb&&nb in r}function ZE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Bd;return r===t}function YE(r){return Ib.call(r)}function Pr(r){if(r!=null){try{return wb.call(r)}catch{}try{return r+""}catch{}}return""}function Tb(r,e){return r===e||r!==r&&e!==e}var QE=lb(function(){return arguments}())?lb:function(r){return Ss(r)&&it.call(r,"callee")&&!Fb.call(r,"callee")},Rd=Array.isArray;function eR(r){return r!=null&&Rb(r.length)&&!Eb(r)}var Xc=lE||nR;function tR(r,e){return xb(r,e)}function Eb(r){if(!Ob(r))return!1;var e=Ps(r);return e==fb||e==RT||e==ET||e==BT}function Rb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=mb}function Ob(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Ss(r){return r!=null&&typeof r=="object"}var Bb=ib?QT(ib):jE;function rR(r){return eR(r)?NE(r):WE(r)}function iR(){return[]}function nR(){return!1}Ai.exports=tR});var kS=f(Kd=>{"use strict";Kd.byteLength=BR;Kd.toByteArray=UR;Kd.fromByteArray=NR;var ot=[],qe=[],OR=typeof Uint8Array<"u"?Uint8Array:Array,Rm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Lr=0,yS=Rm.length;Lr<yS;++Lr)ot[Lr]=Rm[Lr],qe[Rm.charCodeAt(Lr)]=Lr;var Lr,yS;qe[45]=62;qe[95]=63;function bS(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 BR(r){var e=bS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function MR(r,e,t){return(e+t)*3/4-t}function UR(r){var e,t=bS(r),i=t[0],n=t[1],o=new OR(MR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=qe[r.charCodeAt(p)]<<18|qe[r.charCodeAt(p+1)]<<12|qe[r.charCodeAt(p+2)]<<6|qe[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=qe[r.charCodeAt(p)]<<2|qe[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=qe[r.charCodeAt(p)]<<10|qe[r.charCodeAt(p+1)]<<4|qe[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function LR(r){return ot[r>>18&63]+ot[r>>12&63]+ot[r>>6&63]+ot[r&63]}function DR(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(LR(i));return n.join("")}function NR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(DR(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(ot[e>>2]+ot[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ot[e>>10]+ot[e>>4&63]+ot[e<<2&63]+"=")),n.join("")}});var aH=_n(Mv(),1);function h(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 At(r){return r.startsWith(ie.COMMENT)}function ld(r){return r.startsWith(ie.ACCOUNT)}function mr(r){return r.startsWith(ie.LINK)}function Uv(r){return r.startsWith(ie.MESSAGE)}function Lv(r){return r.startsWith(ie.SUBREDDIT)}function Dv(r){return r.startsWith(ie.AWARD)}function $x(r){cr(At(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function Kx(r){cr(ld(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function Xx(r){cr(mr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function Zx(r){cr(Uv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function Yx(r){cr(Lv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function Qx(r){cr(Dv(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ii(r){return $x(r),r}function ne(r){return Kx(r),r}function fe(r){return Xx(r),r}function eA(r){return Zx(r),r}function Re(r){return Yx(r),r}function tA(r){return Qx(r),r}function ve(r){if(At(r))return ii(r);if(ld(r))return ne(r);if(mr(r))return fe(r);if(Uv(r))return eA(r);if(Lv(r))return Re(r);if(Dv(r))return tA(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function mc(r){return At(r)}import*as P from"@devvit/protos";var ud=class{constructor(e){}};var pc=(t=>(t.Installation="installation",t.App="app",t))(pc||{});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)}rA(r)}function rA(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 Tt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var FM=["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","planet","telescope","caret-updown"];import{AppSettingsDefinition as yA,GetFieldsResponse as bA}from"@devvit/protos";import{FormField as gr,FormFieldType as Oe}from"@devvit/protos";function pt(r){return r.map(e=>{switch(e.type){case"string":return iA(e);case"image":return nA(e);case"paragraph":return sA(e);case"number":return oA(e);case"select":return aA(e);case"boolean":return dA(e);case"group":return lA(e);default:throw new Error("Unknown field type.")}})}function iA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function nA(r){return gr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function sA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function oA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Oe.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function aA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Oe.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function dA(r){return gr.fromPartial({defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label})}function lA(r){return gr.fromPartial({fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:pt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as vA}from"@devvit/protos";import{RealtimeSubscriptionStatus as _v}from"@devvit/protos";var D=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",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"}),Nv;(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"})(Nv||(Nv={}));function qv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];h(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];h(p,"useChannel - installation is missing from Context");async function g(A){let B=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(B,A);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 v(){if(!o[n].active){let A=o[n].channel;o[n].active=!0,r.addRealtimeChannel(A)}}function m(){if(o[n].active){let A=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(A)}}function b(A){return async()=>{let B;switch(A.status){case _v.REALTIME_SUBSCRIBED:o[n].connected=!0,B=t.onSubscribed?.();break;case _v.REALTIME_UNSUBSCRIBED:o[n].connected=!1,B=t.onUnsubscribed?.();break;default:B=t.onMessage(A.event?.data??{});break}await B}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Tt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let C=r.realtimeEvent;r.isInitialRender?y.active=!1:C&&y.active&&C.event.channel===y.channel&&(y.preventCallback||r.runHook(b(C)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let w=0;return y.active&&y.connected?w=2:y.active&&!y.connected?w=1:!y.active&&y.connected?w=3:!y.active&&!y.connected&&(w=4),{subscribe:v,unsubscribe:m,send:g,status:w}}return e}import{FormFieldType as ni}from"@devvit/protos";function gc(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 Et(r){return Object.keys(r).reduce((e,t)=>{let i=gc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Hv(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:Tt.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!g.preventSubmit&&v.formId===p&&r.runHook(async()=>{let m=i(Et(v.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function jv(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:Tt.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function v(){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===Tt.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:Tt.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:v,stop:m}}return e}function Wv(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 yc={now(){return new Date}};function Gv(r){return`__autocache__${r}`}function Vv(r){return`__lock__${r}`}var cA=300,mA=1e3,cd=5e3,hc=3,zv=.1,Jv=1e3,pA=3e4;function $v(r){if(r.error)throw new Error(r.error);return r.value}var Rt,Ot,Be,si,$,Kv,Xv,Zv,fc,Yv,Qv,vc,ey,md=class{constructor(e,t,i=yc){l(this,$);l(this,Rt);l(this,Ot,{});l(this,Be);l(this,si);d(this,Rt,e),d(this,si,t),d(this,Be,i)}async cache(e,t){d(this,Ot,s(this,si).__cache=s(this,si).__cache??{}),S(this,$,ey).call(this,t);let i=S(this,$,Kv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,vc).call(this,t.key),o=await S(this,$,Xv).call(this,t,n,e);return $v(o)}};Rt=new WeakMap,Ot=new WeakMap,Be=new WeakMap,si=new WeakMap,$=new WeakSet,Kv=function(e){let t=s(this,Ot)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<hc&&Math.random()<zv&&t.errorTime+Jv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Jv<i||n){delete s(this,Ot)[e];return}else return $v(t)}},Xv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Qv).call(this,n):1;return!t||t?.error&&t.errorCount<hc&&zv>Math.random()||o>Math.random()?S(this,$,Zv).call(this,e,t,i):t},Zv=async function(e,t,i){let n=Vv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Rt).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Yv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,fc).call(this,p,e.key,e.ttl)}},fc=async function(e,t,i){let n=Math.min(i,mA),o=await S(this,$,vc).call(this,t);if(o)return o;if(s(this,Be).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,cA)),S(this,$,fc).call(this,e,t,i)},Yv=async function(e,t,i,n){let o=s(this,Be).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,Be).now().getTime(),t.errorCount++}return s(this,Ot)[e]=t,await s(this,Rt).set(Gv(e),JSON.stringify(t),{expiration:new Date(o+pA)}),t.error&&t.errorCount<hc&&await s(this,Rt).del(Vv(e)),t},Qv=function(e){let t=s(this,Be).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},vc=async function(e){let t=await s(this,Rt).get(Gv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Ot)[e]=i,i}},ey=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 ty(r,e,t=yc){let i=new md(r,e,t);return i.cache.bind(i)}function ry(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,iy,ny,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,iy).call(this,e,t??{webview:!1}):S(this,li,ny).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,iy=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return ry(e),encodeURI(e)}catch{return""}},ny=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{ry(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 Bt,ui=class{constructor(e){l(this,Bt);d(this,Bt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Bt));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,Bt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Bt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Bt));return e}};Bt=new WeakMap;var as,ci=class{constructor(e){l(this,as);d(this,as,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,as));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};as=new WeakMap;var ds,mi=class{constructor(e){l(this,ds);d(this,ds,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ds))}};ds=new WeakMap;var ls,pi=class{constructor(e){l(this,ls);d(this,ls,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,ls))}};ls=new WeakMap;var k,us,hi=class{constructor(e){l(this,k);l(this,us);d(this,k,e),d(this,us,new gd(e))}get modMail(){return s(this,us)}getSubredditById(e){return ye.getById(ve(e),s(this,k))}getSubredditByName(e){return ye.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return ye.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ye.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ye.getFromMetadata(s(this,k))}getPostById(e){return z.getById(ve(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 I.getById(ve(e),s(this,k))}getCollectionById(e){return gi.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return gi.create(e,s(this,k))}getCollectionsForSubreddit(e){return gi.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return I.getByUsername(e,s(this,k))}getCurrentUser(){return I.getFromMetadata(D.User,s(this,k))}getAppUser(){return I.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return I.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return Q.getById(ve(e),s(this,k))}getComments(e){return Q.getComments(e,s(this,k))}getCommentsByUser(e){return Q.getCommentsByUser(e,s(this,k))}submitComment(e){return Q.submit({...e,id:ve(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 I.getOverview(e,s(this,k))}getModerationLog(e){return pd(e,s(this,k))}getApprovedUsers(e){return I.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return I.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return I.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return I.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return I.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return I.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return I.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return I.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 I.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return I.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return I.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return I.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return I.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return I.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return I.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return I.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return I.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return I.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return I.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return I.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?ve(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.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(At(e))return Q.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(At(e))return Q.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 Ue.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Ue.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 be.getPage(e,t,s(this,k))}async getWikiPages(e){return be.getPages(e,s(this,k))}async createWikiPage(e){return be.createPage(e,s(this,k))}async updateWikiPage(e){return be.updatePage(e,s(this,k))}getWikiPageRevisions(e){return be.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return be.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return be.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return be.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return be.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return be.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 ye.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ye.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ye.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ye.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ye.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return ay(e,s(this,k))}getVaultByUserId(e){return dy(ve(e),s(this,k))}getSubredditLeaderboard(e){return oy(e,s(this,k))}};k=new WeakMap,us=new WeakMap;import{RedisKeyScope as bc}from"@devvit/protos";function hd(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,kc=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,fi,Sc=class Sc{constructor(e,t=void 0,i=bc.INSTALLATION){l(this,M);l(this,fi);d(this,M,e),d(this,fi,t),this.scope=i,this.global=i===bc.INSTALLATION?new Sc(s(this,M),s(this,fi),bc.GLOBAL):this}get storage(){return s(this,fi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,M));return new kc(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(hd(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(hd(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(hd(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(hd(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,fi=new WeakMap;var vi=Sc;var fr,yi=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=>(h(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 cs,bi=class{constructor(e){l(this,cs);d(this,cs,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,cs));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...ly(t.installationSettings.settings,u.installationSettings),...ly(t.appSettings.settings,u.appSettings)}}};cs=new WeakMap;function ly(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=gc(r[n]),i),{});return e&&uy(t,e),t}function uy(r,e){for(let t of e)t.type==="group"?uy(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Pc,Form as gA,ToastAppearance as cy}from"@devvit/protos";var vr,ki,fd=class{constructor(e){l(this,vr,[]);l(this,ki);d(this,ki,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,ki)){let a=s(this,ki).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=gA.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});pr(n.fields),o.fields=pt(n.fields),s(this,vr).push({type:Pc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?cy.SUCCESS:cy.NEUTRAL}:t={text:e},s(this,vr).push({type:Pc.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:Pc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,vr)}};vr=new WeakMap,ki=new WeakMap;function Le({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new vi(r),c=ty(a,i?i.state:{}),p=new hi(r),g=new yi(r),v=new bi(r),m=e?new fd(i):void 0,b=new ci(r),y=new di,C=new pi(r),w=t&&i?Wv(i):void 0,A=t&&i?jv(i):void 0,B=t&&i?Hv(i):void 0,me=t&&i?qv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:v,media:b,assets:y,realtime:C,get useForm(){return B??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return w??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return A??(()=>{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 my={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/eslint-config":"0.11.0-dev","@devvit/repo-tools":"0.11.0-dev","@devvit/tsconfig":"0.11.0-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"16.1.0","@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:"8.9.0",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"255 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[D.Subreddit]?.values[0];h(i,"subreddit is missing from Context");let n=r[D.AppUser]?.values[0],o=r[D.User]?.values[0],a=fA(r);return{get appAccountId(){return h(n,"appAccountId is missing from Context"),n},subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}function fA(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[D.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[D.Debug]&&console.info(`[api] @devvit/public-api v${my.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function py(r){return r.flatMap(e=>e.type==="group"?py(e.fields):e)}async function vd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Et(r.fieldValues),o=py(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,v=Object.assign(Le({metadata:t}),le(t)),m=await g({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),vA.fromJSON(i)}async function kA(){if(!u.appSettings)throw new Error("App settings were not defined.");return bA.fromJSON({fields:{fields:pt(u.appSettings)}})}async function SA(r,e){return vd(r,u.appSettings,e)}function gy(r){r.provides(yA),U("GetAppSettingsFields",kA),U("ValidateAppForm",SA)}import{CustomPostDefinition as AA,RenderPostResponse as TA}from"@devvit/protos";import{BlockRenderEventType as Lc,EffectType as Oy}from"@devvit/protos";function Si(r){return r.__effects}function hy(){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 Uc,BlockAnimationDirection as Iy,BlockAnimationLoopMode as Fy,BlockAnimationType as xy,BlockAvatarBackground as Ay,BlockAvatarFacing as Ty,BlockAvatarSize as Mt,BlockBorderWidth as Sd,BlockButtonAppearance as Ut,BlockButtonSize as xc,BlockFullSnooSize as Ci,BlockGap as Pd,BlockHorizontalAlignment as Ac,BlockIconSize as Cd,BlockImageResizeMode as ms,BlockPadding as ps,BlockRadius as gs,BlockSpacerShape as Tc,BlockSpacerSize as wd,BlockStackDirection as Ec,BlockTextOutline as Rc,BlockTextOverflow as Oc,BlockTextSize as wi,BlockTextStyle as Bc,BlockTextWeight as Ey,BlockType as De,BlockVerticalAlignment as Mc}from"@devvit/protos";var Cc={"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 fy={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"},vy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),yy=r=>r in Cc,wc=r=>r in fy,by=r=>!!r.match(/^rgba?\(.*/),ky=r=>!!r.match(/^hsla?\(.*/),Sy=(r,e="light")=>{if(wc(r))return yd(r);let i=Cc[r];return typeof i=="string"?i:i[e]},yd=r=>fy[r]??r,Py=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 bd}from"@devvit/protos";var Ic={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:bd.UNRECOGNIZED,alignment:void 0}};function wy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=PA(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||Cy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||Cy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function Cy(r,e,t,i){return e===r&&i||t===r&&i}function PA(r,e,t){let i=e===bd.STACK_VERTICAL||e===bd.UNRECOGNIZED,n=e===bd.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 kd}from"@devvit/protos";function Pi(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 CA(r,e){return(r.width?.value?.unit===yr.SIZE_UNIT_PERCENT||r.width?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===kd.STACK_HORIZONTAL||e.direction===kd.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===kd.STACK_VERTICAL||e.direction===kd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Fc(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:Pi(r.width),min:Pi(r.minWidth),max:Pi(r.maxWidth)}:void 0,height:i?{value:Pi(r.height),min:Pi(r.minHeight),max:Pi(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=CA(n,e.stackParentLayout)),n}}}var Ry="data-",wA=new Set(["onPress","onMessage"]),IA=new Map([["onPress",Uc.ACTION_CLICK],["onMessage",Uc.ACTION_WEBVIEW]]),hs,Ii=class{constructor(e=()=>{}){l(this,hs);d(this,hs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},Ic);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"fullsnoo":return this.makeFullSnoo(t,n);case"animation":return this.makeAnimation(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 ps.PADDING_NONE;case"xsmall":return ps.PADDING_XSMALL;case"small":return ps.PADDING_SMALL;case"medium":return ps.PADDING_MEDIUM;case"large":return ps.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return gs.RADIUS_NONE;case"small":return gs.RADIUS_SMALL;case"medium":return gs.RADIUS_MEDIUM;case"large":return gs.RADIUS_LARGE;case"full":return gs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return Pd.GAP_NONE;case"small":return Pd.GAP_SMALL;case"medium":return Pd.GAP_MEDIUM;case"large":return Pd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Mc.ALIGN_TOP:e.includes("middle")?t=Mc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Mc.ALIGN_BOTTOM),e.includes("start")?i=Ac.ALIGN_START:e.includes("center")?i=Ac.ALIGN_CENTER:e.includes("end")&&(i=Ac.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=Sd.BORDER_WIDTH_NONE;break;case"thin":o=Sd.BORDER_WIDTH_THIN;break;case"thick":o=Sd.BORDER_WIDTH_THICK;break;default:o=Sd.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 wi.TEXT_SIZE_XSMALL;case"small":return wi.TEXT_SIZE_SMALL;case"medium":return wi.TEXT_SIZE_MEDIUM;case"large":return wi.TEXT_SIZE_LARGE;case"xlarge":return wi.TEXT_SIZE_XLARGE;case"xxlarge":return wi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Bc.TEXT_STYLE_BODY;case"metadata":return Bc.TEXT_STYLE_METADATA;case"heading":return Bc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Rc.TEXT_OUTLINE_NONE;case"thin":return Rc.TEXT_OUTLINE_THIN;case"thick":return Rc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Ey.TEXT_WEIGHT_REGULAR;case"bold":return Ey.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Oc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Oc.TEXT_OVERFLOW_ELLIPSE}return Oc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Ut.BUTTON_APPEARANCE_SECONDARY;case"primary":return Ut.BUTTON_APPEARANCE_PRIMARY;case"plain":return Ut.BUTTON_APPEARANCE_PLAIN;case"bordered":return Ut.BUTTON_APPEARANCE_BORDERED;case"media":return Ut.BUTTON_APPEARANCE_MEDIA;case"destructive":return Ut.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Ut.BUTTON_APPEARANCE_CAUTION;case"success":return Ut.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return xc.BUTTON_SIZE_SMALL;case"medium":return xc.BUTTON_SIZE_MEDIUM;case"large":return xc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ms.IMAGE_RESIZE_NONE;case"fit":return ms.IMAGE_RESIZE_FIT;case"fill":return ms.IMAGE_RESIZE_FILL;case"cover":return ms.IMAGE_RESIZE_COVER;case"scale-down":return ms.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return wd.SPACER_XSMALL;case"small":return wd.SPACER_SMALL;case"medium":return wd.SPACER_MEDIUM;case"large":return wd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Tc.SPACER_INVISIBLE;case"thin":return Tc.SPACER_THIN;case"square":return Tc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Cd.ICON_SIZE_XSMALL;case"small":return Cd.ICON_SIZE_SMALL;case"medium":return Cd.ICON_SIZE_MEDIUM;case"large":return Cd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Mt.AVATAR_SIZE_XXSMALL;case"xsmall":return Mt.AVATAR_SIZE_XSMALL;case"small":return Mt.AVATAR_SIZE_SMALL;case"medium":return Mt.AVATAR_SIZE_MEDIUM;case"large":return Mt.AVATAR_SIZE_LARGE;case"xlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Mt.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Ty.AVATAR_FACING_LEFT;case"right":return Ty.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return Ci.FULLSNOO_XSMALL;case"small":return Ci.FULLSNOO_SMALL;case"medium":return Ci.FULLSNOO_MEDIUM;case"large":return Ci.FULLSNOO_LARGE;case"xlarge":return Ci.FULLSNOO_XLARGE;case"xxlarge":return Ci.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ay.AVATAR_BG_DARK;case"light":return Ay.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?xy.ANIM_LOTTIE:xy.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return Iy.ANIM_DIR_BACKWARD;case"forward":return Iy.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return Fy.ANIM_LOOP_REPEAT;case"bounce":return Fy.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Ry)).reduce((t,i)=>(t[i.substring(Ry.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return wA.forEach(o=>{if(o in t){let a=t[o];i.push({type:IA.get(o)??Uc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),vy(e)?e:yy(e)?Sy(e,t):wc(e)?yd(e):by(e)?Py(e):ky(e)?e:(console.warn(`Could not parse color: ${e}.`),yd("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,hs).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,Ic))}wrapRoot(e,t){return this.makeBlock(De.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=Fc(t,i),p=wy(t,i.stackParentLayout,c);return this.makeBlock(De.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(Ec.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(Ec.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(Ec.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(De.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(De.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(De.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(De.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(De.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(De.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e,t){return e&&this.makeBlock(De.BLOCK_FULLSNOO,e,t,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}makeAnimation(e,t){return e&&this.makeBlock(De.BLOCK_ANIMATION,e,t,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:this.resolveAssetUrl(e.url),loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e,t){return e&&this.makeBlock(De.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Fc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===De.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}};hs=new WeakMap;function By(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var My=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+=My(i);return e+=`</${r.type}>`,e};function FA(r){return" ".repeat(r)}function xA(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+=FA(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
+ `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var Ne,Uy,fs,Dc,vs,gt=class{constructor(e,t,i,n,o){l(this,Ne);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 Ii(()=>this.assets);this.effects=[];l(this,vs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Le({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,Ne,fs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(By(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,Ne,Uy).call(this)}async buildBlocksUI(){let e=S(this,Ne,fs).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 By(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(xA(My(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=hy(),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,Ne,Dc).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,Ne,fs).call(this),...n.props,children:p},v;for(;v===void 0;)try{v=await n.type(g,S(this,Ne,fs).call(this))}catch(m){if(m instanceof Promise)v=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 v=="object")return this.processBlock(v,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===Lc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Lc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Lc.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,vs)||(d(this,vs,!0),this.effects.push({type:Oy.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:Oy.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...Si(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}:{}}}};Ne=new WeakSet,Uy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},fs=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[D.Timezone]?.values[0],locale:this.metadata[D.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},Dc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,Ne,Dc).call(this,i.children)):t.push(i);return t},vs=new WeakMap;async function EA(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new gt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return TA.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function Ly(r){r.provides(AA),U("RenderPost",EA)}import{GetFieldsResponse as RA,InstallationSettingsDefinition as OA}from"@devvit/protos";async function BA(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return RA.fromJSON({fields:{fields:pt(u.installationSettings)}})}async function MA(r,e){return vd(r,u.installationSettings,e)}function Dy(r){r.provides(OA),U("GetSettingsFields",BA),U("ValidateForm",MA)}import{ContextActionDefinition as UA,ContextActionList as LA,ContextActionResponse as DA}from"@devvit/protos";var Ny=r=>`menuItem.${r}`;function Nc(r){return u.menuItems.find((e,t)=>Ny(t)===r)}async function NA(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:Ny(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 LA.fromJSON({actions:i})}async function _A(r,e){let t=Nc(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;h(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Le({ui:!0,metadata:e}),le(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),DA.fromJSON({effects:Si(p.ui)})}function _y(r){r.provides(UA),U("GetActions",NA),U("OnAction",_A)}function ht(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as qA}from"@devvit/protos";async function HA(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(Le({metadata:e}),le(e));await i(n,o)}function qy(r){r.provides(qA),U("HandleScheduledAction",HA)}import{HandlerResult as jA,OnAppInstallDefinition as WA,OnAppUpgradeDefinition as GA,OnCommentCreateDefinition as VA,OnCommentDeleteDefinition as zA,OnCommentReportDefinition as JA,OnCommentSubmitDefinition as $A,OnCommentUpdateDefinition as KA,OnModActionDefinition as XA,OnModMailDefinition as ZA,OnPostCreateDefinition as YA,OnPostDeleteDefinition as QA,OnPostFlairUpdateDefinition as eT,OnPostReportDefinition as tT,OnPostSubmitDefinition as rT,OnPostUpdateDefinition as iT,OnPostNsfwUpdateDefinition as nT,OnPostSpoilerUpdateDefinition as sT}from"@devvit/protos";var Fi;(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){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(Fi||(Fi={}));function ee(r,e){return h(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Le({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=oT(a);if(c)throw c.err;return jA.fromPartial({})}}function Hy(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(rT),U("OnPostSubmit",ee("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(YA),U("OnPostCreate",ee("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(iT),U("OnPostUpdate",ee("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(tT),U("OnPostReport",ee("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(QA),U("OnPostDelete",ee("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(eT),U("OnPostFlairUpdate",ee("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides($A),U("OnCommentSubmit",ee("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(VA),U("OnCommentCreate",ee("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(KA),U("OnCommentUpdate",ee("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(JA),U("OnCommentReport",ee("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(zA),U("OnCommentDelete",ee("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(WA),U("OnAppInstall",ee("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(GA),U("OnAppUpgrade",ee("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(XA),U("OnModAction",ee("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(ZA),U("OnModMail",ee("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(nT),U("OnPostNsfwUpdate",ee("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(sT),U("OnPostSpoilerUpdate",ee("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function oT(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=>Fi.caughtToString(t)).join(`
3
+ `))}}var Mb=_n(Qy(),1),Ub=_n(Yc(),1);import{EffectType as sR,HandleUIEventResponse as Qc,UIEventHandlerDefinition as oR}from"@devvit/protos";async function aR(r,e){let t=r.state??{},i=(0,Mb.default)(t),n=Le({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 gt((C,w)=>u.customPostType?.render(w)??null,r.event,r.state,e,void 0);return await y.reconcile(),Qc.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 v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,w=Nc(y);w?.location==="post"?v=C:w?.location==="comment"&&(m=C)}let b=Object.assign(n,le(e,v,m),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});await g.onSubmit({values:Et(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new gt((g,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),Qc.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Ub.default)(t,i),a=Si(n.ui),c=o?[...a,{type:sR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return Qc.fromJSON({state:i,effects:c})}function Lb(r){r.provides(oR),U("HandleUIEvent",aR)}import{CustomPostDefinition as lk,UIResponse as uk}from"@devvit/protos";import{EffectType as rm,Form as lR,ToastAppearance as _b}from"@devvit/protos";function Db(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var em=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(Et(n.formSubmitted.results))}}};function tm(r,e){let t=Ke({namespace:"useForm",initializer:i=>new em(i,r,e)});return dR({id:t.hookId})}function dR(r){return`form.hook.${r.id}.0`}function Nb(r,e){let t=Db(e);return r.getHook({id:t})}var Nt,Ld=class{constructor(e){l(this,Nt);d(this,Nt,e)}showForm(e,t){let i=Nb(s(this,Nt),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=lR.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});pr(n.fields),o.fields=pt(n.fields),s(this,Nt).emitEffect(e,{type:rm.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?_b.SUCCESS:_b.NEUTRAL}:t={text:e},s(this,Nt).emitEffect(e.toString(),{type:rm.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,Nt).emitEffect(t,{type:rm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Nt=new WeakMap;import{EffectType as uR,RealtimeSubscriptionStatus as qb}from"@devvit/protos";var _t,nt,qt,Cr,Cs,nm,Dd=class Dd{constructor(e,t){l(this,Cs);l(this,_t);l(this,nt);l(this,qt);l(this,Cr);d(this,_t,t.context),d(this,nt,!!t.context._devvitContext?.debug.realtime),d(this,Cr,e),d(this,qt,t.invalidate);let i=t.context.meta[D.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[D.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,_t)._hooks).filter(c=>c instanceof Dd).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 qb.REALTIME_SUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,qt).call(this),await s(this,Cr).onSubscribed?.();break;case qb.REALTIME_UNSUBSCRIBED:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,qt).call(this),await s(this,Cr).onUnsubscribed?.();break;default:s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Cr).onMessage(t.event?.data??{});break}}async send(e){if(s(this,nt)&&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,_t).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,nt)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,qt).call(this),S(this,Cs,nm).call(this))}unsubscribe(){this.state.subscribed&&(s(this,nt)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,qt).call(this),S(this,Cs,nm).call(this))}};_t=new WeakMap,nt=new WeakMap,qt=new WeakMap,Cr=new WeakMap,Cs=new WeakSet,nm=function(){let e=Object.values(s(this,_t)._hooks).filter(t=>t instanceof Dd&&t.state.subscribed).map(t=>t.state.channel);s(this,_t).emitEffect(this.state.channel,{type:uR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var im=Dd;function sm(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 Ke({id:e,namespace:e,initializer:t=>new im(r,t)})}import{EffectType as om}from"@devvit/protos";function Hb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var wr,yt,Ei=class Ei{constructor(e,t){l(this,wr);this._segments=[];l(this,yt,{});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,yt)).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,yt)}set _hooks(e){this._prevHooks=s(this,yt),d(this,yt,e)}get _state(){return s(this,wr)}set _state(e){d(this,yt,{}),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){Ei.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,yt)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ei._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ei._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,yt=new WeakMap,Ei._staticUndeliveredHandlers={};var Ri=Ei;var Ht={};Ri.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete Ht[r.hook],e.emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:Ht}}))});var jt,Oi,ws,Bi,am=class{constructor(e,t,i){l(this,jt);l(this,Oi);l(this,ws);l(this,Bi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Oi,i.invalidate),d(this,jt,i.hookId),d(this,ws,e),d(this,Bi,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,jt)]={duration:this.state.duration}:delete Ht[s(this,jt)]}async onUIEvent(e){await s(this,ws).call(this)}start(){Ht[s(this,jt)]={duration:this.state.duration},this.state.running=!0,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}stop(){delete Ht[s(this,jt)],this.state.running=!1,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:Ht}})}};jt=new WeakMap,Oi=new WeakMap,ws=new WeakMap,Bi=new WeakMap;function dm(r,e){let t=Ke({namespace:"useInterval",initializer:i=>new am(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}var Ir=class extends Error{};var lm="ServerCallRequired";function um(r){return r?.message===lm}var jb=_n(Yc(),1);function mm(r){if(r instanceof Error){if(r.message===lm)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:Fi.caughtToString(r)}}var Xe,st,Mi,Is,cm=class{constructor(e,t,i){l(this,Xe);l(this,st);l(this,Mi);l(this,Is);d(this,Xe,!!i.context.devvitContext.debug.useAsync),s(this,Xe)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,st,i.hookId),this.initializer=e,d(this,Mi,i.invalidate),d(this,Is,i.context),this.localDepends=t.depends??null}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,Xe)&&console.debug("[useAsync] async onLoad ",s(this,st),this.state),s(this,Xe)&&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,Xe)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,st)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Mi).call(this);let e={hook:s(this,st),async:!0,asyncRequest:{requestId:s(this,st)+"-"+JSON.stringify(this.state.depends)}};s(this,Xe)&&console.debug("[useAsync] onLoad requeue"),s(this,Is).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=mm(o)}let n={asyncResponse:i,hook:s(this,st)};s(this,Xe)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,st)+"-"+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,Mi).call(this)):s(this,Xe)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};Xe=new WeakMap,st=new WeakMap,Mi=new WeakMap,Is=new WeakMap;function cR(r,e={}){let t=Ke({namespace:"useAsync",initializer:i=>new cm(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var bt,Ui,Fr,xr,pm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,bt);l(this,Ui);l(this,Fr);l(this,xr);d(this,Fr,e),d(this,xr,t.hookId),d(this,bt,t.invalidate),d(this,Ui,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=mm(e)}s(this,bt).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,bt).call(this)}onStateLoaded(){if(this._promise=s(this,Ui)._prevHooks[s(this,xr)]?._promise,this.state.load_state==="loading")throw new Ir;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,bt).call(this);return}if(e instanceof Promise){this._promise=e,this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,xr)},hook:s(this,xr)};throw s(this,Ui).addToRequeueEvents(t),s(this,bt).call(this),new Ir}else this.state.value=e,this.state.load_state="loaded";s(this,bt).call(this)}}};bt=new WeakMap,Ui=new WeakMap,Fr=new WeakMap,xr=new WeakMap;function gm(r){let e=Ke({namespace:"useState",initializer:t=>new pm(r,t)});return[e.state.value,e.setter.bind(e)]}var ym={now(){return new Date}};function Wb(r){return`__autocache__${r}`}function Gb(r){return`__lock__${r}`}var mR=300,pR=1e3,Nd=5e3,hm=3,Vb=.1,zb=1e3,gR=3e4;function Jb(r){if(r.error)throw new Error(r.error);return r.value}var Wt,Gt,_e,Li,K,$b,Kb,Xb,fm,Zb,Yb,vm,Qb,_d=class{constructor(e,t,i=ym){l(this,K);l(this,Wt);l(this,Gt,{});l(this,_e);l(this,Li);d(this,Wt,e),d(this,Li,t),d(this,_e,i)}async cache(e,t){var a;(a=s(this,Li)).__cache??(a.__cache={}),d(this,Gt,s(this,Li).__cache),S(this,K,Qb).call(this,t);let i=S(this,K,$b).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,vm).call(this,t.key),o=await S(this,K,Kb).call(this,t,n,e);return Jb(o)}};Wt=new WeakMap,Gt=new WeakMap,_e=new WeakMap,Li=new WeakMap,K=new WeakSet,$b=function(e){let t=s(this,Gt)[e];if(t){let i=s(this,_e).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<hm&&Math.random()<Vb&&t.errorTime+zb<i;if(t?.expires&&t.expires<i&&t.checkedAt+zb<i||n){delete s(this,Gt)[e];return}else return Jb(t)}},Kb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,Yb).call(this,n):1;return!t||t?.error&&t.errorCount<hm&&Vb>Math.random()||o>Math.random()?S(this,K,Xb).call(this,e,t,i):t},Xb=async function(e,t,i){let n=Gb(e.key),o=s(this,_e).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Wt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Zb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,_e).now();return S(this,K,fm).call(this,p,e.key,e.ttl)}},fm=async function(e,t,i){let n=Math.min(i,pR),o=await S(this,K,vm).call(this,t);if(o)return o;if(s(this,_e).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,mR)),S(this,K,fm).call(this,e,t,i)},Zb=async function(e,t,i,n){let o=s(this,_e).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,_e).now().getTime(),t.errorCount++}return s(this,Gt)[e]=t,await s(this,Wt).set(Wb(e),JSON.stringify(t),{expiration:new Date(o+gR)}),t.error&&t.errorCount<hm&&await s(this,Wt).del(Gb(e)),t},Yb=function(e){let t=s(this,_e).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},vm=async function(e){let t=await s(this,Wt).get(Wb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,_e).now().getTime(),s(this,Gt)[e]=i,i}},Qb=function(e){e.ttl<Nd&&(console.warn(`Cache TTL cannot be less than ${Nd} milliseconds! Updating ttl value of ${e.ttl} to ${Nd}.`),e.ttl=Nd)};function ek(r,e,t=ym){let i=new _d(r,e,t);return i.cache.bind(i)}var qd=class{buildContext(e,t,i){let n=new mi(i),o=new ui(i),a=new vi(i),c=new hi(i),p=new yi(i),g=new bi(i),v=new Ld(e),m=new ci(i),b=new di,y=new pi(i),C=ek(a,e._state),w={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:b,realtime:y,ui:v,useState:gm,useChannel:sm,useInterval:dm,useForm:tm,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[D.Timezone]?.values[0],locale:i[D.Language]?.values[0],dimensions:t.env?.dimensions}},A=le(i,t.props?.postId);return A.debug.effects=e,{...A,...w}}};var ke=null;function tk(r){return JSON.parse(JSON.stringify(r))}function hR(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 fR(r){return r.blocking||r.resize?!1:!r.hook}function Ke({initializer:r,...e}){if(!ke)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.");hR(e.namespace);let t=ke.nextHookId(e),i=ke,n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:ke},o=ke._state[t]===void 0||Hb(ke._state[t]);ke._hooks[t]=ke._hooks[t]??r(n);let a=ke._hooks[t];return o||(a.state=ke._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var vR=null,Di,Wd,xs,F,ue,Hd,rk,bm,ik,km,Sm,jd,Pm,nk,Fs=class{constructor(e){l(this,F);l(this,Di);l(this,Wd,new qd);l(this,xs,new Ii(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,F,ue)&&console.debug("[blocks] BlocksHandler v1"),d(this,Di,e),vR=this}async handle(e,t){let i=new Ri(e,t),n=s(this,Wd).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),v,m,b=[...a];for(a.length===0&&a.push({}),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 w=tk(i._state);await S(this,F,rk).call(this,i,...y),i._state=w}else await S(this,F,ik).call(this,i,...y)}catch(w){if(!um(w))throw w;if(s(this,F,ue)&&console.debug("[blocks] caught in handler",w),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let A=b.map(B=>{let me={...B};return me.retry=!0,me});i.addToRequeueEvents(...A);break}else throw console.error("[blocks] unhandled error in handler",w),w}s(this,F,ue)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let w of i._requeueEvents){if(!p&&!w.async){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",w),C.push(w);continue}if(p&&w.async&&!g){s(this,F,ue)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",w),C.push(w);continue}s(this,F,ue)&&console.debug("[blocks] reprocessing event in BlocksHandler",w),a.push(w)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:tk(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,F,km).call(this,s(this,Di),i.request.props??{},i));let y=i._latestRenderContent;y&&(o=s(this,xs).createBlocksElementOrThrow(y),o=s(this,xs).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Di=new WeakMap,Wd=new WeakMap,xs=new WeakMap,F=new WeakSet,ue=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Hd=function(e,...t){e._hooks={},S(this,F,km).call(this,s(this,Di),e.request.props??{},e)},rk=async function(e,...t){S(this,F,Hd).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,bm).call(this,e,i)}))},bm=async function(e,t){fR(t)&&console.warn("Received an event in #attemptHook that does not have an associated hook. This will cause the event to be undelivered and may cause bugs. Make sure that event passes a hook field. Event:",{event:t});let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw um(n)?s(this,F,ue)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},ik=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,Hd).call(this,e,i),await S(this,F,bm).call(this,e,i),s(this,F,ue)&&console.log("[blocks] after",e._state);S(this,F,Hd).call(this,e)},km=function(e,t,i){s(this,F,ue)&&console.debug("[blocks] renderRoot"),i._generated={},ke=i,this._latestRenderContext=i;try{let n=S(this,F,Sm).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] = context.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 Ir)return;throw n}finally{ke=null}},Sm=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] = context.useState(async () => {/** your async code */})".`);return S(this,F,Pm).call(this,n,i)}finally{i.pop()}},jd=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,Pm).call(this,i,t)))},Pm=function(e,t){if(Array.isArray(e))return S(this,F,jd).call(this,e,t);if(yR(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=S(this,F,jd).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,F,Sm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=S(this,F,jd).call(this,e.children,t),n=S(this,F,nk).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},nk=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Ke({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 yR(r){return typeof r=="object"&&r!=null&&"type"in r}var sk=r=>{let e=Number(r.trim().split(".").pop());return isNaN(e)?void 0:e},ok=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=sk(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=sk(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)},ak=r=>r?r.platform==="Android"?r.versionNumber<1819908:r.platform==="iOS"?r.versionNumber<614940:!1:(console.warn(`Could not parse devvit-user-agent! Received: '${JSON.stringify(r)}'`),!1),bR=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}`)}},kR=({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=bR(r);t?e.ui.navigateTo(t):console.warn("No upgrade link found for platform:",r)}},"Upgrade"))))),dk=r=>()=>u.createElement(kR,{platform:r});var SR=[[lk,lk.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null]];function PR(r){return async(e,t)=>{let i=ok(t["devvit-user-agent"]?.values?.[0]??"");if(i&&ak(i)){let o=new Fs(dk(i.platform));return uk.fromJSON(await o.handle(e,t))}let n=new Fs(r);return uk.fromJSON(await n.handle(e,t))}}function ck(r){for(let[e,t,i]of SR)r.provides(e),U(t.name,PR(i))}var Ni,As,_i,Ar,Tr,qi,Hi,Er,Vt,Ts,Es,Rr,_,L=class L extends ud{static configure(e){d(this,_i,{...s(this,_i),...e}),ht(e.http)&&this.use(P.HTTPDefinition),(ht(e.kvStore)||ht(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),ht(e.media)&&this.use(P.MediaServiceDefinition),ht(e.modLog)&&this.use(P.ModlogDefinition),ht(e.redditAPI)&&(this.use(P.FlairDefinition),this.use(P.GraphQLDefinition),this.use(P.LinksAndCommentsDefinition),this.use(P.ListingsDefinition),this.use(P.ModerationDefinition),this.use(P.ModNoteDefinition),this.use(P.NewModmailDefinition),this.use(P.PrivateMessagesDefinition),this.use(P.SubredditsDefinition),this.use(P.PostCollectionsDefinition),this.use(P.UsersDefinition),this.use(P.WidgetsDefinition),this.use(P.WikiDefinition),this.use(P.RedditAPIV2Definition)),ht(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,Hi).push(e)}static addCustomPostType(e){d(this,Ar,e)}static createForm(e,t){let i=`form.${s(this,Tr).size}`;return s(this,Tr).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,_)[P.SchedulerDefinition.fullName]||this.use(P.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,qi,t),i.length>0&&d(this,Ni,i),s(this,_)[P.SettingsDefinition.fullName]||this.use(P.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,Vt).has(e.event)?s(this,Vt).get(e.event)?.push(e.onEvent):s(this,Vt).set(e.event,[e.onEvent]),L}static provide(e){s(this,Es).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,_)[e.fullName]=i,i}static get redditAPIPlugins(){if(!ht(s(this,_i).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,_)[P.FlairDefinition.fullName],GraphQL:s(this,_)[P.GraphQLDefinition.fullName],LinksAndComments:s(this,_)[P.LinksAndCommentsDefinition.fullName],Listings:s(this,_)[P.ListingsDefinition.fullName],Moderation:s(this,_)[P.ModerationDefinition.fullName],ModNote:s(this,_)[P.ModNoteDefinition.fullName],NewModmail:s(this,_)[P.NewModmailDefinition.fullName],PrivateMessages:s(this,_)[P.PrivateMessagesDefinition.fullName],Subreddits:s(this,_)[P.SubredditsDefinition.fullName],PostCollections:s(this,_)[P.PostCollectionsDefinition.fullName],Users:s(this,_)[P.UsersDefinition.fullName],Widgets:s(this,_)[P.WidgetsDefinition.fullName],Wiki:s(this,_)[P.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,_)[P.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,_)[P.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,_)[P.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,_)[P.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,_)[P.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 redditapiv2Plugin(){let e=s(this,_)[P.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,_)[P.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,_)[P.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,Hi)}static get customPostType(){return s(this,Ar)}static get formDefinitions(){return s(this,Tr)}static get scheduledJobHandlers(){return s(this,Er)}static get installationSettings(){return s(this,qi)}static get appSettings(){return s(this,Ni)}static get triggerOnEventHandlers(){return s(this,Vt)}static get assets(){return s(this,As)}static get webviewAssets(){return s(this,Ts)}constructor(e){super(e),d(L,As,e.assets??{}),d(L,Ts,e.webviewAssets??{});for(let t in s(L,Rr)){let i=s(L,Rr)[t];i.handler=e.use(i.def,i.options)}s(L,Hi).length>0&&_y(e),s(L,Er).size>0&&qy(e),s(L,Ar)&&(Ly(e),ck(e)),(s(L,Ar)||s(L,Tr).size>0)&&Lb(e),s(L,qi)&&Dy(e),s(L,Ni)&&gy(e),s(L,Vt).size>0&&Hy(e);for(let t of s(L,Es))e.provides(t)}};Ni=new WeakMap,As=new WeakMap,_i=new WeakMap,Ar=new WeakMap,Tr=new WeakMap,qi=new WeakMap,Hi=new WeakMap,Er=new WeakMap,Vt=new WeakMap,Ts=new WeakMap,Es=new WeakMap,Rr=new WeakMap,_=new WeakMap,L.debug={},l(L,Ni),l(L,As,{}),l(L,_i,{}),l(L,Ar),l(L,Tr,new Map),l(L,qi),l(L,Hi,[]),l(L,Er,new Map),l(L,Vt,new Map),l(L,Ts,{}),l(L,Es,[]),l(L,Rr,{}),l(L,_,{});var u=L;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function X(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 Cm;(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"})(Cm||(Cm={}));var mk="text",pk="raw",gk="br",hk="link",fk="c/",vk="p/",yk="r/",bk="u/",kk="@",Sk="spoilertext",Pk="par",Ck="h",wk="hr",Ik="blockquote",Fk="code",xk="li",Ak="list",Tk="L",Ek="R",Rk="C",Ok="table",Bk="embed",Mk="img",Uk="gif",Lk="video";function Dk(r){return{e:Uk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Nk(r,e){let t={},i=[];return Object.assign(t,Rs(t,i),Os(t,i),Bs(t,i),Ls(t,i),Ds(t,i),Ns(t,i)),e(t),{e:Ik,c:i,...r.author&&{a:r.author}}}function _k(r,e){let t={},i=[];return Object.assign(t,Im(t,i)),e(t),{e:Fk,c:i,...r.language&&{l:r.language}}}function qk(r){return{e:fk,t:r.permalink}}function Hk(r,e){let t={},i=[];return Object.assign(t,Im(t,i),Us(t,i)),e(t),{e:Ck,l:r.level,c:i}}function jk(r){return{e:Bk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Wk(){return{e:wk}}function Gk(r){return{e:Mk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Vk(){return{e:gk}}function zk(r){return{e:hk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function Jk(r,e){let t={},i=[];return Object.assign(t,lS(t,i)),e(t),{e:Ak,o:r.ordered,c:i}}function $k(r){let e={},t=[];return Object.assign(e,Rs(e,t),Os(e,t),Bs(e,t),Gd(e,t),Ls(e,t),Ds(e,t),Ns(e,t)),r(e),{e:xk,c:t}}function Kk(r){let e={},t=[];return Object.assign(e,Vd(e,t),Us(e,t),wm(e,t),Fm(e,t),Ms(e,t)),r(e),{e:Pk,c:t}}function Xk(r){return{e:vk,t:r.permalink}}function Zk(r){return{e:pk,t:r}}function Yk(r){let e={},t=[];return Object.assign(e,Vd(e,t),Us(e,t),wm(e,t)),r(e),{e:Sk,c:t}}function Qk(r){return{e:yk,t:r.subredditName,l:r.showPrefix}}function eS(r){let e={},t=[],i=[];return Object.assign(e,uS(e,t,i)),r(e),{e:Ok,h:t,c:i}}function tS(r){let[e,t]=dS();return r(e),{c:t}}function rS(r,e){let[t,i]=dS();e(t);let n;switch(r.columnAlignment){case"left":n=Tk;break;case"right":n=Ek;break;case"center":n=Rk;break}return{...n&&{a:n},...i&&{c:i}}}function iS(r){let e={},t=[];return Object.assign(e,cS(e,t)),r(e),t}function nS(r){return{e:mk,t:r.text,...r.formatting&&{f:r.formatting}}}function sS(r){return{e:bk,t:r.username,l:r.showPrefix}}function oS(r){return{e:kk,t:r.username,l:r.showPrefix}}function aS(r){return{e:Lk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function dS(){let r={},e=[];return Object.assign(r,Vd(r,e),Us(r,e),Fm(r,e),Ms(r,e)),[r,e]}function Rs(r,e){return{blockQuote(t,i){return e.push(Nk(t,i)),r}}}function Os(r,e){return{codeBlock(t,i){return e.push(_k(t,i)),r}}}function mS(r,e){return{embed(t){return e.push(jk(t)),r}}}function Bs(r,e){return{heading(t,i){return e.push(Hk(t,i)),r}}}function Gd(r,e){return{horizontalRule(){return e.push(Wk()),r}}}function Ms(r,e){return{image(t){return e.push(Gk(t)),r},animatedImage(t){return e.push(Dk(t)),r}}}function wm(r,e){return{linebreak(){return e.push(Vk()),r}}}function Us(r,e){return{link(t){return e.push(zk(t)),r},commentLink(t){return e.push(qk(t)),r},postLink(t){return e.push(Xk(t)),r},subredditLink(t){return e.push(Qk(t)),r},userLink(t){return e.push(sS(t)),r},userMention(t){return e.push(oS(t)),r}}}function Ls(r,e){return{list(t,i){return e.push(Jk(t,i)),r}}}function lS(r,e){return{item(t){return e.push($k(t)),r}}}function Ds(r,e){return{paragraph(t){return e.push(Kk(t)),r}}}function Im(r,e){return{rawText(t){return e.push(Zk(t)),r}}}function Fm(r,e){return{spoiler(t){return e.push(Yk(t)),r}}}function uS(r,e,t){return{headerCell(i,n){return e.push(rS(i,n)),r},row(i){return t.push(iS(i)),r}}}function Ns(r,e){return{table(t){return e.push(eS(t)),r}}}function cS(r,e){return{cell(t){return e.push(tS(t)),r}}}function Vd(r,e){return{text(t){return e.push(nS(t)),r}}}function pS(r,e){return{video(t){return e.push(aS(t)),r}}}var CR=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},wR=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)},zd,_s=class{constructor(){zd.set(this,void 0);let e=[];Object.assign(this,Ds(this,e),Bs(this,e),Gd(this,e),Rs(this,e),Os(this,e),mS(this,e),Ls(this,e),Ns(this,e),Ms(this,e),pS(this,e)),CR(this,zd,{document:e},"f")}build(){return JSON.stringify(wR(this,zd,"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}};zd=new WeakMap;function ji(r){let e;return r instanceof _s?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var gS=100,hS=1/0,Or,Br,zt,Wi,Gi,Jd,W=class{constructor(e){l(this,Gi);l(this,Or);l(this,Br);l(this,zt);l(this,Wi,!1);this.pageSize=gS;this.limit=hS;this.children=[];X(this),this._fetch=e.fetch,this.pageSize=e.pageSize??gS,this.limit=e.limit??hS,d(this,Br,e.after),d(this,Or,e.before),d(this,zt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Wi)||!!(s(this,Br)||s(this,Or)||s(this,zt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Gi,Jd).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,zt,e)}preventInitialFetch(){d(this,Wi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Gi,Jd).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,Gi,Jd).call(this);return this.children.slice(0,t)}};Or=new WeakMap,Br=new WeakMap,zt=new WeakMap,Wi=new WeakMap,Gi=new WeakSet,Jd=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,zt)});return this.children.push(...e),d(this,Or,t),d(this,Br,i),d(this,zt,n),d(this,Wi,!0),e};function IR(r){try{return!0}catch{return!1}}function FR(r){try{return!0}catch{return!1}}var qs,xm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new W({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,qs,xm).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,qs,xm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};qs=new WeakSet,xm=function(e){if(h(e.id,"Mod note ID is null or undefined"),h(e.createdAt,"Mod note createdAt is null or undefined"),h(e.type,"Mod note type is null or undefined"),h(e.subreddit,"Mod note subreddit is null or undefined"),h(e.subredditId,"Mod note subredditId is null or undefined"),h(e.operator,"Mod note operator is null or undefined"),h(e.operatorId,"Mod note operatorId is null or undefined"),h(e.user,"Mod note user is null or undefined"),h(e.userId,"Mod note userId is null or undefined"),h(e.userNoteData,"Mod note userNote is null or undefined"),h(e.modActionData,"Mod note modAction is null or undefined"),!IR(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!FR(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:Re(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:ve(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Me,qs);var kt=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 fS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_community","chat_operator"];function xR(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function Am(r){return xR(r,fS,!0)}function vS(r){return r.filter(e=>fS.includes(e))}var AR=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(AR||{}),Ur,Vi,zi,Ji,$i,Ki,Xi,Zi,Yi,Qi,en,$d,Ze=class Ze{constructor(e,t,i){l(this,Ur);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Yi);l(this,Qi);X(this),h(e.id),h(e.text),d(this,Ur,e.id),d(this,Vi,t),d(this,zi,e.text),d(this,Ji,TR(e.textColor)),d(this,$i,ER(e.backgroundColor)),d(this,Ki,RR(e.allowableContent)),d(this,Xi,e.modOnly),d(this,Zi,e.maxEmojis),d(this,Yi,e.textEditable),d(this,Qi,i)}get id(){return s(this,Ur)}get text(){return s(this,zi)}get textColor(){return s(this,Ji)}get backgroundColor(){return s(this,$i)}get allowableContent(){return s(this,Ki)}get modOnly(){return s(this,Xi)}get maxEmojis(){return s(this,Zi)}get allowUserEdits(){return s(this,Yi)}async delete(){return Ze.deleteFlairTemplate(s(this,Ur),s(this,Vi),s(this,Qi))}async edit(e){return Ze.editFlairTemplate({id:s(this,Ur),subredditName:s(this,Vi),text:e.text??s(this,zi),allowableContent:e.allowableContent??s(this,Ki),backgroundColor:e.backgroundColor??s(this,$i),maxEmojis:e.maxEmojis??s(this,Zi),modOnly:e.modOnly??s(this,Xi),textColor:e.textColor??s(this,Ji),allowUserEdits:e.allowUserEdits??s(this,Yi)},s(this,Qi))}static async createPostFlairTemplate(e,t){var i;return S(i=Ze,en,$d).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ze,en,$d).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ze,en,$d).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Ze(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Ze(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Ur=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,en=new WeakSet,$d=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,textColor:v="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 C=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:g,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ze(C,i,t)},l(Ze,en);var de=Ze;function Hs(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var Jt,Tm,Em,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,Jt,Tm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Mr,Jt,Tm).call(i,{...e,postId:fe(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Mr,Jt,Em).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Mr,Jt,Em).call(n,e,void 0,t,i)}};Jt=new WeakSet,Tm=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)},Em=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,Jt);var Ue=Mr;function TR(r){if(h(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function ER(r){if(h(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function RR(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as _R}from"@devvit/protos";var SS=_n(kS(),1);var tn,Ws,rn,Gs,Vs,zs,Js,$s,nn,Ks,Xs,Zs,Ys,Qs,eo,$t,to,ro,Dr,sn,Kt,on,an,dn,Nr,Xt,Zt,ln,Yt,Qt,er,St,io,no,un,cn,N,H=class H{constructor(e,t){l(this,tn);l(this,Ws);l(this,rn);l(this,Gs);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,nn);l(this,Ks);l(this,Xs);l(this,Zs);l(this,Ys);l(this,Qs);l(this,eo);l(this,$t);l(this,to);l(this,ro);l(this,Dr);l(this,sn);l(this,Kt);l(this,on);l(this,an);l(this,dn);l(this,Nr);l(this,Xt);l(this,Zt);l(this,ln);l(this,Yt);l(this,Qt);l(this,er);l(this,St);l(this,io);l(this,no);l(this,un);l(this,cn);l(this,N);X(this),h(e.id,"Post is missing id"),h(e.title,"Post is missing title"),h(e.createdUtc,"Post is missing created date"),h(e.author,"Post is missing author name"),h(e.subreddit,"Post is missing subreddit name"),h(e.subredditId,"Post is missing subreddit id"),h(e.url,"Post is missing url"),h(e.permalink,"Post is missing permalink"),d(this,tn,fe(`t3_${e.id}`)),d(this,rn,e.author),d(this,Ws,e.authorFullname?ne(e.authorFullname):void 0),d(this,Vs,Re(e.subredditId)),d(this,zs,e.subreddit),d(this,Zs,e.score??0),d(this,Ys,e.numComments??0),d(this,Qs,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Gs,i),d(this,$s,e.title),d(this,nn,e.selftext),d(this,Ks,e.selftextHtml),d(this,Xs,e.url),d(this,Js,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,eo,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,$t,e.approved??!1),d(this,to,e.approvedAtUtc??0),d(this,ro,e.bannedAtUtc??0),d(this,Kt,e.removed??!1),d(this,on,e.removedBy),d(this,an,e.removedByCategory),d(this,Dr,e.spam??!1),d(this,sn,e.stickied??!1),d(this,dn,e.archived??!1),d(this,Nr,e.edited??!1),d(this,Xt,e.locked??!1),d(this,Zt,e.over18??!1),d(this,ln,e.quarantine??!1),d(this,Yt,e.spoiler),d(this,Qt,e.hidden??!1),d(this,er,e.ignoreReports??!1),d(this,St,e.distinguished),d(this,no,e.secureMedia),d(this,un,(e.modReports??[]).map(([n])=>n)),d(this,cn,(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,io,{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,tn)}get authorId(){return s(this,Ws)}get authorName(){return s(this,rn)}get subredditId(){return s(this,Vs)}get subredditName(){return s(this,zs)}get permalink(){return s(this,Js)}get title(){return s(this,$s)}get body(){return s(this,nn)}get bodyHtml(){return s(this,Ks)}get url(){return s(this,Xs)}get thumbnail(){return s(this,eo)}get createdAt(){return s(this,Gs)}get score(){return s(this,Zs)}get numberOfComments(){return s(this,Ys)}get numberOfReports(){return s(this,Qs)}get approved(){return s(this,$t)}get approvedAtUtc(){return s(this,to)}get bannedAtUtc(){return s(this,ro)}get spam(){return s(this,Dr)}get stickied(){return s(this,sn)}get removed(){return s(this,Kt)}get removedBy(){return s(this,on)}get removedByCategory(){return s(this,an)}get archived(){return s(this,dn)}get edited(){return s(this,Nr)}get locked(){return s(this,Xt)}get nsfw(){return s(this,Zt)}get quarantined(){return s(this,ln)}get spoiler(){return s(this,Yt)}get hidden(){return s(this,Qt)}get ignoringReports(){return s(this,er)}get distinguishedBy(){return s(this,St)}get comments(){return Q.getComments({postId:this.id},s(this,N))}get flair(){return s(this,io)}get secureMedia(){return s(this,no)}get userReportReasons(){return s(this,cn)}get modReportReasons(){return s(this,un)}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,on),removedByCategory:s(this,an),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,un),userReportReasons:s(this,cn)}}isApproved(){return s(this,$t)}isSpam(){return s(this,Dr)}isStickied(){return s(this,sn)}isRemoved(){return s(this,Kt)}isArchived(){return s(this,dn)}isEdited(){return s(this,Nr)}isLocked(){return s(this,Xt)}isNsfw(){return s(this,Zt)}isQuarantined(){return s(this,ln)}isSpoiler(){return s(this,Yt)}isHidden(){return s(this,Qt)}isIgnoringReports(){return s(this,er)}isDistinguishedBy(){return s(this,St)}async edit(e){let t=await H.edit({id:this.id,...e},s(this,N));d(this,nn,t.body),d(this,Nr,t.edited)}async addComment(e){return Q.submit({id:this.id,...e},s(this,N))}async delete(){return H.delete(this.id,s(this,N))}async approve(){await H.approve(this.id,s(this,N)),d(this,$t,!0),d(this,Kt,!1)}async remove(e=!1){await H.remove(this.id,e,s(this,N)),d(this,Kt,!0),d(this,Dr,e),d(this,$t,!1)}async lock(){await H.lock(this.id,s(this,N)),d(this,Xt,!0)}async unlock(){await H.unlock(this.id,s(this,N)),d(this,Xt,!1)}async hide(){await H.hide(this.id,s(this,N)),d(this,Qt,!0)}async unhide(){await H.unhide(this.id,s(this,N)),d(this,Qt,!1)}async markAsNsfw(){await H.markAsNsfw(this.id,s(this,N)),d(this,Zt,!0)}async unmarkAsNsfw(){await H.unmarkAsNsfw(this.id,s(this,N)),d(this,Zt,!1)}async markAsSpoiler(){await H.markAsSpoiler(this.id,s(this,N)),d(this,Yt,!0)}async unmarkAsSpoiler(){await H.unmarkAsSpoiler(this.id,s(this,N)),d(this,Yt,!1)}async sticky(e){await H.sticky(this.id,e,s(this,N))}async unsticky(){await H.unsticky(this.id,s(this,N))}async distinguish(){let{distinguishedBy:e}=await H.distinguish(this.id,!1,s(this,N));d(this,St,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await H.distinguish(this.id,!0,s(this,N));d(this,St,e)}async undistinguish(){let{distinguishedBy:e}=await H.undistinguish(this.id,s(this,N));d(this,St,e)}async ignoreReports(){await H.ignoreReports(this.id,s(this,N)),d(this,er,!0)}async unignoreReports(){await H.unignoreReports(this.id,s(this,N)),d(this,er,!1)}async getAuthor(){return I.getByUsername(s(this,rn),s(this,N))}async crosspost(e){return H.crosspost({...e,postId:this.id},s(this,N))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,tn)],...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 H(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){h(t,"Missing metadata in `SubmitPostOptions`");let c=await new gt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=_R.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,SS.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?ji(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 H.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 H.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=ji(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 H.getById(n,t)}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 h(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 h(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 W({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 js(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new W({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 js(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({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 js(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({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 js(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({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 js(o,t)}})}};tn=new WeakMap,Ws=new WeakMap,rn=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,nn=new WeakMap,Ks=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,$t=new WeakMap,to=new WeakMap,ro=new WeakMap,Dr=new WeakMap,sn=new WeakMap,Kt=new WeakMap,on=new WeakMap,an=new WeakMap,dn=new WeakMap,Nr=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,ln=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,er=new WeakMap,St=new WeakMap,io=new WeakMap,no=new WeakMap,un=new WeakMap,cn=new WeakMap,N=new WeakMap;var z=H;function js(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 qR=(q=>(q.Custom="CUSTOM",q.Reddit="REDDIT",q.Instagram="INSTAGRAM",q.Twitter="TWITTER",q.Tiktok="TIKTOK",q.Twitch="TWITCH",q.Facebook="FACEBOOK",q.Youtube="YOUTUBE",q.Tumblr="TUMBLR",q.Spotify="SPOTIFY",q.Soundcloud="SOUNDCLOUD",q.Beacons="BEACONS",q.Linktree="LINKTREE",q.Discord="DISCORD",q.Venmo="VENMO",q.CashApp="CASH_APP",q.Patreon="PATREON",q.Kofi="KOFI",q.Paypal="PAYPAL",q.Cameo="CAMEO",q.Onlyfans="ONLYFANS",q.Substack="SUBSTACK",q.Kickstarter="KICKSTARTER",q.Indiegogo="INDIEGOGO",q.BuyMeACoffee="BUY_ME_A_COFFEE",q.Shopify="SHOPIFY",q))(qR||{}),so,mn,oo,ao,lo,uo,co,tr,mo,po,at,_r=class _r{constructor(e,t){l(this,so);l(this,mn);l(this,oo);l(this,ao);l(this,lo);l(this,uo);l(this,co);l(this,tr,new Map);l(this,mo);l(this,po);l(this,at);X(this),h(e.id,"User ID is missing or undefined"),h(e.name,"Username is missing or undefined"),h(e.createdUtc,"User is missing created date"),d(this,so,ne(ld(e.id)?e.id:`t2_${e.id}`)),d(this,mn,e.name),d(this,uo,e.over18??!1),d(this,co,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,oo,i),d(this,ao,e.linkKarma??0),d(this,lo,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,tr).set(n,vS(o));d(this,mo,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,po,e.subreddit?.url??""),d(this,at,t)}get id(){return s(this,so)}get username(){return s(this,mn)}get createdAt(){return s(this,oo)}get linkKarma(){return s(this,ao)}get commentKarma(){return s(this,lo)}get nsfw(){return s(this,uo)}get isAdmin(){return s(this,co)}get modPermissions(){return s(this,tr)}get url(){return s(this,mo)}get permalink(){return s(this,po)}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,tr).has(e))return s(this,tr).get(e);let t=await _r.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,at)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,tr).set(e,i),i}getComments(e){return Q.getCommentsByUser({username:this.username,...e},s(this,at))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,at))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,mn)},s(this,at));return t.users[0]?Hs(t.users[0]):void 0}getSnoovatarUrl(){return _r.getSnoovatarUrl(this.username,s(this,at))}async getSocialLinks(){let i=await kt.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,at));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){h(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 W({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 jR(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?Am(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:Am(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
5
- `))}static async getSnoovatarUrl(e,t){return(await kt.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new W({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:"overview",...n},t);return UR(o,t)}})}};no=new WeakMap,mn=new WeakMap,so=new WeakMap,oo=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=new WeakMap,tr=new WeakMap,co=new WeakMap,mo=new WeakMap,at=new WeakMap;var I=Nr;function UR(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new z(i.data,e);if(i.kind==="t1")return new Q(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function LR(r,e,t){let i=u.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(v=>(h(v.data?.id,"User id is still from listing data"),v.data.id)),o=100,a=[];for(let v=0;v<n.length;v+=o)a.push(n.slice(v,v+o));let p=(await Promise.all(a.map(v=>i.UserDataByAccountIds({ids:v.join(",")},t)))).reduce((v,m)=>({...v,...m.users}),{});return{children:r.data.children.map(v=>{let m=v.data?.id;h(m,"User id is missing from listing");let b=p[m];return h(b,"User data is missing from response"),new I({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:v.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var qr,po,pn,gn,go,ho,hn,fo,vo,fn,rr,yo,bo,Hr,ir,nr,Pt,jr,Ct,ko,So,Po,Co,wo,Io,Fo,te,dt,Xd,Zd,G=class G{constructor(e,t){l(this,qr);l(this,po);l(this,pn);l(this,gn);l(this,go);l(this,ho);l(this,hn);l(this,fo);l(this,vo);l(this,fn);l(this,rr);l(this,yo);l(this,bo);l(this,Hr);l(this,ir);l(this,nr);l(this,Pt);l(this,jr);l(this,Ct);l(this,ko);l(this,So);l(this,Po);l(this,Co);l(this,wo);l(this,Io);l(this,Fo);l(this,te);var n;X(this),h(e.id,"Comment id is null or undefined"),h(e.body,"Comment body is null or undefined"),h(e.createdUtc,"Comment is missing created date"),h(e.author,"Comment author is null or undefined"),h(e.parentId,"Comment parentId is null or undefined"),h(e.linkId,"Comment linkId is null or undefined"),h(e.permalink,"Comment permalink is null or undefined"),h(e.subreddit,"Comment is missing subreddit name"),h(e.subredditId,"Comment is missing subreddit id"),d(this,qr,ii(`t1_${e.id}`)),d(this,po,e.authorFullname?ne(e.authorFullname):void 0),d(this,pn,e.author),d(this,gn,e.body),d(this,fo,Re(e.subredditId)),d(this,vo,e.subreddit),d(this,ho,mc(e.parentId)?ii(e.parentId):fe(e.parentId)),d(this,hn,fe(e.linkId)),d(this,Hr,e.edited??!1),d(this,ir,e.locked??!1),d(this,nr,e.removed??!1),d(this,Pt,e.stickied??!1),d(this,rr,e.approved??!1),d(this,yo,e.approvedAtUtc??0),d(this,bo,e.bannedAtUtc??0),d(this,jr,e.spam??!1),d(this,Ct,e.distinguished),d(this,ko,e.numReports??0),d(this,So,e.collapsedBecauseCrowdControl??!1),d(this,Po,e.score??0),d(this,Co,e.permalink),d(this,Fo,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,wo,(e.modReports??[]).map(([o])=>o)),d(this,Io,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,go,i),d(this,fn,S(n=G,dt,Xd).call(n,{postId:s(this,hn),commentId:s(this,qr)},t)),d(this,te,t)}get id(){return s(this,qr)}get authorId(){return s(this,po)}get authorName(){return s(this,pn)}get subredditId(){return s(this,fo)}get subredditName(){return s(this,vo)}get body(){return s(this,gn)}get createdAt(){return s(this,go)}get parentId(){return s(this,ho)}get postId(){return s(this,hn)}get replies(){return s(this,fn)}get distinguishedBy(){return s(this,Ct)}get locked(){return s(this,ir)}get stickied(){return s(this,Pt)}get removed(){return s(this,nr)}get approved(){return s(this,rr)}get approvedAtUtc(){return s(this,yo)}get bannedAtUtc(){return s(this,bo)}get spam(){return s(this,jr)}get edited(){return s(this,Hr)}get numReports(){return s(this,ko)}get collapsedBecauseCrowdControl(){return s(this,So)}get score(){return s(this,Po)}get permalink(){return s(this,Co)}get userReportReasons(){return s(this,Io)}get modReportReasons(){return s(this,wo)}get url(){return s(this,Fo)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,ir)}isApproved(){return s(this,rr)}isRemoved(){return s(this,nr)}isSpam(){return s(this,jr)}isStickied(){return s(this,Pt)}isDistinguished(){return!!s(this,Ct)}isEdited(){return s(this,Hr)}async delete(){return G.delete(this.id,s(this,te))}async edit(e){let t=await G.edit({id:this.id,...e},s(this,te));return d(this,gn,t.body),d(this,Hr,t.edited),this}async approve(){await G.approve(this.id,s(this,te)),d(this,rr,!0),d(this,nr,!1)}async remove(e=!1){await G.remove(this.id,e,s(this,te)),d(this,nr,!0),d(this,jr,e),d(this,rr,!1)}async lock(){await G.lock(this.id,s(this,te)),d(this,ir,!0)}async unlock(){await G.unlock(this.id,s(this,te)),d(this,ir,!1)}async reply(e){return G.submit({id:this.id,...e},s(this,te))}async getAuthor(){return I.getByUsername(s(this,pn),s(this,te))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!1,s(this,te));d(this,Ct,t),d(this,Pt,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!0,s(this,te));d(this,Ct,t),d(this,Pt,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await G.undistinguish(this.id,s(this,te));d(this,Ct,e),d(this,Pt,t)}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,qr)],...e},s(this,te))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=At(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new G(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=G,dt,Xd).call(a,{postId:fe(i),commentId:n?ii(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let c=a.json?.data?.things?.[0]?.data;return h(c),new G(c,t)}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 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 submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let c=a.json?.data?.things?.[0]?.data;return h(c),new G(c,t)}static async distinguish(e,t,i,n){let c=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return h(c),{distinguishedBy:c.distinguished,stickied:!!c.stickied}}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 h(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({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:"comments",...n},t);return h(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new G(c.data,t))||[],before:o.data.before,after:o.data.after}}})}};qr=new WeakMap,po=new WeakMap,pn=new WeakMap,gn=new WeakMap,go=new WeakMap,ho=new WeakMap,hn=new WeakMap,fo=new WeakMap,vo=new WeakMap,fn=new WeakMap,rr=new WeakMap,yo=new WeakMap,bo=new WeakMap,Hr=new WeakMap,ir=new WeakMap,nr=new WeakMap,Pt=new WeakMap,jr=new WeakMap,Ct=new WeakMap,ko=new WeakMap,So=new WeakMap,Po=new WeakMap,Co=new WeakMap,wo=new WeakMap,Io=new WeakMap,Fo=new WeakMap,te=new WeakMap,dt=new WeakSet,Xd=function(e,t,i=0){return new W({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,y;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let C=n.more;(!o||o>100)&&(o=100);let w=C.children.splice(0,o),A=await c.MoreChildren({linkId:e.postId,children:w,sort:e.sort},t);if(!A.json?.data?.things?.length)return{children:[]};let{children:B}=S(b=G,dt,Zd).call(b,A.json.data.things,e.postId,e,t);return{children:B,more:C.children.length?C:void 0}}else p=n.more.parentId,i=i+n.more.depth;let v=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],m=v[0];return p&&m?.data?.replyList?.data&&(v=m.data.replyList.data.children),S(y=G,dt,Zd).call(y,v,p??e.postId,e,t,i)}})},Zd=function(e,t,i,n,o=0){var g,v;let a=[],c,p={};for(let m of e){if(!m.data||(m.data.depth!=null&&(m.data.depth=m.data.depth+o),m.data.depth!=null&&i.depth!=null&&m.data.depth>=i.depth))continue;let b=m.data.parentId?p[m.data.parentId]:void 0;if(m.kind==="t1"){if(m.data.name===t)continue;let y=new G(m.data,n);if(p[y.id]=y,d(y,fn,S(g=G,dt,Xd).call(g,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:w}=S(v=G,dt,Zd).call(v,m.data.replyList.data.children,y.id,i,n,o);C.length&&y.replies.children.push(...C),w&&y.replies.setMore(w)}y.replies.preventInitialFetch(),b?b.replies.children.push(y):a.push(y)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let y={parentId:mc(m.data.parentId)?ii(m.data.parentId):fe(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(y):y.parentId===t&&(c=y)}}return{children:a,more:c}},l(G,dt);var Q=G;function md(r,e){let t=u.redditAPIPlugins.Moderation;return new W({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return DR(n)}})}function DR(r){if(!r.data?.children)throw new Error("AboutLogResponse is missing children");return{children:r.data.children.map(t=>{if(!t.data)throw new Error("ModAction from AboutLogResponse is missing or invalid");let{id:i,mod:n,modId36:o,createdUtc:a,subreddit:c,subredditNamePrefixed:p,action:g,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:w,targetPermalink:A,targetTitle:B}=t.data;h(i,"ModAction from AboutLogResponse is missing id"),h(n,"ModAction from AboutLogResponse is missing mod"),h(o,"ModAction from AboutLogResponse is missing modId36"),h(a,"ModAction from AboutLogResponse is missing createdUtc"),h(c,"ModAction from AboutLogResponse is missing subreddit"),h(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),h(g,"ModAction from AboutLogResponse is missing action"),h(v,"ModAction from AboutLogResponse is missing srId36");let me=new Date(0);return me.setUTCSeconds(a),{id:i,type:g,moderatorName:n,moderatorId:`t2_${o}`,createdAt:me,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:w?{id:w,author:y,body:C,permalink:A,title:B}:void 0}}),after:r.data.after,before:r.data.before}}var _R=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(_R||{}),NR={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},qR=(y=>(y.Highlighted="Highlighted",y.Unhighlighted="Unhighlighted",y.Archived="Archived",y.Unarchived="Unarchived",y.ReportedToAdmins="ReportedToAdmins",y.Muted="Muted",y.Unmuted="Unmuted",y.Banned="Banned",y.Unbanned="Unbanned",y.Approved="Approved",y.Disapproved="Disapproved",y.Filtered="Filtered",y.Unfiltered="Unfiltered",y))(qR||{}),HR={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},V,J,oe,vS,yS,pd=class{constructor(e){l(this,J);l(this,V);d(this,V,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,V));return n}async getConversations(e){let i=await u.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,V)),n={};for(let o in i.conversations)n[o]=S(this,J,oe).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await u.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,V));return{participantSubreddit:i.participantSubreddit,conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=u.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,V));return t}async createConversation(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await u.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await u.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,V))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,V))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await u.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await u.redditAPIPlugins.NewModmail.TempBan({...e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await u.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,V))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,V))}};V=new WeakMap,J=new WeakSet,oe=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:NR[e.state],messages:S(this,J,vS).call(this,e,t),modActions:S(this,J,yS).call(this,e,i)}},vS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="messages").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]=a)}return i},yS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="modActions").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]={...a,actionType:HR[a.actionTypeId]})}return i};var vn,yn,Yd,xo,Ao,To,Eo,Om=class Om{constructor(e,t){l(this,vn);l(this,yn);l(this,Yd);l(this,xo);l(this,Ao);l(this,To);l(this,Eo);if(X(this),h(e.id,"PrivateMessage: Invalid data, no id"),h(e.name,"PrivateMessage: Invalid data, no name"),h(e.created,"PrivateMessage: Invalid data, no created date"),d(this,vn,ve(e.name)),e.author!=null)d(this,yn,{type:"user",username:e.author,id:e.authorFullname?ne(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,yn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Re(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,xo,e.body??""),d(this,Ao,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,To,i),d(this,Yd,e.parentId?ve(e.parentId):void 0),d(this,Eo,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new W({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new Om(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await u.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,vn)}get from(){return s(this,yn)}get body(){return s(this,xo)}get bodyHtml(){return s(this,Ao)}get created(){return s(this,To)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,vn)},s(this,Eo))}};vn=new WeakMap,yn=new WeakMap,Yd=new WeakMap,xo=new WeakMap,Ao=new WeakMap,To=new WeakMap,Eo=new WeakMap;var hr=Om;var sy=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(sy||{}),bn,x,Ro,Oo,Bo,Mo,Uo,Lo,Do,_o,No,kn,T,lt=class lt{constructor(e,t){l(this,bn);l(this,x);l(this,Ro);l(this,Oo);l(this,Bo);l(this,Mo);l(this,Uo);l(this,Lo);l(this,Do);l(this,_o);l(this,No);l(this,kn);l(this,T);X(this),h(e.id,"Subreddit id is missing or undefined"),h(e.displayName,"Subreddit name is missing or undefined"),d(this,bn,Re(`t5_${e.id}`)),d(this,x,e.displayName),h(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Ro,i),d(this,Oo,jR(e.subredditType)),d(this,Bo,e.title),d(this,Mo,e.description),h(e.lang,"Subreddit is missing language"),d(this,Uo,e.lang),d(this,Lo,e.subscribers??0),d(this,Do,e.activeUserCount??0),d(this,_o,e.over18??!1),d(this,kn,e.url??""),d(this,No,{acceptFollowers:e.acceptFollowers??!1,allOriginalContent:e.allOriginalContent??!1,allowChatPostCreation:e.allowChatPostCreation??!1,allowDiscovery:e.allowDiscovery??!1,allowGalleries:e.allowGalleries??!1,allowImages:e.allowImages??!1,allowPolls:e.allowPolls??!1,allowPredictionContributors:e.allowPredictionContributors??!1,allowPredictions:e.allowPredictions??!1,allowPredictionsTournament:e.allowPredictionsTournament??!1,allowTalks:e.allowTalks??!1,allowVideoGifs:e.allowVideogifs??!1,allowVideos:e.allowVideos??!1,chatPostEnabled:e.isChatPostFeatureEnabled??!1,collectionsEnabled:e.collectionsEnabled??!1,crosspostable:e.isCrosspostableSubreddit??!1,emojisEnabled:e.emojisEnabled??!1,eventPostsEnabled:e.eventPostsEnabled??!1,linkFlairEnabled:e.linkFlairEnabled??!1,originalContentTagEnabled:e.originalContentTagEnabled??!1,restrictCommenting:e.restrictCommenting??!1,restrictPosting:e.restrictPosting??!1,shouldArchivePosts:e.shouldArchivePosts??!1,spoilersEnabled:e.spoilersEnabled??!1,wikiEnabled:e.wikiEnabled??!1,allowedPostType:WR(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(GR),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,kn),"https://www.reddit.com").toString()}),d(this,T,t)}get id(){return s(this,bn)}get name(){return s(this,x)}get createdAt(){return s(this,Ro)}get type(){return s(this,Oo)}get title(){return s(this,Bo)}get description(){return s(this,Mo)}get language(){return s(this,Uo)}get numberOfSubscribers(){return s(this,Lo)}get numberOfActiveUsers(){return s(this,Do)}get nsfw(){return s(this,_o)}get settings(){return s(this,No)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,kn)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,x)};return z.submit(t,s(this,T))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,x)},s(this,T))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,x)},s(this,T))}getApprovedUsers(e={}){return I.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,T))}approveUser(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}removeUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}getWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,T))}addWikiContributor(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}removeWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}getBannedUsers(e={}){return I.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,T))}banUser(e){return I.createRelationship({username:e.username,subredditName:s(this,x),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,T))}unbanUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,T))}getBannedWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,T))}banWikiContributor(e){return I.createRelationship({username:e.username,subredditName:s(this,x),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,T))}unbanWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,T))}getModerators(e={}){return I.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,T))}inviteModerator(e,t){return I.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,T))}revokeModeratorInvite(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,T))}removeModerator(e){return I.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,T))}setModeratorPermissions(e,t){return I.setModeratorPermissions(e,s(this,x),t,s(this,T))}getMutedUsers(e={}){return I.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,T))}muteUser(e,t){return I.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,T))}unmuteUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,T))}getModerationLog(e){return md({subredditName:s(this,x),...e},s(this,T))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,x),s(this,T))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,x),s(this,T))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,T))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,x),...e},s(this,T))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Ue.getUserFlairBySubreddit({subreddit:s(this,x),name:i},s(this,T));return qs(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,T));return{next:t.next,prev:t.prev,users:t.users.map(i=>qs(i))}}}getModQueue(e={type:"all"}){return lt.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,T))}getReports(e={type:"all"}){return lt.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,T))}getSpam(e={type:"all"}){return lt.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,T))}getUnmoderated(e={type:"all"}){return lt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,T))}getEdited(e={type:"all"}){return lt.aboutLocation({...e,location:"edited",subreddit:s(this,x)},s(this,T))}static aboutLocation(e,t){let i=u.redditAPIPlugins.Moderation,n;switch(e.type){case"post":n="links";break;case"comment":n="comments";break;default:n=void 0}return new W({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return bS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new W({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,bn)]},s(this,T));return bS(i,s(this,T))}})}static async addRemovalReason(e,t,i,n){return(await u.redditAPIPlugins.Subreddits.SubredditAddRemovalReason({title:t,message:i,subreddit:e},n)).id}static async getRemovalReasons(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditGetRemovalReasons({subreddit:e},t);return n.order.map(o=>({...n.data[o]}))}static async getFromMetadata(e){h(e);let t=e?.[D.Subreddit]?.values[0];return h(t),lt.getById(Re(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return h(o),lt.getByName(o,t)}static async getByName(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditAbout({subreddit:e},t);if(!n?.data)throw new Error("not found");return new lt(n.data,t)}};bn=new WeakMap,x=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,Uo=new WeakMap,Lo=new WeakMap,Do=new WeakMap,_o=new WeakMap,No=new WeakMap,kn=new WeakMap,T=new WeakMap;var ye=lt;async function oy(r,e){let o=(await kt.query("GetSubredditLeaderboard","18ead70c46b6446d45ecd8b679b16d9a929a933d6ef25d8262a459cb18b72848",{id:r},e)).data?.subredditInfoById?.leaderboard;if(!o)throw new Error("subreddit leaderboard not found");if(!o.summary)throw new Error("subreddit leaderboard summary not found");return{id:o.id,summary:o.summary}}function jR(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function WR(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function GR(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function bS(r,e){let i=(r.data?.children??[]).map(a=>{let c=n(a);if(c!=null)return c;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new z(a.data,e)}catch{return null}}function o(a){try{return new Q(a.data,e)}catch{return null}}}async function ay(r,e){return kS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function dy(r,e){return kS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function kS(r,e,t,i){let o=(await kt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ne(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as VR,GetWidgetsResponse_WidgetItem as ce}from"@devvit/protos";var qo,Ho,jo,Wo,Mm=class Mm{constructor(e,t,i){l(this,qo);l(this,Ho);l(this,jo);l(this,Wo);X(this),d(this,qo,e.id),d(this,Ho,e.shortName),d(this,jo,t),d(this,Wo,i)}get id(){return s(this,qo)}get name(){return s(this,Ho)}get subredditName(){return s(this,jo)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Mm.delete(this.subredditName,this.id,s(this,Wo))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);h(n.layout,"Failed to load widgets for subreddit");let o=n.items,a=[];for(let c of n.layout.sidebar?.order??[]){let p=o[c];switch(p?.kind){case"image":a.push(new Qd(p,e,t));break;case"calendar":a.push(new el(p,e,t));break;case"textarea":a.push(new tl(p,e,t));break;case"button":a.push(new rl(p,e,t));break;case"community-list":a.push(new il(p,e,t));break;case"post-flair":a.push(new nl(p,e,t));break;case"custom":a.push(new sl(p,e,t));break;case"subreddit-rules":{let g=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Bm(g,p,e,t));break}default:throw new Error(`Unknown widget type: ${p.kind}`)}}return a}static async delete(e,t,i){await u.redditAPIPlugins.Widgets.DeleteWidget({subreddit:e,id:t},i)}static async reorder(e,t,i){await u.redditAPIPlugins.Widgets.OrderWidgets({subreddit:e,order:t},i)}static async add(e,t){switch(e?.type){case"image":return Qd.create(e,t);case"calendar":return el.create(e,t);case"textarea":return tl.create(e,t);case"button":return rl.create(e,t);case"community-list":return il.create(e,t);case"post-flair":return nl.create(e,t);case"custom":return sl.create(e,t);default:throw new Error("Unknown widget type")}}};qo=new WeakMap,Ho=new WeakMap,jo=new WeakMap,Wo=new WeakMap;var se=Mm,Go,ol=class ol extends se{constructor(t,i,n){super(t,i,n);l(this,Go);d(this,Go,t.data.map(o=>(h(o.url,"Image widget data is missing url"),h(o.height,"Image widget data is missing height"),h(o.width,"Image widget data is missing width"),h(o.linkUrl,"Image widget data is missing linkUrl"),{url:o.url,height:o.height,width:o.width,linkUrl:o.linkUrl})))}get images(){return s(this,Go)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}};Go=new WeakMap;var Qd=ol,Vo,zo,Jo,al=class al extends se{constructor(t,i,n){super(t,i,n);l(this,Vo);l(this,zo);l(this,Jo);h(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),h(t.configuration,"Calendar widget data is missing configuration"),h(t.styles,"Calendar widget data is missing styles"),d(this,Vo,t.googleCalendarId),d(this,zo,t.configuration),d(this,Jo,t.styles)}get googleCalendarId(){return s(this,Vo)}get configuration(){return s(this,zo)}get styles(){return s(this,Jo)}toJSON(){return{...super.toJSON(),googleCalendarId:this.googleCalendarId,configuration:this.configuration,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}};Vo=new WeakMap,zo=new WeakMap,Jo=new WeakMap;var el=al,$o,Ko,dl=class dl extends se{constructor(t,i,n){super(t,i,n);l(this,$o);l(this,Ko);h(t.text,"Textarea widget data is missing text"),h(t.styles,"Textarea widget data is missing styles"),d(this,$o,t.text),d(this,Ko,t.styles)}get text(){return s(this,$o)}get styles(){return s(this,Ko)}toJSON(){return{...super.toJSON(),text:this.text,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}};$o=new WeakMap,Ko=new WeakMap;var tl=dl,Xo,Zo,Yo,ll=class ll extends se{constructor(t,i,n){super(t,i,n);l(this,Xo);l(this,Zo);l(this,Yo);h(t.styles,"Button widget data is missing styles"),d(this,Xo,t.buttons),d(this,Zo,t.description??""),d(this,Yo,t.styles)}get buttons(){return s(this,Xo)}get description(){return s(this,Zo)}get styles(){return s(this,Yo)}toJSON(){return{...super.toJSON(),buttons:this.buttons,description:this.description,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}};Xo=new WeakMap,Zo=new WeakMap,Yo=new WeakMap;var rl=ll,Qo,ea,ul=class ul extends se{constructor(t,i,n){super(t,i,n);l(this,Qo);l(this,ea);d(this,Qo,t.data.map(o=>VR.fromJSON(o))),h(t.styles,"Community list widget data is missing styles"),d(this,ea,t.styles)}get communities(){return s(this,Qo)}get styles(){return s(this,ea)}toJSON(){return{...super.toJSON(),communities:this.communities,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}};Qo=new WeakMap,ea=new WeakMap;var il=ul,ta,ra,ia,cl=class cl extends se{constructor(t,i,n){super(t,i,n);l(this,ta);l(this,ra);l(this,ia);if(h(t.styles,"Post flair widget data is missing styles"),d(this,ta,t.styles),d(this,ra,t.order.map(o=>t.templates[o])),!(t.display&&t.display==="list"||t.display==="cloud"))throw new Error("Post flair widget data is missing display type");d(this,ia,t.display)}get styles(){return s(this,ta)}get templates(){return s(this,ra)}get display(){return s(this,ia)}toJSON(){return{...super.toJSON(),styles:this.styles,templates:this.templates,display:this.display}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddPostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}};ta=new WeakMap,ra=new WeakMap,ia=new WeakMap;var nl=cl,na,sa,oa,aa,da,ml=class ml extends se{constructor(t,i,n){super(t,i,n);l(this,na);l(this,sa);l(this,oa);l(this,aa);l(this,da);h(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),h(t.height,"Custom widget data is missing height"),h(t.css,"Custom widget data is missing css"),d(this,na,t.imageData??[]),d(this,sa,t.text??""),d(this,oa,t.stylesheetUrl),d(this,aa,t.height),d(this,da,t.css)}get images(){return s(this,na)}get text(){return s(this,sa)}get stylesheetUrl(){return s(this,oa)}get height(){return s(this,aa)}get css(){return s(this,da)}toJSON(){return{...super.toJSON(),images:this.images,text:this.text,stylesheetUrl:this.stylesheetUrl,height:this.height,css:this.css}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}};na=new WeakMap,sa=new WeakMap,oa=new WeakMap,aa=new WeakMap,da=new WeakMap;var sl=ml,la,Bm=class extends se{constructor(t,i,n,o){super(i,n,o);l(this,la);let a=t.rules.map(({description:c,priority:p,shortName:g,violationReason:v})=>(h(c,"Subreddit rule is missing description"),h(p,"Subreddit rule is missing priority"),h(g,"Subreddit rule is missing shortName"),h(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:g,violationReason:v}));d(this,la,a)}get rules(){return s(this,la)}toJSON(){return{...super.toJSON(),rules:this.rules}}};la=new WeakMap;var zR=(i=>(i[i.SUBREDDIT_PERMISSIONS=0]="SUBREDDIT_PERMISSIONS",i[i.APPROVED_CONTRIBUTORS_ONLY=1]="APPROVED_CONTRIBUTORS_ONLY",i[i.MODS_ONLY=2]="MODS_ONLY",i))(zR||{}),Se,Pe,Sn,Pn,Cn,wn,In,Ye,He=class He{constructor(e,t,i,n){l(this,Se);l(this,Pe);l(this,Sn);l(this,Pn);l(this,Cn);l(this,wn);l(this,In);l(this,Ye);X(this),d(this,Se,e),d(this,Pe,t),d(this,Sn,i.contentMd),d(this,Pn,i.revisionId),d(this,Cn,new Date(i.revisionDate)),d(this,wn,i.reason??""),h(i.revisionBy?.data,"Wiki page author details are missing"),d(this,In,new I(i.revisionBy.data,n)),d(this,Ye,n)}get name(){return s(this,Se)}get subredditName(){return s(this,Pe)}get content(){return s(this,Sn)}get revisionId(){return s(this,Pn)}get revisionDate(){return s(this,Cn)}get revisionReason(){return s(this,wn)}get revisionAuthor(){return s(this,In)}toJSON(){return{name:s(this,Se),subredditName:s(this,Pe),content:s(this,Sn),revisionId:s(this,Pn),revisionDate:s(this,Cn),revisionReason:s(this,wn),revisionAuthor:s(this,In).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Pe),page:s(this,Se),content:e,reason:t},s(this,Ye))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Pe),page:s(this,Se),...e},s(this,Ye))}async revertTo(e){return He.revertPage(s(this,Pe),s(this,Se),e,s(this,Ye))}async getSettings(){return He.getPageSettings(s(this,Pe),s(this,Se),s(this,Ye))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Pe),page:s(this,Se),listed:e.listed,permLevel:e.permLevel},s(this,Ye))}async addEditor(e){return He.addEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}async removeEditor(e){return He.removeEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return h(o.data,"Failed to get wiki page"),new He(t,e,o.data,i)}static async getPages(e,t){return(await u.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return He.updatePage(e,t)}static async updatePage(e,t){return await u.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),He.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new W({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return JR(o,t)}})}static async revertPage(e,t,i,n){await u.redditAPIPlugins.Wiki.RevertWikiPage({subreddit:e,page:t,revision:i},n)}static async getPageSettings(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPageSettings({subreddit:e,page:t},i);return h(o.data,"Failed to get wiki page settings"),new pl(o.data,i)}static async updatePageSettings(e,t){let n=await u.redditAPIPlugins.Wiki.UpdateWikiPageSettings({subreddit:e.subredditName,page:e.page,listed:e.listed?"on":"",permlevel:e.permLevel},t);return h(n.data,"Failed to update wiki page settings"),new pl(n.data,t)}static async addEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};Se=new WeakMap,Pe=new WeakMap,Sn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,In=new WeakMap,Ye=new WeakMap;var be=He,Fn,xn,An,Tn,En,Rn,Um=class{constructor(e,t){l(this,Fn);l(this,xn);l(this,An);l(this,Tn);l(this,En);l(this,Rn);d(this,Fn,e.id),d(this,xn,e.page),d(this,An,new Date(e.timestamp)),h(e.author?.data,"Wiki page revision author details are missing"),d(this,Tn,new I(e.author.data,t)),d(this,En,e.reason??""),d(this,Rn,e.revisionHidden??!1)}get id(){return s(this,Fn)}get page(){return s(this,xn)}get date(){return s(this,An)}get author(){return s(this,Tn)}get reason(){return s(this,En)}get hidden(){return s(this,Rn)}toJSON(){return{id:s(this,Fn),page:s(this,xn),date:s(this,An),author:s(this,Tn).toJSON(),reason:s(this,En),hidden:s(this,Rn)}}};Fn=new WeakMap,xn=new WeakMap,An=new WeakMap,Tn=new WeakMap,En=new WeakMap,Rn=new WeakMap;var On,Bn,Mn,pl=class{constructor(e,t){l(this,On);l(this,Bn);l(this,Mn);d(this,On,e.listed),d(this,Bn,e.permLevel),d(this,Mn,e.editors.map(i=>(h(i.data,"Wiki page editor details are missing"),new I(i.data,t))))}get listed(){return s(this,On)}get permLevel(){return s(this,Bn)}get editors(){return s(this,Mn)}toJSON(){return{listed:s(this,On),permLevel:s(this,Bn),editors:s(this,Mn).map(e=>e.toJSON())}}};On=new WeakMap,Bn=new WeakMap,Mn=new WeakMap;function JR(r,e){return h(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Um(i,e)),before:r.data.before,after:r.data.after}}var $R=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))($R||{});function KR(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var je,Ce,ca,Un,Ln,ma,pa,ga,ha,wt,fa,va,Dn,ua=class ua{constructor(e,t){l(this,je);l(this,Ce);l(this,ca);l(this,Un);l(this,Ln);l(this,ma);l(this,pa);l(this,ga);l(this,ha);l(this,wt);l(this,fa);l(this,va);l(this,Dn);h(e.collectionId,"Collection Id is missing or undefined"),h(e.subredditId,"Subreddit Id is missing or undefined"),h(e.title,"Collection title is missing or undefined"),h(e.authorId,"Collection author's id is missing or undefined"),h(e.authorName,"Collection author's id is missing or undefined"),h(e.createdAtUtc,"Collection create timestamp is missing"),h(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,je,t),d(this,Ce,e.collectionId),d(this,ca,e.subredditId),d(this,Un,e.title),d(this,Ln,e.description||""),d(this,ma,e.authorId),d(this,pa,e.authorName),d(this,ga,e.permalink),d(this,ha,e.primaryLinkId),d(this,wt,e.linkIds||[]),d(this,Dn,KR(e.displayLayout)),d(this,fa,e.createdAtUtc),d(this,va,e.lastUpdateUtc),X(this)}get id(){return s(this,Ce)}get subredditId(){return s(this,ca)}get title(){return s(this,Un)}get description(){return s(this,Ln)}get authorId(){return s(this,ma)}get authorName(){return s(this,pa)}get permalink(){return s(this,ga)}get primaryLinkId(){return s(this,ha)}get linkIds(){return s(this,wt)}get createdAtUtc(){return s(this,fa)}get lastUpdateUtc(){return s(this,va)}get displayLayout(){return s(this,Dn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ua(n,t)}static async create(e,t){let n=await u.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ua(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ua(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),s(this,wt).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),d(this,wt,s(this,wt).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Ce)},s(this,je))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Ce),follow:e},s(this,je))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Ce),linkIds:e.join(",")},s(this,je)),d(this,wt,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Ce),title:e},s(this,je)),d(this,Un,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Ce),description:e},s(this,je)),d(this,Ln,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Ce),displayLayout:e},s(this,je)),d(this,Dn,e)}};je=new WeakMap,Ce=new WeakMap,ca=new WeakMap,Un=new WeakMap,Ln=new WeakMap,ma=new WeakMap,pa=new WeakMap,ga=new WeakMap,ha=new WeakMap,wt=new WeakMap,fa=new WeakMap,va=new WeakMap,Dn=new WeakMap;var gi=ua;var XR=["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"],ZR=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],YR=["onload","onerror","onclick","onmouseover"];function QR(r){return/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/.test(r)?r:r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"')}function SS(r){if(r){if(!r.trim().startsWith("<svg")){console.log("The provided string is not a valid SVG.");return}try{let e=new RegExp(`<\\s*(${XR.join("|")})\\b`,"gi"),t=new RegExp(`(${ZR.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${YR.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=QR(r);let n=r.match(e)||[],o=r.match(t)||[],a=r.match(i)||[],c=!1;return n.length>0&&(c=!0,console.warn(`Disallowed elements detected in SVG: ${n.map(p=>p.replace("<","")).join(", ")}`)),o.length>0&&(c=!0,console.warn(`Disallowed styles detected in SVG: ${o.map(p=>p.split(":")[0]).join(", ")}`)),a.length>0&&(c=!0,console.warn(`Disallowed attributes detected in SVG: ${a.map(p=>p.split("=")[0]).join(", ")}`)),c?void 0:r}catch{return}}}function Xq(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=SS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{kM as ALL_ICON_NAMES,sy as AboutLocations,rl as ButtonWidget,el as CalendarWidget,$R as CollectionDisplayLayout,Q as Comment,il as CommunityListWidget,sl as CustomWidget,u as Devvit,Ue as Flair,de as FlairTemplate,PR as FlairType,Tt as Hook,Qd as ImageWidget,W as Listing,qR as ModMailActionType,_R as ModMailConversationState,pd as ModMailService,Me as ModNote,z as Post,gi as PostCollection,nl as PostFlairWidget,hr as PrivateMessage,_s as RichTextBuilder,pc as SettingScope,MR as SocialLinkType,ye as Subreddit,Bm as SubredditRulesWidget,tl as TextAreaWidget,I as User,se as Widget,be as WikiPage,zR as WikiPagePermissionLevel,Um as WikiPageRevision,pl as WikiPageSettings,qs as convertUserFlairProtoToAPI,md as getModerationLog,oy as getSubredditLeaderboard,ay as getVaultByAddress,dy as getVaultByUserId,Xq as svg,oR as useAsync,sm as useChannel,tm as useForm,dm as useInterval,gm as useState};
5
+ `))}static async getSnoovatarUrl(e,t){return(await kt.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new W({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:"overview",...n},t);return HR(o,t)}})}};so=new WeakMap,mn=new WeakMap,oo=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=new WeakMap,co=new WeakMap,tr=new WeakMap,mo=new WeakMap,po=new WeakMap,at=new WeakMap;var I=_r;function HR(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new z(i.data,e);if(i.kind==="t1")return new Q(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function jR(r,e,t){let i=u.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(v=>(h(v.data?.id,"User id is still from listing data"),v.data.id)),o=100,a=[];for(let v=0;v<n.length;v+=o)a.push(n.slice(v,v+o));let p=(await Promise.all(a.map(v=>i.UserDataByAccountIds({ids:v.join(",")},t)))).reduce((v,m)=>({...v,...m.users}),{});return{children:r.data.children.map(v=>{let m=v.data?.id;h(m,"User id is missing from listing");let b=p[m];return h(b,"User data is missing from response"),new I({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:v.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var qr,go,pn,gn,ho,fo,hn,vo,yo,fn,rr,bo,ko,Hr,ir,nr,Pt,jr,Ct,So,Po,Co,wo,Io,Fo,xo,te,dt,Xd,Zd,G=class G{constructor(e,t){l(this,qr);l(this,go);l(this,pn);l(this,gn);l(this,ho);l(this,fo);l(this,hn);l(this,vo);l(this,yo);l(this,fn);l(this,rr);l(this,bo);l(this,ko);l(this,Hr);l(this,ir);l(this,nr);l(this,Pt);l(this,jr);l(this,Ct);l(this,So);l(this,Po);l(this,Co);l(this,wo);l(this,Io);l(this,Fo);l(this,xo);l(this,te);var n;X(this),h(e.id,"Comment id is null or undefined"),h(e.body,"Comment body is null or undefined"),h(e.createdUtc,"Comment is missing created date"),h(e.author,"Comment author is null or undefined"),h(e.parentId,"Comment parentId is null or undefined"),h(e.linkId,"Comment linkId is null or undefined"),h(e.permalink,"Comment permalink is null or undefined"),h(e.subreddit,"Comment is missing subreddit name"),h(e.subredditId,"Comment is missing subreddit id"),d(this,qr,ii(`t1_${e.id}`)),d(this,go,e.authorFullname?ne(e.authorFullname):void 0),d(this,pn,e.author),d(this,gn,e.body),d(this,vo,Re(e.subredditId)),d(this,yo,e.subreddit),d(this,fo,mc(e.parentId)?ii(e.parentId):fe(e.parentId)),d(this,hn,fe(e.linkId)),d(this,Hr,e.edited??!1),d(this,ir,e.locked??!1),d(this,nr,e.removed??!1),d(this,Pt,e.stickied??!1),d(this,rr,e.approved??!1),d(this,bo,e.approvedAtUtc??0),d(this,ko,e.bannedAtUtc??0),d(this,jr,e.spam??!1),d(this,Ct,e.distinguished),d(this,So,e.numReports??0),d(this,Po,e.collapsedBecauseCrowdControl??!1),d(this,Co,e.score??0),d(this,wo,e.permalink),d(this,xo,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,Io,(e.modReports??[]).map(([o])=>o)),d(this,Fo,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,ho,i),d(this,fn,S(n=G,dt,Xd).call(n,{postId:s(this,hn),commentId:s(this,qr)},t)),d(this,te,t)}get id(){return s(this,qr)}get authorId(){return s(this,go)}get authorName(){return s(this,pn)}get subredditId(){return s(this,vo)}get subredditName(){return s(this,yo)}get body(){return s(this,gn)}get createdAt(){return s(this,ho)}get parentId(){return s(this,fo)}get postId(){return s(this,hn)}get replies(){return s(this,fn)}get distinguishedBy(){return s(this,Ct)}get locked(){return s(this,ir)}get stickied(){return s(this,Pt)}get removed(){return s(this,nr)}get approved(){return s(this,rr)}get approvedAtUtc(){return s(this,bo)}get bannedAtUtc(){return s(this,ko)}get spam(){return s(this,jr)}get edited(){return s(this,Hr)}get numReports(){return s(this,So)}get collapsedBecauseCrowdControl(){return s(this,Po)}get score(){return s(this,Co)}get permalink(){return s(this,wo)}get userReportReasons(){return s(this,Fo)}get modReportReasons(){return s(this,Io)}get url(){return s(this,xo)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,ir)}isApproved(){return s(this,rr)}isRemoved(){return s(this,nr)}isSpam(){return s(this,jr)}isStickied(){return s(this,Pt)}isDistinguished(){return!!s(this,Ct)}isEdited(){return s(this,Hr)}async delete(){return G.delete(this.id,s(this,te))}async edit(e){let t=await G.edit({id:this.id,...e},s(this,te));return d(this,gn,t.body),d(this,Hr,t.edited),this}async approve(){await G.approve(this.id,s(this,te)),d(this,rr,!0),d(this,nr,!1)}async remove(e=!1){await G.remove(this.id,e,s(this,te)),d(this,nr,!0),d(this,jr,e),d(this,rr,!1)}async lock(){await G.lock(this.id,s(this,te)),d(this,ir,!0)}async unlock(){await G.unlock(this.id,s(this,te)),d(this,ir,!1)}async reply(e){return G.submit({id:this.id,...e},s(this,te))}async getAuthor(){return I.getByUsername(s(this,pn),s(this,te))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!1,s(this,te));d(this,Ct,t),d(this,Pt,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!0,s(this,te));d(this,Ct,t),d(this,Pt,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await G.undistinguish(this.id,s(this,te));d(this,Ct,e),d(this,Pt,t)}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,qr)],...e},s(this,te))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=At(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new G(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=G,dt,Xd).call(a,{postId:fe(i),commentId:n?ii(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let c=a.json?.data?.things?.[0]?.data;return h(c),new G(c,t)}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 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 submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let c=a.json?.data?.things?.[0]?.data;return h(c),new G(c,t)}static async distinguish(e,t,i,n){let c=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return h(c),{distinguishedBy:c.distinguished,stickied:!!c.stickied}}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 h(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({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:"comments",...n},t);return h(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new G(c.data,t))||[],before:o.data.before,after:o.data.after}}})}};qr=new WeakMap,go=new WeakMap,pn=new WeakMap,gn=new WeakMap,ho=new WeakMap,fo=new WeakMap,hn=new WeakMap,vo=new WeakMap,yo=new WeakMap,fn=new WeakMap,rr=new WeakMap,bo=new WeakMap,ko=new WeakMap,Hr=new WeakMap,ir=new WeakMap,nr=new WeakMap,Pt=new WeakMap,jr=new WeakMap,Ct=new WeakMap,So=new WeakMap,Po=new WeakMap,Co=new WeakMap,wo=new WeakMap,Io=new WeakMap,Fo=new WeakMap,xo=new WeakMap,te=new WeakMap,dt=new WeakSet,Xd=function(e,t,i=0){return new W({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,y;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let C=n.more;(!o||o>100)&&(o=100);let w=C.children.splice(0,o),A=await c.MoreChildren({linkId:e.postId,children:w,sort:e.sort},t);if(!A.json?.data?.things?.length)return{children:[]};let{children:B}=S(b=G,dt,Zd).call(b,A.json.data.things,e.postId,e,t);return{children:B,more:C.children.length?C:void 0}}else p=n.more.parentId,i=i+n.more.depth;let v=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],m=v[0];return p&&m?.data?.replyList?.data&&(v=m.data.replyList.data.children),S(y=G,dt,Zd).call(y,v,p??e.postId,e,t,i)}})},Zd=function(e,t,i,n,o=0){var g,v;let a=[],c,p={};for(let m of e){if(!m.data||(m.data.depth!=null&&(m.data.depth=m.data.depth+o),m.data.depth!=null&&i.depth!=null&&m.data.depth>=i.depth))continue;let b=m.data.parentId?p[m.data.parentId]:void 0;if(m.kind==="t1"){if(m.data.name===t)continue;let y=new G(m.data,n);if(p[y.id]=y,d(y,fn,S(g=G,dt,Xd).call(g,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:w}=S(v=G,dt,Zd).call(v,m.data.replyList.data.children,y.id,i,n,o);C.length&&y.replies.children.push(...C),w&&y.replies.setMore(w)}y.replies.preventInitialFetch(),b?b.replies.children.push(y):a.push(y)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let y={parentId:mc(m.data.parentId)?ii(m.data.parentId):fe(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(y):y.parentId===t&&(c=y)}}return{children:a,more:c}},l(G,dt);var Q=G;function pd(r,e){let t=u.redditAPIPlugins.Moderation;return new W({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return WR(n)}})}function WR(r){if(!r.data?.children)throw new Error("AboutLogResponse is missing children");return{children:r.data.children.map(t=>{if(!t.data)throw new Error("ModAction from AboutLogResponse is missing or invalid");let{id:i,mod:n,modId36:o,createdUtc:a,subreddit:c,subredditNamePrefixed:p,action:g,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:w,targetPermalink:A,targetTitle:B}=t.data;h(i,"ModAction from AboutLogResponse is missing id"),h(n,"ModAction from AboutLogResponse is missing mod"),h(o,"ModAction from AboutLogResponse is missing modId36"),h(a,"ModAction from AboutLogResponse is missing createdUtc"),h(c,"ModAction from AboutLogResponse is missing subreddit"),h(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),h(g,"ModAction from AboutLogResponse is missing action"),h(v,"ModAction from AboutLogResponse is missing srId36");let me=new Date(0);return me.setUTCSeconds(a),{id:i,type:g,moderatorName:n,moderatorId:`t2_${o}`,createdAt:me,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:w?{id:w,author:y,body:C,permalink:A,title:B}:void 0}}),after:r.data.after,before:r.data.before}}var GR=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(GR||{}),VR={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},zR=(y=>(y.Highlighted="Highlighted",y.Unhighlighted="Unhighlighted",y.Archived="Archived",y.Unarchived="Unarchived",y.ReportedToAdmins="ReportedToAdmins",y.Muted="Muted",y.Unmuted="Unmuted",y.Banned="Banned",y.Unbanned="Unbanned",y.Approved="Approved",y.Disapproved="Disapproved",y.Filtered="Filtered",y.Unfiltered="Unfiltered",y))(zR||{}),JR={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},V,J,oe,PS,CS,gd=class{constructor(e){l(this,J);l(this,V);d(this,V,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,V));return n}async getConversations(e){let i=await u.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,V)),n={};for(let o in i.conversations)n[o]=S(this,J,oe).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await u.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,V));return{participantSubreddit:i.participantSubreddit,conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=u.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,V));return t}async createConversation(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await u.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await u.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,V))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,V))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await u.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await u.redditAPIPlugins.NewModmail.TempBan({...e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await u.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,V))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,V))}};V=new WeakMap,J=new WeakSet,oe=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:VR[e.state],messages:S(this,J,PS).call(this,e,t),modActions:S(this,J,CS).call(this,e,i)}},PS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="messages").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]=a)}return i},CS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="modActions").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]={...a,actionType:JR[a.actionTypeId]})}return i};var vn,yn,Yd,Ao,To,Eo,Ro,Om=class Om{constructor(e,t){l(this,vn);l(this,yn);l(this,Yd);l(this,Ao);l(this,To);l(this,Eo);l(this,Ro);if(X(this),h(e.id,"PrivateMessage: Invalid data, no id"),h(e.name,"PrivateMessage: Invalid data, no name"),h(e.created,"PrivateMessage: Invalid data, no created date"),d(this,vn,ve(e.name)),e.author!=null)d(this,yn,{type:"user",username:e.author,id:e.authorFullname?ne(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,yn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Re(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,Ao,e.body??""),d(this,To,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Eo,i),d(this,Yd,e.parentId?ve(e.parentId):void 0),d(this,Ro,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new W({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new Om(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await u.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,vn)}get from(){return s(this,yn)}get body(){return s(this,Ao)}get bodyHtml(){return s(this,To)}get created(){return s(this,Eo)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,vn)},s(this,Ro))}};vn=new WeakMap,yn=new WeakMap,Yd=new WeakMap,Ao=new WeakMap,To=new WeakMap,Eo=new WeakMap,Ro=new WeakMap;var hr=Om;var sy=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(sy||{}),bn,x,Oo,Bo,Mo,Uo,Lo,Do,No,_o,qo,kn,T,lt=class lt{constructor(e,t){l(this,bn);l(this,x);l(this,Oo);l(this,Bo);l(this,Mo);l(this,Uo);l(this,Lo);l(this,Do);l(this,No);l(this,_o);l(this,qo);l(this,kn);l(this,T);X(this),h(e.id,"Subreddit id is missing or undefined"),h(e.displayName,"Subreddit name is missing or undefined"),d(this,bn,Re(`t5_${e.id}`)),d(this,x,e.displayName),h(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Oo,i),d(this,Bo,$R(e.subredditType)),d(this,Mo,e.title),d(this,Uo,e.description),h(e.lang,"Subreddit is missing language"),d(this,Lo,e.lang),d(this,Do,e.subscribers??0),d(this,No,e.activeUserCount??0),d(this,_o,e.over18??!1),d(this,kn,e.url??""),d(this,qo,{acceptFollowers:e.acceptFollowers??!1,allOriginalContent:e.allOriginalContent??!1,allowChatPostCreation:e.allowChatPostCreation??!1,allowDiscovery:e.allowDiscovery??!1,allowGalleries:e.allowGalleries??!1,allowImages:e.allowImages??!1,allowPolls:e.allowPolls??!1,allowPredictionContributors:e.allowPredictionContributors??!1,allowPredictions:e.allowPredictions??!1,allowPredictionsTournament:e.allowPredictionsTournament??!1,allowTalks:e.allowTalks??!1,allowVideoGifs:e.allowVideogifs??!1,allowVideos:e.allowVideos??!1,chatPostEnabled:e.isChatPostFeatureEnabled??!1,collectionsEnabled:e.collectionsEnabled??!1,crosspostable:e.isCrosspostableSubreddit??!1,emojisEnabled:e.emojisEnabled??!1,eventPostsEnabled:e.eventPostsEnabled??!1,linkFlairEnabled:e.linkFlairEnabled??!1,originalContentTagEnabled:e.originalContentTagEnabled??!1,restrictCommenting:e.restrictCommenting??!1,restrictPosting:e.restrictPosting??!1,shouldArchivePosts:e.shouldArchivePosts??!1,spoilersEnabled:e.spoilersEnabled??!1,wikiEnabled:e.wikiEnabled??!1,allowedPostType:KR(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(XR),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,kn),"https://www.reddit.com").toString()}),d(this,T,t)}get id(){return s(this,bn)}get name(){return s(this,x)}get createdAt(){return s(this,Oo)}get type(){return s(this,Bo)}get title(){return s(this,Mo)}get description(){return s(this,Uo)}get language(){return s(this,Lo)}get numberOfSubscribers(){return s(this,Do)}get numberOfActiveUsers(){return s(this,No)}get nsfw(){return s(this,_o)}get settings(){return s(this,qo)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,kn)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,x)};return z.submit(t,s(this,T))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,x)},s(this,T))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,x)},s(this,T))}getApprovedUsers(e={}){return I.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,T))}approveUser(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}removeUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,T))}getWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,T))}addWikiContributor(e){return I.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}removeWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,T))}getBannedUsers(e={}){return I.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,T))}banUser(e){return I.createRelationship({username:e.username,subredditName:s(this,x),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,T))}unbanUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,T))}getBannedWikiContributors(e={}){return I.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,T))}banWikiContributor(e){return I.createRelationship({username:e.username,subredditName:s(this,x),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,T))}unbanWikiContributor(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,T))}getModerators(e={}){return I.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,T))}inviteModerator(e,t){return I.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,T))}revokeModeratorInvite(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,T))}removeModerator(e){return I.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,T))}setModeratorPermissions(e,t){return I.setModeratorPermissions(e,s(this,x),t,s(this,T))}getMutedUsers(e={}){return I.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,T))}muteUser(e,t){return I.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,T))}unmuteUser(e){return I.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,T))}getModerationLog(e){return pd({subredditName:s(this,x),...e},s(this,T))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,x),s(this,T))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,x),s(this,T))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,T))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,x),...e},s(this,T))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Ue.getUserFlairBySubreddit({subreddit:s(this,x),name:i},s(this,T));return Hs(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,T));return{next:t.next,prev:t.prev,users:t.users.map(i=>Hs(i))}}}getModQueue(e={type:"all"}){return lt.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,T))}getReports(e={type:"all"}){return lt.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,T))}getSpam(e={type:"all"}){return lt.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,T))}getUnmoderated(e={type:"all"}){return lt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,T))}getEdited(e={type:"all"}){return lt.aboutLocation({...e,location:"edited",subreddit:s(this,x)},s(this,T))}static aboutLocation(e,t){let i=u.redditAPIPlugins.Moderation,n;switch(e.type){case"post":n="links";break;case"comment":n="comments";break;default:n=void 0}return new W({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return wS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new W({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,bn)]},s(this,T));return wS(i,s(this,T))}})}static async addRemovalReason(e,t,i,n){return(await u.redditAPIPlugins.Subreddits.SubredditAddRemovalReason({title:t,message:i,subreddit:e},n)).id}static async getRemovalReasons(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditGetRemovalReasons({subreddit:e},t);return n.order.map(o=>({...n.data[o]}))}static async getFromMetadata(e){h(e);let t=e?.[D.Subreddit]?.values[0];return h(t),lt.getById(Re(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return h(o),lt.getByName(o,t)}static async getByName(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditAbout({subreddit:e},t);if(!n?.data)throw new Error("not found");return new lt(n.data,t)}};bn=new WeakMap,x=new WeakMap,Oo=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,Uo=new WeakMap,Lo=new WeakMap,Do=new WeakMap,No=new WeakMap,_o=new WeakMap,qo=new WeakMap,kn=new WeakMap,T=new WeakMap;var ye=lt;async function oy(r,e){let o=(await kt.query("GetSubredditLeaderboard","18ead70c46b6446d45ecd8b679b16d9a929a933d6ef25d8262a459cb18b72848",{id:r},e)).data?.subredditInfoById?.leaderboard;if(!o)throw new Error("subreddit leaderboard not found");if(!o.summary)throw new Error("subreddit leaderboard summary not found");return{id:o.id,summary:o.summary}}function $R(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function KR(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function XR(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function wS(r,e){let i=(r.data?.children??[]).map(a=>{let c=n(a);if(c!=null)return c;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new z(a.data,e)}catch{return null}}function o(a){try{return new Q(a.data,e)}catch{return null}}}async function ay(r,e){return IS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function dy(r,e){return IS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function IS(r,e,t,i){let o=(await kt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ne(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as ZR,GetWidgetsResponse_WidgetItem as ce}from"@devvit/protos";var Ho,jo,Wo,Go,Mm=class Mm{constructor(e,t,i){l(this,Ho);l(this,jo);l(this,Wo);l(this,Go);X(this),d(this,Ho,e.id),d(this,jo,e.shortName),d(this,Wo,t),d(this,Go,i)}get id(){return s(this,Ho)}get name(){return s(this,jo)}get subredditName(){return s(this,Wo)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Mm.delete(this.subredditName,this.id,s(this,Go))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);h(n.layout,"Failed to load widgets for subreddit");let o=n.items,a=[];for(let c of n.layout.sidebar?.order??[]){let p=o[c];switch(p?.kind){case"image":a.push(new Qd(p,e,t));break;case"calendar":a.push(new el(p,e,t));break;case"textarea":a.push(new tl(p,e,t));break;case"button":a.push(new rl(p,e,t));break;case"community-list":a.push(new il(p,e,t));break;case"post-flair":a.push(new nl(p,e,t));break;case"custom":a.push(new sl(p,e,t));break;case"subreddit-rules":{let g=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Bm(g,p,e,t));break}default:throw new Error(`Unknown widget type: ${p.kind}`)}}return a}static async delete(e,t,i){await u.redditAPIPlugins.Widgets.DeleteWidget({subreddit:e,id:t},i)}static async reorder(e,t,i){await u.redditAPIPlugins.Widgets.OrderWidgets({subreddit:e,order:t},i)}static async add(e,t){switch(e?.type){case"image":return Qd.create(e,t);case"calendar":return el.create(e,t);case"textarea":return tl.create(e,t);case"button":return rl.create(e,t);case"community-list":return il.create(e,t);case"post-flair":return nl.create(e,t);case"custom":return sl.create(e,t);default:throw new Error("Unknown widget type")}}};Ho=new WeakMap,jo=new WeakMap,Wo=new WeakMap,Go=new WeakMap;var se=Mm,Vo,ol=class ol extends se{constructor(t,i,n){super(t,i,n);l(this,Vo);d(this,Vo,t.data.map(o=>(h(o.url,"Image widget data is missing url"),h(o.height,"Image widget data is missing height"),h(o.width,"Image widget data is missing width"),h(o.linkUrl,"Image widget data is missing linkUrl"),{url:o.url,height:o.height,width:o.width,linkUrl:o.linkUrl})))}get images(){return s(this,Vo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new ol(ce.fromJSON(o),t.subreddit,i)}};Vo=new WeakMap;var Qd=ol,zo,Jo,$o,al=class al extends se{constructor(t,i,n){super(t,i,n);l(this,zo);l(this,Jo);l(this,$o);h(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),h(t.configuration,"Calendar widget data is missing configuration"),h(t.styles,"Calendar widget data is missing styles"),d(this,zo,t.googleCalendarId),d(this,Jo,t.configuration),d(this,$o,t.styles)}get googleCalendarId(){return s(this,zo)}get configuration(){return s(this,Jo)}get styles(){return s(this,$o)}toJSON(){return{...super.toJSON(),googleCalendarId:this.googleCalendarId,configuration:this.configuration,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new al(ce.fromJSON(o),t.subreddit,i)}};zo=new WeakMap,Jo=new WeakMap,$o=new WeakMap;var el=al,Ko,Xo,dl=class dl extends se{constructor(t,i,n){super(t,i,n);l(this,Ko);l(this,Xo);h(t.text,"Textarea widget data is missing text"),h(t.styles,"Textarea widget data is missing styles"),d(this,Ko,t.text),d(this,Xo,t.styles)}get text(){return s(this,Ko)}get styles(){return s(this,Xo)}toJSON(){return{...super.toJSON(),text:this.text,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new dl(ce.fromJSON(o),t.subreddit,i)}};Ko=new WeakMap,Xo=new WeakMap;var tl=dl,Zo,Yo,Qo,ll=class ll extends se{constructor(t,i,n){super(t,i,n);l(this,Zo);l(this,Yo);l(this,Qo);h(t.styles,"Button widget data is missing styles"),d(this,Zo,t.buttons),d(this,Yo,t.description??""),d(this,Qo,t.styles)}get buttons(){return s(this,Zo)}get description(){return s(this,Yo)}get styles(){return s(this,Qo)}toJSON(){return{...super.toJSON(),buttons:this.buttons,description:this.description,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new ll(ce.fromJSON(o),t.subreddit,i)}};Zo=new WeakMap,Yo=new WeakMap,Qo=new WeakMap;var rl=ll,ea,ta,ul=class ul extends se{constructor(t,i,n){super(t,i,n);l(this,ea);l(this,ta);d(this,ea,t.data.map(o=>ZR.fromJSON(o))),h(t.styles,"Community list widget data is missing styles"),d(this,ta,t.styles)}get communities(){return s(this,ea)}get styles(){return s(this,ta)}toJSON(){return{...super.toJSON(),communities:this.communities,styles:this.styles}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new ul(ce.fromJSON(o),t.subreddit,i)}};ea=new WeakMap,ta=new WeakMap;var il=ul,ra,ia,na,cl=class cl extends se{constructor(t,i,n){super(t,i,n);l(this,ra);l(this,ia);l(this,na);if(h(t.styles,"Post flair widget data is missing styles"),d(this,ra,t.styles),d(this,ia,t.order.map(o=>t.templates[o])),!(t.display&&t.display==="list"||t.display==="cloud"))throw new Error("Post flair widget data is missing display type");d(this,na,t.display)}get styles(){return s(this,ra)}get templates(){return s(this,ia)}get display(){return s(this,na)}toJSON(){return{...super.toJSON(),styles:this.styles,templates:this.templates,display:this.display}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddPostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new cl(ce.fromJSON(o),t.subreddit,i)}};ra=new WeakMap,ia=new WeakMap,na=new WeakMap;var nl=cl,sa,oa,aa,da,la,ml=class ml extends se{constructor(t,i,n){super(t,i,n);l(this,sa);l(this,oa);l(this,aa);l(this,da);l(this,la);h(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),h(t.height,"Custom widget data is missing height"),h(t.css,"Custom widget data is missing css"),d(this,sa,t.imageData??[]),d(this,oa,t.text??""),d(this,aa,t.stylesheetUrl),d(this,da,t.height),d(this,la,t.css)}get images(){return s(this,sa)}get text(){return s(this,oa)}get stylesheetUrl(){return s(this,aa)}get height(){return s(this,da)}get css(){return s(this,la)}toJSON(){return{...super.toJSON(),images:this.images,text:this.text,stylesheetUrl:this.stylesheetUrl,height:this.height,css:this.css}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new ml(ce.fromJSON(o),t.subreddit,i)}};sa=new WeakMap,oa=new WeakMap,aa=new WeakMap,da=new WeakMap,la=new WeakMap;var sl=ml,ua,Bm=class extends se{constructor(t,i,n,o){super(i,n,o);l(this,ua);let a=t.rules.map(({description:c,priority:p,shortName:g,violationReason:v})=>(h(c,"Subreddit rule is missing description"),h(p,"Subreddit rule is missing priority"),h(g,"Subreddit rule is missing shortName"),h(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:g,violationReason:v}));d(this,ua,a)}get rules(){return s(this,ua)}toJSON(){return{...super.toJSON(),rules:this.rules}}};ua=new WeakMap;var YR=(i=>(i[i.SUBREDDIT_PERMISSIONS=0]="SUBREDDIT_PERMISSIONS",i[i.APPROVED_CONTRIBUTORS_ONLY=1]="APPROVED_CONTRIBUTORS_ONLY",i[i.MODS_ONLY=2]="MODS_ONLY",i))(YR||{}),Se,Pe,Sn,Pn,Cn,wn,In,Ye,He=class He{constructor(e,t,i,n){l(this,Se);l(this,Pe);l(this,Sn);l(this,Pn);l(this,Cn);l(this,wn);l(this,In);l(this,Ye);X(this),d(this,Se,e),d(this,Pe,t),d(this,Sn,i.contentMd),d(this,Pn,i.revisionId),d(this,Cn,new Date(i.revisionDate)),d(this,wn,i.reason??""),h(i.revisionBy?.data,"Wiki page author details are missing"),d(this,In,new I(i.revisionBy.data,n)),d(this,Ye,n)}get name(){return s(this,Se)}get subredditName(){return s(this,Pe)}get content(){return s(this,Sn)}get revisionId(){return s(this,Pn)}get revisionDate(){return s(this,Cn)}get revisionReason(){return s(this,wn)}get revisionAuthor(){return s(this,In)}toJSON(){return{name:s(this,Se),subredditName:s(this,Pe),content:s(this,Sn),revisionId:s(this,Pn),revisionDate:s(this,Cn),revisionReason:s(this,wn),revisionAuthor:s(this,In).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Pe),page:s(this,Se),content:e,reason:t},s(this,Ye))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Pe),page:s(this,Se),...e},s(this,Ye))}async revertTo(e){return He.revertPage(s(this,Pe),s(this,Se),e,s(this,Ye))}async getSettings(){return He.getPageSettings(s(this,Pe),s(this,Se),s(this,Ye))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Pe),page:s(this,Se),listed:e.listed,permLevel:e.permLevel},s(this,Ye))}async addEditor(e){return He.addEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}async removeEditor(e){return He.removeEditor(s(this,Pe),s(this,Se),e,s(this,Ye))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return h(o.data,"Failed to get wiki page"),new He(t,e,o.data,i)}static async getPages(e,t){return(await u.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return He.updatePage(e,t)}static async updatePage(e,t){return await u.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),He.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new W({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return QR(o,t)}})}static async revertPage(e,t,i,n){await u.redditAPIPlugins.Wiki.RevertWikiPage({subreddit:e,page:t,revision:i},n)}static async getPageSettings(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPageSettings({subreddit:e,page:t},i);return h(o.data,"Failed to get wiki page settings"),new pl(o.data,i)}static async updatePageSettings(e,t){let n=await u.redditAPIPlugins.Wiki.UpdateWikiPageSettings({subreddit:e.subredditName,page:e.page,listed:e.listed?"on":"",permlevel:e.permLevel},t);return h(n.data,"Failed to update wiki page settings"),new pl(n.data,t)}static async addEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};Se=new WeakMap,Pe=new WeakMap,Sn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,In=new WeakMap,Ye=new WeakMap;var be=He,Fn,xn,An,Tn,En,Rn,Um=class{constructor(e,t){l(this,Fn);l(this,xn);l(this,An);l(this,Tn);l(this,En);l(this,Rn);d(this,Fn,e.id),d(this,xn,e.page),d(this,An,new Date(e.timestamp)),h(e.author?.data,"Wiki page revision author details are missing"),d(this,Tn,new I(e.author.data,t)),d(this,En,e.reason??""),d(this,Rn,e.revisionHidden??!1)}get id(){return s(this,Fn)}get page(){return s(this,xn)}get date(){return s(this,An)}get author(){return s(this,Tn)}get reason(){return s(this,En)}get hidden(){return s(this,Rn)}toJSON(){return{id:s(this,Fn),page:s(this,xn),date:s(this,An),author:s(this,Tn).toJSON(),reason:s(this,En),hidden:s(this,Rn)}}};Fn=new WeakMap,xn=new WeakMap,An=new WeakMap,Tn=new WeakMap,En=new WeakMap,Rn=new WeakMap;var On,Bn,Mn,pl=class{constructor(e,t){l(this,On);l(this,Bn);l(this,Mn);d(this,On,e.listed),d(this,Bn,e.permLevel),d(this,Mn,e.editors.map(i=>(h(i.data,"Wiki page editor details are missing"),new I(i.data,t))))}get listed(){return s(this,On)}get permLevel(){return s(this,Bn)}get editors(){return s(this,Mn)}toJSON(){return{listed:s(this,On),permLevel:s(this,Bn),editors:s(this,Mn).map(e=>e.toJSON())}}};On=new WeakMap,Bn=new WeakMap,Mn=new WeakMap;function QR(r,e){return h(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Um(i,e)),before:r.data.before,after:r.data.after}}var eO=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(eO||{});function tO(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var je,Ce,ma,Un,Ln,pa,ga,ha,fa,wt,va,ya,Dn,ca=class ca{constructor(e,t){l(this,je);l(this,Ce);l(this,ma);l(this,Un);l(this,Ln);l(this,pa);l(this,ga);l(this,ha);l(this,fa);l(this,wt);l(this,va);l(this,ya);l(this,Dn);h(e.collectionId,"Collection Id is missing or undefined"),h(e.subredditId,"Subreddit Id is missing or undefined"),h(e.title,"Collection title is missing or undefined"),h(e.authorId,"Collection author's id is missing or undefined"),h(e.authorName,"Collection author's id is missing or undefined"),h(e.createdAtUtc,"Collection create timestamp is missing"),h(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,je,t),d(this,Ce,e.collectionId),d(this,ma,e.subredditId),d(this,Un,e.title),d(this,Ln,e.description||""),d(this,pa,e.authorId),d(this,ga,e.authorName),d(this,ha,e.permalink),d(this,fa,e.primaryLinkId),d(this,wt,e.linkIds||[]),d(this,Dn,tO(e.displayLayout)),d(this,va,e.createdAtUtc),d(this,ya,e.lastUpdateUtc),X(this)}get id(){return s(this,Ce)}get subredditId(){return s(this,ma)}get title(){return s(this,Un)}get description(){return s(this,Ln)}get authorId(){return s(this,pa)}get authorName(){return s(this,ga)}get permalink(){return s(this,ha)}get primaryLinkId(){return s(this,fa)}get linkIds(){return s(this,wt)}get createdAtUtc(){return s(this,va)}get lastUpdateUtc(){return s(this,ya)}get displayLayout(){return s(this,Dn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ca(n,t)}static async create(e,t){let n=await u.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ca(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ca(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),s(this,wt).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),d(this,wt,s(this,wt).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Ce)},s(this,je))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Ce),follow:e},s(this,je))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Ce),linkIds:e.join(",")},s(this,je)),d(this,wt,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Ce),title:e},s(this,je)),d(this,Un,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Ce),description:e},s(this,je)),d(this,Ln,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Ce),displayLayout:e},s(this,je)),d(this,Dn,e)}};je=new WeakMap,Ce=new WeakMap,ma=new WeakMap,Un=new WeakMap,Ln=new WeakMap,pa=new WeakMap,ga=new WeakMap,ha=new WeakMap,fa=new WeakMap,wt=new WeakMap,va=new WeakMap,ya=new WeakMap,Dn=new WeakMap;var gi=ca;var rO=["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"],iO=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],nO=["onload","onerror","onclick","onmouseover"];function sO(r){return/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/.test(r)?r:r.replace(/<svg\b/,'<svg xmlns="http://www.w3.org/2000/svg"')}function FS(r){if(r){if(!r.trim().startsWith("<svg")){console.log("The provided string is not a valid SVG.");return}try{let e=new RegExp(`<\\s*(${rO.join("|")})\\b`,"gi"),t=new RegExp(`(${iO.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${nO.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=sO(r);let n=r.match(e)||[],o=r.match(t)||[],a=r.match(i)||[],c=!1;return n.length>0&&(c=!0,console.warn(`Disallowed elements detected in SVG: ${n.map(p=>p.replace("<","")).join(", ")}`)),o.length>0&&(c=!0,console.warn(`Disallowed styles detected in SVG: ${o.map(p=>p.split(":")[0]).join(", ")}`)),a.length>0&&(c=!0,console.warn(`Disallowed attributes detected in SVG: ${a.map(p=>p.split("=")[0]).join(", ")}`)),c?void 0:r}catch{return}}}function sH(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=FS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{FM as ALL_ICON_NAMES,sy as AboutLocations,rl as ButtonWidget,el as CalendarWidget,eO as CollectionDisplayLayout,Q as Comment,il as CommunityListWidget,sl as CustomWidget,u as Devvit,Ue as Flair,de as FlairTemplate,AR as FlairType,Tt as Hook,Qd as ImageWidget,W as Listing,zR as ModMailActionType,GR as ModMailConversationState,gd as ModMailService,Me as ModNote,z as Post,gi as PostCollection,nl as PostFlairWidget,hr as PrivateMessage,_s as RichTextBuilder,pc as SettingScope,qR as SocialLinkType,ye as Subreddit,Bm as SubredditRulesWidget,tl as TextAreaWidget,I as User,se as Widget,be as WikiPage,YR as WikiPagePermissionLevel,Um as WikiPageRevision,pl as WikiPageSettings,Hs as convertUserFlairProtoToAPI,pd as getModerationLog,oy as getSubredditLeaderboard,ay as getVaultByAddress,dy as getVaultByUserId,sH as svg,cR as useAsync,sm as useChannel,tm as useForm,dm as useInterval,gm as useState};
6
6
  /*! Bundled license information:
7
7
 
8
8
  shallow-clone/index.js: