@devvit/public-api 0.11.0-next-2024-08-05-a2300b1b3.0 → 0.11.0-next-2024-08-06-81c6947e7.0

Sign up to get free protection for your applications and to get access to all the features.
package/public-api.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var SP=Object.create;var Um=Object.defineProperty;var CP=Object.getOwnPropertyDescriptor;var IP=Object.getOwnPropertyNames;var wP=Object.getPrototypeOf,xP=Object.prototype.hasOwnProperty;var Bm=r=>{throw TypeError(r)};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var AP=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of IP(e))!xP.call(r,n)&&n!==t&&Um(r,n,{get:()=>e[n],enumerable:!(i=CP(e,n))||i.enumerable});return r};var Nn=(r,e,t)=>(t=r!=null?SP(wP(r)):{},AP(e||!r||!r.__esModule?Um(t,"default",{value:r,enumerable:!0}):t,r));var gl=(r,e,t)=>e.has(r)||Bm("Cannot "+t);var s=(r,e,t)=>(gl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Bm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(gl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),P=(r,e,t)=>(gl(r,e,"access private method"),t);var ae=h((QO,Dm)=>{Dm.exports=function(r){try{return!!r()}catch{return!0}}});var Pa=h((eF,_m)=>{var TP=ae();_m.exports=!TP(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=h((tF,Hm)=>{var Nm=Pa(),qm=Function.prototype,hl=qm.call,EP=Nm&&qm.bind.bind(hl,hl);Hm.exports=Nm?EP:function(r){return function(){return hl.apply(r,arguments)}}});var Wm=h((rF,jm)=>{var RP=Math.ceil,OP=Math.floor;jm.exports=Math.trunc||function(e){var t=+e;return(t>0?OP:RP)(t)}});var Sa=h((iF,Gm)=>{var FP=Wm();Gm.exports=function(r){var e=+r;return e!==e||e===0?0:FP(e)}});var me=h((nF,Vm)=>{var Ca=function(r){return r&&r.Math==Math&&r};Vm.exports=Ca(typeof globalThis=="object"&&globalThis)||Ca(typeof window=="object"&&window)||Ca(typeof self=="object"&&self)||Ca(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=h((sF,zm)=>{zm.exports=!1});var Ia=h((oF,$m)=>{var Jm=me(),MP=Object.defineProperty;$m.exports=function(r,e){try{MP(Jm,r,{value:e,configurable:!0,writable:!0})}catch{Jm[r]=e}return e}});var wa=h((aF,Xm)=>{var LP=me(),UP=Ia(),Km="__core-js_shared__",BP=LP[Km]||UP(Km,{});Xm.exports=BP});var vl=h((dF,Ym)=>{var DP=Wr(),Zm=wa();(Ym.exports=function(r,e){return Zm[r]||(Zm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:DP?"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 xa=h((lF,Qm)=>{Qm.exports=function(r){return r==null}});var Aa=h((uF,ep)=>{var _P=xa(),NP=TypeError;ep.exports=function(r){if(_P(r))throw NP("Can't call method on "+r);return r}});var qn=h((cF,tp)=>{var qP=Aa(),HP=Object;tp.exports=function(r){return HP(qP(r))}});var Ie=h((mF,rp)=>{var jP=Z(),WP=qn(),GP=jP({}.hasOwnProperty);rp.exports=Object.hasOwn||function(e,t){return GP(WP(e),t)}});var yl=h((pF,ip)=>{var VP=Z(),zP=0,JP=Math.random(),$P=VP(1 .toString);ip.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+$P(++zP+JP,36)}});var sp=h((fF,np)=>{np.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var mp=h((gF,cp)=>{var up=me(),bl=sp(),op=up.process,ap=up.Deno,dp=op&&op.versions||ap&&ap.version,lp=dp&&dp.v8,We,Ta;lp&&(We=lp.split("."),Ta=We[0]>0&&We[0]<4?1:+(We[0]+We[1]));!Ta&&bl&&(We=bl.match(/Edge\/(\d+)/),(!We||We[1]>=74)&&(We=bl.match(/Chrome\/(\d+)/),We&&(Ta=+We[1])));cp.exports=Ta});var kl=h((hF,fp)=>{var pp=mp(),KP=ae();fp.exports=!!Object.getOwnPropertySymbols&&!KP(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&pp&&pp<41})});var Pl=h((vF,gp)=>{var XP=kl();gp.exports=XP&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var we=h((yF,vp)=>{var ZP=me(),YP=vl(),hp=Ie(),QP=yl(),eS=kl(),tS=Pl(),Gr=ZP.Symbol,Sl=YP("wks"),rS=tS?Gr.for||Gr:Gr&&Gr.withoutSetter||QP;vp.exports=function(r){return hp(Sl,r)||(Sl[r]=eS&&hp(Gr,r)?Gr[r]:rS("Symbol."+r)),Sl[r]}});var kp=h((bF,bp)=>{var iS=we(),nS=iS("toStringTag"),yp={};yp[nS]="z";bp.exports=String(yp)==="[object z]"});var Il=h((kF,Pp)=>{var Cl=typeof document=="object"&&document.all,sS=typeof Cl>"u"&&Cl!==void 0;Pp.exports={all:Cl,IS_HTMLDDA:sS}});var Y=h((PF,Cp)=>{var Sp=Il(),oS=Sp.all;Cp.exports=Sp.IS_HTMLDDA?function(r){return typeof r=="function"||r===oS}:function(r){return typeof r=="function"}});var Ea=h((SF,wp)=>{var Ip=Z(),aS=Ip({}.toString),dS=Ip("".slice);wp.exports=function(r){return dS(aS(r),8,-1)}});var Hn=h((CF,xp)=>{var lS=kp(),uS=Y(),Ra=Ea(),cS=we(),mS=cS("toStringTag"),pS=Object,fS=Ra(function(){return arguments}())=="Arguments",gS=function(r,e){try{return r[e]}catch{}};xp.exports=lS?Ra:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=gS(e=pS(r),mS))=="string"?t:fS?Ra(e):(i=Ra(e))=="Object"&&uS(e.callee)?"Arguments":i}});var jn=h((IF,Ap)=>{var hS=Hn(),vS=String;Ap.exports=function(r){if(hS(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return vS(r)}});var xl=h((wF,Rp)=>{var wl=Z(),yS=Sa(),bS=jn(),kS=Aa(),PS=wl("".charAt),Tp=wl("".charCodeAt),SS=wl("".slice),Ep=function(r){return function(e,t){var i=bS(kS(e)),n=yS(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Tp(i,n),a<55296||a>56319||n+1===o||(c=Tp(i,n+1))<56320||c>57343?r?PS(i,n):a:r?SS(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Rp.exports={codeAt:Ep(!1),charAt:Ep(!0)}});var Mp=h((xF,Fp)=>{var CS=me(),IS=Y(),Op=CS.WeakMap;Fp.exports=IS(Op)&&/native code/.test(String(Op))});var It=h((AF,Bp)=>{var Lp=Y(),Up=Il(),wS=Up.all;Bp.exports=Up.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Lp(r)||r===wS}:function(r){return typeof r=="object"?r!==null:Lp(r)}});var pe=h((TF,Dp)=>{var xS=ae();Dp.exports=!xS(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var Tl=h((EF,Np)=>{var AS=me(),_p=It(),Al=AS.document,TS=_p(Al)&&_p(Al.createElement);Np.exports=function(r){return TS?Al.createElement(r):{}}});var El=h((RF,qp)=>{var ES=pe(),RS=ae(),OS=Tl();qp.exports=!ES&&!RS(function(){return Object.defineProperty(OS("div"),"a",{get:function(){return 7}}).a!=7})});var Rl=h((OF,Hp)=>{var FS=pe(),MS=ae();Hp.exports=FS&&MS(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ye=h((FF,jp)=>{var LS=It(),US=String,BS=TypeError;jp.exports=function(r){if(LS(r))return r;throw BS(US(r)+" is not an object")}});var Ge=h((MF,Wp)=>{var DS=Pa(),Oa=Function.prototype.call;Wp.exports=DS?Oa.bind(Oa):function(){return Oa.apply(Oa,arguments)}});var Wn=h((LF,Gp)=>{var Ol=me(),_S=Y(),NS=function(r){return _S(r)?r:void 0};Gp.exports=function(r,e){return arguments.length<2?NS(Ol[r]):Ol[r]&&Ol[r][e]}});var Fl=h((UF,Vp)=>{var qS=Z();Vp.exports=qS({}.isPrototypeOf)});var Ml=h((BF,zp)=>{var HS=Wn(),jS=Y(),WS=Fl(),GS=Pl(),VS=Object;zp.exports=GS?function(r){return typeof r=="symbol"}:function(r){var e=HS("Symbol");return jS(e)&&WS(e.prototype,VS(r))}});var Ll=h((DF,Jp)=>{var zS=String;Jp.exports=function(r){try{return zS(r)}catch{return"Object"}}});var Fa=h((_F,$p)=>{var JS=Y(),$S=Ll(),KS=TypeError;$p.exports=function(r){if(JS(r))return r;throw KS($S(r)+" is not a function")}});var Ma=h((NF,Kp)=>{var XS=Fa(),ZS=xa();Kp.exports=function(r,e){var t=r[e];return ZS(t)?void 0:XS(t)}});var Zp=h((qF,Xp)=>{var Ul=Ge(),Bl=Y(),Dl=It(),YS=TypeError;Xp.exports=function(r,e){var t,i;if(e==="string"&&Bl(t=r.toString)&&!Dl(i=Ul(t,r))||Bl(t=r.valueOf)&&!Dl(i=Ul(t,r))||e!=="string"&&Bl(t=r.toString)&&!Dl(i=Ul(t,r)))return i;throw YS("Can't convert object to primitive value")}});var tf=h((HF,ef)=>{var QS=Ge(),Yp=It(),Qp=Ml(),eC=Ma(),tC=Zp(),rC=we(),iC=TypeError,nC=rC("toPrimitive");ef.exports=function(r,e){if(!Yp(r)||Qp(r))return r;var t=eC(r,nC),i;if(t){if(e===void 0&&(e="default"),i=QS(t,r,e),!Yp(i)||Qp(i))return i;throw iC("Can't convert object to primitive value")}return e===void 0&&(e="number"),tC(r,e)}});var La=h((jF,rf)=>{var sC=tf(),oC=Ml();rf.exports=function(r){var e=sC(r,"string");return oC(e)?e:e+""}});var Qe=h(sf=>{var aC=pe(),dC=El(),lC=Rl(),Ua=Ye(),nf=La(),uC=TypeError,_l=Object.defineProperty,cC=Object.getOwnPropertyDescriptor,Nl="enumerable",ql="configurable",Hl="writable";sf.f=aC?lC?function(e,t,i){if(Ua(e),t=nf(t),Ua(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Hl in i&&!i[Hl]){var n=cC(e,t);n&&n[Hl]&&(e[t]=i.value,i={configurable:ql in i?i[ql]:n[ql],enumerable:Nl in i?i[Nl]:n[Nl],writable:!1})}return _l(e,t,i)}:_l:function(e,t,i){if(Ua(e),t=nf(t),Ua(i),dC)try{return _l(e,t,i)}catch{}if("get"in i||"set"in i)throw uC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=h((GF,of)=>{of.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ba=h((VF,af)=>{var mC=pe(),pC=Qe(),fC=Vr();af.exports=mC?function(r,e,t){return pC.f(r,e,fC(1,t))}:function(r,e,t){return r[e]=t,r}});var Da=h((zF,lf)=>{var gC=vl(),hC=yl(),df=gC("keys");lf.exports=function(r){return df[r]||(df[r]=hC(r))}});var _a=h((JF,uf)=>{uf.exports={}});var zr=h(($F,pf)=>{var vC=Mp(),mf=me(),yC=It(),bC=Ba(),jl=Ie(),Wl=wa(),kC=Da(),PC=_a(),cf="Object already initialized",Gl=mf.TypeError,SC=mf.WeakMap,Na,Gn,qa,CC=function(r){return qa(r)?Gn(r):Na(r,{})},IC=function(r){return function(e){var t;if(!yC(e)||(t=Gn(e)).type!==r)throw Gl("Incompatible receiver, "+r+" required");return t}};vC||Wl.state?(Ve=Wl.state||(Wl.state=new SC),Ve.get=Ve.get,Ve.has=Ve.has,Ve.set=Ve.set,Na=function(r,e){if(Ve.has(r))throw Gl(cf);return e.facade=r,Ve.set(r,e),e},Gn=function(r){return Ve.get(r)||{}},qa=function(r){return Ve.has(r)}):(nr=kC("state"),PC[nr]=!0,Na=function(r,e){if(jl(r,nr))throw Gl(cf);return e.facade=r,bC(r,nr,e),e},Gn=function(r){return jl(r,nr)?r[nr]:{}},qa=function(r){return jl(r,nr)});var Ve,nr;pf.exports={set:Na,get:Gn,has:qa,enforce:CC,getterFor:IC}});var Vl=h(hf=>{"use strict";var ff={}.propertyIsEnumerable,gf=Object.getOwnPropertyDescriptor,wC=gf&&!ff.call({1:2},1);hf.f=wC?function(e){var t=gf(this,e);return!!t&&t.enumerable}:ff});var Jl=h((XF,vf)=>{var xC=Z(),AC=ae(),TC=Ea(),zl=Object,EC=xC("".split);vf.exports=AC(function(){return!zl("z").propertyIsEnumerable(0)})?function(r){return TC(r)=="String"?EC(r,""):zl(r)}:zl});var Jr=h((ZF,yf)=>{var RC=Jl(),OC=Aa();yf.exports=function(r){return RC(OC(r))}});var $l=h(kf=>{var FC=pe(),MC=Ge(),LC=Vl(),UC=Vr(),BC=Jr(),DC=La(),_C=Ie(),NC=El(),bf=Object.getOwnPropertyDescriptor;kf.f=FC?bf:function(e,t){if(e=BC(e),t=DC(t),NC)try{return bf(e,t)}catch{}if(_C(e,t))return UC(!MC(LC.f,e,t),e[t])}});var Zl=h((QF,Sf)=>{var Kl=pe(),qC=Ie(),Pf=Function.prototype,HC=Kl&&Object.getOwnPropertyDescriptor,Xl=qC(Pf,"name"),jC=Xl&&function(){}.name==="something",WC=Xl&&(!Kl||Kl&&HC(Pf,"name").configurable);Sf.exports={EXISTS:Xl,PROPER:jC,CONFIGURABLE:WC}});var Ql=h((eM,Cf)=>{var GC=Z(),VC=Y(),Yl=wa(),zC=GC(Function.toString);VC(Yl.inspectSource)||(Yl.inspectSource=function(r){return zC(r)});Cf.exports=Yl.inspectSource});var ru=h((tM,xf)=>{var tu=Z(),JC=ae(),$C=Y(),Ha=Ie(),eu=pe(),KC=Zl().CONFIGURABLE,XC=Ql(),wf=zr(),ZC=wf.enforce,YC=wf.get,If=String,ja=Object.defineProperty,QC=tu("".slice),eI=tu("".replace),tI=tu([].join),rI=eu&&!JC(function(){return ja(function(){},"length",{value:8}).length!==8}),iI=String(String).split("String"),nI=xf.exports=function(r,e,t){QC(If(e),0,7)==="Symbol("&&(e="["+eI(If(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ha(r,"name")||KC&&r.name!==e)&&(eu?ja(r,"name",{value:e,configurable:!0}):r.name=e),rI&&t&&Ha(t,"arity")&&r.length!==t.arity&&ja(r,"length",{value:t.arity});try{t&&Ha(t,"constructor")&&t.constructor?eu&&ja(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=ZC(r);return Ha(i,"source")||(i.source=tI(iI,typeof e=="string"?e:"")),r};Function.prototype.toString=nI(function(){return $C(this)&&YC(this).source||XC(this)},"toString")});var sr=h((rM,Af)=>{var sI=Y(),oI=Qe(),aI=ru(),dI=Ia();Af.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(sI(t)&&aI(t,o,i),i.global)n?r[e]=t:dI(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:oI.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var iu=h((iM,Tf)=>{var lI=Sa(),uI=Math.max,cI=Math.min;Tf.exports=function(r,e){var t=lI(r);return t<0?uI(t+e,0):cI(t,e)}});var Rf=h((nM,Ef)=>{var mI=Sa(),pI=Math.min;Ef.exports=function(r){return r>0?pI(mI(r),9007199254740991):0}});var Wa=h((sM,Of)=>{var fI=Rf();Of.exports=function(r){return fI(r.length)}});var Lf=h((oM,Mf)=>{var gI=Jr(),hI=iu(),vI=Wa(),Ff=function(r){return function(e,t,i){var n=gI(e),o=vI(n),a=hI(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}};Mf.exports={includes:Ff(!0),indexOf:Ff(!1)}});var su=h((aM,Bf)=>{var yI=Z(),nu=Ie(),bI=Jr(),kI=Lf().indexOf,PI=_a(),Uf=yI([].push);Bf.exports=function(r,e){var t=bI(r),i=0,n=[],o;for(o in t)!nu(PI,o)&&nu(t,o)&&Uf(n,o);for(;e.length>i;)nu(t,o=e[i++])&&(~kI(n,o)||Uf(n,o));return n}});var Ga=h((dM,Df)=>{Df.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Nf=h(_f=>{var SI=su(),CI=Ga(),II=CI.concat("length","prototype");_f.f=Object.getOwnPropertyNames||function(e){return SI(e,II)}});var ou=h(qf=>{qf.f=Object.getOwnPropertySymbols});var jf=h((cM,Hf)=>{var wI=Wn(),xI=Z(),AI=Nf(),TI=ou(),EI=Ye(),RI=xI([].concat);Hf.exports=wI("Reflect","ownKeys")||function(e){var t=AI.f(EI(e)),i=TI.f;return i?RI(t,i(e)):t}});var Vf=h((mM,Gf)=>{var Wf=Ie(),OI=jf(),FI=$l(),MI=Qe();Gf.exports=function(r,e,t){for(var i=OI(e),n=MI.f,o=FI.f,a=0;a<i.length;a++){var c=i[a];!Wf(r,c)&&!(t&&Wf(t,c))&&n(r,c,o(e,c))}}});var Jf=h((pM,zf)=>{var LI=ae(),UI=Y(),BI=/#|\.prototype\./,Vn=function(r,e){var t=_I[DI(r)];return t==qI?!0:t==NI?!1:UI(e)?LI(e):!!e},DI=Vn.normalize=function(r){return String(r).replace(BI,".").toLowerCase()},_I=Vn.data={},NI=Vn.NATIVE="N",qI=Vn.POLYFILL="P";zf.exports=Vn});var zn=h((fM,$f)=>{var au=me(),HI=$l().f,jI=Ba(),WI=sr(),GI=Ia(),VI=Vf(),zI=Jf();$f.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,f,v;if(i?a=au:n?a=au[t]||GI(t,{}):a=(au[t]||{}).prototype,a)for(c in e){if(f=e[c],r.dontCallGetSet?(v=HI(a,c),p=v&&v.value):p=a[c],o=zI(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof f==typeof p)continue;VI(f,p)}(r.sham||p&&p.sham)&&jI(f,"sham",!0),WI(a,c,f,r)}}});var du=h((gM,Kf)=>{var JI=su(),$I=Ga();Kf.exports=Object.keys||function(e){return JI(e,$I)}});var Zf=h(Xf=>{var KI=pe(),XI=Rl(),ZI=Qe(),YI=Ye(),QI=Jr(),ew=du();Xf.f=KI&&!XI?Object.defineProperties:function(e,t){YI(e);for(var i=QI(t),n=ew(t),o=n.length,a=0,c;o>a;)ZI.f(e,c=n[a++],i[c]);return e}});var Qf=h((vM,Yf)=>{var tw=Wn();Yf.exports=tw("document","documentElement")});var Jn=h((yM,og)=>{var rw=Ye(),iw=Zf(),eg=Ga(),nw=_a(),sw=Qf(),ow=Tl(),aw=Da(),tg=">",rg="<",uu="prototype",cu="script",ng=aw("IE_PROTO"),lu=function(){},sg=function(r){return rg+cu+tg+r+rg+"/"+cu+tg},ig=function(r){r.write(sg("")),r.close();var e=r.parentWindow.Object;return r=null,e},dw=function(){var r=ow("iframe"),e="java"+cu+":",t;return r.style.display="none",sw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(sg("document.F=Object")),t.close(),t.F},Va,za=function(){try{Va=new ActiveXObject("htmlfile")}catch{}za=typeof document<"u"?document.domain&&Va?ig(Va):dw():ig(Va);for(var r=eg.length;r--;)delete za[uu][eg[r]];return za()};nw[ng]=!0;og.exports=Object.create||function(e,t){var i;return e!==null?(lu[uu]=rw(e),i=new lu,lu[uu]=null,i[ng]=e):i=za(),t===void 0?i:iw.f(i,t)}});var dg=h((bM,ag)=>{var lw=ae();ag.exports=!lw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var pu=h((kM,ug)=>{var uw=Ie(),cw=Y(),mw=qn(),pw=Da(),fw=dg(),lg=pw("IE_PROTO"),mu=Object,gw=mu.prototype;ug.exports=fw?mu.getPrototypeOf:function(r){var e=mw(r);if(uw(e,lg))return e[lg];var t=e.constructor;return cw(t)&&e instanceof t?t.prototype:e instanceof mu?gw:null}});var vu=h((PM,pg)=>{"use strict";var hw=ae(),vw=Y(),yw=It(),bw=Jn(),cg=pu(),kw=sr(),Pw=we(),Sw=Wr(),hu=Pw("iterator"),mg=!1,lt,fu,gu;[].keys&&(gu=[].keys(),"next"in gu?(fu=cg(cg(gu)),fu!==Object.prototype&&(lt=fu)):mg=!0);var Cw=!yw(lt)||hw(function(){var r={};return lt[hu].call(r)!==r});Cw?lt={}:Sw&&(lt=bw(lt));vw(lt[hu])||kw(lt,hu,function(){return this});pg.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:mg}});var $n=h((SM,gg)=>{var Iw=Qe().f,ww=Ie(),xw=we(),fg=xw("toStringTag");gg.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!ww(r,fg)&&Iw(r,fg,{configurable:!0,value:e})}});var $r=h((CM,hg)=>{hg.exports={}});var yu=h((IM,vg)=>{"use strict";var Aw=vu().IteratorPrototype,Tw=Jn(),Ew=Vr(),Rw=$n(),Ow=$r(),Fw=function(){return this};vg.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Tw(Aw,{next:Ew(+!i,t)}),Rw(r,n,!1,!0),Ow[n]=Fw,r}});var bg=h((wM,yg)=>{var Mw=Y(),Lw=String,Uw=TypeError;yg.exports=function(r){if(typeof r=="object"||Mw(r))return r;throw Uw("Can't set "+Lw(r)+" as a prototype")}});var Pg=h((xM,kg)=>{var Bw=Z(),Dw=Ye(),_w=bg();kg.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Bw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Dw(n),_w(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var ku=h((AM,Og)=>{"use strict";var Nw=zn(),qw=Ge(),Ja=Wr(),Eg=Zl(),Hw=Y(),jw=yu(),Sg=pu(),Cg=Pg(),Ww=$n(),Gw=Ba(),bu=sr(),Vw=we(),Ig=$r(),Rg=vu(),zw=Eg.PROPER,Jw=Eg.CONFIGURABLE,wg=Rg.IteratorPrototype,$a=Rg.BUGGY_SAFARI_ITERATORS,Kn=Vw("iterator"),xg="keys",Xn="values",Ag="entries",Tg=function(){return this};Og.exports=function(r,e,t,i,n,o,a){jw(t,e,i);var c=function(M){if(M===n&&b)return b;if(!$a&&M in v)return v[M];switch(M){case xg:return function(){return new t(this,M)};case Xn:return function(){return new t(this,M)};case Ag:return function(){return new t(this,M)}}return function(){return new t(this)}},p=e+" Iterator",f=!1,v=r.prototype,m=v[Kn]||v["@@iterator"]||n&&v[n],b=!$a&&m||c(n),y=e=="Array"&&v.entries||m,C,I,A;if(y&&(C=Sg(y.call(new r)),C!==Object.prototype&&C.next&&(!Ja&&Sg(C)!==wg&&(Cg?Cg(C,wg):Hw(C[Kn])||bu(C,Kn,Tg)),Ww(C,p,!0,!0),Ja&&(Ig[p]=Tg))),zw&&n==Xn&&m&&m.name!==Xn&&(!Ja&&Jw?Gw(v,"name",Xn):(f=!0,b=function(){return qw(m,this)})),n)if(I={values:c(Xn),keys:o?b:c(xg),entries:c(Ag)},a)for(A in I)($a||f||!(A in v))&&bu(v,A,I[A]);else Nw({target:e,proto:!0,forced:$a||f},I);return(!Ja||a)&&v[Kn]!==b&&bu(v,Kn,b,{name:n}),Ig[e]=b,I}});var Pu=h((TM,Fg)=>{Fg.exports=function(r,e){return{value:r,done:e}}});var Bg=h(()=>{"use strict";var $w=xl().charAt,Kw=jn(),Lg=zr(),Xw=ku(),Mg=Pu(),Ug="String Iterator",Zw=Lg.set,Yw=Lg.getterFor(Ug);Xw(String,"String",function(r){Zw(this,{type:Ug,string:Kw(r),index:0})},function(){var e=Yw(this),t=e.string,i=e.index,n;return i>=t.length?Mg(void 0,!0):(n=$w(t,i),e.index+=n.length,Mg(n,!1))})});var Su=h((OM,Dg)=>{var Qw=ae(),ex=we(),tx=Wr(),rx=ex("iterator");Dg.exports=!Qw(function(){var r=new URL("b?a=1&b=2&c=3","http://a"),e=r.searchParams,t="";return r.pathname="c%20d",e.forEach(function(i,n){e.delete("b"),t+=n+i}),tx&&!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[rx]||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 Ng=h((FM,_g)=>{var ix=Ea(),nx=Z();_g.exports=function(r){if(ix(r)==="Function")return nx(r)}});var Ka=h((MM,Hg)=>{var qg=Ng(),sx=Fa(),ox=Pa(),ax=qg(qg.bind);Hg.exports=function(r,e){return sx(r),e===void 0?r:ox?ax(r,e):function(){return r.apply(e,arguments)}}});var Gg=h((LM,Wg)=>{var jg=ru(),dx=Qe();Wg.exports=function(r,e,t){return t.get&&jg(t.get,e,{getter:!0}),t.set&&jg(t.set,e,{setter:!0}),dx.f(r,e,t)}});var Cu=h((UM,Vg)=>{var lx=Fl(),ux=TypeError;Vg.exports=function(r,e){if(lx(e,r))return r;throw ux("Incorrect invocation")}});var Kg=h((BM,$g)=>{"use strict";var zg=pe(),cx=Z(),mx=Ge(),px=ae(),Iu=du(),fx=ou(),gx=Vl(),hx=qn(),vx=Jl(),Kr=Object.assign,Jg=Object.defineProperty,yx=cx([].concat);$g.exports=!Kr||px(function(){if(zg&&Kr({b:1},Kr(Jg({},"a",{enumerable:!0,get:function(){Jg(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||Iu(Kr({},e)).join("")!=i})?function(e,t){for(var i=hx(e),n=arguments.length,o=1,a=fx.f,c=gx.f;n>o;)for(var p=vx(arguments[o++]),f=a?yx(Iu(p),a(p)):Iu(p),v=f.length,m=0,b;v>m;)b=f[m++],(!zg||mx(c,p,b))&&(i[b]=p[b]);return i}:Kr});var Yg=h((DM,Zg)=>{var bx=Ge(),Xg=Ye(),kx=Ma();Zg.exports=function(r,e,t){var i,n;Xg(r);try{if(i=kx(r,"return"),!i){if(e==="throw")throw t;return t}i=bx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Xg(i),t}});var eh=h((_M,Qg)=>{var Px=Ye(),Sx=Yg();Qg.exports=function(r,e,t,i){try{return i?e(Px(t)[0],t[1]):e(t)}catch(n){Sx(r,"throw",n)}}});var rh=h((NM,th)=>{var Cx=we(),Ix=$r(),wx=Cx("iterator"),xx=Array.prototype;th.exports=function(r){return r!==void 0&&(Ix.Array===r||xx[wx]===r)}});var dh=h((qM,ah)=>{var Ax=Z(),Tx=ae(),ih=Y(),Ex=Hn(),Rx=Wn(),Ox=Ql(),nh=function(){},Fx=[],sh=Rx("Reflect","construct"),wu=/^\s*(?:class|function)\b/,Mx=Ax(wu.exec),Lx=!wu.exec(nh),Zn=function(e){if(!ih(e))return!1;try{return sh(nh,Fx,e),!0}catch{return!1}},oh=function(e){if(!ih(e))return!1;switch(Ex(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Lx||!!Mx(wu,Ox(e))}catch{return!0}};oh.sham=!0;ah.exports=!sh||Tx(function(){var r;return Zn(Zn.call)||!Zn(Object)||!Zn(function(){r=!0})||r})?oh:Zn});var xu=h((HM,lh)=>{"use strict";var Ux=La(),Bx=Qe(),Dx=Vr();lh.exports=function(r,e,t){var i=Ux(e);i in r?Bx.f(r,i,Dx(0,t)):r[i]=t}});var Xa=h((jM,ch)=>{var _x=Hn(),uh=Ma(),Nx=xa(),qx=$r(),Hx=we(),jx=Hx("iterator");ch.exports=function(r){if(!Nx(r))return uh(r,jx)||uh(r,"@@iterator")||qx[_x(r)]}});var Au=h((WM,mh)=>{var Wx=Ge(),Gx=Fa(),Vx=Ye(),zx=Ll(),Jx=Xa(),$x=TypeError;mh.exports=function(r,e){var t=arguments.length<2?Jx(r):e;if(Gx(t))return Vx(Wx(t,r));throw $x(zx(r)+" is not iterable")}});var hh=h((GM,gh)=>{"use strict";var Kx=Ka(),Xx=Ge(),Zx=qn(),Yx=eh(),Qx=rh(),eA=dh(),tA=Wa(),ph=xu(),rA=Au(),iA=Xa(),fh=Array;gh.exports=function(e){var t=Zx(e),i=eA(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=Kx(o,n>2?arguments[2]:void 0));var c=iA(t),p=0,f,v,m,b,y,C;if(c&&!(this===fh&&Qx(c)))for(b=rA(t,c),y=b.next,v=i?new this:[];!(m=Xx(y,b)).done;p++)C=a?Yx(b,o,[m.value,p],!0):m.value,ph(v,p,C);else for(f=tA(t),v=i?new this(f):fh(f);f>p;p++)C=a?o(t[p],p):t[p],ph(v,p,C);return v.length=p,v}});var Tu=h((VM,yh)=>{var vh=iu(),nA=Wa(),sA=xu(),oA=Array,aA=Math.max;yh.exports=function(r,e,t){for(var i=nA(r),n=vh(e,i),o=vh(t===void 0?i:t,i),a=oA(aA(o-n,0)),c=0;n<o;n++,c++)sA(a,c,r[n]);return a.length=c,a}});var Ah=h((zM,xh)=>{var or=Z(),Eu=2147483647,Yn=36,Ch=1,Fu=26,dA=38,lA=700,uA=72,cA=128,mA="-",pA=/[^\0-\u007E]/,Ih=/[.\u3002\uFF0E\uFF61]/g,bh="Overflow: input needs wider integers to process",Ru=Yn-Ch,kh=RangeError,fA=or(Ih.exec),Xr=Math.floor,Ou=String.fromCharCode,Ph=or("".charCodeAt),wh=or([].join),wt=or([].push),gA=or("".replace),hA=or("".split),vA=or("".toLowerCase),yA=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=Ph(r,t++);if(n>=55296&&n<=56319&&t<i){var o=Ph(r,t++);(o&64512)==56320?wt(e,((n&1023)<<10)+(o&1023)+65536):(wt(e,n),t--)}else wt(e,n)}return e},Sh=function(r){return r+22+75*(r<26)},bA=function(r,e,t){var i=0;for(r=t?Xr(r/lA):r>>1,r+=Xr(r/e);r>Ru*Fu>>1;)r=Xr(r/Ru),i+=Yn;return Xr(i+(Ru+1)*r/(r+dA))},kA=function(r){var e=[];r=yA(r);var t=r.length,i=cA,n=0,o=uA,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&wt(e,Ou(c));var p=e.length,f=p;for(p&&wt(e,mA);f<t;){var v=Eu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=f+1;if(v-i>Xr((Eu-n)/m))throw kh(bh);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Eu)throw kh(bh);if(c==i){for(var b=n,y=Yn;;){var C=y<=o?Ch:y>=o+Fu?Fu:y-o;if(b<C)break;var I=b-C,A=Yn-C;wt(e,Ou(Sh(C+I%A))),b=Xr(I/A),y+=Yn}wt(e,Ou(Sh(b))),o=bA(n,m,f==p),n=0,f++}}n++,i++}return wh(e,"")};xh.exports=function(r){var e=[],t=hA(gA(vA(r),Ih,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],wt(e,fA(pA,n)?"xn--"+kA(n):n);return wh(e,".")}});var Mu=h((JM,Th)=>{var PA=TypeError;Th.exports=function(r,e){if(r<e)throw PA("Not enough arguments");return r}});var Rh=h(($M,Eh)=>{var SA=we(),CA=Jn(),IA=Qe().f,Lu=SA("unscopables"),Uu=Array.prototype;Uu[Lu]==null&&IA(Uu,Lu,{configurable:!0,value:CA(null)});Eh.exports=function(r){Uu[Lu][r]=!0}});var Bh=h((KM,Uh)=>{"use strict";var wA=Jr(),Bu=Rh(),Oh=$r(),Mh=zr(),xA=Qe().f,AA=ku(),Za=Pu(),TA=Wr(),EA=pe(),Lh="Array Iterator",RA=Mh.set,OA=Mh.getterFor(Lh);Uh.exports=AA(Array,"Array",function(r,e){RA(this,{type:Lh,target:wA(r),index:0,kind:e})},function(){var r=OA(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Za(void 0,!0)):t=="keys"?Za(i,!1):t=="values"?Za(e[i],!1):Za([i,e[i]],!1)},"values");var Fh=Oh.Arguments=Oh.Array;Bu("keys");Bu("values");Bu("entries");if(!TA&&EA&&Fh.name!=="values")try{xA(Fh,"name",{value:"values"})}catch{}});var _h=h((XM,Dh)=>{var FA=sr();Dh.exports=function(r,e,t){for(var i in e)FA(r,i,e[i],t);return r}});var Hh=h((ZM,qh)=>{var Nh=Tu(),MA=Math.floor,Du=function(r,e){var t=r.length,i=MA(t/2);return t<8?LA(r,e):UA(r,Du(Nh(r,0,i),e),Du(Nh(r,i),e),e)},LA=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},UA=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};qh.exports=Du});var Ju=h((YM,av)=>{"use strict";Bh();var ju=zn(),Yr=me(),Ya=Ge(),et=Z(),BA=pe(),Qh=Su(),ev=sr(),DA=_h(),_A=$n(),NA=yu(),Vu=zr(),tv=Cu(),_u=Y(),qA=Ie(),HA=Ka(),jA=Hn(),WA=Ye(),rv=It(),fe=jn(),GA=Jn(),jh=Vr(),Wu=Au(),VA=Xa(),Zr=Mu(),zA=we(),JA=Hh(),$A=zA("iterator"),ts="URLSearchParams",iv=ts+"Iterator",nv=Vu.set,ze=Vu.getterFor(ts),KA=Vu.getterFor(iv),XA=Object.getOwnPropertyDescriptor,zu=function(r){if(!BA)return Yr[r];var e=XA(Yr,r);return e&&e.value},Wh=zu("fetch"),ed=zu("Request"),Qn=zu("Headers"),Nu=ed&&ed.prototype,Gh=Qn&&Qn.prototype,ZA=Yr.RegExp,YA=Yr.TypeError,sv=Yr.decodeURIComponent,QA=Yr.encodeURIComponent,eT=et("".charAt),Vh=et([].join),ar=et([].push),Gu=et("".replace),tT=et([].shift),zh=et([].splice),Jh=et("".split),rT=et("".slice),iT=/\+/g,$h=Array(4),nT=function(r){return $h[r-1]||($h[r-1]=ZA("((?:%[\\da-f]{2}){"+r+"})","gi"))},sT=function(r){try{return sv(r)}catch{return r}},Kh=function(r){var e=Gu(r,iT," "),t=4;try{return sv(e)}catch{for(;t;)e=Gu(e,nT(t--),sT);return e}},oT=/[!'()~]|%20/g,aT={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},dT=function(r){return aT[r]},Xh=function(r){return Gu(QA(r),oT,dT)},qu=NA(function(e,t){nv(this,{type:iv,iterator:Wu(ze(e).entries),kind:t})},"Iterator",function(){var e=KA(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),ov=function(r){this.entries=[],this.url=null,r!==void 0&&(rv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?eT(r,0)==="?"?rT(r,1):r:fe(r)))};ov.prototype={type:ts,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=VA(r),t,i,n,o,a,c,p;if(e)for(t=Wu(r,e),i=t.next;!(n=Ya(i,t)).done;){if(o=Wu(WA(n.value)),a=o.next,(c=Ya(a,o)).done||(p=Ya(a,o)).done||!Ya(a,o).done)throw YA("Expected sequence with length 2");ar(this.entries,{key:fe(c.value),value:fe(p.value)})}else for(var f in r)qA(r,f)&&ar(this.entries,{key:f,value:fe(r[f])})},parseQuery:function(r){if(r)for(var e=Jh(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Jh(i,"="),ar(this.entries,{key:Kh(tT(n)),value:Kh(Vh(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],ar(e,Xh(i.key)+"="+Xh(i.value));return Vh(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var td=function(){tv(this,es);var e=arguments.length>0?arguments[0]:void 0;nv(this,new ov(e))},es=td.prototype;DA(es,{append:function(e,t){Zr(arguments.length,2);var i=ze(this);ar(i.entries,{key:fe(e),value:fe(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=ze(this),t=e.entries,i=fe(r),n=0;n<t.length;)t[n].key===i?zh(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=ze(this).entries,i=fe(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Zr(arguments.length,1);for(var t=ze(this).entries,i=fe(e),n=[],o=0;o<t.length;o++)t[o].key===i&&ar(n,t[o].value);return n},has:function(e){Zr(arguments.length,1);for(var t=ze(this).entries,i=fe(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Zr(arguments.length,1);for(var i=ze(this),n=i.entries,o=!1,a=fe(e),c=fe(t),p=0,f;p<n.length;p++)f=n[p],f.key===a&&(o?zh(n,p--,1):(o=!0,f.value=c));o||ar(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=ze(this);JA(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=ze(this).entries,i=HA(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 qu(this,"keys")},values:function(){return new qu(this,"values")},entries:function(){return new qu(this,"entries")}},{enumerable:!0});ev(es,$A,es.entries,{name:"entries"});ev(es,"toString",function(){return ze(this).serialize()},{enumerable:!0});_A(td,ts);ju({global:!0,constructor:!0,forced:!Qh},{URLSearchParams:td});!Qh&&_u(Qn)&&(Zh=et(Gh.has),Yh=et(Gh.set),Hu=function(r){if(rv(r)){var e=r.body,t;if(jA(e)===ts)return t=r.headers?new Qn(r.headers):new Qn,Zh(t,"content-type")||Yh(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),GA(r,{body:jh(0,fe(e)),headers:jh(0,t)})}return r},_u(Wh)&&ju({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Wh(e,arguments.length>1?Hu(arguments[1]):{})}}),_u(ed)&&(Qa=function(e){return tv(this,Nu),new ed(e,arguments.length>1?Hu(arguments[1]):{})},Nu.constructor=Qa,Qa.prototype=Nu,ju({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Qa})));var Zh,Yh,Hu,Qa;av.exports={URLSearchParams:td,getState:ze}});var xv=h(()=>{"use strict";Bg();var lT=zn(),lc=pe(),uT=Su(),uc=me(),dv=Ka(),Re=Z(),od=sr(),xe=Gg(),cT=Cu(),oc=Ie(),cc=Kg(),Qr=hh(),Je=Tu(),mT=xl().codeAt,pT=Ah(),ct=jn(),fT=$n(),gT=Mu(),kv=Ju(),Pv=zr(),hT=Pv.set,ad=Pv.getterFor("URL"),vT=kv.URLSearchParams,yT=kv.getState,rs=uc.URL,ac=uc.TypeError,dd=uc.parseInt,bT=Math.floor,lv=Math.pow,Ee=Re("".charAt),$e=Re(/./.exec),ns=Re([].join),kT=Re(1 .toString),PT=Re([].pop),ti=Re([].push),uv=Re("".replace),ST=Re([].shift),CT=Re("".split),os=Re("".slice),ld=Re("".toLowerCase),IT=Re([].unshift),wT="Invalid authority",$u="Invalid scheme",dr="Invalid host",cv="Invalid port",Sv=/[a-z]/i,xT=/[\d+-.a-z]/i,dc=/\d/,AT=/^0x/i,TT=/^[0-7]+$/,ET=/^\d+$/,Cv=/^[\da-f]+$/i,RT=/[\0\t\n\r #%/:<>?@[\\\]^|]/,OT=/[\0\t\n\r #/:<>?@[\\\]^|]/,FT=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,MT=/[\t\n\r]/g,Ae,LT=function(r){var e=CT(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&&Ee(o,0)=="0"&&(a=$e(AT,o)?16:8,o=os(o,a==8?1:2)),o==="")c=0;else{if(!$e(a==10?ET:a==8?TT:Cv,o))return r;c=dd(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=lv(256,5-t))return null}else if(c>255)return null;for(p=PT(i),n=0;n<i.length;n++)p+=i[n]*lv(256,3-n);return p},UT=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,f,v,m,b=function(){return Ee(r,n)};if(b()==":"){if(Ee(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&$e(Cv,b());)o=o*16+dd(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!$e(dc,b()))return;for(;$e(dc,b());){if(f=dd(b(),10),p===null)p=f;else{if(p==0)return;p=p*10+f}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(v=t-i,t=7;t!=0&&v>0;)m=e[t],e[t--]=e[i+v-1],e[i+--v]=m;else if(t!=8)return;return e},BT=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},is=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)IT(e,r%256),r=bT(r/256);return ns(e,".")}else if(typeof r=="object"){for(e="",i=BT(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=kT(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},sd={},Iv=cc({},sd,{" ":1,'"':1,"<":1,">":1,"`":1}),wv=cc({},Iv,{"#":1,"?":1,"{":1,"}":1}),Ku=cc({},wv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=mT(r,0);return t>32&&t<127&&!oc(e,r)?r:encodeURIComponent(r)},rd={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ss=function(r,e){var t;return r.length==2&&$e(Sv,Ee(r,0))&&((t=Ee(r,1))==":"||!e&&t=="|")},mv=function(r){var e;return r.length>1&&ss(os(r,0,2))&&(r.length==2||(e=Ee(r,2))==="/"||e==="\\"||e==="?"||e==="#")},DT=function(r){return r==="."||ld(r)==="%2e"},_T=function(r){return r=ld(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Xu={},pv={},Zu={},fv={},gv={},Yu={},hv={},vv={},id={},nd={},Qu={},ec={},tc={},rc={},yv={},ic={},ei={},tt={},bv={},lr={},ut={},mc=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw ac(o);this.searchParams=null}else{if(t!==void 0&&(n=new mc(t,!0)),o=this.parse(i,null,n),o)throw ac(o);a=yT(new vT),a.bindURL(this),this.searchParams=a}};mc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Xu,o=0,a="",c=!1,p=!1,f=!1,v,m,b,y;for(r=ct(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=uv(r,FT,"")),r=uv(r,MT,""),v=Qr(r);o<=v.length;){switch(m=v[o],n){case Xu:if(m&&$e(Sv,m))a+=ld(m),n=pv;else{if(e)return $u;n=Zu;continue}break;case pv:if(m&&($e(xT,m)||m=="+"||m=="-"||m=="."))a+=ld(m);else if(m==":"){if(e&&(i.isSpecial()!=oc(rd,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&rd[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=rc:i.isSpecial()&&t&&t.scheme==i.scheme?n=fv:i.isSpecial()?n=vv:v[o+1]=="/"?(n=gv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=bv)}else{if(e)return $u;a="",n=Zu,o=0;continue}break;case Zu:if(!t||t.cannotBeABaseURL&&m!="#")return $u;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Je(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?rc:Yu;continue;case fv:if(m=="/"&&v[o+1]=="/")n=id,o++;else{n=Yu;continue}break;case gv:if(m=="/"){n=nd;break}else{n=tt;continue}case Yu:if(i.scheme=t.scheme,m==Ae)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=hv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query="",n=lr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.path.length--,n=tt;continue}break;case hv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=id;else if(m=="/")n=nd;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=tt;continue}break;case vv:if(n=id,m!="/"||Ee(a,o+1)!="/")continue;o++;break;case id:if(m!="/"&&m!="\\"){n=nd;continue}break;case nd:if(m=="@"){c&&(a="%40"+a),c=!0,b=Qr(a);for(var C=0;C<b.length;C++){var I=b[C];if(I==":"&&!f){f=!0;continue}var A=xt(I,Ku);f?i.password+=A:i.username+=A}a=""}else if(m==Ae||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return wT;o-=Qr(a).length+1,a="",n=Qu}else a+=m;break;case Qu:case ec:if(e&&i.scheme=="file"){n=ic;continue}else if(m==":"&&!p){if(a=="")return dr;if(y=i.parseHost(a),y)return y;if(a="",n=tc,e==ec)return}else if(m==Ae||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return dr;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=ei,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case tc:if($e(dc,m))a+=m;else if(m==Ae||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var M=dd(a,10);if(M>65535)return cv;i.port=i.isSpecial()&&M===rd[i.scheme]?null:M,a=""}if(e)return;n=ei;continue}else return cv;break;case rc:if(i.scheme="file",m=="/"||m=="\\")n=yv;else if(t&&t.scheme=="file")if(m==Ae)i.host=t.host,i.path=Je(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Je(t.path),i.query="",n=lr;else if(m=="#")i.host=t.host,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ut;else{mv(ns(Je(v,o),""))||(i.host=t.host,i.path=Je(t.path),i.shortenPath()),n=tt;continue}else{n=tt;continue}break;case yv:if(m=="/"||m=="\\"){n=ic;break}t&&t.scheme=="file"&&!mv(ns(Je(v,o),""))&&(ss(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=tt;continue;case ic:if(m==Ae||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&ss(a))n=tt;else if(a==""){if(i.host="",e)return;n=ei}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ei}continue}else a+=m;break;case ei:if(i.isSpecial()){if(n=tt,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=lr;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=Ae&&(n=tt,m!="/"))continue;break;case tt:if(m==Ae||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(_T(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):DT(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&ss(a)&&(i.host&&(i.host=""),a=Ee(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==Ae||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)ST(i.path);m=="?"?(i.query="",n=lr):m=="#"&&(i.fragment="",n=ut)}else a+=xt(m,wv);break;case bv:m=="?"?(i.query="",n=lr):m=="#"?(i.fragment="",n=ut):m!=Ae&&(i.path[0]+=xt(m,sd));break;case lr:!e&&m=="#"?(i.fragment="",n=ut):m!=Ae&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,sd));break;case ut:m!=Ae&&(i.fragment+=xt(m,Iv));break}o++}},parseHost:function(r){var e,t,i;if(Ee(r,0)=="["){if(Ee(r,r.length-1)!="]"||(e=UT(os(r,1,-1)),!e))return dr;this.host=e}else if(this.isSpecial()){if(r=pT(r),$e(RT,r)||(e=LT(r),e===null))return dr;this.host=e}else{if($e(OT,r))return dr;for(e="",t=Qr(r),i=0;i<t.length;i++)e+=xt(t[i],sd);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return oc(rd,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!ss(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,f=e+":";return n!==null?(f+="//",r.includesCredentials()&&(f+=t+(i?":"+i:"")+"@"),f+=is(n),o!==null&&(f+=":"+o)):e=="file"&&(f+="//"),f+=r.cannotBeABaseURL?a[0]:a.length?"/"+ns(a,"/"):"",c!==null&&(f+="?"+c),p!==null&&(f+="#"+p),f},setHref:function(r){var e=this.parse(r);if(e)throw ac(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ri(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+is(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",Xu)},getUsername:function(){return this.username},setUsername:function(r){var e=Qr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],Ku)}},getPassword:function(){return this.password},setPassword:function(r){var e=Qr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],Ku)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?is(r):is(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Qu)},getHostname:function(){var r=this.host;return r===null?"":is(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,ec)},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,tc))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ns(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ei))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ee(r,0)=="?"&&(r=os(r,1)),this.query="",this.parse(r,lr)),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}Ee(r,0)=="#"&&(r=os(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=cT(this,re),i=gT(arguments.length,1)>1?arguments[1]:void 0,n=hT(t,new mc(e,!1,i));lc||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},re=ri.prototype,Te=function(r,e){return{get:function(){return ad(this)[r]()},set:e&&function(t){return ad(this)[e](t)},configurable:!0,enumerable:!0}};lc&&(xe(re,"href",Te("serialize","setHref")),xe(re,"origin",Te("getOrigin")),xe(re,"protocol",Te("getProtocol","setProtocol")),xe(re,"username",Te("getUsername","setUsername")),xe(re,"password",Te("getPassword","setPassword")),xe(re,"host",Te("getHost","setHost")),xe(re,"hostname",Te("getHostname","setHostname")),xe(re,"port",Te("getPort","setPort")),xe(re,"pathname",Te("getPathname","setPathname")),xe(re,"search",Te("getSearch","setSearch")),xe(re,"searchParams",Te("getSearchParams")),xe(re,"hash",Te("getHash","setHash")));od(re,"toJSON",function(){return ad(this).serialize()},{enumerable:!0});od(re,"toString",function(){return ad(this).serialize()},{enumerable:!0});rs&&(nc=rs.createObjectURL,sc=rs.revokeObjectURL,nc&&od(ri,"createObjectURL",dv(nc,rs)),sc&&od(ri,"revokeObjectURL",dv(sc,rs)));var nc,sc;fT(ri,"URL");lT({global:!0,constructor:!0,forced:!uT,sham:!lc},{URL:ri})});var Av=h(()=>{xv()});var Tv=h(()=>{"use strict";var NT=zn(),qT=Ge();NT({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return qT(URL.prototype.toString,this)}})});var Ev=h(()=>{Ju()});var Ov=h((aL,Rv)=>{var HT=me();Rv.exports=HT});var Mv=h((dL,Fv)=>{Av();Tv();Ev();var jT=Ov();Fv.exports=jT.URL});var qc=h((FD,jy)=>{var tE=Object.prototype.toString;jy.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 oE(e)?"generatorfunction":"function";if(rE(e))return"array";if(lE(e))return"buffer";if(dE(e))return"arguments";if(nE(e))return"date";if(iE(e))return"error";if(sE(e))return"regexp";switch(Hy(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(aE(e))return"generator";switch(t=tE.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 Hy(r){return typeof r.constructor=="function"?r.constructor.name:null}function rE(r){return Array.isArray?Array.isArray(r):r instanceof Array}function iE(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function nE(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function sE(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function oE(r,e){return Hy(r)==="GeneratorFunction"}function aE(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function dE(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 lE(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var Vy=h((MD,Gy)=>{"use strict";var Wy=Symbol.prototype.valueOf,uE=qc();function cE(r,e){switch(uE(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 gE(r);case"symbol":return hE(r);case"arraybuffer":return pE(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return fE(r);case"regexp":return mE(r);case"error":return Object.create(r);default:return r}}function mE(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 pE(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function fE(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function gE(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function hE(r){return Wy?Object(Wy.call(r)):{}}Gy.exports=cE});var Jy=h((LD,zy)=>{"use strict";zy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Xy=h((UD,Ky)=>{"use strict";var vE=Jy();function $y(r){return vE(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Ky.exports=function(e){var t,i;return!($y(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,$y(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Yy=h((BD,Zy)=>{"use strict";var yE=Vy(),bE=qc(),kE=Xy();function Hc(r,e){switch(bE(r)){case"object":return PE(r,e);case"array":return SE(r,e);default:return yE(r)}}function PE(r,e){if(typeof e=="function")return e(r);if(e||kE(r)){let t=new r.constructor;for(let i in r)t[i]=Hc(r[i],e);return t}return r}function SE(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Hc(r[i],e);return t}Zy.exports=Hc});var Qc=h((ys,Ti)=>{var CE=200,Yc="__lodash_hash_undefined__",Fd=1,ub=2,cb=9007199254740991,wd="[object Arguments]",Vc="[object Array]",IE="[object AsyncFunction]",mb="[object Boolean]",pb="[object Date]",fb="[object Error]",gb="[object Function]",wE="[object GeneratorFunction]",xd="[object Map]",hb="[object Number]",xE="[object Null]",Ai="[object Object]",Qy="[object Promise]",AE="[object Proxy]",vb="[object RegExp]",Ad="[object Set]",yb="[object String]",TE="[object Symbol]",EE="[object Undefined]",zc="[object WeakMap]",bb="[object ArrayBuffer]",Td="[object DataView]",RE="[object Float32Array]",OE="[object Float64Array]",FE="[object Int8Array]",ME="[object Int16Array]",LE="[object Int32Array]",UE="[object Uint8Array]",BE="[object Uint8ClampedArray]",DE="[object Uint16Array]",_E="[object Uint32Array]",NE=/[\\^$.*+?()[\]{}|]/g,qE=/^\[object .+?Constructor\]$/,HE=/^(?:0|[1-9]\d*)$/,j={};j[RE]=j[OE]=j[FE]=j[ME]=j[LE]=j[UE]=j[BE]=j[DE]=j[_E]=!0;j[wd]=j[Vc]=j[bb]=j[mb]=j[Td]=j[pb]=j[fb]=j[gb]=j[xd]=j[hb]=j[Ai]=j[vb]=j[Ad]=j[yb]=j[zc]=!1;var kb=typeof global=="object"&&global&&global.Object===Object&&global,jE=typeof self=="object"&&self&&self.Object===Object&&self,gt=kb||jE||Function("return this")(),Pb=typeof ys=="object"&&ys&&!ys.nodeType&&ys,eb=Pb&&typeof Ti=="object"&&Ti&&!Ti.nodeType&&Ti,Sb=eb&&eb.exports===Pb,jc=Sb&&kb.process,tb=function(){try{return jc&&jc.binding&&jc.binding("util")}catch{}}(),rb=tb&&tb.isTypedArray;function WE(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 GE(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function VE(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 zE(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function JE(r){return function(e){return r(e)}}function $E(r,e){return r.has(e)}function KE(r,e){return r?.[e]}function XE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function ZE(r,e){return function(t){return r(e(t))}}function YE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var QE=Array.prototype,eR=Function.prototype,Md=Object.prototype,Wc=gt["__core-js_shared__"],Cb=eR.toString,rt=Md.hasOwnProperty,ib=function(){var r=/[^.]+$/.exec(Wc&&Wc.keys&&Wc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Ib=Md.toString,tR=RegExp("^"+Cb.call(rt).replace(NE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nb=Sb?gt.Buffer:void 0,Ed=gt.Symbol,sb=gt.Uint8Array,wb=Md.propertyIsEnumerable,rR=QE.splice,yr=Ed?Ed.toStringTag:void 0,ob=Object.getOwnPropertySymbols,iR=nb?nb.isBuffer:void 0,nR=ZE(Object.keys,Object),Jc=Ei(gt,"DataView"),bs=Ei(gt,"Map"),$c=Ei(gt,"Promise"),Kc=Ei(gt,"Set"),Xc=Ei(gt,"WeakMap"),ks=Ei(Object,"create"),sR=Pr(Jc),oR=Pr(bs),aR=Pr($c),dR=Pr(Kc),lR=Pr(Xc),ab=Ed?Ed.prototype:void 0,Gc=ab?ab.valueOf:void 0;function br(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 uR(){this.__data__=ks?ks(null):{},this.size=0}function cR(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function mR(r){var e=this.__data__;if(ks){var t=e[r];return t===Yc?void 0:t}return rt.call(e,r)?e[r]:void 0}function pR(r){var e=this.__data__;return ks?e[r]!==void 0:rt.call(e,r)}function fR(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=ks&&e===void 0?Yc:e,this}br.prototype.clear=uR;br.prototype.delete=cR;br.prototype.get=mR;br.prototype.has=pR;br.prototype.set=fR;function ht(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 gR(){this.__data__=[],this.size=0}function hR(r){var e=this.__data__,t=Ld(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():rR.call(e,t,1),--this.size,!0}function vR(r){var e=this.__data__,t=Ld(e,r);return t<0?void 0:e[t][1]}function yR(r){return Ld(this.__data__,r)>-1}function bR(r,e){var t=this.__data__,i=Ld(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ht.prototype.clear=gR;ht.prototype.delete=hR;ht.prototype.get=vR;ht.prototype.has=yR;ht.prototype.set=bR;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 kR(){this.size=0,this.__data__={hash:new br,map:new(bs||ht),string:new br}}function PR(r){var e=Ud(this,r).delete(r);return this.size-=e?1:0,e}function SR(r){return Ud(this,r).get(r)}function CR(r){return Ud(this,r).has(r)}function IR(r,e){var t=Ud(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}kr.prototype.clear=kR;kr.prototype.delete=PR;kr.prototype.get=SR;kr.prototype.has=CR;kr.prototype.set=IR;function Rd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new kr;++e<t;)this.add(r[e])}function wR(r){return this.__data__.set(r,Yc),this}function xR(r){return this.__data__.has(r)}Rd.prototype.add=Rd.prototype.push=wR;Rd.prototype.has=xR;function Bt(r){var e=this.__data__=new ht(r);this.size=e.size}function AR(){this.__data__=new ht,this.size=0}function TR(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function ER(r){return this.__data__.get(r)}function RR(r){return this.__data__.has(r)}function OR(r,e){var t=this.__data__;if(t instanceof ht){var i=t.__data__;if(!bs||i.length<CE-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new kr(i)}return t.set(r,e),this.size=t.size,this}Bt.prototype.clear=AR;Bt.prototype.delete=TR;Bt.prototype.get=ER;Bt.prototype.has=RR;Bt.prototype.set=OR;function FR(r,e){var t=Od(r),i=!t&&JR(r),n=!t&&!i&&Zc(r),o=!t&&!i&&!n&&Fb(r),a=t||i||n||o,c=a?zE(r.length,String):[],p=c.length;for(var f in r)(e||rt.call(r,f))&&!(a&&(f=="length"||n&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||jR(f,p)))&&c.push(f);return c}function Ld(r,e){for(var t=r.length;t--;)if(Tb(r[t][0],e))return t;return-1}function MR(r,e,t){var i=e(r);return Od(r)?i:GE(i,t(r))}function Ss(r){return r==null?r===void 0?EE:xE:yr&&yr in Object(r)?qR(r):zR(r)}function db(r){return Ps(r)&&Ss(r)==wd}function xb(r,e,t,i,n){return r===e?!0:r==null||e==null||!Ps(r)&&!Ps(e)?r!==r&&e!==e:LR(r,e,t,i,xb,n)}function LR(r,e,t,i,n,o){var a=Od(r),c=Od(e),p=a?Vc:Ut(r),f=c?Vc:Ut(e);p=p==wd?Ai:p,f=f==wd?Ai:f;var v=p==Ai,m=f==Ai,b=p==f;if(b&&Zc(r)){if(!Zc(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Bt),a||Fb(r)?Ab(r,e,t,i,n,o):_R(r,e,p,t,i,n,o);if(!(t&Fd)){var y=v&&rt.call(r,"__wrapped__"),C=m&&rt.call(e,"__wrapped__");if(y||C){var I=y?r.value():r,A=C?e.value():e;return o||(o=new Bt),n(I,A,t,i,o)}}return b?(o||(o=new Bt),NR(r,e,t,i,n,o)):!1}function UR(r){if(!Ob(r)||GR(r))return!1;var e=Eb(r)?tR:qE;return e.test(Pr(r))}function BR(r){return Ps(r)&&Rb(r.length)&&!!j[Ss(r)]}function DR(r){if(!VR(r))return nR(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function Ab(r,e,t,i,n,o){var a=t&Fd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var f=o.get(r);if(f&&o.get(e))return f==e;var v=-1,m=!0,b=t&ub?new Rd:void 0;for(o.set(r,e),o.set(e,r);++v<c;){var y=r[v],C=e[v];if(i)var I=a?i(C,y,v,e,r,o):i(y,C,v,r,e,o);if(I!==void 0){if(I)continue;m=!1;break}if(b){if(!VE(e,function(A,M){if(!$E(b,M)&&(y===A||n(y,A,t,i,o)))return b.push(M)})){m=!1;break}}else if(!(y===C||n(y,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function _R(r,e,t,i,n,o,a){switch(t){case Td:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case bb:return!(r.byteLength!=e.byteLength||!o(new sb(r),new sb(e)));case mb:case pb:case hb:return Tb(+r,+e);case fb:return r.name==e.name&&r.message==e.message;case vb:case yb:return r==e+"";case xd:var c=XE;case Ad:var p=i&Fd;if(c||(c=YE),r.size!=e.size&&!p)return!1;var f=a.get(r);if(f)return f==e;i|=ub,a.set(r,e);var v=Ab(c(r),c(e),i,n,o,a);return a.delete(r),v;case TE:if(Gc)return Gc.call(r)==Gc.call(e)}return!1}function NR(r,e,t,i,n,o){var a=t&Fd,c=lb(r),p=c.length,f=lb(e),v=f.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:rt.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var C=!0;o.set(r,e),o.set(e,r);for(var I=a;++m<p;){b=c[m];var A=r[b],M=e[b];if(i)var ce=a?i(M,A,b,e,r,o):i(A,M,b,r,e,o);if(!(ce===void 0?A===M||n(A,M,t,i,o):ce)){C=!1;break}I||(I=b=="constructor")}if(C&&!I){var _n=r.constructor,ka=e.constructor;_n!=ka&&"constructor"in r&&"constructor"in e&&!(typeof _n=="function"&&_n instanceof _n&&typeof ka=="function"&&ka instanceof ka)&&(C=!1)}return o.delete(r),o.delete(e),C}function lb(r){return MR(r,XR,HR)}function Ud(r,e){var t=r.__data__;return WR(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ei(r,e){var t=KE(r,e);return UR(t)?t:void 0}function qR(r){var e=rt.call(r,yr),t=r[yr];try{r[yr]=void 0;var i=!0}catch{}var n=Ib.call(r);return i&&(e?r[yr]=t:delete r[yr]),n}var HR=ob?function(r){return r==null?[]:(r=Object(r),WE(ob(r),function(e){return wb.call(r,e)}))}:ZR,Ut=Ss;(Jc&&Ut(new Jc(new ArrayBuffer(1)))!=Td||bs&&Ut(new bs)!=xd||$c&&Ut($c.resolve())!=Qy||Kc&&Ut(new Kc)!=Ad||Xc&&Ut(new Xc)!=zc)&&(Ut=function(r){var e=Ss(r),t=e==Ai?r.constructor:void 0,i=t?Pr(t):"";if(i)switch(i){case sR:return Td;case oR:return xd;case aR:return Qy;case dR:return Ad;case lR:return zc}return e});function jR(r,e){return e=e??cb,!!e&&(typeof r=="number"||HE.test(r))&&r>-1&&r%1==0&&r<e}function WR(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function GR(r){return!!ib&&ib in r}function VR(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Md;return r===t}function zR(r){return Ib.call(r)}function Pr(r){if(r!=null){try{return Cb.call(r)}catch{}try{return r+""}catch{}}return""}function Tb(r,e){return r===e||r!==r&&e!==e}var JR=db(function(){return arguments}())?db:function(r){return Ps(r)&&rt.call(r,"callee")&&!wb.call(r,"callee")},Od=Array.isArray;function $R(r){return r!=null&&Rb(r.length)&&!Eb(r)}var Zc=iR||YR;function KR(r,e){return xb(r,e)}function Eb(r){if(!Ob(r))return!1;var e=Ss(r);return e==gb||e==wE||e==IE||e==AE}function Rb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=cb}function Ob(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Ps(r){return r!=null&&typeof r=="object"}var Fb=rb?JE(rb):BR;function XR(r){return $R(r)?FR(r):DR(r)}function ZR(){return[]}function YR(){return!1}Ti.exports=KR});var gP=h(Xd=>{"use strict";Xd.byteLength=wO;Xd.toByteArray=AO;Xd.fromByteArray=RO;var st=[],qe=[],IO=typeof Uint8Array<"u"?Uint8Array:Array,Rm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Br=0,pP=Rm.length;Br<pP;++Br)st[Br]=Rm[Br],qe[Rm.charCodeAt(Br)]=Br;var Br,pP;qe[45]=62;qe[95]=63;function fP(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 wO(r){var e=fP(r),t=e[0],i=e[1];return(t+i)*3/4-i}function xO(r,e,t){return(e+t)*3/4-t}function AO(r){var e,t=fP(r),i=t[0],n=t[1],o=new IO(xO(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=qe[r.charCodeAt(p)]<<18|qe[r.charCodeAt(p+1)]<<12|qe[r.charCodeAt(p+2)]<<6|qe[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=qe[r.charCodeAt(p)]<<2|qe[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=qe[r.charCodeAt(p)]<<10|qe[r.charCodeAt(p+1)]<<4|qe[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function TO(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function EO(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(TO(i));return n.join("")}function RO(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(EO(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 XH=Nn(Mv(),1);function g(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function ur(r,e){if(!r)throw Error(e)}var ie;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(ie||(ie={}));function At(r){return r.startsWith(ie.COMMENT)}function ud(r){return r.startsWith(ie.ACCOUNT)}function cr(r){return r.startsWith(ie.LINK)}function Lv(r){return r.startsWith(ie.MESSAGE)}function Uv(r){return r.startsWith(ie.SUBREDDIT)}function Bv(r){return r.startsWith(ie.AWARD)}function WT(r){ur(At(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function GT(r){ur(ud(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function VT(r){ur(cr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function zT(r){ur(Lv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function JT(r){ur(Uv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function $T(r){ur(Bv(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ii(r){return WT(r),r}function ne(r){return GT(r),r}function ge(r){return VT(r),r}function KT(r){return zT(r),r}function Oe(r){return JT(r),r}function XT(r){return $T(r),r}function he(r){if(At(r))return ii(r);if(ud(r))return ne(r);if(cr(r))return ge(r);if(Lv(r))return KT(r);if(Uv(r))return Oe(r);if(Bv(r))return XT(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function pc(r){return At(r)}import*as S from"@devvit/protos";var cd=class{constructor(e){}};var fc=(t=>(t.Installation="installation",t.App="app",t))(fc||{});function mr(r,e=new Set){for(let t of r){if(t.type==="group"){mr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}ZT(r)}function ZT(r){for(let e of r)if(e.type==="string"&&e.isSecret&&e.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${e.name}"`}var Tt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var yL=["activity","add-emoji","add","add-media","add-to-feed","admin","align-center","align-left","align-right","all","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audio","author","avatar-style","award","back","ban","best","binoculars","block","blockchain","bold","bot","boost","bounce","brand-awareness","browse","browser","cake","calendar","camera","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","checkbox-dismiss","checkbox","checkmark","chrome","clear","close","closed-captioning","code-block","code-inline","coins-color-old","coins-color","coins","collapse-left","collapse-right","collection","comment","comments","community","contest","controversial","crop","crosspost","crowd-control","custom-feed","customize","day","delete","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","gif-post","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","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","mark-read","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","new","night","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","planet","play","poll-post","popular","posts","powerup-color-outline","powerup-fill-color","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","refresh","remove","reply","report","reverse","right","rising","rotate","rotate-image","rpan","rules","safari","save","saved","search","self","send","settings","share-android","share","share-ios","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","telescope","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","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-live-1","video-live-fill-1","video-live","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","views","volume","volume-mute","wallet","warning","wiki-ban","wiki","wiki-unban","world"];import{AppSettingsDefinition as p0,GetFieldsResponse as f0}from"@devvit/protos";import{FormField as pr,FormFieldType as Fe}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return YT(e);case"image":return QT(e);case"paragraph":return e0(e);case"number":return t0(e);case"select":return r0(e);case"boolean":return i0(e);case"group":return n0(e);default:throw new Error("Unknown field type.")}})}function YT(r){return pr.fromPartial({defaultValue:{fieldType:Fe.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Fe.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function QT(r){return pr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Fe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function e0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Fe.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function t0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Fe.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function r0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Fe.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function i0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Fe.BOOLEAN,helpText:r.helpText,label:r.label})}function n0(r){return pr.fromPartial({fieldType:Fe.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as m0}from"@devvit/protos";import{RealtimeSubscriptionStatus as _v}from"@devvit/protos";var D=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",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"}),Dv;(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"})(Dv||(Dv={}));function Nv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];g(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];g(p,"useChannel - installation is missing from Context");async function f(A){let M=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(M,A);else throw Error(`Failed to send to channel '${M}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${M}`)}function v(){if(!o[n].active){let A=o[n].channel;o[n].active=!0,r.addRealtimeChannel(A)}}function m(){if(o[n].active){let A=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(A)}}function b(A){return async()=>{let M;switch(A.status){case _v.REALTIME_SUBSCRIBED:o[n].connected=!0,M=t.onSubscribed?.();break;case _v.REALTIME_UNSUBSCRIBED:o[n].connected=!1,M=t.onUnsubscribed?.();break;default:M=t.onMessage(A.event?.data??{});break}await M}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Tt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let C=r.realtimeEvent;r.isInitialRender?y.active=!1:C&&y.active&&C.event.channel===y.channel&&(y.preventCallback||r.runHook(b(C)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let I=0;return y.active&&y.connected?I=2:y.active&&!y.connected?I=1:!y.active&&y.connected?I=3:!y.active&&!y.connected&&(I=4),{subscribe:v,unsubscribe:m,send:f,status:I}}return e}import{FormFieldType as ni}from"@devvit/protos";function gc(r){switch(r.fieldType){case ni.STRING:return r.stringValue;case ni.IMAGE:return r.stringValue;case ni.PARAGRAPH:return r.stringValue;case ni.NUMBER:return r.numberValue;case ni.BOOLEAN:return r.boolValue;case ni.SELECTION:return r.selectionValue?.values??[];default:return}}function Et(r){return Object.keys(r).reduce((e,t)=>{let i=gc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function qv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,f={formKey:p,preventSubmit:!1,type:Tt.FORM};n in a?f=a[n]:n in c&&(f=c[n]),a[n]=f,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!f.preventSubmit&&v.formId===p&&r.runHook(async()=>{let m=i(Et(v.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function Hv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),f={lastRun:void 0,running:!1,preventCallback:!1,type:Tt.INTERVAL};n in o?f=o[n]:n in a&&(f=a[n]);function v(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,y]of Object.entries(o))if(b!==n.toString()&&y?.type===Tt.INTERVAL&&y?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:o[n]?.lastRun??Date.now(),preventCallback:!1,type:Tt.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&f.running&&(f.preventCallback||(f.lastRun===void 0||f.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,f.lastRun=Date.now()}),r.rerenderIn(p)),f.preventCallback=!1,o[n]=f,r.currentHookIndex++,{start:v,stop:m}}return e}function jv(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 bc={now(){return new Date}};function Wv(r){return`__autocache__${r}`}function Gv(r){return`__lock__${r}`}var o0=300,a0=1e3,md=5e3,hc=3,Vv=.1,zv=1e3,d0=3e4;function Jv(r){if(r.error)throw new Error(r.error);return r.value}var Rt,Ot,Me,si,$,$v,Kv,Xv,vc,Zv,Yv,yc,Qv,pd=class{constructor(e,t,i=bc){l(this,$);l(this,Rt);l(this,Ot,{});l(this,Me);l(this,si);d(this,Rt,e),d(this,si,t),d(this,Me,i)}async cache(e,t){d(this,Ot,s(this,si).__cache=s(this,si).__cache??{}),P(this,$,Qv).call(this,t);let i=P(this,$,$v).call(this,t.key);if(i!==void 0)return i;let n=await P(this,$,yc).call(this,t.key),o=await P(this,$,Kv).call(this,t,n,e);return Jv(o)}};Rt=new WeakMap,Ot=new WeakMap,Me=new WeakMap,si=new WeakMap,$=new WeakSet,$v=function(e){let t=s(this,Ot)[e];if(t){let i=s(this,Me).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<hc&&Math.random()<Vv&&t.errorTime+zv<i;if(t?.expires&&t.expires<i&&t.checkedAt+zv<i||n){delete s(this,Ot)[e];return}else return Jv(t)}},Kv=async function(e,t,i){let n=t?.expires,o=n?P(this,$,Yv).call(this,n):1;return!t||t?.error&&t.errorCount<hc&&Vv>Math.random()||o>Math.random()?P(this,$,Xv).call(this,e,t,i):t},Xv=async function(e,t,i){let n=Gv(e.key),o=s(this,Me).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Rt).set(n,"1",{expiration:a,nx:!0}))return P(this,$,Zv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Me).now();return P(this,$,vc).call(this,p,e.key,e.ttl)}},vc=async function(e,t,i){let n=Math.min(i,a0),o=await P(this,$,yc).call(this,t);if(o)return o;if(s(this,Me).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,o0)),P(this,$,vc).call(this,e,t,i)},Zv=async function(e,t,i,n){let o=s(this,Me).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,Me).now().getTime(),t.errorCount++}return s(this,Ot)[e]=t,await s(this,Rt).set(Wv(e),JSON.stringify(t),{expiration:new Date(o+d0)}),t.error&&t.errorCount<hc&&await s(this,Rt).del(Gv(e)),t},Yv=function(e){let t=s(this,Me).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},yc=async function(e){let t=await s(this,Rt).get(Wv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Me).now().getTime(),s(this,Ot)[e]=i,i}},Qv=function(e){e.ttl<md&&(console.warn(`Cache TTL cannot be less than ${md} milliseconds! Updating ttl value of ${e.ttl} to ${md}.`),e.ttl=md)};function ey(r,e,t=bc){let i=new pd(r,e,t);return i.cache.bind(i)}function ty(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,ry,iy,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"?P(this,li,ry).call(this,e,t??{webview:!1}):P(this,li,iy).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,ry=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return ty(e),encodeURI(e)}catch{return""}},iy=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{ty(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 Ft,ui=class{constructor(e){l(this,Ft);d(this,Ft,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Ft));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,Ft))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Ft))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Ft));return e}};Ft=new WeakMap;var as,ci=class{constructor(e){l(this,as);d(this,as,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,as));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};as=new WeakMap;var ds,mi=class{constructor(e){l(this,ds);d(this,ds,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ds))}};ds=new WeakMap;var ls,pi=class{constructor(e){l(this,ls);d(this,ls,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,ls))}};ls=new WeakMap;var k,us,gi=class{constructor(e){l(this,k);l(this,us);d(this,k,e),d(this,us,new gd(e))}get modMail(){return s(this,us)}getSubredditById(e){return ve.getById(he(e),s(this,k))}getSubredditByName(e){return ve.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return ve.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ve.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ve.getFromMetadata(s(this,k))}getPostById(e){return z.getById(he(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 w.getById(he(e),s(this,k))}getCollectionById(e){return fi.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return fi.create(e,s(this,k))}getCollectionsForSubreddit(e){return fi.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return w.getByUsername(e,s(this,k))}getCurrentUser(){return w.getFromMetadata(D.User,s(this,k))}getAppUser(){return w.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return w.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return Q.getById(he(e),s(this,k))}getComments(e){return Q.getComments(e,s(this,k))}getCommentsByUser(e){return Q.getCommentsByUser(e,s(this,k))}submitComment(e){return Q.submit({...e,id:he(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 w.getOverview(e,s(this,k))}getModerationLog(e){return fd(e,s(this,k))}getApprovedUsers(e){return w.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return w.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return w.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return w.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return w.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return w.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,k))}unbanUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return w.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return w.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return w.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return w.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return w.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return w.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return w.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return w.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return w.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Le.get(e,s(this,k))}deleteModNote(e){return Le.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?he(e.redditId):void 0};return Le.add(t,s(this,k))}addRemovalNote(e){return Le.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return fr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return fr.sendAsSubreddit(e,s(this,k))}async approve(e){if(At(e))return Q.approve(e,s(this,k));if(cr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(At(e))return Q.remove(e,t,s(this,k));if(cr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Ue.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Ue.removePostFlair(e,ge(t),s(this,k))}async getWidgets(e){return se.getWidgets(e,s(this,k))}async deleteWidget(e,t){return se.delete(e,t,s(this,k))}async addWidget(e){return se.add(e,s(this,k))}async reorderWidgets(e,t){return se.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ye.getPage(e,t,s(this,k))}async getWikiPages(e){return ye.getPages(e,s(this,k))}async createWikiPage(e){return ye.createPage(e,s(this,k))}async updateWikiPage(e){return ye.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ye.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ye.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ye.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ye.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ye.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ye.removeEditor(e,t,i,s(this,k))}getMessages(e){return fr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return fr.markAllAsRead(s(this,k))}report(e,t){return u.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,k))}getModQueue(e){return ve.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ve.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ve.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ve.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ve.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return oy(e,s(this,k))}getVaultByUserId(e){return ay(he(e),s(this,k))}getSubredditLeaderboard(e){return sy(e,s(this,k))}};k=new WeakMap,us=new WeakMap;import{RedisKeyScope as kc}from"@devvit/protos";var R,O,F,Pc=class{constructor(e,t,i){l(this,R);l(this,O);l(this,F);d(this,R,e),d(this,O,t),d(this,F,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,O)},s(this,F)),this}async multi(){await s(this,R).Multi(s(this,O),s(this,F))}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,F)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,O)},s(this,F)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,O)},s(this,F)),this}async exec(){let e=await s(this,R).Exec(s(this,O),s(this,F)),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,F))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,O)},s(this,F)),this}async unwatch(){return await s(this,R).Unwatch(s(this,O),s(this,F)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,O)},s(this,F)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,O)},s(this,F)),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,F)),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,F)),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,F)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,O)},s(this,F)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,O)},s(this,F)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,O)},s(this,F)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,O)},s(this,F)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,O)},member:t},s(this,F)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,O)},member:t},s(this,F)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,O)},s(this,F)),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,F)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,O)},s(this,F)),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,F)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,O)},members:t},s(this,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),this}};R=new WeakMap,O=new WeakMap,F=new WeakMap;var L,hi,Sc=class Sc{constructor(e,t=void 0,i=kc.INSTALLATION){l(this,L);l(this,hi);d(this,L,e),d(this,hi,t),this.scope=i,this.global=i===kc.INSTALLATION?new Sc(s(this,L),s(this,hi),kc.GLOBAL):this}get storage(){return s(this,hi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,L));return new Pc(this.storage,t,s(this,L))}async get(e){let t=await this.storage.Get({key:e,scope:this.scope},s(this,L));return t!==null?t.value??void 0: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,L))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,L))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,L))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,L));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,L))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,L))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,L))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,L))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,L))).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,L))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,L))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,L))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,L))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,L))).value}async zScore(e,t){let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},s(this,L));return i!==null?i.value:i}async zRank(e,t){let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},s(this,L));return i!==null?i.value:i}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,L));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,L));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,L))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,L));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,L))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,L));return t!==null?t.value:t}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){let i=await this.storage.HGet({key:e,field:t,scope:this.scope},s(this,L));return i!==null?i.value??void 0: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,L))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,L));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,L))).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,L))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,L));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,L))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};L=new WeakMap,hi=new WeakMap;var vi=Sc;var gr,yi=class{constructor(e){l(this,gr);d(this,gr,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,gr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,gr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,gr))).actions.map(t=>(g(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}))}};gr=new WeakMap;var cs,bi=class{constructor(e){l(this,cs);d(this,cs,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,cs));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...dy(t.installationSettings.settings,u.installationSettings),...dy(t.appSettings.settings,u.appSettings)}}};cs=new WeakMap;function dy(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=gc(r[n]),i),{});return e&&ly(t,e),t}function ly(r,e){for(let t of e)t.type==="group"?ly(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Cc,Form as l0,ToastAppearance as uy}from"@devvit/protos";var hr,ki,hd=class{constructor(e){l(this,hr,[]);l(this,ki);d(this,ki,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,ki)){let a=s(this,ki).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=l0.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});mr(n.fields),o.fields=mt(n.fields),s(this,hr).push({type:Cc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?uy.SUCCESS:uy.NEUTRAL}:t={text:e},s(this,hr).push({type:Cc.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,hr).push({type:Cc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,hr)}};hr=new WeakMap,ki=new WeakMap;function Be({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new vi(r),c=ey(a,i?i.state:{}),p=new gi(r),f=new yi(r),v=new bi(r),m=e?new hd(i):void 0,b=new ci(r),y=new di,C=new pi(r),I=t&&i?jv(i):void 0,A=t&&i?Hv(i):void 0,M=t&&i?qv(i):void 0,ce=t&&i?Nv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:f,settings:v,media:b,assets:y,realtime:C,get useForm(){return M??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return I??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return A??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return ce??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var cy={name:"@devvit/public-api",version:"0.11.0-dev",license:"BSD-3-Clause",repository:{type:"git",url:"https://developers.reddit.com/"},type:"module",exports:{".":"./dist/index.js","./package.json":"./package.json","./*":"./dist/*"},main:"./dist/index.js",files:["dist/**"],scripts:{build:"yarn build:icon-types && yarn build:semantic-colors && tsc && cp -af devvit.tsconfig.json dist/ && yarn build:types && yarn build:min && yarn build:unmin","build:icon-types":"make-icons src/types/icons.ts","build:min":"esbuild --bundle --sourcemap=linked --target=es2020 --format=esm --metafile=dist/meta.min.json --outfile=dist/public-api.min.js --external:@devvit/protos --minify src/index.ts","build:semantic-colors":"node scripts/make-semantic-colors.js","build:types":"api-extractor run && sed -ne '/declare global {/,$ p' src/devvit/Devvit.ts >> dist/public-api.d.ts","build:unmin":"esbuild --bundle --sourcemap=inline --target=es2020 --format=iife --metafile=dist/meta.json --outfile=dist/public-api.iife.js --global-name=devvitPublicAPI src/index.ts",clean:"rm -rf .turbo api-extractor coverage dist src/devvit/internals/semanticColors.ts src/types/icons.ts || :",clobber:"yarn clean && rm -rf node_modules",dev:"tsc -w","dev:build":"chokidar ./src --command 'yarn build' --ignore './src/types/icons.ts' --ignore './src/devvit/internals/semanticColors.ts'",lint:"redlint .","lint:fix":"yarn lint --fix",prepublishOnly:"publish-package-json",test:"yarn test:unit && yarn test:types && yarn test:size","test:size":"filesize","test:types":"tsc --noEmit","test:unit":"vitest run","test:unit-with-coverage":"vitest run --coverage"},types:"./dist/index.d.ts",dependencies:{"@devvit/protos":"0.11.0-dev","@devvit/shared-types":"0.11.0-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/eslint-config":"0.11.0-dev","@devvit/repo-tools":"0.11.0-dev","@devvit/tsconfig":"0.11.0-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"11.3.3","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"8.9.0",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"255 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[D.Subreddit]?.values[0];g(i,"subreddit is missing from Context");let n=r[D.AppUser]?.values[0],o=r[D.User]?.values[0],a=c0(r);return{get appAccountId(){return g(n,"appAccountId is missing from Context"),n},subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}function c0(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},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${cy.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function my(r){return r.flatMap(e=>e.type==="group"?my(e.fields):e)}async function vd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i=m0.fromPartial({success:!0,errors:{}}),n=Et(r.fieldValues),o=my(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],f=a.onValidate,v=Object.assign(Be({metadata:t}),le(t)),m=await f({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),i}async function g0(){if(!u.appSettings)throw new Error("App settings were not defined.");return f0.fromPartial({fields:{fields:mt(u.appSettings)}})}async function h0(r,e){return vd(r,u.appSettings,e)}function py(r){r.provides(p0),U("GetAppSettingsFields",g0),U("ValidateAppForm",h0)}import{CustomPostDefinition as C0}from"@devvit/protos";import{BlockRenderEventType as Dc,EffectType as Oy}from"@devvit/protos";function Pi(r){return r.__effects}function fy(){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 Bc,BlockAnimationDirection as Iy,BlockAnimationLoopMode as wy,BlockAnimationType as xy,BlockAvatarBackground as Ay,BlockAvatarFacing as Ty,BlockAvatarSize as Mt,BlockBorderWidth as Pd,BlockButtonAppearance as Lt,BlockButtonSize as Tc,BlockFullSnooSize as Ci,BlockGap as Sd,BlockHorizontalAlignment as Ec,BlockIconSize as Cd,BlockImageResizeMode as ms,BlockPadding as ps,BlockRadius as fs,BlockSpacerShape as Rc,BlockSpacerSize as Id,BlockStackDirection as Oc,BlockTextOutline as Fc,BlockTextOverflow as Mc,BlockTextSize as Ii,BlockTextStyle as Lc,BlockTextWeight as Ey,BlockType as De,BlockVerticalAlignment as Uc}from"@devvit/protos";var Ic={transparent:"transparent",black:"#000000",white:"#ffffff","coolgray-950":"#04090A","coolgray-900":"#0B1416","coolgray-850":"#0F1A1C","coolgray-800":"#131F23","coolgray-750":"#1A282D","coolgray-700":"#223237","coolgray-650":"#2A3C42","coolgray-600":"#33464C","coolgray-550":"#4B6066","coolgray-525":"#576F76","coolgray-500":"#667A80","coolgray-450":"#82959B","coolgray-400":"#A0B0B5","coolgray-350":"#B8C5C9","coolgray-300":"#D2DADD","coolgray-250":"#DAE0E3","coolgray-200":"#E2E7E9","coolgray-150":"#EAEDEF","coolgray-100":"#F2F4F5","coolgray-50":"#F9FAFA","puregray-950":"#080808","puregray-900":"#131313","puregray-850":"#181818","puregray-800":"#1E1E1E","puregray-750":"#272727","puregray-700":"#303030","puregray-650":"#393939","puregray-600":"#434343","puregray-550":"#5C5C5C","puregray-500":"#767676","puregray-450":"#919191","puregray-400":"#ACACAC","puregray-350":"#C3C3C3","puregray-300":"#D6D6D6","puregray-250":"#DDDDDD","puregray-200":"#E4E4E4","puregray-150":"#EBEBEB","puregray-100":"#F2F2F2","puregray-50":"#F8F8F8","orangered-950":"#190600","orangered-900":"#340E00","orangered-800":"#4F1500","orangered-700":"#721F00","orangered-600":"#962900","orangered-500":"#D93A00","orangered-400":"#FE7C53","orangered-300":"#FFBEA6","orangered-200":"#FFD5C6","orangered-100":"#FFEDE5","orangered-50":"#FFF6F3","red-950":"#1C0004","red-900":"#3A0008","red-800":"#58000C","red-700":"#7E0011","red-600":"#A50016","red-500":"#EB001F","red-400":"#FF6E80","red-300":"#FFADB8","red-200":"#FFCCD2","red-100":"#FFEAED","red-50":"#FFF6F7","sakurapink-950":"#1A0011","sakurapink-900":"#360024","sakurapink-800":"#530037","sakurapink-700":"#770051","sakurapink-600":"#9B006A","sakurapink-500":"#E00096","sakurapink-400":"#FF55BD","sakurapink-300":"#FFA5E3","sakurapink-200":"#FFC5EC","sakurapink-100":"#FFE5F9","sakurapink-50":"#FFF3FB","berrypurple-950":"#16001F","berrypurple-900":"#2E0041","berrypurple-800":"#470062","berrypurple-700":"#66008C","berrypurple-600":"#8700B5","berrypurple-500":"#BC0EFF","berrypurple-400":"#D55EFF","berrypurple-300":"#EEA7FF","berrypurple-200":"#F2C8FF","berrypurple-100":"#FBE6FF","berrypurple-50":"#FCF4FF","periwinkle-950":"#0D0B1F","periwinkle-900":"#1A1741","periwinkle-800":"#272262","periwinkle-700":"#372F8C","periwinkle-600":"#453BB5","periwinkle-500":"#6A5CFF","periwinkle-400":"#988EFF","periwinkle-300":"#C3BDFF","periwinkle-200":"#D8D4FF","periwinkle-100":"#ECEAFF","periwinkle-50":"#F7F6FF","alienblue-950":"#000C1D","alienblue-900":"#00183D","alienblue-800":"#00255D","alienblue-700":"#003584","alienblue-600":"#0045AC","alienblue-500":"#1870F4","alienblue-400":"#629FFF","alienblue-300":"#A7CCFF","alienblue-200":"#C6DCFF","alienblue-100":"#E4EFFF","alienblue-50":"#F3F7FF","lightblue-950":"#000D12","lightblue-900":"#001C26","lightblue-800":"#002A3A","lightblue-700":"#003F56","lightblue-600":"#005472","lightblue-500":"#007FAE","lightblue-400":"#47B0DB","lightblue-300":"#95DCFB","lightblue-200":"#B6E9FF","lightblue-100":"#D9F6FF","lightblue-50":"#ECFAFF","mintgreen-950":"#00100E","mintgreen-900":"#001E1B","mintgreen-800":"#002E28","mintgreen-700":"#00443C","mintgreen-600":"#005A4F","mintgreen-500":"#008675","mintgreen-400":"#45B9AB","mintgreen-300":"#96E1D8","mintgreen-200":"#B7ECE5","mintgreen-100":"#DAF7F4","mintgreen-50":"#ECFBF9","kiwigreen-950":"#021000","kiwigreen-900":"#032200","kiwigreen-800":"#053200","kiwigreen-700":"#084A00","kiwigreen-600":"#0A6000","kiwigreen-500":"#0E8A00","kiwigreen-400":"#55BD46","kiwigreen-300":"#A3E398","kiwigreen-200":"#BFEEB8","kiwigreen-100":"#DFF8DB","kiwigreen-50":"#EEFCED","lime-950":"#0C0E00","lime-900":"#1A1F00","lime-800":"#282F00","lime-700":"#3A4501","lime-600":"#4D5A01","lime-500":"#6B7E01","lime-400":"#A1B33B","lime-300":"#CFDB83","lime-200":"#DFE8A6","lime-100":"#EFF4CC","lime-50":"#F7FAE5","yellow-950":"#100D01","yellow-900":"#251E02","yellow-800":"#382D03","yellow-700":"#504104","yellow-600":"#665505","yellow-500":"#8F7407","yellow-400":"#DBAF00","yellow-300":"#FADB61","yellow-200":"#FFE88F","yellow-100":"#FFF2BD","yellow-50":"#FFFAE5","yelloworange-950":"#150C00","yelloworange-900":"#2C1A00","yelloworange-800":"#432700","yelloworange-700":"#623A00","yelloworange-600":"#814C00","yelloworange-500":"#B06400","yelloworange-400":"#FF9C1A","yelloworange-300":"#FFCD7C","yelloworange-200":"#FFDDA8","yelloworange-100":"#FFF0D3","yelloworange-50":"#FFF7EA","poopbrown-950":"#110B04","poopbrown-900":"#29190A","poopbrown-800":"#3B2510","poopbrown-700":"#54371A","poopbrown-600":"#6E4924","poopbrown-500":"#9A6D3F","poopbrown-400":"#CAA075","poopbrown-300":"#EECCAA","poopbrown-200":"#F6DDC3","poopbrown-100":"#FEEEDD","poopbrown-50":"#FEF7EE",pizzaRed:{light:"#ef5350",dark:"#c62828"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-focus":{light:"#47B0DB",dark:"#007FAE"},"interactive-content-disabled":{light:"#0000003f",dark:"#ffffff3f"},"interactive-background-disabled":{light:"#0000000c",dark:"#ffffff0c"},"interactive-pressed":{light:"#00000028",dark:"#ffffff28"},"neutral-content":{light:"#2A3C42",dark:"#B8C5C9"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-weak":{light:"#576F76",dark:"#82959B"},"neutral-content-strong":{light:"#0F1A1C",dark:"#F2F4F5"},"neutral-background":{light:"#ffffff",dark:"#0B1416"},"neutral-background-selected":{light:"#EAEDEF",dark:"#1A282D"},"neutral-background-weak":{light:"#F9FAFA",dark:"#04090A"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-strong":{light:"#ffffff",dark:"#0F1A1C"},"neutral-background-hover":{light:"#F2F4F5",dark:"#131F23"},"neutral-border":{light:"#00000033",dark:"#ffffff33"},"neutral-border-medium":{light:"#0000007f",dark:"#ffffff7f"},"neutral-border-weak":{light:"#00000019",dark:"#ffffff19"},"neutral-border-strong":{light:"#0F1A1C",dark:"#F2F4F5"},primary:{light:"#0045AC",dark:"#629FFF"},"primary-hover":{light:"#003584",dark:"#A7CCFF"},"primary-visited":{light:"#8700B5",dark:"#D55EFF"},"primary-onBackground":{light:"#ffffff",dark:"#ffffff"},"primary-onBackground-selected":{light:"#ffffff",dark:"#000000"},"primary-background":{light:"#0045AC",dark:"#0045AC"},"primary-background-hover":{light:"#003584",dark:"#1870F4"},"primary-background-selected":{light:"#00255D",dark:"#629FFF"},secondary:{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-weak":{light:"#576F76",dark:"#82959B"},"secondary-onBackground":{light:"#000000",dark:"#ffffff"},"secondary-background":{light:"#EAEDEF",dark:"#1A282D"},"secondary-background-hover":{light:"#E2E7E9",dark:"#223237"},"secondary-background-selected":{light:"#D2DADD",dark:"#33464C"},"secondary-plain":{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-plain-hover":{light:"#000000",dark:"#ffffff"},"danger-background":{light:"#EB001F",dark:"#A50016"},"danger-background-disabled":{light:"#FFCCD2",dark:"#3A0008"},"danger-background-hover":{light:"#A50016",dark:"#EB001F"},"danger-onBackground":{light:"#ffffff",dark:"#ffffff"},"danger-content":{light:"#A50016",dark:"#FF6E80"},"danger-content-hover":{light:"#7E0011",dark:"#FFADB8"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"brand-background":{light:"#D93A00",dark:"#D93A00"},"brand-onBackground":{light:"#ffffff",dark:"#ffffff"},"brand-background-hover":{light:"#962900",dark:"#962900"},"media-background":{light:"#00000099",dark:"#00000099"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-weak":{light:"#E2E7E9",dark:"#E2E7E9"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-border-selected":{light:"#ffffff",dark:"#ffffff"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"success-content":{light:"#0A6000",dark:"#55BD46"},"success-hover":{light:"#084A00",dark:"#A3E398"},"success-onBackground":{light:"#ffffff",dark:"#ffffff"},"success-background":{light:"#0E8A00",dark:"#0A6000"},"success-background-hover":{light:"#0A6000",dark:"#0E8A00"},"warning-content":{light:"#665505",dark:"#DBAF00"},"warning-content-hover":{light:"#504104",dark:"#FADB61"},"warning-onBackground":{light:"#000000",dark:"#000000"},"warning-background":{light:"#DBAF00",dark:"#DBAF00"},"warning-background-hover":{light:"#8F7407",dark:"#FADB61"},"upvote-content":{light:"#962900",dark:"#FE7C53"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#9629004c",dark:"#FE7C534c"},"upvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"upvote-background":{light:"#D93A00",dark:"#D93A00"},"upvote-background-hover":{light:"#962900",dark:"#962900"},"upvote-background-disabled":{light:"#D93A004c",dark:"#D93A004c"},"downvote-content":{light:"#453BB5",dark:"#988EFF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#453BB54c",dark:"#988EFF4c"},"downvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"downvote-background":{light:"#6A5CFF",dark:"#453BB5"},"downvote-background-hover":{light:"#453BB5",dark:"#453BB5"},"downvote-background-disabled":{light:"#6A5CFF4c",dark:"#6A5CFF4c"},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"transparent-background-hover":{light:"#82959B19",dark:"#667A8019"},"global-black":{light:"#000000",dark:"#000000"},"global-white":{light:"#ffffff",dark:"#ffffff"},"global-orangered":{light:"#D93A00",dark:"#D93A00"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#131F23",dark:"#131F23"},"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"},"action-upvote":{light:"#D93A00",dark:"#D93A00"},"action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"alert-caution":{light:"#8F7407",dark:"#8F7407"},"identity-admin":{light:"#D93A00",dark:"#D93A00"},"identity-moderator":{light:"#0E8A00",dark:"#0E8A00"},"identity-self":{light:"#008675",dark:"#008675"},"identity-coins":{light:"#DBAF00",dark:"#DBAF00"},"category-live":{light:"#D93A00",dark:"#D93A00"},"category-nsfw":{light:"#E00096",dark:"#E00096"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#ffffff",dark:"#0F1A1C"},"avatar-gradient":{light:"",dark:""},"opacity-highlight":{light:"",dark:""},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},"scrim-gradient":{light:"",dark:""},online:{light:"#55BD46",dark:"#55BD46"},favorite:{light:"#8F7407",dark:"#DBAF00"}};var gy={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"},hy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),vy=r=>r in Ic,wc=r=>r in gy,yy=r=>!!r.match(/^rgba?\(.*/),by=r=>!!r.match(/^hsla?\(.*/),ky=(r,e="light")=>{if(wc(r))return yd(r);let i=Ic[r];return typeof i=="string"?i:i[e]},yd=r=>gy[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),f=Math.round(p*255);a.push(f)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as bd}from"@devvit/protos";var xc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:bd.UNRECOGNIZED,alignment:void 0}};function Cy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=v0(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||Sy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||Sy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function Sy(r,e,t,i){return e===r&&i||t===r&&i}function v0(r,e,t){let i=e===bd.STACK_VERTICAL||e===bd.UNRECOGNIZED,n=e===bd.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,f=0;return n&&p?f=2:i&&p&&(f=1),{growDirection:o,stretchDirection:f}}import{BlockSizeUnit as vr,BlockStackDirection as kd}from"@devvit/protos";function Si(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:vr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=vr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=vr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function y0(r,e){return(r.width?.value?.unit===vr.SIZE_UNIT_PERCENT||r.width?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===kd.STACK_HORIZONTAL||e.direction===kd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===vr.SIZE_UNIT_PERCENT||r.height?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===kd.STACK_VERTICAL||e.direction===kd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Ac(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=y0(n,e.stackParentLayout)),n}}}var Ry="data-",b0=new Set(["onPress","onMessage"]),k0=new Map([["onPress",Bc.ACTION_CLICK],["onMessage",Bc.ACTION_WEBVIEW]]),gs,wi=class{constructor(e=()=>{}){l(this,gs);d(this,gs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},xc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"fullsnoo":return this.makeFullSnoo(t,n);case"animation":return this.makeAnimation(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return ps.PADDING_NONE;case"xsmall":return ps.PADDING_XSMALL;case"small":return ps.PADDING_SMALL;case"medium":return ps.PADDING_MEDIUM;case"large":return ps.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return fs.RADIUS_NONE;case"small":return fs.RADIUS_SMALL;case"medium":return fs.RADIUS_MEDIUM;case"large":return fs.RADIUS_LARGE;case"full":return fs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return Sd.GAP_NONE;case"small":return Sd.GAP_SMALL;case"medium":return Sd.GAP_MEDIUM;case"large":return Sd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Uc.ALIGN_TOP:e.includes("middle")?t=Uc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Uc.ALIGN_BOTTOM),e.includes("start")?i=Ec.ALIGN_START:e.includes("center")?i=Ec.ALIGN_CENTER:e.includes("end")&&(i=Ec.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=Pd.BORDER_WIDTH_NONE;break;case"thin":o=Pd.BORDER_WIDTH_THIN;break;case"thick":o=Pd.BORDER_WIDTH_THICK;break;default:o=Pd.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 Ii.TEXT_SIZE_XSMALL;case"small":return Ii.TEXT_SIZE_SMALL;case"medium":return Ii.TEXT_SIZE_MEDIUM;case"large":return Ii.TEXT_SIZE_LARGE;case"xlarge":return Ii.TEXT_SIZE_XLARGE;case"xxlarge":return Ii.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Lc.TEXT_STYLE_BODY;case"metadata":return Lc.TEXT_STYLE_METADATA;case"heading":return Lc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Fc.TEXT_OUTLINE_NONE;case"thin":return Fc.TEXT_OUTLINE_THIN;case"thick":return Fc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Ey.TEXT_WEIGHT_REGULAR;case"bold":return Ey.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Mc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Mc.TEXT_OVERFLOW_ELLIPSE}return Mc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Lt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Lt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Lt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Lt.BUTTON_APPEARANCE_BORDERED;case"media":return Lt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Lt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Lt.BUTTON_APPEARANCE_CAUTION;case"success":return Lt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return Tc.BUTTON_SIZE_SMALL;case"medium":return Tc.BUTTON_SIZE_MEDIUM;case"large":return Tc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ms.IMAGE_RESIZE_NONE;case"fit":return ms.IMAGE_RESIZE_FIT;case"fill":return ms.IMAGE_RESIZE_FILL;case"cover":return ms.IMAGE_RESIZE_COVER;case"scale-down":return ms.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return Id.SPACER_XSMALL;case"small":return Id.SPACER_SMALL;case"medium":return Id.SPACER_MEDIUM;case"large":return Id.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Rc.SPACER_INVISIBLE;case"thin":return Rc.SPACER_THIN;case"square":return Rc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Cd.ICON_SIZE_XSMALL;case"small":return Cd.ICON_SIZE_SMALL;case"medium":return Cd.ICON_SIZE_MEDIUM;case"large":return Cd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Mt.AVATAR_SIZE_XXSMALL;case"xsmall":return Mt.AVATAR_SIZE_XSMALL;case"small":return Mt.AVATAR_SIZE_SMALL;case"medium":return Mt.AVATAR_SIZE_MEDIUM;case"large":return Mt.AVATAR_SIZE_LARGE;case"xlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Mt.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Ty.AVATAR_FACING_LEFT;case"right":return Ty.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return Ci.FULLSNOO_XSMALL;case"small":return Ci.FULLSNOO_SMALL;case"medium":return Ci.FULLSNOO_MEDIUM;case"large":return Ci.FULLSNOO_LARGE;case"xlarge":return Ci.FULLSNOO_XLARGE;case"xxlarge":return Ci.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ay.AVATAR_BG_DARK;case"light":return Ay.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?xy.ANIM_LOTTIE:xy.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return Iy.ANIM_DIR_BACKWARD;case"forward":return Iy.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return wy.ANIM_LOOP_REPEAT;case"bounce":return wy.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Ry)).reduce((t,i)=>(t[i.substring(Ry.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return b0.forEach(o=>{if(o in t){let a=t[o];i.push({type:k0.get(o)??Bc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),hy(e)?e:vy(e)?ky(e,t):wc(e)?yd(e):yy(e)?Py(e):by(e)?e:(console.warn(`Could not parse color: ${e}.`),yd("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,gs).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,xc))}wrapRoot(e,t){return this.makeBlock(De.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=Ac(t,i),p=Cy(t,i.stackParentLayout,c);return this.makeBlock(De.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(Oc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(Oc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(Oc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(De.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(De.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(De.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(De.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(De.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(De.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e,t){return e&&this.makeBlock(De.BLOCK_FULLSNOO,e,t,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}makeAnimation(e,t){return e&&this.makeBlock(De.BLOCK_ANIMATION,e,t,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:this.resolveAssetUrl(e.url),loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e,t){return e&&this.makeBlock(De.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Ac(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t=e;if(t.type===De.BLOCK_ROOT)return t.config?.rootConfig&&u.customPostType?.height&&(t.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t;let i=this.wrapRoot(void 0,[t]);if(!i)throw new Error("Could not create root block");return i}};gs=new WeakMap;function Fy(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var My=r=>{let e="",t=r.props?Object.keys(r.props).map(i=>i==="onPress"?"":`${i}="${r.props[i]}"`).join(" "):"";e+=`<${r.type}${t?" "+t:""}>`;for(let i of r.children)typeof i=="string"?e+=i:e+=My(i);return e+=`</${r.type}>`,e};function P0(r){return" ".repeat(r)}function S0(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+=P0(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
- `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var _e,Ly,hs,_c,vs,pt=class{constructor(e,t,i,n,o){l(this,_e);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new wi(()=>this.assets);this.effects=[];l(this,vs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Be({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=P(this,_e,hs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(Fy(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(),P(this,_e,Ly).call(this)}async buildBlocksUI(){let e=P(this,_e,hs).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 Fy(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(S0(My(i))),(u.debug.emitState||e.debug.emitState)&&console.debug(JSON.stringify(this.state,void 0,2)),this.transformer.createBlocksElementOrThrow(i)}async processProps(e){let t=e.props??{},i=["onPress","onMessage"];for(let n of i)if(n in t){let o=t[n],a=o?.name,c=this.makeUniqueActionID(`${e.type}.${a??n}`);this.actions.set(c,o),t[n]=c}}async processBlock(e,t=fy(),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(),f=P(this,_e,_c).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:f}}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),f={...P(this,_e,hs).call(this),...n.props,children:p},v;for(;v===void 0;)try{v=await n.type(f,P(this,_e,hs).call(this))}catch(m){if(m instanceof Promise)v=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof v=="object")return this.processBlock(v,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===Dc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Dc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Dc.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,vs)||(d(this,vs,!0),this.effects.push({type:Oy.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:e/1e3}}))}addRealtimeChannel(e){this.realtimeChannels.push(e),this.realtimeUpdated=!0}removeRealtimeChannel(e){this.realtimeChannels=this.realtimeChannels.filter(t=>t!==e),this.realtimeUpdated=!0}get realtimeEffect(){return this.realtimeUpdated&&this.realtimeChannels.length>0?[{type:Oy.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...Pi(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};_e=new WeakSet,Ly=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},hs=function(){let e={...le(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[D.Timezone]?.values[0],locale:this.metadata[D.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},_c=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...P(this,_e,_c).call(this,i.children)):t.push(i);return t},vs=new WeakMap;async function I0(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{state:i.state,blocks:{ui:n},effects:i.getEffects()}}function Uy(r){r.provides(C0),U("RenderPost",I0)}import{GetFieldsResponse as w0,InstallationSettingsDefinition as x0}from"@devvit/protos";async function A0(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return w0.fromPartial({fields:{fields:mt(u.installationSettings)}})}async function T0(r,e){return vd(r,u.installationSettings,e)}function By(r){r.provides(x0),U("GetSettingsFields",A0),U("ValidateForm",T0)}import{ContextActionDefinition as E0,ContextActionDescription as R0,ContextActionResponse as O0}from"@devvit/protos";var Dy=r=>`menuItem.${r}`;function Nc(r){return u.menuItems.find((e,t)=>Dy(t)===r)}async function F0(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");return{actions:t.map((n,o)=>R0.fromPartial({actionId:Dy(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),member:n.forUserType?.includes("member"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}))}}async function M0(r,e){let t=Nc(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;g(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Be({ui:!0,metadata:e}),le(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),O0.fromPartial({effects:Pi(p.ui)})}function _y(r){r.provides(E0),U("GetActions",F0),U("OnAction",M0)}function ft(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as L0}from"@devvit/protos";async function U0(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(Be({metadata:e}),le(e));await i(n,o)}function Ny(r){r.provides(L0),U("HandleScheduledAction",U0)}import{HandlerResult as B0,OnAppInstallDefinition as D0,OnAppUpgradeDefinition as _0,OnCommentCreateDefinition as N0,OnCommentDeleteDefinition as q0,OnCommentReportDefinition as H0,OnCommentSubmitDefinition as j0,OnCommentUpdateDefinition as W0,OnModActionDefinition as G0,OnModMailDefinition as V0,OnPostCreateDefinition as z0,OnPostDeleteDefinition as J0,OnPostFlairUpdateDefinition as $0,OnPostReportDefinition as K0,OnPostSubmitDefinition as X0,OnPostUpdateDefinition as Z0,OnPostNsfwUpdateDefinition as Y0,OnPostSpoilerUpdateDefinition as Q0}from"@devvit/protos";var xi;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(xi||(xi={}));function ee(r,e){return g(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Be({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=eE(a);if(c)throw c.err;return B0.fromPartial({})}}function qy(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(X0),U("OnPostSubmit",ee("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides(z0),U("OnPostCreate",ee("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(Z0),U("OnPostUpdate",ee("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(K0),U("OnPostReport",ee("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(J0),U("OnPostDelete",ee("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides($0),U("OnPostFlairUpdate",ee("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(j0),U("OnCommentSubmit",ee("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(N0),U("OnCommentCreate",ee("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(W0),U("OnCommentUpdate",ee("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(H0),U("OnCommentReport",ee("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(q0),U("OnCommentDelete",ee("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(D0),U("OnAppInstall",ee("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(_0),U("OnAppUpgrade",ee("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(G0),U("OnModAction",ee("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(V0),U("OnModMail",ee("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(Y0),U("OnPostNsfwUpdate",ee("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(Q0),U("OnPostSpoilerUpdate",ee("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function eE(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=>xi.caughtToString(t)).join(`
3
- `))}}var Mb=Nn(Yy(),1),Lb=Nn(Qc(),1);import{EffectType as QR,UIEventHandlerDefinition as eO}from"@devvit/protos";async function tO(r,e){let t=r.state??{},i=(0,Mb.default)(t),n=Be({ui:!0,metadata:e});if(r.event?.formSubmitted&&r.event.formSubmitted.formId){let p=r.event.formSubmitted.formId;if(p.includes("form.hook.")&&u.customPostType){let y=new pt((C,I)=>u.customPostType?.render(I)??null,r.event,r.state,e,void 0);return await y.reconcile(),{state:y.state,effects:y.getEffects()}}let f=u.formDefinitions.get(p);if(!f)throw new Error(`Form with key ${p} not found`);let v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,I=Nc(y);I?.location==="post"?v=C:I?.location==="comment"&&(m=C)}let b=Object.assign(n,le(e,v,m),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});await f.onSubmit({values:Et(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new pt((f,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),{state:p.state,effects:p.getEffects()}}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Lb.default)(t,i),a=Pi(n.ui),c=o?[...a,{type:QR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return{state:i,effects:c}}function Ub(r){r.provides(eO),U("HandleUIEvent",tO)}import{CustomPostDefinition as sk}from"@devvit/protos";import{EffectType as rm,Form as iO,ToastAppearance as _b}from"@devvit/protos";function Bb(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var em=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Et(n.formSubmitted.results))}}};function tm(r,e){let t=Ke({namespace:"useForm"},i=>new em(i,r,e));return rO({id:t.hookId})}function rO(r){return`form.hook.${r.id}.0`}function Db(r,e){let t=Bb(e);return r.getHook({id:t})}var Dt,Bd=class{constructor(e){l(this,Dt);d(this,Dt,e)}showForm(e,t){let i=Db(s(this,Dt),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=iO.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});mr(n.fields),o.fields=mt(n.fields),s(this,Dt).emitEffect(e,{type:rm.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?_b.SUCCESS:_b.NEUTRAL}:t={text:e},s(this,Dt).emitEffect(e.toString(),{type:rm.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Dt).emitEffect(t,{type:rm.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Dt=new WeakMap;import{EffectType as nO,RealtimeSubscriptionStatus as Nb}from"@devvit/protos";var _t,it,Nt,Sr,Cs,nm,Dd=class Dd{constructor(e,t){l(this,Cs);l(this,_t);l(this,it);l(this,Nt);l(this,Sr);d(this,_t,t.context),d(this,it,!!t.context._devvitContext?.debug.realtime),d(this,Sr,e),d(this,Nt,t.invalidate);let i=t.context.meta[D.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[D.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,_t).hooks).filter(c=>c instanceof Dd).some(c=>c.state.channel===o))throw Error(`useChannel channel names must be unique; "${o}" duplicated`);this.state={channel:o,connected:!1,subscribed:!1}}async onUIEvent(e){let t=e.realtimeEvent;if(!(!t||!this.state.subscribed))switch(t.status){case Nb.REALTIME_SUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Nt).call(this),await s(this,Sr).onSubscribed?.();break;case Nb.REALTIME_UNSUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Nt).call(this),await s(this,Sr).onUnsubscribed?.();break;default:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Sr).onMessage(t.event?.data??{});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,Nt).call(this),P(this,Cs,nm).call(this))}unsubscribe(){this.state.subscribed&&(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Nt).call(this),P(this,Cs,nm).call(this))}};_t=new WeakMap,it=new WeakMap,Nt=new WeakMap,Sr=new WeakMap,Cs=new WeakSet,nm=function(){let e=Object.values(s(this,_t).hooks).filter(t=>t instanceof Dd&&t.state.subscribed).map(t=>t.state.channel);s(this,_t).emitEffect(this.state.channel,{type:nO.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var im=Dd;function sm(r){if(!r.name||/[^a-zA-Z0-9_]/.test(r.name))throw Error(`useChannel error: The name "${r.name}" you provided for the hook is invalid. Valid names can only contain letters, numbers, and underscores (_).`);let e=`useChannel:${r.name}`;return Ke({id:e,namespace:e},t=>new im(r,t))}import{EffectType as om}from"@devvit/protos";function qb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var Cr,Ri=class Ri{constructor(e,t){l(this,Cr);this._segments=[];this._hooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,d(this,Cr,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,Cr).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(this._hooks).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 this._hooks}get _state(){return s(this,Cr)}set _state(e){this._changed={},this._hooks={},d(this,Cr,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ri.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return this._hooks[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ri._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ri._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()}}};Cr=new WeakMap,Ri._staticUndeliveredHandlers={};var Oi=Ri;var qt={};Oi.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete qt[r.hook],e.emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:qt}}))});var Ht,Fi,Is,Mi,am=class{constructor(e,t,i){l(this,Ht);l(this,Fi);l(this,Is);l(this,Mi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Fi,i.invalidate),d(this,Ht,i.hookId),d(this,Is,e),d(this,Mi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?qt[s(this,Ht)]={duration:this.state.duration}:delete qt[s(this,Ht)]}async onUIEvent(e){await s(this,Is).call(this)}start(){qt[s(this,Ht)]={duration:this.state.duration},this.state.running=!0,s(this,Fi).call(this),s(this,Mi).emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:qt}})}stop(){delete qt[s(this,Ht)],this.state.running=!1,s(this,Fi).call(this),s(this,Mi).emitEffect("timers",{type:om.EFFECT_SET_INTERVALS,interval:{intervals:qt}})}};Ht=new WeakMap,Fi=new WeakMap,Is=new WeakMap,Mi=new WeakMap;function dm(r,e){let t=Ke({namespace:"useInterval"},i=>new am(r,e,i));return{start:()=>t.start(),stop:()=>t.stop()}}var Ir=class extends Error{};var lm="ServerCallRequired";function Hb(r){return r?.message===lm}var jb=Nn(Qc(),1);function cm(r){if(r instanceof Error){if(r.message===lm)throw r;return{message:r.message,details:r.stack??""}}else return{message:"Unknown error",details:xi.caughtToString(r)}}var nt,vt,ws,Li,xs,wr,um=class{constructor(e,t,i){l(this,nt);l(this,vt);l(this,ws);l(this,Li);l(this,xs);l(this,wr);d(this,nt,!!i.context.devvitContext.debug.useAsync),s(this,nt)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,vt,i.hookId),d(this,ws,e),d(this,Li,i.invalidate),d(this,xs,i.context),d(this,wr,t.depends??null)}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,nt)&&console.debug("[useAsync] async onLoad ",s(this,vt),this.state),s(this,nt)&&console.debug("[useAsync] async onLoad have ",s(this,wr),"and",this.state.depends),!(0,jb.default)(s(this,wr),this.state.depends)||this.state.load_state==="initial")){this.state.load_state="loading",this.state.depends=s(this,wr),s(this,Li).call(this);let e={hook:s(this,vt),async:!0,asyncRequest:{requestId:s(this,vt)+"-"+JSON.stringify(this.state.depends)}};s(this,nt)&&console.debug("[useAsync] onLoad requeue"),s(this,xs).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await s(this,ws).call(this)}}catch(o){i.error=cm(o)}let n={asyncResponse:i,hook:s(this,vt)};s(this,nt)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,vt)+"-"+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,Li).call(this)):s(this,nt)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};nt=new WeakMap,vt=new WeakMap,ws=new WeakMap,Li=new WeakMap,xs=new WeakMap,wr=new WeakMap;function sO(r,e={}){let t=Ke({namespace:"useAsync"},i=>new um(r,e,i));return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var yt,As,xr,Ui,Ar,mm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,yt);l(this,As);l(this,xr);l(this,Ui);l(this,Ar);d(this,xr,e),d(this,Ui,t.hookId),d(this,yt,t.invalidate),d(this,As,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&s(this,Ar)){try{this.state.value=await s(this,Ar),this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=cm(e)}s(this,yt).call(this)}else console.warn("Invalid state: ",this.state.load_state,s(this,Ar))}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,yt).call(this)}onStateLoaded(){if(this.state.load_state==="loading")throw new Ir;if(this.state.load_state==="error")throw new Error(this.state.error?.message??"Unknown error");if(this.state.load_state==="initial"){let e;try{e=s(this,xr)instanceof Function?s(this,xr).call(this):s(this,xr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,yt).call(this);return}if(e instanceof Promise){d(this,Ar,e),this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,Ui)},hook:s(this,Ui)};throw s(this,As).addToRequeueEvents(t),s(this,yt).call(this),new Ir}else this.state.value=e,this.state.load_state="loaded";s(this,yt).call(this)}}};yt=new WeakMap,As=new WeakMap,xr=new WeakMap,Ui=new WeakMap,Ar=new WeakMap;function pm(r){let e=Ke({namespace:"useState"},t=>new mm(r,t));return[e.state.value,e.setter.bind(e)]}var vm={now(){return new Date}};function Wb(r){return`__autocache__${r}`}function Gb(r){return`__lock__${r}`}var oO=300,aO=1e3,_d=5e3,fm=3,Vb=.1,zb=1e3,dO=3e4;function Jb(r){if(r.error)throw new Error(r.error);return r.value}var jt,Wt,Ne,Bi,K,$b,Kb,Xb,gm,Zb,Yb,hm,Qb,Nd=class{constructor(e,t,i=vm){l(this,K);l(this,jt);l(this,Wt,{});l(this,Ne);l(this,Bi);d(this,jt,e),d(this,Bi,t),d(this,Ne,i)}async cache(e,t){var a;(a=s(this,Bi)).__cache??(a.__cache={}),d(this,Wt,s(this,Bi).__cache),P(this,K,Qb).call(this,t);let i=P(this,K,$b).call(this,t.key);if(i!==void 0)return i;let n=await P(this,K,hm).call(this,t.key),o=await P(this,K,Kb).call(this,t,n,e);return Jb(o)}};jt=new WeakMap,Wt=new WeakMap,Ne=new WeakMap,Bi=new WeakMap,K=new WeakSet,$b=function(e){let t=s(this,Wt)[e];if(t){let i=s(this,Ne).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<fm&&Math.random()<Vb&&t.errorTime+zb<i;if(t?.expires&&t.expires<i&&t.checkedAt+zb<i||n){delete s(this,Wt)[e];return}else return Jb(t)}},Kb=async function(e,t,i){let n=t?.expires,o=n?P(this,K,Yb).call(this,n):1;return!t||t?.error&&t.errorCount<fm&&Vb>Math.random()||o>Math.random()?P(this,K,Xb).call(this,e,t,i):t},Xb=async function(e,t,i){let n=Gb(e.key),o=s(this,Ne).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,jt).set(n,"1",{expiration:a,nx:!0}))return P(this,K,Zb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Ne).now();return P(this,K,gm).call(this,p,e.key,e.ttl)}},gm=async function(e,t,i){let n=Math.min(i,aO),o=await P(this,K,hm).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,oO)),P(this,K,gm).call(this,e,t,i)},Zb=async function(e,t,i,n){let o=s(this,Ne).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Ne).now().getTime(),t.errorCount++}return s(this,Wt)[e]=t,await s(this,jt).set(Wb(e),JSON.stringify(t),{expiration:new Date(o+dO)}),t.error&&t.errorCount<fm&&await s(this,jt).del(Gb(e)),t},Yb=function(e){let t=s(this,Ne).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},hm=async function(e){let t=await s(this,jt).get(Wb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Ne).now().getTime(),s(this,Wt)[e]=i,i}},Qb=function(e){e.ttl<_d&&(console.warn(`Cache TTL cannot be less than ${_d} milliseconds! Updating ttl value of ${e.ttl} to ${_d}.`),e.ttl=_d)};function ek(r,e,t=vm){let i=new Nd(r,e,t);return i.cache.bind(i)}var qd=class{buildContext(e,t,i){let n=new mi(i),o=new ui(i),a=new vi(i),c=new gi(i),p=new yi(i),f=new bi(i),v=new Bd(e),m=new ci(i),b=new di,y=new pi(i),C=ek(a,e._state),I={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:f,media:m,assets:b,realtime:y,ui:v,useState:pm,useChannel:sm,useInterval:dm,useForm:tm,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[D.Timezone]?.values[0],locale:i[D.Language]?.values[0],dimensions:t.env?.dimensions}},A=le(i,t.props?.postId);return A.debug.effects=e,{...A,...I}}};var be=null;function tk(r){return JSON.parse(JSON.stringify(r))}function lO(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 uO(r){return r.blocking||r.resize?!1:!r.hook}function Ke(r,e){if(!be)throw new Error("Hooks can only be declared at the top of a component. You cannot declare hooks outside of components or inside of event handlers. It's almost always a mistake to declare hooks inside of loops or conditionals.");lO(r.namespace);let t=be.nextHookId(r),i=be;i._touched[t]=!0;let n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:be},o=be._state[t]===void 0||qb(be._state[t]);be._hooks[t]=be._hooks[t]??e(n);let a=be._hooks[t];return o||(a.state=be._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var cO=null,Di,Gd,Ts,T,ke,Hd,rk,ym,ik,bm,km,jd,Pm,nk,Wd=class{constructor(e){l(this,T);l(this,Di);l(this,Gd,new qd);l(this,Ts,new wi(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,T,ke)&&console.debug("[blocks] BlocksHandler v1"),d(this,Di,e),cO=this}async handle(e,t){let i=new Oi(e,t),n=s(this,Gd).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(y=>!y.async),f=a.some(y=>y.blocking),v,m,b=[...a];for(a.length===0&&a.push({}),s(this,T,ke)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,T,ke)&&console.debug("[blocks] processing events loop iteration",a.length);let y=[];if(!a[0].async)y.push(a.shift());else for(;a[0]?.async;)y.push(a.shift());if(!y.length)throw Error("batch must have at least one event");try{if(y[0].async){let I=tk(i._state);await P(this,T,rk).call(this,i,...y),i._state=I}else await P(this,T,ik).call(this,i,...y)}catch(I){if(!Hb(I))throw I;if(s(this,T,ke)&&console.debug("[blocks] caught in handler",I),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let A=b.map(M=>{let ce={...M};return ce.retry=!0,ce});i.addToRequeueEvents(...A);break}else throw console.error("[blocks] unhandled error in handler",I),I}s(this,T,ke)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let I of i._requeueEvents){if(!p&&!I.async){s(this,T,ke)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",I),C.push(I);continue}if(p&&I.async&&!f){s(this,T,ke)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",I),C.push(I);continue}s(this,T,ke)&&console.debug("[blocks] reprocessing event in BlocksHandler",I),a.push(I)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:tk(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=P(this,T,bm).call(this,s(this,Di),i.request.props??{},i));let y=i._latestRenderContent;y&&(o=s(this,Ts).createBlocksElementOrThrow(y),o=s(this,Ts).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Di=new WeakMap,Gd=new WeakMap,Ts=new WeakMap,T=new WeakSet,ke=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Hd=function(e,...t){e._touched={},P(this,T,bm).call(this,s(this,Di),e.request.props??{},e);for(let i in e._hooks)e._touched[i]||delete e._hooks[i]},rk=async function(e,...t){P(this,T,Hd).call(this,e,...t),await Promise.all(t.map(async i=>{if(!i.async)throw new Error("You can't mix main and other queues in one batch. This is likely a platform bug. Please file an issue in the Discord for someone to help! https://discord.com/channels/1050224141732687912/1115441897079574620");await P(this,T,ym).call(this,e,i)}))},ym=async function(e,t){uO(t)&&console.warn("Received an event in #attemptHook that does not have an associated hook. This will cause the event to be undelivered and may cause bugs. Make sure that event passes a hook field. Event:",{event:t});let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},ik=async function(e,...t){for(let i of t)s(this,T,ke)&&console.log("[blocks] handling main queue event",i),s(this,T,ke)&&console.log("[blocks] before",e._state),P(this,T,Hd).call(this,e,i),await P(this,T,ym).call(this,e,i),s(this,T,ke)&&console.log("[blocks] after",e._state);P(this,T,Hd).call(this,e)},bm=function(e,t,i){s(this,T,ke)&&console.debug("[blocks] renderRoot"),i._generated={},be=i,this._latestRenderContext=i;try{let n=P(this,T,km).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 asynchronous. To use data from an async endpoint, please use "const [data] = context.useState(async () => {/** your async code */})".');if(typeof o=="string")throw new Error("The root element must return a valid block, not a string. Try wrapping the element in a <text>your content</text> tag to continue.");return i._latestRenderContent=o,o}catch(n){if(n instanceof Ir)return;throw n}finally{be=null}},km=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);return P(this,T,Pm).call(this,n,i)}finally{i.pop()}},jd=function(e,t){return e=e.flat(1/0),e.flatMap((i,n)=>(i&&typeof i=="object"&&"props"in i&&(i.props?.key||(i.props=i.props??{},i.props.key=`${n}`)),P(this,T,Pm).call(this,i,t)))},Pm=function(e,t){if(Array.isArray(e))return P(this,T,jd).call(this,e,t);if(mO(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=P(this,T,jd).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return P(this,T,km).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=P(this,T,jd).call(this,e.children,t),n=P(this,T,nk).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},nk=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Ke({namespace:i,key:!1},({hookId:o})=>({hookId:o,state:null,onUIEvent:e[i]}));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 mO(r){return typeof r=="object"&&r!=null&&"type"in r}var pO=[[sk,sk.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null]];function fO(r){return async(e,t)=>new Wd(r).handle(e,t)}function ok(r){for(let[e,t,i]of pO)r.provides(e),U(t.name,fO(i))}var _i,Es,Ni,Tr,Er,qi,Hi,Rr,Gt,Rs,Os,Or,N,B=class B extends cd{static configure(e){d(this,Ni,{...s(this,Ni),...e}),ft(e.http)&&this.use(S.HTTPDefinition),(ft(e.kvStore)||ft(e.redis))&&(this.use(S.KVStoreDefinition),this.use(S.RedisAPIDefinition)),ft(e.media)&&this.use(S.MediaServiceDefinition),ft(e.modLog)&&this.use(S.ModlogDefinition),ft(e.redditAPI)&&(this.use(S.FlairDefinition),this.use(S.GraphQLDefinition),this.use(S.LinksAndCommentsDefinition),this.use(S.ListingsDefinition),this.use(S.ModerationDefinition),this.use(S.ModNoteDefinition),this.use(S.NewModmailDefinition),this.use(S.PrivateMessagesDefinition),this.use(S.SubredditsDefinition),this.use(S.PostCollectionsDefinition),this.use(S.UsersDefinition),this.use(S.WidgetsDefinition),this.use(S.WikiDefinition),this.use(S.RedditAPIV2Definition)),ft(e.realtime)&&this.use(S.RealtimeDefinition)}static addMenuItem(e){s(this,Hi).push(e)}static addCustomPostType(e){d(this,Tr,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,N)[S.SchedulerDefinition.fullName]||this.use(S.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){mr(e);let t=e.filter(n=>n.type==="group"||!n.scope||n.scope==="installation"),i=e.filter(n=>n.type!=="group"&&n.scope==="app");t.length>0&&d(this,qi,t),i.length>0&&d(this,_i,i),s(this,N)[S.SettingsDefinition.fullName]||this.use(S.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]),B}static provide(e){s(this,Os).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,N)[e.fullName]=i,i}static get redditAPIPlugins(){if(!ft(s(this,Ni).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,N)[S.FlairDefinition.fullName],GraphQL:s(this,N)[S.GraphQLDefinition.fullName],LinksAndComments:s(this,N)[S.LinksAndCommentsDefinition.fullName],Listings:s(this,N)[S.ListingsDefinition.fullName],Moderation:s(this,N)[S.ModerationDefinition.fullName],ModNote:s(this,N)[S.ModNoteDefinition.fullName],NewModmail:s(this,N)[S.NewModmailDefinition.fullName],PrivateMessages:s(this,N)[S.PrivateMessagesDefinition.fullName],Subreddits:s(this,N)[S.SubredditsDefinition.fullName],PostCollections:s(this,N)[S.PostCollectionsDefinition.fullName],Users:s(this,N)[S.UsersDefinition.fullName],Widgets:s(this,N)[S.WidgetsDefinition.fullName],Wiki:s(this,N)[S.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,N)[S.ModlogDefinition.fullName];if(!e)throw new Error("ModLog is not enabled. You can enable it by passing `modLog: true` to `Devvit.configure`");return e}static get schedulerPlugin(){let e=s(this,N)[S.SchedulerDefinition.fullName];if(!e)throw new Error("Scheduler is not enabled. You can enable it by calling `Devvit.addSchedulerJob` at the top level of your app.");return e}static get kvStorePlugin(){let e=s(this,N)[S.KVStoreDefinition.fullName];if(!e)throw new Error("Key Value Store is not enabled. You can enable it by passing `kvStore: true` to `Devvit.configure`");return e}static get redisPlugin(){let e=s(this,N)[S.RedisAPIDefinition.fullName];if(!e)throw new Error("Redis is not enabled. You can enable it by passing `redis: true` to `Devvit.configure`");return e}static get mediaPlugin(){let e=s(this,N)[S.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get redditapiv2Plugin(){let e=s(this,N)[S.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,N)[S.SettingsDefinition.fullName];if(!e)throw new Error("Settings must first be configured with `Devvit.addSettings()` before they can be accessed");return e}static get realtimePlugin(){let e=s(this,N)[S.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,Hi)}static get customPostType(){return s(this,Tr)}static get formDefinitions(){return s(this,Er)}static get scheduledJobHandlers(){return s(this,Rr)}static get installationSettings(){return s(this,qi)}static get appSettings(){return s(this,_i)}static get triggerOnEventHandlers(){return s(this,Gt)}static get assets(){return s(this,Es)}static get webviewAssets(){return s(this,Rs)}constructor(e){super(e),d(B,Es,e.assets??{}),d(B,Rs,e.webviewAssets??{});for(let t in s(B,Or)){let i=s(B,Or)[t];i.handler=e.use(i.def,i.options)}s(B,Hi).length>0&&_y(e),s(B,Rr).size>0&&Ny(e),s(B,Tr)&&(Uy(e),ok(e)),(s(B,Tr)||s(B,Er).size>0)&&Ub(e),s(B,qi)&&By(e),s(B,_i)&&py(e),s(B,Gt).size>0&&qy(e);for(let t of s(B,Os))e.provides(t)}};_i=new WeakMap,Es=new WeakMap,Ni=new WeakMap,Tr=new WeakMap,Er=new WeakMap,qi=new WeakMap,Hi=new WeakMap,Rr=new WeakMap,Gt=new WeakMap,Rs=new WeakMap,Os=new WeakMap,Or=new WeakMap,N=new WeakMap,B.debug={},l(B,_i),l(B,Es,{}),l(B,Ni,{}),l(B,Tr),l(B,Er,new Map),l(B,qi),l(B,Hi,[]),l(B,Rr,new Map),l(B,Gt,new Map),l(B,Rs,{}),l(B,Os,[]),l(B,Or,{}),l(B,N,{});var u=B;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function X(r){let e=Object.getOwnPropertyDescriptors(r.constructor.prototype);for(let[t,i]of Object.entries(e))i.get&&Object.defineProperty(r,t,{...i,enumerable:!0})}var Sm;(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"})(Sm||(Sm={}));var ak="text",dk="raw",lk="br",uk="link",ck="c/",mk="p/",pk="r/",fk="u/",gk="@",hk="spoilertext",vk="par",yk="h",bk="hr",kk="blockquote",Pk="code",Sk="li",Ck="list",Ik="L",wk="R",xk="C",Ak="table",Tk="embed",Ek="img",Rk="gif",Ok="video";function Fk(r){return{e:Rk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Mk(r,e){let t={},i=[];return Object.assign(t,Fs(t,i),Ms(t,i),Ls(t,i),Ds(t,i),_s(t,i),Ns(t,i)),e(t),{e:kk,c:i,...r.author&&{a:r.author}}}function Lk(r,e){let t={},i=[];return Object.assign(t,Im(t,i)),e(t),{e:Pk,c:i,...r.language&&{l:r.language}}}function Uk(r){return{e:ck,t:r.permalink}}function Bk(r,e){let t={},i=[];return Object.assign(t,Im(t,i),Bs(t,i)),e(t),{e:yk,l:r.level,c:i}}function Dk(r){return{e:Tk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function _k(){return{e:bk}}function Nk(r){return{e:Ek,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function qk(){return{e:lk}}function Hk(r){return{e:uk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function jk(r,e){let t={},i=[];return Object.assign(t,nP(t,i)),e(t),{e:Ck,o:r.ordered,c:i}}function Wk(r){let e={},t=[];return Object.assign(e,Fs(e,t),Ms(e,t),Ls(e,t),Vd(e,t),Ds(e,t),_s(e,t),Ns(e,t)),r(e),{e:Sk,c:t}}function Gk(r){let e={},t=[];return Object.assign(e,zd(e,t),Bs(e,t),Cm(e,t),wm(e,t),Us(e,t)),r(e),{e:vk,c:t}}function Vk(r){return{e:mk,t:r.permalink}}function zk(r){return{e:dk,t:r}}function Jk(r){let e={},t=[];return Object.assign(e,zd(e,t),Bs(e,t),Cm(e,t)),r(e),{e:hk,c:t}}function $k(r){return{e:pk,t:r.subredditName,l:r.showPrefix}}function Kk(r){let e={},t=[],i=[];return Object.assign(e,sP(e,t,i)),r(e),{e:Ak,h:t,c:i}}function Xk(r){let[e,t]=iP();return r(e),{c:t}}function Zk(r,e){let[t,i]=iP();e(t);let n;switch(r.columnAlignment){case"left":n=Ik;break;case"right":n=wk;break;case"center":n=xk;break}return{...n&&{a:n},...i&&{c:i}}}function Yk(r){let e={},t=[];return Object.assign(e,oP(e,t)),r(e),t}function Qk(r){return{e:ak,t:r.text,...r.formatting&&{f:r.formatting}}}function eP(r){return{e:fk,t:r.username,l:r.showPrefix}}function tP(r){return{e:gk,t:r.username,l:r.showPrefix}}function rP(r){return{e:Ok,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function iP(){let r={},e=[];return Object.assign(r,zd(r,e),Bs(r,e),wm(r,e),Us(r,e)),[r,e]}function Fs(r,e){return{blockQuote(t,i){return e.push(Mk(t,i)),r}}}function Ms(r,e){return{codeBlock(t,i){return e.push(Lk(t,i)),r}}}function aP(r,e){return{embed(t){return e.push(Dk(t)),r}}}function Ls(r,e){return{heading(t,i){return e.push(Bk(t,i)),r}}}function Vd(r,e){return{horizontalRule(){return e.push(_k()),r}}}function Us(r,e){return{image(t){return e.push(Nk(t)),r},animatedImage(t){return e.push(Fk(t)),r}}}function Cm(r,e){return{linebreak(){return e.push(qk()),r}}}function Bs(r,e){return{link(t){return e.push(Hk(t)),r},commentLink(t){return e.push(Uk(t)),r},postLink(t){return e.push(Vk(t)),r},subredditLink(t){return e.push($k(t)),r},userLink(t){return e.push(eP(t)),r},userMention(t){return e.push(tP(t)),r}}}function Ds(r,e){return{list(t,i){return e.push(jk(t,i)),r}}}function nP(r,e){return{item(t){return e.push(Wk(t)),r}}}function _s(r,e){return{paragraph(t){return e.push(Gk(t)),r}}}function Im(r,e){return{rawText(t){return e.push(zk(t)),r}}}function wm(r,e){return{spoiler(t){return e.push(Jk(t)),r}}}function sP(r,e,t){return{headerCell(i,n){return e.push(Zk(i,n)),r},row(i){return t.push(Yk(i)),r}}}function Ns(r,e){return{table(t){return e.push(Kk(t)),r}}}function oP(r,e){return{cell(t){return e.push(Xk(t)),r}}}function zd(r,e){return{text(t){return e.push(Qk(t)),r}}}function dP(r,e){return{video(t){return e.push(rP(t)),r}}}var gO=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},hO=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)},Jd,qs=class{constructor(){Jd.set(this,void 0);let e=[];Object.assign(this,_s(this,e),Ls(this,e),Vd(this,e),Fs(this,e),Ms(this,e),aP(this,e),Ds(this,e),Ns(this,e),Us(this,e),dP(this,e)),gO(this,Jd,{document:e},"f")}build(){return JSON.stringify(hO(this,Jd,"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}};Jd=new WeakMap;function ji(r){let e;return r instanceof qs?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var lP=100,uP=1/0,Fr,Mr,Vt,Wi,Gi,$d,W=class{constructor(e){l(this,Gi);l(this,Fr);l(this,Mr);l(this,Vt);l(this,Wi,!1);this.pageSize=lP;this.limit=uP;this.children=[];X(this),this._fetch=e.fetch,this.pageSize=e.pageSize??lP,this.limit=e.limit??uP,d(this,Mr,e.after),d(this,Fr,e.before),d(this,Vt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Wi)||!!(s(this,Mr)||s(this,Fr)||s(this,Vt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await P(this,Gi,$d).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,Wi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await P(this,Gi,$d).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 P(this,Gi,$d).call(this);return this.children.slice(0,t)}};Fr=new WeakMap,Mr=new WeakMap,Vt=new WeakMap,Wi=new WeakMap,Gi=new WeakSet,$d=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,Fr),after:s(this,Mr),limit:this.pageSize,more:s(this,Vt)});return this.children.push(...e),d(this,Fr,t),d(this,Mr,i),d(this,Vt,n),d(this,Wi,!0),e};function vO(r){try{return!0}catch{return!1}}function yO(r){try{return!0}catch{return!1}}var Hs,xm,Le=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new W({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>P(this,Hs,xm).call(this,a))||[],before:o.hasNextPage?o.endCursor:void 0,hasMore:o.hasNextPage}}})}static async delete(e,t){let i=u.redditAPIPlugins.ModNote,{deleted:n}=await i.DeleteNotes(e,t);return!!n}static async add(e,t){let n=await u.redditAPIPlugins.ModNote.PostNotes(e,t);if(!n?.created)throw new Error("Failed to create mod note");return P(this,Hs,xm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Hs=new WeakSet,xm=function(e){if(g(e.id,"Mod note ID is null or undefined"),g(e.createdAt,"Mod note createdAt is null or undefined"),g(e.type,"Mod note type is null or undefined"),g(e.subreddit,"Mod note subreddit is null or undefined"),g(e.subredditId,"Mod note subredditId is null or undefined"),g(e.operator,"Mod note operator is null or undefined"),g(e.operatorId,"Mod note operatorId is null or undefined"),g(e.user,"Mod note user is null or undefined"),g(e.userId,"Mod note userId is null or undefined"),g(e.userNoteData,"Mod note userNote is null or undefined"),g(e.modActionData,"Mod note modAction is null or undefined"),!vO(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!yO(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ne(e.userId??""),name:e.user},subreddit:{id:Oe(e.subredditId??""),name:e.subreddit},operator:{id:ne(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:he(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Le,Hs);var bt=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 cP=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_community","chat_operator"];function bO(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function Am(r){return bO(r,cP,!0)}function mP(r){return r.filter(e=>cP.includes(e))}var kO=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(kO||{}),Ur,Vi,zi,Ji,$i,Ki,Xi,Zi,Yi,Qi,en,Kd,Xe=class Xe{constructor(e,t,i){l(this,Ur);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Yi);l(this,Qi);X(this),g(e.id),g(e.text),d(this,Ur,e.id),d(this,Vi,t),d(this,zi,e.text),d(this,Ji,PO(e.textColor)),d(this,$i,SO(e.backgroundColor)),d(this,Ki,CO(e.allowableContent)),d(this,Xi,e.modOnly),d(this,Zi,e.maxEmojis),d(this,Yi,e.textEditable),d(this,Qi,i)}get id(){return s(this,Ur)}get text(){return s(this,zi)}get textColor(){return s(this,Ji)}get backgroundColor(){return s(this,$i)}get allowableContent(){return s(this,Ki)}get modOnly(){return s(this,Xi)}get maxEmojis(){return s(this,Zi)}get allowUserEdits(){return s(this,Yi)}async delete(){return Xe.deleteFlairTemplate(s(this,Ur),s(this,Vi),s(this,Qi))}async edit(e){return Xe.editFlairTemplate({id:s(this,Ur),subredditName:s(this,Vi),text:e.text??s(this,zi),allowableContent:e.allowableContent??s(this,Ki),backgroundColor:e.backgroundColor??s(this,$i),maxEmojis:e.maxEmojis??s(this,Zi),modOnly:e.modOnly??s(this,Xi),textColor:e.textColor??s(this,Ji),allowUserEdits:e.allowUserEdits??s(this,Yi)},s(this,Qi))}static async createPostFlairTemplate(e,t){var i;return P(i=Xe,en,Kd).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return P(i=Xe,en,Kd).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return P(i=Xe,en,Kd).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Xe(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Xe(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Ur=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,en=new WeakSet,Kd=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:f,textColor:v="dark",allowUserEdits:m=!1,id:b=""}=e;if(p&&m)throw new Error("Cannot have a mod only flair that is editable by users");let C=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:f,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Xe(C,i,t)},l(Xe,en);var de=Xe;function js(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var zt,Tm,Em,Lr=class Lr{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return P(i=Lr,zt,Tm).call(i,e,t)}static setPostFlair(e,t){var i;return P(i=Lr,zt,Tm).call(i,{...e,postId:ge(e.postId)},t)}static async removePostFlair(e,t,i){var n;return P(n=Lr,zt,Em).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return P(n=Lr,zt,Em).call(n,e,void 0,t,i)}};zt=new WeakSet,Tm=async function(e,t){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e.subredditName,flairTemplateId:e.flairTemplateId??"",text:e.text??"",name:e.username,link:e.postId,backgroundColor:e.backgroundColor??"",textColor:e.textColor??"dark",cssClass:e.cssClass??"",returnRtjson:"none"},t)},Em=async function(e,t,i,n){await u.redditAPIPlugins.Flair.SelectFlair({subreddit:e,name:i??"",link:t??"",flairTemplateId:"",backgroundColor:"",text:"",textColor:"",cssClass:"",returnRtjson:"none"},n)},l(Lr,zt);var Ue=Lr;function PO(r){if(g(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function SO(r){if(g(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function CO(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as OO}from"@devvit/protos";var hP=Nn(gP(),1);var tn,Gs,rn,Vs,zs,Js,$s,Ks,nn,Xs,Zs,Ys,Qs,eo,to,Jt,ro,io,Dr,sn,$t,on,an,dn,_r,Kt,Xt,ln,Zt,Yt,Qt,kt,no,so,un,cn,_,H=class H{constructor(e,t){l(this,tn);l(this,Gs);l(this,rn);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,Ks);l(this,nn);l(this,Xs);l(this,Zs);l(this,Ys);l(this,Qs);l(this,eo);l(this,to);l(this,Jt);l(this,ro);l(this,io);l(this,Dr);l(this,sn);l(this,$t);l(this,on);l(this,an);l(this,dn);l(this,_r);l(this,Kt);l(this,Xt);l(this,ln);l(this,Zt);l(this,Yt);l(this,Qt);l(this,kt);l(this,no);l(this,so);l(this,un);l(this,cn);l(this,_);X(this),g(e.id,"Post is missing id"),g(e.title,"Post is missing title"),g(e.createdUtc,"Post is missing created date"),g(e.author,"Post is missing author name"),g(e.subreddit,"Post is missing subreddit name"),g(e.subredditId,"Post is missing subreddit id"),g(e.url,"Post is missing url"),g(e.permalink,"Post is missing permalink"),d(this,tn,ge(`t3_${e.id}`)),d(this,rn,e.author),d(this,Gs,e.authorFullname?ne(e.authorFullname):void 0),d(this,zs,Oe(e.subredditId)),d(this,Js,e.subreddit),d(this,Ys,e.score??0),d(this,Qs,e.numComments??0),d(this,eo,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Vs,i),d(this,Ks,e.title),d(this,nn,e.selftext),d(this,Xs,e.selftextHtml),d(this,Zs,e.url),d(this,$s,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,to,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,Jt,e.approved??!1),d(this,ro,e.approvedAtUtc??0),d(this,io,e.bannedAtUtc??0),d(this,$t,e.removed??!1),d(this,on,e.removedBy),d(this,an,e.removedByCategory),d(this,Dr,e.spam??!1),d(this,sn,e.stickied??!1),d(this,dn,e.archived??!1),d(this,_r,e.edited??!1),d(this,Kt,e.locked??!1),d(this,Xt,e.over18??!1),d(this,ln,e.quarantine??!1),d(this,Zt,e.spoiler),d(this,Yt,e.hidden??!1),d(this,Qt,e.ignoreReports??!1),d(this,kt,e.distinguished),d(this,so,e.secureMedia),d(this,un,(e.modReports??[]).map(([n])=>n)),d(this,cn,(e.userReports??[]).map(([n])=>n)),d(this,_,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,no,{backgroundColor:e.linkFlairBackgroundColor,cssClass:e.linkFlairCssClass,text:e.linkFlairText,type:e.linkFlairType,templateId:e.linkFlairTemplateId,richtext:(e.linkFlairRichtext??[]).map(({e:n,t:o,a,u:c})=>({elementType:n,text:o,emojiRef:a,url:c})),textColor:e.linkFlairTextColor})}get id(){return s(this,tn)}get authorId(){return s(this,Gs)}get authorName(){return s(this,rn)}get subredditId(){return s(this,zs)}get subredditName(){return s(this,Js)}get permalink(){return s(this,$s)}get title(){return s(this,Ks)}get body(){return s(this,nn)}get bodyHtml(){return s(this,Xs)}get url(){return s(this,Zs)}get thumbnail(){return s(this,to)}get createdAt(){return s(this,Vs)}get score(){return s(this,Ys)}get numberOfComments(){return s(this,Qs)}get numberOfReports(){return s(this,eo)}get approved(){return s(this,Jt)}get approvedAtUtc(){return s(this,ro)}get bannedAtUtc(){return s(this,io)}get spam(){return s(this,Dr)}get stickied(){return s(this,sn)}get removed(){return s(this,$t)}get removedBy(){return s(this,on)}get removedByCategory(){return s(this,an)}get archived(){return s(this,dn)}get edited(){return s(this,_r)}get locked(){return s(this,Kt)}get nsfw(){return s(this,Xt)}get quarantined(){return s(this,ln)}get spoiler(){return s(this,Zt)}get hidden(){return s(this,Yt)}get ignoringReports(){return s(this,Qt)}get distinguishedBy(){return s(this,kt)}get comments(){return Q.getComments({postId:this.id},s(this,_))}get flair(){return s(this,no)}get secureMedia(){return s(this,so)}get userReportReasons(){return s(this,cn)}get modReportReasons(){return s(this,un)}toJSON(){return{id:this.id,authorId:this.authorId,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,permalink:this.permalink,title:this.title,body:this.body,bodyHtml:this.bodyHtml,url:this.url,thumbnail:this.thumbnail,score:this.score,numberOfComments:this.numberOfComments,numberOfReports:this.numberOfReports,createdAt:this.createdAt,approved:this.approved,spam:this.spam,stickied:this.stickied,removed:this.removed,removedBy:s(this,on),removedByCategory:s(this,an),archived:this.archived,edited:this.edited,locked:this.locked,nsfw:this.nsfw,quarantined:this.quarantined,spoiler:this.spoiler,hidden:this.hidden,ignoringReports:this.ignoringReports,distinguishedBy:this.distinguishedBy,flair:this.flair,secureMedia:this.secureMedia,modReportReasons:s(this,un),userReportReasons:s(this,cn)}}isApproved(){return s(this,Jt)}isSpam(){return s(this,Dr)}isStickied(){return s(this,sn)}isRemoved(){return s(this,$t)}isArchived(){return s(this,dn)}isEdited(){return s(this,_r)}isLocked(){return s(this,Kt)}isNsfw(){return s(this,Xt)}isQuarantined(){return s(this,ln)}isSpoiler(){return s(this,Zt)}isHidden(){return s(this,Yt)}isIgnoringReports(){return s(this,Qt)}isDistinguishedBy(){return s(this,kt)}async edit(e){let t=await H.edit({id:this.id,...e},s(this,_));d(this,nn,t.body),d(this,_r,t.edited)}async addComment(e){return Q.submit({id:this.id,...e},s(this,_))}async delete(){return H.delete(this.id,s(this,_))}async approve(){await H.approve(this.id,s(this,_)),d(this,Jt,!0),d(this,$t,!1)}async remove(e=!1){await H.remove(this.id,e,s(this,_)),d(this,$t,!0),d(this,Dr,e),d(this,Jt,!1)}async lock(){await H.lock(this.id,s(this,_)),d(this,Kt,!0)}async unlock(){await H.unlock(this.id,s(this,_)),d(this,Kt,!1)}async hide(){await H.hide(this.id,s(this,_)),d(this,Yt,!0)}async unhide(){await H.unhide(this.id,s(this,_)),d(this,Yt,!1)}async markAsNsfw(){await H.markAsNsfw(this.id,s(this,_)),d(this,Xt,!0)}async unmarkAsNsfw(){await H.unmarkAsNsfw(this.id,s(this,_)),d(this,Xt,!1)}async markAsSpoiler(){await H.markAsSpoiler(this.id,s(this,_)),d(this,Zt,!0)}async unmarkAsSpoiler(){await H.unmarkAsSpoiler(this.id,s(this,_)),d(this,Zt,!1)}async sticky(e){await H.sticky(this.id,e,s(this,_))}async unsticky(){await H.unsticky(this.id,s(this,_))}async distinguish(){let{distinguishedBy:e}=await H.distinguish(this.id,!1,s(this,_));d(this,kt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await H.distinguish(this.id,!0,s(this,_));d(this,kt,e)}async undistinguish(){let{distinguishedBy:e}=await H.undistinguish(this.id,s(this,_));d(this,kt,e)}async ignoreReports(){await H.ignoreReports(this.id,s(this,_)),d(this,Qt,!0)}async unignoreReports(){await H.unignoreReports(this.id,s(this,_)),d(this,Qt,!1)}async getAuthor(){return w.getByUsername(s(this,rn),s(this,_))}async crosspost(e){return H.crosspost({...e,postId:this.id},s(this,_))}addRemovalNote(e){return Le.addRemovalNote({itemIds:[s(this,tn)],...e},s(this,_))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=cr(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new H(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){g(t,"Missing metadata in `SubmitPostOptions`");let c=await new pt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=OO.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,hP.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?ji(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return H.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=u.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,c=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:ge(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return H.getById(`t3_${c.json.data.id}`,t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=ji(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return H.getById(n,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await u.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await u.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:t?"admin":"yes",sticky:!1},i)).json?.data?.things?.[0]?.data;return g(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 g(o),{distinguishedBy:o.distinguished}}static async ignoreReports(e,t){await u.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await u.redditAPIPlugins.Moderation.UnignoreReports({id:e},t)}static getControversialPosts(e={},t){return this.getSortedPosts({...e,sort:"controversial"},t)}static getTopPosts(e={},t){return this.getSortedPosts({...e,sort:"top"},t)}static getSortedPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ws(o,t)}})}};tn=new WeakMap,Gs=new WeakMap,rn=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,Ks=new WeakMap,nn=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,to=new WeakMap,Jt=new WeakMap,ro=new WeakMap,io=new WeakMap,Dr=new WeakMap,sn=new WeakMap,$t=new WeakMap,on=new WeakMap,an=new WeakMap,dn=new WeakMap,_r=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,ln=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,kt=new WeakMap,no=new WeakMap,so=new WeakMap,un=new WeakMap,cn=new WeakMap,_=new WeakMap;var z=H;function Ws(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 FO=(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))(FO||{}),oo,mn,ao,lo,uo,co,mo,er,po,fo,ot,Nr=class Nr{constructor(e,t){l(this,oo);l(this,mn);l(this,ao);l(this,lo);l(this,uo);l(this,co);l(this,mo);l(this,er,new Map);l(this,po);l(this,fo);l(this,ot);X(this),g(e.id,"User ID is missing or undefined"),g(e.name,"Username is missing or undefined"),g(e.createdUtc,"User is missing created date"),d(this,oo,ne(ud(e.id)?e.id:`t2_${e.id}`)),d(this,mn,e.name),d(this,co,e.over18??!1),d(this,mo,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,ao,i),d(this,lo,e.linkKarma??0),d(this,uo,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,er).set(n,mP(o));d(this,po,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,fo,e.subreddit?.url??""),d(this,ot,t)}get id(){return s(this,oo)}get username(){return s(this,mn)}get createdAt(){return s(this,ao)}get linkKarma(){return s(this,lo)}get commentKarma(){return s(this,uo)}get nsfw(){return s(this,co)}get isAdmin(){return s(this,mo)}get modPermissions(){return s(this,er)}get url(){return s(this,po)}get permalink(){return s(this,fo)}toJSON(){return{id:this.id,username:this.username,createdAt:this.createdAt,linkKarma:this.linkKarma,commentKarma:this.commentKarma,nsfw:this.nsfw,modPermissionsBySubreddit:Object.fromEntries(this.modPermissions)}}async getModPermissionsForSubreddit(e){if(s(this,er).has(e))return s(this,er).get(e);let t=await Nr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ot)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,er).set(e,i),i}getComments(e){return Q.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,mn)},s(this,ot));return t.users[0]?js(t.users[0]):void 0}getSnoovatarUrl(){return Nr.getSnoovatarUrl(this.username,s(this,ot))}async getSocialLinks(){let i=await bt.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:Nr.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new Nr(n.data,t)}static async getFromMetadata(e,t){g(t);let i=t?.[e]?.values[0];return i?Nr.getById(ne(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new W({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return LO(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,f=await i.Friend({type:n,subreddit:o,name:a,permissions:c?Am(c):void 0,...p},t);if(f.json?.errors?.length)throw new Error(f.json.errors.join(`
4
- `))}static async removeRelationship(e,t){await u.redditAPIPlugins.Users.Unfriend({type:e.type,subreddit:e.subredditName,name:e.username},t)}static async setModeratorPermissions(e,t,i,n){let a=await u.redditAPIPlugins.Users.SetPermissions({subreddit:t,name:e,type:"moderator",permissions:Am(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
5
- `))}static async getSnoovatarUrl(e,t){return(await bt.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"overview",...n},t);return MO(o,t)}})}};oo=new WeakMap,mn=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=new WeakMap,co=new WeakMap,mo=new WeakMap,er=new WeakMap,po=new WeakMap,fo=new WeakMap,ot=new WeakMap;var w=Nr;function MO(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new z(i.data,e);if(i.kind==="t1")return new Q(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function LO(r,e,t){let i=u.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(v=>(g(v.data?.id,"User id is still from listing data"),v.data.id)),o=100,a=[];for(let v=0;v<n.length;v+=o)a.push(n.slice(v,v+o));let p=(await Promise.all(a.map(v=>i.UserDataByAccountIds({ids:v.join(",")},t)))).reduce((v,m)=>({...v,...m.users}),{});return{children:r.data.children.map(v=>{let m=v.data?.id;g(m,"User id is missing from listing");let b=p[m];return g(b,"User data is missing from response"),new w({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:v.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var qr,go,pn,fn,ho,vo,gn,yo,bo,hn,tr,ko,Po,Hr,rr,ir,Pt,jr,St,So,Co,Io,wo,xo,Ao,To,te,at,Zd,Yd,G=class G{constructor(e,t){l(this,qr);l(this,go);l(this,pn);l(this,fn);l(this,ho);l(this,vo);l(this,gn);l(this,yo);l(this,bo);l(this,hn);l(this,tr);l(this,ko);l(this,Po);l(this,Hr);l(this,rr);l(this,ir);l(this,Pt);l(this,jr);l(this,St);l(this,So);l(this,Co);l(this,Io);l(this,wo);l(this,xo);l(this,Ao);l(this,To);l(this,te);var n;X(this),g(e.id,"Comment id is null or undefined"),g(e.body,"Comment body is null or undefined"),g(e.createdUtc,"Comment is missing created date"),g(e.author,"Comment author is null or undefined"),g(e.parentId,"Comment parentId is null or undefined"),g(e.linkId,"Comment linkId is null or undefined"),g(e.permalink,"Comment permalink is null or undefined"),g(e.subreddit,"Comment is missing subreddit name"),g(e.subredditId,"Comment is missing subreddit id"),d(this,qr,ii(`t1_${e.id}`)),d(this,go,e.authorFullname?ne(e.authorFullname):void 0),d(this,pn,e.author),d(this,fn,e.body),d(this,yo,Oe(e.subredditId)),d(this,bo,e.subreddit),d(this,vo,pc(e.parentId)?ii(e.parentId):ge(e.parentId)),d(this,gn,ge(e.linkId)),d(this,Hr,e.edited??!1),d(this,rr,e.locked??!1),d(this,ir,e.removed??!1),d(this,Pt,e.stickied??!1),d(this,tr,e.approved??!1),d(this,ko,e.approvedAtUtc??0),d(this,Po,e.bannedAtUtc??0),d(this,jr,e.spam??!1),d(this,St,e.distinguished),d(this,So,e.numReports??0),d(this,Co,e.collapsedBecauseCrowdControl??!1),d(this,Io,e.score??0),d(this,wo,e.permalink),d(this,To,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,xo,(e.modReports??[]).map(([o])=>o)),d(this,Ao,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,ho,i),d(this,hn,P(n=G,at,Zd).call(n,{postId:s(this,gn),commentId:s(this,qr)},t)),d(this,te,t)}get id(){return s(this,qr)}get authorId(){return s(this,go)}get authorName(){return s(this,pn)}get subredditId(){return s(this,yo)}get subredditName(){return s(this,bo)}get body(){return s(this,fn)}get createdAt(){return s(this,ho)}get parentId(){return s(this,vo)}get postId(){return s(this,gn)}get replies(){return s(this,hn)}get distinguishedBy(){return s(this,St)}get locked(){return s(this,rr)}get stickied(){return s(this,Pt)}get removed(){return s(this,ir)}get approved(){return s(this,tr)}get approvedAtUtc(){return s(this,ko)}get bannedAtUtc(){return s(this,Po)}get spam(){return s(this,jr)}get edited(){return s(this,Hr)}get numReports(){return s(this,So)}get collapsedBecauseCrowdControl(){return s(this,Co)}get score(){return s(this,Io)}get permalink(){return s(this,wo)}get userReportReasons(){return s(this,Ao)}get modReportReasons(){return s(this,xo)}get url(){return s(this,To)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,rr)}isApproved(){return s(this,tr)}isRemoved(){return s(this,ir)}isSpam(){return s(this,jr)}isStickied(){return s(this,Pt)}isDistinguished(){return!!s(this,St)}isEdited(){return s(this,Hr)}async delete(){return G.delete(this.id,s(this,te))}async edit(e){let t=await G.edit({id:this.id,...e},s(this,te));return d(this,fn,t.body),d(this,Hr,t.edited),this}async approve(){await G.approve(this.id,s(this,te)),d(this,tr,!0),d(this,ir,!1)}async remove(e=!1){await G.remove(this.id,e,s(this,te)),d(this,ir,!0),d(this,jr,e),d(this,tr,!1)}async lock(){await G.lock(this.id,s(this,te)),d(this,rr,!0)}async unlock(){await G.unlock(this.id,s(this,te)),d(this,rr,!1)}async reply(e){return G.submit({id:this.id,...e},s(this,te))}async getAuthor(){return w.getByUsername(s(this,pn),s(this,te))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!1,s(this,te));d(this,St,t),d(this,Pt,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!0,s(this,te));d(this,St,t),d(this,Pt,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await G.undistinguish(this.id,s(this,te));d(this,St,e),d(this,Pt,t)}addRemovalNote(e){return Le.addRemovalNote({itemIds:[s(this,qr)],...e},s(this,te))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=At(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new G(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return P(a=G,at,Zd).call(a,{postId:ge(i),commentId:n?ii(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new G(c,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new G(c,t)}static async distinguish(e,t,i,n){let c=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return g(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 g(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"comments",...n},t);return g(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new G(c.data,t))||[],before:o.data.before,after:o.data.after}}})}};qr=new WeakMap,go=new WeakMap,pn=new WeakMap,fn=new WeakMap,ho=new WeakMap,vo=new WeakMap,gn=new WeakMap,yo=new WeakMap,bo=new WeakMap,hn=new WeakMap,tr=new WeakMap,ko=new WeakMap,Po=new WeakMap,Hr=new WeakMap,rr=new WeakMap,ir=new WeakMap,Pt=new WeakMap,jr=new WeakMap,St=new WeakMap,So=new WeakMap,Co=new WeakMap,Io=new WeakMap,wo=new WeakMap,xo=new WeakMap,Ao=new WeakMap,To=new WeakMap,te=new WeakMap,at=new WeakSet,Zd=function(e,t,i=0){return new W({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,y;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let C=n.more;(!o||o>100)&&(o=100);let I=C.children.splice(0,o),A=await c.MoreChildren({linkId:e.postId,children:I,sort:e.sort},t);if(!A.json?.data?.things?.length)return{children:[]};let{children:M}=P(b=G,at,Yd).call(b,A.json.data.things,e.postId,e,t);return{children:M,more:C.children.length?C:void 0}}else p=n.more.parentId,i=i+n.more.depth;let v=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],m=v[0];return p&&m?.data?.replyList?.data&&(v=m.data.replyList.data.children),P(y=G,at,Yd).call(y,v,p??e.postId,e,t,i)}})},Yd=function(e,t,i,n,o=0){var f,v;let a=[],c,p={};for(let m of e){if(!m.data||(m.data.depth!=null&&(m.data.depth=m.data.depth+o),m.data.depth!=null&&i.depth!=null&&m.data.depth>=i.depth))continue;let b=m.data.parentId?p[m.data.parentId]:void 0;if(m.kind==="t1"){if(m.data.name===t)continue;let y=new G(m.data,n);if(p[y.id]=y,d(y,hn,P(f=G,at,Zd).call(f,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:I}=P(v=G,at,Yd).call(v,m.data.replyList.data.children,y.id,i,n,o);C.length&&y.replies.children.push(...C),I&&y.replies.setMore(I)}y.replies.preventInitialFetch(),b?b.replies.children.push(y):a.push(y)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let y={parentId:pc(m.data.parentId)?ii(m.data.parentId):ge(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(y):y.parentId===t&&(c=y)}}return{children:a,more:c}},l(G,at);var Q=G;function fd(r,e){let t=u.redditAPIPlugins.Moderation;return new W({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return UO(n)}})}function UO(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:f,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:I,targetPermalink:A,targetTitle:M}=t.data;g(i,"ModAction from AboutLogResponse is missing id"),g(n,"ModAction from AboutLogResponse is missing mod"),g(o,"ModAction from AboutLogResponse is missing modId36"),g(a,"ModAction from AboutLogResponse is missing createdUtc"),g(c,"ModAction from AboutLogResponse is missing subreddit"),g(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),g(f,"ModAction from AboutLogResponse is missing action"),g(v,"ModAction from AboutLogResponse is missing srId36");let ce=new Date(0);return ce.setUTCSeconds(a),{id:i,type:f,moderatorName:n,moderatorId:`t2_${o}`,createdAt:ce,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:I?{id:I,author:y,body:C,permalink:A,title:M}:void 0}}),after:r.data.after,before:r.data.before}}var BO=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(BO||{}),DO={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},_O=(y=>(y.Highlighted="Highlighted",y.Unhighlighted="Unhighlighted",y.Archived="Archived",y.Unarchived="Unarchived",y.ReportedToAdmins="ReportedToAdmins",y.Muted="Muted",y.Unmuted="Unmuted",y.Banned="Banned",y.Unbanned="Unbanned",y.Approved="Approved",y.Disapproved="Disapproved",y.Filtered="Filtered",y.Unfiltered="Unfiltered",y))(_O||{}),NO={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},V,J,oe,vP,yP,gd=class{constructor(e){l(this,J);l(this,V);d(this,V,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,V));return n}async getConversations(e){let i=await u.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,V)),n={};for(let o in i.conversations)n[o]=P(this,J,oe).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await u.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,V));return{participantSubreddit:i.participantSubreddit,conversation:P(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=u.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,V));return t}async createConversation(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await u.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await u.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,V))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,V))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await u.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await u.redditAPIPlugins.NewModmail.TempBan({...e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await u.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,V));return{conversation:P(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,V))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,V))}};V=new WeakMap,J=new WeakSet,oe=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:DO[e.state],messages:P(this,J,vP).call(this,e,t),modActions:P(this,J,yP).call(this,e,i)}},vP=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},yP=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:NO[a.actionTypeId]})}return i};var vn,yn,Qd,Eo,Ro,Oo,Fo,Om=class Om{constructor(e,t){l(this,vn);l(this,yn);l(this,Qd);l(this,Eo);l(this,Ro);l(this,Oo);l(this,Fo);if(X(this),g(e.id,"PrivateMessage: Invalid data, no id"),g(e.name,"PrivateMessage: Invalid data, no name"),g(e.created,"PrivateMessage: Invalid data, no created date"),d(this,vn,he(e.name)),e.author!=null)d(this,yn,{type:"user",username:e.author,id:e.authorFullname?ne(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,yn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Oe(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,Eo,e.body??""),d(this,Ro,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Oo,i),d(this,Qd,e.parentId?he(e.parentId):void 0),d(this,Fo,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new W({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new Om(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await u.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,vn)}get from(){return s(this,yn)}get body(){return s(this,Eo)}get bodyHtml(){return s(this,Ro)}get created(){return s(this,Oo)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,vn)},s(this,Fo))}};vn=new WeakMap,yn=new WeakMap,Qd=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,Fo=new WeakMap;var fr=Om;var ny=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(ny||{}),bn,x,Mo,Lo,Uo,Bo,Do,_o,No,qo,Ho,kn,E,dt=class dt{constructor(e,t){l(this,bn);l(this,x);l(this,Mo);l(this,Lo);l(this,Uo);l(this,Bo);l(this,Do);l(this,_o);l(this,No);l(this,qo);l(this,Ho);l(this,kn);l(this,E);X(this),g(e.id,"Subreddit id is missing or undefined"),g(e.displayName,"Subreddit name is missing or undefined"),d(this,bn,Oe(`t5_${e.id}`)),d(this,x,e.displayName),g(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Mo,i),d(this,Lo,qO(e.subredditType)),d(this,Uo,e.title),d(this,Bo,e.description),g(e.lang,"Subreddit is missing language"),d(this,Do,e.lang),d(this,_o,e.subscribers??0),d(this,No,e.activeUserCount??0),d(this,qo,e.over18??!1),d(this,kn,e.url??""),d(this,Ho,{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:HO(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(jO),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,kn),"https://www.reddit.com").toString()}),d(this,E,t)}get id(){return s(this,bn)}get name(){return s(this,x)}get createdAt(){return s(this,Mo)}get type(){return s(this,Lo)}get title(){return s(this,Uo)}get description(){return s(this,Bo)}get language(){return s(this,Do)}get numberOfSubscribers(){return s(this,_o)}get numberOfActiveUsers(){return s(this,No)}get nsfw(){return s(this,qo)}get settings(){return s(this,Ho)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,kn)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,x)};return z.submit(t,s(this,E))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,x)},s(this,E))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,x)},s(this,E))}getApprovedUsers(e={}){return w.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,E))}approveUser(e){return w.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,E))}removeUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,E))}getWikiContributors(e={}){return w.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,E))}addWikiContributor(e){return w.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,E))}removeWikiContributor(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,E))}getBannedUsers(e={}){return w.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,E))}banUser(e){return w.createRelationship({username:e.username,subredditName:s(this,x),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,E))}unbanUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,E))}getBannedWikiContributors(e={}){return w.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,E))}banWikiContributor(e){return w.createRelationship({username:e.username,subredditName:s(this,x),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,E))}unbanWikiContributor(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,E))}getModerators(e={}){return w.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,E))}inviteModerator(e,t){return w.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,E))}revokeModeratorInvite(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,E))}removeModerator(e){return w.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,E))}setModeratorPermissions(e,t){return w.setModeratorPermissions(e,s(this,x),t,s(this,E))}getMutedUsers(e={}){return w.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,E))}muteUser(e,t){return w.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,E))}unmuteUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,E))}getModerationLog(e){return fd({subredditName:s(this,x),...e},s(this,E))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,x),s(this,E))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,x),s(this,E))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,E))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,x),...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,x),name:i},s(this,E));return js(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,E));return{next:t.next,prev:t.prev,users:t.users.map(i=>js(i))}}}getModQueue(e={type:"all"}){return dt.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,E))}getReports(e={type:"all"}){return dt.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,E))}getSpam(e={type:"all"}){return dt.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,E))}getUnmoderated(e={type:"all"}){return dt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,E))}getEdited(e={type:"all"}){return dt.aboutLocation({...e,location:"edited",subreddit:s(this,x)},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 W({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return bP(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new W({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,bn)]},s(this,E));return bP(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){g(e);let t=e?.[D.Subreddit]?.values[0];return g(t),dt.getById(Oe(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return g(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)}};bn=new WeakMap,x=new WeakMap,Mo=new WeakMap,Lo=new WeakMap,Uo=new WeakMap,Bo=new WeakMap,Do=new WeakMap,_o=new WeakMap,No=new WeakMap,qo=new WeakMap,Ho=new WeakMap,kn=new WeakMap,E=new WeakMap;var ve=dt;async function sy(r,e){let o=(await bt.query("GetSubredditLeaderboard","18ead70c46b6446d45ecd8b679b16d9a929a933d6ef25d8262a459cb18b72848",{id:r},e)).data?.subredditInfoById?.leaderboard;if(!o)throw new Error("subreddit leaderboard not found");if(!o.summary)throw new Error("subreddit leaderboard summary not found");return{id:o.id,summary:o.summary}}function qO(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function HO(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function jO(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function bP(r,e){let i=(r.data?.children??[]).map(a=>{let c=n(a);if(c!=null)return c;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new z(a.data,e)}catch{return null}}function o(a){try{return new Q(a.data,e)}catch{return null}}}async function oy(r,e){return kP("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function ay(r,e){return kP("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function kP(r,e,t,i){let o=(await bt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ne(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as WO,GetWidgetsResponse_WidgetItem as ue}from"@devvit/protos";var jo,Wo,Go,Vo,Mm=class Mm{constructor(e,t,i){l(this,jo);l(this,Wo);l(this,Go);l(this,Vo);X(this),d(this,jo,e.id),d(this,Wo,e.shortName),d(this,Go,t),d(this,Vo,i)}get id(){return s(this,jo)}get name(){return s(this,Wo)}get subredditName(){return s(this,Go)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Mm.delete(this.subredditName,this.id,s(this,Vo))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);g(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 el(p,e,t));break;case"calendar":a.push(new tl(p,e,t));break;case"textarea":a.push(new rl(p,e,t));break;case"button":a.push(new il(p,e,t));break;case"community-list":a.push(new nl(p,e,t));break;case"post-flair":a.push(new sl(p,e,t));break;case"custom":a.push(new ol(p,e,t));break;case"subreddit-rules":{let f=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Fm(f,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 el.create(e,t);case"calendar":return tl.create(e,t);case"textarea":return rl.create(e,t);case"button":return il.create(e,t);case"community-list":return nl.create(e,t);case"post-flair":return sl.create(e,t);case"custom":return ol.create(e,t);default:throw new Error("Unknown widget type")}}};jo=new WeakMap,Wo=new WeakMap,Go=new WeakMap,Vo=new WeakMap;var se=Mm,zo,al=class al extends se{constructor(t,i,n){super(t,i,n);l(this,zo);d(this,zo,t.data.map(o=>(g(o.url,"Image widget data is missing url"),g(o.height,"Image widget data is missing height"),g(o.width,"Image widget data is missing width"),g(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,zo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new al(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new al(ue.fromJSON(o),t.subreddit,i)}};zo=new WeakMap;var el=al,Jo,$o,Ko,dl=class dl extends se{constructor(t,i,n){super(t,i,n);l(this,Jo);l(this,$o);l(this,Ko);g(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),g(t.configuration,"Calendar widget data is missing configuration"),g(t.styles,"Calendar widget data is missing styles"),d(this,Jo,t.googleCalendarId),d(this,$o,t.configuration),d(this,Ko,t.styles)}get googleCalendarId(){return s(this,Jo)}get configuration(){return s(this,$o)}get styles(){return s(this,Ko)}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 dl(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new dl(ue.fromJSON(o),t.subreddit,i)}};Jo=new WeakMap,$o=new WeakMap,Ko=new WeakMap;var tl=dl,Xo,Zo,ll=class ll extends se{constructor(t,i,n){super(t,i,n);l(this,Xo);l(this,Zo);g(t.text,"Textarea widget data is missing text"),g(t.styles,"Textarea widget data is missing styles"),d(this,Xo,t.text),d(this,Zo,t.styles)}get text(){return s(this,Xo)}get styles(){return s(this,Zo)}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 ll(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new ll(ue.fromJSON(o),t.subreddit,i)}};Xo=new WeakMap,Zo=new WeakMap;var rl=ll,Yo,Qo,ea,ul=class ul extends se{constructor(t,i,n){super(t,i,n);l(this,Yo);l(this,Qo);l(this,ea);g(t.styles,"Button widget data is missing styles"),d(this,Yo,t.buttons),d(this,Qo,t.description??""),d(this,ea,t.styles)}get buttons(){return s(this,Yo)}get description(){return s(this,Qo)}get styles(){return s(this,ea)}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 ul(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new ul(ue.fromJSON(o),t.subreddit,i)}};Yo=new WeakMap,Qo=new WeakMap,ea=new WeakMap;var il=ul,ta,ra,cl=class cl extends se{constructor(t,i,n){super(t,i,n);l(this,ta);l(this,ra);d(this,ta,t.data.map(o=>WO.fromJSON(o))),g(t.styles,"Community list widget data is missing styles"),d(this,ra,t.styles)}get communities(){return s(this,ta)}get styles(){return s(this,ra)}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 cl(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new cl(ue.fromJSON(o),t.subreddit,i)}};ta=new WeakMap,ra=new WeakMap;var nl=cl,ia,na,sa,ml=class ml extends se{constructor(t,i,n){super(t,i,n);l(this,ia);l(this,na);l(this,sa);if(g(t.styles,"Post flair widget data is missing styles"),d(this,ia,t.styles),d(this,na,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,sa,t.display)}get styles(){return s(this,ia)}get templates(){return s(this,na)}get display(){return s(this,sa)}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 ml(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new ml(ue.fromJSON(o),t.subreddit,i)}};ia=new WeakMap,na=new WeakMap,sa=new WeakMap;var sl=ml,oa,aa,da,la,ua,pl=class pl extends se{constructor(t,i,n){super(t,i,n);l(this,oa);l(this,aa);l(this,da);l(this,la);l(this,ua);g(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),g(t.height,"Custom widget data is missing height"),g(t.css,"Custom widget data is missing css"),d(this,oa,t.imageData??[]),d(this,aa,t.text??""),d(this,da,t.stylesheetUrl),d(this,la,t.height),d(this,ua,t.css)}get images(){return s(this,oa)}get text(){return s(this,aa)}get stylesheetUrl(){return s(this,da)}get height(){return s(this,la)}get css(){return s(this,ua)}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 pl(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new pl(ue.fromJSON(o),t.subreddit,i)}};oa=new WeakMap,aa=new WeakMap,da=new WeakMap,la=new WeakMap,ua=new WeakMap;var ol=pl,ca,Fm=class extends se{constructor(t,i,n,o){super(i,n,o);l(this,ca);let a=t.rules.map(({description:c,priority:p,shortName:f,violationReason:v})=>(g(c,"Subreddit rule is missing description"),g(p,"Subreddit rule is missing priority"),g(f,"Subreddit rule is missing shortName"),g(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:f,violationReason:v}));d(this,ca,a)}get rules(){return s(this,ca)}toJSON(){return{...super.toJSON(),rules:this.rules}}};ca=new WeakMap;var GO=(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))(GO||{}),Pe,Se,Pn,Sn,Cn,In,wn,Ze,He=class He{constructor(e,t,i,n){l(this,Pe);l(this,Se);l(this,Pn);l(this,Sn);l(this,Cn);l(this,In);l(this,wn);l(this,Ze);X(this),d(this,Pe,e),d(this,Se,t),d(this,Pn,i.contentMd),d(this,Sn,i.revisionId),d(this,Cn,new Date(i.revisionDate)),d(this,In,i.reason??""),g(i.revisionBy?.data,"Wiki page author details are missing"),d(this,wn,new w(i.revisionBy.data,n)),d(this,Ze,n)}get name(){return s(this,Pe)}get subredditName(){return s(this,Se)}get content(){return s(this,Pn)}get revisionId(){return s(this,Sn)}get revisionDate(){return s(this,Cn)}get revisionReason(){return s(this,In)}get revisionAuthor(){return s(this,wn)}toJSON(){return{name:s(this,Pe),subredditName:s(this,Se),content:s(this,Pn),revisionId:s(this,Sn),revisionDate:s(this,Cn),revisionReason:s(this,In),revisionAuthor:s(this,wn).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Se),page:s(this,Pe),content:e,reason:t},s(this,Ze))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Se),page:s(this,Pe),...e},s(this,Ze))}async revertTo(e){return He.revertPage(s(this,Se),s(this,Pe),e,s(this,Ze))}async getSettings(){return He.getPageSettings(s(this,Se),s(this,Pe),s(this,Ze))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Se),page:s(this,Pe),listed:e.listed,permLevel:e.permLevel},s(this,Ze))}async addEditor(e){return He.addEditor(s(this,Se),s(this,Pe),e,s(this,Ze))}async removeEditor(e){return He.removeEditor(s(this,Se),s(this,Pe),e,s(this,Ze))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return g(o.data,"Failed to get wiki page"),new He(t,e,o.data,i)}static async getPages(e,t){return(await u.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return He.updatePage(e,t)}static async updatePage(e,t){return await u.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),He.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new W({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return VO(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 g(o.data,"Failed to get wiki page settings"),new fl(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 g(n.data,"Failed to update wiki page settings"),new fl(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,Se=new WeakMap,Pn=new WeakMap,Sn=new WeakMap,Cn=new WeakMap,In=new WeakMap,wn=new WeakMap,Ze=new WeakMap;var ye=He,xn,An,Tn,En,Rn,On,Lm=class{constructor(e,t){l(this,xn);l(this,An);l(this,Tn);l(this,En);l(this,Rn);l(this,On);d(this,xn,e.id),d(this,An,e.page),d(this,Tn,new Date(e.timestamp)),g(e.author?.data,"Wiki page revision author details are missing"),d(this,En,new w(e.author.data,t)),d(this,Rn,e.reason??""),d(this,On,e.revisionHidden??!1)}get id(){return s(this,xn)}get page(){return s(this,An)}get date(){return s(this,Tn)}get author(){return s(this,En)}get reason(){return s(this,Rn)}get hidden(){return s(this,On)}toJSON(){return{id:s(this,xn),page:s(this,An),date:s(this,Tn),author:s(this,En).toJSON(),reason:s(this,Rn),hidden:s(this,On)}}};xn=new WeakMap,An=new WeakMap,Tn=new WeakMap,En=new WeakMap,Rn=new WeakMap,On=new WeakMap;var Fn,Mn,Ln,fl=class{constructor(e,t){l(this,Fn);l(this,Mn);l(this,Ln);d(this,Fn,e.listed),d(this,Mn,e.permLevel),d(this,Ln,e.editors.map(i=>(g(i.data,"Wiki page editor details are missing"),new w(i.data,t))))}get listed(){return s(this,Fn)}get permLevel(){return s(this,Mn)}get editors(){return s(this,Ln)}toJSON(){return{listed:s(this,Fn),permLevel:s(this,Mn),editors:s(this,Ln).map(e=>e.toJSON())}}};Fn=new WeakMap,Mn=new WeakMap,Ln=new WeakMap;function VO(r,e){return g(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Lm(i,e)),before:r.data.before,after:r.data.after}}var zO=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(zO||{});function JO(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var je,Ce,pa,Un,Bn,fa,ga,ha,va,Ct,ya,ba,Dn,ma=class ma{constructor(e,t){l(this,je);l(this,Ce);l(this,pa);l(this,Un);l(this,Bn);l(this,fa);l(this,ga);l(this,ha);l(this,va);l(this,Ct);l(this,ya);l(this,ba);l(this,Dn);g(e.collectionId,"Collection Id is missing or undefined"),g(e.subredditId,"Subreddit Id is missing or undefined"),g(e.title,"Collection title is missing or undefined"),g(e.authorId,"Collection author's id is missing or undefined"),g(e.authorName,"Collection author's id is missing or undefined"),g(e.createdAtUtc,"Collection create timestamp is missing"),g(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,je,t),d(this,Ce,e.collectionId),d(this,pa,e.subredditId),d(this,Un,e.title),d(this,Bn,e.description||""),d(this,fa,e.authorId),d(this,ga,e.authorName),d(this,ha,e.permalink),d(this,va,e.primaryLinkId),d(this,Ct,e.linkIds||[]),d(this,Dn,JO(e.displayLayout)),d(this,ya,e.createdAtUtc),d(this,ba,e.lastUpdateUtc),X(this)}get id(){return s(this,Ce)}get subredditId(){return s(this,pa)}get title(){return s(this,Un)}get description(){return s(this,Bn)}get authorId(){return s(this,fa)}get authorName(){return s(this,ga)}get permalink(){return s(this,ha)}get primaryLinkId(){return s(this,va)}get linkIds(){return s(this,Ct)}get createdAtUtc(){return s(this,ya)}get lastUpdateUtc(){return s(this,ba)}get displayLayout(){return s(this,Dn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ma(n,t)}static async create(e,t){let n=await u.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ma(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ma(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),s(this,Ct).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),d(this,Ct,s(this,Ct).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Ce)},s(this,je))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Ce),follow:e},s(this,je))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Ce),linkIds:e.join(",")},s(this,je)),d(this,Ct,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Ce),title:e},s(this,je)),d(this,Un,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Ce),description:e},s(this,je)),d(this,Bn,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Ce),displayLayout:e},s(this,je)),d(this,Dn,e)}};je=new WeakMap,Ce=new WeakMap,pa=new WeakMap,Un=new WeakMap,Bn=new WeakMap,fa=new WeakMap,ga=new WeakMap,ha=new WeakMap,va=new WeakMap,Ct=new WeakMap,ya=new WeakMap,ba=new WeakMap,Dn=new WeakMap;var fi=ma;var $O=["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"],KO=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],XO=["onload","onerror","onclick","onmouseover"];function ZO(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 PP(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*(${$O.join("|")})\\b`,"gi"),t=new RegExp(`(${KO.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${XO.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=ZO(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 $H(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=PP(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{yL as ALL_ICON_NAMES,ny as AboutLocations,il as ButtonWidget,tl as CalendarWidget,zO as CollectionDisplayLayout,Q as Comment,nl as CommunityListWidget,ol as CustomWidget,u as Devvit,Ue as Flair,de as FlairTemplate,kO as FlairType,Tt as Hook,el as ImageWidget,W as Listing,_O as ModMailActionType,BO as ModMailConversationState,gd as ModMailService,Le as ModNote,z as Post,fi as PostCollection,sl as PostFlairWidget,fr as PrivateMessage,qs as RichTextBuilder,fc as SettingScope,FO as SocialLinkType,ve as Subreddit,Fm as SubredditRulesWidget,rl as TextAreaWidget,w as User,se as Widget,ye as WikiPage,GO as WikiPagePermissionLevel,Lm as WikiPageRevision,fl as WikiPageSettings,js as convertUserFlairProtoToAPI,fd as getModerationLog,sy as getSubredditLeaderboard,oy as getVaultByAddress,ay as getVaultByUserId,$H as svg,sO as useAsync,sm as useChannel,tm as useForm,dm as useInterval,pm as useState};
1
+ var CS=Object.create;var Bm=Object.defineProperty;var IS=Object.getOwnPropertyDescriptor;var wS=Object.getOwnPropertyNames;var xS=Object.getPrototypeOf,AS=Object.prototype.hasOwnProperty;var Dm=r=>{throw TypeError(r)};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var TS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of wS(e))!AS.call(r,n)&&n!==t&&Bm(r,n,{get:()=>e[n],enumerable:!(i=IS(e,n))||i.enumerable});return r};var Nn=(r,e,t)=>(t=r!=null?CS(xS(r)):{},TS(e||!r||!r.__esModule?Bm(t,"default",{value:r,enumerable:!0}):t,r));var gl=(r,e,t)=>e.has(r)||Dm("Cannot "+t);var s=(r,e,t)=>(gl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Dm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(gl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(gl(r,e,"access private method"),t);var ae=h((rF,_m)=>{_m.exports=function(r){try{return!!r()}catch{return!0}}});var Sa=h((iF,Nm)=>{var ES=ae();Nm.exports=!ES(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=h((nF,jm)=>{var qm=Sa(),Hm=Function.prototype,hl=Hm.call,RS=qm&&Hm.bind.bind(hl,hl);jm.exports=qm?RS:function(r){return function(){return hl.apply(r,arguments)}}});var Gm=h((sF,Wm)=>{var OS=Math.ceil,FS=Math.floor;Wm.exports=Math.trunc||function(e){var t=+e;return(t>0?FS:OS)(t)}});var Pa=h((oF,Vm)=>{var MS=Gm();Vm.exports=function(r){var e=+r;return e!==e||e===0?0:MS(e)}});var me=h((aF,zm)=>{var Ca=function(r){return r&&r.Math==Math&&r};zm.exports=Ca(typeof globalThis=="object"&&globalThis)||Ca(typeof window=="object"&&window)||Ca(typeof self=="object"&&self)||Ca(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Wr=h((dF,Jm)=>{Jm.exports=!1});var Ia=h((lF,Km)=>{var $m=me(),LS=Object.defineProperty;Km.exports=function(r,e){try{LS($m,r,{value:e,configurable:!0,writable:!0})}catch{$m[r]=e}return e}});var wa=h((uF,Zm)=>{var US=me(),BS=Ia(),Xm="__core-js_shared__",DS=US[Xm]||BS(Xm,{});Zm.exports=DS});var vl=h((cF,Qm)=>{var _S=Wr(),Ym=wa();(Qm.exports=function(r,e){return Ym[r]||(Ym[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:_S?"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 xa=h((mF,ep)=>{ep.exports=function(r){return r==null}});var Aa=h((pF,tp)=>{var NS=xa(),qS=TypeError;tp.exports=function(r){if(NS(r))throw qS("Can't call method on "+r);return r}});var qn=h((fF,rp)=>{var HS=Aa(),jS=Object;rp.exports=function(r){return jS(HS(r))}});var Ie=h((gF,ip)=>{var WS=Z(),GS=qn(),VS=WS({}.hasOwnProperty);ip.exports=Object.hasOwn||function(e,t){return VS(GS(e),t)}});var yl=h((hF,np)=>{var zS=Z(),JS=0,$S=Math.random(),KS=zS(1 .toString);np.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+KS(++JS+$S,36)}});var op=h((vF,sp)=>{sp.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var pp=h((yF,mp)=>{var cp=me(),bl=op(),ap=cp.process,dp=cp.Deno,lp=ap&&ap.versions||dp&&dp.version,up=lp&&lp.v8,We,Ta;up&&(We=up.split("."),Ta=We[0]>0&&We[0]<4?1:+(We[0]+We[1]));!Ta&&bl&&(We=bl.match(/Edge\/(\d+)/),(!We||We[1]>=74)&&(We=bl.match(/Chrome\/(\d+)/),We&&(Ta=+We[1])));mp.exports=Ta});var kl=h((bF,gp)=>{var fp=pp(),XS=ae();gp.exports=!!Object.getOwnPropertySymbols&&!XS(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&fp&&fp<41})});var Sl=h((kF,hp)=>{var ZS=kl();hp.exports=ZS&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var we=h((SF,yp)=>{var YS=me(),QS=vl(),vp=Ie(),eP=yl(),tP=kl(),rP=Sl(),Gr=YS.Symbol,Pl=QS("wks"),iP=rP?Gr.for||Gr:Gr&&Gr.withoutSetter||eP;yp.exports=function(r){return vp(Pl,r)||(Pl[r]=tP&&vp(Gr,r)?Gr[r]:iP("Symbol."+r)),Pl[r]}});var Sp=h((PF,kp)=>{var nP=we(),sP=nP("toStringTag"),bp={};bp[sP]="z";kp.exports=String(bp)==="[object z]"});var Il=h((CF,Pp)=>{var Cl=typeof document=="object"&&document.all,oP=typeof Cl>"u"&&Cl!==void 0;Pp.exports={all:Cl,IS_HTMLDDA:oP}});var Y=h((IF,Ip)=>{var Cp=Il(),aP=Cp.all;Ip.exports=Cp.IS_HTMLDDA?function(r){return typeof r=="function"||r===aP}:function(r){return typeof r=="function"}});var Ea=h((wF,xp)=>{var wp=Z(),dP=wp({}.toString),lP=wp("".slice);xp.exports=function(r){return lP(dP(r),8,-1)}});var Hn=h((xF,Ap)=>{var uP=Sp(),cP=Y(),Ra=Ea(),mP=we(),pP=mP("toStringTag"),fP=Object,gP=Ra(function(){return arguments}())=="Arguments",hP=function(r,e){try{return r[e]}catch{}};Ap.exports=uP?Ra:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=hP(e=fP(r),pP))=="string"?t:gP?Ra(e):(i=Ra(e))=="Object"&&cP(e.callee)?"Arguments":i}});var jn=h((AF,Tp)=>{var vP=Hn(),yP=String;Tp.exports=function(r){if(vP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return yP(r)}});var xl=h((TF,Op)=>{var wl=Z(),bP=Pa(),kP=jn(),SP=Aa(),PP=wl("".charAt),Ep=wl("".charCodeAt),CP=wl("".slice),Rp=function(r){return function(e,t){var i=kP(SP(e)),n=bP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=Ep(i,n),a<55296||a>56319||n+1===o||(c=Ep(i,n+1))<56320||c>57343?r?PP(i,n):a:r?CP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};Op.exports={codeAt:Rp(!1),charAt:Rp(!0)}});var Lp=h((EF,Mp)=>{var IP=me(),wP=Y(),Fp=IP.WeakMap;Mp.exports=wP(Fp)&&/native code/.test(String(Fp))});var It=h((RF,Dp)=>{var Up=Y(),Bp=Il(),xP=Bp.all;Dp.exports=Bp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:Up(r)||r===xP}:function(r){return typeof r=="object"?r!==null:Up(r)}});var pe=h((OF,_p)=>{var AP=ae();_p.exports=!AP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var Tl=h((FF,qp)=>{var TP=me(),Np=It(),Al=TP.document,EP=Np(Al)&&Np(Al.createElement);qp.exports=function(r){return EP?Al.createElement(r):{}}});var El=h((MF,Hp)=>{var RP=pe(),OP=ae(),FP=Tl();Hp.exports=!RP&&!OP(function(){return Object.defineProperty(FP("div"),"a",{get:function(){return 7}}).a!=7})});var Rl=h((LF,jp)=>{var MP=pe(),LP=ae();jp.exports=MP&&LP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ye=h((UF,Wp)=>{var UP=It(),BP=String,DP=TypeError;Wp.exports=function(r){if(UP(r))return r;throw DP(BP(r)+" is not an object")}});var Ge=h((BF,Gp)=>{var _P=Sa(),Oa=Function.prototype.call;Gp.exports=_P?Oa.bind(Oa):function(){return Oa.apply(Oa,arguments)}});var Wn=h((DF,Vp)=>{var Ol=me(),NP=Y(),qP=function(r){return NP(r)?r:void 0};Vp.exports=function(r,e){return arguments.length<2?qP(Ol[r]):Ol[r]&&Ol[r][e]}});var Fl=h((_F,zp)=>{var HP=Z();zp.exports=HP({}.isPrototypeOf)});var Ml=h((NF,Jp)=>{var jP=Wn(),WP=Y(),GP=Fl(),VP=Sl(),zP=Object;Jp.exports=VP?function(r){return typeof r=="symbol"}:function(r){var e=jP("Symbol");return WP(e)&&GP(e.prototype,zP(r))}});var Ll=h((qF,$p)=>{var JP=String;$p.exports=function(r){try{return JP(r)}catch{return"Object"}}});var Fa=h((HF,Kp)=>{var $P=Y(),KP=Ll(),XP=TypeError;Kp.exports=function(r){if($P(r))return r;throw XP(KP(r)+" is not a function")}});var Ma=h((jF,Xp)=>{var ZP=Fa(),YP=xa();Xp.exports=function(r,e){var t=r[e];return YP(t)?void 0:ZP(t)}});var Yp=h((WF,Zp)=>{var Ul=Ge(),Bl=Y(),Dl=It(),QP=TypeError;Zp.exports=function(r,e){var t,i;if(e==="string"&&Bl(t=r.toString)&&!Dl(i=Ul(t,r))||Bl(t=r.valueOf)&&!Dl(i=Ul(t,r))||e!=="string"&&Bl(t=r.toString)&&!Dl(i=Ul(t,r)))return i;throw QP("Can't convert object to primitive value")}});var rf=h((GF,tf)=>{var eC=Ge(),Qp=It(),ef=Ml(),tC=Ma(),rC=Yp(),iC=we(),nC=TypeError,sC=iC("toPrimitive");tf.exports=function(r,e){if(!Qp(r)||ef(r))return r;var t=tC(r,sC),i;if(t){if(e===void 0&&(e="default"),i=eC(t,r,e),!Qp(i)||ef(i))return i;throw nC("Can't convert object to primitive value")}return e===void 0&&(e="number"),rC(r,e)}});var La=h((VF,nf)=>{var oC=rf(),aC=Ml();nf.exports=function(r){var e=oC(r,"string");return aC(e)?e:e+""}});var Qe=h(of=>{var dC=pe(),lC=El(),uC=Rl(),Ua=Ye(),sf=La(),cC=TypeError,_l=Object.defineProperty,mC=Object.getOwnPropertyDescriptor,Nl="enumerable",ql="configurable",Hl="writable";of.f=dC?uC?function(e,t,i){if(Ua(e),t=sf(t),Ua(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Hl in i&&!i[Hl]){var n=mC(e,t);n&&n[Hl]&&(e[t]=i.value,i={configurable:ql in i?i[ql]:n[ql],enumerable:Nl in i?i[Nl]:n[Nl],writable:!1})}return _l(e,t,i)}:_l:function(e,t,i){if(Ua(e),t=sf(t),Ua(i),lC)try{return _l(e,t,i)}catch{}if("get"in i||"set"in i)throw cC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var Vr=h((JF,af)=>{af.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Ba=h(($F,df)=>{var pC=pe(),fC=Qe(),gC=Vr();df.exports=pC?function(r,e,t){return fC.f(r,e,gC(1,t))}:function(r,e,t){return r[e]=t,r}});var Da=h((KF,uf)=>{var hC=vl(),vC=yl(),lf=hC("keys");uf.exports=function(r){return lf[r]||(lf[r]=vC(r))}});var _a=h((XF,cf)=>{cf.exports={}});var zr=h((ZF,ff)=>{var yC=Lp(),pf=me(),bC=It(),kC=Ba(),jl=Ie(),Wl=wa(),SC=Da(),PC=_a(),mf="Object already initialized",Gl=pf.TypeError,CC=pf.WeakMap,Na,Gn,qa,IC=function(r){return qa(r)?Gn(r):Na(r,{})},wC=function(r){return function(e){var t;if(!bC(e)||(t=Gn(e)).type!==r)throw Gl("Incompatible receiver, "+r+" required");return t}};yC||Wl.state?(Ve=Wl.state||(Wl.state=new CC),Ve.get=Ve.get,Ve.has=Ve.has,Ve.set=Ve.set,Na=function(r,e){if(Ve.has(r))throw Gl(mf);return e.facade=r,Ve.set(r,e),e},Gn=function(r){return Ve.get(r)||{}},qa=function(r){return Ve.has(r)}):(nr=SC("state"),PC[nr]=!0,Na=function(r,e){if(jl(r,nr))throw Gl(mf);return e.facade=r,kC(r,nr,e),e},Gn=function(r){return jl(r,nr)?r[nr]:{}},qa=function(r){return jl(r,nr)});var Ve,nr;ff.exports={set:Na,get:Gn,has:qa,enforce:IC,getterFor:wC}});var Vl=h(vf=>{"use strict";var gf={}.propertyIsEnumerable,hf=Object.getOwnPropertyDescriptor,xC=hf&&!gf.call({1:2},1);vf.f=xC?function(e){var t=hf(this,e);return!!t&&t.enumerable}:gf});var Jl=h((QF,yf)=>{var AC=Z(),TC=ae(),EC=Ea(),zl=Object,RC=AC("".split);yf.exports=TC(function(){return!zl("z").propertyIsEnumerable(0)})?function(r){return EC(r)=="String"?RC(r,""):zl(r)}:zl});var Jr=h((eM,bf)=>{var OC=Jl(),FC=Aa();bf.exports=function(r){return OC(FC(r))}});var $l=h(Sf=>{var MC=pe(),LC=Ge(),UC=Vl(),BC=Vr(),DC=Jr(),_C=La(),NC=Ie(),qC=El(),kf=Object.getOwnPropertyDescriptor;Sf.f=MC?kf:function(e,t){if(e=DC(e),t=_C(t),qC)try{return kf(e,t)}catch{}if(NC(e,t))return BC(!LC(UC.f,e,t),e[t])}});var Zl=h((rM,Cf)=>{var Kl=pe(),HC=Ie(),Pf=Function.prototype,jC=Kl&&Object.getOwnPropertyDescriptor,Xl=HC(Pf,"name"),WC=Xl&&function(){}.name==="something",GC=Xl&&(!Kl||Kl&&jC(Pf,"name").configurable);Cf.exports={EXISTS:Xl,PROPER:WC,CONFIGURABLE:GC}});var Ql=h((iM,If)=>{var VC=Z(),zC=Y(),Yl=wa(),JC=VC(Function.toString);zC(Yl.inspectSource)||(Yl.inspectSource=function(r){return JC(r)});If.exports=Yl.inspectSource});var ru=h((nM,Af)=>{var tu=Z(),$C=ae(),KC=Y(),Ha=Ie(),eu=pe(),XC=Zl().CONFIGURABLE,ZC=Ql(),xf=zr(),YC=xf.enforce,QC=xf.get,wf=String,ja=Object.defineProperty,eI=tu("".slice),tI=tu("".replace),rI=tu([].join),iI=eu&&!$C(function(){return ja(function(){},"length",{value:8}).length!==8}),nI=String(String).split("String"),sI=Af.exports=function(r,e,t){eI(wf(e),0,7)==="Symbol("&&(e="["+tI(wf(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ha(r,"name")||XC&&r.name!==e)&&(eu?ja(r,"name",{value:e,configurable:!0}):r.name=e),iI&&t&&Ha(t,"arity")&&r.length!==t.arity&&ja(r,"length",{value:t.arity});try{t&&Ha(t,"constructor")&&t.constructor?eu&&ja(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=YC(r);return Ha(i,"source")||(i.source=rI(nI,typeof e=="string"?e:"")),r};Function.prototype.toString=sI(function(){return KC(this)&&QC(this).source||ZC(this)},"toString")});var sr=h((sM,Tf)=>{var oI=Y(),aI=Qe(),dI=ru(),lI=Ia();Tf.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(oI(t)&&dI(t,o,i),i.global)n?r[e]=t:lI(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:aI.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var iu=h((oM,Ef)=>{var uI=Pa(),cI=Math.max,mI=Math.min;Ef.exports=function(r,e){var t=uI(r);return t<0?cI(t+e,0):mI(t,e)}});var Of=h((aM,Rf)=>{var pI=Pa(),fI=Math.min;Rf.exports=function(r){return r>0?fI(pI(r),9007199254740991):0}});var Wa=h((dM,Ff)=>{var gI=Of();Ff.exports=function(r){return gI(r.length)}});var Uf=h((lM,Lf)=>{var hI=Jr(),vI=iu(),yI=Wa(),Mf=function(r){return function(e,t,i){var n=hI(e),o=yI(n),a=vI(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}};Lf.exports={includes:Mf(!0),indexOf:Mf(!1)}});var su=h((uM,Df)=>{var bI=Z(),nu=Ie(),kI=Jr(),SI=Uf().indexOf,PI=_a(),Bf=bI([].push);Df.exports=function(r,e){var t=kI(r),i=0,n=[],o;for(o in t)!nu(PI,o)&&nu(t,o)&&Bf(n,o);for(;e.length>i;)nu(t,o=e[i++])&&(~SI(n,o)||Bf(n,o));return n}});var Ga=h((cM,_f)=>{_f.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var qf=h(Nf=>{var CI=su(),II=Ga(),wI=II.concat("length","prototype");Nf.f=Object.getOwnPropertyNames||function(e){return CI(e,wI)}});var ou=h(Hf=>{Hf.f=Object.getOwnPropertySymbols});var Wf=h((fM,jf)=>{var xI=Wn(),AI=Z(),TI=qf(),EI=ou(),RI=Ye(),OI=AI([].concat);jf.exports=xI("Reflect","ownKeys")||function(e){var t=TI.f(RI(e)),i=EI.f;return i?OI(t,i(e)):t}});var zf=h((gM,Vf)=>{var Gf=Ie(),FI=Wf(),MI=$l(),LI=Qe();Vf.exports=function(r,e,t){for(var i=FI(e),n=LI.f,o=MI.f,a=0;a<i.length;a++){var c=i[a];!Gf(r,c)&&!(t&&Gf(t,c))&&n(r,c,o(e,c))}}});var $f=h((hM,Jf)=>{var UI=ae(),BI=Y(),DI=/#|\.prototype\./,Vn=function(r,e){var t=NI[_I(r)];return t==HI?!0:t==qI?!1:BI(e)?UI(e):!!e},_I=Vn.normalize=function(r){return String(r).replace(DI,".").toLowerCase()},NI=Vn.data={},qI=Vn.NATIVE="N",HI=Vn.POLYFILL="P";Jf.exports=Vn});var zn=h((vM,Kf)=>{var au=me(),jI=$l().f,WI=Ba(),GI=sr(),VI=Ia(),zI=zf(),JI=$f();Kf.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,f,v;if(i?a=au:n?a=au[t]||VI(t,{}):a=(au[t]||{}).prototype,a)for(c in e){if(f=e[c],r.dontCallGetSet?(v=jI(a,c),p=v&&v.value):p=a[c],o=JI(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof f==typeof p)continue;zI(f,p)}(r.sham||p&&p.sham)&&WI(f,"sham",!0),GI(a,c,f,r)}}});var du=h((yM,Xf)=>{var $I=su(),KI=Ga();Xf.exports=Object.keys||function(e){return $I(e,KI)}});var Yf=h(Zf=>{var XI=pe(),ZI=Rl(),YI=Qe(),QI=Ye(),ew=Jr(),tw=du();Zf.f=XI&&!ZI?Object.defineProperties:function(e,t){QI(e);for(var i=ew(t),n=tw(t),o=n.length,a=0,c;o>a;)YI.f(e,c=n[a++],i[c]);return e}});var eg=h((kM,Qf)=>{var rw=Wn();Qf.exports=rw("document","documentElement")});var Jn=h((SM,ag)=>{var iw=Ye(),nw=Yf(),tg=Ga(),sw=_a(),ow=eg(),aw=Tl(),dw=Da(),rg=">",ig="<",uu="prototype",cu="script",sg=dw("IE_PROTO"),lu=function(){},og=function(r){return ig+cu+rg+r+ig+"/"+cu+rg},ng=function(r){r.write(og("")),r.close();var e=r.parentWindow.Object;return r=null,e},lw=function(){var r=aw("iframe"),e="java"+cu+":",t;return r.style.display="none",ow.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(og("document.F=Object")),t.close(),t.F},Va,za=function(){try{Va=new ActiveXObject("htmlfile")}catch{}za=typeof document<"u"?document.domain&&Va?ng(Va):lw():ng(Va);for(var r=tg.length;r--;)delete za[uu][tg[r]];return za()};sw[sg]=!0;ag.exports=Object.create||function(e,t){var i;return e!==null?(lu[uu]=iw(e),i=new lu,lu[uu]=null,i[sg]=e):i=za(),t===void 0?i:nw.f(i,t)}});var lg=h((PM,dg)=>{var uw=ae();dg.exports=!uw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var pu=h((CM,cg)=>{var cw=Ie(),mw=Y(),pw=qn(),fw=Da(),gw=lg(),ug=fw("IE_PROTO"),mu=Object,hw=mu.prototype;cg.exports=gw?mu.getPrototypeOf:function(r){var e=pw(r);if(cw(e,ug))return e[ug];var t=e.constructor;return mw(t)&&e instanceof t?t.prototype:e instanceof mu?hw:null}});var vu=h((IM,fg)=>{"use strict";var vw=ae(),yw=Y(),bw=It(),kw=Jn(),mg=pu(),Sw=sr(),Pw=we(),Cw=Wr(),hu=Pw("iterator"),pg=!1,lt,fu,gu;[].keys&&(gu=[].keys(),"next"in gu?(fu=mg(mg(gu)),fu!==Object.prototype&&(lt=fu)):pg=!0);var Iw=!bw(lt)||vw(function(){var r={};return lt[hu].call(r)!==r});Iw?lt={}:Cw&&(lt=kw(lt));yw(lt[hu])||Sw(lt,hu,function(){return this});fg.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:pg}});var $n=h((wM,hg)=>{var ww=Qe().f,xw=Ie(),Aw=we(),gg=Aw("toStringTag");hg.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!xw(r,gg)&&ww(r,gg,{configurable:!0,value:e})}});var $r=h((xM,vg)=>{vg.exports={}});var yu=h((AM,yg)=>{"use strict";var Tw=vu().IteratorPrototype,Ew=Jn(),Rw=Vr(),Ow=$n(),Fw=$r(),Mw=function(){return this};yg.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Ew(Tw,{next:Rw(+!i,t)}),Ow(r,n,!1,!0),Fw[n]=Mw,r}});var kg=h((TM,bg)=>{var Lw=Y(),Uw=String,Bw=TypeError;bg.exports=function(r){if(typeof r=="object"||Lw(r))return r;throw Bw("Can't set "+Uw(r)+" as a prototype")}});var Pg=h((EM,Sg)=>{var Dw=Z(),_w=Ye(),Nw=kg();Sg.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Dw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return _w(n),Nw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var ku=h((RM,Fg)=>{"use strict";var qw=zn(),Hw=Ge(),Ja=Wr(),Rg=Zl(),jw=Y(),Ww=yu(),Cg=pu(),Ig=Pg(),Gw=$n(),Vw=Ba(),bu=sr(),zw=we(),wg=$r(),Og=vu(),Jw=Rg.PROPER,$w=Rg.CONFIGURABLE,xg=Og.IteratorPrototype,$a=Og.BUGGY_SAFARI_ITERATORS,Kn=zw("iterator"),Ag="keys",Xn="values",Tg="entries",Eg=function(){return this};Fg.exports=function(r,e,t,i,n,o,a){Ww(t,e,i);var c=function(M){if(M===n&&b)return b;if(!$a&&M in v)return v[M];switch(M){case Ag:return function(){return new t(this,M)};case Xn:return function(){return new t(this,M)};case Tg:return function(){return new t(this,M)}}return function(){return new t(this)}},p=e+" Iterator",f=!1,v=r.prototype,m=v[Kn]||v["@@iterator"]||n&&v[n],b=!$a&&m||c(n),y=e=="Array"&&v.entries||m,C,I,A;if(y&&(C=Cg(y.call(new r)),C!==Object.prototype&&C.next&&(!Ja&&Cg(C)!==xg&&(Ig?Ig(C,xg):jw(C[Kn])||bu(C,Kn,Eg)),Gw(C,p,!0,!0),Ja&&(wg[p]=Eg))),Jw&&n==Xn&&m&&m.name!==Xn&&(!Ja&&$w?Vw(v,"name",Xn):(f=!0,b=function(){return Hw(m,this)})),n)if(I={values:c(Xn),keys:o?b:c(Ag),entries:c(Tg)},a)for(A in I)($a||f||!(A in v))&&bu(v,A,I[A]);else qw({target:e,proto:!0,forced:$a||f},I);return(!Ja||a)&&v[Kn]!==b&&bu(v,Kn,b,{name:n}),wg[e]=b,I}});var Su=h((OM,Mg)=>{Mg.exports=function(r,e){return{value:r,done:e}}});var Dg=h(()=>{"use strict";var Kw=xl().charAt,Xw=jn(),Ug=zr(),Zw=ku(),Lg=Su(),Bg="String Iterator",Yw=Ug.set,Qw=Ug.getterFor(Bg);Zw(String,"String",function(r){Yw(this,{type:Bg,string:Xw(r),index:0})},function(){var e=Qw(this),t=e.string,i=e.index,n;return i>=t.length?Lg(void 0,!0):(n=Kw(t,i),e.index+=n.length,Lg(n,!1))})});var Pu=h((LM,_g)=>{var ex=ae(),tx=we(),rx=Wr(),ix=tx("iterator");_g.exports=!ex(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}),rx&&!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[ix]||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 qg=h((UM,Ng)=>{var nx=Ea(),sx=Z();Ng.exports=function(r){if(nx(r)==="Function")return sx(r)}});var Ka=h((BM,jg)=>{var Hg=qg(),ox=Fa(),ax=Sa(),dx=Hg(Hg.bind);jg.exports=function(r,e){return ox(r),e===void 0?r:ax?dx(r,e):function(){return r.apply(e,arguments)}}});var Vg=h((DM,Gg)=>{var Wg=ru(),lx=Qe();Gg.exports=function(r,e,t){return t.get&&Wg(t.get,e,{getter:!0}),t.set&&Wg(t.set,e,{setter:!0}),lx.f(r,e,t)}});var Cu=h((_M,zg)=>{var ux=Fl(),cx=TypeError;zg.exports=function(r,e){if(ux(e,r))return r;throw cx("Incorrect invocation")}});var Xg=h((NM,Kg)=>{"use strict";var Jg=pe(),mx=Z(),px=Ge(),fx=ae(),Iu=du(),gx=ou(),hx=Vl(),vx=qn(),yx=Jl(),Kr=Object.assign,$g=Object.defineProperty,bx=mx([].concat);Kg.exports=!Kr||fx(function(){if(Jg&&Kr({b:1},Kr($g({},"a",{enumerable:!0,get:function(){$g(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||Iu(Kr({},e)).join("")!=i})?function(e,t){for(var i=vx(e),n=arguments.length,o=1,a=gx.f,c=hx.f;n>o;)for(var p=yx(arguments[o++]),f=a?bx(Iu(p),a(p)):Iu(p),v=f.length,m=0,b;v>m;)b=f[m++],(!Jg||px(c,p,b))&&(i[b]=p[b]);return i}:Kr});var Qg=h((qM,Yg)=>{var kx=Ge(),Zg=Ye(),Sx=Ma();Yg.exports=function(r,e,t){var i,n;Zg(r);try{if(i=Sx(r,"return"),!i){if(e==="throw")throw t;return t}i=kx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return Zg(i),t}});var th=h((HM,eh)=>{var Px=Ye(),Cx=Qg();eh.exports=function(r,e,t,i){try{return i?e(Px(t)[0],t[1]):e(t)}catch(n){Cx(r,"throw",n)}}});var ih=h((jM,rh)=>{var Ix=we(),wx=$r(),xx=Ix("iterator"),Ax=Array.prototype;rh.exports=function(r){return r!==void 0&&(wx.Array===r||Ax[xx]===r)}});var lh=h((WM,dh)=>{var Tx=Z(),Ex=ae(),nh=Y(),Rx=Hn(),Ox=Wn(),Fx=Ql(),sh=function(){},Mx=[],oh=Ox("Reflect","construct"),wu=/^\s*(?:class|function)\b/,Lx=Tx(wu.exec),Ux=!wu.exec(sh),Zn=function(e){if(!nh(e))return!1;try{return oh(sh,Mx,e),!0}catch{return!1}},ah=function(e){if(!nh(e))return!1;switch(Rx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ux||!!Lx(wu,Fx(e))}catch{return!0}};ah.sham=!0;dh.exports=!oh||Ex(function(){var r;return Zn(Zn.call)||!Zn(Object)||!Zn(function(){r=!0})||r})?ah:Zn});var xu=h((GM,uh)=>{"use strict";var Bx=La(),Dx=Qe(),_x=Vr();uh.exports=function(r,e,t){var i=Bx(e);i in r?Dx.f(r,i,_x(0,t)):r[i]=t}});var Xa=h((VM,mh)=>{var Nx=Hn(),ch=Ma(),qx=xa(),Hx=$r(),jx=we(),Wx=jx("iterator");mh.exports=function(r){if(!qx(r))return ch(r,Wx)||ch(r,"@@iterator")||Hx[Nx(r)]}});var Au=h((zM,ph)=>{var Gx=Ge(),Vx=Fa(),zx=Ye(),Jx=Ll(),$x=Xa(),Kx=TypeError;ph.exports=function(r,e){var t=arguments.length<2?$x(r):e;if(Vx(t))return zx(Gx(t,r));throw Kx(Jx(r)+" is not iterable")}});var vh=h((JM,hh)=>{"use strict";var Xx=Ka(),Zx=Ge(),Yx=qn(),Qx=th(),eA=ih(),tA=lh(),rA=Wa(),fh=xu(),iA=Au(),nA=Xa(),gh=Array;hh.exports=function(e){var t=Yx(e),i=tA(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=Xx(o,n>2?arguments[2]:void 0));var c=nA(t),p=0,f,v,m,b,y,C;if(c&&!(this===gh&&eA(c)))for(b=iA(t,c),y=b.next,v=i?new this:[];!(m=Zx(y,b)).done;p++)C=a?Qx(b,o,[m.value,p],!0):m.value,fh(v,p,C);else for(f=rA(t),v=i?new this(f):gh(f);f>p;p++)C=a?o(t[p],p):t[p],fh(v,p,C);return v.length=p,v}});var Tu=h(($M,bh)=>{var yh=iu(),sA=Wa(),oA=xu(),aA=Array,dA=Math.max;bh.exports=function(r,e,t){for(var i=sA(r),n=yh(e,i),o=yh(t===void 0?i:t,i),a=aA(dA(o-n,0)),c=0;n<o;n++,c++)oA(a,c,r[n]);return a.length=c,a}});var Th=h((KM,Ah)=>{var or=Z(),Eu=2147483647,Yn=36,Ih=1,Fu=26,lA=38,uA=700,cA=72,mA=128,pA="-",fA=/[^\0-\u007E]/,wh=/[.\u3002\uFF0E\uFF61]/g,kh="Overflow: input needs wider integers to process",Ru=Yn-Ih,Sh=RangeError,gA=or(wh.exec),Xr=Math.floor,Ou=String.fromCharCode,Ph=or("".charCodeAt),xh=or([].join),wt=or([].push),hA=or("".replace),vA=or("".split),yA=or("".toLowerCase),bA=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=Ph(r,t++);if(n>=55296&&n<=56319&&t<i){var o=Ph(r,t++);(o&64512)==56320?wt(e,((n&1023)<<10)+(o&1023)+65536):(wt(e,n),t--)}else wt(e,n)}return e},Ch=function(r){return r+22+75*(r<26)},kA=function(r,e,t){var i=0;for(r=t?Xr(r/uA):r>>1,r+=Xr(r/e);r>Ru*Fu>>1;)r=Xr(r/Ru),i+=Yn;return Xr(i+(Ru+1)*r/(r+lA))},SA=function(r){var e=[];r=bA(r);var t=r.length,i=mA,n=0,o=cA,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&wt(e,Ou(c));var p=e.length,f=p;for(p&&wt(e,pA);f<t;){var v=Eu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<v&&(v=c);var m=f+1;if(v-i>Xr((Eu-n)/m))throw Sh(kh);for(n+=(v-i)*m,i=v,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>Eu)throw Sh(kh);if(c==i){for(var b=n,y=Yn;;){var C=y<=o?Ih:y>=o+Fu?Fu:y-o;if(b<C)break;var I=b-C,A=Yn-C;wt(e,Ou(Ch(C+I%A))),b=Xr(I/A),y+=Yn}wt(e,Ou(Ch(b))),o=kA(n,m,f==p),n=0,f++}}n++,i++}return xh(e,"")};Ah.exports=function(r){var e=[],t=vA(hA(yA(r),wh,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],wt(e,gA(fA,n)?"xn--"+SA(n):n);return xh(e,".")}});var Mu=h((XM,Eh)=>{var PA=TypeError;Eh.exports=function(r,e){if(r<e)throw PA("Not enough arguments");return r}});var Oh=h((ZM,Rh)=>{var CA=we(),IA=Jn(),wA=Qe().f,Lu=CA("unscopables"),Uu=Array.prototype;Uu[Lu]==null&&wA(Uu,Lu,{configurable:!0,value:IA(null)});Rh.exports=function(r){Uu[Lu][r]=!0}});var Dh=h((YM,Bh)=>{"use strict";var xA=Jr(),Bu=Oh(),Fh=$r(),Lh=zr(),AA=Qe().f,TA=ku(),Za=Su(),EA=Wr(),RA=pe(),Uh="Array Iterator",OA=Lh.set,FA=Lh.getterFor(Uh);Bh.exports=TA(Array,"Array",function(r,e){OA(this,{type:Uh,target:xA(r),index:0,kind:e})},function(){var r=FA(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,Za(void 0,!0)):t=="keys"?Za(i,!1):t=="values"?Za(e[i],!1):Za([i,e[i]],!1)},"values");var Mh=Fh.Arguments=Fh.Array;Bu("keys");Bu("values");Bu("entries");if(!EA&&RA&&Mh.name!=="values")try{AA(Mh,"name",{value:"values"})}catch{}});var Nh=h((QM,_h)=>{var MA=sr();_h.exports=function(r,e,t){for(var i in e)MA(r,i,e[i],t);return r}});var jh=h((eL,Hh)=>{var qh=Tu(),LA=Math.floor,Du=function(r,e){var t=r.length,i=LA(t/2);return t<8?UA(r,e):BA(r,Du(qh(r,0,i),e),Du(qh(r,i),e),e)},UA=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},BA=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};Hh.exports=Du});var Ju=h((tL,dv)=>{"use strict";Dh();var ju=zn(),Yr=me(),Ya=Ge(),et=Z(),DA=pe(),ev=Pu(),tv=sr(),_A=Nh(),NA=$n(),qA=yu(),Vu=zr(),rv=Cu(),_u=Y(),HA=Ie(),jA=Ka(),WA=Hn(),GA=Ye(),iv=It(),fe=jn(),VA=Jn(),Wh=Vr(),Wu=Au(),zA=Xa(),Zr=Mu(),JA=we(),$A=jh(),KA=JA("iterator"),ts="URLSearchParams",nv=ts+"Iterator",sv=Vu.set,ze=Vu.getterFor(ts),XA=Vu.getterFor(nv),ZA=Object.getOwnPropertyDescriptor,zu=function(r){if(!DA)return Yr[r];var e=ZA(Yr,r);return e&&e.value},Gh=zu("fetch"),ed=zu("Request"),Qn=zu("Headers"),Nu=ed&&ed.prototype,Vh=Qn&&Qn.prototype,YA=Yr.RegExp,QA=Yr.TypeError,ov=Yr.decodeURIComponent,eT=Yr.encodeURIComponent,tT=et("".charAt),zh=et([].join),ar=et([].push),Gu=et("".replace),rT=et([].shift),Jh=et([].splice),$h=et("".split),iT=et("".slice),nT=/\+/g,Kh=Array(4),sT=function(r){return Kh[r-1]||(Kh[r-1]=YA("((?:%[\\da-f]{2}){"+r+"})","gi"))},oT=function(r){try{return ov(r)}catch{return r}},Xh=function(r){var e=Gu(r,nT," "),t=4;try{return ov(e)}catch{for(;t;)e=Gu(e,sT(t--),oT);return e}},aT=/[!'()~]|%20/g,dT={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},lT=function(r){return dT[r]},Zh=function(r){return Gu(eT(r),aT,lT)},qu=qA(function(e,t){sv(this,{type:nv,iterator:Wu(ze(e).entries),kind:t})},"Iterator",function(){var e=XA(this),t=e.kind,i=e.iterator.next(),n=i.value;return i.done||(i.value=t==="keys"?n.key:t==="values"?n.value:[n.key,n.value]),i},!0),av=function(r){this.entries=[],this.url=null,r!==void 0&&(iv(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?tT(r,0)==="?"?iT(r,1):r:fe(r)))};av.prototype={type:ts,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=zA(r),t,i,n,o,a,c,p;if(e)for(t=Wu(r,e),i=t.next;!(n=Ya(i,t)).done;){if(o=Wu(GA(n.value)),a=o.next,(c=Ya(a,o)).done||(p=Ya(a,o)).done||!Ya(a,o).done)throw QA("Expected sequence with length 2");ar(this.entries,{key:fe(c.value),value:fe(p.value)})}else for(var f in r)HA(r,f)&&ar(this.entries,{key:f,value:fe(r[f])})},parseQuery:function(r){if(r)for(var e=$h(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=$h(i,"="),ar(this.entries,{key:Xh(rT(n)),value:Xh(zh(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],ar(e,Zh(i.key)+"="+Zh(i.value));return zh(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var td=function(){rv(this,es);var e=arguments.length>0?arguments[0]:void 0;sv(this,new av(e))},es=td.prototype;_A(es,{append:function(e,t){Zr(arguments.length,2);var i=ze(this);ar(i.entries,{key:fe(e),value:fe(t)}),i.updateURL()},delete:function(r){Zr(arguments.length,1);for(var e=ze(this),t=e.entries,i=fe(r),n=0;n<t.length;)t[n].key===i?Jh(t,n,1):n++;e.updateURL()},get:function(e){Zr(arguments.length,1);for(var t=ze(this).entries,i=fe(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Zr(arguments.length,1);for(var t=ze(this).entries,i=fe(e),n=[],o=0;o<t.length;o++)t[o].key===i&&ar(n,t[o].value);return n},has:function(e){Zr(arguments.length,1);for(var t=ze(this).entries,i=fe(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Zr(arguments.length,1);for(var i=ze(this),n=i.entries,o=!1,a=fe(e),c=fe(t),p=0,f;p<n.length;p++)f=n[p],f.key===a&&(o?Jh(n,p--,1):(o=!0,f.value=c));o||ar(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=ze(this);$A(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=ze(this).entries,i=jA(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 qu(this,"keys")},values:function(){return new qu(this,"values")},entries:function(){return new qu(this,"entries")}},{enumerable:!0});tv(es,KA,es.entries,{name:"entries"});tv(es,"toString",function(){return ze(this).serialize()},{enumerable:!0});NA(td,ts);ju({global:!0,constructor:!0,forced:!ev},{URLSearchParams:td});!ev&&_u(Qn)&&(Yh=et(Vh.has),Qh=et(Vh.set),Hu=function(r){if(iv(r)){var e=r.body,t;if(WA(e)===ts)return t=r.headers?new Qn(r.headers):new Qn,Yh(t,"content-type")||Qh(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),VA(r,{body:Wh(0,fe(e)),headers:Wh(0,t)})}return r},_u(Gh)&&ju({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Gh(e,arguments.length>1?Hu(arguments[1]):{})}}),_u(ed)&&(Qa=function(e){return rv(this,Nu),new ed(e,arguments.length>1?Hu(arguments[1]):{})},Nu.constructor=Qa,Qa.prototype=Nu,ju({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Qa})));var Yh,Qh,Hu,Qa;dv.exports={URLSearchParams:td,getState:ze}});var Av=h(()=>{"use strict";Dg();var uT=zn(),lc=pe(),cT=Pu(),uc=me(),lv=Ka(),Re=Z(),od=sr(),xe=Vg(),mT=Cu(),oc=Ie(),cc=Xg(),Qr=vh(),Je=Tu(),pT=xl().codeAt,fT=Th(),ct=jn(),gT=$n(),hT=Mu(),Sv=Ju(),Pv=zr(),vT=Pv.set,ad=Pv.getterFor("URL"),yT=Sv.URLSearchParams,bT=Sv.getState,rs=uc.URL,ac=uc.TypeError,dd=uc.parseInt,kT=Math.floor,uv=Math.pow,Ee=Re("".charAt),$e=Re(/./.exec),ns=Re([].join),ST=Re(1 .toString),PT=Re([].pop),ti=Re([].push),cv=Re("".replace),CT=Re([].shift),IT=Re("".split),os=Re("".slice),ld=Re("".toLowerCase),wT=Re([].unshift),xT="Invalid authority",$u="Invalid scheme",dr="Invalid host",mv="Invalid port",Cv=/[a-z]/i,AT=/[\d+-.a-z]/i,dc=/\d/,TT=/^0x/i,ET=/^[0-7]+$/,RT=/^\d+$/,Iv=/^[\da-f]+$/i,OT=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FT=/[\0\t\n\r #/:<>?@[\\\]^|]/,MT=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,LT=/[\t\n\r]/g,Ae,UT=function(r){var e=IT(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&&Ee(o,0)=="0"&&(a=$e(TT,o)?16:8,o=os(o,a==8?1:2)),o==="")c=0;else{if(!$e(a==10?RT:a==8?ET:Iv,o))return r;c=dd(o,a)}ti(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=uv(256,5-t))return null}else if(c>255)return null;for(p=PT(i),n=0;n<i.length;n++)p+=i[n]*uv(256,3-n);return p},BT=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,f,v,m,b=function(){return Ee(r,n)};if(b()==":"){if(Ee(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&$e(Iv,b());)o=o*16+dd(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!$e(dc,b()))return;for(;$e(dc,b());){if(f=dd(b(),10),p===null)p=f;else{if(p==0)return;p=p*10+f}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(v=t-i,t=7;t!=0&&v>0;)m=e[t],e[t--]=e[i+v-1],e[i+--v]=m;else if(t!=8)return;return e},DT=function(r){for(var e=null,t=1,i=null,n=0,o=0;o<8;o++)r[o]!==0?(n>t&&(e=i,t=n),i=null,n=0):(i===null&&(i=o),++n);return n>t&&(e=i,t=n),e},is=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)wT(e,r%256),r=kT(r/256);return ns(e,".")}else if(typeof r=="object"){for(e="",i=DT(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=ST(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},sd={},wv=cc({},sd,{" ":1,'"':1,"<":1,">":1,"`":1}),xv=cc({},wv,{"#":1,"?":1,"{":1,"}":1}),Ku=cc({},xv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=pT(r,0);return t>32&&t<127&&!oc(e,r)?r:encodeURIComponent(r)},rd={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ss=function(r,e){var t;return r.length==2&&$e(Cv,Ee(r,0))&&((t=Ee(r,1))==":"||!e&&t=="|")},pv=function(r){var e;return r.length>1&&ss(os(r,0,2))&&(r.length==2||(e=Ee(r,2))==="/"||e==="\\"||e==="?"||e==="#")},_T=function(r){return r==="."||ld(r)==="%2e"},NT=function(r){return r=ld(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Xu={},fv={},Zu={},gv={},hv={},Yu={},vv={},yv={},id={},nd={},Qu={},ec={},tc={},rc={},bv={},ic={},ei={},tt={},kv={},lr={},ut={},mc=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw ac(o);this.searchParams=null}else{if(t!==void 0&&(n=new mc(t,!0)),o=this.parse(i,null,n),o)throw ac(o);a=bT(new yT),a.bindURL(this),this.searchParams=a}};mc.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Xu,o=0,a="",c=!1,p=!1,f=!1,v,m,b,y;for(r=ct(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=cv(r,MT,"")),r=cv(r,LT,""),v=Qr(r);o<=v.length;){switch(m=v[o],n){case Xu:if(m&&$e(Cv,m))a+=ld(m),n=fv;else{if(e)return $u;n=Zu;continue}break;case fv:if(m&&($e(AT,m)||m=="+"||m=="-"||m=="."))a+=ld(m);else if(m==":"){if(e&&(i.isSpecial()!=oc(rd,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&rd[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=rc:i.isSpecial()&&t&&t.scheme==i.scheme?n=gv:i.isSpecial()?n=yv:v[o+1]=="/"?(n=hv,o++):(i.cannotBeABaseURL=!0,ti(i.path,""),n=kv)}else{if(e)return $u;a="",n=Zu,o=0;continue}break;case Zu:if(!t||t.cannotBeABaseURL&&m!="#")return $u;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Je(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?rc:Yu;continue;case gv:if(m=="/"&&v[o+1]=="/")n=id,o++;else{n=Yu;continue}break;case hv:if(m=="/"){n=nd;break}else{n=tt;continue}case Yu:if(i.scheme=t.scheme,m==Ae)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=vv;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query="",n=lr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Je(t.path),i.path.length--,n=tt;continue}break;case vv:if(i.isSpecial()&&(m=="/"||m=="\\"))n=id;else if(m=="/")n=nd;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=tt;continue}break;case yv:if(n=id,m!="/"||Ee(a,o+1)!="/")continue;o++;break;case id:if(m!="/"&&m!="\\"){n=nd;continue}break;case nd:if(m=="@"){c&&(a="%40"+a),c=!0,b=Qr(a);for(var C=0;C<b.length;C++){var I=b[C];if(I==":"&&!f){f=!0;continue}var A=xt(I,Ku);f?i.password+=A:i.username+=A}a=""}else if(m==Ae||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return xT;o-=Qr(a).length+1,a="",n=Qu}else a+=m;break;case Qu:case ec:if(e&&i.scheme=="file"){n=ic;continue}else if(m==":"&&!p){if(a=="")return dr;if(y=i.parseHost(a),y)return y;if(a="",n=tc,e==ec)return}else if(m==Ae||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return dr;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(y=i.parseHost(a),y)return y;if(a="",n=ei,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case tc:if($e(dc,m))a+=m;else if(m==Ae||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var M=dd(a,10);if(M>65535)return mv;i.port=i.isSpecial()&&M===rd[i.scheme]?null:M,a=""}if(e)return;n=ei;continue}else return mv;break;case rc:if(i.scheme="file",m=="/"||m=="\\")n=bv;else if(t&&t.scheme=="file")if(m==Ae)i.host=t.host,i.path=Je(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Je(t.path),i.query="",n=lr;else if(m=="#")i.host=t.host,i.path=Je(t.path),i.query=t.query,i.fragment="",n=ut;else{pv(ns(Je(v,o),""))||(i.host=t.host,i.path=Je(t.path),i.shortenPath()),n=tt;continue}else{n=tt;continue}break;case bv:if(m=="/"||m=="\\"){n=ic;break}t&&t.scheme=="file"&&!pv(ns(Je(v,o),""))&&(ss(t.path[0],!0)?ti(i.path,t.path[0]):i.host=t.host),n=tt;continue;case ic:if(m==Ae||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&ss(a))n=tt;else if(a==""){if(i.host="",e)return;n=ei}else{if(y=i.parseHost(a),y)return y;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ei}continue}else a+=m;break;case ei:if(i.isSpecial()){if(n=tt,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=lr;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=Ae&&(n=tt,m!="/"))continue;break;case tt:if(m==Ae||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(NT(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,"")):_T(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ti(i.path,""):(i.scheme=="file"&&!i.path.length&&ss(a)&&(i.host&&(i.host=""),a=Ee(a,0)+":"),ti(i.path,a)),a="",i.scheme=="file"&&(m==Ae||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)CT(i.path);m=="?"?(i.query="",n=lr):m=="#"&&(i.fragment="",n=ut)}else a+=xt(m,xv);break;case kv:m=="?"?(i.query="",n=lr):m=="#"?(i.fragment="",n=ut):m!=Ae&&(i.path[0]+=xt(m,sd));break;case lr:!e&&m=="#"?(i.fragment="",n=ut):m!=Ae&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,sd));break;case ut:m!=Ae&&(i.fragment+=xt(m,wv));break}o++}},parseHost:function(r){var e,t,i;if(Ee(r,0)=="["){if(Ee(r,r.length-1)!="]"||(e=BT(os(r,1,-1)),!e))return dr;this.host=e}else if(this.isSpecial()){if(r=fT(r),$e(OT,r)||(e=UT(r),e===null))return dr;this.host=e}else{if($e(FT,r))return dr;for(e="",t=Qr(r),i=0;i<t.length;i++)e+=xt(t[i],sd);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return oc(rd,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!ss(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,f=e+":";return n!==null?(f+="//",r.includesCredentials()&&(f+=t+(i?":"+i:"")+"@"),f+=is(n),o!==null&&(f+=":"+o)):e=="file"&&(f+="//"),f+=r.cannotBeABaseURL?a[0]:a.length?"/"+ns(a,"/"):"",c!==null&&(f+="?"+c),p!==null&&(f+="#"+p),f},setHref:function(r){var e=this.parse(r);if(e)throw ac(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ri(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+is(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",Xu)},getUsername:function(){return this.username},setUsername:function(r){var e=Qr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],Ku)}},getPassword:function(){return this.password},setPassword:function(r){var e=Qr(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],Ku)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?is(r):is(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Qu)},getHostname:function(){var r=this.host;return r===null?"":is(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,ec)},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,tc))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+ns(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ei))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ee(r,0)=="?"&&(r=os(r,1)),this.query="",this.parse(r,lr)),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}Ee(r,0)=="#"&&(r=os(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ri=function(e){var t=mT(this,re),i=hT(arguments.length,1)>1?arguments[1]:void 0,n=vT(t,new mc(e,!1,i));lc||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},re=ri.prototype,Te=function(r,e){return{get:function(){return ad(this)[r]()},set:e&&function(t){return ad(this)[e](t)},configurable:!0,enumerable:!0}};lc&&(xe(re,"href",Te("serialize","setHref")),xe(re,"origin",Te("getOrigin")),xe(re,"protocol",Te("getProtocol","setProtocol")),xe(re,"username",Te("getUsername","setUsername")),xe(re,"password",Te("getPassword","setPassword")),xe(re,"host",Te("getHost","setHost")),xe(re,"hostname",Te("getHostname","setHostname")),xe(re,"port",Te("getPort","setPort")),xe(re,"pathname",Te("getPathname","setPathname")),xe(re,"search",Te("getSearch","setSearch")),xe(re,"searchParams",Te("getSearchParams")),xe(re,"hash",Te("getHash","setHash")));od(re,"toJSON",function(){return ad(this).serialize()},{enumerable:!0});od(re,"toString",function(){return ad(this).serialize()},{enumerable:!0});rs&&(nc=rs.createObjectURL,sc=rs.revokeObjectURL,nc&&od(ri,"createObjectURL",lv(nc,rs)),sc&&od(ri,"revokeObjectURL",lv(sc,rs)));var nc,sc;gT(ri,"URL");uT({global:!0,constructor:!0,forced:!cT,sham:!lc},{URL:ri})});var Tv=h(()=>{Av()});var Ev=h(()=>{"use strict";var qT=zn(),HT=Ge();qT({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return HT(URL.prototype.toString,this)}})});var Rv=h(()=>{Ju()});var Fv=h((uL,Ov)=>{var jT=me();Ov.exports=jT});var Lv=h((cL,Mv)=>{Tv();Ev();Rv();var WT=Fv();Mv.exports=WT.URL});var qc=h((UD,Wy)=>{var iE=Object.prototype.toString;Wy.exports=function(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;if(t==="boolean")return"boolean";if(t==="string")return"string";if(t==="number")return"number";if(t==="symbol")return"symbol";if(t==="function")return dE(e)?"generatorfunction":"function";if(nE(e))return"array";if(cE(e))return"buffer";if(uE(e))return"arguments";if(oE(e))return"date";if(sE(e))return"error";if(aE(e))return"regexp";switch(jy(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(lE(e))return"generator";switch(t=iE.call(e),t){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function jy(r){return typeof r.constructor=="function"?r.constructor.name:null}function nE(r){return Array.isArray?Array.isArray(r):r instanceof Array}function sE(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function oE(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function aE(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function dE(r,e){return jy(r)==="GeneratorFunction"}function lE(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function uE(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 cE(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var zy=h((BD,Vy)=>{"use strict";var Gy=Symbol.prototype.valueOf,mE=qc();function pE(r,e){switch(mE(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 vE(r);case"symbol":return yE(r);case"arraybuffer":return gE(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return hE(r);case"regexp":return fE(r);case"error":return Object.create(r);default:return r}}function fE(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 gE(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function hE(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function vE(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function yE(r){return Gy?Object(Gy.call(r)):{}}Vy.exports=pE});var $y=h((DD,Jy)=>{"use strict";Jy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Zy=h((_D,Xy)=>{"use strict";var bE=$y();function Ky(r){return bE(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}Xy.exports=function(e){var t,i;return!(Ky(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ky(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var Qy=h((ND,Yy)=>{"use strict";var kE=zy(),SE=qc(),PE=Zy();function Hc(r,e){switch(SE(r)){case"object":return CE(r,e);case"array":return IE(r,e);default:return kE(r)}}function CE(r,e){if(typeof e=="function")return e(r);if(e||PE(r)){let t=new r.constructor;for(let i in r)t[i]=Hc(r[i],e);return t}return r}function IE(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Hc(r[i],e);return t}Yy.exports=Hc});var Qc=h((ys,Ti)=>{var wE=200,Yc="__lodash_hash_undefined__",Fd=1,cb=2,mb=9007199254740991,wd="[object Arguments]",Vc="[object Array]",xE="[object AsyncFunction]",pb="[object Boolean]",fb="[object Date]",gb="[object Error]",hb="[object Function]",AE="[object GeneratorFunction]",xd="[object Map]",vb="[object Number]",TE="[object Null]",Ai="[object Object]",eb="[object Promise]",EE="[object Proxy]",yb="[object RegExp]",Ad="[object Set]",bb="[object String]",RE="[object Symbol]",OE="[object Undefined]",zc="[object WeakMap]",kb="[object ArrayBuffer]",Td="[object DataView]",FE="[object Float32Array]",ME="[object Float64Array]",LE="[object Int8Array]",UE="[object Int16Array]",BE="[object Int32Array]",DE="[object Uint8Array]",_E="[object Uint8ClampedArray]",NE="[object Uint16Array]",qE="[object Uint32Array]",HE=/[\\^$.*+?()[\]{}|]/g,jE=/^\[object .+?Constructor\]$/,WE=/^(?:0|[1-9]\d*)$/,j={};j[FE]=j[ME]=j[LE]=j[UE]=j[BE]=j[DE]=j[_E]=j[NE]=j[qE]=!0;j[wd]=j[Vc]=j[kb]=j[pb]=j[Td]=j[fb]=j[gb]=j[hb]=j[xd]=j[vb]=j[Ai]=j[yb]=j[Ad]=j[bb]=j[zc]=!1;var Sb=typeof global=="object"&&global&&global.Object===Object&&global,GE=typeof self=="object"&&self&&self.Object===Object&&self,gt=Sb||GE||Function("return this")(),Pb=typeof ys=="object"&&ys&&!ys.nodeType&&ys,tb=Pb&&typeof Ti=="object"&&Ti&&!Ti.nodeType&&Ti,Cb=tb&&tb.exports===Pb,jc=Cb&&Sb.process,rb=function(){try{return jc&&jc.binding&&jc.binding("util")}catch{}}(),ib=rb&&rb.isTypedArray;function VE(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 zE(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function JE(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 $E(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function KE(r){return function(e){return r(e)}}function XE(r,e){return r.has(e)}function ZE(r,e){return r?.[e]}function YE(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function QE(r,e){return function(t){return r(e(t))}}function eR(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var tR=Array.prototype,rR=Function.prototype,Md=Object.prototype,Wc=gt["__core-js_shared__"],Ib=rR.toString,rt=Md.hasOwnProperty,nb=function(){var r=/[^.]+$/.exec(Wc&&Wc.keys&&Wc.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),wb=Md.toString,iR=RegExp("^"+Ib.call(rt).replace(HE,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sb=Cb?gt.Buffer:void 0,Ed=gt.Symbol,ob=gt.Uint8Array,xb=Md.propertyIsEnumerable,nR=tR.splice,yr=Ed?Ed.toStringTag:void 0,ab=Object.getOwnPropertySymbols,sR=sb?sb.isBuffer:void 0,oR=QE(Object.keys,Object),Jc=Ei(gt,"DataView"),bs=Ei(gt,"Map"),$c=Ei(gt,"Promise"),Kc=Ei(gt,"Set"),Xc=Ei(gt,"WeakMap"),ks=Ei(Object,"create"),aR=Sr(Jc),dR=Sr(bs),lR=Sr($c),uR=Sr(Kc),cR=Sr(Xc),db=Ed?Ed.prototype:void 0,Gc=db?db.valueOf:void 0;function br(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 mR(){this.__data__=ks?ks(null):{},this.size=0}function pR(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function fR(r){var e=this.__data__;if(ks){var t=e[r];return t===Yc?void 0:t}return rt.call(e,r)?e[r]:void 0}function gR(r){var e=this.__data__;return ks?e[r]!==void 0:rt.call(e,r)}function hR(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=ks&&e===void 0?Yc:e,this}br.prototype.clear=mR;br.prototype.delete=pR;br.prototype.get=fR;br.prototype.has=gR;br.prototype.set=hR;function ht(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 vR(){this.__data__=[],this.size=0}function yR(r){var e=this.__data__,t=Ld(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():nR.call(e,t,1),--this.size,!0}function bR(r){var e=this.__data__,t=Ld(e,r);return t<0?void 0:e[t][1]}function kR(r){return Ld(this.__data__,r)>-1}function SR(r,e){var t=this.__data__,i=Ld(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ht.prototype.clear=vR;ht.prototype.delete=yR;ht.prototype.get=bR;ht.prototype.has=kR;ht.prototype.set=SR;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 PR(){this.size=0,this.__data__={hash:new br,map:new(bs||ht),string:new br}}function CR(r){var e=Ud(this,r).delete(r);return this.size-=e?1:0,e}function IR(r){return Ud(this,r).get(r)}function wR(r){return Ud(this,r).has(r)}function xR(r,e){var t=Ud(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}kr.prototype.clear=PR;kr.prototype.delete=CR;kr.prototype.get=IR;kr.prototype.has=wR;kr.prototype.set=xR;function Rd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new kr;++e<t;)this.add(r[e])}function AR(r){return this.__data__.set(r,Yc),this}function TR(r){return this.__data__.has(r)}Rd.prototype.add=Rd.prototype.push=AR;Rd.prototype.has=TR;function Bt(r){var e=this.__data__=new ht(r);this.size=e.size}function ER(){this.__data__=new ht,this.size=0}function RR(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function OR(r){return this.__data__.get(r)}function FR(r){return this.__data__.has(r)}function MR(r,e){var t=this.__data__;if(t instanceof ht){var i=t.__data__;if(!bs||i.length<wE-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new kr(i)}return t.set(r,e),this.size=t.size,this}Bt.prototype.clear=ER;Bt.prototype.delete=RR;Bt.prototype.get=OR;Bt.prototype.has=FR;Bt.prototype.set=MR;function LR(r,e){var t=Od(r),i=!t&&KR(r),n=!t&&!i&&Zc(r),o=!t&&!i&&!n&&Mb(r),a=t||i||n||o,c=a?$E(r.length,String):[],p=c.length;for(var f in r)(e||rt.call(r,f))&&!(a&&(f=="length"||n&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||GR(f,p)))&&c.push(f);return c}function Ld(r,e){for(var t=r.length;t--;)if(Eb(r[t][0],e))return t;return-1}function UR(r,e,t){var i=e(r);return Od(r)?i:zE(i,t(r))}function Ps(r){return r==null?r===void 0?OE:TE:yr&&yr in Object(r)?jR(r):$R(r)}function lb(r){return Ss(r)&&Ps(r)==wd}function Ab(r,e,t,i,n){return r===e?!0:r==null||e==null||!Ss(r)&&!Ss(e)?r!==r&&e!==e:BR(r,e,t,i,Ab,n)}function BR(r,e,t,i,n,o){var a=Od(r),c=Od(e),p=a?Vc:Ut(r),f=c?Vc:Ut(e);p=p==wd?Ai:p,f=f==wd?Ai:f;var v=p==Ai,m=f==Ai,b=p==f;if(b&&Zc(r)){if(!Zc(e))return!1;a=!0,v=!1}if(b&&!v)return o||(o=new Bt),a||Mb(r)?Tb(r,e,t,i,n,o):qR(r,e,p,t,i,n,o);if(!(t&Fd)){var y=v&&rt.call(r,"__wrapped__"),C=m&&rt.call(e,"__wrapped__");if(y||C){var I=y?r.value():r,A=C?e.value():e;return o||(o=new Bt),n(I,A,t,i,o)}}return b?(o||(o=new Bt),HR(r,e,t,i,n,o)):!1}function DR(r){if(!Fb(r)||zR(r))return!1;var e=Rb(r)?iR:jE;return e.test(Sr(r))}function _R(r){return Ss(r)&&Ob(r.length)&&!!j[Ps(r)]}function NR(r){if(!JR(r))return oR(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function Tb(r,e,t,i,n,o){var a=t&Fd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var f=o.get(r);if(f&&o.get(e))return f==e;var v=-1,m=!0,b=t&cb?new Rd:void 0;for(o.set(r,e),o.set(e,r);++v<c;){var y=r[v],C=e[v];if(i)var I=a?i(C,y,v,e,r,o):i(y,C,v,r,e,o);if(I!==void 0){if(I)continue;m=!1;break}if(b){if(!JE(e,function(A,M){if(!XE(b,M)&&(y===A||n(y,A,t,i,o)))return b.push(M)})){m=!1;break}}else if(!(y===C||n(y,C,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function qR(r,e,t,i,n,o,a){switch(t){case Td:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case kb:return!(r.byteLength!=e.byteLength||!o(new ob(r),new ob(e)));case pb:case fb:case vb:return Eb(+r,+e);case gb:return r.name==e.name&&r.message==e.message;case yb:case bb:return r==e+"";case xd:var c=YE;case Ad:var p=i&Fd;if(c||(c=eR),r.size!=e.size&&!p)return!1;var f=a.get(r);if(f)return f==e;i|=cb,a.set(r,e);var v=Tb(c(r),c(e),i,n,o,a);return a.delete(r),v;case RE:if(Gc)return Gc.call(r)==Gc.call(e)}return!1}function HR(r,e,t,i,n,o){var a=t&Fd,c=ub(r),p=c.length,f=ub(e),v=f.length;if(p!=v&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:rt.call(e,b)))return!1}var y=o.get(r);if(y&&o.get(e))return y==e;var C=!0;o.set(r,e),o.set(e,r);for(var I=a;++m<p;){b=c[m];var A=r[b],M=e[b];if(i)var ce=a?i(M,A,b,e,r,o):i(A,M,b,r,e,o);if(!(ce===void 0?A===M||n(A,M,t,i,o):ce)){C=!1;break}I||(I=b=="constructor")}if(C&&!I){var _n=r.constructor,ka=e.constructor;_n!=ka&&"constructor"in r&&"constructor"in e&&!(typeof _n=="function"&&_n instanceof _n&&typeof ka=="function"&&ka instanceof ka)&&(C=!1)}return o.delete(r),o.delete(e),C}function ub(r){return UR(r,YR,WR)}function Ud(r,e){var t=r.__data__;return VR(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ei(r,e){var t=ZE(r,e);return DR(t)?t:void 0}function jR(r){var e=rt.call(r,yr),t=r[yr];try{r[yr]=void 0;var i=!0}catch{}var n=wb.call(r);return i&&(e?r[yr]=t:delete r[yr]),n}var WR=ab?function(r){return r==null?[]:(r=Object(r),VE(ab(r),function(e){return xb.call(r,e)}))}:QR,Ut=Ps;(Jc&&Ut(new Jc(new ArrayBuffer(1)))!=Td||bs&&Ut(new bs)!=xd||$c&&Ut($c.resolve())!=eb||Kc&&Ut(new Kc)!=Ad||Xc&&Ut(new Xc)!=zc)&&(Ut=function(r){var e=Ps(r),t=e==Ai?r.constructor:void 0,i=t?Sr(t):"";if(i)switch(i){case aR:return Td;case dR:return xd;case lR:return eb;case uR:return Ad;case cR:return zc}return e});function GR(r,e){return e=e??mb,!!e&&(typeof r=="number"||WE.test(r))&&r>-1&&r%1==0&&r<e}function VR(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function zR(r){return!!nb&&nb in r}function JR(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Md;return r===t}function $R(r){return wb.call(r)}function Sr(r){if(r!=null){try{return Ib.call(r)}catch{}try{return r+""}catch{}}return""}function Eb(r,e){return r===e||r!==r&&e!==e}var KR=lb(function(){return arguments}())?lb:function(r){return Ss(r)&&rt.call(r,"callee")&&!xb.call(r,"callee")},Od=Array.isArray;function XR(r){return r!=null&&Ob(r.length)&&!Rb(r)}var Zc=sR||eO;function ZR(r,e){return Ab(r,e)}function Rb(r){if(!Fb(r))return!1;var e=Ps(r);return e==hb||e==AE||e==xE||e==EE}function Ob(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=mb}function Fb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function Ss(r){return r!=null&&typeof r=="object"}var Mb=ib?KE(ib):_R;function YR(r){return XR(r)?LR(r):NR(r)}function QR(){return[]}function eO(){return!1}Ti.exports=ZR});var hS=h(Xd=>{"use strict";Xd.byteLength=TO;Xd.toByteArray=RO;Xd.fromByteArray=MO;var st=[],qe=[],AO=typeof Uint8Array<"u"?Uint8Array:Array,Om="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Br=0,fS=Om.length;Br<fS;++Br)st[Br]=Om[Br],qe[Om.charCodeAt(Br)]=Br;var Br,fS;qe[45]=62;qe[95]=63;function gS(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function TO(r){var e=gS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function EO(r,e,t){return(e+t)*3/4-t}function RO(r){var e,t=gS(r),i=t[0],n=t[1],o=new AO(EO(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=qe[r.charCodeAt(p)]<<18|qe[r.charCodeAt(p+1)]<<12|qe[r.charCodeAt(p+2)]<<6|qe[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=qe[r.charCodeAt(p)]<<2|qe[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=qe[r.charCodeAt(p)]<<10|qe[r.charCodeAt(p+1)]<<4|qe[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function OO(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function FO(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(OO(i));return n.join("")}function MO(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(FO(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 QH=Nn(Lv(),1);function g(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function ur(r,e){if(!r)throw Error(e)}var ie;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(ie||(ie={}));function At(r){return r.startsWith(ie.COMMENT)}function ud(r){return r.startsWith(ie.ACCOUNT)}function cr(r){return r.startsWith(ie.LINK)}function Uv(r){return r.startsWith(ie.MESSAGE)}function Bv(r){return r.startsWith(ie.SUBREDDIT)}function Dv(r){return r.startsWith(ie.AWARD)}function GT(r){ur(At(r),`Expected comment id to start with ${ie.COMMENT}, got ${r}}`)}function VT(r){ur(ud(r),`Expected account id to start with ${ie.ACCOUNT}, got ${r}}`)}function zT(r){ur(cr(r),`Expected link id to start with ${ie.LINK}, got ${r}}`)}function JT(r){ur(Uv(r),`Expected message id to start with ${ie.MESSAGE}, got ${r}}`)}function $T(r){ur(Bv(r),`Expected subreddit id to start with ${ie.SUBREDDIT}, got ${r}}`)}function KT(r){ur(Dv(r),`Expected award id to start with ${ie.AWARD}, got ${r}}`)}function ii(r){return GT(r),r}function ne(r){return VT(r),r}function ge(r){return zT(r),r}function XT(r){return JT(r),r}function Oe(r){return $T(r),r}function ZT(r){return KT(r),r}function he(r){if(At(r))return ii(r);if(ud(r))return ne(r);if(cr(r))return ge(r);if(Uv(r))return XT(r);if(Bv(r))return Oe(r);if(Dv(r))return ZT(r);throw new Error(`Expected thing id to start with ${Object.values(ie).join(", ")} got ${r}}`)}function pc(r){return At(r)}import*as P from"@devvit/protos";var cd=class{constructor(e){}};var fc=(t=>(t.Installation="installation",t.App="app",t))(fc||{});function mr(r,e=new Set){for(let t of r){if(t.type==="group"){mr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}YT(r)}function YT(r){for(let e of r)if(e.type==="string"&&e.isSecret&&e.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${e.name}"`}var Tt=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var SL=["activity","add-emoji","add","add-media","add-to-feed","admin","align-center","align-left","align-right","all","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audio","author","avatar-style","award","back","ban","best","binoculars","block","blockchain","bold","bot","boost","bounce","brand-awareness","browse","browser","cake","calendar","camera","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","checkbox-dismiss","checkbox","checkmark","chrome","clear","close","closed-captioning","code-block","code-inline","coins-color-old","coins-color","coins","collapse-left","collapse-right","collection","comment","comments","community","contest","controversial","crop","crosspost","crowd-control","custom-feed","customize","day","delete","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","gif-post","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","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","mark-read","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","new","night","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","planet","play","poll-post","popular","posts","powerup-color-outline","powerup-fill-color","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","refresh","remove","reply","report","reverse","right","rising","rotate","rotate-image","rpan","rules","safari","save","saved","search","self","send","settings","share-android","share","share-ios","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","telescope","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","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-live-1","video-live-fill-1","video-live","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","views","volume","volume-mute","wallet","warning","wiki-ban","wiki","wiki-unban","world"];import{AppSettingsDefinition as f0,GetFieldsResponse as g0}from"@devvit/protos";import{FormField as pr,FormFieldType as Fe}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return QT(e);case"image":return e0(e);case"paragraph":return t0(e);case"number":return r0(e);case"select":return i0(e);case"boolean":return n0(e);case"group":return s0(e);default:throw new Error("Unknown field type.")}})}function QT(r){return pr.fromPartial({defaultValue:{fieldType:Fe.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Fe.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function e0(r){return pr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Fe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function t0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Fe.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function r0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Fe.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function i0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Fe.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function n0(r){return pr.fromPartial({defaultValue:{fieldType:Fe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Fe.BOOLEAN,helpText:r.helpText,label:r.label})}function s0(r){return pr.fromPartial({fieldType:Fe.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText})}function U(r,e){u.prototype[r]=e}import{ValidateFormResponse as p0}from"@devvit/protos";import{RealtimeSubscriptionStatus as Nv}from"@devvit/protos";var D=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),_v;(function(r){r.Blocks="blocks",r.EmitSnapshots="emitSnapshots",r.EmitState="emitState",r.Realtime="realtime",r.Runtime="runtime",r.Surface="surface",r.UseAsync="useAsync",r.Payments="payments"})(_v||(_v={}));function qv(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];g(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];g(p,"useChannel - installation is missing from Context");async function f(A){let M=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(M,A);else throw Error(`Failed to send to channel '${M}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${M}`)}function v(){if(!o[n].active){let A=o[n].channel;o[n].active=!0,r.addRealtimeChannel(A)}}function m(){if(o[n].active){let A=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(A)}}function b(A){return async()=>{let M;switch(A.status){case Nv.REALTIME_SUBSCRIBED:o[n].connected=!0,M=t.onSubscribed?.();break;case Nv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,M=t.onUnsubscribed?.();break;default:M=t.onMessage(A.event?.data??{});break}await M}}let y={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Tt.CHANNEL};n in o?y=o[n]:n in a&&(y=a[n]);let C=r.realtimeEvent;r.isInitialRender?y.active=!1:C&&y.active&&C.event.channel===y.channel&&(y.preventCallback||r.runHook(b(C)),r.rerenderIn(0)),o[n]=y,r.currentHookIndex++;let I=0;return y.active&&y.connected?I=2:y.active&&!y.connected?I=1:!y.active&&y.connected?I=3:!y.active&&!y.connected&&(I=4),{subscribe:v,unsubscribe:m,send:f,status:I}}return e}import{FormFieldType as ni}from"@devvit/protos";function gc(r){switch(r.fieldType){case ni.STRING:return r.stringValue;case ni.IMAGE:return r.stringValue;case ni.PARAGRAPH:return r.stringValue;case ni.NUMBER:return r.numberValue;case ni.BOOLEAN:return r.boolValue;case ni.SELECTION:return r.selectionValue?.values??[];default:return}}function Et(r){return Object.keys(r).reduce((e,t)=>{let i=gc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Hv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,f={formKey:p,preventSubmit:!1,type:Tt.FORM};n in a?f=a[n]:n in c&&(f=c[n]),a[n]=f,r.forms.set(p,t);let v=r.formSubmittedEvent;return v&&!f.preventSubmit&&v.formId===p&&r.runHook(async()=>{let m=i(Et(v.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function jv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),f={lastRun:void 0,running:!1,preventCallback:!1,type:Tt.INTERVAL};n in o?f=o[n]:n in a&&(f=a[n]);function v(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,y]of Object.entries(o))if(b!==n.toString()&&y?.type===Tt.INTERVAL&&y?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:o[n]?.lastRun??Date.now(),preventCallback:!1,type:Tt.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&f.running&&(f.preventCallback||(f.lastRun===void 0||f.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,f.lastRun=Date.now()}),r.rerenderIn(p)),f.preventCallback=!1,o[n]=f,r.currentHookIndex++,{start:v,stop:m}}return e}function Wv(r){function e(t){let i=r.currentHookIndex,n=r.getCurrentComponentState(),o=r.getPreviousComponentState();if(i in n)return r.currentHookIndex++,[n[i],a];if(r.isInitialRender||!(i in o)){let c=t instanceof Function?t():t;if(c instanceof Promise)throw(async()=>{n[i]=await c,r.currentHookIndex=0})();n[i]=c}else n[i]=o[i];function a(c){if(r.isRendering)throw new Error("Cannot call setState while rendering.");n[i]=c instanceof Function?c(n[i]):c}return r.currentHookIndex++,[n[i],a]}return e}var bc={now(){return new Date}};function Gv(r){return`__autocache__${r}`}function Vv(r){return`__lock__${r}`}var a0=300,d0=1e3,md=5e3,hc=3,zv=.1,Jv=1e3,l0=3e4;function $v(r){if(r.error)throw new Error(r.error);return r.value}var Rt,Ot,Me,si,$,Kv,Xv,Zv,vc,Yv,Qv,yc,ey,pd=class{constructor(e,t,i=bc){l(this,$);l(this,Rt);l(this,Ot,{});l(this,Me);l(this,si);d(this,Rt,e),d(this,si,t),d(this,Me,i)}async cache(e,t){d(this,Ot,s(this,si).__cache=s(this,si).__cache??{}),S(this,$,ey).call(this,t);let i=S(this,$,Kv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,yc).call(this,t.key),o=await S(this,$,Xv).call(this,t,n,e);return $v(o)}};Rt=new WeakMap,Ot=new WeakMap,Me=new WeakMap,si=new WeakMap,$=new WeakSet,Kv=function(e){let t=s(this,Ot)[e];if(t){let i=s(this,Me).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<hc&&Math.random()<zv&&t.errorTime+Jv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Jv<i||n){delete s(this,Ot)[e];return}else return $v(t)}},Xv=async function(e,t,i){let n=t?.expires,o=n?S(this,$,Qv).call(this,n):1;return!t||t?.error&&t.errorCount<hc&&zv>Math.random()||o>Math.random()?S(this,$,Zv).call(this,e,t,i):t},Zv=async function(e,t,i){let n=Vv(e.key),o=s(this,Me).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Rt).set(n,"1",{expiration:a,nx:!0}))return S(this,$,Yv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Me).now();return S(this,$,vc).call(this,p,e.key,e.ttl)}},vc=async function(e,t,i){let n=Math.min(i,d0),o=await S(this,$,yc).call(this,t);if(o)return o;if(s(this,Me).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,a0)),S(this,$,vc).call(this,e,t,i)},Yv=async function(e,t,i,n){let o=s(this,Me).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,Me).now().getTime(),t.errorCount++}return s(this,Ot)[e]=t,await s(this,Rt).set(Gv(e),JSON.stringify(t),{expiration:new Date(o+l0)}),t.error&&t.errorCount<hc&&await s(this,Rt).del(Vv(e)),t},Qv=function(e){let t=s(this,Me).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},yc=async function(e){let t=await s(this,Rt).get(Gv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Me).now().getTime(),s(this,Ot)[e]=i,i}},ey=function(e){e.ttl<md&&(console.warn(`Cache TTL cannot be less than ${md} milliseconds! Updating ttl value of ${e.ttl} to ${md}.`),e.ttl=md)};function ty(r,e,t=bc){let i=new pd(r,e,t);return i.cache.bind(i)}function ry(r){new URL(r.slice(0,r.indexOf(",")))}var oi,ai,li,iy,ny,di=class{constructor(){l(this,li);l(this,oi,{});l(this,ai,{});d(this,oi,u.assets),d(this,ai,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,li,iy).call(this,e,t??{webview:!1}):S(this,li,ny).call(this,e,t??{webview:!1})}};oi=new WeakMap,ai=new WeakMap,li=new WeakSet,iy=function(e,t){let i=t.webview?s(this,ai)[e]:s(this,oi)[e];if(i)return i;try{return ry(e),encodeURI(e)}catch{return""}},ny=function(e,t){let i={},n=[],o=t.webview?s(this,ai):s(this,oi);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{ry(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var Ft,ui=class{constructor(e){l(this,Ft);d(this,Ft,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Ft));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,Ft))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Ft))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Ft));return e}};Ft=new WeakMap;var as,ci=class{constructor(e){l(this,as);d(this,as,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,as));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};as=new WeakMap;var ds,mi=class{constructor(e){l(this,ds);d(this,ds,e)}async add(e){await u.modLogPlugin.Add(e,s(this,ds))}};ds=new WeakMap;var ls,pi=class{constructor(e){l(this,ls);d(this,ls,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:t},s(this,ls))}};ls=new WeakMap;var k,us,gi=class{constructor(e){l(this,k);l(this,us);d(this,k,e),d(this,us,new gd(e))}get modMail(){return s(this,us)}getSubredditById(e){return ve.getById(he(e),s(this,k))}getSubredditByName(e){return ve.getByName(e,s(this,k))}addSubredditRemovalReason(e,t){return ve.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return ve.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return ve.getFromMetadata(s(this,k))}getPostById(e){return z.getById(he(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 w.getById(he(e),s(this,k))}getCollectionById(e){return fi.getCollectionById({collectionId:e},s(this,k))}createCollection(e){return fi.create(e,s(this,k))}getCollectionsForSubreddit(e){return fi.getCollectionsForSubreddit({subredditId:e},s(this,k))}getUserByUsername(e){return w.getByUsername(e,s(this,k))}getCurrentUser(){return w.getFromMetadata(D.User,s(this,k))}getAppUser(){return w.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return w.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return Q.getById(he(e),s(this,k))}getComments(e){return Q.getComments(e,s(this,k))}getCommentsByUser(e){return Q.getCommentsByUser(e,s(this,k))}submitComment(e){return Q.submit({...e,id:he(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 w.getOverview(e,s(this,k))}getModerationLog(e){return fd(e,s(this,k))}getApprovedUsers(e){return w.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return w.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return w.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return w.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return w.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return w.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,k))}unbanUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return w.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return w.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return w.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return w.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return w.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.subredditName,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return w.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return w.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return w.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return w.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return w.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return w.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Le.get(e,s(this,k))}deleteModNote(e){return Le.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?he(e.redditId):void 0};return Le.add(t,s(this,k))}addRemovalNote(e){return Le.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return fr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return fr.sendAsSubreddit(e,s(this,k))}async approve(e){if(At(e))return Q.approve(e,s(this,k));if(cr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(At(e))return Q.remove(e,t,s(this,k));if(cr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return de.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return de.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return de.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return de.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return de.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return de.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Ue.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Ue.removePostFlair(e,ge(t),s(this,k))}async getWidgets(e){return se.getWidgets(e,s(this,k))}async deleteWidget(e,t){return se.delete(e,t,s(this,k))}async addWidget(e){return se.add(e,s(this,k))}async reorderWidgets(e,t){return se.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ye.getPage(e,t,s(this,k))}async getWikiPages(e){return ye.getPages(e,s(this,k))}async createWikiPage(e){return ye.createPage(e,s(this,k))}async updateWikiPage(e){return ye.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ye.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ye.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ye.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ye.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ye.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ye.removeEditor(e,t,i,s(this,k))}getMessages(e){return fr.getMessages(e,s(this,k))}markAllMessagesAsRead(){return fr.markAllAsRead(s(this,k))}report(e,t){return u.redditAPIPlugins.LinksAndComments.Report({reason:t.reason,thingId:e.id,srName:e.subredditName,usernames:e.authorName},s(this,k))}getModQueue(e){return ve.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return ve.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return ve.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return ve.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return ve.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return ay(e,s(this,k))}getVaultByUserId(e){return dy(he(e),s(this,k))}getSubredditLeaderboard(e){return oy(e,s(this,k))}};k=new WeakMap,us=new WeakMap;import{RedisKeyScope as kc}from"@devvit/protos";var R,O,F,Sc=class{constructor(e,t,i){l(this,R);l(this,O);l(this,F);d(this,R,e),d(this,O,t),d(this,F,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,O)},s(this,F)),this}async multi(){await s(this,R).Multi(s(this,O),s(this,F))}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,F)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,O)},s(this,F)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,O)},s(this,F)),this}async exec(){let e=await s(this,R).Exec(s(this,O),s(this,F)),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,F))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,O)},s(this,F)),this}async unwatch(){return await s(this,R).Unwatch(s(this,O),s(this,F)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,O)},s(this,F)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,O)},s(this,F)),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,F)),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,F)),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,F)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,O)},s(this,F)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,O)},s(this,F)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,O)},s(this,F)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,O)},s(this,F)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,O)},member:t},s(this,F)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,O)},member:t},s(this,F)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,O)},s(this,F)),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,F)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,O)},s(this,F)),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,F)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,O)},members:t},s(this,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),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,F)),this}};R=new WeakMap,O=new WeakMap,F=new WeakMap;var L,hi,Pc=class Pc{constructor(e,t=void 0,i=kc.INSTALLATION){l(this,L);l(this,hi);d(this,L,e),d(this,hi,t),this.scope=i,this.global=i===kc.INSTALLATION?new Pc(s(this,L),s(this,hi),kc.GLOBAL):this}get storage(){return s(this,hi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,L));return new Sc(this.storage,t,s(this,L))}async get(e){let t=await this.storage.Get({key:e,scope:this.scope},s(this,L));return t!==null?t.value??void 0: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,L))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,L))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,L))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,L));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,L))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,L))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,L))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,L))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,L))).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,L))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,L))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,L))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,L))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,L))).value}async zScore(e,t){let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},s(this,L));return i!==null?i.value:i}async zRank(e,t){let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},s(this,L));return i!==null?i.value:i}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,L));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,L));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,L))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,L));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,L))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,L));return t!==null?t.value:t}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){let i=await this.storage.HGet({key:e,field:t,scope:this.scope},s(this,L));return i!==null?i.value??void 0: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,L))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,L));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,L))).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,L))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,L));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,L))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};L=new WeakMap,hi=new WeakMap;var vi=Pc;var gr,yi=class{constructor(e){l(this,gr);d(this,gr,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,gr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,gr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,gr))).actions.map(t=>(g(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}))}};gr=new WeakMap;var cs,bi=class{constructor(e){l(this,cs);d(this,cs,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,cs));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...ly(t.installationSettings.settings,u.installationSettings),...ly(t.appSettings.settings,u.appSettings)}}};cs=new WeakMap;function ly(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=gc(r[n]),i),{});return e&&uy(t,e),t}function uy(r,e){for(let t of e)t.type==="group"?uy(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as Cc,Form as u0,ToastAppearance as cy}from"@devvit/protos";var hr,ki,hd=class{constructor(e){l(this,hr,[]);l(this,ki);d(this,ki,e)}showForm(e,t){let i=u.formDefinitions.get(e);if(!i&&s(this,ki)){let a=s(this,ki).forms.get(e);a&&(i={form:a,onSubmit:()=>{}})}if(!i)throw new Error("Form does not exist. Make sure you have added it using Devvit.createForm at the root of your app.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=u0.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});mr(n.fields),o.fields=mt(n.fields),s(this,hr).push({type:Cc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?cy.SUCCESS:cy.NEUTRAL}:t={text:e},s(this,hr).push({type:Cc.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,hr).push({type:Cc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,hr)}};hr=new WeakMap,ki=new WeakMap;function Be({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new mi(r),o=new ui(r),a=new vi(r),c=ty(a,i?i.state:{}),p=new gi(r),f=new yi(r),v=new bi(r),m=e?new hd(i):void 0,b=new ci(r),y=new di,C=new pi(r),I=t&&i?Wv(i):void 0,A=t&&i?jv(i):void 0,M=t&&i?Hv(i):void 0,ce=t&&i?qv(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:f,settings:v,media:b,assets:y,realtime:C,get useForm(){return M??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return I??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return A??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return ce??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var my={name:"@devvit/public-api",version:"0.11.0-dev",license:"BSD-3-Clause",repository:{type:"git",url:"https://developers.reddit.com/"},type:"module",exports:{".":"./dist/index.js","./package.json":"./package.json","./*":"./dist/*"},main:"./dist/index.js",files:["dist/**"],scripts:{build:"yarn build:icon-types && yarn build:semantic-colors && tsc && cp -af devvit.tsconfig.json dist/ && yarn build:types && yarn build:min && yarn build:unmin","build:icon-types":"make-icons src/types/icons.ts","build:min":"esbuild --bundle --sourcemap=linked --target=es2020 --format=esm --metafile=dist/meta.min.json --outfile=dist/public-api.min.js --external:@devvit/protos --minify src/index.ts","build:semantic-colors":"node scripts/make-semantic-colors.js","build:types":"api-extractor run && sed -ne '/declare global {/,$ p' src/devvit/Devvit.ts >> dist/public-api.d.ts","build:unmin":"esbuild --bundle --sourcemap=inline --target=es2020 --format=iife --metafile=dist/meta.json --outfile=dist/public-api.iife.js --global-name=devvitPublicAPI src/index.ts",clean:"rm -rf .turbo api-extractor coverage dist src/devvit/internals/semanticColors.ts src/types/icons.ts || :",clobber:"yarn clean && rm -rf node_modules",dev:"tsc -w","dev:build":"chokidar ./src --command 'yarn build' --ignore './src/types/icons.ts' --ignore './src/devvit/internals/semanticColors.ts'",lint:"redlint .","lint:fix":"yarn lint --fix",prepublishOnly:"publish-package-json",test:"yarn test:unit && yarn test:types && yarn test:size","test:size":"filesize","test:types":"tsc --noEmit","test:unit":"vitest run","test:unit-with-coverage":"vitest run --coverage"},types:"./dist/index.d.ts",dependencies:{"@devvit/protos":"0.11.0-dev","@devvit/shared-types":"0.11.0-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/eslint-config":"0.11.0-dev","@devvit/repo-tools":"0.11.0-dev","@devvit/tsconfig":"0.11.0-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"11.3.3","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"8.9.0",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"255 KB"}},source:"./src/index.ts"};function le(r,e,t){let i=r[D.Subreddit]?.values[0];g(i,"subreddit is missing from Context");let n=r[D.AppUser]?.values[0],o=r[D.User]?.values[0],a=m0(r);return{get appAccountId(){return g(n,"appAccountId is missing from Context"),n},subredditId:i,userId:o,postId:e,commentId:t,debug:a,toJSON(){return{appAccountId:n,subredditId:i,userId:o,postId:e,commentId:t,debug:a}}}}function m0(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},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[D.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||"true"))}return r[D.Debug]&&console.info(`[api] @devvit/public-api v${my.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function py(r){return r.flatMap(e=>e.type==="group"?py(e.fields):e)}async function vd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Et(r.fieldValues),o=py(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],f=a.onValidate,v=Object.assign(Be({metadata:t}),le(t)),m=await f({value:p,isEditing:r.editing},v);m&&(i.success=!1,i.errors[c]=m)}})),p0.fromJSON(i)}async function h0(){if(!u.appSettings)throw new Error("App settings were not defined.");return g0.fromJSON({fields:{fields:mt(u.appSettings)}})}async function v0(r,e){return vd(r,u.appSettings,e)}function fy(r){r.provides(f0),U("GetAppSettingsFields",h0),U("ValidateAppForm",v0)}import{CustomPostDefinition as I0,RenderPostResponse as w0}from"@devvit/protos";import{BlockRenderEventType as Dc,EffectType as Fy}from"@devvit/protos";function Si(r){return r.__effects}function gy(){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 Bc,BlockAnimationDirection as wy,BlockAnimationLoopMode as xy,BlockAnimationType as Ay,BlockAvatarBackground as Ty,BlockAvatarFacing as Ey,BlockAvatarSize as Mt,BlockBorderWidth as Sd,BlockButtonAppearance as Lt,BlockButtonSize as Tc,BlockFullSnooSize as Ci,BlockGap as Pd,BlockHorizontalAlignment as Ec,BlockIconSize as Cd,BlockImageResizeMode as ms,BlockPadding as ps,BlockRadius as fs,BlockSpacerShape as Rc,BlockSpacerSize as Id,BlockStackDirection as Oc,BlockTextOutline as Fc,BlockTextOverflow as Mc,BlockTextSize as Ii,BlockTextStyle as Lc,BlockTextWeight as Ry,BlockType as De,BlockVerticalAlignment as Uc}from"@devvit/protos";var Ic={transparent:"transparent",black:"#000000",white:"#ffffff","coolgray-950":"#04090A","coolgray-900":"#0B1416","coolgray-850":"#0F1A1C","coolgray-800":"#131F23","coolgray-750":"#1A282D","coolgray-700":"#223237","coolgray-650":"#2A3C42","coolgray-600":"#33464C","coolgray-550":"#4B6066","coolgray-525":"#576F76","coolgray-500":"#667A80","coolgray-450":"#82959B","coolgray-400":"#A0B0B5","coolgray-350":"#B8C5C9","coolgray-300":"#D2DADD","coolgray-250":"#DAE0E3","coolgray-200":"#E2E7E9","coolgray-150":"#EAEDEF","coolgray-100":"#F2F4F5","coolgray-50":"#F9FAFA","puregray-950":"#080808","puregray-900":"#131313","puregray-850":"#181818","puregray-800":"#1E1E1E","puregray-750":"#272727","puregray-700":"#303030","puregray-650":"#393939","puregray-600":"#434343","puregray-550":"#5C5C5C","puregray-500":"#767676","puregray-450":"#919191","puregray-400":"#ACACAC","puregray-350":"#C3C3C3","puregray-300":"#D6D6D6","puregray-250":"#DDDDDD","puregray-200":"#E4E4E4","puregray-150":"#EBEBEB","puregray-100":"#F2F2F2","puregray-50":"#F8F8F8","orangered-950":"#190600","orangered-900":"#340E00","orangered-800":"#4F1500","orangered-700":"#721F00","orangered-600":"#962900","orangered-500":"#D93A00","orangered-400":"#FE7C53","orangered-300":"#FFBEA6","orangered-200":"#FFD5C6","orangered-100":"#FFEDE5","orangered-50":"#FFF6F3","red-950":"#1C0004","red-900":"#3A0008","red-800":"#58000C","red-700":"#7E0011","red-600":"#A50016","red-500":"#EB001F","red-400":"#FF6E80","red-300":"#FFADB8","red-200":"#FFCCD2","red-100":"#FFEAED","red-50":"#FFF6F7","sakurapink-950":"#1A0011","sakurapink-900":"#360024","sakurapink-800":"#530037","sakurapink-700":"#770051","sakurapink-600":"#9B006A","sakurapink-500":"#E00096","sakurapink-400":"#FF55BD","sakurapink-300":"#FFA5E3","sakurapink-200":"#FFC5EC","sakurapink-100":"#FFE5F9","sakurapink-50":"#FFF3FB","berrypurple-950":"#16001F","berrypurple-900":"#2E0041","berrypurple-800":"#470062","berrypurple-700":"#66008C","berrypurple-600":"#8700B5","berrypurple-500":"#BC0EFF","berrypurple-400":"#D55EFF","berrypurple-300":"#EEA7FF","berrypurple-200":"#F2C8FF","berrypurple-100":"#FBE6FF","berrypurple-50":"#FCF4FF","periwinkle-950":"#0D0B1F","periwinkle-900":"#1A1741","periwinkle-800":"#272262","periwinkle-700":"#372F8C","periwinkle-600":"#453BB5","periwinkle-500":"#6A5CFF","periwinkle-400":"#988EFF","periwinkle-300":"#C3BDFF","periwinkle-200":"#D8D4FF","periwinkle-100":"#ECEAFF","periwinkle-50":"#F7F6FF","alienblue-950":"#000C1D","alienblue-900":"#00183D","alienblue-800":"#00255D","alienblue-700":"#003584","alienblue-600":"#0045AC","alienblue-500":"#1870F4","alienblue-400":"#629FFF","alienblue-300":"#A7CCFF","alienblue-200":"#C6DCFF","alienblue-100":"#E4EFFF","alienblue-50":"#F3F7FF","lightblue-950":"#000D12","lightblue-900":"#001C26","lightblue-800":"#002A3A","lightblue-700":"#003F56","lightblue-600":"#005472","lightblue-500":"#007FAE","lightblue-400":"#47B0DB","lightblue-300":"#95DCFB","lightblue-200":"#B6E9FF","lightblue-100":"#D9F6FF","lightblue-50":"#ECFAFF","mintgreen-950":"#00100E","mintgreen-900":"#001E1B","mintgreen-800":"#002E28","mintgreen-700":"#00443C","mintgreen-600":"#005A4F","mintgreen-500":"#008675","mintgreen-400":"#45B9AB","mintgreen-300":"#96E1D8","mintgreen-200":"#B7ECE5","mintgreen-100":"#DAF7F4","mintgreen-50":"#ECFBF9","kiwigreen-950":"#021000","kiwigreen-900":"#032200","kiwigreen-800":"#053200","kiwigreen-700":"#084A00","kiwigreen-600":"#0A6000","kiwigreen-500":"#0E8A00","kiwigreen-400":"#55BD46","kiwigreen-300":"#A3E398","kiwigreen-200":"#BFEEB8","kiwigreen-100":"#DFF8DB","kiwigreen-50":"#EEFCED","lime-950":"#0C0E00","lime-900":"#1A1F00","lime-800":"#282F00","lime-700":"#3A4501","lime-600":"#4D5A01","lime-500":"#6B7E01","lime-400":"#A1B33B","lime-300":"#CFDB83","lime-200":"#DFE8A6","lime-100":"#EFF4CC","lime-50":"#F7FAE5","yellow-950":"#100D01","yellow-900":"#251E02","yellow-800":"#382D03","yellow-700":"#504104","yellow-600":"#665505","yellow-500":"#8F7407","yellow-400":"#DBAF00","yellow-300":"#FADB61","yellow-200":"#FFE88F","yellow-100":"#FFF2BD","yellow-50":"#FFFAE5","yelloworange-950":"#150C00","yelloworange-900":"#2C1A00","yelloworange-800":"#432700","yelloworange-700":"#623A00","yelloworange-600":"#814C00","yelloworange-500":"#B06400","yelloworange-400":"#FF9C1A","yelloworange-300":"#FFCD7C","yelloworange-200":"#FFDDA8","yelloworange-100":"#FFF0D3","yelloworange-50":"#FFF7EA","poopbrown-950":"#110B04","poopbrown-900":"#29190A","poopbrown-800":"#3B2510","poopbrown-700":"#54371A","poopbrown-600":"#6E4924","poopbrown-500":"#9A6D3F","poopbrown-400":"#CAA075","poopbrown-300":"#EECCAA","poopbrown-200":"#F6DDC3","poopbrown-100":"#FEEEDD","poopbrown-50":"#FEF7EE",pizzaRed:{light:"#ef5350",dark:"#c62828"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-focus":{light:"#47B0DB",dark:"#007FAE"},"interactive-content-disabled":{light:"#0000003f",dark:"#ffffff3f"},"interactive-background-disabled":{light:"#0000000c",dark:"#ffffff0c"},"interactive-pressed":{light:"#00000028",dark:"#ffffff28"},"neutral-content":{light:"#2A3C42",dark:"#B8C5C9"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-weak":{light:"#576F76",dark:"#82959B"},"neutral-content-strong":{light:"#0F1A1C",dark:"#F2F4F5"},"neutral-background":{light:"#ffffff",dark:"#0B1416"},"neutral-background-selected":{light:"#EAEDEF",dark:"#1A282D"},"neutral-background-weak":{light:"#F9FAFA",dark:"#04090A"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-strong":{light:"#ffffff",dark:"#0F1A1C"},"neutral-background-hover":{light:"#F2F4F5",dark:"#131F23"},"neutral-border":{light:"#00000033",dark:"#ffffff33"},"neutral-border-medium":{light:"#0000007f",dark:"#ffffff7f"},"neutral-border-weak":{light:"#00000019",dark:"#ffffff19"},"neutral-border-strong":{light:"#0F1A1C",dark:"#F2F4F5"},primary:{light:"#0045AC",dark:"#629FFF"},"primary-hover":{light:"#003584",dark:"#A7CCFF"},"primary-visited":{light:"#8700B5",dark:"#D55EFF"},"primary-onBackground":{light:"#ffffff",dark:"#ffffff"},"primary-onBackground-selected":{light:"#ffffff",dark:"#000000"},"primary-background":{light:"#0045AC",dark:"#0045AC"},"primary-background-hover":{light:"#003584",dark:"#1870F4"},"primary-background-selected":{light:"#00255D",dark:"#629FFF"},secondary:{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-weak":{light:"#576F76",dark:"#82959B"},"secondary-onBackground":{light:"#000000",dark:"#ffffff"},"secondary-background":{light:"#EAEDEF",dark:"#1A282D"},"secondary-background-hover":{light:"#E2E7E9",dark:"#223237"},"secondary-background-selected":{light:"#D2DADD",dark:"#33464C"},"secondary-plain":{light:"#0F1A1C",dark:"#F2F4F5"},"secondary-plain-hover":{light:"#000000",dark:"#ffffff"},"danger-background":{light:"#EB001F",dark:"#A50016"},"danger-background-disabled":{light:"#FFCCD2",dark:"#3A0008"},"danger-background-hover":{light:"#A50016",dark:"#EB001F"},"danger-onBackground":{light:"#ffffff",dark:"#ffffff"},"danger-content":{light:"#A50016",dark:"#FF6E80"},"danger-content-hover":{light:"#7E0011",dark:"#FFADB8"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"brand-background":{light:"#D93A00",dark:"#D93A00"},"brand-onBackground":{light:"#ffffff",dark:"#ffffff"},"brand-background-hover":{light:"#962900",dark:"#962900"},"media-background":{light:"#00000099",dark:"#00000099"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-weak":{light:"#E2E7E9",dark:"#E2E7E9"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-border-selected":{light:"#ffffff",dark:"#ffffff"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"success-content":{light:"#0A6000",dark:"#55BD46"},"success-hover":{light:"#084A00",dark:"#A3E398"},"success-onBackground":{light:"#ffffff",dark:"#ffffff"},"success-background":{light:"#0E8A00",dark:"#0A6000"},"success-background-hover":{light:"#0A6000",dark:"#0E8A00"},"warning-content":{light:"#665505",dark:"#DBAF00"},"warning-content-hover":{light:"#504104",dark:"#FADB61"},"warning-onBackground":{light:"#000000",dark:"#000000"},"warning-background":{light:"#DBAF00",dark:"#DBAF00"},"warning-background-hover":{light:"#8F7407",dark:"#FADB61"},"upvote-content":{light:"#962900",dark:"#FE7C53"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#9629004c",dark:"#FE7C534c"},"upvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"upvote-background":{light:"#D93A00",dark:"#D93A00"},"upvote-background-hover":{light:"#962900",dark:"#962900"},"upvote-background-disabled":{light:"#D93A004c",dark:"#D93A004c"},"downvote-content":{light:"#453BB5",dark:"#988EFF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#453BB54c",dark:"#988EFF4c"},"downvote-onBackground":{light:"#ffffff",dark:"#ffffff"},"downvote-background":{light:"#6A5CFF",dark:"#453BB5"},"downvote-background-hover":{light:"#453BB5",dark:"#453BB5"},"downvote-background-disabled":{light:"#6A5CFF4c",dark:"#6A5CFF4c"},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"transparent-background-hover":{light:"#82959B19",dark:"#667A8019"},"global-black":{light:"#000000",dark:"#000000"},"global-white":{light:"#ffffff",dark:"#ffffff"},"global-orangered":{light:"#D93A00",dark:"#D93A00"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#131F23",dark:"#131F23"},"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"},"action-upvote":{light:"#D93A00",dark:"#D93A00"},"action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"alert-caution":{light:"#8F7407",dark:"#8F7407"},"identity-admin":{light:"#D93A00",dark:"#D93A00"},"identity-moderator":{light:"#0E8A00",dark:"#0E8A00"},"identity-self":{light:"#008675",dark:"#008675"},"identity-coins":{light:"#DBAF00",dark:"#DBAF00"},"category-live":{light:"#D93A00",dark:"#D93A00"},"category-nsfw":{light:"#E00096",dark:"#E00096"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#ffffff",dark:"#0F1A1C"},"avatar-gradient":{light:"",dark:""},"opacity-highlight":{light:"",dark:""},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},"scrim-gradient":{light:"",dark:""},online:{light:"#55BD46",dark:"#55BD46"},favorite:{light:"#8F7407",dark:"#DBAF00"}};var hy={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",transparent:"#FFFFFF00",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},vy=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),yy=r=>r in Ic,wc=r=>r in hy,by=r=>!!r.match(/^rgba?\(.*/),ky=r=>!!r.match(/^hsla?\(.*/),Sy=(r,e="light")=>{if(wc(r))return yd(r);let i=Ic[r];return typeof i=="string"?i:i[e]},yd=r=>hy[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),f=Math.round(p*255);a.push(f)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as bd}from"@devvit/protos";var xc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:bd.UNRECOGNIZED,alignment:void 0}};function Iy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=y0(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||Cy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||Cy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function Cy(r,e,t,i){return e===r&&i||t===r&&i}function y0(r,e,t){let i=e===bd.STACK_VERTICAL||e===bd.UNRECOGNIZED,n=e===bd.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,f=0;return n&&p?f=2:i&&p&&(f=1),{growDirection:o,stretchDirection:f}}import{BlockSizeUnit as vr,BlockStackDirection as kd}from"@devvit/protos";function Pi(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:vr.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=vr.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=vr.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function b0(r,e){return(r.width?.value?.unit===vr.SIZE_UNIT_PERCENT||r.width?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===kd.STACK_HORIZONTAL||e.direction===kd.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===vr.SIZE_UNIT_PERCENT||r.height?.min?.unit===vr.SIZE_UNIT_PERCENT)&&(e.direction===kd.STACK_VERTICAL||e.direction===kd.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function Ac(r,e){if(r){let t=r.width!=null||r.minWidth!=null||r.maxWidth!=null,i=r.height!=null||r.minHeight!=null||r.maxHeight!=null;if(t||i||r.grow!=null){let n={width:t?{value:Pi(r.width),min:Pi(r.minWidth),max:Pi(r.maxWidth)}:void 0,height:i?{value:Pi(r.height),min:Pi(r.minHeight),max:Pi(r.maxHeight)}:void 0,grow:r.grow};return e.stackParentLayout&&(n=b0(n,e.stackParentLayout)),n}}}var Oy="data-",k0=new Set(["onPress","onMessage"]),S0=new Map([["onPress",Bc.ACTION_CLICK],["onMessage",Bc.ACTION_WEBVIEW]]),gs,wi=class{constructor(e=()=>{}){l(this,gs);d(this,gs,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},xc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"fullsnoo":return this.makeFullSnoo(t,n);case"animation":return this.makeAnimation(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return ps.PADDING_NONE;case"xsmall":return ps.PADDING_XSMALL;case"small":return ps.PADDING_SMALL;case"medium":return ps.PADDING_MEDIUM;case"large":return ps.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return fs.RADIUS_NONE;case"small":return fs.RADIUS_SMALL;case"medium":return fs.RADIUS_MEDIUM;case"large":return fs.RADIUS_LARGE;case"full":return fs.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return Pd.GAP_NONE;case"small":return Pd.GAP_SMALL;case"medium":return Pd.GAP_MEDIUM;case"large":return Pd.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Uc.ALIGN_TOP:e.includes("middle")?t=Uc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Uc.ALIGN_BOTTOM),e.includes("start")?i=Ec.ALIGN_START:e.includes("center")?i=Ec.ALIGN_CENTER:e.includes("end")&&(i=Ec.ALIGN_END),t!==void 0||i!==void 0)return{vertical:t,horizontal:i}}makeBlockBorder(e,t,i,n){if(!e&&!t)return;let o;switch(e){case"none":o=Sd.BORDER_WIDTH_NONE;break;case"thin":o=Sd.BORDER_WIDTH_THIN;break;case"thick":o=Sd.BORDER_WIDTH_THICK;break;default:o=Sd.BORDER_WIDTH_THIN;break}let a=t??"neutral-border-weak",c=this.getThemedColors(a,i,n);return{width:o,color:c?.light,colors:c}}makeBlockTextSize(e){switch(e){case"xsmall":return Ii.TEXT_SIZE_XSMALL;case"small":return Ii.TEXT_SIZE_SMALL;case"medium":return Ii.TEXT_SIZE_MEDIUM;case"large":return Ii.TEXT_SIZE_LARGE;case"xlarge":return Ii.TEXT_SIZE_XLARGE;case"xxlarge":return Ii.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Lc.TEXT_STYLE_BODY;case"metadata":return Lc.TEXT_STYLE_METADATA;case"heading":return Lc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return Fc.TEXT_OUTLINE_NONE;case"thin":return Fc.TEXT_OUTLINE_THIN;case"thick":return Fc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return Ry.TEXT_WEIGHT_REGULAR;case"bold":return Ry.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return Mc.TEXT_OVERFLOW_CLIP;case"ellipsis":return Mc.TEXT_OVERFLOW_ELLIPSE}return Mc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Lt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Lt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Lt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Lt.BUTTON_APPEARANCE_BORDERED;case"media":return Lt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Lt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Lt.BUTTON_APPEARANCE_CAUTION;case"success":return Lt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return Tc.BUTTON_SIZE_SMALL;case"medium":return Tc.BUTTON_SIZE_MEDIUM;case"large":return Tc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return ms.IMAGE_RESIZE_NONE;case"fit":return ms.IMAGE_RESIZE_FIT;case"fill":return ms.IMAGE_RESIZE_FILL;case"cover":return ms.IMAGE_RESIZE_COVER;case"scale-down":return ms.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return Id.SPACER_XSMALL;case"small":return Id.SPACER_SMALL;case"medium":return Id.SPACER_MEDIUM;case"large":return Id.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return Rc.SPACER_INVISIBLE;case"thin":return Rc.SPACER_THIN;case"square":return Rc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return Cd.ICON_SIZE_XSMALL;case"small":return Cd.ICON_SIZE_SMALL;case"medium":return Cd.ICON_SIZE_MEDIUM;case"large":return Cd.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Mt.AVATAR_SIZE_XXSMALL;case"xsmall":return Mt.AVATAR_SIZE_XSMALL;case"small":return Mt.AVATAR_SIZE_SMALL;case"medium":return Mt.AVATAR_SIZE_MEDIUM;case"large":return Mt.AVATAR_SIZE_LARGE;case"xlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxlarge":return Mt.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Mt.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return Ey.AVATAR_FACING_LEFT;case"right":return Ey.AVATAR_FACING_RIGHT}}makeBlockFullSnooSize(e){switch(e){case"xsmall":return Ci.FULLSNOO_XSMALL;case"small":return Ci.FULLSNOO_SMALL;case"medium":return Ci.FULLSNOO_MEDIUM;case"large":return Ci.FULLSNOO_LARGE;case"xlarge":return Ci.FULLSNOO_XLARGE;case"xxlarge":return Ci.FULLSNOO_XXLARGE}}makeBlockAvatarBackground(e){switch(e){case"dark":return Ty.AVATAR_BG_DARK;case"light":return Ty.AVATAR_BG_LIGHT}}makeBlockAnimationType(e){return e==="lottie"||e===void 0?Ay.ANIM_LOTTIE:Ay.UNRECOGNIZED}makeBlockAnimationDirection(e){switch(e){case"backward":return wy.ANIM_DIR_BACKWARD;case"forward":return wy.ANIM_DIR_FORWARD}}makeBlockLoopMode(e){switch(e){case"repeat":return xy.ANIM_LOOP_REPEAT;case"bounce":return xy.ANIM_LOOP_BOUNCE}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(Oy)).reduce((t,i)=>(t[i.substring(Oy.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return k0.forEach(o=>{if(o in t){let a=t[o];i.push({type:S0.get(o)??Bc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),vy(e)?e:yy(e)?Sy(e,t):wc(e)?yd(e):by(e)?Py(e):ky(e)?e:(console.warn(`Could not parse color: ${e}.`),yd("red"))}childrenToBlocks(e,t){return e.flatMap(i=>(typeof i!="string"?this.createBlocksElement(i,t):void 0)??[])}getThemedColors(e,t,i){let n=this.blockColorToHex(t,"light"),o=this.blockColorToHex(i,"dark"),a=[];if(e&&(!n||!o)){let c=Array.from(e?.matchAll(/[\w#-]+(?:\([\w\t ,.#-]+\))?/g)??[]);a.push(...c.map(p=>p[0]))}return n||(n=this.blockColorToHex(a?.at(0),"light")),o||(o=this.blockColorToHex(a?.at(1)??a?.at(0),"dark")),n||o?{light:n,dark:o}:void 0}parsePixels(e){return typeof e=="string"?Number(e.slice(0,-2)):e}resolveAssetUrl(e,t){return s(this,gs).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,xc))}wrapRoot(e,t){return this.makeBlock(De.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=Ac(t,i),p=Iy(t,i.stackParentLayout,c);return this.makeBlock(De.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(Oc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(Oc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(Oc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(De.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(De.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(De.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(De.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(De.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(De.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeFullSnoo(e,t){return e&&this.makeBlock(De.BLOCK_FULLSNOO,e,t,{fullsnooConfig:{userId:e.userId,facing:this.makeBlockAvatarFacing(e.facing),size:this.makeBlockFullSnooSize(e.size)}})}makeAnimation(e,t){return e&&this.makeBlock(De.BLOCK_ANIMATION,e,t,{animationConfig:{type:this.makeBlockAnimationType(e.type),url:this.resolveAssetUrl(e.url),loop:e.loop,loopMode:this.makeBlockLoopMode(e.loopMode),autoplay:e.autoplay,width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight),direction:this.makeBlockAnimationDirection(e.direction),speed:e.speed}})}makeWebView(e,t){return e&&this.makeBlock(De.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:Ac(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===De.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};gs=new WeakMap;function My(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Ly=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+=Ly(i);return e+=`</${r.type}>`,e};function P0(r){return" ".repeat(r)}function C0(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+=P0(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
2
+ `),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var _e,Uy,hs,_c,vs,pt=class{constructor(e,t,i,n,o){l(this,_e);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new wi(()=>this.assets);this.effects=[];l(this,vs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=Be({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,_e,hs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(My(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,_e,Uy).call(this)}async buildBlocksUI(){let e=S(this,_e,hs).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 My(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(C0(Ly(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=gy(),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(),f=S(this,_e,_c).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:f}}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),f={...S(this,_e,hs).call(this),...n.props,children:p},v;for(;v===void 0;)try{v=await n.type(f,S(this,_e,hs).call(this))}catch(m){if(m instanceof Promise)v=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof v=="object")return this.processBlock(v,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===Dc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===Dc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===Dc.RENDER_EFFECT_EVENT:!1}get formSubmittedEvent(){return this.event?this.event.formSubmitted:!1}get blockRenderEventId(){return this.event?this.event.id:!1}get realtimeEvent(){if(!this.event)return!1;let e=this.event.realtimeEvent;return e?.event?.channel?e:!1}runHook(e){this.pendingHooks.push(e)}rerenderIn(e){s(this,vs)||(d(this,vs,!0),this.effects.push({type:Fy.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:Fy.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:this.realtimeChannels}}]:[]}getEffects(){return[...Si(this.ui),...this.effects,...this.realtimeEffect]}buildNextState(){for(let e of Object.keys(this.renderState))this.renderState[e]=Object.values(this.renderState[e]);this.state={__postData:this.state.__postData,__renderState:this.renderState,__cache:this.state.__cache,...this.realtimeChannels.length>0?{__realtimeChannels:this.realtimeChannels}:{}}}};_e=new WeakSet,Uy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},hs=function(){let e={...le(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[D.Timezone]?.values[0],locale:this.metadata[D.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},_c=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,_e,_c).call(this,i.children)):t.push(i);return t},vs=new WeakMap;async function x0(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 w0.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function By(r){r.provides(I0),U("RenderPost",x0)}import{GetFieldsResponse as A0,InstallationSettingsDefinition as T0}from"@devvit/protos";async function E0(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return A0.fromJSON({fields:{fields:mt(u.installationSettings)}})}async function R0(r,e){return vd(r,u.installationSettings,e)}function Dy(r){r.provides(T0),U("GetSettingsFields",E0),U("ValidateForm",R0)}import{ContextActionDefinition as O0,ContextActionList as F0,ContextActionResponse as M0}from"@devvit/protos";var _y=r=>`menuItem.${r}`;function Nc(r){return u.menuItems.find((e,t)=>_y(t)===r)}async function L0(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:_y(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),member:n.forUserType?.includes("member"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}));return F0.fromJSON({actions:i})}async function U0(r,e){let t=Nc(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;g(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(Be({ui:!0,metadata:e}),le(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),M0.fromJSON({effects:Si(p.ui)})}function Ny(r){r.provides(O0),U("GetActions",L0),U("OnAction",U0)}function ft(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as B0}from"@devvit/protos";async function D0(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(Be({metadata:e}),le(e));await i(n,o)}function qy(r){r.provides(B0),U("HandleScheduledAction",D0)}import{HandlerResult as _0,OnAppInstallDefinition as N0,OnAppUpgradeDefinition as q0,OnCommentCreateDefinition as H0,OnCommentDeleteDefinition as j0,OnCommentReportDefinition as W0,OnCommentSubmitDefinition as G0,OnCommentUpdateDefinition as V0,OnModActionDefinition as z0,OnModMailDefinition as J0,OnPostCreateDefinition as $0,OnPostDeleteDefinition as K0,OnPostFlairUpdateDefinition as X0,OnPostReportDefinition as Z0,OnPostSubmitDefinition as Y0,OnPostUpdateDefinition as Q0,OnPostNsfwUpdateDefinition as eE,OnPostSpoilerUpdateDefinition as tE}from"@devvit/protos";var xi;(function(r){function e(o,a){return o.length<=a?o:`${o.slice(0,a-1)}\u2026`}r.ellipsize=e;function t(o){return o[0]==null?o:`${o[0].toLocaleUpperCase()}${o.slice(1)}`}r.capitalize=t;function i(o){return o==null||/^\s*$/.test(o)}r.isBlank=i;function n(o){return o instanceof Error?`${o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(xi||(xi={}));function ee(r,e){return g(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(Be({metadata:i}),le(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=rE(a);if(c)throw c.err;return _0.fromPartial({})}}function Hy(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(Y0),U("OnPostSubmit",ee("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides($0),U("OnPostCreate",ee("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(Q0),U("OnPostUpdate",ee("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(Z0),U("OnPostReport",ee("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(K0),U("OnPostDelete",ee("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(X0),U("OnPostFlairUpdate",ee("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(G0),U("OnCommentSubmit",ee("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(H0),U("OnCommentCreate",ee("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(V0),U("OnCommentUpdate",ee("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(W0),U("OnCommentReport",ee("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(j0),U("OnCommentDelete",ee("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(N0),U("OnAppInstall",ee("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(q0),U("OnAppUpgrade",ee("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(z0),U("OnModAction",ee("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(J0),U("OnModMail",ee("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(eE),U("OnPostNsfwUpdate",ee("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(tE),U("OnPostSpoilerUpdate",ee("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function rE(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=>xi.caughtToString(t)).join(`
3
+ `))}}var Lb=Nn(Qy(),1),Ub=Nn(Qc(),1);import{EffectType as tO,HandleUIEventResponse as em,UIEventHandlerDefinition as rO}from"@devvit/protos";async function iO(r,e){let t=r.state??{},i=(0,Lb.default)(t),n=Be({ui:!0,metadata:e});if(r.event?.formSubmitted&&r.event.formSubmitted.formId){let p=r.event.formSubmitted.formId;if(p.includes("form.hook.")&&u.customPostType){let y=new pt((C,I)=>u.customPostType?.render(I)??null,r.event,r.state,e,void 0);return await y.reconcile(),em.fromJSON({state:y.state,effects:y.getEffects()})}let f=u.formDefinitions.get(p);if(!f)throw new Error(`Form with key ${p} not found`);let v,m;if(i.__contextAction){let{actionId:y,thingId:C}=i.__contextAction,I=Nc(y);I?.location==="post"?v=C:I?.location==="comment"&&(m=C)}let b=Object.assign(n,le(e,v,m),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});await f.onSubmit({values:Et(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new pt((f,v)=>u.customPostType?.render(v)??null,r.event,r.state,e,void 0);return await p.reconcile(),em.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,Ub.default)(t,i),a=Si(n.ui),c=o?[...a,{type:tO.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return em.fromJSON({state:i,effects:c})}function Bb(r){r.provides(rO),U("HandleUIEvent",iO)}import{CustomPostDefinition as ok,UIResponse as gO}from"@devvit/protos";import{EffectType as im,Form as sO,ToastAppearance as Nb}from"@devvit/protos";function Db(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var tm=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Et(n.formSubmitted.results))}}};function rm(r,e){let t=Ke({namespace:"useForm"},i=>new tm(i,r,e));return nO({id:t.hookId})}function nO(r){return`form.hook.${r.id}.0`}function _b(r,e){let t=Db(e);return r.getHook({id:t})}var Dt,Bd=class{constructor(e){l(this,Dt);d(this,Dt,e)}showForm(e,t){let i=_b(s(this,Dt),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=sO.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});mr(n.fields),o.fields=mt(n.fields),s(this,Dt).emitEffect(e,{type:im.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Nb.SUCCESS:Nb.NEUTRAL}:t={text:e},s(this,Dt).emitEffect(e.toString(),{type:im.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,Dt).emitEffect(t,{type:im.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Dt=new WeakMap;import{EffectType as oO,RealtimeSubscriptionStatus as qb}from"@devvit/protos";var _t,it,Nt,Pr,Cs,sm,Dd=class Dd{constructor(e,t){l(this,Cs);l(this,_t);l(this,it);l(this,Nt);l(this,Pr);d(this,_t,t.context),d(this,it,!!t.context._devvitContext?.debug.realtime),d(this,Pr,e),d(this,Nt,t.invalidate);let i=t.context.meta[D.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[D.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,_t).hooks).filter(c=>c instanceof Dd).some(c=>c.state.channel===o))throw Error(`useChannel channel names must be unique; "${o}" duplicated`);this.state={channel:o,connected:!1,subscribed:!1}}async onUIEvent(e){let t=e.realtimeEvent;if(!(!t||!this.state.subscribed))switch(t.status){case qb.REALTIME_SUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Nt).call(this),await s(this,Pr).onSubscribed?.();break;case qb.REALTIME_UNSUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Nt).call(this),await s(this,Pr).onUnsubscribed?.();break;default:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,Pr).onMessage(t.event?.data??{});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,Nt).call(this),S(this,Cs,sm).call(this))}unsubscribe(){this.state.subscribed&&(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Nt).call(this),S(this,Cs,sm).call(this))}};_t=new WeakMap,it=new WeakMap,Nt=new WeakMap,Pr=new WeakMap,Cs=new WeakSet,sm=function(){let e=Object.values(s(this,_t).hooks).filter(t=>t instanceof Dd&&t.state.subscribed).map(t=>t.state.channel);s(this,_t).emitEffect(this.state.channel,{type:oO.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var nm=Dd;function om(r){if(!r.name||/[^a-zA-Z0-9_]/.test(r.name))throw Error(`useChannel error: The name "${r.name}" you provided for the hook is invalid. Valid names can only contain letters, numbers, and underscores (_).`);let e=`useChannel:${r.name}`;return Ke({id:e,namespace:e},t=>new nm(r,t))}import{EffectType as am}from"@devvit/protos";function Hb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var Cr,Ri=class Ri{constructor(e,t){l(this,Cr);this._segments=[];this._hooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,d(this,Cr,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,Cr).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(this._hooks).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 this._hooks}get _state(){return s(this,Cr)}set _state(e){this._changed={},this._hooks={},d(this,Cr,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ri.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return this._hooks[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ri._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ri._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()}}};Cr=new WeakMap,Ri._staticUndeliveredHandlers={};var Oi=Ri;var qt={};Oi.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete qt[r.hook],e.emitEffect("timers",{type:am.EFFECT_SET_INTERVALS,interval:{intervals:qt}}))});var Ht,Fi,Is,Mi,dm=class{constructor(e,t,i){l(this,Ht);l(this,Fi);l(this,Is);l(this,Mi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Fi,i.invalidate),d(this,Ht,i.hookId),d(this,Is,e),d(this,Mi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?qt[s(this,Ht)]={duration:this.state.duration}:delete qt[s(this,Ht)]}async onUIEvent(e){await s(this,Is).call(this)}start(){qt[s(this,Ht)]={duration:this.state.duration},this.state.running=!0,s(this,Fi).call(this),s(this,Mi).emitEffect("timers",{type:am.EFFECT_SET_INTERVALS,interval:{intervals:qt}})}stop(){delete qt[s(this,Ht)],this.state.running=!1,s(this,Fi).call(this),s(this,Mi).emitEffect("timers",{type:am.EFFECT_SET_INTERVALS,interval:{intervals:qt}})}};Ht=new WeakMap,Fi=new WeakMap,Is=new WeakMap,Mi=new WeakMap;function lm(r,e){let t=Ke({namespace:"useInterval"},i=>new dm(r,e,i));return{start:()=>t.start(),stop:()=>t.stop()}}var Ir=class extends Error{};var um="ServerCallRequired";function jb(r){return r?.message===um}var Wb=Nn(Qc(),1);function mm(r){if(r instanceof Error){if(r.message===um)throw r;return{message:r.message,details:r.stack??""}}else return{message:"Unknown error",details:xi.caughtToString(r)}}var nt,vt,ws,Li,xs,wr,cm=class{constructor(e,t,i){l(this,nt);l(this,vt);l(this,ws);l(this,Li);l(this,xs);l(this,wr);d(this,nt,!!i.context.devvitContext.debug.useAsync),s(this,nt)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,vt,i.hookId),d(this,ws,e),d(this,Li,i.invalidate),d(this,xs,i.context),d(this,wr,t.depends??null)}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,nt)&&console.debug("[useAsync] async onLoad ",s(this,vt),this.state),s(this,nt)&&console.debug("[useAsync] async onLoad have ",s(this,wr),"and",this.state.depends),!(0,Wb.default)(s(this,wr),this.state.depends)||this.state.load_state==="initial")){this.state.load_state="loading",this.state.depends=s(this,wr),s(this,Li).call(this);let e={hook:s(this,vt),async:!0,asyncRequest:{requestId:s(this,vt)+"-"+JSON.stringify(this.state.depends)}};s(this,nt)&&console.debug("[useAsync] onLoad requeue"),s(this,xs).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await s(this,ws).call(this)}}catch(o){i.error=mm(o)}let n={asyncResponse:i,hook:s(this,vt)};s(this,nt)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,vt)+"-"+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,Li).call(this)):s(this,nt)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};nt=new WeakMap,vt=new WeakMap,ws=new WeakMap,Li=new WeakMap,xs=new WeakMap,wr=new WeakMap;function aO(r,e={}){let t=Ke({namespace:"useAsync"},i=>new cm(r,e,i));return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var yt,As,xr,Ui,Ar,pm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,yt);l(this,As);l(this,xr);l(this,Ui);l(this,Ar);d(this,xr,e),d(this,Ui,t.hookId),d(this,yt,t.invalidate),d(this,As,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&s(this,Ar)){try{this.state.value=await s(this,Ar),this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=mm(e)}s(this,yt).call(this)}else console.warn("Invalid state: ",this.state.load_state,s(this,Ar))}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,yt).call(this)}onStateLoaded(){if(this.state.load_state==="loading")throw new Ir;if(this.state.load_state==="error")throw new Error(this.state.error?.message??"Unknown error");if(this.state.load_state==="initial"){let e;try{e=s(this,xr)instanceof Function?s(this,xr).call(this):s(this,xr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,yt).call(this);return}if(e instanceof Promise){d(this,Ar,e),this.state.load_state="loading";let t={asyncRequest:{requestId:s(this,Ui)},hook:s(this,Ui)};throw s(this,As).addToRequeueEvents(t),s(this,yt).call(this),new Ir}else this.state.value=e,this.state.load_state="loaded";s(this,yt).call(this)}}};yt=new WeakMap,As=new WeakMap,xr=new WeakMap,Ui=new WeakMap,Ar=new WeakMap;function fm(r){let e=Ke({namespace:"useState"},t=>new pm(r,t));return[e.state.value,e.setter.bind(e)]}var ym={now(){return new Date}};function Gb(r){return`__autocache__${r}`}function Vb(r){return`__lock__${r}`}var dO=300,lO=1e3,_d=5e3,gm=3,zb=.1,Jb=1e3,uO=3e4;function $b(r){if(r.error)throw new Error(r.error);return r.value}var jt,Wt,Ne,Bi,K,Kb,Xb,Zb,hm,Yb,Qb,vm,ek,Nd=class{constructor(e,t,i=ym){l(this,K);l(this,jt);l(this,Wt,{});l(this,Ne);l(this,Bi);d(this,jt,e),d(this,Bi,t),d(this,Ne,i)}async cache(e,t){var a;(a=s(this,Bi)).__cache??(a.__cache={}),d(this,Wt,s(this,Bi).__cache),S(this,K,ek).call(this,t);let i=S(this,K,Kb).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,vm).call(this,t.key),o=await S(this,K,Xb).call(this,t,n,e);return $b(o)}};jt=new WeakMap,Wt=new WeakMap,Ne=new WeakMap,Bi=new WeakMap,K=new WeakSet,Kb=function(e){let t=s(this,Wt)[e];if(t){let i=s(this,Ne).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<gm&&Math.random()<zb&&t.errorTime+Jb<i;if(t?.expires&&t.expires<i&&t.checkedAt+Jb<i||n){delete s(this,Wt)[e];return}else return $b(t)}},Xb=async function(e,t,i){let n=t?.expires,o=n?S(this,K,Qb).call(this,n):1;return!t||t?.error&&t.errorCount<gm&&zb>Math.random()||o>Math.random()?S(this,K,Zb).call(this,e,t,i):t},Zb=async function(e,t,i){let n=Vb(e.key),o=s(this,Ne).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,jt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Yb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Ne).now();return S(this,K,hm).call(this,p,e.key,e.ttl)}},hm=async function(e,t,i){let n=Math.min(i,lO),o=await S(this,K,vm).call(this,t);if(o)return o;if(s(this,Ne).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,dO)),S(this,K,hm).call(this,e,t,i)},Yb=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,Wt)[e]=t,await s(this,jt).set(Gb(e),JSON.stringify(t),{expiration:new Date(o+uO)}),t.error&&t.errorCount<gm&&await s(this,jt).del(Vb(e)),t},Qb=function(e){let t=s(this,Ne).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},vm=async function(e){let t=await s(this,jt).get(Gb(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Ne).now().getTime(),s(this,Wt)[e]=i,i}},ek=function(e){e.ttl<_d&&(console.warn(`Cache TTL cannot be less than ${_d} milliseconds! Updating ttl value of ${e.ttl} to ${_d}.`),e.ttl=_d)};function tk(r,e,t=ym){let i=new Nd(r,e,t);return i.cache.bind(i)}var qd=class{buildContext(e,t,i){let n=new mi(i),o=new ui(i),a=new vi(i),c=new gi(i),p=new yi(i),f=new bi(i),v=new Bd(e),m=new ci(i),b=new di,y=new pi(i),C=tk(a,e._state),I={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:f,media:m,assets:b,realtime:y,ui:v,useState:fm,useChannel:om,useInterval:lm,useForm:rm,cache:C,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[D.Timezone]?.values[0],locale:i[D.Language]?.values[0],dimensions:t.env?.dimensions}},A=le(i,t.props?.postId);return A.debug.effects=e,{...A,...I}}};var be=null;function rk(r){return JSON.parse(JSON.stringify(r))}function cO(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 mO(r){return r.blocking||r.resize?!1:!r.hook}function Ke(r,e){if(!be)throw new Error("Hooks can only be declared at the top of a component. You cannot declare hooks outside of components or inside of event handlers. It's almost always a mistake to declare hooks inside of loops or conditionals.");cO(r.namespace);let t=be.nextHookId(r),i=be;i._touched[t]=!0;let n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:be},o=be._state[t]===void 0||Hb(be._state[t]);be._hooks[t]=be._hooks[t]??e(n);let a=be._hooks[t];return o||(a.state=be._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var pO=null,Di,Gd,Ts,T,ke,Hd,ik,bm,nk,km,Sm,jd,Pm,sk,Wd=class{constructor(e){l(this,T);l(this,Di);l(this,Gd,new qd);l(this,Ts,new wi(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,T,ke)&&console.debug("[blocks] BlocksHandler v1"),d(this,Di,e),pO=this}async handle(e,t){let i=new Oi(e,t),n=s(this,Gd).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(y=>!y.async),f=a.some(y=>y.blocking),v,m,b=[...a];for(a.length===0&&a.push({}),s(this,T,ke)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,T,ke)&&console.debug("[blocks] processing events loop iteration",a.length);let y=[];if(!a[0].async)y.push(a.shift());else for(;a[0]?.async;)y.push(a.shift());if(!y.length)throw Error("batch must have at least one event");try{if(y[0].async){let I=rk(i._state);await S(this,T,ik).call(this,i,...y),i._state=I}else await S(this,T,nk).call(this,i,...y)}catch(I){if(!jb(I))throw I;if(s(this,T,ke)&&console.debug("[blocks] caught in handler",I),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=v,i._effects=m._effects;let A=b.map(M=>{let ce={...M};return ce.retry=!0,ce});i.addToRequeueEvents(...A);break}else throw console.error("[blocks] unhandled error in handler",I),I}s(this,T,ke)&&console.debug("[blocks] remaining events",i._requeueEvents);let C=[];for(let I of i._requeueEvents){if(!p&&!I.async){s(this,T,ke)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",I),C.push(I);continue}if(p&&I.async&&!f){s(this,T,ke)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",I),C.push(I);continue}s(this,T,ke)&&console.debug("[blocks] reprocessing event in BlocksHandler",I),a.push(I)}i._requeueEvents=C,a.length>0&&(v={...i._changed},m={_state:rk(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,T,km).call(this,s(this,Di),i.request.props??{},i));let y=i._latestRenderContent;y&&(o=s(this,Ts).createBlocksElementOrThrow(y),o=s(this,Ts).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Di=new WeakMap,Gd=new WeakMap,Ts=new WeakMap,T=new WeakSet,ke=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Hd=function(e,...t){e._touched={},S(this,T,km).call(this,s(this,Di),e.request.props??{},e);for(let i in e._hooks)e._touched[i]||delete e._hooks[i]},ik=async function(e,...t){S(this,T,Hd).call(this,e,...t),await Promise.all(t.map(async i=>{if(!i.async)throw new Error("You can't mix main and other queues in one batch. This is likely a platform bug. Please file an issue in the Discord for someone to help! https://discord.com/channels/1050224141732687912/1115441897079574620");await S(this,T,bm).call(this,e,i)}))},bm=async function(e,t){mO(t)&&console.warn("Received an event in #attemptHook that does not have an associated hook. This will cause the event to be undelivered and may cause bugs. Make sure that event passes a hook field. Event:",{event:t});let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},nk=async function(e,...t){for(let i of t)s(this,T,ke)&&console.log("[blocks] handling main queue event",i),s(this,T,ke)&&console.log("[blocks] before",e._state),S(this,T,Hd).call(this,e,i),await S(this,T,bm).call(this,e,i),s(this,T,ke)&&console.log("[blocks] after",e._state);S(this,T,Hd).call(this,e)},km=function(e,t,i){s(this,T,ke)&&console.debug("[blocks] renderRoot"),i._generated={},be=i,this._latestRenderContext=i;try{let n=S(this,T,Sm).call(this,e,t,i);if(n.length!==1)throw new Error(`There can only be one root element, received: ${n.length}. Please wrap these elements in a <vstack></vstack> or <hstack></hstack> to continue. Fragments cannot be used as a root element.`);let o=n[0];if(o==="[object Promise]")throw new Error('Root elements cannot be asynchronous. To use data from an async endpoint, please use "const [data] = context.useState(async () => {/** your async code */})".');if(typeof o=="string")throw new Error("The root element must return a valid block, not a string. Try wrapping the element in a <text>your content</text> tag to continue.");return i._latestRenderContent=o,o}catch(n){if(n instanceof Ir)return;throw n}finally{be=null}},Sm=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);return S(this,T,Pm).call(this,n,i)}finally{i.pop()}},jd=function(e,t){return e=e.flat(1/0),e.flatMap((i,n)=>(i&&typeof i=="object"&&"props"in i&&(i.props?.key||(i.props=i.props??{},i.props.key=`${n}`)),S(this,T,Pm).call(this,i,t)))},Pm=function(e,t){if(Array.isArray(e))return S(this,T,jd).call(this,e,t);if(fO(e))if(e.type===void 0){t.push({namespace:"fragment",...e.props});let i=S(this,T,jd).call(this,e.children,t);return t.pop(),i}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,T,Sm).call(this,e.type,i,t)}else{t.push({namespace:e.type,...e.props});let i=S(this,T,jd).call(this,e.children,t),n=S(this,T,sk).call(this,e.props??{});return t.pop(),[{type:e.type,children:i,props:n}]}else return[(e??"").toString()]},sk=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Ke({namespace:i,key:!1},({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 fO(r){return typeof r=="object"&&r!=null&&"type"in r}var hO=[[ok,ok.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null]];function vO(r){return async(e,t)=>{let i=new Wd(r);return gO.fromJSON(i.handle(e,t))}}function ak(r){for(let[e,t,i]of hO)r.provides(e),U(t.name,vO(i))}var _i,Es,Ni,Tr,Er,qi,Hi,Rr,Gt,Rs,Os,Or,N,B=class B extends cd{static configure(e){d(this,Ni,{...s(this,Ni),...e}),ft(e.http)&&this.use(P.HTTPDefinition),(ft(e.kvStore)||ft(e.redis))&&(this.use(P.KVStoreDefinition),this.use(P.RedisAPIDefinition)),ft(e.media)&&this.use(P.MediaServiceDefinition),ft(e.modLog)&&this.use(P.ModlogDefinition),ft(e.redditAPI)&&(this.use(P.FlairDefinition),this.use(P.GraphQLDefinition),this.use(P.LinksAndCommentsDefinition),this.use(P.ListingsDefinition),this.use(P.ModerationDefinition),this.use(P.ModNoteDefinition),this.use(P.NewModmailDefinition),this.use(P.PrivateMessagesDefinition),this.use(P.SubredditsDefinition),this.use(P.PostCollectionsDefinition),this.use(P.UsersDefinition),this.use(P.WidgetsDefinition),this.use(P.WikiDefinition),this.use(P.RedditAPIV2Definition)),ft(e.realtime)&&this.use(P.RealtimeDefinition)}static addMenuItem(e){s(this,Hi).push(e)}static addCustomPostType(e){d(this,Tr,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,N)[P.SchedulerDefinition.fullName]||this.use(P.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){mr(e);let t=e.filter(n=>n.type==="group"||!n.scope||n.scope==="installation"),i=e.filter(n=>n.type!=="group"&&n.scope==="app");t.length>0&&d(this,qi,t),i.length>0&&d(this,_i,i),s(this,N)[P.SettingsDefinition.fullName]||this.use(P.SettingsDefinition)}static addTrigger(e){if("events"in e){for(let t of e.events)this.addTrigger({event:t,onEvent:(i,n)=>e.onEvent(i,n)});return this}return s(this,Gt).has(e.event)?s(this,Gt).get(e.event)?.push(e.onEvent):s(this,Gt).set(e.event,[e.onEvent]),B}static provide(e){s(this,Os).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,N)[e.fullName]=i,i}static get redditAPIPlugins(){if(!ft(s(this,Ni).redditAPI))throw new Error("Reddit API is not enabled. You can enable it by passing `redditAPI: true` to `Devvit.configure`.");return{Flair:s(this,N)[P.FlairDefinition.fullName],GraphQL:s(this,N)[P.GraphQLDefinition.fullName],LinksAndComments:s(this,N)[P.LinksAndCommentsDefinition.fullName],Listings:s(this,N)[P.ListingsDefinition.fullName],Moderation:s(this,N)[P.ModerationDefinition.fullName],ModNote:s(this,N)[P.ModNoteDefinition.fullName],NewModmail:s(this,N)[P.NewModmailDefinition.fullName],PrivateMessages:s(this,N)[P.PrivateMessagesDefinition.fullName],Subreddits:s(this,N)[P.SubredditsDefinition.fullName],PostCollections:s(this,N)[P.PostCollectionsDefinition.fullName],Users:s(this,N)[P.UsersDefinition.fullName],Widgets:s(this,N)[P.WidgetsDefinition.fullName],Wiki:s(this,N)[P.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,N)[P.ModlogDefinition.fullName];if(!e)throw new Error("ModLog is not enabled. You can enable it by passing `modLog: true` to `Devvit.configure`");return e}static get schedulerPlugin(){let e=s(this,N)[P.SchedulerDefinition.fullName];if(!e)throw new Error("Scheduler is not enabled. You can enable it by calling `Devvit.addSchedulerJob` at the top level of your app.");return e}static get kvStorePlugin(){let e=s(this,N)[P.KVStoreDefinition.fullName];if(!e)throw new Error("Key Value Store is not enabled. You can enable it by passing `kvStore: true` to `Devvit.configure`");return e}static get redisPlugin(){let e=s(this,N)[P.RedisAPIDefinition.fullName];if(!e)throw new Error("Redis is not enabled. You can enable it by passing `redis: true` to `Devvit.configure`");return e}static get mediaPlugin(){let e=s(this,N)[P.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get redditapiv2Plugin(){let e=s(this,N)[P.RedditAPIV2Definition.fullName];if(!e)throw new Error("RedditAPIV2 is not enabled. You can enable it by passing `apiV2: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,N)[P.SettingsDefinition.fullName];if(!e)throw new Error("Settings must first be configured with `Devvit.addSettings()` before they can be accessed");return e}static get realtimePlugin(){let e=s(this,N)[P.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,Hi)}static get customPostType(){return s(this,Tr)}static get formDefinitions(){return s(this,Er)}static get scheduledJobHandlers(){return s(this,Rr)}static get installationSettings(){return s(this,qi)}static get appSettings(){return s(this,_i)}static get triggerOnEventHandlers(){return s(this,Gt)}static get assets(){return s(this,Es)}static get webviewAssets(){return s(this,Rs)}constructor(e){super(e),d(B,Es,e.assets??{}),d(B,Rs,e.webviewAssets??{});for(let t in s(B,Or)){let i=s(B,Or)[t];i.handler=e.use(i.def,i.options)}s(B,Hi).length>0&&Ny(e),s(B,Rr).size>0&&qy(e),s(B,Tr)&&(By(e),ak(e)),(s(B,Tr)||s(B,Er).size>0)&&Bb(e),s(B,qi)&&Dy(e),s(B,_i)&&fy(e),s(B,Gt).size>0&&Hy(e);for(let t of s(B,Os))e.provides(t)}};_i=new WeakMap,Es=new WeakMap,Ni=new WeakMap,Tr=new WeakMap,Er=new WeakMap,qi=new WeakMap,Hi=new WeakMap,Rr=new WeakMap,Gt=new WeakMap,Rs=new WeakMap,Os=new WeakMap,Or=new WeakMap,N=new WeakMap,B.debug={},l(B,_i),l(B,Es,{}),l(B,Ni,{}),l(B,Tr),l(B,Er,new Map),l(B,qi),l(B,Hi,[]),l(B,Rr,new Map),l(B,Gt,new Map),l(B,Rs,{}),l(B,Os,[]),l(B,Or,{}),l(B,N,{});var u=B;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function X(r){let e=Object.getOwnPropertyDescriptors(r.constructor.prototype);for(let[t,i]of Object.entries(e))i.get&&Object.defineProperty(r,t,{...i,enumerable:!0})}var Cm;(function(r){r[r.bold=1]="bold",r[r.italic=2]="italic",r[r.underline=4]="underline",r[r.strikethrough=8]="strikethrough",r[r.subscript=16]="subscript",r[r.superscript=32]="superscript",r[r.monospace=64]="monospace"})(Cm||(Cm={}));var dk="text",lk="raw",uk="br",ck="link",mk="c/",pk="p/",fk="r/",gk="u/",hk="@",vk="spoilertext",yk="par",bk="h",kk="hr",Sk="blockquote",Pk="code",Ck="li",Ik="list",wk="L",xk="R",Ak="C",Tk="table",Ek="embed",Rk="img",Ok="gif",Fk="video";function Mk(r){return{e:Ok,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Lk(r,e){let t={},i=[];return Object.assign(t,Fs(t,i),Ms(t,i),Ls(t,i),Ds(t,i),_s(t,i),Ns(t,i)),e(t),{e:Sk,c:i,...r.author&&{a:r.author}}}function Uk(r,e){let t={},i=[];return Object.assign(t,wm(t,i)),e(t),{e:Pk,c:i,...r.language&&{l:r.language}}}function Bk(r){return{e:mk,t:r.permalink}}function Dk(r,e){let t={},i=[];return Object.assign(t,wm(t,i),Bs(t,i)),e(t),{e:bk,l:r.level,c:i}}function _k(r){return{e:Ek,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Nk(){return{e:kk}}function qk(r){return{e:Rk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Hk(){return{e:uk}}function jk(r){return{e:ck,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function Wk(r,e){let t={},i=[];return Object.assign(t,sS(t,i)),e(t),{e:Ik,o:r.ordered,c:i}}function Gk(r){let e={},t=[];return Object.assign(e,Fs(e,t),Ms(e,t),Ls(e,t),Vd(e,t),Ds(e,t),_s(e,t),Ns(e,t)),r(e),{e:Ck,c:t}}function Vk(r){let e={},t=[];return Object.assign(e,zd(e,t),Bs(e,t),Im(e,t),xm(e,t),Us(e,t)),r(e),{e:yk,c:t}}function zk(r){return{e:pk,t:r.permalink}}function Jk(r){return{e:lk,t:r}}function $k(r){let e={},t=[];return Object.assign(e,zd(e,t),Bs(e,t),Im(e,t)),r(e),{e:vk,c:t}}function Kk(r){return{e:fk,t:r.subredditName,l:r.showPrefix}}function Xk(r){let e={},t=[],i=[];return Object.assign(e,oS(e,t,i)),r(e),{e:Tk,h:t,c:i}}function Zk(r){let[e,t]=nS();return r(e),{c:t}}function Yk(r,e){let[t,i]=nS();e(t);let n;switch(r.columnAlignment){case"left":n=wk;break;case"right":n=xk;break;case"center":n=Ak;break}return{...n&&{a:n},...i&&{c:i}}}function Qk(r){let e={},t=[];return Object.assign(e,aS(e,t)),r(e),t}function eS(r){return{e:dk,t:r.text,...r.formatting&&{f:r.formatting}}}function tS(r){return{e:gk,t:r.username,l:r.showPrefix}}function rS(r){return{e:hk,t:r.username,l:r.showPrefix}}function iS(r){return{e:Fk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function nS(){let r={},e=[];return Object.assign(r,zd(r,e),Bs(r,e),xm(r,e),Us(r,e)),[r,e]}function Fs(r,e){return{blockQuote(t,i){return e.push(Lk(t,i)),r}}}function Ms(r,e){return{codeBlock(t,i){return e.push(Uk(t,i)),r}}}function dS(r,e){return{embed(t){return e.push(_k(t)),r}}}function Ls(r,e){return{heading(t,i){return e.push(Dk(t,i)),r}}}function Vd(r,e){return{horizontalRule(){return e.push(Nk()),r}}}function Us(r,e){return{image(t){return e.push(qk(t)),r},animatedImage(t){return e.push(Mk(t)),r}}}function Im(r,e){return{linebreak(){return e.push(Hk()),r}}}function Bs(r,e){return{link(t){return e.push(jk(t)),r},commentLink(t){return e.push(Bk(t)),r},postLink(t){return e.push(zk(t)),r},subredditLink(t){return e.push(Kk(t)),r},userLink(t){return e.push(tS(t)),r},userMention(t){return e.push(rS(t)),r}}}function Ds(r,e){return{list(t,i){return e.push(Wk(t,i)),r}}}function sS(r,e){return{item(t){return e.push(Gk(t)),r}}}function _s(r,e){return{paragraph(t){return e.push(Vk(t)),r}}}function wm(r,e){return{rawText(t){return e.push(Jk(t)),r}}}function xm(r,e){return{spoiler(t){return e.push($k(t)),r}}}function oS(r,e,t){return{headerCell(i,n){return e.push(Yk(i,n)),r},row(i){return t.push(Qk(i)),r}}}function Ns(r,e){return{table(t){return e.push(Xk(t)),r}}}function aS(r,e){return{cell(t){return e.push(Zk(t)),r}}}function zd(r,e){return{text(t){return e.push(eS(t)),r}}}function lS(r,e){return{video(t){return e.push(iS(t)),r}}}var yO=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},bO=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)},Jd,qs=class{constructor(){Jd.set(this,void 0);let e=[];Object.assign(this,_s(this,e),Ls(this,e),Vd(this,e),Fs(this,e),Ms(this,e),dS(this,e),Ds(this,e),Ns(this,e),Us(this,e),lS(this,e)),yO(this,Jd,{document:e},"f")}build(){return JSON.stringify(bO(this,Jd,"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}};Jd=new WeakMap;function ji(r){let e;return r instanceof qs?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var uS=100,cS=1/0,Fr,Mr,Vt,Wi,Gi,$d,W=class{constructor(e){l(this,Gi);l(this,Fr);l(this,Mr);l(this,Vt);l(this,Wi,!1);this.pageSize=uS;this.limit=cS;this.children=[];X(this),this._fetch=e.fetch,this.pageSize=e.pageSize??uS,this.limit=e.limit??cS,d(this,Mr,e.after),d(this,Fr,e.before),d(this,Vt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,Wi)||!!(s(this,Mr)||s(this,Fr)||s(this,Vt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Gi,$d).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,Wi,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Gi,$d).call(this);return this.children.slice(0,this.limit)}async get(e){let t=e<=this.limit?e:this.limit;for(;this.hasMore&&this.children.length<t;)await S(this,Gi,$d).call(this);return this.children.slice(0,t)}};Fr=new WeakMap,Mr=new WeakMap,Vt=new WeakMap,Wi=new WeakMap,Gi=new WeakSet,$d=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,Fr),after:s(this,Mr),limit:this.pageSize,more:s(this,Vt)});return this.children.push(...e),d(this,Fr,t),d(this,Mr,i),d(this,Vt,n),d(this,Wi,!0),e};function kO(r){try{return!0}catch{return!1}}function SO(r){try{return!0}catch{return!1}}var Hs,Am,Le=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new W({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>S(this,Hs,Am).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,Hs,Am).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Hs=new WeakSet,Am=function(e){if(g(e.id,"Mod note ID is null or undefined"),g(e.createdAt,"Mod note createdAt is null or undefined"),g(e.type,"Mod note type is null or undefined"),g(e.subreddit,"Mod note subreddit is null or undefined"),g(e.subredditId,"Mod note subredditId is null or undefined"),g(e.operator,"Mod note operator is null or undefined"),g(e.operatorId,"Mod note operatorId is null or undefined"),g(e.user,"Mod note user is null or undefined"),g(e.userId,"Mod note userId is null or undefined"),g(e.userNoteData,"Mod note userNote is null or undefined"),g(e.modActionData,"Mod note modAction is null or undefined"),!kO(e.userNoteData?.label??""))throw new Error(`Invalid user note label: ${e.userNoteData?.label}`);if(!SO(e.type))throw new Error(`Invalid mod note type: ${e.type}`);return{id:e.id,user:{id:ne(e.userId??""),name:e.user},subreddit:{id:Oe(e.subredditId??""),name:e.subreddit},operator:{id:ne(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:he(e.userNoteData?.redditId??""),label:e.userNoteData?.label},type:e.type}},l(Le,Hs);var bt=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 mS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_community","chat_operator"];function PO(r,e,t=!1){let i=t?"%2b":"+";return e.map(n=>(r.includes(n)?i:"-")+n).join(",")}function Tm(r){return PO(r,mS,!0)}function pS(r){return r.filter(e=>mS.includes(e))}var CO=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(CO||{}),Ur,Vi,zi,Ji,$i,Ki,Xi,Zi,Yi,Qi,en,Kd,Xe=class Xe{constructor(e,t,i){l(this,Ur);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Yi);l(this,Qi);X(this),g(e.id),g(e.text),d(this,Ur,e.id),d(this,Vi,t),d(this,zi,e.text),d(this,Ji,IO(e.textColor)),d(this,$i,wO(e.backgroundColor)),d(this,Ki,xO(e.allowableContent)),d(this,Xi,e.modOnly),d(this,Zi,e.maxEmojis),d(this,Yi,e.textEditable),d(this,Qi,i)}get id(){return s(this,Ur)}get text(){return s(this,zi)}get textColor(){return s(this,Ji)}get backgroundColor(){return s(this,$i)}get allowableContent(){return s(this,Ki)}get modOnly(){return s(this,Xi)}get maxEmojis(){return s(this,Zi)}get allowUserEdits(){return s(this,Yi)}async delete(){return Xe.deleteFlairTemplate(s(this,Ur),s(this,Vi),s(this,Qi))}async edit(e){return Xe.editFlairTemplate({id:s(this,Ur),subredditName:s(this,Vi),text:e.text??s(this,zi),allowableContent:e.allowableContent??s(this,Ki),backgroundColor:e.backgroundColor??s(this,$i),maxEmojis:e.maxEmojis??s(this,Zi),modOnly:e.modOnly??s(this,Xi),textColor:e.textColor??s(this,Ji),allowUserEdits:e.allowUserEdits??s(this,Yi)},s(this,Qi))}static async createPostFlairTemplate(e,t){var i;return S(i=Xe,en,Kd).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Xe,en,Kd).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Xe,en,Kd).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Xe(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Xe(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Ur=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,en=new WeakSet,Kd=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:f,textColor:v="dark",allowUserEdits:m=!1,id:b=""}=e;if(p&&m)throw new Error("Cannot have a mod only flair that is editable by users");let C=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:f,textColor:v,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Xe(C,i,t)},l(Xe,en);var de=Xe;function js(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var zt,Em,Rm,Lr=class Lr{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=Lr,zt,Em).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Lr,zt,Em).call(i,{...e,postId:ge(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Lr,zt,Rm).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Lr,zt,Rm).call(n,e,void 0,t,i)}};zt=new WeakSet,Em=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)},Rm=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(Lr,zt);var Ue=Lr;function IO(r){if(g(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function wO(r){if(g(r,"Flair background color is required"),r==="transparent"||/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function xO(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as LO}from"@devvit/protos";var vS=Nn(hS(),1);var tn,Gs,rn,Vs,zs,Js,$s,Ks,nn,Xs,Zs,Ys,Qs,eo,to,Jt,ro,io,Dr,sn,$t,on,an,dn,_r,Kt,Xt,ln,Zt,Yt,Qt,kt,no,so,un,cn,_,H=class H{constructor(e,t){l(this,tn);l(this,Gs);l(this,rn);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,Ks);l(this,nn);l(this,Xs);l(this,Zs);l(this,Ys);l(this,Qs);l(this,eo);l(this,to);l(this,Jt);l(this,ro);l(this,io);l(this,Dr);l(this,sn);l(this,$t);l(this,on);l(this,an);l(this,dn);l(this,_r);l(this,Kt);l(this,Xt);l(this,ln);l(this,Zt);l(this,Yt);l(this,Qt);l(this,kt);l(this,no);l(this,so);l(this,un);l(this,cn);l(this,_);X(this),g(e.id,"Post is missing id"),g(e.title,"Post is missing title"),g(e.createdUtc,"Post is missing created date"),g(e.author,"Post is missing author name"),g(e.subreddit,"Post is missing subreddit name"),g(e.subredditId,"Post is missing subreddit id"),g(e.url,"Post is missing url"),g(e.permalink,"Post is missing permalink"),d(this,tn,ge(`t3_${e.id}`)),d(this,rn,e.author),d(this,Gs,e.authorFullname?ne(e.authorFullname):void 0),d(this,zs,Oe(e.subredditId)),d(this,Js,e.subreddit),d(this,Ys,e.score??0),d(this,Qs,e.numComments??0),d(this,eo,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Vs,i),d(this,Ks,e.title),d(this,nn,e.selftext),d(this,Xs,e.selftextHtml),d(this,Zs,e.url),d(this,$s,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,to,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,Jt,e.approved??!1),d(this,ro,e.approvedAtUtc??0),d(this,io,e.bannedAtUtc??0),d(this,$t,e.removed??!1),d(this,on,e.removedBy),d(this,an,e.removedByCategory),d(this,Dr,e.spam??!1),d(this,sn,e.stickied??!1),d(this,dn,e.archived??!1),d(this,_r,e.edited??!1),d(this,Kt,e.locked??!1),d(this,Xt,e.over18??!1),d(this,ln,e.quarantine??!1),d(this,Zt,e.spoiler),d(this,Yt,e.hidden??!1),d(this,Qt,e.ignoreReports??!1),d(this,kt,e.distinguished),d(this,so,e.secureMedia),d(this,un,(e.modReports??[]).map(([n])=>n)),d(this,cn,(e.userReports??[]).map(([n])=>n)),d(this,_,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,no,{backgroundColor:e.linkFlairBackgroundColor,cssClass:e.linkFlairCssClass,text:e.linkFlairText,type:e.linkFlairType,templateId:e.linkFlairTemplateId,richtext:(e.linkFlairRichtext??[]).map(({e:n,t:o,a,u:c})=>({elementType:n,text:o,emojiRef:a,url:c})),textColor:e.linkFlairTextColor})}get id(){return s(this,tn)}get authorId(){return s(this,Gs)}get authorName(){return s(this,rn)}get subredditId(){return s(this,zs)}get subredditName(){return s(this,Js)}get permalink(){return s(this,$s)}get title(){return s(this,Ks)}get body(){return s(this,nn)}get bodyHtml(){return s(this,Xs)}get url(){return s(this,Zs)}get thumbnail(){return s(this,to)}get createdAt(){return s(this,Vs)}get score(){return s(this,Ys)}get numberOfComments(){return s(this,Qs)}get numberOfReports(){return s(this,eo)}get approved(){return s(this,Jt)}get approvedAtUtc(){return s(this,ro)}get bannedAtUtc(){return s(this,io)}get spam(){return s(this,Dr)}get stickied(){return s(this,sn)}get removed(){return s(this,$t)}get removedBy(){return s(this,on)}get removedByCategory(){return s(this,an)}get archived(){return s(this,dn)}get edited(){return s(this,_r)}get locked(){return s(this,Kt)}get nsfw(){return s(this,Xt)}get quarantined(){return s(this,ln)}get spoiler(){return s(this,Zt)}get hidden(){return s(this,Yt)}get ignoringReports(){return s(this,Qt)}get distinguishedBy(){return s(this,kt)}get comments(){return Q.getComments({postId:this.id},s(this,_))}get flair(){return s(this,no)}get secureMedia(){return s(this,so)}get userReportReasons(){return s(this,cn)}get modReportReasons(){return s(this,un)}toJSON(){return{id:this.id,authorId:this.authorId,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,permalink:this.permalink,title:this.title,body:this.body,bodyHtml:this.bodyHtml,url:this.url,thumbnail:this.thumbnail,score:this.score,numberOfComments:this.numberOfComments,numberOfReports:this.numberOfReports,createdAt:this.createdAt,approved:this.approved,spam:this.spam,stickied:this.stickied,removed:this.removed,removedBy:s(this,on),removedByCategory:s(this,an),archived:this.archived,edited:this.edited,locked:this.locked,nsfw:this.nsfw,quarantined:this.quarantined,spoiler:this.spoiler,hidden:this.hidden,ignoringReports:this.ignoringReports,distinguishedBy:this.distinguishedBy,flair:this.flair,secureMedia:this.secureMedia,modReportReasons:s(this,un),userReportReasons:s(this,cn)}}isApproved(){return s(this,Jt)}isSpam(){return s(this,Dr)}isStickied(){return s(this,sn)}isRemoved(){return s(this,$t)}isArchived(){return s(this,dn)}isEdited(){return s(this,_r)}isLocked(){return s(this,Kt)}isNsfw(){return s(this,Xt)}isQuarantined(){return s(this,ln)}isSpoiler(){return s(this,Zt)}isHidden(){return s(this,Yt)}isIgnoringReports(){return s(this,Qt)}isDistinguishedBy(){return s(this,kt)}async edit(e){let t=await H.edit({id:this.id,...e},s(this,_));d(this,nn,t.body),d(this,_r,t.edited)}async addComment(e){return Q.submit({id:this.id,...e},s(this,_))}async delete(){return H.delete(this.id,s(this,_))}async approve(){await H.approve(this.id,s(this,_)),d(this,Jt,!0),d(this,$t,!1)}async remove(e=!1){await H.remove(this.id,e,s(this,_)),d(this,$t,!0),d(this,Dr,e),d(this,Jt,!1)}async lock(){await H.lock(this.id,s(this,_)),d(this,Kt,!0)}async unlock(){await H.unlock(this.id,s(this,_)),d(this,Kt,!1)}async hide(){await H.hide(this.id,s(this,_)),d(this,Yt,!0)}async unhide(){await H.unhide(this.id,s(this,_)),d(this,Yt,!1)}async markAsNsfw(){await H.markAsNsfw(this.id,s(this,_)),d(this,Xt,!0)}async unmarkAsNsfw(){await H.unmarkAsNsfw(this.id,s(this,_)),d(this,Xt,!1)}async markAsSpoiler(){await H.markAsSpoiler(this.id,s(this,_)),d(this,Zt,!0)}async unmarkAsSpoiler(){await H.unmarkAsSpoiler(this.id,s(this,_)),d(this,Zt,!1)}async sticky(e){await H.sticky(this.id,e,s(this,_))}async unsticky(){await H.unsticky(this.id,s(this,_))}async distinguish(){let{distinguishedBy:e}=await H.distinguish(this.id,!1,s(this,_));d(this,kt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await H.distinguish(this.id,!0,s(this,_));d(this,kt,e)}async undistinguish(){let{distinguishedBy:e}=await H.undistinguish(this.id,s(this,_));d(this,kt,e)}async ignoreReports(){await H.ignoreReports(this.id,s(this,_)),d(this,Qt,!0)}async unignoreReports(){await H.unignoreReports(this.id,s(this,_)),d(this,Qt,!1)}async getAuthor(){return w.getByUsername(s(this,rn),s(this,_))}async crosspost(e){return H.crosspost({...e,postId:this.id},s(this,_))}addRemovalNote(e){return Le.addRemovalNote({itemIds:[s(this,tn)],...e},s(this,_))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=cr(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new H(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){g(t,"Missing metadata in `SubmitPostOptions`");let c=await new pt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=LO.encode(c).finish();n=await i.Submit({kind:"custom",sr:e.subredditName,richtextJson:(0,vS.fromByteArray)(p),...e},t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?ji(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return H.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=u.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,c=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:ge(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return H.getById(`t3_${c.json.data.id}`,t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=ji(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return H.getById(n,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await u.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await u.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:t?"admin":"yes",sticky:!1},i)).json?.data?.things?.[0]?.data;return g(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 g(o),{distinguishedBy:o.distinguished}}static async ignoreReports(e,t){await u.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await u.redditAPIPlugins.Moderation.UnignoreReports({id:e},t)}static getControversialPosts(e={},t){return this.getSortedPosts({...e,sort:"controversial"},t)}static getTopPosts(e={},t){return this.getSortedPosts({...e,sort:"top"},t)}static getSortedPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ws(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ws(o,t)}})}};tn=new WeakMap,Gs=new WeakMap,rn=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,Ks=new WeakMap,nn=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,Qs=new WeakMap,eo=new WeakMap,to=new WeakMap,Jt=new WeakMap,ro=new WeakMap,io=new WeakMap,Dr=new WeakMap,sn=new WeakMap,$t=new WeakMap,on=new WeakMap,an=new WeakMap,dn=new WeakMap,_r=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,ln=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,Qt=new WeakMap,kt=new WeakMap,no=new WeakMap,so=new WeakMap,un=new WeakMap,cn=new WeakMap,_=new WeakMap;var z=H;function Ws(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 UO=(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))(UO||{}),oo,mn,ao,lo,uo,co,mo,er,po,fo,ot,Nr=class Nr{constructor(e,t){l(this,oo);l(this,mn);l(this,ao);l(this,lo);l(this,uo);l(this,co);l(this,mo);l(this,er,new Map);l(this,po);l(this,fo);l(this,ot);X(this),g(e.id,"User ID is missing or undefined"),g(e.name,"Username is missing or undefined"),g(e.createdUtc,"User is missing created date"),d(this,oo,ne(ud(e.id)?e.id:`t2_${e.id}`)),d(this,mn,e.name),d(this,co,e.over18??!1),d(this,mo,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,ao,i),d(this,lo,e.linkKarma??0),d(this,uo,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,er).set(n,pS(o));d(this,po,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,fo,e.subreddit?.url??""),d(this,ot,t)}get id(){return s(this,oo)}get username(){return s(this,mn)}get createdAt(){return s(this,ao)}get linkKarma(){return s(this,lo)}get commentKarma(){return s(this,uo)}get nsfw(){return s(this,co)}get isAdmin(){return s(this,mo)}get modPermissions(){return s(this,er)}get url(){return s(this,po)}get permalink(){return s(this,fo)}toJSON(){return{id:this.id,username:this.username,createdAt:this.createdAt,linkKarma:this.linkKarma,commentKarma:this.commentKarma,nsfw:this.nsfw,modPermissionsBySubreddit:Object.fromEntries(this.modPermissions)}}async getModPermissionsForSubreddit(e){if(s(this,er).has(e))return s(this,er).get(e);let t=await Nr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ot)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,er).set(e,i),i}getComments(e){return Q.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,mn)},s(this,ot));return t.users[0]?js(t.users[0]):void 0}getSnoovatarUrl(){return Nr.getSnoovatarUrl(this.username,s(this,ot))}async getSocialLinks(){let i=await bt.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:Nr.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new Nr(n.data,t)}static async getFromMetadata(e,t){g(t);let i=t?.[e]?.values[0];return i?Nr.getById(ne(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new W({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return DO(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,f=await i.Friend({type:n,subreddit:o,name:a,permissions:c?Tm(c):void 0,...p},t);if(f.json?.errors?.length)throw new Error(f.json.errors.join(`
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:Tm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
5
+ `))}static async getSnoovatarUrl(e,t){return(await bt.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"overview",...n},t);return BO(o,t)}})}};oo=new WeakMap,mn=new WeakMap,ao=new WeakMap,lo=new WeakMap,uo=new WeakMap,co=new WeakMap,mo=new WeakMap,er=new WeakMap,po=new WeakMap,fo=new WeakMap,ot=new WeakMap;var w=Nr;function BO(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new z(i.data,e);if(i.kind==="t1")return new Q(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function DO(r,e,t){let i=u.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(v=>(g(v.data?.id,"User id is still from listing data"),v.data.id)),o=100,a=[];for(let v=0;v<n.length;v+=o)a.push(n.slice(v,v+o));let p=(await Promise.all(a.map(v=>i.UserDataByAccountIds({ids:v.join(",")},t)))).reduce((v,m)=>({...v,...m.users}),{});return{children:r.data.children.map(v=>{let m=v.data?.id;g(m,"User id is missing from listing");let b=p[m];return g(b,"User data is missing from response"),new w({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:v.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var qr,go,pn,fn,ho,vo,gn,yo,bo,hn,tr,ko,So,Hr,rr,ir,St,jr,Pt,Po,Co,Io,wo,xo,Ao,To,te,at,Zd,Yd,G=class G{constructor(e,t){l(this,qr);l(this,go);l(this,pn);l(this,fn);l(this,ho);l(this,vo);l(this,gn);l(this,yo);l(this,bo);l(this,hn);l(this,tr);l(this,ko);l(this,So);l(this,Hr);l(this,rr);l(this,ir);l(this,St);l(this,jr);l(this,Pt);l(this,Po);l(this,Co);l(this,Io);l(this,wo);l(this,xo);l(this,Ao);l(this,To);l(this,te);var n;X(this),g(e.id,"Comment id is null or undefined"),g(e.body,"Comment body is null or undefined"),g(e.createdUtc,"Comment is missing created date"),g(e.author,"Comment author is null or undefined"),g(e.parentId,"Comment parentId is null or undefined"),g(e.linkId,"Comment linkId is null or undefined"),g(e.permalink,"Comment permalink is null or undefined"),g(e.subreddit,"Comment is missing subreddit name"),g(e.subredditId,"Comment is missing subreddit id"),d(this,qr,ii(`t1_${e.id}`)),d(this,go,e.authorFullname?ne(e.authorFullname):void 0),d(this,pn,e.author),d(this,fn,e.body),d(this,yo,Oe(e.subredditId)),d(this,bo,e.subreddit),d(this,vo,pc(e.parentId)?ii(e.parentId):ge(e.parentId)),d(this,gn,ge(e.linkId)),d(this,Hr,e.edited??!1),d(this,rr,e.locked??!1),d(this,ir,e.removed??!1),d(this,St,e.stickied??!1),d(this,tr,e.approved??!1),d(this,ko,e.approvedAtUtc??0),d(this,So,e.bannedAtUtc??0),d(this,jr,e.spam??!1),d(this,Pt,e.distinguished),d(this,Po,e.numReports??0),d(this,Co,e.collapsedBecauseCrowdControl??!1),d(this,Io,e.score??0),d(this,wo,e.permalink),d(this,To,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,xo,(e.modReports??[]).map(([o])=>o)),d(this,Ao,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,ho,i),d(this,hn,S(n=G,at,Zd).call(n,{postId:s(this,gn),commentId:s(this,qr)},t)),d(this,te,t)}get id(){return s(this,qr)}get authorId(){return s(this,go)}get authorName(){return s(this,pn)}get subredditId(){return s(this,yo)}get subredditName(){return s(this,bo)}get body(){return s(this,fn)}get createdAt(){return s(this,ho)}get parentId(){return s(this,vo)}get postId(){return s(this,gn)}get replies(){return s(this,hn)}get distinguishedBy(){return s(this,Pt)}get locked(){return s(this,rr)}get stickied(){return s(this,St)}get removed(){return s(this,ir)}get approved(){return s(this,tr)}get approvedAtUtc(){return s(this,ko)}get bannedAtUtc(){return s(this,So)}get spam(){return s(this,jr)}get edited(){return s(this,Hr)}get numReports(){return s(this,Po)}get collapsedBecauseCrowdControl(){return s(this,Co)}get score(){return s(this,Io)}get permalink(){return s(this,wo)}get userReportReasons(){return s(this,Ao)}get modReportReasons(){return s(this,xo)}get url(){return s(this,To)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url}}isLocked(){return s(this,rr)}isApproved(){return s(this,tr)}isRemoved(){return s(this,ir)}isSpam(){return s(this,jr)}isStickied(){return s(this,St)}isDistinguished(){return!!s(this,Pt)}isEdited(){return s(this,Hr)}async delete(){return G.delete(this.id,s(this,te))}async edit(e){let t=await G.edit({id:this.id,...e},s(this,te));return d(this,fn,t.body),d(this,Hr,t.edited),this}async approve(){await G.approve(this.id,s(this,te)),d(this,tr,!0),d(this,ir,!1)}async remove(e=!1){await G.remove(this.id,e,s(this,te)),d(this,ir,!0),d(this,jr,e),d(this,tr,!1)}async lock(){await G.lock(this.id,s(this,te)),d(this,rr,!0)}async unlock(){await G.unlock(this.id,s(this,te)),d(this,rr,!1)}async reply(e){return G.submit({id:this.id,...e},s(this,te))}async getAuthor(){return w.getByUsername(s(this,pn),s(this,te))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!1,s(this,te));d(this,Pt,t),d(this,St,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await G.distinguish(this.id,e,!0,s(this,te));d(this,Pt,t),d(this,St,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await G.undistinguish(this.id,s(this,te));d(this,Pt,e),d(this,St,t)}addRemovalNote(e){return Le.addRemovalNote({itemIds:[s(this,qr)],...e},s(this,te))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=At(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new G(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=G,at,Zd).call(a,{postId:ge(i),commentId:n?ii(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new G(c,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=ji(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let c=a.json?.data?.things?.[0]?.data;return g(c),new G(c,t)}static async distinguish(e,t,i,n){let c=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return g(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 g(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new W({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"comments",...n},t);return g(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new G(c.data,t))||[],before:o.data.before,after:o.data.after}}})}};qr=new WeakMap,go=new WeakMap,pn=new WeakMap,fn=new WeakMap,ho=new WeakMap,vo=new WeakMap,gn=new WeakMap,yo=new WeakMap,bo=new WeakMap,hn=new WeakMap,tr=new WeakMap,ko=new WeakMap,So=new WeakMap,Hr=new WeakMap,rr=new WeakMap,ir=new WeakMap,St=new WeakMap,jr=new WeakMap,Pt=new WeakMap,Po=new WeakMap,Co=new WeakMap,Io=new WeakMap,wo=new WeakMap,xo=new WeakMap,Ao=new WeakMap,To=new WeakMap,te=new WeakMap,at=new WeakSet,Zd=function(e,t,i=0){return new W({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,y;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let C=n.more;(!o||o>100)&&(o=100);let I=C.children.splice(0,o),A=await c.MoreChildren({linkId:e.postId,children:I,sort:e.sort},t);if(!A.json?.data?.things?.length)return{children:[]};let{children:M}=S(b=G,at,Yd).call(b,A.json.data.things,e.postId,e,t);return{children:M,more:C.children.length?C:void 0}}else p=n.more.parentId,i=i+n.more.depth;let v=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],m=v[0];return p&&m?.data?.replyList?.data&&(v=m.data.replyList.data.children),S(y=G,at,Yd).call(y,v,p??e.postId,e,t,i)}})},Yd=function(e,t,i,n,o=0){var f,v;let a=[],c,p={};for(let m of e){if(!m.data||(m.data.depth!=null&&(m.data.depth=m.data.depth+o),m.data.depth!=null&&i.depth!=null&&m.data.depth>=i.depth))continue;let b=m.data.parentId?p[m.data.parentId]:void 0;if(m.kind==="t1"){if(m.data.name===t)continue;let y=new G(m.data,n);if(p[y.id]=y,d(y,hn,S(f=G,at,Zd).call(f,{...i,postId:y.postId,commentId:y.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:C,more:I}=S(v=G,at,Yd).call(v,m.data.replyList.data.children,y.id,i,n,o);C.length&&y.replies.children.push(...C),I&&y.replies.setMore(I)}y.replies.preventInitialFetch(),b?b.replies.children.push(y):a.push(y)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let y={parentId:pc(m.data.parentId)?ii(m.data.parentId):ge(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(y):y.parentId===t&&(c=y)}}return{children:a,more:c}},l(G,at);var Q=G;function fd(r,e){let t=u.redditAPIPlugins.Moderation;return new W({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return _O(n)}})}function _O(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:f,srId36:v,description:m,details:b,targetAuthor:y,targetBody:C,targetFullname:I,targetPermalink:A,targetTitle:M}=t.data;g(i,"ModAction from AboutLogResponse is missing id"),g(n,"ModAction from AboutLogResponse is missing mod"),g(o,"ModAction from AboutLogResponse is missing modId36"),g(a,"ModAction from AboutLogResponse is missing createdUtc"),g(c,"ModAction from AboutLogResponse is missing subreddit"),g(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),g(f,"ModAction from AboutLogResponse is missing action"),g(v,"ModAction from AboutLogResponse is missing srId36");let ce=new Date(0);return ce.setUTCSeconds(a),{id:i,type:f,moderatorName:n,moderatorId:`t2_${o}`,createdAt:ce,subredditName:c,subredditId:`t5_${v}`,description:m,details:b,target:I?{id:I,author:y,body:C,permalink:A,title:M}:void 0}}),after:r.data.after,before:r.data.before}}var NO=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(NO||{}),qO={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},HO=(y=>(y.Highlighted="Highlighted",y.Unhighlighted="Unhighlighted",y.Archived="Archived",y.Unarchived="Unarchived",y.ReportedToAdmins="ReportedToAdmins",y.Muted="Muted",y.Unmuted="Unmuted",y.Banned="Banned",y.Unbanned="Unbanned",y.Approved="Approved",y.Disapproved="Disapproved",y.Filtered="Filtered",y.Unfiltered="Unfiltered",y))(HO||{}),jO={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},V,J,oe,yS,bS,gd=class{constructor(e){l(this,J);l(this,V);d(this,V,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,V));return n}async getConversations(e){let i=await u.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,V)),n={};for(let o in i.conversations)n[o]=S(this,J,oe).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await u.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,V));return{participantSubreddit:i.participantSubreddit,conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=u.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,V));return t}async createConversation(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async reply(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await u.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await u.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,V))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,V))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await u.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await u.redditAPIPlugins.NewModmail.TempBan({...e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await u.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,V));return{conversation:S(this,J,oe).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,V))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,V))}};V=new WeakMap,J=new WeakSet,oe=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:qO[e.state],messages:S(this,J,yS).call(this,e,t),modActions:S(this,J,bS).call(this,e,i)}},yS=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},bS=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:jO[a.actionTypeId]})}return i};var vn,yn,Qd,Eo,Ro,Oo,Fo,Fm=class Fm{constructor(e,t){l(this,vn);l(this,yn);l(this,Qd);l(this,Eo);l(this,Ro);l(this,Oo);l(this,Fo);if(X(this),g(e.id,"PrivateMessage: Invalid data, no id"),g(e.name,"PrivateMessage: Invalid data, no name"),g(e.created,"PrivateMessage: Invalid data, no created date"),d(this,vn,he(e.name)),e.author!=null)d(this,yn,{type:"user",username:e.author,id:e.authorFullname?ne(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,yn,{type:"subreddit",name:e.subreddit,id:e.subredditId?Oe(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,Eo,e.body??""),d(this,Ro,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Oo,i),d(this,Qd,e.parentId?he(e.parentId):void 0),d(this,Fo,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new W({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new Fm(a.data,t)).filter(Boolean)||[]}}})}static async send({to:e,subject:t,text:i},n){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,subject:t,text:i,fromSr:""},n)}static async sendAsSubreddit({to:e,fromSubredditName:t,subject:i,text:n},o){await u.redditAPIPlugins.PrivateMessages.Compose({to:e,fromSr:t,subject:i,text:n},o)}static async markAllAsRead(e){await u.redditAPIPlugins.PrivateMessages.ReadAllMessages({filterTypes:""},e)}get id(){return s(this,vn)}get from(){return s(this,yn)}get body(){return s(this,Eo)}get bodyHtml(){return s(this,Ro)}get created(){return s(this,Oo)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,vn)},s(this,Fo))}};vn=new WeakMap,yn=new WeakMap,Qd=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,Fo=new WeakMap;var fr=Fm;var sy=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))(sy||{}),bn,x,Mo,Lo,Uo,Bo,Do,_o,No,qo,Ho,kn,E,dt=class dt{constructor(e,t){l(this,bn);l(this,x);l(this,Mo);l(this,Lo);l(this,Uo);l(this,Bo);l(this,Do);l(this,_o);l(this,No);l(this,qo);l(this,Ho);l(this,kn);l(this,E);X(this),g(e.id,"Subreddit id is missing or undefined"),g(e.displayName,"Subreddit name is missing or undefined"),d(this,bn,Oe(`t5_${e.id}`)),d(this,x,e.displayName),g(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Mo,i),d(this,Lo,WO(e.subredditType)),d(this,Uo,e.title),d(this,Bo,e.description),g(e.lang,"Subreddit is missing language"),d(this,Do,e.lang),d(this,_o,e.subscribers??0),d(this,No,e.activeUserCount??0),d(this,qo,e.over18??!1),d(this,kn,e.url??""),d(this,Ho,{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:GO(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(VO),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,mobileBannerImage:e.mobileBannerImage,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,kn),"https://www.reddit.com").toString()}),d(this,E,t)}get id(){return s(this,bn)}get name(){return s(this,x)}get createdAt(){return s(this,Mo)}get type(){return s(this,Lo)}get title(){return s(this,Uo)}get description(){return s(this,Bo)}get language(){return s(this,Do)}get numberOfSubscribers(){return s(this,_o)}get numberOfActiveUsers(){return s(this,No)}get nsfw(){return s(this,qo)}get settings(){return s(this,Ho)}get userFlairsEnabled(){return this.settings.userFlairs.enabled}get postFlairsEnabled(){return this.settings.postFlairs.enabled}get usersCanAssignUserFlairs(){return this.settings.userFlairs.usersCanAssign}get usersCanAssignPostFlairs(){return this.settings.postFlairs.usersCanAssign}get url(){return this.settings.url}get permalink(){return s(this,kn)}toJSON(){return{id:this.id,name:this.name,createdAt:this.createdAt,type:this.type,title:this.title,description:this.description,language:this.language,nsfw:this.nsfw,numberOfSubscribers:this.numberOfSubscribers,numberOfActiveUsers:this.numberOfActiveUsers,settings:this.settings}}async submitPost(e){let t={...e,subredditName:s(this,x)};return z.submit(t,s(this,E))}getControversialPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,x)},s(this,E))}getTopPosts(e={}){if(!s(this,x))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,x)},s(this,E))}getApprovedUsers(e={}){return w.getSubredditUsersByType({type:"contributors",subredditName:s(this,x),...e},s(this,E))}approveUser(e){return w.createRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,E))}removeUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"contributor"},s(this,E))}getWikiContributors(e={}){return w.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,x),...e},s(this,E))}addWikiContributor(e){return w.createRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,E))}removeWikiContributor(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"wikicontributor"},s(this,E))}getBannedUsers(e={}){return w.getSubredditUsersByType({type:"banned",subredditName:s(this,x),...e},s(this,E))}banUser(e){return w.createRelationship({username:e.username,subredditName:s(this,x),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration},s(this,E))}unbanUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"banned"},s(this,E))}getBannedWikiContributors(e={}){return w.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,x),...e},s(this,E))}banWikiContributor(e){return w.createRelationship({username:e.username,subredditName:s(this,x),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,E))}unbanWikiContributor(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"wikibanned"},s(this,E))}getModerators(e={}){return w.getSubredditUsersByType({type:"moderators",subredditName:s(this,x),...e},s(this,E))}inviteModerator(e,t){return w.createRelationship({type:"moderator_invite",subredditName:s(this,x),username:e,permissions:t??[]},s(this,E))}revokeModeratorInvite(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"moderator_invite"},s(this,E))}removeModerator(e){return w.removeRelationship({type:"moderator",subredditName:s(this,x),username:e},s(this,E))}setModeratorPermissions(e,t){return w.setModeratorPermissions(e,s(this,x),t,s(this,E))}getMutedUsers(e={}){return w.getSubredditUsersByType({type:"muted",subredditName:s(this,x),...e},s(this,E))}muteUser(e,t){return w.createRelationship({username:e,subredditName:s(this,x),type:"muted",note:t},s(this,E))}unmuteUser(e){return w.removeRelationship({username:e,subredditName:s(this,x),type:"muted"},s(this,E))}getModerationLog(e){return fd({subredditName:s(this,x),...e},s(this,E))}getUserFlairTemplates(){return de.getUserFlairTemplates(s(this,x),s(this,E))}getPostFlairTemplates(){return de.getPostFlairTemplates(s(this,x),s(this,E))}createPostFlairTemplate(e){return de.createPostFlairTemplate({subredditName:s(this,x),...e},s(this,E))}createUserFlairTemplate(e){return de.createUserFlairTemplate({subredditName:s(this,x),...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,x),name:i},s(this,E));return js(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,x)},s(this,E));return{next:t.next,prev:t.prev,users:t.users.map(i=>js(i))}}}getModQueue(e={type:"all"}){return dt.aboutLocation({...e,location:"modqueue",subreddit:s(this,x)},s(this,E))}getReports(e={type:"all"}){return dt.aboutLocation({...e,location:"reports",subreddit:s(this,x)},s(this,E))}getSpam(e={type:"all"}){return dt.aboutLocation({...e,location:"spam",subreddit:s(this,x)},s(this,E))}getUnmoderated(e={type:"all"}){return dt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,x)},s(this,E))}getEdited(e={type:"all"}){return dt.aboutLocation({...e,location:"edited",subreddit:s(this,x)},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 W({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return kS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new W({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,bn)]},s(this,E));return kS(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){g(e);let t=e?.[D.Subreddit]?.values[0];return g(t),dt.getById(Oe(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return g(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)}};bn=new WeakMap,x=new WeakMap,Mo=new WeakMap,Lo=new WeakMap,Uo=new WeakMap,Bo=new WeakMap,Do=new WeakMap,_o=new WeakMap,No=new WeakMap,qo=new WeakMap,Ho=new WeakMap,kn=new WeakMap,E=new WeakMap;var ve=dt;async function oy(r,e){let o=(await bt.query("GetSubredditLeaderboard","18ead70c46b6446d45ecd8b679b16d9a929a933d6ef25d8262a459cb18b72848",{id:r},e)).data?.subredditInfoById?.leaderboard;if(!o)throw new Error("subreddit leaderboard not found");if(!o.summary)throw new Error("subreddit leaderboard summary not found");return{id:o.id,summary:o.summary}}function WO(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_restricted"||r==="archived")return r;throw new Error(`invalid subreddit type: ${r}`)}function GO(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function VO(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function kS(r,e){let i=(r.data?.children??[]).map(a=>{let c=n(a);if(c!=null)return c;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new z(a.data,e)}catch{return null}}function o(a){try{return new Q(a.data,e)}catch{return null}}}async function ay(r,e){return SS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function dy(r,e){return SS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function SS(r,e,t,i){let o=(await bt.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:ne(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as zO,GetWidgetsResponse_WidgetItem as ue}from"@devvit/protos";var jo,Wo,Go,Vo,Lm=class Lm{constructor(e,t,i){l(this,jo);l(this,Wo);l(this,Go);l(this,Vo);X(this),d(this,jo,e.id),d(this,Wo,e.shortName),d(this,Go,t),d(this,Vo,i)}get id(){return s(this,jo)}get name(){return s(this,Wo)}get subredditName(){return s(this,Go)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Lm.delete(this.subredditName,this.id,s(this,Vo))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);g(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 el(p,e,t));break;case"calendar":a.push(new tl(p,e,t));break;case"textarea":a.push(new rl(p,e,t));break;case"button":a.push(new il(p,e,t));break;case"community-list":a.push(new nl(p,e,t));break;case"post-flair":a.push(new sl(p,e,t));break;case"custom":a.push(new ol(p,e,t));break;case"subreddit-rules":{let f=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Mm(f,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 el.create(e,t);case"calendar":return tl.create(e,t);case"textarea":return rl.create(e,t);case"button":return il.create(e,t);case"community-list":return nl.create(e,t);case"post-flair":return sl.create(e,t);case"custom":return ol.create(e,t);default:throw new Error("Unknown widget type")}}};jo=new WeakMap,Wo=new WeakMap,Go=new WeakMap,Vo=new WeakMap;var se=Lm,zo,al=class al extends se{constructor(t,i,n){super(t,i,n);l(this,zo);d(this,zo,t.data.map(o=>(g(o.url,"Image widget data is missing url"),g(o.height,"Image widget data is missing height"),g(o.width,"Image widget data is missing width"),g(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,zo)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new al(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new al(ue.fromJSON(o),t.subreddit,i)}};zo=new WeakMap;var el=al,Jo,$o,Ko,dl=class dl extends se{constructor(t,i,n){super(t,i,n);l(this,Jo);l(this,$o);l(this,Ko);g(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),g(t.configuration,"Calendar widget data is missing configuration"),g(t.styles,"Calendar widget data is missing styles"),d(this,Jo,t.googleCalendarId),d(this,$o,t.configuration),d(this,Ko,t.styles)}get googleCalendarId(){return s(this,Jo)}get configuration(){return s(this,$o)}get styles(){return s(this,Ko)}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 dl(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new dl(ue.fromJSON(o),t.subreddit,i)}};Jo=new WeakMap,$o=new WeakMap,Ko=new WeakMap;var tl=dl,Xo,Zo,ll=class ll extends se{constructor(t,i,n){super(t,i,n);l(this,Xo);l(this,Zo);g(t.text,"Textarea widget data is missing text"),g(t.styles,"Textarea widget data is missing styles"),d(this,Xo,t.text),d(this,Zo,t.styles)}get text(){return s(this,Xo)}get styles(){return s(this,Zo)}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 ll(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new ll(ue.fromJSON(o),t.subreddit,i)}};Xo=new WeakMap,Zo=new WeakMap;var rl=ll,Yo,Qo,ea,ul=class ul extends se{constructor(t,i,n){super(t,i,n);l(this,Yo);l(this,Qo);l(this,ea);g(t.styles,"Button widget data is missing styles"),d(this,Yo,t.buttons),d(this,Qo,t.description??""),d(this,ea,t.styles)}get buttons(){return s(this,Yo)}get description(){return s(this,Qo)}get styles(){return s(this,ea)}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 ul(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new ul(ue.fromJSON(o),t.subreddit,i)}};Yo=new WeakMap,Qo=new WeakMap,ea=new WeakMap;var il=ul,ta,ra,cl=class cl extends se{constructor(t,i,n){super(t,i,n);l(this,ta);l(this,ra);d(this,ta,t.data.map(o=>zO.fromJSON(o))),g(t.styles,"Community list widget data is missing styles"),d(this,ra,t.styles)}get communities(){return s(this,ta)}get styles(){return s(this,ra)}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 cl(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new cl(ue.fromJSON(o),t.subreddit,i)}};ta=new WeakMap,ra=new WeakMap;var nl=cl,ia,na,sa,ml=class ml extends se{constructor(t,i,n){super(t,i,n);l(this,ia);l(this,na);l(this,sa);if(g(t.styles,"Post flair widget data is missing styles"),d(this,ia,t.styles),d(this,na,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,sa,t.display)}get styles(){return s(this,ia)}get templates(){return s(this,na)}get display(){return s(this,sa)}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 ml(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new ml(ue.fromJSON(o),t.subreddit,i)}};ia=new WeakMap,na=new WeakMap,sa=new WeakMap;var sl=ml,oa,aa,da,la,ua,pl=class pl extends se{constructor(t,i,n){super(t,i,n);l(this,oa);l(this,aa);l(this,da);l(this,la);l(this,ua);g(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),g(t.height,"Custom widget data is missing height"),g(t.css,"Custom widget data is missing css"),d(this,oa,t.imageData??[]),d(this,aa,t.text??""),d(this,da,t.stylesheetUrl),d(this,la,t.height),d(this,ua,t.css)}get images(){return s(this,oa)}get text(){return s(this,aa)}get stylesheetUrl(){return s(this,da)}get height(){return s(this,la)}get css(){return s(this,ua)}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 pl(ue.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new pl(ue.fromJSON(o),t.subreddit,i)}};oa=new WeakMap,aa=new WeakMap,da=new WeakMap,la=new WeakMap,ua=new WeakMap;var ol=pl,ca,Mm=class extends se{constructor(t,i,n,o){super(i,n,o);l(this,ca);let a=t.rules.map(({description:c,priority:p,shortName:f,violationReason:v})=>(g(c,"Subreddit rule is missing description"),g(p,"Subreddit rule is missing priority"),g(f,"Subreddit rule is missing shortName"),g(v,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:f,violationReason:v}));d(this,ca,a)}get rules(){return s(this,ca)}toJSON(){return{...super.toJSON(),rules:this.rules}}};ca=new WeakMap;var JO=(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))(JO||{}),Se,Pe,Sn,Pn,Cn,In,wn,Ze,He=class He{constructor(e,t,i,n){l(this,Se);l(this,Pe);l(this,Sn);l(this,Pn);l(this,Cn);l(this,In);l(this,wn);l(this,Ze);X(this),d(this,Se,e),d(this,Pe,t),d(this,Sn,i.contentMd),d(this,Pn,i.revisionId),d(this,Cn,new Date(i.revisionDate)),d(this,In,i.reason??""),g(i.revisionBy?.data,"Wiki page author details are missing"),d(this,wn,new w(i.revisionBy.data,n)),d(this,Ze,n)}get name(){return s(this,Se)}get subredditName(){return s(this,Pe)}get content(){return s(this,Sn)}get revisionId(){return s(this,Pn)}get revisionDate(){return s(this,Cn)}get revisionReason(){return s(this,In)}get revisionAuthor(){return s(this,wn)}toJSON(){return{name:s(this,Se),subredditName:s(this,Pe),content:s(this,Sn),revisionId:s(this,Pn),revisionDate:s(this,Cn),revisionReason:s(this,In),revisionAuthor:s(this,wn).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Pe),page:s(this,Se),content:e,reason:t},s(this,Ze))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Pe),page:s(this,Se),...e},s(this,Ze))}async revertTo(e){return He.revertPage(s(this,Pe),s(this,Se),e,s(this,Ze))}async getSettings(){return He.getPageSettings(s(this,Pe),s(this,Se),s(this,Ze))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Pe),page:s(this,Se),listed:e.listed,permLevel:e.permLevel},s(this,Ze))}async addEditor(e){return He.addEditor(s(this,Pe),s(this,Se),e,s(this,Ze))}async removeEditor(e){return He.removeEditor(s(this,Pe),s(this,Se),e,s(this,Ze))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return g(o.data,"Failed to get wiki page"),new He(t,e,o.data,i)}static async getPages(e,t){return(await u.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return He.updatePage(e,t)}static async updatePage(e,t){return await u.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),He.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new W({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return $O(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 g(o.data,"Failed to get wiki page settings"),new fl(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 g(n.data,"Failed to update wiki page settings"),new fl(n.data,t)}static async addEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};Se=new WeakMap,Pe=new WeakMap,Sn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,In=new WeakMap,wn=new WeakMap,Ze=new WeakMap;var ye=He,xn,An,Tn,En,Rn,On,Um=class{constructor(e,t){l(this,xn);l(this,An);l(this,Tn);l(this,En);l(this,Rn);l(this,On);d(this,xn,e.id),d(this,An,e.page),d(this,Tn,new Date(e.timestamp)),g(e.author?.data,"Wiki page revision author details are missing"),d(this,En,new w(e.author.data,t)),d(this,Rn,e.reason??""),d(this,On,e.revisionHidden??!1)}get id(){return s(this,xn)}get page(){return s(this,An)}get date(){return s(this,Tn)}get author(){return s(this,En)}get reason(){return s(this,Rn)}get hidden(){return s(this,On)}toJSON(){return{id:s(this,xn),page:s(this,An),date:s(this,Tn),author:s(this,En).toJSON(),reason:s(this,Rn),hidden:s(this,On)}}};xn=new WeakMap,An=new WeakMap,Tn=new WeakMap,En=new WeakMap,Rn=new WeakMap,On=new WeakMap;var Fn,Mn,Ln,fl=class{constructor(e,t){l(this,Fn);l(this,Mn);l(this,Ln);d(this,Fn,e.listed),d(this,Mn,e.permLevel),d(this,Ln,e.editors.map(i=>(g(i.data,"Wiki page editor details are missing"),new w(i.data,t))))}get listed(){return s(this,Fn)}get permLevel(){return s(this,Mn)}get editors(){return s(this,Ln)}toJSON(){return{listed:s(this,Fn),permLevel:s(this,Mn),editors:s(this,Ln).map(e=>e.toJSON())}}};Fn=new WeakMap,Mn=new WeakMap,Ln=new WeakMap;function $O(r,e){return g(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new Um(i,e)),before:r.data.before,after:r.data.after}}var KO=(t=>(t.Gallery="GALLERY",t.Timeline="TIMELINE",t))(KO||{});function XO(r){return r==="GALLERY"?"GALLERY":"TIMELINE"}var je,Ce,pa,Un,Bn,fa,ga,ha,va,Ct,ya,ba,Dn,ma=class ma{constructor(e,t){l(this,je);l(this,Ce);l(this,pa);l(this,Un);l(this,Bn);l(this,fa);l(this,ga);l(this,ha);l(this,va);l(this,Ct);l(this,ya);l(this,ba);l(this,Dn);g(e.collectionId,"Collection Id is missing or undefined"),g(e.subredditId,"Subreddit Id is missing or undefined"),g(e.title,"Collection title is missing or undefined"),g(e.authorId,"Collection author's id is missing or undefined"),g(e.authorName,"Collection author's id is missing or undefined"),g(e.createdAtUtc,"Collection create timestamp is missing"),g(e.lastUpdateUtc,"Collection last updated timestamp is missing"),d(this,je,t),d(this,Ce,e.collectionId),d(this,pa,e.subredditId),d(this,Un,e.title),d(this,Bn,e.description||""),d(this,fa,e.authorId),d(this,ga,e.authorName),d(this,ha,e.permalink),d(this,va,e.primaryLinkId),d(this,Ct,e.linkIds||[]),d(this,Dn,XO(e.displayLayout)),d(this,ya,e.createdAtUtc),d(this,ba,e.lastUpdateUtc),X(this)}get id(){return s(this,Ce)}get subredditId(){return s(this,pa)}get title(){return s(this,Un)}get description(){return s(this,Bn)}get authorId(){return s(this,fa)}get authorName(){return s(this,ga)}get permalink(){return s(this,ha)}get primaryLinkId(){return s(this,va)}get linkIds(){return s(this,Ct)}get createdAtUtc(){return s(this,ya)}get lastUpdateUtc(){return s(this,ba)}get displayLayout(){return s(this,Dn)}static async getCollectionById(e,t){let n=await u.redditAPIPlugins.PostCollections.Collection(e,t);return new ma(n,t)}static async create(e,t){let n=await u.redditAPIPlugins.PostCollections.Create({srFullname:e.subredditId,title:e.title,description:e.description,displayLayout:e.displayLayout},t);return new ma(n,t)}static async getCollectionsForSubreddit(e,t){return(await u.redditapiv2Plugin.GetSubredditCollections({srFullname:e.subredditId},t)).collections.map(n=>new ma(n,t))}async addPost(e){await u.redditAPIPlugins.PostCollections.AddPost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),s(this,Ct).push(e)}async removePost(e){await u.redditAPIPlugins.PostCollections.RemovePost({collectionId:s(this,Ce),linkFullname:e},s(this,je)),d(this,Ct,s(this,Ct).filter(i=>i!==e))}async delete(){await u.redditAPIPlugins.PostCollections.Delete({collectionId:s(this,Ce)},s(this,je))}async follow(e){await u.redditAPIPlugins.PostCollections.Follow({collectionId:s(this,Ce),follow:e},s(this,je))}async reorder(e){await u.redditAPIPlugins.PostCollections.Reorder({collectionId:s(this,Ce),linkIds:e.join(",")},s(this,je)),d(this,Ct,e)}async updateTitle(e){await u.redditAPIPlugins.PostCollections.UpdateTitle({collectionId:s(this,Ce),title:e},s(this,je)),d(this,Un,e)}async updateDescription(e){await u.redditAPIPlugins.PostCollections.UpdateDescription({collectionId:s(this,Ce),description:e},s(this,je)),d(this,Bn,e)}async updateLayout(e){await u.redditAPIPlugins.PostCollections.UpdateDisplayLayout({collectionId:s(this,Ce),displayLayout:e},s(this,je)),d(this,Dn,e)}};je=new WeakMap,Ce=new WeakMap,pa=new WeakMap,Un=new WeakMap,Bn=new WeakMap,fa=new WeakMap,ga=new WeakMap,ha=new WeakMap,va=new WeakMap,Ct=new WeakMap,ya=new WeakMap,ba=new WeakMap,Dn=new WeakMap;var fi=ma;var ZO=["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"],YO=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],QO=["onload","onerror","onclick","onmouseover"];function eF(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 PS(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*(${ZO.join("|")})\\b`,"gi"),t=new RegExp(`(${YO.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${QO.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=eF(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 ZH(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=PS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{SL as ALL_ICON_NAMES,sy as AboutLocations,il as ButtonWidget,tl as CalendarWidget,KO as CollectionDisplayLayout,Q as Comment,nl as CommunityListWidget,ol as CustomWidget,u as Devvit,Ue as Flair,de as FlairTemplate,CO as FlairType,Tt as Hook,el as ImageWidget,W as Listing,HO as ModMailActionType,NO as ModMailConversationState,gd as ModMailService,Le as ModNote,z as Post,fi as PostCollection,sl as PostFlairWidget,fr as PrivateMessage,qs as RichTextBuilder,fc as SettingScope,UO as SocialLinkType,ve as Subreddit,Mm as SubredditRulesWidget,rl as TextAreaWidget,w as User,se as Widget,ye as WikiPage,JO as WikiPagePermissionLevel,Um as WikiPageRevision,fl as WikiPageSettings,js as convertUserFlairProtoToAPI,fd as getModerationLog,oy as getSubredditLeaderboard,ay as getVaultByAddress,dy as getVaultByUserId,ZH as svg,aO as useAsync,om as useChannel,rm as useForm,lm as useInterval,fm as useState};
6
6
  /*! Bundled license information:
7
7
 
8
8
  shallow-clone/index.js: