@devvit/public-api 0.11.2-next-2024-10-24-21d7de2c5.0 → 0.11.2-next-2024-10-24-d85f5d31e.0
Sign up to get free protection for your applications and to get access to all the features.
- package/apis/reddit/RedditAPIClient.d.ts +1 -2
- package/apis/reddit/RedditAPIClient.d.ts.map +1 -1
- package/apis/reddit/RedditAPIClient.js +1 -2
- package/devvit/Devvit.d.ts +9 -9
- package/devvit/Devvit.d.ts.map +1 -1
- package/devvit/Devvit.js +8 -7
- package/devvit/internals/menu-items.d.ts.map +1 -1
- package/devvit/internals/menu-items.js +0 -1
- package/meta.json +7 -7
- package/meta.min.json +7 -7
- package/package.json +6 -6
- package/public-api.d.ts +16 -13
- package/public-api.iife.js +9 -9
- package/public-api.min.js +1 -1
- package/public-api.min.js.map +2 -2
- package/types/menu-item.d.ts +1 -1
- package/types/menu-item.d.ts.map +1 -1
package/public-api.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var SS=Object.create;var xm=Object.defineProperty;var PS=Object.getOwnPropertyDescriptor;var CS=Object.getOwnPropertyNames;var wS=Object.getPrototypeOf,xS=Object.prototype.hasOwnProperty;var Im=r=>{throw TypeError(r)};var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var IS=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of CS(e))!xS.call(r,n)&&n!==t&&xm(r,n,{get:()=>e[n],enumerable:!(i=PS(e,n))||i.enumerable});return r};var Ln=(r,e,t)=>(t=r!=null?SS(wS(r)):{},IS(e||!r||!r.__esModule?xm(t,"default",{value:r,enumerable:!0}):t,r));var rl=(r,e,t)=>e.has(r)||Im("Cannot "+t);var s=(r,e,t)=>(rl(r,e,"read from private field"),t?t.call(r):e.get(r)),l=(r,e,t)=>e.has(r)?Im("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),d=(r,e,t,i)=>(rl(r,e,"write to private field"),i?i.call(r,t):e.set(r,t),t),S=(r,e,t)=>(rl(r,e,"access private method"),t);var le=h((sO,Fm)=>{Fm.exports=function(r){try{return!!r()}catch{return!0}}});var aa=h((oO,Tm)=>{var FS=le();Tm.exports=!FS(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Z=h((aO,Rm)=>{var Am=aa(),Em=Function.prototype,il=Em.call,TS=Am&&Em.bind.bind(il,il);Rm.exports=Am?TS:function(r){return function(){return il.apply(r,arguments)}}});var Bm=h((dO,Om)=>{var AS=Math.ceil,ES=Math.floor;Om.exports=Math.trunc||function(e){var t=+e;return(t>0?ES:AS)(t)}});var da=h((lO,Mm)=>{var RS=Bm();Mm.exports=function(r){var e=+r;return e!==e||e===0?0:RS(e)}});var he=h((uO,Um)=>{var la=function(r){return r&&r.Math==Math&&r};Um.exports=la(typeof globalThis=="object"&&globalThis)||la(typeof window=="object"&&window)||la(typeof self=="object"&&self)||la(typeof global=="object"&&global)||function(){return this}()||Function("return this")()});var Gr=h((cO,Dm)=>{Dm.exports=!1});var ua=h((mO,Nm)=>{var Lm=he(),OS=Object.defineProperty;Nm.exports=function(r,e){try{OS(Lm,r,{value:e,configurable:!0,writable:!0})}catch{Lm[r]=e}return e}});var ca=h((pO,Hm)=>{var BS=he(),MS=ua(),_m="__core-js_shared__",US=BS[_m]||MS(_m,{});Hm.exports=US});var nl=h((gO,jm)=>{var DS=Gr(),qm=ca();(jm.exports=function(r,e){return qm[r]||(qm[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.27.2",mode:DS?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"})});var ma=h((hO,Wm)=>{Wm.exports=function(r){return r==null}});var pa=h((fO,Gm)=>{var LS=ma(),NS=TypeError;Gm.exports=function(r){if(LS(r))throw NS("Can't call method on "+r);return r}});var Nn=h((vO,Vm)=>{var _S=pa(),HS=Object;Vm.exports=function(r){return HS(_S(r))}});var we=h((yO,zm)=>{var qS=Z(),jS=Nn(),WS=qS({}.hasOwnProperty);zm.exports=Object.hasOwn||function(e,t){return WS(jS(e),t)}});var sl=h((bO,Jm)=>{var GS=Z(),VS=0,zS=Math.random(),JS=GS(1 .toString);Jm.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+JS(++VS+zS,36)}});var Km=h((kO,$m)=>{$m.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var rp=h((SO,tp)=>{var ep=he(),ol=Km(),Xm=ep.process,Zm=ep.Deno,Qm=Xm&&Xm.versions||Zm&&Zm.version,Ym=Qm&&Qm.v8,qe,ga;Ym&&(qe=Ym.split("."),ga=qe[0]>0&&qe[0]<4?1:+(qe[0]+qe[1]));!ga&&ol&&(qe=ol.match(/Edge\/(\d+)/),(!qe||qe[1]>=74)&&(qe=ol.match(/Chrome\/(\d+)/),qe&&(ga=+qe[1])));tp.exports=ga});var al=h((PO,np)=>{var ip=rp(),$S=le();np.exports=!!Object.getOwnPropertySymbols&&!$S(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&ip&&ip<41})});var dl=h((CO,sp)=>{var KS=al();sp.exports=KS&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var xe=h((wO,ap)=>{var XS=he(),ZS=nl(),op=we(),QS=sl(),YS=al(),eP=dl(),Vr=XS.Symbol,ll=ZS("wks"),tP=eP?Vr.for||Vr:Vr&&Vr.withoutSetter||QS;ap.exports=function(r){return op(ll,r)||(ll[r]=YS&&op(Vr,r)?Vr[r]:tP("Symbol."+r)),ll[r]}});var up=h((xO,lp)=>{var rP=xe(),iP=rP("toStringTag"),dp={};dp[iP]="z";lp.exports=String(dp)==="[object z]"});var cl=h((IO,cp)=>{var ul=typeof document=="object"&&document.all,nP=typeof ul>"u"&&ul!==void 0;cp.exports={all:ul,IS_HTMLDDA:nP}});var Q=h((FO,pp)=>{var mp=cl(),sP=mp.all;pp.exports=mp.IS_HTMLDDA?function(r){return typeof r=="function"||r===sP}:function(r){return typeof r=="function"}});var ha=h((TO,hp)=>{var gp=Z(),oP=gp({}.toString),aP=gp("".slice);hp.exports=function(r){return aP(oP(r),8,-1)}});var _n=h((AO,fp)=>{var dP=up(),lP=Q(),fa=ha(),uP=xe(),cP=uP("toStringTag"),mP=Object,pP=fa(function(){return arguments}())=="Arguments",gP=function(r,e){try{return r[e]}catch{}};fp.exports=dP?fa:function(r){var e,t,i;return r===void 0?"Undefined":r===null?"Null":typeof(t=gP(e=mP(r),cP))=="string"?t:pP?fa(e):(i=fa(e))=="Object"&&lP(e.callee)?"Arguments":i}});var Hn=h((EO,vp)=>{var hP=_n(),fP=String;vp.exports=function(r){if(hP(r)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return fP(r)}});var pl=h((RO,kp)=>{var ml=Z(),vP=da(),yP=Hn(),bP=pa(),kP=ml("".charAt),yp=ml("".charCodeAt),SP=ml("".slice),bp=function(r){return function(e,t){var i=yP(bP(e)),n=vP(t),o=i.length,a,c;return n<0||n>=o?r?"":void 0:(a=yp(i,n),a<55296||a>56319||n+1===o||(c=yp(i,n+1))<56320||c>57343?r?kP(i,n):a:r?SP(i,n,n+2):(a-55296<<10)+(c-56320)+65536)}};kp.exports={codeAt:bp(!1),charAt:bp(!0)}});var Cp=h((OO,Pp)=>{var PP=he(),CP=Q(),Sp=PP.WeakMap;Pp.exports=CP(Sp)&&/native code/.test(String(Sp))});var Ct=h((BO,Ip)=>{var wp=Q(),xp=cl(),wP=xp.all;Ip.exports=xp.IS_HTMLDDA?function(r){return typeof r=="object"?r!==null:wp(r)||r===wP}:function(r){return typeof r=="object"?r!==null:wp(r)}});var fe=h((MO,Fp)=>{var xP=le();Fp.exports=!xP(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var hl=h((UO,Ap)=>{var IP=he(),Tp=Ct(),gl=IP.document,FP=Tp(gl)&&Tp(gl.createElement);Ap.exports=function(r){return FP?gl.createElement(r):{}}});var fl=h((DO,Ep)=>{var TP=fe(),AP=le(),EP=hl();Ep.exports=!TP&&!AP(function(){return Object.defineProperty(EP("div"),"a",{get:function(){return 7}}).a!=7})});var vl=h((LO,Rp)=>{var RP=fe(),OP=le();Rp.exports=RP&&OP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var Ze=h((NO,Op)=>{var BP=Ct(),MP=String,UP=TypeError;Op.exports=function(r){if(BP(r))return r;throw UP(MP(r)+" is not an object")}});var je=h((_O,Bp)=>{var DP=aa(),va=Function.prototype.call;Bp.exports=DP?va.bind(va):function(){return va.apply(va,arguments)}});var qn=h((HO,Mp)=>{var yl=he(),LP=Q(),NP=function(r){return LP(r)?r:void 0};Mp.exports=function(r,e){return arguments.length<2?NP(yl[r]):yl[r]&&yl[r][e]}});var bl=h((qO,Up)=>{var _P=Z();Up.exports=_P({}.isPrototypeOf)});var kl=h((jO,Dp)=>{var HP=qn(),qP=Q(),jP=bl(),WP=dl(),GP=Object;Dp.exports=WP?function(r){return typeof r=="symbol"}:function(r){var e=HP("Symbol");return qP(e)&&jP(e.prototype,GP(r))}});var Sl=h((WO,Lp)=>{var VP=String;Lp.exports=function(r){try{return VP(r)}catch{return"Object"}}});var ya=h((GO,Np)=>{var zP=Q(),JP=Sl(),$P=TypeError;Np.exports=function(r){if(zP(r))return r;throw $P(JP(r)+" is not a function")}});var ba=h((VO,_p)=>{var KP=ya(),XP=ma();_p.exports=function(r,e){var t=r[e];return XP(t)?void 0:KP(t)}});var qp=h((zO,Hp)=>{var Pl=je(),Cl=Q(),wl=Ct(),ZP=TypeError;Hp.exports=function(r,e){var t,i;if(e==="string"&&Cl(t=r.toString)&&!wl(i=Pl(t,r))||Cl(t=r.valueOf)&&!wl(i=Pl(t,r))||e!=="string"&&Cl(t=r.toString)&&!wl(i=Pl(t,r)))return i;throw ZP("Can't convert object to primitive value")}});var Vp=h((JO,Gp)=>{var QP=je(),jp=Ct(),Wp=kl(),YP=ba(),eC=qp(),tC=xe(),rC=TypeError,iC=tC("toPrimitive");Gp.exports=function(r,e){if(!jp(r)||Wp(r))return r;var t=YP(r,iC),i;if(t){if(e===void 0&&(e="default"),i=QP(t,r,e),!jp(i)||Wp(i))return i;throw rC("Can't convert object to primitive value")}return e===void 0&&(e="number"),eC(r,e)}});var ka=h(($O,zp)=>{var nC=Vp(),sC=kl();zp.exports=function(r){var e=nC(r,"string");return sC(e)?e:e+""}});var Qe=h($p=>{var oC=fe(),aC=fl(),dC=vl(),Sa=Ze(),Jp=ka(),lC=TypeError,xl=Object.defineProperty,uC=Object.getOwnPropertyDescriptor,Il="enumerable",Fl="configurable",Tl="writable";$p.f=oC?dC?function(e,t,i){if(Sa(e),t=Jp(t),Sa(i),typeof e=="function"&&t==="prototype"&&"value"in i&&Tl in i&&!i[Tl]){var n=uC(e,t);n&&n[Tl]&&(e[t]=i.value,i={configurable:Fl in i?i[Fl]:n[Fl],enumerable:Il in i?i[Il]:n[Il],writable:!1})}return xl(e,t,i)}:xl:function(e,t,i){if(Sa(e),t=Jp(t),Sa(i),aC)try{return xl(e,t,i)}catch{}if("get"in i||"set"in i)throw lC("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var zr=h((XO,Kp)=>{Kp.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var Pa=h((ZO,Xp)=>{var cC=fe(),mC=Qe(),pC=zr();Xp.exports=cC?function(r,e,t){return mC.f(r,e,pC(1,t))}:function(r,e,t){return r[e]=t,r}});var Ca=h((QO,Qp)=>{var gC=nl(),hC=sl(),Zp=gC("keys");Qp.exports=function(r){return Zp[r]||(Zp[r]=hC(r))}});var wa=h((YO,Yp)=>{Yp.exports={}});var Jr=h((eB,rg)=>{var fC=Cp(),tg=he(),vC=Ct(),yC=Pa(),Al=we(),El=ca(),bC=Ca(),kC=wa(),eg="Object already initialized",Rl=tg.TypeError,SC=tg.WeakMap,xa,jn,Ia,PC=function(r){return Ia(r)?jn(r):xa(r,{})},CC=function(r){return function(e){var t;if(!vC(e)||(t=jn(e)).type!==r)throw Rl("Incompatible receiver, "+r+" required");return t}};fC||El.state?(We=El.state||(El.state=new SC),We.get=We.get,We.has=We.has,We.set=We.set,xa=function(r,e){if(We.has(r))throw Rl(eg);return e.facade=r,We.set(r,e),e},jn=function(r){return We.get(r)||{}},Ia=function(r){return We.has(r)}):(or=bC("state"),kC[or]=!0,xa=function(r,e){if(Al(r,or))throw Rl(eg);return e.facade=r,yC(r,or,e),e},jn=function(r){return Al(r,or)?r[or]:{}},Ia=function(r){return Al(r,or)});var We,or;rg.exports={set:xa,get:jn,has:Ia,enforce:PC,getterFor:CC}});var Ol=h(sg=>{"use strict";var ig={}.propertyIsEnumerable,ng=Object.getOwnPropertyDescriptor,wC=ng&&!ig.call({1:2},1);sg.f=wC?function(e){var t=ng(this,e);return!!t&&t.enumerable}:ig});var Ml=h((rB,og)=>{var xC=Z(),IC=le(),FC=ha(),Bl=Object,TC=xC("".split);og.exports=IC(function(){return!Bl("z").propertyIsEnumerable(0)})?function(r){return FC(r)=="String"?TC(r,""):Bl(r)}:Bl});var $r=h((iB,ag)=>{var AC=Ml(),EC=pa();ag.exports=function(r){return AC(EC(r))}});var Ul=h(lg=>{var RC=fe(),OC=je(),BC=Ol(),MC=zr(),UC=$r(),DC=ka(),LC=we(),NC=fl(),dg=Object.getOwnPropertyDescriptor;lg.f=RC?dg:function(e,t){if(e=UC(e),t=DC(t),NC)try{return dg(e,t)}catch{}if(LC(e,t))return MC(!OC(BC.f,e,t),e[t])}});var Nl=h((sB,cg)=>{var Dl=fe(),_C=we(),ug=Function.prototype,HC=Dl&&Object.getOwnPropertyDescriptor,Ll=_C(ug,"name"),qC=Ll&&function(){}.name==="something",jC=Ll&&(!Dl||Dl&&HC(ug,"name").configurable);cg.exports={EXISTS:Ll,PROPER:qC,CONFIGURABLE:jC}});var Hl=h((oB,mg)=>{var WC=Z(),GC=Q(),_l=ca(),VC=WC(Function.toString);GC(_l.inspectSource)||(_l.inspectSource=function(r){return VC(r)});mg.exports=_l.inspectSource});var Wl=h((aB,hg)=>{var jl=Z(),zC=le(),JC=Q(),Fa=we(),ql=fe(),$C=Nl().CONFIGURABLE,KC=Hl(),gg=Jr(),XC=gg.enforce,ZC=gg.get,pg=String,Ta=Object.defineProperty,QC=jl("".slice),YC=jl("".replace),e0=jl([].join),t0=ql&&!zC(function(){return Ta(function(){},"length",{value:8}).length!==8}),r0=String(String).split("String"),i0=hg.exports=function(r,e,t){QC(pg(e),0,7)==="Symbol("&&(e="["+YC(pg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Fa(r,"name")||$C&&r.name!==e)&&(ql?Ta(r,"name",{value:e,configurable:!0}):r.name=e),t0&&t&&Fa(t,"arity")&&r.length!==t.arity&&Ta(r,"length",{value:t.arity});try{t&&Fa(t,"constructor")&&t.constructor?ql&&Ta(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var i=XC(r);return Fa(i,"source")||(i.source=e0(r0,typeof e=="string"?e:"")),r};Function.prototype.toString=i0(function(){return JC(this)&&ZC(this).source||KC(this)},"toString")});var ar=h((dB,fg)=>{var n0=Q(),s0=Qe(),o0=Wl(),a0=ua();fg.exports=function(r,e,t,i){i||(i={});var n=i.enumerable,o=i.name!==void 0?i.name:e;if(n0(t)&&o0(t,o,i),i.global)n?r[e]=t:a0(e,t);else{try{i.unsafe?r[e]&&(n=!0):delete r[e]}catch{}n?r[e]=t:s0.f(r,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return r}});var Gl=h((lB,vg)=>{var d0=da(),l0=Math.max,u0=Math.min;vg.exports=function(r,e){var t=d0(r);return t<0?l0(t+e,0):u0(t,e)}});var bg=h((uB,yg)=>{var c0=da(),m0=Math.min;yg.exports=function(r){return r>0?m0(c0(r),9007199254740991):0}});var Aa=h((cB,kg)=>{var p0=bg();kg.exports=function(r){return p0(r.length)}});var Cg=h((mB,Pg)=>{var g0=$r(),h0=Gl(),f0=Aa(),Sg=function(r){return function(e,t,i){var n=g0(e),o=f0(n),a=h0(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}};Pg.exports={includes:Sg(!0),indexOf:Sg(!1)}});var zl=h((pB,xg)=>{var v0=Z(),Vl=we(),y0=$r(),b0=Cg().indexOf,k0=wa(),wg=v0([].push);xg.exports=function(r,e){var t=y0(r),i=0,n=[],o;for(o in t)!Vl(k0,o)&&Vl(t,o)&&wg(n,o);for(;e.length>i;)Vl(t,o=e[i++])&&(~b0(n,o)||wg(n,o));return n}});var Ea=h((gB,Ig)=>{Ig.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Tg=h(Fg=>{var S0=zl(),P0=Ea(),C0=P0.concat("length","prototype");Fg.f=Object.getOwnPropertyNames||function(e){return S0(e,C0)}});var Jl=h(Ag=>{Ag.f=Object.getOwnPropertySymbols});var Rg=h((vB,Eg)=>{var w0=qn(),x0=Z(),I0=Tg(),F0=Jl(),T0=Ze(),A0=x0([].concat);Eg.exports=w0("Reflect","ownKeys")||function(e){var t=I0.f(T0(e)),i=F0.f;return i?A0(t,i(e)):t}});var Mg=h((yB,Bg)=>{var Og=we(),E0=Rg(),R0=Ul(),O0=Qe();Bg.exports=function(r,e,t){for(var i=E0(e),n=O0.f,o=R0.f,a=0;a<i.length;a++){var c=i[a];!Og(r,c)&&!(t&&Og(t,c))&&n(r,c,o(e,c))}}});var Dg=h((bB,Ug)=>{var B0=le(),M0=Q(),U0=/#|\.prototype\./,Wn=function(r,e){var t=L0[D0(r)];return t==_0?!0:t==N0?!1:M0(e)?B0(e):!!e},D0=Wn.normalize=function(r){return String(r).replace(U0,".").toLowerCase()},L0=Wn.data={},N0=Wn.NATIVE="N",_0=Wn.POLYFILL="P";Ug.exports=Wn});var Gn=h((kB,Lg)=>{var $l=he(),H0=Ul().f,q0=Pa(),j0=ar(),W0=ua(),G0=Mg(),V0=Dg();Lg.exports=function(r,e){var t=r.target,i=r.global,n=r.stat,o,a,c,p,g,f;if(i?a=$l:n?a=$l[t]||W0(t,{}):a=($l[t]||{}).prototype,a)for(c in e){if(g=e[c],r.dontCallGetSet?(f=H0(a,c),p=f&&f.value):p=a[c],o=V0(i?c:t+(n?".":"#")+c,r.forced),!o&&p!==void 0){if(typeof g==typeof p)continue;G0(g,p)}(r.sham||p&&p.sham)&&q0(g,"sham",!0),j0(a,c,g,r)}}});var Kl=h((SB,Ng)=>{var z0=zl(),J0=Ea();Ng.exports=Object.keys||function(e){return z0(e,J0)}});var Hg=h(_g=>{var $0=fe(),K0=vl(),X0=Qe(),Z0=Ze(),Q0=$r(),Y0=Kl();_g.f=$0&&!K0?Object.defineProperties:function(e,t){Z0(e);for(var i=Q0(t),n=Y0(t),o=n.length,a=0,c;o>a;)X0.f(e,c=n[a++],i[c]);return e}});var jg=h((CB,qg)=>{var ew=qn();qg.exports=ew("document","documentElement")});var Vn=h((wB,Kg)=>{var tw=Ze(),rw=Hg(),Wg=Ea(),iw=wa(),nw=jg(),sw=hl(),ow=Ca(),Gg=">",Vg="<",Zl="prototype",Ql="script",Jg=ow("IE_PROTO"),Xl=function(){},$g=function(r){return Vg+Ql+Gg+r+Vg+"/"+Ql+Gg},zg=function(r){r.write($g("")),r.close();var e=r.parentWindow.Object;return r=null,e},aw=function(){var r=sw("iframe"),e="java"+Ql+":",t;return r.style.display="none",nw.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write($g("document.F=Object")),t.close(),t.F},Ra,Oa=function(){try{Ra=new ActiveXObject("htmlfile")}catch{}Oa=typeof document<"u"?document.domain&&Ra?zg(Ra):aw():zg(Ra);for(var r=Wg.length;r--;)delete Oa[Zl][Wg[r]];return Oa()};iw[Jg]=!0;Kg.exports=Object.create||function(e,t){var i;return e!==null?(Xl[Zl]=tw(e),i=new Xl,Xl[Zl]=null,i[Jg]=e):i=Oa(),t===void 0?i:rw.f(i,t)}});var Zg=h((xB,Xg)=>{var dw=le();Xg.exports=!dw(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var eu=h((IB,Yg)=>{var lw=we(),uw=Q(),cw=Nn(),mw=Ca(),pw=Zg(),Qg=mw("IE_PROTO"),Yl=Object,gw=Yl.prototype;Yg.exports=pw?Yl.getPrototypeOf:function(r){var e=cw(r);if(lw(e,Qg))return e[Qg];var t=e.constructor;return uw(t)&&e instanceof t?t.prototype:e instanceof Yl?gw:null}});var nu=h((FB,rh)=>{"use strict";var hw=le(),fw=Q(),vw=Ct(),yw=Vn(),eh=eu(),bw=ar(),kw=xe(),Sw=Gr(),iu=kw("iterator"),th=!1,lt,tu,ru;[].keys&&(ru=[].keys(),"next"in ru?(tu=eh(eh(ru)),tu!==Object.prototype&&(lt=tu)):th=!0);var Pw=!vw(lt)||hw(function(){var r={};return lt[iu].call(r)!==r});Pw?lt={}:Sw&&(lt=yw(lt));fw(lt[iu])||bw(lt,iu,function(){return this});rh.exports={IteratorPrototype:lt,BUGGY_SAFARI_ITERATORS:th}});var zn=h((TB,nh)=>{var Cw=Qe().f,ww=we(),xw=xe(),ih=xw("toStringTag");nh.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!ww(r,ih)&&Cw(r,ih,{configurable:!0,value:e})}});var Kr=h((AB,sh)=>{sh.exports={}});var su=h((EB,oh)=>{"use strict";var Iw=nu().IteratorPrototype,Fw=Vn(),Tw=zr(),Aw=zn(),Ew=Kr(),Rw=function(){return this};oh.exports=function(r,e,t,i){var n=e+" Iterator";return r.prototype=Fw(Iw,{next:Tw(+!i,t)}),Aw(r,n,!1,!0),Ew[n]=Rw,r}});var dh=h((RB,ah)=>{var Ow=Q(),Bw=String,Mw=TypeError;ah.exports=function(r){if(typeof r=="object"||Ow(r))return r;throw Mw("Can't set "+Bw(r)+" as a prototype")}});var uh=h((OB,lh)=>{var Uw=Z(),Dw=Ze(),Lw=dh();lh.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Uw(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(e,[]),r=e instanceof Array}catch{}return function(n,o){return Dw(n),Lw(o),r?t(n,o):n.__proto__=o,n}}():void 0)});var au=h((BB,kh)=>{"use strict";var Nw=Gn(),_w=je(),Ba=Gr(),yh=Nl(),Hw=Q(),qw=su(),ch=eu(),mh=uh(),jw=zn(),Ww=Pa(),ou=ar(),Gw=xe(),ph=Kr(),bh=nu(),Vw=yh.PROPER,zw=yh.CONFIGURABLE,gh=bh.IteratorPrototype,Ma=bh.BUGGY_SAFARI_ITERATORS,Jn=Gw("iterator"),hh="keys",$n="values",fh="entries",vh=function(){return this};kh.exports=function(r,e,t,i,n,o,a){qw(t,e,i);var c=function(I){if(I===n&&b)return b;if(!Ma&&I in f)return f[I];switch(I){case hh:return function(){return new t(this,I)};case $n:return function(){return new t(this,I)};case fh:return function(){return new t(this,I)}}return function(){return new t(this)}},p=e+" Iterator",g=!1,f=r.prototype,m=f[Jn]||f["@@iterator"]||n&&f[n],b=!Ma&&m||c(n),v=e=="Array"&&f.entries||m,P,C,F;if(v&&(P=ch(v.call(new r)),P!==Object.prototype&&P.next&&(!Ba&&ch(P)!==gh&&(mh?mh(P,gh):Hw(P[Jn])||ou(P,Jn,vh)),jw(P,p,!0,!0),Ba&&(ph[p]=vh))),Vw&&n==$n&&m&&m.name!==$n&&(!Ba&&zw?Ww(f,"name",$n):(g=!0,b=function(){return _w(m,this)})),n)if(C={values:c($n),keys:o?b:c(hh),entries:c(fh)},a)for(F in C)(Ma||g||!(F in f))&&ou(f,F,C[F]);else Nw({target:e,proto:!0,forced:Ma||g},C);return(!Ba||a)&&f[Jn]!==b&&ou(f,Jn,b,{name:n}),ph[e]=b,C}});var du=h((MB,Sh)=>{Sh.exports=function(r,e){return{value:r,done:e}}});var xh=h(()=>{"use strict";var Jw=pl().charAt,$w=Hn(),Ch=Jr(),Kw=au(),Ph=du(),wh="String Iterator",Xw=Ch.set,Zw=Ch.getterFor(wh);Kw(String,"String",function(r){Xw(this,{type:wh,string:$w(r),index:0})},function(){var e=Zw(this),t=e.string,i=e.index,n;return i>=t.length?Ph(void 0,!0):(n=Jw(t,i),e.index+=n.length,Ph(n,!1))})});var lu=h((LB,Ih)=>{var Qw=le(),Yw=xe(),ex=Gr(),tx=Yw("iterator");Ih.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}),ex&&!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[tx]||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 Th=h((NB,Fh)=>{var rx=ha(),ix=Z();Fh.exports=function(r){if(rx(r)==="Function")return ix(r)}});var Ua=h((_B,Eh)=>{var Ah=Th(),nx=ya(),sx=aa(),ox=Ah(Ah.bind);Eh.exports=function(r,e){return nx(r),e===void 0?r:sx?ox(r,e):function(){return r.apply(e,arguments)}}});var Bh=h((HB,Oh)=>{var Rh=Wl(),ax=Qe();Oh.exports=function(r,e,t){return t.get&&Rh(t.get,e,{getter:!0}),t.set&&Rh(t.set,e,{setter:!0}),ax.f(r,e,t)}});var uu=h((qB,Mh)=>{var dx=bl(),lx=TypeError;Mh.exports=function(r,e){if(dx(e,r))return r;throw lx("Incorrect invocation")}});var Nh=h((jB,Lh)=>{"use strict";var Uh=fe(),ux=Z(),cx=je(),mx=le(),cu=Kl(),px=Jl(),gx=Ol(),hx=Nn(),fx=Ml(),Xr=Object.assign,Dh=Object.defineProperty,vx=ux([].concat);Lh.exports=!Xr||mx(function(){if(Uh&&Xr({b:1},Xr(Dh({},"a",{enumerable:!0,get:function(){Dh(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}),Xr({},r)[t]!=7||cu(Xr({},e)).join("")!=i})?function(e,t){for(var i=hx(e),n=arguments.length,o=1,a=px.f,c=gx.f;n>o;)for(var p=fx(arguments[o++]),g=a?vx(cu(p),a(p)):cu(p),f=g.length,m=0,b;f>m;)b=g[m++],(!Uh||cx(c,p,b))&&(i[b]=p[b]);return i}:Xr});var qh=h((WB,Hh)=>{var yx=je(),_h=Ze(),bx=ba();Hh.exports=function(r,e,t){var i,n;_h(r);try{if(i=bx(r,"return"),!i){if(e==="throw")throw t;return t}i=yx(i,r)}catch(o){n=!0,i=o}if(e==="throw")throw t;if(n)throw i;return _h(i),t}});var Wh=h((GB,jh)=>{var kx=Ze(),Sx=qh();jh.exports=function(r,e,t,i){try{return i?e(kx(t)[0],t[1]):e(t)}catch(n){Sx(r,"throw",n)}}});var Vh=h((VB,Gh)=>{var Px=xe(),Cx=Kr(),wx=Px("iterator"),xx=Array.prototype;Gh.exports=function(r){return r!==void 0&&(Cx.Array===r||xx[wx]===r)}});var Zh=h((zB,Xh)=>{var Ix=Z(),Fx=le(),zh=Q(),Tx=_n(),Ax=qn(),Ex=Hl(),Jh=function(){},Rx=[],$h=Ax("Reflect","construct"),mu=/^\s*(?:class|function)\b/,Ox=Ix(mu.exec),Bx=!mu.exec(Jh),Kn=function(e){if(!zh(e))return!1;try{return $h(Jh,Rx,e),!0}catch{return!1}},Kh=function(e){if(!zh(e))return!1;switch(Tx(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bx||!!Ox(mu,Ex(e))}catch{return!0}};Kh.sham=!0;Xh.exports=!$h||Fx(function(){var r;return Kn(Kn.call)||!Kn(Object)||!Kn(function(){r=!0})||r})?Kh:Kn});var pu=h((JB,Qh)=>{"use strict";var Mx=ka(),Ux=Qe(),Dx=zr();Qh.exports=function(r,e,t){var i=Mx(e);i in r?Ux.f(r,i,Dx(0,t)):r[i]=t}});var Da=h(($B,ef)=>{var Lx=_n(),Yh=ba(),Nx=ma(),_x=Kr(),Hx=xe(),qx=Hx("iterator");ef.exports=function(r){if(!Nx(r))return Yh(r,qx)||Yh(r,"@@iterator")||_x[Lx(r)]}});var gu=h((KB,tf)=>{var jx=je(),Wx=ya(),Gx=Ze(),Vx=Sl(),zx=Da(),Jx=TypeError;tf.exports=function(r,e){var t=arguments.length<2?zx(r):e;if(Wx(t))return Gx(jx(t,r));throw Jx(Vx(r)+" is not iterable")}});var of=h((XB,sf)=>{"use strict";var $x=Ua(),Kx=je(),Xx=Nn(),Zx=Wh(),Qx=Vh(),Yx=Zh(),eI=Aa(),rf=pu(),tI=gu(),rI=Da(),nf=Array;sf.exports=function(e){var t=Xx(e),i=Yx(this),n=arguments.length,o=n>1?arguments[1]:void 0,a=o!==void 0;a&&(o=$x(o,n>2?arguments[2]:void 0));var c=rI(t),p=0,g,f,m,b,v,P;if(c&&!(this===nf&&Qx(c)))for(b=tI(t,c),v=b.next,f=i?new this:[];!(m=Kx(v,b)).done;p++)P=a?Zx(b,o,[m.value,p],!0):m.value,rf(f,p,P);else for(g=eI(t),f=i?new this(g):nf(g);g>p;p++)P=a?o(t[p],p):t[p],rf(f,p,P);return f.length=p,f}});var hu=h((ZB,df)=>{var af=Gl(),iI=Aa(),nI=pu(),sI=Array,oI=Math.max;df.exports=function(r,e,t){for(var i=iI(r),n=af(e,i),o=af(t===void 0?i:t,i),a=sI(oI(o-n,0)),c=0;n<o;n++,c++)nI(a,c,r[n]);return a.length=c,a}});var vf=h((QB,ff)=>{var dr=Z(),fu=2147483647,Xn=36,pf=1,bu=26,aI=38,dI=700,lI=72,uI=128,cI="-",mI=/[^\0-\u007E]/,gf=/[.\u3002\uFF0E\uFF61]/g,lf="Overflow: input needs wider integers to process",vu=Xn-pf,uf=RangeError,pI=dr(gf.exec),Zr=Math.floor,yu=String.fromCharCode,cf=dr("".charCodeAt),hf=dr([].join),wt=dr([].push),gI=dr("".replace),hI=dr("".split),fI=dr("".toLowerCase),vI=function(r){for(var e=[],t=0,i=r.length;t<i;){var n=cf(r,t++);if(n>=55296&&n<=56319&&t<i){var o=cf(r,t++);(o&64512)==56320?wt(e,((n&1023)<<10)+(o&1023)+65536):(wt(e,n),t--)}else wt(e,n)}return e},mf=function(r){return r+22+75*(r<26)},yI=function(r,e,t){var i=0;for(r=t?Zr(r/dI):r>>1,r+=Zr(r/e);r>vu*bu>>1;)r=Zr(r/vu),i+=Xn;return Zr(i+(vu+1)*r/(r+aI))},bI=function(r){var e=[];r=vI(r);var t=r.length,i=uI,n=0,o=lI,a,c;for(a=0;a<r.length;a++)c=r[a],c<128&&wt(e,yu(c));var p=e.length,g=p;for(p&&wt(e,cI);g<t;){var f=fu;for(a=0;a<r.length;a++)c=r[a],c>=i&&c<f&&(f=c);var m=g+1;if(f-i>Zr((fu-n)/m))throw uf(lf);for(n+=(f-i)*m,i=f,a=0;a<r.length;a++){if(c=r[a],c<i&&++n>fu)throw uf(lf);if(c==i){for(var b=n,v=Xn;;){var P=v<=o?pf:v>=o+bu?bu:v-o;if(b<P)break;var C=b-P,F=Xn-P;wt(e,yu(mf(P+C%F))),b=Zr(C/F),v+=Xn}wt(e,yu(mf(b))),o=yI(n,m,g==p),n=0,g++}}n++,i++}return hf(e,"")};ff.exports=function(r){var e=[],t=hI(gI(fI(r),gf,"."),"."),i,n;for(i=0;i<t.length;i++)n=t[i],wt(e,pI(mI,n)?"xn--"+bI(n):n);return hf(e,".")}});var ku=h((YB,yf)=>{var kI=TypeError;yf.exports=function(r,e){if(r<e)throw kI("Not enough arguments");return r}});var kf=h((eM,bf)=>{var SI=xe(),PI=Vn(),CI=Qe().f,Su=SI("unscopables"),Pu=Array.prototype;Pu[Su]==null&&CI(Pu,Su,{configurable:!0,value:PI(null)});bf.exports=function(r){Pu[Su][r]=!0}});var If=h((tM,xf)=>{"use strict";var wI=$r(),Cu=kf(),Sf=Kr(),Cf=Jr(),xI=Qe().f,II=au(),La=du(),FI=Gr(),TI=fe(),wf="Array Iterator",AI=Cf.set,EI=Cf.getterFor(wf);xf.exports=II(Array,"Array",function(r,e){AI(this,{type:wf,target:wI(r),index:0,kind:e})},function(){var r=EI(this),e=r.target,t=r.kind,i=r.index++;return!e||i>=e.length?(r.target=void 0,La(void 0,!0)):t=="keys"?La(i,!1):t=="values"?La(e[i],!1):La([i,e[i]],!1)},"values");var Pf=Sf.Arguments=Sf.Array;Cu("keys");Cu("values");Cu("entries");if(!FI&&TI&&Pf.name!=="values")try{xI(Pf,"name",{value:"values"})}catch{}});var Tf=h((rM,Ff)=>{var RI=ar();Ff.exports=function(r,e,t){for(var i in e)RI(r,i,e[i],t);return r}});var Rf=h((iM,Ef)=>{var Af=hu(),OI=Math.floor,wu=function(r,e){var t=r.length,i=OI(t/2);return t<8?BI(r,e):MI(r,wu(Af(r,0,i),e),wu(Af(r,i),e),e)},BI=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},MI=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};Ef.exports=wu});var Mu=h((nM,Zf)=>{"use strict";If();var Au=Gn(),Yr=he(),Na=je(),Ye=Z(),UI=fe(),Wf=lu(),Gf=ar(),DI=Tf(),LI=zn(),NI=su(),Ou=Jr(),Vf=uu(),xu=Q(),_I=we(),HI=Ua(),qI=_n(),jI=Ze(),zf=Ct(),ve=Hn(),WI=Vn(),Of=zr(),Eu=gu(),GI=Da(),Qr=ku(),VI=xe(),zI=Rf(),JI=VI("iterator"),Yn="URLSearchParams",Jf=Yn+"Iterator",$f=Ou.set,Ge=Ou.getterFor(Yn),$I=Ou.getterFor(Jf),KI=Object.getOwnPropertyDescriptor,Bu=function(r){if(!UI)return Yr[r];var e=KI(Yr,r);return e&&e.value},Bf=Bu("fetch"),Ha=Bu("Request"),Zn=Bu("Headers"),Iu=Ha&&Ha.prototype,Mf=Zn&&Zn.prototype,XI=Yr.RegExp,ZI=Yr.TypeError,Kf=Yr.decodeURIComponent,QI=Yr.encodeURIComponent,YI=Ye("".charAt),Uf=Ye([].join),lr=Ye([].push),Ru=Ye("".replace),eF=Ye([].shift),Df=Ye([].splice),Lf=Ye("".split),tF=Ye("".slice),rF=/\+/g,Nf=Array(4),iF=function(r){return Nf[r-1]||(Nf[r-1]=XI("((?:%[\\da-f]{2}){"+r+"})","gi"))},nF=function(r){try{return Kf(r)}catch{return r}},_f=function(r){var e=Ru(r,rF," "),t=4;try{return Kf(e)}catch{for(;t;)e=Ru(e,iF(t--),nF);return e}},sF=/[!'()~]|%20/g,oF={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},aF=function(r){return oF[r]},Hf=function(r){return Ru(QI(r),sF,aF)},Fu=NI(function(e,t){$f(this,{type:Jf,iterator:Eu(Ge(e).entries),kind:t})},"Iterator",function(){var e=$I(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),Xf=function(r){this.entries=[],this.url=null,r!==void 0&&(zf(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?YI(r,0)==="?"?tF(r,1):r:ve(r)))};Xf.prototype={type:Yn,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var e=GI(r),t,i,n,o,a,c,p;if(e)for(t=Eu(r,e),i=t.next;!(n=Na(i,t)).done;){if(o=Eu(jI(n.value)),a=o.next,(c=Na(a,o)).done||(p=Na(a,o)).done||!Na(a,o).done)throw ZI("Expected sequence with length 2");lr(this.entries,{key:ve(c.value),value:ve(p.value)})}else for(var g in r)_I(r,g)&&lr(this.entries,{key:g,value:ve(r[g])})},parseQuery:function(r){if(r)for(var e=Lf(r,"&"),t=0,i,n;t<e.length;)i=e[t++],i.length&&(n=Lf(i,"="),lr(this.entries,{key:_f(eF(n)),value:_f(Uf(n,"="))}))},serialize:function(){for(var r=this.entries,e=[],t=0,i;t<r.length;)i=r[t++],lr(e,Hf(i.key)+"="+Hf(i.value));return Uf(e,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var qa=function(){Vf(this,Qn);var e=arguments.length>0?arguments[0]:void 0;$f(this,new Xf(e))},Qn=qa.prototype;DI(Qn,{append:function(e,t){Qr(arguments.length,2);var i=Ge(this);lr(i.entries,{key:ve(e),value:ve(t)}),i.updateURL()},delete:function(r){Qr(arguments.length,1);for(var e=Ge(this),t=e.entries,i=ve(r),n=0;n<t.length;)t[n].key===i?Df(t,n,1):n++;e.updateURL()},get:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=[],o=0;o<t.length;o++)t[o].key===i&&lr(n,t[o].value);return n},has:function(e){Qr(arguments.length,1);for(var t=Ge(this).entries,i=ve(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){Qr(arguments.length,1);for(var i=Ge(this),n=i.entries,o=!1,a=ve(e),c=ve(t),p=0,g;p<n.length;p++)g=n[p],g.key===a&&(o?Df(n,p--,1):(o=!0,g.value=c));o||lr(n,{key:a,value:c}),i.updateURL()},sort:function(){var e=Ge(this);zI(e.entries,function(t,i){return t.key>i.key?1:-1}),e.updateURL()},forEach:function(e){for(var t=Ge(this).entries,i=HI(e,arguments.length>1?arguments[1]:void 0),n=0,o;n<t.length;)o=t[n++],i(o.value,o.key,this)},keys:function(){return new Fu(this,"keys")},values:function(){return new Fu(this,"values")},entries:function(){return new Fu(this,"entries")}},{enumerable:!0});Gf(Qn,JI,Qn.entries,{name:"entries"});Gf(Qn,"toString",function(){return Ge(this).serialize()},{enumerable:!0});LI(qa,Yn);Au({global:!0,constructor:!0,forced:!Wf},{URLSearchParams:qa});!Wf&&xu(Zn)&&(qf=Ye(Mf.has),jf=Ye(Mf.set),Tu=function(r){if(zf(r)){var e=r.body,t;if(qI(e)===Yn)return t=r.headers?new Zn(r.headers):new Zn,qf(t,"content-type")||jf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),WI(r,{body:Of(0,ve(e)),headers:Of(0,t)})}return r},xu(Bf)&&Au({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Bf(e,arguments.length>1?Tu(arguments[1]):{})}}),xu(Ha)&&(_a=function(e){return Vf(this,Iu),new Ha(e,arguments.length>1?Tu(arguments[1]):{})},Iu.constructor=_a,_a.prototype=Iu,Au({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:_a})));var qf,jf,Tu,_a;Zf.exports={URLSearchParams:qa,getState:Ge}});var fv=h(()=>{"use strict";xh();var dF=Gn(),Xu=fe(),lF=lu(),Zu=he(),Qf=Ua(),Ee=Z(),za=ar(),Ie=Bh(),uF=uu(),Ju=we(),Qu=Nh(),ei=of(),Ve=hu(),cF=pl().codeAt,mF=vf(),ct=Hn(),pF=zn(),gF=ku(),uv=Mu(),cv=Jr(),hF=cv.set,Ja=cv.getterFor("URL"),fF=uv.URLSearchParams,vF=uv.getState,es=Zu.URL,$u=Zu.TypeError,$a=Zu.parseInt,yF=Math.floor,Yf=Math.pow,Ae=Ee("".charAt),ze=Ee(/./.exec),rs=Ee([].join),bF=Ee(1 .toString),kF=Ee([].pop),ri=Ee([].push),ev=Ee("".replace),SF=Ee([].shift),PF=Ee("".split),ns=Ee("".slice),Ka=Ee("".toLowerCase),CF=Ee([].unshift),wF="Invalid authority",Uu="Invalid scheme",ur="Invalid host",tv="Invalid port",mv=/[a-z]/i,xF=/[\d+-.a-z]/i,Ku=/\d/,IF=/^0x/i,FF=/^[0-7]+$/,TF=/^\d+$/,pv=/^[\da-f]+$/i,AF=/[\0\t\n\r #%/:<>?@[\\\]^|]/,EF=/[\0\t\n\r #/:<>?@[\\\]^|]/,RF=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,OF=/[\t\n\r]/g,Fe,BF=function(r){var e=PF(r,"."),t,i,n,o,a,c,p;if(e.length&&e[e.length-1]==""&&e.length--,t=e.length,t>4)return r;for(i=[],n=0;n<t;n++){if(o=e[n],o=="")return r;if(a=10,o.length>1&&Ae(o,0)=="0"&&(a=ze(IF,o)?16:8,o=ns(o,a==8?1:2)),o==="")c=0;else{if(!ze(a==10?TF:a==8?FF:pv,o))return r;c=$a(o,a)}ri(i,c)}for(n=0;n<t;n++)if(c=i[n],n==t-1){if(c>=Yf(256,5-t))return null}else if(c>255)return null;for(p=kF(i),n=0;n<i.length;n++)p+=i[n]*Yf(256,3-n);return p},MF=function(r){var e=[0,0,0,0,0,0,0,0],t=0,i=null,n=0,o,a,c,p,g,f,m,b=function(){return Ae(r,n)};if(b()==":"){if(Ae(r,1)!=":")return;n+=2,t++,i=t}for(;b();){if(t==8)return;if(b()==":"){if(i!==null)return;n++,t++,i=t;continue}for(o=a=0;a<4&&ze(pv,b());)o=o*16+$a(b(),16),n++,a++;if(b()=="."){if(a==0||(n-=a,t>6))return;for(c=0;b();){if(p=null,c>0)if(b()=="."&&c<4)n++;else return;if(!ze(Ku,b()))return;for(;ze(Ku,b());){if(g=$a(b(),10),p===null)p=g;else{if(p==0)return;p=p*10+g}if(p>255)return;n++}e[t]=e[t]*256+p,c++,(c==2||c==4)&&t++}if(c!=4)return;break}else if(b()==":"){if(n++,!b())return}else if(b())return;e[t++]=o}if(i!==null)for(f=t-i,t=7;t!=0&&f>0;)m=e[t],e[t--]=e[i+f-1],e[i+--f]=m;else if(t!=8)return;return e},UF=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},ts=function(r){var e,t,i,n;if(typeof r=="number"){for(e=[],t=0;t<4;t++)CF(e,r%256),r=yF(r/256);return rs(e,".")}else if(typeof r=="object"){for(e="",i=UF(r),t=0;t<8;t++)n&&r[t]===0||(n&&(n=!1),i===t?(e+=t?":":"::",n=!0):(e+=bF(r[t],16),t<7&&(e+=":")));return"["+e+"]"}return r},Va={},gv=Qu({},Va,{" ":1,'"':1,"<":1,">":1,"`":1}),hv=Qu({},gv,{"#":1,"?":1,"{":1,"}":1}),Du=Qu({},hv,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),xt=function(r,e){var t=cF(r,0);return t>32&&t<127&&!Ju(e,r)?r:encodeURIComponent(r)},ja={ftp:21,file:null,http:80,https:443,ws:80,wss:443},is=function(r,e){var t;return r.length==2&&ze(mv,Ae(r,0))&&((t=Ae(r,1))==":"||!e&&t=="|")},rv=function(r){var e;return r.length>1&&is(ns(r,0,2))&&(r.length==2||(e=Ae(r,2))==="/"||e==="\\"||e==="?"||e==="#")},DF=function(r){return r==="."||Ka(r)==="%2e"},LF=function(r){return r=Ka(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Lu={},iv={},Nu={},nv={},sv={},_u={},ov={},av={},Wa={},Ga={},Hu={},qu={},ju={},Wu={},dv={},Gu={},ti={},et={},lv={},cr={},ut={},Yu=function(r,e,t){var i=ct(r),n,o,a;if(e){if(o=this.parse(i),o)throw $u(o);this.searchParams=null}else{if(t!==void 0&&(n=new Yu(t,!0)),o=this.parse(i,null,n),o)throw $u(o);a=vF(new fF),a.bindURL(this),this.searchParams=a}};Yu.prototype={type:"URL",parse:function(r,e,t){var i=this,n=e||Lu,o=0,a="",c=!1,p=!1,g=!1,f,m,b,v;for(r=ct(r),e||(i.scheme="",i.username="",i.password="",i.host=null,i.port=null,i.path=[],i.query=null,i.fragment=null,i.cannotBeABaseURL=!1,r=ev(r,RF,"")),r=ev(r,OF,""),f=ei(r);o<=f.length;){switch(m=f[o],n){case Lu:if(m&&ze(mv,m))a+=Ka(m),n=iv;else{if(e)return Uu;n=Nu;continue}break;case iv:if(m&&(ze(xF,m)||m=="+"||m=="-"||m=="."))a+=Ka(m);else if(m==":"){if(e&&(i.isSpecial()!=Ju(ja,a)||a=="file"&&(i.includesCredentials()||i.port!==null)||i.scheme=="file"&&!i.host))return;if(i.scheme=a,e){i.isSpecial()&&ja[i.scheme]==i.port&&(i.port=null);return}a="",i.scheme=="file"?n=Wu:i.isSpecial()&&t&&t.scheme==i.scheme?n=nv:i.isSpecial()?n=av:f[o+1]=="/"?(n=sv,o++):(i.cannotBeABaseURL=!0,ri(i.path,""),n=lv)}else{if(e)return Uu;a="",n=Nu,o=0;continue}break;case Nu:if(!t||t.cannotBeABaseURL&&m!="#")return Uu;if(t.cannotBeABaseURL&&m=="#"){i.scheme=t.scheme,i.path=Ve(t.path),i.query=t.query,i.fragment="",i.cannotBeABaseURL=!0,n=ut;break}n=t.scheme=="file"?Wu:_u;continue;case nv:if(m=="/"&&f[o+1]=="/")n=Wa,o++;else{n=_u;continue}break;case sv:if(m=="/"){n=Ga;break}else{n=et;continue}case _u:if(i.scheme=t.scheme,m==Fe)i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query;else if(m=="/"||m=="\\"&&i.isSpecial())n=ov;else if(m=="?")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,i.path=Ve(t.path),i.path.length--,n=et;continue}break;case ov:if(i.isSpecial()&&(m=="/"||m=="\\"))n=Wa;else if(m=="/")n=Ga;else{i.username=t.username,i.password=t.password,i.host=t.host,i.port=t.port,n=et;continue}break;case av:if(n=Wa,m!="/"||Ae(a,o+1)!="/")continue;o++;break;case Wa:if(m!="/"&&m!="\\"){n=Ga;continue}break;case Ga:if(m=="@"){c&&(a="%40"+a),c=!0,b=ei(a);for(var P=0;P<b.length;P++){var C=b[P];if(C==":"&&!g){g=!0;continue}var F=xt(C,Du);g?i.password+=F:i.username+=F}a=""}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(c&&a=="")return wF;o-=ei(a).length+1,a="",n=Hu}else a+=m;break;case Hu:case qu:if(e&&i.scheme=="file"){n=Gu;continue}else if(m==":"&&!p){if(a=="")return ur;if(v=i.parseHost(a),v)return v;if(a="",n=ju,e==qu)return}else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()){if(i.isSpecial()&&a=="")return ur;if(e&&a==""&&(i.includesCredentials()||i.port!==null))return;if(v=i.parseHost(a),v)return v;if(a="",n=ti,e)return;continue}else m=="["?p=!0:m=="]"&&(p=!1),a+=m;break;case ju:if(ze(Ku,m))a+=m;else if(m==Fe||m=="/"||m=="?"||m=="#"||m=="\\"&&i.isSpecial()||e){if(a!=""){var I=$a(a,10);if(I>65535)return tv;i.port=i.isSpecial()&&I===ja[i.scheme]?null:I,a=""}if(e)return;n=ti;continue}else return tv;break;case Wu:if(i.scheme="file",m=="/"||m=="\\")n=dv;else if(t&&t.scheme=="file")if(m==Fe)i.host=t.host,i.path=Ve(t.path),i.query=t.query;else if(m=="?")i.host=t.host,i.path=Ve(t.path),i.query="",n=cr;else if(m=="#")i.host=t.host,i.path=Ve(t.path),i.query=t.query,i.fragment="",n=ut;else{rv(rs(Ve(f,o),""))||(i.host=t.host,i.path=Ve(t.path),i.shortenPath()),n=et;continue}else{n=et;continue}break;case dv:if(m=="/"||m=="\\"){n=Gu;break}t&&t.scheme=="file"&&!rv(rs(Ve(f,o),""))&&(is(t.path[0],!0)?ri(i.path,t.path[0]):i.host=t.host),n=et;continue;case Gu:if(m==Fe||m=="/"||m=="\\"||m=="?"||m=="#"){if(!e&&is(a))n=et;else if(a==""){if(i.host="",e)return;n=ti}else{if(v=i.parseHost(a),v)return v;if(i.host=="localhost"&&(i.host=""),e)return;a="",n=ti}continue}else a+=m;break;case ti:if(i.isSpecial()){if(n=et,m!="/"&&m!="\\")continue}else if(!e&&m=="?")i.query="",n=cr;else if(!e&&m=="#")i.fragment="",n=ut;else if(m!=Fe&&(n=et,m!="/"))continue;break;case et:if(m==Fe||m=="/"||m=="\\"&&i.isSpecial()||!e&&(m=="?"||m=="#")){if(LF(a)?(i.shortenPath(),m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,"")):DF(a)?m!="/"&&!(m=="\\"&&i.isSpecial())&&ri(i.path,""):(i.scheme=="file"&&!i.path.length&&is(a)&&(i.host&&(i.host=""),a=Ae(a,0)+":"),ri(i.path,a)),a="",i.scheme=="file"&&(m==Fe||m=="?"||m=="#"))for(;i.path.length>1&&i.path[0]==="";)SF(i.path);m=="?"?(i.query="",n=cr):m=="#"&&(i.fragment="",n=ut)}else a+=xt(m,hv);break;case lv:m=="?"?(i.query="",n=cr):m=="#"?(i.fragment="",n=ut):m!=Fe&&(i.path[0]+=xt(m,Va));break;case cr:!e&&m=="#"?(i.fragment="",n=ut):m!=Fe&&(m=="'"&&i.isSpecial()?i.query+="%27":m=="#"?i.query+="%23":i.query+=xt(m,Va));break;case ut:m!=Fe&&(i.fragment+=xt(m,gv));break}o++}},parseHost:function(r){var e,t,i;if(Ae(r,0)=="["){if(Ae(r,r.length-1)!="]"||(e=MF(ns(r,1,-1)),!e))return ur;this.host=e}else if(this.isSpecial()){if(r=mF(r),ze(AF,r)||(e=BF(r),e===null))return ur;this.host=e}else{if(ze(EF,r))return ur;for(e="",t=ei(r),i=0;i<t.length;i++)e+=xt(t[i],Va);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme=="file"},includesCredentials:function(){return this.username!=""||this.password!=""},isSpecial:function(){return Ju(ja,this.scheme)},shortenPath:function(){var r=this.path,e=r.length;e&&(this.scheme!="file"||e!=1||!is(r[0],!0))&&r.length--},serialize:function(){var r=this,e=r.scheme,t=r.username,i=r.password,n=r.host,o=r.port,a=r.path,c=r.query,p=r.fragment,g=e+":";return n!==null?(g+="//",r.includesCredentials()&&(g+=t+(i?":"+i:"")+"@"),g+=ts(n),o!==null&&(g+=":"+o)):e=="file"&&(g+="//"),g+=r.cannotBeABaseURL?a[0]:a.length?"/"+rs(a,"/"):"",c!==null&&(g+="?"+c),p!==null&&(g+="#"+p),g},setHref:function(r){var e=this.parse(r);if(e)throw $u(e);this.searchParams.update()},getOrigin:function(){var r=this.scheme,e=this.port;if(r=="blob")try{return new ii(r.path[0]).origin}catch{return"null"}return r=="file"||!this.isSpecial()?"null":r+"://"+ts(this.host)+(e!==null?":"+e:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(ct(r)+":",Lu)},getUsername:function(){return this.username},setUsername:function(r){var e=ei(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var t=0;t<e.length;t++)this.username+=xt(e[t],Du)}},getPassword:function(){return this.password},setPassword:function(r){var e=ei(ct(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var t=0;t<e.length;t++)this.password+=xt(e[t],Du)}},getHost:function(){var r=this.host,e=this.port;return r===null?"":e===null?ts(r):ts(r)+":"+e},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Hu)},getHostname:function(){var r=this.host;return r===null?"":ts(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,qu)},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,ju))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+rs(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,ti))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=ct(r),r==""?this.query=null:(Ae(r,0)=="?"&&(r=ns(r,1)),this.query="",this.parse(r,cr)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=ct(r),r==""){this.fragment=null;return}Ae(r,0)=="#"&&(r=ns(r,1)),this.fragment="",this.parse(r,ut)},update:function(){this.query=this.searchParams.serialize()||null}};var ii=function(e){var t=uF(this,ne),i=gF(arguments.length,1)>1?arguments[1]:void 0,n=hF(t,new Yu(e,!1,i));Xu||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},ne=ii.prototype,Te=function(r,e){return{get:function(){return Ja(this)[r]()},set:e&&function(t){return Ja(this)[e](t)},configurable:!0,enumerable:!0}};Xu&&(Ie(ne,"href",Te("serialize","setHref")),Ie(ne,"origin",Te("getOrigin")),Ie(ne,"protocol",Te("getProtocol","setProtocol")),Ie(ne,"username",Te("getUsername","setUsername")),Ie(ne,"password",Te("getPassword","setPassword")),Ie(ne,"host",Te("getHost","setHost")),Ie(ne,"hostname",Te("getHostname","setHostname")),Ie(ne,"port",Te("getPort","setPort")),Ie(ne,"pathname",Te("getPathname","setPathname")),Ie(ne,"search",Te("getSearch","setSearch")),Ie(ne,"searchParams",Te("getSearchParams")),Ie(ne,"hash",Te("getHash","setHash")));za(ne,"toJSON",function(){return Ja(this).serialize()},{enumerable:!0});za(ne,"toString",function(){return Ja(this).serialize()},{enumerable:!0});es&&(Vu=es.createObjectURL,zu=es.revokeObjectURL,Vu&&za(ii,"createObjectURL",Qf(Vu,es)),zu&&za(ii,"revokeObjectURL",Qf(zu,es)));var Vu,zu;pF(ii,"URL");dF({global:!0,constructor:!0,forced:!lF,sham:!Xu},{URL:ii})});var vv=h(()=>{fv()});var yv=h(()=>{"use strict";var NF=Gn(),_F=je();NF({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return _F(URL.prototype.toString,this)}})});var bv=h(()=>{Mu()});var Sv=h((pM,kv)=>{var HF=he();kv.exports=HF});var Cv=h((gM,Pv)=>{vv();yv();bv();var qF=Sv();Pv.exports=qF.URL});var Fc=h((NL,Oy)=>{var iA=Object.prototype.toString;Oy.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 dA(e)?"generatorfunction":"function";if(nA(e))return"array";if(cA(e))return"buffer";if(uA(e))return"arguments";if(oA(e))return"date";if(sA(e))return"error";if(aA(e))return"regexp";switch(Ry(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(lA(e))return"generator";switch(t=iA.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 Ry(r){return typeof r.constructor=="function"?r.constructor.name:null}function nA(r){return Array.isArray?Array.isArray(r):r instanceof Array}function sA(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function oA(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function aA(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function dA(r,e){return Ry(r)==="GeneratorFunction"}function lA(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function uA(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 cA(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var Uy=h((_L,My)=>{"use strict";var By=Symbol.prototype.valueOf,mA=Fc();function pA(r,e){switch(mA(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 vA(r);case"symbol":return yA(r);case"arraybuffer":return hA(r);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return fA(r);case"regexp":return gA(r);case"error":return Object.create(r);default:return r}}function gA(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 hA(r){let e=new r.constructor(r.byteLength);return new Uint8Array(e).set(new Uint8Array(r)),e}function fA(r,e){return new r.constructor(r.buffer,r.byteOffset,r.length)}function vA(r){let e=r.length,t=Buffer.allocUnsafe?Buffer.allocUnsafe(e):Buffer.from(e);return r.copy(t),t}function yA(r){return By?Object(By.call(r)):{}}My.exports=pA});var Ly=h((HL,Dy)=>{"use strict";Dy.exports=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1}});var Hy=h((qL,_y)=>{"use strict";var bA=Ly();function Ny(r){return bA(r)===!0&&Object.prototype.toString.call(r)==="[object Object]"}_y.exports=function(e){var t,i;return!(Ny(e)===!1||(t=e.constructor,typeof t!="function")||(i=t.prototype,Ny(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var jy=h((jL,qy)=>{"use strict";var kA=Uy(),SA=Fc(),PA=Hy();function Tc(r,e){switch(SA(r)){case"object":return CA(r,e);case"array":return wA(r,e);default:return kA(r)}}function CA(r,e){if(typeof e=="function")return e(r);if(e||PA(r)){let t=new r.constructor;for(let i in r)t[i]=Tc(r[i],e);return t}return r}function wA(r,e){let t=new r.constructor(r.length);for(let i=0;i<r.length;i++)t[i]=Tc(r[i],e);return t}qy.exports=Tc});var Hc=h((fs,Fi)=>{var xA=200,_c="__lodash_hash_undefined__",bd=1,eb=2,tb=9007199254740991,md="[object Arguments]",Oc="[object Array]",IA="[object AsyncFunction]",rb="[object Boolean]",ib="[object Date]",nb="[object Error]",sb="[object Function]",FA="[object GeneratorFunction]",pd="[object Map]",ob="[object Number]",TA="[object Null]",Ii="[object Object]",Wy="[object Promise]",AA="[object Proxy]",ab="[object RegExp]",gd="[object Set]",db="[object String]",EA="[object Symbol]",RA="[object Undefined]",Bc="[object WeakMap]",lb="[object ArrayBuffer]",hd="[object DataView]",OA="[object Float32Array]",BA="[object Float64Array]",MA="[object Int8Array]",UA="[object Int16Array]",DA="[object Int32Array]",LA="[object Uint8Array]",NA="[object Uint8ClampedArray]",_A="[object Uint16Array]",HA="[object Uint32Array]",qA=/[\\^$.*+?()[\]{}|]/g,jA=/^\[object .+?Constructor\]$/,WA=/^(?:0|[1-9]\d*)$/,W={};W[OA]=W[BA]=W[MA]=W[UA]=W[DA]=W[LA]=W[NA]=W[_A]=W[HA]=!0;W[md]=W[Oc]=W[lb]=W[rb]=W[hd]=W[ib]=W[nb]=W[sb]=W[pd]=W[ob]=W[Ii]=W[ab]=W[gd]=W[db]=W[Bc]=!1;var ub=typeof global=="object"&&global&&global.Object===Object&&global,GA=typeof self=="object"&&self&&self.Object===Object&&self,ht=ub||GA||Function("return this")(),cb=typeof fs=="object"&&fs&&!fs.nodeType&&fs,Gy=cb&&typeof Fi=="object"&&Fi&&!Fi.nodeType&&Fi,mb=Gy&&Gy.exports===cb,Ac=mb&&ub.process,Vy=function(){try{return Ac&&Ac.binding&&Ac.binding("util")}catch{}}(),zy=Vy&&Vy.isTypedArray;function VA(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 zA(r,e){for(var t=-1,i=e.length,n=r.length;++t<i;)r[n+t]=e[t];return r}function JA(r,e){for(var t=-1,i=r==null?0:r.length;++t<i;)if(e(r[t],t,r))return!0;return!1}function $A(r,e){for(var t=-1,i=Array(r);++t<r;)i[t]=e(t);return i}function KA(r){return function(e){return r(e)}}function XA(r,e){return r.has(e)}function ZA(r,e){return r?.[e]}function QA(r){var e=-1,t=Array(r.size);return r.forEach(function(i,n){t[++e]=[n,i]}),t}function YA(r,e){return function(t){return r(e(t))}}function eE(r){var e=-1,t=Array(r.size);return r.forEach(function(i){t[++e]=i}),t}var tE=Array.prototype,rE=Function.prototype,kd=Object.prototype,Ec=ht["__core-js_shared__"],pb=rE.toString,rt=kd.hasOwnProperty,Jy=function(){var r=/[^.]+$/.exec(Ec&&Ec.keys&&Ec.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),gb=kd.toString,iE=RegExp("^"+pb.call(rt).replace(qA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$y=mb?ht.Buffer:void 0,fd=ht.Symbol,Ky=ht.Uint8Array,hb=kd.propertyIsEnumerable,nE=tE.splice,kr=fd?fd.toStringTag:void 0,Xy=Object.getOwnPropertySymbols,sE=$y?$y.isBuffer:void 0,oE=YA(Object.keys,Object),Mc=Ti(ht,"DataView"),vs=Ti(ht,"Map"),Uc=Ti(ht,"Promise"),Dc=Ti(ht,"Set"),Lc=Ti(ht,"WeakMap"),ys=Ti(Object,"create"),aE=Cr(Mc),dE=Cr(vs),lE=Cr(Uc),uE=Cr(Dc),cE=Cr(Lc),Zy=fd?fd.prototype:void 0,Rc=Zy?Zy.valueOf:void 0;function Sr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function mE(){this.__data__=ys?ys(null):{},this.size=0}function pE(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}function gE(r){var e=this.__data__;if(ys){var t=e[r];return t===_c?void 0:t}return rt.call(e,r)?e[r]:void 0}function hE(r){var e=this.__data__;return ys?e[r]!==void 0:rt.call(e,r)}function fE(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=ys&&e===void 0?_c:e,this}Sr.prototype.clear=mE;Sr.prototype.delete=pE;Sr.prototype.get=gE;Sr.prototype.has=hE;Sr.prototype.set=fE;function ft(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var i=r[e];this.set(i[0],i[1])}}function vE(){this.__data__=[],this.size=0}function yE(r){var e=this.__data__,t=Sd(e,r);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():nE.call(e,t,1),--this.size,!0}function bE(r){var e=this.__data__,t=Sd(e,r);return t<0?void 0:e[t][1]}function kE(r){return Sd(this.__data__,r)>-1}function SE(r,e){var t=this.__data__,i=Sd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}ft.prototype.clear=vE;ft.prototype.delete=yE;ft.prototype.get=bE;ft.prototype.has=kE;ft.prototype.set=SE;function Pr(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 PE(){this.size=0,this.__data__={hash:new Sr,map:new(vs||ft),string:new Sr}}function CE(r){var e=Pd(this,r).delete(r);return this.size-=e?1:0,e}function wE(r){return Pd(this,r).get(r)}function xE(r){return Pd(this,r).has(r)}function IE(r,e){var t=Pd(this,r),i=t.size;return t.set(r,e),this.size+=t.size==i?0:1,this}Pr.prototype.clear=PE;Pr.prototype.delete=CE;Pr.prototype.get=wE;Pr.prototype.has=xE;Pr.prototype.set=IE;function vd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Pr;++e<t;)this.add(r[e])}function FE(r){return this.__data__.set(r,_c),this}function TE(r){return this.__data__.has(r)}vd.prototype.add=vd.prototype.push=FE;vd.prototype.has=TE;function Ut(r){var e=this.__data__=new ft(r);this.size=e.size}function AE(){this.__data__=new ft,this.size=0}function EE(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function RE(r){return this.__data__.get(r)}function OE(r){return this.__data__.has(r)}function BE(r,e){var t=this.__data__;if(t instanceof ft){var i=t.__data__;if(!vs||i.length<xA-1)return i.push([r,e]),this.size=++t.size,this;t=this.__data__=new Pr(i)}return t.set(r,e),this.size=t.size,this}Ut.prototype.clear=AE;Ut.prototype.delete=EE;Ut.prototype.get=RE;Ut.prototype.has=OE;Ut.prototype.set=BE;function ME(r,e){var t=yd(r),i=!t&&KE(r),n=!t&&!i&&Nc(r),o=!t&&!i&&!n&&Pb(r),a=t||i||n||o,c=a?$A(r.length,String):[],p=c.length;for(var g in r)(e||rt.call(r,g))&&!(a&&(g=="length"||n&&(g=="offset"||g=="parent")||o&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||GE(g,p)))&&c.push(g);return c}function Sd(r,e){for(var t=r.length;t--;)if(yb(r[t][0],e))return t;return-1}function UE(r,e,t){var i=e(r);return yd(r)?i:zA(i,t(r))}function ks(r){return r==null?r===void 0?RA:TA:kr&&kr in Object(r)?jE(r):$E(r)}function Qy(r){return bs(r)&&ks(r)==md}function fb(r,e,t,i,n){return r===e?!0:r==null||e==null||!bs(r)&&!bs(e)?r!==r&&e!==e:DE(r,e,t,i,fb,n)}function DE(r,e,t,i,n,o){var a=yd(r),c=yd(e),p=a?Oc:Mt(r),g=c?Oc:Mt(e);p=p==md?Ii:p,g=g==md?Ii:g;var f=p==Ii,m=g==Ii,b=p==g;if(b&&Nc(r)){if(!Nc(e))return!1;a=!0,f=!1}if(b&&!f)return o||(o=new Ut),a||Pb(r)?vb(r,e,t,i,n,o):HE(r,e,p,t,i,n,o);if(!(t&bd)){var v=f&&rt.call(r,"__wrapped__"),P=m&&rt.call(e,"__wrapped__");if(v||P){var C=v?r.value():r,F=P?e.value():e;return o||(o=new Ut),n(C,F,t,i,o)}}return b?(o||(o=new Ut),qE(r,e,t,i,n,o)):!1}function LE(r){if(!Sb(r)||zE(r))return!1;var e=bb(r)?iE:jA;return e.test(Cr(r))}function NE(r){return bs(r)&&kb(r.length)&&!!W[ks(r)]}function _E(r){if(!JE(r))return oE(r);var e=[];for(var t in Object(r))rt.call(r,t)&&t!="constructor"&&e.push(t);return e}function vb(r,e,t,i,n,o){var a=t&bd,c=r.length,p=e.length;if(c!=p&&!(a&&p>c))return!1;var g=o.get(r);if(g&&o.get(e))return g==e;var f=-1,m=!0,b=t&eb?new vd:void 0;for(o.set(r,e),o.set(e,r);++f<c;){var v=r[f],P=e[f];if(i)var C=a?i(P,v,f,e,r,o):i(v,P,f,r,e,o);if(C!==void 0){if(C)continue;m=!1;break}if(b){if(!JA(e,function(F,I){if(!XA(b,I)&&(v===F||n(v,F,t,i,o)))return b.push(I)})){m=!1;break}}else if(!(v===P||n(v,P,t,i,o))){m=!1;break}}return o.delete(r),o.delete(e),m}function HE(r,e,t,i,n,o,a){switch(t){case hd:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case lb:return!(r.byteLength!=e.byteLength||!o(new Ky(r),new Ky(e)));case rb:case ib:case ob:return yb(+r,+e);case nb:return r.name==e.name&&r.message==e.message;case ab:case db:return r==e+"";case pd:var c=QA;case gd:var p=i&bd;if(c||(c=eE),r.size!=e.size&&!p)return!1;var g=a.get(r);if(g)return g==e;i|=eb,a.set(r,e);var f=vb(c(r),c(e),i,n,o,a);return a.delete(r),f;case EA:if(Rc)return Rc.call(r)==Rc.call(e)}return!1}function qE(r,e,t,i,n,o){var a=t&bd,c=Yy(r),p=c.length,g=Yy(e),f=g.length;if(p!=f&&!a)return!1;for(var m=p;m--;){var b=c[m];if(!(a?b in e:rt.call(e,b)))return!1}var v=o.get(r);if(v&&o.get(e))return v==e;var P=!0;o.set(r,e),o.set(e,r);for(var C=a;++m<p;){b=c[m];var F=r[b],I=e[b];if(i)var ge=a?i(I,F,b,e,r,o):i(F,I,b,r,e,o);if(!(ge===void 0?F===I||n(F,I,t,i,o):ge)){P=!1;break}C||(C=b=="constructor")}if(P&&!C){var Dn=r.constructor,oa=e.constructor;Dn!=oa&&"constructor"in r&&"constructor"in e&&!(typeof Dn=="function"&&Dn instanceof Dn&&typeof oa=="function"&&oa instanceof oa)&&(P=!1)}return o.delete(r),o.delete(e),P}function Yy(r){return UE(r,QE,WE)}function Pd(r,e){var t=r.__data__;return VE(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Ti(r,e){var t=ZA(r,e);return LE(t)?t:void 0}function jE(r){var e=rt.call(r,kr),t=r[kr];try{r[kr]=void 0;var i=!0}catch{}var n=gb.call(r);return i&&(e?r[kr]=t:delete r[kr]),n}var WE=Xy?function(r){return r==null?[]:(r=Object(r),VA(Xy(r),function(e){return hb.call(r,e)}))}:YE,Mt=ks;(Mc&&Mt(new Mc(new ArrayBuffer(1)))!=hd||vs&&Mt(new vs)!=pd||Uc&&Mt(Uc.resolve())!=Wy||Dc&&Mt(new Dc)!=gd||Lc&&Mt(new Lc)!=Bc)&&(Mt=function(r){var e=ks(r),t=e==Ii?r.constructor:void 0,i=t?Cr(t):"";if(i)switch(i){case aE:return hd;case dE:return pd;case lE:return Wy;case uE:return gd;case cE:return Bc}return e});function GE(r,e){return e=e??tb,!!e&&(typeof r=="number"||WA.test(r))&&r>-1&&r%1==0&&r<e}function VE(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function zE(r){return!!Jy&&Jy in r}function JE(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||kd;return r===t}function $E(r){return gb.call(r)}function Cr(r){if(r!=null){try{return pb.call(r)}catch{}try{return r+""}catch{}}return""}function yb(r,e){return r===e||r!==r&&e!==e}var KE=Qy(function(){return arguments}())?Qy:function(r){return bs(r)&&rt.call(r,"callee")&&!hb.call(r,"callee")},yd=Array.isArray;function XE(r){return r!=null&&kb(r.length)&&!bb(r)}var Nc=sE||eR;function ZE(r,e){return fb(r,e)}function bb(r){if(!Sb(r))return!1;var e=ks(r);return e==sb||e==FA||e==IA||e==AA}function kb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=tb}function Sb(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function bs(r){return r!=null&&typeof r=="object"}var Pb=zy?KA(zy):NE;function QE(r){return XE(r)?ME(r):_E(r)}function YE(){return[]}function eR(){return!1}Fi.exports=ZE});var lS=h(Nd=>{"use strict";Nd.byteLength=AR;Nd.toByteArray=RR;Nd.fromByteArray=MR;var st=[],_e=[],TR=typeof Uint8Array<"u"?Uint8Array:Array,ym="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Nr=0,aS=ym.length;Nr<aS;++Nr)st[Nr]=ym[Nr],_e[ym.charCodeAt(Nr)]=Nr;var Nr,aS;_e[45]=62;_e[95]=63;function dS(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 AR(r){var e=dS(r),t=e[0],i=e[1];return(t+i)*3/4-i}function ER(r,e,t){return(e+t)*3/4-t}function RR(r){var e,t=dS(r),i=t[0],n=t[1],o=new TR(ER(r,i,n)),a=0,c=n>0?i-4:i,p;for(p=0;p<c;p+=4)e=_e[r.charCodeAt(p)]<<18|_e[r.charCodeAt(p+1)]<<12|_e[r.charCodeAt(p+2)]<<6|_e[r.charCodeAt(p+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return n===2&&(e=_e[r.charCodeAt(p)]<<2|_e[r.charCodeAt(p+1)]>>4,o[a++]=e&255),n===1&&(e=_e[r.charCodeAt(p)]<<10|_e[r.charCodeAt(p+1)]<<4|_e[r.charCodeAt(p+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function OR(r){return st[r>>18&63]+st[r>>12&63]+st[r>>6&63]+st[r&63]}function BR(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(OR(i));return n.join("")}function MR(r){for(var e,t=r.length,i=t%3,n=[],o=16383,a=0,c=t-i;a<c;a+=o)n.push(BR(r,a,a+o>c?c:a+o));return i===1?(e=r[t-1],n.push(st[e>>2]+st[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),n.join("")}});var pq=Ln(Cv(),1);function y(r,e){if(r==null)throw Error(e??"Expected nonnullish value.")}function mr(r,e){if(!r)throw Error(e)}var se;(function(r){r.COMMENT="t1_",r.ACCOUNT="t2_",r.LINK="t3_",r.MESSAGE="t4_",r.SUBREDDIT="t5_",r.AWARD="t6_"})(se||(se={}));function It(r){return r.startsWith(se.COMMENT)}function Xa(r){return r.startsWith(se.ACCOUNT)}function pr(r){return r.startsWith(se.LINK)}function wv(r){return r.startsWith(se.MESSAGE)}function xv(r){return r.startsWith(se.SUBREDDIT)}function Iv(r){return r.startsWith(se.AWARD)}function jF(r){mr(It(r),`Expected comment id to start with ${se.COMMENT}, got ${r}}`)}function WF(r){mr(Xa(r),`Expected account id to start with ${se.ACCOUNT}, got ${r}}`)}function GF(r){mr(pr(r),`Expected link id to start with ${se.LINK}, got ${r}}`)}function VF(r){mr(wv(r),`Expected message id to start with ${se.MESSAGE}, got ${r}}`)}function zF(r){mr(xv(r),`Expected subreddit id to start with ${se.SUBREDDIT}, got ${r}}`)}function JF(r){mr(Iv(r),`Expected award id to start with ${se.AWARD}, got ${r}}`)}function ni(r){return jF(r),r}function oe(r){return WF(r),r}function ye(r){return GF(r),r}function $F(r){return VF(r),r}function ie(r){return zF(r),r}function KF(r){return JF(r),r}function Re(r){if(It(r))return ni(r);if(Xa(r))return oe(r);if(pr(r))return ye(r);if(wv(r))return $F(r);if(xv(r))return ie(r);if(Iv(r))return KF(r);throw new Error(`Expected thing id to start with ${Object.values(se).join(", ")} got ${r}}`)}function ec(r){return It(r)}import*as w from"@devvit/protos";var Za=class{constructor(e){}};var tc=(t=>(t.Installation="installation",t.App="app",t))(tc||{});function gr(r,e=new Set){for(let t of r){if(t.type==="group"){gr(t.fields,e);continue}let i=t.name;if(e.has(i))throw new Error(`Duplicate field name: ${i}`);e.add(i)}XF(r)}function XF(r){for(let e of r)if(e.type==="string"&&e.isSecret&&e.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${e.name}"`}var Ft=Object.freeze({INTERVAL:0,FORM:1,STATE:2,CHANNEL:3});var wM=["3rd-party","activity","add-emoji","add","add-media","add-to-feed","admin","ads","ai","align-center","align-left","align-right","all","ama","appearance","approve","archived","aspect-ratio","aspect-rectangle","attach","audience","audio","author","automod","avatar-style","award","back","backup","ban","best","block","blockchain","bold","boost","bot","bounce","brand-awareness","browse","browser","cake","calendar","camera","campaign","caret-down","caret-left","caret-right","caret-up","chat","chat-group","chat-new","chat-private","checkbox-dismiss","checkbox","checkmark","chrome","clear","client-list","close","closed-captioning","code-block","code-inline","coins-color-old","coins","collapse-left","collapse-right","collectible-expressions","collection","comment","comments","communities","community","confidence","contest","controversial","conversion","copy-clipboard","crop","crosspost","crowd-control","custom-feed","customize","dashboard","day","delete-column","delete","delete-row","devvit","discover","dismiss-all","distinguish","down-arrow","down","download","downvote","downvotes","drag","drugs","duplicate","edit","effect","embed","emoji","end-live-chat","error","expand-left","expand-right","external","feed-video","filter","format","forward","funnel","gif-post","gold","hashtag","heart","help","hide","history","home","hot","ignore-reports","image-post","inbox","info","insert-column-left","insert-column-right","insert-row-above","insert-row-below","internet","invite","italic","join","joined","jump-down","jump-up","karma","keyboard","kick","language","leave","left","link","link-post","list-bulleted","list-numbered","live-chat","live","load","location","lock","logout","loop","macro","mark-read","marketplace","mask","media-gallery","meme","menu","message","mic","mic-mute","mod","mod-mail","mod-mode","mod-mute","mod-overflow","mod-queue","mod-unmute","music","mute","new","night","no-internet","notification","notification-frequent","notification-off","nsfw","nsfw-language","nsfw-violence","official","original","overflow-caret","overflow-horizontal","overflow-vertical","pause","payment","peace","pending-posts","phone","pin","play","poll-post","popular","posts","powerup","predictions","premium","privacy","profile","qa","qr-code","quarantined","quote","r-slash","radar","radio-button","raise-hand","random","ratings-everyone","ratings-mature","ratings-nsfw","ratings-violence","recovery-phrase","refresh","removal-reasons","remove","reply","report","reverse","rich-text","right","rising","rotate","rotate-image","rpan","rules","safari","save","save-view","saved","saved-response","search","self","send","settings","severity","share","share-new","show","side-menu","skipback10","skipforward10","sort-az","sort","sort-price","sort-za","spam","spoiler","sponsored","spreadsheet","star","statistics","status-live","sticker","strikethrough","subtract","superscript","swap-camera","swipe-back","swipe-down","swipe","swipe-up","table","tag","tap","text","text-post","text-size","toggle","tools","top","topic-activism","topic-addictionsupport","topic-advice","topic-animals","topic-anime","topic-art","topic-beauty","topic-business","topic-careers","topic-cars","topic-celebrity","topic-craftsdiy","topic-crypto","topic-culture","topic-diy","topic-entertainment","topic-ethics","topic-family","topic-fashion","topic","topic-fitness","topic-food","topic-funny","topic-gender","topic-health","topic-help","topic-history","topic-hobbies","topic-homegarden","topic-internet","topic-law","topic-learning","topic-lifestyle","topic-marketplace","topic-mature","topic-mensfashion","topic-menshealth","topic-meta","topic-military","topic-movies","topic-music","topic-news","topic-other","topic-outdoors","topic-pets","topic-photography","topic-places","topic-podcasts","topic-politics","topic-programming","topic-reading","topic-religion","topic-science","topic-sexorientation","topic-sports","topic-style","topic-tabletop","topic-technology","topic-television","topic-traumasupport","topic-travel","topic-videogaming","topic-womensfashion","topic-womenshealth","translate","translation-off","trim","u-slash","unban","undo","unheart","unlock","unmod","unpin","unstar","unverified","up-arrow","up","upload","upvote","upvotes","user","user-note","users","vault","verified","video-camera","video-feed","video-post","video-thread","video-transcription","view-card","view-classic","view-compact","view-grid","view-sort","views","volume","wallet","warning","webhook","whale","wiki-ban","wiki","wiki-unban","world","coins-color","powerup-color","powerup-fill-color","share-android","share-ios","video-live-1","video-live-fill-1","video-live","volume-mute","binoculars","caret-updown","planet","telescope"];import{AppSettingsDefinition as mT,GetFieldsResponse as pT}from"@devvit/protos";import{FormField as hr,FormFieldType as Oe}from"@devvit/protos";function mt(r){return r.map(e=>{switch(e.type){case"string":return ZF(e);case"image":return QF(e);case"paragraph":return YF(e);case"number":return eT(e);case"select":return tT(e);case"boolean":return rT(e);case"group":return iT(e);default:throw new Error("Unknown field type.")}})}function ZF(r){return hr.fromPartial({defaultValue:{fieldType:Oe.STRING,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{stringConfig:{placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.STRING,helpText:r.helpText,label:r.label,required:r.required,isSecret:r.isSecret})}function QF(r){return hr.fromPartial({disabled:r.disabled,fieldId:r.name,fieldType:Oe.IMAGE,helpText:r.helpText,label:r.label,required:r.required})}function YF(r){return hr.fromPartial({defaultValue:{fieldType:Oe.PARAGRAPH,stringValue:r.defaultValue},disabled:r.disabled,fieldConfig:{paragraphConfig:{lineHeight:r.lineHeight,placeholder:r.placeholder}},fieldId:r.name,fieldType:Oe.PARAGRAPH,helpText:r.helpText,label:r.label,required:r.required})}function eT(r){return hr.fromPartial({defaultValue:{fieldType:Oe.NUMBER,numberValue:r.defaultValue},disabled:r.disabled,fieldConfig:{numberConfig:{}},fieldId:r.name,fieldType:Oe.NUMBER,helpText:r.helpText,label:r.label,required:r.required})}function tT(r){return hr.fromPartial({defaultValue:{fieldType:Oe.SELECTION,selectionValue:{values:r.defaultValue}},disabled:r.disabled,fieldConfig:{selectionConfig:{choices:r.options,multiSelect:r.multiSelect}},fieldId:r.name,fieldType:Oe.SELECTION,helpText:r.helpText,label:r.label,required:r.required})}function rT(r){return hr.fromPartial({defaultValue:{fieldType:Oe.BOOLEAN,boolValue:r.defaultValue},disabled:r.disabled,fieldId:r.name,fieldType:Oe.BOOLEAN,helpText:r.helpText,label:r.label})}function iT(r){return hr.fromPartial({fieldType:Oe.GROUP,fieldConfig:{groupConfig:{fields:mt(r.fields)}},label:r.label,helpText:r.helpText})}function M(r,e){u.prototype[r]=e}import{ValidateFormResponse as cT}from"@devvit/protos";import{RealtimeSubscriptionStatus as Tv}from"@devvit/protos";var D=Object.freeze({Actor:"devvit-actor",App:"devvit-app",AppUser:"devvit-app-user",AppViewerAuthToken:"devvit-app-viewer-authorization",Caller:"devvit-caller",CallerPortID:"devvit-caller-port-id",Canary:"devvit-canary",Debug:"devvit-debug",GQLHost:"devvit-gql-host",Installation:"devvit-installation",ModPermissions:"devvit-mod-permissions",Post:"devvit-post",PostAuthor:"devvit-post-author",R2Auth:"devvit-sec-authorization",R2Host:"devvit-r2-host",RemoteHostname:"devvit-remote-hostname",SettingsUri:"devvit-sec-settings-uri",StreamID:"devvit-stream-id",Subreddit:"devvit-subreddit",SubredditName:"devvit-subreddit-name",TraceID:"devvit-trace-id",User:"devvit-user",UserAgent:"devvit-user-agent",Version:"devvit-version",Language:"devvit-accept-language",Timezone:"devvit-accept-timezone",AppDependencies:"devvit-app-dependencies",WebviewTemplate:"devvit-webview-template"}),Fv;(function(r){r.Blocks="blocks",r.EmitSnapshots="emitSnapshots",r.EmitState="emitState",r.Realtime="realtime",r.Runtime="runtime",r.Surface="surface",r.UseAsync="useAsync",r.Payments="payments",r.Bootstrap="bootstrap"})(Fv||(Fv={}));function Av(r){function e(t){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=r.metadata[D.App]?.values[0];y(c,"useChannel - app is missing from Context");let p=r.metadata[D.Installation]?.values[0];y(p,"useChannel - installation is missing from Context");async function g(F){let I=o[n].channel;if(o[n].active)if(o[n].connected)await r.realtime.send(I,F);else throw Error(`Failed to send to channel '${I}'; it is active but not yet connected`);else throw Error(`Cannot send a message over inactive channel: ${I}`)}function f(){if(!o[n].active){let F=o[n].channel;o[n].active=!0,r.addRealtimeChannel(F)}}function m(){if(o[n].active){let F=o[n].channel;o[n].active=!1,r.removeRealtimeChannel(F)}}function b(F){return async()=>{let I;switch(F.status){case Tv.REALTIME_SUBSCRIBED:o[n].connected=!0,I=t.onSubscribed?.();break;case Tv.REALTIME_UNSUBSCRIBED:o[n].connected=!1,I=t.onUnsubscribed?.();break;default:I=t.onMessage(F.event?.data?.msg);break}await I}}let v={channel:`${c}:${p}:${t.name}`,active:!1,connected:!1,preventCallback:!1,type:Ft.CHANNEL};n in o?v=o[n]:n in a&&(v=a[n]);let P=r.realtimeEvent;r.isInitialRender?v.active=!1:P&&v.active&&P.event.channel===v.channel&&(v.preventCallback||r.runHook(b(P)),r.rerenderIn(0)),o[n]=v,r.currentHookIndex++;let C=0;return v.active&&v.connected?C=2:v.active&&!v.connected?C=1:!v.active&&v.connected?C=3:!v.active&&!v.connected&&(C=4),{subscribe:f,unsubscribe:m,send:g,status:C}}return e}import{FormFieldType as si}from"@devvit/protos";function rc(r){switch(r.fieldType){case si.STRING:return r.stringValue;case si.IMAGE:return r.stringValue;case si.PARAGRAPH:return r.stringValue;case si.NUMBER:return r.numberValue;case si.BOOLEAN:return r.boolValue;case si.SELECTION:return r.selectionValue?.values??[];default:return}}function Tt(r){return Object.keys(r).reduce((e,t)=>{let i=rc(r[t]);return i!==void 0&&(e[t]=i),e},{})}function Ev(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentKey(),a=r.getCurrentComponentState(),c=r.getPreviousComponentState(),p=`form.hook.${o}.${n}`,g={formKey:p,preventSubmit:!1,type:Ft.FORM};n in a?g=a[n]:n in c&&(g=c[n]),a[n]=g,r.forms.set(p,t);let f=r.formSubmittedEvent;return f&&!g.preventSubmit&&f.formId===p&&r.runHook(async()=>{let m=i(Tt(f.results));m&&m instanceof Promise&&await m,r.rerenderIn(0)}),a[n].preventSubmit=!1,r.currentHookIndex++,p}return e}function Rv(r){function e(t,i){let n=r.currentHookIndex,o=r.getCurrentComponentState(),a=r.getPreviousComponentState(),c=100,p=Math.max(c,i),g={lastRun:void 0,running:!1,preventCallback:!1,type:Ft.INTERVAL};n in o?g=o[n]:n in a&&(g=a[n]);function f(){i<c&&console.error(`useInterval delay must be at least ${c}ms. Your interval of ${i}ms was automatically extended.`);for(let[b,v]of Object.entries(o))if(b!==n.toString()&&v?.type===Ft.INTERVAL&&v?.running)throw new Error("Only one useInterval hook may be running at a time");o[n]={running:!0,lastRun:o[n]?.lastRun??Date.now(),preventCallback:!1,type:Ft.INTERVAL},r.rerenderIn(p)}function m(){o[n].running=!1,o[n].lastRun=void 0,o[n].preventCallback=!1}return r.isEffectRender&&g.running&&(g.preventCallback||(g.lastRun===void 0||g.lastRun+p<Date.now())&&r.runHook(async()=>{let b=t();b&&b instanceof Promise&&await b,g.lastRun=Date.now()}),r.rerenderIn(p)),g.preventCallback=!1,o[n]=g,r.currentHookIndex++,{start:f,stop:m}}return e}function Ov(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 oc={now(){return new Date}};function Bv(r){return`__autocache__${r}`}function Mv(r){return`__lock__${r}`}var sT=300,oT=1e3,Qa=5e3,ic=3,Uv=.1,Dv=1e3,aT=3e4;function Lv(r){if(r.error)throw new Error(r.error);return r.value}var At,Et,Be,oi,$,Nv,_v,Hv,nc,qv,jv,sc,Wv,Ya=class{constructor(e,t,i=oc){l(this,$);l(this,At);l(this,Et,{});l(this,Be);l(this,oi);d(this,At,e),d(this,oi,t),d(this,Be,i)}async cache(e,t){d(this,Et,s(this,oi).__cache=s(this,oi).__cache??{}),S(this,$,Wv).call(this,t);let i=S(this,$,Nv).call(this,t.key);if(i!==void 0)return i;let n=await S(this,$,sc).call(this,t.key),o=await S(this,$,_v).call(this,t,n,e);return Lv(o)}};At=new WeakMap,Et=new WeakMap,Be=new WeakMap,oi=new WeakMap,$=new WeakSet,Nv=function(e){let t=s(this,Et)[e];if(t){let i=s(this,Be).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<ic&&Math.random()<Uv&&t.errorTime+Dv<i;if(t?.expires&&t.expires<i&&t.checkedAt+Dv<i||n){delete s(this,Et)[e];return}else return Lv(t)}},_v=async function(e,t,i){let n=t?.expires,o=n?S(this,$,jv).call(this,n):1;return!t||t?.error&&t.errorCount<ic&&Uv>Math.random()||o>Math.random()?S(this,$,Hv).call(this,e,t,i):t},Hv=async function(e,t,i){let n=Mv(e.key),o=s(this,Be).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,At).set(n,"1",{expiration:a,nx:!0}))return S(this,$,qv).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Be).now();return S(this,$,nc).call(this,p,e.key,e.ttl)}},nc=async function(e,t,i){let n=Math.min(i,oT),o=await S(this,$,sc).call(this,t);if(o)return o;if(s(this,Be).now().getTime()-e.getTime()>=n)throw new Error(`Cache request timed out trying to get data at key: ${t}`);return await new Promise(a=>setTimeout(a,sT)),S(this,$,nc).call(this,e,t,i)},qv=async function(e,t,i,n){let o=s(this,Be).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Be).now().getTime(),t.errorCount++}return s(this,Et)[e]=t,await s(this,At).set(Bv(e),JSON.stringify(t),{expiration:new Date(o+aT)}),t.error&&t.errorCount<ic&&await s(this,At).del(Mv(e)),t},jv=function(e){let t=s(this,Be).now().getTime(),i=e-t;return i<0?1:i<1e3?.1:i<2e3?.01:i<3e3?.001:0},sc=async function(e){let t=await s(this,At).get(Bv(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Be).now().getTime(),s(this,Et)[e]=i,i}},Wv=function(e){e.ttl<Qa&&(console.warn(`Cache TTL cannot be less than ${Qa} milliseconds! Updating ttl value of ${e.ttl} to ${Qa}.`),e.ttl=Qa)};function Gv(r,e,t=oc){let i=new Ya(r,e,t);return i.cache.bind(i)}function Vv(r){new URL(r.slice(0,r.indexOf(",")))}var ai,di,ui,zv,Jv,li=class{constructor(){l(this,ui);l(this,ai,{});l(this,di,{});d(this,ai,u.assets),d(this,di,u.webviewAssets)}getURL(e,t){return typeof e=="string"?S(this,ui,zv).call(this,e,t??{webview:!1}):S(this,ui,Jv).call(this,e,t??{webview:!1})}};ai=new WeakMap,di=new WeakMap,ui=new WeakSet,zv=function(e,t){let i=t.webview?s(this,di)[e]:s(this,ai)[e];if(i)return i;try{return Vv(e),encodeURI(e)}catch{return""}},Jv=function(e,t){let i={},n=[],o=t.webview?s(this,di):s(this,ai);if(o)for(let a of e)if(o[a])i[a]=o[a];else try{Vv(a),i[a]=encodeURI(a)}catch{n.push(a)}else n=e;if(n.length>0)throw new Error(`The following assets were missing from the assets list: ${n.join(", ")}`);return i};var Rt,ci=class{constructor(e){l(this,Rt);d(this,Rt,e)}async get(e){let{messages:t}=await u.kvStorePlugin.Get({keys:[e]},s(this,Rt));try{if(t[e])return JSON.parse(t[e])}catch{return}}async put(e,t){let i={};i[e]=JSON.stringify(t),await u.kvStorePlugin.Put({messages:i},s(this,Rt))}async delete(e){await u.kvStorePlugin.Del({keys:[e]},s(this,Rt))}async list(){let{keys:e}=await u.kvStorePlugin.List({filter:"*"},s(this,Rt));return e}};Rt=new WeakMap;var ss,mi=class{constructor(e){l(this,ss);d(this,ss,e)}async upload(e){let t=await u.mediaPlugin.Upload(e,s(this,ss));if(!t.mediaId)throw new Error("unable to get mediaId via uploads");return Promise.resolve({mediaId:t.mediaId,mediaUrl:t.mediaUrl})}};ss=new WeakMap;var os,pi=class{constructor(e){l(this,os);d(this,os,e)}async add(e){await u.modLogPlugin.Add(e,s(this,os))}};os=new WeakMap;var as,gi=class{constructor(e){l(this,as);d(this,as,e)}async send(e,t){await u.realtimePlugin.Send({channel:e,data:{msg:t}},s(this,as))}};as=new WeakMap;var k,ds,hi=class{constructor(e){l(this,k);l(this,ds);d(this,k,e),d(this,ds,new td(e))}get modMail(){return s(this,ds)}getSubredditById(e){return be.getById(Re(e),s(this,k))}getSubredditInfoById(e){return Kv(e,s(this,k))}getSubredditByName(e){return be.getByName(e,s(this,k))}getSubredditInfoByName(e){return Xv(e,s(this,k))}addSubredditRemovalReason(e,t){return be.addRemovalReason(e,t.title,t.message,s(this,k))}getSubredditRemovalReasons(e){return be.getRemovalReasons(e,s(this,k))}getCurrentSubreddit(){return be.getFromMetadata(s(this,k))}getPostById(e){return z.getById(Re(e),s(this,k))}submitPost(e){return z.submit(e,s(this,k))}crosspost(e){return z.crosspost(e,s(this,k))}getUserById(e){return x.getById(Re(e),s(this,k))}getUserByUsername(e){return x.getByUsername(e,s(this,k))}getCurrentUser(){return x.getFromMetadata(D.User,s(this,k))}getAppUser(){return x.getFromMetadata(D.AppUser,s(this,k))}getSnoovatarUrl(e){return x.getSnoovatarUrl(e,s(this,k))}getCommentById(e){return te.getById(Re(e),s(this,k))}getComments(e){return te.getComments(e,s(this,k))}getCommentsByUser(e){return te.getCommentsByUser(e,s(this,k))}submitComment(e){return te.submit({...e,id:Re(e.id)},s(this,k))}getControversialPosts(e){return z.getControversialPosts(e,s(this,k))}getTopPosts(e){return z.getTopPosts(e,s(this,k))}getHotPosts(e){return z.getHotPosts(e,s(this,k))}getNewPosts(e){return z.getNewPosts(e,s(this,k))}getRisingPosts(e){return z.getRisingPosts(e,s(this,k))}getPostsByUser(e){return z.getPostsByUser(e,s(this,k))}getCommentsAndPostsByUser(e){return x.getOverview(e,s(this,k))}getModerationLog(e){return ed(e,s(this,k))}getApprovedUsers(e){return x.getSubredditUsersByType({type:"contributors",...e},s(this,k))}approveUser(e,t){return x.createRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}removeUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"contributor"},s(this,k))}getWikiContributors(e){return x.getSubredditUsersByType({type:"wikicontributors",...e},s(this,k))}addWikiContributor(e,t){return x.createRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}removeWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikicontributor"},s(this,k))}getBannedUsers(e){return x.getSubredditUsersByType({type:"banned",...e},s(this,k))}banUser(e){return x.createRelationship({username:e.username,subredditName:e.subredditName,type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration,banContext:e.context},s(this,k))}unbanUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"banned"},s(this,k))}getBannedWikiContributors(e){return x.getSubredditUsersByType({type:"wikibanned",...e},s(this,k))}banWikiContributor(e){return x.createRelationship({...e,type:"wikibanned"},s(this,k))}unbanWikiContributor(e,t){return x.removeRelationship({username:e,subredditName:t,type:"wikibanned"},s(this,k))}getModerators(e){return x.getSubredditUsersByType({type:"moderators",...e},s(this,k))}inviteModerator(e){return x.createRelationship({type:"moderator_invite",subredditName:e.subredditName,username:e.username,permissions:e.permissions??[]},s(this,k))}revokeModeratorInvite(e,t){return x.removeRelationship({username:e,subredditName:t,type:"moderator_invite"},s(this,k))}removeModerator(e,t){return x.removeRelationship({type:"moderator",subredditName:t,username:e},s(this,k))}setModeratorPermissions(e,t,i){return x.setModeratorPermissions(e,t,i,s(this,k))}getMutedUsers(e){return x.getSubredditUsersByType({type:"muted",...e},s(this,k))}muteUser(e){return x.createRelationship({...e,type:"muted"},s(this,k))}unmuteUser(e,t){return x.removeRelationship({username:e,subredditName:t,type:"muted"},s(this,k))}getModNotes(e){return Me.get(e,s(this,k))}deleteModNote(e){return Me.delete(e,s(this,k))}addModNote(e){let t={...e,redditId:e.redditId?Re(e.redditId):void 0};return Me.add(t,s(this,k))}addRemovalNote(e){return Me.addRemovalNote(e,s(this,k))}async sendPrivateMessage(e){return fr.send(e,s(this,k))}async sendPrivateMessageAsSubreddit(e){return fr.sendAsSubreddit(e,s(this,k))}async approve(e){if(It(e))return te.approve(e,s(this,k));if(pr(e))return z.approve(e,s(this,k));throw new Error("id must start with either t1_ or t3_")}async remove(e,t){if(It(e))return te.remove(e,t,s(this,k));if(pr(e))return z.remove(e,t,s(this,k));throw new Error("id must start with either t1_ or t3_")}async getPostFlairTemplates(e){return ue.getPostFlairTemplates(e,s(this,k))}async getUserFlairTemplates(e){return ue.getUserFlairTemplates(e,s(this,k))}async createPostFlairTemplate(e){return ue.createPostFlairTemplate(e,s(this,k))}async createUserFlairTemplate(e){return ue.createUserFlairTemplate(e,s(this,k))}async editFlairTemplate(e){return ue.editFlairTemplate(e,s(this,k))}async deleteFlairTemplate(e,t){return ue.deleteFlairTemplate(e,t,s(this,k))}async setUserFlair(e){return Ue.setUserFlair(e,s(this,k))}async removeUserFlair(e,t){return Ue.removeUserFlair(e,t,s(this,k))}async setPostFlair(e){return Ue.setPostFlair(e,s(this,k))}async removePostFlair(e,t){return Ue.removePostFlair(e,ye(t),s(this,k))}async getWidgets(e){return ae.getWidgets(e,s(this,k))}async deleteWidget(e,t){return ae.delete(e,t,s(this,k))}async addWidget(e){return ae.add(e,s(this,k))}async reorderWidgets(e,t){return ae.reorder(e,t,s(this,k))}async getWikiPage(e,t){return ke.getPage(e,t,s(this,k))}async getWikiPages(e){return ke.getPages(e,s(this,k))}async createWikiPage(e){return ke.createPage(e,s(this,k))}async updateWikiPage(e){return ke.updatePage(e,s(this,k))}getWikiPageRevisions(e){return ke.getPageRevisions(e,s(this,k))}async revertWikiPage(e,t,i){return ke.revertPage(e,t,i,s(this,k))}async getWikiPageSettings(e,t){return ke.getPageSettings(e,t,s(this,k))}async updateWikiPageSettings(e){return ke.updatePageSettings(e,s(this,k))}async addEditorToWikiPage(e,t,i){return ke.addEditor(e,t,i,s(this,k))}async removeEditorFromWikiPage(e,t,i){return ke.removeEditor(e,t,i,s(this,k))}getMessages(e){return 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 be.aboutLocation({...e,location:"modqueue"},s(this,k))}getReports(e){return be.aboutLocation({...e,location:"reports"},s(this,k))}getSpam(e){return be.aboutLocation({...e,location:"spam"},s(this,k))}getUnmoderated(e){return be.aboutLocation({...e,location:"unmoderated"},s(this,k))}getEdited(e){return be.aboutLocation({...e,location:"edited"},s(this,k))}getVaultByAddress(e){return Yv(e,s(this,k))}getVaultByUserId(e){return ey(Re(e),s(this,k))}getSubredditLeaderboard(e){return Zv(e,s(this,k))}getSubredditStyles(e){return Qv(e,s(this,k))}};k=new WeakMap,ds=new WeakMap;import{RedisKeyScope as ac}from"@devvit/protos";function rd(r){return r&&typeof r=="object"&&"message"in r&&r.message!==void 0&&typeof r.message=="string"?r.message.includes("redis: nil"):!1}var R,O,B,dc=class{constructor(e,t,i){l(this,R);l(this,O);l(this,B);d(this,R,e),d(this,O,t),d(this,B,i)}async get(e){return await s(this,R).Get({key:e,transactionId:s(this,O)},s(this,B)),this}async multi(){await s(this,R).Multi(s(this,O),s(this,B))}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),await s(this,R).Set({key:e,value:t,nx:i?.nx===!0,xx:i?.xx===!0,expiration:n||0,transactionId:s(this,O)},s(this,B)),this}async del(...e){return await s(this,R).Del({keys:e,transactionId:s(this,O)},s(this,B)),this}async type(e){return await s(this,R).Type({key:e,transactionId:s(this,O)},s(this,B)),this}async exec(){let e=await s(this,R).Exec(s(this,O),s(this,B)),t=[];for(let i of e.response)i.members?t.push(i.members):i.nil!==void 0?t.push(null):i.num!==void 0?t.push(i.num):i.values!==void 0?t.push(i.values.values):i.str!==void 0&&t.push(i.str);return t}async discard(){await s(this,R).Discard(s(this,O),s(this,B))}async watch(...e){return await s(this,R).Watch({keys:e,transactionId:s(this,O)},s(this,B)),this}async unwatch(){return await s(this,R).Unwatch(s(this,O),s(this,B)),this}async getRange(e,t,i){return await s(this,R).GetRange({key:e,start:t,end:i,transactionId:s(this,O)},s(this,B)),this}async setRange(e,t,i){return await s(this,R).SetRange({key:e,offset:t,value:i,transactionId:s(this,O)},s(this,B)),this}async strlen(e){return this.strLen(e)}async strLen(e){return await s(this,R).Strlen({key:e,transactionId:s(this,O)},s(this,B)),this}async mget(e){return this.mGet(e)}async mGet(e){return await s(this,R).MGet({keys:e,transactionId:s(this,O)},s(this,B)),this}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));return await s(this,R).MSet({kv:t,transactionId:s(this,O)},s(this,B)),this}async incrBy(e,t){return await s(this,R).IncrBy({key:e,value:t,transactionId:s(this,O)},s(this,B)),this}async expire(e,t){return await s(this,R).Expire({key:e,seconds:t,transactionId:s(this,O)},s(this,B)),this}async expireTime(e){return await s(this,R).ExpireTime({key:e,transactionId:s(this,O)},s(this,B)),this}async zAdd(e,...t){return await s(this,R).ZAdd({key:e,members:t,transactionId:s(this,O)},s(this,B)),this}async zScore(e,t){return await s(this,R).ZScore({key:{key:e,transactionId:s(this,O)},member:t},s(this,B)),this}async zRank(e,t){return await s(this,R).ZRank({key:{key:e,transactionId:s(this,O)},member:t},s(this,B)),this}async zIncrBy(e,t,i){return await s(this,R).ZIncrBy({key:e,member:t,value:i,transactionId:s(this,O)},s(this,B)),this}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,O)};return await s(this,R).ZScan(o,s(this,B)),this}async zCard(e){return await s(this,R).ZCard({key:e,transactionId:s(this,O)},s(this,B)),this}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"&&(o.byScore=!0),await s(this,R).ZRange({key:{key:e,transactionId:s(this,O)},start:t+"",stop:i+"",...o},s(this,B)),this}async zRem(e,t){return await s(this,R).ZRem({key:{key:e,transactionId:s(this,O)},members:t},s(this,B)),this}async zRemRangeByLex(e,t,i){return await s(this,R).ZRemRangeByLex({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,B)),this}async zRemRangeByRank(e,t,i){return await s(this,R).ZRemRangeByRank({key:{key:e,transactionId:s(this,O)},start:t,stop:i},s(this,B)),this}async zRemRangeByScore(e,t,i){return await s(this,R).ZRemRangeByScore({key:{key:e,transactionId:s(this,O)},min:t,max:i},s(this,B)),this}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){return await s(this,R).HGetAll({key:e,transactionId:s(this,O)},s(this,B)),this}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){return await s(this,R).HGet({key:e,field:t,transactionId:s(this,O)},s(this,B)),this}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([n,o])=>({field:n,value:o}));return await s(this,R).HSet({key:e,fv:i,transactionId:s(this,O)},s(this,B)),this}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return await s(this,R).HIncrBy({key:e,field:t,value:i,transactionId:s(this,O)},s(this,B)),this}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return await s(this,R).HDel({key:e,fields:t,transactionId:s(this,O)},s(this,B)),this}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,transactionId:s(this,O)};return await s(this,R).HScan(o,s(this,B)),this}async hkeys(e){return this.hKeys(e)}async hKeys(e){return await s(this,R).HKeys({key:e,transactionId:s(this,O)},s(this,B)),this}async hlen(e){return this.hLen(e)}async hLen(e){return await s(this,R).HLen({key:e,transactionId:s(this,O)},s(this,B)),this}};R=new WeakMap,O=new WeakMap,B=new WeakMap;var U,fi,lc=class lc{constructor(e,t=void 0,i=ac.INSTALLATION){l(this,U);l(this,fi);d(this,U,e),d(this,fi,t),this.scope=i,this.global=i===ac.INSTALLATION?new lc(s(this,U),s(this,fi),ac.GLOBAL):this}get storage(){return s(this,fi)||u.redisPlugin}async watch(...e){let t=await this.storage.Watch({keys:e},s(this,U));return new dc(this.storage,t,s(this,U))}async get(e){try{let t=await this.storage.Get({key:e,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return t!==null?t.value??void 0:t}catch(t){if(rd(t))return;throw t}}async set(e,t,i){let n;return i?.expiration&&(n=Math.floor((i.expiration.getTime()-Date.now())/1e3),n<1&&(n=1)),(await this.storage.Set({key:e,value:t,nx:i?.nx===!0&&!i.xx,xx:i?.xx===!0&&!i.nx,expiration:n||0,scope:this.scope},s(this,U))).value}async del(...e){await this.storage.Del({keys:e,scope:this.scope},s(this,U))}async incrBy(e,t){return(await this.storage.IncrBy({key:e,value:t,scope:this.scope},s(this,U))).value}async getRange(e,t,i){let n=await this.storage.GetRange({key:e,start:t,end:i,scope:this.scope},s(this,U));return n!==null?n.value:n}async setRange(e,t,i){return(await this.storage.SetRange({key:e,offset:t,value:i,scope:this.scope},s(this,U))).value}async strlen(e){return this.strLen(e)}async strLen(e){return(await this.storage.Strlen({key:e,scope:this.scope},s(this,U))).value}async expire(e,t){await this.storage.Expire({key:e,seconds:t,scope:this.scope},s(this,U))}async expireTime(e){return(await this.storage.ExpireTime({key:e,scope:this.scope},s(this,U))).value}async zAdd(e,...t){return(await this.storage.ZAdd({key:e,members:t,scope:this.scope},s(this,U))).value}async zRange(e,t,i,n){let o={rev:!1,byLex:!1,byScore:!1,offset:0,count:1e3};return n?.reverse&&(o.rev=n.reverse),n?.by==="lex"?o.byLex=!0:n?.by==="score"?o.byScore=!0:(o.offset=0,o.count=0),(await this.storage.ZRange({key:{key:e},start:t+"",stop:i+"",...o,scope:this.scope},s(this,U))).members}async zRem(e,t){return(await this.storage.ZRem({key:{key:e},members:t,scope:this.scope},s(this,U))).value}async zRemRangeByLex(e,t,i){return(await this.storage.ZRemRangeByLex({key:{key:e},min:t,max:i,scope:this.scope},s(this,U))).value}async zRemRangeByRank(e,t,i){return(await this.storage.ZRemRangeByRank({key:{key:e},start:t,stop:i,scope:this.scope},s(this,U))).value}async zRemRangeByScore(e,t,i){return(await this.storage.ZRemRangeByScore({key:{key:e},min:t,max:i,scope:this.scope},s(this,U))).value}async zScore(e,t){try{let i=await this.storage.ZScore({key:{key:e},member:t,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(rd(i))return;throw i}}async zRank(e,t){try{let i=await this.storage.ZRank({key:{key:e},member:t,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value:i}catch(i){if(rd(i))return;throw i}}async zIncrBy(e,t,i){let n=await this.storage.ZIncrBy({key:e,member:t,value:i,scope:this.scope},s(this,U));return n!==null?n.value:n}async mget(e){return this.mGet(e)}async mGet(e){let t=await this.storage.MGet({keys:e,scope:this.scope},s(this,U));return t!==null?t.values.map(i=>i||null):t}async mset(e){return this.mSet(e)}async mSet(e){let t=Object.entries(e).map(([i,n])=>({key:i,value:n}));await this.storage.MSet({kv:t,scope:this.scope},s(this,U))}async zCard(e){let t=await this.storage.ZCard({key:e,scope:this.scope},s(this,U));return t!==null?t.value:t}async zScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.ZScan(o,s(this,U))}async type(e){let t=await this.storage.Type({key:e,scope:this.scope},s(this,U));return t!==null?t.value:t}async hget(e,t){return this.hGet(e,t)}async hGet(e,t){try{let i=await this.storage.HGet({key:e,field:t,scope:this.scope},{...s(this,U),"throw-redis-nil":{values:["true"]}});return i!==null?i.value??void 0:i}catch(i){if(rd(i))return;throw i}}async hset(e,t){return this.hSet(e,t)}async hSet(e,t){let i=Object.entries(t).map(([o,a])=>({field:o,value:a}));return(await this.storage.HSet({key:e,fv:i,scope:this.scope},s(this,U))).value}async hgetall(e){return this.hGetAll(e)}async hGetAll(e){let t=await this.storage.HGetAll({key:e,scope:this.scope},s(this,U));return t!==null?t.fieldValues:t}async hdel(e,t){return this.hDel(e,t)}async hDel(e,t){return(await this.storage.HDel({key:e,fields:t,scope:this.scope},s(this,U))).value}async hscan(e,t,i,n){return this.hScan(e,t,i,n)}async hScan(e,t,i,n){let o={key:e,cursor:t,pattern:i,count:n,scope:this.scope};return await this.storage.HScan(o,s(this,U))}async hkeys(e){return this.hKeys(e)}async hKeys(e){let t=await this.storage.HKeys({key:e,scope:this.scope},s(this,U));return t!==null?t.keys:t}async hincrby(e,t,i){return this.hIncrBy(e,t,i)}async hIncrBy(e,t,i){return(await this.storage.HIncrBy({key:e,field:t,value:i,scope:this.scope},s(this,U))).value}async hlen(e){return this.hLen(e)}async hLen(e){return(await this.storage.HLen({key:e,scope:this.scope})).value}};U=new WeakMap,fi=new WeakMap;var vi=lc;var vr,yi=class{constructor(e){l(this,vr);d(this,vr,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,vr))).id}async cancelJob(e){await u.schedulerPlugin.Cancel({id:e},s(this,vr))}async listJobs(){return(await u.schedulerPlugin.List({after:new Date(0),before:new Date(Date.now()+31536e7)},s(this,vr))).actions.map(t=>(y(t.request?.action,"Scheduled job is malformed"),"when"in t.request&&t.request.when!=null?{id:t.id,name:t.request.action.type,runAt:t.request.when,data:t.request.action.data}:{id:t.id,name:t.request.action.type,cron:t.request.cron??"",data:t.request.action}))}};vr=new WeakMap;var ls,bi=class{constructor(e){l(this,ls);d(this,ls,e)}async get(e){return(await this.getAll())[e]}async getAll(){let t=await u.settingsPlugin.GetSettings({},s(this,ls));if(!t.installationSettings)throw new Error("Could not get installation settings");if(!t.appSettings)throw new Error("Could not get app settings");return{...ty(t.installationSettings.settings,u.installationSettings),...ty(t.appSettings.settings,u.appSettings)}}};ls=new WeakMap;function ty(r,e){let t=Object.keys(r).reduce((i,n)=>(i[n]=rc(r[n]),i),{});return e&&ry(t,e),t}function ry(r,e){for(let t of e)t.type==="group"?ry(r,t.fields):!(t.name in r)&&"defaultValue"in t&&(r[t.name]=t.defaultValue)}import{EffectType as uc,Form as dT,ToastAppearance as iy}from"@devvit/protos";var yr,ki,id=class{constructor(e){l(this,yr,[]);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=dT.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});gr(n.fields),o.fields=mt(n.fields),s(this,yr).push({type:uc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?iy.SUCCESS:iy.NEUTRAL}:t={text:e},s(this,yr).push({type:uc.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,yr).push({type:uc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}get __effects(){return s(this,yr)}};yr=new WeakMap,ki=new WeakMap;function De({metadata:r,ui:e,hooks:t,reconciler:i}){let n=new pi(r),o=new ci(r),a=new vi(r),c=Gv(a,i?i.state:{}),p=new hi(r),g=new yi(r),f=new bi(r),m=e?new id(i):void 0,b=new mi(r),v=new li,P=new gi(r),C=t&&i?Ov(i):void 0,F=t&&i?Rv(i):void 0,I=t&&i?Ev(i):void 0,ge=t&&i?Av(i):void 0;return{modLog:n,kvStore:o,redis:a,reddit:p,scheduler:g,settings:f,media:b,assets:v,realtime:P,get useForm(){return I??(()=>{throw new Error("useForm() is unavailable")})},get cache(){return c??(()=>{throw new Error("cache() is unavailable")})},get useState(){return C??(()=>{throw new Error("useState() is unavailable")})},get useInterval(){return F??(()=>{throw new Error("useInterval() is unavailable")})},get useChannel(){return ge??(()=>{throw new Error("useChannel() is unavailable")})},get ui(){if(!m)throw new Error("ui client is not available");return m}}}var ny={name:"@devvit/public-api",version:"0.11.2-dev",license:"BSD-3-Clause",repository:{type:"git",url:"https://developers.reddit.com/"},type:"module",exports:{".":"./dist/index.js","./package.json":"./package.json","./*":"./dist/*"},main:"./dist/index.js",files:["dist/**"],scripts:{build:"yarn build:icon-types && yarn build:semantic-colors && tsc && cp -af devvit.tsconfig.json dist/ && yarn build:types && yarn build:min && yarn build:unmin","build:icon-types":"make-icons src/types/icons.ts","build:min":"esbuild --bundle --sourcemap=linked --target=es2020 --format=esm --metafile=dist/meta.min.json --outfile=dist/public-api.min.js --external:@devvit/protos --minify src/index.ts","build:semantic-colors":"node scripts/make-semantic-colors.js","build:types":"api-extractor run && sed -ne '/declare global {/,$ p' src/devvit/Devvit.ts >> dist/public-api.d.ts","build:unmin":"esbuild --bundle --sourcemap=inline --target=es2020 --format=iife --metafile=dist/meta.json --outfile=dist/public-api.iife.js --global-name=devvitPublicAPI src/index.ts",clean:"rm -rf .turbo api-extractor coverage dist src/devvit/internals/semanticColors.ts src/types/icons.ts || :",clobber:"yarn clean && rm -rf node_modules",dev:"tsc -w","dev:build":"chokidar ./src --command 'yarn build' --ignore './src/types/icons.ts' --ignore './src/devvit/internals/semanticColors.ts'",lint:"redlint .","lint:fix":"yarn lint --fix",prepublishOnly:"publish-package-json",test:"yarn test:unit && yarn test:types && yarn test:size","test:size":"filesize","test:types":"tsc --noEmit","test:unit":"vitest run","test:unit-with-coverage":"vitest run --coverage"},types:"./dist/index.d.ts",dependencies:{"@devvit/protos":"0.11.2-dev","@devvit/shared-types":"0.11.2-dev","base64-js":"1.5.1","clone-deep":"4.0.1","core-js":"3.27.2","lodash.isequal":"4.5.0"},devDependencies:{"@ampproject/filesize":"4.3.0","@devvit/repo-tools":"0.11.2-dev","@devvit/tsconfig":"0.11.2-dev","@microsoft/api-extractor":"7.41.0","@reddit/faceplate-ui":"18.0.1","@types/clone-deep":"4.0.1","@types/core-js":"2.5.6","@types/lodash.isequal":"4.5.6","@vitest/coverage-c8":"0.32.0","chokidar-cli":"3.0.0",esbuild:"0.23.0",eslint:"9.11.1",typescript:"5.3.2",vitest:"1.6.0"},publishConfig:{directory:"dist"},filesize:{"dist/public-api.min.js":{gzip:"78 KB",none:"256 KB"}},source:"./src/index.ts"};function ce(r,e,t){let i=r[D.Subreddit]?.values[0];y(i,"subreddit is missing from Context");let n=r[D.SubredditName]?.values[0],o=r[D.AppUser]?.values[0],a=r[D.App]?.values[0],c=r[D.Version]?.values[0],p=r[D.User]?.values[0],g=uT(r);return{get appAccountId(){return y(o,"appAccountId is missing from Context"),o},subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,appName:a,appVersion:c,debug:g,toJSON(){return{appAccountId:o,appName:a,appVersion:c,subredditId:i,subredditName:n,userId:p,postId:e,commentId:t,debug:g}}}}function uT(r){let e={blocks:void 0,emitSnapshots:void 0,emitState:void 0,realtime:void 0,runtime:void 0,surface:void 0,useAsync:void 0,payments:void 0,bootstrap:void 0},t={};for(let n in e)t[n.toLowerCase()]=n;let i={};for(let n of(r[D.Debug]?.values??[]).join().split(",")){let[o,a]=n.split("=");o&&(o=o.trim(),a=a?.trim(),o.toLowerCase()in t&&(o=t[o.toLowerCase()]),i[o]??(i[o]=a||"true"))}return r[D.Debug]&&console.info(`[api] @devvit/public-api v${ny.version} ${Object.entries(i).map(([n,o])=>`${n}=${o}`).join(" ")}`),{...i,metadata:r}}function sy(r){return r.flatMap(e=>e.type==="group"?sy(e.fields):e)}async function nd(r,e,t){if(!e)throw new Error("Settings were not defined.");let i={success:!0,errors:{}},n=Tt(r.fieldValues),o=sy(e);return await Promise.all(o.map(async a=>{let c=a.name;if(c&&a.onValidate){let p=n[c],g=a.onValidate,f=Object.assign(De({metadata:t}),ce(t)),m=await g({value:p,isEditing:r.editing},f);m&&(i.success=!1,i.errors[c]=m)}})),cT.fromJSON(i)}async function gT(){if(!u.appSettings)throw new Error("App settings were not defined.");return pT.fromJSON({fields:{fields:mt(u.appSettings)}})}async function hT(r,e){return nd(r,u.appSettings,e)}function oy(r){r.provides(mT),M("GetAppSettingsFields",gT),M("ValidateAppForm",hT)}import{CustomPostDefinition as PT,RenderPostResponse as CT}from"@devvit/protos";import{BlockRenderEventType as wc,EffectType as Sy}from"@devvit/protos";function Si(r){return r.__effects}function ay(){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 Cc,BlockAvatarBackground as vy,BlockAvatarFacing as yy,BlockAvatarSize as Ot,BlockBorderWidth as dd,BlockButtonAppearance as Bt,BlockButtonSize as hc,BlockGap as ld,BlockHorizontalAlignment as fc,BlockIconSize as ud,BlockImageResizeMode as us,BlockPadding as cs,BlockRadius as ms,BlockSpacerShape as vc,BlockSpacerSize as cd,BlockStackDirection as yc,BlockTextOutline as bc,BlockTextOverflow as kc,BlockTextSize as Ci,BlockTextStyle as Sc,BlockTextWeight as by,BlockType as tt,BlockVerticalAlignment as Pc}from"@devvit/protos";var cc={"alienblue-100":"#DCE2FB","alienblue-200":"#B8C5FC","alienblue-25":"#F7F8FD","alienblue-300":"#90A9FD","alienblue-400":"#648EFC","alienblue-50":"#EEF0FB","alienblue-500":"#1870F4","alienblue-600":"#115BCA","alienblue-700":"#0A449B","alienblue-75":"#E6E9FB","alienblue-800":"#0A2F6C","alienblue-900":"#0A1A3F","alienblue-950":"#07102B","berrypurple-100":"#F3DAFB","berrypurple-200":"#EAB3FD","berrypurple-25":"#FBF6FD","berrypurple-300":"#DE8BFF","berrypurple-400":"#CF5FFF","berrypurple-50":"#F8EDFC","berrypurple-500":"#BC0EFF","berrypurple-600":"#9B00D4","berrypurple-700":"#7600A3","berrypurple-75":"#F6E4FB","berrypurple-800":"#520472","berrypurple-900":"#300643","berrypurple-950":"#20042A",black:"#000000","black-opacity-0":"#00000000","black-opacity-10":"#00000019","black-opacity-15":"#00000026","black-opacity-20":"#00000033","black-opacity-25":"#0000003F","black-opacity-33":"#00000054","black-opacity-5":"#0000000C","black-opacity-50":"#0000007F","black-opacity-60":"#00000099","black-opacity-67":"#000000AA","black-opacity-80":"#000000CC","black-opacity-90":"#000000E5","brown-100":"#F1DFCF","brown-200":"#E9BE95","brown-25":"#FBF7F4","brown-300":"#DC9D5D","brown-400":"#BA854E","brown-50":"#F7EFE9","brown-500":"#9A6D3F","brown-600":"#7B5631","brown-700":"#5D4023","brown-75":"#F4E7DC","brown-800":"#3F2C19","brown-900":"#221A11","brown-950":"#15100A","coolgray-100":"#DBE4E9","coolgray-150":"#C9D7DE","coolgray-200":"#B7CAD4","coolgray-25":"#F6F8F9","coolgray-250":"#A4BDCA","coolgray-300":"#97AFBC","coolgray-350":"#8BA2AD","coolgray-400":"#7F949F","coolgray-450":"#748791","coolgray-50":"#EEF1F3","coolgray-500":"#667780","coolgray-525":"#576F76","coolgray-550":"#5C6C74","coolgray-600":"#536168","coolgray-650":"#48545B","coolgray-700":"#3D494E","coolgray-75":"#E5EBEE","coolgray-750":"#333D42","coolgray-800":"#2A3236","coolgray-850":"#21272A","coolgray-900":"#181C1F","coolgray-950":"#0E1113","global-black":{light:"#000000",dark:"#000000"},"global-brand-orangered":{light:"#FF4500",dark:"#FF4500"},"global-white":{light:"#FFFFFF",dark:"#FFFFFF"},"kiwigreen-100":"#A8F5A0","kiwigreen-200":"#58E15B","kiwigreen-25":"#EBFDE7","kiwigreen-300":"#00C61C","kiwigreen-400":"#01A816","kiwigreen-50":"#DDF8D7","kiwigreen-500":"#008A10","kiwigreen-600":"#016E0B","kiwigreen-700":"#005306","kiwigreen-75":"#CAF5C2","kiwigreen-800":"#033902","kiwigreen-900":"#0D2005","kiwigreen-950":"#081404","lightblue-100":"#CAE7FB","lightblue-200":"#87D0FD","lightblue-25":"#F3F9FD","lightblue-300":"#02B9FB","lightblue-400":"#029DD5","lightblue-50":"#E6F3FC","lightblue-500":"#007FAE","lightblue-600":"#01668D","lightblue-700":"#014D6B","lightblue-75":"#D9EDFB","lightblue-800":"#03354B","lightblue-900":"#051E2B","lightblue-950":"#04131A","lime-100":"#B7F28E","lime-200":"#90DA58","lime-25":"#EEFDDC","lime-300":"#6DBF01","lime-400":"#5BA200","lime-50":"#E0F8C8","lime-500":"#4A8500","lime-600":"#3A6A00","lime-700":"#2A5000","lime-75":"#CEF5AD","lime-800":"#1E3702","lime-900":"#151E05","lime-950":"#0D1304","mintgreen-100":"#9BF5D9","mintgreen-200":"#00E2B7","mintgreen-25":"#E7FDF5","mintgreen-300":"#00C29D","mintgreen-400":"#01A484","mintgreen-50":"#D7F8EC","mintgreen-500":"#01876D","mintgreen-600":"#006C56","mintgreen-700":"#015140","mintgreen-75":"#C0F5E3","mintgreen-800":"#00382B","mintgreen-900":"#032019","mintgreen-950":"#03140F","orangered-100":"#FCDBCF","orangered-200":"#FDB498","orangered-25":"#FDF6F4","orangered-300":"#FF895D","orangered-400":"#FF4500","orangered-50":"#FCEEE8","orangered-500":"#D93900","orangered-600":"#AE2C00","orangered-700":"#842100","orangered-75":"#FBE5DC","orangered-800":"#591B02","orangered-900":"#2F1405","orangered-950":"#1C0D04","periwinkle-100":"#E6DFFB","periwinkle-200":"#CDBEFD","periwinkle-25":"#F9F7FD","periwinkle-300":"#B29FFF","periwinkle-400":"#9580FF","periwinkle-50":"#F2EFFC","periwinkle-500":"#6A5CFF","periwinkle-600":"#523DFF","periwinkle-700":"#4001EA","periwinkle-75":"#ECE7FB","periwinkle-800":"#250AA6","periwinkle-900":"#160E5B","periwinkle-950":"#0C083F","poopbrown-100":"#FEEEDD","poopbrown-200":"#F6DDC3","poopbrown-300":"#EECCAA","poopbrown-400":"#CAA075","poopbrown-50":"#FEF7EE","poopbrown-500":"#9A6D3F","poopbrown-600":"#6E4924","poopbrown-700":"#54371A","poopbrown-800":"#3B2510","poopbrown-900":"#29190A","poopbrown-950":"#110B04","puregray-100":"#F2F2F2","puregray-150":"#EBEBEB","puregray-200":"#E4E4E4","puregray-250":"#DDDDDD","puregray-300":"#D6D6D6","puregray-350":"#C3C3C3","puregray-400":"#ACACAC","puregray-450":"#919191","puregray-50":"#F8F8F8","puregray-500":"#767676","puregray-550":"#5C5C5C","puregray-600":"#434343","puregray-650":"#393939","puregray-700":"#303030","puregray-750":"#272727","puregray-800":"#1E1E1E","puregray-850":"#181818","puregray-900":"#131313","puregray-950":"#080808","red-100":"#FBDBD4","red-200":"#FDB3A4","red-25":"#FDF6F5","red-300":"#FF8773","red-400":"#FF4F40","red-50":"#FCEEEA","red-500":"#EB001F","red-600":"#BC0117","red-700":"#90000F","red-75":"#FBE4DF","red-800":"#650405","red-900":"#340F05","red-950":"#1F0B04","sakurapink-100":"#FBD9EB","sakurapink-200":"#FDAEDA","sakurapink-25":"#FDF6F9","sakurapink-300":"#FF7ECA","sakurapink-400":"#FF38BB","sakurapink-50":"#FCEDF4","sakurapink-500":"#DE019F","sakurapink-600":"#B2007F","sakurapink-700":"#880060","sakurapink-75":"#FBE3EF","sakurapink-800":"#5F0443","sakurapink-900":"#380626","sakurapink-950":"#250419",transparent:"transparent",white:"#ffffff","white-opacity-0":"#FFFFFF00","white-opacity-10":"#FFFFFF19","white-opacity-15":"#FFFFFF26","white-opacity-20":"#FFFFFF33","white-opacity-25":"#FFFFFF3F","white-opacity-5":"#FFFFFF0C","white-opacity-50":"#FFFFFF7F","yellow-100":"#FFE284","yellow-200":"#FFBF0B","yellow-25":"#FFF9E0","yellow-300":"#D8A100","yellow-400":"#B78800","yellow-50":"#FFF3C0","yellow-500":"#977000","yellow-600":"#785800","yellow-700":"#5B4200","yellow-75":"#FFEAA2","yellow-800":"#3F2D00","yellow-900":"#231A03","yellow-950":"#161003","yelloworange-100":"#FCDCC8","yelloworange-200":"#FDB586","yelloworange-25":"#FDF7F3","yelloworange-300":"#FF8A35","yelloworange-400":"#E46C00","yelloworange-50":"#FCEEE6","yelloworange-500":"#BD5800","yelloworange-600":"#974500","yelloworange-700":"#733300","yelloworange-75":"#FBE5D7","yelloworange-800":"#4E2402","yelloworange-900":"#2A1705","yelloworange-950":"#1A0E04","action-downvote":{light:"#6A5CFF",dark:"#6A5CFF"},"action-upvote":{light:"#D93900",dark:"#D93900"},"ai-background-weaker":{light:"#E7FDF5",dark:"#00382B"},"ai-plain":{light:"#006C56",dark:"#01A484"},"ai-plain-hover":{light:"#015140",dark:"#00C29D"},"alert-caution":{light:"#977000",dark:"#977000"},"avatar-gradient":{light:"",dark:""},"brand-background":{light:"#D93900",dark:"#D93900"},"brand-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"brand-gradient-active":{light:"",dark:""},"brand-gradient-active-highlight":{light:"",dark:""},"brand-gradient-default":{light:"",dark:""},"brand-gradient-default-highlight":{light:"",dark:""},"brand-gradient-hover":{light:"",dark:""},"brand-gradient-hover-highlight":{light:"",dark:""},"brand-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"category-live":{light:"#D93900",dark:"#D93900"},"category-nsfw":{light:"#DE019F",dark:"#DE019F"},"category-spoiler":{light:"#131313",dark:"#F2F2F2"},"caution-background":{light:"#FFBF0B",dark:"#D8A100"},"caution-background-hover":{light:"#D8A100",dark:"#FFBF0B"},"caution-onBackground":{light:"#000000",dark:"#000000"},"caution-plain":{light:"#785800",dark:"#FFBF0B"},"caution-plain-hover":{light:"#5B4200",dark:"#FFE284"},"danger-background":{light:"#EB001F",dark:"#BC0117"},"danger-background-disabled":{light:"#FDB3A4",dark:"#340F05"},"danger-background-hover":{light:"#BC0117",dark:"#EB001F"},"danger-background-weaker":{light:"#FBDBD4",dark:"#650405"},"danger-content":{light:"#BC0117",dark:"#FF4F40"},"danger-content-default":{light:"#ffffff",dark:"#ffffff"},"danger-content-hover":{light:"#90000F",dark:"#FF8773"},"danger-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"danger-plain":{light:"#BC0117",dark:"#FF8773"},"danger-plain-hover":{light:"#90000F",dark:"#FDB3A4"},"downvote-background":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-background-disabled":{light:"#6a5cff4d",dark:"#6a5cff4d"},"downvote-background-hover":{light:"#523DFF",dark:"#523DFF"},"downvote-content":{light:"#523DFF",dark:"#9580FF"},"downvote-content-weak":{light:"#6A5CFF",dark:"#6A5CFF"},"downvote-disabled":{light:"#523DFF4c",dark:"#9580FF4c"},"downvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"downvote-onStrongScrim":{light:"#B29FFF",dark:"#B29FFF"},"downvote-onStrongScrim-disabled":{light:"#b29fff4d",dark:"#b29fff4d"},"downvote-onStrongScrim-weaker":{light:"#9580FF",dark:"#9580FF"},"downvote-plain":{light:"#523DFF",dark:"#9580FF"},"downvote-plain-disabled":{light:"#523dff4d",dark:"#9580ff4d"},"downvote-plain-weaker":{light:"#6A5CFF",dark:"#6A5CFF"},"elevation-large1":{light:"#0000003F",dark:"#0000007F"},"elevation-large2":{light:"#00000026",dark:"#00000033"},"elevation-medium1":{light:"#0000003F",dark:"#0000007F"},"elevation-medium2":{light:"#00000019",dark:"#00000033"},"elevation-small":{light:"#00000026",dark:"#00000054"},"elevation-xsmall":{light:"#0000003F",dark:"#000000AA"},favorite:{light:"#977000",dark:"#B78800"},"global-admin":{light:"#D93900",dark:"#D93900"},"global-alienblue":{light:"#1870F4",dark:"#1870F4"},"global-darkblue":{light:"#2A3236",dark:"#2A3236"},"global-focus":{light:"#029DD5",dark:"#007FAE"},"global-gold":{light:"#B78800",dark:"#D8A100"},"global-moderator":{light:"#008A10",dark:"#008A10"},"global-nsfw":{light:"#DE019F",dark:"#DE019F"},"global-offline":{light:"#667780",dark:"#667780"},"global-online":{light:"#00C61C",dark:"#00C61C"},"global-orangered":{light:"#FF4500",dark:"#FF4500"},"global-stars":{light:"#977000",dark:"#D8A100"},"gradient-media":{light:"",dark:""},"gradient-media-strong":{light:"",dark:""},"identity-admin":{light:"#D93900",dark:"#D93900"},"identity-coins":{light:"#B78800",dark:"#B78800"},"identity-moderator":{light:"#008A10",dark:"#008A10"},"identity-self":{light:"#01876D",dark:"#01876D"},"interactive-background-disabled":{light:"#0000000C",dark:"#FFFFFF0C"},"interactive-content-disabled":{light:"#0000003F",dark:"#FFFFFF3F"},"interactive-focused":{light:"#007FAE",dark:"#007FAE"},"interactive-pressed":{light:"#00000026",dark:"#FFFFFF26"},"inverted-interactive-background-disabled":{light:"#FFFFFF0C",dark:"#0000000C"},"inverted-interactive-content-disabled":{light:"#FFFFFF3F",dark:"#0000003F"},"inverted-interactive-pressed":{light:"#FFFFFF26",dark:"#00000026"},"inverted-neutral-background":{light:"#0E1113",dark:"#FFFFFF"},"inverted-neutral-background-hover":{light:"#181C1F",dark:"#F6F8F9"},"inverted-neutral-border":{light:"#FFFFFF33",dark:"#00000033"},"inverted-neutral-content":{light:"#B7CAD4",dark:"#333D42"},"inverted-neutral-content-strong":{light:"#EEF1F3",dark:"#181C1F"},"inverted-secondary-background":{light:"#2A3236",dark:"#E5EBEE"},"inverted-secondary-background-hover":{light:"#333D42",dark:"#DBE4E9"},"inverted-secondary-background-selected":{light:"#3D494E",dark:"#C9D7DE"},"inverted-secondary-onBackground":{light:"#FFFFFF",dark:"#000000"},"inverted-secondary-plain":{light:"#DBE4E9",dark:"#181C1F"},"inverted-secondary-plain-hover":{light:"#FFFFFF",dark:"#000000"},"media-background":{light:"#00000099",dark:"#00000099"},"media-background-hover":{light:"#000000cc",dark:"#000000cc"},"media-background-selected":{light:"#000000cc",dark:"#000000cc"},"media-border-selected":{light:"#FFFFFF",dark:"#FFFFFF"},"media-border-weak":{light:"#FFFFFF19",dark:"#FFFFFF19"},"media-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"media-onBackground-disabled":{light:"#FFFFFF3F",dark:"#FFFFFF3F"},"media-onBackground-weak":{light:"#E5EBEE",dark:"#E5EBEE"},"media-onbackground":{light:"#ffffff",dark:"#ffffff"},"media-onbackground-disabled":{light:"#ffffff3f",dark:"#ffffff3f"},"media-onbackground-weak":{light:"#B7CAD4",dark:"#B7CAD4"},"neutral-background":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-container":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-container-hover":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong":{light:"#EEF1F3",dark:"#21272A"},"neutral-background-container-strong-hover":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-gilded":{light:"#FFF9E0",dark:"#181C1F"},"neutral-background-gilded-hover":{light:"#FFF3C0",dark:"#21272A"},"neutral-background-hover":{light:"#F6F8F9",dark:"#181C1F"},"neutral-background-medium":{light:"#F8F8F8",dark:"#131313"},"neutral-background-pinned":{light:"#FFFFFF",dark:"#0E1113"},"neutral-background-selected":{light:"#E5EBEE",dark:"#2A3236"},"neutral-background-strong":{light:"#FFFFFF",dark:"#181C1F"},"neutral-background-strong-hover":{light:"#F6F8F9",dark:"#21272A"},"neutral-background-weak":{light:"#F6F8F9",dark:"#000000"},"neutral-background-weak-hover":{light:"#EEF1F3",dark:"#0E1113"},"neutral-border":{light:"#00000033",dark:"#FFFFFF33"},"neutral-border-medium":{light:"#0000007F",dark:"#FFFFFF7F"},"neutral-border-strong":{light:"#181C1F",dark:"#F6F8F9"},"neutral-border-weak":{light:"#00000019",dark:"#FFFFFF19"},"neutral-content":{light:"#333D42",dark:"#B7CAD4"},"neutral-content-disabled":{light:"#D6D6D6",dark:"#303030"},"neutral-content-strong":{light:"#181C1F",dark:"#EEF1F3"},"neutral-content-weak":{light:"#5C6C74",dark:"#8BA2AD"},offline:{light:"#767676",dark:"#767676"},online:{light:"#01A816",dark:"#01A816"},"opacity-08":{light:"#13131314",dark:"#13131314"},"opacity-50":{light:"#0000007f",dark:"#F2F2F27f"},"opacity-highlight":{light:"",dark:""},pizzaRed:{light:"#ef5350",dark:"#c62828"},primary:{light:"#115BCA",dark:"#648EFC"},"primary-background":{light:"#0A449B",dark:"#115BCA"},"primary-background-hover":{light:"#0A2F6C",dark:"#1870F4"},"primary-background-selected":{light:"#0A1A3F",dark:"#648EFC"},"primary-border":{light:"#0A449B",dark:"#648EFC"},"primary-border-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-hover":{light:"#0A449B",dark:"#90A9FD"},"primary-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"primary-onBackground-selected":{light:"#FFFFFF",dark:"#000000"},"primary-plain":{light:"#0A449B",dark:"#648EFC"},"primary-plain-hover":{light:"#0A2F6C",dark:"#90A9FD"},"primary-plain-visited":{light:"#7600A3",dark:"#CF5FFF"},"primary-visited":{light:"#9B00D4",dark:"#CF5FFF"},scrim:{light:"#00000099",dark:"#00000099"},"scrim-background":{light:"#00000099",dark:"#00000099"},"scrim-background-strong":{light:"#000000CC",dark:"#000000CC"},"scrim-gradient":{light:"",dark:""},"scrim-strong":{light:"#000000cc",dark:"#000000cc"},secondary:{light:"#21272A",dark:"#DBE4E9"},"secondary-background":{light:"#E5EBEE",dark:"#2A3236"},"secondary-background-hover":{light:"#DBE4E9",dark:"#333D42"},"secondary-background-selected":{light:"#C9D7DE",dark:"#3D494E"},"secondary-hover":{light:"#000000",dark:"#ffffff"},"secondary-onBackground":{light:"#000000",dark:"#FFFFFF"},"secondary-plain":{light:"#181C1F",dark:"#DBE4E9"},"secondary-plain-hover":{light:"#000000",dark:"#FFFFFF"},"secondary-plain-weak":{light:"#5C6C74",dark:"#8BA2AD"},"secondary-weak":{light:"#576F76",dark:"#748791"},"success-background":{light:"#008A10",dark:"#016E0B"},"success-background-hover":{light:"#016E0B",dark:"#008A10"},"success-content":{light:"#016E0B",dark:"#01A816"},"success-hover":{light:"#005306",dark:"#00C61C"},"success-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"success-plain":{light:"#016E0B",dark:"#00C61C"},"success-plain-hover":{light:"#005306",dark:"#58E15B"},"tone-1":{light:"#131313",dark:"#F2F2F2"},"tone-2":{light:"#434343",dark:"#ACACAC"},"tone-3":{light:"#ACACAC",dark:"#434343"},"tone-4":{light:"#E4E4E4",dark:"#303030"},"tone-5":{light:"#F2F2F2",dark:"#1E1E1E"},"tone-6":{light:"#F8F8F8",dark:"#131313"},"tone-7":{light:"#ffffff",dark:"#080808"},"transparent-background-hover":{light:"#74879119",dark:"#66778019"},"ui-canvas":{light:"#F2F2F2",dark:"#080808"},"ui-modalbackground":{light:"#FFFFFF",dark:"#181C1F"},"upvote-background":{light:"#D93900",dark:"#D93900"},"upvote-background-disabled":{light:"#d939004d",dark:"#d939004d"},"upvote-background-hover":{light:"#AE2C00",dark:"#AE2C00"},"upvote-content":{light:"#AE2C00",dark:"#FF4500"},"upvote-content-weak":{light:"#FF4500",dark:"#FF4500"},"upvote-disabled":{light:"#AE2C004c",dark:"#FF45004c"},"upvote-onBackground":{light:"#FFFFFF",dark:"#FFFFFF"},"upvote-onStrongScrim":{light:"#FF895D",dark:"#FF895D"},"upvote-onStrongScrim-disabled":{light:"#ff895d4d",dark:"#ff895d4d"},"upvote-onStrongScrim-weaker":{light:"#FF4500",dark:"#FF4500"},"upvote-plain":{light:"#AE2C00",dark:"#FF895D"},"upvote-plain-disabled":{light:"#ae2c004d",dark:"#ff895d4d"},"upvote-plain-weaker":{light:"#FF4500",dark:"#FF4500"},"warning-background":{light:"#B78800",dark:"#B78800"},"warning-background-hover":{light:"#977000",dark:"#D8A100"},"warning-content":{light:"#785800",dark:"#B78800"},"warning-content-hover":{light:"#5B4200",dark:"#D8A100"},"warning-onBackground":{light:"#000000",dark:"#000000"}};var dy={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"},ly=r=>!!r.match(/^(#[0-9a-fA-F]{3,8}).*/),uy=r=>r in cc,mc=r=>r in dy,cy=r=>!!r.match(/^rgba?\(.*/),my=r=>!!r.match(/^hsla?\(.*/),py=(r,e="light")=>{if(mc(r))return sd(r);let i=cc[r];return typeof i=="string"?i:i[e]},sd=r=>dy[r]??r,gy=r=>{let[e,t,i,n]=r.replace(/^rgba?\(|\s+|\)$/g,"").split(",");if(!e||!t||!i)return r;let a=[...[e,t,i].map(p=>parseFloat(p))];if(n){let p=parseFloat(n),g=Math.round(p*255);a.push(g)}return`#${a.map(p=>p.toString(16).padStart(2,"0")).join("")}`};import{BlockStackDirection as od}from"@devvit/protos";var pc={stackParentLayout:{hasHeight:!0,hasWidth:!0,direction:od.UNRECOGNIZED,alignment:void 0}};function fy(r,e,t){if(!e)return{hasHeight:!1,hasWidth:!1};let{growDirection:i,stretchDirection:n}=fT(r?.grow,e.direction,e.alignment),o=t?.height?.value?.value||t?.height?.min?.value||hy(2,i,n,e.hasHeight),a=t?.width?.value?.value||t?.width?.min?.value||hy(1,i,n,e.hasWidth);return{hasHeight:!!o,hasWidth:!!a}}function hy(r,e,t,i){return e===r&&i||t===r&&i}function fT(r,e,t){let i=e===od.STACK_VERTICAL||e===od.UNRECOGNIZED,n=e===od.STACK_HORIZONTAL,o=0;n&&r?o=1:i&&r&&(o=2);let a=t===void 0||t.horizontal===void 0,c=t===void 0||t.vertical===void 0,p=n?!!c:i?!!a:!1,g=0;return n&&p?g=2:i&&p&&(g=1),{growDirection:o,stretchDirection:g}}import{BlockSizeUnit as br,BlockStackDirection as ad}from"@devvit/protos";function Pi(r){if(r==null)return;if(typeof r=="number")return{value:r,unit:br.SIZE_UNIT_PERCENT};let e=r.match(/^(\d+(?:\.\d+)?)(px|%)?$/);if(e==null)return;let t=br.SIZE_UNIT_PERCENT;return e.at(2)==="px"&&(t=br.SIZE_UNIT_PIXELS),{value:Number.parseFloat(e[1]),unit:t}}function vT(r,e){return(r.width?.value?.unit===br.SIZE_UNIT_PERCENT||r.width?.min?.unit===br.SIZE_UNIT_PERCENT)&&(e.direction===ad.STACK_HORIZONTAL||e.direction===ad.STACK_DEPTH)&&(e.hasWidth||(r.width=void 0)),(r.height?.value?.unit===br.SIZE_UNIT_PERCENT||r.height?.min?.unit===br.SIZE_UNIT_PERCENT)&&(e.direction===ad.STACK_VERTICAL||e.direction===ad.STACK_DEPTH)&&(e.hasHeight||(r.height=void 0)),r}function gc(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=vT(n,e.stackParentLayout)),n}}}var ky="data-",yT=new Set(["onPress","onMessage"]),bT=new Map([["onPress",Cc.ACTION_CLICK],["onMessage",Cc.ACTION_WEBVIEW]]),ps,wi=class{constructor(e=()=>{}){l(this,ps);d(this,ps,e)}createBlocksElementOrThrow({type:e,props:t,children:i}){let n=this.createBlocksElement({type:e,props:t,children:i},pc);if(!n)throw new Error(`Could not create block of type ${e}`);return n}createBlocksElement({type:e,props:t,children:i},n){switch(e){case"blocks":return this.makeRoot(t,...i);case"hstack":return this.makeHStack(t,n,...i);case"vstack":return this.makeVStack(t,n,...i);case"zstack":return this.makeZStack(t,n,...i);case"text":return this.makeText(t,n,...i);case"button":return this.makeButton(t,n,...i);case"image":return this.makeImage(t,n);case"spacer":return this.makeSpacer(t,n);case"icon":return this.makeIcon(t,n);case"avatar":return this.makeAvatar(t,n);case"webview":return this.makeWebView(t,n);case"__fragment":throw new Error("root fragment is not supported - use 'blocks' instead")}}makeRootHeight(e){switch(e){case"regular":return 320;case"tall":return 512}}makeBlockPadding(e){switch(e){case"none":return cs.PADDING_NONE;case"xsmall":return cs.PADDING_XSMALL;case"small":return cs.PADDING_SMALL;case"medium":return cs.PADDING_MEDIUM;case"large":return cs.PADDING_LARGE}}makeBlockRadius(e){switch(e){case"none":return ms.RADIUS_NONE;case"small":return ms.RADIUS_SMALL;case"medium":return ms.RADIUS_MEDIUM;case"large":return ms.RADIUS_LARGE;case"full":return ms.RADIUS_FULL}}makeBlockGap(e){switch(e){case"none":return ld.GAP_NONE;case"small":return ld.GAP_SMALL;case"medium":return ld.GAP_MEDIUM;case"large":return ld.GAP_LARGE}}makeBlockAlignment(e){if(e===void 0)return;let t,i;if(e.includes("top")?t=Pc.ALIGN_TOP:e.includes("middle")?t=Pc.ALIGN_MIDDLE:e.includes("bottom")&&(t=Pc.ALIGN_BOTTOM),e.includes("start")?i=fc.ALIGN_START:e.includes("center")?i=fc.ALIGN_CENTER:e.includes("end")&&(i=fc.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=dd.BORDER_WIDTH_NONE;break;case"thin":o=dd.BORDER_WIDTH_THIN;break;case"thick":o=dd.BORDER_WIDTH_THICK;break;default:o=dd.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 Ci.TEXT_SIZE_XSMALL;case"small":return Ci.TEXT_SIZE_SMALL;case"medium":return Ci.TEXT_SIZE_MEDIUM;case"large":return Ci.TEXT_SIZE_LARGE;case"xlarge":return Ci.TEXT_SIZE_XLARGE;case"xxlarge":return Ci.TEXT_SIZE_XXLARGE}}makeBlockTextStyle(e){switch(e){case"body":return Sc.TEXT_STYLE_BODY;case"metadata":return Sc.TEXT_STYLE_METADATA;case"heading":return Sc.TEXT_STYLE_HEADING}}makeBlockTextOutline(e){switch(e){case"none":return bc.TEXT_OUTLINE_NONE;case"thin":return bc.TEXT_OUTLINE_THIN;case"thick":return bc.TEXT_OUTLINE_THICK}}makeBlockTextWeight(e){switch(e){case"regular":return by.TEXT_WEIGHT_REGULAR;case"bold":return by.TEXT_WEIGHT_BOLD}}makeBlockTextOverflow(e){switch(e){case"clip":return kc.TEXT_OVERFLOW_CLIP;case"ellipsis":return kc.TEXT_OVERFLOW_ELLIPSE}return kc.TEXT_OVERFLOW_ELLIPSE}makeBlockButtonAppearance(e){switch(e){case"secondary":return Bt.BUTTON_APPEARANCE_SECONDARY;case"primary":return Bt.BUTTON_APPEARANCE_PRIMARY;case"plain":return Bt.BUTTON_APPEARANCE_PLAIN;case"bordered":return Bt.BUTTON_APPEARANCE_BORDERED;case"media":return Bt.BUTTON_APPEARANCE_MEDIA;case"destructive":return Bt.BUTTON_APPEARANCE_DESTRUCTIVE;case"caution":return Bt.BUTTON_APPEARANCE_CAUTION;case"success":return Bt.BUTTON_APPEARANCE_SUCCESS}}makeBlockButtonSize(e){switch(e){case"small":return hc.BUTTON_SIZE_SMALL;case"medium":return hc.BUTTON_SIZE_MEDIUM;case"large":return hc.BUTTON_SIZE_LARGE}}makeBlockImageResizeMode(e){switch(e){case"none":return us.IMAGE_RESIZE_NONE;case"fit":return us.IMAGE_RESIZE_FIT;case"fill":return us.IMAGE_RESIZE_FILL;case"cover":return us.IMAGE_RESIZE_COVER;case"scale-down":return us.IMAGE_RESIZE_SCALE_DOWN}}makeBlockSpacerSize(e){switch(e){case"xsmall":return cd.SPACER_XSMALL;case"small":return cd.SPACER_SMALL;case"medium":return cd.SPACER_MEDIUM;case"large":return cd.SPACER_LARGE}}makeBlockSpacerShape(e){switch(e){case"invisible":return vc.SPACER_INVISIBLE;case"thin":return vc.SPACER_THIN;case"square":return vc.SPACER_SQUARE}}makeBlockIconSize(e){switch(e){case"xsmall":return ud.ICON_SIZE_XSMALL;case"small":return ud.ICON_SIZE_SMALL;case"medium":return ud.ICON_SIZE_MEDIUM;case"large":return ud.ICON_SIZE_LARGE}}makeBlockAvatarSize(e){switch(e){case"xxsmall":return Ot.AVATAR_SIZE_XXSMALL;case"xsmall":return Ot.AVATAR_SIZE_XSMALL;case"small":return Ot.AVATAR_SIZE_SMALL;case"medium":return Ot.AVATAR_SIZE_MEDIUM;case"large":return Ot.AVATAR_SIZE_LARGE;case"xlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxlarge":return Ot.AVATAR_SIZE_XXLARGE;case"xxxlarge":return Ot.AVATAR_SIZE_XXXLARGE}}makeBlockAvatarFacing(e){switch(e){case"left":return yy.AVATAR_FACING_LEFT;case"right":return yy.AVATAR_FACING_RIGHT}}makeBlockAvatarBackground(e){switch(e){case"dark":return vy.AVATAR_BG_DARK;case"light":return vy.AVATAR_BG_LIGHT}}getDataSet(e){return Object.keys(e).filter(t=>t.startsWith(ky)).reduce((t,i)=>(t[i.substring(ky.length)]=e[i],t),{})}makeActions(e,t){let i=[],n=this.getDataSet(t);return yT.forEach(o=>{if(o in t){let a=t[o];i.push({type:bT.get(o)??Cc.UNRECOGNIZED,id:a.toString(),data:n})}}),i}blockColorToHex(e,t="light"){if(e)return e=e.toLowerCase(),ly(e)?e:uy(e)?py(e,t):mc(e)?sd(e):cy(e)?gy(e):my(e)?e:(console.warn(`Could not parse color: ${e}.`),sd("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,ps).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,pc))}wrapRoot(e,t){return this.makeBlock(tt.BLOCK_ROOT,{},{},{rootConfig:{children:t,height:this.makeRootHeight(u.customPostType?.height??e?.height??"regular")}})}makeStackBlock(e,t,i,n){let o=this.getThemedColors(t?.backgroundColor,t?.lightBackgroundColor,t?.darkBackgroundColor),a=this.makeBlockAlignment(t?.alignment),c=gc(t,i),p=fy(t,i.stackParentLayout,c);return this.makeBlock(tt.BLOCK_STACK,t,i,{stackConfig:{alignment:a,backgroundColor:o?.light,backgroundColors:o,border:this.makeBlockBorder(t?.border,t?.borderColor,t?.lightBorderColor,t?.darkBorderColor),children:this.childrenToBlocks(n,{stackParentLayout:{...p,direction:e,alignment:a}}),cornerRadius:this.makeBlockRadius(t?.cornerRadius),direction:e,gap:this.makeBlockGap(t?.gap),padding:this.makeBlockPadding(t?.padding),reverse:t?.reverse}})}makeHStack(e,t,...i){return this.makeStackBlock(yc.STACK_HORIZONTAL,e,t,i)}makeVStack(e,t,...i){return this.makeStackBlock(yc.STACK_VERTICAL,e,t,i)}makeZStack(e,t,...i){return this.makeStackBlock(yc.STACK_DEPTH,e,t,i)}makeText(e,t,...i){let n=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return this.makeBlock(tt.BLOCK_TEXT,e,t,{textConfig:{alignment:this.makeBlockAlignment(e?.alignment),color:n?.light,colors:n,outline:this.makeBlockTextOutline(e?.outline),size:this.makeBlockTextSize(e?.size),style:this.makeBlockTextStyle(e?.style),text:this.childrenToString(i),weight:this.makeBlockTextWeight(e?.weight),selectable:e?.selectable,wrap:e?.wrap,overflow:this.makeBlockTextOverflow(e?.overflow)}})}makeButton(e,t,...i){let n=this.getThemedColors(e?.textColor,e?.lightTextColor,e?.darkTextColor);return this.makeBlock(tt.BLOCK_BUTTON,e,t,{buttonConfig:{buttonAppearance:this.makeBlockButtonAppearance(e?.appearance),icon:e?.icon,buttonSize:this.makeBlockButtonSize(e?.size),text:this.childrenToString(i),textColor:n?.light,textColors:n,disabled:e?.disabled}})}makeImage(e,t){return e&&this.makeBlock(tt.BLOCK_IMAGE,e,t,{imageConfig:{description:e?.description,resizeMode:this.makeBlockImageResizeMode(e.resizeMode),url:this.resolveAssetUrl(e.url),width:this.parsePixels(e.imageWidth),height:this.parsePixels(e.imageHeight)}})}makeSpacer(e,t){return this.makeBlock(tt.BLOCK_SPACER,e,t,{spacerConfig:{size:this.makeBlockSpacerSize(e?.size),shape:this.makeBlockSpacerShape(e?.shape)}})}makeIcon(e,t){let i=this.getThemedColors(e?.color,e?.lightColor,e?.darkColor);return e&&this.makeBlock(tt.BLOCK_ICON,e,t,{iconConfig:{icon:e.name,color:i?.light,colors:i,size:this.makeBlockIconSize(e.size)}})}makeAvatar(e,t){return e&&this.makeBlock(tt.BLOCK_AVATAR,e,t,{avatarConfig:{thingId:e.thingId,size:this.makeBlockAvatarSize(e.size),facing:this.makeBlockAvatarFacing(e.facing),background:this.makeBlockAvatarBackground(e.background)}})}makeWebView(e,t){return e&&this.makeBlock(tt.BLOCK_WEBVIEW,e,t,{webviewConfig:{url:this.resolveAssetUrl(e.url,{webview:!0}),state:e.state}})}makeBlock(e,t,i,n){return{type:e,sizes:gc(t,i),config:n,actions:(t&&this.makeActions(e,t))??[],id:t?.id,key:t?.key}}ensureRootBlock(e){let t;if(e.type===tt.BLOCK_ROOT?(e.config?.rootConfig&&u.customPostType?.height&&(e.config.rootConfig.height=this.makeRootHeight(u.customPostType?.height)),t=e):t=this.wrapRoot(void 0,[e]),!t)throw new Error("Could not create root block");return t}};ps=new WeakMap;function Py(r){if(typeof r=="string")throw new Error("Root element cannot be a string")}var Cy=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+=Cy(i);return e+=`</${r.type}>`,e};function kT(r){return" ".repeat(r)}function ST(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+=kT(t),n!==0&&(e+="<"),e+=o,n!==i.length-1&&(e+=`>
|
2
|
-
`),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var Le,wy,gs,xc,hs,pt=class{constructor(e,t,i,n,o){l(this,Le);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new wi(()=>this.assets);this.effects=[];l(this,hs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=De({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,Le,gs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(Py(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,Le,wy).call(this)}async buildBlocksUI(){let e=S(this,Le,gs).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 Py(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(ST(Cy(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=ay(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let b=n.children[m];b!=null&&c.push(await this.processBlock(b,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),g=S(this,Le,xc).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:g}}if(typeof n.type=="function"){let c=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(c),this.renderState[c]||(this.renderState[c]={});let p=n.children.flatMap(m=>m),g={...S(this,Le,gs).call(this),...n.props,children:p},f;for(;f===void 0;)try{f=await n.type(g,S(this,Le,gs).call(this))}catch(m){if(m instanceof Promise)f=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof f=="object")return this.processBlock(f,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===wc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===wc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===wc.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,hs)||(d(this,hs,!0),this.effects.push({type:Sy.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:Sy.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}:{}}}};Le=new WeakSet,wy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},gs=function(){let e={...ce(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[D.Timezone]?.values[0],locale:this.metadata[D.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},xc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,Le,xc).call(this,i.children)):t.push(i);return t},hs=new WeakMap;async function wT(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 CT.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function xy(r){r.provides(PT),M("RenderPost",wT)}import{GetFieldsResponse as xT,InstallationSettingsDefinition as IT}from"@devvit/protos";async function FT(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return xT.fromJSON({fields:{fields:mt(u.installationSettings)}})}async function TT(r,e){return nd(r,u.installationSettings,e)}function Iy(r){r.provides(IT),M("GetSettingsFields",FT),M("ValidateForm",TT)}import{ContextActionDefinition as AT,ContextActionList as ET,ContextActionResponse as RT}from"@devvit/protos";var Fy=r=>`menuItem.${r}`;function Ic(r){return u.menuItems.find((e,t)=>Fy(t)===r)}async function OT(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:Fy(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 ET.fromJSON({actions:i})}async function BT(r,e){let t=Ic(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;y(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(De({ui:!0,metadata:e}),ce(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),RT.fromJSON({effects:Si(p.ui)})}function Ty(r){r.provides(AT),M("GetActions",OT),M("OnAction",BT)}function gt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as MT}from"@devvit/protos";async function UT(r,e){let t=r.type,i=u.scheduledJobHandlers.get(t);if(!i)throw new Error(`Job ${t} not found`);let n={name:t,data:r.data},o=Object.assign(De({metadata:e}),ce(e));await i(n,o)}function Ay(r){r.provides(MT),M("HandleScheduledAction",UT)}import{HandlerResult as DT,OnAppInstallDefinition as LT,OnAppUpgradeDefinition as NT,OnAutomoderatorFilterCommentDefinition as _T,OnAutomoderatorFilterPostDefinition as HT,OnCommentCreateDefinition as qT,OnCommentDeleteDefinition as jT,OnCommentReportDefinition as WT,OnCommentSubmitDefinition as GT,OnCommentUpdateDefinition as VT,OnModActionDefinition as zT,OnModMailDefinition as JT,OnPostCreateDefinition as $T,OnPostDeleteDefinition as KT,OnPostFlairUpdateDefinition as XT,OnPostNsfwUpdateDefinition as ZT,OnPostReportDefinition as QT,OnPostSpoilerUpdateDefinition as YT,OnPostSubmitDefinition as eA,OnPostUpdateDefinition as tA}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,a="stack"){return o instanceof Error?`${o[a]||o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(xi||(xi={}));function X(r,e){return y(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(De({metadata:i}),ce(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=rA(a);if(c)throw c.err;return DT.fromPartial({})}}function Ey(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(eA),M("OnPostSubmit",X("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides($T),M("OnPostCreate",X("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(tA),M("OnPostUpdate",X("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(QT),M("OnPostReport",X("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(KT),M("OnPostDelete",X("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(XT),M("OnPostFlairUpdate",X("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(GT),M("OnCommentSubmit",X("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(qT),M("OnCommentCreate",X("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(VT),M("OnCommentUpdate",X("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(WT),M("OnCommentReport",X("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(jT),M("OnCommentDelete",X("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(LT),M("OnAppInstall",X("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(NT),M("OnAppUpgrade",X("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(zT),M("OnModAction",X("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(JT),M("OnModMail",X("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(ZT),M("OnPostNsfwUpdate",X("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(YT),M("OnPostSpoilerUpdate",X("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterPost":r.provides(HT),M("OnAutomoderatorFilterPost",X("AutomoderatorFilterPost",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterComment":r.provides(_T),M("OnAutomoderatorFilterComment",X("AutomoderatorFilterComment",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function rA(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(`
|
2
|
+
`),!a&&o.indexOf("</")===-1&&o.charAt(o.length-1)!=="/"&&t++}return e}var Le,wy,gs,xc,hs,pt=class{constructor(e,t,i,n,o){l(this,Le);this.renderState={};this.currentComponentKey=[];this.currentHookIndex=0;this.actions=new Map;this.forms=new Map;this.realtimeChannels=[];this.realtimeUpdated=!1;this.pendingHooks=[];this.isRendering=!1;this.transformer=new wi(()=>this.assets);this.effects=[];l(this,hs,!1);this.component=e,this.event=t,this.state={__renderState:{},...i},this.metadata=n,this.state.__realtimeChannels&&(this.realtimeChannels=this.state.__realtimeChannels);let a=De({reconciler:this,hooks:!0,ui:!0,metadata:n});this.cache=a.cache,this.modLog=a.modLog,this.reddit=a.reddit,this.kvStore=a.kvStore,this.redis=a.redis,this.settings=a.settings,this.scheduler=a.scheduler,this.media=a.media,this.assets=a.assets,this.realtime=a.realtime,this.dimensions=o,this.ui=a.ui,this.hooks={useState:a.useState,useInterval:a.useInterval,useForm:a.useForm,useChannel:a.useChannel}}emitEffect(e,t){this.effects.push(t)}async render(){await this.reconcile(),this.isRendering=!0;let e=await this.buildBlocksUI();return this.isRendering=!1,e}makeUniqueActionID(e){let t=e,i=1;for(;this.actions.has(t);)t=`${e}.${i++}`;return t}async reconcile(){let e=S(this,Le,gs).call(this),t={type:this.component,props:e,children:[]},i=await this.processBlock(t);if(Py(i),this.transformer.createBlocksElementOrThrow(i),this.isUserActionRender&&this.blockRenderEventId){let n=this.actions.get(this.blockRenderEventId);n&&await n(this.event.data)}for(let n of this.pendingHooks)await n();this.buildNextState(),S(this,Le,wy).call(this)}async buildBlocksUI(){let e=S(this,Le,gs).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 Py(i),(u.debug.emitSnapshots||e.debug.emitSnapshots)&&console.debug(ST(Cy(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=ay(),i=[]){let n=e;if(typeof n.type=="string"){let c=[];for(let m=0;m<n.children.length;m++){let b=n.children[m];b!=null&&c.push(await this.processBlock(b,t,[...i,`${n.type}.${m}`]))}let p=c.flat(),g=S(this,Le,xc).call(this,p);return await this.processProps(n),{type:n.type,props:n.props,children:g}}if(typeof n.type=="function"){let c=t(`${i.length?i.join("."):"root"}.${n.type.name.length?n.type.name:"anonymous"}`);this.currentComponentKey.push(c),this.renderState[c]||(this.renderState[c]={});let p=n.children.flatMap(m=>m),g={...S(this,Le,gs).call(this),...n.props,children:p},f;for(;f===void 0;)try{f=await n.type(g,S(this,Le,gs).call(this))}catch(m){if(m instanceof Promise)f=await m;else throw m}if(!this.isInitialRender){let m=this.getPreviousComponentState();if(Object.keys(m).length!==this.currentHookIndex)throw new Error("Invalid hook call. Hooks can only be called at the top-level of a function component. Make sure that you are not calling hooks inside loops, conditions, or nested functions.")}if(this.currentComponentKey.pop(),this.currentHookIndex=0,typeof f=="object")return this.processBlock(f,t,[...i,n.type.name])}if(typeof n=="string")return n;if(typeof n=="number")return`${n}`;let o=[],a="";return Array.isArray(n)?o=n:typeof n.type>"u"&&n.children&&(o=n.children,a="fragmentChild."),{type:"__fragment",props:void 0,children:await Promise.all(o.flatMap(async(c,p)=>await this.processBlock(c,t,[...i,`${a}${p}`])))}}getCurrentComponentKey(){if(!this.currentComponentKey.at(-1))throw new Error("Current component key is missing");return this.currentComponentKey}getCurrentComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.renderState[e]}getPreviousComponentState(){let e=this.currentComponentKey.at(-1);if(!e)throw new Error("Current component key is missing");return this.state.__renderState[e]||(this.state.__renderState[e]={}),this.state.__renderState[e]}get isInitialRender(){return this.event?this.event.type===wc.RENDER_INITIAL:!1}get isUserActionRender(){return this.event?this.event.type===wc.RENDER_USER_ACTION:!1}get isEffectRender(){return this.event?this.event.type===wc.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,hs)||(d(this,hs,!0),this.effects.push({type:Sy.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:Sy.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}:{}}}};Le=new WeakSet,wy=function(){this.actions.clear(),this.currentComponentKey=[],this.currentHookIndex=0,this.pendingHooks=[],this.realtimeChannels=[],this.realtimeUpdated=!1},gs=function(){let e={...ce(this.metadata,this.state.__postData?.thingId),modLog:this.modLog,reddit:this.reddit,cache:this.cache,kvStore:this.kvStore,redis:this.redis,settings:this.settings,scheduler:this.scheduler,media:this.media,assets:this.assets,realtime:this.realtime,ui:this.ui,dimensions:this.dimensions,uiEnvironment:{timezone:this.metadata[D.Timezone]?.values[0],locale:this.metadata[D.Language]?.values[0],dimensions:this.dimensions},...this.hooks};return e.debug.effects=this,e},xc=function(e){let t=[];for(let i of e)typeof i=="string"?t.push(i):i.type==="__fragment"?t.push(...S(this,Le,xc).call(this,i.children)):t.push(i);return t},hs=new WeakMap;async function wT(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 CT.fromJSON({state:i.state,blocks:{ui:n},effects:i.getEffects()})}function xy(r){r.provides(PT),M("RenderPost",wT)}import{GetFieldsResponse as xT,InstallationSettingsDefinition as IT}from"@devvit/protos";async function FT(){if(!u.installationSettings)throw new Error("Installation settings were not defined.");return xT.fromJSON({fields:{fields:mt(u.installationSettings)}})}async function TT(r,e){return nd(r,u.installationSettings,e)}function Iy(r){r.provides(IT),M("GetSettingsFields",FT),M("ValidateForm",TT)}import{ContextActionDefinition as AT,ContextActionList as ET,ContextActionResponse as RT}from"@devvit/protos";var Fy=r=>`menuItem.${r}`;function Ic(r){return u.menuItems.find((e,t)=>Fy(t)===r)}async function OT(r,e){let t=u.menuItems;if(!t.length)throw new Error("No menu items registered.");let i=t.map((n,o)=>({actionId:Fy(o),name:n.label,description:n.description,contexts:{subreddit:n.location.includes("subreddit"),post:n.location.includes("post"),comment:n.location.includes("comment")},users:{loggedOut:n.forUserType?.includes("loggedOut"),moderator:n.forUserType?.includes("moderator")},postFilters:n.postFilter==="currentApp"?{currentApp:!0}:void 0}));return ET.fromJSON({actions:i})}async function BT(r,e){let t=Ic(r.actionId);if(!t)throw new Error(`MenuItem ${r.actionId} not found`);let i=r.comment?.id&&`t1_${r.comment.id}`,n=r.post?.id&&`t3_${r.post.id}`,o=r.subreddit?.id&&`t5_${r.subreddit.id}`,a=i||n||o;y(a,"targetId is missing from ContextActionRequest");let c={targetId:a,location:r.comment?"comment":r.post?"post":"subreddit"},p=Object.assign(De({ui:!0,metadata:e}),ce(e,n,i),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});return await t.onPress(c,p),RT.fromJSON({effects:Si(p.ui)})}function Ty(r){r.provides(AT),M("GetActions",OT),M("OnAction",BT)}function gt(r){return r?r===!0?!0:r.enabled:!1}import{SchedulerHandlerDefinition as MT}from"@devvit/protos";async function UT(r,e){let t=r.type,i=u.scheduledJobHandlers.get(t);if(!i)throw new Error(`Job ${t} not found`);let n={name:t,data:r.data},o=Object.assign(De({metadata:e}),ce(e));await i(n,o)}function Ay(r){r.provides(MT),M("HandleScheduledAction",UT)}import{HandlerResult as DT,OnAppInstallDefinition as LT,OnAppUpgradeDefinition as NT,OnAutomoderatorFilterCommentDefinition as _T,OnAutomoderatorFilterPostDefinition as HT,OnCommentCreateDefinition as qT,OnCommentDeleteDefinition as jT,OnCommentReportDefinition as WT,OnCommentSubmitDefinition as GT,OnCommentUpdateDefinition as VT,OnModActionDefinition as zT,OnModMailDefinition as JT,OnPostCreateDefinition as $T,OnPostDeleteDefinition as KT,OnPostFlairUpdateDefinition as XT,OnPostNsfwUpdateDefinition as ZT,OnPostReportDefinition as QT,OnPostSpoilerUpdateDefinition as YT,OnPostSubmitDefinition as eA,OnPostUpdateDefinition as tA}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,a="stack"){return o instanceof Error?`${o[a]||o.stack||o.message||o.name}`:String(o)}r.caughtToString=n})(xi||(xi={}));function X(r,e){return y(e),async(t,i)=>{let n={...t,type:r},o=Object.assign(De({metadata:i}),ce(i)),a=await Promise.allSettled(e.map(p=>p(n,o))),c=rA(a);if(c)throw c.err;return DT.fromPartial({})}}function Ey(r){for(let e of u.triggerOnEventHandlers.keys())switch(e){case"PostSubmit":r.provides(eA),M("OnPostSubmit",X("PostSubmit",u.triggerOnEventHandlers.get(e)));break;case"PostCreate":r.provides($T),M("OnPostCreate",X("PostCreate",u.triggerOnEventHandlers.get(e)));break;case"PostUpdate":r.provides(tA),M("OnPostUpdate",X("PostUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostReport":r.provides(QT),M("OnPostReport",X("PostReport",u.triggerOnEventHandlers.get(e)));break;case"PostDelete":r.provides(KT),M("OnPostDelete",X("PostDelete",u.triggerOnEventHandlers.get(e)));break;case"PostFlairUpdate":r.provides(XT),M("OnPostFlairUpdate",X("PostFlairUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentSubmit":r.provides(GT),M("OnCommentSubmit",X("CommentSubmit",u.triggerOnEventHandlers.get(e)));break;case"CommentCreate":r.provides(qT),M("OnCommentCreate",X("CommentCreate",u.triggerOnEventHandlers.get(e)));break;case"CommentUpdate":r.provides(VT),M("OnCommentUpdate",X("CommentUpdate",u.triggerOnEventHandlers.get(e)));break;case"CommentReport":r.provides(WT),M("OnCommentReport",X("CommentReport",u.triggerOnEventHandlers.get(e)));break;case"CommentDelete":r.provides(jT),M("OnCommentDelete",X("CommentDelete",u.triggerOnEventHandlers.get(e)));break;case"AppInstall":r.provides(LT),M("OnAppInstall",X("AppInstall",u.triggerOnEventHandlers.get(e)));break;case"AppUpgrade":r.provides(NT),M("OnAppUpgrade",X("AppUpgrade",u.triggerOnEventHandlers.get(e)));break;case"ModAction":r.provides(zT),M("OnModAction",X("ModAction",u.triggerOnEventHandlers.get(e)));break;case"ModMail":r.provides(JT),M("OnModMail",X("ModMail",u.triggerOnEventHandlers.get(e)));break;case"PostNsfwUpdate":r.provides(ZT),M("OnPostNsfwUpdate",X("PostNsfwUpdate",u.triggerOnEventHandlers.get(e)));break;case"PostSpoilerUpdate":r.provides(YT),M("OnPostSpoilerUpdate",X("PostSpoilerUpdate",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterPost":r.provides(HT),M("OnAutomoderatorFilterPost",X("AutomoderatorFilterPost",u.triggerOnEventHandlers.get(e)));break;case"AutomoderatorFilterComment":r.provides(_T),M("OnAutomoderatorFilterComment",X("AutomoderatorFilterComment",u.triggerOnEventHandlers.get(e)));break;default:throw new Error(`Unknown trigger event: ${e}`)}}function rA(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
3
|
`))}}import{EffectType as tR,HandleUIEventResponse as qc,UIEventHandlerDefinition as rR}from"@devvit/protos";var Cb=Ln(jy(),1),wb=Ln(Hc(),1);async function iR(r,e){let t=r.state??{},i=(0,Cb.default)(t),n=De({ui:!0,metadata:e});if(r.event?.formSubmitted&&r.event.formSubmitted.formId){let p=r.event.formSubmitted.formId;if(p.includes("form.hook.")&&u.customPostType){let v=new pt((P,C)=>u.customPostType?.render(C)??null,r.event,r.state,e,void 0);return await v.reconcile(),qc.fromJSON({state:v.state,effects:v.getEffects()})}let g=u.formDefinitions.get(p);if(!g)throw new Error(`Form with key ${p} not found`);let f,m;if(i.__contextAction){let{actionId:v,thingId:P}=i.__contextAction,C=Ic(v);C?.location==="post"?f=P:C?.location==="comment"&&(m=P)}let b=Object.assign(n,ce(e,f,m),{uiEnvironment:{timezone:e[D.Timezone]?.values[0],locale:e[D.Language]?.values[0]}});await g.onSubmit({values:Tt(r.event.formSubmitted.results)},b)}else if(r.event?.realtimeEvent){if(u.customPostType){let p=new pt((g,f)=>u.customPostType?.render(f)??null,r.event,r.state,e,void 0);return await p.reconcile(),qc.fromJSON({state:p.state,effects:p.getEffects()})}}else if(r.event?.toastAction)throw new Error("Toast actions not yet implemented");let o=!(0,wb.default)(t,i),a=Si(n.ui),c=o?[...a,{type:tR.EFFECT_RERENDER_UI,rerenderUi:{delaySeconds:0}}]:a;return qc.fromJSON({state:i,effects:c})}function xb(r){r.provides(rR),M("HandleUIEvent",iR)}import{CustomPostDefinition as Od,UIResponse as Yb}from"@devvit/protos";import{UIEventScope as mR}from"@devvit/protos";var jc="ServerCallRequired";function Cd(r){return r?.message===jc}var zc={now(){return new Date}};function Ib(r){return`__autocache__${r}`}function Fb(r){return`__lock__${r}`}var nR=300,sR=1e3,wd=5e3,Wc=3,Tb=.1,Ab=1e3,oR=3e4;function Eb(r){if(r.error)throw new Error(r.error);return r.value}var Dt,Lt,Ne,Ai,K,Rb,Ob,Bb,Gc,Mb,Ub,Vc,Db,xd=class{constructor(e,t,i=zc){l(this,K);l(this,Dt);l(this,Lt,{});l(this,Ne);l(this,Ai);d(this,Dt,e),d(this,Ai,t),d(this,Ne,i)}async cache(e,t){var a;(a=s(this,Ai)).__cache??(a.__cache={}),d(this,Lt,s(this,Ai).__cache),S(this,K,Db).call(this,t);let i=S(this,K,Rb).call(this,t.key);if(i!==void 0)return i;let n=await S(this,K,Vc).call(this,t.key),o=await S(this,K,Ob).call(this,t,n,e);return Eb(o)}};Dt=new WeakMap,Lt=new WeakMap,Ne=new WeakMap,Ai=new WeakMap,K=new WeakSet,Rb=function(e){let t=s(this,Lt)[e];if(t){let i=s(this,Ne).now().getTime(),n=t?.error&&t?.errorTime&&t.errorCount<Wc&&Math.random()<Tb&&t.errorTime+Ab<i;if(t?.expires&&t.expires<i&&t.checkedAt+Ab<i||n){delete s(this,Lt)[e];return}else return Eb(t)}},Ob=async function(e,t,i){let n=t?.expires,o=n?S(this,K,Ub).call(this,n):1;return!t||t?.error&&t.errorCount<Wc&&Tb>Math.random()||o>Math.random()?S(this,K,Bb).call(this,e,t,i):t},Bb=async function(e,t,i){let n=Fb(e.key),o=s(this,Ne).now().getTime(),a=new Date(o+e.ttl/2);if(await s(this,Dt).set(n,"1",{expiration:a,nx:!0}))return S(this,K,Mb).call(this,e.key,t,i,e.ttl);if(t)return t;{let p=s(this,Ne).now();return S(this,K,Gc).call(this,p,e.key,e.ttl)}},Gc=async function(e,t,i){let n=Math.min(i,sR),o=await S(this,K,Vc).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,nR)),S(this,K,Gc).call(this,e,t,i)},Mb=async function(e,t,i,n){let o=s(this,Ne).now().getTime()+n;t=t??{value:null,expires:o,errorCount:0,error:null,errorTime:null,checkedAt:0};try{t.value=await i(),t.error=null,t.errorCount=0,t.errorTime=null}catch(a){t.value=null,t.error=a.message??"Unknown error",t.errorTime=s(this,Ne).now().getTime(),t.errorCount++}return s(this,Lt)[e]=t,await s(this,Dt).set(Ib(e),JSON.stringify(t),{expiration:new Date(o+oR)}),t.error&&t.errorCount<Wc&&await s(this,Dt).del(Fb(e)),t},Ub=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},Vc=async function(e){let t=await s(this,Dt).get(Ib(e));if(t){let i=JSON.parse(t);return i.checkedAt=s(this,Ne).now().getTime(),s(this,Lt)[e]=i,i}},Db=function(e){e.ttl<wd&&(console.warn(`Cache TTL cannot be less than ${wd} milliseconds! Updating ttl value of ${e.ttl} to ${wd}.`),e.ttl=wd)};function Lb(r,e,t=zc){let i=new xd(r,e,t);return i.cache.bind(i)}import{EffectType as Kc,Form as dR,ToastAppearance as Hb}from"@devvit/protos";function Nb(r){let e=r.match(/form\.hook\.(.+)\.0/);if(e?.[1])return e[1]}var Jc=class{constructor(e,t,i){this.state=null;this.hookId=e.hookId,this.form=t,this.onSubmit=i,this.onUIEvent=async n=>{n.formSubmitted&&await i(Tt(n.formSubmitted.results))}}};function $c(r,e){let t=Je({namespace:"useForm",initializer:i=>new Jc(i,r,e)});return aR({id:t.hookId})}function aR(r){return`form.hook.${r.id}.0`}function _b(r,e){let t=Nb(e);return r.getHook({id:t})}var Nt,Id=class{constructor(e){l(this,Nt);d(this,Nt,e)}showForm(e,t){let i=_b(s(this,Nt),e);if(!i)throw new Error("Form does not exist. Make sure you have added it using useForm.");let n=i.form instanceof Function?i.form(t??{}):i.form,o=dR.fromPartial({id:e,title:n.title,acceptLabel:n.acceptLabel,cancelLabel:n.cancelLabel,shortDescription:n.description});gr(n.fields),o.fields=mt(n.fields),s(this,Nt).emitEffect(e,{type:Kc.EFFECT_SHOW_FORM,showForm:{form:o}})}showToast(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?Hb.SUCCESS:Hb.NEUTRAL}:t={text:e},s(this,Nt).emitEffect(e.toString(),{type:Kc.EFFECT_SHOW_TOAST,showToast:{toast:t}})}navigateTo(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.permalink,"https://www.reddit.com").toString(),s(this,Nt).emitEffect(t,{type:Kc.EFFECT_NAVIGATE_TO_URL,navigateToUrl:{url:t}})}};Nt=new WeakMap;import{EffectType as lR,RealtimeSubscriptionStatus as qb}from"@devvit/protos";var _t,it,Ht,wr,Ss,Zc,Fd=class Fd{constructor(e,t){l(this,Ss);l(this,_t);l(this,it);l(this,Ht);l(this,wr);d(this,_t,t.context),d(this,it,!!t.context._devvitContext?.debug.realtime),d(this,wr,e),d(this,Ht,t.invalidate);let i=t.context.meta[D.App]?.values[0];if(!i)throw Error("useChannel missing app ID metadata");let n=t.context.meta[D.Installation]?.values[0];if(!n)throw Error("useChannel missing install ID from metadata");let o=`${i}:${n}:${e.name}`;if(Object.values(s(this,_t)._hooks).filter(c=>c instanceof Fd).some(c=>c.state.channel===o))throw Error(`useChannel channel names must be unique; "${o}" duplicated`);this.state={channel:o,connected:!1,subscribed:!1}}async onUIEvent(e){let t=e.realtimeEvent;if(!(!t||!this.state.subscribed))switch(t.status){case qb.REALTIME_SUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" connected`),this.state.connected=!0,s(this,Ht).call(this),await s(this,wr).onSubscribed?.();break;case qb.REALTIME_UNSUBSCRIBED:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" disconnected`),this.state.connected=!1,s(this,Ht).call(this),await s(this,wr).onUnsubscribed?.();break;default:s(this,it)&&console.debug(`[realtime] "${this.state.channel}" received message: ${JSON.stringify(e,void 0,2)}`),s(this,wr).onMessage(t.event?.data?.msg);break}}async send(e){if(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" send message: ${JSON.stringify(e,void 0,2)}`),!this.state.subscribed||!this.state.connected)throw console.debug(`[realtime] "${this.state.channel}" send failed; channel not connected`),Error(`useChannel send failed; "${this.state.channel}" channel not connected`);await s(this,_t).devvitContext.realtime.send(this.state.channel,e)}get status(){return this.state.subscribed&&this.state.connected?2:this.state.subscribed&&!this.state.connected?1:!this.state.subscribed&&this.state.connected?3:4}subscribe(){this.state.subscribed||(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" subscribed`),this.state.subscribed=!0,s(this,Ht).call(this),S(this,Ss,Zc).call(this))}unsubscribe(){this.state.subscribed&&(s(this,it)&&console.debug(`[realtime] "${this.state.channel}" unsubscribed`),this.state.subscribed=!1,s(this,Ht).call(this),S(this,Ss,Zc).call(this))}};_t=new WeakMap,it=new WeakMap,Ht=new WeakMap,wr=new WeakMap,Ss=new WeakSet,Zc=function(){let e=Object.values(s(this,_t)._hooks).filter(t=>t instanceof Fd&&t.state.subscribed).map(t=>t.state.channel);s(this,_t).emitEffect(this.state.channel,{type:lR.EFFECT_REALTIME_SUB,realtimeSubscriptions:{subscriptionIds:e}})};var Xc=Fd;function Qc(r){if(!r.name||/[^a-zA-Z0-9_]/.test(r.name))throw Error(`useChannel error: The name "${r.name}" you provided for the hook is invalid. Valid names can only contain letters, numbers, and underscores (_).`);let e=`useChannel:${r.name}`;return Je({id:e,namespace:e,initializer:t=>new Xc(r,t)})}import{EffectType as Yc}from"@devvit/protos";function jb(r){return typeof r=="object"&&r!==null&&"__deleted"in r}var xr,qt,Ei=class Ei{constructor(e,t){l(this,xr);this._segments=[];l(this,qt,{});this._prevHooks={};this._prevHookId="";this._effects={};this._changed={};this._touched={};this._requeueEvents=[];this._rootProps={};this._generated={};this._undeliveredHandlers={};this.request=e,this.meta=t,d(this,xr,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,xr).__cache??{}};for(let i in this._changed)e[i]=this._state[i];let t=new Set(Object.keys(this._state));return Object.keys(s(this,qt)).forEach(i=>{i!=="__cache"&&t.delete(i)}),t.forEach(i=>{if(i==="__cache")return;let n={__deleted:!0};this._state[i]=e[i]=n}),e}get _hooks(){return s(this,qt)}set _hooks(e){this._prevHooks=s(this,qt),d(this,qt,e)}get _state(){return s(this,xr)}set _state(e){d(this,xr,e)}push(e){this._segments.push({...e,next:0})}pop(){this._segments.pop()}addUndeliveredEventHandler(e,t){this._undeliveredHandlers[e]=t}addGlobalUndeliveredEventHandler(e,t){Ei.addGlobalUndeliveredEventHandler(e,t)}getHook(e){return s(this,qt)[e.id]}static addGlobalUndeliveredEventHandler(e,t){Ei._staticUndeliveredHandlers[e]=t}async handleUndeliveredEvent(e){let t={...Ei._staticUndeliveredHandlers,...this._undeliveredHandlers};for(let[i,n]of Object.entries(t))await n(e,this)}emitEffect(e,t){this._effects[e]=t}addToRequeueEvents(...e){this._devvitContext?.debug.blocks&&console.debug("[blocks] requeueing events",e);let t=e.reduce((i,n)=>(n.retry?i.retry.push(n):i.normal.push(n),i),{retry:[],normal:[]});this._requeueEvents=[...t.retry,...this._requeueEvents,...t.normal]}get effects(){return Object.values(this._effects)}nextHookId(e){e.key===void 0&&(e.key=this._segments[this._segments.length-1].next+++""),this.push(e);try{let t=[];for(let n=this._segments.length-1;n>=0;n--){let o=this._segments[n];if(o.id){t.unshift(o.id);break}let a=[];o.namespace&&a.push(o.namespace),o.key!==void 0&&o.key!==!1&&a.push(o.key),t.unshift(a.join("-"))}let i=t.join(".");if(this._generated[i]&&!e.shared)throw new Error(`Hook id ${i} already used, cannot register another hook with the same id`);return this._generated[i]=!0,this._prevHookId=i,i}finally{this.pop()}}};xr=new WeakMap,qt=new WeakMap,Ei._staticUndeliveredHandlers={};var Ri=Ei;var jt={};Ri.addGlobalUndeliveredEventHandler("intervals",async(r,e)=>{r.timer&&r.hook&&(delete jt[r.hook],e.emitEffect("timers",{type:Yc.EFFECT_SET_INTERVALS,interval:{intervals:jt}}))});var Wt,Oi,Ps,Bi,em=class{constructor(e,t,i){l(this,Wt);l(this,Oi);l(this,Ps);l(this,Bi);this.state={duration:{seconds:0,nanos:0},running:!1};d(this,Oi,i.invalidate),d(this,Wt,i.hookId),d(this,Ps,e),d(this,Bi,i.context);let n=Math.floor(t/1e3),o=t%1e3*1e6;this.state.duration={seconds:n,nanos:o}}onStateLoaded(){this.state.running?jt[s(this,Wt)]={duration:this.state.duration}:delete jt[s(this,Wt)]}async onUIEvent(e){await s(this,Ps).call(this)}start(){jt[s(this,Wt)]={duration:this.state.duration},this.state.running=!0,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:Yc.EFFECT_SET_INTERVALS,interval:{intervals:jt}})}stop(){delete jt[s(this,Wt)],this.state.running=!1,s(this,Oi).call(this),s(this,Bi).emitEffect("timers",{type:Yc.EFFECT_SET_INTERVALS,interval:{intervals:jt}})}};Wt=new WeakMap,Oi=new WeakMap,Ps=new WeakMap,Bi=new WeakMap;function tm(r,e){let t=Je({namespace:"useInterval",initializer:i=>new em(r,e,i)});return{start:()=>t.start(),stop:()=>t.stop()}}import{UIEventScope as cR}from"@devvit/protos";var Ir=class extends Error{};import{UIEventScope as Wb}from"@devvit/protos";var Gb=Ln(Hc(),1);function im(r){if(r instanceof Error){if(r.message===jc)throw r;return console.error(r),{message:r.message,details:r.stack??""}}else return console.error(r),{message:"Unknown error",details:xi.caughtToString(r)}}var $e,nt,Mi,Cs,rm=class{constructor(e,t,i){l(this,$e);l(this,nt);l(this,Mi);l(this,Cs);d(this,$e,!!i.context.devvitContext.debug.useAsync),s(this,$e)&&console.debug("[useAsync] v1",t),this.state={data:null,load_state:"initial",error:null,depends:null},d(this,nt,i.hookId),this.initializer=e,d(this,Mi,i.invalidate),d(this,Cs,i.context),this.localDepends=t.depends??null}onStateLoaded(){if(this.state.load_state!=="disabled"&&(s(this,$e)&&console.debug("[useAsync] async onLoad ",s(this,nt),this.state),s(this,$e)&&console.debug("[useAsync] async onLoad have ",this.localDepends,"and",this.state.depends),!(0,Gb.default)(this.localDepends,this.state.depends)||this.state.load_state==="initial")){s(this,$e)&&console.debug("[useAsync] attempting to resolve for hookId",s(this,nt)),this.state.load_state="loading",this.state.depends=this.localDepends,s(this,Mi).call(this);let e={scope:Wb.ALL,hook:s(this,nt),async:!0,asyncRequest:{requestId:s(this,nt)+"-"+JSON.stringify(this.state.depends)}};s(this,$e)&&console.debug("[useAsync] onLoad requeue"),s(this,Cs).addToRequeueEvents(e)}}async onUIEvent(e,t){if(e.asyncRequest){let i={requestId:e.asyncRequest.requestId};try{i.data={value:await this.initializer()}}catch(o){i.error=im(o)}let n={scope:Wb.ALL,asyncResponse:i,hook:s(this,nt)};s(this,$e)&&console.debug("[useAsync] onReq requeue"),t.addToRequeueEvents(n)}else if(e.asyncResponse){let i=s(this,nt)+"-"+JSON.stringify(this.state.depends);e.asyncResponse.requestId===i?(this.state={...this.state,data:e.asyncResponse.data?.value,error:e.asyncResponse.error??null,load_state:e.asyncResponse.error?"error":"loaded"},s(this,Mi).call(this)):s(this,$e)&&console.debug("[useAsync] onResp skip, stale event")}else throw new Error("Unknown event type")}};$e=new WeakMap,nt=new WeakMap,Mi=new WeakMap,Cs=new WeakMap;function uR(r,e={}){let t=Je({namespace:"useAsync",initializer:i=>new rm(r,e,i)});return{data:t.state.data,error:t.state.error,loading:t.state.load_state==="loading"}}var vt,Ui,Fr,Tr,nm=class{constructor(e,t){this.state={value:null,load_state:"initial",error:null};l(this,vt);l(this,Ui);l(this,Fr);l(this,Tr);d(this,Fr,e),d(this,Tr,t.hookId),d(this,vt,t.invalidate),d(this,Ui,t.context)}async onUIEvent(){if(this.state.load_state==="loading"&&this._promise){try{this.state.value=await this._promise,this.state.load_state="loaded"}catch(e){this.state.load_state="error",this.state.error=im(e)}s(this,vt).call(this)}else console.warn("Invalid state: ",this.state.load_state,this._promise)}setter(e){this.state.value=e instanceof Function?e(this.state.value):e,this.state.load_state="loaded",s(this,vt).call(this)}onStateLoaded(){if(this._promise=s(this,Ui)._prevHooks[s(this,Tr)]?._promise,this.state.load_state==="loading")throw new Ir;if(this.state.load_state==="error")throw new Error(this.state.error?.message??"Unknown error");if(this.state.load_state==="initial"){let e;try{e=s(this,Fr)instanceof Function?s(this,Fr).call(this):s(this,Fr)}catch(t){console.log("error in loading async",t),this.state.load_state="error",s(this,vt).call(this);return}if(e instanceof Promise){this._promise=e,this.state.load_state="loading";let t={scope:cR.ALL,asyncRequest:{requestId:s(this,Tr)},hook:s(this,Tr)};throw s(this,Ui).addToRequeueEvents(t),s(this,vt).call(this),new Ir}else this.state.value=e,this.state.load_state="loaded";s(this,vt).call(this)}}};vt=new WeakMap,Ui=new WeakMap,Fr=new WeakMap,Tr=new WeakMap;function sm(r){let e=Je({namespace:"useState",initializer:t=>new nm(r,t)});return[e.state.value,e.setter.bind(e)]}var Td=class{buildContext(e,t,i){let n=new pi(i),o=new ci(i),a=new vi(i),c=new hi(i),p=new yi(i),g=new bi(i),f=new Id(e),m=new mi(i),b=new li,v=new gi(i),P=Lb(a,e._state),C={modLog:n,kvStore:o,redis:a,reddit:c,scheduler:p,settings:g,media:m,assets:b,realtime:v,ui:f,useState:sm,useChannel:Qc,useInterval:tm,useForm:$c,cache:P,dimensions:t.env?.dimensions,uiEnvironment:{timezone:i[D.Timezone]?.values[0],locale:i[D.Language]?.values[0],dimensions:t.env?.dimensions}},F=ce(i,t.props?.postId);return F.debug.effects=e,{...F,...C}}};var Se=null;function Vb(r){return JSON.parse(JSON.stringify(r))}function pR(r){if(!(r!==""&&!/[-.]/.test(r)))throw new Error(`Hook with namespace '${r}' is invalid. Hook namespaces cannot be empty string or contain dashes/dots because they are used as delimiters internally. Please update the hook namespace and try again.`)}function Je({initializer:r,...e}){if(!Se)throw new Error("Hooks can only be declared at the top of a component. You cannot declare hooks outside of components or inside of event handlers. It's almost always a mistake to declare hooks inside of loops or conditionals.");pR(e.namespace);let t=Se.nextHookId(e),i=Se,n={hookId:t,invalidate:()=>{i._changed[t]=!0,i._state[t]=i?._hooks[t]?.state},context:Se},o=Se._state[t]===void 0||jb(Se._state[t]);Se._hooks[t]=Se._hooks[t]??r(n);let a=Se._hooks[t];return o||(a.state=Se._state[t]),a.onStateLoaded?.(),o&&a.state!==void 0&&a.state!==null&&n.invalidate(),a}var gR=null,Di,Rd,ws,T,me,Ad,zb,om,Jb,am,dm,Ed,lm,$b,Ar=class{constructor(e){l(this,T);l(this,Di);l(this,Rd,new Td);l(this,ws,new wi(()=>this._latestRenderContext?.devvitContext?.assets));this._latestRenderContext=null;s(this,T,me)&&console.debug("[blocks] BlocksHandler v1"),d(this,Di,e),gR=this}async handle(e,t){let i=new Ri(e,t),n=s(this,Rd).buildContext(i,e,t);i.devvitContext=n;let o,a=e.events,p=!e.events?.length||a.some(v=>!v.async),g=a.some(v=>v.blocking),f,m,b=[...a];for(a.length===0&&a.push({scope:mR.ALL}),s(this,T,me)&&console.debug("[blocks] starting processing events");a.length>0;){s(this,T,me)&&console.debug("[blocks] processing events loop iteration",a.length);let v=[];if(!a[0].async)v.push(a.shift());else for(;a[0]?.async;)v.push(a.shift());if(!v.length)throw Error("batch must have at least one event");try{if(v[0].async){let C=Vb(i._state);await S(this,T,zb).call(this,i,...v),i._state=C}else await S(this,T,Jb).call(this,i,...v)}catch(C){if(!Cd(C))throw C;if(s(this,T,me)&&console.debug("[blocks] caught in handler",C),i._latestRenderContent=void 0,m){i._state=m._state,i._changed=f,i._effects=m._effects;let F=b.map(I=>{let ge={...I};return ge.retry=!0,ge});i.addToRequeueEvents(...F);break}else throw Cd(C)||console.error("[blocks] unhandled error in handler",C),C}s(this,T,me)&&console.debug("[blocks] remaining events",i._requeueEvents);let P=[];for(let C of i._requeueEvents){if(!p&&!C.async){s(this,T,me)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch A",C),P.push(C);continue}if(p&&C.async&&!g){s(this,T,me)&&console.debug("[blocks] NOT reprocessing event in BlocksHandler, sync mismatch B",C),P.push(C);continue}s(this,T,me)&&console.debug("[blocks] reprocessing event in BlocksHandler",C),a.push(C)}i._requeueEvents=P,a.length>0&&(f={...i._changed},m={_state:Vb(i._state),_effects:{...i._effects}},b=[...a])}if(p){i._latestRenderContent||(i._latestRenderContent=S(this,T,am).call(this,s(this,Di),i.request.props??{},i));let v=i._latestRenderContent;v&&(o=s(this,ws).createBlocksElementOrThrow(v),o=s(this,ws).ensureRootBlock(o))}return{state:i._changedState,effects:i.effects,blocks:o,events:i._requeueEvents}}};Di=new WeakMap,Rd=new WeakMap,ws=new WeakMap,T=new WeakSet,me=function(){return!!this._latestRenderContext?.devvitContext.debug.blocks},Ad=function(e,...t){e._hooks={},S(this,T,am).call(this,s(this,Di),e.request.props??{},e)},zb=async function(e,...t){S(this,T,Ad).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,om).call(this,e,i)}))},om=async function(e,t){let i=e._hooks[t.hook];if(i?.onUIEvent)try{await i.onUIEvent(t,e)}catch(n){throw Cd(n)?s(this,T,me)&&console.error("Server call required",n):console.error("Error in event handler",n),n}else await e.handleUndeliveredEvent(t)},Jb=async function(e,...t){for(let i of t)s(this,T,me)&&console.log("[blocks] handling main queue event",i),s(this,T,me)&&console.log("[blocks] before",e._state),S(this,T,Ad).call(this,e,i),await S(this,T,om).call(this,e,i),s(this,T,me)&&console.log("[blocks] after",e._state);S(this,T,Ad).call(this,e)},am=function(e,t,i){s(this,T,me)&&console.debug("[blocks] renderRoot"),i._generated={},Se=i,this._latestRenderContext=i;try{let n=S(this,T,dm).call(this,e,t,i);if(n.length!==1)throw new Error(`There can only be one root element, received: ${n.length}. Please wrap these elements in a <vstack></vstack> or <hstack></hstack> to continue. Fragments cannot be used as a root element.`);let o=n[0];if(o==="[object Promise]")throw new Error('Root elements cannot be async. To use data from an async endpoint, please use "const [data] = useState(async () => {/** your async code */})".');if(typeof o=="string")throw new Error("The root element must return a valid block, not a string. Try wrapping the element in a <text>your content</text> tag to continue.");return i._latestRenderContent=o,o}catch(n){if(n instanceof Ir)return;throw n}finally{Se=null}},dm=function(e,t,i){i.push({namespace:e.name||"anonymous",...t});try{let n=e(t,i.devvitContext);if(n instanceof Promise)throw new Error(`Components (found: ${e.name??"unknown component"}) cannot be async. To use data from an async endpoint, please use "const [data] = useState(async () => {/** your async code */})".`);return S(this,T,lm).call(this,n,i)}finally{i.pop()}},Ed=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,lm).call(this,i,t)))},lm=function(e,t){if(Array.isArray(e))return S(this,T,Ed).call(this,e,t);if(hR(e))if(e.type===void 0)try{return t.push({namespace:"fragment",...e.props}),S(this,T,Ed).call(this,e.children,t)}finally{t.pop()}else if(typeof e.type=="function"){let i={...e.props,children:e.children.flat(1/0)};return S(this,T,dm).call(this,e.type,i,t)}else try{t.push({namespace:e.type,...e.props});let i=S(this,T,Ed).call(this,e.children,t),n=S(this,T,$b).call(this,e.props??{});return[{type:e.type,children:i,props:n}]}finally{t.pop()}else return[(e??"").toString()]},$b=function(e){let t={};for(let i in e)if(!(typeof e[i]>"u"))if(typeof e[i]=="function"){let n=Je({namespace:i,key:!1,initializer:({hookId:o})=>({hookId:o,state:null,onUIEvent:a=>e[i](a.userAction?.data)})});t[i]=n.hookId,"captureHookRef"in e[i]&&e[i].captureHookRef()}else{let n=JSON.parse(JSON.stringify(e[i]));n!=null&&(t[i]=n)}return t};function hR(r){return typeof r=="object"&&r!=null&&"type"in r}var Kb=r=>{let e=Number(r.trim().split(".").pop());return isNaN(e)?void 0:e},Xb=r=>{let[e,t,i]=r.trim().split(";");if(!e||!t||!i){console.warn(`Received a malformed devvit-user-agent! Received: '${r}'`);return}if(e!=="Reddit"){console.warn(`Received unknown company name in user agent! Received: '${r}'`);return}if(t==="iOS"){let n=Kb(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"iOS",rawVersion:i,versionNumber:n}}if(t==="Android"){let n=Kb(i);if(n===void 0){console.warn(`Could not parse version number from user agent! Received: '${r}'`);return}return{company:"Reddit",platform:"Android",rawVersion:i,versionNumber:n}}if(t==="Shreddit")return{company:"Reddit",platform:"Shreddit",rawVersion:i};if(t==="Play")return{company:"Reddit",platform:"Play",rawVersion:i};console.warn("Received unknown platform:",t)},Zb=r=>r?r.platform==="Android"?r.versionNumber<1875012:r.platform==="iOS"?r.versionNumber<614973:!1:(console.warn(`Could not parse devvit-user-agent! Received: '${JSON.stringify(r)}'`),!1),fR=r=>{switch(r){case"Android":return"https://play.google.com/store/apps/details?id=com.reddit.frontpage";case"iOS":return"https://apps.apple.com/us/app/reddit/id1064216828";case"Play":case"Shreddit":break;default:console.error(`No upgrade link for platform: ${r}`)}},vR=({platform:r},e)=>u.createElement("blocks",null,u.createElement("vstack",{alignment:"middle center",height:100,width:100},u.createElement("vstack",{maxWidth:"300px",gap:"large",alignment:"middle center"},u.createElement("vstack",{gap:"medium",alignment:"middle center"},u.createElement("image",{imageHeight:100,imageWidth:100,url:"https://i.redd.it/p1vmc5ulmpib1.png"}),u.createElement("text",{size:"large",weight:"bold",wrap:!0,alignment:"center"},"Uh oh, the app you're trying to use requires the latest version of Reddit. Please upgrade your app to continue.")),u.createElement("hstack",{alignment:"middle center"},u.createElement("button",{onPress:()=>{let t=fR(r);t?e.ui.navigateTo(t):console.warn("No upgrade link found for platform:",r)}},"Upgrade"))))),Qb=r=>()=>u.createElement(vR,{platform:r});var yR=()=>u.createElement("vstack",{alignment:"center middle",width:"100%",height:"100%"},u.createElement("text",null,"This feature is not available yet")),bR=[[Od,Od.methods.renderPostContent,(r,e)=>u.customPostType?.render(e)??null],[Od,Od.methods.renderPostComposer,(r,e)=>u.createElement(yR,null)]];function kR(r){return async(e,t)=>{let i=Xb(t["devvit-user-agent"]?.values?.[0]??"");if(i&&Zb(i)){let o=new Ar(Qb(i.platform));return Yb.fromJSON(await o.handle(e,t))}let n=new Ar(r);return Yb.fromJSON(await n.handle(e,t))}}function ek(r){for(let[e,t,i]of bR)r.provides(e),M(t.name,kR(i))}var Li,xs,Ni,Er,Rr,_i,Hi,Or,Gt,Is,Fs,Br,G,_=class _ extends Za{static configure(e){d(this,Ni,{...s(this,Ni),...e}),gt(e.http)&&this.use(w.HTTPDefinition),(gt(e.kvStore)||gt(e.redis))&&(this.use(w.KVStoreDefinition),this.use(w.RedisAPIDefinition)),gt(e.media)&&this.use(w.MediaServiceDefinition),gt(e.modLog)&&this.use(w.ModlogDefinition),gt(e.redditAPI)&&(this.use(w.FlairDefinition),this.use(w.GraphQLDefinition),this.use(w.LinksAndCommentsDefinition),this.use(w.ListingsDefinition),this.use(w.ModerationDefinition),this.use(w.ModNoteDefinition),this.use(w.NewModmailDefinition),this.use(w.PrivateMessagesDefinition),this.use(w.SubredditsDefinition),this.use(w.UsersDefinition),this.use(w.WidgetsDefinition),this.use(w.WikiDefinition)),gt(e.realtime)&&this.use(w.RealtimeDefinition)}static addMenuItem(e){s(this,Hi).push(e)}static addCustomPostType(e){d(this,Er,e)}static createForm(e,t){let i=`form.${s(this,Rr).size}`;return s(this,Rr).set(i,{form:e,onSubmit:t}),i}static addSchedulerJob(e){if(s(this,G)[w.SchedulerDefinition.fullName]||this.use(w.SchedulerDefinition),s(this,Or).has(e.name))throw new Error(`Job ${e.name} is already defined`);s(this,Or).set(e.name,e.onRun)}static addSettings(e){gr(e);let t=e.filter(n=>n.type==="group"||!n.scope||n.scope==="installation"),i=e.filter(n=>n.type!=="group"&&n.scope==="app");t.length>0&&d(this,_i,t),i.length>0&&d(this,Li,i),s(this,G)[w.SettingsDefinition.fullName]||this.use(w.SettingsDefinition)}static addTrigger(e){if("events"in e){for(let t of e.events)this.addTrigger({event:t,onEvent:(i,n)=>e.onEvent(i,n)});return this}return s(this,Gt).has(e.event)?s(this,Gt).get(e.event)?.push(e.onEvent):s(this,Gt).set(e.event,[e.onEvent]),_}static provide(e){s(this,Fs).push(e)}static use(e,t){s(this,Br)[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,Br)[e.fullName].handler?.[n.name]?.(n.requestType?.fromPartial(o??{}),a);return s(this,G)[e.fullName]=i,i}static get redditAPIPlugins(){if(!gt(s(this,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,G)[w.FlairDefinition.fullName],GraphQL:s(this,G)[w.GraphQLDefinition.fullName],LinksAndComments:s(this,G)[w.LinksAndCommentsDefinition.fullName],Listings:s(this,G)[w.ListingsDefinition.fullName],Moderation:s(this,G)[w.ModerationDefinition.fullName],ModNote:s(this,G)[w.ModNoteDefinition.fullName],NewModmail:s(this,G)[w.NewModmailDefinition.fullName],PrivateMessages:s(this,G)[w.PrivateMessagesDefinition.fullName],Subreddits:s(this,G)[w.SubredditsDefinition.fullName],Users:s(this,G)[w.UsersDefinition.fullName],Widgets:s(this,G)[w.WidgetsDefinition.fullName],Wiki:s(this,G)[w.WikiDefinition.fullName]}}static get modLogPlugin(){let e=s(this,G)[w.ModlogDefinition.fullName];if(!e)throw new Error("ModLog is not enabled. You can enable it by passing `modLog: true` to `Devvit.configure`");return e}static get schedulerPlugin(){let e=s(this,G)[w.SchedulerDefinition.fullName];if(!e)throw new Error("Scheduler is not enabled. You can enable it by calling `Devvit.addSchedulerJob` at the top level of your app.");return e}static get kvStorePlugin(){let e=s(this,G)[w.KVStoreDefinition.fullName];if(!e)throw new Error("Key Value Store is not enabled. You can enable it by passing `kvStore: true` to `Devvit.configure`");return e}static get redisPlugin(){let e=s(this,G)[w.RedisAPIDefinition.fullName];if(!e)throw new Error("Redis is not enabled. You can enable it by passing `redis: true` to `Devvit.configure`");return e}static get mediaPlugin(){let e=s(this,G)[w.MediaServiceDefinition.fullName];if(!e)throw new Error("MediaService is not enabled. You can enable it by passing `media: true` to `Devvit.configure`");return e}static get settingsPlugin(){let e=s(this,G)[w.SettingsDefinition.fullName];if(!e)throw new Error("Settings must first be configured with `Devvit.addSettings()` before they can be accessed");return e}static get realtimePlugin(){let e=s(this,G)[w.RealtimeDefinition.fullName];if(!e)throw new Error("Realtime is not enabled. You can enable it by passing `realtime: true` to `Devvit.configure`");return e}static get menuItems(){return s(this,Hi)}static get customPostType(){return s(this,Er)}static get formDefinitions(){return s(this,Rr)}static get scheduledJobHandlers(){return s(this,Or)}static get installationSettings(){return s(this,_i)}static get appSettings(){return s(this,Li)}static get triggerOnEventHandlers(){return s(this,Gt)}static get assets(){return s(this,xs)}static get webviewAssets(){return s(this,Is)}constructor(e){super(e),d(_,xs,e.assets??{}),d(_,Is,e.webviewAssets??{});for(let t in s(_,Br)){let i=s(_,Br)[t];i.handler=e.use(i.def,i.options)}s(_,Hi).length>0&&Ty(e),s(_,Or).size>0&&Ay(e),s(_,Er)&&(xy(e),ek(e)),(s(_,Er)||s(_,Rr).size>0)&&xb(e),s(_,_i)&&Iy(e),s(_,Li)&&oy(e),s(_,Gt).size>0&&Ey(e);for(let t of s(_,Fs))e.provides(t)}};Li=new WeakMap,xs=new WeakMap,Ni=new WeakMap,Er=new WeakMap,Rr=new WeakMap,_i=new WeakMap,Hi=new WeakMap,Or=new WeakMap,Gt=new WeakMap,Is=new WeakMap,Fs=new WeakMap,Br=new WeakMap,G=new WeakMap,_.debug={},l(_,Li),l(_,xs,{}),l(_,Ni,{}),l(_,Er),l(_,Rr,new Map),l(_,_i),l(_,Hi,[]),l(_,Or,new Map),l(_,Gt,new Map),l(_,Is,{}),l(_,Fs,[]),l(_,Br,{}),l(_,G,{});var u=_;(e=>{function r(t,i,...n){return{type:t,props:i,children:n}}e.createElement=r})(u||(u={}));function Y(r){let e=Object.getOwnPropertyDescriptors(r.constructor.prototype);for(let[t,i]of Object.entries(e))i.get&&Object.defineProperty(r,t,{...i,enumerable:!0})}var um;(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"})(um||(um={}));var tk="text",rk="raw",ik="br",nk="link",sk="c/",ok="p/",ak="r/",dk="u/",lk="@",uk="spoilertext",ck="par",mk="h",pk="hr",gk="blockquote",hk="code",fk="li",vk="list",yk="L",bk="R",kk="C",Sk="table",Pk="embed",Ck="img",wk="gif",xk="video";function Ik(r){return{e:wk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Fk(r,e){let t={},i=[];return Object.assign(t,Ts(t,i),As(t,i),Es(t,i),Bs(t,i),Ms(t,i),Us(t,i)),e(t),{e:gk,c:i,...r.author&&{a:r.author}}}function Tk(r,e){let t={},i=[];return Object.assign(t,mm(t,i)),e(t),{e:hk,c:i,...r.language&&{l:r.language}}}function Ak(r){return{e:sk,t:r.permalink}}function Ek(r,e){let t={},i=[];return Object.assign(t,mm(t,i),Os(t,i)),e(t),{e:mk,l:r.level,c:i}}function Rk(r){return{e:Pk,u:r.sourceUrl,c:r.contentUrl,x:r.width,y:r.height}}function Ok(){return{e:pk}}function Bk(r){return{e:Ck,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur}}}function Mk(){return{e:ik}}function Uk(r){return{e:nk,t:r.text,u:r.url,...r.formatting&&{f:r.formatting},...r.tooltip&&{a:r.tooltip}}}function Dk(r,e){let t={},i=[];return Object.assign(t,Qk(t,i)),e(t),{e:vk,o:r.ordered,c:i}}function Lk(r){let e={},t=[];return Object.assign(e,Ts(e,t),As(e,t),Es(e,t),Bd(e,t),Bs(e,t),Ms(e,t),Us(e,t)),r(e),{e:fk,c:t}}function Nk(r){let e={},t=[];return Object.assign(e,Md(e,t),Os(e,t),cm(e,t),pm(e,t),Rs(e,t)),r(e),{e:ck,c:t}}function _k(r){return{e:ok,t:r.permalink}}function Hk(r){return{e:rk,t:r}}function qk(r){let e={},t=[];return Object.assign(e,Md(e,t),Os(e,t),cm(e,t)),r(e),{e:uk,c:t}}function jk(r){return{e:ak,t:r.subredditName,l:r.showPrefix}}function Wk(r){let e={},t=[],i=[];return Object.assign(e,Yk(e,t,i)),r(e),{e:Sk,h:t,c:i}}function Gk(r){let[e,t]=Zk();return r(e),{c:t}}function Vk(r,e){let[t,i]=Zk();e(t);let n;switch(r.columnAlignment){case"left":n=yk;break;case"right":n=bk;break;case"center":n=kk;break}return{...n&&{a:n},...i&&{c:i}}}function zk(r){let e={},t=[];return Object.assign(e,eS(e,t)),r(e),t}function Jk(r){return{e:tk,t:r.text,...r.formatting&&{f:r.formatting}}}function $k(r){return{e:dk,t:r.username,l:r.showPrefix}}function Kk(r){return{e:lk,t:r.username,l:r.showPrefix}}function Xk(r){return{e:xk,id:r.mediaId,...r.caption&&{c:r.caption},...r.blur&&{o:r.blur},...r.thumbnail&&{p:r.thumbnail},...r.convertToGif&&{gifify:r.convertToGif}}}function Zk(){let r={},e=[];return Object.assign(r,Md(r,e),Os(r,e),pm(r,e),Rs(r,e)),[r,e]}function Ts(r,e){return{blockQuote(t,i){return e.push(Fk(t,i)),r}}}function As(r,e){return{codeBlock(t,i){return e.push(Tk(t,i)),r}}}function tS(r,e){return{embed(t){return e.push(Rk(t)),r}}}function Es(r,e){return{heading(t,i){return e.push(Ek(t,i)),r}}}function Bd(r,e){return{horizontalRule(){return e.push(Ok()),r}}}function Rs(r,e){return{image(t){return e.push(Bk(t)),r},animatedImage(t){return e.push(Ik(t)),r}}}function cm(r,e){return{linebreak(){return e.push(Mk()),r}}}function Os(r,e){return{link(t){return e.push(Uk(t)),r},commentLink(t){return e.push(Ak(t)),r},postLink(t){return e.push(_k(t)),r},subredditLink(t){return e.push(jk(t)),r},userLink(t){return e.push($k(t)),r},userMention(t){return e.push(Kk(t)),r}}}function Bs(r,e){return{list(t,i){return e.push(Dk(t,i)),r}}}function Qk(r,e){return{item(t){return e.push(Lk(t)),r}}}function Ms(r,e){return{paragraph(t){return e.push(Nk(t)),r}}}function mm(r,e){return{rawText(t){return e.push(Hk(t)),r}}}function pm(r,e){return{spoiler(t){return e.push(qk(t)),r}}}function Yk(r,e,t){return{headerCell(i,n){return e.push(Vk(i,n)),r},row(i){return t.push(zk(i)),r}}}function Us(r,e){return{table(t){return e.push(Wk(t)),r}}}function eS(r,e){return{cell(t){return e.push(Gk(t)),r}}}function Md(r,e){return{text(t){return e.push(Jk(t)),r}}}function rS(r,e){return{video(t){return e.push(Xk(t)),r}}}var SR=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},PR=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)},Ud,yt=class{constructor(){Ud.set(this,void 0);let e=[];Object.assign(this,Ms(this,e),Es(this,e),Bd(this,e),Ts(this,e),As(this,e),tS(this,e),Bs(this,e),Us(this,e),Rs(this,e),rS(this,e)),SR(this,Ud,{document:e},"f")}build(){return JSON.stringify(PR(this,Ud,"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}};Ud=new WeakMap;function qi(r){let e;return r instanceof yt?e=r.build():typeof r=="object"?e=JSON.stringify(r):e=r,e}var iS=100,nS=1/0,Mr,Ur,Vt,ji,Wi,Dd,V=class{constructor(e){l(this,Wi);l(this,Mr);l(this,Ur);l(this,Vt);l(this,ji,!1);this.pageSize=iS;this.limit=nS;this.children=[];Y(this),this._fetch=e.fetch,this.pageSize=e.pageSize??iS,this.limit=e.limit??nS,d(this,Ur,e.after),d(this,Mr,e.before),d(this,Vt,e.more),e.children&&(this.children=e.children)}get hasMore(){return!s(this,ji)||!!(s(this,Ur)||s(this,Mr)||s(this,Vt))}async*[Symbol.asyncIterator](){let e=0;for(;;){if(e===this.children.length)if(this.hasMore){if((await S(this,Wi,Dd).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,ji,!0)}async all(){for(;this.hasMore&&this.children.length<this.limit;)await S(this,Wi,Dd).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,Wi,Dd).call(this);return this.children.slice(0,t)}};Mr=new WeakMap,Ur=new WeakMap,Vt=new WeakMap,ji=new WeakMap,Wi=new WeakSet,Dd=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,Mr),after:s(this,Ur),limit:this.pageSize,more:s(this,Vt)});return this.children.push(...e),d(this,Mr,t),d(this,Ur,i),d(this,Vt,n),d(this,ji,!0),e};var Ds,gm,Me=class{constructor(){}static get(e,t){let i=u.redditAPIPlugins.ModNote;return new V({hasMore:!0,before:e.before,limit:e.limit,pageSize:e.limit,fetch:async n=>{let o=await i.GetNotes({subreddit:e.subreddit,user:e.user,filter:e.filter,before:n.before,limit:n.limit},t);return{children:o.modNotes?.map(a=>S(this,Ds,gm).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,Ds,gm).call(this,n.created)}static async addRemovalNote(e,t){await u.redditAPIPlugins.ModNote.PostRemovalNote(e,t)}};Ds=new WeakSet,gm=function(e){return y(e.id,"Mod note ID is null or undefined"),y(e.createdAt,"Mod note createdAt is null or undefined"),y(e.type,"Mod note type is null or undefined"),y(e.subreddit,"Mod note subreddit is null or undefined"),y(e.subredditId,"Mod note subredditId is null or undefined"),y(e.operator,"Mod note operator is null or undefined"),y(e.operatorId,"Mod note operatorId is null or undefined"),y(e.user,"Mod note user is null or undefined"),y(e.userId,"Mod note userId is null or undefined"),y(e.userNoteData,"Mod note userNote is null or undefined"),y(e.modActionData,"Mod note modAction is null or undefined"),{id:e.id,user:{id:oe(e.userId??""),name:e.user},subreddit:{id:ie(e.subredditId??""),name:e.subreddit},operator:{id:oe(e.operatorId??""),name:e.operator},createdAt:new Date(e.createdAt*1e3),userNote:{note:e.userNoteData?.note,redditId:e.userNoteData?.redditId?Re(e.userNoteData?.redditId):void 0,label:e.userNoteData?.label},type:e.type}},l(Me,Ds);var re=class{static queryWithQueryString(e,t){return u.redditAPIPlugins.GraphQL.Query({query:e},t)}static query(e,t,i,n){return u.redditAPIPlugins.GraphQL.PersistedQuery({operationName:e,id:t,variables:i},n)}};var sS=["all","wiki","posts","access","mail","config","flair","channels","chat_config","chat_operator","community_chat"];function CR(r,e){return e.map(t=>(r.includes(t)?"+":"-")+t).join(",")}function hm(r){return CR(r,sS)}function oS(r){return r.filter(e=>sS.includes(e))}var wR=(t=>(t.User="USER_FLAIR",t.Post="LINK_FLAIR",t))(wR||{}),Lr,Gi,Vi,zi,Ji,$i,Ki,Xi,Zi,Qi,Yi,Ld,Ke=class Ke{constructor(e,t,i){l(this,Lr);l(this,Gi);l(this,Vi);l(this,zi);l(this,Ji);l(this,$i);l(this,Ki);l(this,Xi);l(this,Zi);l(this,Qi);Y(this),y(e.id),y(e.text),d(this,Lr,e.id),d(this,Gi,t),d(this,Vi,e.text),d(this,zi,xR(e.textColor)),d(this,Ji,IR(e.backgroundColor)),d(this,$i,FR(e.allowableContent)),d(this,Ki,e.modOnly),d(this,Xi,e.maxEmojis),d(this,Zi,e.textEditable),d(this,Qi,i)}get id(){return s(this,Lr)}get text(){return s(this,Vi)}get textColor(){return s(this,zi)}get backgroundColor(){return s(this,Ji)}get allowableContent(){return s(this,$i)}get modOnly(){return s(this,Ki)}get maxEmojis(){return s(this,Xi)}get allowUserEdits(){return s(this,Zi)}async delete(){return Ke.deleteFlairTemplate(s(this,Lr),s(this,Gi),s(this,Qi))}async edit(e){return Ke.editFlairTemplate({id:s(this,Lr),subredditName:s(this,Gi),text:e.text??s(this,Vi),allowableContent:e.allowableContent??s(this,$i),backgroundColor:e.backgroundColor??s(this,Ji),maxEmojis:e.maxEmojis??s(this,Xi),modOnly:e.modOnly??s(this,Ki),textColor:e.textColor??s(this,zi),allowUserEdits:e.allowUserEdits??s(this,Zi)},s(this,Qi))}static async createPostFlairTemplate(e,t){var i;return S(i=Ke,Yi,Ld).call(i,{...e,flairType:"LINK_FLAIR"},t)}static async createUserFlairTemplate(e,t){var i;return S(i=Ke,Yi,Ld).call(i,{...e,flairType:"USER_FLAIR"},t)}static async editFlairTemplate(e,t){var i;return S(i=Ke,Yi,Ld).call(i,e,t)}static async getPostFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.LinkFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async getUserFlairTemplates(e,t){return(await u.redditAPIPlugins.Flair.UserFlair({subreddit:e},t)).flair?.map(o=>new Ke(o,e,t))||[]}static async deleteFlairTemplate(e,t,i){await u.redditAPIPlugins.Flair.DeleteFlairTemplate({subreddit:e,flairTemplateId:t},i)}};Lr=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,zi=new WeakMap,Ji=new WeakMap,$i=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,Yi=new WeakSet,Ld=async function(e,t){let{subredditName:i,allowableContent:n="all",backgroundColor:o="transparent",flairType:a="",maxEmojis:c=10,modOnly:p=!1,text:g,textColor:f="dark",allowUserEdits:m=!1,id:b=""}=e;if(p&&m)throw new Error("Cannot have a mod only flair that is editable by users");let P=await u.redditAPIPlugins.Flair.FlairTemplate({subreddit:i,allowableContent:n,backgroundColor:o,flairType:a,maxEmojis:c,modOnly:p,text:g,textColor:f,textEditable:m,flairTemplateId:b,cssClass:"",overrideCss:!1},t);return new Ke(P,i,t)},l(Ke,Yi);var ue=Ke;function Ls(r){return{flairCssClass:r.flairCssClass,user:r.user,flairText:r.flairText}}var zt,fm,vm,Dr=class Dr{static async getUserFlairBySubreddit(e,t){return u.redditAPIPlugins.Flair.FlairList(e,t)}static setUserFlair(e,t){var i;return S(i=Dr,zt,fm).call(i,e,t)}static setPostFlair(e,t){var i;return S(i=Dr,zt,fm).call(i,{...e,postId:ye(e.postId)},t)}static async removePostFlair(e,t,i){var n;return S(n=Dr,zt,vm).call(n,e,t,void 0,i)}static async removeUserFlair(e,t,i){var n;return S(n=Dr,zt,vm).call(n,e,void 0,t,i)}};zt=new WeakSet,fm=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)},vm=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(Dr,zt);var Ue=Dr;function xR(r){if(y(r,"Flair text color is required"),r==="light"||r==="dark")return r;throw new Error(`Invalid flair text color: ${r}`)}function IR(r){if(!r||r.length===0||r==="transparent")return"transparent";if(/^#([A-Fa-f0-9]{6})$/.test(r))return r;throw new Error(`Invalid flair background color: ${r}`)}function FR(r){if(r==="all"||r==="text"||r==="emoji")return r;throw new Error(`Invalid allowable content: ${r}`)}import{Block as uS,CustomPostDefinition as DR,Definition as LR,UIEventHandlerDefinition as NR,UIResponse as _R}from"@devvit/protos";import{LinkedBundle as cS}from"@devvit/protos/types/devvit/runtime/bundle.js";var en=Ln(lS(),1);var bm=r=>"text"in r?r.text:UR(r.richtext),UR=r=>r instanceof yt?r.build():typeof r=="object"?JSON.stringify(r):r;var tn,_s,rn,Hs,nn,qs,js,Ws,Jt,Gs,Vs,zs,Js,$s,Ks,$t,Xs,Zs,_r,sn,Kt,on,an,dn,bt,Xt,Zt,ln,Qt,Yt,er,kt,Qs,Ys,un,cn,N,L=class L{constructor(e,t){l(this,tn);l(this,_s);l(this,rn);l(this,Hs);l(this,nn);l(this,qs);l(this,js);l(this,Ws);l(this,Jt);l(this,Gs);l(this,Vs);l(this,zs);l(this,Js);l(this,$s);l(this,Ks);l(this,$t);l(this,Xs);l(this,Zs);l(this,_r);l(this,sn);l(this,Kt);l(this,on);l(this,an);l(this,dn);l(this,bt);l(this,Xt);l(this,Zt);l(this,ln);l(this,Qt);l(this,Yt);l(this,er);l(this,kt);l(this,Qs);l(this,Ys);l(this,un);l(this,cn);l(this,N);Y(this),y(e.id,"Post is missing id"),y(e.title,"Post is missing title"),y(e.createdUtc,"Post is missing created date"),y(e.author,"Post is missing author name"),y(e.subreddit,"Post is missing subreddit name"),y(e.subredditId,"Post is missing subreddit id"),y(e.url,"Post is missing url"),y(e.permalink,"Post is missing permalink"),d(this,tn,ye(`t3_${e.id}`)),d(this,rn,e.author),d(this,_s,e.authorFullname?oe(e.authorFullname):void 0),d(this,nn,ie(e.subredditId)),d(this,qs,e.subreddit),d(this,zs,e.score??0),d(this,Js,e.numComments??0),d(this,$s,e.numReports??0);let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Hs,i),d(this,Ws,e.title),d(this,Jt,e.selftext),d(this,Gs,e.selftextHtml),d(this,Vs,e.url),d(this,js,e.permalink),e.thumbnail&&e.thumbnail!=="self"&&e.thumbnail!=="nsfw"&&e.thumbnailHeight!=null&&e.thumbnailWidth!=null&&d(this,Ks,{url:e.thumbnail,height:e.thumbnailHeight,width:e.thumbnailWidth}),d(this,$t,e.approved??!1),d(this,Xs,e.approvedAtUtc??0),d(this,Zs,e.bannedAtUtc??0),d(this,Kt,e.removed??!1),d(this,on,e.removedBy),d(this,an,e.removedByCategory),d(this,_r,e.spam??!1),d(this,sn,e.stickied??!1),d(this,dn,e.archived??!1),d(this,bt,e.edited??!1),d(this,Xt,e.locked??!1),d(this,Zt,e.over18??!1),d(this,ln,e.quarantine??!1),d(this,Qt,e.spoiler),d(this,Yt,e.hidden??!1),d(this,er,e.ignoreReports??!1),d(this,kt,e.distinguished),d(this,Ys,e.secureMedia),d(this,un,(e.modReports??[]).map(([n])=>n)),d(this,cn,(e.userReports??[]).map(([n])=>n)),d(this,N,t),(e.linkFlairBackgroundColor||e.linkFlairCssClass||e.linkFlairText||e.linkFlairType||e.linkFlairTemplateId||e.linkFlairRichtext||e.linkFlairTextColor)&&d(this,Qs,{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,_s)}get authorName(){return s(this,rn)}get subredditId(){return s(this,nn)}get subredditName(){return s(this,qs)}get permalink(){return s(this,js)}get title(){return s(this,Ws)}get body(){return s(this,Jt)}get bodyHtml(){return s(this,Gs)}get url(){return s(this,Vs)}get thumbnail(){return s(this,Ks)}get createdAt(){return s(this,Hs)}get score(){return s(this,zs)}get numberOfComments(){return s(this,Js)}get numberOfReports(){return s(this,$s)}get approved(){return s(this,$t)}get approvedAtUtc(){return s(this,Xs)}get bannedAtUtc(){return s(this,Zs)}get spam(){return s(this,_r)}get stickied(){return s(this,sn)}get removed(){return s(this,Kt)}get removedBy(){return s(this,on)}get removedByCategory(){return s(this,an)}get archived(){return s(this,dn)}get edited(){return s(this,bt)}get locked(){return s(this,Xt)}get nsfw(){return s(this,Zt)}get quarantined(){return s(this,ln)}get spoiler(){return s(this,Qt)}get hidden(){return s(this,Yt)}get ignoringReports(){return s(this,er)}get distinguishedBy(){return s(this,kt)}get comments(){return te.getComments({postId:this.id},s(this,N))}get flair(){return s(this,Qs)}get secureMedia(){return s(this,Ys)}get userReportReasons(){return s(this,cn)}get modReportReasons(){return s(this,un)}toJSON(){return{id:this.id,authorId:this.authorId,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,permalink:this.permalink,title:this.title,body:this.body,bodyHtml:this.bodyHtml,url:this.url,thumbnail:this.thumbnail,score:this.score,numberOfComments:this.numberOfComments,numberOfReports:this.numberOfReports,createdAt:this.createdAt,approved:this.approved,spam:this.spam,stickied:this.stickied,removed:this.removed,removedBy:s(this,on),removedByCategory:s(this,an),archived:this.archived,edited:this.edited,locked:this.locked,nsfw:this.nsfw,quarantined:this.quarantined,spoiler:this.spoiler,hidden:this.hidden,ignoringReports:this.ignoringReports,distinguishedBy:this.distinguishedBy,flair:this.flair,secureMedia:this.secureMedia,modReportReasons:s(this,un),userReportReasons:s(this,cn)}}isApproved(){return s(this,$t)}isSpam(){return s(this,_r)}isStickied(){return s(this,sn)}isRemoved(){return s(this,Kt)}isArchived(){return s(this,dn)}isEdited(){return s(this,bt)}isLocked(){return s(this,Xt)}isNsfw(){return s(this,Zt)}isQuarantined(){return s(this,ln)}isSpoiler(){return s(this,Qt)}isHidden(){return s(this,Yt)}isIgnoringReports(){return s(this,er)}isDistinguishedBy(){return s(this,kt)}async edit(e){let t=await L.edit({id:this.id,...e},s(this,N));d(this,Jt,t.body),d(this,bt,t.edited)}async setSuggestedCommentSort(e){await L.setSuggestedCommentSort({id:this.id,subredditId:s(this,nn),suggestedSort:e},s(this,N))}async setCustomPostPreview(e){let t=await L.setCustomPostPreview({id:this.id,body:this.body,ui:e},s(this,N));d(this,Jt,t.body),d(this,bt,t.edited)}async setTextFallback(e){let t=await L.setTextFallback(e,this.id,s(this,N));d(this,Jt,t.body),d(this,bt,t.edited)}async addComment(e){return te.submit({id:this.id,...e},s(this,N))}async delete(){return L.delete(this.id,s(this,N))}async approve(){await L.approve(this.id,s(this,N)),d(this,$t,!0),d(this,Kt,!1)}async remove(e=!1){await L.remove(this.id,e,s(this,N)),d(this,Kt,!0),d(this,_r,e),d(this,$t,!1)}async lock(){await L.lock(this.id,s(this,N)),d(this,Xt,!0)}async unlock(){await L.unlock(this.id,s(this,N)),d(this,Xt,!1)}async hide(){await L.hide(this.id,s(this,N)),d(this,Yt,!0)}async unhide(){await L.unhide(this.id,s(this,N)),d(this,Yt,!1)}async markAsNsfw(){await L.markAsNsfw(this.id,s(this,N)),d(this,Zt,!0)}async unmarkAsNsfw(){await L.unmarkAsNsfw(this.id,s(this,N)),d(this,Zt,!1)}async markAsSpoiler(){await L.markAsSpoiler(this.id,s(this,N)),d(this,Qt,!0)}async unmarkAsSpoiler(){await L.unmarkAsSpoiler(this.id,s(this,N)),d(this,Qt,!1)}async sticky(e){await L.sticky(this.id,e,s(this,N))}async unsticky(){await L.unsticky(this.id,s(this,N))}async distinguish(){let{distinguishedBy:e}=await L.distinguish(this.id,!1,s(this,N));d(this,kt,e)}async distinguishAsAdmin(){let{distinguishedBy:e}=await L.distinguish(this.id,!0,s(this,N));d(this,kt,e)}async undistinguish(){let{distinguishedBy:e}=await L.undistinguish(this.id,s(this,N));d(this,kt,e)}async ignoreReports(){await L.ignoreReports(this.id,s(this,N)),d(this,er,!0)}async unignoreReports(){await L.unignoreReports(this.id,s(this,N)),d(this,er,!1)}async getAuthor(){return x.getByUsername(s(this,rn),s(this,N))}async crosspost(e){return L.crosspost({...e,postId:this.id},s(this,N))}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,tn)],...e},s(this,N))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=pr(e)?e:`t3_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.length)throw new Error("could not find post");let a=o.data.children[0];if(!a?.data)throw new Error("could not find post");return new L(a.data,t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,n;if("preview"in e){y(t,"Missing metadata in `SubmitPostOptions`");let c=await new pt(()=>e.preview,void 0,{},t,void 0).buildBlocksUI(),p=uS.encode(c).finish(),{textFallback:g,...f}=e,m=g?bm(g):"",b={kind:"custom",sr:e.subredditName,richtextJson:(0,en.fromByteArray)(p),richtextFallback:m,...f};n=await i.SubmitCustomPost(b,t)}else n=await i.Submit({kind:"kind"in e?e.kind:"url"in e?"link":"self",sr:e.subredditName,richtextJson:"richtext"in e?qi(e.richtext):void 0,...e},t);if("kind"in e&&["image","video","videogif"].includes(e.kind)&&!n.json?.data?.id&&"url"in e)throw new Error(`Post of ${e.kind} type with ${e.url} is being created asynchronously and should be updated in the subreddit soon.`);if(!n.json?.data?.id||n.json?.errors?.length)throw new Error(`failed to submit post - either post ID is empty or request failed with errors: ${n.json?.errors}`);return L.getById(`t3_${n.json.data.id}`,t)}static async crosspost(e,t){let i=u.redditAPIPlugins.LinksAndComments,{postId:n,subredditName:o,...a}=e,c=await i.Submit({kind:"crosspost",sr:o,crosspostFullname:ye(n),...a},t);if(!c.json?.data?.id||c.json?.errors?.length)throw new Error("failed to crosspost post");return L.getById(`t3_${c.json.data.id}`,t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;if("richtext"in e&&(o=qi(e.richtext)),(await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t)).json?.errors?.length)throw new Error("Failed to edit post");return L.getById(n,t)}static async setSuggestedCommentSort(e,t){if(!(await re.query("SetSuggestedSort","cf6052acc7fefaa65b710625b81dba8041f258313aafe9730e2a3dc855e5d10d",{input:{subredditId:e.subredditId,postId:e.id,sort:e.suggestedSort}},t)).data?.setSuggestedSort?.ok)throw new Error("Failed to set suggested sort")}static async setCustomPostPreview(e,t){if(!t)throw new Error("Failed to set custom post preview. Metadata not found");let i=new RegExp(/DX_Bundle:\n\n {4}(?<bundle>[^\n]*)/g).exec(e.body??"");if(!i?.groups?.bundle)throw new Error(`Failed to set custom post preview. Couldn't find bundle in post ${e.id}`);let n=(0,en.toByteArray)(i.groups.bundle),o=cS.decode(n);o.provides=[DR,NR].map(I=>LR.toSerializable(I));let a=(0,en.fromByteArray)(cS.encode(o).finish()),p=new RegExp(/DX_RichtextFallback:\n\n {4}(?<fallback>[^\n]*)/g).exec(e.body??"")?.groups?.fallback,g=new Ar(e.ui),m=_R.fromJSON(await g.handle({events:[]},t)).blocks,b=(0,en.fromByteArray)(uS.encode(m).finish()),v=new yt().heading({level:1},I=>I.rawText("DX_Bundle:")).codeBlock({language:""},I=>{I.rawText(a)}).heading({level:1},I=>I.rawText("DX_Config:")).codeBlock({language:""},I=>{I.rawText("EgA=")}).heading({level:1},I=>I.rawText("DX_Cached:")).codeBlock({language:""},I=>{I.rawText(b)});if(p&&v.heading({level:1},I=>I.rawText("DX_RichtextFallback:")).codeBlock({language:""},I=>{I.rawText(p)}),!(await re.query("UpdatePost","ccc5f1da31a8d8c518b6607e81c2903a46f922cb6562c8b47fcc8988f0611360",{input:{postId:e.id,content:{richText:v.build()}}},t)).data?.updatePost?.ok)throw new Error("Failed to set custom post preview");return L.getById(e.id,t)}static async setTextFallback(e,t,i){if(!("text"in e)&&!("richtext"in e))throw new Error(`No text fallback provided for post ${t}.`);let n=u.redditAPIPlugins.LinksAndComments,o=bm(e);if((await n.EditCustomPost({thingId:t,richtextFallback:o},i)).json?.errors?.length)throw new Error("Failed to set post text fallback");return L.getById(t,i)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async hide(e,t){await u.redditAPIPlugins.LinksAndComments.Hide({id:e},t)}static async unhide(e,t){await u.redditAPIPlugins.LinksAndComments.Unhide({id:e},t)}static async markAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.MarkNSFW({id:e},t)}static async unmarkAsNsfw(e,t){await u.redditAPIPlugins.LinksAndComments.UnmarkNSFW({id:e},t)}static async markAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Spoiler({id:e},t)}static async unmarkAsSpoiler(e,t){await u.redditAPIPlugins.LinksAndComments.Unspoiler({id:e},t)}static async sticky(e,t,i){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!0,num:t},i)}static async unsticky(e,t){await u.redditAPIPlugins.LinksAndComments.SetSubredditSticky({id:e,state:!1},t)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async distinguish(e,t,i){let a=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:t?"admin":"yes",sticky:!1},i)).json?.data?.things?.[0]?.data;return y(a),{distinguishedBy:a.distinguished}}static async undistinguish(e,t){let o=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return y(o),{distinguishedBy:o.distinguished}}static async ignoreReports(e,t){await u.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await u.redditAPIPlugins.Moderation.UnignoreReports({id:e},t)}static getControversialPosts(e={},t){return this.getSortedPosts({...e,sort:"controversial"},t)}static getTopPosts(e={},t){return this.getSortedPosts({...e,sort:"top"},t)}static getSortedPosts(e,t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Sort({show:"all",sort:e.sort,t:e.timeframe,subreddit:e.subredditName,...n},t);return Ns(o,t)}})}static getHotPosts(e={location:"GLOBAL"},t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Hot({g:e.location,show:"all",subreddit:e.subredditName,...n},t);return Ns(o,t)}})}static getNewPosts(e,t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.New({show:"all",subreddit:e.subredditName,...n},t);return Ns(o,t)}})}static getRisingPosts(e,t){let i=u.redditAPIPlugins.Listings;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,fetch:async n=>{let o=await i.Rising({show:"all",subreddit:e.subredditName,...n},t);return Ns(o,t)}})}static getPostsByUser(e,t){let i=u.redditAPIPlugins.Users;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"submitted",...n},t);return Ns(o,t)}})}};tn=new WeakMap,_s=new WeakMap,rn=new WeakMap,Hs=new WeakMap,nn=new WeakMap,qs=new WeakMap,js=new WeakMap,Ws=new WeakMap,Jt=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,zs=new WeakMap,Js=new WeakMap,$s=new WeakMap,Ks=new WeakMap,$t=new WeakMap,Xs=new WeakMap,Zs=new WeakMap,_r=new WeakMap,sn=new WeakMap,Kt=new WeakMap,on=new WeakMap,an=new WeakMap,dn=new WeakMap,bt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,ln=new WeakMap,Qt=new WeakMap,Yt=new WeakMap,er=new WeakMap,kt=new WeakMap,Qs=new WeakMap,Ys=new WeakMap,un=new WeakMap,cn=new WeakMap,N=new WeakMap;var z=L;function Ns(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 HR=(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))(HR||{}),eo,mn,to,ro,io,no,so,tr,oo,ao,ot,Hr=class Hr{constructor(e,t){l(this,eo);l(this,mn);l(this,to);l(this,ro);l(this,io);l(this,no);l(this,so);l(this,tr,new Map);l(this,oo);l(this,ao);l(this,ot);Y(this),y(e.id,"User ID is missing or undefined"),y(e.name,"Username is missing or undefined"),y(e.createdUtc,"User is missing created date"),d(this,eo,oe(Xa(e.id)?e.id:`t2_${e.id}`)),d(this,mn,e.name),d(this,no,e.over18??!1),d(this,so,e.isEmployee??!1);let i=new Date(0);if(i.setUTCSeconds(e.createdUtc),d(this,to,i),d(this,ro,e.linkKarma??0),d(this,io,e.commentKarma??0),e.modPermissions)for(let[n,o]of Object.entries(e.modPermissions))s(this,tr).set(n,oS(o));d(this,oo,new URL(e.subreddit?.url??"","https://www.reddit.com").toString()),d(this,ao,e.subreddit?.url??""),d(this,ot,t)}get id(){return s(this,eo)}get username(){return s(this,mn)}get createdAt(){return s(this,to)}get linkKarma(){return s(this,ro)}get commentKarma(){return s(this,io)}get nsfw(){return s(this,no)}get isAdmin(){return s(this,so)}get modPermissions(){return s(this,tr)}get url(){return s(this,oo)}get permalink(){return s(this,ao)}toJSON(){return{id:this.id,username:this.username,createdAt:this.createdAt,linkKarma:this.linkKarma,commentKarma:this.commentKarma,nsfw:this.nsfw,modPermissionsBySubreddit:Object.fromEntries(this.modPermissions)}}async getModPermissionsForSubreddit(e){if(s(this,tr).has(e))return s(this,tr).get(e);let t=await Hr.getSubredditUsersByType({subredditName:e,type:"moderators",username:this.username},s(this,ot)).all();if(t.length===0)return[];let i=t[0].modPermissions.get(e)??[];return i.length>0&&s(this,tr).set(e,i),i}getComments(e){return te.getCommentsByUser({username:this.username,...e},s(this,ot))}getPosts(e){return z.getPostsByUser({username:this.username,...e},s(this,ot))}async getUserFlairBySubreddit(e){let t=await Ue.getUserFlairBySubreddit({subreddit:e,name:s(this,mn)},s(this,ot));return t.users[0]?Ls(t.users[0]):void 0}getSnoovatarUrl(){return Hr.getSnoovatarUrl(this.username,s(this,ot))}async getSocialLinks(){let i=await re.query("GetUserSocialLinks","2aca18ef5f4fc75fb91cdaace3e9aeeae2cb3843b5c26ad511e6f01b8521593a",{name:this.username},s(this,ot));return i.data?.user?.profile?.socialLinks?i.data.user.profile.socialLinks.map(n=>({...n,handle:n.handle??void 0})):[]}static async getById(e,t){let o=(await u.redditAPIPlugins.Users.UserDataByAccountIds({ids:e},t))?.users?.[e]?.name;return o==null?void 0:Hr.getByUsername(o,t)}static async getByUsername(e,t){let n=await u.redditAPIPlugins.Users.UserAbout({username:e},t);if(n.data?.id)return new Hr(n.data,t)}static async getFromMetadata(e,t){y(t);let i=t?.[e]?.values[0];return i?Hr.getById(oe(i),t):Promise.resolve(void 0)}static getSubredditUsersByType(e,t){let i=u.redditAPIPlugins.Subreddits;return new V({hasMore:!0,pageSize:e.pageSize,limit:e.limit,after:e.after,before:e.before,fetch:async n=>{let o=await i.AboutWhere({where:e.type,user:e.username,subreddit:e.subredditName,show:"all",...n},t);return jR(o,e.subredditName,t)}})}static async createRelationship(e,t){let i=u.redditAPIPlugins.Users,{type:n,subredditName:o,username:a,permissions:c,...p}=e,g=await i.Friend({type:n,subreddit:o,name:a,permissions:c?hm(c):void 0,...p},t);if(g.json?.errors?.length)throw new Error(g.json.errors.join(`
|
4
4
|
`))}static async removeRelationship(e,t){await u.redditAPIPlugins.Users.Unfriend({type:e.type,subreddit:e.subredditName,name:e.username},t)}static async setModeratorPermissions(e,t,i,n){let a=await u.redditAPIPlugins.Users.SetPermissions({subreddit:t,name:e,type:"moderator",permissions:hm(i)},n);if(a.json?.errors?.length)throw new Error(a.json.errors.join(`
|
5
5
|
`))}static async getSnoovatarUrl(e,t){return(await re.query("GetSnoovatarUrlByName","c47fd42345af268616d2d8904b56856acdc05cf61d3650380f539ad7d596ac0c",{username:e},t)).data?.redditorInfoByName?.snoovatarIcon?.url}static getOverview(e,t){let i=u.redditAPIPlugins.Users;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"overview",...n},t);return qR(o,t)}})}};eo=new WeakMap,mn=new WeakMap,to=new WeakMap,ro=new WeakMap,io=new WeakMap,no=new WeakMap,so=new WeakMap,tr=new WeakMap,oo=new WeakMap,ao=new WeakMap,ot=new WeakMap;var x=Hr;function qR(r,e){if(!r.data?.children)throw new Error("Listing response is missing children");return{children:r.data.children.map(i=>{if(i.kind==="t3")return new z(i.data,e);if(i.kind==="t1")return new te(i.data,e);throw new Error(`Type ${i.kind} is not supported`)}),before:r.data.before,after:r.data.after}}async function jR(r,e,t){let i=u.redditAPIPlugins.Users;if(!r.data?.children)throw new Error("Listing response is missing children");let n=r.data.children.map(f=>(y(f.data?.id,"User id is still from listing data"),f.data.id)),o=100,a=[];for(let f=0;f<n.length;f+=o)a.push(n.slice(f,f+o));let p=(await Promise.all(a.map(f=>i.UserDataByAccountIds({ids:f.join(",")},t)))).reduce((f,m)=>({...f,...m.users}),{});return{children:r.data.children.map(f=>{let m=f.data?.id;y(m,"User id is missing from listing");let b=p[m];return y(b,"User data is missing from response"),new x({id:m,name:b.name,linkKarma:b.linkKarma,commentKarma:b.commentKarma,createdUtc:b.createdUtc,over18:b.profileOver18,snoovatarSize:[],modPermissions:{[e]:f.data?.modPermissions??[]}},t)}),before:r.data.before,after:r.data.after}}var qr,lo,pn,gn,uo,co,hn,mo,po,fn,rr,go,ho,jr,ir,nr,St,Wr,Pt,fo,vo,yo,bo,ko,So,Po,sr,ee,at,_d,Hd,j=class j{constructor(e,t){l(this,qr);l(this,lo);l(this,pn);l(this,gn);l(this,uo);l(this,co);l(this,hn);l(this,mo);l(this,po);l(this,fn);l(this,rr);l(this,go);l(this,ho);l(this,jr);l(this,ir);l(this,nr);l(this,St);l(this,Wr);l(this,Pt);l(this,fo);l(this,vo);l(this,yo);l(this,bo);l(this,ko);l(this,So);l(this,Po);l(this,sr);l(this,ee);var n;Y(this),y(e.id,"Comment id is null or undefined"),y(e.body,"Comment body is null or undefined"),y(e.createdUtc,"Comment is missing created date"),y(e.author,"Comment author is null or undefined"),y(e.parentId,"Comment parentId is null or undefined"),y(e.linkId,"Comment linkId is null or undefined"),y(e.permalink,"Comment permalink is null or undefined"),y(e.subreddit,"Comment is missing subreddit name"),y(e.subredditId,"Comment is missing subreddit id"),d(this,qr,ni(`t1_${e.id}`)),d(this,lo,e.authorFullname?oe(e.authorFullname):void 0),d(this,pn,e.author),d(this,gn,e.body),d(this,mo,ie(e.subredditId)),d(this,po,e.subreddit),d(this,co,ec(e.parentId)?ni(e.parentId):ye(e.parentId)),d(this,hn,ye(e.linkId)),d(this,jr,e.edited??!1),d(this,ir,e.locked??!1),d(this,nr,e.removed??!1),d(this,St,e.stickied??!1),d(this,rr,e.approved??!1),d(this,go,e.approvedAtUtc??0),d(this,ho,e.bannedAtUtc??0),d(this,Wr,e.spam??!1),d(this,Pt,e.distinguished),d(this,fo,e.numReports??0),d(this,vo,e.collapsedBecauseCrowdControl??!1),d(this,yo,e.score??0),d(this,bo,e.permalink),d(this,Po,new URL(e.permalink??"","https://www.reddit.com/").toString()),d(this,sr,e.ignoreReports??!1),d(this,ko,(e.modReports??[]).map(([o])=>o)),d(this,So,(e.userReports??[]).map(([o])=>o));let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,uo,i),d(this,fn,S(n=j,at,_d).call(n,{postId:s(this,hn),commentId:s(this,qr)},t)),d(this,ee,t)}get id(){return s(this,qr)}get authorId(){return s(this,lo)}get authorName(){return s(this,pn)}get subredditId(){return s(this,mo)}get subredditName(){return s(this,po)}get body(){return s(this,gn)}get createdAt(){return s(this,uo)}get parentId(){return s(this,co)}get postId(){return s(this,hn)}get replies(){return s(this,fn)}get distinguishedBy(){return s(this,Pt)}get locked(){return s(this,ir)}get stickied(){return s(this,St)}get removed(){return s(this,nr)}get approved(){return s(this,rr)}get approvedAtUtc(){return s(this,go)}get bannedAtUtc(){return s(this,ho)}get spam(){return s(this,Wr)}get edited(){return s(this,jr)}get numReports(){return s(this,fo)}get collapsedBecauseCrowdControl(){return s(this,vo)}get score(){return s(this,yo)}get permalink(){return s(this,bo)}get userReportReasons(){return s(this,So)}get modReportReasons(){return s(this,ko)}get url(){return s(this,Po)}get ignoringReports(){return s(this,sr)}toJSON(){return{id:this.id,authorName:this.authorName,subredditId:this.subredditId,subredditName:this.subredditName,body:this.body,createdAt:this.createdAt,parentId:this.parentId,postId:this.postId,replies:this.replies,approved:this.approved,locked:this.locked,removed:this.removed,stickied:this.stickied,spam:this.spam,edited:this.edited,distinguishedBy:this.distinguishedBy,numReports:this.numReports,collapsedBecauseCrowdControl:this.collapsedBecauseCrowdControl,score:this.score,permalink:this.permalink,modReportReasons:this.modReportReasons,userReportReasons:this.userReportReasons,url:this.url,ignoringReports:this.ignoringReports}}isLocked(){return s(this,ir)}isApproved(){return s(this,rr)}isRemoved(){return s(this,nr)}isSpam(){return s(this,Wr)}isStickied(){return s(this,St)}isDistinguished(){return!!s(this,Pt)}isEdited(){return s(this,jr)}isIgnoringReports(){return s(this,sr)}async delete(){return j.delete(this.id,s(this,ee))}async edit(e){let t=await j.edit({id:this.id,...e},s(this,ee));return d(this,gn,t.body),d(this,jr,t.edited),this}async approve(){await j.approve(this.id,s(this,ee)),d(this,rr,!0),d(this,nr,!1)}async remove(e=!1){await j.remove(this.id,e,s(this,ee)),d(this,nr,!0),d(this,Wr,e),d(this,rr,!1)}async lock(){await j.lock(this.id,s(this,ee)),d(this,ir,!0)}async unlock(){await j.unlock(this.id,s(this,ee)),d(this,ir,!1)}async reply(e){return j.submit({id:this.id,...e},s(this,ee))}async getAuthor(){return x.getByUsername(s(this,pn),s(this,ee))}async distinguish(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!1,s(this,ee));d(this,Pt,t),d(this,St,i)}async distinguishAsAdmin(e=!1){let{distinguishedBy:t,stickied:i}=await j.distinguish(this.id,e,!0,s(this,ee));d(this,Pt,t),d(this,St,i)}async undistinguish(){let{distinguishedBy:e,stickied:t}=await j.undistinguish(this.id,s(this,ee));d(this,Pt,e),d(this,St,t)}async ignoreReports(){await j.ignoreReports(this.id,s(this,ee)),d(this,sr,!0)}async unignoreReports(){await j.unignoreReports(this.id,s(this,ee)),d(this,sr,!1)}addRemovalNote(e){return Me.addRemovalNote({itemIds:[s(this,qr)],...e},s(this,ee))}static async getById(e,t){let i=u.redditAPIPlugins.LinksAndComments,n=It(e)?e:`t1_${e}`,o=await i.Info({subreddits:[],thingIds:[n]},t);if(!o.data?.children?.[0]?.data)throw new Error("not found");return new j(o.data.children[0].data,t)}static getComments(e,t){var a;let{postId:i,commentId:n,...o}=e;return S(a=j,at,_d).call(a,{postId:ye(i),commentId:n?ni(n):void 0,...o},t)}static async edit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=qi(e.richtext));let a=await i.EditUserText({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("Failed to edit comment");let c=a.json?.data?.things?.[0]?.data;return y(c),new j(c,t)}static async delete(e,t){await u.redditAPIPlugins.LinksAndComments.Del({id:e},t)}static async approve(e,t){await u.redditAPIPlugins.Moderation.Approve({id:e},t)}static async remove(e,t=!1,i){await u.redditAPIPlugins.Moderation.Remove({id:e,spam:t},i)}static async lock(e,t){await u.redditAPIPlugins.LinksAndComments.Lock({id:e},t)}static async unlock(e,t){await u.redditAPIPlugins.LinksAndComments.Unlock({id:e},t)}static async submit(e,t){let i=u.redditAPIPlugins.LinksAndComments,{id:n}=e,o;"richtext"in e&&(o=qi(e.richtext));let a=await i.Comment({thingId:n,text:"text"in e?e.text:"",richtextJson:o},t);if(a.json?.errors?.length)throw new Error("failed to reply to comment");let c=a.json?.data?.things?.[0]?.data;return y(c),new j(c,t)}static async distinguish(e,t,i,n){let c=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:i?"admin":"yes",sticky:t},n)).json?.data?.things?.[0]?.data;return y(c),{distinguishedBy:c.distinguished,stickied:!!c.stickied}}static async undistinguish(e,t){let o=(await u.redditAPIPlugins.Moderation.Distinguish({id:e,how:"no",sticky:!1},t)).json?.data?.things?.[0]?.data;return y(o),{distinguishedBy:o.distinguished,stickied:!!o.stickied}}static getCommentsByUser(e,t){let i=u.redditAPIPlugins.Users;return new V({hasMore:!0,before:e.before,after:e.after,pageSize:e.pageSize,limit:e.limit,async fetch(n){let o=await i.UserWhere({username:e.username,where:"comments",...n},t);return y(o.data,"Failed to get comments for user"),{children:o.data.children?.map(c=>new j(c.data,t))||[],before:o.data.before,after:o.data.after}}})}static async ignoreReports(e,t){await u.redditAPIPlugins.Moderation.IgnoreReports({id:e},t)}static async unignoreReports(e,t){await u.redditAPIPlugins.Moderation.UnignoreReports({id:e},t)}};qr=new WeakMap,lo=new WeakMap,pn=new WeakMap,gn=new WeakMap,uo=new WeakMap,co=new WeakMap,hn=new WeakMap,mo=new WeakMap,po=new WeakMap,fn=new WeakMap,rr=new WeakMap,go=new WeakMap,ho=new WeakMap,jr=new WeakMap,ir=new WeakMap,nr=new WeakMap,St=new WeakMap,Wr=new WeakMap,Pt=new WeakMap,fo=new WeakMap,vo=new WeakMap,yo=new WeakMap,bo=new WeakMap,ko=new WeakMap,So=new WeakMap,Po=new WeakMap,sr=new WeakMap,ee=new WeakMap,at=new WeakSet,_d=function(e,t,i=0){return new V({limit:e.limit,pageSize:e.pageSize,fetch:async n=>{var b,v;let o=n.limit,a=u.redditAPIPlugins.Listings,c=u.redditAPIPlugins.LinksAndComments,p=e.commentId;if(n.more)if(n.more.children.length){let P=n.more;(!o||o>100)&&(o=100);let C=P.children.splice(0,o),F=await c.MoreChildren({linkId:e.postId,children:C,sort:e.sort},t);if(!F.json?.data?.things?.length)return{children:[]};let{children:I}=S(b=j,at,Hd).call(b,F.json.data.things,e.postId,e,t);return{children:I,more:P.children.length?P:void 0}}else p=n.more.parentId,i=i+n.more.depth;let f=(await a.Comments({article:e.postId.substring(3),comment:p?.substring(3),limit:o,depth:e.depth,sort:e.sort},t)).listings?.[1]?.data?.children??[],m=f[0];return p&&m?.data?.replyList?.data&&(f=m.data.replyList.data.children),S(v=j,at,Hd).call(v,f,p??e.postId,e,t,i)}})},Hd=function(e,t,i,n,o=0){var g,f;let a=[],c,p={};for(let m of e){if(!m.data||(m.data.depth!=null&&(m.data.depth=m.data.depth+o),m.data.depth!=null&&i.depth!=null&&m.data.depth>=i.depth))continue;let b=m.data.parentId?p[m.data.parentId]:void 0;if(m.kind==="t1"){if(m.data.name===t)continue;let v=new j(m.data,n);if(p[v.id]=v,d(v,fn,S(g=j,at,_d).call(g,{...i,postId:v.postId,commentId:v.id},n,o)),"replyList"in m.data&&m.data.replyList?.data){let{children:P,more:C}=S(f=j,at,Hd).call(f,m.data.replyList.data.children,v.id,i,n,o);P.length&&v.replies.children.push(...P),C&&v.replies.setMore(C)}v.replies.preventInitialFetch(),b?b.replies.children.push(v):a.push(v)}else if(m.kind==="more"&&m.data.parentId&&m.data.depth!=null){let v={parentId:ec(m.data.parentId)?ni(m.data.parentId):ye(m.data.parentId),children:m.data.children??[],depth:m.data.depth};b?b.replies.setMore(v):v.parentId===t&&(c=v)}}return{children:a,more:c}},l(j,at);var te=j;function ed(r,e){let t=u.redditAPIPlugins.Moderation;return new V({hasMore:!0,after:r.after,before:r.before,limit:r.limit,pageSize:r.pageSize,fetch:async i=>{let n=await t.AboutLog({subreddit:r.subredditName,mod:r.moderatorUsernames?r.moderatorUsernames.join(","):void 0,type:r.type,...i},e);return WR(n)}})}function WR(r){if(!r.data?.children)throw new Error("AboutLogResponse is missing children");return{children:r.data.children.map(t=>{if(!t.data)throw new Error("ModAction from AboutLogResponse is missing or invalid");let{id:i,mod:n,modId36:o,createdUtc:a,subreddit:c,subredditNamePrefixed:p,action:g,srId36:f,description:m,details:b,targetAuthor:v,targetBody:P,targetFullname:C,targetPermalink:F,targetTitle:I}=t.data;y(i,"ModAction from AboutLogResponse is missing id"),y(n,"ModAction from AboutLogResponse is missing mod"),y(o,"ModAction from AboutLogResponse is missing modId36"),y(a,"ModAction from AboutLogResponse is missing createdUtc"),y(c,"ModAction from AboutLogResponse is missing subreddit"),y(p,"ModAction from AboutLogResponse is missing subredditNamePrefixed"),y(g,"ModAction from AboutLogResponse is missing action"),y(f,"ModAction from AboutLogResponse is missing srId36");let ge=new Date(0);return ge.setUTCSeconds(a),{id:i,type:g,moderatorName:n,moderatorId:`t2_${o}`,createdAt:ge,subredditName:c,subredditId:`t5_${f}`,description:m,details:b,target:C?{id:C,author:v,body:P,permalink:F,title:I}:void 0}}),after:r.data.after,before:r.data.before}}import"@devvit/protos";var GR=(a=>(a.New="New",a.InProgress="InProgress",a.Archived="Archived",a.Appeals="Appeals",a.JoinRequests="JoinRequests",a.Filtered="Filtered",a))(GR||{}),VR={0:"New",1:"InProgress",2:"Archived",3:"Appeals",4:"JoinRequests",5:"Filtered"},zR=(v=>(v.Highlighted="Highlighted",v.Unhighlighted="Unhighlighted",v.Archived="Archived",v.Unarchived="Unarchived",v.ReportedToAdmins="ReportedToAdmins",v.Muted="Muted",v.Unmuted="Unmuted",v.Banned="Banned",v.Unbanned="Unbanned",v.Approved="Approved",v.Disapproved="Disapproved",v.Filtered="Filtered",v.Unfiltered="Unfiltered",v))(zR||{}),JR={0:"Highlighted",1:"Unhighlighted",2:"Archived",3:"Unarchived",4:"ReportedToAdmins",5:"Muted",6:"Unmuted",7:"Banned",8:"Unbanned",9:"Approved",10:"Disapproved",11:"Filtered",12:"Unfiltered"},H,J,de,mS,pS,td=class{constructor(e){l(this,J);l(this,H);this.notificationSubjectPrefix="[notification]";d(this,H,e)}async bulkReadConversations(e,t){let i=u.redditAPIPlugins.NewModmail,{conversationIds:n}=await i.BulkReadConversations({entity:e.join(","),state:t},s(this,H));return n}async getConversations(e){let i=await u.redditAPIPlugins.NewModmail.GetConversations({after:e.after,entity:e.subreddits?e.subreddits.join(","):void 0,limit:e.limit,sort:e.sort,state:e.state},s(this,H)),n={};for(let o in i.conversations)n[o]=S(this,J,de).call(this,{protoConversation:i.conversations[o],protoMessages:i.messages,protoModActions:{}});return{conversations:n,viewerId:i.viewerId}}async getConversation(e){let i=await u.redditAPIPlugins.NewModmail.GetConversation({...e,markRead:!!e.markRead},s(this,H));return{participantSubreddit:i.participantSubreddit,conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getSubreddits(){let e=u.redditAPIPlugins.NewModmail,{subreddits:t}=await e.Subreddits({},s(this,H));return t}async createConversation(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversation({body:e.body,isAuthorHidden:e.isAuthorHidden??!1,srName:e.subredditName,subject:e.subject,to:e.to?e.to:void 0},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async createModDiscussionConversation(e){return km({subject:e.subject,bodyMarkdown:e.bodyMarkdown,subredditId:ie(e.subredditId),isInternal:!0,participantType:"MODERATOR",conversationType:"INTERNAL"},s(this,H))}async createModInboxConversation(e){return km({subject:e.subject,bodyMarkdown:e.bodyMarkdown,subredditId:ie(e.subredditId),isInternal:!1,participantType:"PARTICIPANT_USER",conversationType:"SR_USER"},s(this,H))}async createModNotification(e){let t=e.subject;return e.subject.startsWith(this.notificationSubjectPrefix)||(t=`${this.notificationSubjectPrefix} ${e.subject}`),km({subject:t,bodyMarkdown:e.bodyMarkdown,subredditId:ie(e.subredditId),isInternal:!1,participantType:"PARTICIPANT_USER",conversationType:"SR_USER"},s(this,H))}async reply(e){let i=await u.redditAPIPlugins.NewModmail.CreateConversationMessage({body:e.body,conversationId:e.conversationId,isAuthorHidden:e.isAuthorHidden??!1,isInternal:e.isInternal??!1},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:{}}),user:i.user}}async highlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.HighlightConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unhighlightConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnhighlightConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async archiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ArchiveConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async unarchiveConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnarchiveConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversation,protoMessages:i.messages,protoModActions:i.modActions})}}async muteConversation(e){let i=await u.redditAPIPlugins.NewModmail.MuteConversation({conversationId:e.conversationId,numHours:e.numHours},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unmuteConversation(e){let i=await u.redditAPIPlugins.NewModmail.UnmuteConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async readConversations(e){await u.redditAPIPlugins.NewModmail.Read({conversationIds:e.join(",")},s(this,H))}async unreadConversations(e){await u.redditAPIPlugins.NewModmail.Unread({conversationIds:e.join(",")},s(this,H))}async approveConversation(e){let i=await u.redditAPIPlugins.NewModmail.ApproveConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async disapproveConversation(e){let i=await u.redditAPIPlugins.NewModmail.DisapproveConversation({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async tempBanConversation(e){let i=await u.redditAPIPlugins.NewModmail.TempBan({...e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async unbanConversation(e){let i=await u.redditAPIPlugins.NewModmail.Unban({conversationId:e},s(this,H));return{conversation:S(this,J,de).call(this,{protoConversation:i.conversations,protoMessages:i.messages,protoModActions:i.modActions}),user:i.user}}async getUnreadCount(){return await u.redditAPIPlugins.NewModmail.UnreadCount({},s(this,H))}async getUserConversations(e){return await u.redditAPIPlugins.NewModmail.UserConversations({conversationId:e},s(this,H))}};H=new WeakMap,J=new WeakSet,de=function({protoConversation:e,protoMessages:t,protoModActions:i}){return{...e,state:VR[e.state],messages:S(this,J,mS).call(this,e,t),modActions:S(this,J,pS).call(this,e,i)}},mS=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},pS=function(e,t){let i={},n=e.objIds.filter(o=>o.key==="modActions").map(({id:o})=>o);for(let o of n){let a=t[o];a&&(i[o]={...a,actionType:JR[a.actionTypeId]})}return i};async function km(r,e){let t=e[D.AppUser]?.values[0],o=await re.query("CreateModmailConversation","5f9ae20b0c7bdffcafb80241728a72e67cd4239bc09f67284b79d4aa706ee0e5",{subject:r.subject,bodyMarkdown:r.bodyMarkdown,subredditId:r.subredditId,authorId:t,isInternal:r.isInternal,participantType:r.participantType,conversationType:r.conversationType},e);if(o.data?.createModmailConversationV2?.ok)return o.data?.createModmailConversationV2?.conversationId;throw new Error("modmail conversation creation failed; ${response.data?.createModmailConversationV2?.errors[0].message}")}var vn,yn,Co,wo,xo,Io,Sm=class Sm{constructor(e,t){l(this,vn);l(this,yn);l(this,Co);l(this,wo);l(this,xo);l(this,Io);if(Y(this),y(e.id,"PrivateMessage: Invalid data, no id"),y(e.name,"PrivateMessage: Invalid data, no name"),y(e.created,"PrivateMessage: Invalid data, no created date"),d(this,vn,Re(e.name)),e.author!=null)d(this,yn,{type:"user",username:e.author,id:e.authorFullname?oe(e.authorFullname):void 0});else if(e.subreddit!=null)d(this,yn,{type:"subreddit",name:e.subreddit,id:e.subredditId?ie(e.subredditId):void 0});else throw new Error("PrivateMessage: Invalid data, no author or subreddit");d(this,Co,e.body??""),d(this,wo,e.bodyHtml??"");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,xo,i),d(this,Io,t)}static async getMessages(e,t){let i=u.redditAPIPlugins.PrivateMessages;return new V({...e,fetch:async n=>{let o=await i.MessageWhere({...n,where:e.type??"inbox"},t);return{after:o.data?.after,before:o.data?.before,children:o.data?.children?.map(a=>new Sm(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,Co)}get bodyHtml(){return s(this,wo)}get created(){return s(this,xo)}async markAsRead(){await u.redditAPIPlugins.PrivateMessages.ReadMessage({id:s(this,vn)},s(this,Io))}};vn=new WeakMap,yn=new WeakMap,Co=new WeakMap,wo=new WeakMap,xo=new WeakMap,Io=new WeakMap;var fr=Sm;var $v=(o=>(o.Reports="reports",o.Spam="spam",o.Modqueue="modqueue",o.Unmoderated="unmoderated",o.Edited="edited",o))($v||{}),gS=class{},hS=class{},fS=class{},vS=class{},bn,A,Fo,To,Ao,Eo,Ro,Oo,Bo,Mo,Uo,kn,E,dt=class dt{constructor(e,t){l(this,bn);l(this,A);l(this,Fo);l(this,To);l(this,Ao);l(this,Eo);l(this,Ro);l(this,Oo);l(this,Bo);l(this,Mo);l(this,Uo);l(this,kn);l(this,E);Y(this),y(e.id,"Subreddit id is missing or undefined"),y(e.displayName,"Subreddit name is missing or undefined"),d(this,bn,ie(`t5_${e.id}`)),d(this,A,e.displayName),y(e.createdUtc,"Subreddit is missing created date");let i=new Date(0);i.setUTCSeconds(e.createdUtc),d(this,Fo,i),d(this,To,$R(e.subredditType)),d(this,Ao,e.title),d(this,Eo,e.description),y(e.lang,"Subreddit is missing language"),d(this,Ro,e.lang),d(this,Oo,e.subscribers??0),d(this,Bo,e.activeUserCount??0),d(this,Mo,e.over18??!1),d(this,kn,e.url??""),d(this,Uo,{acceptFollowers:e.acceptFollowers??!1,allOriginalContent:e.allOriginalContent??!1,allowChatPostCreation:e.allowChatPostCreation??!1,allowDiscovery:e.allowDiscovery??!1,allowGalleries:e.allowGalleries??!1,allowImages:e.allowImages??!1,allowPolls:e.allowPolls??!1,allowPredictionContributors:e.allowPredictionContributors??!1,allowPredictions:e.allowPredictions??!1,allowPredictionsTournament:e.allowPredictionsTournament??!1,allowTalks:e.allowTalks??!1,allowVideoGifs:e.allowVideogifs??!1,allowVideos:e.allowVideos??!1,chatPostEnabled:e.isChatPostFeatureEnabled??!1,collectionsEnabled:e.collectionsEnabled??!1,crosspostable:e.isCrosspostableSubreddit??!1,emojisEnabled:e.emojisEnabled??!1,eventPostsEnabled:e.eventPostsEnabled??!1,linkFlairEnabled:e.linkFlairEnabled??!1,originalContentTagEnabled:e.originalContentTagEnabled??!1,restrictCommenting:e.restrictCommenting??!1,restrictPosting:e.restrictPosting??!1,shouldArchivePosts:e.shouldArchivePosts??!1,spoilersEnabled:e.spoilersEnabled??!1,wikiEnabled:e.wikiEnabled??!1,allowedPostType:KR(e.submissionType),allowedMediaInComments:(e.allowedMediaInComments??[]).map(XR),bannerBackgroundColor:e.bannerBackgroundColor,bannerBackgroundImage:e.bannerBackgroundImage,bannerImage:e.bannerImg,communityIcon:e.communityIcon,headerTitle:e.headerTitle,keyColor:e.keyColor,mobileBannerImage:e.mobileBannerImage,primaryColor:e.primaryColor,userFlairs:{enabled:e.userFlairEnabledInSr??!1,usersCanAssign:e.canAssignUserFlair??!1,userFlairBackgroundColor:e.userFlairBackgroundColor,userFlairTextColor:e.userFlairTextColor},postFlairs:{enabled:e.linkFlairEnabled??!1,usersCanAssign:e.canAssignLinkFlair??!1},url:new URL(s(this,kn),"https://www.reddit.com").toString()}),d(this,E,t)}get id(){return s(this,bn)}get name(){return s(this,A)}get createdAt(){return s(this,Fo)}get type(){return s(this,To)}get title(){return s(this,Ao)}get description(){return s(this,Eo)}get language(){return s(this,Ro)}get numberOfSubscribers(){return s(this,Oo)}get numberOfActiveUsers(){return s(this,Bo)}get nsfw(){return s(this,Mo)}get settings(){return s(this,Uo)}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,A)};return z.submit(t,s(this,E))}getControversialPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getControversialPosts({...e,subredditName:s(this,A)},s(this,E))}getTopPosts(e={}){if(!s(this,A))throw new Error("subreddit missing displayName - it might not have been fetched");return z.getTopPosts({...e,subredditName:s(this,A)},s(this,E))}getApprovedUsers(e={}){return x.getSubredditUsersByType({type:"contributors",subredditName:s(this,A),...e},s(this,E))}approveUser(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,E))}removeUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"contributor"},s(this,E))}getWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikicontributors",subredditName:s(this,A),...e},s(this,E))}addWikiContributor(e){return x.createRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,E))}removeWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikicontributor"},s(this,E))}getBannedUsers(e={}){return x.getSubredditUsersByType({type:"banned",subredditName:s(this,A),...e},s(this,E))}banUser(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"banned",banReason:e.reason,banMessage:e.message,note:e.note,duration:e.duration,banContext:e.context},s(this,E))}unbanUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"banned"},s(this,E))}getBannedWikiContributors(e={}){return x.getSubredditUsersByType({type:"wikibanned",subredditName:s(this,A),...e},s(this,E))}banWikiContributor(e){return x.createRelationship({username:e.username,subredditName:s(this,A),type:"wikibanned",banReason:e.reason,note:e.note,duration:e.duration},s(this,E))}unbanWikiContributor(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"wikibanned"},s(this,E))}getModerators(e={}){return x.getSubredditUsersByType({type:"moderators",subredditName:s(this,A),...e},s(this,E))}inviteModerator(e,t){return x.createRelationship({type:"moderator_invite",subredditName:s(this,A),username:e,permissions:t??[]},s(this,E))}revokeModeratorInvite(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"moderator_invite"},s(this,E))}removeModerator(e){return x.removeRelationship({type:"moderator",subredditName:s(this,A),username:e},s(this,E))}setModeratorPermissions(e,t){return x.setModeratorPermissions(e,s(this,A),t,s(this,E))}getMutedUsers(e={}){return x.getSubredditUsersByType({type:"muted",subredditName:s(this,A),...e},s(this,E))}muteUser(e,t){return x.createRelationship({username:e,subredditName:s(this,A),type:"muted",note:t},s(this,E))}unmuteUser(e){return x.removeRelationship({username:e,subredditName:s(this,A),type:"muted"},s(this,E))}getModerationLog(e){return ed({subredditName:s(this,A),...e},s(this,E))}getUserFlairTemplates(){return ue.getUserFlairTemplates(s(this,A),s(this,E))}getPostFlairTemplates(){return ue.getPostFlairTemplates(s(this,A),s(this,E))}createPostFlairTemplate(e){return ue.createPostFlairTemplate({subredditName:s(this,A),...e},s(this,E))}createUserFlairTemplate(e){return ue.createUserFlairTemplate({subredditName:s(this,A),...e},s(this,E))}async getUserFlair(e){if(e?.usernames!==void 0)return{users:await Promise.all(e.usernames.map(async i=>{let n=await Ue.getUserFlairBySubreddit({subreddit:s(this,A),name:i},s(this,E));return Ls(n.users[0])}))};{let t=await Ue.getUserFlairBySubreddit({...e,subreddit:s(this,A)},s(this,E));return{next:t.next,prev:t.prev,users:t.users.map(i=>Ls(i))}}}getModQueue(e={type:"all"}){return dt.aboutLocation({...e,location:"modqueue",subreddit:s(this,A)},s(this,E))}getReports(e={type:"all"}){return dt.aboutLocation({...e,location:"reports",subreddit:s(this,A)},s(this,E))}getSpam(e={type:"all"}){return dt.aboutLocation({...e,location:"spam",subreddit:s(this,A)},s(this,E))}getUnmoderated(e={type:"all"}){return dt.aboutLocation({...e,location:"unmoderated",subreddit:s(this,A)},s(this,E))}getEdited(e={type:"all"}){return dt.aboutLocation({...e,location:"edited",subreddit:s(this,A)},s(this,E))}static aboutLocation(e,t){let i=u.redditAPIPlugins.Moderation,n;switch(e.type){case"post":n="links";break;case"comment":n="comments";break;default:n=void 0}return new V({...e,fetch:async o=>{let a=await i.AboutLocation({...o,...e,only:n},t);return yS(a,t)}})}getCommentsAndPostsByIds(e){let t=u.redditAPIPlugins.LinksAndComments;return new V({fetch:async()=>{let i=await t.Info({thingIds:e,subreddits:[s(this,bn)]},s(this,E));return yS(i,s(this,E))}})}static async addRemovalReason(e,t,i,n){return(await u.redditAPIPlugins.Subreddits.SubredditAddRemovalReason({title:t,message:i,subreddit:e},n)).id}static async getRemovalReasons(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditGetRemovalReasons({subreddit:e},t);return n.order.map(o=>({...n.data[o]}))}static async getFromMetadata(e){y(e);let t=e?.[D.Subreddit]?.values[0];return y(t),dt.getById(ie(t),e)}static async getById(e,t){let o=(await u.redditAPIPlugins.LinksAndComments.Info({thingIds:[e],subreddits:[]},t)).data?.children[0]?.data?.displayName;return y(o),dt.getByName(o,t)}static async getByName(e,t){let n=await u.redditAPIPlugins.Subreddits.SubredditAbout({subreddit:e},t);if(!n?.data)throw new Error("not found");return new dt(n.data,t)}};bn=new WeakMap,A=new WeakMap,Fo=new WeakMap,To=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,Bo=new WeakMap,Mo=new WeakMap,Uo=new WeakMap,kn=new WeakMap,E=new WeakMap;var be=dt;async function Kv(r,e){let o=(await re.query("GetSubredditInfoById","315a9b75c22a017d526afdf2d274616946156451aacfd56dfb91e7ad3f7a2fde",{id:r},e)).data?.subredditInfoById;if(!o)throw new Error("subreddit info not found");return o}async function Xv(r,e){let o=(await re.query("GetSubredditInfoByName","4aa69726c7e3f5d33ab2bee22b3d74fce645824fddd5ea3ec6dfe30bdb4295cb",{name:r},e)).data?.subredditInfoByName;if(!o)throw new Error("subreddit info not found");return o}async function Zv(r,e){let o=(await re.query("GetSubredditLeaderboard","18ead70c46b6446d45ecd8b679b16d9a929a933d6ef25d8262a459cb18b72848",{id:r},e)).data?.subredditInfoById?.leaderboard;if(!o)throw new Error("subreddit leaderboard not found");if(!o.summary)throw new Error("subreddit leaderboard summary not found");return{id:o.id,summary:o.summary}}async function Qv(r,e){let o=(await re.query("GetSubredditStyles","d491d17ea8858f563ea578b26b9595d64adecf4bf34557d567c7e53c470f5f22",{id:r},e)).data?.subredditInfoById?.styles;if(!o)throw new Error("subreddit styles not found");return o}function $R(r){if(r==="public"||r==="private"||r==="restricted"||r==="employees_only"||r==="gold_only"||r==="gold_restricted"||r==="archived"||r==="user")return r;throw new Error(`invalid subreddit type: ${r}`)}function KR(r){if(r==="any"||r==="link"||r==="self")return r;throw new Error(`invalid allowed post type: ${r}`)}function XR(r){if(r==="animated"||r==="giphy"||r==="static"||r==="expression")return r;throw new Error(`invalid comment media type: ${r}`)}function yS(r,e){let i=(r.data?.children??[]).map(a=>{let c=n(a);if(c!=null)return c;let p=o(a);return p??null}).filter(Boolean);return{after:r.data?.after,before:r.data?.before,children:i};function n(a){try{return new z(a.data,e)}catch{return null}}function o(a){try{return new te(a.data,e)}catch{return null}}}async function Yv(r,e){return bS("GetVaultContactByAddress","3e2f7966a5c120e64fd2795d06a46595c52d988185be98d3ed71c3f81ae80d2e",{provider:"ethereum",address:r},e)}async function ey(r,e){return bS("GetVaultContactByUserId","a854ddc19d0e22c4f36ed917fdbd568f299f3571427e393aee5e2972080fffe9",{provider:"ethereum",userId:r},e)}async function bS(r,e,t,i){let o=(await re.query(r,e,t,i))?.data?.vault?.contact;return{provider:o?.provider,userId:oe(o?.userId),address:o?.address,createdAt:o?.createdAt,isActive:o?.isActive}}import{CommunityListWidget_CommunityData as ZR,GetWidgetsResponse_WidgetItem as pe}from"@devvit/protos";var Do,Lo,No,_o,Cm=class Cm{constructor(e,t,i){l(this,Do);l(this,Lo);l(this,No);l(this,_o);Y(this),d(this,Do,e.id),d(this,Lo,e.shortName),d(this,No,t),d(this,_o,i)}get id(){return s(this,Do)}get name(){return s(this,Lo)}get subredditName(){return s(this,No)}toJSON(){return{id:this.id,name:this.name,subredditName:this.subredditName}}delete(){return Cm.delete(this.subredditName,this.id,s(this,_o))}static async getWidgets(e,t){let n=await u.redditAPIPlugins.Widgets.GetWidgets({subreddit:e},t);y(n.layout,"Failed to load widgets for subreddit");let o=n.items,a=[];for(let c of n.layout.sidebar?.order??[]){let p=o[c];switch(p?.kind){case"image":a.push(new qd(p,e,t));break;case"calendar":a.push(new jd(p,e,t));break;case"textarea":a.push(new Wd(p,e,t));break;case"button":a.push(new Gd(p,e,t));break;case"community-list":a.push(new Vd(p,e,t));break;case"post-flair":a.push(new zd(p,e,t));break;case"custom":a.push(new Jd(p,e,t));break;case"subreddit-rules":{let g=await u.redditAPIPlugins.Subreddits.SubredditAboutRules({subreddit:e},t);a.push(new Pm(g,p,e,t));break}default:throw new Error(`Unknown widget type: ${p.kind}`)}}return a}static async delete(e,t,i){await u.redditAPIPlugins.Widgets.DeleteWidget({subreddit:e,id:t},i)}static async reorder(e,t,i){await u.redditAPIPlugins.Widgets.OrderWidgets({subreddit:e,order:t},i)}static async add(e,t){switch(e?.type){case"image":return qd.create(e,t);case"calendar":return jd.create(e,t);case"textarea":return Wd.create(e,t);case"button":return Gd.create(e,t);case"community-list":return Vd.create(e,t);case"post-flair":return zd.create(e,t);case"custom":return Jd.create(e,t);default:throw new Error("Unknown widget type")}}};Do=new WeakMap,Lo=new WeakMap,No=new WeakMap,_o=new WeakMap;var ae=Cm,Ho,$d=class $d extends ae{constructor(t,i,n){super(t,i,n);l(this,Ho);d(this,Ho,t.data.map(o=>(y(o.url,"Image widget data is missing url"),y(o.height,"Image widget data is missing height"),y(o.width,"Image widget data is missing width"),y(o.linkUrl,"Image widget data is missing linkUrl"),{url:o.url,height:o.height,width:o.width,linkUrl:o.linkUrl})))}get images(){return s(this,Ho)}toJSON(){return{...super.toJSON(),images:this.images}}static async create(t,i){let o=await u.redditAPIPlugins.Widgets.AddImageWidget(t,i);return new $d(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateImageWidget(t,i);return new $d(pe.fromJSON(o),t.subreddit,i)}};Ho=new WeakMap;var qd=$d,qo,jo,Wo,Kd=class Kd extends ae{constructor(t,i,n){super(t,i,n);l(this,qo);l(this,jo);l(this,Wo);y(t.googleCalendarId,"Calendar widget data is missing googleCalendarId"),y(t.configuration,"Calendar widget data is missing configuration"),y(t.styles,"Calendar widget data is missing styles"),d(this,qo,t.googleCalendarId),d(this,jo,t.configuration),d(this,Wo,t.styles)}get googleCalendarId(){return s(this,qo)}get configuration(){return s(this,jo)}get styles(){return s(this,Wo)}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 Kd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCalendarWidget(t,i);return new Kd(pe.fromJSON(o),t.subreddit,i)}};qo=new WeakMap,jo=new WeakMap,Wo=new WeakMap;var jd=Kd,Go,Vo,Xd=class Xd extends ae{constructor(t,i,n){super(t,i,n);l(this,Go);l(this,Vo);y(t.text,"Textarea widget data is missing text"),y(t.styles,"Textarea widget data is missing styles"),d(this,Go,t.text),d(this,Vo,t.styles)}get text(){return s(this,Go)}get styles(){return s(this,Vo)}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 Xd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateTextAreaWidget(t,i);return new Xd(pe.fromJSON(o),t.subreddit,i)}};Go=new WeakMap,Vo=new WeakMap;var Wd=Xd,zo,Jo,$o,Zd=class Zd extends ae{constructor(t,i,n){super(t,i,n);l(this,zo);l(this,Jo);l(this,$o);y(t.styles,"Button widget data is missing styles"),d(this,zo,t.buttons),d(this,Jo,t.description??""),d(this,$o,t.styles)}get buttons(){return s(this,zo)}get description(){return s(this,Jo)}get styles(){return s(this,$o)}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 Zd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateButtonWidget(t,i);return new Zd(pe.fromJSON(o),t.subreddit,i)}};zo=new WeakMap,Jo=new WeakMap,$o=new WeakMap;var Gd=Zd,Ko,Xo,Qd=class Qd extends ae{constructor(t,i,n){super(t,i,n);l(this,Ko);l(this,Xo);d(this,Ko,t.data.map(o=>ZR.fromJSON(o))),y(t.styles,"Community list widget data is missing styles"),d(this,Xo,t.styles)}get communities(){return s(this,Ko)}get styles(){return s(this,Xo)}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 Qd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCommunityListWidget(t,i);return new Qd(pe.fromJSON(o),t.subreddit,i)}};Ko=new WeakMap,Xo=new WeakMap;var Vd=Qd,Zo,Qo,Yo,Yd=class Yd extends ae{constructor(t,i,n){super(t,i,n);l(this,Zo);l(this,Qo);l(this,Yo);if(y(t.styles,"Post flair widget data is missing styles"),d(this,Zo,t.styles),d(this,Qo,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,Yo,t.display)}get styles(){return s(this,Zo)}get templates(){return s(this,Qo)}get display(){return s(this,Yo)}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 Yd(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdatePostFlairWidget(t,i);return new Yd(pe.fromJSON(o),t.subreddit,i)}};Zo=new WeakMap,Qo=new WeakMap,Yo=new WeakMap;var zd=Yd,ea,ta,ra,ia,na,el=class el extends ae{constructor(t,i,n){super(t,i,n);l(this,ea);l(this,ta);l(this,ra);l(this,ia);l(this,na);y(t.stylesheetUrl,"Custom widget data is missing stylesheetUrl"),y(t.height,"Custom widget data is missing height"),y(t.css,"Custom widget data is missing css"),d(this,ea,t.imageData??[]),d(this,ta,t.text??""),d(this,ra,t.stylesheetUrl),d(this,ia,t.height),d(this,na,t.css)}get images(){return s(this,ea)}get text(){return s(this,ta)}get stylesheetUrl(){return s(this,ra)}get height(){return s(this,ia)}get css(){return s(this,na)}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 el(pe.fromJSON(o),t.subreddit,i)}static async update(t,i){let o=await u.redditAPIPlugins.Widgets.UpdateCustomWidget(t,i);return new el(pe.fromJSON(o),t.subreddit,i)}};ea=new WeakMap,ta=new WeakMap,ra=new WeakMap,ia=new WeakMap,na=new WeakMap;var Jd=el,sa,Pm=class extends ae{constructor(t,i,n,o){super(i,n,o);l(this,sa);let a=t.rules.map(({description:c,priority:p,shortName:g,violationReason:f})=>(y(c,"Subreddit rule is missing description"),y(p,"Subreddit rule is missing priority"),y(g,"Subreddit rule is missing shortName"),y(f,"Subreddit rule is missing violationReason"),{description:c,priority:p,shortName:g,violationReason:f}));d(this,sa,a)}get rules(){return s(this,sa)}toJSON(){return{...super.toJSON(),rules:this.rules}}};sa=new WeakMap;var QR=(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))(QR||{}),Pe,Ce,Sn,Pn,Cn,wn,xn,In,Xe,He=class He{constructor(e,t,i,n){l(this,Pe);l(this,Ce);l(this,Sn);l(this,Pn);l(this,Cn);l(this,wn);l(this,xn);l(this,In);l(this,Xe);Y(this),d(this,Pe,e),d(this,Ce,t),d(this,Sn,i.contentMd),d(this,Pn,i.contentHtml),d(this,Cn,i.revisionId),d(this,wn,new Date(i.revisionDate*1e3)),d(this,xn,i.reason??""),y(i.revisionBy?.data,"Wiki page author details are missing"),d(this,In,new x(i.revisionBy.data,n)),d(this,Xe,n)}get name(){return s(this,Pe)}get subredditName(){return s(this,Ce)}get content(){return s(this,Sn)}get contentHtml(){return s(this,Pn)}get revisionId(){return s(this,Cn)}get revisionDate(){return s(this,wn)}get revisionReason(){return s(this,xn)}get revisionAuthor(){return s(this,In)}toJSON(){return{name:s(this,Pe),subredditName:s(this,Ce),content:s(this,Sn),contentHtml:s(this,Pn),revisionId:s(this,Cn),revisionDate:s(this,wn),revisionReason:s(this,xn),revisionAuthor:s(this,In).toJSON()}}async update(e,t){return He.updatePage({subredditName:s(this,Ce),page:s(this,Pe),content:e,reason:t},s(this,Xe))}async getRevisions(e){return He.getPageRevisions({subredditName:s(this,Ce),page:s(this,Pe),...e},s(this,Xe))}async revertTo(e){return He.revertPage(s(this,Ce),s(this,Pe),e,s(this,Xe))}async getSettings(){return He.getPageSettings(s(this,Ce),s(this,Pe),s(this,Xe))}async updateSettings(e){return He.updatePageSettings({subredditName:s(this,Ce),page:s(this,Pe),listed:e.listed,permLevel:e.permLevel},s(this,Xe))}async addEditor(e){return He.addEditor(s(this,Ce),s(this,Pe),e,s(this,Xe))}async removeEditor(e){return He.removeEditor(s(this,Ce),s(this,Pe),e,s(this,Xe))}static async getPage(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPage({subreddit:e,page:t},i);return y(o.data,"Failed to get wiki page"),new He(t,e,o.data,i)}static async getPages(e,t){return(await u.redditAPIPlugins.Wiki.GetWikiPages({subreddit:e},t)).data||[]}static async createPage(e,t){return He.updatePage(e,t)}static async updatePage(e,t){return await u.redditAPIPlugins.Wiki.EditWikiPage({subreddit:e.subredditName,page:e.page,content:e.content,reason:e.reason??""},t),He.getPage(e.subredditName,e.page,t)}static getPageRevisions(e,t){let i=u.redditAPIPlugins.Wiki;return new V({hasMore:!0,after:e.after,limit:e.limit,pageSize:e.pageSize,async fetch(n){let o=await i.GetWikiPageRevisions({subreddit:e.subredditName,page:e.page,limit:n.limit,after:n.after,before:n.before},t);return YR(o,t)}})}static async revertPage(e,t,i,n){await u.redditAPIPlugins.Wiki.RevertWikiPage({subreddit:e,page:t,revision:i},n)}static async getPageSettings(e,t,i){let o=await u.redditAPIPlugins.Wiki.GetWikiPageSettings({subreddit:e,page:t},i);return y(o.data,"Failed to get wiki page settings"),new tl(o.data,i)}static async updatePageSettings(e,t){let n=await u.redditAPIPlugins.Wiki.UpdateWikiPageSettings({subreddit:e.subredditName,page:e.page,listed:e.listed?"on":"",permlevel:e.permLevel},t);return y(n.data,"Failed to update wiki page settings"),new tl(n.data,t)}static async addEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"add",subreddit:e,page:t,username:i},n)}static async removeEditor(e,t,i,n){await u.redditAPIPlugins.Wiki.AllowEditor({act:"del",subreddit:e,page:t,username:i},n)}};Pe=new WeakMap,Ce=new WeakMap,Sn=new WeakMap,Pn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,xn=new WeakMap,In=new WeakMap,Xe=new WeakMap;var ke=He,Fn,Tn,An,En,Rn,On,wm=class{constructor(e,t){l(this,Fn);l(this,Tn);l(this,An);l(this,En);l(this,Rn);l(this,On);d(this,Fn,e.id),d(this,Tn,e.page),d(this,An,new Date(e.timestamp)),y(e.author?.data,"Wiki page revision author details are missing"),d(this,En,new x(e.author.data,t)),d(this,Rn,e.reason??""),d(this,On,e.revisionHidden??!1)}get id(){return s(this,Fn)}get page(){return s(this,Tn)}get date(){return s(this,An)}get author(){return s(this,En)}get reason(){return s(this,Rn)}get hidden(){return s(this,On)}toJSON(){return{id:s(this,Fn),page:s(this,Tn),date:s(this,An),author:s(this,En).toJSON(),reason:s(this,Rn),hidden:s(this,On)}}};Fn=new WeakMap,Tn=new WeakMap,An=new WeakMap,En=new WeakMap,Rn=new WeakMap,On=new WeakMap;var Bn,Mn,Un,tl=class{constructor(e,t){l(this,Bn);l(this,Mn);l(this,Un);d(this,Bn,e.listed),d(this,Mn,e.permLevel),d(this,Un,e.editors.map(i=>(y(i.data,"Wiki page editor details are missing"),new x(i.data,t))))}get listed(){return s(this,Bn)}get permLevel(){return s(this,Mn)}get editors(){return s(this,Un)}toJSON(){return{listed:s(this,Bn),permLevel:s(this,Mn),editors:s(this,Un).map(e=>e.toJSON())}}};Bn=new WeakMap,Mn=new WeakMap,Un=new WeakMap;function YR(r,e){return y(r.data?.children,"Wiki page revision listing is missing children"),{children:r.data.children.map(i=>new wm(i,e)),before:r.data.before,after:r.data.after}}var eO=["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"],tO=["border-image","border-image-source","behavior","expression","list-style-image","cursor","content"],rO=["onload","onerror","onclick","onmouseover"];function iO(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 kS(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*(${eO.join("|")})\\b`,"gi"),t=new RegExp(`(${tO.join("|")})\\s*:\\s*url\\s*\\((['"]?)(.*?)\\2\\)`,"gi"),i=new RegExp(`(${rO.join("|")})\\s*(=\\s*(['"]?)(.*?)\\3)?`,"gi");r=r.trim().replace(/\s+/g," "),r=iO(r);let n=r.match(e)||[],o=r.match(t)||[],a=r.match(i)||[],c=!1;return n.length>0&&(c=!0,console.warn(`Disallowed elements detected in SVG: ${n.map(p=>p.replace("<","")).join(", ")}`)),o.length>0&&(c=!0,console.warn(`Disallowed styles detected in SVG: ${o.map(p=>p.split(":")[0]).join(", ")}`)),a.length>0&&(c=!0,console.warn(`Disallowed attributes detected in SVG: ${a.map(p=>p.split("=")[0]).join(", ")}`)),c?void 0:r}catch{return}}}function cq(r,...e){let t="";return r.forEach((i,n)=>{t+=i;let o=e[n];o!==void 0&&(t+=`${o}`)}),t=kS(t),t===void 0?"":`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}export{wM as ALL_ICON_NAMES,$v as AboutLocations,fS as AuthorFlairSettings,Gd as ButtonWidget,jd as CalendarWidget,te as Comment,Vd as CommunityListWidget,Jd as CustomWidget,u as Devvit,Ue as Flair,ue as FlairTemplate,wR as FlairType,Ft as Hook,qd as ImageWidget,V as Listing,zR as ModMailActionType,GR as ModMailConversationState,td as ModMailService,Me as ModNote,z as Post,vS as PostFlairSettings,zd as PostFlairWidget,fr as PrivateMessage,yt as RichTextBuilder,tc as SettingScope,HR as SocialLinkType,be as Subreddit,gS as SubredditDescription,Pm as SubredditRulesWidget,hS as SubredditWikiSettings,Wd as TextAreaWidget,x as User,ae as Widget,ke as WikiPage,QR as WikiPagePermissionLevel,wm as WikiPageRevision,tl as WikiPageSettings,Ls as convertUserFlairProtoToAPI,ed as getModerationLog,Kv as getSubredditInfoById,Xv as getSubredditInfoByName,Zv as getSubredditLeaderboard,Qv as getSubredditStyles,Yv as getVaultByAddress,ey as getVaultByUserId,cq as svg,uR as useAsync,Qc as useChannel,$c as useForm,tm as useInterval,sm as useState};
|