@kitelev/exocortex-cli 15.100.0 → 15.100.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +5 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @kitelev/exocortex-cli v15.100.0
2
+ // @kitelev/exocortex-cli v15.100.1
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -37,7 +37,9 @@ Expecting `+od.join(", ")+", got '"+(this.terminals_[ct]||ct)+"'":Gg="Parse erro
37
37
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(C){this.unput(this.match.slice(C))},"less"),pastInput:c(function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var C=this.pastInput(),P=new Array(C.length+1).join("-");return C+this.upcomingInput()+`
38
38
  `+P+"^"},"showPosition"),test_match:c(function(C,P){var D,re,Pe;if(this.options.backtrack_lexer&&(Pe={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(Pe.yylloc.range=this.yylloc.range.slice(0))),re=C[0].match(/(?:\r\n?|\n).*/g),re&&(this.yylineno+=re.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:re?re[re.length-1].length-re[re.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(C[0].length),this.matched+=C[0],D=this.performAction.call(this,this.yy,this,P,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),D)return D;if(this._backtrack){for(var m in Pe)this[m]=Pe[m];return!1}return!1},"test_match"),next:c(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,P,D,re;this._more||(this.yytext="",this.match="");for(var Pe=this._currentRules(),m=0;m<Pe.length;m++)if(D=this._input.match(this.rules[Pe[m]]),D&&(!P||D[0].length>P[0].length)){if(P=D,re=m,this.options.backtrack_lexer){if(C=this.test_match(D,Pe[m]),C!==!1)return C;if(this._backtrack){P=!1;continue}else return!1}else if(!this.options.flex)break}return P?(C=this.test_match(P,Pe[re]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
39
39
  `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:c(function(){var P=this.next();return P||this.lex()},"lex"),begin:c(function(P){this.conditionStack.push(P)},"begin"),popState:c(function(){var P=this.conditionStack.length-1;return P>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:c(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:c(function(P){return P=this.conditionStack.length-1-Math.abs(P||0),P>=0?this.conditionStack[P]:"INITIAL"},"topState"),pushState:c(function(P){this.begin(P)},"pushState"),stateStackSize:c(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:c(function(P,D,re,Pe){var m=Pe;switch(re){case 0:break;case 1:return 12;case 2:return 15;case 3:return 41;case 4:return 325;case 5:return 326;case 6:return 45;case 7:return 47;case 8:return 48;case 9:return 39;case 10:return 24;case 11:return 28;case 12:return 29;case 13:return 31;case 14:return 32;case 15:return 36;case 16:return 53;case 17:return 327;case 18:return 63;case 19:return 64;case 20:return 70;case 21:return 73;case 22:return 76;case 23:return 78;case 24:return 81;case 25:return 83;case 26:return 85;case 27:return 193;case 28:return 100;case 29:return 328;case 30:return 121;case 31:return 329;case 32:return 330;case 33:return 110;case 34:return 331;case 35:return 109;case 36:return 332;case 37:return 333;case 38:return 113;case 39:return 115;case 40:return 116;case 41:return 131;case 42:return 123;case 43:return 126;case 44:return 128;case 45:return 132;case 46:return 112;case 47:return 334;case 48:return 335;case 49:return 159;case 50:return 161;case 51:return 164;case 52:return 174;case 53:return 160;case 54:return 336;case 55:return 163;case 56:return 312;case 57:return 314;case 58:return 317;case 59:return 318;case 60:return 272;case 61:return 197;case 62:return 337;case 63:return 338;case 64:return 229;case 65:return 340;case 66:return 263;case 67:return 224;case 68:return 231;case 69:return 232;case 70:return 242;case 71:return 246;case 72:return 290;case 73:return 341;case 74:return 342;case 75:return 343;case 76:return 344;case 77:return 345;case 78:return 250;case 79:return 346;case 80:return 265;case 81:return 276;case 82:return 277;case 83:return 268;case 84:return 269;case 85:return 270;case 86:return 271;case 87:return 347;case 88:return 348;case 89:return 273;case 90:return 274;case 91:return 350;case 92:return 349;case 93:return 351;case 94:return 279;case 95:return 280;case 96:return 283;case 97:return 285;case 98:return 289;case 99:return 293;case 100:return 296;case 101:return 13;case 102:return 16;case 103:return 308;case 104:return 309;case 105:return 87;case 106:return 292;case 107:return 82;case 108:return 294;case 109:return 295;case 110:return 297;case 111:return 298;case 112:return 299;case 113:return 300;case 114:return 301;case 115:return 302;case 116:return"EXPONENT";case 117:return 303;case 118:return 304;case 119:return 305;case 120:return 306;case 121:return 89;case 122:return 310;case 123:return 6;case 124:return"INVALID";case 125:console.log(D.yytext);break}},"anonymous"),rules:[/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:\{\|)/i,/^(?:\|\})/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(SUBJECT|PREDICATE|OBJECT|isTRIPLE))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:TRIPLE)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],inclusive:!0}}};return I})();Dg.lexer=uD;function Fe(){this.yy={}}return c(Fe,"Parser"),Fe.prototype=Dg,Dg.Parser=Fe,new Fe})();XE.exports=ek});var tT=v((GX,eT)=>{var tk="http://www.w3.org/2001/XMLSchema#integer",rk="http://www.w3.org/2001/XMLSchema#string";function Et(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];pu(i)&&(this._prefixByIri[i]=r,t.push(i))}var s=t.join("|").replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^("+s+")([a-zA-Z][\\-_a-zA-Z0-9]*)$"),this._usedPrefixes={},this._sparqlStar=n.sparqlStar,this._indent=pu(n.indent)?n.indent:" ",this._newline=pu(n.newline)?n.newline:`
40
- `,this._explicitDatatype=!!n.explicitDatatype}c(Et,"Generator");Et.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=In(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:oa(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+nh(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=In(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+In(n.group,void 0,function(t){var r=oa(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+nh(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+In(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+In(n.order,void 0,function(t){var r="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+r:r},this)+this._newline),n.offset&&(e+="OFFSET "+n.offset+this._newline),n.limit&&(e+="LIMIT "+n.limit+this._newline),n.values&&(e+=this.values(n)),e=this.baseAndPrefixes(n)+e,e.trim()};Et.prototype.baseAndPrefixes=function(n){var e=n.base?"BASE <"+n.base+">"+this._newline:"",t="";for(var r in n.prefixes)(this._options.allPrefixes||this._usedPrefixes[r])&&(t+="PREFIX "+r+": <"+n.prefixes[r]+">"+this._newline);return e+t};Et.prototype.toPattern=function(n){var e=n.type||n instanceof Array&&"array"||(n.subject&&n.predicate&&n.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](n)};Et.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};Et.prototype.array=function(n){return In(n,this._newline,this.toPattern,this)};Et.prototype.bgp=function(n){return this.encodeTriples(n.triples)};Et.prototype.encodeTriples=function(n){if(!n.length)return"";for(var e=[],t=void 0,r=void 0,i=0;i<n.length;i++){var s=n[i];ro(s.subject,t)?ro(s.predicate,r)?e.push(","):(r=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(r))):(t&&e.push("."+this._newline),t=s.subject,r=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(r))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};Et.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};Et.prototype.graphs=function(n,e){return!e||e.length===0?"":In(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};Et.prototype.group=function(n,e){return n=e!==!0?this.array(n.patterns||n.triples):this.toPattern(n.type!=="group"?n:n.patterns),n.indexOf(this._newline)===-1?"{ "+n+" }":"{"+this._newline+this.indent(n)+this._newline+"}"};Et.prototype.query=function(n){return this.toQuery(n)};Et.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};Et.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+nh(n.variable)+")"};Et.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};Et.prototype.union=function(n){return In(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};Et.prototype.minus=function(n){return"MINUS "+this.group(n)};Et.prototype.values=function(n){var e=Object.keys(n.values.reduce(function(i,s){for(var a in s)i[a]=!0;return i},{})),t,r;return e.length===1?t=r="":(t="(",r=")"),"VALUES "+t+e.join(" ")+r+" {"+this._newline+In(n.values,this._newline,function(i){return" "+t+In(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};Et.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};Et.prototype.toExpression=function(n){if(oa(n))return this.toEntity(n);switch(n.type.toLowerCase()){case"aggregate":return n.aggregation.toUpperCase()+"("+(n.distinct?"DISTINCT ":"")+this.toExpression(n.expression)+(typeof n.separator=="string"?'; SEPARATOR = "'+n.separator.replace(JE,ZE)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+In(n.args,", ",this.toExpression,this)+")";case"operation":var e=n.operator.toUpperCase(),t=n.args||[];switch(n.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(oa(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(oa(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(pu(t[1])?t[1]:In(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+In(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};Et.prototype.toEntity=function(n){if(oa(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return nh(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(JE,ZE)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case rk:return n;case tk:if(/^\d+$/.test(e))return e+" "}n+="^^"+this.encodeIRI(r.value)}return n;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return n.graph&&n.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(n.graph)+" { "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" } >>":"<< "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" >>";default:return this.encodeIRI(n.value)}else{var i=n.items.map(this.toEntity,this),s=n.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var JE=/["\\\t\n\r\b\f]/g,ZE=c(function(n){return nk[n]},"escapeReplacer"),nk={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};Et.prototype.encodeIRI=function(n){var e=this._prefixRegex.exec(n);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+n+">"};Et.prototype.toUpdate=function(n){switch(n.type||n.updateType){case"load":return"LOAD"+(n.source?" "+this.toEntity(n.source):"")+(n.destination?" INTO GRAPH "+this.toEntity(n.destination):"");case"insert":return"INSERT DATA "+this.group(n.insert,!0);case"delete":return"DELETE DATA "+this.group(n.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(n.delete,!0);case"insertdelete":return(n.graph?"WITH "+this.toEntity(n.graph)+this._newline:"")+(n.delete.length?"DELETE "+this.group(n.delete,!0)+this._newline:"")+(n.insert.length?"INSERT "+this.group(n.insert,!0)+this._newline:"")+(n.using?this.graphs("USING ",n.using.default):"")+(n.using?this.graphs("USING NAMED ",n.using.named):"")+"WHERE "+this.group(n.where,!0);case"add":case"copy":case"move":return n.type.toUpperCase()+" "+(n.silent?"SILENT ":"")+(n.source.default?"DEFAULT":this.toEntity(n.source.name))+" TO "+this.toEntity(n.destination.name);case"create":case"clear":case"drop":return n.type.toUpperCase()+(n.silent?" SILENT ":" ")+(n.graph.default?"DEFAULT":n.graph.named?"NAMED":n.graph.all?"ALL":"GRAPH "+this.toEntity(n.graph.name));default:throw new Error("Unknown update query type: "+n.type)}};Et.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function nh(n){return"?"+n.value}c(nh,"variableToString");function pu(n){return typeof n=="string"}c(pu,"isString");function oa(n){return typeof n.termType=="string"}c(oa,"isTerm");function ro(n,e){if(!n||!oa(n)||!e||!oa(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&ro(n.datatype,e.datatype);case"Quad":return ro(n.subject,e.subject)&&ro(n.predicate,e.predicate)&&ro(n.object,e.object)&&ro(n.graph,e.graph);default:return n.value===e.value}}c(ro,"equalTerms");function In(n,e,t,r){return n.map(t,r).join(pu(e)?e:" ")}c(In,"mapJoin");function ik(n={}){return{stringify:c(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new Et(t).toQuery(e)},"stringify"),createGenerator:c(function(){return new Et(n)},"createGenerator")}}c(ik,"_Generator");eT.exports={Generator:ik}});var M0=v(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.BlankNode=void 0;var k0=class{static{c(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};ih.BlankNode=k0});var j0=v(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.DefaultGraph=void 0;var mu=class{static{c(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};sh.DefaultGraph=mu;mu.INSTANCE=new mu});var oh=v(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.NamedNode=void 0;var $0=class{static{c(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};ah.NamedNode=$0});var V0=v(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.Literal=void 0;var rT=oh(),gu=class n{static{c(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=n.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=n.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};ch.Literal=gu;gu.RDF_LANGUAGE_STRING=new rT.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");gu.XSD_STRING=new rT.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var B0=v(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.Quad=void 0;var U0=class{static{c(this,"Quad")}constructor(e,t,r,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};lh.Quad=U0});var W0=v(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.Variable=void 0;var q0=class{static{c(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};uh.Variable=q0});var iT=v(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});fh.DataFactory=void 0;var sk=M0(),ak=j0(),nT=V0(),ok=oh(),ck=B0(),lk=W0(),uk=0,G0=class{static{c(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${uk++}_`}namedNode(e){return new ok.NamedNode(e)}blankNode(e){return new sk.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new nT.Literal(e,t)}variable(e){return new lk.Variable(e)}defaultGraph(){return ak.DefaultGraph.INSTANCE}quad(e,t,r,i){return new ck.Quad(e,t,r,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(nT.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};fh.DataFactory=G0});var sT=v(Rn=>{"use strict";var fk=Rn&&Rn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:c(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),no=Rn&&Rn.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&fk(e,n,t)};Object.defineProperty(Rn,"__esModule",{value:!0});no(M0(),Rn);no(iT(),Rn);no(j0(),Rn);no(V0(),Rn);no(oh(),Rn);no(B0(),Rn);no(W0(),Rn)});var oT=v((lK,aT)=>{var{Parser:As}=KE(),{Generator:dk}=tT(),{Wildcard:hk}=L0(),{DataFactory:pk}=sT();function mk({prefixes:n,baseIRI:e,factory:t,pathOnly:r,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:a}={}){let o={};for(let u in n??{})o[u]=n[u];let l=new As;return l.parse=function(){return As.base=e||"",As.prefixes=Object.create(o),As.factory=t||new pk,As.sparqlStar=!!i,As.pathOnly=!!r,As.skipValidation=!!s||!!a,As.prototype.parse.apply(l,arguments)},l._resetBlanks=As._resetBlanks,l}c(mk,"_Parser");aT.exports={Parser:mk,Generator:dk,Wildcard:hk}});var H0=v(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.CaseWhenTransformerError=oc.CaseWhenTransformer=void 0;var z0=class{static{c(this,"CaseWhenTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Cs("Too many nested CASE expressions (max 100 iterations)");while(t!==r);return t}transformSinglePass(e){let t=this.findCasePositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractCaseExpression(r,s);if(a){let o=this.convertCaseToIf(a.content);r=r.substring(0,s)+o+r.substring(s+a.length)}}return r}findCasePositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(r.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){t.push(i),i+=4;continue}i++}return t}extractCaseExpression(e,t){let r=1,i=t+4,s=e.toUpperCase();for(;i<e.length&&r>0;){if(e[i]==="'"||e[i]==='"'){let a=e[i];for(i++;i<e.length&&e[i]!==a;)e[i]==="\\"&&i++,i++;i++;continue}if(s.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){r++,i+=4;continue}if(s.substring(i,i+3)==="END"&&this.isWordBoundary(e,i,3)){if(r--,r===0){let a=e.substring(t,i+3);return{content:a,length:a.length}}i+=3;continue}i++}if(r>0)throw new Cs(`Unclosed CASE expression at position ${t}`);return null}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_?$]/.test(i),a=t+r<e.length?e[t+r]:"",o=t+r>=e.length||!/[a-zA-Z0-9_]/.test(a);return s&&o}convertCaseToIf(e){let t=this.extractWhenClauses(e),r=this.extractElseClause(e);if(t.length===0)throw new Cs("CASE expression must have at least one WHEN clause");let i=r!==null?r:'""';for(let s=t.length-1;s>=0;s--){let{condition:a,result:o}=t[s];i=`IF(${a}, ${o}, ${i})`}return i}extractWhenClauses(e){let t=[],r=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),i=this.findKeywordPositions(r,"WHEN"),s=this.findKeywordPositions(r,"ELSE"),a=s.length>0?s[0]:r.length;for(let o=0;o<i.length;o++){let l=i[o]+4,u=o+1<i.length?i[o+1]:a,f=r.substring(l,u).trim(),d=this.parseWhenClause(f);d&&t.push(d)}return t}findKeywordPositions(e,t){let r=[],i=e.toUpperCase(),s=0,a=0;for(;s<e.length;){let o=e[s];if(o==="'"||o==='"'){let l=o;for(s++;s<e.length&&e[s]!==l;)e[s]==="\\"&&s++,s++;s++;continue}if(o==="("){a++,s++;continue}if(o===")"){a--,s++;continue}if(a===0&&i.substring(s,s+t.length)===t&&this.isWordBoundary(e,s,t.length)){r.push(s),s+=t.length;continue}s++}return r}parseWhenClause(e){let t=this.findKeywordPositions(e,"THEN");if(t.length===0)throw new Cs(`WHEN clause missing THEN keyword: ${e.substring(0,50)}...`);let r=t[0],i=e.substring(0,r).trim(),s=e.substring(r+4).trim();if(!i)throw new Cs("WHEN clause has empty condition");if(!s)throw new Cs("WHEN clause has empty result");return{condition:i,result:s}}extractElseClause(e){let t=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),r=this.findKeywordPositions(t,"ELSE");if(r.length>0){let i=r[0];return t.substring(i+4).trim()}return null}};oc.CaseWhenTransformer=z0;var Cs=class extends Error{static{c(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};oc.CaseWhenTransformerError=Cs});var Q0=v(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.LateralTransformerError=cc.LateralTransformer=void 0;var dh=class n{static{c(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new ca("Too many nested LATERAL joins (max 100 iterations)");while(t!==r);return t}hasLateral(e){return this.findLateralPositions(e).length>0}static isLateralJoin(e){if(e.type==="group"&&e.patterns){for(let t of e.patterns)if(t.type==="query"&&t.queryType==="SELECT"&&t.variables&&Array.isArray(t.variables)){for(let r of t.variables)if(r.termType==="Variable"&&r.value===n.LATERAL_MARKER)return!0}}if(e.type==="query"&&e.queryType==="SELECT"&&e.variables&&Array.isArray(e.variables)){for(let t of e.variables)if(t.termType==="Variable"&&t.value===n.LATERAL_MARKER)return!0}return!1}transformSinglePass(e){let t=this.findLateralPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractLateralExpression(r,s);if(a){let o=this.transformLateral(a.content);r=r.substring(0,s)+o+r.substring(s+a.length)}}return r}findLateralPositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(e[i]==="#"){for(;i<e.length&&e[i]!==`
40
+ `,this._explicitDatatype=!!n.explicitDatatype}c(Et,"Generator");Et.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=In(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:oa(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+nh(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=In(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+In(n.group,void 0,function(t){var r=oa(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+nh(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+In(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+In(n.order,void 0,function(t){var r="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+r:r},this)+this._newline),n.offset&&(e+="OFFSET "+n.offset+this._newline),n.limit&&(e+="LIMIT "+n.limit+this._newline),n.values&&(e+=this.values(n)),e=this.baseAndPrefixes(n)+e,e.trim()};Et.prototype.baseAndPrefixes=function(n){var e=n.base?"BASE <"+n.base+">"+this._newline:"",t="";for(var r in n.prefixes)(this._options.allPrefixes||this._usedPrefixes[r])&&(t+="PREFIX "+r+": <"+n.prefixes[r]+">"+this._newline);return e+t};Et.prototype.toPattern=function(n){var e=n.type||n instanceof Array&&"array"||(n.subject&&n.predicate&&n.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](n)};Et.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};Et.prototype.array=function(n){return In(n,this._newline,this.toPattern,this)};Et.prototype.bgp=function(n){return this.encodeTriples(n.triples)};Et.prototype.encodeTriples=function(n){if(!n.length)return"";for(var e=[],t=void 0,r=void 0,i=0;i<n.length;i++){var s=n[i];ro(s.subject,t)?ro(s.predicate,r)?e.push(","):(r=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(r))):(t&&e.push("."+this._newline),t=s.subject,r=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(r))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};Et.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};Et.prototype.graphs=function(n,e){return!e||e.length===0?"":In(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};Et.prototype.group=function(n,e){return n=e!==!0?this.array(n.patterns||n.triples):this.toPattern(n.type!=="group"?n:n.patterns),n.indexOf(this._newline)===-1?"{ "+n+" }":"{"+this._newline+this.indent(n)+this._newline+"}"};Et.prototype.query=function(n){return this.toQuery(n)};Et.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};Et.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+nh(n.variable)+")"};Et.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};Et.prototype.union=function(n){return In(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};Et.prototype.minus=function(n){return"MINUS "+this.group(n)};Et.prototype.values=function(n){var e=Object.keys(n.values.reduce(function(i,s){for(var a in s)i[a]=!0;return i},{})),t,r;return e.length===1?t=r="":(t="(",r=")"),"VALUES "+t+e.join(" ")+r+" {"+this._newline+In(n.values,this._newline,function(i){return" "+t+In(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};Et.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};Et.prototype.toExpression=function(n){if(oa(n))return this.toEntity(n);switch(n.type.toLowerCase()){case"aggregate":return n.aggregation.toUpperCase()+"("+(n.distinct?"DISTINCT ":"")+this.toExpression(n.expression)+(typeof n.separator=="string"?'; SEPARATOR = "'+n.separator.replace(JE,ZE)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+In(n.args,", ",this.toExpression,this)+")";case"operation":var e=n.operator.toUpperCase(),t=n.args||[];switch(n.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(oa(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(oa(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(pu(t[1])?t[1]:In(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+In(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};Et.prototype.toEntity=function(n){if(oa(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return nh(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(JE,ZE)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case rk:return n;case tk:if(/^\d+$/.test(e))return e+" "}n+="^^"+this.encodeIRI(r.value)}return n;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return n.graph&&n.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(n.graph)+" { "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" } >>":"<< "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" >>";default:return this.encodeIRI(n.value)}else{var i=n.items.map(this.toEntity,this),s=n.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var JE=/["\\\t\n\r\b\f]/g,ZE=c(function(n){return nk[n]},"escapeReplacer"),nk={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};Et.prototype.encodeIRI=function(n){var e=this._prefixRegex.exec(n);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+n+">"};Et.prototype.toUpdate=function(n){switch(n.type||n.updateType){case"load":return"LOAD"+(n.source?" "+this.toEntity(n.source):"")+(n.destination?" INTO GRAPH "+this.toEntity(n.destination):"");case"insert":return"INSERT DATA "+this.group(n.insert,!0);case"delete":return"DELETE DATA "+this.group(n.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(n.delete,!0);case"insertdelete":return(n.graph?"WITH "+this.toEntity(n.graph)+this._newline:"")+(n.delete.length?"DELETE "+this.group(n.delete,!0)+this._newline:"")+(n.insert.length?"INSERT "+this.group(n.insert,!0)+this._newline:"")+(n.using?this.graphs("USING ",n.using.default):"")+(n.using?this.graphs("USING NAMED ",n.using.named):"")+"WHERE "+this.group(n.where,!0);case"add":case"copy":case"move":return n.type.toUpperCase()+" "+(n.silent?"SILENT ":"")+(n.source.default?"DEFAULT":this.toEntity(n.source.name))+" TO "+this.toEntity(n.destination.name);case"create":case"clear":case"drop":return n.type.toUpperCase()+(n.silent?" SILENT ":" ")+(n.graph.default?"DEFAULT":n.graph.named?"NAMED":n.graph.all?"ALL":"GRAPH "+this.toEntity(n.graph.name));default:throw new Error("Unknown update query type: "+n.type)}};Et.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function nh(n){return"?"+n.value}c(nh,"variableToString");function pu(n){return typeof n=="string"}c(pu,"isString");function oa(n){return typeof n.termType=="string"}c(oa,"isTerm");function ro(n,e){if(!n||!oa(n)||!e||!oa(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&ro(n.datatype,e.datatype);case"Quad":return ro(n.subject,e.subject)&&ro(n.predicate,e.predicate)&&ro(n.object,e.object)&&ro(n.graph,e.graph);default:return n.value===e.value}}c(ro,"equalTerms");function In(n,e,t,r){return n.map(t,r).join(pu(e)?e:" ")}c(In,"mapJoin");function ik(n={}){return{stringify:c(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new Et(t).toQuery(e)},"stringify"),createGenerator:c(function(){return new Et(n)},"createGenerator")}}c(ik,"_Generator");eT.exports={Generator:ik}});var M0=v(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});ih.BlankNode=void 0;var k0=class{static{c(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};ih.BlankNode=k0});var j0=v(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.DefaultGraph=void 0;var mu=class{static{c(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};sh.DefaultGraph=mu;mu.INSTANCE=new mu});var oh=v(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.NamedNode=void 0;var $0=class{static{c(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};ah.NamedNode=$0});var V0=v(ch=>{"use strict";Object.defineProperty(ch,"__esModule",{value:!0});ch.Literal=void 0;var rT=oh(),gu=class n{static{c(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=n.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=n.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};ch.Literal=gu;gu.RDF_LANGUAGE_STRING=new rT.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");gu.XSD_STRING=new rT.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var B0=v(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.Quad=void 0;var U0=class{static{c(this,"Quad")}constructor(e,t,r,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};lh.Quad=U0});var W0=v(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.Variable=void 0;var q0=class{static{c(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};uh.Variable=q0});var iT=v(fh=>{"use strict";Object.defineProperty(fh,"__esModule",{value:!0});fh.DataFactory=void 0;var sk=M0(),ak=j0(),nT=V0(),ok=oh(),ck=B0(),lk=W0(),uk=0,G0=class{static{c(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${uk++}_`}namedNode(e){return new ok.NamedNode(e)}blankNode(e){return new sk.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new nT.Literal(e,t)}variable(e){return new lk.Variable(e)}defaultGraph(){return ak.DefaultGraph.INSTANCE}quad(e,t,r,i){return new ck.Quad(e,t,r,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(nT.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};fh.DataFactory=G0});var sT=v(Rn=>{"use strict";var fk=Rn&&Rn.__createBinding||(Object.create?(function(n,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:c(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),no=Rn&&Rn.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&fk(e,n,t)};Object.defineProperty(Rn,"__esModule",{value:!0});no(M0(),Rn);no(iT(),Rn);no(j0(),Rn);no(V0(),Rn);no(oh(),Rn);no(B0(),Rn);no(W0(),Rn)});var oT=v((lK,aT)=>{var{Parser:As}=KE(),{Generator:dk}=tT(),{Wildcard:hk}=L0(),{DataFactory:pk}=sT();function mk({prefixes:n,baseIRI:e,factory:t,pathOnly:r,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:a}={}){let o={};for(let u in n??{})o[u]=n[u];let l=new As;return l.parse=function(){return As.base=e||"",As.prefixes=Object.create(o),As.factory=t||new pk,As.sparqlStar=!!i,As.pathOnly=!!r,As.skipValidation=!!s||!!a,As.prototype.parse.apply(l,arguments)},l._resetBlanks=As._resetBlanks,l}c(mk,"_Parser");aT.exports={Parser:mk,Generator:dk,Wildcard:hk}});var H0=v(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.CaseWhenTransformerError=oc.CaseWhenTransformer=void 0;var z0=class{static{c(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Cs("Too many nested CASE expressions (max 100 iterations)");while(t!==r);return t}stripLineComments(e){let t="",r=0;for(;r<e.length;){let i=e[r];if(i==="'"||i==='"'){let s=i;for(t+=i,r++;r<e.length&&e[r]!==s;){if(e[r]==="\\"&&r+1<e.length){t+=e[r]+e[r+1],r+=2;continue}t+=e[r],r++}r<e.length&&(t+=e[r],r++);continue}if(i==="<"){let s=e.indexOf(">",r),a=e.indexOf(`
41
+ `,r);if(s!==-1&&(a===-1||s<a)){t+=e.substring(r,s+1),r=s+1;continue}}if(i==="#"){let s=e.indexOf(`
42
+ `,r),a=s===-1?e.length:s;t+=" ".repeat(a-r),r=a;continue}t+=i,r++}return t}transformSinglePass(e){let t=this.findCasePositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractCaseExpression(r,s);if(a){let o=this.convertCaseToIf(a.content);r=r.substring(0,s)+o+r.substring(s+a.length)}}return r}findCasePositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(r.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){t.push(i),i+=4;continue}i++}return t}extractCaseExpression(e,t){let r=1,i=t+4,s=e.toUpperCase();for(;i<e.length&&r>0;){if(e[i]==="'"||e[i]==='"'){let a=e[i];for(i++;i<e.length&&e[i]!==a;)e[i]==="\\"&&i++,i++;i++;continue}if(s.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){r++,i+=4;continue}if(s.substring(i,i+3)==="END"&&this.isWordBoundary(e,i,3)){if(r--,r===0){let a=e.substring(t,i+3);return{content:a,length:a.length}}i+=3;continue}i++}if(r>0)throw new Cs(`Unclosed CASE expression at position ${t}`);return null}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_?$]/.test(i),a=t+r<e.length?e[t+r]:"",o=t+r>=e.length||!/[a-zA-Z0-9_]/.test(a);return s&&o}convertCaseToIf(e){let t=this.extractWhenClauses(e),r=this.extractElseClause(e);if(t.length===0)throw new Cs("CASE expression must have at least one WHEN clause");let i=r!==null?r:'""';for(let s=t.length-1;s>=0;s--){let{condition:a,result:o}=t[s];i=`IF(${a}, ${o}, ${i})`}return i}extractWhenClauses(e){let t=[],r=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),i=this.findKeywordPositions(r,"WHEN"),s=this.findKeywordPositions(r,"ELSE"),a=s.length>0?s[0]:r.length;for(let o=0;o<i.length;o++){let l=i[o]+4,u=o+1<i.length?i[o+1]:a,f=r.substring(l,u).trim(),d=this.parseWhenClause(f);d&&t.push(d)}return t}findKeywordPositions(e,t){let r=[],i=e.toUpperCase(),s=0,a=0;for(;s<e.length;){let o=e[s];if(o==="'"||o==='"'){let l=o;for(s++;s<e.length&&e[s]!==l;)e[s]==="\\"&&s++,s++;s++;continue}if(o==="("){a++,s++;continue}if(o===")"){a--,s++;continue}if(a===0&&i.substring(s,s+t.length)===t&&this.isWordBoundary(e,s,t.length)){r.push(s),s+=t.length;continue}s++}return r}parseWhenClause(e){let t=this.findKeywordPositions(e,"THEN");if(t.length===0)throw new Cs(`WHEN clause missing THEN keyword: ${e.substring(0,50)}...`);let r=t[0],i=e.substring(0,r).trim(),s=e.substring(r+4).trim();if(!i)throw new Cs("WHEN clause has empty condition");if(!s)throw new Cs("WHEN clause has empty result");return{condition:i,result:s}}extractElseClause(e){let t=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),r=this.findKeywordPositions(t,"ELSE");if(r.length>0){let i=r[0];return t.substring(i+4).trim()}return null}};oc.CaseWhenTransformer=z0;var Cs=class extends Error{static{c(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};oc.CaseWhenTransformerError=Cs});var Q0=v(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.LateralTransformerError=cc.LateralTransformer=void 0;var dh=class n{static{c(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new ca("Too many nested LATERAL joins (max 100 iterations)");while(t!==r);return t}hasLateral(e){return this.findLateralPositions(e).length>0}static isLateralJoin(e){if(e.type==="group"&&e.patterns){for(let t of e.patterns)if(t.type==="query"&&t.queryType==="SELECT"&&t.variables&&Array.isArray(t.variables)){for(let r of t.variables)if(r.termType==="Variable"&&r.value===n.LATERAL_MARKER)return!0}}if(e.type==="query"&&e.queryType==="SELECT"&&e.variables&&Array.isArray(e.variables)){for(let t of e.variables)if(t.termType==="Variable"&&t.value===n.LATERAL_MARKER)return!0}return!1}transformSinglePass(e){let t=this.findLateralPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],a=this.extractLateralExpression(r,s);if(a){let o=this.transformLateral(a.content);r=r.substring(0,s)+o+r.substring(s+a.length)}}return r}findLateralPositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(e[i]==="#"){for(;i<e.length&&e[i]!==`
41
43
  `;)i++;continue}if(r.substring(i,i+7)==="LATERAL"&&this.isWordBoundary(e,i,7)){t.push(i),i+=7;continue}i++}return t}extractLateralExpression(e,t){let r=t+7;for(;r<e.length&&/\s/.test(e[r]);)r++;if(e[r]!=="{")throw new ca(`Expected '{' after LATERAL keyword at position ${t}`);let i=1;for(r++;r<e.length&&i>0;){if(e[r]==="'"||e[r]==='"'){let s=e[r];for(r++;r<e.length&&e[r]!==s;)e[r]==="\\"&&r++,r++;r++;continue}if(e[r]==="#"){for(;r<e.length&&e[r]!==`
42
44
  `;)r++;continue}if(e[r]==="{"){i++,r++;continue}if(e[r]==="}"){if(i--,i===0){let s=e.substring(t,r+1);return{content:s,length:s.length}}r++;continue}r++}if(i>0)throw new ca(`Unclosed LATERAL block at position ${t}`);return null}transformLateral(e){let t=e.indexOf("{");if(t===-1)throw new ca("LATERAL expression missing opening brace");let r=e.substring(t+1,e.length-1).trim();if(!r.toUpperCase().trim().startsWith("SELECT"))throw new ca("LATERAL block must contain a SELECT subquery");let a=r.toUpperCase().indexOf("SELECT")+6;for(;a<r.length&&/\s/.test(r[a]);)a++;let o=r.substring(a).toUpperCase();return o.startsWith("DISTINCT")?a+=8:o.startsWith("REDUCED")&&(a+=7),`{ ${r.substring(0,a)+` ?${n.LATERAL_MARKER}`+r.substring(a)} }`}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_]/.test(i),a=t+r<e.length?e[t+r]:"",o=t+r>=e.length||!/[a-zA-Z0-9_]/.test(a);return s&&o}};cc.LateralTransformer=dh;dh.LATERAL_MARKER="__LATERAL_JOIN__";var ca=class extends Error{static{c(this,"LateralTransformerError")}constructor(e){super(`LATERAL transformation error: ${e}`),this.name="LateralTransformerError"}};cc.LateralTransformerError=ca});var cT=v(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.PrefixStarTransformerError=la.PrefixStarTransformer=la.WellKnownPrefixResolver=void 0;var hh=class{static{c(this,"WellKnownPrefixResolver")}constructor(){this.wellKnownPrefixes=new Map;let e=new Map;e.set("schema","http://schema.org/"),this.wellKnownPrefixes.set("http://schema.org/",e);let t=new Map;t.set("foaf","http://xmlns.com/foaf/0.1/"),this.wellKnownPrefixes.set("http://xmlns.com/foaf/0.1/",t);let r=new Map;r.set("dc","http://purl.org/dc/elements/1.1/"),r.set("dcterms","http://purl.org/dc/terms/"),this.wellKnownPrefixes.set("http://purl.org/dc/elements/1.1/",r),this.wellKnownPrefixes.set("http://purl.org/dc/terms/",r);let i=new Map;i.set("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),i.set("rdfs","http://www.w3.org/2000/01/rdf-schema#"),this.wellKnownPrefixes.set("http://www.w3.org/1999/02/22-rdf-syntax-ns#",i),this.wellKnownPrefixes.set("http://www.w3.org/2000/01/rdf-schema#",i);let s=new Map;s.set("owl","http://www.w3.org/2002/07/owl#"),this.wellKnownPrefixes.set("http://www.w3.org/2002/07/owl#",s);let a=new Map;a.set("xsd","http://www.w3.org/2001/XMLSchema#"),this.wellKnownPrefixes.set("http://www.w3.org/2001/XMLSchema#",a);let o=new Map;o.set("skos","http://www.w3.org/2004/02/skos/core#"),this.wellKnownPrefixes.set("http://www.w3.org/2004/02/skos/core#",o);let l=new Map;l.set("prov","http://www.w3.org/ns/prov#"),this.wellKnownPrefixes.set("http://www.w3.org/ns/prov#",l);let u=new Map;u.set("geo","http://www.w3.org/2003/01/geo/wgs84_pos#"),this.wellKnownPrefixes.set("http://www.w3.org/2003/01/geo/wgs84_pos#",u);let f=new Map;f.set("dcat","http://www.w3.org/ns/dcat#"),this.wellKnownPrefixes.set("http://www.w3.org/ns/dcat#",f)}async resolve(e){let t=e.endsWith("#")||e.endsWith("/")?e:e+(e.includes("#")?"":"/"),r=this.wellKnownPrefixes.get(t);if(r)return r;let i=t.slice(0,-1),s=this.wellKnownPrefixes.get(i);return s||new Map}addVocabulary(e,t){this.wellKnownPrefixes.set(e,t)}};la.WellKnownPrefixResolver=hh;var Y0=class{static{c(this,"PrefixStarTransformer")}constructor(e){this.resolver=e??new hh}async transform(e){let t=this.findPrefixStarDeclarations(e);if(t.length===0)return e;let r=[],i=[];for(let a of t)try{let o=await this.resolver.resolve(a.uri);for(let[l,u]of o)r.push(`PREFIX ${l}: <${u}>`);if(o.size===0){let l=this.extractPrefixFromUri(a.uri);l&&r.push(`PREFIX ${l}: <${a.uri}>`)}}catch(o){let l=o instanceof Error?o.message:String(o);i.push(`Failed to resolve vocabulary ${a.uri}: ${l}`)}if(r.length===0&&i.length>0)throw new lc(i.join("; "));let s=e;for(let a=t.length-1;a>=0;a--){let o=t[a];s=s.substring(0,o.startPos)+s.substring(o.endPos)}return r.length>0&&(s=r.join(`
43
45
  `)+`
@@ -744,7 +746,7 @@ ${Pr.dump(i,{lineWidth:-1})}---
744
746
  \u{1F50D} Dry-run: command "${l.name}" on "${t.target}"
745
747
  `),console.log(" Precondition: passed \u2705"),console.log(" Grounding (would execute):"),SS(l.grounding," ");return}let h=new Mt.ServiceRegistry;HO(h);let p=new Ft(i),b=await new Mt.GroundingExecutor(p,p,h).execute(l.grounding,u,t.target);if(r==="json"){let E=Z.success({command:l.name,target:t.target,preconditionPassed:!0,executed:!0,success:b.success,...b.error&&{error:b.error},...l.successMessage&&b.success&&{message:l.successMessage}});console.log(JSON.stringify(E,null,2))}else if(b.success){let E=l.successMessage??`Command "${l.name}" executed successfully.`;console.log(`\u2705 ${E}`)}else console.log(`\u274C Command "${l.name}" failed: ${b.error}`),process.exitCode=5}catch(i){k.handle(i)}}),n.command("validate").description("Validate all dynamic command definitions in vault").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json","text").action(async e=>{let t=e.output||"text";k.setFormat(t);try{let r=(0,fs.resolve)(e.vault);if(!(0,us.existsSync)(r))throw new Ce(r);let i=rH(r);if(t==="json"){let s=Z.success({totalCommands:vS(r).length,totalIssues:i.reduce((a,o)=>a+o.issues.length,0),commandsWithIssues:i.length,issues:i});console.log(JSON.stringify(s,null,2))}else{let s=vS(r);if(i.length===0)console.log(`\u2705 All ${s.length} dynamic command(s) are valid.`);else{let a=i.reduce((o,l)=>o+l.issues.length,0);console.log(`\u274C Found ${a} issue(s) in ${i.length} command(s) out of ${s.length} total:
746
748
  `);for(let o of i){console.log(` \u{1F4C4} ${o.label} (${o.uid}):`);for(let l of o.issues)console.log(` \u2022 ${l}`);console.log()}process.exitCode=5}}}catch(r){k.handle(r)}}),n}c(QO,"dynamicCommandCommand");function vS(n){let e=[],t=[];wS(n,t);for(let{filePath:r,fm:i}of t){if(!Ml(i,"exocmd__Command"))continue;let s=i.exo__Asset_uid??"",a=i.exo__Asset_label??YO(r),o=i.exocmd__Command_category,l=i.exocmd__Command_icon,u=!!i.exocmd__Command_precondition,f=i.exocmd__Command_grounding,d;if(f){let h=Tg(String(f)),p=t.find(_=>_.fm.exo__Asset_uid===h&&Ml(_.fm,"exocmd__Grounding"));p&&(d=p.fm.exocmd__Grounding_type)}e.push({filePath:r,uid:s,label:a,category:o,icon:l,hasPrecondition:u,groundingType:d})}return e}c(vS,"scanCommands");async function tH(n,e){let{tripleStore:t}=await bS(n),r=new Mt.CommandResolver(t),i=await r.findBindings(),s=new Set;for(let o of i)s.add(o.commandRef);let a=[];for(let o of s){let l=await r.loadCommand(o);l&&a.push({filePath:"",uid:l.id,label:l.name,category:l.category,icon:l.icon,hasPrecondition:!!l.precondition,groundingType:l.grounding.type})}return a}c(tH,"listCommandsForTarget");function rH(n){let e=[],t=[];wS(n,t);let r=new Map;for(let i of t){let s=i.fm.exo__Asset_uid;s&&r.set(s,i)}for(let{filePath:i,fm:s}of t){if(!Ml(s,"exocmd__Command"))continue;let a=s.exo__Asset_uid??"",o=s.exo__Asset_label??YO(i),l=[];a||l.push("Missing exo__Asset_uid"),s.exo__Asset_label||l.push("Missing exo__Asset_label");let u=s.exocmd__Command_grounding;if(!u)l.push("Missing exocmd__Command_grounding (required)");else{let h=Tg(String(u)),p=r.get(h);if(!p)l.push(`Grounding reference "${h}" not found in vault`);else if(!Ml(p.fm,"exocmd__Grounding"))l.push(`Grounding reference "${h}" is not an exocmd__Grounding asset`);else{let _=p.fm,b=_.exocmd__Grounding_type;b?(Object.values(Mt.GroundingType).includes(b)||l.push(`Grounding "${h}" has invalid type "${b}"`),(b===Mt.GroundingType.PROPERTY_SET||b===Mt.GroundingType.PROPERTY_DELETE)&&!_.exocmd__Grounding_targetProperty&&l.push(`Grounding "${h}" (${b}) missing targetProperty`),b===Mt.GroundingType.PROPERTY_SET&&!_.exocmd__Grounding_targetValue&&l.push(`Grounding "${h}" (property_set) missing targetValue`),b===Mt.GroundingType.SERVICE_CALL&&((_.exocmd__Grounding_serviceId??_.exocmd__Grounding_targetProperty)||l.push(`Grounding "${h}" (service_call) missing serviceId and targetProperty`))):l.push(`Grounding "${h}" missing exocmd__Grounding_type`)}}let f=s.exocmd__Command_precondition;if(f){let h=Tg(String(f)),p=r.get(h);if(!p)l.push(`Precondition reference "${h}" not found in vault`);else if(!Ml(p.fm,"exocmd__Precondition"))l.push(`Precondition reference "${h}" is not an exocmd__Precondition asset`);else{let _=p.fm.exocmd__Precondition_sparqlAsk,b=p.fm.exocmd__Precondition_hostFunction;!_&&!b&&l.push(`Precondition "${h}" missing both sparqlAsk and hostFunction`)}}t.some(h=>Ml(h.fm,"exocmd__CommandBinding")?Tg(String(h.fm.exocmd__CommandBinding_command??""))===a:!1)||l.push("No CommandBinding references this command (command will be unused)"),l.length>0&&e.push({uid:a,label:o,filePath:i,issues:l})}return e}c(rH,"validateCommands");async function bS(n){let e=new hr(n),r=await new Mt.NoteToRDFConverter(e).convertVault(),i=new Mt.InMemoryTripleStore;return await i.addAll(r),{tripleStore:i}}c(bS,"buildTripleStore");function SS(n,e){if(console.log(`${e}ID: ${n.id}`),console.log(`${e}Label: ${n.label}`),console.log(`${e}Type: ${n.type}`),n.targetProperty&&console.log(`${e}Target property: ${n.targetProperty}`),n.targetValue!==void 0&&console.log(`${e}Target value: ${n.targetValue}`),n.sparqlUpdate&&console.log(`${e}SPARQL UPDATE: ${n.sparqlUpdate}`),n.steps&&n.steps.length>0){console.log(`${e}Steps (${n.steps.length}):`);for(let t=0;t<n.steps.length;t++)console.log(`${e} Step ${t+1}:`),SS(n.steps[t],e+" ")}}c(SS,"printGrounding");function wS(n,e){let t;try{t=(0,us.readdirSync)(n,{withFileTypes:!0})}catch{return}for(let r of t){let i=(0,fs.join)(n,r.name);if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;wS(i,e)}else if(r.name.endsWith(".md"))try{let s=(0,us.readFileSync)(i,"utf-8"),a=eH.parse(s);a.exists&&e.push({filePath:i,fm:nH(a.content)})}catch{}}}c(wS,"collectParsedFiles");function nH(n){let e={},t=n.split(`
747
- `),r="",i=null;for(let s of t){if(s.match(/^\s+-\s+/)&&r){let o=s.replace(/^\s+-\s+/,"").trim();i||(i=[]),i.push(o),e[r]=i;continue}let a=s.match(/^([a-zA-Z0-9_]+):\s*(.*)/);if(a){r=a[1],i=null;let o=a[2].trim();if((o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),o==="true"?o=!0:o==="false"&&(o=!1),o===""){e[r]=[],i=e[r];continue}e[r]=o}}return e}c(nH,"parseYamlFrontmatter");function Ml(n,e){let t=n.exo__Instance_class;if(!t)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}c(Ml,"hasClass");function Tg(n){if(typeof n!="string")return"";let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t>=0?e.substring(0,t).trim():e}c(Tg,"normalizeWikilink");function YO(n){return(0,fs.basename)(n,".md")}c(YO,"extractLabelFromFilename");function XO(n){n.addCommand(GR()),n.addCommand(YR()),n.addCommand(XR())}c(XO,"addQuerySubcommands");function KO(n){let e=new Le;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.100.0");let t=e.command("exoql").description("ExoQL query execution and cache management");XO(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return XO(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(iO()),e.addCommand(oO()),e.addCommand(cO()),e.addCommand(uO()),e.addCommand(fO()),e.addCommand(gO()),e.addCommand(bO()),e.addCommand(IO()),e.addCommand(OO()),e.addCommand(kO()),e.addCommand($O()),e.addCommand(VO()),e.addCommand(BO()),e.addCommand(QO()),e}c(KO,"createProgram");KO().parse();0&&(module.exports={createProgram});
749
+ `),r="",i=null;for(let s of t){if(s.match(/^\s+-\s+/)&&r){let o=s.replace(/^\s+-\s+/,"").trim();i||(i=[]),i.push(o),e[r]=i;continue}let a=s.match(/^([a-zA-Z0-9_]+):\s*(.*)/);if(a){r=a[1],i=null;let o=a[2].trim();if((o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),o==="true"?o=!0:o==="false"&&(o=!1),o===""){e[r]=[],i=e[r];continue}e[r]=o}}return e}c(nH,"parseYamlFrontmatter");function Ml(n,e){let t=n.exo__Instance_class;if(!t)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}c(Ml,"hasClass");function Tg(n){if(typeof n!="string")return"";let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t>=0?e.substring(0,t).trim():e}c(Tg,"normalizeWikilink");function YO(n){return(0,fs.basename)(n,".md")}c(YO,"extractLabelFromFilename");function XO(n){n.addCommand(GR()),n.addCommand(YR()),n.addCommand(XR())}c(XO,"addQuerySubcommands");function KO(n){let e=new Le;e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"15.100.1");let t=e.command("exoql").description("ExoQL query execution and cache management");XO(t);let r=e.command("sparql").description("(deprecated) Use 'exoql' instead");return XO(r),r.hook("preAction",()=>{console.error('\u26A0\uFE0F "sparql" is deprecated. Use "exoql" instead.')}),e.addCommand(iO()),e.addCommand(oO()),e.addCommand(cO()),e.addCommand(uO()),e.addCommand(fO()),e.addCommand(gO()),e.addCommand(bO()),e.addCommand(IO()),e.addCommand(OO()),e.addCommand(kO()),e.addCommand($O()),e.addCommand(VO()),e.addCommand(BO()),e.addCommand(QO()),e}c(KO,"createProgram");KO().parse();0&&(module.exports={createProgram});
748
750
  /*! Bundled license information:
749
751
 
750
752
  reflect-metadata/Reflect.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitelev/exocortex-cli",
3
- "version": "15.100.0",
3
+ "version": "15.100.1",
4
4
  "description": "CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more",
5
5
  "main": "dist/index.js",
6
6
  "bin": {