@sockethub/examples 1.0.0-beta.5 → 1.0.0-beta.6

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.
Files changed (41) hide show
  1. package/build/_app/immutable/chunks/{yo1B285t.js → 07ylGzvL.js} +1 -1
  2. package/build/_app/immutable/chunks/{BEufgWz0.js → 5EUVsl4H.js} +1 -1
  3. package/build/_app/immutable/chunks/{wTGAw4y8.js → BDK5vUoz.js} +1 -1
  4. package/build/_app/immutable/chunks/{DZrh4NVE.js → BRuA5QdV.js} +1 -1
  5. package/build/_app/immutable/chunks/BZg_jQMS.js +1 -0
  6. package/build/_app/immutable/chunks/{DehUvw1i.js → BkPGNRvN.js} +1 -1
  7. package/build/_app/immutable/chunks/{CLpPY9Jp.js → Boj55s2Y.js} +1 -1
  8. package/build/_app/immutable/chunks/{DIcvT44P.js → CLdqsKKa.js} +1 -1
  9. package/build/_app/immutable/chunks/DMXUQGSP.js +1 -0
  10. package/build/_app/immutable/chunks/{tApYyOtF.js → DshV_ywF.js} +1 -1
  11. package/build/_app/immutable/entry/{app.BbkIp1G2.js → app.C0NXbi27.js} +2 -2
  12. package/build/_app/immutable/entry/start.fotkUet2.js +1 -0
  13. package/build/_app/immutable/nodes/{0.DSwZU-9P.js → 0.28e4pOMd.js} +1 -1
  14. package/build/_app/immutable/nodes/{1.51JJ2FlP.js → 1.Dggwcq-u.js} +1 -1
  15. package/build/_app/immutable/nodes/{10.B0ma2jo4.js → 10.-i0LjebR.js} +1 -1
  16. package/build/_app/immutable/nodes/{11.C6lMwURo.js → 11.DHG0UgU1.js} +1 -1
  17. package/build/_app/immutable/nodes/{12.DCNEAQNf.js → 12.Cy2ufrYb.js} +1 -1
  18. package/build/_app/immutable/nodes/{2.g-FF_oGR.js → 2.Cifckn20.js} +1 -1
  19. package/build/_app/immutable/nodes/{3.BihBGY9y.js → 3.wfo-kI2F.js} +1 -1
  20. package/build/_app/immutable/nodes/{4.CxXOlqnK.js → 4.DLcCSWvz.js} +1 -1
  21. package/build/_app/immutable/nodes/{5.LpN7rB59.js → 5.BF7cCrqq.js} +1 -1
  22. package/build/_app/immutable/nodes/{6.8_oL0Jwe.js → 6.CmtP5cQa.js} +1 -1
  23. package/build/_app/immutable/nodes/{7.BzZfgtu_.js → 7.CRCIUtcz.js} +1 -1
  24. package/build/_app/immutable/nodes/{8.D_3lUgJe.js → 8.CAm-eU-o.js} +1 -1
  25. package/build/_app/immutable/nodes/{9.GB0FEHre.js → 9.CCYl3sR6.js} +1 -1
  26. package/build/_app/version.json +1 -1
  27. package/build/caldav.html +7 -7
  28. package/build/carddav.html +7 -7
  29. package/build/dummy.html +7 -7
  30. package/build/email.html +7 -7
  31. package/build/feeds.html +7 -7
  32. package/build/index.html +7 -7
  33. package/build/instagram.html +7 -7
  34. package/build/irc.html +7 -7
  35. package/build/messenger.html +7 -7
  36. package/build/metadata.html +7 -7
  37. package/build/xmpp.html +7 -7
  38. package/package.json +4 -4
  39. package/build/_app/immutable/chunks/B2rCrZ6z.js +0 -1
  40. package/build/_app/immutable/chunks/QJ0LqQm_.js +0 -1
  41. package/build/_app/immutable/entry/start.By6-5HBf.js +0 -1
