@devvit/client 0.11.19-next-2025-07-10-16-01-08-87ea7b7d1.0 → 0.11.19-next-2025-07-10-20-42-44-7cf4b3c9b.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.
@@ -230,14 +230,35 @@
230
230
  "imports": [],
231
231
  "format": "esm"
232
232
  },
233
+ "../protos/dist/types/google/protobuf/struct.js": {
234
+ "bytes": 14848,
235
+ "imports": [
236
+ {
237
+ "path": "../../node_modules/protobufjs/minimal.js",
238
+ "kind": "import-statement",
239
+ "original": "protobufjs/minimal.js"
240
+ },
241
+ {
242
+ "path": "../protos/dist/types/typeRegistry.js",
243
+ "kind": "import-statement",
244
+ "original": "../../typeRegistry.js"
245
+ }
246
+ ],
247
+ "format": "esm"
248
+ },
233
249
  "../protos/dist/types/devvit/ui/effects/web_view/v1alpha/context.js": {
234
- "bytes": 4780,
250
+ "bytes": 6766,
235
251
  "imports": [
236
252
  {
237
253
  "path": "../../node_modules/protobufjs/minimal.js",
238
254
  "kind": "import-statement",
239
255
  "original": "protobufjs/minimal.js"
240
256
  },
257
+ {
258
+ "path": "../protos/dist/types/google/protobuf/struct.js",
259
+ "kind": "import-statement",
260
+ "original": "../../../../../google/protobuf/struct.js"
261
+ },
241
262
  {
242
263
  "path": "../protos/dist/types/typeRegistry.js",
243
264
  "kind": "import-statement",
@@ -263,7 +284,7 @@
263
284
  "format": "esm"
264
285
  },
265
286
  "../web-view-scripts/dist/init-context.js": {
266
- "bytes": 1026,
287
+ "bytes": 1589,
267
288
  "imports": [
268
289
  {
269
290
  "path": "../protos/dist/types/devvit/ui/effects/web_view/v1alpha/context.js",
@@ -294,22 +315,6 @@
294
315
  ],
295
316
  "format": "esm"
296
317
  },
297
- "../protos/dist/types/google/protobuf/struct.js": {
298
- "bytes": 14848,
299
- "imports": [
300
- {
301
- "path": "../../node_modules/protobufjs/minimal.js",
302
- "kind": "import-statement",
303
- "original": "protobufjs/minimal.js"
304
- },
305
- {
306
- "path": "../protos/dist/types/typeRegistry.js",
307
- "kind": "import-statement",
308
- "original": "../../typeRegistry.js"
309
- }
310
- ],
311
- "format": "esm"
312
- },
313
318
  "../../node_modules/rxjs/dist/esm5/internal/util/isFunction.js": {
314
319
  "bytes": 116,
315
320
  "imports": [],
@@ -4966,7 +4971,7 @@
4966
4971
  "format": "esm"
4967
4972
  },
4968
4973
  "src/index.ts": {
4969
- "bytes": 122,
4974
+ "bytes": 188,
4970
4975
  "imports": [
4971
4976
  {
4972
4977
  "path": "src/context.ts",
@@ -4987,7 +4992,7 @@
4987
4992
  "imports": [],
4988
4993
  "exports": [],
4989
4994
  "inputs": {},
4990
- "bytes": 326370
4995
+ "bytes": 330441
4991
4996
  },
4992
4997
  "dist/client.min.js": {
4993
4998
  "imports": [],
@@ -5055,7 +5060,10 @@
5055
5060
  "bytesInOutput": 49
5056
5061
  },
5057
5062
  "../protos/dist/types/devvit/ui/effects/web_view/v1alpha/context.js": {
5058
- "bytesInOutput": 2034
5063
+ "bytesInOutput": 2927
5064
+ },
5065
+ "../protos/dist/types/google/protobuf/struct.js": {
5066
+ "bytesInOutput": 6248
5059
5067
  },
5060
5068
  "../protos/dist/types/typeRegistry.js": {
5061
5069
  "bytesInOutput": 14
@@ -5067,7 +5075,7 @@
5067
5075
  "bytesInOutput": 605
5068
5076
  },
5069
5077
  "../web-view-scripts/dist/init-context.js": {
5070
- "bytesInOutput": 352
5078
+ "bytesInOutput": 559
5071
5079
  },
5072
5080
  "src/context.ts": {
5073
5081
  "bytesInOutput": 224
@@ -5078,9 +5086,6 @@
5078
5086
  "../protos/dist/types/devvit/ui/events/v1alpha/web_view.js": {
5079
5087
  "bytesInOutput": 5409
5080
5088
  },
5081
- "../protos/dist/types/google/protobuf/struct.js": {
5082
- "bytesInOutput": 6248
5083
- },
5084
5089
  "../protos/dist/types/devvit/ui/effects/v1alpha/realtime_subscriptions.js": {
5085
5090
  "bytesInOutput": 2445
5086
5091
  },
@@ -5133,7 +5138,7 @@
5133
5138
  "bytesInOutput": 141
5134
5139
  }
5135
5140
  },
5136
- "bytes": 73958
5141
+ "bytes": 75058
5137
5142
  }
5138
5143
  }
5139
5144
  }
package/client.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var zn=Object.create;var lt=Object.defineProperty;var Kn=Object.getOwnPropertyDescriptor;var Qn=Object.getOwnPropertyNames;var Yn=Object.getPrototypeOf,Xn=Object.prototype.hasOwnProperty;var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var jn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Qn(t))!Xn.call(e,r)&&r!==n&&lt(e,r,{get:()=>t[r],enumerable:!(o=Kn(t,r))||o.enumerable});return e};var A=(e,t,n)=>(n=e!=null?zn(Yn(e)):{},jn(t||!e||!e.__esModule?lt(n,"default",{value:e,enumerable:!0}):n,e));var st=b((Pi,dt)=>{"use strict";dt.exports=ei;function ei(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(l,u){n[o]=function(s){if(i)if(i=!1,s)u(s);else{for(var F=new Array(arguments.length-1),se=0;se<F.length;)F[se++]=arguments[se];l.apply(null,F)}};try{e.apply(t||null,n)}catch(f){i&&(i=!1,u(f))}})}});var mt=b(ht=>{"use strict";var Re=ht;Re.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 Se=new Array(64),pt=new Array(123);for(R=0;R<64;)pt[Se[R]=R<26?R+65:R<52?R+71:R<62?R-4:R-59|43]=R++;var R;Re.encode=function(t,n,o){for(var r=null,i=[],a=0,l=0,u;n<o;){var f=t[n++];switch(l){case 0:i[a++]=Se[f>>2],u=(f&3)<<4,l=1;break;case 1:i[a++]=Se[u|f>>4],u=(f&15)<<2,l=2;break;case 2:i[a++]=Se[u|f>>6],i[a++]=Se[f&63],l=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),a=0)}return l&&(i[a++]=Se[u],i[a++]=61,l===1&&(i[a++]=61)),r?(a&&r.push(String.fromCharCode.apply(String,i.slice(0,a))),r.join("")):String.fromCharCode.apply(String,i.slice(0,a))};var ct="invalid encoding";Re.decode=function(t,n,o){for(var r=o,i=0,a,l=0;l<t.length;){var u=t.charCodeAt(l++);if(u===61&&i>1)break;if((u=pt[u])===void 0)throw Error(ct);switch(i){case 0:a=u,i=1;break;case 1:n[o++]=a<<2|(u&48)>>4,a=u,i=2;break;case 2:n[o++]=(a&15)<<4|(u&60)>>2,a=u,i=3;break;case 3:n[o++]=(a&3)<<6|u,i=0;break}}if(i===1)throw Error(ct);return o-r};Re.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var gt=b((Di,yt)=>{"use strict";yt.exports=we;function we(){this._listeners={}}we.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};we.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};we.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 Vt=b((Wi,Nt)=>{"use strict";Nt.exports=St(St);function St(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function r(u,f,s){t[0]=u,f[s]=n[0],f[s+1]=n[1],f[s+2]=n[2],f[s+3]=n[3]}function i(u,f,s){t[0]=u,f[s]=n[3],f[s+1]=n[2],f[s+2]=n[1],f[s+3]=n[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function a(u,f){return n[0]=u[f],n[1]=u[f+1],n[2]=u[f+2],n[3]=u[f+3],t[0]}function l(u,f){return n[3]=u[f],n[2]=u[f+1],n[1]=u[f+2],n[0]=u[f+3],t[0]}e.readFloatLE=o?a:l,e.readFloatBE=o?l:a}():function(){function t(o,r,i,a){var l=r<0?1:0;if(l&&(r=-r),r===0)o(1/r>0?0:2147483648,i,a);else if(isNaN(r))o(2143289344,i,a);else if(r>34028234663852886e22)o((l<<31|2139095040)>>>0,i,a);else if(r<11754943508222875e-54)o((l<<31|Math.round(r/1401298464324817e-60))>>>0,i,a);else{var u=Math.floor(Math.log(r)/Math.LN2),f=Math.round(r*Math.pow(2,-u)*8388608)&8388607;o((l<<31|u+127<<23|f)>>>0,i,a)}}e.writeFloatLE=t.bind(null,bt),e.writeFloatBE=t.bind(null,Et);function n(o,r,i){var a=o(r,i),l=(a>>31)*2+1,u=a>>>23&255,f=a&8388607;return u===255?f?NaN:l*(1/0):u===0?l*1401298464324817e-60*f:l*Math.pow(2,u-150)*(f+8388608)}e.readFloatLE=n.bind(null,vt),e.readFloatBE=n.bind(null,Tt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function r(u,f,s){t[0]=u,f[s]=n[0],f[s+1]=n[1],f[s+2]=n[2],f[s+3]=n[3],f[s+4]=n[4],f[s+5]=n[5],f[s+6]=n[6],f[s+7]=n[7]}function i(u,f,s){t[0]=u,f[s]=n[7],f[s+1]=n[6],f[s+2]=n[5],f[s+3]=n[4],f[s+4]=n[3],f[s+5]=n[2],f[s+6]=n[1],f[s+7]=n[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function a(u,f){return n[0]=u[f],n[1]=u[f+1],n[2]=u[f+2],n[3]=u[f+3],n[4]=u[f+4],n[5]=u[f+5],n[6]=u[f+6],n[7]=u[f+7],t[0]}function l(u,f){return n[7]=u[f],n[6]=u[f+1],n[5]=u[f+2],n[4]=u[f+3],n[3]=u[f+4],n[2]=u[f+5],n[1]=u[f+6],n[0]=u[f+7],t[0]}e.readDoubleLE=o?a:l,e.readDoubleBE=o?l:a}():function(){function t(o,r,i,a,l,u){var f=a<0?1:0;if(f&&(a=-a),a===0)o(0,l,u+r),o(1/a>0?0:2147483648,l,u+i);else if(isNaN(a))o(0,l,u+r),o(2146959360,l,u+i);else if(a>17976931348623157e292)o(0,l,u+r),o((f<<31|2146435072)>>>0,l,u+i);else{var s;if(a<22250738585072014e-324)s=a/5e-324,o(s>>>0,l,u+r),o((f<<31|s/4294967296)>>>0,l,u+i);else{var F=Math.floor(Math.log(a)/Math.LN2);F===1024&&(F=1023),s=a*Math.pow(2,-F),o(s*4503599627370496>>>0,l,u+r),o((f<<31|F+1023<<20|s*1048576&1048575)>>>0,l,u+i)}}}e.writeDoubleLE=t.bind(null,bt,0,4),e.writeDoubleBE=t.bind(null,Et,4,0);function n(o,r,i,a,l){var u=o(a,l+r),f=o(a,l+i),s=(f>>31)*2+1,F=f>>>20&2047,se=4294967296*(f&1048575)+u;return F===2047?se?NaN:s*(1/0):F===0?s*5e-324*se:s*Math.pow(2,F-1075)*(se+4503599627370496)}e.readDoubleLE=n.bind(null,vt,0,4),e.readDoubleBE=n.bind(null,Tt,4,0)}(),e}function bt(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 Et(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 vt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Tt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Ct=b((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 kt=b(xt=>{"use strict";var Me=xt;Me.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};Me.read=function(t,n,o){var r=o-n;if(r<1)return"";for(var i=null,a=[],l=0,u;n<o;)u=t[n++],u<128?a[l++]=u:u>191&&u<224?a[l++]=(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,a[l++]=55296+(u>>10),a[l++]=56320+(u&1023)):a[l++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,l>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),l=0);return i?(l&&i.push(String.fromCharCode.apply(String,a.slice(0,l))),i.join("")):String.fromCharCode.apply(String,a.slice(0,l))};Me.write=function(t,n,o){for(var r=o,i,a,l=0;l<t.length;++l)i=t.charCodeAt(l),i<128?n[o++]=i:i<2048?(n[o++]=i>>6|192,n[o++]=i&63|128):(i&64512)===55296&&((a=t.charCodeAt(l+1))&64512)===56320?(i=65536+((i&1023)<<10)+(a&1023),++l,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 Ft=b((Ui,It)=>{"use strict";It.exports=ti;function ti(e,t,n){var o=n||8192,r=o>>>1,i=null,a=o;return function(u){if(u<1||u>r)return e(u);a+u>o&&(i=e(o),a=0);var f=t.call(i,a,a+=u);return a&7&&(a=(a|7)+1),f}}});var Ot=b(($i,_t)=>{"use strict";_t.exports=E;var Ne=H();function E(e,t){this.lo=e>>>0,this.hi=t>>>0}var ce=E.zero=new E(0,0);ce.toNumber=function(){return 0};ce.zzEncode=ce.zzDecode=function(){return this};ce.length=function(){return 1};var ni=E.zeroHash="\0\0\0\0\0\0\0\0";E.fromNumber=function(t){if(t===0)return ce;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 E(o,r)};E.from=function(t){if(typeof t=="number")return E.fromNumber(t);if(Ne.isString(t))if(Ne.Long)t=Ne.Long.fromString(t);else return E.fromNumber(parseInt(t,10));return t.low||t.high?new E(t.low>>>0,t.high>>>0):ce};E.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};E.prototype.toLong=function(t){return Ne.Long?new Ne.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var q=String.prototype.charCodeAt;E.fromHash=function(t){return t===ni?ce:new E((q.call(t,0)|q.call(t,1)<<8|q.call(t,2)<<16|q.call(t,3)<<24)>>>0,(q.call(t,4)|q.call(t,5)<<8|q.call(t,6)<<16|q.call(t,7)<<24)>>>0)};E.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)};E.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};E.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};E.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 H=b(Ue=>{"use strict";var d=Ue;d.asPromise=st();d.base64=mt();d.EventEmitter=gt();d.float=Vt();d.inquire=Ct();d.utf8=kt();d.pool=Ft();d.LongBits=Ot();d.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);d.global=d.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Ue;d.emptyArray=Object.freeze?Object.freeze([]):[];d.emptyObject=Object.freeze?Object.freeze({}):{};d.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};d.isString=function(t){return typeof t=="string"||t instanceof String};d.isObject=function(t){return t&&typeof t=="object"};d.isset=d.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};d.Buffer=function(){try{var e=d.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();d._Buffer_from=null;d._Buffer_allocUnsafe=null;d.newBuffer=function(t){return typeof t=="number"?d.Buffer?d._Buffer_allocUnsafe(t):new d.Array(t):d.Buffer?d._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};d.Array=typeof Uint8Array<"u"?Uint8Array:Array;d.Long=d.global.dcodeIO&&d.global.dcodeIO.Long||d.global.Long||d.inquire("long");d.key2Re=/^true|false|0|1$/;d.key32Re=/^-?(?:0|[1-9][0-9]*)$/;d.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;d.longToHash=function(t){return t?d.LongBits.from(t).toHash():d.LongBits.zeroHash};d.longFromHash=function(t,n){var o=d.LongBits.fromHash(t);return d.Long?d.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function Rt(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}d.merge=Rt;d.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function wt(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&&Rt(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}d.newError=wt;d.ProtocolError=wt("ProtocolError");d.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]}};d.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};d.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};d._configure=function(){var e=d.Buffer;if(!e){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},d._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var Ke=b((qi,Pt)=>{"use strict";Pt.exports=h;var _=H(),$e,Le=_.LongBits,Lt=_.base64,Bt=_.utf8;function Ve(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function qe(){}function ii(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new Ve(qe,0,0),this.tail=this.head,this.states=null}var At=function(){return _.Buffer?function(){return(h.create=function(){return new $e})()}:function(){return new h}};h.create=At();h.alloc=function(t){return new _.Array(t)};_.Array!==Array&&(h.alloc=_.pool(h.alloc,_.Array.prototype.subarray));h.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Ve(t,n,o),this.len+=n,this};function He(e,t,n){t[n]=e&255}function ri(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Ze(e,t){this.len=e,this.next=void 0,this.val=t}Ze.prototype=Object.create(Ve.prototype);Ze.prototype.fn=ri;h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Ze((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};h.prototype.int32=function(t){return t<0?this._push(ze,10,Le.fromNumber(t)):this.uint32(t)};h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function ze(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}h.prototype.uint64=function(t){var n=Le.from(t);return this._push(ze,n.length(),n)};h.prototype.int64=h.prototype.uint64;h.prototype.sint64=function(t){var n=Le.from(t).zzEncode();return this._push(ze,n.length(),n)};h.prototype.bool=function(t){return this._push(He,1,t?1:0)};function Ge(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}h.prototype.fixed32=function(t){return this._push(Ge,4,t>>>0)};h.prototype.sfixed32=h.prototype.fixed32;h.prototype.fixed64=function(t){var n=Le.from(t);return this._push(Ge,4,n.lo)._push(Ge,4,n.hi)};h.prototype.sfixed64=h.prototype.fixed64;h.prototype.float=function(t){return this._push(_.float.writeFloatLE,4,t)};h.prototype.double=function(t){return this._push(_.float.writeDoubleLE,8,t)};var oi=_.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]};h.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(He,1,0);if(_.isString(t)){var o=h.alloc(n=Lt.length(t));Lt.decode(t,o,0),t=o}return this.uint32(n)._push(oi,n,t)};h.prototype.string=function(t){var n=Bt.length(t);return n?this.uint32(n)._push(Bt.write,n,t):this._push(He,1,0)};h.prototype.fork=function(){return this.states=new ii(this),this.head=this.tail=new Ve(qe,0,0),this.len=0,this};h.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 Ve(qe,0,0),this.len=0),this};h.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};h.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};h._configure=function(e){$e=e,h.create=At(),$e._configure()}});var Wt=b((Hi,Dt)=>{"use strict";Dt.exports=P;var Jt=Ke();(P.prototype=Object.create(Jt.prototype)).constructor=P;var Z=H();function P(){Jt.call(this)}P._configure=function(){P.alloc=Z._Buffer_allocUnsafe,P.writeBytesBuffer=Z.Buffer&&Z.Buffer.prototype instanceof Uint8Array&&Z.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++]}};P.prototype.bytes=function(t){Z.isString(t)&&(t=Z._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(P.writeBytesBuffer,n,t),this};function ui(e,t,n){e.length<40?Z.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}P.prototype.string=function(t){var n=Z.Buffer.byteLength(t);return this.uint32(n),n&&this._push(ui,n,t),this};P._configure()});var Xe=b((Zi,qt)=>{"use strict";qt.exports=g;var w=H(),Ye,$t=w.LongBits,ai=w.utf8;function L(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function g(e){this.buf=e,this.pos=0,this.len=e.length}var Mt=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new g(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new g(t);throw Error("illegal buffer")},Gt=function(){return w.Buffer?function(n){return(g.create=function(r){return w.Buffer.isBuffer(r)?new Ye(r):Mt(r)})(n)}:Mt};g.create=Gt();g.prototype._slice=w.Array.prototype.subarray||w.Array.prototype.slice;g.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,L(this,10);return t}}();g.prototype.int32=function(){return this.uint32()|0};g.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Qe(){var e=new $t(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 L(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 L(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")}g.prototype.bool=function(){return this.uint32()!==0};function Be(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}g.prototype.fixed32=function(){if(this.pos+4>this.len)throw L(this,4);return Be(this.buf,this.pos+=4)};g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw L(this,4);return Be(this.buf,this.pos+=4)|0};function Ut(){if(this.pos+8>this.len)throw L(this,8);return new $t(Be(this.buf,this.pos+=4),Be(this.buf,this.pos+=4))}g.prototype.float=function(){if(this.pos+4>this.len)throw L(this,4);var t=w.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};g.prototype.double=function(){if(this.pos+8>this.len)throw L(this,4);var t=w.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};g.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw L(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var r=w.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};g.prototype.string=function(){var t=this.bytes();return ai.read(t,0,t.length)};g.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw L(this,t);this.pos+=t}else do if(this.pos>=this.len)throw L(this);while(this.buf[this.pos++]&128);return this};g.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};g._configure=function(e){Ye=e,g.create=Gt(),Ye._configure();var t=w.Long?"toLong":"toNumber";w.merge(g.prototype,{int64:function(){return Qe.call(this)[t](!1)},uint64:function(){return Qe.call(this)[t](!0)},sint64:function(){return Qe.call(this).zzDecode()[t](!1)},fixed64:function(){return Ut.call(this)[t](!0)},sfixed64:function(){return Ut.call(this)[t](!1)}})}});var Kt=b((zi,zt)=>{"use strict";zt.exports=pe;var Zt=Xe();(pe.prototype=Object.create(Zt.prototype)).constructor=pe;var Ht=H();function pe(e){Zt.call(this,e)}pe._configure=function(){Ht.Buffer&&(pe.prototype._slice=Ht.Buffer.prototype.slice)};pe.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))};pe._configure()});var Yt=b((Ki,Qt)=>{"use strict";Qt.exports=Ce;var je=H();(Ce.prototype=Object.create(je.EventEmitter.prototype)).constructor=Ce;function Ce(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");je.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}Ce.prototype.rpcCall=function e(t,n,o,r,i){if(!r)throw TypeError("request must be specified");var a=this;if(!i)return je.asPromise(e,a,t,n,o,r);if(!a.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(u,f){if(u)return a.emit("error",u,t),i(u);if(f===null){a.end(!0);return}if(!(f instanceof o))try{f=o[a.responseDelimited?"decodeDelimited":"decode"](f)}catch(s){return a.emit("error",s,t),i(s)}return a.emit("data",f,t),i(null,f)})}catch(l){a.emit("error",l,t),setTimeout(function(){i(l)},0);return}};Ce.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var jt=b(Xt=>{"use strict";var fi=Xt;fi.Service=Yt()});var tn=b((Yi,en)=>{"use strict";en.exports={}});var on=b(rn=>{"use strict";var T=rn;T.build="minimal";T.Writer=Ke();T.BufferWriter=Wt();T.Reader=Xe();T.BufferReader=Kt();T.util=H();T.rpc=jt();T.roots=tn();T.configure=nn;function nn(){T.util._configure(),T.Writer._configure(T.BufferWriter),T.Reader._configure(T.BufferReader)}nn()});var B=b((ji,un)=>{"use strict";un.exports=on()});var Ae=A(B(),1);var c=new Map;function an(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var xe={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,t=Ae.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 Ae.default.Reader?e:Ae.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=an();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:be(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:be(e.subredditName)?globalThis.String(e.subredditName):"",userId:be(e.userId)?globalThis.String(e.userId):"",appName:be(e.appName)?globalThis.String(e.appName):"",appVersion:be(e.appVersion)?globalThis.String(e.appVersion):"",postId:be(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 xe.fromPartial(e??{})},fromPartial(e){let t=an();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(xe.$type,xe);function be(e){return e!=null}function Pe(e,t){if(!e)throw Error(t)}var z;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(z||(z={}));function li(e){return e.startsWith(z.ACCOUNT)}function di(e){return e.startsWith(z.LINK)}function si(e){return e.startsWith(z.SUBREDDIT)}function ci(e){Pe(li(e),`Expected account id to start with ${z.ACCOUNT}, got ${e}}`)}function pi(e){Pe(di(e),`Expected link id to start with ${z.LINK}, got ${e}}`)}function hi(e){Pe(si(e),`Expected subreddit id to start with ${z.SUBREDDIT}, got ${e}}`)}function fn(e){return ci(e),e}function ln(e){return pi(e),e}function dn(e){return hi(e),e}var mi=({search:e})=>{let t=new URLSearchParams(e).get("context");if(t){let n=decodeURIComponent(t),o=xe.fromJSON(JSON.parse(n)),r={subredditId:dn(o.subredditId),userId:fn(o.userId),subredditName:o.subredditName,appName:o.appName,appVersion:o.appVersion,postId:ln(o.postId)};globalThis.devvit={context:r}}};globalThis.location&&mi(globalThis.location);var yi=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 I=A(B(),1);var V=A(B(),1);var me;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(me||(me={}));function gi(e){switch(e){case 0:case"NULL_VALUE":return me.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return me.UNRECOGNIZED}}function Si(e){switch(e){case me.NULL_VALUE:return 0;case me.UNRECOGNIZED:default:return-1}}function et(){return{fields:{}}}var O={$type:"google.protobuf.Struct",encode(e,t=V.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&ke.encode({key:n,value:o},t.uint32(10).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=et();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=ke.decode(n,n.uint32());a.value!==void 0&&(r.fields[a.key]=a.value);continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:cn(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 O.fromPartial(e??{})},fromPartial(e){let t=et();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=r),n),{}),t},wrap(e){let t=et();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(O.$type,O);function sn(){return{key:"",value:void 0}}var ke={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=V.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&v.encode(v.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=sn();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=v.unwrap(v.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:Ee(e.key)?globalThis.String(e.key):"",value:Ee(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 ke.fromPartial(e??{})},fromPartial(e){let t=sn();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(ke.$type,ke);function tt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var v={$type:"google.protobuf.Value",encode(e,t=V.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&&O.encode(O.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&he.encode(he.wrap(e.listValue),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=tt();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=O.unwrap(O.decode(n,n.uint32()));continue;case 6:if(i!==50)break;r.listValue=he.unwrap(he.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{nullValue:Ee(e.nullValue)?gi(e.nullValue):void 0,numberValue:Ee(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:Ee(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:Ee(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:cn(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=Si(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return v.fromPartial(e??{})},fromPartial(e){let t=tt();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=tt();if(e===null)t.nullValue=me.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(v.$type,v);function nt(){return{values:[]}}var he={$type:"google.protobuf.ListValue",encode(e,t=V.default.Writer.create()){for(let n of e.values)v.encode(v.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof V.default.Reader?e:V.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=nt();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(v.unwrap(v.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 he.fromPartial(e??{})},fromPartial(e){let t=nt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=nt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(he.$type,he);function cn(e){return typeof e=="object"&&e!==null}function Ee(e){return e!=null}var ge=A(B(),1);var ye=A(B(),1);var Je=A(B(),1);function pn(){return{}}var De={$type:"google.protobuf.Empty",encode(e,t=Je.default.Writer.create()){return t},decode(e,t){let n=e instanceof Je.default.Reader?e:Je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=pn();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 De.fromPartial(e??{})},fromPartial(e){return pn()}};c.set(De.$type,De);function hn(){return{channels:[]}}var it={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=ye.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof ye.default.Reader?e:ye.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=hn();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 it.fromPartial(e??{})},fromPartial(e){let t=hn();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(it.$type,it);function mn(){return{channel:"",data:void 0}}var J={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=ye.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&O.encode(O.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof ye.default.Reader?e:ye.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=mn();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=O.unwrap(O.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{channel:Ei(e.channel)?globalThis.String(e.channel):"",data:bi(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 J.fromPartial(e??{})},fromPartial(e){let t=mn();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(J.$type,J);function bi(e){return typeof e=="object"&&e!==null}function Ei(e){return e!=null}var K;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(K||(K={}));function vi(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return K.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return K.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function Ti(e){switch(e){case K.REALTIME_SUBSCRIBED:return 0;case K.REALTIME_UNSUBSCRIBED:return 1;case K.UNRECOGNIZED:default:return-1}}function yn(){return{subscriptionIds:[]}}var rt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=ge.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof ge.default.Reader?e:ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=yn();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 rt.fromPartial(e??{})},fromPartial(e){let t=yn();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(rt.$type,rt);function gn(){return{event:void 0,status:void 0}}var D={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=ge.default.Writer.create()){return e.event!==void 0&&J.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 ge.default.Reader?e:ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=gn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.event=J.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:Sn(e.event)?J.fromJSON(e.event):void 0,status:Sn(e.status)?vi(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=J.toJSON(e.event)),e.status!==void 0&&(t.status=Ti(e.status)),t},create(e){return D.fromPartial(e??{})},fromPartial(e){let t=gn();return t.event=e.event!==void 0&&e.event!==null?J.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(D.$type,D);function Sn(e){return e!=null}var k=A(B(),1);var We=A(B(),1);var m=A(B(),1);var S;(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"})(S||(S={}));function ve(e){switch(e){case 0:case"STRING":return S.STRING;case 1:case"PARAGRAPH":return S.PARAGRAPH;case 2:case"NUMBER":return S.NUMBER;case 3:case"BOOLEAN":return S.BOOLEAN;case 4:case"LIST":return S.LIST;case 5:case"SELECTION":return S.SELECTION;case 6:case"GROUP":return S.GROUP;case 7:case"IMAGE":return S.IMAGE;case-1:case"UNRECOGNIZED":default:return S.UNRECOGNIZED}}function Te(e){switch(e){case S.STRING:return 0;case S.PARAGRAPH:return 1;case S.NUMBER:return 2;case S.BOOLEAN:return 3;case S.LIST:return 4;case S.SELECTION:return 5;case S.GROUP:return 6;case S.IMAGE:return 7;case S.UNRECOGNIZED:default:return-1}}var C=A(B(),1);function bn(){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 y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=C.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&&Q.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Y.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&X.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=bn();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=Q.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionValue=Y.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupValue=X.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fieldType:W(e.fieldType)?ve(e.fieldType):0,isSecret:W(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:W(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:W(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:W(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:W(e.listValue)?Q.fromJSON(e.listValue):void 0,selectionValue:W(e.selectionValue)?Y.fromJSON(e.selectionValue):void 0,groupValue:W(e.groupValue)?X.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Te(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=Q.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Y.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=X.toJSON(e.groupValue)),t},create(e){return y.fromPartial(e??{})},fromPartial(e){let t=bn();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?Q.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Y.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?X.fromPartial(e.groupValue):void 0,t}};c.set(y.$type,y);function En(){return{itemType:0,items:[]}}var Q={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=C.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)y.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=En();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(y.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{itemType:W(e.itemType)?ve(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>y.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Te(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>y.toJSON(n))),t},create(e){return Q.fromPartial(e??{})},fromPartial(e){let t=En();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>y.fromPartial(n))||[],t}};c.set(Q.$type,Q);function vn(){return{values:[]}}var Y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=C.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=vn();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 Y.fromPartial(e??{})},fromPartial(e){let t=vn();return t.values=e.values?.map(n=>n)||[],t}};c.set(Y.$type,Y);function Tn(){return{}}var X={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=C.default.Writer.create()){return t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Tn();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 X.fromPartial(e??{})},fromPartial(e){return Tn()}};c.set(X.$type,X);function W(e){return e!=null}function Nn(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var N={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=m.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&&y.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&&x.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Nn();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=y.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=x.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:p(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:p(e.fieldType)?ve(e.fieldType):0,label:p(e.label)?globalThis.String(e.label):"",helpText:p(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:p(e.defaultValue)?y.fromJSON(e.defaultValue):void 0,required:p(e.required)?globalThis.Boolean(e.required):void 0,disabled:p(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:p(e.fieldConfig)?x.fromJSON(e.fieldConfig):void 0,isSecret:p(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Te(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=y.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=x.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return N.fromPartial(e??{})},fromPartial(e){let t=Nn();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?y.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?x.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(N.$type,N);function Vn(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var x={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=m.default.Writer.create()){return e.stringConfig!==void 0&&j.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&ee.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&te.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&ne.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&ie.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&re.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&ue.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Vn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=j.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=ee.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.numberConfig=te.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=ne.decode(n,n.uint32());continue;case 5:if(i!==42)break;r.listConfig=ie.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=re.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupConfig=ue.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{stringConfig:p(e.stringConfig)?j.fromJSON(e.stringConfig):void 0,paragraphConfig:p(e.paragraphConfig)?ee.fromJSON(e.paragraphConfig):void 0,numberConfig:p(e.numberConfig)?te.fromJSON(e.numberConfig):void 0,booleanConfig:p(e.booleanConfig)?ne.fromJSON(e.booleanConfig):void 0,listConfig:p(e.listConfig)?ie.fromJSON(e.listConfig):void 0,selectionConfig:p(e.selectionConfig)?re.fromJSON(e.selectionConfig):void 0,groupConfig:p(e.groupConfig)?ue.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=j.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=ee.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=te.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=ne.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=ie.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=re.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=ue.toJSON(e.groupConfig)),t},create(e){return x.fromPartial(e??{})},fromPartial(e){let t=Vn();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?j.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?ee.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?te.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?ne.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?ie.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?re.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?ue.fromPartial(e.groupConfig):void 0,t}};c.set(x.$type,x);function Cn(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var j={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Cn();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:p(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:p(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:p(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 j.fromPartial(e??{})},fromPartial(e){let t=Cn();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(j.$type,j);function xn(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var ee={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=xn();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:p(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:p(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:p(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 ee.fromPartial(e??{})},fromPartial(e){let t=xn();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ee.$type,ee);function kn(){return{step:void 0,min:void 0,max:void 0}}var te={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=kn();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:p(e.step)?globalThis.Number(e.step):void 0,min:p(e.min)?globalThis.Number(e.min):void 0,max:p(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 te.fromPartial(e??{})},fromPartial(e){let t=kn();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(te.$type,te);function In(){return{}}var ne={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=m.default.Writer.create()){return t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=In();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 ne.fromPartial(e??{})},fromPartial(e){return In()}};c.set(ne.$type,ne);function Fn(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=m.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&x.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Fn();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=x.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:p(e.itemType)?ve(e.itemType):0,itemConfig:p(e.itemConfig)?x.fromJSON(e.itemConfig):void 0,minEntries:p(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:p(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:p(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Te(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=x.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 ie.fromPartial(e??{})},fromPartial(e){let t=Fn();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?x.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(ie.$type,ie);function _n(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var re={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=m.default.Writer.create()){for(let n of e.choices)oe.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=_n();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.choices.push(oe.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=>oe.fromJSON(t)):[],multiSelect:p(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:p(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:p(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:p(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>oe.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 re.fromPartial(e??{})},fromPartial(e){let t=_n();return t.choices=e.choices?.map(n=>oe.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(re.$type,re);function On(){return{label:"",value:""}}var oe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=On();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:p(e.label)?globalThis.String(e.label):"",value:p(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 oe.fromPartial(e??{})},fromPartial(e){let t=On();return t.label=e.label??"",t.value=e.value??"",t}};c.set(oe.$type,oe);function Rn(){return{fields:[]}}var ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=m.default.Writer.create()){for(let n of e.fields)N.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Rn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(N.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=>N.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>N.toJSON(n))),t},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=Rn();return t.fields=e.fields?.map(n=>N.fromPartial(n))||[],t}};c.set(ue.$type,ue);function p(e){return e!=null}function wn(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var M={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=We.default.Writer.create()){for(let n of e.fields)N.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 We.default.Reader?e:We.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=wn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.fields.push(N.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=>N.fromJSON(t)):[],title:Ie(e.title)?globalThis.String(e.title):void 0,shortDescription:Ie(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:Ie(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:Ie(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:Ie(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>N.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 M.fromPartial(e??{})},fromPartial(e){let t=wn();return t.fields=e.fields?.map(n=>N.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(M.$type,M);function Ie(e){return e!=null}function Ln(){return{form:void 0}}var ot={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=k.default.Writer.create()){return e.form!==void 0&&M.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof k.default.Reader?e:k.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Ln();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=M.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{form:_e(e.form)?M.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=M.toJSON(e.form)),t},create(e){return ot.fromPartial(e??{})},fromPartial(e){let t=Ln();return t.form=e.form!==void 0&&e.form!==null?M.fromPartial(e.form):void 0,t}};c.set(ot.$type,ot);function Bn(){return{results:{},formId:void 0}}var U={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=k.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{Fe.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 k.default.Reader?e:k.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Bn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=Fe.decode(n,n.uint32());a.value!==void 0&&(r.results[a.key]=a.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:Ni(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=y.fromJSON(o),t),{}):{},formId:_e(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]=y.toJSON(r)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=Bn();return t.results=Object.entries(e.results??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=y.fromPartial(r)),n),{}),t.formId=e.formId??void 0,t}};c.set(U.$type,U);function An(){return{key:"",value:void 0}}var Fe={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=k.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&y.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof k.default.Reader?e:k.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=An();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=y.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:_e(e.key)?globalThis.String(e.key):"",value:_e(e.value)?y.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=y.toJSON(e.value)),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=An();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?y.fromPartial(e.value):void 0,t}};c.set(Fe.$type,Fe);function Pn(){return{formId:void 0}}var $={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=k.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof k.default.Reader?e:k.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Pn();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:_e(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 $.fromPartial(e??{})},fromPartial(e){let t=Pn();return t.formId=e.formId??void 0,t}};c.set($.$type,$);function Ni(e){return typeof e=="object"&&e!==null}function _e(e){return e!=null}var le;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(le||(le={}));function Vi(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return le.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return le.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return le.UNRECOGNIZED}}function Ci(e){switch(e){case le.WEBVIEW_VISIBLE:return 0;case le.WEBVIEW_HIDDEN:return 1;case le.UNRECOGNIZED:default:return-1}}function Jn(){return{message:void 0,jsonString:""}}var ae={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=I.default.Writer.create()){return e.message!==void 0&&v.encode(v.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Jn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=v.unwrap(v.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:G(e?.message)?e.message:void 0,jsonString:G(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 ae.fromPartial(e??{})},fromPartial(e){let t=Jn();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(ae.$type,ae);function Dn(){return{visibility:0}}var fe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=I.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Dn();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:G(e.visibility)?Vi(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Ci(e.visibility)),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=Dn();return t.visibility=e.visibility??0,t}};c.set(fe.$type,fe);function Wn(){return{postMessage:void 0,fullScreen:void 0}}var ut={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=I.default.Writer.create()){return e.postMessage!==void 0&&ae.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&fe.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Wn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=ae.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.fullScreen=fe.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{postMessage:G(e.postMessage)?ae.fromJSON(e.postMessage):void 0,fullScreen:G(e.fullScreen)?fe.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=ae.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=fe.toJSON(e.fullScreen)),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=Wn();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?ae.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?fe.fromPartial(e.fullScreen):void 0,t}};c.set(ut.$type,ut);function Mn(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0}}var Oe={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=I.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&$.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&U.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&D.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=Mn();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=$.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=U.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=D.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{id:G(e.id)?globalThis.String(e.id):"",formCanceled:G(e.formCanceled)?$.fromJSON(e.formCanceled):void 0,formSubmitted:G(e.formSubmitted)?U.fromJSON(e.formSubmitted):void 0,realtimeEvent:G(e.realtimeEvent)?D.fromJSON(e.realtimeEvent):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=$.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=U.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=D.toJSON(e.realtimeEvent)),t},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let t=Mn();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?$.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?U.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?D.fromPartial(e.realtimeEvent):void 0,t}};c.set(Oe.$type,Oe);function G(e){return e!=null}var Un=[3];var de=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:n.effect=e,Un.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 a=Oe.fromJSON(i.data.data);t(a),window.removeEventListener("message",r)}};window.addEventListener("message",r),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});function $n(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.url).toString(),de({navigateToUrl:{url:t},type:5})}function at(e,t=new Set){for(let n of e){if(n.type==="group"){at(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}xi(e)}function xi(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 ki(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 Gn(e){return Object.keys(e).reduce((t,n)=>{let o=ki(e[n]);return o!==void 0&&(t[n]=o),t},{})}function ft(e){return e.map(t=>{switch(t.type){case"string":return Ii(t);case"image":return Fi(t);case"paragraph":return _i(t);case"number":return Oi(t);case"select":return Ri(t);case"boolean":return wi(t);case"group":return Li(t);default:throw new Error("Unknown field type.")}})}function Ii(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 Fi(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function _i(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 Oi(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 Ri(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 wi(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Li(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:ft(e.fields)}},label:e.label,helpText:e.helpText}}var qn=1,Bi=()=>(qn++,`form.${qn}`),Hn=async e=>{let t={fields:[],id:Bi(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};at(e.fields),t.fields=ft(e.fields);let n=await de({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Gn(n.formSubmitted.results)}};function Zn(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},de({showToast:{toast:t},type:4})}export{yi as context,de as emitEffect,$n as navigateTo,Hn as showForm,Zn as showToast};
1
+ var Qn=Object.create;var dt=Object.defineProperty;var Yn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var jn=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var tr=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xn(t))!er.call(e,i)&&i!==n&&dt(e,i,{get:()=>t[i],enumerable:!(o=Yn(t,i))||o.enumerable});return e};var P=(e,t,n)=>(n=e!=null?Qn(jn(e)):{},tr(t||!e||!e.__esModule?dt(n,"default",{value:e,enumerable:!0}):n,e));var ct=b((Mr,st)=>{"use strict";st.exports=nr;function nr(e,t){for(var n=new Array(arguments.length-1),o=0,i=2,r=!0;i<arguments.length;)n[o++]=arguments[i++];return new Promise(function(l,u){n[o]=function(s){if(r)if(r=!1,s)u(s);else{for(var _=new Array(arguments.length-1),se=0;se<_.length;)_[se++]=arguments[se];l.apply(null,_)}};try{e.apply(t||null,n)}catch(f){r&&(r=!1,u(f))}})}});var yt=b(mt=>{"use strict";var Le=mt;Le.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 be=new Array(64),ht=new Array(123);for(R=0;R<64;)ht[be[R]=R<26?R+65:R<52?R+71:R<62?R-4:R-59|43]=R++;var R;Le.encode=function(t,n,o){for(var i=null,r=[],a=0,l=0,u;n<o;){var f=t[n++];switch(l){case 0:r[a++]=be[f>>2],u=(f&3)<<4,l=1;break;case 1:r[a++]=be[u|f>>4],u=(f&15)<<2,l=2;break;case 2:r[a++]=be[u|f>>6],r[a++]=be[f&63],l=0;break}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,r)),a=0)}return l&&(r[a++]=be[u],r[a++]=61,l===1&&(r[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,r.slice(0,a))),i.join("")):String.fromCharCode.apply(String,r.slice(0,a))};var pt="invalid encoding";Le.decode=function(t,n,o){for(var i=o,r=0,a,l=0;l<t.length;){var u=t.charCodeAt(l++);if(u===61&&r>1)break;if((u=ht[u])===void 0)throw Error(pt);switch(r){case 0:a=u,r=1;break;case 1:n[o++]=a<<2|(u&48)>>4,a=u,r=2;break;case 2:n[o++]=(a&15)<<4|(u&60)>>2,a=u,r=3;break;case 3:n[o++]=(a&3)<<6|u,r=0;break}}if(r===1)throw Error(pt);return o-i};Le.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var St=b(($r,gt)=>{"use strict";gt.exports=Be;function Be(){this._listeners={}}Be.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};Be.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var o=this._listeners[t],i=0;i<o.length;)o[i].fn===n?o.splice(i,1):++i;return this};Be.prototype.emit=function(t){var n=this._listeners[t];if(n){for(var o=[],i=1;i<arguments.length;)o.push(arguments[i++]);for(i=0;i<n.length;)n[i].fn.apply(n[i++].ctx,o)}return this}});var Ct=b((Gr,Vt)=>{"use strict";Vt.exports=bt(bt);function bt(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function i(u,f,s){t[0]=u,f[s]=n[0],f[s+1]=n[1],f[s+2]=n[2],f[s+3]=n[3]}function r(u,f,s){t[0]=u,f[s]=n[3],f[s+1]=n[2],f[s+2]=n[1],f[s+3]=n[0]}e.writeFloatLE=o?i:r,e.writeFloatBE=o?r:i;function a(u,f){return n[0]=u[f],n[1]=u[f+1],n[2]=u[f+2],n[3]=u[f+3],t[0]}function l(u,f){return n[3]=u[f],n[2]=u[f+1],n[1]=u[f+2],n[0]=u[f+3],t[0]}e.readFloatLE=o?a:l,e.readFloatBE=o?l:a}():function(){function t(o,i,r,a){var l=i<0?1:0;if(l&&(i=-i),i===0)o(1/i>0?0:2147483648,r,a);else if(isNaN(i))o(2143289344,r,a);else if(i>34028234663852886e22)o((l<<31|2139095040)>>>0,r,a);else if(i<11754943508222875e-54)o((l<<31|Math.round(i/1401298464324817e-60))>>>0,r,a);else{var u=Math.floor(Math.log(i)/Math.LN2),f=Math.round(i*Math.pow(2,-u)*8388608)&8388607;o((l<<31|u+127<<23|f)>>>0,r,a)}}e.writeFloatLE=t.bind(null,vt),e.writeFloatBE=t.bind(null,Et);function n(o,i,r){var a=o(i,r),l=(a>>31)*2+1,u=a>>>23&255,f=a&8388607;return u===255?f?NaN:l*(1/0):u===0?l*1401298464324817e-60*f:l*Math.pow(2,u-150)*(f+8388608)}e.readFloatLE=n.bind(null,Tt),e.readFloatBE=n.bind(null,Nt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function i(u,f,s){t[0]=u,f[s]=n[0],f[s+1]=n[1],f[s+2]=n[2],f[s+3]=n[3],f[s+4]=n[4],f[s+5]=n[5],f[s+6]=n[6],f[s+7]=n[7]}function r(u,f,s){t[0]=u,f[s]=n[7],f[s+1]=n[6],f[s+2]=n[5],f[s+3]=n[4],f[s+4]=n[3],f[s+5]=n[2],f[s+6]=n[1],f[s+7]=n[0]}e.writeDoubleLE=o?i:r,e.writeDoubleBE=o?r:i;function a(u,f){return n[0]=u[f],n[1]=u[f+1],n[2]=u[f+2],n[3]=u[f+3],n[4]=u[f+4],n[5]=u[f+5],n[6]=u[f+6],n[7]=u[f+7],t[0]}function l(u,f){return n[7]=u[f],n[6]=u[f+1],n[5]=u[f+2],n[4]=u[f+3],n[3]=u[f+4],n[2]=u[f+5],n[1]=u[f+6],n[0]=u[f+7],t[0]}e.readDoubleLE=o?a:l,e.readDoubleBE=o?l:a}():function(){function t(o,i,r,a,l,u){var f=a<0?1:0;if(f&&(a=-a),a===0)o(0,l,u+i),o(1/a>0?0:2147483648,l,u+r);else if(isNaN(a))o(0,l,u+i),o(2146959360,l,u+r);else if(a>17976931348623157e292)o(0,l,u+i),o((f<<31|2146435072)>>>0,l,u+r);else{var s;if(a<22250738585072014e-324)s=a/5e-324,o(s>>>0,l,u+i),o((f<<31|s/4294967296)>>>0,l,u+r);else{var _=Math.floor(Math.log(a)/Math.LN2);_===1024&&(_=1023),s=a*Math.pow(2,-_),o(s*4503599627370496>>>0,l,u+i),o((f<<31|_+1023<<20|s*1048576&1048575)>>>0,l,u+r)}}}e.writeDoubleLE=t.bind(null,vt,0,4),e.writeDoubleBE=t.bind(null,Et,4,0);function n(o,i,r,a,l){var u=o(a,l+i),f=o(a,l+r),s=(f>>31)*2+1,_=f>>>20&2047,se=4294967296*(f&1048575)+u;return _===2047?se?NaN:s*(1/0):_===0?s*5e-324*se:s*Math.pow(2,_-1075)*(se+4503599627370496)}e.readDoubleLE=n.bind(null,Tt,0,4),e.readDoubleBE=n.bind(null,Nt,4,0)}(),e}function vt(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 Et(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 Tt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Nt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var xt=b((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 It=b(kt=>{"use strict";var Ue=kt;Ue.length=function(t){for(var n=0,o=0,i=0;i<t.length;++i)o=t.charCodeAt(i),o<128?n+=1:o<2048?n+=2:(o&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,n+=4):n+=3;return n};Ue.read=function(t,n,o){var i=o-n;if(i<1)return"";for(var r=null,a=[],l=0,u;n<o;)u=t[n++],u<128?a[l++]=u:u>191&&u<224?a[l++]=(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,a[l++]=55296+(u>>10),a[l++]=56320+(u&1023)):a[l++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,l>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,a)),l=0);return r?(l&&r.push(String.fromCharCode.apply(String,a.slice(0,l))),r.join("")):String.fromCharCode.apply(String,a.slice(0,l))};Ue.write=function(t,n,o){for(var i=o,r,a,l=0;l<t.length;++l)r=t.charCodeAt(l),r<128?n[o++]=r:r<2048?(n[o++]=r>>6|192,n[o++]=r&63|128):(r&64512)===55296&&((a=t.charCodeAt(l+1))&64512)===56320?(r=65536+((r&1023)<<10)+(a&1023),++l,n[o++]=r>>18|240,n[o++]=r>>12&63|128,n[o++]=r>>6&63|128,n[o++]=r&63|128):(n[o++]=r>>12|224,n[o++]=r>>6&63|128,n[o++]=r&63|128);return o-i}});var _t=b((Hr,Ft)=>{"use strict";Ft.exports=rr;function rr(e,t,n){var o=n||8192,i=o>>>1,r=null,a=o;return function(u){if(u<1||u>i)return e(u);a+u>o&&(r=e(o),a=0);var f=t.call(r,a,a+=u);return a&7&&(a=(a|7)+1),f}}});var Rt=b((Zr,Ot)=>{"use strict";Ot.exports=v;var Ve=H();function v(e,t){this.lo=e>>>0,this.hi=t>>>0}var ce=v.zero=new v(0,0);ce.toNumber=function(){return 0};ce.zzEncode=ce.zzDecode=function(){return this};ce.length=function(){return 1};var ir=v.zeroHash="\0\0\0\0\0\0\0\0";v.fromNumber=function(t){if(t===0)return ce;var n=t<0;n&&(t=-t);var o=t>>>0,i=(t-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new v(o,i)};v.from=function(t){if(typeof t=="number")return v.fromNumber(t);if(Ve.isString(t))if(Ve.Long)t=Ve.Long.fromString(t);else return v.fromNumber(parseInt(t,10));return t.low||t.high?new v(t.low>>>0,t.high>>>0):ce};v.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};v.prototype.toLong=function(t){return Ve.Long?new Ve.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var q=String.prototype.charCodeAt;v.fromHash=function(t){return t===ir?ce:new v((q.call(t,0)|q.call(t,1)<<8|q.call(t,2)<<16|q.call(t,3)<<24)>>>0,(q.call(t,4)|q.call(t,5)<<8|q.call(t,6)<<16|q.call(t,7)<<24)>>>0)};v.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)};v.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};v.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};v.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 H=b($e=>{"use strict";var d=$e;d.asPromise=ct();d.base64=yt();d.EventEmitter=St();d.float=Ct();d.inquire=xt();d.utf8=It();d.pool=_t();d.LongBits=Rt();d.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);d.global=d.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||$e;d.emptyArray=Object.freeze?Object.freeze([]):[];d.emptyObject=Object.freeze?Object.freeze({}):{};d.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};d.isString=function(t){return typeof t=="string"||t instanceof String};d.isObject=function(t){return t&&typeof t=="object"};d.isset=d.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};d.Buffer=function(){try{var e=d.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();d._Buffer_from=null;d._Buffer_allocUnsafe=null;d.newBuffer=function(t){return typeof t=="number"?d.Buffer?d._Buffer_allocUnsafe(t):new d.Array(t):d.Buffer?d._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};d.Array=typeof Uint8Array<"u"?Uint8Array:Array;d.Long=d.global.dcodeIO&&d.global.dcodeIO.Long||d.global.Long||d.inquire("long");d.key2Re=/^true|false|0|1$/;d.key32Re=/^-?(?:0|[1-9][0-9]*)$/;d.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;d.longToHash=function(t){return t?d.LongBits.from(t).toHash():d.LongBits.zeroHash};d.longFromHash=function(t,n){var o=d.LongBits.fromHash(t);return d.Long?d.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function wt(e,t,n){for(var o=Object.keys(t),i=0;i<o.length;++i)(e[o[i]]===void 0||!n)&&(e[o[i]]=t[o[i]]);return e}d.merge=wt;d.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Lt(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&&wt(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}d.newError=Lt;d.ProtocolError=Lt("ProtocolError");d.oneOfGetter=function(t){for(var n={},o=0;o<t.length;++o)n[t[o]]=1;return function(){for(var i=Object.keys(this),r=i.length-1;r>-1;--r)if(n[i[r]]===1&&this[i[r]]!==void 0&&this[i[r]]!==null)return i[r]}};d.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};d.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};d._configure=function(){var e=d.Buffer;if(!e){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},d._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var Qe=b((Kr,Dt)=>{"use strict";Dt.exports=h;var O=H(),Ge,Pe=O.LongBits,Bt=O.base64,Pt=O.utf8;function Ce(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function He(){}function or(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new Ce(He,0,0),this.tail=this.head,this.states=null}var At=function(){return O.Buffer?function(){return(h.create=function(){return new Ge})()}:function(){return new h}};h.create=At();h.alloc=function(t){return new O.Array(t)};O.Array!==Array&&(h.alloc=O.pool(h.alloc,O.Array.prototype.subarray));h.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Ce(t,n,o),this.len+=n,this};function Ze(e,t,n){t[n]=e&255}function ur(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function ze(e,t){this.len=e,this.next=void 0,this.val=t}ze.prototype=Object.create(Ce.prototype);ze.prototype.fn=ur;h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new ze((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};h.prototype.int32=function(t){return t<0?this._push(Ke,10,Pe.fromNumber(t)):this.uint32(t)};h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Ke(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}h.prototype.uint64=function(t){var n=Pe.from(t);return this._push(Ke,n.length(),n)};h.prototype.int64=h.prototype.uint64;h.prototype.sint64=function(t){var n=Pe.from(t).zzEncode();return this._push(Ke,n.length(),n)};h.prototype.bool=function(t){return this._push(Ze,1,t?1:0)};function qe(e,t,n){t[n]=e&255,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}h.prototype.fixed32=function(t){return this._push(qe,4,t>>>0)};h.prototype.sfixed32=h.prototype.fixed32;h.prototype.fixed64=function(t){var n=Pe.from(t);return this._push(qe,4,n.lo)._push(qe,4,n.hi)};h.prototype.sfixed64=h.prototype.fixed64;h.prototype.float=function(t){return this._push(O.float.writeFloatLE,4,t)};h.prototype.double=function(t){return this._push(O.float.writeDoubleLE,8,t)};var ar=O.Array.prototype.set?function(t,n,o){n.set(t,o)}:function(t,n,o){for(var i=0;i<t.length;++i)n[o+i]=t[i]};h.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(Ze,1,0);if(O.isString(t)){var o=h.alloc(n=Bt.length(t));Bt.decode(t,o,0),t=o}return this.uint32(n)._push(ar,n,t)};h.prototype.string=function(t){var n=Pt.length(t);return n?this.uint32(n)._push(Pt.write,n,t):this._push(Ze,1,0)};h.prototype.fork=function(){return this.states=new or(this),this.head=this.tail=new Ce(He,0,0),this.len=0,this};h.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 Ce(He,0,0),this.len=0),this};h.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};h.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};h._configure=function(e){Ge=e,h.create=At(),Ge._configure()}});var Mt=b((Qr,Wt)=>{"use strict";Wt.exports=A;var Jt=Qe();(A.prototype=Object.create(Jt.prototype)).constructor=A;var Z=H();function A(){Jt.call(this)}A._configure=function(){A.alloc=Z._Buffer_allocUnsafe,A.writeBytesBuffer=Z.Buffer&&Z.Buffer.prototype instanceof Uint8Array&&Z.Buffer.prototype.set.name==="set"?function(t,n,o){n.set(t,o)}:function(t,n,o){if(t.copy)t.copy(n,o,0,t.length);else for(var i=0;i<t.length;)n[o++]=t[i++]}};A.prototype.bytes=function(t){Z.isString(t)&&(t=Z._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(A.writeBytesBuffer,n,t),this};function fr(e,t,n){e.length<40?Z.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}A.prototype.string=function(t){var n=Z.Buffer.byteLength(t);return this.uint32(n),n&&this._push(fr,n,t),this};A._configure()});var je=b((Yr,Ht)=>{"use strict";Ht.exports=g;var w=H(),Xe,Gt=w.LongBits,lr=w.utf8;function L(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function g(e){this.buf=e,this.pos=0,this.len=e.length}var Ut=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new g(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new g(t);throw Error("illegal buffer")},qt=function(){return w.Buffer?function(n){return(g.create=function(i){return w.Buffer.isBuffer(i)?new Xe(i):Ut(i)})(n)}:Ut};g.create=qt();g.prototype._slice=w.Array.prototype.subarray||w.Array.prototype.slice;g.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,L(this,10);return t}}();g.prototype.int32=function(){return this.uint32()|0};g.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Ye(){var e=new Gt(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 L(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 L(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")}g.prototype.bool=function(){return this.uint32()!==0};function Ae(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}g.prototype.fixed32=function(){if(this.pos+4>this.len)throw L(this,4);return Ae(this.buf,this.pos+=4)};g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw L(this,4);return Ae(this.buf,this.pos+=4)|0};function $t(){if(this.pos+8>this.len)throw L(this,8);return new Gt(Ae(this.buf,this.pos+=4),Ae(this.buf,this.pos+=4))}g.prototype.float=function(){if(this.pos+4>this.len)throw L(this,4);var t=w.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};g.prototype.double=function(){if(this.pos+8>this.len)throw L(this,4);var t=w.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};g.prototype.bytes=function(){var t=this.uint32(),n=this.pos,o=this.pos+t;if(o>this.len)throw L(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var i=w.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,o)};g.prototype.string=function(){var t=this.bytes();return lr.read(t,0,t.length)};g.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw L(this,t);this.pos+=t}else do if(this.pos>=this.len)throw L(this);while(this.buf[this.pos++]&128);return this};g.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};g._configure=function(e){Xe=e,g.create=qt(),Xe._configure();var t=w.Long?"toLong":"toNumber";w.merge(g.prototype,{int64:function(){return Ye.call(this)[t](!1)},uint64:function(){return Ye.call(this)[t](!0)},sint64:function(){return Ye.call(this).zzDecode()[t](!1)},fixed64:function(){return $t.call(this)[t](!0)},sfixed64:function(){return $t.call(this)[t](!1)}})}});var Qt=b((Xr,Kt)=>{"use strict";Kt.exports=pe;var zt=je();(pe.prototype=Object.create(zt.prototype)).constructor=pe;var Zt=H();function pe(e){zt.call(this,e)}pe._configure=function(){Zt.Buffer&&(pe.prototype._slice=Zt.Buffer.prototype.slice)};pe.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))};pe._configure()});var Xt=b((jr,Yt)=>{"use strict";Yt.exports=xe;var et=H();(xe.prototype=Object.create(et.EventEmitter.prototype)).constructor=xe;function xe(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");et.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}xe.prototype.rpcCall=function e(t,n,o,i,r){if(!i)throw TypeError("request must be specified");var a=this;if(!r)return et.asPromise(e,a,t,n,o,i);if(!a.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,f){if(u)return a.emit("error",u,t),r(u);if(f===null){a.end(!0);return}if(!(f instanceof o))try{f=o[a.responseDelimited?"decodeDelimited":"decode"](f)}catch(s){return a.emit("error",s,t),r(s)}return a.emit("data",f,t),r(null,f)})}catch(l){a.emit("error",l,t),setTimeout(function(){r(l)},0);return}};xe.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var en=b(jt=>{"use strict";var dr=jt;dr.Service=Xt()});var nn=b((ti,tn)=>{"use strict";tn.exports={}});var un=b(on=>{"use strict";var N=on;N.build="minimal";N.Writer=Qe();N.BufferWriter=Mt();N.Reader=je();N.BufferReader=Qt();N.util=H();N.rpc=en();N.roots=nn();N.configure=rn;function rn(){N.util._configure(),N.Writer._configure(N.BufferWriter),N.Reader._configure(N.BufferReader)}rn()});var B=b((ri,an)=>{"use strict";an.exports=un()});var ye=P(B(),1);var C=P(B(),1);var c=new Map;var me;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(me||(me={}));function sr(e){switch(e){case 0:case"NULL_VALUE":return me.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return me.UNRECOGNIZED}}function cr(e){switch(e){case me.NULL_VALUE:return 0;case me.UNRECOGNIZED:default:return-1}}function tt(){return{fields:{}}}var E={$type:"google.protobuf.Struct",encode(e,t=C.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&ke.encode({key:n,value:o},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=tt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let a=ke.decode(n,n.uint32());a.value!==void 0&&(i.fields[a.key]=a.value);continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:ln(e.fields)?Object.entries(e.fields).reduce((t,[n,o])=>(t[n]=o,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([o,i])=>{t.fields[o]=i}))}return t},create(e){return E.fromPartial(e??{})},fromPartial(e){let t=tt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),{}),t},wrap(e){let t=tt();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(E.$type,E);function fn(){return{key:"",value:void 0}}var ke={$type:"google.protobuf.Struct.FieldsEntry",encode(e,t=C.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&T.encode(T.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=fn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=T.unwrap(T.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:ve(e.key)?globalThis.String(e.key):"",value:ve(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 ke.fromPartial(e??{})},fromPartial(e){let t=fn();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(ke.$type,ke);function nt(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var T={$type:"google.protobuf.Value",encode(e,t=C.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&&E.encode(E.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&he.encode(he.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=nt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.nullValue=n.int32();continue;case 2:if(r!==17)break;i.numberValue=n.double();continue;case 3:if(r!==26)break;i.stringValue=n.string();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.structValue=E.unwrap(E.decode(n,n.uint32()));continue;case 6:if(r!==50)break;i.listValue=he.unwrap(he.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{nullValue:ve(e.nullValue)?sr(e.nullValue):void 0,numberValue:ve(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ve(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ve(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:ln(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=cr(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 T.fromPartial(e??{})},fromPartial(e){let t=nt();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=nt();if(e===null)t.nullValue=me.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(T.$type,T);function rt(){return{values:[]}}var he={$type:"google.protobuf.ListValue",encode(e,t=C.default.Writer.create()){for(let n of e.values)T.encode(T.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof C.default.Reader?e:C.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=rt();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(T.unwrap(T.decode(n,n.uint32())));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return he.fromPartial(e??{})},fromPartial(e){let t=rt();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=rt();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(he.$type,he);function ln(e){return typeof e=="object"&&e!==null}function ve(e){return e!=null}function dn(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var Ie={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,t=ye.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 ye.default.Reader?e:ye.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=dn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subredditId=n.string();continue;case 2:if(r!==18)break;i.subredditName=n.string();continue;case 3:if(r!==26)break;i.userId=n.string();continue;case 4:if(r!==34)break;i.appName=n.string();continue;case 5:if(r!==42)break;i.appVersion=n.string();continue;case 6:if(r!==50)break;i.postId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subredditId:Ee(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:Ee(e.subredditName)?globalThis.String(e.subredditName):"",userId:Ee(e.userId)?globalThis.String(e.userId):"",appName:Ee(e.appName)?globalThis.String(e.appName):"",appVersion:Ee(e.appVersion)?globalThis.String(e.appVersion):"",postId:Ee(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 Ie.fromPartial(e??{})},fromPartial(e){let t=dn();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(Ie.$type,Ie);function sn(){return{developerData:void 0}}var Fe={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode(e,t=ye.default.Writer.create()){return e.developerData!==void 0&&E.encode(E.wrap(e.developerData),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof ye.default.Reader?e:ye.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=sn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 2:if(r!==18)break;i.developerData=E.unwrap(E.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{developerData:pr(e.developerData)?e.developerData:void 0}},toJSON(e){let t={};return e.developerData!==void 0&&(t.developerData=e.developerData),t},create(e){return Fe.fromPartial(e??{})},fromPartial(e){let t=sn();return t.developerData=e.developerData??void 0,t}};c.set(Fe.$type,Fe);function pr(e){return typeof e=="object"&&e!==null}function Ee(e){return e!=null}function De(e,t){if(!e)throw Error(t)}var z;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(z||(z={}));function hr(e){return e.startsWith(z.ACCOUNT)}function mr(e){return e.startsWith(z.LINK)}function yr(e){return e.startsWith(z.SUBREDDIT)}function gr(e){De(hr(e),`Expected account id to start with ${z.ACCOUNT}, got ${e}}`)}function Sr(e){De(mr(e),`Expected link id to start with ${z.LINK}, got ${e}}`)}function br(e){De(yr(e),`Expected subreddit id to start with ${z.SUBREDDIT}, got ${e}}`)}function cn(e){return gr(e),e}function pn(e){return Sr(e),e}function hn(e){return br(e),e}var vr=({search:e,hash:t})=>{let n=new URLSearchParams(e).get("context");if(n){let o=decodeURIComponent(n),i=Ie.fromJSON(JSON.parse(o)),r=Er(t),a={subredditId:hn(i.subredditId),userId:cn(i.userId),subredditName:i.subredditName,appName:i.appName,appVersion:i.appVersion,postId:pn(i.postId),postData:r?.developerData};globalThis.devvit={context:a}}};globalThis.location&&vr(globalThis.location);function Er(e){let t=e?.slice(1);if(t)try{return Fe.fromJSON(JSON.parse(decodeURIComponent(t)))}catch(n){console.error("Error parsing post data from hash",n);return}}var Tr=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 F=P(B(),1);var Se=P(B(),1);var ge=P(B(),1);var Je=P(B(),1);function mn(){return{}}var We={$type:"google.protobuf.Empty",encode(e,t=Je.default.Writer.create()){return t},decode(e,t){let n=e instanceof Je.default.Reader?e:Je.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=mn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return We.fromPartial(e??{})},fromPartial(e){return mn()}};c.set(We.$type,We);function yn(){return{channels:[]}}var it={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=ge.default.Writer.create()){for(let n of e.channels)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof ge.default.Reader?e:ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=yn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channels.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channels:globalThis.Array.isArray(e?.channels)?e.channels.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.channels?.length&&(t.channels=e.channels),t},create(e){return it.fromPartial(e??{})},fromPartial(e){let t=yn();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(it.$type,it);function gn(){return{channel:"",data:void 0}}var D={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=ge.default.Writer.create()){return e.channel!==""&&t.uint32(10).string(e.channel),e.data!==void 0&&E.encode(E.wrap(e.data),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof ge.default.Reader?e:ge.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=gn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.channel=n.string();continue;case 2:if(r!==18)break;i.data=E.unwrap(E.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{channel:Vr(e.channel)?globalThis.String(e.channel):"",data:Nr(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 D.fromPartial(e??{})},fromPartial(e){let t=gn();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(D.$type,D);function Nr(e){return typeof e=="object"&&e!==null}function Vr(e){return e!=null}var K;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(K||(K={}));function Cr(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return K.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return K.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return K.UNRECOGNIZED}}function xr(e){switch(e){case K.REALTIME_SUBSCRIBED:return 0;case K.REALTIME_UNSUBSCRIBED:return 1;case K.UNRECOGNIZED:default:return-1}}function Sn(){return{subscriptionIds:[]}}var ot={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=Se.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof Se.default.Reader?e:Se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Sn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.subscriptionIds.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create(e){return ot.fromPartial(e??{})},fromPartial(e){let t=Sn();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(ot.$type,ot);function bn(){return{event:void 0,status:void 0}}var J={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=Se.default.Writer.create()){return e.event!==void 0&&D.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 Se.default.Reader?e:Se.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=bn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.event=D.decode(n,n.uint32());continue;case 2:if(r!==16)break;i.status=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{event:vn(e.event)?D.fromJSON(e.event):void 0,status:vn(e.status)?Cr(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=D.toJSON(e.event)),e.status!==void 0&&(t.status=xr(e.status)),t},create(e){return J.fromPartial(e??{})},fromPartial(e){let t=bn();return t.event=e.event!==void 0&&e.event!==null?D.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(J.$type,J);function vn(e){return e!=null}var I=P(B(),1);var Me=P(B(),1);var m=P(B(),1);var S;(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"})(S||(S={}));function Te(e){switch(e){case 0:case"STRING":return S.STRING;case 1:case"PARAGRAPH":return S.PARAGRAPH;case 2:case"NUMBER":return S.NUMBER;case 3:case"BOOLEAN":return S.BOOLEAN;case 4:case"LIST":return S.LIST;case 5:case"SELECTION":return S.SELECTION;case 6:case"GROUP":return S.GROUP;case 7:case"IMAGE":return S.IMAGE;case-1:case"UNRECOGNIZED":default:return S.UNRECOGNIZED}}function Ne(e){switch(e){case S.STRING:return 0;case S.PARAGRAPH:return 1;case S.NUMBER:return 2;case S.BOOLEAN:return 3;case S.LIST:return 4;case S.SELECTION:return 5;case S.GROUP:return 6;case S.IMAGE:return 7;case S.UNRECOGNIZED:default:return-1}}var x=P(B(),1);function En(){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 y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode(e,t=x.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&&Q.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&Y.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&X.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=En();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.fieldType=n.int32();continue;case 100:if(r!==800)break;i.isSecret=n.bool();continue;case 2:if(r!==18)break;i.stringValue=n.string();continue;case 3:if(r!==25)break;i.numberValue=n.double();continue;case 4:if(r!==32)break;i.boolValue=n.bool();continue;case 5:if(r!==42)break;i.listValue=Q.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionValue=Y.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupValue=X.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldType:W(e.fieldType)?Te(e.fieldType):0,isSecret:W(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:W(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:W(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:W(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:W(e.listValue)?Q.fromJSON(e.listValue):void 0,selectionValue:W(e.selectionValue)?Y.fromJSON(e.selectionValue):void 0,groupValue:W(e.groupValue)?X.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Ne(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=Q.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=Y.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=X.toJSON(e.groupValue)),t},create(e){return y.fromPartial(e??{})},fromPartial(e){let t=En();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?Q.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?Y.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?X.fromPartial(e.groupValue):void 0,t}};c.set(y.$type,y);function Tn(){return{itemType:0,items:[]}}var Q={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=x.default.Writer.create()){e.itemType!==0&&t.uint32(8).int32(e.itemType);for(let n of e.items)y.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Tn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.items.push(y.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:W(e.itemType)?Te(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map(t=>y.fromJSON(t)):[]}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Ne(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>y.toJSON(n))),t},create(e){return Q.fromPartial(e??{})},fromPartial(e){let t=Tn();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>y.fromPartial(n))||[],t}};c.set(Q.$type,Q);function Nn(){return{values:[]}}var Y={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=x.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Nn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.values.push(n.string());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return Y.fromPartial(e??{})},fromPartial(e){let t=Nn();return t.values=e.values?.map(n=>n)||[],t}};c.set(Y.$type,Y);function Vn(){return{}}var X={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=x.default.Writer.create()){return t},decode(e,t){let n=e instanceof x.default.Reader?e:x.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Vn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return X.fromPartial(e??{})},fromPartial(e){return Vn()}};c.set(X.$type,X);function W(e){return e!=null}function Cn(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}var V={$type:"devvit.ui.form_builder.v1alpha.FormField",encode(e,t=m.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&&y.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&&k.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Cn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fieldId=n.string();continue;case 2:if(r!==16)break;i.fieldType=n.int32();continue;case 3:if(r!==26)break;i.label=n.string();continue;case 4:if(r!==34)break;i.helpText=n.string();continue;case 5:if(r!==42)break;i.defaultValue=y.decode(n,n.uint32());continue;case 6:if(r!==48)break;i.required=n.bool();continue;case 7:if(r!==56)break;i.disabled=n.bool();continue;case 8:if(r!==66)break;i.fieldConfig=k.decode(n,n.uint32());continue;case 9:if(r!==72)break;i.isSecret=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fieldId:p(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:p(e.fieldType)?Te(e.fieldType):0,label:p(e.label)?globalThis.String(e.label):"",helpText:p(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:p(e.defaultValue)?y.fromJSON(e.defaultValue):void 0,required:p(e.required)?globalThis.Boolean(e.required):void 0,disabled:p(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:p(e.fieldConfig)?k.fromJSON(e.fieldConfig):void 0,isSecret:p(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}},toJSON(e){let t={};return e.fieldId!==""&&(t.fieldId=e.fieldId),e.fieldType!==0&&(t.fieldType=Ne(e.fieldType)),e.label!==""&&(t.label=e.label),e.helpText!==void 0&&(t.helpText=e.helpText),e.defaultValue!==void 0&&(t.defaultValue=y.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=k.toJSON(e.fieldConfig)),e.isSecret!==void 0&&(t.isSecret=e.isSecret),t},create(e){return V.fromPartial(e??{})},fromPartial(e){let t=Cn();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?y.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?k.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};c.set(V.$type,V);function xn(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}var k={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode(e,t=m.default.Writer.create()){return e.stringConfig!==void 0&&j.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&ee.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&te.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&ne.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&re.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&ie.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&ue.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=xn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.stringConfig=j.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.paragraphConfig=ee.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.numberConfig=te.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.booleanConfig=ne.decode(n,n.uint32());continue;case 5:if(r!==42)break;i.listConfig=re.decode(n,n.uint32());continue;case 6:if(r!==50)break;i.selectionConfig=ie.decode(n,n.uint32());continue;case 7:if(r!==58)break;i.groupConfig=ue.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{stringConfig:p(e.stringConfig)?j.fromJSON(e.stringConfig):void 0,paragraphConfig:p(e.paragraphConfig)?ee.fromJSON(e.paragraphConfig):void 0,numberConfig:p(e.numberConfig)?te.fromJSON(e.numberConfig):void 0,booleanConfig:p(e.booleanConfig)?ne.fromJSON(e.booleanConfig):void 0,listConfig:p(e.listConfig)?re.fromJSON(e.listConfig):void 0,selectionConfig:p(e.selectionConfig)?ie.fromJSON(e.selectionConfig):void 0,groupConfig:p(e.groupConfig)?ue.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=j.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=ee.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=te.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=ne.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=re.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=ie.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=ue.toJSON(e.groupConfig)),t},create(e){return k.fromPartial(e??{})},fromPartial(e){let t=xn();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?j.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?ee.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?te.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?ne.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?re.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?ie.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?ue.fromPartial(e.groupConfig):void 0,t}};c.set(k.$type,k);function kn(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var j={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=kn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.minLength=n.int32();continue;case 2:if(r!==16)break;i.maxLength=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{minLength:p(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:p(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:p(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 j.fromPartial(e??{})},fromPartial(e){let t=kn();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(j.$type,j);function In(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var ee={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=In();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.maxCharacters=n.int32();continue;case 2:if(r!==16)break;i.lineHeight=n.int32();continue;case 3:if(r!==26)break;i.placeholder=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{maxCharacters:p(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:p(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:p(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 ee.fromPartial(e??{})},fromPartial(e){let t=In();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ee.$type,ee);function Fn(){return{step:void 0,min:void 0,max:void 0}}var te={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Fn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==9)break;i.step=n.double();continue;case 2:if(r!==17)break;i.min=n.double();continue;case 3:if(r!==25)break;i.max=n.double();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{step:p(e.step)?globalThis.Number(e.step):void 0,min:p(e.min)?globalThis.Number(e.min):void 0,max:p(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 te.fromPartial(e??{})},fromPartial(e){let t=Fn();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(te.$type,te);function _n(){return{}}var ne={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode(e,t=m.default.Writer.create()){return t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=_n();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return ne.fromPartial(e??{})},fromPartial(e){return _n()}};c.set(ne.$type,ne);function On(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var re={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode(e,t=m.default.Writer.create()){return e.itemType!==0&&t.uint32(8).int32(e.itemType),e.itemConfig!==void 0&&k.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=On();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.itemType=n.int32();continue;case 2:if(r!==18)break;i.itemConfig=k.decode(n,n.uint32());continue;case 3:if(r!==24)break;i.minEntries=n.int32();continue;case 4:if(r!==32)break;i.maxEntries=n.int32();continue;case 5:if(r!==42)break;i.entryLabel=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{itemType:p(e.itemType)?Te(e.itemType):0,itemConfig:p(e.itemConfig)?k.fromJSON(e.itemConfig):void 0,minEntries:p(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:p(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:p(e.entryLabel)?globalThis.String(e.entryLabel):void 0}},toJSON(e){let t={};return e.itemType!==0&&(t.itemType=Ne(e.itemType)),e.itemConfig!==void 0&&(t.itemConfig=k.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 re.fromPartial(e??{})},fromPartial(e){let t=On();return t.itemType=e.itemType??0,t.itemConfig=e.itemConfig!==void 0&&e.itemConfig!==null?k.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(re.$type,re);function Rn(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var ie={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=m.default.Writer.create()){for(let n of e.choices)oe.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Rn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.choices.push(oe.decode(n,n.uint32()));continue;case 2:if(r!==16)break;i.multiSelect=n.bool();continue;case 3:if(r!==24)break;i.minSelections=n.int32();continue;case 4:if(r!==32)break;i.maxSelections=n.int32();continue;case 5:if(r!==40)break;i.renderAsList=n.bool();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{choices:globalThis.Array.isArray(e?.choices)?e.choices.map(t=>oe.fromJSON(t)):[],multiSelect:p(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:p(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:p(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:p(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}},toJSON(e){let t={};return e.choices?.length&&(t.choices=e.choices.map(n=>oe.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 ie.fromPartial(e??{})},fromPartial(e){let t=Rn();return t.choices=e.choices?.map(n=>oe.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(ie.$type,ie);function wn(){return{label:"",value:""}}var oe={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode(e,t=m.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 m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=wn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.label=n.string();continue;case 2:if(r!==18)break;i.value=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{label:p(e.label)?globalThis.String(e.label):"",value:p(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 oe.fromPartial(e??{})},fromPartial(e){let t=wn();return t.label=e.label??"",t.value=e.value??"",t}};c.set(oe.$type,oe);function Ln(){return{fields:[]}}var ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=m.default.Writer.create()){for(let n of e.fields)V.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof m.default.Reader?e:m.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Ln();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(V.decode(n,n.uint32()));continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>V.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>V.toJSON(n))),t},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=Ln();return t.fields=e.fields?.map(n=>V.fromPartial(n))||[],t}};c.set(ue.$type,ue);function p(e){return e!=null}function Bn(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var M={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=Me.default.Writer.create()){for(let n of e.fields)V.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 Me.default.Reader?e:Me.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Bn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.fields.push(V.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.title=n.string();continue;case 3:if(r!==26)break;i.shortDescription=n.string();continue;case 4:if(r!==34)break;i.acceptLabel=n.string();continue;case 5:if(r!==42)break;i.cancelLabel=n.string();continue;case 6:if(r!==50)break;i.id=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>V.fromJSON(t)):[],title:_e(e.title)?globalThis.String(e.title):void 0,shortDescription:_e(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:_e(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:_e(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:_e(e.id)?globalThis.String(e.id):void 0}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>V.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 M.fromPartial(e??{})},fromPartial(e){let t=Bn();return t.fields=e.fields?.map(n=>V.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(M.$type,M);function _e(e){return e!=null}function Pn(){return{form:void 0}}var ut={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=I.default.Writer.create()){return e.form!==void 0&&M.encode(e.form,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Pn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.form=M.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{form:Re(e.form)?M.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=M.toJSON(e.form)),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=Pn();return t.form=e.form!==void 0&&e.form!==null?M.fromPartial(e.form):void 0,t}};c.set(ut.$type,ut);function An(){return{results:{},formId:void 0}}var U={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=I.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{Oe.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 I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=An();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;let a=Oe.decode(n,n.uint32());a.value!==void 0&&(i.results[a.key]=a.value);continue;case 2:if(r!==18)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{results:kr(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=y.fromJSON(o),t),{}):{},formId:Re(e.formId)?globalThis.String(e.formId):void 0}},toJSON(e){let t={};if(e.results){let n=Object.entries(e.results);n.length>0&&(t.results={},n.forEach(([o,i])=>{t.results[o]=y.toJSON(i)}))}return e.formId!==void 0&&(t.formId=e.formId),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=An();return t.results=Object.entries(e.results??{}).reduce((n,[o,i])=>(i!==void 0&&(n[o]=y.fromPartial(i)),n),{}),t.formId=e.formId??void 0,t}};c.set(U.$type,U);function Dn(){return{key:"",value:void 0}}var Oe={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent.ResultsEntry",encode(e,t=I.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&y.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Dn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.key=n.string();continue;case 2:if(r!==18)break;i.value=y.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{key:Re(e.key)?globalThis.String(e.key):"",value:Re(e.value)?y.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=y.toJSON(e.value)),t},create(e){return Oe.fromPartial(e??{})},fromPartial(e){let t=Dn();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?y.fromPartial(e.value):void 0,t}};c.set(Oe.$type,Oe);function Jn(){return{formId:void 0}}var $={$type:"devvit.ui.effects.v1alpha.FormCanceledEvent",encode(e,t=I.default.Writer.create()){return e.formId!==void 0&&t.uint32(10).string(e.formId),t},decode(e,t){let n=e instanceof I.default.Reader?e:I.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Jn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.formId=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{formId:Re(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 $.fromPartial(e??{})},fromPartial(e){let t=Jn();return t.formId=e.formId??void 0,t}};c.set($.$type,$);function kr(e){return typeof e=="object"&&e!==null}function Re(e){return e!=null}var le;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(le||(le={}));function Ir(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return le.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return le.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return le.UNRECOGNIZED}}function Fr(e){switch(e){case le.WEBVIEW_VISIBLE:return 0;case le.WEBVIEW_HIDDEN:return 1;case le.UNRECOGNIZED:default:return-1}}function Wn(){return{message:void 0,jsonString:""}}var ae={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=F.default.Writer.create()){return e.message!==void 0&&T.encode(T.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Wn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.message=T.unwrap(T.decode(n,n.uint32()));continue;case 2:if(r!==18)break;i.jsonString=n.string();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{message:G(e?.message)?e.message:void 0,jsonString:G(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 ae.fromPartial(e??{})},fromPartial(e){let t=Wn();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(ae.$type,ae);function Mn(){return{visibility:0}}var fe={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=F.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Mn();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==8)break;i.visibility=n.int32();continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{visibility:G(e.visibility)?Ir(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Fr(e.visibility)),t},create(e){return fe.fromPartial(e??{})},fromPartial(e){let t=Mn();return t.visibility=e.visibility??0,t}};c.set(fe.$type,fe);function Un(){return{postMessage:void 0,fullScreen:void 0}}var at={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=F.default.Writer.create()){return e.postMessage!==void 0&&ae.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&fe.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=Un();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.postMessage=ae.decode(n,n.uint32());continue;case 2:if(r!==18)break;i.fullScreen=fe.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{postMessage:G(e.postMessage)?ae.fromJSON(e.postMessage):void 0,fullScreen:G(e.fullScreen)?fe.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=ae.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=fe.toJSON(e.fullScreen)),t},create(e){return at.fromPartial(e??{})},fromPartial(e){let t=Un();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?ae.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?fe.fromPartial(e.fullScreen):void 0,t}};c.set(at.$type,at);function $n(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0}}var we={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=F.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&$.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&U.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&J.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof F.default.Reader?e:F.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,i=$n();for(;n.pos<o;){let r=n.uint32();switch(r>>>3){case 1:if(r!==10)break;i.id=n.string();continue;case 2:if(r!==18)break;i.formCanceled=$.decode(n,n.uint32());continue;case 3:if(r!==26)break;i.formSubmitted=U.decode(n,n.uint32());continue;case 4:if(r!==34)break;i.realtimeEvent=J.decode(n,n.uint32());continue}if((r&7)===4||r===0)break;n.skipType(r&7)}return i},fromJSON(e){return{id:G(e.id)?globalThis.String(e.id):"",formCanceled:G(e.formCanceled)?$.fromJSON(e.formCanceled):void 0,formSubmitted:G(e.formSubmitted)?U.fromJSON(e.formSubmitted):void 0,realtimeEvent:G(e.realtimeEvent)?J.fromJSON(e.realtimeEvent):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=$.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=U.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=J.toJSON(e.realtimeEvent)),t},create(e){return we.fromPartial(e??{})},fromPartial(e){let t=$n();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?$.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?U.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?J.fromPartial(e.realtimeEvent):void 0,t}};c.set(we.$type,we);function G(e){return e!=null}var Gn=[3];var de=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:n.effect=e,Gn.includes(e.type)){let o=self.crypto.randomUUID();n.id=o;let i=r=>{if(r.data?.type==="devvit-message"&&r.data?.data?.id===o){let a=we.fromJSON(r.data.data);t(a),window.removeEventListener("message",i)}};window.addEventListener("message",i),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});function qn(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.url).toString(),de({navigateToUrl:{url:t},type:5})}function ft(e,t=new Set){for(let n of e){if(n.type==="group"){ft(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}_r(e)}function _r(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 Or(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 Hn(e){return Object.keys(e).reduce((t,n)=>{let o=Or(e[n]);return o!==void 0&&(t[n]=o),t},{})}function lt(e){return e.map(t=>{switch(t.type){case"string":return Rr(t);case"image":return wr(t);case"paragraph":return Lr(t);case"number":return Br(t);case"select":return Pr(t);case"boolean":return Ar(t);case"group":return Dr(t);default:throw new Error("Unknown field type.")}})}function Rr(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 wr(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Lr(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 Br(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 Pr(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 Ar(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Dr(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:lt(e.fields)}},label:e.label,helpText:e.helpText}}var Zn=1,Jr=()=>(Zn++,`form.${Zn}`),zn=async e=>{let t={fields:[],id:Jr(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};ft(e.fields),t.fields=lt(e.fields);let n=await de({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:Hn(n.formSubmitted.results)}};function Kn(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},de({showToast:{toast:t},type:4})}export{Tr as context,de as emitEffect,qn as navigateTo,zn as showForm,Kn as showToast};
2
2
  //# sourceMappingURL=client.min.js.map