@phantomclient/plugin 0.1.1 → 0.1.2
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/dist/lib/chunks/{api-Cu4nKe7h.js → api-DhaU9Jsd.js} +327 -307
- package/dist/lib/chunks/sdk-permissions-CyDMa4we.js +429 -0
- package/dist/lib/chunks/{state-kAlKf5xt.js → state-BGYMFLti.js} +9 -8
- package/dist/lib/guest.js +1126 -851
- package/dist/lib/index.js +33 -27
- package/dist/lib/styles.css +1 -1
- package/dist/lib/vue.js +3 -3
- package/dist/runtime/chunks/api-DCkkcNDr.js +1 -0
- package/dist/runtime/chunks/sdk-permissions-AYsXGgro.js +1 -0
- package/dist/runtime/chunks/{state-BjAtxWlm.js → state-CyERnsrb.js} +1 -1
- package/dist/runtime/frame.html +3 -3
- package/dist/runtime/runtime.css +1 -1
- package/dist/runtime/runtime.js +4 -1
- package/dist/runtime/sdk-vue.js +1 -1
- package/dist/runtime/sdk.js +1 -1
- package/dist/types/index.d.ts +1519 -288
- package/dist/types/vue.d.ts +1260 -217
- package/package.json +1 -1
- package/dist/lib/chunks/sdk-permissions-DPyveeLR.js +0 -250
- package/dist/runtime/chunks/api-ByZmAFMe.js +0 -1
- package/dist/runtime/chunks/sdk-permissions-BKJgZYgg.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class u extends Error{constructor(t,n,r){super(r===void 0?t:`${t} (at ${r})`),this.code=n,this.offset=r,this.name="ProtocolError"}code;offset}new TextEncoder;const Re={lt:"<",gt:">",amp:"&",apos:"'",quot:'"'};function V(e){if(!e.includes("&"))return e;let t="",n=0;for(;n<e.length;){const r=e.indexOf("&",n);if(r===-1)break;const i=e.indexOf(";",r+1);t+=e.slice(n,r);const o=i===-1?null:$e(e.slice(r+1,i));o===null?(t+="&",n=r+1):(t+=o,n=i+1)}return t+e.slice(n)}function $e(e){if(e.startsWith("#")){const t=e[1]==="x"||e[1]==="X",n=e.slice(t?2:1);if(n.length===0||!(t?_e(n):Fe(n)))return null;const r=Number.parseInt(n,t?16:10);return r<=1114111?String.fromCodePoint(r):null}return Re[e]??null}function Fe(e){for(const t of e)if(t<"0"||t>"9")return!1;return!0}function _e(e){for(const t of e.toLowerCase())if(!(t>="0"&&t<="9"||t>="a"&&t<="f"))return!1;return!0}function $(e){let t="";for(const n of e)n==="&"?t+="&":n==="<"?t+="<":n===">"?t+=">":t+=n;return t}function Q(e,t){let n="";for(const r of e)r==="&"?n+="&":r==="<"?n+="<":r===t?n+=t==='"'?""":"'":n+=r;return n}class I{constructor(t,n,r="'",i=" ",o=["",""]){this.name=t,this.quote=r,this.leading=i,this.around=o,this.written=n,this.decoded=V(n)}name;quote;leading;around;written;decoded;static create(t,n,r="'"){return new I(t,Q(n,r),r)}get value(){return this.decoded}set value(t){this.decoded=t,this.written=Q(t,this.quote)}get raw(){return this.written}}class E{type="text";written;decoded;constructor(t){this.written=t,this.decoded=V(t)}static create(t){return new E($(t))}get value(){return this.decoded}set value(t){this.decoded=t,this.written=$(t)}get raw(){return this.written}}class T{constructor(t){this.value=t}value;type="cdata"}class Oe{constructor(t){this.value=t}value;type="comment"}class ze{constructor(t,n){this.target=t,this.content=n}target;content;type="instruction"}class v{constructor(t,n={}){this.name=t,this.attributes=n.attributes??[],this.children=n.children??[],this.selfClosing=n.selfClosing??!1,this.trailing=n.trailing??"",this.closingTrailing=n.closingTrailing??""}name;type="element";attributes;children;selfClosing;trailing;closingTrailing;attribute(t){var n;return((n=this.attributes.find(r=>r.name===t))==null?void 0:n.value)??null}setAttribute(t,n){const r=this.attributes.find(i=>i.name===t);r?r.value=n:this.attributes.push(I.create(t,n))}removeAttribute(t){const n=this.attributes.findIndex(r=>r.name===t);return n===-1?!1:(this.attributes.splice(n,1),!0)}get elements(){return this.children.filter(t=>t.type==="element")}child(t){return this.elements.find(n=>n.name===t)??null}childrenNamed(t){return this.elements.filter(n=>n.name===t)}get textContent(){return this.children.map(t=>{switch(t.type){case"element":return t.textContent;case"text":case"cdata":return t.value;default:return""}}).join("")}set textContent(t){const n=this.children.some(r=>r.type==="cdata");this.children=[n?new T(t):E.create(t)],this.selfClosing=!1}append(...t){this.children.push(...t),t.length>0&&(this.selfClosing=!1)}}class pe{constructor(t){this.children=t}children;get root(){return this.children.find(t=>t.type==="element")??null}}class Ve{constructor(t){this.input=t}input;index=0;get offset(){return this.index}get done(){return this.index>=this.input.length}peek(t=0){return this.input.charAt(this.index+t)}startsWith(t){return this.input.startsWith(t,this.index)}advance(t=1){this.index=Math.min(this.index+t,this.input.length)}expect(t){this.startsWith(t)||this.fail(`Expected "${t}"`),this.index+=t.length}whitespace(){const t=this.index;for(;!this.done&&He(this.input.charCodeAt(this.index));)this.index++;return this.input.slice(t,this.index)}until(t,n){const r=this.input.indexOf(t,this.index);r===-1&&this.fail(`Unterminated ${n}`);const i=this.input.slice(this.index,r);return this.index=r,i}name(){const t=this.index;for((this.done||!ge(this.input.charCodeAt(this.index)))&&this.fail("Expected a name"),this.index++;!this.done&&Je(this.input.charCodeAt(this.index));)this.index++;return this.input.slice(t,this.index)}fail(t){throw new u(t,"XML_SYNTAX",this.index)}}const Xe=32,Ke=9,Ge=10,We=13;function He(e){return e===Xe||e===Ke||e===Ge||e===We}function ge(e){return e>=97&&e<=122||e>=65&&e<=90||e===95||e===58||e>127}function Je(e){return ge(e)||e>=48&&e<=57||e===45||e===46}const Z=64;function le(e){const t=new Ve(e),n=ve(t,null,0);return n.some(r=>r.type==="element")||t.fail("Expected an element"),new pe(n)}function ve(e,t,n){const r=[];for(;!e.done;){if(e.startsWith("</"))return t===null&&e.fail("Closing tag with nothing open"),r;e.startsWith("<![CDATA[")?(e.advance(9),r.push(new T(e.until("]]>","CDATA section"))),e.advance(3)):e.startsWith("<!--")?(e.advance(4),r.push(new Oe(e.until("-->","comment"))),e.advance(3)):e.startsWith("<?")?r.push(Qe(e)):e.startsWith("<!")?e.fail("Document type declarations are not supported"):e.peek()==="<"?r.push(Ze(e,n)):r.push(Ye(e))}return t!==null&&e.fail(`Unclosed element <${t}>`),r}function Ye(e){const t=e.offset;for(;!e.done&&e.peek()!=="<";)e.advance();return new E(e.input.slice(t,e.offset))}function Qe(e){e.expect("<?");const t=e.name(),n=e.until("?>","processing instruction");return e.advance(2),new ze(t,n)}function Ze(e,t){t>=Z&&e.fail(`Elements nested deeper than ${Z}`),e.expect("<");const n=e.name(),r=[];for(;;){const i=e.whitespace();if(e.startsWith("/>"))return e.advance(2),new v(n,{attributes:r,selfClosing:!0,trailing:i});if(e.peek()===">"){e.advance();const o=ve(e,n,t+1);e.expect("</");const s=e.name();s!==n&&e.fail(`Expected </${n}> but found </${s}>`);const c=e.whitespace();return e.expect(">"),new v(n,{attributes:r,children:o,trailing:i,closingTrailing:c})}e.done&&e.fail(`Unterminated tag <${n}>`),i.length===0&&e.fail("Expected whitespace before an attribute"),r.push(et(e,i,r))}}function et(e,t,n){const r=e.name();n.some(m=>m.name===r)&&e.fail(`Attribute "${r}" given twice`);const i=e.whitespace();e.expect("=");const o=e.whitespace(),s=e.peek();s!=='"'&&s!=="'"&&e.fail("Expected a quoted attribute value"),e.advance();const c=e.until(s,"attribute value");return c.includes("<")&&e.fail('"<" is not allowed in an attribute value'),e.advance(),new I(r,c,s,t,[i,o])}function ee(e){return e instanceof pe?e.children.map(F).join(""):F(e)}function F(e){switch(e.type){case"element":return tt(e);case"text":return e.raw;case"cdata":return`<![CDATA[${e.value.split("]]>").join("]]]]><![CDATA[>")}]]>`;case"comment":return`<!--${e.value}-->`;case"instruction":return`<?${e.target}${e.content}?>`}}function tt(e){const t=e.attributes.map(nt).join(""),n=`<${e.name}${t}${e.trailing}`;if(e.selfClosing&&e.children.length===0)return`${n}/>`;const r=e.children.map(F).join("");return`${n}>${r}</${e.name}${e.closingTrailing}>`}function nt(e){const[t,n]=e.around,{leading:r,name:i,quote:o,raw:s}=e;return`${r}${i}${t}=${n}${o}${s}${o}`}function rt(e){const t=le(e).root;if(!t||t.name!=="dataObj")throw new u("Expected a <dataObj> element","DATA_OBJECT");return Ie(t,{})}function Ie(e,t){const n=t;for(const r of e.elements)if(r.name==="var")n[A(r,"n")]=it(r);else if(r.name==="obj"){const i=A(r,"t");if(i!=="a"&&i!=="o")throw new u(`Unknown object kind "${i}"`,"DATA_OBJECT");n[A(r,"o")]=Ie(r,i==="a"?[]:{})}return t}function it(e){const t=e.textContent;switch(A(e,"t")){case"s":return t;case"n":return Number(t);case"b":return t!=="0";case"x":return null;default:throw new u(`Unknown variable type "${e.attribute("t")}"`,"DATA_OBJECT")}}function A(e,t){const n=e.attribute(t);if(n===null)throw new u(`<${e.name}> is missing its "${t}" attribute`,"DATA_OBJECT");return n}function at(e){return`<dataObj>${ye(e)}</dataObj>`}function ye(e){return Object.entries(e).map(([t,n])=>n===null?`<var n='${t}' t='x'></var>`:typeof n=="object"?`<obj t='${Array.isArray(n)?"a":"o"}' o='${t}'>${ye(n)}</obj>`:typeof n=="boolean"?`<var n='${t}' t='b'>${n?1:0}</var>`:typeof n=="number"?`<var n='${t}' t='n'>${n}</var>`:`<var n='${t}' t='s'>${$(n)}</var>`).join("")}class we{constructor(t,n){this.raw=t,this.direction=n}raw;direction;wasModified=!1;wasDropped=!1;get modified(){return this.wasModified}get dropped(){return this.wasDropped}drop(){this.wasDropped=!0}encode(){return this.wasModified?this.serialize():this.raw}toString(){return this.encode()}markModified(){this.wasModified=!0}}const te="xt";class D extends we{format="xml";document;constructor(t,n){super(t,n),this.document=le(t)}static create(t,n,r,i,o=[]){const s=new v("msg",{attributes:[I.create("t",n)],children:[new v("body",{attributes:[I.create("action",r),I.create("r",String(i))],children:[...o]})]});return new D(ee(s),t)}get element(){return this.document.root.name}get type(){var t;return((t=this.envelope)==null?void 0:t.attribute("t"))??null}get command(){var t;return((t=this.body)==null?void 0:t.attribute("action"))??null}get room(){const t=this.body,n=Number((t==null?void 0:t.attribute("r"))??(t==null?void 0:t.attribute("id"))??Number.NaN);return Number.isInteger(n)?n:null}get signed(){var t;return(((t=this.envelope)==null?void 0:t.attribute("h"))??null)!==null}get body(){var t;return((t=this.envelope)==null?void 0:t.child("body"))??null}get data(){return this.type!==te||!this.body?null:rt(this.body.textContent)}set data(t){if(this.type!==te||!this.body)throw new u("Only an extension message carries an object","PACKET_FORMAT");this.edit(n=>{const r=n.root.child("body");r.children=[new T(at(t))]})}edit(t){if(this.signed)throw new u("This message is signed by the client; changing it would fail the server’s check","PACKET_FORMAT");t(this.document),this.markModified()}serialize(){return ee(this.document)}get envelope(){const t=this.document.root;return(t==null?void 0:t.name)==="msg"?t:null}}const b="%",_="xt";class U extends we{format="xt";fields;constructor(t,n){super(t,n),this.fields=ot(t,n)}static create(t,n,r,i=[],o="o"){return new U(ne(t,{extension:o,command:n,room:String(r),args:i.map(String)}),t)}get command(){return this.fields.command}set command(t){f(t),this.fields.command=t,this.markModified()}get extension(){return this.fields.extension}get room(){const t=Number(this.fields.room);return Number.isInteger(t)?t:null}set room(t){this.fields.room=String(t),this.markModified()}get args(){return[...this.fields.args]}get length(){return this.fields.args.length}arg(t){return this.fields.args[t]}setArg(t,n){if(!Number.isInteger(t)||t<0||t>this.fields.args.length)throw new RangeError(`Argument ${t} is outside a message of ${this.length} arguments`);const r=String(n);f(r),this.fields.args[t]=r,this.markModified()}setArgs(t){const n=t.map(String);n.forEach(f),this.fields.args=n,this.markModified()}serialize(){return ne(this.direction,this.fields)}}function ot(e,t){if(e.length<2||!e.startsWith(b)||!e.endsWith(b))throw new u('An extension message starts and ends with "%"',"XT_SYNTAX");const n=e.slice(1,-1).split(b);if(n[0]!==_)throw new u(`Expected the "xt" handler, found "${n[0]}"`,"XT_SYNTAX",1);const r=t==="toServer"?4:3;if(n.length<r)throw new u(`A message to the ${t==="toServer"?"server":"client"} has at least ${r} fields`,"XT_SYNTAX");return t==="toServer"?{extension:n[1],command:n[2],room:n[3],args:n.slice(4)}:{extension:null,command:n[1],room:n[2],args:n.slice(3)}}function ne(e,t){const r=[...e==="toServer"?[_,t.extension??"o",t.command,t.room]:[_,t.command,t.room],...t.args];return r.forEach(f),b+r.map(i=>i+b).join("")}function f(e){if(e.includes(b))throw new u(`An extension message value cannot contain "${b}": ${e}`,"XT_VALUE")}class C{constructor(t,n){this.values=t,this.packet=n}values;packet;index=0;get position(){return this.index}get remaining(){return this.values.length-this.index}string(t){return this.next(t)}int(t){const n=this.next(t),r=Number(n);return(n.trim()===""||!Number.isInteger(r))&&this.fail(t,this.index-1,"is not an integer",n),r}number(t){const n=this.next(t),r=Number(n);return(n.trim()===""||!Number.isFinite(r))&&this.fail(t,this.index-1,"is not a number",n),r}flag(t){return this.next(t)!=="0"}repeat(t,n){return Array.from({length:t},(r,i)=>n(i))}rest(){const t=this.values.slice(this.index);return this.index=this.values.length,t}next(t){return this.index>=this.values.length&&this.fail(t,this.index,`is missing: the message has ${this.values.length} arguments`),this.values[this.index++]}fail(t,n,r,i){const o=i===void 0?"":` ("${i}")`;throw new u(`${this.packet}: field "${t}" (${n}) ${r}${o}`,"PACKET_FIELD")}}class st{written=[];string(t){return this.written.push(t),this}int(t){if(!Number.isInteger(t))throw new RangeError(`${t} is not an integer`);return this.written.push(t),this}number(t){if(!Number.isFinite(t))throw new RangeError(`${t} is not a finite number`);return this.written.push(t),this}flag(t){return this.written.push(t?"1":"0"),this}each(t,n){return t.forEach(n),this}raw(t){return this.written.push(...t),this}get values(){return this.written}}function a(e){const{name:t,description:n,direction:r,command:i,extension:o="o",read:s,write:c}=e,m=d=>d instanceof U&&d.direction===r&&d.command===i&&(r==="toClient"||d.extension===o);return{name:t,description:n,format:"xt",direction:r,command:i,matches:m,decode(d){return be(m(d),t,d),{...s(new C(d.args,t)),room:d.room??-1}},encode(d){const h=new st;return c(h,d),U.create(r,i,d.room,h.values,o)}}}function S(e){const{name:t,description:n,direction:r,command:i,type:o,read:s,write:c}=e,m=d=>d instanceof D&&d.direction===r&&d.type===o&&d.command===i;return{name:t,description:n,format:"xml",direction:r,command:i,matches:m,decode(d){return be(m(d),t,d),{...s(d),room:d.room??-1}},encode(d){return D.create(r,o,i,d.room,c(d))}}}function be(e,t,n){if(!e)throw new TypeError(`A ${n.format} "${n.command}" message ${n.direction} is not ${t}`)}function Te(e){return{invId:e.int("invId"),defId:e.int("defId")}}function xe(e,t){e.int(t.length).each(t,({invId:n,defId:r})=>e.int(n).int(r))}a({name:"achievement.list-request",description:"The client asks for a player’s achievements.",direction:"toServer",command:"za",read:e=>({userName:e.string("userName"),secondsSinceLastAsked:e.int("secondsSinceLastAsked")}),write:(e,{userName:t,secondsSinceLastAsked:n})=>e.string(t).int(n)});a({name:"achievement.set-user-var",description:"The client sets one of the player’s user variables.",direction:"toServer",command:"zs",read:e=>({userVarId:e.int("userVarId"),value:e.int("value"),notify:e.flag("notify")}),write:(e,{userVarId:t,value:n,notify:r})=>e.int(t).int(n).int(r?1:0)});a({name:"achievement.user-vars-request",description:"The client asks for all of the player’s user variables.",direction:"toServer",command:"zg",read:()=>({}),write:()=>{}});a({name:"achievement.list",description:"The server gives a player’s achievements.",direction:"toClient",command:"za",read:e=>{const t=e.string("userName"),n=e.int("count");return{userName:t,archived:n===-1,achievements:e.repeat(Math.max(n,0),()=>Te(e))}},write:(e,{userName:t,archived:n,achievements:r})=>{e.string(t),n?e.int(-1):xe(e,r)}});a({name:"achievement.user-var-changed",description:"One of the player’s user variables changed, and any achievements it earned.",direction:"toClient",command:"zs",read:e=>({userVarId:e.int("userVarId"),value:e.number("value"),achievements:e.repeat(e.int("count"),()=>Te(e))}),write:(e,{userVarId:t,value:n,achievements:r})=>{e.int(t).number(n),xe(e,r)}});a({name:"achievement.user-vars",description:"The server gives all of the player’s user variables.",direction:"toClient",command:"zg",read:e=>({userVars:e.repeat(e.int("count"),()=>({userVarId:e.int("userVarId"),type:e.int("type"),value:e.number("value")}))}),write:(e,{userVars:t})=>e.int(t.length).each(t,({userVarId:n,type:r,value:i})=>e.int(n).int(r).number(i))});a({name:"adopt-a-pet.data-request",description:"The client asks for another player’s Adopt a Pet cards.",direction:"toServer",command:"pad",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"adopt-a-pet.data",description:"The server lists a player’s Adopt a Pet cards.",direction:"toClient",command:"pad",read:e=>{const t=e.flag("success");return t?{success:t,cards:e.repeat(e.int("count"),()=>({defId:e.int("defId"),invId:e.int("invId")}))}:{success:t,cards:[]}},write:(e,{success:t,cards:n})=>{e.flag(t),t&&e.int(n.length).each(n,r=>e.int(r.defId).int(r.invId))}});a({name:"adopt-a-pet.count-request",description:"The client asks how many Adopt a Pet cards another player has.",direction:"toServer",command:"padc",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"adopt-a-pet.count",description:"The server says how many Adopt a Pet cards a player has.",direction:"toClient",command:"padc",read:e=>({count:e.int("count")}),write:(e,{count:t})=>e.int(t)});a({name:"adopt-a-pet.seen-request",description:"The player marks Adopt a Pet cards as seen.",direction:"toServer",command:"pads",read:e=>({defIds:e.repeat(e.remaining,()=>e.int("defId"))}),write:(e,{defIds:t})=>e.each(t,n=>e.int(n))});function Ce(e){return{lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits"),name:e.string("petName"),createdTs:e.number("createdTs"),personalityDefId:e.int("personalityDefId"),favoriteFoodDefId:e.int("favoriteFoodDefId"),favoriteToyDefId:e.int("favoriteToyDefId")}}function Ne(e,t){e.int(t.lBits).int(t.uBits).int(t.eBits).string(t.name).number(t.createdTs).int(t.personalityDefId).int(t.favoriteFoodDefId).int(t.favoriteToyDefId)}a({name:"pet.list-request",description:"The client asks for a player’s pets.",direction:"toServer",command:"pl",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"pet.list",description:"The server lists a player’s pets.",direction:"toClient",command:"pl",read:e=>{const t=e.string("found")==="1";if(!t)return{found:t,userName:"",pets:[]};const n=e.string("userName"),r=e.repeat(e.int("count"),()=>({invId:e.int("invId"),createdTs:e.number("createdTs"),name:e.string("name"),lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits"),masteryCounter:e.int("masteryCounter"),personalityDefId:e.int("personalityDefId"),favoriteToyDefId:e.int("favoriteToyDefId"),favoriteFoodDefId:e.int("favoriteFoodDefId"),denStoreInvId:e.int("denStoreInvId")}));return{found:t,userName:n,pets:r}},write:(e,{found:t,userName:n,pets:r})=>{e.string(t?"1":"0"),t&&e.string(n).int(r.length).each(r,i=>e.int(i.invId).number(i.createdTs).string(i.name).int(i.lBits).int(i.uBits).int(i.eBits).int(i.masteryCounter).int(i.personalityDefId).int(i.favoriteToyDefId).int(i.favoriteFoodDefId).int(i.denStoreInvId))}});a({name:"pet.switch-request",description:"The player brings out a pet, or puts theirs away.",direction:"toServer",command:"ps",read:e=>({invId:e.int("invId")}),write:(e,{invId:t})=>e.int(t)});a({name:"pet.switched",description:"Someone brought out a pet or put theirs away.",direction:"toClient",command:"ps",read:e=>{const t=e.string("success")==="1";if(!t)return{success:t,userId:-1,activePetInvId:null,pet:null};const n=e.int("userId");return e.remaining===1?{success:t,userId:n,activePetInvId:e.int("activePetInvId"),pet:null}:{success:t,userId:n,activePetInvId:null,pet:Ce(e)}},write:(e,{success:t,userId:n,activePetInvId:r,pet:i})=>{if(e.string(t?"1":"0"),!!t)if(e.int(n),i)Ne(e,i);else if(r!==null)e.int(r);else throw new u("pet.switched: a success names a pet or an inventory id","PACKET_FIELD")}});a({name:"pet.mastery-display-request",description:"The player shows or hides a pet’s mastery badge.",direction:"toServer",command:"pm",read:e=>({show:e.flag("show"),invId:e.int("invId")}),write:(e,{show:t,invId:n})=>e.flag(t).int(n)});a({name:"pet.mastery-displayed",description:"The server says whether a pet’s mastery badge changed.",direction:"toClient",command:"pm",read:e=>{const t=e.flag("success");return t?{success:t,invId:e.int("invId"),lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits")}:{success:t,invId:-1,lBits:0,uBits:0,eBits:0}},write:(e,{success:t,invId:n,lBits:r,uBits:i,eBits:o})=>{e.flag(t),t&&e.int(n).int(r).int(i).int(o)}});a({name:"pet.egg-name-request",description:"The player names a newly hatched egg pet from two lists of predefined name parts.",direction:"toServer",command:"pn",read:e=>({invId:e.int("invId"),firstNameLocId:e.int("firstNameLocId"),secondNameLocId:e.int("secondNameLocId")}),write:(e,{invId:t,firstNameLocId:n,secondNameLocId:r})=>e.int(t).int(n).int(r)});a({name:"pet.egg-named",description:"The server says whether an egg pet was named.",direction:"toClient",command:"pn",read:e=>({success:e.flag("success"),invId:e.int("invId"),name:e.string("name")}),write:(e,{success:t,invId:n,name:r})=>e.flag(t).int(n).string(r)});a({name:"pet.create-request",description:"The player adopts a new pet.",direction:"toServer",command:"pc",read:e=>({shopId:e.int("shopId"),lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits"),firstNameLocId:e.int("firstNameLocId"),secondNameLocId:e.int("secondNameLocId"),fromRedemption:e.flag("fromRedemption")}),write:(e,t)=>e.int(t.shopId).int(t.lBits).int(t.uBits).int(t.eBits).int(t.firstNameLocId).int(t.secondNameLocId).flag(t.fromRedemption)});a({name:"pet.created",description:"The server says whether a new pet was adopted.",direction:"toClient",command:"pc",read:e=>{const t=e.flag("success");if(!t)return{success:t,balance:0,currencyType:0,pet:null};const n=e.int("balance"),r=e.int("currencyType"),i=e.int("invId"),o=e.int("lBits"),s=e.int("uBits"),c=e.int("eBits"),m=e.string("name"),d=e.number("createdTs"),h=e.int("personalityDefId"),l=e.int("favoriteToyDefId"),g=e.int("favoriteFoodDefId"),P=e.flag("broughtOut");return{success:t,balance:n,currencyType:r,pet:{invId:i,lBits:o,uBits:s,eBits:c,name:m,createdTs:d,personalityDefId:h,favoriteToyDefId:l,favoriteFoodDefId:g,broughtOut:P}}},write:(e,t)=>{e.flag(t.success),!(!t.success||!t.pet)&&e.int(t.balance).int(t.currencyType).int(t.pet.invId).int(t.pet.lBits).int(t.pet.uBits).int(t.pet.eBits).string(t.pet.name).number(t.pet.createdTs).int(t.pet.personalityDefId).int(t.pet.favoriteToyDefId).int(t.pet.favoriteFoodDefId).flag(t.pet.broughtOut)}});a({name:"pet.dismiss-request",description:"The player frees one of their pets.",direction:"toServer",command:"pd",read:e=>({invId:e.int("invId")}),write:(e,{invId:t})=>e.int(t)});a({name:"pet.dismissed",description:"The server says whether a pet was freed.",direction:"toClient",command:"pd",read:e=>({success:e.string("success")==="1",invId:e.int("invId")}),write:(e,{success:t,invId:n})=>e.string(t?"1":"0").int(n)});a({name:"pet.shop-buy-request",description:"The player buys a pet they have not unlocked from a shop.",direction:"toServer",command:"pb",read:e=>({shopId:e.int("shopId"),itemDefId:e.int("itemDefId"),lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits"),firstNameLocId:e.int("firstNameLocId"),secondNameLocId:e.int("secondNameLocId"),fromRedemption:e.flag("fromRedemption")}),write:(e,t)=>e.int(t.shopId).int(t.itemDefId).int(t.lBits).int(t.uBits).int(t.eBits).int(t.firstNameLocId).int(t.secondNameLocId).flag(t.fromRedemption)});a({name:"pet.items-request",description:"The player changes what their pet that is out is wearing.",direction:"toServer",command:"pi",read:e=>({cat9:e.int("cat9"),cat10:e.int("cat10"),cat11:e.int("cat11"),enviroType:e.int("enviroType")}),write:(e,{cat9:t,cat10:n,cat11:r,enviroType:i})=>e.int(t).int(n).int(r).int(i)});a({name:"pet.items-changed",description:"The server says whether the pet that is out now wears something new.",direction:"toClient",command:"pi",read:e=>{const t=e.flag("success");return t?{success:t,gems:e.int("gems"),invId:e.int("invId"),lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits")}:{success:t,gems:0,invId:-1,lBits:0,uBits:0,eBits:0}},write:(e,{success:t,gems:n,invId:r,lBits:i,uBits:o,eBits:s})=>{e.flag(t),t&&e.int(n).int(r).int(i).int(o).int(s)}});a({name:"pet.unlocked",description:"The server says which kinds of pet the account has unlocked.",direction:"toClient",command:"pu",read:e=>({unlockedPets:e.string("unlockedPets")}),write:(e,{unlockedPets:t})=>e.string(t)});a({name:"avatar.move",description:"The player walks or is placed somewhere in the room.",direction:"toServer",command:"au",read:e=>{const t=e.int("count"),n=e.repeat(t,()=>({x:e.int("x"),y:e.int("y")})),r=e.int("animation")>>>0;return{points:n,animation:r,immediate:e.flag("immediate")}},write:(e,{points:t,animation:n,immediate:r})=>e.int(t.length).each(t,({x:i,y:o})=>e.int(i).int(o)).int(n>>>0).flag(r)});a({name:"avatar.moved",description:"Avatars in the room walked or were placed.",direction:"toClient",command:"au",read:e=>({avatars:e.repeat(e.int("users"),()=>{const t=e.int("userId"),n=e.int("count"),r=e.repeat(n,()=>({x:e.int("x"),y:e.int("y")}));return{userId:t,path:r,teleport:e.flag("teleport")}})}),write:(e,{avatars:t})=>e.int(t.length).each(t,({userId:n,path:r,teleport:i})=>e.int(n).int(r.length).each(r,({x:o,y:s})=>e.int(o).int(s)).flag(i))});a({name:"avatar.paint",description:"The player changes their avatar’s colours.",direction:"toServer",command:"ap",read:e=>({colors:[e.int("color1"),e.int("color2"),e.int("color3")],avatarId:e.int("avatarId")}),write:(e,{colors:t,avatarId:n})=>e.int(t[0]).int(t[1]).int(t[2]).int(n)});function k(e){return[e.int("color1"),e.int("color2"),e.int("color3")]}function B(e,t){e.int(t[0]).int(t[1]).int(t[2])}function re(e){return e!==void 0&&e.trim()!==""&&Number.isInteger(Number(e))}a({name:"avatar.paint-result",description:"The server says whether the player’s colours changed.",direction:"toClient",command:"ap",read:e=>({success:e.string("success")==="1",extra:e.rest()}),write:(e,{success:t,extra:n})=>e.string(t?"1":"0").raw(n)});a({name:"avatar.switch-request",description:"The player switches to another of their avatars.",direction:"toServer",command:"as",read:e=>({perUserAvId:e.int("perUserAvId")}),write:(e,{perUserAvId:t})=>e.int(t)});a({name:"avatar.switched",description:"Someone in the room switched avatars.",direction:"toClient",command:"as",read:e=>{if(!e.flag("success"))return{success:!1,extra:e.rest()};const t=e.int("userId"),n={perUserAvId:e.int("perUserAvId"),avInvId:e.int("avInvId"),customAvId:e.int("customAvId"),avTypeId:e.int("avTypeId"),colors:k(e),avName:e.string("avName")};if(e.remaining===2){const i={activePetInvId:e.int("activePetInvId"),questLevel:e.int("questLevel")};return{success:!0,userId:t,avatar:n,player:i,other:null}}const r={pet:Ce(e),questLevel:e.int("questLevel")};return{success:!0,userId:t,avatar:n,player:null,other:r}},write:(e,t)=>{if(!t.success){e.flag(!1).raw(t.extra);return}const{userId:n,avatar:r,player:i,other:o}=t;if(e.flag(!0).int(n).int(r.perUserAvId).int(r.avInvId).int(r.customAvId).int(r.avTypeId),B(e,r.colors),e.string(r.avName),i)e.int(i.activePetInvId).int(i.questLevel);else if(o)Ne(e,o.pet),e.int(o.questLevel);else throw new u("avatar.switched: a success has a player or an other part","PACKET_FIELD")}});a({name:"avatar.list-request",description:"The client asks for a player’s avatars.",direction:"toServer",command:"al",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"avatar.list",description:"The server lists a player’s avatars.",direction:"toClient",command:"al",read:e=>{const t=e.rest(),n=new C(t,"avatar.list"),r=n.string("userName"),i=Number(t[1]);if(re(t[1])&&t.length===2+i&&t.slice(2).every(d=>re(d))){const d=n.int("count");return{own:!1,userName:r,perUserAvIds:n.repeat(d,()=>n.int("perUserAvId"))}}const s=n.int("slotFlags")>>>0,c=n.string("uuid"),m=n.repeat(n.int("count"),()=>({perUserAvId:n.int("perUserAvId"),avInvId:n.int("avInvId"),avName:n.string("avName"),avTypeId:n.int("avTypeId"),customAvId:n.int("customAvId")}));return{own:!0,userName:r,slotFlags:s,uuid:c,avatars:m}},write:(e,t)=>{if(e.string(t.userName),!t.own){e.int(t.perUserAvIds.length).each(t.perUserAvIds,n=>e.int(n));return}e.int(t.slotFlags>>>0).string(t.uuid).int(t.avatars.length).each(t.avatars,n=>e.int(n.perUserAvId).int(n.avInvId).string(n.avName).int(n.avTypeId).int(n.customAvId))}});a({name:"avatar.data-request",description:"The client asks for one of a player’s avatars.",direction:"toServer",command:"ad",read:e=>({userName:e.string("userName"),perUserAvId:e.int("perUserAvId"),items:e.int("items")}),write:(e,{userName:t,perUserAvId:n,items:r})=>e.string(t).int(n).int(r)});a({name:"avatar.data",description:"The server describes one of a player’s avatars.",direction:"toClient",command:"ad",read:e=>{const t={userName:e.string("userName"),uuid:e.string("uuid"),nameBarData:e.int("nameBarData"),enviroType:e.int("enviroType"),userNameModeratedFlag:e.int("userNameModeratedFlag"),timeLeftHostingCustomParty:e.int("timeLeftHostingCustomParty"),daysSinceLastLogin:e.int("daysSinceLastLogin"),perUserAvId:e.int("perUserAvId"),avTypeId:e.int("avTypeId"),customAvId:e.int("customAvId"),colors:k(e),avName:e.string("avName"),questLevel:e.int("questLevel")};if(e.remaining===8){const r={avInvId:e.int("avInvId"),landPetInvId:e.int("landPetInvId"),oceanPetInvId:e.int("oceanPetInvId"),attackBase:e.int("attackBase"),attackMax:e.int("attackMax"),defenseBase:e.int("defenseBase"),defenseMax:e.int("defenseMax"),healthBase:e.int("healthBase")};return{...t,player:r,other:null}}const n={lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits"),petName:e.string("petName")};return{...t,player:null,other:n}},write:(e,t)=>{e.string(t.userName).string(t.uuid).int(t.nameBarData).int(t.enviroType).int(t.userNameModeratedFlag).int(t.timeLeftHostingCustomParty).int(t.daysSinceLastLogin).int(t.perUserAvId).int(t.avTypeId).int(t.customAvId),B(e,t.colors),e.string(t.avName).int(t.questLevel);const{player:n,other:r}=t;if(n)e.int(n.avInvId).int(n.landPetInvId).int(n.oceanPetInvId).int(n.attackBase).int(n.attackMax).int(n.defenseBase).int(n.defenseMax).int(n.healthBase);else if(r)e.int(r.lBits).int(r.uBits).int(r.eBits).string(r.petName);else throw new u("avatar.data: an avatar has a player or an other part","PACKET_FIELD")}});a({name:"avatar.lookup-request",description:"The client looks a player up by name.",direction:"toServer",command:"ag",read:e=>({userName:e.string("userName"),userLookup:e.flag("userLookup")}),write:(e,{userName:t,userLookup:n})=>e.string(t).flag(n)});a({name:"avatar.lookup",description:"The server describes a player looked up by name.",direction:"toClient",command:"ag",read:e=>{const t=e.string("userName"),n=e.string("uuid"),r=e.int("status");if(r!==0&&r!==1)return{userName:t,uuid:n,status:r,avatar:null};const i={accountType:e.int("accountType"),isGuide:e.string("isGuide")==="1",daysSinceLastLogin:e.int("daysSinceLastLogin"),perUserAvId:e.int("perUserAvId"),avInvId:e.int("avInvId"),nameBarData:e.int("nameBarData"),avTypeId:e.int("avTypeId"),customAvId:e.int("customAvId"),colors:k(e),avName:e.string("avName"),eyesDefId:e.int("eyesDefId"),patternDefId:e.int("patternDefId"),questLevel:e.int("questLevel")},o=e.int("count"),s={userId:e.int("userId"),userNameModeratedFlag:e.int("userNameModeratedFlag"),pet:{lBits:e.int("lBits"),uBits:e.int("uBits"),eBits:e.int("eBits"),name:e.string("petName")},items:e.repeat(o,()=>({defId:e.int("defId"),color:e.int("color")}))};return{userName:t,uuid:n,status:r,avatar:{...i,...s}}},write:(e,{userName:t,uuid:n,status:r,avatar:i})=>{e.string(t).string(n).int(r),i&&(e.int(i.accountType).string(i.isGuide?"1":"0").int(i.daysSinceLastLogin).int(i.perUserAvId).int(i.avInvId).int(i.nameBarData).int(i.avTypeId).int(i.customAvId),B(e,i.colors),e.string(i.avName).int(i.eyesDefId).int(i.patternDefId).int(i.questLevel).int(i.items.length).int(i.userId).int(i.userNameModeratedFlag).int(i.pet.lBits).int(i.pet.uBits).int(i.pet.eBits).string(i.pet.name).each(i.items,({defId:o,color:s})=>e.int(o).int(s)))}});a({name:"avatar.joined",description:"An avatar appears in the room.",direction:"toClient",command:"ac",read:e=>({userId:e.int("userId"),x:e.int("x"),y:e.int("y"),animation:e.int("animation")>>>0,userName:e.string("userName"),uuid:e.string("uuid"),perUserAvId:e.int("perUserAvId"),avName:e.string("avName"),avTypeId:e.int("avTypeId"),customAvId:e.int("customAvId"),colors:k(e),questLevel:e.int("questLevel"),details:e.rest()}),write:(e,t)=>{e.int(t.userId).int(t.x).int(t.y).int(t.animation>>>0).string(t.userName).string(t.uuid).int(t.perUserAvId).string(t.avName).int(t.avTypeId).int(t.customAvId),B(e,t.colors),e.int(t.questLevel).raw(t.details)}});a({name:"avatar.kill-request",description:"The player deletes one of their avatars for good.",direction:"toServer",command:"ak",read:e=>({perUserAvId:e.int("perUserAvId")}),write:(e,{perUserAvId:t})=>e.int(t)});a({name:"avatar.killed",description:"The server says whether an avatar was deleted for good.",direction:"toClient",command:"ak",read:e=>({success:e.flag("success"),extra:e.int("extra")}),write:(e,{success:t,extra:n})=>e.flag(t).int(n)});a({name:"avatar.left",description:"An avatar leaves the room.",direction:"toClient",command:"ar",read:e=>{const t=e.int("userId");if(e.remaining===0)return{userId:t,walkOut:0,walkTo:null,extra:[]};const n=e.int("walkOut"),r=n>0?{x:e.int("x"),y:e.int("y")}:null;return{userId:t,walkOut:n,walkTo:r,extra:e.rest()}},write:(e,{userId:t,walkOut:n,walkTo:r,extra:i})=>{e.int(t),!(n===0&&!r&&i.length===0)&&(e.int(n),n>0&&r&&e.int(r.x).int(r.y),e.raw(i))}});function qe(e){return[e.int("nameId1"),e.int("nameId2"),e.int("nameId3")]}function Se(e,t){e.int(t[0]).int(t[1]).int(t[2])}a({name:"avatar.add-request",description:"The player adds a new animal to their account.",direction:"toServer",command:"aa",read:e=>({nameIds:qe(e),avTypeId:e.int("avTypeId"),customAvId:e.int("customAvId"),diamondDefId:e.int("diamondDefId"),shopId:e.int("shopId")}),write:(e,{nameIds:t,avTypeId:n,customAvId:r,diamondDefId:i,shopId:o})=>{Se(e,t),e.int(n).int(r).int(i).int(o)}});a({name:"avatar.added",description:"The server says whether a new animal was added to the account.",direction:"toClient",command:"aa",read:e=>({status:e.int("status"),perUserAvId:e.int("perUserAvId"),avInvId:e.int("avInvId")}),write:(e,{status:t,perUserAvId:n,avInvId:r})=>e.int(t).int(n).int(r)});a({name:"avatar.slot-buy-request",description:"The player buys another avatar slot.",direction:"toServer",command:"ab",read:()=>({}),write:()=>{}});a({name:"avatar.slot-bought",description:"The server says whether another avatar slot was bought.",direction:"toClient",command:"ab",read:e=>({success:e.flag("success")}),write:(e,{success:t})=>e.flag(t)});a({name:"avatar.pending-flag",description:"The client sets one of the account’s pending flags.",direction:"toServer",command:"af",read:e=>({flag:e.int("flag")}),write:(e,{flag:t})=>e.int(t)});a({name:"avatar.fast-pass-add-request",description:"The player adds the first animal to an account made without one.",direction:"toServer",command:"afp",read:e=>({avTypeId:e.int("avTypeId"),nameIds:qe(e)}),write:(e,{avTypeId:t,nameIds:n})=>{e.int(t),Se(e,n)}});a({name:"avatar.fast-pass-added",description:"The server says whether the first animal of an account was added.",direction:"toClient",command:"afp",read:e=>({success:e.flag("success")}),write:(e,{success:t})=>e.flag(t)});a({name:"avatar.lookup-by-id-request",description:"The client looks a player up by their id in the room.",direction:"toServer",command:"ags",read:e=>({userId:e.int("userId"),userLookup:e.flag("userLookup")}),write:(e,{userId:t,userLookup:n})=>e.int(t).flag(n)});a({name:"avatar.name-bar-changed",description:"Someone in the room changed their name bar.",direction:"toClient",command:"an",read:e=>({userId:e.int("userId"),nameBarData:e.int("nameBarData")}),write:(e,{userId:t,nameBarData:n})=>e.int(t).int(n)});a({name:"avatar.ordain-request",description:"The player chooses which of their avatars stay usable without a membership.",direction:"toServer",command:"ao",read:e=>({avInvIds:e.repeat(e.remaining,()=>e.int("avInvId"))}),write:(e,{avInvIds:t})=>e.each(t,n=>e.int(n))});a({name:"avatar.ordained",description:"The server says whether the avatars chosen to stay usable were taken.",direction:"toClient",command:"ao",read:e=>({success:e.flag("success")}),write:(e,{success:t})=>e.flag(t)});a({name:"avatar.photo-request",description:"The player pays for a photo booth picture they saved.",direction:"toServer",command:"apb",read:()=>({}),write:()=>{}});a({name:"avatar.photo-taken",description:"The server says what the player has left after paying for a photo.",direction:"toClient",command:"apb",read:e=>({gems:e.int("gems")}),write:(e,{gems:t})=>e.int(t)});a({name:"avatar.photo-check-request",description:"The client asks whether the player can pay for a photo booth picture.",direction:"toServer",command:"apc",read:()=>({}),write:()=>{}});a({name:"avatar.photo-checked",description:"The server says whether the player can pay for a photo booth picture.",direction:"toClient",command:"apc",read:e=>({gems:e.int("gems")}),write:(e,{gems:t})=>e.int(t)});a({name:"buddy.list-request",description:"The player asks for their buddy and blocked lists.",direction:"toServer",command:"bl",read:()=>({}),write:()=>{}});a({name:"buddy.list",description:"The server sends the buddy list or the blocked list.",direction:"toClient",command:"bl",read:e=>{if(e.string("list")!=="0"){const r=e.int("blocked");return{blocked:!0,buddies:[],blockedUserNames:e.repeat(r,()=>e.string("userName"))}}const t=e.repeat(e.int("online"),()=>ie(e,!0)),n=e.repeat(e.int("offline"),()=>ie(e,!1));return{blocked:!1,buddies:[...t,...n],blockedUserNames:[]}},write:(e,{blocked:t,buddies:n,blockedUserNames:r})=>{if(t){e.string("1").int(r.length),r.forEach(s=>e.string(s));return}const i=n.filter(s=>s.online),o=n.filter(s=>!s.online);e.string("0").int(i.length),i.forEach(s=>ae(e,s,!0)),e.int(o.length),o.forEach(s=>ae(e,s,!1))}});a({name:"buddy.add-request",description:"The player asks someone to be their buddy.",direction:"toServer",command:"ba",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"buddy.add-result",description:"Someone asks to be a buddy, or the server answers the player’s request.",direction:"toClient",command:"ba",read:e=>({status:e.int("status"),userName:e.string("userName"),userNameModerationFlag:e.int("userNameModerationFlag")}),write:(e,{status:t,userName:n,userNameModerationFlag:r})=>e.int(t).string(n).int(r)});a({name:"buddy.confirm",description:"The player accepts or declines a buddy request.",direction:"toServer",command:"bc",read:e=>({userName:e.string("userName"),accept:e.flag("accept")}),write:(e,{userName:t,accept:n})=>e.string(t).flag(n)});a({name:"buddy.status",description:"A buddy comes online or goes offline, is added, or is renamed.",direction:"toClient",command:"bs",read:e=>{const t=e.string("withAvatar")==="1",n={userName:e.string("userName"),uuid:e.string("uuid"),userNameModerationFlag:e.int("userNameModerationFlag"),online:e.string("online")==="1",accountType:e.int("accountType"),change:e.int("change")};return t?{withAvatar:t,...n,newUserName:null,avatarName:e.string("avatarName"),perUserAvatarId:e.int("perUserAvatarId"),partyTimeLeft:e.int("partyTimeLeft")}:{withAvatar:t,...n,newUserName:e.string("newUserName"),avatarName:null,perUserAvatarId:null,partyTimeLeft:null}},write:(e,t)=>{e.flag(t.withAvatar).string(t.userName).string(t.uuid).int(t.userNameModerationFlag).flag(t.online).int(t.accountType).int(t.change),t.withAvatar?e.string(t.avatarName??"").int(t.perUserAvatarId??-1).int(t.partyTimeLeft??-1):e.string(t.newUserName??"")}});a({name:"buddy.remove-request",description:"The player removes a buddy.",direction:"toServer",command:"bd",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"buddy.removed",description:"A buddy is no longer a buddy.",direction:"toClient",command:"bd",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"buddy.location-request",description:"The player asks where a buddy is.",direction:"toServer",command:"br",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"buddy.location",description:"The server says where a buddy is.",direction:"toClient",command:"br",read:e=>({roomName:e.string("roomName"),displayName:e.string("displayName"),displayNameId:e.int("displayNameId"),locked:e.string("locked")==="1"}),write:(e,{roomName:t,displayName:n,displayNameId:r,locked:i})=>e.string(t).string(n).int(r).flag(i)});a({name:"buddy.block-request",description:"The player blocks someone.",direction:"toServer",command:"bb",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"buddy.block-result",description:"The server says whether someone was blocked.",direction:"toClient",command:"bb",read:e=>({userName:e.string("userName"),success:e.string("success")==="1"}),write:(e,{userName:t,success:n})=>e.string(t).flag(n)});a({name:"buddy.unblock-request",description:"The player unblocks someone.",direction:"toServer",command:"bu",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"buddy.unblock-result",description:"The server says whether someone was unblocked.",direction:"toClient",command:"bu",read:e=>({userName:e.string("userName"),success:e.string("success")==="1"}),write:(e,{userName:t,success:n})=>e.string(t).flag(n)});a({name:"buddy.block-info-request",description:"The player asks whether someone is blocking them.",direction:"toServer",command:"bi",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"buddy.block-info",description:"The server says whether someone is blocking the player.",direction:"toClient",command:"bi",read:e=>({userName:e.string("userName"),blockingPlayer:e.string("blockingPlayer")==="1"}),write:(e,{userName:t,blockingPlayer:n})=>e.string(t).flag(n)});function ie(e,t){return{userName:e.string("userName"),uuid:e.string("uuid"),userNameModerationFlag:e.int("userNameModerationFlag"),online:t,accountType:e.int("accountType"),partyTimeLeft:t?e.int("partyTimeLeft"):null}}function ae(e,t,n){e.string(t.userName).string(t.uuid).int(t.userNameModerationFlag).int(t.accountType),n&&e.int(t.partyTimeLeft??-1)}const Qt={free:0,safeChat:1,emote:2,action:3,attachmentEmote:4,permanentEmote:5,slide:6,petAction:7,blendColor:8,freeSafeChat:9,alpha:10,customAdventure:11,customPvp:12};S({name:"chat.public",description:"The player says something in the room.",direction:"toServer",type:"sys",command:"pubMsg",read:e=>{var t,n;const r=V(((n=(t=e.body)==null?void 0:t.child("txt"))==null?void 0:n.textContent)??""),i=r.lastIndexOf("%");if(i===-1)throw new u("chat.public: the text has no kind after it","PACKET_FIELD");const o=Number(r.slice(i+1));if(!Number.isInteger(o))throw new u("chat.public: the kind is not an integer","PACKET_FIELD");return{text:r.slice(0,i),kind:o}},write:({text:e,kind:t})=>[new v("txt",{children:[new T(ct(`${e}%${t}`))]})]});a({name:"chat.room",description:"Someone in the room said something.",direction:"toClient",command:"uc",read:e=>({userId:e.int("userId"),text:e.string("text"),kind:e.int("kind"),level:e.remaining>0?e.int("level"):null,extra:e.rest()}),write:(e,{userId:t,text:n,kind:r,level:i,extra:o})=>{e.int(t).string(n).int(r),i!==null&&e.int(i),e.raw(o)}});a({name:"chat.moderation",description:"A moderator bans, silences, kicks, warns or messages the player.",direction:"toClient",command:"fd",read:e=>({action:e.string("action"),extra:e.rest()}),write:(e,{action:t,extra:n})=>e.string(t).raw(n)});a({name:"facilitator.invis-mode",description:"The server confirms the player's ghost mode.",direction:"toClient",command:"fi",read:e=>({invisible:e.flag("invisible")}),write:(e,{invisible:t})=>e.flag(t)});a({name:"facilitator.report-request",description:"The player reports someone.",direction:"toServer",command:"fr",read:e=>({userName:e.string("userName"),reasonId:e.int("reasonId")}),write:(e,{userName:t,reasonId:n})=>e.string(t).int(n)});a({name:"facilitator.report-result",description:"The server confirms a report.",direction:"toClient",command:"fr",read:e=>({success:e.flag("success")}),write:(e,{success:t})=>e.flag(t)});a({name:"facilitator.report-with-data-request",description:"The player reports someone over something specific they sent.",direction:"toServer",command:"fra",read:e=>({userName:e.string("userName"),reasonId:e.int("reasonId"),dataType:e.int("dataType"),data:e.string("data")}),write:(e,{userName:t,reasonId:n,dataType:r,data:i})=>e.string(t).int(n).int(r).string(i)});a({name:"facilitator.report-with-data-result",description:"The server confirms a report with content attached.",direction:"toClient",command:"fra",read:e=>({success:e.flag("success")}),write:(e,{success:t})=>e.flag(t)});function ct(e){let t="";for(const n of e)t+=dt[n]??n;return t}const dt={"&":"&","<":"<",">":">","'":"'",'"':"""},oe=100;a({name:"currency.update",description:"One or more of the player’s balances changed.",direction:"toClient",command:"cu",read:e=>{const t=e.int("currency"),n=t===oe?mt(e.string("balances")):[{currency:t,amount:e.int("amount")}],r=e.remaining>0?e.int("reason"):null;return{currency:t,balances:n,reason:r,extra:e.rest()}},write:(e,{currency:t,balances:n,reason:r,extra:i})=>{var o;e.int(t),t===oe?e.string(n.map(({currency:s,amount:c})=>`${s}x${c}`).join(",")):e.int(((o=n[0])==null?void 0:o.amount)??0),r!==null&&e.int(r),e.raw(i)}});function mt(e){return e===""?[]:e.split(",").map(t=>{const n=t.split("x"),[r="",i=""]=n,o=Number(r),s=Number(i),c=r.trim()===""||i.trim()==="";if(n.length!==2||c||!Number.isInteger(o)||!Number.isInteger(s))throw new u(`currency.update: field "balances" has "${t}", not <currency>x<amount>`,"PACKET_FIELD");return{currency:o,amount:s}})}a({name:"currency.donate",description:"The player donates gems.",direction:"toServer",command:"cd",read:e=>({amount:e.int("amount")}),write:(e,{amount:t})=>e.int(t)});a({name:"currency.donate-result",description:"The server says whether the donation went through.",direction:"toClient",command:"cd",read:e=>({success:e.string("result")==="1",extra:e.rest()}),write:(e,{success:t,extra:n})=>e.string(t?"1":"0").raw(n)});a({name:"currency.exchange",description:"The player exchanges one currency for another at a shop.",direction:"toServer",command:"ce",read:e=>({shopId:e.int("shopId"),exchangeDefId:e.int("exchangeDefId")}),write:(e,{shopId:t,exchangeDefId:n})=>e.int(t).int(n)});a({name:"currency.exchange-result",description:"The server says whether the exchange went through.",direction:"toClient",command:"ce",read:e=>({success:e.string("result")==="1",balance:e.remaining>0?e.string("balance"):"",extra:e.rest()}),write:(e,{success:t,balance:n,extra:r})=>e.string(t?"1":"0").string(n).raw(r)});a({name:"currency.redeem-code",description:"The player redeems a code.",direction:"toServer",command:"grc",read:e=>({code:e.string("code"),captchaQuestion:e.string("captchaQuestion"),captchaAnswer:e.string("captchaAnswer")}),write:(e,{code:t,captchaQuestion:n,captchaAnswer:r})=>e.string(t).string(n).string(r)});a({name:"currency.redeem-code-result",description:"The server says what a redeemed code came to.",direction:"toClient",command:"grc",read:e=>{const t=e.string("result"),n=e.remaining>0?e.string("details"):"",r=e.remaining>0?e.string("hasGiftsElsewhere")==="1":!1;return{result:t,details:ut(n),hasGiftsElsewhere:r,extra:e.rest()}},write:(e,{result:t,details:n,hasGiftsElsewhere:r,extra:i})=>e.string(t).string(n===null?"":JSON.stringify(n)).string(r?"1":"0").raw(i)});function ut(e){if(e==="")return null;try{return JSON.parse(e)}catch{throw new u(`currency.redeem-code-result: field "details" is not JSON ("${e}")`,"PACKET_FIELD")}}a({name:"currency.membership-redeemed",description:"A membership was redeemed on the account.",direction:"toClient",command:"grm",read:e=>{const t=e.int("result");return t!==1?{result:t,accountType:null,daysLeft:null,sourceType:null,extra:e.rest()}:{result:t,accountType:e.int("accountType"),daysLeft:e.int("daysLeft"),sourceType:e.string("sourceType"),extra:e.rest()}},write:(e,{result:t,accountType:n,daysLeft:r,sourceType:i,extra:o})=>{e.int(t),t===1&&e.int(n??0).int(r??0).string(i??""),e.raw(o)}});a({name:"den.join-request",description:"The player asks to join a den.",direction:"toServer",command:"dj",read:e=>({denName:e.string("denName"),confirmLanguageChange:e.flag("confirmLanguageChange"),doorItem:e.int("doorItem")}),write:(e,{denName:t,confirmLanguageChange:n,doorItem:r})=>e.string(t).flag(n).int(r)});a({name:"den.privacy-request",description:"The player sets their den’s privacy, or asks for someone else’s.",direction:"toServer",command:"dp",read:e=>({query:e.flag("lookup")?{request:"lookup",userName:e.string("userName")}:{request:"set",privacy:e.int("privacy")}}),write:(e,{query:t})=>{t.request==="lookup"?e.flag(!0).string(t.userName):e.flag(!1).int(t.privacy)}});a({name:"den.privacy-result",description:"The server says who may come into someone’s den.",direction:"toClient",command:"dp",read:e=>({userName:e.string("userName"),privacy:e.int("privacy")}),write:(e,{userName:t,privacy:n})=>e.string(t).int(n)});a({name:"den.kicked",description:"The player was sent out of a den its owner locked.",direction:"toClient",command:"dpk",read:()=>({}),write:()=>{}});a({name:"den.visitor-count",description:"Someone came into or left the player's den, by username, and how many are in it.",direction:"toClient",command:"drc",read:e=>({count:e.int("count"),entering:e.flag("entering"),userName:e.string("userName")}),write:(e,{count:t,entering:n,userName:r})=>e.int(t).flag(n).string(r)});a({name:"den.room-list-request",description:"The player asks for their den rooms.",direction:"toServer",command:"dl",read:()=>({}),write:()=>{}});a({name:"den.room-list",description:"The server lists the player’s den rooms.",direction:"toClient",command:"dl",read:e=>({rooms:e.repeat(e.int("count"),()=>({invIdx:e.int("invIdx"),defId:e.int("defId")}))}),write:(e,{rooms:t})=>e.int(t.length).each(t,({invIdx:n,defId:r})=>e.int(n).int(r))});a({name:"den.change-request",description:"The player switches to another of their den rooms.",direction:"toServer",command:"dc",read:e=>({invIdx:e.int("invIdx")}),write:(e,{invIdx:t})=>e.int(t)});a({name:"den.change-result",description:"The server says which den room the player switched to.",direction:"toClient",command:"dc",read:e=>{const t=e.int("denRoomDefId"),n=e.remaining>=2;return{denRoomDefId:t,perUserAvId:n?e.int("perUserAvId"):null,activePetInvId:n?e.int("activePetInvId"):null,extra:e.rest()}},write:(e,{denRoomDefId:t,perUserAvId:n,activePetInvId:r,extra:i})=>{e.int(t),n!==null&&r!==null&&e.int(n).int(r),e.raw(i)}});a({name:"den.masterpiece-items-request",description:"The player asks for every masterpiece placed in someone’s den.",direction:"toServer",command:"dmi",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"den.masterpiece-items",description:"The server lists every masterpiece placed in a den.",direction:"toClient",command:"dmi",read:e=>({items:e.repeat(e.int("count"),()=>({defId:e.int("defId"),invIdx:e.int("invIdx"),version:e.int("version"),approved:e.string("approved")!=="",uniqueImageId:e.string("uniqueImageId"),uniqueImageCreatorDbId:e.int("uniqueImageCreatorDbId"),uniqueImageCreatorUUID:e.string("uniqueImageCreatorUUID")}))}),write:(e,{items:t})=>e.int(t.length).each(t,n=>e.int(n.defId).int(n.invIdx).int(n.version).string(n.approved?"1":"").string(n.uniqueImageId).int(n.uniqueImageCreatorDbId).string(n.uniqueImageCreatorUUID))});a({name:"den.masterpiece-creator-request",description:"The player asks who drew a masterpiece.",direction:"toServer",command:"dmc",read:e=>({denUserName:e.string("denUserName"),uniqueImageId:e.string("uniqueImageId")}),write:(e,{denUserName:t,uniqueImageId:n})=>e.string(t).string(n)});a({name:"den.masterpiece-creator",description:"The server names who drew a masterpiece.",direction:"toClient",command:"dmc",read:e=>({creatorName:e.string("creatorName")}),write:(e,{creatorName:t})=>e.string(t)});function ht(e){return{baseColor:e.int("baseColor"),patternColor:e.int("patternColor"),patternDefId:e.int("patternDefId"),eyeColor:e.int("eyeColor"),eyeDefId:e.int("eyeDefId")}}function pt(e,t){e.int(t.baseColor).int(t.patternColor).int(t.patternDefId).int(t.eyeColor).int(t.eyeDefId)}function gt(e){return{...ht(e),tailInvId:e.int("tailInvId"),legInvId:e.int("legInvId"),backInvId:e.int("backInvId"),neckInvId:e.int("neckInvId"),headInvId:e.int("headInvId")}}function lt(e,t){pt(e,t),e.int(t.tailInvId).int(t.legInvId).int(t.backInvId).int(t.neckInvId).int(t.headInvId)}a({name:"den.items-request",description:"The player asks for every den item they own.",direction:"toServer",command:"di",read:()=>({}),write:()=>{}});a({name:"den.items",description:"The server lists every den item the player owns.",direction:"toClient",command:"di",read:e=>({activeDenIdx:e.int("activeDenIdx"),itemCount:e.int("itemCount"),petCount:e.int("petCount"),details:e.rest()}),write:(e,{activeDenIdx:t,itemCount:n,petCount:r,details:i})=>e.int(t).int(n).int(r).raw(i)});a({name:"den.state",description:"The server says what is placed in the den on screen.",direction:"toClient",command:"ds",read:e=>({itemCount:e.int("itemCount"),petCount:e.int("petCount"),forceReload:e.string("forceReload")==="1",details:e.rest()}),write:(e,{itemCount:t,petCount:n,forceReload:r,details:i})=>e.int(t).int(n).string(r?"1":"0").raw(i)});const se={baseColor:0,patternColor:0,patternDefId:0,eyeColor:0,eyeDefId:0,tailInvId:0,legInvId:0,backInvId:0,neckInvId:0,headInvId:0};a({name:"den.state-save",description:"The player saves changes to their den.",direction:"toServer",command:"ds",read:e=>({changes:e.repeat(e.int("count"),()=>{const t=e.int("refId"),n=e.int("invIdx"),r=e.flag("placed"),i=e.int("x"),o=e.int("y"),s=e.int("flipped"),c=e.string("userNameLink"),m=gt(e),d=Object.keys(se).every(h=>m[h]===0);return{refId:t,invIdx:n,placed:r,x:i,y:o,flipped:s,userNameLink:c==="off"?"":c,mannequin:d?null:m}})}),write:(e,{changes:t})=>{e.int(t.length);for(const n of t)e.int(n.refId).int(n.invIdx).flag(n.placed).int(n.x).int(n.y).int(n.flipped).string(n.userNameLink===""?"off":n.userNameLink),lt(e,n.mannequin??se)}});a({name:"den.state-saved",description:"The server says which den items it saved.",direction:"toClient",command:"dss",read:e=>({invIdxs:e.repeat(e.remaining,()=>e.int("invIdx"))}),write:(e,{invIdxs:t})=>e.each(t,n=>e.int(n))});a({name:"den.buy-request",description:"The player buys a den item or a den room.",direction:"toServer",command:"db",read:e=>{const t=e.string("kind")==="-1",n=e.int("shopId"),r=e.int("defId");return t?{order:{kind:"den-room",shopId:n,defId:r,denSlot:e.int("denSlot"),diamond:e.flag("diamond")}}:{order:{kind:"den-item",shopId:n,defId:r,version:e.int("version"),diamond:e.flag("diamond"),masterpiece:e.flag("masterpiece"),usingTokens:e.flag("usingTokens"),masterpieceUuid:e.string("masterpieceUuid")}}},write:(e,{order:t})=>{if(t.kind==="den-room"){e.string("-1").int(t.shopId).int(t.defId).int(t.denSlot).flag(t.diamond);return}e.string("0").int(t.shopId).int(t.defId).int(t.version).flag(t.diamond).flag(t.masterpiece).flag(t.usingTokens).string(t.masterpieceUuid)}});a({name:"den.buy-result",description:"The server says whether a den item or den room was bought.",direction:"toClient",command:"db",read:e=>({status:e.int("status"),balance:e.string("balance"),unused:e.string("unused"),currencyType:e.int("currencyType"),invIdx:e.int("invIdx"),extra:e.rest()}),write:(e,{status:t,balance:n,unused:r,currencyType:i,invIdx:o,extra:s})=>e.int(t).string(n).string(r).int(i).int(o).raw(s)});a({name:"den.recycle-request",description:"The player sells den items or den rooms back to the game.",direction:"toServer",command:"dr",read:e=>{const t=e.string("kind")==="-1",n=e.string("invIdxs");return{rooms:t,invIdxs:n===""?[]:n.split(",").map(vt)}},write:(e,{rooms:t,invIdxs:n})=>e.string(t?"-1":"0").string(n.join(","))});function vt(e){return new C([e],"den.recycle-request").int("invIdxs")}a({name:"den.recycle-result",description:"The server says which den items or rooms were sold.",direction:"toClient",command:"dr",read:e=>{const t=e.int("count");return{gems:e.int("gems"),invIdxs:e.repeat(t,()=>e.int("invIdx"))}},write:(e,{gems:t,invIdxs:n})=>e.int(n.length).int(t).each(n,r=>e.int(r))});a({name:"den.empty-request",description:"The player clears everything out of their den.",direction:"toServer",command:"de",read:()=>({}),write:()=>{}});a({name:"den.emptied",description:"The server says the den was cleared.",direction:"toClient",command:"de",read:e=>({extra:e.rest()}),write:(e,{extra:t})=>e.raw(t)});a({name:"den.epic-dens-request",description:"The player asks for the epic dens the world map lists.",direction:"toServer",command:"dh",read:()=>({}),write:()=>{}});a({name:"den.epic-dens",description:"The server lists the epic dens, by owner.",direction:"toClient",command:"dh",read:e=>({userNames:e.repeat(e.int("count"),()=>e.string("userName"))}),write:(e,{userNames:t})=>e.int(t.length).each(t,n=>e.string(n))});a({name:"den.phantom-request",description:"The player turns into a phantom, or back.",direction:"toServer",command:"dph",read:e=>({phantom:e.flag("phantom")}),write:(e,{phantom:t})=>e.flag(t)});a({name:"den.phantom",description:"Someone in the den turned into a phantom, or back.",direction:"toClient",command:"dph",read:e=>{const t=e.string("success")==="1";return{success:t,userId:t?e.int("userId"):null,phantom:t?e.string("phantom")==="1":!1,extra:e.rest()}},write:(e,{success:t,userId:n,phantom:r,extra:i})=>{e.string(t?"1":"0"),t&&e.int(n??0).string(r?"1":"0"),e.raw(i)}});a({name:"den.eco-state-request",description:"The player asks for the den’s eco system.",direction:"toServer",command:"dEf",read:()=>({}),write:()=>{}});a({name:"den.eco-state",description:"The server describes the den’s eco system.",direction:"toClient",command:"dEf",read:e=>({numActiveWindTurbines:e.int("numActiveWindTurbines"),numActiveSolarPanels:e.int("numActiveSolarPanels"),numConsumerItems:e.int("numConsumerItems"),ecoPowerGeneration:e.int("ecoPowerGeneration"),ecoPowerConsumption:e.int("ecoPowerConsumption"),ecoScoreRequired:e.int("ecoScoreRequired"),nextRewardBitIndex:e.int("nextRewardBitIndex"),unredeemedEcoCredits:e.int("unredeemedEcoCredits"),secondsUntilNextEcoCredit:e.int("secondsUntilNextEcoCredit")}),write:(e,t)=>e.int(t.numActiveWindTurbines).int(t.numActiveSolarPanels).int(t.numConsumerItems).int(t.ecoPowerGeneration).int(t.ecoPowerConsumption).int(t.ecoScoreRequired).int(t.nextRewardBitIndex).int(t.unredeemedEcoCredits).int(t.secondsUntilNextEcoCredit)});a({name:"den.eco-redeem-request",description:"The player redeems the den’s eco credits.",direction:"toServer",command:"dEr",read:()=>({}),write:()=>{}});a({name:"den.eco-redeem-result",description:"The server says whether the den’s eco credits were redeemed.",direction:"toClient",command:"dEr",read:e=>({redeemed:e.string("redeemed")==="1",secondsUntilNextEcoCredit:e.remaining>0?e.int("secondsUntilNextEcoCredit"):null}),write:(e,{redeemed:t,secondsUntilNextEcoCredit:n})=>{e.string(t?"1":"0"),n!==null&&e.int(n)}});a({name:"den.eco-consumer-request",description:"The player turns one of the den’s eco items on or off.",direction:"toServer",command:"dEc",read:e=>({invIdx:e.int("invIdx"),online:e.flag("online")}),write:(e,{invIdx:t,online:n})=>e.int(t).flag(n)});a({name:"den.eco-consumer-result",description:"The server says which of the den’s eco items are on.",direction:"toClient",command:"dEc",read:e=>({ecoPointsConsumed:e.int("ecoPointsConsumed"),ecoScore:e.int("ecoScore"),consumers:e.repeat(e.int("count"),()=>({invIdx:e.int("invIdx"),stateId:e.int("stateId")}))}),write:(e,{ecoPointsConsumed:t,ecoScore:n,consumers:r})=>e.int(t).int(n).int(r.length).each(r,({invIdx:i,stateId:o})=>e.int(i).int(o))});a({name:"ecard.list-request",description:"The player asks for their jam-a-grams.",direction:"toServer",command:"el",read:e=>({interactive:e.flag("interactive")}),write:(e,{interactive:t})=>e.flag(t)});a({name:"ecard.list",description:"The server sends the player’s jam-a-grams.",direction:"toClient",command:"el",read:e=>{const t=e.int("count");return{cards:e.repeat(Math.max(t,0),()=>Ae(e))}},write:(e,{cards:t})=>{e.int(t.length),t.forEach(n=>fe(e,n))}});a({name:"ecard.received",description:"The player receives a jam-a-gram.",direction:"toClient",command:"ep",read:e=>({card:Ae(e)}),write:(e,{card:t})=>fe(e,t)});a({name:"ecard.send",description:"The player sends a jam-a-gram.",direction:"toServer",command:"es",read:e=>({userName:e.string("userName"),cardMediaId:e.int("cardMediaId"),stampMediaId:e.int("stampMediaId"),messageType:e.int("messageType"),message:e.string("message"),type:e.int("type"),giftInvIdx:e.int("giftInvIdx"),specialType:e.int("specialType")}),write:(e,t)=>e.string(t.userName).int(t.cardMediaId).int(t.stampMediaId).int(t.messageType).string(t.message).int(t.type).int(t.giftInvIdx).int(t.specialType)});a({name:"ecard.send-result",description:"The server says whether a jam-a-gram was sent.",direction:"toClient",command:"es",read:e=>({result:e.int("result")}),write:(e,{result:t})=>e.int(t)});a({name:"ecard.read",description:"The player opens a jam-a-gram.",direction:"toServer",command:"er",read:e=>({messageId:e.int("messageId")}),write:(e,{messageId:t})=>e.int(t)});a({name:"ecard.read-result",description:"The server says whether a jam-a-gram was marked read.",direction:"toClient",command:"er",read:e=>({messageId:e.int("messageId"),success:e.string("success")==="1"}),write:(e,{messageId:t,success:n})=>e.int(t).flag(n)});a({name:"ecard.delete",description:"The player deletes a jam-a-gram.",direction:"toServer",command:"ed",read:e=>({messageId:e.int("messageId")}),write:(e,{messageId:t})=>e.int(t)});a({name:"ecard.delete-result",description:"The server says which jam-a-grams were deleted.",direction:"toClient",command:"ed",read:e=>({success:e.string("success")==="1",messageIds:e.repeat(e.int("count"),()=>e.int("messageId"))}),write:(e,{success:t,messageIds:n})=>{e.flag(t).int(n.length),n.forEach(r=>e.int(r))}});a({name:"ecard.gift",description:"The player accepts or discards a jam-a-gram’s gift.",direction:"toServer",command:"eg",read:e=>({messageId:e.int("messageId"),accept:e.flag("accept"),option:e.remaining>0?e.int("option"):null}),write:(e,{messageId:t,accept:n,option:r})=>{e.int(t).flag(n),r!==null&&e.int(r)}});a({name:"ecard.gift-result",description:"The server says whether a jam-a-gram’s gift was accepted or discarded.",direction:"toClient",command:"eg",read:e=>({messageId:e.int("messageId"),success:e.string("success")==="1"}),write:(e,{messageId:t,success:n})=>e.int(t).flag(n)});a({name:"ecard.update",description:"The server changes a jam-a-gram’s message.",direction:"toClient",command:"eu",read:e=>({messageId:e.int("messageId"),message:e.string("message")}),write:(e,{messageId:t,message:n})=>e.int(t).string(n)});a({name:"ecard.privacy",description:"The player changes who may send them jam-a-grams.",direction:"toServer",command:"ei",read:e=>({setting:e.int("setting")}),write:(e,{setting:t})=>e.int(t)});a({name:"ecard.privacy-result",description:"The server says whether the jam-a-gram privacy setting changed.",direction:"toClient",command:"ei",read:e=>({success:e.string("success")==="1"}),write:(e,{success:t})=>e.flag(t)});a({name:"ecard.buddy-answer",description:"The player accepts or declines the buddy request a jam-a-gram carries.",direction:"toServer",command:"eb",read:e=>({messageId:e.int("messageId"),accept:e.flag("accept")}),write:(e,{messageId:t,accept:n})=>e.int(t).flag(n)});a({name:"ecard.buddy-answer-result",description:"The server answers the player’s reply to a jam-a-gram’s buddy request.",direction:"toClient",command:"eb",read:e=>({result:e.int("result")}),write:(e,{result:t})=>e.int(t)});a({name:"ecard.clear-cache",description:"The player asks the server to drop its cached jam-a-gram inbox.",direction:"toServer",command:"ec",read:()=>({}),write:()=>{}});function Ae(e){return{messageId:e.int("messageId"),senderUserName:e.string("senderUserName"),cardMediaId:e.int("cardMediaId"),stampMediaId:e.int("stampMediaId"),read:e.string("read")==="1",message:e.string("message"),type:e.int("type"),giftId:e.int("giftId"),giftColor:e.int("giftColor"),giftName:e.string("giftName"),senderAccountType:e.int("senderAccountType"),senderNameBarData:e.int("senderNameBarData"),secondaryType:e.int("secondaryType"),senderType:e.int("senderType"),userNameModerationFlag:e.int("userNameModerationFlag"),additionalGiftData:e.string("additionalGiftData"),specialType:e.int("specialType")}}function fe(e,t){e.int(t.messageId).string(t.senderUserName).int(t.cardMediaId).int(t.stampMediaId).flag(t.read).string(t.message).int(t.type).int(t.giftId).int(t.giftColor).string(t.giftName).int(t.senderAccountType).int(t.senderNameBarData).int(t.secondaryType).int(t.senderType).int(t.userNameModerationFlag).string(t.additionalGiftData).int(t.specialType)}a({name:"item.list-request",description:"The client asks for an avatar’s items.",direction:"toServer",command:"il",read:e=>({userName:e.string("userName"),perUserAvId:e.int("perUserAvId"),full:e.flag("full")}),write:(e,{userName:t,perUserAvId:n,full:r})=>e.string(t).int(n).flag(r)});a({name:"item.list",description:"The server lists or changes an avatar’s items.",direction:"toClient",command:"il",read:e=>{const t=e.string("type");if(t==="-1")return{kind:"failed",extra:e.rest()};if(t==="0"||t==="1"){const l={unused:e.string("unused"),perUserAvId:e.int("perUserAvId"),userName:e.string("userName"),eyesDefId:e.int("eyesDefId"),patternDefId:e.int("patternDefId")},g=e.int("count"),P=g>0&&e.remaining===g*5,Me=e.repeat(g,()=>It(e,P));return{kind:t==="0"?"inventory":"worn",...l,items:Me}}const n=t==="3",r=e.string("wear")==="1",i=e.int("perUserAvId"),o=e.string("userName"),s=e.int("color")>>>0,c=e.int("added"),m=e.int("removed"),d=e.repeat(c,()=>({invId:e.int("invId"),defId:e.int("defId")})),h=e.repeat(m,()=>e.int("invId"));return{kind:"changed",wornOnly:n,wear:r,perUserAvId:i,userName:o,color:s,added:d,removed:h}},write:(e,t)=>{if(t.kind==="failed"){e.string("-1").raw(t.extra);return}if(t.kind==="changed"){e.string(t.wornOnly?"3":"2").string(t.wear?"1":"0").int(t.perUserAvId).string(t.userName).int(t.color>>>0).int(t.added.length).int(t.removed.length).each(t.added,({invId:n,defId:r})=>e.int(n).int(r)).each(t.removed,n=>e.int(n));return}e.string(t.kind==="inventory"?"0":"1").string(t.unused).int(t.perUserAvId).string(t.userName).int(t.eyesDefId).int(t.patternDefId).int(t.items.length).each(t.items,n=>{e.int(n.defId).int(n.invId).int(n.color>>>0),n.equippedAvatars!==null&&e.string(n.equippedAvatars).int(n.denStoreInvId??0)})}});function It(e,t){const n=e.int("defId"),r=e.int("invId"),i=e.int("color")>>>0;return t?{defId:n,invId:r,color:i,equippedAvatars:e.string("equippedAvatars"),denStoreInvId:e.int("denStoreInvId")}:{defId:n,invId:r,color:i,equippedAvatars:null,denStoreInvId:null}}a({name:"item.use",description:"The player puts items on and takes items off.",direction:"toServer",command:"iu",read:e=>{const t=e.int("wearCount"),n=e.int("removeCount");return{wear:e.repeat(t,()=>e.int("invId")),remove:e.repeat(n,()=>e.int("invId"))}},write:(e,{wear:t,remove:n})=>e.int(t.length).int(n.length).each(t,r=>e.int(r)).each(n,r=>e.int(r))});a({name:"item.use-result",description:"The server says whether the player’s items changed.",direction:"toClient",command:"iu",read:e=>({success:e.string("success")==="1",extra:e.rest()}),write:(e,{success:t,extra:n})=>e.string(t?"1":"0").raw(n)});a({name:"item.buy",description:"The player buys an item.",direction:"toServer",command:"ib",read:e=>({shopId:e.int("shopId"),quantity:e.int("quantity"),defId:e.int("defId"),colorIndex:e.int("colorIndex"),diamond:e.flag("diamond"),targetInvId:e.int("targetInvId"),targetUserName:e.string("targetUserName")}),write:(e,t)=>e.int(t.shopId).int(t.quantity).int(t.defId).int(t.colorIndex).flag(t.diamond).int(t.targetInvId).string(t.targetUserName)});a({name:"item.buy-result",description:"The server says whether an item was bought.",direction:"toClient",command:"ib",read:e=>{const t=e.int("status"),n=e.int("shopId"),r=e.string("balance"),i=r===""?null:Number(r);return{status:t,shopId:n,balance:i,currencyType:e.int("currencyType"),extra:e.rest()}},write:(e,{status:t,shopId:n,balance:r,currencyType:i,extra:o})=>e.int(t).int(n).string(r===null?"":String(r)).int(i).raw(o)});a({name:"item.recycle",description:"The player recycles items.",direction:"toServer",command:"ir",read:e=>({invIds:e.repeat(e.remaining,()=>e.int("invId"))}),write:(e,{invIds:t})=>e.each(t,n=>e.int(n))});a({name:"item.recycle-result",description:"The server says which items were recycled.",direction:"toClient",command:"ir",read:e=>{const t=e.int("count");return{gems:e.int("gems"),invIds:e.repeat(t,()=>e.int("invId"))}},write:(e,{gems:t,invIds:n})=>e.int(n.length).int(t).each(n,r=>e.int(r))});a({name:"item.diamond-bundle-buy",description:"The player buys the bundle shop’s whole bundle for diamonds.",direction:"toServer",command:"id",read:e=>({shopId:e.int("shopId")}),write:(e,{shopId:t})=>e.int(t)});a({name:"item.diamond-bundle-buy-result",description:"The server says whether the bundle shop’s whole bundle was bought.",direction:"toClient",command:"id",read:e=>({bought:e.string("bought")==="true",balance:e.remaining>0?e.int("balance"):null,extra:e.rest()}),write:(e,{bought:t,balance:n,extra:r})=>{e.string(t?"true":"false"),n!==null&&e.int(n),e.raw(r)}});a({name:"item.prize",description:"The server offers the player a prize.",direction:"toClient",command:"ip",read:e=>({userVarId:e.int("userVarId"),isClothing:e.string("isClothing")==="1",defId:e.int("defId"),nameStrId:e.int("nameStrId"),descStrId:e.int("descStrId"),color:e.number("color"),extra:e.rest()}),write:(e,{userVarId:t,isClothing:n,defId:r,nameStrId:i,descStrId:o,color:s,extra:c})=>e.int(t).string(n?"1":"0").int(r).int(i).int(o).number(s).raw(c)});const yt=["hc","pf","mo","as","ul"];a({name:"minigame.info-request",description:"The client asks the server to describe minigames.",direction:"toServer",command:"mi",read:e=>({gameDefIds:e.repeat(e.remaining,()=>e.int("gameDefId"))}),write:(e,{gameDefIds:t})=>e.each(t,n=>e.int(n))});a({name:"minigame.join",description:"The player asks to play a minigame.",direction:"toServer",command:"mj",read:e=>({gameDefId:e.int("gameDefId"),multiplayer:e.flag("multiplayer"),proModeId:e.int("proModeId"),hostUserId:e.int("hostUserId")}),write:(e,{gameDefId:t,multiplayer:n,proModeId:r,hostUserId:i})=>e.int(t).flag(n).int(r).int(i)});a({name:"minigame.start-request",description:"The player starts a waiting minigame now.",direction:"toServer",command:"ms",read:e=>({gameDefId:e.int("gameDefId")}),write:(e,{gameDefId:t})=>e.int(t)});a({name:"minigame.leave",description:"The player leaves an in-room minigame.",direction:"toServer",command:"ml",read:()=>({}),write:()=>{}});a({name:"minigame.send",description:"A minigame sends its own message to the server.",direction:"toServer",command:"mm",read:e=>({gameDefId:e.int("gameDefId"),data:e.rest()}),write:(e,{gameDefId:t,data:n})=>e.int(t).raw(n)});a({name:"minigame.pvp",description:"The player challenges, accepts, or turns down a two player game.",direction:"toServer",command:"mp",read:e=>({gameDefId:e.int("gameDefId"),action:e.int("action"),userName:e.remaining>0?e.string("userName"):""}),write:(e,{gameDefId:t,action:n,userName:r})=>{e.int(t).int(n),r!==""&&e.string(r)}});a({name:"minigame.custom-pvp-join",description:"The player joins a two player game another player set up.",direction:"toServer",command:"mcp",read:e=>({gameDefId:e.int("gameDefId"),action:e.int("action"),userName:e.string("userName")}),write:(e,{gameDefId:t,action:n,userName:r})=>e.int(t).int(n).string(r)});a({name:"minigame.leaderboard-request",description:"The client asks for a minigame’s leaderboard.",direction:"toServer",command:"mlb",read:e=>({gameDefId:e.int("gameDefId")}),write:(e,{gameDefId:t})=>e.int(t)});a({name:"minigame.info",description:"The server describes minigames.",direction:"toClient",command:"mi",read:e=>({games:e.repeat(e.int("count"),()=>({gameDefId:e.int("gameDefId"),titleStrId:e.int("titleStrId"),extName:e.string("extName"),swfName:e.string("swfName"),minPlayers:e.int("minPlayers"),maxPlayers:e.int("maxPlayers"),maxSpectators:e.int("maxSpectators"),type:e.int("type"),gameCardMediaId:e.int("gameCardMediaId"),gameCountUserVarRef:e.int("gameCountUserVarRef"),custom1UserVarRef:e.int("custom1UserVarRef"),custom2UserVarRef:e.int("custom2UserVarRef"),readyForPvp:e.flag("readyForPvp"),gemMultiplier:e.number("gemMultiplier"),petDefId:e.int("petDefId"),proModeUserVarRefId:e.int("proModeUserVarRefId"),leaderboardUserVarRef:e.int("leaderboardUserVarRef"),gameLibraryIconMediaId:e.int("gameLibraryIconMediaId"),requiredAvatarType:e.int("requiredAvatarType")}))}),write:(e,{games:t})=>e.int(t.length).each(t,n=>e.int(n.gameDefId).int(n.titleStrId).string(n.extName).string(n.swfName).int(n.minPlayers).int(n.maxPlayers).int(n.maxSpectators).int(n.type).int(n.gameCardMediaId).int(n.gameCountUserVarRef).int(n.custom1UserVarRef).int(n.custom2UserVarRef).flag(n.readyForPvp).number(n.gemMultiplier).int(n.petDefId).int(n.proModeUserVarRefId).int(n.leaderboardUserVarRef).int(n.gameLibraryIconMediaId).int(n.requiredAvatarType))});a({name:"minigame.join-result",description:"The server seats the player in a minigame, or says why not.",direction:"toClient",command:"mj",read:e=>{if(e.remaining===0)return{joined:!0,refusal:null,waitingUserIds:[],detail:[]};const t=e.string("result"),n=yt.find(o=>o===t);if(n)return{joined:!1,refusal:n,waitingUserIds:[],detail:e.rest()};const r=new C([t],"minigame.join-result").int("userId"),i=e.repeat(e.remaining,()=>e.int("userId"));return{joined:!0,refusal:null,waitingUserIds:[r,...i],detail:[]}},write:(e,t)=>{t.joined?e.each(t.waitingUserIds,n=>e.int(n)):e.string(t.refusal).raw(t.detail)}});a({name:"minigame.started",description:"The minigame starts, with its players.",direction:"toClient",command:"ms",read:e=>({playerIds:e.repeat(e.int("playerCount"),()=>e.int("userId")),data:e.rest()}),write:(e,{playerIds:t,data:n})=>e.int(t.length).each(t,r=>e.int(r)).raw(n)});function L(e,t,n){return a({name:e,description:n,direction:"toClient",command:t,read:r=>({data:r.rest()}),write:(r,{data:i})=>r.raw(i)})}L("minigame.message","mm","A minigame’s own message from the server.");L("minigame.left","ml","A player left the minigame.");L("minigame.ended","me","The minigame ended.");L("minigame.room-removed","mr","The minigame’s room was removed.");a({name:"minigame.pvp-invite",description:"A player challenges the player to a two player game, or turns them down.",direction:"toClient",command:"mp",read:e=>{const t=e.int("gameDefId"),n=e.int("action");return n!==0?{gameDefId:t,action:n,userName:"",nameVisible:!1,extra:e.rest()}:{gameDefId:t,action:n,userName:e.string("userName"),nameVisible:e.int("nameVisible")>0,extra:e.rest()}},write:(e,{gameDefId:t,action:n,userName:r,nameVisible:i,extra:o})=>{e.int(t).int(n),n===0&&e.string(r).int(i?1:0),e.raw(o)}});a({name:"minigame.leaderboard",description:"The server gives a minigame’s leaderboard.",direction:"toClient",command:"mlb",read:e=>{const t=e.int("gameDefId");if(t===-1)return{gameDefId:t,allTime:[],thisWeek:[],buddies:[]};const n=()=>e.repeat(e.int("count"),()=>({name:e.string("name"),score:e.number("score")})),r=n(),i=n(),o=n();return{gameDefId:t,allTime:r,thisWeek:i,buddies:o}},write:(e,{gameDefId:t,allTime:n,thisWeek:r,buddies:i})=>{if(e.int(t),t!==-1)for(const o of[n,r,i])e.int(o.length).each(o,({name:s,score:c})=>e.string(s).number(c))}});a({name:"minigame.gems",description:"The server hands out the serial the next gem award is folded with.",direction:"toClient",command:"mg",read:e=>({serial:e.int("serial"),forScore:e.remaining>0?e.int("forScore")===1:!1}),write:(e,{serial:t,forScore:n})=>e.int(t).int(n?1:0)});a({name:"minigame.pet-mastery",description:"The server hands out the serial the next pet mastery award is folded with.",direction:"toClient",command:"ma",read:e=>({serial:e.int("serial"),showPopup:e.remaining>0?e.string("showPopup")==="1":!1}),write:(e,{serial:t,showPopup:n})=>e.int(t).string(n?"1":"0")});function De(e){return{amountSum:e.number("amountSum"),gameSum:e.number("gameSum"),checkSum:e.number("checkSum")}}function Ue(e,{amountSum:t,gameSum:n,checkSum:r}){return e.number(t).number(n).number(r)}a({name:"minigame.gem-award",description:"A minigame awards the player gems.",direction:"toServer",command:"mg",read:e=>De(e),write:(e,t)=>Ue(e,t)});a({name:"minigame.pet-mastery-award",description:"A minigame awards the active pet mastery points.",direction:"toServer",command:"ma",read:e=>De(e),write:(e,t)=>Ue(e,t)});a({name:"minigame.score",description:"A minigame reports the player’s score.",direction:"toServer",command:"msv",read:e=>({mainSum:e.number("mainSum"),valueSum:e.number("valueSum"),numSum:e.number("numSum"),varRefSum:e.number("varRefSum"),gameSum:e.number("gameSum")}),write:(e,{mainSum:t,valueSum:n,numSum:r,varRefSum:i,gameSum:o})=>e.number(t).number(n).number(r).number(i).number(o)});a({name:"party.list-request",description:"The player asks which parties are on.",direction:"toServer",command:"sl",read:()=>({}),write:()=>{}});a({name:"party.list",description:"The server lists Animal Jam’s parties.",direction:"toClient",command:"sl",read:e=>({unread:e.string("unread"),parties:e.repeat(e.int("count"),()=>({defId:e.int("defId"),secondsToStart:e.number("secondsToStart"),secondsToEnd:e.number("secondsToEnd")}))}),write:(e,{unread:t,parties:n})=>e.string(t).int(n.length).each(n,r=>e.int(r.defId).number(r.secondsToStart).number(r.secondsToEnd))});a({name:"party.join-request",description:"The player asks to join a party.",direction:"toServer",command:"sj",read:e=>({defId:e.int("defId")}),write:(e,{defId:t})=>e.int(t)});a({name:"party.join-result",description:"The server says a party could not be joined.",direction:"toClient",command:"sj",read:e=>{const t=e.flag("joined"),n=!t&&e.remaining>0?e.string("reason"):null;return{joined:t,reason:n,extra:e.rest()}},write:(e,{joined:t,reason:n,extra:r})=>{e.flag(t),n!==null&&e.string(n),e.raw(r)}});a({name:"party.custom-list-request",description:"The player asks which parties players are hosting.",direction:"toServer",command:"slp",read:e=>({start:e.int("start"),limit:e.int("limit")}),write:(e,{start:t,limit:n})=>e.int(t).int(n)});a({name:"party.custom-list",description:"The server lists the parties players are hosting.",direction:"toClient",command:"slp",read:e=>{const t=e.flag("unread"),n=e.int("total");if(n<=0)return{unread:t,total:n,skipped:null,parties:[]};const r=[e.int("skipped1"),e.int("skipped2")],i=e.repeat(e.int("count"),()=>({creatorUuid:e.string("creatorUuid"),name:e.string("name"),node:e.string("node"),defId:e.int("defId"),timeLeft:e.number("timeLeft")}));return{unread:t,total:n,skipped:r,parties:i}},write:(e,{unread:t,total:n,skipped:r,parties:i})=>{e.flag(t).int(n),!(n<=0)&&e.int((r==null?void 0:r[0])??0).int((r==null?void 0:r[1])??0).int(i.length).each(i,o=>e.string(o.creatorUuid).string(o.name).string(o.node).int(o.defId).number(o.timeLeft))}});a({name:"party.custom-join-request",description:"The player asks to join a party a player hosts.",direction:"toServer",command:"sjp",read:e=>({creatorUuid:e.string("creatorUuid")}),write:(e,{creatorUuid:t})=>e.string(t)});a({name:"party.custom-join-result",description:"The server says whether a hosted party could be joined.",direction:"toClient",command:"sjp",read:e=>{const t=e.string("joined")==="1",n=!t&&e.remaining>0?e.string("reason"):null;return{joined:t,reason:n,extra:e.rest()}},write:(e,{joined:t,reason:n,extra:r})=>{e.string(t?"1":"0"),n!==null&&e.string(n),e.raw(r)}});a({name:"party.custom-node-request",description:"The player asks which server a hosted party is on.",direction:"toServer",command:"spn",read:e=>({creatorUuid:e.string("creatorUuid")}),write:(e,{creatorUuid:t})=>e.string(t)});a({name:"party.custom-host-request",description:"The player asks to host a party of their own.",direction:"toServer",command:"scp",read:e=>({defId:e.int("defId"),nameStrIds:[e.int("nameStrId1"),e.int("nameStrId2"),e.int("nameStrId3")],audioDefId:e.int("audioDefId")}),write:(e,{defId:t,nameStrIds:n,audioDefId:r})=>e.int(t).int(n[0]).int(n[1]).int(n[2]).int(r)});a({name:"party.custom-hosting-request",description:"The player asks whether someone is hosting a party.",direction:"toServer",command:"sphp",read:e=>({creatorUuid:e.string("creatorUuid")}),write:(e,{creatorUuid:t})=>e.string(t)});a({name:"party.custom-hosting",description:"The server says how long someone has left hosting a party.",direction:"toClient",command:"sphp",read:e=>({secondsLeft:e.int("secondsLeft"),extra:e.rest()}),write:(e,{secondsLeft:t,extra:n})=>e.int(t).raw(n)});a({name:"party.masterpieces-request",description:"The player asks for the bulletin board’s masterpieces.",direction:"toServer",command:"sm",read:()=>({}),write:()=>{}});a({name:"party.masterpieces",description:"The server gives the bulletin board’s masterpieces.",direction:"toClient",command:"sm",read:e=>{const t=e.string("pool");return{json:t,pool:wt(t)}},write:(e,{json:t})=>e.string(t)});function wt(e){if(e==="")return[];let t;try{t=JSON.parse(e)}catch{throw new u(`party.masterpieces: field "pool" is not JSON ("${e}")`,"PACKET_FIELD")}return(ce(t)&&Array.isArray(t.pool)?t.pool:[]).filter(ce).map(r=>({frameId:Number(r.frameId)||0,resourceId:Number(r.resourceId)||0,userName:typeof r.userName=="string"?r.userName:"",creatorDbId:Number(r.creatorDBId)||0,creatorUuid:typeof r.creatorId=="string"?r.creatorId:"",raw:r}))}function ce(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a({name:"party.custom-host-result",description:"The server says whether the player may host a party.",direction:"toClient",command:"scp",read:e=>{const t=e.flag("hosting"),n={hosting:t,secondsLeft:null,reason:null};if(!t)return{...n,reason:e.string("reason")};const r=e.flag("stillHosting");return{...n,secondsLeft:r?e.int("secondsLeft"):null}},write:(e,{hosting:t,secondsLeft:n,reason:r})=>{if(e.flag(t),!t){e.string(r??"");return}e.flag(n!==null),n!==null&&e.int(n)}});a({name:"party.custom-killed",description:"The server ends the player’s hosted party from outside the client.",direction:"toClient",command:"spk",read:e=>({diamondsRefunded:e.int("diamondsRefunded")}),write:(e,{diamondsRefunded:t})=>e.int(t)});a({name:"party.custom-node",description:"The server says which server a hosted party is on.",direction:"toClient",command:"spn",read:e=>{const t=e.string("found")==="1",n=t?{creatorUuid:e.string("creatorUuid"),node:e.string("node")}:null;return{found:t,party:n,extra:e.rest()}},write:(e,{found:t,party:n,extra:r})=>{e.string(t?"1":"0"),t&&n&&e.string(n.creatorUuid).string(n.node),e.raw(r)}});a({name:"newspaper.page-seen-request",description:"The player marks a newspaper page seen.",direction:"toServer",command:"nps",read:e=>({defId:e.int("defId")}),write:(e,{defId:t})=>e.int(t)});a({name:"newspaper.page-seen",description:"The server confirms a newspaper page was marked seen.",direction:"toClient",command:"nps",read:e=>({defId:e.int("defId"),timeSeen:e.int("timeSeen")}),write:(e,{defId:t,timeSeen:n})=>e.int(t).int(n)});const N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function bt(e){const t=e.replace(/[\s=]/g,""),n=new Uint8Array(Math.floor(t.length*3/4));let r=0,i=0,o=0;for(const s of t){const c=N.indexOf(s);if(c===-1)throw new u(`"${s}" is not a Base64 character`,"PACKET_FIELD");r=r<<6|c,i+=6,i>=8&&(i-=8,n[o++]=r>>i&255)}return n.subarray(0,o)}function Tt(e){let t="";for(let n=0;n<e.length;n+=3){const r=e[n],i=e[n+1],o=e[n+2],s=r<<16|(i??0)<<8|(o??0);t+=N[s>>18&63]+N[s>>12&63],t+=i===void 0?"=":N[s>>6&63],t+=o===void 0?"=":N[s&63]}return t}class xt{constructor(t){this.bytes=t}bytes;position=0;readShort(){const n=this.byte()<<8|this.byte();return n>=32768?n-65536:n}readUTF(){const t=this.byte()<<8|this.byte(),n=this.position+t;n>this.bytes.length&&this.fail("A string runs past the end of the bytes");let r="";for(;this.position<n;){const i=this.byte();if(i<128)r+=String.fromCharCode(i);else if((i&224)===192)r+=String.fromCharCode((i&31)<<6|this.byte()&63);else if((i&240)===224){const o=this.byte();r+=String.fromCharCode((i&15)<<12|(o&63)<<6|this.byte()&63)}else this.fail("A string holds a byte modified UTF-8 never starts a character with")}return r}byte(){return this.position>=this.bytes.length&&this.fail("The bytes end early"),this.bytes[this.position++]}fail(t){throw new u(t,"PACKET_FIELD",this.position)}}class Ct{bytes=[];writeShort(t){return this.bytes.push(t>>8&255,t&255),this}writeUTF(t){const n=[];for(let r=0;r<t.length;r++){const i=t.charCodeAt(r);i>=1&&i<128?n.push(i):i<2048?n.push(192|i>>6,128|i&63):n.push(224|i>>12,128|i>>6&63,128|i&63)}if(n.length>65535)throw new u("A string is longer than writeUTF can write","PACKET_FIELD");return this.writeShort(n.length),this.bytes.push(...n),this}toBytes(){return Uint8Array.from(this.bytes)}}function Nt(e){const t=Math.max(1,Math.ceil(e.length/65535)),n=new Uint8Array(2+t*5+e.length+4);n[0]=120,n[1]=1;let r=2;for(let c=0;c<t;c++){const m=c*65535,d=Math.min(65535,e.length-m);n[r++]=c===t-1?1:0,n[r++]=d&255,n[r++]=d>>8,n[r++]=~d&255,n[r++]=~d>>8&255,n.set(e.subarray(m,m+d),r),r+=d}let i=1,o=0;for(const c of e)i=(i+c)%65521,o=(o+i)%65521;const s=(o<<16|i)>>>0;return n[r++]=s>>>24,n[r++]=s>>>16&255,n[r++]=s>>>8&255,n[r]=s&255,n}function qt(e){return e.length<2&&p("A zlib stream has a two byte header"),((e[0]&15)!==8||(e[0]<<8|e[1])%31!==0)&&p("Not a zlib stream of deflate data"),e[1]&32&&p("A zlib stream with a preset dictionary cannot be read"),kt(e.subarray(2))}const St=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],de=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],At=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],me=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ft=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function q(e){const t=new Uint16Array(16);for(let i=0;i<e.length;i++)t[e[i]]++;t[0]=0;const n=new Uint16Array(16);for(let i=1;i<16;i++)n[i]=n[i-1]+t[i-1];const r=new Uint16Array(e.length);for(let i=0;i<e.length;i++){const o=e[i];o!==0&&(r[n[o]++]=i)}return{counts:t,symbols:r}}let M=null;function Dt(){if(!M){const e=new Uint8Array(288);e.fill(8,0,144),e.fill(9,144,256),e.fill(7,256,280),e.fill(8,280,288),M={literals:q(e),distances:q(new Uint8Array(30).fill(5))}}return M}class Ut{constructor(t){this.bytes=t}bytes;position=0;bitBuffer=0;bitCount=0;bits(t){for(;this.bitCount<t;)this.position>=this.bytes.length&&p("The deflate data ends early"),this.bitBuffer|=this.bytes[this.position++]<<this.bitCount,this.bitCount+=8;const n=this.bitBuffer&(1<<t)-1;return this.bitBuffer>>>=t,this.bitCount-=t,n}align(){this.bitBuffer=0,this.bitCount=0}byte(){return this.position>=this.bytes.length&&p("The deflate data ends early"),this.bytes[this.position++]}decode(t){let n=0,r=0,i=0;for(let o=1;o<16;o++){i|=this.bits(1);const s=t.counts[o];if(i-n<s)return t.symbols[r+i-n];r+=s,n=n+s<<1,i<<=1}return p("The deflate data holds a code that is not in its table")}}class Et{bytes=new Uint8Array(1024);length=0;push(t){if(this.length===this.bytes.length){const n=new Uint8Array(this.bytes.length*2);n.set(this.bytes),this.bytes=n}this.bytes[this.length++]=t}}function kt(e){const t=new Ut(e),n=new Et;let r=!1;for(;!r;){r=t.bits(1)===1;const i=t.bits(2);if(i===0){t.align();const o=t.byte()|t.byte()<<8,s=t.byte()|t.byte()<<8;(o^65535)!==s&&p("A stored deflate block has a bad length");for(let c=0;c<o;c++)n.push(t.byte())}else if(i===1){const{literals:o,distances:s}=Dt();ue(t,n,o,s)}else if(i===2){const{literals:o,distances:s}=Bt(t);ue(t,n,o,s)}else p("A deflate block has the reserved type 3")}return n.bytes.slice(0,n.length)}function Bt(e){const t=e.bits(5)+257,n=e.bits(5)+1,r=e.bits(4)+4,i=new Uint8Array(19);for(let m=0;m<r;m++)i[St[m]]=e.bits(3);const o=q(i),s=new Uint8Array(t+n);let c=0;for(;c<s.length;){const m=e.decode(o);if(m<16){s[c++]=m;continue}let d,h=0;m===16?(c===0&&p("A deflate block repeats a code length before giving one"),h=s[c-1],d=3+e.bits(2)):m===17?d=3+e.bits(3):d=11+e.bits(7),c+d>s.length&&p("A deflate block has too many code lengths"),s.fill(h,c,c+d),c+=d}return{literals:q(s.subarray(0,t)),distances:q(s.subarray(t))}}function ue(e,t,n,r){for(;;){const i=e.decode(n);if(i<256)t.push(i);else{if(i===256)return;{const o=i-257;o>=de.length&&p("A deflate block has a bad length code");const s=de[o]+e.bits(At[o]),c=e.decode(r);c>=me.length&&p("A deflate block has a bad distance code");const m=me[c]+e.bits(ft[c]);m>t.length&&p("A deflate block points before its start");for(let d=0;d<s;d++)t.push(t.bytes[t.length-m])}}}}function p(e){throw new u(e,"PACKET_FIELD")}const Lt=200,Ee=16,jt=[11,23],Pt={setState:1},y={denItem:1,clothing:2,gems:3,crystals:4};a({name:"quest.join",description:"The player joins or creates a public adventure.",direction:"toServer",command:"qj",read:e=>({roomName:e.string("roomName"),scriptDefId:e.int("scriptDefId"),difficulty:e.int("difficulty"),reserved:e.int("reserved")}),write:(e,{roomName:t,scriptDefId:n,difficulty:r,reserved:i})=>e.string(t).int(n).int(r).int(i)});a({name:"quest.create-private",description:"The player creates a private adventure to host.",direction:"toServer",command:"qjc",read:e=>({roomName:e.string("roomName"),scriptDefId:e.int("scriptDefId"),difficulty:e.int("difficulty")}),write:(e,{roomName:t,scriptDefId:n,difficulty:r})=>e.string(t).int(n).int(r)});a({name:"quest.join-private",description:"The player joins a private adventure another player hosts.",direction:"toServer",command:"qjp",read:e=>({roomName:e.string("roomName"),hostUserName:e.string("hostUserName")}),write:(e,{roomName:t,hostUserName:n})=>e.string(t).string(n)});a({name:"quest.join-buddy",description:"The player joins the adventure a buddy is in.",direction:"toServer",command:"qjf",read:e=>({roomName:e.string("roomName"),buddyUserName:e.string("buddyUserName")}),write:(e,{roomName:t,buddyUserName:n})=>e.string(t).string(n)});a({name:"quest.join-cancel",description:"The player leaves an adventure lobby before it starts.",direction:"toServer",command:"qjx",read:()=>({}),write:()=>{}});a({name:"quest.kick",description:"The host removes a player from a private adventure lobby.",direction:"toServer",command:"qjk",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"quest.start",description:"The player starts the adventure they are waiting in.",direction:"toServer",command:"qs",read:e=>({roomName:e.string("roomName")}),write:(e,{roomName:t})=>e.string(t)});a({name:"quest.exit",description:"The player leaves the adventure.",direction:"toServer",command:"qx",read:e=>({exitType:e.string("exitType")}),write:(e,{exitType:t})=>e.string(t)});a({name:"quest.actor-trigger",description:"The player sets off an adventure actor, such as a treasure chest.",direction:"toServer",command:"qat",read:e=>({actorId:e.string("actorId"),value:e.int("value")}),write:(e,{actorId:t,value:n})=>e.string(t).int(n)});a({name:"quest.treasure-choice",description:"The player keeps or turns down a treasure chest’s prize.",direction:"toServer",command:"qatt",read:e=>({actorId:e.string("actorId"),keep:e.flag("keep")}),write:(e,{actorId:t,keep:n})=>e.string(t).flag(n)});a({name:"quest.pick-up",description:"The player picks up an item in an adventure.",direction:"toServer",command:"qpup",read:e=>({actorId:e.string("actorId"),userId:e.int("userId")}),write:(e,{actorId:t,userId:n})=>e.string(t).int(n)});function ke(e,t,n){return a({name:e,description:n,direction:"toServer",command:t,read:r=>({index:r.int("index"),belowGoal:r.flag("belowGoal"),discarded:r.flag("discarded")}),write:(r,{index:i,belowGoal:o,discarded:s})=>r.int(i).flag(o).flag(s)})}ke("quest.gift-choice","qpgift","The player picks a gift on an adventure’s reward screen.");ke("quest.player-gift-choice","qpgiftplr","The player picks a gift on their own reward screen.");a({name:"quest.gifts-done",description:"The player finished picking an adventure’s gifts.",direction:"toServer",command:"qpgiftdone",read:e=>({done:e.flag("done")}),write:(e,{done:t})=>e.flag(t)});function X(e,t,n,r){return a({name:e,description:n,direction:"toClient",command:t,read:i=>{const o=i.flag("joined");return o?{joined:o,status:i.string("status"),scriptDefId:i.int("scriptDefId"),difficulty:r&&i.remaining>0?i.int("difficulty"):null,extra:i.rest(),refusal:null}:{joined:o,refusal:i.string("refusal"),extra:i.rest()}},write:(i,o)=>{i.flag(o.joined),o.joined?(i.string(o.status).int(o.scriptDefId),o.difficulty!==null&&i.int(o.difficulty)):i.string(o.refusal),i.raw(o.extra)}})}X("quest.join-result","qj","The server says whether the player joined a public adventure.",!0);X("quest.create-private-result","qjc","The server says whether the player’s private adventure was created.",!1);X("quest.join-private-result","qjp","The server says whether the player joined a private adventure.",!0);a({name:"quest.waiting",description:"The players waiting in the adventure lobby changed.",direction:"toClient",command:"qw",read:e=>({userIds:e.repeat(e.remaining,()=>e.int("userId"))}),write:(e,{userIds:t})=>e.each(t,n=>e.int(n))});a({name:"quest.join-cancelled",description:"The server confirms the player left the adventure lobby.",direction:"toClient",command:"qjx",read:e=>({extra:e.rest()}),write:(e,{extra:t})=>e.raw(t)});a({name:"quest.started",description:"The adventure starts, with every actor in it.",direction:"toClient",command:"qs",read:e=>{const t=e.int("scriptDefId"),n=e.int("playerCount"),r=e.int("actorCount");if(r<0)return{scriptDefId:t,playerCount:n,started:!1,timestamp:"",actors:[],extra:e.rest()};const i=e.string("timestamp"),o=e.repeat(r,()=>Mt(e));return{scriptDefId:t,playerCount:n,started:!0,timestamp:i,actors:o,extra:e.rest()}},write:(e,{scriptDefId:t,playerCount:n,started:r,timestamp:i,actors:o,extra:s})=>{e.int(t).int(n),r?e.int(o.length).string(i).each(o,c=>Rt(e,c)):e.int(-1),e.raw(s)}});function Mt(e){const t=e.string("actorId"),n=e.int("type"),r=n===Ee,i=r?e.string("defName"):null,o=r?null:e.int("defId");return{actorId:t,type:n,defId:o,defName:i,state:e.int("state"),visible:e.int("visible")===1,requireClick:e.int("requireClick")===1,pathName:e.string("pathName"),swfState:e.string("swfState")}}function Rt(e,t){e.string(t.actorId).int(t.type),t.type===Ee?e.string(t.defName??""):e.int(t.defId??0),e.int(t.state).int(t.visible?1:0).int(t.requireClick?1:0).string(t.pathName).string(t.swfState)}a({name:"quest.treasure",description:"A treasure chest offers the player its prize.",direction:"toClient",command:"qatt",read:e=>({actorId:e.string("actorId"),prize:e.int("prize"),value:e.int("value"),color:e.int("color"),popup:e.int("popup")}),write:(e,{actorId:t,prize:n,value:r,color:i,popup:o})=>e.string(t).int(n).int(r).int(i).int(o)});a({name:"quest.xp",description:"The player earned adventure experience.",direction:"toClient",command:"quxp",read:e=>({earned:e.int("earned"),totalXp:e.int("totalXp"),previousLevel:e.int("previousLevel"),level:e.int("level"),levelProgress:e.number("levelProgress"),actorId:e.string("actorId")}),write:(e,{earned:t,totalXp:n,previousLevel:r,level:i,levelProgress:o,actorId:s})=>e.int(t).int(n).int(r).int(i).number(o).string(s)});a({name:"quest.level-up",description:"A player in the adventure levelled up.",direction:"toClient",command:"qulu",read:e=>({userId:e.int("userId"),level:e.int("level")}),write:(e,{userId:t,level:n})=>e.int(t).int(n)});a({name:"quest.player-left",description:"A player left the adventure.",direction:"toClient",command:"qplq",read:e=>({userId:e.int("userId"),avatarName:e.string("avatarName")}),write:(e,{userId:t,avatarName:n})=>e.int(t).string(n)});function Be(e,t,n){return a({name:e,description:n,direction:"toClient",command:t,read:r=>{const i=r.int("count"),o=r.int("popupType"),s=r.repeat(i,()=>({prize:r.int("prize"),value:r.int("value"),color:r.int("color")}));return{popupType:o,gifts:s}},write:(r,{popupType:i,gifts:o})=>r.int(o.length).int(i).each(o,({prize:s,value:c,color:m})=>r.int(s).int(c).int(m))})}Be("quest.rewards","qpgift","The adventure’s reward screen opens with its gifts.");Be("quest.player-rewards","qpgiftplr","The player’s own reward screen opens with its gifts.");a({name:"quest.award",description:"The adventure awards a stat or achievement.",direction:"toClient",command:"qaward",read:e=>({userVarId:e.int("userVarId"),value:e.int("value")}),write:(e,{userVarId:t,value:n})=>e.int(t).int(n)});a({name:"quest.exit-by-type",description:"The server sends the player out of the adventure.",direction:"toClient",command:"qxt",read:e=>({exitType:e.string("exitType")}),write:(e,{exitType:t})=>e.string(t)});a({name:"quest.bundle",description:"Several adventure messages packed into one.",direction:"toClient",command:"qqm",read:e=>{const t=e.string("payload"),n=new xt(qt(bt(t))),r=n.readShort();return{messages:Array.from({length:Math.max(0,r)},()=>{const o=n.readShort(),s=n.readUTF(),c=Array.from({length:Math.max(0,o-1)},()=>n.readUTF());return{command:s,args:c}}),extra:e.rest()}},write:(e,{messages:t,extra:n})=>{const r=new Ct().writeShort(t.length);for(const{command:i,args:o}of t)r.writeShort(o.length+1).writeUTF(i),o.forEach(s=>r.writeUTF(s));e.string(Tt(Nt(r.toBytes()))).raw(n)}});a({name:"quest.actor-spawned",description:"An actor appears in the adventure, such as dropped treasure.",direction:"toClient",command:"qspn",read:e=>{const t=e.string("spawnedFrom"),n=e.string("actorId"),r=e.int("type"),i=e.int("defId");let o=null,s=null;if(r===Lt){const c=e.int("subType");o={subType:c,denDefId:null,itemDefId:null,color:null,amount:null},c===y.denItem?o.denDefId=e.int("denDefId"):c===y.clothing?(o.itemDefId=e.int("itemDefId"),o.color=e.int("color")):(c===y.gems||c===y.crystals)&&(o.amount=e.int("amount"))}else jt.includes(r)&&(s={x:e.number("spawnOffsetX"),y:e.number("spawnOffsetY")});return{spawnedFrom:t,actorId:n,type:r,defId:i,dropped:o,spawnOffset:s,extra:e.rest()}},write:(e,{spawnedFrom:t,actorId:n,type:r,defId:i,dropped:o,spawnOffset:s,extra:c})=>{e.string(t).string(n).int(r).int(i),o?(e.int(o.subType),o.subType===y.denItem?e.int(o.denDefId??0):o.subType===y.clothing?e.int(o.itemDefId??0).int(o.color??0):(o.subType===y.gems||o.subType===y.crystals)&&e.int(o.amount??0)):s&&e.number(s.x).number(s.y),e.raw(c)}});a({name:"quest.actor-moved",description:"An adventure actor moved.",direction:"toClient",command:"qau",read:e=>({actorId:e.string("actorId"),x:e.int("x"),y:e.int("y"),velocity:e.int("velocity"),seekType:e.int("seekType"),nearestX:e.int("nearestX"),nearestY:e.int("nearestY")}),write:(e,{actorId:t,x:n,y:r,velocity:i,seekType:o,nearestX:s,nearestY:c})=>e.string(t).int(n).int(r).int(i).int(o).int(s).int(c)});a({name:"quest.actor-position-report",description:"The client reports where an adventure actor it moves is.",direction:"toServer",command:"qau",read:e=>({actorId:e.string("actorId"),x:e.int("x"),y:e.int("y"),velocity:e.int("velocity"),seekType:e.int("seekType"),nearestX:e.int("nearestX"),nearestY:e.int("nearestY")}),write:(e,{actorId:t,x:n,y:r,velocity:i,seekType:o,nearestX:s,nearestY:c})=>e.string(t).int(n).int(r).int(i).int(o).int(s).int(c)});a({name:"quest.actor-seek",description:"An adventure actor starts seeking a player, path or plant.",direction:"toClient",command:"qas",read:e=>({actorId:e.string("actorId"),seekType:e.int("seekType"),userId:e.int("userId")}),write:(e,{actorId:t,seekType:n,userId:r})=>e.string(t).int(n).int(r)});a({name:"quest.actor-seek-request",description:"The client asks for an adventure actor to seek.",direction:"toServer",command:"qas",read:e=>({actorId:e.string("actorId"),seekType:e.int("seekType")}),write:(e,{actorId:t,seekType:n})=>e.string(t).int(n)});a({name:"quest.actor-untrigger",description:"The player left an adventure actor’s area.",direction:"toServer",command:"qaut",read:e=>({actorId:e.string("actorId")}),write:(e,{actorId:t})=>e.string(t)});a({name:"quest.actor-health",description:"An adventure actor was hit, or missed.",direction:"toClient",command:"qahs",read:e=>{const t=e.string("actorId"),n=e.int("healthPercent"),r=n===-1,i=!r&&e.remaining>0?e.int("damage"):null,o=i!==null&&e.remaining>0?e.int("fierce")===1:null;return{actorId:t,healthPercent:n,missed:r,damage:i,fierce:o,extra:e.rest()}},write:(e,{actorId:t,healthPercent:n,damage:r,fierce:i,extra:o})=>{e.string(t).int(n),r!==null&&(e.int(r),i!==null&&e.int(i?1:0)),e.raw(o)}});a({name:"quest.actor-died",description:"An adventure actor was defeated or used up.",direction:"toClient",command:"qad",read:e=>({actorId:e.string("actorId"),damage:e.int("damage"),moved:e.string("moved")==="1",x:e.int("x"),y:e.int("y"),otherActorId:e.string("otherActorId")}),write:(e,{actorId:t,damage:n,moved:r,x:i,y:o,otherActorId:s})=>e.string(t).int(n).flag(r).int(i).int(o).string(s)});a({name:"quest.actor-restored",description:"An adventure actor came back.",direction:"toClient",command:"qrestore",read:e=>({actorId:e.string("actorId"),healthPercent:e.int("healthPercent")}),write:(e,{actorId:t,healthPercent:n})=>e.string(t).int(n)});function Le(e,t,n,r){return a({name:e,description:n,direction:"toClient",command:t,read:i=>{const o=i.int("command");if(o!==Pt.setState||i.remaining<2)return{command:o,actorId:null,state:null,visible:null,requireClick:null,args:i.rest()};const s=i.string("actorId"),c=i.int("state"),m=!r&&i.remaining>=2,d=m?i.string("visible")==="1":null,h=m?i.string("requireClick")==="1":null;return{command:o,actorId:s,state:c,visible:d,requireClick:h,args:i.rest()}},write:(i,o)=>{i.int(o.command),o.actorId!==null&&o.state!==null&&(i.string(o.actorId).int(o.state),o.visible!==null&&o.requireClick!==null&&i.flag(o.visible).flag(o.requireClick)),i.raw(o.args)}})}Le("quest.command","qcmd","The adventure’s script tells the client to do something, such as change an actor.",!1);Le("quest.variable","qcmdVT","The adventure’s script sets one of its variables.",!0);a({name:"quest.actor-swf-state",description:"An adventure actor’s animation changes state.",direction:"toClient",command:"qswfs",read:e=>({actorId:e.string("actorId"),swfState:e.string("swfState")}),write:(e,{actorId:t,swfState:n})=>e.string(t).string(n)});a({name:"quest.actor-path",description:"An adventure actor walks another path.",direction:"toClient",command:"qsp",read:e=>({actorId:e.string("actorId"),pathName:e.string("pathName")}),write:(e,{actorId:t,pathName:n})=>e.string(t).string(n)});a({name:"quest.actor-icon",description:"An adventure actor’s icon shows or hides.",direction:"toClient",command:"qicon",read:e=>({actorId:e.string("actorId"),showing:e.string("showing")==="1"}),write:(e,{actorId:t,showing:n})=>e.string(t).flag(n)});a({name:"quest.moved-items",description:"Where players moved the adventure’s items.",direction:"toClient",command:"qmi",read:e=>({items:e.repeat(Math.floor(e.remaining/5),()=>({actorId:e.string("actorId"),innerRadius:e.int("innerRadius"),outerRadius:e.int("outerRadius"),x:e.number("x"),y:e.number("y")})),extra:e.rest()}),write:(e,{items:t,extra:n})=>e.each(t,r=>e.string(r.actorId).int(r.innerRadius).int(r.outerRadius).number(r.x).number(r.y)).raw(n)});const x={askToDrop:0,pickedUp:1,droppedAt:3,placedAt:4};a({name:"quest.pick-up-result",description:"The server says what came of picking up an adventure item.",direction:"toClient",command:"qpup",read:e=>{const t=e.int("result"),n={result:t,heldItem:null,actorId:null,userId:null,x:null,y:null,innerRadius:null,outerRadius:null,dropperUserId:null};if(t===x.askToDrop)return{...n,heldItem:e.string("heldItem"),extra:e.rest()};if(t!==x.pickedUp&&t!==x.droppedAt&&t!==x.placedAt)return{...n,extra:e.rest()};const r={...n,actorId:e.string("actorId"),userId:e.int("userId")};return t!==x.pickedUp&&(r.x=e.number("x"),r.y=e.number("y")),t===x.placedAt&&(r.innerRadius=e.int("innerRadius"),r.outerRadius=e.int("outerRadius"),r.dropperUserId=e.int("dropperUserId")),{...r,extra:e.rest()}},write:(e,t)=>{e.int(t.result),t.heldItem!==null&&e.string(t.heldItem),t.actorId!==null&&e.string(t.actorId).int(t.userId??0),t.x!==null&&t.y!==null&&e.number(t.x).number(t.y),t.innerRadius!==null&&e.int(t.innerRadius).int(t.outerRadius??0).int(t.dropperUserId??0),e.raw(t.extra)}});a({name:"quest.give-item",description:"The server hands the player an adventure item to pick up.",direction:"toClient",command:"qgi",read:e=>({actorId:e.string("actorId")}),write:(e,{actorId:t})=>e.string(t)});function je(e,t,n,r){return a({name:e,description:n,direction:"toClient",command:t,read:i=>{const o=i.int("userId"),s=i.int("healthPercent"),c=i.int("change"),m=i.int("health"),d=i.int("maxHealth"),h=r&&i.remaining>=2,l=h?i.int("x"):null,g=h?i.int("y"):null;return{userId:o,healthPercent:s,change:c,health:m,maxHealth:d,x:l,y:g,extra:i.rest()}},write:(i,{userId:o,healthPercent:s,change:c,health:m,maxHealth:d,x:h,y:l,extra:g})=>{i.int(o).int(s).int(c).int(m).int(d),h!==null&&l!==null&&i.int(h).int(l),i.raw(g)}})}je("quest.health","quhp","A player’s health in the adventure changed.",!1);je("quest.respawned","qrspn","A player came back to life in the adventure.",!0);a({name:"quest.player-dead",description:"A player in the adventure was defeated.",direction:"toClient",command:"qpd",read:e=>({userId:e.int("userId")}),write:(e,{userId:t})=>e.int(t)});a({name:"quest.crystals",description:"The crystals the player gathered in the adventure changed.",direction:"toClient",command:"qporbs",read:e=>({crystals:e.int("crystals")}),write:(e,{crystals:t})=>e.int(t)});a({name:"quest.exited",description:"The server answers the player leaving the adventure.",direction:"toClient",command:"qx",read:e=>({extra:e.rest()}),write:(e,{extra:t})=>e.raw(t)});a({name:"quest.seed-given",description:"The player’s seed count changed.",direction:"toClient",command:"qseed",read:e=>({defId:e.int("defId"),count:e.int("count"),max:e.int("max")}),write:(e,{defId:t,count:n,max:r})=>e.int(t).int(n).int(r)});a({name:"quest.seed-planted",description:"A seed was planted in the adventure, or refused.",direction:"toClient",command:"qps",read:e=>{const t={planted:e.flag("planted"),userName:e.string("userName"),plant:null};return t.planted?{...t,plant:{actorName:e.string("actorName"),defId:e.int("defId"),x:e.int("x"),y:e.int("y"),launcherUserId:e.int("launcherUserId")}}:t},write:(e,{planted:t,userName:n,plant:r})=>{e.flag(t).string(n),t&&r&&e.string(r.actorName).int(r.defId).int(r.x).int(r.y).int(r.launcherUserId)}});a({name:"quest.plant-ate",description:"A planted seed’s plant ate a phantom.",direction:"toClient",command:"qpa",read:e=>({plantActorId:e.string("plantActorId"),phantomActorId:e.string("phantomActorId")}),write:(e,{plantActorId:t,phantomActorId:n})=>e.string(t).string(n)});a({name:"quest.plant-eat-recoil",description:"A planted seed’s plant recoils after eating.",direction:"toClient",command:"qepr",read:e=>({actorId:e.string("actorId")}),write:(e,{actorId:t})=>e.string(t)});a({name:"quest.volume-progress",description:"An interactive volume’s progress changed.",direction:"toClient",command:"qviu",read:e=>({actorId:e.string("actorId"),progress:e.int("progress")}),write:(e,{actorId:t,progress:n})=>e.string(t).int(n)});a({name:"quest.stats-update",description:"The player’s own attack and defence range in the adventure changed.",direction:"toClient",command:"qusu",read:e=>({attackBase:e.int("attackBase"),attackMax:e.int("attackMax"),defenseBase:e.int("defenseBase"),defenseMax:e.int("defenseMax")}),write:(e,{attackBase:t,attackMax:n,defenseBase:r,defenseMax:i})=>e.int(t).int(n).int(r).int(i)});a({name:"quest.avatar-switch",description:"A player is drawn disguised as a phantom or NPC, or their disguise is taken off.",direction:"toClient",command:"qavsw",read:e=>{const t=e.int("avatarRefId");return{avatarRefId:t===-1?null:t,userId:e.int("userId")}},write:(e,{avatarRefId:t,userId:n})=>e.int(t??-1).int(n)});a({name:"quest.actor-attack",description:"The client says an adventure actor, or the player, was hit.",direction:"toServer",command:"qaa",read:e=>({actorId:e.string("actorId"),playerHit:e.flag("playerHit"),weaponDefId:e.int("weaponDefId"),x:e.int("x"),y:e.int("y")}),write:(e,{actorId:t,playerHit:n,weaponDefId:r,x:i,y:o})=>e.string(t).flag(n).int(r).int(i).int(o)});a({name:"quest.attack-player",description:"The client says an adventure phantom it moves attacks a player.",direction:"toServer",command:"qap",read:e=>({actorId:e.string("actorId"),userId:e.int("userId"),weaponDefId:e.int("weaponDefId"),color:e.int("color")}),write:(e,{actorId:t,userId:n,weaponDefId:r,color:i})=>e.string(t).int(n).int(r).int(i)});a({name:"quest.player-attacked",description:"An adventure actor attacks a player.",direction:"toClient",command:"qap",read:e=>({actorId:e.string("actorId"),userId:e.int("userId"),weaponDefId:e.int("weaponDefId"),color:e.int("color")}),write:(e,{actorId:t,userId:n,weaponDefId:r,color:i})=>e.string(t).int(n).int(r).int(i)});a({name:"quest.beam-zap",description:"The client says an adventure beam caught the player.",direction:"toServer",command:"qbzap",read:e=>({actorId:e.string("actorId"),userId:e.int("userId")}),write:(e,{actorId:t,userId:n})=>e.string(t).int(n)});a({name:"quest.beam-zapped",description:"An adventure beam zaps.",direction:"toClient",command:"qbzap",read:e=>({actorId:e.string("actorId"),userId:e.int("userId")}),write:(e,{actorId:t,userId:n})=>e.string(t).int(n)});a({name:"quest.phantom-zap",description:"The client says a phantom’s touch caught the player.",direction:"toServer",command:"qpzap",read:e=>({actorId:e.string("actorId"),userId:e.int("userId"),x:e.int("x"),y:e.int("y")}),write:(e,{actorId:t,userId:n,x:r,y:i})=>e.string(t).int(n).int(r).int(i)});a({name:"quest.phantom-zapped",description:"An adventure phantom zaps a player.",direction:"toClient",command:"qpzap",read:e=>({actorId:e.string("actorId"),userId:e.int("userId")}),write:(e,{actorId:t,userId:n})=>e.string(t).int(n)});a({name:"quest.phantom-attack-destructible",description:"The client says a phantom’s attack caught a destructible actor.",direction:"toServer",command:"qpad",read:e=>({phantomActorId:e.string("phantomActorId"),destructibleActorId:e.string("destructibleActorId")}),write:(e,{phantomActorId:t,destructibleActorId:n})=>e.string(t).string(n)});a({name:"quest.player-heal",description:"The client says the player’s healing weapon landed on a player.",direction:"toServer",command:"qph",read:e=>({weaponDefId:e.int("weaponDefId"),userId:e.int("userId")}),write:(e,{weaponDefId:t,userId:n})=>e.int(t).int(n)});function j(e,t,n,r){return a({name:e,description:r,direction:n,command:t,read:i=>({weaponDefId:i.int("weaponDefId"),x:i.int("x"),y:i.int("y"),actorId:i.string("actorId"),userId:i.int("userId"),color:i.int("color")}),write:(i,{weaponDefId:o,x:s,y:c,actorId:m,userId:d,color:h})=>i.int(o).int(s).int(c).string(m).int(d).int(h)})}j("quest.projectile-launch","qp","toServer","The client says the player threw a weapon in an adventure.");j("quest.projectile-launched","qp","toClient","A player or actor threw a weapon in the adventure.");j("quest.swipe","qm","toServer","The client says the player swung a weapon in an adventure.");j("quest.swiped","qm","toClient","A player or actor swung a weapon in the adventure.");a({name:"quest.respawn-request",description:"The player asks to come back to life in the adventure.",direction:"toServer",command:"qprr",read:e=>({reserved:e.int("reserved"),x:e.int("x"),y:e.int("y")}),write:(e,{reserved:t,x:n,y:r})=>e.int(t).int(n).int(r)});a({name:"quest.respawn-granted",description:"The server lets the player come back to life in the adventure.",direction:"toClient",command:"qprr",read:e=>({extra:e.rest()}),write:(e,{extra:t})=>e.raw(t)});a({name:"quest.answer",description:"The player answers a question the adventure asked.",direction:"toServer",command:"qaskr",read:e=>({actorName:e.string("actorName"),actorState:e.int("actorState"),yes:e.flag("yes")}),write:(e,{actorName:t,actorState:n,yes:r})=>e.string(t).int(n).flag(r)});a({name:"quest.minigame-done",description:"A minigame an adventure launched is over.",direction:"toServer",command:"qmgc",read:e=>({actorName:e.string("actorName"),actorState:e.int("actorState"),result:e.int("result")}),write:(e,{actorName:t,actorState:n,result:r})=>e.string(t).int(n).int(r)});a({name:"quest.full-room-minigame-done",description:"A minigame an adventure room played together is over.",direction:"toServer",command:"qfrmgdone",read:e=>({roomName:e.string("roomName"),result:e.int("result")}),write:(e,{roomName:t,result:n})=>e.string(t).int(n)});a({name:"quest.clone",description:"The player asks for the adventure again.",direction:"toServer",command:"qcq",read:()=>({}),write:()=>{}});a({name:"quest.moved-items-request",description:"The client asks where players moved the adventure’s items.",direction:"toServer",command:"qmi",read:()=>({}),write:()=>{}});a({name:"quest.drop-item",description:"The player drops the adventure item they carry.",direction:"toServer",command:"qdroppup",read:e=>({x:e.int("x"),y:e.int("y"),actorId:e.string("actorId"),userId:e.int("userId")}),write:(e,{x:t,y:n,actorId:r,userId:i})=>e.int(t).int(n).string(r).int(i)});a({name:"quest.plant-seed",description:"The player plants a seed in the adventure.",direction:"toServer",command:"qps",read:e=>({defId:e.int("defId"),x:e.int("x"),y:e.int("y")}),write:(e,{defId:t,x:n,y:r})=>e.int(t).int(n).int(r)});a({name:"quest.eat-phantom",description:"The client says a plant bit a phantom.",direction:"toServer",command:"qep",read:e=>({plantActorId:e.string("plantActorId"),phantomActorId:e.string("phantomActorId"),x:e.int("x"),y:e.int("y")}),write:(e,{plantActorId:t,phantomActorId:n,x:r,y:i})=>e.string(t).string(n).int(r).int(i)});a({name:"quest.plant-ate-report",description:"The client says a plant started eating.",direction:"toServer",command:"qpa",read:e=>({plantActorId:e.string("plantActorId"),phantomActorId:e.string("phantomActorId")}),write:(e,{plantActorId:t,phantomActorId:n})=>e.string(t).string(n)});a({name:"quest.side-scroll-report",description:"The client says where the player is in a side scrolling adventure.",direction:"toServer",command:"qssau",read:e=>({x:e.int("x"),y:e.int("y"),flags:e.int("flags")}),write:(e,{x:t,y:n,flags:r})=>e.int(t).int(n).int(r)});a({name:"quest.side-scroll-moved",description:"A player moved in a side scrolling adventure.",direction:"toClient",command:"qssau",read:e=>({userId:e.int("userId"),x:e.number("x"),y:e.number("y"),extra:e.rest()}),write:(e,{userId:t,x:n,y:r,extra:i})=>e.int(t).number(n).number(r).raw(i)});a({name:"quest.player-room-change",description:"A player went to another room of the adventure.",direction:"toClient",command:"qrc",read:e=>({userId:e.int("userId"),roomName:e.string("roomName"),x:e.int("x"),y:e.int("y")}),write:(e,{userId:t,roomName:n,x:r,y:i})=>e.int(t).string(n).int(r).int(i)});a({name:"quest.torch",description:"A torch in the adventure is lit or put out.",direction:"toClient",command:"qtorch",read:e=>{const t=e.int("target"),n=e.int("lit")===1,r=t===0;return{target:t,lit:n,actorId:r?e.string("actorId"):null,userId:r?null:e.int("userId")}},write:(e,{target:t,lit:n,actorId:r,userId:i})=>{e.int(t).int(n?1:0),r!==null?e.string(r):e.int(i??0)}});a({name:"quest.play-swf",description:"The adventure plays a film over the screen.",direction:"toClient",command:"qplayswf",read:e=>({mediaId:e.int("mediaId")}),write:(e,{mediaId:t})=>e.int(t)});a({name:"quest.play-swf-done",description:"The client says the adventure’s film finished.",direction:"toServer",command:"qplayswf",read:()=>({}),write:()=>{}});a({name:"quest.preload-swf",description:"The adventure loads a film ahead of playing it.",direction:"toClient",command:"qpreloadswf",read:e=>({mediaId:e.int("mediaId")}),write:(e,{mediaId:t})=>e.int(t)});a({name:"quest.fade",description:"The adventure fades the screen out, or back in.",direction:"toClient",command:"qfade",read:e=>({fadeIn:e.string("fadeIn")==="1"}),write:(e,{fadeIn:t})=>e.flag(t)});a({name:"quest.shake",description:"The adventure shakes the room.",direction:"toClient",command:"qshake",read:e=>({milliseconds:e.number("milliseconds")}),write:(e,{milliseconds:t})=>e.number(t)});a({name:"quest.sound",description:"The adventure plays a sound.",direction:"toClient",command:"qsnd",read:e=>({name:e.string("name")}),write:(e,{name:t})=>e.string(t)});a({name:"quest.voice-over",description:"The adventure plays a voice over with its subtitle.",direction:"toClient",command:"qsndVO",read:e=>({name:e.string("name"),subtitle:e.string("subtitle")}),write:(e,{name:t,subtitle:n})=>e.string(t).string(n)});a({name:"quest.music",description:"The adventure changes its music.",direction:"toClient",command:"qmusic",read:e=>({name:e.string("name")}),write:(e,{name:t})=>e.string(t)});a({name:"quest.media-library",description:"The adventure loads a pack of its sounds.",direction:"toClient",command:"qmlib",read:e=>({mediaId:e.int("mediaId")}),write:(e,{mediaId:t})=>e.int(t)});a({name:"quest.sound-pack",description:"The adventure loads a pack of its sounds.",direction:"toClient",command:"qsndpk",read:e=>({mediaId:e.int("mediaId")}),write:(e,{mediaId:t})=>e.int(t)});a({name:"quest.post-uri",description:"The adventure records a page view for analytics.",direction:"toClient",command:"qposturi",read:e=>({uri:e.string("uri")}),write:(e,{uri:t})=>e.string(t)});a({name:"room.join-request",description:"The player asks to join a room.",direction:"toServer",command:"rj",read:e=>({target:e.string("target"),confirmLanguageChange:e.flag("confirmLanguageChange"),invisible:e.flag("invisible"),joinType:e.string("joinType")}),write:(e,{target:t,confirmLanguageChange:n,invisible:r,joinType:i})=>e.string(t).flag(n).flag(r).string(i)});const $t=8;a({name:"room.join-result",description:"The server says whether the player joined, and describes the room.",direction:"toClient",command:"rj",read:e=>{const t=e.flag("joined");if(!t){const i=e.remaining>0?e.string("error"):null;return{joined:t,joinedRoom:null,details:null,error:i,extra:e.rest()}}const n={name:e.string("name"),id:e.int("id"),users:e.int("users"),maxUsers:e.int("maxUsers"),spectators:e.int("spectators"),maxSpectators:e.int("maxSpectators"),isPrivate:e.flag("isPrivate"),isGame:e.flag("isGame"),isLimbo:e.flag("isLimbo")},r=e.remaining>=$t?Ft(e):null;return{joined:t,joinedRoom:n,details:r,error:null,extra:e.rest()}},write:(e,{joined:t,joinedRoom:n,details:r,error:i,extra:o})=>{e.flag(t),t&&n?(e.string(n.name).int(n.id).int(n.users).int(n.maxUsers).int(n.spectators).int(n.maxSpectators).flag(n.isPrivate).flag(n.isGame).flag(n.isLimbo),r&&(e.flag(r.isTemp).flag(r.isSubRoom).string(r.displayName).int(r.displayNameId).int(r.perUserAvId).int(r.activePetInvId).int(r.language).int(r.customMusicDef),r.shardId!==null&&e.int(r.shardId))):!t&&i!==null&&e.string(i),e.raw(o)}});function Ft(e){return{isTemp:e.flag("isTemp"),isSubRoom:e.flag("isSubRoom"),displayName:e.string("displayName"),displayNameId:e.int("displayNameId"),perUserAvId:e.int("perUserAvId"),activePetInvId:e.int("activePetInvId"),language:e.int("language"),customMusicDef:e.int("customMusicDef"),shardId:e.remaining>0?e.int("shardId"):null}}a({name:"room.properties",description:"The server says which room to load, and how.",direction:"toClient",command:"rp",read:e=>({pathName:e.string("pathName"),environmentType:e.int("environmentType"),roomType:e.int("roomType"),secondaryDefId:e.int("secondaryDefId"),zoom:e.int("zoom"),roomDefId:e.int("roomDefId"),customData:e.remaining>0?e.string("customData"):null}),write:(e,t)=>{e.string(t.pathName).int(t.environmentType).int(t.roomType).int(t.secondaryDefId).int(t.zoom).int(t.roomDefId),t.customData!==null&&e.string(t.customData)}});a({name:"room.leave-request",description:"The player leaves an in room game’s room.",direction:"toServer",command:"rl",read:e=>({roomId:e.int("roomId")}),write:(e,{roomId:t})=>e.int(t)});a({name:"room.list",description:"The server lists the rooms the client knows.",direction:"toClient",command:"rl",read:e=>({rooms:e.repeat(e.int("count"),()=>({id:e.int("id"),name:e.string("name"),maxUsers:e.int("maxUsers"),isTemp:e.flag("isTemp"),isGame:e.flag("isGame"),users:e.int("users")}))}),write:(e,{rooms:t})=>e.int(t.length).each(t,n=>e.int(n.id).string(n.name).int(n.maxUsers).flag(n.isTemp).flag(n.isGame).int(n.users))});a({name:"room.ffm-request",description:"The player asks for their first five minutes room.",direction:"toServer",command:"rf",read:()=>({}),write:()=>{}});a({name:"room.ffm-result",description:"The server says whether the first five minutes room is ready.",direction:"toClient",command:"rf",read:e=>({ready:e.string("ready")==="1",extra:e.rest()}),write:(e,{ready:t,extra:n})=>e.string(t?"1":"0").raw(n)});S({name:"session.version-check",description:"The client says which SmartFox version it speaks.",direction:"toServer",type:"sys",command:"verChk",read:e=>{var t,n;return{version:((n=(t=e.body)==null?void 0:t.child("ver"))==null?void 0:n.attribute("v"))??""}},write:({version:e})=>[new v("ver",{attributes:[I.create("v",e)],selfClosing:!0,trailing:" "})]});S({name:"session.random-key-request",description:"The client asks for the key it signs its login with.",direction:"toServer",type:"sys",command:"rndK",read:()=>({}),write:()=>[]});S({name:"session.random-key",description:"The server gives the key the login is signed with.",direction:"toClient",type:"sys",command:"rndK",read:e=>{var t,n;return{key:((n=(t=e.body)==null?void 0:t.child("k"))==null?void 0:n.textContent)??""}},write:({key:e})=>[new v("k",{children:[new T(e)]})]});S({name:"session.login",description:"The client signs in to a zone with its auth token.",direction:"toServer",type:"sys",command:"login",read:e=>{var t,n,r;const i=(t=e.body)==null?void 0:t.child("login");return{zone:(i==null?void 0:i.attribute("z"))??"",nick:((n=i==null?void 0:i.child("nick"))==null?void 0:n.textContent)??"",password:((r=i==null?void 0:i.child("pword"))==null?void 0:r.textContent)??""}},write:({zone:e,nick:t,password:n})=>[new v("login",{attributes:[I.create("z",e)],children:[new v("nick",{children:[new T(t)]}),new v("pword",{children:[new T(n)]})]})]});a({name:"session.email-activation-request",description:"The player asks for the email that activates their email address to be sent.",direction:"toServer",command:"ves",read:e=>({email:e.string("email")}),write:(e,{email:t})=>e.string(t)});a({name:"session.email-activation-result",description:"The server says whether the activation email was sent.",direction:"toClient",command:"ves",read:e=>({sent:e.string("sent")==="1"}),write:(e,{sent:t})=>e.string(t?"1":"0")});a({name:"session.email-validated",description:"The account’s email address was validated.",direction:"toClient",command:"vea",read:()=>({}),write:()=>{}});const w={clothing:1e3,denItems:1030,denRooms:1040,currencyExchange:1051,diamondShop:1054,combined:1060},_t=[w.clothing,w.denItems,w.denRooms,w.currencyExchange,w.diamondShop];a({name:"shop.list-request",description:"The player asks for a shop’s contents.",direction:"toServer",command:"gl",read:e=>({listId:e.int("listId")}),write:(e,{listId:t})=>e.int(t)});a({name:"shop.list",description:"The server sends a shop’s contents.",direction:"toClient",command:"gl",read:e=>{const t=e.int("listId"),n=e.int("listType"),r=_t.indexOf(n)!==-1;if(!r&&n!==w.combined)return{kind:"other",listId:t,listType:n,body:e.rest()};const i={listId:t,listType:n,titleStrId:e.string("titleStrId"),unused:e.string("unused"),diamondBundle:e.string("diamondBundle")!=="",diamondCost:O(e.string("diamondCost"))},o=e.int("count");return r?{...i,kind:"items",defIds:e.repeat(o,()=>e.int("defId"))}:{...i,kind:"combined",groups:Ot(e,o)}},write:(e,t)=>{if(e.int(t.listId).int(t.listType),t.kind==="other"){e.raw(t.body);return}if(e.string(t.titleStrId).string(t.unused).string(t.diamondBundle?"1":"").int(t.diamondCost),t.kind==="items"){e.int(t.defIds.length).each(t.defIds,n=>e.int(n));return}e.int(t.groups.length),t.groups.length!==0&&(e.string(t.groups.map(n=>n.listType).join(",")).string(t.groups.map(n=>n.defIds.length).join(",")),t.groups.forEach(n=>n.defIds.forEach(r=>e.int(r))))}});function Ot(e,t){if(t===0)return[];const n=e.string("groupTypes").split(","),r=e.string("groupCounts").split(",");return n.map((i,o)=>({listType:O(i),defIds:e.repeat(O(r[o]??""),()=>e.int("defId"))}))}function O(e){const t=Number(e);return Number.isInteger(t)?t:0}a({name:"shop.den-shop-update-request",description:"The player adds, reprices or removes items in their own den shop.",direction:"toServer",command:"dsu",read:e=>({storeInvId:e.int("storeInvId"),state:e.string("state"),upserts:e.repeat(e.int("upsertCount"),()=>({itemKind:e.int("itemKind"),invIdx:e.int("invIdx"),currencyType:e.int("currencyType"),cost:e.int("cost")})),removals:e.repeat(e.int("removeCount"),()=>({itemKind:e.int("itemKind"),invIdx:e.int("invIdx")}))}),write:(e,{storeInvId:t,state:n,upserts:r,removals:i})=>{e.int(t).string(n),e.int(r.length).each(r,o=>e.int(o.itemKind).int(o.invIdx).int(o.currencyType).int(o.cost)),e.int(i.length).each(i,o=>e.int(o.itemKind).int(o.invIdx))}});a({name:"shop.den-shop-update-result",description:"The server answers a change to the player’s own den shop.",direction:"toClient",command:"dsu",read:e=>{const t=e.string("ok")==="1";return{ok:t,state:t?e.string("state"):""}},write:(e,{ok:t,state:n})=>{e.string(t?"1":"0"),t&&e.string(n)}});a({name:"shop.den-shop-info-request",description:"The player asks to see a den shop’s listings.",direction:"toServer",command:"dsi",read:e=>({userName:e.string("userName"),storeInvId:e.int("storeInvId")}),write:(e,{userName:t,storeInvId:n})=>e.string(t).int(n)});a({name:"shop.den-shop-info",description:"The server sends a den shop’s listings.",direction:"toClient",command:"dsi",read:e=>{const t=e.string("ok")==="1",n=e.int("itemCount");if(!t||n<0)return{ok:t,itemCount:-1,state:"",items:[]};const r=e.string("state");return{ok:t,itemCount:n,state:r,items:e.rest()}},write:(e,t)=>{e.string(t.ok?"1":"0").int(t.itemCount),t.ok&&t.itemCount>=0&&e.string(t.state).raw(t.items)}});a({name:"shop.den-shop-buy-request",description:"The player buys an item from a den shop.",direction:"toServer",command:"dsb",read:e=>({userName:e.string("userName"),shopInvIdx:e.int("shopInvIdx"),state:e.string("state"),itemKind:e.int("itemKind"),invIdx:e.int("invIdx"),currencyType:e.int("currencyType"),cost:e.int("cost")}),write:(e,{userName:t,shopInvIdx:n,state:r,itemKind:i,invIdx:o,currencyType:s,cost:c})=>e.string(t).int(n).string(r).int(i).int(o).int(s).int(c)});a({name:"shop.den-shop-buy-result",description:"The server answers a den shop purchase.",direction:"toClient",command:"dsb",read:e=>{const t=e.int("status");if(t!==1)return{status:t,ownerUserName:"",storeInvId:-1,rest:[]};const n=e.string("ownerUserName"),r=e.int("storeInvId");return{status:t,ownerUserName:n,storeInvId:r,rest:e.rest()}},write:(e,t)=>{e.int(t.status),t.status===1&&e.string(t.ownerUserName).int(t.storeInvId).raw(t.rest)}});a({name:"trade.list-request",description:"The player asks for someone’s trade list.",direction:"toServer",command:"tl",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"trade.list",description:"The server sends someone’s trade list.",direction:"toClient",command:"tl",read:e=>({userName:e.string("userName"),clothing:e.repeat(e.int("clothing"),()=>({defId:e.int("defId"),invIdx:e.int("invIdx"),color:e.int("color")})),den:e.repeat(e.int("den"),()=>{const t=e.int("defId"),n=e.int("invIdx");return{defId:t,invIdx:n,...K(e)}}),pets:e.repeat(e.int("pets"),()=>{const t=e.int("defId"),n=e.int("invIdx"),r=e.number("createdAt"),i=W(e),o=e.string("name");return{defId:t,invIdx:n,createdAt:r,bits:i,name:o,...J(e)}})}),write:(e,{userName:t,clothing:n,den:r,pets:i})=>{e.string(t).int(n.length),n.forEach(o=>e.int(o.defId).int(o.invIdx??-1).int(o.color)),e.int(r.length),r.forEach(o=>{e.int(o.defId).int(o.invIdx??-1),G(e,o)}),e.int(i.length),i.forEach(o=>{e.int(o.defId).int(o.invIdx).number(o.createdAt),H(e,o),e.string(o.name),Y(e,o)})}});a({name:"trade.list-change",description:"The player changes their trade list.",direction:"toServer",command:"ts",read:e=>({removed:e.repeat(e.int("removed"),()=>z(e)),added:e.repeat(e.int("added"),()=>z(e))}),write:(e,{removed:t,added:n})=>{e.int(t.length),t.forEach(r=>e.int(r.itemType).int(r.invIdx)),e.int(n.length),n.forEach(r=>e.int(r.itemType).int(r.invIdx))}});a({name:"trade.busy",description:"The player starts or stops being busy with a trade.",direction:"toServer",command:"tb",read:e=>({busy:e.flag("busy")}),write:(e,{busy:t})=>e.flag(t)});a({name:"trade.action",description:"The player asks for a trade, answers one, withdraws or confirms.",direction:"toServer",command:"ti",read:e=>{const t=e.int("action");switch(t){case 0:{const n=e.string("userName"),r=e.int("itemType"),i=e.int("invIdx"),o=e.int("clothing"),s=e.int("den"),c=e.int("audio"),m=e.int("pets");return{action:"request",userName:n,itemType:r,invIdx:i,clothing:e.repeat(o,()=>e.int("invIdx")),den:e.repeat(s+c,()=>e.int("invIdx")),audio:c,pets:e.repeat(m,()=>e.int("invIdx"))}}case 1:return{action:"respond",response:e.int("response")};case 2:return{action:"cancel"};case 3:return{action:"confirm",confirm:e.flag("confirm")};default:throw new u(`trade.action: unknown action ${t}`,"PACKET_FIELD")}},write:(e,t)=>{switch(t.action){case"request":e.int(0).string(t.userName).int(t.itemType).int(t.invIdx).int(t.clothing.length).int(t.den.length-t.audio).int(t.audio).int(t.pets.length),[...t.clothing,...t.den,...t.pets].forEach(n=>e.int(n));return;case"respond":e.int(1).int(t.response);return;case"cancel":e.int(2);return;case"confirm":e.int(3).int(t.confirm?1:0);return}}});a({name:"trade.result",description:"Someone offers a trade, or a trade is accepted, done or ends.",direction:"toClient",command:"ti",read:e=>{const t=e.int("status");switch(t){case 0:return{kind:"offer",status:0,offer:zt(e)};case 1:{if(e.int("stage")===0)return{kind:"confirm",status:1};const n=e.repeat(e.int("received"),()=>Xt(e)),r=e.repeat(e.int("removed"),()=>z(e));return{kind:"completed",status:1,received:n,removed:r,extra:e.rest()}}case 6:return{kind:"closed",status:6,extra:e.rest()};case 7:return{kind:"different-server",status:7,roomName:e.string("roomName"),extra:e.rest()};default:return{kind:"failed",status:t,userName:e.string("userName"),userNameModerationFlag:e.int("userNameModerationFlag"),extra:e.rest()}}},write:(e,t)=>{switch(e.int(t.status),t.kind){case"offer":Vt(e,t.offer);return;case"confirm":e.int(0);return;case"completed":e.int(1).int(t.received.length),t.received.forEach(n=>Kt(e,n)),e.int(t.removed.length),t.removed.forEach(n=>e.int(n.itemType).int(n.invIdx)),e.raw(t.extra);return;case"closed":e.raw(t.extra);return;case"different-server":e.string(t.roomName).raw(t.extra);return;case"failed":e.string(t.userName).int(t.userNameModerationFlag).raw(t.extra);return}}});function zt(e){const t=e.string("userName"),n=e.int("userNameModerationFlag"),r=e.int("wantedKind"),i=e.int("wantedInvIdx"),o=e.int("clothing"),s=e.int("den"),c=e.int("pets");return{userName:t,userNameModerationFlag:n,wantedKind:r,wantedInvIdx:i,offered:{clothing:e.repeat(o,()=>({defId:e.int("defId"),color:e.int("color"),invIdx:null})),den:e.repeat(s,()=>({defId:e.int("defId"),invIdx:null,...K(e)})),pets:e.repeat(c,()=>{const m=e.number("createdAt"),d=e.int("defId"),h=e.int("invIdx"),l=W(e),g=J(e);return{defId:d,invIdx:h,createdAt:m,bits:l,name:e.string("name"),...g}})}}}function Vt(e,t){const{clothing:n,den:r,pets:i}=t.offered;e.string(t.userName).int(t.userNameModerationFlag).int(t.wantedKind).int(t.wantedInvIdx).int(n.length).int(r.length).int(i.length),n.forEach(o=>e.int(o.defId).int(o.color)),r.forEach(o=>{e.int(o.defId),G(e,o)}),i.forEach(o=>{e.number(o.createdAt).int(o.defId).int(o.invIdx),H(e,o),Y(e,o),e.string(o.name)})}function Xt(e){const t=e.int("type");switch(t){case 0:return{type:"clothing",defId:e.int("defId"),invIdx:e.int("invIdx"),color:e.int("color")};case 1:{const n=e.int("invIdx");return{type:"den",defId:e.int("defId"),invIdx:n,...K(e)}}case 2:{const n=e.number("createdAt"),r=e.int("invIdx"),i=e.int("defId"),o=W(e),s=J(e);return{type:"pet",defId:i,invIdx:r,createdAt:n,bits:o,name:e.string("name"),...s}}default:throw new u(`trade.result: unknown received item type ${t}`,"PACKET_FIELD")}}function Kt(e,t){switch(t.type){case"clothing":e.int(0).int(t.defId).int(t.invIdx??-1).int(t.color);return;case"den":e.int(1).int(t.invIdx??-1).int(t.defId),G(e,t);return;case"pet":e.int(2).number(t.createdAt).int(t.invIdx).int(t.defId),H(e,t),Y(e,t),e.string(t.name);return}}function z(e){return{itemType:e.int("itemType"),invIdx:e.int("invIdx")}}function K(e){return{version:e.int("version"),approved:e.string("approved")==="true",uniqueImageId:e.string("uniqueImageId"),creatorDbId:e.int("creatorDbId"),creatorUuid:e.string("creatorUuid")}}function G(e,t){e.int(t.version).string(t.approved?"true":"false").string(t.uniqueImageId).int(t.creatorDbId).string(t.creatorUuid)}function W(e){return[e.int("bits1"),e.int("bits2"),e.int("bits3")]}function H(e,t){e.int(t.bits[0]).int(t.bits[1]).int(t.bits[2])}function J(e){return{traitDefId:e.int("traitDefId"),toyDefId:e.int("toyDefId"),foodDefId:e.int("foodDefId")}}function Y(e,t){e.int(t.traitDefId).int(t.toyDefId).int(t.foodDefId)}a({name:"world.room-count-request",description:"The player asks how many are in each room.",direction:"toServer",command:"rc",read:()=>({}),write:()=>{}});a({name:"world.room-counts",description:"The server says how many are in each room.",direction:"toClient",command:"rc",read:e=>({rooms:e.repeat(e.int("count"),()=>({name:e.string("name"),users:e.int("users")}))}),write:(e,{rooms:t})=>e.int(t.length).each(t,({name:n,users:r})=>e.string(n).int(r))});a({name:"world.shard-list-request",description:"The player asks for the list of shards.",direction:"toServer",command:"rm",read:()=>({}),write:()=>{}});const R=4;a({name:"world.shard-list",description:"The server lists the shards on each server node.",direction:"toClient",command:"rm",read:e=>{const t=e.rest(),n=t[0];return n!==void 0&&Pe(n)?{status:new C(t,"world.shard-list").int("status"),nodes:[]}:{status:null,nodes:Gt(t)}},write:(e,{status:t,nodes:n})=>{if(t!==null){e.int(t);return}e.each(n,({host:r,shards:i})=>e.string(r).each(i,o=>e.int(o.id).int(o.language).int(o.population).int(o.buddies)))}});function Gt(e){const t=[];let n=0;for(;n<e.length;){const r=e[n++];let i=n;for(;i<e.length&&Pe(e[i]);)i++;const o=i-n;if(o%R!==0)throw new u(`world.shard-list: node "${r}" has ${o} numbers, not shards of ${R}`,"PACKET_FIELD");const s=new C(e.slice(n,i),"world.shard-list"),c=s.repeat(o/R,()=>({id:s.int("id"),language:s.int("language"),population:s.int("population"),buddies:s.int("buddies")}));t.push({host:r,shards:c}),n=i}return t}function Pe(e){return e.trim()!==""&&Number.isFinite(Number(e))}a({name:"world.node-hop-request",description:"The player asks to move off a server that is shutting down.",direction:"toServer",command:"nd",read:()=>({}),write:()=>{}});a({name:"world.node-hop",description:"The server names the server to move to.",direction:"toClient",command:"nd",read:e=>({host:e.string("host")}),write:(e,{host:t})=>e.string(t)});a({name:"player-wall.token-request",description:"The client asks for the token a player wall’s service wants.",direction:"toServer",command:"wt",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"player-wall.token",description:"The server hands over a player wall’s token, or refuses it.",direction:"toClient",command:"wt",read:e=>{const t=e.string("result");return t!=="1"?{result:t,token:null,read:!1,write:!1,userName:null,extra:e.rest()}:{result:t,token:e.string("token"),read:e.string("read")==="1",write:e.string("write")==="1",userName:e.string("userName"),extra:e.rest()}},write:(e,{result:t,token:n,read:r,write:i,userName:o,extra:s})=>{e.string(t),t==="1"&&e.string(n??"").string(r?"1":"0").string(i?"1":"0").string(o??""),e.raw(s)}});a({name:"player-wall.settings-set-request",description:"The player sets who may post on their wall.",direction:"toServer",command:"wss",read:e=>({setting:e.int("setting")}),write:(e,{setting:t})=>e.int(t)});a({name:"player-wall.settings-set-result",description:"The server says whether it kept who may post on the player’s wall.",direction:"toClient",command:"wss",read:e=>({ok:e.string("ok")==="1",extra:e.rest()}),write:(e,{ok:t,extra:n})=>e.string(t?"1":"0").raw(n)});a({name:"player-wall.settings-request",description:"The player asks who may post on someone’s wall.",direction:"toServer",command:"wsg",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"player-wall.settings",description:"The server says who may post on a wall.",direction:"toClient",command:"wsg",read:e=>({setting:e.int("setting"),extra:e.rest()}),write:(e,{setting:t,extra:n})=>e.int(t).raw(n)});a({name:"player-wall.parameters-request",description:"The player changes how their wall looks.",direction:"toServer",command:"wps",read:e=>({changes:e.string("changes")}),write:(e,{changes:t})=>e.string(t)});a({name:"player-wall.parameters-result",description:"The server says whether it kept how the player’s wall looks.",direction:"toClient",command:"wps",read:e=>({ok:e.string("ok")==="1",extra:e.rest()}),write:(e,{ok:t,extra:n})=>e.string(t?"1":"0").raw(n)});a({name:"player-wall.visit-request",description:"The player counts a visit to someone’s wall.",direction:"toServer",command:"wci",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"player-wall.visit-result",description:"The server says whether a visit to a wall was counted.",direction:"toClient",command:"wci",read:e=>({ok:e.string("ok")==="1",extra:e.rest()}),write:(e,{ok:t,extra:n})=>e.string(t?"1":"0").raw(n)});a({name:"resource-array.get-request",description:"The player asks how many have liked a masterpiece or a wall.",direction:"toServer",command:"crg",read:e=>({resourceType:e.string("resourceType"),resourceId:e.string("resourceId"),userUuid:e.string("userUuid"),report:e.string("report")==="report"}),write:(e,{resourceType:t,resourceId:n,userUuid:r,report:i})=>e.string(t).string(n).string(r).string(i?"report":"")});a({name:"resource-array.get",description:"The server says how many have liked a masterpiece or a wall.",direction:"toClient",command:"crg",read:e=>({ok:e.string("ok")==="1",liked:e.remaining>0?e.string("liked")==="1":!1,count:e.remaining>0?e.int("count"):0,extra:e.rest()}),write:(e,{ok:t,liked:n,count:r,extra:i})=>e.string(t?"1":"0").string(n?"1":"0").int(r).raw(i)});a({name:"resource-array.put-request",description:"The player likes a masterpiece or a wall.",direction:"toServer",command:"crp",read:e=>{const t=e.string("resourceType"),n=e.string("resourceId"),r=e.string("userUuid"),i=e.remaining>0?e.string("detail"):null,o=e.remaining>0?Wt(e.string("creator")):null;return{resourceType:t,resourceId:n,userUuid:r,detail:i,creator:o,extra:e.rest()}},write:(e,{resourceType:t,resourceId:n,userUuid:r,detail:i,creator:o,extra:s})=>{e.string(t).string(n).string(r),(i!==null||o!==null)&&e.string(i??""),o!==null&&e.string(`${o.version},${o.creatorUuid},${o.creatorDbId}`),e.raw(s)}});function Wt(e){const t=e.split(","),[n="",r="",i=""]=t,o=Number(n),s=Number(i);if(t.length!==3||n.trim()===""||i.trim()===""||!Number.isInteger(o)||!Number.isInteger(s))throw new u(`resource-array.put-request: field "creator" has "${e}", not <version>,<creatorUUID>,<creatorDbId>`,"PACKET_FIELD");return{version:o,creatorUuid:r,creatorDbId:s}}a({name:"resource-array.put",description:"The server says whether a like was taken.",direction:"toClient",command:"crp",read:e=>({ok:e.string("ok")==="1",extra:e.rest()}),write:(e,{ok:t,extra:n})=>e.string(t?"1":"0").raw(n)});a({name:"world-item.gift-request",description:"The player takes a world item’s gift.",direction:"toServer",command:"wig",read:e=>({defId:e.int("defId"),version:e.int("version"),colorIndex:e.int("colorIndex")}),write:(e,{defId:t,version:n,colorIndex:r})=>e.int(t).int(n).int(r)});a({name:"world-item.gift-result",description:"The server says whether a world item’s gift was given.",direction:"toClient",command:"wig",read:e=>({ok:e.string("ok")==="1",balance:e.remaining>0?e.int("balance"):-1,extra:e.rest()}),write:(e,{ok:t,balance:n,extra:r})=>e.string(t?"1":"0").int(n).raw(r)});a({name:"referral.code-request",description:"The player asks for their refer a friend code.",direction:"toServer",command:"refc",read:()=>({}),write:()=>{}});a({name:"referral.code",description:"The server sends the player’s refer a friend code.",direction:"toClient",command:"refc",read:e=>({status:e.int("status"),code:e.remaining>0?e.string("code"):null}),write:(e,{status:t,code:n})=>{e.int(t),n!==null&&e.string(n)}});a({name:"referral.has-associate-request",description:"The player asks whether they have named who referred them.",direction:"toServer",command:"refh",read:()=>({}),write:()=>{}});a({name:"referral.has-associate",description:"The server says whether the player has named who referred them.",direction:"toClient",command:"refh",read:e=>({status:e.int("status")}),write:(e,{status:t})=>e.int(t)});a({name:"referral.associate",description:"The player names who referred them.",direction:"toServer",command:"refa",read:e=>({userName:e.string("userName")}),write:(e,{userName:t})=>e.string(t)});a({name:"referral.associate-result",description:"The server says whether the player’s referrer was recorded.",direction:"toClient",command:"refa",read:e=>({status:e.int("status")}),write:(e,{status:t})=>e.int(t)});a({name:"referral.list-request",description:"The player asks for the players who joined with their code.",direction:"toServer",command:"refr",read:e=>({page:e.int("page"),pageSize:e.int("pageSize")}),write:(e,{page:t,pageSize:n})=>e.int(t).int(n)});a({name:"referral.list",description:"The server sends the players who joined with the player’s code.",direction:"toClient",command:"refr",read:e=>({status:e.int("status"),referrals:e.remaining>0?Ht(e.string("referrals")):null}),write:(e,{status:t,referrals:n})=>{e.int(t),n!==null&&e.string(Jt(n))}});function Ht(e){let t;try{t=JSON.parse(e)}catch{throw new u(`referral.list: field "referrals" is not JSON ("${e}")`,"PACKET_FIELD")}const n=he(t)?t.referrals:null;return Array.isArray(n)?n.filter(he).map(r=>({userName:typeof r.name=="string"?r.name:String(r.name??""),moderatedUserName:"moderatedUserName"in r&&r.moderatedUserName!==null?String(r.moderatedUserName):null,nameBarData:"namebarData"in r?Number(r.namebarData)||0:null,accountType:typeof r.account_type=="string"?r.account_type:""})):[]}function Jt(e){return JSON.stringify({referrals:e.map(t=>({name:t.userName,...t.moderatedUserName===null?{}:{moderatedUserName:t.moderatedUserName},...t.nameBarData===null?{}:{namebarData:t.nameBarData},account_type:t.accountType}))})}function he(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Yt={none:0,game:1,denVolume:2,splash:3,storePet:4,socialGroup:5,socialEmoticon:6,guiAction:7,recycleAccessory:8,recycleDenItem:9,triggerWalkIn:11,genericList:12,clickEmoticon:13,air:14,dynamicCollision:15,dynamicAir:16,dynamicPhantomAir:17,plant:18,stealth:19,adventureInteract:20,darkSoft:21,darkHard:22,fallingPhantom:23};Object.fromEntries(Object.entries(Yt).map(([e,t])=>[t,e]));new Set(Object.values(w));class Zt extends Error{constructor(t,n){super(n),this.code=t,this.name="PluginError"}code}export{Qt as C,we as M,u as P,b as X,U as a,D as b,Zt as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const f=1;function m(r){return typeof r=="object"&&r!==null&&r.phantom===1&&typeof r.type=="string"}function S(r){return m(r)}function w(r){return m(r)}function b(r,e=""){return`phantom-plugin://${r}/${e.replace(/^\/+/,"")}`}const P="__phantom/frame.html",k="__phantom/runtime.js",A="__phantom/runtime.css",C=5299,R="/__phantom/plugin.json",T=15e8,L=1e6,p={timeout:"REALTIME_ASK_TIMEOUT",gone:"REALTIME_ASK_GONE",closed:"REALTIME_ASK_CLOSED","no-handler":"REALTIME_ASK_NO_HANDLER",failed:"REALTIME_ASK_FAILED"};class i extends Error{constructor(e,a){super(a),this.reason=e,this.name="RealtimeAskError",this.code=p[e]}reason;code}function g(r){if(r instanceof i)return r;const e=r==null?void 0:r.code,a=r instanceof Error?r.message:String(r);for(const[s,d]of Object.entries(p))if(e===d)return new i(s,a);return new i("failed",a)}class y{constructor(e,a){this.calls=a,this.id=e.id,this.scope=e.scope,this.name=e.name,this.part=e.part,this.self=e.you,this.list=[...e.members],this.shared=e.state??null;const s=e.host===null?null:[this.self,...this.list].find(d=>d.id===e.host);this.hostAt=s??null,this.hostIsHidden=e.hostHidden===!0||e.host!==null&&!s}calls;id;scope;name;part;self;list;shared;hostAt;hostIsHidden;closedWith=null;answers=null;heard={message:new Set,join:new Set,leave:new Set,state:new Set,presence:new Set,host:new Set,close:new Set};stop=()=>{};get you(){return this.self}get open(){return this.closedWith===null}members(){return this.list}host(){const e=this.hostAt;return e?e.id===this.self.id?this.self:this.list.find(a=>a.id===e.id)??e:null}get isHost(){return this.hostAt!==null&&this.hostAt.id===this.self.id}get hosted(){return this.hostAt!==null||this.hostIsHidden}giveHost(e){return this.closedWith?this.refuse():this.calls.giveHost(this.id,e)}state(){return this.shared}setState(e){return this.closedWith?this.refuse():this.calls.setState(this.id,e)}presence(){return this.self.presence??null}setPresence(e){return this.closedWith?this.refuse():(this.self=e===null?{id:this.self.id,screenName:this.self.screenName}:{...this.self,presence:e},this.calls.setPresence(this.id,e))}send(e){return this.closedWith?this.refuse():this.calls.send(this.id,e)}sendTo(e,a){return this.closedWith?this.refuse():this.calls.sendTo(this.id,e,a)}async ask(e,a,s){if(this.closedWith)throw new i("closed",`This channel is closed: ${this.closedWith.message}`);try{return await this.calls.ask(this.id,e,a,s)}catch(d){throw g(d)}}onAsk(e){if(typeof e!="function")throw new TypeError("Pass a handler function");if(this.closedWith)return()=>{};const a=e;return this.answers=a,()=>{this.answers===a&&(this.answers=null)}}async leave(){this.closedWith||(await this.calls.leave(this.id),this.hear({kind:"close",channel:this.id,reason:"left",message:"Left the channel."}))}onMessage(e){return this.listen(this.heard.message,e)}onJoin(e){return this.listen(this.heard.join,e)}onLeave(e){return this.listen(this.heard.leave,e)}onState(e){return this.listen(this.heard.state,e)}onPresence(e){return this.listen(this.heard.presence,e)}onHost(e){return this.listen(this.heard.host,e)}onClose(e){return this.listen(this.heard.close,e)}hear(e){if(!this.closedWith)switch(e.kind){case"message":return this.tell(this.heard.message,e.message);case"ask":this.reply({channel:e.channel,id:e.id,from:e.from,data:e.data,at:e.at});return;case"join":{const a=e.member;return this.list.some(s=>s.id===a.id)||(this.list=[...this.list,a]),this.tell(this.heard.join,a)}case"leave":return this.list=this.list.filter(a=>a.id!==e.member.id),this.tell(this.heard.leave,e.member);case"state":return this.shared=e.state,this.tell(this.heard.state,{channel:e.channel,state:this.shared,from:e.from,at:e.at});case"presence":{const a=e.member;return this.list=this.list.some(s=>s.id===a.id)?this.list.map(s=>s.id===a.id?a:s):[...this.list,a],this.tell(this.heard.presence,a)}case"host":return this.hostAt=e.host??null,this.hostIsHidden=e.hosted&&e.host===null,this.tell(this.heard.host,{channel:e.channel,host:this.host(),you:this.isHost,hosted:this.hosted});case"close":{const a={channel:e.channel,reason:e.reason,message:e.message};this.closedWith=a,this.answers=null,this.list=[],this.shared=null,this.hostAt=null,this.hostIsHidden=!1,this.stop(),this.tell(this.heard.close,a);for(const s of Object.values(this.heard))s.clear();return}}}async reply(e){const a=this.answers;if(!a)return this.turnDown(e,"no-handler");let s;try{s=await a(e)}catch(d){return console.error("An onAsk handler failed",d),this.turnDown(e,"failed")}try{await this.calls.answer(e.id,s===void 0?null:s)}catch(d){return console.error("An answer could not be sent",d),this.turnDown(e,"failed")}}async turnDown(e,a){try{await this.calls.decline(e.id,a)}catch{}}stopWith(e){this.stop=e}listen(e,a){if(typeof a!="function")throw new TypeError("Pass a listener function");return this.closedWith?()=>{}:(e.add(a),()=>{e.delete(a)})}tell(e,a){for(const s of[...e])try{s(a)}catch(d){console.error("A real-time listener failed",d)}}refuse(){return Promise.reject(new Error(`This channel is closed: ${this.closedWith.message}`))}}async function O(r,e,a){let s=null;const d=[],n=(t,u)=>{s?t===s.id&&s.hear(u):d.push({channel:t,event:u})},v=[r.onMessage(t=>n(t.channel,{kind:"message",message:t})),r.onAsk(t=>n(t.channel,{kind:"ask",...t})),r.onJoin(t=>n(t.channel,{kind:"join",...t})),r.onLeave(t=>n(t.channel,{kind:"leave",...t})),r.onState(t=>n(t.channel,{kind:"state",...t})),r.onPresence(t=>n(t.channel,{kind:"presence",...t})),r.onHost(t=>n(t.channel,{kind:"host",...t})),r.onClose(t=>n(t.channel,{kind:"close",...t}))],c=()=>{for(const t of v.splice(0))t()};let l;try{l=a?await r.open(e,a):await r.open(e)}catch(t){throw c(),t}const o=new y(l,r);o.stopWith(c),s=o;for(const t of d.splice(0))t.channel===o.id&&o.hear(t.event);return o}const E=["avatar.view","adventures.record","content.replaceOnScreen","content.load","realtime.join"],I={"avatar.view":"flash","adventures.record":"sdk:adventures:read","content.load":"flash","content.replaceOnScreen":"flash","recipes.chatShortcuts":"flash","recipes.customChatBox":"flash","recipes.chatHistoryPanel":"flash","realtime.join":"sdk:realtime:act"},h={"avatar.position":"read","avatar.walkTo":"act","avatar.teleport":"act","avatar.userId":"read","avatar.userName":"read","avatar.perUserAvId":"read","avatar.colors":"read","avatar.palette":"read","avatar.colorOf":"read","avatar.offerColors":"act","avatar.restoreColors":"act","avatar.pickColor":"act","avatar.paint":"act","avatar.paintColor":"act","avatar.act":"act","avatar.list":"read","avatar.switchTo":"act","avatar.slots":"read","avatar.remove":"act","avatar.typeDefinition":"read","avatar.isMemberOnlyType":"read","avatar.lookup":"read","avatar.lookupById":"read","avatar.onSwitch":"read","avatar.onLookup":"read","avatar.onPaintResult":"read","avatar.standing":"read","avatar.idleAnimation":"read","avatar.placeAt":"act","avatar.playAnimation":"act","avatar.tint":"act","avatar.setOpacity":"act","avatar.showBubble":"act","avatar.setMode":"act","avatar.face":"act","avatar.walkSpeed":"read","avatar.setWalkSpeed":"act","avatar.glide":"act","avatar.setNoClip":"act","avatar.setAirborne":"act","avatar.walkPath":"act","avatar.walkThrough":"act","avatar.create":"act","avatar.buySlot":"act","avatar.createFirst":"act","avatar.chooseUsable":"act","avatar.setPendingFlag":"act","avatar.canPayForPhoto":"read","avatar.payForPhoto":"act","avatar.definitionsLoaded":"read","avatar.loadDefinitions":"read","avatar.data":"read","avatar.inRoom":"read","avatar.findInRoom":"read","avatar.standingOf":"read","avatar.defaultLook":"read","avatar.buddyCardAvatar":"read","avatar.adventurePlayers":"read","avatar.offScreenPlayers":"read","avatar.lastSeenAt":"read","avatar.hosting":"read","avatar.isHostingAdventure":"read","avatar.suitsEnvironment":"read","avatar.roomState":"read","avatar.lastNameBar":"read","avatar.onList":"read","avatar.onRemoved":"read","avatar.onAdded":"read","avatar.onSlotBought":"read","avatar.onFirstCreated":"read","avatar.onNameBarChange":"read","avatar.onUsableChosen":"read","avatar.onPhotoChecked":"read","avatar.onPhotoTaken":"read","player.login":"read","player.onLogin":"read","player.userName":"read","player.uuid":"read","player.avatarName":"read","player.isMember":"read","player.isModerator":"read","player.accountType":"read","player.isGuide":"read","player.isSilenced":"read","player.moderatedName":"read","player.can":"read","player.chatType":"read","player.daysSinceLastLogin":"read","player.isHostingParty":"read","player.loginCount":"read","player.createdAt":"read","player.worldMapRoom":"read","player.hasPendingFlag":"read","player.discipline":"read","player.onDiscipline":"read","player.membershipDaysLeft":"read","player.email":"read","player.invisible":"read","player.setInvisible":"act","player.settingOn":"read","player.onInvisibleChange":"read","player.state":"read","player.onChange":"read","player.record":"read","player.avatars":"read","player.avatarOf":"read","player.partyTimeLeft":"read","player.onPartyHosting":"read","player.onTradeListChange":"read","player.clothing":"read","player.denItemsForRoom":"read","player.petsInDen":"read","player.animalKindCount":"read","player.animalDefaults":"read","player.customAnimal":"read","player.customAnimalsOf":"read","player.animalOf":"read","player.denRoomDefinitions":"read","player.denRoomDefinition":"read","chat.recent":"read","chat.say":"act","chat.emote":"act","chat.phrase":"read","chat.onMessage":"read","chat.onAdminMessage":"read","chat.onModeration":"read","chat.onJamAGram":"read","chat.phraseCode":"read","chat.canSay":"read","chat.phrasesReady":"read","chat.blend":"act","chat.fade":"act","chat.slide":"act","chat.phrases":"read","chat.isEmote":"read","chat.sayPhrase":"act","chat.sayFree":"act","chat.permanentEmote":"act","chat.petAction":"act","chat.attachmentEmote":"act","chat.showBalloon":"act","chat.log":"act","chat.clearLog":"act","chat.lastAdminMessage":"read","chat.lastModeration":"read","buddies.list":"read","buddies.online":"read","buddies.blocked":"read","buddies.get":"read","buddies.isBlocked":"read","buddies.refresh":"read","buddies.add":"act","buddies.remove":"act","buddies.respond":"act","buddies.block":"act","buddies.unblock":"act","buddies.locate":"read","buddies.jumpTo":"act","buddies.onRequest":"read","buddies.onUpdate":"read","buddies.onLocation":"read","buddies.onBlockInfo":"read","buddies.capacity":"read","buddies.knows":"read","buddies.details":"read","buddies.pendingSent":"read","buddies.isBlockingMe":"act","buddies.showCard":"act","buddies.closeCard":"act","buddies.joinBuddyQuest":"act","buddies.requests":"read","buddies.onAddResult":"read","buddies.onBlockChange":"read","buddies.onList":"read","buddies.clientList":"read","buddies.clientBlocked":"read","buddies.hasBlocked":"read","buddies.cardTradeList":"read","ecards.inbox":"read","ecards.unread":"read","ecards.get":"read","ecards.refresh":"read","ecards.unreadCount":"read","ecards.remainingSends":"read","ecards.cardMediaIds":"read","ecards.stampMediaIds":"read","ecards.isMessageAllowed":"read","ecards.privacy":"read","ecards.isComposerOpen":"read","ecards.onReceived":"read","ecards.onUpdated":"read","ecards.onRemoved":"read","ecards.onSendResult":"read","ecards.onGiftResult":"read","ecards.onPrivacyResult":"read","ecards.clearCache":"act","ecards.setPrivacy":"act","ecards.markRead":"act","ecards.remove":"act","ecards.acceptGift":"act","ecards.respondToBuddyRequest":"act","ecards.openComposer":"act","ecards.closeInbox":"act","ecards.send":"act","ecards.discardGift":"act","ecards.lastBuddyAnswer":"read","ecards.onBuddyAnswer":"read","ecards.onInbox":"read","ecards.clientInbox":"read","ecards.clientInboxLoaded":"read","playerWall.posts":"read","playerWall.check":"read","playerWall.privacyOf":"read","playerWall.blockedMessages":"read","playerWall.isOwnWallOpen":"read","playerWall.openWallOwner":"read","playerWall.onPosts":"read","playerWall.post":"act","playerWall.remove":"act","playerWall.clear":"act","playerWall.setPrivacy":"act","playerWall.blockMessage":"act","playerWall.acknowledgeNotifications":"act","playerWall.countVisit":"act","playerWall.openOwn":"act","playerWall.open":"act","playerWall.close":"act","playerWall.myPrivacy":"read","playerWall.cached":"read","playerWall.hiddenPostIds":"read","playerWall.permissions":"read","playerWall.setParameters":"act","playerWall.showPostAs":"act","playerWall.removeMasterpiece":"act","playerWall.hasOpenedOwnWall":"read","playerWall.hasCountedVisit":"read","playerWall.likes":"read","playerWall.onAccess":"read","playerWall.onPrivacy":"read","playerWall.onPrivacyChange":"read","playerWall.onParametersChange":"read","playerWall.onVisitCounted":"read","playerWall.onLikes":"read","playerWall.onLiked":"read","playerWall.onServiceRequest":"read","playerWall.requestPermissions":"act","playerWall.like":"act","dailyGift.daysInCycle":"read","dailyGift.statId":"read","dailyGift.received":"read","dailyGift.isOpen":"read","dailyGift.current":"read","dailyGift.onGift":"read","dailyGift.open":"act","dailyGift.keep":"act","dailyGift.keepDiamonds":"act","dailyGift.close":"act","dailyGift.reject":"act","sound.settings":"read","sound.areSoundsMuted":"read","sound.isMusicMuted":"read","sound.volume":"read","sound.musicVolume":"read","sound.onChange":"read","sound.muteSounds":"act","sound.muteMusic":"act","sound.muteAll":"act","sound.toggleMute":"act","sound.setVolume":"act","sound.setSoundVolume":"act","sound.setMusicVolume":"act","sound.pauseMusic":"act","sound.stopMusic":"act","sound.stopSounds":"act","sound.isBankLoaded":"read","sound.pauseSounds":"act","sound.unpauseSounds":"act","sound.stopAll":"act","sound.play":"act","sound.stop":"act","sound.onPlay":"read","sound.onStop":"read","sound.playEffect":"act","sound.effects":"read","sound.playSfx":"act","sound.stopSfx":"act","feedback.types":"read","feedback.maxLength":"read","feedback.isOpen":"read","feedback.close":"act","reports.report":"act","reports.reportContent":"act","reports.onReportResult":"read","reports.onContentReportResult":"read","reports.onReportSent":"read","newspaper.definitions":"read","newspaper.dataOf":"read","newspaper.hasUnseenPages":"read","newspaper.hasSeenFirstPage":"read","newspaper.onPageSeen":"read","newspaper.markSeen":"act","newspaper.open":"act","newspaper.definition":"read","masterpieces.itemsOf":"read","masterpieces.creatorOf":"read","masterpieces.likes":"read","masterpieces.onItems":"read","masterpieces.onCreator":"read","masterpieces.onLikes":"read","masterpieces.onLiked":"read","masterpieces.like":"act","trades.offer":"read","trades.onOffer":"read","trades.onConfirmRequest":"read","trades.onComplete":"read","trades.onEnd":"read","trades.accept":"act","trades.decline":"act","trades.confirm":"act","trades.cancel":"act","trades.list":"read","trades.myList":"read","trades.request":"act","trades.add":"act","trades.remove":"act","trades.onChange":"read","trades.isTrading":"read","trades.heldList":"read","trades.setBusy":"act","trades.onList":"read","trades.onListChanged":"read","trades.offerDraft":"read","trades.counts":"read","trades.listEntry":"read","inventory.items":"read","inventory.owned":"read","inventory.worn":"read","inventory.canWear":"read","inventory.onChange":"read","inventory.onUse":"read","inventory.wear":"act","inventory.takeOff":"act","inventory.change":"act","inventory.buy":"act","inventory.recycle":"act","inventory.wearableBy":"read","inventory.limits":"read","inventory.avatarSlots":"read","inventory.onAvatarSlot":"read","inventory.latestPrize":"read","inventory.onPrize":"read","shops.offering":"read","shops.definition":"read","shops.listType":"read","shops.isOpen":"read","shops.open":"act","shops.close":"act","shops.diamondItem":"read","shops.diamondDefinition":"read","shops.diamondList":"read","shops.buy":"act","shops.sell":"act","shops.onBuy":"read","shops.onSell":"read","shops.onList":"read","shops.denOffering":"read","shops.definitionsReady":"read","shops.isAvailable":"read","shops.onOpen":"read","shops.buyDiamondBundle":"act","shops.onDiamondBundleBuy":"read","shops.picture":"read","pets.list":"read","pets.active":"read","pets.activeName":"read","pets.get":"read","pets.max":"read","pets.kindName":"read","pets.kindId":"read","pets.hasUnnamedEggPet":"read","pets.refresh":"read","pets.sparkle":"act","pets.activeInvId":"read","pets.bringOut":"act","pets.putAway":"act","pets.free":"act","pets.onSwitch":"read","pets.onList":"read","pets.onDismissed":"read","pets.adoptionCards":"read","pets.adoptionCard":"read","pets.adoptionTier":"read","pets.hasUnseenAdoption":"read","pets.markAdoptionSeen":"act","pets.definition":"read","pets.appearance":"read","pets.packBits":"read","pets.canBringOut":"read","pets.isUnlocked":"read","pets.hasHatched":"read","pets.setMasteryBadge":"act","pets.nameEggPet":"act","pets.create":"act","pets.randomAppearance":"read","pets.buy":"act","pets.restyle":"act","pets.adoptionChecklistOf":"read","pets.adoptionCountOf":"read","pets.adoptionCardDefs":"read","pets.adoptionCardTotal":"read","pets.hasAdoptionCards":"read","pets.definitions":"read","pets.unlockedKinds":"read","pets.goesOnLandAndInOcean":"read","pets.goesWith":"read","pets.enviroTypeOf":"read","pets.isGroundType":"read","pets.kindOfBits":"read","pets.listAsItems":"read","pets.picture":"read","pets.onCreated":"read","pets.onEggNamed":"read","pets.onMasteryBadge":"read","pets.onRestyled":"read","pets.onUnlocked":"read","pets.onAdoptionChecklist":"read","pets.onAdoptionCount":"read","pets.onDefinitionsLoaded":"read","room.players.list":"read","room.players.count":"read","room.players.get":"read","room.players.byUserName":"read","room.players.byAvatarName":"read","room.players.onEnter":"read","room.players.onLeave":"read","room.players.onMove":"read","room.players.refresh":"read","room.current":"read","room.details":"read","room.layout":"read","room.onLayout":"read","room.focusCamera":"act","room.stopWalking":"act","room.scene":"read","room.restoreMusic":"act","room.players.viewOf":"read","room.players.views":"read","room.toScreen":"read","room.toWorld":"read","room.worldItem":"read","room.takeWorldItem":"act","room.onJoin":"read","room.onJoinFailed":"read","room.join":"act","room.teleport":"act","room.respawn":"act","room.spawns":"read","room.portals":"read","room.bounds":"read","room.camera":"read","room.moveCamera":"act","room.holdCamera":"act","room.setZoom":"act","room.cellAt":"read","room.checkWall":"read","room.nearestOpen":"read","room.respawnPoint":"read","room.bounceAt":"read","room.leavePreview":"act","room.setPathDepth":"act","room.volumes":"read","room.volumesAt":"read","room.layers":"read","room.showAvatars":"act","room.reload":"act","room.players.pathOf":"read","room.onWorldItemTaken":"read","room.joiningInvisibly":"read","room.darkAreas":"read","room.nearestEmptyCell":"read","room.journeyBookItemsLeft":"read","room.objectAt":"read","room.setJamaaTime":"act","room.setDenKickNotice":"act","dens.join":"act","dens.joinOwn":"act","dens.isOwnDen":"read","dens.owner":"read","dens.privacyOf":"read","dens.setPrivacy":"act","dens.rooms":"read","dens.switchRoom":"act","dens.visitors":"read","dens.onVisitors":"read","dens.onKicked":"read","dens.items":"read","dens.moveItem":"act","dens.saveLayout":"act","dens.inventory":"read","dens.itemDefinition":"read","dens.place":"act","dens.removeItem":"act","dens.buyItem":"act","dens.recycleItems":"act","dens.empty":"act","dens.onEntered":"read","dens.onEdited":"read","dens.onRoomChanged":"read","dens.onPrivacyChanged":"read","dens.onRooms":"read","dens.limits":"read","dens.buyRoom":"act","dens.recycleRooms":"act","dens.ecoState":"read","dens.redeemEcoCredits":"act","dens.setEcoConsumer":"act","dens.inOwnDen":"read","dens.guests":"read","dens.onGuestArrive":"read","dens.onVisit":"read","dens.onGuestLeave":"read","dens.onOwnDen":"read","dens.roomChange":"read","dens.kickedAt":"read","dens.lastPurchase":"read","dens.onPurchase":"read","dens.lastSale":"read","dens.onSale":"read","dens.emptiedAt":"read","dens.onEmptied":"read","dens.epicDens":"read","dens.onEpicDens":"read","dens.setPhantom":"act","dens.onPhantom":"read","dens.lastEcoState":"read","dens.onEcoState":"read","dens.lastEcoRedemption":"read","dens.onEcoCreditsRedeemed":"read","dens.ecoConsumers":"read","dens.onEcoConsumers":"read","dens.activeDenIdx":"read","dens.onItemList":"read","dens.serverState":"read","dens.onState":"read","dens.saveItems":"act","dens.onSaved":"read","dens.onSaving":"read","dens.isChangePending":"read","dens.openDenShopId":"read","dens.heldDenShop":"read","denShop.offering":"read","denShop.onChange":"read","denShop.onBuy":"read","denShop.list":"act","denShop.reprice":"act","denShop.unlist":"act","denShop.buy":"act","denShop.onOffering":"read","denShop.onSale":"read","denShop.inDen":"read","denShop.update":"act","shops.knownShops":"read","world.serverNode":"read","world.shardId":"read","world.shards":"read","world.switchShard":"act","world.roomCounts":"read","world.onRoomCounts":"read","world.requestNodeHop":"act","world.onNodeHop":"read","world.parties":"read","world.customParties":"read","world.joinParty":"act","world.joinCustomParty":"act","world.onPartyJoinFailed":"read","world.onParties":"read","world.onPartyNode":"read","world.roomDefinition":"read","world.goToPlayer":"act","world.leaveRoom":"act","world.partyDefinition":"read","world.partyRules":"read","world.shardName":"read","world.hostParty":"act","world.onHostingEnded":"read","world.partyNode":"act","world.hostingTimeLeft":"act","world.showParties":"act","world.onRoomList":"read","world.onRandomKey":"read","world.rooms":"read","world.randomKey":"read","world.lastNodeHop":"read","world.lastPartyJoin":"read","world.hosting":"read","world.onHostResult":"read","world.onCustomParties":"read","world.onShards":"read","world.onHostingTimeLeft":"read","world.partyDefinitions":"read","world.canUseAvatarHere":"read","world.partyMasterpieces":"read","world.onPartyMasterpieces":"read","world.onFirstFiveMinutesRoom":"read","world.requestFirstFiveMinutesRoom":"act","world.joinNamedRoom":"act","session.connected":"read","session.mode":"read","session.server":"read","session.onConnectionLost":"read","session.onConnected":"read","session.onNodeSwitch":"read","session.disconnect":"act","session.requestList":"read","session.onList":"read","session.inMinigame":"read","session.settingsUserName":"read","session.sendEmailActivation":"act","session.onEmailActivation":"read","session.onEmailActivationRequest":"read","session.emailValidated":"read","session.onEmailValidated":"read","assets.deployVersion":"read","assets.buildVersion":"read","assets.loadMedia":"read","assets.requestDefPack":"read","assets.onLoaded":"read","adventures.lobby":"read","adventures.current":"read","adventures.treasures":"read","adventures.availableIds":"read","adventures.definition":"read","adventures.list":"read","adventures.join":"act","adventures.host":"act","adventures.joinPrivate":"act","adventures.joinBuddy":"act","adventures.start":"act","adventures.kick":"act","adventures.leaveLobby":"act","adventures.leave":"act","adventures.openTreasure":"act","adventures.keepTreasure":"act","adventures.onJoinResult":"read","adventures.onStart":"read","adventures.onTreasure":"read","adventures.onRewards":"read","adventures.onXp":"read","adventures.onLevelUp":"read","adventures.onAward":"read","adventures.onItemGiven":"read","adventures.onPlayerLeft":"read","adventures.onDefeated":"read","adventures.onExited":"read","adventures.onGiftChoice":"read","adventures.onPlayerGiftChoice":"read","adventures.actors":"read","adventures.actor":"read","adventures.collectables":"read","adventures.health":"read","adventures.actorPosition":"read","adventures.trigger":"act","adventures.pickUp":"act","adventures.dropCarriedItem":"act","adventures.collectTreasure":"act","adventures.collect":"act","adventures.crystalActors":"read","adventures.takeRewards":"act","adventures.clearRoomTransition":"act","adventures.walkToActor":"act","adventures.stopWalking":"act","adventures.weapon":"read","adventures.mode":"read","adventures.attack":"act","adventures.respawn":"act","adventures.heal":"act","adventures.answerQuestion":"act","adventures.restart":"act","adventures.pathDistances":"read","adventures.crystals":"read","adventures.liveActors":"read","adventures.onCrystals":"read","adventures.chooseReward":"act","adventures.finishRewards":"act","adventures.unlockedGifts":"read","adventures.autoAcceptDialogue":"act","adventures.stopAutoAcceptDialogue":"act","adventures.closeDialogue":"act","adventures.screenBlocked":"read","adventures.closeGoalScreen":"act","adventures.onActor":"read","adventures.onActorIcon":"read","adventures.onActorSeek":"read","adventures.onAvatarSwitched":"read","adventures.onCombatStats":"read","adventures.onVolumeProgress":"read","adventures.onHealth":"read","adventures.onRewardChoice":"read","adventures.onComplete":"read","adventures.onEnd":"read","adventures.phantomsNear":"read","adventures.nearestPhantom":"read","adventures.nearestPlant":"read","adventures.darken":"act","adventures.lighten":"act","adventures.darkenFromScene":"act","adventures.playSound":"act","adventures.playMusic":"act","adventures.loopSound":"act","adventures.stopLoop":"act","adventures.onStep":"read","adventures.npcDefinition":"read","adventures.inspectActor":"read","adventures.hitAt":"read","adventures.actorTouching":"read","adventures.pointInActor":"read","adventures.livePlayers":"read","adventures.inStealth":"read","adventures.meleeTargets":"act","adventures.speak":"act","adventures.actorHitText":"act","adventures.statusText":"act","adventures.showObjective":"act","adventures.showActor":"act","adventures.actorSwfState":"act","adventures.actorPath":"act","adventures.spawnActor":"act","adventures.torch":"act","adventures.shake":"act","adventures.plantSeed":"act","adventures.validatePlantSpot":"read","adventures.eatPhantom":"act","adventures.onSeedGiven":"read","adventures.onSeedPlanted":"read","adventures.onPlantAte":"read","adventures.onPlantEatRecoil":"read","adventures.canPlaySideScroll":"act","adventures.experience":"read","adventures.playerLevel":"read","adventures.departedPlayers":"read","adventures.defeatedPlayers":"read","adventures.awards":"read","adventures.givenItems":"read","adventures.exitConfirmed":"read","adventures.lastBundle":"read","adventures.actorIconShowing":"read","adventures.actorSeeking":"read","adventures.disguise":"read","adventures.seeds":"read","adventures.plants":"read","adventures.combatStats":"read","adventures.volumeProgress":"read","adventures.attackTarget":"read","adventures.playerRoom":"read","adventures.sideScrollPosition":"read","adventures.actorTorch":"read","adventures.playerTorch":"read","adventures.music":"read","adventures.cutscene":"read","adventures.preloadedCutscenes":"read","adventures.soundPacks":"read","adventures.screenFaded":"read","adventures.lastZap":"read","adventures.lastLaunch":"read","adventures.respawnsGranted":"read","adventures.shaking":"read","adventures.lastSound":"read","adventures.pageViews":"read","adventures.clientStatus":"read","adventures.actorPathToPlayer":"read","adventures.onActorSpawned":"read","adventures.onActorMoved":"read","adventures.onActorHealth":"read","adventures.onActorDied":"read","adventures.onActorRestored":"read","adventures.onActorSwfState":"read","adventures.onActorPath":"read","adventures.onCommand":"read","adventures.onVariable":"read","adventures.onPickUpResult":"read","adventures.onMovedItems":"read","adventures.onCrystalCount":"read","adventures.onSentOut":"read","adventures.onLobbyWaiting":"read","adventures.onLobbyLeft":"read","adventures.onPlayerAttacked":"read","adventures.onBeamZap":"read","adventures.onPhantomZap":"read","adventures.onThrow":"read","adventures.onSwing":"read","adventures.onRespawnGranted":"read","adventures.onPlayerRoomChange":"read","adventures.onSideScroll":"read","adventures.onTorch":"read","adventures.onCutscene":"read","adventures.onCutscenePreload":"read","adventures.onFade":"read","adventures.onShake":"read","adventures.onSound":"read","adventures.onMusic":"read","adventures.onSoundPack":"read","adventures.onPageView":"read","adventures.movedItems":"read","adventures.reportHit":"act","adventures.reportPlayerHit":"act","adventures.reportAttackOnPlayer":"act","adventures.reportActorPosition":"act","adventures.requestActorSeek":"act","adventures.untrigger":"act","adventures.reportBeamZap":"act","adventures.reportPhantomZap":"act","adventures.reportDestructibleHit":"act","adventures.reportPlantAte":"act","adventures.reportThrow":"act","adventures.reportSwing":"act","adventures.finishCutscene":"act","adventures.requestRespawn":"act","adventures.finishMinigame":"act","adventures.finishRoomMinigame":"act","adventures.reportSideScroll":"act","minigames.current":"read","minigames.isPlaying":"read","minigames.play":"act","minigames.leave":"act","minigames.send":"act","minigames.info":"read","minigames.leaderboard":"read","minigames.onJoinResult":"read","minigames.onStart":"read","minigames.onMessage":"read","minigames.onEnd":"read","minigames.onPvpInvite":"read","minigames.onJoinRequest":"read","minigames.definition":"read","minigames.pvpGames":"read","minigames.invitePvp":"act","minigames.respondToPvp":"act","minigames.submitScore":"act","minigames.awardGems":"act","minigames.awardPetMastery":"act","minigames.keepAlive":"act","minigames.status":"read","minigames.playing":"read","minigames.cachedLeaderboard":"read","minigames.gameName":"read","minigames.isOfferingPvp":"read","minigames.onPlayerLeft":"read","minigames.onInfo":"read","minigames.onRoomRemoved":"read","minigames.join":"act","minigames.startNow":"act","minigames.commitScore":"act","minigames.feedGame":"act","minigames.readyForPvp":"act","minigames.offerPvp":"act","minigames.joinOfferedPvp":"act","minigames.chat":"act","minigames.onLeaderboard":"read","minigames.clientLeaderboard":"read","minigames.lastJoin":"read","minigames.pvpInvite":"read","minigames.serials":"read","minigames.onGemSerial":"read","minigames.onMasterySerial":"read","minigames.onGemAward":"read","minigames.onPetMasteryAward":"read","minigames.onScore":"read","minigames.quit":"act","minigames.playerInfo":"read","minigames.gameNameId":"read","minigames.isMemberAccountType":"read","minigames.ticTacToe.board":"read","minigames.ticTacToe.opponent":"read","minigames.ticTacToe.myTurn":"read","minigames.ticTacToe.mark":"act","minigames.ticTacToe.onRoundStart":"read","minigames.ticTacToe.onMarked":"read","minigames.ticTacToe.onRoundEnd":"read","minigames.connectFour.board":"read","minigames.connectFour.opponent":"read","minigames.connectFour.myTurn":"read","minigames.connectFour.drop":"act","minigames.connectFour.onRoundStart":"read","minigames.connectFour.onDropped":"read","minigames.connectFour.onRoundEnd":"read","minigames.rockPaperScissors.opponent":"read","minigames.rockPaperScissors.choose":"act","minigames.rockPaperScissors.onRoundStart":"read","minigames.rockPaperScissors.onReveal":"read","minigames.shellGame.opponent":"read","minigames.shellGame.winningShell":"read","minigames.shellGame.pick":"act","minigames.shellGame.onRoundStart":"read","minigames.shellGame.onReveal":"read","minigames.trivia.current":"read","minigames.trivia.answer":"act","minigames.trivia.react":"act","minigames.trivia.onQuestion":"read","minigames.trueFalse.current":"read","minigames.trueFalse.answer":"act","minigames.trueFalse.react":"act","minigames.trueFalse.onQuestion":"read","achievements.stat":"read","achievements.stats":"read","achievements.readStat":"read","achievements.refreshStats":"read","achievements.setStat":"act","achievements.of":"read","achievements.onStatChange":"read","achievements.onAchievement":"read","achievements.onAchievements":"read","achievements.definition":"read","achievements.definitions":"read","achievements.hasUnseen":"read","achievements.showNew":"act","achievements.describe":"read","achievements.types":"read","achievements.catalogue":"read","achievements.held":"read","achievements.readStats":"read","achievements.statBit":"read","achievements.statType":"read","achievements.earn":"act","achievements.onStats":"read","achievements.definitionsByType":"read","membership.real":"read","membership.onChange":"read","membership.shown":"read","membership.showing":"read","membership.onShowing":"read","membership.show":"act","membership.stopShowing":"act","currency.gems":"read","currency.tickets":"read","currency.diamonds":"read","currency.balance":"read","currency.read":"read","currency.onChange":"read","currency.donateGems":"act","currency.redeemCode":"act","currency.onRedeemResult":"read","currency.onMembershipRedeemed":"read","currency.canAfford":"read","currency.wallet":"read","currency.craftingCurrencies":"read","currency.priceParts":"read","currency.exchangeDefinition":"read","currency.exchange":"act","currency.onExchange":"read","currency.onDonate":"read","currency.diamondsLoaded":"read","currency.diamondDefinitionId":"read","gui.tree":"read","gui.find":"read","gui.findAll":"read","gui.at":"read","gui.text":"read","gui.isVisible":"read","gui.isEnabled":"read","gui.bounds":"read","gui.popups":"read","gui.click":"act","gui.setText":"act","gui.focus":"act","gui.closePopup":"act","gui.onPopup":"read","gui.onText":"read","gui.onVisible":"read","gui.hud":"read","gui.hudPart":"read","gui.clickHud":"act","gui.chatBox":"read","gui.setChatBox":"act","gui.chatHistory":"read","gui.closeChatPanel":"act","gui.freeChatEnabled":"read","gui.onFreeChatChange":"read","gui.gems":"read","gui.diamonds":"read","gui.openMap":"act","gui.openBuddyList":"act","gui.open":"act","gui.screens":"read","gui.close":"act","gui.isModal":"read","gui.isReconnecting":"read","gui.focusChat":"act","gui.refreshHudAvatar":"act","gui.grayHudAvatar":"act","gui.toggleHud":"act","gui.isDarkened":"read","editor.isAvatarEditorOpen":"read","editor.avatarEditorColorTab":"read","editor.openAvatarEditorTab":"act","editor.onAvatarEditorTab":"read","editor.onAvatarEditorOpen":"read","editor.onAvatarEditorClose":"read","editor.isDenEditorOpen":"read","editor.toggleDenEditor":"act","editor.onDenEditorToggle":"read","editor.refreshDenLockSettings":"act","editor.reloadDenItems":"act","editor.clearDenInUseItems":"act","editor.isPetCreatorOpen":"read","editor.petCreatorTab":"read","editor.openPetCreatorTab":"act","editor.petCreatorColor":"read","editor.pickPetCreatorColor":"act","editor.onPetCreatorColorChange":"read","editor.onPetCreatorOpen":"read","editor.onPetCreatorClose":"read","popups.list":"read","popups.read":"read","popups.answer":"act","popups.onOpen":"read","popups.onClose":"read","popups.isOpen":"read","popups.close":"act","screens.isOpen":"read","screens.close":"act","screens.onOpen":"read","screens.onClose":"read","screens.denSwitcherIndex":"read","screens.serverName":"read","ui.skin":"act","ui.status":"read","ui.ready":"read","ui.readyTimeoutMs":"act","ui.theme":"read","ui.symbols":"read","ui.hasSymbol":"read","ui.symbol":"act","ui.window":"act","ui.button":"act","ui.label":"act","ui.input":"act","ui.checkbox":"act","ui.dropdown":"act","ui.tabs":"act","ui.list":"act","ui.grid":"act","ui.scroll":"act","ui.tooltip":"act","ui.progress":"act","ui.colors":"act","ui.places":"read","ui.place":"read","ui.screens":"read","ui.onScreen":"read","ui.attach":"act","ui.replace":"act","ui.piece":"act","ui.paletteValues":"read","ui.feed":"act","ui.hide":"act","ui.clear":"act","ui.popup.message":"act","ui.popup.ok":"act","ui.popup.okCancel":"act","ui.popup.yesNo":"act","ui.popup.titled":"act","ui.popup.parchment":"act","ui.popup.closeAll":"act","localization.currentLanguage":"read","localization.setLanguage":"act","localization.hasLocalizations":"read","localization.translate":"read","localization.translatePreferred":"read","localization.translateWithValues":"read","localization.translateAvatarName":"read","localization.translatePetName":"read","localization.translateRichText":"read","localization.isReversed":"read","localization.languageId":"read","localization.onLanguageChange":"read","localization.onReady":"read","localization.accountLanguage":"read","localization.languageForLocale":"read","localization.sortingLocale":"read","localization.numberLocale":"read","localization.countryCode":"read","content.available":"read","content.replacements":"read","content.onRequest":"read","content.replace":"act","content.restore":"act","community.available":"read","community.hidden":"read","community.onHidden":"read","community.hide":"act","community.unhide":"act","community.report":"act","customRooms.available":"read","customRooms.current":"read","customRooms.onEnter":"read","customRooms.onLeave":"read","customRooms.onMove":"read","customRooms.onChat":"read","customRooms.onPropEnter":"read","customRooms.onPropLeave":"read","customRooms.onPropNear":"read","customRooms.onPropClick":"read","customRooms.shared":"read","customRooms.define":"act","customRooms.remove":"act","customRooms.enter":"act","customRooms.leave":"act","realtime.available":"read","realtime.status":"read","realtime.onStatus":"read","realtime.channels":"read","realtime.members":"read","realtime.state":"read","realtime.presence":"read","realtime.host":"read","realtime.onMessage":"read","realtime.onJoin":"read","realtime.onLeave":"read","realtime.onState":"read","realtime.onPresence":"read","realtime.onHost":"read","realtime.onClose":"read","realtime.open":"act","realtime.leave":"act","realtime.send":"act","realtime.sendTo":"act","realtime.onAsk":"read","realtime.ask":"act","realtime.answer":"act","realtime.decline":"act","realtime.setState":"act","realtime.setPresence":"act","realtime.giveHost":"act","journeyBook.counts":"read","journeyBook.unseenPages":"read","journeyBook.unclaimedGifts":"read","journeyBook.onChange":"read","journeyBook.open":"act","referrals.code":"read","referrals.clientCode":"read","referrals.fetchCode":"read","referrals.hasReferrer":"read","referrals.list":"read","referrals.onCode":"read","referrals.onHasReferrer":"read","referrals.onReferrerNamed":"read","referrals.onList":"read","referrals.nameReferrer":"act","avatar.noClip":"read","avatar.onNoClip":"read","input.bound":"read","input.onShortcut":"read","input.bind":"act","input.unbind":"act","view.state":"read","view.zoom":"read","view.zoomLimits":"read","view.onChange":"read","view.setZoom":"act","view.resetZoom":"act","view.showInterface":"act","view.showOwnAvatar":"act","view.showOwnNameTag":"act","session.markActive":"act","session.keepActive":"act","session.stopKeepingActive":"act","session.keepingActive":"read","session.onIdleWarning":"read","popups.skipAtLogin":"act","popups.stopSkippingAtLogin":"act","popups.skippingAtLogin":"read","popups.onSkipped":"read","gui.pinCurrency":"act","gui.unpinCurrency":"act","gui.currencyPinned":"read","dens.placement":"read","dailyGift.unwrap":"act","dailyGift.onOpen":"read","dailyGift.wheelOpen":"read","dailyGift.spinWheel":"act","dailyGift.onWheelOpen":"read","buddies.whereabouts":"read","buddies.whereaboutsOf":"read","buddies.onWhereabouts":"read","world.roomDefinitions":"read","looks.current":"read","looks.of":"read","looks.plan":"read","looks.onChange":"read","looks.putOn":"act","artStudio.isOpen":"read","artStudio.current":"read","artStudio.state":"read","artStudio.palette":"read","artStudio.picture":"read","artStudio.painting":"read","artStudio.planPainting":"read","artStudio.onOpen":"read","artStudio.onClose":"read","artStudio.onStroke":"read","artStudio.onToolChange":"read","artStudio.onColorChange":"read","artStudio.onClear":"read","artStudio.onSubmit":"read","artStudio.onSubmitted":"read","artStudio.onMasterpieceBought":"read","artStudio.onSaved":"read","artStudio.onBrowse":"read","artStudio.onPaintProgress":"read","artStudio.onPaintDone":"read","artStudio.open":"act","artStudio.close":"act","artStudio.setTool":"act","artStudio.setBrushSize":"act","artStudio.setColor":"act","artStudio.stroke":"act","artStudio.shape":"act","artStudio.fill":"act","artStudio.setCells":"act","artStudio.clear":"act","artStudio.undo":"act","artStudio.paintImage":"act","artStudio.startPainting":"act","artStudio.stopPainting":"act","artStudio.submit":"act","artStudio.createMasterpiece":"act","artStudio.openStorage":"act","artStudio.print":"act","artStudio.browse":"act","artStudio.startColouring":"act"};function M(r){const e=r.slice(r.lastIndexOf(".")+1);return/^on[A-Z]/.test(e)}function W(r){return Object.prototype.hasOwnProperty.call(h,r)}function D(r){return`sdk:${r.slice(0,r.indexOf("."))}:${h[r]}`}export{R as D,I as F,E as N,f as P,k as R,h as S,w as a,C as b,P as c,L as d,T as e,A as f,i as g,S as h,M as i,O as j,W as k,b as p,D as s};
|