@coasys/ad4m-connect 0.10.1-rc9-dev6 → 0.10.1-rc9-dev7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +18 -30
- package/dist/utils.js +1 -1
- package/dist/web.js +73 -86
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -58,7 +58,7 @@ For more information, please visit: https://go.apollo.dev/c/docs`):new q(9);if(t
|
|
|
58
58
|
`)}function Sf(e){for(var t=0;t<e.length;++t)if(e[t]!==" "&&e[t]!==" ")return!1;return!0}function Wm(e){for(var t,r=!0,n=!0,i=0,a=null,o=0;o<e.length;++o)switch(e.charCodeAt(o)){case 13:e.charCodeAt(o+1)===10&&++o;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(t=a)!==null&&t!==void 0?t:0}var Hm=function(){function e(r){var n=new Ee(I.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},t.lookahead=function(){var n=this.token;if(n.kind!==I.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=Ym(this,n)}while(n.kind===I.COMMENT);return n},e}();function Jm(e){return e===I.BANG||e===I.DOLLAR||e===I.AMP||e===I.PAREN_L||e===I.PAREN_R||e===I.SPREAD||e===I.COLON||e===I.EQUALS||e===I.AT||e===I.BRACKET_L||e===I.BRACKET_R||e===I.BRACE_L||e===I.PIPE||e===I.BRACE_R}function en(e){return isNaN(e)?I.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function Ym(e,t){for(var r=e.source,n=r.body,i=n.length,a=t.end;a<i;){var o=n.charCodeAt(a),s=e.line,u=1+a-e.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++e.line,e.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++e.line,e.lineStart=a;continue;case 33:return new Ee(I.BANG,a,a+1,s,u,t);case 35:return Xm(r,a,s,u,t);case 36:return new Ee(I.DOLLAR,a,a+1,s,u,t);case 38:return new Ee(I.AMP,a,a+1,s,u,t);case 40:return new Ee(I.PAREN_L,a,a+1,s,u,t);case 41:return new Ee(I.PAREN_R,a,a+1,s,u,t);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Ee(I.SPREAD,a,a+3,s,u,t);break;case 58:return new Ee(I.COLON,a,a+1,s,u,t);case 61:return new Ee(I.EQUALS,a,a+1,s,u,t);case 64:return new Ee(I.AT,a,a+1,s,u,t);case 91:return new Ee(I.BRACKET_L,a,a+1,s,u,t);case 93:return new Ee(I.BRACKET_R,a,a+1,s,u,t);case 123:return new Ee(I.BRACE_L,a,a+1,s,u,t);case 124:return new Ee(I.PIPE,a,a+1,s,u,t);case 125:return new Ee(I.BRACE_R,a,a+1,s,u,t);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?rg(r,a,s,u,t,e):tg(r,a,s,u,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return eg(r,a,o,s,u,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return ig(r,a,s,u,t)}throw ct(r,a,Zm(o))}var c=e.line,l=1+a-e.lineStart;return new Ee(I.EOF,i,i,c,l,t)}function Zm(e){return e<32&&e!==9&&e!==10&&e!==13?"Cannot contain the invalid character ".concat(en(e),"."):e===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(en(e),".")}function Xm(e,t,r,n,i){var a=e.body,o,s=t;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Ee(I.COMMENT,t,s,r,n,i,a.slice(t+1,s))}function eg(e,t,r,n,i,a){var o=e.body,s=r,u=t,c=!1;if(s===45&&(s=o.charCodeAt(++u)),s===48){if(s=o.charCodeAt(++u),s>=48&&s<=57)throw ct(e,u,"Invalid number, unexpected digit after 0: ".concat(en(s),"."))}else u=pc(e,u,s),s=o.charCodeAt(u);if(s===46&&(c=!0,s=o.charCodeAt(++u),u=pc(e,u,s),s=o.charCodeAt(u)),(s===69||s===101)&&(c=!0,s=o.charCodeAt(++u),(s===43||s===45)&&(s=o.charCodeAt(++u)),u=pc(e,u,s),s=o.charCodeAt(u)),s===46||ag(s))throw ct(e,u,"Invalid number, expected digit but got: ".concat(en(s),"."));return new Ee(c?I.FLOAT:I.INT,t,u,n,i,a,o.slice(t,u))}function pc(e,t,r){var n=e.body,i=t,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw ct(e,i,"Invalid number, expected digit but got: ".concat(en(a),"."))}function tg(e,t,r,n,i){for(var a=e.body,o=t+1,s=o,u=0,c="";o<a.length&&!isNaN(u=a.charCodeAt(o))&&u!==10&&u!==13;){if(u===34)return c+=a.slice(s,o),new Ee(I.STRING,t,o+1,r,n,i,c);if(u<32&&u!==9)throw ct(e,o,"Invalid character within String: ".concat(en(u),"."));if(++o,u===92){switch(c+=a.slice(s,o-1),u=a.charCodeAt(o),u){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
|
|
59
59
|
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var l=ng(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw ct(e,o,"Invalid character escape sequence: \\u".concat(d,"."))}c+=String.fromCharCode(l),o+=4;break}default:throw ct(e,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++o,s=o}}throw ct(e,o,"Unterminated string.")}function rg(e,t,r,n,i,a){for(var o=e.body,s=t+3,u=s,c=0,l="";s<o.length&&!isNaN(c=o.charCodeAt(s));){if(c===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(u,s),new Ee(I.BLOCK_STRING,t,s+3,r,n,i,Km(l));if(c<32&&c!==9&&c!==10&&c!==13)throw ct(e,s,"Invalid character within String: ".concat(en(c),"."));c===10?(++s,++a.line,a.lineStart=s):c===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):c===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(u,s)+'"""',s+=4,u=s):++s}throw ct(e,s,"Unterminated string.")}function ng(e,t,r,n){return Ja(e)<<12|Ja(t)<<8|Ja(r)<<4|Ja(n)}function Ja(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ig(e,t,r,n,i){for(var a=e.body,o=a.length,s=t+1,u=0;s!==o&&!isNaN(u=a.charCodeAt(s))&&(u===95||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++s;return new Ee(I.NAME,t,s,r,n,i,a.slice(t,s))}function ag(e){return e===95||e>=65&&e<=90||e>=97&&e<=122}function og(e,t){var r=new sg(e,t);return r.parseDocument()}var sg=function(){function e(r,n){var i=zm(r)?r:new Rp(r);this._lexer=new Hm(i),this._options=n}var t=e.prototype;return t.parseName=function(){var n=this.expectToken(I.NAME);return{kind:$.NAME,value:n.value,loc:this.loc(n)}},t.parseDocument=function(){var n=this._lexer.token;return{kind:$.DOCUMENT,definitions:this.many(I.SOF,this.parseDefinition,I.EOF),loc:this.loc(n)}},t.parseDefinition=function(){if(this.peek(I.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(I.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(I.BRACE_L))return{kind:$.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(I.NAME)&&(a=this.parseName()),{kind:$.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},t.parseOperationType=function(){var n=this.expectToken(I.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},t.parseVariableDefinitions=function(){return this.optionalMany(I.PAREN_L,this.parseVariableDefinition,I.PAREN_R)},t.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:$.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(I.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(I.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},t.parseVariable=function(){var n=this._lexer.token;return this.expectToken(I.DOLLAR),{kind:$.VARIABLE,name:this.parseName(),loc:this.loc(n)}},t.parseSelectionSet=function(){var n=this._lexer.token;return{kind:$.SELECTION_SET,selections:this.many(I.BRACE_L,this.parseSelection,I.BRACE_R),loc:this.loc(n)}},t.parseSelection=function(){return this.peek(I.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(I.COLON)?(a=i,o=this.parseName()):o=i,{kind:$.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(I.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},t.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(I.PAREN_L,i,I.PAREN_R)},t.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(I.COLON),{kind:$.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},t.parseConstArgument=function(){var n=this._lexer.token;return{kind:$.ARGUMENT,name:this.parseName(),value:(this.expectToken(I.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},t.parseFragment=function(){var n=this._lexer.token;this.expectToken(I.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(I.NAME)?{kind:$.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:$.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},t.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:$.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:$.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},t.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case I.BRACKET_L:return this.parseList(n);case I.BRACE_L:return this.parseObject(n);case I.INT:return this._lexer.advance(),{kind:$.INT,value:i.value,loc:this.loc(i)};case I.FLOAT:return this._lexer.advance(),{kind:$.FLOAT,value:i.value,loc:this.loc(i)};case I.STRING:case I.BLOCK_STRING:return this.parseStringLiteral();case I.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:$.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:$.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:$.NULL,loc:this.loc(i)};default:return{kind:$.ENUM,value:i.value,loc:this.loc(i)}}case I.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},t.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:$.STRING,value:n.value,block:n.kind===I.BLOCK_STRING,loc:this.loc(n)}},t.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:$.LIST,values:this.any(I.BRACKET_L,o,I.BRACKET_R),loc:this.loc(a)}},t.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:$.OBJECT,fields:this.any(I.BRACE_L,o,I.BRACE_R),loc:this.loc(a)}},t.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(I.COLON),{kind:$.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},t.parseDirectives=function(n){for(var i=[];this.peek(I.AT);)i.push(this.parseDirective(n));return i},t.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(I.AT),{kind:$.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},t.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(I.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(I.BRACKET_R),i={kind:$.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(I.BANG)?{kind:$.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},t.parseNamedType=function(){var n=this._lexer.token;return{kind:$.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},t.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===I.NAME)switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(n)},t.peekDescription=function(){return this.peek(I.STRING)||this.peek(I.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(I.BRACE_L,this.parseOperationTypeDefinition,I.BRACE_R);return{kind:$.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},t.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(I.COLON);var a=this.parseNamedType();return{kind:$.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},t.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:$.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},t.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:$.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},t.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(I.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(I.AMP)||this.peek(I.NAME));return i}return this.delimitedMany(I.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(I.BRACE_L)&&this._lexer.lookahead().kind===I.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(I.BRACE_L,this.parseFieldDefinition,I.BRACE_R)},t.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(I.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:$.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:u,loc:this.loc(n)}},t.parseArgumentDefs=function(){return this.optionalMany(I.PAREN_L,this.parseInputValueDef,I.PAREN_R)},t.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(I.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(I.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:$.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:u,loc:this.loc(n)}},t.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:$.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},t.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:$.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(I.EQUALS)?this.delimitedMany(I.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:$.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(I.BRACE_L,this.parseEnumValueDefinition,I.BRACE_R)},t.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:$.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},t.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:$.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(I.BRACE_L,this.parseInputValueDef,I.BRACE_R)},t.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===I.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)},t.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(I.BRACE_L,this.parseOperationTypeDefinition,I.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:$.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},t.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:$.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},t.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:$.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},t.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:$.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},t.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:$.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},t.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:$.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},t.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:$.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},t.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(I.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:$.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(n)}},t.parseDirectiveLocations=function(){return this.delimitedMany(I.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Gm[i.value]!==void 0)return i;throw this.unexpected(n)},t.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new Np(n,this._lexer.lastToken,this._lexer.source)},t.peek=function(n){return this._lexer.token.kind===n},t.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw ct(this._lexer.source,i.start,"Expected ".concat(Pp(n),", found ").concat(dc(i),"."))},t.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},t.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===I.NAME&&i.value===n)this._lexer.advance();else throw ct(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(dc(i),"."))},t.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===I.NAME&&i.value===n?(this._lexer.advance(),!0):!1},t.unexpected=function(n){var i=n??this._lexer.token;return ct(this._lexer.source,i.start,"Unexpected ".concat(dc(i),"."))},t.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},t.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},t.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},t.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},e}();function dc(e){var t=e.value;return Pp(e.kind)+(t!=null?' "'.concat(t,'"'):"")}function Pp(e){return Jm(e)?'"'.concat(e,'"'):e}var ho=new Map,Pc=new Map,Lp=!0,To=!1;function Fp(e){return e.replace(/[\s,]+/g," ").trim()}function cg(e){return Fp(e.source.body.substring(e.start,e.end))}function ug(e){var t=new Set,r=[];return e.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=cg(n.loc),o=Pc.get(i);o&&!o.has(a)?Lp&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
60
60
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
61
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Pc.set(i,o=new Set),o.add(a),t.has(a)||(t.add(a),r.push(n))}else r.push(n)}),xo(xo({},e),{definitions:r})}function lg(e){var t=new Set(e.definitions);t.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&t.add(a)})});var r=e.loc;return r&&(delete r.startToken,delete r.endToken),e}function fg(e){var t=Fp(e);if(!ho.has(t)){var r=og(e,{experimentalFragmentVariables:To,allowLegacyFragmentVariables:To});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");ho.set(t,lg(ug(r)))}return ho.get(t)}function E(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];typeof e=="string"&&(e=[e]);var n=e[0];return t.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=e[a+1]}),fg(n)}function pg(){ho.clear(),Pc.clear()}function dg(){Lp=!1}function hg(){To=!0}function mg(){To=!1}var Ei={gql:E,resetCaches:pg,disableFragmentWarnings:dg,enableExperimentalFragmentVariables:hg,disableExperimentalFragmentVariables:mg};(function(e){e.gql=Ei.gql,e.resetCaches=Ei.resetCaches,e.disableFragmentWarnings=Ei.disableFragmentWarnings,e.enableExperimentalFragmentVariables=Ei.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=Ei.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function k(e){if(!e)throw"Got no result from Apollo";if(e.error)throw e.error;if(e.errors)throw e.errors;return e.data}function gg(){}function nu(){return gg}var w=nu,Ue=nu,W=nu,Mp=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},$p=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},tn=class{constructor(t){this.code=t}};Mp([w(),$p("design:type",String)],tn.prototype,"code",void 0);tn=Mp([W(),$p("design:paramtypes",[String])],tn);var iu=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},au=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},jt=class{constructor(t,r){this.address=t,this.name=r}};iu([w(),au("design:type",String)],jt.prototype,"address",void 0);iu([w(),au("design:type",String)],jt.prototype,"name",void 0);jt=iu([W(),au("design:paramtypes",[String,String])],jt);var ge=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},De=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Sr=class{constructor(t,r){this.key=r,this.signature=t}};ge([w(),De("design:type",String)],Sr.prototype,"signature",void 0);ge([w(),De("design:type",String)],Sr.prototype,"key",void 0);ge([w(),De("design:type",Boolean)],Sr.prototype,"valid",void 0);ge([w(),De("design:type",Boolean)],Sr.prototype,"invalid",void 0);Sr=ge([W(),Ue(),De("design:paramtypes",[String,String])],Sr);var rn=class{};ge([w(),De("design:type",String)],rn.prototype,"signature",void 0);ge([w(),De("design:type",String)],rn.prototype,"key",void 0);ge([w(),De("design:type",Boolean)],rn.prototype,"valid",void 0);ge([w(),De("design:type",Boolean)],rn.prototype,"invalid",void 0);rn=ge([Ue()],rn);function Ar(e){let t=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return ge([w(),De("design:type",String)],t.prototype,"author",void 0),ge([w(),De("design:type",String)],t.prototype,"timestamp",void 0),ge([w(),De("design:type",Object)],t.prototype,"data",void 0),ge([w(),De("design:type",Sr)],t.prototype,"proof",void 0),t=ge([W(),De("design:paramtypes",[String,String,Object,Sr])],t),t}function yg(e){let t=class{};return ge([w(),De("design:type",String)],t.prototype,"author",void 0),ge([w(),De("design:type",String)],t.prototype,"timestamp",void 0),ge([w(),De("design:type",Object)],t.prototype,"data",void 0),ge([w(),De("design:type",rn)],t.prototype,"proof",void 0),t=ge([Ue()],t),t}var Ef=class extends Ar(){};Ef=ge([W()],Ef);var Io=class extends Ar(){};ge([w(),De("design:type",jt)],Io.prototype,"language",void 0);ge([w(),De("design:type",tn)],Io.prototype,"icon",void 0);Io=ge([W()],Io);function wI(e){return e&&e.author&&e.timestamp&&e.data}var Te=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},qe=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},nn=class{constructor(t){this.source=t.source?t.source:"",this.target=t.target?t.target:"",this.predicate=t.predicate?t.predicate:""}};Te([w(),qe("design:type",String)],nn.prototype,"source",void 0);Te([w(),qe("design:type",String)],nn.prototype,"target",void 0);Te([w(),qe("design:type",String)],nn.prototype,"predicate",void 0);nn=Te([W(),qe("design:paramtypes",[Object])],nn);var ko=class{};Te([w(),qe("design:type",Array)],ko.prototype,"additions",void 0);Te([w(),qe("design:type",Array)],ko.prototype,"removals",void 0);ko=Te([Ue()],ko);var Oo=class{constructor(t,r){this.additions=t,this.removals=r}};Te([w(),qe("design:type",Array)],Oo.prototype,"additions",void 0);Te([w(),qe("design:type",Array)],Oo.prototype,"removals",void 0);Oo=Te([W(),qe("design:paramtypes",[Array,Array])],Oo);var Hi=class{};Te([w(),qe("design:type",String)],Hi.prototype,"source",void 0);Te([w(),qe("design:type",String)],Hi.prototype,"target",void 0);Te([w(),qe("design:type",String)],Hi.prototype,"predicate",void 0);Hi=Te([Ue()],Hi);var an=class extends Ar(){hash(){let t=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<t.length;n++)i=t.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};Te([w(),qe("design:type",String)],an.prototype,"status",void 0);an=Te([W()],an);var Lc=class extends yg(){};Te([w(),qe("design:type",String)],Lc.prototype,"status",void 0);Lc=Te([Ue()],Lc);function OI(e,t){return e.author==t.author&&e.timestamp==t.timestamp&&e.data.source==t.data.source&&e.data.predicate==t.data.predicate&&e.data.target==t.data.target}function AI(e){return e&&e.source&&e.target}var Ao=class{constructor(t,r){this.oldLink=t,this.newLink=r}};Te([w(),qe("design:type",an)],Ao.prototype,"oldLink",void 0);Te([w(),qe("design:type",an)],Ao.prototype,"newLink",void 0);Ao=Te([W(),qe("design:paramtypes",[an,an])],Ao);var fn=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},sa=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Fc,Er=class{constructor(t){t?this.links=t:this.links=[]}get(t){if(!t||!t.source&&!t.predicate&&!t.target)return this.links;if(t.source){let n=JSON.parse(JSON.stringify(this.links));return t.target&&(n=n.filter(i=>i.data.target===t.target)),t.predicate&&(n=n.filter(i=>i.data.predicate===t.predicate)),t.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=t.fromDate)),t.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=t.untilDate)),t.limit&&(n=n.slice(0,t.limit)),n}if(t.target){let n=JSON.parse(JSON.stringify(this.links));return t.predicate&&(n=n.filter(i=>i.data.predicate===t.predicate)),t.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=t.fromDate)),t.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=t.untilDate)),t.limit&&(n=n.slice(0,t.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===t.predicate),t.limit&&(r=r.slice(0,t.limit)),r}getSingleTarget(t){delete t.target;let r=this.get(t);return r.length?r[0].data.target:null}};fn([w(),sa("design:type",Array)],Er.prototype,"links",void 0);Er=fn([W(),sa("design:paramtypes",[Array])],Er);var Mc=class{};fn([w(),sa("design:type",Array)],Mc.prototype,"links",void 0);Mc=fn([Ue()],Mc);var $c=Fc=class{constructor(t){t?this.links=t:this.links=[]}static fromLink(t){let r=new Fc;return r.links.push(t),r}};fn([w(),sa("design:type",Array)],$c.prototype,"links",void 0);$c=Fc=fn([Ue(),sa("design:paramtypes",[Array])],$c);var jc=class extends Ar(){};jc=fn([W()],jc);var F=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},M=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},yr=class{constructor(t,r){this.did=t,r?this.perspective=r:this.perspective=new Er}};F([w(),M("design:type",String)],yr.prototype,"did",void 0);F([w(),M("design:type",Er)],yr.prototype,"perspective",void 0);F([w(),M("design:type",String)],yr.prototype,"directMessageLanguage",void 0);yr=F([W(),M("design:paramtypes",[String,Er])],yr);var xf=class extends Ar(){};xf=F([W()],xf);var xr=class{constructor(t,r,n,i,a,o){this.did=t,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],xr.prototype,"did",void 0);F([w(),M("design:type",String)],xr.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],xr.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],xr.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],xr.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],xr.prototype,"didSignedByDeviceKey",void 0);xr=F([W(),M("design:paramtypes",[String,String,String,String,String,String])],xr);var Tr=class{constructor(t,r,n,i,a,o){this.did=t,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],Tr.prototype,"did",void 0);F([w(),M("design:type",String)],Tr.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],Tr.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],Tr.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],Tr.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],Tr.prototype,"didSignedByDeviceKey",void 0);Tr=F([Ue(),M("design:paramtypes",[String,String,String,String,String,String])],Tr);var Do=class{constructor(t,r){this.signature=t,this.publicKey=r}};F([w(),M("design:type",String)],Do.prototype,"signature",void 0);F([w(),M("design:type",String)],Do.prototype,"publicKey",void 0);Do=F([W(),M("design:paramtypes",[String,String])],Do);var Vn=class{constructor(t,r){this.domain=t,this.pointers=r}};F([w(),M("design:type",String)],Vn.prototype,"domain",void 0);F([w(),M("design:type",Array)],Vn.prototype,"pointers",void 0);Vn=F([W(),M("design:paramtypes",[String,Array])],Vn);var No=class{constructor(t,r){this.with=t,this.can=r}};F([w(),M("design:type",Vn)],No.prototype,"with",void 0);F([w(),M("design:type",Array)],No.prototype,"can",void 0);No=F([W(),M("design:paramtypes",[Vn,Array])],No);var er=class{constructor(t,r,n,i,a){this.appName=t,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};F([w(),M("design:type",String)],er.prototype,"appName",void 0);F([w(),M("design:type",String)],er.prototype,"appDesc",void 0);F([w(),M("design:type",String)],er.prototype,"appUrl",void 0);F([w(),M("design:type",String)],er.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],er.prototype,"capabilities",void 0);er=F([W(),M("design:paramtypes",[String,String,String,Array,String])],er);var Qn=class{constructor(t,r,n,i){this.requestId=t,this.auth=r,this.token=n,this.revoked=i}};F([w(),M("design:type",String)],Qn.prototype,"requestId",void 0);F([w(),M("design:type",String)],Qn.prototype,"token",void 0);F([w(),M("design:type",Boolean)],Qn.prototype,"revoked",void 0);F([w(),M("design:type",er)],Qn.prototype,"auth",void 0);Qn=F([W(),M("design:paramtypes",[String,er,String,Boolean])],Qn);var zn=class{constructor(t,r){this.domain=t,this.pointers=r}};F([w(),M("design:type",String)],zn.prototype,"domain",void 0);F([w(),M("design:type",Array)],zn.prototype,"pointers",void 0);zn=F([Ue(),M("design:paramtypes",[String,Array])],zn);var Co=class{constructor(t,r){this.with=t,this.can=r}};F([w(),M("design:type",zn)],Co.prototype,"with",void 0);F([w(),M("design:type",Array)],Co.prototype,"can",void 0);Co=F([Ue(),M("design:paramtypes",[zn,Array])],Co);var Ir=class{constructor(t,r,n,i,a,o){this.appName=t,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};F([w(),M("design:type",String)],Ir.prototype,"appName",void 0);F([w(),M("design:type",String)],Ir.prototype,"appDesc",void 0);F([w(),M("design:type",String)],Ir.prototype,"appDomain",void 0);F([w(),M("design:type",String)],Ir.prototype,"appUrl",void 0);F([w(),M("design:type",String)],Ir.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],Ir.prototype,"capabilities",void 0);Ir=F([Ue(),M("design:paramtypes",[String,String,String,String,String,Array])],Ir);var Hn=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Jn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},gt=class{constructor(t){t?(this.isInitialized=t.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=t.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=t.did,this.didDocument=t.didDocument,this.error=t.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Hn([w(),Jn("design:type",Boolean)],gt.prototype,"isInitialized",void 0);Hn([w(),Jn("design:type",Boolean)],gt.prototype,"isUnlocked",void 0);Hn([w(),Jn("design:type",String)],gt.prototype,"did",void 0);Hn([w(),Jn("design:type",String)],gt.prototype,"didDocument",void 0);Hn([w(),Jn("design:type",String)],gt.prototype,"error",void 0);gt=Hn([W(),Jn("design:paramtypes",[Object])],gt);var Tf=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},Se=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},et,tt,Uc=class{constructor(t,r){et.set(this,void 0),tt.set(this,void 0),Tf(this,et,t,"f"),Tf(this,tt,r,"f")}async otherAgents(){return await Se(this,et,"f").otherAgents(Se(this,tt,"f"))}async hasTelepresenceAdapter(){return await Se(this,et,"f").hasTelepresenceAdapter(Se(this,tt,"f"))}async onlineAgents(){return await Se(this,et,"f").onlineAgents(Se(this,tt,"f"))}async setOnlineStatus(t){return await Se(this,et,"f").setOnlineStatus(Se(this,tt,"f"),t)}async setOnlineStatusU(t){return await Se(this,et,"f").setOnlineStatusU(Se(this,tt,"f"),t)}async sendSignal(t,r){return await Se(this,et,"f").sendSignal(Se(this,tt,"f"),t,r)}async sendSignalU(t,r){return await Se(this,et,"f").sendSignalU(Se(this,tt,"f"),t,r)}async sendBroadcast(t,r=!1){return await Se(this,et,"f").sendBroadcast(Se(this,tt,"f"),t,r)}async sendBroadcastU(t,r=!1){return await Se(this,et,"f").sendBroadcastU(Se(this,tt,"f"),t,r)}async addSignalHandler(t){await Se(this,et,"f").addSignalHandler(Se(this,tt,"f"),t)}removeSignalHandler(t){Se(this,et,"f").removeSignalHandler(Se(this,tt,"f"),t)}};et=new WeakMap,tt=new WeakMap;var pn=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},dn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},lt=class{constructor(t){t&&(this.source=t.source,this.predicate=t.predicate,this.target=t.target,t.fromDate&&(this.fromDate=t.fromDate),t.untilDate&&(this.untilDate=t.untilDate),t.limit&&(this.limit=t.limit))}isMatch(t){return!(this.source&&this.source!==t.source||this.predicate&&this.predicate!==t.predicate||this.target&&this.target!==t.target)}};pn([w(),dn("design:type",String)],lt.prototype,"source",void 0);pn([w(),dn("design:type",String)],lt.prototype,"target",void 0);pn([w(),dn("design:type",String)],lt.prototype,"predicate",void 0);pn([w(),dn("design:type",Date)],lt.prototype,"fromDate",void 0);pn([w(),dn("design:type",Date)],lt.prototype,"untilDate",void 0);pn([w(),dn("design:type",Number)],lt.prototype,"limit",void 0);lt=pn([W(),Ue(),dn("design:paramtypes",[Object])],lt);var If=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},Xe=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},xt,Ht;function hc(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}var kt=class{constructor(){xt.set(this,void 0),Ht.set(this,void 0)}static fromUrl(t){if(!t||!t.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new kt;return If(r,Ht,t,"f"),r}static from(t){let r=new kt;return If(r,xt,t,"f"),r}toUrl(){if(Xe(this,Ht,"f")&&!Xe(this,xt,"f"))return Xe(this,Ht,"f");if(!Xe(this,Ht,"f")&&!Xe(this,xt,"f"))throw new Error("Can't turn empty Literal into URL");let t;switch(typeof Xe(this,xt,"f")){case"string":t=`string:${hc(Xe(this,xt,"f"))}`;break;case"number":t=`number:${hc(Xe(this,xt,"f"))}`;break;case"object":t=`json:${hc(JSON.stringify(Xe(this,xt,"f")))}`;break}return`literal://${t}`}get(){if(Xe(this,xt,"f"))return Xe(this,xt,"f");if(!Xe(this,Ht,"f"))throw new Error("Can't render empty Literal");if(!Xe(this,Ht,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let t=Xe(this,Ht,"f").substring(10);if(t.startsWith("string:"))return decodeURIComponent(t.substring(7));if(t.startsWith("number:")){let r=t.substring(7);return parseFloat(r)}if(t.startsWith("json:")){let r=t.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${t}`)}};xt=new WeakMap,Ht=new WeakMap;function vr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function jp(e){return`set${vr(e)}`}function Xt(e){return e.endsWith("y")?e.slice(0,-1)+"ies":e+"s"}function ou(e){return e.endsWith("ies")?e.slice(0,-3)+"y":e.endsWith("s")?e.slice(0,-1):e}function vg(e){return`add${vr(ou(e))}`}function bg(e){let t=e.substring(3),r=Xt(t);return r.charAt(0).toLowerCase()+r.slice(1)}function _g(e){return`remove${vr(ou(e))}`}function wg(e){let t=e.substring(6),r=Xt(t);return r.charAt(0).toLowerCase()+r.slice(1)}function Sg(e){let t=e.substring(13),r=Xt(t);return r.charAt(0).toLowerCase()+r.slice(1)}function Eg(e){return`setCollection${vr(ou(e))}`}function Vr(e){if(Array.isArray(e))return`[${e.map(Vr).join(", ")}]`;let t=Object.keys(e),r=[];for(let n of t){let i=JSON.stringify(e[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var mc=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},B=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},ze,Ge,ve,Ro=class{constructor(e,t,r){ze.set(this,void 0),Ge.set(this,void 0),ve.set(this,void 0),mc(this,ze,t,"f"),mc(this,Ge,r,"f"),mc(this,ve,e,"f")}get baseExpression(){return B(this,ze,"f")}async init(){let isInstance=await B(this,ve,"f").isSubjectInstance(B(this,ze,"f"),B(this,Ge,"f"));if(!isInstance)throw`Not a valid subject instance of ${B(this,Ge,"f")} for ${B(this,ze,"f")}`;let results=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property(C, Property)`),properties=results.map(e=>e.Property);for(let e of properties){let t=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_resolve(C, "${e}")`);Object.defineProperty(this,e,{configurable:!0,get:async()=>{let r=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_getter(C, "${B(this,ze,"f")}", "${e}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(t)try{if(n){let i=await B(this,ve,"f").getExpression(n);try{return JSON.parse(i.data)}catch{return i.data}}else return n}catch{return n}else return n}else return r||void 0}})}let setters=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[jp(property)]=async e=>{resolveLanguage&&(e=await B(this,ve,"f").createExpression(e,resolveLanguage)),await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}let results2=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(e=>e.Collection);for(let e of collections)Object.defineProperty(this,e,{configurable:!0,get:async()=>{let t=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_getter(C, "${B(this,ze,"f")}", "${e}", Value)`);return t&&t.length>0&&t[0].Value?t[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[vg(collection)]=async e=>{Array.isArray(e)?await Promise.all(e.map(t=>B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:t}]))):await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}let removers=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[_g(collection)]=async e=>{Array.isArray(e)?await Promise.all(e.map(t=>B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:t}]))):await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}let collectionSetters=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[Eg(collection)]=async e=>{Array.isArray(e)?await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),e.map(t=>({name:"value",value:t}))):await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}}};ze=new WeakMap,Ge=new WeakMap,ve=new WeakMap;var Pn=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},L=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},oe,le,Qr,zr,Gr,ki,qn=class{constructor(e,t){oe.set(this,void 0),le.set(this,void 0),Qr.set(this,void 0),zr.set(this,void 0),Gr.set(this,void 0),ki.set(this,void 0),Pn(this,Qr,[],"f"),Pn(this,zr,[],"f"),Pn(this,Gr,[],"f"),Pn(this,ki,[],"f"),Pn(this,oe,e,"f"),Pn(this,le,t,"f"),this.uuid=L(this,oe,"f").uuid,this.name=L(this,oe,"f").name,this.sharedUrl=L(this,oe,"f").sharedUrl,this.neighbourhood=L(this,oe,"f").neighbourhood,this.state=L(this,oe,"f").state,L(this,le,"f").addPerspectiveLinkAddedListener(L(this,oe,"f").uuid,L(this,Qr,"f")),L(this,le,"f").addPerspectiveLinkRemovedListener(L(this,oe,"f").uuid,L(this,zr,"f")),L(this,le,"f").addPerspectiveLinkUpdatedListener(L(this,oe,"f").uuid,L(this,Gr,"f")),L(this,le,"f").addPerspectiveSyncStateChangeListener(L(this,oe,"f").uuid,L(this,ki,"f"))}async executeAction(e,t,r){return await L(this,le,"f").executeCommands(L(this,oe,"f").uuid,JSON.stringify(e),t,JSON.stringify(r))}async get(e){return await L(this,le,"f").queryLinks(L(this,oe,"f").uuid,e)}async infer(e){return await L(this,le,"f").queryProlog(L(this,oe,"f").uuid,e)}async add(e,t="shared"){return await L(this,le,"f").addLink(L(this,oe,"f").uuid,e,t)}async addLinks(e,t="shared"){return await L(this,le,"f").addLinks(L(this,oe,"f").uuid,e,t)}async removeLinks(e){return await L(this,le,"f").removeLinks(L(this,oe,"f").uuid,e)}async linkMutations(e,t="shared"){return await L(this,le,"f").linkMutations(L(this,oe,"f").uuid,e,t)}async addLinkExpression(e,t="shared"){return await L(this,le,"f").addLinkExpression(L(this,oe,"f").uuid,e,t)}async update(e,t){return await L(this,le,"f").updateLink(L(this,oe,"f").uuid,e,t)}async remove(e){return await L(this,le,"f").removeLink(L(this,oe,"f").uuid,e)}async getExpression(e){return await L(this,le,"f").getExpression(e)}async createExpression(e,t){return await L(this,le,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?L(this,Qr,"f").push(t):e==="link-removed"?L(this,zr,"f").push(t):e==="link-updated"&&L(this,Gr,"f").push(t)}async addSyncStateChangeListener(e){L(this,ki,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=L(this,Qr,"f").indexOf(t);L(this,Qr,"f").splice(r,1)}else if(e==="link-removed"){let r=L(this,zr,"f").indexOf(t);L(this,zr,"f").splice(r,1)}else if(e==="link-updated"){let r=L(this,Gr,"f").indexOf(t);L(this,Gr,"f").splice(r,1)}}async snapshot(){return L(this,le,"f").snapshotByUUID(L(this,oe,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new lt({source:e.source,predicate:e.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[e];await this.linkMutations({additions:a,removals:i},t)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(t=>t.X)}async availableFlows(e){return(await this.infer(`flowable("${e}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(e,t){return(await this.infer(`register_sdna_flow("${e}", F), flow_state(X, ${t}, F)`)).map(n=>n.X)}async flowState(e,t){return(await this.infer(`register_sdna_flow("${e}", F), flow_state("${t}", X, F)`))[0].X}async flowActions(e,t){return(await this.infer(`register_sdna_flow("${e}", Flow), flow_state("${t}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){return(await this.get(new lt({predicate:"ad4m://sdna"}))).map(t=>t.data.target).map(t=>kt.fromUrl(t).get())}async addSdna(e,t,r){return L(this,le,"f").addSdna(L(this,oe,"f").uuid,e,t,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(e=>e.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClass(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t){let r;if(typeof e=="string")r=e,await L(this,le,"f").createSubject(L(this,oe,"f").uuid,JSON.stringify({className:r}),t);else{let n=this.buildQueryFromTemplate(e);await L(this,le,"f").createSubject(L(this,oe,"f").uuid,JSON.stringify({query:n}),t)}return this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await L(this,le,"f").getSubjectData(L(this,oe,"f").uuid,JSON.stringify({className:e}),t));let r=this.buildQueryFromTemplate(e);return JSON.parse(await L(this,le,"f").getSubjectData(L(this,oe,"f").uuid,JSON.stringify({query:r}),t))}async removeSubject(subjectClass,exprAddr){let className=await this.stringOrTemplateObjectToSubjectClass(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No constructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClass(t),n=!1,i=5,a=0;for(;a<i&&!n;)n=await this.infer(`subject_class("${r}", C), instance(C, "${e}")`),a++;return n}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClass(t),n=new Ro(this,e,r);return await n.init(),n}async getAllSubjectInstances(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let i=await this.infer(`subject_class("${n}", C), instance(C, X)`),a=await Promise.all(i.map(async o=>await this.getSubjectProxy(o.X,n)));r=r.concat(a)}return r}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t)r=await this.infer(`subject_class("${n}", C), instance(C, X)`);return r}buildQueryFromTemplate(e){let t;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>!i.includes(l)):i.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let u=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));u=u.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let l of n)c+=`, property(C, "${l}")`;for(let l of i)c+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),c+=`, property_setter(C, "${d}", _)`}for(let l of o)c+=`, collection_adder(C, "${bg(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${wg(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${Sg(l)}", _)`;c+=".",t=c}(e),t}async subjectClassesByTemplate(e){let t=this.buildQueryFromTemplate(e),r=await this.infer(t);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(e){if((await this.subjectClassesByTemplate(new e)).length>0)return;let{name:r,sdna:n}=e.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return L(this,le,"f").getNeighbourhoodProxy(L(this,oe,"f").uuid)}get ai(){return L(this,le,"f").aiClient}};oe=new WeakMap,le=new WeakMap,Qr=new WeakMap,zr=new WeakMap,Gr=new WeakMap,ki=new WeakMap;var pr=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},Q=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},ie,Oi,Ai,Di,mo,Ni,go,yo,ot=`
|
|
61
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Pc.set(i,o=new Set),o.add(a),t.has(a)||(t.add(a),r.push(n))}else r.push(n)}),xo(xo({},e),{definitions:r})}function lg(e){var t=new Set(e.definitions);t.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&t.add(a)})});var r=e.loc;return r&&(delete r.startToken,delete r.endToken),e}function fg(e){var t=Fp(e);if(!ho.has(t)){var r=og(e,{experimentalFragmentVariables:To,allowLegacyFragmentVariables:To});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");ho.set(t,lg(ug(r)))}return ho.get(t)}function E(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];typeof e=="string"&&(e=[e]);var n=e[0];return t.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=e[a+1]}),fg(n)}function pg(){ho.clear(),Pc.clear()}function dg(){Lp=!1}function hg(){To=!0}function mg(){To=!1}var Ei={gql:E,resetCaches:pg,disableFragmentWarnings:dg,enableExperimentalFragmentVariables:hg,disableExperimentalFragmentVariables:mg};(function(e){e.gql=Ei.gql,e.resetCaches=Ei.resetCaches,e.disableFragmentWarnings=Ei.disableFragmentWarnings,e.enableExperimentalFragmentVariables=Ei.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=Ei.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function k(e){if(!e)throw"Got no result from Apollo";if(e.error)throw e.error;if(e.errors)throw e.errors;return e.data}function gg(){}function nu(){return gg}var w=nu,Ue=nu,W=nu,Mp=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},$p=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},tn=class{constructor(t){this.code=t}};Mp([w(),$p("design:type",String)],tn.prototype,"code",void 0);tn=Mp([W(),$p("design:paramtypes",[String])],tn);var iu=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},au=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},jt=class{constructor(t,r){this.address=t,this.name=r}};iu([w(),au("design:type",String)],jt.prototype,"address",void 0);iu([w(),au("design:type",String)],jt.prototype,"name",void 0);jt=iu([W(),au("design:paramtypes",[String,String])],jt);var ge=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},De=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Sr=class{constructor(t,r){this.key=r,this.signature=t}};ge([w(),De("design:type",String)],Sr.prototype,"signature",void 0);ge([w(),De("design:type",String)],Sr.prototype,"key",void 0);ge([w(),De("design:type",Boolean)],Sr.prototype,"valid",void 0);ge([w(),De("design:type",Boolean)],Sr.prototype,"invalid",void 0);Sr=ge([W(),Ue(),De("design:paramtypes",[String,String])],Sr);var rn=class{};ge([w(),De("design:type",String)],rn.prototype,"signature",void 0);ge([w(),De("design:type",String)],rn.prototype,"key",void 0);ge([w(),De("design:type",Boolean)],rn.prototype,"valid",void 0);ge([w(),De("design:type",Boolean)],rn.prototype,"invalid",void 0);rn=ge([Ue()],rn);function Ar(e){let t=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return ge([w(),De("design:type",String)],t.prototype,"author",void 0),ge([w(),De("design:type",String)],t.prototype,"timestamp",void 0),ge([w(),De("design:type",Object)],t.prototype,"data",void 0),ge([w(),De("design:type",Sr)],t.prototype,"proof",void 0),t=ge([W(),De("design:paramtypes",[String,String,Object,Sr])],t),t}function yg(e){let t=class{};return ge([w(),De("design:type",String)],t.prototype,"author",void 0),ge([w(),De("design:type",String)],t.prototype,"timestamp",void 0),ge([w(),De("design:type",Object)],t.prototype,"data",void 0),ge([w(),De("design:type",rn)],t.prototype,"proof",void 0),t=ge([Ue()],t),t}var Ef=class extends Ar(){};Ef=ge([W()],Ef);var Io=class extends Ar(){};ge([w(),De("design:type",jt)],Io.prototype,"language",void 0);ge([w(),De("design:type",tn)],Io.prototype,"icon",void 0);Io=ge([W()],Io);function wI(e){return e&&e.author&&e.timestamp&&e.data}var Te=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},qe=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},nn=class{constructor(t){this.source=t.source?t.source:"",this.target=t.target?t.target:"",this.predicate=t.predicate?t.predicate:""}};Te([w(),qe("design:type",String)],nn.prototype,"source",void 0);Te([w(),qe("design:type",String)],nn.prototype,"target",void 0);Te([w(),qe("design:type",String)],nn.prototype,"predicate",void 0);nn=Te([W(),qe("design:paramtypes",[Object])],nn);var ko=class{};Te([w(),qe("design:type",Array)],ko.prototype,"additions",void 0);Te([w(),qe("design:type",Array)],ko.prototype,"removals",void 0);ko=Te([Ue()],ko);var Oo=class{constructor(t,r){this.additions=t,this.removals=r}};Te([w(),qe("design:type",Array)],Oo.prototype,"additions",void 0);Te([w(),qe("design:type",Array)],Oo.prototype,"removals",void 0);Oo=Te([W(),qe("design:paramtypes",[Array,Array])],Oo);var Hi=class{};Te([w(),qe("design:type",String)],Hi.prototype,"source",void 0);Te([w(),qe("design:type",String)],Hi.prototype,"target",void 0);Te([w(),qe("design:type",String)],Hi.prototype,"predicate",void 0);Hi=Te([Ue()],Hi);var an=class extends Ar(){hash(){let t=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<t.length;n++)i=t.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};Te([w(),qe("design:type",String)],an.prototype,"status",void 0);an=Te([W()],an);var Lc=class extends yg(){};Te([w(),qe("design:type",String)],Lc.prototype,"status",void 0);Lc=Te([Ue()],Lc);function OI(e,t){return e.author==t.author&&e.timestamp==t.timestamp&&e.data.source==t.data.source&&e.data.predicate==t.data.predicate&&e.data.target==t.data.target}function AI(e){return e&&e.source&&e.target}var Ao=class{constructor(t,r){this.oldLink=t,this.newLink=r}};Te([w(),qe("design:type",an)],Ao.prototype,"oldLink",void 0);Te([w(),qe("design:type",an)],Ao.prototype,"newLink",void 0);Ao=Te([W(),qe("design:paramtypes",[an,an])],Ao);var fn=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},sa=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Fc,Er=class{constructor(t){t?this.links=t:this.links=[]}get(t){if(!t||!t.source&&!t.predicate&&!t.target)return this.links;if(t.source){let n=JSON.parse(JSON.stringify(this.links));return t.target&&(n=n.filter(i=>i.data.target===t.target)),t.predicate&&(n=n.filter(i=>i.data.predicate===t.predicate)),t.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=t.fromDate)),t.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=t.untilDate)),t.limit&&(n=n.slice(0,t.limit)),n}if(t.target){let n=JSON.parse(JSON.stringify(this.links));return t.predicate&&(n=n.filter(i=>i.data.predicate===t.predicate)),t.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=t.fromDate)),t.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=t.untilDate)),t.limit&&(n=n.slice(0,t.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===t.predicate),t.limit&&(r=r.slice(0,t.limit)),r}getSingleTarget(t){delete t.target;let r=this.get(t);return r.length?r[0].data.target:null}};fn([w(),sa("design:type",Array)],Er.prototype,"links",void 0);Er=fn([W(),sa("design:paramtypes",[Array])],Er);var Mc=class{};fn([w(),sa("design:type",Array)],Mc.prototype,"links",void 0);Mc=fn([Ue()],Mc);var $c=Fc=class{constructor(t){t?this.links=t:this.links=[]}static fromLink(t){let r=new Fc;return r.links.push(t),r}};fn([w(),sa("design:type",Array)],$c.prototype,"links",void 0);$c=Fc=fn([Ue(),sa("design:paramtypes",[Array])],$c);var jc=class extends Ar(){};jc=fn([W()],jc);var F=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},M=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},yr=class{constructor(t,r){this.did=t,r?this.perspective=r:this.perspective=new Er}};F([w(),M("design:type",String)],yr.prototype,"did",void 0);F([w(),M("design:type",Er)],yr.prototype,"perspective",void 0);F([w(),M("design:type",String)],yr.prototype,"directMessageLanguage",void 0);yr=F([W(),M("design:paramtypes",[String,Er])],yr);var xf=class extends Ar(){};xf=F([W()],xf);var xr=class{constructor(t,r,n,i,a,o){this.did=t,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],xr.prototype,"did",void 0);F([w(),M("design:type",String)],xr.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],xr.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],xr.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],xr.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],xr.prototype,"didSignedByDeviceKey",void 0);xr=F([W(),M("design:paramtypes",[String,String,String,String,String,String])],xr);var Tr=class{constructor(t,r,n,i,a,o){this.did=t,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],Tr.prototype,"did",void 0);F([w(),M("design:type",String)],Tr.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],Tr.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],Tr.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],Tr.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],Tr.prototype,"didSignedByDeviceKey",void 0);Tr=F([Ue(),M("design:paramtypes",[String,String,String,String,String,String])],Tr);var Do=class{constructor(t,r){this.signature=t,this.publicKey=r}};F([w(),M("design:type",String)],Do.prototype,"signature",void 0);F([w(),M("design:type",String)],Do.prototype,"publicKey",void 0);Do=F([W(),M("design:paramtypes",[String,String])],Do);var Vn=class{constructor(t,r){this.domain=t,this.pointers=r}};F([w(),M("design:type",String)],Vn.prototype,"domain",void 0);F([w(),M("design:type",Array)],Vn.prototype,"pointers",void 0);Vn=F([W(),M("design:paramtypes",[String,Array])],Vn);var No=class{constructor(t,r){this.with=t,this.can=r}};F([w(),M("design:type",Vn)],No.prototype,"with",void 0);F([w(),M("design:type",Array)],No.prototype,"can",void 0);No=F([W(),M("design:paramtypes",[Vn,Array])],No);var er=class{constructor(t,r,n,i,a){this.appName=t,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};F([w(),M("design:type",String)],er.prototype,"appName",void 0);F([w(),M("design:type",String)],er.prototype,"appDesc",void 0);F([w(),M("design:type",String)],er.prototype,"appUrl",void 0);F([w(),M("design:type",String)],er.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],er.prototype,"capabilities",void 0);er=F([W(),M("design:paramtypes",[String,String,String,Array,String])],er);var Qn=class{constructor(t,r,n,i){this.requestId=t,this.auth=r,this.token=n,this.revoked=i}};F([w(),M("design:type",String)],Qn.prototype,"requestId",void 0);F([w(),M("design:type",String)],Qn.prototype,"token",void 0);F([w(),M("design:type",Boolean)],Qn.prototype,"revoked",void 0);F([w(),M("design:type",er)],Qn.prototype,"auth",void 0);Qn=F([W(),M("design:paramtypes",[String,er,String,Boolean])],Qn);var zn=class{constructor(t,r){this.domain=t,this.pointers=r}};F([w(),M("design:type",String)],zn.prototype,"domain",void 0);F([w(),M("design:type",Array)],zn.prototype,"pointers",void 0);zn=F([Ue(),M("design:paramtypes",[String,Array])],zn);var Co=class{constructor(t,r){this.with=t,this.can=r}};F([w(),M("design:type",zn)],Co.prototype,"with",void 0);F([w(),M("design:type",Array)],Co.prototype,"can",void 0);Co=F([Ue(),M("design:paramtypes",[zn,Array])],Co);var Ir=class{constructor(t,r,n,i,a,o){this.appName=t,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};F([w(),M("design:type",String)],Ir.prototype,"appName",void 0);F([w(),M("design:type",String)],Ir.prototype,"appDesc",void 0);F([w(),M("design:type",String)],Ir.prototype,"appDomain",void 0);F([w(),M("design:type",String)],Ir.prototype,"appUrl",void 0);F([w(),M("design:type",String)],Ir.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],Ir.prototype,"capabilities",void 0);Ir=F([Ue(),M("design:paramtypes",[String,String,String,String,String,Array])],Ir);var Hn=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Jn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},gt=class{constructor(t){t?(this.isInitialized=t.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=t.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=t.did,this.didDocument=t.didDocument,this.error=t.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Hn([w(),Jn("design:type",Boolean)],gt.prototype,"isInitialized",void 0);Hn([w(),Jn("design:type",Boolean)],gt.prototype,"isUnlocked",void 0);Hn([w(),Jn("design:type",String)],gt.prototype,"did",void 0);Hn([w(),Jn("design:type",String)],gt.prototype,"didDocument",void 0);Hn([w(),Jn("design:type",String)],gt.prototype,"error",void 0);gt=Hn([W(),Jn("design:paramtypes",[Object])],gt);var Tf=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},Se=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},et,tt,Uc=class{constructor(t,r){et.set(this,void 0),tt.set(this,void 0),Tf(this,et,t,"f"),Tf(this,tt,r,"f")}async otherAgents(){return await Se(this,et,"f").otherAgents(Se(this,tt,"f"))}async hasTelepresenceAdapter(){return await Se(this,et,"f").hasTelepresenceAdapter(Se(this,tt,"f"))}async onlineAgents(){return await Se(this,et,"f").onlineAgents(Se(this,tt,"f"))}async setOnlineStatus(t){return await Se(this,et,"f").setOnlineStatus(Se(this,tt,"f"),t)}async setOnlineStatusU(t){return await Se(this,et,"f").setOnlineStatusU(Se(this,tt,"f"),t)}async sendSignal(t,r){return await Se(this,et,"f").sendSignal(Se(this,tt,"f"),t,r)}async sendSignalU(t,r){return await Se(this,et,"f").sendSignalU(Se(this,tt,"f"),t,r)}async sendBroadcast(t){return await Se(this,et,"f").sendBroadcast(Se(this,tt,"f"),t)}async sendBroadcastU(t){return await Se(this,et,"f").sendBroadcastU(Se(this,tt,"f"),t)}async addSignalHandler(t){await Se(this,et,"f").addSignalHandler(Se(this,tt,"f"),t)}removeSignalHandler(t){Se(this,et,"f").removeSignalHandler(Se(this,tt,"f"),t)}};et=new WeakMap,tt=new WeakMap;var pn=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},dn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},lt=class{constructor(t){t&&(this.source=t.source,this.predicate=t.predicate,this.target=t.target,t.fromDate&&(this.fromDate=t.fromDate),t.untilDate&&(this.untilDate=t.untilDate),t.limit&&(this.limit=t.limit))}isMatch(t){return!(this.source&&this.source!==t.source||this.predicate&&this.predicate!==t.predicate||this.target&&this.target!==t.target)}};pn([w(),dn("design:type",String)],lt.prototype,"source",void 0);pn([w(),dn("design:type",String)],lt.prototype,"target",void 0);pn([w(),dn("design:type",String)],lt.prototype,"predicate",void 0);pn([w(),dn("design:type",Date)],lt.prototype,"fromDate",void 0);pn([w(),dn("design:type",Date)],lt.prototype,"untilDate",void 0);pn([w(),dn("design:type",Number)],lt.prototype,"limit",void 0);lt=pn([W(),Ue(),dn("design:paramtypes",[Object])],lt);var If=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},Xe=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},xt,Ht;function hc(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}var kt=class{constructor(){xt.set(this,void 0),Ht.set(this,void 0)}static fromUrl(t){if(!t||!t.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new kt;return If(r,Ht,t,"f"),r}static from(t){let r=new kt;return If(r,xt,t,"f"),r}toUrl(){if(Xe(this,Ht,"f")&&!Xe(this,xt,"f"))return Xe(this,Ht,"f");if(!Xe(this,Ht,"f")&&!Xe(this,xt,"f"))throw new Error("Can't turn empty Literal into URL");let t;switch(typeof Xe(this,xt,"f")){case"string":t=`string:${hc(Xe(this,xt,"f"))}`;break;case"number":t=`number:${hc(Xe(this,xt,"f"))}`;break;case"object":t=`json:${hc(JSON.stringify(Xe(this,xt,"f")))}`;break}return`literal://${t}`}get(){if(Xe(this,xt,"f"))return Xe(this,xt,"f");if(!Xe(this,Ht,"f"))throw new Error("Can't render empty Literal");if(!Xe(this,Ht,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let t=Xe(this,Ht,"f").substring(10);if(t.startsWith("string:"))return decodeURIComponent(t.substring(7));if(t.startsWith("number:")){let r=t.substring(7);return parseFloat(r)}if(t.startsWith("json:")){let r=t.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${t}`)}};xt=new WeakMap,Ht=new WeakMap;function vr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function jp(e){return`set${vr(e)}`}function Xt(e){return e.endsWith("y")?e.slice(0,-1)+"ies":e+"s"}function ou(e){return e.endsWith("ies")?e.slice(0,-3)+"y":e.endsWith("s")?e.slice(0,-1):e}function vg(e){return`add${vr(ou(e))}`}function bg(e){let t=e.substring(3),r=Xt(t);return r.charAt(0).toLowerCase()+r.slice(1)}function _g(e){return`remove${vr(ou(e))}`}function wg(e){let t=e.substring(6),r=Xt(t);return r.charAt(0).toLowerCase()+r.slice(1)}function Sg(e){let t=e.substring(13),r=Xt(t);return r.charAt(0).toLowerCase()+r.slice(1)}function Eg(e){return`setCollection${vr(ou(e))}`}function Vr(e){if(Array.isArray(e))return`[${e.map(Vr).join(", ")}]`;let t=Object.keys(e),r=[];for(let n of t){let i=JSON.stringify(e[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var mc=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},B=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},ze,Ge,ve,Ro=class{constructor(e,t,r){ze.set(this,void 0),Ge.set(this,void 0),ve.set(this,void 0),mc(this,ze,t,"f"),mc(this,Ge,r,"f"),mc(this,ve,e,"f")}get baseExpression(){return B(this,ze,"f")}async init(){let isInstance=await B(this,ve,"f").isSubjectInstance(B(this,ze,"f"),B(this,Ge,"f"));if(!isInstance)throw`Not a valid subject instance of ${B(this,Ge,"f")} for ${B(this,ze,"f")}`;let results=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property(C, Property)`),properties=results.map(e=>e.Property);for(let e of properties){let t=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_resolve(C, "${e}")`);Object.defineProperty(this,e,{configurable:!0,get:async()=>{let r=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_getter(C, "${B(this,ze,"f")}", "${e}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(t)try{if(n){let i=await B(this,ve,"f").getExpression(n);try{return JSON.parse(i.data)}catch{return i.data}}else return n}catch{return n}else return n}else return r||void 0}})}let setters=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[jp(property)]=async e=>{resolveLanguage&&(e=await B(this,ve,"f").createExpression(e,resolveLanguage)),await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}let results2=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(e=>e.Collection);for(let e of collections)Object.defineProperty(this,e,{configurable:!0,get:async()=>{let t=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_getter(C, "${B(this,ze,"f")}", "${e}", Value)`);return t&&t.length>0&&t[0].Value?t[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[vg(collection)]=async e=>{Array.isArray(e)?await Promise.all(e.map(t=>B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:t}]))):await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}let removers=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[_g(collection)]=async e=>{Array.isArray(e)?await Promise.all(e.map(t=>B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:t}]))):await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}let collectionSetters=await B(this,ve,"f").infer(`subject_class("${B(this,Ge,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[Eg(collection)]=async e=>{Array.isArray(e)?await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),e.map(t=>({name:"value",value:t}))):await B(this,ve,"f").executeAction(actions,B(this,ze,"f"),[{name:"value",value:e}])}}}};ze=new WeakMap,Ge=new WeakMap,ve=new WeakMap;var Pn=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},L=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},oe,le,Qr,zr,Gr,ki,qn=class{constructor(e,t){oe.set(this,void 0),le.set(this,void 0),Qr.set(this,void 0),zr.set(this,void 0),Gr.set(this,void 0),ki.set(this,void 0),Pn(this,Qr,[],"f"),Pn(this,zr,[],"f"),Pn(this,Gr,[],"f"),Pn(this,ki,[],"f"),Pn(this,oe,e,"f"),Pn(this,le,t,"f"),this.uuid=L(this,oe,"f").uuid,this.name=L(this,oe,"f").name,this.sharedUrl=L(this,oe,"f").sharedUrl,this.neighbourhood=L(this,oe,"f").neighbourhood,this.state=L(this,oe,"f").state,L(this,le,"f").addPerspectiveLinkAddedListener(L(this,oe,"f").uuid,L(this,Qr,"f")),L(this,le,"f").addPerspectiveLinkRemovedListener(L(this,oe,"f").uuid,L(this,zr,"f")),L(this,le,"f").addPerspectiveLinkUpdatedListener(L(this,oe,"f").uuid,L(this,Gr,"f")),L(this,le,"f").addPerspectiveSyncStateChangeListener(L(this,oe,"f").uuid,L(this,ki,"f"))}async executeAction(e,t,r){return await L(this,le,"f").executeCommands(L(this,oe,"f").uuid,JSON.stringify(e),t,JSON.stringify(r))}async get(e){return await L(this,le,"f").queryLinks(L(this,oe,"f").uuid,e)}async infer(e){return await L(this,le,"f").queryProlog(L(this,oe,"f").uuid,e)}async add(e,t="shared"){return await L(this,le,"f").addLink(L(this,oe,"f").uuid,e,t)}async addLinks(e,t="shared"){return await L(this,le,"f").addLinks(L(this,oe,"f").uuid,e,t)}async removeLinks(e){return await L(this,le,"f").removeLinks(L(this,oe,"f").uuid,e)}async linkMutations(e,t="shared"){return await L(this,le,"f").linkMutations(L(this,oe,"f").uuid,e,t)}async addLinkExpression(e,t="shared"){return await L(this,le,"f").addLinkExpression(L(this,oe,"f").uuid,e,t)}async update(e,t){return await L(this,le,"f").updateLink(L(this,oe,"f").uuid,e,t)}async remove(e){return await L(this,le,"f").removeLink(L(this,oe,"f").uuid,e)}async getExpression(e){return await L(this,le,"f").getExpression(e)}async createExpression(e,t){return await L(this,le,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?L(this,Qr,"f").push(t):e==="link-removed"?L(this,zr,"f").push(t):e==="link-updated"&&L(this,Gr,"f").push(t)}async addSyncStateChangeListener(e){L(this,ki,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=L(this,Qr,"f").indexOf(t);L(this,Qr,"f").splice(r,1)}else if(e==="link-removed"){let r=L(this,zr,"f").indexOf(t);L(this,zr,"f").splice(r,1)}else if(e==="link-updated"){let r=L(this,Gr,"f").indexOf(t);L(this,Gr,"f").splice(r,1)}}async snapshot(){return L(this,le,"f").snapshotByUUID(L(this,oe,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new lt({source:e.source,predicate:e.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[e];await this.linkMutations({additions:a,removals:i},t)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(t=>t.X)}async availableFlows(e){return(await this.infer(`flowable("${e}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(e,t){return(await this.infer(`register_sdna_flow("${e}", F), flow_state(X, ${t}, F)`)).map(n=>n.X)}async flowState(e,t){return(await this.infer(`register_sdna_flow("${e}", F), flow_state("${t}", X, F)`))[0].X}async flowActions(e,t){return(await this.infer(`register_sdna_flow("${e}", Flow), flow_state("${t}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){return(await this.get(new lt({predicate:"ad4m://sdna"}))).map(t=>t.data.target).map(t=>kt.fromUrl(t).get())}async addSdna(e,t,r){return L(this,le,"f").addSdna(L(this,oe,"f").uuid,e,t,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(e=>e.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClass(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t){let r;if(typeof e=="string")r=e,await L(this,le,"f").createSubject(L(this,oe,"f").uuid,JSON.stringify({className:r}),t);else{let n=this.buildQueryFromTemplate(e);await L(this,le,"f").createSubject(L(this,oe,"f").uuid,JSON.stringify({query:n}),t)}return this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await L(this,le,"f").getSubjectData(L(this,oe,"f").uuid,JSON.stringify({className:e}),t));let r=this.buildQueryFromTemplate(e);return JSON.parse(await L(this,le,"f").getSubjectData(L(this,oe,"f").uuid,JSON.stringify({query:r}),t))}async removeSubject(subjectClass,exprAddr){let className=await this.stringOrTemplateObjectToSubjectClass(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No constructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClass(t),n=!1,i=5,a=0;for(;a<i&&!n;)n=await this.infer(`subject_class("${r}", C), instance(C, "${e}")`),a++;return n}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClass(t),n=new Ro(this,e,r);return await n.init(),n}async getAllSubjectInstances(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let i=await this.infer(`subject_class("${n}", C), instance(C, X)`),a=await Promise.all(i.map(async o=>await this.getSubjectProxy(o.X,n)));r=r.concat(a)}return r}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t)r=await this.infer(`subject_class("${n}", C), instance(C, X)`);return r}buildQueryFromTemplate(e){let t;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>!i.includes(l)):i.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let u=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));u=u.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let l of n)c+=`, property(C, "${l}")`;for(let l of i)c+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),c+=`, property_setter(C, "${d}", _)`}for(let l of o)c+=`, collection_adder(C, "${bg(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${wg(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${Sg(l)}", _)`;c+=".",t=c}(e),t}async subjectClassesByTemplate(e){let t=this.buildQueryFromTemplate(e),r=await this.infer(t);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(e){if((await this.subjectClassesByTemplate(new e)).length>0)return;let{name:r,sdna:n}=e.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return L(this,le,"f").getNeighbourhoodProxy(L(this,oe,"f").uuid)}get ai(){return L(this,le,"f").aiClient}};oe=new WeakMap,le=new WeakMap,Qr=new WeakMap,zr=new WeakMap,Gr=new WeakMap,ki=new WeakMap;var pr=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},Q=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},ie,Oi,Ai,Di,mo,Ni,go,yo,ot=`
|
|
62
62
|
author
|
|
63
63
|
timestamp
|
|
64
64
|
status
|
|
@@ -477,27 +477,23 @@ neighbourhood {
|
|
|
477
477
|
remoteAgentDid: $remoteAgentDid,
|
|
478
478
|
payload: $payload
|
|
479
479
|
)
|
|
480
|
-
}`,variables:{perspectiveUUID:t,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(t,r
|
|
480
|
+
}`,variables:{perspectiveUUID:t,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(t,r){let{neighbourhoodSendBroadcast:n}=k(await $e(this,Ke,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
|
|
481
481
|
$perspectiveUUID: String!,
|
|
482
|
-
$payload: PerspectiveInput
|
|
483
|
-
$loopback: Boolean
|
|
482
|
+
$payload: PerspectiveInput!
|
|
484
483
|
) {
|
|
485
484
|
neighbourhoodSendBroadcast(
|
|
486
485
|
perspectiveUUID: $perspectiveUUID,
|
|
487
|
-
payload: $payload
|
|
488
|
-
loopback: $loopback
|
|
486
|
+
payload: $payload
|
|
489
487
|
)
|
|
490
|
-
}`,variables:{perspectiveUUID:t,payload:r
|
|
488
|
+
}`,variables:{perspectiveUUID:t,payload:r}}));return n}async sendBroadcastU(t,r){let{neighbourhoodSendBroadcastU:n}=k(await $e(this,Ke,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
|
|
491
489
|
$perspectiveUUID: String!,
|
|
492
|
-
$payload: PerspectiveUnsignedInput
|
|
493
|
-
$loopback: Boolean
|
|
490
|
+
$payload: PerspectiveUnsignedInput!
|
|
494
491
|
) {
|
|
495
492
|
neighbourhoodSendBroadcastU(
|
|
496
493
|
perspectiveUUID: $perspectiveUUID,
|
|
497
|
-
payload: $payload
|
|
498
|
-
loopback: $loopback
|
|
494
|
+
payload: $payload
|
|
499
495
|
)
|
|
500
|
-
}`,variables:{perspectiveUUID:t,payload:r
|
|
496
|
+
}`,variables:{perspectiveUUID:t,payload:r}}));return n}dispatchSignal(t,r){let n=$e(this,Kr,"f").get(t);n&&n.forEach(i=>i(r))}async subscribeToSignals(t){let r=this;await $e(this,Ke,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
|
|
501
497
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
502
498
|
author
|
|
503
499
|
timestamp
|
|
@@ -795,13 +791,13 @@ triggerMatch
|
|
|
795
791
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
796
792
|
aiEmbed(modelId: $modelId, text: $text)
|
|
797
793
|
}
|
|
798
|
-
`,variables:{modelId:t,text:r}})),i=Ko.toByteArray(n);return JSON.parse(Pb.inflate(i,{to:"string"}))}async openTranscriptionStream(t,r
|
|
799
|
-
mutation AiOpenTranscriptionStream($modelId: String
|
|
800
|
-
aiOpenTranscriptionStream(modelId: $modelId
|
|
794
|
+
`,variables:{modelId:t,text:r}})),i=Ko.toByteArray(n);return JSON.parse(Pb.inflate(i,{to:"string"}))}async openTranscriptionStream(t,r){let{aiOpenTranscriptionStream:n}=k(await Ne(this,Ae,"f").mutate({mutation:E`
|
|
795
|
+
mutation AiOpenTranscriptionStream($modelId: String!) {
|
|
796
|
+
aiOpenTranscriptionStream(modelId: $modelId)
|
|
801
797
|
}
|
|
802
|
-
`,variables:{modelId:t
|
|
803
|
-
aiTranscriptionText(streamId: "${
|
|
804
|
-
}`}).subscribe({next(
|
|
798
|
+
`,variables:{modelId:t}})),i=Ne(this,Ae,"f").subscribe({query:E` subscription {
|
|
799
|
+
aiTranscriptionText(streamId: "${n}")
|
|
800
|
+
}`}).subscribe({next(a){return r(a.data.aiTranscriptionText),a.data.aiTranscriptionText},error(a){console.error(a)}});return Ne(this,bo,"f").set(n,i),n}async closeTranscriptionStream(t){let{aiCloseTranscriptionStream:r}=k(await Ne(this,Ae,"f").mutate({mutation:E`
|
|
805
801
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
806
802
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
807
803
|
}
|
|
@@ -1142,7 +1138,7 @@ type Mutation {
|
|
|
1142
1138
|
aiCloseTranscriptionStream(streamId: String!): String!
|
|
1143
1139
|
aiEmbed(modelId: String!, text: String!): String!
|
|
1144
1140
|
aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
|
|
1145
|
-
aiOpenTranscriptionStream(modelId: String
|
|
1141
|
+
aiOpenTranscriptionStream(modelId: String!): String!
|
|
1146
1142
|
aiPrompt(prompt: String!, taskId: String!): String!
|
|
1147
1143
|
aiRemoveModel(modelId: String!): Boolean!
|
|
1148
1144
|
aiRemoveTask(taskId: String!): AITask!
|
|
@@ -1158,8 +1154,8 @@ type Mutation {
|
|
|
1158
1154
|
languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
|
|
1159
1155
|
neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
|
|
1160
1156
|
neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
|
|
1161
|
-
neighbourhoodSendBroadcast(
|
|
1162
|
-
neighbourhoodSendBroadcastU(
|
|
1157
|
+
neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
|
|
1158
|
+
neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
|
|
1163
1159
|
neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
1164
1160
|
neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
1165
1161
|
neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
|
|
@@ -1357,14 +1353,6 @@ type TriggeredNotification {
|
|
|
1357
1353
|
perspectiveId: String!
|
|
1358
1354
|
triggerMatch: String!
|
|
1359
1355
|
}
|
|
1360
|
-
|
|
1361
|
-
input VoiceActivityParamsInput {
|
|
1362
|
-
endThreshold: Float
|
|
1363
|
-
endWindow: Float
|
|
1364
|
-
startThreshold: Float
|
|
1365
|
-
startWindow: Float
|
|
1366
|
-
timeBeforeSpeech: Float
|
|
1367
|
-
}
|
|
1368
|
-
`;function xp(e){return e?.length?e.length===1?e.toString():e.length===2?e.join(" and "):e.slice(0,-1).join(", ")+", and "+e.slice(-1):""}function Ek(e){let t=e.can.includes("*")?["READ","WRITE","UPDATE"]:e.can,r=e.with.domain==="*"?"":e.with.domain,n=e.with.pointers.includes("*")?["all AD4M data"]:e.with.pointers;return`${xp(t)} your ${r} actions, with access to ${xp(n)}`}var Br=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},V=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},We,It,Eo,me,Tp=class{constructor(e,t,r){We.set(this,void 0),It.set(this,void 0),Eo.set(this,void 0),me.set(this,void 0),Br(this,We,t||kt.from(Td(24)).toUrl(),"f"),Br(this,me,e,"f"),Br(this,Eo,r||"ad4m://self","f")}get baseExpression(){return V(this,We,"f")}get perspective(){return V(this,me,"f")}async getData(e){let t=e??V(this,We,"f"),r=await V(this,me,"f").getSubjectData(V(this,It,"f"),t);return Object.assign(this,r),Br(this,We,t,"f"),this}async setProperty(key,value){let setters=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await V(this,me,"f").createExpression(value,resolveLanguage)),await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}])}}async setCollectionSetter(key,value){let collectionSetters=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), collection_setter(C, "${Xt(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await V(this,me,"f").executeAction(actions,V(this,We,"f"),value.map(e=>({name:"value",value:e}))):await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}]))}}async setCollectionAdder(key,value){let adders=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), collection_adder(C, "${Xt(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(e=>V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value:e}]))):await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}]))}}async setCollectionRemover(key,value){let removers=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), collection_remover(C, "${Xt(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(e=>V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value:e}]))):await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}]))}}async save(){Br(this,It,await V(this,me,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await V(this,me,"f").createSubject(this,V(this,We,"f")),await V(this,me,"f").add(new nn({source:V(this,Eo,"f"),predicate:"ad4m://has_child",target:this.baseExpression})),await this.update()}async update(){Br(this,It,await V(this,me,"f").stringOrTemplateObjectToSubjectClass(this),"f");let e=Object.entries(this);for(let[t,r]of e)if(r!=null)if(r?.action)switch(r.action){case"setter":await this.setCollectionSetter(t,r.value);break;case"adder":await this.setCollectionAdder(t,r.value);break;case"remover":await this.setCollectionRemover(t,r.value);default:await this.setCollectionSetter(t,r.value);break}else Array.isArray(r)&&r.length>0?await this.setCollectionSetter(t,r):r!=null&&r!==""&&await this.setProperty(t,r);await this.getData()}async get(){return Br(this,It,await V(this,me,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await this.getData()}async delete(){await V(this,me,"f").removeSubject(this,V(this,We,"f"))}static async all(e){let t=await e.stringOrTemplateObjectToSubjectClass(this),r=await e.getAllSubjectProxies(t),n=[];if(r){for(let i of r){let a=new this(e,i.X);n.push(await a.get())}return n}return[]}static async query(e,t){let r=t?.source||"ad4m://self",n=await e.stringOrTemplateObjectToSubjectClass(this),i=[],a=`subject_class("${n}", C), instance(C, Base), link("${r}", Predicate, Base, Timestamp, Author)`;if(t){if(t.where)if(t.where.condition)a+=", "+t.where.condition;else{let s=Object.entries(t.where);for(let u of s){let c=u[0],l=u[1];a+=`, property_getter(C, Base, "${c}", "${l}")`}}try{if((await e.infer(`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), length(SortedData, DataLength).`))[0].DataLength>=t.size){let u=`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), reverse(SortedData, ReverseSortedData), paginate(ReverseSortedData, ${t.page}, ${t.size}, PageData).`;i=await e.infer(u),i=i[0].PageData.map(c=>({Base:c[1],Timestamp:c[0]}))}else i=await e.infer(a)}catch(s){console.log("Query failed",s)}}else i=await e.infer(a);return i?await Promise.all(i.map(async s=>await new this(e,s.Base).get())):[]}};We=new WeakMap,It=new WeakMap,Eo=new WeakMap,me=new WeakMap;var Id="0.10.1-rc9-dev5";var Xo=12e3;function $b(){let e=new AbortController;return setTimeout(()=>e.abort(),20),e}function es(e,t=1e4){return Ve(this,null,function*(){return Promise.race([new Promise((r,n)=>{try{e.includes("localhost")||r(new WebSocket(e));let i=new WebSocket(e);i.onopen=()=>{r(i)},i.onerror=a=>{n(a)}}catch(i){n(i)}}),new Promise((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},t)})])})}function yu(e){return Ve(this,null,function*(){try{let t=yield fetch(`http://localhost:${e}/graphql/`,{signal:$b().signal,mode:"cors"});if(t.status===400||t.status===0||t.status===200)return e;throw new Error(`Could not connect to port ${e}`)}catch(t){throw new Error(`Could not connect to port ${e}`)}})}function jb(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(e){return!1}return!0}function kd(e,t){jb()&&localStorage.setItem(`${Id}/${e}`,t)}var Ub=e=>{let t=new Set;do for(let r of Reflect.ownKeys(e))t.add([e,r]);while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t};function vu(e,{include:t,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return t?t.some(a):r?!r.some(a):!0};for(let[i,a]of Ub(e.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(e[a]=e[a].bind(e))}return e}var bu=class{constructor({appName:t,appDesc:r,appIconPath:n,appUrl:i,appDomain:a,capabilities:o,port:s,token:u,url:c,hosting:l}){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Xo;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};vu(this);this.appName=t,this.appDesc=r,this.appDomain=a,this.appUrl=i,this.appIconPath=n,this.capabilities=o,this.port=s||this.port,this.url=c||`ws://localhost:${this.port}/graphql`,this.token=u||this.token,this.isHosting=l||!1,this.buildClient()}notifyConfigChange(t,r){this.listeners.configstatechange.forEach(n=>{n(t,r)})}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.listeners.connectionstatechange.forEach(r=>{r(t)}))}notifyAuthChange(t){this.authState!==t&&(this.authState=t,this.listeners.authstatechange.forEach(r=>{r(t)}))}setPort(t){this.port!==t&&(this.port=t,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",t))}setUrl(t){this.url!==t&&(this.url=t,this.notifyConfigChange("url",t))}setToken(t){this.token!==t&&(this.token=t,this.notifyConfigChange("token",t))}on(t,r){this.listeners[t].push(r)}connect(t){return Ve(this,null,function*(){try{if(t){yield es(t),this.setUrl(t);let r=this.buildClient();return yield this.checkAuth(),r}else{this.notifyConnectionChange("checking_local");try{yield es(`ws://localhost:${this.port}/graphql`,2e3);let r=this.buildClient();return yield this.checkAuth(),r}catch(r){let n=yield this.ensureConnection();return yield this.checkAuth(),n}}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}loginToHosting(t,r){return Ve(this,null,function*(){try{let n=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:r})});if(n.status===200){let i=yield n.json();localStorage.setItem("hosting_token",i.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,kd("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield n.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(n){throw console.log(n),new Error(`Error logging in ${n}`)}})}checkEmail(t){return Ve(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${t}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(r){console.log(r)}})}connectToPort(t){return Ve(this,null,function*(){try{if(t){let r=yield yu(t);return this.setPort(r),this.buildClient()}else if(this.url.includes("localhost")){let r=yield this.findPort();return this.setPort(r),this.buildClient()}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return Ve(this,null,function*(){var r,n;if(((r=this.activeSocket)==null?void 0:r.readyState)===WebSocket.OPEN&&((n=this.activeSocket)==null?void 0:n.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield es(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return Ve(this,null,function*(){let t=[...Array(10).keys()].map((i,a)=>yu(Xo+a)),n=(yield Promise.allSettled(t)).find(i=>i.status==="fulfilled");if(n)return n.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let t=new WebSocket(this.url)}catch(t){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=mf({url:this.url,connectionParams:()=>Ve(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:t=>{this.activeSocket=t},error:t=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:t=>Ve(this,null,function*(){if(console.log("buildClient closed:",t),!t.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let r=yield this.connect();r?this.ad4mClient=r:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new uc({link:new gf(this.wsClient),cache:new Qa({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new Uo(this.apolloClient),this.ad4mClient}checkAuth(){return Ve(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(t){return t.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(t=!1){return Ve(this,null,function*(){var r;if(t&&this.setToken(null),this.isHosting){let n=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+n}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(r=this.ad4mClient)==null?void 0:r.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(t){return Ve(this,null,function*(){var r;try{let n=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,t);return this.setToken(n),yield this.buildClient(),yield this.checkAuth(),this.token}catch(n){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Xo),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};export{bu as default};
|
|
1356
|
+
`;function xp(e){return e?.length?e.length===1?e.toString():e.length===2?e.join(" and "):e.slice(0,-1).join(", ")+", and "+e.slice(-1):""}function Ek(e){let t=e.can.includes("*")?["READ","WRITE","UPDATE"]:e.can,r=e.with.domain==="*"?"":e.with.domain,n=e.with.pointers.includes("*")?["all AD4M data"]:e.with.pointers;return`${xp(t)} your ${r} actions, with access to ${xp(n)}`}var Br=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},V=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},We,It,Eo,me,Tp=class{constructor(e,t,r){We.set(this,void 0),It.set(this,void 0),Eo.set(this,void 0),me.set(this,void 0),Br(this,We,t||kt.from(Td(24)).toUrl(),"f"),Br(this,me,e,"f"),Br(this,Eo,r||"ad4m://self","f")}get baseExpression(){return V(this,We,"f")}get perspective(){return V(this,me,"f")}async getData(e){let t=e??V(this,We,"f"),r=await V(this,me,"f").getSubjectData(V(this,It,"f"),t);return Object.assign(this,r),Br(this,We,t,"f"),this}async setProperty(key,value){let setters=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await V(this,me,"f").createExpression(value,resolveLanguage)),await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}])}}async setCollectionSetter(key,value){let collectionSetters=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), collection_setter(C, "${Xt(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await V(this,me,"f").executeAction(actions,V(this,We,"f"),value.map(e=>({name:"value",value:e}))):await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}]))}}async setCollectionAdder(key,value){let adders=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), collection_adder(C, "${Xt(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(e=>V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value:e}]))):await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}]))}}async setCollectionRemover(key,value){let removers=await V(this,me,"f").infer(`subject_class("${V(this,It,"f")}", C), collection_remover(C, "${Xt(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(e=>V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value:e}]))):await V(this,me,"f").executeAction(actions,V(this,We,"f"),[{name:"value",value}]))}}async save(){Br(this,It,await V(this,me,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await V(this,me,"f").createSubject(this,V(this,We,"f")),await V(this,me,"f").add(new nn({source:V(this,Eo,"f"),predicate:"ad4m://has_child",target:this.baseExpression})),await this.update()}async update(){Br(this,It,await V(this,me,"f").stringOrTemplateObjectToSubjectClass(this),"f");let e=Object.entries(this);for(let[t,r]of e)if(r!=null)if(r?.action)switch(r.action){case"setter":await this.setCollectionSetter(t,r.value);break;case"adder":await this.setCollectionAdder(t,r.value);break;case"remover":await this.setCollectionRemover(t,r.value);default:await this.setCollectionSetter(t,r.value);break}else Array.isArray(r)&&r.length>0?await this.setCollectionSetter(t,r):r!=null&&r!==""&&await this.setProperty(t,r);await this.getData()}async get(){return Br(this,It,await V(this,me,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await this.getData()}async delete(){await V(this,me,"f").removeSubject(this,V(this,We,"f"))}static async all(e){let t=await e.stringOrTemplateObjectToSubjectClass(this),r=await e.getAllSubjectProxies(t),n=[];if(r){for(let i of r){let a=new this(e,i.X);n.push(await a.get())}return n}return[]}static async query(e,t){let r=t?.source||"ad4m://self",n=await e.stringOrTemplateObjectToSubjectClass(this),i=[],a=`subject_class("${n}", C), instance(C, Base), link("${r}", Predicate, Base, Timestamp, Author)`;if(t){if(t.where)if(t.where.condition)a+=", "+t.where.condition;else{let s=Object.entries(t.where);for(let u of s){let c=u[0],l=u[1];a+=`, property_getter(C, Base, "${c}", "${l}")`}}try{if((await e.infer(`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), length(SortedData, DataLength).`))[0].DataLength>=t.size){let u=`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), reverse(SortedData, ReverseSortedData), paginate(ReverseSortedData, ${t.page}, ${t.size}, PageData).`;i=await e.infer(u),i=i[0].PageData.map(c=>({Base:c[1],Timestamp:c[0]}))}else i=await e.infer(a)}catch(s){console.log("Query failed",s)}}else i=await e.infer(a);return i?await Promise.all(i.map(async s=>await new this(e,s.Base).get())):[]}};We=new WeakMap,It=new WeakMap,Eo=new WeakMap,me=new WeakMap;var Id="0.10.1-rc9-dev7";var Xo=12e3;function $b(){let e=new AbortController;return setTimeout(()=>e.abort(),20),e}function es(e,t=1e4){return Ve(this,null,function*(){return Promise.race([new Promise((r,n)=>{try{e.includes("localhost")||r(new WebSocket(e));let i=new WebSocket(e);i.onopen=()=>{r(i)},i.onerror=a=>{n(a)}}catch(i){n(i)}}),new Promise((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},t)})])})}function yu(e){return Ve(this,null,function*(){try{let t=yield fetch(`http://localhost:${e}/graphql/`,{signal:$b().signal,mode:"cors"});if(t.status===400||t.status===0||t.status===200)return e;throw new Error(`Could not connect to port ${e}`)}catch(t){throw new Error(`Could not connect to port ${e}`)}})}function jb(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(e){return!1}return!0}function kd(e,t){jb()&&localStorage.setItem(`${Id}/${e}`,t)}var Ub=e=>{let t=new Set;do for(let r of Reflect.ownKeys(e))t.add([e,r]);while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t};function vu(e,{include:t,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return t?t.some(a):r?!r.some(a):!0};for(let[i,a]of Ub(e.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(e[a]=e[a].bind(e))}return e}var bu=class{constructor({appName:t,appDesc:r,appIconPath:n,appUrl:i,appDomain:a,capabilities:o,port:s,token:u,url:c,hosting:l}){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Xo;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};vu(this);this.appName=t,this.appDesc=r,this.appDomain=a,this.appUrl=i,this.appIconPath=n,this.capabilities=o,this.port=s||this.port,this.url=c||`ws://localhost:${this.port}/graphql`,this.token=u||this.token,this.isHosting=l||!1,this.buildClient()}notifyConfigChange(t,r){this.listeners.configstatechange.forEach(n=>{n(t,r)})}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.listeners.connectionstatechange.forEach(r=>{r(t)}))}notifyAuthChange(t){this.authState!==t&&(this.authState=t,this.listeners.authstatechange.forEach(r=>{r(t)}))}setPort(t){this.port!==t&&(this.port=t,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",t))}setUrl(t){this.url!==t&&(this.url=t,this.notifyConfigChange("url",t))}setToken(t){this.token!==t&&(this.token=t,this.notifyConfigChange("token",t))}on(t,r){this.listeners[t].push(r)}connect(t){return Ve(this,null,function*(){try{if(t){yield es(t),this.setUrl(t);let r=this.buildClient();return yield this.checkAuth(),r}else{this.notifyConnectionChange("checking_local");try{yield es(`ws://localhost:${this.port}/graphql`,2e3);let r=this.buildClient();return yield this.checkAuth(),r}catch(r){let n=yield this.ensureConnection();return yield this.checkAuth(),n}}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}loginToHosting(t,r){return Ve(this,null,function*(){try{let n=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,password:r})});if(n.status===200){let i=yield n.json();localStorage.setItem("hosting_token",i.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,kd("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield n.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(n){throw console.log(n),new Error(`Error logging in ${n}`)}})}checkEmail(t){return Ve(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${t}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(r){console.log(r)}})}connectToPort(t){return Ve(this,null,function*(){try{if(t){let r=yield yu(t);return this.setPort(r),this.buildClient()}else if(this.url.includes("localhost")){let r=yield this.findPort();return this.setPort(r),this.buildClient()}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return Ve(this,null,function*(){var r,n;if(((r=this.activeSocket)==null?void 0:r.readyState)===WebSocket.OPEN&&((n=this.activeSocket)==null?void 0:n.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield es(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return Ve(this,null,function*(){let t=[...Array(10).keys()].map((i,a)=>yu(Xo+a)),n=(yield Promise.allSettled(t)).find(i=>i.status==="fulfilled");if(n)return n.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let t=new WebSocket(this.url)}catch(t){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=mf({url:this.url,connectionParams:()=>Ve(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:t=>{this.activeSocket=t},error:t=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:t=>Ve(this,null,function*(){if(!t.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let r=yield this.connect();r?this.ad4mClient=r:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new uc({link:new gf(this.wsClient),cache:new Qa({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new Uo(this.apolloClient),this.ad4mClient}checkAuth(){return Ve(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(t){return t.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(t=!1){return Ve(this,null,function*(){var r;if(t&&this.setToken(null),this.isHosting){let n=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+n}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(r=this.ad4mClient)==null?void 0:r.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(t){return Ve(this,null,function*(){var r;try{let n=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,t);return this.setToken(n),yield this.buildClient(),yield this.checkAuth(),this.token}catch(n){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Xo),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};export{bu as default};
|
|
1369
1357
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
1370
1358
|
//! @fayeed - make it support node.js
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=(e,t,o)=>new Promise((n,s)=>{var c=r=>{try{l(o.next(r))}catch(u){s(u)}},p=r=>{try{l(o.throw(r))}catch(u){s(u)}},l=r=>r.done?n(r.value):Promise.resolve(r.value).then(c,p);l((o=o.apply(e,t)).next())});var i="0.10.1-rc9-
|
|
1
|
+
var a=(e,t,o)=>new Promise((n,s)=>{var c=r=>{try{l(o.next(r))}catch(u){s(u)}},p=r=>{try{l(o.throw(r))}catch(u){s(u)}},l=r=>r.done?n(r.value):Promise.resolve(r.value).then(c,p);l((o=o.apply(e,t)).next())});var i="0.10.1-rc9-dev7";var w=12e3;function b(){let e=new AbortController;return setTimeout(()=>e.abort(),20),e}function j(e,t=1e4){return a(this,null,function*(){return Promise.race([new Promise((o,n)=>{try{e.includes("localhost")||o(new WebSocket(e));let s=new WebSocket(e);s.onopen=()=>{o(s)},s.onerror=c=>{n(c)}}catch(s){n(s)}}),new Promise((o,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},t)})])})}function v(e){return a(this,null,function*(){try{let t=yield fetch(`http://localhost:${e}/graphql/`,{signal:b().signal,mode:"cors"});if(t.status===400||t.status===0||t.status===200)return e;throw new Error(`Could not connect to port ${e}`)}catch(t){throw new Error(`Could not connect to port ${e}`)}})}function y(){return new Promise((e,t)=>{let o=document.querySelector("ad4m-connect"),n=o==null?void 0:o.getAd4mClient();n?e(n):t("No Ad4mClient found")})}function S(e){let t=document.querySelector("ad4m-connect");t==null||t.addEventListener("authstatechange",o=>{e(o.detail)})}function x(){let e=navigator.userAgent,t="";return e.search("Windows")!==-1?t="Windows":e.search("Mac")!==-1?t="MacOS":e.search("X11")!==-1&&e.search("Linux")===-1?t="UNIX":e.search("Linux")!==-1&&e.search("X11")!==-1&&(t="Linux"),t}function d(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(e){return!1}return!0}function A(e,t){d()&&localStorage.setItem(`${i}/${e}`,t)}function C(e){return d()?localStorage.getItem(`${i}/${e}`):null}function $(e){d()&&localStorage.removeItem(`${i}/${e}`)}export{w as DEFAULT_PORT,v as checkPort,j as connectWebSocket,x as detectOS,y as getAd4mClient,C as getForVersion,S as onAuthStateChanged,$ as removeForVersion,A as setForVersion};
|
package/dist/web.js
CHANGED
|
@@ -60,7 +60,7 @@ For more information, please visit: https://go.apollo.dev/c/docs`):new V(9);if(t
|
|
|
60
60
|
`)}function id(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Bg(t){for(var e,r=!0,n=!0,i=0,a=null,o=0;o<t.length;++o)switch(t.charCodeAt(o)){case 13:t.charCodeAt(o+1)===10&&++o;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var Vg=function(){function t(r){var n=new Ie(k.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=t.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==k.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=Qg(this,n)}while(n.kind===k.COMMENT);return n},t}();function zg(t){return t===k.BANG||t===k.DOLLAR||t===k.AMP||t===k.PAREN_L||t===k.PAREN_R||t===k.SPREAD||t===k.COLON||t===k.EQUALS||t===k.AT||t===k.BRACKET_L||t===k.BRACKET_R||t===k.BRACE_L||t===k.PIPE||t===k.BRACE_R}function wn(t){return isNaN(t)?k.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function Qg(t,e){for(var r=t.source,n=r.body,i=n.length,a=e.end;a<i;){var o=n.charCodeAt(a),s=t.line,u=1+a-t.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++t.line,t.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new Ie(k.BANG,a,a+1,s,u,e);case 35:return Hg(r,a,s,u,e);case 36:return new Ie(k.DOLLAR,a,a+1,s,u,e);case 38:return new Ie(k.AMP,a,a+1,s,u,e);case 40:return new Ie(k.PAREN_L,a,a+1,s,u,e);case 41:return new Ie(k.PAREN_R,a,a+1,s,u,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Ie(k.SPREAD,a,a+3,s,u,e);break;case 58:return new Ie(k.COLON,a,a+1,s,u,e);case 61:return new Ie(k.EQUALS,a,a+1,s,u,e);case 64:return new Ie(k.AT,a,a+1,s,u,e);case 91:return new Ie(k.BRACKET_L,a,a+1,s,u,e);case 93:return new Ie(k.BRACKET_R,a,a+1,s,u,e);case 123:return new Ie(k.BRACE_L,a,a+1,s,u,e);case 124:return new Ie(k.PIPE,a,a+1,s,u,e);case 125:return new Ie(k.BRACE_R,a,a+1,s,u,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?Zg(r,a,s,u,e,t):Kg(r,a,s,u,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Wg(r,a,o,s,u,e);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return Jg(r,a,s,u,e)}throw gt(r,a,Gg(o))}var c=t.line,l=1+a-t.lineStart;return new Ie(k.EOF,i,i,c,l,e)}function Gg(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(wn(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(wn(t),".")}function Hg(t,e,r,n,i){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Ie(k.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function Wg(t,e,r,n,i,a){var o=t.body,s=r,u=e,c=!1;if(s===45&&(s=o.charCodeAt(++u)),s===48){if(s=o.charCodeAt(++u),s>=48&&s<=57)throw gt(t,u,"Invalid number, unexpected digit after 0: ".concat(wn(s),"."))}else u=hu(t,u,s),s=o.charCodeAt(u);if(s===46&&(c=!0,s=o.charCodeAt(++u),u=hu(t,u,s),s=o.charCodeAt(u)),(s===69||s===101)&&(c=!0,s=o.charCodeAt(++u),(s===43||s===45)&&(s=o.charCodeAt(++u)),u=hu(t,u,s),s=o.charCodeAt(u)),s===46||Xg(s))throw gt(t,u,"Invalid number, expected digit but got: ".concat(wn(s),"."));return new Ie(c?k.FLOAT:k.INT,e,u,n,i,a,o.slice(e,u))}function hu(t,e,r){var n=t.body,i=e,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw gt(t,i,"Invalid number, expected digit but got: ".concat(wn(a),"."))}function Kg(t,e,r,n,i){for(var a=t.body,o=e+1,s=o,u=0,c="";o<a.length&&!isNaN(u=a.charCodeAt(o))&&u!==10&&u!==13;){if(u===34)return c+=a.slice(s,o),new Ie(k.STRING,e,o+1,r,n,i,c);if(u<32&&u!==9)throw gt(t,o,"Invalid character within String: ".concat(wn(u),"."));if(++o,u===92){switch(c+=a.slice(s,o-1),u=a.charCodeAt(o),u){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
|
|
61
61
|
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var l=Yg(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw gt(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}c+=String.fromCharCode(l),o+=4;break}default:throw gt(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++o,s=o}}throw gt(t,o,"Unterminated string.")}function Zg(t,e,r,n,i,a){for(var o=t.body,s=e+3,u=s,c=0,l="";s<o.length&&!isNaN(c=o.charCodeAt(s));){if(c===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(u,s),new Ie(k.BLOCK_STRING,e,s+3,r,n,i,qg(l));if(c<32&&c!==9&&c!==10&&c!==13)throw gt(t,s,"Invalid character within String: ".concat(wn(c),"."));c===10?(++s,++a.line,a.lineStart=s):c===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):c===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(u,s)+'"""',s+=4,u=s):++s}throw gt(t,s,"Unterminated string.")}function Yg(t,e,r,n){return Ro(t)<<12|Ro(e)<<8|Ro(r)<<4|Ro(n)}function Ro(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function Jg(t,e,r,n,i){for(var a=t.body,o=a.length,s=e+1,u=0;s!==o&&!isNaN(u=a.charCodeAt(s))&&(u===95||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++s;return new Ie(k.NAME,e,s,r,n,i,a.slice(e,s))}function Xg(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function ey(t,e){var r=new ty(t,e);return r.parseDocument()}var ty=function(){function t(r,n){var i=Ug(r)?r:new mh(r);this._lexer=new Vg(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(k.NAME);return{kind:U.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:U.DOCUMENT,definitions:this.many(k.SOF,this.parseDefinition,k.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(k.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(k.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(k.BRACE_L))return{kind:U.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(k.NAME)&&(a=this.parseName()),{kind:U.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(k.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(k.PAREN_L,this.parseVariableDefinition,k.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:U.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(k.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(k.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(k.DOLLAR),{kind:U.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:U.SELECTION_SET,selections:this.many(k.BRACE_L,this.parseSelection,k.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(k.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(k.COLON)?(a=i,o=this.parseName()):o=i,{kind:U.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(k.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(k.PAREN_L,i,k.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(k.COLON),{kind:U.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:U.ARGUMENT,name:this.parseName(),value:(this.expectToken(k.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(k.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(k.NAME)?{kind:U.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:U.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:U.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:U.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case k.BRACKET_L:return this.parseList(n);case k.BRACE_L:return this.parseObject(n);case k.INT:return this._lexer.advance(),{kind:U.INT,value:i.value,loc:this.loc(i)};case k.FLOAT:return this._lexer.advance(),{kind:U.FLOAT,value:i.value,loc:this.loc(i)};case k.STRING:case k.BLOCK_STRING:return this.parseStringLiteral();case k.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:U.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:U.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:U.NULL,loc:this.loc(i)};default:return{kind:U.ENUM,value:i.value,loc:this.loc(i)}}case k.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:U.STRING,value:n.value,block:n.kind===k.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:U.LIST,values:this.any(k.BRACKET_L,o,k.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:U.OBJECT,fields:this.any(k.BRACE_L,o,k.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(k.COLON),{kind:U.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(k.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(k.AT),{kind:U.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(k.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(k.BRACKET_R),i={kind:U.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(k.BANG)?{kind:U.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:U.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===k.NAME)switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(n)},e.peekDescription=function(){return this.peek(k.STRING)||this.peek(k.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(k.BRACE_L,this.parseOperationTypeDefinition,k.BRACE_R);return{kind:U.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(k.COLON);var a=this.parseNamedType();return{kind:U.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:U.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:U.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(k.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(k.AMP)||this.peek(k.NAME));return i}return this.delimitedMany(k.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(k.BRACE_L)&&this._lexer.lookahead().kind===k.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(k.BRACE_L,this.parseFieldDefinition,k.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(k.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:U.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:u,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(k.PAREN_L,this.parseInputValueDef,k.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(k.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(k.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:U.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:u,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:U.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:U.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(k.EQUALS)?this.delimitedMany(k.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:U.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(k.BRACE_L,this.parseEnumValueDefinition,k.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:U.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:U.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(k.BRACE_L,this.parseInputValueDef,k.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===k.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(k.BRACE_L,this.parseOperationTypeDefinition,k.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:U.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:U.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:U.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:U.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:U.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:U.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:U.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(k.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:U.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(k.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(jg[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new dh(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw gt(this._lexer.source,i.start,"Expected ".concat(gh(n),", found ").concat(mu(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===k.NAME&&i.value===n)this._lexer.advance();else throw gt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(mu(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===k.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return gt(this._lexer.source,i.start,"Unexpected ".concat(mu(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},t}();function mu(t){var e=t.value;return gh(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function gh(t){return zg(t)?'"'.concat(t,'"'):t}var Zo=new Map,$u=new Map,yh=!0,ss=!1;function vh(t){return t.replace(/[\s,]+/g," ").trim()}function ry(t){return vh(t.source.body.substring(t.start,t.end))}function ny(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=ry(n.loc),o=$u.get(i);o&&!o.has(a)?yh&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
62
62
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
63
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||$u.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),os(os({},t),{definitions:r})}function iy(t){var e=new Set(t.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function ay(t){var e=vh(t);if(!Zo.has(e)){var r=ey(t,{experimentalFragmentVariables:ss,allowLegacyFragmentVariables:ss});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");Zo.set(e,iy(ny(r)))}return Zo.get(e)}function C(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),ay(n)}function oy(){Zo.clear(),$u.clear()}function sy(){yh=!1}function cy(){ss=!0}function uy(){ss=!1}var Yi={gql:C,resetCaches:oy,disableFragmentWarnings:sy,enableExperimentalFragmentVariables:cy,disableExperimentalFragmentVariables:uy};(function(t){t.gql=Yi.gql,t.resetCaches=Yi.resetCaches,t.disableFragmentWarnings=Yi.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Yi.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Yi.disableExperimentalFragmentVariables})(C||(C={}));C.default=C;function T(t){if(!t)throw"Got no result from Apollo";if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function ly(){}function al(){return ly}var w=al,He=al,Z=al,bh=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},_h=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Sn=class{constructor(e){this.code=e}};bh([w(),_h("design:type",String)],Sn.prototype,"code",void 0);Sn=bh([Z(),_h("design:paramtypes",[String])],Sn);var ol=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},sl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ht=class{constructor(e,r){this.address=e,this.name=r}};ol([w(),sl("design:type",String)],Ht.prototype,"address",void 0);ol([w(),sl("design:type",String)],Ht.prototype,"name",void 0);Ht=ol([Z(),sl("design:paramtypes",[String,String])],Ht);var Se=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},$e=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},$r=class{constructor(e,r){this.key=r,this.signature=e}};Se([w(),$e("design:type",String)],$r.prototype,"signature",void 0);Se([w(),$e("design:type",String)],$r.prototype,"key",void 0);Se([w(),$e("design:type",Boolean)],$r.prototype,"valid",void 0);Se([w(),$e("design:type",Boolean)],$r.prototype,"invalid",void 0);$r=Se([Z(),He(),$e("design:paramtypes",[String,String])],$r);var Cn=class{};Se([w(),$e("design:type",String)],Cn.prototype,"signature",void 0);Se([w(),$e("design:type",String)],Cn.prototype,"key",void 0);Se([w(),$e("design:type",Boolean)],Cn.prototype,"valid",void 0);Se([w(),$e("design:type",Boolean)],Cn.prototype,"invalid",void 0);Cn=Se([He()],Cn);function Vr(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Se([w(),$e("design:type",String)],e.prototype,"author",void 0),Se([w(),$e("design:type",String)],e.prototype,"timestamp",void 0),Se([w(),$e("design:type",Object)],e.prototype,"data",void 0),Se([w(),$e("design:type",$r)],e.prototype,"proof",void 0),e=Se([Z(),$e("design:paramtypes",[String,String,Object,$r])],e),e}function fy(t){let e=class{};return Se([w(),$e("design:type",String)],e.prototype,"author",void 0),Se([w(),$e("design:type",String)],e.prototype,"timestamp",void 0),Se([w(),$e("design:type",Object)],e.prototype,"data",void 0),Se([w(),$e("design:type",Cn)],e.prototype,"proof",void 0),e=Se([He()],e),e}var ad=class extends Vr(){};ad=Se([Z()],ad);var cs=class extends Vr(){};Se([w(),$e("design:type",Ht)],cs.prototype,"language",void 0);Se([w(),$e("design:type",Sn)],cs.prototype,"icon",void 0);cs=Se([Z()],cs);function d9(t){return t&&t.author&&t.timestamp&&t.data}var De=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},We=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},En=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};De([w(),We("design:type",String)],En.prototype,"source",void 0);De([w(),We("design:type",String)],En.prototype,"target",void 0);De([w(),We("design:type",String)],En.prototype,"predicate",void 0);En=De([Z(),We("design:paramtypes",[Object])],En);var us=class{};De([w(),We("design:type",Array)],us.prototype,"additions",void 0);De([w(),We("design:type",Array)],us.prototype,"removals",void 0);us=De([He()],us);var ls=class{constructor(e,r){this.additions=e,this.removals=r}};De([w(),We("design:type",Array)],ls.prototype,"additions",void 0);De([w(),We("design:type",Array)],ls.prototype,"removals",void 0);ls=De([Z(),We("design:paramtypes",[Array,Array])],ls);var Ca=class{};De([w(),We("design:type",String)],Ca.prototype,"source",void 0);De([w(),We("design:type",String)],Ca.prototype,"target",void 0);De([w(),We("design:type",String)],Ca.prototype,"predicate",void 0);Ca=De([He()],Ca);var xn=class extends Vr(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};De([w(),We("design:type",String)],xn.prototype,"status",void 0);xn=De([Z()],xn);var Fu=class extends fy(){};De([w(),We("design:type",String)],Fu.prototype,"status",void 0);Fu=De([He()],Fu);function _9(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function w9(t){return t&&t.source&&t.target}var fs=class{constructor(e,r){this.oldLink=e,this.newLink=r}};De([w(),We("design:type",xn)],fs.prototype,"oldLink",void 0);De([w(),We("design:type",xn)],fs.prototype,"newLink",void 0);fs=De([Z(),We("design:paramtypes",[xn,xn])],fs);var Dn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},La=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Mu,Fr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};Dn([w(),La("design:type",Array)],Fr.prototype,"links",void 0);Fr=Dn([Z(),La("design:paramtypes",[Array])],Fr);var Uu=class{};Dn([w(),La("design:type",Array)],Uu.prototype,"links",void 0);Uu=Dn([He()],Uu);var ju=Mu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new Mu;return r.links.push(e),r}};Dn([w(),La("design:type",Array)],ju.prototype,"links",void 0);ju=Mu=Dn([He(),La("design:paramtypes",[Array])],ju);var qu=class extends Vr(){};qu=Dn([Z()],qu);var F=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},M=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Dr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new Fr}};F([w(),M("design:type",String)],Dr.prototype,"did",void 0);F([w(),M("design:type",Fr)],Dr.prototype,"perspective",void 0);F([w(),M("design:type",String)],Dr.prototype,"directMessageLanguage",void 0);Dr=F([Z(),M("design:paramtypes",[String,Fr])],Dr);var od=class extends Vr(){};od=F([Z()],od);var Mr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],Mr.prototype,"did",void 0);F([w(),M("design:type",String)],Mr.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],Mr.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],Mr.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],Mr.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],Mr.prototype,"didSignedByDeviceKey",void 0);Mr=F([Z(),M("design:paramtypes",[String,String,String,String,String,String])],Mr);var Ur=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],Ur.prototype,"did",void 0);F([w(),M("design:type",String)],Ur.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],Ur.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],Ur.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],Ur.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],Ur.prototype,"didSignedByDeviceKey",void 0);Ur=F([He(),M("design:paramtypes",[String,String,String,String,String,String])],Ur);var ps=class{constructor(e,r){this.signature=e,this.publicKey=r}};F([w(),M("design:type",String)],ps.prototype,"signature",void 0);F([w(),M("design:type",String)],ps.prototype,"publicKey",void 0);ps=F([Z(),M("design:paramtypes",[String,String])],ps);var pi=class{constructor(e,r){this.domain=e,this.pointers=r}};F([w(),M("design:type",String)],pi.prototype,"domain",void 0);F([w(),M("design:type",Array)],pi.prototype,"pointers",void 0);pi=F([Z(),M("design:paramtypes",[String,Array])],pi);var ds=class{constructor(e,r){this.with=e,this.can=r}};F([w(),M("design:type",pi)],ds.prototype,"with",void 0);F([w(),M("design:type",Array)],ds.prototype,"can",void 0);ds=F([Z(),M("design:paramtypes",[pi,Array])],ds);var lr=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};F([w(),M("design:type",String)],lr.prototype,"appName",void 0);F([w(),M("design:type",String)],lr.prototype,"appDesc",void 0);F([w(),M("design:type",String)],lr.prototype,"appUrl",void 0);F([w(),M("design:type",String)],lr.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],lr.prototype,"capabilities",void 0);lr=F([Z(),M("design:paramtypes",[String,String,String,Array,String])],lr);var di=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};F([w(),M("design:type",String)],di.prototype,"requestId",void 0);F([w(),M("design:type",String)],di.prototype,"token",void 0);F([w(),M("design:type",Boolean)],di.prototype,"revoked",void 0);F([w(),M("design:type",lr)],di.prototype,"auth",void 0);di=F([Z(),M("design:paramtypes",[String,lr,String,Boolean])],di);var hi=class{constructor(e,r){this.domain=e,this.pointers=r}};F([w(),M("design:type",String)],hi.prototype,"domain",void 0);F([w(),M("design:type",Array)],hi.prototype,"pointers",void 0);hi=F([He(),M("design:paramtypes",[String,Array])],hi);var hs=class{constructor(e,r){this.with=e,this.can=r}};F([w(),M("design:type",hi)],hs.prototype,"with",void 0);F([w(),M("design:type",Array)],hs.prototype,"can",void 0);hs=F([He(),M("design:paramtypes",[hi,Array])],hs);var jr=class{constructor(e,r,n,i,a,o){this.appName=e,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};F([w(),M("design:type",String)],jr.prototype,"appName",void 0);F([w(),M("design:type",String)],jr.prototype,"appDesc",void 0);F([w(),M("design:type",String)],jr.prototype,"appDomain",void 0);F([w(),M("design:type",String)],jr.prototype,"appUrl",void 0);F([w(),M("design:type",String)],jr.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],jr.prototype,"capabilities",void 0);jr=F([He(),M("design:paramtypes",[String,String,String,String,String,Array])],jr);var vi=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},bi=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Et=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};vi([w(),bi("design:type",Boolean)],Et.prototype,"isInitialized",void 0);vi([w(),bi("design:type",Boolean)],Et.prototype,"isUnlocked",void 0);vi([w(),bi("design:type",String)],Et.prototype,"did",void 0);vi([w(),bi("design:type",String)],Et.prototype,"didDocument",void 0);vi([w(),bi("design:type",String)],Et.prototype,"error",void 0);Et=vi([Z(),bi("design:paramtypes",[Object])],Et);var sd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ae=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},st,ct,Bu=class{constructor(e,r){st.set(this,void 0),ct.set(this,void 0),sd(this,st,e,"f"),sd(this,ct,r,"f")}async otherAgents(){return await Ae(this,st,"f").otherAgents(Ae(this,ct,"f"))}async hasTelepresenceAdapter(){return await Ae(this,st,"f").hasTelepresenceAdapter(Ae(this,ct,"f"))}async onlineAgents(){return await Ae(this,st,"f").onlineAgents(Ae(this,ct,"f"))}async setOnlineStatus(e){return await Ae(this,st,"f").setOnlineStatus(Ae(this,ct,"f"),e)}async setOnlineStatusU(e){return await Ae(this,st,"f").setOnlineStatusU(Ae(this,ct,"f"),e)}async sendSignal(e,r){return await Ae(this,st,"f").sendSignal(Ae(this,ct,"f"),e,r)}async sendSignalU(e,r){return await Ae(this,st,"f").sendSignalU(Ae(this,ct,"f"),e,r)}async sendBroadcast(e,r=!1){return await Ae(this,st,"f").sendBroadcast(Ae(this,ct,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Ae(this,st,"f").sendBroadcastU(Ae(this,ct,"f"),e,r)}async addSignalHandler(e){await Ae(this,st,"f").addSignalHandler(Ae(this,ct,"f"),e)}removeSignalHandler(e){Ae(this,st,"f").removeSignalHandler(Ae(this,ct,"f"),e)}};st=new WeakMap,ct=new WeakMap;var Nn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Rn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},vt=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};Nn([w(),Rn("design:type",String)],vt.prototype,"source",void 0);Nn([w(),Rn("design:type",String)],vt.prototype,"target",void 0);Nn([w(),Rn("design:type",String)],vt.prototype,"predicate",void 0);Nn([w(),Rn("design:type",Date)],vt.prototype,"fromDate",void 0);Nn([w(),Rn("design:type",Date)],vt.prototype,"untilDate",void 0);Nn([w(),Rn("design:type",Number)],vt.prototype,"limit",void 0);vt=Nn([Z(),He(),Rn("design:paramtypes",[Object])],vt);var cd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ot=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Nt,ar;function gu(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Lt=class{constructor(){Nt.set(this,void 0),ar.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new Lt;return cd(r,ar,e,"f"),r}static from(e){let r=new Lt;return cd(r,Nt,e,"f"),r}toUrl(){if(ot(this,ar,"f")&&!ot(this,Nt,"f"))return ot(this,ar,"f");if(!ot(this,ar,"f")&&!ot(this,Nt,"f"))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof ot(this,Nt,"f")){case"string":e=`string:${gu(ot(this,Nt,"f"))}`;break;case"number":e=`number:${gu(ot(this,Nt,"f"))}`;break;case"object":e=`json:${gu(JSON.stringify(ot(this,Nt,"f")))}`;break}return`literal://${e}`}get(){if(ot(this,Nt,"f"))return ot(this,Nt,"f");if(!ot(this,ar,"f"))throw new Error("Can't render empty Literal");if(!ot(this,ar,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=ot(this,ar,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};Nt=new WeakMap,ar=new WeakMap;function Nr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function wh(t){return`set${Nr(t)}`}function ur(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function cl(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function py(t){return`add${Nr(cl(t))}`}function dy(t){let e=t.substring(3),r=ur(e);return r.charAt(0).toLowerCase()+r.slice(1)}function hy(t){return`remove${Nr(cl(t))}`}function my(t){let e=t.substring(6),r=ur(e);return r.charAt(0).toLowerCase()+r.slice(1)}function gy(t){let e=t.substring(13),r=ur(e);return r.charAt(0).toLowerCase()+r.slice(1)}function yy(t){return`setCollection${Nr(cl(t))}`}function ln(t){if(Array.isArray(t))return`[${t.map(ln).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var yu=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},z=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Je,Xe,Ee,ms=class{constructor(t,e,r){Je.set(this,void 0),Xe.set(this,void 0),Ee.set(this,void 0),yu(this,Je,e,"f"),yu(this,Xe,r,"f"),yu(this,Ee,t,"f")}get baseExpression(){return z(this,Je,"f")}async init(){let isInstance=await z(this,Ee,"f").isSubjectInstance(z(this,Je,"f"),z(this,Xe,"f"));if(!isInstance)throw`Not a valid subject instance of ${z(this,Xe,"f")} for ${z(this,Je,"f")}`;let results=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_getter(C, "${z(this,Je,"f")}", "${t}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(e)try{if(n){let i=await z(this,Ee,"f").getExpression(n);try{return JSON.parse(i.data)}catch{return i.data}}else return n}catch{return n}else return n}else return r||void 0}})}let setters=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[wh(property)]=async t=>{resolveLanguage&&(t=await z(this,Ee,"f").createExpression(t,resolveLanguage)),await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}let results2=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(t=>t.Collection);for(let t of collections)Object.defineProperty(this,t,{configurable:!0,get:async()=>{let e=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_getter(C, "${z(this,Je,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[py(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:e}]))):await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}let removers=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[hy(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:e}]))):await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}let collectionSetters=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[yy(collection)]=async t=>{Array.isArray(t)?await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),t.map(e=>({name:"value",value:e}))):await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}}};Je=new WeakMap,Xe=new WeakMap,Ee=new WeakMap;var ni=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},$=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},le,me,fn,pn,dn,ta,li=class{constructor(t,e){le.set(this,void 0),me.set(this,void 0),fn.set(this,void 0),pn.set(this,void 0),dn.set(this,void 0),ta.set(this,void 0),ni(this,fn,[],"f"),ni(this,pn,[],"f"),ni(this,dn,[],"f"),ni(this,ta,[],"f"),ni(this,le,t,"f"),ni(this,me,e,"f"),this.uuid=$(this,le,"f").uuid,this.name=$(this,le,"f").name,this.sharedUrl=$(this,le,"f").sharedUrl,this.neighbourhood=$(this,le,"f").neighbourhood,this.state=$(this,le,"f").state,$(this,me,"f").addPerspectiveLinkAddedListener($(this,le,"f").uuid,$(this,fn,"f")),$(this,me,"f").addPerspectiveLinkRemovedListener($(this,le,"f").uuid,$(this,pn,"f")),$(this,me,"f").addPerspectiveLinkUpdatedListener($(this,le,"f").uuid,$(this,dn,"f")),$(this,me,"f").addPerspectiveSyncStateChangeListener($(this,le,"f").uuid,$(this,ta,"f"))}async executeAction(t,e,r){return await $(this,me,"f").executeCommands($(this,le,"f").uuid,JSON.stringify(t),e,JSON.stringify(r))}async get(t){return await $(this,me,"f").queryLinks($(this,le,"f").uuid,t)}async infer(t){return await $(this,me,"f").queryProlog($(this,le,"f").uuid,t)}async add(t,e="shared"){return await $(this,me,"f").addLink($(this,le,"f").uuid,t,e)}async addLinks(t,e="shared"){return await $(this,me,"f").addLinks($(this,le,"f").uuid,t,e)}async removeLinks(t){return await $(this,me,"f").removeLinks($(this,le,"f").uuid,t)}async linkMutations(t,e="shared"){return await $(this,me,"f").linkMutations($(this,le,"f").uuid,t,e)}async addLinkExpression(t,e="shared"){return await $(this,me,"f").addLinkExpression($(this,le,"f").uuid,t,e)}async update(t,e){return await $(this,me,"f").updateLink($(this,le,"f").uuid,t,e)}async remove(t){return await $(this,me,"f").removeLink($(this,le,"f").uuid,t)}async getExpression(t){return await $(this,me,"f").getExpression(t)}async createExpression(t,e){return await $(this,me,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?$(this,fn,"f").push(e):t==="link-removed"?$(this,pn,"f").push(e):t==="link-updated"&&$(this,dn,"f").push(e)}async addSyncStateChangeListener(t){$(this,ta,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=$(this,fn,"f").indexOf(e);$(this,fn,"f").splice(r,1)}else if(t==="link-removed"){let r=$(this,pn,"f").indexOf(e);$(this,pn,"f").splice(r,1)}else if(t==="link-updated"){let r=$(this,dn,"f").indexOf(e);$(this,dn,"f").splice(r,1)}}async snapshot(){return $(this,me,"f").snapshotByUUID($(this,le,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t,e="shared"){let r=new vt({source:t.source,predicate:t.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[t];await this.linkMutations({additions:a,removals:i},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(n=>n.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){return(await this.get(new vt({predicate:"ad4m://sdna"}))).map(e=>e.data.target).map(e=>Lt.fromUrl(e).get())}async addSdna(t,e,r){return $(this,me,"f").addSdna($(this,le,"f").uuid,t,e,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClass(t){if(typeof t=="string")return t;{let e=await this.subjectClassesByTemplate(t);return e[0]?e[0]:t.className}}async createSubject(t,e){let r;if(typeof t=="string")r=t,await $(this,me,"f").createSubject($(this,le,"f").uuid,JSON.stringify({className:r}),e);else{let n=this.buildQueryFromTemplate(t);await $(this,me,"f").createSubject($(this,le,"f").uuid,JSON.stringify({query:n}),e)}return this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await $(this,me,"f").getSubjectData($(this,le,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await $(this,me,"f").getSubjectData($(this,le,"f").uuid,JSON.stringify({query:r}),e))}async removeSubject(subjectClass,exprAddr){let className=await this.stringOrTemplateObjectToSubjectClass(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No constructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0)}async isSubjectInstance(t,e){let r=await this.stringOrTemplateObjectToSubjectClass(e),n=!1,i=5,a=0;for(;a<i&&!n;)n=await this.infer(`subject_class("${r}", C), instance(C, "${t}")`),a++;return n}async getSubjectProxy(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${JSON.stringify(e)}`;let r=await this.stringOrTemplateObjectToSubjectClass(e),n=new ms(this,t,r);return await n.init(),n}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.infer(`subject_class("${n}", C), instance(C, X)`),a=await Promise.all(i.map(async o=>await this.getSubjectProxy(o.X,n)));r=r.concat(a)}return r}async getAllSubjectProxies(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e)r=await this.infer(`subject_class("${n}", C), instance(C, X)`);return r}buildQueryFromTemplate(t){let e;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>!i.includes(l)):i.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let u=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));u=u.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let l of n)c+=`, property(C, "${l}")`;for(let l of i)c+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),c+=`, property_setter(C, "${d}", _)`}for(let l of o)c+=`, collection_adder(C, "${dy(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${my(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${gy(l)}", _)`;c+=".",e=c}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:n}=t.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return $(this,me,"f").getNeighbourhoodProxy($(this,le,"f").uuid)}get ai(){return $(this,me,"f").aiClient}};le=new WeakMap,me=new WeakMap,fn=new WeakMap,pn=new WeakMap,dn=new WeakMap,ta=new WeakMap;var kr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},G=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},se,ra,na,ia,Yo,aa,Jo,Xo,ht=`
|
|
63
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||$u.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),os(os({},t),{definitions:r})}function iy(t){var e=new Set(t.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function ay(t){var e=vh(t);if(!Zo.has(e)){var r=ey(t,{experimentalFragmentVariables:ss,allowLegacyFragmentVariables:ss});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");Zo.set(e,iy(ny(r)))}return Zo.get(e)}function C(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),ay(n)}function oy(){Zo.clear(),$u.clear()}function sy(){yh=!1}function cy(){ss=!0}function uy(){ss=!1}var Yi={gql:C,resetCaches:oy,disableFragmentWarnings:sy,enableExperimentalFragmentVariables:cy,disableExperimentalFragmentVariables:uy};(function(t){t.gql=Yi.gql,t.resetCaches=Yi.resetCaches,t.disableFragmentWarnings=Yi.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Yi.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Yi.disableExperimentalFragmentVariables})(C||(C={}));C.default=C;function T(t){if(!t)throw"Got no result from Apollo";if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function ly(){}function al(){return ly}var w=al,He=al,Z=al,bh=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},_h=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Sn=class{constructor(e){this.code=e}};bh([w(),_h("design:type",String)],Sn.prototype,"code",void 0);Sn=bh([Z(),_h("design:paramtypes",[String])],Sn);var ol=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},sl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ht=class{constructor(e,r){this.address=e,this.name=r}};ol([w(),sl("design:type",String)],Ht.prototype,"address",void 0);ol([w(),sl("design:type",String)],Ht.prototype,"name",void 0);Ht=ol([Z(),sl("design:paramtypes",[String,String])],Ht);var Se=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},$e=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},$r=class{constructor(e,r){this.key=r,this.signature=e}};Se([w(),$e("design:type",String)],$r.prototype,"signature",void 0);Se([w(),$e("design:type",String)],$r.prototype,"key",void 0);Se([w(),$e("design:type",Boolean)],$r.prototype,"valid",void 0);Se([w(),$e("design:type",Boolean)],$r.prototype,"invalid",void 0);$r=Se([Z(),He(),$e("design:paramtypes",[String,String])],$r);var Cn=class{};Se([w(),$e("design:type",String)],Cn.prototype,"signature",void 0);Se([w(),$e("design:type",String)],Cn.prototype,"key",void 0);Se([w(),$e("design:type",Boolean)],Cn.prototype,"valid",void 0);Se([w(),$e("design:type",Boolean)],Cn.prototype,"invalid",void 0);Cn=Se([He()],Cn);function Vr(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Se([w(),$e("design:type",String)],e.prototype,"author",void 0),Se([w(),$e("design:type",String)],e.prototype,"timestamp",void 0),Se([w(),$e("design:type",Object)],e.prototype,"data",void 0),Se([w(),$e("design:type",$r)],e.prototype,"proof",void 0),e=Se([Z(),$e("design:paramtypes",[String,String,Object,$r])],e),e}function fy(t){let e=class{};return Se([w(),$e("design:type",String)],e.prototype,"author",void 0),Se([w(),$e("design:type",String)],e.prototype,"timestamp",void 0),Se([w(),$e("design:type",Object)],e.prototype,"data",void 0),Se([w(),$e("design:type",Cn)],e.prototype,"proof",void 0),e=Se([He()],e),e}var ad=class extends Vr(){};ad=Se([Z()],ad);var cs=class extends Vr(){};Se([w(),$e("design:type",Ht)],cs.prototype,"language",void 0);Se([w(),$e("design:type",Sn)],cs.prototype,"icon",void 0);cs=Se([Z()],cs);function d9(t){return t&&t.author&&t.timestamp&&t.data}var De=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},We=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},En=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};De([w(),We("design:type",String)],En.prototype,"source",void 0);De([w(),We("design:type",String)],En.prototype,"target",void 0);De([w(),We("design:type",String)],En.prototype,"predicate",void 0);En=De([Z(),We("design:paramtypes",[Object])],En);var us=class{};De([w(),We("design:type",Array)],us.prototype,"additions",void 0);De([w(),We("design:type",Array)],us.prototype,"removals",void 0);us=De([He()],us);var ls=class{constructor(e,r){this.additions=e,this.removals=r}};De([w(),We("design:type",Array)],ls.prototype,"additions",void 0);De([w(),We("design:type",Array)],ls.prototype,"removals",void 0);ls=De([Z(),We("design:paramtypes",[Array,Array])],ls);var Ca=class{};De([w(),We("design:type",String)],Ca.prototype,"source",void 0);De([w(),We("design:type",String)],Ca.prototype,"target",void 0);De([w(),We("design:type",String)],Ca.prototype,"predicate",void 0);Ca=De([He()],Ca);var xn=class extends Vr(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};De([w(),We("design:type",String)],xn.prototype,"status",void 0);xn=De([Z()],xn);var Fu=class extends fy(){};De([w(),We("design:type",String)],Fu.prototype,"status",void 0);Fu=De([He()],Fu);function _9(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function w9(t){return t&&t.source&&t.target}var fs=class{constructor(e,r){this.oldLink=e,this.newLink=r}};De([w(),We("design:type",xn)],fs.prototype,"oldLink",void 0);De([w(),We("design:type",xn)],fs.prototype,"newLink",void 0);fs=De([Z(),We("design:paramtypes",[xn,xn])],fs);var Dn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},La=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Mu,Fr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};Dn([w(),La("design:type",Array)],Fr.prototype,"links",void 0);Fr=Dn([Z(),La("design:paramtypes",[Array])],Fr);var Uu=class{};Dn([w(),La("design:type",Array)],Uu.prototype,"links",void 0);Uu=Dn([He()],Uu);var ju=Mu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new Mu;return r.links.push(e),r}};Dn([w(),La("design:type",Array)],ju.prototype,"links",void 0);ju=Mu=Dn([He(),La("design:paramtypes",[Array])],ju);var qu=class extends Vr(){};qu=Dn([Z()],qu);var F=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},M=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Dr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new Fr}};F([w(),M("design:type",String)],Dr.prototype,"did",void 0);F([w(),M("design:type",Fr)],Dr.prototype,"perspective",void 0);F([w(),M("design:type",String)],Dr.prototype,"directMessageLanguage",void 0);Dr=F([Z(),M("design:paramtypes",[String,Fr])],Dr);var od=class extends Vr(){};od=F([Z()],od);var Mr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],Mr.prototype,"did",void 0);F([w(),M("design:type",String)],Mr.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],Mr.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],Mr.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],Mr.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],Mr.prototype,"didSignedByDeviceKey",void 0);Mr=F([Z(),M("design:paramtypes",[String,String,String,String,String,String])],Mr);var Ur=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};F([w(),M("design:type",String)],Ur.prototype,"did",void 0);F([w(),M("design:type",String)],Ur.prototype,"didSigningKeyId",void 0);F([w(),M("design:type",String)],Ur.prototype,"deviceKeyType",void 0);F([w(),M("design:type",String)],Ur.prototype,"deviceKey",void 0);F([w(),M("design:type",String)],Ur.prototype,"deviceKeySignedByDid",void 0);F([w(),M("design:type",String)],Ur.prototype,"didSignedByDeviceKey",void 0);Ur=F([He(),M("design:paramtypes",[String,String,String,String,String,String])],Ur);var ps=class{constructor(e,r){this.signature=e,this.publicKey=r}};F([w(),M("design:type",String)],ps.prototype,"signature",void 0);F([w(),M("design:type",String)],ps.prototype,"publicKey",void 0);ps=F([Z(),M("design:paramtypes",[String,String])],ps);var pi=class{constructor(e,r){this.domain=e,this.pointers=r}};F([w(),M("design:type",String)],pi.prototype,"domain",void 0);F([w(),M("design:type",Array)],pi.prototype,"pointers",void 0);pi=F([Z(),M("design:paramtypes",[String,Array])],pi);var ds=class{constructor(e,r){this.with=e,this.can=r}};F([w(),M("design:type",pi)],ds.prototype,"with",void 0);F([w(),M("design:type",Array)],ds.prototype,"can",void 0);ds=F([Z(),M("design:paramtypes",[pi,Array])],ds);var lr=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};F([w(),M("design:type",String)],lr.prototype,"appName",void 0);F([w(),M("design:type",String)],lr.prototype,"appDesc",void 0);F([w(),M("design:type",String)],lr.prototype,"appUrl",void 0);F([w(),M("design:type",String)],lr.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],lr.prototype,"capabilities",void 0);lr=F([Z(),M("design:paramtypes",[String,String,String,Array,String])],lr);var di=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};F([w(),M("design:type",String)],di.prototype,"requestId",void 0);F([w(),M("design:type",String)],di.prototype,"token",void 0);F([w(),M("design:type",Boolean)],di.prototype,"revoked",void 0);F([w(),M("design:type",lr)],di.prototype,"auth",void 0);di=F([Z(),M("design:paramtypes",[String,lr,String,Boolean])],di);var hi=class{constructor(e,r){this.domain=e,this.pointers=r}};F([w(),M("design:type",String)],hi.prototype,"domain",void 0);F([w(),M("design:type",Array)],hi.prototype,"pointers",void 0);hi=F([He(),M("design:paramtypes",[String,Array])],hi);var hs=class{constructor(e,r){this.with=e,this.can=r}};F([w(),M("design:type",hi)],hs.prototype,"with",void 0);F([w(),M("design:type",Array)],hs.prototype,"can",void 0);hs=F([He(),M("design:paramtypes",[hi,Array])],hs);var jr=class{constructor(e,r,n,i,a,o){this.appName=e,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};F([w(),M("design:type",String)],jr.prototype,"appName",void 0);F([w(),M("design:type",String)],jr.prototype,"appDesc",void 0);F([w(),M("design:type",String)],jr.prototype,"appDomain",void 0);F([w(),M("design:type",String)],jr.prototype,"appUrl",void 0);F([w(),M("design:type",String)],jr.prototype,"appIconPath",void 0);F([w(),M("design:type",Array)],jr.prototype,"capabilities",void 0);jr=F([He(),M("design:paramtypes",[String,String,String,String,String,Array])],jr);var vi=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},bi=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Et=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};vi([w(),bi("design:type",Boolean)],Et.prototype,"isInitialized",void 0);vi([w(),bi("design:type",Boolean)],Et.prototype,"isUnlocked",void 0);vi([w(),bi("design:type",String)],Et.prototype,"did",void 0);vi([w(),bi("design:type",String)],Et.prototype,"didDocument",void 0);vi([w(),bi("design:type",String)],Et.prototype,"error",void 0);Et=vi([Z(),bi("design:paramtypes",[Object])],Et);var sd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ae=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},st,ct,Bu=class{constructor(e,r){st.set(this,void 0),ct.set(this,void 0),sd(this,st,e,"f"),sd(this,ct,r,"f")}async otherAgents(){return await Ae(this,st,"f").otherAgents(Ae(this,ct,"f"))}async hasTelepresenceAdapter(){return await Ae(this,st,"f").hasTelepresenceAdapter(Ae(this,ct,"f"))}async onlineAgents(){return await Ae(this,st,"f").onlineAgents(Ae(this,ct,"f"))}async setOnlineStatus(e){return await Ae(this,st,"f").setOnlineStatus(Ae(this,ct,"f"),e)}async setOnlineStatusU(e){return await Ae(this,st,"f").setOnlineStatusU(Ae(this,ct,"f"),e)}async sendSignal(e,r){return await Ae(this,st,"f").sendSignal(Ae(this,ct,"f"),e,r)}async sendSignalU(e,r){return await Ae(this,st,"f").sendSignalU(Ae(this,ct,"f"),e,r)}async sendBroadcast(e){return await Ae(this,st,"f").sendBroadcast(Ae(this,ct,"f"),e)}async sendBroadcastU(e){return await Ae(this,st,"f").sendBroadcastU(Ae(this,ct,"f"),e)}async addSignalHandler(e){await Ae(this,st,"f").addSignalHandler(Ae(this,ct,"f"),e)}removeSignalHandler(e){Ae(this,st,"f").removeSignalHandler(Ae(this,ct,"f"),e)}};st=new WeakMap,ct=new WeakMap;var Nn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Rn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},vt=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};Nn([w(),Rn("design:type",String)],vt.prototype,"source",void 0);Nn([w(),Rn("design:type",String)],vt.prototype,"target",void 0);Nn([w(),Rn("design:type",String)],vt.prototype,"predicate",void 0);Nn([w(),Rn("design:type",Date)],vt.prototype,"fromDate",void 0);Nn([w(),Rn("design:type",Date)],vt.prototype,"untilDate",void 0);Nn([w(),Rn("design:type",Number)],vt.prototype,"limit",void 0);vt=Nn([Z(),He(),Rn("design:paramtypes",[Object])],vt);var cd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ot=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Nt,ar;function gu(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Lt=class{constructor(){Nt.set(this,void 0),ar.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new Lt;return cd(r,ar,e,"f"),r}static from(e){let r=new Lt;return cd(r,Nt,e,"f"),r}toUrl(){if(ot(this,ar,"f")&&!ot(this,Nt,"f"))return ot(this,ar,"f");if(!ot(this,ar,"f")&&!ot(this,Nt,"f"))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof ot(this,Nt,"f")){case"string":e=`string:${gu(ot(this,Nt,"f"))}`;break;case"number":e=`number:${gu(ot(this,Nt,"f"))}`;break;case"object":e=`json:${gu(JSON.stringify(ot(this,Nt,"f")))}`;break}return`literal://${e}`}get(){if(ot(this,Nt,"f"))return ot(this,Nt,"f");if(!ot(this,ar,"f"))throw new Error("Can't render empty Literal");if(!ot(this,ar,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=ot(this,ar,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};Nt=new WeakMap,ar=new WeakMap;function Nr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function wh(t){return`set${Nr(t)}`}function ur(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function cl(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function py(t){return`add${Nr(cl(t))}`}function dy(t){let e=t.substring(3),r=ur(e);return r.charAt(0).toLowerCase()+r.slice(1)}function hy(t){return`remove${Nr(cl(t))}`}function my(t){let e=t.substring(6),r=ur(e);return r.charAt(0).toLowerCase()+r.slice(1)}function gy(t){let e=t.substring(13),r=ur(e);return r.charAt(0).toLowerCase()+r.slice(1)}function yy(t){return`setCollection${Nr(cl(t))}`}function ln(t){if(Array.isArray(t))return`[${t.map(ln).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var yu=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},z=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Je,Xe,Ee,ms=class{constructor(t,e,r){Je.set(this,void 0),Xe.set(this,void 0),Ee.set(this,void 0),yu(this,Je,e,"f"),yu(this,Xe,r,"f"),yu(this,Ee,t,"f")}get baseExpression(){return z(this,Je,"f")}async init(){let isInstance=await z(this,Ee,"f").isSubjectInstance(z(this,Je,"f"),z(this,Xe,"f"));if(!isInstance)throw`Not a valid subject instance of ${z(this,Xe,"f")} for ${z(this,Je,"f")}`;let results=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_getter(C, "${z(this,Je,"f")}", "${t}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(e)try{if(n){let i=await z(this,Ee,"f").getExpression(n);try{return JSON.parse(i.data)}catch{return i.data}}else return n}catch{return n}else return n}else return r||void 0}})}let setters=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[wh(property)]=async t=>{resolveLanguage&&(t=await z(this,Ee,"f").createExpression(t,resolveLanguage)),await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}let results2=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(t=>t.Collection);for(let t of collections)Object.defineProperty(this,t,{configurable:!0,get:async()=>{let e=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_getter(C, "${z(this,Je,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[py(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:e}]))):await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}let removers=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[hy(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:e}]))):await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}let collectionSetters=await z(this,Ee,"f").infer(`subject_class("${z(this,Xe,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[yy(collection)]=async t=>{Array.isArray(t)?await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),t.map(e=>({name:"value",value:e}))):await z(this,Ee,"f").executeAction(actions,z(this,Je,"f"),[{name:"value",value:t}])}}}};Je=new WeakMap,Xe=new WeakMap,Ee=new WeakMap;var ni=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},$=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},le,me,fn,pn,dn,ta,li=class{constructor(t,e){le.set(this,void 0),me.set(this,void 0),fn.set(this,void 0),pn.set(this,void 0),dn.set(this,void 0),ta.set(this,void 0),ni(this,fn,[],"f"),ni(this,pn,[],"f"),ni(this,dn,[],"f"),ni(this,ta,[],"f"),ni(this,le,t,"f"),ni(this,me,e,"f"),this.uuid=$(this,le,"f").uuid,this.name=$(this,le,"f").name,this.sharedUrl=$(this,le,"f").sharedUrl,this.neighbourhood=$(this,le,"f").neighbourhood,this.state=$(this,le,"f").state,$(this,me,"f").addPerspectiveLinkAddedListener($(this,le,"f").uuid,$(this,fn,"f")),$(this,me,"f").addPerspectiveLinkRemovedListener($(this,le,"f").uuid,$(this,pn,"f")),$(this,me,"f").addPerspectiveLinkUpdatedListener($(this,le,"f").uuid,$(this,dn,"f")),$(this,me,"f").addPerspectiveSyncStateChangeListener($(this,le,"f").uuid,$(this,ta,"f"))}async executeAction(t,e,r){return await $(this,me,"f").executeCommands($(this,le,"f").uuid,JSON.stringify(t),e,JSON.stringify(r))}async get(t){return await $(this,me,"f").queryLinks($(this,le,"f").uuid,t)}async infer(t){return await $(this,me,"f").queryProlog($(this,le,"f").uuid,t)}async add(t,e="shared"){return await $(this,me,"f").addLink($(this,le,"f").uuid,t,e)}async addLinks(t,e="shared"){return await $(this,me,"f").addLinks($(this,le,"f").uuid,t,e)}async removeLinks(t){return await $(this,me,"f").removeLinks($(this,le,"f").uuid,t)}async linkMutations(t,e="shared"){return await $(this,me,"f").linkMutations($(this,le,"f").uuid,t,e)}async addLinkExpression(t,e="shared"){return await $(this,me,"f").addLinkExpression($(this,le,"f").uuid,t,e)}async update(t,e){return await $(this,me,"f").updateLink($(this,le,"f").uuid,t,e)}async remove(t){return await $(this,me,"f").removeLink($(this,le,"f").uuid,t)}async getExpression(t){return await $(this,me,"f").getExpression(t)}async createExpression(t,e){return await $(this,me,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?$(this,fn,"f").push(e):t==="link-removed"?$(this,pn,"f").push(e):t==="link-updated"&&$(this,dn,"f").push(e)}async addSyncStateChangeListener(t){$(this,ta,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=$(this,fn,"f").indexOf(e);$(this,fn,"f").splice(r,1)}else if(t==="link-removed"){let r=$(this,pn,"f").indexOf(e);$(this,pn,"f").splice(r,1)}else if(t==="link-updated"){let r=$(this,dn,"f").indexOf(e);$(this,dn,"f").splice(r,1)}}async snapshot(){return $(this,me,"f").snapshotByUUID($(this,le,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t,e="shared"){let r=new vt({source:t.source,predicate:t.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[t];await this.linkMutations({additions:a,removals:i},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(n=>n.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){return(await this.get(new vt({predicate:"ad4m://sdna"}))).map(e=>e.data.target).map(e=>Lt.fromUrl(e).get())}async addSdna(t,e,r){return $(this,me,"f").addSdna($(this,le,"f").uuid,t,e,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClass(t){if(typeof t=="string")return t;{let e=await this.subjectClassesByTemplate(t);return e[0]?e[0]:t.className}}async createSubject(t,e){let r;if(typeof t=="string")r=t,await $(this,me,"f").createSubject($(this,le,"f").uuid,JSON.stringify({className:r}),e);else{let n=this.buildQueryFromTemplate(t);await $(this,me,"f").createSubject($(this,le,"f").uuid,JSON.stringify({query:n}),e)}return this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await $(this,me,"f").getSubjectData($(this,le,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await $(this,me,"f").getSubjectData($(this,le,"f").uuid,JSON.stringify({query:r}),e))}async removeSubject(subjectClass,exprAddr){let className=await this.stringOrTemplateObjectToSubjectClass(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No constructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0)}async isSubjectInstance(t,e){let r=await this.stringOrTemplateObjectToSubjectClass(e),n=!1,i=5,a=0;for(;a<i&&!n;)n=await this.infer(`subject_class("${r}", C), instance(C, "${t}")`),a++;return n}async getSubjectProxy(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${JSON.stringify(e)}`;let r=await this.stringOrTemplateObjectToSubjectClass(e),n=new ms(this,t,r);return await n.init(),n}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.infer(`subject_class("${n}", C), instance(C, X)`),a=await Promise.all(i.map(async o=>await this.getSubjectProxy(o.X,n)));r=r.concat(a)}return r}async getAllSubjectProxies(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e)r=await this.infer(`subject_class("${n}", C), instance(C, X)`);return r}buildQueryFromTemplate(t){let e;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>!i.includes(l)):i.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let u=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));u=u.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let l of n)c+=`, property(C, "${l}")`;for(let l of i)c+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),c+=`, property_setter(C, "${d}", _)`}for(let l of o)c+=`, collection_adder(C, "${dy(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${my(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${gy(l)}", _)`;c+=".",e=c}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:n}=t.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return $(this,me,"f").getNeighbourhoodProxy($(this,le,"f").uuid)}get ai(){return $(this,me,"f").aiClient}};le=new WeakMap,me=new WeakMap,fn=new WeakMap,pn=new WeakMap,dn=new WeakMap,ta=new WeakMap;var kr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},G=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},se,ra,na,ia,Yo,aa,Jo,Xo,ht=`
|
|
64
64
|
author
|
|
65
65
|
timestamp
|
|
66
66
|
status
|
|
@@ -479,27 +479,23 @@ neighbourhood {
|
|
|
479
479
|
remoteAgentDid: $remoteAgentDid,
|
|
480
480
|
payload: $payload
|
|
481
481
|
)
|
|
482
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r
|
|
482
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r){let{neighbourhoodSendBroadcast:n}=T(await Qe(this,et,"f").mutate({mutation:C`mutation neighbourhoodSendBroadcast(
|
|
483
483
|
$perspectiveUUID: String!,
|
|
484
|
-
$payload: PerspectiveInput
|
|
485
|
-
$loopback: Boolean
|
|
484
|
+
$payload: PerspectiveInput!
|
|
486
485
|
) {
|
|
487
486
|
neighbourhoodSendBroadcast(
|
|
488
487
|
perspectiveUUID: $perspectiveUUID,
|
|
489
|
-
payload: $payload
|
|
490
|
-
loopback: $loopback
|
|
488
|
+
payload: $payload
|
|
491
489
|
)
|
|
492
|
-
}`,variables:{perspectiveUUID:e,payload:r
|
|
490
|
+
}`,variables:{perspectiveUUID:e,payload:r}}));return n}async sendBroadcastU(e,r){let{neighbourhoodSendBroadcastU:n}=T(await Qe(this,et,"f").mutate({mutation:C`mutation neighbourhoodSendBroadcastU(
|
|
493
491
|
$perspectiveUUID: String!,
|
|
494
|
-
$payload: PerspectiveUnsignedInput
|
|
495
|
-
$loopback: Boolean
|
|
492
|
+
$payload: PerspectiveUnsignedInput!
|
|
496
493
|
) {
|
|
497
494
|
neighbourhoodSendBroadcastU(
|
|
498
495
|
perspectiveUUID: $perspectiveUUID,
|
|
499
|
-
payload: $payload
|
|
500
|
-
loopback: $loopback
|
|
496
|
+
payload: $payload
|
|
501
497
|
)
|
|
502
|
-
}`,variables:{perspectiveUUID:e,payload:r
|
|
498
|
+
}`,variables:{perspectiveUUID:e,payload:r}}));return n}dispatchSignal(e,r){let n=Qe(this,hn,"f").get(e);n&&n.forEach(i=>i(r))}async subscribeToSignals(e){let r=this;await Qe(this,et,"f").subscribe({query:C`subscription neighbourhoodSignal($perspectiveUUID: String!) {
|
|
503
499
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
504
500
|
author
|
|
505
501
|
timestamp
|
|
@@ -797,13 +793,13 @@ triggerMatch
|
|
|
797
793
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
798
794
|
aiEmbed(modelId: $modelId, text: $text)
|
|
799
795
|
}
|
|
800
|
-
`,variables:{modelId:e,text:r}})),i=Is.toByteArray(n);return JSON.parse(A2.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r
|
|
801
|
-
mutation AiOpenTranscriptionStream($modelId: String
|
|
802
|
-
aiOpenTranscriptionStream(modelId: $modelId
|
|
796
|
+
`,variables:{modelId:e,text:r}})),i=Is.toByteArray(n);return JSON.parse(A2.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r){let{aiOpenTranscriptionStream:n}=T(await Fe(this,Le,"f").mutate({mutation:C`
|
|
797
|
+
mutation AiOpenTranscriptionStream($modelId: String!) {
|
|
798
|
+
aiOpenTranscriptionStream(modelId: $modelId)
|
|
803
799
|
}
|
|
804
|
-
`,variables:{modelId:e
|
|
805
|
-
aiTranscriptionText(streamId: "${
|
|
806
|
-
}`}).subscribe({next(
|
|
800
|
+
`,variables:{modelId:e}})),i=Fe(this,Le,"f").subscribe({query:C` subscription {
|
|
801
|
+
aiTranscriptionText(streamId: "${n}")
|
|
802
|
+
}`}).subscribe({next(a){return r(a.data.aiTranscriptionText),a.data.aiTranscriptionText},error(a){console.error(a)}});return Fe(this,ts,"f").set(n,i),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=T(await Fe(this,Le,"f").mutate({mutation:C`
|
|
807
803
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
808
804
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
809
805
|
}
|
|
@@ -1144,7 +1140,7 @@ type Mutation {
|
|
|
1144
1140
|
aiCloseTranscriptionStream(streamId: String!): String!
|
|
1145
1141
|
aiEmbed(modelId: String!, text: String!): String!
|
|
1146
1142
|
aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
|
|
1147
|
-
aiOpenTranscriptionStream(modelId: String
|
|
1143
|
+
aiOpenTranscriptionStream(modelId: String!): String!
|
|
1148
1144
|
aiPrompt(prompt: String!, taskId: String!): String!
|
|
1149
1145
|
aiRemoveModel(modelId: String!): Boolean!
|
|
1150
1146
|
aiRemoveTask(taskId: String!): AITask!
|
|
@@ -1160,8 +1156,8 @@ type Mutation {
|
|
|
1160
1156
|
languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
|
|
1161
1157
|
neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
|
|
1162
1158
|
neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
|
|
1163
|
-
neighbourhoodSendBroadcast(
|
|
1164
|
-
neighbourhoodSendBroadcastU(
|
|
1159
|
+
neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
|
|
1160
|
+
neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
|
|
1165
1161
|
neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
1166
1162
|
neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
1167
1163
|
neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
|
|
@@ -1359,15 +1355,7 @@ type TriggeredNotification {
|
|
|
1359
1355
|
perspectiveId: String!
|
|
1360
1356
|
triggerMatch: String!
|
|
1361
1357
|
}
|
|
1362
|
-
|
|
1363
|
-
input VoiceActivityParamsInput {
|
|
1364
|
-
endThreshold: Float
|
|
1365
|
-
endWindow: Float
|
|
1366
|
-
startThreshold: Float
|
|
1367
|
-
startWindow: Float
|
|
1368
|
-
timeBeforeSpeech: Float
|
|
1369
|
-
}
|
|
1370
|
-
`;function oh(t){return t?.length?t.length===1?t.toString():t.length===2?t.join(" and "):t.slice(0,-1).join(", ")+", and "+t.slice(-1):""}function cm(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,n=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${oh(e)} your ${r} actions, with access to ${oh(n)}`}var un=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Q=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},tt,Pt,as,we,sh=class{constructor(t,e,r){tt.set(this,void 0),Pt.set(this,void 0),as.set(this,void 0),we.set(this,void 0),un(this,tt,e||Lt.from(sm(24)).toUrl(),"f"),un(this,we,t,"f"),un(this,as,r||"ad4m://self","f")}get baseExpression(){return Q(this,tt,"f")}get perspective(){return Q(this,we,"f")}async getData(t){let e=t??Q(this,tt,"f"),r=await Q(this,we,"f").getSubjectData(Q(this,Pt,"f"),e);return Object.assign(this,r),un(this,tt,e,"f"),this}async setProperty(key,value){let setters=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await Q(this,we,"f").createExpression(value,resolveLanguage)),await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}])}}async setCollectionSetter(key,value){let collectionSetters=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), collection_setter(C, "${ur(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),value.map(t=>({name:"value",value:t}))):await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}]))}}async setCollectionAdder(key,value){let adders=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), collection_adder(C, "${ur(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(t=>Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value:t}]))):await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}]))}}async setCollectionRemover(key,value){let removers=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), collection_remover(C, "${ur(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(t=>Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value:t}]))):await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}]))}}async save(){un(this,Pt,await Q(this,we,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await Q(this,we,"f").createSubject(this,Q(this,tt,"f")),await Q(this,we,"f").add(new En({source:Q(this,as,"f"),predicate:"ad4m://has_child",target:this.baseExpression})),await this.update()}async update(){un(this,Pt,await Q(this,we,"f").stringOrTemplateObjectToSubjectClass(this),"f");let t=Object.entries(this);for(let[e,r]of t)if(r!=null)if(r?.action)switch(r.action){case"setter":await this.setCollectionSetter(e,r.value);break;case"adder":await this.setCollectionAdder(e,r.value);break;case"remover":await this.setCollectionRemover(e,r.value);default:await this.setCollectionSetter(e,r.value);break}else Array.isArray(r)&&r.length>0?await this.setCollectionSetter(e,r):r!=null&&r!==""&&await this.setProperty(e,r);await this.getData()}async get(){return un(this,Pt,await Q(this,we,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await this.getData()}async delete(){await Q(this,we,"f").removeSubject(this,Q(this,tt,"f"))}static async all(t){let e=await t.stringOrTemplateObjectToSubjectClass(this),r=await t.getAllSubjectProxies(e),n=[];if(r){for(let i of r){let a=new this(t,i.X);n.push(await a.get())}return n}return[]}static async query(t,e){let r=e?.source||"ad4m://self",n=await t.stringOrTemplateObjectToSubjectClass(this),i=[],a=`subject_class("${n}", C), instance(C, Base), link("${r}", Predicate, Base, Timestamp, Author)`;if(e){if(e.where)if(e.where.condition)a+=", "+e.where.condition;else{let s=Object.entries(e.where);for(let u of s){let c=u[0],l=u[1];a+=`, property_getter(C, Base, "${c}", "${l}")`}}try{if((await t.infer(`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), length(SortedData, DataLength).`))[0].DataLength>=e.size){let u=`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), reverse(SortedData, ReverseSortedData), paginate(ReverseSortedData, ${e.page}, ${e.size}, PageData).`;i=await t.infer(u),i=i[0].PageData.map(c=>({Base:c[1],Timestamp:c[0]}))}else i=await t.infer(a)}catch(s){console.log("Query failed",s)}}else i=await t.infer(a);return i?await Promise.all(i.map(async s=>await new this(t,s.Base).get())):[]}};tt=new WeakMap,Pt=new WeakMap,as=new WeakMap,we=new WeakMap;var Ls="0.10.1-rc9-dev5";var fr=12e3;function N2(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function $s(t,e=1e4){return pe(this,null,function*(){return Promise.race([new Promise((r,n)=>{try{t.includes("localhost")||r(new WebSocket(t));let i=new WebSocket(t);i.onopen=()=>{r(i)},i.onerror=a=>{n(a)}}catch(i){n(i)}}),new Promise((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}function bl(t){return pe(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:N2().signal,mode:"cors"});if(e.status===400||e.status===0||e.status===200)return t;throw new Error(`Could not connect to port ${t}`)}catch(e){throw new Error(`Could not connect to port ${t}`)}})}function R2(){return new Promise((t,e)=>{let r=document.querySelector("ad4m-connect"),n=r==null?void 0:r.getAd4mClient();n?t(n):e("No Ad4mClient found")})}function _l(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function Fs(t,e){_l()&&localStorage.setItem(`${Ls}/${t}`,e)}function Jt(t){return _l()?localStorage.getItem(`${Ls}/${t}`):null}function wl(t){_l()&&localStorage.removeItem(`${Ls}/${t}`)}var P2=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};function ja(t,{include:e,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):r?!r.some(a):!0};for(let[i,a]of P2(t.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var qa=class{constructor({appName:e,appDesc:r,appIconPath:n,appUrl:i,appDomain:a,capabilities:o,port:s,token:u,url:c,hosting:l}){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=fr;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};ja(this);this.appName=e,this.appDesc=r,this.appDomain=a,this.appUrl=i,this.appIconPath=n,this.capabilities=o,this.port=s||this.port,this.url=c||`ws://localhost:${this.port}/graphql`,this.token=u||this.token,this.isHosting=l||!1,this.buildClient()}notifyConfigChange(e,r){this.listeners.configstatechange.forEach(n=>{n(e,r)})}notifyConnectionChange(e){this.connectionState!==e&&(this.connectionState=e,this.listeners.connectionstatechange.forEach(r=>{r(e)}))}notifyAuthChange(e){this.authState!==e&&(this.authState=e,this.listeners.authstatechange.forEach(r=>{r(e)}))}setPort(e){this.port!==e&&(this.port=e,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",e))}setUrl(e){this.url!==e&&(this.url=e,this.notifyConfigChange("url",e))}setToken(e){this.token!==e&&(this.token=e,this.notifyConfigChange("token",e))}on(e,r){this.listeners[e].push(r)}connect(e){return pe(this,null,function*(){try{if(e){yield $s(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{this.notifyConnectionChange("checking_local");try{yield $s(`ws://localhost:${this.port}/graphql`,2e3);let r=this.buildClient();return yield this.checkAuth(),r}catch(r){let n=yield this.ensureConnection();return yield this.checkAuth(),n}}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}loginToHosting(e,r){return pe(this,null,function*(){try{let n=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})});if(n.status===200){let i=yield n.json();localStorage.setItem("hosting_token",i.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,Fs("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield n.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(n){throw console.log(n),new Error(`Error logging in ${n}`)}})}checkEmail(e){return pe(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(r){console.log(r)}})}connectToPort(e){return pe(this,null,function*(){try{if(e){let r=yield bl(e);return this.setPort(r),this.buildClient()}else if(this.url.includes("localhost")){let r=yield this.findPort();return this.setPort(r),this.buildClient()}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return pe(this,null,function*(){var r,n;if(((r=this.activeSocket)==null?void 0:r.readyState)===WebSocket.OPEN&&((n=this.activeSocket)==null?void 0:n.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield $s(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return pe(this,null,function*(){let e=[...Array(10).keys()].map((i,a)=>bl(fr+a)),n=(yield Promise.allSettled(e)).find(i=>i.status==="fulfilled");if(n)return n.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let e=new WebSocket(this.url)}catch(e){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=Yp({url:this.url,connectionParams:()=>pe(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:e=>{this.activeSocket=e},error:e=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:e=>pe(this,null,function*(){if(console.log("buildClient closed:",e),!e.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let r=yield this.connect();r?this.ad4mClient=r:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new fu({link:new Jp(this.wsClient),cache:new To({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new Ss(this.apolloClient),this.ad4mClient}checkAuth(){return pe(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(e){return e.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(e=!1){return pe(this,null,function*(){var r;if(e&&this.setToken(null),this.isHosting){let n=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+n}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(r=this.ad4mClient)==null?void 0:r.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(e){return pe(this,null,function*(){var r;try{let n=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,e);return this.setToken(n),yield this.buildClient(),yield this.checkAuth(),this.token}catch(n){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(fr),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function Sl({unlockAgent:t,reconnect:e}){return B`
|
|
1358
|
+
`;function oh(t){return t?.length?t.length===1?t.toString():t.length===2?t.join(" and "):t.slice(0,-1).join(", ")+", and "+t.slice(-1):""}function cm(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,n=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${oh(e)} your ${r} actions, with access to ${oh(n)}`}var un=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Q=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},tt,Pt,as,we,sh=class{constructor(t,e,r){tt.set(this,void 0),Pt.set(this,void 0),as.set(this,void 0),we.set(this,void 0),un(this,tt,e||Lt.from(sm(24)).toUrl(),"f"),un(this,we,t,"f"),un(this,as,r||"ad4m://self","f")}get baseExpression(){return Q(this,tt,"f")}get perspective(){return Q(this,we,"f")}async getData(t){let e=t??Q(this,tt,"f"),r=await Q(this,we,"f").getSubjectData(Q(this,Pt,"f"),e);return Object.assign(this,r),un(this,tt,e,"f"),this}async setProperty(key,value){let setters=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await Q(this,we,"f").createExpression(value,resolveLanguage)),await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}])}}async setCollectionSetter(key,value){let collectionSetters=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), collection_setter(C, "${ur(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),value.map(t=>({name:"value",value:t}))):await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}]))}}async setCollectionAdder(key,value){let adders=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), collection_adder(C, "${ur(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(t=>Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value:t}]))):await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}]))}}async setCollectionRemover(key,value){let removers=await Q(this,we,"f").infer(`subject_class("${Q(this,Pt,"f")}", C), collection_remover(C, "${ur(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(t=>Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value:t}]))):await Q(this,we,"f").executeAction(actions,Q(this,tt,"f"),[{name:"value",value}]))}}async save(){un(this,Pt,await Q(this,we,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await Q(this,we,"f").createSubject(this,Q(this,tt,"f")),await Q(this,we,"f").add(new En({source:Q(this,as,"f"),predicate:"ad4m://has_child",target:this.baseExpression})),await this.update()}async update(){un(this,Pt,await Q(this,we,"f").stringOrTemplateObjectToSubjectClass(this),"f");let t=Object.entries(this);for(let[e,r]of t)if(r!=null)if(r?.action)switch(r.action){case"setter":await this.setCollectionSetter(e,r.value);break;case"adder":await this.setCollectionAdder(e,r.value);break;case"remover":await this.setCollectionRemover(e,r.value);default:await this.setCollectionSetter(e,r.value);break}else Array.isArray(r)&&r.length>0?await this.setCollectionSetter(e,r):r!=null&&r!==""&&await this.setProperty(e,r);await this.getData()}async get(){return un(this,Pt,await Q(this,we,"f").stringOrTemplateObjectToSubjectClass(this),"f"),await this.getData()}async delete(){await Q(this,we,"f").removeSubject(this,Q(this,tt,"f"))}static async all(t){let e=await t.stringOrTemplateObjectToSubjectClass(this),r=await t.getAllSubjectProxies(e),n=[];if(r){for(let i of r){let a=new this(t,i.X);n.push(await a.get())}return n}return[]}static async query(t,e){let r=e?.source||"ad4m://self",n=await t.stringOrTemplateObjectToSubjectClass(this),i=[],a=`subject_class("${n}", C), instance(C, Base), link("${r}", Predicate, Base, Timestamp, Author)`;if(e){if(e.where)if(e.where.condition)a+=", "+e.where.condition;else{let s=Object.entries(e.where);for(let u of s){let c=u[0],l=u[1];a+=`, property_getter(C, Base, "${c}", "${l}")`}}try{if((await t.infer(`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), length(SortedData, DataLength).`))[0].DataLength>=e.size){let u=`findall([Timestamp, Base], (${a}), AllData), sort(AllData, SortedData), reverse(SortedData, ReverseSortedData), paginate(ReverseSortedData, ${e.page}, ${e.size}, PageData).`;i=await t.infer(u),i=i[0].PageData.map(c=>({Base:c[1],Timestamp:c[0]}))}else i=await t.infer(a)}catch(s){console.log("Query failed",s)}}else i=await t.infer(a);return i?await Promise.all(i.map(async s=>await new this(t,s.Base).get())):[]}};tt=new WeakMap,Pt=new WeakMap,as=new WeakMap,we=new WeakMap;var Ls="0.10.1-rc9-dev7";var fr=12e3;function N2(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function $s(t,e=1e4){return pe(this,null,function*(){return Promise.race([new Promise((r,n)=>{try{t.includes("localhost")||r(new WebSocket(t));let i=new WebSocket(t);i.onopen=()=>{r(i)},i.onerror=a=>{n(a)}}catch(i){n(i)}}),new Promise((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}function bl(t){return pe(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:N2().signal,mode:"cors"});if(e.status===400||e.status===0||e.status===200)return t;throw new Error(`Could not connect to port ${t}`)}catch(e){throw new Error(`Could not connect to port ${t}`)}})}function R2(){return new Promise((t,e)=>{let r=document.querySelector("ad4m-connect"),n=r==null?void 0:r.getAd4mClient();n?t(n):e("No Ad4mClient found")})}function _l(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function Fs(t,e){_l()&&localStorage.setItem(`${Ls}/${t}`,e)}function Jt(t){return _l()?localStorage.getItem(`${Ls}/${t}`):null}function wl(t){_l()&&localStorage.removeItem(`${Ls}/${t}`)}var P2=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};function ja(t,{include:e,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):r?!r.some(a):!0};for(let[i,a]of P2(t.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var qa=class{constructor({appName:e,appDesc:r,appIconPath:n,appUrl:i,appDomain:a,capabilities:o,port:s,token:u,url:c,hosting:l}){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=fr;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};ja(this);this.appName=e,this.appDesc=r,this.appDomain=a,this.appUrl=i,this.appIconPath=n,this.capabilities=o,this.port=s||this.port,this.url=c||`ws://localhost:${this.port}/graphql`,this.token=u||this.token,this.isHosting=l||!1,this.buildClient()}notifyConfigChange(e,r){this.listeners.configstatechange.forEach(n=>{n(e,r)})}notifyConnectionChange(e){this.connectionState!==e&&(this.connectionState=e,this.listeners.connectionstatechange.forEach(r=>{r(e)}))}notifyAuthChange(e){this.authState!==e&&(this.authState=e,this.listeners.authstatechange.forEach(r=>{r(e)}))}setPort(e){this.port!==e&&(this.port=e,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",e))}setUrl(e){this.url!==e&&(this.url=e,this.notifyConfigChange("url",e))}setToken(e){this.token!==e&&(this.token=e,this.notifyConfigChange("token",e))}on(e,r){this.listeners[e].push(r)}connect(e){return pe(this,null,function*(){try{if(e){yield $s(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{this.notifyConnectionChange("checking_local");try{yield $s(`ws://localhost:${this.port}/graphql`,2e3);let r=this.buildClient();return yield this.checkAuth(),r}catch(r){let n=yield this.ensureConnection();return yield this.checkAuth(),n}}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}loginToHosting(e,r){return pe(this,null,function*(){try{let n=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})});if(n.status===200){let i=yield n.json();localStorage.setItem("hosting_token",i.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,Fs("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield n.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(n){throw console.log(n),new Error(`Error logging in ${n}`)}})}checkEmail(e){return pe(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(r){console.log(r)}})}connectToPort(e){return pe(this,null,function*(){try{if(e){let r=yield bl(e);return this.setPort(r),this.buildClient()}else if(this.url.includes("localhost")){let r=yield this.findPort();return this.setPort(r),this.buildClient()}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return pe(this,null,function*(){var r,n;if(((r=this.activeSocket)==null?void 0:r.readyState)===WebSocket.OPEN&&((n=this.activeSocket)==null?void 0:n.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield $s(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return pe(this,null,function*(){let e=[...Array(10).keys()].map((i,a)=>bl(fr+a)),n=(yield Promise.allSettled(e)).find(i=>i.status==="fulfilled");if(n)return n.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let e=new WebSocket(this.url)}catch(e){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=Yp({url:this.url,connectionParams:()=>pe(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:e=>{this.activeSocket=e},error:e=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:e=>pe(this,null,function*(){if(!e.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let r=yield this.connect();r?this.ad4mClient=r:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new fu({link:new Jp(this.wsClient),cache:new To({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new Ss(this.apolloClient),this.ad4mClient}checkAuth(){return pe(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(e){return e.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(e=!1){return pe(this,null,function*(){var r;if(e&&this.setToken(null),this.isHosting){let n=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+n}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(r=this.ad4mClient)==null?void 0:r.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(e){return pe(this,null,function*(){var r;try{let n=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,e);return this.setToken(n),yield this.buildClient(),yield this.checkAuth(),this.token}catch(n){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(fr),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function Sl({unlockAgent:t,reconnect:e}){return B`
|
|
1371
1359
|
<div class="text-center">
|
|
1372
1360
|
<div class="items">
|
|
1373
1361
|
<div>
|
|
@@ -1594,62 +1582,61 @@ input VoiceActivityParamsInput {
|
|
|
1594
1582
|
Locally
|
|
1595
1583
|
</button>
|
|
1596
1584
|
<button class=${`button ${r?"button--primary":"button--secondary"}`} @click=${()=>i(!0)}>
|
|
1597
|
-
|
|
1585
|
+
Remotely
|
|
1598
1586
|
</button>
|
|
1599
1587
|
</div>
|
|
1600
|
-
${r?B
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
@input=${p=>u(parseInt(p.target.value))}
|
|
1627
|
-
/>
|
|
1628
|
-
</div>
|
|
1588
|
+
${r?B`
|
|
1589
|
+
<div class="input">
|
|
1590
|
+
<label class="input__label">URL</label>
|
|
1591
|
+
<input
|
|
1592
|
+
class="input__field"
|
|
1593
|
+
value=${e}
|
|
1594
|
+
@input=${p=>s(p.target.value)}
|
|
1595
|
+
/>
|
|
1596
|
+
</div>
|
|
1597
|
+
<div class="buttons">
|
|
1598
|
+
<button
|
|
1599
|
+
class="button button--full"
|
|
1600
|
+
@click=${()=>a(e)}
|
|
1601
|
+
>
|
|
1602
|
+
Connect
|
|
1603
|
+
</button>
|
|
1604
|
+
</div>
|
|
1605
|
+
`:B`
|
|
1606
|
+
<div class="input">
|
|
1607
|
+
<label class="input__label">PORT</label>
|
|
1608
|
+
<input
|
|
1609
|
+
class="input__field"
|
|
1610
|
+
value=${t}
|
|
1611
|
+
@input=${p=>u(parseInt(p.target.value))}
|
|
1612
|
+
/>
|
|
1613
|
+
</div>
|
|
1629
1614
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1615
|
+
<div class="buttons">
|
|
1616
|
+
<button
|
|
1617
|
+
class="button button--full"
|
|
1618
|
+
@click=${()=>n(t)}
|
|
1619
|
+
>
|
|
1620
|
+
Connect
|
|
1621
|
+
</button>
|
|
1622
|
+
</div>
|
|
1623
|
+
`}
|
|
1624
|
+
|
|
1625
|
+
<div class="text-center">or</div>
|
|
1626
|
+
<div class="buttons">
|
|
1627
|
+
<button
|
|
1628
|
+
class="button button--full button--secondary"
|
|
1629
|
+
@click=${()=>o("start")}
|
|
1630
|
+
>
|
|
1631
|
+
Back
|
|
1632
|
+
</button>
|
|
1633
|
+
<button
|
|
1634
|
+
class="button button--full button--secondary"
|
|
1635
|
+
@click=${c}
|
|
1636
|
+
>
|
|
1637
|
+
Clear state
|
|
1638
|
+
</button>
|
|
1639
|
+
</div
|
|
1653
1640
|
</div>
|
|
1654
1641
|
`}function Nl({connect:t,isMobile:e,hasClickedDownload:r,changeState:n,onDownloaded:i,scanQrcode:a,hosting:o}){let u=(Jt("ad4murl")||`http://localhost:${fr}`).includes("localhost");function c(l){l.preventDefault();let d=l.currentTarget;window.open(d.href,"_blank"),this.onDownloaded()}return B`
|
|
1655
1642
|
<div class="items">
|
|
@@ -1677,12 +1664,12 @@ input VoiceActivityParamsInput {
|
|
|
1677
1664
|
${o?B`<button class="button" @click=${()=>n("hosting")}>Use hosted AD4M (alpha)</button>`:""}
|
|
1678
1665
|
</div>
|
|
1679
1666
|
<div class="text-center">
|
|
1680
|
-
<button class="button button--
|
|
1667
|
+
<button class="button button--secondary" @click=${()=>t()}>
|
|
1681
1668
|
Try again
|
|
1682
1669
|
</button>
|
|
1683
1670
|
or
|
|
1684
1671
|
<button
|
|
1685
|
-
class="button button--
|
|
1672
|
+
class="button button--secondary "
|
|
1686
1673
|
@click=${()=>n("settings")}
|
|
1687
1674
|
>
|
|
1688
1675
|
Change connection settings
|
|
@@ -1703,7 +1690,7 @@ input VoiceActivityParamsInput {
|
|
|
1703
1690
|
`}
|
|
1704
1691
|
|
|
1705
1692
|
<div class="text-center">
|
|
1706
|
-
<a class="button button--
|
|
1693
|
+
<a class="button button--secondary" _target="blank" href="https://ad4m.dev"
|
|
1707
1694
|
>Learn more about ADAM</a
|
|
1708
1695
|
>
|
|
1709
1696
|
</div>
|
package/package.json
CHANGED