@@ -34,4 +34,4 @@ https://github.com/highlightjs/highlight.js/issues/2277`),et=ee,qe=fe),Se===void
34
34
  `)},l.prototype.displayStateStack=function(u,d){for(var w,P=0,$=0;$<u.length;$++){var E=u[$],m=E.rule.toString(E.dot);m===w?P++:(P>0&&d.push(" ^ "+P+" more lines identical to this"),P=0,d.push(" "+m)),w=m}},l.prototype.getSymbolDisplay=function(u){return a(u)},l.prototype.buildFirstStateStack=function(u,d){if(d.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var w=u.wantedBy[0],P=[u].concat(d),$=this.buildFirstStateStack(w,P);return $===null?null:[u].concat($)},l.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},l.prototype.restore=function(u){var d=u.index;this.current=d,this.table[d]=u,this.table.splice(d+1),this.lexerState=u.lexerState,this.results=this.finish()},l.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},l.prototype.finish=function(){var u=[],d=this.grammar.start,w=this.table[this.table.length-1];return w.states.forEach(function(P){P.rule.name===d&&P.dot===P.rule.symbols.length&&P.reference===0&&P.data!==l.fail&&u.push(P)}),u.map(function(P){return P.data})};function a(u){var d=typeof u;if(d==="string")return u;if(d==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function f(u){var d=typeof u;if(d==="string")return u;if(d==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:l,Grammar:o,Rule:r}})}),$l=K(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(o){return o[0]}var r=o=>[].concat(...o.map(i=>Array.isArray(i)?r(i):i));function n(o){return o?Array.isArray(o)?r(o).join(""):o:""}var s={Lexer:void 0,ParserRules:[{name:"Reverse_path",symbols:["Path"]},{name:"Reverse_path$string$1",symbols:[{literal:"<"},{literal:">"}],postprocess:o=>o.join("")},{name:"Reverse_path",symbols:["Reverse_path$string$1"]},{name:"Forward_path$subexpression$1$subexpression$1",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:"@"}],postprocess:function(o){return o.join("")}},{name:"Forward_path$subexpression$1",symbols:["Forward_path$subexpression$1$subexpression$1","Domain",{literal:">"}]},{name:"Forward_path",symbols:["Forward_path$subexpression$1"]},{name:"Forward_path$subexpression$2",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:">"}],postprocess:function(o){return o.join("")}},{name:"Forward_path",symbols:["Forward_path$subexpression$2"]},{name:"Forward_path",symbols:["Path"]},{name:"Path$ebnf$1$subexpression$1",symbols:["A_d_l",{literal:":"}]},{name:"Path$ebnf$1",symbols:["Path$ebnf$1$subexpression$1"],postprocess:e},{name:"Path$ebnf$1",symbols:[],postprocess:()=>null},{name:"Path",symbols:[{literal:"<"},"Path$ebnf$1","Mailbox",{literal:">"}]},{name:"A_d_l$ebnf$1",symbols:[]},{name:"A_d_l$ebnf$1$subexpression$1",symbols:[{literal:","},"At_domain"]},{name:"A_d_l$ebnf$1",symbols:["A_d_l$ebnf$1","A_d_l$ebnf$1$subexpression$1"],postprocess:o=>o[0].concat([o[1]])},{name:"A_d_l",symbols:["At_domain","A_d_l$ebnf$1"]},{name:"At_domain",symbols:[{literal:"@"},"Domain"]},{name:"Domain$ebnf$1",symbols:[]},{name:"Domain$ebnf$1$subexpression$1",symbols:[{literal:"."},"sub_domain"]},{name:"Domain$ebnf$1",symbols:["Domain$ebnf$1","Domain$ebnf$1$subexpression$1"],postprocess:o=>o[0].concat([o[1]])},{name:"Domain",symbols:["sub_domain","Domain$ebnf$1"]},{name:"sub_domain",symbols:["U_label"]},{name:"Let_dig",symbols:["ALPHA_DIGIT"],postprocess:e},{name:"Ldh_str$ebnf$1",symbols:[]},{name:"Ldh_str$ebnf$1",symbols:["Ldh_str$ebnf$1","ALPHA_DIG_DASH"],postprocess:o=>o[0].concat([o[1]])},{name:"Ldh_str",symbols:["Ldh_str$ebnf$1","Let_dig"]},{name:"U_Let_dig",symbols:["ALPHA_DIGIT_U"],postprocess:e},{name:"U_Ldh_str$ebnf$1",symbols:[]},{name:"U_Ldh_str$ebnf$1",symbols:["U_Ldh_str$ebnf$1","ALPHA_DIG_DASH_U"],postprocess:o=>o[0].concat([o[1]])},{name:"U_Ldh_str",symbols:["U_Ldh_str$ebnf$1","U_Let_dig"]},{name:"U_label$ebnf$1$subexpression$1",symbols:["U_Ldh_str"]},{name:"U_label$ebnf$1",symbols:["U_label$ebnf$1$subexpression$1"],postprocess:e},{name:"U_label$ebnf$1",symbols:[],postprocess:()=>null},{name:"U_label",symbols:["U_Let_dig","U_label$ebnf$1"]},{name:"address_literal$subexpression$1",symbols:["IPv4_address_literal"]},{name:"address_literal$subexpression$1",symbols:["IPv6_address_literal"]},{name:"address_literal$subexpression$1",symbols:["General_address_literal"]},{name:"address_literal",symbols:[{literal:"["},"address_literal$subexpression$1",{literal:"]"}]},{name:"non_local_part",symbols:["Domain"],postprocess:function(o){return{DomainName:n(o[0])}}},{name:"non_local_part",symbols:["address_literal"],postprocess:function(o){return{AddressLiteral:n(o[0])}}},{name:"Mailbox",symbols:["Local_part",{literal:"@"},"non_local_part"],postprocess:function(o){return{localPart:n(o[0]),domainPart:n(o[2])}}},{name:"Local_part",symbols:["Dot_string"],postprocess:function(o){return{DotString:n(o[0])}}},{name:"Local_part",symbols:["Quoted_string"],postprocess:function(o){return{QuotedString:n(o[0])}}},{name:"Dot_string$ebnf$1",symbols:[]},{name:"Dot_string$ebnf$1$subexpression$1",symbols:[{literal:"."},"Atom"]},{name:"Dot_string$ebnf$1",symbols:["Dot_string$ebnf$1","Dot_string$ebnf$1$subexpression$1"],postprocess:o=>o[0].concat([o[1]])},{name:"Dot_string",symbols:["Atom","Dot_string$ebnf$1"]},{name:"Atom$ebnf$1",symbols:[/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/]},{name:"Atom$ebnf$1",symbols:["Atom$ebnf$1",/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/],postprocess:o=>o[0].concat([o[1]])},{name:"Atom",symbols:["Atom$ebnf$1"]},{name:"Quoted_string$ebnf$1",symbols:[]},{name:"Quoted_string$ebnf$1",symbols:["Quoted_string$ebnf$1","QcontentSMTP"],postprocess:o=>o[0].concat([o[1]])},{name:"Quoted_string",symbols:["DQUOTE","Quoted_string$ebnf$1","DQUOTE"]},{name:"QcontentSMTP",symbols:["qtextSMTP"]},{name:"QcontentSMTP",symbols:["quoted_pairSMTP"]},{name:"quoted_pairSMTP",symbols:[{literal:"\\"},/[\x20-\x7e]/]},{name:"qtextSMTP",symbols:[/[\x20-\x21\x23-\x5b\x5d-\x7e\u0080-\uFFFF]/],postprocess:e},{name:"IPv4_address_literal$macrocall$2",symbols:[{literal:"."},"Snum"]},{name:"IPv4_address_literal$macrocall$1",symbols:["IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2"]},{name:"IPv4_address_literal",symbols:["Snum","IPv4_address_literal$macrocall$1"]},{name:"IPv6_address_literal$subexpression$1",symbols:[/[iI]/,/[pP]/,/[vV]/,{literal:"6"},{literal:":"}],postprocess:function(o){return o.join("")}},{name:"IPv6_address_literal",symbols:["IPv6_address_literal$subexpression$1","IPv6_addr"]},{name:"General_address_literal$ebnf$1",symbols:["dcontent"]},{name:"General_address_literal$ebnf$1",symbols:["General_address_literal$ebnf$1","dcontent"],postprocess:o=>o[0].concat([o[1]])},{name:"General_address_literal",symbols:["Standardized_tag",{literal:":"},"General_address_literal$ebnf$1"]},{name:"Standardized_tag",symbols:["Ldh_str"]},{name:"dcontent",symbols:[/[\x21-\x5a\x5e-\x7e]/],postprocess:e},{name:"Snum",symbols:["DIGIT"]},{name:"Snum$subexpression$1",symbols:[/[1-9]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$1"]},{name:"Snum$subexpression$2",symbols:[{literal:"1"},"DIGIT","DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$2"]},{name:"Snum$subexpression$3",symbols:[{literal:"2"},/[0-4]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$3"]},{name:"Snum$subexpression$4",symbols:[{literal:"2"},{literal:"5"},/[0-5]/]},{name:"Snum",symbols:["Snum$subexpression$4"]},{name:"IPv6_addr",symbols:["IPv6_full"]},{name:"IPv6_addr",symbols:["IPv6_comp"]},{name:"IPv6_addr",symbols:["IPv6v4_full"]},{name:"IPv6_addr",symbols:["IPv6v4_comp"]},{name:"IPv6_hex",symbols:["HEXDIG"]},{name:"IPv6_hex$subexpression$1",symbols:["HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$1"]},{name:"IPv6_hex$subexpression$2",symbols:["HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$2"]},{name:"IPv6_hex$subexpression$3",symbols:["HEXDIG","HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$3"]},{name:"IPv6_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_full$macrocall$1",symbols:["IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2"]},{name:"IPv6_full",symbols:["IPv6_hex","IPv6_full$macrocall$1"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$1",symbols:["IPv6_comp$ebnf$1$subexpression$1"],postprocess:e},{name:"IPv6_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:o=>o.join("")},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$2$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$2",symbols:["IPv6_comp$ebnf$2$subexpression$1"],postprocess:e},{name:"IPv6_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6_comp",symbols:["IPv6_comp$ebnf$1","IPv6_comp$string$1","IPv6_comp$ebnf$2"]},{name:"IPv6v4_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_full$macrocall$1",symbols:["IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2"]},{name:"IPv6v4_full",symbols:["IPv6_hex","IPv6v4_full$macrocall$1",{literal:":"},"IPv4_address_literal"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6v4_comp$ebnf$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1"],postprocess:e},{name:"IPv6v4_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:o=>o.join("")},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",{literal:":"}]},{name:"IPv6v4_comp$ebnf$2",symbols:["IPv6v4_comp$ebnf$2$subexpression$1"],postprocess:e},{name:"IPv6v4_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp",symbols:["IPv6v4_comp$ebnf$1","IPv6v4_comp$string$1","IPv6v4_comp$ebnf$2","IPv4_address_literal"]},{name:"DIGIT",symbols:[/[0-9]/],postprocess:e},{name:"ALPHA_DIGIT_U",symbols:[/[0-9A-Za-z\u0080-\uFFFF]/],postprocess:e},{name:"ALPHA_DIGIT",symbols:[/[0-9A-Za-z]/],postprocess:e},{name:"ALPHA_DIG_DASH",symbols:[/[-0-9A-Za-z]/],postprocess:e},{name:"ALPHA_DIG_DASH_U",symbols:[/[-0-9A-Za-z\u0080-\uFFFF]/],postprocess:e},{name:"HEXDIG",symbols:[/[0-9A-Fa-f]/],postprocess:e},{name:"DQUOTE",symbols:[{literal:'"'}],postprocess:e}],ParserStart:"Reverse_path"};t.default=s}),vs=K(function(t){var e=t&&t.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(t,"__esModule",{value:!0}),t.canonicalize=t.canonicalize_quoted_string=t.normalize=t.normalize_dot_string=t.parse=void 0;var r=bl(),n=e($l());n.default.ParserStart="Mailbox";var s=r.Grammar.fromCompiled(n.default);function o(u){if(u.length>986)throw new Error("address too long");const w=new r.Parser(s);if(w.feed(u),w.results.length!==1)throw new Error("address parsing failed: ambiguous grammar");const P=u.lastIndexOf("@"),$=u.substring(P+1);if($[0]!=="["){if($.length>253)throw new Error("domain too long");const E=$.split(".");if(E.length<2)throw new Error("domain not fully qualified");if(E[E.length-1].length<2)throw new Error("top level domain label too short");if(E.sort(function(m,c){return c.length-m.length}),E[0].length>63)throw new Error("domain label too long")}return w.results[0]}t.parse=o;function i(u){return function(){const P=u.indexOf("+");return P===-1?u:u.substr(0,P)}().replace(/\./g,"").toLowerCase()}t.normalize_dot_string=i;function l(u){var d,w;const P=o(u),$=(d=P.domainPart.AddressLiteral)!==null&&d!==void 0?d:P.domainPart.DomainName.toLowerCase();return`${(w=P.localPart.QuotedString)!==null&&w!==void 0?w:i(P.localPart.DotString)}@${$}`}t.normalize=l;function a(u){return`"${u.substr(1).substr(0,u.length-2).replace(/(?:\\(.))/g,"$1").replace(/(?:(["\\]))/g,"\\$1")}"`}t.canonicalize_quoted_string=a;function f(u){var d;const w=o(u),P=(d=w.domainPart.AddressLiteral)!==null&&d!==void 0?d:w.domainPart.DomainName.toLowerCase();return`${w.localPart.QuotedString?a(w.localPart.QuotedString):w.localPart.DotString}@${P}`}t.canonicalize=f}),El=K(function(t,e){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},l=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var w=r.call(d,"constructor"),P=d.constructor&&d.constructor.prototype&&r.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!w&&!P)return!1;var $;for($ in d);return typeof $>"u"||r.call(d,$)},a=function(d,w){s&&w.name==="__proto__"?s(d,w.name,{enumerable:!0,configurable:!0,value:w.newValue,writable:!0}):d[w.name]=w.newValue},f=function(d,w){if(w==="__proto__")if(r.call(d,w)){if(o)return o(d,w).value}else return;return d[w]};e.exports=function u(){var d,w,P,$,E,m,c=arguments[0],_=1,p=arguments.length,v=!1;for(typeof c=="boolean"&&(v=c,c=arguments[1]||{},_=2),(c==null||typeof c!="object"&&typeof c!="function")&&(c={});_<p;++_)if(d=arguments[_],d!=null)for(w in d)P=f(c,w),$=f(d,w),c!==$&&(v&&$&&(l($)||(E=i($)))?(E?(E=!1,m=P&&i(P)?P:[]):m=P&&l(P)?P:{},a(c,{name:w,newValue:u(v,m,$)})):typeof $<"u"&&a(c,{name:w,newValue:$}));return c}}),Sl=K(function(t,e){e.exports=[{scheme:"aaa",description:"Diameter Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6733"}]},{scheme:"aaas",description:"Diameter Protocol with Secure Transport",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6733"}]},{scheme:"about",description:"about",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6694"}]},{scheme:"acap",description:"application configuration access protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2244"}]},{scheme:"acct",description:"acct",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7565"}]},{scheme:"cap",description:"Calendar Access Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4324"}]},{scheme:"cid",description:"content identifier",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2392"}]},{scheme:"coap",description:"coap",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7252"}]},{scheme:"coaps",description:"coaps",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7252"}]},{scheme:"crid",description:"TV-Anytime Content Reference Identifier",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4078"}]},{scheme:"data",description:"data",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2397"}]},{scheme:"dav",description:"dav",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4918"}]},{scheme:"dict",description:"dictionary service protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2229"}]},{scheme:"dns",description:"Domain Name System",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4501"}]},{scheme:"example",description:"example",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7595"}]},{scheme:"file",description:"Host-specific file names",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc1738"}]},{scheme:"ftp",description:"File Transfer Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc1738"}]},{scheme:"geo",description:"Geographic Locations",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5870"}]},{scheme:"go",description:"go",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3368"}]},{scheme:"gopher",description:"The Gopher Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4266"}]},{scheme:"h323",description:"H.323",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3508"}]},{scheme:"http",description:"Hypertext Transfer Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7230"}]},{scheme:"https",description:"Hypertext Transfer Protocol Secure",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7230"}]},{scheme:"iax",description:"Inter-Asterisk eXchange Version 2",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5456"}]},{scheme:"icap",description:"Internet Content Adaptation Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3507"}]},{scheme:"im",description:"Instant Messaging",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3860"}]},{scheme:"imap",description:"internet message access protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5092"}]},{scheme:"info",description:`Information Assets with Identifiers in Public Namespaces.
35
35
  (section 3) defines an "info" registry
36
36
  of public namespaces, which is maintained by NISO and can be accessed
37
- from .`,reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4452"}]},{scheme:"ipp",description:"Internet Printing Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3510"}]},{scheme:"ipps",description:"Internet Printing Protocol over HTTPS",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7472"}]},{scheme:"iris",description:"Internet Registry Information Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3981"}]},{scheme:"iris.beep",description:"iris.beep",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3983"}]},{scheme:"iris.lwz",description:"iris.lwz",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4993"}]},{scheme:"iris.xpc",description:"iris.xpc",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4992"}]},{scheme:"iris.xpcs",description:"iris.xpcs",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4992"}]},{scheme:"jabber",description:"jabber",reference:[],template:"http://www.iana.org/assignments/uri-schemes/perm/jabber"},{scheme:"ldap",description:"Lightweight Directory Access Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4516"}]},{scheme:"mailto",description:"Electronic mail address",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6068"}]},{scheme:"mid",description:"message identifier",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2392"}]},{scheme:"msrp",description:"Message Session Relay Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4975"}]},{scheme:"msrps",description:"Message Session Relay Protocol Secure",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4975"}]},{scheme:"mtqp",description:"Message Tracking Query Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3887"}]},{scheme:"mupdate",description:"Mailbox Update (MUPDATE) Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3656"}]},{scheme:"news",description:"USENET news",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5538"}]},{scheme:"nfs",description:"network file system protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2224"}]},{scheme:"ni",description:"ni",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6920"}]},{scheme:"nih",description:"nih",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6920"}]},{scheme:"nntp",description:"USENET news using NNTP access",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5538"}]},{scheme:"opaquelocktoken",description:"opaquelocktokent",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4918"}]},{scheme:"pkcs11",description:"PKCS#11",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7512"}]},{scheme:"pop",description:"Post Office Protocol v3",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2384"}]},{scheme:"pres",description:"Presence",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3859"}]},{scheme:"reload",description:"reload",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6940"}]},{scheme:"rtsp",description:"Real-time Streaming Protocol (RTSP)",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2326"},{type:"draft",href:"http://www.iana.org/go/RFC-ietf-mmusic-rfc2326bis-40"}]},{scheme:"rtsps",description:"Real-time Streaming Protocol (RTSP) over TLS",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2326"},{type:"draft",href:"http://www.iana.org/go/RFC-ietf-mmusic-rfc2326bis-40"}]},{scheme:"rtspu",description:"Real-time Streaming Protocol (RTSP) over unreliable datagram transport",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2326"}]},{scheme:"service",description:"service location",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2609"}]},{scheme:"session",description:"session",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6787"}]},{scheme:"shttp",description:"Secure Hypertext Transfer Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2660"}]},{scheme:"sieve",description:"ManageSieve Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5804"}]},{scheme:"sip",description:"session initiation protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3261"}]},{scheme:"sips",description:"secure session initiation protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3261"}]},{scheme:"sms",description:"Short Message Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5724"}]},{scheme:"snmp",description:"Simple Network Management Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4088"}]},{scheme:"soap.beep",description:"soap.beep",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4227"}]},{scheme:"soap.beeps",description:"soap.beeps",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4227"}]},{scheme:"stun",description:"stun",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7064"}]},{scheme:"stuns",description:"stuns",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7064"}]},{scheme:"tag",description:"tag",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4151"}]},{scheme:"tel",description:"telephone",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3966"}]},{scheme:"telnet",description:"Reference to interactive sessions",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4248"}]},{scheme:"tftp",description:"Trivial File Transfer Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3617"}]},{scheme:"thismessage",description:"multipart/related relative reference resolution",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2557"}],template:"http://www.iana.org/assignments/uri-schemes/perm/thismessage"},{scheme:"tip",description:"Transaction Internet Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2371"}]},{scheme:"tn3270",description:"Interactive 3270 emulation sessions",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6270"}]},{scheme:"turn",description:"turn",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7065"}]},{scheme:"turns",description:"turns",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7065"}]},{scheme:"tv",description:"TV Broadcasts",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2838"}]},{scheme:"urn",description:"Uniform Resource Names",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2141"},{type:"registry",href:"http://www.iana.org/assignments/urn-namespaces"}]},{scheme:"vemmi",description:"versatile multimedia interface",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2122"}]},{scheme:"vnc",description:"Remote Framebuffer Protocol",reference:[{type:"draft",href:"http://www.iana.org/go/RFC-warden-appsawg-vnc-scheme-10"}]},{scheme:"ws",description:"WebSocket connections",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6455"}]},{scheme:"wss",description:"Encrypted WebSocket connections",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6455"}]},{scheme:"xcon",description:"xcon",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6501"}]},{scheme:"xcon-userid",description:"xcon-userid",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6501"}]},{scheme:"xmlrpc.beep",description:"xmlrpc.beep",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3529"}]},{scheme:"xmlrpc.beeps",description:"xmlrpc.beeps",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3529"}]},{scheme:"xmpp",description:"Extensible Messaging and Presence Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5122"}]},{scheme:"z39.50r",description:"Z39.50 Retrieval",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2056"}]},{scheme:"z39.50s",description:"Z39.50 Session",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2056"}]}]}),Pl=K(function(t,e){e.exports=[{scheme:"acr",description:"acr",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/acr"},{scheme:"adiumxtra",description:"adiumxtra",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/adiumxtra"},{scheme:"afp",description:"afp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/afp"},{scheme:"afs",description:"Andrew File System global file names",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc1738"}]},{scheme:"aim",description:"aim",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/aim"},{scheme:"appdata",description:"appdata",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/appdata"},{scheme:"apt",description:"apt",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/apt"},{scheme:"attachment",description:"attachment",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/attachment"},{scheme:"aw",description:"aw",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/aw"},{scheme:"barion",description:"barion",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/barion"},{scheme:"beshare",description:"beshare",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/beshare"},{scheme:"bitcoin",description:"bitcoin",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/bitcoin"},{scheme:"blob",description:"blob",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/blob"},{scheme:"bolo",description:"bolo",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/bolo"},{scheme:"callto",description:"callto",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/callto"},{scheme:"chrome",description:"chrome",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/chrome"},{scheme:"chrome-extension",description:"chrome-extension",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/chrome-extension"},{scheme:"com-eventbrite-attendee",description:"com-eventbrite-attendee",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/com-eventbrite-attendee"},{scheme:"content",description:"content",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/content"},{scheme:"cvs",description:"cvs",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/cvs"},{scheme:"dis",description:"dis",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dis"},{scheme:"dlna-playcontainer",description:"dlna-playcontainer",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dlna-playcontainer"},{scheme:"dlna-playsingle",description:"dlna-playsingle",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dlna-playsingle"},{scheme:"dntp",description:"dntp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dntp"},{scheme:"dtn",description:"DTNRG research and development",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5050"}]},{scheme:"dvb",description:"dvb",reference:[{type:"draft",href:"http://www.iana.org/go/draft-mcroberts-uri-dvb"}]},{scheme:"ed2k",description:"ed2k",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ed2k"},{scheme:"facetime",description:"facetime",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/facetime"},{scheme:"feed",description:"feed",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/feed"},{scheme:"feedready",description:"feedready",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/feedready"},{scheme:"finger",description:"finger",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/finger"},{scheme:"fish",description:"fish",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/fish"},{scheme:"gg",description:"gg",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/gg"},{scheme:"git",description:"git",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/git"},{scheme:"gizmoproject",description:"gizmoproject",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/gizmoproject"},{scheme:"gtalk",description:"gtalk",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/gtalk"},{scheme:"ham",description:"ham",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7046"}]},{scheme:"hcp",description:"hcp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/hcp"},{scheme:"icon",description:"icon",reference:[{type:"draft",href:"http://www.iana.org/go/draft-lafayette-icon-uri-scheme"}]},{scheme:"iotdisco",description:"iotdisco",reference:[{type:"uri",href:"http://www.iana.org/assignments/uri-schemes/prov/iotdisco.pdf"}],template:"http://www.iana.org/assignments/uri-schemes/prov/iotdisco"},{scheme:"ipn",description:"ipn",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6260"}]},{scheme:"irc",description:"irc",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/irc"},{scheme:"irc6",description:"irc6",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/irc6"},{scheme:"ircs",description:"ircs",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ircs"},{scheme:"isostore",description:"isostore",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/isostore"},{scheme:"itms",description:"itms",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/itms"},{scheme:"jar",description:"jar",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/jar"},{scheme:"jms",description:"Java Message Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6167"}]},{scheme:"keyparc",description:"keyparc",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/keyparc"},{scheme:"lastfm",description:"lastfm",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/lastfm"},{scheme:"ldaps",description:"ldaps",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ldaps"},{scheme:"magnet",description:"magnet",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/magnet"},{scheme:"maps",description:"maps",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/maps"},{scheme:"market",description:"market",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/market"},{scheme:"message",description:"message",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/message"},{scheme:"mms",description:"mms",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/mms"},{scheme:"ms-access",description:"ms-access",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-access"},{scheme:"ms-drive-to",description:"ms-drive-to",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-drive-to"},{scheme:"ms-enrollment",description:"ms-enrollment",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-enrollment"},{scheme:"ms-excel",description:"ms-excel",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-excel"},{scheme:"ms-getoffice",description:"ms-getoffice",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-getoffice"},{scheme:"ms-help",description:"ms-help",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-help"},{scheme:"ms-infopath",description:"ms-infopath",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-infopath"},{scheme:"ms-media-stream-id",description:"ms-media-stream-id",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-media-stream-id"},{scheme:"ms-powerpoint",description:"ms-powerpoint",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-powerpoint"},{scheme:"ms-project",description:"ms-project",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-project"},{scheme:"ms-publisher",description:"ms-publisher",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-publisher"},{scheme:"ms-search-repair",description:"ms-search-repair",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-search-repair"},{scheme:"ms-secondary-screen-controller",description:"ms-secondary-screen-controller",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-secondary-screen-controller"},{scheme:"ms-secondary-screen-setup",description:"ms-secondary-screen-setup",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-secondary-screen-setup"},{scheme:"ms-settings",description:"ms-settings",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings"},{scheme:"ms-settings-airplanemode",description:"ms-settings-airplanemode",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-airplanemode"},{scheme:"ms-settings-bluetooth",description:"ms-settings-bluetooth",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-bluetooth"},{scheme:"ms-settings-camera",description:"ms-settings-camera",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-camera"},{scheme:"ms-settings-cellular",description:"ms-settings-cellular",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-cellular"},{scheme:"ms-settings-cloudstorage",description:"ms-settings-cloudstorage",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-cloudstorage"},{scheme:"ms-settings-connectabledevices",description:"ms-settings-connectabledevices",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-connectabledevices"},{scheme:"ms-settings-displays-topology",description:"ms-settings-displays-topology",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-displays-topology"},{scheme:"ms-settings-emailandaccounts",description:"ms-settings-emailandaccounts",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-emailandaccounts"},{scheme:"ms-settings-language",description:"ms-settings-language",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-language"},{scheme:"ms-settings-location",description:"ms-settings-location",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-location"},{scheme:"ms-settings-lock",description:"ms-settings-lock",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-lock"},{scheme:"ms-settings-nfctransactions",description:"ms-settings-nfctransactions",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-nfctransactions"},{scheme:"ms-settings-notifications",description:"ms-settings-notifications",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-notifications"},{scheme:"ms-settings-power",description:"ms-settings-power",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-power"},{scheme:"ms-settings-privacy",description:"ms-settings-privacy",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-privacy"},{scheme:"ms-settings-proximity",description:"ms-settings-proximity",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-proximity"},{scheme:"ms-settings-screenrotation",description:"ms-settings-screenrotation",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-screenrotation"},{scheme:"ms-settings-wifi",description:"ms-settings-wifi",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-wifi"},{scheme:"ms-settings-workplace",description:"ms-settings-workplace",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-workplace"},{scheme:"ms-spd",description:"ms-spd",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-spd"},{scheme:"ms-transit-to",description:"ms-transit-to",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-transit-to"},{scheme:"ms-visio",description:"ms-visio",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-visio"},{scheme:"ms-walk-to",description:"ms-walk-to",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-walk-to"},{scheme:"ms-word",description:"ms-word",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-word"},{scheme:"msnim",description:"msnim",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/msnim"},{scheme:"mumble",description:"mumble",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/mumble"},{scheme:"mvn",description:"mvn",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/mvn"},{scheme:"notes",description:"notes",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/notes"},{scheme:"oid",description:"oid",reference:[{type:"draft",href:"http://www.iana.org/go/draft-larmouth-oid-iri"}],template:"http://www.iana.org/assignments/uri-schemes/prov/oid"},{scheme:"palm",description:"palm",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/palm"},{scheme:"paparazzi",description:"paparazzi",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/paparazzi"},{scheme:"platform",description:"platform",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/platform"},{scheme:"proxy",description:"proxy",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/proxy"},{scheme:"psyc",description:"psyc",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/psyc"},{scheme:"query",description:"query",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/query"},{scheme:"redis",description:"redis",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/redis"},{scheme:"rediss",description:"rediss",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/rediss"},{scheme:"res",description:"res",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/res"},{scheme:"resource",description:"resource",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/resource"},{scheme:"rmi",description:"rmi",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/rmi"},{scheme:"rsync",description:"rsync",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5781"}]},{scheme:"rtmfp",description:"rtmfp",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7425"}],template:"http://www.iana.org/assignments/uri-schemes/prov/rtmfp"},{scheme:"rtmp",description:"rtmp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/rtmp"},{scheme:"secondlife",description:"query",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/secondlife"},{scheme:"sftp",description:"query",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/sftp"},{scheme:"sgn",description:"sgn",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/sgn"},{scheme:"skype",description:"skype",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/skype"},{scheme:"smb",description:"smb",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/smb"},{scheme:"smtp",description:"smtp",reference:[{type:"draft",href:"http://www.iana.org/go/draft-melnikov-smime-msa-to-mda"}],template:"http://www.iana.org/assignments/uri-schemes/prov/smtp"},{scheme:"soldat",description:"soldat",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/soldat"},{scheme:"spotify",description:"spotify",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/spotify"},{scheme:"ssh",description:"ssh",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ssh"},{scheme:"steam",description:"steam",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/steam"},{scheme:"submit",description:"submit",reference:[{type:"draft",href:"http://www.iana.org/go/draft-melnikov-smime-msa-to-mda"}],template:"http://www.iana.org/assignments/uri-schemes/prov/submit"},{scheme:"svn",description:"svn",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/svn"},{scheme:"teamspeak",description:"teamspeak",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/teamspeak"},{scheme:"teliaeid",description:"teliaeid",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/teliaeid"},{scheme:"things",description:"things",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/things"},{scheme:"tool",description:"tool",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/tool"},{scheme:"udp",description:"udp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/udp"},{scheme:"unreal",description:"unreal",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/unreal"},{scheme:"ut2004",description:"ut2004",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ut2004"},{scheme:"v-event",description:"v-event",reference:[{type:"draft",href:"http://www.iana.org/go/draft-menderico-v-event-uri"}],template:"http://www.iana.org/assignments/uri-schemes/prov/v-event"},{scheme:"ventrilo",description:"ventrilo",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ventrilo"},{scheme:"view-source",description:"view-source",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/view-source"},{scheme:"webcal",description:"webcal",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/webcal"},{scheme:"wpid",description:"wpid",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/wpid"},{scheme:"wtai",description:"wtai",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/wtai"},{scheme:"wyciwyg",description:"wyciwyg",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/wyciwyg"},{scheme:"xfire",description:"xfire",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/xfire"},{scheme:"xri",description:"xri",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/xri"},{scheme:"ymsgr",description:"ymsgr",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ymsgr"}]}),kl=K(function(t,e){e.exports=[{scheme:"fax",description:"fax",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2806"},{type:"rfc",href:"http://www.iana.org/go/rfc3966"}]},{scheme:"filesystem",description:"filesystem",reference:[],template:"http://www.iana.org/assignments/uri-schemes/historic/filesystem"},{scheme:"mailserver",description:"Access to data available from mail servers",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6196"}]},{scheme:"modem",description:"modem",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2806"},{type:"rfc",href:"http://www.iana.org/go/rfc3966"}]},{scheme:"pack",description:"pack",reference:[{type:"draft",href:"http://www.iana.org/go/draft-shur-pack-uri-scheme"}],template:"http://www.iana.org/assignments/uri-schemes/historic/pack"},{scheme:"prospero",description:"Prospero Directory Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4157"}]},{scheme:"snews",description:"NNTP over SSL/TLS",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5538"}]},{scheme:"videotex",description:"videotex",reference:[{type:"draft",href:"http://www.iana.org/go/draft-mavrakis-videotex-url-spec"},{type:"rfc",href:"http://www.iana.org/go/rfc2122"},{type:"rfc",href:"http://www.iana.org/go/rfc3986"}],template:"http://www.iana.org/assignments/uri-schemes/historic/videotex"},{scheme:"wais",description:"Wide Area Information Servers",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4156"}]},{scheme:"z39.50",description:"Z39.50 information access",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc1738"},{type:"rfc",href:"http://www.iana.org/go/rfc2056"}]}]}),Ol=K(function(t,e){e.exports=[{scheme:"android-app"},{scheme:"webpack"},{scheme:"s3",description:"Amazon Web Services S3 bucket"},{scheme:"gs",description:"Google Cloud Storage"},{scheme:"mqtt",description:"Message Queuing Telemetry Transport Protocol"},{scheme:"modbus+tcp",description:"Modbus over TCP"}]}),Xi=K(function(t,e){var r=El(),n={permanent:Sl(),provosional:Pl(),historical:kl()},s={};Object.keys(n).forEach(function(o){n[o].forEach(function(i){s[i.scheme]=r(i,{type:o})})}),n.unofficial=Ol().filter(function(o){return!s[o.scheme]}),n.unofficial.forEach(function(o){s[o.scheme]=r(o,{type:"unofficial"})}),e.exports=r(n,{allByName:s})}),Nl=K(function(t,e){var{parse:r}=ms(),{addressParser:n}=vs(),s=Xi();function o(i){try{return n(i),!0}catch{return!1}}e.exports=i=>{const l=r(i);return!!(l.scheme==="mailto"&&l.to.every(o)||l.reference==="absolute"&&s.allByName[l.scheme])}}),Tl=K(function(t,e){e.exports=/^P(?!$)(\d+(?:\.\d+)?Y)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?W)?(\d+(?:\.\d+)?D)?(T(?=\d)(\d+(?:\.\d+)?H)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?S)?)?$/}),Rl=K(function(t,e){var{parse:r}=vs();e.exports=n=>{try{return r(n),!0}catch{return!1}}}),Il={};function Yi(t){return this[t]}function Cl(t,e){this[t]=Dl.bind(null,e)}var Zi,ea,Sr,ys,rn,Al=(t,e,r)=>{var n=e&&typeof e=="object"||typeof e=="function"?ys(e):[];for(let s of n)!rn.call(t,s)&&s!=="default"&&Sr(t,s,{get:Yi.bind(e,s),enumerable:!0})},jl,Ws=(t,e,r)=>{var n=t!=null&&typeof t=="object";if(n){var s=jl??(jl=new WeakMap),o=s.get(t);if(o)return o}r=t!=null?Zi(ea(t)):{};let i=e||!t||!t.__esModule||!rn.call(t,"default")?Sr(r,"default",{value:t,enumerable:!0}):r;if(t&&typeof t=="object"||typeof t=="function")for(let l of ys(t))rn.call(i,l)||Sr(i,l,{get:Yi.bind(t,l),enumerable:!0});return n&&s.set(t,i),i},Ml=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dl=t=>t,ql=(t,e)=>{for(var r in e)Sr(t,r,{get:e[r],enumerable:!0,configurable:!0,set:Cl.bind(e,r)})},An,jn,Mn,Ll,Vl=Dc(()=>{Zi=Object.create,{getPrototypeOf:ea,defineProperty:Sr,getOwnPropertyNames:ys}=Object,rn=Object.prototype.hasOwnProperty,An=Ml(function(t,e){var r=/^xn--/,n=/[^\0-\x7F]/,s=/[\x2E\u3002\uFF0E\uFF61]/g,o={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},i=Math.floor,l=String.fromCharCode;function a(b){throw RangeError(o[b])}function f(b,g){let h=[],S=b.length;for(;S--;)h[S]=g(b[S]);return h}function u(b,g){let h=b.split("@"),S="";h.length>1&&(S=h[0]+"@",b=h[1]),b=b.replace(s,".");let O=b.split("."),C=f(O,g).join(".");return S+C}function d(b){let g=[],h=0,S=b.length;for(;h<S;){let O=b.charCodeAt(h++);if(O>=55296&&O<=56319&&h<S){let C=b.charCodeAt(h++);(C&64512)==56320?g.push(((O&1023)<<10)+(C&1023)+65536):(g.push(O),h--)}else g.push(O)}return g}var w=b=>String.fromCodePoint(...b),P=function(b){return b>=48&&b<58?26+(b-48):b>=65&&b<91?b-65:b>=97&&b<123?b-97:36},$=function(b,g){return b+22+75*(b<26)-((g!=0)<<5)},E=function(b,g,h){let S=0;for(b=h?i(b/700):b>>1,b+=i(b/g);b>455;S+=36)b=i(b/35);return i(S+36*b/(b+38))},m=function(b){let g=[],h=b.length,S=0,O=128,C=72,D=b.lastIndexOf("-");D<0&&(D=0);for(let q=0;q<D;++q)b.charCodeAt(q)>=128&&a("not-basic"),g.push(b.charCodeAt(q));for(let q=D>0?D+1:0;q<h;){let X=S;for(let Z=1,ce=36;;ce+=36){q>=h&&a("invalid-input");let ye=P(b.charCodeAt(q++));ye>=36&&a("invalid-input"),ye>i((2147483647-S)/Z)&&a("overflow"),S+=ye*Z;let Re=ce<=C?1:ce>=C+26?26:ce-C;if(ye<Re)break;let ie=36-Re;Z>i(2147483647/ie)&&a("overflow"),Z*=ie}let G=g.length+1;C=E(S-X,G,X==0),i(S/G)>2147483647-O&&a("overflow"),O+=i(S/G),S%=G,g.splice(S++,0,O)}return String.fromCodePoint(...g)},c=function(b){let g=[];b=d(b);let h=b.length,S=128,O=0,C=72;for(let X of b)X<128&&g.push(l(X));let D=g.length,q=D;for(D&&g.push("-");q<h;){let X=2147483647;for(let Z of b)Z>=S&&Z<X&&(X=Z);let G=q+1;X-S>i((2147483647-O)/G)&&a("overflow"),O+=(X-S)*G,S=X;for(let Z of b)if(Z<S&&++O>2147483647&&a("overflow"),Z===S){let ce=O;for(let ye=36;;ye+=36){let Re=ye<=C?1:ye>=C+26?26:ye-C;if(ce<Re)break;let ie=ce-Re,z=36-Re;g.push(l($(Re+ie%z,0))),ce=i(ie/z)}g.push(l($(ce,0))),C=E(O,G,q===D),O=0,++q}++O,++S}return g.join("")},_=function(b){return u(b,function(g){return r.test(g)?m(g.slice(4).toLowerCase()):g})},p=function(b){return u(b,function(g){return n.test(g)?"xn--"+c(g):g})},v={version:"2.3.1",ucs2:{decode:d,encode:w},decode:m,encode:c,toASCII:p,toUnicode:_};e.exports=v}),jn={},ql(jn,{default:()=>Mn.default}),Al(jn,Ws(An())),Mn=Ws(An()),Ll=Mn.default}),Ul=K(function(t,e){var{toASCII:r}=(Vl(),Mc(Il)),n=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;e.exports=s=>{const o=r(s);return o.replace(/\.$/,"").length<=253&&n.test(o)}}),Fl=K(function(t,e){var{parse:r}=ms(),{addressParser:n}=vs(),s=Xi();function o(i){try{return n(i),!0}catch{return!1}}e.exports=i=>{const l=r(i);return l.scheme==="mailto"&&l.to.every(o)||l.reference==="absolute"&&l.path!==void 0&&s.allByName[l.scheme]?!0:l.scheme&&!s.allByName[l.scheme]?!1:l.path!==void 0&&(l.reference==="relative"||l.reference==="same-document"||l.reference==="uri")}}),zl=K(function(t,e){t.iri=Nl(),t.duration=Tl(),t["idn-email"]=Rl(),t["idn-hostname"]=Ul(),t["iri-reference"]=Fl()}),Bl=K(function(t,e){var r=zl();e.exports=(n,s={})=>{const o=Object.keys(r);let i=o;if(s.formats){if(!Array.isArray(s.formats))throw new Error("options.formats must be an array");i=s.formats}return o.filter(l=>i.includes(l)).forEach(l=>{n.addFormat(l,r[l])}),n}}),xl=K(function(t,e){var r=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function o(f,u,d){this.fn=f,this.context=u,this.once=d||!1}function i(f,u,d,w,P){if(typeof d!="function")throw new TypeError("The listener must be a function");var $=new o(d,w||f,P),E=n?n+u:u;return f._events[E]?f._events[E].fn?f._events[E]=[f._events[E],$]:f._events[E].push($):(f._events[E]=$,f._eventsCount++),f}function l(f,u){--f._eventsCount===0?f._events=new s:delete f._events[u]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],d,w;if(this._eventsCount===0)return u;for(w in d=this._events)r.call(d,w)&&u.push(n?w.slice(1):w);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=n?n+u:u,w=this._events[d];if(!w)return[];if(w.fn)return[w.fn];for(var P=0,$=w.length,E=new Array($);P<$;P++)E[P]=w[P].fn;return E},a.prototype.listenerCount=function(u){var d=n?n+u:u,w=this._events[d];return w?w.fn?1:w.length:0},a.prototype.emit=function(u,d,w,P,$,E){var m=n?n+u:u;if(!this._events[m])return!1;var c=this._events[m],_=arguments.length,p,v;if(c.fn){switch(c.once&&this.removeListener(u,c.fn,void 0,!0),_){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,d),!0;case 3:return c.fn.call(c.context,d,w),!0;case 4:return c.fn.call(c.context,d,w,P),!0;case 5:return c.fn.call(c.context,d,w,P,$),!0;case 6:return c.fn.call(c.context,d,w,P,$,E),!0}for(v=1,p=new Array(_-1);v<_;v++)p[v-1]=arguments[v];c.fn.apply(c.context,p)}else{var b=c.length,g;for(v=0;v<b;v++)switch(c[v].once&&this.removeListener(u,c[v].fn,void 0,!0),_){case 1:c[v].fn.call(c[v].context);break;case 2:c[v].fn.call(c[v].context,d);break;case 3:c[v].fn.call(c[v].context,d,w);break;case 4:c[v].fn.call(c[v].context,d,w,P);break;default:if(!p)for(g=1,p=new Array(_-1);g<_;g++)p[g-1]=arguments[g];c[v].fn.apply(c[v].context,p)}}return!0},a.prototype.on=function(u,d,w){return i(this,u,d,w,!1)},a.prototype.once=function(u,d,w){return i(this,u,d,w,!0)},a.prototype.removeListener=function(u,d,w,P){var $=n?n+u:u;if(!this._events[$])return this;if(!d)return l(this,$),this;var E=this._events[$];if(E.fn)E.fn===d&&(!P||E.once)&&(!w||E.context===w)&&l(this,$);else{for(var m=0,c=[],_=E.length;m<_;m++)(E[m].fn!==d||P&&!E[m].once||w&&E[m].context!==w)&&c.push(E[m]);c.length?this._events[$]=c.length===1?c[0]:c:l(this,$)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&l(this,d)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,typeof e<"u"&&(e.exports=a)}),Hl="https://www.w3.org/ns/activitystreams",Kl="https://sockethub.org/ns/context/v1.jsonld",Gl="error",Wl="https://sockethub.org/ns/context/platform/error/v1.jsonld",Jl="sockethub:internal",Ql="https://sockethub.org/ns/context/platform/sockethub:internal/v1.jsonld",_s=new Map,ta=new Map,ra=new Map;function Xl(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function Yl(t){return Xl(t["@context"])}function na(t,e,r,n){_s.set(e,t),ta.set(e,r),ra.set(e,n)}function mn(t){const r=Yl(t).filter(n=>_s.has(n));return r.length!==1?null:r[0]}function sa(t){return _s.get(t)}function Zl(t){return ta.get(t)}function ef(t){return ra.get(t)}var ia={feed:{required:["id","type"],additionalProperties:!0,properties:{type:{enum:["feed"]},id:{type:"string",format:"iri"},name:{type:"string"},description:{type:"string"},author:{type:"string"},favicon:{type:"string"}}},person:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["person"]},name:{type:"string"}}},room:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["room"]},name:{type:"string"}}},service:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["service"]},name:{type:"string"}}},platform:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["platform"]},name:{type:"string"}}},website:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string",format:"iri"},type:{enum:["website"]},name:{type:"string"}}},address:{required:["type"],additionalProperties:!1,properties:{type:{enum:["address"]}}},calendar:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string",format:"iri"},type:{enum:["calendar"]},name:{type:"string"},components:{type:"array",items:{enum:["event","task"]}}}},addressBook:{required:["id","type"],additionalProperties:!1,properties:{id:{type:"string",format:"iri"},type:{enum:["addressBook"]}}}},tf=Object.keys(ia),aa=["person","room","service","feed","website","platform"],oa=["person","room","service","feed","website","platform","address","calendar","addressBook"],rf=aa.map(t=>({$ref:`#/definitions/type/${t}`})),nf=oa.map(t=>({$ref:`#/definitions/type/${t}`})),sf={type:"array",minItems:3,maxItems:3,items:{type:"string"},allOf:[{contains:{const:Hl}},{contains:{const:Kl}}]},af={type:"string"},of={$id:"https://sockethub.org/schemas/v/activity-stream.json",description:"Schema for Sockethub Activity Streams",type:"object",required:["@context","type","actor"],additionalProperties:!1,properties:{"@context":sf,id:{type:"string"},type:af,actor:{type:"object",oneOf:rf},target:{type:"object",oneOf:nf},object:{type:"object"},published:{type:"string",format:"date-time"}},definitions:{type:ia}},cf={version:"3.0.0-beta.5"};function uf(t,e){return t.replace("/v/",`/${e}/`)}var lf={$id:"https://sockethub.org/schemas/v/sockethub-config.json"};uf(lf.$id,cf.version);var ff=Pr(Hi()),jr,Js=!1;function gn(){if(jr===void 0)try{new Function("return true"),jr=!0}catch{jr=!1}return jr}function vn(){Js||(Js=!0,console.warn("[@sockethub/schemas] Schema validation is disabled: this environment's Content Security Policy blocks `new Function`, which Ajv needs to compile schemas. The Sockethub server still validates every message."))}var Qs={type:"integer",minimum:0},df={type:"string",minLength:1},Xs={type:"string",pattern:"^/(?![/\\\\])[^\\s\\\\]*$"},hf={$id:"https://sockethub.org/schemas/v/service-descriptor.json",description:"Sockethub service descriptor",type:"object",required:["name","apiVersion","platforms"],additionalProperties:!0,properties:{name:{const:"sockethub"},apiVersion:Qs,endpoints:{type:"object",required:["socketIO"],additionalProperties:!0,properties:{socketIO:Xs,httpActions:Xs}},platforms:{type:"array",items:{type:"object",required:["id","apiVersion"],additionalProperties:!0,properties:{id:df,apiVersion:Qs}}}}},Dn,Ys;function pf(t){return gn()?(Dn||(Dn=new ff.default({strictTypes:!1,allErrors:!0})),Ys??(Ys=Dn.compile(hf)),Ys(t)):(vn(),mf(t))}function mf(t){if(!t||typeof t!="object")return!1;const e=t;if(e.name!=="sockethub"||!Zs(e.apiVersion)||!Array.isArray(e.platforms))return!1;for(const r of e.platforms){if(!r||typeof r!="object")return!1;const n=r;if(typeof n.id!="string"||n.id.length===0||!Zs(n.apiVersion))return!1}if(e.endpoints!==void 0){if(!e.endpoints||typeof e.endpoints!="object")return!1;const r=e.endpoints;if(!ei(r.socketIO)||r.httpActions!==void 0&&!ei(r.httpActions))return!1}return!0}function Zs(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function ei(t){return typeof t=="string"&&/^\/(?![/\\])[^\s\\]*$/.test(t)}var gf=Pr(Hi()),vf=Pr(wl()),yf=Pr(Bl());function _f(t){let e=`${t.instancePath?t.instancePath:"activity stream"}: ${t.message}`;return t.keyword==="additionalProperties"?e+=`: ${t.params.additionalProperty}`:t.keyword==="enum"&&(e+=`: ${t.params.allowedValues.join(", ")}`),e}var wf=64;function wr(t,e=0){const r=[];if(e>wf)return r;t!=null&&t.type&&r.push(t.type);const n=t;for(const s in n){const o=n[s];o&&typeof o=="object"&&"type"in o&&r.push(...wr(o,e+1))}return r}function bf(t){const e=t.schemaPath.match(/#\/\w+\/\w+\/([\w-]+)\//);return e?e[1]:void 0}function $f(t){const e=t.instancePath.match(/\/(\w+)/);return e?e[1]:void 0}function Ef(t,e){const r=bf(t),n=$f(t);if(!n)return-1;const s=e[n];return!s||!r||!s.includes(r)?-1:t.instancePath.split("/").length}function Sf(t){if(!Array.isArray(t["@context"]))return{actor:[],target:[],object:wr(t)};const e=t;return{actor:wr(e.actor),target:wr(e.target),object:e.object?wr(e.object):[]}}function Pf(t,e,r){const n=Sf(t);let s=0,o=-1;for(let i=0;i<e.length;i++){const l=Ef(e[i],n);l>o&&(o=l,s=i)}return o>=0?_f(e[s]):Of(e[e.length-1],r)}function kf(t,e){if(!(e!=null&&e.excludeTypes)||e.excludeTypes.length===0)return t;const r=new Set(e.excludeTypes);return t.filter(n=>!r.has(n))}function Of(t,e){let r;if(t.keyword==="oneOf"){const n=t.instancePath.split("/")[1],s=n==="actor"?aa:n==="target"?oa:tf,o=kf(s,e),i=o.length>0?o:s;r=`${t.instancePath}: ${t.message}: ${i.join(", ")}`}else r=`${t.instancePath?t.instancePath:"activity stream"}: ${t.message}`;return"additionalProperty"in t.params&&(r+=`: ${t.params.additionalProperty}`),r}var qt="https://sockethub.org/schemas/v0",Qn={},Nf={},ti=!1;Qn[`${qt}/activity-stream`]=of;var qn;function ws(){if(!gn()){vn();return}if(!qn){const t=new gf.default({strictTypes:!1,allErrors:!0});vf.default(t),yf.default(t);for(const e in Qn)t.addSchema(Qn[e],e);qn=t}return qn}function ri(t,e){na(t,e,`${qt}/context/${t}/messages`,`${qt}/context/${t}/credentials`);const r=ws();if(!r)return;const n=`${qt}/context/${t}/messages`;r.getSchema(n)||r.addSchema({},n);const s=`${qt}/context/${t}/credentials`;r.getSchema(s)||r.addSchema({},s)}function Tf(){ti||(ri(Gl,Wl),ri(Jl,Ql),ti=!0)}Tf();function nn(t,e){const r=ws();if(!r)return"";const n=r.getSchema(t);if(!n)return`schema ${t} not found`;if(!n(e)){let o=Pf(e,n.errors,Nf);if(Array.isArray(e["@context"])){const i=mn(e);if(i){const l=sa(i);l&&(o=`[${l}] ${o}`)}}return o}return""}function Rf(t){if(!gn())return vn(),"";const e=nn(`${qt}/activity-stream`,t);if(e)return e;const r=mn(t);if(!r)return"activity streams must have exactly one registered platform context URL in @context";const n=Zl(r);return n?nn(n,t):`platform context URL ${r} does not have a registered message schema`}function If(t){if(!gn())return vn(),"";if(!Array.isArray(t["@context"]))return"credential activity streams must have an @context set";if(t.type!=="credentials")return"credential activity streams must have credentials set as type";const e=nn(`${qt}/activity-stream`,t);if(e)return e;const r=mn(t);if(!r)return"credential activity streams must have exactly one registered platform context URL in @context";const n=ef(r);return n?nn(n,t):`platform context URL ${r} does not have a registered credentials schema`}function ni(t,e){const r=ws();if(!r)return;const n=`${qt}/context/${e}`;r.removeSchema(n),r.addSchema(t,n)}function Cf(t,e){na(t,e,`${qt}/context/${t}/messages`,`${qt}/context/${t}/credentials`)}function sn(t){const e=mn(t);return e?sa(e)??null:null}var si={actor:"id",target:"id",object:"content"};function Af(t,e){return typeof t=="string"?{[e]:t}:Array.isArray(t)?t.map(r=>typeof r=="string"?{id:r}:r):t}function Vr(t){const e={...t};for(const r of Object.keys(si))r in e&&(e[r]=Af(e[r],si[r]));return e}var jf=Pr(xl()),Mf=jf.default,Df=/^v?(\d+)(?:\.\d+){0,2}(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;function Ln(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function ii(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0}function ai(t){if(!t||typeof t!="object")return;const{apiVersion:e,version:r}=t;if(ii(e))return e;if(typeof r=="string"){const n=Df.exec(r.trim()),s=n?Number(n[1]):void 0;if(ii(s))return s}}function qf(t){var i,l;if(!t||typeof t!="object")return;const e=t,r=(i=e.contexts)==null?void 0:i.as,n=(l=e.contexts)==null?void 0:l.sockethub;if(typeof r!="string"||typeof n!="string"||!Array.isArray(e.platforms))return;const s=ai(e);if(s===void 0)return;const o=new Map;for(const a of e.platforms){if(!a||typeof a!="object"||typeof a.id!="string"||typeof a.contextUrl!="string"||typeof a.contextVersion!="string"||typeof a.schemaVersion!="string")continue;const f=ai(a);if(f===void 0)continue;const u=Ln(a.schemas)?a.schemas:{};o.set(a.id,{id:a.id,apiVersion:f,contextUrl:a.contextUrl,contextVersion:a.contextVersion,schemaVersion:a.schemaVersion,types:Array.isArray(a.types)?a.types.filter(d=>typeof d=="string"):[],schemas:{credentials:Ln(u.credentials)?u.credentials:void 0,messages:Ln(u.messages)?u.messages:void 0}})}return{apiVersion:s,asContextUrl:r,sockethubContextUrl:n,platforms:o}}function Lf(t){Cf(t.id,t.contextUrl);try{t.schemas.credentials&&ni(t.schemas.credentials,`${t.id}/credentials`),t.schemas.messages&&ni(t.schemas.messages,`${t.id}/messages`)}catch(e){const r=e instanceof Error?e.message:String(e);console.warn(`[SockethubClient] Failed to register schemas for platform ${t.id}: ${r}`)}}class Kt extends Error{constructor(e,r){super(e,r),this.name="DiscoveryError"}}async function Vf(t,e={}){let r;try{r=new URL(t)}catch(f){throw new Kt(`Sockethub discovery needs an absolute base URL, got ${JSON.stringify(t)}`,{cause:f})}if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Kt(`Sockethub discovery needs an http(s) base URL, got ${JSON.stringify(t)}`);const n=e.fetch??globalThis.fetch;if(typeof n!="function")throw new Kt("Sockethub discovery needs fetch(); pass one in the options");const s=new AbortController,o=e.discoveryTimeoutMs??1e4,i=setTimeout(()=>s.abort(),o),l=()=>s.signal.aborted;let a;try{let f;try{f=await n(r.href,{headers:{accept:"application/json"},signal:s.signal})}catch(u){const d=l()?`timed out after ${o}ms`:u instanceof Error?u.message:String(u);throw new Kt(`Sockethub discovery failed: could not reach ${r.href} (${d})`,{cause:u})}if(!f.ok)throw new Kt(`Sockethub discovery failed: ${r.href} answered ${f.status}`);try{a=await f.json()}catch(u){throw new Kt(l()?`Sockethub discovery failed: ${r.href} timed out after ${o}ms while sending the descriptor`:`Sockethub discovery failed: ${r.href} did not return JSON; is it a Sockethub server?`,{cause:u})}}finally{clearTimeout(i)}if(!pf(a))throw new Kt(`Sockethub discovery failed: ${r.href} did not return a valid service descriptor`);return a}function Uf(t,e){const r=new URL(e,t);if(r.origin!==new URL(t).origin)throw new Kt(`Sockethub discovery failed: endpoint path ${JSON.stringify(e)} resolves to ${r.origin}, not ${t}`);return r.href}async function Ff(t){if(t)return t;const e=globalThis.io;if(typeof e=="function")return e;try{const r=await _o(()=>import("./BEufgWz0.js"),[],import.meta.url);if(typeof r.io=="function")return r.io}catch{}throw new Error("SockethubClient.connect() needs socket.io-client: install it, load /socket.io.js, or pass `io` in the options")}var oi="https://sockethub.org/ns/context/platform/";function zf(t){if(Array.isArray(t)){for(const e of t)if(typeof e=="string"&&e.startsWith(oi)){const r=e.slice(oi.length),n=r.indexOf("/");if(n>0)return r.slice(0,n)}}}function Vn(t){return typeof t=="object"&&t!==null&&"error"in t&&!!t.error}function bs(t){return"actor"in t&&t.actor!==null&&typeof t.actor=="object"&&"id"in t.actor&&typeof t.actor.id=="string"}function ci(t){var e,r;return(t==null?void 0:t.type)==="update"&&((e=t.object)==null?void 0:e.type)==="address"&&bs(t)&&typeof t.target=="object"&&typeof((r=t.target)==null?void 0:r.id)=="string"&&t.target.id!==t.actor.id}function Un(t){var s;const e=((s=t.actor)==null?void 0:s.id)||t.actor;if(!e)throw new Error(`actor property not present for message type: ${t==null?void 0:t.type}`);const r=t.target?t.target.id||t.target:"";return`${sn(t)??""}:${e}-${r}`}function Xn(t,e){var n;if(!t||typeof t!="object")return!1;const r=Vr(t);return((n=r.actor)==null?void 0:n.id)===e.actorId&&(sn(r)??zf(r["@context"]))===e.platform}class Bf{constructor(){Ye(this,"events",{credentials:new Map,connect:new Map,join:new Map})}clearCredentials(e){if(!e){this.events.credentials.clear();return}for(const r of Object.values(this.events))for(const[n,s]of r)Xn(s,e)&&r.delete(n)}recordCredentials(e){e.object&&e.object.type==="credentials"&&this.events.credentials.set(Un(e),e)}recordMessage(e){const r=Un(e);e.type==="join"||e.type==="connect"?this.events[e.type].set(r,e):e.type==="leave"?this.events.join.delete(r):e.type==="disconnect"&&this.events.connect.delete(r)}moveActor(e){const r=e.actor.id,n=e.target,s=n.id,o=typeof n.name=="string"?n.name:void 0,i=sn(e)??"",l=[];for(const a of Object.values(this.events))for(const[f,u]of[...a]){if(!bs(u)||u.actor.id!==r||(sn(u)??"")!==i)continue;const d={...u,actor:{...u.actor,id:s,...o?{name:o}:{}}};a.delete(f),a.set(Un(d),d),l.push([r,s])}return l}}class yn{constructor(e,r={},n){Ye(this,"replayStore",new Bf);Ye(this,"_socket");Ye(this,"socket");Ye(this,"debug",!0);Ye(this,"descriptor");Ye(this,"serverOrigin");Ye(this,"options");Ye(this,"platformRegistry",new Map);Ye(this,"asContextUrl");Ye(this,"sockethubContextUrl");Ye(this,"apiVersion");Ye(this,"initState","idle");Ye(this,"hasReadyOnce",!1);Ye(this,"initCycle");Ye(this,"initTokenCounter",0);Ye(this,"initTimeoutTimer");Ye(this,"waitingWarningTimer");Ye(this,"waitingWarningIntervalMs",1e4);Ye(this,"readyWaiters",[]);Ye(this,"outboundQueue",[]);Ye(this,"outboundSequence",0);Ye(this,"pendingScopedClears",[]);Ye(this,"registryFingerprint");Ye(this,"latestReadyInfo");if(!e)throw new Error("SockethubClient requires a socket.io instance");this._socket=e,this.descriptor=n==null?void 0:n.descriptor,this.serverOrigin=n==null?void 0:n.serverOrigin,this.options={initTimeoutMs:r.initTimeoutMs??5e3,maxQueuedOutbound:r.maxQueuedOutbound??1e3,maxQueuedAgeMs:r.maxQueuedAgeMs??3e4,validation:r.validation??"auto"},this.socket=this.createPublicEmitter(),this.registerSocketIOHandlers(),this._socket.connected&&(this.socket.connected=!0,this.socket.id=this._socket.id,this.socket._emit("connect"),this.startInitialization("initial-connect",!0))}endpointUrl(e){var n,s;const r=(s=(n=this.descriptor)==null?void 0:n.endpoints)==null?void 0:s[e];if(!(!this.serverOrigin||!r))return Uf(this.serverOrigin,r)}static async connect(e,r={}){var P;const{io:n,socketOptions:s,fetch:o,discoveryTimeoutMs:i,...l}=r,a=await Vf(e,{fetch:o,discoveryTimeoutMs:i}),f=(P=a.endpoints)==null?void 0:P.socketIO;if(!f)throw new Kt(`Sockethub discovery failed: ${e} does not advertise a Socket.IO endpoint (older server?); pass a socket to the constructor instead`);const u=new URL(e).origin,w=(await Ff(n))(u,{...s,path:f});return new yn(w,l,{descriptor:a,serverOrigin:u})}clearCredentials(e){const r=[];this.outboundQueue=this.outboundQueue.filter(n=>n.event==="credentials"&&(!e||Xn(n.content,e))?(r.push(n),!1):!0),this.replayStore.clearCredentials(e),e&&!this.isReady()&&this.pendingScopedClears.push({scope:e,before:this.outboundSequence}),this.emitCancelled(r)}emitCancelled(e){for(const r of e)this.emitClientError(r.event,r.callback,"SockethubClient queued credentials cancelled by clearCredentials")}getRegisteredPlatforms(){return Array.from(this.platformRegistry.values()).map(e=>({...e,types:[...e.types],schemas:{...e.schemas}}))}isSchemasReady(){return this.isReady()}isReady(){return this.initState==="ready"}getInitState(){return this.initState}getRegisteredBaseContexts(){if(!this.asContextUrl||!this.sockethubContextUrl)throw new Error("Schema registry not loaded yet. Wait for client ready state after connect.");return{as:this.asContextUrl,sockethub:this.sockethubContextUrl}}getPlatformSchema(e,r="messages"){var s,o;const n=e==null?void 0:e.trim();if(n)return(o=(s=this.platformRegistry.get(n))==null?void 0:s.schemas)==null?void 0:o[r]}async waitForSchemas(e=2e3){return await this.ready(e),this.buildPlatformRegistryPayload()}ready(e=this.options.initTimeoutMs){return this.isReady()&&this.latestReadyInfo?Promise.resolve(this.latestReadyInfo):new Promise((r,n)=>{const s={resolve:r,reject:n};e>0&&(s.timer=setTimeout(()=>{this.readyWaiters=this.readyWaiters.filter(o=>o!==s),n(new Error(`SockethubClient ready() timed out after ${e}ms`))},e)),this.readyWaiters.push(s),this.socket.connected&&this.initState==="idle"&&this.startInitialization(this.hasReadyOnce?"reconnect":"initial-connect",!0)})}validateActivity(e){return this.options.validation==="off"?"":e.type==="credentials"?If(e):Rf(e)}contextFor(e){if(typeof e!="string"||e.trim().length===0)throw new Error("SockethubClient.contextFor(platform) requires a non-empty platform string");if(!this.asContextUrl||!this.sockethubContextUrl)throw new Error("Schema registry not loaded yet. Wait for client ready state after connect.");const r=e.trim(),n=this.platformRegistry.get(r);if(!n){const s=Array.from(this.platformRegistry.keys()).sort();throw new Error(`unknown platform '${r}'. Registered platforms: ${s.join(", ")}`)}return[this.asContextUrl,this.sockethubContextUrl,n.contextUrl]}createPublicEmitter(){const e=new Mf;return e._emit=e.emit,e.emit=(r,n,s)=>{this.handlePublicEmit(r,n,s)},e.connected=!1,e.disconnect=()=>{this._socket.disconnect()},e.connect=()=>{this._socket.connect()},e}requestSchemaRegistry(){"io"in this._socket&&this._socket.emit("schemas",this.registryFingerprint,r=>{this.handleSchemasPayload(r)})}applyPlatformRegistry(e){const r=qf(e);if(!r)return;this.apiVersion=r.apiVersion,this.asContextUrl=r.asContextUrl,this.sockethubContextUrl=r.sockethubContextUrl,this.platformRegistry=r.platforms;for(const o of r.platforms.values())Lf(o);const n=this.buildPlatformRegistryPayload(),s=e;return this.registryFingerprint=typeof s.fingerprint=="string"?s.fingerprint:void 0,this.socket._emit("schemas",n),n}buildPlatformRegistryPayload(){return{apiVersion:this.apiVersion,contexts:this.asContextUrl&&this.sockethubContextUrl?{as:this.asContextUrl,sockethub:this.sockethubContextUrl}:void 0,platforms:this.getRegisteredPlatforms()}}buildReadyInfo(e){if(!(this.apiVersion===void 0||!this.asContextUrl||!this.sockethubContextUrl))return{state:"ready",reason:e,apiVersion:this.apiVersion,contexts:{as:this.asContextUrl,sockethub:this.sockethubContextUrl},platforms:this.getRegisteredPlatforms().map(r=>({id:r.id,apiVersion:r.apiVersion,contextUrl:r.contextUrl,contextVersion:r.contextVersion,schemaVersion:r.schemaVersion,types:[...r.types]}))}}resolveReadyWaiters(e){const r=this.readyWaiters;this.readyWaiters=[];for(const n of r)n.timer&&clearTimeout(n.timer),n.resolve(e)}rejectReadyWaiters(e){const r=this.readyWaiters;this.readyWaiters=[];for(const n of r)n.timer&&clearTimeout(n.timer),n.reject(e)}emitInitError(e,r,n){this.socket._emit("init_error",{error:e,phase:r,retrying:n})}emitClientError(e,r,n){if(typeof r=="function"){r({error:n});return}this.socket._emit("client_error",{event:e,error:n})}clearInitTimers(){this.initTimeoutTimer&&(clearTimeout(this.initTimeoutTimer),this.initTimeoutTimer=void 0),this.waitingWarningTimer&&(clearInterval(this.waitingWarningTimer),this.waitingWarningTimer=void 0)}startWaitingWarnings(){this.waitingWarningTimer||(this.waitingWarningTimer=setInterval(()=>{if(this.isReady()||this.initState==="closed"){this.clearInitTimers();return}const e=this.outboundQueue.length,r=this.outboundQueue[0],n=r?((Date.now()-r.enqueuedAt)/1e3).toFixed(1):"0.0";console.warn(`[SockethubClient] Still waiting for schemas; queued outbound messages: ${e}; oldest queued age: ${n}s.`)},this.waitingWarningIntervalMs))}startInitialization(e,r){if(!this.socket.connected||this.initState==="closed")return;const n=++this.initTokenCounter;this.initCycle={token:n,reason:e,startedAt:Date.now(),replayOnReady:r,timedOut:!1},this.initState="initializing",this.clearInitTimers(),this.initTimeoutTimer=setTimeout(()=>{if(!this.initCycle||this.initCycle.token!==n)return;this.initCycle.timedOut=!0,this.initState="init_error";const s=`Initialization timed out after ${this.options.initTimeoutMs}ms waiting for schemas`;console.warn(`[SockethubClient] ${s}; queued outbound messages: ${this.outboundQueue.length}. Waiting for schemas event from server.`),this.emitInitError(s,"timeout",!1),this.startWaitingWarnings()},this.options.initTimeoutMs);try{this.requestSchemaRegistry()}catch(s){this.initState="init_error";const o=s instanceof Error?s.message:String(s);this.emitInitError(o,"schemas-request",!1),this.startWaitingWarnings()}}markReady(e){const r=this.initCycle,n=!!(r!=null&&r.replayOnReady);this.initCycle=void 0,this.clearInitTimers(),this.initState="ready",this.hasReadyOnce=!0;const s=this.buildReadyInfo(e);if(!s){const o=new Error("Failed to build ready payload");this.initState="init_error",this.emitInitError(o.message,"schemas-apply",!0),this.rejectReadyWaiters(o);return}if(this.socket._emit("ready",s),this.latestReadyInfo=s,this.resolveReadyWaiters(s),n){const{credentials:o,connect:i,join:l}=this.replayStore.events;this.replay("credentials",o),this.replay("message",i),this.replay("message",l)}this.flushOutboundQueue()}handleSchemasPayload(e){if(!e||typeof e!="object")return;if(e.unchanged===!0&&typeof this.registryFingerprint=="string"&&this.platformRegistry.size>0){this.initCycle?this.markReady(this.initCycle.reason):this.initState!=="ready"&&this.markReady("schemas-update");return}const r=e.fingerprint;if(this.initState==="ready"&&!this.initCycle&&r&&r===this.registryFingerprint)return;if(this.initState==="ready"&&!this.initCycle&&(this.initState="initializing"),!this.applyPlatformRegistry(e)){this.initState="init_error",this.emitInitError("Received invalid schemas payload from server","schemas-apply",!0),this.startWaitingWarnings();return}if(this.initCycle){this.markReady(this.initCycle.reason);return}this.markReady("schemas-update")}handlePublicEmit(e,r,n){const s={event:e,content:r,callback:n,enqueuedAt:Date.now(),sequence:this.outboundSequence++};if(!this.isReady()){this.enqueueOutbound(s);return}this.sendOutbound(s)}enqueueOutbound(e){if(this.outboundQueue.push(e),this.outboundQueue.length<=this.options.maxQueuedOutbound)return;const r=this.outboundQueue.shift();r&&this.emitClientError(r.event,r.callback,"SockethubClient queue overflow before ready")}flushOutboundQueue(){if(!this.isReady()||this.outboundQueue.length===0)return;const e=Date.now();this.outboundQueue.sort((n,s)=>n.sequence-s.sequence);const r=this.pendingScopedClears;for(this.pendingScopedClears=[];this.outboundQueue.length>0;){const n=this.outboundQueue.shift();if(n.event==="credentials"&&r.some(s=>n.sequence<s.before&&Xn(n.content,s.scope))){this.emitCancelled([n]);continue}if(e-n.enqueuedAt>this.options.maxQueuedAgeMs){this.emitClientError(n.event,n.callback,`SockethubClient queued message expired after ${this.options.maxQueuedAgeMs}ms before initialization`);continue}this.sendOutbound(n)}}sendOutbound(e){let r=e.content;try{if(e.event==="credentials"||e.event==="message"){if(r=Vr(e.content),r&&typeof r=="object"){const s=r;e.event==="credentials"&&!s.type&&(s.type="credentials"),s.actor&&typeof s.actor=="object"&&!s.actor.type&&(s.actor.type="person")}if(this.platformRegistry.size>0){const s=this.validateActivity(r);if(s){this.emitClientError(e.event,e.callback,`SockethubClient validation failed: ${s}`);return}}}let n=e.callback;e.event==="credentials"?this.replayStore.recordCredentials(r):e.event==="message"&&(this._socket.connected&&this.replayStore.recordMessage(r),n=this.rememberRequestedRename(r,n)),this._socket.emit(e.event,r,n)}catch(n){const s=n instanceof Error?n.message:String(n);this.emitClientError(e.event,e.callback,s)}}log(e,r){this.debug&&console.log(e,r)}registerSocketIOHandlers(){this._socket.on("connect",()=>{this.socket.id=this._socket.id,this.socket.connected=!0,this.socket._emit("connect"),this.startInitialization(this.hasReadyOnce?"reconnect":"initial-connect",!0)}),this._socket.on("connect_error",e=>{this.socket._emit("connect_error",e)}),this._socket.on("disconnect",e=>{this.socket.connected=!1,this.initState!=="closed"&&(this.initState="idle"),this.clearInitTimers(),this.socket._emit("disconnect",e)}),this._socket.on("schemas",e=>{this.handleSchemasPayload(e)}),this._socket.on("message",e=>{const r=Vr(e);this.followActorRename(r),this.socket._emit("message",r)})}followActorRename(e){Vn(e)||ci(e)&&this.moveReplayState(e)}rememberRequestedRename(e,r){return ci(e)?(...n)=>{const[s,o]=n;s instanceof Error||Vn(s)||Vn(o)||this.moveReplayState(e),typeof r=="function"&&r(...n)}:r}moveReplayState(e){for(const[r,n]of this.replayStore.moveActor(e))this.log(`replay state moved from ${r} to ${n}`)}replay(e,r){for(const n of r.values()){const s=Vr(n);let o=s==null?void 0:s.id;if(bs(s)){const i=s.actor;o=typeof i=="string"?i:i.id}this.log(`replaying ${e} for ${o}`),this._socket.emit(e,s)}}}(t=>{t.SockethubClient=yn})(typeof globalThis=="object"?globalThis:{});const Vt=Object.create(null);Vt.open="0";Vt.close="1";Vt.ping="2";Vt.pong="3";Vt.message="4";Vt.upgrade="5";Vt.noop="6";const Ur=Object.create(null);Object.keys(Vt).forEach(t=>{Ur[Vt[t]]=t});const Yn={type:"error",data:"parser error"},ca=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ua=typeof ArrayBuffer=="function",la=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,$s=({type:t,data:e},r,n)=>ca&&e instanceof Blob?r?n(e):ui(e,n):ua&&(e instanceof ArrayBuffer||la(e))?r?n(e):ui(new Blob([e]),n):n(Vt[t]+(e||"")),ui=(t,e)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];e("b"+(n||""))},r.readAsDataURL(t)};function li(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Fn;function xf(t,e){if(ca&&t.data instanceof Blob)return t.data.arrayBuffer().then(li).then(e);if(ua&&(t.data instanceof ArrayBuffer||la(t.data)))return e(li(t.data));$s(t,!1,r=>{Fn||(Fn=new TextEncoder),e(Fn.encode(r))})}const fi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",br=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<fi.length;t++)br[fi.charCodeAt(t)]=t;const Hf=t=>{let e=t.length*.75,r=t.length,n,s=0,o,i,l,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),u=new Uint8Array(f);for(n=0;n<r;n+=4)o=br[t.charCodeAt(n)],i=br[t.charCodeAt(n+1)],l=br[t.charCodeAt(n+2)],a=br[t.charCodeAt(n+3)],u[s++]=o<<2|i>>4,u[s++]=(i&15)<<4|l>>2,u[s++]=(l&3)<<6|a&63;return f},Kf=typeof ArrayBuffer=="function",Es=(t,e)=>{if(typeof t!="string")return{type:"message",data:fa(t,e)};const r=t.charAt(0);return r==="b"?{type:"message",data:Gf(t.substring(1),e)}:Ur[r]?t.length>1?{type:Ur[r],data:t.substring(1)}:{type:Ur[r]}:Yn},Gf=(t,e)=>{if(Kf){const r=Hf(t);return fa(r,e)}else return{base64:!0,data:t}},fa=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},da="",Wf=(t,e)=>{const r=t.length,n=new Array(r);let s=0;t.forEach((o,i)=>{$s(o,!1,l=>{n[i]=l,++s===r&&e(n.join(da))})})},Jf=(t,e)=>{const r=t.split(da),n=[];for(let s=0;s<r.length;s++){const o=Es(r[s],e);if(n.push(o),o.type==="error")break}return n};function Qf(){return new TransformStream({transform(t,e){xf(t,r=>{const n=r.length;let s;if(n<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,n);else if(n<65536){s=new Uint8Array(3);const o=new DataView(s.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{s=new Uint8Array(9);const o=new DataView(s.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}t.data&&typeof t.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(r)})}})}let zn;function Mr(t){return t.reduce((e,r)=>e+r.length,0)}function Dr(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let n=0;for(let s=0;s<e;s++)r[s]=t[0][n++],n===t[0].length&&(t.shift(),n=0);return t.length&&n<t[0].length&&(t[0]=t[0].slice(n)),r}function Xf(t,e){zn||(zn=new TextDecoder);const r=[];let n=0,s=-1,o=!1;return new TransformStream({transform(i,l){for(r.push(i);;){if(n===0){if(Mr(r)<1)break;const a=Dr(r,1);o=(a[0]&128)===128,s=a[0]&127,s<126?n=3:s===126?n=1:n=2}else if(n===1){if(Mr(r)<2)break;const a=Dr(r,2);s=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),n=3}else if(n===2){if(Mr(r)<8)break;const a=Dr(r,8),f=new DataView(a.buffer,a.byteOffset,a.length),u=f.getUint32(0);if(u>Math.pow(2,21)-1){l.enqueue(Yn);break}s=u*Math.pow(2,32)+f.getUint32(4),n=3}else{if(Mr(r)<s)break;const a=Dr(r,s);l.enqueue(Es(o?a:zn.decode(a),e)),n=0}if(s===0||s>t){l.enqueue(Yn);break}}}})}const ha=4;function ft(t){if(t)return Yf(t)}function Yf(t){for(var e in ft.prototype)t[e]=ft.prototype[e];return t}ft.prototype.on=ft.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};ft.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this};ft.prototype.off=ft.prototype.removeListener=ft.prototype.removeAllListeners=ft.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var n,s=0;s<r.length;s++)if(n=r[s],n===e||n.fn===e){r.splice(s,1);break}return r.length===0&&delete this._callbacks["$"+t],this};ft.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,e)}return this};ft.prototype.emitReserved=ft.prototype.emit;ft.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};ft.prototype.hasListeners=function(t){return!!this.listeners(t).length};const _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,r)=>r(e,0),Ot=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Zf="arraybuffer";function pa(t,...e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&(r[n]=t[n]),r),{})}const ed=Ot.setTimeout,td=Ot.clearTimeout;function wn(t,e){e.useNativeTimers?(t.setTimeoutFn=ed.bind(Ot),t.clearTimeoutFn=td.bind(Ot)):(t.setTimeoutFn=Ot.setTimeout.bind(Ot),t.clearTimeoutFn=Ot.clearTimeout.bind(Ot))}const rd=1.33;function nd(t){return typeof t=="string"?sd(t):Math.ceil((t.byteLength||t.size)*rd)}function sd(t){let e=0,r=0;for(let n=0,s=t.length;n<s;n++)e=t.charCodeAt(n),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}function ma(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function id(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}function ad(t){let e={},r=t.split("&");for(let n=0,s=r.length;n<s;n++){let o=r[n].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class od extends Error{constructor(e,r,n){super(e),this.description=r,this.context=n,this.type="TransportError"}}class Ss extends ft{constructor(e){super(),this.writable=!1,wn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,r,n){return super.emitReserved("error",new od(e,r,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const r=Es(e,this.socket.binaryType);this.onPacket(r)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,r={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const r=id(e);return r.length?"?"+r:""}}class cd extends Ss{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const r=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||r()})),this.writable||(n++,this.once("drain",function(){--n||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const r=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};Jf(e,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Wf(e,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=ma()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(e,r)}}let ga=!1;try{ga=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ud=ga;function ld(){}class fd extends cd{constructor(e){if(super(e),typeof location<"u"){const r=location.protocol==="https:";let n=location.port;n||(n=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,r){const n=this.request({method:"POST",data:e});n.on("success",r),n.on("error",(s,o)=>{this.onError("xhr post error",s,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(r,n)=>{this.onError("xhr poll error",r,n)}),this.pollXhr=e}}class Lt extends ft{constructor(e,r,n){super(),this.createRequest=e,wn(this,n),this._opts=n,this._method=n.method||"GET",this._uri=r,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var e;const r=pa(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(r);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&n.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var s;n.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=Lt.requestsCount++,Lt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=ld,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Lt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Lt.requestsCount=0;Lt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",di);else if(typeof addEventListener=="function"){const t="onpagehide"in Ot?"pagehide":"unload";addEventListener(t,di,!1)}}function di(){for(let t in Lt.requests)Lt.requests.hasOwnProperty(t)&&Lt.requests[t].abort()}const dd=function(){const t=va({xdomain:!1});return t&&t.responseType!==null}();class hd extends fd{constructor(e){super(e);const r=e&&e.forceBase64;this.supportsBinary=dd&&!r}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Lt(va,this.uri(),e)}}function va(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ud))return new XMLHttpRequest}catch{}if(!e)try{return new Ot[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const ya=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class pd extends Ss{get name(){return"websocket"}doOpen(){const e=this.uri(),r=this.opts.protocols,n=ya?{}:pa(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,r,n)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],s=r===e.length-1;$s(n,this.supportsBinary,o=>{try{this.doWrite(n,o)}catch{}s&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=ma()),this.supportsBinary||(r.b64=1),this.createUri(e,r)}}const Bn=Ot.WebSocket||Ot.MozWebSocket;class md extends pd{createSocket(e,r,n){return ya?new Bn(e,r,n):r?new Bn(e,r):new Bn(e)}doWrite(e,r){this.ws.send(r)}}class gd extends Ss{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const r=Xf(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(r).getReader(),s=Qf();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const o=()=>{n.read().then(({done:l,value:a})=>{l||(this.onPacket(a),o())}).catch(l=>{})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],s=r===e.length-1;this._writer.write(n).then(()=>{s&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const vd={websocket:md,webtransport:gd,polling:hd},yd=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,_d=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zn(t){if(t.length>8e3)throw"URI too long";const e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));let s=yd.exec(t||""),o={},i=14;for(;i--;)o[_d[i]]=s[i]||"";return r!=-1&&n!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=wd(o,o.path),o.queryKey=bd(o,o.query),o}function wd(t,e){const r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function bd(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,s,o){s&&(r[s]=o)}),r}const es=typeof addEventListener=="function"&&typeof removeEventListener=="function",Fr=[];es&&addEventListener("offline",()=>{Fr.forEach(t=>t())},!1);class Yt extends ft{constructor(e,r){if(super(),this.binaryType=Zf,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(r=e,e=null),e){const n=Zn(e);r.hostname=n.host,r.secure=n.protocol==="https"||n.protocol==="wss",r.port=n.port,n.query&&(r.query=n.query)}else r.host&&(r.hostname=Zn(r.host).host);wn(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(n=>{const s=n.prototype.name;this.transports.push(s),this._transportsByName[s]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ad(this.opts.query)),es&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Fr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const r=Object.assign({},this.opts.query);r.EIO=ha,r.transport=e,this.id&&(r.sid=this.id);const n=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Yt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(e);r.open(),this.setTransport(r)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",Yt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=e.data,this._onError(r);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let n=0;n<this.writeBuffer.length;n++){const s=this.writeBuffer[n].data;if(s&&(r+=nd(s)),n>0&&r>this._maxPayload)return this.writeBuffer.slice(0,n);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_n(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,r,n){return this._sendPacket("message",e,r,n),this}send(e,r,n){return this._sendPacket("message",e,r,n),this}_sendPacket(e,r,n,s){if(typeof r=="function"&&(s=r,r=void 0),typeof n=="function"&&(s=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const o={type:e,data:r,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),e()},n=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Yt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),es&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=Fr.indexOf(this._offlineEventListener);n!==-1&&Fr.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,r),this.writeBuffer=[],this._prevBufferLen=0}}}Yt.protocol=ha;class $d extends Yt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let r=this.createTransport(e),n=!1;Yt.priorWebsocketSuccess=!1;const s=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",d=>{if(!n)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;Yt.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(u(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=r.name,this.emitReserved("upgradeError",w)}}))};function o(){n||(n=!0,u(),r.close(),r=null)}const i=d=>{const w=new Error("probe error: "+d);w.transport=r.name,o(),this.emitReserved("upgradeError",w)};function l(){i("transport closed")}function a(){i("socket closed")}function f(d){r&&d.name!==r.name&&o()}const u=()=>{r.removeListener("open",s),r.removeListener("error",i),r.removeListener("close",l),this.off("close",a),this.off("upgrading",f)};r.once("open",s),r.once("error",i),r.once("close",l),this.once("close",a),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||r.open()},200):r.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const r=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&r.push(e[n]);return r}}let Ed=class extends $d{constructor(e,r={}){const n=typeof e=="object"?e:r;(!n.transports||n.transports&&typeof n.transports[0]=="string")&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(s=>vd[s]).filter(s=>!!s)),super(e,n)}};function Sd(t,e="",r){let n=t;r=r||typeof location<"u"&&location,t==null&&(t=r.protocol+"//"+r.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=r.protocol+t:t=r.host+t),/^(https?|wss?):\/\//.test(t)||(typeof r<"u"?t=r.protocol+"//"+t:t="https://"+t),n=Zn(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const o=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+e,n.href=n.protocol+"://"+o+(r&&r.port===n.port?"":":"+n.port),n}const Pd=typeof ArrayBuffer=="function",kd=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,_a=Object.prototype.toString,Od=typeof Blob=="function"||typeof Blob<"u"&&_a.call(Blob)==="[object BlobConstructor]",Nd=typeof File=="function"||typeof File<"u"&&_a.call(File)==="[object FileConstructor]";function Ps(t){return Pd&&(t instanceof ArrayBuffer||kd(t))||Od&&t instanceof Blob||Nd&&t instanceof File}function zr(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(zr(t[r]))return!0;return!1}if(Ps(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return zr(t.toJSON(),!0);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&zr(t[r]))return!0;return!1}function Td(t){const e=[],r=t.data,n=t;return n.data=ts(r,e),n.attachments=e.length,{packet:n,buffers:e}}function ts(t,e){if(!t)return t;if(Ps(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Array.isArray(t)){const r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=ts(t[n],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=ts(t[n],e));return r}return t}function Rd(t,e){return t.data=rs(t.data,e),delete t.attachments,t}function rs(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=rs(t[r],e);else if(typeof t=="object")for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=rs(t[r],e));return t}const Id=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Cd=5;var Le;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(Le||(Le={}));class Ad{constructor(e){this.replacer=e}encode(e){return(e.type===Le.EVENT||e.type===Le.ACK)&&zr(e)?this.encodeAsBinary({type:e.type===Le.EVENT?Le.BINARY_EVENT:Le.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let r=""+e.type;return(e.type===Le.BINARY_EVENT||e.type===Le.BINARY_ACK)&&(r+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(r+=e.nsp+","),e.id!=null&&(r+=e.id),e.data!=null&&(r+=JSON.stringify(e.data,this.replacer)),r}encodeAsBinary(e){const r=Td(e),n=this.encodeAsString(r.packet),s=r.buffers;return s.unshift(n),s}}function hi(t){return Object.prototype.toString.call(t)==="[object Object]"}class ks extends ft{constructor(e){super(),this.reviver=e}add(e){let r;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(e);const n=r.type===Le.BINARY_EVENT;n||r.type===Le.BINARY_ACK?(r.type=n?Le.EVENT:Le.ACK,this.reconstructor=new jd(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(Ps(e)||e.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let r=0;const n={type:Number(e.charAt(0))};if(Le[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===Le.BINARY_EVENT||n.type===Le.BINARY_ACK){const o=r+1;for(;e.charAt(++r)!=="-"&&r!=e.length;);const i=e.substring(o,r);if(i!=Number(i)||e.charAt(r)!=="-")throw new Error("Illegal attachments");n.attachments=Number(i)}if(e.charAt(r+1)==="/"){const o=r+1;for(;++r&&!(e.charAt(r)===","||r===e.length););n.nsp=e.substring(o,r)}else n.nsp="/";const s=e.charAt(r+1);if(s!==""&&Number(s)==s){const o=r+1;for(;++r;){const i=e.charAt(r);if(i==null||Number(i)!=i){--r;break}if(r===e.length)break}n.id=Number(e.substring(o,r+1))}if(e.charAt(++r)){const o=this.tryParse(e.substr(r));if(ks.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,r){switch(e){case Le.CONNECT:return hi(r);case Le.DISCONNECT:return r===void 0;case Le.CONNECT_ERROR:return typeof r=="string"||hi(r);case Le.EVENT:case Le.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&Id.indexOf(r[0])===-1);case Le.ACK:case Le.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class jd{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const r=Rd(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Md=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ks,Encoder:Ad,get PacketType(){return Le},protocol:Cd},Symbol.toStringTag,{value:"Module"}));function Rt(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const Dd=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wa extends ft{constructor(e,r,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=r,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Rt(e,"open",this.onopen.bind(this)),Rt(e,"packet",this.onpacket.bind(this)),Rt(e,"error",this.onerror.bind(this)),Rt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...r){var n,s,o;if(Dd.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(r.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const i={type:Le.EVENT,data:r};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const u=this.ids++,d=r.pop();this._registerAckCallback(u,d),i.id=u}const l=(s=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||s===void 0?void 0:s.writable,a=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!l||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,r){var n;const s=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(s===void 0){this.acks[e]=r;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===e&&this.sendBuffer.splice(l,1);r.call(this,new Error("operation has timed out"))},s),i=(...l)=>{this.io.clearTimeoutFn(o),r.apply(this,l)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...r){return new Promise((n,s)=>{const o=(i,l)=>i?s(i):n(l);o.withError=!0,r.push(o),this.emit(e,...r)})}_addToQueue(e){let r;typeof e[e.length-1]=="function"&&(r=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...o)=>(this._queue[0],s!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(s)):(this._queue.shift(),r&&r(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!e||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Le.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(n=>String(n.id)===e)){const n=this.acks[e];delete this.acks[e],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Le.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Le.EVENT:case Le.BINARY_EVENT:this.onevent(e);break;case Le.ACK:case Le.BINARY_ACK:this.onack(e);break;case Le.DISCONNECT:this.ondisconnect();break;case Le.CONNECT_ERROR:this.destroy();const n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);break}}onevent(e){const r=e.data||[];e.id!=null&&r.push(this.ack(e.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const n of r)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const r=this;let n=!1;return function(...s){n||(n=!0,r.packet({type:Le.ACK,id:e,data:s}))}}onack(e){const r=this.acks[e.id];typeof r=="function"&&(delete this.acks[e.id],r.withError&&e.data.unshift(null),r.apply(this,e.data))}onconnect(e,r){this.id=e,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Le.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const r=this._anyListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const r=this._anyOutgoingListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const n of r)n.apply(this,e.data)}}}function fr(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}fr.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-r:t+r}return Math.min(t,this.max)|0};fr.prototype.reset=function(){this.attempts=0};fr.prototype.setMin=function(t){this.ms=t};fr.prototype.setMax=function(t){this.max=t};fr.prototype.setJitter=function(t){this.jitter=t};class ns extends ft{constructor(e,r){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(r=e,e=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,wn(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((n=r.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new fr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=e;const s=r.parser||Md;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var r;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(r=this.backoff)===null||r===void 0||r.setMin(e),this)}randomizationFactor(e){var r;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(r=this.backoff)===null||r===void 0||r.setJitter(e),this)}reconnectionDelayMax(e){var r;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(r=this.backoff)===null||r===void 0||r.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ed(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const s=Rt(r,"open",function(){n.onopen(),e&&e()}),o=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),e?e(l):this.maybeReconnectOnOpen()},i=Rt(r,"error",o);if(this._timeout!==!1){const l=this._timeout,a=this.setTimeoutFn(()=>{s(),o(new Error("timeout")),r.close()},l);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(s),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Rt(e,"ping",this.onping.bind(this)),Rt(e,"data",this.ondata.bind(this)),Rt(e,"error",this.onerror.bind(this)),Rt(e,"close",this.onclose.bind(this)),Rt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(r){this.onclose("parse error",r)}}ondecoded(e){_n(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,r){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new wa(this,e,r),this.nsps[e]=n),n}_destroy(e){const r=Object.keys(this.nsps);for(const n of r)if(this.nsps[n].active)return;this._close()}_packet(e){const r=this.encoder.encode(e);for(let n=0;n<r.length;n++)this.engine.write(r[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,r){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},r);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const vr={};function Br(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const r=Sd(t,e.path||"/socket.io"),n=r.source,s=r.id,o=r.path,i=vr[s]&&o in vr[s].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||i;let a;return l?a=new ns(n,e):(vr[s]||(vr[s]=new ns(n,e)),a=vr[s]),r.query&&!e.query&&(e.query=r.queryKey),a.socket(r.path,e)}Object.assign(Br,{Manager:ns,Socket:wa,io:Br,connect:Br});const xn={},pi=lr(void 0);function Zd(t){return[...t].sort((e,r)=>e.id==="dummy"||r.id==="dummy"?e.id===r.id?0:e.id==="dummy"?-1:1:e.id.localeCompare(r.id))}function qd(t=globalThis.location,e=xn==null?void 0:xn.VITE_SOCKETHUB_URL){if(typeof e=="string"&&e.trim()!=="")return e.trim();const r=t==null?void 0:t.origin;return r&&r!=="null"?r:void 0}function Ld(t){return t instanceof Error?t.message:String(t)}function Vd(t,e,r){return new Promise((n,s)=>{if(!t.connected){s(new Error("Sockethub is disconnected. Reconnect and try again."));return}let o=!1;const i=e==="credentials",l=setTimeout(()=>f(new Error(i?"Credential acknowledgement timed out. Try again.":"Message acknowledgement timed out; delivery is unknown. Do not retry automatically.")),i?1e4:3e4),a=()=>f(new Error(i?"Disconnected before credentials were acknowledged. Try again.":"Disconnected before message acknowledgement; delivery is unknown. Do not retry automatically."));function f(u,d){o||(o=!0,clearTimeout(l),t.off("disconnect",a),u?s(u):n(d))}t.on("disconnect",a);try{t.emit(e,r,u=>f(void 0,u))}catch(u){f(u instanceof Error?u:new Error(String(u)))}})}let vt;const Ud=lr(!1);async function ba(){if(!vt)throw new Error("Sockethub client is not initialized yet");await vt.ready()}async function eh(t){return await ba(),vt.contextFor(t)}function th(t){return{id:t.id,type:t.type,name:t.name??t.id}}async function rh(t){await ba(),console.log("sending ->",t);const e=Ar("SEND",t);let r;try{if(r=await Vd(vt.socket,"message",e),!r)throw new Error("Missing message acknowledgement; delivery is unknown.")}catch(n){throw Ar("RESP",{...e,error:n instanceof Error?n.message:String(n)}),n}if(console.log("received <-",r),Ar("RESP",r),r.totalItems&&r.items)for(const n of r.items.reverse())Ar("RESP",n,!0,e.id);if(Ii(r,!0),r.error)throw new Error(r.error);return r}function Hn(t){return e=>{const r=t==="connect";Ud.update(()=>r),console.log(`sockethub ${t} [connected: ${r}]`,e||"")}}function Fd(t){console.log("handle incoming: ",t),Ii(t,!1)}async function zd(t){try{vt=await yn.connect(t,{io:Br,initTimeoutMs:1e4})}catch(e){console.error("sockethub discovery failed",e),pi.set({state:"unavailable",reason:Ld(e)});return}vt.descriptor&&vt.serverOrigin&&pi.set({state:"available",descriptor:vt.descriptor,serverOrigin:vt.serverOrigin}),vt.socket.on("connect",Hn("connect")),vt.socket.on("error",Hn("error")),vt.socket.on("disconnect",Hn("disconnect")),vt.socket.on("message",Fd),vt.socket.on("schemas",e=>{console.log("schemas received:",e),Cn("schemas",e)}),vt.socket.on("ready",e=>{console.log("client ready:",e),Cn("ready",e)}),vt.socket.on("init_error",e=>{console.error("client init error:",e),Cn("init_error",e)})}const Kn=qd();Kn&&(console.log("connecting to sockethub via discovery at",Kn),zd(Kn));export{_n as A,Cd as B,gd as C,ft as E,Qd as I,Xd as L,ec as M,cd as P,Ed as S,md as W,hd as X,ba as a,Jd as b,eh as c,rh as d,Wn as e,It as f,th as g,Ho as h,Si as i,ur as j,pi as k,Zd as l,Uf as m,Vd as n,Wd as o,Qr as p,Ud as q,Lo as r,vt as s,jo as t,Io as u,To as v,Zn as w,Le as x,wn as y,Md as z};
37
+ from .`,reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4452"}]},{scheme:"ipp",description:"Internet Printing Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3510"}]},{scheme:"ipps",description:"Internet Printing Protocol over HTTPS",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7472"}]},{scheme:"iris",description:"Internet Registry Information Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3981"}]},{scheme:"iris.beep",description:"iris.beep",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3983"}]},{scheme:"iris.lwz",description:"iris.lwz",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4993"}]},{scheme:"iris.xpc",description:"iris.xpc",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4992"}]},{scheme:"iris.xpcs",description:"iris.xpcs",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4992"}]},{scheme:"jabber",description:"jabber",reference:[],template:"http://www.iana.org/assignments/uri-schemes/perm/jabber"},{scheme:"ldap",description:"Lightweight Directory Access Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4516"}]},{scheme:"mailto",description:"Electronic mail address",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6068"}]},{scheme:"mid",description:"message identifier",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2392"}]},{scheme:"msrp",description:"Message Session Relay Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4975"}]},{scheme:"msrps",description:"Message Session Relay Protocol Secure",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4975"}]},{scheme:"mtqp",description:"Message Tracking Query Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3887"}]},{scheme:"mupdate",description:"Mailbox Update (MUPDATE) Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3656"}]},{scheme:"news",description:"USENET news",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5538"}]},{scheme:"nfs",description:"network file system protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2224"}]},{scheme:"ni",description:"ni",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6920"}]},{scheme:"nih",description:"nih",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6920"}]},{scheme:"nntp",description:"USENET news using NNTP access",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5538"}]},{scheme:"opaquelocktoken",description:"opaquelocktokent",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4918"}]},{scheme:"pkcs11",description:"PKCS#11",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7512"}]},{scheme:"pop",description:"Post Office Protocol v3",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2384"}]},{scheme:"pres",description:"Presence",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3859"}]},{scheme:"reload",description:"reload",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6940"}]},{scheme:"rtsp",description:"Real-time Streaming Protocol (RTSP)",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2326"},{type:"draft",href:"http://www.iana.org/go/RFC-ietf-mmusic-rfc2326bis-40"}]},{scheme:"rtsps",description:"Real-time Streaming Protocol (RTSP) over TLS",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2326"},{type:"draft",href:"http://www.iana.org/go/RFC-ietf-mmusic-rfc2326bis-40"}]},{scheme:"rtspu",description:"Real-time Streaming Protocol (RTSP) over unreliable datagram transport",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2326"}]},{scheme:"service",description:"service location",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2609"}]},{scheme:"session",description:"session",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6787"}]},{scheme:"shttp",description:"Secure Hypertext Transfer Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2660"}]},{scheme:"sieve",description:"ManageSieve Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5804"}]},{scheme:"sip",description:"session initiation protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3261"}]},{scheme:"sips",description:"secure session initiation protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3261"}]},{scheme:"sms",description:"Short Message Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5724"}]},{scheme:"snmp",description:"Simple Network Management Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4088"}]},{scheme:"soap.beep",description:"soap.beep",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4227"}]},{scheme:"soap.beeps",description:"soap.beeps",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4227"}]},{scheme:"stun",description:"stun",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7064"}]},{scheme:"stuns",description:"stuns",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7064"}]},{scheme:"tag",description:"tag",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4151"}]},{scheme:"tel",description:"telephone",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3966"}]},{scheme:"telnet",description:"Reference to interactive sessions",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4248"}]},{scheme:"tftp",description:"Trivial File Transfer Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3617"}]},{scheme:"thismessage",description:"multipart/related relative reference resolution",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2557"}],template:"http://www.iana.org/assignments/uri-schemes/perm/thismessage"},{scheme:"tip",description:"Transaction Internet Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2371"}]},{scheme:"tn3270",description:"Interactive 3270 emulation sessions",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6270"}]},{scheme:"turn",description:"turn",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7065"}]},{scheme:"turns",description:"turns",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7065"}]},{scheme:"tv",description:"TV Broadcasts",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2838"}]},{scheme:"urn",description:"Uniform Resource Names",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2141"},{type:"registry",href:"http://www.iana.org/assignments/urn-namespaces"}]},{scheme:"vemmi",description:"versatile multimedia interface",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2122"}]},{scheme:"vnc",description:"Remote Framebuffer Protocol",reference:[{type:"draft",href:"http://www.iana.org/go/RFC-warden-appsawg-vnc-scheme-10"}]},{scheme:"ws",description:"WebSocket connections",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6455"}]},{scheme:"wss",description:"Encrypted WebSocket connections",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6455"}]},{scheme:"xcon",description:"xcon",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6501"}]},{scheme:"xcon-userid",description:"xcon-userid",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6501"}]},{scheme:"xmlrpc.beep",description:"xmlrpc.beep",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3529"}]},{scheme:"xmlrpc.beeps",description:"xmlrpc.beeps",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc3529"}]},{scheme:"xmpp",description:"Extensible Messaging and Presence Protocol",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5122"}]},{scheme:"z39.50r",description:"Z39.50 Retrieval",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2056"}]},{scheme:"z39.50s",description:"Z39.50 Session",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2056"}]}]}),Pl=K(function(t,e){e.exports=[{scheme:"acr",description:"acr",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/acr"},{scheme:"adiumxtra",description:"adiumxtra",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/adiumxtra"},{scheme:"afp",description:"afp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/afp"},{scheme:"afs",description:"Andrew File System global file names",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc1738"}]},{scheme:"aim",description:"aim",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/aim"},{scheme:"appdata",description:"appdata",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/appdata"},{scheme:"apt",description:"apt",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/apt"},{scheme:"attachment",description:"attachment",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/attachment"},{scheme:"aw",description:"aw",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/aw"},{scheme:"barion",description:"barion",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/barion"},{scheme:"beshare",description:"beshare",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/beshare"},{scheme:"bitcoin",description:"bitcoin",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/bitcoin"},{scheme:"blob",description:"blob",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/blob"},{scheme:"bolo",description:"bolo",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/bolo"},{scheme:"callto",description:"callto",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/callto"},{scheme:"chrome",description:"chrome",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/chrome"},{scheme:"chrome-extension",description:"chrome-extension",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/chrome-extension"},{scheme:"com-eventbrite-attendee",description:"com-eventbrite-attendee",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/com-eventbrite-attendee"},{scheme:"content",description:"content",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/content"},{scheme:"cvs",description:"cvs",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/cvs"},{scheme:"dis",description:"dis",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dis"},{scheme:"dlna-playcontainer",description:"dlna-playcontainer",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dlna-playcontainer"},{scheme:"dlna-playsingle",description:"dlna-playsingle",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dlna-playsingle"},{scheme:"dntp",description:"dntp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/dntp"},{scheme:"dtn",description:"DTNRG research and development",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5050"}]},{scheme:"dvb",description:"dvb",reference:[{type:"draft",href:"http://www.iana.org/go/draft-mcroberts-uri-dvb"}]},{scheme:"ed2k",description:"ed2k",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ed2k"},{scheme:"facetime",description:"facetime",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/facetime"},{scheme:"feed",description:"feed",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/feed"},{scheme:"feedready",description:"feedready",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/feedready"},{scheme:"finger",description:"finger",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/finger"},{scheme:"fish",description:"fish",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/fish"},{scheme:"gg",description:"gg",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/gg"},{scheme:"git",description:"git",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/git"},{scheme:"gizmoproject",description:"gizmoproject",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/gizmoproject"},{scheme:"gtalk",description:"gtalk",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/gtalk"},{scheme:"ham",description:"ham",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7046"}]},{scheme:"hcp",description:"hcp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/hcp"},{scheme:"icon",description:"icon",reference:[{type:"draft",href:"http://www.iana.org/go/draft-lafayette-icon-uri-scheme"}]},{scheme:"iotdisco",description:"iotdisco",reference:[{type:"uri",href:"http://www.iana.org/assignments/uri-schemes/prov/iotdisco.pdf"}],template:"http://www.iana.org/assignments/uri-schemes/prov/iotdisco"},{scheme:"ipn",description:"ipn",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6260"}]},{scheme:"irc",description:"irc",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/irc"},{scheme:"irc6",description:"irc6",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/irc6"},{scheme:"ircs",description:"ircs",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ircs"},{scheme:"isostore",description:"isostore",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/isostore"},{scheme:"itms",description:"itms",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/itms"},{scheme:"jar",description:"jar",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/jar"},{scheme:"jms",description:"Java Message Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6167"}]},{scheme:"keyparc",description:"keyparc",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/keyparc"},{scheme:"lastfm",description:"lastfm",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/lastfm"},{scheme:"ldaps",description:"ldaps",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ldaps"},{scheme:"magnet",description:"magnet",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/magnet"},{scheme:"maps",description:"maps",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/maps"},{scheme:"market",description:"market",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/market"},{scheme:"message",description:"message",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/message"},{scheme:"mms",description:"mms",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/mms"},{scheme:"ms-access",description:"ms-access",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-access"},{scheme:"ms-drive-to",description:"ms-drive-to",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-drive-to"},{scheme:"ms-enrollment",description:"ms-enrollment",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-enrollment"},{scheme:"ms-excel",description:"ms-excel",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-excel"},{scheme:"ms-getoffice",description:"ms-getoffice",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-getoffice"},{scheme:"ms-help",description:"ms-help",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-help"},{scheme:"ms-infopath",description:"ms-infopath",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-infopath"},{scheme:"ms-media-stream-id",description:"ms-media-stream-id",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-media-stream-id"},{scheme:"ms-powerpoint",description:"ms-powerpoint",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-powerpoint"},{scheme:"ms-project",description:"ms-project",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-project"},{scheme:"ms-publisher",description:"ms-publisher",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-publisher"},{scheme:"ms-search-repair",description:"ms-search-repair",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-search-repair"},{scheme:"ms-secondary-screen-controller",description:"ms-secondary-screen-controller",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-secondary-screen-controller"},{scheme:"ms-secondary-screen-setup",description:"ms-secondary-screen-setup",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-secondary-screen-setup"},{scheme:"ms-settings",description:"ms-settings",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings"},{scheme:"ms-settings-airplanemode",description:"ms-settings-airplanemode",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-airplanemode"},{scheme:"ms-settings-bluetooth",description:"ms-settings-bluetooth",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-bluetooth"},{scheme:"ms-settings-camera",description:"ms-settings-camera",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-camera"},{scheme:"ms-settings-cellular",description:"ms-settings-cellular",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-cellular"},{scheme:"ms-settings-cloudstorage",description:"ms-settings-cloudstorage",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-cloudstorage"},{scheme:"ms-settings-connectabledevices",description:"ms-settings-connectabledevices",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-connectabledevices"},{scheme:"ms-settings-displays-topology",description:"ms-settings-displays-topology",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-displays-topology"},{scheme:"ms-settings-emailandaccounts",description:"ms-settings-emailandaccounts",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-emailandaccounts"},{scheme:"ms-settings-language",description:"ms-settings-language",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-language"},{scheme:"ms-settings-location",description:"ms-settings-location",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-location"},{scheme:"ms-settings-lock",description:"ms-settings-lock",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-lock"},{scheme:"ms-settings-nfctransactions",description:"ms-settings-nfctransactions",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-nfctransactions"},{scheme:"ms-settings-notifications",description:"ms-settings-notifications",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-notifications"},{scheme:"ms-settings-power",description:"ms-settings-power",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-power"},{scheme:"ms-settings-privacy",description:"ms-settings-privacy",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-privacy"},{scheme:"ms-settings-proximity",description:"ms-settings-proximity",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-proximity"},{scheme:"ms-settings-screenrotation",description:"ms-settings-screenrotation",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-screenrotation"},{scheme:"ms-settings-wifi",description:"ms-settings-wifi",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-wifi"},{scheme:"ms-settings-workplace",description:"ms-settings-workplace",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-settings-workplace"},{scheme:"ms-spd",description:"ms-spd",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-spd"},{scheme:"ms-transit-to",description:"ms-transit-to",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-transit-to"},{scheme:"ms-visio",description:"ms-visio",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-visio"},{scheme:"ms-walk-to",description:"ms-walk-to",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-walk-to"},{scheme:"ms-word",description:"ms-word",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ms-word"},{scheme:"msnim",description:"msnim",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/msnim"},{scheme:"mumble",description:"mumble",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/mumble"},{scheme:"mvn",description:"mvn",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/mvn"},{scheme:"notes",description:"notes",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/notes"},{scheme:"oid",description:"oid",reference:[{type:"draft",href:"http://www.iana.org/go/draft-larmouth-oid-iri"}],template:"http://www.iana.org/assignments/uri-schemes/prov/oid"},{scheme:"palm",description:"palm",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/palm"},{scheme:"paparazzi",description:"paparazzi",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/paparazzi"},{scheme:"platform",description:"platform",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/platform"},{scheme:"proxy",description:"proxy",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/proxy"},{scheme:"psyc",description:"psyc",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/psyc"},{scheme:"query",description:"query",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/query"},{scheme:"redis",description:"redis",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/redis"},{scheme:"rediss",description:"rediss",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/rediss"},{scheme:"res",description:"res",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/res"},{scheme:"resource",description:"resource",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/resource"},{scheme:"rmi",description:"rmi",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/rmi"},{scheme:"rsync",description:"rsync",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5781"}]},{scheme:"rtmfp",description:"rtmfp",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc7425"}],template:"http://www.iana.org/assignments/uri-schemes/prov/rtmfp"},{scheme:"rtmp",description:"rtmp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/rtmp"},{scheme:"secondlife",description:"query",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/secondlife"},{scheme:"sftp",description:"query",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/sftp"},{scheme:"sgn",description:"sgn",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/sgn"},{scheme:"skype",description:"skype",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/skype"},{scheme:"smb",description:"smb",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/smb"},{scheme:"smtp",description:"smtp",reference:[{type:"draft",href:"http://www.iana.org/go/draft-melnikov-smime-msa-to-mda"}],template:"http://www.iana.org/assignments/uri-schemes/prov/smtp"},{scheme:"soldat",description:"soldat",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/soldat"},{scheme:"spotify",description:"spotify",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/spotify"},{scheme:"ssh",description:"ssh",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ssh"},{scheme:"steam",description:"steam",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/steam"},{scheme:"submit",description:"submit",reference:[{type:"draft",href:"http://www.iana.org/go/draft-melnikov-smime-msa-to-mda"}],template:"http://www.iana.org/assignments/uri-schemes/prov/submit"},{scheme:"svn",description:"svn",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/svn"},{scheme:"teamspeak",description:"teamspeak",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/teamspeak"},{scheme:"teliaeid",description:"teliaeid",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/teliaeid"},{scheme:"things",description:"things",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/things"},{scheme:"tool",description:"tool",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/tool"},{scheme:"udp",description:"udp",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/udp"},{scheme:"unreal",description:"unreal",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/unreal"},{scheme:"ut2004",description:"ut2004",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ut2004"},{scheme:"v-event",description:"v-event",reference:[{type:"draft",href:"http://www.iana.org/go/draft-menderico-v-event-uri"}],template:"http://www.iana.org/assignments/uri-schemes/prov/v-event"},{scheme:"ventrilo",description:"ventrilo",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ventrilo"},{scheme:"view-source",description:"view-source",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/view-source"},{scheme:"webcal",description:"webcal",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/webcal"},{scheme:"wpid",description:"wpid",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/wpid"},{scheme:"wtai",description:"wtai",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/wtai"},{scheme:"wyciwyg",description:"wyciwyg",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/wyciwyg"},{scheme:"xfire",description:"xfire",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/xfire"},{scheme:"xri",description:"xri",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/xri"},{scheme:"ymsgr",description:"ymsgr",reference:[],template:"http://www.iana.org/assignments/uri-schemes/prov/ymsgr"}]}),kl=K(function(t,e){e.exports=[{scheme:"fax",description:"fax",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2806"},{type:"rfc",href:"http://www.iana.org/go/rfc3966"}]},{scheme:"filesystem",description:"filesystem",reference:[],template:"http://www.iana.org/assignments/uri-schemes/historic/filesystem"},{scheme:"mailserver",description:"Access to data available from mail servers",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc6196"}]},{scheme:"modem",description:"modem",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc2806"},{type:"rfc",href:"http://www.iana.org/go/rfc3966"}]},{scheme:"pack",description:"pack",reference:[{type:"draft",href:"http://www.iana.org/go/draft-shur-pack-uri-scheme"}],template:"http://www.iana.org/assignments/uri-schemes/historic/pack"},{scheme:"prospero",description:"Prospero Directory Service",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4157"}]},{scheme:"snews",description:"NNTP over SSL/TLS",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc5538"}]},{scheme:"videotex",description:"videotex",reference:[{type:"draft",href:"http://www.iana.org/go/draft-mavrakis-videotex-url-spec"},{type:"rfc",href:"http://www.iana.org/go/rfc2122"},{type:"rfc",href:"http://www.iana.org/go/rfc3986"}],template:"http://www.iana.org/assignments/uri-schemes/historic/videotex"},{scheme:"wais",description:"Wide Area Information Servers",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc4156"}]},{scheme:"z39.50",description:"Z39.50 information access",reference:[{type:"rfc",href:"http://www.iana.org/go/rfc1738"},{type:"rfc",href:"http://www.iana.org/go/rfc2056"}]}]}),Ol=K(function(t,e){e.exports=[{scheme:"android-app"},{scheme:"webpack"},{scheme:"s3",description:"Amazon Web Services S3 bucket"},{scheme:"gs",description:"Google Cloud Storage"},{scheme:"mqtt",description:"Message Queuing Telemetry Transport Protocol"},{scheme:"modbus+tcp",description:"Modbus over TCP"}]}),Xi=K(function(t,e){var r=El(),n={permanent:Sl(),provosional:Pl(),historical:kl()},s={};Object.keys(n).forEach(function(o){n[o].forEach(function(i){s[i.scheme]=r(i,{type:o})})}),n.unofficial=Ol().filter(function(o){return!s[o.scheme]}),n.unofficial.forEach(function(o){s[o.scheme]=r(o,{type:"unofficial"})}),e.exports=r(n,{allByName:s})}),Nl=K(function(t,e){var{parse:r}=ms(),{addressParser:n}=vs(),s=Xi();function o(i){try{return n(i),!0}catch{return!1}}e.exports=i=>{const l=r(i);return!!(l.scheme==="mailto"&&l.to.every(o)||l.reference==="absolute"&&s.allByName[l.scheme])}}),Tl=K(function(t,e){e.exports=/^P(?!$)(\d+(?:\.\d+)?Y)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?W)?(\d+(?:\.\d+)?D)?(T(?=\d)(\d+(?:\.\d+)?H)?(\d+(?:\.\d+)?M)?(\d+(?:\.\d+)?S)?)?$/}),Rl=K(function(t,e){var{parse:r}=vs();e.exports=n=>{try{return r(n),!0}catch{return!1}}}),Il={};function Yi(t){return this[t]}function Cl(t,e){this[t]=Dl.bind(null,e)}var Zi,ea,Sr,ys,rn,Al=(t,e,r)=>{var n=e&&typeof e=="object"||typeof e=="function"?ys(e):[];for(let s of n)!rn.call(t,s)&&s!=="default"&&Sr(t,s,{get:Yi.bind(e,s),enumerable:!0})},jl,Ws=(t,e,r)=>{var n=t!=null&&typeof t=="object";if(n){var s=jl??(jl=new WeakMap),o=s.get(t);if(o)return o}r=t!=null?Zi(ea(t)):{};let i=e||!t||!t.__esModule||!rn.call(t,"default")?Sr(r,"default",{value:t,enumerable:!0}):r;if(t&&typeof t=="object"||typeof t=="function")for(let l of ys(t))rn.call(i,l)||Sr(i,l,{get:Yi.bind(t,l),enumerable:!0});return n&&s.set(t,i),i},Ml=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dl=t=>t,ql=(t,e)=>{for(var r in e)Sr(t,r,{get:e[r],enumerable:!0,configurable:!0,set:Cl.bind(e,r)})},An,jn,Mn,Ll,Vl=Dc(()=>{Zi=Object.create,{getPrototypeOf:ea,defineProperty:Sr,getOwnPropertyNames:ys}=Object,rn=Object.prototype.hasOwnProperty,An=Ml(function(t,e){var r=/^xn--/,n=/[^\0-\x7F]/,s=/[\x2E\u3002\uFF0E\uFF61]/g,o={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},i=Math.floor,l=String.fromCharCode;function a(b){throw RangeError(o[b])}function f(b,g){let h=[],S=b.length;for(;S--;)h[S]=g(b[S]);return h}function u(b,g){let h=b.split("@"),S="";h.length>1&&(S=h[0]+"@",b=h[1]),b=b.replace(s,".");let O=b.split("."),C=f(O,g).join(".");return S+C}function d(b){let g=[],h=0,S=b.length;for(;h<S;){let O=b.charCodeAt(h++);if(O>=55296&&O<=56319&&h<S){let C=b.charCodeAt(h++);(C&64512)==56320?g.push(((O&1023)<<10)+(C&1023)+65536):(g.push(O),h--)}else g.push(O)}return g}var w=b=>String.fromCodePoint(...b),P=function(b){return b>=48&&b<58?26+(b-48):b>=65&&b<91?b-65:b>=97&&b<123?b-97:36},$=function(b,g){return b+22+75*(b<26)-((g!=0)<<5)},E=function(b,g,h){let S=0;for(b=h?i(b/700):b>>1,b+=i(b/g);b>455;S+=36)b=i(b/35);return i(S+36*b/(b+38))},m=function(b){let g=[],h=b.length,S=0,O=128,C=72,D=b.lastIndexOf("-");D<0&&(D=0);for(let q=0;q<D;++q)b.charCodeAt(q)>=128&&a("not-basic"),g.push(b.charCodeAt(q));for(let q=D>0?D+1:0;q<h;){let X=S;for(let Z=1,ce=36;;ce+=36){q>=h&&a("invalid-input");let ye=P(b.charCodeAt(q++));ye>=36&&a("invalid-input"),ye>i((2147483647-S)/Z)&&a("overflow"),S+=ye*Z;let Re=ce<=C?1:ce>=C+26?26:ce-C;if(ye<Re)break;let ie=36-Re;Z>i(2147483647/ie)&&a("overflow"),Z*=ie}let G=g.length+1;C=E(S-X,G,X==0),i(S/G)>2147483647-O&&a("overflow"),O+=i(S/G),S%=G,g.splice(S++,0,O)}return String.fromCodePoint(...g)},c=function(b){let g=[];b=d(b);let h=b.length,S=128,O=0,C=72;for(let X of b)X<128&&g.push(l(X));let D=g.length,q=D;for(D&&g.push("-");q<h;){let X=2147483647;for(let Z of b)Z>=S&&Z<X&&(X=Z);let G=q+1;X-S>i((2147483647-O)/G)&&a("overflow"),O+=(X-S)*G,S=X;for(let Z of b)if(Z<S&&++O>2147483647&&a("overflow"),Z===S){let ce=O;for(let ye=36;;ye+=36){let Re=ye<=C?1:ye>=C+26?26:ye-C;if(ce<Re)break;let ie=ce-Re,z=36-Re;g.push(l($(Re+ie%z,0))),ce=i(ie/z)}g.push(l($(ce,0))),C=E(O,G,q===D),O=0,++q}++O,++S}return g.join("")},_=function(b){return u(b,function(g){return r.test(g)?m(g.slice(4).toLowerCase()):g})},p=function(b){return u(b,function(g){return n.test(g)?"xn--"+c(g):g})},v={version:"2.3.1",ucs2:{decode:d,encode:w},decode:m,encode:c,toASCII:p,toUnicode:_};e.exports=v}),jn={},ql(jn,{default:()=>Mn.default}),Al(jn,Ws(An())),Mn=Ws(An()),Ll=Mn.default}),Ul=K(function(t,e){var{toASCII:r}=(Vl(),Mc(Il)),n=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;e.exports=s=>{const o=r(s);return o.replace(/\.$/,"").length<=253&&n.test(o)}}),Fl=K(function(t,e){var{parse:r}=ms(),{addressParser:n}=vs(),s=Xi();function o(i){try{return n(i),!0}catch{return!1}}e.exports=i=>{const l=r(i);return l.scheme==="mailto"&&l.to.every(o)||l.reference==="absolute"&&l.path!==void 0&&s.allByName[l.scheme]?!0:l.scheme&&!s.allByName[l.scheme]?!1:l.path!==void 0&&(l.reference==="relative"||l.reference==="same-document"||l.reference==="uri")}}),zl=K(function(t,e){t.iri=Nl(),t.duration=Tl(),t["idn-email"]=Rl(),t["idn-hostname"]=Ul(),t["iri-reference"]=Fl()}),Bl=K(function(t,e){var r=zl();e.exports=(n,s={})=>{const o=Object.keys(r);let i=o;if(s.formats){if(!Array.isArray(s.formats))throw new Error("options.formats must be an array");i=s.formats}return o.filter(l=>i.includes(l)).forEach(l=>{n.addFormat(l,r[l])}),n}}),xl=K(function(t,e){var r=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function o(f,u,d){this.fn=f,this.context=u,this.once=d||!1}function i(f,u,d,w,P){if(typeof d!="function")throw new TypeError("The listener must be a function");var $=new o(d,w||f,P),E=n?n+u:u;return f._events[E]?f._events[E].fn?f._events[E]=[f._events[E],$]:f._events[E].push($):(f._events[E]=$,f._eventsCount++),f}function l(f,u){--f._eventsCount===0?f._events=new s:delete f._events[u]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],d,w;if(this._eventsCount===0)return u;for(w in d=this._events)r.call(d,w)&&u.push(n?w.slice(1):w);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=n?n+u:u,w=this._events[d];if(!w)return[];if(w.fn)return[w.fn];for(var P=0,$=w.length,E=new Array($);P<$;P++)E[P]=w[P].fn;return E},a.prototype.listenerCount=function(u){var d=n?n+u:u,w=this._events[d];return w?w.fn?1:w.length:0},a.prototype.emit=function(u,d,w,P,$,E){var m=n?n+u:u;if(!this._events[m])return!1;var c=this._events[m],_=arguments.length,p,v;if(c.fn){switch(c.once&&this.removeListener(u,c.fn,void 0,!0),_){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,d),!0;case 3:return c.fn.call(c.context,d,w),!0;case 4:return c.fn.call(c.context,d,w,P),!0;case 5:return c.fn.call(c.context,d,w,P,$),!0;case 6:return c.fn.call(c.context,d,w,P,$,E),!0}for(v=1,p=new Array(_-1);v<_;v++)p[v-1]=arguments[v];c.fn.apply(c.context,p)}else{var b=c.length,g;for(v=0;v<b;v++)switch(c[v].once&&this.removeListener(u,c[v].fn,void 0,!0),_){case 1:c[v].fn.call(c[v].context);break;case 2:c[v].fn.call(c[v].context,d);break;case 3:c[v].fn.call(c[v].context,d,w);break;case 4:c[v].fn.call(c[v].context,d,w,P);break;default:if(!p)for(g=1,p=new Array(_-1);g<_;g++)p[g-1]=arguments[g];c[v].fn.apply(c[v].context,p)}}return!0},a.prototype.on=function(u,d,w){return i(this,u,d,w,!1)},a.prototype.once=function(u,d,w){return i(this,u,d,w,!0)},a.prototype.removeListener=function(u,d,w,P){var $=n?n+u:u;if(!this._events[$])return this;if(!d)return l(this,$),this;var E=this._events[$];if(E.fn)E.fn===d&&(!P||E.once)&&(!w||E.context===w)&&l(this,$);else{for(var m=0,c=[],_=E.length;m<_;m++)(E[m].fn!==d||P&&!E[m].once||w&&E[m].context!==w)&&c.push(E[m]);c.length?this._events[$]=c.length===1?c[0]:c:l(this,$)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&l(this,d)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,typeof e<"u"&&(e.exports=a)}),Hl="https://www.w3.org/ns/activitystreams",Kl="https://sockethub.org/ns/context/v1.jsonld",Gl="error",Wl="https://sockethub.org/ns/context/platform/error/v1.jsonld",Jl="sockethub:internal",Ql="https://sockethub.org/ns/context/platform/sockethub:internal/v1.jsonld",_s=new Map,ta=new Map,ra=new Map;function Xl(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function Yl(t){return Xl(t["@context"])}function na(t,e,r,n){_s.set(e,t),ta.set(e,r),ra.set(e,n)}function mn(t){const r=Yl(t).filter(n=>_s.has(n));return r.length!==1?null:r[0]}function sa(t){return _s.get(t)}function Zl(t){return ta.get(t)}function ef(t){return ra.get(t)}var ia={feed:{required:["id","type"],additionalProperties:!0,properties:{type:{enum:["feed"]},id:{type:"string",format:"iri"},name:{type:"string"},description:{type:"string"},author:{type:"string"},favicon:{type:"string"}}},person:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["person"]},name:{type:"string"}}},room:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["room"]},name:{type:"string"}}},service:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["service"]},name:{type:"string"}}},platform:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string"},type:{enum:["platform"]},name:{type:"string"}}},website:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string",format:"iri"},type:{enum:["website"]},name:{type:"string"}}},address:{required:["type"],additionalProperties:!1,properties:{type:{enum:["address"]}}},calendar:{required:["id","type"],additionalProperties:!0,properties:{id:{type:"string",format:"iri"},type:{enum:["calendar"]},name:{type:"string"},components:{type:"array",items:{enum:["event","task"]}}}},addressBook:{required:["id","type"],additionalProperties:!1,properties:{id:{type:"string",format:"iri"},type:{enum:["addressBook"]}}}},tf=Object.keys(ia),aa=["person","room","service","feed","website","platform"],oa=["person","room","service","feed","website","platform","address","calendar","addressBook"],rf=aa.map(t=>({$ref:`#/definitions/type/${t}`})),nf=oa.map(t=>({$ref:`#/definitions/type/${t}`})),sf={type:"array",minItems:3,maxItems:3,items:{type:"string"},allOf:[{contains:{const:Hl}},{contains:{const:Kl}}]},af={type:"string"},of={$id:"https://sockethub.org/schemas/v/activity-stream.json",description:"Schema for Sockethub Activity Streams",type:"object",required:["@context","type","actor"],additionalProperties:!1,properties:{"@context":sf,id:{type:"string"},type:af,actor:{type:"object",oneOf:rf},target:{type:"object",oneOf:nf},object:{type:"object"},published:{type:"string",format:"date-time"}},definitions:{type:ia}},cf={version:"3.0.0-beta.6"};function uf(t,e){return t.replace("/v/",`/${e}/`)}var lf={$id:"https://sockethub.org/schemas/v/sockethub-config.json"};uf(lf.$id,cf.version);var ff=Pr(Hi()),jr,Js=!1;function gn(){if(jr===void 0)try{new Function("return true"),jr=!0}catch{jr=!1}return jr}function vn(){Js||(Js=!0,console.warn("[@sockethub/schemas] Schema validation is disabled: this environment's Content Security Policy blocks `new Function`, which Ajv needs to compile schemas. The Sockethub server still validates every message."))}var Qs={type:"integer",minimum:0},df={type:"string",minLength:1},Xs={type:"string",pattern:"^/(?![/\\\\])[^\\s\\\\]*$"},hf={$id:"https://sockethub.org/schemas/v/service-descriptor.json",description:"Sockethub service descriptor",type:"object",required:["name","apiVersion","platforms"],additionalProperties:!0,properties:{name:{const:"sockethub"},apiVersion:Qs,endpoints:{type:"object",required:["socketIO"],additionalProperties:!0,properties:{socketIO:Xs,httpActions:Xs}},platforms:{type:"array",items:{type:"object",required:["id","apiVersion"],additionalProperties:!0,properties:{id:df,apiVersion:Qs}}}}},Dn,Ys;function pf(t){return gn()?(Dn||(Dn=new ff.default({strictTypes:!1,allErrors:!0})),Ys??(Ys=Dn.compile(hf)),Ys(t)):(vn(),mf(t))}function mf(t){if(!t||typeof t!="object")return!1;const e=t;if(e.name!=="sockethub"||!Zs(e.apiVersion)||!Array.isArray(e.platforms))return!1;for(const r of e.platforms){if(!r||typeof r!="object")return!1;const n=r;if(typeof n.id!="string"||n.id.length===0||!Zs(n.apiVersion))return!1}if(e.endpoints!==void 0){if(!e.endpoints||typeof e.endpoints!="object")return!1;const r=e.endpoints;if(!ei(r.socketIO)||r.httpActions!==void 0&&!ei(r.httpActions))return!1}return!0}function Zs(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function ei(t){return typeof t=="string"&&/^\/(?![/\\])[^\s\\]*$/.test(t)}var gf=Pr(Hi()),vf=Pr(wl()),yf=Pr(Bl());function _f(t){let e=`${t.instancePath?t.instancePath:"activity stream"}: ${t.message}`;return t.keyword==="additionalProperties"?e+=`: ${t.params.additionalProperty}`:t.keyword==="enum"&&(e+=`: ${t.params.allowedValues.join(", ")}`),e}var wf=64;function wr(t,e=0){const r=[];if(e>wf)return r;t!=null&&t.type&&r.push(t.type);const n=t;for(const s in n){const o=n[s];o&&typeof o=="object"&&"type"in o&&r.push(...wr(o,e+1))}return r}function bf(t){const e=t.schemaPath.match(/#\/\w+\/\w+\/([\w-]+)\//);return e?e[1]:void 0}function $f(t){const e=t.instancePath.match(/\/(\w+)/);return e?e[1]:void 0}function Ef(t,e){const r=bf(t),n=$f(t);if(!n)return-1;const s=e[n];return!s||!r||!s.includes(r)?-1:t.instancePath.split("/").length}function Sf(t){if(!Array.isArray(t["@context"]))return{actor:[],target:[],object:wr(t)};const e=t;return{actor:wr(e.actor),target:wr(e.target),object:e.object?wr(e.object):[]}}function Pf(t,e,r){const n=Sf(t);let s=0,o=-1;for(let i=0;i<e.length;i++){const l=Ef(e[i],n);l>o&&(o=l,s=i)}return o>=0?_f(e[s]):Of(e[e.length-1],r)}function kf(t,e){if(!(e!=null&&e.excludeTypes)||e.excludeTypes.length===0)return t;const r=new Set(e.excludeTypes);return t.filter(n=>!r.has(n))}function Of(t,e){let r;if(t.keyword==="oneOf"){const n=t.instancePath.split("/")[1],s=n==="actor"?aa:n==="target"?oa:tf,o=kf(s,e),i=o.length>0?o:s;r=`${t.instancePath}: ${t.message}: ${i.join(", ")}`}else r=`${t.instancePath?t.instancePath:"activity stream"}: ${t.message}`;return"additionalProperty"in t.params&&(r+=`: ${t.params.additionalProperty}`),r}var qt="https://sockethub.org/schemas/v0",Qn={},Nf={},ti=!1;Qn[`${qt}/activity-stream`]=of;var qn;function ws(){if(!gn()){vn();return}if(!qn){const t=new gf.default({strictTypes:!1,allErrors:!0});vf.default(t),yf.default(t);for(const e in Qn)t.addSchema(Qn[e],e);qn=t}return qn}function ri(t,e){na(t,e,`${qt}/context/${t}/messages`,`${qt}/context/${t}/credentials`);const r=ws();if(!r)return;const n=`${qt}/context/${t}/messages`;r.getSchema(n)||r.addSchema({},n);const s=`${qt}/context/${t}/credentials`;r.getSchema(s)||r.addSchema({},s)}function Tf(){ti||(ri(Gl,Wl),ri(Jl,Ql),ti=!0)}Tf();function nn(t,e){const r=ws();if(!r)return"";const n=r.getSchema(t);if(!n)return`schema ${t} not found`;if(!n(e)){let o=Pf(e,n.errors,Nf);if(Array.isArray(e["@context"])){const i=mn(e);if(i){const l=sa(i);l&&(o=`[${l}] ${o}`)}}return o}return""}function Rf(t){if(!gn())return vn(),"";const e=nn(`${qt}/activity-stream`,t);if(e)return e;const r=mn(t);if(!r)return"activity streams must have exactly one registered platform context URL in @context";const n=Zl(r);return n?nn(n,t):`platform context URL ${r} does not have a registered message schema`}function If(t){if(!gn())return vn(),"";if(!Array.isArray(t["@context"]))return"credential activity streams must have an @context set";if(t.type!=="credentials")return"credential activity streams must have credentials set as type";const e=nn(`${qt}/activity-stream`,t);if(e)return e;const r=mn(t);if(!r)return"credential activity streams must have exactly one registered platform context URL in @context";const n=ef(r);return n?nn(n,t):`platform context URL ${r} does not have a registered credentials schema`}function ni(t,e){const r=ws();if(!r)return;const n=`${qt}/context/${e}`;r.removeSchema(n),r.addSchema(t,n)}function Cf(t,e){na(t,e,`${qt}/context/${t}/messages`,`${qt}/context/${t}/credentials`)}function sn(t){const e=mn(t);return e?sa(e)??null:null}var si={actor:"id",target:"id",object:"content"};function Af(t,e){return typeof t=="string"?{[e]:t}:Array.isArray(t)?t.map(r=>typeof r=="string"?{id:r}:r):t}function Vr(t){const e={...t};for(const r of Object.keys(si))r in e&&(e[r]=Af(e[r],si[r]));return e}var jf=Pr(xl()),Mf=jf.default,Df=/^v?(\d+)(?:\.\d+){0,2}(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;function Ln(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function ii(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0}function ai(t){if(!t||typeof t!="object")return;const{apiVersion:e,version:r}=t;if(ii(e))return e;if(typeof r=="string"){const n=Df.exec(r.trim()),s=n?Number(n[1]):void 0;if(ii(s))return s}}function qf(t){var i,l;if(!t||typeof t!="object")return;const e=t,r=(i=e.contexts)==null?void 0:i.as,n=(l=e.contexts)==null?void 0:l.sockethub;if(typeof r!="string"||typeof n!="string"||!Array.isArray(e.platforms))return;const s=ai(e);if(s===void 0)return;const o=new Map;for(const a of e.platforms){if(!a||typeof a!="object"||typeof a.id!="string"||typeof a.contextUrl!="string"||typeof a.contextVersion!="string"||typeof a.schemaVersion!="string")continue;const f=ai(a);if(f===void 0)continue;const u=Ln(a.schemas)?a.schemas:{};o.set(a.id,{id:a.id,apiVersion:f,contextUrl:a.contextUrl,contextVersion:a.contextVersion,schemaVersion:a.schemaVersion,types:Array.isArray(a.types)?a.types.filter(d=>typeof d=="string"):[],schemas:{credentials:Ln(u.credentials)?u.credentials:void 0,messages:Ln(u.messages)?u.messages:void 0}})}return{apiVersion:s,asContextUrl:r,sockethubContextUrl:n,platforms:o}}function Lf(t){Cf(t.id,t.contextUrl);try{t.schemas.credentials&&ni(t.schemas.credentials,`${t.id}/credentials`),t.schemas.messages&&ni(t.schemas.messages,`${t.id}/messages`)}catch(e){const r=e instanceof Error?e.message:String(e);console.warn(`[SockethubClient] Failed to register schemas for platform ${t.id}: ${r}`)}}class Kt extends Error{constructor(e,r){super(e,r),this.name="DiscoveryError"}}async function Vf(t,e={}){let r;try{r=new URL(t)}catch(f){throw new Kt(`Sockethub discovery needs an absolute base URL, got ${JSON.stringify(t)}`,{cause:f})}if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Kt(`Sockethub discovery needs an http(s) base URL, got ${JSON.stringify(t)}`);const n=e.fetch??globalThis.fetch;if(typeof n!="function")throw new Kt("Sockethub discovery needs fetch(); pass one in the options");const s=new AbortController,o=e.discoveryTimeoutMs??1e4,i=setTimeout(()=>s.abort(),o),l=()=>s.signal.aborted;let a;try{let f;try{f=await n(r.href,{headers:{accept:"application/json"},signal:s.signal})}catch(u){const d=l()?`timed out after ${o}ms`:u instanceof Error?u.message:String(u);throw new Kt(`Sockethub discovery failed: could not reach ${r.href} (${d})`,{cause:u})}if(!f.ok)throw new Kt(`Sockethub discovery failed: ${r.href} answered ${f.status}`);try{a=await f.json()}catch(u){throw new Kt(l()?`Sockethub discovery failed: ${r.href} timed out after ${o}ms while sending the descriptor`:`Sockethub discovery failed: ${r.href} did not return JSON; is it a Sockethub server?`,{cause:u})}}finally{clearTimeout(i)}if(!pf(a))throw new Kt(`Sockethub discovery failed: ${r.href} did not return a valid service descriptor`);return a}function Uf(t,e){const r=new URL(e,t);if(r.origin!==new URL(t).origin)throw new Kt(`Sockethub discovery failed: endpoint path ${JSON.stringify(e)} resolves to ${r.origin}, not ${t}`);return r.href}async function Ff(t){if(t)return t;const e=globalThis.io;if(typeof e=="function")return e;try{const r=await _o(()=>import("./5EUVsl4H.js"),[],import.meta.url);if(typeof r.io=="function")return r.io}catch{}throw new Error("SockethubClient.connect() needs socket.io-client: install it, load /socket.io.js, or pass `io` in the options")}var oi="https://sockethub.org/ns/context/platform/";function zf(t){if(Array.isArray(t)){for(const e of t)if(typeof e=="string"&&e.startsWith(oi)){const r=e.slice(oi.length),n=r.indexOf("/");if(n>0)return r.slice(0,n)}}}function Vn(t){return typeof t=="object"&&t!==null&&"error"in t&&!!t.error}function bs(t){return"actor"in t&&t.actor!==null&&typeof t.actor=="object"&&"id"in t.actor&&typeof t.actor.id=="string"}function ci(t){var e,r;return(t==null?void 0:t.type)==="update"&&((e=t.object)==null?void 0:e.type)==="address"&&bs(t)&&typeof t.target=="object"&&typeof((r=t.target)==null?void 0:r.id)=="string"&&t.target.id!==t.actor.id}function Un(t){var s;const e=((s=t.actor)==null?void 0:s.id)||t.actor;if(!e)throw new Error(`actor property not present for message type: ${t==null?void 0:t.type}`);const r=t.target?t.target.id||t.target:"";return`${sn(t)??""}:${e}-${r}`}function Xn(t,e){var n;if(!t||typeof t!="object")return!1;const r=Vr(t);return((n=r.actor)==null?void 0:n.id)===e.actorId&&(sn(r)??zf(r["@context"]))===e.platform}class Bf{constructor(){Ye(this,"events",{credentials:new Map,connect:new Map,join:new Map})}clearCredentials(e){if(!e){this.events.credentials.clear();return}for(const r of Object.values(this.events))for(const[n,s]of r)Xn(s,e)&&r.delete(n)}recordCredentials(e){e.object&&e.object.type==="credentials"&&this.events.credentials.set(Un(e),e)}recordMessage(e){const r=Un(e);e.type==="join"||e.type==="connect"?this.events[e.type].set(r,e):e.type==="leave"?this.events.join.delete(r):e.type==="disconnect"&&this.events.connect.delete(r)}moveActor(e){const r=e.actor.id,n=e.target,s=n.id,o=typeof n.name=="string"?n.name:void 0,i=sn(e)??"",l=[];for(const a of Object.values(this.events))for(const[f,u]of[...a]){if(!bs(u)||u.actor.id!==r||(sn(u)??"")!==i)continue;const d={...u,actor:{...u.actor,id:s,...o?{name:o}:{}}};a.delete(f),a.set(Un(d),d),l.push([r,s])}return l}}class yn{constructor(e,r={},n){Ye(this,"replayStore",new Bf);Ye(this,"_socket");Ye(this,"socket");Ye(this,"debug",!0);Ye(this,"descriptor");Ye(this,"serverOrigin");Ye(this,"options");Ye(this,"platformRegistry",new Map);Ye(this,"asContextUrl");Ye(this,"sockethubContextUrl");Ye(this,"apiVersion");Ye(this,"initState","idle");Ye(this,"hasReadyOnce",!1);Ye(this,"initCycle");Ye(this,"initTokenCounter",0);Ye(this,"initTimeoutTimer");Ye(this,"waitingWarningTimer");Ye(this,"waitingWarningIntervalMs",1e4);Ye(this,"readyWaiters",[]);Ye(this,"outboundQueue",[]);Ye(this,"outboundSequence",0);Ye(this,"pendingScopedClears",[]);Ye(this,"registryFingerprint");Ye(this,"latestReadyInfo");if(!e)throw new Error("SockethubClient requires a socket.io instance");this._socket=e,this.descriptor=n==null?void 0:n.descriptor,this.serverOrigin=n==null?void 0:n.serverOrigin,this.options={initTimeoutMs:r.initTimeoutMs??5e3,maxQueuedOutbound:r.maxQueuedOutbound??1e3,maxQueuedAgeMs:r.maxQueuedAgeMs??3e4,validation:r.validation??"auto"},this.socket=this.createPublicEmitter(),this.registerSocketIOHandlers(),this._socket.connected&&(this.socket.connected=!0,this.socket.id=this._socket.id,this.socket._emit("connect"),this.startInitialization("initial-connect",!0))}endpointUrl(e){var n,s;const r=(s=(n=this.descriptor)==null?void 0:n.endpoints)==null?void 0:s[e];if(!(!this.serverOrigin||!r))return Uf(this.serverOrigin,r)}static async connect(e,r={}){var P;const{io:n,socketOptions:s,fetch:o,discoveryTimeoutMs:i,...l}=r,a=await Vf(e,{fetch:o,discoveryTimeoutMs:i}),f=(P=a.endpoints)==null?void 0:P.socketIO;if(!f)throw new Kt(`Sockethub discovery failed: ${e} does not advertise a Socket.IO endpoint (older server?); pass a socket to the constructor instead`);const u=new URL(e).origin,w=(await Ff(n))(u,{...s,path:f});return new yn(w,l,{descriptor:a,serverOrigin:u})}clearCredentials(e){const r=[];this.outboundQueue=this.outboundQueue.filter(n=>n.event==="credentials"&&(!e||Xn(n.content,e))?(r.push(n),!1):!0),this.replayStore.clearCredentials(e),e&&!this.isReady()&&this.pendingScopedClears.push({scope:e,before:this.outboundSequence}),this.emitCancelled(r)}emitCancelled(e){for(const r of e)this.emitClientError(r.event,r.callback,"SockethubClient queued credentials cancelled by clearCredentials")}getRegisteredPlatforms(){return Array.from(this.platformRegistry.values()).map(e=>({...e,types:[...e.types],schemas:{...e.schemas}}))}isSchemasReady(){return this.isReady()}isReady(){return this.initState==="ready"}getInitState(){return this.initState}getRegisteredBaseContexts(){if(!this.asContextUrl||!this.sockethubContextUrl)throw new Error("Schema registry not loaded yet. Wait for client ready state after connect.");return{as:this.asContextUrl,sockethub:this.sockethubContextUrl}}getPlatformSchema(e,r="messages"){var s,o;const n=e==null?void 0:e.trim();if(n)return(o=(s=this.platformRegistry.get(n))==null?void 0:s.schemas)==null?void 0:o[r]}async waitForSchemas(e=2e3){return await this.ready(e),this.buildPlatformRegistryPayload()}ready(e=this.options.initTimeoutMs){return this.isReady()&&this.latestReadyInfo?Promise.resolve(this.latestReadyInfo):new Promise((r,n)=>{const s={resolve:r,reject:n};e>0&&(s.timer=setTimeout(()=>{this.readyWaiters=this.readyWaiters.filter(o=>o!==s),n(new Error(`SockethubClient ready() timed out after ${e}ms`))},e)),this.readyWaiters.push(s),this.socket.connected&&this.initState==="idle"&&this.startInitialization(this.hasReadyOnce?"reconnect":"initial-connect",!0)})}validateActivity(e){return this.options.validation==="off"?"":e.type==="credentials"?If(e):Rf(e)}contextFor(e){if(typeof e!="string"||e.trim().length===0)throw new Error("SockethubClient.contextFor(platform) requires a non-empty platform string");if(!this.asContextUrl||!this.sockethubContextUrl)throw new Error("Schema registry not loaded yet. Wait for client ready state after connect.");const r=e.trim(),n=this.platformRegistry.get(r);if(!n){const s=Array.from(this.platformRegistry.keys()).sort();throw new Error(`unknown platform '${r}'. Registered platforms: ${s.join(", ")}`)}return[this.asContextUrl,this.sockethubContextUrl,n.contextUrl]}createPublicEmitter(){const e=new Mf;return e._emit=e.emit,e.emit=(r,n,s)=>{this.handlePublicEmit(r,n,s)},e.connected=!1,e.disconnect=()=>{this._socket.disconnect()},e.connect=()=>{this._socket.connect()},e}requestSchemaRegistry(){"io"in this._socket&&this._socket.emit("schemas",this.registryFingerprint,r=>{this.handleSchemasPayload(r)})}applyPlatformRegistry(e){const r=qf(e);if(!r)return;this.apiVersion=r.apiVersion,this.asContextUrl=r.asContextUrl,this.sockethubContextUrl=r.sockethubContextUrl,this.platformRegistry=r.platforms;for(const o of r.platforms.values())Lf(o);const n=this.buildPlatformRegistryPayload(),s=e;return this.registryFingerprint=typeof s.fingerprint=="string"?s.fingerprint:void 0,this.socket._emit("schemas",n),n}buildPlatformRegistryPayload(){return{apiVersion:this.apiVersion,contexts:this.asContextUrl&&this.sockethubContextUrl?{as:this.asContextUrl,sockethub:this.sockethubContextUrl}:void 0,platforms:this.getRegisteredPlatforms()}}buildReadyInfo(e){if(!(this.apiVersion===void 0||!this.asContextUrl||!this.sockethubContextUrl))return{state:"ready",reason:e,apiVersion:this.apiVersion,contexts:{as:this.asContextUrl,sockethub:this.sockethubContextUrl},platforms:this.getRegisteredPlatforms().map(r=>({id:r.id,apiVersion:r.apiVersion,contextUrl:r.contextUrl,contextVersion:r.contextVersion,schemaVersion:r.schemaVersion,types:[...r.types]}))}}resolveReadyWaiters(e){const r=this.readyWaiters;this.readyWaiters=[];for(const n of r)n.timer&&clearTimeout(n.timer),n.resolve(e)}rejectReadyWaiters(e){const r=this.readyWaiters;this.readyWaiters=[];for(const n of r)n.timer&&clearTimeout(n.timer),n.reject(e)}emitInitError(e,r,n){this.socket._emit("init_error",{error:e,phase:r,retrying:n})}emitClientError(e,r,n){if(typeof r=="function"){r({error:n});return}this.socket._emit("client_error",{event:e,error:n})}clearInitTimers(){this.initTimeoutTimer&&(clearTimeout(this.initTimeoutTimer),this.initTimeoutTimer=void 0),this.waitingWarningTimer&&(clearInterval(this.waitingWarningTimer),this.waitingWarningTimer=void 0)}startWaitingWarnings(){this.waitingWarningTimer||(this.waitingWarningTimer=setInterval(()=>{if(this.isReady()||this.initState==="closed"){this.clearInitTimers();return}const e=this.outboundQueue.length,r=this.outboundQueue[0],n=r?((Date.now()-r.enqueuedAt)/1e3).toFixed(1):"0.0";console.warn(`[SockethubClient] Still waiting for schemas; queued outbound messages: ${e}; oldest queued age: ${n}s.`)},this.waitingWarningIntervalMs))}startInitialization(e,r){if(!this.socket.connected||this.initState==="closed")return;const n=++this.initTokenCounter;this.initCycle={token:n,reason:e,startedAt:Date.now(),replayOnReady:r,timedOut:!1},this.initState="initializing",this.clearInitTimers(),this.initTimeoutTimer=setTimeout(()=>{if(!this.initCycle||this.initCycle.token!==n)return;this.initCycle.timedOut=!0,this.initState="init_error";const s=`Initialization timed out after ${this.options.initTimeoutMs}ms waiting for schemas`;console.warn(`[SockethubClient] ${s}; queued outbound messages: ${this.outboundQueue.length}. Waiting for schemas event from server.`),this.emitInitError(s,"timeout",!1),this.startWaitingWarnings()},this.options.initTimeoutMs);try{this.requestSchemaRegistry()}catch(s){this.initState="init_error";const o=s instanceof Error?s.message:String(s);this.emitInitError(o,"schemas-request",!1),this.startWaitingWarnings()}}markReady(e){const r=this.initCycle,n=!!(r!=null&&r.replayOnReady);this.initCycle=void 0,this.clearInitTimers(),this.initState="ready",this.hasReadyOnce=!0;const s=this.buildReadyInfo(e);if(!s){const o=new Error("Failed to build ready payload");this.initState="init_error",this.emitInitError(o.message,"schemas-apply",!0),this.rejectReadyWaiters(o);return}if(this.socket._emit("ready",s),this.latestReadyInfo=s,this.resolveReadyWaiters(s),n){const{credentials:o,connect:i,join:l}=this.replayStore.events;this.replay("credentials",o),this.replay("message",i),this.replay("message",l)}this.flushOutboundQueue()}handleSchemasPayload(e){if(!e||typeof e!="object")return;if(e.unchanged===!0&&typeof this.registryFingerprint=="string"&&this.platformRegistry.size>0){this.initCycle?this.markReady(this.initCycle.reason):this.initState!=="ready"&&this.markReady("schemas-update");return}const r=e.fingerprint;if(this.initState==="ready"&&!this.initCycle&&r&&r===this.registryFingerprint)return;if(this.initState==="ready"&&!this.initCycle&&(this.initState="initializing"),!this.applyPlatformRegistry(e)){this.initState="init_error",this.emitInitError("Received invalid schemas payload from server","schemas-apply",!0),this.startWaitingWarnings();return}if(this.initCycle){this.markReady(this.initCycle.reason);return}this.markReady("schemas-update")}handlePublicEmit(e,r,n){const s={event:e,content:r,callback:n,enqueuedAt:Date.now(),sequence:this.outboundSequence++};if(!this.isReady()){this.enqueueOutbound(s);return}this.sendOutbound(s)}enqueueOutbound(e){if(this.outboundQueue.push(e),this.outboundQueue.length<=this.options.maxQueuedOutbound)return;const r=this.outboundQueue.shift();r&&this.emitClientError(r.event,r.callback,"SockethubClient queue overflow before ready")}flushOutboundQueue(){if(!this.isReady()||this.outboundQueue.length===0)return;const e=Date.now();this.outboundQueue.sort((n,s)=>n.sequence-s.sequence);const r=this.pendingScopedClears;for(this.pendingScopedClears=[];this.outboundQueue.length>0;){const n=this.outboundQueue.shift();if(n.event==="credentials"&&r.some(s=>n.sequence<s.before&&Xn(n.content,s.scope))){this.emitCancelled([n]);continue}if(e-n.enqueuedAt>this.options.maxQueuedAgeMs){this.emitClientError(n.event,n.callback,`SockethubClient queued message expired after ${this.options.maxQueuedAgeMs}ms before initialization`);continue}this.sendOutbound(n)}}sendOutbound(e){let r=e.content;try{if(e.event==="credentials"||e.event==="message"){if(r=Vr(e.content),r&&typeof r=="object"){const s=r;e.event==="credentials"&&!s.type&&(s.type="credentials"),s.actor&&typeof s.actor=="object"&&!s.actor.type&&(s.actor.type="person")}if(this.platformRegistry.size>0){const s=this.validateActivity(r);if(s){this.emitClientError(e.event,e.callback,`SockethubClient validation failed: ${s}`);return}}}let n=e.callback;e.event==="credentials"?this.replayStore.recordCredentials(r):e.event==="message"&&(this._socket.connected&&this.replayStore.recordMessage(r),n=this.rememberRequestedRename(r,n)),this._socket.emit(e.event,r,n)}catch(n){const s=n instanceof Error?n.message:String(n);this.emitClientError(e.event,e.callback,s)}}log(e,r){this.debug&&console.log(e,r)}registerSocketIOHandlers(){this._socket.on("connect",()=>{this.socket.id=this._socket.id,this.socket.connected=!0,this.socket._emit("connect"),this.startInitialization(this.hasReadyOnce?"reconnect":"initial-connect",!0)}),this._socket.on("connect_error",e=>{this.socket._emit("connect_error",e)}),this._socket.on("disconnect",e=>{this.socket.connected=!1,this.initState!=="closed"&&(this.initState="idle"),this.clearInitTimers(),this.socket._emit("disconnect",e)}),this._socket.on("schemas",e=>{this.handleSchemasPayload(e)}),this._socket.on("message",e=>{const r=Vr(e);this.followActorRename(r),this.socket._emit("message",r)})}followActorRename(e){Vn(e)||ci(e)&&this.moveReplayState(e)}rememberRequestedRename(e,r){return ci(e)?(...n)=>{const[s,o]=n;s instanceof Error||Vn(s)||Vn(o)||this.moveReplayState(e),typeof r=="function"&&r(...n)}:r}moveReplayState(e){for(const[r,n]of this.replayStore.moveActor(e))this.log(`replay state moved from ${r} to ${n}`)}replay(e,r){for(const n of r.values()){const s=Vr(n);let o=s==null?void 0:s.id;if(bs(s)){const i=s.actor;o=typeof i=="string"?i:i.id}this.log(`replaying ${e} for ${o}`),this._socket.emit(e,s)}}}(t=>{t.SockethubClient=yn})(typeof globalThis=="object"?globalThis:{});const Vt=Object.create(null);Vt.open="0";Vt.close="1";Vt.ping="2";Vt.pong="3";Vt.message="4";Vt.upgrade="5";Vt.noop="6";const Ur=Object.create(null);Object.keys(Vt).forEach(t=>{Ur[Vt[t]]=t});const Yn={type:"error",data:"parser error"},ca=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ua=typeof ArrayBuffer=="function",la=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,$s=({type:t,data:e},r,n)=>ca&&e instanceof Blob?r?n(e):ui(e,n):ua&&(e instanceof ArrayBuffer||la(e))?r?n(e):ui(new Blob([e]),n):n(Vt[t]+(e||"")),ui=(t,e)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];e("b"+(n||""))},r.readAsDataURL(t)};function li(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Fn;function xf(t,e){if(ca&&t.data instanceof Blob)return t.data.arrayBuffer().then(li).then(e);if(ua&&(t.data instanceof ArrayBuffer||la(t.data)))return e(li(t.data));$s(t,!1,r=>{Fn||(Fn=new TextEncoder),e(Fn.encode(r))})}const fi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",br=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<fi.length;t++)br[fi.charCodeAt(t)]=t;const Hf=t=>{let e=t.length*.75,r=t.length,n,s=0,o,i,l,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),u=new Uint8Array(f);for(n=0;n<r;n+=4)o=br[t.charCodeAt(n)],i=br[t.charCodeAt(n+1)],l=br[t.charCodeAt(n+2)],a=br[t.charCodeAt(n+3)],u[s++]=o<<2|i>>4,u[s++]=(i&15)<<4|l>>2,u[s++]=(l&3)<<6|a&63;return f},Kf=typeof ArrayBuffer=="function",Es=(t,e)=>{if(typeof t!="string")return{type:"message",data:fa(t,e)};const r=t.charAt(0);return r==="b"?{type:"message",data:Gf(t.substring(1),e)}:Ur[r]?t.length>1?{type:Ur[r],data:t.substring(1)}:{type:Ur[r]}:Yn},Gf=(t,e)=>{if(Kf){const r=Hf(t);return fa(r,e)}else return{base64:!0,data:t}},fa=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},da="",Wf=(t,e)=>{const r=t.length,n=new Array(r);let s=0;t.forEach((o,i)=>{$s(o,!1,l=>{n[i]=l,++s===r&&e(n.join(da))})})},Jf=(t,e)=>{const r=t.split(da),n=[];for(let s=0;s<r.length;s++){const o=Es(r[s],e);if(n.push(o),o.type==="error")break}return n};function Qf(){return new TransformStream({transform(t,e){xf(t,r=>{const n=r.length;let s;if(n<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,n);else if(n<65536){s=new Uint8Array(3);const o=new DataView(s.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{s=new Uint8Array(9);const o=new DataView(s.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}t.data&&typeof t.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(r)})}})}let zn;function Mr(t){return t.reduce((e,r)=>e+r.length,0)}function Dr(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let n=0;for(let s=0;s<e;s++)r[s]=t[0][n++],n===t[0].length&&(t.shift(),n=0);return t.length&&n<t[0].length&&(t[0]=t[0].slice(n)),r}function Xf(t,e){zn||(zn=new TextDecoder);const r=[];let n=0,s=-1,o=!1;return new TransformStream({transform(i,l){for(r.push(i);;){if(n===0){if(Mr(r)<1)break;const a=Dr(r,1);o=(a[0]&128)===128,s=a[0]&127,s<126?n=3:s===126?n=1:n=2}else if(n===1){if(Mr(r)<2)break;const a=Dr(r,2);s=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),n=3}else if(n===2){if(Mr(r)<8)break;const a=Dr(r,8),f=new DataView(a.buffer,a.byteOffset,a.length),u=f.getUint32(0);if(u>Math.pow(2,21)-1){l.enqueue(Yn);break}s=u*Math.pow(2,32)+f.getUint32(4),n=3}else{if(Mr(r)<s)break;const a=Dr(r,s);l.enqueue(Es(o?a:zn.decode(a),e)),n=0}if(s===0||s>t){l.enqueue(Yn);break}}}})}const ha=4;function ft(t){if(t)return Yf(t)}function Yf(t){for(var e in ft.prototype)t[e]=ft.prototype[e];return t}ft.prototype.on=ft.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};ft.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this};ft.prototype.off=ft.prototype.removeListener=ft.prototype.removeAllListeners=ft.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var n,s=0;s<r.length;s++)if(n=r[s],n===e||n.fn===e){r.splice(s,1);break}return r.length===0&&delete this._callbacks["$"+t],this};ft.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,e)}return this};ft.prototype.emitReserved=ft.prototype.emit;ft.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};ft.prototype.hasListeners=function(t){return!!this.listeners(t).length};const _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,r)=>r(e,0),Ot=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Zf="arraybuffer";function pa(t,...e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&(r[n]=t[n]),r),{})}const ed=Ot.setTimeout,td=Ot.clearTimeout;function wn(t,e){e.useNativeTimers?(t.setTimeoutFn=ed.bind(Ot),t.clearTimeoutFn=td.bind(Ot)):(t.setTimeoutFn=Ot.setTimeout.bind(Ot),t.clearTimeoutFn=Ot.clearTimeout.bind(Ot))}const rd=1.33;function nd(t){return typeof t=="string"?sd(t):Math.ceil((t.byteLength||t.size)*rd)}function sd(t){let e=0,r=0;for(let n=0,s=t.length;n<s;n++)e=t.charCodeAt(n),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}function ma(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function id(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}function ad(t){let e={},r=t.split("&");for(let n=0,s=r.length;n<s;n++){let o=r[n].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class od extends Error{constructor(e,r,n){super(e),this.description=r,this.context=n,this.type="TransportError"}}class Ss extends ft{constructor(e){super(),this.writable=!1,wn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,r,n){return super.emitReserved("error",new od(e,r,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const r=Es(e,this.socket.binaryType);this.onPacket(r)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,r={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const r=id(e);return r.length?"?"+r:""}}class cd extends Ss{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const r=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||r()})),this.writable||(n++,this.once("drain",function(){--n||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const r=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};Jf(e,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Wf(e,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=ma()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(e,r)}}let ga=!1;try{ga=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ud=ga;function ld(){}class fd extends cd{constructor(e){if(super(e),typeof location<"u"){const r=location.protocol==="https:";let n=location.port;n||(n=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,r){const n=this.request({method:"POST",data:e});n.on("success",r),n.on("error",(s,o)=>{this.onError("xhr post error",s,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(r,n)=>{this.onError("xhr poll error",r,n)}),this.pollXhr=e}}class Lt extends ft{constructor(e,r,n){super(),this.createRequest=e,wn(this,n),this._opts=n,this._method=n.method||"GET",this._uri=r,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var e;const r=pa(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(r);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&n.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var s;n.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=Lt.requestsCount++,Lt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=ld,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Lt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Lt.requestsCount=0;Lt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",di);else if(typeof addEventListener=="function"){const t="onpagehide"in Ot?"pagehide":"unload";addEventListener(t,di,!1)}}function di(){for(let t in Lt.requests)Lt.requests.hasOwnProperty(t)&&Lt.requests[t].abort()}const dd=function(){const t=va({xdomain:!1});return t&&t.responseType!==null}();class hd extends fd{constructor(e){super(e);const r=e&&e.forceBase64;this.supportsBinary=dd&&!r}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Lt(va,this.uri(),e)}}function va(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ud))return new XMLHttpRequest}catch{}if(!e)try{return new Ot[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const ya=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class pd extends Ss{get name(){return"websocket"}doOpen(){const e=this.uri(),r=this.opts.protocols,n=ya?{}:pa(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,r,n)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],s=r===e.length-1;$s(n,this.supportsBinary,o=>{try{this.doWrite(n,o)}catch{}s&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=ma()),this.supportsBinary||(r.b64=1),this.createUri(e,r)}}const Bn=Ot.WebSocket||Ot.MozWebSocket;class md extends pd{createSocket(e,r,n){return ya?new Bn(e,r,n):r?new Bn(e,r):new Bn(e)}doWrite(e,r){this.ws.send(r)}}class gd extends Ss{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const r=Xf(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(r).getReader(),s=Qf();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const o=()=>{n.read().then(({done:l,value:a})=>{l||(this.onPacket(a),o())}).catch(l=>{})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],s=r===e.length-1;this._writer.write(n).then(()=>{s&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const vd={websocket:md,webtransport:gd,polling:hd},yd=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,_d=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zn(t){if(t.length>8e3)throw"URI too long";const e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));let s=yd.exec(t||""),o={},i=14;for(;i--;)o[_d[i]]=s[i]||"";return r!=-1&&n!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=wd(o,o.path),o.queryKey=bd(o,o.query),o}function wd(t,e){const r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function bd(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,s,o){s&&(r[s]=o)}),r}const es=typeof addEventListener=="function"&&typeof removeEventListener=="function",Fr=[];es&&addEventListener("offline",()=>{Fr.forEach(t=>t())},!1);class Yt extends ft{constructor(e,r){if(super(),this.binaryType=Zf,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(r=e,e=null),e){const n=Zn(e);r.hostname=n.host,r.secure=n.protocol==="https"||n.protocol==="wss",r.port=n.port,n.query&&(r.query=n.query)}else r.host&&(r.hostname=Zn(r.host).host);wn(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(n=>{const s=n.prototype.name;this.transports.push(s),this._transportsByName[s]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ad(this.opts.query)),es&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Fr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const r=Object.assign({},this.opts.query);r.EIO=ha,r.transport=e,this.id&&(r.sid=this.id);const n=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Yt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(e);r.open(),this.setTransport(r)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",Yt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=e.data,this._onError(r);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let n=0;n<this.writeBuffer.length;n++){const s=this.writeBuffer[n].data;if(s&&(r+=nd(s)),n>0&&r>this._maxPayload)return this.writeBuffer.slice(0,n);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_n(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,r,n){return this._sendPacket("message",e,r,n),this}send(e,r,n){return this._sendPacket("message",e,r,n),this}_sendPacket(e,r,n,s){if(typeof r=="function"&&(s=r,r=void 0),typeof n=="function"&&(s=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const o={type:e,data:r,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),e()},n=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Yt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),es&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=Fr.indexOf(this._offlineEventListener);n!==-1&&Fr.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,r),this.writeBuffer=[],this._prevBufferLen=0}}}Yt.protocol=ha;class $d extends Yt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let r=this.createTransport(e),n=!1;Yt.priorWebsocketSuccess=!1;const s=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",d=>{if(!n)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;Yt.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(u(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=r.name,this.emitReserved("upgradeError",w)}}))};function o(){n||(n=!0,u(),r.close(),r=null)}const i=d=>{const w=new Error("probe error: "+d);w.transport=r.name,o(),this.emitReserved("upgradeError",w)};function l(){i("transport closed")}function a(){i("socket closed")}function f(d){r&&d.name!==r.name&&o()}const u=()=>{r.removeListener("open",s),r.removeListener("error",i),r.removeListener("close",l),this.off("close",a),this.off("upgrading",f)};r.once("open",s),r.once("error",i),r.once("close",l),this.once("close",a),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||r.open()},200):r.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const r=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&r.push(e[n]);return r}}let Ed=class extends $d{constructor(e,r={}){const n=typeof e=="object"?e:r;(!n.transports||n.transports&&typeof n.transports[0]=="string")&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(s=>vd[s]).filter(s=>!!s)),super(e,n)}};function Sd(t,e="",r){let n=t;r=r||typeof location<"u"&&location,t==null&&(t=r.protocol+"//"+r.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=r.protocol+t:t=r.host+t),/^(https?|wss?):\/\//.test(t)||(typeof r<"u"?t=r.protocol+"//"+t:t="https://"+t),n=Zn(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const o=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+e,n.href=n.protocol+"://"+o+(r&&r.port===n.port?"":":"+n.port),n}const Pd=typeof ArrayBuffer=="function",kd=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,_a=Object.prototype.toString,Od=typeof Blob=="function"||typeof Blob<"u"&&_a.call(Blob)==="[object BlobConstructor]",Nd=typeof File=="function"||typeof File<"u"&&_a.call(File)==="[object FileConstructor]";function Ps(t){return Pd&&(t instanceof ArrayBuffer||kd(t))||Od&&t instanceof Blob||Nd&&t instanceof File}function zr(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(zr(t[r]))return!0;return!1}if(Ps(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return zr(t.toJSON(),!0);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&zr(t[r]))return!0;return!1}function Td(t){const e=[],r=t.data,n=t;return n.data=ts(r,e),n.attachments=e.length,{packet:n,buffers:e}}function ts(t,e){if(!t)return t;if(Ps(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Array.isArray(t)){const r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=ts(t[n],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=ts(t[n],e));return r}return t}function Rd(t,e){return t.data=rs(t.data,e),delete t.attachments,t}function rs(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=rs(t[r],e);else if(typeof t=="object")for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=rs(t[r],e));return t}const Id=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Cd=5;var Le;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(Le||(Le={}));class Ad{constructor(e){this.replacer=e}encode(e){return(e.type===Le.EVENT||e.type===Le.ACK)&&zr(e)?this.encodeAsBinary({type:e.type===Le.EVENT?Le.BINARY_EVENT:Le.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let r=""+e.type;return(e.type===Le.BINARY_EVENT||e.type===Le.BINARY_ACK)&&(r+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(r+=e.nsp+","),e.id!=null&&(r+=e.id),e.data!=null&&(r+=JSON.stringify(e.data,this.replacer)),r}encodeAsBinary(e){const r=Td(e),n=this.encodeAsString(r.packet),s=r.buffers;return s.unshift(n),s}}function hi(t){return Object.prototype.toString.call(t)==="[object Object]"}class ks extends ft{constructor(e){super(),this.reviver=e}add(e){let r;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(e);const n=r.type===Le.BINARY_EVENT;n||r.type===Le.BINARY_ACK?(r.type=n?Le.EVENT:Le.ACK,this.reconstructor=new jd(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(Ps(e)||e.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let r=0;const n={type:Number(e.charAt(0))};if(Le[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===Le.BINARY_EVENT||n.type===Le.BINARY_ACK){const o=r+1;for(;e.charAt(++r)!=="-"&&r!=e.length;);const i=e.substring(o,r);if(i!=Number(i)||e.charAt(r)!=="-")throw new Error("Illegal attachments");n.attachments=Number(i)}if(e.charAt(r+1)==="/"){const o=r+1;for(;++r&&!(e.charAt(r)===","||r===e.length););n.nsp=e.substring(o,r)}else n.nsp="/";const s=e.charAt(r+1);if(s!==""&&Number(s)==s){const o=r+1;for(;++r;){const i=e.charAt(r);if(i==null||Number(i)!=i){--r;break}if(r===e.length)break}n.id=Number(e.substring(o,r+1))}if(e.charAt(++r)){const o=this.tryParse(e.substr(r));if(ks.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,r){switch(e){case Le.CONNECT:return hi(r);case Le.DISCONNECT:return r===void 0;case Le.CONNECT_ERROR:return typeof r=="string"||hi(r);case Le.EVENT:case Le.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&Id.indexOf(r[0])===-1);case Le.ACK:case Le.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class jd{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const r=Rd(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Md=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ks,Encoder:Ad,get PacketType(){return Le},protocol:Cd},Symbol.toStringTag,{value:"Module"}));function Rt(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const Dd=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wa extends ft{constructor(e,r,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=r,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Rt(e,"open",this.onopen.bind(this)),Rt(e,"packet",this.onpacket.bind(this)),Rt(e,"error",this.onerror.bind(this)),Rt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...r){var n,s,o;if(Dd.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(r.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const i={type:Le.EVENT,data:r};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const u=this.ids++,d=r.pop();this._registerAckCallback(u,d),i.id=u}const l=(s=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||s===void 0?void 0:s.writable,a=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!l||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,r){var n;const s=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(s===void 0){this.acks[e]=r;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===e&&this.sendBuffer.splice(l,1);r.call(this,new Error("operation has timed out"))},s),i=(...l)=>{this.io.clearTimeoutFn(o),r.apply(this,l)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...r){return new Promise((n,s)=>{const o=(i,l)=>i?s(i):n(l);o.withError=!0,r.push(o),this.emit(e,...r)})}_addToQueue(e){let r;typeof e[e.length-1]=="function"&&(r=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...o)=>(this._queue[0],s!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(s)):(this._queue.shift(),r&&r(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!e||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Le.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(n=>String(n.id)===e)){const n=this.acks[e];delete this.acks[e],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Le.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Le.EVENT:case Le.BINARY_EVENT:this.onevent(e);break;case Le.ACK:case Le.BINARY_ACK:this.onack(e);break;case Le.DISCONNECT:this.ondisconnect();break;case Le.CONNECT_ERROR:this.destroy();const n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);break}}onevent(e){const r=e.data||[];e.id!=null&&r.push(this.ack(e.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const n of r)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const r=this;let n=!1;return function(...s){n||(n=!0,r.packet({type:Le.ACK,id:e,data:s}))}}onack(e){const r=this.acks[e.id];typeof r=="function"&&(delete this.acks[e.id],r.withError&&e.data.unshift(null),r.apply(this,e.data))}onconnect(e,r){this.id=e,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Le.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const r=this._anyListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const r=this._anyOutgoingListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const n of r)n.apply(this,e.data)}}}function fr(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}fr.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-r:t+r}return Math.min(t,this.max)|0};fr.prototype.reset=function(){this.attempts=0};fr.prototype.setMin=function(t){this.ms=t};fr.prototype.setMax=function(t){this.max=t};fr.prototype.setJitter=function(t){this.jitter=t};class ns extends ft{constructor(e,r){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(r=e,e=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,wn(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((n=r.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new fr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=e;const s=r.parser||Md;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var r;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(r=this.backoff)===null||r===void 0||r.setMin(e),this)}randomizationFactor(e){var r;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(r=this.backoff)===null||r===void 0||r.setJitter(e),this)}reconnectionDelayMax(e){var r;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(r=this.backoff)===null||r===void 0||r.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ed(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const s=Rt(r,"open",function(){n.onopen(),e&&e()}),o=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),e?e(l):this.maybeReconnectOnOpen()},i=Rt(r,"error",o);if(this._timeout!==!1){const l=this._timeout,a=this.setTimeoutFn(()=>{s(),o(new Error("timeout")),r.close()},l);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(s),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Rt(e,"ping",this.onping.bind(this)),Rt(e,"data",this.ondata.bind(this)),Rt(e,"error",this.onerror.bind(this)),Rt(e,"close",this.onclose.bind(this)),Rt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(r){this.onclose("parse error",r)}}ondecoded(e){_n(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,r){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new wa(this,e,r),this.nsps[e]=n),n}_destroy(e){const r=Object.keys(this.nsps);for(const n of r)if(this.nsps[n].active)return;this._close()}_packet(e){const r=this.encoder.encode(e);for(let n=0;n<r.length;n++)this.engine.write(r[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,r){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},r);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const vr={};function Br(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const r=Sd(t,e.path||"/socket.io"),n=r.source,s=r.id,o=r.path,i=vr[s]&&o in vr[s].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||i;let a;return l?a=new ns(n,e):(vr[s]||(vr[s]=new ns(n,e)),a=vr[s]),r.query&&!e.query&&(e.query=r.queryKey),a.socket(r.path,e)}Object.assign(Br,{Manager:ns,Socket:wa,io:Br,connect:Br});const xn={},pi=lr(void 0);function Zd(t){return[...t].sort((e,r)=>e.id==="dummy"||r.id==="dummy"?e.id===r.id?0:e.id==="dummy"?-1:1:e.id.localeCompare(r.id))}function qd(t=globalThis.location,e=xn==null?void 0:xn.VITE_SOCKETHUB_URL){if(typeof e=="string"&&e.trim()!=="")return e.trim();const r=t==null?void 0:t.origin;return r&&r!=="null"?r:void 0}function Ld(t){return t instanceof Error?t.message:String(t)}function Vd(t,e,r){return new Promise((n,s)=>{if(!t.connected){s(new Error("Sockethub is disconnected. Reconnect and try again."));return}let o=!1;const i=e==="credentials",l=setTimeout(()=>f(new Error(i?"Credential acknowledgement timed out. Try again.":"Message acknowledgement timed out; delivery is unknown. Do not retry automatically.")),i?1e4:3e4),a=()=>f(new Error(i?"Disconnected before credentials were acknowledged. Try again.":"Disconnected before message acknowledgement; delivery is unknown. Do not retry automatically."));function f(u,d){o||(o=!0,clearTimeout(l),t.off("disconnect",a),u?s(u):n(d))}t.on("disconnect",a);try{t.emit(e,r,u=>f(void 0,u))}catch(u){f(u instanceof Error?u:new Error(String(u)))}})}let vt;const Ud=lr(!1);async function ba(){if(!vt)throw new Error("Sockethub client is not initialized yet");await vt.ready()}async function eh(t){return await ba(),vt.contextFor(t)}function th(t){return{id:t.id,type:t.type,name:t.name??t.id}}async function rh(t){await ba(),console.log("sending ->",t);const e=Ar("SEND",t);let r;try{if(r=await Vd(vt.socket,"message",e),!r)throw new Error("Missing message acknowledgement; delivery is unknown.")}catch(n){throw Ar("RESP",{...e,error:n instanceof Error?n.message:String(n)}),n}if(console.log("received <-",r),Ar("RESP",r),r.totalItems&&r.items)for(const n of r.items.reverse())Ar("RESP",n,!0,e.id);if(Ii(r,!0),r.error)throw new Error(r.error);return r}function Hn(t){return e=>{const r=t==="connect";Ud.update(()=>r),console.log(`sockethub ${t} [connected: ${r}]`,e||"")}}function Fd(t){console.log("handle incoming: ",t),Ii(t,!1)}async function zd(t){try{vt=await yn.connect(t,{io:Br,initTimeoutMs:1e4})}catch(e){console.error("sockethub discovery failed",e),pi.set({state:"unavailable",reason:Ld(e)});return}vt.descriptor&&vt.serverOrigin&&pi.set({state:"available",descriptor:vt.descriptor,serverOrigin:vt.serverOrigin}),vt.socket.on("connect",Hn("connect")),vt.socket.on("error",Hn("error")),vt.socket.on("disconnect",Hn("disconnect")),vt.socket.on("message",Fd),vt.socket.on("schemas",e=>{console.log("schemas received:",e),Cn("schemas",e)}),vt.socket.on("ready",e=>{console.log("client ready:",e),Cn("ready",e)}),vt.socket.on("init_error",e=>{console.error("client init error:",e),Cn("init_error",e)})}const Kn=qd();Kn&&(console.log("connecting to sockethub via discovery at",Kn),zd(Kn));export{_n as A,Cd as B,gd as C,ft as E,Qd as I,Xd as L,ec as M,cd as P,Ed as S,md as W,hd as X,ba as a,Jd as b,eh as c,rh as d,Wn as e,It as f,th as g,Ho as h,Si as i,ur as j,pi as k,Zd as l,Uf as m,Vd as n,Wd as o,Qr as p,Ud as q,Lo as r,vt as s,jo as t,Io as u,To as v,Zn as w,Le as x,wn as y,Md as z};