@devvit/public-api 0.11.2 → 0.11.3-next-2024-10-31-36e124f73.0
Sign up to get free protection for your applications and to get access to all the features.
- package/meta.json +3 -3
- package/meta.min.json +4 -4
- package/package.json +6 -6
- package/public-api.iife.js +13 -6
- package/public-api.min.js +2 -2
- package/public-api.min.js.map +3 -3
- package/version.json +5 -5
package/public-api.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
var kS=Object.create;var wm=Object.defineProperty;var SS=Object.getOwnPropertyDescriptor;var PS=Object.getOwnPropertyNames;var CS=Object.getPrototypeOf,wS=Object.prototype.hasOwnProperty;var xm=r=>{throw TypeError(r)};var h=(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 PS(e))!wS.call(r,n)&&n!==t&&wm(r,n,{get:()=>e[n],enumerable:!(i=SS(e,n))||i.enumerable});return r};var Dn=(r,e,t)=>(t=r!=null?kS(CS(r)):{},xS(e||!r||!r.__esModule?wm(t,"default",{value:r,enumerable:!0}):t,r));var tl=(r,e,t)=>e.has(r)||xm("Cannot "+t);var s=(r,e,t)=>(tl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?xm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(tl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(tl(r,e,"access private method"),t);var le=h((tO,Im)=>{Im.exports=function(r){try{return!!r()}catch{return!0}}});var oa=h((rO,Fm)=>{var IS=le();Fm.exports=!IS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=h((iO,Em)=>{var Tm=oa(),Am=Function.prototype,rl=Am.call,FS=Tm&&Am.bind.bind(rl,rl);Em.exports=Tm?FS:function(r){return function(){return rl.apply(r,arguments)}}});var Om=h((nO,Rm)=>{var TS=Math.ceil,AS=Math.floor;Rm.exports=Math.trunc||function(e){var t=+e;return(t>0?AS:TS)(t)}});var aa=h((sO,Bm)=>{var ES=Om();Bm.exports=function(r){var e=+r;return e!==e||e===0?0:ES(e)}});var he=h((oO,Mm)=>{var da=function(r){return r&&r.Math==Math&&r};Mm.exports=da(typeof globalThis=="object"&&globalThis)||da(typeof window=="object"&&window)||da(typeof self=="object"&&self)||da(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=h((aO,Um)=>{Um.exports=!1});var la=h((dO,Lm)=>{var Dm=he(),RS=Object.defineProperty;Lm.exports=function(r,e){try{RS(Dm,r,{value:e,configurable:!0,writable:!0})}catch{Dm[r]=e}return e}});var ua=h((lO,_m)=>{var OS=he(),BS=la(),Nm="__core-js_shared__",MS=OS[Nm]||BS(Nm,{});_m.exports=MS});var il=h((uO,qm)=>{var US=Wr(),Hm=ua();(qm.exports=function(r,e){return Hm[r]||(Hm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:US?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"})});var ca=h((cO,jm)=>{jm.exports=function(r){return r==null}});var ma=h((mO,Wm)=>{var DS=ca(),LS=TypeError;Wm.exports=function(r){if(DS(r))throw LS("Can't call method on "+r);return r}});var Ln=h((pO,Gm)=>{var NS=ma(),_S=Object;Gm.exports=function(r){return _S(NS(r))}});var we=h((gO,Vm)=>{var HS=Z(),qS=Ln(),jS=HS({}.hasOwnProperty);Vm.exports=Object.hasOwn||function(e,t){return jS(qS(e),t)}});var nl=h((hO,zm)=>{var WS=Z(),GS=0,VS=Math.random(),zS=WS(1 .toString);zm.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+zS(++GS+VS,36)}});var $m=h((fO,Jm)=>{Jm.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var tp=h((vO,ep)=>{var Ym=he(),sl=$m(),Km=Ym.process,Xm=Ym.Deno,Zm=Km&&Km.versions||Xm&&Xm.version,Qm=Zm&&Zm.v8,qe,pa;Qm&&(qe=Qm.split("."),pa=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!pa&&sl&&(qe=sl.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=sl.match(/Chrome\/(\d+)/),qe&&(pa=+qe[1])));ep.exports=pa});var ol=h((yO,ip)=>{var rp=tp(),JS=le();ip.exports=!!Object.getOwnPropertySymbols&&!JS(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&rp&&rp<41})});var al=h((bO,np)=>{var $S=ol();np.exports=$S&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var xe=h((kO,op)=>{var KS=he(),XS=il(),sp=we(),ZS=nl(),QS=ol(),YS=al(),Gr=KS.Symbol,dl=XS("wks"),eP=YS?Gr.for||Gr:Gr&&Gr.withoutSetter||ZS;op.exports=function(r){return sp(dl,r)||(dl[r]=QS&&sp(Gr,r)?Gr[r]:eP("Symbol."+r)),dl[r]}});var lp=h((SO,dp)=>{var tP=xe(),rP=tP("toStringTag"),ap={};ap[rP]="z";dp.exports=String(ap)==="[object z]"});var ul=h((PO,up)=>{var ll=typeof document=="object"&&document.all,iP=typeof ll>"u"&&ll!==void 0;up.exports={all:ll,IS_HTMLDDA:iP}});var Q=h((CO,mp)=>{var cp=ul(),nP=cp.all;mp.exports=cp.IS_HTMLDDA?function(r){return typeof r=="function"||r===nP}:function(r){return typeof r=="function"}});var ga=h((wO,gp)=>{var pp=Z(),sP=pp({}.toString),oP=pp("".slice);gp.exports=function(r){return oP(sP(r),8,-1)}});var Nn=h((xO,hp)=>{var aP=lp(),dP=Q(),ha=ga(),lP=xe(),uP=lP("toStringTag"),cP=Object,mP=ha(function(){return arguments}())=="Arguments",pP=function(r,e){try{return r[e]}catch{}};hp.exports=aP?ha:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=pP(e=cP(r),uP))=="string"?t:mP?ha(e):(i=ha(e))=="Object"&&dP(e.callee)?"Arguments":i}});var _n=h((IO,fp)=>{var gP=Nn(),hP=String;fp.exports=function(r){if(gP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return hP(r)}});var ml=h((FO,bp)=>{var cl=Z(),fP=aa(),vP=_n(),yP=ma(),bP=cl("".charAt),vp=cl("".charCodeAt),kP=cl("".slice),yp=function(r){return function(e,t){var i=vP(yP(e)),n=fP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=vp(i,n),a<55296||a>56319||n+1===o||(c=vp(i,n+1))<56320||c>57343?r?bP(i,n):a:r?kP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};bp.exports={codeAt:yp(!1),charAt:yp(!0)}});var Pp=h((TO,Sp)=>{var SP=he(),PP=Q(),kp=SP.WeakMap;Sp.exports=PP(kp)&&/native code/.test(String(kp))});var Ct=h((AO,xp)=>{var Cp=Q(),wp=ul(),CP=wp.all;xp.exports=wp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Cp(r)||r===CP}:function(r){return typeof r=="object"?r!==null:Cp(r)}});var fe=h((EO,Ip)=>{var wP=le();Ip.exports=!wP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var gl=h((RO,Tp)=>{var xP=he(),Fp=Ct(),pl=xP.document,IP=Fp(pl)&&Fp(pl.createElement);Tp.exports=function(r){return IP?pl.createElement(r):{}}});var hl=h((OO,Ap)=>{var FP=fe(),TP=le(),AP=gl();Ap.exports=!FP&&!TP(function(){return Object.defineProperty(AP("div"),"a",{get:function(){return 7}}).a!=7})});var fl=h((BO,Ep)=>{var EP=fe(),RP=le();Ep.exports=EP&&RP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=h((MO,Rp)=>{var OP=Ct(),BP=String,MP=TypeError;Rp.exports=function(r){if(OP(r))return r;throw MP(BP(r)+" is not an object")}});var je=h((UO,Op)=>{var UP=oa(),fa=Function.prototype.call;Op.exports=UP?fa.bind(fa):function(){return fa.apply(fa,arguments)}});var Hn=h((DO,Bp)=>{var vl=he(),DP=Q(),LP=function(r){return DP(r)?r:void 0};Bp.exports=function(r,e){return arguments.length<2?LP(vl[r]):vl[r]&&vl[r][e]}});var yl=h((LO,Mp)=>{var NP=Z();Mp.exports=NP({}.isPrototypeOf)});var bl=h((NO,Up)=>{var _P=Hn(),HP=Q(),qP=yl(),jP=al(),WP=Object;Up.exports=jP?function(r){return typeof r=="symbol"}:function(r){var e=_P("Symbol");return HP(e)&&qP(e.prototype,WP(r))}});var kl=h((_O,Dp)=>{var GP=String;Dp.exports=function(r){try{return GP(r)}catch{return"Object"}}});var va=h((HO,Lp)=>{var VP=Q(),zP=kl(),JP=TypeError;Lp.exports=function(r){if(VP(r))return r;throw JP(zP(r)+" is not a function")}});var ya=h((qO,Np)=>{var $P=va(),KP=ca();Np.exports=function(r,e){var t=r[e];return KP(t)?void 0:$P(t)}});var Hp=h((jO,_p)=>{var Sl=je(),Pl=Q(),Cl=Ct(),XP=TypeError;_p.exports=function(r,e){var t,i;if(e==="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r))||Pl(t=r.valueOf)&&!Cl(i=Sl(t,r))||e!=="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r)))return i;throw XP("Can't convert object to primitive value")}});var Gp=h((WO,Wp)=>{var ZP=je(),qp=Ct(),jp=bl(),QP=ya(),YP=Hp(),eC=xe(),tC=TypeError,rC=eC("toPrimitive");Wp.exports=function(r,e){if(!qp(r)||jp(r))return r;var t=QP(r,rC),i;if(t){if(e===void 0&&(e="default"),i=ZP(t,r,e),!qp(i)||jp(i))return i;throw tC("Can't convert object to primitive value")}return e===void 0&&(e="number"),YP(r,e)}});var ba=h((GO,Vp)=>{var iC=Gp(),nC=bl();Vp.exports=function(r){var e=iC(r,"string");return nC(e)?e:e+""}});var Qe=h(Jp=>{var sC=fe(),oC=hl(),aC=fl(),ka=Ze(),zp=ba(),dC=TypeError,wl=Object.defineProperty,lC=Object.getOwnPropertyDescriptor,xl="enumerable",Il="configurable",Fl="writable";Jp.f=sC?aC?function(e,t,i){if(ka(e),t=zp(t),ka(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Fl in i&&!i[Fl]){var n=lC(e,t);n&&n[Fl]&&(e[t]=i.value,i={configurable:Il in i?i[Il]:n[Il],enumerable:xl in i?i[xl]:n[xl],writable:!1})}return wl(e,t,i)}:wl:function(e,t,i){if(ka(e),t=zp(t),ka(i),oC)try{return wl(e,t,i)}catch{}if("get"in i||"set"in i)throw dC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=h((zO,$p)=>{$p.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Sa=h((JO,Kp)=>{var uC=fe(),cC=Qe(),mC=Vr();Kp.exports=uC?function(r,e,t){return cC.f(r,e,mC(1,t))}:function(r,e,t){return r[e]=t,r}});var Pa=h(($O,Zp)=>{var pC=il(),gC=nl(),Xp=pC("keys");Zp.exports=function(r){return Xp[r]||(Xp[r]=gC(r))}});var Ca=h((KO,Qp)=>{Qp.exports={}});var zr=h((XO,tg)=>{var hC=Pp(),eg=he(),fC=Ct(),vC=Sa(),Tl=we(),Al=ua(),yC=Pa(),bC=Ca(),Yp="Object already initialized",El=eg.TypeError,kC=eg.WeakMap,wa,qn,xa,SC=function(r){return xa(r)?qn(r):wa(r,{})},PC=function(r){return function(e){var t;if(!fC(e)||(t=qn(e)).type!==r)throw El("Incompatible receiver, "+r+" required");return t}};hC||Al.state?(We=Al.state||(Al.state=new kC),We.get=We.get,We.has=We.has,We.set=We.set,wa=function(r,e){if(We.has(r))throw El(Yp);return e.facade=r,We.set(r,e),e},qn=function(r){return We.get(r)||{}},xa=function(r){return We.has(r)}):(or=yC("state"),bC[or]=!0,wa=function(r,e){if(Tl(r,or))throw El(Yp);return e.facade=r,vC(r,or,e),e},qn=function(r){return Tl(r,or)?r[or]:{}},xa=function(r){return Tl(r,or)});var We,or;tg.exports={set:wa,get:qn,has:xa,enforce:SC,getterFor:PC}});var Rl=h(ng=>{"use strict";var rg={}.propertyIsEnumerable,ig=Object.getOwnPropertyDescriptor,CC=ig&&!rg.call({1:2},1);ng.f=CC?function(e){var t=ig(this,e);return!!t&&t.enumerable}:rg});var Bl=h((QO,sg)=>{var wC=Z(),xC=le(),IC=ga(),Ol=Object,FC=wC("".split);sg.exports=xC(function(){return!Ol("z").propertyIsEnumerable(0)})?function(r){return IC(r)=="String"?FC(r,""):Ol(r)}:Ol});var Jr=h((YO,og)=>{var TC=Bl(),AC=ma();og.exports=function(r){return TC(AC(r))}});var Ml=h(dg=>{var EC=fe(),RC=je(),OC=Rl(),BC=Vr(),MC=Jr(),UC=ba(),DC=we(),LC=hl(),ag=Object.getOwnPropertyDescriptor;dg.f=EC?ag:function(e,t){if(e=MC(e),t=UC(t),LC)try{return ag(e,t)}catch{}if(DC(e,t))return BC(!RC(OC.f,e,t),e[t])}});var Ll=h((tB,ug)=>{var Ul=fe(),NC=we(),lg=Function.prototype,_C=Ul&&Object.getOwnPropertyDescriptor,Dl=NC(lg,"name"),HC=Dl&&function(){}.name==="something",qC=Dl&&(!Ul||Ul&&_C(lg,"name").configurable);ug.exports={EXISTS:Dl,PROPER:HC,CONFIGURABLE:qC}});var _l=h((rB,cg)=>{var jC=Z(),WC=Q(),Nl=ua(),GC=jC(Function.toString);WC(Nl.inspectSource)||(Nl.inspectSource=function(r){return GC(r)});cg.exports=Nl.inspectSource});var jl=h((iB,gg)=>{var ql=Z(),VC=le(),zC=Q(),Ia=we(),Hl=fe(),JC=Ll().CONFIGURABLE,$C=_l(),pg=zr(),KC=pg.enforce,XC=pg.get,mg=String,Fa=Object.defineProperty,ZC=ql("".slice),QC=ql("".replace),YC=ql([].join),e0=Hl&&!VC(function(){return Fa(function(){},"length",{value:8}).length!==8}),t0=String(String).split("String"),r0=gg.exports=function(r,e,t){ZC(mg(e),0,7)==="Symbol("&&(e="["+QC(mg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ia(r,"name")||JC&&r.name!==e)&&(Hl?Fa(r,"name",{value:e,configurable:!0}):r.name=e),e0&&t&&Ia(t,"arity")&&r.length!==t.arity&&Fa(r,"length",{value:t.arity});try{t&&Ia(t,"constructor")&&t.constructor?Hl&&Fa(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=KC(r);return Ia(i,"source")||(i.source=YC(t0,typeof e=="string"?e:"")),r};Function.prototype.toString=r0(function(){return zC(this)&&XC(this).source||$C(this)},"toString")});var ar=h((nB,hg)=>{var i0=Q(),n0=Qe(),s0=jl(),o0=la();hg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(i0(t)&&s0(t,o,i),i.global)n?r[e]=t:o0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:n0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Wl=h((sB,fg)=>{var a0=aa(),d0=Math.max,l0=Math.min;fg.exports=function(r,e){var t=a0(r);return t<0?d0(t+e,0):l0(t,e)}});var yg=h((oB,vg)=>{var u0=aa(),c0=Math.min;vg.exports=function(r){return r>0?c0(u0(r),9007199254740991):0}});var Ta=h((aB,bg)=>{var m0=yg();bg.exports=function(r){return m0(r.length)}});var Pg=h((dB,Sg)=>{var p0=Jr(),g0=Wl(),h0=Ta(),kg=function(r){return function(e,t,i){var n=p0(e),o=h0(n),a=g0(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}};Sg.exports={includes:kg(!0),indexOf:kg(!1)}});var Vl=h((lB,wg)=>{var f0=Z(),Gl=we(),v0=Jr(),y0=Pg().indexOf,b0=Ca(),Cg=f0([].push);wg.exports=function(r,e){var t=v0(r),i=0,n=[],o;for(o in t)!Gl(b0,o)&&Gl(t,o)&&Cg(n,o);for(;e.length>i;)Gl(t,o=e[i++])&&(~y0(n,o)||Cg(n,o));return n}});var Aa=h((uB,xg)=>{xg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Fg=h(Ig=>{var k0=Vl(),S0=Aa(),P0=S0.concat("length","prototype");Ig.f=Object.getOwnPropertyNames||function(e){return k0(e,P0)}});var zl=h(Tg=>{Tg.f=Object.getOwnPropertySymbols});var Eg=h((pB,Ag)=>{var C0=Hn(),w0=Z(),x0=Fg(),I0=zl(),F0=Ze(),T0=w0([].concat);Ag.exports=C0("Reflect","ownKeys")||function(e){var t=x0.f(F0(e)),i=I0.f;return i?T0(t,i(e)):t}});var Bg=h((gB,Og)=>{var Rg=we(),A0=Eg(),E0=Ml(),R0=Qe();Og.exports=function(r,e,t){for(var i=A0(e),n=R0.f,o=E0.f,a=0;a<i.length;a++){var c=i[a];!Rg(r,c)&&!(t&&Rg(t,c))&&n(r,c,o(e,c))}}});var Ug=h((hB,Mg)=>{var O0=le(),B0=Q(),M0=/#|\.prototype\./,jn=function(r,e){var t=D0[U0(r)];return t==N0?!0:t==L0?!1:B0(e)?O0(e):!!e},U0=jn.normalize=function(r){return String(r).replace(M0,".").toLowerCase()},D0=jn.data={},L0=jn.NATIVE="N",N0=jn.POLYFILL="P";Mg.exports=jn});var Wn=h((fB,Dg)=>{var Jl=he(),_0=Ml().f,H0=Sa(),q0=ar(),j0=la(),W0=Bg(),G0=Ug();Dg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,f;if(i?a=Jl:n?a=Jl[t]||j0(t,{}):a=(Jl[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(f=_0(a,c),p=f&&f.value):p=a[c],o=G0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;W0(g,p)}(r.sham||p&&p.sham)&&H0(g,"sham",!0),q0(a,c,g,r)}}});var $l=h((vB,Lg)=>{var V0=Vl(),z0=Aa();Lg.exports=Object.keys||function(e){return V0(e,z0)}});var _g=h(Ng=>{var J0=fe(),$0=fl(),K0=Qe(),X0=Ze(),Z0=Jr(),Q0=$l();Ng.f=J0&&!$0?Object.defineProperties:function(e,t){X0(e);for(var i=Z0(t),n=Q0(t),o=n.length,a=0,c;o>a;)K0.f(e,c=n[a++],i[c]);return e}});var qg=h((bB,Hg)=>{var Y0=Hn();Hg.exports=Y0("document","documentElement")});var Gn=h((kB,$g)=>{var ew=Ze(),tw=_g(),jg=Aa(),rw=Ca(),iw=qg(),nw=gl(),sw=Pa(),Wg=">",Gg="<",Xl="prototype",Zl="script",zg=sw("IE_PROTO"),Kl=function(){},Jg=function(r){return Gg+Zl+Wg+r+Gg+"/"+Zl+Wg},Vg=function(r){r.write(Jg("")),r.close();var e=r.parentWindow.Object;return r=null,e},ow=function(){var r=nw("iframe"),e="java"+Zl+":",t;return r.style.display="none",iw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Jg("document.F=Object")),t.close(),t.F},Ea,Ra=function(){try{Ea=new ActiveXObject("htmlfile")}catch{}Ra=typeof document<"u"?document.domain&&Ea?Vg(Ea):ow():Vg(Ea);for(var r=jg.length;r--;)delete Ra[Xl][jg[r]];return Ra()};rw[zg]=!0;$g.exports=Object.create||function(e,t){var i;return e!==null?(Kl[Xl]=ew(e),i=new Kl,Kl[Xl]=null,i[zg]=e):i=Ra(),t===void 0?i:tw.f(i,t)}});var Xg=h((SB,Kg)=>{var aw=le();Kg.exports=!aw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Yl=h((PB,Qg)=>{var dw=we(),lw=Q(),uw=Ln(),cw=Pa(),mw=Xg(),Zg=cw("IE_PROTO"),Ql=Object,pw=Ql.prototype;Qg.exports=mw?Ql.getPrototypeOf:function(r){var e=uw(r);if(dw(e,Zg))return e[Zg];var t=e.constructor;return lw(t)&&e instanceof t?t.prototype:e instanceof Ql?pw:null}});var iu=h((CB,th)=>{"use strict";var gw=le(),hw=Q(),fw=Ct(),vw=Gn(),Yg=Yl(),yw=ar(),bw=xe(),kw=Wr(),ru=bw("iterator"),eh=!1,lt,eu,tu;[].keys&&(tu=[].keys(),"next"in tu?(eu=Yg(Yg(tu)),eu!==Object.prototype&&(lt=eu)):eh=!0);var Sw=!fw(lt)||gw(function(){var r={};return lt[ru].call(r)!==r});Sw?lt={}:kw&&(lt=vw(lt));hw(lt[ru])||yw(lt,ru,function(){return this});th.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:eh}});var Vn=h((wB,ih)=>{var Pw=Qe().f,Cw=we(),ww=xe(),rh=ww("toStringTag");ih.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Cw(r,rh)&&Pw(r,rh,{configurable:!0,value:e})}});var $r=h((xB,nh)=>{nh.exports={}});var nu=h((IB,sh)=>{"use strict";var xw=iu().IteratorPrototype,Iw=Gn(),Fw=Vr(),Tw=Vn(),Aw=$r(),Ew=function(){return this};sh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Iw(xw,{next:Fw(+!i,t)}),Tw(r,n,!1,!0),Aw[n]=Ew,r}});var ah=h((FB,oh)=>{var Rw=Q(),Ow=String,Bw=TypeError;oh.exports=function(r){if(typeof r=="object"||Rw(r))return r;throw Bw("Can't set "+Ow(r)+" as a prototype")}});var lh=h((TB,dh)=>{var Mw=Z(),Uw=Ze(),Dw=ah();dh.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Mw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Uw(n),Dw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var ou=h((AB,bh)=>{"use strict";var Lw=Wn(),Nw=je(),Oa=Wr(),vh=Ll(),_w=Q(),Hw=nu(),uh=Yl(),ch=lh(),qw=Vn(),jw=Sa(),su=ar(),Ww=xe(),mh=$r(),yh=iu(),Gw=vh.PROPER,Vw=vh.CONFIGURABLE,ph=yh.IteratorPrototype,Ba=yh.BUGGY_SAFARI_ITERATORS,zn=Ww("iterator"),gh="keys",Jn="values",hh="entries",fh=function(){return this};bh.exports=function(r,e,t,i,n,o,a){Hw(t,e,i);var c=function(I){if(I===n&&b)return b;if(!Ba&&I in f)return f[I];switch(I){case gh:return function(){return new t(this,I)};case Jn:return function(){return new t(this,I)};case hh:return function(){return new t(this,I)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,f=r.prototype,m=f[zn]||f["@@iterator"]||n&&f[n],b=!Ba&&m||c(n),v=e=="Array"&&f.entries||m,P,C,F;if(v&&(P=uh(v.call(new r)),P!==Object.prototype&&P.next&&(!Oa&&uh(P)!==ph&&(ch?ch(P,ph):_w(P[zn])||su(P,zn,fh)),qw(P,p,!0,!0),Oa&&(mh[p]=fh))),Gw&&n==Jn&&m&&m.name!==Jn&&(!Oa&&Vw?jw(f,"name",Jn):(g=!0,b=function(){return Nw(m,this)})),n)if(C={values:c(Jn),keys:o?b:c(gh),entries:c(hh)},a)for(F in C)(Ba||g||!(F in f))&&su(f,F,C[F]);else Lw({target:e,proto:!0,forced:Ba||g},C);return(!Oa||a)&&f[zn]!==b&&su(f,zn,b,{name:n}),mh[e]=b,C}});var au=h((EB,kh)=>{kh.exports=function(r,e){return{value:r,done:e}}});var wh=h(()=>{"use strict";var zw=ml().charAt,Jw=_n(),Ph=zr(),$w=ou(),Sh=au(),Ch="String Iterator",Kw=Ph.set,Xw=Ph.getterFor(Ch);$w(String,"String",function(r){Kw(this,{type:Ch,string:Jw(r),index:0})},function(){var e=Xw(this),t=e.string,i=e.index,n;return i>=t.length?Sh(void 0,!0):(n=zw(t,i),e.index+=n.length,Sh(n,!1))})});var du=h((BB,xh)=>{var Zw=le(),Qw=xe(),Yw=Wr(),ex=Qw("iterator");xh.exports=!Zw(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}),Yw&&!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[ex]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var Fh=h((MB,Ih)=>{var tx=ga(),rx=Z();Ih.exports=function(r){if(tx(r)==="Function")return rx(r)}});var Ma=h((UB,Ah)=>{var Th=Fh(),ix=va(),nx=oa(),sx=Th(Th.bind);Ah.exports=function(r,e){return ix(r),e===void 0?r:nx?sx(r,e):function(){return r.apply(e,arguments)}}});var Oh=h((DB,Rh)=>{var Eh=jl(),ox=Qe();Rh.exports=function(r,e,t){return t.get&&Eh(t.get,e,{getter:!0}),t.set&&Eh(t.set,e,{setter:!0}),ox.f(r,e,t)}});var lu=h((LB,Bh)=>{var ax=yl(),dx=TypeError;Bh.exports=function(r,e){if(ax(e,r))return r;throw dx("Incorrect invocation")}});var Lh=h((NB,Dh)=>{"use strict";var Mh=fe(),lx=Z(),ux=je(),cx=le(),uu=$l(),mx=zl(),px=Rl(),gx=Ln(),hx=Bl(),Kr=Object.assign,Uh=Object.defineProperty,fx=lx([].concat);Dh.exports=!Kr||cx(function(){if(Mh&&Kr({b:1},Kr(Uh({},"a",{enumerable:!0,get:function(){Uh(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},e={},t=Symbol(),i="abcdefghijklmnopqrst";return r[t]=7,i.split("").forEach(function(n){e[n]=n}),Kr({},r)[t]!=7||uu(Kr({},e)).join("")!=i})?function(e,t){for(var i=gx(e),n=arguments.length,o=1,a=mx.f,c=px.f;n>o;)for(var p=hx(arguments[o++]),g=a?fx(uu(p),a(p)):uu(p),f=g.length,m=0,b;f>m;)b=g[m++],(!Mh||ux(c,p,b))&&(i[b]=p[b]);return i}:Kr});var Hh=h((_B,_h)=>{var vx=je(),Nh=Ze(),yx=ya();_h.exports=function(r,e,t){var i,n;Nh(r);try{if(i=yx(r,"return"),!i){if(e==="throw")throw t;return t}i=vx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Nh(i),t}});var jh=h((HB,qh)=>{var bx=Ze(),kx=Hh();qh.exports=function(r,e,t,i){try{return i?e(bx(t)[0],t[1]):e(t)}catch(n){kx(r,"throw",n)}}});var Gh=h((qB,Wh)=>{var Sx=xe(),Px=$r(),Cx=Sx("iterator"),wx=Array.prototype;Wh.exports=function(r){return r!==void 0&&(Px.Array===r||wx[Cx]===r)}});var Xh=h((jB,Kh)=>{var xx=Z(),Ix=le(),Vh=Q(),Fx=Nn(),Tx=Hn(),Ax=_l(),zh=function(){},Ex=[],Jh=Tx("Reflect","construct"),cu=/^\s*(?:class|function)\b/,Rx=xx(cu.exec),Ox=!cu.exec(zh),$n=function(e){if(!Vh(e))return!1;try{return Jh(zh,Ex,e),!0}catch{return!1}},$h=function(e){if(!Vh(e))return!1;switch(Fx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ox||!!Rx(cu,Ax(e))}catch{return!0}};$h.sham=!0;Kh.exports=!Jh||Ix(function(){var r;return $n($n.call)||!$n(Object)||!$n(function(){r=!0})||r})?$h:$n});var mu=h((WB,Zh)=>{"use strict";var Bx=ba(),Mx=Qe(),Ux=Vr();Zh.exports=function(r,e,t){var i=Bx(e);i in r?Mx.f(r,i,Ux(0,t)):r[i]=t}});var Ua=h((GB,Yh)=>{var Dx=Nn(),Qh=ya(),Lx=ca(),Nx=$r(),_x=xe(),Hx=_x("iterator");Yh.exports=function(r){if(!Lx(r))return Qh(r,Hx)||Qh(r,"@@iterator")||Nx[Dx(r)]}});var pu=h((VB,ef)=>{var qx=je(),jx=va(),Wx=Ze(),Gx=kl(),Vx=Ua(),zx=TypeError;ef.exports=function(r,e){var t=arguments.length<2?Vx(r):e;if(jx(t))return Wx(qx(t,r));throw zx(Gx(r)+" is not iterable")}});var sf=h((zB,nf)=>{"use strict";var Jx=Ma(),$x=je(),Kx=Ln(),Xx=jh(),Zx=Gh(),Qx=Xh(),Yx=Ta(),tf=mu(),eI=pu(),tI=Ua(),rf=Array;nf.exports=function(e){var t=Kx(e),i=Qx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=Jx(o,n>2?arguments[2]:void 0));var c=tI(t),p=0,g,f,m,b,v,P;if(c&&!(this===rf&&Zx(c)))for(b=eI(t,c),v=b.next,f=i?new this:[];!(m=$x(v,b)).done;p++)P=a?Xx(b,o,[m.value,p],!0):m.value,tf(f,p,P);else for(g=Yx(t),f=i?new this(g):rf(g);g>p;p++)P=a?o(t[p],p):t[p],tf(f,p,P);return f.length=p,f}});var gu=h((JB,af)=>{var of=Wl(),rI=Ta(),iI=mu(),nI=Array,sI=Math.max;af.exports=function(r,e,t){for(var i=rI(r),n=of(e,i),o=of(t===void 0?i:t,i),a=nI(sI(o-n,0)),c=0;n<o;n++,c++)iI(a,c,r[n]);return a.length=c,a}});var ff=h(($B,hf)=>{var dr=Z(),hu=2147483647,Kn=36,mf=1,yu=26,oI=38,aI=700,dI=72,lI=128,uI="-",cI=/[^\0-\u007E]/,pf=/[.\u3002\uFF0E\uFF61]/g,df="Overflow: input needs wider integers to process",fu=Kn-mf,lf=RangeError,mI=dr(pf.exec),Xr=Math.floor,vu=String.fromCharCode,uf=dr("".charCodeAt),gf=dr([].join),wt=dr([].push),pI=dr("".replace),gI=dr("".split),hI=dr("".toLowerCase),fI=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=uf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=uf(r,t++);(o&64512)==56320?wt(e,((n&1023)<<10)+(o&1023)+65536):(wt(e,n),t--)}else wt(e,n)}return e},cf=function(r){return r+22+75*(r<26)},vI=function(r,e,t){var i=0;for(r=t?Xr(r/aI):r>>1,r+=Xr(r/e);r>fu*yu>>1;)r=Xr(r/fu),i+=Kn;return Xr(i+(fu+1)*r/(r+oI))},yI=function(r){var e=[];r=fI(r);var t=r.length,i=lI,n=0,o=dI,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&wt(e,vu(c));var p=e.length,g=p;for(p&&wt(e,uI);g<t;){var f=hu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<f&&(f=c);var m=g+1;if(f-i>Xr((hu-n)/m))throw lf(df);for(n+=(f-i)*m,i=f,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>hu)throw lf(df);if(c==i){for(var b=n,v=Kn;;){var P=v<=o?mf:v>=o+yu?yu:v-o;if(b<P)break;var C=b-P,F=Kn-P;wt(e,vu(cf(P+C%F))),b=Xr(C/F),v+=Kn}wt(e,vu(cf(b))),o=vI(n,m,g==p),n=0,g++}}n++,i++}return gf(e,"")};hf.exports=function(r){var e=[],t=gI(pI(hI(r),pf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],wt(e,mI(cI,n)?"xn--"+yI(n):n);return gf(e,".")}});var bu=h((KB,vf)=>{var bI=TypeError;vf.exports=function(r,e){if(r<e)throw bI("Not enough arguments");return r}});var bf=h((XB,yf)=>{var kI=xe(),SI=Gn(),PI=Qe().f,ku=kI("unscopables"),Su=Array.prototype;Su[ku]==null&&PI(Su,ku,{configurable:!0,value:SI(null)});yf.exports=function(r){Su[ku][r]=!0}});var xf=h((ZB,wf)=>{"use strict";var CI=Jr(),Pu=bf(),kf=$r(),Pf=zr(),wI=Qe().f,xI=ou(),Da=au(),II=Wr(),FI=fe(),Cf="Array Iterator",TI=Pf.set,AI=Pf.getterFor(Cf);wf.exports=xI(Array,"Array",function(r,e){TI(this,{type:Cf,target:CI(r),index:0,kind:e})},function(){var r=AI(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Da(void 0,!0)):t=="keys"?Da(i,!1):t=="values"?Da(e[i],!1):Da([i,e[i]],!1)},"values");var Sf=kf.Arguments=kf.Array;Pu("keys");Pu("values");Pu("entries");if(!II&&FI&&Sf.name!=="values")try{wI(Sf,"name",{value:"values"})}catch{}});var Ff=h((QB,If)=>{var EI=ar();If.exports=function(r,e,t){for(var i in e)EI(r,i,e[i],t);return r}});var Ef=h((YB,Af)=>{var Tf=gu(),RI=Math.floor,Cu=function(r,e){var t=r.length,i=RI(t/2);return t<8?OI(r,e):BI(r,Cu(Tf(r,0,i),e),Cu(Tf(r,i),e),e)},OI=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},BI=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};Af.exports=Cu});var Bu=h((eM,Xf)=>{"use strict";xf();var Tu=Wn(),Qr=he(),La=je(),Ye=Z(),MI=fe(),jf=du(),Wf=ar(),UI=Ff(),DI=Vn(),LI=nu(),Ru=zr(),Gf=lu(),wu=Q(),NI=we(),_I=Ma(),HI=Nn(),qI=Ze(),Vf=Ct(),ve=_n(),jI=Gn(),Rf=Vr(),Au=pu(),WI=Ua(),Zr=bu(),GI=xe(),VI=Ef(),zI=GI("iterator"),Qn="URLSearchParams",zf=Qn+"Iterator",Jf=Ru.set,Ge=Ru.getterFor(Qn),JI=Ru.getterFor(zf),$I=Object.getOwnPropertyDescriptor,Ou=function(r){if(!MI)return Qr[r];var e=$I(Qr,r);return e&&e.value},Of=Ou("fetch"),_a=Ou("Request"),Xn=Ou("Headers"),xu=_a&&_a.prototype,Bf=Xn&&Xn.prototype,KI=Qr.RegExp,XI=Qr.TypeError,$f=Qr.decodeURIComponent,ZI=Qr.encodeURIComponent,QI=Ye("".charAt),Mf=Ye([].join),lr=Ye([].push),Eu=Ye("".replace),YI=Ye([].shift),Uf=Ye([].splice),Df=Ye("".split),eF=Ye("".slice),tF=/\+/g,Lf=Array(4),rF=function(r){return Lf[r-1]||(Lf[r-1]=KI("((?:%[\\da-f]{2}){"+r+"})","gi"))},iF=function(r){try{return $f(r)}catch{return r}},Nf=function(r){var e=Eu(r,tF," "),t=4;try{return $f(e)}catch{for(;t;)e=Eu(e,rF(t--),iF);return e}},nF=/[!'()~]|%20/g,sF={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},oF=function(r){return sF[r]},_f=function(r){return Eu(ZI(r),nF,oF)},Iu=LI(function(e,t){Jf(this,{type:zf,iterator:Au(Ge(e).entries),kind:t})},"Iterator",function(){var e=JI(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),Kf=function(r){this.entries=[],this.url=null,r!==void 0&&(Vf(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?QI(r,0)==="?"?eF(r,1):r:ve(r)))};Kf.prototype={type:Qn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=WI(r),t,i,n,o,a,c,p;if(e)for(t=Au(r,e),i=t.next;!(n=La(i,t)).done;){if(o=Au(qI(n.value)),a=o.next,(c=La(a,o)).done||(p=La(a,o)).done||!La(a,o).done)throw XI("Expected sequence with length 2");lr(this.entries,{key:ve(c.value),value:ve(p.value)})}else for(var g in r)NI(r,g)&&lr(this.entries,{key:g,value:ve(r[g])})},parseQuery:function(r){if(r)for(var e=Df(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Df(i,"="),lr(this.entries,{key:Nf(YI(n)),value:Nf(Mf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],lr(e,_f(i.key)+"="+_f(i.value));return Mf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Ha=function(){Gf(this,Zn);var e=arguments.length>0?arguments[0]:void 0;Jf(this,new Kf(e))},Zn=Ha.prototype;UI(Zn,{append:function(e,t){Zr(arguments.length,2);var i=Ge(this);lr(i.entries,{key:ve(e),value:ve(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=ve(r),n=0;n<t.length;)t[n].key===i?Uf(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=[],o=0;o<t.length;o++)t[o].key===i&&lr(n,t[o].value);return n},has:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Zr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=ve(e),c=ve(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?Uf(n,p--,1):(o=!0,g.value=c));o||lr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ge(this);VI(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=_I(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 Iu(this,"keys")},values:function(){return new Iu(this,"values")},entries:function(){return new Iu(this,"entries")}},{enumerable:!0});Wf(Zn,zI,Zn.entries,{name:"entries"});Wf(Zn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});DI(Ha,Qn);Tu({global:!0,constructor:!0,forced:!jf},{URLSearchParams:Ha});!jf&&wu(Xn)&&(Hf=Ye(Bf.has),qf=Ye(Bf.set),Fu=function(r){if(Vf(r)){var e=r.body,t;if(HI(e)===Qn)return t=r.headers?new Xn(r.headers):new Xn,Hf(t,"content-type")||qf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),jI(r,{body:Rf(0,ve(e)),headers:Rf(0,t)})}return r},wu(Of)&&Tu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Of(e,arguments.length>1?Fu(arguments[1]):{})}}),wu(_a)&&(Na=function(e){return Gf(this,xu),new _a(e,arguments.length>1?Fu(arguments[1]):{})},xu.constructor=Na,Na.prototype=xu,Tu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Na})));var Hf,qf,Fu,Na;Xf.exports={URLSearchParams:Ha,getState:Ge}});var hv=h(()=>{"use strict";wh();var aF=Wn(),Ku=fe(),dF=du(),Xu=he(),Zf=Ma(),Ee=Z(),Va=ar(),Ie=Oh(),lF=lu(),zu=we(),Zu=Lh(),Yr=sf(),Ve=gu(),uF=ml().codeAt,cF=ff(),ct=_n(),mF=Vn(),pF=bu(),lv=Bu(),uv=zr(),gF=uv.set,za=uv.getterFor("URL"),hF=lv.URLSearchParams,fF=lv.getState,Yn=Xu.URL,Ju=Xu.TypeError,Ja=Xu.parseInt,vF=Math.floor,Qf=Math.pow,Ae=Ee("".charAt),ze=Ee(/./.exec),ts=Ee([].join),yF=Ee(1 .toString),bF=Ee([].pop),ti=Ee([].push),Yf=Ee("".replace),kF=Ee([].shift),SF=Ee("".split),is=Ee("".slice),$a=Ee("".toLowerCase),PF=Ee([].unshift),CF="Invalid authority",Mu="Invalid scheme",ur="Invalid host",ev="Invalid port",cv=/[a-z]/i,wF=/[\d+-.a-z]/i,$u=/\d/,xF=/^0x/i,IF=/^[0-7]+$/,FF=/^\d+$/,mv=/^[\da-f]+$/i,TF=/[\0\t\n\r #%/:<>?@[\\\]^|]/,AF=/[\0\t\n\r #/:<>?@[\\\]^|]/,EF=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,RF=/[\t\n\r]/g,Fe,OF=function(r){var e=SF(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&&Ae(o,0)=="0"&&(a=ze(xF,o)?16:8,o=is(o,a==8?1:2)),o==="")c=0;else{if(!ze(a==10?FF:a==8?IF:mv,o))return r;c=Ja(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=Qf(256,5-t))return null}else if(c>255)return null;for(p=bF(i),n=0;n<i.length;n++)p+=i[n]*Qf(256,3-n);return p},BF=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,f,m,b=function(){return Ae(r,n)};if(b()==":"){if(Ae(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(mv,b());)o=o*16+Ja(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!ze($u,b()))return;for(;ze($u,b());){if(g=Ja(b(),10),p===null)p=g;else{if(p==0)return;p=p*10+g}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(f=t-i,t=7;t!=0&&f>0;)m=e[t],e[t--]=e[i+f-1],e[i+--f]=m;else if(t!=8)return;return e},MF=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},es=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)PF(e,r%256),r=vF(r/256);return ts(e,".")}else if(typeof r=="object"){for(e="",i=MF(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=yF(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},Ga={},pv=Zu({},Ga,{" ":1,'"':1,"<":1,">":1,"`":1}),gv=Zu({},pv,{"#":1,"?":1,"{":1,"}":1}),Uu=Zu({},gv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=uF(r,0);return t>32&&t<127&&!zu(e,r)?r:encodeURIComponent(r)},qa={ftp:21,file:null,http:80,https:443,ws:80,wss:443},rs=function(r,e){var t;return r.length==2&&ze(cv,Ae(r,0))&&((t=Ae(r,1))==":"||!e&&t=="|")},tv=function(r){var e;return r.length>1&&rs(is(r,0,2))&&(r.length==2||(e=Ae(r,2))==="/"||e==="\\"||e==="?"||e==="#")},UF=function(r){return r==="."||$a(r)==="%2e"},DF=function(r){return r=$a(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Du={},rv={},Lu={},iv={},nv={},Nu={},sv={},ov={},ja={},Wa={},_u={},Hu={},qu={},ju={},av={},Wu={},ei={},et={},dv={},cr={},ut={},Qu=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw Ju(o);this.searchParams=null}else{if(t!==void 0&&(n=new Qu(t,!0)),o=this.parse(i,null,n),o)throw Ju(o);a=fF(new hF),a.bindURL(this),this.searchParams=a}};Qu.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Du,o=0,a="",c=!1,p=!1,g=!1,f,m,b,v;for(r=ct(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=Yf(r,EF,"")),r=Yf(r,RF,""),f=Yr(r);o<=f.length;){switch(m=f[o],n){case Du:if(m&&ze(cv,m))a+=$a(m),n=rv;else{if(e)return Mu;n=Lu;continue}break;case rv:if(m&&(ze(wF,m)||m=="+"||m=="-"||m=="."))a+=$a(m);else if(m==":"){if(e&&(i.isSpecial()!=zu(qa,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&qa[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=ju:i.isSpecial()&&t&&t.scheme==i.scheme?n=iv:i.isSpecial()?n=ov:f[o+1]=="/"?(n=nv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=dv)}else{if(e)return Mu;a="",n=Lu,o=0;continue}break;case Lu:if(!t||t.cannotBeABaseURL&&m!="#")return Mu;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Ve(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?ju:Nu;continue;case iv:if(m=="/"&&f[o+1]=="/")n=ja,o++;else{n=Nu;continue}break;case nv:if(m=="/"){n=Wa;break}else{n=et;continue}case Nu:if(i.scheme=t.scheme,m==Fe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=sv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.path.length--,n=et;continue}break;case sv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=ja;else if(m=="/")n=Wa;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case ov:if(n=ja,m!="/"||Ae(a,o+1)!="/")continue;o++;break;case ja:if(m!="/"&&m!="\\"){n=Wa;continue}break;case Wa:if(m=="@"){c&&(a="%40"+a),c=!0,b=Yr(a);for(var P=0;P<b.length;P++){var C=b[P];if(C==":"&&!g){g=!0;continue}var F=xt(C,Uu);g?i.password+=F:i.username+=F}a=""}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return CF;o-=Yr(a).length+1,a="",n=_u}else a+=m;break;case _u:case Hu:if(e&&i.scheme=="file"){n=Wu;continue}else if(m==":"&&!p){if(a=="")return ur;if(v=i.parseHost(a),v)return v;if(a="",n=qu,e==Hu)return}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ur;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(v=i.parseHost(a),v)return v;if(a="",n=ei,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case qu:if(ze($u,m))a+=m;else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var I=Ja(a,10);if(I>65535)return ev;i.port=i.isSpecial()&&I===qa[i.scheme]?null:I,a=""}if(e)return;n=ei;continue}else return ev;break;case ju:if(i.scheme="file",m=="/"||m=="\\")n=av;else if(t&&t.scheme=="file")if(m==Fe)i.host=t.host,i.path=Ve(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.host=t.host,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{tv(ts(Ve(f,o),""))||(i.host=t.host,i.path=Ve(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case av:if(m=="/"||m=="\\"){n=Wu;break}t&&t.scheme=="file"&&!tv(ts(Ve(f,o),""))&&(rs(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=et;continue;case Wu:if(m==Fe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&rs(a))n=et;else if(a==""){if(i.host="",e)return;n=ei}else{if(v=i.parseHost(a),v)return v;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ei}continue}else a+=m;break;case ei:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=cr;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=Fe&&(n=et,m!="/"))continue;break;case et:if(m==Fe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(DF(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):UF(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&rs(a)&&(i.host&&(i.host=""),a=Ae(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==Fe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)kF(i.path);m=="?"?(i.query="",n=cr):m=="#"&&(i.fragment="",n=ut)}else a+=xt(m,gv);break;case dv:m=="?"?(i.query="",n=cr):m=="#"?(i.fragment="",n=ut):m!=Fe&&(i.path[0]+=xt(m,Ga));break;case cr:!e&&m=="#"?(i.fragment="",n=ut):m!=Fe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,Ga));break;case ut:m!=Fe&&(i.fragment+=xt(m,pv));break}o++}},parseHost:function(r){var e,t,i;if(Ae(r,0)=="["){if(Ae(r,r.length-1)!="]"||(e=BF(is(r,1,-1)),!e))return ur;this.host=e}else if(this.isSpecial()){if(r=cF(r),ze(TF,r)||(e=OF(r),e===null))return ur;this.host=e}else{if(ze(AF,r))return ur;for(e="",t=Yr(r),i=0;i<t.length;i++)e+=xt(t[i],Ga);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return zu(qa,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!rs(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+=es(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ts(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw Ju(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ri(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+es(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",Du)},getUsername:function(){return this.username},setUsername:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],Uu)}},getPassword:function(){return this.password},setPassword:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],Uu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?es(r):es(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,_u)},getHostname:function(){var r=this.host;return r===null?"":es(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Hu)},getPort:function(){var r=this.port;return r===null?"":ct(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ct(r),r==""?this.port=null:this.parse(r,qu))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ts(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ei))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ae(r,0)=="?"&&(r=is(r,1)),this.query="",this.parse(r,cr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=ct(r),r==""){this.fragment=null;return}Ae(r,0)=="#"&&(r=is(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=lF(this,ne),i=pF(arguments.length,1)>1?arguments[1]:void 0,n=gF(t,new Qu(e,!1,i));Ku||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},ne=ri.prototype,Te=function(r,e){return{get:function(){return za(this)[r]()},set:e&&function(t){return za(this)[e](t)},configurable:!0,enumerable:!0}};Ku&&(Ie(ne,"href",Te("serialize","setHref")),Ie(ne,"origin",Te("getOrigin")),Ie(ne,"protocol",Te("getProtocol","setProtocol")),Ie(ne,"username",Te("getUsername","setUsername")),Ie(ne,"password",Te("getPassword","setPassword")),Ie(ne,"host",Te("getHost","setHost")),Ie(ne,"hostname",Te("getHostname","setHostname")),Ie(ne,"port",Te("getPort","setPort")),Ie(ne,"pathname",Te("getPathname","setPathname")),Ie(ne,"search",Te("getSearch","setSearch")),Ie(ne,"searchParams",Te("getSearchParams")),Ie(ne,"hash",Te("getHash","setHash")));Va(ne,"toJSON",function(){return za(this).serialize()},{enumerable:!0});Va(ne,"toString",function(){return za(this).serialize()},{enumerable:!0});Yn&&(Gu=Yn.createObjectURL,Vu=Yn.revokeObjectURL,Gu&&Va(ri,"createObjectURL",Zf(Gu,Yn)),Vu&&Va(ri,"revokeObjectURL",Zf(Vu,Yn)));var Gu,Vu;mF(ri,"URL");aF({global:!0,constructor:!0,forced:!dF,sham:!Ku},{URL:ri})});var fv=h(()=>{hv()});var vv=h(()=>{"use strict";var LF=Wn(),NF=je();LF({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return NF(URL.prototype.toString,this)}})});var yv=h(()=>{Bu()});var kv=h((lM,bv)=>{var _F=he();bv.exports=_F});var Pv=h((uM,Sv)=>{fv();vv();yv();var HF=kv();Sv.exports=HF.URL});var Ic=h((LL,Ry)=>{var eA=Object.prototype.toString;Ry.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 sA(e)?"generatorfunction":"function";if(tA(e))return"array";if(dA(e))return"buffer";if(aA(e))return"arguments";if(iA(e))return"date";if(rA(e))return"error";if(nA(e))return"regexp";switch(Ey(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(oA(e))return"generator";switch(t=eA.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 Ey(r){return typeof r.constructor=="function"?r.constructor.name:null}function tA(r){return Array.isArray?Array.isArray(r):r instanceof Array}function rA(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function iA(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function nA(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function sA(r,e){return Ey(r)==="GeneratorFunction"}function oA(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function aA(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 dA(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var My=h((NL,By)=>{"use strict";var Oy=Symbol.prototype.valueOf,lA=Ic();function uA(r,e){switch(lA(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 gA(r);case"symbol":return hA(r);case"arraybuffer":return mA(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return pA(r);case"regexp":return cA(r);case"error":return Object.create(r);default:return r}}function cA(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 mA(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function pA(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function gA(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function hA(r){return Oy?Object(Oy.call(r)):{}}By.exports=uA});var Dy=h((_L,Uy)=>{"use strict";Uy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var _y=h((HL,Ny)=>{"use strict";var fA=Dy();function Ly(r){return fA(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Ny.exports=function(e){var t,i;return!(Ly(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ly(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var qy=h((qL,Hy)=>{"use strict";var vA=My(),yA=Ic(),bA=_y();function Fc(r,e){switch(yA(r)){case"object":return kA(r,e);case"array":return SA(r,e);default:return vA(r)}}function kA(r,e){if(typeof e=="function")return e(r);if(e||bA(r)){let t=new r.constructor;for(let i in r)t[i]=Fc(r[i],e);return t}return r}function SA(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Fc(r[i],e);return t}Hy.exports=Fc});var _c=h((hs,Ii)=>{var PA=200,Nc="__lodash_hash_undefined__",yd=1,Yy=2,eb=9007199254740991,cd="[object Arguments]",Rc="[object Array]",CA="[object AsyncFunction]",tb="[object Boolean]",rb="[object Date]",ib="[object Error]",nb="[object Function]",wA="[object GeneratorFunction]",md="[object Map]",sb="[object Number]",xA="[object Null]",xi="[object Object]",jy="[object Promise]",IA="[object Proxy]",ob="[object RegExp]",pd="[object Set]",ab="[object String]",FA="[object Symbol]",TA="[object Undefined]",Oc="[object WeakMap]",db="[object ArrayBuffer]",gd="[object DataView]",AA="[object Float32Array]",EA="[object Float64Array]",RA="[object Int8Array]",OA="[object Int16Array]",BA="[object Int32Array]",MA="[object Uint8Array]",UA="[object Uint8ClampedArray]",DA="[object Uint16Array]",LA="[object Uint32Array]",NA=/[\\^$.*+?()[\]{}|]/g,_A=/^\[object .+?Constructor\]$/,HA=/^(?:0|[1-9]\d*)$/,W={};W[AA]=W[EA]=W[RA]=W[OA]=W[BA]=W[MA]=W[UA]=W[DA]=W[LA]=!0;W[cd]=W[Rc]=W[db]=W[tb]=W[gd]=W[rb]=W[ib]=W[nb]=W[md]=W[sb]=W[xi]=W[ob]=W[pd]=W[ab]=W[Oc]=!1;var lb=typeof global=="object"&&global&&global.Object===Object&&global,qA=typeof self=="object"&&self&&self.Object===Object&&self,ht=lb||qA||Function("return this")(),ub=typeof hs=="object"&&hs&&!hs.nodeType&&hs,Wy=ub&&typeof Ii=="object"&&Ii&&!Ii.nodeType&&Ii,cb=Wy&&Wy.exports===ub,Tc=cb&&lb.process,Gy=function(){try{return Tc&&Tc.binding&&Tc.binding("util")}catch{}}(),Vy=Gy&&Gy.isTypedArray;function jA(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 WA(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function GA(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 VA(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function zA(r){return function(e){return r(e)}}function JA(r,e){return r.has(e)}function $A(r,e){return r?.[e]}function KA(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function XA(r,e){return function(t){return r(e(t))}}function ZA(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var QA=Array.prototype,YA=Function.prototype,bd=Object.prototype,Ac=ht["__core-js_shared__"],mb=YA.toString,rt=bd.hasOwnProperty,zy=function(){var r=/[^.]+$/.exec(Ac&&Ac.keys&&Ac.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),pb=bd.toString,eE=RegExp("^"+mb.call(rt).replace(NA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Jy=cb?ht.Buffer:void 0,hd=ht.Symbol,$y=ht.Uint8Array,gb=bd.propertyIsEnumerable,tE=QA.splice,br=hd?hd.toStringTag:void 0,Ky=Object.getOwnPropertySymbols,rE=Jy?Jy.isBuffer:void 0,iE=XA(Object.keys,Object),Bc=Fi(ht,"DataView"),fs=Fi(ht,"Map"),Mc=Fi(ht,"Promise"),Uc=Fi(ht,"Set"),Dc=Fi(ht,"WeakMap"),vs=Fi(Object,"create"),nE=Pr(Bc),sE=Pr(fs),oE=Pr(Mc),aE=Pr(Uc),dE=Pr(Dc),Xy=hd?hd.prototype:void 0,Ec=Xy?Xy.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 lE(){this.__data__=vs?vs(null):{},this.size=0}function uE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function cE(r){var e=this.__data__;if(vs){var t=e[r];return t===Nc?void 0:t}return rt.call(e,r)?e[r]:void 0}function mE(r){var e=this.__data__;return vs?e[r]!==void 0:rt.call(e,r)}function pE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=vs&&e===void 0?Nc:e,this}kr.prototype.clear=lE;kr.prototype.delete=uE;kr.prototype.get=cE;kr.prototype.has=mE;kr.prototype.set=pE;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function gE(){this.__data__=[],this.size=0}function hE(r){var e=this.__data__,t=kd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():tE.call(e,t,1),--this.size,!0}function fE(r){var e=this.__data__,t=kd(e,r);return t<0?void 0:e[t][1]}function vE(r){return kd(this.__data__,r)>-1}function yE(r,e){var t=this.__data__,i=kd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=gE;ft.prototype.delete=hE;ft.prototype.get=fE;ft.prototype.has=vE;ft.prototype.set=yE;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 bE(){this.size=0,this.__data__={hash:new kr,map:new(fs||ft),string:new kr}}function kE(r){var e=Sd(this,r).delete(r);return this.size-=e?1:0,e}function SE(r){return Sd(this,r).get(r)}function PE(r){return Sd(this,r).has(r)}function CE(r,e){var t=Sd(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Sr.prototype.clear=bE;Sr.prototype.delete=kE;Sr.prototype.get=SE;Sr.prototype.has=PE;Sr.prototype.set=CE;function fd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Sr;++e<t;)this.add(r[e])}function wE(r){return this.__data__.set(r,Nc),this}function xE(r){return this.__data__.has(r)}fd.prototype.add=fd.prototype.push=wE;fd.prototype.has=xE;function Ut(r){var e=this.__data__=new ft(r);this.size=e.size}function IE(){this.__data__=new ft,this.size=0}function FE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function TE(r){return this.__data__.get(r)}function AE(r){return this.__data__.has(r)}function EE(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!fs||i.length<PA-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}Ut.prototype.clear=IE;Ut.prototype.delete=FE;Ut.prototype.get=TE;Ut.prototype.has=AE;Ut.prototype.set=EE;function RE(r,e){var t=vd(r),i=!t&&zE(r),n=!t&&!i&&Lc(r),o=!t&&!i&&!n&&Sb(r),a=t||i||n||o,c=a?VA(r.length,String):[],p=c.length;for(var g in r)(e||rt.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||qE(g,p)))&&c.push(g);return c}function kd(r,e){for(var t=r.length;t--;)if(vb(r[t][0],e))return t;return-1}function OE(r,e,t){var i=e(r);return vd(r)?i:WA(i,t(r))}function bs(r){return r==null?r===void 0?TA:xA:br&&br in Object(r)?_E(r):VE(r)}function Zy(r){return ys(r)&&bs(r)==cd}function hb(r,e,t,i,n){return r===e?!0:r==null||e==null||!ys(r)&&!ys(e)?r!==r&&e!==e:BE(r,e,t,i,hb,n)}function BE(r,e,t,i,n,o){var a=vd(r),c=vd(e),p=a?Rc:Mt(r),g=c?Rc:Mt(e);p=p==cd?xi:p,g=g==cd?xi:g;var f=p==xi,m=g==xi,b=p==g;if(b&&Lc(r)){if(!Lc(e))return!1;a=!0,f=!1}if(b&&!f)return o||(o=new Ut),a||Sb(r)?fb(r,e,t,i,n,o):LE(r,e,p,t,i,n,o);if(!(t&yd)){var v=f&&rt.call(r,"__wrapped__"),P=m&&rt.call(e,"__wrapped__");if(v||P){var C=v?r.value():r,F=P?e.value():e;return o||(o=new Ut),n(C,F,t,i,o)}}return b?(o||(o=new Ut),NE(r,e,t,i,n,o)):!1}function ME(r){if(!kb(r)||WE(r))return!1;var e=yb(r)?eE:_A;return e.test(Pr(r))}function UE(r){return ys(r)&&bb(r.length)&&!!W[bs(r)]}function DE(r){if(!GE(r))return iE(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function fb(r,e,t,i,n,o){var a=t&yd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var g=o.get(r);if(g&&o.get(e))return g==e;var f=-1,m=!0,b=t&Yy?new fd:void 0;for(o.set(r,e),o.set(e,r);++f<c;){var v=r[f],P=e[f];if(i)var C=a?i(P,v,f,e,r,o):i(v,P,f,r,e,o);if(C!==void 0){if(C)continue;m=!1;break}if(b){if(!GA(e,function(F,I){if(!JA(b,I)&&(v===F||n(v,F,t,i,o)))return b.push(I)})){m=!1;break}}else if(!(v===P||n(v,P,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function LE(r,e,t,i,n,o,a){switch(t){case gd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case db:return!(r.byteLength!=e.byteLength||!o(new $y(r),new $y(e)));case tb:case rb:case sb:return vb(+r,+e);case ib:return r.name==e.name&&r.message==e.message;case ob:case ab:return r==e+"";case md:var c=KA;case pd:var p=i&yd;if(c||(c=ZA),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=Yy,a.set(r,e);var f=fb(c(r),c(e),i,n,o,a);return a.delete(r),f;case FA:if(Ec)return Ec.call(r)==Ec.call(e)}return!1}function NE(r,e,t,i,n,o){var a=t&yd,c=Qy(r),p=c.length,g=Qy(e),f=g.length;if(p!=f&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:rt.call(e,b)))return!1}var v=o.get(r);if(v&&o.get(e))return v==e;var P=!0;o.set(r,e),o.set(e,r);for(var C=a;++m<p;){b=c[m];var F=r[b],I=e[b];if(i)var ge=a?i(I,F,b,e,r,o):i(F,I,b,r,e,o);if(!(ge===void 0?F===I||n(F,I,t,i,o):ge)){P=!1;break}C||(C=b=="constructor")}if(P&&!C){var Un=r.constructor,sa=e.constructor;Un!=sa&&"constructor"in r&&"constructor"in e&&!(typeof Un=="function"&&Un instanceof Un&&typeof sa=="function"&&sa instanceof sa)&&(P=!1)}return o.delete(r),o.delete(e),P}function Qy(r){return OE(r,KE,HE)}function Sd(r,e){var t=r.__data__;return jE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Fi(r,e){var t=$A(r,e);return ME(t)?t:void 0}function _E(r){var e=rt.call(r,br),t=r[br];try{r[br]=void 0;var i=!0}catch{}var n=pb.call(r);return i&&(e?r[br]=t:delete r[br]),n}var HE=Ky?function(r){return r==null?[]:(r=Object(r),jA(Ky(r),function(e){return gb.call(r,e)}))}:XE,Mt=bs;(Bc&&Mt(new Bc(new ArrayBuffer(1)))!=gd||fs&&Mt(new fs)!=md||Mc&&Mt(Mc.resolve())!=jy||Uc&&Mt(new Uc)!=pd||Dc&&Mt(new Dc)!=Oc)&&(Mt=function(r){var e=bs(r),t=e==xi?r.constructor:void 0,i=t?Pr(t):"";if(i)switch(i){case nE:return gd;case sE:return md;case oE:return jy;case aE:return pd;case dE:return Oc}return e});function qE(r,e){return e=e??eb,!!e&&(typeof r=="number"||HA.test(r))&&r>-1&&r%1==0&&r<e}function jE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function WE(r){return!!zy&&zy in r}function GE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||bd;return r===t}function VE(r){return pb.call(r)}function Pr(r){if(r!=null){try{return mb.call(r)}catch{}try{return r+""}catch{}}return""}function vb(r,e){return r===e||r!==r&&e!==e}var zE=Zy(function(){return arguments}())?Zy:function(r){return ys(r)&&rt.call(r,"callee")&&!gb.call(r,"callee")},vd=Array.isArray;function JE(r){return r!=null&&bb(r.length)&&!yb(r)}var Lc=rE||ZE;function $E(r,e){return hb(r,e)}function yb(r){if(!kb(r))return!1;var e=bs(r);return e==nb||e==wA||e==CA||e==IA}function bb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=eb}function kb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function ys(r){return r!=null&&typeof r=="object"}var Sb=Vy?zA(Vy):UE;function KE(r){return JE(r)?RE(r):DE(r)}function XE(){return[]}function ZE(){return!1}Ii.exports=$E});var dS=h(Ld=>{"use strict";Ld.byteLength=xR;Ld.toByteArray=FR;Ld.fromByteArray=ER;var st=[],_e=[],wR=typeof Uint8Array<"u"?Uint8Array:Array,vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Lr=0,oS=vm.length;Lr<oS;++Lr)st[Lr]=vm[Lr],_e[vm.charCodeAt(Lr)]=Lr;var Lr,oS;_e[45]=62;_e[95]=63;function aS(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=aS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function IR(r,e,t){return(e+t)*3/4-t}function FR(r){var e,t=aS(r),i=t[0],n=t[1],o=new wR(IR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=_e[r.charCodeAt(p)]<<18|_e[r.charCodeAt(p+1)]<<12|_e[r.charCodeAt(p+2)]<<6|_e[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=_e[r.charCodeAt(p)]<<2|_e[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=_e[r.charCodeAt(p)]<<10|_e[r.charCodeAt(p+1)]<<4|_e[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function TR(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function AR(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(TR(i));return n.join("")}function ER(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(AR(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(st[e>>2]+st[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),n.join("")}});var pq=Dn(Pv(),1);function y(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function mr(r,e){if(!r)throw Error(e)}var se;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(se||(se={}));function It(r){return r.startsWith(se.COMMENT)}function Ka(r){return r.startsWith(se.ACCOUNT)}function pr(r){return r.startsWith(se.LINK)}function Cv(r){return r.startsWith(se.MESSAGE)}function wv(r){return r.startsWith(se.SUBREDDIT)}function xv(r){return r.startsWith(se.AWARD)}function qF(r){mr(It(r),`Expected comment id to start with ${se.COMMENT}, got ${r}}`)}function jF(r){mr(Ka(r),`Expected account id to start with ${se.ACCOUNT}, got ${r}}`)}function WF(r){mr(pr(r),`Expected link id to start with ${se.LINK}, got ${r}}`)}function GF(r){mr(Cv(r),`Expected message id to start with ${se.MESSAGE}, got ${r}}`)}function VF(r){mr(wv(r),`Expected subreddit id to start with ${se.SUBREDDIT}, got ${r}}`)}function zF(r){mr(xv(r),`Expected award id to start with ${se.AWARD}, got ${r}}`)}function ii(r){return qF(r),r}function oe(r){return jF(r),r}function ye(r){return WF(r),r}function JF(r){return GF(r),r}function ie(r){return VF(r),r}function $F(r){return zF(r),r}function Re(r){if(It(r))return ii(r);if(Ka(r))return oe(r);if(pr(r))return ye(r);if(Cv(r))return JF(r);if(wv(r))return ie(r);if(xv(r))return $F(r);throw new Error(`Expected thing id to start with ${Object.values(se).join(", ")} got ${r}}`)}function Yu(r){return It(r)}import*as w from"@devvit/protos";var Xa=class{constructor(e){}};var ec=(t=>(t.Installation="installation",t.App="app",t))(ec||{});function gr(r,e=new Set){for(let t of r){if(t.type==="group"){gr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}KF(r)}function KF(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 Ft=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","caret-updown","planet","telescope"];import{AppSettingsDefinition as uT,GetFieldsResponse as cT}from"@devvit/protos";import{FormFieldType as Oe}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return XF(e);case"image":return ZF(e);case"paragraph":return QF(e);case"number":return YF(e);case"select":return eT(e);case"boolean":return tT(e);case"group":return rT(e);default:throw new Error("Unknown field type.")}})}function XF(r){return{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 ZF(r){return{disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required}}function QF(r){return{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 YF(r){return{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 eT(r){return{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 tT(r){return{defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label}}function rT(r){return{fieldId:"",fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText}}function M(r,e){u.prototype[r]=e}import{ValidateFormResponse as lT}from"@devvit/protos";import{RealtimeSubscriptionStatus as Fv}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",Post:"devvit-post",PostAuthor:"devvit-post-author",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",SubredditName:"devvit-subreddit-name",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),Iv;(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"})(Iv||(Iv={}));function Tv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];y(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];y(p,"useChannel - installation is missing from Context");async function g(F){let I=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(I,F);else throw Error(`Failed to send to channel '${I}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${I}`)}function f(){if(!o[n].active){let F=o[n].channel;o[n].active=!0,r.addRealtimeChannel(F)}}function m(){if(o[n].active){let F=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(F)}}function b(F){return async()=>{let I;switch(F.status){case Fv.REALTIME_SUBSCRIBED:o[n].connected=!0,I=t.onSubscribed?.();break;case Fv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,I=t.onUnsubscribed?.();break;default:I=t.onMessage(F.event?.data?.msg);break}await I}}let v={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Ft.CHANNEL};n in o?v=o[n]:n in a&&(v=a[n]);let P=r.realtimeEvent;r.isInitialRender?v.active=!1:P&&v.active&&P.event.channel===v.channel&&(v.preventCallback||r.runHook(b(P)),r.rerenderIn(0)),o[n]=v,r.currentHookIndex++;let C=0;return v.active&&v.connected?C=2:v.active&&!v.connected?C=1:!v.active&&v.connected?C=3:!v.active&&!v.connected&&(C=4),{subscribe:f,unsubscribe:m,send:g,status:C}}return e}import{FormFieldType as ni}from"@devvit/protos";function tc(r){switch(r.fieldType){case ni.STRING:return r.stringValue;case ni.IMAGE:return r.stringValue;case ni.PARAGRAPH:return r.stringValue;case ni.NUMBER:return r.numberValue;case ni.BOOLEAN:return r.boolValue;case ni.SELECTION:return r.selectionValue?.values??[];default:return}}function Tt(r){return Object.keys(r).reduce((e,t)=>{let i=tc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Av(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:Ft.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let f=r.formSubmittedEvent;return f&&!g.preventSubmit&&f.formId===p&&r.runHook(async()=>{let m=i(Tt(f.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function Ev(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:Ft.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function f(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,v]of Object.entries(o))if(b!==n.toString()&&v?.type===Ft.INTERVAL&&v?.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:Ft.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&g.running&&(g.preventCallback||(g.lastRun===void 0||g.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:f,stop:m}}return e}function Rv(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState();if(i in n)return r.currentHookIndex++,[n[i],a];if(r.isInitialRender||!(i in o)){let c=t instanceof Function?t():t;if(c instanceof Promise)throw(async()=>{n[i]=await c,r.currentHookIndex=0})();n[i]=c}else n[i]=o[i];function a(c){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=c instanceof Function?c(n[i]):c}return r.currentHookIndex++,[n[i],a]}return e}var sc={now(){return new Date}};function Ov(r){return`__autocache__${r}`}function Bv(r){return`__lock__${r}`}var nT=300,sT=1e3,Za=5e3,rc=3,Mv=.1,Uv=1e3,oT=3e4;function Dv(r){if(r.error)throw new Error(r.error);return r.value}var At,Et,Be,si,$,Lv,Nv,_v,ic,Hv,qv,nc,jv,Qa=class{constructor(e,t,i=sc){l(this,$);l(this,At);l(this,Et,{});l(this,Be);l(this,si);d(this,At,e),d(this,si,t),d(this,Be,i)}async cache(e,t){d(this,Et,s(this,si).__cache=s(this,si).__cache??{}),S(this,$,jv).call(this,t);let i=S(this,$,Lv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,nc).call(this,t.key),o=await S(this,$,Nv).call(this,t,n,e);return Dv(o)}};At=new WeakMap,Et=new WeakMap,Be=new WeakMap,si=new WeakMap,$=new WeakSet,Lv=function(e){let t=s(this,Et)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<rc&&Math.random()<Mv&&t.errorTime+Uv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Uv<i||n){delete s(this,Et)[e];return}else return Dv(t)}},Nv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,qv).call(this,n):1;return!t||t?.error&&t.errorCount<rc&&Mv>Math.random()||o>Math.random()?S(this,$,_v).call(this,e,t,i):t},_v=async function(e,t,i){let n=Bv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,At).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Hv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,ic).call(this,p,e.key,e.ttl)}},ic=async function(e,t,i){let n=Math.min(i,sT),o=await S(this,$,nc).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,nT)),S(this,$,ic).call(this,e,t,i)},Hv=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,Et)[e]=t,await s(this,At).set(Ov(e),JSON.stringify(t),{expiration:new Date(o+oT)}),t.error&&t.errorCount<rc&&await s(this,At).del(Bv(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},nc=async function(e){let t=await s(this,At).get(Ov(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Et)[e]=i,i}},jv=function(e){e.ttl<Za&&(console.warn(`Cache TTL cannot be less than ${Za} milliseconds! Updating ttl value of ${e.ttl} to ${Za}.`),e.ttl=Za)};function Wv(r,e,t=sc){let i=new Qa(r,e,t);return i.cache.bind(i)}function Gv(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,Vv,zv,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,Vv).call(this,e,t??{webview:!1}):S(this,li,zv).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,Vv=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return Gv(e),encodeURI(e)}catch{return""}},zv=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{Gv(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 Rt,ui=class{constructor(e){l(this,Rt);d(this,Rt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Rt));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,Rt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Rt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Rt));return e}};Rt=new WeakMap;var ns,ci=class{constructor(e){l(this,ns);d(this,ns,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,ns));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};ns=new WeakMap;var ss,mi=class{constructor(e){l(this,ss);d(this,ss,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ss))}};ss=new WeakMap;var os,pi=class{constructor(e){l(this,os);d(this,os,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:{msg:t}},s(this,os))}};os=new WeakMap;var k,as,gi=class{constructor(e){l(this,k);l(this,as);d(this,k,e),d(this,as,new ed(e))}get modMail(){return s(this,as)}getSubredditById(e){return be.getById(Re(e),s(this,k))}getSubredditInfoById(e){return $v(e,s(this,k))}getSubredditByName(e){return be.getByName(e,s(this,k))}getSubredditInfoByName(e){return Kv(e,s(this,k))}addSubredditRemovalReason(e,t){return be.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return be.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return be.getFromMetadata(s(this,k))}getPostById(e){return z.getById(Re(e),s(this,k))}submitPost(e){return z.submit(e,s(this,k))}crosspost(e){return z.crosspost(e,s(this,k))}getUserById(e){return x.getById(Re(e),s(this,k))}getUserByUsername(e){return x.getByUsername(e,s(this,k))}getCurrentUser(){return x.getFromMetadata(D.User,s(this,k))}getAppUser(){return x.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return x.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return te.getById(Re(e),s(this,k))}getComments(e){return te.getComments(e,s(this,k))}getCommentsByUser(e){return te.getCommentsByUser(e,s(this,k))}submitComment(e){return te.submit({...e,id:Re(e.id)},s(this,k))}getControversialPosts(e){return z.getControversialPosts(e,s(this,k))}getTopPosts(e){return z.getTopPosts(e,s(this,k))}getHotPosts(e){return z.getHotPosts(e,s(this,k))}getNewPosts(e){return z.getNewPosts(e,s(this,k))}getRisingPosts(e){return z.getRisingPosts(e,s(this,k))}getPostsByUser(e){return z.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return x.getOverview(e,s(this,k))}getModerationLog(e){return Ya(e,s(this,k))}getApprovedUsers(e){return x.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return x.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return x.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return x.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return x.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return x.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration,banContext:e.context},s(this,k))}unbanUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return x.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return x.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return x.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return x.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.username,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return x.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return x.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return x.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return x.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return x.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?Re(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(It(e))return te.approve(e,s(this,k));if(pr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(It(e))return te.remove(e,t,s(this,k));if(pr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return ue.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return ue.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return ue.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return ue.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return ue.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return ue.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,ye(t),s(this,k))}async getWidgets(e){return ae.getWidgets(e,s(this,k))}async deleteWidget(e,t){return ae.delete(e,t,s(this,k))}async addWidget(e){return ae.add(e,s(this,k))}async reorderWidgets(e,t){return ae.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ke.getPage(e,t,s(this,k))}async getWikiPages(e){return ke.getPages(e,s(this,k))}async createWikiPage(e){return ke.createPage(e,s(this,k))}async updateWikiPage(e){return ke.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ke.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ke.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ke.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ke.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ke.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ke.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 be.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return be.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return be.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return be.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return be.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return Qv(e,s(this,k))}getVaultByUserId(e){return Yv(Re(e),s(this,k))}getSubredditLeaderboard(e){return Xv(e,s(this,k))}getSubredditStyles(e){return Zv(e,s(this,k))}};k=new WeakMap,as=new WeakMap;import{RedisKeyScope as oc}from"@devvit/protos";function td(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var R,O,B,ac=class{constructor(e,t,i){l(this,R);l(this,O);l(this,B);d(this,R,e),d(this,O,t),d(this,B,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,O)},s(this,B)),this}async multi(){await s(this,R).Multi(s(this,O),s(this,B))}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,R).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,O)},s(this,B)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,O)},s(this,B)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,O)},s(this,B)),this}async exec(){let e=await s(this,R).Exec(s(this,O),s(this,B)),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,R).Discard(s(this,O),s(this,B))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,O)},s(this,B)),this}async unwatch(){return await s(this,R).Unwatch(s(this,O),s(this,B)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,O)},s(this,B)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,O)},s(this,B)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,R).Strlen({key:e,transactionId:s(this,O)},s(this,B)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,R).MGet({keys:e,transactionId:s(this,O)},s(this,B)),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,R).MSet({kv:t,transactionId:s(this,O)},s(this,B)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,O)},s(this,B)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,O)},s(this,B)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,O)},s(this,B)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,O)},s(this,B)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,O)},member:t},s(this,B)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,O)},member:t},s(this,B)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,O)},s(this,B)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,O)};return await s(this,R).ZScan(o,s(this,B)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,O)},s(this,B)),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,R).ZRange({key:{key:e,transactionId:s(this,O)},start:t+"",stop:i+"",...o},s(this,B)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,O)},members:t},s(this,B)),this}async zRemRangeByLex(e,t,i){return await s(this,R).ZRemRangeByLex({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,B)),this}async zRemRangeByRank(e,t,i){return await s(this,R).ZRemRangeByRank({key:{key:e,transactionId:s(this,O)},start:t,stop:i},s(this,B)),this}async zRemRangeByScore(e,t,i){return await s(this,R).ZRemRangeByScore({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,B)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,R).HGetAll({key:e,transactionId:s(this,O)},s(this,B)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,R).HGet({key:e,field:t,transactionId:s(this,O)},s(this,B)),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,R).HSet({key:e,fv:i,transactionId:s(this,O)},s(this,B)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,R).HIncrBy({key:e,field:t,value:i,transactionId:s(this,O)},s(this,B)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,R).HDel({key:e,fields:t,transactionId:s(this,O)},s(this,B)),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,O)};return await s(this,R).HScan(o,s(this,B)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,R).HKeys({key:e,transactionId:s(this,O)},s(this,B)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,R).HLen({key:e,transactionId:s(this,O)},s(this,B)),this}};R=new WeakMap,O=new WeakMap,B=new WeakMap;var U,hi,dc=class dc{constructor(e,t=void 0,i=oc.INSTALLATION){l(this,U);l(this,hi);d(this,U,e),d(this,hi,t),this.scope=i,this.global=i===oc.INSTALLATION?new dc(s(this,U),s(this,hi),oc.GLOBAL):this}get storage(){return s(this,hi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,U));return new ac(this.storage,t,s(this,U))}async get(e){try{let t=await this.storage.Get({key:e,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return t!==null?t.value??void 0:t}catch(t){if(td(t))return;throw t}}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,U))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,U))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,U))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,U));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,U))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,U))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,U))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,U))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,U))).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,U))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,U))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,U))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,U))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,U))).value}async zScore(e,t){try{let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zRank(e,t){try{let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,U));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,U));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,U))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,U));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,U))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,U));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,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value??void 0:i}catch(i){if(td(i))return;throw i}}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([o,a])=>({field:o,value:a}));return(await this.storage.HSet({key:e,fv:i,scope:this.scope},s(this,U))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,U));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,U))).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,U))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,U));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,U))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};U=new WeakMap,hi=new WeakMap;var fi=dc;var fr,vi=class{constructor(e){l(this,fr);d(this,fr,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,fr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,fr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,fr))).actions.map(t=>(y(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 ds,yi=class{constructor(e){l(this,ds);d(this,ds,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,ds));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...ey(t.installationSettings.settings,u.installationSettings),...ey(t.appSettings.settings,u.appSettings)}}};ds=new WeakMap;function ey(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=tc(r[n]),i),{});return e&&ty(t,e),t}function ty(r,e){for(let t of e)t.type==="group"?ty(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as lc,ToastAppearance as ry}from"@devvit/protos";var vr,bi,rd=class{constructor(e){l(this,vr,[]);l(this,bi);d(this,bi,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,bi)){let a=s(this,bi).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o={fields:[],id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description};gr(n.fields),o.fields=mt(n.fields),s(this,vr).push({type:lc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?ry.SUCCESS:ry.NEUTRAL}:t={text:e},s(this,vr).push({type:lc.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,vr).push({type:lc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,vr)}};vr=new WeakMap,bi=new WeakMap;function De({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new fi(r),c=Wv(a,i?i.state:{}),p=new gi(r),g=new vi(r),f=new yi(r),m=e?new rd(i):void 0,b=new ci(r),v=new di,P=new pi(r),C=t&&i?Rv(i):void 0,F=t&&i?Ev(i):void 0,I=t&&i?Av(i):void 0,ge=t&&i?Tv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:f,media:b,assets:v,realtime:P,get useForm(){return I??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return C??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return F??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return ge??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var iy={name:"@devvit/public-api",version:"0.11.2-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.2-dev","@devvit/shared-types":"0.11.2-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/repo-tools":"0.11.2-dev","@devvit/tsconfig":"0.11.2-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"18.0.1","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"9.11.1",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"256 KB"}},source:"./src/index.ts"};function ce(r,e,t){let i=r[D.Subreddit]?.values[0];y(i,"subreddit is missing from Context");let n=r[D.SubredditName]?.values[0],o=r[D.AppUser]?.values[0],a=r[D.App]?.values[0],c=r[D.Version]?.values[0],p=r[D.User]?.values[0],g=dT(r);return{get appAccountId(){return y(o,"appAccountId is missing from Context"),o},subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,appName:a,appVersion:c,debug:g,toJSON(){return{appAccountId:o,appName:a,appVersion:c,subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,debug:g}}}}function dT(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${iy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function ny(r){return r.flatMap(e=>e.type==="group"?ny(e.fields):e)}async function id(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Tt(r.fieldValues),o=ny(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,f=Object.assign(De({metadata:t}),ce(t)),m=await g({value:p,isEditing:r.editing},f);m&&(i.success=!1,i.errors[c]=m)}})),lT.fromJSON(i)}async function mT(){if(!u.appSettings)throw new Error("App settings were not defined.");return cT.fromJSON({fields:{fields:mt(u.appSettings)}})}async function pT(r,e){return id(r,u.appSettings,e)}function sy(r){r.provides(uT),M("GetAppSettingsFields",mT),M("ValidateAppForm",pT)}import{CustomPostDefinition as kT,RenderPostResponse as ST}from"@devvit/protos";import{BlockRenderEventType as Cc,EffectType as ky}from"@devvit/protos";function ki(r){return r.__effects}function oy(){let r=new Set;return e=>{let t=e,i=1;for(;r.has(t);)t=`${e}.${i++}`;return r.add(t),t}}import{BlockActionType as Pc,BlockAvatarBackground as fy,BlockAvatarFacing as vy,BlockAvatarSize as Ot,BlockBorderWidth as ad,BlockButtonAppearance as Bt,BlockButtonSize as gc,BlockGap as dd,BlockHorizontalAlignment as hc,BlockIconSize as ld,BlockImageResizeMode as ls,BlockPadding as us,BlockRadius as cs,BlockSpacerShape as fc,BlockSpacerSize as ud,BlockStackDirection as vc,BlockTextOutline as yc,BlockTextOverflow as bc,BlockTextSize as Pi,BlockTextStyle as kc,BlockTextWeight as yy,BlockType as tt,BlockVerticalAlignment as Sc}from"@devvit/protos";var uc={"alienblue-100":"#DCE2FB","alienblue-200":"#B8C5FC","alienblue-25":"#F7F8FD","alienblue-300":"#90A9FD","alienblue-400":"#648EFC","alienblue-50":"#EEF0FB","alienblue-500":"#1870F4","alienblue-600":"#115BCA","alienblue-700":"#0A449B","alienblue-75":"#E6E9FB","alienblue-800":"#0A2F6C","alienblue-900":"#0A1A3F","alienblue-950":"#07102B","berrypurple-100":"#F3DAFB","berrypurple-200":"#EAB3FD","berrypurple-25":"#FBF6FD","berrypurple-300":"#DE8BFF","berrypurple-400":"#CF5FFF","berrypurple-50":"#F8EDFC","berrypurple-500":"#BC0EFF","berrypurple-600":"#9B00D4","berrypurple-700":"#7600A3","berrypurple-75":"#F6E4FB","berrypurple-800":"#520472","berrypurple-900":"#300643","berrypurple-950":"#20042A",black:"#000000","black-opacity-0":"#00000000","black-opacity-10":"#00000019","black-opacity-15":"#00000026","black-opacity-20":"#00000033","black-opacity-25":"#0000003F","black-opacity-33":"#00000054","black-opacity-5":"#0000000C","black-opacity-50":"#0000007F","black-opacity-60":"#00000099","black-opacity-67":"#000000AA","black-opacity-80":"#000000CC","black-opacity-90":"#000000E5","brown-100":"#F1DFCF","brown-200":"#E9BE95","brown-25":"#FBF7F4","brown-300":"#DC9D5D","brown-400":"#BA854E","brown-50":"#F7EFE9","brown-500":"#9A6D3F","brown-600":"#7B5631","brown-700":"#5D4023","brown-75":"#F4E7DC","brown-800":"#3F2C19","brown-900":"#221A11","brown-950":"#15100A","coolgray-100":"#DBE4E9","coolgray-150":"#C9D7DE","coolgray-200":"#B7CAD4","coolgray-25":"#F6F8F9","coolgray-250":"#A4BDCA","coolgray-300":"#97AFBC","coolgray-350":"#8BA2AD","coolgray-400":"#7F949F","coolgray-450":"#748791","coolgray-50":"#EEF1F3","coolgray-500":"#667780","coolgray-525":"#576F76","coolgray-550":"#5C6C74","coolgray-600":"#536168","coolgray-650":"#48545B","coolgray-700":"#3D494E","coolgray-75":"#E5EBEE","coolgray-750":"#333D42","coolgray-800":"#2A3236","coolgray-850":"#21272A","coolgray-900":"#181C1F","coolgray-950":"#0E1113","global-black":{light:"#000000",dark:"#000000"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-white":{light:"#FFFFFF",dark:"#FFFFFF"},"kiwigreen-100":"#A8F5A0","kiwigreen-200":"#58E15B","kiwigreen-25":"#EBFDE7","kiwigreen-300":"#00C61C","kiwigreen-400":"#01A816","kiwigreen-50":"#DDF8D7","kiwigreen-500":"#008A10","kiwigreen-600":"#016E0B","kiwigreen-700":"#005306","kiwigreen-75":"#CAF5C2","kiwigreen-800":"#033902","kiwigreen-900":"#0D2005","kiwigreen-950":"#081404","lightblue-100":"#CAE7FB","lightblue-200":"#87D0FD","lightblue-25":"#F3F9FD","lightblue-300":"#02B9FB","lightblue-400":"#029DD5","lightblue-50":"#E6F3FC","lightblue-500":"#007FAE","lightblue-600":"#01668D","lightblue-700":"#014D6B","lightblue-75":"#D9EDFB","lightblue-800":"#03354B","lightblue-900":"#051E2B","lightblue-950":"#04131A","lime-100":"#B7F28E","lime-200":"#90DA58","lime-25":"#EEFDDC","lime-300":"#6DBF01","lime-400":"#5BA200","lime-50":"#E0F8C8","lime-500":"#4A8500","lime-600":"#3A6A00","lime-700":"#2A5000","lime-75":"#CEF5AD","lime-800":"#1E3702","lime-900":"#151E05","lime-950":"#0D1304","mintgreen-100":"#9BF5D9","mintgreen-200":"#00E2B7","mintgreen-25":"#E7FDF5","mintgreen-300":"#00C29D","mintgreen-400":"#01A484","mintgreen-50":"#D7F8EC","mintgreen-500":"#01876D","mintgreen-600":"#006C56","mintgreen-700":"#015140","mintgreen-75":"#C0F5E3","mintgreen-800":"#00382B","mintgreen-900":"#032019","mintgreen-950":"#03140F","orangered-100":"#FCDBCF","orangered-200":"#FDB498","orangered-25":"#FDF6F4","orangered-300":"#FF895D","orangered-400":"#FF4500","orangered-50":"#FCEEE8","orangered-500":"#D93900","orangered-600":"#AE2C00","orangered-700":"#842100","orangered-75":"#FBE5DC","orangered-800":"#591B02","orangered-900":"#2F1405","orangered-950":"#1C0D04","periwinkle-100":"#E6DFFB","periwinkle-200":"#CDBEFD","periwinkle-25":"#F9F7FD","periwinkle-300":"#B29FFF","periwinkle-400":"#9580FF","periwinkle-50":"#F2EFFC","periwinkle-500":"#6A5CFF","periwinkle-600":"#523DFF","periwinkle-700":"#4001EA","periwinkle-75":"#ECE7FB","periwinkle-800":"#250AA6","periwinkle-900":"#160E5B","periwinkle-950":"#0C083F","poopbrown-100":"#FEEEDD","poopbrown-200":"#F6DDC3","poopbrown-300":"#EECCAA","poopbrown-400":"#CAA075","poopbrown-50":"#FEF7EE","poopbrown-500":"#9A6D3F","poopbrown-600":"#6E4924","poopbrown-700":"#54371A","poopbrown-800":"#3B2510","poopbrown-900":"#29190A","poopbrown-950":"#110B04","puregray-100":"#F2F2F2","puregray-150":"#EBEBEB","puregray-200":"#E4E4E4","puregray-250":"#DDDDDD","puregray-300":"#D6D6D6","puregray-350":"#C3C3C3","puregray-400":"#ACACAC","puregray-450":"#919191","puregray-50":"#F8F8F8","puregray-500":"#767676","puregray-550":"#5C5C5C","puregray-600":"#434343","puregray-650":"#393939","puregray-700":"#303030","puregray-750":"#272727","puregray-800":"#1E1E1E","puregray-850":"#181818","puregray-900":"#131313","puregray-950":"#080808","red-100":"#FBDBD4","red-200":"#FDB3A4","red-25":"#FDF6F5","red-300":"#FF8773","red-400":"#FF4F40","red-50":"#FCEEEA","red-500":"#EB001F","red-600":"#BC0117","red-700":"#90000F","red-75":"#FBE4DF","red-800":"#650405","red-900":"#340F05","red-950":"#1F0B04","sakurapink-100":"#FBD9EB","sakurapink-200":"#FDAEDA","sakurapink-25":"#FDF6F9","sakurapink-300":"#FF7ECA","sakurapink-400":"#FF38BB","sakurapink-50":"#FCEDF4","sakurapink-500":"#DE019F","sakurapink-600":"#B2007F","sakurapink-700":"#880060","sakurapink-75":"#FBE3EF","sakurapink-800":"#5F0443","sakurapink-900":"#380626","sakurapink-950":"#250419",transparent:"transparent",white:"#ffffff","white-opacity-0":"#FFFFFF00","white-opacity-10":"#FFFFFF19","white-opacity-15":"#FFFFFF26","white-opacity-20":"#FFFFFF33","white-opacity-25":"#FFFFFF3F","white-opacity-5":"#FFFFFF0C","white-opacity-50":"#FFFFFF7F","yellow-100":"#FFE284","yellow-200":"#FFBF0B","yellow-25":"#FFF9E0","yellow-300":"#D8A100","yellow-400":"#B78800","yellow-50":"#FFF3C0","yellow-500":"#977000","yellow-600":"#785800","yellow-700":"#5B4200","yellow-75":"#FFEAA2","yellow-800":"#3F2D00","yellow-900":"#231A03","yellow-950":"#161003","yelloworange-100":"#FCDCC8","yelloworange-200":"#FDB586","yelloworange-25":"#FDF7F3","yelloworange-300":"#FF8A35","yelloworange-400":"#E46C00","yelloworange-50":"#FCEEE6","yelloworange-500":"#BD5800","yelloworange-600":"#974500","yelloworange-700":"#733300","yelloworange-75":"#FBE5D7","yelloworange-800":"#4E2402","yelloworange-900":"#2A1705","yelloworange-950":"#1A0E04","action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"action-upvote":{light:"#D93900",dark:"#D93900"},"ai-background-weaker":{light:"#E7FDF5",dark:"#00382B"},"ai-plain":{light:"#006C56",dark:"#01A484"},"ai-plain-hover":{light:"#015140",dark:"#00C29D"},"alert-caution":{light:"#977000",dark:"#977000"},"avatar-gradient":{light:"",dark:""},"brand-background":{light:"#D93900",dark:"#D93900"},"brand-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"category-live":{light:"#D93900",dark:"#D93900"},"category-nsfw":{light:"#DE019F",dark:"#DE019F"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"caution-background":{light:"#FFBF0B",dark:"#D8A100"},"caution-background-hover":{light:"#D8A100",dark:"#FFBF0B"},"caution-onBackground":{light:"#000000",dark:"#000000"},"caution-plain":{light:"#785800",dark:"#FFBF0B"},"caution-plain-hover":{light:"#5B4200",dark:"#FFE284"},"danger-background":{light:"#EB001F",dark:"#BC0117"},"danger-background-disabled":{light:"#FDB3A4",dark:"#340F05"},"danger-background-hover":{light:"#BC0117",dark:"#EB001F"},"danger-background-weaker":{light:"#FBDBD4",dark:"#650405"},"danger-content":{light:"#BC0117",dark:"#FF4F40"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"danger-content-hover":{light:"#90000F",dark:"#FF8773"},"danger-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"danger-plain":{light:"#BC0117",dark:"#FF8773"},"danger-plain-hover":{light:"#90000F",dark:"#FDB3A4"},"downvote-background":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-background-disabled":{light:"#6a5cff4d",dark:"#6a5cff4d"},"downvote-background-hover":{light:"#523DFF",dark:"#523DFF"},"downvote-content":{light:"#523DFF",dark:"#9580FF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#523DFF4c",dark:"#9580FF4c"},"downvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"downvote-onStrongScrim":{light:"#B29FFF",dark:"#B29FFF"},"downvote-onStrongScrim-disabled":{light:"#b29fff4d",dark:"#b29fff4d"},"downvote-onStrongScrim-weaker":{light:"#9580FF",dark:"#9580FF"},"downvote-plain":{light:"#523DFF",dark:"#9580FF"},"downvote-plain-disabled":{light:"#523dff4d",dark:"#9580ff4d"},"downvote-plain-weaker":{light:"#6A5CFF",dark:"#6A5CFF"},"elevation-large1":{light:"#0000003F",dark:"#0000007F"},"elevation-large2":{light:"#00000026",dark:"#00000033"},"elevation-medium1":{light:"#0000003F",dark:"#0000007F"},"elevation-medium2":{light:"#00000019",dark:"#00000033"},"elevation-small":{light:"#00000026",dark:"#00000054"},"elevation-xsmall":{light:"#0000003F",dark:"#000000AA"},favorite:{light:"#977000",dark:"#B78800"},"global-admin":{light:"#D93900",dark:"#D93900"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#2A3236",dark:"#2A3236"},"global-focus":{light:"#029DD5",dark:"#007FAE"},"global-gold":{light:"#B78800",dark:"#D8A100"},"global-moderator":{light:"#008A10",dark:"#008A10"},"global-nsfw":{light:"#DE019F",dark:"#DE019F"},"global-offline":{light:"#667780",dark:"#667780"},"global-online":{light:"#00C61C",dark:"#00C61C"},"global-orangered":{light:"#FF4500",dark:"#FF4500"},"global-stars":{light:"#977000",dark:"#D8A100"},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"identity-admin":{light:"#D93900",dark:"#D93900"},"identity-coins":{light:"#B78800",dark:"#B78800"},"identity-moderator":{light:"#008A10",dark:"#008A10"},"identity-self":{light:"#01876D",dark:"#01876D"},"interactive-background-disabled":{light:"#0000000C",dark:"#FFFFFF0C"},"interactive-content-disabled":{light:"#0000003F",dark:"#FFFFFF3F"},"interactive-focused":{light:"#007FAE",dark:"#007FAE"},"interactive-pressed":{light:"#00000026",dark:"#FFFFFF26"},"inverted-interactive-background-disabled":{light:"#FFFFFF0C",dark:"#0000000C"},"inverted-interactive-content-disabled":{light:"#FFFFFF3F",dark:"#0000003F"},"inverted-interactive-pressed":{light:"#FFFFFF26",dark:"#00000026"},"inverted-neutral-background":{light:"#0E1113",dark:"#FFFFFF"},"inverted-neutral-background-hover":{light:"#181C1F",dark:"#F6F8F9"},"inverted-neutral-border":{light:"#FFFFFF33",dark:"#00000033"},"inverted-neutral-content":{light:"#B7CAD4",dark:"#333D42"},"inverted-neutral-content-strong":{light:"#EEF1F3",dark:"#181C1F"},"inverted-secondary-background":{light:"#2A3236",dark:"#E5EBEE"},"inverted-secondary-background-hover":{light:"#333D42",dark:"#DBE4E9"},"inverted-secondary-background-selected":{light:"#3D494E",dark:"#C9D7DE"},"inverted-secondary-onBackground":{light:"#FFFFFF",dark:"#000000"},"inverted-secondary-plain":{light:"#DBE4E9",dark:"#181C1F"},"inverted-secondary-plain-hover":{light:"#FFFFFF",dark:"#000000"},"media-background":{light:"#00000099",dark:"#00000099"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"media-border-selected":{light:"#FFFFFF",dark:"#FFFFFF"},"media-border-weak":{light:"#FFFFFF19",dark:"#FFFFFF19"},"media-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"media-onBackground-disabled":{light:"#FFFFFF3F",dark:"#FFFFFF3F"},"media-onBackground-weak":{light:"#E5EBEE",dark:"#E5EBEE"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-onbackground-weak":{light:"#B7CAD4",dark:"#B7CAD4"},"neutral-background":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-container":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-container-hover":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong-hover":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-gilded":{light:"#FFF9E0",dark:"#181C1F"},"neutral-background-gilded-hover":{light:"#FFF3C0",dark:"#21272A"},"neutral-background-hover":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-pinned":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-selected":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-strong":{light:"#FFFFFF",dark:"#181C1F"},"neutral-background-strong-hover":{light:"#F6F8F9",dark:"#21272A"},"neutral-background-weak":{light:"#F6F8F9",dark:"#000000"},"neutral-background-weak-hover":{light:"#EEF1F3",dark:"#0E1113"},"neutral-border":{light:"#00000033",dark:"#FFFFFF33"},"neutral-border-medium":{light:"#0000007F",dark:"#FFFFFF7F"},"neutral-border-strong":{light:"#181C1F",dark:"#F6F8F9"},"neutral-border-weak":{light:"#00000019",dark:"#FFFFFF19"},"neutral-content":{light:"#333D42",dark:"#B7CAD4"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-strong":{light:"#181C1F",dark:"#EEF1F3"},"neutral-content-weak":{light:"#5C6C74",dark:"#8BA2AD"},offline:{light:"#767676",dark:"#767676"},online:{light:"#01A816",dark:"#01A816"},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},"opacity-highlight":{light:"",dark:""},pizzaRed:{light:"#ef5350",dark:"#c62828"},primary:{light:"#115BCA",dark:"#648EFC"},"primary-background":{light:"#0A449B",dark:"#115BCA"},"primary-background-hover":{light:"#0A2F6C",dark:"#1870F4"},"primary-background-selected":{light:"#0A1A3F",dark:"#648EFC"},"primary-border":{light:"#0A449B",dark:"#648EFC"},"primary-border-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-hover":{light:"#0A449B",dark:"#90A9FD"},"primary-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"primary-onBackground-selected":{light:"#FFFFFF",dark:"#000000"},"primary-plain":{light:"#0A449B",dark:"#648EFC"},"primary-plain-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-plain-visited":{light:"#7600A3",dark:"#CF5FFF"},"primary-visited":{light:"#9B00D4",dark:"#CF5FFF"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-background":{light:"#00000099",dark:"#00000099"},"scrim-background-strong":{light:"#000000CC",dark:"#000000CC"},"scrim-gradient":{light:"",dark:""},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},secondary:{light:"#21272A",dark:"#DBE4E9"},"secondary-background":{light:"#E5EBEE",dark:"#2A3236"},"secondary-background-hover":{light:"#DBE4E9",dark:"#333D42"},"secondary-background-selected":{light:"#C9D7DE",dark:"#3D494E"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-onBackground":{light:"#000000",dark:"#FFFFFF"},"secondary-plain":{light:"#181C1F",dark:"#DBE4E9"},"secondary-plain-hover":{light:"#000000",dark:"#FFFFFF"},"secondary-plain-weak":{light:"#5C6C74",dark:"#8BA2AD"},"secondary-weak":{light:"#576F76",dark:"#748791"},"success-background":{light:"#008A10",dark:"#016E0B"},"success-background-hover":{light:"#016E0B",dark:"#008A10"},"success-content":{light:"#016E0B",dark:"#01A816"},"success-hover":{light:"#005306",dark:"#00C61C"},"success-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"success-plain":{light:"#016E0B",dark:"#00C61C"},"success-plain-hover":{light:"#005306",dark:"#58E15B"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"transparent-background-hover":{light:"#74879119",dark:"#66778019"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#FFFFFF",dark:"#181C1F"},"upvote-background":{light:"#D93900",dark:"#D93900"},"upvote-background-disabled":{light:"#d939004d",dark:"#d939004d"},"upvote-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"upvote-content":{light:"#AE2C00",dark:"#FF4500"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#AE2C004c",dark:"#FF45004c"},"upvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"upvote-onStrongScrim":{light:"#FF895D",dark:"#FF895D"},"upvote-onStrongScrim-disabled":{light:"#ff895d4d",dark:"#ff895d4d"},"upvote-onStrongScrim-weaker":{light:"#FF4500",dark:"#FF4500"},"upvote-plain":{light:"#AE2C00",dark:"#FF895D"},"upvote-plain-disabled":{light:"#ae2c004d",dark:"#ff895d4d"},"upvote-plain-weaker":{light:"#FF4500",dark:"#FF4500"},"warning-background":{light:"#B78800",dark:"#B78800"},"warning-background-hover":{light:"#977000",dark:"#D8A100"},"warning-content":{light:"#785800",dark:"#B78800"},"warning-content-hover":{light:"#5B4200",dark:"#D8A100"},"warning-onBackground":{light:"#000000",dark:"#000000"}};var ay={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"},dy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),ly=r=>r in uc,cc=r=>r in ay,uy=r=>!!r.match(/^rgba?\(.*/),cy=r=>!!r.match(/^hsla?\(.*/),my=(r,e="light")=>{if(cc(r))return nd(r);let i=uc[r];return typeof i=="string"?i:i[e]},nd=r=>ay[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 sd}from"@devvit/protos";var mc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:sd.UNRECOGNIZED,alignment:void 0}};function hy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=gT(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||gy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||gy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function gy(r,e,t,i){return e===r&&i||t===r&&i}function gT(r,e,t){let i=e===sd.STACK_VERTICAL||e===sd.UNRECOGNIZED,n=e===sd.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,g=0;return n&&p?g=2:i&&p&&(g=1),{growDirection:o,stretchDirection:g}}import{BlockSizeUnit as yr,BlockStackDirection as od}from"@devvit/protos";function Si(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:yr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=yr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=yr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function hT(r,e){return(r.width?.value?.unit===yr.SIZE_UNIT_PERCENT||r.width?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_HORIZONTAL||e.direction===od.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===yr.SIZE_UNIT_PERCENT||r.height?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_VERTICAL||e.direction===od.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function pc(r,e){if(r){let t=r.width!=null||r.minWidth!=null||r.maxWidth!=null,i=r.height!=null||r.minHeight!=null||r.maxHeight!=null;if(t||i||r.grow!=null){let n={width:t?{value:Si(r.width),min:Si(r.minWidth),max:Si(r.maxWidth)}:void 0,height:i?{value:Si(r.height),min:Si(r.minHeight),max:Si(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=hT(n,e.stackParentLayout)),n}}}var by="data-",fT=new Set(["onPress","onMessage"]),vT=new Map([["onPress",Pc.ACTION_CLICK],["onMessage",Pc.ACTION_WEBVIEW]]),ms,Ci=class{constructor(e=()=>{}){l(this,ms);d(this,ms,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},mc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return us.PADDING_NONE;case"xsmall":return us.PADDING_XSMALL;case"small":return us.PADDING_SMALL;case"medium":return us.PADDING_MEDIUM;case"large":return us.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return cs.RADIUS_NONE;case"small":return cs.RADIUS_SMALL;case"medium":return cs.RADIUS_MEDIUM;case"large":return cs.RADIUS_LARGE;case"full":return cs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return dd.GAP_NONE;case"small":return dd.GAP_SMALL;case"medium":return dd.GAP_MEDIUM;case"large":return dd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Sc.ALIGN_TOP:e.includes("middle")?t=Sc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Sc.ALIGN_BOTTOM),e.includes("start")?i=hc.ALIGN_START:e.includes("center")?i=hc.ALIGN_CENTER:e.includes("end")&&(i=hc.ALIGN_END),t!==void 0||i!==void 0)return{vertical:t,horizontal:i}}makeBlockBorder(e,t,i,n){if(!e&&!t)return;let o;switch(e){case"none":o=ad.BORDER_WIDTH_NONE;break;case"thin":o=ad.BORDER_WIDTH_THIN;break;case"thick":o=ad.BORDER_WIDTH_THICK;break;default:o=ad.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",c=this.getThemedColors(a,i,n);return{width:o,color:c?.light,colors:c}}makeBlockTextSize(e){switch(e){case"xsmall":return Pi.TEXT_SIZE_XSMALL;case"small":return Pi.TEXT_SIZE_SMALL;case"medium":return Pi.TEXT_SIZE_MEDIUM;case"large":return Pi.TEXT_SIZE_LARGE;case"xlarge":return Pi.TEXT_SIZE_XLARGE;case"xxlarge":return Pi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return kc.TEXT_STYLE_BODY;case"metadata":return kc.TEXT_STYLE_METADATA;case"heading":return kc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return yc.TEXT_OUTLINE_NONE;case"thin":return yc.TEXT_OUTLINE_THIN;case"thick":return yc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return yy.TEXT_WEIGHT_REGULAR;case"bold":return yy.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return bc.TEXT_OVERFLOW_CLIP;case"ellipsis":return bc.TEXT_OVERFLOW_ELLIPSE}return bc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Bt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Bt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Bt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Bt.BUTTON_APPEARANCE_BORDERED;case"media":return Bt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Bt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Bt.BUTTON_APPEARANCE_CAUTION;case"success":return Bt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return gc.BUTTON_SIZE_SMALL;case"medium":return gc.BUTTON_SIZE_MEDIUM;case"large":return gc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ls.IMAGE_RESIZE_NONE;case"fit":return ls.IMAGE_RESIZE_FIT;case"fill":return ls.IMAGE_RESIZE_FILL;case"cover":return ls.IMAGE_RESIZE_COVER;case"scale-down":return ls.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return ud.SPACER_XSMALL;case"small":return ud.SPACER_SMALL;case"medium":return ud.SPACER_MEDIUM;case"large":return ud.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return fc.SPACER_INVISIBLE;case"thin":return fc.SPACER_THIN;case"square":return fc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return ld.ICON_SIZE_XSMALL;case"small":return ld.ICON_SIZE_SMALL;case"medium":return ld.ICON_SIZE_MEDIUM;case"large":return ld.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Ot.AVATAR_SIZE_XXSMALL;case"xsmall":return Ot.AVATAR_SIZE_XSMALL;case"small":return Ot.AVATAR_SIZE_SMALL;case"medium":return Ot.AVATAR_SIZE_MEDIUM;case"large":return Ot.AVATAR_SIZE_LARGE;case"xlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Ot.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return vy.AVATAR_FACING_LEFT;case"right":return vy.AVATAR_FACING_RIGHT}}makeBlockAvatarBackground(e){switch(e){case"dark":return fy.AVATAR_BG_DARK;case"light":return fy.AVATAR_BG_LIGHT}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(by)).reduce((t,i)=>(t[i.substring(by.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return fT.forEach(o=>{if(o in t){let a=t[o];i.push({type:vT.get(o)??Pc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),dy(e)?e:ly(e)?my(e,t):cc(e)?nd(e):uy(e)?py(e):cy(e)?e:(console.warn(`Could not parse color: ${e}.`),nd("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,ms).call(this)?.getURL(e,t)??e}childrenToString(e){return e.map(t=>t.toString()).join("")}makeRoot(e,...t){return this.wrapRoot(e,this.childrenToBlocks(t,mc))}wrapRoot(e,t){return this.makeBlock(tt.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=pc(t,i),p=hy(t,i.stackParentLayout,c);return this.makeBlock(tt.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(vc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(vc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(vc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(tt.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(tt.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(tt.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(tt.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(tt.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(tt.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeWebView(e,t){return e&&this.makeBlock(tt.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:pc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===tt.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};ms=new WeakMap;function Sy(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Py=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+=Py(i);return e+=`</${r.type}>`,e};function yT(r){return" ".repeat(r)}function bT(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+=yT(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 Le,Cy,ps,wc,gs,pt=class{constructor(e,t,i,n,o){l(this,Le);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new Ci(()=>this.assets);this.effects=[];l(this,gs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=De({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,Le,ps).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(Sy(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,Le,Cy).call(this)}async buildBlocksUI(){let e=S(this,Le,ps).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 Sy(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(bT(Py(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=oy(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let b=n.children[m];b!=null&&c.push(await this.processBlock(b,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),g=S(this,Le,wc).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:g}}if(typeof n.type=="function"){let c=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(c),this.renderState[c]||(this.renderState[c]={});let p=n.children.flatMap(m=>m),g={...S(this,Le,ps).call(this),...n.props,children:p},f;for(;f===void 0;)try{f=await n.type(g,S(this,Le,ps).call(this))}catch(m){if(m instanceof Promise)f=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof f=="object")return this.processBlock(f,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===Cc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Cc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Cc.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,gs)||(d(this,gs,!0),this.effects.push({type:ky.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:ky.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...ki(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};Le=new WeakSet,Cy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},ps=function(){let e={...ce(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},wc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,Le,wc).call(this,i.children)):t.push(i);return t},gs=new WeakMap;async function PT(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new pt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return ST.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function wy(r){r.provides(kT),M("RenderPost",PT)}import{GetFieldsResponse as CT,InstallationSettingsDefinition as wT}from"@devvit/protos";async function xT(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return CT.fromJSON({fields:{fields:mt(u.installationSettings)}})}async function IT(r,e){return id(r,u.installationSettings,e)}function xy(r){r.provides(wT),M("GetSettingsFields",xT),M("ValidateForm",IT)}import{ContextActionDefinition as FT,ContextActionList as TT,ContextActionResponse as AT}from"@devvit/protos";var Iy=r=>`menuItem.${r}`;function xc(r){return u.menuItems.find((e,t)=>Iy(t)===r)}async function ET(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:Iy(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"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}));return TT.fromJSON({actions:i})}async function RT(r,e){let t=xc(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;y(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(De({ui:!0,metadata:e}),ce(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),AT.fromJSON({effects:ki(p.ui)})}function Fy(r){r.provides(FT),M("GetActions",ET),M("OnAction",RT)}function gt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as OT}from"@devvit/protos";async function BT(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(De({metadata:e}),ce(e));await i(n,o)}function Ty(r){r.provides(OT),M("HandleScheduledAction",BT)}import{OnAppInstallDefinition as MT,OnAppUpgradeDefinition as UT,OnAutomoderatorFilterCommentDefinition as DT,OnAutomoderatorFilterPostDefinition as LT,OnCommentCreateDefinition as NT,OnCommentDeleteDefinition as _T,OnCommentReportDefinition as HT,OnCommentSubmitDefinition as qT,OnCommentUpdateDefinition as jT,OnModActionDefinition as WT,OnModMailDefinition as GT,OnPostCreateDefinition as VT,OnPostDeleteDefinition as zT,OnPostFlairUpdateDefinition as JT,OnPostNsfwUpdateDefinition as $T,OnPostReportDefinition as KT,OnPostSpoilerUpdateDefinition as XT,OnPostSubmitDefinition as ZT,OnPostUpdateDefinition as QT}from"@devvit/protos";var wi;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o,a="stack"){return o instanceof Error?`${o[a]||o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(wi||(wi={}));function X(r,e){return y(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(De({metadata:i}),ce(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=YT(a);if(c)throw c.err;return{}}}function Ay(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(ZT),M("OnPostSubmit",X("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(VT),M("OnPostCreate",X("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(QT),M("OnPostUpdate",X("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(KT),M("OnPostReport",X("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(zT),M("OnPostDelete",X("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(JT),M("OnPostFlairUpdate",X("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(qT),M("OnCommentSubmit",X("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(NT),M("OnCommentCreate",X("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(jT),M("OnCommentUpdate",X("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(HT),M("OnCommentReport",X("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(_T),M("OnCommentDelete",X("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(MT),M("OnAppInstall",X("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(UT),M("OnAppUpgrade",X("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(WT),M("OnModAction",X("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(GT),M("OnModMail",X("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides($T),M("OnPostNsfwUpdate",X("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(XT),M("OnPostSpoilerUpdate",X("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterPost":r.provides(LT),M("OnAutomoderatorFilterPost",X("AutomoderatorFilterPost",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterComment":r.provides(DT),M("OnAutomoderatorFilterComment",X("AutomoderatorFilterComment",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function YT(r){let e=r.reduce((t,i)=>i.status==="rejected"?[...t,i.reason]:t,[]);if(e.length!==0)return e.length===1?{err:e[0]}:{err:new Error(e.map(t=>wi.caughtToString(t)).join(`
|
1
|
+
var kS=Object.create;var wm=Object.defineProperty;var SS=Object.getOwnPropertyDescriptor;var PS=Object.getOwnPropertyNames;var CS=Object.getPrototypeOf,wS=Object.prototype.hasOwnProperty;var xm=r=>{throw TypeError(r)};var h=(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 PS(e))!wS.call(r,n)&&n!==t&&wm(r,n,{get:()=>e[n],enumerable:!(i=SS(e,n))||i.enumerable});return r};var Dn=(r,e,t)=>(t=r!=null?kS(CS(r)):{},xS(e||!r||!r.__esModule?wm(t,"default",{value:r,enumerable:!0}):t,r));var tl=(r,e,t)=>e.has(r)||xm("Cannot "+t);var s=(r,e,t)=>(tl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?xm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(tl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(tl(r,e,"access private method"),t);var le=h((tO,Im)=>{Im.exports=function(r){try{return!!r()}catch{return!0}}});var oa=h((rO,Fm)=>{var IS=le();Fm.exports=!IS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=h((iO,Em)=>{var Tm=oa(),Am=Function.prototype,rl=Am.call,FS=Tm&&Am.bind.bind(rl,rl);Em.exports=Tm?FS:function(r){return function(){return rl.apply(r,arguments)}}});var Om=h((nO,Rm)=>{var TS=Math.ceil,AS=Math.floor;Rm.exports=Math.trunc||function(e){var t=+e;return(t>0?AS:TS)(t)}});var aa=h((sO,Bm)=>{var ES=Om();Bm.exports=function(r){var e=+r;return e!==e||e===0?0:ES(e)}});var he=h((oO,Mm)=>{var da=function(r){return r&&r.Math==Math&&r};Mm.exports=da(typeof globalThis=="object"&&globalThis)||da(typeof window=="object"&&window)||da(typeof self=="object"&&self)||da(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=h((aO,Um)=>{Um.exports=!1});var la=h((dO,Lm)=>{var Dm=he(),RS=Object.defineProperty;Lm.exports=function(r,e){try{RS(Dm,r,{value:e,configurable:!0,writable:!0})}catch{Dm[r]=e}return e}});var ua=h((lO,_m)=>{var OS=he(),BS=la(),Nm="__core-js_shared__",MS=OS[Nm]||BS(Nm,{});_m.exports=MS});var il=h((uO,qm)=>{var US=Wr(),Hm=ua();(qm.exports=function(r,e){return Hm[r]||(Hm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:US?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"})});var ca=h((cO,jm)=>{jm.exports=function(r){return r==null}});var ma=h((mO,Wm)=>{var DS=ca(),LS=TypeError;Wm.exports=function(r){if(DS(r))throw LS("Can't call method on "+r);return r}});var Ln=h((pO,Gm)=>{var NS=ma(),_S=Object;Gm.exports=function(r){return _S(NS(r))}});var we=h((gO,Vm)=>{var HS=Z(),qS=Ln(),jS=HS({}.hasOwnProperty);Vm.exports=Object.hasOwn||function(e,t){return jS(qS(e),t)}});var nl=h((hO,zm)=>{var WS=Z(),GS=0,VS=Math.random(),zS=WS(1 .toString);zm.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+zS(++GS+VS,36)}});var $m=h((fO,Jm)=>{Jm.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var tp=h((vO,ep)=>{var Ym=he(),sl=$m(),Km=Ym.process,Xm=Ym.Deno,Zm=Km&&Km.versions||Xm&&Xm.version,Qm=Zm&&Zm.v8,qe,pa;Qm&&(qe=Qm.split("."),pa=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!pa&&sl&&(qe=sl.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=sl.match(/Chrome\/(\d+)/),qe&&(pa=+qe[1])));ep.exports=pa});var ol=h((yO,ip)=>{var rp=tp(),JS=le();ip.exports=!!Object.getOwnPropertySymbols&&!JS(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&rp&&rp<41})});var al=h((bO,np)=>{var $S=ol();np.exports=$S&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var xe=h((kO,op)=>{var KS=he(),XS=il(),sp=we(),ZS=nl(),QS=ol(),YS=al(),Gr=KS.Symbol,dl=XS("wks"),eP=YS?Gr.for||Gr:Gr&&Gr.withoutSetter||ZS;op.exports=function(r){return sp(dl,r)||(dl[r]=QS&&sp(Gr,r)?Gr[r]:eP("Symbol."+r)),dl[r]}});var lp=h((SO,dp)=>{var tP=xe(),rP=tP("toStringTag"),ap={};ap[rP]="z";dp.exports=String(ap)==="[object z]"});var ul=h((PO,up)=>{var ll=typeof document=="object"&&document.all,iP=typeof ll>"u"&&ll!==void 0;up.exports={all:ll,IS_HTMLDDA:iP}});var Q=h((CO,mp)=>{var cp=ul(),nP=cp.all;mp.exports=cp.IS_HTMLDDA?function(r){return typeof r=="function"||r===nP}:function(r){return typeof r=="function"}});var ga=h((wO,gp)=>{var pp=Z(),sP=pp({}.toString),oP=pp("".slice);gp.exports=function(r){return oP(sP(r),8,-1)}});var Nn=h((xO,hp)=>{var aP=lp(),dP=Q(),ha=ga(),lP=xe(),uP=lP("toStringTag"),cP=Object,mP=ha(function(){return arguments}())=="Arguments",pP=function(r,e){try{return r[e]}catch{}};hp.exports=aP?ha:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=pP(e=cP(r),uP))=="string"?t:mP?ha(e):(i=ha(e))=="Object"&&dP(e.callee)?"Arguments":i}});var _n=h((IO,fp)=>{var gP=Nn(),hP=String;fp.exports=function(r){if(gP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return hP(r)}});var ml=h((FO,bp)=>{var cl=Z(),fP=aa(),vP=_n(),yP=ma(),bP=cl("".charAt),vp=cl("".charCodeAt),kP=cl("".slice),yp=function(r){return function(e,t){var i=vP(yP(e)),n=fP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=vp(i,n),a<55296||a>56319||n+1===o||(c=vp(i,n+1))<56320||c>57343?r?bP(i,n):a:r?kP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};bp.exports={codeAt:yp(!1),charAt:yp(!0)}});var Pp=h((TO,Sp)=>{var SP=he(),PP=Q(),kp=SP.WeakMap;Sp.exports=PP(kp)&&/native code/.test(String(kp))});var Ct=h((AO,xp)=>{var Cp=Q(),wp=ul(),CP=wp.all;xp.exports=wp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Cp(r)||r===CP}:function(r){return typeof r=="object"?r!==null:Cp(r)}});var fe=h((EO,Ip)=>{var wP=le();Ip.exports=!wP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var gl=h((RO,Tp)=>{var xP=he(),Fp=Ct(),pl=xP.document,IP=Fp(pl)&&Fp(pl.createElement);Tp.exports=function(r){return IP?pl.createElement(r):{}}});var hl=h((OO,Ap)=>{var FP=fe(),TP=le(),AP=gl();Ap.exports=!FP&&!TP(function(){return Object.defineProperty(AP("div"),"a",{get:function(){return 7}}).a!=7})});var fl=h((BO,Ep)=>{var EP=fe(),RP=le();Ep.exports=EP&&RP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=h((MO,Rp)=>{var OP=Ct(),BP=String,MP=TypeError;Rp.exports=function(r){if(OP(r))return r;throw MP(BP(r)+" is not an object")}});var je=h((UO,Op)=>{var UP=oa(),fa=Function.prototype.call;Op.exports=UP?fa.bind(fa):function(){return fa.apply(fa,arguments)}});var Hn=h((DO,Bp)=>{var vl=he(),DP=Q(),LP=function(r){return DP(r)?r:void 0};Bp.exports=function(r,e){return arguments.length<2?LP(vl[r]):vl[r]&&vl[r][e]}});var yl=h((LO,Mp)=>{var NP=Z();Mp.exports=NP({}.isPrototypeOf)});var bl=h((NO,Up)=>{var _P=Hn(),HP=Q(),qP=yl(),jP=al(),WP=Object;Up.exports=jP?function(r){return typeof r=="symbol"}:function(r){var e=_P("Symbol");return HP(e)&&qP(e.prototype,WP(r))}});var kl=h((_O,Dp)=>{var GP=String;Dp.exports=function(r){try{return GP(r)}catch{return"Object"}}});var va=h((HO,Lp)=>{var VP=Q(),zP=kl(),JP=TypeError;Lp.exports=function(r){if(VP(r))return r;throw JP(zP(r)+" is not a function")}});var ya=h((qO,Np)=>{var $P=va(),KP=ca();Np.exports=function(r,e){var t=r[e];return KP(t)?void 0:$P(t)}});var Hp=h((jO,_p)=>{var Sl=je(),Pl=Q(),Cl=Ct(),XP=TypeError;_p.exports=function(r,e){var t,i;if(e==="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r))||Pl(t=r.valueOf)&&!Cl(i=Sl(t,r))||e!=="string"&&Pl(t=r.toString)&&!Cl(i=Sl(t,r)))return i;throw XP("Can't convert object to primitive value")}});var Gp=h((WO,Wp)=>{var ZP=je(),qp=Ct(),jp=bl(),QP=ya(),YP=Hp(),eC=xe(),tC=TypeError,rC=eC("toPrimitive");Wp.exports=function(r,e){if(!qp(r)||jp(r))return r;var t=QP(r,rC),i;if(t){if(e===void 0&&(e="default"),i=ZP(t,r,e),!qp(i)||jp(i))return i;throw tC("Can't convert object to primitive value")}return e===void 0&&(e="number"),YP(r,e)}});var ba=h((GO,Vp)=>{var iC=Gp(),nC=bl();Vp.exports=function(r){var e=iC(r,"string");return nC(e)?e:e+""}});var Qe=h(Jp=>{var sC=fe(),oC=hl(),aC=fl(),ka=Ze(),zp=ba(),dC=TypeError,wl=Object.defineProperty,lC=Object.getOwnPropertyDescriptor,xl="enumerable",Il="configurable",Fl="writable";Jp.f=sC?aC?function(e,t,i){if(ka(e),t=zp(t),ka(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Fl in i&&!i[Fl]){var n=lC(e,t);n&&n[Fl]&&(e[t]=i.value,i={configurable:Il in i?i[Il]:n[Il],enumerable:xl in i?i[xl]:n[xl],writable:!1})}return wl(e,t,i)}:wl:function(e,t,i){if(ka(e),t=zp(t),ka(i),oC)try{return wl(e,t,i)}catch{}if("get"in i||"set"in i)throw dC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=h((zO,$p)=>{$p.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Sa=h((JO,Kp)=>{var uC=fe(),cC=Qe(),mC=Vr();Kp.exports=uC?function(r,e,t){return cC.f(r,e,mC(1,t))}:function(r,e,t){return r[e]=t,r}});var Pa=h(($O,Zp)=>{var pC=il(),gC=nl(),Xp=pC("keys");Zp.exports=function(r){return Xp[r]||(Xp[r]=gC(r))}});var Ca=h((KO,Qp)=>{Qp.exports={}});var zr=h((XO,tg)=>{var hC=Pp(),eg=he(),fC=Ct(),vC=Sa(),Tl=we(),Al=ua(),yC=Pa(),bC=Ca(),Yp="Object already initialized",El=eg.TypeError,kC=eg.WeakMap,wa,qn,xa,SC=function(r){return xa(r)?qn(r):wa(r,{})},PC=function(r){return function(e){var t;if(!fC(e)||(t=qn(e)).type!==r)throw El("Incompatible receiver, "+r+" required");return t}};hC||Al.state?(We=Al.state||(Al.state=new kC),We.get=We.get,We.has=We.has,We.set=We.set,wa=function(r,e){if(We.has(r))throw El(Yp);return e.facade=r,We.set(r,e),e},qn=function(r){return We.get(r)||{}},xa=function(r){return We.has(r)}):(or=yC("state"),bC[or]=!0,wa=function(r,e){if(Tl(r,or))throw El(Yp);return e.facade=r,vC(r,or,e),e},qn=function(r){return Tl(r,or)?r[or]:{}},xa=function(r){return Tl(r,or)});var We,or;tg.exports={set:wa,get:qn,has:xa,enforce:SC,getterFor:PC}});var Rl=h(ng=>{"use strict";var rg={}.propertyIsEnumerable,ig=Object.getOwnPropertyDescriptor,CC=ig&&!rg.call({1:2},1);ng.f=CC?function(e){var t=ig(this,e);return!!t&&t.enumerable}:rg});var Bl=h((QO,sg)=>{var wC=Z(),xC=le(),IC=ga(),Ol=Object,FC=wC("".split);sg.exports=xC(function(){return!Ol("z").propertyIsEnumerable(0)})?function(r){return IC(r)=="String"?FC(r,""):Ol(r)}:Ol});var Jr=h((YO,og)=>{var TC=Bl(),AC=ma();og.exports=function(r){return TC(AC(r))}});var Ml=h(dg=>{var EC=fe(),RC=je(),OC=Rl(),BC=Vr(),MC=Jr(),UC=ba(),DC=we(),LC=hl(),ag=Object.getOwnPropertyDescriptor;dg.f=EC?ag:function(e,t){if(e=MC(e),t=UC(t),LC)try{return ag(e,t)}catch{}if(DC(e,t))return BC(!RC(OC.f,e,t),e[t])}});var Ll=h((tB,ug)=>{var Ul=fe(),NC=we(),lg=Function.prototype,_C=Ul&&Object.getOwnPropertyDescriptor,Dl=NC(lg,"name"),HC=Dl&&function(){}.name==="something",qC=Dl&&(!Ul||Ul&&_C(lg,"name").configurable);ug.exports={EXISTS:Dl,PROPER:HC,CONFIGURABLE:qC}});var _l=h((rB,cg)=>{var jC=Z(),WC=Q(),Nl=ua(),GC=jC(Function.toString);WC(Nl.inspectSource)||(Nl.inspectSource=function(r){return GC(r)});cg.exports=Nl.inspectSource});var jl=h((iB,gg)=>{var ql=Z(),VC=le(),zC=Q(),Ia=we(),Hl=fe(),JC=Ll().CONFIGURABLE,$C=_l(),pg=zr(),KC=pg.enforce,XC=pg.get,mg=String,Fa=Object.defineProperty,ZC=ql("".slice),QC=ql("".replace),YC=ql([].join),e0=Hl&&!VC(function(){return Fa(function(){},"length",{value:8}).length!==8}),t0=String(String).split("String"),r0=gg.exports=function(r,e,t){ZC(mg(e),0,7)==="Symbol("&&(e="["+QC(mg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ia(r,"name")||JC&&r.name!==e)&&(Hl?Fa(r,"name",{value:e,configurable:!0}):r.name=e),e0&&t&&Ia(t,"arity")&&r.length!==t.arity&&Fa(r,"length",{value:t.arity});try{t&&Ia(t,"constructor")&&t.constructor?Hl&&Fa(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=KC(r);return Ia(i,"source")||(i.source=YC(t0,typeof e=="string"?e:"")),r};Function.prototype.toString=r0(function(){return zC(this)&&XC(this).source||$C(this)},"toString")});var ar=h((nB,hg)=>{var i0=Q(),n0=Qe(),s0=jl(),o0=la();hg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(i0(t)&&s0(t,o,i),i.global)n?r[e]=t:o0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:n0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Wl=h((sB,fg)=>{var a0=aa(),d0=Math.max,l0=Math.min;fg.exports=function(r,e){var t=a0(r);return t<0?d0(t+e,0):l0(t,e)}});var yg=h((oB,vg)=>{var u0=aa(),c0=Math.min;vg.exports=function(r){return r>0?c0(u0(r),9007199254740991):0}});var Ta=h((aB,bg)=>{var m0=yg();bg.exports=function(r){return m0(r.length)}});var Pg=h((dB,Sg)=>{var p0=Jr(),g0=Wl(),h0=Ta(),kg=function(r){return function(e,t,i){var n=p0(e),o=h0(n),a=g0(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}};Sg.exports={includes:kg(!0),indexOf:kg(!1)}});var Vl=h((lB,wg)=>{var f0=Z(),Gl=we(),v0=Jr(),y0=Pg().indexOf,b0=Ca(),Cg=f0([].push);wg.exports=function(r,e){var t=v0(r),i=0,n=[],o;for(o in t)!Gl(b0,o)&&Gl(t,o)&&Cg(n,o);for(;e.length>i;)Gl(t,o=e[i++])&&(~y0(n,o)||Cg(n,o));return n}});var Aa=h((uB,xg)=>{xg.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Fg=h(Ig=>{var k0=Vl(),S0=Aa(),P0=S0.concat("length","prototype");Ig.f=Object.getOwnPropertyNames||function(e){return k0(e,P0)}});var zl=h(Tg=>{Tg.f=Object.getOwnPropertySymbols});var Eg=h((pB,Ag)=>{var C0=Hn(),w0=Z(),x0=Fg(),I0=zl(),F0=Ze(),T0=w0([].concat);Ag.exports=C0("Reflect","ownKeys")||function(e){var t=x0.f(F0(e)),i=I0.f;return i?T0(t,i(e)):t}});var Bg=h((gB,Og)=>{var Rg=we(),A0=Eg(),E0=Ml(),R0=Qe();Og.exports=function(r,e,t){for(var i=A0(e),n=R0.f,o=E0.f,a=0;a<i.length;a++){var c=i[a];!Rg(r,c)&&!(t&&Rg(t,c))&&n(r,c,o(e,c))}}});var Ug=h((hB,Mg)=>{var O0=le(),B0=Q(),M0=/#|\.prototype\./,jn=function(r,e){var t=D0[U0(r)];return t==N0?!0:t==L0?!1:B0(e)?O0(e):!!e},U0=jn.normalize=function(r){return String(r).replace(M0,".").toLowerCase()},D0=jn.data={},L0=jn.NATIVE="N",N0=jn.POLYFILL="P";Mg.exports=jn});var Wn=h((fB,Dg)=>{var Jl=he(),_0=Ml().f,H0=Sa(),q0=ar(),j0=la(),W0=Bg(),G0=Ug();Dg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,f;if(i?a=Jl:n?a=Jl[t]||j0(t,{}):a=(Jl[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(f=_0(a,c),p=f&&f.value):p=a[c],o=G0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;W0(g,p)}(r.sham||p&&p.sham)&&H0(g,"sham",!0),q0(a,c,g,r)}}});var $l=h((vB,Lg)=>{var V0=Vl(),z0=Aa();Lg.exports=Object.keys||function(e){return V0(e,z0)}});var _g=h(Ng=>{var J0=fe(),$0=fl(),K0=Qe(),X0=Ze(),Z0=Jr(),Q0=$l();Ng.f=J0&&!$0?Object.defineProperties:function(e,t){X0(e);for(var i=Z0(t),n=Q0(t),o=n.length,a=0,c;o>a;)K0.f(e,c=n[a++],i[c]);return e}});var qg=h((bB,Hg)=>{var Y0=Hn();Hg.exports=Y0("document","documentElement")});var Gn=h((kB,$g)=>{var ew=Ze(),tw=_g(),jg=Aa(),rw=Ca(),iw=qg(),nw=gl(),sw=Pa(),Wg=">",Gg="<",Xl="prototype",Zl="script",zg=sw("IE_PROTO"),Kl=function(){},Jg=function(r){return Gg+Zl+Wg+r+Gg+"/"+Zl+Wg},Vg=function(r){r.write(Jg("")),r.close();var e=r.parentWindow.Object;return r=null,e},ow=function(){var r=nw("iframe"),e="java"+Zl+":",t;return r.style.display="none",iw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Jg("document.F=Object")),t.close(),t.F},Ea,Ra=function(){try{Ea=new ActiveXObject("htmlfile")}catch{}Ra=typeof document<"u"?document.domain&&Ea?Vg(Ea):ow():Vg(Ea);for(var r=jg.length;r--;)delete Ra[Xl][jg[r]];return Ra()};rw[zg]=!0;$g.exports=Object.create||function(e,t){var i;return e!==null?(Kl[Xl]=ew(e),i=new Kl,Kl[Xl]=null,i[zg]=e):i=Ra(),t===void 0?i:tw.f(i,t)}});var Xg=h((SB,Kg)=>{var aw=le();Kg.exports=!aw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Yl=h((PB,Qg)=>{var dw=we(),lw=Q(),uw=Ln(),cw=Pa(),mw=Xg(),Zg=cw("IE_PROTO"),Ql=Object,pw=Ql.prototype;Qg.exports=mw?Ql.getPrototypeOf:function(r){var e=uw(r);if(dw(e,Zg))return e[Zg];var t=e.constructor;return lw(t)&&e instanceof t?t.prototype:e instanceof Ql?pw:null}});var iu=h((CB,th)=>{"use strict";var gw=le(),hw=Q(),fw=Ct(),vw=Gn(),Yg=Yl(),yw=ar(),bw=xe(),kw=Wr(),ru=bw("iterator"),eh=!1,lt,eu,tu;[].keys&&(tu=[].keys(),"next"in tu?(eu=Yg(Yg(tu)),eu!==Object.prototype&&(lt=eu)):eh=!0);var Sw=!fw(lt)||gw(function(){var r={};return lt[ru].call(r)!==r});Sw?lt={}:kw&&(lt=vw(lt));hw(lt[ru])||yw(lt,ru,function(){return this});th.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:eh}});var Vn=h((wB,ih)=>{var Pw=Qe().f,Cw=we(),ww=xe(),rh=ww("toStringTag");ih.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!Cw(r,rh)&&Pw(r,rh,{configurable:!0,value:e})}});var $r=h((xB,nh)=>{nh.exports={}});var nu=h((IB,sh)=>{"use strict";var xw=iu().IteratorPrototype,Iw=Gn(),Fw=Vr(),Tw=Vn(),Aw=$r(),Ew=function(){return this};sh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Iw(xw,{next:Fw(+!i,t)}),Tw(r,n,!1,!0),Aw[n]=Ew,r}});var ah=h((FB,oh)=>{var Rw=Q(),Ow=String,Bw=TypeError;oh.exports=function(r){if(typeof r=="object"||Rw(r))return r;throw Bw("Can't set "+Ow(r)+" as a prototype")}});var lh=h((TB,dh)=>{var Mw=Z(),Uw=Ze(),Dw=ah();dh.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Mw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Uw(n),Dw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var ou=h((AB,bh)=>{"use strict";var Lw=Wn(),Nw=je(),Oa=Wr(),vh=Ll(),_w=Q(),Hw=nu(),uh=Yl(),ch=lh(),qw=Vn(),jw=Sa(),su=ar(),Ww=xe(),mh=$r(),yh=iu(),Gw=vh.PROPER,Vw=vh.CONFIGURABLE,ph=yh.IteratorPrototype,Ba=yh.BUGGY_SAFARI_ITERATORS,zn=Ww("iterator"),gh="keys",Jn="values",hh="entries",fh=function(){return this};bh.exports=function(r,e,t,i,n,o,a){Hw(t,e,i);var c=function(I){if(I===n&&b)return b;if(!Ba&&I in f)return f[I];switch(I){case gh:return function(){return new t(this,I)};case Jn:return function(){return new t(this,I)};case hh:return function(){return new t(this,I)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,f=r.prototype,m=f[zn]||f["@@iterator"]||n&&f[n],b=!Ba&&m||c(n),v=e=="Array"&&f.entries||m,P,C,F;if(v&&(P=uh(v.call(new r)),P!==Object.prototype&&P.next&&(!Oa&&uh(P)!==ph&&(ch?ch(P,ph):_w(P[zn])||su(P,zn,fh)),qw(P,p,!0,!0),Oa&&(mh[p]=fh))),Gw&&n==Jn&&m&&m.name!==Jn&&(!Oa&&Vw?jw(f,"name",Jn):(g=!0,b=function(){return Nw(m,this)})),n)if(C={values:c(Jn),keys:o?b:c(gh),entries:c(hh)},a)for(F in C)(Ba||g||!(F in f))&&su(f,F,C[F]);else Lw({target:e,proto:!0,forced:Ba||g},C);return(!Oa||a)&&f[zn]!==b&&su(f,zn,b,{name:n}),mh[e]=b,C}});var au=h((EB,kh)=>{kh.exports=function(r,e){return{value:r,done:e}}});var wh=h(()=>{"use strict";var zw=ml().charAt,Jw=_n(),Ph=zr(),$w=ou(),Sh=au(),Ch="String Iterator",Kw=Ph.set,Xw=Ph.getterFor(Ch);$w(String,"String",function(r){Kw(this,{type:Ch,string:Jw(r),index:0})},function(){var e=Xw(this),t=e.string,i=e.index,n;return i>=t.length?Sh(void 0,!0):(n=zw(t,i),e.index+=n.length,Sh(n,!1))})});var du=h((BB,xh)=>{var Zw=le(),Qw=xe(),Yw=Wr(),ex=Qw("iterator");xh.exports=!Zw(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}),Yw&&!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[ex]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var Fh=h((MB,Ih)=>{var tx=ga(),rx=Z();Ih.exports=function(r){if(tx(r)==="Function")return rx(r)}});var Ma=h((UB,Ah)=>{var Th=Fh(),ix=va(),nx=oa(),sx=Th(Th.bind);Ah.exports=function(r,e){return ix(r),e===void 0?r:nx?sx(r,e):function(){return r.apply(e,arguments)}}});var Oh=h((DB,Rh)=>{var Eh=jl(),ox=Qe();Rh.exports=function(r,e,t){return t.get&&Eh(t.get,e,{getter:!0}),t.set&&Eh(t.set,e,{setter:!0}),ox.f(r,e,t)}});var lu=h((LB,Bh)=>{var ax=yl(),dx=TypeError;Bh.exports=function(r,e){if(ax(e,r))return r;throw dx("Incorrect invocation")}});var Lh=h((NB,Dh)=>{"use strict";var Mh=fe(),lx=Z(),ux=je(),cx=le(),uu=$l(),mx=zl(),px=Rl(),gx=Ln(),hx=Bl(),Kr=Object.assign,Uh=Object.defineProperty,fx=lx([].concat);Dh.exports=!Kr||cx(function(){if(Mh&&Kr({b:1},Kr(Uh({},"a",{enumerable:!0,get:function(){Uh(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},e={},t=Symbol(),i="abcdefghijklmnopqrst";return r[t]=7,i.split("").forEach(function(n){e[n]=n}),Kr({},r)[t]!=7||uu(Kr({},e)).join("")!=i})?function(e,t){for(var i=gx(e),n=arguments.length,o=1,a=mx.f,c=px.f;n>o;)for(var p=hx(arguments[o++]),g=a?fx(uu(p),a(p)):uu(p),f=g.length,m=0,b;f>m;)b=g[m++],(!Mh||ux(c,p,b))&&(i[b]=p[b]);return i}:Kr});var Hh=h((_B,_h)=>{var vx=je(),Nh=Ze(),yx=ya();_h.exports=function(r,e,t){var i,n;Nh(r);try{if(i=yx(r,"return"),!i){if(e==="throw")throw t;return t}i=vx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Nh(i),t}});var jh=h((HB,qh)=>{var bx=Ze(),kx=Hh();qh.exports=function(r,e,t,i){try{return i?e(bx(t)[0],t[1]):e(t)}catch(n){kx(r,"throw",n)}}});var Gh=h((qB,Wh)=>{var Sx=xe(),Px=$r(),Cx=Sx("iterator"),wx=Array.prototype;Wh.exports=function(r){return r!==void 0&&(Px.Array===r||wx[Cx]===r)}});var Xh=h((jB,Kh)=>{var xx=Z(),Ix=le(),Vh=Q(),Fx=Nn(),Tx=Hn(),Ax=_l(),zh=function(){},Ex=[],Jh=Tx("Reflect","construct"),cu=/^\s*(?:class|function)\b/,Rx=xx(cu.exec),Ox=!cu.exec(zh),$n=function(e){if(!Vh(e))return!1;try{return Jh(zh,Ex,e),!0}catch{return!1}},$h=function(e){if(!Vh(e))return!1;switch(Fx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ox||!!Rx(cu,Ax(e))}catch{return!0}};$h.sham=!0;Kh.exports=!Jh||Ix(function(){var r;return $n($n.call)||!$n(Object)||!$n(function(){r=!0})||r})?$h:$n});var mu=h((WB,Zh)=>{"use strict";var Bx=ba(),Mx=Qe(),Ux=Vr();Zh.exports=function(r,e,t){var i=Bx(e);i in r?Mx.f(r,i,Ux(0,t)):r[i]=t}});var Ua=h((GB,Yh)=>{var Dx=Nn(),Qh=ya(),Lx=ca(),Nx=$r(),_x=xe(),Hx=_x("iterator");Yh.exports=function(r){if(!Lx(r))return Qh(r,Hx)||Qh(r,"@@iterator")||Nx[Dx(r)]}});var pu=h((VB,ef)=>{var qx=je(),jx=va(),Wx=Ze(),Gx=kl(),Vx=Ua(),zx=TypeError;ef.exports=function(r,e){var t=arguments.length<2?Vx(r):e;if(jx(t))return Wx(qx(t,r));throw zx(Gx(r)+" is not iterable")}});var sf=h((zB,nf)=>{"use strict";var Jx=Ma(),$x=je(),Kx=Ln(),Xx=jh(),Zx=Gh(),Qx=Xh(),Yx=Ta(),tf=mu(),eI=pu(),tI=Ua(),rf=Array;nf.exports=function(e){var t=Kx(e),i=Qx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=Jx(o,n>2?arguments[2]:void 0));var c=tI(t),p=0,g,f,m,b,v,P;if(c&&!(this===rf&&Zx(c)))for(b=eI(t,c),v=b.next,f=i?new this:[];!(m=$x(v,b)).done;p++)P=a?Xx(b,o,[m.value,p],!0):m.value,tf(f,p,P);else for(g=Yx(t),f=i?new this(g):rf(g);g>p;p++)P=a?o(t[p],p):t[p],tf(f,p,P);return f.length=p,f}});var gu=h((JB,af)=>{var of=Wl(),rI=Ta(),iI=mu(),nI=Array,sI=Math.max;af.exports=function(r,e,t){for(var i=rI(r),n=of(e,i),o=of(t===void 0?i:t,i),a=nI(sI(o-n,0)),c=0;n<o;n++,c++)iI(a,c,r[n]);return a.length=c,a}});var ff=h(($B,hf)=>{var dr=Z(),hu=2147483647,Kn=36,mf=1,yu=26,oI=38,aI=700,dI=72,lI=128,uI="-",cI=/[^\0-\u007E]/,pf=/[.\u3002\uFF0E\uFF61]/g,df="Overflow: input needs wider integers to process",fu=Kn-mf,lf=RangeError,mI=dr(pf.exec),Xr=Math.floor,vu=String.fromCharCode,uf=dr("".charCodeAt),gf=dr([].join),wt=dr([].push),pI=dr("".replace),gI=dr("".split),hI=dr("".toLowerCase),fI=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=uf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=uf(r,t++);(o&64512)==56320?wt(e,((n&1023)<<10)+(o&1023)+65536):(wt(e,n),t--)}else wt(e,n)}return e},cf=function(r){return r+22+75*(r<26)},vI=function(r,e,t){var i=0;for(r=t?Xr(r/aI):r>>1,r+=Xr(r/e);r>fu*yu>>1;)r=Xr(r/fu),i+=Kn;return Xr(i+(fu+1)*r/(r+oI))},yI=function(r){var e=[];r=fI(r);var t=r.length,i=lI,n=0,o=dI,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&wt(e,vu(c));var p=e.length,g=p;for(p&&wt(e,uI);g<t;){var f=hu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<f&&(f=c);var m=g+1;if(f-i>Xr((hu-n)/m))throw lf(df);for(n+=(f-i)*m,i=f,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>hu)throw lf(df);if(c==i){for(var b=n,v=Kn;;){var P=v<=o?mf:v>=o+yu?yu:v-o;if(b<P)break;var C=b-P,F=Kn-P;wt(e,vu(cf(P+C%F))),b=Xr(C/F),v+=Kn}wt(e,vu(cf(b))),o=vI(n,m,g==p),n=0,g++}}n++,i++}return gf(e,"")};hf.exports=function(r){var e=[],t=gI(pI(hI(r),pf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],wt(e,mI(cI,n)?"xn--"+yI(n):n);return gf(e,".")}});var bu=h((KB,vf)=>{var bI=TypeError;vf.exports=function(r,e){if(r<e)throw bI("Not enough arguments");return r}});var bf=h((XB,yf)=>{var kI=xe(),SI=Gn(),PI=Qe().f,ku=kI("unscopables"),Su=Array.prototype;Su[ku]==null&&PI(Su,ku,{configurable:!0,value:SI(null)});yf.exports=function(r){Su[ku][r]=!0}});var xf=h((ZB,wf)=>{"use strict";var CI=Jr(),Pu=bf(),kf=$r(),Pf=zr(),wI=Qe().f,xI=ou(),Da=au(),II=Wr(),FI=fe(),Cf="Array Iterator",TI=Pf.set,AI=Pf.getterFor(Cf);wf.exports=xI(Array,"Array",function(r,e){TI(this,{type:Cf,target:CI(r),index:0,kind:e})},function(){var r=AI(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Da(void 0,!0)):t=="keys"?Da(i,!1):t=="values"?Da(e[i],!1):Da([i,e[i]],!1)},"values");var Sf=kf.Arguments=kf.Array;Pu("keys");Pu("values");Pu("entries");if(!II&&FI&&Sf.name!=="values")try{wI(Sf,"name",{value:"values"})}catch{}});var Ff=h((QB,If)=>{var EI=ar();If.exports=function(r,e,t){for(var i in e)EI(r,i,e[i],t);return r}});var Ef=h((YB,Af)=>{var Tf=gu(),RI=Math.floor,Cu=function(r,e){var t=r.length,i=RI(t/2);return t<8?OI(r,e):BI(r,Cu(Tf(r,0,i),e),Cu(Tf(r,i),e),e)},OI=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},BI=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};Af.exports=Cu});var Bu=h((eM,Xf)=>{"use strict";xf();var Tu=Wn(),Qr=he(),La=je(),Ye=Z(),MI=fe(),jf=du(),Wf=ar(),UI=Ff(),DI=Vn(),LI=nu(),Ru=zr(),Gf=lu(),wu=Q(),NI=we(),_I=Ma(),HI=Nn(),qI=Ze(),Vf=Ct(),ve=_n(),jI=Gn(),Rf=Vr(),Au=pu(),WI=Ua(),Zr=bu(),GI=xe(),VI=Ef(),zI=GI("iterator"),Qn="URLSearchParams",zf=Qn+"Iterator",Jf=Ru.set,Ge=Ru.getterFor(Qn),JI=Ru.getterFor(zf),$I=Object.getOwnPropertyDescriptor,Ou=function(r){if(!MI)return Qr[r];var e=$I(Qr,r);return e&&e.value},Of=Ou("fetch"),_a=Ou("Request"),Xn=Ou("Headers"),xu=_a&&_a.prototype,Bf=Xn&&Xn.prototype,KI=Qr.RegExp,XI=Qr.TypeError,$f=Qr.decodeURIComponent,ZI=Qr.encodeURIComponent,QI=Ye("".charAt),Mf=Ye([].join),lr=Ye([].push),Eu=Ye("".replace),YI=Ye([].shift),Uf=Ye([].splice),Df=Ye("".split),eF=Ye("".slice),tF=/\+/g,Lf=Array(4),rF=function(r){return Lf[r-1]||(Lf[r-1]=KI("((?:%[\\da-f]{2}){"+r+"})","gi"))},iF=function(r){try{return $f(r)}catch{return r}},Nf=function(r){var e=Eu(r,tF," "),t=4;try{return $f(e)}catch{for(;t;)e=Eu(e,rF(t--),iF);return e}},nF=/[!'()~]|%20/g,sF={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},oF=function(r){return sF[r]},_f=function(r){return Eu(ZI(r),nF,oF)},Iu=LI(function(e,t){Jf(this,{type:zf,iterator:Au(Ge(e).entries),kind:t})},"Iterator",function(){var e=JI(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),Kf=function(r){this.entries=[],this.url=null,r!==void 0&&(Vf(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?QI(r,0)==="?"?eF(r,1):r:ve(r)))};Kf.prototype={type:Qn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=WI(r),t,i,n,o,a,c,p;if(e)for(t=Au(r,e),i=t.next;!(n=La(i,t)).done;){if(o=Au(qI(n.value)),a=o.next,(c=La(a,o)).done||(p=La(a,o)).done||!La(a,o).done)throw XI("Expected sequence with length 2");lr(this.entries,{key:ve(c.value),value:ve(p.value)})}else for(var g in r)NI(r,g)&&lr(this.entries,{key:g,value:ve(r[g])})},parseQuery:function(r){if(r)for(var e=Df(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Df(i,"="),lr(this.entries,{key:Nf(YI(n)),value:Nf(Mf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],lr(e,_f(i.key)+"="+_f(i.value));return Mf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Ha=function(){Gf(this,Zn);var e=arguments.length>0?arguments[0]:void 0;Jf(this,new Kf(e))},Zn=Ha.prototype;UI(Zn,{append:function(e,t){Zr(arguments.length,2);var i=Ge(this);lr(i.entries,{key:ve(e),value:ve(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=ve(r),n=0;n<t.length;)t[n].key===i?Uf(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=[],o=0;o<t.length;o++)t[o].key===i&&lr(n,t[o].value);return n},has:function(e){Zr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Zr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=ve(e),c=ve(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?Uf(n,p--,1):(o=!0,g.value=c));o||lr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ge(this);VI(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=_I(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 Iu(this,"keys")},values:function(){return new Iu(this,"values")},entries:function(){return new Iu(this,"entries")}},{enumerable:!0});Wf(Zn,zI,Zn.entries,{name:"entries"});Wf(Zn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});DI(Ha,Qn);Tu({global:!0,constructor:!0,forced:!jf},{URLSearchParams:Ha});!jf&&wu(Xn)&&(Hf=Ye(Bf.has),qf=Ye(Bf.set),Fu=function(r){if(Vf(r)){var e=r.body,t;if(HI(e)===Qn)return t=r.headers?new Xn(r.headers):new Xn,Hf(t,"content-type")||qf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),jI(r,{body:Rf(0,ve(e)),headers:Rf(0,t)})}return r},wu(Of)&&Tu({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Of(e,arguments.length>1?Fu(arguments[1]):{})}}),wu(_a)&&(Na=function(e){return Gf(this,xu),new _a(e,arguments.length>1?Fu(arguments[1]):{})},xu.constructor=Na,Na.prototype=xu,Tu({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Na})));var Hf,qf,Fu,Na;Xf.exports={URLSearchParams:Ha,getState:Ge}});var hv=h(()=>{"use strict";wh();var aF=Wn(),Ku=fe(),dF=du(),Xu=he(),Zf=Ma(),Ee=Z(),Va=ar(),Ie=Oh(),lF=lu(),zu=we(),Zu=Lh(),Yr=sf(),Ve=gu(),uF=ml().codeAt,cF=ff(),ct=_n(),mF=Vn(),pF=bu(),lv=Bu(),uv=zr(),gF=uv.set,za=uv.getterFor("URL"),hF=lv.URLSearchParams,fF=lv.getState,Yn=Xu.URL,Ju=Xu.TypeError,Ja=Xu.parseInt,vF=Math.floor,Qf=Math.pow,Ae=Ee("".charAt),ze=Ee(/./.exec),ts=Ee([].join),yF=Ee(1 .toString),bF=Ee([].pop),ti=Ee([].push),Yf=Ee("".replace),kF=Ee([].shift),SF=Ee("".split),is=Ee("".slice),$a=Ee("".toLowerCase),PF=Ee([].unshift),CF="Invalid authority",Mu="Invalid scheme",ur="Invalid host",ev="Invalid port",cv=/[a-z]/i,wF=/[\d+-.a-z]/i,$u=/\d/,xF=/^0x/i,IF=/^[0-7]+$/,FF=/^\d+$/,mv=/^[\da-f]+$/i,TF=/[\0\t\n\r #%/:<>?@[\\\]^|]/,AF=/[\0\t\n\r #/:<>?@[\\\]^|]/,EF=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,RF=/[\t\n\r]/g,Fe,OF=function(r){var e=SF(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&&Ae(o,0)=="0"&&(a=ze(xF,o)?16:8,o=is(o,a==8?1:2)),o==="")c=0;else{if(!ze(a==10?FF:a==8?IF:mv,o))return r;c=Ja(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=Qf(256,5-t))return null}else if(c>255)return null;for(p=bF(i),n=0;n<i.length;n++)p+=i[n]*Qf(256,3-n);return p},BF=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,f,m,b=function(){return Ae(r,n)};if(b()==":"){if(Ae(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(mv,b());)o=o*16+Ja(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!ze($u,b()))return;for(;ze($u,b());){if(g=Ja(b(),10),p===null)p=g;else{if(p==0)return;p=p*10+g}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(f=t-i,t=7;t!=0&&f>0;)m=e[t],e[t--]=e[i+f-1],e[i+--f]=m;else if(t!=8)return;return e},MF=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},es=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)PF(e,r%256),r=vF(r/256);return ts(e,".")}else if(typeof r=="object"){for(e="",i=MF(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=yF(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},Ga={},pv=Zu({},Ga,{" ":1,'"':1,"<":1,">":1,"`":1}),gv=Zu({},pv,{"#":1,"?":1,"{":1,"}":1}),Uu=Zu({},gv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=uF(r,0);return t>32&&t<127&&!zu(e,r)?r:encodeURIComponent(r)},qa={ftp:21,file:null,http:80,https:443,ws:80,wss:443},rs=function(r,e){var t;return r.length==2&&ze(cv,Ae(r,0))&&((t=Ae(r,1))==":"||!e&&t=="|")},tv=function(r){var e;return r.length>1&&rs(is(r,0,2))&&(r.length==2||(e=Ae(r,2))==="/"||e==="\\"||e==="?"||e==="#")},UF=function(r){return r==="."||$a(r)==="%2e"},DF=function(r){return r=$a(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Du={},rv={},Lu={},iv={},nv={},Nu={},sv={},ov={},ja={},Wa={},_u={},Hu={},qu={},ju={},av={},Wu={},ei={},et={},dv={},cr={},ut={},Qu=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw Ju(o);this.searchParams=null}else{if(t!==void 0&&(n=new Qu(t,!0)),o=this.parse(i,null,n),o)throw Ju(o);a=fF(new hF),a.bindURL(this),this.searchParams=a}};Qu.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Du,o=0,a="",c=!1,p=!1,g=!1,f,m,b,v;for(r=ct(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=Yf(r,EF,"")),r=Yf(r,RF,""),f=Yr(r);o<=f.length;){switch(m=f[o],n){case Du:if(m&&ze(cv,m))a+=$a(m),n=rv;else{if(e)return Mu;n=Lu;continue}break;case rv:if(m&&(ze(wF,m)||m=="+"||m=="-"||m=="."))a+=$a(m);else if(m==":"){if(e&&(i.isSpecial()!=zu(qa,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&qa[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=ju:i.isSpecial()&&t&&t.scheme==i.scheme?n=iv:i.isSpecial()?n=ov:f[o+1]=="/"?(n=nv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=dv)}else{if(e)return Mu;a="",n=Lu,o=0;continue}break;case Lu:if(!t||t.cannotBeABaseURL&&m!="#")return Mu;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Ve(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?ju:Nu;continue;case iv:if(m=="/"&&f[o+1]=="/")n=ja,o++;else{n=Nu;continue}break;case nv:if(m=="/"){n=Wa;break}else{n=et;continue}case Nu:if(i.scheme=t.scheme,m==Fe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=sv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.path.length--,n=et;continue}break;case sv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=ja;else if(m=="/")n=Wa;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case ov:if(n=ja,m!="/"||Ae(a,o+1)!="/")continue;o++;break;case ja:if(m!="/"&&m!="\\"){n=Wa;continue}break;case Wa:if(m=="@"){c&&(a="%40"+a),c=!0,b=Yr(a);for(var P=0;P<b.length;P++){var C=b[P];if(C==":"&&!g){g=!0;continue}var F=xt(C,Uu);g?i.password+=F:i.username+=F}a=""}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return CF;o-=Yr(a).length+1,a="",n=_u}else a+=m;break;case _u:case Hu:if(e&&i.scheme=="file"){n=Wu;continue}else if(m==":"&&!p){if(a=="")return ur;if(v=i.parseHost(a),v)return v;if(a="",n=qu,e==Hu)return}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ur;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(v=i.parseHost(a),v)return v;if(a="",n=ei,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case qu:if(ze($u,m))a+=m;else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var I=Ja(a,10);if(I>65535)return ev;i.port=i.isSpecial()&&I===qa[i.scheme]?null:I,a=""}if(e)return;n=ei;continue}else return ev;break;case ju:if(i.scheme="file",m=="/"||m=="\\")n=av;else if(t&&t.scheme=="file")if(m==Fe)i.host=t.host,i.path=Ve(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.host=t.host,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{tv(ts(Ve(f,o),""))||(i.host=t.host,i.path=Ve(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case av:if(m=="/"||m=="\\"){n=Wu;break}t&&t.scheme=="file"&&!tv(ts(Ve(f,o),""))&&(rs(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=et;continue;case Wu:if(m==Fe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&rs(a))n=et;else if(a==""){if(i.host="",e)return;n=ei}else{if(v=i.parseHost(a),v)return v;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ei}continue}else a+=m;break;case ei:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=cr;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=Fe&&(n=et,m!="/"))continue;break;case et:if(m==Fe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(DF(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):UF(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&rs(a)&&(i.host&&(i.host=""),a=Ae(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==Fe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)kF(i.path);m=="?"?(i.query="",n=cr):m=="#"&&(i.fragment="",n=ut)}else a+=xt(m,gv);break;case dv:m=="?"?(i.query="",n=cr):m=="#"?(i.fragment="",n=ut):m!=Fe&&(i.path[0]+=xt(m,Ga));break;case cr:!e&&m=="#"?(i.fragment="",n=ut):m!=Fe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,Ga));break;case ut:m!=Fe&&(i.fragment+=xt(m,pv));break}o++}},parseHost:function(r){var e,t,i;if(Ae(r,0)=="["){if(Ae(r,r.length-1)!="]"||(e=BF(is(r,1,-1)),!e))return ur;this.host=e}else if(this.isSpecial()){if(r=cF(r),ze(TF,r)||(e=OF(r),e===null))return ur;this.host=e}else{if(ze(AF,r))return ur;for(e="",t=Yr(r),i=0;i<t.length;i++)e+=xt(t[i],Ga);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return zu(qa,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!rs(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+=es(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+ts(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw Ju(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ri(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+es(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",Du)},getUsername:function(){return this.username},setUsername:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],Uu)}},getPassword:function(){return this.password},setPassword:function(r){var e=Yr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],Uu)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?es(r):es(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,_u)},getHostname:function(){var r=this.host;return r===null?"":es(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Hu)},getPort:function(){var r=this.port;return r===null?"":ct(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=ct(r),r==""?this.port=null:this.parse(r,qu))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ts(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ei))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ae(r,0)=="?"&&(r=is(r,1)),this.query="",this.parse(r,cr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=ct(r),r==""){this.fragment=null;return}Ae(r,0)=="#"&&(r=is(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=lF(this,ne),i=pF(arguments.length,1)>1?arguments[1]:void 0,n=gF(t,new Qu(e,!1,i));Ku||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},ne=ri.prototype,Te=function(r,e){return{get:function(){return za(this)[r]()},set:e&&function(t){return za(this)[e](t)},configurable:!0,enumerable:!0}};Ku&&(Ie(ne,"href",Te("serialize","setHref")),Ie(ne,"origin",Te("getOrigin")),Ie(ne,"protocol",Te("getProtocol","setProtocol")),Ie(ne,"username",Te("getUsername","setUsername")),Ie(ne,"password",Te("getPassword","setPassword")),Ie(ne,"host",Te("getHost","setHost")),Ie(ne,"hostname",Te("getHostname","setHostname")),Ie(ne,"port",Te("getPort","setPort")),Ie(ne,"pathname",Te("getPathname","setPathname")),Ie(ne,"search",Te("getSearch","setSearch")),Ie(ne,"searchParams",Te("getSearchParams")),Ie(ne,"hash",Te("getHash","setHash")));Va(ne,"toJSON",function(){return za(this).serialize()},{enumerable:!0});Va(ne,"toString",function(){return za(this).serialize()},{enumerable:!0});Yn&&(Gu=Yn.createObjectURL,Vu=Yn.revokeObjectURL,Gu&&Va(ri,"createObjectURL",Zf(Gu,Yn)),Vu&&Va(ri,"revokeObjectURL",Zf(Vu,Yn)));var Gu,Vu;mF(ri,"URL");aF({global:!0,constructor:!0,forced:!dF,sham:!Ku},{URL:ri})});var fv=h(()=>{hv()});var vv=h(()=>{"use strict";var LF=Wn(),NF=je();LF({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return NF(URL.prototype.toString,this)}})});var yv=h(()=>{Bu()});var kv=h((lM,bv)=>{var _F=he();bv.exports=_F});var Pv=h((uM,Sv)=>{fv();vv();yv();var HF=kv();Sv.exports=HF.URL});var Ic=h((LL,Ry)=>{var eA=Object.prototype.toString;Ry.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 sA(e)?"generatorfunction":"function";if(tA(e))return"array";if(dA(e))return"buffer";if(aA(e))return"arguments";if(iA(e))return"date";if(rA(e))return"error";if(nA(e))return"regexp";switch(Ey(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(oA(e))return"generator";switch(t=eA.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 Ey(r){return typeof r.constructor=="function"?r.constructor.name:null}function tA(r){return Array.isArray?Array.isArray(r):r instanceof Array}function rA(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function iA(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function nA(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function sA(r,e){return Ey(r)==="GeneratorFunction"}function oA(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function aA(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 dA(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var My=h((NL,By)=>{"use strict";var Oy=Symbol.prototype.valueOf,lA=Ic();function uA(r,e){switch(lA(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 gA(r);case"symbol":return hA(r);case"arraybuffer":return mA(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return pA(r);case"regexp":return cA(r);case"error":return Object.create(r);default:return r}}function cA(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 mA(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function pA(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function gA(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function hA(r){return Oy?Object(Oy.call(r)):{}}By.exports=uA});var Dy=h((_L,Uy)=>{"use strict";Uy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var _y=h((HL,Ny)=>{"use strict";var fA=Dy();function Ly(r){return fA(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Ny.exports=function(e){var t,i;return!(Ly(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ly(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var qy=h((qL,Hy)=>{"use strict";var vA=My(),yA=Ic(),bA=_y();function Fc(r,e){switch(yA(r)){case"object":return kA(r,e);case"array":return SA(r,e);default:return vA(r)}}function kA(r,e){if(typeof e=="function")return e(r);if(e||bA(r)){let t=new r.constructor;for(let i in r)t[i]=Fc(r[i],e);return t}return r}function SA(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Fc(r[i],e);return t}Hy.exports=Fc});var _c=h((hs,Ii)=>{var PA=200,Nc="__lodash_hash_undefined__",yd=1,Yy=2,eb=9007199254740991,cd="[object Arguments]",Rc="[object Array]",CA="[object AsyncFunction]",tb="[object Boolean]",rb="[object Date]",ib="[object Error]",nb="[object Function]",wA="[object GeneratorFunction]",md="[object Map]",sb="[object Number]",xA="[object Null]",xi="[object Object]",jy="[object Promise]",IA="[object Proxy]",ob="[object RegExp]",pd="[object Set]",ab="[object String]",FA="[object Symbol]",TA="[object Undefined]",Oc="[object WeakMap]",db="[object ArrayBuffer]",gd="[object DataView]",AA="[object Float32Array]",EA="[object Float64Array]",RA="[object Int8Array]",OA="[object Int16Array]",BA="[object Int32Array]",MA="[object Uint8Array]",UA="[object Uint8ClampedArray]",DA="[object Uint16Array]",LA="[object Uint32Array]",NA=/[\\^$.*+?()[\]{}|]/g,_A=/^\[object .+?Constructor\]$/,HA=/^(?:0|[1-9]\d*)$/,W={};W[AA]=W[EA]=W[RA]=W[OA]=W[BA]=W[MA]=W[UA]=W[DA]=W[LA]=!0;W[cd]=W[Rc]=W[db]=W[tb]=W[gd]=W[rb]=W[ib]=W[nb]=W[md]=W[sb]=W[xi]=W[ob]=W[pd]=W[ab]=W[Oc]=!1;var lb=typeof global=="object"&&global&&global.Object===Object&&global,qA=typeof self=="object"&&self&&self.Object===Object&&self,ht=lb||qA||Function("return this")(),ub=typeof hs=="object"&&hs&&!hs.nodeType&&hs,Wy=ub&&typeof Ii=="object"&&Ii&&!Ii.nodeType&&Ii,cb=Wy&&Wy.exports===ub,Tc=cb&&lb.process,Gy=function(){try{return Tc&&Tc.binding&&Tc.binding("util")}catch{}}(),Vy=Gy&&Gy.isTypedArray;function jA(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 WA(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function GA(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 VA(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function zA(r){return function(e){return r(e)}}function JA(r,e){return r.has(e)}function $A(r,e){return r?.[e]}function KA(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function XA(r,e){return function(t){return r(e(t))}}function ZA(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var QA=Array.prototype,YA=Function.prototype,bd=Object.prototype,Ac=ht["__core-js_shared__"],mb=YA.toString,rt=bd.hasOwnProperty,zy=function(){var r=/[^.]+$/.exec(Ac&&Ac.keys&&Ac.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),pb=bd.toString,eE=RegExp("^"+mb.call(rt).replace(NA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Jy=cb?ht.Buffer:void 0,hd=ht.Symbol,$y=ht.Uint8Array,gb=bd.propertyIsEnumerable,tE=QA.splice,br=hd?hd.toStringTag:void 0,Ky=Object.getOwnPropertySymbols,rE=Jy?Jy.isBuffer:void 0,iE=XA(Object.keys,Object),Bc=Fi(ht,"DataView"),fs=Fi(ht,"Map"),Mc=Fi(ht,"Promise"),Uc=Fi(ht,"Set"),Dc=Fi(ht,"WeakMap"),vs=Fi(Object,"create"),nE=Pr(Bc),sE=Pr(fs),oE=Pr(Mc),aE=Pr(Uc),dE=Pr(Dc),Xy=hd?hd.prototype:void 0,Ec=Xy?Xy.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 lE(){this.__data__=vs?vs(null):{},this.size=0}function uE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function cE(r){var e=this.__data__;if(vs){var t=e[r];return t===Nc?void 0:t}return rt.call(e,r)?e[r]:void 0}function mE(r){var e=this.__data__;return vs?e[r]!==void 0:rt.call(e,r)}function pE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=vs&&e===void 0?Nc:e,this}kr.prototype.clear=lE;kr.prototype.delete=uE;kr.prototype.get=cE;kr.prototype.has=mE;kr.prototype.set=pE;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function gE(){this.__data__=[],this.size=0}function hE(r){var e=this.__data__,t=kd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():tE.call(e,t,1),--this.size,!0}function fE(r){var e=this.__data__,t=kd(e,r);return t<0?void 0:e[t][1]}function vE(r){return kd(this.__data__,r)>-1}function yE(r,e){var t=this.__data__,i=kd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=gE;ft.prototype.delete=hE;ft.prototype.get=fE;ft.prototype.has=vE;ft.prototype.set=yE;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 bE(){this.size=0,this.__data__={hash:new kr,map:new(fs||ft),string:new kr}}function kE(r){var e=Sd(this,r).delete(r);return this.size-=e?1:0,e}function SE(r){return Sd(this,r).get(r)}function PE(r){return Sd(this,r).has(r)}function CE(r,e){var t=Sd(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Sr.prototype.clear=bE;Sr.prototype.delete=kE;Sr.prototype.get=SE;Sr.prototype.has=PE;Sr.prototype.set=CE;function fd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Sr;++e<t;)this.add(r[e])}function wE(r){return this.__data__.set(r,Nc),this}function xE(r){return this.__data__.has(r)}fd.prototype.add=fd.prototype.push=wE;fd.prototype.has=xE;function Ut(r){var e=this.__data__=new ft(r);this.size=e.size}function IE(){this.__data__=new ft,this.size=0}function FE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function TE(r){return this.__data__.get(r)}function AE(r){return this.__data__.has(r)}function EE(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!fs||i.length<PA-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}Ut.prototype.clear=IE;Ut.prototype.delete=FE;Ut.prototype.get=TE;Ut.prototype.has=AE;Ut.prototype.set=EE;function RE(r,e){var t=vd(r),i=!t&&zE(r),n=!t&&!i&&Lc(r),o=!t&&!i&&!n&&Sb(r),a=t||i||n||o,c=a?VA(r.length,String):[],p=c.length;for(var g in r)(e||rt.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||qE(g,p)))&&c.push(g);return c}function kd(r,e){for(var t=r.length;t--;)if(vb(r[t][0],e))return t;return-1}function OE(r,e,t){var i=e(r);return vd(r)?i:WA(i,t(r))}function bs(r){return r==null?r===void 0?TA:xA:br&&br in Object(r)?_E(r):VE(r)}function Zy(r){return ys(r)&&bs(r)==cd}function hb(r,e,t,i,n){return r===e?!0:r==null||e==null||!ys(r)&&!ys(e)?r!==r&&e!==e:BE(r,e,t,i,hb,n)}function BE(r,e,t,i,n,o){var a=vd(r),c=vd(e),p=a?Rc:Mt(r),g=c?Rc:Mt(e);p=p==cd?xi:p,g=g==cd?xi:g;var f=p==xi,m=g==xi,b=p==g;if(b&&Lc(r)){if(!Lc(e))return!1;a=!0,f=!1}if(b&&!f)return o||(o=new Ut),a||Sb(r)?fb(r,e,t,i,n,o):LE(r,e,p,t,i,n,o);if(!(t&yd)){var v=f&&rt.call(r,"__wrapped__"),P=m&&rt.call(e,"__wrapped__");if(v||P){var C=v?r.value():r,F=P?e.value():e;return o||(o=new Ut),n(C,F,t,i,o)}}return b?(o||(o=new Ut),NE(r,e,t,i,n,o)):!1}function ME(r){if(!kb(r)||WE(r))return!1;var e=yb(r)?eE:_A;return e.test(Pr(r))}function UE(r){return ys(r)&&bb(r.length)&&!!W[bs(r)]}function DE(r){if(!GE(r))return iE(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function fb(r,e,t,i,n,o){var a=t&yd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var g=o.get(r);if(g&&o.get(e))return g==e;var f=-1,m=!0,b=t&Yy?new fd:void 0;for(o.set(r,e),o.set(e,r);++f<c;){var v=r[f],P=e[f];if(i)var C=a?i(P,v,f,e,r,o):i(v,P,f,r,e,o);if(C!==void 0){if(C)continue;m=!1;break}if(b){if(!GA(e,function(F,I){if(!JA(b,I)&&(v===F||n(v,F,t,i,o)))return b.push(I)})){m=!1;break}}else if(!(v===P||n(v,P,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function LE(r,e,t,i,n,o,a){switch(t){case gd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case db:return!(r.byteLength!=e.byteLength||!o(new $y(r),new $y(e)));case tb:case rb:case sb:return vb(+r,+e);case ib:return r.name==e.name&&r.message==e.message;case ob:case ab:return r==e+"";case md:var c=KA;case pd:var p=i&yd;if(c||(c=ZA),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=Yy,a.set(r,e);var f=fb(c(r),c(e),i,n,o,a);return a.delete(r),f;case FA:if(Ec)return Ec.call(r)==Ec.call(e)}return!1}function NE(r,e,t,i,n,o){var a=t&yd,c=Qy(r),p=c.length,g=Qy(e),f=g.length;if(p!=f&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:rt.call(e,b)))return!1}var v=o.get(r);if(v&&o.get(e))return v==e;var P=!0;o.set(r,e),o.set(e,r);for(var C=a;++m<p;){b=c[m];var F=r[b],I=e[b];if(i)var ge=a?i(I,F,b,e,r,o):i(F,I,b,r,e,o);if(!(ge===void 0?F===I||n(F,I,t,i,o):ge)){P=!1;break}C||(C=b=="constructor")}if(P&&!C){var Un=r.constructor,sa=e.constructor;Un!=sa&&"constructor"in r&&"constructor"in e&&!(typeof Un=="function"&&Un instanceof Un&&typeof sa=="function"&&sa instanceof sa)&&(P=!1)}return o.delete(r),o.delete(e),P}function Qy(r){return OE(r,KE,HE)}function Sd(r,e){var t=r.__data__;return jE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Fi(r,e){var t=$A(r,e);return ME(t)?t:void 0}function _E(r){var e=rt.call(r,br),t=r[br];try{r[br]=void 0;var i=!0}catch{}var n=pb.call(r);return i&&(e?r[br]=t:delete r[br]),n}var HE=Ky?function(r){return r==null?[]:(r=Object(r),jA(Ky(r),function(e){return gb.call(r,e)}))}:XE,Mt=bs;(Bc&&Mt(new Bc(new ArrayBuffer(1)))!=gd||fs&&Mt(new fs)!=md||Mc&&Mt(Mc.resolve())!=jy||Uc&&Mt(new Uc)!=pd||Dc&&Mt(new Dc)!=Oc)&&(Mt=function(r){var e=bs(r),t=e==xi?r.constructor:void 0,i=t?Pr(t):"";if(i)switch(i){case nE:return gd;case sE:return md;case oE:return jy;case aE:return pd;case dE:return Oc}return e});function qE(r,e){return e=e??eb,!!e&&(typeof r=="number"||HA.test(r))&&r>-1&&r%1==0&&r<e}function jE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function WE(r){return!!zy&&zy in r}function GE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||bd;return r===t}function VE(r){return pb.call(r)}function Pr(r){if(r!=null){try{return mb.call(r)}catch{}try{return r+""}catch{}}return""}function vb(r,e){return r===e||r!==r&&e!==e}var zE=Zy(function(){return arguments}())?Zy:function(r){return ys(r)&&rt.call(r,"callee")&&!gb.call(r,"callee")},vd=Array.isArray;function JE(r){return r!=null&&bb(r.length)&&!yb(r)}var Lc=rE||ZE;function $E(r,e){return hb(r,e)}function yb(r){if(!kb(r))return!1;var e=bs(r);return e==nb||e==wA||e==CA||e==IA}function bb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=eb}function kb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function ys(r){return r!=null&&typeof r=="object"}var Sb=Vy?zA(Vy):UE;function KE(r){return JE(r)?RE(r):DE(r)}function XE(){return[]}function ZE(){return!1}Ii.exports=$E});var dS=h(Ld=>{"use strict";Ld.byteLength=xR;Ld.toByteArray=FR;Ld.fromByteArray=ER;var st=[],_e=[],wR=typeof Uint8Array<"u"?Uint8Array:Array,vm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Lr=0,oS=vm.length;Lr<oS;++Lr)st[Lr]=vm[Lr],_e[vm.charCodeAt(Lr)]=Lr;var Lr,oS;_e[45]=62;_e[95]=63;function aS(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=aS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function IR(r,e,t){return(e+t)*3/4-t}function FR(r){var e,t=aS(r),i=t[0],n=t[1],o=new wR(IR(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=_e[r.charCodeAt(p)]<<18|_e[r.charCodeAt(p+1)]<<12|_e[r.charCodeAt(p+2)]<<6|_e[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=_e[r.charCodeAt(p)]<<2|_e[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=_e[r.charCodeAt(p)]<<10|_e[r.charCodeAt(p+1)]<<4|_e[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function TR(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function AR(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(TR(i));return n.join("")}function ER(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(AR(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(st[e>>2]+st[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),n.join("")}});var pq=Dn(Pv(),1);function y(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function mr(r,e){if(!r)throw Error(e)}var se;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(se||(se={}));function It(r){return r.startsWith(se.COMMENT)}function Ka(r){return r.startsWith(se.ACCOUNT)}function pr(r){return r.startsWith(se.LINK)}function Cv(r){return r.startsWith(se.MESSAGE)}function wv(r){return r.startsWith(se.SUBREDDIT)}function xv(r){return r.startsWith(se.AWARD)}function qF(r){mr(It(r),`Expected comment id to start with ${se.COMMENT}, got ${r}}`)}function jF(r){mr(Ka(r),`Expected account id to start with ${se.ACCOUNT}, got ${r}}`)}function WF(r){mr(pr(r),`Expected link id to start with ${se.LINK}, got ${r}}`)}function GF(r){mr(Cv(r),`Expected message id to start with ${se.MESSAGE}, got ${r}}`)}function VF(r){mr(wv(r),`Expected subreddit id to start with ${se.SUBREDDIT}, got ${r}}`)}function zF(r){mr(xv(r),`Expected award id to start with ${se.AWARD}, got ${r}}`)}function ii(r){return qF(r),r}function oe(r){return jF(r),r}function ye(r){return WF(r),r}function JF(r){return GF(r),r}function ie(r){return VF(r),r}function $F(r){return zF(r),r}function Re(r){if(It(r))return ii(r);if(Ka(r))return oe(r);if(pr(r))return ye(r);if(Cv(r))return JF(r);if(wv(r))return ie(r);if(xv(r))return $F(r);throw new Error(`Expected thing id to start with ${Object.values(se).join(", ")} got ${r}}`)}function Yu(r){return It(r)}import*as w from"@devvit/protos";var Xa=class{constructor(e){}};var ec=(t=>(t.Installation="installation",t.App="app",t))(ec||{});function gr(r,e=new Set){for(let t of r){if(t.type==="group"){gr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}KF(r)}function KF(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 Ft=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","caret-updown","planet","telescope"];import{AppSettingsDefinition as uT,GetFieldsResponse as cT}from"@devvit/protos";import{FormFieldType as Oe}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return XF(e);case"image":return ZF(e);case"paragraph":return QF(e);case"number":return YF(e);case"select":return eT(e);case"boolean":return tT(e);case"group":return rT(e);default:throw new Error("Unknown field type.")}})}function XF(r){return{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 ZF(r){return{disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required}}function QF(r){return{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 YF(r){return{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 eT(r){return{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 tT(r){return{defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label}}function rT(r){return{fieldId:"",fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText}}function M(r,e){u.prototype[r]=e}import{ValidateFormResponse as lT}from"@devvit/protos";import{RealtimeSubscriptionStatus as Fv}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",Post:"devvit-post",PostAuthor:"devvit-post-author",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",SubredditName:"devvit-subreddit-name",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),Iv;(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"})(Iv||(Iv={}));function Tv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];y(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];y(p,"useChannel - installation is missing from Context");async function g(F){let I=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(I,F);else throw Error(`Failed to send to channel '${I}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${I}`)}function f(){if(!o[n].active){let F=o[n].channel;o[n].active=!0,r.addRealtimeChannel(F)}}function m(){if(o[n].active){let F=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(F)}}function b(F){return async()=>{let I;switch(F.status){case Fv.REALTIME_SUBSCRIBED:o[n].connected=!0,I=t.onSubscribed?.();break;case Fv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,I=t.onUnsubscribed?.();break;default:I=t.onMessage(F.event?.data?.msg);break}await I}}let v={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Ft.CHANNEL};n in o?v=o[n]:n in a&&(v=a[n]);let P=r.realtimeEvent;r.isInitialRender?v.active=!1:P&&v.active&&P.event.channel===v.channel&&(v.preventCallback||r.runHook(b(P)),r.rerenderIn(0)),o[n]=v,r.currentHookIndex++;let C=0;return v.active&&v.connected?C=2:v.active&&!v.connected?C=1:!v.active&&v.connected?C=3:!v.active&&!v.connected&&(C=4),{subscribe:f,unsubscribe:m,send:g,status:C}}return e}import{FormFieldType as ni}from"@devvit/protos";function tc(r){switch(r.fieldType){case ni.STRING:return r.stringValue;case ni.IMAGE:return r.stringValue;case ni.PARAGRAPH:return r.stringValue;case ni.NUMBER:return r.numberValue;case ni.BOOLEAN:return r.boolValue;case ni.SELECTION:return r.selectionValue?.values??[];default:return}}function Tt(r){return Object.keys(r).reduce((e,t)=>{let i=tc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Av(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:Ft.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let f=r.formSubmittedEvent;return f&&!g.preventSubmit&&f.formId===p&&r.runHook(async()=>{let m=i(Tt(f.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function Ev(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:Ft.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function f(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,v]of Object.entries(o))if(b!==n.toString()&&v?.type===Ft.INTERVAL&&v?.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:Ft.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&g.running&&(g.preventCallback||(g.lastRun===void 0||g.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:f,stop:m}}return e}function Rv(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState();if(i in n)return r.currentHookIndex++,[n[i],a];if(r.isInitialRender||!(i in o)){let c=t instanceof Function?t():t;if(c instanceof Promise)throw(async()=>{n[i]=await c,r.currentHookIndex=0})();n[i]=c}else n[i]=o[i];function a(c){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=c instanceof Function?c(n[i]):c}return r.currentHookIndex++,[n[i],a]}return e}var sc={now(){return new Date}};function Ov(r){return`__autocache__${r}`}function Bv(r){return`__lock__${r}`}var nT=300,sT=1e3,Za=5e3,rc=3,Mv=.1,Uv=1e3,oT=3e4;function Dv(r){if(r.error)throw new Error(r.error);return r.value}var At,Et,Be,si,$,Lv,Nv,_v,ic,Hv,qv,nc,jv,Qa=class{constructor(e,t,i=sc){l(this,$);l(this,At);l(this,Et,{});l(this,Be);l(this,si);d(this,At,e),d(this,si,t),d(this,Be,i)}async cache(e,t){d(this,Et,s(this,si).__cache=s(this,si).__cache??{}),S(this,$,jv).call(this,t);let i=S(this,$,Lv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,nc).call(this,t.key),o=await S(this,$,Nv).call(this,t,n,e);return Dv(o)}};At=new WeakMap,Et=new WeakMap,Be=new WeakMap,si=new WeakMap,$=new WeakSet,Lv=function(e){let t=s(this,Et)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<rc&&Math.random()<Mv&&t.errorTime+Uv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Uv<i||n){delete s(this,Et)[e];return}else return Dv(t)}},Nv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,qv).call(this,n):1;return!t||t?.error&&t.errorCount<rc&&Mv>Math.random()||o>Math.random()?S(this,$,_v).call(this,e,t,i):t},_v=async function(e,t,i){let n=Bv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,At).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Hv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,ic).call(this,p,e.key,e.ttl)}},ic=async function(e,t,i){let n=Math.min(i,sT),o=await S(this,$,nc).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,nT)),S(this,$,ic).call(this,e,t,i)},Hv=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,Et)[e]=t,await s(this,At).set(Ov(e),JSON.stringify(t),{expiration:new Date(o+oT)}),t.error&&t.errorCount<rc&&await s(this,At).del(Bv(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},nc=async function(e){let t=await s(this,At).get(Ov(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Et)[e]=i,i}},jv=function(e){e.ttl<Za&&(console.warn(`Cache TTL cannot be less than ${Za} milliseconds! Updating ttl value of ${e.ttl} to ${Za}.`),e.ttl=Za)};function Wv(r,e,t=sc){let i=new Qa(r,e,t);return i.cache.bind(i)}function Gv(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,Vv,zv,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,Vv).call(this,e,t??{webview:!1}):S(this,li,zv).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,Vv=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return Gv(e),encodeURI(e)}catch{return""}},zv=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{Gv(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 Rt,ui=class{constructor(e){l(this,Rt);d(this,Rt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Rt));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,Rt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Rt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Rt));return e}};Rt=new WeakMap;var ns,ci=class{constructor(e){l(this,ns);d(this,ns,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,ns));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};ns=new WeakMap;var ss,mi=class{constructor(e){l(this,ss);d(this,ss,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ss))}};ss=new WeakMap;var os,pi=class{constructor(e){l(this,os);d(this,os,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:{msg:t}},s(this,os))}};os=new WeakMap;var k,as,gi=class{constructor(e){l(this,k);l(this,as);d(this,k,e),d(this,as,new ed(e))}get modMail(){return s(this,as)}getSubredditById(e){return be.getById(Re(e),s(this,k))}getSubredditInfoById(e){return $v(e,s(this,k))}getSubredditByName(e){return be.getByName(e,s(this,k))}getSubredditInfoByName(e){return Kv(e,s(this,k))}addSubredditRemovalReason(e,t){return be.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return be.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return be.getFromMetadata(s(this,k))}getPostById(e){return z.getById(Re(e),s(this,k))}submitPost(e){return z.submit(e,s(this,k))}crosspost(e){return z.crosspost(e,s(this,k))}getUserById(e){return x.getById(Re(e),s(this,k))}getUserByUsername(e){return x.getByUsername(e,s(this,k))}getCurrentUser(){return x.getFromMetadata(D.User,s(this,k))}getAppUser(){return x.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return x.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return te.getById(Re(e),s(this,k))}getComments(e){return te.getComments(e,s(this,k))}getCommentsByUser(e){return te.getCommentsByUser(e,s(this,k))}submitComment(e){return te.submit({...e,id:Re(e.id)},s(this,k))}getControversialPosts(e){return z.getControversialPosts(e,s(this,k))}getTopPosts(e){return z.getTopPosts(e,s(this,k))}getHotPosts(e){return z.getHotPosts(e,s(this,k))}getNewPosts(e){return z.getNewPosts(e,s(this,k))}getRisingPosts(e){return z.getRisingPosts(e,s(this,k))}getPostsByUser(e){return z.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return x.getOverview(e,s(this,k))}getModerationLog(e){return Ya(e,s(this,k))}getApprovedUsers(e){return x.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return x.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return x.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return x.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return x.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return x.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration,banContext:e.context},s(this,k))}unbanUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return x.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return x.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return x.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return x.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.username,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return x.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return x.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return x.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return x.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return x.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?Re(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(It(e))return te.approve(e,s(this,k));if(pr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(It(e))return te.remove(e,t,s(this,k));if(pr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return ue.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return ue.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return ue.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return ue.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return ue.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return ue.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,ye(t),s(this,k))}async getWidgets(e){return ae.getWidgets(e,s(this,k))}async deleteWidget(e,t){return ae.delete(e,t,s(this,k))}async addWidget(e){return ae.add(e,s(this,k))}async reorderWidgets(e,t){return ae.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ke.getPage(e,t,s(this,k))}async getWikiPages(e){return ke.getPages(e,s(this,k))}async createWikiPage(e){return ke.createPage(e,s(this,k))}async updateWikiPage(e){return ke.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ke.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ke.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ke.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ke.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ke.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ke.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 be.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return be.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return be.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return be.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return be.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return Qv(e,s(this,k))}getVaultByUserId(e){return Yv(Re(e),s(this,k))}getSubredditLeaderboard(e){return Xv(e,s(this,k))}getSubredditStyles(e){return Zv(e,s(this,k))}};k=new WeakMap,as=new WeakMap;import{RedisKeyScope as oc}from"@devvit/protos";function td(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var R,O,B,ac=class{constructor(e,t,i){l(this,R);l(this,O);l(this,B);d(this,R,e),d(this,O,t),d(this,B,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,O)},s(this,B)),this}async multi(){await s(this,R).Multi(s(this,O),s(this,B))}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,R).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,O)},s(this,B)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,O)},s(this,B)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,O)},s(this,B)),this}async exec(){let e=await s(this,R).Exec(s(this,O),s(this,B)),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,R).Discard(s(this,O),s(this,B))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,O)},s(this,B)),this}async unwatch(){return await s(this,R).Unwatch(s(this,O),s(this,B)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,O)},s(this,B)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,O)},s(this,B)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,R).Strlen({key:e,transactionId:s(this,O)},s(this,B)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,R).MGet({keys:e,transactionId:s(this,O)},s(this,B)),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,R).MSet({kv:t,transactionId:s(this,O)},s(this,B)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,O)},s(this,B)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,O)},s(this,B)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,O)},s(this,B)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,O)},s(this,B)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,O)},member:t},s(this,B)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,O)},member:t},s(this,B)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,O)},s(this,B)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,O)};return await s(this,R).ZScan(o,s(this,B)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,O)},s(this,B)),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,R).ZRange({key:{key:e,transactionId:s(this,O)},start:t+"",stop:i+"",...o},s(this,B)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,O)},members:t},s(this,B)),this}async zRemRangeByLex(e,t,i){return await s(this,R).ZRemRangeByLex({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,B)),this}async zRemRangeByRank(e,t,i){return await s(this,R).ZRemRangeByRank({key:{key:e,transactionId:s(this,O)},start:t,stop:i},s(this,B)),this}async zRemRangeByScore(e,t,i){return await s(this,R).ZRemRangeByScore({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,B)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,R).HGetAll({key:e,transactionId:s(this,O)},s(this,B)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,R).HGet({key:e,field:t,transactionId:s(this,O)},s(this,B)),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,R).HSet({key:e,fv:i,transactionId:s(this,O)},s(this,B)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,R).HIncrBy({key:e,field:t,value:i,transactionId:s(this,O)},s(this,B)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,R).HDel({key:e,fields:t,transactionId:s(this,O)},s(this,B)),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,O)};return await s(this,R).HScan(o,s(this,B)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,R).HKeys({key:e,transactionId:s(this,O)},s(this,B)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,R).HLen({key:e,transactionId:s(this,O)},s(this,B)),this}};R=new WeakMap,O=new WeakMap,B=new WeakMap;var U,hi,dc=class dc{constructor(e,t=void 0,i=oc.INSTALLATION){l(this,U);l(this,hi);d(this,U,e),d(this,hi,t),this.scope=i,this.global=i===oc.INSTALLATION?new dc(s(this,U),s(this,hi),oc.GLOBAL):this}get storage(){return s(this,hi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,U));return new ac(this.storage,t,s(this,U))}async get(e){try{let t=await this.storage.Get({key:e,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return t!==null?t.value??void 0:t}catch(t){if(td(t))return;throw t}}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,U))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,U))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,U))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,U));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,U))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,U))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,U))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,U))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,U))).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,U))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,U))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,U))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,U))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,U))).value}async zScore(e,t){try{let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zRank(e,t){try{let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(td(i))return;throw i}}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,U));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,U));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,U))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,U));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,U))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,U));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,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value??void 0:i}catch(i){if(td(i))return;throw i}}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([o,a])=>({field:o,value:a}));return(await this.storage.HSet({key:e,fv:i,scope:this.scope},s(this,U))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,U));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,U))).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,U))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,U));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,U))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};U=new WeakMap,hi=new WeakMap;var fi=dc;var fr,vi=class{constructor(e){l(this,fr);d(this,fr,e)}async runJob(e){return(await u.schedulerPlugin.Schedule({action:{type:e.name,data:e.data},cron:"cron"in e?e.cron:void 0,when:"runAt"in e?e.runAt:void 0},s(this,fr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,fr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,fr))).actions.map(t=>(y(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 ds,yi=class{constructor(e){l(this,ds);d(this,ds,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,ds));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...ey(t.installationSettings.settings,u.installationSettings),...ey(t.appSettings.settings,u.appSettings)}}};ds=new WeakMap;function ey(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=tc(r[n]),i),{});return e&&ty(t,e),t}function ty(r,e){for(let t of e)t.type==="group"?ty(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as lc,ToastAppearance as ry}from"@devvit/protos";var vr,bi,rd=class{constructor(e){l(this,vr,[]);l(this,bi);d(this,bi,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,bi)){let a=s(this,bi).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o={fields:[],id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description};gr(n.fields),o.fields=mt(n.fields),s(this,vr).push({type:lc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?ry.SUCCESS:ry.NEUTRAL}:t={text:e},s(this,vr).push({type:lc.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,vr).push({type:lc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,vr)}};vr=new WeakMap,bi=new WeakMap;function De({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new fi(r),c=Wv(a,i?i.state:{}),p=new gi(r),g=new vi(r),f=new yi(r),m=e?new rd(i):void 0,b=new ci(r),v=new di,P=new pi(r),C=t&&i?Rv(i):void 0,F=t&&i?Ev(i):void 0,I=t&&i?Av(i):void 0,ge=t&&i?Tv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:f,media:b,assets:v,realtime:P,get useForm(){return I??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return C??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return F??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return ge??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var iy={name:"@devvit/public-api",version:"0.11.3-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.3-dev","@devvit/shared-types":"0.11.3-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/repo-tools":"0.11.3-dev","@devvit/tsconfig":"0.11.3-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"18.0.1","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"9.11.1",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"256 KB"}},source:"./src/index.ts"};function ce(r,e,t){let i=r[D.Subreddit]?.values[0];y(i,"subreddit is missing from Context");let n=r[D.SubredditName]?.values[0],o=r[D.AppUser]?.values[0],a=r[D.App]?.values[0],c=r[D.Version]?.values[0],p=r[D.User]?.values[0],g=dT(r);return{get appAccountId(){return y(o,"appAccountId is missing from Context"),o},subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,appName:a,appVersion:c,debug:g,toJSON(){return{appAccountId:o,appName:a,appVersion:c,subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,debug:g}}}}function dT(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${iy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function ny(r){return r.flatMap(e=>e.type==="group"?ny(e.fields):e)}async function id(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Tt(r.fieldValues),o=ny(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,f=Object.assign(De({metadata:t}),ce(t)),m=await g({value:p,isEditing:r.editing},f);m&&(i.success=!1,i.errors[c]=m)}})),lT.fromJSON(i)}async function mT(){if(!u.appSettings)throw new Error("App settings were not defined.");return cT.fromJSON({fields:{fields:mt(u.appSettings)}})}async function pT(r,e){return id(r,u.appSettings,e)}function sy(r){r.provides(uT),M("GetAppSettingsFields",mT),M("ValidateAppForm",pT)}import{CustomPostDefinition as kT,RenderPostResponse as ST}from"@devvit/protos";import{BlockRenderEventType as Cc,EffectType as ky}from"@devvit/protos";function ki(r){return r.__effects}function oy(){let r=new Set;return e=>{let t=e,i=1;for(;r.has(t);)t=`${e}.${i++}`;return r.add(t),t}}import{BlockActionType as Pc,BlockAvatarBackground as fy,BlockAvatarFacing as vy,BlockAvatarSize as Ot,BlockBorderWidth as ad,BlockButtonAppearance as Bt,BlockButtonSize as gc,BlockGap as dd,BlockHorizontalAlignment as hc,BlockIconSize as ld,BlockImageResizeMode as ls,BlockPadding as us,BlockRadius as cs,BlockSpacerShape as fc,BlockSpacerSize as ud,BlockStackDirection as vc,BlockTextOutline as yc,BlockTextOverflow as bc,BlockTextSize as Pi,BlockTextStyle as kc,BlockTextWeight as yy,BlockType as tt,BlockVerticalAlignment as Sc}from"@devvit/protos";var uc={"alienblue-100":"#DCE2FB","alienblue-200":"#B8C5FC","alienblue-25":"#F7F8FD","alienblue-300":"#90A9FD","alienblue-400":"#648EFC","alienblue-50":"#EEF0FB","alienblue-500":"#1870F4","alienblue-600":"#115BCA","alienblue-700":"#0A449B","alienblue-75":"#E6E9FB","alienblue-800":"#0A2F6C","alienblue-900":"#0A1A3F","alienblue-950":"#07102B","berrypurple-100":"#F3DAFB","berrypurple-200":"#EAB3FD","berrypurple-25":"#FBF6FD","berrypurple-300":"#DE8BFF","berrypurple-400":"#CF5FFF","berrypurple-50":"#F8EDFC","berrypurple-500":"#BC0EFF","berrypurple-600":"#9B00D4","berrypurple-700":"#7600A3","berrypurple-75":"#F6E4FB","berrypurple-800":"#520472","berrypurple-900":"#300643","berrypurple-950":"#20042A",black:"#000000","black-opacity-0":"#00000000","black-opacity-10":"#00000019","black-opacity-15":"#00000026","black-opacity-20":"#00000033","black-opacity-25":"#0000003F","black-opacity-33":"#00000054","black-opacity-5":"#0000000C","black-opacity-50":"#0000007F","black-opacity-60":"#00000099","black-opacity-67":"#000000AA","black-opacity-80":"#000000CC","black-opacity-90":"#000000E5","brown-100":"#F1DFCF","brown-200":"#E9BE95","brown-25":"#FBF7F4","brown-300":"#DC9D5D","brown-400":"#BA854E","brown-50":"#F7EFE9","brown-500":"#9A6D3F","brown-600":"#7B5631","brown-700":"#5D4023","brown-75":"#F4E7DC","brown-800":"#3F2C19","brown-900":"#221A11","brown-950":"#15100A","coolgray-100":"#DBE4E9","coolgray-150":"#C9D7DE","coolgray-200":"#B7CAD4","coolgray-25":"#F6F8F9","coolgray-250":"#A4BDCA","coolgray-300":"#97AFBC","coolgray-350":"#8BA2AD","coolgray-400":"#7F949F","coolgray-450":"#748791","coolgray-50":"#EEF1F3","coolgray-500":"#667780","coolgray-525":"#576F76","coolgray-550":"#5C6C74","coolgray-600":"#536168","coolgray-650":"#48545B","coolgray-700":"#3D494E","coolgray-75":"#E5EBEE","coolgray-750":"#333D42","coolgray-800":"#2A3236","coolgray-850":"#21272A","coolgray-900":"#181C1F","coolgray-950":"#0E1113","global-black":{light:"#000000",dark:"#000000"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-white":{light:"#FFFFFF",dark:"#FFFFFF"},"kiwigreen-100":"#A8F5A0","kiwigreen-200":"#58E15B","kiwigreen-25":"#EBFDE7","kiwigreen-300":"#00C61C","kiwigreen-400":"#01A816","kiwigreen-50":"#DDF8D7","kiwigreen-500":"#008A10","kiwigreen-600":"#016E0B","kiwigreen-700":"#005306","kiwigreen-75":"#CAF5C2","kiwigreen-800":"#033902","kiwigreen-900":"#0D2005","kiwigreen-950":"#081404","lightblue-100":"#CAE7FB","lightblue-200":"#87D0FD","lightblue-25":"#F3F9FD","lightblue-300":"#02B9FB","lightblue-400":"#029DD5","lightblue-50":"#E6F3FC","lightblue-500":"#007FAE","lightblue-600":"#01668D","lightblue-700":"#014D6B","lightblue-75":"#D9EDFB","lightblue-800":"#03354B","lightblue-900":"#051E2B","lightblue-950":"#04131A","lime-100":"#B7F28E","lime-200":"#90DA58","lime-25":"#EEFDDC","lime-300":"#6DBF01","lime-400":"#5BA200","lime-50":"#E0F8C8","lime-500":"#4A8500","lime-600":"#3A6A00","lime-700":"#2A5000","lime-75":"#CEF5AD","lime-800":"#1E3702","lime-900":"#151E05","lime-950":"#0D1304","mintgreen-100":"#9BF5D9","mintgreen-200":"#00E2B7","mintgreen-25":"#E7FDF5","mintgreen-300":"#00C29D","mintgreen-400":"#01A484","mintgreen-50":"#D7F8EC","mintgreen-500":"#01876D","mintgreen-600":"#006C56","mintgreen-700":"#015140","mintgreen-75":"#C0F5E3","mintgreen-800":"#00382B","mintgreen-900":"#032019","mintgreen-950":"#03140F","orangered-100":"#FCDBCF","orangered-200":"#FDB498","orangered-25":"#FDF6F4","orangered-300":"#FF895D","orangered-400":"#FF4500","orangered-50":"#FCEEE8","orangered-500":"#D93900","orangered-600":"#AE2C00","orangered-700":"#842100","orangered-75":"#FBE5DC","orangered-800":"#591B02","orangered-900":"#2F1405","orangered-950":"#1C0D04","periwinkle-100":"#E6DFFB","periwinkle-200":"#CDBEFD","periwinkle-25":"#F9F7FD","periwinkle-300":"#B29FFF","periwinkle-400":"#9580FF","periwinkle-50":"#F2EFFC","periwinkle-500":"#6A5CFF","periwinkle-600":"#523DFF","periwinkle-700":"#4001EA","periwinkle-75":"#ECE7FB","periwinkle-800":"#250AA6","periwinkle-900":"#160E5B","periwinkle-950":"#0C083F","poopbrown-100":"#FEEEDD","poopbrown-200":"#F6DDC3","poopbrown-300":"#EECCAA","poopbrown-400":"#CAA075","poopbrown-50":"#FEF7EE","poopbrown-500":"#9A6D3F","poopbrown-600":"#6E4924","poopbrown-700":"#54371A","poopbrown-800":"#3B2510","poopbrown-900":"#29190A","poopbrown-950":"#110B04","puregray-100":"#F2F2F2","puregray-150":"#EBEBEB","puregray-200":"#E4E4E4","puregray-250":"#DDDDDD","puregray-300":"#D6D6D6","puregray-350":"#C3C3C3","puregray-400":"#ACACAC","puregray-450":"#919191","puregray-50":"#F8F8F8","puregray-500":"#767676","puregray-550":"#5C5C5C","puregray-600":"#434343","puregray-650":"#393939","puregray-700":"#303030","puregray-750":"#272727","puregray-800":"#1E1E1E","puregray-850":"#181818","puregray-900":"#131313","puregray-950":"#080808","red-100":"#FBDBD4","red-200":"#FDB3A4","red-25":"#FDF6F5","red-300":"#FF8773","red-400":"#FF4F40","red-50":"#FCEEEA","red-500":"#EB001F","red-600":"#BC0117","red-700":"#90000F","red-75":"#FBE4DF","red-800":"#650405","red-900":"#340F05","red-950":"#1F0B04","sakurapink-100":"#FBD9EB","sakurapink-200":"#FDAEDA","sakurapink-25":"#FDF6F9","sakurapink-300":"#FF7ECA","sakurapink-400":"#FF38BB","sakurapink-50":"#FCEDF4","sakurapink-500":"#DE019F","sakurapink-600":"#B2007F","sakurapink-700":"#880060","sakurapink-75":"#FBE3EF","sakurapink-800":"#5F0443","sakurapink-900":"#380626","sakurapink-950":"#250419",transparent:"transparent",white:"#ffffff","white-opacity-0":"#FFFFFF00","white-opacity-10":"#FFFFFF19","white-opacity-15":"#FFFFFF26","white-opacity-20":"#FFFFFF33","white-opacity-25":"#FFFFFF3F","white-opacity-5":"#FFFFFF0C","white-opacity-50":"#FFFFFF7F","yellow-100":"#FFE284","yellow-200":"#FFBF0B","yellow-25":"#FFF9E0","yellow-300":"#D8A100","yellow-400":"#B78800","yellow-50":"#FFF3C0","yellow-500":"#977000","yellow-600":"#785800","yellow-700":"#5B4200","yellow-75":"#FFEAA2","yellow-800":"#3F2D00","yellow-900":"#231A03","yellow-950":"#161003","yelloworange-100":"#FCDCC8","yelloworange-200":"#FDB586","yelloworange-25":"#FDF7F3","yelloworange-300":"#FF8A35","yelloworange-400":"#E46C00","yelloworange-50":"#FCEEE6","yelloworange-500":"#BD5800","yelloworange-600":"#974500","yelloworange-700":"#733300","yelloworange-75":"#FBE5D7","yelloworange-800":"#4E2402","yelloworange-900":"#2A1705","yelloworange-950":"#1A0E04","action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"action-upvote":{light:"#D93900",dark:"#D93900"},"ai-background-weaker":{light:"#E7FDF5",dark:"#00382B"},"ai-plain":{light:"#006C56",dark:"#01A484"},"ai-plain-hover":{light:"#015140",dark:"#00C29D"},"alert-caution":{light:"#977000",dark:"#977000"},"avatar-gradient":{light:"",dark:""},"brand-background":{light:"#D93900",dark:"#D93900"},"brand-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"category-live":{light:"#D93900",dark:"#D93900"},"category-nsfw":{light:"#DE019F",dark:"#DE019F"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"caution-background":{light:"#FFBF0B",dark:"#D8A100"},"caution-background-hover":{light:"#D8A100",dark:"#FFBF0B"},"caution-onBackground":{light:"#000000",dark:"#000000"},"caution-plain":{light:"#785800",dark:"#FFBF0B"},"caution-plain-hover":{light:"#5B4200",dark:"#FFE284"},"danger-background":{light:"#EB001F",dark:"#BC0117"},"danger-background-disabled":{light:"#FDB3A4",dark:"#340F05"},"danger-background-hover":{light:"#BC0117",dark:"#EB001F"},"danger-background-weaker":{light:"#FBDBD4",dark:"#650405"},"danger-content":{light:"#BC0117",dark:"#FF4F40"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"danger-content-hover":{light:"#90000F",dark:"#FF8773"},"danger-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"danger-plain":{light:"#BC0117",dark:"#FF8773"},"danger-plain-hover":{light:"#90000F",dark:"#FDB3A4"},"downvote-background":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-background-disabled":{light:"#6a5cff4d",dark:"#6a5cff4d"},"downvote-background-hover":{light:"#523DFF",dark:"#523DFF"},"downvote-content":{light:"#523DFF",dark:"#9580FF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#523DFF4c",dark:"#9580FF4c"},"downvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"downvote-onStrongScrim":{light:"#B29FFF",dark:"#B29FFF"},"downvote-onStrongScrim-disabled":{light:"#b29fff4d",dark:"#b29fff4d"},"downvote-onStrongScrim-weaker":{light:"#9580FF",dark:"#9580FF"},"downvote-plain":{light:"#523DFF",dark:"#9580FF"},"downvote-plain-disabled":{light:"#523dff4d",dark:"#9580ff4d"},"downvote-plain-weaker":{light:"#6A5CFF",dark:"#6A5CFF"},"elevation-large1":{light:"#0000003F",dark:"#0000007F"},"elevation-large2":{light:"#00000026",dark:"#00000033"},"elevation-medium1":{light:"#0000003F",dark:"#0000007F"},"elevation-medium2":{light:"#00000019",dark:"#00000033"},"elevation-small":{light:"#00000026",dark:"#00000054"},"elevation-xsmall":{light:"#0000003F",dark:"#000000AA"},favorite:{light:"#977000",dark:"#B78800"},"global-admin":{light:"#D93900",dark:"#D93900"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#2A3236",dark:"#2A3236"},"global-focus":{light:"#029DD5",dark:"#007FAE"},"global-gold":{light:"#B78800",dark:"#D8A100"},"global-moderator":{light:"#008A10",dark:"#008A10"},"global-nsfw":{light:"#DE019F",dark:"#DE019F"},"global-offline":{light:"#667780",dark:"#667780"},"global-online":{light:"#00C61C",dark:"#00C61C"},"global-orangered":{light:"#FF4500",dark:"#FF4500"},"global-stars":{light:"#977000",dark:"#D8A100"},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"identity-admin":{light:"#D93900",dark:"#D93900"},"identity-coins":{light:"#B78800",dark:"#B78800"},"identity-moderator":{light:"#008A10",dark:"#008A10"},"identity-self":{light:"#01876D",dark:"#01876D"},"interactive-background-disabled":{light:"#0000000C",dark:"#FFFFFF0C"},"interactive-content-disabled":{light:"#0000003F",dark:"#FFFFFF3F"},"interactive-focused":{light:"#007FAE",dark:"#007FAE"},"interactive-pressed":{light:"#00000026",dark:"#FFFFFF26"},"inverted-interactive-background-disabled":{light:"#FFFFFF0C",dark:"#0000000C"},"inverted-interactive-content-disabled":{light:"#FFFFFF3F",dark:"#0000003F"},"inverted-interactive-pressed":{light:"#FFFFFF26",dark:"#00000026"},"inverted-neutral-background":{light:"#0E1113",dark:"#FFFFFF"},"inverted-neutral-background-hover":{light:"#181C1F",dark:"#F6F8F9"},"inverted-neutral-border":{light:"#FFFFFF33",dark:"#00000033"},"inverted-neutral-content":{light:"#B7CAD4",dark:"#333D42"},"inverted-neutral-content-strong":{light:"#EEF1F3",dark:"#181C1F"},"inverted-secondary-background":{light:"#2A3236",dark:"#E5EBEE"},"inverted-secondary-background-hover":{light:"#333D42",dark:"#DBE4E9"},"inverted-secondary-background-selected":{light:"#3D494E",dark:"#C9D7DE"},"inverted-secondary-onBackground":{light:"#FFFFFF",dark:"#000000"},"inverted-secondary-plain":{light:"#DBE4E9",dark:"#181C1F"},"inverted-secondary-plain-hover":{light:"#FFFFFF",dark:"#000000"},"media-background":{light:"#00000099",dark:"#00000099"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"media-border-selected":{light:"#FFFFFF",dark:"#FFFFFF"},"media-border-weak":{light:"#FFFFFF19",dark:"#FFFFFF19"},"media-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"media-onBackground-disabled":{light:"#FFFFFF3F",dark:"#FFFFFF3F"},"media-onBackground-weak":{light:"#E5EBEE",dark:"#E5EBEE"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-onbackground-weak":{light:"#B7CAD4",dark:"#B7CAD4"},"neutral-background":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-container":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-container-hover":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong-hover":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-gilded":{light:"#FFF9E0",dark:"#181C1F"},"neutral-background-gilded-hover":{light:"#FFF3C0",dark:"#21272A"},"neutral-background-hover":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-pinned":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-selected":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-strong":{light:"#FFFFFF",dark:"#181C1F"},"neutral-background-strong-hover":{light:"#F6F8F9",dark:"#21272A"},"neutral-background-weak":{light:"#F6F8F9",dark:"#000000"},"neutral-background-weak-hover":{light:"#EEF1F3",dark:"#0E1113"},"neutral-border":{light:"#00000033",dark:"#FFFFFF33"},"neutral-border-medium":{light:"#0000007F",dark:"#FFFFFF7F"},"neutral-border-strong":{light:"#181C1F",dark:"#F6F8F9"},"neutral-border-weak":{light:"#00000019",dark:"#FFFFFF19"},"neutral-content":{light:"#333D42",dark:"#B7CAD4"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-strong":{light:"#181C1F",dark:"#EEF1F3"},"neutral-content-weak":{light:"#5C6C74",dark:"#8BA2AD"},offline:{light:"#767676",dark:"#767676"},online:{light:"#01A816",dark:"#01A816"},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},"opacity-highlight":{light:"",dark:""},pizzaRed:{light:"#ef5350",dark:"#c62828"},primary:{light:"#115BCA",dark:"#648EFC"},"primary-background":{light:"#0A449B",dark:"#115BCA"},"primary-background-hover":{light:"#0A2F6C",dark:"#1870F4"},"primary-background-selected":{light:"#0A1A3F",dark:"#648EFC"},"primary-border":{light:"#0A449B",dark:"#648EFC"},"primary-border-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-hover":{light:"#0A449B",dark:"#90A9FD"},"primary-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"primary-onBackground-selected":{light:"#FFFFFF",dark:"#000000"},"primary-plain":{light:"#0A449B",dark:"#648EFC"},"primary-plain-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-plain-visited":{light:"#7600A3",dark:"#CF5FFF"},"primary-visited":{light:"#9B00D4",dark:"#CF5FFF"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-background":{light:"#00000099",dark:"#00000099"},"scrim-background-strong":{light:"#000000CC",dark:"#000000CC"},"scrim-gradient":{light:"",dark:""},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},secondary:{light:"#21272A",dark:"#DBE4E9"},"secondary-background":{light:"#E5EBEE",dark:"#2A3236"},"secondary-background-hover":{light:"#DBE4E9",dark:"#333D42"},"secondary-background-selected":{light:"#C9D7DE",dark:"#3D494E"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-onBackground":{light:"#000000",dark:"#FFFFFF"},"secondary-plain":{light:"#181C1F",dark:"#DBE4E9"},"secondary-plain-hover":{light:"#000000",dark:"#FFFFFF"},"secondary-plain-weak":{light:"#5C6C74",dark:"#8BA2AD"},"secondary-weak":{light:"#576F76",dark:"#748791"},"success-background":{light:"#008A10",dark:"#016E0B"},"success-background-hover":{light:"#016E0B",dark:"#008A10"},"success-content":{light:"#016E0B",dark:"#01A816"},"success-hover":{light:"#005306",dark:"#00C61C"},"success-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"success-plain":{light:"#016E0B",dark:"#00C61C"},"success-plain-hover":{light:"#005306",dark:"#58E15B"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"transparent-background-hover":{light:"#74879119",dark:"#66778019"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#FFFFFF",dark:"#181C1F"},"upvote-background":{light:"#D93900",dark:"#D93900"},"upvote-background-disabled":{light:"#d939004d",dark:"#d939004d"},"upvote-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"upvote-content":{light:"#AE2C00",dark:"#FF4500"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#AE2C004c",dark:"#FF45004c"},"upvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"upvote-onStrongScrim":{light:"#FF895D",dark:"#FF895D"},"upvote-onStrongScrim-disabled":{light:"#ff895d4d",dark:"#ff895d4d"},"upvote-onStrongScrim-weaker":{light:"#FF4500",dark:"#FF4500"},"upvote-plain":{light:"#AE2C00",dark:"#FF895D"},"upvote-plain-disabled":{light:"#ae2c004d",dark:"#ff895d4d"},"upvote-plain-weaker":{light:"#FF4500",dark:"#FF4500"},"warning-background":{light:"#B78800",dark:"#B78800"},"warning-background-hover":{light:"#977000",dark:"#D8A100"},"warning-content":{light:"#785800",dark:"#B78800"},"warning-content-hover":{light:"#5B4200",dark:"#D8A100"},"warning-onBackground":{light:"#000000",dark:"#000000"}};var ay={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"},dy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),ly=r=>r in uc,cc=r=>r in ay,uy=r=>!!r.match(/^rgba?\(.*/),cy=r=>!!r.match(/^hsla?\(.*/),my=(r,e="light")=>{if(cc(r))return nd(r);let i=uc[r];return typeof i=="string"?i:i[e]},nd=r=>ay[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 sd}from"@devvit/protos";var mc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:sd.UNRECOGNIZED,alignment:void 0}};function hy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=gT(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||gy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||gy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function gy(r,e,t,i){return e===r&&i||t===r&&i}function gT(r,e,t){let i=e===sd.STACK_VERTICAL||e===sd.UNRECOGNIZED,n=e===sd.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,g=0;return n&&p?g=2:i&&p&&(g=1),{growDirection:o,stretchDirection:g}}import{BlockSizeUnit as yr,BlockStackDirection as od}from"@devvit/protos";function Si(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:yr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=yr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=yr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function hT(r,e){return(r.width?.value?.unit===yr.SIZE_UNIT_PERCENT||r.width?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_HORIZONTAL||e.direction===od.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===yr.SIZE_UNIT_PERCENT||r.height?.min?.unit===yr.SIZE_UNIT_PERCENT)&&(e.direction===od.STACK_VERTICAL||e.direction===od.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function pc(r,e){if(r){let t=r.width!=null||r.minWidth!=null||r.maxWidth!=null,i=r.height!=null||r.minHeight!=null||r.maxHeight!=null;if(t||i||r.grow!=null){let n={width:t?{value:Si(r.width),min:Si(r.minWidth),max:Si(r.maxWidth)}:void 0,height:i?{value:Si(r.height),min:Si(r.minHeight),max:Si(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=hT(n,e.stackParentLayout)),n}}}var by="data-",fT=new Set(["onPress","onMessage"]),vT=new Map([["onPress",Pc.ACTION_CLICK],["onMessage",Pc.ACTION_WEBVIEW]]),ms,Ci=class{constructor(e=()=>{}){l(this,ms);d(this,ms,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},mc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return us.PADDING_NONE;case"xsmall":return us.PADDING_XSMALL;case"small":return us.PADDING_SMALL;case"medium":return us.PADDING_MEDIUM;case"large":return us.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return cs.RADIUS_NONE;case"small":return cs.RADIUS_SMALL;case"medium":return cs.RADIUS_MEDIUM;case"large":return cs.RADIUS_LARGE;case"full":return cs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return dd.GAP_NONE;case"small":return dd.GAP_SMALL;case"medium":return dd.GAP_MEDIUM;case"large":return dd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Sc.ALIGN_TOP:e.includes("middle")?t=Sc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Sc.ALIGN_BOTTOM),e.includes("start")?i=hc.ALIGN_START:e.includes("center")?i=hc.ALIGN_CENTER:e.includes("end")&&(i=hc.ALIGN_END),t!==void 0||i!==void 0)return{vertical:t,horizontal:i}}makeBlockBorder(e,t,i,n){if(!e&&!t)return;let o;switch(e){case"none":o=ad.BORDER_WIDTH_NONE;break;case"thin":o=ad.BORDER_WIDTH_THIN;break;case"thick":o=ad.BORDER_WIDTH_THICK;break;default:o=ad.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",c=this.getThemedColors(a,i,n);return{width:o,color:c?.light,colors:c}}makeBlockTextSize(e){switch(e){case"xsmall":return Pi.TEXT_SIZE_XSMALL;case"small":return Pi.TEXT_SIZE_SMALL;case"medium":return Pi.TEXT_SIZE_MEDIUM;case"large":return Pi.TEXT_SIZE_LARGE;case"xlarge":return Pi.TEXT_SIZE_XLARGE;case"xxlarge":return Pi.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return kc.TEXT_STYLE_BODY;case"metadata":return kc.TEXT_STYLE_METADATA;case"heading":return kc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return yc.TEXT_OUTLINE_NONE;case"thin":return yc.TEXT_OUTLINE_THIN;case"thick":return yc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return yy.TEXT_WEIGHT_REGULAR;case"bold":return yy.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return bc.TEXT_OVERFLOW_CLIP;case"ellipsis":return bc.TEXT_OVERFLOW_ELLIPSE}return bc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Bt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Bt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Bt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Bt.BUTTON_APPEARANCE_BORDERED;case"media":return Bt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Bt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Bt.BUTTON_APPEARANCE_CAUTION;case"success":return Bt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return gc.BUTTON_SIZE_SMALL;case"medium":return gc.BUTTON_SIZE_MEDIUM;case"large":return gc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ls.IMAGE_RESIZE_NONE;case"fit":return ls.IMAGE_RESIZE_FIT;case"fill":return ls.IMAGE_RESIZE_FILL;case"cover":return ls.IMAGE_RESIZE_COVER;case"scale-down":return ls.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return ud.SPACER_XSMALL;case"small":return ud.SPACER_SMALL;case"medium":return ud.SPACER_MEDIUM;case"large":return ud.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return fc.SPACER_INVISIBLE;case"thin":return fc.SPACER_THIN;case"square":return fc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return ld.ICON_SIZE_XSMALL;case"small":return ld.ICON_SIZE_SMALL;case"medium":return ld.ICON_SIZE_MEDIUM;case"large":return ld.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Ot.AVATAR_SIZE_XXSMALL;case"xsmall":return Ot.AVATAR_SIZE_XSMALL;case"small":return Ot.AVATAR_SIZE_SMALL;case"medium":return Ot.AVATAR_SIZE_MEDIUM;case"large":return Ot.AVATAR_SIZE_LARGE;case"xlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Ot.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return vy.AVATAR_FACING_LEFT;case"right":return vy.AVATAR_FACING_RIGHT}}makeBlockAvatarBackground(e){switch(e){case"dark":return fy.AVATAR_BG_DARK;case"light":return fy.AVATAR_BG_LIGHT}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(by)).reduce((t,i)=>(t[i.substring(by.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return fT.forEach(o=>{if(o in t){let a=t[o];i.push({type:vT.get(o)??Pc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),dy(e)?e:ly(e)?my(e,t):cc(e)?nd(e):uy(e)?py(e):cy(e)?e:(console.warn(`Could not parse color: ${e}.`),nd("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,ms).call(this)?.getURL(e,t)??e}childrenToString(e){return e.map(t=>t.toString()).join("")}makeRoot(e,...t){return this.wrapRoot(e,this.childrenToBlocks(t,mc))}wrapRoot(e,t){return this.makeBlock(tt.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=pc(t,i),p=hy(t,i.stackParentLayout,c);return this.makeBlock(tt.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(vc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(vc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(vc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(tt.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(tt.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(tt.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(tt.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(tt.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(tt.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeWebView(e,t){return e&&this.makeBlock(tt.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:pc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===tt.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};ms=new WeakMap;function Sy(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Py=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+=Py(i);return e+=`</${r.type}>`,e};function yT(r){return" ".repeat(r)}function bT(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+=yT(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 Le,Cy,ps,wc,gs,pt=class{constructor(e,t,i,n,o){l(this,Le);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new Ci(()=>this.assets);this.effects=[];l(this,gs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=De({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,Le,ps).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(Sy(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,Le,Cy).call(this)}async buildBlocksUI(){let e=S(this,Le,ps).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 Sy(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(bT(Py(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=oy(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let b=n.children[m];b!=null&&c.push(await this.processBlock(b,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),g=S(this,Le,wc).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:g}}if(typeof n.type=="function"){let c=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(c),this.renderState[c]||(this.renderState[c]={});let p=n.children.flatMap(m=>m),g={...S(this,Le,ps).call(this),...n.props,children:p},f;for(;f===void 0;)try{f=await n.type(g,S(this,Le,ps).call(this))}catch(m){if(m instanceof Promise)f=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof f=="object")return this.processBlock(f,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===Cc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Cc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Cc.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,gs)||(d(this,gs,!0),this.effects.push({type:ky.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:ky.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...ki(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};Le=new WeakSet,Cy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},ps=function(){let e={...ce(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},wc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,Le,wc).call(this,i.children)):t.push(i);return t},gs=new WeakMap;async function PT(r,e){let t=u.customPostType;if(!t)throw new Error("Custom post type not registered");let i=new pt((o,a)=>t.render(a),r.blocks,r.state,e,r.dimensions),n=await i.render();return ST.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function wy(r){r.provides(kT),M("RenderPost",PT)}import{GetFieldsResponse as CT,InstallationSettingsDefinition as wT}from"@devvit/protos";async function xT(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return CT.fromJSON({fields:{fields:mt(u.installationSettings)}})}async function IT(r,e){return id(r,u.installationSettings,e)}function xy(r){r.provides(wT),M("GetSettingsFields",xT),M("ValidateForm",IT)}import{ContextActionDefinition as FT,ContextActionList as TT,ContextActionResponse as AT}from"@devvit/protos";var Iy=r=>`menuItem.${r}`;function xc(r){return u.menuItems.find((e,t)=>Iy(t)===r)}async function ET(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:Iy(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"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}));return TT.fromJSON({actions:i})}async function RT(r,e){let t=xc(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;y(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(De({ui:!0,metadata:e}),ce(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),AT.fromJSON({effects:ki(p.ui)})}function Fy(r){r.provides(FT),M("GetActions",ET),M("OnAction",RT)}function gt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as OT}from"@devvit/protos";async function BT(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(De({metadata:e}),ce(e));await i(n,o)}function Ty(r){r.provides(OT),M("HandleScheduledAction",BT)}import{OnAppInstallDefinition as MT,OnAppUpgradeDefinition as UT,OnAutomoderatorFilterCommentDefinition as DT,OnAutomoderatorFilterPostDefinition as LT,OnCommentCreateDefinition as NT,OnCommentDeleteDefinition as _T,OnCommentReportDefinition as HT,OnCommentSubmitDefinition as qT,OnCommentUpdateDefinition as jT,OnModActionDefinition as WT,OnModMailDefinition as GT,OnPostCreateDefinition as VT,OnPostDeleteDefinition as zT,OnPostFlairUpdateDefinition as JT,OnPostNsfwUpdateDefinition as $T,OnPostReportDefinition as KT,OnPostSpoilerUpdateDefinition as XT,OnPostSubmitDefinition as ZT,OnPostUpdateDefinition as QT}from"@devvit/protos";var wi;(function(r){function e(a,c){return a.length<=c?a:`${a.slice(0,c-1)}\u2026`}r.ellipsize=e;function t(a){return a[0]==null?a:`${a[0].toLocaleUpperCase()}${a.slice(1)}`}r.capitalize=t;function i(a){return a==null||/^\s*$/.test(a)}r.isBlank=i;function n(a,c="stack"){return a instanceof Error?`${a[c]||a.stack||a.message||a.name}`:String(a)}r.caughtToString=n;function o(a,c="stack"){return a instanceof Error?`${a[c]||a.stack||a.message||a.name}`:String(a)}r.caughtToStringUntyped=o})(wi||(wi={}));function X(r,e){return y(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(De({metadata:i}),ce(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=YT(a);if(c)throw c.err;return{}}}function Ay(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(ZT),M("OnPostSubmit",X("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(VT),M("OnPostCreate",X("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(QT),M("OnPostUpdate",X("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(KT),M("OnPostReport",X("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(zT),M("OnPostDelete",X("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(JT),M("OnPostFlairUpdate",X("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(qT),M("OnCommentSubmit",X("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(NT),M("OnCommentCreate",X("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(jT),M("OnCommentUpdate",X("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(HT),M("OnCommentReport",X("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(_T),M("OnCommentDelete",X("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(MT),M("OnAppInstall",X("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(UT),M("OnAppUpgrade",X("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(WT),M("OnModAction",X("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(GT),M("OnModMail",X("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides($T),M("OnPostNsfwUpdate",X("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(XT),M("OnPostSpoilerUpdate",X("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterPost":r.provides(LT),M("OnAutomoderatorFilterPost",X("AutomoderatorFilterPost",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterComment":r.provides(DT),M("OnAutomoderatorFilterComment",X("AutomoderatorFilterComment",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function YT(r){let e=r.reduce((t,i)=>i.status==="rejected"?[...t,i.reason]:t,[]);if(e.length!==0)return e.length===1?{err:e[0]}:{err:new Error(e.map(t=>wi.caughtToString(t)).join(`
|
3
3
|
`))}}import{EffectType as QE,HandleUIEventResponse as Hc,UIEventHandlerDefinition as YE}from"@devvit/protos";var Pb=Dn(qy(),1),Cb=Dn(_c(),1);async function eR(r,e){let t=r.state??{},i=(0,Pb.default)(t),n=De({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 v=new pt((P,C)=>u.customPostType?.render(C)??null,r.event,r.state,e,void 0);return await v.reconcile(),Hc.fromJSON({state:v.state,effects:v.getEffects()})}let g=u.formDefinitions.get(p);if(!g)throw new Error(`Form with key ${p} not found`);let f,m;if(i.__contextAction){let{actionId:v,thingId:P}=i.__contextAction,C=xc(v);C?.location==="post"?f=P:C?.location==="comment"&&(m=P)}let b=Object.assign(n,ce(e,f,m),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});await g.onSubmit({values:Tt(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new pt((g,f)=>u.customPostType?.render(f)??null,r.event,r.state,e,void 0);return await p.reconcile(),Hc.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Cb.default)(t,i),a=ki(n.ui),c=o?[...a,{type:QE.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return Hc.fromJSON({state:i,effects:c})}function wb(r){r.provides(YE),M("HandleUIEvent",eR)}import{CustomPostDefinition as Rd,UIResponse as Qb}from"@devvit/protos";import{UIEventScope as dR}from"@devvit/protos";var qc="ServerCallRequired";function Pd(r){return r?.message===qc}var Vc={now(){return new Date}};function xb(r){return`__autocache__${r}`}function Ib(r){return`__lock__${r}`}var tR=300,rR=1e3,Cd=5e3,jc=3,Fb=.1,Tb=1e3,iR=3e4;function Ab(r){if(r.error)throw new Error(r.error);return r.value}var Dt,Lt,Ne,Ti,K,Eb,Rb,Ob,Wc,Bb,Mb,Gc,Ub,wd=class{constructor(e,t,i=Vc){l(this,K);l(this,Dt);l(this,Lt,{});l(this,Ne);l(this,Ti);d(this,Dt,e),d(this,Ti,t),d(this,Ne,i)}async cache(e,t){var a;(a=s(this,Ti)).__cache??(a.__cache={}),d(this,Lt,s(this,Ti).__cache),S(this,K,Ub).call(this,t);let i=S(this,K,Eb).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,Gc).call(this,t.key),o=await S(this,K,Rb).call(this,t,n,e);return Ab(o)}};Dt=new WeakMap,Lt=new WeakMap,Ne=new WeakMap,Ti=new WeakMap,K=new WeakSet,Eb=function(e){let t=s(this,Lt)[e];if(t){let i=s(this,Ne).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<jc&&Math.random()<Fb&&t.errorTime+Tb<i;if(t?.expires&&t.expires<i&&t.checkedAt+Tb<i||n){delete s(this,Lt)[e];return}else return Ab(t)}},Rb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,Mb).call(this,n):1;return!t||t?.error&&t.errorCount<jc&&Fb>Math.random()||o>Math.random()?S(this,K,Ob).call(this,e,t,i):t},Ob=async function(e,t,i){let n=Ib(e.key),o=s(this,Ne).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Dt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Bb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Ne).now();return S(this,K,Wc).call(this,p,e.key,e.ttl)}},Wc=async function(e,t,i){let n=Math.min(i,rR),o=await S(this,K,Gc).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,tR)),S(this,K,Wc).call(this,e,t,i)},Bb=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,Lt)[e]=t,await s(this,Dt).set(xb(e),JSON.stringify(t),{expiration:new Date(o+iR)}),t.error&&t.errorCount<jc&&await s(this,Dt).del(Ib(e)),t},Mb=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},Gc=async function(e){let t=await s(this,Dt).get(xb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Ne).now().getTime(),s(this,Lt)[e]=i,i}},Ub=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 Db(r,e,t=Vc){let i=new wd(r,e,t);return i.cache.bind(i)}import{EffectType as $c,ToastAppearance as _b}from"@devvit/protos";function Lb(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var zc=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Tt(n.formSubmitted.results))}}};function Jc(r,e){let t=Je({namespace:"useForm",initializer:i=>new zc(i,r,e)});return nR({id:t.hookId})}function nR(r){return`form.hook.${r.id}.0`}function Nb(r,e){let t=Lb(e);return r.getHook({id:t})}var Nt,xd=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={fields:[],id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description};gr(n.fields),o.fields=mt(n.fields),s(this,Nt).emitEffect(e,{type:$c.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?_b.SUCCESS:_b.NEUTRAL}:t={text:e},s(this,Nt).emitEffect(e.toString(),{type:$c.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Nt).emitEffect(t,{type:$c.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Nt=new WeakMap;import{EffectType as sR,RealtimeSubscriptionStatus as Hb}from"@devvit/protos";var _t,it,Ht,Cr,ks,Xc,Id=class Id{constructor(e,t){l(this,ks);l(this,_t);l(this,it);l(this,Ht);l(this,Cr);d(this,_t,t.context),d(this,it,!!t.context._devvitContext?.debug.realtime),d(this,Cr,e),d(this,Ht,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 Id).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 Hb.REALTIME_SUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Ht).call(this),await s(this,Cr).onSubscribed?.();break;case Hb.REALTIME_UNSUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Ht).call(this),await s(this,Cr).onUnsubscribed?.();break;default:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Cr).onMessage(t.event?.data?.msg);break}}async send(e){if(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" send message: ${JSON.stringify(e,void 0,2)}`),!this.state.subscribed||!this.state.connected)throw console.debug(`[realtime] "${this.state.channel}" send failed; channel not connected`),Error(`useChannel send failed; "${this.state.channel}" channel not connected`);await s(this,_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,it)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,Ht).call(this),S(this,ks,Xc).call(this))}unsubscribe(){this.state.subscribed&&(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Ht).call(this),S(this,ks,Xc).call(this))}};_t=new WeakMap,it=new WeakMap,Ht=new WeakMap,Cr=new WeakMap,ks=new WeakSet,Xc=function(){let e=Object.values(s(this,_t)._hooks).filter(t=>t instanceof Id&&t.state.subscribed).map(t=>t.state.channel);s(this,_t).emitEffect(this.state.channel,{type:sR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var Kc=Id;function Zc(r){if(!r.name||/[^a-zA-Z0-9_]/.test(r.name))throw Error(`useChannel error: The name "${r.name}" you provided for the hook is invalid. Valid names can only contain letters, numbers, and underscores (_).`);let e=`useChannel:${r.name}`;return Je({id:e,namespace:e,initializer:t=>new Kc(r,t)})}import{EffectType as Qc}from"@devvit/protos";function qb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var wr,qt,Ai=class Ai{constructor(e,t){l(this,wr);this._segments=[];l(this,qt,{});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,qt)).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,qt)}set _hooks(e){this._prevHooks=s(this,qt),d(this,qt,e)}get _state(){return s(this,wr)}set _state(e){d(this,wr,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ai.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,qt)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ai._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ai._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}addToRequeueEvents(...e){this._devvitContext?.debug.blocks&&console.debug("[blocks] requeueing events",e);let t=e.reduce((i,n)=>(n.retry?i.retry.push(n):i.normal.push(n),i),{retry:[],normal:[]});this._requeueEvents=[...t.retry,...this._requeueEvents,...t.normal]}get effects(){return Object.values(this._effects)}nextHookId(e){e.key===void 0&&(e.key=this._segments[this._segments.length-1].next+++""),this.push(e);try{let t=[];for(let n=this._segments.length-1;n>=0;n--){let o=this._segments[n];if(o.id){t.unshift(o.id);break}let a=[];o.namespace&&a.push(o.namespace),o.key!==void 0&&o.key!==!1&&a.push(o.key),t.unshift(a.join("-"))}let i=t.join(".");if(this._generated[i]&&!e.shared)throw new Error(`Hook id ${i} already used, cannot register another hook with the same id`);return this._generated[i]=!0,this._prevHookId=i,i}finally{this.pop()}}};wr=new WeakMap,qt=new WeakMap,Ai._staticUndeliveredHandlers={};var Ei=Ai;var jt={};Ei.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete jt[r.hook],e.emitEffect("timers",{type:Qc.EFFECT_SET_INTERVALS,interval:{intervals:jt}}))});var Wt,Ri,Ss,Oi,Yc=class{constructor(e,t,i){l(this,Wt);l(this,Ri);l(this,Ss);l(this,Oi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Ri,i.invalidate),d(this,Wt,i.hookId),d(this,Ss,e),d(this,Oi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?jt[s(this,Wt)]={duration:this.state.duration}:delete jt[s(this,Wt)]}async onUIEvent(e){await s(this,Ss).call(this)}start(){jt[s(this,Wt)]={duration:this.state.duration},this.state.running=!0,s(this,Ri).call(this),s(this,Oi).emitEffect("timers",{type:Qc.EFFECT_SET_INTERVALS,interval:{intervals:jt}})}stop(){delete jt[s(this,Wt)],this.state.running=!1,s(this,Ri).call(this),s(this,Oi).emitEffect("timers",{type:Qc.EFFECT_SET_INTERVALS,interval:{intervals:jt}})}};Wt=new WeakMap,Ri=new WeakMap,Ss=new WeakMap,Oi=new WeakMap;function em(r,e){let t=Je({namespace:"useInterval",initializer:i=>new Yc(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}import{UIEventScope as aR}from"@devvit/protos";var xr=class extends Error{};import{UIEventScope as jb}from"@devvit/protos";var Wb=Dn(_c(),1);function rm(r){if(r instanceof Error){if(r.message===qc)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:wi.caughtToString(r)}}var $e,nt,Bi,Ps,tm=class{constructor(e,t,i){l(this,$e);l(this,nt);l(this,Bi);l(this,Ps);d(this,$e,!!i.context.devvitContext.debug.useAsync),s(this,$e)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,nt,i.hookId),this.initializer=e,d(this,Bi,i.invalidate),d(this,Ps,i.context),this.localDepends=t.depends??null}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,$e)&&console.debug("[useAsync] async onLoad ",s(this,nt),this.state),s(this,$e)&&console.debug("[useAsync] async onLoad have ",this.localDepends,"and",this.state.depends),!(0,Wb.default)(this.localDepends,this.state.depends)||this.state.load_state==="initial")){s(this,$e)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,nt)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Bi).call(this);let e={scope:jb.ALL,hook:s(this,nt),async:!0,asyncRequest:{requestId:s(this,nt)+"-"+JSON.stringify(this.state.depends)}};s(this,$e)&&console.debug("[useAsync] onLoad requeue"),s(this,Ps).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await this.initializer()}}catch(o){i.error=rm(o)}let n={scope:jb.ALL,asyncResponse:i,hook:s(this,nt)};s(this,$e)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,nt)+"-"+JSON.stringify(this.state.depends);e.asyncResponse.requestId===i?(this.state={...this.state,data:e.asyncResponse.data?.value,error:e.asyncResponse.error??null,load_state:e.asyncResponse.error?"error":"loaded"},s(this,Bi).call(this)):s(this,$e)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};$e=new WeakMap,nt=new WeakMap,Bi=new WeakMap,Ps=new WeakMap;function oR(r,e={}){let t=Je({namespace:"useAsync",initializer:i=>new tm(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var vt,Mi,Ir,Fr,im=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,vt);l(this,Mi);l(this,Ir);l(this,Fr);d(this,Ir,e),d(this,Fr,t.hookId),d(this,vt,t.invalidate),d(this,Mi,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&this._promise){try{this.state.value=await this._promise,this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=rm(e)}s(this,vt).call(this)}else console.warn("Invalid state: ",this.state.load_state,this._promise)}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,vt).call(this)}onStateLoaded(){if(this._promise=s(this,Mi)._prevHooks[s(this,Fr)]?._promise,this.state.load_state==="loading")throw new xr;if(this.state.load_state==="error")throw new Error(this.state.error?.message??"Unknown error");if(this.state.load_state==="initial"){let e;try{e=s(this,Ir)instanceof Function?s(this,Ir).call(this):s(this,Ir)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,vt).call(this);return}if(e instanceof Promise){this._promise=e,this.state.load_state="loading";let t={scope:aR.ALL,asyncRequest:{requestId:s(this,Fr)},hook:s(this,Fr)};throw s(this,Mi).addToRequeueEvents(t),s(this,vt).call(this),new xr}else this.state.value=e,this.state.load_state="loaded";s(this,vt).call(this)}}};vt=new WeakMap,Mi=new WeakMap,Ir=new WeakMap,Fr=new WeakMap;function nm(r){let e=Je({namespace:"useState",initializer:t=>new im(r,t)});return[e.state.value,e.setter.bind(e)]}var Fd=class{buildContext(e,t,i){let n=new mi(i),o=new ui(i),a=new fi(i),c=new gi(i),p=new vi(i),g=new yi(i),f=new xd(e),m=new ci(i),b=new di,v=new pi(i),P=Db(a,e._state),C={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:b,realtime:v,ui:f,useState:nm,useChannel:Zc,useInterval:em,useForm:Jc,cache:P,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[D.Timezone]?.values[0],locale:i[D.Language]?.values[0],dimensions:t.env?.dimensions}},F=ce(i,t.props?.postId);return F.debug.effects=e,{...F,...C}}};var Se=null;function Gb(r){return JSON.parse(JSON.stringify(r))}function lR(r){if(!(r!==""&&!/[-.]/.test(r)))throw new Error(`Hook with namespace '${r}' is invalid. Hook namespaces cannot be empty string or contain dashes/dots because they are used as delimiters internally. Please update the hook namespace and try again.`)}function Je({initializer:r,...e}){if(!Se)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.");lR(e.namespace);let t=Se.nextHookId(e),i=Se,n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:Se},o=Se._state[t]===void 0||qb(Se._state[t]);Se._hooks[t]=Se._hooks[t]??r(n);let a=Se._hooks[t];return o||(a.state=Se._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var uR=null,Ui,Ed,Cs,T,me,Td,Vb,sm,zb,om,am,Ad,dm,Jb,Tr=class{constructor(e){l(this,T);l(this,Ui);l(this,Ed,new Fd);l(this,Cs,new Ci(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,T,me)&&console.debug("[blocks] BlocksHandler v1"),d(this,Ui,e),uR=this}async handle(e,t){let i=new Ei(e,t),n=s(this,Ed).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(v=>!v.async),g=a.some(v=>v.blocking),f,m,b=[...a];for(a.length===0&&a.push({scope:dR.ALL}),s(this,T,me)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,T,me)&&console.debug("[blocks] processing events loop iteration",a.length);let v=[];if(!a[0].async)v.push(a.shift());else for(;a[0]?.async;)v.push(a.shift());if(!v.length)throw Error("batch must have at least one event");try{if(v[0].async){let C=Gb(i._state);await S(this,T,Vb).call(this,i,...v),i._state=C}else await S(this,T,zb).call(this,i,...v)}catch(C){if(!Pd(C))throw C;if(s(this,T,me)&&console.debug("[blocks] caught in handler",C),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=f,i._effects=m._effects;let F=b.map(I=>{let ge={...I};return ge.retry=!0,ge});i.addToRequeueEvents(...F);break}else throw Pd(C)||console.error("[blocks] unhandled error in handler",C),C}s(this,T,me)&&console.debug("[blocks] remaining events",i._requeueEvents);let P=[];for(let C of i._requeueEvents){if(!p&&!C.async){s(this,T,me)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",C),P.push(C);continue}if(p&&C.async&&!g){s(this,T,me)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",C),P.push(C);continue}s(this,T,me)&&console.debug("[blocks] reprocessing event in BlocksHandler",C),a.push(C)}i._requeueEvents=P,a.length>0&&(f={...i._changed},m={_state:Gb(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,T,om).call(this,s(this,Ui),i.request.props??{},i));let v=i._latestRenderContent;v&&(o=s(this,Cs).createBlocksElementOrThrow(v),o=s(this,Cs).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Ui=new WeakMap,Ed=new WeakMap,Cs=new WeakMap,T=new WeakSet,me=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Td=function(e,...t){e._hooks={},S(this,T,om).call(this,s(this,Ui),e.request.props??{},e)},Vb=async function(e,...t){S(this,T,Td).call(this,e,...t),await Promise.all(t.map(async i=>{if(!i.async)throw new Error("You can't mix main and other queues in one batch. This is likely a platform bug. Please file an issue in the Discord for someone to help! https://discord.com/channels/1050224141732687912/1115441897079574620");await S(this,T,sm).call(this,e,i)}))},sm=async function(e,t){let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw Pd(n)?s(this,T,me)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},zb=async function(e,...t){for(let i of t)s(this,T,me)&&console.log("[blocks] handling main queue event",i),s(this,T,me)&&console.log("[blocks] before",e._state),S(this,T,Td).call(this,e,i),await S(this,T,sm).call(this,e,i),s(this,T,me)&&console.log("[blocks] after",e._state);S(this,T,Td).call(this,e)},om=function(e,t,i){s(this,T,me)&&console.debug("[blocks] renderRoot"),i._generated={},Se=i,this._latestRenderContext=i;try{let n=S(this,T,am).call(this,e,t,i);if(n.length!==1)throw new Error(`There can only be one root element, received: ${n.length}. Please wrap these elements in a <vstack></vstack> or <hstack></hstack> to continue. Fragments cannot be used as a root element.`);let o=n[0];if(o==="[object Promise]")throw new Error('Root elements cannot be async. To use data from an async endpoint, please use "const [data] = useState(async () => {/** your async code */})".');if(typeof o=="string")throw new Error("The root element must return a valid block, not a string. Try wrapping the element in a <text>your content</text> tag to continue.");return i._latestRenderContent=o,o}catch(n){if(n instanceof xr)return;throw n}finally{Se=null}},am=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);if(n instanceof Promise)throw new Error(`Components (found: ${e.name??"unknown component"}) cannot be async. To use data from an async endpoint, please use "const [data] = useState(async () => {/** your async code */})".`);return S(this,T,dm).call(this,n,i)}finally{i.pop()}},Ad=function(e,t){return e=e.flat(1/0),e.flatMap((i,n)=>(i&&typeof i=="object"&&"props"in i&&(i.props?.key||(i.props=i.props??{},i.props.key=`${n}`)),S(this,T,dm).call(this,i,t)))},dm=function(e,t){if(Array.isArray(e))return S(this,T,Ad).call(this,e,t);if(cR(e))if(e.type===void 0)try{return t.push({namespace:"fragment",...e.props}),S(this,T,Ad).call(this,e.children,t)}finally{t.pop()}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,T,am).call(this,e.type,i,t)}else try{t.push({namespace:e.type,...e.props});let i=S(this,T,Ad).call(this,e.children,t),n=S(this,T,Jb).call(this,e.props??{});return[{type:e.type,children:i,props:n}]}finally{t.pop()}else return[(e??"").toString()]},Jb=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Je({namespace:i,key:!1,initializer:({hookId:o})=>({hookId:o,state:null,onUIEvent:a=>e[i](a.userAction?.data)})});t[i]=n.hookId,"captureHookRef"in e[i]&&e[i].captureHookRef()}else{let n=JSON.parse(JSON.stringify(e[i]));n!=null&&(t[i]=n)}return t};function cR(r){return typeof r=="object"&&r!=null&&"type"in r}var $b=r=>{let e=Number(r.trim().split(".").pop());return isNaN(e)?void 0:e},Kb=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=$b(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=$b(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)},Xb=r=>r?r.platform==="Android"?r.versionNumber<1875012:r.platform==="iOS"?r.versionNumber<614973:!1:(console.warn(`Could not parse devvit-user-agent! Received: '${JSON.stringify(r)}'`),!1),mR=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}`)}},pR=({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=mR(r);t?e.ui.navigateTo(t):console.warn("No upgrade link found for platform:",r)}},"Upgrade"))))),Zb=r=>()=>u.createElement(pR,{platform:r});var gR=()=>u.createElement("vstack",{alignment:"center middle",width:"100%",height:"100%"},u.createElement("text",null,"This feature is not available yet")),hR=[[Rd,Rd.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null],[Rd,Rd.methods.renderPostComposer,(r,e)=>u.createElement(gR,null)]];function fR(r){return async(e,t)=>{let i=Kb(t["devvit-user-agent"]?.values?.[0]??"");if(i&&Xb(i)){let o=new Tr(Zb(i.platform));return Qb.fromJSON(await o.handle(e,t))}let n=new Tr(r);return Qb.fromJSON(await n.handle(e,t))}}function Yb(r){for(let[e,t,i]of hR)r.provides(e),M(t.name,fR(i))}var Di,ws,Li,Ar,Er,Ni,_i,Rr,Gt,xs,Is,Or,G,_=class _ extends Xa{static configure(e){d(this,Li,{...s(this,Li),...e}),gt(e.http)&&this.use(w.HTTPDefinition),(gt(e.kvStore)||gt(e.redis))&&(this.use(w.KVStoreDefinition),this.use(w.RedisAPIDefinition)),gt(e.media)&&this.use(w.MediaServiceDefinition),gt(e.modLog)&&this.use(w.ModlogDefinition),gt(e.redditAPI)&&(this.use(w.FlairDefinition),this.use(w.GraphQLDefinition),this.use(w.LinksAndCommentsDefinition),this.use(w.ListingsDefinition),this.use(w.ModerationDefinition),this.use(w.ModNoteDefinition),this.use(w.NewModmailDefinition),this.use(w.PrivateMessagesDefinition),this.use(w.SubredditsDefinition),this.use(w.UsersDefinition),this.use(w.WidgetsDefinition),this.use(w.WikiDefinition)),gt(e.realtime)&&this.use(w.RealtimeDefinition)}static addMenuItem(e){s(this,_i).push(e)}static addCustomPostType(e){d(this,Ar,e)}static createForm(e,t){let i=`form.${s(this,Er).size}`;return s(this,Er).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,G)[w.SchedulerDefinition.fullName]||this.use(w.SchedulerDefinition),s(this,Rr).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,Rr).set(e.name,e.onRun)}static addSettings(e){gr(e);let t=e.filter(n=>n.type==="group"||!n.scope||n.scope==="installation"),i=e.filter(n=>n.type!=="group"&&n.scope==="app");t.length>0&&d(this,Ni,t),i.length>0&&d(this,Di,i),s(this,G)[w.SettingsDefinition.fullName]||this.use(w.SettingsDefinition)}static addTrigger(e){if("events"in e){for(let t of e.events)this.addTrigger({event:t,onEvent:(i,n)=>e.onEvent(i,n)});return this}return s(this,Gt).has(e.event)?s(this,Gt).get(e.event)?.push(e.onEvent):s(this,Gt).set(e.event,[e.onEvent]),_}static provide(e){s(this,Is).push(e)}static use(e,t){s(this,Or)[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,Or)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,G)[e.fullName]=i,i}static get redditAPIPlugins(){if(!gt(s(this,Li).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,G)[w.FlairDefinition.fullName],GraphQL:s(this,G)[w.GraphQLDefinition.fullName],LinksAndComments:s(this,G)[w.LinksAndCommentsDefinition.fullName],Listings:s(this,G)[w.ListingsDefinition.fullName],Moderation:s(this,G)[w.ModerationDefinition.fullName],ModNote:s(this,G)[w.ModNoteDefinition.fullName],NewModmail:s(this,G)[w.NewModmailDefinition.fullName],PrivateMessages:s(this,G)[w.PrivateMessagesDefinition.fullName],Subreddits:s(this,G)[w.SubredditsDefinition.fullName],Users:s(this,G)[w.UsersDefinition.fullName],Widgets:s(this,G)[w.WidgetsDefinition.fullName],Wiki:s(this,G)[w.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,G)[w.ModlogDefinition.fullName];if(!e)throw new Error("ModLog is not enabled. You can enable it by passing `modLog: true` to `Devvit.configure`");return e}static get schedulerPlugin(){let e=s(this,G)[w.SchedulerDefinition.fullName];if(!e)throw new Error("Scheduler is not enabled. You can enable it by calling `Devvit.addSchedulerJob` at the top level of your app.");return e}static get kvStorePlugin(){let e=s(this,G)[w.KVStoreDefinition.fullName];if(!e)throw new Error("Key Value Store is not enabled. You can enable it by passing `kvStore: true` to `Devvit.configure`");return e}static get redisPlugin(){let e=s(this,G)[w.RedisAPIDefinition.fullName];if(!e)throw new Error("Redis is not enabled. You can enable it by passing `redis: true` to `Devvit.configure`");return e}static get mediaPlugin(){let e=s(this,G)[w.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,G)[w.SettingsDefinition.fullName];if(!e)throw new Error("Settings must first be configured with `Devvit.addSettings()` before they can be accessed");return e}static get realtimePlugin(){let e=s(this,G)[w.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,_i)}static get customPostType(){return s(this,Ar)}static get formDefinitions(){return s(this,Er)}static get scheduledJobHandlers(){return s(this,Rr)}static get installationSettings(){return s(this,Ni)}static get appSettings(){return s(this,Di)}static get triggerOnEventHandlers(){return s(this,Gt)}static get assets(){return s(this,ws)}static get webviewAssets(){return s(this,xs)}constructor(e){super(e),d(_,ws,e.assets??{}),d(_,xs,e.webviewAssets??{});for(let t in s(_,Or)){let i=s(_,Or)[t];i.handler=e.use(i.def,i.options)}s(_,_i).length>0&&Fy(e),s(_,Rr).size>0&&Ty(e),s(_,Ar)&&(wy(e),Yb(e)),(s(_,Ar)||s(_,Er).size>0)&&wb(e),s(_,Ni)&&xy(e),s(_,Di)&&sy(e),s(_,Gt).size>0&&Ay(e);for(let t of s(_,Is))e.provides(t)}};Di=new WeakMap,ws=new WeakMap,Li=new WeakMap,Ar=new WeakMap,Er=new WeakMap,Ni=new WeakMap,_i=new WeakMap,Rr=new WeakMap,Gt=new WeakMap,xs=new WeakMap,Is=new WeakMap,Or=new WeakMap,G=new WeakMap,_.debug={},l(_,Di),l(_,ws,{}),l(_,Li,{}),l(_,Ar),l(_,Er,new Map),l(_,Ni),l(_,_i,[]),l(_,Rr,new Map),l(_,Gt,new Map),l(_,xs,{}),l(_,Is,[]),l(_,Or,{}),l(_,G,{});var u=_;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function Y(r){let e=Object.getOwnPropertyDescriptors(r.constructor.prototype);for(let[t,i]of Object.entries(e))i.get&&Object.defineProperty(r,t,{...i,enumerable:!0})}var lm;(function(r){r[r.bold=1]="bold",r[r.italic=2]="italic",r[r.underline=4]="underline",r[r.strikethrough=8]="strikethrough",r[r.subscript=16]="subscript",r[r.superscript=32]="superscript",r[r.monospace=64]="monospace"})(lm||(lm={}));var ek="text",tk="raw",rk="br",ik="link",nk="c/",sk="p/",ok="r/",ak="u/",dk="@",lk="spoilertext",uk="par",ck="h",mk="hr",pk="blockquote",gk="code",hk="li",fk="list",vk="L",yk="R",bk="C",kk="table",Sk="embed",Pk="img",Ck="gif",wk="video";function xk(r){return{e:Ck,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Ik(r,e){let t={},i=[];return Object.assign(t,Fs(t,i),Ts(t,i),As(t,i),Os(t,i),Bs(t,i),Ms(t,i)),e(t),{e:pk,c:i,...r.author&&{a:r.author}}}function Fk(r,e){let t={},i=[];return Object.assign(t,cm(t,i)),e(t),{e:gk,c:i,...r.language&&{l:r.language}}}function Tk(r){return{e:nk,t:r.permalink}}function Ak(r,e){let t={},i=[];return Object.assign(t,cm(t,i),Rs(t,i)),e(t),{e:ck,l:r.level,c:i}}function Ek(r){return{e:Sk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Rk(){return{e:mk}}function Ok(r){return{e:Pk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Bk(){return{e:rk}}function Mk(r){return{e:ik,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function Uk(r,e){let t={},i=[];return Object.assign(t,Zk(t,i)),e(t),{e:fk,o:r.ordered,c:i}}function Dk(r){let e={},t=[];return Object.assign(e,Fs(e,t),Ts(e,t),As(e,t),Od(e,t),Os(e,t),Bs(e,t),Ms(e,t)),r(e),{e:hk,c:t}}function Lk(r){let e={},t=[];return Object.assign(e,Bd(e,t),Rs(e,t),um(e,t),mm(e,t),Es(e,t)),r(e),{e:uk,c:t}}function Nk(r){return{e:sk,t:r.permalink}}function _k(r){return{e:tk,t:r}}function Hk(r){let e={},t=[];return Object.assign(e,Bd(e,t),Rs(e,t),um(e,t)),r(e),{e:lk,c:t}}function qk(r){return{e:ok,t:r.subredditName,l:r.showPrefix}}function jk(r){let e={},t=[],i=[];return Object.assign(e,Qk(e,t,i)),r(e),{e:kk,h:t,c:i}}function Wk(r){let[e,t]=Xk();return r(e),{c:t}}function Gk(r,e){let[t,i]=Xk();e(t);let n;switch(r.columnAlignment){case"left":n=vk;break;case"right":n=yk;break;case"center":n=bk;break}return{...n&&{a:n},...i&&{c:i}}}function Vk(r){let e={},t=[];return Object.assign(e,Yk(e,t)),r(e),t}function zk(r){return{e:ek,t:r.text,...r.formatting&&{f:r.formatting}}}function Jk(r){return{e:ak,t:r.username,l:r.showPrefix}}function $k(r){return{e:dk,t:r.username,l:r.showPrefix}}function Kk(r){return{e:wk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function Xk(){let r={},e=[];return Object.assign(r,Bd(r,e),Rs(r,e),mm(r,e),Es(r,e)),[r,e]}function Fs(r,e){return{blockQuote(t,i){return e.push(Ik(t,i)),r}}}function Ts(r,e){return{codeBlock(t,i){return e.push(Fk(t,i)),r}}}function eS(r,e){return{embed(t){return e.push(Ek(t)),r}}}function As(r,e){return{heading(t,i){return e.push(Ak(t,i)),r}}}function Od(r,e){return{horizontalRule(){return e.push(Rk()),r}}}function Es(r,e){return{image(t){return e.push(Ok(t)),r},animatedImage(t){return e.push(xk(t)),r}}}function um(r,e){return{linebreak(){return e.push(Bk()),r}}}function Rs(r,e){return{link(t){return e.push(Mk(t)),r},commentLink(t){return e.push(Tk(t)),r},postLink(t){return e.push(Nk(t)),r},subredditLink(t){return e.push(qk(t)),r},userLink(t){return e.push(Jk(t)),r},userMention(t){return e.push($k(t)),r}}}function Os(r,e){return{list(t,i){return e.push(Uk(t,i)),r}}}function Zk(r,e){return{item(t){return e.push(Dk(t)),r}}}function Bs(r,e){return{paragraph(t){return e.push(Lk(t)),r}}}function cm(r,e){return{rawText(t){return e.push(_k(t)),r}}}function mm(r,e){return{spoiler(t){return e.push(Hk(t)),r}}}function Qk(r,e,t){return{headerCell(i,n){return e.push(Gk(i,n)),r},row(i){return t.push(Vk(i)),r}}}function Ms(r,e){return{table(t){return e.push(jk(t)),r}}}function Yk(r,e){return{cell(t){return e.push(Wk(t)),r}}}function Bd(r,e){return{text(t){return e.push(zk(t)),r}}}function tS(r,e){return{video(t){return e.push(Kk(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)},Md,yt=class{constructor(){Md.set(this,void 0);let e=[];Object.assign(this,Bs(this,e),As(this,e),Od(this,e),Fs(this,e),Ts(this,e),eS(this,e),Os(this,e),Ms(this,e),Es(this,e),tS(this,e)),vR(this,Md,{document:e},"f")}build(){return JSON.stringify(yR(this,Md,"f"))}paragraph(e){return this}heading(e,t){return this}horizontalRule(){return this}blockQuote(e,t){return this}codeBlock(e,t){return this}embed(e){return this}list(e,t){return this}table(e){return this}image(e){return this}animatedImage(e){return this}video(e){return this}};Md=new WeakMap;function Hi(r){let e;return r instanceof yt?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var rS=100,iS=1/0,Br,Mr,Vt,qi,ji,Ud,V=class{constructor(e){l(this,ji);l(this,Br);l(this,Mr);l(this,Vt);l(this,qi,!1);this.pageSize=rS;this.limit=iS;this.children=[];Y(this),this._fetch=e.fetch,this.pageSize=e.pageSize??rS,this.limit=e.limit??iS,d(this,Mr,e.after),d(this,Br,e.before),d(this,Vt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,qi)||!!(s(this,Mr)||s(this,Br)||s(this,Vt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,ji,Ud).call(this)).length===0)break}else break;if(yield this.children[e],e++,e===this.limit)break}}setMore(e){d(this,Vt,e)}preventInitialFetch(){d(this,qi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,ji,Ud).call(this);return this.children.slice(0,this.limit)}async get(e){let t=e<=this.limit?e:this.limit;for(;this.hasMore&&this.children.length<t;)await S(this,ji,Ud).call(this);return this.children.slice(0,t)}};Br=new WeakMap,Mr=new WeakMap,Vt=new WeakMap,qi=new WeakMap,ji=new WeakSet,Ud=async function(){if(!this.hasMore)throw new Error("This listing does not have any more items to load.");let{children:e,before:t,after:i,more:n}=await this._fetch({before:s(this,Br),after:s(this,Mr),limit:this.pageSize,more:s(this,Vt)});return this.children.push(...e),d(this,Br,t),d(this,Mr,i),d(this,Vt,n),d(this,qi,!0),e};var Us,pm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new V({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,Us,pm).call(this,a))||[],before:o.hasNextPage?o.endCursor:void 0,hasMore:o.hasNextPage}}})}static async delete(e,t){let i=u.redditAPIPlugins.ModNote,{deleted:n}=await i.DeleteNotes(e,t);return!!n}static async add(e,t){let n=await u.redditAPIPlugins.ModNote.PostNotes(e,t);if(!n?.created)throw new Error("Failed to create mod note");return S(this,Us,pm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Us=new WeakSet,pm=function(e){return y(e.id,"Mod note ID is null or undefined"),y(e.createdAt,"Mod note createdAt is null or undefined"),y(e.type,"Mod note type is null or undefined"),y(e.subreddit,"Mod note subreddit is null or undefined"),y(e.subredditId,"Mod note subredditId is null or undefined"),y(e.operator,"Mod note operator is null or undefined"),y(e.operatorId,"Mod note operatorId is null or undefined"),y(e.user,"Mod note user is null or undefined"),y(e.userId,"Mod note userId is null or undefined"),y(e.userNoteData,"Mod note userNote is null or undefined"),y(e.modActionData,"Mod note modAction is null or undefined"),{id:e.id,user:{id:oe(e.userId??""),name:e.user},subreddit:{id:ie(e.subredditId??""),name:e.subreddit},operator:{id:oe(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:e.userNoteData?.redditId?Re(e.userNoteData?.redditId):void 0,label:e.userNoteData?.label},type:e.type}},l(Me,Us);var re=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 nS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_operator","community_chat"];function bR(r,e){return e.map(t=>(r.includes(t)?"+":"-")+t).join(",")}function gm(r){return bR(r,nS)}function sS(r){return r.filter(e=>nS.includes(e))}var kR=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(kR||{}),Dr,Wi,Gi,Vi,zi,Ji,$i,Ki,Xi,Zi,Qi,Dd,Ke=class Ke{constructor(e,t,i){l(this,Dr);l(this,Wi);l(this,Gi);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);Y(this),y(e.id),y(e.text),d(this,Dr,e.id),d(this,Wi,t),d(this,Gi,e.text),d(this,Vi,SR(e.textColor)),d(this,zi,PR(e.backgroundColor)),d(this,Ji,CR(e.allowableContent)),d(this,$i,e.modOnly),d(this,Ki,e.maxEmojis),d(this,Xi,e.textEditable),d(this,Zi,i)}get id(){return s(this,Dr)}get text(){return s(this,Gi)}get textColor(){return s(this,Vi)}get backgroundColor(){return s(this,zi)}get allowableContent(){return s(this,Ji)}get modOnly(){return s(this,$i)}get maxEmojis(){return s(this,Ki)}get allowUserEdits(){return s(this,Xi)}async delete(){return Ke.deleteFlairTemplate(s(this,Dr),s(this,Wi),s(this,Zi))}async edit(e){return Ke.editFlairTemplate({id:s(this,Dr),subredditName:s(this,Wi),text:e.text??s(this,Gi),allowableContent:e.allowableContent??s(this,Ji),backgroundColor:e.backgroundColor??s(this,zi),maxEmojis:e.maxEmojis??s(this,Ki),modOnly:e.modOnly??s(this,$i),textColor:e.textColor??s(this,Vi),allowUserEdits:e.allowUserEdits??s(this,Xi)},s(this,Zi))}static async createPostFlairTemplate(e,t){var i;return S(i=Ke,Qi,Dd).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ke,Qi,Dd).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ke,Qi,Dd).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Dr=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Qi=new WeakSet,Dd=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,textColor:f="dark",allowUserEdits:m=!1,id:b=""}=e;if(p&&m)throw new Error("Cannot have a mod only flair that is editable by users");let P=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:g,textColor:f,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ke(P,i,t)},l(Ke,Qi);var ue=Ke;function Ds(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var zt,hm,fm,Ur=class Ur{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=Ur,zt,hm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Ur,zt,hm).call(i,{...e,postId:ye(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Ur,zt,fm).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Ur,zt,fm).call(n,e,void 0,t,i)}};zt=new WeakSet,hm=async function(e,t){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e.subredditName,flairTemplateId:e.flairTemplateId??"",text:e.text??"",name:e.username,link:e.postId,backgroundColor:e.backgroundColor??"",textColor:e.textColor??"dark",cssClass:e.cssClass??"",returnRtjson:"none"},t)},fm=async function(e,t,i,n){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e,name:i??"",link:t??"",flairTemplateId:"",backgroundColor:"",text:"",textColor:"",cssClass:"",returnRtjson:"none"},n)},l(Ur,zt);var Ue=Ur;function SR(r){if(y(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function PR(r){if(!r||r.length===0||r==="transparent")return"transparent";if(/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function CR(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as lS,CustomPostDefinition as OR,Definition as BR,UIEventHandlerDefinition as MR,UIResponse as UR}from"@devvit/protos";import{LinkedBundle as uS}from"@devvit/protos/types/devvit/runtime/bundle.js";var Yi=Dn(dS(),1);var ym=r=>"text"in r?r.text:RR(r.richtext),RR=r=>r instanceof yt?r.build():typeof r=="object"?JSON.stringify(r):r;var en,Ns,tn,_s,rn,Hs,qs,js,Jt,Ws,Gs,Vs,zs,Js,$s,$t,Ks,Xs,Nr,nn,Kt,sn,on,an,bt,Xt,Zt,dn,Qt,Yt,er,kt,Zs,Qs,ln,un,N,L=class L{constructor(e,t){l(this,en);l(this,Ns);l(this,tn);l(this,_s);l(this,rn);l(this,Hs);l(this,qs);l(this,js);l(this,Jt);l(this,Ws);l(this,Gs);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,$t);l(this,Ks);l(this,Xs);l(this,Nr);l(this,nn);l(this,Kt);l(this,sn);l(this,on);l(this,an);l(this,bt);l(this,Xt);l(this,Zt);l(this,dn);l(this,Qt);l(this,Yt);l(this,er);l(this,kt);l(this,Zs);l(this,Qs);l(this,ln);l(this,un);l(this,N);Y(this),y(e.id,"Post is missing id"),y(e.title,"Post is missing title"),y(e.createdUtc,"Post is missing created date"),y(e.author,"Post is missing author name"),y(e.subreddit,"Post is missing subreddit name"),y(e.subredditId,"Post is missing subreddit id"),y(e.url,"Post is missing url"),y(e.permalink,"Post is missing permalink"),d(this,en,ye(`t3_${e.id}`)),d(this,tn,e.author),d(this,Ns,e.authorFullname?oe(e.authorFullname):void 0),d(this,rn,ie(e.subredditId)),d(this,Hs,e.subreddit),d(this,Vs,e.score??0),d(this,zs,e.numComments??0),d(this,Js,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,_s,i),d(this,js,e.title),d(this,Jt,e.selftext),d(this,Ws,e.selftextHtml),d(this,Gs,e.url),d(this,qs,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,$s,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,$t,e.approved??!1),d(this,Ks,e.approvedAtUtc??0),d(this,Xs,e.bannedAtUtc??0),d(this,Kt,e.removed??!1),d(this,sn,e.removedBy),d(this,on,e.removedByCategory),d(this,Nr,e.spam??!1),d(this,nn,e.stickied??!1),d(this,an,e.archived??!1),d(this,bt,e.edited??!1),d(this,Xt,e.locked??!1),d(this,Zt,e.over18??!1),d(this,dn,e.quarantine??!1),d(this,Qt,e.spoiler),d(this,Yt,e.hidden??!1),d(this,er,e.ignoreReports??!1),d(this,kt,e.distinguished),d(this,Qs,e.secureMedia),d(this,ln,(e.modReports??[]).map(([n])=>n)),d(this,un,(e.userReports??[]).map(([n])=>n)),d(this,N,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,Zs,{backgroundColor:e.linkFlairBackgroundColor,cssClass:e.linkFlairCssClass,text:e.linkFlairText,type:e.linkFlairType,templateId:e.linkFlairTemplateId,richtext:(e.linkFlairRichtext??[]).map(({e:n,t:o,a,u:c})=>({elementType:n,text:o,emojiRef:a,url:c})),textColor:e.linkFlairTextColor})}get id(){return s(this,en)}get authorId(){return s(this,Ns)}get authorName(){return s(this,tn)}get subredditId(){return s(this,rn)}get subredditName(){return s(this,Hs)}get permalink(){return s(this,qs)}get title(){return s(this,js)}get body(){return s(this,Jt)}get bodyHtml(){return s(this,Ws)}get url(){return s(this,Gs)}get thumbnail(){return s(this,$s)}get createdAt(){return s(this,_s)}get score(){return s(this,Vs)}get numberOfComments(){return s(this,zs)}get numberOfReports(){return s(this,Js)}get approved(){return s(this,$t)}get approvedAtUtc(){return s(this,Ks)}get bannedAtUtc(){return s(this,Xs)}get spam(){return s(this,Nr)}get stickied(){return s(this,nn)}get removed(){return s(this,Kt)}get removedBy(){return s(this,sn)}get removedByCategory(){return s(this,on)}get archived(){return s(this,an)}get edited(){return s(this,bt)}get locked(){return s(this,Xt)}get nsfw(){return s(this,Zt)}get quarantined(){return s(this,dn)}get spoiler(){return s(this,Qt)}get hidden(){return s(this,Yt)}get ignoringReports(){return s(this,er)}get distinguishedBy(){return s(this,kt)}get comments(){return te.getComments({postId:this.id},s(this,N))}get flair(){return s(this,Zs)}get secureMedia(){return s(this,Qs)}get userReportReasons(){return s(this,un)}get modReportReasons(){return s(this,ln)}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,sn),removedByCategory:s(this,on),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,ln),userReportReasons:s(this,un)}}isApproved(){return s(this,$t)}isSpam(){return s(this,Nr)}isStickied(){return s(this,nn)}isRemoved(){return s(this,Kt)}isArchived(){return s(this,an)}isEdited(){return s(this,bt)}isLocked(){return s(this,Xt)}isNsfw(){return s(this,Zt)}isQuarantined(){return s(this,dn)}isSpoiler(){return s(this,Qt)}isHidden(){return s(this,Yt)}isIgnoringReports(){return s(this,er)}isDistinguishedBy(){return s(this,kt)}async edit(e){let t=await L.edit({id:this.id,...e},s(this,N));d(this,Jt,t.body),d(this,bt,t.edited)}async setSuggestedCommentSort(e){await L.setSuggestedCommentSort({id:this.id,subredditId:s(this,rn),suggestedSort:e},s(this,N))}async setCustomPostPreview(e){let t=await L.setCustomPostPreview({id:this.id,body:this.body,ui:e},s(this,N));d(this,Jt,t.body),d(this,bt,t.edited)}async setTextFallback(e){let t=await L.setTextFallback(e,this.id,s(this,N));d(this,Jt,t.body),d(this,bt,t.edited)}async addComment(e){return te.submit({id:this.id,...e},s(this,N))}async delete(){return L.delete(this.id,s(this,N))}async approve(){await L.approve(this.id,s(this,N)),d(this,$t,!0),d(this,Kt,!1)}async remove(e=!1){await L.remove(this.id,e,s(this,N)),d(this,Kt,!0),d(this,Nr,e),d(this,$t,!1)}async lock(){await L.lock(this.id,s(this,N)),d(this,Xt,!0)}async unlock(){await L.unlock(this.id,s(this,N)),d(this,Xt,!1)}async hide(){await L.hide(this.id,s(this,N)),d(this,Yt,!0)}async unhide(){await L.unhide(this.id,s(this,N)),d(this,Yt,!1)}async markAsNsfw(){await L.markAsNsfw(this.id,s(this,N)),d(this,Zt,!0)}async unmarkAsNsfw(){await L.unmarkAsNsfw(this.id,s(this,N)),d(this,Zt,!1)}async markAsSpoiler(){await L.markAsSpoiler(this.id,s(this,N)),d(this,Qt,!0)}async unmarkAsSpoiler(){await L.unmarkAsSpoiler(this.id,s(this,N)),d(this,Qt,!1)}async sticky(e){await L.sticky(this.id,e,s(this,N))}async unsticky(){await L.unsticky(this.id,s(this,N))}async distinguish(){let{distinguishedBy:e}=await L.distinguish(this.id,!1,s(this,N));d(this,kt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await L.distinguish(this.id,!0,s(this,N));d(this,kt,e)}async undistinguish(){let{distinguishedBy:e}=await L.undistinguish(this.id,s(this,N));d(this,kt,e)}async ignoreReports(){await L.ignoreReports(this.id,s(this,N)),d(this,er,!0)}async unignoreReports(){await L.unignoreReports(this.id,s(this,N)),d(this,er,!1)}async getAuthor(){return x.getByUsername(s(this,tn),s(this,N))}async crosspost(e){return L.crosspost({...e,postId:this.id},s(this,N))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,en)],...e},s(this,N))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=pr(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 L(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){y(t,"Missing metadata in `SubmitPostOptions`");let c=await new pt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=lS.encode(c).finish(),{textFallback:g,...f}=e,m=g?ym(g):"",b={kind:"custom",sr:e.subredditName,richtextJson:(0,Yi.fromByteArray)(p),richtextFallback:m,...f};n=await i.SubmitCustomPost(b,t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?Hi(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return L.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:ye(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return L.getById(`t3_${c.json.data.id}`,t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=Hi(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return L.getById(n,t)}static async setSuggestedCommentSort(e,t){if(!(await re.query("SetSuggestedSort","cf6052acc7fefaa65b710625b81dba8041f258313aafe9730e2a3dc855e5d10d",{input:{subredditId:e.subredditId,postId:e.id,sort:e.suggestedSort}},t)).data?.setSuggestedSort?.ok)throw new Error("Failed to set suggested sort")}static async setCustomPostPreview(e,t){if(!t)throw new Error("Failed to set custom post preview. Metadata not found");let i=new RegExp(/DX_Bundle:\n\n {4}(?<bundle>[^\n]*)/g).exec(e.body??"");if(!i?.groups?.bundle)throw new Error(`Failed to set custom post preview. Couldn't find bundle in post ${e.id}`);let n=(0,Yi.toByteArray)(i.groups.bundle),o=uS.decode(n);o.provides=[OR,MR].map(I=>BR.toSerializable(I));let a=(0,Yi.fromByteArray)(uS.encode(o).finish()),p=new RegExp(/DX_RichtextFallback:\n\n {4}(?<fallback>[^\n]*)/g).exec(e.body??"")?.groups?.fallback,g=new Tr(e.ui),m=UR.fromJSON(await g.handle({events:[]},t)).blocks,b=(0,Yi.fromByteArray)(lS.encode(m).finish()),v=new yt().heading({level:1},I=>I.rawText("DX_Bundle:")).codeBlock({language:""},I=>{I.rawText(a)}).heading({level:1},I=>I.rawText("DX_Config:")).codeBlock({language:""},I=>{I.rawText("EgA=")}).heading({level:1},I=>I.rawText("DX_Cached:")).codeBlock({language:""},I=>{I.rawText(b)});if(p&&v.heading({level:1},I=>I.rawText("DX_RichtextFallback:")).codeBlock({language:""},I=>{I.rawText(p)}),!(await re.query("UpdatePost","ccc5f1da31a8d8c518b6607e81c2903a46f922cb6562c8b47fcc8988f0611360",{input:{postId:e.id,content:{richText:v.build()}}},t)).data?.updatePost?.ok)throw new Error("Failed to set custom post preview");return L.getById(e.id,t)}static async setTextFallback(e,t,i){if(!("text"in e)&&!("richtext"in e))throw new Error(`No text fallback provided for post ${t}.`);let n=u.redditAPIPlugins.LinksAndComments,o=ym(e);if((await n.EditCustomPost({thingId:t,richtextFallback:o},i)).json?.errors?.length)throw new Error("Failed to set post text fallback");return L.getById(t,i)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await u.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await u.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:t?"admin":"yes",sticky:!1},i)).json?.data?.things?.[0]?.data;return y(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 y(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 V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ls(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ls(o,t)}})}};en=new WeakMap,Ns=new WeakMap,tn=new WeakMap,_s=new WeakMap,rn=new WeakMap,Hs=new WeakMap,qs=new WeakMap,js=new WeakMap,Jt=new WeakMap,Ws=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,$t=new WeakMap,Ks=new WeakMap,Xs=new WeakMap,Nr=new WeakMap,nn=new WeakMap,Kt=new WeakMap,sn=new WeakMap,on=new WeakMap,an=new WeakMap,bt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,dn=new WeakMap,Qt=new WeakMap,Yt=new WeakMap,er=new WeakMap,kt=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,ln=new WeakMap,un=new WeakMap,N=new WeakMap;var z=L;function Ls(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>new z(i.data,e)),before:r.data.before,after:r.data.after}}var DR=(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))(DR||{}),Ys,cn,eo,to,ro,io,no,tr,so,oo,ot,_r=class _r{constructor(e,t){l(this,Ys);l(this,cn);l(this,eo);l(this,to);l(this,ro);l(this,io);l(this,no);l(this,tr,new Map);l(this,so);l(this,oo);l(this,ot);Y(this),y(e.id,"User ID is missing or undefined"),y(e.name,"Username is missing or undefined"),y(e.createdUtc,"User is missing created date"),d(this,Ys,oe(Ka(e.id)?e.id:`t2_${e.id}`)),d(this,cn,e.name),d(this,io,e.over18??!1),d(this,no,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,eo,i),d(this,to,e.linkKarma??0),d(this,ro,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,tr).set(n,sS(o));d(this,so,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,oo,e.subreddit?.url??""),d(this,ot,t)}get id(){return s(this,Ys)}get username(){return s(this,cn)}get createdAt(){return s(this,eo)}get linkKarma(){return s(this,to)}get commentKarma(){return s(this,ro)}get nsfw(){return s(this,io)}get isAdmin(){return s(this,no)}get modPermissions(){return s(this,tr)}get url(){return s(this,so)}get permalink(){return s(this,oo)}toJSON(){return{id:this.id,username:this.username,createdAt:this.createdAt,linkKarma:this.linkKarma,commentKarma:this.commentKarma,nsfw:this.nsfw,modPermissionsBySubreddit:Object.fromEntries(this.modPermissions)}}async getModPermissionsForSubreddit(e){if(s(this,tr).has(e))return s(this,tr).get(e);let t=await _r.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ot)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,tr).set(e,i),i}getComments(e){return te.getCommentsByUser({username:this.username,...e},s(this,ot))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,ot))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,cn)},s(this,ot));return t.users[0]?Ds(t.users[0]):void 0}getSnoovatarUrl(){return _r.getSnoovatarUrl(this.username,s(this,ot))}async getSocialLinks(){let i=await re.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,ot));return i.data?.user?.profile?.socialLinks?i.data.user.profile.socialLinks.map(n=>({...n,handle:n.handle??void 0})):[]}static async getById(e,t){let o=(await u.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return o==null?void 0:_r.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new _r(n.data,t)}static async getFromMetadata(e,t){y(t);let i=t?.[e]?.values[0];return i?_r.getById(oe(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new V({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 NR(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,g=await i.Friend({type:n,subreddit:o,name:a,permissions:c?gm(c):void 0,...p},t);if(g.json?.errors?.length)throw new Error(g.json.errors.join(`
|
4
4
|
`))}static async removeRelationship(e,t){await u.redditAPIPlugins.Users.Unfriend({type:e.type,subreddit:e.subredditName,name:e.username},t)}static async setModeratorPermissions(e,t,i,n){let a=await u.redditAPIPlugins.Users.SetPermissions({subreddit:t,name:e,type:"moderator",permissions:gm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
|
5
5
|
`))}static async getSnoovatarUrl(e,t){return(await re.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new V({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 LR(o,t)}})}};Ys=new WeakMap,cn=new WeakMap,eo=new WeakMap,to=new WeakMap,ro=new WeakMap,io=new WeakMap,no=new WeakMap,tr=new WeakMap,so=new WeakMap,oo=new WeakMap,ot=new WeakMap;var x=_r;function LR(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 te(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function NR(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(f=>(y(f.data?.id,"User id is still from listing data"),f.data.id)),o=100,a=[];for(let f=0;f<n.length;f+=o)a.push(n.slice(f,f+o));let p=(await Promise.all(a.map(f=>i.UserDataByAccountIds({ids:f.join(",")},t)))).reduce((f,m)=>({...f,...m.users}),{});return{children:r.data.children.map(f=>{let m=f.data?.id;y(m,"User id is missing from listing");let b=p[m];return y(b,"User data is missing from response"),new x({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:f.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var Hr,ao,mn,pn,lo,uo,gn,co,mo,hn,rr,po,go,qr,ir,nr,St,jr,Pt,ho,fo,vo,yo,bo,ko,So,sr,ee,at,Nd,_d,j=class j{constructor(e,t){l(this,Hr);l(this,ao);l(this,mn);l(this,pn);l(this,lo);l(this,uo);l(this,gn);l(this,co);l(this,mo);l(this,hn);l(this,rr);l(this,po);l(this,go);l(this,qr);l(this,ir);l(this,nr);l(this,St);l(this,jr);l(this,Pt);l(this,ho);l(this,fo);l(this,vo);l(this,yo);l(this,bo);l(this,ko);l(this,So);l(this,sr);l(this,ee);var n;Y(this),y(e.id,"Comment id is null or undefined"),y(e.body,"Comment body is null or undefined"),y(e.createdUtc,"Comment is missing created date"),y(e.author,"Comment author is null or undefined"),y(e.parentId,"Comment parentId is null or undefined"),y(e.linkId,"Comment linkId is null or undefined"),y(e.permalink,"Comment permalink is null or undefined"),y(e.subreddit,"Comment is missing subreddit name"),y(e.subredditId,"Comment is missing subreddit id"),d(this,Hr,ii(`t1_${e.id}`)),d(this,ao,e.authorFullname?oe(e.authorFullname):void 0),d(this,mn,e.author),d(this,pn,e.body),d(this,co,ie(e.subredditId)),d(this,mo,e.subreddit),d(this,uo,Yu(e.parentId)?ii(e.parentId):ye(e.parentId)),d(this,gn,ye(e.linkId)),d(this,qr,e.edited??!1),d(this,ir,e.locked??!1),d(this,nr,e.removed??!1),d(this,St,e.stickied??!1),d(this,rr,e.approved??!1),d(this,po,e.approvedAtUtc??0),d(this,go,e.bannedAtUtc??0),d(this,jr,e.spam??!1),d(this,Pt,e.distinguished),d(this,ho,e.numReports??0),d(this,fo,e.collapsedBecauseCrowdControl??!1),d(this,vo,e.score??0),d(this,yo,e.permalink),d(this,So,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,sr,e.ignoreReports??!1),d(this,bo,(e.modReports??[]).map(([o])=>o)),d(this,ko,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,lo,i),d(this,hn,S(n=j,at,Nd).call(n,{postId:s(this,gn),commentId:s(this,Hr)},t)),d(this,ee,t)}get id(){return s(this,Hr)}get authorId(){return s(this,ao)}get authorName(){return s(this,mn)}get subredditId(){return s(this,co)}get subredditName(){return s(this,mo)}get body(){return s(this,pn)}get createdAt(){return s(this,lo)}get parentId(){return s(this,uo)}get postId(){return s(this,gn)}get replies(){return s(this,hn)}get distinguishedBy(){return s(this,Pt)}get locked(){return s(this,ir)}get stickied(){return s(this,St)}get removed(){return s(this,nr)}get approved(){return s(this,rr)}get approvedAtUtc(){return s(this,po)}get bannedAtUtc(){return s(this,go)}get spam(){return s(this,jr)}get edited(){return s(this,qr)}get numReports(){return s(this,ho)}get collapsedBecauseCrowdControl(){return s(this,fo)}get score(){return s(this,vo)}get permalink(){return s(this,yo)}get userReportReasons(){return s(this,ko)}get modReportReasons(){return s(this,bo)}get url(){return s(this,So)}get ignoringReports(){return s(this,sr)}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,ignoringReports:this.ignoringReports}}isLocked(){return s(this,ir)}isApproved(){return s(this,rr)}isRemoved(){return s(this,nr)}isSpam(){return s(this,jr)}isStickied(){return s(this,St)}isDistinguished(){return!!s(this,Pt)}isEdited(){return s(this,qr)}isIgnoringReports(){return s(this,sr)}async delete(){return j.delete(this.id,s(this,ee))}async edit(e){let t=await j.edit({id:this.id,...e},s(this,ee));return d(this,pn,t.body),d(this,qr,t.edited),this}async approve(){await j.approve(this.id,s(this,ee)),d(this,rr,!0),d(this,nr,!1)}async remove(e=!1){await j.remove(this.id,e,s(this,ee)),d(this,nr,!0),d(this,jr,e),d(this,rr,!1)}async lock(){await j.lock(this.id,s(this,ee)),d(this,ir,!0)}async unlock(){await j.unlock(this.id,s(this,ee)),d(this,ir,!1)}async reply(e){return j.submit({id:this.id,...e},s(this,ee))}async getAuthor(){return x.getByUsername(s(this,mn),s(this,ee))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!1,s(this,ee));d(this,Pt,t),d(this,St,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!0,s(this,ee));d(this,Pt,t),d(this,St,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await j.undistinguish(this.id,s(this,ee));d(this,Pt,e),d(this,St,t)}async ignoreReports(){await j.ignoreReports(this.id,s(this,ee)),d(this,sr,!0)}async unignoreReports(){await j.unignoreReports(this.id,s(this,ee)),d(this,sr,!1)}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,Hr)],...e},s(this,ee))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=It(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 j(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=j,at,Nd).call(a,{postId:ye(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=Hi(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 y(c),new j(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=Hi(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 y(c),new j(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 y(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 y(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new V({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 y(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new j(c.data,t))||[],before:o.data.before,after:o.data.after}}})}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)}};Hr=new WeakMap,ao=new WeakMap,mn=new WeakMap,pn=new WeakMap,lo=new WeakMap,uo=new WeakMap,gn=new WeakMap,co=new WeakMap,mo=new WeakMap,hn=new WeakMap,rr=new WeakMap,po=new WeakMap,go=new WeakMap,qr=new WeakMap,ir=new WeakMap,nr=new WeakMap,St=new WeakMap,jr=new WeakMap,Pt=new WeakMap,ho=new WeakMap,fo=new WeakMap,vo=new WeakMap,yo=new WeakMap,bo=new WeakMap,ko=new WeakMap,So=new WeakMap,sr=new WeakMap,ee=new WeakMap,at=new WeakSet,Nd=function(e,t,i=0){return new V({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,v;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let P=n.more;(!o||o>100)&&(o=100);let C=P.children.splice(0,o),F=await c.MoreChildren({linkId:e.postId,children:C,sort:e.sort},t);if(!F.json?.data?.things?.length)return{children:[]};let{children:I}=S(b=j,at,_d).call(b,F.json.data.things,e.postId,e,t);return{children:I,more:P.children.length?P:void 0}}else p=n.more.parentId,i=i+n.more.depth;let f=(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=f[0];return p&&m?.data?.replyList?.data&&(f=m.data.replyList.data.children),S(v=j,at,_d).call(v,f,p??e.postId,e,t,i)}})},_d=function(e,t,i,n,o=0){var g,f;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 v=new j(m.data,n);if(p[v.id]=v,d(v,hn,S(g=j,at,Nd).call(g,{...i,postId:v.postId,commentId:v.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:P,more:C}=S(f=j,at,_d).call(f,m.data.replyList.data.children,v.id,i,n,o);P.length&&v.replies.children.push(...P),C&&v.replies.setMore(C)}v.replies.preventInitialFetch(),b?b.replies.children.push(v):a.push(v)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let v={parentId:Yu(m.data.parentId)?ii(m.data.parentId):ye(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(v):v.parentId===t&&(c=v)}}return{children:a,more:c}},l(j,at);var te=j;function Ya(r,e){let t=u.redditAPIPlugins.Moderation;return new V({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 _R(n)}})}function _R(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:f,description:m,details:b,targetAuthor:v,targetBody:P,targetFullname:C,targetPermalink:F,targetTitle:I}=t.data;y(i,"ModAction from AboutLogResponse is missing id"),y(n,"ModAction from AboutLogResponse is missing mod"),y(o,"ModAction from AboutLogResponse is missing modId36"),y(a,"ModAction from AboutLogResponse is missing createdUtc"),y(c,"ModAction from AboutLogResponse is missing subreddit"),y(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),y(g,"ModAction from AboutLogResponse is missing action"),y(f,"ModAction from AboutLogResponse is missing srId36");let ge=new Date(0);return ge.setUTCSeconds(a),{id:i,type:g,moderatorName:n,moderatorId:`t2_${o}`,createdAt:ge,subredditName:c,subredditId:`t5_${f}`,description:m,details:b,target:C?{id:C,author:v,body:P,permalink:F,title:I}:void 0}}),after:r.data.after,before:r.data.before}}import"@devvit/protos";var HR=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(HR||{}),qR={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},jR=(v=>(v.Highlighted="Highlighted",v.Unhighlighted="Unhighlighted",v.Archived="Archived",v.Unarchived="Unarchived",v.ReportedToAdmins="ReportedToAdmins",v.Muted="Muted",v.Unmuted="Unmuted",v.Banned="Banned",v.Unbanned="Unbanned",v.Approved="Approved",v.Disapproved="Disapproved",v.Filtered="Filtered",v.Unfiltered="Unfiltered",v))(jR||{}),WR={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"},H,J,de,cS,mS,ed=class{constructor(e){l(this,J);l(this,H);this.notificationSubjectPrefix="[notification]";d(this,H,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,H));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,H)),n={};for(let o in i.conversations)n[o]=S(this,J,de).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,H));return{participantSubreddit:i.participantSubreddit,conversation:S(this,J,de).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,H));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,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async createModDiscussionConversation(e){return bm({subject:e.subject,bodyMarkdown:e.bodyMarkdown,subredditId:ie(e.subredditId),isInternal:!0,participantType:"MODERATOR",conversationType:"INTERNAL"},s(this,H))}async createModInboxConversation(e){return bm({subject:e.subject,bodyMarkdown:e.bodyMarkdown,subredditId:ie(e.subredditId),isInternal:!1,participantType:"PARTICIPANT_USER",conversationType:"SR_USER"},s(this,H))}async createModNotification(e){let t=e.subject;return e.subject.startsWith(this.notificationSubjectPrefix)||(t=`${this.notificationSubjectPrefix} ${e.subject}`),bm({subject:t,bodyMarkdown:e.bodyMarkdown,subredditId:ie(e.subredditId),isInternal:!1,participantType:"PARTICIPANT_USER",conversationType:"SR_USER"},s(this,H))}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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,H))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).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,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,H))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,H))}};H=new WeakMap,J=new WeakSet,de=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:qR[e.state],messages:S(this,J,cS).call(this,e,t),modActions:S(this,J,mS).call(this,e,i)}},cS=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},mS=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:WR[a.actionTypeId]})}return i};async function bm(r,e){let t=e[D.AppUser]?.values[0],o=await re.query("CreateModmailConversation","5f9ae20b0c7bdffcafb80241728a72e67cd4239bc09f67284b79d4aa706ee0e5",{subject:r.subject,bodyMarkdown:r.bodyMarkdown,subredditId:r.subredditId,authorId:t,isInternal:r.isInternal,participantType:r.participantType,conversationType:r.conversationType},e);if(o.data?.createModmailConversationV2?.ok)return o.data?.createModmailConversationV2?.conversationId;throw new Error("modmail conversation creation failed; ${response.data?.createModmailConversationV2?.errors[0].message}")}var fn,vn,Po,Co,wo,xo,km=class km{constructor(e,t){l(this,fn);l(this,vn);l(this,Po);l(this,Co);l(this,wo);l(this,xo);if(Y(this),y(e.id,"PrivateMessage: Invalid data, no id"),y(e.name,"PrivateMessage: Invalid data, no name"),y(e.created,"PrivateMessage: Invalid data, no created date"),d(this,fn,Re(e.name)),e.author!=null)d(this,vn,{type:"user",username:e.author,id:e.authorFullname?oe(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,vn,{type:"subreddit",name:e.subreddit,id:e.subredditId?ie(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,Po,e.body??""),d(this,Co,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,wo,i),d(this,xo,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new V({...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 km(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,fn)}get from(){return s(this,vn)}get body(){return s(this,Po)}get bodyHtml(){return s(this,Co)}get created(){return s(this,wo)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,fn)},s(this,xo))}};fn=new WeakMap,vn=new WeakMap,Po=new WeakMap,Co=new WeakMap,wo=new WeakMap,xo=new WeakMap;var hr=km;var Jv=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(Jv||{}),pS=class{},gS=class{},hS=class{},fS=class{},yn,A,Io,Fo,To,Ao,Eo,Ro,Oo,Bo,Mo,bn,E,dt=class dt{constructor(e,t){l(this,yn);l(this,A);l(this,Io);l(this,Fo);l(this,To);l(this,Ao);l(this,Eo);l(this,Ro);l(this,Oo);l(this,Bo);l(this,Mo);l(this,bn);l(this,E);Y(this),y(e.id,"Subreddit id is missing or undefined"),y(e.displayName,"Subreddit name is missing or undefined"),d(this,yn,ie(`t5_${e.id}`)),d(this,A,e.displayName),y(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Io,i),d(this,Fo,GR(e.subredditType)),d(this,To,e.title),d(this,Ao,e.description),y(e.lang,"Subreddit is missing language"),d(this,Eo,e.lang),d(this,Ro,e.subscribers??0),d(this,Oo,e.activeUserCount??0),d(this,Bo,e.over18??!1),d(this,bn,e.url??""),d(this,Mo,{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:VR(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(zR),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,keyColor:e.keyColor,mobileBannerImage:e.mobileBannerImage,primaryColor:e.primaryColor,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1,userFlairBackgroundColor:e.userFlairBackgroundColor,userFlairTextColor:e.userFlairTextColor},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,bn),"https://www.reddit.com").toString()}),d(this,E,t)}get id(){return s(this,yn)}get name(){return s(this,A)}get createdAt(){return s(this,Io)}get type(){return s(this,Fo)}get title(){return s(this,To)}get description(){return s(this,Ao)}get language(){return s(this,Eo)}get numberOfSubscribers(){return s(this,Ro)}get numberOfActiveUsers(){return s(this,Oo)}get nsfw(){return s(this,Bo)}get settings(){return s(this,Mo)}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,bn)}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,A)};return z.submit(t,s(this,E))}getControversialPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,A)},s(this,E))}getTopPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,A)},s(this,E))}getApprovedUsers(e={}){return x.getSubredditUsersByType({type:"contributors",subredditName:s(this,A),...e},s(this,E))}approveUser(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,E))}removeUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,E))}getWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,A),...e},s(this,E))}addWikiContributor(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,E))}removeWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,E))}getBannedUsers(e={}){return x.getSubredditUsersByType({type:"banned",subredditName:s(this,A),...e},s(this,E))}banUser(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration,banContext:e.context},s(this,E))}unbanUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"banned"},s(this,E))}getBannedWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,A),...e},s(this,E))}banWikiContributor(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,E))}unbanWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikibanned"},s(this,E))}getModerators(e={}){return x.getSubredditUsersByType({type:"moderators",subredditName:s(this,A),...e},s(this,E))}inviteModerator(e,t){return x.createRelationship({type:"moderator_invite",subredditName:s(this,A),username:e,permissions:t??[]},s(this,E))}revokeModeratorInvite(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"moderator_invite"},s(this,E))}removeModerator(e){return x.removeRelationship({type:"moderator",subredditName:s(this,A),username:e},s(this,E))}setModeratorPermissions(e,t){return x.setModeratorPermissions(e,s(this,A),t,s(this,E))}getMutedUsers(e={}){return x.getSubredditUsersByType({type:"muted",subredditName:s(this,A),...e},s(this,E))}muteUser(e,t){return x.createRelationship({username:e,subredditName:s(this,A),type:"muted",note:t},s(this,E))}unmuteUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"muted"},s(this,E))}getModerationLog(e){return Ya({subredditName:s(this,A),...e},s(this,E))}getUserFlairTemplates(){return ue.getUserFlairTemplates(s(this,A),s(this,E))}getPostFlairTemplates(){return ue.getPostFlairTemplates(s(this,A),s(this,E))}createPostFlairTemplate(e){return ue.createPostFlairTemplate({subredditName:s(this,A),...e},s(this,E))}createUserFlairTemplate(e){return ue.createUserFlairTemplate({subredditName:s(this,A),...e},s(this,E))}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,A),name:i},s(this,E));return Ds(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,A)},s(this,E));return{next:t.next,prev:t.prev,users:t.users.map(i=>Ds(i))}}}getModQueue(e={type:"all"}){return dt.aboutLocation({...e,location:"modqueue",subreddit:s(this,A)},s(this,E))}getReports(e={type:"all"}){return dt.aboutLocation({...e,location:"reports",subreddit:s(this,A)},s(this,E))}getSpam(e={type:"all"}){return dt.aboutLocation({...e,location:"spam",subreddit:s(this,A)},s(this,E))}getUnmoderated(e={type:"all"}){return dt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,A)},s(this,E))}getEdited(e={type:"all"}){return dt.aboutLocation({...e,location:"edited",subreddit:s(this,A)},s(this,E))}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 V({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return vS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new V({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,yn)]},s(this,E));return vS(i,s(this,E))}})}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){y(e);let t=e?.[D.Subreddit]?.values[0];return y(t),dt.getById(ie(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return y(o),dt.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 dt(n.data,t)}};yn=new WeakMap,A=new WeakMap,Io=new WeakMap,Fo=new WeakMap,To=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,bn=new WeakMap,E=new WeakMap;var be=dt;async function $v(r,e){let o=(await re.query("GetSubredditInfoById","315a9b75c22a017d526afdf2d274616946156451aacfd56dfb91e7ad3f7a2fde",{id:r},e)).data?.subredditInfoById;if(!o)throw new Error("subreddit info not found");return o}async function Kv(r,e){let o=(await re.query("GetSubredditInfoByName","4aa69726c7e3f5d33ab2bee22b3d74fce645824fddd5ea3ec6dfe30bdb4295cb",{name:r},e)).data?.subredditInfoByName;if(!o)throw new Error("subreddit info not found");return o}async function Xv(r,e){let o=(await re.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}}async function Zv(r,e){let o=(await re.query("GetSubredditStyles","d491d17ea8858f563ea578b26b9595d64adecf4bf34557d567c7e53c470f5f22",{id:r},e)).data?.subredditInfoById?.styles;if(!o)throw new Error("subreddit styles not found");return o}function GR(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_only"||r==="gold_restricted"||r==="archived"||r==="user")return r;throw new Error(`invalid subreddit type: ${r}`)}function VR(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function zR(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function vS(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 te(a.data,e)}catch{return null}}}async function Qv(r,e){return yS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function Yv(r,e){return yS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function yS(r,e,t,i){let o=(await re.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:oe(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as JR,GetWidgetsResponse_WidgetItem as pe}from"@devvit/protos";var Uo,Do,Lo,No,Pm=class Pm{constructor(e,t,i){l(this,Uo);l(this,Do);l(this,Lo);l(this,No);Y(this),d(this,Uo,e.id),d(this,Do,e.shortName),d(this,Lo,t),d(this,No,i)}get id(){return s(this,Uo)}get name(){return s(this,Do)}get subredditName(){return s(this,Lo)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Pm.delete(this.subredditName,this.id,s(this,No))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);y(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 Hd(p,e,t));break;case"calendar":a.push(new qd(p,e,t));break;case"textarea":a.push(new jd(p,e,t));break;case"button":a.push(new Wd(p,e,t));break;case"community-list":a.push(new Gd(p,e,t));break;case"post-flair":a.push(new Vd(p,e,t));break;case"custom":a.push(new zd(p,e,t));break;case"subreddit-rules":{let g=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Sm(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 Hd.create(e,t);case"calendar":return qd.create(e,t);case"textarea":return jd.create(e,t);case"button":return Wd.create(e,t);case"community-list":return Gd.create(e,t);case"post-flair":return Vd.create(e,t);case"custom":return zd.create(e,t);default:throw new Error("Unknown widget type")}}};Uo=new WeakMap,Do=new WeakMap,Lo=new WeakMap,No=new WeakMap;var ae=Pm,_o,Jd=class Jd extends ae{constructor(t,i,n){super(t,i,n);l(this,_o);d(this,_o,t.data.map(o=>(y(o.url,"Image widget data is missing url"),y(o.height,"Image widget data is missing height"),y(o.width,"Image widget data is missing width"),y(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,_o)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new Jd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new Jd(pe.fromJSON(o),t.subreddit,i)}};_o=new WeakMap;var Hd=Jd,Ho,qo,jo,$d=class $d extends ae{constructor(t,i,n){super(t,i,n);l(this,Ho);l(this,qo);l(this,jo);y(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),y(t.configuration,"Calendar widget data is missing configuration"),y(t.styles,"Calendar widget data is missing styles"),d(this,Ho,t.googleCalendarId),d(this,qo,t.configuration),d(this,jo,t.styles)}get googleCalendarId(){return s(this,Ho)}get configuration(){return s(this,qo)}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 $d(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new $d(pe.fromJSON(o),t.subreddit,i)}};Ho=new WeakMap,qo=new WeakMap,jo=new WeakMap;var qd=$d,Wo,Go,Kd=class Kd extends ae{constructor(t,i,n){super(t,i,n);l(this,Wo);l(this,Go);y(t.text,"Textarea widget data is missing text"),y(t.styles,"Textarea widget data is missing styles"),d(this,Wo,t.text),d(this,Go,t.styles)}get text(){return s(this,Wo)}get styles(){return s(this,Go)}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 Kd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new Kd(pe.fromJSON(o),t.subreddit,i)}};Wo=new WeakMap,Go=new WeakMap;var jd=Kd,Vo,zo,Jo,Xd=class Xd extends ae{constructor(t,i,n){super(t,i,n);l(this,Vo);l(this,zo);l(this,Jo);y(t.styles,"Button widget data is missing styles"),d(this,Vo,t.buttons),d(this,zo,t.description??""),d(this,Jo,t.styles)}get buttons(){return s(this,Vo)}get description(){return s(this,zo)}get styles(){return s(this,Jo)}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 Xd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new Xd(pe.fromJSON(o),t.subreddit,i)}};Vo=new WeakMap,zo=new WeakMap,Jo=new WeakMap;var Wd=Xd,$o,Ko,Zd=class Zd extends ae{constructor(t,i,n){super(t,i,n);l(this,$o);l(this,Ko);d(this,$o,t.data.map(o=>JR.fromJSON(o))),y(t.styles,"Community list widget data is missing styles"),d(this,Ko,t.styles)}get communities(){return s(this,$o)}get styles(){return s(this,Ko)}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 Zd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new Zd(pe.fromJSON(o),t.subreddit,i)}};$o=new WeakMap,Ko=new WeakMap;var Gd=Zd,Xo,Zo,Qo,Qd=class Qd extends ae{constructor(t,i,n){super(t,i,n);l(this,Xo);l(this,Zo);l(this,Qo);if(y(t.styles,"Post flair widget data is missing styles"),d(this,Xo,t.styles),d(this,Zo,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,Qo,t.display)}get styles(){return s(this,Xo)}get templates(){return s(this,Zo)}get display(){return s(this,Qo)}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 Qd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new Qd(pe.fromJSON(o),t.subreddit,i)}};Xo=new WeakMap,Zo=new WeakMap,Qo=new WeakMap;var Vd=Qd,Yo,ea,ta,ra,ia,Yd=class Yd extends ae{constructor(t,i,n){super(t,i,n);l(this,Yo);l(this,ea);l(this,ta);l(this,ra);l(this,ia);y(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),y(t.height,"Custom widget data is missing height"),y(t.css,"Custom widget data is missing css"),d(this,Yo,t.imageData??[]),d(this,ea,t.text??""),d(this,ta,t.stylesheetUrl),d(this,ra,t.height),d(this,ia,t.css)}get images(){return s(this,Yo)}get text(){return s(this,ea)}get stylesheetUrl(){return s(this,ta)}get height(){return s(this,ra)}get css(){return s(this,ia)}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 Yd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new Yd(pe.fromJSON(o),t.subreddit,i)}};Yo=new WeakMap,ea=new WeakMap,ta=new WeakMap,ra=new WeakMap,ia=new WeakMap;var zd=Yd,na,Sm=class extends ae{constructor(t,i,n,o){super(i,n,o);l(this,na);let a=t.rules.map(({description:c,priority:p,shortName:g,violationReason:f})=>(y(c,"Subreddit rule is missing description"),y(p,"Subreddit rule is missing priority"),y(g,"Subreddit rule is missing shortName"),y(f,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:g,violationReason:f}));d(this,na,a)}get rules(){return s(this,na)}toJSON(){return{...super.toJSON(),rules:this.rules}}};na=new WeakMap;var $R=(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))($R||{}),Pe,Ce,kn,Sn,Pn,Cn,wn,xn,Xe,He=class He{constructor(e,t,i,n){l(this,Pe);l(this,Ce);l(this,kn);l(this,Sn);l(this,Pn);l(this,Cn);l(this,wn);l(this,xn);l(this,Xe);Y(this),d(this,Pe,e),d(this,Ce,t),d(this,kn,i.contentMd),d(this,Sn,i.contentHtml),d(this,Pn,i.revisionId),d(this,Cn,new Date(i.revisionDate*1e3)),d(this,wn,i.reason??""),y(i.revisionBy?.data,"Wiki page author details are missing"),d(this,xn,new x(i.revisionBy.data,n)),d(this,Xe,n)}get name(){return s(this,Pe)}get subredditName(){return s(this,Ce)}get content(){return s(this,kn)}get contentHtml(){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,xn)}toJSON(){return{name:s(this,Pe),subredditName:s(this,Ce),content:s(this,kn),contentHtml:s(this,Sn),revisionId:s(this,Pn),revisionDate:s(this,Cn),revisionReason:s(this,wn),revisionAuthor:s(this,xn).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Ce),page:s(this,Pe),content:e,reason:t},s(this,Xe))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Ce),page:s(this,Pe),...e},s(this,Xe))}async revertTo(e){return He.revertPage(s(this,Ce),s(this,Pe),e,s(this,Xe))}async getSettings(){return He.getPageSettings(s(this,Ce),s(this,Pe),s(this,Xe))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Ce),page:s(this,Pe),listed:e.listed,permLevel:e.permLevel},s(this,Xe))}async addEditor(e){return He.addEditor(s(this,Ce),s(this,Pe),e,s(this,Xe))}async removeEditor(e){return He.removeEditor(s(this,Ce),s(this,Pe),e,s(this,Xe))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return y(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 V({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 KR(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 y(o.data,"Failed to get wiki page settings"),new el(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 y(n.data,"Failed to update wiki page settings"),new el(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)}};Pe=new WeakMap,Ce=new WeakMap,kn=new WeakMap,Sn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,xn=new WeakMap,Xe=new WeakMap;var ke=He,In,Fn,Tn,An,En,Rn,Cm=class{constructor(e,t){l(this,In);l(this,Fn);l(this,Tn);l(this,An);l(this,En);l(this,Rn);d(this,In,e.id),d(this,Fn,e.page),d(this,Tn,new Date(e.timestamp)),y(e.author?.data,"Wiki page revision author details are missing"),d(this,An,new x(e.author.data,t)),d(this,En,e.reason??""),d(this,Rn,e.revisionHidden??!1)}get id(){return s(this,In)}get page(){return s(this,Fn)}get date(){return s(this,Tn)}get author(){return s(this,An)}get reason(){return s(this,En)}get hidden(){return s(this,Rn)}toJSON(){return{id:s(this,In),page:s(this,Fn),date:s(this,Tn),author:s(this,An).toJSON(),reason:s(this,En),hidden:s(this,Rn)}}};In=new WeakMap,Fn=new WeakMap,Tn=new WeakMap,An=new WeakMap,En=new WeakMap,Rn=new WeakMap;var On,Bn,Mn,el=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=>(y(i.data,"Wiki page editor details are missing"),new x(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 KR(r,e){return y(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Cm(i,e)),before:r.data.before,after:r.data.after}}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"],QR=["onload","onerror","onclick","onmouseover"];function YR(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 bS(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(`(${QR.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=YR(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 cq(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=bS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{kM as ALL_ICON_NAMES,Jv as AboutLocations,hS as AuthorFlairSettings,Wd as ButtonWidget,qd as CalendarWidget,te as Comment,Gd as CommunityListWidget,zd as CustomWidget,u as Devvit,Ue as Flair,ue as FlairTemplate,kR as FlairType,Ft as Hook,Hd as ImageWidget,V as Listing,jR as ModMailActionType,HR as ModMailConversationState,ed as ModMailService,Me as ModNote,z as Post,fS as PostFlairSettings,Vd as PostFlairWidget,hr as PrivateMessage,yt as RichTextBuilder,ec as SettingScope,DR as SocialLinkType,be as Subreddit,pS as SubredditDescription,Sm as SubredditRulesWidget,gS as SubredditWikiSettings,jd as TextAreaWidget,x as User,ae as Widget,ke as WikiPage,$R as WikiPagePermissionLevel,Cm as WikiPageRevision,el as WikiPageSettings,Ds as convertUserFlairProtoToAPI,Ya as getModerationLog,$v as getSubredditInfoById,Kv as getSubredditInfoByName,Xv as getSubredditLeaderboard,Zv as getSubredditStyles,Qv as getVaultByAddress,Yv as getVaultByUserId,cq as svg,oR as useAsync,Zc as useChannel,Jc as useForm,em as useInterval,nm as useState};
|