@devvit/client 0.11.18-next-2025-06-18-19-23-18-aec8c9257.0 → 0.11.18-next-2025-06-18-19-42-19-ed4753129.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-meta.min.json +4 -4
- package/client.min.js +1 -1
- package/client.min.js.map +2 -2
- package/effects/realtime.d.ts +2 -2
- package/effects/realtime.d.ts.map +1 -1
- package/effects/realtime.js +3 -3
- package/package.json +8 -8
package/client-meta.min.json
CHANGED
|
@@ -4888,7 +4888,7 @@
|
|
|
4888
4888
|
"format": "esm"
|
|
4889
4889
|
},
|
|
4890
4890
|
"src/effects/realtime.ts": {
|
|
4891
|
-
"bytes":
|
|
4891
|
+
"bytes": 3455,
|
|
4892
4892
|
"imports": [
|
|
4893
4893
|
{
|
|
4894
4894
|
"path": "src/effects/emit-effect.ts",
|
|
@@ -5013,7 +5013,7 @@
|
|
|
5013
5013
|
"imports": [],
|
|
5014
5014
|
"exports": [],
|
|
5015
5015
|
"inputs": {},
|
|
5016
|
-
"bytes":
|
|
5016
|
+
"bytes": 331898
|
|
5017
5017
|
},
|
|
5018
5018
|
"dist/client.min.js": {
|
|
5019
5019
|
"imports": [],
|
|
@@ -5146,7 +5146,7 @@
|
|
|
5146
5146
|
"bytesInOutput": 126
|
|
5147
5147
|
},
|
|
5148
5148
|
"src/effects/realtime.ts": {
|
|
5149
|
-
"bytesInOutput":
|
|
5149
|
+
"bytesInOutput": 850
|
|
5150
5150
|
},
|
|
5151
5151
|
"src/effects/helpers/assert-valid-form-fields.ts": {
|
|
5152
5152
|
"bytesInOutput": 361
|
|
@@ -5164,7 +5164,7 @@
|
|
|
5164
5164
|
"bytesInOutput": 140
|
|
5165
5165
|
}
|
|
5166
5166
|
},
|
|
5167
|
-
"bytes":
|
|
5167
|
+
"bytes": 75384
|
|
5168
5168
|
}
|
|
5169
5169
|
}
|
|
5170
5170
|
}
|
package/client.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var oi=Object.create;var Ge=Object.defineProperty;var ai=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var li=Object.getPrototypeOf,fi=Object.prototype.hasOwnProperty;var bt=e=>{throw TypeError(e)};var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),si=(e,t)=>{for(var n in t)Ge(e,n,{get:t[n],enumerable:!0})},di=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ui(t))!fi.call(e,r)&&r!==n&&Ge(e,r,{get:()=>t[r],enumerable:!(o=ai(t,r))||o.enumerable});return e};var P=(e,t,n)=>(n=e!=null?oi(li(e)):{},di(t||!e||!e.__esModule?Ge(n,"default",{value:e,enumerable:!0}):n,e));var vt=(e,t,n)=>t.has(e)||bt("Cannot "+n);var D=(e,t,n)=>(vt(e,t,"read from private field"),n?n.call(e):t.get(e)),Et=(e,t,n)=>t.has(e)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Tt=(e,t,n,o)=>(vt(e,t,"write to private field"),o?o.call(e,n):t.set(e,n),n);var Ct=b((Ki,Nt)=>{"use strict";Nt.exports=ci;function ci(e,t){for(var n=new Array(arguments.length-1),o=0,r=2,i=!0;r<arguments.length;)n[o++]=arguments[r++];return new Promise(function(f,a){n[o]=function(d){if(i)if(i=!1,d)a(d);else{for(var _=new Array(arguments.length-1),pe=0;pe<_.length;)_[pe++]=arguments[pe];f.apply(null,_)}};try{e.apply(t||null,n)}catch(l){i&&(i=!1,a(l))}})}});var kt=b(It=>{"use strict";var Be=It;Be.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 ve=new Array(64),xt=new Array(123);for(w=0;w<64;)xt[ve[w]=w<26?w+65:w<52?w+71:w<62?w-4:w-59|43]=w++;var w;Be.encode=function(t,n,o){for(var r=null,i=[],u=0,f=0,a;n<o;){var l=t[n++];switch(f){case 0:i[u++]=ve[l>>2],a=(l&3)<<4,f=1;break;case 1:i[u++]=ve[a|l>>4],a=(l&15)<<2,f=2;break;case 2:i[u++]=ve[a|l>>6],i[u++]=ve[l&63],f=0;break}u>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),u=0)}return f&&(i[u++]=ve[a],i[u++]=61,f===1&&(i[u++]=61)),r?(u&&r.push(String.fromCharCode.apply(String,i.slice(0,u))),r.join("")):String.fromCharCode.apply(String,i.slice(0,u))};var Vt="invalid encoding";Be.decode=function(t,n,o){for(var r=o,i=0,u,f=0;f<t.length;){var a=t.charCodeAt(f++);if(a===61&&i>1)break;if((a=xt[a])===void 0)throw Error(Vt);switch(i){case 0:u=a,i=1;break;case 1:n[o++]=u<<2|(a&48)>>4,u=a,i=2;break;case 2:n[o++]=(u&15)<<4|(a&60)>>2,u=a,i=3;break;case 3:n[o++]=(u&3)<<6|a,i=0;break}}if(i===1)throw Error(Vt);return o-r};Be.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Ft=b((Yi,_t)=>{"use strict";_t.exports=Ae;function Ae(){this._listeners={}}Ae.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};Ae.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};Ae.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 Pt=b((Xi,At)=>{"use strict";At.exports=Ot(Ot);function Ot(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function r(a,l,d){t[0]=a,l[d]=n[0],l[d+1]=n[1],l[d+2]=n[2],l[d+3]=n[3]}function i(a,l,d){t[0]=a,l[d]=n[3],l[d+1]=n[2],l[d+2]=n[1],l[d+3]=n[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function u(a,l){return n[0]=a[l],n[1]=a[l+1],n[2]=a[l+2],n[3]=a[l+3],t[0]}function f(a,l){return n[3]=a[l],n[2]=a[l+1],n[1]=a[l+2],n[0]=a[l+3],t[0]}e.readFloatLE=o?u:f,e.readFloatBE=o?f:u}():function(){function t(o,r,i,u){var f=r<0?1:0;if(f&&(r=-r),r===0)o(1/r>0?0:2147483648,i,u);else if(isNaN(r))o(2143289344,i,u);else if(r>34028234663852886e22)o((f<<31|2139095040)>>>0,i,u);else if(r<11754943508222875e-54)o((f<<31|Math.round(r/1401298464324817e-60))>>>0,i,u);else{var a=Math.floor(Math.log(r)/Math.LN2),l=Math.round(r*Math.pow(2,-a)*8388608)&8388607;o((f<<31|a+127<<23|l)>>>0,i,u)}}e.writeFloatLE=t.bind(null,Rt),e.writeFloatBE=t.bind(null,wt);function n(o,r,i){var u=o(r,i),f=(u>>31)*2+1,a=u>>>23&255,l=u&8388607;return a===255?l?NaN:f*(1/0):a===0?f*1401298464324817e-60*l:f*Math.pow(2,a-150)*(l+8388608)}e.readFloatLE=n.bind(null,Lt),e.readFloatBE=n.bind(null,Bt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function r(a,l,d){t[0]=a,l[d]=n[0],l[d+1]=n[1],l[d+2]=n[2],l[d+3]=n[3],l[d+4]=n[4],l[d+5]=n[5],l[d+6]=n[6],l[d+7]=n[7]}function i(a,l,d){t[0]=a,l[d]=n[7],l[d+1]=n[6],l[d+2]=n[5],l[d+3]=n[4],l[d+4]=n[3],l[d+5]=n[2],l[d+6]=n[1],l[d+7]=n[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function u(a,l){return n[0]=a[l],n[1]=a[l+1],n[2]=a[l+2],n[3]=a[l+3],n[4]=a[l+4],n[5]=a[l+5],n[6]=a[l+6],n[7]=a[l+7],t[0]}function f(a,l){return n[7]=a[l],n[6]=a[l+1],n[5]=a[l+2],n[4]=a[l+3],n[3]=a[l+4],n[2]=a[l+5],n[1]=a[l+6],n[0]=a[l+7],t[0]}e.readDoubleLE=o?u:f,e.readDoubleBE=o?f:u}():function(){function t(o,r,i,u,f,a){var l=u<0?1:0;if(l&&(u=-u),u===0)o(0,f,a+r),o(1/u>0?0:2147483648,f,a+i);else if(isNaN(u))o(0,f,a+r),o(2146959360,f,a+i);else if(u>17976931348623157e292)o(0,f,a+r),o((l<<31|2146435072)>>>0,f,a+i);else{var d;if(u<22250738585072014e-324)d=u/5e-324,o(d>>>0,f,a+r),o((l<<31|d/4294967296)>>>0,f,a+i);else{var _=Math.floor(Math.log(u)/Math.LN2);_===1024&&(_=1023),d=u*Math.pow(2,-_),o(d*4503599627370496>>>0,f,a+r),o((l<<31|_+1023<<20|d*1048576&1048575)>>>0,f,a+i)}}}e.writeDoubleLE=t.bind(null,Rt,0,4),e.writeDoubleBE=t.bind(null,wt,4,0);function n(o,r,i,u,f){var a=o(u,f+r),l=o(u,f+i),d=(l>>31)*2+1,_=l>>>20&2047,pe=4294967296*(l&1048575)+a;return _===2047?pe?NaN:d*(1/0):_===0?d*5e-324*pe:d*Math.pow(2,_-1075)*(pe+4503599627370496)}e.readDoubleLE=n.bind(null,Lt,0,4),e.readDoubleBE=n.bind(null,Bt,4,0)}(),e}function Rt(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 wt(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 Lt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Bt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Jt=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 Mt=b(Dt=>{"use strict";var qe=Dt;qe.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};qe.read=function(t,n,o){var r=o-n;if(r<1)return"";for(var i=null,u=[],f=0,a;n<o;)a=t[n++],a<128?u[f++]=a:a>191&&a<224?u[f++]=(a&31)<<6|t[n++]&63:a>239&&a<365?(a=((a&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,u[f++]=55296+(a>>10),u[f++]=56320+(a&1023)):u[f++]=(a&15)<<12|(t[n++]&63)<<6|t[n++]&63,f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,u)),f=0);return i?(f&&i.push(String.fromCharCode.apply(String,u.slice(0,f))),i.join("")):String.fromCharCode.apply(String,u.slice(0,f))};qe.write=function(t,n,o){for(var r=o,i,u,f=0;f<t.length;++f)i=t.charCodeAt(f),i<128?n[o++]=i:i<2048?(n[o++]=i>>6|192,n[o++]=i&63|128):(i&64512)===55296&&((u=t.charCodeAt(f+1))&64512)===56320?(i=65536+((i&1023)<<10)+(u&1023),++f,n[o++]=i>>18|240,n[o++]=i>>12&63|128,n[o++]=i>>6&63|128,n[o++]=i&63|128):(n[o++]=i>>12|224,n[o++]=i>>6&63|128,n[o++]=i&63|128);return o-r}});var Ut=b((er,Wt)=>{"use strict";Wt.exports=pi;function pi(e,t,n){var o=n||8192,r=o>>>1,i=null,u=o;return function(a){if(a<1||a>r)return e(a);u+a>o&&(i=e(o),u=0);var l=t.call(i,u,u+=a);return u&7&&(u=(u|7)+1),l}}});var Gt=b((tr,$t)=>{"use strict";$t.exports=v;var xe=K();function v(e,t){this.lo=e>>>0,this.hi=t>>>0}var he=v.zero=new v(0,0);he.toNumber=function(){return 0};he.zzEncode=he.zzDecode=function(){return this};he.length=function(){return 1};var hi=v.zeroHash="\0\0\0\0\0\0\0\0";v.fromNumber=function(t){if(t===0)return he;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 v(o,r)};v.from=function(t){if(typeof t=="number")return v.fromNumber(t);if(xe.isString(t))if(xe.Long)t=xe.Long.fromString(t);else return v.fromNumber(parseInt(t,10));return t.low||t.high?new v(t.low>>>0,t.high>>>0):he};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 xe.Long?new xe.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var z=String.prototype.charCodeAt;v.fromHash=function(t){return t===hi?he:new v((z.call(t,0)|z.call(t,1)<<8|z.call(t,2)<<16|z.call(t,3)<<24)>>>0,(z.call(t,4)|z.call(t,5)<<8|z.call(t,6)<<16|z.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 K=b(He=>{"use strict";var s=He;s.asPromise=Ct();s.base64=kt();s.EventEmitter=Ft();s.float=Pt();s.inquire=Jt();s.utf8=Mt();s.pool=Ut();s.LongBits=Gt();s.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);s.global=s.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||He;s.emptyArray=Object.freeze?Object.freeze([]):[];s.emptyObject=Object.freeze?Object.freeze({}):{};s.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};s.isString=function(t){return typeof t=="string"||t instanceof String};s.isObject=function(t){return t&&typeof t=="object"};s.isset=s.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};s.Buffer=function(){try{var e=s.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();s._Buffer_from=null;s._Buffer_allocUnsafe=null;s.newBuffer=function(t){return typeof t=="number"?s.Buffer?s._Buffer_allocUnsafe(t):new s.Array(t):s.Buffer?s._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};s.Array=typeof Uint8Array<"u"?Uint8Array:Array;s.Long=s.global.dcodeIO&&s.global.dcodeIO.Long||s.global.Long||s.inquire("long");s.key2Re=/^true|false|0|1$/;s.key32Re=/^-?(?:0|[1-9][0-9]*)$/;s.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;s.longToHash=function(t){return t?s.LongBits.from(t).toHash():s.LongBits.zeroHash};s.longFromHash=function(t,n){var o=s.LongBits.fromHash(t);return s.Long?s.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function qt(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}s.merge=qt;s.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Ht(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&&qt(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}s.newError=Ht;s.ProtocolError=Ht("ProtocolError");s.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]}};s.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};s.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};s._configure=function(){var e=s.Buffer;if(!e){s._Buffer_from=s._Buffer_allocUnsafe=null;return}s._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},s._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var je=b((ir,Qt)=>{"use strict";Qt.exports=h;var F=K(),Ze,Pe=F.LongBits,Zt=F.base64,zt=F.utf8;function Ie(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Ke(){}function mi(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 Ie(Ke,0,0),this.tail=this.head,this.states=null}var Kt=function(){return F.Buffer?function(){return(h.create=function(){return new Ze})()}:function(){return new h}};h.create=Kt();h.alloc=function(t){return new F.Array(t)};F.Array!==Array&&(h.alloc=F.pool(h.alloc,F.Array.prototype.subarray));h.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Ie(t,n,o),this.len+=n,this};function Qe(e,t,n){t[n]=e&255}function yi(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Ye(e,t){this.len=e,this.next=void 0,this.val=t}Ye.prototype=Object.create(Ie.prototype);Ye.prototype.fn=yi;h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Ye((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(Xe,10,Pe.fromNumber(t)):this.uint32(t)};h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Xe(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(Xe,n.length(),n)};h.prototype.int64=h.prototype.uint64;h.prototype.sint64=function(t){var n=Pe.from(t).zzEncode();return this._push(Xe,n.length(),n)};h.prototype.bool=function(t){return this._push(Qe,1,t?1:0)};function ze(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(ze,4,t>>>0)};h.prototype.sfixed32=h.prototype.fixed32;h.prototype.fixed64=function(t){var n=Pe.from(t);return this._push(ze,4,n.lo)._push(ze,4,n.hi)};h.prototype.sfixed64=h.prototype.fixed64;h.prototype.float=function(t){return this._push(F.float.writeFloatLE,4,t)};h.prototype.double=function(t){return this._push(F.float.writeDoubleLE,8,t)};var gi=F.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(Qe,1,0);if(F.isString(t)){var o=h.alloc(n=Zt.length(t));Zt.decode(t,o,0),t=o}return this.uint32(n)._push(gi,n,t)};h.prototype.string=function(t){var n=zt.length(t);return n?this.uint32(n)._push(zt.write,n,t):this._push(Qe,1,0)};h.prototype.fork=function(){return this.states=new mi(this),this.head=this.tail=new Ie(Ke,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 Ie(Ke,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){Ze=e,h.create=Kt(),Ze._configure()}});var jt=b((rr,Xt)=>{"use strict";Xt.exports=J;var Yt=je();(J.prototype=Object.create(Yt.prototype)).constructor=J;var Q=K();function J(){Yt.call(this)}J._configure=function(){J.alloc=Q._Buffer_allocUnsafe,J.writeBytesBuffer=Q.Buffer&&Q.Buffer.prototype instanceof Uint8Array&&Q.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++]}};J.prototype.bytes=function(t){Q.isString(t)&&(t=Q._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(J.writeBytesBuffer,n,t),this};function Si(e,t,n){e.length<40?Q.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}J.prototype.string=function(t){var n=Q.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Si,n,t),this};J._configure()});var nt=b((or,on)=>{"use strict";on.exports=g;var L=K(),tt,nn=L.LongBits,bi=L.utf8;function B(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 en=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")},rn=function(){return L.Buffer?function(n){return(g.create=function(r){return L.Buffer.isBuffer(r)?new tt(r):en(r)})(n)}:en};g.create=rn();g.prototype._slice=L.Array.prototype.subarray||L.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,B(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 et(){var e=new nn(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 B(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 B(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 Je(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 B(this,4);return Je(this.buf,this.pos+=4)};g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw B(this,4);return Je(this.buf,this.pos+=4)|0};function tn(){if(this.pos+8>this.len)throw B(this,8);return new nn(Je(this.buf,this.pos+=4),Je(this.buf,this.pos+=4))}g.prototype.float=function(){if(this.pos+4>this.len)throw B(this,4);var t=L.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};g.prototype.double=function(){if(this.pos+8>this.len)throw B(this,4);var t=L.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 B(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var r=L.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 bi.read(t,0,t.length)};g.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw B(this,t);this.pos+=t}else do if(this.pos>=this.len)throw B(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){tt=e,g.create=rn(),tt._configure();var t=L.Long?"toLong":"toNumber";L.merge(g.prototype,{int64:function(){return et.call(this)[t](!1)},uint64:function(){return et.call(this)[t](!0)},sint64:function(){return et.call(this).zzDecode()[t](!1)},fixed64:function(){return tn.call(this)[t](!0)},sfixed64:function(){return tn.call(this)[t](!1)}})}});var fn=b((ar,ln)=>{"use strict";ln.exports=me;var un=nt();(me.prototype=Object.create(un.prototype)).constructor=me;var an=K();function me(e){un.call(this,e)}me._configure=function(){an.Buffer&&(me.prototype._slice=an.Buffer.prototype.slice)};me.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};me._configure()});var dn=b((ur,sn)=>{"use strict";sn.exports=ke;var it=K();(ke.prototype=Object.create(it.EventEmitter.prototype)).constructor=ke;function ke(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");it.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}ke.prototype.rpcCall=function e(t,n,o,r,i){if(!r)throw TypeError("request must be specified");var u=this;if(!i)return it.asPromise(e,u,t,n,o,r);if(!u.rpcImpl){setTimeout(function(){i(Error("already ended"))},0);return}try{return u.rpcImpl(t,n[u.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(a,l){if(a)return u.emit("error",a,t),i(a);if(l===null){u.end(!0);return}if(!(l instanceof o))try{l=o[u.responseDelimited?"decodeDelimited":"decode"](l)}catch(d){return u.emit("error",d,t),i(d)}return u.emit("data",l,t),i(null,l)})}catch(f){u.emit("error",f,t),setTimeout(function(){i(f)},0);return}};ke.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var pn=b(cn=>{"use strict";var vi=cn;vi.Service=dn()});var mn=b((fr,hn)=>{"use strict";hn.exports={}});var Sn=b(gn=>{"use strict";var T=gn;T.build="minimal";T.Writer=je();T.BufferWriter=jt();T.Reader=nt();T.BufferReader=fn();T.util=K();T.rpc=pn();T.roots=mn();T.configure=yn;function yn(){T.util._configure(),T.Writer._configure(T.BufferWriter),T.Reader._configure(T.BufferReader)}yn()});var A=b((dr,bn)=>{"use strict";bn.exports=Sn()});var De=P(A(),1);var c=new Map;function vn(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var _e={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,t=De.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 De.default.Reader?e:De.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.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: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 _e.fromPartial(e??{})},fromPartial(e){let t=vn();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(_e.$type,_e);function Ee(e){return e!=null}function Me(e,t){if(!e)throw Error(t)}var Y;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(Y||(Y={}));function Ei(e){return e.startsWith(Y.ACCOUNT)}function Ti(e){return e.startsWith(Y.LINK)}function Ni(e){return e.startsWith(Y.SUBREDDIT)}function Ci(e){Me(Ei(e),`Expected account id to start with ${Y.ACCOUNT}, got ${e}}`)}function Vi(e){Me(Ti(e),`Expected link id to start with ${Y.LINK}, got ${e}}`)}function xi(e){Me(Ni(e),`Expected subreddit id to start with ${Y.SUBREDDIT}, got ${e}}`)}function En(e){return Ci(e),e}function Tn(e){return Vi(e),e}function Nn(e){return xi(e),e}var Ii=({search:e})=>{let t=new URLSearchParams(e).get("context");if(t){let n=decodeURIComponent(t),o=_e.fromJSON(JSON.parse(n)),r={subredditId:Nn(o.subredditId),userId:En(o.userId),subredditName:o.subredditName,appName:o.appName,appVersion:o.appVersion,postId:Tn(o.postId)};globalThis.devvit={context:r}}};globalThis.location&&Ii(globalThis.location);var ki=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 ri={};si(ri,{connectRealtime:()=>pt,disconnectRealtime:()=>ht,navigateTo:()=>dt,showForm:()=>gt,showToast:()=>St});var k=P(A(),1);var C=P(A(),1);var ge;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ge||(ge={}));function _i(e){switch(e){case 0:case"NULL_VALUE":return ge.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return ge.UNRECOGNIZED}}function Fi(e){switch(e){case ge.NULL_VALUE:return 0;case ge.UNRECOGNIZED:default:return-1}}function rt(){return{fields:{}}}var O={$type:"google.protobuf.Struct",encode(e,t=C.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&Fe.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,r=rt();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let u=Fe.decode(n,n.uint32());u.value!==void 0&&(r.fields[u.key]=u.value);continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:Vn(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=rt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=r),n),{}),t},wrap(e){let t=rt();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 Cn(){return{key:"",value:void 0}}var Fe={$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&&E.encode(E.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,r=Cn();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=E.unwrap(E.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:Te(e.key)?globalThis.String(e.key):"",value:Te(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 Fe.fromPartial(e??{})},fromPartial(e){let t=Cn();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(Fe.$type,Fe);function ot(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var E={$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&&O.encode(O.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&ye.encode(ye.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,r=ot();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=ye.unwrap(ye.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{nullValue:Te(e.nullValue)?_i(e.nullValue):void 0,numberValue:Te(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:Te(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:Te(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:Vn(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=Fi(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 E.fromPartial(e??{})},fromPartial(e){let t=ot();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=ot();if(e===null)t.nullValue=ge.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(E.$type,E);function at(){return{values:[]}}var ye={$type:"google.protobuf.ListValue",encode(e,t=C.default.Writer.create()){for(let n of e.values)E.encode(E.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,r=at();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(E.unwrap(E.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 ye.fromPartial(e??{})},fromPartial(e){let t=at();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=at();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(ye.$type,ye);function Vn(e){return typeof e=="object"&&e!==null}function Te(e){return e!=null}var be=P(A(),1);var Se=P(A(),1);var We=P(A(),1);function xn(){return{}}var Ue={$type:"google.protobuf.Empty",encode(e,t=We.default.Writer.create()){return 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=xn();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 Ue.fromPartial(e??{})},fromPartial(e){return xn()}};c.set(Ue.$type,Ue);function In(){return{channels:[]}}var ut={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=Se.default.Writer.create()){for(let n of e.channels)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,r=In();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 ut.fromPartial(e??{})},fromPartial(e){let t=In();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(ut.$type,ut);function kn(){return{channel:"",data:void 0}}var M={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=Se.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 Se.default.Reader?e:Se.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!==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:Ri(e.channel)?globalThis.String(e.channel):"",data:Oi(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 M.fromPartial(e??{})},fromPartial(e){let t=kn();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(M.$type,M);function Oi(e){return typeof e=="object"&&e!==null}function Ri(e){return e!=null}var X;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(X||(X={}));function wi(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return X.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return X.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return X.UNRECOGNIZED}}function Li(e){switch(e){case X.REALTIME_SUBSCRIBED:return 0;case X.REALTIME_UNSUBSCRIBED:return 1;case X.UNRECOGNIZED:default:return-1}}function _n(){return{subscriptionIds:[]}}var lt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=be.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof be.default.Reader?e:be.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=_n();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 lt.fromPartial(e??{})},fromPartial(e){let t=_n();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(lt.$type,lt);function Fn(){return{event:void 0,status:void 0}}var W={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=be.default.Writer.create()){return e.event!==void 0&&M.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 be.default.Reader?e:be.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!==10)break;r.event=M.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:On(e.event)?M.fromJSON(e.event):void 0,status:On(e.status)?wi(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=M.toJSON(e.event)),e.status!==void 0&&(t.status=Li(e.status)),t},create(e){return W.fromPartial(e??{})},fromPartial(e){let t=Fn();return t.event=e.event!==void 0&&e.event!==null?M.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(W.$type,W);function On(e){return e!=null}var I=P(A(),1);var $e=P(A(),1);var m=P(A(),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 Ne(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 Ce(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 V=P(A(),1);function Rn(){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=V.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&&j.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&ee.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&te.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.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!==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=j.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionValue=ee.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupValue=te.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fieldType:U(e.fieldType)?Ne(e.fieldType):0,isSecret:U(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:U(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:U(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:U(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:U(e.listValue)?j.fromJSON(e.listValue):void 0,selectionValue:U(e.selectionValue)?ee.fromJSON(e.selectionValue):void 0,groupValue:U(e.groupValue)?te.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Ce(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=j.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=ee.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=te.toJSON(e.groupValue)),t},create(e){return y.fromPartial(e??{})},fromPartial(e){let t=Rn();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?j.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?ee.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?te.fromPartial(e.groupValue):void 0,t}};c.set(y.$type,y);function wn(){return{itemType:0,items:[]}}var j={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=V.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 V.default.Reader?e:V.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!==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:U(e.itemType)?Ne(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=Ce(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>y.toJSON(n))),t},create(e){return j.fromPartial(e??{})},fromPartial(e){let t=wn();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>y.fromPartial(n))||[],t}};c.set(j.$type,j);function Ln(){return{values:[]}}var ee={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=V.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);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=Ln();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 ee.fromPartial(e??{})},fromPartial(e){let t=Ln();return t.values=e.values?.map(n=>n)||[],t}};c.set(ee.$type,ee);function Bn(){return{}}var te={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=V.default.Writer.create()){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=Bn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return te.fromPartial(e??{})},fromPartial(e){return Bn()}};c.set(te.$type,te);function U(e){return e!=null}function An(){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=An();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)?Ne(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=Ce(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=An();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 Pn(){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&&ne.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&ie.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&re.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&oe.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&ae.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&ue.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&fe.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=Pn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=ie.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.numberConfig=re.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=oe.decode(n,n.uint32());continue;case 5:if(i!==42)break;r.listConfig=ae.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=ue.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupConfig=fe.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)?ne.fromJSON(e.stringConfig):void 0,paragraphConfig:p(e.paragraphConfig)?ie.fromJSON(e.paragraphConfig):void 0,numberConfig:p(e.numberConfig)?re.fromJSON(e.numberConfig):void 0,booleanConfig:p(e.booleanConfig)?oe.fromJSON(e.booleanConfig):void 0,listConfig:p(e.listConfig)?ae.fromJSON(e.listConfig):void 0,selectionConfig:p(e.selectionConfig)?ue.fromJSON(e.selectionConfig):void 0,groupConfig:p(e.groupConfig)?fe.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=ne.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=ie.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=re.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=oe.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=ae.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=ue.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=fe.toJSON(e.groupConfig)),t},create(e){return x.fromPartial(e??{})},fromPartial(e){let t=Pn();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?ne.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?ie.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?re.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?oe.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?ae.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?ue.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?fe.fromPartial(e.groupConfig):void 0,t}};c.set(x.$type,x);function Jn(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var ne={$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=Jn();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 ne.fromPartial(e??{})},fromPartial(e){let t=Jn();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ne.$type,ne);function Dn(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var ie={$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=Dn();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 ie.fromPartial(e??{})},fromPartial(e){let t=Dn();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ie.$type,ie);function Mn(){return{step:void 0,min:void 0,max:void 0}}var re={$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=Mn();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 re.fromPartial(e??{})},fromPartial(e){let t=Mn();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(re.$type,re);function Wn(){return{}}var oe={$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=Wn();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 oe.fromPartial(e??{})},fromPartial(e){return Wn()}};c.set(oe.$type,oe);function Un(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var ae={$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=Un();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)?Ne(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=Ce(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 ae.fromPartial(e??{})},fromPartial(e){let t=Un();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(ae.$type,ae);function $n(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var ue={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=m.default.Writer.create()){for(let n of e.choices)le.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(le.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=>le.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=>le.toJSON(n))),e.multiSelect!==void 0&&(t.multiSelect=e.multiSelect),e.minSelections!==void 0&&(t.minSelections=Math.round(e.minSelections)),e.maxSelections!==void 0&&(t.maxSelections=Math.round(e.maxSelections)),e.renderAsList!==void 0&&(t.renderAsList=e.renderAsList),t},create(e){return ue.fromPartial(e??{})},fromPartial(e){let t=$n();return t.choices=e.choices?.map(n=>le.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(ue.$type,ue);function Gn(){return{label:"",value:""}}var le={$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=Gn();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 le.fromPartial(e??{})},fromPartial(e){let t=Gn();return t.label=e.label??"",t.value=e.value??"",t}};c.set(le.$type,le);function qn(){return{fields:[]}}var fe={$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=qn();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 fe.fromPartial(e??{})},fromPartial(e){let t=qn();return t.fields=e.fields?.map(n=>N.fromPartial(n))||[],t}};c.set(fe.$type,fe);function p(e){return e!=null}function Hn(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var $={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=$e.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 $e.default.Reader?e:$e.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.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:Oe(e.title)?globalThis.String(e.title):void 0,shortDescription:Oe(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:Oe(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:Oe(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:Oe(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 $.fromPartial(e??{})},fromPartial(e){let t=Hn();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($.$type,$);function Oe(e){return e!=null}function Zn(){return{form:void 0}}var ft={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=I.default.Writer.create()){return e.form!==void 0&&$.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,r=Zn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=$.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{form:we(e.form)?$.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=$.toJSON(e.form)),t},create(e){return ft.fromPartial(e??{})},fromPartial(e){let t=Zn();return t.form=e.form!==void 0&&e.form!==null?$.fromPartial(e.form):void 0,t}};c.set(ft.$type,ft);function zn(){return{results:{},formId:void 0}}var G={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=I.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{Re.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,r=zn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let u=Re.decode(n,n.uint32());u.value!==void 0&&(r.results[u.key]=u.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:Bi(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=y.fromJSON(o),t),{}):{},formId:we(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 G.fromPartial(e??{})},fromPartial(e){let t=zn();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(G.$type,G);function Kn(){return{key:"",value:void 0}}var Re={$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,r=Kn();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:we(e.key)?globalThis.String(e.key):"",value:we(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 Re.fromPartial(e??{})},fromPartial(e){let t=Kn();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?y.fromPartial(e.value):void 0,t}};c.set(Re.$type,Re);function Qn(){return{formId:void 0}}var q={$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,r=Qn();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:we(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 q.fromPartial(e??{})},fromPartial(e){let t=Qn();return t.formId=e.formId??void 0,t}};c.set(q.$type,q);function Bi(e){return typeof e=="object"&&e!==null}function we(e){return e!=null}var ce;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ce||(ce={}));function Ai(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return ce.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return ce.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return ce.UNRECOGNIZED}}function Pi(e){switch(e){case ce.WEBVIEW_VISIBLE:return 0;case ce.WEBVIEW_HIDDEN:return 1;case ce.UNRECOGNIZED:default:return-1}}function Yn(){return{message:void 0,jsonString:""}}var se={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=k.default.Writer.create()){return e.message!==void 0&&E.encode(E.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),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=Yn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=E.unwrap(E.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:H(e?.message)?e.message:void 0,jsonString:H(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 se.fromPartial(e??{})},fromPartial(e){let t=Yn();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(se.$type,se);function Xn(){return{visibility:0}}var de={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=k.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),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=Xn();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:H(e.visibility)?Ai(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Pi(e.visibility)),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=Xn();return t.visibility=e.visibility??0,t}};c.set(de.$type,de);function jn(){return{postMessage:void 0,fullScreen:void 0}}var st={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=k.default.Writer.create()){return e.postMessage!==void 0&&se.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&de.encode(e.fullScreen,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=jn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=se.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.fullScreen=de.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{postMessage:H(e.postMessage)?se.fromJSON(e.postMessage):void 0,fullScreen:H(e.fullScreen)?de.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=se.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=de.toJSON(e.fullScreen)),t},create(e){return st.fromPartial(e??{})},fromPartial(e){let t=jn();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?se.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?de.fromPartial(e.fullScreen):void 0,t}};c.set(st.$type,st);function ei(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0}}var Le={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=k.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&q.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&G.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&W.encode(e.realtimeEvent,t.uint32(34).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=ei();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=q.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=G.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=W.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{id:H(e.id)?globalThis.String(e.id):"",formCanceled:H(e.formCanceled)?q.fromJSON(e.formCanceled):void 0,formSubmitted:H(e.formSubmitted)?G.fromJSON(e.formSubmitted):void 0,realtimeEvent:H(e.realtimeEvent)?W.fromJSON(e.realtimeEvent):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=q.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=G.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=W.toJSON(e.realtimeEvent)),t},create(e){return Le.fromPartial(e??{})},fromPartial(e){let t=ei();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?q.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?G.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?W.fromPartial(e.realtimeEvent):void 0,t}};c.set(Le.$type,Le);function H(e){return e!=null}var ti=[3];var Z=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:n.effect=e,ti.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 u=Le.fromJSON(i.data.data);t(u),window.removeEventListener("message",r)}};window.addEventListener("message",r),window.parent.postMessage(n,"*")}else window.parent.postMessage(n,"*"),t(void 0)});function dt(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.url).toString(),Z({navigateToUrl:{url:t},type:5})}var Ve=new Map,pt=async e=>{if(Ve.has(e.channel))return;let t=new ct(e);Ve.set(e.channel,t),addEventListener("message",t.onMessage),await Z({realtimeSubscriptions:{subscriptionIds:[...Ve.keys()]},type:0})},ht=async e=>{if(!Ve.get(e))return;let n=[...Ve.keys()].filter(o=>o!==e);await Z({realtimeSubscriptions:{subscriptionIds:n},type:0}),Ve.delete(e)},R,ct=class{constructor(t){Et(this,R);this.onMessage=t=>{let{type:n,data:o}=t.data;if(n!=="devvit-message"||!o.realtimeEvent)return;let{status:r,event:i}=o.realtimeEvent;i?.channel.endsWith(D(this,R).channel)&&(i.channel=D(this,R).channel,r===0?D(this,R).onConnect?.(D(this,R).channel):r===1?D(this,R).onDisconnect?.(D(this,R).channel):i.data?D(this,R).onMessage(i.data):console.log("[realtime] Received event without data:",{channel:D(this,R).channel,status:r}))};Tt(this,R,t)}};R=new WeakMap;function mt(e,t=new Set){for(let n of e){if(n.type==="group"){mt(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}Ji(e)}function Ji(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 Di(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 ni(e){return Object.keys(e).reduce((t,n)=>{let o=Di(e[n]);return o!==void 0&&(t[n]=o),t},{})}function yt(e){return e.map(t=>{switch(t.type){case"string":return Mi(t);case"image":return Wi(t);case"paragraph":return Ui(t);case"number":return $i(t);case"select":return Gi(t);case"boolean":return qi(t);case"group":return Hi(t);default:throw new Error("Unknown field type.")}})}function Mi(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 Wi(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Ui(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 $i(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 Gi(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 qi(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Hi(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:yt(e.fields)}},label:e.label,helpText:e.helpText}}var ii=1,Zi=()=>(ii++,`form.${ii}`),gt=async e=>{let t={fields:[],id:Zi(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};mt(e.fields),t.fields=yt(e.fields);let n=await Z({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:ni(n.formSubmitted.results)}};function St(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},Z({showToast:{toast:t},type:4})}export{pt as connectRealtime,ki as context,ht as disconnectRealtime,dt as navigateTo,gt as showForm,St as showToast,ri as ui};
|
|
1
|
+
var oi=Object.create;var Ge=Object.defineProperty;var ui=Object.getOwnPropertyDescriptor;var ai=Object.getOwnPropertyNames;var li=Object.getPrototypeOf,fi=Object.prototype.hasOwnProperty;var bt=e=>{throw TypeError(e)};var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),si=(e,t)=>{for(var n in t)Ge(e,n,{get:t[n],enumerable:!0})},di=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ai(t))!fi.call(e,r)&&r!==n&&Ge(e,r,{get:()=>t[r],enumerable:!(o=ui(t,r))||o.enumerable});return e};var P=(e,t,n)=>(n=e!=null?oi(li(e)):{},di(t||!e||!e.__esModule?Ge(n,"default",{value:e,enumerable:!0}):n,e));var vt=(e,t,n)=>t.has(e)||bt("Cannot "+n);var D=(e,t,n)=>(vt(e,t,"read from private field"),n?n.call(e):t.get(e)),Et=(e,t,n)=>t.has(e)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Tt=(e,t,n,o)=>(vt(e,t,"write to private field"),o?o.call(e,n):t.set(e,n),n);var Ct=b((Ki,Nt)=>{"use strict";Nt.exports=ci;function ci(e,t){for(var n=new Array(arguments.length-1),o=0,r=2,i=!0;r<arguments.length;)n[o++]=arguments[r++];return new Promise(function(f,u){n[o]=function(d){if(i)if(i=!1,d)u(d);else{for(var _=new Array(arguments.length-1),pe=0;pe<_.length;)_[pe++]=arguments[pe];f.apply(null,_)}};try{e.apply(t||null,n)}catch(l){i&&(i=!1,u(l))}})}});var kt=b(It=>{"use strict";var Be=It;Be.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 ve=new Array(64),xt=new Array(123);for(w=0;w<64;)xt[ve[w]=w<26?w+65:w<52?w+71:w<62?w-4:w-59|43]=w++;var w;Be.encode=function(t,n,o){for(var r=null,i=[],a=0,f=0,u;n<o;){var l=t[n++];switch(f){case 0:i[a++]=ve[l>>2],u=(l&3)<<4,f=1;break;case 1:i[a++]=ve[u|l>>4],u=(l&15)<<2,f=2;break;case 2:i[a++]=ve[u|l>>6],i[a++]=ve[l&63],f=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),a=0)}return f&&(i[a++]=ve[u],i[a++]=61,f===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 Vt="invalid encoding";Be.decode=function(t,n,o){for(var r=o,i=0,a,f=0;f<t.length;){var u=t.charCodeAt(f++);if(u===61&&i>1)break;if((u=xt[u])===void 0)throw Error(Vt);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(Vt);return o-r};Be.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Ft=b((Yi,_t)=>{"use strict";_t.exports=Ae;function Ae(){this._listeners={}}Ae.prototype.on=function(t,n,o){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:o||this}),this};Ae.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};Ae.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 Pt=b((Xi,At)=>{"use strict";At.exports=Ot(Ot);function Ot(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),o=n[3]===128;function r(u,l,d){t[0]=u,l[d]=n[0],l[d+1]=n[1],l[d+2]=n[2],l[d+3]=n[3]}function i(u,l,d){t[0]=u,l[d]=n[3],l[d+1]=n[2],l[d+2]=n[1],l[d+3]=n[0]}e.writeFloatLE=o?r:i,e.writeFloatBE=o?i:r;function a(u,l){return n[0]=u[l],n[1]=u[l+1],n[2]=u[l+2],n[3]=u[l+3],t[0]}function f(u,l){return n[3]=u[l],n[2]=u[l+1],n[1]=u[l+2],n[0]=u[l+3],t[0]}e.readFloatLE=o?a:f,e.readFloatBE=o?f:a}():function(){function t(o,r,i,a){var f=r<0?1:0;if(f&&(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((f<<31|2139095040)>>>0,i,a);else if(r<11754943508222875e-54)o((f<<31|Math.round(r/1401298464324817e-60))>>>0,i,a);else{var u=Math.floor(Math.log(r)/Math.LN2),l=Math.round(r*Math.pow(2,-u)*8388608)&8388607;o((f<<31|u+127<<23|l)>>>0,i,a)}}e.writeFloatLE=t.bind(null,Rt),e.writeFloatBE=t.bind(null,wt);function n(o,r,i){var a=o(r,i),f=(a>>31)*2+1,u=a>>>23&255,l=a&8388607;return u===255?l?NaN:f*(1/0):u===0?f*1401298464324817e-60*l:f*Math.pow(2,u-150)*(l+8388608)}e.readFloatLE=n.bind(null,Lt),e.readFloatBE=n.bind(null,Bt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),o=n[7]===128;function r(u,l,d){t[0]=u,l[d]=n[0],l[d+1]=n[1],l[d+2]=n[2],l[d+3]=n[3],l[d+4]=n[4],l[d+5]=n[5],l[d+6]=n[6],l[d+7]=n[7]}function i(u,l,d){t[0]=u,l[d]=n[7],l[d+1]=n[6],l[d+2]=n[5],l[d+3]=n[4],l[d+4]=n[3],l[d+5]=n[2],l[d+6]=n[1],l[d+7]=n[0]}e.writeDoubleLE=o?r:i,e.writeDoubleBE=o?i:r;function a(u,l){return n[0]=u[l],n[1]=u[l+1],n[2]=u[l+2],n[3]=u[l+3],n[4]=u[l+4],n[5]=u[l+5],n[6]=u[l+6],n[7]=u[l+7],t[0]}function f(u,l){return n[7]=u[l],n[6]=u[l+1],n[5]=u[l+2],n[4]=u[l+3],n[3]=u[l+4],n[2]=u[l+5],n[1]=u[l+6],n[0]=u[l+7],t[0]}e.readDoubleLE=o?a:f,e.readDoubleBE=o?f:a}():function(){function t(o,r,i,a,f,u){var l=a<0?1:0;if(l&&(a=-a),a===0)o(0,f,u+r),o(1/a>0?0:2147483648,f,u+i);else if(isNaN(a))o(0,f,u+r),o(2146959360,f,u+i);else if(a>17976931348623157e292)o(0,f,u+r),o((l<<31|2146435072)>>>0,f,u+i);else{var d;if(a<22250738585072014e-324)d=a/5e-324,o(d>>>0,f,u+r),o((l<<31|d/4294967296)>>>0,f,u+i);else{var _=Math.floor(Math.log(a)/Math.LN2);_===1024&&(_=1023),d=a*Math.pow(2,-_),o(d*4503599627370496>>>0,f,u+r),o((l<<31|_+1023<<20|d*1048576&1048575)>>>0,f,u+i)}}}e.writeDoubleLE=t.bind(null,Rt,0,4),e.writeDoubleBE=t.bind(null,wt,4,0);function n(o,r,i,a,f){var u=o(a,f+r),l=o(a,f+i),d=(l>>31)*2+1,_=l>>>20&2047,pe=4294967296*(l&1048575)+u;return _===2047?pe?NaN:d*(1/0):_===0?d*5e-324*pe:d*Math.pow(2,_-1075)*(pe+4503599627370496)}e.readDoubleLE=n.bind(null,Lt,0,4),e.readDoubleBE=n.bind(null,Bt,4,0)}(),e}function Rt(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 wt(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 Lt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Bt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Jt=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 Mt=b(Dt=>{"use strict";var qe=Dt;qe.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};qe.read=function(t,n,o){var r=o-n;if(r<1)return"";for(var i=null,a=[],f=0,u;n<o;)u=t[n++],u<128?a[f++]=u:u>191&&u<224?a[f++]=(u&31)<<6|t[n++]&63:u>239&&u<365?(u=((u&7)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,a[f++]=55296+(u>>10),a[f++]=56320+(u&1023)):a[f++]=(u&15)<<12|(t[n++]&63)<<6|t[n++]&63,f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),f=0);return i?(f&&i.push(String.fromCharCode.apply(String,a.slice(0,f))),i.join("")):String.fromCharCode.apply(String,a.slice(0,f))};qe.write=function(t,n,o){for(var r=o,i,a,f=0;f<t.length;++f)i=t.charCodeAt(f),i<128?n[o++]=i:i<2048?(n[o++]=i>>6|192,n[o++]=i&63|128):(i&64512)===55296&&((a=t.charCodeAt(f+1))&64512)===56320?(i=65536+((i&1023)<<10)+(a&1023),++f,n[o++]=i>>18|240,n[o++]=i>>12&63|128,n[o++]=i>>6&63|128,n[o++]=i&63|128):(n[o++]=i>>12|224,n[o++]=i>>6&63|128,n[o++]=i&63|128);return o-r}});var Ut=b((er,Wt)=>{"use strict";Wt.exports=pi;function pi(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 l=t.call(i,a,a+=u);return a&7&&(a=(a|7)+1),l}}});var Gt=b((tr,$t)=>{"use strict";$t.exports=v;var xe=K();function v(e,t){this.lo=e>>>0,this.hi=t>>>0}var he=v.zero=new v(0,0);he.toNumber=function(){return 0};he.zzEncode=he.zzDecode=function(){return this};he.length=function(){return 1};var hi=v.zeroHash="\0\0\0\0\0\0\0\0";v.fromNumber=function(t){if(t===0)return he;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 v(o,r)};v.from=function(t){if(typeof t=="number")return v.fromNumber(t);if(xe.isString(t))if(xe.Long)t=xe.Long.fromString(t);else return v.fromNumber(parseInt(t,10));return t.low||t.high?new v(t.low>>>0,t.high>>>0):he};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 xe.Long?new xe.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var z=String.prototype.charCodeAt;v.fromHash=function(t){return t===hi?he:new v((z.call(t,0)|z.call(t,1)<<8|z.call(t,2)<<16|z.call(t,3)<<24)>>>0,(z.call(t,4)|z.call(t,5)<<8|z.call(t,6)<<16|z.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 K=b(He=>{"use strict";var s=He;s.asPromise=Ct();s.base64=kt();s.EventEmitter=Ft();s.float=Pt();s.inquire=Jt();s.utf8=Mt();s.pool=Ut();s.LongBits=Gt();s.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);s.global=s.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||He;s.emptyArray=Object.freeze?Object.freeze([]):[];s.emptyObject=Object.freeze?Object.freeze({}):{};s.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};s.isString=function(t){return typeof t=="string"||t instanceof String};s.isObject=function(t){return t&&typeof t=="object"};s.isset=s.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};s.Buffer=function(){try{var e=s.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();s._Buffer_from=null;s._Buffer_allocUnsafe=null;s.newBuffer=function(t){return typeof t=="number"?s.Buffer?s._Buffer_allocUnsafe(t):new s.Array(t):s.Buffer?s._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};s.Array=typeof Uint8Array<"u"?Uint8Array:Array;s.Long=s.global.dcodeIO&&s.global.dcodeIO.Long||s.global.Long||s.inquire("long");s.key2Re=/^true|false|0|1$/;s.key32Re=/^-?(?:0|[1-9][0-9]*)$/;s.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;s.longToHash=function(t){return t?s.LongBits.from(t).toHash():s.LongBits.zeroHash};s.longFromHash=function(t,n){var o=s.LongBits.fromHash(t);return s.Long?s.Long.fromBits(o.lo,o.hi,n):o.toNumber(!!n)};function qt(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}s.merge=qt;s.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Ht(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&&qt(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}s.newError=Ht;s.ProtocolError=Ht("ProtocolError");s.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]}};s.oneOfSetter=function(t){return function(n){for(var o=0;o<t.length;++o)t[o]!==n&&delete this[t[o]]}};s.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};s._configure=function(){var e=s.Buffer;if(!e){s._Buffer_from=s._Buffer_allocUnsafe=null;return}s._Buffer_from=e.from!==Uint8Array.from&&e.from||function(n,o){return new e(n,o)},s._Buffer_allocUnsafe=e.allocUnsafe||function(n){return new e(n)}}});var je=b((ir,Qt)=>{"use strict";Qt.exports=h;var F=K(),Ze,Pe=F.LongBits,Zt=F.base64,zt=F.utf8;function Ie(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function Ke(){}function mi(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 Ie(Ke,0,0),this.tail=this.head,this.states=null}var Kt=function(){return F.Buffer?function(){return(h.create=function(){return new Ze})()}:function(){return new h}};h.create=Kt();h.alloc=function(t){return new F.Array(t)};F.Array!==Array&&(h.alloc=F.pool(h.alloc,F.Array.prototype.subarray));h.prototype._push=function(t,n,o){return this.tail=this.tail.next=new Ie(t,n,o),this.len+=n,this};function Qe(e,t,n){t[n]=e&255}function yi(e,t,n){for(;e>127;)t[n++]=e&127|128,e>>>=7;t[n]=e}function Ye(e,t){this.len=e,this.next=void 0,this.val=t}Ye.prototype=Object.create(Ie.prototype);Ye.prototype.fn=yi;h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Ye((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(Xe,10,Pe.fromNumber(t)):this.uint32(t)};h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Xe(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(Xe,n.length(),n)};h.prototype.int64=h.prototype.uint64;h.prototype.sint64=function(t){var n=Pe.from(t).zzEncode();return this._push(Xe,n.length(),n)};h.prototype.bool=function(t){return this._push(Qe,1,t?1:0)};function ze(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(ze,4,t>>>0)};h.prototype.sfixed32=h.prototype.fixed32;h.prototype.fixed64=function(t){var n=Pe.from(t);return this._push(ze,4,n.lo)._push(ze,4,n.hi)};h.prototype.sfixed64=h.prototype.fixed64;h.prototype.float=function(t){return this._push(F.float.writeFloatLE,4,t)};h.prototype.double=function(t){return this._push(F.float.writeDoubleLE,8,t)};var gi=F.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(Qe,1,0);if(F.isString(t)){var o=h.alloc(n=Zt.length(t));Zt.decode(t,o,0),t=o}return this.uint32(n)._push(gi,n,t)};h.prototype.string=function(t){var n=zt.length(t);return n?this.uint32(n)._push(zt.write,n,t):this._push(Qe,1,0)};h.prototype.fork=function(){return this.states=new mi(this),this.head=this.tail=new Ie(Ke,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 Ie(Ke,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){Ze=e,h.create=Kt(),Ze._configure()}});var jt=b((rr,Xt)=>{"use strict";Xt.exports=J;var Yt=je();(J.prototype=Object.create(Yt.prototype)).constructor=J;var Q=K();function J(){Yt.call(this)}J._configure=function(){J.alloc=Q._Buffer_allocUnsafe,J.writeBytesBuffer=Q.Buffer&&Q.Buffer.prototype instanceof Uint8Array&&Q.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++]}};J.prototype.bytes=function(t){Q.isString(t)&&(t=Q._Buffer_from(t,"base64"));var n=t.length>>>0;return this.uint32(n),n&&this._push(J.writeBytesBuffer,n,t),this};function Si(e,t,n){e.length<40?Q.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}J.prototype.string=function(t){var n=Q.Buffer.byteLength(t);return this.uint32(n),n&&this._push(Si,n,t),this};J._configure()});var nt=b((or,on)=>{"use strict";on.exports=g;var L=K(),tt,nn=L.LongBits,bi=L.utf8;function B(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 en=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")},rn=function(){return L.Buffer?function(n){return(g.create=function(r){return L.Buffer.isBuffer(r)?new tt(r):en(r)})(n)}:en};g.create=rn();g.prototype._slice=L.Array.prototype.subarray||L.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,B(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 et(){var e=new nn(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 B(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 B(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 Je(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 B(this,4);return Je(this.buf,this.pos+=4)};g.prototype.sfixed32=function(){if(this.pos+4>this.len)throw B(this,4);return Je(this.buf,this.pos+=4)|0};function tn(){if(this.pos+8>this.len)throw B(this,8);return new nn(Je(this.buf,this.pos+=4),Je(this.buf,this.pos+=4))}g.prototype.float=function(){if(this.pos+4>this.len)throw B(this,4);var t=L.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};g.prototype.double=function(){if(this.pos+8>this.len)throw B(this,4);var t=L.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 B(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(n,o);if(n===o){var r=L.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 bi.read(t,0,t.length)};g.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw B(this,t);this.pos+=t}else do if(this.pos>=this.len)throw B(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){tt=e,g.create=rn(),tt._configure();var t=L.Long?"toLong":"toNumber";L.merge(g.prototype,{int64:function(){return et.call(this)[t](!1)},uint64:function(){return et.call(this)[t](!0)},sint64:function(){return et.call(this).zzDecode()[t](!1)},fixed64:function(){return tn.call(this)[t](!0)},sfixed64:function(){return tn.call(this)[t](!1)}})}});var fn=b((ur,ln)=>{"use strict";ln.exports=me;var an=nt();(me.prototype=Object.create(an.prototype)).constructor=me;var un=K();function me(e){an.call(this,e)}me._configure=function(){un.Buffer&&(me.prototype._slice=un.Buffer.prototype.slice)};me.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};me._configure()});var dn=b((ar,sn)=>{"use strict";sn.exports=ke;var it=K();(ke.prototype=Object.create(it.EventEmitter.prototype)).constructor=ke;function ke(e,t,n){if(typeof e!="function")throw TypeError("rpcImpl must be a function");it.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=!!t,this.responseDelimited=!!n}ke.prototype.rpcCall=function e(t,n,o,r,i){if(!r)throw TypeError("request must be specified");var a=this;if(!i)return it.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,l){if(u)return a.emit("error",u,t),i(u);if(l===null){a.end(!0);return}if(!(l instanceof o))try{l=o[a.responseDelimited?"decodeDelimited":"decode"](l)}catch(d){return a.emit("error",d,t),i(d)}return a.emit("data",l,t),i(null,l)})}catch(f){a.emit("error",f,t),setTimeout(function(){i(f)},0);return}};ke.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var pn=b(cn=>{"use strict";var vi=cn;vi.Service=dn()});var mn=b((fr,hn)=>{"use strict";hn.exports={}});var Sn=b(gn=>{"use strict";var T=gn;T.build="minimal";T.Writer=je();T.BufferWriter=jt();T.Reader=nt();T.BufferReader=fn();T.util=K();T.rpc=pn();T.roots=mn();T.configure=yn;function yn(){T.util._configure(),T.Writer._configure(T.BufferWriter),T.Reader._configure(T.BufferReader)}yn()});var A=b((dr,bn)=>{"use strict";bn.exports=Sn()});var De=P(A(),1);var c=new Map;function vn(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}var _e={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode(e,t=De.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 De.default.Reader?e:De.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.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: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 _e.fromPartial(e??{})},fromPartial(e){let t=vn();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(_e.$type,_e);function Ee(e){return e!=null}function Me(e,t){if(!e)throw Error(t)}var Y;(function(e){e.COMMENT="t1_",e.ACCOUNT="t2_",e.LINK="t3_",e.MESSAGE="t4_",e.SUBREDDIT="t5_",e.AWARD="t6_"})(Y||(Y={}));function Ei(e){return e.startsWith(Y.ACCOUNT)}function Ti(e){return e.startsWith(Y.LINK)}function Ni(e){return e.startsWith(Y.SUBREDDIT)}function Ci(e){Me(Ei(e),`Expected account id to start with ${Y.ACCOUNT}, got ${e}}`)}function Vi(e){Me(Ti(e),`Expected link id to start with ${Y.LINK}, got ${e}}`)}function xi(e){Me(Ni(e),`Expected subreddit id to start with ${Y.SUBREDDIT}, got ${e}}`)}function En(e){return Ci(e),e}function Tn(e){return Vi(e),e}function Nn(e){return xi(e),e}var Ii=({search:e})=>{let t=new URLSearchParams(e).get("context");if(t){let n=decodeURIComponent(t),o=_e.fromJSON(JSON.parse(n)),r={subredditId:Nn(o.subredditId),userId:En(o.userId),subredditName:o.subredditName,appName:o.appName,appVersion:o.appVersion,postId:Tn(o.postId)};globalThis.devvit={context:r}}};globalThis.location&&Ii(globalThis.location);var ki=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 ri={};si(ri,{connectRealtime:()=>pt,disconnectRealtime:()=>ht,navigateTo:()=>dt,showForm:()=>gt,showToast:()=>St});var k=P(A(),1);var C=P(A(),1);var ge;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ge||(ge={}));function _i(e){switch(e){case 0:case"NULL_VALUE":return ge.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return ge.UNRECOGNIZED}}function Fi(e){switch(e){case ge.NULL_VALUE:return 0;case ge.UNRECOGNIZED:default:return-1}}function rt(){return{fields:{}}}var O={$type:"google.protobuf.Struct",encode(e,t=C.default.Writer.create()){return Object.entries(e.fields).forEach(([n,o])=>{o!==void 0&&Fe.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,r=rt();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.fields[a.key]=a.value);continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fields:Vn(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=rt();return t.fields=Object.entries(e.fields??{}).reduce((n,[o,r])=>(r!==void 0&&(n[o]=r),n),{}),t},wrap(e){let t=rt();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 Cn(){return{key:"",value:void 0}}var Fe={$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&&E.encode(E.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,r=Cn();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=E.unwrap(E.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{key:Te(e.key)?globalThis.String(e.key):"",value:Te(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 Fe.fromPartial(e??{})},fromPartial(e){let t=Cn();return t.key=e.key??"",t.value=e.value??void 0,t}};c.set(Fe.$type,Fe);function ot(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var E={$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&&O.encode(O.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&ye.encode(ye.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,r=ot();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=ye.unwrap(ye.decode(n,n.uint32()));continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{nullValue:Te(e.nullValue)?_i(e.nullValue):void 0,numberValue:Te(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:Te(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:Te(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:Vn(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=Fi(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 E.fromPartial(e??{})},fromPartial(e){let t=ot();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=ot();if(e===null)t.nullValue=ge.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(E.$type,E);function ut(){return{values:[]}}var ye={$type:"google.protobuf.ListValue",encode(e,t=C.default.Writer.create()){for(let n of e.values)E.encode(E.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,r=ut();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.values.push(E.unwrap(E.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 ye.fromPartial(e??{})},fromPartial(e){let t=ut();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=ut();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};c.set(ye.$type,ye);function Vn(e){return typeof e=="object"&&e!==null}function Te(e){return e!=null}var be=P(A(),1);var Se=P(A(),1);var We=P(A(),1);function xn(){return{}}var Ue={$type:"google.protobuf.Empty",encode(e,t=We.default.Writer.create()){return 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=xn();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 Ue.fromPartial(e??{})},fromPartial(e){return xn()}};c.set(Ue.$type,Ue);function In(){return{channels:[]}}var at={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=Se.default.Writer.create()){for(let n of e.channels)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,r=In();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 at.fromPartial(e??{})},fromPartial(e){let t=In();return t.channels=e.channels?.map(n=>n)||[],t}};c.set(at.$type,at);function kn(){return{channel:"",data:void 0}}var M={$type:"devvit.events.v1alpha.RealtimeEvent",encode(e,t=Se.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 Se.default.Reader?e:Se.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!==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:Ri(e.channel)?globalThis.String(e.channel):"",data:Oi(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 M.fromPartial(e??{})},fromPartial(e){let t=kn();return t.channel=e.channel??"",t.data=e.data??void 0,t}};c.set(M.$type,M);function Oi(e){return typeof e=="object"&&e!==null}function Ri(e){return e!=null}var X;(function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(X||(X={}));function wi(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return X.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return X.REALTIME_UNSUBSCRIBED;case-1:case"UNRECOGNIZED":default:return X.UNRECOGNIZED}}function Li(e){switch(e){case X.REALTIME_SUBSCRIBED:return 0;case X.REALTIME_UNSUBSCRIBED:return 1;case X.UNRECOGNIZED:default:return-1}}function _n(){return{subscriptionIds:[]}}var lt={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=be.default.Writer.create()){for(let n of e.subscriptionIds)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof be.default.Reader?e:be.default.Reader.create(e),o=t===void 0?n.len:n.pos+t,r=_n();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 lt.fromPartial(e??{})},fromPartial(e){let t=_n();return t.subscriptionIds=e.subscriptionIds?.map(n=>n)||[],t}};c.set(lt.$type,lt);function Fn(){return{event:void 0,status:void 0}}var W={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode(e,t=be.default.Writer.create()){return e.event!==void 0&&M.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 be.default.Reader?e:be.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!==10)break;r.event=M.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:On(e.event)?M.fromJSON(e.event):void 0,status:On(e.status)?wi(e.status):void 0}},toJSON(e){let t={};return e.event!==void 0&&(t.event=M.toJSON(e.event)),e.status!==void 0&&(t.status=Li(e.status)),t},create(e){return W.fromPartial(e??{})},fromPartial(e){let t=Fn();return t.event=e.event!==void 0&&e.event!==null?M.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};c.set(W.$type,W);function On(e){return e!=null}var I=P(A(),1);var $e=P(A(),1);var m=P(A(),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 Ne(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 Ce(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 V=P(A(),1);function Rn(){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=V.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&&j.encode(e.listValue,t.uint32(42).fork()).ldelim(),e.selectionValue!==void 0&&ee.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),e.groupValue!==void 0&&te.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof V.default.Reader?e:V.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!==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=j.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionValue=ee.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupValue=te.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{fieldType:U(e.fieldType)?Ne(e.fieldType):0,isSecret:U(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:U(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:U(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:U(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:U(e.listValue)?j.fromJSON(e.listValue):void 0,selectionValue:U(e.selectionValue)?ee.fromJSON(e.selectionValue):void 0,groupValue:U(e.groupValue)?te.fromJSON(e.groupValue):void 0}},toJSON(e){let t={};return e.fieldType!==0&&(t.fieldType=Ce(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=j.toJSON(e.listValue)),e.selectionValue!==void 0&&(t.selectionValue=ee.toJSON(e.selectionValue)),e.groupValue!==void 0&&(t.groupValue=te.toJSON(e.groupValue)),t},create(e){return y.fromPartial(e??{})},fromPartial(e){let t=Rn();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?j.fromPartial(e.listValue):void 0,t.selectionValue=e.selectionValue!==void 0&&e.selectionValue!==null?ee.fromPartial(e.selectionValue):void 0,t.groupValue=e.groupValue!==void 0&&e.groupValue!==null?te.fromPartial(e.groupValue):void 0,t}};c.set(y.$type,y);function wn(){return{itemType:0,items:[]}}var j={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=V.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 V.default.Reader?e:V.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!==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:U(e.itemType)?Ne(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=Ce(e.itemType)),e.items?.length&&(t.items=e.items.map(n=>y.toJSON(n))),t},create(e){return j.fromPartial(e??{})},fromPartial(e){let t=wn();return t.itemType=e.itemType??0,t.items=e.items?.map(n=>y.fromPartial(n))||[],t}};c.set(j.$type,j);function Ln(){return{values:[]}}var ee={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=V.default.Writer.create()){for(let n of e.values)t.uint32(10).string(n);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=Ln();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 ee.fromPartial(e??{})},fromPartial(e){let t=Ln();return t.values=e.values?.map(n=>n)||[],t}};c.set(ee.$type,ee);function Bn(){return{}}var te={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode(e,t=V.default.Writer.create()){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=Bn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{}},toJSON(e){return{}},create(e){return te.fromPartial(e??{})},fromPartial(e){return Bn()}};c.set(te.$type,te);function U(e){return e!=null}function An(){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=An();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)?Ne(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=Ce(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=An();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 Pn(){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&&ne.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),e.paragraphConfig!==void 0&&ie.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),e.numberConfig!==void 0&&re.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),e.booleanConfig!==void 0&&oe.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),e.listConfig!==void 0&&ue.encode(e.listConfig,t.uint32(42).fork()).ldelim(),e.selectionConfig!==void 0&&ae.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),e.groupConfig!==void 0&&fe.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=Pn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.stringConfig=ne.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.paragraphConfig=ie.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.numberConfig=re.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.booleanConfig=oe.decode(n,n.uint32());continue;case 5:if(i!==42)break;r.listConfig=ue.decode(n,n.uint32());continue;case 6:if(i!==50)break;r.selectionConfig=ae.decode(n,n.uint32());continue;case 7:if(i!==58)break;r.groupConfig=fe.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)?ne.fromJSON(e.stringConfig):void 0,paragraphConfig:p(e.paragraphConfig)?ie.fromJSON(e.paragraphConfig):void 0,numberConfig:p(e.numberConfig)?re.fromJSON(e.numberConfig):void 0,booleanConfig:p(e.booleanConfig)?oe.fromJSON(e.booleanConfig):void 0,listConfig:p(e.listConfig)?ue.fromJSON(e.listConfig):void 0,selectionConfig:p(e.selectionConfig)?ae.fromJSON(e.selectionConfig):void 0,groupConfig:p(e.groupConfig)?fe.fromJSON(e.groupConfig):void 0}},toJSON(e){let t={};return e.stringConfig!==void 0&&(t.stringConfig=ne.toJSON(e.stringConfig)),e.paragraphConfig!==void 0&&(t.paragraphConfig=ie.toJSON(e.paragraphConfig)),e.numberConfig!==void 0&&(t.numberConfig=re.toJSON(e.numberConfig)),e.booleanConfig!==void 0&&(t.booleanConfig=oe.toJSON(e.booleanConfig)),e.listConfig!==void 0&&(t.listConfig=ue.toJSON(e.listConfig)),e.selectionConfig!==void 0&&(t.selectionConfig=ae.toJSON(e.selectionConfig)),e.groupConfig!==void 0&&(t.groupConfig=fe.toJSON(e.groupConfig)),t},create(e){return x.fromPartial(e??{})},fromPartial(e){let t=Pn();return t.stringConfig=e.stringConfig!==void 0&&e.stringConfig!==null?ne.fromPartial(e.stringConfig):void 0,t.paragraphConfig=e.paragraphConfig!==void 0&&e.paragraphConfig!==null?ie.fromPartial(e.paragraphConfig):void 0,t.numberConfig=e.numberConfig!==void 0&&e.numberConfig!==null?re.fromPartial(e.numberConfig):void 0,t.booleanConfig=e.booleanConfig!==void 0&&e.booleanConfig!==null?oe.fromPartial(e.booleanConfig):void 0,t.listConfig=e.listConfig!==void 0&&e.listConfig!==null?ue.fromPartial(e.listConfig):void 0,t.selectionConfig=e.selectionConfig!==void 0&&e.selectionConfig!==null?ae.fromPartial(e.selectionConfig):void 0,t.groupConfig=e.groupConfig!==void 0&&e.groupConfig!==null?fe.fromPartial(e.groupConfig):void 0,t}};c.set(x.$type,x);function Jn(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}var ne={$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=Jn();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 ne.fromPartial(e??{})},fromPartial(e){let t=Jn();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ne.$type,ne);function Dn(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}var ie={$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=Dn();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 ie.fromPartial(e??{})},fromPartial(e){let t=Dn();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};c.set(ie.$type,ie);function Mn(){return{step:void 0,min:void 0,max:void 0}}var re={$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=Mn();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 re.fromPartial(e??{})},fromPartial(e){let t=Mn();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};c.set(re.$type,re);function Wn(){return{}}var oe={$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=Wn();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 oe.fromPartial(e??{})},fromPartial(e){return Wn()}};c.set(oe.$type,oe);function Un(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}var ue={$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=Un();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)?Ne(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=Ce(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 ue.fromPartial(e??{})},fromPartial(e){let t=Un();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(ue.$type,ue);function $n(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}var ae={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=m.default.Writer.create()){for(let n of e.choices)le.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(le.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=>le.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=>le.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 ae.fromPartial(e??{})},fromPartial(e){let t=$n();return t.choices=e.choices?.map(n=>le.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(ae.$type,ae);function Gn(){return{label:"",value:""}}var le={$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=Gn();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 le.fromPartial(e??{})},fromPartial(e){let t=Gn();return t.label=e.label??"",t.value=e.value??"",t}};c.set(le.$type,le);function qn(){return{fields:[]}}var fe={$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=qn();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 fe.fromPartial(e??{})},fromPartial(e){let t=qn();return t.fields=e.fields?.map(n=>N.fromPartial(n))||[],t}};c.set(fe.$type,fe);function p(e){return e!=null}function Hn(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}var $={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=$e.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 $e.default.Reader?e:$e.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.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:Oe(e.title)?globalThis.String(e.title):void 0,shortDescription:Oe(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:Oe(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:Oe(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:Oe(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 $.fromPartial(e??{})},fromPartial(e){let t=Hn();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($.$type,$);function Oe(e){return e!=null}function Zn(){return{form:void 0}}var ft={$type:"devvit.ui.effects.v1alpha.ShowFormEffect",encode(e,t=I.default.Writer.create()){return e.form!==void 0&&$.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,r=Zn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.form=$.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{form:we(e.form)?$.fromJSON(e.form):void 0}},toJSON(e){let t={};return e.form!==void 0&&(t.form=$.toJSON(e.form)),t},create(e){return ft.fromPartial(e??{})},fromPartial(e){let t=Zn();return t.form=e.form!==void 0&&e.form!==null?$.fromPartial(e.form):void 0,t}};c.set(ft.$type,ft);function zn(){return{results:{},formId:void 0}}var G={$type:"devvit.ui.effects.v1alpha.FormSubmittedEvent",encode(e,t=I.default.Writer.create()){return Object.entries(e.results).forEach(([n,o])=>{Re.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,r=zn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;let a=Re.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:Bi(e.results)?Object.entries(e.results).reduce((t,[n,o])=>(t[n]=y.fromJSON(o),t),{}):{},formId:we(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 G.fromPartial(e??{})},fromPartial(e){let t=zn();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(G.$type,G);function Kn(){return{key:"",value:void 0}}var Re={$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,r=Kn();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:we(e.key)?globalThis.String(e.key):"",value:we(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 Re.fromPartial(e??{})},fromPartial(e){let t=Kn();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?y.fromPartial(e.value):void 0,t}};c.set(Re.$type,Re);function Qn(){return{formId:void 0}}var q={$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,r=Qn();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:we(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 q.fromPartial(e??{})},fromPartial(e){let t=Qn();return t.formId=e.formId??void 0,t}};c.set(q.$type,q);function Bi(e){return typeof e=="object"&&e!==null}function we(e){return e!=null}var ce;(function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ce||(ce={}));function Ai(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return ce.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return ce.WEBVIEW_HIDDEN;case-1:case"UNRECOGNIZED":default:return ce.UNRECOGNIZED}}function Pi(e){switch(e){case ce.WEBVIEW_VISIBLE:return 0;case ce.WEBVIEW_HIDDEN:return 1;case ce.UNRECOGNIZED:default:return-1}}function Yn(){return{message:void 0,jsonString:""}}var se={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode(e,t=k.default.Writer.create()){return e.message!==void 0&&E.encode(E.wrap(e.message),t.uint32(10).fork()).ldelim(),e.jsonString!==""&&t.uint32(18).string(e.jsonString),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=Yn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.message=E.unwrap(E.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:H(e?.message)?e.message:void 0,jsonString:H(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 se.fromPartial(e??{})},fromPartial(e){let t=Yn();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};c.set(se.$type,se);function Xn(){return{visibility:0}}var de={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode(e,t=k.default.Writer.create()){return e.visibility!==0&&t.uint32(8).int32(e.visibility),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=Xn();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:H(e.visibility)?Ai(e.visibility):0}},toJSON(e){let t={};return e.visibility!==0&&(t.visibility=Pi(e.visibility)),t},create(e){return de.fromPartial(e??{})},fromPartial(e){let t=Xn();return t.visibility=e.visibility??0,t}};c.set(de.$type,de);function jn(){return{postMessage:void 0,fullScreen:void 0}}var st={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode(e,t=k.default.Writer.create()){return e.postMessage!==void 0&&se.encode(e.postMessage,t.uint32(10).fork()).ldelim(),e.fullScreen!==void 0&&de.encode(e.fullScreen,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=jn();for(;n.pos<o;){let i=n.uint32();switch(i>>>3){case 1:if(i!==10)break;r.postMessage=se.decode(n,n.uint32());continue;case 2:if(i!==18)break;r.fullScreen=de.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{postMessage:H(e.postMessage)?se.fromJSON(e.postMessage):void 0,fullScreen:H(e.fullScreen)?de.fromJSON(e.fullScreen):void 0}},toJSON(e){let t={};return e.postMessage!==void 0&&(t.postMessage=se.toJSON(e.postMessage)),e.fullScreen!==void 0&&(t.fullScreen=de.toJSON(e.fullScreen)),t},create(e){return st.fromPartial(e??{})},fromPartial(e){let t=jn();return t.postMessage=e.postMessage!==void 0&&e.postMessage!==null?se.fromPartial(e.postMessage):void 0,t.fullScreen=e.fullScreen!==void 0&&e.fullScreen!==null?de.fromPartial(e.fullScreen):void 0,t}};c.set(st.$type,st);function ei(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0}}var Le={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode(e,t=k.default.Writer.create()){return e.id!==""&&t.uint32(10).string(e.id),e.formCanceled!==void 0&&q.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),e.formSubmitted!==void 0&&G.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),e.realtimeEvent!==void 0&&W.encode(e.realtimeEvent,t.uint32(34).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=ei();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=q.decode(n,n.uint32());continue;case 3:if(i!==26)break;r.formSubmitted=G.decode(n,n.uint32());continue;case 4:if(i!==34)break;r.realtimeEvent=W.decode(n,n.uint32());continue}if((i&7)===4||i===0)break;n.skipType(i&7)}return r},fromJSON(e){return{id:H(e.id)?globalThis.String(e.id):"",formCanceled:H(e.formCanceled)?q.fromJSON(e.formCanceled):void 0,formSubmitted:H(e.formSubmitted)?G.fromJSON(e.formSubmitted):void 0,realtimeEvent:H(e.realtimeEvent)?W.fromJSON(e.realtimeEvent):void 0}},toJSON(e){let t={};return e.id!==""&&(t.id=e.id),e.formCanceled!==void 0&&(t.formCanceled=q.toJSON(e.formCanceled)),e.formSubmitted!==void 0&&(t.formSubmitted=G.toJSON(e.formSubmitted)),e.realtimeEvent!==void 0&&(t.realtimeEvent=W.toJSON(e.realtimeEvent)),t},create(e){return Le.fromPartial(e??{})},fromPartial(e){let t=ei();return t.id=e.id??"",t.formCanceled=e.formCanceled!==void 0&&e.formCanceled!==null?q.fromPartial(e.formCanceled):void 0,t.formSubmitted=e.formSubmitted!==void 0&&e.formSubmitted!==null?G.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=e.realtimeEvent!==void 0&&e.realtimeEvent!==null?W.fromPartial(e.realtimeEvent):void 0,t}};c.set(Le.$type,Le);function H(e){return e!=null}var ti=[3];var Z=e=>new Promise(t=>{let n={scope:0,type:"devvit-internal"};if(e.realtimeSubscriptions?n.realtimeEffect=e.realtimeSubscriptions:n.effect=e,ti.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=Le.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 dt(e){let t;typeof e=="string"?t=new URL(e).toString():t=new URL(e.url).toString(),Z({navigateToUrl:{url:t},type:5})}var Ve=new Map,pt=async e=>{if(Ve.has(e.channel))return;let t=new ct(e);Ve.set(e.channel,t),addEventListener("message",t.onMessage),await Z({realtimeSubscriptions:{subscriptionIds:[...Ve.keys()]},type:0})},ht=async e=>{if(!Ve.get(e))return;let n=[...Ve.keys()].filter(o=>o!==e);await Z({realtimeSubscriptions:{subscriptionIds:n},type:0}),Ve.delete(e)},R,ct=class{constructor(t){Et(this,R);this.onMessage=t=>{let{type:n,data:o}=t.data;if(n!=="devvit-message"||!o.realtimeEvent)return;let{status:r,event:i}=o.realtimeEvent;i?.channel.endsWith(D(this,R).channel)&&(i.channel=D(this,R).channel,r===0?D(this,R).onConnect?.(D(this,R).channel):r===1?D(this,R).onDisconnect?.(D(this,R).channel):i.data?D(this,R).onMessage(i.data.msg):console.error("[realtime] Received event without data:",{channel:D(this,R).channel,event:i}))};Tt(this,R,t)}};R=new WeakMap;function mt(e,t=new Set){for(let n of e){if(n.type==="group"){mt(n.fields,t);continue}let o=n.name;if(t.has(o))throw new Error(`Duplicate field name: ${o}`);t.add(o)}Ji(e)}function Ji(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 Di(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 ni(e){return Object.keys(e).reduce((t,n)=>{let o=Di(e[n]);return o!==void 0&&(t[n]=o),t},{})}function yt(e){return e.map(t=>{switch(t.type){case"string":return Mi(t);case"image":return Wi(t);case"paragraph":return Ui(t);case"number":return $i(t);case"select":return Gi(t);case"boolean":return qi(t);case"group":return Hi(t);default:throw new Error("Unknown field type.")}})}function Mi(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 Wi(e){return{disabled:e.disabled,fieldId:e.name,fieldType:7,helpText:e.helpText,label:e.label,required:e.required}}function Ui(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 $i(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 Gi(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 qi(e){return{defaultValue:{fieldType:3,boolValue:e.defaultValue},disabled:e.disabled,fieldId:e.name,fieldType:3,helpText:e.helpText,label:e.label}}function Hi(e){return{fieldId:"",fieldType:6,fieldConfig:{groupConfig:{fields:yt(e.fields)}},label:e.label,helpText:e.helpText}}var ii=1,Zi=()=>(ii++,`form.${ii}`),gt=async e=>{let t={fields:[],id:Zi(),title:e.title,acceptLabel:e.acceptLabel,cancelLabel:e.cancelLabel,shortDescription:e.description};mt(e.fields),t.fields=yt(e.fields);let n=await Z({showForm:{form:t},type:3});return!n||!n.formSubmitted?{action:"CANCELED"}:{action:"SUBMITTED",values:ni(n.formSubmitted.results)}};function St(e){let t;e instanceof Object?t={text:e.text,appearance:e.appearance==="success"?1:0}:t={text:e},Z({showToast:{toast:t},type:4})}export{pt as connectRealtime,ki as context,ht as disconnectRealtime,dt as navigateTo,gt as showForm,St as showToast,ri as ui};
|
|
2
2
|
//# sourceMappingURL=client.min.js.map
|