@devvit/web-view-scripts 0.13.7-next-2026-07-06-22-55-50-e17da017f.0 → 0.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/devvit.v1.meta.json +1 -1
- package/package.json +7 -7
- package/scripts/devvit.v1.min.js +1 -1
- package/scripts/devvit.v1.min.js.map +3 -3
- package/telemetry.js +31 -8
package/scripts/devvit.v1.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var $o=Object.create;var ur=Object.defineProperty;var Go=Object.getOwnPropertyDescriptor;var Zo=Object.getOwnPropertyNames;var Ho=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var un=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ko=(e,t)=>()=>(e&&(t=e(e=0)),t);var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Xo=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Zo(t))!zo.call(e,i)&&i!==n&&ur(e,i,{get:()=>t[i],enumerable:!(o=Go(t,i))||o.enumerable});return e};var G=(e,t,n)=>(n=e!=null?$o(Ho(e)):{},Xo(t||!e||!e.__esModule?ur(n,"default",{value:e,enumerable:!0}):n,e));var v,d=Ko(()=>{v={hash:"e17da01",version:"0.13.7-dev"}});var pr=M((Tu,hr)=>{"use strict";d();hr.exports=is;function is(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(p,f){n[o]=function(S){if(r)if(r=!1,S)f(S);else{for(var O=new Array(arguments.length-1),y=0;y<O.length;)O[y++]=arguments[y];p.apply(null,O)}};try{e.apply(t||null,n)}catch(a){r&&(r=!1,f(a))}})}});var Er=M(Sr=>{"use strict";d();var zt=Sr;zt.length=function(t){var n=t.length;if(!n)return 0;for(var o=0;--n%4>1&&t.charAt(n)==="=";)++o;return Math.ceil(t.length*3)/4-o};var It=new Array(64),mr=new Array(123);for(me=0;me<64;)mr[It[me]=me<26?me+65:me<52?me+71:me<62?me-4:me-59|43]=me++;var me;zt.encode=function(t,n,o){for(var i=null,r=[],u=0,p=0,f;n<o;){var a=t[n++];switch(p){case 0:r[u++]=It[a>>2],f=(a&3)<<4,p=1;break;case 1:r[u++]=It[f|a>>4],f=(a&15)<<2,p=2;break;case 2:r[u++]=It[f|a>>6],r[u++]=It[a&63],p=0;break}u>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),u=0)}return p&&(r[u++]=It[f],r[u++]=61,p===1&&(r[u++]=61)),i?(u&&i.push(String.fromCharCode.apply(String,r.slice(0,u))),i.join("")):String.fromCharCode.apply(String,r.slice(0,u))};var gr="invalid encoding";zt.decode=function(t,n,o){for(var i=o,r=0,u,p=0;p<t.length;){var f=t.charCodeAt(p++);if(f===61&&r>1)break;if((f=mr[f])===void 0)throw Error(gr);switch(r){case 0:u=f,r=1;break;case 1:n[o++]=u<<2|(f&48)>>4,u=f,r=2;break;case 2:n[o++]=(u&15)<<4|(f&60)>>2,u=f,r=3;break;case 3:n[o++]=(u&3)<<6|f,r=0;break}}if(r===1)throw Error(gr);return o-i};zt.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var yr=M((Iu,vr)=>{"use strict";d();vr.exports=Kt;function Kt(){this._listeners=Object.create(null)}Kt.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};Kt.prototype.off=function(t,n){if(t===void 0)this._listeners=Object.create(null);else if(n===void 0)this._listeners[t]=[];else{var o=this._listeners[t];if(!o)return this;for(var i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i}return this};Kt.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],i=1;i<arguments.length;)o.push(arguments[i++]);for(i=0;i<n.length;)n[i].fn.apply(n[i++].ctx,o)}return this}});var Ir=M((wu,Or)=>{"use strict";d();Or.exports=Nr(Nr);function Nr(e){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(f,a,S){t[0]=f,a[S]=n[0],a[S+1]=n[1],a[S+2]=n[2],a[S+3]=n[3]}function r(f,a,S){t[0]=f,a[S]=n[3],a[S+1]=n[2],a[S+2]=n[1],a[S+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function u(f,a){return n[0]=f[a],n[1]=f[a+1],n[2]=f[a+2],n[3]=f[a+3],t[0]}function p(f,a){return n[3]=f[a],n[2]=f[a+1],n[1]=f[a+2],n[0]=f[a+3],t[0]}e.readFloatLE=o?u:p,e.readFloatBE=o?p:u})():(function(){function t(o,i,r,u){var p=i<0?1:0;if(p&&(i=-i),i===0)o(1/i>0?0:2147483648,r,u);else if(isNaN(i))o(2143289344,r,u);else if(i>34028234663852886e22)o((p<<31|2139095040)>>>0,r,u);else if(i<11754943508222875e-54)o((p<<31|Math.round(i/1401298464324817e-60))>>>0,r,u);else{var f=Math.floor(Math.log(i)/Math.LN2),a=Math.round(i*Math.pow(2,-f)*8388608)&8388607;o((p<<31|f+127<<23|a)>>>0,r,u)}}e.writeFloatLE=t.bind(null,br),e.writeFloatBE=t.bind(null,Tr);function n(o,i,r){var u=o(i,r),p=(u>>31)*2+1,f=u>>>23&255,a=u&8388607;return f===255?a?NaN:p*(1/0):f===0?p*1401298464324817e-60*a:p*Math.pow(2,f-150)*(a+8388608)}e.readFloatLE=n.bind(null,_r),e.readFloatBE=n.bind(null,Rr)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(f,a,S){t[0]=f,a[S]=n[0],a[S+1]=n[1],a[S+2]=n[2],a[S+3]=n[3],a[S+4]=n[4],a[S+5]=n[5],a[S+6]=n[6],a[S+7]=n[7]}function r(f,a,S){t[0]=f,a[S]=n[7],a[S+1]=n[6],a[S+2]=n[5],a[S+3]=n[4],a[S+4]=n[3],a[S+5]=n[2],a[S+6]=n[1],a[S+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function u(f,a){return n[0]=f[a],n[1]=f[a+1],n[2]=f[a+2],n[3]=f[a+3],n[4]=f[a+4],n[5]=f[a+5],n[6]=f[a+6],n[7]=f[a+7],t[0]}function p(f,a){return n[7]=f[a],n[6]=f[a+1],n[5]=f[a+2],n[4]=f[a+3],n[3]=f[a+4],n[2]=f[a+5],n[1]=f[a+6],n[0]=f[a+7],t[0]}e.readDoubleLE=o?u:p,e.readDoubleBE=o?p:u})():(function(){function t(o,i,r,u,p,f){var a=u<0?1:0;if(a&&(u=-u),u===0)o(0,p,f+i),o(1/u>0?0:2147483648,p,f+r);else if(isNaN(u))o(0,p,f+i),o(2146959360,p,f+r);else if(u>17976931348623157e292)o(0,p,f+i),o((a<<31|2146435072)>>>0,p,f+r);else{var S;if(u<22250738585072014e-324)S=u/5e-324,o(S>>>0,p,f+i),o((a<<31|S/4294967296)>>>0,p,f+r);else{var O=Math.floor(Math.log(u)/Math.LN2);O===1024&&(O=1023),S=u*Math.pow(2,-O),o(S*4503599627370496>>>0,p,f+i),o((a<<31|O+1023<<20|S*1048576&1048575)>>>0,p,f+r)}}}e.writeDoubleLE=t.bind(null,br,0,4),e.writeDoubleBE=t.bind(null,Tr,4,0);function n(o,i,r,u,p){var f=o(u,p+i),a=o(u,p+r),S=(a>>31)*2+1,O=a>>>20&2047,y=4294967296*(a&1048575)+f;return O===2047?y?NaN:S*(1/0):O===0?S*5e-324*y:S*Math.pow(2,O-1075)*(y+4503599627370496)}e.readDoubleLE=n.bind(null,_r,0,4),e.readDoubleBE=n.bind(null,Rr,4,0)})(),e}function br(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function Tr(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=e&255}function _r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Rr(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var wr=M((xu,Cr)=>{"use strict";d();Cr.exports=os;function os(e){try{if(typeof un!="function")return null;var t=un(e);return t&&(t.length||Object.keys(t).length)?t:null}catch{return null}}});var xr=M(kr=>{"use strict";d();var hn=kr,cn="\uFFFD";hn.length=function(t){for(var n=0,o=0,i=0;i<t.length;++i)o=t.charCodeAt(i),o<128?n+=1:o<2048?n+=2:(o&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,n+=4):n+=3;return n};hn.read=function(t,n,o){if(o-n<1)return"";for(var i="",r=n;r<o;){var u=t[r++];if(u<=127)i+=String.fromCharCode(u);else if(u>=192&&u<224){var p=(u&31)<<6|t[r++]&63;i+=p>=128?String.fromCharCode(p):cn}else if(u>=224&&u<240){var f=(u&15)<<12|(t[r++]&63)<<6|t[r++]&63;i+=f>=2048?String.fromCharCode(f):cn}else if(u>=240){var a=(u&7)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63;a<65536||a>1114111?i+=cn:(a-=65536,i+=String.fromCharCode(55296+(a>>10)),i+=String.fromCharCode(56320+(a&1023)))}}return i};hn.write=function(t,n,o){for(var i=o,r,u,p=0;p<t.length;++p)r=t.charCodeAt(p),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((u=t.charCodeAt(p+1))&64512)===56320?(r=65536+((r&1023)<<10)+(u&1023),++p,n[o++]=r>>18|240,n[o++]=r>>12&63|128,n[o++]=r>>6&63|128,n[o++]=r&63|128):(n[o++]=r>>12|224,n[o++]=r>>6&63|128,n[o++]=r&63|128);return o-i}});var Lr=M((Uu,Vr)=>{"use strict";d();Vr.exports=ss;function ss(e,t,n){var o=n||8192,i=o>>>1,r=null,u=o;return function(f){if(f<1||f>i)return e(f);u+f>o&&(r=e(o),u=0);var a=t.call(r,u,u+=f);return u&7&&(u=(u|7)+1),a}}});var Pr=M((Du,Ar)=>{"use strict";d();Ar.exports=B;var Pt=Fe();function B(e,t){this.lo=e>>>0,this.hi=t>>>0}var dt=B.zero=new B(0,0);dt.toNumber=function(){return 0};dt.zzEncode=dt.zzDecode=function(){return this};dt.length=function(){return 1};var us=B.zeroHash="\0\0\0\0\0\0\0\0";B.fromNumber=function(t){if(t===0)return dt;var n=t<0;n&&(t=-t);var o=t>>>0,i=(t-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new B(o,i)};B.from=function(t){if(typeof t=="number")return B.fromNumber(t);if(Pt.isString(t))if(Pt.Long)t=Pt.Long.fromString(t);else return B.fromNumber(parseInt(t,10));return t.low||t.high?new B(t.low>>>0,t.high>>>0):dt};B.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};B.prototype.toLong=function(t){return Pt.Long?new Pt.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Je=String.prototype.charCodeAt;B.fromHash=function(t){return t===us?dt:new B((Je.call(t,0)|Je.call(t,1)<<8|Je.call(t,2)<<16|Je.call(t,3)<<24)>>>0,(Je.call(t,4)|Je.call(t,5)<<8|Je.call(t,6)<<16|Je.call(t,7)<<24)>>>0)};B.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};B.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};B.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};B.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var Ur=M((Ut,pn)=>{d();(function(e,t){function n(o){return o.default||o}typeof define=="function"&&define.amd?define([],function(){var o={};return t(o),n(o)}):typeof Ut=="object"?(t(Ut),typeof pn=="object"&&(pn.exports=n(Ut))):(function(){var o={};t(o),e.Long=n(o)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Ut,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(l,s,g){this.low=l|0,this.high=s|0,this.unsigned=!!g}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0});function o(l){return(l&&l.__isLong__)===!0}function i(l){var s=Math.clz32(l&-l);return l?31-s:s}n.isLong=o;var r={},u={};function p(l,s){var g,b,k;return s?(l>>>=0,(k=0<=l&&l<256)&&(b=u[l],b)?b:(g=a(l,0,!0),k&&(u[l]=g),g)):(l|=0,(k=-128<=l&&l<128)&&(b=r[l],b)?b:(g=a(l,l<0?-1:0,!1),k&&(r[l]=g),g))}n.fromInt=p;function f(l,s){if(isNaN(l))return s?Oe:ge;if(s){if(l<0)return Oe;if(l>=tr)return sr}else{if(l<=-nr)return K;if(l+1>=nr)return or}return l<0?f(-l,s).neg():a(l%_t|0,l/_t|0,s)}n.fromNumber=f;function a(l,s,g){return new n(l,s,g)}n.fromBits=a;var S=Math.pow;function O(l,s,g){if(l.length===0)throw Error("empty string");if(typeof s=="number"?(g=s,s=!1):s=!!s,l==="NaN"||l==="Infinity"||l==="+Infinity"||l==="-Infinity")return s?Oe:ge;if(g=g||10,g<2||36<g)throw RangeError("radix");var b;if((b=l.indexOf("-"))>0)throw Error("interior hyphen");if(b===0)return O(l.substring(1),s,g).neg();for(var k=f(S(g,8)),w=ge,U=0;U<l.length;U+=8){var X=Math.min(8,l.length-U),se=parseInt(l.substring(U,U+X),g);if(X<8){var $=f(S(g,X));w=w.mul($).add(f(se))}else w=w.mul(k),w=w.add(f(se))}return w.unsigned=s,w}n.fromString=O;function y(l,s){return typeof l=="number"?f(l,s):typeof l=="string"?O(l,s):a(l.low,l.high,typeof s=="boolean"?s:l.unsigned)}n.fromValue=y;var q=65536,Tt=1<<24,_t=q*q,tr=_t*_t,nr=tr/2,rr=p(Tt),ge=p(0);n.ZERO=ge;var Oe=p(0,!0);n.UZERO=Oe;var Rt=p(1);n.ONE=Rt;var ir=p(1,!0);n.UONE=ir;var sn=p(-1);n.NEG_ONE=sn;var or=a(-1,2147483647,!1);n.MAX_VALUE=or;var sr=a(-1,-1,!0);n.MAX_UNSIGNED_VALUE=sr;var K=a(0,-2147483648,!1);n.MIN_VALUE=K;var c=n.prototype;c.toInt=function(){return this.unsigned?this.low>>>0:this.low},c.toNumber=function(){return this.unsigned?(this.high>>>0)*_t+(this.low>>>0):this.high*_t+(this.low>>>0)},c.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(K)){var g=f(s),b=this.div(g),k=b.mul(g).sub(this);return b.toString(s)+k.toInt().toString(s)}else return"-"+this.neg().toString(s);for(var w=f(S(s,6),this.unsigned),U=this,X="";;){var se=U.div(w),$=U.sub(se.mul(w)).toInt()>>>0,A=$.toString(s);if(U=se,U.isZero())return A+X;for(;A.length<6;)A="0"+A;X=""+A+X}},c.getHighBits=function(){return this.high},c.getHighBitsUnsigned=function(){return this.high>>>0},c.getLowBits=function(){return this.low},c.getLowBitsUnsigned=function(){return this.low>>>0},c.getNumBitsAbs=function(){if(this.isNegative())return this.eq(K)?64:this.neg().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,g=31;g>0&&(s&1<<g)==0;g--);return this.high!=0?g+33:g+1},c.isSafeInteger=function(){var s=this.high>>21;return s?this.unsigned?!1:s===-1&&!(this.low===0&&this.high===-2097152):!0},c.isZero=function(){return this.high===0&&this.low===0},c.eqz=c.isZero,c.isNegative=function(){return!this.unsigned&&this.high<0},c.isPositive=function(){return this.unsigned||this.high>=0},c.isOdd=function(){return(this.low&1)===1},c.isEven=function(){return(this.low&1)===0},c.equals=function(s){return o(s)||(s=y(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},c.eq=c.equals,c.notEquals=function(s){return!this.eq(s)},c.neq=c.notEquals,c.ne=c.notEquals,c.lessThan=function(s){return this.comp(s)<0},c.lt=c.lessThan,c.lessThanOrEqual=function(s){return this.comp(s)<=0},c.lte=c.lessThanOrEqual,c.le=c.lessThanOrEqual,c.greaterThan=function(s){return this.comp(s)>0},c.gt=c.greaterThan,c.greaterThanOrEqual=function(s){return this.comp(s)>=0},c.gte=c.greaterThanOrEqual,c.ge=c.greaterThanOrEqual,c.compare=function(s){if(o(s)||(s=y(s)),this.eq(s))return 0;var g=this.isNegative(),b=s.isNegative();return g&&!b?-1:!g&&b?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.sub(s).isNegative()?-1:1},c.comp=c.compare,c.negate=function(){return!this.unsigned&&this.eq(K)?K:this.not().add(Rt)},c.neg=c.negate,c.add=function(s){o(s)||(s=y(s));var g=this.high>>>16,b=this.high&65535,k=this.low>>>16,w=this.low&65535,U=s.high>>>16,X=s.high&65535,se=s.low>>>16,$=s.low&65535,A=0,ue=0,D=0,ee=0;return ee+=w+$,D+=ee>>>16,ee&=65535,D+=k+se,ue+=D>>>16,D&=65535,ue+=b+X,A+=ue>>>16,ue&=65535,A+=g+U,A&=65535,a(D<<16|ee,A<<16|ue,this.unsigned)},c.subtract=function(s){return o(s)||(s=y(s)),this.add(s.neg())},c.sub=c.subtract,c.multiply=function(s){if(this.isZero())return this;if(o(s)||(s=y(s)),t){var g=t.mul(this.low,this.high,s.low,s.high);return a(g,t.get_high(),this.unsigned)}if(s.isZero())return this.unsigned?Oe:ge;if(this.eq(K))return s.isOdd()?K:ge;if(s.eq(K))return this.isOdd()?K:ge;if(this.isNegative())return s.isNegative()?this.neg().mul(s.neg()):this.neg().mul(s).neg();if(s.isNegative())return this.mul(s.neg()).neg();if(this.lt(rr)&&s.lt(rr))return f(this.toNumber()*s.toNumber(),this.unsigned);var b=this.high>>>16,k=this.high&65535,w=this.low>>>16,U=this.low&65535,X=s.high>>>16,se=s.high&65535,$=s.low>>>16,A=s.low&65535,ue=0,D=0,ee=0,Gt=0;return Gt+=U*A,ee+=Gt>>>16,Gt&=65535,ee+=w*A,D+=ee>>>16,ee&=65535,ee+=U*$,D+=ee>>>16,ee&=65535,D+=k*A,ue+=D>>>16,D&=65535,D+=w*$,ue+=D>>>16,D&=65535,D+=U*se,ue+=D>>>16,D&=65535,ue+=b*A+k*$+w*se+U*X,ue&=65535,a(ee<<16|Gt,ue<<16|D,this.unsigned)},c.mul=c.multiply,c.divide=function(s){if(o(s)||(s=y(s)),s.isZero())throw Error("division by zero");if(t){if(!this.unsigned&&this.high===-2147483648&&s.low===-1&&s.high===-1)return this;var g=(this.unsigned?t.div_u:t.div_s)(this.low,this.high,s.low,s.high);return a(g,t.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Oe:ge;var b,k,w;if(this.unsigned){if(s.unsigned||(s=s.toUnsigned()),s.gt(this))return Oe;if(s.gt(this.shru(1)))return ir;w=Oe}else{if(this.eq(K)){if(s.eq(Rt)||s.eq(sn))return K;if(s.eq(K))return Rt;var U=this.shr(1);return b=U.div(s).shl(1),b.eq(ge)?s.isNegative()?Rt:sn:(k=this.sub(s.mul(b)),w=b.add(k.div(s)),w)}else if(s.eq(K))return this.unsigned?Oe:ge;if(this.isNegative())return s.isNegative()?this.neg().div(s.neg()):this.neg().div(s).neg();if(s.isNegative())return this.div(s.neg()).neg();w=ge}for(k=this;k.gte(s);){b=Math.max(1,Math.floor(k.toNumber()/s.toNumber()));for(var X=Math.ceil(Math.log(b)/Math.LN2),se=X<=48?1:S(2,X-48),$=f(b),A=$.mul(s);A.isNegative()||A.gt(k);)b-=se,$=f(b,this.unsigned),A=$.mul(s);$.isZero()&&($=Rt),w=w.add($),k=k.sub(A)}return w},c.div=c.divide,c.modulo=function(s){if(o(s)||(s=y(s)),t){var g=(this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,s.low,s.high);return a(g,t.get_high(),this.unsigned)}return this.sub(this.div(s).mul(s))},c.mod=c.modulo,c.rem=c.modulo,c.not=function(){return a(~this.low,~this.high,this.unsigned)},c.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},c.clz=c.countLeadingZeros,c.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},c.ctz=c.countTrailingZeros,c.and=function(s){return o(s)||(s=y(s)),a(this.low&s.low,this.high&s.high,this.unsigned)},c.or=function(s){return o(s)||(s=y(s)),a(this.low|s.low,this.high|s.high,this.unsigned)},c.xor=function(s){return o(s)||(s=y(s)),a(this.low^s.low,this.high^s.high,this.unsigned)},c.shiftLeft=function(s){return o(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?a(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):a(0,this.low<<s-32,this.unsigned)},c.shl=c.shiftLeft,c.shiftRight=function(s){return o(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?a(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):a(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},c.shr=c.shiftRight,c.shiftRightUnsigned=function(s){return o(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?a(this.low>>>s|this.high<<32-s,this.high>>>s,this.unsigned):s===32?a(this.high,0,this.unsigned):a(this.high>>>s-32,0,this.unsigned)},c.shru=c.shiftRightUnsigned,c.shr_u=c.shiftRightUnsigned,c.rotateLeft=function(s){var g;return o(s)&&(s=s.toInt()),(s&=63)===0?this:s===32?a(this.high,this.low,this.unsigned):s<32?(g=32-s,a(this.low<<s|this.high>>>g,this.high<<s|this.low>>>g,this.unsigned)):(s-=32,g=32-s,a(this.high<<s|this.low>>>g,this.low<<s|this.high>>>g,this.unsigned))},c.rotl=c.rotateLeft,c.rotateRight=function(s){var g;return o(s)&&(s=s.toInt()),(s&=63)===0?this:s===32?a(this.high,this.low,this.unsigned):s<32?(g=32-s,a(this.high<<g|this.low>>>s,this.low<<g|this.high>>>s,this.unsigned)):(s-=32,g=32-s,a(this.low<<g|this.high>>>s,this.high<<g|this.low>>>s,this.unsigned))},c.rotr=c.rotateRight,c.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},c.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},c.toBytes=function(s){return s?this.toBytesLE():this.toBytesBE()},c.toBytesLE=function(){var s=this.high,g=this.low;return[g&255,g>>>8&255,g>>>16&255,g>>>24,s&255,s>>>8&255,s>>>16&255,s>>>24]},c.toBytesBE=function(){var s=this.high,g=this.low;return[s>>>24,s>>>16&255,s>>>8&255,s&255,g>>>24,g>>>16&255,g>>>8&255,g&255]},n.fromBytes=function(s,g,b){return b?n.fromBytesLE(s,g):n.fromBytesBE(s,g)},n.fromBytesLE=function(s,g){return new n(s[0]|s[1]<<8|s[2]<<16|s[3]<<24,s[4]|s[5]<<8|s[6]<<16|s[7]<<24,g)},n.fromBytesBE=function(s,g){return new n(s[4]<<24|s[5]<<16|s[6]<<8|s[7],s[0]<<24|s[1]<<16|s[2]<<8|s[3],g)},typeof BigInt=="function"&&(n.fromBigInt=function(s,g){var b=Number(BigInt.asIntN(32,s)),k=Number(BigInt.asIntN(32,s>>BigInt(32)));return a(b,k,g)},n.fromValue=function(s,g){return typeof s=="bigint"?n.fromBigInt(s,g):y(s,g)},c.toBigInt=function(){var s=BigInt(this.low>>>0),g=BigInt(this.unsigned?this.high>>>0:this.high);return g<<BigInt(32)|s});var nu=e.default=n})});var Fe=M(gn=>{"use strict";d();var E=gn;E.asPromise=pr();E.base64=Er();E.EventEmitter=yr();E.float=Ir();E.inquire=wr();E.utf8=xr();E.pool=Lr();E.LongBits=Pr();function Mr(e){return e==="__proto__"||e==="prototype"||e==="constructor"}E.isUnsafeProperty=Mr;E.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);E.global=E.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||gn;E.emptyArray=Object.freeze?Object.freeze([]):[];E.emptyObject=Object.freeze?Object.freeze({}):{};E.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};E.isString=function(t){return typeof t=="string"||t instanceof String};E.isObject=function(t){return t&&typeof t=="object"};E.isset=E.isSet=function(t,n){var o=t[n];return o!=null&&Object.hasOwnProperty.call(t,n)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};E.Buffer=(function(){try{var e=E.global.Buffer;return e.prototype.utf8Write?e:null}catch{return null}})();E._Buffer_from=null;E._Buffer_allocUnsafe=null;E.newBuffer=function(t){return typeof t=="number"?E.Buffer?E._Buffer_allocUnsafe(t):new E.Array(t):E.Buffer?E._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};E.Array=typeof Uint8Array<"u"?Uint8Array:Array;E.Long=E.global.dcodeIO&&E.global.dcodeIO.Long||E.global.Long||(function(){try{var e=Ur();return e&&e.isLong?e:null}catch{return null}})();E.key2Re=/^true|false|0|1$/;E.key32Re=/^-?(?:0|[1-9][0-9]*)$/;E.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;E.longToHash=function(t){return t?E.LongBits.from(t).toHash():E.LongBits.zeroHash};E.longFromHash=function(t,n){var o=E.LongBits.fromHash(t);return E.Long?E.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function Dr(e){var t=typeof arguments[arguments.length-1]=="boolean",n=t?arguments.length-1:arguments.length;t=t&&arguments[arguments.length-1];for(var o=1;o<n;++o){var i=arguments[o];if(i)for(var r=Object.keys(i),u=0;u<r.length;++u)!Mr(r[u])&&(e[r[u]]===void 0||!t)&&(e[r[u]]=i[r[u]])}return e}E.merge=Dr;E.nestingLimit=32;E.recursionLimit=100;E.makeProp=function(t,n){Object.defineProperty(t,n,{enumerable:!0,configurable:!0,writable:!0})};E.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Br(e){function t(n,o){if(!(this instanceof t))return new t(n,o);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&Dr(this,o)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}E.newError=Br;E.ProtocolError=Br("ProtocolError");E.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var i=Object.keys(this),r=i.length-1;r>-1;--r)if(n[i[r]]===1&&this[i[r]]!==void 0&&this[i[r]]!==null)return i[r]}};E.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};E.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};E._configure=function(){var e=E.Buffer;if(!e){E._Buffer_from=E._Buffer_allocUnsafe=null;return}E._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},E._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var bn=M((qu,qr)=>{"use strict";d();qr.exports=T;var ae=Fe(),mn,Xt=ae.LongBits,Jr=ae.base64,Fr=ae.utf8;function Mt(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function En(){}function as(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function T(){this.len=0,this.head=new Mt(En,0,0),this.tail=this.head,this.states=null}var Wr=function(){return ae.Buffer?function(){return(T.create=function(){return new mn})()}:function(){return new T}};T.create=Wr();T.alloc=function(t){return new ae.Array(t)};ae.Array!==Array&&(T.alloc=ae.pool(T.alloc,ae.Array.prototype.subarray));T.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Mt(t,n,o),this.len+=n,this};function vn(e,t,n){t[n]=e&255}function fs(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function yn(e,t){this.len=e,this.next=void 0,this.val=t}yn.prototype=Object.create(Mt.prototype);yn.prototype.fn=fs;T.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new yn((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};T.prototype.int32=function(t){return(t|=0)<0?this._push(Nn,10,Xt.fromNumber(t)):this.uint32(t)};T.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Nn(e,t,n){for(var o=e.lo,i=e.hi;i;)t[n++]=o&127|128,o=(o>>>7|i<<25)>>>0,i>>>=7;for(;o>127;)t[n++]=o&127|128,o=o>>>7;t[n++]=o}T.prototype.uint64=function(t){var n=Xt.from(t);return this._push(Nn,n.length(),n)};T.prototype.int64=T.prototype.uint64;T.prototype.sint64=function(t){var n=Xt.from(t).zzEncode();return this._push(Nn,n.length(),n)};T.prototype.bool=function(t){return this._push(vn,1,t?1:0)};function Sn(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}T.prototype.fixed32=function(t){return this._push(Sn,4,t>>>0)};T.prototype.sfixed32=T.prototype.fixed32;T.prototype.fixed64=function(t){var n=Xt.from(t);return this._push(Sn,4,n.lo)._push(Sn,4,n.hi)};T.prototype.sfixed64=T.prototype.fixed64;T.prototype.float=function(t){return this._push(ae.float.writeFloatLE,4,t)};T.prototype.double=function(t){return this._push(ae.float.writeDoubleLE,8,t)};var ds=ae.Array.prototype.set?function(t,n,o){n.set(t,o)}:function(t,n,o){for(var i=0;i<t.length;++i)n[o+i]=t[i]};T.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(vn,1,0);if(ae.isString(t)){var o=T.alloc(n=Jr.length(t));Jr.decode(t,o,0),t=o}return this.uint32(n)._push(ds,n,t)};T.prototype.string=function(t){var n=Fr.length(t);return n?this.uint32(n)._push(Fr.write,n,t):this._push(vn,1,0)};T.prototype.fork=function(){return this.states=new as(this),this.head=this.tail=new Mt(En,0,0),this.len=0,this};T.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Mt(En,0,0),this.len=0),this};T.prototype.ldelim=function(){var t=this.head,n=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=t.next,this.tail=n,this.len+=o),this};T.prototype.finish=function(){for(var t=this.head.next,n=this.constructor.alloc(this.len),o=0;t;)t.fn(t.val,n,o),o+=t.len,t=t.next;return n};T._configure=function(e){mn=e,T.create=Wr(),mn._configure()}});var Zr=M((Gu,Gr)=>{"use strict";d();Gr.exports=ve;var $r=bn();(ve.prototype=Object.create($r.prototype)).constructor=ve;var We=Fe();function ve(){$r.call(this)}ve._configure=function(){ve.alloc=We._Buffer_allocUnsafe,ve.writeBytesBuffer=We.Buffer&&We.Buffer.prototype instanceof Uint8Array&&We.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};ve.prototype.bytes=function(t){We.isString(t)&&(t=We._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(ve.writeBytesBuffer,n,t),this};function ls(e,t,n){e.length<40?We.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}ve.prototype.string=function(t){var n=We.Buffer.byteLength(t);return this.uint32(n),n&&this._push(ls,n,t),this};ve._configure()});var Rn=M((Hu,Yr)=>{"use strict";d();Yr.exports=x;var fe=Fe(),_n,Kr=fe.LongBits,cs=fe.utf8;function Se(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function x(e){this.buf=e,this.pos=0,this.len=e.length}var Hr=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new x(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new x(t);throw Error("illegal buffer")},Xr=function(){return fe.Buffer?function(n){return(x.create=function(i){return fe.Buffer.isBuffer(i)?new _n(i):Hr(i)})(n)}:Hr};x.create=Xr();x.prototype._slice=fe.Array.prototype.subarray||fe.Array.prototype.slice;x.prototype.uint32=(function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Se(this,10);return t}})();x.prototype.int32=function(){return this.uint32()|0};x.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Tn(){var e=new Kr(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Se(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Se(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}x.prototype.bool=function(){return this.uint32()!==0};function Yt(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}x.prototype.fixed32=function(){if(this.pos+4>this.len)throw Se(this,4);return Yt(this.buf,this.pos+=4)};x.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Se(this,4);return Yt(this.buf,this.pos+=4)|0};function zr(){if(this.pos+8>this.len)throw Se(this,8);return new Kr(Yt(this.buf,this.pos+=4),Yt(this.buf,this.pos+=4))}x.prototype.float=function(){if(this.pos+4>this.len)throw Se(this,4);var t=fe.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};x.prototype.double=function(){if(this.pos+8>this.len)throw Se(this,4);var t=fe.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};x.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw Se(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=fe.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};x.prototype.string=function(){var t=this.bytes();return cs.read(t,0,t.length)};x.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Se(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Se(this);while(this.buf[this.pos++]&128);return this};x.recursionLimit=fe.recursionLimit;x.prototype.skipType=function(e,t){if(t===void 0&&(t=0),t>x.recursionLimit)throw Error("maximum nesting depth exceeded");switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e,t+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};x._configure=function(e){_n=e,x.create=Xr(),_n._configure();var t=fe.Long?"toLong":"toNumber";fe.merge(x.prototype,{int64:function(){return Tn.call(this)[t](!1)},uint64:function(){return Tn.call(this)[t](!0)},sint64:function(){return Tn.call(this).zzDecode()[t](!1)},fixed64:function(){return zr.call(this)[t](!0)},sfixed64:function(){return zr.call(this)[t](!1)}})}});var ti=M((Ku,ei)=>{"use strict";d();ei.exports=lt;var jr=Rn();(lt.prototype=Object.create(jr.prototype)).constructor=lt;var Qr=Fe();function lt(e){jr.call(this,e)}lt._configure=function(){Qr.Buffer&&(lt.prototype._slice=Qr.Buffer.prototype.slice)};lt.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};lt._configure()});var ri=M((Yu,ni)=>{"use strict";d();ni.exports=Dt;var On=Fe();(Dt.prototype=Object.create(On.EventEmitter.prototype)).constructor=Dt;function Dt(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");On.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}Dt.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var u=this;if(!r)return On.asPromise(e,u,t,n,o,i);if(!u.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return u.rpcImpl(t,n[u.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(f,a){if(f)return u.emit("error",f,t),r(f);if(a===null){u.end(!0);return}if(!(a instanceof o))try{a=o[u.responseDelimited?"decodeDelimited":"decode"](a)}catch(S){return u.emit("error",S,t),r(S)}return u.emit("data",a,t),r(null,a)})}catch(p){u.emit("error",p,t),setTimeout(function(){r(p)},0);return}};Dt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var oi=M(ii=>{"use strict";d();var hs=ii;hs.Service=ri()});var ui=M((ta,si)=>{"use strict";d();si.exports=Object.create(null)});var di=M(fi=>{"use strict";d();var Y=fi;Y.build="minimal";Y.Writer=bn();Y.BufferWriter=Zr();Y.Reader=Rn();Y.BufferReader=ti();Y.util=Fe();Y.rpc=oi();Y.roots=ui();Y.configure=ai;function ai(){Y.util._configure(),Y.Writer._configure(Y.BufferWriter),Y.Reader._configure(Y.BufferReader)}ai()});var W=M((oa,li)=>{"use strict";d();li.exports=di()});d();d();d();var ar="clientVersion",an="devvit.v1.min.js",fn="screenshot.v1.min.js",fr=`https://webview.devvit.net/scripts/${an}`;function dr(e){if(e.currentScript&&"src"in e.currentScript)return new URL(e.currentScript.src).searchParams.get(ar)??void 0}function lr(e){if(e.currentScript&&"src"in e.currentScript)return e.currentScript.src}d();d();var Ot;(function(e){e[e.CLIENT_UNSPECIFIED=0]="CLIENT_UNSPECIFIED",e[e.ANDROID=1]="ANDROID",e[e.IOS=2]="IOS",e[e.SHREDDIT=3]="SHREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ot||(Ot={}));var cr;(function(e){e[e.HEIGHT_UNSPECIFIED=0]="HEIGHT_UNSPECIFIED",e[e.REGULAR=1]="REGULAR",e[e.TALL=2]="TALL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(cr||(cr={}));d();d();function Zt(e,t){if(!e)throw Error(t)}var Be;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(Be||(Be={}));function Qo(e){return!!e?.startsWith(Be.ACCOUNT)}function jo(e){return!!e?.startsWith(Be.LINK)}function es(e){return!!e?.startsWith(Be.SUBREDDIT)}function ts(e){Zt(Qo(e),`Expected account id to start with ${Be.ACCOUNT}, got ${e}`)}function ns(e){Zt(jo(e),`Expected link id to start with ${Be.LINK}, got ${e}`)}function rs(e){Zt(es(e),`Expected subreddit id to start with ${Be.SUBREDDIT}, got ${e}`)}function Ht(e){return ts(e),e}function dn(e){return ns(e),e}function ln(e){return rs(e),e}d();d();d();var z;(function(e){e[e.EFFECT_REALTIME_SUB=0]="EFFECT_REALTIME_SUB",e[e.EFFECT_RERENDER_UI=1]="EFFECT_RERENDER_UI",e[e.EFFECT_RELOAD_PART=2]="EFFECT_RELOAD_PART",e[e.EFFECT_SHOW_FORM=3]="EFFECT_SHOW_FORM",e[e.EFFECT_SHOW_TOAST=4]="EFFECT_SHOW_TOAST",e[e.EFFECT_NAVIGATE_TO_URL=5]="EFFECT_NAVIGATE_TO_URL",e[e.EFFECT_SET_INTERVALS=7]="EFFECT_SET_INTERVALS",e[e.EFFECT_CREATE_ORDER=8]="EFFECT_CREATE_ORDER",e[e.EFFECT_WEB_VIEW=9]="EFFECT_WEB_VIEW",e[e.EFFECT_CAN_RUN_AS_USER=11]="EFFECT_CAN_RUN_AS_USER",e[e.EFFECT_TELEMETRY=12]="EFFECT_TELEMETRY",e[e.EFFECT_UPDATE_REQUEST_CONTEXT=13]="EFFECT_UPDATE_REQUEST_CONTEXT",e[e.EFFECT_SCREENSHOT_RESPONSE=14]="EFFECT_SCREENSHOT_RESPONSE",e[e.EFFECT_LOGIN_PROMPT=15]="EFFECT_LOGIN_PROMPT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(z||(z={}));d();d();var At;(function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(At||(At={}));d();var L=G(W(),1);d();var te=G(W(),1);d();var m=new Map;var ht;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ht||(ht={}));function ps(e){switch(e){case 0:case"NULL_VALUE":return ht.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return ht.UNRECOGNIZED}}function gs(e){switch(e){case ht.NULL_VALUE:return 0;case ht.UNRECOGNIZED:default:return-1}}function In(){return{fields:{}}}var de={$type:"google.protobuf.Struct",encode(e,t=te.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&Bt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=In();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let u=Bt.decode(n,n.uint32());u.value!==void 0&&(i.fields[u.key]=u.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:hi(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,i])=>{t.fields[o]=i}))}return t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=In();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=In();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};m.set(de.$type,de);function ci(){return{key:"",value:void 0}}var Bt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=te.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Ct(e.key)?globalThis.String(e.key):"",value:Ct(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return Bt.fromPartial(e??{})},fromPartial(e){let t=ci();return t.key=e.key??"",t.value=e.value??void 0,t}};m.set(Bt.$type,Bt);function Cn(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Z={$type:"google.protobuf.Value",encode(e,t=te.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&de.encode(de.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&ct.encode(ct.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Cn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.nullValue=n.int32();continue;case 2:if(r!==17)break;i.numberValue=n.double();continue;case 3:if(r!==26)break;i.stringValue=n.string();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.structValue=de.unwrap(de.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=ct.unwrap(ct.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:Ct(e.nullValue)?ps(e.nullValue):void 0,numberValue:Ct(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:Ct(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:Ct(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:hi(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=gs(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return Z.fromPartial(e??{})},fromPartial(e){let t=Cn();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=Cn();if(e===null)t.nullValue=ht.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};m.set(Z.$type,Z);function wn(){return{values:[]}}var ct={$type:"google.protobuf.ListValue",encode(e,t=te.default.Writer.create()){for(let n of e.values)Z.encode(Z.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(Z.unwrap(Z.decode(n,n.uint32())));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return ct.fromPartial(e??{})},fromPartial(e){let t=wn();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=wn();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};m.set(ct.$type,ct);function hi(e){return typeof e=="object"&&e!==null}function Ct(e){return e!=null}d();var St=G(W(),1);d();var C=G(W(),1);d();d();var le=null;try{le=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function I(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}I.prototype.__isLong__;Object.defineProperty(I.prototype,"__isLong__",{value:!0});function H(e){return(e&&e.__isLong__)===!0}function pi(e){var t=Math.clz32(e&-e);return e?31-t:t}I.isLong=H;var gi={},mi={};function pt(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=mi[e],o)?o:(n=_(e,0,!0),i&&(mi[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=gi[e],o)?o:(n=_(e,e<0?-1:0,!1),i&&(gi[e]=n),n))}I.fromInt=pt;function ce(e,t){if(isNaN(e))return t?Ie:Ee;if(t){if(e<0)return Ie;if(e>=yi)return Ti}else{if(e<=-Ei)return Q;if(e+1>=Ei)return bi}return e<0?ce(-e,t).neg():_(e%kt|0,e/kt|0,t)}I.fromNumber=ce;function _(e,t,n){return new I(e,t,n)}I.fromBits=_;var Qt=Math.pow;function xn(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Ie:Ee;if(n=n||10,n<2||36<n)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return xn(e.substring(1),t,n).neg();for(var i=ce(Qt(n,8)),r=Ee,u=0;u<e.length;u+=8){var p=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+p),n);if(p<8){var a=ce(Qt(n,p));r=r.mul(a).add(ce(f))}else r=r.mul(i),r=r.add(ce(f))}return r.unsigned=t,r}I.fromString=xn;function he(e,t){return typeof e=="number"?ce(e,t):typeof e=="string"?xn(e,t):_(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}I.fromValue=he;var Si=65536,ms=1<<24,kt=Si*Si,yi=kt*kt,Ei=yi/2,vi=pt(ms),Ee=pt(0);I.ZERO=Ee;var Ie=pt(0,!0);I.UZERO=Ie;var wt=pt(1);I.ONE=wt;var Ni=pt(1,!0);I.UONE=Ni;var kn=pt(-1);I.NEG_ONE=kn;var bi=_(-1,2147483647,!1);I.MAX_VALUE=bi;var Ti=_(-1,-1,!0);I.MAX_UNSIGNED_VALUE=Ti;var Q=_(0,-2147483648,!1);I.MIN_VALUE=Q;var h=I.prototype;h.toInt=function(){return this.unsigned?this.low>>>0:this.low};h.toNumber=function(){return this.unsigned?(this.high>>>0)*kt+(this.low>>>0):this.high*kt+(this.low>>>0)};h.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Q)){var n=ce(t),o=this.div(n),i=o.mul(n).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var r=ce(Qt(t,6),this.unsigned),u=this,p="";;){var f=u.div(r),a=u.sub(f.mul(r)).toInt()>>>0,S=a.toString(t);if(u=f,u.isZero())return S+p;for(;S.length<6;)S="0"+S;p=""+S+p}};h.getHighBits=function(){return this.high};h.getHighBitsUnsigned=function(){return this.high>>>0};h.getLowBits=function(){return this.low};h.getLowBitsUnsigned=function(){return this.low>>>0};h.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Q)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&(t&1<<n)==0;n--);return this.high!=0?n+33:n+1};h.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};h.isZero=function(){return this.high===0&&this.low===0};h.eqz=h.isZero;h.isNegative=function(){return!this.unsigned&&this.high<0};h.isPositive=function(){return this.unsigned||this.high>=0};h.isOdd=function(){return(this.low&1)===1};h.isEven=function(){return(this.low&1)===0};h.equals=function(t){return H(t)||(t=he(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};h.eq=h.equals;h.notEquals=function(t){return!this.eq(t)};h.neq=h.notEquals;h.ne=h.notEquals;h.lessThan=function(t){return this.comp(t)<0};h.lt=h.lessThan;h.lessThanOrEqual=function(t){return this.comp(t)<=0};h.lte=h.lessThanOrEqual;h.le=h.lessThanOrEqual;h.greaterThan=function(t){return this.comp(t)>0};h.gt=h.greaterThan;h.greaterThanOrEqual=function(t){return this.comp(t)>=0};h.gte=h.greaterThanOrEqual;h.ge=h.greaterThanOrEqual;h.compare=function(t){if(H(t)||(t=he(t)),this.eq(t))return 0;var n=this.isNegative(),o=t.isNegative();return n&&!o?-1:!n&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};h.comp=h.compare;h.negate=function(){return!this.unsigned&&this.eq(Q)?Q:this.not().add(wt)};h.neg=h.negate;h.add=function(t){H(t)||(t=he(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,u=t.high>>>16,p=t.high&65535,f=t.low>>>16,a=t.low&65535,S=0,O=0,y=0,q=0;return q+=r+a,y+=q>>>16,q&=65535,y+=i+f,O+=y>>>16,y&=65535,O+=o+p,S+=O>>>16,O&=65535,S+=n+u,S&=65535,_(y<<16|q,S<<16|O,this.unsigned)};h.subtract=function(t){return H(t)||(t=he(t)),this.add(t.neg())};h.sub=h.subtract;h.multiply=function(t){if(this.isZero())return this;if(H(t)||(t=he(t)),le){var n=le.mul(this.low,this.high,t.low,t.high);return _(n,le.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Ie:Ee;if(this.eq(Q))return t.isOdd()?Q:Ee;if(t.eq(Q))return this.isOdd()?Q:Ee;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(vi)&&t.lt(vi))return ce(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,u=this.low&65535,p=t.high>>>16,f=t.high&65535,a=t.low>>>16,S=t.low&65535,O=0,y=0,q=0,Tt=0;return Tt+=u*S,q+=Tt>>>16,Tt&=65535,q+=r*S,y+=q>>>16,q&=65535,q+=u*a,y+=q>>>16,q&=65535,y+=i*S,O+=y>>>16,y&=65535,y+=r*a,O+=y>>>16,y&=65535,y+=u*f,O+=y>>>16,y&=65535,O+=o*S+i*a+r*f+u*p,O&=65535,_(q<<16|Tt,O<<16|y,this.unsigned)};h.mul=h.multiply;h.divide=function(t){if(H(t)||(t=he(t)),t.isZero())throw Error("division by zero");if(le){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?le.div_u:le.div_s)(this.low,this.high,t.low,t.high);return _(n,le.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ie:Ee;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ie;if(t.gt(this.shru(1)))return Ni;r=Ie}else{if(this.eq(Q)){if(t.eq(wt)||t.eq(kn))return Q;if(t.eq(Q))return wt;var u=this.shr(1);return o=u.div(t).shl(1),o.eq(Ee)?t.isNegative()?wt:kn:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(Q))return this.unsigned?Ie:Ee;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=Ee}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var p=Math.ceil(Math.log(o)/Math.LN2),f=p<=48?1:Qt(2,p-48),a=ce(o),S=a.mul(t);S.isNegative()||S.gt(i);)o-=f,a=ce(o,this.unsigned),S=a.mul(t);a.isZero()&&(a=wt),r=r.add(a),i=i.sub(S)}return r};h.div=h.divide;h.modulo=function(t){if(H(t)||(t=he(t)),le){var n=(this.unsigned?le.rem_u:le.rem_s)(this.low,this.high,t.low,t.high);return _(n,le.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};h.mod=h.modulo;h.rem=h.modulo;h.not=function(){return _(~this.low,~this.high,this.unsigned)};h.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};h.clz=h.countLeadingZeros;h.countTrailingZeros=function(){return this.low?pi(this.low):pi(this.high)+32};h.ctz=h.countTrailingZeros;h.and=function(t){return H(t)||(t=he(t)),_(this.low&t.low,this.high&t.high,this.unsigned)};h.or=function(t){return H(t)||(t=he(t)),_(this.low|t.low,this.high|t.high,this.unsigned)};h.xor=function(t){return H(t)||(t=he(t)),_(this.low^t.low,this.high^t.high,this.unsigned)};h.shiftLeft=function(t){return H(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?_(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):_(0,this.low<<t-32,this.unsigned)};h.shl=h.shiftLeft;h.shiftRight=function(t){return H(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?_(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):_(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};h.shr=h.shiftRight;h.shiftRightUnsigned=function(t){return H(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?_(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?_(this.high,0,this.unsigned):_(this.high>>>t-32,0,this.unsigned)};h.shru=h.shiftRightUnsigned;h.shr_u=h.shiftRightUnsigned;h.rotateLeft=function(t){var n;return H(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?_(this.high,this.low,this.unsigned):t<32?(n=32-t,_(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,_(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};h.rotl=h.rotateLeft;h.rotateRight=function(t){var n;return H(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?_(this.high,this.low,this.unsigned):t<32?(n=32-t,_(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,_(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};h.rotr=h.rotateRight;h.toSigned=function(){return this.unsigned?_(this.low,this.high,!1):this};h.toUnsigned=function(){return this.unsigned?this:_(this.low,this.high,!0)};h.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};h.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};h.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};I.fromBytes=function(t,n,o){return o?I.fromBytesLE(t,n):I.fromBytesBE(t,n)};I.fromBytesLE=function(t,n){return new I(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};I.fromBytesBE=function(t,n){return new I(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};typeof BigInt=="function"&&(I.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return _(o,i,n)},I.fromValue=function(t,n){return typeof t=="bigint"?I.fromBigInt(t,n):he(t,n)},h.toBigInt=function(){var t=BigInt(this.low>>>0),n=BigInt(this.unsigned?this.high>>>0:this.high);return n<<BigInt(32)|t});var Vn=I;var gt=G(W(),1);function _i(){return{seconds:0,nanos:0}}var mt={$type:"google.protobuf.Timestamp",encode(e,t=gt.default.Writer.create()){return e.seconds!==0&&t.uint32(8).int64(e.seconds),e.nanos!==0&&t.uint32(16).int32(e.nanos),t},decode(e,t){let n=e instanceof gt.default.Reader?e:gt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_i();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=Ss(n.int64());continue;case 2:if(r!==16)break;i.nanos=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{seconds:Ri(e.seconds)?globalThis.Number(e.seconds):0,nanos:Ri(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==0&&(t.seconds=Math.round(e.seconds)),e.nanos!==0&&(t.nanos=Math.round(e.nanos)),t},create(e){return mt.fromPartial(e??{})},fromPartial(e){let t=_i();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};m.set(mt.$type,mt);function Ss(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}gt.default.util.Long!==Vn&&(gt.default.util.Long=Vn,gt.default.configure());function Ri(e){return e!=null}var ye;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ye||(ye={}));function Bn(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ye.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ye.REVOKED;case 2:case"GRANTED":return ye.GRANTED;case-1:case"UNRECOGNIZED":default:return ye.UNRECOGNIZED}}function Jn(e){switch(e){case ye.CONSENT_STATUS_UNKNOWN:return 0;case ye.REVOKED:return 1;case ye.GRANTED:return 2;case ye.UNRECOGNIZED:default:return-1}}var pe;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(pe||(pe={}));function Pi(e){switch(e){case 0:case"SCOPE_UNKNOWN":return pe.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return pe.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return pe.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return pe.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return pe.UNRECOGNIZED}}function Ui(e){switch(e){case pe.SCOPE_UNKNOWN:return 0;case pe.SUBMIT_POST:return 1;case pe.SUBMIT_COMMENT:return 2;case pe.SUBSCRIBE_TO_SUBREDDIT:return 3;case pe.UNRECOGNIZED:default:return-1}}function Oi(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var qe={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=C.default.Writer.create()){e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.subredditId!==""&&t.uint32(18).string(e.subredditId),t.uint32(26).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),e.consentStatus!==0&&t.uint32(32).int32(e.consentStatus),e.updatedAt!==void 0&&mt.encode(Es(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Oi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.subredditId=n.string();continue;case 3:if(r===24){i.scopes.push(n.int32());continue}if(r===26){let u=n.uint32()+n.pos;for(;n.pos<u;)i.scopes.push(n.int32());continue}break;case 4:if(r!==32)break;i.consentStatus=n.int32();continue;case 5:if(r!==42)break;i.updatedAt=Mi(mt.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:J(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Pi(t)):[],consentStatus:J(e.consentStatus)?Bn(e.consentStatus):0,updatedAt:J(e.updatedAt)?vs(e.updatedAt):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Ui(n))),e.consentStatus!==0&&(t.consentStatus=Jn(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return qe.fromPartial(e??{})},fromPartial(e){let t=Oi();return t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t.consentStatus=e.consentStatus??0,t.updatedAt=e.updatedAt??void 0,t}};m.set(qe.$type,qe);function Ii(){return{appSlug:"",appName:"",termsAndConditions:void 0,privacyPolicy:void 0}}var $e={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=C.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),e.termsAndConditions!==void 0&&t.uint32(26).string(e.termsAndConditions),e.privacyPolicy!==void 0&&t.uint32(34).string(e.privacyPolicy),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ii();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.appName=n.string();continue;case 3:if(r!==26)break;i.termsAndConditions=n.string();continue;case 4:if(r!==34)break;i.privacyPolicy=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",appName:J(e.appName)?globalThis.String(e.appName):"",termsAndConditions:J(e.termsAndConditions)?globalThis.String(e.termsAndConditions):void 0,privacyPolicy:J(e.privacyPolicy)?globalThis.String(e.privacyPolicy):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),e.termsAndConditions!==void 0&&(t.termsAndConditions=e.termsAndConditions),e.privacyPolicy!==void 0&&(t.privacyPolicy=e.privacyPolicy),t},create(e){return $e.fromPartial(e??{})},fromPartial(e){let t=Ii();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t.termsAndConditions=e.termsAndConditions??void 0,t.privacyPolicy=e.privacyPolicy??void 0,t}};m.set($e.$type,$e);function Ci(){return{userId:""}}var Ln={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=C.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:J(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return Ln.fromPartial(e??{})},fromPartial(e){let t=Ci();return t.userId=e.userId??"",t}};m.set(Ln.$type,Ln);function wi(){return{appPermissions:[],devvitApps:[]}}var An={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=C.default.Writer.create()){for(let n of e.appPermissions)qe.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)$e.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(qe.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push($e.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(t=>qe.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>$e.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>qe.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>$e.toJSON(n))),t},create(e){return An.fromPartial(e??{})},fromPartial(e){let t=wi();return t.appPermissions=e.appPermissions?.map(n=>qe.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>$e.fromPartial(n))||[],t}};m.set(An.$type,An);function ki(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Pn={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=C.default.Writer.create()){e.userId!==""&&t.uint32(10).string(e.userId),e.appSlug!==""&&t.uint32(18).string(e.appSlug),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t.uint32(34).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ki();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue;case 4:if(r===32){i.scopes.push(n.int32());continue}if(r===34){let u=n.uint32()+n.pos;for(;n.pos<u;)i.scopes.push(n.int32());continue}break}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:J(e.userId)?globalThis.String(e.userId):"",appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:J(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Pi(t)):[]}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Ui(n))),t},create(e){return Pn.fromPartial(e??{})},fromPartial(e){let t=ki();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};m.set(Pn.$type,Pn);function xi(){return{error:void 0}}var Un={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=C.default.Writer.create()){return e.error!==void 0&&ne.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=xi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=ne.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:J(e.error)?ne.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=ne.toJSON(e.error)),t},create(e){return Un.fromPartial(e??{})},fromPartial(e){let t=xi();return t.error=e.error!==void 0&&e.error!==null?ne.fromPartial(e.error):void 0,t}};m.set(Un.$type,Un);function Vi(){return{appSlug:"",userId:"",subredditId:""}}var Mn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=C.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.userId!==""&&t.uint32(18).string(e.userId),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.userId=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",userId:J(e.userId)?globalThis.String(e.userId):"",subredditId:J(e.subredditId)?globalThis.String(e.subredditId):""}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.userId!==""&&(t.userId=e.userId),e.subredditId!==""&&(t.subredditId=e.subredditId),t},create(e){return Mn.fromPartial(e??{})},fromPartial(e){let t=Vi();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};m.set(Mn.$type,Mn);function Li(){return{error:void 0}}var Dn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=C.default.Writer.create()){return e.error!==void 0&&ne.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Li();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=ne.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:J(e.error)?ne.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=ne.toJSON(e.error)),t},create(e){return Dn.fromPartial(e??{})},fromPartial(e){let t=Li();return t.error=e.error!==void 0&&e.error!==null?ne.fromPartial(e.error):void 0,t}};m.set(Dn.$type,Dn);function Ai(){return{message:""}}var ne={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=C.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ai();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:J(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return ne.fromPartial(e??{})},fromPartial(e){let t=Ai();return t.message=e.message??"",t}};m.set(ne.$type,ne);function Es(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function Mi(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function vs(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Mi(mt.fromJSON(e))}function J(e){return e!=null}function Di(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var Fn={$type:"devvit.ui.effect_types.v1alpha.CanRunAsUserEffect",encode(e,t=St.default.Writer.create()){return e.postId!==void 0&&t.uint32(10).string(e.postId),e.appSlug!==void 0&&t.uint32(18).string(e.appSlug),e.subredditId!==void 0&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof St.default.Reader?e:St.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Di();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postId:jt(e.postId)?globalThis.String(e.postId):void 0,appSlug:jt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:jt(e.subredditId)?globalThis.String(e.subredditId):void 0}},toJSON(e){let t={};return e.postId!==void 0&&(t.postId=e.postId),e.appSlug!==void 0&&(t.appSlug=e.appSlug),e.subredditId!==void 0&&(t.subredditId=e.subredditId),t},create(e){return Fn.fromPartial(e??{})},fromPartial(e){let t=Di();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};m.set(Fn.$type,Fn);function Bi(){return{consentStatus:0}}var Ce={$type:"devvit.ui.effect_types.v1alpha.ConsentStatusEvent",encode(e,t=St.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof St.default.Reader?e:St.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Bi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.consentStatus=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{consentStatus:jt(e.consentStatus)?Bn(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=Jn(e.consentStatus)),t},create(e){return Ce.fromPartial(e??{})},fromPartial(e){let t=Bi();return t.consentStatus=e.consentStatus??0,t}};m.set(Ce.$type,Ce);function jt(e){return e!=null}d();var be=G(W(),1);var Ne;(function(e){e[e.STATUS_CANCELLED=0]="STATUS_CANCELLED",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_ERROR=2]="STATUS_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ne||(Ne={}));function ys(e){switch(e){case 0:case"STATUS_CANCELLED":return Ne.STATUS_CANCELLED;case 1:case"STATUS_SUCCESS":return Ne.STATUS_SUCCESS;case 2:case"STATUS_ERROR":return Ne.STATUS_ERROR;case-1:case"UNRECOGNIZED":default:return Ne.UNRECOGNIZED}}function Ns(e){switch(e){case Ne.STATUS_CANCELLED:return 0;case Ne.STATUS_SUCCESS:return 1;case Ne.STATUS_ERROR:return 2;case Ne.UNRECOGNIZED:default:return-1}}function Ji(){return{id:"",skus:[],metadata:{}}}var Ge={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect",encode(e,t=be.default.Writer.create()){e.id!==""&&t.uint32(10).string(e.id);for(let n of e.skus)t.uint32(18).string(n);return Object.entries(e.metadata).forEach(([n,o])=>{Jt.encode({key:n,value:o},t.uint32(26).fork()).ldelim()}),t},decode(e,t){let n=e instanceof be.default.Reader?e:be.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ji();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.skus.push(n.string());continue;case 3:if(r!==26)break;let u=Jt.decode(n,n.uint32());u.value!==void 0&&(i.metadata[u.key]=u.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:Ze(e.id)?globalThis.String(e.id):"",skus:globalThis.Array.isArray(e?.skus)?e.skus.map(t=>globalThis.String(t)):[],metadata:bs(e.metadata)?Object.entries(e.metadata).reduce((t,[n,o])=>(t[n]=String(o),t),{}):{}}},toJSON(e){let t={};if(e.id!==""&&(t.id=e.id),e.skus?.length&&(t.skus=e.skus),e.metadata){let n=Object.entries(e.metadata);n.length>0&&(t.metadata={},n.forEach(([o,i])=>{t.metadata[o]=i}))}return t},create(e){return Ge.fromPartial(e??{})},fromPartial(e){let t=Ji();return t.id=e.id??"",t.skus=e.skus?.map(n=>n)||[],t.metadata=Object.entries(e.metadata??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=globalThis.String(i)),n),{}),t}};m.set(Ge.$type,Ge);function Fi(){return{key:"",value:""}}var Jt={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect.MetadataEntry",encode(e,t=be.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof be.default.Reader?e:be.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Ze(e.key)?globalThis.String(e.key):"",value:Ze(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==""&&(t.value=e.value),t},create(e){return Jt.fromPartial(e??{})},fromPartial(e){let t=Fi();return t.key=e.key??"",t.value=e.value??"",t}};m.set(Jt.$type,Jt);function Wi(){return{errorMessage:void 0,orderId:void 0,order:void 0,status:0,errorCode:void 0}}var we={$type:"devvit.ui.effect_types.v1alpha.OrderResultEvent",encode(e,t=be.default.Writer.create()){return e.errorMessage!==void 0&&t.uint32(18).string(e.errorMessage),e.orderId!==void 0&&t.uint32(26).string(e.orderId),e.order!==void 0&&Ge.encode(e.order,t.uint32(34).fork()).ldelim(),e.status!==0&&t.uint32(40).int32(e.status),e.errorCode!==void 0&&t.uint32(48).int32(e.errorCode),t},decode(e,t){let n=e instanceof be.default.Reader?e:be.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 2:if(r!==18)break;i.errorMessage=n.string();continue;case 3:if(r!==26)break;i.orderId=n.string();continue;case 4:if(r!==34)break;i.order=Ge.decode(n,n.uint32());continue;case 5:if(r!==40)break;i.status=n.int32();continue;case 6:if(r!==48)break;i.errorCode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{errorMessage:Ze(e.errorMessage)?globalThis.String(e.errorMessage):void 0,orderId:Ze(e.orderId)?globalThis.String(e.orderId):void 0,order:Ze(e.order)?Ge.fromJSON(e.order):void 0,status:Ze(e.status)?ys(e.status):0,errorCode:Ze(e.errorCode)?globalThis.Number(e.errorCode):void 0}},toJSON(e){let t={};return e.errorMessage!==void 0&&(t.errorMessage=e.errorMessage),e.orderId!==void 0&&(t.orderId=e.orderId),e.order!==void 0&&(t.order=Ge.toJSON(e.order)),e.status!==0&&(t.status=Ns(e.status)),e.errorCode!==void 0&&(t.errorCode=Math.round(e.errorCode)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=Wi();return t.errorMessage=e.errorMessage??void 0,t.orderId=e.orderId??void 0,t.order=e.order!==void 0&&e.order!==null?Ge.fromPartial(e.order):void 0,t.status=e.status??0,t.errorCode=e.errorCode??void 0,t}};m.set(we.$type,we);function bs(e){return typeof e=="object"&&e!==null}function Ze(e){return e!=null}d();var oe=G(W(),1);d();var en=G(W(),1);d();var R=G(W(),1);d();var P;(function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(P||(P={}));function xt(e){switch(e){case 0:case"STRING":return P.STRING;case 1:case"PARAGRAPH":return P.PARAGRAPH;case 2:case"NUMBER":return P.NUMBER;case 3:case"BOOLEAN":return P.BOOLEAN;case 4:case"LIST":return P.LIST;case 5:case"SELECTION":return P.SELECTION;case 6:case"GROUP":return P.GROUP;case 7:case"IMAGE":return P.IMAGE;case-1:case"UNRECOGNIZED":default:return P.UNRECOGNIZED}}function Vt(e){switch(e){case P.STRING:return 0;case P.PARAGRAPH:return 1;case P.NUMBER:return 2;case P.BOOLEAN:return 3;case P.LIST:return 4;case P.SELECTION:return 5;case P.GROUP:return 6;case P.IMAGE:return 7;case P.UNRECOGNIZED:default:return-1}}d();var re=G(W(),1);function qi(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var V={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=re.default.Writer.create()){return e.fieldType!==0&&t.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&t.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&t.uint32(18).string(e.stringValue),e.numberValue!==void 0&&t.uint32(25).double(e.numberValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.listValue!==void 0&&He.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&ze.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Ke.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=qi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.fieldType=n.int32();continue;case 100:if(r!==800)break;i.isSecret=n.bool();continue;case 2:if(r!==18)break;i.stringValue=n.string();continue;case 3:if(r!==25)break;i.numberValue=n.double();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.listValue=He.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=ze.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=Ke.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:ke(e.fieldType)?xt(e.fieldType):0,isSecret:ke(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ke(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ke(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ke(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ke(e.listValue)?He.fromJSON(e.listValue):void 0,selectionValue:ke(e.selectionValue)?ze.fromJSON(e.selectionValue):void 0,groupValue:ke(e.groupValue)?Ke.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Vt(e.fieldType)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.listValue!==void 0&&(t.listValue=He.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=ze.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=Ke.toJSON(e.groupValue)),t},create(e){return V.fromPartial(e??{})},fromPartial(e){let t=qi();return t.fieldType=e.fieldType??0,t.isSecret=e.isSecret??void 0,t.stringValue=e.stringValue??void 0,t.numberValue=e.numberValue??void 0,t.boolValue=e.boolValue??void 0,t.listValue=e.listValue!==void 0&&e.listValue!==null?He.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?ze.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Ke.fromPartial(e.groupValue):void 0,t}};m.set(V.$type,V);function $i(){return{itemType:0,items:[]}}var He={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=re.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)V.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$i();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(V.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:ke(e.itemType)?xt(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>V.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Vt(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>V.toJSON(n))),t},create(e){return He.fromPartial(e??{})},fromPartial(e){let t=$i();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>V.fromPartial(n))||[],t}};m.set(He.$type,He);function Gi(){return{values:[]}}var ze={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=re.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Gi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return ze.fromPartial(e??{})},fromPartial(e){let t=Gi();return t.values=e.values?.map(n=>n)||[],t}};m.set(ze.$type,ze);function Zi(){return{}}var Ke={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=re.default.Writer.create()){return t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Zi();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Ke.fromPartial(e??{})},fromPartial(e){return Zi()}};m.set(Ke.$type,Ke);function ke(e){return e!=null}function Hi(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var j={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=R.default.Writer.create()){return e.fieldId!==""&&t.uint32(10).string(e.fieldId),e.fieldType!==0&&t.uint32(16).int32(e.fieldType),e.label!==""&&t.uint32(26).string(e.label),e.helpText!==void 0&&t.uint32(34).string(e.helpText),e.defaultValue!==void 0&&V.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&ie.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Hi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fieldId=n.string();continue;case 2:if(r!==16)break;i.fieldType=n.int32();continue;case 3:if(r!==26)break;i.label=n.string();continue;case 4:if(r!==34)break;i.helpText=n.string();continue;case 5:if(r!==42)break;i.defaultValue=V.decode(n,n.uint32());continue;case 6:if(r!==48)break;i.required=n.bool();continue;case 7:if(r!==56)break;i.disabled=n.bool();continue;case 8:if(r!==66)break;i.fieldConfig=ie.decode(n,n.uint32());continue;case 9:if(r!==72)break;i.isSecret=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldId:N(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:N(e.fieldType)?xt(e.fieldType):0,label:N(e.label)?globalThis.String(e.label):"",helpText:N(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:N(e.defaultValue)?V.fromJSON(e.defaultValue):void 0,required:N(e.required)?globalThis.Boolean(e.required):void 0,disabled:N(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:N(e.fieldConfig)?ie.fromJSON(e.fieldConfig):void 0,isSecret:N(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Vt(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=V.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=ie.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return j.fromPartial(e??{})},fromPartial(e){let t=Hi();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?V.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?ie.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};m.set(j.$type,j);function zi(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=R.default.Writer.create()){return e.stringConfig!==void 0&&Xe.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&Ye.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Qe.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&je.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&et.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&tt.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&rt.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=zi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=Xe.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=Ye.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=Qe.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=je.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=et.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=tt.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=rt.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:N(e.stringConfig)?Xe.fromJSON(e.stringConfig):void 0,paragraphConfig:N(e.paragraphConfig)?Ye.fromJSON(e.paragraphConfig):void 0,numberConfig:N(e.numberConfig)?Qe.fromJSON(e.numberConfig):void 0,booleanConfig:N(e.booleanConfig)?je.fromJSON(e.booleanConfig):void 0,listConfig:N(e.listConfig)?et.fromJSON(e.listConfig):void 0,selectionConfig:N(e.selectionConfig)?tt.fromJSON(e.selectionConfig):void 0,groupConfig:N(e.groupConfig)?rt.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=Xe.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=Ye.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Qe.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=je.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=et.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=tt.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=rt.toJSON(e.groupConfig)),t},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=zi();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Xe.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?Ye.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Qe.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?je.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?et.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?tt.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?rt.fromPartial(e.groupConfig):void 0,t}};m.set(ie.$type,ie);function Ki(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Xe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=R.default.Writer.create()){return e.minLength!==void 0&&t.uint32(8).int32(e.minLength),e.maxLength!==void 0&&t.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ki();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.minLength=n.int32();continue;case 2:if(r!==16)break;i.maxLength=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{minLength:N(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:N(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:N(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.minLength!==void 0&&(t.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(t.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return Xe.fromPartial(e??{})},fromPartial(e){let t=Ki();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};m.set(Xe.$type,Xe);function Xi(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Ye={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=R.default.Writer.create()){return e.maxCharacters!==void 0&&t.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&t.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Xi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.maxCharacters=n.int32();continue;case 2:if(r!==16)break;i.lineHeight=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{maxCharacters:N(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:N(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:N(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.maxCharacters!==void 0&&(t.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(t.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return Ye.fromPartial(e??{})},fromPartial(e){let t=Xi();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};m.set(Ye.$type,Ye);function Yi(){return{step:void 0,min:void 0,max:void 0}}var Qe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=R.default.Writer.create()){return e.step!==void 0&&t.uint32(9).double(e.step),e.min!==void 0&&t.uint32(17).double(e.min),e.max!==void 0&&t.uint32(25).double(e.max),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==9)break;i.step=n.double();continue;case 2:if(r!==17)break;i.min=n.double();continue;case 3:if(r!==25)break;i.max=n.double();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{step:N(e.step)?globalThis.Number(e.step):void 0,min:N(e.min)?globalThis.Number(e.min):void 0,max:N(e.max)?globalThis.Number(e.max):void 0}},toJSON(e){let t={};return e.step!==void 0&&(t.step=e.step),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t},create(e){return Qe.fromPartial(e??{})},fromPartial(e){let t=Yi();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};m.set(Qe.$type,Qe);function Qi(){return{}}var je={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=R.default.Writer.create()){return t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Qi();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return je.fromPartial(e??{})},fromPartial(e){return Qi()}};m.set(je.$type,je);function ji(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var et={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=R.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&ie.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ji();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=ie.decode(n,n.uint32());continue;case 3:if(r!==24)break;i.minEntries=n.int32();continue;case 4:if(r!==32)break;i.maxEntries=n.int32();continue;case 5:if(r!==42)break;i.entryLabel=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:N(e.itemType)?xt(e.itemType):0,itemConfig:N(e.itemConfig)?ie.fromJSON(e.itemConfig):void 0,minEntries:N(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:N(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:N(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Vt(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=ie.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return et.fromPartial(e??{})},fromPartial(e){let t=ji();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?ie.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};m.set(et.$type,et);function eo(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var tt={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=R.default.Writer.create()){for(let n of e.choices)nt.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=eo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(nt.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>nt.fromJSON(t)):[],multiSelect:N(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:N(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:N(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:N(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>nt.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return tt.fromPartial(e??{})},fromPartial(e){let t=eo();return t.choices=e.choices?.map(n=>nt.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};m.set(tt.$type,tt);function to(){return{label:"",value:""}}var nt={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=R.default.Writer.create()){return e.label!==""&&t.uint32(10).string(e.label),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=to();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.label=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{label:N(e.label)?globalThis.String(e.label):"",value:N(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return nt.fromPartial(e??{})},fromPartial(e){let t=to();return t.label=e.label??"",t.value=e.value??"",t}};m.set(nt.$type,nt);function no(){return{fields:[]}}var rt={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=R.default.Writer.create()){for(let n of e.fields)j.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=no();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(j.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>j.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>j.toJSON(n))),t},create(e){return rt.fromPartial(e??{})},fromPartial(e){let t=no();return t.fields=e.fields?.map(n=>j.fromPartial(n))||[],t}};m.set(rt.$type,rt);function N(e){return e!=null}function ro(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var xe={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=en.default.Writer.create()){for(let n of e.fields)j.encode(n,t.uint32(10).fork()).ldelim();return e.title!==void 0&&t.uint32(18).string(e.title),e.shortDescription!==void 0&&t.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&t.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&t.uint32(42).string(e.cancelLabel),e.id!==void 0&&t.uint32(50).string(e.id),t},decode(e,t){let n=e instanceof en.default.Reader?e:en.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ro();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(j.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.title=n.string();continue;case 3:if(r!==26)break;i.shortDescription=n.string();continue;case 4:if(r!==34)break;i.acceptLabel=n.string();continue;case 5:if(r!==42)break;i.cancelLabel=n.string();continue;case 6:if(r!==50)break;i.id=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>j.fromJSON(t)):[],title:Ft(e.title)?globalThis.String(e.title):void 0,shortDescription:Ft(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:Ft(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:Ft(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:Ft(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>j.toJSON(n))),e.title!==void 0&&(t.title=e.title),e.shortDescription!==void 0&&(t.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(t.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(t.cancelLabel=e.cancelLabel),e.id!==void 0&&(t.id=e.id),t},create(e){return xe.fromPartial(e??{})},fromPartial(e){let t=ro();return t.fields=e.fields?.map(n=>j.fromPartial(n))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};m.set(xe.$type,xe);function Ft(e){return e!=null}function io(){return{form:void 0}}var Wn={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode(e,t=oe.default.Writer.create()){return e.form!==void 0&&xe.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=io();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=xe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:qt(e.form)?xe.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=xe.toJSON(e.form)),t},create(e){return Wn.fromPartial(e??{})},fromPartial(e){let t=io();return t.form=e.form!==void 0&&e.form!==null?xe.fromPartial(e.form):void 0,t}};m.set(Wn.$type,Wn);function oo(){return{results:{},formId:void 0}}var Ve={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode(e,t=oe.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{Wt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),e.formId!==void 0&&t.uint32(18).string(e.formId),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=oo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let u=Wt.decode(n,n.uint32());u.value!==void 0&&(i.results[u.key]=u.value);continue;case 2:if(r!==18)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{results:Ts(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=V.fromJSON(o),t),{}):{},formId:qt(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,i])=>{t.results[o]=V.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return Ve.fromPartial(e??{})},fromPartial(e){let t=oo();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=V.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};m.set(Ve.$type,Ve);function so(){return{key:"",value:void 0}}var Wt={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=oe.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&V.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=so();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=V.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:qt(e.key)?globalThis.String(e.key):"",value:qt(e.value)?V.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=V.toJSON(e.value)),t},create(e){return Wt.fromPartial(e??{})},fromPartial(e){let t=so();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?V.fromPartial(e.value):void 0,t}};m.set(Wt.$type,Wt);function uo(){return{formId:void 0}}var Le={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode(e,t=oe.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=uo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:qt(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return Le.fromPartial(e??{})},fromPartial(e){let t=uo();return t.formId=e.formId??void 0,t}};m.set(Le.$type,Le);function Ts(e){return typeof e=="object"&&e!==null}function qt(e){return e!=null}d();var Et=G(W(),1);function ao(){return{}}var qn={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEffect",encode(e,t=Et.default.Writer.create()){return t},decode(e,t){let n=e instanceof Et.default.Reader?e:Et.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ao();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return qn.fromPartial(e??{})},fromPartial(e){return ao()}};m.set(qn.$type,qn);function fo(){return{signedRequestContext:""}}var Ae={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEvent",encode(e,t=Et.default.Writer.create()){return e.signedRequestContext!==""&&t.uint32(10).string(e.signedRequestContext),t},decode(e,t){let n=e instanceof Et.default.Reader?e:Et.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.signedRequestContext=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{signedRequestContext:_s(e.signedRequestContext)?globalThis.String(e.signedRequestContext):""}},toJSON(e){let t={};return e.signedRequestContext!==""&&(t.signedRequestContext=e.signedRequestContext),t},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=fo();return t.signedRequestContext=e.signedRequestContext??"",t}};m.set(Ae.$type,Ae);function _s(e){return e!=null}d();var yt=G(W(),1);d();var vt=G(W(),1);d();var tn=G(W(),1);function lo(){return{}}var nn={$type:"google.protobuf.Empty",encode(e,t=tn.default.Writer.create()){return t},decode(e,t){let n=e instanceof tn.default.Reader?e:tn.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=lo();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return nn.fromPartial(e??{})},fromPartial(e){return lo()}};m.set(nn.$type,nn);function co(){return{channels:[]}}var $n={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=vt.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof vt.default.Reader?e:vt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=co();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channels.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.channels?.length&&(t.channels=e.channels),t},create(e){return $n.fromPartial(e??{})},fromPartial(e){let t=co();return t.channels=e.channels?.map(n=>n)||[],t}};m.set($n.$type,$n);function ho(){return{channel:"",data:void 0}}var Pe={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=vt.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&de.encode(de.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof vt.default.Reader?e:vt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ho();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channel=n.string();continue;case 2:if(r!==18)break;i.data=de.unwrap(de.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:Os(e.channel)?globalThis.String(e.channel):"",data:Rs(e.data)?e.data:void 0}},toJSON(e){let t={};return e.channel!==""&&(t.channel=e.channel),e.data!==void 0&&(t.data=e.data),t},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let t=ho();return t.channel=e.channel??"",t.data=e.data??void 0,t}};m.set(Pe.$type,Pe);function Rs(e){return typeof e=="object"&&e!==null}function Os(e){return e!=null}var it;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(it||(it={}));function Is(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return it.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return it.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return it.UNRECOGNIZED}}function Cs(e){switch(e){case it.REALTIME_SUBSCRIBED:return 0;case it.REALTIME_UNSUBSCRIBED:return 1;case it.UNRECOGNIZED:default:return-1}}function po(){return{subscriptionIds:[]}}var Gn={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=yt.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof yt.default.Reader?e:yt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=po();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subscriptionIds.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return Gn.fromPartial(e??{})},fromPartial(e){let t=po();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};m.set(Gn.$type,Gn);function go(){return{event:void 0,status:void 0}}var Ue={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=yt.default.Writer.create()){return e.event!==void 0&&Pe.encode(e.event,t.uint32(10).fork()).ldelim(),e.status!==void 0&&t.uint32(16).int32(e.status),t},decode(e,t){let n=e instanceof yt.default.Reader?e:yt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=go();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=Pe.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:mo(e.event)?Pe.fromJSON(e.event):void 0,status:mo(e.status)?Is(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=Pe.toJSON(e.event)),e.status!==void 0&&(t.status=Cs(e.status)),t},create(e){return Ue.fromPartial(e??{})},fromPartial(e){let t=go();return t.event=e.event!==void 0&&e.event!==null?Pe.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};m.set(Ue.$type,Ue);function mo(e){return e!=null}d();var rn=G(W(),1);var Te;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.INLINE_MODE=1]="INLINE_MODE",e[e.IMMERSIVE_MODE=2]="IMMERSIVE_MODE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Te||(Te={}));function Hn(e){switch(e){case 0:case"UNSPECIFIED":return Te.UNSPECIFIED;case 1:case"INLINE_MODE":return Te.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return Te.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return Te.UNRECOGNIZED}}function zn(e){switch(e){case Te.UNSPECIFIED:return 0;case Te.INLINE_MODE:return 1;case Te.IMMERSIVE_MODE:return 2;case Te.UNRECOGNIZED:default:return-1}}function So(){return{immersiveMode:0,entryUrl:void 0}}var Zn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=rn.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),e.entryUrl!==void 0&&t.uint32(18).string(e.entryUrl),t},decode(e,t){let n=e instanceof rn.default.Reader?e:rn.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=So();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue;case 2:if(r!==18)break;i.entryUrl=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:Eo(e.immersiveMode)?Hn(e.immersiveMode):0,entryUrl:Eo(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=zn(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return Zn.fromPartial(e??{})},fromPartial(e){let t=So();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};m.set(Zn.$type,Zn);function Eo(e){return e!=null}d();var Nt=G(W(),1);function vo(){return{}}var Me={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotRequestEvent",encode(e,t=Nt.default.Writer.create()){return t},decode(e,t){let n=e instanceof Nt.default.Reader?e:Nt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=vo();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Me.fromPartial(e??{})},fromPartial(e){return vo()}};m.set(Me.$type,Me);function yo(){return{dataUrl:void 0,error:void 0}}var Kn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotResponseEffect",encode(e,t=Nt.default.Writer.create()){return e.dataUrl!==void 0&&t.uint32(10).string(e.dataUrl),e.error!==void 0&&t.uint32(18).string(e.error),t},decode(e,t){let n=e instanceof Nt.default.Reader?e:Nt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=yo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.dataUrl=n.string();continue;case 2:if(r!==18)break;i.error=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{dataUrl:No(e.dataUrl)?globalThis.String(e.dataUrl):void 0,error:No(e.error)?globalThis.String(e.error):void 0}},toJSON(e){let t={};return e.dataUrl!==void 0&&(t.dataUrl=e.dataUrl),e.error!==void 0&&(t.error=e.error),t},create(e){return Kn.fromPartial(e??{})},fromPartial(e){let t=yo();return t.dataUrl=e.dataUrl??void 0,t.error=e.error??void 0,t}};m.set(Kn.$type,Kn);function No(e){return e!=null}var ft;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ft||(ft={}));function ws(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return ft.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return ft.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return ft.UNRECOGNIZED}}function ks(e){switch(e){case ft.WEBVIEW_VISIBLE:return 0;case ft.WEBVIEW_HIDDEN:return 1;case ft.UNRECOGNIZED:default:return-1}}function bo(){return{message:void 0,jsonString:""}}var ot={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=L.default.Writer.create()){return e.message!==void 0&&Z.encode(Z.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=bo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=Z.unwrap(Z.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.jsonString=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:F(e?.message)?e.message:void 0,jsonString:F(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let t={};return e.message!==void 0&&(t.message=e.message),e.jsonString!==""&&(t.jsonString=e.jsonString),t},create(e){return ot.fromPartial(e??{})},fromPartial(e){let t=bo();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};m.set(ot.$type,ot);function To(){return{visibility:0}}var st={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=L.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=To();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.visibility=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{visibility:F(e.visibility)?ws(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=ks(e.visibility)),t},create(e){return st.fromPartial(e??{})},fromPartial(e){let t=To();return t.visibility=e.visibility??0,t}};m.set(st.$type,st);function _o(){return{postMessage:void 0,fullScreen:void 0}}var Xn={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=L.default.Writer.create()){return e.postMessage!==void 0&&ot.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&st.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_o();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=ot.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=st.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:F(e.postMessage)?ot.fromJSON(e.postMessage):void 0,fullScreen:F(e.fullScreen)?st.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=ot.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=st.toJSON(e.fullScreen)),t},create(e){return Xn.fromPartial(e??{})},fromPartial(e){let t=_o();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?ot.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?st.fromPartial(e.fullScreen):void 0,t}};m.set(Xn.$type,Xn);function Ro(){return{immersiveMode:0}}var ut={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=L.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ro();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:F(e.immersiveMode)?Hn(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=zn(e.immersiveMode)),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=Ro();return t.immersiveMode=e.immersiveMode??0,t}};m.set(ut.$type,ut);function Oo(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0,orderResult:void 0,updateRequestContext:void 0,screenshotRequest:void 0}}var _e={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=L.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&Le.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&Ve.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&Ue.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&ut.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&Ce.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),e.orderResult!==void 0&&we.encode(e.orderResult,t.uint32(66).fork()).ldelim(),e.updateRequestContext!==void 0&&Ae.encode(e.updateRequestContext,t.uint32(74).fork()).ldelim(),e.screenshotRequest!==void 0&&Me.encode(e.screenshotRequest,t.uint32(82).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Oo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.formCanceled=Le.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=Ve.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=Ue.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=ut.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=Ce.decode(n,n.uint32());continue;case 8:if(r!==66)break;i.orderResult=we.decode(n,n.uint32());continue;case 9:if(r!==74)break;i.updateRequestContext=Ae.decode(n,n.uint32());continue;case 10:if(r!==82)break;i.screenshotRequest=Me.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:F(e.id)?globalThis.String(e.id):"",formCanceled:F(e.formCanceled)?Le.fromJSON(e.formCanceled):void 0,formSubmitted:F(e.formSubmitted)?Ve.fromJSON(e.formSubmitted):void 0,realtimeEvent:F(e.realtimeEvent)?Ue.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:F(e.immersiveModeEvent)?ut.fromJSON(e.immersiveModeEvent):void 0,consentStatus:F(e.consentStatus)?Ce.fromJSON(e.consentStatus):void 0,orderResult:F(e.orderResult)?we.fromJSON(e.orderResult):void 0,updateRequestContext:F(e.updateRequestContext)?Ae.fromJSON(e.updateRequestContext):void 0,screenshotRequest:F(e.screenshotRequest)?Me.fromJSON(e.screenshotRequest):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=Le.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=Ve.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=Ue.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=ut.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=Ce.toJSON(e.consentStatus)),e.orderResult!==void 0&&(t.orderResult=we.toJSON(e.orderResult)),e.updateRequestContext!==void 0&&(t.updateRequestContext=Ae.toJSON(e.updateRequestContext)),e.screenshotRequest!==void 0&&(t.screenshotRequest=Me.toJSON(e.screenshotRequest)),t},create(e){return _e.fromPartial(e??{})},fromPartial(e){let t=Oo();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?Le.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?Ve.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?Ue.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?ut.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?Ce.fromPartial(e.consentStatus):void 0,t.orderResult=e.orderResult!==void 0&&e.orderResult!==null?we.fromPartial(e.orderResult):void 0,t.updateRequestContext=e.updateRequestContext!==void 0&&e.updateRequestContext!==null?Ae.fromPartial(e.updateRequestContext):void 0,t.screenshotRequest=e.screenshotRequest!==void 0&&e.screenshotRequest!==null?Me.fromPartial(e.screenshotRequest):void 0,t}};m.set(_e.$type,_e);function Io(){return{data:void 0}}var Yn={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=L.default.Writer.create()){return e.data!==void 0&&at.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Io();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=at.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:F(e.data)?at.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=at.toJSON(e.data)),t},create(e){return Yn.fromPartial(e??{})},fromPartial(e){let t=Io();return t.data=e.data!==void 0&&e.data!==null?at.fromPartial(e.data):void 0,t}};m.set(Yn.$type,Yn);function Co(){return{type:"",data:void 0}}var at={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=L.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&_e.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Co();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.type=n.string();continue;case 2:if(r!==18)break;i.data=_e.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:F(e.type)?globalThis.String(e.type):"",data:F(e.data)?_e.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=_e.toJSON(e.data)),t},create(e){return at.fromPartial(e??{})},fromPartial(e){let t=Co();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?_e.fromPartial(e.data):void 0,t}};m.set(at.$type,at);function F(e){return e!=null}var wo="devvit-internal",De=(e,t)=>{let n={...e,realtimeEffect:e.realtime,id:t,scope:At.CLIENT,type:wo};(e.showToast||e.navigateToUrl)&&(n.effect=e),parent.postMessage(n,"*")},ko=e=>new Promise(t=>{let n={...e,realtimeEffect:e.realtime,scope:At.CLIENT,type:wo};(e.showForm||e.type===z.EFFECT_CAN_RUN_AS_USER)&&(n.effect=e);let o=crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let u=_e.fromJSON(r.data.data);t(u),removeEventListener("message",i)}};addEventListener("message",i),parent.postMessage(n,"*")});d();var bt=class extends Error{};bt.prototype.name="InvalidTokenError";function xs(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function Vs(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return xs(t)}catch{return atob(t)}}function Qn(e,t){if(typeof e!="string")throw new bt("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new bt(`Invalid token specified: missing part #${n+1}`);let i;try{i=Vs(o)}catch(r){throw new bt(`Invalid token specified: invalid base64 for part #${n+1} (${r.message})`)}try{return JSON.parse(i)}catch(r){throw new bt(`Invalid token specified: invalid json for part #${n+1} (${r.message})`)}}function xo(e){if(e)try{return Qn(e)?.devvit}catch(t){throw Error("token decode failure",{cause:t})}}function Vo(){setInterval(Ls,6e4)}async function Ls(){let{exp:e}=Qn(globalThis.devvit.token);e&&e-Date.now()/1e3>300||await jn()}async function jn(){let e=await ko({type:z.EFFECT_UPDATE_REQUEST_CONTEXT,updateRequestContext:{}});if(!e?.updateRequestContext?.signedRequestContext){console.error("Failed to refresh token");return}Lo(e.updateRequestContext.signedRequestContext)}var Ao=(e,t,n)=>{let o=Us(n.name,t.hash),i=Ms(o),r=o?.appPermissionState;i?.name==="ANDROID"&&(i.version.yyyy<2026||i.version.yyyy===2026&&i.version.release<=5)&&(r=void 0);let u=xo(o.signedRequestContext),p;if(u?p=As(u,i,o.postData):o.webViewContext&&(p=Ps(o.webViewContext,i,o.postData)),!p)throw Error("no context");let f=o.webViewClientData;globalThis.devvit={context:p,dependencies:{client:dr(e),webViewScripts:v},entrypoints:f?.appConfig?.entrypoints??{},share:o?.shareParam?{userData:o?.shareParam.userData}:void 0,adPayload:o?.adPayload,appPermissionState:r,token:o.signedRequestContext||o.webbitToken,webViewMode:o?.viewMode,startTime:o?.startTime??void 0,refreshToken:jn}};function Po(e){devvit.webViewMode=e}function Lo(e){globalThis.devvit.token=e}function As(e,t,n){if(!e.app)throw Error("no RequestContext.app");if(!e.post)throw Error("no RequestContext.post");if(!e.subreddit)throw Error("no RequestContext.subreddit");return{appName:e.app.name,appSlug:e.app.slug,appVersion:e.app.version,client:t,commentId:void 0,loid:e.user?.devvitLoid??e.user?.devvit_loid,postAuthorId:Ht(e.post.author),postData:n?.developerData,postId:dn(e.post.id),snoovatar:e.user?.snoovatar,subredditId:ln(e.subreddit.id),subredditName:e.subreddit.name,userId:e.user?.id?Ht(e.user.id):void 0,username:e.user?.name}}function Ps(e,t,n){return{appName:e.appName,appSlug:e.appName,appVersion:e.appVersion,client:t,commentId:void 0,loid:void 0,postData:n?.developerData,postAuthorId:void 0,postId:dn(e.postId),snoovatar:void 0,subredditId:ln(e.subredditId),subredditName:e.subredditName,userId:e.userId?Ht(e.userId):void 0,username:void 0}}function Us(e,t){if(e)return JSON.parse(e);let n=t?.slice(1);if(!n)throw Error("no bridge context");return JSON.parse(decodeURIComponent(n))}function Ms(e){if(!(e.client!==Ot.ANDROID&&e.client!==Ot.IOS||!e.nativeVersion))return{name:e.client===Ot.ANDROID?"ANDROID":"IOS",version:e.nativeVersion}}d();async function Ds(e,t,n,o,i){let r=new Request(o,i);return Bs(n,new URL(r.url))&&r.headers.set("Authorization",`Bearer ${e.token}`),await t(r)}function Uo(){globalThis.fetch=Ds.bind(void 0,globalThis.devvit,globalThis.fetch,location)}function Bs(e,t){return t.origin===e.origin}d();var Js=new URL(fn,fr).toString();function Fs(e){let t=e?.trim();if(t)try{let n=new URL(t);if(n.pathname.endsWith(`/${an}`))return new URL(fn,n).toString()}catch{}return Js}async function Ws(e,t){let n=e.data;if(n?.type!=="devvit-message"||n.data==null)return;let o=n.data;if(o.screenshotRequest==null||typeof o.id!="string")return;let i,r;try{let u=Fs(t),{captureScreenshot:p}=await import(u);i=await p()}catch(u){r=u instanceof Error?u.message:String(u)}De({type:z.EFFECT_SCREENSHOT_RESPONSE,screenshot:{dataUrl:i,error:r}},o.id)}function Mo(e){addEventListener("message",t=>{Ws(t,e)})}d();d();function Do(e){let t=qs(e.target,e.isTrusted);De({type:z.EFFECT_TELEMETRY,telemetry:{event:t.event,click:t},analytics:t})}function qs(e,t){let{definition:n,elemTrackId:o}=$s(e,t);return{event:"click",definition:n,elemTrackId:o}}function $s(e,t){let n=Gs(e);if(!n)return{definition:"default",elemTrackId:void 0};let o="default";t&&globalThis.window.getComputedStyle(n)?.getPropertyValue("cursor")==="pointer"&&(o="strict");let i,r=n;for(;r;){if(i===void 0){let u=r.getAttribute("data-track-id");u?i=u:r.id&&(i=r.id)}if(t&&o==="default"&&Zs(r)&&(o="strict"),i!==void 0&&(!t||o==="strict"))break;r=r.parentElement}return{definition:o,elemTrackId:i}}function Gs(e){if(!e||typeof e!="object"||!("nodeType"in e))return;let t=e;return t.nodeType===1?t:t.parentElement??void 0}function Zs(e){return["A","BUTTON","CANVAS","INPUT","SELECT","TEXTAREA","LABEL"].includes(e.tagName)||["true","plaintext-only"].includes(e.getAttribute("contenteditable")??"")}var Re,Lt,$t=!1;function Fo(){eu(),Hs(),zs()}function Hs(){addEventListener("load",()=>{let e=performance.timeOrigin,t=performance.now(),n=performance.timeOrigin+t,o={event:"web-view-loaded",timeStart:e,timeEnd:n,duration:t};De({type:z.EFFECT_TELEMETRY,telemetry:{event:o.event,loaded:o},analytics:o})})}function zs(){document.addEventListener("click",e=>{Do(e)},{passive:!0})}function on(){return performance.getEntriesByType("navigation")[0]}function Bo(){let e=on();if(!(!Lt||!e))return{spanName:"web_view_time_to_first_byte",timeStart:Lt+e.requestStart,timeEnd:Lt+e.responseStart}}function er(e,t){return[{spanName:e,timeStart:performance.timeOrigin,timeEnd:performance.timeOrigin+t}]}function Ks(){if(Lt)return{spanName:"web_view_initialization",timeStart:Lt,timeEnd:performance.timeOrigin}}function Wo(){let e=on(),t=performance.getEntriesByType("paint").find(o=>o.name==="first-contentful-paint")?.startTime,n=Qs(e);if(!(t==null||n==null||!e||e.responseStart<=0))return{spanName:"web_view_render_duration",timeStart:performance.timeOrigin+e.responseStart,timeEnd:performance.timeOrigin+Math.max(t,n)}}function Xs(){let t=performance.getEntriesByType("paint").find(n=>n.name==="first-contentful-paint");return t?er("web_view_first_contentful_paint",t.startTime):[]}function Ys(){return er("web_view_load",performance.now())}function Qs(e=on()){return e&&e.loadEventEnd>0?e.loadEventEnd:void 0}function js(){if($t)return;let e=Wo();e&&($t=!0,De({type:z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:[e]}}}))}function Jo(){let t=on()?.domInteractive;return t?er("web_view_time_to_interactive",t):[]}function eu(){Re=[],Lt=globalThis.devvit?.startTime,$t=!1;let e=Ks();if(e&&Re.push(e),document.readyState==="complete"){let o=Bo();o&&Re.push(o)}let t=new PerformanceObserver(o=>{for(let i of o.getEntries())if(i.name==="first-contentful-paint"){let r=Xs();if(t.disconnect(),r.length===0)break;let u=$t?void 0:Wo();u&&($t=!0),document.readyState==="complete"?De({type:z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:u?[...r,u]:r}}}):(Re.push(...r),u&&Re.push(u));break}});t.observe({type:"paint",buffered:!0});let n=new PerformanceObserver(o=>{o.getEntries().find(r=>r.entryType==="navigation")&&(n.disconnect(),js())});n.observe({type:"navigation",buffered:!0}),document.readyState==="loading"?globalThis.addEventListener("DOMContentLoaded",()=>{Re.push(...Jo())}):Re.push(...Jo()),globalThis.addEventListener("load",()=>{let o=Bo();o&&Re.push(o),Re.push(...Ys()),De({type:z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:Re}}})})}d();function qo(){addEventListener("message",tu)}function tu(e){e.data?.type==="devvit-message"&&e.data?.data?.immersiveModeEvent&&Po(e.data.data.immersiveModeEvent.immersiveMode)}Ao(document,location,window);Fo();Uo();Mo(lr(document)??"");Vo();qo();})();
|
|
1
|
+
"use strict";(()=>{var $o=Object.create;var ur=Object.defineProperty;var Go=Object.getOwnPropertyDescriptor;var Zo=Object.getOwnPropertyNames;var Ho=Object.getPrototypeOf,zo=Object.prototype.hasOwnProperty;var un=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ko=(e,t)=>()=>(e&&(t=e(e=0)),t);var M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Xo=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Zo(t))!zo.call(e,i)&&i!==n&&ur(e,i,{get:()=>t[i],enumerable:!(o=Go(t,i))||o.enumerable});return e};var G=(e,t,n)=>(n=e!=null?$o(Ho(e)):{},Xo(t||!e||!e.__esModule?ur(n,"default",{value:e,enumerable:!0}):n,e));var v,d=Ko(()=>{v={hash:"c50d60a",version:"0.13.7-dev"}});var pr=M((Tu,hr)=>{"use strict";d();hr.exports=is;function is(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(p,f){n[o]=function(S){if(r)if(r=!1,S)f(S);else{for(var O=new Array(arguments.length-1),y=0;y<O.length;)O[y++]=arguments[y];p.apply(null,O)}};try{e.apply(t||null,n)}catch(a){r&&(r=!1,f(a))}})}});var Er=M(Sr=>{"use strict";d();var zt=Sr;zt.length=function(t){var n=t.length;if(!n)return 0;for(var o=0;--n%4>1&&t.charAt(n)==="=";)++o;return Math.ceil(t.length*3)/4-o};var Ct=new Array(64),mr=new Array(123);for(Se=0;Se<64;)mr[Ct[Se]=Se<26?Se+65:Se<52?Se+71:Se<62?Se-4:Se-59|43]=Se++;var Se;zt.encode=function(t,n,o){for(var i=null,r=[],u=0,p=0,f;n<o;){var a=t[n++];switch(p){case 0:r[u++]=Ct[a>>2],f=(a&3)<<4,p=1;break;case 1:r[u++]=Ct[f|a>>4],f=(a&15)<<2,p=2;break;case 2:r[u++]=Ct[f|a>>6],r[u++]=Ct[a&63],p=0;break}u>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),u=0)}return p&&(r[u++]=Ct[f],r[u++]=61,p===1&&(r[u++]=61)),i?(u&&i.push(String.fromCharCode.apply(String,r.slice(0,u))),i.join("")):String.fromCharCode.apply(String,r.slice(0,u))};var gr="invalid encoding";zt.decode=function(t,n,o){for(var i=o,r=0,u,p=0;p<t.length;){var f=t.charCodeAt(p++);if(f===61&&r>1)break;if((f=mr[f])===void 0)throw Error(gr);switch(r){case 0:u=f,r=1;break;case 1:n[o++]=u<<2|(f&48)>>4,u=f,r=2;break;case 2:n[o++]=(u&15)<<4|(f&60)>>2,u=f,r=3;break;case 3:n[o++]=(u&3)<<6|f,r=0;break}}if(r===1)throw Error(gr);return o-i};zt.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var yr=M((Iu,vr)=>{"use strict";d();vr.exports=Kt;function Kt(){this._listeners=Object.create(null)}Kt.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};Kt.prototype.off=function(t,n){if(t===void 0)this._listeners=Object.create(null);else if(n===void 0)this._listeners[t]=[];else{var o=this._listeners[t];if(!o)return this;for(var i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i}return this};Kt.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],i=1;i<arguments.length;)o.push(arguments[i++]);for(i=0;i<n.length;)n[i].fn.apply(n[i++].ctx,o)}return this}});var Ir=M((wu,Or)=>{"use strict";d();Or.exports=Nr(Nr);function Nr(e){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(f,a,S){t[0]=f,a[S]=n[0],a[S+1]=n[1],a[S+2]=n[2],a[S+3]=n[3]}function r(f,a,S){t[0]=f,a[S]=n[3],a[S+1]=n[2],a[S+2]=n[1],a[S+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function u(f,a){return n[0]=f[a],n[1]=f[a+1],n[2]=f[a+2],n[3]=f[a+3],t[0]}function p(f,a){return n[3]=f[a],n[2]=f[a+1],n[1]=f[a+2],n[0]=f[a+3],t[0]}e.readFloatLE=o?u:p,e.readFloatBE=o?p:u})():(function(){function t(o,i,r,u){var p=i<0?1:0;if(p&&(i=-i),i===0)o(1/i>0?0:2147483648,r,u);else if(isNaN(i))o(2143289344,r,u);else if(i>34028234663852886e22)o((p<<31|2139095040)>>>0,r,u);else if(i<11754943508222875e-54)o((p<<31|Math.round(i/1401298464324817e-60))>>>0,r,u);else{var f=Math.floor(Math.log(i)/Math.LN2),a=Math.round(i*Math.pow(2,-f)*8388608)&8388607;o((p<<31|f+127<<23|a)>>>0,r,u)}}e.writeFloatLE=t.bind(null,br),e.writeFloatBE=t.bind(null,Tr);function n(o,i,r){var u=o(i,r),p=(u>>31)*2+1,f=u>>>23&255,a=u&8388607;return f===255?a?NaN:p*(1/0):f===0?p*1401298464324817e-60*a:p*Math.pow(2,f-150)*(a+8388608)}e.readFloatLE=n.bind(null,_r),e.readFloatBE=n.bind(null,Rr)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(f,a,S){t[0]=f,a[S]=n[0],a[S+1]=n[1],a[S+2]=n[2],a[S+3]=n[3],a[S+4]=n[4],a[S+5]=n[5],a[S+6]=n[6],a[S+7]=n[7]}function r(f,a,S){t[0]=f,a[S]=n[7],a[S+1]=n[6],a[S+2]=n[5],a[S+3]=n[4],a[S+4]=n[3],a[S+5]=n[2],a[S+6]=n[1],a[S+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function u(f,a){return n[0]=f[a],n[1]=f[a+1],n[2]=f[a+2],n[3]=f[a+3],n[4]=f[a+4],n[5]=f[a+5],n[6]=f[a+6],n[7]=f[a+7],t[0]}function p(f,a){return n[7]=f[a],n[6]=f[a+1],n[5]=f[a+2],n[4]=f[a+3],n[3]=f[a+4],n[2]=f[a+5],n[1]=f[a+6],n[0]=f[a+7],t[0]}e.readDoubleLE=o?u:p,e.readDoubleBE=o?p:u})():(function(){function t(o,i,r,u,p,f){var a=u<0?1:0;if(a&&(u=-u),u===0)o(0,p,f+i),o(1/u>0?0:2147483648,p,f+r);else if(isNaN(u))o(0,p,f+i),o(2146959360,p,f+r);else if(u>17976931348623157e292)o(0,p,f+i),o((a<<31|2146435072)>>>0,p,f+r);else{var S;if(u<22250738585072014e-324)S=u/5e-324,o(S>>>0,p,f+i),o((a<<31|S/4294967296)>>>0,p,f+r);else{var O=Math.floor(Math.log(u)/Math.LN2);O===1024&&(O=1023),S=u*Math.pow(2,-O),o(S*4503599627370496>>>0,p,f+i),o((a<<31|O+1023<<20|S*1048576&1048575)>>>0,p,f+r)}}}e.writeDoubleLE=t.bind(null,br,0,4),e.writeDoubleBE=t.bind(null,Tr,4,0);function n(o,i,r,u,p){var f=o(u,p+i),a=o(u,p+r),S=(a>>31)*2+1,O=a>>>20&2047,y=4294967296*(a&1048575)+f;return O===2047?y?NaN:S*(1/0):O===0?S*5e-324*y:S*Math.pow(2,O-1075)*(y+4503599627370496)}e.readDoubleLE=n.bind(null,_r,0,4),e.readDoubleBE=n.bind(null,Rr,4,0)})(),e}function br(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function Tr(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=e&255}function _r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Rr(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var wr=M((xu,Cr)=>{"use strict";d();Cr.exports=os;function os(e){try{if(typeof un!="function")return null;var t=un(e);return t&&(t.length||Object.keys(t).length)?t:null}catch{return null}}});var xr=M(kr=>{"use strict";d();var hn=kr,cn="\uFFFD";hn.length=function(t){for(var n=0,o=0,i=0;i<t.length;++i)o=t.charCodeAt(i),o<128?n+=1:o<2048?n+=2:(o&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,n+=4):n+=3;return n};hn.read=function(t,n,o){if(o-n<1)return"";for(var i="",r=n;r<o;){var u=t[r++];if(u<=127)i+=String.fromCharCode(u);else if(u>=192&&u<224){var p=(u&31)<<6|t[r++]&63;i+=p>=128?String.fromCharCode(p):cn}else if(u>=224&&u<240){var f=(u&15)<<12|(t[r++]&63)<<6|t[r++]&63;i+=f>=2048?String.fromCharCode(f):cn}else if(u>=240){var a=(u&7)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63;a<65536||a>1114111?i+=cn:(a-=65536,i+=String.fromCharCode(55296+(a>>10)),i+=String.fromCharCode(56320+(a&1023)))}}return i};hn.write=function(t,n,o){for(var i=o,r,u,p=0;p<t.length;++p)r=t.charCodeAt(p),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((u=t.charCodeAt(p+1))&64512)===56320?(r=65536+((r&1023)<<10)+(u&1023),++p,n[o++]=r>>18|240,n[o++]=r>>12&63|128,n[o++]=r>>6&63|128,n[o++]=r&63|128):(n[o++]=r>>12|224,n[o++]=r>>6&63|128,n[o++]=r&63|128);return o-i}});var Lr=M((Uu,Vr)=>{"use strict";d();Vr.exports=ss;function ss(e,t,n){var o=n||8192,i=o>>>1,r=null,u=o;return function(f){if(f<1||f>i)return e(f);u+f>o&&(r=e(o),u=0);var a=t.call(r,u,u+=f);return u&7&&(u=(u|7)+1),a}}});var Pr=M((Du,Ar)=>{"use strict";d();Ar.exports=B;var Pt=We();function B(e,t){this.lo=e>>>0,this.hi=t>>>0}var lt=B.zero=new B(0,0);lt.toNumber=function(){return 0};lt.zzEncode=lt.zzDecode=function(){return this};lt.length=function(){return 1};var us=B.zeroHash="\0\0\0\0\0\0\0\0";B.fromNumber=function(t){if(t===0)return lt;var n=t<0;n&&(t=-t);var o=t>>>0,i=(t-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new B(o,i)};B.from=function(t){if(typeof t=="number")return B.fromNumber(t);if(Pt.isString(t))if(Pt.Long)t=Pt.Long.fromString(t);else return B.fromNumber(parseInt(t,10));return t.low||t.high?new B(t.low>>>0,t.high>>>0):lt};B.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var n=~this.lo+1>>>0,o=~this.hi>>>0;return n||(o=o+1>>>0),-(n+o*4294967296)}return this.lo+this.hi*4294967296};B.prototype.toLong=function(t){return Pt.Long?new Pt.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Fe=String.prototype.charCodeAt;B.fromHash=function(t){return t===us?lt:new B((Fe.call(t,0)|Fe.call(t,1)<<8|Fe.call(t,2)<<16|Fe.call(t,3)<<24)>>>0,(Fe.call(t,4)|Fe.call(t,5)<<8|Fe.call(t,6)<<16|Fe.call(t,7)<<24)>>>0)};B.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};B.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};B.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};B.prototype.length=function(){var t=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?n===0?t<16384?t<128?1:2:t<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:o<128?9:10}});var Ur=M((Ut,pn)=>{d();(function(e,t){function n(o){return o.default||o}typeof define=="function"&&define.amd?define([],function(){var o={};return t(o),n(o)}):typeof Ut=="object"?(t(Ut),typeof pn=="object"&&(pn.exports=n(Ut))):(function(){var o={};t(o),e.Long=n(o)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Ut,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(l,s,g){this.low=l|0,this.high=s|0,this.unsigned=!!g}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0});function o(l){return(l&&l.__isLong__)===!0}function i(l){var s=Math.clz32(l&-l);return l?31-s:s}n.isLong=o;var r={},u={};function p(l,s){var g,b,k;return s?(l>>>=0,(k=0<=l&&l<256)&&(b=u[l],b)?b:(g=a(l,0,!0),k&&(u[l]=g),g)):(l|=0,(k=-128<=l&&l<128)&&(b=r[l],b)?b:(g=a(l,l<0?-1:0,!1),k&&(r[l]=g),g))}n.fromInt=p;function f(l,s){if(isNaN(l))return s?Ie:me;if(s){if(l<0)return Ie;if(l>=tr)return sr}else{if(l<=-nr)return K;if(l+1>=nr)return or}return l<0?f(-l,s).neg():a(l%Rt|0,l/Rt|0,s)}n.fromNumber=f;function a(l,s,g){return new n(l,s,g)}n.fromBits=a;var S=Math.pow;function O(l,s,g){if(l.length===0)throw Error("empty string");if(typeof s=="number"?(g=s,s=!1):s=!!s,l==="NaN"||l==="Infinity"||l==="+Infinity"||l==="-Infinity")return s?Ie:me;if(g=g||10,g<2||36<g)throw RangeError("radix");var b;if((b=l.indexOf("-"))>0)throw Error("interior hyphen");if(b===0)return O(l.substring(1),s,g).neg();for(var k=f(S(g,8)),w=me,U=0;U<l.length;U+=8){var X=Math.min(8,l.length-U),ue=parseInt(l.substring(U,U+X),g);if(X<8){var $=f(S(g,X));w=w.mul($).add(f(ue))}else w=w.mul(k),w=w.add(f(ue))}return w.unsigned=s,w}n.fromString=O;function y(l,s){return typeof l=="number"?f(l,s):typeof l=="string"?O(l,s):a(l.low,l.high,typeof s=="boolean"?s:l.unsigned)}n.fromValue=y;var q=65536,_t=1<<24,Rt=q*q,tr=Rt*Rt,nr=tr/2,rr=p(_t),me=p(0);n.ZERO=me;var Ie=p(0,!0);n.UZERO=Ie;var Ot=p(1);n.ONE=Ot;var ir=p(1,!0);n.UONE=ir;var sn=p(-1);n.NEG_ONE=sn;var or=a(-1,2147483647,!1);n.MAX_VALUE=or;var sr=a(-1,-1,!0);n.MAX_UNSIGNED_VALUE=sr;var K=a(0,-2147483648,!1);n.MIN_VALUE=K;var c=n.prototype;c.toInt=function(){return this.unsigned?this.low>>>0:this.low},c.toNumber=function(){return this.unsigned?(this.high>>>0)*Rt+(this.low>>>0):this.high*Rt+(this.low>>>0)},c.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(K)){var g=f(s),b=this.div(g),k=b.mul(g).sub(this);return b.toString(s)+k.toInt().toString(s)}else return"-"+this.neg().toString(s);for(var w=f(S(s,6),this.unsigned),U=this,X="";;){var ue=U.div(w),$=U.sub(ue.mul(w)).toInt()>>>0,A=$.toString(s);if(U=ue,U.isZero())return A+X;for(;A.length<6;)A="0"+A;X=""+A+X}},c.getHighBits=function(){return this.high},c.getHighBitsUnsigned=function(){return this.high>>>0},c.getLowBits=function(){return this.low},c.getLowBitsUnsigned=function(){return this.low>>>0},c.getNumBitsAbs=function(){if(this.isNegative())return this.eq(K)?64:this.neg().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,g=31;g>0&&(s&1<<g)==0;g--);return this.high!=0?g+33:g+1},c.isSafeInteger=function(){var s=this.high>>21;return s?this.unsigned?!1:s===-1&&!(this.low===0&&this.high===-2097152):!0},c.isZero=function(){return this.high===0&&this.low===0},c.eqz=c.isZero,c.isNegative=function(){return!this.unsigned&&this.high<0},c.isPositive=function(){return this.unsigned||this.high>=0},c.isOdd=function(){return(this.low&1)===1},c.isEven=function(){return(this.low&1)===0},c.equals=function(s){return o(s)||(s=y(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},c.eq=c.equals,c.notEquals=function(s){return!this.eq(s)},c.neq=c.notEquals,c.ne=c.notEquals,c.lessThan=function(s){return this.comp(s)<0},c.lt=c.lessThan,c.lessThanOrEqual=function(s){return this.comp(s)<=0},c.lte=c.lessThanOrEqual,c.le=c.lessThanOrEqual,c.greaterThan=function(s){return this.comp(s)>0},c.gt=c.greaterThan,c.greaterThanOrEqual=function(s){return this.comp(s)>=0},c.gte=c.greaterThanOrEqual,c.ge=c.greaterThanOrEqual,c.compare=function(s){if(o(s)||(s=y(s)),this.eq(s))return 0;var g=this.isNegative(),b=s.isNegative();return g&&!b?-1:!g&&b?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.sub(s).isNegative()?-1:1},c.comp=c.compare,c.negate=function(){return!this.unsigned&&this.eq(K)?K:this.not().add(Ot)},c.neg=c.negate,c.add=function(s){o(s)||(s=y(s));var g=this.high>>>16,b=this.high&65535,k=this.low>>>16,w=this.low&65535,U=s.high>>>16,X=s.high&65535,ue=s.low>>>16,$=s.low&65535,A=0,ae=0,D=0,ee=0;return ee+=w+$,D+=ee>>>16,ee&=65535,D+=k+ue,ae+=D>>>16,D&=65535,ae+=b+X,A+=ae>>>16,ae&=65535,A+=g+U,A&=65535,a(D<<16|ee,A<<16|ae,this.unsigned)},c.subtract=function(s){return o(s)||(s=y(s)),this.add(s.neg())},c.sub=c.subtract,c.multiply=function(s){if(this.isZero())return this;if(o(s)||(s=y(s)),t){var g=t.mul(this.low,this.high,s.low,s.high);return a(g,t.get_high(),this.unsigned)}if(s.isZero())return this.unsigned?Ie:me;if(this.eq(K))return s.isOdd()?K:me;if(s.eq(K))return this.isOdd()?K:me;if(this.isNegative())return s.isNegative()?this.neg().mul(s.neg()):this.neg().mul(s).neg();if(s.isNegative())return this.mul(s.neg()).neg();if(this.lt(rr)&&s.lt(rr))return f(this.toNumber()*s.toNumber(),this.unsigned);var b=this.high>>>16,k=this.high&65535,w=this.low>>>16,U=this.low&65535,X=s.high>>>16,ue=s.high&65535,$=s.low>>>16,A=s.low&65535,ae=0,D=0,ee=0,Gt=0;return Gt+=U*A,ee+=Gt>>>16,Gt&=65535,ee+=w*A,D+=ee>>>16,ee&=65535,ee+=U*$,D+=ee>>>16,ee&=65535,D+=k*A,ae+=D>>>16,D&=65535,D+=w*$,ae+=D>>>16,D&=65535,D+=U*ue,ae+=D>>>16,D&=65535,ae+=b*A+k*$+w*ue+U*X,ae&=65535,a(ee<<16|Gt,ae<<16|D,this.unsigned)},c.mul=c.multiply,c.divide=function(s){if(o(s)||(s=y(s)),s.isZero())throw Error("division by zero");if(t){if(!this.unsigned&&this.high===-2147483648&&s.low===-1&&s.high===-1)return this;var g=(this.unsigned?t.div_u:t.div_s)(this.low,this.high,s.low,s.high);return a(g,t.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ie:me;var b,k,w;if(this.unsigned){if(s.unsigned||(s=s.toUnsigned()),s.gt(this))return Ie;if(s.gt(this.shru(1)))return ir;w=Ie}else{if(this.eq(K)){if(s.eq(Ot)||s.eq(sn))return K;if(s.eq(K))return Ot;var U=this.shr(1);return b=U.div(s).shl(1),b.eq(me)?s.isNegative()?Ot:sn:(k=this.sub(s.mul(b)),w=b.add(k.div(s)),w)}else if(s.eq(K))return this.unsigned?Ie:me;if(this.isNegative())return s.isNegative()?this.neg().div(s.neg()):this.neg().div(s).neg();if(s.isNegative())return this.div(s.neg()).neg();w=me}for(k=this;k.gte(s);){b=Math.max(1,Math.floor(k.toNumber()/s.toNumber()));for(var X=Math.ceil(Math.log(b)/Math.LN2),ue=X<=48?1:S(2,X-48),$=f(b),A=$.mul(s);A.isNegative()||A.gt(k);)b-=ue,$=f(b,this.unsigned),A=$.mul(s);$.isZero()&&($=Ot),w=w.add($),k=k.sub(A)}return w},c.div=c.divide,c.modulo=function(s){if(o(s)||(s=y(s)),t){var g=(this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,s.low,s.high);return a(g,t.get_high(),this.unsigned)}return this.sub(this.div(s).mul(s))},c.mod=c.modulo,c.rem=c.modulo,c.not=function(){return a(~this.low,~this.high,this.unsigned)},c.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},c.clz=c.countLeadingZeros,c.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},c.ctz=c.countTrailingZeros,c.and=function(s){return o(s)||(s=y(s)),a(this.low&s.low,this.high&s.high,this.unsigned)},c.or=function(s){return o(s)||(s=y(s)),a(this.low|s.low,this.high|s.high,this.unsigned)},c.xor=function(s){return o(s)||(s=y(s)),a(this.low^s.low,this.high^s.high,this.unsigned)},c.shiftLeft=function(s){return o(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?a(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):a(0,this.low<<s-32,this.unsigned)},c.shl=c.shiftLeft,c.shiftRight=function(s){return o(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?a(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):a(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},c.shr=c.shiftRight,c.shiftRightUnsigned=function(s){return o(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?a(this.low>>>s|this.high<<32-s,this.high>>>s,this.unsigned):s===32?a(this.high,0,this.unsigned):a(this.high>>>s-32,0,this.unsigned)},c.shru=c.shiftRightUnsigned,c.shr_u=c.shiftRightUnsigned,c.rotateLeft=function(s){var g;return o(s)&&(s=s.toInt()),(s&=63)===0?this:s===32?a(this.high,this.low,this.unsigned):s<32?(g=32-s,a(this.low<<s|this.high>>>g,this.high<<s|this.low>>>g,this.unsigned)):(s-=32,g=32-s,a(this.high<<s|this.low>>>g,this.low<<s|this.high>>>g,this.unsigned))},c.rotl=c.rotateLeft,c.rotateRight=function(s){var g;return o(s)&&(s=s.toInt()),(s&=63)===0?this:s===32?a(this.high,this.low,this.unsigned):s<32?(g=32-s,a(this.high<<g|this.low>>>s,this.low<<g|this.high>>>s,this.unsigned)):(s-=32,g=32-s,a(this.low<<g|this.high>>>s,this.high<<g|this.low>>>s,this.unsigned))},c.rotr=c.rotateRight,c.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},c.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},c.toBytes=function(s){return s?this.toBytesLE():this.toBytesBE()},c.toBytesLE=function(){var s=this.high,g=this.low;return[g&255,g>>>8&255,g>>>16&255,g>>>24,s&255,s>>>8&255,s>>>16&255,s>>>24]},c.toBytesBE=function(){var s=this.high,g=this.low;return[s>>>24,s>>>16&255,s>>>8&255,s&255,g>>>24,g>>>16&255,g>>>8&255,g&255]},n.fromBytes=function(s,g,b){return b?n.fromBytesLE(s,g):n.fromBytesBE(s,g)},n.fromBytesLE=function(s,g){return new n(s[0]|s[1]<<8|s[2]<<16|s[3]<<24,s[4]|s[5]<<8|s[6]<<16|s[7]<<24,g)},n.fromBytesBE=function(s,g){return new n(s[4]<<24|s[5]<<16|s[6]<<8|s[7],s[0]<<24|s[1]<<16|s[2]<<8|s[3],g)},typeof BigInt=="function"&&(n.fromBigInt=function(s,g){var b=Number(BigInt.asIntN(32,s)),k=Number(BigInt.asIntN(32,s>>BigInt(32)));return a(b,k,g)},n.fromValue=function(s,g){return typeof s=="bigint"?n.fromBigInt(s,g):y(s,g)},c.toBigInt=function(){var s=BigInt(this.low>>>0),g=BigInt(this.unsigned?this.high>>>0:this.high);return g<<BigInt(32)|s});var nu=e.default=n})});var We=M(gn=>{"use strict";d();var E=gn;E.asPromise=pr();E.base64=Er();E.EventEmitter=yr();E.float=Ir();E.inquire=wr();E.utf8=xr();E.pool=Lr();E.LongBits=Pr();function Mr(e){return e==="__proto__"||e==="prototype"||e==="constructor"}E.isUnsafeProperty=Mr;E.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);E.global=E.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||gn;E.emptyArray=Object.freeze?Object.freeze([]):[];E.emptyObject=Object.freeze?Object.freeze({}):{};E.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};E.isString=function(t){return typeof t=="string"||t instanceof String};E.isObject=function(t){return t&&typeof t=="object"};E.isset=E.isSet=function(t,n){var o=t[n];return o!=null&&Object.hasOwnProperty.call(t,n)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};E.Buffer=(function(){try{var e=E.global.Buffer;return e.prototype.utf8Write?e:null}catch{return null}})();E._Buffer_from=null;E._Buffer_allocUnsafe=null;E.newBuffer=function(t){return typeof t=="number"?E.Buffer?E._Buffer_allocUnsafe(t):new E.Array(t):E.Buffer?E._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};E.Array=typeof Uint8Array<"u"?Uint8Array:Array;E.Long=E.global.dcodeIO&&E.global.dcodeIO.Long||E.global.Long||(function(){try{var e=Ur();return e&&e.isLong?e:null}catch{return null}})();E.key2Re=/^true|false|0|1$/;E.key32Re=/^-?(?:0|[1-9][0-9]*)$/;E.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;E.longToHash=function(t){return t?E.LongBits.from(t).toHash():E.LongBits.zeroHash};E.longFromHash=function(t,n){var o=E.LongBits.fromHash(t);return E.Long?E.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function Dr(e){var t=typeof arguments[arguments.length-1]=="boolean",n=t?arguments.length-1:arguments.length;t=t&&arguments[arguments.length-1];for(var o=1;o<n;++o){var i=arguments[o];if(i)for(var r=Object.keys(i),u=0;u<r.length;++u)!Mr(r[u])&&(e[r[u]]===void 0||!t)&&(e[r[u]]=i[r[u]])}return e}E.merge=Dr;E.nestingLimit=32;E.recursionLimit=100;E.makeProp=function(t,n){Object.defineProperty(t,n,{enumerable:!0,configurable:!0,writable:!0})};E.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Br(e){function t(n,o){if(!(this instanceof t))return new t(n,o);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&Dr(this,o)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}E.newError=Br;E.ProtocolError=Br("ProtocolError");E.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var i=Object.keys(this),r=i.length-1;r>-1;--r)if(n[i[r]]===1&&this[i[r]]!==void 0&&this[i[r]]!==null)return i[r]}};E.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};E.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};E._configure=function(){var e=E.Buffer;if(!e){E._Buffer_from=E._Buffer_allocUnsafe=null;return}E._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},E._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var bn=M((qu,qr)=>{"use strict";d();qr.exports=T;var fe=We(),mn,Xt=fe.LongBits,Jr=fe.base64,Fr=fe.utf8;function Mt(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function En(){}function as(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function T(){this.len=0,this.head=new Mt(En,0,0),this.tail=this.head,this.states=null}var Wr=function(){return fe.Buffer?function(){return(T.create=function(){return new mn})()}:function(){return new T}};T.create=Wr();T.alloc=function(t){return new fe.Array(t)};fe.Array!==Array&&(T.alloc=fe.pool(T.alloc,fe.Array.prototype.subarray));T.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Mt(t,n,o),this.len+=n,this};function vn(e,t,n){t[n]=e&255}function fs(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function yn(e,t){this.len=e,this.next=void 0,this.val=t}yn.prototype=Object.create(Mt.prototype);yn.prototype.fn=fs;T.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new yn((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};T.prototype.int32=function(t){return(t|=0)<0?this._push(Nn,10,Xt.fromNumber(t)):this.uint32(t)};T.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Nn(e,t,n){for(var o=e.lo,i=e.hi;i;)t[n++]=o&127|128,o=(o>>>7|i<<25)>>>0,i>>>=7;for(;o>127;)t[n++]=o&127|128,o=o>>>7;t[n++]=o}T.prototype.uint64=function(t){var n=Xt.from(t);return this._push(Nn,n.length(),n)};T.prototype.int64=T.prototype.uint64;T.prototype.sint64=function(t){var n=Xt.from(t).zzEncode();return this._push(Nn,n.length(),n)};T.prototype.bool=function(t){return this._push(vn,1,t?1:0)};function Sn(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}T.prototype.fixed32=function(t){return this._push(Sn,4,t>>>0)};T.prototype.sfixed32=T.prototype.fixed32;T.prototype.fixed64=function(t){var n=Xt.from(t);return this._push(Sn,4,n.lo)._push(Sn,4,n.hi)};T.prototype.sfixed64=T.prototype.fixed64;T.prototype.float=function(t){return this._push(fe.float.writeFloatLE,4,t)};T.prototype.double=function(t){return this._push(fe.float.writeDoubleLE,8,t)};var ds=fe.Array.prototype.set?function(t,n,o){n.set(t,o)}:function(t,n,o){for(var i=0;i<t.length;++i)n[o+i]=t[i]};T.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(vn,1,0);if(fe.isString(t)){var o=T.alloc(n=Jr.length(t));Jr.decode(t,o,0),t=o}return this.uint32(n)._push(ds,n,t)};T.prototype.string=function(t){var n=Fr.length(t);return n?this.uint32(n)._push(Fr.write,n,t):this._push(vn,1,0)};T.prototype.fork=function(){return this.states=new as(this),this.head=this.tail=new Mt(En,0,0),this.len=0,this};T.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Mt(En,0,0),this.len=0),this};T.prototype.ldelim=function(){var t=this.head,n=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=t.next,this.tail=n,this.len+=o),this};T.prototype.finish=function(){for(var t=this.head.next,n=this.constructor.alloc(this.len),o=0;t;)t.fn(t.val,n,o),o+=t.len,t=t.next;return n};T._configure=function(e){mn=e,T.create=Wr(),mn._configure()}});var Zr=M((Gu,Gr)=>{"use strict";d();Gr.exports=ye;var $r=bn();(ye.prototype=Object.create($r.prototype)).constructor=ye;var qe=We();function ye(){$r.call(this)}ye._configure=function(){ye.alloc=qe._Buffer_allocUnsafe,ye.writeBytesBuffer=qe.Buffer&&qe.Buffer.prototype instanceof Uint8Array&&qe.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};ye.prototype.bytes=function(t){qe.isString(t)&&(t=qe._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(ye.writeBytesBuffer,n,t),this};function ls(e,t,n){e.length<40?qe.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}ye.prototype.string=function(t){var n=qe.Buffer.byteLength(t);return this.uint32(n),n&&this._push(ls,n,t),this};ye._configure()});var Rn=M((Hu,Yr)=>{"use strict";d();Yr.exports=x;var de=We(),_n,Kr=de.LongBits,cs=de.utf8;function Ee(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function x(e){this.buf=e,this.pos=0,this.len=e.length}var Hr=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new x(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new x(t);throw Error("illegal buffer")},Xr=function(){return de.Buffer?function(n){return(x.create=function(i){return de.Buffer.isBuffer(i)?new _n(i):Hr(i)})(n)}:Hr};x.create=Xr();x.prototype._slice=de.Array.prototype.subarray||de.Array.prototype.slice;x.prototype.uint32=(function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Ee(this,10);return t}})();x.prototype.int32=function(){return this.uint32()|0};x.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Tn(){var e=new Kr(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Ee(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Ee(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}x.prototype.bool=function(){return this.uint32()!==0};function Yt(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}x.prototype.fixed32=function(){if(this.pos+4>this.len)throw Ee(this,4);return Yt(this.buf,this.pos+=4)};x.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Ee(this,4);return Yt(this.buf,this.pos+=4)|0};function zr(){if(this.pos+8>this.len)throw Ee(this,8);return new Kr(Yt(this.buf,this.pos+=4),Yt(this.buf,this.pos+=4))}x.prototype.float=function(){if(this.pos+4>this.len)throw Ee(this,4);var t=de.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};x.prototype.double=function(){if(this.pos+8>this.len)throw Ee(this,4);var t=de.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};x.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw Ee(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=de.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};x.prototype.string=function(){var t=this.bytes();return cs.read(t,0,t.length)};x.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Ee(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Ee(this);while(this.buf[this.pos++]&128);return this};x.recursionLimit=de.recursionLimit;x.prototype.skipType=function(e,t){if(t===void 0&&(t=0),t>x.recursionLimit)throw Error("maximum nesting depth exceeded");switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e,t+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};x._configure=function(e){_n=e,x.create=Xr(),_n._configure();var t=de.Long?"toLong":"toNumber";de.merge(x.prototype,{int64:function(){return Tn.call(this)[t](!1)},uint64:function(){return Tn.call(this)[t](!0)},sint64:function(){return Tn.call(this).zzDecode()[t](!1)},fixed64:function(){return zr.call(this)[t](!0)},sfixed64:function(){return zr.call(this)[t](!1)}})}});var ti=M((Ku,ei)=>{"use strict";d();ei.exports=ct;var jr=Rn();(ct.prototype=Object.create(jr.prototype)).constructor=ct;var Qr=We();function ct(e){jr.call(this,e)}ct._configure=function(){Qr.Buffer&&(ct.prototype._slice=Qr.Buffer.prototype.slice)};ct.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};ct._configure()});var ri=M((Yu,ni)=>{"use strict";d();ni.exports=Dt;var On=We();(Dt.prototype=Object.create(On.EventEmitter.prototype)).constructor=Dt;function Dt(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");On.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}Dt.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var u=this;if(!r)return On.asPromise(e,u,t,n,o,i);if(!u.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return u.rpcImpl(t,n[u.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(f,a){if(f)return u.emit("error",f,t),r(f);if(a===null){u.end(!0);return}if(!(a instanceof o))try{a=o[u.responseDelimited?"decodeDelimited":"decode"](a)}catch(S){return u.emit("error",S,t),r(S)}return u.emit("data",a,t),r(null,a)})}catch(p){u.emit("error",p,t),setTimeout(function(){r(p)},0);return}};Dt.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var oi=M(ii=>{"use strict";d();var hs=ii;hs.Service=ri()});var ui=M((ta,si)=>{"use strict";d();si.exports=Object.create(null)});var di=M(fi=>{"use strict";d();var Y=fi;Y.build="minimal";Y.Writer=bn();Y.BufferWriter=Zr();Y.Reader=Rn();Y.BufferReader=ti();Y.util=We();Y.rpc=oi();Y.roots=ui();Y.configure=ai;function ai(){Y.util._configure(),Y.Writer._configure(Y.BufferWriter),Y.Reader._configure(Y.BufferReader)}ai()});var W=M((oa,li)=>{"use strict";d();li.exports=di()});d();d();d();var ar="clientVersion",an="devvit.v1.min.js",fn="screenshot.v1.min.js",fr=`https://webview.devvit.net/scripts/${an}`;function dr(e){if(e.currentScript&&"src"in e.currentScript)return new URL(e.currentScript.src).searchParams.get(ar)??void 0}function lr(e){if(e.currentScript&&"src"in e.currentScript)return e.currentScript.src}d();d();var It;(function(e){e[e.CLIENT_UNSPECIFIED=0]="CLIENT_UNSPECIFIED",e[e.ANDROID=1]="ANDROID",e[e.IOS=2]="IOS",e[e.SHREDDIT=3]="SHREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(It||(It={}));var cr;(function(e){e[e.HEIGHT_UNSPECIFIED=0]="HEIGHT_UNSPECIFIED",e[e.REGULAR=1]="REGULAR",e[e.TALL=2]="TALL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(cr||(cr={}));d();d();function Zt(e,t){if(!e)throw Error(t)}var Je;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(Je||(Je={}));function Qo(e){return!!e?.startsWith(Je.ACCOUNT)}function jo(e){return!!e?.startsWith(Je.LINK)}function es(e){return!!e?.startsWith(Je.SUBREDDIT)}function ts(e){Zt(Qo(e),`Expected account id to start with ${Je.ACCOUNT}, got ${e}`)}function ns(e){Zt(jo(e),`Expected link id to start with ${Je.LINK}, got ${e}`)}function rs(e){Zt(es(e),`Expected subreddit id to start with ${Je.SUBREDDIT}, got ${e}`)}function Ht(e){return ts(e),e}function dn(e){return ns(e),e}function ln(e){return rs(e),e}d();d();d();var z;(function(e){e[e.EFFECT_REALTIME_SUB=0]="EFFECT_REALTIME_SUB",e[e.EFFECT_RERENDER_UI=1]="EFFECT_RERENDER_UI",e[e.EFFECT_RELOAD_PART=2]="EFFECT_RELOAD_PART",e[e.EFFECT_SHOW_FORM=3]="EFFECT_SHOW_FORM",e[e.EFFECT_SHOW_TOAST=4]="EFFECT_SHOW_TOAST",e[e.EFFECT_NAVIGATE_TO_URL=5]="EFFECT_NAVIGATE_TO_URL",e[e.EFFECT_SET_INTERVALS=7]="EFFECT_SET_INTERVALS",e[e.EFFECT_CREATE_ORDER=8]="EFFECT_CREATE_ORDER",e[e.EFFECT_WEB_VIEW=9]="EFFECT_WEB_VIEW",e[e.EFFECT_CAN_RUN_AS_USER=11]="EFFECT_CAN_RUN_AS_USER",e[e.EFFECT_TELEMETRY=12]="EFFECT_TELEMETRY",e[e.EFFECT_UPDATE_REQUEST_CONTEXT=13]="EFFECT_UPDATE_REQUEST_CONTEXT",e[e.EFFECT_SCREENSHOT_RESPONSE=14]="EFFECT_SCREENSHOT_RESPONSE",e[e.EFFECT_LOGIN_PROMPT=15]="EFFECT_LOGIN_PROMPT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(z||(z={}));d();d();var At;(function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(At||(At={}));d();var L=G(W(),1);d();var te=G(W(),1);d();var m=new Map;var pt;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(pt||(pt={}));function ps(e){switch(e){case 0:case"NULL_VALUE":return pt.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return pt.UNRECOGNIZED}}function gs(e){switch(e){case pt.NULL_VALUE:return 0;case pt.UNRECOGNIZED:default:return-1}}function In(){return{fields:{}}}var le={$type:"google.protobuf.Struct",encode(e,t=te.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&Bt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=In();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let u=Bt.decode(n,n.uint32());u.value!==void 0&&(i.fields[u.key]=u.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:hi(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,i])=>{t.fields[o]=i}))}return t},create(e){return le.fromPartial(e??{})},fromPartial(e){let t=In();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=In();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};m.set(le.$type,le);function ci(){return{key:"",value:void 0}}var Bt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=te.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Z.encode(Z.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=Z.unwrap(Z.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:wt(e.key)?globalThis.String(e.key):"",value:wt(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return Bt.fromPartial(e??{})},fromPartial(e){let t=ci();return t.key=e.key??"",t.value=e.value??void 0,t}};m.set(Bt.$type,Bt);function Cn(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var Z={$type:"google.protobuf.Value",encode(e,t=te.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&le.encode(le.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&ht.encode(ht.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Cn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.nullValue=n.int32();continue;case 2:if(r!==17)break;i.numberValue=n.double();continue;case 3:if(r!==26)break;i.stringValue=n.string();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.structValue=le.unwrap(le.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=ht.unwrap(ht.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:wt(e.nullValue)?ps(e.nullValue):void 0,numberValue:wt(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:wt(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:wt(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:hi(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=gs(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return Z.fromPartial(e??{})},fromPartial(e){let t=Cn();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=Cn();if(e===null)t.nullValue=pt.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};m.set(Z.$type,Z);function wn(){return{values:[]}}var ht={$type:"google.protobuf.ListValue",encode(e,t=te.default.Writer.create()){for(let n of e.values)Z.encode(Z.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof te.default.Reader?e:te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(Z.unwrap(Z.decode(n,n.uint32())));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return ht.fromPartial(e??{})},fromPartial(e){let t=wn();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=wn();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};m.set(ht.$type,ht);function hi(e){return typeof e=="object"&&e!==null}function wt(e){return e!=null}d();var Et=G(W(),1);d();var C=G(W(),1);d();d();var ce=null;try{ce=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function I(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}I.prototype.__isLong__;Object.defineProperty(I.prototype,"__isLong__",{value:!0});function H(e){return(e&&e.__isLong__)===!0}function pi(e){var t=Math.clz32(e&-e);return e?31-t:t}I.isLong=H;var gi={},mi={};function gt(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=mi[e],o)?o:(n=_(e,0,!0),i&&(mi[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=gi[e],o)?o:(n=_(e,e<0?-1:0,!1),i&&(gi[e]=n),n))}I.fromInt=gt;function he(e,t){if(isNaN(e))return t?Ce:ve;if(t){if(e<0)return Ce;if(e>=yi)return Ti}else{if(e<=-Ei)return Q;if(e+1>=Ei)return bi}return e<0?he(-e,t).neg():_(e%xt|0,e/xt|0,t)}I.fromNumber=he;function _(e,t,n){return new I(e,t,n)}I.fromBits=_;var Qt=Math.pow;function xn(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Ce:ve;if(n=n||10,n<2||36<n)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return xn(e.substring(1),t,n).neg();for(var i=he(Qt(n,8)),r=ve,u=0;u<e.length;u+=8){var p=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+p),n);if(p<8){var a=he(Qt(n,p));r=r.mul(a).add(he(f))}else r=r.mul(i),r=r.add(he(f))}return r.unsigned=t,r}I.fromString=xn;function pe(e,t){return typeof e=="number"?he(e,t):typeof e=="string"?xn(e,t):_(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}I.fromValue=pe;var Si=65536,ms=1<<24,xt=Si*Si,yi=xt*xt,Ei=yi/2,vi=gt(ms),ve=gt(0);I.ZERO=ve;var Ce=gt(0,!0);I.UZERO=Ce;var kt=gt(1);I.ONE=kt;var Ni=gt(1,!0);I.UONE=Ni;var kn=gt(-1);I.NEG_ONE=kn;var bi=_(-1,2147483647,!1);I.MAX_VALUE=bi;var Ti=_(-1,-1,!0);I.MAX_UNSIGNED_VALUE=Ti;var Q=_(0,-2147483648,!1);I.MIN_VALUE=Q;var h=I.prototype;h.toInt=function(){return this.unsigned?this.low>>>0:this.low};h.toNumber=function(){return this.unsigned?(this.high>>>0)*xt+(this.low>>>0):this.high*xt+(this.low>>>0)};h.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Q)){var n=he(t),o=this.div(n),i=o.mul(n).sub(this);return o.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var r=he(Qt(t,6),this.unsigned),u=this,p="";;){var f=u.div(r),a=u.sub(f.mul(r)).toInt()>>>0,S=a.toString(t);if(u=f,u.isZero())return S+p;for(;S.length<6;)S="0"+S;p=""+S+p}};h.getHighBits=function(){return this.high};h.getHighBitsUnsigned=function(){return this.high>>>0};h.getLowBits=function(){return this.low};h.getLowBitsUnsigned=function(){return this.low>>>0};h.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Q)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&(t&1<<n)==0;n--);return this.high!=0?n+33:n+1};h.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};h.isZero=function(){return this.high===0&&this.low===0};h.eqz=h.isZero;h.isNegative=function(){return!this.unsigned&&this.high<0};h.isPositive=function(){return this.unsigned||this.high>=0};h.isOdd=function(){return(this.low&1)===1};h.isEven=function(){return(this.low&1)===0};h.equals=function(t){return H(t)||(t=pe(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};h.eq=h.equals;h.notEquals=function(t){return!this.eq(t)};h.neq=h.notEquals;h.ne=h.notEquals;h.lessThan=function(t){return this.comp(t)<0};h.lt=h.lessThan;h.lessThanOrEqual=function(t){return this.comp(t)<=0};h.lte=h.lessThanOrEqual;h.le=h.lessThanOrEqual;h.greaterThan=function(t){return this.comp(t)>0};h.gt=h.greaterThan;h.greaterThanOrEqual=function(t){return this.comp(t)>=0};h.gte=h.greaterThanOrEqual;h.ge=h.greaterThanOrEqual;h.compare=function(t){if(H(t)||(t=pe(t)),this.eq(t))return 0;var n=this.isNegative(),o=t.isNegative();return n&&!o?-1:!n&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};h.comp=h.compare;h.negate=function(){return!this.unsigned&&this.eq(Q)?Q:this.not().add(kt)};h.neg=h.negate;h.add=function(t){H(t)||(t=pe(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,u=t.high>>>16,p=t.high&65535,f=t.low>>>16,a=t.low&65535,S=0,O=0,y=0,q=0;return q+=r+a,y+=q>>>16,q&=65535,y+=i+f,O+=y>>>16,y&=65535,O+=o+p,S+=O>>>16,O&=65535,S+=n+u,S&=65535,_(y<<16|q,S<<16|O,this.unsigned)};h.subtract=function(t){return H(t)||(t=pe(t)),this.add(t.neg())};h.sub=h.subtract;h.multiply=function(t){if(this.isZero())return this;if(H(t)||(t=pe(t)),ce){var n=ce.mul(this.low,this.high,t.low,t.high);return _(n,ce.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Ce:ve;if(this.eq(Q))return t.isOdd()?Q:ve;if(t.eq(Q))return this.isOdd()?Q:ve;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(vi)&&t.lt(vi))return he(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,u=this.low&65535,p=t.high>>>16,f=t.high&65535,a=t.low>>>16,S=t.low&65535,O=0,y=0,q=0,_t=0;return _t+=u*S,q+=_t>>>16,_t&=65535,q+=r*S,y+=q>>>16,q&=65535,q+=u*a,y+=q>>>16,q&=65535,y+=i*S,O+=y>>>16,y&=65535,y+=r*a,O+=y>>>16,y&=65535,y+=u*f,O+=y>>>16,y&=65535,O+=o*S+i*a+r*f+u*p,O&=65535,_(q<<16|_t,O<<16|y,this.unsigned)};h.mul=h.multiply;h.divide=function(t){if(H(t)||(t=pe(t)),t.isZero())throw Error("division by zero");if(ce){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?ce.div_u:ce.div_s)(this.low,this.high,t.low,t.high);return _(n,ce.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ce:ve;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ce;if(t.gt(this.shru(1)))return Ni;r=Ce}else{if(this.eq(Q)){if(t.eq(kt)||t.eq(kn))return Q;if(t.eq(Q))return kt;var u=this.shr(1);return o=u.div(t).shl(1),o.eq(ve)?t.isNegative()?kt:kn:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(Q))return this.unsigned?Ce:ve;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();r=ve}for(i=this;i.gte(t);){o=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var p=Math.ceil(Math.log(o)/Math.LN2),f=p<=48?1:Qt(2,p-48),a=he(o),S=a.mul(t);S.isNegative()||S.gt(i);)o-=f,a=he(o,this.unsigned),S=a.mul(t);a.isZero()&&(a=kt),r=r.add(a),i=i.sub(S)}return r};h.div=h.divide;h.modulo=function(t){if(H(t)||(t=pe(t)),ce){var n=(this.unsigned?ce.rem_u:ce.rem_s)(this.low,this.high,t.low,t.high);return _(n,ce.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};h.mod=h.modulo;h.rem=h.modulo;h.not=function(){return _(~this.low,~this.high,this.unsigned)};h.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};h.clz=h.countLeadingZeros;h.countTrailingZeros=function(){return this.low?pi(this.low):pi(this.high)+32};h.ctz=h.countTrailingZeros;h.and=function(t){return H(t)||(t=pe(t)),_(this.low&t.low,this.high&t.high,this.unsigned)};h.or=function(t){return H(t)||(t=pe(t)),_(this.low|t.low,this.high|t.high,this.unsigned)};h.xor=function(t){return H(t)||(t=pe(t)),_(this.low^t.low,this.high^t.high,this.unsigned)};h.shiftLeft=function(t){return H(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?_(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):_(0,this.low<<t-32,this.unsigned)};h.shl=h.shiftLeft;h.shiftRight=function(t){return H(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?_(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):_(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};h.shr=h.shiftRight;h.shiftRightUnsigned=function(t){return H(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?_(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?_(this.high,0,this.unsigned):_(this.high>>>t-32,0,this.unsigned)};h.shru=h.shiftRightUnsigned;h.shr_u=h.shiftRightUnsigned;h.rotateLeft=function(t){var n;return H(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?_(this.high,this.low,this.unsigned):t<32?(n=32-t,_(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,_(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};h.rotl=h.rotateLeft;h.rotateRight=function(t){var n;return H(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?_(this.high,this.low,this.unsigned):t<32?(n=32-t,_(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,_(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};h.rotr=h.rotateRight;h.toSigned=function(){return this.unsigned?_(this.low,this.high,!1):this};h.toUnsigned=function(){return this.unsigned?this:_(this.low,this.high,!0)};h.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};h.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};h.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};I.fromBytes=function(t,n,o){return o?I.fromBytesLE(t,n):I.fromBytesBE(t,n)};I.fromBytesLE=function(t,n){return new I(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};I.fromBytesBE=function(t,n){return new I(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};typeof BigInt=="function"&&(I.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return _(o,i,n)},I.fromValue=function(t,n){return typeof t=="bigint"?I.fromBigInt(t,n):pe(t,n)},h.toBigInt=function(){var t=BigInt(this.low>>>0),n=BigInt(this.unsigned?this.high>>>0:this.high);return n<<BigInt(32)|t});var Vn=I;var mt=G(W(),1);function _i(){return{seconds:0,nanos:0}}var St={$type:"google.protobuf.Timestamp",encode(e,t=mt.default.Writer.create()){return e.seconds!==0&&t.uint32(8).int64(e.seconds),e.nanos!==0&&t.uint32(16).int32(e.nanos),t},decode(e,t){let n=e instanceof mt.default.Reader?e:mt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_i();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=Ss(n.int64());continue;case 2:if(r!==16)break;i.nanos=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{seconds:Ri(e.seconds)?globalThis.Number(e.seconds):0,nanos:Ri(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==0&&(t.seconds=Math.round(e.seconds)),e.nanos!==0&&(t.nanos=Math.round(e.nanos)),t},create(e){return St.fromPartial(e??{})},fromPartial(e){let t=_i();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};m.set(St.$type,St);function Ss(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}mt.default.util.Long!==Vn&&(mt.default.util.Long=Vn,mt.default.configure());function Ri(e){return e!=null}var Ne;(function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ne||(Ne={}));function Bn(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return Ne.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return Ne.REVOKED;case 2:case"GRANTED":return Ne.GRANTED;case-1:case"UNRECOGNIZED":default:return Ne.UNRECOGNIZED}}function Jn(e){switch(e){case Ne.CONSENT_STATUS_UNKNOWN:return 0;case Ne.REVOKED:return 1;case Ne.GRANTED:return 2;case Ne.UNRECOGNIZED:default:return-1}}var ge;(function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ge||(ge={}));function Pi(e){switch(e){case 0:case"SCOPE_UNKNOWN":return ge.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return ge.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return ge.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return ge.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return ge.UNRECOGNIZED}}function Ui(e){switch(e){case ge.SCOPE_UNKNOWN:return 0;case ge.SUBMIT_POST:return 1;case ge.SUBMIT_COMMENT:return 2;case ge.SUBSCRIBE_TO_SUBREDDIT:return 3;case ge.UNRECOGNIZED:default:return-1}}function Oi(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var $e={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=C.default.Writer.create()){e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.subredditId!==""&&t.uint32(18).string(e.subredditId),t.uint32(26).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),e.consentStatus!==0&&t.uint32(32).int32(e.consentStatus),e.updatedAt!==void 0&&St.encode(Es(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Oi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.subredditId=n.string();continue;case 3:if(r===24){i.scopes.push(n.int32());continue}if(r===26){let u=n.uint32()+n.pos;for(;n.pos<u;)i.scopes.push(n.int32());continue}break;case 4:if(r!==32)break;i.consentStatus=n.int32();continue;case 5:if(r!==42)break;i.updatedAt=Mi(St.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:J(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Pi(t)):[],consentStatus:J(e.consentStatus)?Bn(e.consentStatus):0,updatedAt:J(e.updatedAt)?vs(e.updatedAt):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Ui(n))),e.consentStatus!==0&&(t.consentStatus=Jn(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return $e.fromPartial(e??{})},fromPartial(e){let t=Oi();return t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t.consentStatus=e.consentStatus??0,t.updatedAt=e.updatedAt??void 0,t}};m.set($e.$type,$e);function Ii(){return{appSlug:"",appName:"",termsAndConditions:void 0,privacyPolicy:void 0}}var Ge={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=C.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),e.termsAndConditions!==void 0&&t.uint32(26).string(e.termsAndConditions),e.privacyPolicy!==void 0&&t.uint32(34).string(e.privacyPolicy),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ii();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.appName=n.string();continue;case 3:if(r!==26)break;i.termsAndConditions=n.string();continue;case 4:if(r!==34)break;i.privacyPolicy=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",appName:J(e.appName)?globalThis.String(e.appName):"",termsAndConditions:J(e.termsAndConditions)?globalThis.String(e.termsAndConditions):void 0,privacyPolicy:J(e.privacyPolicy)?globalThis.String(e.privacyPolicy):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),e.termsAndConditions!==void 0&&(t.termsAndConditions=e.termsAndConditions),e.privacyPolicy!==void 0&&(t.privacyPolicy=e.privacyPolicy),t},create(e){return Ge.fromPartial(e??{})},fromPartial(e){let t=Ii();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t.termsAndConditions=e.termsAndConditions??void 0,t.privacyPolicy=e.privacyPolicy??void 0,t}};m.set(Ge.$type,Ge);function Ci(){return{userId:""}}var Ln={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=C.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ci();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:J(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return Ln.fromPartial(e??{})},fromPartial(e){let t=Ci();return t.userId=e.userId??"",t}};m.set(Ln.$type,Ln);function wi(){return{appPermissions:[],devvitApps:[]}}var An={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=C.default.Writer.create()){for(let n of e.appPermissions)$e.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)Ge.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push($e.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(Ge.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(t=>$e.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>Ge.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>$e.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>Ge.toJSON(n))),t},create(e){return An.fromPartial(e??{})},fromPartial(e){let t=wi();return t.appPermissions=e.appPermissions?.map(n=>$e.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>Ge.fromPartial(n))||[],t}};m.set(An.$type,An);function ki(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Pn={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=C.default.Writer.create()){e.userId!==""&&t.uint32(10).string(e.userId),e.appSlug!==""&&t.uint32(18).string(e.appSlug),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t.uint32(34).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ki();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.userId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue;case 4:if(r===32){i.scopes.push(n.int32());continue}if(r===34){let u=n.uint32()+n.pos;for(;n.pos<u;)i.scopes.push(n.int32());continue}break}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{userId:J(e.userId)?globalThis.String(e.userId):"",appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:J(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Pi(t)):[]}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),e.appSlug!==""&&(t.appSlug=e.appSlug),e.subredditId!==""&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Ui(n))),t},create(e){return Pn.fromPartial(e??{})},fromPartial(e){let t=ki();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};m.set(Pn.$type,Pn);function xi(){return{error:void 0}}var Un={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=C.default.Writer.create()){return e.error!==void 0&&ne.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=xi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=ne.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:J(e.error)?ne.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=ne.toJSON(e.error)),t},create(e){return Un.fromPartial(e??{})},fromPartial(e){let t=xi();return t.error=e.error!==void 0&&e.error!==null?ne.fromPartial(e.error):void 0,t}};m.set(Un.$type,Un);function Vi(){return{appSlug:"",userId:"",subredditId:""}}var Mn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=C.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.userId!==""&&t.uint32(18).string(e.userId),e.subredditId!==""&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appSlug=n.string();continue;case 2:if(r!==18)break;i.userId=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:J(e.appSlug)?globalThis.String(e.appSlug):"",userId:J(e.userId)?globalThis.String(e.userId):"",subredditId:J(e.subredditId)?globalThis.String(e.subredditId):""}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.userId!==""&&(t.userId=e.userId),e.subredditId!==""&&(t.subredditId=e.subredditId),t},create(e){return Mn.fromPartial(e??{})},fromPartial(e){let t=Vi();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};m.set(Mn.$type,Mn);function Li(){return{error:void 0}}var Dn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=C.default.Writer.create()){return e.error!==void 0&&ne.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Li();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=ne.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:J(e.error)?ne.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=ne.toJSON(e.error)),t},create(e){return Dn.fromPartial(e??{})},fromPartial(e){let t=Li();return t.error=e.error!==void 0&&e.error!==null?ne.fromPartial(e.error):void 0,t}};m.set(Dn.$type,Dn);function Ai(){return{message:""}}var ne={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=C.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ai();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:J(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return ne.fromPartial(e??{})},fromPartial(e){let t=Ai();return t.message=e.message??"",t}};m.set(ne.$type,ne);function Es(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function Mi(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function vs(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Mi(St.fromJSON(e))}function J(e){return e!=null}function Di(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var Fn={$type:"devvit.ui.effect_types.v1alpha.CanRunAsUserEffect",encode(e,t=Et.default.Writer.create()){return e.postId!==void 0&&t.uint32(10).string(e.postId),e.appSlug!==void 0&&t.uint32(18).string(e.appSlug),e.subredditId!==void 0&&t.uint32(26).string(e.subredditId),t},decode(e,t){let n=e instanceof Et.default.Reader?e:Et.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Di();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postId=n.string();continue;case 2:if(r!==18)break;i.appSlug=n.string();continue;case 3:if(r!==26)break;i.subredditId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postId:jt(e.postId)?globalThis.String(e.postId):void 0,appSlug:jt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:jt(e.subredditId)?globalThis.String(e.subredditId):void 0}},toJSON(e){let t={};return e.postId!==void 0&&(t.postId=e.postId),e.appSlug!==void 0&&(t.appSlug=e.appSlug),e.subredditId!==void 0&&(t.subredditId=e.subredditId),t},create(e){return Fn.fromPartial(e??{})},fromPartial(e){let t=Di();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};m.set(Fn.$type,Fn);function Bi(){return{consentStatus:0}}var we={$type:"devvit.ui.effect_types.v1alpha.ConsentStatusEvent",encode(e,t=Et.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof Et.default.Reader?e:Et.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Bi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.consentStatus=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{consentStatus:jt(e.consentStatus)?Bn(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=Jn(e.consentStatus)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=Bi();return t.consentStatus=e.consentStatus??0,t}};m.set(we.$type,we);function jt(e){return e!=null}d();var Te=G(W(),1);var be;(function(e){e[e.STATUS_CANCELLED=0]="STATUS_CANCELLED",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_ERROR=2]="STATUS_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(be||(be={}));function ys(e){switch(e){case 0:case"STATUS_CANCELLED":return be.STATUS_CANCELLED;case 1:case"STATUS_SUCCESS":return be.STATUS_SUCCESS;case 2:case"STATUS_ERROR":return be.STATUS_ERROR;case-1:case"UNRECOGNIZED":default:return be.UNRECOGNIZED}}function Ns(e){switch(e){case be.STATUS_CANCELLED:return 0;case be.STATUS_SUCCESS:return 1;case be.STATUS_ERROR:return 2;case be.UNRECOGNIZED:default:return-1}}function Ji(){return{id:"",skus:[],metadata:{}}}var Ze={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect",encode(e,t=Te.default.Writer.create()){e.id!==""&&t.uint32(10).string(e.id);for(let n of e.skus)t.uint32(18).string(n);return Object.entries(e.metadata).forEach(([n,o])=>{Jt.encode({key:n,value:o},t.uint32(26).fork()).ldelim()}),t},decode(e,t){let n=e instanceof Te.default.Reader?e:Te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ji();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.skus.push(n.string());continue;case 3:if(r!==26)break;let u=Jt.decode(n,n.uint32());u.value!==void 0&&(i.metadata[u.key]=u.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:He(e.id)?globalThis.String(e.id):"",skus:globalThis.Array.isArray(e?.skus)?e.skus.map(t=>globalThis.String(t)):[],metadata:bs(e.metadata)?Object.entries(e.metadata).reduce((t,[n,o])=>(t[n]=String(o),t),{}):{}}},toJSON(e){let t={};if(e.id!==""&&(t.id=e.id),e.skus?.length&&(t.skus=e.skus),e.metadata){let n=Object.entries(e.metadata);n.length>0&&(t.metadata={},n.forEach(([o,i])=>{t.metadata[o]=i}))}return t},create(e){return Ze.fromPartial(e??{})},fromPartial(e){let t=Ji();return t.id=e.id??"",t.skus=e.skus?.map(n=>n)||[],t.metadata=Object.entries(e.metadata??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=globalThis.String(i)),n),{}),t}};m.set(Ze.$type,Ze);function Fi(){return{key:"",value:""}}var Jt={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect.MetadataEntry",encode(e,t=Te.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof Te.default.Reader?e:Te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:He(e.key)?globalThis.String(e.key):"",value:He(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==""&&(t.value=e.value),t},create(e){return Jt.fromPartial(e??{})},fromPartial(e){let t=Fi();return t.key=e.key??"",t.value=e.value??"",t}};m.set(Jt.$type,Jt);function Wi(){return{errorMessage:void 0,orderId:void 0,order:void 0,status:0,errorCode:void 0}}var ke={$type:"devvit.ui.effect_types.v1alpha.OrderResultEvent",encode(e,t=Te.default.Writer.create()){return e.errorMessage!==void 0&&t.uint32(18).string(e.errorMessage),e.orderId!==void 0&&t.uint32(26).string(e.orderId),e.order!==void 0&&Ze.encode(e.order,t.uint32(34).fork()).ldelim(),e.status!==0&&t.uint32(40).int32(e.status),e.errorCode!==void 0&&t.uint32(48).int32(e.errorCode),t},decode(e,t){let n=e instanceof Te.default.Reader?e:Te.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 2:if(r!==18)break;i.errorMessage=n.string();continue;case 3:if(r!==26)break;i.orderId=n.string();continue;case 4:if(r!==34)break;i.order=Ze.decode(n,n.uint32());continue;case 5:if(r!==40)break;i.status=n.int32();continue;case 6:if(r!==48)break;i.errorCode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{errorMessage:He(e.errorMessage)?globalThis.String(e.errorMessage):void 0,orderId:He(e.orderId)?globalThis.String(e.orderId):void 0,order:He(e.order)?Ze.fromJSON(e.order):void 0,status:He(e.status)?ys(e.status):0,errorCode:He(e.errorCode)?globalThis.Number(e.errorCode):void 0}},toJSON(e){let t={};return e.errorMessage!==void 0&&(t.errorMessage=e.errorMessage),e.orderId!==void 0&&(t.orderId=e.orderId),e.order!==void 0&&(t.order=Ze.toJSON(e.order)),e.status!==0&&(t.status=Ns(e.status)),e.errorCode!==void 0&&(t.errorCode=Math.round(e.errorCode)),t},create(e){return ke.fromPartial(e??{})},fromPartial(e){let t=Wi();return t.errorMessage=e.errorMessage??void 0,t.orderId=e.orderId??void 0,t.order=e.order!==void 0&&e.order!==null?Ze.fromPartial(e.order):void 0,t.status=e.status??0,t.errorCode=e.errorCode??void 0,t}};m.set(ke.$type,ke);function bs(e){return typeof e=="object"&&e!==null}function He(e){return e!=null}d();var oe=G(W(),1);d();var en=G(W(),1);d();var R=G(W(),1);d();var P;(function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(P||(P={}));function Vt(e){switch(e){case 0:case"STRING":return P.STRING;case 1:case"PARAGRAPH":return P.PARAGRAPH;case 2:case"NUMBER":return P.NUMBER;case 3:case"BOOLEAN":return P.BOOLEAN;case 4:case"LIST":return P.LIST;case 5:case"SELECTION":return P.SELECTION;case 6:case"GROUP":return P.GROUP;case 7:case"IMAGE":return P.IMAGE;case-1:case"UNRECOGNIZED":default:return P.UNRECOGNIZED}}function Lt(e){switch(e){case P.STRING:return 0;case P.PARAGRAPH:return 1;case P.NUMBER:return 2;case P.BOOLEAN:return 3;case P.LIST:return 4;case P.SELECTION:return 5;case P.GROUP:return 6;case P.IMAGE:return 7;case P.UNRECOGNIZED:default:return-1}}d();var re=G(W(),1);function qi(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}var V={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=re.default.Writer.create()){return e.fieldType!==0&&t.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&t.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&t.uint32(18).string(e.stringValue),e.numberValue!==void 0&&t.uint32(25).double(e.numberValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.listValue!==void 0&&ze.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Ke.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Xe.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=qi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.fieldType=n.int32();continue;case 100:if(r!==800)break;i.isSecret=n.bool();continue;case 2:if(r!==18)break;i.stringValue=n.string();continue;case 3:if(r!==25)break;i.numberValue=n.double();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.listValue=ze.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Ke.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=Xe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:xe(e.fieldType)?Vt(e.fieldType):0,isSecret:xe(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:xe(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:xe(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:xe(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:xe(e.listValue)?ze.fromJSON(e.listValue):void 0,selectionValue:xe(e.selectionValue)?Ke.fromJSON(e.selectionValue):void 0,groupValue:xe(e.groupValue)?Xe.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Lt(e.fieldType)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.listValue!==void 0&&(t.listValue=ze.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Ke.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=Xe.toJSON(e.groupValue)),t},create(e){return V.fromPartial(e??{})},fromPartial(e){let t=qi();return t.fieldType=e.fieldType??0,t.isSecret=e.isSecret??void 0,t.stringValue=e.stringValue??void 0,t.numberValue=e.numberValue??void 0,t.boolValue=e.boolValue??void 0,t.listValue=e.listValue!==void 0&&e.listValue!==null?ze.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Ke.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Xe.fromPartial(e.groupValue):void 0,t}};m.set(V.$type,V);function $i(){return{itemType:0,items:[]}}var ze={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=re.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)V.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$i();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(V.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:xe(e.itemType)?Vt(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>V.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Lt(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>V.toJSON(n))),t},create(e){return ze.fromPartial(e??{})},fromPartial(e){let t=$i();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>V.fromPartial(n))||[],t}};m.set(ze.$type,ze);function Gi(){return{values:[]}}var Ke={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=re.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Gi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return Ke.fromPartial(e??{})},fromPartial(e){let t=Gi();return t.values=e.values?.map(n=>n)||[],t}};m.set(Ke.$type,Ke);function Zi(){return{}}var Xe={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=re.default.Writer.create()){return t},decode(e,t){let n=e instanceof re.default.Reader?e:re.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Zi();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Xe.fromPartial(e??{})},fromPartial(e){return Zi()}};m.set(Xe.$type,Xe);function xe(e){return e!=null}function Hi(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var j={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=R.default.Writer.create()){return e.fieldId!==""&&t.uint32(10).string(e.fieldId),e.fieldType!==0&&t.uint32(16).int32(e.fieldType),e.label!==""&&t.uint32(26).string(e.label),e.helpText!==void 0&&t.uint32(34).string(e.helpText),e.defaultValue!==void 0&&V.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),e.required!==void 0&&t.uint32(48).bool(e.required),e.disabled!==void 0&&t.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&ie.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&t.uint32(72).bool(e.isSecret),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Hi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fieldId=n.string();continue;case 2:if(r!==16)break;i.fieldType=n.int32();continue;case 3:if(r!==26)break;i.label=n.string();continue;case 4:if(r!==34)break;i.helpText=n.string();continue;case 5:if(r!==42)break;i.defaultValue=V.decode(n,n.uint32());continue;case 6:if(r!==48)break;i.required=n.bool();continue;case 7:if(r!==56)break;i.disabled=n.bool();continue;case 8:if(r!==66)break;i.fieldConfig=ie.decode(n,n.uint32());continue;case 9:if(r!==72)break;i.isSecret=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldId:N(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:N(e.fieldType)?Vt(e.fieldType):0,label:N(e.label)?globalThis.String(e.label):"",helpText:N(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:N(e.defaultValue)?V.fromJSON(e.defaultValue):void 0,required:N(e.required)?globalThis.Boolean(e.required):void 0,disabled:N(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:N(e.fieldConfig)?ie.fromJSON(e.fieldConfig):void 0,isSecret:N(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Lt(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=V.toJSON(e.defaultValue)),e.required!==void 0&&(t.required=e.required),e.disabled!==void 0&&(t.disabled=e.disabled),e.fieldConfig!==void 0&&(t.fieldConfig=ie.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return j.fromPartial(e??{})},fromPartial(e){let t=Hi();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?V.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?ie.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};m.set(j.$type,j);function zi(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=R.default.Writer.create()){return e.stringConfig!==void 0&&Ye.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&Qe.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&je.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&et.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&tt.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&nt.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&it.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=zi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=Ye.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=Qe.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=je.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=et.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=tt.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=nt.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=it.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:N(e.stringConfig)?Ye.fromJSON(e.stringConfig):void 0,paragraphConfig:N(e.paragraphConfig)?Qe.fromJSON(e.paragraphConfig):void 0,numberConfig:N(e.numberConfig)?je.fromJSON(e.numberConfig):void 0,booleanConfig:N(e.booleanConfig)?et.fromJSON(e.booleanConfig):void 0,listConfig:N(e.listConfig)?tt.fromJSON(e.listConfig):void 0,selectionConfig:N(e.selectionConfig)?nt.fromJSON(e.selectionConfig):void 0,groupConfig:N(e.groupConfig)?it.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=Ye.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=Qe.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=je.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=et.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=tt.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=nt.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=it.toJSON(e.groupConfig)),t},create(e){return ie.fromPartial(e??{})},fromPartial(e){let t=zi();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Ye.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?Qe.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?je.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?et.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?tt.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?nt.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?it.fromPartial(e.groupConfig):void 0,t}};m.set(ie.$type,ie);function Ki(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Ye={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=R.default.Writer.create()){return e.minLength!==void 0&&t.uint32(8).int32(e.minLength),e.maxLength!==void 0&&t.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ki();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.minLength=n.int32();continue;case 2:if(r!==16)break;i.maxLength=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{minLength:N(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:N(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:N(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.minLength!==void 0&&(t.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(t.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return Ye.fromPartial(e??{})},fromPartial(e){let t=Ki();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};m.set(Ye.$type,Ye);function Xi(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Qe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=R.default.Writer.create()){return e.maxCharacters!==void 0&&t.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&t.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&t.uint32(26).string(e.placeholder),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Xi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.maxCharacters=n.int32();continue;case 2:if(r!==16)break;i.lineHeight=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{maxCharacters:N(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:N(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:N(e.placeholder)?globalThis.String(e.placeholder):void 0}},toJSON(e){let t={};return e.maxCharacters!==void 0&&(t.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(t.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(t.placeholder=e.placeholder),t},create(e){return Qe.fromPartial(e??{})},fromPartial(e){let t=Xi();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};m.set(Qe.$type,Qe);function Yi(){return{step:void 0,min:void 0,max:void 0}}var je={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=R.default.Writer.create()){return e.step!==void 0&&t.uint32(9).double(e.step),e.min!==void 0&&t.uint32(17).double(e.min),e.max!==void 0&&t.uint32(25).double(e.max),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yi();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==9)break;i.step=n.double();continue;case 2:if(r!==17)break;i.min=n.double();continue;case 3:if(r!==25)break;i.max=n.double();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{step:N(e.step)?globalThis.Number(e.step):void 0,min:N(e.min)?globalThis.Number(e.min):void 0,max:N(e.max)?globalThis.Number(e.max):void 0}},toJSON(e){let t={};return e.step!==void 0&&(t.step=e.step),e.min!==void 0&&(t.min=e.min),e.max!==void 0&&(t.max=e.max),t},create(e){return je.fromPartial(e??{})},fromPartial(e){let t=Yi();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};m.set(je.$type,je);function Qi(){return{}}var et={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=R.default.Writer.create()){return t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Qi();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return et.fromPartial(e??{})},fromPartial(e){return Qi()}};m.set(et.$type,et);function ji(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var tt={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=R.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&ie.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&t.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&t.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&t.uint32(42).string(e.entryLabel),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ji();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=ie.decode(n,n.uint32());continue;case 3:if(r!==24)break;i.minEntries=n.int32();continue;case 4:if(r!==32)break;i.maxEntries=n.int32();continue;case 5:if(r!==42)break;i.entryLabel=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:N(e.itemType)?Vt(e.itemType):0,itemConfig:N(e.itemConfig)?ie.fromJSON(e.itemConfig):void 0,minEntries:N(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:N(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:N(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Lt(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=ie.toJSON(e.itemConfig)),e.minEntries!==void 0&&(t.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(t.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(t.entryLabel=e.entryLabel),t},create(e){return tt.fromPartial(e??{})},fromPartial(e){let t=ji();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?ie.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};m.set(tt.$type,tt);function eo(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var nt={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=R.default.Writer.create()){for(let n of e.choices)rt.encode(n,t.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&t.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&t.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&t.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=eo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(rt.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>rt.fromJSON(t)):[],multiSelect:N(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:N(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:N(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:N(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>rt.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return nt.fromPartial(e??{})},fromPartial(e){let t=eo();return t.choices=e.choices?.map(n=>rt.fromPartial(n))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};m.set(nt.$type,nt);function to(){return{label:"",value:""}}var rt={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=R.default.Writer.create()){return e.label!==""&&t.uint32(10).string(e.label),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=to();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.label=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{label:N(e.label)?globalThis.String(e.label):"",value:N(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.label!==""&&(t.label=e.label),e.value!==""&&(t.value=e.value),t},create(e){return rt.fromPartial(e??{})},fromPartial(e){let t=to();return t.label=e.label??"",t.value=e.value??"",t}};m.set(rt.$type,rt);function no(){return{fields:[]}}var it={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=R.default.Writer.create()){for(let n of e.fields)j.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=no();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(j.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>j.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>j.toJSON(n))),t},create(e){return it.fromPartial(e??{})},fromPartial(e){let t=no();return t.fields=e.fields?.map(n=>j.fromPartial(n))||[],t}};m.set(it.$type,it);function N(e){return e!=null}function ro(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var Ve={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=en.default.Writer.create()){for(let n of e.fields)j.encode(n,t.uint32(10).fork()).ldelim();return e.title!==void 0&&t.uint32(18).string(e.title),e.shortDescription!==void 0&&t.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&t.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&t.uint32(42).string(e.cancelLabel),e.id!==void 0&&t.uint32(50).string(e.id),t},decode(e,t){let n=e instanceof en.default.Reader?e:en.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ro();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(j.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.title=n.string();continue;case 3:if(r!==26)break;i.shortDescription=n.string();continue;case 4:if(r!==34)break;i.acceptLabel=n.string();continue;case 5:if(r!==42)break;i.cancelLabel=n.string();continue;case 6:if(r!==50)break;i.id=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>j.fromJSON(t)):[],title:Ft(e.title)?globalThis.String(e.title):void 0,shortDescription:Ft(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:Ft(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:Ft(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:Ft(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>j.toJSON(n))),e.title!==void 0&&(t.title=e.title),e.shortDescription!==void 0&&(t.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(t.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(t.cancelLabel=e.cancelLabel),e.id!==void 0&&(t.id=e.id),t},create(e){return Ve.fromPartial(e??{})},fromPartial(e){let t=ro();return t.fields=e.fields?.map(n=>j.fromPartial(n))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};m.set(Ve.$type,Ve);function Ft(e){return e!=null}function io(){return{form:void 0}}var Wn={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode(e,t=oe.default.Writer.create()){return e.form!==void 0&&Ve.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=io();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=Ve.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:qt(e.form)?Ve.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=Ve.toJSON(e.form)),t},create(e){return Wn.fromPartial(e??{})},fromPartial(e){let t=io();return t.form=e.form!==void 0&&e.form!==null?Ve.fromPartial(e.form):void 0,t}};m.set(Wn.$type,Wn);function oo(){return{results:{},formId:void 0}}var Le={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode(e,t=oe.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{Wt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),e.formId!==void 0&&t.uint32(18).string(e.formId),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=oo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let u=Wt.decode(n,n.uint32());u.value!==void 0&&(i.results[u.key]=u.value);continue;case 2:if(r!==18)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{results:Ts(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=V.fromJSON(o),t),{}):{},formId:qt(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,i])=>{t.results[o]=V.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return Le.fromPartial(e??{})},fromPartial(e){let t=oo();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=V.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};m.set(Le.$type,Le);function so(){return{key:"",value:void 0}}var Wt={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=oe.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&V.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=so();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=V.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:qt(e.key)?globalThis.String(e.key):"",value:qt(e.value)?V.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=V.toJSON(e.value)),t},create(e){return Wt.fromPartial(e??{})},fromPartial(e){let t=so();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?V.fromPartial(e.value):void 0,t}};m.set(Wt.$type,Wt);function uo(){return{formId:void 0}}var Ae={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode(e,t=oe.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=uo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:qt(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return Ae.fromPartial(e??{})},fromPartial(e){let t=uo();return t.formId=e.formId??void 0,t}};m.set(Ae.$type,Ae);function Ts(e){return typeof e=="object"&&e!==null}function qt(e){return e!=null}d();var vt=G(W(),1);function ao(){return{}}var qn={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEffect",encode(e,t=vt.default.Writer.create()){return t},decode(e,t){let n=e instanceof vt.default.Reader?e:vt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ao();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return qn.fromPartial(e??{})},fromPartial(e){return ao()}};m.set(qn.$type,qn);function fo(){return{signedRequestContext:""}}var Pe={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEvent",encode(e,t=vt.default.Writer.create()){return e.signedRequestContext!==""&&t.uint32(10).string(e.signedRequestContext),t},decode(e,t){let n=e instanceof vt.default.Reader?e:vt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.signedRequestContext=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{signedRequestContext:_s(e.signedRequestContext)?globalThis.String(e.signedRequestContext):""}},toJSON(e){let t={};return e.signedRequestContext!==""&&(t.signedRequestContext=e.signedRequestContext),t},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let t=fo();return t.signedRequestContext=e.signedRequestContext??"",t}};m.set(Pe.$type,Pe);function _s(e){return e!=null}d();var Nt=G(W(),1);d();var yt=G(W(),1);d();var tn=G(W(),1);function lo(){return{}}var nn={$type:"google.protobuf.Empty",encode(e,t=tn.default.Writer.create()){return t},decode(e,t){let n=e instanceof tn.default.Reader?e:tn.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=lo();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return nn.fromPartial(e??{})},fromPartial(e){return lo()}};m.set(nn.$type,nn);function co(){return{channels:[]}}var $n={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=yt.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof yt.default.Reader?e:yt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=co();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channels.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.channels?.length&&(t.channels=e.channels),t},create(e){return $n.fromPartial(e??{})},fromPartial(e){let t=co();return t.channels=e.channels?.map(n=>n)||[],t}};m.set($n.$type,$n);function ho(){return{channel:"",data:void 0}}var Ue={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=yt.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&le.encode(le.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof yt.default.Reader?e:yt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ho();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channel=n.string();continue;case 2:if(r!==18)break;i.data=le.unwrap(le.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:Os(e.channel)?globalThis.String(e.channel):"",data:Rs(e.data)?e.data:void 0}},toJSON(e){let t={};return e.channel!==""&&(t.channel=e.channel),e.data!==void 0&&(t.data=e.data),t},create(e){return Ue.fromPartial(e??{})},fromPartial(e){let t=ho();return t.channel=e.channel??"",t.data=e.data??void 0,t}};m.set(Ue.$type,Ue);function Rs(e){return typeof e=="object"&&e!==null}function Os(e){return e!=null}var ot;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ot||(ot={}));function Is(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return ot.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return ot.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return ot.UNRECOGNIZED}}function Cs(e){switch(e){case ot.REALTIME_SUBSCRIBED:return 0;case ot.REALTIME_UNSUBSCRIBED:return 1;case ot.UNRECOGNIZED:default:return-1}}function po(){return{subscriptionIds:[]}}var Gn={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=Nt.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Nt.default.Reader?e:Nt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=po();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subscriptionIds.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return Gn.fromPartial(e??{})},fromPartial(e){let t=po();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};m.set(Gn.$type,Gn);function go(){return{event:void 0,status:void 0}}var Me={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=Nt.default.Writer.create()){return e.event!==void 0&&Ue.encode(e.event,t.uint32(10).fork()).ldelim(),e.status!==void 0&&t.uint32(16).int32(e.status),t},decode(e,t){let n=e instanceof Nt.default.Reader?e:Nt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=go();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=Ue.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:mo(e.event)?Ue.fromJSON(e.event):void 0,status:mo(e.status)?Is(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=Ue.toJSON(e.event)),e.status!==void 0&&(t.status=Cs(e.status)),t},create(e){return Me.fromPartial(e??{})},fromPartial(e){let t=go();return t.event=e.event!==void 0&&e.event!==null?Ue.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};m.set(Me.$type,Me);function mo(e){return e!=null}d();var rn=G(W(),1);var _e;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.INLINE_MODE=1]="INLINE_MODE",e[e.IMMERSIVE_MODE=2]="IMMERSIVE_MODE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(_e||(_e={}));function Hn(e){switch(e){case 0:case"UNSPECIFIED":return _e.UNSPECIFIED;case 1:case"INLINE_MODE":return _e.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return _e.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return _e.UNRECOGNIZED}}function zn(e){switch(e){case _e.UNSPECIFIED:return 0;case _e.INLINE_MODE:return 1;case _e.IMMERSIVE_MODE:return 2;case _e.UNRECOGNIZED:default:return-1}}function So(){return{immersiveMode:0,entryUrl:void 0}}var Zn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=rn.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),e.entryUrl!==void 0&&t.uint32(18).string(e.entryUrl),t},decode(e,t){let n=e instanceof rn.default.Reader?e:rn.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=So();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue;case 2:if(r!==18)break;i.entryUrl=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:Eo(e.immersiveMode)?Hn(e.immersiveMode):0,entryUrl:Eo(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=zn(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return Zn.fromPartial(e??{})},fromPartial(e){let t=So();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};m.set(Zn.$type,Zn);function Eo(e){return e!=null}d();var bt=G(W(),1);function vo(){return{}}var De={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotRequestEvent",encode(e,t=bt.default.Writer.create()){return t},decode(e,t){let n=e instanceof bt.default.Reader?e:bt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=vo();for(;n.pos<o;){let r=n.uint32();if(r>>>3,(r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return De.fromPartial(e??{})},fromPartial(e){return vo()}};m.set(De.$type,De);function yo(){return{dataUrl:void 0,error:void 0}}var Kn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewScreenshotResponseEffect",encode(e,t=bt.default.Writer.create()){return e.dataUrl!==void 0&&t.uint32(10).string(e.dataUrl),e.error!==void 0&&t.uint32(18).string(e.error),t},decode(e,t){let n=e instanceof bt.default.Reader?e:bt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=yo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.dataUrl=n.string();continue;case 2:if(r!==18)break;i.error=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{dataUrl:No(e.dataUrl)?globalThis.String(e.dataUrl):void 0,error:No(e.error)?globalThis.String(e.error):void 0}},toJSON(e){let t={};return e.dataUrl!==void 0&&(t.dataUrl=e.dataUrl),e.error!==void 0&&(t.error=e.error),t},create(e){return Kn.fromPartial(e??{})},fromPartial(e){let t=yo();return t.dataUrl=e.dataUrl??void 0,t.error=e.error??void 0,t}};m.set(Kn.$type,Kn);function No(e){return e!=null}var dt;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(dt||(dt={}));function ws(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return dt.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return dt.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return dt.UNRECOGNIZED}}function ks(e){switch(e){case dt.WEBVIEW_VISIBLE:return 0;case dt.WEBVIEW_HIDDEN:return 1;case dt.UNRECOGNIZED:default:return-1}}function bo(){return{message:void 0,jsonString:""}}var st={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=L.default.Writer.create()){return e.message!==void 0&&Z.encode(Z.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=bo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=Z.unwrap(Z.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.jsonString=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:F(e?.message)?e.message:void 0,jsonString:F(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let t={};return e.message!==void 0&&(t.message=e.message),e.jsonString!==""&&(t.jsonString=e.jsonString),t},create(e){return st.fromPartial(e??{})},fromPartial(e){let t=bo();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};m.set(st.$type,st);function To(){return{visibility:0}}var ut={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=L.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=To();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.visibility=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{visibility:F(e.visibility)?ws(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=ks(e.visibility)),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=To();return t.visibility=e.visibility??0,t}};m.set(ut.$type,ut);function _o(){return{postMessage:void 0,fullScreen:void 0}}var Xn={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=L.default.Writer.create()){return e.postMessage!==void 0&&st.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&ut.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_o();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=st.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=ut.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:F(e.postMessage)?st.fromJSON(e.postMessage):void 0,fullScreen:F(e.fullScreen)?ut.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=st.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=ut.toJSON(e.fullScreen)),t},create(e){return Xn.fromPartial(e??{})},fromPartial(e){let t=_o();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?st.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?ut.fromPartial(e.fullScreen):void 0,t}};m.set(Xn.$type,Xn);function Ro(){return{immersiveMode:0}}var at={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=L.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ro();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.immersiveMode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:F(e.immersiveMode)?Hn(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=zn(e.immersiveMode)),t},create(e){return at.fromPartial(e??{})},fromPartial(e){let t=Ro();return t.immersiveMode=e.immersiveMode??0,t}};m.set(at.$type,at);function Oo(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0,orderResult:void 0,updateRequestContext:void 0,screenshotRequest:void 0}}var Re={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=L.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&Ae.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&Le.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&Me.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&at.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&we.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),e.orderResult!==void 0&&ke.encode(e.orderResult,t.uint32(66).fork()).ldelim(),e.updateRequestContext!==void 0&&Pe.encode(e.updateRequestContext,t.uint32(74).fork()).ldelim(),e.screenshotRequest!==void 0&&De.encode(e.screenshotRequest,t.uint32(82).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Oo();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.formCanceled=Ae.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=Le.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=Me.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=at.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=we.decode(n,n.uint32());continue;case 8:if(r!==66)break;i.orderResult=ke.decode(n,n.uint32());continue;case 9:if(r!==74)break;i.updateRequestContext=Pe.decode(n,n.uint32());continue;case 10:if(r!==82)break;i.screenshotRequest=De.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:F(e.id)?globalThis.String(e.id):"",formCanceled:F(e.formCanceled)?Ae.fromJSON(e.formCanceled):void 0,formSubmitted:F(e.formSubmitted)?Le.fromJSON(e.formSubmitted):void 0,realtimeEvent:F(e.realtimeEvent)?Me.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:F(e.immersiveModeEvent)?at.fromJSON(e.immersiveModeEvent):void 0,consentStatus:F(e.consentStatus)?we.fromJSON(e.consentStatus):void 0,orderResult:F(e.orderResult)?ke.fromJSON(e.orderResult):void 0,updateRequestContext:F(e.updateRequestContext)?Pe.fromJSON(e.updateRequestContext):void 0,screenshotRequest:F(e.screenshotRequest)?De.fromJSON(e.screenshotRequest):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=Ae.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=Le.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=Me.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=at.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=we.toJSON(e.consentStatus)),e.orderResult!==void 0&&(t.orderResult=ke.toJSON(e.orderResult)),e.updateRequestContext!==void 0&&(t.updateRequestContext=Pe.toJSON(e.updateRequestContext)),e.screenshotRequest!==void 0&&(t.screenshotRequest=De.toJSON(e.screenshotRequest)),t},create(e){return Re.fromPartial(e??{})},fromPartial(e){let t=Oo();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?Ae.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?Le.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?Me.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?at.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?we.fromPartial(e.consentStatus):void 0,t.orderResult=e.orderResult!==void 0&&e.orderResult!==null?ke.fromPartial(e.orderResult):void 0,t.updateRequestContext=e.updateRequestContext!==void 0&&e.updateRequestContext!==null?Pe.fromPartial(e.updateRequestContext):void 0,t.screenshotRequest=e.screenshotRequest!==void 0&&e.screenshotRequest!==null?De.fromPartial(e.screenshotRequest):void 0,t}};m.set(Re.$type,Re);function Io(){return{data:void 0}}var Yn={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=L.default.Writer.create()){return e.data!==void 0&&ft.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Io();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.data=ft.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:F(e.data)?ft.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=ft.toJSON(e.data)),t},create(e){return Yn.fromPartial(e??{})},fromPartial(e){let t=Io();return t.data=e.data!==void 0&&e.data!==null?ft.fromPartial(e.data):void 0,t}};m.set(Yn.$type,Yn);function Co(){return{type:"",data:void 0}}var ft={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=L.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&Re.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof L.default.Reader?e:L.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Co();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.type=n.string();continue;case 2:if(r!==18)break;i.data=Re.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:F(e.type)?globalThis.String(e.type):"",data:F(e.data)?Re.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=Re.toJSON(e.data)),t},create(e){return ft.fromPartial(e??{})},fromPartial(e){let t=Co();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?Re.fromPartial(e.data):void 0,t}};m.set(ft.$type,ft);function F(e){return e!=null}var wo="devvit-internal",Be=(e,t)=>{let n={...e,realtimeEffect:e.realtime,id:t,scope:At.CLIENT,type:wo};(e.showToast||e.navigateToUrl)&&(n.effect=e),parent.postMessage(n,"*")},ko=e=>new Promise(t=>{let n={...e,realtimeEffect:e.realtime,scope:At.CLIENT,type:wo};(e.showForm||e.type===z.EFFECT_CAN_RUN_AS_USER)&&(n.effect=e);let o=crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let u=Re.fromJSON(r.data.data);t(u),removeEventListener("message",i)}};addEventListener("message",i),parent.postMessage(n,"*")});d();var Tt=class extends Error{};Tt.prototype.name="InvalidTokenError";function xs(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function Vs(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return xs(t)}catch{return atob(t)}}function Qn(e,t){if(typeof e!="string")throw new Tt("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Tt(`Invalid token specified: missing part #${n+1}`);let i;try{i=Vs(o)}catch(r){throw new Tt(`Invalid token specified: invalid base64 for part #${n+1} (${r.message})`)}try{return JSON.parse(i)}catch(r){throw new Tt(`Invalid token specified: invalid json for part #${n+1} (${r.message})`)}}function xo(e){if(e)try{return Qn(e)?.devvit}catch(t){throw Error("token decode failure",{cause:t})}}function Vo(){setInterval(Ls,6e4)}async function Ls(){let{exp:e}=Qn(globalThis.devvit.token);e&&e-Date.now()/1e3>300||await jn()}async function jn(){let e=await ko({type:z.EFFECT_UPDATE_REQUEST_CONTEXT,updateRequestContext:{}});if(!e?.updateRequestContext?.signedRequestContext){console.error("Failed to refresh token");return}Lo(e.updateRequestContext.signedRequestContext)}var Ao=(e,t,n)=>{let o=Us(n.name,t.hash),i=Ms(o),r=o?.appPermissionState;i?.name==="ANDROID"&&(i.version.yyyy<2026||i.version.yyyy===2026&&i.version.release<=5)&&(r=void 0);let u=xo(o.signedRequestContext),p;if(u?p=As(u,i,o.postData):o.webViewContext&&(p=Ps(o.webViewContext,i,o.postData)),!p)throw Error("no context");let f=o.webViewClientData;globalThis.devvit={context:p,dependencies:{client:dr(e),webViewScripts:v},entrypoints:f?.appConfig?.entrypoints??{},share:o?.shareParam?{userData:o?.shareParam.userData}:void 0,adPayload:o?.adPayload,appPermissionState:r,token:o.signedRequestContext||o.webbitToken,webViewMode:o?.viewMode,startTime:o?.startTime??void 0,refreshToken:jn}};function Po(e){devvit.webViewMode=e}function Lo(e){globalThis.devvit.token=e}function As(e,t,n){if(!e.app)throw Error("no RequestContext.app");if(!e.post)throw Error("no RequestContext.post");if(!e.subreddit)throw Error("no RequestContext.subreddit");return{appName:e.app.name,appSlug:e.app.slug,appVersion:e.app.version,client:t,commentId:void 0,loid:e.user?.devvitLoid??e.user?.devvit_loid,postAuthorId:Ht(e.post.author),postData:n?.developerData,postId:dn(e.post.id),snoovatar:e.user?.snoovatar,subredditId:ln(e.subreddit.id),subredditName:e.subreddit.name,userId:e.user?.id?Ht(e.user.id):void 0,username:e.user?.name}}function Ps(e,t,n){return{appName:e.appName,appSlug:e.appName,appVersion:e.appVersion,client:t,commentId:void 0,loid:void 0,postData:n?.developerData,postAuthorId:void 0,postId:dn(e.postId),snoovatar:void 0,subredditId:ln(e.subredditId),subredditName:e.subredditName,userId:e.userId?Ht(e.userId):void 0,username:void 0}}function Us(e,t){if(e)return JSON.parse(e);let n=t?.slice(1);if(!n)throw Error("no bridge context");return JSON.parse(decodeURIComponent(n))}function Ms(e){if(!(e.client!==It.ANDROID&&e.client!==It.IOS||!e.nativeVersion))return{name:e.client===It.ANDROID?"ANDROID":"IOS",version:e.nativeVersion}}d();async function Ds(e,t,n,o,i){let r=new Request(o,i);return Bs(n,new URL(r.url))&&r.headers.set("Authorization",`Bearer ${e.token}`),await t(r)}function Uo(){globalThis.fetch=Ds.bind(void 0,globalThis.devvit,globalThis.fetch,location)}function Bs(e,t){return t.origin===e.origin}d();var Js=new URL(fn,fr).toString();function Fs(e){let t=e?.trim();if(t)try{let n=new URL(t);if(n.pathname.endsWith(`/${an}`))return new URL(fn,n).toString()}catch{}return Js}async function Ws(e,t){let n=e.data;if(n?.type!=="devvit-message"||n.data==null)return;let o=n.data;if(o.screenshotRequest==null||typeof o.id!="string")return;let i,r;try{let u=Fs(t),{captureScreenshot:p}=await import(u);i=await p()}catch(u){r=u instanceof Error?u.message:String(u)}Be({type:z.EFFECT_SCREENSHOT_RESPONSE,screenshot:{dataUrl:i,error:r}},o.id)}function Mo(e){addEventListener("message",t=>{Ws(t,e)})}d();d();function Do(e){let t=qs(e.target,e.isTrusted);Be({type:z.EFFECT_TELEMETRY,telemetry:{event:t.event,click:t},analytics:t})}function qs(e,t){let{definition:n,elemTrackId:o}=$s(e,t);return{event:"click",definition:n,elemTrackId:o}}function $s(e,t){let n=Gs(e);if(!n)return{definition:"default",elemTrackId:void 0};let o="default";t&&globalThis.window.getComputedStyle(n)?.getPropertyValue("cursor")==="pointer"&&(o="strict");let i,r=n;for(;r;){if(i===void 0){let u=r.getAttribute("data-track-id");u?i=u:r.id&&(i=r.id)}if(t&&o==="default"&&Zs(r)&&(o="strict"),i!==void 0&&(!t||o==="strict"))break;r=r.parentElement}return{definition:o,elemTrackId:i}}function Gs(e){if(!e||typeof e!="object"||!("nodeType"in e))return;let t=e;return t.nodeType===1?t:t.parentElement??void 0}function Zs(e){return["A","BUTTON","CANVAS","INPUT","SELECT","TEXTAREA","LABEL"].includes(e.tagName)||["true","plaintext-only"].includes(e.getAttribute("contenteditable")??"")}var Oe,se,$t=!1;function Fo(){eu(),Hs(),zs()}function Hs(){addEventListener("load",()=>{let e=performance.timeOrigin,t=performance.now(),n=performance.timeOrigin+t,o={event:"web-view-loaded",timeStart:e,timeEnd:n,duration:t};Be({type:z.EFFECT_TELEMETRY,telemetry:{event:o.event,loaded:o},analytics:o})})}function zs(){document.addEventListener("click",e=>{Do(e)},{passive:!0})}function on(){return performance.getEntriesByType("navigation")[0]}function Bo(){let e=on();if(!(!se||!e))return{spanName:"web_view_time_to_first_byte",timeStart:se+e.requestStart,timeEnd:se+e.responseStart}}function er(e,t){return se?[{spanName:e,timeStart:se,timeEnd:se+t},{spanName:`${e}_v2`,timeStart:performance.timeOrigin,timeEnd:performance.timeOrigin+t}]:[]}function Ks(){if(se)return{spanName:"web_view_initialization",timeStart:se,timeEnd:performance.timeOrigin}}function Wo(){let e=on(),t=performance.getEntriesByType("paint").find(o=>o.name==="first-contentful-paint")?.startTime,n=Qs(e);if(!(t==null||n==null||!e||e.responseStart<=0))return{spanName:"web_view_render_duration",timeStart:performance.timeOrigin+e.responseStart,timeEnd:performance.timeOrigin+Math.max(t,n)}}function Xs(){let t=performance.getEntriesByType("paint").find(n=>n.name==="first-contentful-paint");return!t||!se?[]:er("web_view_first_contentful_paint",t.startTime)}function Ys(){return se?er("web_view_load",performance.now()):[]}function Qs(e=on()){return e&&e.loadEventEnd>0?e.loadEventEnd:void 0}function js(){if($t)return;let e=Wo();e&&($t=!0,Be({type:z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:[e]}}}))}function Jo(){let t=on().domInteractive;return!se||!t?[]:er("web_view_time_to_interactive",t)}function eu(){if(Oe=[],se=globalThis.devvit?.startTime,$t=!1,!se)return;let e=Ks();if(e&&Oe.push(e),document.readyState==="complete"){let o=Bo();o&&Oe.push(o)}let t=new PerformanceObserver(o=>{for(let i of o.getEntries())if(i.name==="first-contentful-paint"){let r=Xs();if(t.disconnect(),r.length===0)break;let u=$t?void 0:Wo();u&&($t=!0),document.readyState==="complete"?Be({type:z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:u?[...r,u]:r}}}):(Oe.push(...r),u&&Oe.push(u));break}});t.observe({type:"paint",buffered:!0});let n=new PerformanceObserver(o=>{o.getEntries().find(r=>r.entryType==="navigation")&&(n.disconnect(),js())});n.observe({type:"navigation",buffered:!0}),document.readyState==="loading"?globalThis.addEventListener("DOMContentLoaded",()=>{Oe.push(...Jo())}):Oe.push(...Jo()),globalThis.addEventListener("load",()=>{let o=Bo();o&&Oe.push(o),Oe.push(...Ys()),Be({type:z.EFFECT_TELEMETRY,telemetry:{metrics:{metrics:Oe}}})})}d();function qo(){addEventListener("message",tu)}function tu(e){e.data?.type==="devvit-message"&&e.data?.data?.immersiveModeEvent&&Po(e.data.data.immersiveModeEvent.immersiveMode)}Ao(document,location,window);Fo();Uo();Mo(lr(document)??"");Vo();qo();})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
long/umd/index.js:
|