@devvit/client 0.12.10-next-2026-01-22-22-08-59-4328e6a29.0 → 0.12.10

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/client.min.js DELETED
@@ -1,25 +0,0 @@
1
- var Bi=Object.create;var Nn=Object.defineProperty;var Fi=Object.getOwnPropertyDescriptor;var Di=Object.getOwnPropertyNames;var Ji=Object.getPrototypeOf,Wi=Object.prototype.hasOwnProperty;var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Gi=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Di(t))!Wi.call(e,i)&&i!==n&&Nn(e,i,{get:()=>t[i],enumerable:!(o=Fi(t,i))||o.enumerable});return e};var P=(e,t,n)=>(n=e!=null?Bi(Ji(e)):{},Gi(t||!e||!e.__esModule?Nn(n,"default",{value:e,enumerable:!0}):n,e));var vn=C((wo,yn)=>{"use strict";yn.exports=qi;function qi(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(d,a){n[o]=function(c){if(r)if(r=!1,c)a(c);else{for(var v=new Array(arguments.length-1),y=0;y<v.length;)v[y++]=arguments[y];d.apply(null,v)}};try{e.apply(t||null,n)}catch(s){r&&(r=!1,a(s))}})}});var _n=C(In=>{"use strict";var gt=In;gt.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 tt=new Array(64),On=new Array(123);for(X=0;X<64;)On[tt[X]=X<26?X+65:X<52?X+71:X<62?X-4:X-59|43]=X++;var X;gt.encode=function(t,n,o){for(var i=null,r=[],u=0,d=0,a;n<o;){var s=t[n++];switch(d){case 0:r[u++]=tt[s>>2],a=(s&3)<<4,d=1;break;case 1:r[u++]=tt[a|s>>4],a=(s&15)<<2,d=2;break;case 2:r[u++]=tt[a|s>>6],r[u++]=tt[s&63],d=0;break}u>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),u=0)}return d&&(r[u++]=tt[a],r[u++]=61,d===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 Tn="invalid encoding";gt.decode=function(t,n,o){for(var i=o,r=0,u,d=0;d<t.length;){var a=t.charCodeAt(d++);if(a===61&&r>1)break;if((a=On[a])===void 0)throw Error(Tn);switch(r){case 0:u=a,r=1;break;case 1:n[o++]=u<<2|(a&48)>>4,u=a,r=2;break;case 2:n[o++]=(u&15)<<4|(a&60)>>2,u=a,r=3;break;case 3:n[o++]=(u&3)<<6|a,r=0;break}}if(r===1)throw Error(Tn);return o-i};gt.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Cn=C((Mo,Rn)=>{"use strict";Rn.exports=St;function St(){this._listeners={}}St.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};St.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var o=this._listeners[t],i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i;return this};St.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 Pn=C((Bo,Un)=>{"use strict";Un.exports=bn(bn);function bn(e){return typeof Float32Array<"u"?(function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(a,s,c){t[0]=a,s[c]=n[0],s[c+1]=n[1],s[c+2]=n[2],s[c+3]=n[3]}function r(a,s,c){t[0]=a,s[c]=n[3],s[c+1]=n[2],s[c+2]=n[1],s[c+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function u(a,s){return n[0]=a[s],n[1]=a[s+1],n[2]=a[s+2],n[3]=a[s+3],t[0]}function d(a,s){return n[3]=a[s],n[2]=a[s+1],n[1]=a[s+2],n[0]=a[s+3],t[0]}e.readFloatLE=o?u:d,e.readFloatBE=o?d:u})():(function(){function t(o,i,r,u){var d=i<0?1:0;if(d&&(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((d<<31|2139095040)>>>0,r,u);else if(i<11754943508222875e-54)o((d<<31|Math.round(i/1401298464324817e-60))>>>0,r,u);else{var a=Math.floor(Math.log(i)/Math.LN2),s=Math.round(i*Math.pow(2,-a)*8388608)&8388607;o((d<<31|a+127<<23|s)>>>0,r,u)}}e.writeFloatLE=t.bind(null,xn),e.writeFloatBE=t.bind(null,kn);function n(o,i,r){var u=o(i,r),d=(u>>31)*2+1,a=u>>>23&255,s=u&8388607;return a===255?s?NaN:d*(1/0):a===0?d*1401298464324817e-60*s:d*Math.pow(2,a-150)*(s+8388608)}e.readFloatLE=n.bind(null,An),e.readFloatBE=n.bind(null,Vn)})(),typeof Float64Array<"u"?(function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(a,s,c){t[0]=a,s[c]=n[0],s[c+1]=n[1],s[c+2]=n[2],s[c+3]=n[3],s[c+4]=n[4],s[c+5]=n[5],s[c+6]=n[6],s[c+7]=n[7]}function r(a,s,c){t[0]=a,s[c]=n[7],s[c+1]=n[6],s[c+2]=n[5],s[c+3]=n[4],s[c+4]=n[3],s[c+5]=n[2],s[c+6]=n[1],s[c+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function u(a,s){return n[0]=a[s],n[1]=a[s+1],n[2]=a[s+2],n[3]=a[s+3],n[4]=a[s+4],n[5]=a[s+5],n[6]=a[s+6],n[7]=a[s+7],t[0]}function d(a,s){return n[7]=a[s],n[6]=a[s+1],n[5]=a[s+2],n[4]=a[s+3],n[3]=a[s+4],n[2]=a[s+5],n[1]=a[s+6],n[0]=a[s+7],t[0]}e.readDoubleLE=o?u:d,e.readDoubleBE=o?d:u})():(function(){function t(o,i,r,u,d,a){var s=u<0?1:0;if(s&&(u=-u),u===0)o(0,d,a+i),o(1/u>0?0:2147483648,d,a+r);else if(isNaN(u))o(0,d,a+i),o(2146959360,d,a+r);else if(u>17976931348623157e292)o(0,d,a+i),o((s<<31|2146435072)>>>0,d,a+r);else{var c;if(u<22250738585072014e-324)c=u/5e-324,o(c>>>0,d,a+i),o((s<<31|c/4294967296)>>>0,d,a+r);else{var v=Math.floor(Math.log(u)/Math.LN2);v===1024&&(v=1023),c=u*Math.pow(2,-v),o(c*4503599627370496>>>0,d,a+i),o((s<<31|v+1023<<20|c*1048576&1048575)>>>0,d,a+r)}}}e.writeDoubleLE=t.bind(null,xn,0,4),e.writeDoubleBE=t.bind(null,kn,4,0);function n(o,i,r,u,d){var a=o(u,d+i),s=o(u,d+r),c=(s>>31)*2+1,v=s>>>20&2047,y=4294967296*(s&1048575)+a;return v===2047?y?NaN:c*(1/0):v===0?c*5e-324*y:c*Math.pow(2,v-1075)*(y+4503599627370496)}e.readDoubleLE=n.bind(null,An,0,4),e.readDoubleBE=n.bind(null,Vn,4,0)})(),e}function xn(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 kn(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 An(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Vn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var wn=C((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}});var Mn=C(Ln=>{"use strict";var Ct=Ln;Ct.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};Ct.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,u=[],d=0,a;n<o;)a=t[n++],a<128?u[d++]=a:a>191&&a<224?u[d++]=(a&31)<<6|t[n++]&63:a>239&&a<365?(a=((a&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,u[d++]=55296+(a>>10),u[d++]=56320+(a&1023)):u[d++]=(a&15)<<12|(t[n++]&63)<<6|t[n++]&63,d>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,u)),d=0);return r?(d&&r.push(String.fromCharCode.apply(String,u.slice(0,d))),r.join("")):String.fromCharCode.apply(String,u.slice(0,d))};Ct.write=function(t,n,o){for(var i=o,r,u,d=0;d<t.length;++d)r=t.charCodeAt(d),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((u=t.charCodeAt(d+1))&64512)===56320?(r=65536+((r&1023)<<10)+(u&1023),++d,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 Fn=C((Do,Bn)=>{"use strict";Bn.exports=$i;function $i(e,t,n){var o=n||8192,i=o>>>1,r=null,u=o;return function(a){if(a<1||a>i)return e(a);u+a>o&&(r=e(o),u=0);var s=t.call(r,u,u+=a);return u&7&&(u=(u|7)+1),s}}});var Jn=C((Jo,Dn)=>{"use strict";Dn.exports=b;var at=Ne();function b(e,t){this.lo=e>>>0,this.hi=t>>>0}var qe=b.zero=new b(0,0);qe.toNumber=function(){return 0};qe.zzEncode=qe.zzDecode=function(){return this};qe.length=function(){return 1};var Zi=b.zeroHash="\0\0\0\0\0\0\0\0";b.fromNumber=function(t){if(t===0)return qe;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(at.isString(t))if(at.Long)t=at.Long.fromString(t);else return b.fromNumber(parseInt(t,10));return t.low||t.high?new b(t.low>>>0,t.high>>>0):qe};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 at.Long?new at.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Se=String.prototype.charCodeAt;b.fromHash=function(t){return t===Zi?qe:new b((Se.call(t,0)|Se.call(t,1)<<8|Se.call(t,2)<<16|Se.call(t,3)<<24)>>>0,(Se.call(t,4)|Se.call(t,5)<<8|Se.call(t,6)<<16|Se.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 Ne=C(bt=>{"use strict";var p=bt;p.asPromise=vn();p.base64=_n();p.EventEmitter=Cn();p.float=Pn();p.inquire=wn();p.utf8=Mn();p.pool=Fn();p.LongBits=Jn();p.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);p.global=p.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||bt;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};p.isString=function(t){return typeof t=="string"||t instanceof String};p.isObject=function(t){return t&&typeof t=="object"};p.isset=p.isSet=function(t,n){var o=t[n];return o!=null&&t.hasOwnProperty(n)?typeof o!="object"||(Array.isArray(o)?o.length:Object.keys(o).length)>0:!1};p.Buffer=(function(){try{var e=p.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}})();p._Buffer_from=null;p._Buffer_allocUnsafe=null;p.newBuffer=function(t){return typeof t=="number"?p.Buffer?p._Buffer_allocUnsafe(t):new p.Array(t):p.Buffer?p._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};p.Array=typeof Uint8Array<"u"?Uint8Array:Array;p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||p.inquire("long");p.key2Re=/^true|false|0|1$/;p.key32Re=/^-?(?:0|[1-9][0-9]*)$/;p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;p.longToHash=function(t){return t?p.LongBits.from(t).toHash():p.LongBits.zeroHash};p.longFromHash=function(t,n){var o=p.LongBits.fromHash(t);return p.Long?p.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function Wn(e,t,n){for(var o=Object.keys(t),i=0;i<o.length;++i)(e[o[i]]===void 0||!n)&&(e[o[i]]=t[o[i]]);return e}p.merge=Wn;p.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Gn(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&&Wn(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}p.newError=Gn;p.ProtocolError=Gn("ProtocolError");p.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]}};p.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};p._configure=function(){var e=p.Buffer;if(!e){p._Buffer_from=p._Buffer_allocUnsafe=null;return}p._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var wt=C((Go,Hn)=>{"use strict";Hn.exports=m;var q=Ne(),xt,Nt=q.LongBits,qn=q.base64,$n=q.utf8;function st(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function At(){}function Hi(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function m(){this.len=0,this.head=new st(At,0,0),this.tail=this.head,this.states=null}var Zn=function(){return q.Buffer?function(){return(m.create=function(){return new xt})()}:function(){return new m}};m.create=Zn();m.alloc=function(t){return new q.Array(t)};q.Array!==Array&&(m.alloc=q.pool(m.alloc,q.Array.prototype.subarray));m.prototype._push=function(t,n,o){return this.tail=this.tail.next=new st(t,n,o),this.len+=n,this};function Vt(e,t,n){t[n]=e&255}function Ki(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Ut(e,t){this.len=e,this.next=void 0,this.val=t}Ut.prototype=Object.create(st.prototype);Ut.prototype.fn=Ki;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Ut((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};m.prototype.int32=function(t){return t<0?this._push(Pt,10,Nt.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Pt(e,t,n){for(;e.hi;)t[n++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=e.lo&127|128,e.lo=e.lo>>>7;t[n++]=e.lo}m.prototype.uint64=function(t){var n=Nt.from(t);return this._push(Pt,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=Nt.from(t).zzEncode();return this._push(Pt,n.length(),n)};m.prototype.bool=function(t){return this._push(Vt,1,t?1:0)};function kt(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}m.prototype.fixed32=function(t){return this._push(kt,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=Nt.from(t);return this._push(kt,4,n.lo)._push(kt,4,n.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(t){return this._push(q.float.writeFloatLE,4,t)};m.prototype.double=function(t){return this._push(q.float.writeDoubleLE,8,t)};var zi=q.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]};m.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(Vt,1,0);if(q.isString(t)){var o=m.alloc(n=qn.length(t));qn.decode(t,o,0),t=o}return this.uint32(n)._push(zi,n,t)};m.prototype.string=function(t){var n=$n.length(t);return n?this.uint32(n)._push($n.write,n,t):this._push(Vt,1,0)};m.prototype.fork=function(){return this.states=new Hi(this),this.head=this.tail=new st(At,0,0),this.len=0,this};m.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 st(At,0,0),this.len=0),this};m.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};m.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};m._configure=function(e){xt=e,m.create=Zn(),xt._configure()}});var Yn=C((qo,zn)=>{"use strict";zn.exports=ne;var Kn=wt();(ne.prototype=Object.create(Kn.prototype)).constructor=ne;var ye=Ne();function ne(){Kn.call(this)}ne._configure=function(){ne.alloc=ye._Buffer_allocUnsafe,ne.writeBytesBuffer=ye.Buffer&&ye.Buffer.prototype instanceof Uint8Array&&ye.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++]}};ne.prototype.bytes=function(t){ye.isString(t)&&(t=ye._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(ne.writeBytesBuffer,n,t),this};function Yi(e,t,n){e.length<40?ye.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}ne.prototype.string=function(t){var n=ye.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Yi,n,t),this};ne._configure()});var Bt=C(($o,tr)=>{"use strict";tr.exports=_;var Q=Ne(),Mt,jn=Q.LongBits,Xi=Q.utf8;function j(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function _(e){this.buf=e,this.pos=0,this.len=e.length}var Xn=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new _(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new _(t);throw Error("illegal buffer")},er=function(){return Q.Buffer?function(n){return(_.create=function(i){return Q.Buffer.isBuffer(i)?new Mt(i):Xn(i)})(n)}:Xn};_.create=er();_.prototype._slice=Q.Array.prototype.subarray||Q.Array.prototype.slice;_.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,j(this,10);return t}})();_.prototype.int32=function(){return this.uint32()|0};_.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Lt(){var e=new jn(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 j(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 j(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")}_.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}_.prototype.fixed32=function(){if(this.pos+4>this.len)throw j(this,4);return yt(this.buf,this.pos+=4)};_.prototype.sfixed32=function(){if(this.pos+4>this.len)throw j(this,4);return yt(this.buf,this.pos+=4)|0};function Qn(){if(this.pos+8>this.len)throw j(this,8);return new jn(yt(this.buf,this.pos+=4),yt(this.buf,this.pos+=4))}_.prototype.float=function(){if(this.pos+4>this.len)throw j(this,4);var t=Q.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};_.prototype.double=function(){if(this.pos+8>this.len)throw j(this,4);var t=Q.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};_.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw j(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=Q.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};_.prototype.string=function(){var t=this.bytes();return Xi.read(t,0,t.length)};_.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw j(this,t);this.pos+=t}else do if(this.pos>=this.len)throw j(this);while(this.buf[this.pos++]&128);return this};_.prototype.skipType=function(e){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);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};_._configure=function(e){Mt=e,_.create=er(),Mt._configure();var t=Q.Long?"toLong":"toNumber";Q.merge(_.prototype,{int64:function(){return Lt.call(this)[t](!1)},uint64:function(){return Lt.call(this)[t](!0)},sint64:function(){return Lt.call(this).zzDecode()[t](!1)},fixed64:function(){return Qn.call(this)[t](!0)},sfixed64:function(){return Qn.call(this)[t](!1)}})}});var or=C((Zo,ir)=>{"use strict";ir.exports=$e;var rr=Bt();($e.prototype=Object.create(rr.prototype)).constructor=$e;var nr=Ne();function $e(e){rr.call(this,e)}$e._configure=function(){nr.Buffer&&($e.prototype._slice=nr.Buffer.prototype.slice)};$e.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))};$e._configure()});var ar=C((Ho,ur)=>{"use strict";ur.exports=ft;var Ft=Ne();(ft.prototype=Object.create(Ft.EventEmitter.prototype)).constructor=ft;function ft(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Ft.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}ft.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var u=this;if(!r)return Ft.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(a,s){if(a)return u.emit("error",a,t),r(a);if(s===null){u.end(!0);return}if(!(s instanceof o))try{s=o[u.responseDelimited?"decodeDelimited":"decode"](s)}catch(c){return u.emit("error",c,t),r(c)}return u.emit("data",s,t),r(null,s)})}catch(d){u.emit("error",d,t),setTimeout(function(){r(d)},0);return}};ft.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var fr=C(sr=>{"use strict";var Qi=sr;Qi.Service=ar()});var lr=C((zo,dr)=>{"use strict";dr.exports={}});var hr=C(pr=>{"use strict";var w=pr;w.build="minimal";w.Writer=wt();w.BufferWriter=Yn();w.Reader=Bt();w.BufferReader=or();w.util=Ne();w.rpc=fr();w.roots=lr();w.configure=cr;function cr(){w.util._configure(),w.Writer._configure(w.BufferWriter),w.Reader._configure(w.BufferReader)}cr()});var A=C((Xo,mr)=>{"use strict";mr.exports=hr()});var Ao=globalThis.devvit?.context;var Ge;(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.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ge||(Ge={}));var Et;(function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Et||(Et={}));var O=P(A(),1);var F=P(A(),1);var l=new Map;var He;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(He||(He={}));function ji(e){switch(e){case 0:case"NULL_VALUE":return He.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return He.UNRECOGNIZED}}function eo(e){switch(e){case He.NULL_VALUE:return 0;case He.UNRECOGNIZED:default:return-1}}function Dt(){return{fields:{}}}var $={$type:"google.protobuf.Struct",encode(e,t=F.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&dt.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Dt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let u=dt.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:gr(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 $.fromPartial(e??{})},fromPartial(e){let t=Dt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=Dt();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}};l.set($.$type,$);function Er(){return{key:"",value:void 0}}var dt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=F.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&V.encode(V.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Er();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.unwrap(V.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:nt(e.key)?globalThis.String(e.key):"",value:nt(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 dt.fromPartial(e??{})},fromPartial(e){let t=Er();return t.key=e.key??"",t.value=e.value??void 0,t}};l.set(dt.$type,dt);function Jt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var V={$type:"google.protobuf.Value",encode(e,t=F.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&&$.encode($.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&Ze.encode(Ze.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Jt();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=$.unwrap($.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=Ze.unwrap(Ze.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:nt(e.nullValue)?ji(e.nullValue):void 0,numberValue:nt(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:nt(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:nt(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:gr(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=eo(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 V.fromPartial(e??{})},fromPartial(e){let t=Jt();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=Jt();if(e===null)t.nullValue=He.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}};l.set(V.$type,V);function Wt(){return{values:[]}}var Ze={$type:"google.protobuf.ListValue",encode(e,t=F.default.Writer.create()){for(let n of e.values)V.encode(V.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(V.unwrap(V.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 Ze.fromPartial(e??{})},fromPartial(e){let t=Wt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=Wt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};l.set(Ze.$type,Ze);function gr(e){return typeof e=="object"&&e!==null}function nt(e){return e!=null}var Xe=P(A(),1);var N=P(A(),1);var Z=null;try{Z=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 S(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}S.prototype.__isLong__;Object.defineProperty(S.prototype,"__isLong__",{value:!0});function U(e){return(e&&e.__isLong__)===!0}function Sr(e){var t=Math.clz32(e&-e);return e?31-t:t}S.isLong=U;var Nr={},yr={};function Ke(e,t){var n,o,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(o=yr[e],o)?o:(n=E(e,0,!0),i&&(yr[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(o=Nr[e],o)?o:(n=E(e,e<0?-1:0,!1),i&&(Nr[e]=n),n))}S.fromInt=Ke;function H(e,t){if(isNaN(e))return t?se:ee;if(t){if(e<0)return se;if(e>=Ir)return Cr}else{if(e<=-Tr)return L;if(e+1>=Tr)return Rr}return e<0?H(-e,t).neg():E(e%it|0,e/it|0,t)}S.fromNumber=H;function E(e,t,n){return new S(e,t,n)}S.fromBits=E;var vt=Math.pow;function qt(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?se: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 qt(e.substring(1),t,n).neg();for(var i=H(vt(n,8)),r=ee,u=0;u<e.length;u+=8){var d=Math.min(8,e.length-u),a=parseInt(e.substring(u,u+d),n);if(d<8){var s=H(vt(n,d));r=r.mul(s).add(H(a))}else r=r.mul(i),r=r.add(H(a))}return r.unsigned=t,r}S.fromString=qt;function K(e,t){return typeof e=="number"?H(e,t):typeof e=="string"?qt(e,t):E(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}S.fromValue=K;var vr=65536,to=1<<24,it=vr*vr,Ir=it*it,Tr=Ir/2,Or=Ke(to),ee=Ke(0);S.ZERO=ee;var se=Ke(0,!0);S.UZERO=se;var rt=Ke(1);S.ONE=rt;var _r=Ke(1,!0);S.UONE=_r;var Gt=Ke(-1);S.NEG_ONE=Gt;var Rr=E(-1,2147483647,!1);S.MAX_VALUE=Rr;var Cr=E(-1,-1,!0);S.MAX_UNSIGNED_VALUE=Cr;var L=E(0,-2147483648,!1);S.MIN_VALUE=L;var f=S.prototype;f.toInt=function(){return this.unsigned?this.low>>>0:this.low};f.toNumber=function(){return this.unsigned?(this.high>>>0)*it+(this.low>>>0):this.high*it+(this.low>>>0)};f.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(L)){var n=H(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=H(vt(t,6),this.unsigned),u=this,d="";;){var a=u.div(r),s=u.sub(a.mul(r)).toInt()>>>0,c=s.toString(t);if(u=a,u.isZero())return c+d;for(;c.length<6;)c="0"+c;d=""+c+d}};f.getHighBits=function(){return this.high};f.getHighBitsUnsigned=function(){return this.high>>>0};f.getLowBits=function(){return this.low};f.getLowBitsUnsigned=function(){return this.low>>>0};f.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?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};f.isSafeInteger=function(){var t=this.high>>21;return t?this.unsigned?!1:t===-1&&!(this.low===0&&this.high===-2097152):!0};f.isZero=function(){return this.high===0&&this.low===0};f.eqz=f.isZero;f.isNegative=function(){return!this.unsigned&&this.high<0};f.isPositive=function(){return this.unsigned||this.high>=0};f.isOdd=function(){return(this.low&1)===1};f.isEven=function(){return(this.low&1)===0};f.equals=function(t){return U(t)||(t=K(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};f.eq=f.equals;f.notEquals=function(t){return!this.eq(t)};f.neq=f.notEquals;f.ne=f.notEquals;f.lessThan=function(t){return this.comp(t)<0};f.lt=f.lessThan;f.lessThanOrEqual=function(t){return this.comp(t)<=0};f.lte=f.lessThanOrEqual;f.le=f.lessThanOrEqual;f.greaterThan=function(t){return this.comp(t)>0};f.gt=f.greaterThan;f.greaterThanOrEqual=function(t){return this.comp(t)>=0};f.gte=f.greaterThanOrEqual;f.ge=f.greaterThanOrEqual;f.compare=function(t){if(U(t)||(t=K(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};f.comp=f.compare;f.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(rt)};f.neg=f.negate;f.add=function(t){U(t)||(t=K(t));var n=this.high>>>16,o=this.high&65535,i=this.low>>>16,r=this.low&65535,u=t.high>>>16,d=t.high&65535,a=t.low>>>16,s=t.low&65535,c=0,v=0,y=0,B=0;return B+=r+s,y+=B>>>16,B&=65535,y+=i+a,v+=y>>>16,y&=65535,v+=o+d,c+=v>>>16,v&=65535,c+=n+u,c&=65535,E(y<<16|B,c<<16|v,this.unsigned)};f.subtract=function(t){return U(t)||(t=K(t)),this.add(t.neg())};f.sub=f.subtract;f.multiply=function(t){if(this.isZero())return this;if(U(t)||(t=K(t)),Z){var n=Z.mul(this.low,this.high,t.low,t.high);return E(n,Z.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?se:ee;if(this.eq(L))return t.isOdd()?L:ee;if(t.eq(L))return this.isOdd()?L: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(Or)&&t.lt(Or))return H(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,i=this.high&65535,r=this.low>>>16,u=this.low&65535,d=t.high>>>16,a=t.high&65535,s=t.low>>>16,c=t.low&65535,v=0,y=0,B=0,mt=0;return mt+=u*c,B+=mt>>>16,mt&=65535,B+=r*c,y+=B>>>16,B&=65535,B+=u*s,y+=B>>>16,B&=65535,y+=i*c,v+=y>>>16,y&=65535,y+=r*s,v+=y>>>16,y&=65535,y+=u*a,v+=y>>>16,y&=65535,v+=o*c+i*s+r*a+u*d,v&=65535,E(B<<16|mt,v<<16|y,this.unsigned)};f.mul=f.multiply;f.divide=function(t){if(U(t)||(t=K(t)),t.isZero())throw Error("division by zero");if(Z){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?Z.div_u:Z.div_s)(this.low,this.high,t.low,t.high);return E(n,Z.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?se:ee;var o,i,r;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return se;if(t.gt(this.shru(1)))return _r;r=se}else{if(this.eq(L)){if(t.eq(rt)||t.eq(Gt))return L;if(t.eq(L))return rt;var u=this.shr(1);return o=u.div(t).shl(1),o.eq(ee)?t.isNegative()?rt:Gt:(i=this.sub(t.mul(o)),r=o.add(i.div(t)),r)}else if(t.eq(L))return this.unsigned?se: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 d=Math.ceil(Math.log(o)/Math.LN2),a=d<=48?1:vt(2,d-48),s=H(o),c=s.mul(t);c.isNegative()||c.gt(i);)o-=a,s=H(o,this.unsigned),c=s.mul(t);s.isZero()&&(s=rt),r=r.add(s),i=i.sub(c)}return r};f.div=f.divide;f.modulo=function(t){if(U(t)||(t=K(t)),Z){var n=(this.unsigned?Z.rem_u:Z.rem_s)(this.low,this.high,t.low,t.high);return E(n,Z.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};f.mod=f.modulo;f.rem=f.modulo;f.not=function(){return E(~this.low,~this.high,this.unsigned)};f.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};f.clz=f.countLeadingZeros;f.countTrailingZeros=function(){return this.low?Sr(this.low):Sr(this.high)+32};f.ctz=f.countTrailingZeros;f.and=function(t){return U(t)||(t=K(t)),E(this.low&t.low,this.high&t.high,this.unsigned)};f.or=function(t){return U(t)||(t=K(t)),E(this.low|t.low,this.high|t.high,this.unsigned)};f.xor=function(t){return U(t)||(t=K(t)),E(this.low^t.low,this.high^t.high,this.unsigned)};f.shiftLeft=function(t){return U(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):E(0,this.low<<t-32,this.unsigned)};f.shl=f.shiftLeft;f.shiftRight=function(t){return U(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):E(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};f.shr=f.shiftRight;f.shiftRightUnsigned=function(t){return U(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?E(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?E(this.high,0,this.unsigned):E(this.high>>>t-32,0,this.unsigned)};f.shru=f.shiftRightUnsigned;f.shr_u=f.shiftRightUnsigned;f.rotateLeft=function(t){var n;return U(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?E(this.high,this.low,this.unsigned):t<32?(n=32-t,E(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,E(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};f.rotl=f.rotateLeft;f.rotateRight=function(t){var n;return U(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?E(this.high,this.low,this.unsigned):t<32?(n=32-t,E(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,E(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};f.rotr=f.rotateRight;f.toSigned=function(){return this.unsigned?E(this.low,this.high,!1):this};f.toUnsigned=function(){return this.unsigned?this:E(this.low,this.high,!0)};f.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};f.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]};f.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]};S.fromBytes=function(t,n,o){return o?S.fromBytesLE(t,n):S.fromBytesBE(t,n)};S.fromBytesLE=function(t,n){return new S(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};S.fromBytesBE=function(t,n){return new S(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"&&(S.fromBigInt=function(t,n){var o=Number(BigInt.asIntN(32,t)),i=Number(BigInt.asIntN(32,t>>BigInt(32)));return E(o,i,n)},S.fromValue=function(t,n){return typeof t=="bigint"?S.fromBigInt(t,n):K(t,n)},f.toBigInt=function(){var t=BigInt(this.low>>>0),n=BigInt(this.unsigned?this.high>>>0:this.high);return n<<BigInt(32)|t});var $t=S;var ze=P(A(),1);function br(){return{seconds:0,nanos:0}}var Ye={$type:"google.protobuf.Timestamp",encode(e,t=ze.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 ze.default.Reader?e:ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=br();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.seconds=no(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:xr(e.seconds)?globalThis.Number(e.seconds):0,nanos:xr(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 Ye.fromPartial(e??{})},fromPartial(e){let t=br();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};l.set(Ye.$type,Ye);function no(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}ze.default.util.Long!==$t&&(ze.default.util.Long=$t,ze.default.configure());function xr(e){return e!=null}var re;(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"})(re||(re={}));function Qt(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return re.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return re.REVOKED;case 2:case"GRANTED":return re.GRANTED;case-1:case"UNRECOGNIZED":default:return re.UNRECOGNIZED}}function jt(e){switch(e){case re.CONSENT_STATUS_UNKNOWN:return 0;case re.REVOKED:return 1;case re.GRANTED:return 2;case re.UNRECOGNIZED:default:return-1}}var z;(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"})(z||(z={}));function Fr(e){switch(e){case 0:case"SCOPE_UNKNOWN":return z.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return z.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return z.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return z.SUBSCRIBE_TO_SUBREDDIT;case-1:case"UNRECOGNIZED":default:return z.UNRECOGNIZED}}function Dr(e){switch(e){case z.SCOPE_UNKNOWN:return 0;case z.SUBMIT_POST:return 1;case z.SUBMIT_COMMENT:return 2;case z.SUBSCRIBE_TO_SUBREDDIT:return 3;case z.UNRECOGNIZED:default:return-1}}function kr(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var ve={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=N.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&&Ye.encode(ro(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=kr();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=Jr(Ye.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{appSlug:x(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:x(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Fr(t)):[],consentStatus:x(e.consentStatus)?Qt(e.consentStatus):0,updatedAt:x(e.updatedAt)?io(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=>Dr(n))),e.consentStatus!==0&&(t.consentStatus=jt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return ve.fromPartial(e??{})},fromPartial(e){let t=kr();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}};l.set(ve.$type,ve);function Ar(){return{appSlug:"",appName:"",termsAndConditions:void 0,privacyPolicy:void 0}}var Te={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=N.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 N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ar();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:x(e.appSlug)?globalThis.String(e.appSlug):"",appName:x(e.appName)?globalThis.String(e.appName):"",termsAndConditions:x(e.termsAndConditions)?globalThis.String(e.termsAndConditions):void 0,privacyPolicy:x(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 Te.fromPartial(e??{})},fromPartial(e){let t=Ar();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t.termsAndConditions=e.termsAndConditions??void 0,t.privacyPolicy=e.privacyPolicy??void 0,t}};l.set(Te.$type,Te);function Vr(){return{userId:""}}var Zt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=N.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vr();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:x(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let t={};return e.userId!==""&&(t.userId=e.userId),t},create(e){return Zt.fromPartial(e??{})},fromPartial(e){let t=Vr();return t.userId=e.userId??"",t}};l.set(Zt.$type,Zt);function Ur(){return{appPermissions:[],devvitApps:[]}}var Ht={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=N.default.Writer.create()){for(let n of e.appPermissions)ve.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)Te.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ur();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.appPermissions.push(ve.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.devvitApps.push(Te.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=>ve.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>Te.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>ve.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>Te.toJSON(n))),t},create(e){return Ht.fromPartial(e??{})},fromPartial(e){let t=Ur();return t.appPermissions=e.appPermissions?.map(n=>ve.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>Te.fromPartial(n))||[],t}};l.set(Ht.$type,Ht);function Pr(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Kt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=N.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 N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pr();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:x(e.userId)?globalThis.String(e.userId):"",appSlug:x(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:x(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>Fr(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=>Dr(n))),t},create(e){return Kt.fromPartial(e??{})},fromPartial(e){let t=Pr();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};l.set(Kt.$type,Kt);function wr(){return{error:void 0}}var zt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=N.default.Writer.create()){return e.error!==void 0&&D.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=D.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:x(e.error)?D.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=D.toJSON(e.error)),t},create(e){return zt.fromPartial(e??{})},fromPartial(e){let t=wr();return t.error=e.error!==void 0&&e.error!==null?D.fromPartial(e.error):void 0,t}};l.set(zt.$type,zt);function Lr(){return{appSlug:"",userId:"",subredditId:""}}var Yt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=N.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 N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Lr();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:x(e.appSlug)?globalThis.String(e.appSlug):"",userId:x(e.userId)?globalThis.String(e.userId):"",subredditId:x(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 Yt.fromPartial(e??{})},fromPartial(e){let t=Lr();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};l.set(Yt.$type,Yt);function Mr(){return{error:void 0}}var Xt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=N.default.Writer.create()){return e.error!==void 0&&D.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.error=D.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{error:x(e.error)?D.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=D.toJSON(e.error)),t},create(e){return Xt.fromPartial(e??{})},fromPartial(e){let t=Mr();return t.error=e.error!==void 0&&e.error!==null?D.fromPartial(e.error):void 0,t}};l.set(Xt.$type,Xt);function Br(){return{message:""}}var D={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=N.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof N.default.Reader?e:N.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Br();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:x(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return D.fromPartial(e??{})},fromPartial(e){let t=Br();return t.message=e.message??"",t}};l.set(D.$type,D);function ro(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function Jr(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function io(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Jr(Ye.fromJSON(e))}function x(e){return e!=null}function Wr(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}var en={$type:"devvit.ui.effect_types.v1alpha.CanRunAsUserEffect",encode(e,t=Xe.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 Xe.default.Reader?e:Xe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wr();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:Tt(e.postId)?globalThis.String(e.postId):void 0,appSlug:Tt(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:Tt(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 en.fromPartial(e??{})},fromPartial(e){let t=Wr();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};l.set(en.$type,en);function Gr(){return{consentStatus:0}}var fe={$type:"devvit.ui.effect_types.v1alpha.ConsentStatusEvent",encode(e,t=Xe.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof Xe.default.Reader?e:Xe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Gr();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:Tt(e.consentStatus)?Qt(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=jt(e.consentStatus)),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=Gr();return t.consentStatus=e.consentStatus??0,t}};l.set(fe.$type,fe);function Tt(e){return e!=null}var oe=P(A(),1);var ie;(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"})(ie||(ie={}));function oo(e){switch(e){case 0:case"STATUS_CANCELLED":return ie.STATUS_CANCELLED;case 1:case"STATUS_SUCCESS":return ie.STATUS_SUCCESS;case 2:case"STATUS_ERROR":return ie.STATUS_ERROR;case-1:case"UNRECOGNIZED":default:return ie.UNRECOGNIZED}}function uo(e){switch(e){case ie.STATUS_CANCELLED:return 0;case ie.STATUS_SUCCESS:return 1;case ie.STATUS_ERROR:return 2;case ie.UNRECOGNIZED:default:return-1}}function qr(){return{id:"",skus:[],metadata:{}}}var Oe={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect",encode(e,t=oe.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])=>{lt.encode({key:n,value:o},t.uint32(26).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=qr();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=lt.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:Ie(e.id)?globalThis.String(e.id):"",skus:globalThis.Array.isArray(e?.skus)?e.skus.map(t=>globalThis.String(t)):[],metadata:ao(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 Oe.fromPartial(e??{})},fromPartial(e){let t=qr();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}};l.set(Oe.$type,Oe);function $r(){return{key:"",value:""}}var lt={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect.MetadataEntry",encode(e,t=oe.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 oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$r();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:Ie(e.key)?globalThis.String(e.key):"",value:Ie(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 lt.fromPartial(e??{})},fromPartial(e){let t=$r();return t.key=e.key??"",t.value=e.value??"",t}};l.set(lt.$type,lt);function Zr(){return{errorMessage:void 0,orderId:void 0,order:void 0,status:0,errorCode:void 0}}var de={$type:"devvit.ui.effect_types.v1alpha.OrderResultEvent",encode(e,t=oe.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&&Oe.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 oe.default.Reader?e:oe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Zr();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=Oe.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:Ie(e.errorMessage)?globalThis.String(e.errorMessage):void 0,orderId:Ie(e.orderId)?globalThis.String(e.orderId):void 0,order:Ie(e.order)?Oe.fromJSON(e.order):void 0,status:Ie(e.status)?oo(e.status):0,errorCode:Ie(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=Oe.toJSON(e.order)),e.status!==0&&(t.status=uo(e.status)),e.errorCode!==void 0&&(t.errorCode=Math.round(e.errorCode)),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=Zr();return t.errorMessage=e.errorMessage??void 0,t.orderId=e.orderId??void 0,t.order=e.order!==void 0&&e.order!==null?Oe.fromPartial(e.order):void 0,t.status=e.status??0,t.errorCode=e.errorCode??void 0,t}};l.set(de.$type,de);function ao(e){return typeof e=="object"&&e!==null}function Ie(e){return e!=null}var G=P(A(),1);var Ot=P(A(),1);var g=P(A(),1);var R;(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"})(R||(R={}));function ot(e){switch(e){case 0:case"STRING":return R.STRING;case 1:case"PARAGRAPH":return R.PARAGRAPH;case 2:case"NUMBER":return R.NUMBER;case 3:case"BOOLEAN":return R.BOOLEAN;case 4:case"LIST":return R.LIST;case 5:case"SELECTION":return R.SELECTION;case 6:case"GROUP":return R.GROUP;case 7:case"IMAGE":return R.IMAGE;case-1:case"UNRECOGNIZED":default:return R.UNRECOGNIZED}}function ut(e){switch(e){case R.STRING:return 0;case R.PARAGRAPH:return 1;case R.NUMBER:return 2;case R.BOOLEAN:return 3;case R.LIST:return 4;case R.SELECTION:return 5;case R.GROUP:return 6;case R.IMAGE:return 7;case R.UNRECOGNIZED:default:return-1}}var J=P(A(),1);function Hr(){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 T={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=J.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&&_e.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Re.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Ce.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof J.default.Reader?e:J.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Hr();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=_e.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Re.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=Ce.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:le(e.fieldType)?ot(e.fieldType):0,isSecret:le(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:le(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:le(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:le(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:le(e.listValue)?_e.fromJSON(e.listValue):void 0,selectionValue:le(e.selectionValue)?Re.fromJSON(e.selectionValue):void 0,groupValue:le(e.groupValue)?Ce.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=ut(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=_e.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Re.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=Ce.toJSON(e.groupValue)),t},create(e){return T.fromPartial(e??{})},fromPartial(e){let t=Hr();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?_e.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Re.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Ce.fromPartial(e.groupValue):void 0,t}};l.set(T.$type,T);function Kr(){return{itemType:0,items:[]}}var _e={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=J.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)T.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof J.default.Reader?e:J.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Kr();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(T.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:le(e.itemType)?ot(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>T.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=ut(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>T.toJSON(n))),t},create(e){return _e.fromPartial(e??{})},fromPartial(e){let t=Kr();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>T.fromPartial(n))||[],t}};l.set(_e.$type,_e);function zr(){return{values:[]}}var Re={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=J.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof J.default.Reader?e:J.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=zr();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 Re.fromPartial(e??{})},fromPartial(e){let t=zr();return t.values=e.values?.map(n=>n)||[],t}};l.set(Re.$type,Re);function Yr(){return{}}var Ce={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=J.default.Writer.create()){return t},decode(e,t){let n=e instanceof J.default.Reader?e:J.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Yr();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 Ce.fromPartial(e??{})},fromPartial(e){return Yr()}};l.set(Ce.$type,Ce);function le(e){return e!=null}function Xr(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var M={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=g.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&&T.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&&W.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 g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Xr();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=T.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=W.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:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?ot(e.fieldType):0,label:h(e.label)?globalThis.String(e.label):"",helpText:h(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:h(e.defaultValue)?T.fromJSON(e.defaultValue):void 0,required:h(e.required)?globalThis.Boolean(e.required):void 0,disabled:h(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:h(e.fieldConfig)?W.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=ut(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=T.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=W.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return M.fromPartial(e??{})},fromPartial(e){let t=Xr();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?T.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?W.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};l.set(M.$type,M);function Qr(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var W={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=g.default.Writer.create()){return e.stringConfig!==void 0&&be.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&xe.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&ke.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Ae.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Ve.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&Ue.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&we.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Qr();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=be.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=xe.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=ke.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=Ae.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=Ve.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=Ue.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=we.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:h(e.stringConfig)?be.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?xe.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?ke.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?Ae.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?Ve.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?Ue.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?we.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=be.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=xe.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=ke.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=Ae.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Ve.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=Ue.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=we.toJSON(e.groupConfig)),t},create(e){return W.fromPartial(e??{})},fromPartial(e){let t=Qr();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?be.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?xe.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?ke.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Ae.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Ve.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?Ue.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?we.fromPartial(e.groupConfig):void 0,t}};l.set(W.$type,W);function jr(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var be={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=g.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 g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=jr();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:h(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:h(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:h(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 be.fromPartial(e??{})},fromPartial(e){let t=jr();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};l.set(be.$type,be);function ei(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var xe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=g.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 g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ei();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:h(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:h(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:h(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 xe.fromPartial(e??{})},fromPartial(e){let t=ei();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};l.set(xe.$type,xe);function ti(){return{step:void 0,min:void 0,max:void 0}}var ke={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=g.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 g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ti();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:h(e.step)?globalThis.Number(e.step):void 0,min:h(e.min)?globalThis.Number(e.min):void 0,max:h(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 ke.fromPartial(e??{})},fromPartial(e){let t=ti();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};l.set(ke.$type,ke);function ni(){return{}}var Ae={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=g.default.Writer.create()){return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ni();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 Ae.fromPartial(e??{})},fromPartial(e){return ni()}};l.set(Ae.$type,Ae);function ri(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Ve={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=g.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&W.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 g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ri();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=W.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:h(e.itemType)?ot(e.itemType):0,itemConfig:h(e.itemConfig)?W.fromJSON(e.itemConfig):void 0,minEntries:h(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:h(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:h(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=ut(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=W.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 Ve.fromPartial(e??{})},fromPartial(e){let t=ri();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?W.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};l.set(Ve.$type,Ve);function ii(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var Ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=g.default.Writer.create()){for(let n of e.choices)Pe.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 g.default.Reader?e:g.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.choices.push(Pe.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=>Pe.fromJSON(t)):[],multiSelect:h(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:h(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:h(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:h(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>Pe.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 Ue.fromPartial(e??{})},fromPartial(e){let t=ii();return t.choices=e.choices?.map(n=>Pe.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}};l.set(Ue.$type,Ue);function oi(){return{label:"",value:""}}var Pe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=g.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 g.default.Reader?e:g.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.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:h(e.label)?globalThis.String(e.label):"",value:h(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 Pe.fromPartial(e??{})},fromPartial(e){let t=oi();return t.label=e.label??"",t.value=e.value??"",t}};l.set(Pe.$type,Pe);function ui(){return{fields:[]}}var we={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=g.default.Writer.create()){for(let n of e.fields)M.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ui();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(M.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=>M.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>M.toJSON(n))),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=ui();return t.fields=e.fields?.map(n=>M.fromPartial(n))||[],t}};l.set(we.$type,we);function h(e){return e!=null}function ai(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var ce={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=Ot.default.Writer.create()){for(let n of e.fields)M.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 Ot.default.Reader?e:Ot.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.fields.push(M.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=>M.fromJSON(t)):[],title:ct(e.title)?globalThis.String(e.title):void 0,shortDescription:ct(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:ct(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:ct(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:ct(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>M.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 ce.fromPartial(e??{})},fromPartial(e){let t=ai();return t.fields=e.fields?.map(n=>M.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}};l.set(ce.$type,ce);function ct(e){return e!=null}function si(){return{form:void 0}}var tn={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode(e,t=G.default.Writer.create()){return e.form!==void 0&&ce.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=si();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=ce.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:ht(e.form)?ce.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=ce.toJSON(e.form)),t},create(e){return tn.fromPartial(e??{})},fromPartial(e){let t=si();return t.form=e.form!==void 0&&e.form!==null?ce.fromPartial(e.form):void 0,t}};l.set(tn.$type,tn);function fi(){return{results:{},formId:void 0}}var pe={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode(e,t=G.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{pt.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 G.default.Reader?e:G.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;let u=pt.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:so(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=T.fromJSON(o),t),{}):{},formId:ht(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]=T.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return pe.fromPartial(e??{})},fromPartial(e){let t=fi();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=T.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};l.set(pe.$type,pe);function di(){return{key:"",value:void 0}}var pt={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=G.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&T.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.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.key=n.string();continue;case 2:if(r!==18)break;i.value=T.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ht(e.key)?globalThis.String(e.key):"",value:ht(e.value)?T.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=T.toJSON(e.value)),t},create(e){return pt.fromPartial(e??{})},fromPartial(e){let t=di();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?T.fromPartial(e.value):void 0,t}};l.set(pt.$type,pt);function li(){return{formId:void 0}}var he={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode(e,t=G.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof G.default.Reader?e:G.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.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:ht(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 he.fromPartial(e??{})},fromPartial(e){let t=li();return t.formId=e.formId??void 0,t}};l.set(he.$type,he);function so(e){return typeof e=="object"&&e!==null}function ht(e){return e!=null}var Qe=P(A(),1);function ci(){return{}}var nn={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEffect",encode(e,t=Qe.default.Writer.create()){return t},decode(e,t){let n=e instanceof Qe.default.Reader?e:Qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=ci();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 ci()}};l.set(nn.$type,nn);function pi(){return{signedRequestContext:""}}var me={$type:"devvit.ui.effect_types.v1alpha.UpdateRequestContextEvent",encode(e,t=Qe.default.Writer.create()){return e.signedRequestContext!==""&&t.uint32(10).string(e.signedRequestContext),t},decode(e,t){let n=e instanceof Qe.default.Reader?e:Qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=pi();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:fo(e.signedRequestContext)?globalThis.String(e.signedRequestContext):""}},toJSON(e){let t={};return e.signedRequestContext!==""&&(t.signedRequestContext=e.signedRequestContext),t},create(e){return me.fromPartial(e??{})},fromPartial(e){let t=pi();return t.signedRequestContext=e.signedRequestContext??"",t}};l.set(me.$type,me);function fo(e){return e!=null}var et=P(A(),1);var je=P(A(),1);var It=P(A(),1);function hi(){return{}}var _t={$type:"google.protobuf.Empty",encode(e,t=It.default.Writer.create()){return t},decode(e,t){let n=e instanceof It.default.Reader?e:It.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=hi();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 _t.fromPartial(e??{})},fromPartial(e){return hi()}};l.set(_t.$type,_t);function mi(){return{channels:[]}}var rn={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=je.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof je.default.Reader?e:je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=mi();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 rn.fromPartial(e??{})},fromPartial(e){let t=mi();return t.channels=e.channels?.map(n=>n)||[],t}};l.set(rn.$type,rn);function Ei(){return{channel:"",data:void 0}}var Ee={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=je.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&$.encode($.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof je.default.Reader?e:je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ei();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=$.unwrap($.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:co(e.channel)?globalThis.String(e.channel):"",data:lo(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 Ee.fromPartial(e??{})},fromPartial(e){let t=Ei();return t.channel=e.channel??"",t.data=e.data??void 0,t}};l.set(Ee.$type,Ee);function lo(e){return typeof e=="object"&&e!==null}function co(e){return e!=null}var Le;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Le||(Le={}));function po(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Le.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Le.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Le.UNRECOGNIZED}}function ho(e){switch(e){case Le.REALTIME_SUBSCRIBED:return 0;case Le.REALTIME_UNSUBSCRIBED:return 1;case Le.UNRECOGNIZED:default:return-1}}function gi(){return{subscriptionIds:[]}}var on={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=et.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);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=gi();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 on.fromPartial(e??{})},fromPartial(e){let t=gi();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};l.set(on.$type,on);function Si(){return{event:void 0,status:void 0}}var ge={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=et.default.Writer.create()){return e.event!==void 0&&Ee.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 et.default.Reader?e:et.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Si();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=Ee.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:Ni(e.event)?Ee.fromJSON(e.event):void 0,status:Ni(e.status)?po(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=Ee.toJSON(e.event)),e.status!==void 0&&(t.status=ho(e.status)),t},create(e){return ge.fromPartial(e??{})},fromPartial(e){let t=Si();return t.event=e.event!==void 0&&e.event!==null?Ee.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};l.set(ge.$type,ge);function Ni(e){return e!=null}var Rt=P(A(),1);var ue;(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"})(ue||(ue={}));function an(e){switch(e){case 0:case"UNSPECIFIED":return ue.UNSPECIFIED;case 1:case"INLINE_MODE":return ue.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return ue.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return ue.UNRECOGNIZED}}function sn(e){switch(e){case ue.UNSPECIFIED:return 0;case ue.INLINE_MODE:return 1;case ue.IMMERSIVE_MODE:return 2;case ue.UNRECOGNIZED:default:return-1}}function yi(){return{immersiveMode:0,entryUrl:void 0}}var un={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=Rt.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 Rt.default.Reader?e:Rt.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!==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:vi(e.immersiveMode)?an(e.immersiveMode):0,entryUrl:vi(e.entryUrl)?globalThis.String(e.entryUrl):void 0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=sn(e.immersiveMode)),e.entryUrl!==void 0&&(t.entryUrl=e.entryUrl),t},create(e){return un.fromPartial(e??{})},fromPartial(e){let t=yi();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};l.set(un.$type,un);function vi(e){return e!=null}var Je;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Je||(Je={}));function mo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Je.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Je.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Je.UNRECOGNIZED}}function Eo(e){switch(e){case Je.WEBVIEW_VISIBLE:return 0;case Je.WEBVIEW_HIDDEN:return 1;case Je.UNRECOGNIZED:default:return-1}}function Ti(){return{message:void 0,jsonString:""}}var Me={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=O.default.Writer.create()){return e.message!==void 0&&V.encode(V.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ti();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=V.unwrap(V.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:k(e?.message)?e.message:void 0,jsonString:k(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 Me.fromPartial(e??{})},fromPartial(e){let t=Ti();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};l.set(Me.$type,Me);function Oi(){return{visibility:0}}var Be={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=O.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.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!==8)break;i.visibility=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{visibility:k(e.visibility)?mo(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Eo(e.visibility)),t},create(e){return Be.fromPartial(e??{})},fromPartial(e){let t=Oi();return t.visibility=e.visibility??0,t}};l.set(Be.$type,Be);function Ii(){return{postMessage:void 0,fullScreen:void 0}}var fn={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=O.default.Writer.create()){return e.postMessage!==void 0&&Me.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Be.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.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.postMessage=Me.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=Be.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:k(e.postMessage)?Me.fromJSON(e.postMessage):void 0,fullScreen:k(e.fullScreen)?Be.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=Me.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=Be.toJSON(e.fullScreen)),t},create(e){return fn.fromPartial(e??{})},fromPartial(e){let t=Ii();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?Me.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Be.fromPartial(e.fullScreen):void 0,t}};l.set(fn.$type,fn);function _i(){return{immersiveMode:0}}var Fe={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=O.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.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.immersiveMode=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{immersiveMode:k(e.immersiveMode)?an(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=sn(e.immersiveMode)),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=_i();return t.immersiveMode=e.immersiveMode??0,t}};l.set(Fe.$type,Fe);function Ri(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0,orderResult:void 0,updateRequestContext:void 0}}var ae={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=O.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&he.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&pe.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&ge.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&Fe.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.consentStatus!==void 0&&fe.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),e.orderResult!==void 0&&de.encode(e.orderResult,t.uint32(66).fork()).ldelim(),e.updateRequestContext!==void 0&&me.encode(e.updateRequestContext,t.uint32(74).fork()).ldelim(),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ri();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=he.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=pe.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=ge.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.immersiveModeEvent=Fe.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.consentStatus=fe.decode(n,n.uint32());continue;case 8:if(r!==66)break;i.orderResult=de.decode(n,n.uint32());continue;case 9:if(r!==74)break;i.updateRequestContext=me.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:k(e.id)?globalThis.String(e.id):"",formCanceled:k(e.formCanceled)?he.fromJSON(e.formCanceled):void 0,formSubmitted:k(e.formSubmitted)?pe.fromJSON(e.formSubmitted):void 0,realtimeEvent:k(e.realtimeEvent)?ge.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:k(e.immersiveModeEvent)?Fe.fromJSON(e.immersiveModeEvent):void 0,consentStatus:k(e.consentStatus)?fe.fromJSON(e.consentStatus):void 0,orderResult:k(e.orderResult)?de.fromJSON(e.orderResult):void 0,updateRequestContext:k(e.updateRequestContext)?me.fromJSON(e.updateRequestContext):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=he.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=pe.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=ge.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=Fe.toJSON(e.immersiveModeEvent)),e.consentStatus!==void 0&&(t.consentStatus=fe.toJSON(e.consentStatus)),e.orderResult!==void 0&&(t.orderResult=de.toJSON(e.orderResult)),e.updateRequestContext!==void 0&&(t.updateRequestContext=me.toJSON(e.updateRequestContext)),t},create(e){return ae.fromPartial(e??{})},fromPartial(e){let t=Ri();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?he.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?pe.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?ge.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?Fe.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=e.consentStatus!==void 0&&e.consentStatus!==null?fe.fromPartial(e.consentStatus):void 0,t.orderResult=e.orderResult!==void 0&&e.orderResult!==null?de.fromPartial(e.orderResult):void 0,t.updateRequestContext=e.updateRequestContext!==void 0&&e.updateRequestContext!==null?me.fromPartial(e.updateRequestContext):void 0,t}};l.set(ae.$type,ae);function Ci(){return{data:void 0}}var dn={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode(e,t=O.default.Writer.create()){return e.data!==void 0&&De.encode(e.data,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.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.data=De.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{data:k(e.data)?De.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.data!==void 0&&(t.data=De.toJSON(e.data)),t},create(e){return dn.fromPartial(e??{})},fromPartial(e){let t=Ci();return t.data=e.data!==void 0&&e.data!==null?De.fromPartial(e.data):void 0,t}};l.set(dn.$type,dn);function bi(){return{type:"",data:void 0}}var De={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode(e,t=O.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.data!==void 0&&ae.encode(e.data,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof O.default.Reader?e:O.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!==10)break;i.type=n.string();continue;case 2:if(r!==18)break;i.data=ae.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{type:k(e.type)?globalThis.String(e.type):"",data:k(e.data)?ae.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.data!==void 0&&(t.data=ae.toJSON(e.data)),t},create(e){return De.fromPartial(e??{})},fromPartial(e){let t=bi();return t.type=e.type??"",t.data=e.data!==void 0&&e.data!==null?ae.fromPartial(e.data):void 0,t}};l.set(De.$type,De);function k(e){return e!=null}var go="devvit-internal",So={[Ge.EFFECT_SHOW_FORM]:!0,[Ge.EFFECT_CAN_RUN_AS_USER]:!0,[Ge.EFFECT_CREATE_ORDER]:!0},Y=e=>new Promise(t=>{let n={...e,realtimeEffect:e.realtime,scope:Et.CLIENT,type:go};if((e.showToast||e.navigateToUrl||e.showForm||e.type===Ge.EFFECT_CAN_RUN_AS_USER)&&(n.effect=e),So[e.type]){let o=crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let u=ae.fromJSON(r.data.data);t(u),removeEventListener("message",i)}};addEventListener("message",i),parent.postMessage(n,"*")}else parent.postMessage(n,"*"),t(void 0)});function na(e){let t=typeof e=="string"?e:e.url,n;try{n=new URL(t).toString()}catch{throw new TypeError(`Invalid URL: ${t}`)}Y({navigateToUrl:{url:n},type:5})}var We;(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"})(We||(We={}));var xi;(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"})(xi||(xi={}));var aa=async()=>{let e=devvit.appPermissionState;if(!e)return!0;if(e.requestedScopes.length===0)return!1;switch(e.consentStatus){case We.REVOKED:return!1;case We.GRANTED:if(e.requestedScopes.every(n=>e.grantedScopes.includes(n)))return!0;break;case We.CONSENT_STATUS_UNKNOWN:case We.UNRECOGNIZED:break;default:{e.consentStatus;break}}return(await Y({canRunAsUser:{postId:devvit.context.postId,appSlug:devvit.context.appName,subredditId:devvit.context.subredditId},type:11}))?.consentStatus?.consentStatus===We.GRANTED};var ki="$devvit_icon.png";async function ha(e){if(e.data&&e.data.length>1024)throw Error(`data must be <= ${1024} characters but was ${e.data.length} characters`);let t=`${new URL(ki,location.origin)}`,n;try{n=await fetch(t,{method:"HEAD"})}catch{}await Y({type:9,share:{appIconUri:n?.ok?t:void 0,userData:e.data,text:e.text,title:e.title}})}function ma(){return devvit.share?.userData}function ln(e,t=new Set){for(let n of e){if(n.type==="group"){ln(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}No(e)}function No(e){for(let t of e)if(t.type==="string"&&t.isSecret&&t.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${t.name}"`}var I;(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"})(I||(I={}));var cn;(function(e){e[e.UNKNOWN_EVENT_SOURCE=0]="UNKNOWN_EVENT_SOURCE",e[e.USER=1]="USER",e[e.ADMIN=2]="ADMIN",e[e.MODERATOR=3]="MODERATOR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(cn||(cn={}));var pn;(function(e){e[e.UNSPECIFIED_DELETION_REASON=0]="UNSPECIFIED_DELETION_REASON",e[e.SPAM=1]="SPAM",e[e.LEGAL=2]="LEGAL",e[e.OTHER=3]="OTHER",e[e.UNKNOWN=4]="UNKNOWN",e[e.EXPLICIT_CONTENT=5]="EXPLICIT_CONTENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(pn||(pn={}));var hn;(function(e){e[e.OFF=0]="OFF",e[e.LENIENT=1]="LENIENT",e[e.MEDIUM=2]="MEDIUM",e[e.STRICT=3]="STRICT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(hn||(hn={}));var mn;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.ADMIN=1]="ADMIN",e[e.GOLD=2]="GOLD",e[e.GOLD_AUTO=3]="GOLD_AUTO",e[e.YES=4]="YES",e[e.SPECIAL=5]="SPECIAL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(mn||(mn={}));var En;(function(e){e[e.ARCHIVED=0]="ARCHIVED",e[e.EMPLOYEES_ONLY=1]="EMPLOYEES_ONLY",e[e.GOLD_ONLY=2]="GOLD_ONLY",e[e.GOLD_RESTRICTED=3]="GOLD_RESTRICTED",e[e.PRIVATE=4]="PRIVATE",e[e.PUBLIC=5]="PUBLIC",e[e.RESTRICTED=6]="RESTRICTED",e[e.USER=7]="USER",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(En||(En={}));var gn;(function(e){e[e.UNKNOWN_SUBREDDIT_RATING=0]="UNKNOWN_SUBREDDIT_RATING",e[e.E=1]="E",e[e.M1=2]="M1",e[e.M2=3]="M2",e[e.D=4]="D",e[e.V=5]="V",e[e.X=6]="X",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(gn||(gn={}));var Vi;(function(e){e.Installation="installation",e.App="app"})(Vi||(Vi={}));var Ui;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(Ui||(Ui={}));function yo(e){switch(e.fieldType){case I.STRING:return e.stringValue;case I.IMAGE:return e.stringValue;case I.PARAGRAPH:return e.stringValue;case I.NUMBER:return e.numberValue;case I.BOOLEAN:return e.boolValue;case I.SELECTION:return e.selectionValue?.values??[];default:return}}function Pi(e){return Object.keys(e).reduce((t,n)=>{let o=yo(e[n]);return o!==void 0&&(t[n]=o),t},{})}function Sn(e){return e.map(t=>{switch(t.type){case"string":return vo(t);case"image":return To(t);case"paragraph":return Oo(t);case"number":return Io(t);case"select":return _o(t);case"boolean":return Ro(t);case"group":return Co(t);default:throw new Error("Unknown field type.")}})}function vo(e){return{defaultValue:{fieldType:I.STRING,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{stringConfig:{placeholder:e.placeholder}},fieldId:e.name,fieldType:I.STRING,helpText:e.helpText,label:e.label,required:e.required,isSecret:e.isSecret}}function To(e){return{disabled:e.disabled,fieldId:e.name,fieldType:I.IMAGE,helpText:e.helpText,label:e.label,required:e.required}}function Oo(e){return{defaultValue:{fieldType:I.PARAGRAPH,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{paragraphConfig:{lineHeight:e.lineHeight,placeholder:e.placeholder}},fieldId:e.name,fieldType:I.PARAGRAPH,helpText:e.helpText,label:e.label,required:e.required}}function Io(e){return{defaultValue:{fieldType:I.NUMBER,numberValue:e.defaultValue},disabled:e.disabled,fieldConfig:{numberConfig:{}},fieldId:e.name,fieldType:I.NUMBER,helpText:e.helpText,label:e.label,required:e.required}}function _o(e){return{defaultValue:{fieldType:I.SELECTION,selectionValue:{values:e.defaultValue??[]}},disabled:e.disabled,fieldConfig:{selectionConfig:{choices:e.options,multiSelect:e.multiSelect}},fieldId:e.name,fieldType:I.SELECTION,helpText:e.helpText,label:e.label,required:e.required}}function Ro(e){return{defaultValue:{fieldType:I.BOOLEAN,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:I.BOOLEAN,helpText:e.helpText,label:e.label}}function Co(e){return{fieldId:"",fieldType:I.GROUP,fieldConfig:{groupConfig:{fields:Sn(e.fields)}},label:e.label,helpText:e.helpText}}var wi=1,bo=()=>(wi++,`form.${wi}`),Xa=async e=>{let t={fields:[],id:bo(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};ln(e.fields),t.fields=Sn(e.fields);let n=await Y({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Pi(n.formSubmitted.results)}};function es(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},Y({showToast:{toast:t},type:4})}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={}));var Li="token";var as=()=>xo(devvit.webViewMode);function ss(e,t){if(devvit.webViewMode===te.IMMERSIVE_MODE)throw Error("web view is already expanded");return Mi(te.IMMERSIVE_MODE,e,t)}function fs(e){if(devvit.webViewMode===te.INLINE_MODE)throw Error("web view is already inlined");return Mi(te.INLINE_MODE,e,void 0)}function ds(e){}function ls(e){}async function Mi(e,t,n){if(!t.isTrusted||t.type!=="click")throw console.error("Expanded mode effect ignored due to untrusted event"),new Error("Untrusted event");if(n!=null&&!devvit.entrypoints[n])throw Error(`no entrypoint named "${n}"; all entrypoints must appear in \`devvit.json\` \`post.entrypoints\``);let o;if(n){let r=new URL(devvit.entrypoints[n]);r.searchParams.set(Li,devvit.token),o=`${r}`}await Y({type:9,immersiveMode:{entryUrl:o,immersiveMode:e}})}function xo(e){switch(e){case te.IMMERSIVE_MODE:return"expanded";case te.INLINE_MODE:case te.UNRECOGNIZED:case te.UNSPECIFIED:case void 0:return"inline";default:throw Error(`${e} not a WebViewImmersiveMode`)}}export{ds as addWebViewModeListener,aa as canRunAsUser,Ao as context,fs as exitExpandedMode,ma as getShareData,as as getWebViewMode,na as navigateTo,ls as removeWebViewModeListener,ss as requestExpandedMode,Xa as showForm,ha as showShareSheet,es as showToast};
2
- /*! Bundled license information:
3
-
4
- long/index.js:
5
- (**
6
- * @license
7
- * Copyright 2009 The Closure Library Authors
8
- * Copyright 2020 Daniel Wirtz / The long.js Authors.
9
- *
10
- * Licensed under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- *
22
- * SPDX-License-Identifier: Apache-2.0
23
- *)
24
- */
25
- //# sourceMappingURL=client.min.js.map