@devvit/client 0.11.19-next-2025-07-22-19-50-28-4acdca86a.0 → 0.11.19-next-2025-07-22-21-51-48-a55919b49.0

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 CHANGED
@@ -1,2 +1,2 @@
1
- var Tr=Object.create;var at=Object.defineProperty;var Ir=Object.getOwnPropertyDescriptor;var Or=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Cr=Object.prototype.hasOwnProperty;var O=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var _r=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Or(n))!Cr.call(e,r)&&r!==t&&at(e,r,{get:()=>n[r],enumerable:!(o=Ir(n,r))||o.enumerable});return e};var x=(e,n,t)=>(t=e!=null?Tr(Fr(e)):{},_r(n||!e||!e.__esModule?at(t,"default",{value:e,enumerable:!0}):t,e));var ft=O((bo,dt)=>{"use strict";dt.exports=kr;function kr(e,n){for(var t=new Array(arguments.length-1),o=0,r=2,i=!0;r<arguments.length;)t[o++]=arguments[r++];return new Promise(function(f,u){t[o]=function(l){if(i)if(i=!1,l)u(l);else{for(var E=new Array(arguments.length-1),y=0;y<E.length;)E[y++]=arguments[y];f.apply(null,E)}};try{e.apply(n||null,t)}catch(a){i&&(i=!1,u(a))}})}});var ht=O(pt=>{"use strict";var pn=pt;pn.length=function(n){var t=n.length;if(!t)return 0;for(var o=0;--t%4>1&&n.charAt(t)==="=";)++o;return Math.ceil(n.length*3)/4-o};var Ke=new Array(64),ct=new Array(123);for(Q=0;Q<64;)ct[Ke[Q]=Q<26?Q+65:Q<52?Q+71:Q<62?Q-4:Q-59|43]=Q++;var Q;pn.encode=function(n,t,o){for(var r=null,i=[],s=0,f=0,u;t<o;){var a=n[t++];switch(f){case 0:i[s++]=Ke[a>>2],u=(a&3)<<4,f=1;break;case 1:i[s++]=Ke[u|a>>4],u=(a&15)<<2,f=2;break;case 2:i[s++]=Ke[u|a>>6],i[s++]=Ke[a&63],f=0;break}s>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),s=0)}return f&&(i[s++]=Ke[u],i[s++]=61,f===1&&(i[s++]=61)),r?(s&&r.push(String.fromCharCode.apply(String,i.slice(0,s))),r.join("")):String.fromCharCode.apply(String,i.slice(0,s))};var lt="invalid encoding";pn.decode=function(n,t,o){for(var r=o,i=0,s,f=0;f<n.length;){var u=n.charCodeAt(f++);if(u===61&&i>1)break;if((u=ct[u])===void 0)throw Error(lt);switch(i){case 0:s=u,i=1;break;case 1:t[o++]=s<<2|(u&48)>>4,s=u,i=2;break;case 2:t[o++]=(s&15)<<4|(u&60)>>2,s=u,i=3;break;case 3:t[o++]=(s&3)<<6|u,i=0;break}}if(i===1)throw Error(lt);return o-r};pn.test=function(n){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(n)}});var gt=O((No,mt)=>{"use strict";mt.exports=hn;function hn(){this._listeners={}}hn.prototype.on=function(n,t,o){return(this._listeners[n]||(this._listeners[n]=[])).push({fn:t,ctx:o||this}),this};hn.prototype.off=function(n,t){if(n===void 0)this._listeners={};else if(t===void 0)this._listeners[n]=[];else for(var o=this._listeners[n],r=0;r<o.length;)o[r].fn===t?o.splice(r,1):++r;return this};hn.prototype.emit=function(n){var t=this._listeners[n];if(t){for(var o=[],r=1;r<arguments.length;)o.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,o)}return this}});var Tt=O((To,Nt)=>{"use strict";Nt.exports=St(St);function St(e){return typeof Float32Array<"u"?function(){var n=new Float32Array([-0]),t=new Uint8Array(n.buffer),o=t[3]===128;function r(u,a,l){n[0]=u,a[l]=t[0],a[l+1]=t[1],a[l+2]=t[2],a[l+3]=t[3]}function i(u,a,l){n[0]=u,a[l]=t[3],a[l+1]=t[2],a[l+2]=t[1],a[l+3]=t[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function s(u,a){return t[0]=u[a],t[1]=u[a+1],t[2]=u[a+2],t[3]=u[a+3],n[0]}function f(u,a){return t[3]=u[a],t[2]=u[a+1],t[1]=u[a+2],t[0]=u[a+3],n[0]}e.readFloatLE=o?s:f,e.readFloatBE=o?f:s}():function(){function n(o,r,i,s){var f=r<0?1:0;if(f&&(r=-r),r===0)o(1/r>0?0:2147483648,i,s);else if(isNaN(r))o(2143289344,i,s);else if(r>34028234663852886e22)o((f<<31|2139095040)>>>0,i,s);else if(r<11754943508222875e-54)o((f<<31|Math.round(r/1401298464324817e-60))>>>0,i,s);else{var u=Math.floor(Math.log(r)/Math.LN2),a=Math.round(r*Math.pow(2,-u)*8388608)&8388607;o((f<<31|u+127<<23|a)>>>0,i,s)}}e.writeFloatLE=n.bind(null,yt),e.writeFloatBE=n.bind(null,vt);function t(o,r,i){var s=o(r,i),f=(s>>31)*2+1,u=s>>>23&255,a=s&8388607;return u===255?a?NaN:f*(1/0):u===0?f*1401298464324817e-60*a:f*Math.pow(2,u-150)*(a+8388608)}e.readFloatLE=t.bind(null,bt),e.readFloatBE=t.bind(null,Et)}(),typeof Float64Array<"u"?function(){var n=new Float64Array([-0]),t=new Uint8Array(n.buffer),o=t[7]===128;function r(u,a,l){n[0]=u,a[l]=t[0],a[l+1]=t[1],a[l+2]=t[2],a[l+3]=t[3],a[l+4]=t[4],a[l+5]=t[5],a[l+6]=t[6],a[l+7]=t[7]}function i(u,a,l){n[0]=u,a[l]=t[7],a[l+1]=t[6],a[l+2]=t[5],a[l+3]=t[4],a[l+4]=t[3],a[l+5]=t[2],a[l+6]=t[1],a[l+7]=t[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function s(u,a){return t[0]=u[a],t[1]=u[a+1],t[2]=u[a+2],t[3]=u[a+3],t[4]=u[a+4],t[5]=u[a+5],t[6]=u[a+6],t[7]=u[a+7],n[0]}function f(u,a){return t[7]=u[a],t[6]=u[a+1],t[5]=u[a+2],t[4]=u[a+3],t[3]=u[a+4],t[2]=u[a+5],t[1]=u[a+6],t[0]=u[a+7],n[0]}e.readDoubleLE=o?s:f,e.readDoubleBE=o?f:s}():function(){function n(o,r,i,s,f,u){var a=s<0?1:0;if(a&&(s=-s),s===0)o(0,f,u+r),o(1/s>0?0:2147483648,f,u+i);else if(isNaN(s))o(0,f,u+r),o(2146959360,f,u+i);else if(s>17976931348623157e292)o(0,f,u+r),o((a<<31|2146435072)>>>0,f,u+i);else{var l;if(s<22250738585072014e-324)l=s/5e-324,o(l>>>0,f,u+r),o((a<<31|l/4294967296)>>>0,f,u+i);else{var E=Math.floor(Math.log(s)/Math.LN2);E===1024&&(E=1023),l=s*Math.pow(2,-E),o(l*4503599627370496>>>0,f,u+r),o((a<<31|E+1023<<20|l*1048576&1048575)>>>0,f,u+i)}}}e.writeDoubleLE=n.bind(null,yt,0,4),e.writeDoubleBE=n.bind(null,vt,4,0);function t(o,r,i,s,f){var u=o(s,f+r),a=o(s,f+i),l=(a>>31)*2+1,E=a>>>20&2047,y=4294967296*(a&1048575)+u;return E===2047?y?NaN:l*(1/0):E===0?l*5e-324*y:l*Math.pow(2,E-1075)*(y+4503599627370496)}e.readDoubleLE=t.bind(null,bt,0,4),e.readDoubleBE=t.bind(null,Et,4,0)}(),e}function yt(e,n,t){n[t]=e&255,n[t+1]=e>>>8&255,n[t+2]=e>>>16&255,n[t+3]=e>>>24}function vt(e,n,t){n[t]=e>>>24,n[t+1]=e>>>16&255,n[t+2]=e>>>8&255,n[t+3]=e&255}function bt(e,n){return(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)>>>0}function Et(e,n){return(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0}});var It=O((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 Ft=O(Ot=>{"use strict";var On=Ot;On.length=function(n){for(var t=0,o=0,r=0;r<n.length;++r)o=n.charCodeAt(r),o<128?t+=1:o<2048?t+=2:(o&64512)===55296&&(n.charCodeAt(r+1)&64512)===56320?(++r,t+=4):t+=3;return t};On.read=function(n,t,o){var r=o-t;if(r<1)return"";for(var i=null,s=[],f=0,u;t<o;)u=n[t++],u<128?s[f++]=u:u>191&&u<224?s[f++]=(u&31)<<6|n[t++]&63:u>239&&u<365?(u=((u&7)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,s[f++]=55296+(u>>10),s[f++]=56320+(u&1023)):s[f++]=(u&15)<<12|(n[t++]&63)<<6|n[t++]&63,f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),f=0);return i?(f&&i.push(String.fromCharCode.apply(String,s.slice(0,f))),i.join("")):String.fromCharCode.apply(String,s.slice(0,f))};On.write=function(n,t,o){for(var r=o,i,s,f=0;f<n.length;++f)i=n.charCodeAt(f),i<128?t[o++]=i:i<2048?(t[o++]=i>>6|192,t[o++]=i&63|128):(i&64512)===55296&&((s=n.charCodeAt(f+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++f,t[o++]=i>>18|240,t[o++]=i>>12&63|128,t[o++]=i>>6&63|128,t[o++]=i&63|128):(t[o++]=i>>12|224,t[o++]=i>>6&63|128,t[o++]=i&63|128);return o-r}});var _t=O((Oo,Ct)=>{"use strict";Ct.exports=Rr;function Rr(e,n,t){var o=t||8192,r=o>>>1,i=null,s=o;return function(u){if(u<1||u>r)return e(u);s+u>o&&(i=e(o),s=0);var a=n.call(i,s,s+=u);return s&7&&(s=(s|7)+1),a}}});var Rt=O((Fo,kt)=>{"use strict";kt.exports=F;var nn=ce();function F(e,n){this.lo=e>>>0,this.hi=n>>>0}var Le=F.zero=new F(0,0);Le.toNumber=function(){return 0};Le.zzEncode=Le.zzDecode=function(){return this};Le.length=function(){return 1};var Vr=F.zeroHash="\0\0\0\0\0\0\0\0";F.fromNumber=function(n){if(n===0)return Le;var t=n<0;t&&(n=-n);var o=n>>>0,r=(n-o)/4294967296>>>0;return t&&(r=~r>>>0,o=~o>>>0,++o>4294967295&&(o=0,++r>4294967295&&(r=0))),new F(o,r)};F.from=function(n){if(typeof n=="number")return F.fromNumber(n);if(nn.isString(n))if(nn.Long)n=nn.Long.fromString(n);else return F.fromNumber(parseInt(n,10));return n.low||n.high?new F(n.low>>>0,n.high>>>0):Le};F.prototype.toNumber=function(n){if(!n&&this.hi>>>31){var t=~this.lo+1>>>0,o=~this.hi>>>0;return t||(o=o+1>>>0),-(t+o*4294967296)}return this.lo+this.hi*4294967296};F.prototype.toLong=function(n){return nn.Long?new nn.Long(this.lo|0,this.hi|0,!!n):{low:this.lo|0,high:this.hi|0,unsigned:!!n}};var le=String.prototype.charCodeAt;F.fromHash=function(n){return n===Vr?Le:new F((le.call(n,0)|le.call(n,1)<<8|le.call(n,2)<<16|le.call(n,3)<<24)>>>0,(le.call(n,4)|le.call(n,5)<<8|le.call(n,6)<<16|le.call(n,7)<<24)>>>0)};F.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)};F.prototype.zzEncode=function(){var n=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^n)>>>0,this.lo=(this.lo<<1^n)>>>0,this};F.prototype.zzDecode=function(){var n=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^n)>>>0,this.hi=(this.hi>>>1^n)>>>0,this};F.prototype.length=function(){var n=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return o===0?t===0?n<16384?n<128?1:2:n<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:o<128?9:10}});var ce=O(Fn=>{"use strict";var p=Fn;p.asPromise=ft();p.base64=ht();p.EventEmitter=gt();p.float=Tt();p.inquire=It();p.utf8=Ft();p.pool=_t();p.LongBits=Rt();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||Fn;p.emptyArray=Object.freeze?Object.freeze([]):[];p.emptyObject=Object.freeze?Object.freeze({}):{};p.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};p.isString=function(n){return typeof n=="string"||n instanceof String};p.isObject=function(n){return n&&typeof n=="object"};p.isset=p.isSet=function(n,t){var o=n[t];return o!=null&&n.hasOwnProperty(t)?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(n){return typeof n=="number"?p.Buffer?p._Buffer_allocUnsafe(n):new p.Array(n):p.Buffer?p._Buffer_from(n):typeof Uint8Array>"u"?n:new Uint8Array(n)};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(n){return n?p.LongBits.from(n).toHash():p.LongBits.zeroHash};p.longFromHash=function(n,t){var o=p.LongBits.fromHash(n);return p.Long?p.Long.fromBits(o.lo,o.hi,t):o.toNumber(!!t)};function Vt(e,n,t){for(var o=Object.keys(n),r=0;r<o.length;++r)(e[o[r]]===void 0||!t)&&(e[o[r]]=n[o[r]]);return e}p.merge=Vt;p.lcFirst=function(n){return n.charAt(0).toLowerCase()+n.substring(1)};function xt(e){function n(t,o){if(!(this instanceof n))return new n(t,o);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:new Error().stack||""}),o&&Vt(this,o)}return n.prototype=Object.create(Error.prototype,{constructor:{value:n,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}}),n}p.newError=xt;p.ProtocolError=xt("ProtocolError");p.oneOfGetter=function(n){for(var t={},o=0;o<n.length;++o)t[n[o]]=1;return function(){for(var r=Object.keys(this),i=r.length-1;i>-1;--i)if(t[r[i]]===1&&this[r[i]]!==void 0&&this[r[i]]!==null)return r[i]}};p.oneOfSetter=function(n){return function(t){for(var o=0;o<n.length;++o)n[o]!==t&&delete this[n[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(t,o){return new e(t,o)},p._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}}});var Pn=O((_o,Bt)=>{"use strict";Bt.exports=m;var G=ce(),Cn,mn=G.LongBits,Pt=G.base64,wt=G.utf8;function tn(e,n,t){this.fn=e,this.len=n,this.next=void 0,this.val=t}function kn(){}function xr(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 tn(kn,0,0),this.tail=this.head,this.states=null}var At=function(){return G.Buffer?function(){return(m.create=function(){return new Cn})()}:function(){return new m}};m.create=At();m.alloc=function(n){return new G.Array(n)};G.Array!==Array&&(m.alloc=G.pool(m.alloc,G.Array.prototype.subarray));m.prototype._push=function(n,t,o){return this.tail=this.tail.next=new tn(n,t,o),this.len+=t,this};function Rn(e,n,t){n[t]=e&255}function Pr(e,n,t){for(;e>127;)n[t++]=e&127|128,e>>>=7;n[t]=e}function Vn(e,n){this.len=e,this.next=void 0,this.val=n}Vn.prototype=Object.create(tn.prototype);Vn.prototype.fn=Pr;m.prototype.uint32=function(n){return this.len+=(this.tail=this.tail.next=new Vn((n=n>>>0)<128?1:n<16384?2:n<2097152?3:n<268435456?4:5,n)).len,this};m.prototype.int32=function(n){return n<0?this._push(xn,10,mn.fromNumber(n)):this.uint32(n)};m.prototype.sint32=function(n){return this.uint32((n<<1^n>>31)>>>0)};function xn(e,n,t){for(;e.hi;)n[t++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)n[t++]=e.lo&127|128,e.lo=e.lo>>>7;n[t++]=e.lo}m.prototype.uint64=function(n){var t=mn.from(n);return this._push(xn,t.length(),t)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(n){var t=mn.from(n).zzEncode();return this._push(xn,t.length(),t)};m.prototype.bool=function(n){return this._push(Rn,1,n?1:0)};function _n(e,n,t){n[t]=e&255,n[t+1]=e>>>8&255,n[t+2]=e>>>16&255,n[t+3]=e>>>24}m.prototype.fixed32=function(n){return this._push(_n,4,n>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(n){var t=mn.from(n);return this._push(_n,4,t.lo)._push(_n,4,t.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(n){return this._push(G.float.writeFloatLE,4,n)};m.prototype.double=function(n){return this._push(G.float.writeDoubleLE,8,n)};var wr=G.Array.prototype.set?function(n,t,o){t.set(n,o)}:function(n,t,o){for(var r=0;r<n.length;++r)t[o+r]=n[r]};m.prototype.bytes=function(n){var t=n.length>>>0;if(!t)return this._push(Rn,1,0);if(G.isString(n)){var o=m.alloc(t=Pt.length(n));Pt.decode(n,o,0),n=o}return this.uint32(t)._push(wr,t,n)};m.prototype.string=function(n){var t=wt.length(n);return t?this.uint32(t)._push(wt.write,t,n):this._push(Rn,1,0)};m.prototype.fork=function(){return this.states=new xr(this),this.head=this.tail=new tn(kn,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 tn(kn,0,0),this.len=0),this};m.prototype.ldelim=function(){var n=this.head,t=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=n.next,this.tail=t,this.len+=o),this};m.prototype.finish=function(){for(var n=this.head.next,t=this.constructor.alloc(this.len),o=0;n;)n.fn(n.val,t,o),o+=n.len,n=n.next;return t};m._configure=function(e){Cn=e,m.create=At(),Cn._configure()}});var Jt=O((ko,Dt)=>{"use strict";Dt.exports=ne;var Lt=Pn();(ne.prototype=Object.create(Lt.prototype)).constructor=ne;var pe=ce();function ne(){Lt.call(this)}ne._configure=function(){ne.alloc=pe._Buffer_allocUnsafe,ne.writeBytesBuffer=pe.Buffer&&pe.Buffer.prototype instanceof Uint8Array&&pe.Buffer.prototype.set.name==="set"?function(n,t,o){t.set(n,o)}:function(n,t,o){if(n.copy)n.copy(t,o,0,n.length);else for(var r=0;r<n.length;)t[o++]=n[r++]}};ne.prototype.bytes=function(n){pe.isString(n)&&(n=pe._Buffer_from(n,"base64"));var t=n.length>>>0;return this.uint32(t),t&&this._push(ne.writeBytesBuffer,t,n),this};function Ar(e,n,t){e.length<40?pe.utf8.write(e,n,t):n.utf8Write?n.utf8Write(e,t):n.write(e,t)}ne.prototype.string=function(n){var t=pe.Buffer.byteLength(n);return this.uint32(t),t&&this._push(Ar,t,n),this};ne._configure()});var Bn=O((Ro,qt)=>{"use strict";qt.exports=T;var Y=ce(),An,Wt=Y.LongBits,Br=Y.utf8;function j(e,n){return RangeError("index out of range: "+e.pos+" + "+(n||1)+" > "+e.len)}function T(e){this.buf=e,this.pos=0,this.len=e.length}var Mt=typeof Uint8Array<"u"?function(n){if(n instanceof Uint8Array||Array.isArray(n))return new T(n);throw Error("illegal buffer")}:function(n){if(Array.isArray(n))return new T(n);throw Error("illegal buffer")},$t=function(){return Y.Buffer?function(t){return(T.create=function(r){return Y.Buffer.isBuffer(r)?new An(r):Mt(r)})(t)}:Mt};T.create=$t();T.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;T.prototype.uint32=function(){var n=4294967295;return function(){if(n=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(n=(n|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(n=(n|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return n;if((this.pos+=5)>this.len)throw this.pos=this.len,j(this,10);return n}}();T.prototype.int32=function(){return this.uint32()|0};T.prototype.sint32=function(){var n=this.uint32();return n>>>1^-(n&1)|0};function wn(){var e=new Wt(0,0),n=0;if(this.len-this.pos>4){for(;n<4;++n)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<n*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;n=0}else{for(;n<3;++n){if(this.pos>=this.len)throw j(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<n*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<n*7)>>>0,e}if(this.len-this.pos>4){for(;n<5;++n)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<n*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;n<5;++n){if(this.pos>=this.len)throw j(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<n*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}T.prototype.bool=function(){return this.uint32()!==0};function gn(e,n){return(e[n-4]|e[n-3]<<8|e[n-2]<<16|e[n-1]<<24)>>>0}T.prototype.fixed32=function(){if(this.pos+4>this.len)throw j(this,4);return gn(this.buf,this.pos+=4)};T.prototype.sfixed32=function(){if(this.pos+4>this.len)throw j(this,4);return gn(this.buf,this.pos+=4)|0};function Ut(){if(this.pos+8>this.len)throw j(this,8);return new Wt(gn(this.buf,this.pos+=4),gn(this.buf,this.pos+=4))}T.prototype.float=function(){if(this.pos+4>this.len)throw j(this,4);var n=Y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,n};T.prototype.double=function(){if(this.pos+8>this.len)throw j(this,4);var n=Y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,n};T.prototype.bytes=function(){var n=this.uint32(),t=this.pos,o=this.pos+n;if(o>this.len)throw j(this,n);if(this.pos+=n,Array.isArray(this.buf))return this.buf.slice(t,o);if(t===o){var r=Y.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,o)};T.prototype.string=function(){var n=this.bytes();return Br.read(n,0,n.length)};T.prototype.skip=function(n){if(typeof n=="number"){if(this.pos+n>this.len)throw j(this,n);this.pos+=n}else do if(this.pos>=this.len)throw j(this);while(this.buf[this.pos++]&128);return this};T.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};T._configure=function(e){An=e,T.create=$t(),An._configure();var n=Y.Long?"toLong":"toNumber";Y.merge(T.prototype,{int64:function(){return wn.call(this)[n](!1)},uint64:function(){return wn.call(this)[n](!0)},sint64:function(){return wn.call(this).zzDecode()[n](!1)},fixed64:function(){return Ut.call(this)[n](!0)},sfixed64:function(){return Ut.call(this)[n](!1)}})}});var Kt=O((Vo,Ht)=>{"use strict";Ht.exports=De;var Zt=Bn();(De.prototype=Object.create(Zt.prototype)).constructor=De;var Gt=ce();function De(e){Zt.call(this,e)}De._configure=function(){Gt.Buffer&&(De.prototype._slice=Gt.Buffer.prototype.slice)};De.prototype.string=function(){var n=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+n,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+n,this.len))};De._configure()});var Xt=O((xo,zt)=>{"use strict";zt.exports=rn;var Ln=ce();(rn.prototype=Object.create(Ln.EventEmitter.prototype)).constructor=rn;function rn(e,n,t){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Ln.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!n,this.responseDelimited=!!t}rn.prototype.rpcCall=function e(n,t,o,r,i){if(!r)throw TypeError("request must be specified");var s=this;if(!i)return Ln.asPromise(e,s,n,t,o,r);if(!s.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return s.rpcImpl(n,t[s.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(u,a){if(u)return s.emit("error",u,n),i(u);if(a===null){s.end(!0);return}if(!(a instanceof o))try{a=o[s.responseDelimited?"decodeDelimited":"decode"](a)}catch(l){return s.emit("error",l,n),i(l)}return s.emit("data",a,n),i(null,a)})}catch(f){s.emit("error",f,n),setTimeout(function(){i(f)},0);return}};rn.prototype.end=function(n){return this.rpcImpl&&(n||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Yt=O(Qt=>{"use strict";var Lr=Qt;Lr.Service=Xt()});var ei=O((wo,jt)=>{"use strict";jt.exports={}});var ii=O(ti=>{"use strict";var A=ti;A.build="minimal";A.Writer=Pn();A.BufferWriter=Jt();A.Reader=Bn();A.BufferReader=Kt();A.util=ce();A.rpc=Yt();A.roots=ei();A.configure=ni;function ni(){A.util._configure(),A.Writer._configure(A.BufferWriter),A.Reader._configure(A.BufferReader)}ni()});var P=O((Bo,ri)=>{"use strict";ri.exports=ii()});var Ni=O((Yo,Ei)=>{Ei.exports=v;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 v(e,n,t){this.low=e|0,this.high=n|0,this.unsigned=!!t}v.prototype.__isLong__;Object.defineProperty(v.prototype,"__isLong__",{value:!0});function L(e){return(e&&e.__isLong__)===!0}v.isLong=L;var ci={},pi={};function $e(e,n){var t,o,r;return n?(e>>>=0,(r=0<=e&&e<256)&&(o=pi[e],o)?o:(t=b(e,(e|0)<0?-1:0,!0),r&&(pi[e]=t),t)):(e|=0,(r=-128<=e&&e<128)&&(o=ci[e],o)?o:(t=b(e,e<0?-1:0,!1),r&&(ci[e]=t),t))}v.fromInt=$e;function H(e,n){if(isNaN(e))return n?We:K;if(n){if(e<0)return We;if(e>=Si)return bi}else{if(e<=-mi)return B;if(e+1>=mi)return vi}return e<0?H(-e,n).neg():b(e%Ye|0,e/Ye|0,n)}v.fromNumber=H;function b(e,n,t){return new v(e,n,t)}v.fromBits=b;var yn=Math.pow;function Wn(e,n,t){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return K;if(typeof n=="number"?(t=n,n=!1):n=!!n,t=t||10,t<2||36<t)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return Wn(e.substring(1),n,t).neg();for(var r=H(yn(t,8)),i=K,s=0;s<e.length;s+=8){var f=Math.min(8,e.length-s),u=parseInt(e.substring(s,s+f),t);if(f<8){var a=H(yn(t,f));i=i.mul(a).add(H(u))}else i=i.mul(r),i=i.add(H(u))}return i.unsigned=n,i}v.fromString=Wn;function ee(e,n){return typeof e=="number"?H(e,n):typeof e=="string"?Wn(e,n):b(e.low,e.high,typeof n=="boolean"?n:e.unsigned)}v.fromValue=ee;var hi=65536,Xr=1<<24,Ye=hi*hi,Si=Ye*Ye,mi=Si/2,gi=$e(Xr),K=$e(0);v.ZERO=K;var We=$e(0,!0);v.UZERO=We;var Qe=$e(1);v.ONE=Qe;var yi=$e(1,!0);v.UONE=yi;var Un=$e(-1);v.NEG_ONE=Un;var vi=b(-1,2147483647,!1);v.MAX_VALUE=vi;var bi=b(-1,-1,!0);v.MAX_UNSIGNED_VALUE=bi;var B=b(0,-2147483648,!1);v.MIN_VALUE=B;var d=v.prototype;d.toInt=function(){return this.unsigned?this.low>>>0:this.low};d.toNumber=function(){return this.unsigned?(this.high>>>0)*Ye+(this.low>>>0):this.high*Ye+(this.low>>>0)};d.toString=function(n){if(n=n||10,n<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(B)){var t=H(n),o=this.div(t),r=o.mul(t).sub(this);return o.toString(n)+r.toInt().toString(n)}else return"-"+this.neg().toString(n);for(var i=H(yn(n,6),this.unsigned),s=this,f="";;){var u=s.div(i),a=s.sub(u.mul(i)).toInt()>>>0,l=a.toString(n);if(s=u,s.isZero())return l+f;for(;l.length<6;)l="0"+l;f=""+l+f}};d.getHighBits=function(){return this.high};d.getHighBitsUnsigned=function(){return this.high>>>0};d.getLowBits=function(){return this.low};d.getLowBitsUnsigned=function(){return this.low>>>0};d.getNumBitsAbs=function(){if(this.isNegative())return this.eq(B)?64:this.neg().getNumBitsAbs();for(var n=this.high!=0?this.high:this.low,t=31;t>0&&!(n&1<<t);t--);return this.high!=0?t+33:t+1};d.isZero=function(){return this.high===0&&this.low===0};d.eqz=d.isZero;d.isNegative=function(){return!this.unsigned&&this.high<0};d.isPositive=function(){return this.unsigned||this.high>=0};d.isOdd=function(){return(this.low&1)===1};d.isEven=function(){return(this.low&1)===0};d.equals=function(n){return L(n)||(n=ee(n)),this.unsigned!==n.unsigned&&this.high>>>31===1&&n.high>>>31===1?!1:this.high===n.high&&this.low===n.low};d.eq=d.equals;d.notEquals=function(n){return!this.eq(n)};d.neq=d.notEquals;d.ne=d.notEquals;d.lessThan=function(n){return this.comp(n)<0};d.lt=d.lessThan;d.lessThanOrEqual=function(n){return this.comp(n)<=0};d.lte=d.lessThanOrEqual;d.le=d.lessThanOrEqual;d.greaterThan=function(n){return this.comp(n)>0};d.gt=d.greaterThan;d.greaterThanOrEqual=function(n){return this.comp(n)>=0};d.gte=d.greaterThanOrEqual;d.ge=d.greaterThanOrEqual;d.compare=function(n){if(L(n)||(n=ee(n)),this.eq(n))return 0;var t=this.isNegative(),o=n.isNegative();return t&&!o?-1:!t&&o?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1};d.comp=d.compare;d.negate=function(){return!this.unsigned&&this.eq(B)?B:this.not().add(Qe)};d.neg=d.negate;d.add=function(n){L(n)||(n=ee(n));var t=this.high>>>16,o=this.high&65535,r=this.low>>>16,i=this.low&65535,s=n.high>>>16,f=n.high&65535,u=n.low>>>16,a=n.low&65535,l=0,E=0,y=0,J=0;return J+=i+a,y+=J>>>16,J&=65535,y+=r+u,E+=y>>>16,y&=65535,E+=o+f,l+=E>>>16,E&=65535,l+=t+s,l&=65535,b(y<<16|J,l<<16|E,this.unsigned)};d.subtract=function(n){return L(n)||(n=ee(n)),this.add(n.neg())};d.sub=d.subtract;d.multiply=function(n){if(this.isZero())return K;if(L(n)||(n=ee(n)),Z){var t=Z.mul(this.low,this.high,n.low,n.high);return b(t,Z.get_high(),this.unsigned)}if(n.isZero())return K;if(this.eq(B))return n.isOdd()?B:K;if(n.eq(B))return this.isOdd()?B:K;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(gi)&&n.lt(gi))return H(this.toNumber()*n.toNumber(),this.unsigned);var o=this.high>>>16,r=this.high&65535,i=this.low>>>16,s=this.low&65535,f=n.high>>>16,u=n.high&65535,a=n.low>>>16,l=n.low&65535,E=0,y=0,J=0,cn=0;return cn+=s*l,J+=cn>>>16,cn&=65535,J+=i*l,y+=J>>>16,J&=65535,J+=s*a,y+=J>>>16,J&=65535,y+=r*l,E+=y>>>16,y&=65535,y+=i*a,E+=y>>>16,y&=65535,y+=s*u,E+=y>>>16,y&=65535,E+=o*l+r*a+i*u+s*f,E&=65535,b(J<<16|cn,E<<16|y,this.unsigned)};d.mul=d.multiply;d.divide=function(n){if(L(n)||(n=ee(n)),n.isZero())throw Error("division by zero");if(Z){if(!this.unsigned&&this.high===-2147483648&&n.low===-1&&n.high===-1)return this;var t=(this.unsigned?Z.div_u:Z.div_s)(this.low,this.high,n.low,n.high);return b(t,Z.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?We:K;var o,r,i;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return We;if(n.gt(this.shru(1)))return yi;i=We}else{if(this.eq(B)){if(n.eq(Qe)||n.eq(Un))return B;if(n.eq(B))return Qe;var s=this.shr(1);return o=s.div(n).shl(1),o.eq(K)?n.isNegative()?Qe:Un:(r=this.sub(n.mul(o)),i=o.add(r.div(n)),i)}else if(n.eq(B))return this.unsigned?We:K;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();i=K}for(r=this;r.gte(n);){o=Math.max(1,Math.floor(r.toNumber()/n.toNumber()));for(var f=Math.ceil(Math.log(o)/Math.LN2),u=f<=48?1:yn(2,f-48),a=H(o),l=a.mul(n);l.isNegative()||l.gt(r);)o-=u,a=H(o,this.unsigned),l=a.mul(n);a.isZero()&&(a=Qe),i=i.add(a),r=r.sub(l)}return i};d.div=d.divide;d.modulo=function(n){if(L(n)||(n=ee(n)),Z){var t=(this.unsigned?Z.rem_u:Z.rem_s)(this.low,this.high,n.low,n.high);return b(t,Z.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))};d.mod=d.modulo;d.rem=d.modulo;d.not=function(){return b(~this.low,~this.high,this.unsigned)};d.and=function(n){return L(n)||(n=ee(n)),b(this.low&n.low,this.high&n.high,this.unsigned)};d.or=function(n){return L(n)||(n=ee(n)),b(this.low|n.low,this.high|n.high,this.unsigned)};d.xor=function(n){return L(n)||(n=ee(n)),b(this.low^n.low,this.high^n.high,this.unsigned)};d.shiftLeft=function(n){return L(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?b(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):b(0,this.low<<n-32,this.unsigned)};d.shl=d.shiftLeft;d.shiftRight=function(n){return L(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?b(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):b(this.high>>n-32,this.high>=0?0:-1,this.unsigned)};d.shr=d.shiftRight;d.shiftRightUnsigned=function(n){if(L(n)&&(n=n.toInt()),n&=63,n===0)return this;var t=this.high;if(n<32){var o=this.low;return b(o>>>n|t<<32-n,t>>>n,this.unsigned)}else return n===32?b(t,0,this.unsigned):b(t>>>n-32,0,this.unsigned)};d.shru=d.shiftRightUnsigned;d.shr_u=d.shiftRightUnsigned;d.toSigned=function(){return this.unsigned?b(this.low,this.high,!1):this};d.toUnsigned=function(){return this.unsigned?this:b(this.low,this.high,!0)};d.toBytes=function(n){return n?this.toBytesLE():this.toBytesBE()};d.toBytesLE=function(){var n=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,n&255,n>>>8&255,n>>>16&255,n>>>24]};d.toBytesBE=function(){var n=this.high,t=this.low;return[n>>>24,n>>>16&255,n>>>8&255,n&255,t>>>24,t>>>16&255,t>>>8&255,t&255]};v.fromBytes=function(n,t,o){return o?v.fromBytesLE(n,t):v.fromBytesBE(n,t)};v.fromBytesLE=function(n,t){return new v(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,t)};v.fromBytesBE=function(n,t){return new v(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],t)}});var Ue=x(P(),1);var M=x(P(),1);var c=new Map;var Me;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Me||(Me={}));function Dr(e){switch(e){case 0:case"NULL_VALUE":return Me.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Me.UNRECOGNIZED}}function Jr(e){switch(e){case Me.NULL_VALUE:return 0;case Me.UNRECOGNIZED:default:return-1}}function Dn(){return{fields:{}}}var C={$type:"google.protobuf.Struct",encode(e,n=M.default.Writer.create()){return Object.entries(e.fields).forEach(([t,o])=>{o!==void 0&&on.encode({key:t,value:o},n.uint32(10).fork()).ldelim()}),n},decode(e,n){let t=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Dn();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;let s=on.decode(t,t.uint32());s.value!==void 0&&(r.fields[s.key]=s.value);continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:si(e.fields)?Object.entries(e.fields).reduce((n,[t,o])=>(n[t]=o,n),{}):{}}},toJSON(e){let n={};if(e.fields){let t=Object.entries(e.fields);t.length>0&&(n.fields={},t.forEach(([o,r])=>{n.fields[o]=r}))}return n},create(e){return C.fromPartial(e??{})},fromPartial(e){let n=Dn();return n.fields=Object.entries(e.fields??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=r),t),{}),n},wrap(e){let n=Dn();if(e!==void 0)for(let t of Object.keys(e))n.fields[t]=e[t];return n},unwrap(e){let n={};if(e.fields)for(let t of Object.keys(e.fields))n[t]=e.fields[t];return n}};c.set(C.$type,C);function oi(){return{key:"",value:void 0}}var on={$type:"google.protobuf.Struct.FieldsEntry",encode(e,n=M.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==void 0&&_.encode(_.wrap(e.value),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=oi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=_.unwrap(_.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:ze(e.key)?globalThis.String(e.key):"",value:ze(e?.value)?e.value:void 0}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==void 0&&(n.value=e.value),n},create(e){return on.fromPartial(e??{})},fromPartial(e){let n=oi();return n.key=e.key??"",n.value=e.value??void 0,n}};c.set(on.$type,on);function Jn(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var _={$type:"google.protobuf.Value",encode(e,n=M.default.Writer.create()){return e.nullValue!==void 0&&n.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&n.uint32(17).double(e.numberValue),e.stringValue!==void 0&&n.uint32(26).string(e.stringValue),e.boolValue!==void 0&&n.uint32(32).bool(e.boolValue),e.structValue!==void 0&&C.encode(C.wrap(e.structValue),n.uint32(42).fork()).ldelim(),e.listValue!==void 0&&Je.encode(Je.wrap(e.listValue),n.uint32(50).fork()).ldelim(),n},decode(e,n){let t=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Jn();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.nullValue=t.int32();continue;case 2:if(i!==17)break;r.numberValue=t.double();continue;case 3:if(i!==26)break;r.stringValue=t.string();continue;case 4:if(i!==32)break;r.boolValue=t.bool();continue;case 5:if(i!==42)break;r.structValue=C.unwrap(C.decode(t,t.uint32()));continue;case 6:if(i!==50)break;r.listValue=Je.unwrap(Je.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{nullValue:ze(e.nullValue)?Dr(e.nullValue):void 0,numberValue:ze(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ze(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ze(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:si(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let n={};return e.nullValue!==void 0&&(n.nullValue=Jr(e.nullValue)),e.numberValue!==void 0&&(n.numberValue=e.numberValue),e.stringValue!==void 0&&(n.stringValue=e.stringValue),e.boolValue!==void 0&&(n.boolValue=e.boolValue),e.structValue!==void 0&&(n.structValue=e.structValue),e.listValue!==void 0&&(n.listValue=e.listValue),n},create(e){return _.fromPartial(e??{})},fromPartial(e){let n=Jn();return n.nullValue=e.nullValue??void 0,n.numberValue=e.numberValue??void 0,n.stringValue=e.stringValue??void 0,n.boolValue=e.boolValue??void 0,n.structValue=e.structValue??void 0,n.listValue=e.listValue??void 0,n},wrap(e){let n=Jn();if(e===null)n.nullValue=Me.NULL_VALUE;else if(typeof e=="boolean")n.boolValue=e;else if(typeof e=="number")n.numberValue=e;else if(typeof e=="string")n.stringValue=e;else if(globalThis.Array.isArray(e))n.listValue=e;else if(typeof e=="object")n.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return n},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}};c.set(_.$type,_);function Mn(){return{values:[]}}var Je={$type:"google.protobuf.ListValue",encode(e,n=M.default.Writer.create()){for(let t of e.values)_.encode(_.wrap(t),n.uint32(10).fork()).ldelim();return n},decode(e,n){let t=e instanceof M.default.Reader?e:M.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Mn();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(_.unwrap(_.decode(t,t.uint32())));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let n={};return e.values?.length&&(n.values=e.values),n},create(e){return Je.fromPartial(e??{})},fromPartial(e){let n=Mn();return n.values=e.values?.map(t=>t)||[],n},wrap(e){let n=Mn();return n.values=e??[],n},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(Je.$type,Je);function si(e){return typeof e=="object"&&e!==null}function ze(e){return e!=null}function ui(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var sn={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,n=Ue.default.Writer.create()){return e.subredditId!==""&&n.uint32(10).string(e.subredditId),e.subredditName!==""&&n.uint32(18).string(e.subredditName),e.userId!==""&&n.uint32(26).string(e.userId),e.appName!==""&&n.uint32(34).string(e.appName),e.appVersion!==""&&n.uint32(42).string(e.appVersion),e.postId!==""&&n.uint32(50).string(e.postId),n},decode(e,n){let t=e instanceof Ue.default.Reader?e:Ue.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ui();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subredditId=t.string();continue;case 2:if(i!==18)break;r.subredditName=t.string();continue;case 3:if(i!==26)break;r.userId=t.string();continue;case 4:if(i!==34)break;r.appName=t.string();continue;case 5:if(i!==42)break;r.appVersion=t.string();continue;case 6:if(i!==50)break;r.postId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{subredditId:Xe(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:Xe(e.subredditName)?globalThis.String(e.subredditName):"",userId:Xe(e.userId)?globalThis.String(e.userId):"",appName:Xe(e.appName)?globalThis.String(e.appName):"",appVersion:Xe(e.appVersion)?globalThis.String(e.appVersion):"",postId:Xe(e.postId)?globalThis.String(e.postId):""}},toJSON(e){let n={};return e.subredditId!==""&&(n.subredditId=e.subredditId),e.subredditName!==""&&(n.subredditName=e.subredditName),e.userId!==""&&(n.userId=e.userId),e.appName!==""&&(n.appName=e.appName),e.appVersion!==""&&(n.appVersion=e.appVersion),e.postId!==""&&(n.postId=e.postId),n},create(e){return sn.fromPartial(e??{})},fromPartial(e){let n=ui();return n.subredditId=e.subredditId??"",n.subredditName=e.subredditName??"",n.userId=e.userId??"",n.appName=e.appName??"",n.appVersion=e.appVersion??"",n.postId=e.postId??"",n}};c.set(sn.$type,sn);function ai(){return{developerData:void 0}}var un={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode(e,n=Ue.default.Writer.create()){return e.developerData!==void 0&&C.encode(C.wrap(e.developerData),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof Ue.default.Reader?e:Ue.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ai();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 2:if(i!==18)break;r.developerData=C.unwrap(C.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{developerData:Mr(e.developerData)?e.developerData:void 0}},toJSON(e){let n={};return e.developerData!==void 0&&(n.developerData=e.developerData),n},create(e){return un.fromPartial(e??{})},fromPartial(e){let n=ai();return n.developerData=e.developerData??void 0,n}};c.set(un.$type,un);function Mr(e){return typeof e=="object"&&e!==null}function Xe(e){return e!=null}function Sn(e,n){if(!e)throw Error(n)}var he;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(he||(he={}));function Ur(e){return e.startsWith(he.ACCOUNT)}function Wr(e){return e.startsWith(he.LINK)}function $r(e){return e.startsWith(he.SUBREDDIT)}function qr(e){Sn(Ur(e),`Expected account id to start with ${he.ACCOUNT}, got ${e}}`)}function Gr(e){Sn(Wr(e),`Expected link id to start with ${he.LINK}, got ${e}}`)}function Zr(e){Sn($r(e),`Expected subreddit id to start with ${he.SUBREDDIT}, got ${e}}`)}function di(e){return qr(e),e}function fi(e){return Gr(e),e}function li(e){return Zr(e),e}var Hr=({search:e,hash:n})=>{let t=new URLSearchParams(e).get("context");if(t){let o=decodeURIComponent(t),r=sn.fromJSON(JSON.parse(o)),i=Kr(n),s={subredditId:li(r.subredditId),userId:di(r.userId),subredditName:r.subredditName,appName:r.appName,appVersion:r.appVersion,postId:fi(r.postId),postData:i?.developerData};globalThis.devvit={context:s}}};globalThis.location&&Hr(globalThis.location);function Kr(e){let n=e?.slice(1);if(n)try{return un.fromJSON(JSON.parse(decodeURIComponent(n)))}catch(t){console.error("Error parsing post data from hash",t);return}}var zr=new Proxy({},{get:(e,n)=>globalThis.devvit.context[n],ownKeys(){return Object.keys(globalThis.devvit.context)},getOwnPropertyDescriptor(e,n){return{enumerable:!0,configurable:!0,value:globalThis.devvit.context[n]}}});var V=x(P(),1);var R=x(P(),1);var S=x(P(),1);var $n=x(Ni(),1),qe=x(P(),1);function Ti(){return{seconds:0,nanos:0}}var Ge={$type:"google.protobuf.Timestamp",encode(e,n=qe.default.Writer.create()){return e.seconds!==0&&n.uint32(8).int64(e.seconds),e.nanos!==0&&n.uint32(16).int32(e.nanos),n},decode(e,n){let t=e instanceof qe.default.Reader?e:qe.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ti();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.seconds=Qr(t.int64());continue;case 2:if(i!==16)break;r.nanos=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{seconds:Ii(e.seconds)?globalThis.Number(e.seconds):0,nanos:Ii(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let n={};return e.seconds!==0&&(n.seconds=Math.round(e.seconds)),e.nanos!==0&&(n.nanos=Math.round(e.nanos)),n},create(e){return Ge.fromPartial(e??{})},fromPartial(e){let n=Ti();return n.seconds=e.seconds??0,n.nanos=e.nanos??0,n}};c.set(Ge.$type,Ge);function Qr(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}qe.default.util.Long!==$n.default&&(qe.default.util.Long=$n.default,qe.default.configure());function Ii(e){return e!=null}var te;(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"})(te||(te={}));function Xn(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return te.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return te.REVOKED;case 2:case"GRANTED":return te.GRANTED;case-1:case"UNRECOGNIZED":default:return te.UNRECOGNIZED}}function Qn(e){switch(e){case te.CONSENT_STATUS_UNKNOWN:return 0;case te.REVOKED:return 1;case te.GRANTED:return 2;case te.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 vn(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 bn(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 Oi(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var me={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,n=S.default.Writer.create()){e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.subredditId!==""&&n.uint32(18).string(e.subredditId),n.uint32(26).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),e.consentStatus!==0&&n.uint32(32).int32(e.consentStatus),e.updatedAt!==void 0&&Ge.encode(Yr(e.updatedAt),n.uint32(42).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Oi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.subredditId=t.string();continue;case 3:if(i===24){r.scopes.push(t.int32());continue}if(i===26){let s=t.uint32()+t.pos;for(;t.pos<s;)r.scopes.push(t.int32());continue}break;case 4:if(i!==32)break;r.consentStatus=t.int32();continue;case 5:if(i!==42)break;r.updatedAt=wi(Ge.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>vn(n)):[],consentStatus:k(e.consentStatus)?Xn(e.consentStatus):0,updatedAt:k(e.updatedAt)?jr(e.updatedAt):void 0}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.subredditId!==""&&(n.subredditId=e.subredditId),e.scopes?.length&&(n.scopes=e.scopes.map(t=>bn(t))),e.consentStatus!==0&&(n.consentStatus=Qn(e.consentStatus)),e.updatedAt!==void 0&&(n.updatedAt=e.updatedAt.toISOString()),n},create(e){return me.fromPartial(e??{})},fromPartial(e){let n=Oi();return n.appSlug=e.appSlug??"",n.subredditId=e.subredditId??"",n.scopes=e.scopes?.map(t=>t)||[],n.consentStatus=e.consentStatus??0,n.updatedAt=e.updatedAt??void 0,n}};c.set(me.$type,me);function Fi(){return{appSlug:"",appName:""}}var ge={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,n=S.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.appName!==""&&n.uint32(18).string(e.appName),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Fi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.appName=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",appName:k(e.appName)?globalThis.String(e.appName):""}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.appName!==""&&(n.appName=e.appName),n},create(e){return ge.fromPartial(e??{})},fromPartial(e){let n=Fi();return n.appSlug=e.appSlug??"",n.appName=e.appName??"",n}};c.set(ge.$type,ge);function Ci(){return{userId:""}}var qn={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,n=S.default.Writer.create()){return e.userId!==""&&n.uint32(10).string(e.userId),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ci();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{userId:k(e.userId)?globalThis.String(e.userId):""}},toJSON(e){let n={};return e.userId!==""&&(n.userId=e.userId),n},create(e){return qn.fromPartial(e??{})},fromPartial(e){let n=Ci();return n.userId=e.userId??"",n}};c.set(qn.$type,qn);function _i(){return{appPermissions:[],devvitApps:[]}}var Gn={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,n=S.default.Writer.create()){for(let t of e.appPermissions)me.encode(t,n.uint32(10).fork()).ldelim();for(let t of e.devvitApps)ge.encode(t,n.uint32(18).fork()).ldelim();return n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=_i();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appPermissions.push(me.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.devvitApps.push(ge.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(n=>me.fromJSON(n)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(n=>ge.fromJSON(n)):[]}},toJSON(e){let n={};return e.appPermissions?.length&&(n.appPermissions=e.appPermissions.map(t=>me.toJSON(t))),e.devvitApps?.length&&(n.devvitApps=e.devvitApps.map(t=>ge.toJSON(t))),n},create(e){return Gn.fromPartial(e??{})},fromPartial(e){let n=_i();return n.appPermissions=e.appPermissions?.map(t=>me.fromPartial(t))||[],n.devvitApps=e.devvitApps?.map(t=>ge.fromPartial(t))||[],n}};c.set(Gn.$type,Gn);function ki(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Zn={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,n=S.default.Writer.create()){e.userId!==""&&n.uint32(10).string(e.userId),e.appSlug!==""&&n.uint32(18).string(e.appSlug),e.subredditId!==""&&n.uint32(26).string(e.subredditId),n.uint32(34).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ki();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=t.string();continue;case 2:if(i!==18)break;r.appSlug=t.string();continue;case 3:if(i!==26)break;r.subredditId=t.string();continue;case 4:if(i===32){r.scopes.push(t.int32());continue}if(i===34){let s=t.uint32()+t.pos;for(;t.pos<s;)r.scopes.push(t.int32());continue}break}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{userId:k(e.userId)?globalThis.String(e.userId):"",appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>vn(n)):[]}},toJSON(e){let n={};return e.userId!==""&&(n.userId=e.userId),e.appSlug!==""&&(n.appSlug=e.appSlug),e.subredditId!==""&&(n.subredditId=e.subredditId),e.scopes?.length&&(n.scopes=e.scopes.map(t=>bn(t))),n},create(e){return Zn.fromPartial(e??{})},fromPartial(e){let n=ki();return n.userId=e.userId??"",n.appSlug=e.appSlug??"",n.subredditId=e.subredditId??"",n.scopes=e.scopes?.map(t=>t)||[],n}};c.set(Zn.$type,Zn);function Ri(){return{error:void 0}}var Hn={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,n=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ri();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=U.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{error:k(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let n={};return e.error!==void 0&&(n.error=U.toJSON(e.error)),n},create(e){return Hn.fromPartial(e??{})},fromPartial(e){let n=Ri();return n.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,n}};c.set(Hn.$type,Hn);function Vi(){return{appSlug:"",userId:"",subredditId:""}}var Kn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,n=S.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.userId!==""&&n.uint32(18).string(e.userId),e.subredditId!==""&&n.uint32(26).string(e.subredditId),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Vi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.userId=t.string();continue;case 3:if(i!==26)break;r.subredditId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",userId:k(e.userId)?globalThis.String(e.userId):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):""}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.userId!==""&&(n.userId=e.userId),e.subredditId!==""&&(n.subredditId=e.subredditId),n},create(e){return Kn.fromPartial(e??{})},fromPartial(e){let n=Vi();return n.appSlug=e.appSlug??"",n.userId=e.userId??"",n.subredditId=e.subredditId??"",n}};c.set(Kn.$type,Kn);function xi(){return{error:void 0}}var zn={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,n=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=xi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=U.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{error:k(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let n={};return e.error!==void 0&&(n.error=U.toJSON(e.error)),n},create(e){return zn.fromPartial(e??{})},fromPartial(e){let n=xi();return n.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,n}};c.set(zn.$type,zn);function Pi(){return{message:""}}var U={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,n=S.default.Writer.create()){return e.message!==""&&n.uint32(10).string(e.message),n},decode(e,n){let t=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Pi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{message:k(e.message)?globalThis.String(e.message):""}},toJSON(e){let n={};return e.message!==""&&(n.message=e.message),n},create(e){return U.fromPartial(e??{})},fromPartial(e){let n=Pi();return n.message=e.message??"",n}};c.set(U.$type,U);function Yr(e){let n=Math.trunc(e.getTime()/1e3),t=e.getTime()%1e3*1e6;return{seconds:n,nanos:t}}function wi(e){let n=(e.seconds||0)*1e3;return n+=(e.nanos||0)/1e6,new globalThis.Date(n)}function jr(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):wi(Ge.fromJSON(e))}function k(e){return e!=null}function Ai(){return{app:void 0,scopes:[],subreddit:void 0,redditor:void 0}}var Yn={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect",encode(e,n=R.default.Writer.create()){e.app!==void 0&&ye.encode(e.app,n.uint32(10).fork()).ldelim(),n.uint32(18).fork();for(let t of e.scopes)n.int32(t);return n.ldelim(),e.subreddit!==void 0&&ve.encode(e.subreddit,n.uint32(26).fork()).ldelim(),e.redditor!==void 0&&Se.encode(e.redditor,n.uint32(34).fork()).ldelim(),n},decode(e,n){let t=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ai();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.app=ye.decode(t,t.uint32());continue;case 2:if(i===16){r.scopes.push(t.int32());continue}if(i===18){let s=t.uint32()+t.pos;for(;t.pos<s;)r.scopes.push(t.int32());continue}break;case 3:if(i!==26)break;r.subreddit=ve.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.redditor=Se.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{app:w(e.app)?ye.fromJSON(e.app):void 0,scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(n=>vn(n)):[],subreddit:w(e.subreddit)?ve.fromJSON(e.subreddit):void 0,redditor:w(e.redditor)?Se.fromJSON(e.redditor):void 0}},toJSON(e){let n={};return e.app!==void 0&&(n.app=ye.toJSON(e.app)),e.scopes?.length&&(n.scopes=e.scopes.map(t=>bn(t))),e.subreddit!==void 0&&(n.subreddit=ve.toJSON(e.subreddit)),e.redditor!==void 0&&(n.redditor=Se.toJSON(e.redditor)),n},create(e){return Yn.fromPartial(e??{})},fromPartial(e){let n=Ai();return n.app=e.app!==void 0&&e.app!==null?ye.fromPartial(e.app):void 0,n.scopes=e.scopes?.map(t=>t)||[],n.subreddit=e.subreddit!==void 0&&e.subreddit!==null?ve.fromPartial(e.subreddit):void 0,n.redditor=e.redditor!==void 0&&e.redditor!==null?Se.fromPartial(e.redditor):void 0,n}};c.set(Yn.$type,Yn);function Bi(){return{id:"",icon:void 0,snoovatarIcon:void 0}}var Se={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Redditor",encode(e,n=R.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.icon!==void 0&&n.uint32(18).string(e.icon),e.snoovatarIcon!==void 0&&n.uint32(26).string(e.snoovatarIcon),n},decode(e,n){let t=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Bi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.icon=t.string();continue;case 3:if(i!==26)break;r.snoovatarIcon=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:w(e.id)?globalThis.String(e.id):"",icon:w(e.icon)?globalThis.String(e.icon):void 0,snoovatarIcon:w(e.snoovatarIcon)?globalThis.String(e.snoovatarIcon):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.icon!==void 0&&(n.icon=e.icon),e.snoovatarIcon!==void 0&&(n.snoovatarIcon=e.snoovatarIcon),n},create(e){return Se.fromPartial(e??{})},fromPartial(e){let n=Bi();return n.id=e.id??"",n.icon=e.icon??void 0,n.snoovatarIcon=e.snoovatarIcon??void 0,n}};c.set(Se.$type,Se);function Li(){return{appSlug:"",appName:"",termsAndConditionsUrl:void 0,privacyPolicyUrl:void 0}}var ye={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.DevvitApp",encode(e,n=R.default.Writer.create()){return e.appSlug!==""&&n.uint32(10).string(e.appSlug),e.appName!==""&&n.uint32(18).string(e.appName),e.termsAndConditionsUrl!==void 0&&n.uint32(26).string(e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&n.uint32(34).string(e.privacyPolicyUrl),n},decode(e,n){let t=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Li();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=t.string();continue;case 2:if(i!==18)break;r.appName=t.string();continue;case 3:if(i!==26)break;r.termsAndConditionsUrl=t.string();continue;case 4:if(i!==34)break;r.privacyPolicyUrl=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",appName:w(e.appName)?globalThis.String(e.appName):"",termsAndConditionsUrl:w(e.termsAndConditionsUrl)?globalThis.String(e.termsAndConditionsUrl):void 0,privacyPolicyUrl:w(e.privacyPolicyUrl)?globalThis.String(e.privacyPolicyUrl):void 0}},toJSON(e){let n={};return e.appSlug!==""&&(n.appSlug=e.appSlug),e.appName!==""&&(n.appName=e.appName),e.termsAndConditionsUrl!==void 0&&(n.termsAndConditionsUrl=e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&(n.privacyPolicyUrl=e.privacyPolicyUrl),n},create(e){return ye.fromPartial(e??{})},fromPartial(e){let n=Li();return n.appSlug=e.appSlug??"",n.appName=e.appName??"",n.termsAndConditionsUrl=e.termsAndConditionsUrl??void 0,n.privacyPolicyUrl=e.privacyPolicyUrl??void 0,n}};c.set(ye.$type,ye);function Di(){return{id:"",name:"",isNsfw:void 0,icon:void 0}}var ve={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Subreddit",encode(e,n=R.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.name!==""&&n.uint32(18).string(e.name),e.isNsfw!==void 0&&n.uint32(24).bool(e.isNsfw),e.icon!==void 0&&n.uint32(34).string(e.icon),n},decode(e,n){let t=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Di();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.name=t.string();continue;case 3:if(i!==24)break;r.isNsfw=t.bool();continue;case 4:if(i!==34)break;r.icon=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:w(e.id)?globalThis.String(e.id):"",name:w(e.name)?globalThis.String(e.name):"",isNsfw:w(e.isNsfw)?globalThis.Boolean(e.isNsfw):void 0,icon:w(e.icon)?globalThis.String(e.icon):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.name!==""&&(n.name=e.name),e.isNsfw!==void 0&&(n.isNsfw=e.isNsfw),e.icon!==void 0&&(n.icon=e.icon),n},create(e){return ve.fromPartial(e??{})},fromPartial(e){let n=Di();return n.id=e.id??"",n.name=e.name??"",n.isNsfw=e.isNsfw??void 0,n.icon=e.icon??void 0,n}};c.set(ve.$type,ve);function Ji(){return{consentStatus:0}}var re={$type:"devvit.ui.effects.v1alpha.AppPermissionsConsentSubmittedEvent",encode(e,n=R.default.Writer.create()){return e.consentStatus!==0&&n.uint32(8).int32(e.consentStatus),n},decode(e,n){let t=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ji();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.consentStatus=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{consentStatus:w(e.consentStatus)?Xn(e.consentStatus):0}},toJSON(e){let n={};return e.consentStatus!==0&&(n.consentStatus=Qn(e.consentStatus)),n},create(e){return re.fromPartial(e??{})},fromPartial(e){let n=Ji();return n.consentStatus=e.consentStatus??0,n}};c.set(re.$type,re);function w(e){return e!=null}var He=x(P(),1);var Ze=x(P(),1);var En=x(P(),1);function Mi(){return{}}var Nn={$type:"google.protobuf.Empty",encode(e,n=En.default.Writer.create()){return n},decode(e,n){let t=e instanceof En.default.Reader?e:En.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Mi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Nn.fromPartial(e??{})},fromPartial(e){return Mi()}};c.set(Nn.$type,Nn);function Ui(){return{channels:[]}}var jn={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,n=Ze.default.Writer.create()){for(let t of e.channels)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof Ze.default.Reader?e:Ze.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ui();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channels.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.channels?.length&&(n.channels=e.channels),n},create(e){return jn.fromPartial(e??{})},fromPartial(e){let n=Ui();return n.channels=e.channels?.map(t=>t)||[],n}};c.set(jn.$type,jn);function Wi(){return{channel:"",data:void 0}}var oe={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,n=Ze.default.Writer.create()){return e.channel!==""&&n.uint32(10).string(e.channel),e.data!==void 0&&C.encode(C.wrap(e.data),n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof Ze.default.Reader?e:Ze.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Wi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channel=t.string();continue;case 2:if(i!==18)break;r.data=C.unwrap(C.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{channel:no(e.channel)?globalThis.String(e.channel):"",data:eo(e.data)?e.data:void 0}},toJSON(e){let n={};return e.channel!==""&&(n.channel=e.channel),e.data!==void 0&&(n.data=e.data),n},create(e){return oe.fromPartial(e??{})},fromPartial(e){let n=Wi();return n.channel=e.channel??"",n.data=e.data??void 0,n}};c.set(oe.$type,oe);function eo(e){return typeof e=="object"&&e!==null}function no(e){return e!=null}var be;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(be||(be={}));function to(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return be.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return be.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return be.UNRECOGNIZED}}function io(e){switch(e){case be.REALTIME_SUBSCRIBED:return 0;case be.REALTIME_UNSUBSCRIBED:return 1;case be.UNRECOGNIZED:default:return-1}}function $i(){return{subscriptionIds:[]}}var et={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,n=He.default.Writer.create()){for(let t of e.subscriptionIds)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof He.default.Reader?e:He.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=$i();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subscriptionIds.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.subscriptionIds?.length&&(n.subscriptionIds=e.subscriptionIds),n},create(e){return et.fromPartial(e??{})},fromPartial(e){let n=$i();return n.subscriptionIds=e.subscriptionIds?.map(t=>t)||[],n}};c.set(et.$type,et);function qi(){return{event:void 0,status:void 0}}var se={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,n=He.default.Writer.create()){return e.event!==void 0&&oe.encode(e.event,n.uint32(10).fork()).ldelim(),e.status!==void 0&&n.uint32(16).int32(e.status),n},decode(e,n){let t=e instanceof He.default.Reader?e:He.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=qi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.event=oe.decode(t,t.uint32());continue;case 2:if(i!==16)break;r.status=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{event:Gi(e.event)?oe.fromJSON(e.event):void 0,status:Gi(e.status)?to(e.status):void 0}},toJSON(e){let n={};return e.event!==void 0&&(n.event=oe.toJSON(e.event)),e.status!==void 0&&(n.status=io(e.status)),n},create(e){return se.fromPartial(e??{})},fromPartial(e){let n=qi();return n.event=e.event!==void 0&&e.event!==null?oe.fromPartial(e.event):void 0,n.status=e.status??void 0,n}};c.set(se.$type,se);function Gi(e){return e!=null}var q=x(P(),1);var Tn=x(P(),1);var g=x(P(),1);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={}));function je(e){switch(e){case 0:case"STRING":return I.STRING;case 1:case"PARAGRAPH":return I.PARAGRAPH;case 2:case"NUMBER":return I.NUMBER;case 3:case"BOOLEAN":return I.BOOLEAN;case 4:case"LIST":return I.LIST;case 5:case"SELECTION":return I.SELECTION;case 6:case"GROUP":return I.GROUP;case 7:case"IMAGE":return I.IMAGE;case-1:case"UNRECOGNIZED":default:return I.UNRECOGNIZED}}function en(e){switch(e){case I.STRING:return 0;case I.PARAGRAPH:return 1;case I.NUMBER:return 2;case I.BOOLEAN:return 3;case I.LIST:return 4;case I.SELECTION:return 5;case I.GROUP:return 6;case I.IMAGE:return 7;case I.UNRECOGNIZED:default:return-1}}var W=x(P(),1);function Zi(){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 N={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,n=W.default.Writer.create()){return e.fieldType!==0&&n.uint32(8).int32(e.fieldType),e.isSecret!==void 0&&n.uint32(800).bool(e.isSecret),e.stringValue!==void 0&&n.uint32(18).string(e.stringValue),e.numberValue!==void 0&&n.uint32(25).double(e.numberValue),e.boolValue!==void 0&&n.uint32(32).bool(e.boolValue),e.listValue!==void 0&&Ee.encode(e.listValue,n.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Ne.encode(e.selectionValue,n.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Te.encode(e.groupValue,n.uint32(58).fork()).ldelim(),n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Zi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.fieldType=t.int32();continue;case 100:if(i!==800)break;r.isSecret=t.bool();continue;case 2:if(i!==18)break;r.stringValue=t.string();continue;case 3:if(i!==25)break;r.numberValue=t.double();continue;case 4:if(i!==32)break;r.boolValue=t.bool();continue;case 5:if(i!==42)break;r.listValue=Ee.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.selectionValue=Ne.decode(t,t.uint32());continue;case 7:if(i!==58)break;r.groupValue=Te.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fieldType:ue(e.fieldType)?je(e.fieldType):0,isSecret:ue(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ue(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ue(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ue(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ue(e.listValue)?Ee.fromJSON(e.listValue):void 0,selectionValue:ue(e.selectionValue)?Ne.fromJSON(e.selectionValue):void 0,groupValue:ue(e.groupValue)?Te.fromJSON(e.groupValue):void 0}},toJSON(e){let n={};return e.fieldType!==0&&(n.fieldType=en(e.fieldType)),e.isSecret!==void 0&&(n.isSecret=e.isSecret),e.stringValue!==void 0&&(n.stringValue=e.stringValue),e.numberValue!==void 0&&(n.numberValue=e.numberValue),e.boolValue!==void 0&&(n.boolValue=e.boolValue),e.listValue!==void 0&&(n.listValue=Ee.toJSON(e.listValue)),e.selectionValue!==void 0&&(n.selectionValue=Ne.toJSON(e.selectionValue)),e.groupValue!==void 0&&(n.groupValue=Te.toJSON(e.groupValue)),n},create(e){return N.fromPartial(e??{})},fromPartial(e){let n=Zi();return n.fieldType=e.fieldType??0,n.isSecret=e.isSecret??void 0,n.stringValue=e.stringValue??void 0,n.numberValue=e.numberValue??void 0,n.boolValue=e.boolValue??void 0,n.listValue=e.listValue!==void 0&&e.listValue!==null?Ee.fromPartial(e.listValue):void 0,n.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Ne.fromPartial(e.selectionValue):void 0,n.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Te.fromPartial(e.groupValue):void 0,n}};c.set(N.$type,N);function Hi(){return{itemType:0,items:[]}}var Ee={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,n=W.default.Writer.create()){e.itemType!==0&&n.uint32(8).int32(e.itemType);for(let t of e.items)N.encode(t,n.uint32(18).fork()).ldelim();return n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Hi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=t.int32();continue;case 2:if(i!==18)break;r.items.push(N.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{itemType:ue(e.itemType)?je(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(n=>N.fromJSON(n)):[]}},toJSON(e){let n={};return e.itemType!==0&&(n.itemType=en(e.itemType)),e.items?.length&&(n.items=e.items.map(t=>N.toJSON(t))),n},create(e){return Ee.fromPartial(e??{})},fromPartial(e){let n=Hi();return n.itemType=e.itemType??0,n.items=e.items?.map(t=>N.fromPartial(t))||[],n}};c.set(Ee.$type,Ee);function Ki(){return{values:[]}}var Ne={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,n=W.default.Writer.create()){for(let t of e.values)n.uint32(10).string(t);return n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Ki();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(t.string());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(n=>globalThis.String(n)):[]}},toJSON(e){let n={};return e.values?.length&&(n.values=e.values),n},create(e){return Ne.fromPartial(e??{})},fromPartial(e){let n=Ki();return n.values=e.values?.map(t=>t)||[],n}};c.set(Ne.$type,Ne);function zi(){return{}}var Te={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,n=W.default.Writer.create()){return n},decode(e,n){let t=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=zi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Te.fromPartial(e??{})},fromPartial(e){return zi()}};c.set(Te.$type,Te);function ue(e){return e!=null}function Xi(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var D={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,n=g.default.Writer.create()){return e.fieldId!==""&&n.uint32(10).string(e.fieldId),e.fieldType!==0&&n.uint32(16).int32(e.fieldType),e.label!==""&&n.uint32(26).string(e.label),e.helpText!==void 0&&n.uint32(34).string(e.helpText),e.defaultValue!==void 0&&N.encode(e.defaultValue,n.uint32(42).fork()).ldelim(),e.required!==void 0&&n.uint32(48).bool(e.required),e.disabled!==void 0&&n.uint32(56).bool(e.disabled),e.fieldConfig!==void 0&&$.encode(e.fieldConfig,n.uint32(66).fork()).ldelim(),e.isSecret!==void 0&&n.uint32(72).bool(e.isSecret),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Xi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fieldId=t.string();continue;case 2:if(i!==16)break;r.fieldType=t.int32();continue;case 3:if(i!==26)break;r.label=t.string();continue;case 4:if(i!==34)break;r.helpText=t.string();continue;case 5:if(i!==42)break;r.defaultValue=N.decode(t,t.uint32());continue;case 6:if(i!==48)break;r.required=t.bool();continue;case 7:if(i!==56)break;r.disabled=t.bool();continue;case 8:if(i!==66)break;r.fieldConfig=$.decode(t,t.uint32());continue;case 9:if(i!==72)break;r.isSecret=t.bool();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?je(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)?N.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)?$.fromJSON(e.fieldConfig):void 0,isSecret:h(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let n={};return e.fieldId!==""&&(n.fieldId=e.fieldId),e.fieldType!==0&&(n.fieldType=en(e.fieldType)),e.label!==""&&(n.label=e.label),e.helpText!==void 0&&(n.helpText=e.helpText),e.defaultValue!==void 0&&(n.defaultValue=N.toJSON(e.defaultValue)),e.required!==void 0&&(n.required=e.required),e.disabled!==void 0&&(n.disabled=e.disabled),e.fieldConfig!==void 0&&(n.fieldConfig=$.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(n.isSecret=e.isSecret),n},create(e){return D.fromPartial(e??{})},fromPartial(e){let n=Xi();return n.fieldId=e.fieldId??"",n.fieldType=e.fieldType??0,n.label=e.label??"",n.helpText=e.helpText??void 0,n.defaultValue=e.defaultValue!==void 0&&e.defaultValue!==null?N.fromPartial(e.defaultValue):void 0,n.required=e.required??void 0,n.disabled=e.disabled??void 0,n.fieldConfig=e.fieldConfig!==void 0&&e.fieldConfig!==null?$.fromPartial(e.fieldConfig):void 0,n.isSecret=e.isSecret??void 0,n}};c.set(D.$type,D);function Qi(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var $={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,n=g.default.Writer.create()){return e.stringConfig!==void 0&&Ie.encode(e.stringConfig,n.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&Oe.encode(e.paragraphConfig,n.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Fe.encode(e.numberConfig,n.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&Ce.encode(e.booleanConfig,n.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&_e.encode(e.listConfig,n.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&ke.encode(e.selectionConfig,n.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Ve.encode(e.groupConfig,n.uint32(58).fork()).ldelim(),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Qi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=Ie.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=Oe.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.numberConfig=Fe.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=Ce.decode(t,t.uint32());continue;case 5:if(i!==42)break;r.listConfig=_e.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=ke.decode(t,t.uint32());continue;case 7:if(i!==58)break;r.groupConfig=Ve.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{stringConfig:h(e.stringConfig)?Ie.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?Oe.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?Fe.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?Ce.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?_e.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?ke.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?Ve.fromJSON(e.groupConfig):void 0}},toJSON(e){let n={};return e.stringConfig!==void 0&&(n.stringConfig=Ie.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(n.paragraphConfig=Oe.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(n.numberConfig=Fe.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(n.booleanConfig=Ce.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(n.listConfig=_e.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(n.selectionConfig=ke.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(n.groupConfig=Ve.toJSON(e.groupConfig)),n},create(e){return $.fromPartial(e??{})},fromPartial(e){let n=Qi();return n.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Ie.fromPartial(e.stringConfig):void 0,n.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?Oe.fromPartial(e.paragraphConfig):void 0,n.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Fe.fromPartial(e.numberConfig):void 0,n.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?Ce.fromPartial(e.booleanConfig):void 0,n.listConfig=e.listConfig!==void 0&&e.listConfig!==null?_e.fromPartial(e.listConfig):void 0,n.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?ke.fromPartial(e.selectionConfig):void 0,n.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Ve.fromPartial(e.groupConfig):void 0,n}};c.set($.$type,$);function Yi(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,n=g.default.Writer.create()){return e.minLength!==void 0&&n.uint32(8).int32(e.minLength),e.maxLength!==void 0&&n.uint32(16).int32(e.maxLength),e.placeholder!==void 0&&n.uint32(26).string(e.placeholder),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=Yi();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.minLength=t.int32();continue;case 2:if(i!==16)break;r.maxLength=t.int32();continue;case 3:if(i!==26)break;r.placeholder=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},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 n={};return e.minLength!==void 0&&(n.minLength=Math.round(e.minLength)),e.maxLength!==void 0&&(n.maxLength=Math.round(e.maxLength)),e.placeholder!==void 0&&(n.placeholder=e.placeholder),n},create(e){return Ie.fromPartial(e??{})},fromPartial(e){let n=Yi();return n.minLength=e.minLength??void 0,n.maxLength=e.maxLength??void 0,n.placeholder=e.placeholder??void 0,n}};c.set(Ie.$type,Ie);function ji(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Oe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,n=g.default.Writer.create()){return e.maxCharacters!==void 0&&n.uint32(8).int32(e.maxCharacters),e.lineHeight!==void 0&&n.uint32(16).int32(e.lineHeight),e.placeholder!==void 0&&n.uint32(26).string(e.placeholder),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ji();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.maxCharacters=t.int32();continue;case 2:if(i!==16)break;r.lineHeight=t.int32();continue;case 3:if(i!==26)break;r.placeholder=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},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 n={};return e.maxCharacters!==void 0&&(n.maxCharacters=Math.round(e.maxCharacters)),e.lineHeight!==void 0&&(n.lineHeight=Math.round(e.lineHeight)),e.placeholder!==void 0&&(n.placeholder=e.placeholder),n},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let n=ji();return n.maxCharacters=e.maxCharacters??void 0,n.lineHeight=e.lineHeight??void 0,n.placeholder=e.placeholder??void 0,n}};c.set(Oe.$type,Oe);function er(){return{step:void 0,min:void 0,max:void 0}}var Fe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,n=g.default.Writer.create()){return e.step!==void 0&&n.uint32(9).double(e.step),e.min!==void 0&&n.uint32(17).double(e.min),e.max!==void 0&&n.uint32(25).double(e.max),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=er();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==9)break;r.step=t.double();continue;case 2:if(i!==17)break;r.min=t.double();continue;case 3:if(i!==25)break;r.max=t.double();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},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 n={};return e.step!==void 0&&(n.step=e.step),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),n},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let n=er();return n.step=e.step??void 0,n.min=e.min??void 0,n.max=e.max??void 0,n}};c.set(Fe.$type,Fe);function nr(){return{}}var Ce={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,n=g.default.Writer.create()){return n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=nr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Ce.fromPartial(e??{})},fromPartial(e){return nr()}};c.set(Ce.$type,Ce);function tr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var _e={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,n=g.default.Writer.create()){return e.itemType!==0&&n.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&$.encode(e.itemConfig,n.uint32(18).fork()).ldelim(),e.minEntries!==void 0&&n.uint32(24).int32(e.minEntries),e.maxEntries!==void 0&&n.uint32(32).int32(e.maxEntries),e.entryLabel!==void 0&&n.uint32(42).string(e.entryLabel),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=tr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=t.int32();continue;case 2:if(i!==18)break;r.itemConfig=$.decode(t,t.uint32());continue;case 3:if(i!==24)break;r.minEntries=t.int32();continue;case 4:if(i!==32)break;r.maxEntries=t.int32();continue;case 5:if(i!==42)break;r.entryLabel=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{itemType:h(e.itemType)?je(e.itemType):0,itemConfig:h(e.itemConfig)?$.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 n={};return e.itemType!==0&&(n.itemType=en(e.itemType)),e.itemConfig!==void 0&&(n.itemConfig=$.toJSON(e.itemConfig)),e.minEntries!==void 0&&(n.minEntries=Math.round(e.minEntries)),e.maxEntries!==void 0&&(n.maxEntries=Math.round(e.maxEntries)),e.entryLabel!==void 0&&(n.entryLabel=e.entryLabel),n},create(e){return _e.fromPartial(e??{})},fromPartial(e){let n=tr();return n.itemType=e.itemType??0,n.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?$.fromPartial(e.itemConfig):void 0,n.minEntries=e.minEntries??void 0,n.maxEntries=e.maxEntries??void 0,n.entryLabel=e.entryLabel??void 0,n}};c.set(_e.$type,_e);function ir(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var ke={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,n=g.default.Writer.create()){for(let t of e.choices)Re.encode(t,n.uint32(10).fork()).ldelim();return e.multiSelect!==void 0&&n.uint32(16).bool(e.multiSelect),e.minSelections!==void 0&&n.uint32(24).int32(e.minSelections),e.maxSelections!==void 0&&n.uint32(32).int32(e.maxSelections),e.renderAsList!==void 0&&n.uint32(40).bool(e.renderAsList),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ir();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.choices.push(Re.decode(t,t.uint32()));continue;case 2:if(i!==16)break;r.multiSelect=t.bool();continue;case 3:if(i!==24)break;r.minSelections=t.int32();continue;case 4:if(i!==32)break;r.maxSelections=t.int32();continue;case 5:if(i!==40)break;r.renderAsList=t.bool();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(n=>Re.fromJSON(n)):[],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 n={};return e.choices?.length&&(n.choices=e.choices.map(t=>Re.toJSON(t))),e.multiSelect!==void 0&&(n.multiSelect=e.multiSelect),e.minSelections!==void 0&&(n.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(n.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(n.renderAsList=e.renderAsList),n},create(e){return ke.fromPartial(e??{})},fromPartial(e){let n=ir();return n.choices=e.choices?.map(t=>Re.fromPartial(t))||[],n.multiSelect=e.multiSelect??void 0,n.minSelections=e.minSelections??void 0,n.maxSelections=e.maxSelections??void 0,n.renderAsList=e.renderAsList??void 0,n}};c.set(ke.$type,ke);function rr(){return{label:"",value:""}}var Re={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,n=g.default.Writer.create()){return e.label!==""&&n.uint32(10).string(e.label),e.value!==""&&n.uint32(18).string(e.value),n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=rr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.label=t.string();continue;case 2:if(i!==18)break;r.value=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{label:h(e.label)?globalThis.String(e.label):"",value:h(e.value)?globalThis.String(e.value):""}},toJSON(e){let n={};return e.label!==""&&(n.label=e.label),e.value!==""&&(n.value=e.value),n},create(e){return Re.fromPartial(e??{})},fromPartial(e){let n=rr();return n.label=e.label??"",n.value=e.value??"",n}};c.set(Re.$type,Re);function or(){return{fields:[]}}var Ve={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,n=g.default.Writer.create()){for(let t of e.fields)D.encode(t,n.uint32(10).fork()).ldelim();return n},decode(e,n){let t=e instanceof g.default.Reader?e:g.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=or();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(D.decode(t,t.uint32()));continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(n=>D.fromJSON(n)):[]}},toJSON(e){let n={};return e.fields?.length&&(n.fields=e.fields.map(t=>D.toJSON(t))),n},create(e){return Ve.fromPartial(e??{})},fromPartial(e){let n=or();return n.fields=e.fields?.map(t=>D.fromPartial(t))||[],n}};c.set(Ve.$type,Ve);function h(e){return e!=null}function sr(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var ae={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,n=Tn.default.Writer.create()){for(let t of e.fields)D.encode(t,n.uint32(10).fork()).ldelim();return e.title!==void 0&&n.uint32(18).string(e.title),e.shortDescription!==void 0&&n.uint32(26).string(e.shortDescription),e.acceptLabel!==void 0&&n.uint32(34).string(e.acceptLabel),e.cancelLabel!==void 0&&n.uint32(42).string(e.cancelLabel),e.id!==void 0&&n.uint32(50).string(e.id),n},decode(e,n){let t=e instanceof Tn.default.Reader?e:Tn.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=sr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(D.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.title=t.string();continue;case 3:if(i!==26)break;r.shortDescription=t.string();continue;case 4:if(i!==34)break;r.acceptLabel=t.string();continue;case 5:if(i!==42)break;r.cancelLabel=t.string();continue;case 6:if(i!==50)break;r.id=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(n=>D.fromJSON(n)):[],title:an(e.title)?globalThis.String(e.title):void 0,shortDescription:an(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:an(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:an(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:an(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let n={};return e.fields?.length&&(n.fields=e.fields.map(t=>D.toJSON(t))),e.title!==void 0&&(n.title=e.title),e.shortDescription!==void 0&&(n.shortDescription=e.shortDescription),e.acceptLabel!==void 0&&(n.acceptLabel=e.acceptLabel),e.cancelLabel!==void 0&&(n.cancelLabel=e.cancelLabel),e.id!==void 0&&(n.id=e.id),n},create(e){return ae.fromPartial(e??{})},fromPartial(e){let n=sr();return n.fields=e.fields?.map(t=>D.fromPartial(t))||[],n.title=e.title??void 0,n.shortDescription=e.shortDescription??void 0,n.acceptLabel=e.acceptLabel??void 0,n.cancelLabel=e.cancelLabel??void 0,n.id=e.id??void 0,n}};c.set(ae.$type,ae);function an(e){return e!=null}function ur(){return{form:void 0}}var nt={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,n=q.default.Writer.create()){return e.form!==void 0&&ae.encode(e.form,n.uint32(10).fork()).ldelim(),n},decode(e,n){let t=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ur();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=ae.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{form:fn(e.form)?ae.fromJSON(e.form):void 0}},toJSON(e){let n={};return e.form!==void 0&&(n.form=ae.toJSON(e.form)),n},create(e){return nt.fromPartial(e??{})},fromPartial(e){let n=ur();return n.form=e.form!==void 0&&e.form!==null?ae.fromPartial(e.form):void 0,n}};c.set(nt.$type,nt);function ar(){return{results:{},formId:void 0}}var de={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,n=q.default.Writer.create()){return Object.entries(e.results).forEach(([t,o])=>{dn.encode({key:t,value:o},n.uint32(10).fork()).ldelim()}),e.formId!==void 0&&n.uint32(18).string(e.formId),n},decode(e,n){let t=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=ar();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;let s=dn.decode(t,t.uint32());s.value!==void 0&&(r.results[s.key]=s.value);continue;case 2:if(i!==18)break;r.formId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{results:ro(e.results)?Object.entries(e.results).reduce((n,[t,o])=>(n[t]=N.fromJSON(o),n),{}):{},formId:fn(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let n={};if(e.results){let t=Object.entries(e.results);t.length>0&&(n.results={},t.forEach(([o,r])=>{n.results[o]=N.toJSON(r)}))}return e.formId!==void 0&&(n.formId=e.formId),n},create(e){return de.fromPartial(e??{})},fromPartial(e){let n=ar();return n.results=Object.entries(e.results??{}).reduce((t,[o,r])=>(r!==void 0&&(t[o]=N.fromPartial(r)),t),{}),n.formId=e.formId??void 0,n}};c.set(de.$type,de);function dr(){return{key:"",value:void 0}}var dn={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,n=q.default.Writer.create()){return e.key!==""&&n.uint32(10).string(e.key),e.value!==void 0&&N.encode(e.value,n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=dr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=t.string();continue;case 2:if(i!==18)break;r.value=N.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{key:fn(e.key)?globalThis.String(e.key):"",value:fn(e.value)?N.fromJSON(e.value):void 0}},toJSON(e){let n={};return e.key!==""&&(n.key=e.key),e.value!==void 0&&(n.value=N.toJSON(e.value)),n},create(e){return dn.fromPartial(e??{})},fromPartial(e){let n=dr();return n.key=e.key??"",n.value=e.value!==void 0&&e.value!==null?N.fromPartial(e.value):void 0,n}};c.set(dn.$type,dn);function fr(){return{formId:void 0}}var fe={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,n=q.default.Writer.create()){return e.formId!==void 0&&n.uint32(10).string(e.formId),n},decode(e,n){let t=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=fr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.formId=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{formId:fn(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let n={};return e.formId!==void 0&&(n.formId=e.formId),n},create(e){return fe.fromPartial(e??{})},fromPartial(e){let n=fr();return n.formId=e.formId??void 0,n}};c.set(fe.$type,fe);function ro(e){return typeof e=="object"&&e!==null}function fn(e){return e!=null}var In=x(P(),1);var ie;(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"})(ie||(ie={}));function it(e){switch(e){case 0:case"UNSPECIFIED":return ie.UNSPECIFIED;case 1:case"INLINE_MODE":return ie.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return ie.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return ie.UNRECOGNIZED}}function rt(e){switch(e){case ie.UNSPECIFIED:return 0;case ie.INLINE_MODE:return 1;case ie.IMMERSIVE_MODE:return 2;case ie.UNRECOGNIZED:default:return-1}}function lr(){return{immersiveMode:0}}var tt={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,n=In.default.Writer.create()){return e.immersiveMode!==0&&n.uint32(8).int32(e.immersiveMode),n},decode(e,n){let t=e instanceof In.default.Reader?e:In.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=lr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:oo(e.immersiveMode)?it(e.immersiveMode):0}},toJSON(e){let n={};return e.immersiveMode!==0&&(n.immersiveMode=rt(e.immersiveMode)),n},create(e){return tt.fromPartial(e??{})},fromPartial(e){let n=lr();return n.immersiveMode=e.immersiveMode??0,n}};c.set(tt.$type,tt);function oo(e){return e!=null}var Ae;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ae||(Ae={}));function so(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Ae.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Ae.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Ae.UNRECOGNIZED}}function uo(e){switch(e){case Ae.WEBVIEW_VISIBLE:return 0;case Ae.WEBVIEW_HIDDEN:return 1;case Ae.UNRECOGNIZED:default:return-1}}function cr(){return{message:void 0,jsonString:""}}var xe={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,n=V.default.Writer.create()){return e.message!==void 0&&_.encode(_.wrap(e.message),n.uint32(10).fork()).ldelim(),e.jsonString!==""&&n.uint32(18).string(e.jsonString),n},decode(e,n){let t=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=cr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=_.unwrap(_.decode(t,t.uint32()));continue;case 2:if(i!==18)break;r.jsonString=t.string();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{message:X(e?.message)?e.message:void 0,jsonString:X(e.jsonString)?globalThis.String(e.jsonString):""}},toJSON(e){let n={};return e.message!==void 0&&(n.message=e.message),e.jsonString!==""&&(n.jsonString=e.jsonString),n},create(e){return xe.fromPartial(e??{})},fromPartial(e){let n=cr();return n.message=e.message??void 0,n.jsonString=e.jsonString??"",n}};c.set(xe.$type,xe);function pr(){return{visibility:0}}var Pe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,n=V.default.Writer.create()){return e.visibility!==0&&n.uint32(8).int32(e.visibility),n},decode(e,n){let t=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=pr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.visibility=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{visibility:X(e.visibility)?so(e.visibility):0}},toJSON(e){let n={};return e.visibility!==0&&(n.visibility=uo(e.visibility)),n},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let n=pr();return n.visibility=e.visibility??0,n}};c.set(Pe.$type,Pe);function hr(){return{postMessage:void 0,fullScreen:void 0}}var ot={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,n=V.default.Writer.create()){return e.postMessage!==void 0&&xe.encode(e.postMessage,n.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Pe.encode(e.fullScreen,n.uint32(18).fork()).ldelim(),n},decode(e,n){let t=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=hr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=xe.decode(t,t.uint32());continue;case 2:if(i!==18)break;r.fullScreen=Pe.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{postMessage:X(e.postMessage)?xe.fromJSON(e.postMessage):void 0,fullScreen:X(e.fullScreen)?Pe.fromJSON(e.fullScreen):void 0}},toJSON(e){let n={};return e.postMessage!==void 0&&(n.postMessage=xe.toJSON(e.postMessage)),e.fullScreen!==void 0&&(n.fullScreen=Pe.toJSON(e.fullScreen)),n},create(e){return ot.fromPartial(e??{})},fromPartial(e){let n=hr();return n.postMessage=e.postMessage!==void 0&&e.postMessage!==null?xe.fromPartial(e.postMessage):void 0,n.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Pe.fromPartial(e.fullScreen):void 0,n}};c.set(ot.$type,ot);function mr(){return{immersiveMode:0}}var we={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,n=V.default.Writer.create()){return e.immersiveMode!==0&&n.uint32(8).int32(e.immersiveMode),n},decode(e,n){let t=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=mr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=t.int32();continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:X(e.immersiveMode)?it(e.immersiveMode):0}},toJSON(e){let n={};return e.immersiveMode!==0&&(n.immersiveMode=rt(e.immersiveMode)),n},create(e){return we.fromPartial(e??{})},fromPartial(e){let n=mr();return n.immersiveMode=e.immersiveMode??0,n}};c.set(we.$type,we);function gr(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,appPermissionsConsentSubmitted:void 0}}var ln={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,n=V.default.Writer.create()){return e.id!==""&&n.uint32(10).string(e.id),e.formCanceled!==void 0&&fe.encode(e.formCanceled,n.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&de.encode(e.formSubmitted,n.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&se.encode(e.realtimeEvent,n.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&we.encode(e.immersiveModeEvent,n.uint32(42).fork()).ldelim(),e.appPermissionsConsentSubmitted!==void 0&&re.encode(e.appPermissionsConsentSubmitted,n.uint32(50).fork()).ldelim(),n},decode(e,n){let t=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=n===void 0?t.len:t.pos+n,r=gr();for(;t.pos<o;){let i=t.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=t.string();continue;case 2:if(i!==18)break;r.formCanceled=fe.decode(t,t.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=de.decode(t,t.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=se.decode(t,t.uint32());continue;case 5:if(i!==42)break;r.immersiveModeEvent=we.decode(t,t.uint32());continue;case 6:if(i!==50)break;r.appPermissionsConsentSubmitted=re.decode(t,t.uint32());continue}if((i&7)===4||i===0)break;t.skipType(i&7)}return r},fromJSON(e){return{id:X(e.id)?globalThis.String(e.id):"",formCanceled:X(e.formCanceled)?fe.fromJSON(e.formCanceled):void 0,formSubmitted:X(e.formSubmitted)?de.fromJSON(e.formSubmitted):void 0,realtimeEvent:X(e.realtimeEvent)?se.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:X(e.immersiveModeEvent)?we.fromJSON(e.immersiveModeEvent):void 0,appPermissionsConsentSubmitted:X(e.appPermissionsConsentSubmitted)?re.fromJSON(e.appPermissionsConsentSubmitted):void 0}},toJSON(e){let n={};return e.id!==""&&(n.id=e.id),e.formCanceled!==void 0&&(n.formCanceled=fe.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(n.formSubmitted=de.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(n.realtimeEvent=se.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(n.immersiveModeEvent=we.toJSON(e.immersiveModeEvent)),e.appPermissionsConsentSubmitted!==void 0&&(n.appPermissionsConsentSubmitted=re.toJSON(e.appPermissionsConsentSubmitted)),n},create(e){return ln.fromPartial(e??{})},fromPartial(e){let n=gr();return n.id=e.id??"",n.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?fe.fromPartial(e.formCanceled):void 0,n.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?de.fromPartial(e.formSubmitted):void 0,n.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?se.fromPartial(e.realtimeEvent):void 0,n.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?we.fromPartial(e.immersiveModeEvent):void 0,n.appPermissionsConsentSubmitted=e.appPermissionsConsentSubmitted!==void 0&&e.appPermissionsConsentSubmitted!==null?re.fromPartial(e.appPermissionsConsentSubmitted):void 0,n}};c.set(ln.$type,ln);function X(e){return e!=null}var Sr=[3];var Be=e=>new Promise(n=>{let t={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?t.realtimeEffect=e.realtimeSubscriptions:t.effect=e,Sr.includes(e.type)){let o=self.crypto.randomUUID();t.id=o;let r=i=>{if(i.data?.type==="devvit-message"&&i.data?.data?.id===o){let s=ln.fromJSON(i.data.data);n(s),window.removeEventListener("message",r)}};window.addEventListener("message",r),window.parent.postMessage(t,"*")}else window.parent.postMessage(t,"*"),n(void 0)});function yr(e){let n;typeof e=="string"?n=new URL(e).toString():n=new URL(e.url).toString(),Be({navigateToUrl:{url:n},type:5})}function st(e,n=new Set){for(let t of e){if(t.type==="group"){st(t.fields,n);continue}let o=t.name;if(n.has(o))throw new Error(`Duplicate field name: ${o}`);n.add(o)}ao(e)}function ao(e){for(let n of e)if(n.type==="string"&&n.isSecret&&n.scope!=="app")throw`Invalid setting: only app settings can be secrets. Add "scope: SettingScope.App" to field "${n.name}"`}function fo(e){switch(e.fieldType){case 0:return e.stringValue;case 7:return e.stringValue;case 1:return e.stringValue;case 2:return e.numberValue;case 3:return e.boolValue;case 5:return e.selectionValue?.values??[];default:return}}function vr(e){return Object.keys(e).reduce((n,t)=>{let o=fo(e[t]);return o!==void 0&&(n[t]=o),n},{})}function ut(e){return e.map(n=>{switch(n.type){case"string":return lo(n);case"image":return co(n);case"paragraph":return po(n);case"number":return ho(n);case"select":return mo(n);case"boolean":return go(n);case"group":return So(n);default:throw new Error("Unknown field type.")}})}function lo(e){return{defaultValue:{fieldType:0,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{stringConfig:{placeholder:e.placeholder}},fieldId:e.name,fieldType:0,helpText:e.helpText,label:e.label,required:e.required,isSecret:e.isSecret}}function co(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function po(e){return{defaultValue:{fieldType:1,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{paragraphConfig:{lineHeight:e.lineHeight,placeholder:e.placeholder}},fieldId:e.name,fieldType:1,helpText:e.helpText,label:e.label,required:e.required}}function ho(e){return{defaultValue:{fieldType:2,numberValue:e.defaultValue},disabled:e.disabled,fieldConfig:{numberConfig:{}},fieldId:e.name,fieldType:2,helpText:e.helpText,label:e.label,required:e.required}}function mo(e){return{defaultValue:{fieldType:5,selectionValue:{values:e.defaultValue??[]}},disabled:e.disabled,fieldConfig:{selectionConfig:{choices:e.options,multiSelect:e.multiSelect}},fieldId:e.name,fieldType:5,helpText:e.helpText,label:e.label,required:e.required}}function go(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function So(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:ut(e.fields)}},label:e.label,helpText:e.helpText}}var br=1,yo=()=>(br++,`form.${br}`),Er=async e=>{let n={fields:[],id:yo(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};st(e.fields),n.fields=ut(e.fields);let t=await Be({showForm:{form:n},type:3});return!t||!t.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:vr(t.formSubmitted.results)}};function Nr(e){let n;e instanceof Object?n={text:e.text,appearance:e.appearance==="success"?1:0}:n={text:e},Be({showToast:{toast:n},type:4})}export{zr as context,Be as emitEffect,yr as navigateTo,Er as showForm,Nr as showToast};
1
+ var Nr=Object.create;var dn=Object.defineProperty;var Tr=Object.getOwnPropertyDescriptor;var Ir=Object.getOwnPropertyNames;var Or=Object.getPrototypeOf,Cr=Object.prototype.hasOwnProperty;var O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var _r=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ir(t))!Cr.call(e,r)&&r!==n&&dn(e,r,{get:()=>t[r],enumerable:!(o=Tr(t,r))||o.enumerable});return e};var x=(e,t,n)=>(n=e!=null?Nr(Or(e)):{},_r(t||!e||!e.__esModule?dn(n,"default",{value:e,enumerable:!0}):n,e));var ln=O((Co,fn)=>{"use strict";fn.exports=Fr;function Fr(e,t){for(var n=new Array(arguments.length-1),o=0,r=2,i=!0;r<arguments.length;)n[o++]=arguments[r++];return new Promise(function(f,u){n[o]=function(l){if(i)if(i=!1,l)u(l);else{for(var b=new Array(arguments.length-1),y=0;y<b.length;)b[y++]=arguments[y];f.apply(null,b)}};try{e.apply(t||null,n)}catch(a){i&&(i=!1,u(a))}})}});var mn=O(hn=>{"use strict";var ct=hn;ct.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 Ke=new Array(64),pn=new Array(123);for(Q=0;Q<64;)pn[Ke[Q]=Q<26?Q+65:Q<52?Q+71:Q<62?Q-4:Q-59|43]=Q++;var Q;ct.encode=function(t,n,o){for(var r=null,i=[],s=0,f=0,u;n<o;){var a=t[n++];switch(f){case 0:i[s++]=Ke[a>>2],u=(a&3)<<4,f=1;break;case 1:i[s++]=Ke[u|a>>4],u=(a&15)<<2,f=2;break;case 2:i[s++]=Ke[u|a>>6],i[s++]=Ke[a&63],f=0;break}s>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),s=0)}return f&&(i[s++]=Ke[u],i[s++]=61,f===1&&(i[s++]=61)),r?(s&&r.push(String.fromCharCode.apply(String,i.slice(0,s))),r.join("")):String.fromCharCode.apply(String,i.slice(0,s))};var cn="invalid encoding";ct.decode=function(t,n,o){for(var r=o,i=0,s,f=0;f<t.length;){var u=t.charCodeAt(f++);if(u===61&&i>1)break;if((u=pn[u])===void 0)throw Error(cn);switch(i){case 0:s=u,i=1;break;case 1:n[o++]=s<<2|(u&48)>>4,s=u,i=2;break;case 2:n[o++]=(s&15)<<4|(u&60)>>2,s=u,i=3;break;case 3:n[o++]=(s&3)<<6|u,i=0;break}}if(i===1)throw Error(cn);return o-r};ct.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Sn=O((Fo,gn)=>{"use strict";gn.exports=pt;function pt(){this._listeners={}}pt.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};pt.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],r=0;r<o.length;)o[r].fn===n?o.splice(r,1):++r;return this};pt.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],r=1;r<arguments.length;)o.push(arguments[r++]);for(r=0;r<n.length;)n[r].fn.apply(n[r++].ctx,o)}return this}});var In=O((ko,Tn)=>{"use strict";Tn.exports=yn(yn);function yn(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function r(u,a,l){t[0]=u,a[l]=n[0],a[l+1]=n[1],a[l+2]=n[2],a[l+3]=n[3]}function i(u,a,l){t[0]=u,a[l]=n[3],a[l+1]=n[2],a[l+2]=n[1],a[l+3]=n[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function s(u,a){return n[0]=u[a],n[1]=u[a+1],n[2]=u[a+2],n[3]=u[a+3],t[0]}function f(u,a){return n[3]=u[a],n[2]=u[a+1],n[1]=u[a+2],n[0]=u[a+3],t[0]}e.readFloatLE=o?s:f,e.readFloatBE=o?f:s}():function(){function t(o,r,i,s){var f=r<0?1:0;if(f&&(r=-r),r===0)o(1/r>0?0:2147483648,i,s);else if(isNaN(r))o(2143289344,i,s);else if(r>34028234663852886e22)o((f<<31|2139095040)>>>0,i,s);else if(r<11754943508222875e-54)o((f<<31|Math.round(r/1401298464324817e-60))>>>0,i,s);else{var u=Math.floor(Math.log(r)/Math.LN2),a=Math.round(r*Math.pow(2,-u)*8388608)&8388607;o((f<<31|u+127<<23|a)>>>0,i,s)}}e.writeFloatLE=t.bind(null,vn),e.writeFloatBE=t.bind(null,En);function n(o,r,i){var s=o(r,i),f=(s>>31)*2+1,u=s>>>23&255,a=s&8388607;return u===255?a?NaN:f*(1/0):u===0?f*1401298464324817e-60*a:f*Math.pow(2,u-150)*(a+8388608)}e.readFloatLE=n.bind(null,bn),e.readFloatBE=n.bind(null,Nn)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function r(u,a,l){t[0]=u,a[l]=n[0],a[l+1]=n[1],a[l+2]=n[2],a[l+3]=n[3],a[l+4]=n[4],a[l+5]=n[5],a[l+6]=n[6],a[l+7]=n[7]}function i(u,a,l){t[0]=u,a[l]=n[7],a[l+1]=n[6],a[l+2]=n[5],a[l+3]=n[4],a[l+4]=n[3],a[l+5]=n[2],a[l+6]=n[1],a[l+7]=n[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function s(u,a){return n[0]=u[a],n[1]=u[a+1],n[2]=u[a+2],n[3]=u[a+3],n[4]=u[a+4],n[5]=u[a+5],n[6]=u[a+6],n[7]=u[a+7],t[0]}function f(u,a){return n[7]=u[a],n[6]=u[a+1],n[5]=u[a+2],n[4]=u[a+3],n[3]=u[a+4],n[2]=u[a+5],n[1]=u[a+6],n[0]=u[a+7],t[0]}e.readDoubleLE=o?s:f,e.readDoubleBE=o?f:s}():function(){function t(o,r,i,s,f,u){var a=s<0?1:0;if(a&&(s=-s),s===0)o(0,f,u+r),o(1/s>0?0:2147483648,f,u+i);else if(isNaN(s))o(0,f,u+r),o(2146959360,f,u+i);else if(s>17976931348623157e292)o(0,f,u+r),o((a<<31|2146435072)>>>0,f,u+i);else{var l;if(s<22250738585072014e-324)l=s/5e-324,o(l>>>0,f,u+r),o((a<<31|l/4294967296)>>>0,f,u+i);else{var b=Math.floor(Math.log(s)/Math.LN2);b===1024&&(b=1023),l=s*Math.pow(2,-b),o(l*4503599627370496>>>0,f,u+r),o((a<<31|b+1023<<20|l*1048576&1048575)>>>0,f,u+i)}}}e.writeDoubleLE=t.bind(null,vn,0,4),e.writeDoubleBE=t.bind(null,En,4,0);function n(o,r,i,s,f){var u=o(s,f+r),a=o(s,f+i),l=(a>>31)*2+1,b=a>>>20&2047,y=4294967296*(a&1048575)+u;return b===2047?y?NaN:l*(1/0):b===0?l*5e-324*y:l*Math.pow(2,b-1075)*(y+4503599627370496)}e.readDoubleLE=n.bind(null,bn,0,4),e.readDoubleBE=n.bind(null,Nn,4,0)}(),e}function vn(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 En(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 bn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Nn(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var On=O((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 _n=O(Cn=>{"use strict";var It=Cn;It.length=function(t){for(var n=0,o=0,r=0;r<t.length;++r)o=t.charCodeAt(r),o<128?n+=1:o<2048?n+=2:(o&64512)===55296&&(t.charCodeAt(r+1)&64512)===56320?(++r,n+=4):n+=3;return n};It.read=function(t,n,o){var r=o-n;if(r<1)return"";for(var i=null,s=[],f=0,u;n<o;)u=t[n++],u<128?s[f++]=u:u>191&&u<224?s[f++]=(u&31)<<6|t[n++]&63:u>239&&u<365?(u=((u&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,s[f++]=55296+(u>>10),s[f++]=56320+(u&1023)):s[f++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),f=0);return i?(f&&i.push(String.fromCharCode.apply(String,s.slice(0,f))),i.join("")):String.fromCharCode.apply(String,s.slice(0,f))};It.write=function(t,n,o){for(var r=o,i,s,f=0;f<t.length;++f)i=t.charCodeAt(f),i<128?n[o++]=i:i<2048?(n[o++]=i>>6|192,n[o++]=i&63|128):(i&64512)===55296&&((s=t.charCodeAt(f+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++f,n[o++]=i>>18|240,n[o++]=i>>12&63|128,n[o++]=i>>6&63|128,n[o++]=i&63|128):(n[o++]=i>>12|224,n[o++]=i>>6&63|128,n[o++]=i&63|128);return o-r}});var kn=O((Vo,Fn)=>{"use strict";Fn.exports=kr;function kr(e,t,n){var o=n||8192,r=o>>>1,i=null,s=o;return function(u){if(u<1||u>r)return e(u);s+u>o&&(i=e(o),s=0);var a=t.call(i,s,s+=u);return s&7&&(s=(s|7)+1),a}}});var Vn=O((xo,Rn)=>{"use strict";Rn.exports=C;var tt=ce();function C(e,t){this.lo=e>>>0,this.hi=t>>>0}var Be=C.zero=new C(0,0);Be.toNumber=function(){return 0};Be.zzEncode=Be.zzDecode=function(){return this};Be.length=function(){return 1};var Rr=C.zeroHash="\0\0\0\0\0\0\0\0";C.fromNumber=function(t){if(t===0)return Be;var n=t<0;n&&(t=-t);var o=t>>>0,r=(t-o)/4294967296>>>0;return n&&(r=~r>>>0,o=~o>>>0,++o>4294967295&&(o=0,++r>4294967295&&(r=0))),new C(o,r)};C.from=function(t){if(typeof t=="number")return C.fromNumber(t);if(tt.isString(t))if(tt.Long)t=tt.Long.fromString(t);else return C.fromNumber(parseInt(t,10));return t.low||t.high?new C(t.low>>>0,t.high>>>0):Be};C.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};C.prototype.toLong=function(t){return tt.Long?new tt.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var le=String.prototype.charCodeAt;C.fromHash=function(t){return t===Rr?Be:new C((le.call(t,0)|le.call(t,1)<<8|le.call(t,2)<<16|le.call(t,3)<<24)>>>0,(le.call(t,4)|le.call(t,5)<<8|le.call(t,6)<<16|le.call(t,7)<<24)>>>0)};C.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)};C.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};C.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};C.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 ce=O(Ot=>{"use strict";var p=Ot;p.asPromise=ln();p.base64=mn();p.EventEmitter=Sn();p.float=In();p.inquire=On();p.utf8=_n();p.pool=kn();p.LongBits=Vn();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||Ot;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 xn(e,t,n){for(var o=Object.keys(t),r=0;r<o.length;++r)(e[o[r]]===void 0||!n)&&(e[o[r]]=t[o[r]]);return e}p.merge=xn;p.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Pn(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&&xn(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=Pn;p.ProtocolError=Pn("ProtocolError");p.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var r=Object.keys(this),i=r.length-1;i>-1;--i)if(n[r[i]]===1&&this[r[i]]!==void 0&&this[r[i]]!==null)return r[i]}};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 xt=O((wo,Bn)=>{"use strict";Bn.exports=m;var G=ce(),Ct,ht=G.LongBits,wn=G.base64,An=G.utf8;function nt(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Ft(){}function Vr(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 nt(Ft,0,0),this.tail=this.head,this.states=null}var Ln=function(){return G.Buffer?function(){return(m.create=function(){return new Ct})()}:function(){return new m}};m.create=Ln();m.alloc=function(t){return new G.Array(t)};G.Array!==Array&&(m.alloc=G.pool(m.alloc,G.Array.prototype.subarray));m.prototype._push=function(t,n,o){return this.tail=this.tail.next=new nt(t,n,o),this.len+=n,this};function kt(e,t,n){t[n]=e&255}function xr(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Rt(e,t){this.len=e,this.next=void 0,this.val=t}Rt.prototype=Object.create(nt.prototype);Rt.prototype.fn=xr;m.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Rt((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(Vt,10,ht.fromNumber(t)):this.uint32(t)};m.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Vt(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=ht.from(t);return this._push(Vt,n.length(),n)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(t){var n=ht.from(t).zzEncode();return this._push(Vt,n.length(),n)};m.prototype.bool=function(t){return this._push(kt,1,t?1:0)};function _t(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(_t,4,t>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(t){var n=ht.from(t);return this._push(_t,4,n.lo)._push(_t,4,n.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(t){return this._push(G.float.writeFloatLE,4,t)};m.prototype.double=function(t){return this._push(G.float.writeDoubleLE,8,t)};var Pr=G.Array.prototype.set?function(t,n,o){n.set(t,o)}:function(t,n,o){for(var r=0;r<t.length;++r)n[o+r]=t[r]};m.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(kt,1,0);if(G.isString(t)){var o=m.alloc(n=wn.length(t));wn.decode(t,o,0),t=o}return this.uint32(n)._push(Pr,n,t)};m.prototype.string=function(t){var n=An.length(t);return n?this.uint32(n)._push(An.write,n,t):this._push(kt,1,0)};m.prototype.fork=function(){return this.states=new Vr(this),this.head=this.tail=new nt(Ft,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 nt(Ft,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){Ct=e,m.create=Ln(),Ct._configure()}});var Jn=O((Ao,Dn)=>{"use strict";Dn.exports=te;var Mn=xt();(te.prototype=Object.create(Mn.prototype)).constructor=te;var pe=ce();function te(){Mn.call(this)}te._configure=function(){te.alloc=pe._Buffer_allocUnsafe,te.writeBytesBuffer=pe.Buffer&&pe.Buffer.prototype instanceof Uint8Array&&pe.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 r=0;r<t.length;)n[o++]=t[r++]}};te.prototype.bytes=function(t){pe.isString(t)&&(t=pe._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(te.writeBytesBuffer,n,t),this};function wr(e,t,n){e.length<40?pe.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}te.prototype.string=function(t){var n=pe.Buffer.byteLength(t);return this.uint32(n),n&&this._push(wr,n,t),this};te._configure()});var At=O((Lo,Gn)=>{"use strict";Gn.exports=T;var Y=ce(),wt,$n=Y.LongBits,Ar=Y.utf8;function j(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function T(e){this.buf=e,this.pos=0,this.len=e.length}var Un=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new T(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new T(t);throw Error("illegal buffer")},qn=function(){return Y.Buffer?function(n){return(T.create=function(r){return Y.Buffer.isBuffer(r)?new wt(r):Un(r)})(n)}:Un};T.create=qn();T.prototype._slice=Y.Array.prototype.subarray||Y.Array.prototype.slice;T.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}}();T.prototype.int32=function(){return this.uint32()|0};T.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Pt(){var e=new $n(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")}T.prototype.bool=function(){return this.uint32()!==0};function mt(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}T.prototype.fixed32=function(){if(this.pos+4>this.len)throw j(this,4);return mt(this.buf,this.pos+=4)};T.prototype.sfixed32=function(){if(this.pos+4>this.len)throw j(this,4);return mt(this.buf,this.pos+=4)|0};function Wn(){if(this.pos+8>this.len)throw j(this,8);return new $n(mt(this.buf,this.pos+=4),mt(this.buf,this.pos+=4))}T.prototype.float=function(){if(this.pos+4>this.len)throw j(this,4);var t=Y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};T.prototype.double=function(){if(this.pos+8>this.len)throw j(this,4);var t=Y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};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 r=Y.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};T.prototype.string=function(){var t=this.bytes();return Ar.read(t,0,t.length)};T.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};T.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};T._configure=function(e){wt=e,T.create=qn(),wt._configure();var t=Y.Long?"toLong":"toNumber";Y.merge(T.prototype,{int64:function(){return Pt.call(this)[t](!1)},uint64:function(){return Pt.call(this)[t](!0)},sint64:function(){return Pt.call(this).zzDecode()[t](!1)},fixed64:function(){return Wn.call(this)[t](!0)},sfixed64:function(){return Wn.call(this)[t](!1)}})}});var zn=O((Bo,Kn)=>{"use strict";Kn.exports=Me;var Hn=At();(Me.prototype=Object.create(Hn.prototype)).constructor=Me;var Zn=ce();function Me(e){Hn.call(this,e)}Me._configure=function(){Zn.Buffer&&(Me.prototype._slice=Zn.Buffer.prototype.slice)};Me.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))};Me._configure()});var Qn=O((Mo,Xn)=>{"use strict";Xn.exports=it;var Lt=ce();(it.prototype=Object.create(Lt.EventEmitter.prototype)).constructor=it;function it(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Lt.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}it.prototype.rpcCall=function e(t,n,o,r,i){if(!r)throw TypeError("request must be specified");var s=this;if(!i)return Lt.asPromise(e,s,t,n,o,r);if(!s.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(u,a){if(u)return s.emit("error",u,t),i(u);if(a===null){s.end(!0);return}if(!(a instanceof o))try{a=o[s.responseDelimited?"decodeDelimited":"decode"](a)}catch(l){return s.emit("error",l,t),i(l)}return s.emit("data",a,t),i(null,a)})}catch(f){s.emit("error",f,t),setTimeout(function(){i(f)},0);return}};it.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var jn=O(Yn=>{"use strict";var Lr=Yn;Lr.Service=Qn()});var ti=O((Jo,ei)=>{"use strict";ei.exports={}});var ri=O(ii=>{"use strict";var A=ii;A.build="minimal";A.Writer=xt();A.BufferWriter=Jn();A.Reader=At();A.BufferReader=zn();A.util=ce();A.rpc=jn();A.roots=ti();A.configure=ni;function ni(){A.util._configure(),A.Writer._configure(A.BufferWriter),A.Reader._configure(A.BufferReader)}ni()});var P=O((Wo,oi)=>{"use strict";oi.exports=ri()});var Ii=O((ss,Ti)=>{Ti.exports=v;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 v(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}v.prototype.__isLong__;Object.defineProperty(v.prototype,"__isLong__",{value:!0});function B(e){return(e&&e.__isLong__)===!0}v.isLong=B;var hi={},mi={};function $e(e,t){var n,o,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(o=mi[e],o)?o:(n=E(e,(e|0)<0?-1:0,!0),r&&(mi[e]=n),n)):(e|=0,(r=-128<=e&&e<128)&&(o=hi[e],o)?o:(n=E(e,e<0?-1:0,!1),r&&(hi[e]=n),n))}v.fromInt=$e;function H(e,t){if(isNaN(e))return t?We:K;if(t){if(e<0)return We;if(e>=vi)return Ni}else{if(e<=-Si)return L;if(e+1>=Si)return bi}return e<0?H(-e,t).neg():E(e%Ye|0,e/Ye|0,t)}v.fromNumber=H;function E(e,t,n){return new v(e,t,n)}v.fromBits=E;var yt=Math.pow;function qt(e,t,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return K;if(typeof t=="number"?(n=t,t=!1):t=!!t,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 r=H(yt(n,8)),i=K,s=0;s<e.length;s+=8){var f=Math.min(8,e.length-s),u=parseInt(e.substring(s,s+f),n);if(f<8){var a=H(yt(n,f));i=i.mul(a).add(H(u))}else i=i.mul(r),i=i.add(H(u))}return i.unsigned=t,i}v.fromString=qt;function ee(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)}v.fromValue=ee;var gi=65536,Xr=1<<24,Ye=gi*gi,vi=Ye*Ye,Si=vi/2,yi=$e(Xr),K=$e(0);v.ZERO=K;var We=$e(0,!0);v.UZERO=We;var Qe=$e(1);v.ONE=Qe;var Ei=$e(1,!0);v.UONE=Ei;var $t=$e(-1);v.NEG_ONE=$t;var bi=E(-1,2147483647,!1);v.MAX_VALUE=bi;var Ni=E(-1,-1,!0);v.MAX_UNSIGNED_VALUE=Ni;var L=E(0,-2147483648,!1);v.MIN_VALUE=L;var d=v.prototype;d.toInt=function(){return this.unsigned?this.low>>>0:this.low};d.toNumber=function(){return this.unsigned?(this.high>>>0)*Ye+(this.low>>>0):this.high*Ye+(this.low>>>0)};d.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),r=o.mul(n).sub(this);return o.toString(t)+r.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=H(yt(t,6),this.unsigned),s=this,f="";;){var u=s.div(i),a=s.sub(u.mul(i)).toInt()>>>0,l=a.toString(t);if(s=u,s.isZero())return l+f;for(;l.length<6;)l="0"+l;f=""+l+f}};d.getHighBits=function(){return this.high};d.getHighBitsUnsigned=function(){return this.high>>>0};d.getLowBits=function(){return this.low};d.getLowBitsUnsigned=function(){return this.low>>>0};d.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);n--);return this.high!=0?n+33:n+1};d.isZero=function(){return this.high===0&&this.low===0};d.eqz=d.isZero;d.isNegative=function(){return!this.unsigned&&this.high<0};d.isPositive=function(){return this.unsigned||this.high>=0};d.isOdd=function(){return(this.low&1)===1};d.isEven=function(){return(this.low&1)===0};d.equals=function(t){return B(t)||(t=ee(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};d.eq=d.equals;d.notEquals=function(t){return!this.eq(t)};d.neq=d.notEquals;d.ne=d.notEquals;d.lessThan=function(t){return this.comp(t)<0};d.lt=d.lessThan;d.lessThanOrEqual=function(t){return this.comp(t)<=0};d.lte=d.lessThanOrEqual;d.le=d.lessThanOrEqual;d.greaterThan=function(t){return this.comp(t)>0};d.gt=d.greaterThan;d.greaterThanOrEqual=function(t){return this.comp(t)>=0};d.gte=d.greaterThanOrEqual;d.ge=d.greaterThanOrEqual;d.compare=function(t){if(B(t)||(t=ee(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};d.comp=d.compare;d.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(Qe)};d.neg=d.negate;d.add=function(t){B(t)||(t=ee(t));var n=this.high>>>16,o=this.high&65535,r=this.low>>>16,i=this.low&65535,s=t.high>>>16,f=t.high&65535,u=t.low>>>16,a=t.low&65535,l=0,b=0,y=0,D=0;return D+=i+a,y+=D>>>16,D&=65535,y+=r+u,b+=y>>>16,y&=65535,b+=o+f,l+=b>>>16,b&=65535,l+=n+s,l&=65535,E(y<<16|D,l<<16|b,this.unsigned)};d.subtract=function(t){return B(t)||(t=ee(t)),this.add(t.neg())};d.sub=d.subtract;d.multiply=function(t){if(this.isZero())return K;if(B(t)||(t=ee(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 K;if(this.eq(L))return t.isOdd()?L:K;if(t.eq(L))return this.isOdd()?L:K;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(yi)&&t.lt(yi))return H(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,r=this.high&65535,i=this.low>>>16,s=this.low&65535,f=t.high>>>16,u=t.high&65535,a=t.low>>>16,l=t.low&65535,b=0,y=0,D=0,lt=0;return lt+=s*l,D+=lt>>>16,lt&=65535,D+=i*l,y+=D>>>16,D&=65535,D+=s*a,y+=D>>>16,D&=65535,y+=r*l,b+=y>>>16,y&=65535,y+=i*a,b+=y>>>16,y&=65535,y+=s*u,b+=y>>>16,y&=65535,b+=o*l+r*a+i*u+s*f,b&=65535,E(D<<16|lt,b<<16|y,this.unsigned)};d.mul=d.multiply;d.divide=function(t){if(B(t)||(t=ee(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?We:K;var o,r,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return We;if(t.gt(this.shru(1)))return Ei;i=We}else{if(this.eq(L)){if(t.eq(Qe)||t.eq($t))return L;if(t.eq(L))return Qe;var s=this.shr(1);return o=s.div(t).shl(1),o.eq(K)?t.isNegative()?Qe:$t:(r=this.sub(t.mul(o)),i=o.add(r.div(t)),i)}else if(t.eq(L))return this.unsigned?We:K;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();i=K}for(r=this;r.gte(t);){o=Math.max(1,Math.floor(r.toNumber()/t.toNumber()));for(var f=Math.ceil(Math.log(o)/Math.LN2),u=f<=48?1:yt(2,f-48),a=H(o),l=a.mul(t);l.isNegative()||l.gt(r);)o-=u,a=H(o,this.unsigned),l=a.mul(t);a.isZero()&&(a=Qe),i=i.add(a),r=r.sub(l)}return i};d.div=d.divide;d.modulo=function(t){if(B(t)||(t=ee(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))};d.mod=d.modulo;d.rem=d.modulo;d.not=function(){return E(~this.low,~this.high,this.unsigned)};d.and=function(t){return B(t)||(t=ee(t)),E(this.low&t.low,this.high&t.high,this.unsigned)};d.or=function(t){return B(t)||(t=ee(t)),E(this.low|t.low,this.high|t.high,this.unsigned)};d.xor=function(t){return B(t)||(t=ee(t)),E(this.low^t.low,this.high^t.high,this.unsigned)};d.shiftLeft=function(t){return B(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)};d.shl=d.shiftLeft;d.shiftRight=function(t){return B(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)};d.shr=d.shiftRight;d.shiftRightUnsigned=function(t){if(B(t)&&(t=t.toInt()),t&=63,t===0)return this;var n=this.high;if(t<32){var o=this.low;return E(o>>>t|n<<32-t,n>>>t,this.unsigned)}else return t===32?E(n,0,this.unsigned):E(n>>>t-32,0,this.unsigned)};d.shru=d.shiftRightUnsigned;d.shr_u=d.shiftRightUnsigned;d.toSigned=function(){return this.unsigned?E(this.low,this.high,!1):this};d.toUnsigned=function(){return this.unsigned?this:E(this.low,this.high,!0)};d.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};d.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]};d.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]};v.fromBytes=function(t,n,o){return o?v.fromBytesLE(t,n):v.fromBytesBE(t,n)};v.fromBytesLE=function(t,n){return new v(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};v.fromBytesBE=function(t,n){return new v(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)}});var Ue=x(P(),1);var J=x(P(),1);var c=new Map;var Je;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Je||(Je={}));function Br(e){switch(e){case 0:case"NULL_VALUE":return Je.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Je.UNRECOGNIZED}}function Mr(e){switch(e){case Je.NULL_VALUE:return 0;case Je.UNRECOGNIZED:default:return-1}}function Bt(){return{fields:{}}}var _={$type:"google.protobuf.Struct",encode(e,t=J.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&rt.encode({key:n,value:o},t.uint32(10).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,r=Bt();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let s=rt.decode(n,n.uint32());s.value!==void 0&&(r.fields[s.key]=s.value);continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:ui(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,r])=>{t.fields[o]=r}))}return t},create(e){return _.fromPartial(e??{})},fromPartial(e){let t=Bt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=r),n),{}),t},wrap(e){let t=Bt();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}};c.set(_.$type,_);function si(){return{key:"",value:void 0}}var rt={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=J.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&F.encode(F.wrap(e.value),t.uint32(18).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,r=si();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=n.string();continue;case 2:if(i!==18)break;r.value=F.unwrap(F.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:ze(e.key)?globalThis.String(e.key):"",value:ze(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 rt.fromPartial(e??{})},fromPartial(e){let t=si();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(rt.$type,rt);function Mt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var F={$type:"google.protobuf.Value",encode(e,t=J.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&&De.encode(De.wrap(e.listValue),t.uint32(50).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,r=Mt();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.nullValue=n.int32();continue;case 2:if(i!==17)break;r.numberValue=n.double();continue;case 3:if(i!==26)break;r.stringValue=n.string();continue;case 4:if(i!==32)break;r.boolValue=n.bool();continue;case 5:if(i!==42)break;r.structValue=_.unwrap(_.decode(n,n.uint32()));continue;case 6:if(i!==50)break;r.listValue=De.unwrap(De.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{nullValue:ze(e.nullValue)?Br(e.nullValue):void 0,numberValue:ze(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ze(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ze(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:ui(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=Mr(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 F.fromPartial(e??{})},fromPartial(e){let t=Mt();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=Mt();if(e===null)t.nullValue=Je.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}};c.set(F.$type,F);function Dt(){return{values:[]}}var De={$type:"google.protobuf.ListValue",encode(e,t=J.default.Writer.create()){for(let n of e.values)F.encode(F.wrap(n),t.uint32(10).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,r=Dt();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(F.unwrap(F.decode(n,n.uint32())));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 De.fromPartial(e??{})},fromPartial(e){let t=Dt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=Dt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(De.$type,De);function ui(e){return typeof e=="object"&&e!==null}function ze(e){return e!=null}function ai(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var ot={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,t=Ue.default.Writer.create()){return e.subredditId!==""&&t.uint32(10).string(e.subredditId),e.subredditName!==""&&t.uint32(18).string(e.subredditName),e.userId!==""&&t.uint32(26).string(e.userId),e.appName!==""&&t.uint32(34).string(e.appName),e.appVersion!==""&&t.uint32(42).string(e.appVersion),e.postId!==""&&t.uint32(50).string(e.postId),t},decode(e,t){let n=e instanceof Ue.default.Reader?e:Ue.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=ai();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subredditId=n.string();continue;case 2:if(i!==18)break;r.subredditName=n.string();continue;case 3:if(i!==26)break;r.userId=n.string();continue;case 4:if(i!==34)break;r.appName=n.string();continue;case 5:if(i!==42)break;r.appVersion=n.string();continue;case 6:if(i!==50)break;r.postId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{subredditId:Xe(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:Xe(e.subredditName)?globalThis.String(e.subredditName):"",userId:Xe(e.userId)?globalThis.String(e.userId):"",appName:Xe(e.appName)?globalThis.String(e.appName):"",appVersion:Xe(e.appVersion)?globalThis.String(e.appVersion):"",postId:Xe(e.postId)?globalThis.String(e.postId):""}},toJSON(e){let t={};return e.subredditId!==""&&(t.subredditId=e.subredditId),e.subredditName!==""&&(t.subredditName=e.subredditName),e.userId!==""&&(t.userId=e.userId),e.appName!==""&&(t.appName=e.appName),e.appVersion!==""&&(t.appVersion=e.appVersion),e.postId!==""&&(t.postId=e.postId),t},create(e){return ot.fromPartial(e??{})},fromPartial(e){let t=ai();return t.subredditId=e.subredditId??"",t.subredditName=e.subredditName??"",t.userId=e.userId??"",t.appName=e.appName??"",t.appVersion=e.appVersion??"",t.postId=e.postId??"",t}};c.set(ot.$type,ot);function di(){return{developerData:void 0}}var st={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode(e,t=Ue.default.Writer.create()){return e.developerData!==void 0&&_.encode(_.wrap(e.developerData),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof Ue.default.Reader?e:Ue.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=di();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 2:if(i!==18)break;r.developerData=_.unwrap(_.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{developerData:Dr(e.developerData)?e.developerData:void 0}},toJSON(e){let t={};return e.developerData!==void 0&&(t.developerData=e.developerData),t},create(e){return st.fromPartial(e??{})},fromPartial(e){let t=di();return t.developerData=e.developerData??void 0,t}};c.set(st.$type,st);function Dr(e){return typeof e=="object"&&e!==null}function Xe(e){return e!=null}function gt(e,t){if(!e)throw Error(t)}var he;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(he||(he={}));function Jr(e){return e.startsWith(he.ACCOUNT)}function Ur(e){return e.startsWith(he.LINK)}function Wr(e){return e.startsWith(he.SUBREDDIT)}function $r(e){gt(Jr(e),`Expected account id to start with ${he.ACCOUNT}, got ${e}}`)}function qr(e){gt(Ur(e),`Expected link id to start with ${he.LINK}, got ${e}}`)}function Gr(e){gt(Wr(e),`Expected subreddit id to start with ${he.SUBREDDIT}, got ${e}}`)}function fi(e){return $r(e),e}function li(e){return qr(e),e}function ci(e){return Gr(e),e}var Zr=({search:e,hash:t})=>{let n=new URLSearchParams(e).get("context");if(n){let o=decodeURIComponent(n),r=ot.fromJSON(JSON.parse(o)),i=Hr(t),s={subredditId:ci(r.subredditId),userId:fi(r.userId),subredditName:r.subredditName,appName:r.appName,appVersion:r.appVersion,postId:li(r.postId),postData:i?.developerData};globalThis.devvit={context:s}}};globalThis.location&&Zr(globalThis.location);function Hr(e){let t=e?.slice(1);if(t)try{return st.fromJSON(JSON.parse(decodeURIComponent(t)))}catch(n){console.error("Error parsing post data from hash",n);return}}var Kr=new Proxy({},{get:(e,t)=>globalThis.devvit.context[t],ownKeys(){return Object.keys(globalThis.devvit.context)},getOwnPropertyDescriptor(e,t){return{enumerable:!0,configurable:!0,value:globalThis.devvit.context[t]}}});var St=x(P(),1);var ne;(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"})(ne||(ne={}));function Ut(e){switch(e){case 0:case"UNSPECIFIED":return ne.UNSPECIFIED;case 1:case"INLINE_MODE":return ne.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return ne.IMMERSIVE_MODE;case-1:case"UNRECOGNIZED":default:return ne.UNRECOGNIZED}}function Wt(e){switch(e){case ne.UNSPECIFIED:return 0;case ne.INLINE_MODE:return 1;case ne.IMMERSIVE_MODE:return 2;case ne.UNRECOGNIZED:default:return-1}}function pi(){return{immersiveMode:0}}var Jt={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode(e,t=St.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof St.default.Reader?e:St.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=pi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:zr(e.immersiveMode)?Ut(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=Wt(e.immersiveMode)),t},create(e){return Jt.fromPartial(e??{})},fromPartial(e){let t=pi();return t.immersiveMode=e.immersiveMode??0,t}};c.set(Jt.$type,Jt);function zr(e){return e!=null}var V=x(P(),1);var R=x(P(),1);var S=x(P(),1);var Gt=x(Ii(),1),qe=x(P(),1);function Oi(){return{seconds:0,nanos:0}}var Ge={$type:"google.protobuf.Timestamp",encode(e,t=qe.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 qe.default.Reader?e:qe.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Oi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.seconds=Qr(n.int64());continue;case 2:if(i!==16)break;r.nanos=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{seconds:Ci(e.seconds)?globalThis.Number(e.seconds):0,nanos:Ci(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 Ge.fromPartial(e??{})},fromPartial(e){let t=Oi();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};c.set(Ge.$type,Ge);function Qr(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}qe.default.util.Long!==Gt.default&&(qe.default.util.Long=Gt.default,qe.default.configure());function Ci(e){return e!=null}var ie;(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"})(ie||(ie={}));function Yt(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ie.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ie.REVOKED;case 2:case"GRANTED":return ie.GRANTED;case-1:case"UNRECOGNIZED":default:return ie.UNRECOGNIZED}}function jt(e){switch(e){case ie.CONSENT_STATUS_UNKNOWN:return 0;case ie.REVOKED:return 1;case ie.GRANTED:return 2;case ie.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 vt(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 Et(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 _i(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}var me={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=S.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&&Ge.encode(Yr(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=_i();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=n.string();continue;case 2:if(i!==18)break;r.subredditId=n.string();continue;case 3:if(i===24){r.scopes.push(n.int32());continue}if(i===26){let s=n.uint32()+n.pos;for(;n.pos<s;)r.scopes.push(n.int32());continue}break;case 4:if(i!==32)break;r.consentStatus=n.int32();continue;case 5:if(i!==42)break;r.updatedAt=Li(Ge.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>vt(t)):[],consentStatus:k(e.consentStatus)?Yt(e.consentStatus):0,updatedAt:k(e.updatedAt)?jr(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=>Et(n))),e.consentStatus!==0&&(t.consentStatus=jt(e.consentStatus)),e.updatedAt!==void 0&&(t.updatedAt=e.updatedAt.toISOString()),t},create(e){return me.fromPartial(e??{})},fromPartial(e){let t=_i();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}};c.set(me.$type,me);function Fi(){return{appSlug:"",appName:""}}var ge={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode(e,t=S.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Fi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=n.string();continue;case 2:if(i!==18)break;r.appName=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",appName:k(e.appName)?globalThis.String(e.appName):""}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),t},create(e){return ge.fromPartial(e??{})},fromPartial(e){let t=Fi();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};c.set(ge.$type,ge);function ki(){return{userId:""}}var Zt={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode(e,t=S.default.Writer.create()){return e.userId!==""&&t.uint32(10).string(e.userId),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=ki();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{userId:k(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=ki();return t.userId=e.userId??"",t}};c.set(Zt.$type,Zt);function Ri(){return{appPermissions:[],devvitApps:[]}}var Ht={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=S.default.Writer.create()){for(let n of e.appPermissions)me.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.devvitApps)ge.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Ri();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appPermissions.push(me.decode(n,n.uint32()));continue;case 2:if(i!==18)break;r.devvitApps.push(ge.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map(t=>me.fromJSON(t)):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map(t=>ge.fromJSON(t)):[]}},toJSON(e){let t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map(n=>me.toJSON(n))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map(n=>ge.toJSON(n))),t},create(e){return Ht.fromPartial(e??{})},fromPartial(e){let t=Ri();return t.appPermissions=e.appPermissions?.map(n=>me.fromPartial(n))||[],t.devvitApps=e.devvitApps?.map(n=>ge.fromPartial(n))||[],t}};c.set(Ht.$type,Ht);function Vi(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}var Kt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=S.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 S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Vi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.userId=n.string();continue;case 2:if(i!==18)break;r.appSlug=n.string();continue;case 3:if(i!==26)break;r.subredditId=n.string();continue;case 4:if(i===32){r.scopes.push(n.int32());continue}if(i===34){let s=n.uint32()+n.pos;for(;n.pos<s;)r.scopes.push(n.int32());continue}break}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{userId:k(e.userId)?globalThis.String(e.userId):"",appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:k(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>vt(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=>Et(n))),t},create(e){return Kt.fromPartial(e??{})},fromPartial(e){let t=Vi();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map(n=>n)||[],t}};c.set(Kt.$type,Kt);function xi(){return{error:void 0}}var zt={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode(e,t=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=xi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=U.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{error:k(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return zt.fromPartial(e??{})},fromPartial(e){let t=xi();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(zt.$type,zt);function Pi(){return{appSlug:"",userId:"",subredditId:""}}var Xt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode(e,t=S.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 S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Pi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=n.string();continue;case 2:if(i!==18)break;r.userId=n.string();continue;case 3:if(i!==26)break;r.subredditId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{appSlug:k(e.appSlug)?globalThis.String(e.appSlug):"",userId:k(e.userId)?globalThis.String(e.userId):"",subredditId:k(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 Xt.fromPartial(e??{})},fromPartial(e){let t=Pi();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};c.set(Xt.$type,Xt);function wi(){return{error:void 0}}var Qt={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode(e,t=S.default.Writer.create()){return e.error!==void 0&&U.encode(e.error,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=wi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.error=U.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{error:k(e.error)?U.fromJSON(e.error):void 0}},toJSON(e){let t={};return e.error!==void 0&&(t.error=U.toJSON(e.error)),t},create(e){return Qt.fromPartial(e??{})},fromPartial(e){let t=wi();return t.error=e.error!==void 0&&e.error!==null?U.fromPartial(e.error):void 0,t}};c.set(Qt.$type,Qt);function Ai(){return{message:""}}var U={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode(e,t=S.default.Writer.create()){return e.message!==""&&t.uint32(10).string(e.message),t},decode(e,t){let n=e instanceof S.default.Reader?e:S.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Ai();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{message:k(e.message)?globalThis.String(e.message):""}},toJSON(e){let t={};return e.message!==""&&(t.message=e.message),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=Ai();return t.message=e.message??"",t}};c.set(U.$type,U);function Yr(e){let t=Math.trunc(e.getTime()/1e3),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function Li(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function jr(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):Li(Ge.fromJSON(e))}function k(e){return e!=null}function Bi(){return{app:void 0,scopes:[],subreddit:void 0,redditor:void 0}}var en={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect",encode(e,t=R.default.Writer.create()){e.app!==void 0&&ye.encode(e.app,t.uint32(10).fork()).ldelim(),t.uint32(18).fork();for(let n of e.scopes)t.int32(n);return t.ldelim(),e.subreddit!==void 0&&ve.encode(e.subreddit,t.uint32(26).fork()).ldelim(),e.redditor!==void 0&&Se.encode(e.redditor,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Bi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.app=ye.decode(n,n.uint32());continue;case 2:if(i===16){r.scopes.push(n.int32());continue}if(i===18){let s=n.uint32()+n.pos;for(;n.pos<s;)r.scopes.push(n.int32());continue}break;case 3:if(i!==26)break;r.subreddit=ve.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.redditor=Se.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{app:w(e.app)?ye.fromJSON(e.app):void 0,scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map(t=>vt(t)):[],subreddit:w(e.subreddit)?ve.fromJSON(e.subreddit):void 0,redditor:w(e.redditor)?Se.fromJSON(e.redditor):void 0}},toJSON(e){let t={};return e.app!==void 0&&(t.app=ye.toJSON(e.app)),e.scopes?.length&&(t.scopes=e.scopes.map(n=>Et(n))),e.subreddit!==void 0&&(t.subreddit=ve.toJSON(e.subreddit)),e.redditor!==void 0&&(t.redditor=Se.toJSON(e.redditor)),t},create(e){return en.fromPartial(e??{})},fromPartial(e){let t=Bi();return t.app=e.app!==void 0&&e.app!==null?ye.fromPartial(e.app):void 0,t.scopes=e.scopes?.map(n=>n)||[],t.subreddit=e.subreddit!==void 0&&e.subreddit!==null?ve.fromPartial(e.subreddit):void 0,t.redditor=e.redditor!==void 0&&e.redditor!==null?Se.fromPartial(e.redditor):void 0,t}};c.set(en.$type,en);function Mi(){return{id:"",icon:void 0,snoovatarIcon:void 0}}var Se={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Redditor",encode(e,t=R.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.icon!==void 0&&t.uint32(18).string(e.icon),e.snoovatarIcon!==void 0&&t.uint32(26).string(e.snoovatarIcon),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Mi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=n.string();continue;case 2:if(i!==18)break;r.icon=n.string();continue;case 3:if(i!==26)break;r.snoovatarIcon=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{id:w(e.id)?globalThis.String(e.id):"",icon:w(e.icon)?globalThis.String(e.icon):void 0,snoovatarIcon:w(e.snoovatarIcon)?globalThis.String(e.snoovatarIcon):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.icon!==void 0&&(t.icon=e.icon),e.snoovatarIcon!==void 0&&(t.snoovatarIcon=e.snoovatarIcon),t},create(e){return Se.fromPartial(e??{})},fromPartial(e){let t=Mi();return t.id=e.id??"",t.icon=e.icon??void 0,t.snoovatarIcon=e.snoovatarIcon??void 0,t}};c.set(Se.$type,Se);function Di(){return{appSlug:"",appName:"",termsAndConditionsUrl:void 0,privacyPolicyUrl:void 0}}var ye={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.DevvitApp",encode(e,t=R.default.Writer.create()){return e.appSlug!==""&&t.uint32(10).string(e.appSlug),e.appName!==""&&t.uint32(18).string(e.appName),e.termsAndConditionsUrl!==void 0&&t.uint32(26).string(e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&t.uint32(34).string(e.privacyPolicyUrl),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Di();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.appSlug=n.string();continue;case 2:if(i!==18)break;r.appName=n.string();continue;case 3:if(i!==26)break;r.termsAndConditionsUrl=n.string();continue;case 4:if(i!==34)break;r.privacyPolicyUrl=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{appSlug:w(e.appSlug)?globalThis.String(e.appSlug):"",appName:w(e.appName)?globalThis.String(e.appName):"",termsAndConditionsUrl:w(e.termsAndConditionsUrl)?globalThis.String(e.termsAndConditionsUrl):void 0,privacyPolicyUrl:w(e.privacyPolicyUrl)?globalThis.String(e.privacyPolicyUrl):void 0}},toJSON(e){let t={};return e.appSlug!==""&&(t.appSlug=e.appSlug),e.appName!==""&&(t.appName=e.appName),e.termsAndConditionsUrl!==void 0&&(t.termsAndConditionsUrl=e.termsAndConditionsUrl),e.privacyPolicyUrl!==void 0&&(t.privacyPolicyUrl=e.privacyPolicyUrl),t},create(e){return ye.fromPartial(e??{})},fromPartial(e){let t=Di();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t.termsAndConditionsUrl=e.termsAndConditionsUrl??void 0,t.privacyPolicyUrl=e.privacyPolicyUrl??void 0,t}};c.set(ye.$type,ye);function Ji(){return{id:"",name:"",isNsfw:void 0,icon:void 0}}var ve={$type:"devvit.ui.effects.v1alpha.ObtainAppPermissionsEffect.Subreddit",encode(e,t=R.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.name!==""&&t.uint32(18).string(e.name),e.isNsfw!==void 0&&t.uint32(24).bool(e.isNsfw),e.icon!==void 0&&t.uint32(34).string(e.icon),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Ji();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=n.string();continue;case 2:if(i!==18)break;r.name=n.string();continue;case 3:if(i!==24)break;r.isNsfw=n.bool();continue;case 4:if(i!==34)break;r.icon=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{id:w(e.id)?globalThis.String(e.id):"",name:w(e.name)?globalThis.String(e.name):"",isNsfw:w(e.isNsfw)?globalThis.Boolean(e.isNsfw):void 0,icon:w(e.icon)?globalThis.String(e.icon):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.name!==""&&(t.name=e.name),e.isNsfw!==void 0&&(t.isNsfw=e.isNsfw),e.icon!==void 0&&(t.icon=e.icon),t},create(e){return ve.fromPartial(e??{})},fromPartial(e){let t=Ji();return t.id=e.id??"",t.name=e.name??"",t.isNsfw=e.isNsfw??void 0,t.icon=e.icon??void 0,t}};c.set(ve.$type,ve);function Ui(){return{consentStatus:0}}var re={$type:"devvit.ui.effects.v1alpha.AppPermissionsConsentSubmittedEvent",encode(e,t=R.default.Writer.create()){return e.consentStatus!==0&&t.uint32(8).int32(e.consentStatus),t},decode(e,t){let n=e instanceof R.default.Reader?e:R.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Ui();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.consentStatus=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{consentStatus:w(e.consentStatus)?Yt(e.consentStatus):0}},toJSON(e){let t={};return e.consentStatus!==0&&(t.consentStatus=jt(e.consentStatus)),t},create(e){return re.fromPartial(e??{})},fromPartial(e){let t=Ui();return t.consentStatus=e.consentStatus??0,t}};c.set(re.$type,re);function w(e){return e!=null}var He=x(P(),1);var Ze=x(P(),1);var bt=x(P(),1);function Wi(){return{}}var Nt={$type:"google.protobuf.Empty",encode(e,t=bt.default.Writer.create()){return t},decode(e,t){let n=e instanceof bt.default.Reader?e:bt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Wi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Nt.fromPartial(e??{})},fromPartial(e){return Wi()}};c.set(Nt.$type,Nt);function $i(){return{channels:[]}}var tn={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=Ze.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return 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,r=$i();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channels.push(n.string());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 tn.fromPartial(e??{})},fromPartial(e){let t=$i();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(tn.$type,tn);function qi(){return{channel:"",data:void 0}}var oe={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=Ze.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 Ze.default.Reader?e:Ze.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=qi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.channel=n.string();continue;case 2:if(i!==18)break;r.data=_.unwrap(_.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{channel:to(e.channel)?globalThis.String(e.channel):"",data:eo(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 oe.fromPartial(e??{})},fromPartial(e){let t=qi();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(oe.$type,oe);function eo(e){return typeof e=="object"&&e!==null}function to(e){return e!=null}var Ee;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ee||(Ee={}));function no(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return Ee.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return Ee.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return Ee.UNRECOGNIZED}}function io(e){switch(e){case Ee.REALTIME_SUBSCRIBED:return 0;case Ee.REALTIME_UNSUBSCRIBED:return 1;case Ee.UNRECOGNIZED:default:return-1}}function Gi(){return{subscriptionIds:[]}}var nn={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=He.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof He.default.Reader?e:He.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Gi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.subscriptionIds.push(n.string());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 nn.fromPartial(e??{})},fromPartial(e){let t=Gi();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(nn.$type,nn);function Zi(){return{event:void 0,status:void 0}}var se={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=He.default.Writer.create()){return e.event!==void 0&&oe.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 He.default.Reader?e:He.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Zi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.event=oe.decode(n,n.uint32());continue;case 2:if(i!==16)break;r.status=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{event:Hi(e.event)?oe.fromJSON(e.event):void 0,status:Hi(e.status)?no(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=oe.toJSON(e.event)),e.status!==void 0&&(t.status=io(e.status)),t},create(e){return se.fromPartial(e??{})},fromPartial(e){let t=Zi();return t.event=e.event!==void 0&&e.event!==null?oe.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(se.$type,se);function Hi(e){return e!=null}var q=x(P(),1);var Tt=x(P(),1);var g=x(P(),1);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={}));function je(e){switch(e){case 0:case"STRING":return I.STRING;case 1:case"PARAGRAPH":return I.PARAGRAPH;case 2:case"NUMBER":return I.NUMBER;case 3:case"BOOLEAN":return I.BOOLEAN;case 4:case"LIST":return I.LIST;case 5:case"SELECTION":return I.SELECTION;case 6:case"GROUP":return I.GROUP;case 7:case"IMAGE":return I.IMAGE;case-1:case"UNRECOGNIZED":default:return I.UNRECOGNIZED}}function et(e){switch(e){case I.STRING:return 0;case I.PARAGRAPH:return 1;case I.NUMBER:return 2;case I.BOOLEAN:return 3;case I.LIST:return 4;case I.SELECTION:return 5;case I.GROUP:return 6;case I.IMAGE:return 7;case I.UNRECOGNIZED:default:return-1}}var W=x(P(),1);function Ki(){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 N={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=W.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&&be.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Ne.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&Te.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Ki();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.fieldType=n.int32();continue;case 100:if(i!==800)break;r.isSecret=n.bool();continue;case 2:if(i!==18)break;r.stringValue=n.string();continue;case 3:if(i!==25)break;r.numberValue=n.double();continue;case 4:if(i!==32)break;r.boolValue=n.bool();continue;case 5:if(i!==42)break;r.listValue=be.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionValue=Ne.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupValue=Te.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fieldType:ue(e.fieldType)?je(e.fieldType):0,isSecret:ue(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:ue(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:ue(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:ue(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:ue(e.listValue)?be.fromJSON(e.listValue):void 0,selectionValue:ue(e.selectionValue)?Ne.fromJSON(e.selectionValue):void 0,groupValue:ue(e.groupValue)?Te.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=et(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=be.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Ne.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=Te.toJSON(e.groupValue)),t},create(e){return N.fromPartial(e??{})},fromPartial(e){let t=Ki();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?be.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Ne.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?Te.fromPartial(e.groupValue):void 0,t}};c.set(N.$type,N);function zi(){return{itemType:0,items:[]}}var be={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=W.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)N.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=zi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=n.int32();continue;case 2:if(i!==18)break;r.items.push(N.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{itemType:ue(e.itemType)?je(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>N.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=et(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>N.toJSON(n))),t},create(e){return be.fromPartial(e??{})},fromPartial(e){let t=zi();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>N.fromPartial(n))||[],t}};c.set(be.$type,be);function Xi(){return{values:[]}}var Ne={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=W.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Xi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(n.string());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 Ne.fromPartial(e??{})},fromPartial(e){let t=Xi();return t.values=e.values?.map(n=>n)||[],t}};c.set(Ne.$type,Ne);function Qi(){return{}}var Te={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=W.default.Writer.create()){return t},decode(e,t){let n=e instanceof W.default.Reader?e:W.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Qi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return Te.fromPartial(e??{})},fromPartial(e){return Qi()}};c.set(Te.$type,Te);function ue(e){return e!=null}function Yi(){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&&N.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&&$.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,r=Yi();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fieldId=n.string();continue;case 2:if(i!==16)break;r.fieldType=n.int32();continue;case 3:if(i!==26)break;r.label=n.string();continue;case 4:if(i!==34)break;r.helpText=n.string();continue;case 5:if(i!==42)break;r.defaultValue=N.decode(n,n.uint32());continue;case 6:if(i!==48)break;r.required=n.bool();continue;case 7:if(i!==56)break;r.disabled=n.bool();continue;case 8:if(i!==66)break;r.fieldConfig=$.decode(n,n.uint32());continue;case 9:if(i!==72)break;r.isSecret=n.bool();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fieldId:h(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:h(e.fieldType)?je(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)?N.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)?$.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=et(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=N.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=$.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return M.fromPartial(e??{})},fromPartial(e){let t=Yi();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?N.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?$.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(M.$type,M);function ji(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var $={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=g.default.Writer.create()){return e.stringConfig!==void 0&&Ie.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&Oe.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&Ce.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&_e.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&Fe.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&ke.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&Ve.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,r=ji();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=Ie.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=Oe.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.numberConfig=Ce.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=_e.decode(n,n.uint32());continue;case 5:if(i!==42)break;r.listConfig=Fe.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=ke.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupConfig=Ve.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{stringConfig:h(e.stringConfig)?Ie.fromJSON(e.stringConfig):void 0,paragraphConfig:h(e.paragraphConfig)?Oe.fromJSON(e.paragraphConfig):void 0,numberConfig:h(e.numberConfig)?Ce.fromJSON(e.numberConfig):void 0,booleanConfig:h(e.booleanConfig)?_e.fromJSON(e.booleanConfig):void 0,listConfig:h(e.listConfig)?Fe.fromJSON(e.listConfig):void 0,selectionConfig:h(e.selectionConfig)?ke.fromJSON(e.selectionConfig):void 0,groupConfig:h(e.groupConfig)?Ve.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=Ie.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=Oe.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=Ce.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=_e.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=Fe.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=ke.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=Ve.toJSON(e.groupConfig)),t},create(e){return $.fromPartial(e??{})},fromPartial(e){let t=ji();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?Ie.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?Oe.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?Ce.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?_e.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?Fe.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?ke.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?Ve.fromPartial(e.groupConfig):void 0,t}};c.set($.$type,$);function er(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var Ie={$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,r=er();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.minLength=n.int32();continue;case 2:if(i!==16)break;r.maxLength=n.int32();continue;case 3:if(i!==26)break;r.placeholder=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 Ie.fromPartial(e??{})},fromPartial(e){let t=er();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(Ie.$type,Ie);function tr(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var Oe={$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,r=tr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.maxCharacters=n.int32();continue;case 2:if(i!==16)break;r.lineHeight=n.int32();continue;case 3:if(i!==26)break;r.placeholder=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 Oe.fromPartial(e??{})},fromPartial(e){let t=tr();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(Oe.$type,Oe);function nr(){return{step:void 0,min:void 0,max:void 0}}var Ce={$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,r=nr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==9)break;r.step=n.double();continue;case 2:if(i!==17)break;r.min=n.double();continue;case 3:if(i!==25)break;r.max=n.double();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 Ce.fromPartial(e??{})},fromPartial(e){let t=nr();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(Ce.$type,Ce);function ir(){return{}}var _e={$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,r=ir();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return _e.fromPartial(e??{})},fromPartial(e){return ir()}};c.set(_e.$type,_e);function rr(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var Fe={$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&&$.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,r=rr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.itemType=n.int32();continue;case 2:if(i!==18)break;r.itemConfig=$.decode(n,n.uint32());continue;case 3:if(i!==24)break;r.minEntries=n.int32();continue;case 4:if(i!==32)break;r.maxEntries=n.int32();continue;case 5:if(i!==42)break;r.entryLabel=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{itemType:h(e.itemType)?je(e.itemType):0,itemConfig:h(e.itemConfig)?$.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=et(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=$.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 Fe.fromPartial(e??{})},fromPartial(e){let t=rr();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?$.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};c.set(Fe.$type,Fe);function or(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var ke={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=g.default.Writer.create()){for(let n of e.choices)Re.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,r=or();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.choices.push(Re.decode(n,n.uint32()));continue;case 2:if(i!==16)break;r.multiSelect=n.bool();continue;case 3:if(i!==24)break;r.minSelections=n.int32();continue;case 4:if(i!==32)break;r.maxSelections=n.int32();continue;case 5:if(i!==40)break;r.renderAsList=n.bool();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>Re.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=>Re.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 ke.fromPartial(e??{})},fromPartial(e){let t=or();return t.choices=e.choices?.map(n=>Re.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}};c.set(ke.$type,ke);function sr(){return{label:"",value:""}}var Re={$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,r=sr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.label=n.string();continue;case 2:if(i!==18)break;r.value=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 Re.fromPartial(e??{})},fromPartial(e){let t=sr();return t.label=e.label??"",t.value=e.value??"",t}};c.set(Re.$type,Re);function ur(){return{fields:[]}}var Ve={$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,r=ur();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(M.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},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 Ve.fromPartial(e??{})},fromPartial(e){let t=ur();return t.fields=e.fields?.map(n=>M.fromPartial(n))||[],t}};c.set(Ve.$type,Ve);function h(e){return e!=null}function ar(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var ae={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=Tt.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 Tt.default.Reader?e:Tt.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=ar();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(M.decode(n,n.uint32()));continue;case 2:if(i!==18)break;r.title=n.string();continue;case 3:if(i!==26)break;r.shortDescription=n.string();continue;case 4:if(i!==34)break;r.acceptLabel=n.string();continue;case 5:if(i!==42)break;r.cancelLabel=n.string();continue;case 6:if(i!==50)break;r.id=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>M.fromJSON(t)):[],title:ut(e.title)?globalThis.String(e.title):void 0,shortDescription:ut(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:ut(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:ut(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:ut(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 ae.fromPartial(e??{})},fromPartial(e){let t=ar();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}};c.set(ae.$type,ae);function ut(e){return e!=null}function dr(){return{form:void 0}}var rn={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=q.default.Writer.create()){return e.form!==void 0&&ae.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=dr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=ae.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{form:dt(e.form)?ae.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=ae.toJSON(e.form)),t},create(e){return rn.fromPartial(e??{})},fromPartial(e){let t=dr();return t.form=e.form!==void 0&&e.form!==null?ae.fromPartial(e.form):void 0,t}};c.set(rn.$type,rn);function fr(){return{results:{},formId:void 0}}var de={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=q.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{at.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 q.default.Reader?e:q.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=fr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let s=at.decode(n,n.uint32());s.value!==void 0&&(r.results[s.key]=s.value);continue;case 2:if(i!==18)break;r.formId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{results:ro(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=N.fromJSON(o),t),{}):{},formId:dt(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,r])=>{t.results[o]=N.toJSON(r)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=fr();return t.results=Object.entries(e.results??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=N.fromPartial(r)),n),{}),t.formId=e.formId??void 0,t}};c.set(de.$type,de);function lr(){return{key:"",value:void 0}}var at={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=q.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&N.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=lr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.key=n.string();continue;case 2:if(i!==18)break;r.value=N.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:dt(e.key)?globalThis.String(e.key):"",value:dt(e.value)?N.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=N.toJSON(e.value)),t},create(e){return at.fromPartial(e??{})},fromPartial(e){let t=lr();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?N.fromPartial(e.value):void 0,t}};c.set(at.$type,at);function cr(){return{formId:void 0}}var fe={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=q.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof q.default.Reader?e:q.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=cr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.formId=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{formId:dt(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 fe.fromPartial(e??{})},fromPartial(e){let t=cr();return t.formId=e.formId??void 0,t}};c.set(fe.$type,fe);function ro(e){return typeof e=="object"&&e!==null}function dt(e){return e!=null}var Ae;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ae||(Ae={}));function oo(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return Ae.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return Ae.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return Ae.UNRECOGNIZED}}function so(e){switch(e){case Ae.WEBVIEW_VISIBLE:return 0;case Ae.WEBVIEW_HIDDEN:return 1;case Ae.UNRECOGNIZED:default:return-1}}function pr(){return{message:void 0,jsonString:""}}var xe={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=V.default.Writer.create()){return e.message!==void 0&&F.encode(F.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=pr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=F.unwrap(F.decode(n,n.uint32()));continue;case 2:if(i!==18)break;r.jsonString=n.string();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{message:X(e?.message)?e.message:void 0,jsonString:X(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 xe.fromPartial(e??{})},fromPartial(e){let t=pr();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(xe.$type,xe);function hr(){return{visibility:0}}var Pe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=V.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=hr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.visibility=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{visibility:X(e.visibility)?oo(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=so(e.visibility)),t},create(e){return Pe.fromPartial(e??{})},fromPartial(e){let t=hr();return t.visibility=e.visibility??0,t}};c.set(Pe.$type,Pe);function mr(){return{postMessage:void 0,fullScreen:void 0}}var on={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=V.default.Writer.create()){return e.postMessage!==void 0&&xe.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&Pe.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=mr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=xe.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.fullScreen=Pe.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{postMessage:X(e.postMessage)?xe.fromJSON(e.postMessage):void 0,fullScreen:X(e.fullScreen)?Pe.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=xe.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=Pe.toJSON(e.fullScreen)),t},create(e){return on.fromPartial(e??{})},fromPartial(e){let t=mr();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?xe.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?Pe.fromPartial(e.fullScreen):void 0,t}};c.set(on.$type,on);function gr(){return{immersiveMode:0}}var we={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode(e,t=V.default.Writer.create()){return e.immersiveMode!==0&&t.uint32(8).int32(e.immersiveMode),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=gr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==8)break;r.immersiveMode=n.int32();continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{immersiveMode:X(e.immersiveMode)?Ut(e.immersiveMode):0}},toJSON(e){let t={};return e.immersiveMode!==0&&(t.immersiveMode=Wt(e.immersiveMode)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=gr();return t.immersiveMode=e.immersiveMode??0,t}};c.set(we.$type,we);function Sr(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,appPermissionsConsentSubmitted:void 0}}var ft={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=V.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&fe.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&de.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&se.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),e.immersiveModeEvent!==void 0&&we.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),e.appPermissionsConsentSubmitted!==void 0&&re.encode(e.appPermissionsConsentSubmitted,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Sr();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.id=n.string();continue;case 2:if(i!==18)break;r.formCanceled=fe.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=de.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=se.decode(n,n.uint32());continue;case 5:if(i!==42)break;r.immersiveModeEvent=we.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.appPermissionsConsentSubmitted=re.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{id:X(e.id)?globalThis.String(e.id):"",formCanceled:X(e.formCanceled)?fe.fromJSON(e.formCanceled):void 0,formSubmitted:X(e.formSubmitted)?de.fromJSON(e.formSubmitted):void 0,realtimeEvent:X(e.realtimeEvent)?se.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:X(e.immersiveModeEvent)?we.fromJSON(e.immersiveModeEvent):void 0,appPermissionsConsentSubmitted:X(e.appPermissionsConsentSubmitted)?re.fromJSON(e.appPermissionsConsentSubmitted):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=fe.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=de.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=se.toJSON(e.realtimeEvent)),e.immersiveModeEvent!==void 0&&(t.immersiveModeEvent=we.toJSON(e.immersiveModeEvent)),e.appPermissionsConsentSubmitted!==void 0&&(t.appPermissionsConsentSubmitted=re.toJSON(e.appPermissionsConsentSubmitted)),t},create(e){return ft.fromPartial(e??{})},fromPartial(e){let t=Sr();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?fe.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?de.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?se.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=e.immersiveModeEvent!==void 0&&e.immersiveModeEvent!==null?we.fromPartial(e.immersiveModeEvent):void 0,t.appPermissionsConsentSubmitted=e.appPermissionsConsentSubmitted!==void 0&&e.appPermissionsConsentSubmitted!==null?re.fromPartial(e.appPermissionsConsentSubmitted):void 0,t}};c.set(ft.$type,ft);function X(e){return e!=null}var yr=[3];var Le=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:n.effect=e,yr.includes(e.type)){let o=self.crypto.randomUUID();n.id=o;let r=i=>{if(i.data?.type==="devvit-message"&&i.data?.data?.id===o){let s=ft.fromJSON(i.data.data);t(s),window.removeEventListener("message",r)}};window.addEventListener("message",r),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});var sn=new Set;function uo(e){return vr(2,e)}function ao(e){return vr(1,e)}function fo(e){sn.add(e)}function lo(e){sn.delete(e)}async function vr(e,t){if(!t.isTrusted)throw console.error("Immersive mode effect ignored due to untrusted event"),new Error("Untrusted event");await Le({type:9,immersiveMode:{immersiveMode:e}})}typeof addEventListener=="function"&&addEventListener("message",e=>{let{type:t,data:n}=e.data;if(t!=="devvit-message"||!n.immersiveMode)return;let r=e.data.data?.immersiveMode?.immersiveMode===2?"immersive":"inline";sn.forEach(i=>i(r))});function co(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.url).toString(),Le({navigateToUrl:{url:t},type:5})}function un(e,t=new Set){for(let n of e){if(n.type==="group"){un(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}po(e)}function po(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}"`}function ho(e){switch(e.fieldType){case 0:return e.stringValue;case 7:return e.stringValue;case 1:return e.stringValue;case 2:return e.numberValue;case 3:return e.boolValue;case 5:return e.selectionValue?.values??[];default:return}}function Er(e){return Object.keys(e).reduce((t,n)=>{let o=ho(e[n]);return o!==void 0&&(t[n]=o),t},{})}function an(e){return e.map(t=>{switch(t.type){case"string":return mo(t);case"image":return go(t);case"paragraph":return So(t);case"number":return yo(t);case"select":return vo(t);case"boolean":return Eo(t);case"group":return bo(t);default:throw new Error("Unknown field type.")}})}function mo(e){return{defaultValue:{fieldType:0,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{stringConfig:{placeholder:e.placeholder}},fieldId:e.name,fieldType:0,helpText:e.helpText,label:e.label,required:e.required,isSecret:e.isSecret}}function go(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function So(e){return{defaultValue:{fieldType:1,stringValue:e.defaultValue},disabled:e.disabled,fieldConfig:{paragraphConfig:{lineHeight:e.lineHeight,placeholder:e.placeholder}},fieldId:e.name,fieldType:1,helpText:e.helpText,label:e.label,required:e.required}}function yo(e){return{defaultValue:{fieldType:2,numberValue:e.defaultValue},disabled:e.disabled,fieldConfig:{numberConfig:{}},fieldId:e.name,fieldType:2,helpText:e.helpText,label:e.label,required:e.required}}function vo(e){return{defaultValue:{fieldType:5,selectionValue:{values:e.defaultValue??[]}},disabled:e.disabled,fieldConfig:{selectionConfig:{choices:e.options,multiSelect:e.multiSelect}},fieldId:e.name,fieldType:5,helpText:e.helpText,label:e.label,required:e.required}}function Eo(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function bo(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:an(e.fields)}},label:e.label,helpText:e.helpText}}var br=1,No=()=>(br++,`form.${br}`),To=async e=>{let t={fields:[],id:No(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};un(e.fields),t.fields=an(e.fields);let n=await Le({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Er(n.formSubmitted.results)}};function Io(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},Le({showToast:{toast:t},type:4})}export{fo as addImmersiveModeChangeEventListener,Kr as context,ao as exitImmersiveMode,co as navigateTo,lo as removeImmersiveModeChangeEventListener,uo as requestImmersiveMode,To as showForm,Io as showToast};
2
2
  //# sourceMappingURL=client.min.js.map