@kitelev/exocortex-cli 15.32.2 → 15.32.4
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/index.js +88 -88
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @kitelev/exocortex-cli v15.32.
|
|
2
|
+
// @kitelev/exocortex-cli v15.32.4
|
|
3
3
|
// CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
|
|
4
4
|
// License: MIT
|
|
5
5
|
|
|
6
|
-
"use strict";var vI=Object.create;var Fc=Object.defineProperty;var _I=Object.getOwnPropertyDescriptor;var bI=Object.getOwnPropertyNames;var SI=Object.getPrototypeOf,wI=Object.prototype.hasOwnProperty;var o=(n,e)=>Fc(n,"name",{value:e,configurable:!0});var EI=(n,e)=>()=>(n&&(e=n(n=0)),e);var v=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),s_=(n,e)=>{for(var t in e)Fc(n,t,{get:e[t],enumerable:!0})},a_=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bI(e))!wI.call(n,i)&&i!==t&&Fc(n,i,{get:()=>e[i],enumerable:!(r=_I(e,i))||r.enumerable});return n};var X=(n,e,t)=>(t=n!=null?vI(SI(n)):{},a_(e||!n||!n.__esModule?Fc(t,"default",{value:n,enumerable:!0}):t,n)),kp=n=>a_(Fc({},"__esModule",{value:!0}),n);var Pu=v(()=>{var o_;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(n);typeof t.Reflect<"u"&&(r=i(t.Reflect,r)),e(r,t),typeof t.Reflect>"u"&&(t.Reflect=n);function i(l,u){return function(f,h){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:h}),u&&u(f,h)}}o(i,"makeExporter");function s(){try{return Function("return this;")()}catch{}}o(s,"functionThis");function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}o(a,"indirectEvalThis");function c(){return s()||a()}o(c,"sloppyModeThis")})(function(e,t){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,f={create:c?function(){return Pe(Object.create(null))}:l?function(){return Pe({__proto__:null})}:function(){return Pe({})},has:u?function(S,w){return r.call(S,w)}:function(S,w){return w in S},get:u?function(S,w){return r.call(S,w)?S[w]:void 0}:function(S,w){return S[w]}},h=Object.getPrototypeOf(Function),d=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:me(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ge(),_=typeof WeakMap=="function"?WeakMap:$e(),b=i?Symbol.for("@reflect-metadata:registry"):void 0,E=he(),A=de(E);function C(S,w,T,P){if(B(T)){if(!Fe(S))throw new TypeError;if(!De(w))throw new TypeError;return dt(S,w)}else{if(!Fe(S))throw new TypeError;if(!J(w))throw new TypeError;if(!J(P)&&!B(P)&&!Te(P))throw new TypeError;return Te(P)&&(P=void 0),T=ye(T),nt(S,w,T,P)}}o(C,"decorate"),e("decorate",C);function M(S,w){function T(P,K){if(!J(P))throw new TypeError;if(!B(K)&&!je(K))throw new TypeError;te(S,w,P,K)}return o(T,"decorator"),T}o(M,"metadata"),e("metadata",M);function G(S,w,T,P){if(!J(T))throw new TypeError;return B(P)||(P=ye(P)),te(S,w,T,P)}o(G,"defineMetadata"),e("defineMetadata",G);function Q(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),vt(S,w,T)}o(Q,"hasMetadata"),e("hasMetadata",Q);function H(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),Ke(S,w,T)}o(H,"hasOwnMetadata"),e("hasOwnMetadata",H);function ee(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),Je(S,w,T)}o(ee,"getMetadata"),e("getMetadata",ee);function Se(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),Ue(S,w,T)}o(Se,"getOwnMetadata"),e("getOwnMetadata",Se);function N(S,w){if(!J(S))throw new TypeError;return B(w)||(w=ye(w)),$(S,w)}o(N,"getMetadataKeys"),e("getMetadataKeys",N);function Y(S,w){if(!J(S))throw new TypeError;return B(w)||(w=ye(w)),Ze(S,w)}o(Y,"getOwnMetadataKeys"),e("getOwnMetadataKeys",Y);function ge(S,w,T){if(!J(w))throw new TypeError;if(B(T)||(T=ye(T)),!J(w))throw new TypeError;B(T)||(T=ye(T));var P=ne(w,T,!1);return B(P)?!1:P.OrdinaryDeleteMetadata(S,w,T)}o(ge,"deleteMetadata"),e("deleteMetadata",ge);function dt(S,w){for(var T=S.length-1;T>=0;--T){var P=S[T],K=P(w);if(!B(K)&&!Te(K)){if(!De(K))throw new TypeError;w=K}}return w}o(dt,"DecorateConstructor");function nt(S,w,T,P){for(var K=S.length-1;K>=0;--K){var ot=S[K],pt=ot(w,T,P);if(!B(pt)&&!Te(pt)){if(!J(pt))throw new TypeError;P=pt}}return P}o(nt,"DecorateProperty");function vt(S,w,T){var P=Ke(S,w,T);if(P)return!0;var K=ie(w);return Te(K)?!1:vt(S,K,T)}o(vt,"OrdinaryHasMetadata");function Ke(S,w,T){var P=ne(w,T,!1);return B(P)?!1:Re(P.OrdinaryHasOwnMetadata(S,w,T))}o(Ke,"OrdinaryHasOwnMetadata");function Je(S,w,T){var P=Ke(S,w,T);if(P)return Ue(S,w,T);var K=ie(w);if(!Te(K))return Je(S,K,T)}o(Je,"OrdinaryGetMetadata");function Ue(S,w,T){var P=ne(w,T,!1);if(!B(P))return P.OrdinaryGetOwnMetadata(S,w,T)}o(Ue,"OrdinaryGetOwnMetadata");function te(S,w,T,P){var K=ne(T,P,!0);K.OrdinaryDefineOwnMetadata(S,w,T,P)}o(te,"OrdinaryDefineOwnMetadata");function $(S,w){var T=Ze(S,w),P=ie(S);if(P===null)return T;var K=$(P,w);if(K.length<=0)return T;if(T.length<=0)return K;for(var ot=new p,pt=[],Ce=0,V=T;Ce<V.length;Ce++){var U=V[Ce],q=ot.has(U);q||(ot.add(U),pt.push(U))}for(var z=0,Ee=K;z<Ee.length;z++){var U=Ee[z],q=ot.has(U);q||(ot.add(U),pt.push(U))}return pt}o($,"OrdinaryMetadataKeys");function Ze(S,w){var T=ne(S,w,!1);return T?T.OrdinaryOwnMetadataKeys(S,w):[]}o(Ze,"OrdinaryOwnMetadataKeys");function it(S){if(S===null)return 1;switch(typeof S){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return S===null?1:6;default:return 6}}o(it,"Type");function B(S){return S===void 0}o(B,"IsUndefined");function Te(S){return S===null}o(Te,"IsNull");function Ne(S){return typeof S=="symbol"}o(Ne,"IsSymbol");function J(S){return typeof S=="object"?S!==null:typeof S=="function"}o(J,"IsObject");function Le(S,w){switch(it(S)){case 0:return S;case 1:return S;case 2:return S;case 3:return S;case 4:return S;case 5:return S}var T=w===3?"string":w===5?"number":"default",P=le(S,s);if(P!==void 0){var K=P.call(S,T);if(J(K))throw new TypeError;return K}return ke(S,T==="default"?"number":T)}o(Le,"ToPrimitive");function ke(S,w){if(w==="string"){var T=S.toString;if(xe(T)){var P=T.call(S);if(!J(P))return P}var K=S.valueOf;if(xe(K)){var P=K.call(S);if(!J(P))return P}}else{var K=S.valueOf;if(xe(K)){var P=K.call(S);if(!J(P))return P}var ot=S.toString;if(xe(ot)){var P=ot.call(S);if(!J(P))return P}}throw new TypeError}o(ke,"OrdinaryToPrimitive");function Re(S){return!!S}o(Re,"ToBoolean");function Me(S){return""+S}o(Me,"ToString");function ye(S){var w=Le(S,3);return Ne(w)?w:Me(w)}o(ye,"ToPropertyKey");function Fe(S){return Array.isArray?Array.isArray(S):S instanceof Object?S instanceof Array:Object.prototype.toString.call(S)==="[object Array]"}o(Fe,"IsArray");function xe(S){return typeof S=="function"}o(xe,"IsCallable");function De(S){return typeof S=="function"}o(De,"IsConstructor");function je(S){switch(it(S)){case 3:return!0;case 4:return!0;default:return!1}}o(je,"IsPropertyKey");function se(S,w){return S===w||S!==S&&w!==w}o(se,"SameValueZero");function le(S,w){var T=S[w];if(T!=null){if(!xe(T))throw new TypeError;return T}}o(le,"GetMethod");function ue(S){var w=le(S,a);if(!xe(w))throw new TypeError;var T=w.call(S);if(!J(T))throw new TypeError;return T}o(ue,"GetIterator");function ae(S){return S.value}o(ae,"IteratorValue");function oe(S){var w=S.next();return w.done?!1:w}o(oe,"IteratorStep");function ce(S){var w=S.return;w&&w.call(S)}o(ce,"IteratorClose");function ie(S){var w=Object.getPrototypeOf(S);if(typeof S!="function"||S===h||w!==h)return w;var T=S.prototype,P=T&&Object.getPrototypeOf(T);if(P==null||P===Object.prototype)return w;var K=P.constructor;return typeof K!="function"||K===S?w:K}o(ie,"OrdinaryGetPrototypeOf");function fe(){var S;!B(b)&&typeof t.Reflect<"u"&&!(b in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(S=pe(t.Reflect));var w,T,P,K=new _,ot={registerProvider:pt,getProvider:V,setProvider:q};return ot;function pt(z){if(!Object.isExtensible(ot))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case S===z:break;case B(w):w=z;break;case w===z:break;case B(T):T=z;break;case T===z:break;default:P===void 0&&(P=new p),P.add(z);break}}function Ce(z,Ee){if(!B(w)){if(w.isProviderFor(z,Ee))return w;if(!B(T)){if(T.isProviderFor(z,Ee))return w;if(!B(P))for(var He=ue(P);;){var ze=oe(He);if(!ze)return;var Jt=ae(ze);if(Jt.isProviderFor(z,Ee))return ce(He),Jt}}}if(!B(S)&&S.isProviderFor(z,Ee))return S}function V(z,Ee){var He=K.get(z),ze;return B(He)||(ze=He.get(Ee)),B(ze)&&(ze=Ce(z,Ee),B(ze)||(B(He)&&(He=new d,K.set(z,He)),He.set(Ee,ze))),ze}function U(z){if(B(z))throw new TypeError;return w===z||T===z||!B(P)&&P.has(z)}function q(z,Ee,He){if(!U(He))throw new Error("Metadata provider not registered.");var ze=V(z,Ee);if(ze!==He){if(!B(ze))return!1;var Jt=K.get(z);B(Jt)&&(Jt=new d,K.set(z,Jt)),Jt.set(Ee,He)}return!0}}o(fe,"CreateMetadataRegistry");function he(){var S;return!B(b)&&J(t.Reflect)&&Object.isExtensible(t.Reflect)&&(S=t.Reflect[b]),B(S)&&(S=fe()),!B(b)&&J(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,b,{enumerable:!1,configurable:!1,writable:!1,value:S}),S}o(he,"GetOrCreateMetadataRegistry");function de(S){var w=new _,T={isProviderFor:o(function(U,q){var z=w.get(U);return B(z)?!1:z.has(q)},"isProviderFor"),OrdinaryDefineOwnMetadata:pt,OrdinaryHasOwnMetadata:K,OrdinaryGetOwnMetadata:ot,OrdinaryOwnMetadataKeys:Ce,OrdinaryDeleteMetadata:V};return E.registerProvider(T),T;function P(U,q,z){var Ee=w.get(U),He=!1;if(B(Ee)){if(!z)return;Ee=new d,w.set(U,Ee),He=!0}var ze=Ee.get(q);if(B(ze)){if(!z)return;if(ze=new d,Ee.set(q,ze),!S.setProvider(U,q,T))throw Ee.delete(q),He&&w.delete(U),new Error("Wrong provider for target.")}return ze}o(P,"GetOrCreateMetadataMap");function K(U,q,z){var Ee=P(q,z,!1);return B(Ee)?!1:Re(Ee.has(U))}o(K,"OrdinaryHasOwnMetadata");function ot(U,q,z){var Ee=P(q,z,!1);if(!B(Ee))return Ee.get(U)}o(ot,"OrdinaryGetOwnMetadata");function pt(U,q,z,Ee){var He=P(z,Ee,!0);He.set(U,q)}o(pt,"OrdinaryDefineOwnMetadata");function Ce(U,q){var z=[],Ee=P(U,q,!1);if(B(Ee))return z;for(var He=Ee.keys(),ze=ue(He),Jt=0;;){var Br=oe(ze);if(!Br)return z.length=Jt,z;var Jr=ae(Br);try{z[Jt]=Jr}catch(xr){try{ce(ze)}finally{throw xr}}Jt++}}o(Ce,"OrdinaryOwnMetadataKeys");function V(U,q,z){var Ee=P(q,z,!1);if(B(Ee)||!Ee.delete(U))return!1;if(Ee.size===0){var He=w.get(q);B(He)||(He.delete(z),He.size===0&&w.delete(He))}return!0}o(V,"OrdinaryDeleteMetadata")}o(de,"CreateMetadataProvider");function pe(S){var w=S.defineMetadata,T=S.hasOwnMetadata,P=S.getOwnMetadata,K=S.getOwnMetadataKeys,ot=S.deleteMetadata,pt=new _,Ce={isProviderFor:o(function(V,U){var q=pt.get(V);return!B(q)&&q.has(U)?!0:K(V,U).length?(B(q)&&(q=new p,pt.set(V,q)),q.add(U),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:w,OrdinaryHasOwnMetadata:T,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:K,OrdinaryDeleteMetadata:ot};return Ce}o(pe,"CreateFallbackProvider");function ne(S,w,T){var P=E.getProvider(S,w);if(!B(P))return P;if(T){if(E.setProvider(S,w,A))return A;throw new Error("Illegal state.")}}o(ne,"GetMetadataProvider");function me(){var S={},w=[],T=(function(){function Ce(V,U,q){this._index=0,this._keys=V,this._values=U,this._selector=q}return o(Ce,"MapIterator"),Ce.prototype["@@iterator"]=function(){return this},Ce.prototype[a]=function(){return this},Ce.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var U=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=w,this._values=w):this._index++,{value:U,done:!1}}return{value:void 0,done:!0}},Ce.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=w,this._values=w),V},Ce.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=w,this._values=w),{value:V,done:!0}},Ce})(),P=(function(){function Ce(){this._keys=[],this._values=[],this._cacheKey=S,this._cacheIndex=-2}return o(Ce,"Map"),Object.defineProperty(Ce.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),Ce.prototype.has=function(V){return this._find(V,!1)>=0},Ce.prototype.get=function(V){var U=this._find(V,!1);return U>=0?this._values[U]:void 0},Ce.prototype.set=function(V,U){var q=this._find(V,!0);return this._values[q]=U,this},Ce.prototype.delete=function(V){var U=this._find(V,!1);if(U>=0){for(var q=this._keys.length,z=U+1;z<q;z++)this._keys[z-1]=this._keys[z],this._values[z-1]=this._values[z];return this._keys.length--,this._values.length--,se(V,this._cacheKey)&&(this._cacheKey=S,this._cacheIndex=-2),!0}return!1},Ce.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=S,this._cacheIndex=-2},Ce.prototype.keys=function(){return new T(this._keys,this._values,K)},Ce.prototype.values=function(){return new T(this._keys,this._values,ot)},Ce.prototype.entries=function(){return new T(this._keys,this._values,pt)},Ce.prototype["@@iterator"]=function(){return this.entries()},Ce.prototype[a]=function(){return this.entries()},Ce.prototype._find=function(V,U){if(!se(this._cacheKey,V)){this._cacheIndex=-1;for(var q=0;q<this._keys.length;q++)if(se(this._keys[q],V)){this._cacheIndex=q;break}}return this._cacheIndex<0&&U&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},Ce})();return P;function K(Ce,V){return Ce}function ot(Ce,V){return V}function pt(Ce,V){return[Ce,V]}}o(me,"CreateMapPolyfill");function Ge(){var S=(function(){function w(){this._map=new d}return o(w,"Set"),Object.defineProperty(w.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),w.prototype.has=function(T){return this._map.has(T)},w.prototype.add=function(T){return this._map.set(T,T),this},w.prototype.delete=function(T){return this._map.delete(T)},w.prototype.clear=function(){this._map.clear()},w.prototype.keys=function(){return this._map.keys()},w.prototype.values=function(){return this._map.keys()},w.prototype.entries=function(){return this._map.entries()},w.prototype["@@iterator"]=function(){return this.keys()},w.prototype[a]=function(){return this.keys()},w})();return S}o(Ge,"CreateSetPolyfill");function $e(){var S=16,w=f.create(),T=P();return(function(){function V(){this._key=P()}return o(V,"WeakMap"),V.prototype.has=function(U){var q=K(U,!1);return q!==void 0?f.has(q,this._key):!1},V.prototype.get=function(U){var q=K(U,!1);return q!==void 0?f.get(q,this._key):void 0},V.prototype.set=function(U,q){var z=K(U,!0);return z[this._key]=q,this},V.prototype.delete=function(U){var q=K(U,!1);return q!==void 0?delete q[this._key]:!1},V.prototype.clear=function(){this._key=P()},V})();function P(){var V;do V="@@WeakMap@@"+Ce();while(f.has(w,V));return w[V]=!0,V}function K(V,U){if(!r.call(V,T)){if(!U)return;Object.defineProperty(V,T,{value:f.create()})}return V[T]}function ot(V,U){for(var q=0;q<U;++q)V[q]=Math.random()*255|0;return V}function pt(V){if(typeof Uint8Array=="function"){var U=new Uint8Array(V);return typeof crypto<"u"?crypto.getRandomValues(U):typeof msCrypto<"u"?msCrypto.getRandomValues(U):ot(U,V),U}return ot(new Array(V),V)}function Ce(){var V=pt(S);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var U="",q=0;q<S;++q){var z=V[q];(q===4||q===6||q===8)&&(U+="-"),z<16&&(U+="0"),U+=z.toString(16).toLowerCase()}return U}}o($e,"CreateWeakMapPolyfill");function Pe(S){return S.__=void 0,delete S.__,S}o(Pe,"MakeDictionary")})})(o_||(o_={}))});var Dc=v(jp=>{var Ru=class extends Error{static{o(this,"CommanderError")}constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Mp=class extends Ru{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};jp.CommanderError=Ru;jp.InvalidArgumentError=Mp});var Fu=v(Vp=>{var{InvalidArgumentError:TI}=Dc(),$p=class{static{o(this,"Argument")}constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new TI(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function xI(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(xI,"humanReadableArgName");Vp.Argument=$p;Vp.humanReadableArgName=xI});var qp=v(Bp=>{var{humanReadableArgName:AI}=Fu(),Up=class{static{o(this,"Help")}constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let r=o(i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,""),"getSortKey");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),r=e._getHelpOption();if(r&&!r.hidden){let i=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!i&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!i&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let i=r.options.filter(s=>!s.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>AI(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[])}),t.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[]),i.get(a).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(h,d){return t.formatItem(h,r,d,t)}o(s,"callFormatItem");let a=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(h=>s(t.styleArgumentTerm(t.argumentTerm(h)),t.styleArgumentDescription(t.argumentDescription(h))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),h=>h.helpGroupHeading??"Options:").forEach((h,d)=>{let p=h.map(_=>s(t.styleOptionTerm(t.optionTerm(_)),t.styleOptionDescription(t.optionDescription(_))));a=a.concat(this.formatItemList(d,p,t))}),t.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(d=>s(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",h,t))}return this.groupItems(e.commands,t.visibleCommands(e),h=>h.helpGroup()||"Commands:").forEach((h,d)=>{let p=h.map(_=>s(t.styleSubcommandTerm(t.subcommandTerm(_)),t.styleSubcommandDescription(t.subcommandDescription(_))));a=a.concat(this.formatItemList(d,p,t))}),a.join(`
|
|
6
|
+
"use strict";var vI=Object.create;var Fc=Object.defineProperty;var _I=Object.getOwnPropertyDescriptor;var bI=Object.getOwnPropertyNames;var SI=Object.getPrototypeOf,wI=Object.prototype.hasOwnProperty;var o=(n,e)=>Fc(n,"name",{value:e,configurable:!0});var EI=(n,e)=>()=>(n&&(e=n(n=0)),e);var v=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),s_=(n,e)=>{for(var t in e)Fc(n,t,{get:e[t],enumerable:!0})},a_=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bI(e))!wI.call(n,i)&&i!==t&&Fc(n,i,{get:()=>e[i],enumerable:!(r=_I(e,i))||r.enumerable});return n};var X=(n,e,t)=>(t=n!=null?vI(SI(n)):{},a_(e||!n||!n.__esModule?Fc(t,"default",{value:n,enumerable:!0}):t,n)),kp=n=>a_(Fc({},"__esModule",{value:!0}),n);var Pu=v(()=>{var o_;(function(n){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:c(),r=i(n);typeof t.Reflect<"u"&&(r=i(t.Reflect,r)),e(r,t),typeof t.Reflect>"u"&&(t.Reflect=n);function i(l,u){return function(f,h){Object.defineProperty(l,f,{configurable:!0,writable:!0,value:h}),u&&u(f,h)}}o(i,"makeExporter");function s(){try{return Function("return this;")()}catch{}}o(s,"functionThis");function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}o(a,"indirectEvalThis");function c(){return s()||a()}o(c,"sloppyModeThis")})(function(e,t){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!c&&!l,f={create:c?function(){return Pe(Object.create(null))}:l?function(){return Pe({__proto__:null})}:function(){return Pe({})},has:u?function(S,w){return r.call(S,w)}:function(S,w){return w in S},get:u?function(S,w){return r.call(S,w)?S[w]:void 0}:function(S,w){return S[w]}},h=Object.getPrototypeOf(Function),d=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:me(),p=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ge(),_=typeof WeakMap=="function"?WeakMap:$e(),b=i?Symbol.for("@reflect-metadata:registry"):void 0,E=he(),A=de(E);function C(S,w,T,P){if(B(T)){if(!Fe(S))throw new TypeError;if(!De(w))throw new TypeError;return dt(S,w)}else{if(!Fe(S))throw new TypeError;if(!J(w))throw new TypeError;if(!J(P)&&!B(P)&&!Te(P))throw new TypeError;return Te(P)&&(P=void 0),T=ye(T),nt(S,w,T,P)}}o(C,"decorate"),e("decorate",C);function j(S,w){function T(P,K){if(!J(P))throw new TypeError;if(!B(K)&&!je(K))throw new TypeError;te(S,w,P,K)}return o(T,"decorator"),T}o(j,"metadata"),e("metadata",j);function G(S,w,T,P){if(!J(T))throw new TypeError;return B(P)||(P=ye(P)),te(S,w,T,P)}o(G,"defineMetadata"),e("defineMetadata",G);function Q(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),vt(S,w,T)}o(Q,"hasMetadata"),e("hasMetadata",Q);function H(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),Ke(S,w,T)}o(H,"hasOwnMetadata"),e("hasOwnMetadata",H);function ee(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),Je(S,w,T)}o(ee,"getMetadata"),e("getMetadata",ee);function Se(S,w,T){if(!J(w))throw new TypeError;return B(T)||(T=ye(T)),Ue(S,w,T)}o(Se,"getOwnMetadata"),e("getOwnMetadata",Se);function L(S,w){if(!J(S))throw new TypeError;return B(w)||(w=ye(w)),$(S,w)}o(L,"getMetadataKeys"),e("getMetadataKeys",L);function Y(S,w){if(!J(S))throw new TypeError;return B(w)||(w=ye(w)),Ze(S,w)}o(Y,"getOwnMetadataKeys"),e("getOwnMetadataKeys",Y);function ge(S,w,T){if(!J(w))throw new TypeError;if(B(T)||(T=ye(T)),!J(w))throw new TypeError;B(T)||(T=ye(T));var P=ne(w,T,!1);return B(P)?!1:P.OrdinaryDeleteMetadata(S,w,T)}o(ge,"deleteMetadata"),e("deleteMetadata",ge);function dt(S,w){for(var T=S.length-1;T>=0;--T){var P=S[T],K=P(w);if(!B(K)&&!Te(K)){if(!De(K))throw new TypeError;w=K}}return w}o(dt,"DecorateConstructor");function nt(S,w,T,P){for(var K=S.length-1;K>=0;--K){var ot=S[K],pt=ot(w,T,P);if(!B(pt)&&!Te(pt)){if(!J(pt))throw new TypeError;P=pt}}return P}o(nt,"DecorateProperty");function vt(S,w,T){var P=Ke(S,w,T);if(P)return!0;var K=ie(w);return Te(K)?!1:vt(S,K,T)}o(vt,"OrdinaryHasMetadata");function Ke(S,w,T){var P=ne(w,T,!1);return B(P)?!1:Re(P.OrdinaryHasOwnMetadata(S,w,T))}o(Ke,"OrdinaryHasOwnMetadata");function Je(S,w,T){var P=Ke(S,w,T);if(P)return Ue(S,w,T);var K=ie(w);if(!Te(K))return Je(S,K,T)}o(Je,"OrdinaryGetMetadata");function Ue(S,w,T){var P=ne(w,T,!1);if(!B(P))return P.OrdinaryGetOwnMetadata(S,w,T)}o(Ue,"OrdinaryGetOwnMetadata");function te(S,w,T,P){var K=ne(T,P,!0);K.OrdinaryDefineOwnMetadata(S,w,T,P)}o(te,"OrdinaryDefineOwnMetadata");function $(S,w){var T=Ze(S,w),P=ie(S);if(P===null)return T;var K=$(P,w);if(K.length<=0)return T;if(T.length<=0)return K;for(var ot=new p,pt=[],Ce=0,V=T;Ce<V.length;Ce++){var U=V[Ce],q=ot.has(U);q||(ot.add(U),pt.push(U))}for(var z=0,Ee=K;z<Ee.length;z++){var U=Ee[z],q=ot.has(U);q||(ot.add(U),pt.push(U))}return pt}o($,"OrdinaryMetadataKeys");function Ze(S,w){var T=ne(S,w,!1);return T?T.OrdinaryOwnMetadataKeys(S,w):[]}o(Ze,"OrdinaryOwnMetadataKeys");function it(S){if(S===null)return 1;switch(typeof S){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return S===null?1:6;default:return 6}}o(it,"Type");function B(S){return S===void 0}o(B,"IsUndefined");function Te(S){return S===null}o(Te,"IsNull");function Ne(S){return typeof S=="symbol"}o(Ne,"IsSymbol");function J(S){return typeof S=="object"?S!==null:typeof S=="function"}o(J,"IsObject");function Le(S,w){switch(it(S)){case 0:return S;case 1:return S;case 2:return S;case 3:return S;case 4:return S;case 5:return S}var T=w===3?"string":w===5?"number":"default",P=le(S,s);if(P!==void 0){var K=P.call(S,T);if(J(K))throw new TypeError;return K}return ke(S,T==="default"?"number":T)}o(Le,"ToPrimitive");function ke(S,w){if(w==="string"){var T=S.toString;if(xe(T)){var P=T.call(S);if(!J(P))return P}var K=S.valueOf;if(xe(K)){var P=K.call(S);if(!J(P))return P}}else{var K=S.valueOf;if(xe(K)){var P=K.call(S);if(!J(P))return P}var ot=S.toString;if(xe(ot)){var P=ot.call(S);if(!J(P))return P}}throw new TypeError}o(ke,"OrdinaryToPrimitive");function Re(S){return!!S}o(Re,"ToBoolean");function Me(S){return""+S}o(Me,"ToString");function ye(S){var w=Le(S,3);return Ne(w)?w:Me(w)}o(ye,"ToPropertyKey");function Fe(S){return Array.isArray?Array.isArray(S):S instanceof Object?S instanceof Array:Object.prototype.toString.call(S)==="[object Array]"}o(Fe,"IsArray");function xe(S){return typeof S=="function"}o(xe,"IsCallable");function De(S){return typeof S=="function"}o(De,"IsConstructor");function je(S){switch(it(S)){case 3:return!0;case 4:return!0;default:return!1}}o(je,"IsPropertyKey");function se(S,w){return S===w||S!==S&&w!==w}o(se,"SameValueZero");function le(S,w){var T=S[w];if(T!=null){if(!xe(T))throw new TypeError;return T}}o(le,"GetMethod");function ue(S){var w=le(S,a);if(!xe(w))throw new TypeError;var T=w.call(S);if(!J(T))throw new TypeError;return T}o(ue,"GetIterator");function ae(S){return S.value}o(ae,"IteratorValue");function oe(S){var w=S.next();return w.done?!1:w}o(oe,"IteratorStep");function ce(S){var w=S.return;w&&w.call(S)}o(ce,"IteratorClose");function ie(S){var w=Object.getPrototypeOf(S);if(typeof S!="function"||S===h||w!==h)return w;var T=S.prototype,P=T&&Object.getPrototypeOf(T);if(P==null||P===Object.prototype)return w;var K=P.constructor;return typeof K!="function"||K===S?w:K}o(ie,"OrdinaryGetPrototypeOf");function fe(){var S;!B(b)&&typeof t.Reflect<"u"&&!(b in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(S=pe(t.Reflect));var w,T,P,K=new _,ot={registerProvider:pt,getProvider:V,setProvider:q};return ot;function pt(z){if(!Object.isExtensible(ot))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case S===z:break;case B(w):w=z;break;case w===z:break;case B(T):T=z;break;case T===z:break;default:P===void 0&&(P=new p),P.add(z);break}}function Ce(z,Ee){if(!B(w)){if(w.isProviderFor(z,Ee))return w;if(!B(T)){if(T.isProviderFor(z,Ee))return w;if(!B(P))for(var He=ue(P);;){var ze=oe(He);if(!ze)return;var Jt=ae(ze);if(Jt.isProviderFor(z,Ee))return ce(He),Jt}}}if(!B(S)&&S.isProviderFor(z,Ee))return S}function V(z,Ee){var He=K.get(z),ze;return B(He)||(ze=He.get(Ee)),B(ze)&&(ze=Ce(z,Ee),B(ze)||(B(He)&&(He=new d,K.set(z,He)),He.set(Ee,ze))),ze}function U(z){if(B(z))throw new TypeError;return w===z||T===z||!B(P)&&P.has(z)}function q(z,Ee,He){if(!U(He))throw new Error("Metadata provider not registered.");var ze=V(z,Ee);if(ze!==He){if(!B(ze))return!1;var Jt=K.get(z);B(Jt)&&(Jt=new d,K.set(z,Jt)),Jt.set(Ee,He)}return!0}}o(fe,"CreateMetadataRegistry");function he(){var S;return!B(b)&&J(t.Reflect)&&Object.isExtensible(t.Reflect)&&(S=t.Reflect[b]),B(S)&&(S=fe()),!B(b)&&J(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,b,{enumerable:!1,configurable:!1,writable:!1,value:S}),S}o(he,"GetOrCreateMetadataRegistry");function de(S){var w=new _,T={isProviderFor:o(function(U,q){var z=w.get(U);return B(z)?!1:z.has(q)},"isProviderFor"),OrdinaryDefineOwnMetadata:pt,OrdinaryHasOwnMetadata:K,OrdinaryGetOwnMetadata:ot,OrdinaryOwnMetadataKeys:Ce,OrdinaryDeleteMetadata:V};return E.registerProvider(T),T;function P(U,q,z){var Ee=w.get(U),He=!1;if(B(Ee)){if(!z)return;Ee=new d,w.set(U,Ee),He=!0}var ze=Ee.get(q);if(B(ze)){if(!z)return;if(ze=new d,Ee.set(q,ze),!S.setProvider(U,q,T))throw Ee.delete(q),He&&w.delete(U),new Error("Wrong provider for target.")}return ze}o(P,"GetOrCreateMetadataMap");function K(U,q,z){var Ee=P(q,z,!1);return B(Ee)?!1:Re(Ee.has(U))}o(K,"OrdinaryHasOwnMetadata");function ot(U,q,z){var Ee=P(q,z,!1);if(!B(Ee))return Ee.get(U)}o(ot,"OrdinaryGetOwnMetadata");function pt(U,q,z,Ee){var He=P(z,Ee,!0);He.set(U,q)}o(pt,"OrdinaryDefineOwnMetadata");function Ce(U,q){var z=[],Ee=P(U,q,!1);if(B(Ee))return z;for(var He=Ee.keys(),ze=ue(He),Jt=0;;){var Br=oe(ze);if(!Br)return z.length=Jt,z;var Jr=ae(Br);try{z[Jt]=Jr}catch(xr){try{ce(ze)}finally{throw xr}}Jt++}}o(Ce,"OrdinaryOwnMetadataKeys");function V(U,q,z){var Ee=P(q,z,!1);if(B(Ee)||!Ee.delete(U))return!1;if(Ee.size===0){var He=w.get(q);B(He)||(He.delete(z),He.size===0&&w.delete(He))}return!0}o(V,"OrdinaryDeleteMetadata")}o(de,"CreateMetadataProvider");function pe(S){var w=S.defineMetadata,T=S.hasOwnMetadata,P=S.getOwnMetadata,K=S.getOwnMetadataKeys,ot=S.deleteMetadata,pt=new _,Ce={isProviderFor:o(function(V,U){var q=pt.get(V);return!B(q)&&q.has(U)?!0:K(V,U).length?(B(q)&&(q=new p,pt.set(V,q)),q.add(U),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:w,OrdinaryHasOwnMetadata:T,OrdinaryGetOwnMetadata:P,OrdinaryOwnMetadataKeys:K,OrdinaryDeleteMetadata:ot};return Ce}o(pe,"CreateFallbackProvider");function ne(S,w,T){var P=E.getProvider(S,w);if(!B(P))return P;if(T){if(E.setProvider(S,w,A))return A;throw new Error("Illegal state.")}}o(ne,"GetMetadataProvider");function me(){var S={},w=[],T=(function(){function Ce(V,U,q){this._index=0,this._keys=V,this._values=U,this._selector=q}return o(Ce,"MapIterator"),Ce.prototype["@@iterator"]=function(){return this},Ce.prototype[a]=function(){return this},Ce.prototype.next=function(){var V=this._index;if(V>=0&&V<this._keys.length){var U=this._selector(this._keys[V],this._values[V]);return V+1>=this._keys.length?(this._index=-1,this._keys=w,this._values=w):this._index++,{value:U,done:!1}}return{value:void 0,done:!0}},Ce.prototype.throw=function(V){throw this._index>=0&&(this._index=-1,this._keys=w,this._values=w),V},Ce.prototype.return=function(V){return this._index>=0&&(this._index=-1,this._keys=w,this._values=w),{value:V,done:!0}},Ce})(),P=(function(){function Ce(){this._keys=[],this._values=[],this._cacheKey=S,this._cacheIndex=-2}return o(Ce,"Map"),Object.defineProperty(Ce.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),Ce.prototype.has=function(V){return this._find(V,!1)>=0},Ce.prototype.get=function(V){var U=this._find(V,!1);return U>=0?this._values[U]:void 0},Ce.prototype.set=function(V,U){var q=this._find(V,!0);return this._values[q]=U,this},Ce.prototype.delete=function(V){var U=this._find(V,!1);if(U>=0){for(var q=this._keys.length,z=U+1;z<q;z++)this._keys[z-1]=this._keys[z],this._values[z-1]=this._values[z];return this._keys.length--,this._values.length--,se(V,this._cacheKey)&&(this._cacheKey=S,this._cacheIndex=-2),!0}return!1},Ce.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=S,this._cacheIndex=-2},Ce.prototype.keys=function(){return new T(this._keys,this._values,K)},Ce.prototype.values=function(){return new T(this._keys,this._values,ot)},Ce.prototype.entries=function(){return new T(this._keys,this._values,pt)},Ce.prototype["@@iterator"]=function(){return this.entries()},Ce.prototype[a]=function(){return this.entries()},Ce.prototype._find=function(V,U){if(!se(this._cacheKey,V)){this._cacheIndex=-1;for(var q=0;q<this._keys.length;q++)if(se(this._keys[q],V)){this._cacheIndex=q;break}}return this._cacheIndex<0&&U&&(this._cacheIndex=this._keys.length,this._keys.push(V),this._values.push(void 0)),this._cacheIndex},Ce})();return P;function K(Ce,V){return Ce}function ot(Ce,V){return V}function pt(Ce,V){return[Ce,V]}}o(me,"CreateMapPolyfill");function Ge(){var S=(function(){function w(){this._map=new d}return o(w,"Set"),Object.defineProperty(w.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),w.prototype.has=function(T){return this._map.has(T)},w.prototype.add=function(T){return this._map.set(T,T),this},w.prototype.delete=function(T){return this._map.delete(T)},w.prototype.clear=function(){this._map.clear()},w.prototype.keys=function(){return this._map.keys()},w.prototype.values=function(){return this._map.keys()},w.prototype.entries=function(){return this._map.entries()},w.prototype["@@iterator"]=function(){return this.keys()},w.prototype[a]=function(){return this.keys()},w})();return S}o(Ge,"CreateSetPolyfill");function $e(){var S=16,w=f.create(),T=P();return(function(){function V(){this._key=P()}return o(V,"WeakMap"),V.prototype.has=function(U){var q=K(U,!1);return q!==void 0?f.has(q,this._key):!1},V.prototype.get=function(U){var q=K(U,!1);return q!==void 0?f.get(q,this._key):void 0},V.prototype.set=function(U,q){var z=K(U,!0);return z[this._key]=q,this},V.prototype.delete=function(U){var q=K(U,!1);return q!==void 0?delete q[this._key]:!1},V.prototype.clear=function(){this._key=P()},V})();function P(){var V;do V="@@WeakMap@@"+Ce();while(f.has(w,V));return w[V]=!0,V}function K(V,U){if(!r.call(V,T)){if(!U)return;Object.defineProperty(V,T,{value:f.create()})}return V[T]}function ot(V,U){for(var q=0;q<U;++q)V[q]=Math.random()*255|0;return V}function pt(V){if(typeof Uint8Array=="function"){var U=new Uint8Array(V);return typeof crypto<"u"?crypto.getRandomValues(U):typeof msCrypto<"u"?msCrypto.getRandomValues(U):ot(U,V),U}return ot(new Array(V),V)}function Ce(){var V=pt(S);V[6]=V[6]&79|64,V[8]=V[8]&191|128;for(var U="",q=0;q<S;++q){var z=V[q];(q===4||q===6||q===8)&&(U+="-"),z<16&&(U+="0"),U+=z.toString(16).toLowerCase()}return U}}o($e,"CreateWeakMapPolyfill");function Pe(S){return S.__=void 0,delete S.__,S}o(Pe,"MakeDictionary")})})(o_||(o_={}))});var Dc=v(jp=>{var Ru=class extends Error{static{o(this,"CommanderError")}constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Mp=class extends Ru{static{o(this,"InvalidArgumentError")}constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};jp.CommanderError=Ru;jp.InvalidArgumentError=Mp});var Fu=v(Vp=>{var{InvalidArgumentError:TI}=Dc(),$p=class{static{o(this,"Argument")}constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new TI(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function xI(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}o(xI,"humanReadableArgName");Vp.Argument=$p;Vp.humanReadableArgName=xI});var qp=v(Bp=>{var{humanReadableArgName:AI}=Fu(),Up=class{static{o(this,"Help")}constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((i,s)=>i.name().localeCompare(s.name())),t}compareOptions(e,t){let r=o(i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,""),"getSortKey");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),r=e._getHelpOption();if(r&&!r.hidden){let i=r.short&&e._findOption(r.short),s=r.long&&e._findOption(r.long);!i&&!s?t.push(r):r.long&&!s?t.push(e.createOption(r.long,r.description)):r.short&&!i&&t.push(e.createOption(r.short,r.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let i=r.options.filter(s=>!s.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>AI(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[])}),t.forEach(s=>{let a=r(s);i.has(a)||i.set(a,[]),i.get(a).push(s)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function s(h,d){return t.formatItem(h,r,d,t)}o(s,"callFormatItem");let a=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],c=t.commandDescription(e);c.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(c),i),""]));let l=t.visibleArguments(e).map(h=>s(t.styleArgumentTerm(t.argumentTerm(h)),t.styleArgumentDescription(t.argumentDescription(h))));if(a=a.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),h=>h.helpGroupHeading??"Options:").forEach((h,d)=>{let p=h.map(_=>s(t.styleOptionTerm(t.optionTerm(_)),t.styleOptionDescription(t.optionDescription(_))));a=a.concat(this.formatItemList(d,p,t))}),t.showGlobalOptions){let h=t.visibleGlobalOptions(e).map(d=>s(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",h,t))}return this.groupItems(e.commands,t.visibleCommands(e),h=>h.helpGroup()||"Commands:").forEach((h,d)=>{let p=h.map(_=>s(t.styleSubcommandTerm(t.subcommandTerm(_)),t.styleSubcommandDescription(t.subcommandDescription(_))));a=a.concat(this.formatItemList(d,p,t))}),a.join(`
|
|
7
7
|
`)}displayWidth(e){return c_(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,r,i){let a=" ".repeat(2);if(!r)return a+e;let c=e.padEnd(t+e.length-i.displayWidth(e)),l=2,f=(this.helpWidth??80)-t-l-2,h;return f<this.minWidthToWrap||i.preformatted(r)?h=r:h=i.boxWrap(r,f).replace(/\n/g,`
|
|
8
8
|
`+" ".repeat(t+l)),a+c+" ".repeat(l)+h.replace(/\n/g,`
|
|
9
9
|
${a}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,s=[];return r.forEach(a=>{let c=a.match(i);if(c===null){s.push("");return}let l=[c.shift()],u=this.displayWidth(l[0]);c.forEach(f=>{let h=this.displayWidth(f);if(u+h<=t){l.push(f),u+=h;return}s.push(l.join(""));let d=f.trimStart();l=[d],u=this.displayWidth(d)}),s.push(l.join(""))}),s.join(`
|
|
@@ -28,7 +28,7 @@ Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
28
28
|
`),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,s=r.code||"commander.error";this._exit(i,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in Ye.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,Ye.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new kI(this.options),t=o(r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r)),"hasCustomOptionValue");this.options.filter(r=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,r.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=o(a=>{let c=a.attributeName(),l=this.getOptionValue(c),u=this.options.find(h=>h.negate&&c===h.attributeName()),f=this.options.find(h=>!h.negate&&c===h.attributeName());return u&&(u.presetArg===void 0&&l===!1||u.presetArg!==void 0&&l===u.presetArg)?u:f||a},"findBestOptionFromValue"),i=o(a=>{let c=r(a),l=c.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${c.envVar}'`:`option '${c.flags}'`},"getErrorMessage"),s=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(c=>c.long).map(c=>c.long);i=i.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);t=d_(e,i)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${r} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(s=>{i.push(s.name()),s.alias()&&i.push(s.alias())}),t=d_(e,i)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let i=this.createOption(t,r);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
29
29
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let i=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(r=>DI(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Hi.basename(e,Hi.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let i=t.formatHelp(this,t);return r.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,r,i,s;return t?(r=o(c=>this._outputConfiguration.writeErr(c),"baseWrite"),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=o(c=>this._outputConfiguration.writeOut(c),"baseWrite"),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:o(c=>(i||(c=this._outputConfiguration.stripColor(c)),r(c)),"write"),hasColors:i,helpWidth:s}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let r=this._getOutputContext(e),i={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation({error:r.error});if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(Ye.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
30
30
|
Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,s=>{let a;typeof t=="function"?a=t({error:s.error,command:s.command}):a=t,a&&s.write(`${a}
|
|
31
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function p_(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?i=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],i=s[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}o(p_,"incrementNodeInspectorPort");function Xp(){if(Ye.env.NO_COLOR||Ye.env.FORCE_COLOR==="0"||Ye.env.FORCE_COLOR==="false")return!1;if(Ye.env.FORCE_COLOR||Ye.env.CLICOLOR_FORCE!==void 0)return!0}o(Xp,"useColor");Jp.Command=Kp;Jp.useColor=Xp});var __=v(hn=>{var{Argument:g_}=Fu(),{Command:Zp}=m_(),{CommanderError:MI,InvalidArgumentError:y_}=Dc(),{Help:jI}=qp(),{Option:v_}=zp();hn.program=new Zp;hn.createCommand=n=>new Zp(n);hn.createOption=(n,e)=>new v_(n,e);hn.createArgument=(n,e)=>new g_(n,e);hn.Command=Zp;hn.Option=v_;hn.Argument=g_;hn.Help=jI;hn.CommanderError=MI;hn.InvalidArgumentError=y_;hn.InvalidOptionArgumentError=y_});var em=v(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.AssetClass=void 0;var S_;(function(n){n.AREA="ems__Area",n.TASK="ems__Task",n.PROJECT="ems__Project",n.MEETING="ems__Meeting",n.INITIATIVE="ems__Initiative",n.TASK_PROTOTYPE="ems__TaskPrototype",n.TASK_PROTOTYPE_UID="75302770-279e-4a59-ba85-09df29725713",n.MEETING_PROTOTYPE="ems__MeetingPrototype",n.EVENT_PROTOTYPE="exo__EventPrototype",n.PROJECT_PROTOTYPE="ems__ProjectPrototype",n.EVENT="exo__Event",n.DAILY_NOTE="pn__DailyNote",n.CONCEPT="ims__Concept",n.SESSION_START_EVENT="ems__SessionStartEvent",n.SESSION_END_EVENT="ems__SessionEndEvent",n.PROTOTYPE="exo__Prototype",n.CLASS="exo__Class",n.FLEETING_NOTE="ztlk__FleetingNote",n.FLEETING_NOTE_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7"})(S_||(Nu.AssetClass=S_={}))});var tm=v(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.EffortStatus=void 0;var w_;(function(n){n.DRAFT="ems__EffortStatusDraft",n.BACKLOG="ems__EffortStatusBacklog",n.ANALYSIS="ems__EffortStatusAnalysis",n.TODO="ems__EffortStatusToDo",n.DOING="ems__EffortStatusDoing",n.DONE="ems__EffortStatusDone",n.TRASHED="ems__EffortStatusTrashed"})(w_||(Lu.EffortStatus=w_={}))});var E_=v(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.hasPosition=$I;ku.isFixed=VI;function $I(n){return typeof n.x=="number"&&typeof n.y=="number"}o($I,"hasPosition");function VI(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(VI,"isFixed")});var T_=v(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.createEmptyGraphData=UI;Mu.mergeGraphData=BI;function UI(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(UI,"createEmptyGraphData");function BI(n,e){let t=new Map,r=new Set,i=[];for(let s of n.nodes)t.set(s.id,s);for(let s of e.nodes)t.set(s.id,s);for(let s of n.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}for(let s of e.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}o(BI,"mergeGraphData")});var rm=v(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.createEdgeId=qI;ju.edgesEqual=GI;function qI(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(qI,"createEdgeId");function GI(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(GI,"edgesEqual")});var nm=v(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.BUILT_IN_EDGE_STYLES=Tt.BUILT_IN_NODE_STYLES=Tt.DEFAULT_EDGE_STYLE=Tt.DEFAULT_NODE_STYLE=Tt.RDF_TYPE_PREDICATES=void 0;Tt.mergeNodeStyles=WI;Tt.mergeEdgeStyles=HI;Tt.extractLocalName=zI;Tt.isClassType=QI;Tt.isTypePredicate=YI;Tt.isSubClassPredicate=KI;Tt.RDF_TYPE_PREDICATES={RDF_TYPE:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDFS_CLASS:"http://www.w3.org/2000/01/rdf-schema#Class",OWL_CLASS:"http://www.w3.org/2002/07/owl#Class",RDFS_SUBCLASS_OF:"http://www.w3.org/2000/01/rdf-schema#subClassOf",OWL_EQUIVALENT_CLASS:"http://www.w3.org/2002/07/owl#equivalentClass",RDFS_LABEL:"http://www.w3.org/2000/01/rdf-schema#label",RDFS_COMMENT:"http://www.w3.org/2000/01/rdf-schema#comment"};Tt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Tt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Tt.BUILT_IN_NODE_STYLES={"http://www.w3.org/2000/01/rdf-schema#Class":{color:"#f59e0b",shape:"diamond",size:40},"http://www.w3.org/2002/07/owl#Class":{color:"#f59e0b",shape:"diamond",size:40},ems__Task:{color:"#22c55e",shape:"circle"},ems__Project:{color:"#3b82f6",shape:"square"},ems__Area:{color:"#8b5cf6",shape:"hexagon",size:40},ems__Meeting:{color:"#ec4899",shape:"circle"},exo__Class:{color:"#f59e0b",shape:"diamond"},ims__Person:{color:"#06b6d4",shape:"circle"}};Tt.BUILT_IN_EDGE_STYLES={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":{color:"#f59e0b",lineStyle:"dashed",arrow:"standard"},"http://www.w3.org/2000/01/rdf-schema#subClassOf":{color:"#8b5cf6",width:2,arrow:"triangle"},"https://exocortex.my/ontology/ems#Effort_parent":{color:"#6366f1",width:2,arrow:"standard"},"https://exocortex.my/ontology/exo#Asset_prototype":{color:"#f59e0b",lineStyle:"dashed",arrow:"circle"},"https://exocortex.my/ontology/exo#references":{color:"#22c55e",opacity:.4,arrow:"standard"}};function WI(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(WI,"mergeNodeStyles");function HI(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(HI,"mergeEdgeStyles");function zI(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(zI,"extractLocalName");function QI(n){return n===Tt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Tt.RDF_TYPE_PREDICATES.OWL_CLASS}o(QI,"isClassType");function YI(n){return n===Tt.RDF_TYPE_PREDICATES.RDF_TYPE}o(YI,"isTypePredicate");function KI(n){return n===Tt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(KI,"isSubClassPredicate")});var A_=v(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0})});var We=v($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.IRI=void 0;var im=class n{static{o(this,"IRI")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("IRI cannot be empty");if(!n.isValidIRI(t))throw new Error("Invalid IRI format");this._value=t}get value(){return this._value}equals(e){return this._value===e._value}toString(){return this._value}static isValidIRI(e){if(!e||e.trim().length===0||/\s/.test(e)||!/^[a-z][a-z0-9+.-]*:/i.test(e))return!1;let r=["http","https","ftp","ftps","file","mailto","tel","data","ws","wss","urn","obsidian"],i=e.match(/^([a-z][a-z0-9+.-]*?):/i);if(i){let s=i[1].toLowerCase();if(!r.includes(s))return!1}try{return new URL(e),!0}catch{return/^urn:[a-z0-9][a-z0-9-]{0,31}:[^\s]+$/i.test(e)}}};$u.IRI=im});var mt=v(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.Literal=void 0;Ys.parseLanguageTag=C_;Ys.createDirectionalLiteral=JI;Ys.createLiteralFromLanguageTag=ZI;var XI="http://www.w3.org/2001/XMLSchema#string",Nc=class{static{o(this,"Literal")}constructor(e,t,r,i){if(e.length===0)throw new Error("Literal value cannot be empty");if(t&&r)throw new Error("Literal cannot have both datatype and language tag");if(i&&!r)throw new Error("Literal cannot have direction without language tag");if(i&&i!=="ltr"&&i!=="rtl")throw new Error('Direction must be "ltr" or "rtl"');this._value=e,this._datatype=t,this._language=r?r.toLowerCase():void 0,this._direction=i}get value(){return this._value}get datatype(){return this._datatype}get language(){return this._language}get direction(){return this._direction}hasDirection(){return this._direction!==void 0}equals(e){if(this._value!==e._value||this._language!==e._language||this._direction!==e._direction)return!1;let t=this.normalizedDatatype(),r=e.normalizedDatatype();return t===r}normalizedDatatype(){return!this._datatype||this._datatype.value===XI?null:this._datatype.value}toString(){let e=`"${this._value}"`;return this._datatype?e+=`^^<${this._datatype.value}>`:this._language&&(e+=`@${this._language}`,this._direction&&(e+=`--${this._direction}`)),e}};Ys.Literal=Nc;function C_(n){let t=n.lastIndexOf("--");if(t===-1)return{language:n.toLowerCase()};let r=n.substring(t+2),i=n.substring(0,t);return r==="ltr"||r==="rtl"?{language:i.toLowerCase(),direction:r}:{language:n.toLowerCase()}}o(C_,"parseLanguageTag");function JI(n,e,t){return new Nc(n,void 0,e,t)}o(JI,"createDirectionalLiteral");function ZI(n,e){let{language:t,direction:r}=C_(e);return new Nc(n,void 0,t,r)}o(ZI,"createLiteralFromLanguageTag")});var kt=v(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.BlankNode=void 0;var Vu=class n{static{o(this,"BlankNode")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("BlankNode id cannot be empty");this._id=t}get id(){return this._id}equals(e){return this._id===e._id}toString(){return`_:${this._id}`}static generateId(){return`b${++n.counter}`}static create(){return new n(n.generateId())}};Uu.BlankNode=Vu;Vu.counter=0});var dn=v(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.Namespace=void 0;var I_=We(),Or=class{static{o(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new I_.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new I_.IRI(`${this._iri.value}${e}`)}expand(e){let t=e.split(":");if(t.length!==2)return null;let[r,i]=t;return r!==this._prefix?null:this.term(i)}};Bu.Namespace=Or;Or.RDF=new Or("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");Or.RDFS=new Or("rdfs","http://www.w3.org/2000/01/rdf-schema#");Or.OWL=new Or("owl","http://www.w3.org/2002/07/owl#");Or.XSD=new Or("xsd","http://www.w3.org/2001/XMLSchema#");Or.EXO=new Or("exo","https://exocortex.my/ontology/exo#");Or.EMS=new Or("ems","https://exocortex.my/ontology/ems#")});var _i=v(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.Triple=void 0;var sm=We(),am=mt(),om=kt(),cm=class{static{o(this,"Triple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof sm.IRI&&t instanceof sm.IRI||e instanceof om.BlankNode&&t instanceof om.BlankNode||e instanceof am.Literal&&t instanceof am.Literal||this.isQuotedTriple(e)&&this.isQuotedTriple(t)?e.equals(t):!1}isQuotedTriple(e){return typeof e=="object"&&e!==null&&"termType"in e&&e.termType==="QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`${e} ${t} ${r} .`}nodeToString(e){return e instanceof sm.IRI?`<${e.value}>`:e instanceof om.BlankNode||e instanceof am.Literal||this.isQuotedTriple(e)?e.toString():""}};qu.Triple=cm});var Lc=v(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.QuotedTriple=void 0;var lm=We(),um=mt(),fm=kt(),hm=class n{static{o(this,"QuotedTriple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof lm.IRI&&t instanceof lm.IRI||e instanceof fm.BlankNode&&t instanceof fm.BlankNode||e instanceof um.Literal&&t instanceof um.Literal||e instanceof n&&t instanceof n?e.equals(t):!1}get termType(){return"QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`<< ${e} ${t} ${r} >>`}nodeToString(e){return e instanceof lm.IRI?`<${e.value}>`:e instanceof fm.BlankNode||e instanceof um.Literal||e instanceof n?e.toString():""}};Gu.QuotedTriple=hm});var O_=v(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.QuotedTriple=Ft.Triple=Ft.Namespace=Ft.BlankNode=Ft.createLiteralFromLanguageTag=Ft.createDirectionalLiteral=Ft.parseLanguageTag=Ft.Literal=Ft.IRI=void 0;var eO=We();Object.defineProperty(Ft,"IRI",{enumerable:!0,get:o(function(){return eO.IRI},"get")});var Wu=mt();Object.defineProperty(Ft,"Literal",{enumerable:!0,get:o(function(){return Wu.Literal},"get")});Object.defineProperty(Ft,"parseLanguageTag",{enumerable:!0,get:o(function(){return Wu.parseLanguageTag},"get")});Object.defineProperty(Ft,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return Wu.createDirectionalLiteral},"get")});Object.defineProperty(Ft,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return Wu.createLiteralFromLanguageTag},"get")});var tO=kt();Object.defineProperty(Ft,"BlankNode",{enumerable:!0,get:o(function(){return tO.BlankNode},"get")});var rO=dn();Object.defineProperty(Ft,"Namespace",{enumerable:!0,get:o(function(){return rO.Namespace},"get")});var nO=_i();Object.defineProperty(Ft,"Triple",{enumerable:!0,get:o(function(){return nO.Triple},"get")});var iO=Lc();Object.defineProperty(Ft,"QuotedTriple",{enumerable:!0,get:o(function(){return iO.QuotedTriple},"get")})});var Hu=v(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.UUID_URL_NAMESPACE=mn.DEFAULT_LANGUAGE_TAG=mn.REQUIRED_PROPERTIES=mn.ALLOWED_PROPERTIES=mn.Exo003MetadataType=void 0;var pn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(pn||(mn.Exo003MetadataType=pn={}));mn.ALLOWED_PROPERTIES={[pn.Namespace]:["metadata","uri","aliases"],[pn.Anchor]:["metadata","uri","aliases"],[pn.BlankNode]:["metadata","uri","aliases"],[pn.Statement]:["metadata","subject","predicate","object","aliases"],[pn.Body]:["metadata","subject","predicate","aliases"]};mn.REQUIRED_PROPERTIES={[pn.Namespace]:["metadata","uri"],[pn.Anchor]:["metadata","uri"],[pn.BlankNode]:["metadata","uri"],[pn.Statement]:["metadata","subject","predicate","object"],[pn.Body]:["metadata","subject","predicate"]};mn.DEFAULT_LANGUAGE_TAG="ru";mn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var P_=v(dm=>{"use strict";Object.defineProperty(dm,"__esModule",{value:!0});dm.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var R_=v(pm=>{"use strict";Object.defineProperty(pm,"__esModule",{value:!0});pm.default="00000000-0000-0000-0000-000000000000"});var F_=v(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var kc=v(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});var sO=F_();function aO(n){return typeof n=="string"&&sO.default.test(n)}o(aO,"validate");gm.default=aO});var Mc=v(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});var oO=kc();function cO(n){if(!(0,oO.default)(n))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(n.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(n.slice(9,13),16))>>>8,e&255,(e=parseInt(n.slice(14,18),16))>>>8,e&255,(e=parseInt(n.slice(19,23),16))>>>8,e&255,(e=parseInt(n.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}o(cO,"parse");ym.default=cO});var zi=v(jc=>{"use strict";Object.defineProperty(jc,"__esModule",{value:!0});jc.unsafeStringify=void 0;var lO=kc(),tr=[];for(let n=0;n<256;++n)tr.push((n+256).toString(16).slice(1));function D_(n,e=0){return(tr[n[e+0]]+tr[n[e+1]]+tr[n[e+2]]+tr[n[e+3]]+"-"+tr[n[e+4]]+tr[n[e+5]]+"-"+tr[n[e+6]]+tr[n[e+7]]+"-"+tr[n[e+8]]+tr[n[e+9]]+"-"+tr[n[e+10]]+tr[n[e+11]]+tr[n[e+12]]+tr[n[e+13]]+tr[n[e+14]]+tr[n[e+15]]).toLowerCase()}o(D_,"unsafeStringify");jc.unsafeStringify=D_;function uO(n,e=0){let t=D_(n,e);if(!(0,lO.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(uO,"stringify");jc.default=uO});var Yu=v(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});var fO=require("crypto"),Qu=new Uint8Array(256),zu=Qu.length;function hO(){return zu>Qu.length-16&&((0,fO.randomFillSync)(Qu),zu=0),Qu.slice(zu,zu+=16)}o(hO,"rng");vm.default=hO});var _m=v(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.updateV1State=void 0;var N_=Yu(),dO=zi(),$c={};function pO(n,e,t){let r,i=n?._v6??!1;if(n){let s=Object.keys(n);s.length===1&&s[0]==="_v6"&&(n=void 0)}if(n)r=L_(n.random??n.rng?.()??(0,N_.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,N_.default)();k_($c,s,a),r=L_(a,$c.msecs,$c.nsecs,i?void 0:$c.clockseq,i?void 0:$c.node,e,t)}return e??(0,dO.unsafeStringify)(r)}o(pO,"v1");function k_(n,e,t){return n.msecs??=-1/0,n.nsecs??=0,e===n.msecs?(n.nsecs++,n.nsecs>=1e4&&(n.node=void 0,n.nsecs=0)):e>n.msecs?n.nsecs=0:e<n.msecs&&(n.node=void 0),n.node||(n.node=t.slice(10,16),n.node[0]|=1,n.clockseq=(t[8]<<8|t[9])&16383),n.msecs=e,n}o(k_,"updateV1State");Vc.updateV1State=k_;function L_(n,e,t,r,i,s,a=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),a=0;else if(a<0||a+16>s.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);e??=Date.now(),t??=0,r??=(n[8]<<8|n[9])&16383,i??=n.slice(10,16),e+=122192928e5;let c=((e&268435455)*1e4+t)%4294967296;s[a++]=c>>>24&255,s[a++]=c>>>16&255,s[a++]=c>>>8&255,s[a++]=c&255;let l=e/4294967296*1e4&268435455;s[a++]=l>>>8&255,s[a++]=l&255,s[a++]=l>>>24&15|16,s[a++]=l>>>16&255,s[a++]=r>>>8|128,s[a++]=r&255;for(let u=0;u<6;++u)s[a++]=i[u];return s}o(L_,"v1Bytes");Vc.default=pO});var Sm=v(bm=>{"use strict";Object.defineProperty(bm,"__esModule",{value:!0});var mO=Mc(),gO=zi();function yO(n){let e=typeof n=="string"?(0,mO.default)(n):n,t=vO(e);return typeof n=="string"?(0,gO.unsafeStringify)(t):t}o(yO,"v1ToV6");bm.default=yO;function vO(n){return Uint8Array.of((n[6]&15)<<4|n[7]>>4&15,(n[7]&15)<<4|(n[4]&240)>>4,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,(n[1]&15)<<4|(n[2]&240)>>4,96|n[2]&15,n[3],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(vO,"_v1ToV6")});var M_=v(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});var _O=require("crypto");function bO(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,_O.createHash)("md5").update(n).digest()}o(bO,"md5");wm.default=bO});var Uc=v(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.URL=Qi.DNS=Qi.stringToBytes=void 0;var j_=Mc(),SO=zi();function $_(n){n=unescape(encodeURIComponent(n));let e=new Uint8Array(n.length);for(let t=0;t<n.length;++t)e[t]=n.charCodeAt(t);return e}o($_,"stringToBytes");Qi.stringToBytes=$_;Qi.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Qi.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function wO(n,e,t,r,i,s){let a=typeof t=="string"?$_(t):t,c=typeof r=="string"?(0,j_.default)(r):r;if(typeof r=="string"&&(r=(0,j_.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(c),l.set(a,c.length),l=e(l),l[6]=l[6]&15|n,l[8]=l[8]&63|128,i){s=s||0;for(let u=0;u<16;++u)i[s+u]=l[u];return i}return(0,SO.unsafeStringify)(l)}o(wO,"v35");Qi.default=wO});var U_=v(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.URL=Ks.DNS=void 0;var EO=M_(),Em=Uc(),V_=Uc();Object.defineProperty(Ks,"DNS",{enumerable:!0,get:o(function(){return V_.DNS},"get")});Object.defineProperty(Ks,"URL",{enumerable:!0,get:o(function(){return V_.URL},"get")});function Tm(n,e,t,r){return(0,Em.default)(48,EO.default,n,e,t,r)}o(Tm,"v3");Tm.DNS=Em.DNS;Tm.URL=Em.URL;Ks.default=Tm});var B_=v(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});var TO=require("crypto");xm.default={randomUUID:TO.randomUUID}});var G_=v(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});var q_=B_(),xO=Yu(),AO=zi();function CO(n,e,t){if(q_.default.randomUUID&&!e&&!n)return q_.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,xO.default)();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return(0,AO.unsafeStringify)(r)}o(CO,"v4");Am.default=CO});var W_=v(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});var IO=require("crypto");function OO(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,IO.createHash)("sha1").update(n).digest()}o(OO,"sha1");Cm.default=OO});var z_=v(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.URL=Xs.DNS=void 0;var PO=W_(),Im=Uc(),H_=Uc();Object.defineProperty(Xs,"DNS",{enumerable:!0,get:o(function(){return H_.DNS},"get")});Object.defineProperty(Xs,"URL",{enumerable:!0,get:o(function(){return H_.URL},"get")});function Om(n,e,t,r){return(0,Im.default)(80,PO.default,n,e,t,r)}o(Om,"v5");Om.DNS=Im.DNS;Om.URL=Im.URL;Xs.default=Om});var Q_=v(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var RO=zi(),FO=_m(),DO=Sm();function NO(n,e,t){n??={},t??=0;let r=(0,FO.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,DO.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,RO.unsafeStringify)(r)}o(NO,"v6");Pm.default=NO});var Y_=v(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:!0});var LO=Mc(),kO=zi();function MO(n){let e=typeof n=="string"?(0,LO.default)(n):n,t=jO(e);return typeof n=="string"?(0,kO.unsafeStringify)(t):t}o(MO,"v6ToV1");Rm.default=MO;function jO(n){return Uint8Array.of((n[3]&15)<<4|n[4]>>4&15,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|n[6]&15,n[7],(n[1]&15)<<4|(n[2]&240)>>4,(n[2]&15)<<4|(n[3]&240)>>4,16|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(jO,"_v6ToV1")});var Z_=v(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.updateV7State=void 0;var K_=Yu(),$O=zi(),Fm={};function VO(n,e,t){let r;if(n)r=X_(n.random??n.rng?.()??(0,K_.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,K_.default)();J_(Fm,i,s),r=X_(s,Fm.msecs,Fm.seq,e,t)}return e??(0,$O.unsafeStringify)(r)}o(VO,"v7");function J_(n,e,t){return n.msecs??=-1/0,n.seq??=0,e>n.msecs?(n.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],n.msecs=e):(n.seq=n.seq+1|0,n.seq===0&&n.msecs++),n}o(J_,"updateV7State");Bc.updateV7State=J_;function X_(n,e,t,r,i=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return e??=Date.now(),t??=n[6]*127<<24|n[7]<<16|n[8]<<8|n[9],r[i++]=e/1099511627776&255,r[i++]=e/4294967296&255,r[i++]=e/16777216&255,r[i++]=e/65536&255,r[i++]=e/256&255,r[i++]=e&255,r[i++]=112|t>>>28&15,r[i++]=t>>>20&255,r[i++]=128|t>>>14&63,r[i++]=t>>>6&255,r[i++]=t<<2&255|n[10]&3,r[i++]=n[11],r[i++]=n[12],r[i++]=n[13],r[i++]=n[14],r[i++]=n[15],r}o(X_,"v7Bytes");Bc.default=VO});var eb=v(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});var UO=kc();function BO(n){if(!(0,UO.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(BO,"version");Dm.default=BO});var Pr=v(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.version=Xe.validate=Xe.v7=Xe.v6ToV1=Xe.v6=Xe.v5=Xe.v4=Xe.v3=Xe.v1ToV6=Xe.v1=Xe.stringify=Xe.parse=Xe.NIL=Xe.MAX=void 0;var qO=P_();Object.defineProperty(Xe,"MAX",{enumerable:!0,get:o(function(){return qO.default},"get")});var GO=R_();Object.defineProperty(Xe,"NIL",{enumerable:!0,get:o(function(){return GO.default},"get")});var WO=Mc();Object.defineProperty(Xe,"parse",{enumerable:!0,get:o(function(){return WO.default},"get")});var HO=zi();Object.defineProperty(Xe,"stringify",{enumerable:!0,get:o(function(){return HO.default},"get")});var zO=_m();Object.defineProperty(Xe,"v1",{enumerable:!0,get:o(function(){return zO.default},"get")});var QO=Sm();Object.defineProperty(Xe,"v1ToV6",{enumerable:!0,get:o(function(){return QO.default},"get")});var YO=U_();Object.defineProperty(Xe,"v3",{enumerable:!0,get:o(function(){return YO.default},"get")});var KO=G_();Object.defineProperty(Xe,"v4",{enumerable:!0,get:o(function(){return KO.default},"get")});var XO=z_();Object.defineProperty(Xe,"v5",{enumerable:!0,get:o(function(){return XO.default},"get")});var JO=Q_();Object.defineProperty(Xe,"v6",{enumerable:!0,get:o(function(){return JO.default},"get")});var ZO=Y_();Object.defineProperty(Xe,"v6ToV1",{enumerable:!0,get:o(function(){return ZO.default},"get")});var eP=Z_();Object.defineProperty(Xe,"v7",{enumerable:!0,get:o(function(){return eP.default},"get")});var tP=kc();Object.defineProperty(Xe,"validate",{enumerable:!0,get:o(function(){return tP.default},"get")});var rP=eb();Object.defineProperty(Xe,"version",{enumerable:!0,get:o(function(){return rP.default},"get")})});var km=v(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.Exo003UUIDGenerator=void 0;var Nm=Pr(),tb=Hu(),Lm=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,Nm.v5)(e,tb.UUID_URL_NAMESPACE)}static generateAssetUUID(e,t){if(!t||t.trim().length===0)throw new Error("Local identifier cannot be empty");let r=this.generateNamespaceUUID(e);return(0,Nm.v5)(t,r)}static generateFromIRI(e){if(!e||e.trim().length===0)throw new Error("IRI cannot be empty");let{namespace:t,localName:r}=this.splitIRI(e);return r?this.generateAssetUUID(t,r):(0,Nm.v5)(e,tb.UUID_URL_NAMESPACE)}static generateBlankNodeUUID(e,t){if(!e||e.trim().length===0)throw new Error("Blank node ID cannot be empty");let r="urn:exocortex:blank-node:",i=t?`${t}#${e}`:e;return this.generateAssetUUID(r,i)}static generateStatementUUID(e,t,r){if(!e||!t||!r)throw new Error("Subject, predicate, and object cannot be empty");let i="urn:exocortex:statement:",s=`${e} ${t} ${r}`;return this.generateAssetUUID(i,s)}static generateBodyUUID(e,t){let r="urn:exocortex:body:",i=e;return t?.datatype?i+=`^^${t.datatype}`:t?.language&&(i+=`@${t.language}`,t.direction&&(i+=`--${t.direction}`)),this.generateAssetUUID(r,i)}static splitIRI(e){let t=e.lastIndexOf("#");if(t!==-1&&t<e.length-1)return{namespace:e.substring(0,t+1),localName:e.substring(t+1)};let r=e.lastIndexOf("/"),i=e.indexOf("://");return r!==-1&&r>i+2&&r<e.length-1?{namespace:e.substring(0,r+1),localName:e.substring(r+1)}:{namespace:e,localName:""}}static isValidUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};Ku.Exo003UUIDGenerator=Lm});var nb=v(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Exo003Parser=void 0;var at=Hu(),qc=km(),fs=We(),Xu=mt(),rb=kt(),nP=_i(),Mm=class{static{o(this,"Exo003Parser")}static parse(e,t){let r=this.validate(e);if(!r.valid)return{success:!1,errors:r.errors};let i=e.metadata;try{return{success:!0,metadata:this.parseByType(e,i),bodyContent:i===at.Exo003MetadataType.Body?t:void 0}}catch(s){return{success:!1,errors:[s instanceof Error?s.message:String(s)]}}}static validate(e){let t=[],r=[];if(!e.metadata)return t.push("Missing required property: metadata"),{valid:!1,errors:t,warnings:r};let i=e.metadata;if(!Object.values(at.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(at.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=at.ALLOWED_PROPERTIES[s],c=at.REQUIRED_PROPERTIES[s];for(let l of c)(e[l]===void 0||e[l]===null)&&t.push(`Missing required property: ${l}`);for(let l of Object.keys(e))a.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case at.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case at.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case at.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case at.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case at.Exo003MetadataType.Body:this.validateBodyMetadata(e,t,r);break}return{valid:t.length===0,errors:t,warnings:r}}static parseByType(e,t){let r={metadata:t,aliases:e.aliases};switch(t){case at.Exo003MetadataType.Namespace:return{...r,metadata:at.Exo003MetadataType.Namespace,uri:e.uri};case at.Exo003MetadataType.Anchor:return{...r,metadata:at.Exo003MetadataType.Anchor,uri:e.uri};case at.Exo003MetadataType.BlankNode:return{...r,metadata:at.Exo003MetadataType.BlankNode,uri:e.uri};case at.Exo003MetadataType.Statement:return{...r,metadata:at.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case at.Exo003MetadataType.Body:return{...r,metadata:at.Exo003MetadataType.Body,subject:e.subject,predicate:e.predicate}}}static validateNamespaceMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new fs.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateAnchorMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new fs.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateBlankNodeMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new fs.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateStatementMetadata(e,t){let r=e.subject,i=e.predicate,s=e.object,a=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of a)l&&typeof l!="string"&&t.push(`${c} must be a string`)}static validateBodyMetadata(e,t,r){let i=e.subject,s=e.predicate;i&&typeof i!="string"&&t.push("subject must be a string"),s&&typeof s!="string"&&t.push("predicate must be a string")}static toTriple(e,t,r){let i=t(e.subject),s;if(i.type==="iri")s=new fs.IRI(i.value);else if(i.type==="blank")s=new rb.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let a=t(e.predicate);if(a.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new fs.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new fs.IRI(l.value);else if(l.type==="blank")u=new rb.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new Xu.Literal(f,new fs.IRI(l.datatype));else{let h=l.language||at.DEFAULT_LANGUAGE_TAG;u=(0,Xu.createDirectionalLiteral)(f,h,l.direction)}}return new nP.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new Xu.Literal(t,new fs.IRI(r.datatype));let i=r?.language||at.DEFAULT_LANGUAGE_TAG;return(0,Xu.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(at.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case at.Exo003MetadataType.Namespace:return qc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case at.Exo003MetadataType.Anchor:return qc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case at.Exo003MetadataType.BlankNode:return qc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case at.Exo003MetadataType.Statement:{let r=e;return qc.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case at.Exo003MetadataType.Body:{let r=e;return qc.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};Ju.Exo003Parser=Mm});var jm=v(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.Exo003Parser=dr.Exo003UUIDGenerator=dr.UUID_URL_NAMESPACE=dr.DEFAULT_LANGUAGE_TAG=dr.REQUIRED_PROPERTIES=dr.ALLOWED_PROPERTIES=dr.Exo003MetadataType=void 0;var Gc=Hu();Object.defineProperty(dr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Gc.Exo003MetadataType},"get")});Object.defineProperty(dr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Gc.ALLOWED_PROPERTIES},"get")});Object.defineProperty(dr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Gc.REQUIRED_PROPERTIES},"get")});Object.defineProperty(dr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Gc.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(dr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Gc.UUID_URL_NAMESPACE},"get")});var iP=km();Object.defineProperty(dr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return iP.Exo003UUIDGenerator},"get")});var sP=nb();Object.defineProperty(dr,"Exo003Parser",{enumerable:!0,get:o(function(){return sP.Exo003Parser},"get")})});var Js=v(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.WikiLinkHelpers=void 0;var Zu=class{static{o(this,"WikiLinkHelpers")}static normalize(e){return e?e.replace(this.WIKI_LINK_PATTERN,"").trim():""}static normalizeArray(e){return e?(Array.isArray(e)?e:[e]).map(r=>this.normalize(r)).filter(r=>r.length>0):[]}static equals(e,t){return this.normalize(e)===this.normalize(t)}static includes(e,t){let r=this.normalizeArray(e),i=this.normalize(t);return r.includes(i)}};ef.WikiLinkHelpers=Zu;Zu.WIKI_LINK_PATTERN=/\[\[|\]\]/g});var pr=v(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.EffortStatus=Ka.AssetClass=void 0;var aP=em();Object.defineProperty(Ka,"AssetClass",{enumerable:!0,get:o(function(){return aP.AssetClass},"get")});var oP=tm();Object.defineProperty(Ka,"EffortStatus",{enumerable:!0,get:o(function(){return oP.EffortStatus},"get")})});var hs=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.hasClass=ea;mr.isAreaOrProject=cP;mr.isEffort=lP;mr.hasStatus=uP;mr.isAssetArchived=fP;mr.hasEmptyProperties=hP;mr.needsFolderRepair=dP;mr.getTodayDateString=$m;mr.isPlannedForToday=pP;mr.hasPlannedStartTimestamp=mP;mr.extractDailyNoteDate=gP;mr.isCurrentDateGteDay=yP;mr.inheritsFromPrototype=ab;mr.isPrototypeClass=_P;var sb=Js(),Zs=pr();function ea(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>sb.WikiLinkHelpers.normalize(r)===e):!1}o(ea,"hasClass");function cP(n){return ea(n,Zs.AssetClass.AREA)||ea(n,Zs.AssetClass.PROJECT)}o(cP,"isAreaOrProject");function lP(n){return ea(n,Zs.AssetClass.TASK)||ea(n,Zs.AssetClass.PROJECT)||ea(n,Zs.AssetClass.MEETING)}o(lP,"isEffort");function uP(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?sb.WikiLinkHelpers.normalize(t)===e:!1}o(uP,"hasStatus");function fP(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(fP,"isAssetArchived");function hP(n){return!n||Object.keys(n).length===0?!1:Object.values(n).some(e=>!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0))}o(hP,"hasEmptyProperties");function dP(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(dP,"needsFolderRepair");function $m(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return`${e}-${t}-${r}`}o($m,"getTodayDateString");function pP(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=$m();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(pP,"isPlannedForToday");function mP(n){let e=n.ems__Effort_plannedStartTimestamp;return e?typeof e=="string"?e.trim().length>0:Array.isArray(e)&&e.length>0?String(e[0]).trim().length>0:!1:!1}o(mP,"hasPlannedStartTimestamp");function gP(n){let e=n.pn__DailyNote_day;if(!e)return null;if(typeof e=="string"){let t=e.match(/\[\[([^\[\]]+)\]\]/);return t?t[1]:e}if(Array.isArray(e)&&e.length>0){let t=String(e[0]),r=t.match(/\[\[([^\[\]]+)\]\]/);return r?r[1]:t}return null}o(gP,"extractDailyNoteDate");function yP(n){return $m()>=n}o(yP,"isCurrentDateGteDay");function ib(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(ib,"normalizeWithQuotes");var vP=10;function ab(n,e=vP){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let a of s){let c=ib(a);c&&i.push({className:c,depth:0})}for(;i.length>0;){let a=i.shift();if(!a)continue;let{className:c,depth:l}=a;if(l>e)continue;if(c===Zs.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let h=Array.isArray(f)?f:[f];for(let d of h){let p=ib(d);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(ab,"inheritsFromPrototype");function _P(n,e){return ea(n,Zs.AssetClass.CLASS)?ab(e):!1}o(_P,"isPrototypeClass")});var ob=v(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.canCreateTask=bP;Ja.canCreateRelatedTask=SP;Ja.canConvertTaskToProject=wP;Ja.canSetCriticalityZone=EP;var Xa=hs(),Vm=pr();function bP(n){return(0,Xa.isAreaOrProject)(n.instanceClass)}o(bP,"canCreateTask");function SP(n){return!(!(0,Xa.hasClass)(n.instanceClass,Vm.AssetClass.TASK)||(0,Xa.isAssetArchived)(n.isArchived))}o(SP,"canCreateRelatedTask");function wP(n){return(0,Xa.hasClass)(n.instanceClass,Vm.AssetClass.TASK)}o(wP,"canConvertTaskToProject");function EP(n){return!(!(0,Xa.hasClass)(n.instanceClass,Vm.AssetClass.TASK)||(0,Xa.isAssetArchived)(n.isArchived))}o(EP,"canSetCriticalityZone")});var cb=v(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.canCreateProject=TP;Za.canMoveToAnalysis=xP;Za.canMoveToToDo=AP;Za.canConvertProjectToTask=CP;var ds=hs(),ps=pr();function TP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.AREA)||(0,ds.hasClass)(n.instanceClass,ps.AssetClass.INITIATIVE)||(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)}o(TP,"canCreateProject");function xP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)?(0,ds.hasStatus)(n.currentStatus,ps.EffortStatus.BACKLOG):!1}o(xP,"canMoveToAnalysis");function AP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)?(0,ds.hasStatus)(n.currentStatus,ps.EffortStatus.ANALYSIS):!1}o(AP,"canMoveToToDo");function CP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)}o(CP,"canConvertProjectToTask")});var fb=v(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.canCreateChildArea=IP;tf.canSetActiveFocus=OP;var lb=hs(),ub=pr();function IP(n){return(0,lb.hasClass)(n.instanceClass,ub.AssetClass.AREA)}o(IP,"canCreateChildArea");function OP(n){return(0,lb.hasClass)(n.instanceClass,ub.AssetClass.AREA)}o(OP,"canSetActiveFocus")});var db=v(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.canPlanOnToday=PP;Fr.canPlanForEvening=RP;Fr.canShiftDayBackward=FP;Fr.canShiftDayForward=DP;Fr.canSetDraftStatus=NP;Fr.canMoveToBacklog=LP;Fr.canStartEffort=kP;Fr.canMarkDone=MP;Fr.canTrashEffort=jP;Fr.canVoteOnEffort=$P;Fr.canRollbackStatus=VP;Fr.canArchiveTask=UP;Fr.canMarkReviewed=BP;var hb=Js(),tt=hs(),Rr=pr();function PP(n){return!(!(0,tt.isEffort)(n.instanceClass)||(0,tt.isPlannedForToday)(n.metadata))}o(PP,"canPlanOnToday");function RP(n){return!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.TASK)&&!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.MEETING)?!1:(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.BACKLOG)}o(RP,"canPlanForEvening");function FP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasPlannedStartTimestamp)(n.metadata):!1}o(FP,"canShiftDayBackward");function DP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasPlannedStartTimestamp)(n.metadata):!1}o(DP,"canShiftDayForward");function NP(n){return(0,tt.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(NP,"canSetDraftStatus");function LP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.DRAFT):!1}o(LP,"canMoveToBacklog");function kP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.TASK)||(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.MEETING)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.BACKLOG):(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.PROJECT)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.TODO):!1:!1}o(kP,"canStartEffort");function MP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.DOING):!1}o(MP,"canMarkDone");function jP(n){return(0,tt.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=hb.WikiLinkHelpers.normalize(r);return i===Rr.EffortStatus.TRASHED||i===Rr.EffortStatus.DONE}):!0:!1}o(jP,"canTrashEffort");function $P(n){return!(!(0,tt.isEffort)(n.instanceClass)||(0,tt.isAssetArchived)(n.isArchived))}o($P,"canVoteOnEffort");function VP(n){if(!(0,tt.isEffort)(n.instanceClass)||(0,tt.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||hb.WikiLinkHelpers.normalize(e)===Rr.EffortStatus.TRASHED)}o(VP,"canRollbackStatus");function UP(n){return!(0,tt.isAssetArchived)(n.isArchived)}o(UP,"canArchiveTask");function BP(n){return!(!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.TASK)&&!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.PROJECT)||(0,tt.isAssetArchived)(n.isArchived))}o(BP,"canMarkReviewed")});var pb=v(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.canCreateEvent=qP;gn.canCreateInstance=GP;gn.canCleanProperties=WP;gn.canRepairFolder=HP;gn.canRenameToUid=zP;gn.canCopyLabelToAliases=QP;gn.canCreateNarrowerConcept=YP;gn.canCreateSubclass=KP;gn.canCreateTaskForDailyNote=XP;gn.canCopyFleetingNoteLabel=JP;var gr=hs(),Rn=pr();function qP(n){return(0,gr.isAreaOrProject)(n.instanceClass)}o(qP,"canCreateEvent");function GP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.TASK_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.TASK_PROTOTYPE_UID)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.MEETING_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.EVENT_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.PROJECT_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,gr.isPrototypeClass)(n.instanceClass,n.metadata)}o(GP,"canCreateInstance");function WP(n){return(0,gr.hasEmptyProperties)(n.metadata)}o(WP,"canCleanProperties");function HP(n){return(0,gr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(HP,"canRepairFolder");function zP(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(zP,"canRenameToUid");function QP(n){let e=n.metadata.exo__Asset_label;if(!e||typeof e!="string"||e.trim()==="")return!1;let t=e.trim(),r=n.metadata.aliases;return!r||!Array.isArray(r)||r.length===0?!0:!r.some(i=>typeof i!="string"?!1:i.trim()===t)}o(QP,"canCopyLabelToAliases");function YP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.CONCEPT)}o(YP,"canCreateNarrowerConcept");function KP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.CLASS)}o(KP,"canCreateSubclass");function XP(n){return!(!(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.DAILY_NOTE)||n.isArchived||!(0,gr.extractDailyNoteDate)(n.metadata))}o(XP,"canCreateTaskForDailyNote");function JP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.FLEETING_NOTE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.FLEETING_NOTE_UID)}o(JP,"canCopyFleetingNoteLabel")});var gb=v(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.canCopyFleetingNoteLabel=D.canCreateTaskForDailyNote=D.canCreateSubclass=D.canCreateNarrowerConcept=D.canCopyLabelToAliases=D.canRenameToUid=D.canRepairFolder=D.canCleanProperties=D.canCreateInstance=D.canCreateEvent=D.canMarkReviewed=D.canArchiveTask=D.canRollbackStatus=D.canVoteOnEffort=D.canTrashEffort=D.canMarkDone=D.canStartEffort=D.canMoveToBacklog=D.canSetDraftStatus=D.canShiftDayForward=D.canShiftDayBackward=D.canPlanForEvening=D.canPlanOnToday=D.canSetActiveFocus=D.canCreateChildArea=D.canConvertProjectToTask=D.canMoveToToDo=D.canMoveToAnalysis=D.canCreateProject=D.canSetCriticalityZone=D.canConvertTaskToProject=D.canCreateRelatedTask=D.canCreateTask=D.isPrototypeClass=D.inheritsFromPrototype=D.isCurrentDateGteDay=D.extractDailyNoteDate=D.hasPlannedStartTimestamp=D.isPlannedForToday=D.getTodayDateString=D.needsFolderRepair=D.hasEmptyProperties=D.isAssetArchived=D.hasStatus=D.isEffort=D.isAreaOrProject=D.hasClass=void 0;var Gr=hs();Object.defineProperty(D,"hasClass",{enumerable:!0,get:o(function(){return Gr.hasClass},"get")});Object.defineProperty(D,"isAreaOrProject",{enumerable:!0,get:o(function(){return Gr.isAreaOrProject},"get")});Object.defineProperty(D,"isEffort",{enumerable:!0,get:o(function(){return Gr.isEffort},"get")});Object.defineProperty(D,"hasStatus",{enumerable:!0,get:o(function(){return Gr.hasStatus},"get")});Object.defineProperty(D,"isAssetArchived",{enumerable:!0,get:o(function(){return Gr.isAssetArchived},"get")});Object.defineProperty(D,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Gr.hasEmptyProperties},"get")});Object.defineProperty(D,"needsFolderRepair",{enumerable:!0,get:o(function(){return Gr.needsFolderRepair},"get")});Object.defineProperty(D,"getTodayDateString",{enumerable:!0,get:o(function(){return Gr.getTodayDateString},"get")});Object.defineProperty(D,"isPlannedForToday",{enumerable:!0,get:o(function(){return Gr.isPlannedForToday},"get")});Object.defineProperty(D,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Gr.hasPlannedStartTimestamp},"get")});Object.defineProperty(D,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Gr.extractDailyNoteDate},"get")});Object.defineProperty(D,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Gr.isCurrentDateGteDay},"get")});Object.defineProperty(D,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Gr.inheritsFromPrototype},"get")});Object.defineProperty(D,"isPrototypeClass",{enumerable:!0,get:o(function(){return Gr.isPrototypeClass},"get")});var rf=ob();Object.defineProperty(D,"canCreateTask",{enumerable:!0,get:o(function(){return rf.canCreateTask},"get")});Object.defineProperty(D,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return rf.canCreateRelatedTask},"get")});Object.defineProperty(D,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return rf.canConvertTaskToProject},"get")});Object.defineProperty(D,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return rf.canSetCriticalityZone},"get")});var nf=cb();Object.defineProperty(D,"canCreateProject",{enumerable:!0,get:o(function(){return nf.canCreateProject},"get")});Object.defineProperty(D,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return nf.canMoveToAnalysis},"get")});Object.defineProperty(D,"canMoveToToDo",{enumerable:!0,get:o(function(){return nf.canMoveToToDo},"get")});Object.defineProperty(D,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return nf.canConvertProjectToTask},"get")});var mb=fb();Object.defineProperty(D,"canCreateChildArea",{enumerable:!0,get:o(function(){return mb.canCreateChildArea},"get")});Object.defineProperty(D,"canSetActiveFocus",{enumerable:!0,get:o(function(){return mb.canSetActiveFocus},"get")});var Zr=db();Object.defineProperty(D,"canPlanOnToday",{enumerable:!0,get:o(function(){return Zr.canPlanOnToday},"get")});Object.defineProperty(D,"canPlanForEvening",{enumerable:!0,get:o(function(){return Zr.canPlanForEvening},"get")});Object.defineProperty(D,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Zr.canShiftDayBackward},"get")});Object.defineProperty(D,"canShiftDayForward",{enumerable:!0,get:o(function(){return Zr.canShiftDayForward},"get")});Object.defineProperty(D,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Zr.canSetDraftStatus},"get")});Object.defineProperty(D,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Zr.canMoveToBacklog},"get")});Object.defineProperty(D,"canStartEffort",{enumerable:!0,get:o(function(){return Zr.canStartEffort},"get")});Object.defineProperty(D,"canMarkDone",{enumerable:!0,get:o(function(){return Zr.canMarkDone},"get")});Object.defineProperty(D,"canTrashEffort",{enumerable:!0,get:o(function(){return Zr.canTrashEffort},"get")});Object.defineProperty(D,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Zr.canVoteOnEffort},"get")});Object.defineProperty(D,"canRollbackStatus",{enumerable:!0,get:o(function(){return Zr.canRollbackStatus},"get")});Object.defineProperty(D,"canArchiveTask",{enumerable:!0,get:o(function(){return Zr.canArchiveTask},"get")});Object.defineProperty(D,"canMarkReviewed",{enumerable:!0,get:o(function(){return Zr.canMarkReviewed},"get")});var bi=pb();Object.defineProperty(D,"canCreateEvent",{enumerable:!0,get:o(function(){return bi.canCreateEvent},"get")});Object.defineProperty(D,"canCreateInstance",{enumerable:!0,get:o(function(){return bi.canCreateInstance},"get")});Object.defineProperty(D,"canCleanProperties",{enumerable:!0,get:o(function(){return bi.canCleanProperties},"get")});Object.defineProperty(D,"canRepairFolder",{enumerable:!0,get:o(function(){return bi.canRepairFolder},"get")});Object.defineProperty(D,"canRenameToUid",{enumerable:!0,get:o(function(){return bi.canRenameToUid},"get")});Object.defineProperty(D,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return bi.canCopyLabelToAliases},"get")});Object.defineProperty(D,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return bi.canCreateNarrowerConcept},"get")});Object.defineProperty(D,"canCreateSubclass",{enumerable:!0,get:o(function(){return bi.canCreateSubclass},"get")});Object.defineProperty(D,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return bi.canCreateTaskForDailyNote},"get")});Object.defineProperty(D,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return bi.canCopyFleetingNoteLabel},"get")})});var yb=v(ta=>{"use strict";var ZP=ta&&ta.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),eR=ta&&ta.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ZP(e,n,t)};Object.defineProperty(ta,"__esModule",{value:!0});eR(gb(),ta)});var Bm=v(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.PropertyFieldType=void 0;Wc.rangeToFieldType=nR;var rr;(function(n){n.Text="text",n.Number="number",n.Date="date",n.DateTime="datetime",n.Boolean="boolean",n.Reference="reference",n.Enum="enum",n.StatusSelect="status-select",n.SizeSelect="size-select",n.Wikilink="wikilink",n.Timestamp="timestamp",n.Unknown="unknown"})(rr||(Wc.PropertyFieldType=rr={}));var vb="http://www.w3.org/2001/XMLSchema#",tR="https://exocortex.my/ontology/exo#",rR="https://exocortex.my/ontology/ems#";function nR(n){if(!n)return rr.Unknown;let e=n.trim();if(!e)return rr.Unknown;if(e.startsWith(vb)){let t=e.substring(vb.length);return Um(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return Um(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return Um(r)}return e.startsWith(rR)||e.startsWith("ems:")?iR(e):e.startsWith(tR)||e.startsWith("exo:")||sR(e)?rr.Reference:rr.Text}o(nR,"rangeToFieldType");function Um(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return rr.Text;case"integer":case"int":case"long":case"short":case"byte":case"nonnegativeinteger":case"positiveinteger":case"nonpositiveinteger":case"negativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"decimal":case"float":case"double":return rr.Number;case"date":return rr.Date;case"datetime":case"datetimestamp":return rr.DateTime;case"boolean":return rr.Boolean;case"time":return rr.Timestamp;default:return rr.Text}}o(Um,"xsdTypeToFieldType");function iR(n){let e=n.toLowerCase();return e.includes("effortstatus")?rr.StatusSelect:e.includes("tasksize")?rr.SizeSelect:rr.Reference}o(iR,"emsTypeToFieldType");function sR(n){let e=n.toLowerCase();return e.includes("exocortex.my/ontology")?!0:["asset","task","project","area","effort","class","property","concept"].some(r=>e.includes(r))}o(sR,"isClassReference")});var bb=v(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.propertyNameToUri=aR;Hc.uriToPropertyName=_b;Hc.extractPropertyLabel=oR;function aR(n){return n.replace(/^([a-z]+)__/,"$1:")}o(aR,"propertyNameToUri");function _b(n){if(n.startsWith("http://")||n.startsWith("https://")){let e=n.match(/\/([a-z]+)#([A-Za-z0-9_]+)$/);if(e)return`${e[1]}__${e[2]}`;let t=n.lastIndexOf("#"),r=n.lastIndexOf("/"),i=Math.max(t,r);return i>=0?n.substring(i+1):n}return n.replace(/^([a-z]+):/,"$1__")}o(_b,"uriToPropertyName");function oR(n){let r=(n.includes(":")?_b(n):n).replace(/^[a-z]+__/,"").split("_");return(r.length>1?r.slice(1).join(" "):r[0]).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,s=>s.toUpperCase())}o(oR,"extractPropertyLabel")});var sf={};s_(sf,{__assign:()=>Gm,__asyncDelegator:()=>bR,__asyncGenerator:()=>_R,__asyncValues:()=>SR,__await:()=>zc,__awaiter:()=>dR,__classPrivateFieldGet:()=>xR,__classPrivateFieldSet:()=>AR,__createBinding:()=>mR,__decorate:()=>uR,__exportStar:()=>gR,__extends:()=>cR,__generator:()=>pR,__importDefault:()=>TR,__importStar:()=>ER,__makeTemplateObject:()=>wR,__metadata:()=>hR,__param:()=>fR,__read:()=>Sb,__rest:()=>lR,__spread:()=>yR,__spreadArrays:()=>vR,__values:()=>Wm});function cR(n,e){qm(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function lR(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function uR(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function fR(n,e){return function(t,r){e(t,r,n)}}function hR(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function dR(n,e,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return o(i,"adopt"),new(t||(t=Promise))(function(s,a){function c(f){try{u(r.next(f))}catch(h){a(h)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(h){a(h)}}o(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}o(u,"step"),u((r=r.apply(n,e||[])).next())})}function pR(n,e){var t={label:0,sent:o(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(f){return l([u,f])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(f){u=[6,f],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function mR(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function gR(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function Wm(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:o(function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Sb(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s}function yR(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Sb(arguments[e]));return n}function vR(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var s=arguments[e],a=0,c=s.length;a<c;a++,i++)r[i]=s[a];return r}function zc(n){return this instanceof zc?(this.v=n,this):new zc(n)}function _R(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(d){r[d]&&(i[d]=function(p){return new Promise(function(_,b){s.push([d,p,_,b])>1||c(d,p)})})}function c(d,p){try{l(r[d](p))}catch(_){h(s[0][3],_)}}function l(d){d.value instanceof zc?Promise.resolve(d.value.v).then(u,f):h(s[0][2],d)}function u(d){c("next",d)}function f(d){c("throw",d)}function h(d,p){d(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function bR(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=n[i]?function(a){return(t=!t)?{value:zc(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function SR(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof Wm=="function"?Wm(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(a){return new Promise(function(c,l){a=n[s](a),i(c,l,a.done,a.value)})}}function i(s,a,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},a)}}function wR(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function ER(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function TR(n){return n&&n.__esModule?n:{default:n}}function xR(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function AR(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var qm,Gm,af=EI(()=>{qm=o(function(n,e){return qm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])},qm(n,e)},"extendStatics");o(cR,"__extends");Gm=o(function(){return Gm=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),Gm.apply(this,arguments)},"__assign");o(lR,"__rest");o(uR,"__decorate");o(fR,"__param");o(hR,"__metadata");o(dR,"__awaiter");o(pR,"__generator");o(mR,"__createBinding");o(gR,"__exportStar");o(Wm,"__values");o(Sb,"__read");o(yR,"__spread");o(vR,"__spreadArrays");o(zc,"__await");o(_R,"__asyncGenerator");o(bR,"__asyncDelegator");o(SR,"__asyncValues");o(wR,"__makeTemplateObject");o(ER,"__importStar");o(TR,"__importDefault");o(xR,"__classPrivateFieldGet");o(AR,"__classPrivateFieldSet")});var Qm=v(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var Hm;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(Hm||(Hm={}));zm.default=Hm});var wb=v(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});var CR=Qm();Object.defineProperty(Ym,"Lifecycle",{enumerable:!0,get:o(function(){return CR.default},"get")})});var ra=v(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.defineInjectionTokenMetadata=Fn.getParamInfo=Fn.INJECTION_TOKEN_METADATA_KEY=void 0;Fn.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function IR(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(Fn.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(IR,"getParamInfo");Fn.getParamInfo=IR;function OR(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(Fn.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(Fn.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(OR,"defineInjectionTokenMetadata");Fn.defineInjectionTokenMetadata=OR});var Km=v(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.isClassProvider=void 0;function PR(n){return!!n.useClass}o(PR,"isClassProvider");of.isClassProvider=PR});var Xm=v(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.isFactoryProvider=void 0;function RR(n){return!!n.useFactory}o(RR,"isFactoryProvider");cf.isFactoryProvider=RR});var uf=v(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.delay=eo.DelayedConstructor=void 0;var lf=class{static{o(this,"DelayedConstructor")}constructor(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}createProxy(e){let t={},r=!1,i,s=o(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=o(i=>{t[i]=(...s)=>{s[0]=e();let a=Reflect[i];return a(...s)}},"install");return this.reflectMethods.forEach(r),t}};eo.DelayedConstructor=lf;function FR(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new lf(n)}o(FR,"delay");eo.delay=FR});var ff=v(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.isConstructorToken=Si.isTransformDescriptor=Si.isTokenDescriptor=Si.isNormalToken=void 0;var DR=uf();function NR(n){return typeof n=="string"||typeof n=="symbol"}o(NR,"isNormalToken");Si.isNormalToken=NR;function LR(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(LR,"isTokenDescriptor");Si.isTokenDescriptor=LR;function kR(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(kR,"isTransformDescriptor");Si.isTransformDescriptor=kR;function MR(n){return typeof n=="function"||n instanceof DR.DelayedConstructor}o(MR,"isConstructorToken");Si.isConstructorToken=MR});var Jm=v(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.isTokenProvider=void 0;function jR(n){return!!n.useToken}o(jR,"isTokenProvider");hf.isTokenProvider=jR});var Zm=v(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.isValueProvider=void 0;function $R(n){return n.useValue!=null}o($R,"isValueProvider");df.isValueProvider=$R});var eg=v(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var VR=Km();Object.defineProperty(na,"isClassProvider",{enumerable:!0,get:o(function(){return VR.isClassProvider},"get")});var UR=Xm();Object.defineProperty(na,"isFactoryProvider",{enumerable:!0,get:o(function(){return UR.isFactoryProvider},"get")});var BR=ff();Object.defineProperty(na,"isNormalToken",{enumerable:!0,get:o(function(){return BR.isNormalToken},"get")});var qR=Jm();Object.defineProperty(na,"isTokenProvider",{enumerable:!0,get:o(function(){return qR.isTokenProvider},"get")});var GR=Zm();Object.defineProperty(na,"isValueProvider",{enumerable:!0,get:o(function(){return GR.isValueProvider},"get")})});var Eb=v(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.isProvider=void 0;var WR=Km(),HR=Zm(),zR=Jm(),QR=Xm();function YR(n){return WR.isClassProvider(n)||HR.isValueProvider(n)||zR.isTokenProvider(n)||QR.isFactoryProvider(n)}o(YR,"isProvider");pf.isProvider=YR});var ng=v(rg=>{"use strict";Object.defineProperty(rg,"__esModule",{value:!0});var tg=class{static{o(this,"RegistryBase")}constructor(){this._registryMap=new Map}entries(){return this._registryMap.entries()}getAll(e){return this.ensure(e),this._registryMap.get(e)}get(e){this.ensure(e);let t=this._registryMap.get(e);return t[t.length-1]||null}set(e,t){this.ensure(e),this._registryMap.get(e).push(t)}setAll(e,t){this._registryMap.set(e,t)}has(e){return this.ensure(e),this._registryMap.get(e).length>0}clear(){this._registryMap.clear()}ensure(e){this._registryMap.has(e)||this._registryMap.set(e,[])}};rg.default=tg});var Tb=v(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});var KR=ng(),ig=class extends KR.default{static{o(this,"Registry")}};sg.default=ig});var xb=v(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});var ag=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};og.default=ag});var cg=v(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.formatErrorCtor=void 0;function XR(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(XR,"formatDependency");function JR(n,e,t=" "){return[n,...e.message.split(`
|
|
31
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function p_(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?i=s[3]:r=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],r=s[3],i=s[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}o(p_,"incrementNodeInspectorPort");function Xp(){if(Ye.env.NO_COLOR||Ye.env.FORCE_COLOR==="0"||Ye.env.FORCE_COLOR==="false")return!1;if(Ye.env.FORCE_COLOR||Ye.env.CLICOLOR_FORCE!==void 0)return!0}o(Xp,"useColor");Jp.Command=Kp;Jp.useColor=Xp});var __=v(hn=>{var{Argument:g_}=Fu(),{Command:Zp}=m_(),{CommanderError:MI,InvalidArgumentError:y_}=Dc(),{Help:jI}=qp(),{Option:v_}=zp();hn.program=new Zp;hn.createCommand=n=>new Zp(n);hn.createOption=(n,e)=>new v_(n,e);hn.createArgument=(n,e)=>new g_(n,e);hn.Command=Zp;hn.Option=v_;hn.Argument=g_;hn.Help=jI;hn.CommanderError=MI;hn.InvalidArgumentError=y_;hn.InvalidOptionArgumentError=y_});var em=v(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.AssetClass=void 0;var S_;(function(n){n.AREA="ems__Area",n.TASK="ems__Task",n.PROJECT="ems__Project",n.MEETING="ems__Meeting",n.INITIATIVE="ems__Initiative",n.TASK_PROTOTYPE="ems__TaskPrototype",n.TASK_PROTOTYPE_UID="75302770-279e-4a59-ba85-09df29725713",n.MEETING_PROTOTYPE="ems__MeetingPrototype",n.EVENT_PROTOTYPE="exo__EventPrototype",n.PROJECT_PROTOTYPE="ems__ProjectPrototype",n.EVENT="exo__Event",n.DAILY_NOTE="pn__DailyNote",n.CONCEPT="ims__Concept",n.SESSION_START_EVENT="ems__SessionStartEvent",n.SESSION_END_EVENT="ems__SessionEndEvent",n.PROTOTYPE="exo__Prototype",n.CLASS="exo__Class",n.FLEETING_NOTE="ztlk__FleetingNote",n.FLEETING_NOTE_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7"})(S_||(Nu.AssetClass=S_={}))});var tm=v(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.EffortStatus=void 0;var w_;(function(n){n.DRAFT="ems__EffortStatusDraft",n.BACKLOG="ems__EffortStatusBacklog",n.ANALYSIS="ems__EffortStatusAnalysis",n.TODO="ems__EffortStatusToDo",n.DOING="ems__EffortStatusDoing",n.DONE="ems__EffortStatusDone",n.TRASHED="ems__EffortStatusTrashed"})(w_||(Lu.EffortStatus=w_={}))});var E_=v(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.hasPosition=$I;ku.isFixed=VI;function $I(n){return typeof n.x=="number"&&typeof n.y=="number"}o($I,"hasPosition");function VI(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}o(VI,"isFixed")});var T_=v(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.createEmptyGraphData=UI;Mu.mergeGraphData=BI;function UI(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}o(UI,"createEmptyGraphData");function BI(n,e){let t=new Map,r=new Set,i=[];for(let s of n.nodes)t.set(s.id,s);for(let s of e.nodes)t.set(s.id,s);for(let s of n.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}for(let s of e.edges){let a=`${s.source}->${s.target}:${s.type}`;r.has(a)||(r.add(a),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}o(BI,"mergeGraphData")});var rm=v(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.createEdgeId=qI;ju.edgesEqual=GI;function qI(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}o(qI,"createEdgeId");function GI(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}o(GI,"edgesEqual")});var nm=v(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.BUILT_IN_EDGE_STYLES=Tt.BUILT_IN_NODE_STYLES=Tt.DEFAULT_EDGE_STYLE=Tt.DEFAULT_NODE_STYLE=Tt.RDF_TYPE_PREDICATES=void 0;Tt.mergeNodeStyles=WI;Tt.mergeEdgeStyles=HI;Tt.extractLocalName=zI;Tt.isClassType=QI;Tt.isTypePredicate=YI;Tt.isSubClassPredicate=KI;Tt.RDF_TYPE_PREDICATES={RDF_TYPE:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",RDFS_CLASS:"http://www.w3.org/2000/01/rdf-schema#Class",OWL_CLASS:"http://www.w3.org/2002/07/owl#Class",RDFS_SUBCLASS_OF:"http://www.w3.org/2000/01/rdf-schema#subClassOf",OWL_EQUIVALENT_CLASS:"http://www.w3.org/2002/07/owl#equivalentClass",RDFS_LABEL:"http://www.w3.org/2000/01/rdf-schema#label",RDFS_COMMENT:"http://www.w3.org/2000/01/rdf-schema#comment"};Tt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Tt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Tt.BUILT_IN_NODE_STYLES={"http://www.w3.org/2000/01/rdf-schema#Class":{color:"#f59e0b",shape:"diamond",size:40},"http://www.w3.org/2002/07/owl#Class":{color:"#f59e0b",shape:"diamond",size:40},ems__Task:{color:"#22c55e",shape:"circle"},ems__Project:{color:"#3b82f6",shape:"square"},ems__Area:{color:"#8b5cf6",shape:"hexagon",size:40},ems__Meeting:{color:"#ec4899",shape:"circle"},exo__Class:{color:"#f59e0b",shape:"diamond"},ims__Person:{color:"#06b6d4",shape:"circle"}};Tt.BUILT_IN_EDGE_STYLES={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":{color:"#f59e0b",lineStyle:"dashed",arrow:"standard"},"http://www.w3.org/2000/01/rdf-schema#subClassOf":{color:"#8b5cf6",width:2,arrow:"triangle"},"https://exocortex.my/ontology/ems#Effort_parent":{color:"#6366f1",width:2,arrow:"standard"},"https://exocortex.my/ontology/exo#Asset_prototype":{color:"#f59e0b",lineStyle:"dashed",arrow:"circle"},"https://exocortex.my/ontology/exo#references":{color:"#22c55e",opacity:.4,arrow:"standard"}};function WI(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(WI,"mergeNodeStyles");function HI(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}o(HI,"mergeEdgeStyles");function zI(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}o(zI,"extractLocalName");function QI(n){return n===Tt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Tt.RDF_TYPE_PREDICATES.OWL_CLASS}o(QI,"isClassType");function YI(n){return n===Tt.RDF_TYPE_PREDICATES.RDF_TYPE}o(YI,"isTypePredicate");function KI(n){return n===Tt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}o(KI,"isSubClassPredicate")});var A_=v(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0})});var We=v($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.IRI=void 0;var im=class n{static{o(this,"IRI")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("IRI cannot be empty");if(!n.isValidIRI(t))throw new Error("Invalid IRI format");this._value=t}get value(){return this._value}equals(e){return this._value===e._value}toString(){return this._value}static isValidIRI(e){if(!e||e.trim().length===0||/\s/.test(e)||!/^[a-z][a-z0-9+.-]*:/i.test(e))return!1;let r=["http","https","ftp","ftps","file","mailto","tel","data","ws","wss","urn","obsidian"],i=e.match(/^([a-z][a-z0-9+.-]*?):/i);if(i){let s=i[1].toLowerCase();if(!r.includes(s))return!1}try{return new URL(e),!0}catch{return/^urn:[a-z0-9][a-z0-9-]{0,31}:[^\s]+$/i.test(e)}}};$u.IRI=im});var mt=v(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.Literal=void 0;Ys.parseLanguageTag=C_;Ys.createDirectionalLiteral=JI;Ys.createLiteralFromLanguageTag=ZI;var XI="http://www.w3.org/2001/XMLSchema#string",Nc=class{static{o(this,"Literal")}constructor(e,t,r,i){if(e.length===0)throw new Error("Literal value cannot be empty");if(t&&r)throw new Error("Literal cannot have both datatype and language tag");if(i&&!r)throw new Error("Literal cannot have direction without language tag");if(i&&i!=="ltr"&&i!=="rtl")throw new Error('Direction must be "ltr" or "rtl"');this._value=e,this._datatype=t,this._language=r?r.toLowerCase():void 0,this._direction=i}get value(){return this._value}get datatype(){return this._datatype}get language(){return this._language}get direction(){return this._direction}hasDirection(){return this._direction!==void 0}equals(e){if(this._value!==e._value||this._language!==e._language||this._direction!==e._direction)return!1;let t=this.normalizedDatatype(),r=e.normalizedDatatype();return t===r}normalizedDatatype(){return!this._datatype||this._datatype.value===XI?null:this._datatype.value}toString(){let e=`"${this._value}"`;return this._datatype?e+=`^^<${this._datatype.value}>`:this._language&&(e+=`@${this._language}`,this._direction&&(e+=`--${this._direction}`)),e}};Ys.Literal=Nc;function C_(n){let t=n.lastIndexOf("--");if(t===-1)return{language:n.toLowerCase()};let r=n.substring(t+2),i=n.substring(0,t);return r==="ltr"||r==="rtl"?{language:i.toLowerCase(),direction:r}:{language:n.toLowerCase()}}o(C_,"parseLanguageTag");function JI(n,e,t){return new Nc(n,void 0,e,t)}o(JI,"createDirectionalLiteral");function ZI(n,e){let{language:t,direction:r}=C_(e);return new Nc(n,void 0,t,r)}o(ZI,"createLiteralFromLanguageTag")});var kt=v(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.BlankNode=void 0;var Vu=class n{static{o(this,"BlankNode")}constructor(e){let t=e.trim();if(t.length===0)throw new Error("BlankNode id cannot be empty");this._id=t}get id(){return this._id}equals(e){return this._id===e._id}toString(){return`_:${this._id}`}static generateId(){return`b${++n.counter}`}static create(){return new n(n.generateId())}};Uu.BlankNode=Vu;Vu.counter=0});var dn=v(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.Namespace=void 0;var I_=We(),Or=class{static{o(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new I_.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new I_.IRI(`${this._iri.value}${e}`)}expand(e){let t=e.split(":");if(t.length!==2)return null;let[r,i]=t;return r!==this._prefix?null:this.term(i)}};Bu.Namespace=Or;Or.RDF=new Or("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");Or.RDFS=new Or("rdfs","http://www.w3.org/2000/01/rdf-schema#");Or.OWL=new Or("owl","http://www.w3.org/2002/07/owl#");Or.XSD=new Or("xsd","http://www.w3.org/2001/XMLSchema#");Or.EXO=new Or("exo","https://exocortex.my/ontology/exo#");Or.EMS=new Or("ems","https://exocortex.my/ontology/ems#")});var _i=v(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.Triple=void 0;var sm=We(),am=mt(),om=kt(),cm=class{static{o(this,"Triple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof sm.IRI&&t instanceof sm.IRI||e instanceof om.BlankNode&&t instanceof om.BlankNode||e instanceof am.Literal&&t instanceof am.Literal||this.isQuotedTriple(e)&&this.isQuotedTriple(t)?e.equals(t):!1}isQuotedTriple(e){return typeof e=="object"&&e!==null&&"termType"in e&&e.termType==="QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`${e} ${t} ${r} .`}nodeToString(e){return e instanceof sm.IRI?`<${e.value}>`:e instanceof om.BlankNode||e instanceof am.Literal||this.isQuotedTriple(e)?e.toString():""}};qu.Triple=cm});var Lc=v(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.QuotedTriple=void 0;var lm=We(),um=mt(),fm=kt(),hm=class n{static{o(this,"QuotedTriple")}constructor(e,t,r){this._subject=e,this._predicate=t,this._object=r}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}equals(e){return!(!this.equalsNode(this._subject,e._subject)||!this._predicate.equals(e._predicate)||!this.equalsNode(this._object,e._object))}equalsNode(e,t){return e instanceof lm.IRI&&t instanceof lm.IRI||e instanceof fm.BlankNode&&t instanceof fm.BlankNode||e instanceof um.Literal&&t instanceof um.Literal||e instanceof n&&t instanceof n?e.equals(t):!1}get termType(){return"QuotedTriple"}toString(){let e=this.nodeToString(this._subject),t=`<${this._predicate.value}>`,r=this.nodeToString(this._object);return`<< ${e} ${t} ${r} >>`}nodeToString(e){return e instanceof lm.IRI?`<${e.value}>`:e instanceof fm.BlankNode||e instanceof um.Literal||e instanceof n?e.toString():""}};Gu.QuotedTriple=hm});var O_=v(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.QuotedTriple=Ft.Triple=Ft.Namespace=Ft.BlankNode=Ft.createLiteralFromLanguageTag=Ft.createDirectionalLiteral=Ft.parseLanguageTag=Ft.Literal=Ft.IRI=void 0;var eO=We();Object.defineProperty(Ft,"IRI",{enumerable:!0,get:o(function(){return eO.IRI},"get")});var Wu=mt();Object.defineProperty(Ft,"Literal",{enumerable:!0,get:o(function(){return Wu.Literal},"get")});Object.defineProperty(Ft,"parseLanguageTag",{enumerable:!0,get:o(function(){return Wu.parseLanguageTag},"get")});Object.defineProperty(Ft,"createDirectionalLiteral",{enumerable:!0,get:o(function(){return Wu.createDirectionalLiteral},"get")});Object.defineProperty(Ft,"createLiteralFromLanguageTag",{enumerable:!0,get:o(function(){return Wu.createLiteralFromLanguageTag},"get")});var tO=kt();Object.defineProperty(Ft,"BlankNode",{enumerable:!0,get:o(function(){return tO.BlankNode},"get")});var rO=dn();Object.defineProperty(Ft,"Namespace",{enumerable:!0,get:o(function(){return rO.Namespace},"get")});var nO=_i();Object.defineProperty(Ft,"Triple",{enumerable:!0,get:o(function(){return nO.Triple},"get")});var iO=Lc();Object.defineProperty(Ft,"QuotedTriple",{enumerable:!0,get:o(function(){return iO.QuotedTriple},"get")})});var Hu=v(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.UUID_URL_NAMESPACE=mn.DEFAULT_LANGUAGE_TAG=mn.REQUIRED_PROPERTIES=mn.ALLOWED_PROPERTIES=mn.Exo003MetadataType=void 0;var pn;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(pn||(mn.Exo003MetadataType=pn={}));mn.ALLOWED_PROPERTIES={[pn.Namespace]:["metadata","uri","aliases"],[pn.Anchor]:["metadata","uri","aliases"],[pn.BlankNode]:["metadata","uri","aliases"],[pn.Statement]:["metadata","subject","predicate","object","aliases"],[pn.Body]:["metadata","subject","predicate","aliases"]};mn.REQUIRED_PROPERTIES={[pn.Namespace]:["metadata","uri"],[pn.Anchor]:["metadata","uri"],[pn.BlankNode]:["metadata","uri"],[pn.Statement]:["metadata","subject","predicate","object"],[pn.Body]:["metadata","subject","predicate"]};mn.DEFAULT_LANGUAGE_TAG="ru";mn.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var P_=v(dm=>{"use strict";Object.defineProperty(dm,"__esModule",{value:!0});dm.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var R_=v(pm=>{"use strict";Object.defineProperty(pm,"__esModule",{value:!0});pm.default="00000000-0000-0000-0000-000000000000"});var F_=v(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});mm.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var kc=v(gm=>{"use strict";Object.defineProperty(gm,"__esModule",{value:!0});var sO=F_();function aO(n){return typeof n=="string"&&sO.default.test(n)}o(aO,"validate");gm.default=aO});var Mc=v(ym=>{"use strict";Object.defineProperty(ym,"__esModule",{value:!0});var oO=kc();function cO(n){if(!(0,oO.default)(n))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(n.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(n.slice(9,13),16))>>>8,e&255,(e=parseInt(n.slice(14,18),16))>>>8,e&255,(e=parseInt(n.slice(19,23),16))>>>8,e&255,(e=parseInt(n.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}o(cO,"parse");ym.default=cO});var zi=v(jc=>{"use strict";Object.defineProperty(jc,"__esModule",{value:!0});jc.unsafeStringify=void 0;var lO=kc(),tr=[];for(let n=0;n<256;++n)tr.push((n+256).toString(16).slice(1));function D_(n,e=0){return(tr[n[e+0]]+tr[n[e+1]]+tr[n[e+2]]+tr[n[e+3]]+"-"+tr[n[e+4]]+tr[n[e+5]]+"-"+tr[n[e+6]]+tr[n[e+7]]+"-"+tr[n[e+8]]+tr[n[e+9]]+"-"+tr[n[e+10]]+tr[n[e+11]]+tr[n[e+12]]+tr[n[e+13]]+tr[n[e+14]]+tr[n[e+15]]).toLowerCase()}o(D_,"unsafeStringify");jc.unsafeStringify=D_;function uO(n,e=0){let t=D_(n,e);if(!(0,lO.default)(t))throw TypeError("Stringified UUID is invalid");return t}o(uO,"stringify");jc.default=uO});var Yu=v(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});var fO=require("crypto"),Qu=new Uint8Array(256),zu=Qu.length;function hO(){return zu>Qu.length-16&&((0,fO.randomFillSync)(Qu),zu=0),Qu.slice(zu,zu+=16)}o(hO,"rng");vm.default=hO});var _m=v(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.updateV1State=void 0;var N_=Yu(),dO=zi(),$c={};function pO(n,e,t){let r,i=n?._v6??!1;if(n){let s=Object.keys(n);s.length===1&&s[0]==="_v6"&&(n=void 0)}if(n)r=L_(n.random??n.rng?.()??(0,N_.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),a=(0,N_.default)();k_($c,s,a),r=L_(a,$c.msecs,$c.nsecs,i?void 0:$c.clockseq,i?void 0:$c.node,e,t)}return e??(0,dO.unsafeStringify)(r)}o(pO,"v1");function k_(n,e,t){return n.msecs??=-1/0,n.nsecs??=0,e===n.msecs?(n.nsecs++,n.nsecs>=1e4&&(n.node=void 0,n.nsecs=0)):e>n.msecs?n.nsecs=0:e<n.msecs&&(n.node=void 0),n.node||(n.node=t.slice(10,16),n.node[0]|=1,n.clockseq=(t[8]<<8|t[9])&16383),n.msecs=e,n}o(k_,"updateV1State");Vc.updateV1State=k_;function L_(n,e,t,r,i,s,a=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),a=0;else if(a<0||a+16>s.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);e??=Date.now(),t??=0,r??=(n[8]<<8|n[9])&16383,i??=n.slice(10,16),e+=122192928e5;let c=((e&268435455)*1e4+t)%4294967296;s[a++]=c>>>24&255,s[a++]=c>>>16&255,s[a++]=c>>>8&255,s[a++]=c&255;let l=e/4294967296*1e4&268435455;s[a++]=l>>>8&255,s[a++]=l&255,s[a++]=l>>>24&15|16,s[a++]=l>>>16&255,s[a++]=r>>>8|128,s[a++]=r&255;for(let u=0;u<6;++u)s[a++]=i[u];return s}o(L_,"v1Bytes");Vc.default=pO});var Sm=v(bm=>{"use strict";Object.defineProperty(bm,"__esModule",{value:!0});var mO=Mc(),gO=zi();function yO(n){let e=typeof n=="string"?(0,mO.default)(n):n,t=vO(e);return typeof n=="string"?(0,gO.unsafeStringify)(t):t}o(yO,"v1ToV6");bm.default=yO;function vO(n){return Uint8Array.of((n[6]&15)<<4|n[7]>>4&15,(n[7]&15)<<4|(n[4]&240)>>4,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,(n[1]&15)<<4|(n[2]&240)>>4,96|n[2]&15,n[3],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(vO,"_v1ToV6")});var M_=v(wm=>{"use strict";Object.defineProperty(wm,"__esModule",{value:!0});var _O=require("crypto");function bO(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,_O.createHash)("md5").update(n).digest()}o(bO,"md5");wm.default=bO});var Uc=v(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.URL=Qi.DNS=Qi.stringToBytes=void 0;var j_=Mc(),SO=zi();function $_(n){n=unescape(encodeURIComponent(n));let e=new Uint8Array(n.length);for(let t=0;t<n.length;++t)e[t]=n.charCodeAt(t);return e}o($_,"stringToBytes");Qi.stringToBytes=$_;Qi.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Qi.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function wO(n,e,t,r,i,s){let a=typeof t=="string"?$_(t):t,c=typeof r=="string"?(0,j_.default)(r):r;if(typeof r=="string"&&(r=(0,j_.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+a.length);if(l.set(c),l.set(a,c.length),l=e(l),l[6]=l[6]&15|n,l[8]=l[8]&63|128,i){s=s||0;for(let u=0;u<16;++u)i[s+u]=l[u];return i}return(0,SO.unsafeStringify)(l)}o(wO,"v35");Qi.default=wO});var U_=v(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.URL=Ks.DNS=void 0;var EO=M_(),Em=Uc(),V_=Uc();Object.defineProperty(Ks,"DNS",{enumerable:!0,get:o(function(){return V_.DNS},"get")});Object.defineProperty(Ks,"URL",{enumerable:!0,get:o(function(){return V_.URL},"get")});function Tm(n,e,t,r){return(0,Em.default)(48,EO.default,n,e,t,r)}o(Tm,"v3");Tm.DNS=Em.DNS;Tm.URL=Em.URL;Ks.default=Tm});var B_=v(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});var TO=require("crypto");xm.default={randomUUID:TO.randomUUID}});var G_=v(Am=>{"use strict";Object.defineProperty(Am,"__esModule",{value:!0});var q_=B_(),xO=Yu(),AO=zi();function CO(n,e,t){if(q_.default.randomUUID&&!e&&!n)return q_.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,xO.default)();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return(0,AO.unsafeStringify)(r)}o(CO,"v4");Am.default=CO});var W_=v(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});var IO=require("crypto");function OO(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,IO.createHash)("sha1").update(n).digest()}o(OO,"sha1");Cm.default=OO});var z_=v(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.URL=Xs.DNS=void 0;var PO=W_(),Im=Uc(),H_=Uc();Object.defineProperty(Xs,"DNS",{enumerable:!0,get:o(function(){return H_.DNS},"get")});Object.defineProperty(Xs,"URL",{enumerable:!0,get:o(function(){return H_.URL},"get")});function Om(n,e,t,r){return(0,Im.default)(80,PO.default,n,e,t,r)}o(Om,"v5");Om.DNS=Im.DNS;Om.URL=Im.URL;Xs.default=Om});var Q_=v(Pm=>{"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var RO=zi(),FO=_m(),DO=Sm();function NO(n,e,t){n??={},t??=0;let r=(0,FO.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,DO.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,RO.unsafeStringify)(r)}o(NO,"v6");Pm.default=NO});var Y_=v(Rm=>{"use strict";Object.defineProperty(Rm,"__esModule",{value:!0});var LO=Mc(),kO=zi();function MO(n){let e=typeof n=="string"?(0,LO.default)(n):n,t=jO(e);return typeof n=="string"?(0,kO.unsafeStringify)(t):t}o(MO,"v6ToV1");Rm.default=MO;function jO(n){return Uint8Array.of((n[3]&15)<<4|n[4]>>4&15,(n[4]&15)<<4|(n[5]&240)>>4,(n[5]&15)<<4|n[6]&15,n[7],(n[1]&15)<<4|(n[2]&240)>>4,(n[2]&15)<<4|(n[3]&240)>>4,16|(n[0]&240)>>4,(n[0]&15)<<4|(n[1]&240)>>4,n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}o(jO,"_v6ToV1")});var Z_=v(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.updateV7State=void 0;var K_=Yu(),$O=zi(),Fm={};function VO(n,e,t){let r;if(n)r=X_(n.random??n.rng?.()??(0,K_.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,K_.default)();J_(Fm,i,s),r=X_(s,Fm.msecs,Fm.seq,e,t)}return e??(0,$O.unsafeStringify)(r)}o(VO,"v7");function J_(n,e,t){return n.msecs??=-1/0,n.seq??=0,e>n.msecs?(n.seq=t[6]<<23|t[7]<<16|t[8]<<8|t[9],n.msecs=e):(n.seq=n.seq+1|0,n.seq===0&&n.msecs++),n}o(J_,"updateV7State");Bc.updateV7State=J_;function X_(n,e,t,r,i=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return e??=Date.now(),t??=n[6]*127<<24|n[7]<<16|n[8]<<8|n[9],r[i++]=e/1099511627776&255,r[i++]=e/4294967296&255,r[i++]=e/16777216&255,r[i++]=e/65536&255,r[i++]=e/256&255,r[i++]=e&255,r[i++]=112|t>>>28&15,r[i++]=t>>>20&255,r[i++]=128|t>>>14&63,r[i++]=t>>>6&255,r[i++]=t<<2&255|n[10]&3,r[i++]=n[11],r[i++]=n[12],r[i++]=n[13],r[i++]=n[14],r[i++]=n[15],r}o(X_,"v7Bytes");Bc.default=VO});var eb=v(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});var UO=kc();function BO(n){if(!(0,UO.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}o(BO,"version");Dm.default=BO});var Pr=v(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.version=Xe.validate=Xe.v7=Xe.v6ToV1=Xe.v6=Xe.v5=Xe.v4=Xe.v3=Xe.v1ToV6=Xe.v1=Xe.stringify=Xe.parse=Xe.NIL=Xe.MAX=void 0;var qO=P_();Object.defineProperty(Xe,"MAX",{enumerable:!0,get:o(function(){return qO.default},"get")});var GO=R_();Object.defineProperty(Xe,"NIL",{enumerable:!0,get:o(function(){return GO.default},"get")});var WO=Mc();Object.defineProperty(Xe,"parse",{enumerable:!0,get:o(function(){return WO.default},"get")});var HO=zi();Object.defineProperty(Xe,"stringify",{enumerable:!0,get:o(function(){return HO.default},"get")});var zO=_m();Object.defineProperty(Xe,"v1",{enumerable:!0,get:o(function(){return zO.default},"get")});var QO=Sm();Object.defineProperty(Xe,"v1ToV6",{enumerable:!0,get:o(function(){return QO.default},"get")});var YO=U_();Object.defineProperty(Xe,"v3",{enumerable:!0,get:o(function(){return YO.default},"get")});var KO=G_();Object.defineProperty(Xe,"v4",{enumerable:!0,get:o(function(){return KO.default},"get")});var XO=z_();Object.defineProperty(Xe,"v5",{enumerable:!0,get:o(function(){return XO.default},"get")});var JO=Q_();Object.defineProperty(Xe,"v6",{enumerable:!0,get:o(function(){return JO.default},"get")});var ZO=Y_();Object.defineProperty(Xe,"v6ToV1",{enumerable:!0,get:o(function(){return ZO.default},"get")});var eP=Z_();Object.defineProperty(Xe,"v7",{enumerable:!0,get:o(function(){return eP.default},"get")});var tP=kc();Object.defineProperty(Xe,"validate",{enumerable:!0,get:o(function(){return tP.default},"get")});var rP=eb();Object.defineProperty(Xe,"version",{enumerable:!0,get:o(function(){return rP.default},"get")})});var km=v(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.Exo003UUIDGenerator=void 0;var Nm=Pr(),tb=Hu(),Lm=class{static{o(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,Nm.v5)(e,tb.UUID_URL_NAMESPACE)}static generateAssetUUID(e,t){if(!t||t.trim().length===0)throw new Error("Local identifier cannot be empty");let r=this.generateNamespaceUUID(e);return(0,Nm.v5)(t,r)}static generateFromIRI(e){if(!e||e.trim().length===0)throw new Error("IRI cannot be empty");let{namespace:t,localName:r}=this.splitIRI(e);return r?this.generateAssetUUID(t,r):(0,Nm.v5)(e,tb.UUID_URL_NAMESPACE)}static generateBlankNodeUUID(e,t){if(!e||e.trim().length===0)throw new Error("Blank node ID cannot be empty");let r="urn:exocortex:blank-node:",i=t?`${t}#${e}`:e;return this.generateAssetUUID(r,i)}static generateStatementUUID(e,t,r){if(!e||!t||!r)throw new Error("Subject, predicate, and object cannot be empty");let i="urn:exocortex:statement:",s=`${e} ${t} ${r}`;return this.generateAssetUUID(i,s)}static generateBodyUUID(e,t){let r="urn:exocortex:body:",i=e;return t?.datatype?i+=`^^${t.datatype}`:t?.language&&(i+=`@${t.language}`,t.direction&&(i+=`--${t.direction}`)),this.generateAssetUUID(r,i)}static splitIRI(e){let t=e.lastIndexOf("#");if(t!==-1&&t<e.length-1)return{namespace:e.substring(0,t+1),localName:e.substring(t+1)};let r=e.lastIndexOf("/"),i=e.indexOf("://");return r!==-1&&r>i+2&&r<e.length-1?{namespace:e.substring(0,r+1),localName:e.substring(r+1)}:{namespace:e,localName:""}}static isValidUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};Ku.Exo003UUIDGenerator=Lm});var nb=v(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Exo003Parser=void 0;var at=Hu(),qc=km(),fs=We(),Xu=mt(),rb=kt(),nP=_i(),Mm=class{static{o(this,"Exo003Parser")}static parse(e,t){let r=this.validate(e);if(!r.valid)return{success:!1,errors:r.errors};let i=e.metadata;try{return{success:!0,metadata:this.parseByType(e,i),bodyContent:i===at.Exo003MetadataType.Body?t:void 0}}catch(s){return{success:!1,errors:[s instanceof Error?s.message:String(s)]}}}static validate(e){let t=[],r=[];if(!e.metadata)return t.push("Missing required property: metadata"),{valid:!1,errors:t,warnings:r};let i=e.metadata;if(!Object.values(at.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(at.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,a=at.ALLOWED_PROPERTIES[s],c=at.REQUIRED_PROPERTIES[s];for(let l of c)(e[l]===void 0||e[l]===null)&&t.push(`Missing required property: ${l}`);for(let l of Object.keys(e))a.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case at.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case at.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case at.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case at.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case at.Exo003MetadataType.Body:this.validateBodyMetadata(e,t,r);break}return{valid:t.length===0,errors:t,warnings:r}}static parseByType(e,t){let r={metadata:t,aliases:e.aliases};switch(t){case at.Exo003MetadataType.Namespace:return{...r,metadata:at.Exo003MetadataType.Namespace,uri:e.uri};case at.Exo003MetadataType.Anchor:return{...r,metadata:at.Exo003MetadataType.Anchor,uri:e.uri};case at.Exo003MetadataType.BlankNode:return{...r,metadata:at.Exo003MetadataType.BlankNode,uri:e.uri};case at.Exo003MetadataType.Statement:return{...r,metadata:at.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case at.Exo003MetadataType.Body:return{...r,metadata:at.Exo003MetadataType.Body,subject:e.subject,predicate:e.predicate}}}static validateNamespaceMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new fs.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateAnchorMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r)try{new fs.IRI(r)}catch{t.push(`uri is not a valid IRI: ${String(r)}`)}}static validateBlankNodeMetadata(e,t){let r=e.uri;if(r&&typeof r!="string")t.push("uri must be a string");else if(r){let i=r;if(!i.startsWith("_:"))try{new fs.IRI(i)}catch{t.push(`uri is not a valid IRI or blank node identifier: ${String(r)}`)}}}static validateStatementMetadata(e,t){let r=e.subject,i=e.predicate,s=e.object,a=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of a)l&&typeof l!="string"&&t.push(`${c} must be a string`)}static validateBodyMetadata(e,t,r){let i=e.subject,s=e.predicate;i&&typeof i!="string"&&t.push("subject must be a string"),s&&typeof s!="string"&&t.push("predicate must be a string")}static toTriple(e,t,r){let i=t(e.subject),s;if(i.type==="iri")s=new fs.IRI(i.value);else if(i.type==="blank")s=new rb.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let a=t(e.predicate);if(a.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new fs.IRI(a.value),l=t(e.object),u;if(l.type==="iri")u=new fs.IRI(l.value);else if(l.type==="blank")u=new rb.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new Xu.Literal(f,new fs.IRI(l.datatype));else{let h=l.language||at.DEFAULT_LANGUAGE_TAG;u=(0,Xu.createDirectionalLiteral)(f,h,l.direction)}}return new nP.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new Xu.Literal(t,new fs.IRI(r.datatype));let i=r?.language||at.DEFAULT_LANGUAGE_TAG;return(0,Xu.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(at.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case at.Exo003MetadataType.Namespace:return qc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case at.Exo003MetadataType.Anchor:return qc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case at.Exo003MetadataType.BlankNode:return qc.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case at.Exo003MetadataType.Statement:{let r=e;return qc.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case at.Exo003MetadataType.Body:{let r=e;return qc.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};Ju.Exo003Parser=Mm});var jm=v(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.Exo003Parser=dr.Exo003UUIDGenerator=dr.UUID_URL_NAMESPACE=dr.DEFAULT_LANGUAGE_TAG=dr.REQUIRED_PROPERTIES=dr.ALLOWED_PROPERTIES=dr.Exo003MetadataType=void 0;var Gc=Hu();Object.defineProperty(dr,"Exo003MetadataType",{enumerable:!0,get:o(function(){return Gc.Exo003MetadataType},"get")});Object.defineProperty(dr,"ALLOWED_PROPERTIES",{enumerable:!0,get:o(function(){return Gc.ALLOWED_PROPERTIES},"get")});Object.defineProperty(dr,"REQUIRED_PROPERTIES",{enumerable:!0,get:o(function(){return Gc.REQUIRED_PROPERTIES},"get")});Object.defineProperty(dr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:o(function(){return Gc.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(dr,"UUID_URL_NAMESPACE",{enumerable:!0,get:o(function(){return Gc.UUID_URL_NAMESPACE},"get")});var iP=km();Object.defineProperty(dr,"Exo003UUIDGenerator",{enumerable:!0,get:o(function(){return iP.Exo003UUIDGenerator},"get")});var sP=nb();Object.defineProperty(dr,"Exo003Parser",{enumerable:!0,get:o(function(){return sP.Exo003Parser},"get")})});var Js=v(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.WikiLinkHelpers=void 0;var Zu=class{static{o(this,"WikiLinkHelpers")}static normalize(e){return e?e.replace(this.WIKI_LINK_PATTERN,"").trim():""}static normalizeArray(e){return e?(Array.isArray(e)?e:[e]).map(r=>this.normalize(r)).filter(r=>r.length>0):[]}static equals(e,t){return this.normalize(e)===this.normalize(t)}static includes(e,t){let r=this.normalizeArray(e),i=this.normalize(t);return r.includes(i)}};ef.WikiLinkHelpers=Zu;Zu.WIKI_LINK_PATTERN=/\[\[|\]\]/g});var pr=v(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.EffortStatus=Ka.AssetClass=void 0;var aP=em();Object.defineProperty(Ka,"AssetClass",{enumerable:!0,get:o(function(){return aP.AssetClass},"get")});var oP=tm();Object.defineProperty(Ka,"EffortStatus",{enumerable:!0,get:o(function(){return oP.EffortStatus},"get")})});var hs=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.hasClass=ea;mr.isAreaOrProject=cP;mr.isEffort=lP;mr.hasStatus=uP;mr.isAssetArchived=fP;mr.hasEmptyProperties=hP;mr.needsFolderRepair=dP;mr.getTodayDateString=$m;mr.isPlannedForToday=pP;mr.hasPlannedStartTimestamp=mP;mr.extractDailyNoteDate=gP;mr.isCurrentDateGteDay=yP;mr.inheritsFromPrototype=ab;mr.isPrototypeClass=_P;var sb=Js(),Zs=pr();function ea(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>sb.WikiLinkHelpers.normalize(r)===e):!1}o(ea,"hasClass");function cP(n){return ea(n,Zs.AssetClass.AREA)||ea(n,Zs.AssetClass.PROJECT)}o(cP,"isAreaOrProject");function lP(n){return ea(n,Zs.AssetClass.TASK)||ea(n,Zs.AssetClass.PROJECT)||ea(n,Zs.AssetClass.MEETING)}o(lP,"isEffort");function uP(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?sb.WikiLinkHelpers.normalize(t)===e:!1}o(uP,"hasStatus");function fP(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}o(fP,"isAssetArchived");function hP(n){return!n||Object.keys(n).length===0?!1:Object.values(n).some(e=>!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0))}o(hP,"hasEmptyProperties");function dP(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}o(dP,"needsFolderRepair");function $m(){let n=new Date,e=n.getFullYear(),t=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0");return`${e}-${t}-${r}`}o($m,"getTodayDateString");function pP(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=$m();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}o(pP,"isPlannedForToday");function mP(n){let e=n.ems__Effort_plannedStartTimestamp;return e?typeof e=="string"?e.trim().length>0:Array.isArray(e)&&e.length>0?String(e[0]).trim().length>0:!1:!1}o(mP,"hasPlannedStartTimestamp");function gP(n){let e=n.pn__DailyNote_day;if(!e)return null;if(typeof e=="string"){let t=e.match(/\[\[([^\[\]]+)\]\]/);return t?t[1]:e}if(Array.isArray(e)&&e.length>0){let t=String(e[0]),r=t.match(/\[\[([^\[\]]+)\]\]/);return r?r[1]:t}return null}o(gP,"extractDailyNoteDate");function yP(n){return $m()>=n}o(yP,"isCurrentDateGteDay");function ib(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}o(ib,"normalizeWithQuotes");var vP=10;function ab(n,e=vP){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let a of s){let c=ib(a);c&&i.push({className:c,depth:0})}for(;i.length>0;){let a=i.shift();if(!a)continue;let{className:c,depth:l}=a;if(l>e)continue;if(c===Zs.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let h=Array.isArray(f)?f:[f];for(let d of h){let p=ib(d);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}o(ab,"inheritsFromPrototype");function _P(n,e){return ea(n,Zs.AssetClass.CLASS)?ab(e):!1}o(_P,"isPrototypeClass")});var ob=v(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});Ja.canCreateTask=bP;Ja.canCreateRelatedTask=SP;Ja.canConvertTaskToProject=wP;Ja.canSetCriticalityZone=EP;var Xa=hs(),Vm=pr();function bP(n){return(0,Xa.isAreaOrProject)(n.instanceClass)}o(bP,"canCreateTask");function SP(n){return!(!(0,Xa.hasClass)(n.instanceClass,Vm.AssetClass.TASK)||(0,Xa.isAssetArchived)(n.isArchived))}o(SP,"canCreateRelatedTask");function wP(n){return(0,Xa.hasClass)(n.instanceClass,Vm.AssetClass.TASK)}o(wP,"canConvertTaskToProject");function EP(n){return!(!(0,Xa.hasClass)(n.instanceClass,Vm.AssetClass.TASK)||(0,Xa.isAssetArchived)(n.isArchived))}o(EP,"canSetCriticalityZone")});var cb=v(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.canCreateProject=TP;Za.canMoveToAnalysis=xP;Za.canMoveToToDo=AP;Za.canConvertProjectToTask=CP;var ds=hs(),ps=pr();function TP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.AREA)||(0,ds.hasClass)(n.instanceClass,ps.AssetClass.INITIATIVE)||(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)}o(TP,"canCreateProject");function xP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)?(0,ds.hasStatus)(n.currentStatus,ps.EffortStatus.BACKLOG):!1}o(xP,"canMoveToAnalysis");function AP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)?(0,ds.hasStatus)(n.currentStatus,ps.EffortStatus.ANALYSIS):!1}o(AP,"canMoveToToDo");function CP(n){return(0,ds.hasClass)(n.instanceClass,ps.AssetClass.PROJECT)}o(CP,"canConvertProjectToTask")});var fb=v(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.canCreateChildArea=IP;tf.canSetActiveFocus=OP;var lb=hs(),ub=pr();function IP(n){return(0,lb.hasClass)(n.instanceClass,ub.AssetClass.AREA)}o(IP,"canCreateChildArea");function OP(n){return(0,lb.hasClass)(n.instanceClass,ub.AssetClass.AREA)}o(OP,"canSetActiveFocus")});var db=v(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.canPlanOnToday=PP;Fr.canPlanForEvening=RP;Fr.canShiftDayBackward=FP;Fr.canShiftDayForward=DP;Fr.canSetDraftStatus=NP;Fr.canMoveToBacklog=LP;Fr.canStartEffort=kP;Fr.canMarkDone=MP;Fr.canTrashEffort=jP;Fr.canVoteOnEffort=$P;Fr.canRollbackStatus=VP;Fr.canArchiveTask=UP;Fr.canMarkReviewed=BP;var hb=Js(),tt=hs(),Rr=pr();function PP(n){return!(!(0,tt.isEffort)(n.instanceClass)||(0,tt.isPlannedForToday)(n.metadata))}o(PP,"canPlanOnToday");function RP(n){return!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.TASK)&&!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.MEETING)?!1:(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.BACKLOG)}o(RP,"canPlanForEvening");function FP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasPlannedStartTimestamp)(n.metadata):!1}o(FP,"canShiftDayBackward");function DP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasPlannedStartTimestamp)(n.metadata):!1}o(DP,"canShiftDayForward");function NP(n){return(0,tt.isEffort)(n.instanceClass)?!n.currentStatus:!1}o(NP,"canSetDraftStatus");function LP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.DRAFT):!1}o(LP,"canMoveToBacklog");function kP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.TASK)||(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.MEETING)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.BACKLOG):(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.PROJECT)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.TODO):!1:!1}o(kP,"canStartEffort");function MP(n){return(0,tt.isEffort)(n.instanceClass)?(0,tt.hasStatus)(n.currentStatus,Rr.EffortStatus.DOING):!1}o(MP,"canMarkDone");function jP(n){return(0,tt.isEffort)(n.instanceClass)?n.currentStatus?!(Array.isArray(n.currentStatus)?n.currentStatus:[n.currentStatus]).some(r=>{let i=hb.WikiLinkHelpers.normalize(r);return i===Rr.EffortStatus.TRASHED||i===Rr.EffortStatus.DONE}):!0:!1}o(jP,"canTrashEffort");function $P(n){return!(!(0,tt.isEffort)(n.instanceClass)||(0,tt.isAssetArchived)(n.isArchived))}o($P,"canVoteOnEffort");function VP(n){if(!(0,tt.isEffort)(n.instanceClass)||(0,tt.isAssetArchived)(n.isArchived)||!n.currentStatus)return!1;let e=Array.isArray(n.currentStatus)?n.currentStatus[0]:n.currentStatus;return!(!e||hb.WikiLinkHelpers.normalize(e)===Rr.EffortStatus.TRASHED)}o(VP,"canRollbackStatus");function UP(n){return!(0,tt.isAssetArchived)(n.isArchived)}o(UP,"canArchiveTask");function BP(n){return!(!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.TASK)&&!(0,tt.hasClass)(n.instanceClass,Rr.AssetClass.PROJECT)||(0,tt.isAssetArchived)(n.isArchived))}o(BP,"canMarkReviewed")});var pb=v(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.canCreateEvent=qP;gn.canCreateInstance=GP;gn.canCleanProperties=WP;gn.canRepairFolder=HP;gn.canRenameToUid=zP;gn.canCopyLabelToAliases=QP;gn.canCreateNarrowerConcept=YP;gn.canCreateSubclass=KP;gn.canCreateTaskForDailyNote=XP;gn.canCopyFleetingNoteLabel=JP;var gr=hs(),Rn=pr();function qP(n){return(0,gr.isAreaOrProject)(n.instanceClass)}o(qP,"canCreateEvent");function GP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.TASK_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.TASK_PROTOTYPE_UID)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.MEETING_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.EVENT_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.PROJECT_PROTOTYPE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.PROTOTYPE)||n.classIsPrototype?!0:(0,gr.isPrototypeClass)(n.instanceClass,n.metadata)}o(GP,"canCreateInstance");function WP(n){return(0,gr.hasEmptyProperties)(n.metadata)}o(WP,"canCleanProperties");function HP(n){return(0,gr.needsFolderRepair)(n.currentFolder,n.expectedFolder)}o(HP,"canRepairFolder");function zP(n,e){let t=n.metadata.exo__Asset_uid;return t?e!==t:!1}o(zP,"canRenameToUid");function QP(n){let e=n.metadata.exo__Asset_label;if(!e||typeof e!="string"||e.trim()==="")return!1;let t=e.trim(),r=n.metadata.aliases;return!r||!Array.isArray(r)||r.length===0?!0:!r.some(i=>typeof i!="string"?!1:i.trim()===t)}o(QP,"canCopyLabelToAliases");function YP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.CONCEPT)}o(YP,"canCreateNarrowerConcept");function KP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.CLASS)}o(KP,"canCreateSubclass");function XP(n){return!(!(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.DAILY_NOTE)||n.isArchived||!(0,gr.extractDailyNoteDate)(n.metadata))}o(XP,"canCreateTaskForDailyNote");function JP(n){return(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.FLEETING_NOTE)||(0,gr.hasClass)(n.instanceClass,Rn.AssetClass.FLEETING_NOTE_UID)}o(JP,"canCopyFleetingNoteLabel")});var gb=v(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.canCopyFleetingNoteLabel=D.canCreateTaskForDailyNote=D.canCreateSubclass=D.canCreateNarrowerConcept=D.canCopyLabelToAliases=D.canRenameToUid=D.canRepairFolder=D.canCleanProperties=D.canCreateInstance=D.canCreateEvent=D.canMarkReviewed=D.canArchiveTask=D.canRollbackStatus=D.canVoteOnEffort=D.canTrashEffort=D.canMarkDone=D.canStartEffort=D.canMoveToBacklog=D.canSetDraftStatus=D.canShiftDayForward=D.canShiftDayBackward=D.canPlanForEvening=D.canPlanOnToday=D.canSetActiveFocus=D.canCreateChildArea=D.canConvertProjectToTask=D.canMoveToToDo=D.canMoveToAnalysis=D.canCreateProject=D.canSetCriticalityZone=D.canConvertTaskToProject=D.canCreateRelatedTask=D.canCreateTask=D.isPrototypeClass=D.inheritsFromPrototype=D.isCurrentDateGteDay=D.extractDailyNoteDate=D.hasPlannedStartTimestamp=D.isPlannedForToday=D.getTodayDateString=D.needsFolderRepair=D.hasEmptyProperties=D.isAssetArchived=D.hasStatus=D.isEffort=D.isAreaOrProject=D.hasClass=void 0;var Gr=hs();Object.defineProperty(D,"hasClass",{enumerable:!0,get:o(function(){return Gr.hasClass},"get")});Object.defineProperty(D,"isAreaOrProject",{enumerable:!0,get:o(function(){return Gr.isAreaOrProject},"get")});Object.defineProperty(D,"isEffort",{enumerable:!0,get:o(function(){return Gr.isEffort},"get")});Object.defineProperty(D,"hasStatus",{enumerable:!0,get:o(function(){return Gr.hasStatus},"get")});Object.defineProperty(D,"isAssetArchived",{enumerable:!0,get:o(function(){return Gr.isAssetArchived},"get")});Object.defineProperty(D,"hasEmptyProperties",{enumerable:!0,get:o(function(){return Gr.hasEmptyProperties},"get")});Object.defineProperty(D,"needsFolderRepair",{enumerable:!0,get:o(function(){return Gr.needsFolderRepair},"get")});Object.defineProperty(D,"getTodayDateString",{enumerable:!0,get:o(function(){return Gr.getTodayDateString},"get")});Object.defineProperty(D,"isPlannedForToday",{enumerable:!0,get:o(function(){return Gr.isPlannedForToday},"get")});Object.defineProperty(D,"hasPlannedStartTimestamp",{enumerable:!0,get:o(function(){return Gr.hasPlannedStartTimestamp},"get")});Object.defineProperty(D,"extractDailyNoteDate",{enumerable:!0,get:o(function(){return Gr.extractDailyNoteDate},"get")});Object.defineProperty(D,"isCurrentDateGteDay",{enumerable:!0,get:o(function(){return Gr.isCurrentDateGteDay},"get")});Object.defineProperty(D,"inheritsFromPrototype",{enumerable:!0,get:o(function(){return Gr.inheritsFromPrototype},"get")});Object.defineProperty(D,"isPrototypeClass",{enumerable:!0,get:o(function(){return Gr.isPrototypeClass},"get")});var rf=ob();Object.defineProperty(D,"canCreateTask",{enumerable:!0,get:o(function(){return rf.canCreateTask},"get")});Object.defineProperty(D,"canCreateRelatedTask",{enumerable:!0,get:o(function(){return rf.canCreateRelatedTask},"get")});Object.defineProperty(D,"canConvertTaskToProject",{enumerable:!0,get:o(function(){return rf.canConvertTaskToProject},"get")});Object.defineProperty(D,"canSetCriticalityZone",{enumerable:!0,get:o(function(){return rf.canSetCriticalityZone},"get")});var nf=cb();Object.defineProperty(D,"canCreateProject",{enumerable:!0,get:o(function(){return nf.canCreateProject},"get")});Object.defineProperty(D,"canMoveToAnalysis",{enumerable:!0,get:o(function(){return nf.canMoveToAnalysis},"get")});Object.defineProperty(D,"canMoveToToDo",{enumerable:!0,get:o(function(){return nf.canMoveToToDo},"get")});Object.defineProperty(D,"canConvertProjectToTask",{enumerable:!0,get:o(function(){return nf.canConvertProjectToTask},"get")});var mb=fb();Object.defineProperty(D,"canCreateChildArea",{enumerable:!0,get:o(function(){return mb.canCreateChildArea},"get")});Object.defineProperty(D,"canSetActiveFocus",{enumerable:!0,get:o(function(){return mb.canSetActiveFocus},"get")});var Zr=db();Object.defineProperty(D,"canPlanOnToday",{enumerable:!0,get:o(function(){return Zr.canPlanOnToday},"get")});Object.defineProperty(D,"canPlanForEvening",{enumerable:!0,get:o(function(){return Zr.canPlanForEvening},"get")});Object.defineProperty(D,"canShiftDayBackward",{enumerable:!0,get:o(function(){return Zr.canShiftDayBackward},"get")});Object.defineProperty(D,"canShiftDayForward",{enumerable:!0,get:o(function(){return Zr.canShiftDayForward},"get")});Object.defineProperty(D,"canSetDraftStatus",{enumerable:!0,get:o(function(){return Zr.canSetDraftStatus},"get")});Object.defineProperty(D,"canMoveToBacklog",{enumerable:!0,get:o(function(){return Zr.canMoveToBacklog},"get")});Object.defineProperty(D,"canStartEffort",{enumerable:!0,get:o(function(){return Zr.canStartEffort},"get")});Object.defineProperty(D,"canMarkDone",{enumerable:!0,get:o(function(){return Zr.canMarkDone},"get")});Object.defineProperty(D,"canTrashEffort",{enumerable:!0,get:o(function(){return Zr.canTrashEffort},"get")});Object.defineProperty(D,"canVoteOnEffort",{enumerable:!0,get:o(function(){return Zr.canVoteOnEffort},"get")});Object.defineProperty(D,"canRollbackStatus",{enumerable:!0,get:o(function(){return Zr.canRollbackStatus},"get")});Object.defineProperty(D,"canArchiveTask",{enumerable:!0,get:o(function(){return Zr.canArchiveTask},"get")});Object.defineProperty(D,"canMarkReviewed",{enumerable:!0,get:o(function(){return Zr.canMarkReviewed},"get")});var bi=pb();Object.defineProperty(D,"canCreateEvent",{enumerable:!0,get:o(function(){return bi.canCreateEvent},"get")});Object.defineProperty(D,"canCreateInstance",{enumerable:!0,get:o(function(){return bi.canCreateInstance},"get")});Object.defineProperty(D,"canCleanProperties",{enumerable:!0,get:o(function(){return bi.canCleanProperties},"get")});Object.defineProperty(D,"canRepairFolder",{enumerable:!0,get:o(function(){return bi.canRepairFolder},"get")});Object.defineProperty(D,"canRenameToUid",{enumerable:!0,get:o(function(){return bi.canRenameToUid},"get")});Object.defineProperty(D,"canCopyLabelToAliases",{enumerable:!0,get:o(function(){return bi.canCopyLabelToAliases},"get")});Object.defineProperty(D,"canCreateNarrowerConcept",{enumerable:!0,get:o(function(){return bi.canCreateNarrowerConcept},"get")});Object.defineProperty(D,"canCreateSubclass",{enumerable:!0,get:o(function(){return bi.canCreateSubclass},"get")});Object.defineProperty(D,"canCreateTaskForDailyNote",{enumerable:!0,get:o(function(){return bi.canCreateTaskForDailyNote},"get")});Object.defineProperty(D,"canCopyFleetingNoteLabel",{enumerable:!0,get:o(function(){return bi.canCopyFleetingNoteLabel},"get")})});var yb=v(ta=>{"use strict";var ZP=ta&&ta.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),eR=ta&&ta.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ZP(e,n,t)};Object.defineProperty(ta,"__esModule",{value:!0});eR(gb(),ta)});var Bm=v(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.PropertyFieldType=void 0;Wc.rangeToFieldType=nR;var rr;(function(n){n.Text="text",n.Number="number",n.Date="date",n.DateTime="datetime",n.Boolean="boolean",n.Reference="reference",n.Enum="enum",n.StatusSelect="status-select",n.SizeSelect="size-select",n.Wikilink="wikilink",n.Timestamp="timestamp",n.Unknown="unknown"})(rr||(Wc.PropertyFieldType=rr={}));var vb="http://www.w3.org/2001/XMLSchema#",tR="https://exocortex.my/ontology/exo#",rR="https://exocortex.my/ontology/ems#";function nR(n){if(!n)return rr.Unknown;let e=n.trim();if(!e)return rr.Unknown;if(e.startsWith(vb)){let t=e.substring(vb.length);return Um(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return Um(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return Um(r)}return e.startsWith(rR)||e.startsWith("ems:")?iR(e):e.startsWith(tR)||e.startsWith("exo:")||sR(e)?rr.Reference:rr.Text}o(nR,"rangeToFieldType");function Um(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return rr.Text;case"integer":case"int":case"long":case"short":case"byte":case"nonnegativeinteger":case"positiveinteger":case"nonpositiveinteger":case"negativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"decimal":case"float":case"double":return rr.Number;case"date":return rr.Date;case"datetime":case"datetimestamp":return rr.DateTime;case"boolean":return rr.Boolean;case"time":return rr.Timestamp;default:return rr.Text}}o(Um,"xsdTypeToFieldType");function iR(n){let e=n.toLowerCase();return e.includes("effortstatus")?rr.StatusSelect:e.includes("tasksize")?rr.SizeSelect:rr.Reference}o(iR,"emsTypeToFieldType");function sR(n){let e=n.toLowerCase();return e.includes("exocortex.my/ontology")?!0:["asset","task","project","area","effort","class","property","concept"].some(r=>e.includes(r))}o(sR,"isClassReference")});var bb=v(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.propertyNameToUri=aR;Hc.uriToPropertyName=_b;Hc.extractPropertyLabel=oR;function aR(n){return n.replace(/^([a-z]+)__/,"$1:")}o(aR,"propertyNameToUri");function _b(n){if(n.startsWith("http://")||n.startsWith("https://")){let e=n.match(/\/([a-z]+)#([A-Za-z0-9_]+)$/);if(e)return`${e[1]}__${e[2]}`;let t=n.lastIndexOf("#"),r=n.lastIndexOf("/"),i=Math.max(t,r);return i>=0?n.substring(i+1):n}return n.replace(/^([a-z]+):/,"$1__")}o(_b,"uriToPropertyName");function oR(n){let r=(n.includes(":")?_b(n):n).replace(/^[a-z]+__/,"").split("_");return(r.length>1?r.slice(1).join(" "):r[0]).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,s=>s.toUpperCase())}o(oR,"extractPropertyLabel")});var sf={};s_(sf,{__assign:()=>Gm,__asyncDelegator:()=>bR,__asyncGenerator:()=>_R,__asyncValues:()=>SR,__await:()=>zc,__awaiter:()=>dR,__classPrivateFieldGet:()=>xR,__classPrivateFieldSet:()=>AR,__createBinding:()=>mR,__decorate:()=>uR,__exportStar:()=>gR,__extends:()=>cR,__generator:()=>pR,__importDefault:()=>TR,__importStar:()=>ER,__makeTemplateObject:()=>wR,__metadata:()=>hR,__param:()=>fR,__read:()=>Sb,__rest:()=>lR,__spread:()=>yR,__spreadArrays:()=>vR,__values:()=>Wm});function cR(n,e){qm(n,e);function t(){this.constructor=n}o(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function lR(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function uR(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function fR(n,e){return function(t,r){e(t,r,n)}}function hR(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function dR(n,e,t,r){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return o(i,"adopt"),new(t||(t=Promise))(function(s,a){function c(f){try{u(r.next(f))}catch(h){a(h)}}o(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(h){a(h)}}o(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}o(u,"step"),u((r=r.apply(n,e||[])).next())})}function pR(n,e){var t={label:0,sent:o(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(f){return l([u,f])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){t.label=u[1];break}if(u[0]===6&&t.label<s[1]){t.label=s[1],s=u;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(u);break}s[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(n,t)}catch(f){u=[6,f],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function mR(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function gR(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function Wm(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:o(function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Sb(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return s}function yR(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Sb(arguments[e]));return n}function vR(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),i=0,e=0;e<t;e++)for(var s=arguments[e],a=0,c=s.length;a<c;a++,i++)r[i]=s[a];return r}function zc(n){return this instanceof zc?(this.v=n,this):new zc(n)}function _R(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(d){r[d]&&(i[d]=function(p){return new Promise(function(_,b){s.push([d,p,_,b])>1||c(d,p)})})}function c(d,p){try{l(r[d](p))}catch(_){h(s[0][3],_)}}function l(d){d.value instanceof zc?Promise.resolve(d.value.v).then(u,f):h(s[0][2],d)}function u(d){c("next",d)}function f(d){c("throw",d)}function h(d,p){d(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function bR(n){var e,t;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=n[i]?function(a){return(t=!t)?{value:zc(n[i](a)),done:i==="return"}:s?s(a):a}:s}}function SR(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof Wm=="function"?Wm(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(a){return new Promise(function(c,l){a=n[s](a),i(c,l,a.done,a.value)})}}function i(s,a,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},a)}}function wR(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function ER(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function TR(n){return n&&n.__esModule?n:{default:n}}function xR(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function AR(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var qm,Gm,af=EI(()=>{qm=o(function(n,e){return qm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])},qm(n,e)},"extendStatics");o(cR,"__extends");Gm=o(function(){return Gm=Object.assign||o(function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},"__assign"),Gm.apply(this,arguments)},"__assign");o(lR,"__rest");o(uR,"__decorate");o(fR,"__param");o(hR,"__metadata");o(dR,"__awaiter");o(pR,"__generator");o(mR,"__createBinding");o(gR,"__exportStar");o(Wm,"__values");o(Sb,"__read");o(yR,"__spread");o(vR,"__spreadArrays");o(zc,"__await");o(_R,"__asyncGenerator");o(bR,"__asyncDelegator");o(SR,"__asyncValues");o(wR,"__makeTemplateObject");o(ER,"__importStar");o(TR,"__importDefault");o(xR,"__classPrivateFieldGet");o(AR,"__classPrivateFieldSet")});var Qm=v(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var Hm;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(Hm||(Hm={}));zm.default=Hm});var wb=v(Ym=>{"use strict";Object.defineProperty(Ym,"__esModule",{value:!0});var CR=Qm();Object.defineProperty(Ym,"Lifecycle",{enumerable:!0,get:o(function(){return CR.default},"get")})});var ra=v(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.defineInjectionTokenMetadata=Fn.getParamInfo=Fn.INJECTION_TOKEN_METADATA_KEY=void 0;Fn.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function IR(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(Fn.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}o(IR,"getParamInfo");Fn.getParamInfo=IR;function OR(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(Fn.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(Fn.INJECTION_TOKEN_METADATA_KEY,s,t)}}o(OR,"defineInjectionTokenMetadata");Fn.defineInjectionTokenMetadata=OR});var Km=v(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.isClassProvider=void 0;function PR(n){return!!n.useClass}o(PR,"isClassProvider");of.isClassProvider=PR});var Xm=v(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.isFactoryProvider=void 0;function RR(n){return!!n.useFactory}o(RR,"isFactoryProvider");cf.isFactoryProvider=RR});var uf=v(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.delay=eo.DelayedConstructor=void 0;var lf=class{static{o(this,"DelayedConstructor")}constructor(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}createProxy(e){let t={},r=!1,i,s=o(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=o(i=>{t[i]=(...s)=>{s[0]=e();let a=Reflect[i];return a(...s)}},"install");return this.reflectMethods.forEach(r),t}};eo.DelayedConstructor=lf;function FR(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new lf(n)}o(FR,"delay");eo.delay=FR});var ff=v(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.isConstructorToken=Si.isTransformDescriptor=Si.isTokenDescriptor=Si.isNormalToken=void 0;var DR=uf();function NR(n){return typeof n=="string"||typeof n=="symbol"}o(NR,"isNormalToken");Si.isNormalToken=NR;function LR(n){return typeof n=="object"&&"token"in n&&"multiple"in n}o(LR,"isTokenDescriptor");Si.isTokenDescriptor=LR;function kR(n){return typeof n=="object"&&"token"in n&&"transform"in n}o(kR,"isTransformDescriptor");Si.isTransformDescriptor=kR;function MR(n){return typeof n=="function"||n instanceof DR.DelayedConstructor}o(MR,"isConstructorToken");Si.isConstructorToken=MR});var Jm=v(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.isTokenProvider=void 0;function jR(n){return!!n.useToken}o(jR,"isTokenProvider");hf.isTokenProvider=jR});var Zm=v(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.isValueProvider=void 0;function $R(n){return n.useValue!=null}o($R,"isValueProvider");df.isValueProvider=$R});var eg=v(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var VR=Km();Object.defineProperty(na,"isClassProvider",{enumerable:!0,get:o(function(){return VR.isClassProvider},"get")});var UR=Xm();Object.defineProperty(na,"isFactoryProvider",{enumerable:!0,get:o(function(){return UR.isFactoryProvider},"get")});var BR=ff();Object.defineProperty(na,"isNormalToken",{enumerable:!0,get:o(function(){return BR.isNormalToken},"get")});var qR=Jm();Object.defineProperty(na,"isTokenProvider",{enumerable:!0,get:o(function(){return qR.isTokenProvider},"get")});var GR=Zm();Object.defineProperty(na,"isValueProvider",{enumerable:!0,get:o(function(){return GR.isValueProvider},"get")})});var Eb=v(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.isProvider=void 0;var WR=Km(),HR=Zm(),zR=Jm(),QR=Xm();function YR(n){return WR.isClassProvider(n)||HR.isValueProvider(n)||zR.isTokenProvider(n)||QR.isFactoryProvider(n)}o(YR,"isProvider");pf.isProvider=YR});var ng=v(rg=>{"use strict";Object.defineProperty(rg,"__esModule",{value:!0});var tg=class{static{o(this,"RegistryBase")}constructor(){this._registryMap=new Map}entries(){return this._registryMap.entries()}getAll(e){return this.ensure(e),this._registryMap.get(e)}get(e){this.ensure(e);let t=this._registryMap.get(e);return t[t.length-1]||null}set(e,t){this.ensure(e),this._registryMap.get(e).push(t)}setAll(e,t){this._registryMap.set(e,t)}has(e){return this.ensure(e),this._registryMap.get(e).length>0}clear(){this._registryMap.clear()}ensure(e){this._registryMap.has(e)||this._registryMap.set(e,[])}};rg.default=tg});var Tb=v(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});var KR=ng(),ig=class extends KR.default{static{o(this,"Registry")}};sg.default=ig});var xb=v(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});var ag=class{static{o(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};og.default=ag});var cg=v(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.formatErrorCtor=void 0;function XR(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}o(XR,"formatDependency");function JR(n,e,t=" "){return[n,...e.message.split(`
|
|
32
32
|
`).map(r=>t+r)].join(`
|
|
33
33
|
`)}o(JR,"composeErrorMessage");function ZR(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=XR(r,e);return JR(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}o(ZR,"formatErrorCtor");mf.formatErrorCtor=ZR});var Ab=v(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});gf.isDisposable=void 0;function eF(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}o(eF,"isDisposable");gf.isDisposable=eF});var Ib=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.PostResolutionInterceptors=ia.PreResolutionInterceptors=void 0;var Cb=ng(),yf=class extends Cb.default{static{o(this,"PreResolutionInterceptors")}};ia.PreResolutionInterceptors=yf;var vf=class extends Cb.default{static{o(this,"PostResolutionInterceptors")}};ia.PostResolutionInterceptors=vf;var lg=class{static{o(this,"Interceptors")}constructor(){this.preResolution=new yf,this.postResolution=new vf}};ia.default=lg});var ms=v(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.instance=Yi.typeInfo=void 0;var tF=(af(),kp(sf)),Dr=eg(),rF=Eb(),_f=ff(),nF=Tb(),Wr=Qm(),bf=xb(),iF=cg(),sF=uf(),aF=Ab(),oF=Ib();Yi.typeInfo=new Map;var ug=class n{static{o(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new nF.default,this.interceptors=new oF.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:Wr.default.Transient}){this.ensureNotDisposed();let i;if(rF.isProvider(t)?i=t:i={useClass:t},Dr.isTokenProvider(i)){let s=[e],a=i;for(;a!=null;){let c=a.useToken;if(s.includes(c))throw new Error(`Token registration cycle detected! ${[...s,c].join(" -> ")}`);s.push(c);let l=this._registry.get(c);l&&Dr.isTokenProvider(l.provider)?a=l.provider:a=null}}if((r.lifecycle===Wr.default.Singleton||r.lifecycle==Wr.default.ContainerScoped||r.lifecycle==Wr.default.ResolutionScoped)&&(Dr.isValueProvider(i)||Dr.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${Wr.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),Dr.isNormalToken(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})}registerInstance(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})}registerSingleton(e,t){if(this.ensureNotDisposed(),Dr.isNormalToken(e)){if(Dr.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:Wr.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Wr.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!Dr.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Wr.default.Singleton})}resolve(e,t=new bf.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&Dr.isNormalToken(e)){if(r)return;throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"Single"),i){let s=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}if(_f.isConstructorToken(e)){let s=this.construct(e,t);return this.executePostResolutionInterceptor(e,s,"Single"),s}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")}executePreResolutionInterceptor(e,t){if(this.interceptors.preResolution.has(e)){let r=[];for(let i of this.interceptors.preResolution.getAll(e))i.options.frequency!="Once"&&r.push(i),i.callback(e,t);this.interceptors.preResolution.setAll(e,r)}}executePostResolutionInterceptor(e,t,r){if(this.interceptors.postResolution.has(e)){let i=[];for(let s of this.interceptors.postResolution.getAll(e))s.options.frequency!="Once"&&i.push(s),s.callback(e,t,r);this.interceptors.postResolution.setAll(e,i)}}resolveRegistration(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Wr.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===Wr.default.Singleton,i=e.options.lifecycle===Wr.default.ContainerScoped,s=r||i,a;return Dr.isValueProvider(e.provider)?a=e.provider.useValue:Dr.isTokenProvider(e.provider)?a=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Dr.isClassProvider(e.provider)?a=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):Dr.isFactoryProvider(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,t),e.options.lifecycle===Wr.default.ResolutionScoped&&t.scopedResolutions.set(e,a),a}resolveAll(e,t=new bf.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&Dr.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let a=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,a,"All"),a}let s=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,s,"All"),s}isRegistered(e,t=!1){return this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)}reset(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()}clearInstances(){this.ensureNotDisposed();for(let[e,t]of this._registry.entries())this._registry.setAll(e,t.filter(r=>!Dr.isValueProvider(r.provider)).map(r=>(r.instance=void 0,r)))}createChildContainer(){this.ensureNotDisposed();let e=new n(this);for(let[t,r]of this._registry.entries())r.some(({options:i})=>i.lifecycle===Wr.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===Wr.default.ContainerScoped?{provider:i.provider,options:i.options}:i));return e}beforeResolution(e,t,r={frequency:"Always"}){this.interceptors.preResolution.set(e,{callback:t,options:r})}afterResolution(e,t,r={frequency:"Always"}){this.interceptors.postResolution.set(e,{callback:t,options:r})}dispose(){return tF.__awaiter(this,void 0,void 0,function*(){this.disposed=!0;let e=[];this.disposables.forEach(t=>{let r=t.dispose();r&&e.push(r)}),yield Promise.all(e)})}getRegistration(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null}getAllRegistrations(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null}construct(e,t){if(e instanceof sF.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=Yi.typeInfo.get(e);if(!i||i.length===0){if(e.length===0)return new e;throw new Error(`TypeInfo not known for "${e.name}"`)}let s=i.map(this.resolveParams(t,e));return new e(...s)})();return aF.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return _f.isTokenDescriptor(r)?_f.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new bf.default,r.isOptional),...r.transformArgs):this.resolve(r.transform).transform(this.resolve(r.token,e,r.isOptional),...r.transformArgs):r.multiple?this.resolveAll(r.token,new bf.default,r.isOptional):this.resolve(r.token,e,r.isOptional):_f.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(iF.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};Yi.instance=new ug;Yi.default=Yi.instance});var Ob=v(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0});var cF=ra(),Ki=ms(),fg=ff(),lF=cg();function uF(){return function(n){let e=cF.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return fg.isTokenDescriptor(r)?fg.isTransformDescriptor(r)?r.multiple?Ki.instance.resolve(r.transform).transform(Ki.instance.resolveAll(r.token),...r.transformArgs):Ki.instance.resolve(r.transform).transform(Ki.instance.resolve(r.token),...r.transformArgs):r.multiple?Ki.instance.resolveAll(r.token):Ki.instance.resolve(r.token):fg.isTransformDescriptor(r)?Ki.instance.resolve(r.transform).transform(Ki.instance.resolve(r.token),...r.transformArgs):Ki.instance.resolve(r)}catch(s){let a=i+t.length;throw new Error(lF.formatErrorCtor(n,a,s))}})))}}}}o(uF,"autoInjectable");hg.default=uF});var Pb=v(dg=>{"use strict";Object.defineProperty(dg,"__esModule",{value:!0});var fF=ra();function hF(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return fF.defineInjectionTokenMetadata(t)}o(hF,"inject");dg.default=hF});var Sf=v(pg=>{"use strict";Object.defineProperty(pg,"__esModule",{value:!0});var dF=ra(),pF=ms(),Rb=ms();function mF(n){return function(e){pF.typeInfo.set(e,dF.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{Rb.instance.register(t,e)}):Rb.instance.register(n.token,e))}}o(mF,"injectable");pg.default=mF});var Fb=v(mg=>{"use strict";Object.defineProperty(mg,"__esModule",{value:!0});var gF=(af(),kp(sf)),yF=ms();function vF(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=gF.__rest(t,["token","options"]);return yF.instance.register(r,s,i)}),e}}o(vF,"registry");mg.default=vF});var Db=v(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});var _F=Sf(),bF=ms();function SF(){return function(n){_F.default()(n),bF.instance.registerSingleton(n)}}o(SF,"singleton");gg.default=SF});var Nb=v(yg=>{"use strict";Object.defineProperty(yg,"__esModule",{value:!0});var wF=ra();function EF(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return wF.defineInjectionTokenMetadata(t)}o(EF,"injectAll");yg.default=EF});var Lb=v(vg=>{"use strict";Object.defineProperty(vg,"__esModule",{value:!0});var TF=ra();function xF(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return TF.defineInjectionTokenMetadata(r)}o(xF,"injectAllWithTransform");vg.default=xF});var kb=v(_g=>{"use strict";Object.defineProperty(_g,"__esModule",{value:!0});var AF=ra();function CF(n,e,...t){return AF.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}o(CF,"injectWithTransform");_g.default=CF});var Mb=v(bg=>{"use strict";Object.defineProperty(bg,"__esModule",{value:!0});var IF=Sf(),OF=ms();function PF(n,e){return function(t){IF.default()(t),OF.instance.register(e||t,t,{lifecycle:n})}}o(PF,"scoped");bg.default=PF});var jb=v(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});var RF=Ob();Object.defineProperty(Dn,"autoInjectable",{enumerable:!0,get:o(function(){return RF.default},"get")});var FF=Pb();Object.defineProperty(Dn,"inject",{enumerable:!0,get:o(function(){return FF.default},"get")});var DF=Sf();Object.defineProperty(Dn,"injectable",{enumerable:!0,get:o(function(){return DF.default},"get")});var NF=Fb();Object.defineProperty(Dn,"registry",{enumerable:!0,get:o(function(){return NF.default},"get")});var LF=Db();Object.defineProperty(Dn,"singleton",{enumerable:!0,get:o(function(){return LF.default},"get")});var kF=Nb();Object.defineProperty(Dn,"injectAll",{enumerable:!0,get:o(function(){return kF.default},"get")});var MF=Lb();Object.defineProperty(Dn,"injectAllWithTransform",{enumerable:!0,get:o(function(){return MF.default},"get")});var jF=kb();Object.defineProperty(Dn,"injectWithTransform",{enumerable:!0,get:o(function(){return jF.default},"get")});var $F=Mb();Object.defineProperty(Dn,"scoped",{enumerable:!0,get:o(function(){return $F.default},"get")})});var $b=v(Sg=>{"use strict";Object.defineProperty(Sg,"__esModule",{value:!0});function VF(n){let e;return t=>(e==null&&(e=n(t)),e)}o(VF,"instanceCachingFactory");Sg.default=VF});var Vb=v(wg=>{"use strict";Object.defineProperty(wg,"__esModule",{value:!0});function UF(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}o(UF,"instancePerContainerCachingFactory");wg.default=UF});var Ub=v(Eg=>{"use strict";Object.defineProperty(Eg,"__esModule",{value:!0});function BF(n,e,t,r=!0){let i,s;return a=>{let c=n(a);return(!r||s!==c)&&((s=c)?i=a.resolve(e):i=a.resolve(t)),i}}o(BF,"predicateAwareClassFactory");Eg.default=BF});var Bb=v(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});var qF=$b();Object.defineProperty(Qc,"instanceCachingFactory",{enumerable:!0,get:o(function(){return qF.default},"get")});var GF=Vb();Object.defineProperty(Qc,"instancePerContainerCachingFactory",{enumerable:!0,get:o(function(){return GF.default},"get")});var WF=Ub();Object.defineProperty(Qc,"predicateAwareClassFactory",{enumerable:!0,get:o(function(){return WF.default},"get")})});var Ve=v(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});var Tg=(af(),kp(sf));if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var HF=wb();Object.defineProperty(gs,"Lifecycle",{enumerable:!0,get:o(function(){return HF.Lifecycle},"get")});Tg.__exportStar(jb(),gs);Tg.__exportStar(Bb(),gs);Tg.__exportStar(eg(),gs);var zF=uf();Object.defineProperty(gs,"delay",{enumerable:!0,get:o(function(){return zF.delay},"get")});var QF=ms();Object.defineProperty(gs,"container",{enumerable:!0,get:o(function(){return QF.instance},"get")})});var yn=v(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.MetadataHelpers=void 0;var xg=class{static{o(this,"MetadataHelpers")}static findAllReferencingProperties(e,t){let r=[];for(let[i,s]of Object.entries(e))this.containsReference(s,t)&&r.push(i);return r}static findReferencingProperty(e,t){for(let[r,i]of Object.entries(e))if(this.containsReference(i,t))return r}static containsReference(e,t){if(!e)return!1;let r=t.replace(/\.md$/,"");if(typeof e=="string"){let i=/\[\[([^\[\]]+)\]\]/g,s;for(;(s=i.exec(e))!==null;){let c=s[1].split("|")[0].trim();if(c===r||c.endsWith(`/${r}`))return!0}return!1}return Array.isArray(e)?e.some(i=>this.containsReference(i,t)):!1}static isAssetArchived(e){let t=e?.exo__Asset_isArchived;if(t!=null){if(t===!0||t===1)return!0;if(typeof t=="string"){let i=t.toLowerCase().trim();if(i==="true"||i==="yes"||i==="1")return!0}if(typeof t=="boolean")return t}let r=e?.archived;if(r==null)return!1;if(typeof r=="boolean")return r;if(typeof r=="number")return r!==0;if(typeof r=="string"){let i=r.toLowerCase().trim();return i==="true"||i==="yes"||i==="1"}return!1}static getPropertyValue(e,t){return t==="Name"||t==="title"?e.title:t==="created"?e.created:t==="modified"?e.modified:t==="path"?e.path:e.metadata?.[t]}static ensureQuoted(e){return!e||e==='""'?'""':e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`}static buildFileContent(e,t){let r=Object.entries(e).map(([s,a])=>{if(Array.isArray(a)){let c=a.map(l=>` - ${l}`).join(`
|
|
34
34
|
`);return`${s}:
|
|
@@ -107,151 +107,151 @@ ${i}
|
|
|
107
107
|
|
|
108
108
|
`)}cleanMarkdownContent(e){let t=e.replace(/^---[\s\S]*?---\n*/m,"").replace(/```[\s\S]*?```/g,r=>r.replace(/```\w*\n?|\n?```/g,"")).replace(/`([^`]+)`/g,"$1").replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(r,i,s)=>s||i).replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/!\[[^\]]*\]\([^)]+\)/g,"").replace(/^---+$/gm,"");return t=this.removeHtmlTags(t),t.replace(/\n{3,}/g,`
|
|
109
109
|
|
|
110
|
-
`).trim()}removeHtmlTags(e){let t=/<[^>]*>/g,r=e,i;do i=r,r=r.replace(t,"");while(r!==i);return r}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}getStats(){return{requestCount:this.requestCount,tokenCount:this.tokenCount}}resetStats(){this.requestCount=0,this.tokenCount=0}};vn.EmbeddingService=b0;vn.EmbeddingService=b0=y4([(0,_4.injectable)(),v4("design:paramtypes",[Object])],b0)});var T0=v(_n=>{"use strict";var b4=_n&&_n.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},S4=_n&&_n.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(_n,"__esModule",{value:!0});_n.VectorStore=_n.DEFAULT_VECTOR_STORE_CONFIG=void 0;var w4=Ve(),w0=la();_n.DEFAULT_VECTOR_STORE_CONFIG={maxEntries:0,similarityThreshold:.7};var E0=class{static{o(this,"VectorStore")}constructor(e={}){this.entries=new Map,this.createdAt=new Date,this.updatedAt=new Date,this.config={..._n.DEFAULT_VECTOR_STORE_CONFIG,...e}}setConfig(e){this.config={...this.config,...e}}upsert(e){if(!e.vector||e.vector.length===0)throw new Error("Vector cannot be empty");let t=this.entries.values().next().value;if(t&&t.vector.length!==e.vector.length)throw new Error(`Vector dimension mismatch: expected ${t.vector.length}, got ${e.vector.length}`);if(this.config.maxEntries&&this.config.maxEntries>0&&!this.entries.has(e.id)&&this.entries.size>=this.config.maxEntries){let r=null,i=1/0;for(let[s,a]of this.entries)a.timestamp<i&&(i=a.timestamp,r=s);r&&(this.entries.delete(r),w0.LoggingService.debug(`VectorStore: Evicted oldest entry ${r}`))}this.entries.set(e.id,e),this.updatedAt=new Date}remove(e){let t=this.entries.delete(e);return t&&(this.updatedAt=new Date),t}get(e){return this.entries.get(e)}has(e){return this.entries.has(e)}needsUpdate(e,t){let r=this.entries.get(e);return r?r.contentHash!==t:!0}getAllIds(){return Array.from(this.entries.keys())}size(){return this.entries.size}clear(){this.entries.clear(),this.updatedAt=new Date}search(e,t=10){if(this.entries.size===0)return[];let r=this.entries.values().next().value;if(r&&r.vector.length!==e.length)throw new Error(`Query vector dimension mismatch: expected ${r.vector.length}, got ${e.length}`);let i=[],s=this.config.similarityThreshold??.7;for(let a of this.entries.values()){let c=this.cosineSimilarity(e,a.vector);c>=s&&i.push({entry:a,score:c})}return i.sort((a,c)=>c.score-a.score),i.slice(0,t)}findSimilar(e,t=10){let r=this.entries.get(e);return r?this.search(r.vector,t+1).filter(s=>s.entry.id!==e).slice(0,t):[]}cosineSimilarity(e,t){if(e.length!==t.length)throw new Error("Vectors must have the same dimension");let r=0,i=0,s=0;for(let a=0;a<e.length;a++)r+=e[a]*t[a],i+=e[a]*e[a],s+=t[a]*t[a];return i=Math.sqrt(i),s=Math.sqrt(s),i===0||s===0?0:r/(i*s)}serialize(){return{version:1,entries:Array.from(this.entries.values()).map(e=>({id:e.id,vector:e.vector,metadata:e.metadata,timestamp:e.timestamp,contentHash:e.contentHash})),createdAt:this.createdAt.toISOString(),updatedAt:this.updatedAt.toISOString()}}deserialize(e){if(e.version!==1)throw new Error(`Unsupported VectorStore version: ${e.version}`);this.entries.clear();for(let t of e.entries)this.entries.set(t.id,{id:t.id,vector:t.vector,metadata:t.metadata,timestamp:t.timestamp,contentHash:t.contentHash});this.createdAt=new Date(e.createdAt),this.updatedAt=new Date(e.updatedAt),w0.LoggingService.debug(`VectorStore: Loaded ${this.entries.size} entries from persistence`)}getStats(){let t=this.entries.values().next().value?.vector.length??null,i=(t?this.entries.size*t*8:0)/(1024*1024);return{entryCount:this.entries.size,dimension:t,createdAt:this.createdAt.toISOString(),updatedAt:this.updatedAt.toISOString(),estimatedMemoryMB:Math.round(i*100)/100}}pruneInvalidEntries(e){let t=[];for(let r of this.entries.keys())e.has(r)||t.push(r);for(let r of t)this.entries.delete(r);return t.length>0&&(this.updatedAt=new Date,w0.LoggingService.debug(`VectorStore: Pruned ${t.length} invalid entries`)),t.length}};_n.VectorStore=E0;_n.VectorStore=E0=b4([(0,w4.injectable)(),S4("design:paramtypes",[Object])],E0)});var AS=v(bn=>{"use strict";var E4=bn&&bn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},T4=bn&&bn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(bn,"__esModule",{value:!0});bn.SemanticSearchService=bn.DEFAULT_SEMANTIC_SEARCH_CONFIG=void 0;var x4=Ve(),Zc=la(),xS=S0(),A4=T0();bn.DEFAULT_SEMANTIC_SEARCH_CONFIG={embedding:xS.DEFAULT_EMBEDDING_CONFIG,maxResults:10,minSimilarity:.7,autoEmbed:!0,batchSize:20};var x0=class{static{o(this,"SemanticSearchService")}constructor(e={}){this.indexingStatus={isIndexing:!1,totalFiles:0,indexedFiles:0,failedFiles:0,progress:0},this.abortController=null,this.config={...bn.DEFAULT_SEMANTIC_SEARCH_CONFIG,...e},this.embeddingService=new xS.EmbeddingService(this.config.embedding),this.vectorStore=new A4.VectorStore({similarityThreshold:this.config.minSimilarity})}setConfig(e){this.config={...this.config,...e},e.embedding&&this.embeddingService.setConfig(e.embedding),e.minSimilarity!==void 0&&this.vectorStore.setConfig({similarityThreshold:e.minSimilarity})}getConfig(){return{...this.config,embedding:this.embeddingService.getConfig()}}isConfigured(){return this.embeddingService.isConfigured()}getIndexingStatus(){return{...this.indexingStatus}}async search(e,t){if(!this.isConfigured())throw new Error("SemanticSearchService is not properly configured");if(!e.trim())return[];let r=await this.embeddingService.generateEmbedding(e),i=t??this.config.maxResults;return this.vectorStore.search(r.embedding,i).map(a=>this.toSearchResult(a))}async findSimilar(e,t){let r=t??this.config.maxResults;return this.vectorStore.findSimilar(e,r).map(s=>this.toSearchResult(s))}toSearchResult(e){let t=e.entry.metadata??{};return{path:e.entry.id,score:e.score,label:t.exo__Asset_label,instanceClass:this.extractInstanceClass(t),metadata:t}}extractInstanceClass(e){let t=e.exo__Instance_class;if(t){if(Array.isArray(t)){let r=t[0];return typeof r=="string"?this.cleanWikiLink(r):void 0}return typeof t=="string"?this.cleanWikiLink(t):void 0}}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}async indexFile(e,t,r){if(!this.isConfigured())return!1;try{let i=await this.hashContent(t);if(!this.vectorStore.needsUpdate(e,i))return!0;let s=this.embeddingService.prepareTextForEmbedding(t,r),a=await this.embeddingService.generateEmbedding(s);return this.vectorStore.upsert({id:e,vector:a.embedding,metadata:r,timestamp:Date.now(),contentHash:i}),Zc.LoggingService.debug(`Indexed file: ${e}`),!0}catch(i){return Zc.LoggingService.warn(`Failed to index file ${e}: ${i instanceof Error?i.message:"Unknown error"}`),!1}}removeFromIndex(e){return this.vectorStore.remove(e)}async indexBatch(e){if(!this.isConfigured())return{indexed:0,failed:e.length};let t=[],r=new Map;for(let c of e){let l=await this.hashContent(c.content);if(!this.vectorStore.needsUpdate(c.path,l))continue;let u=this.embeddingService.prepareTextForEmbedding(c.content,c.metadata);t.push({id:c.path,text:u}),r.set(c.path,{content:c.content,metadata:c.metadata,contentHash:l})}if(t.length===0)return{indexed:0,failed:0};let i=await this.embeddingService.generateBatchEmbeddings(t),s=0,a=0;for(let c of i){let l=r.get(c.id);l&&(c.result?(this.vectorStore.upsert({id:c.id,vector:c.result.embedding,metadata:l.metadata,timestamp:Date.now(),contentHash:l.contentHash}),s++):(a++,Zc.LoggingService.warn(`Failed to embed ${c.id}: ${c.error||"Unknown error"}`)))}return{indexed:s,failed:a}}async indexAll(e,t,r){if(!this.isConfigured())throw new Error("SemanticSearchService is not properly configured");if(this.indexingStatus.isIndexing)throw new Error("Indexing is already in progress");this.abortController=new AbortController,this.indexingStatus={isIndexing:!0,totalFiles:e.length,indexedFiles:0,failedFiles:0,progress:0};let i=0,s=0,a=!1;try{for(let c=0;c<e.length;c+=this.config.batchSize){if(this.abortController.signal.aborted){a=!0;break}let l=e.slice(c,c+this.config.batchSize),u=[];for(let h of l){if(this.abortController.signal.aborted){a=!0;break}let d=await t(h);d?u.push({path:h,content:d.content,metadata:d.metadata}):s++}if(a)break;let f=await this.indexBatch(u);i+=f.indexed,s+=f.failed,this.indexingStatus.indexedFiles=c+l.length,this.indexingStatus.failedFiles=s,this.indexingStatus.progress=Math.round(this.indexingStatus.indexedFiles/e.length*100),r&&r({...this.indexingStatus})}}finally{this.indexingStatus.isIndexing=!1,this.abortController=null}return{indexed:i,failed:s,aborted:a}}abortIndexing(){this.abortController&&(this.abortController.abort(),Zc.LoggingService.debug("Indexing aborted by user"))}isIndexed(e){return this.vectorStore.has(e)}getIndexedPaths(){return this.vectorStore.getAllIds()}getIndexedCount(){return this.vectorStore.size()}clearIndex(){this.vectorStore.clear(),Zc.LoggingService.debug("Semantic search index cleared")}pruneDeletedFiles(e){return this.vectorStore.pruneInvalidEntries(e)}serializeIndex(){return this.vectorStore.serialize()}deserializeIndex(e){this.vectorStore.deserialize(e)}getStats(){return{indexStats:this.vectorStore.getStats(),embeddingStats:this.embeddingService.getStats()}}async hashContent(e){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("")}};bn.SemanticSearchService=x0;bn.SemanticSearchService=x0=E4([(0,x4.injectable)(),T4("design:paramtypes",[Object])],x0)});var CS=v(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.GraphQueryService=void 0;var el=We(),C4=mt(),ys=dn(),I4=rm(),Ei={INSTANCE_CLASS:ys.Namespace.EXO.term("Instance_class"),ASSET_LABEL:ys.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:ys.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:ys.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:ys.Namespace.EMS.term("Effort_parent"),REFERENCES:ys.Namespace.EXO.term("references"),REFERENCED_BY:ys.Namespace.EXO.term("referencedBy"),RDF_TYPE:ys.Namespace.RDF.term("type")},A0=class{static{o(this,"GraphQueryService")}constructor(e,t={}){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.config={defaultLimit:t.defaultLimit??100,maxLimit:t.maxLimit??1e4,defaultDepth:t.defaultDepth??2,maxDepth:t.maxDepth??10,includeArchivedByDefault:t.includeArchivedByDefault??!1,cacheTTL:t.cacheTTL??3e4}}async loadGraphData(e={}){let t=Date.now(),r=await this.loadNodes(e),i=await this.loadEdges(r,e),s=this.computeStats(r,i),a=Date.now()-t;return a>100&&r.length>0&&console.debug(`GraphQueryService: loaded ${r.length} nodes in ${a}ms (${(a/r.length).toFixed(2)}ms/node)`),{nodes:r,edges:i,stats:s,lastUpdated:Date.now(),version:1}}async loadNodesIncremental(e={}){let t=Math.min(e.limit??this.config.defaultLimit,this.config.maxLimit),r=e.offset??0,i=await this.loadNodes({...e,limit:t+1,offset:r}),s=i.length>t,a=s?i.slice(0,t):i,c=await this.loadEdges(a,e);return{nodes:a,edges:c,hasMore:s,totalCount:void 0,cursor:s?String(r+t):void 0}}async loadConnectedNodes(e,t={}){let r=Math.min(t.depth??this.config.defaultDepth,this.config.maxDepth),i=Math.min(t.limit??this.config.maxLimit,this.config.maxLimit),s=new Set,a=[{id:e,currentDepth:0}],c=[];for(;a.length>0&&c.length<i;){let{id:u,currentDepth:f}=a.shift();if(s.has(u))continue;s.add(u);let h=await this.getNodeById(u,t);if(h&&(c.push(h),f<r)){let d=await this.getConnectedNodeIds(u);for(let p of d)s.has(p)||a.push({id:p,currentDepth:f+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:a.length>0,totalCount:s.size+a.length}}async getNodeById(e,t={}){let r=this.getCachedNode(e);if(r)return{...r};let i=this.idToIRI(e),s=await this.tripleStore.match(i,void 0,void 0);if(s.length===0)return null;let a=this.triplesToNode(e,s,t);return a&&this.cacheNode(a),a}subscribe(e){return this.subscribers.add(e),{unsubscribe:o(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){console.error("GraphQueryService: error in subscriber callback",r)}this.invalidateCache()}async getStats(){let e=await this.loadNodes({includeArchived:!0}),t=await this.loadEdges(e,{});return this.computeStats(e,t)}clearCache(){this.nodeCache.clear(),this.lastCacheUpdate=0}async loadNodes(e){let t=e.includeArchived??this.config.includeArchivedByDefault,r=e.limit??this.config.maxLimit,i=e.offset??0,s=await this.tripleStore.match(void 0,Ei.INSTANCE_CLASS,void 0),a=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);a=s.filter(_=>{let b=this.getObjectValue(_.object);return b&&p.has(b)})}let c=new Set;for(let p of a)c.add(this.subjectToId(p.subject));let f=Array.from(c).slice(i,i+r).map(p=>this.getNodeById(p,e));return(await Promise.all(f)).filter(p=>!(!p||!t&&p.isArchived))}async loadEdges(e,t){let r=new Set(e.map(a=>a.id)),i=[],s=new Set;for(let a of e){let c=this.idToIRI(a.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(a.id,u,r);f&&!s.has(f.id)&&(!t.edgeTypes||t.edgeTypes.includes(f.type))&&(s.add(f.id),i.push(f))}}return i}async getConnectedNodeIds(e){let t=this.idToIRI(e),r=[],i=await this.tripleStore.match(t,void 0,void 0);for(let a of i){let c=this.objectToId(a.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let a of s)r.push(this.subjectToId(a.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,a,c,l,u=!1;for(let d of t){let p=d.predicate.value,_=this.getObjectValue(d.object);if(p===Ei.INSTANCE_CLASS.value)s=_;else if(p===Ei.ASSET_LABEL.value)a=_;else if(p===Ei.ASSET_PROTOTYPE.value)c=this.objectToId(d.object)??_;else if(p===Ei.EFFORT_PARENT.value)l=this.objectToId(d.object)??_;else if(p===Ei.ASSET_IS_ARCHIVED.value)u=_==="true"||_==="1";else{let b=this.predicateToPropertyName(p);b&&(i[b]=_)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),h=a??this.pathToTitle(f);return{id:e,path:f,title:h,label:h,assetClass:s,isArchived:u,uri:e.startsWith("http")?e:void 0,prototype:c,parent:l,properties:Object.keys(i).length>0?i:void 0}}tripleToEdge(e,t,r){let i=t.predicate.value,s=this.objectToId(t.object);if(!s||!r.has(s)||s===e)return null;let a=this.predicateToEdgeType(i);if(!a)return null;let c=(0,I4.createEdgeId)(e,s,a,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:a,predicate:i,label:l}}predicateToEdgeType(e){return e===Ei.EFFORT_PARENT.value?"hierarchy":e===Ei.ASSET_PROTOTYPE.value?"prototype":e===Ei.REFERENCES.value?"forward-link":e===Ei.REFERENCED_BY.value?"backlink":e.includes("Asset_")||e.includes("Instance_")?null:"semantic"}predicateToLabel(e){let t=e.lastIndexOf("#"),r=e.lastIndexOf("/"),i=Math.max(t,r);return i>=0?e.substring(i+1):e}predicateToPropertyName(e){return this.predicateToLabel(e).replace(/_/g,"__").replace(/#/g,"_")}computeStats(e,t){let r={},i={backlink:0,"forward-link":0,hierarchy:0,prototype:0,semantic:0,reference:0};for(let c of e){let l=c.assetClass??"unknown";r[l]=(r[l]??0)+1}for(let c of t)i[c.type]=(i[c.type]??0)+1;let s=new Map,a=new Map;for(let c of t)a.set(c.source,(a.get(c.source)??0)+1),s.set(c.target,(s.get(c.target)??0)+1);for(let c of e)c.inDegree=s.get(c.id)??0,c.outDegree=a.get(c.id)??0,c.weight=c.inDegree+c.outDegree;return{nodeCount:e.length,edgeCount:t.length,nodesByClass:r,edgesByType:i,computedAt:Date.now()}}idToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?new el.IRI(e):new el.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof el.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof el.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof C4.Literal||e instanceof el.IRI)return e.value}idToPath(e){if(e.startsWith("obsidian://vault/"))return decodeURIComponent(e.replace("obsidian://vault/",""));if(e.startsWith("http://")||e.startsWith("https://")){let t=e.match(/\/([^/]+\.md)$/);if(t)return t[1]}return e}pathToTitle(e){return(e.split("/").pop()??e).replace(/\.md$/,"")}getCachedNode(e){return Date.now()-this.lastCacheUpdate>this.config.cacheTTL?(this.clearCache(),null):this.nodeCache.get(e)??null}cacheNode(e){this.nodeCache.set(e.id,e),this.lastCacheUpdate===0&&(this.lastCacheUpdate=Date.now())}invalidateCache(){this.clearCache()}};kf.GraphQueryService=A0});var OS=v(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.TypeRegistry=void 0;var Ti=We(),IS=kt(),O4=mt(),rt=nm(),C0=class{static{o(this,"TypeRegistry")}constructor(e=null,t={}){this.nodeTypes=new Map,this.edgeTypes=new Map,this.typeHierarchy=new Map,this.subscribers=new Set,this.discoveryComplete=!1,this.tripleStore=e,this.config={autoDiscoverTypes:t.autoDiscoverTypes??!0,includeBuiltInStyles:t.includeBuiltInStyles??!0,styleResolution:t.styleResolution??{mergeStyles:!0,inheritParentStyles:!0,defaultNodeStyle:rt.DEFAULT_NODE_STYLE,defaultEdgeStyle:rt.DEFAULT_EDGE_STYLE},maxInheritanceDepth:t.maxInheritanceDepth??10},this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerNodeType(e){let r=this.nodeTypes.get(e.uri)?"type-updated":"type-added";this.nodeTypes.set(e.uri,e),e.parentTypes&&e.parentTypes.length>0&&this.typeHierarchy.set(e.uri,e.parentTypes),this.emit({type:r,typeUri:e.uri,definition:e})}registerEdgeType(e){let r=this.edgeTypes.get(e.uri)?"type-updated":"type-added";this.edgeTypes.set(e.uri,e),this.emit({type:r,typeUri:e.uri,definition:e})}unregisterType(e){let t=this.nodeTypes.delete(e),r=this.edgeTypes.delete(e);this.typeHierarchy.delete(e),(t||r)&&this.emit({type:"type-removed",typeUri:e})}getNodeType(e){return this.nodeTypes.get(e)}getEdgeType(e){return this.edgeTypes.get(e)}getAllNodeTypes(){return Array.from(this.nodeTypes.values())}getAllEdgeTypes(){return Array.from(this.edgeTypes.values())}getParentTypes(e,t=this.config.maxInheritanceDepth){let r=[],i=new Set,s=[{uri:e,currentDepth:0}];for(;s.length>0;){let{uri:a,currentDepth:c}=s.shift();if(i.has(a)||(i.add(a),c>=t))continue;let l=this.typeHierarchy.get(a)??[];for(let u of l)i.has(u)||(r.push(u),s.push({uri:u,currentDepth:c+1}))}return r}getChildTypes(e){let t=[];for(let[r,i]of this.typeHierarchy)i.includes(e)&&t.push(r);return t}isSubtypeOf(e,t){return e===t?!0:this.getParentTypes(e).includes(t)}resolveNodeType(e){let t=[],r="unknown",i="custom";if(e.assetClass){let c=this.normalizeTypeUri(e.assetClass);t.push(c),r=c,i="exo:Instance_class"}let s=e.properties?.[rt.RDF_TYPE_PREDICATES.RDF_TYPE];s&&!t.includes(s)&&(t.push(s),r==="unknown"&&(r=s,i="rdf:type"));for(let c of[...t]){let l=this.getParentTypes(c);for(let u of l)t.includes(u)||t.push(u)}let a=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:a,source:i}}resolveEdgeType(e){let t=e.predicate??e.type,r=e.predicate?"rdf:type":"custom",i=this.resolveEdgeStyle(t);return{primaryType:t,resolvedStyle:i,source:r}}resolveNodeStyle(e){let{mergeStyles:t,defaultNodeStyle:r}=this.config.styleResolution,i={...r},s=[];for(let a of e){let c=this.nodeTypes.get(a);c&&s.push(c)}if(s.sort((a,c)=>a.priority-c.priority),t)for(let a of s)i=(0,rt.mergeNodeStyles)(i,a.style);else if(s.length>0){let a=s[s.length-1];i=(0,rt.mergeNodeStyles)(i,a.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,rt.mergeEdgeStyles)(r,i.style)),r}filterNodes(e,t){return e.filter(r=>{let i=this.resolveNodeType(r);return!(t.includeNodeTypes&&t.includeNodeTypes.length>0&&!t.includeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||!t.includeDeprecated&&this.nodeTypes.get(i.primaryType)?.deprecated)})}filterEdges(e,t){return e.filter(r=>{let i=r.predicate??r.type;return!(t.includeEdgeTypes&&t.includeEdgeTypes.length>0&&!t.includeEdgeTypes.includes(i)||t.excludeEdgeTypes&&t.excludeEdgeTypes.length>0&&t.excludeEdgeTypes.includes(i))})}groupNodesByType(e,t,r={}){let{groupByNodeType:i=!0,groupByParentType:s=!1,groupLevel:a=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let d of e){let p=this.resolveNodeType(d),_;if(l?_=l(p.types):s&&p.types.length>a?_=p.types[a]??p.primaryType:i?_=p.primaryType:_="all",!u.has(_)){let E=this.nodeTypes.get(_)?.label??(0,rt.extractLocalName)(_);u.set(_,{nodeIds:new Set,label:E})}u.get(_).nodeIds.add(d.id)}let f=Array.from(u.entries()).map(([d,p])=>({id:d,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((_,b)=>b.nodeIds.length-_.nodeIds.length);let d=f.slice(0,c-1),p=f.slice(c-1).flatMap(_=>_.nodeIds);d.push({id:"other",label:"Other",nodeIds:p}),f=d}let h=new Map;for(let d of f)for(let p of d.nodeIds)h.set(p,d.id);return f.map((d,p)=>{let _=new Set(d.nodeIds),b=[],E=[];for(let M of t){let G=_.has(M.source),Q=_.has(M.target);G&&Q?M.id&&b.push(M.id):(G||Q)&&M.id&&E.push(M.id)}let C=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:d.id,label:d.label,nodeIds:d.nodeIds,internalEdgeIds:b,externalEdgeIds:E,color:C,stats:{nodeCount:d.nodeIds.length,internalEdgeCount:b.length,externalEdgeCount:E.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let a=this.resolveNodeType(s);if(a.primaryType!=="unknown"){let c=this.nodeTypes.get(a.primaryType);!c&&a.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${a.primaryType}" is not registered`,elementId:s.id,suggestion:"Register the type with registerNodeType()"}),c?.deprecated&&i.push({code:"DEPRECATED_NODE_TYPE",message:`Node uses deprecated type "${a.primaryType}"`,elementId:s.id,suggestion:"Migrate to a non-deprecated type"})}else i.push({code:"MISSING_NODE_TYPE",message:"Node has no type information",elementId:s.id,suggestion:"Add exo:Instance_class or rdf:type to the node"})}for(let s of t){let a=s.predicate??s.type,c=this.edgeTypes.get(a);if(c?.domain&&c.domain.length>0){let l=e.find(u=>u.id===s.source);if(l){let u=this.resolveNodeType(l);c.domain.some(h=>u.types.includes(h))||r.push({code:"DOMAIN_VIOLATION",message:"Edge source does not match expected domain",elementId:s.id,expected:c.domain,actual:u.types})}}if(c?.range&&c.range.length>0){let l=e.find(u=>u.id===s.target);if(l){let u=this.resolveNodeType(l);c.range.some(h=>u.types.includes(h))||r.push({code:"RANGE_VIOLATION",message:"Edge target does not match expected range",elementId:s.id,expected:c.range,actual:u.types})}}}return{valid:r.length===0,errors:r,warnings:i}}async discoverTypes(){if(!this.tripleStore||this.discoveryComplete)return;let e=await this.tripleStore.match(void 0,new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,rt.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF),void 0);for(let r of t){let i=this.getSubjectValue(r.subject),s=this.getObjectValue(r.object);if(i&&s){let a=this.typeHierarchy.get(i)??[];if(!a.includes(s)){a.push(s),this.typeHierarchy.set(i,a);let c=this.nodeTypes.get(i);c&&(c.parentTypes=a)}}}this.discoveryComplete=!0,this.emit({type:"hierarchy-updated",rootTypes:this.getRootTypes()})}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}clear(){this.nodeTypes.clear(),this.edgeTypes.clear(),this.typeHierarchy.clear(),this.discoveryComplete=!1,this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerBuiltInTypes(){for(let[e,t]of Object.entries(rt.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,rt.extractLocalName)(e),source:"custom",style:(0,rt.mergeNodeStyles)(rt.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(rt.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,rt.extractLocalName)(e),source:"custom",style:(0,rt.mergeEdgeStyles)(rt.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new Ti.IRI(e),new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new Ti.IRI(e),new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,rt.extractLocalName)(e):(0,rt.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,a="rdfs:Class",c=await this.tripleStore.match(new Ti.IRI(e),new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===rt.RDF_TYPE_PREDICATES.OWL_CLASS){a="owl:Class";break}let l=rt.BUILT_IN_NODE_STYLES[e]??rt.BUILT_IN_NODE_STYLES[(0,rt.extractLocalName)(e)],u={uri:e,label:i,description:s,source:a,style:(0,rt.mergeNodeStyles)(rt.DEFAULT_NODE_STYLE,l??{}),priority:1};this.registerNodeType(u)}normalizeTypeUri(e){let t=e.match(/^\[\[(.+?)\]\]$/);return t?t[1]:e}getSubjectValue(e){if(e instanceof Ti.IRI)return e.value;if(e instanceof IS.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof O4.Literal||e instanceof Ti.IRI)return e.value;if(e instanceof IS.BlankNode)return`_:${e.id}`}getRootTypes(){let e=new Set;for(let r of this.typeHierarchy.values())for(let i of r)e.add(i);let t=[];for(let r of this.nodeTypes.keys())(!this.typeHierarchy.has(r)||this.typeHierarchy.get(r).length===0)&&e.has(r)&&t.push(r);return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){console.error("TypeRegistry: error in subscriber callback",r)}}};Mf.TypeRegistry=C0});var I0=v(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.SPARQL_TEMPLATES=k.KNOWN_CLASSES=k.KNOWN_PROTOTYPES=k.EFFORT_STATUSES=k.ASSET_CLASSES=k.PREDICATES=k.SPARQL_PREFIXES=void 0;k.findClassByTerm=P4;k.getTemplateByName=R4;k.findMatchingTemplates=F4;k.fillTemplate=D4;k.validateParameters=N4;k.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
|
|
110
|
+
`).trim()}removeHtmlTags(e){let t=/<[^>]*>/g,r=e,i;do i=r,r=r.replace(t,"");while(r!==i);return r}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}getStats(){return{requestCount:this.requestCount,tokenCount:this.tokenCount}}resetStats(){this.requestCount=0,this.tokenCount=0}};vn.EmbeddingService=b0;vn.EmbeddingService=b0=y4([(0,_4.injectable)(),v4("design:paramtypes",[Object])],b0)});var T0=v(_n=>{"use strict";var b4=_n&&_n.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},S4=_n&&_n.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(_n,"__esModule",{value:!0});_n.VectorStore=_n.DEFAULT_VECTOR_STORE_CONFIG=void 0;var w4=Ve(),w0=la();_n.DEFAULT_VECTOR_STORE_CONFIG={maxEntries:0,similarityThreshold:.7};var E0=class{static{o(this,"VectorStore")}constructor(e={}){this.entries=new Map,this.createdAt=new Date,this.updatedAt=new Date,this.config={..._n.DEFAULT_VECTOR_STORE_CONFIG,...e}}setConfig(e){this.config={...this.config,...e}}upsert(e){if(!e.vector||e.vector.length===0)throw new Error("Vector cannot be empty");let t=this.entries.values().next().value;if(t&&t.vector.length!==e.vector.length)throw new Error(`Vector dimension mismatch: expected ${t.vector.length}, got ${e.vector.length}`);if(this.config.maxEntries&&this.config.maxEntries>0&&!this.entries.has(e.id)&&this.entries.size>=this.config.maxEntries){let r=null,i=1/0;for(let[s,a]of this.entries)a.timestamp<i&&(i=a.timestamp,r=s);r&&(this.entries.delete(r),w0.LoggingService.debug(`VectorStore: Evicted oldest entry ${r}`))}this.entries.set(e.id,e),this.updatedAt=new Date}remove(e){let t=this.entries.delete(e);return t&&(this.updatedAt=new Date),t}get(e){return this.entries.get(e)}has(e){return this.entries.has(e)}needsUpdate(e,t){let r=this.entries.get(e);return r?r.contentHash!==t:!0}getAllIds(){return Array.from(this.entries.keys())}size(){return this.entries.size}clear(){this.entries.clear(),this.updatedAt=new Date}search(e,t=10){if(this.entries.size===0)return[];let r=this.entries.values().next().value;if(r&&r.vector.length!==e.length)throw new Error(`Query vector dimension mismatch: expected ${r.vector.length}, got ${e.length}`);let i=[],s=this.config.similarityThreshold??.7;for(let a of this.entries.values()){let c=this.cosineSimilarity(e,a.vector);c>=s&&i.push({entry:a,score:c})}return i.sort((a,c)=>c.score-a.score),i.slice(0,t)}findSimilar(e,t=10){let r=this.entries.get(e);return r?this.search(r.vector,t+1).filter(s=>s.entry.id!==e).slice(0,t):[]}cosineSimilarity(e,t){if(e.length!==t.length)throw new Error("Vectors must have the same dimension");let r=0,i=0,s=0;for(let a=0;a<e.length;a++)r+=e[a]*t[a],i+=e[a]*e[a],s+=t[a]*t[a];return i=Math.sqrt(i),s=Math.sqrt(s),i===0||s===0?0:r/(i*s)}serialize(){return{version:1,entries:Array.from(this.entries.values()).map(e=>({id:e.id,vector:e.vector,metadata:e.metadata,timestamp:e.timestamp,contentHash:e.contentHash})),createdAt:this.createdAt.toISOString(),updatedAt:this.updatedAt.toISOString()}}deserialize(e){if(e.version!==1)throw new Error(`Unsupported VectorStore version: ${e.version}`);this.entries.clear();for(let t of e.entries)this.entries.set(t.id,{id:t.id,vector:t.vector,metadata:t.metadata,timestamp:t.timestamp,contentHash:t.contentHash});this.createdAt=new Date(e.createdAt),this.updatedAt=new Date(e.updatedAt),w0.LoggingService.debug(`VectorStore: Loaded ${this.entries.size} entries from persistence`)}getStats(){let t=this.entries.values().next().value?.vector.length??null,i=(t?this.entries.size*t*8:0)/(1024*1024);return{entryCount:this.entries.size,dimension:t,createdAt:this.createdAt.toISOString(),updatedAt:this.updatedAt.toISOString(),estimatedMemoryMB:Math.round(i*100)/100}}pruneInvalidEntries(e){let t=[];for(let r of this.entries.keys())e.has(r)||t.push(r);for(let r of t)this.entries.delete(r);return t.length>0&&(this.updatedAt=new Date,w0.LoggingService.debug(`VectorStore: Pruned ${t.length} invalid entries`)),t.length}};_n.VectorStore=E0;_n.VectorStore=E0=b4([(0,w4.injectable)(),S4("design:paramtypes",[Object])],E0)});var AS=v(bn=>{"use strict";var E4=bn&&bn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},T4=bn&&bn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(bn,"__esModule",{value:!0});bn.SemanticSearchService=bn.DEFAULT_SEMANTIC_SEARCH_CONFIG=void 0;var x4=Ve(),Zc=la(),xS=S0(),A4=T0();bn.DEFAULT_SEMANTIC_SEARCH_CONFIG={embedding:xS.DEFAULT_EMBEDDING_CONFIG,maxResults:10,minSimilarity:.7,autoEmbed:!0,batchSize:20};var x0=class{static{o(this,"SemanticSearchService")}constructor(e={}){this.indexingStatus={isIndexing:!1,totalFiles:0,indexedFiles:0,failedFiles:0,progress:0},this.abortController=null,this.config={...bn.DEFAULT_SEMANTIC_SEARCH_CONFIG,...e},this.embeddingService=new xS.EmbeddingService(this.config.embedding),this.vectorStore=new A4.VectorStore({similarityThreshold:this.config.minSimilarity})}setConfig(e){this.config={...this.config,...e},e.embedding&&this.embeddingService.setConfig(e.embedding),e.minSimilarity!==void 0&&this.vectorStore.setConfig({similarityThreshold:e.minSimilarity})}getConfig(){return{...this.config,embedding:this.embeddingService.getConfig()}}isConfigured(){return this.embeddingService.isConfigured()}getIndexingStatus(){return{...this.indexingStatus}}async search(e,t){if(!this.isConfigured())throw new Error("SemanticSearchService is not properly configured");if(!e.trim())return[];let r=await this.embeddingService.generateEmbedding(e),i=t??this.config.maxResults;return this.vectorStore.search(r.embedding,i).map(a=>this.toSearchResult(a))}async findSimilar(e,t){let r=t??this.config.maxResults;return this.vectorStore.findSimilar(e,r).map(s=>this.toSearchResult(s))}toSearchResult(e){let t=e.entry.metadata??{};return{path:e.entry.id,score:e.score,label:t.exo__Asset_label,instanceClass:this.extractInstanceClass(t),metadata:t}}extractInstanceClass(e){let t=e.exo__Instance_class;if(t){if(Array.isArray(t)){let r=t[0];return typeof r=="string"?this.cleanWikiLink(r):void 0}return typeof t=="string"?this.cleanWikiLink(t):void 0}}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}async indexFile(e,t,r){if(!this.isConfigured())return!1;try{let i=await this.hashContent(t);if(!this.vectorStore.needsUpdate(e,i))return!0;let s=this.embeddingService.prepareTextForEmbedding(t,r),a=await this.embeddingService.generateEmbedding(s);return this.vectorStore.upsert({id:e,vector:a.embedding,metadata:r,timestamp:Date.now(),contentHash:i}),Zc.LoggingService.debug(`Indexed file: ${e}`),!0}catch(i){return Zc.LoggingService.warn(`Failed to index file ${e}: ${i instanceof Error?i.message:"Unknown error"}`),!1}}removeFromIndex(e){return this.vectorStore.remove(e)}async indexBatch(e){if(!this.isConfigured())return{indexed:0,failed:e.length};let t=[],r=new Map;for(let c of e){let l=await this.hashContent(c.content);if(!this.vectorStore.needsUpdate(c.path,l))continue;let u=this.embeddingService.prepareTextForEmbedding(c.content,c.metadata);t.push({id:c.path,text:u}),r.set(c.path,{content:c.content,metadata:c.metadata,contentHash:l})}if(t.length===0)return{indexed:0,failed:0};let i=await this.embeddingService.generateBatchEmbeddings(t),s=0,a=0;for(let c of i){let l=r.get(c.id);l&&(c.result?(this.vectorStore.upsert({id:c.id,vector:c.result.embedding,metadata:l.metadata,timestamp:Date.now(),contentHash:l.contentHash}),s++):(a++,Zc.LoggingService.warn(`Failed to embed ${c.id}: ${c.error||"Unknown error"}`)))}return{indexed:s,failed:a}}async indexAll(e,t,r){if(!this.isConfigured())throw new Error("SemanticSearchService is not properly configured");if(this.indexingStatus.isIndexing)throw new Error("Indexing is already in progress");this.abortController=new AbortController,this.indexingStatus={isIndexing:!0,totalFiles:e.length,indexedFiles:0,failedFiles:0,progress:0};let i=0,s=0,a=!1;try{for(let c=0;c<e.length;c+=this.config.batchSize){if(this.abortController.signal.aborted){a=!0;break}let l=e.slice(c,c+this.config.batchSize),u=[];for(let h of l){if(this.abortController.signal.aborted){a=!0;break}let d=await t(h);d?u.push({path:h,content:d.content,metadata:d.metadata}):s++}if(a)break;let f=await this.indexBatch(u);i+=f.indexed,s+=f.failed,this.indexingStatus.indexedFiles=c+l.length,this.indexingStatus.failedFiles=s,this.indexingStatus.progress=Math.round(this.indexingStatus.indexedFiles/e.length*100),r&&r({...this.indexingStatus})}}finally{this.indexingStatus.isIndexing=!1,this.abortController=null}return{indexed:i,failed:s,aborted:a}}abortIndexing(){this.abortController&&(this.abortController.abort(),Zc.LoggingService.debug("Indexing aborted by user"))}isIndexed(e){return this.vectorStore.has(e)}getIndexedPaths(){return this.vectorStore.getAllIds()}getIndexedCount(){return this.vectorStore.size()}clearIndex(){this.vectorStore.clear(),Zc.LoggingService.debug("Semantic search index cleared")}pruneDeletedFiles(e){return this.vectorStore.pruneInvalidEntries(e)}serializeIndex(){return this.vectorStore.serialize()}deserializeIndex(e){this.vectorStore.deserialize(e)}getStats(){return{indexStats:this.vectorStore.getStats(),embeddingStats:this.embeddingService.getStats()}}async hashContent(e){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("")}};bn.SemanticSearchService=x0;bn.SemanticSearchService=x0=E4([(0,x4.injectable)(),T4("design:paramtypes",[Object])],x0)});var CS=v(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});kf.GraphQueryService=void 0;var el=We(),C4=mt(),ys=dn(),I4=rm(),Ei={INSTANCE_CLASS:ys.Namespace.EXO.term("Instance_class"),ASSET_LABEL:ys.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:ys.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:ys.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:ys.Namespace.EMS.term("Effort_parent"),REFERENCES:ys.Namespace.EXO.term("references"),REFERENCED_BY:ys.Namespace.EXO.term("referencedBy"),RDF_TYPE:ys.Namespace.RDF.term("type")},A0=class{static{o(this,"GraphQueryService")}constructor(e,t={}){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.config={defaultLimit:t.defaultLimit??100,maxLimit:t.maxLimit??1e4,defaultDepth:t.defaultDepth??2,maxDepth:t.maxDepth??10,includeArchivedByDefault:t.includeArchivedByDefault??!1,cacheTTL:t.cacheTTL??3e4}}async loadGraphData(e={}){let t=Date.now(),r=await this.loadNodes(e),i=await this.loadEdges(r,e),s=this.computeStats(r,i),a=Date.now()-t;return a>100&&r.length>0&&console.debug(`GraphQueryService: loaded ${r.length} nodes in ${a}ms (${(a/r.length).toFixed(2)}ms/node)`),{nodes:r,edges:i,stats:s,lastUpdated:Date.now(),version:1}}async loadNodesIncremental(e={}){let t=Math.min(e.limit??this.config.defaultLimit,this.config.maxLimit),r=e.offset??0,i=await this.loadNodes({...e,limit:t+1,offset:r}),s=i.length>t,a=s?i.slice(0,t):i,c=await this.loadEdges(a,e);return{nodes:a,edges:c,hasMore:s,totalCount:void 0,cursor:s?String(r+t):void 0}}async loadConnectedNodes(e,t={}){let r=Math.min(t.depth??this.config.defaultDepth,this.config.maxDepth),i=Math.min(t.limit??this.config.maxLimit,this.config.maxLimit),s=new Set,a=[{id:e,currentDepth:0}],c=[];for(;a.length>0&&c.length<i;){let{id:u,currentDepth:f}=a.shift();if(s.has(u))continue;s.add(u);let h=await this.getNodeById(u,t);if(h&&(c.push(h),f<r)){let d=await this.getConnectedNodeIds(u);for(let p of d)s.has(p)||a.push({id:p,currentDepth:f+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:a.length>0,totalCount:s.size+a.length}}async getNodeById(e,t={}){let r=this.getCachedNode(e);if(r)return{...r};let i=this.idToIRI(e),s=await this.tripleStore.match(i,void 0,void 0);if(s.length===0)return null;let a=this.triplesToNode(e,s,t);return a&&this.cacheNode(a),a}subscribe(e){return this.subscribers.add(e),{unsubscribe:o(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){console.error("GraphQueryService: error in subscriber callback",r)}this.invalidateCache()}async getStats(){let e=await this.loadNodes({includeArchived:!0}),t=await this.loadEdges(e,{});return this.computeStats(e,t)}clearCache(){this.nodeCache.clear(),this.lastCacheUpdate=0}async loadNodes(e){let t=e.includeArchived??this.config.includeArchivedByDefault,r=e.limit??this.config.maxLimit,i=e.offset??0,s=await this.tripleStore.match(void 0,Ei.INSTANCE_CLASS,void 0),a=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);a=s.filter(_=>{let b=this.getObjectValue(_.object);return b&&p.has(b)})}let c=new Set;for(let p of a)c.add(this.subjectToId(p.subject));let f=Array.from(c).slice(i,i+r).map(p=>this.getNodeById(p,e));return(await Promise.all(f)).filter(p=>!(!p||!t&&p.isArchived))}async loadEdges(e,t){let r=new Set(e.map(a=>a.id)),i=[],s=new Set;for(let a of e){let c=this.idToIRI(a.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(a.id,u,r);f&&!s.has(f.id)&&(!t.edgeTypes||t.edgeTypes.includes(f.type))&&(s.add(f.id),i.push(f))}}return i}async getConnectedNodeIds(e){let t=this.idToIRI(e),r=[],i=await this.tripleStore.match(t,void 0,void 0);for(let a of i){let c=this.objectToId(a.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let a of s)r.push(this.subjectToId(a.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,a,c,l,u=!1;for(let d of t){let p=d.predicate.value,_=this.getObjectValue(d.object);if(p===Ei.INSTANCE_CLASS.value)s=_;else if(p===Ei.ASSET_LABEL.value)a=_;else if(p===Ei.ASSET_PROTOTYPE.value)c=this.objectToId(d.object)??_;else if(p===Ei.EFFORT_PARENT.value)l=this.objectToId(d.object)??_;else if(p===Ei.ASSET_IS_ARCHIVED.value)u=_==="true"||_==="1";else{let b=this.predicateToPropertyName(p);b&&(i[b]=_)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),h=a??this.pathToTitle(f);return{id:e,path:f,title:h,label:h,assetClass:s,isArchived:u,uri:e.startsWith("http")?e:void 0,prototype:c,parent:l,properties:Object.keys(i).length>0?i:void 0}}tripleToEdge(e,t,r){let i=t.predicate.value,s=this.objectToId(t.object);if(!s||!r.has(s)||s===e)return null;let a=this.predicateToEdgeType(i);if(!a)return null;let c=(0,I4.createEdgeId)(e,s,a,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:a,predicate:i,label:l}}predicateToEdgeType(e){return e===Ei.EFFORT_PARENT.value?"hierarchy":e===Ei.ASSET_PROTOTYPE.value?"prototype":e===Ei.REFERENCES.value?"forward-link":e===Ei.REFERENCED_BY.value?"backlink":e.includes("Asset_")||e.includes("Instance_")?null:"semantic"}predicateToLabel(e){let t=e.lastIndexOf("#"),r=e.lastIndexOf("/"),i=Math.max(t,r);return i>=0?e.substring(i+1):e}predicateToPropertyName(e){return this.predicateToLabel(e).replace(/_/g,"__").replace(/#/g,"_")}computeStats(e,t){let r={},i={backlink:0,"forward-link":0,hierarchy:0,prototype:0,semantic:0,reference:0};for(let c of e){let l=c.assetClass??"unknown";r[l]=(r[l]??0)+1}for(let c of t)i[c.type]=(i[c.type]??0)+1;let s=new Map,a=new Map;for(let c of t)a.set(c.source,(a.get(c.source)??0)+1),s.set(c.target,(s.get(c.target)??0)+1);for(let c of e)c.inDegree=s.get(c.id)??0,c.outDegree=a.get(c.id)??0,c.weight=c.inDegree+c.outDegree;return{nodeCount:e.length,edgeCount:t.length,nodesByClass:r,edgesByType:i,computedAt:Date.now()}}idToIRI(e){return e.startsWith("http://")||e.startsWith("https://")?new el.IRI(e):new el.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof el.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof el.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof C4.Literal||e instanceof el.IRI)return e.value}idToPath(e){if(e.startsWith("obsidian://vault/"))return decodeURIComponent(e.replace("obsidian://vault/",""));if(e.startsWith("http://")||e.startsWith("https://")){let t=e.match(/\/([^/]+\.md)$/);if(t)return t[1]}return e}pathToTitle(e){return(e.split("/").pop()??e).replace(/\.md$/,"")}getCachedNode(e){return Date.now()-this.lastCacheUpdate>this.config.cacheTTL?(this.clearCache(),null):this.nodeCache.get(e)??null}cacheNode(e){this.nodeCache.set(e.id,e),this.lastCacheUpdate===0&&(this.lastCacheUpdate=Date.now())}invalidateCache(){this.clearCache()}};kf.GraphQueryService=A0});var OS=v(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});Mf.TypeRegistry=void 0;var Ti=We(),IS=kt(),O4=mt(),rt=nm(),C0=class{static{o(this,"TypeRegistry")}constructor(e=null,t={}){this.nodeTypes=new Map,this.edgeTypes=new Map,this.typeHierarchy=new Map,this.subscribers=new Set,this.discoveryComplete=!1,this.tripleStore=e,this.config={autoDiscoverTypes:t.autoDiscoverTypes??!0,includeBuiltInStyles:t.includeBuiltInStyles??!0,styleResolution:t.styleResolution??{mergeStyles:!0,inheritParentStyles:!0,defaultNodeStyle:rt.DEFAULT_NODE_STYLE,defaultEdgeStyle:rt.DEFAULT_EDGE_STYLE},maxInheritanceDepth:t.maxInheritanceDepth??10},this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerNodeType(e){let r=this.nodeTypes.get(e.uri)?"type-updated":"type-added";this.nodeTypes.set(e.uri,e),e.parentTypes&&e.parentTypes.length>0&&this.typeHierarchy.set(e.uri,e.parentTypes),this.emit({type:r,typeUri:e.uri,definition:e})}registerEdgeType(e){let r=this.edgeTypes.get(e.uri)?"type-updated":"type-added";this.edgeTypes.set(e.uri,e),this.emit({type:r,typeUri:e.uri,definition:e})}unregisterType(e){let t=this.nodeTypes.delete(e),r=this.edgeTypes.delete(e);this.typeHierarchy.delete(e),(t||r)&&this.emit({type:"type-removed",typeUri:e})}getNodeType(e){return this.nodeTypes.get(e)}getEdgeType(e){return this.edgeTypes.get(e)}getAllNodeTypes(){return Array.from(this.nodeTypes.values())}getAllEdgeTypes(){return Array.from(this.edgeTypes.values())}getParentTypes(e,t=this.config.maxInheritanceDepth){let r=[],i=new Set,s=[{uri:e,currentDepth:0}];for(;s.length>0;){let{uri:a,currentDepth:c}=s.shift();if(i.has(a)||(i.add(a),c>=t))continue;let l=this.typeHierarchy.get(a)??[];for(let u of l)i.has(u)||(r.push(u),s.push({uri:u,currentDepth:c+1}))}return r}getChildTypes(e){let t=[];for(let[r,i]of this.typeHierarchy)i.includes(e)&&t.push(r);return t}isSubtypeOf(e,t){return e===t?!0:this.getParentTypes(e).includes(t)}resolveNodeType(e){let t=[],r="unknown",i="custom";if(e.assetClass){let c=this.normalizeTypeUri(e.assetClass);t.push(c),r=c,i="exo:Instance_class"}let s=e.properties?.[rt.RDF_TYPE_PREDICATES.RDF_TYPE];s&&!t.includes(s)&&(t.push(s),r==="unknown"&&(r=s,i="rdf:type"));for(let c of[...t]){let l=this.getParentTypes(c);for(let u of l)t.includes(u)||t.push(u)}let a=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:a,source:i}}resolveEdgeType(e){let t=e.predicate??e.type,r=e.predicate?"rdf:type":"custom",i=this.resolveEdgeStyle(t);return{primaryType:t,resolvedStyle:i,source:r}}resolveNodeStyle(e){let{mergeStyles:t,defaultNodeStyle:r}=this.config.styleResolution,i={...r},s=[];for(let a of e){let c=this.nodeTypes.get(a);c&&s.push(c)}if(s.sort((a,c)=>a.priority-c.priority),t)for(let a of s)i=(0,rt.mergeNodeStyles)(i,a.style);else if(s.length>0){let a=s[s.length-1];i=(0,rt.mergeNodeStyles)(i,a.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,rt.mergeEdgeStyles)(r,i.style)),r}filterNodes(e,t){return e.filter(r=>{let i=this.resolveNodeType(r);return!(t.includeNodeTypes&&t.includeNodeTypes.length>0&&!t.includeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(a=>i.types.includes(a)||t.includeInferred&&this.isSubtypeOf(i.primaryType,a))||!t.includeDeprecated&&this.nodeTypes.get(i.primaryType)?.deprecated)})}filterEdges(e,t){return e.filter(r=>{let i=r.predicate??r.type;return!(t.includeEdgeTypes&&t.includeEdgeTypes.length>0&&!t.includeEdgeTypes.includes(i)||t.excludeEdgeTypes&&t.excludeEdgeTypes.length>0&&t.excludeEdgeTypes.includes(i))})}groupNodesByType(e,t,r={}){let{groupByNodeType:i=!0,groupByParentType:s=!1,groupLevel:a=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let d of e){let p=this.resolveNodeType(d),_;if(l?_=l(p.types):s&&p.types.length>a?_=p.types[a]??p.primaryType:i?_=p.primaryType:_="all",!u.has(_)){let E=this.nodeTypes.get(_)?.label??(0,rt.extractLocalName)(_);u.set(_,{nodeIds:new Set,label:E})}u.get(_).nodeIds.add(d.id)}let f=Array.from(u.entries()).map(([d,p])=>({id:d,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((_,b)=>b.nodeIds.length-_.nodeIds.length);let d=f.slice(0,c-1),p=f.slice(c-1).flatMap(_=>_.nodeIds);d.push({id:"other",label:"Other",nodeIds:p}),f=d}let h=new Map;for(let d of f)for(let p of d.nodeIds)h.set(p,d.id);return f.map((d,p)=>{let _=new Set(d.nodeIds),b=[],E=[];for(let j of t){let G=_.has(j.source),Q=_.has(j.target);G&&Q?j.id&&b.push(j.id):(G||Q)&&j.id&&E.push(j.id)}let C=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:d.id,label:d.label,nodeIds:d.nodeIds,internalEdgeIds:b,externalEdgeIds:E,color:C,stats:{nodeCount:d.nodeIds.length,internalEdgeCount:b.length,externalEdgeCount:E.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let a=this.resolveNodeType(s);if(a.primaryType!=="unknown"){let c=this.nodeTypes.get(a.primaryType);!c&&a.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${a.primaryType}" is not registered`,elementId:s.id,suggestion:"Register the type with registerNodeType()"}),c?.deprecated&&i.push({code:"DEPRECATED_NODE_TYPE",message:`Node uses deprecated type "${a.primaryType}"`,elementId:s.id,suggestion:"Migrate to a non-deprecated type"})}else i.push({code:"MISSING_NODE_TYPE",message:"Node has no type information",elementId:s.id,suggestion:"Add exo:Instance_class or rdf:type to the node"})}for(let s of t){let a=s.predicate??s.type,c=this.edgeTypes.get(a);if(c?.domain&&c.domain.length>0){let l=e.find(u=>u.id===s.source);if(l){let u=this.resolveNodeType(l);c.domain.some(h=>u.types.includes(h))||r.push({code:"DOMAIN_VIOLATION",message:"Edge source does not match expected domain",elementId:s.id,expected:c.domain,actual:u.types})}}if(c?.range&&c.range.length>0){let l=e.find(u=>u.id===s.target);if(l){let u=this.resolveNodeType(l);c.range.some(h=>u.types.includes(h))||r.push({code:"RANGE_VIOLATION",message:"Edge target does not match expected range",elementId:s.id,expected:c.range,actual:u.types})}}}return{valid:r.length===0,errors:r,warnings:i}}async discoverTypes(){if(!this.tripleStore||this.discoveryComplete)return;let e=await this.tripleStore.match(void 0,new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,rt.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF),void 0);for(let r of t){let i=this.getSubjectValue(r.subject),s=this.getObjectValue(r.object);if(i&&s){let a=this.typeHierarchy.get(i)??[];if(!a.includes(s)){a.push(s),this.typeHierarchy.set(i,a);let c=this.nodeTypes.get(i);c&&(c.parentTypes=a)}}}this.discoveryComplete=!0,this.emit({type:"hierarchy-updated",rootTypes:this.getRootTypes()})}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}clear(){this.nodeTypes.clear(),this.edgeTypes.clear(),this.typeHierarchy.clear(),this.discoveryComplete=!1,this.config.includeBuiltInStyles&&this.registerBuiltInTypes()}registerBuiltInTypes(){for(let[e,t]of Object.entries(rt.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,rt.extractLocalName)(e),source:"custom",style:(0,rt.mergeNodeStyles)(rt.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(rt.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,rt.extractLocalName)(e),source:"custom",style:(0,rt.mergeEdgeStyles)(rt.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new Ti.IRI(e),new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new Ti.IRI(e),new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,rt.extractLocalName)(e):(0,rt.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,a="rdfs:Class",c=await this.tripleStore.match(new Ti.IRI(e),new Ti.IRI(rt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===rt.RDF_TYPE_PREDICATES.OWL_CLASS){a="owl:Class";break}let l=rt.BUILT_IN_NODE_STYLES[e]??rt.BUILT_IN_NODE_STYLES[(0,rt.extractLocalName)(e)],u={uri:e,label:i,description:s,source:a,style:(0,rt.mergeNodeStyles)(rt.DEFAULT_NODE_STYLE,l??{}),priority:1};this.registerNodeType(u)}normalizeTypeUri(e){let t=e.match(/^\[\[(.+?)\]\]$/);return t?t[1]:e}getSubjectValue(e){if(e instanceof Ti.IRI)return e.value;if(e instanceof IS.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof O4.Literal||e instanceof Ti.IRI)return e.value;if(e instanceof IS.BlankNode)return`_:${e.id}`}getRootTypes(){let e=new Set;for(let r of this.typeHierarchy.values())for(let i of r)e.add(i);let t=[];for(let r of this.nodeTypes.keys())(!this.typeHierarchy.has(r)||this.typeHierarchy.get(r).length===0)&&e.has(r)&&t.push(r);return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){console.error("TypeRegistry: error in subscriber callback",r)}}};Mf.TypeRegistry=C0});var I0=v(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.SPARQL_TEMPLATES=M.KNOWN_CLASSES=M.KNOWN_PROTOTYPES=M.EFFORT_STATUSES=M.ASSET_CLASSES=M.PREDICATES=M.SPARQL_PREFIXES=void 0;M.findClassByTerm=P4;M.getTemplateByName=R4;M.findMatchingTemplates=F4;M.fillTemplate=D4;M.validateParameters=N4;M.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
|
|
111
111
|
PREFIX ems: <https://exocortex.my/ontology/ems#>
|
|
112
112
|
PREFIX ims: <https://exocortex.my/ontology/ims#>
|
|
113
113
|
PREFIX gtd: <https://exocortex.my/ontology/gtd#>
|
|
114
114
|
PREFIX period: <https://exocortex.my/ontology/period#>
|
|
115
115
|
PREFIX lit: <https://exocortex.my/ontology/lit#>
|
|
116
116
|
PREFIX inbox: <https://exocortex.my/ontology/inbox#>
|
|
117
|
-
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>`;
|
|
117
|
+
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>`;M.PREDICATES={ASSET_LABEL:"exo:Asset_label",ASSET_UID:"exo:Asset_uid",ASSET_PROTOTYPE:"exo:Asset_prototype",INSTANCE_CLASS:"exo:Instance_class",EFFORT_START_TIMESTAMP:"ems:Effort_startTimestamp",EFFORT_END_TIMESTAMP:"ems:Effort_endTimestamp",EFFORT_STATUS:"ems:Effort_status",EFFORT_PARENT:"ems:Effort_parent",TASK_ESTIMATED_DURATION:"ems:Task_estimatedDuration",PROPERTY_DOMAIN:"exo:Property_domain",PROPERTY_RANGE:"exo:Property_range",CLASS_SUPERCLASS:"exo:Class_superClass"};M.ASSET_CLASSES={TASK:"ems__Task",MEETING:"ems__Meeting",PROJECT:"ems__Project",AREA:"ems__Area",TASK_PROTOTYPE:"ems__TaskPrototype",MEETING_PROTOTYPE:"ems__MeetingPrototype",PERSON:"ims__Person",DAY:"period__Day",CLASS:"exo__Class",OBJECT_PROPERTY:"exo__ObjectProperty",DATA_PROPERTY:"exo__DataProperty",DEPRECATED_PROPERTY:"exo__DeprecatedProperty"};M.EFFORT_STATUSES={DOING:"ems:EffortStatusDoing",DONE:"ems:EffortStatusDone",BACKLOG:"ems:EffortStatusBacklog"};M.KNOWN_PROTOTYPES={MORNING_SHOWER:"2d369bb0-159f-4639-911d-ec2c585e8d00",CUT_NAILS:"1d7b739c-0e3e-46f2-ba88-e66f30b732f9"};M.KNOWN_CLASSES=[{terms:["\u043A\u043E\u043D\u0446\u0435\u043F\u0442","concept","\u043A\u043E\u043D\u0446\u0435\u043F\u0442\u044B","\u043A\u043E\u043D\u0446\u0435\u043F\u0442\u043E\u0432"],match:"dda12c48-6886-4624-8710-ed4ba92ce2b3",label:"ims__Concept"},{terms:["\u0437\u0430\u0434\u0430\u0447\u0430","\u0437\u0430\u0434\u0430\u0447\u0438","\u0437\u0430\u0434\u0430\u0447","task","tasks"],match:"1b20a8f0-d745-4e93-91db-4531b3df120e",label:"ems__Task"},{terms:["\u043F\u0440\u043E\u0435\u043A\u0442","\u043F\u0440\u043E\u0435\u043A\u0442\u044B","\u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432","project","projects"],match:"7db5eeff-718a-49b0-8d2b-39b084a356e3",label:"ems__Project"},{terms:["\u043A\u043E\u043D\u0441\u043F\u0435\u043A\u0442","\u043A\u043E\u043D\u0441\u043F\u0435\u043A\u0442\u044B","\u043A\u043E\u043D\u0441\u043F\u0435\u043A\u0442\u043E\u0432","conspect"],match:"8efe8da6-0b88-4752-b90a-109280111c43",label:"lit__Conspect"},{terms:["\u0432\u0441\u0442\u0440\u0435\u0447\u0430","\u0432\u0441\u0442\u0440\u0435\u0447\u0438","\u0432\u0441\u0442\u0440\u0435\u0447","meeting","meetings"],match:"ems#Meeting",label:"ems__Meeting"},{terms:["\u043E\u0431\u043B\u0430\u0441\u0442\u044C","\u043E\u0431\u043B\u0430\u0441\u0442\u0438","area","areas"],match:"ems#Area",label:"ems__Area"},{terms:["\u043F\u0435\u0440\u0441\u043E\u043D\u0430","\u043F\u0435\u0440\u0441\u043E\u043D\u044B","\u043F\u0435\u0440\u0441\u043E\u043D","\u0447\u0435\u043B\u043E\u0432\u0435\u043A","\u043B\u044E\u0434\u0438","\u043B\u044E\u0434\u0435\u0439","\u043B\u044E\u0434\u044F\u043C","person","persons"],match:"ims__Person",label:"ims__Person"}];function P4(n){let e=n.toLowerCase();return M.KNOWN_CLASSES.find(t=>t.terms.some(r=>e.includes(r)))}o(P4,"findClassByTerm");M.SPARQL_TEMPLATES=[{name:"search_by_label",description:"Search entities by label containing a keyword",template:`${M.SPARQL_PREFIXES}
|
|
118
118
|
|
|
119
119
|
SELECT ?s ?label WHERE {
|
|
120
|
-
?s ${
|
|
120
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
121
121
|
FILTER(CONTAINS(?label, "{{keyword}}"))
|
|
122
122
|
}
|
|
123
123
|
ORDER BY ?label
|
|
124
|
-
LIMIT {{limit}}`,parameters:[{name:"keyword",description:"Keyword to search for in labels",required:!0,example:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u043D\u0430\u0439\u0434\u0438 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043E \u0441\u043B\u043E\u0432\u043E\u043C \u0434\u0443\u0448","\u043F\u043E\u0438\u0441\u043A \u043F\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044E \u043F\u043E\u0441\u043F\u0430\u0442\u044C","\u043F\u043E\u043A\u0430\u0436\u0438 \u0437\u0430\u043F\u0438\u0441\u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0441\u043B\u043E\u0432\u043E \u0439\u043E\u0433\u0430"],keywords:["\u043D\u0430\u0439\u0434\u0438","\u043D\u0430\u0439\u0442\u0438","\u043F\u043E\u0438\u0441\u043A","\u0438\u0441\u043A\u0430\u0442\u044C","\u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435","\u0441\u043E \u0441\u043B\u043E\u0432\u043E\u043C"]},{name:"find_by_prototype_uuid",description:"Find all instances of a specific prototype by UUID (most reliable method)",template:`${
|
|
124
|
+
LIMIT {{limit}}`,parameters:[{name:"keyword",description:"Keyword to search for in labels",required:!0,example:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u043D\u0430\u0439\u0434\u0438 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043E \u0441\u043B\u043E\u0432\u043E\u043C \u0434\u0443\u0448","\u043F\u043E\u0438\u0441\u043A \u043F\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044E \u043F\u043E\u0441\u043F\u0430\u0442\u044C","\u043F\u043E\u043A\u0430\u0436\u0438 \u0437\u0430\u043F\u0438\u0441\u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0441\u043B\u043E\u0432\u043E \u0439\u043E\u0433\u0430"],keywords:["\u043D\u0430\u0439\u0434\u0438","\u043D\u0430\u0439\u0442\u0438","\u043F\u043E\u0438\u0441\u043A","\u0438\u0441\u043A\u0430\u0442\u044C","\u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435","\u0441\u043E \u0441\u043B\u043E\u0432\u043E\u043C"]},{name:"find_by_prototype_uuid",description:"Find all instances of a specific prototype by UUID (most reliable method)",template:`${M.SPARQL_PREFIXES}
|
|
125
125
|
|
|
126
126
|
SELECT ?s ?label ?start ?end
|
|
127
127
|
WHERE {
|
|
128
|
-
?s ${
|
|
128
|
+
?s ${M.PREDICATES.ASSET_PROTOTYPE} ?proto .
|
|
129
129
|
FILTER(CONTAINS(STR(?proto), "{{prototypeUuid}}"))
|
|
130
|
-
?s ${
|
|
131
|
-
OPTIONAL { ?s ${
|
|
132
|
-
OPTIONAL { ?s ${
|
|
130
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
131
|
+
OPTIONAL { ?s ${M.PREDICATES.EFFORT_START_TIMESTAMP} ?start }
|
|
132
|
+
OPTIONAL { ?s ${M.PREDICATES.EFFORT_END_TIMESTAMP} ?end }
|
|
133
133
|
}
|
|
134
134
|
ORDER BY DESC(?start)
|
|
135
|
-
LIMIT {{limit}}`,parameters:[{name:"prototypeUuid",description:"UUID of the prototype (or part of it)",required:!0,example:"2d369bb0"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u0432\u0441\u0435 \u0438\u043D\u0441\u0442\u0430\u043D\u0441\u044B \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430 \u0441 UUID 2d369bb0","\u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u043E\u043C 2d369bb0-159f-4639-911d-ec2c585e8d00"],keywords:["\u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F","prototype","UUID","\u0438\u043D\u0441\u0442\u0430\u043D\u0441\u044B"]},{name:"average_duration_by_prototype",description:"Calculate average duration of tasks by prototype UUID using built-in functions",template:`${
|
|
135
|
+
LIMIT {{limit}}`,parameters:[{name:"prototypeUuid",description:"UUID of the prototype (or part of it)",required:!0,example:"2d369bb0"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u0432\u0441\u0435 \u0438\u043D\u0441\u0442\u0430\u043D\u0441\u044B \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430 \u0441 UUID 2d369bb0","\u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u043E\u043C 2d369bb0-159f-4639-911d-ec2c585e8d00"],keywords:["\u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F","prototype","UUID","\u0438\u043D\u0441\u0442\u0430\u043D\u0441\u044B"]},{name:"average_duration_by_prototype",description:"Calculate average duration of tasks by prototype UUID using built-in functions",template:`${M.SPARQL_PREFIXES}
|
|
136
136
|
|
|
137
137
|
SELECT (AVG(?durationMin) AS ?avgMinutes) (COUNT(?s) AS ?count) (MIN(?durationMin) AS ?minMin) (MAX(?durationMin) AS ?maxMin) (SUM(?durationMin) AS ?totalMin)
|
|
138
138
|
WHERE {
|
|
139
|
-
?s ${
|
|
139
|
+
?s ${M.PREDICATES.ASSET_PROTOTYPE} ?proto .
|
|
140
140
|
FILTER(CONTAINS(STR(?proto), "{{prototypeUuid}}"))
|
|
141
|
-
?s ${
|
|
142
|
-
?s ${
|
|
141
|
+
?s ${M.PREDICATES.EFFORT_START_TIMESTAMP} ?start .
|
|
142
|
+
?s ${M.PREDICATES.EFFORT_END_TIMESTAMP} ?end .
|
|
143
143
|
BIND(exo:dateDiffMinutes(?start, ?end) AS ?durationMin)
|
|
144
|
-
}`,parameters:[{name:"prototypeUuid",description:"UUID of the prototype",required:!0,example:"2d369bb0-159f-4639-911d-ec2c585e8d00"}],examples:["\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u0443\u0442\u0440\u0435\u043D\u043D\u0435\u0433\u043E \u0434\u0443\u0448\u0430","\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0432 \u0441\u0440\u0435\u0434\u043D\u0435\u043C \u0437\u0430\u043D\u0438\u043C\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u043F\u043E \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u0441\u043D\u0430"],keywords:["\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0440\u0435\u0434\u043D\u044F\u044F","average","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430","\u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C","duration","\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0437\u0430\u043D\u0438\u043C\u0430\u0435\u0442"]},{name:"sleep_analysis",description:"Analyze sleep patterns (tasks starting with \u041F\u043E\u0441\u043F\u0430\u0442\u044C)",template:`${
|
|
144
|
+
}`,parameters:[{name:"prototypeUuid",description:"UUID of the prototype",required:!0,example:"2d369bb0-159f-4639-911d-ec2c585e8d00"}],examples:["\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u0443\u0442\u0440\u0435\u043D\u043D\u0435\u0433\u043E \u0434\u0443\u0448\u0430","\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0432 \u0441\u0440\u0435\u0434\u043D\u0435\u043C \u0437\u0430\u043D\u0438\u043C\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u043F\u043E \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0432\u0440\u0435\u043C\u044F \u0441\u043D\u0430"],keywords:["\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0440\u0435\u0434\u043D\u044F\u044F","average","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430","\u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C","duration","\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0437\u0430\u043D\u0438\u043C\u0430\u0435\u0442"]},{name:"sleep_analysis",description:"Analyze sleep patterns (tasks starting with \u041F\u043E\u0441\u043F\u0430\u0442\u044C)",template:`${M.SPARQL_PREFIXES}
|
|
145
145
|
|
|
146
146
|
SELECT ?label ?start ?end
|
|
147
147
|
WHERE {
|
|
148
|
-
?s ${
|
|
148
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
149
149
|
FILTER(STRSTARTS(?label, "\u041F\u043E\u0441\u043F\u0430\u0442\u044C {{yearMonth}}"))
|
|
150
|
-
?s ${
|
|
151
|
-
?s ${
|
|
150
|
+
?s ${M.PREDICATES.EFFORT_START_TIMESTAMP} ?start .
|
|
151
|
+
?s ${M.PREDICATES.EFFORT_END_TIMESTAMP} ?end .
|
|
152
152
|
}
|
|
153
|
-
ORDER BY ?start`,parameters:[{name:"yearMonth",description:"Year-month prefix for filtering (e.g., 2025-12)",required:!1,example:"2025-12"}],examples:["\u0430\u043D\u0430\u043B\u0438\u0437 \u0441\u043D\u0430 \u0437\u0430 \u0434\u0435\u043A\u0430\u0431\u0440\u044C","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u0441\u043D\u0430","\u043A\u043E\u0433\u0434\u0430 \u044F \u0441\u043F\u0430\u043B","\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u044F \u0441\u043F\u0430\u043B \u0432 \u043D\u043E\u044F\u0431\u0440\u0435"],keywords:["\u0441\u043E\u043D","\u0441\u043F\u0430\u0442\u044C","\u043F\u043E\u0441\u043F\u0430\u0442\u044C","sleep","\u0441\u043F\u0430\u043B"]},{name:"active_projects",description:"Find active projects with status Doing",template:`${
|
|
153
|
+
ORDER BY ?start`,parameters:[{name:"yearMonth",description:"Year-month prefix for filtering (e.g., 2025-12)",required:!1,example:"2025-12"}],examples:["\u0430\u043D\u0430\u043B\u0438\u0437 \u0441\u043D\u0430 \u0437\u0430 \u0434\u0435\u043A\u0430\u0431\u0440\u044C","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u0441\u043D\u0430","\u043A\u043E\u0433\u0434\u0430 \u044F \u0441\u043F\u0430\u043B","\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u044F \u0441\u043F\u0430\u043B \u0432 \u043D\u043E\u044F\u0431\u0440\u0435"],keywords:["\u0441\u043E\u043D","\u0441\u043D\u0430","\u0441\u043F\u0430\u0442\u044C","\u043F\u043E\u0441\u043F\u0430\u0442\u044C","sleep","\u0441\u043F\u0430\u043B","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u0441\u043D\u0430"]},{name:"active_projects",description:"Find active projects with status Doing",template:`${M.SPARQL_PREFIXES}
|
|
154
154
|
|
|
155
155
|
SELECT ?project ?label
|
|
156
156
|
WHERE {
|
|
157
|
-
?project ${
|
|
158
|
-
?project ${
|
|
159
|
-
?project ${
|
|
157
|
+
?project ${M.PREDICATES.INSTANCE_CLASS} "[[${M.ASSET_CLASSES.PROJECT}]]" .
|
|
158
|
+
?project ${M.PREDICATES.EFFORT_STATUS} ${M.EFFORT_STATUSES.DOING} .
|
|
159
|
+
?project ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
160
160
|
}
|
|
161
|
-
ORDER BY ?label`,parameters:[],examples:["\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B","\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0432 \u0440\u0430\u0431\u043E\u0442\u0435","\u043D\u0430\u0434 \u0447\u0435\u043C \u0440\u0430\u0431\u043E\u0442\u0430\u044E","\u0442\u0435\u043A\u0443\u0449\u0438\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B"],keywords:["\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435","\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0445","\u043F\u0440\u043E\u0435\u043A\u0442\u044B","projects","\u0432 \u0440\u0430\u0431\u043E\u0442\u0435","doing"]},{name:"projects_without_tasks",description:"Find active projects that have no child tasks",template:`${
|
|
161
|
+
ORDER BY ?label`,parameters:[],examples:["\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B","\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0432 \u0440\u0430\u0431\u043E\u0442\u0435","\u043D\u0430\u0434 \u0447\u0435\u043C \u0440\u0430\u0431\u043E\u0442\u0430\u044E","\u0442\u0435\u043A\u0443\u0449\u0438\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B"],keywords:["\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435","\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0445","\u043F\u0440\u043E\u0435\u043A\u0442\u044B","projects","\u0432 \u0440\u0430\u0431\u043E\u0442\u0435","doing"]},{name:"projects_without_tasks",description:"Find active projects that have no child tasks",template:`${M.SPARQL_PREFIXES}
|
|
162
162
|
|
|
163
163
|
SELECT ?project ?label
|
|
164
164
|
WHERE {
|
|
165
|
-
?project ${
|
|
166
|
-
?project ${
|
|
167
|
-
?project ${
|
|
165
|
+
?project ${M.PREDICATES.INSTANCE_CLASS} "[[${M.ASSET_CLASSES.PROJECT}]]" .
|
|
166
|
+
?project ${M.PREDICATES.EFFORT_STATUS} ${M.EFFORT_STATUSES.DOING} .
|
|
167
|
+
?project ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
168
168
|
FILTER NOT EXISTS {
|
|
169
|
-
?task ${
|
|
169
|
+
?task ${M.PREDICATES.EFFORT_PARENT} ?project .
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
ORDER BY ?label`,parameters:[],examples:["\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0431\u0435\u0437 \u0437\u0430\u0434\u0430\u0447","\u043F\u0443\u0441\u0442\u044B\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B","\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u043A\u043E\u0442\u043E\u0440\u044B\u043C \u043D\u0443\u0436\u043D\u044B \u0437\u0430\u0434\u0430\u0447\u0438"],keywords:["\u0431\u0435\u0437 \u0437\u0430\u0434\u0430\u0447","\u043F\u0443\u0441\u0442\u044B\u0435","\u043D\u0435\u0442 \u0437\u0430\u0434\u0430\u0447"]},{name:"recent_activities",description:"Get recent activities ordered by start time",template:`${
|
|
172
|
+
ORDER BY ?label`,parameters:[],examples:["\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0431\u0435\u0437 \u0437\u0430\u0434\u0430\u0447","\u043F\u0443\u0441\u0442\u044B\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B","\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u043A\u043E\u0442\u043E\u0440\u044B\u043C \u043D\u0443\u0436\u043D\u044B \u0437\u0430\u0434\u0430\u0447\u0438"],keywords:["\u0431\u0435\u0437 \u0437\u0430\u0434\u0430\u0447","\u043F\u0443\u0441\u0442\u044B\u0435","\u043D\u0435\u0442 \u0437\u0430\u0434\u0430\u0447"]},{name:"recent_activities",description:"Get recent activities ordered by start time",template:`${M.SPARQL_PREFIXES}
|
|
173
173
|
|
|
174
174
|
SELECT ?label ?start ?end
|
|
175
175
|
WHERE {
|
|
176
|
-
?s ${
|
|
177
|
-
?s ${
|
|
178
|
-
?s ${
|
|
176
|
+
?s ${M.PREDICATES.EFFORT_START_TIMESTAMP} ?start .
|
|
177
|
+
?s ${M.PREDICATES.EFFORT_END_TIMESTAMP} ?end .
|
|
178
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
179
179
|
}
|
|
180
180
|
ORDER BY DESC(?start)
|
|
181
|
-
LIMIT {{limit}}`,parameters:[{name:"limit",description:"Maximum number of results",required:!1,example:"50"}],examples:["\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438","\u0447\u0442\u043E \u0434\u0435\u043B\u0430\u043B \u043D\u0435\u0434\u0430\u0432\u043D\u043E","\u043D\u0435\u0434\u0430\u0432\u043D\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438","\u0438\u0441\u0442\u043E\u0440\u0438\u044F \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0435\u0439"],keywords:["\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435","\u043D\u0435\u0434\u0430\u0432\u043D\u0438\u0435","recent","\u0438\u0441\u0442\u043E\u0440\u0438\u044F","\u043D\u0435\u0434\u0430\u0432\u043D\u043E"]},{name:"tasks_by_label_pattern",description:"Find tasks matching a specific label pattern",template:`${
|
|
181
|
+
LIMIT {{limit}}`,parameters:[{name:"limit",description:"Maximum number of results",required:!1,example:"50"}],examples:["\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438","\u0447\u0442\u043E \u0434\u0435\u043B\u0430\u043B \u043D\u0435\u0434\u0430\u0432\u043D\u043E","\u043D\u0435\u0434\u0430\u0432\u043D\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438","\u0438\u0441\u0442\u043E\u0440\u0438\u044F \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0435\u0439"],keywords:["\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435","\u043D\u0435\u0434\u0430\u0432\u043D\u0438\u0435","recent","\u0438\u0441\u0442\u043E\u0440\u0438\u044F","\u043D\u0435\u0434\u0430\u0432\u043D\u043E"]},{name:"tasks_by_label_pattern",description:"Find tasks matching a specific label pattern",template:`${M.SPARQL_PREFIXES}
|
|
182
182
|
|
|
183
183
|
SELECT ?label ?start ?end
|
|
184
184
|
WHERE {
|
|
185
|
-
?s ${
|
|
185
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
186
186
|
FILTER(CONTAINS(?label, "{{pattern}}"))
|
|
187
|
-
?s ${
|
|
188
|
-
?s ${
|
|
187
|
+
?s ${M.PREDICATES.EFFORT_START_TIMESTAMP} ?start .
|
|
188
|
+
?s ${M.PREDICATES.EFFORT_END_TIMESTAMP} ?end .
|
|
189
189
|
}
|
|
190
|
-
ORDER BY ?start`,parameters:[{name:"pattern",description:"Pattern to match in task labels",required:!0,example:"\u0439\u043E\u0433\u0430"}],examples:["\u0432\u0441\u0435 \u0437\u0430\u043D\u044F\u0442\u0438\u044F \u0439\u043E\u0433\u043E\u0439","\u0442\u0440\u0435\u043D\u0438\u0440\u043E\u0432\u043A\u0438 \u043F\u0440\u0435\u0441\u0441\u0430","\u043F\u0440\u0430\u043A\u0442\u0438\u043A\u0438 \u041C\u041E\u0427\u0418","\u0432\u0441\u0442\u0440\u0435\u0447\u0438 1-2-1"],keywords:["\u0437\u0430\u043D\u044F\u0442\u0438\u044F","\u0442\u0440\u0435\u043D\u0438\u0440\u043E\u0432\u043A\u0438","\u043F\u0440\u0430\u043A\u0442\u0438\u043A\u0438","\u0432\u0441\u0442\u0440\u0435\u0447\u0438"]},{name:"count_by_class",description:"Count entities by their class type",template:`${
|
|
190
|
+
ORDER BY ?start`,parameters:[{name:"pattern",description:"Pattern to match in task labels",required:!0,example:"\u0439\u043E\u0433\u0430"}],examples:["\u0432\u0441\u0435 \u0437\u0430\u043D\u044F\u0442\u0438\u044F \u0439\u043E\u0433\u043E\u0439","\u0442\u0440\u0435\u043D\u0438\u0440\u043E\u0432\u043A\u0438 \u043F\u0440\u0435\u0441\u0441\u0430","\u043F\u0440\u0430\u043A\u0442\u0438\u043A\u0438 \u041C\u041E\u0427\u0418","\u0432\u0441\u0442\u0440\u0435\u0447\u0438 1-2-1"],keywords:["\u0437\u0430\u043D\u044F\u0442\u0438\u044F","\u0442\u0440\u0435\u043D\u0438\u0440\u043E\u0432\u043A\u0438","\u043F\u0440\u0430\u043A\u0442\u0438\u043A\u0438","\u0432\u0441\u0442\u0440\u0435\u0447\u0438"]},{name:"count_by_class",description:"Count entities by their class type",template:`${M.SPARQL_PREFIXES}
|
|
191
191
|
|
|
192
192
|
SELECT ?class (COUNT(?s) AS ?count)
|
|
193
193
|
WHERE {
|
|
194
|
-
?s ${
|
|
194
|
+
?s ${M.PREDICATES.INSTANCE_CLASS} ?class .
|
|
195
195
|
}
|
|
196
196
|
GROUP BY ?class
|
|
197
197
|
ORDER BY DESC(?count)
|
|
198
|
-
LIMIT {{limit}}`,parameters:[{name:"limit",description:"Maximum number of results",required:!1,example:"20"}],examples:["\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u043A\u0430\u0436\u0434\u043E\u0433\u043E \u0442\u0438\u043F\u0430","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u043F\u043E \u043A\u043B\u0430\u0441\u0441\u0430\u043C","\u0442\u0438\u043F\u044B \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439"],keywords:["\u0441\u043A\u043E\u043B\u044C\u043A\u043E","count","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430","\u0442\u0438\u043F\u044B","\u043A\u043B\u0430\u0441\u0441\u044B"]},{name:"find_prototype",description:"Find prototype URI by task label",template:`${
|
|
198
|
+
LIMIT {{limit}}`,parameters:[{name:"limit",description:"Maximum number of results",required:!1,example:"20"}],examples:["\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u043A\u0430\u0436\u0434\u043E\u0433\u043E \u0442\u0438\u043F\u0430","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u043F\u043E \u043A\u043B\u0430\u0441\u0441\u0430\u043C","\u0442\u0438\u043F\u044B \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439"],keywords:["\u0441\u043A\u043E\u043B\u044C\u043A\u043E","count","\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430","\u0442\u0438\u043F\u044B","\u043A\u043B\u0430\u0441\u0441\u044B"]},{name:"find_prototype",description:"Find prototype URI by task label",template:`${M.SPARQL_PREFIXES}
|
|
199
199
|
|
|
200
200
|
SELECT DISTINCT ?prototype ?label
|
|
201
201
|
WHERE {
|
|
202
|
-
?s ${
|
|
202
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
203
203
|
FILTER(CONTAINS(?label, "{{taskLabel}}"))
|
|
204
|
-
?s ${
|
|
204
|
+
?s ${M.PREDICATES.ASSET_PROTOTYPE} ?prototype .
|
|
205
205
|
}
|
|
206
|
-
LIMIT 5`,parameters:[{name:"taskLabel",description:"Task label to search for",required:!0,example:"\u0423\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448"}],examples:["\u043A\u0430\u043A\u043E\u0439 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F \u0443 \u0437\u0430\u0434\u0430\u0447\u0438 \u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448","\u043D\u0430\u0439\u0434\u0438 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F \u0434\u043B\u044F","UUID \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430"],keywords:["\u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F","prototype","\u0448\u0430\u0431\u043B\u043E\u043D","template"]},{name:"entity_properties",description:"Get all properties of an entity by label",template:`${
|
|
206
|
+
LIMIT 5`,parameters:[{name:"taskLabel",description:"Task label to search for",required:!0,example:"\u0423\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448"}],examples:["\u043A\u0430\u043A\u043E\u0439 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F \u0443 \u0437\u0430\u0434\u0430\u0447\u0438 \u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448","\u043D\u0430\u0439\u0434\u0438 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F \u0434\u043B\u044F","UUID \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430"],keywords:["\u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F","prototype","\u0448\u0430\u0431\u043B\u043E\u043D","template"]},{name:"entity_properties",description:"Get all properties of an entity by label",template:`${M.SPARQL_PREFIXES}
|
|
207
207
|
|
|
208
208
|
SELECT ?p ?o
|
|
209
209
|
WHERE {
|
|
210
|
-
?s ${
|
|
210
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
211
211
|
FILTER(CONTAINS(?label, "{{entityLabel}}"))
|
|
212
212
|
?s ?p ?o .
|
|
213
|
-
}`,parameters:[{name:"entityLabel",description:"Entity label to search for",required:!0,example:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C 2025-11-30"}],examples:["\u0432\u0441\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447\u0438","\u043F\u043E\u043A\u0430\u0436\u0438 \u0434\u0435\u0442\u0430\u043B\u0438 \u0437\u0430\u043F\u0438\u0441\u0438","\u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E"],keywords:["\u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430","properties","\u0434\u0435\u0442\u0430\u043B\u0438","\u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F"]},{name:"properties_by_uuid",description:"Get all properties of an entity by UUID",template:`${
|
|
213
|
+
}`,parameters:[{name:"entityLabel",description:"Entity label to search for",required:!0,example:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C 2025-11-30"}],examples:["\u0432\u0441\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447\u0438","\u043F\u043E\u043A\u0430\u0436\u0438 \u0434\u0435\u0442\u0430\u043B\u0438 \u0437\u0430\u043F\u0438\u0441\u0438","\u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E"],keywords:["\u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430","properties","\u0434\u0435\u0442\u0430\u043B\u0438","\u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F"]},{name:"properties_by_uuid",description:"Get all properties of an entity by UUID",template:`${M.SPARQL_PREFIXES}
|
|
214
214
|
|
|
215
215
|
SELECT ?p ?o
|
|
216
216
|
WHERE {
|
|
217
217
|
?s ?p ?o .
|
|
218
218
|
FILTER(CONTAINS(STR(?s), "{{uuid}}"))
|
|
219
|
-
}`,parameters:[{name:"uuid",description:"UUID of the entity",required:!0,example:"2d369bb0-159f-4639-911d-ec2c585e8d00"}],examples:["\u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u043F\u043E UUID","\u043F\u043E\u043A\u0430\u0436\u0438 \u0437\u0430\u043F\u0438\u0441\u044C \u0441 UUID"],keywords:["UUID","uid"]},{name:"find_by_class_and_keyword",description:"Find entities of a specific ontology class matching a keyword pattern",template:`${
|
|
219
|
+
}`,parameters:[{name:"uuid",description:"UUID of the entity",required:!0,example:"2d369bb0-159f-4639-911d-ec2c585e8d00"}],examples:["\u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u043F\u043E UUID","\u043F\u043E\u043A\u0430\u0436\u0438 \u0437\u0430\u043F\u0438\u0441\u044C \u0441 UUID"],keywords:["UUID","uid"]},{name:"find_by_class_and_keyword",description:"Find entities of a specific ontology class matching a keyword pattern",template:`${M.SPARQL_PREFIXES}
|
|
220
220
|
|
|
221
221
|
SELECT ?uid ?label WHERE {
|
|
222
|
-
?s ${
|
|
222
|
+
?s ${M.PREDICATES.INSTANCE_CLASS} ?class .
|
|
223
223
|
FILTER(CONTAINS(STR(?class), "{{classMatch}}"))
|
|
224
|
-
?s ${
|
|
225
|
-
?s ${
|
|
224
|
+
?s ${M.PREDICATES.ASSET_UID} ?uid .
|
|
225
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
226
226
|
FILTER(REGEX(?label, "{{regexPattern}}", "i"))
|
|
227
227
|
FILTER NOT EXISTS { ?s exo:Asset_deprecatedBy ?newer }
|
|
228
228
|
}
|
|
229
229
|
ORDER BY ?label
|
|
230
|
-
LIMIT {{limit}}`,parameters:[{name:"classMatch",description:"Class identifier to match (UUID or IRI fragment)",required:!0,example:"dda12c48-6886-4624-8710-ed4ba92ce2b3"},{name:"regexPattern",description:"REGEX pattern to match in labels (supports | for OR)",required:!0,example:"agent|sandbox"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u043D\u0430\u0439\u0434\u0438 \u0432\u0441\u0435 \u043A\u043E\u043D\u0446\u0435\u043F\u0442\u044B \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0441 agent \u0438\u043B\u0438 sandbox","\u043A\u043E\u043D\u0446\u0435\u043F\u0442\u044B \u043F\u0440\u043E \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435","\u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 review","\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0441\u043E \u0441\u043B\u043E\u0432\u043E\u043C migration"],keywords:[]},{name:"find_by_class",description:"List all entities of a specific ontology class",template:`${
|
|
230
|
+
LIMIT {{limit}}`,parameters:[{name:"classMatch",description:"Class identifier to match (UUID or IRI fragment)",required:!0,example:"dda12c48-6886-4624-8710-ed4ba92ce2b3"},{name:"regexPattern",description:"REGEX pattern to match in labels (supports | for OR)",required:!0,example:"agent|sandbox"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u043D\u0430\u0439\u0434\u0438 \u0432\u0441\u0435 \u043A\u043E\u043D\u0446\u0435\u043F\u0442\u044B \u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0441 agent \u0438\u043B\u0438 sandbox","\u043A\u043E\u043D\u0446\u0435\u043F\u0442\u044B \u043F\u0440\u043E \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435","\u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 review","\u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0441\u043E \u0441\u043B\u043E\u0432\u043E\u043C migration"],keywords:[]},{name:"find_by_class",description:"List all entities of a specific ontology class",template:`${M.SPARQL_PREFIXES}
|
|
231
231
|
|
|
232
232
|
SELECT ?uid ?label WHERE {
|
|
233
|
-
?s ${
|
|
233
|
+
?s ${M.PREDICATES.INSTANCE_CLASS} ?class .
|
|
234
234
|
FILTER(CONTAINS(STR(?class), "{{classMatch}}"))
|
|
235
|
-
?s ${
|
|
236
|
-
?s ${
|
|
235
|
+
?s ${M.PREDICATES.ASSET_UID} ?uid .
|
|
236
|
+
?s ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
237
237
|
FILTER NOT EXISTS { ?s exo:Asset_deprecatedBy ?newer }
|
|
238
238
|
}
|
|
239
239
|
ORDER BY ?label
|
|
240
|
-
LIMIT {{limit}}`,parameters:[{name:"classMatch",description:"Class identifier to match (UUID or IRI fragment)",required:!0,example:"dda12c48-6886-4624-8710-ed4ba92ce2b3"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u0432\u0441\u0435 \u043A\u043E\u043D\u0446\u0435\u043F\u0442\u044B","\u043F\u043E\u043A\u0430\u0436\u0438 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438","\u0441\u043F\u0438\u0441\u043E\u043A \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432","\u0432\u0441\u0435 \u043A\u043E\u043D\u0441\u043F\u0435\u043A\u0442\u044B"],keywords:[]},{name:"areas",description:"List all areas in the knowledge base",template:`${
|
|
240
|
+
LIMIT {{limit}}`,parameters:[{name:"classMatch",description:"Class identifier to match (UUID or IRI fragment)",required:!0,example:"dda12c48-6886-4624-8710-ed4ba92ce2b3"},{name:"limit",description:"Maximum number of results",required:!1,example:"100"}],examples:["\u0432\u0441\u0435 \u043A\u043E\u043D\u0446\u0435\u043F\u0442\u044B","\u043F\u043E\u043A\u0430\u0436\u0438 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438","\u0441\u043F\u0438\u0441\u043E\u043A \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432","\u0432\u0441\u0435 \u043A\u043E\u043D\u0441\u043F\u0435\u043A\u0442\u044B"],keywords:[]},{name:"areas",description:"List all areas in the knowledge base",template:`${M.SPARQL_PREFIXES}
|
|
241
241
|
|
|
242
242
|
SELECT ?area ?label
|
|
243
243
|
WHERE {
|
|
244
|
-
?area ${
|
|
245
|
-
?area ${
|
|
244
|
+
?area ${M.PREDICATES.INSTANCE_CLASS} "[[${M.ASSET_CLASSES.AREA}]]" .
|
|
245
|
+
?area ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
246
246
|
}
|
|
247
|
-
ORDER BY ?label`,parameters:[],examples:["\u0432\u0441\u0435 \u043E\u0431\u043B\u0430\u0441\u0442\u0438","\u043E\u0431\u043B\u0430\u0441\u0442\u0438 \u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u0438","areas"],keywords:["\u043E\u0431\u043B\u0430\u0441\u0442\u0438","areas","area"]},{name:"persons",description:"List all persons in the knowledge base",template:`${
|
|
247
|
+
ORDER BY ?label`,parameters:[],examples:["\u0432\u0441\u0435 \u043E\u0431\u043B\u0430\u0441\u0442\u0438","\u043E\u0431\u043B\u0430\u0441\u0442\u0438 \u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0441\u0442\u0438","areas"],keywords:["\u043E\u0431\u043B\u0430\u0441\u0442\u0438","areas","area"]},{name:"persons",description:"List all persons in the knowledge base",template:`${M.SPARQL_PREFIXES}
|
|
248
248
|
|
|
249
249
|
SELECT ?person ?label
|
|
250
250
|
WHERE {
|
|
251
|
-
?person ${
|
|
252
|
-
?person ${
|
|
251
|
+
?person ${M.PREDICATES.INSTANCE_CLASS} "[[${M.ASSET_CLASSES.PERSON}]]" .
|
|
252
|
+
?person ${M.PREDICATES.ASSET_LABEL} ?label .
|
|
253
253
|
}
|
|
254
|
-
ORDER BY ?label`,parameters:[],examples:["\u0432\u0441\u0435 \u043B\u044E\u0434\u0438","\u043A\u043E\u043D\u0442\u0430\u043A\u0442\u044B","persons"],keywords:["\u043B\u044E\u0434\u0438","\u043A\u043E\u043D\u0442\u0430\u043A\u0442\u044B","\u043F\u0435\u0440\u0441\u043E\u043D","\u043F\u0435\u0440\u0441\u043E\u043D\u044B","\u043F\u0435\u0440\u0441\u043E\u043D\u0430","persons","person"]}];function R4(n){return k.SPARQL_TEMPLATES.find(e=>e.name===n)}o(R4,"getTemplateByName");function F4(n,e=3){let t=n.toLowerCase(),r=new Map;for(let i of k.SPARQL_TEMPLATES){let s=0;for(let a of i.keywords)t.includes(a.toLowerCase())&&(s+=2);for(let a of i.examples){let c=a.toLowerCase().split(/\s+/),l=t.split(/\s+/),u=c.filter(f=>l.some(h=>h.includes(f)||f.includes(h)));s+=u.length*.5}s>0&&r.set(i,s)}return Array.from(r.entries()).sort((i,s)=>s[1]-i[1]).slice(0,e).map(([i])=>i)}o(F4,"findMatchingTemplates");function D4(n,e){let t=n.template;for(let r of n.parameters)!r.required&&!e[r.name]&&r.name==="limit"&&(e[r.name]="100");for(let[r,i]of Object.entries(e))t=t.replace(new RegExp(`\\{\\{${r}\\}\\}`,"g"),i);return t}o(D4,"fillTemplate");function N4(n,e){let t=[];for(let r of n.parameters)r.required&&!e[r.name]&&t.push(r.name);return{valid:t.length===0,missing:t}}o(N4,"validateParameters")});var PS=v(Sn=>{"use strict";var L4=Sn&&Sn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},k4=Sn&&Sn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.NLToSPARQLService=Sn.DEFAULT_NL_TO_SPARQL_CONFIG=void 0;var M4=Ve(),j4=la(),ut=I0();Sn.DEFAULT_NL_TO_SPARQL_CONFIG={defaultLimit:100,includeExplanation:!0,confidenceThreshold:.3};var O0=class{static{o(this,"NLToSPARQLService")}constructor(e={}){this.uuidPattern=/\b([0-9a-f]{8}[-]?[0-9a-f]{4}[-]?[0-9a-f]{4}[-]?[0-9a-f]{4}[-]?[0-9a-f]{12})\b/i,this.datePattern=/\b(20\d{2}[-]?\d{2}(?:[-]?\d{2})?)\b/,this.monthNames={\u044F\u043D\u0432\u0430\u0440:"01",\u0444\u0435\u0432\u0440\u0430\u043B:"02",\u043C\u0430\u0440\u0442:"03",\u0430\u043F\u0440\u0435\u043B:"04",\u043C\u0430\u0439:"05",\u0438\u044E\u043D:"06",\u0438\u044E\u043B:"07",\u0430\u0432\u0433\u0443\u0441\u0442:"08",\u0441\u0435\u043D\u0442\u044F\u0431\u0440:"09",\u043E\u043A\u0442\u044F\u0431\u0440:"10",\u043D\u043E\u044F\u0431\u0440:"11",\u0434\u0435\u043A\u0430\u0431\u0440:"12",january:"01",february:"02",march:"03",april:"04",may:"05",june:"06",july:"07",august:"08",september:"09",october:"10",november:"11",december:"12"},this.activityPatterns={\u0434\u0443\u0448:"\u0434\u0443\u0448","morning shower":"\u0434\u0443\u0448","\u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448":"\u0434\u0443\u0448",\u0441\u043E\u043D:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",\u0441\u043F\u0430\u0442\u044C:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",\u043F\u043E\u0441\u043F\u0430\u0442\u044C:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",sleep:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",\u0439\u043E\u0433\u0430:"\u0439\u043E\u0433",yoga:"\u0439\u043E\u0433",\u043F\u0440\u0435\u0441\u0441:"\u041F\u0440\u0435\u0441\u0441","wim hof":"Wim Hof",\u043C\u043E\u0447\u0438:"\u041C\u041E\u0427\u0418"},this.prototypeMapping={\u0434\u0443\u0448:ut.KNOWN_PROTOTYPES.MORNING_SHOWER,"\u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448":ut.KNOWN_PROTOTYPES.MORNING_SHOWER,"morning shower":ut.KNOWN_PROTOTYPES.MORNING_SHOWER,\u043D\u043E\u0433\u0442\u0438:ut.KNOWN_PROTOTYPES.CUT_NAILS,"\u043F\u043E\u0434\u0441\u0442\u0440\u0438\u0447\u044C \u043D\u043E\u0433\u0442\u0438":ut.KNOWN_PROTOTYPES.CUT_NAILS},this.config={...Sn.DEFAULT_NL_TO_SPARQL_CONFIG,...e}}convert(e){let t=e.trim().toLowerCase(),r=t.match(this.uuidPattern);if(r)return this.handleUuidQuery(t,r[1]);let i=(0,ut.findClassByTerm)(t),s=(0,ut.findMatchingTemplates)(t,3),a=new Set(["active_projects","projects_without_tasks","areas","persons","find_prototype","sleep_analysis","recent_activities"]);if(s.length>0){let l=s[0];if(a.has(l.name)){let u=t.split(/\s+/);if(l.keywords.some(h=>u.includes(h.toLowerCase())))return this.buildTemplateResult(t,l,s)}}if(i)return this.handleClassQuery(t,i);if(s.length===0)return this.createFallbackQuery(t);let c=s[0];return this.buildTemplateResult(t,c,s)}buildTemplateResult(e,t,r){let i=this.extractParameters(e,t),s=(0,ut.validateParameters)(t,i);if(!s.valid){for(let f of s.missing){let h=this.inferParameter(e,f,t);h&&(i[f]=h)}let u=(0,ut.validateParameters)(t,i);if(!u.valid){let f=(0,ut.findClassByTerm)(e);return f?this.handleClassQuery(e,f):this.createFallbackQuery(e,{template:t,missingParams:u.missing})}}let a=(0,ut.fillTemplate)(t,i),c=this.calculateConfidence(e,t,i),l=r.slice(1).map(u=>{let f=this.extractParameters(e,u);return(0,ut.fillTemplate)(u,f)}).filter(u=>u!==a);return{query:a,templateName:t.name,parameters:i,confidence:c,explanation:this.generateExplanation(t,i),isFallback:!1,alternatives:l}}handleUuidQuery(e,t){if(e.includes("\u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F")||e.includes("prototype")||e.includes("\u0438\u043D\u0441\u0442\u0430\u043D\u0441")){let s=(0,ut.getTemplateByName)("find_by_prototype_uuid");if(!s)throw new Error("Template find_by_prototype_uuid not found");let a={prototypeUuid:t,limit:"100"};return{query:(0,ut.fillTemplate)(s,a),templateName:s.name,parameters:a,confidence:.9,explanation:`\u041F\u043E\u0438\u0441\u043A \u0438\u043D\u0441\u0442\u0430\u043D\u0441\u043E\u0432 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430 \u0441 UUID ${t}`,isFallback:!1,alternatives:[]}}let r=(0,ut.getTemplateByName)("properties_by_uuid");if(!r)throw new Error("Template properties_by_uuid not found");let i={uuid:t};return{query:(0,ut.fillTemplate)(r,i),templateName:r.name,parameters:i,confidence:.9,explanation:`\u041F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0441 UUID ${t}`,isFallback:!1,alternatives:[]}}handleClassQuery(e,t){let r=this.extractSearchTerms(e,t);if(r.length>0){let a=(0,ut.getTemplateByName)("find_by_class_and_keyword");if(!a)throw new Error("Template find_by_class_and_keyword not found");let c=r.join("|"),l={classMatch:t.match,regexPattern:c,limit:this.extractLimit(e)};return{query:(0,ut.fillTemplate)(a,l),templateName:a.name,parameters:l,confidence:.85,explanation:`\u041F\u043E\u0438\u0441\u043A ${t.label} \u043F\u043E \u043F\u0430\u0442\u0442\u0435\u0440\u043D\u0443 "${c}"`,isFallback:!1,alternatives:[]}}let i=(0,ut.getTemplateByName)("find_by_class");if(!i)throw new Error("Template find_by_class not found");let s={classMatch:t.match,limit:this.extractLimit(e)};return{query:(0,ut.fillTemplate)(i,s),templateName:i.name,parameters:s,confidence:.8,explanation:`\u0421\u043F\u0438\u0441\u043E\u043A \u0432\u0441\u0435\u0445 ${t.label}`,isFallback:!1,alternatives:[]}}extractSearchTerms(e,t){let r=e.toLowerCase().split(/\s+/),i=new Set([...t.terms,"\u0432\u0441\u0435","\u0432\u0441\u0435\u0445","\u0432\u0441\u044E","\u0432\u0435\u0441\u044C","\u043D\u0430\u0439\u0434\u0438","\u043D\u0430\u0439\u0442\u0438","\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0436\u0435\u0448\u044C","\u0441\u043F\u0438\u0441\u043E\u043A","\u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435","\u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0445","\u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0439","\u043F\u0440\u043E","\u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435","\u0441\u043E","\u0441\u043B\u043E\u0432\u043E\u043C","\u0438\u043B\u0438","\u0438","and","or","\u0441","\u043D\u0430","\u043F\u043E","\u0434\u043B\u044F","\u0432","\u0437\u0430","\u043E\u0442","\u043A","\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435","\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0445","\u043C\u043E\u0438","\u043C\u043E\u0438\u0445","\u043C\u043E\u0439","\u043C\u043E\u044F","\u043A\u0430\u043A\u0438\u0435","\u043A\u0430\u043A\u043E\u0439","\u043A\u0430\u043A\u0430\u044F","\u043A\u0430\u043A\u043E\u0433\u043E","\u0447\u0442\u043E","\u0433\u0434\u0435","\u043A\u0430\u043A","\u043A\u0442\u043E"]);return r.filter(a=>a.length>=2&&!i.has(a)&&!/^\d+$/.test(a))}extractParameters(e,t){let r={};for(let i of t.parameters)switch(i.name){case"keyword":case"pattern":case"taskLabel":case"entityLabel":r[i.name]=this.extractKeyword(e,t);break;case"prototypeUuid":r[i.name]=this.extractPrototypeUuid(e);break;case"yearMonth":r[i.name]=this.extractYearMonth(e);break;case"limit":r[i.name]=this.extractLimit(e);break;case"uuid":{let s=e.match(this.uuidPattern);s&&(r[i.name]=s[1]);break}}return r}extractKeyword(e,t){for(let[a,c]of Object.entries(this.activityPatterns))if(e.includes(a))return c;let r=e.match(/["'«»]([^"'«»]+)["'«»]/);if(r)return r[1];let i=e.replace(/^(найди|найти|покажи|покажешь|какие|какой|сколько|где|как|что|все|всех|мои|моих|за|в|по|для|который|которые)\s+/gi,"").replace(/\s+(за|в|по|для|с|на|от)\s+\d+.*$/gi,"").trim(),s=i.split(/\s+/);return s.length>0?s.slice(0,2).join(" "):i||e}extractPrototypeUuid(e){let t=e.match(this.uuidPattern);if(t)return t[1];for(let[r,i]of Object.entries(this.prototypeMapping))if(e.includes(r))return i;return""}extractYearMonth(e){let t=e.match(this.datePattern);if(t)return t[1].replace(/(\d{4})(\d{2})/,"$1-$2");for(let[r,i]of Object.entries(this.monthNames))if(e.includes(r)){let s=e.match(/\b(20\d{2})\b/);return`${s?s[1]:new Date().getFullYear()}-${i}`}return""}extractLimit(e){let t=e.match(/(?:первые|последние|топ|limit|лимит)\s*(\d+)/i);if(t)return t[1];let r=e.match(/\b(\d{1,3})\b/);return r&&parseInt(r[1])<=500?r[1]:String(this.config.defaultLimit)}inferParameter(e,t,r){switch(t){case"prototypeUuid":for(let[i,s]of Object.entries(this.prototypeMapping))if(e.includes(i))return s;break;case"keyword":case"pattern":for(let[i,s]of Object.entries(this.activityPatterns))if(e.includes(i))return s;break}return null}createFallbackQuery(e,t){let r=this.extractKeyword(e,ut.SPARQL_TEMPLATES[0]),i=`${ut.SPARQL_PREFIXES}
|
|
254
|
+
ORDER BY ?label`,parameters:[],examples:["\u0432\u0441\u0435 \u043B\u044E\u0434\u0438","\u043A\u043E\u043D\u0442\u0430\u043A\u0442\u044B","persons"],keywords:["\u043B\u044E\u0434\u0438","\u043A\u043E\u043D\u0442\u0430\u043A\u0442\u044B","\u043F\u0435\u0440\u0441\u043E\u043D","\u043F\u0435\u0440\u0441\u043E\u043D\u044B","\u043F\u0435\u0440\u0441\u043E\u043D\u0430","persons","person"]}];function R4(n){return M.SPARQL_TEMPLATES.find(e=>e.name===n)}o(R4,"getTemplateByName");function F4(n,e=3){let t=n.toLowerCase(),r=new Map;for(let i of M.SPARQL_TEMPLATES){let s=0;for(let a of i.keywords)t.includes(a.toLowerCase())&&(s+=2);for(let a of i.examples){let c=a.toLowerCase().split(/\s+/),l=t.split(/\s+/),u=c.filter(f=>l.some(h=>h.includes(f)||f.includes(h)));s+=u.length*.5}s>0&&r.set(i,s)}return Array.from(r.entries()).sort((i,s)=>s[1]-i[1]).slice(0,e).map(([i])=>i)}o(F4,"findMatchingTemplates");function D4(n,e){let t=n.template;for(let r of n.parameters)!r.required&&!e[r.name]&&r.name==="limit"&&(e[r.name]="100");for(let[r,i]of Object.entries(e))t=t.replace(new RegExp(`\\{\\{${r}\\}\\}`,"g"),i);return t}o(D4,"fillTemplate");function N4(n,e){let t=[];for(let r of n.parameters)r.required&&!e[r.name]&&t.push(r.name);return{valid:t.length===0,missing:t}}o(N4,"validateParameters")});var PS=v(Sn=>{"use strict";var L4=Sn&&Sn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},k4=Sn&&Sn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.NLToSPARQLService=Sn.DEFAULT_NL_TO_SPARQL_CONFIG=void 0;var M4=Ve(),j4=la(),ut=I0();Sn.DEFAULT_NL_TO_SPARQL_CONFIG={defaultLimit:100,includeExplanation:!0,confidenceThreshold:.3};var O0=class{static{o(this,"NLToSPARQLService")}constructor(e={}){this.uuidPattern=/\b([0-9a-f]{8}[-]?[0-9a-f]{4}[-]?[0-9a-f]{4}[-]?[0-9a-f]{4}[-]?[0-9a-f]{12})\b/i,this.datePattern=/\b(20\d{2}[-]?\d{2}(?:[-]?\d{2})?)\b/,this.monthNames={\u044F\u043D\u0432\u0430\u0440:"01",\u0444\u0435\u0432\u0440\u0430\u043B:"02",\u043C\u0430\u0440\u0442:"03",\u0430\u043F\u0440\u0435\u043B:"04",\u043C\u0430\u0439:"05",\u0438\u044E\u043D:"06",\u0438\u044E\u043B:"07",\u0430\u0432\u0433\u0443\u0441\u0442:"08",\u0441\u0435\u043D\u0442\u044F\u0431\u0440:"09",\u043E\u043A\u0442\u044F\u0431\u0440:"10",\u043D\u043E\u044F\u0431\u0440:"11",\u0434\u0435\u043A\u0430\u0431\u0440:"12",january:"01",february:"02",march:"03",april:"04",may:"05",june:"06",july:"07",august:"08",september:"09",october:"10",november:"11",december:"12"},this.activityPatterns={\u0434\u0443\u0448:"\u0434\u0443\u0448","morning shower":"\u0434\u0443\u0448","\u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448":"\u0434\u0443\u0448",\u0441\u043E\u043D:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",\u0441\u043F\u0430\u0442\u044C:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",\u043F\u043E\u0441\u043F\u0430\u0442\u044C:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",sleep:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C",\u0439\u043E\u0433\u0430:"\u0439\u043E\u0433",yoga:"\u0439\u043E\u0433",\u043F\u0440\u0435\u0441\u0441:"\u041F\u0440\u0435\u0441\u0441","wim hof":"Wim Hof",\u043C\u043E\u0447\u0438:"\u041C\u041E\u0427\u0418"},this.prototypeMapping={\u0434\u0443\u0448:ut.KNOWN_PROTOTYPES.MORNING_SHOWER,"\u0443\u0442\u0440\u0435\u043D\u043D\u0438\u0439 \u0434\u0443\u0448":ut.KNOWN_PROTOTYPES.MORNING_SHOWER,"morning shower":ut.KNOWN_PROTOTYPES.MORNING_SHOWER,\u043D\u043E\u0433\u0442\u0438:ut.KNOWN_PROTOTYPES.CUT_NAILS,"\u043F\u043E\u0434\u0441\u0442\u0440\u0438\u0447\u044C \u043D\u043E\u0433\u0442\u0438":ut.KNOWN_PROTOTYPES.CUT_NAILS},this.config={...Sn.DEFAULT_NL_TO_SPARQL_CONFIG,...e}}convert(e){let t=e.trim().toLowerCase(),r=t.match(this.uuidPattern);if(r)return this.handleUuidQuery(t,r[1]);let i=(0,ut.findClassByTerm)(t),s=(0,ut.findMatchingTemplates)(t,3),a=new Set(["active_projects","projects_without_tasks","areas","persons","find_prototype","sleep_analysis","recent_activities"]);if(s.length>0){let l=s[0];if(a.has(l.name)){let u=t.split(/\s+/);if(l.keywords.some(h=>u.includes(h.toLowerCase())))return this.buildTemplateResult(t,l,s)}}if(i)return this.handleClassQuery(t,i);if(s.length===0)return this.createFallbackQuery(t);let c=s[0];return this.buildTemplateResult(t,c,s)}buildTemplateResult(e,t,r){let i=this.extractParameters(e,t),s=(0,ut.validateParameters)(t,i);if(!s.valid){for(let f of s.missing){let h=this.inferParameter(e,f,t);h&&(i[f]=h)}let u=(0,ut.validateParameters)(t,i);if(!u.valid){let f=(0,ut.findClassByTerm)(e);return f?this.handleClassQuery(e,f):this.createFallbackQuery(e,{template:t,missingParams:u.missing})}}let a=(0,ut.fillTemplate)(t,i),c=this.calculateConfidence(e,t,i),l=r.slice(1).map(u=>{let f=this.extractParameters(e,u);return(0,ut.fillTemplate)(u,f)}).filter(u=>u!==a);return{query:a,templateName:t.name,parameters:i,confidence:c,explanation:this.generateExplanation(t,i),isFallback:!1,alternatives:l}}handleUuidQuery(e,t){if(e.includes("\u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F")||e.includes("prototype")||e.includes("\u0438\u043D\u0441\u0442\u0430\u043D\u0441")){let s=(0,ut.getTemplateByName)("find_by_prototype_uuid");if(!s)throw new Error("Template find_by_prototype_uuid not found");let a={prototypeUuid:t,limit:"100"};return{query:(0,ut.fillTemplate)(s,a),templateName:s.name,parameters:a,confidence:.9,explanation:`\u041F\u043E\u0438\u0441\u043A \u0438\u043D\u0441\u0442\u0430\u043D\u0441\u043E\u0432 \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430 \u0441 UUID ${t}`,isFallback:!1,alternatives:[]}}let r=(0,ut.getTemplateByName)("properties_by_uuid");if(!r)throw new Error("Template properties_by_uuid not found");let i={uuid:t};return{query:(0,ut.fillTemplate)(r,i),templateName:r.name,parameters:i,confidence:.9,explanation:`\u041F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0441 UUID ${t}`,isFallback:!1,alternatives:[]}}handleClassQuery(e,t){let r=this.extractSearchTerms(e,t);if(r.length>0){let a=(0,ut.getTemplateByName)("find_by_class_and_keyword");if(!a)throw new Error("Template find_by_class_and_keyword not found");let c=r.join("|"),l={classMatch:t.match,regexPattern:c,limit:this.extractLimit(e)};return{query:(0,ut.fillTemplate)(a,l),templateName:a.name,parameters:l,confidence:.85,explanation:`\u041F\u043E\u0438\u0441\u043A ${t.label} \u043F\u043E \u043F\u0430\u0442\u0442\u0435\u0440\u043D\u0443 "${c}"`,isFallback:!1,alternatives:[]}}let i=(0,ut.getTemplateByName)("find_by_class");if(!i)throw new Error("Template find_by_class not found");let s={classMatch:t.match,limit:this.extractLimit(e)};return{query:(0,ut.fillTemplate)(i,s),templateName:i.name,parameters:s,confidence:.8,explanation:`\u0421\u043F\u0438\u0441\u043E\u043A \u0432\u0441\u0435\u0445 ${t.label}`,isFallback:!1,alternatives:[]}}extractSearchTerms(e,t){let r=e.toLowerCase().split(/\s+/),i=new Set([...t.terms,"\u0432\u0441\u0435","\u0432\u0441\u0435\u0445","\u0432\u0441\u044E","\u0432\u0435\u0441\u044C","\u043D\u0430\u0439\u0434\u0438","\u043D\u0430\u0439\u0442\u0438","\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0436\u0435\u0448\u044C","\u0441\u043F\u0438\u0441\u043E\u043A","\u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435","\u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0445","\u0441\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0439","\u043F\u0440\u043E","\u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435","\u0441\u043E","\u0441\u043B\u043E\u0432\u043E\u043C","\u0438\u043B\u0438","\u0438","and","or","\u0441","\u043D\u0430","\u043F\u043E","\u0434\u043B\u044F","\u0432","\u0437\u0430","\u043E\u0442","\u043A","\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435","\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0445","\u043C\u043E\u0438","\u043C\u043E\u0438\u0445","\u043C\u043E\u0439","\u043C\u043E\u044F","\u043A\u0430\u043A\u0438\u0435","\u043A\u0430\u043A\u043E\u0439","\u043A\u0430\u043A\u0430\u044F","\u043A\u0430\u043A\u043E\u0433\u043E","\u0447\u0442\u043E","\u0433\u0434\u0435","\u043A\u0430\u043A","\u043A\u0442\u043E"]);return r.filter(a=>a.length>=2&&!i.has(a)&&!/^\d+$/.test(a))}extractParameters(e,t){let r={};for(let i of t.parameters)switch(i.name){case"keyword":case"pattern":case"taskLabel":case"entityLabel":r[i.name]=this.extractKeyword(e,t);break;case"prototypeUuid":r[i.name]=this.extractPrototypeUuid(e);break;case"yearMonth":r[i.name]=this.extractYearMonth(e);break;case"limit":r[i.name]=this.extractLimit(e);break;case"uuid":{let s=e.match(this.uuidPattern);s&&(r[i.name]=s[1]);break}}return r}extractKeyword(e,t){for(let[a,c]of Object.entries(this.activityPatterns))if(e.includes(a))return c;let r=e.match(/["'«»]([^"'«»]+)["'«»]/);if(r)return r[1];let i=e.replace(/^(найди|найти|покажи|покажешь|какие|какой|сколько|где|как|что|все|всех|мои|моих|за|в|по|для|который|которые)\s+/gi,"").replace(/\s+(за|в|по|для|с|на|от)\s+\d+.*$/gi,"").trim(),s=i.split(/\s+/);return s.length>0?s.slice(0,2).join(" "):i||e}extractPrototypeUuid(e){let t=e.match(this.uuidPattern);if(t)return t[1];for(let[r,i]of Object.entries(this.prototypeMapping))if(e.includes(r))return i;return""}extractYearMonth(e){let t=e.match(this.datePattern);if(t)return t[1].replace(/(\d{4})(\d{2})/,"$1-$2");for(let[r,i]of Object.entries(this.monthNames))if(e.includes(r)){let s=e.match(/\b(20\d{2})\b/);return`${s?s[1]:new Date().getFullYear()}-${i}`}return""}extractLimit(e){let t=e.match(/(?:первые|последние|топ|limit|лимит)\s*(\d+)/i);if(t)return t[1];let r=e.match(/\b(\d{1,3})\b/);return r&&parseInt(r[1])<=500?r[1]:String(this.config.defaultLimit)}inferParameter(e,t,r){switch(t){case"prototypeUuid":for(let[i,s]of Object.entries(this.prototypeMapping))if(e.includes(i))return s;break;case"keyword":case"pattern":for(let[i,s]of Object.entries(this.activityPatterns))if(e.includes(i))return s;break}return null}createFallbackQuery(e,t){let r=this.extractKeyword(e,ut.SPARQL_TEMPLATES[0]),i=`${ut.SPARQL_PREFIXES}
|
|
255
255
|
|
|
256
256
|
SELECT ?s ?label ?class WHERE {
|
|
257
257
|
?s ${ut.PREDICATES.ASSET_LABEL} ?label .
|
|
@@ -261,13 +261,13 @@ SELECT ?s ?label ?class WHERE {
|
|
|
261
261
|
}
|
|
262
262
|
ORDER BY ?label
|
|
263
263
|
LIMIT ${this.config.defaultLimit}`,s="\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0442\u043E\u0447\u043D\u043E \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0438\u0442\u044C \u0442\u0438\u043F \u0437\u0430\u043F\u0440\u043E\u0441\u0430. \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F \u043F\u043E\u0438\u0441\u043A \u043F\u043E \u043A\u043B\u044E\u0447\u0435\u0432\u043E\u043C\u0443 \u0441\u043B\u043E\u0432\u0443.";return t?.template&&t?.missingParams&&(s+=` \u0414\u043B\u044F \u0448\u0430\u0431\u043B\u043E\u043D\u0430 "${t.template.name}" \u043D\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432: ${t.missingParams.join(", ")}.`),{query:i,templateName:null,parameters:{keyword:r},confidence:.3,explanation:s,isFallback:!0,alternatives:[]}}calculateConfidence(e,t,r){let i=.5;for(let c of t.keywords)e.includes(c.toLowerCase())&&(i+=.1);let s=t.parameters.filter(c=>c.required),a=s.filter(c=>r[c.name]&&r[c.name].length>0);s.length>0?i+=a.length/s.length*.2:i+=.2;for(let[c]of Object.entries(this.prototypeMapping))if(e.includes(c)){i+=.1;break}return Math.min(i,1)}generateExplanation(e,t){let r=e.description;return Object.keys(t).length>0&&(r+=". \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: ",r+=Object.entries(t).filter(([,i])=>i&&i.length>0).map(([i,s])=>`${i}="${s}"`).join(", ")),r}getAvailableTemplates(){return[...ut.SPARQL_TEMPLATES]}getTemplate(e){return(0,ut.getTemplateByName)(e)}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}addTemplate(e){ut.SPARQL_TEMPLATES.push(e),j4.LoggingService.debug(`Added custom template: ${e.name}`)}getSuggestions(e){let t=[];return(e.includes("\u0441\u043A\u043E\u043B\u044C\u043A\u043E")||e.includes("\u0441\u0440\u0435\u0434\u043D")||e.includes("\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A"))&&!e.match(/\b20\d{2}\b/)&&!this.containsMonth(e)&&t.push("\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434 \u0432\u0440\u0435\u043C\u0435\u043D\u0438 (\u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: '\u0437\u0430 \u0434\u0435\u043A\u0430\u0431\u0440\u044C' \u0438\u043B\u0438 '\u0437\u0430 2025-12')"),(e.includes("\u0437\u0430\u0434\u0430\u0447")||e.includes("\u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442"))&&t.push("\u0414\u043B\u044F \u0442\u043E\u0447\u043D\u043E\u0433\u043E \u043F\u043E\u0438\u0441\u043A\u0430 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 UUID \u043F\u0440\u043E\u0442\u043E\u0442\u0438\u043F\u0430 \u0432\u043C\u0435\u0441\u0442\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044F"),e.length<10&&t.push("\u0423\u0442\u043E\u0447\u043D\u0438\u0442\u0435 \u0437\u0430\u043F\u0440\u043E\u0441: \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438 \u0438\u043B\u0438 \u0442\u0438\u043F \u0434\u0430\u043D\u043D\u044B\u0445"),t}containsMonth(e){return Object.keys(this.monthNames).some(t=>e.includes(t))}};Sn.NLToSPARQLService=O0;Sn.NLToSPARQLService=O0=L4([(0,M4.injectable)(),k4("design:paramtypes",[Object])],O0)});var FS=v(Zn=>{"use strict";var $4=Zn&&Zn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},V4=Zn&&Zn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},U4=Zn&&Zn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.AnalyticsService=void 0;var RS=Ve(),B4=lt(),q4=nr(),G4=Xi(),P0=class{static{o(this,"AnalyticsService")}constructor(e){this.vault=e,this.frontmatterService=new G4.FrontmatterService}getDefaultPeriod(){let e=new Date,t=new Date;return t.setDate(t.getDate()-30),{startDate:t,endDate:e}}async getEffortsInPeriod(e,t){let i=this.vault.getAllFiles().filter(a=>a.path.endsWith(".md")),s=[];for(let a of i)try{let c=await this.vault.read(a),l=this.extractEffortData(a,c);if(!l)continue;if(l.startTimestamp){if(l.startTimestamp<e.startDate||l.startTimestamp>e.endDate)continue}else continue;if(t?.prototypeUri&&l.prototypeUri!==t.prototypeUri||t?.labelContains&&!l.label.toLowerCase().includes(t.labelContains.toLowerCase())||t?.status&&l.status&&!t.status.includes(l.status))continue;s.push(l)}catch{continue}return s}extractEffortData(e,t){let r=this.frontmatterService.parse(t);if(!r.exists)return null;let i=this.frontmatterService.getPropertyValue(r.content,"exo__Asset_label");if(!i)return null;let s=this.frontmatterService.getPropertyValue(r.content,"ems__Effort_status"),a=this.frontmatterService.getPropertyValue(r.content,"ems__Effort_startTimestamp"),c=this.frontmatterService.getPropertyValue(r.content,"ems__Effort_endTimestamp"),l=this.frontmatterService.getPropertyValue(r.content,"exo__Asset_prototype"),u=this.extractInstanceClass(r.content);return{path:e.path,label:this.cleanWikiLink(i),status:s?this.cleanWikiLink(s):null,startTimestamp:a?this.parseTimestamp(a):null,endTimestamp:c?this.parseTimestamp(c):null,prototypeUri:l?this.cleanWikiLink(l):null,instanceClass:u}}extractInstanceClass(e){let t=e.match(/exo__Instance_class:\s*\n((?:\s*-\s*.*\n?)+)/);if(t)return t[1].split(`
|
|
264
|
-
`).filter(s=>s.trim()).map(s=>this.cleanWikiLink(s.replace(/^\s*-\s*/,"").trim()));let r=this.frontmatterService.getPropertyValue(e,"exo__Instance_class");return r?this.cleanWikiLink(r):null}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}parseTimestamp(e){if(!e)return null;let t=e.replace(/^"/,"").replace(/"$/,""),r=new Date(t);return isNaN(r.getTime())?null:r}calculateDurationStats(e){let t=e.filter(f=>f.startTimestamp&&f.endTimestamp).map(f=>(f.endTimestamp.getTime()-f.startTimestamp.getTime())/6e4).filter(f=>f>0);if(t.length===0)return{count:0,totalMinutes:0,averageMinutes:0,minMinutes:0,maxMinutes:0,stdDevMinutes:0};let r=t.reduce((f,h)=>f+h,0),i=r/t.length,s=Math.min(...t),a=Math.max(...t),l=t.map(f=>Math.pow(f-i,2)).reduce((f,h)=>f+h,0)/t.length,u=Math.sqrt(l);return{count:t.length,totalMinutes:Math.round(r),averageMinutes:Math.round(i*10)/10,minMinutes:Math.round(s),maxMinutes:Math.round(a),stdDevMinutes:Math.round(u*10)/10}}calculateDailyAggregates(e){let t=new Map;for(let r of e){if(!r.startTimestamp)continue;let i=q4.DateFormatter.toDateString(r.startTimestamp);t.has(i)||t.set(i,{count:0,totalMinutes:0});let s=t.get(i);if(s.count++,r.endTimestamp){let a=r.endTimestamp.getTime()-r.startTimestamp.getTime();s.totalMinutes+=a/6e4}}return Array.from(t.entries()).map(([r,i])=>({date:r,count:i.count,totalMinutes:Math.round(i.totalMinutes),averageMinutes:i.count>0?Math.round(i.totalMinutes/i.count*10)/10:0})).sort((r,i)=>r.date.localeCompare(i.date))}calculateHourlyDistribution(e){let t=new Array(24).fill(0);for(let i of e){if(!i.startTimestamp)continue;let s=i.startTimestamp.getHours();t[s]++}let r=t.reduce((i,s)=>i+s,0);return t.map((i,s)=>({hour:s,count:i,percentage:r>0?Math.round(i/r*1e3)/10:0}))}calculateWeekdayDistribution(e){let t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=new Array(7).fill(0);for(let s of e){if(!s.startTimestamp)continue;let a=s.startTimestamp.getDay();r[a]++}let i=r.reduce((s,a)=>s+a,0);return r.map((s,a)=>({dayOfWeek:a,dayName:t[a],count:s,percentage:i>0?Math.round(s/i*1e3)/10:0}))}async analyzeSleep(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e,{labelContains:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C"}),r=this.calculateDurationStats(t),i=this.calculateDailyAggregates(t),s=[],a=[];for(let h of t){if(h.startTimestamp){let d=h.startTimestamp.getHours()*60+h.startTimestamp.getMinutes();s.push(d<360?d+1440:d)}if(h.endTimestamp){let d=h.endTimestamp.getHours()*60+h.endTimestamp.getMinutes();a.push(d)}}let c=s.length>0?s.reduce((h,d)=>h+d,0)/s.length:0,l=a.length>0?a.reduce((h,d)=>h+d,0)/a.length:0,u=s.length>1?Math.sqrt(s.map(h=>Math.pow(h-c,2)).reduce((h,d)=>h+d,0)/s.length):0,f=a.length>1?Math.sqrt(a.map(h=>Math.pow(h-l,2)).reduce((h,d)=>h+d,0)/a.length):0;return{period:e,stats:r,dailyData:i,averageBedtime:this.minutesToTimeString(c%1440),averageWakeTime:this.minutesToTimeString(l),bedtimeVariabilityMinutes:Math.round(u),wakeTimeVariabilityMinutes:Math.round(f)}}minutesToTimeString(e){let t=Math.floor(e/60),r=Math.round(e%60);return`${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")}`}async analyzeTaskCompletion(e=this.getDefaultPeriod()){let r=(await this.getEffortsInPeriod(e)).filter(u=>Array.isArray(u.instanceClass)?u.instanceClass.some(f=>f.includes("ems__Task")):u.instanceClass?.includes("ems__Task")??!1),i=r.filter(u=>u.status?.includes("ems__EffortStatusDone")),s=r.filter(u=>u.status?.includes("ems__EffortStatusTrashed")),a=i.filter(u=>u.startTimestamp&&u.endTimestamp).map(u=>(u.endTimestamp.getTime()-u.startTimestamp.getTime())/6e4),c=a.length>0?a.reduce((u,f)=>u+f,0)/a.length:0,l=this.calculateDailyAggregates(i);return{period:e,totalTasks:r.length,completedTasks:i.length,trashedTasks:s.length,completionRate:r.length>0?Math.round(i.length/r.length*1e3)/10:0,averageCompletionTimeMinutes:Math.round(c*10)/10,dailyCompletions:l}}async analyzeActivityFrequency(e,t=this.getDefaultPeriod()){let r=await this.getEffortsInPeriod(t,{labelContains:e}),i=this.calculateDurationStats(r),s=this.calculateDailyAggregates(r),a=this.calculateHourlyDistribution(r),c=this.calculateWeekdayDistribution(r);return{activityLabel:e,period:t,stats:i,dailyData:s,hourlyDistribution:a,weekdayDistribution:c}}async getActivitySummary(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e),r=new Map;for(let s of t){let a=s.label.split(" ")[0];r.has(a)||r.set(a,[]),r.get(a).push(s)}let i=new Map;for(let[s,a]of r)i.set(s,this.calculateDurationStats(a));return i}};Zn.AnalyticsService=P0;Zn.AnalyticsService=P0=$4([(0,RS.injectable)(),U4(0,(0,RS.inject)(B4.DI_TOKENS.IVaultAdapter)),V4("design:paramtypes",[Object])],P0)});var DS=v(fa=>{"use strict";var W4=fa&&fa.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(fa,"__esModule",{value:!0});fa.TrendDetectionService=void 0;var H4=Ve(),R0=class{static{o(this,"TrendDetectionService")}constructor(){this.TREND_THRESHOLD=.05,this.ANOMALY_THRESHOLD_STD=2,this.STRONG_CORRELATION_THRESHOLD=.7,this.MODERATE_CORRELATION_THRESHOLD=.4}analyzeTrend(e,t="averageMinutes"){if(e.length<3)return{direction:"stable",strength:"none",slope:0,rSquared:0,changePercentage:0,insight:"Insufficient data for trend analysis (need at least 3 data points)"};let r=e.map(d=>d[t]),{slope:i,rSquared:s}=this.linearRegression(r),a=r[0]||1,l=((r[r.length-1]||0)-a)/a*100,u;Math.abs(l)<this.TREND_THRESHOLD*100?u="stable":i>0?u="increasing":u="decreasing";let f;s>=.7?f="strong":s>=.4?f="moderate":s>=.2?f="weak":f="none";let h=this.generateTrendInsight(u,f,l);return{direction:u,strength:f,slope:Math.round(i*100)/100,rSquared:Math.round(s*100)/100,changePercentage:Math.round(l*10)/10,insight:h}}linearRegression(e){let t=e.length;if(t===0)return{slope:0,intercept:0,rSquared:0};let r=(t-1)/2,i=e.reduce((d,p)=>d+p,0)/t,s=0,a=0;for(let d=0;d<t;d++)s+=(d-r)*(e[d]-i),a+=Math.pow(d-r,2);let c=a!==0?s/a:0,l=i-c*r,u=0,f=0;for(let d=0;d<t;d++){let p=l+c*d;u+=Math.pow(e[d]-p,2),f+=Math.pow(e[d]-i,2)}let h=f!==0?1-u/f:0;return{slope:c,intercept:l,rSquared:Math.max(0,h)}}generateTrendInsight(e,t,r){if(t==="none"||e==="stable")return"Metric is relatively stable with no significant trend.";let i=t==="strong"?"clearly":t==="moderate"?"moderately":"slightly",s=e==="increasing"?"increasing":"decreasing",a=`${Math.abs(Math.round(r))}%`;return`Metric is ${i} ${s} (${a} change over the period).`}detectAnomalies(e,t="averageMinutes"){if(e.length<5)return[];let r=e.map(c=>c[t]),{mean:i,stdDev:s}=this.calculateStats(r),a=[];for(let c=0;c<e.length;c++){let l=r[c],u=(l-i)/(s||1);if(Math.abs(u)>=this.ANOMALY_THRESHOLD_STD){let f=this.determineAnomalySeverity(u),h=this.determineAnomalyType(u,l,i);a.push({date:e[c].date,value:l,expectedValue:Math.round(i*10)/10,deviation:Math.round(u*100)/100,severity:f,type:h,description:this.generateAnomalyDescription(h,f,u,l,i)})}}return a}calculateStats(e){if(e.length===0)return{mean:0,stdDev:0};let t=e.reduce((a,c)=>a+c,0)/e.length,i=e.map(a=>Math.pow(a-t,2)).reduce((a,c)=>a+c,0)/e.length,s=Math.sqrt(i);return{mean:t,stdDev:s}}determineAnomalySeverity(e){let t=Math.abs(e);return t>=3?"critical":t>=2.5?"warning":"info"}determineAnomalyType(e,t,r){return t>r&&e>0?"spike":t<r&&e<0?"drop":"outlier"}generateAnomalyDescription(e,t,r,i,s){let a=t==="critical"?"Significant":t==="warning"?"Notable":"Minor",c=e==="spike"?"spike":e==="drop"?"drop":"unusual value",l=Math.round((i-s)/s*100);return`${a} ${c} detected: ${Math.round(i)} (${l>0?"+":""}${l}% from average of ${Math.round(s)}, ${r.toFixed(1)}\u03C3 from mean).`}calculateCorrelation(e,t,r,i){let s=Math.min(e.length,t.length);if(s<5)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"Insufficient data for correlation analysis."};let{mean:a,stdDev:c}=this.calculateStats(e.slice(0,s)),{mean:l,stdDev:u}=this.calculateStats(t.slice(0,s));if(c===0||u===0)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"One or both metrics have no variation."};let f=0;for(let E=0;E<s;E++)f+=(e[E]-a)/c*((t[E]-l)/u);let h=f/s,d=Math.abs(h),p;d>=this.STRONG_CORRELATION_THRESHOLD?p="strong":d>=this.MODERATE_CORRELATION_THRESHOLD?p="moderate":d>=.2?p="weak":p="none";let _=p==="none"?"none":h>0?"positive":"negative",b=this.generateCorrelationInsight(r,i,h,p,_);return{metric1:r,metric2:i,coefficient:Math.round(h*100)/100,strength:p,direction:_,insight:b}}generateCorrelationInsight(e,t,r,i,s){if(i==="none")return`No significant correlation found between ${e} and ${t}.`;let a=i==="strong"?"strongly":i==="moderate"?"moderately":"weakly",c=s==="positive"?"When one increases, the other tends to increase":"When one increases, the other tends to decrease";return`${e} and ${t} are ${a} ${s}ly correlated (r=${r.toFixed(2)}). ${c}.`}analyzeWeeklyPattern(e,t="averageMinutes"){let r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i={};for(let l of e){let f=new Date(l.date).getDay();i[f]||(i[f]=[]),i[f].push(l[t])}let s=[],a=0,c=1/0;for(let l=0;l<7;l++){let u=i[l]||[],{mean:f,stdDev:h}=this.calculateStats(u);f>a&&(a=f),f<c&&u.length>0&&(c=f),s.push({dayOfWeek:l,dayName:r[l],averageValue:Math.round(f*10)/10,deviation:Math.round(h*10)/10,isHighPoint:!1,isLowPoint:!1})}for(let l of s)l.averageValue===a&&a>0&&(l.isHighPoint=!0),l.averageValue===c&&c!==1/0&&(l.isLowPoint=!0);return s}generateInsights(e,t,r,i,s){let a=[];t.strength!=="none"&&t.direction!=="stable"&&a.push({type:"trend",severity:t.direction==="decreasing"?"warning":"info",title:`${s} is ${t.direction}`,description:t.insight,metric:s,value:t.changePercentage,actionable:t.direction==="decreasing"});let c=r.filter(f=>f.severity==="critical");if(c.length>0)for(let f of c)a.push({type:"anomaly",severity:"critical",title:`Unusual ${f.type} detected on ${f.date}`,description:f.description,metric:s,value:f.value,actionable:!0});let l=i.filter(f=>f.isHighPoint).map(f=>f.dayName),u=i.filter(f=>f.isLowPoint).map(f=>f.dayName);return l.length>0&&u.length>0&&a.push({type:"pattern",severity:"info",title:"Weekly pattern detected",description:`${s} tends to be highest on ${l.join(", ")} and lowest on ${u.join(", ")}.`,metric:s,actionable:!1}),e.stdDevMinutes>e.averageMinutes*.5&&a.push({type:"recommendation",severity:"warning",title:"High variability detected",description:`${s} shows high variability (std dev: ${e.stdDevMinutes} min). Consider maintaining a more consistent schedule.`,metric:s,value:e.stdDevMinutes,actionable:!0}),a}detectSuddenChanges(e,t="averageMinutes",r=50){let i=[];for(let s=1;s<e.length;s++){let a=e[s-1][t],c=e[s][t];if(a===0)continue;let l=(c-a)/a*100;Math.abs(l)>=r&&i.push({date:e[s].date,previousValue:a,currentValue:c,changePercent:Math.round(l*10)/10})}return i}};fa.TrendDetectionService=R0;fa.TrendDetectionService=R0=W4([(0,H4.injectable)()],R0)});var LS=v(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.AutocompleteService=ha.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;var jf=dn(),tl=We(),NS=mt();ha.DEFAULT_AUTOCOMPLETE_CONFIG={limit:10,activeBoost:20,recencyBoost:10,recencyDays:7};var F0=class{static{o(this,"AutocompleteService")}constructor(e,t){this.tripleStore=e,this.config={...ha.DEFAULT_AUTOCOMPLETE_CONFIG,...t}}async getSuggestions(e,t,r){let i={...this.config,...r},s=await this.getPropertyRange(e);if(s.length===0){let l=this.inferClassFromProperty(e);l&&s.push(l)}let a=[];for(let l of s){let u=await this.getAssetsOfClass(l);a.push(...u)}return a.map(l=>({...l,matchScore:this.calculateMatchScore(l,t,i)})).filter(l=>l.matchScore>0).sort((l,u)=>u.matchScore-l.matchScore).slice(0,i.limit)}async getSuggestionsByClass(e,t,r){let i={...this.config,...r},s=[];for(let c of e){let l=await this.getAssetsOfClass(c);s.push(...l)}return s.map(c=>({...c,matchScore:this.calculateMatchScore(c,t,i)})).filter(c=>c.matchScore>0).sort((c,l)=>l.matchScore-c.matchScore).slice(0,i.limit)}async getPropertyRange(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(new tl.IRI(t),jf.Namespace.RDFS.term("range"),void 0);for(let s of i)if(s.object instanceof tl.IRI){let a=this.toClassName(s.object.value);a&&r.push(a)}return r}async getAssetsOfClass(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(void 0,jf.Namespace.RDF.term("type"),new tl.IRI(t));for(let s of i)if(s.subject instanceof tl.IRI){let a=await this.buildSuggestion(s.subject,e);a&&r.push(a)}return r}async buildSuggestion(e,t){let r=await this.tripleStore.match(e,jf.Namespace.EXO.term("Asset_label"),void 0),i="";for(let c of r)if(c.object instanceof NS.Literal){i=c.object.value;break}if(i||(i=this.extractLabelFromUri(e.value)),!i)return null;let s=await this.checkIfActive(e),a=this.extractPathFromUri(e.value);return{label:i,uri:e.value,path:a,assetClass:t,isActive:s,matchScore:0}}async checkIfActive(e){let t=await this.tripleStore.match(e,jf.Namespace.EMS.term("Effort_status"),void 0);for(let r of t){let i=r.object instanceof NS.Literal||r.object instanceof tl.IRI?r.object.value:"";if(i.includes("Active")||i.includes("EffortStatus_Active"))return!0}return!1}calculateMatchScore(e,t,r){if(!t||t.length===0)return e.isActive?100+r.activeBoost:100;let i=e.label.toLowerCase(),s=t.toLowerCase(),a=0;if(i===s)a=100;else if(i.startsWith(s))a=80;else if(i.includes(s))a=60;else if(this.fuzzyMatch(s,i))a=40;else return 0;if(e.isActive&&(a+=r.activeBoost),e.lastModified){let c=(Date.now()-e.lastModified)/864e5;c<=r.recencyDays&&(a+=r.recencyBoost*(1-c/r.recencyDays))}return a}fuzzyMatch(e,t){let r=0;for(let i=0;i<t.length&&r<e.length;i++)t[i]===e[r]&&r++;return r===e.length}inferClassFromProperty(e){let t=e.toLowerCase();return t.includes("project")?"ems__Project":t.includes("area")?"ems__Area":t.includes("task")?"ems__Task":t.includes("effort")?"ems__Effort":null}toFullIri(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;let t=e.match(/^([a-z]+)__(.+)$/);if(t){let[,r,i]=t;switch(r){case"ems":return`https://exocortex.my/ontology/ems#${i}`;case"exo":return`https://exocortex.my/ontology/exo#${i}`;default:return`https://exocortex.my/ontology/${r}#${i}`}}return e}toClassName(e){let t=e.match(/https:\/\/exocortex\.my\/ontology\/([a-z]+)#(.+)$/);if(t){let[,r,i]=t;return`${r}__${i}`}return null}extractLabelFromUri(e){if(e.startsWith("obsidian://")){let r=decodeURIComponent(e),i=r.lastIndexOf("/");if(i>=0){let s=r.substring(i+1);return s.endsWith(".md")&&(s=s.substring(0,s.length-3)),s}}let t=e.lastIndexOf("/");if(t>=0){let r=e.substring(t+1);return r.endsWith(".md")&&(r=r.substring(0,r.length-3)),r}return""}extractPathFromUri(e){if(e.startsWith("obsidian://vault/")){let t=decodeURIComponent(e.substring(17)),r=t.indexOf("/");return r>=0?t.substring(r+1):t}return e}};ha.AutocompleteService=F0});var MS=v(ei=>{"use strict";var z4=ei&&ei.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Q4=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Y4=ei&&ei.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ei,"__esModule",{value:!0});ei.DailyReviewService=void 0;var kS=Ve(),K4=lt(),ro=nr(),X4=Xi(),J4=Pr(),D0=class{static{o(this,"DailyReviewService")}constructor(e){this.vault=e,this.frontmatterService=new X4.FrontmatterService}async getPractices(){let e=this.vault.getAllFiles(),t=[],r=ro.DateFormatter.toDateString(new Date);for(let i of e)if(i.path.endsWith(".md"))try{let s=await this.vault.read(i),a=this.frontmatterService.parse(s);if(!a.exists)continue;let c=this.frontmatterService.getPropertyValue(a.content,"exo__Instance_class");if(!this.isTaskPrototype(c))continue;let l=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_uid");if(!l)continue;let u=l.replace(/"/g,""),f=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_label");if(!f)continue;let h=f.replace(/"/g,""),p=this.frontmatterService.getPropertyValue(a.content,"ems__Recurring_rule")?.replace(/"/g,"")||null,_=this.frontmatterService.getPropertyValue(a.content,"ems__Task_estimatedDuration"),b=null;if(_){let A=parseInt(_,10);isNaN(A)||(b=A)}let E=await this.findTodayInstance(u,r);t.push({uid:u,label:h,path:i.path,recurringRule:p,estimatedDuration:b,doneToday:E?.status==="done",inProgressToday:E?.status==="doing",todayInstancePath:E?.path||null})}catch{continue}return t.sort((i,s)=>i.label.localeCompare(s.label))}async getDailyReviewSummary(e){let t=e||new Date,r=ro.DateFormatter.toDateString(t),i=new Date(t);i.setHours(0,0,0,0);let s=new Date(t);s.setHours(23,59,59,999);let a=this.vault.getAllFiles(),c=0,l=0,u=0,f=0;for(let _ of a)if(_.path.endsWith(".md"))try{let b=await this.vault.read(_),E=this.frontmatterService.parse(b);if(!E.exists)continue;let A=this.frontmatterService.getPropertyValue(E.content,"exo__Instance_class");if(!this.isTask(A))continue;let C=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_plannedStartTimestamp"),M=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_startTimestamp"),G=M?new Date(M):null,Q=C?new Date(C):null;if(!(Q&&Q>=i&&Q<=s||G&&G>=i&&G<=s))continue;c++;let ee=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_status");if(this.isDoneStatus(ee)){l++;let Se=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_endTimestamp");if(M&&Se){let N=this.calculateDurationMinutes(M,Se);f+=N}}else this.isDoingStatus(ee)&&u++}catch{continue}let d=(await this.getPractices()).filter(_=>!_.doneToday&&_.recurringRule),p=c>0?Math.round(l/c*100):0;return{date:r,plannedCount:c,completedCount:l,inProgressCount:u,practicesDue:d,completionPercentage:p,totalTimeMinutes:Math.round(f)}}async quickCapture(e,t=!0,r){let i=(0,J4.v4)(),s=ro.DateFormatter.toISOTimestamp(new Date),a=`${i}.md`,c="03 Knowledge/kitelev",l=["---",`exo__Asset_uid: "${i}"`,`exo__Asset_label: "${e}"`,'exo__Instance_class: "[[ems__Task]]"'];if(r?.prototypeUid){let h=this.buildPrototypeUri(r.prototypeUid);l.push(`exo__Asset_prototype: "${h}"`)}if(r?.areaUid){let h=this.buildAssetUri(r.areaUid);l.push(`ems__Effort_area: "${h}"`)}if(r?.parentUid){let h=this.buildAssetUri(r.parentUid);l.push(`ems__Effort_parent: "${h}"`)}t?(l.push('ems__Effort_status: "[[ems__EffortStatusDoing]]"'),l.push(`ems__Effort_startTimestamp: ${s}`)):l.push('ems__Effort_status: "[[ems__EffortStatusBacklog]]"'),l.push("---","","");let u=l.join(`
|
|
264
|
+
`).filter(s=>s.trim()).map(s=>this.cleanWikiLink(s.replace(/^\s*-\s*/,"").trim()));let r=this.frontmatterService.getPropertyValue(e,"exo__Instance_class");return r?this.cleanWikiLink(r):null}cleanWikiLink(e){return e.replace(/^\[\[/,"").replace(/\]\]$/,"").replace(/^"/,"").replace(/"$/,"")}parseTimestamp(e){if(!e)return null;let t=e.replace(/^"/,"").replace(/"$/,""),r=new Date(t);return isNaN(r.getTime())?null:r}calculateDurationStats(e){let t=e.filter(f=>f.startTimestamp&&f.endTimestamp).map(f=>(f.endTimestamp.getTime()-f.startTimestamp.getTime())/6e4).filter(f=>f>0);if(t.length===0)return{count:0,totalMinutes:0,averageMinutes:0,minMinutes:0,maxMinutes:0,stdDevMinutes:0};let r=t.reduce((f,h)=>f+h,0),i=r/t.length,s=Math.min(...t),a=Math.max(...t),l=t.map(f=>Math.pow(f-i,2)).reduce((f,h)=>f+h,0)/t.length,u=Math.sqrt(l);return{count:t.length,totalMinutes:Math.round(r),averageMinutes:Math.round(i*10)/10,minMinutes:Math.round(s),maxMinutes:Math.round(a),stdDevMinutes:Math.round(u*10)/10}}calculateDailyAggregates(e){let t=new Map;for(let r of e){if(!r.startTimestamp)continue;let i=q4.DateFormatter.toDateString(r.startTimestamp);t.has(i)||t.set(i,{count:0,totalMinutes:0});let s=t.get(i);if(s.count++,r.endTimestamp){let a=r.endTimestamp.getTime()-r.startTimestamp.getTime();s.totalMinutes+=a/6e4}}return Array.from(t.entries()).map(([r,i])=>({date:r,count:i.count,totalMinutes:Math.round(i.totalMinutes),averageMinutes:i.count>0?Math.round(i.totalMinutes/i.count*10)/10:0})).sort((r,i)=>r.date.localeCompare(i.date))}calculateHourlyDistribution(e){let t=new Array(24).fill(0);for(let i of e){if(!i.startTimestamp)continue;let s=i.startTimestamp.getHours();t[s]++}let r=t.reduce((i,s)=>i+s,0);return t.map((i,s)=>({hour:s,count:i,percentage:r>0?Math.round(i/r*1e3)/10:0}))}calculateWeekdayDistribution(e){let t=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=new Array(7).fill(0);for(let s of e){if(!s.startTimestamp)continue;let a=s.startTimestamp.getDay();r[a]++}let i=r.reduce((s,a)=>s+a,0);return r.map((s,a)=>({dayOfWeek:a,dayName:t[a],count:s,percentage:i>0?Math.round(s/i*1e3)/10:0}))}async analyzeSleep(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e,{labelContains:"\u041F\u043E\u0441\u043F\u0430\u0442\u044C"}),r=this.calculateDurationStats(t),i=this.calculateDailyAggregates(t),s=[],a=[];for(let h of t){if(h.startTimestamp){let d=h.startTimestamp.getHours()*60+h.startTimestamp.getMinutes();s.push(d<360?d+1440:d)}if(h.endTimestamp){let d=h.endTimestamp.getHours()*60+h.endTimestamp.getMinutes();a.push(d)}}let c=s.length>0?s.reduce((h,d)=>h+d,0)/s.length:0,l=a.length>0?a.reduce((h,d)=>h+d,0)/a.length:0,u=s.length>1?Math.sqrt(s.map(h=>Math.pow(h-c,2)).reduce((h,d)=>h+d,0)/s.length):0,f=a.length>1?Math.sqrt(a.map(h=>Math.pow(h-l,2)).reduce((h,d)=>h+d,0)/a.length):0;return{period:e,stats:r,dailyData:i,averageBedtime:this.minutesToTimeString(c%1440),averageWakeTime:this.minutesToTimeString(l),bedtimeVariabilityMinutes:Math.round(u),wakeTimeVariabilityMinutes:Math.round(f)}}minutesToTimeString(e){let t=Math.floor(e/60),r=Math.round(e%60);return`${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")}`}async analyzeTaskCompletion(e=this.getDefaultPeriod()){let r=(await this.getEffortsInPeriod(e)).filter(u=>Array.isArray(u.instanceClass)?u.instanceClass.some(f=>f.includes("ems__Task")):u.instanceClass?.includes("ems__Task")??!1),i=r.filter(u=>u.status?.includes("ems__EffortStatusDone")),s=r.filter(u=>u.status?.includes("ems__EffortStatusTrashed")),a=i.filter(u=>u.startTimestamp&&u.endTimestamp).map(u=>(u.endTimestamp.getTime()-u.startTimestamp.getTime())/6e4),c=a.length>0?a.reduce((u,f)=>u+f,0)/a.length:0,l=this.calculateDailyAggregates(i);return{period:e,totalTasks:r.length,completedTasks:i.length,trashedTasks:s.length,completionRate:r.length>0?Math.round(i.length/r.length*1e3)/10:0,averageCompletionTimeMinutes:Math.round(c*10)/10,dailyCompletions:l}}async analyzeActivityFrequency(e,t=this.getDefaultPeriod()){let r=await this.getEffortsInPeriod(t,{labelContains:e}),i=this.calculateDurationStats(r),s=this.calculateDailyAggregates(r),a=this.calculateHourlyDistribution(r),c=this.calculateWeekdayDistribution(r);return{activityLabel:e,period:t,stats:i,dailyData:s,hourlyDistribution:a,weekdayDistribution:c}}async getActivitySummary(e=this.getDefaultPeriod()){let t=await this.getEffortsInPeriod(e),r=new Map;for(let s of t){let a=s.label.split(" ")[0];r.has(a)||r.set(a,[]),r.get(a).push(s)}let i=new Map;for(let[s,a]of r)i.set(s,this.calculateDurationStats(a));return i}};Zn.AnalyticsService=P0;Zn.AnalyticsService=P0=$4([(0,RS.injectable)(),U4(0,(0,RS.inject)(B4.DI_TOKENS.IVaultAdapter)),V4("design:paramtypes",[Object])],P0)});var DS=v(fa=>{"use strict";var W4=fa&&fa.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(fa,"__esModule",{value:!0});fa.TrendDetectionService=void 0;var H4=Ve(),R0=class{static{o(this,"TrendDetectionService")}constructor(){this.TREND_THRESHOLD=.05,this.ANOMALY_THRESHOLD_STD=2,this.STRONG_CORRELATION_THRESHOLD=.7,this.MODERATE_CORRELATION_THRESHOLD=.4}analyzeTrend(e,t="averageMinutes"){if(e.length<3)return{direction:"stable",strength:"none",slope:0,rSquared:0,changePercentage:0,insight:"Insufficient data for trend analysis (need at least 3 data points)"};let r=e.map(d=>d[t]),{slope:i,rSquared:s}=this.linearRegression(r),a=r[0]||1,l=((r[r.length-1]||0)-a)/a*100,u;Math.abs(l)<this.TREND_THRESHOLD*100?u="stable":i>0?u="increasing":u="decreasing";let f;s>=.7?f="strong":s>=.4?f="moderate":s>=.2?f="weak":f="none";let h=this.generateTrendInsight(u,f,l);return{direction:u,strength:f,slope:Math.round(i*100)/100,rSquared:Math.round(s*100)/100,changePercentage:Math.round(l*10)/10,insight:h}}linearRegression(e){let t=e.length;if(t===0)return{slope:0,intercept:0,rSquared:0};let r=(t-1)/2,i=e.reduce((d,p)=>d+p,0)/t,s=0,a=0;for(let d=0;d<t;d++)s+=(d-r)*(e[d]-i),a+=Math.pow(d-r,2);let c=a!==0?s/a:0,l=i-c*r,u=0,f=0;for(let d=0;d<t;d++){let p=l+c*d;u+=Math.pow(e[d]-p,2),f+=Math.pow(e[d]-i,2)}let h=f!==0?1-u/f:0;return{slope:c,intercept:l,rSquared:Math.max(0,h)}}generateTrendInsight(e,t,r){if(t==="none"||e==="stable")return"Metric is relatively stable with no significant trend.";let i=t==="strong"?"clearly":t==="moderate"?"moderately":"slightly",s=e==="increasing"?"increasing":"decreasing",a=`${Math.abs(Math.round(r))}%`;return`Metric is ${i} ${s} (${a} change over the period).`}detectAnomalies(e,t="averageMinutes"){if(e.length<5)return[];let r=e.map(c=>c[t]),{mean:i,stdDev:s}=this.calculateStats(r),a=[];for(let c=0;c<e.length;c++){let l=r[c],u=(l-i)/(s||1);if(Math.abs(u)>=this.ANOMALY_THRESHOLD_STD){let f=this.determineAnomalySeverity(u),h=this.determineAnomalyType(u,l,i);a.push({date:e[c].date,value:l,expectedValue:Math.round(i*10)/10,deviation:Math.round(u*100)/100,severity:f,type:h,description:this.generateAnomalyDescription(h,f,u,l,i)})}}return a}calculateStats(e){if(e.length===0)return{mean:0,stdDev:0};let t=e.reduce((a,c)=>a+c,0)/e.length,i=e.map(a=>Math.pow(a-t,2)).reduce((a,c)=>a+c,0)/e.length,s=Math.sqrt(i);return{mean:t,stdDev:s}}determineAnomalySeverity(e){let t=Math.abs(e);return t>=3?"critical":t>=2.5?"warning":"info"}determineAnomalyType(e,t,r){return t>r&&e>0?"spike":t<r&&e<0?"drop":"outlier"}generateAnomalyDescription(e,t,r,i,s){let a=t==="critical"?"Significant":t==="warning"?"Notable":"Minor",c=e==="spike"?"spike":e==="drop"?"drop":"unusual value",l=Math.round((i-s)/s*100);return`${a} ${c} detected: ${Math.round(i)} (${l>0?"+":""}${l}% from average of ${Math.round(s)}, ${r.toFixed(1)}\u03C3 from mean).`}calculateCorrelation(e,t,r,i){let s=Math.min(e.length,t.length);if(s<5)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"Insufficient data for correlation analysis."};let{mean:a,stdDev:c}=this.calculateStats(e.slice(0,s)),{mean:l,stdDev:u}=this.calculateStats(t.slice(0,s));if(c===0||u===0)return{metric1:r,metric2:i,coefficient:0,strength:"none",direction:"none",insight:"One or both metrics have no variation."};let f=0;for(let E=0;E<s;E++)f+=(e[E]-a)/c*((t[E]-l)/u);let h=f/s,d=Math.abs(h),p;d>=this.STRONG_CORRELATION_THRESHOLD?p="strong":d>=this.MODERATE_CORRELATION_THRESHOLD?p="moderate":d>=.2?p="weak":p="none";let _=p==="none"?"none":h>0?"positive":"negative",b=this.generateCorrelationInsight(r,i,h,p,_);return{metric1:r,metric2:i,coefficient:Math.round(h*100)/100,strength:p,direction:_,insight:b}}generateCorrelationInsight(e,t,r,i,s){if(i==="none")return`No significant correlation found between ${e} and ${t}.`;let a=i==="strong"?"strongly":i==="moderate"?"moderately":"weakly",c=s==="positive"?"When one increases, the other tends to increase":"When one increases, the other tends to decrease";return`${e} and ${t} are ${a} ${s}ly correlated (r=${r.toFixed(2)}). ${c}.`}analyzeWeeklyPattern(e,t="averageMinutes"){let r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i={};for(let l of e){let f=new Date(l.date).getDay();i[f]||(i[f]=[]),i[f].push(l[t])}let s=[],a=0,c=1/0;for(let l=0;l<7;l++){let u=i[l]||[],{mean:f,stdDev:h}=this.calculateStats(u);f>a&&(a=f),f<c&&u.length>0&&(c=f),s.push({dayOfWeek:l,dayName:r[l],averageValue:Math.round(f*10)/10,deviation:Math.round(h*10)/10,isHighPoint:!1,isLowPoint:!1})}for(let l of s)l.averageValue===a&&a>0&&(l.isHighPoint=!0),l.averageValue===c&&c!==1/0&&(l.isLowPoint=!0);return s}generateInsights(e,t,r,i,s){let a=[];t.strength!=="none"&&t.direction!=="stable"&&a.push({type:"trend",severity:t.direction==="decreasing"?"warning":"info",title:`${s} is ${t.direction}`,description:t.insight,metric:s,value:t.changePercentage,actionable:t.direction==="decreasing"});let c=r.filter(f=>f.severity==="critical");if(c.length>0)for(let f of c)a.push({type:"anomaly",severity:"critical",title:`Unusual ${f.type} detected on ${f.date}`,description:f.description,metric:s,value:f.value,actionable:!0});let l=i.filter(f=>f.isHighPoint).map(f=>f.dayName),u=i.filter(f=>f.isLowPoint).map(f=>f.dayName);return l.length>0&&u.length>0&&a.push({type:"pattern",severity:"info",title:"Weekly pattern detected",description:`${s} tends to be highest on ${l.join(", ")} and lowest on ${u.join(", ")}.`,metric:s,actionable:!1}),e.stdDevMinutes>e.averageMinutes*.5&&a.push({type:"recommendation",severity:"warning",title:"High variability detected",description:`${s} shows high variability (std dev: ${e.stdDevMinutes} min). Consider maintaining a more consistent schedule.`,metric:s,value:e.stdDevMinutes,actionable:!0}),a}detectSuddenChanges(e,t="averageMinutes",r=50){let i=[];for(let s=1;s<e.length;s++){let a=e[s-1][t],c=e[s][t];if(a===0)continue;let l=(c-a)/a*100;Math.abs(l)>=r&&i.push({date:e[s].date,previousValue:a,currentValue:c,changePercent:Math.round(l*10)/10})}return i}};fa.TrendDetectionService=R0;fa.TrendDetectionService=R0=W4([(0,H4.injectable)()],R0)});var LS=v(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.AutocompleteService=ha.DEFAULT_AUTOCOMPLETE_CONFIG=void 0;var jf=dn(),tl=We(),NS=mt();ha.DEFAULT_AUTOCOMPLETE_CONFIG={limit:10,activeBoost:20,recencyBoost:10,recencyDays:7};var F0=class{static{o(this,"AutocompleteService")}constructor(e,t){this.tripleStore=e,this.config={...ha.DEFAULT_AUTOCOMPLETE_CONFIG,...t}}async getSuggestions(e,t,r){let i={...this.config,...r},s=await this.getPropertyRange(e);if(s.length===0){let l=this.inferClassFromProperty(e);l&&s.push(l)}let a=[];for(let l of s){let u=await this.getAssetsOfClass(l);a.push(...u)}return a.map(l=>({...l,matchScore:this.calculateMatchScore(l,t,i)})).filter(l=>l.matchScore>0).sort((l,u)=>u.matchScore-l.matchScore).slice(0,i.limit)}async getSuggestionsByClass(e,t,r){let i={...this.config,...r},s=[];for(let c of e){let l=await this.getAssetsOfClass(c);s.push(...l)}return s.map(c=>({...c,matchScore:this.calculateMatchScore(c,t,i)})).filter(c=>c.matchScore>0).sort((c,l)=>l.matchScore-c.matchScore).slice(0,i.limit)}async getPropertyRange(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(new tl.IRI(t),jf.Namespace.RDFS.term("range"),void 0);for(let s of i)if(s.object instanceof tl.IRI){let a=this.toClassName(s.object.value);a&&r.push(a)}return r}async getAssetsOfClass(e){let t=this.toFullIri(e),r=[],i=await this.tripleStore.match(void 0,jf.Namespace.RDF.term("type"),new tl.IRI(t));for(let s of i)if(s.subject instanceof tl.IRI){let a=await this.buildSuggestion(s.subject,e);a&&r.push(a)}return r}async buildSuggestion(e,t){let r=await this.tripleStore.match(e,jf.Namespace.EXO.term("Asset_label"),void 0),i="";for(let c of r)if(c.object instanceof NS.Literal){i=c.object.value;break}if(i||(i=this.extractLabelFromUri(e.value)),!i)return null;let s=await this.checkIfActive(e),a=this.extractPathFromUri(e.value);return{label:i,uri:e.value,path:a,assetClass:t,isActive:s,matchScore:0}}async checkIfActive(e){let t=await this.tripleStore.match(e,jf.Namespace.EMS.term("Effort_status"),void 0);for(let r of t){let i=r.object instanceof NS.Literal||r.object instanceof tl.IRI?r.object.value:"";if(i.includes("Active")||i.includes("EffortStatus_Active"))return!0}return!1}calculateMatchScore(e,t,r){if(!t||t.length===0)return e.isActive?100+r.activeBoost:100;let i=e.label.toLowerCase(),s=t.toLowerCase(),a=0;if(i===s)a=100;else if(i.startsWith(s))a=80;else if(i.includes(s))a=60;else if(this.fuzzyMatch(s,i))a=40;else return 0;if(e.isActive&&(a+=r.activeBoost),e.lastModified){let c=(Date.now()-e.lastModified)/864e5;c<=r.recencyDays&&(a+=r.recencyBoost*(1-c/r.recencyDays))}return a}fuzzyMatch(e,t){let r=0;for(let i=0;i<t.length&&r<e.length;i++)t[i]===e[r]&&r++;return r===e.length}inferClassFromProperty(e){let t=e.toLowerCase();return t.includes("project")?"ems__Project":t.includes("area")?"ems__Area":t.includes("task")?"ems__Task":t.includes("effort")?"ems__Effort":null}toFullIri(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;let t=e.match(/^([a-z]+)__(.+)$/);if(t){let[,r,i]=t;switch(r){case"ems":return`https://exocortex.my/ontology/ems#${i}`;case"exo":return`https://exocortex.my/ontology/exo#${i}`;default:return`https://exocortex.my/ontology/${r}#${i}`}}return e}toClassName(e){let t=e.match(/https:\/\/exocortex\.my\/ontology\/([a-z]+)#(.+)$/);if(t){let[,r,i]=t;return`${r}__${i}`}return null}extractLabelFromUri(e){if(e.startsWith("obsidian://")){let r=decodeURIComponent(e),i=r.lastIndexOf("/");if(i>=0){let s=r.substring(i+1);return s.endsWith(".md")&&(s=s.substring(0,s.length-3)),s}}let t=e.lastIndexOf("/");if(t>=0){let r=e.substring(t+1);return r.endsWith(".md")&&(r=r.substring(0,r.length-3)),r}return""}extractPathFromUri(e){if(e.startsWith("obsidian://vault/")){let t=decodeURIComponent(e.substring(17)),r=t.indexOf("/");return r>=0?t.substring(r+1):t}return e}};ha.AutocompleteService=F0});var MS=v(ei=>{"use strict";var z4=ei&&ei.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Q4=ei&&ei.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Y4=ei&&ei.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ei,"__esModule",{value:!0});ei.DailyReviewService=void 0;var kS=Ve(),K4=lt(),ro=nr(),X4=Xi(),J4=Pr(),D0=class{static{o(this,"DailyReviewService")}constructor(e){this.vault=e,this.frontmatterService=new X4.FrontmatterService}async getPractices(){let e=this.vault.getAllFiles(),t=[],r=ro.DateFormatter.toDateString(new Date);for(let i of e)if(i.path.endsWith(".md"))try{let s=await this.vault.read(i),a=this.frontmatterService.parse(s);if(!a.exists)continue;let c=this.frontmatterService.getPropertyValue(a.content,"exo__Instance_class");if(!this.isTaskPrototype(c))continue;let l=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_uid");if(!l)continue;let u=l.replace(/"/g,""),f=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_label");if(!f)continue;let h=f.replace(/"/g,""),p=this.frontmatterService.getPropertyValue(a.content,"ems__Recurring_rule")?.replace(/"/g,"")||null,_=this.frontmatterService.getPropertyValue(a.content,"ems__Task_estimatedDuration"),b=null;if(_){let A=parseInt(_,10);isNaN(A)||(b=A)}let E=await this.findTodayInstance(u,r);t.push({uid:u,label:h,path:i.path,recurringRule:p,estimatedDuration:b,doneToday:E?.status==="done",inProgressToday:E?.status==="doing",todayInstancePath:E?.path||null})}catch{continue}return t.sort((i,s)=>i.label.localeCompare(s.label))}async getDailyReviewSummary(e){let t=e||new Date,r=ro.DateFormatter.toDateString(t),i=new Date(t);i.setHours(0,0,0,0);let s=new Date(t);s.setHours(23,59,59,999);let a=this.vault.getAllFiles(),c=0,l=0,u=0,f=0;for(let _ of a)if(_.path.endsWith(".md"))try{let b=await this.vault.read(_),E=this.frontmatterService.parse(b);if(!E.exists)continue;let A=this.frontmatterService.getPropertyValue(E.content,"exo__Instance_class");if(!this.isTask(A))continue;let C=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_plannedStartTimestamp"),j=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_startTimestamp"),G=j?new Date(j):null,Q=C?new Date(C):null;if(!(Q&&Q>=i&&Q<=s||G&&G>=i&&G<=s))continue;c++;let ee=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_status");if(this.isDoneStatus(ee)){l++;let Se=this.frontmatterService.getPropertyValue(E.content,"ems__Effort_endTimestamp");if(j&&Se){let L=this.calculateDurationMinutes(j,Se);f+=L}}else this.isDoingStatus(ee)&&u++}catch{continue}let d=(await this.getPractices()).filter(_=>!_.doneToday&&_.recurringRule),p=c>0?Math.round(l/c*100):0;return{date:r,plannedCount:c,completedCount:l,inProgressCount:u,practicesDue:d,completionPercentage:p,totalTimeMinutes:Math.round(f)}}async quickCapture(e,t=!0,r){let i=(0,J4.v4)(),s=ro.DateFormatter.toISOTimestamp(new Date),a=`${i}.md`,c="03 Knowledge/kitelev",l=["---",`exo__Asset_uid: "${i}"`,`exo__Asset_label: "${e}"`,'exo__Instance_class: "[[ems__Task]]"'];if(r?.prototypeUid){let h=this.buildPrototypeUri(r.prototypeUid);l.push(`exo__Asset_prototype: "${h}"`)}if(r?.areaUid){let h=this.buildAssetUri(r.areaUid);l.push(`ems__Effort_area: "${h}"`)}if(r?.parentUid){let h=this.buildAssetUri(r.parentUid);l.push(`ems__Effort_parent: "${h}"`)}t?(l.push('ems__Effort_status: "[[ems__EffortStatusDoing]]"'),l.push(`ems__Effort_startTimestamp: ${s}`)):l.push('ems__Effort_status: "[[ems__EffortStatusBacklog]]"'),l.push("---","","");let u=l.join(`
|
|
265
265
|
`),f=`${c}/${a}`;return await this.vault.create(f,u),{path:f,uid:i,label:e,started:t}}async createFromPractice(e){let r=(await this.getPractices()).find(a=>a.uid===e.prototypeUid);if(!r)throw new Error(`Practice not found: ${e.prototypeUid}`);if(r.doneToday)throw new Error(`Practice "${r.label}" already completed today`);if(r.inProgressToday&&r.todayInstancePath)return{path:r.todayInstancePath,uid:e.prototypeUid,label:r.label,started:!0};let i=ro.DateFormatter.toDateString(new Date),s=e.label||`${r.label} ${i}`;return this.quickCapture(s,e.startImmediately??!0,{prototypeUid:e.prototypeUid,areaUid:e.areaUid,parentUid:e.parentUid})}async markPracticeDone(e){let r=(await this.getPractices()).find(u=>u.uid===e);if(!r)throw new Error(`Practice not found: ${e}`);if(r.doneToday)return;if(!r.todayInstancePath)throw new Error(`No active instance for practice "${r.label}" today`);let i=this.vault.getAbstractFileByPath(r.todayInstancePath);if(!i||!("basename"in i))throw new Error(`File not found: ${r.todayInstancePath}`);let s=i,a=await this.vault.read(s),c=ro.DateFormatter.toISOTimestamp(new Date),l=this.frontmatterService.updateProperty(a,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');l=this.frontmatterService.updateProperty(l,"ems__Effort_endTimestamp",c),l=this.frontmatterService.updateProperty(l,"ems__Effort_resolutionTimestamp",c),await this.vault.modify(s,l)}async findTodayInstance(e,t){let r=this.vault.getAllFiles();for(let i of r)if(i.path.endsWith(".md"))try{let s=await this.vault.read(i),a=this.frontmatterService.parse(s);if(!a.exists)continue;let c=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_prototype");if(!c||!c.includes(e))continue;let l=this.frontmatterService.getPropertyValue(a.content,"exo__Asset_label"),u=this.frontmatterService.getPropertyValue(a.content,"ems__Effort_startTimestamp"),f=l?.includes(t),h=u?new Date(u):null,d=h&&ro.DateFormatter.toDateString(h)===t;if(!f&&!d)continue;let p=this.frontmatterService.getPropertyValue(a.content,"ems__Effort_status");return this.isDoneStatus(p)?{path:i.path,status:"done"}:this.isDoingStatus(p)?{path:i.path,status:"doing"}:{path:i.path,status:"other"}}catch{continue}return null}isTaskPrototype(e){return e?e.includes("ems__TaskPrototype")||e.includes("TaskPrototype"):!1}isTask(e){return e?(e.includes("ems__Task")||e.includes("[[ems__Task]]"))&&!e.includes("Prototype"):!1}isDoneStatus(e){return e?e.includes("Done")||e.includes("EffortStatusDone"):!1}isDoingStatus(e){return e?e.includes("Doing")||e.includes("EffortStatusDoing"):!1}calculateDurationMinutes(e,t){let r=new Date(e);return(new Date(t).getTime()-r.getTime())/1e3/60}buildPrototypeUri(e){return`obsidian://vault/03%20Knowledge%2Fkitelev%2F${e}.md`}buildAssetUri(e){return`obsidian://vault/03%20Knowledge%2Fkitelev%2F${e}.md`}};ei.DailyReviewService=D0;ei.DailyReviewService=D0=z4([(0,kS.injectable)(),Y4(0,(0,kS.inject)(K4.DI_TOKENS.IVaultAdapter)),Q4("design:paramtypes",[Object])],D0)});var L0=v(yr=>{"use strict";var Z4=yr&&yr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},e5=yr&&yr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},t5=yr&&yr.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(yr,"__esModule",{value:!0});yr.CriticalityZoneService=yr.CriticalityZoneUUIDs=void 0;var jS=Ve(),r5=Xi(),n5=lt();yr.CriticalityZoneUUIDs={TODAY:"e266a2e9-9eb0-431d-b1fe-b95b9d3e9a3f",THIS_WEEK:"c7f1a968-0959-4ac7-ac82-31b0cdc2aba7",SOMEDAY:"6968a0fc-7a41-4393-82b1-17d767c7ad7c"};var N0=class{static{o(this,"CriticalityZoneService")}constructor(e){this.vault=e,this.frontmatterService=new r5.FrontmatterService}async setZoneToday(e){await this.setZone(e,yr.CriticalityZoneUUIDs.TODAY)}async setZoneThisWeek(e){await this.setZone(e,yr.CriticalityZoneUUIDs.THIS_WEEK)}async setZoneSomeday(e){await this.setZone(e,yr.CriticalityZoneUUIDs.SOMEDAY)}async setZone(e,t){let r=await this.vault.read(e),i=this.frontmatterService.updateProperty(r,"ems__Task_zone",`"[[${t}]]"`);await this.vault.modify(e,i)}};yr.CriticalityZoneService=N0;yr.CriticalityZoneService=N0=Z4([(0,jS.injectable)(),t5(0,(0,jS.inject)(n5.DI_TOKENS.IVaultAdapter)),e5("design:paramtypes",[Object])],N0)});var $S=v($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.EffortSortingHelpers=void 0;var k0=class n{static{o(this,"EffortSortingHelpers")}static getTimeFromTimestamp(e){if(!e)return"00:00:00";let t=new Date(e);if(isNaN(t.getTime()))return"00:00:00";let r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${r}:${i}:${s}`}static sortByStartTime(e,t){let r=n.getTimeFromTimestamp(e.startTimestamp),i=n.getTimeFromTimestamp(t.startTimestamp),s=r==="00:00:00",a=i==="00:00:00";return s&&!a?1:!s&&a?-1:r.localeCompare(i)}static sortByPriority(e,t){if(e.isTrashed!==t.isTrashed)return e.isTrashed?1:-1;if(e.isDone!==t.isDone)return e.isDone?1:-1;let r=typeof e.metadata.ems__Effort_votes=="number"?e.metadata.ems__Effort_votes:0,i=typeof t.metadata.ems__Effort_votes=="number"?t.metadata.ems__Effort_votes:0;return r!==i?i-r:e.startTime&&t.startTime?e.startTime.localeCompare(t.startTime):e.startTime?-1:t.startTime?1:0}};$f.EffortSortingHelpers=k0});var VS=v(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.FilenameValidator=void 0;var da=class{static{o(this,"FilenameValidator")}static validate(e,t={}){let{maxLength:r=this.DEFAULT_MAX_LENGTH,replacementChar:i=this.DEFAULT_REPLACEMENT,allowEmpty:s=!1}=t,a=[];if(!e||e.trim().length===0)return s||a.push("Filename cannot be empty"),{valid:a.length===0,sanitized:"",errors:a};e.endsWith(" ")&&a.push("Filename should not end with a space");let c=e.trim();this.INVALID_CHARS_PATTERN.test(c)&&a.push('Filename contains invalid characters: / \\ : * ? " < > |');let l=this.getBaseName(c);this.RESERVED_NAMES.has(l.toUpperCase())&&a.push(`"${l}" is a reserved filename on Windows`),c.length>r&&a.push(`Filename exceeds maximum length of ${r} characters`),c.startsWith(".")&&a.push("Filename should not start with a dot"),c.endsWith(".")&&a.push("Filename should not end with a dot");let u=this.sanitize(e,{maxLength:r,replacementChar:i});return{valid:a.length===0,sanitized:u,errors:a}}static sanitize(e,t={}){let{maxLength:r=this.DEFAULT_MAX_LENGTH,replacementChar:i=this.DEFAULT_REPLACEMENT}=t;if(!e||e.trim().length===0)return"";let s=e.trim();for(s=s.replace(this.INVALID_CHARS_PATTERN,i);s.startsWith(".")&&s.length>1;)s=s.substring(1);for(;s.length>0&&(s.endsWith(".")||s.endsWith(" "));)s=s.slice(0,-1);for(s.includes(i)&&(s=s.split(i).filter(u=>u!=="").join(i));s.startsWith(i);)s=s.slice(i.length);for(;s.endsWith(i);)s=s.slice(0,-i.length);let a=this.getBaseName(s);if(this.RESERVED_NAMES.has(a.toUpperCase())){let c=this.getExtension(s);s=a+i+c}if(s.length>r)for(s=s.slice(0,r);s.endsWith(i);)s=s.slice(0,-i.length);return s}static hasInvalidChars(e){return this.INVALID_CHARS_PATTERN.test(e)}static getInvalidChars(e){let t=e.match(this.INVALID_CHARS_PATTERN);return t?[...new Set(t)]:[]}static getBaseName(e){let t=e.lastIndexOf(".");return t===-1||t===0?e:e.substring(0,t)}static getExtension(e){let t=e.lastIndexOf(".");return t===-1||t===0?"":e.substring(t)}};Vf.FilenameValidator=da;da.INVALID_CHARS_PATTERN=/[/\\:*?"<>|\x00-\x1F]/g;da.RESERVED_NAMES=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]);da.DEFAULT_MAX_LENGTH=200;da.DEFAULT_REPLACEMENT="_"});var j0=v(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});Uf.NTriplesSerializer=void 0;var M0=class{static{o(this,"NTriplesSerializer")}serialize(e,t={}){let r=t.newline??`
|
|
266
266
|
`;return e.length===0?"":e.map(i=>i.toString()).join(r)+r}serializeChunk(e,t){return e.length===0?"":e.map(r=>r.toString()).join(t)+t}};Uf.NTriplesSerializer=M0});var US=v(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.TurtleSerializer=void 0;var no=dn(),i5=j0(),s5={rdf:no.Namespace.RDF.iri.value,rdfs:no.Namespace.RDFS.iri.value,owl:no.Namespace.OWL.iri.value,xsd:no.Namespace.XSD.iri.value,exo:no.Namespace.EXO.iri.value,ems:no.Namespace.EMS.iri.value},$0=class{static{o(this,"TurtleSerializer")}constructor(){this.nTriplesSerializer=new i5.NTriplesSerializer}serialize(e,t={}){let r=t.newline??`
|
|
267
267
|
`,i=this.composePrefixes(t),s=this.serializePrefixes(i,r),a=this.nTriplesSerializer.serialize(e,{newline:r}).trimEnd();return s?a?`${s}${r}${r}${a}${r}`:`${s}${r}`:a?`${a}${r}`:""}serializePrefixes(e,t){let r=Object.entries(e);return r.length===0?"":r.map(([i,s])=>`@prefix ${i}: <${s}> .`).join(t)}composePrefixes(e){return e.includeDefaultPrefixes??!0?{...s5,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};Bf.TurtleSerializer=$0});var GS=v(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.JSONLDSerializer=void 0;var BS=We(),qS=kt(),a5=mt(),io=dn(),o5={rdf:io.Namespace.RDF.iri.value,rdfs:io.Namespace.RDFS.iri.value,owl:io.Namespace.OWL.iri.value,xsd:io.Namespace.XSD.iri.value,exo:io.Namespace.EXO.iri.value,ems:io.Namespace.EMS.iri.value},V0=class{static{o(this,"JSONLDSerializer")}toDocument(e,t={}){let r={...o5,...t.context??{}},i=new Map;for(let s of e){let a=this.subjectToId(s.subject),c=this.compactIri(s.predicate.value,r),l=this.objectToJSONLD(s.object,r),u=i.get(a)??{"@id":a},f=u[c];f===void 0?u[c]=l:Array.isArray(f)?f.push(l):u[c]=[f,l],i.set(a,u)}return{"@context":r,"@graph":Array.from(i.values())}}serialize(e,t={}){let r=this.toDocument(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}subjectToId(e){return e instanceof BS.IRI?e.value:e instanceof qS.BlankNode?`_:${e.id}`:String(e)}compactIri(e,t){for(let[r,i]of Object.entries(t))if(e.startsWith(i)){let s=e.slice(i.length);if(s.length>0)return`${r}:${s}`}return e}objectToJSONLD(e,t){if(e instanceof BS.IRI)return{"@id":e.value};if(e instanceof qS.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof a5.Literal){let r={"@value":e.value};return e.datatype?r["@type"]=this.compactIri(e.datatype.value,t):e.language&&(r["@language"]=e.language,e.hasDirection()&&e.direction&&(r["@direction"]=e.direction)),r}return e}};qf.JSONLDSerializer=V0});var q0=v(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.NTriplesParser=void 0;var c5=_i(),WS=We(),U0=mt(),l5=kt(),so=dn(),u5={rdf:so.Namespace.RDF.iri.value,rdfs:so.Namespace.RDFS.iri.value,owl:so.Namespace.OWL.iri.value,xsd:so.Namespace.XSD.iri.value,exo:so.Namespace.EXO.iri.value,ems:so.Namespace.EMS.iri.value},B0=class{static{o(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...u5,...t.prefixes??{}},strict:t.strict??!1},i=[];return e.split(/\r?\n/).forEach((a,c)=>{let l=a.trim();!l||l.startsWith("#")||i.push(this.parseLine(l,c+1,r))}),i}parseLine(e,t,r){if(!e.endsWith("."))throw new Error(`Invalid RDF statement at line ${t}: missing '.' terminator`);let s=e.slice(0,-1).trim(),a=this.parseSubject(s,t,r);s=a.rest.trim();let c=this.parsePredicate(s,t,r);s=c.rest.trim();let l=this.parseObject(s,t,r);if(s=l.rest.trim(),s.length>0)throw new Error(`Unexpected tokens after object at line ${t}`);return new c5.Triple(a.node,c.node,l.node)}parseSubject(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):e.startsWith("_:")?this.consumeBlankNode(e,t):this.consumePrefixedName(e,t,r)}parsePredicate(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):this.consumePrefixedName(e,t,r)}parseObject(e,t,r){return e.startsWith("<")?this.consumeIRI(e,t,r):e.startsWith("_:")?this.consumeBlankNode(e,t):e.startsWith('"')?this.consumeLiteral(e,t,r):this.consumePrefixedName(e,t,r)}consumePrefixedName(e,t,r){let i=e.match(/^([a-zA-Z_][\w-]*):([^\s]+)(?:\s+(.*))?$/);if(!i)throw new Error(`Invalid token at line ${t}: ${e}`);let[,s,a,c]=i,l=r.prefixes[s];if(!l)throw new Error(`Unknown prefix "${s}" at line ${t}`);return{node:new WS.IRI(`${l}${a}`),rest:(c??"").trimStart()}}consumeIRI(e,t,r){let i=this.findClosingBracket(e,"<",">");if(i===-1)throw new Error(`Invalid IRI at line ${t}`);let s=e.slice(1,i),a=new WS.IRI(s),c=e.slice(i+1).trimStart();return{node:a,rest:c}}consumeBlankNode(e,t){let r=e.match(/^_:(\w+)(?:\s+(.*))?$/);if(!r)throw new Error(`Invalid blank node identifier at line ${t}`);let[,i,s]=r;return{node:new l5.BlankNode(i),rest:(s??"").trimStart()}}consumeLiteral(e,t,r){let{value:i,rest:s}=this.consumeQuotedString(e,t),a=s.trimStart();if(a.startsWith("^^")){a=a.slice(2).trimStart();let c=a.startsWith("<")?this.consumeIRI(a,t,r):this.consumePrefixedName(a,t,r);return{node:new U0.Literal(i,c.node),rest:c.rest}}if(a.startsWith("@")){let c=a.match(/^@([a-zA-Z-]+)(?:\s+(.*))?$/);if(!c)throw new Error(`Invalid language tag at line ${t}`);let[,l,u]=c;return{node:new U0.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new U0.Literal(i),rest:a}}consumeQuotedString(e,t){if(!e.startsWith('"'))throw new Error(`Expected quoted string at line ${t}`);let r="";for(let i=1;i<e.length;i++){let s=e[i];if(s==="\\"){if(i+1>=e.length)throw new Error(`Invalid escape sequence at line ${t}`);let a=e[i+1];switch(a){case"t":r+=" ",i+=1;break;case"b":r+="\b",i+=1;break;case"n":r+=`
|
|
268
268
|
`,i+=1;break;case"r":r+="\r",i+=1;break;case"f":r+="\f",i+=1;break;case'"':r+='"',i+=1;break;case"\\":r+="\\",i+=1;break;case"u":{let c=e.slice(i+2,i+6);if(c.length!==4||!/^[0-9a-fA-F]{4}$/.test(c))throw new Error(`Invalid \\u escape at line ${t}`);r+=String.fromCharCode(parseInt(c,16)),i+=5;break}case"U":{let c=e.slice(i+2,i+10);if(c.length!==8||!/^[0-9a-fA-F]{8}$/.test(c))throw new Error(`Invalid \\U escape at line ${t}`);r+=String.fromCodePoint(parseInt(c,16)),i+=9;break}default:throw new Error(`Unknown escape sequence \\${a} at line ${t}`)}continue}if(s==='"'){let a=e.slice(i+1);return{value:r,rest:a}}r+=s}throw new Error(`Unterminated string literal at line ${t}`)}findClosingBracket(e,t,r){let i=0;for(let s=0;s<e.length;s++){let a=e[s];if(a===t){i++;continue}if(a===r&&(i--,i===0))return s}return-1}};Gf.NTriplesParser=B0});var HS=v(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.TurtleParser=void 0;var ao=dn(),f5=q0(),h5={rdf:ao.Namespace.RDF.iri.value,rdfs:ao.Namespace.RDFS.iri.value,owl:ao.Namespace.OWL.iri.value,xsd:ao.Namespace.XSD.iri.value,exo:ao.Namespace.EXO.iri.value,ems:ao.Namespace.EMS.iri.value},d5=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,G0=class{static{o(this,"TurtleParser")}constructor(){this.nTriplesParser=new f5.NTriplesParser}parse(e,t={}){let r={...h5,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:a,lineNumber:c})=>{if(this.isPrefixStatement(a)){let u=a.match(d5);if(!u)throw new Error(`Invalid prefix declaration at line ${c}`);let[,f,h]=u;r[f]=h;return}if(a.includes(";")||a.includes(","))throw new Error(`Complex Turtle statements with ';' or ',' are not supported (line ${c})`);let l=this.normalizeShortcuts(a);s.push(this.nTriplesParser.parseLine(l,c,{prefixes:r,strict:!1}))}),s}collectStatements(e){let t=e.split(/\r?\n/),r=[],i="",s=0;if(t.forEach((a,c)=>{let l=a.trim();!l||l.startsWith("#")||(i||(s=c+1),i=i?`${i} ${l}`:l,l.endsWith(".")&&(r.push({statement:i,lineNumber:s}),i=""))}),i)throw new Error(`Unterminated Turtle statement near line ${s}`);return r}isPrefixStatement(e){return e.startsWith("@prefix")}normalizeShortcuts(e){return e.includes(" a ")?e.replace(/\sa\s/g," rdf:type "):e}};Wf.TurtleParser=G0});var zS=v(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.RDFSerializer=void 0;var oo=_i(),pa=We(),ma=mt(),W0=kt(),xi=dn(),p5=US(),m5=j0(),g5=GS(),y5=HS(),v5=q0(),_5=1024,b5=`
|
|
269
269
|
`,S5={rdf:xi.Namespace.RDF.iri.value,rdfs:xi.Namespace.RDFS.iri.value,owl:xi.Namespace.OWL.iri.value,xsd:xi.Namespace.XSD.iri.value,exo:xi.Namespace.EXO.iri.value,ems:xi.Namespace.EMS.iri.value},H0=class{static{o(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new p5.TurtleSerializer,this.nTriplesSerializer=new m5.NTriplesSerializer,this.jsonldSerializer=new g5.JSONLDSerializer,this.turtleParser=new y5.TurtleParser,this.nTriplesParser=new v5.NTriplesParser}async serialize(e,t={}){let r=await this.store.match();return this.serializeTriples(r,e,t)}serializeTriples(e,t,r={}){switch(t){case"turtle":return this.turtleSerializer.serialize(e,{prefixes:r.prefixes,includeDefaultPrefixes:r.includeDefaultPrefixes,newline:r.newline});case"n-triples":return this.nTriplesSerializer.serialize(e,{newline:r.newline});case"json-ld":return this.jsonldSerializer.serialize(e,{context:r.prefixes,pretty:r.pretty,indent:r.indent});default:throw new Error(`Unsupported serialization format: ${t}`)}}stream(e,t={}){let r=t.newline??b5,i=t.batchSize??_5,s=t.includeDefaultPrefixes,a=t.prefixes,c=this,l=!1,u=[],f=[],h=0,d=o(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let _=c.jsonldSerializer.toDocument(f,{context:a,pretty:!1});u.push(...c.buildJsonLdChunks(_))}else if(e==="turtle"){let _=c.turtleSerializer.serializePrefixes(c.composePrefixes(a,s),r);_&&u.push(`${_}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await d(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(h>=f.length)return{value:void 0,done:!0};let _=f.slice(h,h+i);h+=_.length;let b="";if(e==="turtle"){let E=c.turtleSerializer.serializeTriplesOnly(_,r);E&&(b=`${E}${r}`)}else e==="n-triples"&&(b=c.nTriplesSerializer.serializeChunk(_,r));return b?{value:b,done:!1}:this.next()},async return(){return u=[],f=[],h=0,{value:void 0,done:!0}},[Symbol.asyncIterator](){return this}}}async load(e,t,r={}){let i=this.parse(e,t,r);return r.mode!=="append"&&await this.store.clear(),await this.store.addAll(i),i.length}parse(e,t,r={}){switch(t){case"turtle":return this.turtleParser.parse(e,this.buildTurtleParseOptions(r));case"n-triples":return this.nTriplesParser.parse(e,this.buildNTriplesParseOptions(r));case"json-ld":return this.parseJsonLd(e,r);default:throw new Error(`Unsupported serialization format: ${t}`)}}buildTurtleParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}buildNTriplesParseOptions(e){return{prefixes:this.composePrefixes(e.prefixes,!0),strict:e.strict}}composePrefixes(e,t){return t??!0?{...S5,...e??{}}:{...e??{}}}parseJsonLd(e,t){let r;try{r=JSON.parse(e)}catch(u){throw new Error(`Invalid JSON-LD document: ${u.message}`)}let i=this.composePrefixes(t.prefixes,!0),s=this.extractContext(r),a={...i,...s},c=this.extractGraph(r),l=[];return c.forEach((u,f)=>{if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`Invalid JSON-LD node at index ${f}`);let h=this.parseSubjectFromNode(u,a,f),d=Object.entries(u);for(let[p,_]of d){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(h,_,l,a);continue}let b=this.expandTerm(p,a),E=new pa.IRI(b);this.collectTriplesForValue(h,E,_,l,a)}}),l}extractContext(e){if(!e||typeof e!="object"||Array.isArray(e))return{};let t=e["@context"];if(!t||typeof t!="object"||Array.isArray(t))return{};let r={};return Object.entries(t).forEach(([i,s])=>{typeof s=="string"&&(r[i]=s)}),r}extractGraph(e){if(Array.isArray(e))return e;if(!e||typeof e!="object")return[];let t=e["@graph"];return Array.isArray(t)?t:[e]}parseSubjectFromNode(e,t,r){let i=e["@id"];if(typeof i=="string"){if(i.startsWith("_:"))return new W0.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new pa.IRI(i);let s=this.expandTerm(i,t);return new pa.IRI(s)}return new W0.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=xi.Namespace.RDF.term("type");(Array.isArray(t)?t:[t]).forEach(c=>{if(typeof c!="string")throw new Error("Invalid @type value in JSON-LD node");let l=this.expandTerm(c,i);r.push(new oo.Triple(e,s,new pa.IRI(l)))})}collectTriplesForValue(e,t,r,i,s){if(r!=null){if(Array.isArray(r)){r.forEach(a=>this.collectTriplesForValue(e,t,a,i,s));return}if(typeof r=="object"){let a=r;if(typeof a["@id"]=="string"){let c=this.parseIdNode(a["@id"],s);i.push(new oo.Triple(e,t,c));return}if(a["@value"]!==void 0){let c=this.parseLiteralObject(a,s);i.push(new oo.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new oo.Triple(e,t,new ma.Literal(r)));return}if(typeof r=="number"){let a=Number.isInteger(r)?xi.Namespace.XSD.term("integer"):xi.Namespace.XSD.term("decimal");i.push(new oo.Triple(e,t,new ma.Literal(r.toString(),a)));return}if(typeof r=="boolean"){let a=xi.Namespace.XSD.term("boolean");i.push(new oo.Triple(e,t,new ma.Literal(r.toString(),a)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new W0.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new pa.IRI(e);let r=this.expandTerm(e,t);return new pa.IRI(r)}parseLiteralObject(e,t){let r=e["@value"];if(typeof r!="string")throw new Error("JSON-LD literal values must be strings");if(typeof e["@language"]=="string"){let i=e["@direction"];return i==="ltr"||i==="rtl"?new ma.Literal(r,void 0,e["@language"],i):new ma.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new ma.Literal(r,new pa.IRI(i))}return new ma.Literal(r)}expandTerm(e,t){if(this.isAbsoluteIri(e))return e;let r=e.indexOf(":");if(r>0){let s=e.slice(0,r),a=e.slice(r+1),c=t[s];if(!c)throw new Error(`Unknown prefix "${s}" in JSON-LD document`);return`${c}${a}`}let i=t["@vocab"];if(i)return`${i}${e}`;throw new Error(`Unable to expand JSON-LD term "${e}"`)}isAbsoluteIri(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)}buildJsonLdChunks(e){let t=[],r=JSON.stringify(e["@context"]);return t.push(`{"@context":${r},"@graph":[`),e["@graph"].forEach((i,s)=>{let a=JSON.stringify(i);s>0?t.push(`,${a}`):t.push(a)}),t.push(`]}
|
|
270
|
-
`),t}};Hf.RDFSerializer=H0});var K0=v(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.TransactionError=vs.TripleNotFoundError=vs.TripleAlreadyExistsError=void 0;var z0=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};vs.TripleAlreadyExistsError=z0;var Q0=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};vs.TripleNotFoundError=Q0;var Y0=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};vs.TransactionError=Y0});var Qf=v(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.LRUCache=void 0;var X0=class{static{o(this,"LRUCache")}constructor(e){this.maxSize=e,this.cache=new Map}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};zf.LRUCache=X0});var QS=v(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.InMemoryTripleStore=void 0;var _s=K0(),Yf=We(),w5=kt(),E5=mt(),T5=dn(),x5=Qf(),A5=T5.Namespace.XSD.term("string").value,C5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,co="__default__",J0=class n{static{o(this,"InMemoryTripleStore")}constructor(){this.triples=new Map,this.spo=new Map,this.sop=new Map,this.pso=new Map,this.pos=new Map,this.osp=new Map,this.ops=new Map,this.queryCache=new x5.LRUCache(1e3),this.uuidIndex=new Map,this.namedGraphs=new Map}async add(e){let t=this.getTripleKey(e);if(this.triples.has(t))return;this.triples.set(t,e);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);this.addToIndex(this.spo,r,i,s),this.addToIndex(this.sop,r,s,i),this.addToIndex(this.pso,i,r,s),this.addToIndex(this.pos,i,s,r),this.addToIndex(this.osp,s,r,i),this.addToIndex(this.ops,s,i,r),this.addToUUIDIndex(e.subject),this.queryCache.clear()}async remove(e){let t=this.getTripleKey(e);if(!this.triples.has(t))return!1;this.triples.delete(t);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);return this.removeFromIndex(this.spo,r,i,s),this.removeFromIndex(this.sop,r,s,i),this.removeFromIndex(this.pso,i,r,s),this.removeFromIndex(this.pos,i,s,r),this.removeFromIndex(this.osp,s,r,i),this.removeFromIndex(this.ops,s,i,r),this.queryCache.clear(),!0}async has(e){let t=this.getTripleKey(e);return this.triples.has(t)}async match(e,t,r){let i=this.getMatchCacheKey(e,t,r),s=this.queryCache.get(i);if(s!==void 0)return s;let a;return!e&&!t&&!r?a=Array.from(this.triples.values()):e&&t&&r?a=this.matchSPO(e,t,r):e&&t?a=this.matchSP(e,t):e&&r?a=this.matchSO(e,r):t&&r?a=this.matchPO(t,r):e?a=this.matchS(e):t?a=this.matchP(t):r?a=this.matchO(r):a=[],this.queryCache.set(i,a),a}async addAll(e){for(let t of e)await this.add(t)}async removeAll(e){let t=0;for(let r of e)await this.remove(r)&&t++;return t}async clear(){this.triples.clear(),this.spo.clear(),this.sop.clear(),this.pso.clear(),this.pos.clear(),this.osp.clear(),this.ops.clear(),this.uuidIndex.clear(),this.queryCache.clear()}async count(){return this.triples.size}async subjects(){let e=new Set;for(let t of this.triples.values())e.add(t.subject);return Array.from(e)}async predicates(){let e=new Set;for(let t of this.triples.values())e.add(t.predicate);return Array.from(e)}async objects(){let e=new Set;for(let t of this.triples.values())e.add(t.object);return Array.from(e)}async beginTransaction(){return new Z0(this)}async findSubjectsByUUID(e){return this.findSubjectsByUUIDSync(e)}findSubjectsByUUIDSync(e){let t=e.toLowerCase(),r=this.uuidIndex.get(t);if(!r||r.size===0)return[];let i=[];for(let s of r)this.spo.has(`i:${s}`)&&i.push(new Yf.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof Yf.IRI))return;let t=e.value,r=t.match(C5);if(r)for(let i of r){let s=i.toLowerCase();this.uuidIndex.has(s)||this.uuidIndex.set(s,new Set),this.uuidIndex.get(s).add(t)}}matchSPO(e,t,r){let i=this.getNodeKey(e),s=this.getNodeKey(t),a=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(a)){let u=this.buildTripleKey(i,s,a),f=this.triples.get(u);return f?[f]:[]}return[]}matchSP(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.spo.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,i,c))):[]}matchSO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.sop.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,c,i))):[]}matchPO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.pos.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(c,r,i))):[]}matchS(e){let t=this.getNodeKey(e),r=this.spo.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(t,s,c));return this.getTriplesByKeys(i)}matchP(e){let t=this.getNodeKey(e),r=this.pso.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,t,c));return this.getTriplesByKeys(i)}matchO(e){let t=this.getNodeKey(e),r=this.osp.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,c,t));return this.getTriplesByKeys(i)}getTriplesByKeys(e){let t=[];for(let r of e){let i=this.triples.get(r);i&&t.push(i)}return t}addToIndex(e,t,r,i){e.has(t)||e.set(t,new Map);let s=e.get(t);s.has(r)||s.set(r,new Set),s.get(r).add(i)}removeFromIndex(e,t,r,i){let s=e.get(t);if(!s)return;let a=s.get(r);a&&(a.delete(i),a.size===0&&s.delete(r),s.size===0&&e.delete(t))}getTripleKey(e){let t=this.getNodeKey(e.subject),r=this.getNodeKey(e.predicate),i=this.getNodeKey(e.object);return this.buildTripleKey(t,r,i)}buildTripleKey(e,t,r){return`${e}|${t}|${r}`}getNodeKey(e){if(e instanceof Yf.IRI)return`i:${e.value}`;if(e instanceof w5.BlankNode)return`b:${e.id}`;if(e instanceof E5.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==A5?t+=`^^${e.datatype.value}`:e.language&&(t+=`@${e.language}`),t}return""}getMatchCacheKey(e,t,r){let i=e?this.getNodeKey(e):"?",s=t?this.getNodeKey(t):"?",a=r?this.getNodeKey(r):"?";return`${i}|${s}|${a}`}getGraphKey(e){return e?e.value:co}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===co?this:(this.namedGraphs.has(t)||this.namedGraphs.set(t,new n),this.namedGraphs.get(t))}async addToGraph(e,t){await this.getOrCreateGraphStore(t).add(e)}async removeFromGraph(e,t){let r=this.getGraphKey(t);if(r===co)return this.remove(e);let i=this.namedGraphs.get(r);return i?i.remove(e):!1}async matchInGraph(e,t,r,i){let s=this.getGraphKey(i);if(s===co)return this.match(e,t,r);let a=this.namedGraphs.get(s);return a?a.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new Yf.IRI(e))}async hasGraph(e){let t=this.namedGraphs.get(e.value);return t?await t.count()>0:!1}async clearGraph(e){let t=this.getGraphKey(e);if(t===co){await this.clear();return}let r=this.namedGraphs.get(t);r&&(await r.clear(),this.namedGraphs.delete(t))}async countInGraph(e){let t=this.getGraphKey(e);if(t===co)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Kf.InMemoryTripleStore=J0;var Z0=class{static{o(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");for(let e of this.operations)e.type==="add"?await this.store.add(e.triple):await this.store.remove(e.triple);this.committed=!0,this.operations=[]}async rollback(){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var ty=v(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});Xf.RDFVocabularyMapper=void 0;var tn=_i(),YS=We(),we=dn(),ey=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",we.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",we.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",we.Namespace.RDFS.term("subClassOf")],["exo__Property_range",we.Namespace.RDFS.term("range")],["exo__Property_domain",we.Namespace.RDFS.term("domain")],["exo__Property_superProperty",we.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new tn.Triple(we.Namespace.EXO.term("Asset"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.RDFS.term("Resource"))),e.push(new tn.Triple(we.Namespace.EXO.term("Class"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.RDFS.term("Class"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.RDF.term("Property"))),e.push(new tn.Triple(we.Namespace.EMS.term("Task"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.EXO.term("Asset"))),e.push(new tn.Triple(we.Namespace.EMS.term("Project"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.EXO.term("Asset"))),e.push(new tn.Triple(we.Namespace.EMS.term("Area"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new tn.Triple(we.Namespace.EXO.term("Instance_class"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDF.term("type"))),e.push(new tn.Triple(we.Namespace.EXO.term("Asset_isDefinedBy"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("isDefinedBy"))),e.push(new tn.Triple(we.Namespace.EXO.term("Class_superClass"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("subClassOf"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property_range"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("range"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property_domain"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("domain"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property_superProperty"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof YS.IRI)s=r;else{let a=r.match(/^(ems|exo)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?we.Namespace.EMS:we.Namespace.EXO).term(l)}else s=new YS.IRI(r)}return new tn.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Xf.RDFVocabularyMapper=ey});var KS=v(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.RDFSInferenceEngine=void 0;var I5=_i(),Jf=We(),ry=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(h=>h.value.includes("Class_superClass")),i=t.find(h=>h.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let a=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let h of l)if(h.object instanceof Jf.IRI){let d=a.get(h.object.value);if(d)for(let p of d)u.push(new I5.Triple(h.subject,i,new Jf.IRI(p)))}return u.length>0&&await e.addAll(u),await e.count()-c}async buildDirectParentMap(e,t){let r=await e.match(void 0,t),i=new Map;for(let s of r)if(s.subject instanceof Jf.IRI&&s.object instanceof Jf.IRI){let a=s.subject.value,c=s.object.value;i.has(a)||i.set(a,new Set),i.get(a).add(c)}return i}computeAllAncestors(e){let t=new Map;for(let r of e.keys())t.has(r)||t.set(r,this.computeAncestorsBFS(r,e));return t}computeAncestorsBFS(e,t){let r=new Set,i=new Set,s=[],a=t.get(e);if(a)for(let c of a)s.push(c);for(;s.length>0;){let c=s.shift();if(i.has(c))continue;i.add(c),r.add(c);let l=t.get(c);if(l)for(let u of l)i.has(u)||s.push(u)}return r}};Zf.RDFSInferenceEngine=ry});var ny=v(ti=>{"use strict";var O5=ti&&ti.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},P5=ti&&ti.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},R5=ti&&ti.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ti,"__esModule",{value:!0});ti.NoteToRDFConverter=void 0;var XS=Ve(),Hr=_i(),lo=We(),rn=mt(),JS=kt(),Nr=dn(),F5=lt(),D5=ty(),zr=jm(),uo=class{static{o(this,"NoteToRDFConverter")}constructor(e){this.vault=e,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new D5.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?zr.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Nr.Namespace.EXO.term("Asset_fileName");r.push(new Hr.Triple(i,s,new rn.Literal(e.basename)));for(let[c,l]of Object.entries(t)){if(!this.isExocortexProperty(c))continue;let u=this.propertyKeyToIRI(c),f=Array.isArray(l)?l:[l];for(let h of f)if(c==="exo__Instance_class"){let d=this.valueToClassURI(h);r.push(new Hr.Triple(i,u,d))}else{let d=await this.valueToRDFObject(h,e);for(let p of d)if(r.push(new Hr.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof lo.IRI){let _=this.vocabularyMapper.generateMappedTriple(i,c,p);_&&r.push(_)}}if(c==="exo__Instance_class")for(let h of f){let d=this.expandClassValue(h);if(d){let p=Nr.Namespace.RDF.term("type");r.push(new Hr.Triple(i,p,d))}}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=zr.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case zr.Exo003MetadataType.Namespace:break;case zr.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case zr.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case zr.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case zr.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new lo.IRI(t.uri);return[new Hr.Triple(r,Nr.Namespace.OWL.term("sameAs"),i),new Hr.Triple(i,Nr.Namespace.OWL.term("sameAs"),r)]}convertExo003BlankNode(e,t){let r=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new Hr.Triple(r,Nr.Namespace.OWL.term("sameAs"),new JS.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=zr.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new Hr.Triple(a,Nr.Namespace.RDF.term("value"),s.subject))}catch{}return r}async convertExo003Body(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.createExo003ReferenceResolver(e),c=a(t.subject),l=a(t.predicate);if(c.type==="literal")throw new Error("Body subject cannot be a literal");if(l.type!=="iri")throw new Error("Body predicate must be an IRI");let u=c.type==="iri"?new lo.IRI(c.value):new JS.BlankNode(c.value),f=new lo.IRI(l.value),h=zr.Exo003Parser.toLiteral(t,s.trim());r.push(new Hr.Triple(u,f,h));let d=this.notePathToIRI(e.path);r.push(new Hr.Triple(d,Nr.Namespace.RDF.term("value"),u))}catch{}return r}createExo003ReferenceResolver(e){return t=>{let r=this.extractWikilink(t),i=r||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let a=this.vault.getFrontmatter(s);if(a&&zr.Exo003Parser.isExo003Format(a)){let c=zr.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===zr.Exo003MetadataType.Anchor||l.metadata===zr.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===zr.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=await this.convertNote(a);r.push(...c)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),console.warn(`\u26A0\uFE0F Skipping file with invalid IRI: ${a.path}`),console.warn(` Reason: ${l}`)}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;lo.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new lo.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return e.startsWith("exo__")||e.startsWith("ems__")}propertyKeyToIRI(e){if(e.startsWith("exo__")){let t=e.substring(5);return Nr.Namespace.EXO.term(t)}if(e.startsWith("ems__")){let t=e.substring(5);return Nr.Namespace.EMS.term(t)}throw new Error(`Invalid property key: ${e}`)}async valueToRDFObject(e,t){if(typeof e=="string"){let r=this.removeQuotes(e),i=this.extractWikilink(r);if(i){let s=this.vault.getFirstLinkpathDest(i,t.path);if(s){let a=this.notePathToIRI(s.path);if(this.isUUID(i)){let c=new rn.Literal(i);return[a,c]}return[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new rn.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new rn.Literal(r,Nr.Namespace.XSD.term("dateTime"))]:[new rn.Literal(r)]}return typeof e=="boolean"?[new rn.Literal(e.toString())]:typeof e=="number"?[new rn.Literal(e.toString(),Nr.Namespace.XSD.term("decimal"))]:e instanceof Date?[new rn.Literal(e.toISOString(),Nr.Namespace.XSD.term("dateTime"))]:[new rn.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);return t?t[1]:null}valueToClassURI(e){if(typeof e!="string")return new rn.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);return s||new rn.Literal(t)}isClassReference(e){return(e.startsWith("ems__")||e.startsWith("exo__"))&&!/\s/.test(e)}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}expandClassValue(e){let t=this.removeQuotes(e);if(t.startsWith("ems__")){let r=t.substring(5);return Nr.Namespace.EMS.term(r)}if(t.startsWith("exo__")){let r=t.substring(5);return Nr.Namespace.EXO.term(r)}return null}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.extractBodyWikilinks(s),c=Nr.Namespace.EXO.term("Asset_bodyLink");for(let l of a){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new Hr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new Hr.Triple(t,c,f)):r.push(new Hr.Triple(t,c,new rn.Literal(l)))}else r.push(new Hr.Triple(t,c,new rn.Literal(l)))}}catch{}return r}};ti.NoteToRDFConverter=uo;uo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};uo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};uo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ti.NoteToRDFConverter=uo=O5([(0,XS.injectable)(),R5(0,(0,XS.inject)(F5.DI_TOKENS.IVaultAdapter)),P5("design:paramtypes",[Object])],uo)});var iy=v((Bz,ZS)=>{var fo=class{static{o(this,"Wildcard")}constructor(){return N5||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(fo.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(fo.prototype,"termType",{enumerable:!0,value:"Wildcard"});var N5=new fo;ZS.exports.Wildcard=fo});var tw=v((Gz,ew)=>{var L5=(function(){var n=o(function(I,x,O,F){for(O=O||{},F=I.length;F--;O[I[F]]=x);return O},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],h=[1,45],d=[1,41],p=[1,44],_=[123,126],b=[1,67],E=[39,45,87],A=[13,16,45,197,224,308],C=[1,87],M=[2,281],G=[1,86],Q=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],H=[6,28,29,53,63,70,73,81,83,85],ee=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],Se=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],N=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],Y=[13,16,308],ge=[112,132,327,334],dt=[13,16,112,132,308],nt=[1,111],vt=[1,117],Ke=[112,132,327,328,334],Je=[13,16,112,132,308,328],Ue=[28,29,45,53,87],te=[1,138],$=[1,151],Ze=[1,128],it=[1,127],B=[1,129],Te=[1,140],Ne=[1,141],J=[1,142],Le=[1,143],ke=[1,144],Re=[1,145],Me=[1,147],ye=[1,148],Fe=[2,457],xe=[1,158],De=[1,159],je=[1,160],se=[1,152],le=[1,153],ue=[1,156],ae=[1,171],oe=[1,172],ce=[1,173],ie=[1,174],fe=[1,175],he=[1,176],de=[1,167],pe=[1,168],ne=[1,169],me=[1,170],Ge=[1,157],$e=[1,166],Pe=[1,161],S=[1,162],w=[1,163],T=[1,164],P=[1,165],K=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],ot=[1,195],pt=[6,31,73,81,83,85],Ce=[2,285],V=[1,199],U=[1,201],q=[6,31,70,73,81,83,85],z=[2,283],Ee=[1,207],He=[1,218],ze=[1,223],Jt=[1,219],Br=[1,225],Jr=[1,226],xr=[1,224],yv=[6,63,70,73,81,83,85],vv=[1,236],_v=[2,334],bv=[1,243],Sv=[1,241],Zt=[6,193],cu=[2,349],wv=[2,339],cs=[28,128],Ev=[47,48,193,272],lu=[47,48,193,242,272],$a=[47,48,193,242,246,272],Va=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Bt=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],Tv=[1,271],xv=[1,270],Pt=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],Av=[1,281],Cv=[1,280],Ar=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],wc=[45,89],uu=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],fu=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],hu=[31,89],du=[48,87],$s=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],di=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],Iv=[1,313],Ua=[6,85],mp=[6,31,81,83,85],Ov=[2,361],ji=[2,353],Vs=[1,343],Ec=[31,112,335],$i=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],gp=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],Pv=[6,109,193],Us=[31,112],Rt=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],yp=[1,390],vp=[1,391],ls=[13,16,87,197,308,314],Rv=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],pu=[1,417],mu=[1,418],Fv=[13,16,48,197,229,308],us=[6,31,85],Dv=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],_p=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],Bs=[29,31,85,112,159,160,161,163,164],gu=[1,443],yu=[1,444],Nv=[1,449],qs=[31,112,193,232,318,335],vu=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Lv=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],bp=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Tc=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],xc=[31,45],kv=[1,507],Mv=[1,508],jv=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],_u=[29,31,85,112,159,160,161,163,164,335],Gs=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$v=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Vv=[2,352],Sp=[13,16,197,308,314],Uv=[1,565],Ba=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],Bv=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Vi=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],qv=[13,16,87,308],Ui=[2,364],qa=[29,31,85,112,159,160,161,163,164,193,232,318,335],bu=[31,112,193,232,272,318,335],Bi=[2,359],Gv=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Su=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],Wv=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Hv=[2,347],wp={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:o(function(x,O,F,Z,Ae,m,Ir){var g=m.length-1;switch(Ae){case 1:if(m[g-1]=m[g-1]||{},Oe.base&&(m[g-1].base=Oe.base),Oe.base="",m[g-1].prefixes=Oe.prefixes,Oe.prefixes=null,Oe.pathOnly){if(m[g-1].type==="path"||"termType"in m[g-1])return m[g-1];throw new Error("Received full SPARQL query in path only mode")}else if(m[g-1].type==="path"||"termType"in m[g-1])throw new Error("Received only path in full SPARQL mode");if(m[g-1].type==="update"){let ct={};for(let St of m[g-1].updates)if(St.updateType==="insert"){let Qe={};for(let et of St.insert)if(et.type==="bgp"||et.type==="graph")for(let qr of et.triples)qr.subject.termType==="BlankNode"&&(Qe[qr.subject.value]=!0),qr.predicate.termType==="BlankNode"&&(Qe[qr.predicate.value]=!0),qr.object.termType==="BlankNode"&&(Qe[qr.object.value]=!0);for(let et of Object.keys(Qe)){if(ct[et])throw new Error("Detected reuse blank node across different INSERT DATA clauses");ct[et]=!0}}}return m[g-1];case 2:this.$={...m[g-1],...m[g],type:"query"};break;case 4:Oe.base=Ac(m[g]);break;case 5:Oe.prefixes||(Oe.prefixes={}),m[g-1]=m[g-1].substr(0,m[g-1].length-1),m[g]=Ac(m[g]),Oe.prefixes[m[g-1]]=m[g];break;case 6:this.$={...m[g-3],...zs(m[g-2]),...m[g-1],...m[g]};break;case 7:if(!Oe.skipValidation&&(Pp(m[g-3].variables.map(St=>Op(St.expression))).some(St=>St.aggregation==="count"&&!(St.expression instanceof wu))||m[g].group)){for(let St of m[g-3].variables)if(St.termType==="Variable"){if(!m[g].group||!m[g].group.map(Qe=>za(Qe)).includes(za(St)))throw Error("Projection of ungrouped variable (?"+za(St)+")")}else if(Op(St.expression).length===0){let Qe=mI(St.expression);for(let et of Qe)if(!m[g].group||!m[g].group.map||!m[g].group.map(qr=>za(qr)).includes(za(et)))throw Error("Use of ungrouped variable in projection of operation (?"+za(et)+")")}}let yi=m[g-1].where.filter(ct=>ct.type==="query");if(yi.length>0){let ct=m[g-3].variables.filter(Qe=>Qe.variable&&Qe.variable.value).map(Qe=>Qe.variable.value),St=Pp(yi.map(Qe=>Qe.variables)).map(Qe=>Qe.value||Qe.variable.value);for(let Qe of ct)if(St.indexOf(Qe)>=0)throw Error("Target id of 'AS' (?"+Qe+") already used in subquery")}this.$=xt(m[g-3],zs(m[g-2]),m[g-1],m[g]);break;case 8:this.$=xt({queryType:"CONSTRUCT",template:m[g-3]},zs(m[g-2]),m[g-1],m[g]);break;case 9:this.$=xt({queryType:"CONSTRUCT",template:m[g-2]=m[g-2]?m[g-2].triples:[]},zs(m[g-5]),{where:[{type:"bgp",triples:Hs([],m[g-2])}]},m[g]);break;case 10:this.$=xt({queryType:"DESCRIBE",variables:m[g-3]==="*"?[new wu]:m[g-3]},zs(m[g-2]),m[g-1],m[g]);break;case 11:this.$=xt({queryType:"ASK"},zs(m[g-2]),m[g-1],m[g]);break;case 12:this.$=xt(m[g-1],{variables:[new wu]});break;case 13:let Rc=m[g].map(ct=>ct.value||ct.variable.value),Qa=gI(Rc);if(Qa.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Qa[0]+")");this.$=xt(m[g-1],{variables:m[g]});break;case 14:this.$=xt({queryType:"SELECT"},m[g]&&(m[g-1]=Cr(m[g]),m[g]={},m[g][m[g-1]]=!0,m[g]));break;case 16:case 27:this.$=Ga(m[g-3],{variable:m[g-1]});break;case 17:case 18:this.$=xt(m[g-3],m[g-2],m[g-1],m[g],{type:"query"});break;case 19:case 58:this.$={iri:m[g],named:!!m[g-1]};break;case 20:this.$={where:m[g].patterns};break;case 21:this.$=xt(m[g-1],m[g]);break;case 22:this.$=xt(m[g-2],m[g-1],m[g]);break;case 23:this.$={group:m[g]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=Ga(m[g]);break;case 26:this.$=Ga(m[g-1]);break;case 29:this.$={having:m[g]};break;case 30:this.$={order:m[g]};break;case 32:this.$=Ga(m[g],{descending:!0});break;case 35:this.$={limit:Ha(m[g])};break;case 36:this.$={offset:Ha(m[g])};break;case 37:this.$={limit:Ha(m[g-2]),offset:Ha(m[g])};break;case 38:this.$={limit:Ha(m[g]),offset:Ha(m[g-2])};break;case 39:case 43:this.$={type:"values",values:m[g]};break;case 40:case 84:this.$=m[g-1].map(ct=>({[m[g-3]]:ct}));break;case 41:case 85:this.$=m[g-1].map(()=>({}));break;case 42:case 86:var gi=m[g-4].length;m[g-4]=m[g-4].map(Ep),this.$=m[g-1].map(function(ct){if(ct.length!==gi)throw Error("Inconsistent VALUES length");for(var St={},Qe=0;Qe<gi;Qe++)St["?"+m[g-4][Qe].value]=ct[Qe];return St});break;case 44:case 65:case 100:case 126:case 175:this.$=m[g-1];break;case 45:this.$={type:"update",updates:qi(m[g-2],m[g-1])};break;case 46:this.$=xt({type:"load",silent:!!m[g-2],source:m[g-1]},m[g]&&{destination:m[g]});break;case 47:this.$={type:Cr(m[g-2]),silent:!!m[g-1],graph:m[g]};break;case 48:this.$={type:Cr(m[g-4]),silent:!!m[g-3],source:m[g-2],destination:m[g]};break;case 49:this.$={type:"create",silent:!!m[g-2],graph:{type:"graph",name:m[g]}};break;case 50:this.$={updateType:"insert",insert:n_(m[g])};break;case 51:this.$={updateType:"delete",delete:Dp(n_(m[g]))};break;case 52:this.$={updateType:"deletewhere",delete:Dp(m[g])};break;case 53:this.$={updateType:"insertdelete",...m[g-4],...m[g-3],...zs(m[g-2],"using"),where:m[g].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=m[g];break;case 55:this.$={delete:Dp(m[g-1]),insert:m[g]||[]};break;case 56:this.$={delete:[],insert:m[g]};break;case 59:this.$={graph:m[g]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:m[g]};break;case 64:this.$={[Cr(m[g])]:!0};break;case 66:this.$=m[g-1]?pi(m[g],[m[g-1]]):pi(m[g]);break;case 67:var Oc=xt(m[g-3]||{triples:[]},{type:"graph",name:m[g-5]});this.$=m[g]?[Oc,m[g]]:[Oc];break;case 68:case 73:this.$={type:"bgp",triples:pi(m[g-2],[m[g-1]])};break;case 69:this.$={type:"group",patterns:[m[g-1]]};break;case 70:for(let ct of m[g-1].filter(St=>St.type==="bind")){let St=m[g-1].indexOf(ct),Qe=new Set;for(let et of m[g-1].slice(0,St))(et.type==="group"||et.type==="bgp")&&t_(et).forEach(qr=>Qe.add(qr));if(Qe.has(ct.variable.value))throw Error("Variable used to bind is already bound (?"+ct.variable.value+")")}this.$={type:"group",patterns:m[g-1]};break;case 71:this.$=m[g-1]?pi([m[g-1]],m[g]):pi(m[g]);break;case 72:this.$=m[g]?[m[g-2],m[g]]:m[g-2];break;case 75:this.$=xt(m[g],{type:"optional"});break;case 76:this.$=xt(m[g],{type:"minus"});break;case 77:this.$=xt(m[g],{type:"graph",name:m[g-1]});break;case 78:this.$=xt(m[g],{type:"service",name:m[g-1],silent:!!m[g-2]});break;case 79:this.$={type:"filter",expression:m[g]};break;case 80:this.$={type:"bind",variable:m[g-1],expression:m[g-3]};break;case 89:this.$=Ic(m[g]);break;case 90:this.$=void 0;break;case 91:this.$=m[g-1].length?{type:"union",patterns:pi(m[g-1].map(xp),[xp(m[g])])}:m[g];break;case 95:this.$={...m[g],function:m[g-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:qi(m[g-2],m[g-1]),distinct:!!m[g-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=qi(m[g-2],m[g-1]);break;case 101:this.$=pi(m[g-2],[m[g-1]]);break;case 102:case 112:this.$=Fp(m[g].map(ct=>xt(Gi(m[g-1]),ct)));break;case 103:this.$=Fp(Hs(m[g].map(ct=>xt(Gi(m[g-1].entity),ct)),m[g-1].triples));break;case 105:this.$=pi([m[g-1]],m[g]);break;case 106:this.$=pi(m[g]);break;case 107:this.$=Ip(m[g-1],m[g]);break;case 109:case 237:this.$=Oe.factory.namedNode(sI);break;case 110:case 118:this.$=qi(m[g-1],m[g]);break;case 111:this.$=m[g]?{annotation:m[g],object:m[g-1]}:m[g-1];break;case 113:this.$=m[g]?Fp(Hs(m[g].map(ct=>xt(Gi(m[g-1].entity),ct)),m[g-1].triples)):m[g-1].triples;break;case 114:this.$=Ip(...m[g-1],m[g]);break;case 116:this.$=Ip(...m[g]);break;case 117:case 159:case 163:this.$=[m[g-1],m[g]];break;case 119:this.$=m[g]?{object:m[g-1],annotation:m[g]}:m[g-1];break;case 120:this.$=m[g-1].length?Wa("|",qi(m[g-1],m[g])):m[g];break;case 121:this.$=m[g-1].length?Wa("/",qi(m[g-1],m[g])):m[g];break;case 122:this.$=m[g]?Wa(m[g],[m[g-1]]):m[g-1];break;case 123:this.$=m[g-1]?Wa(m[g-1],[m[g]]):m[g];break;case 125:case 131:this.$=Wa(m[g-1],[m[g]]);break;case 129:this.$=Wa("|",qi(m[g-2],m[g-1]));break;case 132:case 134:this.$=dI(m[g-1]);break;case 133:case 135:this.$=pI(m[g-1]);break;case 140:this.$={entity:m[g],triples:[]};break;case 145:this.$=Ep(m[g]);break;case 149:this.$=Oe.factory.namedNode(zv);break;case 151:case 153:case 158:case 162:this.$=Tp(m[g-1],m[g]);break;case 152:this.$=["||",m[g]];break;case 154:this.$=["&&",m[g]];break;case 156:this.$=er(m[g-1],[m[g-2],m[g]]);break;case 157:this.$=er(m[g-2]?"notin":"in",[m[g-3],m[g]]);break;case 160:this.$=["+",Tp(m[g-1],m[g])];break;case 161:var xu=mi(m[g-1].value.replace("-",""),m[g-1].datatype);this.$=["-",Tp(xu,m[g])];break;case 164:this.$=er("UPLUS",[m[g]]);break;case 165:this.$=er(m[g-1],[m[g]]);break;case 166:this.$=er("UMINUS",[m[g]]);break;case 177:this.$=er(Cr(m[g-1]));break;case 178:this.$=er(Cr(m[g-3]),[m[g-1]]);break;case 179:this.$=Ic(er(Cr(m[g-3]),[m[g-1]]));break;case 180:this.$=er(Cr(m[g-5]),[m[g-3],m[g-1]]);break;case 181:this.$=er(Cr(m[g-7]),[m[g-5],m[g-3],m[g-1]]);break;case 182:this.$=Ic(er(Cr(m[g-7]),[m[g-5],m[g-3],m[g-1]]));break;case 183:this.$=er(Cr(m[g-1]),m[g]);break;case 184:this.$=er("bound",[Ep(m[g-1])]);break;case 185:this.$=er(m[g-1],[]);break;case 186:this.$=er(m[g-3],[m[g-1]]);break;case 187:this.$=er(m[g-2]?"notexists":"exists",[xp(m[g])]);break;case 188:case 189:this.$=Ga(m[g-1],{type:"aggregate",aggregation:Cr(m[g-4]),distinct:!!m[g-2]});break;case 190:this.$=Ga(m[g-2],{type:"aggregate",aggregation:Cr(m[g-5]),distinct:!!m[g-3],separator:typeof m[g-1]=="string"?m[g-1]:" "});break;case 192:this.$=mi(m[g]);break;case 193:this.$=lI(m[g-1],Cr(m[g].substr(1)));break;case 194:this.$=mi(m[g-2],m[g]);break;case 195:case 204:this.$=mi(m[g],Qv);break;case 196:case 205:this.$=mi(m[g],Yv);break;case 197:case 206:this.$=mi(Cr(m[g]),Kv);break;case 200:this.$=mi(m[g].toLowerCase(),cI);break;case 201:this.$=mi(m[g].substr(1),Qv);break;case 202:this.$=mi(m[g].substr(1),Yv);break;case 203:this.$=mi(m[g].substr(1).toLowerCase(),Kv);break;case 207:case 208:this.$=e_(m[g],1);break;case 209:case 210:this.$=e_(m[g],3);break;case 211:this.$=Oe.factory.namedNode(Ac(m[g]));break;case 213:var Au=m[g].indexOf(":"),Pc=m[g].substr(0,Au),Cu=Oe.prefixes[Pc];if(!Cu)throw new Error("Unknown prefix: "+Pc);var Et=Ac(Cu+m[g].substr(Au+1));this.$=Oe.factory.namedNode(Et);break;case 214:if(m[g]=m[g].substr(0,m[g].length-1),!(m[g]in Oe.prefixes))throw new Error("Unknown prefix: "+m[g]);var Et=Ac(Oe.prefixes[m[g]]);this.$=Oe.factory.namedNode(Et);break;case 215:this.$=Cc(m[g].replace(/^(_:)/,""));break;case 216:this.$=Cc();break;case 217:case 218:case 232:this.$=Ic(Ap(m[g-3],m[g-2],m[g-1]));break;case 230:case 231:this.$=Ic(m[g-1]);break;case 248:case 250:case 252:case 254:case 256:case 260:case 264:case 268:case 270:case 292:case 294:case 296:case 298:case 300:case 302:case 304:case 306:case 329:case 342:case 356:case 368:case 370:case 372:case 374:case 392:case 402:case 425:case 427:case 429:case 431:case 441:case 445:case 447:case 449:m[g-1].push(m[g]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[m[g]];break;case 308:m[g-3].push(m[g-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:m[g-2].push(m[g-1]);break}},"anonymous"),table:[n(e,t,{3:1,4:2,10:3}),{1:[3]},n(r,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:i,16:i,45:i,197:i,224:i,229:i,308:i,24:[1,13],32:[1,14],36:[1,15],41:s}),n([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:a},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:h,33:35,39:[1,37],44:39,55:40,87:d,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(_,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:b,87:d},n(E,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),n(e,[2,248]),n(e,[2,245]),n(e,[2,246]),{13:[1,72]},{16:[1,73]},{1:[2,1]},{6:[2,2]},{6:[2,244]},{45:[1,77],85:[1,78],86:74,87:[1,75],89:[1,76]},n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],[2,120],{337:[1,79]}),n(A,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:C,29:M,52:84,53:G,56:85},{19:88,28:C,29:M,52:89,53:G,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:G},n(Q,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(H,[2,263],{34:96}),n(H,[2,261],{44:39,55:40,307:43,139:97,13:f,16:h,87:d,308:p}),n(H,[2,262]),n(ee,[2,259]),n(Se,[2,143]),n(Se,[2,144]),n([6,13,16,28,29,31,39,45,47,48,53,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,145]),n(N,[2,211]),n(N,[2,212]),n(N,[2,213]),n(N,[2,214]),{19:98,28:C,29:M,52:99,53:G,56:85},{6:[2,309],99:100,193:[1,101]},n(Y,[2,311],{101:102,328:[1,103]}),n(ge,[2,317],{104:104,328:[1,105]}),n(dt,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:nt,114:110},{29:nt,114:112},{29:nt,114:113},{118:114,123:[1,115],125:116,126:vt},n(Ke,[2,315]),n(Ke,[2,316]),n(Je,[2,319]),n(Je,[2,320]),n(Je,[2,321]),n(_,[2,327]),{13:f,16:h,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:b,87:d}),n(Ue,[2,269]),n(Ue,[2,15]),{13:f,16:h,44:136,45:te,46:120,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(E,[2,14]),n(E,[2,274]),n(E,[2,271]),n(E,[2,272]),n(e,[2,4]),{13:[1,177]},n(K,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:h,45:[1,193],55:194,197:ot,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(A,[2,419]),n(pt,Ce,{20:196,59:197,69:198,70:V}),n(l,[2,250]),{29:U,57:200},n(Y,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(q,z,{23:204,58:205,62:206,63:Ee}),n(l,[2,252]),{19:208,28:C,29:M,52:209,53:G,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,145:212,172:221,185:213,187:214,231:Jt,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(yv,[2,265],{56:85,35:227,52:228,19:229,28:C,29:M,53:G}),n(ee,[2,260]),n(q,z,{58:205,62:206,23:230,63:Ee}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:h,55:232,307:43,308:p},n(Y,[2,312]),{105:233,112:vv,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(ge,[2,318]),n(Y,_v,{108:240,133:242,112:bv,132:Sv}),n(dt,[2,323]),{112:[1,244]},{112:[2,325]},n(Zt,[2,50]),n(Q,cu,{135:245,136:246,143:247,144:248,31:wv,112:wv}),n(Zt,[2,51]),n(Zt,[2,52]),n(cs,[2,328],{119:249}),{29:nt,114:250},n(cs,[2,56]),{29:nt,114:251},n(_,[2,59]),n(Ue,[2,270]),{47:[1,252]},n(Ev,[2,150]),n(lu,[2,428],{240:253}),n($a,[2,430],{244:254}),n($a,[2,155],{248:255,249:256,250:[2,438],290:[1,257],341:[1,258],342:[1,259],343:[1,260],344:[1,261],345:[1,262],346:[1,263]}),n(Va,[2,440],{252:264}),n(Bt,[2,448],{260:265}),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,255:154,257:155,264:266,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,255:154,257:155,264:267,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,255:154,257:155,264:268,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Bt,[2,167]),n(Bt,[2,168]),n(Bt,[2,169]),n(Bt,[2,170],{176:269,45:Tv,89:xv}),n(Bt,[2,171]),n(Bt,[2,172]),n(Bt,[2,173]),n(Bt,[2,174]),{13:f,16:h,44:136,45:te,46:272,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:Av,89:Cv,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(Ar,[2,192],{292:[1,286],293:[1,287]}),n(Ar,[2,195]),n(Ar,[2,196]),n(Ar,[2,197]),n(Ar,[2,198]),n(Ar,[2,199]),n(Ar,[2,200]),{13:f,16:h,44:39,55:40,82:$,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(wc,[2,452]),n(wc,[2,453]),n(wc,[2,454]),n(wc,[2,455]),n(wc,[2,456]),{279:[2,458]},n(uu,[2,207]),n(uu,[2,208]),n(uu,[2,209]),n(uu,[2,210]),n(Ar,[2,201]),n(Ar,[2,202]),n(Ar,[2,203]),n(Ar,[2,204]),n(Ar,[2,205]),n(Ar,[2,206]),n(e,[2,5]),n(fu,[2,297],{88:295}),n(hu,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(du,[2,301]),n(K,[2,43]),n(K,[2,82]),n(K,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n($s,[2,123]),n($s,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(di,[2,124]),{13:f,16:h,45:[1,311],55:194,89:[1,310],197:ot,223:312,225:308,226:309,229:Iv,307:43,308:p},n(c,i,{215:10,214:314}),n(di,[2,236]),n(di,[2,237]),n(Ua,[2,6]),n(mp,[2,287],{60:315,72:316,73:[1,317]}),n(pt,[2,286]),{13:f,16:h,45:te,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},n([6,31,63,70,73,81,83,85],[2,20]),n(Q,Ov,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:ji,31:ji,85:ji,112:ji,159:ji,160:ji,161:ji,163:ji,164:ji,41:s}),{13:f,16:h,55:331,307:43,308:p},n(Y,[2,280]),n(Ua,[2,7]),n(pt,Ce,{59:197,69:198,20:332,70:V}),n(q,[2,284]),{64:[1,333]},n(q,z,{58:205,62:206,23:334,63:Ee}),n(l,[2,254]),n(Q,cu,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:h,44:39,55:40,87:d,139:342,186:339,190:340,195:341,197:Vs,307:43,308:p},n(Ec,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:h,87:d,197:Vs,308:p}),n($i,[2,227]),n($i,[2,228]),n($i,[2,229]),{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,172:221,185:351,187:350,200:348,230:347,231:Jt,234:349,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},{13:f,16:h,44:39,55:40,87:d,139:342,186:352,190:340,195:341,197:Vs,307:43,308:p},n($i,[2,146]),n($i,[2,147]),n($i,[2,148]),n($i,[2,149]),{13:f,16:h,44:354,55:355,82:$,87:d,172:357,237:356,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:358,312:xr,313:353},n(gp,[2,215]),n(gp,[2,216]),n(q,z,{58:205,62:206,23:359,63:Ee}),n(H,[2,264]),n(yv,[2,266]),n(Ua,[2,11]),n(r,[2,308],{6:[2,310]}),n(Zt,[2,313],{102:360,120:361,121:[1,362]}),n(Zt,[2,47]),n(Zt,[2,63]),n(Zt,[2,64]),{13:f,16:h,55:363,307:43,308:p},n(Zt,[2,336]),n(Zt,[2,337]),n(Zt,[2,338]),{109:[1,364]},n(Pv,[2,60]),{13:f,16:h,55:365,307:43,308:p},n(Y,[2,335]),{13:f,16:h,55:366,307:43,308:p},{31:[1,367]},n(Us,[2,341],{137:368}),n(Us,[2,340]),{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,145:369,172:221,185:213,187:214,231:Jt,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},{28:[1,370],127:371,128:[1,372]},n(cs,[2,330],{124:373,125:374,126:vt}),n(cs,[2,57]),{44:375,87:d},n(Ev,[2,151],{241:376,242:[1,377]}),n(lu,[2,153],{245:378,246:[1,379]}),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,247:380,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{250:[1,381]},n(Rt,[2,432]),n(Rt,[2,433]),n(Rt,[2,434]),n(Rt,[2,435]),n(Rt,[2,436]),n(Rt,[2,437]),{250:[2,439]},n([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:ae,298:oe,299:ce,300:ie,301:fe,302:he}),n(Va,[2,162],{261:388,262:389,39:yp,338:vp}),n(Bt,[2,164]),n(Bt,[2,165]),n(Bt,[2,166]),n(Pt,[2,95]),n(Pt,[2,96]),n(Rt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Pt,[2,177]),{13:f,16:h,44:136,45:te,46:395,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:396,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:397,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:398,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:399,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,183]),n(Pt,[2,98]),n(Rt,[2,381],{180:400}),{87:[1,401]},n(Pt,[2,185]),{13:f,16:h,44:136,45:te,46:402,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{29:U,57:403},n(Ar,[2,193]),{13:f,16:h,55:404,307:43,308:p},{13:f,16:h,44:39,55:40,87:d,139:342,195:405,197:Vs,307:43,308:p},n(ls,[2,233]),n(ls,[2,234]),n(ls,[2,235]),n(Rv,[2,459],{281:406,325:[1,407]}),n(Rt,[2,463],{284:408,325:[1,409]}),n(Rt,[2,465],{286:410,325:[1,411]}),{13:f,16:h,31:[1,412],55:414,82:$,171:413,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},{31:[1,419],89:[1,420]},{29:[1,421]},n(du,[2,302]),n(fu,[2,367],{167:422}),n(hu,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(du,[2,371]),n($s,[2,122]),n($s,[2,417]),n($s,[2,413]),n($s,[2,414]),n($s,[2,415]),n(di,[2,125]),n(di,[2,127]),n(di,[2,128]),n(Fv,[2,420],{227:426}),n(di,[2,130]),{13:f,16:h,55:194,197:ot,223:427,307:43,308:p},{48:[1,428]},n(us,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(mp,[2,288]),{64:[1,433]},n(pt,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:h,45:te,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,276:Me,277:ye,279:Fe,280:xe,283:De,285:je,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P}),n(Dv,[2,293]),n(_p,[2,92]),n(_p,[2,93]),n(_p,[2,94]),{45:Tv,89:xv,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:C,29:M,56:85},{19:438,28:C,29:M,56:85},n(Bs,[2,355],{149:439}),n(Bs,[2,354]),{13:f,16:h,44:215,45:gu,55:220,82:$,87:d,89:ze,156:440,172:221,185:441,203:442,231:yu,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(H,[2,19]),n(us,[2,21]),{13:f,16:h,44:450,45:Nv,55:323,65:445,66:446,67:447,68:448,87:d,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Ua,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(Q,[2,386],{31:[2,388]}),n(Ec,[2,102]),n(qs,[2,391],{191:452}),n(Q,[2,395],{196:453,198:454}),n(Q,[2,108]),n(Q,[2,109]),n(Ec,[2,103]),n(Ec,[2,104]),n(Ec,[2,390]),{13:f,16:h,44:215,45:He,48:[1,455],55:220,82:$,87:d,89:ze,172:221,185:351,187:350,200:456,231:Jt,234:349,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(vu,[2,424]),n(Lv,[2,136]),n(Lv,[2,137]),n(bp,[2,140]),{232:[1,457]},{13:f,16:h,44:39,55:40,87:d,139:342,195:458,197:Vs,307:43,308:p},n(ls,[2,219]),n(ls,[2,220]),n(ls,[2,221]),n(ls,[2,222]),n(ls,[2,223]),n(Ua,[2,10]),n(Zt,[2,46]),n(Zt,[2,314]),{112:vv,122:459},n(Zt,[2,62]),n(Y,_v,{133:242,108:460,112:bv,132:Sv}),n(Pv,[2,61]),n(Zt,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Us,[2,351],{146:463,335:[1,464]}),{29:U,57:465},n(cs,[2,329]),n(Y,[2,332],{129:466,327:[1,467]}),n(cs,[2,55]),n(cs,[2,331]),{48:[1,468]},n(lu,[2,429]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n($a,[2,431]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,243:470,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n($a,[2,156]),{45:Av,89:Cv,179:471},n(Va,[2,441]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,251:472,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Bt,[2,444],{256:473}),n(Bt,[2,446],{258:474}),n(Rt,[2,442]),n(Rt,[2,443]),n(Bt,[2,449]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,255:154,257:155,259:475,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rt,[2,450]),n(Rt,[2,451]),n(Rt,[2,379],{178:476}),n(Rt,[2,378]),n([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:f,16:h,44:136,45:te,46:482,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{48:[1,483]},{48:[1,484]},n(Pt,[2,187]),n(Ar,[2,194]),{13:f,16:h,44:39,55:40,82:$,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,320:485},{13:f,16:h,39:[1,487],44:136,45:te,46:488,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,282:486,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rv,[2,460]),{13:f,16:h,44:136,45:te,46:489,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rt,[2,464]),{13:f,16:h,44:136,45:te,46:490,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rt,[2,466]),n(K,[2,40]),n(fu,[2,298]),n(Tc,[2,87]),n(Tc,[2,88]),n(Tc,[2,89]),n(Tc,[2,90]),{13:f,16:h,55:492,82:$,172:493,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,311:494,312:xr,315:491},n(K,[2,41]),n(hu,[2,300]),n(xc,[2,303],{92:495}),{13:f,16:h,31:[1,496],55:414,82:$,171:497,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},{31:[1,498],89:[1,499]},{29:[1,500]},n(du,[2,372]),{13:f,16:h,48:[2,422],55:194,197:ot,223:312,226:502,228:501,229:Iv,307:43,308:p},n(di,[2,131]),n(di,[2,126]),n(us,[2,22]),n(us,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:h,44:510,45:te,55:323,67:321,68:322,74:505,75:506,76:kv,77:320,78:Mv,79:509,87:d,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Dv,[2,294]),n(jv,[2,69]),n(jv,[2,70]),n(pt,Ce,{59:197,69:198,20:511,70:V}),n(q,z,{58:205,62:206,23:512,63:Ee}),{29:[2,375],31:[2,71],84:522,85:a,112:[1,518],150:513,151:514,158:515,159:[1,516],160:[1,517],161:[1,519],163:[1,520],164:[1,521],175:523},n(Bs,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:d}),n(_u,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:d}),{13:f,16:h,44:215,45:gu,55:220,82:$,87:d,89:ze,172:221,185:351,203:536,212:534,231:yu,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:d}),n(q,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:h,45:Nv,87:d,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,276:Me,277:ye,279:Fe,280:xe,283:De,285:je,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P}),n(Gs,[2,291]),n(Gs,[2,24]),n(Gs,[2,25]),{13:f,16:h,44:136,45:te,46:539,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Gs,[2,28]),n(q,z,{58:205,62:206,23:540,63:Ee}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(qs,[2,107]),{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,172:221,185:351,187:350,199:543,200:544,231:Jt,234:349,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n($v,[2,132]),n(vu,[2,425]),n($v,[2,133]),{13:f,16:h,44:354,55:355,82:$,87:d,172:357,237:356,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:358,312:xr,313:545},n(Zt,[2,54]),n(Zt,[2,48]),n(Us,[2,342]),{13:f,16:h,44:39,55:40,87:d,139:546,307:43,308:p},n(Us,[2,68]),n(Q,[2,350],{31:Vv,112:Vv}),n(Zt,[2,53]),{13:f,16:h,55:547,307:43,308:p},n(Y,[2,333]),n(Ue,[2,16]),n(lu,[2,152]),n($a,[2,154]),n($a,[2,157]),n(Va,[2,159]),n(Va,[2,160],{262:389,261:548,39:yp,338:vp}),n(Va,[2,161],{262:389,261:549,39:yp,338:vp}),n(Bt,[2,163]),{13:f,16:h,44:136,45:te,46:550,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,178]),n(Pt,[2,179]),{13:f,16:h,44:136,45:te,46:551,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:552,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:553,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{48:[1,554],272:[1,555]},n(Pt,[2,184]),n(Pt,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:f,16:h,55:194,197:ot,223:562,307:43,308:p},n(Sp,[2,224]),n(Sp,[2,225]),n(Sp,[2,226]),{31:[1,563],45:Uv,94:564},n(K,[2,84]),n(fu,[2,368]),n(K,[2,85]),n(hu,[2,370]),n(xc,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(us,[2,35],{83:[1,569]}),n(us,[2,36],{81:[1,570]}),n(mp,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:f,16:h,45:te,76:kv,78:Mv,87:d,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,276:Me,277:ye,279:Fe,280:xe,283:De,285:je,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P}),n(Ba,[2,295]),{45:te,77:572},{45:te,77:573},n(Ba,[2,33]),n(Ba,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(Bs,[2,356]),n(Bv,[2,357],{152:578,335:[1,579]}),n(Vi,[2,74]),{29:U,57:580},{29:U,57:581},{13:f,16:h,44:39,55:40,87:d,139:582,307:43,308:p},n(qv,[2,365],{162:583,328:[1,584]}),{13:f,16:h,45:te,55:323,67:321,68:322,77:320,79:585,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},{45:[1,586]},n(Vi,[2,81]),{29:U,57:587},n(Bs,[2,73]),n(Q,[2,362],{29:Ui,31:Ui,85:Ui,112:Ui,159:Ui,160:Ui,161:Ui,163:Ui,164:Ui}),n(_u,[2,112]),n(qa,[2,401],{206:588}),n(Q,[2,405],{209:589,210:590}),n(Q,[2,403]),n(Q,[2,404]),n(_u,[2,113]),n(_u,[2,400]),{13:f,16:h,44:215,45:gu,48:[1,591],55:220,82:$,87:d,89:ze,172:221,185:351,203:536,212:592,231:yu,234:535,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(vu,[2,426]),n(bp,[2,138]),n(bp,[2,139]),{232:[1,593]},n(Gs,[2,292]),{47:[1,595],48:[1,594]},n(Ua,[2,9]),n(qs,[2,392]),n(qs,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:h,87:d,197:Vs,308:p}),n(qs,[2,110],{272:[1,598]}),n(bu,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(cs,[2,58]),n(Bt,[2,445]),n(Bt,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Pt,[2,99]),n(Rt,[2,382]),n([13,16,39,47,48,87,193,197,242,246,250,263,265,272,290,297,298,299,300,301,302,308,314,338,341,342,343,344,345,346],[2,232]),n(Pt,[2,188]),n(Pt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:h,55:492,82:$,172:493,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,311:494,312:xr,315:611},n(K,[2,42]),n(xc,[2,304]),{13:f,16:h,55:414,82:$,95:612,171:613,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},{31:[1,614],45:Uv,94:615},n(di,[2,129]),n(Fv,[2,421]),{82:[1,616]},{82:[1,617]},n(Ba,[2,296]),n(Ba,[2,31]),n(Ba,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(Q,Ov,{155:330,153:618,154:619,29:Bi,31:Bi,85:Bi,112:Bi,159:Bi,160:Bi,161:Bi,163:Bi,164:Bi}),n(Bv,[2,358]),n(Vi,[2,75]),n(Vi,[2,76]),{29:U,57:620},{13:f,16:h,44:39,55:40,87:d,139:621,307:43,308:p},n(qv,[2,366]),n(Vi,[2,79]),{13:f,16:h,44:136,45:te,46:622,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Vi,[2,91],{336:[1,623]}),n([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),n(qa,[2,117]),{13:f,16:h,44:215,45:gu,55:220,82:$,87:d,89:ze,172:221,185:351,203:536,211:626,212:627,231:yu,234:535,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n($i,[2,134]),n(vu,[2,427]),n($i,[2,135]),n(Gs,[2,26]),{44:628,87:d},n(qs,[2,106]),n(qs,[2,394]),n(Q,[2,396]),n(bu,[2,111]),n(bu,[2,398]),{13:f,16:h,44:39,55:40,87:d,139:342,186:629,190:340,195:341,197:Vs,307:43,308:p},n(gp,[2,217]),n(Q,cu,{144:248,140:630,143:631,31:[2,343]}),n(Pt,[2,97]),n(Rt,[2,380]),n(Pt,[2,180]),{13:f,16:h,44:136,45:te,46:632,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:633,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:h,48:[1,636],55:414,82:$,171:637,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},n(Gv,[2,305]),n(K,[2,86]),n(xc,[2,374]),n(us,[2,37]),n(us,[2,38]),n(Bs,[2,72]),n(Bs,[2,360]),n(Vi,[2,77]),{29:U,57:638},{47:[1,639]},{29:[2,376]},n(qa,[2,402]),n(qa,[2,115],{215:10,208:528,214:529,44:530,205:640,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:d}),n(qa,[2,118],{272:[1,641]}),n(Su,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:de,304:pe,305:ne,306:me},n(Tc,[2,218]),n(xc,[2,44]),n(Gv,[2,306]),n(Vi,[2,78]),{44:651,87:d},n(qa,[2,116]),n(Q,[2,406]),n(Su,[2,119]),n(Su,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:d}),n(Gs,[2,27]),n(bu,[2,230]),n(Wv,[2,345],{141:653,335:[1,654]}),n(Pt,[2,181]),n(Pt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(Q,cu,{144:248,142:657,143:658,31:Hv,112:Hv}),n(Wv,[2,346]),n(Vi,[2,80]),n(Su,[2,231]),n(Us,[2,67]),n(Us,[2,348])],defaultActions:{5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]},parseError:o(function(x,O){if(O.recoverable)this.trace(x);else{var F=new Error(x);throw F.hash=O,F}},"parseError"),parse:o(function(x){var O=this,F=[0],Z=[],Ae=[null],m=[],Ir=this.table,g="",gi=0,Oc=0,xu=0,Au=2,Pc=1,Cu=m.slice.call(arguments,1),Et=Object.create(this.lexer),yi={yy:{}};for(var Rc in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Rc)&&(yi.yy[Rc]=this.yy[Rc]);Et.setInput(x,yi.yy),yi.yy.lexer=Et,yi.yy.parser=this,typeof Et.yylloc>"u"&&(Et.yylloc={});var Qa=Et.yylloc;m.push(Qa);var ct=Et.options&&Et.options.ranges;typeof yi.yy.parseError=="function"?this.parseError=yi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function St(vi){F.length=F.length-2*vi,Ae.length=Ae.length-vi,m.length=m.length-vi}o(St,"popStack");for(var Qe=o(function(){var vi;return vi=Et.lex()||Pc,typeof vi!="number"&&(vi=O.symbols_[vi]||vi),vi},"lex"),et,qr,Qs,fn,CU,Np,Ya={},Iu,Wi,i_,Ou;;){if(Qs=F[F.length-1],this.defaultActions[Qs]?fn=this.defaultActions[Qs]:((et===null||typeof et>"u")&&(et=Qe()),fn=Ir[Qs]&&Ir[Qs][et]),typeof fn>"u"||!fn.length||!fn[0]){var Lp="";Ou=[];for(Iu in Ir[Qs])this.terminals_[Iu]&&Iu>Au&&Ou.push("'"+this.terminals_[Iu]+"'");Et.showPosition?Lp="Parse error on line "+(gi+1)+`:
|
|
270
|
+
`),t}};Hf.RDFSerializer=H0});var K0=v(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.TransactionError=vs.TripleNotFoundError=vs.TripleAlreadyExistsError=void 0;var z0=class extends Error{static{o(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};vs.TripleAlreadyExistsError=z0;var Q0=class extends Error{static{o(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};vs.TripleNotFoundError=Q0;var Y0=class extends Error{static{o(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};vs.TransactionError=Y0});var Qf=v(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.LRUCache=void 0;var X0=class{static{o(this,"LRUCache")}constructor(e){this.maxSize=e,this.cache=new Map}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};zf.LRUCache=X0});var QS=v(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.InMemoryTripleStore=void 0;var _s=K0(),Yf=We(),w5=kt(),E5=mt(),T5=dn(),x5=Qf(),A5=T5.Namespace.XSD.term("string").value,C5=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,co="__default__",J0=class n{static{o(this,"InMemoryTripleStore")}constructor(){this.triples=new Map,this.spo=new Map,this.sop=new Map,this.pso=new Map,this.pos=new Map,this.osp=new Map,this.ops=new Map,this.queryCache=new x5.LRUCache(1e3),this.uuidIndex=new Map,this.namedGraphs=new Map}async add(e){let t=this.getTripleKey(e);if(this.triples.has(t))return;this.triples.set(t,e);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);this.addToIndex(this.spo,r,i,s),this.addToIndex(this.sop,r,s,i),this.addToIndex(this.pso,i,r,s),this.addToIndex(this.pos,i,s,r),this.addToIndex(this.osp,s,r,i),this.addToIndex(this.ops,s,i,r),this.addToUUIDIndex(e.subject),this.queryCache.clear()}async remove(e){let t=this.getTripleKey(e);if(!this.triples.has(t))return!1;this.triples.delete(t);let r=this.getNodeKey(e.subject),i=this.getNodeKey(e.predicate),s=this.getNodeKey(e.object);return this.removeFromIndex(this.spo,r,i,s),this.removeFromIndex(this.sop,r,s,i),this.removeFromIndex(this.pso,i,r,s),this.removeFromIndex(this.pos,i,s,r),this.removeFromIndex(this.osp,s,r,i),this.removeFromIndex(this.ops,s,i,r),this.queryCache.clear(),!0}async has(e){let t=this.getTripleKey(e);return this.triples.has(t)}async match(e,t,r){let i=this.getMatchCacheKey(e,t,r),s=this.queryCache.get(i);if(s!==void 0)return s;let a;return!e&&!t&&!r?a=Array.from(this.triples.values()):e&&t&&r?a=this.matchSPO(e,t,r):e&&t?a=this.matchSP(e,t):e&&r?a=this.matchSO(e,r):t&&r?a=this.matchPO(t,r):e?a=this.matchS(e):t?a=this.matchP(t):r?a=this.matchO(r):a=[],this.queryCache.set(i,a),a}async addAll(e){for(let t of e)await this.add(t)}async removeAll(e){let t=0;for(let r of e)await this.remove(r)&&t++;return t}async clear(){this.triples.clear(),this.spo.clear(),this.sop.clear(),this.pso.clear(),this.pos.clear(),this.osp.clear(),this.ops.clear(),this.uuidIndex.clear(),this.queryCache.clear()}async count(){return this.triples.size}async subjects(){let e=new Set;for(let t of this.triples.values())e.add(t.subject);return Array.from(e)}async predicates(){let e=new Set;for(let t of this.triples.values())e.add(t.predicate);return Array.from(e)}async objects(){let e=new Set;for(let t of this.triples.values())e.add(t.object);return Array.from(e)}async beginTransaction(){return new Z0(this)}async findSubjectsByUUID(e){return this.findSubjectsByUUIDSync(e)}findSubjectsByUUIDSync(e){let t=e.toLowerCase(),r=this.uuidIndex.get(t);if(!r||r.size===0)return[];let i=[];for(let s of r)this.spo.has(`i:${s}`)&&i.push(new Yf.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof Yf.IRI))return;let t=e.value,r=t.match(C5);if(r)for(let i of r){let s=i.toLowerCase();this.uuidIndex.has(s)||this.uuidIndex.set(s,new Set),this.uuidIndex.get(s).add(t)}}matchSPO(e,t,r){let i=this.getNodeKey(e),s=this.getNodeKey(t),a=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(a)){let u=this.buildTripleKey(i,s,a),f=this.triples.get(u);return f?[f]:[]}return[]}matchSP(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.spo.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,i,c))):[]}matchSO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.sop.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(r,c,i))):[]}matchPO(e,t){let r=this.getNodeKey(e),i=this.getNodeKey(t),s=this.pos.get(r);if(!s)return[];let a=s.get(i);return a?this.getTriplesByKeys(Array.from(a).map(c=>this.buildTripleKey(c,r,i))):[]}matchS(e){let t=this.getNodeKey(e),r=this.spo.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(t,s,c));return this.getTriplesByKeys(i)}matchP(e){let t=this.getNodeKey(e),r=this.pso.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,t,c));return this.getTriplesByKeys(i)}matchO(e){let t=this.getNodeKey(e),r=this.osp.get(t);if(!r)return[];let i=[];for(let[s,a]of r.entries())for(let c of a)i.push(this.buildTripleKey(s,c,t));return this.getTriplesByKeys(i)}getTriplesByKeys(e){let t=[];for(let r of e){let i=this.triples.get(r);i&&t.push(i)}return t}addToIndex(e,t,r,i){e.has(t)||e.set(t,new Map);let s=e.get(t);s.has(r)||s.set(r,new Set),s.get(r).add(i)}removeFromIndex(e,t,r,i){let s=e.get(t);if(!s)return;let a=s.get(r);a&&(a.delete(i),a.size===0&&s.delete(r),s.size===0&&e.delete(t))}getTripleKey(e){let t=this.getNodeKey(e.subject),r=this.getNodeKey(e.predicate),i=this.getNodeKey(e.object);return this.buildTripleKey(t,r,i)}buildTripleKey(e,t,r){return`${e}|${t}|${r}`}getNodeKey(e){if(e instanceof Yf.IRI)return`i:${e.value}`;if(e instanceof w5.BlankNode)return`b:${e.id}`;if(e instanceof E5.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==A5?t+=`^^${e.datatype.value}`:e.language&&(t+=`@${e.language}`),t}return""}getMatchCacheKey(e,t,r){let i=e?this.getNodeKey(e):"?",s=t?this.getNodeKey(t):"?",a=r?this.getNodeKey(r):"?";return`${i}|${s}|${a}`}getGraphKey(e){return e?e.value:co}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===co?this:(this.namedGraphs.has(t)||this.namedGraphs.set(t,new n),this.namedGraphs.get(t))}async addToGraph(e,t){await this.getOrCreateGraphStore(t).add(e)}async removeFromGraph(e,t){let r=this.getGraphKey(t);if(r===co)return this.remove(e);let i=this.namedGraphs.get(r);return i?i.remove(e):!1}async matchInGraph(e,t,r,i){let s=this.getGraphKey(i);if(s===co)return this.match(e,t,r);let a=this.namedGraphs.get(s);return a?a.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new Yf.IRI(e))}async hasGraph(e){let t=this.namedGraphs.get(e.value);return t?await t.count()>0:!1}async clearGraph(e){let t=this.getGraphKey(e);if(t===co){await this.clear();return}let r=this.namedGraphs.get(t);r&&(await r.clear(),this.namedGraphs.delete(t))}async countInGraph(e){let t=this.getGraphKey(e);if(t===co)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Kf.InMemoryTripleStore=J0;var Z0=class{static{o(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");for(let e of this.operations)e.type==="add"?await this.store.add(e.triple):await this.store.remove(e.triple);this.committed=!0,this.operations=[]}async rollback(){if(this.committed)throw new _s.TransactionError("Transaction already committed");if(this.rolledBack)throw new _s.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var ty=v(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});Xf.RDFVocabularyMapper=void 0;var tn=_i(),YS=We(),we=dn(),ey=class{static{o(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",we.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",we.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",we.Namespace.RDFS.term("subClassOf")],["exo__Property_range",we.Namespace.RDFS.term("range")],["exo__Property_domain",we.Namespace.RDFS.term("domain")],["exo__Property_superProperty",we.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new tn.Triple(we.Namespace.EXO.term("Asset"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.RDFS.term("Resource"))),e.push(new tn.Triple(we.Namespace.EXO.term("Class"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.RDFS.term("Class"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.RDF.term("Property"))),e.push(new tn.Triple(we.Namespace.EMS.term("Task"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.EXO.term("Asset"))),e.push(new tn.Triple(we.Namespace.EMS.term("Project"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.EXO.term("Asset"))),e.push(new tn.Triple(we.Namespace.EMS.term("Area"),we.Namespace.RDFS.term("subClassOf"),we.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new tn.Triple(we.Namespace.EXO.term("Instance_class"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDF.term("type"))),e.push(new tn.Triple(we.Namespace.EXO.term("Asset_isDefinedBy"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("isDefinedBy"))),e.push(new tn.Triple(we.Namespace.EXO.term("Class_superClass"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("subClassOf"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property_range"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("range"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property_domain"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("domain"))),e.push(new tn.Triple(we.Namespace.EXO.term("Property_superProperty"),we.Namespace.RDFS.term("subPropertyOf"),we.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof YS.IRI)s=r;else{let a=r.match(/^(ems|exo)__(.+)$/);if(a){let[,c,l]=a;s=(c==="ems"?we.Namespace.EMS:we.Namespace.EXO).term(l)}else s=new YS.IRI(r)}return new tn.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};Xf.RDFVocabularyMapper=ey});var KS=v(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.RDFSInferenceEngine=void 0;var I5=_i(),Jf=We(),ry=class{static{o(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(h=>h.value.includes("Class_superClass")),i=t.find(h=>h.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let a=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let h of l)if(h.object instanceof Jf.IRI){let d=a.get(h.object.value);if(d)for(let p of d)u.push(new I5.Triple(h.subject,i,new Jf.IRI(p)))}return u.length>0&&await e.addAll(u),await e.count()-c}async buildDirectParentMap(e,t){let r=await e.match(void 0,t),i=new Map;for(let s of r)if(s.subject instanceof Jf.IRI&&s.object instanceof Jf.IRI){let a=s.subject.value,c=s.object.value;i.has(a)||i.set(a,new Set),i.get(a).add(c)}return i}computeAllAncestors(e){let t=new Map;for(let r of e.keys())t.has(r)||t.set(r,this.computeAncestorsBFS(r,e));return t}computeAncestorsBFS(e,t){let r=new Set,i=new Set,s=[],a=t.get(e);if(a)for(let c of a)s.push(c);for(;s.length>0;){let c=s.shift();if(i.has(c))continue;i.add(c),r.add(c);let l=t.get(c);if(l)for(let u of l)i.has(u)||s.push(u)}return r}};Zf.RDFSInferenceEngine=ry});var ny=v(ti=>{"use strict";var O5=ti&&ti.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,r);else for(var c=n.length-1;c>=0;c--)(a=n[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},P5=ti&&ti.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},R5=ti&&ti.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ti,"__esModule",{value:!0});ti.NoteToRDFConverter=void 0;var XS=Ve(),Hr=_i(),lo=We(),rn=mt(),JS=kt(),Nr=dn(),F5=lt(),D5=ty(),zr=jm(),uo=class{static{o(this,"NoteToRDFConverter")}constructor(e){this.vault=e,this.OBSIDIAN_VAULT_SCHEME="obsidian://vault/",this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.vocabularyMapper=new D5.RDFVocabularyMapper}async convertNote(e){let t=this.vault.getFrontmatter(e);return t?zr.Exo003Parser.isExo003Format(t)?this.convertExo003Note(e,t):this.convertLegacyNote(e,t):[]}async convertLegacyNote(e,t){let r=[],i=this.notePathToIRI(e.path),s=Nr.Namespace.EXO.term("Asset_fileName");r.push(new Hr.Triple(i,s,new rn.Literal(e.basename)));for(let[c,l]of Object.entries(t)){if(!this.isExocortexProperty(c))continue;let u=this.propertyKeyToIRI(c),f=Array.isArray(l)?l:[l];for(let h of f)if(c==="exo__Instance_class"){let d=this.valueToClassURI(h);r.push(new Hr.Triple(i,u,d))}else{let d=await this.valueToRDFObject(h,e);for(let p of d)if(r.push(new Hr.Triple(i,u,p)),this.vocabularyMapper.hasMappingFor(c)&&p instanceof lo.IRI){let _=this.vocabularyMapper.generateMappedTriple(i,c,p);_&&r.push(_)}}if(c==="exo__Instance_class")for(let h of f){let d=this.expandClassValue(h);if(d){let p=Nr.Namespace.RDF.term("type");r.push(new Hr.Triple(i,p,d))}}}let a=await this.convertBodyWikilinks(e,i);return r.push(...a),r}async convertExo003Note(e,t){let r=zr.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case zr.Exo003MetadataType.Namespace:break;case zr.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case zr.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case zr.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case zr.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new lo.IRI(t.uri);return[new Hr.Triple(r,Nr.Namespace.OWL.term("sameAs"),i),new Hr.Triple(i,Nr.Namespace.OWL.term("sameAs"),r)]}convertExo003BlankNode(e,t){let r=this.notePathToIRI(e.path),i=t.uri.replace(/[^a-zA-Z0-9_-]/g,"_");return[new Hr.Triple(r,Nr.Namespace.OWL.term("sameAs"),new JS.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=zr.Exo003Parser.toTriple(t,i);r.push(s);let a=this.notePathToIRI(e.path);r.push(new Hr.Triple(a,Nr.Namespace.RDF.term("value"),s.subject))}catch{}return r}async convertExo003Body(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.createExo003ReferenceResolver(e),c=a(t.subject),l=a(t.predicate);if(c.type==="literal")throw new Error("Body subject cannot be a literal");if(l.type!=="iri")throw new Error("Body predicate must be an IRI");let u=c.type==="iri"?new lo.IRI(c.value):new JS.BlankNode(c.value),f=new lo.IRI(l.value),h=zr.Exo003Parser.toLiteral(t,s.trim());r.push(new Hr.Triple(u,f,h));let d=this.notePathToIRI(e.path);r.push(new Hr.Triple(d,Nr.Namespace.RDF.term("value"),u))}catch{}return r}createExo003ReferenceResolver(e){return t=>{let r=this.extractWikilink(t),i=r||t,s=this.vault.getFirstLinkpathDest(i,e.path);if(s){let a=this.vault.getFrontmatter(s);if(a&&zr.Exo003Parser.isExo003Format(a)){let c=zr.Exo003Parser.parse(a);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===zr.Exo003MetadataType.Anchor||l.metadata===zr.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===zr.Exo003MetadataType.BlankNode)return{type:"blank",value:l.uri.replace(/[^a-zA-Z0-9_-]/g,"_")}}}return{type:"iri",value:this.notePathToIRI(s.path).value}}return!r&&t.includes("://")?{type:"iri",value:t}:{type:"literal",value:t}}}async convertVault(){return(await this.convertVaultWithValidation({strict:!1})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1;for(let a of t)try{let c=await this.convertNote(a);r.push(...c)}catch(c){let l=c instanceof Error?c.message:String(c);if(s)throw new Error(`Invalid IRI for file "${a.path}": ${l}`);i.push({path:a.path,reason:`Invalid IRI: ${l}`}),console.warn(`\u26A0\uFE0F Skipping file with invalid IRI: ${a.path}`),console.warn(` Reason: ${l}`)}return{triples:r,skippedFiles:i,summary:{total:t.length,indexed:t.length-i.length,skipped:i.length}}}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=encodeURI(r.path),s=`${this.OBSIDIAN_VAULT_SCHEME}${i}`;lo.IRI.isValidIRI(s)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){let t=encodeURI(e);return new lo.IRI(`${this.OBSIDIAN_VAULT_SCHEME}${t}`)}isExocortexProperty(e){return e.startsWith("exo__")||e.startsWith("ems__")}propertyKeyToIRI(e){if(e.startsWith("exo__")){let t=e.substring(5);return Nr.Namespace.EXO.term(t)}if(e.startsWith("ems__")){let t=e.substring(5);return Nr.Namespace.EMS.term(t)}throw new Error(`Invalid property key: ${e}`)}async valueToRDFObject(e,t){if(typeof e=="string"){let r=this.removeQuotes(e),i=this.extractWikilink(r);if(i){let s=this.vault.getFirstLinkpathDest(i,t.path);if(s){let a=this.notePathToIRI(s.path);if(this.isUUID(i)){let c=new rn.Literal(i);return[a,c]}return[a]}if(this.isClassReference(i)){let a=this.expandClassValue(i);if(a)return[a]}return[new rn.Literal(r)]}if(this.isClassReference(r)){let s=this.expandClassValue(r);if(s)return[s]}return this.isISO8601DateTime(r)?[new rn.Literal(r,Nr.Namespace.XSD.term("dateTime"))]:[new rn.Literal(r)]}return typeof e=="boolean"?[new rn.Literal(e.toString())]:typeof e=="number"?[new rn.Literal(e.toString(),Nr.Namespace.XSD.term("decimal"))]:e instanceof Date?[new rn.Literal(e.toISOString(),Nr.Namespace.XSD.term("dateTime"))]:[new rn.Literal(String(e))]}isISO8601DateTime(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?(Z|[+-]\d{2}:\d{2})?$/.test(e)}removeQuotes(e){let t=e.trim();return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.substring(1,t.length-1):e}extractWikilink(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);return t?t[1]:null}valueToClassURI(e){if(typeof e!="string")return new rn.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);return s||new rn.Literal(t)}isClassReference(e){return(e.startsWith("ems__")||e.startsWith("exo__"))&&!/\s/.test(e)}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}expandClassValue(e){let t=this.removeQuotes(e);if(t.startsWith("ems__")){let r=t.substring(5);return Nr.Namespace.EMS.term(r)}if(t.startsWith("exo__")){let r=t.substring(5);return Nr.Namespace.EXO.term(r)}return null}extractBodyContent(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/;return e.replace(t,"")}extractBodyWikilinks(e){let t=new Set,r,i=new RegExp(this.BODY_WIKILINK_PATTERN.source,"g");for(;(r=i.exec(e))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}async convertBodyWikilinks(e,t){let r=[];try{let i=await this.vault.read(e),s=this.extractBodyContent(i),a=this.extractBodyWikilinks(s),c=Nr.Namespace.EXO.term("Asset_bodyLink");for(let l of a){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new Hr.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new Hr.Triple(t,c,f)):r.push(new Hr.Triple(t,c,new rn.Literal(l)))}else r.push(new Hr.Triple(t,c,new rn.Literal(l)))}}catch{}return r}};ti.NoteToRDFConverter=uo;uo.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};uo.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};uo.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};ti.NoteToRDFConverter=uo=O5([(0,XS.injectable)(),R5(0,(0,XS.inject)(F5.DI_TOKENS.IVaultAdapter)),P5("design:paramtypes",[Object])],uo)});var iy=v((Bz,ZS)=>{var fo=class{static{o(this,"Wildcard")}constructor(){return N5||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(fo.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(fo.prototype,"termType",{enumerable:!0,value:"Wildcard"});var N5=new fo;ZS.exports.Wildcard=fo});var tw=v((Gz,ew)=>{var L5=(function(){var n=o(function(I,x,O,F){for(O=O||{},F=I.length;F--;O[I[F]]=x);return O},"o"),e=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],t=[2,247],r=[100,110,113,115,116,123,126,131,329,330,331,332,333],i=[2,409],s=[1,18],a=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],h=[1,45],d=[1,41],p=[1,44],_=[123,126],b=[1,67],E=[39,45,87],A=[13,16,45,197,224,308],C=[1,87],j=[2,281],G=[1,86],Q=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],H=[6,28,29,53,63,70,73,81,83,85],ee=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],Se=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],L=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],Y=[13,16,308],ge=[112,132,327,334],dt=[13,16,112,132,308],nt=[1,111],vt=[1,117],Ke=[112,132,327,328,334],Je=[13,16,112,132,308,328],Ue=[28,29,45,53,87],te=[1,138],$=[1,151],Ze=[1,128],it=[1,127],B=[1,129],Te=[1,140],Ne=[1,141],J=[1,142],Le=[1,143],ke=[1,144],Re=[1,145],Me=[1,147],ye=[1,148],Fe=[2,457],xe=[1,158],De=[1,159],je=[1,160],se=[1,152],le=[1,153],ue=[1,156],ae=[1,171],oe=[1,172],ce=[1,173],ie=[1,174],fe=[1,175],he=[1,176],de=[1,167],pe=[1,168],ne=[1,169],me=[1,170],Ge=[1,157],$e=[1,166],Pe=[1,161],S=[1,162],w=[1,163],T=[1,164],P=[1,165],K=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],ot=[1,195],pt=[6,31,73,81,83,85],Ce=[2,285],V=[1,199],U=[1,201],q=[6,31,70,73,81,83,85],z=[2,283],Ee=[1,207],He=[1,218],ze=[1,223],Jt=[1,219],Br=[1,225],Jr=[1,226],xr=[1,224],yv=[6,63,70,73,81,83,85],vv=[1,236],_v=[2,334],bv=[1,243],Sv=[1,241],Zt=[6,193],cu=[2,349],wv=[2,339],cs=[28,128],Ev=[47,48,193,272],lu=[47,48,193,242,272],$a=[47,48,193,242,246,272],Va=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Bt=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],Tv=[1,271],xv=[1,270],Pt=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],Av=[1,281],Cv=[1,280],Ar=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],wc=[45,89],uu=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],fu=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],hu=[31,89],du=[48,87],$s=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],di=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],Iv=[1,313],Ua=[6,85],mp=[6,31,81,83,85],Ov=[2,361],ji=[2,353],Vs=[1,343],Ec=[31,112,335],$i=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],gp=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],Pv=[6,109,193],Us=[31,112],Rt=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],yp=[1,390],vp=[1,391],ls=[13,16,87,197,308,314],Rv=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],pu=[1,417],mu=[1,418],Fv=[13,16,48,197,229,308],us=[6,31,85],Dv=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],_p=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],Bs=[29,31,85,112,159,160,161,163,164],gu=[1,443],yu=[1,444],Nv=[1,449],qs=[31,112,193,232,318,335],vu=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Lv=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],bp=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Tc=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],xc=[31,45],kv=[1,507],Mv=[1,508],jv=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],_u=[29,31,85,112,159,160,161,163,164,335],Gs=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$v=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Vv=[2,352],Sp=[13,16,197,308,314],Uv=[1,565],Ba=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],Bv=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Vi=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],qv=[13,16,87,308],Ui=[2,364],qa=[29,31,85,112,159,160,161,163,164,193,232,318,335],bu=[31,112,193,232,272,318,335],Bi=[2,359],Gv=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Su=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],Wv=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Hv=[2,347],wp={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:o(function(x,O,F,Z,Ae,m,Ir){var g=m.length-1;switch(Ae){case 1:if(m[g-1]=m[g-1]||{},Oe.base&&(m[g-1].base=Oe.base),Oe.base="",m[g-1].prefixes=Oe.prefixes,Oe.prefixes=null,Oe.pathOnly){if(m[g-1].type==="path"||"termType"in m[g-1])return m[g-1];throw new Error("Received full SPARQL query in path only mode")}else if(m[g-1].type==="path"||"termType"in m[g-1])throw new Error("Received only path in full SPARQL mode");if(m[g-1].type==="update"){let ct={};for(let St of m[g-1].updates)if(St.updateType==="insert"){let Qe={};for(let et of St.insert)if(et.type==="bgp"||et.type==="graph")for(let qr of et.triples)qr.subject.termType==="BlankNode"&&(Qe[qr.subject.value]=!0),qr.predicate.termType==="BlankNode"&&(Qe[qr.predicate.value]=!0),qr.object.termType==="BlankNode"&&(Qe[qr.object.value]=!0);for(let et of Object.keys(Qe)){if(ct[et])throw new Error("Detected reuse blank node across different INSERT DATA clauses");ct[et]=!0}}}return m[g-1];case 2:this.$={...m[g-1],...m[g],type:"query"};break;case 4:Oe.base=Ac(m[g]);break;case 5:Oe.prefixes||(Oe.prefixes={}),m[g-1]=m[g-1].substr(0,m[g-1].length-1),m[g]=Ac(m[g]),Oe.prefixes[m[g-1]]=m[g];break;case 6:this.$={...m[g-3],...zs(m[g-2]),...m[g-1],...m[g]};break;case 7:if(!Oe.skipValidation&&(Pp(m[g-3].variables.map(St=>Op(St.expression))).some(St=>St.aggregation==="count"&&!(St.expression instanceof wu))||m[g].group)){for(let St of m[g-3].variables)if(St.termType==="Variable"){if(!m[g].group||!m[g].group.map(Qe=>za(Qe)).includes(za(St)))throw Error("Projection of ungrouped variable (?"+za(St)+")")}else if(Op(St.expression).length===0){let Qe=mI(St.expression);for(let et of Qe)if(!m[g].group||!m[g].group.map||!m[g].group.map(qr=>za(qr)).includes(za(et)))throw Error("Use of ungrouped variable in projection of operation (?"+za(et)+")")}}let yi=m[g-1].where.filter(ct=>ct.type==="query");if(yi.length>0){let ct=m[g-3].variables.filter(Qe=>Qe.variable&&Qe.variable.value).map(Qe=>Qe.variable.value),St=Pp(yi.map(Qe=>Qe.variables)).map(Qe=>Qe.value||Qe.variable.value);for(let Qe of ct)if(St.indexOf(Qe)>=0)throw Error("Target id of 'AS' (?"+Qe+") already used in subquery")}this.$=xt(m[g-3],zs(m[g-2]),m[g-1],m[g]);break;case 8:this.$=xt({queryType:"CONSTRUCT",template:m[g-3]},zs(m[g-2]),m[g-1],m[g]);break;case 9:this.$=xt({queryType:"CONSTRUCT",template:m[g-2]=m[g-2]?m[g-2].triples:[]},zs(m[g-5]),{where:[{type:"bgp",triples:Hs([],m[g-2])}]},m[g]);break;case 10:this.$=xt({queryType:"DESCRIBE",variables:m[g-3]==="*"?[new wu]:m[g-3]},zs(m[g-2]),m[g-1],m[g]);break;case 11:this.$=xt({queryType:"ASK"},zs(m[g-2]),m[g-1],m[g]);break;case 12:this.$=xt(m[g-1],{variables:[new wu]});break;case 13:let Rc=m[g].map(ct=>ct.value||ct.variable.value),Qa=gI(Rc);if(Qa.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Qa[0]+")");this.$=xt(m[g-1],{variables:m[g]});break;case 14:this.$=xt({queryType:"SELECT"},m[g]&&(m[g-1]=Cr(m[g]),m[g]={},m[g][m[g-1]]=!0,m[g]));break;case 16:case 27:this.$=Ga(m[g-3],{variable:m[g-1]});break;case 17:case 18:this.$=xt(m[g-3],m[g-2],m[g-1],m[g],{type:"query"});break;case 19:case 58:this.$={iri:m[g],named:!!m[g-1]};break;case 20:this.$={where:m[g].patterns};break;case 21:this.$=xt(m[g-1],m[g]);break;case 22:this.$=xt(m[g-2],m[g-1],m[g]);break;case 23:this.$={group:m[g]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=Ga(m[g]);break;case 26:this.$=Ga(m[g-1]);break;case 29:this.$={having:m[g]};break;case 30:this.$={order:m[g]};break;case 32:this.$=Ga(m[g],{descending:!0});break;case 35:this.$={limit:Ha(m[g])};break;case 36:this.$={offset:Ha(m[g])};break;case 37:this.$={limit:Ha(m[g-2]),offset:Ha(m[g])};break;case 38:this.$={limit:Ha(m[g]),offset:Ha(m[g-2])};break;case 39:case 43:this.$={type:"values",values:m[g]};break;case 40:case 84:this.$=m[g-1].map(ct=>({[m[g-3]]:ct}));break;case 41:case 85:this.$=m[g-1].map(()=>({}));break;case 42:case 86:var gi=m[g-4].length;m[g-4]=m[g-4].map(Ep),this.$=m[g-1].map(function(ct){if(ct.length!==gi)throw Error("Inconsistent VALUES length");for(var St={},Qe=0;Qe<gi;Qe++)St["?"+m[g-4][Qe].value]=ct[Qe];return St});break;case 44:case 65:case 100:case 126:case 175:this.$=m[g-1];break;case 45:this.$={type:"update",updates:qi(m[g-2],m[g-1])};break;case 46:this.$=xt({type:"load",silent:!!m[g-2],source:m[g-1]},m[g]&&{destination:m[g]});break;case 47:this.$={type:Cr(m[g-2]),silent:!!m[g-1],graph:m[g]};break;case 48:this.$={type:Cr(m[g-4]),silent:!!m[g-3],source:m[g-2],destination:m[g]};break;case 49:this.$={type:"create",silent:!!m[g-2],graph:{type:"graph",name:m[g]}};break;case 50:this.$={updateType:"insert",insert:n_(m[g])};break;case 51:this.$={updateType:"delete",delete:Dp(n_(m[g]))};break;case 52:this.$={updateType:"deletewhere",delete:Dp(m[g])};break;case 53:this.$={updateType:"insertdelete",...m[g-4],...m[g-3],...zs(m[g-2],"using"),where:m[g].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=m[g];break;case 55:this.$={delete:Dp(m[g-1]),insert:m[g]||[]};break;case 56:this.$={delete:[],insert:m[g]};break;case 59:this.$={graph:m[g]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:m[g]};break;case 64:this.$={[Cr(m[g])]:!0};break;case 66:this.$=m[g-1]?pi(m[g],[m[g-1]]):pi(m[g]);break;case 67:var Oc=xt(m[g-3]||{triples:[]},{type:"graph",name:m[g-5]});this.$=m[g]?[Oc,m[g]]:[Oc];break;case 68:case 73:this.$={type:"bgp",triples:pi(m[g-2],[m[g-1]])};break;case 69:this.$={type:"group",patterns:[m[g-1]]};break;case 70:for(let ct of m[g-1].filter(St=>St.type==="bind")){let St=m[g-1].indexOf(ct),Qe=new Set;for(let et of m[g-1].slice(0,St))(et.type==="group"||et.type==="bgp")&&t_(et).forEach(qr=>Qe.add(qr));if(Qe.has(ct.variable.value))throw Error("Variable used to bind is already bound (?"+ct.variable.value+")")}this.$={type:"group",patterns:m[g-1]};break;case 71:this.$=m[g-1]?pi([m[g-1]],m[g]):pi(m[g]);break;case 72:this.$=m[g]?[m[g-2],m[g]]:m[g-2];break;case 75:this.$=xt(m[g],{type:"optional"});break;case 76:this.$=xt(m[g],{type:"minus"});break;case 77:this.$=xt(m[g],{type:"graph",name:m[g-1]});break;case 78:this.$=xt(m[g],{type:"service",name:m[g-1],silent:!!m[g-2]});break;case 79:this.$={type:"filter",expression:m[g]};break;case 80:this.$={type:"bind",variable:m[g-1],expression:m[g-3]};break;case 89:this.$=Ic(m[g]);break;case 90:this.$=void 0;break;case 91:this.$=m[g-1].length?{type:"union",patterns:pi(m[g-1].map(xp),[xp(m[g])])}:m[g];break;case 95:this.$={...m[g],function:m[g-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:qi(m[g-2],m[g-1]),distinct:!!m[g-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=qi(m[g-2],m[g-1]);break;case 101:this.$=pi(m[g-2],[m[g-1]]);break;case 102:case 112:this.$=Fp(m[g].map(ct=>xt(Gi(m[g-1]),ct)));break;case 103:this.$=Fp(Hs(m[g].map(ct=>xt(Gi(m[g-1].entity),ct)),m[g-1].triples));break;case 105:this.$=pi([m[g-1]],m[g]);break;case 106:this.$=pi(m[g]);break;case 107:this.$=Ip(m[g-1],m[g]);break;case 109:case 237:this.$=Oe.factory.namedNode(sI);break;case 110:case 118:this.$=qi(m[g-1],m[g]);break;case 111:this.$=m[g]?{annotation:m[g],object:m[g-1]}:m[g-1];break;case 113:this.$=m[g]?Fp(Hs(m[g].map(ct=>xt(Gi(m[g-1].entity),ct)),m[g-1].triples)):m[g-1].triples;break;case 114:this.$=Ip(...m[g-1],m[g]);break;case 116:this.$=Ip(...m[g]);break;case 117:case 159:case 163:this.$=[m[g-1],m[g]];break;case 119:this.$=m[g]?{object:m[g-1],annotation:m[g]}:m[g-1];break;case 120:this.$=m[g-1].length?Wa("|",qi(m[g-1],m[g])):m[g];break;case 121:this.$=m[g-1].length?Wa("/",qi(m[g-1],m[g])):m[g];break;case 122:this.$=m[g]?Wa(m[g],[m[g-1]]):m[g-1];break;case 123:this.$=m[g-1]?Wa(m[g-1],[m[g]]):m[g];break;case 125:case 131:this.$=Wa(m[g-1],[m[g]]);break;case 129:this.$=Wa("|",qi(m[g-2],m[g-1]));break;case 132:case 134:this.$=dI(m[g-1]);break;case 133:case 135:this.$=pI(m[g-1]);break;case 140:this.$={entity:m[g],triples:[]};break;case 145:this.$=Ep(m[g]);break;case 149:this.$=Oe.factory.namedNode(zv);break;case 151:case 153:case 158:case 162:this.$=Tp(m[g-1],m[g]);break;case 152:this.$=["||",m[g]];break;case 154:this.$=["&&",m[g]];break;case 156:this.$=er(m[g-1],[m[g-2],m[g]]);break;case 157:this.$=er(m[g-2]?"notin":"in",[m[g-3],m[g]]);break;case 160:this.$=["+",Tp(m[g-1],m[g])];break;case 161:var xu=mi(m[g-1].value.replace("-",""),m[g-1].datatype);this.$=["-",Tp(xu,m[g])];break;case 164:this.$=er("UPLUS",[m[g]]);break;case 165:this.$=er(m[g-1],[m[g]]);break;case 166:this.$=er("UMINUS",[m[g]]);break;case 177:this.$=er(Cr(m[g-1]));break;case 178:this.$=er(Cr(m[g-3]),[m[g-1]]);break;case 179:this.$=Ic(er(Cr(m[g-3]),[m[g-1]]));break;case 180:this.$=er(Cr(m[g-5]),[m[g-3],m[g-1]]);break;case 181:this.$=er(Cr(m[g-7]),[m[g-5],m[g-3],m[g-1]]);break;case 182:this.$=Ic(er(Cr(m[g-7]),[m[g-5],m[g-3],m[g-1]]));break;case 183:this.$=er(Cr(m[g-1]),m[g]);break;case 184:this.$=er("bound",[Ep(m[g-1])]);break;case 185:this.$=er(m[g-1],[]);break;case 186:this.$=er(m[g-3],[m[g-1]]);break;case 187:this.$=er(m[g-2]?"notexists":"exists",[xp(m[g])]);break;case 188:case 189:this.$=Ga(m[g-1],{type:"aggregate",aggregation:Cr(m[g-4]),distinct:!!m[g-2]});break;case 190:this.$=Ga(m[g-2],{type:"aggregate",aggregation:Cr(m[g-5]),distinct:!!m[g-3],separator:typeof m[g-1]=="string"?m[g-1]:" "});break;case 192:this.$=mi(m[g]);break;case 193:this.$=lI(m[g-1],Cr(m[g].substr(1)));break;case 194:this.$=mi(m[g-2],m[g]);break;case 195:case 204:this.$=mi(m[g],Qv);break;case 196:case 205:this.$=mi(m[g],Yv);break;case 197:case 206:this.$=mi(Cr(m[g]),Kv);break;case 200:this.$=mi(m[g].toLowerCase(),cI);break;case 201:this.$=mi(m[g].substr(1),Qv);break;case 202:this.$=mi(m[g].substr(1),Yv);break;case 203:this.$=mi(m[g].substr(1).toLowerCase(),Kv);break;case 207:case 208:this.$=e_(m[g],1);break;case 209:case 210:this.$=e_(m[g],3);break;case 211:this.$=Oe.factory.namedNode(Ac(m[g]));break;case 213:var Au=m[g].indexOf(":"),Pc=m[g].substr(0,Au),Cu=Oe.prefixes[Pc];if(!Cu)throw new Error("Unknown prefix: "+Pc);var Et=Ac(Cu+m[g].substr(Au+1));this.$=Oe.factory.namedNode(Et);break;case 214:if(m[g]=m[g].substr(0,m[g].length-1),!(m[g]in Oe.prefixes))throw new Error("Unknown prefix: "+m[g]);var Et=Ac(Oe.prefixes[m[g]]);this.$=Oe.factory.namedNode(Et);break;case 215:this.$=Cc(m[g].replace(/^(_:)/,""));break;case 216:this.$=Cc();break;case 217:case 218:case 232:this.$=Ic(Ap(m[g-3],m[g-2],m[g-1]));break;case 230:case 231:this.$=Ic(m[g-1]);break;case 248:case 250:case 252:case 254:case 256:case 260:case 264:case 268:case 270:case 292:case 294:case 296:case 298:case 300:case 302:case 304:case 306:case 329:case 342:case 356:case 368:case 370:case 372:case 374:case 392:case 402:case 425:case 427:case 429:case 431:case 441:case 445:case 447:case 449:m[g-1].push(m[g]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[m[g]];break;case 308:m[g-3].push(m[g-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:m[g-2].push(m[g-1]);break}},"anonymous"),table:[n(e,t,{3:1,4:2,10:3}),{1:[3]},n(r,[2,307],{5:4,7:5,321:6,214:7,8:8,96:9,215:10,17:11,21:12,97:16,38:17,6:[2,238],13:i,16:i,45:i,197:i,224:i,229:i,308:i,24:[1,13],32:[1,14],36:[1,15],41:s}),n([6,13,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],[2,3],{322:19,11:20,14:21,12:[1,22],15:[1,23]}),{6:[1,24]},{6:[2,240]},{6:[2,241]},{6:[2,242]},{6:[2,243],9:25,84:26,85:a},{6:[2,239]},n(c,[2,411],{216:28,217:29}),n(l,[2,249],{18:30}),n(l,[2,251],{22:31}),n(u,[2,255],{25:32,27:33,29:[1,34]}),{13:f,16:h,33:35,39:[1,37],44:39,55:40,87:d,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(_,[2,326],{98:47,103:49,106:50,117:55,130:61,100:[1,48],110:[1,51],113:[1,52],115:[1,53],116:[1,54],131:[1,62],329:[1,56],330:[1,57],331:[1,58],332:[1,59],333:[1,60]}),{39:[1,63],40:64,43:65,44:66,45:b,87:d},n(E,[2,273],{42:68,324:69,325:[1,70],326:[1,71]}),n(e,[2,248]),n(e,[2,245]),n(e,[2,246]),{13:[1,72]},{16:[1,73]},{1:[2,1]},{6:[2,2]},{6:[2,244]},{45:[1,77],85:[1,78],86:74,87:[1,75],89:[1,76]},n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],[2,120],{337:[1,79]}),n(A,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:C,29:j,52:84,53:G,56:85},{19:88,28:C,29:j,52:89,53:G,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:G},n(Q,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(H,[2,263],{34:96}),n(H,[2,261],{44:39,55:40,307:43,139:97,13:f,16:h,87:d,308:p}),n(H,[2,262]),n(ee,[2,259]),n(Se,[2,143]),n(Se,[2,144]),n([6,13,16,28,29,31,39,45,47,48,53,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,145]),n(L,[2,211]),n(L,[2,212]),n(L,[2,213]),n(L,[2,214]),{19:98,28:C,29:j,52:99,53:G,56:85},{6:[2,309],99:100,193:[1,101]},n(Y,[2,311],{101:102,328:[1,103]}),n(ge,[2,317],{104:104,328:[1,105]}),n(dt,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:nt,114:110},{29:nt,114:112},{29:nt,114:113},{118:114,123:[1,115],125:116,126:vt},n(Ke,[2,315]),n(Ke,[2,316]),n(Je,[2,319]),n(Je,[2,320]),n(Je,[2,321]),n(_,[2,327]),{13:f,16:h,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:b,87:d}),n(Ue,[2,269]),n(Ue,[2,15]),{13:f,16:h,44:136,45:te,46:120,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(E,[2,14]),n(E,[2,274]),n(E,[2,271]),n(E,[2,272]),n(e,[2,4]),{13:[1,177]},n(K,[2,39]),{29:[1,178]},{29:[1,179]},{87:[1,181],91:180},{45:[1,187],87:[1,185],89:[1,186],93:182,165:183,166:184},n(c,[2,410]),n([6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337],[2,121],{338:[1,188]}),{13:f,16:h,45:[1,193],55:194,197:ot,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(A,[2,419]),n(pt,Ce,{20:196,59:197,69:198,70:V}),n(l,[2,250]),{29:U,57:200},n(Y,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(q,z,{23:204,58:205,62:206,63:Ee}),n(l,[2,252]),{19:208,28:C,29:j,52:209,53:G,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,145:212,172:221,185:213,187:214,231:Jt,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(yv,[2,265],{56:85,35:227,52:228,19:229,28:C,29:j,53:G}),n(ee,[2,260]),n(q,z,{58:205,62:206,23:230,63:Ee}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:h,55:232,307:43,308:p},n(Y,[2,312]),{105:233,112:vv,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(ge,[2,318]),n(Y,_v,{108:240,133:242,112:bv,132:Sv}),n(dt,[2,323]),{112:[1,244]},{112:[2,325]},n(Zt,[2,50]),n(Q,cu,{135:245,136:246,143:247,144:248,31:wv,112:wv}),n(Zt,[2,51]),n(Zt,[2,52]),n(cs,[2,328],{119:249}),{29:nt,114:250},n(cs,[2,56]),{29:nt,114:251},n(_,[2,59]),n(Ue,[2,270]),{47:[1,252]},n(Ev,[2,150]),n(lu,[2,428],{240:253}),n($a,[2,430],{244:254}),n($a,[2,155],{248:255,249:256,250:[2,438],290:[1,257],341:[1,258],342:[1,259],343:[1,260],344:[1,261],345:[1,262],346:[1,263]}),n(Va,[2,440],{252:264}),n(Bt,[2,448],{260:265}),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,255:154,257:155,264:266,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,255:154,257:155,264:267,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,255:154,257:155,264:268,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Bt,[2,167]),n(Bt,[2,168]),n(Bt,[2,169]),n(Bt,[2,170],{176:269,45:Tv,89:xv}),n(Bt,[2,171]),n(Bt,[2,172]),n(Bt,[2,173]),n(Bt,[2,174]),{13:f,16:h,44:136,45:te,46:272,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:Av,89:Cv,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(Ar,[2,192],{292:[1,286],293:[1,287]}),n(Ar,[2,195]),n(Ar,[2,196]),n(Ar,[2,197]),n(Ar,[2,198]),n(Ar,[2,199]),n(Ar,[2,200]),{13:f,16:h,44:39,55:40,82:$,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(wc,[2,452]),n(wc,[2,453]),n(wc,[2,454]),n(wc,[2,455]),n(wc,[2,456]),{279:[2,458]},n(uu,[2,207]),n(uu,[2,208]),n(uu,[2,209]),n(uu,[2,210]),n(Ar,[2,201]),n(Ar,[2,202]),n(Ar,[2,203]),n(Ar,[2,204]),n(Ar,[2,205]),n(Ar,[2,206]),n(e,[2,5]),n(fu,[2,297],{88:295}),n(hu,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(du,[2,301]),n(K,[2,43]),n(K,[2,82]),n(K,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n($s,[2,123]),n($s,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(di,[2,124]),{13:f,16:h,45:[1,311],55:194,89:[1,310],197:ot,223:312,225:308,226:309,229:Iv,307:43,308:p},n(c,i,{215:10,214:314}),n(di,[2,236]),n(di,[2,237]),n(Ua,[2,6]),n(mp,[2,287],{60:315,72:316,73:[1,317]}),n(pt,[2,286]),{13:f,16:h,45:te,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},n([6,31,63,70,73,81,83,85],[2,20]),n(Q,Ov,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:ji,31:ji,85:ji,112:ji,159:ji,160:ji,161:ji,163:ji,164:ji,41:s}),{13:f,16:h,55:331,307:43,308:p},n(Y,[2,280]),n(Ua,[2,7]),n(pt,Ce,{59:197,69:198,20:332,70:V}),n(q,[2,284]),{64:[1,333]},n(q,z,{58:205,62:206,23:334,63:Ee}),n(l,[2,254]),n(Q,cu,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:h,44:39,55:40,87:d,139:342,186:339,190:340,195:341,197:Vs,307:43,308:p},n(Ec,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:h,87:d,197:Vs,308:p}),n($i,[2,227]),n($i,[2,228]),n($i,[2,229]),{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,172:221,185:351,187:350,200:348,230:347,231:Jt,234:349,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},{13:f,16:h,44:39,55:40,87:d,139:342,186:352,190:340,195:341,197:Vs,307:43,308:p},n($i,[2,146]),n($i,[2,147]),n($i,[2,148]),n($i,[2,149]),{13:f,16:h,44:354,55:355,82:$,87:d,172:357,237:356,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:358,312:xr,313:353},n(gp,[2,215]),n(gp,[2,216]),n(q,z,{58:205,62:206,23:359,63:Ee}),n(H,[2,264]),n(yv,[2,266]),n(Ua,[2,11]),n(r,[2,308],{6:[2,310]}),n(Zt,[2,313],{102:360,120:361,121:[1,362]}),n(Zt,[2,47]),n(Zt,[2,63]),n(Zt,[2,64]),{13:f,16:h,55:363,307:43,308:p},n(Zt,[2,336]),n(Zt,[2,337]),n(Zt,[2,338]),{109:[1,364]},n(Pv,[2,60]),{13:f,16:h,55:365,307:43,308:p},n(Y,[2,335]),{13:f,16:h,55:366,307:43,308:p},{31:[1,367]},n(Us,[2,341],{137:368}),n(Us,[2,340]),{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,145:369,172:221,185:213,187:214,231:Jt,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},{28:[1,370],127:371,128:[1,372]},n(cs,[2,330],{124:373,125:374,126:vt}),n(cs,[2,57]),{44:375,87:d},n(Ev,[2,151],{241:376,242:[1,377]}),n(lu,[2,153],{245:378,246:[1,379]}),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,247:380,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{250:[1,381]},n(Rt,[2,432]),n(Rt,[2,433]),n(Rt,[2,434]),n(Rt,[2,435]),n(Rt,[2,436]),n(Rt,[2,437]),{250:[2,439]},n([47,48,193,242,246,250,272,290,341,342,343,344,345,346],[2,158],{253:382,254:383,255:384,257:385,263:[1,386],265:[1,387],297:ae,298:oe,299:ce,300:ie,301:fe,302:he}),n(Va,[2,162],{261:388,262:389,39:yp,338:vp}),n(Bt,[2,164]),n(Bt,[2,165]),n(Bt,[2,166]),n(Pt,[2,95]),n(Pt,[2,96]),n(Rt,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(Pt,[2,177]),{13:f,16:h,44:136,45:te,46:395,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:396,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:397,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:398,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:399,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,183]),n(Pt,[2,98]),n(Rt,[2,381],{180:400}),{87:[1,401]},n(Pt,[2,185]),{13:f,16:h,44:136,45:te,46:402,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{29:U,57:403},n(Ar,[2,193]),{13:f,16:h,55:404,307:43,308:p},{13:f,16:h,44:39,55:40,87:d,139:342,195:405,197:Vs,307:43,308:p},n(ls,[2,233]),n(ls,[2,234]),n(ls,[2,235]),n(Rv,[2,459],{281:406,325:[1,407]}),n(Rt,[2,463],{284:408,325:[1,409]}),n(Rt,[2,465],{286:410,325:[1,411]}),{13:f,16:h,31:[1,412],55:414,82:$,171:413,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},{31:[1,419],89:[1,420]},{29:[1,421]},n(du,[2,302]),n(fu,[2,367],{167:422}),n(hu,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(du,[2,371]),n($s,[2,122]),n($s,[2,417]),n($s,[2,413]),n($s,[2,414]),n($s,[2,415]),n(di,[2,125]),n(di,[2,127]),n(di,[2,128]),n(Fv,[2,420],{227:426}),n(di,[2,130]),{13:f,16:h,55:194,197:ot,223:427,307:43,308:p},{48:[1,428]},n(us,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(mp,[2,288]),{64:[1,433]},n(pt,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:h,45:te,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,276:Me,277:ye,279:Fe,280:xe,283:De,285:je,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P}),n(Dv,[2,293]),n(_p,[2,92]),n(_p,[2,93]),n(_p,[2,94]),{45:Tv,89:xv,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:C,29:j,56:85},{19:438,28:C,29:j,56:85},n(Bs,[2,355],{149:439}),n(Bs,[2,354]),{13:f,16:h,44:215,45:gu,55:220,82:$,87:d,89:ze,156:440,172:221,185:441,203:442,231:yu,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(H,[2,19]),n(us,[2,21]),{13:f,16:h,44:450,45:Nv,55:323,65:445,66:446,67:447,68:448,87:d,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Ua,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(Q,[2,386],{31:[2,388]}),n(Ec,[2,102]),n(qs,[2,391],{191:452}),n(Q,[2,395],{196:453,198:454}),n(Q,[2,108]),n(Q,[2,109]),n(Ec,[2,103]),n(Ec,[2,104]),n(Ec,[2,390]),{13:f,16:h,44:215,45:He,48:[1,455],55:220,82:$,87:d,89:ze,172:221,185:351,187:350,200:456,231:Jt,234:349,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(vu,[2,424]),n(Lv,[2,136]),n(Lv,[2,137]),n(bp,[2,140]),{232:[1,457]},{13:f,16:h,44:39,55:40,87:d,139:342,195:458,197:Vs,307:43,308:p},n(ls,[2,219]),n(ls,[2,220]),n(ls,[2,221]),n(ls,[2,222]),n(ls,[2,223]),n(Ua,[2,10]),n(Zt,[2,46]),n(Zt,[2,314]),{112:vv,122:459},n(Zt,[2,62]),n(Y,_v,{133:242,108:460,112:bv,132:Sv}),n(Pv,[2,61]),n(Zt,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n(Us,[2,351],{146:463,335:[1,464]}),{29:U,57:465},n(cs,[2,329]),n(Y,[2,332],{129:466,327:[1,467]}),n(cs,[2,55]),n(cs,[2,331]),{48:[1,468]},n(lu,[2,429]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n($a,[2,431]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,243:470,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n($a,[2,156]),{45:Av,89:Cv,179:471},n(Va,[2,441]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,251:472,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Bt,[2,444],{256:473}),n(Bt,[2,446],{258:474}),n(Rt,[2,442]),n(Rt,[2,443]),n(Bt,[2,449]),{13:f,16:h,44:136,45:te,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,255:154,257:155,259:475,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rt,[2,450]),n(Rt,[2,451]),n(Rt,[2,379],{178:476}),n(Rt,[2,378]),n([6,13,16,29,31,39,45,47,48,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],[2,175]),{48:[1,477]},{48:[1,478]},{272:[1,479]},{272:[1,480]},{272:[1,481]},{13:f,16:h,44:136,45:te,46:482,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{48:[1,483]},{48:[1,484]},n(Pt,[2,187]),n(Ar,[2,194]),{13:f,16:h,44:39,55:40,82:$,87:d,139:289,172:291,255:154,257:155,266:290,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,320:485},{13:f,16:h,39:[1,487],44:136,45:te,46:488,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,282:486,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rv,[2,460]),{13:f,16:h,44:136,45:te,46:489,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rt,[2,464]),{13:f,16:h,44:136,45:te,46:490,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Rt,[2,466]),n(K,[2,40]),n(fu,[2,298]),n(Tc,[2,87]),n(Tc,[2,88]),n(Tc,[2,89]),n(Tc,[2,90]),{13:f,16:h,55:492,82:$,172:493,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,311:494,312:xr,315:491},n(K,[2,41]),n(hu,[2,300]),n(xc,[2,303],{92:495}),{13:f,16:h,31:[1,496],55:414,82:$,171:497,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},{31:[1,498],89:[1,499]},{29:[1,500]},n(du,[2,372]),{13:f,16:h,48:[2,422],55:194,197:ot,223:312,226:502,228:501,229:Iv,307:43,308:p},n(di,[2,131]),n(di,[2,126]),n(us,[2,22]),n(us,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:h,44:510,45:te,55:323,67:321,68:322,74:505,75:506,76:kv,77:320,78:Mv,79:509,87:d,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Dv,[2,294]),n(jv,[2,69]),n(jv,[2,70]),n(pt,Ce,{59:197,69:198,20:511,70:V}),n(q,z,{58:205,62:206,23:512,63:Ee}),{29:[2,375],31:[2,71],84:522,85:a,112:[1,518],150:513,151:514,158:515,159:[1,516],160:[1,517],161:[1,519],163:[1,520],164:[1,521],175:523},n(Bs,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:d}),n(_u,[2,399],{215:10,205:527,208:528,214:529,44:530,204:531,202:532,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:d}),{13:f,16:h,44:215,45:gu,55:220,82:$,87:d,89:ze,172:221,185:351,203:536,212:534,231:yu,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:d}),n(q,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:h,45:Nv,87:d,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,276:Me,277:ye,279:Fe,280:xe,283:De,285:je,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P}),n(Gs,[2,291]),n(Gs,[2,24]),n(Gs,[2,25]),{13:f,16:h,44:136,45:te,46:539,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Gs,[2,28]),n(q,z,{58:205,62:206,23:540,63:Ee}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(qs,[2,107]),{13:f,16:h,44:215,45:He,55:220,82:$,87:d,89:ze,172:221,185:351,187:350,199:543,200:544,231:Jt,234:349,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n($v,[2,132]),n(vu,[2,425]),n($v,[2,133]),{13:f,16:h,44:354,55:355,82:$,87:d,172:357,237:356,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:358,312:xr,313:545},n(Zt,[2,54]),n(Zt,[2,48]),n(Us,[2,342]),{13:f,16:h,44:39,55:40,87:d,139:546,307:43,308:p},n(Us,[2,68]),n(Q,[2,350],{31:Vv,112:Vv}),n(Zt,[2,53]),{13:f,16:h,55:547,307:43,308:p},n(Y,[2,333]),n(Ue,[2,16]),n(lu,[2,152]),n($a,[2,154]),n($a,[2,157]),n(Va,[2,159]),n(Va,[2,160],{262:389,261:548,39:yp,338:vp}),n(Va,[2,161],{262:389,261:549,39:yp,338:vp}),n(Bt,[2,163]),{13:f,16:h,44:136,45:te,46:550,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,178]),n(Pt,[2,179]),{13:f,16:h,44:136,45:te,46:551,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:552,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:553,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{48:[1,554],272:[1,555]},n(Pt,[2,184]),n(Pt,[2,186]),{314:[1,556]},{48:[1,557]},{48:[2,461]},{48:[2,462]},{48:[1,558]},{48:[2,467],193:[1,561],287:559,288:560},{13:f,16:h,55:194,197:ot,223:562,307:43,308:p},n(Sp,[2,224]),n(Sp,[2,225]),n(Sp,[2,226]),{31:[1,563],45:Uv,94:564},n(K,[2,84]),n(fu,[2,368]),n(K,[2,85]),n(hu,[2,370]),n(xc,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(us,[2,35],{83:[1,569]}),n(us,[2,36],{81:[1,570]}),n(mp,[2,30],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:509,44:510,75:571,13:f,16:h,45:te,76:kv,78:Mv,87:d,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,276:Me,277:ye,279:Fe,280:xe,283:De,285:je,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P}),n(Ba,[2,295]),{45:te,77:572},{45:te,77:573},n(Ba,[2,33]),n(Ba,[2,34]),{31:[2,275],50:574,84:575,85:a},{31:[2,277],51:576,84:577,85:a},n(Bs,[2,356]),n(Bv,[2,357],{152:578,335:[1,579]}),n(Vi,[2,74]),{29:U,57:580},{29:U,57:581},{13:f,16:h,44:39,55:40,87:d,139:582,307:43,308:p},n(qv,[2,365],{162:583,328:[1,584]}),{13:f,16:h,45:te,55:323,67:321,68:322,77:320,79:585,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,307:43,308:p,346:$e,347:Pe,348:S,349:w,350:T,351:P},{45:[1,586]},n(Vi,[2,81]),{29:U,57:587},n(Bs,[2,73]),n(Q,[2,362],{29:Ui,31:Ui,85:Ui,112:Ui,159:Ui,160:Ui,161:Ui,163:Ui,164:Ui}),n(_u,[2,112]),n(qa,[2,401],{206:588}),n(Q,[2,405],{209:589,210:590}),n(Q,[2,403]),n(Q,[2,404]),n(_u,[2,113]),n(_u,[2,400]),{13:f,16:h,44:215,45:gu,48:[1,591],55:220,82:$,87:d,89:ze,172:221,185:351,203:536,212:592,231:yu,234:535,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n(vu,[2,426]),n(bp,[2,138]),n(bp,[2,139]),{232:[1,593]},n(Gs,[2,292]),{47:[1,595],48:[1,594]},n(Ua,[2,9]),n(qs,[2,392]),n(qs,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:h,87:d,197:Vs,308:p}),n(qs,[2,110],{272:[1,598]}),n(bu,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n(cs,[2,58]),n(Bt,[2,445]),n(Bt,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(Pt,[2,99]),n(Rt,[2,382]),n([13,16,39,47,48,87,193,197,242,246,250,263,265,272,290,297,298,299,300,301,302,308,314,338,341,342,343,344,345,346],[2,232]),n(Pt,[2,188]),n(Pt,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:h,55:492,82:$,172:493,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,311:494,312:xr,315:611},n(K,[2,42]),n(xc,[2,304]),{13:f,16:h,55:414,82:$,95:612,171:613,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},{31:[1,614],45:Uv,94:615},n(di,[2,129]),n(Fv,[2,421]),{82:[1,616]},{82:[1,617]},n(Ba,[2,296]),n(Ba,[2,31]),n(Ba,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(Q,Ov,{155:330,153:618,154:619,29:Bi,31:Bi,85:Bi,112:Bi,159:Bi,160:Bi,161:Bi,163:Bi,164:Bi}),n(Bv,[2,358]),n(Vi,[2,75]),n(Vi,[2,76]),{29:U,57:620},{13:f,16:h,44:39,55:40,87:d,139:621,307:43,308:p},n(qv,[2,366]),n(Vi,[2,79]),{13:f,16:h,44:136,45:te,46:622,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Vi,[2,91],{336:[1,623]}),n([29,31,85,112,159,160,161,163,164,232,318,335],[2,114],{207:624,193:[1,625]}),n(qa,[2,117]),{13:f,16:h,44:215,45:gu,55:220,82:$,87:d,89:ze,172:221,185:351,203:536,211:626,212:627,231:yu,234:535,236:216,237:222,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,309:Br,310:Jr,311:217,312:xr},n($i,[2,134]),n(vu,[2,427]),n($i,[2,135]),n(Gs,[2,26]),{44:628,87:d},n(qs,[2,106]),n(qs,[2,394]),n(Q,[2,396]),n(bu,[2,111]),n(bu,[2,398]),{13:f,16:h,44:39,55:40,87:d,139:342,186:629,190:340,195:341,197:Vs,307:43,308:p},n(gp,[2,217]),n(Q,cu,{144:248,140:630,143:631,31:[2,343]}),n(Pt,[2,97]),n(Rt,[2,380]),n(Pt,[2,180]),{13:f,16:h,44:136,45:te,46:632,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},{13:f,16:h,44:136,45:te,46:633,55:133,67:132,68:134,77:131,82:$,87:d,172:135,224:Ze,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:it,264:130,265:B,266:137,267:139,268:Te,269:Ne,270:J,271:Le,273:ke,274:Re,275:146,276:Me,277:ye,278:149,279:Fe,280:xe,283:De,285:je,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:Ge,346:$e,347:Pe,348:S,349:w,350:T,351:P},n(Pt,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:h,48:[1,636],55:414,82:$,171:637,172:415,173:416,174:pu,255:154,257:155,291:150,294:se,295:le,296:ue,297:ae,298:oe,299:ce,300:ie,301:fe,302:he,303:de,304:pe,305:ne,306:me,307:43,308:p,312:mu},n(Gv,[2,305]),n(K,[2,86]),n(xc,[2,374]),n(us,[2,37]),n(us,[2,38]),n(Bs,[2,72]),n(Bs,[2,360]),n(Vi,[2,77]),{29:U,57:638},{47:[1,639]},{29:[2,376]},n(qa,[2,402]),n(qa,[2,115],{215:10,208:528,214:529,44:530,205:640,13:i,16:i,45:i,197:i,224:i,229:i,308:i,87:d}),n(qa,[2,118],{272:[1,641]}),n(Su,[2,407],{213:642,319:643,317:[1,644]}),{48:[1,645]},{318:[1,646]},{31:[1,647]},{31:[2,344]},{48:[1,648]},{48:[1,649]},{291:650,303:de,304:pe,305:ne,306:me},n(Tc,[2,218]),n(xc,[2,44]),n(Gv,[2,306]),n(Vi,[2,78]),{44:651,87:d},n(qa,[2,116]),n(Q,[2,406]),n(Su,[2,119]),n(Su,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:d}),n(Gs,[2,27]),n(bu,[2,230]),n(Wv,[2,345],{141:653,335:[1,654]}),n(Pt,[2,181]),n(Pt,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(Q,cu,{144:248,142:657,143:658,31:Hv,112:Hv}),n(Wv,[2,346]),n(Vi,[2,80]),n(Su,[2,231]),n(Us,[2,67]),n(Us,[2,348])],defaultActions:{5:[2,240],6:[2,241],7:[2,242],9:[2,239],24:[2,1],25:[2,2],26:[2,244],87:[2,282],94:[2,384],100:[2,45],109:[2,325],166:[2,458],263:[2,439],336:[2,258],337:[2,101],487:[2,461],488:[2,462],560:[2,468],574:[2,17],575:[2,276],576:[2,18],577:[2,278],623:[2,376],631:[2,344],650:[2,191]},parseError:o(function(x,O){if(O.recoverable)this.trace(x);else{var F=new Error(x);throw F.hash=O,F}},"parseError"),parse:o(function(x){var O=this,F=[0],Z=[],Ae=[null],m=[],Ir=this.table,g="",gi=0,Oc=0,xu=0,Au=2,Pc=1,Cu=m.slice.call(arguments,1),Et=Object.create(this.lexer),yi={yy:{}};for(var Rc in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Rc)&&(yi.yy[Rc]=this.yy[Rc]);Et.setInput(x,yi.yy),yi.yy.lexer=Et,yi.yy.parser=this,typeof Et.yylloc>"u"&&(Et.yylloc={});var Qa=Et.yylloc;m.push(Qa);var ct=Et.options&&Et.options.ranges;typeof yi.yy.parseError=="function"?this.parseError=yi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function St(vi){F.length=F.length-2*vi,Ae.length=Ae.length-vi,m.length=m.length-vi}o(St,"popStack");for(var Qe=o(function(){var vi;return vi=Et.lex()||Pc,typeof vi!="number"&&(vi=O.symbols_[vi]||vi),vi},"lex"),et,qr,Qs,fn,CU,Np,Ya={},Iu,Wi,i_,Ou;;){if(Qs=F[F.length-1],this.defaultActions[Qs]?fn=this.defaultActions[Qs]:((et===null||typeof et>"u")&&(et=Qe()),fn=Ir[Qs]&&Ir[Qs][et]),typeof fn>"u"||!fn.length||!fn[0]){var Lp="";Ou=[];for(Iu in Ir[Qs])this.terminals_[Iu]&&Iu>Au&&Ou.push("'"+this.terminals_[Iu]+"'");Et.showPosition?Lp="Parse error on line "+(gi+1)+`:
|
|
271
271
|
`+Et.showPosition()+`
|
|
272
272
|
Expecting `+Ou.join(", ")+", got '"+(this.terminals_[et]||et)+"'":Lp="Parse error on line "+(gi+1)+": Unexpected "+(et==Pc?"end of input":"'"+(this.terminals_[et]||et)+"'"),this.parseError(Lp,{text:Et.match,token:this.terminals_[et]||et,line:Et.yylineno,loc:Qa,expected:Ou})}if(fn[0]instanceof Array&&fn.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Qs+", token: "+et);switch(fn[0]){case 1:F.push(et),Ae.push(Et.yytext),m.push(Et.yylloc),F.push(fn[1]),et=null,qr?(et=qr,qr=null):(Oc=Et.yyleng,g=Et.yytext,gi=Et.yylineno,Qa=Et.yylloc,xu>0&&xu--);break;case 2:if(Wi=this.productions_[fn[1]][1],Ya.$=Ae[Ae.length-Wi],Ya._$={first_line:m[m.length-(Wi||1)].first_line,last_line:m[m.length-1].last_line,first_column:m[m.length-(Wi||1)].first_column,last_column:m[m.length-1].last_column},ct&&(Ya._$.range=[m[m.length-(Wi||1)].range[0],m[m.length-1].range[1]]),Np=this.performAction.apply(Ya,[g,Oc,gi,yi.yy,fn[1],Ae,m].concat(Cu)),typeof Np<"u")return Np;Wi&&(F=F.slice(0,-1*Wi*2),Ae=Ae.slice(0,-1*Wi),m=m.slice(0,-1*Wi)),F.push(this.productions_[fn[1]][0]),Ae.push(Ya.$),m.push(Ya._$),i_=Ir[F[F.length-2]][F[F.length-1]],F.push(i_);break;case 3:return!0}}return!0},"parse")},wu=iy().Wildcard,Eu="http://www.w3.org/1999/02/22-rdf-syntax-ns#",sI=Eu+"type",aI=Eu+"first",oI=Eu+"rest",zv=Eu+"nil",Tu="http://www.w3.org/2001/XMLSchema#",Qv=Tu+"integer",Yv=Tu+"decimal",Kv=Tu+"double",cI=Tu+"boolean",Ws="",Xv="",Jv="";function Cr(I){return I.toLowerCase()}o(Cr,"lowercase");function qi(I,x){return I.push(x),I}o(qi,"appendTo");function Hs(I,x){return I.push.apply(I,x),I}o(Hs,"appendAllTo");function xt(I){I||(I={});for(var x=1,O=arguments.length,F;x<O&&(F=arguments[x]||{});x++)for(var Z in F)I[Z]=F[Z];return I}o(xt,"extend");function pi(){for(var I=[],x=0,O=arguments.length;x<O;x++)I=I.concat.apply(I,arguments[x]);return I}o(pi,"unionAll");function Ac(I){if(I[0]==="<"&&(I=I.substring(1,I.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(I))return I;if(!Oe.base)throw new Error("Cannot resolve relative IRI "+I+" because no base IRI was set.");switch(Ws!==Oe.base&&(Ws=Oe.base,Xv=Ws.replace(/[^\/:]*$/,""),Jv=Ws.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),I[0]){case void 0:return Ws;case"#":return Ws+I;case"?":return Ws.replace(/(?:\?.*)?$/,I);case"/":return Jv+I;default:return Xv+I}}o(Ac,"resolveIRI");function Ep(I){if(I){var x=I[0];if(x==="?"||x==="$")return Oe.factory.variable(I.substr(1))}return I}o(Ep,"toVar");function er(I,x){return{type:"operation",operator:I,args:x||[]}}o(er,"operation");function Ga(I,x){var O={expression:I==="*"?new wu:I};if(x)for(var F in x)O[F]=x[F];return O}o(Ga,"expression");function Wa(I,x){return{type:"path",pathType:I,items:x}}o(Wa,"path");function Tp(I,x){for(var O=0,F=x.length,Z;O<F&&(Z=x[O]);O++)I=er(Z[0],[I,Z[1]]);return I}o(Tp,"createOperationTree");function zs(I,x){var O=[],F=[],Z=I.length,Ae,m={};if(!Z)return null;for(var Ir=0;Ir<Z&&(Ae=I[Ir]);Ir++)(Ae.named?F:O).push(Ae.iri);return m[x||"from"]={default:O,named:F},m}o(zs,"groupDatasets");function Ha(I){return parseInt(I,10)}o(Ha,"toInt");function xp(I){return I.type==="group"&&I.patterns.length===1?I.patterns[0]:I}o(xp,"degroupSingle");function mi(I,x){return x&&x.termType!=="NamedNode"&&(x=Oe.factory.namedNode(x)),Oe.factory.literal(I,x)}o(mi,"createTypedLiteral");function lI(I,x){return Oe.factory.literal(I,x)}o(lI,"createLangLiteral");function Ap(I,x,O){if(!("termType"in x))throw new Error("Nested triples cannot contain paths");return Oe.factory.quad(I,x,O)}o(Ap,"nestedTriple");function Gi(I,x,O,F){var Z={};return I!=null&&(Z.subject=I),x!=null&&(Z.predicate=x),O!=null&&(Z.object=O),F!=null&&(Z.annotations=F),Z}o(Gi,"triple");function Cc(I){return typeof I=="string"?I.startsWith("e_")?Oe.factory.blankNode(I):Oe.factory.blankNode("e_"+I):Oe.factory.blankNode("g_"+Zv++)}o(Cc,"blank");var Zv=0;Oe._resetBlanks=function(){Zv=0};var uI=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,fI={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
|
|
273
273
|
`,r:"\r",f:"\f"},hI=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,Cp=String.fromCharCode;function e_(I,x){I=I.substring(x,I.length-x);try{I=I.replace(uI,function(O,F,Z,Ae){var m;if(F){if(m=parseInt(F,16),isNaN(m))throw new Error;return Cp(m)}else if(Z){if(m=parseInt(Z,16),isNaN(m))throw new Error;return m<65535?Cp(m):Cp(55296+((m-=65536)>>10),56320+(m&1023))}else{var Ir=fI[Ae];if(!Ir)throw new Error;return Ir}})}catch{return""}if(hI.exec(I))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+I);return I}o(e_,"unescapeString");function dI(I){var x=Cc(),O=x,F=[],Z,Ae=[];I.forEach(function(gi){F.push(gi.entity),Hs(Ae,gi.triples)});for(var m=0,Ir=0,g=F.length,Z=Array(g*2);m<g;)Z[Ir++]=Gi(O,Oe.factory.namedNode(aI),F[m]),Z[Ir++]=Gi(O,Oe.factory.namedNode(oI),O=++m<g?Cc():Oe.factory.namedNode(zv));return{entity:x,triples:Hs(Z,Ae)}}o(dI,"createList");function pI(I){var x=Cc();return{entity:x,triples:I.map(function(O){return xt(Gi(x),O)})}}o(pI,"createAnonymousObject");function Ip(I,x,O){var F=[],Z=[];return x.forEach(function(Ae){let m=null;Ae.annotation&&(m=Ae.annotation,Ae=Ae.object),F.push(Gi(null,I,Ae.entity,m)),Hs(Z,Ae.triples)}),pi(F,O||[],Z)}o(Ip,"objectListToTriples");function xU(I){for(var x=[],O,F=0,Z;Z=I[F];F++)switch(Z.type){case"bgp":Z.triples.length&&(O?Hs(O.triples,Z.triples):qi(x,O=Z));break;default:(!Z.patterns||Z.patterns.length>0)&&(qi(x,Z),O=null)}return x}o(xU,"mergeAdjacentBGPs");function za(I){return I.variable?I.variable.value:I.value||I.expression.value}o(za,"getExpressionId");function Op(I){if(!I)return[];if(I.type==="aggregate")return[I];if(I.type==="operation"){let x=[];for(let O of I.args)x.push(...Op(O));return x}return[]}o(Op,"getAggregatesOfExpression");function mI(I){let x=new Set,O=o(function(F){F&&(F.termType==="Variable"?x.add(F):F.type==="operation"&&F.args.forEach(O))},"visitExpression");return O(I),x}o(mI,"getVariablesFromExpression");function Pp(I,x=1,O=[]){for(let F of I)x>0&&F instanceof Array?Pp(F,x-1,O):O.push(F);return O}o(Pp,"flatten");function Rp(I){return I.termType==="Variable"}o(Rp,"isVariable");function t_(I){if(I.triples){let x=[];for(let O of I.triples)Rp(O.subject)&&x.push(O.subject.value),Rp(O.predicate)&&x.push(O.predicate.value),Rp(O.object)&&x.push(O.object.value);return x}else if(I.patterns){let x=[];for(let O of I.patterns)x.push(...t_(O));return x}return[]}o(t_,"getBoundVarsFromGroupGraphPattern");function gI(I){let x=I.slice().sort(),O=[];for(let F=0;F<x.length-1;F++)x[F+1]==x[F]&&O.push(x[F]);return O}o(gI,"getDuplicatesInArray");function Ic(I){if(!Oe.sparqlStar)throw new Error("SPARQL-star support is not enabled");return I}o(Ic,"ensureSparqlStar");function r_(I,x,O){for(let F of x){let Z=Gi("subject"in F?F.subject:I,F.predicate,F.object);O.push(Z),F.annotations&&r_(Ap(I,F.predicate,F.object),F.annotations,O)}}o(r_,"_applyAnnotations");function Fp(I){if(Oe.sparqlStar){let x=[];return I.forEach(O=>{let F=Gi(O.subject,O.predicate,O.object);x.push(F),O.annotations&&r_(Ap(O.subject,O.predicate,O.object),O.annotations,x)}),x}return I}o(Fp,"applyAnnotations");function AU(I){if(!Oe.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return I}o(AU,"ensureSparqlStarNestedQuads");function n_(I){for(let x of I){if(x.type==="graph"&&x.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(x.type==="bgp"||x.type==="graph"){for(let O of x.triples)if(O.subject.termType==="Variable"||O.predicate.termType==="Variable"||O.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return I}o(n_,"ensureNoVariables");function Dp(I){for(let x of I)if(x.type==="bgp"){for(let O of x.triples)if(O.subject.termType==="BlankNode"||O.predicate.termType==="BlankNode"||O.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return I}o(Dp,"ensureNoBnodes");var yI=(function(){var I={EOF:1,parseError:o(function(O,F){if(this.yy.parser)this.yy.parser.parseError(O,F);else throw new Error(O)},"parseError"),setInput:o(function(x,O){return this.yy=O||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var O=x.match(/(?:\r\n?|\n).*/g);return O?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:o(function(x){var O=x.length,F=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-O),this.offset-=O;var Z=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),F.length-1&&(this.yylineno-=F.length-1);var Ae=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:F?(F.length===Z.length?this.yylloc.first_column:0)+Z[Z.length-F.length].length-F[0].length:this.yylloc.first_column-O},this.options.ranges&&(this.yylloc.range=[Ae[0],Ae[0]+this.yyleng-O]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
@@ -280,7 +280,7 @@ Expecting `+Ou.join(", ")+", got '"+(this.terminals_[et]||et)+"'":Lp="Parse erro
|
|
|
280
280
|
`)+`
|
|
281
281
|
`+s.trimStart()),s}findPrefixStarDeclarations(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+6)==="PREFIX"){let s=i;for(i+=6;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="*"){for(i++;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]==="<"){i++;let a=i;for(;i<e.length&&e[i]!==">";)i++;if(e[i]===">"){let c=e.substring(a,i);i++;let l=this.findDeclarationEnd(e,i);t.push({uri:c,startPos:s,endPos:l}),i=l;continue}else throw new mo(`Unclosed IRI in PREFIX* declaration at position ${a}`)}else throw new mo(`Expected IRI after PREFIX* at position ${i}`)}else continue}i++}return t}findDeclarationEnd(e,t){let r=t;for(;r<e.length;){let i=e[r];if(i===`
|
|
282
282
|
`)return r+1;let s=e.substring(r).toUpperCase();if(s.startsWith("PREFIX")||s.startsWith("BASE")||s.startsWith("SELECT")||s.startsWith("CONSTRUCT")||s.startsWith("DESCRIBE")||s.startsWith("ASK"))return r;if(/\s/.test(i)){r++;continue}break}return r}extractPrefixFromUri(e){let t=e.replace(/^https?:\/\//,"");t=t.replace(/\/$/,"").replace(/#$/,"");let r=t.split(/[/.#]+/).filter(Boolean);if(r.length===0)return null;let i=r[r.length-1];return/^(ontology|vocab|schema|ns|core)$/i.test(i)&&r.length>1?r[r.length-2].toLowerCase():i.toLowerCase().replace(/[^a-z0-9]/g,"")}};ws.PrefixStarTransformer=vy;var mo=class extends Error{static{o(this,"PrefixStarTransformerError")}constructor(e){super(`PREFIX* transformation error: ${e}`),this.name="PrefixStarTransformerError"}};ws.PrefixStarTransformerError=mo});var _y=v(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.DescribeOptionsTransformer=yo.DescribeOptionsTransformerError=void 0;var fh=class extends Error{static{o(this,"DescribeOptionsTransformerError")}constructor(e){super(e),this.name="DescribeOptionsTransformerError"}};yo.DescribeOptionsTransformerError=fh;var go=class n{static{o(this,"DescribeOptionsTransformer")}transform(e){if(!n.DESCRIBE_QUERY_PATTERN.test(e))return{query:e};let t=e,r={},i=!1,s=n.DEPTH_PATTERN.exec(e);if(s){let a=parseInt(s[1],10);if(a<0)throw new fh(`DESCRIBE DEPTH must be a non-negative integer, got: ${a}`);r.depth=a,i=!0,n.DEPTH_PATTERN.lastIndex=0,t=t.replace(n.DEPTH_PATTERN,"")}return n.DEPTH_PATTERN.lastIndex=0,n.SYMMETRIC_PATTERN.test(e)&&(r.symmetric=!0,i=!0,n.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(n.SYMMETRIC_PATTERN,"")),n.SYMMETRIC_PATTERN.lastIndex=0,t=t.replace(/\s{2,}/g," ").trim(),{query:t,options:i?r:void 0}}hasDescribeOptions(e){let t=n.DEPTH_PATTERN.test(e);n.DEPTH_PATTERN.lastIndex=0;let r=n.SYMMETRIC_PATTERN.test(e);return n.SYMMETRIC_PATTERN.lastIndex=0,t||r}};yo.DescribeOptionsTransformer=go;go.DEPTH_PATTERN=/\bDEPTH\s+(\d+)/gi;go.SYMMETRIC_PATTERN=/\bSYMMETRIC\b/gi;go.DESCRIBE_QUERY_PATTERN=/\bDESCRIBE\b/i});var dw=v(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.DirectionalLangTagTransformerError=vo.DirectionalLangTagTransformer=void 0;var hh=class n{static{o(this,"DirectionalLangTagTransformer")}constructor(){this.directionMappings=new Map}transform(e){return this.directionMappings.clear(),e.replace(n.DIRECTIONAL_TAG_REGEX,(t,r,i,s,a)=>{let c=s.toLowerCase();return this.directionMappings.set(c,a),`${r}${i}${r}@${s}`})}getDirection(e){return this.directionMappings.get(e.toLowerCase())}getAllMappings(){return new Map(this.directionMappings)}hasDirectionalTags(e){return n.DIRECTIONAL_TAG_REGEX.lastIndex=0,n.DIRECTIONAL_TAG_REGEX.test(e)}clearMappings(){this.directionMappings.clear()}};vo.DirectionalLangTagTransformer=hh;hh.DIRECTIONAL_TAG_REGEX=/(["'])((?:[^\\]|\\.)*?)\1@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)--(ltr|rtl)/g;var by=class extends Error{static{o(this,"DirectionalLangTagTransformerError")}constructor(e){super(`Directional language tag transformation error: ${e}`),this.name="DirectionalLangTagTransformerError"}};vo.DirectionalLangTagTransformerError=by});var pw=v(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.TripleTermTransformerError=bo.TripleTermTransformer=void 0;var Sy=class{static{o(this,"TripleTermTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new _o("Too many nested triple terms (max 100 iterations)");while(t!==r);return t}hasTripleTermSyntax(e){return this.findTripleTermPositions(e).length>0}transformSinglePass(e){let t=this.findTripleTermPositions(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.extractTripleTerm(r,s);if(a){let c=this.convertToStandardSyntax(a.content);r=r.substring(0,s)+c+r.substring(s+a.length)}}return r}findTripleTermPositions(e){let t=[],r=0;for(;r<e.length;){if(e[r]==="'"){r=this.skipStringLiteral(e,r,"'");continue}if(e[r]==='"'){r=this.skipStringLiteral(e,r,'"');continue}if(e.substring(r,r+2)==="<<"&&this.isParenthesizedTripleTerm(e,r)){t.push(r),r+=2;continue}r++}return t}skipStringLiteral(e,t,r){let i=r.repeat(3);if(e.substring(t,t+3)===i){for(t+=3;t<e.length;){if(e.substring(t,t+3)===i)return t+3;e[t]==="\\"&&t++,t++}return t}for(t++;t<e.length&&e[t]!==r;)e[t]==="\\"&&t++,t++;return t+1}isParenthesizedTripleTerm(e,t){let r=t+2;for(;r<e.length&&/\s/.test(e[r]);)r++;return e[r]==="("}extractTripleTerm(e,t){let r=t+2;for(;r<e.length&&/\s/.test(e[r]);)r++;if(e[r]!=="(")return null;r++;let i=1;for(;r<e.length&&i>0;){if(e[r]==="'"||e[r]==='"'){r=this.skipStringLiteral(e,r,e[r]);continue}if(e.substring(r,r+2)==="<<"&&this.isParenthesizedTripleTerm(e,r)){for(r+=2;r<e.length&&/\s/.test(e[r]);)r++;e[r]==="("&&(i++,r++);continue}if(e.substring(r,r+2)==="<<"){r+=2;let s=1;for(;r<e.length&&s>0;){if(e[r]==="'"||e[r]==='"'){r=this.skipStringLiteral(e,r,e[r]);continue}if(e.substring(r,r+2)==="<<"){s++,r+=2;continue}if(e.substring(r,r+2)===">>"){s--,r+=2;continue}r++}continue}if(e[r]==="("){i++,r++;continue}if(e[r]===")"){let s=r+1;for(;s<e.length&&/\s/.test(e[s]);)s++;if(e.substring(s,s+2)===">>"){if(i--,i===0){let a=e.substring(t,s+2);return{content:a,length:a.length}}r=s+2;continue}r++;continue}r++}if(i>0)throw new _o(`Unclosed triple term at position ${t}: missing )>>`);return null}convertToStandardSyntax(e){let t=e.match(/^<<\s*\(\s*([\s\S]*?)\s*\)\s*>>$/);if(!t)throw new _o(`Invalid triple term syntax: ${e.substring(0,50)}...`);return`<< ${t[1]} >>`}};bo.TripleTermTransformer=Sy;var _o=class extends Error{static{o(this,"TripleTermTransformerError")}constructor(e){super(`Triple term transformation error: ${e}`),this.name="TripleTermTransformerError"}};bo.TripleTermTransformerError=_o});var Ey=v(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.VaultPrefixTransformer=void 0;var X5=/PREFIX\s+(\w+)\s*:/gi,J5=new Set(["mailto","http","https","urn","ftp","prefix","base","select","construct","describe","ask","where","filter","optional","union","graph","order","group","having","limit","offset","values","bind","minus","service","insert","delete","load","clear","drop","create","move","copy","add"]),wy=class{static{o(this,"VaultPrefixTransformer")}constructor(){this.vaultPrefixes=new Map}setVaultPrefixes(e){this.vaultPrefixes=new Map(e)}getVaultPrefixes(){return new Map(this.vaultPrefixes)}transform(e){if(this.vaultPrefixes.size===0)return e;let t=this.findDeclaredPrefixes(e),r=[];for(let[a,c]of this.vaultPrefixes)!t.has(a.toLowerCase())&&!J5.has(a.toLowerCase())&&r.push({prefix:a,baseIRI:c});if(r.length===0)return e;let i="",s=0;for(;s<e.length;){let a=e[s];if(a==='"'||a==="'"){let l=this.skipLiteral(e,s);i+=e.substring(s,l),s=l;continue}if(a==="<"){let l=e.indexOf(">",s);l!==-1?(i+=e.substring(s,l+1),s=l+1):(i+=a,s++);continue}if(a==="#"){let l=e.indexOf(`
|
|
283
|
-
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=a,s++}return i}tryReplacePrefixedName(e,t,r){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of r){if(e.substring(t,t+i.length+1)!==i+":")continue;let a=t+i.length+1,c=a;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===a)continue;let l=e.substring(a,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(X5.source,"gi"),i;for(;(i=r.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let r=e[t];if(t+2<e.length&&e.substring(t,t+3)===r+r+r){let s=e.indexOf(r+r+r,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};dh.VaultPrefixTransformer=wy});var yw=v(wn=>{"use strict";var Z5=wn&&wn.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),e9=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),t9=wn&&wn.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&Z5(t,e,r[i]);return e9(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.SPARQLParser=wn.SPARQLParseError=void 0;var mw=t9(fw()),Ty=gy(),xy=yy(),gw=hw(),Ay=_y(),r9=dw(),Cy=pw(),n9=Ey(),Mt=class extends Error{static{o(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};wn.SPARQLParseError=Mt;var Iy=class{static{o(this,"SPARQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new mw.Parser({sparqlStar:!0}),this.generator=new mw.Generator({sparqlStar:!0}),this.caseWhenTransformer=new Ty.CaseWhenTransformer,this.lateralTransformer=new xy.LateralTransformer,this.prefixStarTransformer=new gw.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new Ay.DescribeOptionsTransformer,this.directionalLangTagTransformer=new r9.DirectionalLangTagTransformer,this.tripleTermTransformer=new Cy.TripleTermTransformer,this.vaultPrefixTransformer=new n9.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof Ay.DescribeOptionsTransformerError)throw new Mt(t.message);if(t instanceof xy.LateralTransformerError)throw new Mt(t.message);if(t instanceof Ty.CaseWhenTransformerError)throw new Mt(t.message);if(t instanceof Cy.TripleTermTransformerError)throw new Mt(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new Mt(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}parseWithOptions(e){return{query:this.parse(e),describeOptions:this.lastDescribeOptions}}getLastDescribeOptions(){return this.lastDescribeOptions}async parseAsync(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=await this.prefixStarTransformer.transform(i),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof Ay.DescribeOptionsTransformerError)throw new Mt(t.message);if(t instanceof gw.PrefixStarTransformerError)throw new Mt(t.message);if(t instanceof xy.LateralTransformerError)throw new Mt(t.message);if(t instanceof Ty.CaseWhenTransformerError)throw new Mt(t.message);if(t instanceof Cy.TripleTermTransformerError)throw new Mt(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new Mt(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}async parseAsyncWithOptions(e){return{query:await this.parseAsync(e),describeOptions:this.lastDescribeOptions}}hasPrefixStar(e){return/PREFIX\s*\*/i.test(e)}hasLateral(e){return this.lateralTransformer.hasLateral(e)}hasDescribeOptions(e){return this.describeOptionsTransformer.hasDescribeOptions(e)}hasDirectionalLangTags(e){return this.directionalLangTagTransformer.hasDirectionalTags(e)}hasTripleTermSyntax(e){return this.tripleTermTransformer.hasTripleTermSyntax(e)}getLastDirectionMappings(){return new Map(this.lastDirectionMappings)}getDirectionForLanguage(e){return this.lastDirectionMappings.get(e.toLowerCase())}toString(e){try{return this.generator.stringify(e)}catch(t){throw t instanceof Error?new Mt(`Failed to serialize SPARQL query: ${t.message}`,void 0,void 0,t):t}}getQueryType(e){if("queryType"in e&&e.type==="query")return e.queryType;throw new Mt("Query does not have a valid queryType property")}isSelectQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="SELECT"}isConstructQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="CONSTRUCT"}isAskQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="ASK"}isDescribeQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="DESCRIBE"}isUpdateQuery(e){return e.type==="update"}isInsertDataOperation(e){return"updateType"in e&&e.updateType==="insert"}isDeleteDataOperation(e){return"updateType"in e&&e.updateType==="delete"}validateQuery(e){if(!e||typeof e!="object")throw new Mt("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new Mt(`Invalid type: expected "query" or "update", got "${e.type}"`);if(e.type==="query"){let t=["SELECT","CONSTRUCT","ASK","DESCRIBE"];if(!t.includes(e.queryType))throw new Mt(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};wn.SPARQLParser=Iy});var _w=v(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.AlgebraTranslator=So.AlgebraTranslatorError=void 0;var vw=yy(),ve=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};So.AlgebraTranslatorError=ve;var Oy=class{static{o(this,"AlgebraTranslator")}constructor(){this.directionMappings=new Map,this.aggregateCounter=0}setDirectionMappings(e){this.directionMappings=e}translate(e){if(e.type!=="query")throw new ve("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new ve(`Query type ${e.queryType} not yet supported`)}translateSelect(e){let t;if(!e.where||e.where.length===0)throw new ve("SELECT query must have WHERE clause");t=this.translateWhere(e.where),this.aggregateCounter=0;let r=new Map,i=this.extractAggregatesWithMapping(e.variables,r),s=this.extractGroupVariables(e.group),a=this.extractHavingExpressions(e.having,i,r);if((i.length>0||s.length>0||a.length>0)&&(t={type:"group",variables:s,aggregates:i,having:a.length>0?a:void 0,input:t}),e.variables&&e.variables.length>0){for(let l of e.variables){let u=l;if(u.expression&&u.variable){if(u.expression.type==="aggregate")continue;let f=this.transformExpressionWithAggregateVars(u.expression,r);t={type:"extend",variable:u.variable.value,expression:f,input:t}}}let c=e.variables.filter(l=>l.termType==="Variable"||l.variable).map(l=>l.termType==="Variable"?l.value:l.variable.value);c.length>0&&(t={type:"project",variables:c,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(c=>this.translateOrderComparator(c)),input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new ve("CONSTRUCT query must have WHERE clause");let r=this.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.translateWhere(e.where):{type:"bgp",triples:[]}}}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)!i.expression||!i.variable||(i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}collectNestedAggregates(e,t,r){if(e){if(e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if(e.type==="operation"&&e.args)for(let i of e.args)this.collectNestedAggregates(i,t,r)}}transformExpressionWithAggregateVars(e,t){if(t.has(e))return{type:"variable",name:t.get(e)};if(e.type==="operation"&&e.args){let r=e.args.map(c=>this.transformExpressionWithAggregateVars(c,t)),i=["=","!=","<",">","<=",">="],s=["&&","||","!"],a=["+","-","*","/"];return i.includes(e.operator)?{type:"comparison",operator:e.operator,left:r[0],right:r[1]}:s.includes(e.operator)?{type:"logical",operator:e.operator,operands:r}:a.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:r[0],right:r[1]}:{type:"function",function:e.operator,args:r}}return this.translateExpression(e)}extractGroupVariables(e){return e?e.filter(t=>t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}translateAggregateExpression(e){let t=e.aggregation;if(typeof t=="string"){let r=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(r)?{type:"aggregate",aggregation:r,expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}}if(t&&typeof t=="object"){let r;if(t.termType==="NamedNode"&&t.value)r=t.value;else if("value"in t)r=String(t.value);else throw new ve(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(t)}`);return{type:"aggregate",aggregation:{type:"custom",iri:r},expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}}throw new ve(`Unknown aggregate format: ${JSON.stringify(t)}`)}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1)return e.patterns[0];throw new ve("Invalid lateral pattern structure")}translateWhere(e){if(e.length===0)throw new ve("Empty WHERE clause");let t=e.filter(a=>a.type==="filter"),r=e.filter(a=>a.type==="bind"),i=e.filter(a=>a.type!=="filter"&&a.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)i[0].type==="optional"?s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:i[0].expression?this.translateExpression(i[0].expression):void 0}:s=this.translatePattern(i[0]);else{i[0].type==="optional"?s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:i[0].expression?this.translateExpression(i[0].expression):void 0}:s=this.translatePattern(i[0]);for(let a=1;a<i.length;a++){let c=i[a];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelect(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional")s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:c.expression?this.translateExpression(c.expression):void 0};else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let a of r)s=this.translateBind(a,s);for(let a of t)s={type:"filter",expression:this.translateExpression(a.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new ve("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGP(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new ve(`Unsupported pattern type: ${e.type}`)}}translateBGP(e){if(!e.triples||!Array.isArray(e.triples))throw new ve("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ve("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translatePredicate(e){return e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!e.pathType)throw new ve("Property path must have pathType");if(!e.items||!Array.isArray(e.items))throw new ve("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new ve("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new ve("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new ve("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new ve("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new ve(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if(e.type==="path")return this.translatePropertyPath(e);if(e.termType==="NamedNode")return{type:"iri",value:e.value};throw new ve(`Unsupported path item type: ${e.type||e.termType}`)}translateTripleElement(e){if(!e||!e.termType)throw new ve("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new ve(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ve("Quoted triple must have subject, predicate, and object");let t=this.translateTripleElement(e.subject),r=this.translateQuotedTriplePredicate(e.predicate),i=this.translateTripleElement(e.object);return{type:"quoted",subject:t,predicate:r,object:i}}translateQuotedTriplePredicate(e){if(!e||!e.termType)throw new ve("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new ve(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}translateFilter(e){if(!e.expression)throw new ve("Filter pattern must have expression");let t=e.patterns?this.translateWhere(e.patterns):{type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateExpression(e){if(!e)throw new ve("Expression cannot be null or undefined");if(e.type==="operation")return this.translateOperationExpression(e);if(e.type==="functioncall"||e.type==="functionCall")return{type:"functionCall",function:e.function,args:e.args.map(t=>this.translateExpression(t))};if(e.termType)return this.translateTermExpression(e);throw new ve(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"];return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(e.args[0]),right:this.translateExpression(e.args[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:e.args.map(s=>this.translateExpression(s))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(e.args[0]),right:this.translateExpression(e.args[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:e.args.map(s=>this.translateExpression(s))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new ve("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&t.patterns?r=this.translateWhere(t.patterns):t.type==="bgp"?r=this.translateBGP(t):r=this.translatePattern(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new ve("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new ve("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new ve("OPTIONAL pattern must have patterns");return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:e.expression?this.translateExpression(e.expression):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new ve("UNION pattern must have at least 2 patterns");let t=o(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),r={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)r={type:"union",left:r,right:t(e.patterns[i])};return r}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new ve("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new ve("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let a=s.startsWith("?")?s.slice(1):s;t.add(a)}let r=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:r}}translateValuesBinding(e){let t={};for(let[r,i]of Object.entries(e)){let s=r.startsWith("?")?r.slice(1):r,a=i;if(a)if(a.termType==="NamedNode")t[s]={type:"iri",value:a.value};else if(a.termType==="Literal"){let c={type:"literal",value:a.value,datatype:a.datatype?.value,language:a.language||void 0};if(a.language){let l=this.directionMappings.get(a.language.toLowerCase());l&&(c.direction=l)}t[s]=c}else throw new ve(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new ve("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpression(e.expression),input:t}}translateOrderComparator(e){return{expression:this.translateExpression(e.expression),descending:e.descending||!1}}isLateralSubquery(e){return e.queryType!=="SELECT"||!e.variables?!1:e.variables.some(t=>t.termType==="Variable"&&t.value===vw.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){return e.variables?{...e,variables:e.variables.filter(t=>!(t.termType==="Variable"&&t.value===vw.LateralTransformer.LATERAL_MARKER))}:e}translateSubquery(e){if(e.queryType!=="SELECT")throw new ve(`Only SELECT subqueries are supported, got: ${e.queryType}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelect(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new ve("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new ve("SERVICE pattern must have patterns array");let t=this.translateWhere(e.patterns);return{type:"service",endpoint:e.name.value,pattern:t,silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new ve("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new ve("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new ve(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);let r=this.translateWhere(e.patterns);return{type:"graph",name:t,pattern:r}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables))for(let s of e.variables){let a=s;a.termType==="Wildcard"||a.value==="*"||(a.termType==="Variable"?t.push({type:"variable",value:a.value}):a.termType==="NamedNode"&&t.push({type:"iri",value:a.value}))}let r;e.where&&e.where.length>0&&(r=this.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};So.AlgebraTranslator=Oy});var Ry=v(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.FilterContainsOptimizer=void 0;var i9=We(),s9=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,Py=class{static{o(this,"FilterContainsOptimizer")}constructor(){this.tripleStore=null,this.lastOptimizationHints=[]}setTripleStore(e){this.tripleStore=e}getLastOptimizationHints(){return this.lastOptimizationHints}clearHints(){this.lastOptimizationHints=[]}async optimize(e){return this.clearHints(),this.optimizeRecursive(e)}optimizeSync(e,t){return this.clearHints(),this.optimizeSyncRecursive(e,t)}async optimizeRecursive(e){return e.type==="filter"?this.optimizeFilter(e):e.type==="join"?{type:"join",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="leftjoin"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="union"?{type:"union",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="minus"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="project"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="orderby"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="slice"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="distinct"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="reduced"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="group"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="extend"?{...e,input:await this.optimizeRecursive(e.input)}:e}optimizeSyncRecursive(e,t){return e.type==="filter"?this.optimizeFilterSync(e,t):e.type==="join"?{type:"join",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="leftjoin"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="union"?{type:"union",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="minus"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="project"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="orderby"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="slice"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="distinct"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="reduced"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="group"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="extend"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e}async optimizeFilter(e){let t=this.detectContainsUUIDPattern(e.expression);if(!t)return{type:"filter",expression:e.expression,input:await this.optimizeRecursive(e.input)};let r=[];return this.tripleStore&&(r=await this.findSubjectsContainingUUID(t.uuid)),this.rewriteFilter(e,t,r)}optimizeFilterSync(e,t){let r=this.detectContainsUUIDPattern(e.expression);if(!r)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input,t)};let i=t?t.filter(s=>s.includes(r.uuid)):[];return this.rewriteFilter(e,r,i)}rewriteFilter(e,t,r){if(this.lastOptimizationHints.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${t.variable}), "${t.uuid}"))`,suggestedRewrite:r.length===1?`VALUES ?${t.variable} { <${r[0]}> }`:r.length>1?`VALUES ?${t.variable} { ${r.map(i=>`<${i}>`).join(" ")} }`:"No matching URIs found for UUID",estimatedSpeedup:r.length>0?"O(n) \u2192 O(1)":"N/A",matchedUri:r.length===1?r[0]:void 0}),r.length===0)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input)};if(r.length===1){let i=this.injectSubjectConstraint(e.input,t.variable,r[0]);if(i!==e.input)return i}return this.createValuesJoin(e,t,r)}detectContainsUUIDPattern(e){if(e.type==="function"||e.type==="functionCall"){let t=e;if((typeof t.function=="string"?t.function.toLowerCase():t.function?.value?.toLowerCase()??"")==="contains"&&t.args.length===2)return this.analyzeContainsArgs(t.args[0],t.args[1],e)}if(e.type==="logical"&&e.operator==="&&")for(let t of e.operands){let r=this.detectContainsUUIDPattern(t);if(r)return r}return null}analyzeContainsArgs(e,t,r){let i=null;if(e.type==="function"||e.type==="functionCall"){let s=e;if((typeof s.function=="string"?s.function.toLowerCase():s.function?.value?.toLowerCase()??"")==="str"&&s.args.length===1){let c=s.args[0];c.type==="variable"&&(i=c.name)}}if(!i&&e.type==="variable"&&(i=e.name),!i)return null;if(t.type==="literal"){let c=String(t.value).match(s9);if(c)return{variable:i,uuid:c[0].toLowerCase(),originalExpression:r}}return null}async findSubjectsContainingUUID(e){if(!this.tripleStore)return[];if(this.tripleStore.findSubjectsByUUID)return(await this.tripleStore.findSubjectsByUUID(e)).map(s=>s.value);let t=await this.tripleStore.subjects(),r=[];for(let i of t)i instanceof i9.IRI&&i.value.toLowerCase().includes(e.toLowerCase())&&r.push(i.value);return r}injectSubjectConstraint(e,t,r){if(e.type==="bgp"){let i=e.triples.map(a=>a.subject.type==="variable"&&a.subject.value===t?{...a,subject:{type:"iri",value:r}}:a);if(i.some((a,c)=>a.subject!==e.triples[c].subject))return{type:"bgp",triples:i}}if(e.type==="join"){let i=this.injectSubjectConstraint(e.left,t,r),s=this.injectSubjectConstraint(e.right,t,r);if(i!==e.left||s!==e.right)return{type:"join",left:i,right:s}}if(e.type==="filter"){let i=this.injectSubjectConstraint(e.input,t,r);if(i!==e.input)return{...e,input:i}}return e}createValuesJoin(e,t,r){return{type:"join",left:{type:"values",variables:[t.variable],bindings:r.map(a=>({[t.variable]:{type:"iri",value:a}}))},right:this.optimizeSyncRecursive(e.input)}}analyzeQuery(e){let t=[];return this.analyzeRecursive(e,t),t}analyzeRecursive(e,t){if(e.type==="filter"){let r=this.detectContainsUUIDPattern(e.expression);r&&t.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${r.variable}), "${r.uuid}"))`,suggestedRewrite:`Use --optimize flag or rewrite as VALUES ?${r.variable} { <uri-containing-uuid> }`,estimatedSpeedup:"O(n) \u2192 O(1) with UUID index lookup"}),this.analyzeRecursive(e.input,t);return}e.type==="join"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="leftjoin"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="union"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="minus"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="project"?this.analyzeRecursive(e.input,t):e.type==="orderby"?this.analyzeRecursive(e.input,t):e.type==="slice"?this.analyzeRecursive(e.input,t):e.type==="distinct"?this.analyzeRecursive(e.input,t):e.type==="reduced"?this.analyzeRecursive(e.input,t):e.type==="group"?this.analyzeRecursive(e.input,t):e.type==="extend"&&this.analyzeRecursive(e.input,t)}};ph.FilterContainsOptimizer=Py});var bw=v(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.AlgebraOptimizer=void 0;var a9=Ry(),Fy=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new a9.FilterContainsOptimizer}setTripleStore(e){this.tripleStore=e,this.filterContainsOptimizer.setTripleStore(e)}getOptimizationHints(){return this.filterContainsOptimizer.getLastOptimizationHints()}analyzeQuery(e){return this.filterContainsOptimizer.analyzeQuery(e)}optimize(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),t=this.filterPushDown(t),t=this.joinReordering(t),t}async optimizeAsync(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),this.tripleStore&&(t=await this.filterContainsOptimizer.optimize(t)),t=this.filterPushDown(t),t=this.joinReordering(t),t}optimizeWithSubjects(e,t){let r=e;return r=this.eliminateEmptyBGPInFilterJoin(r),r=this.filterContainsOptimizer.optimizeSync(r,t),r=this.filterPushDown(r),r=this.joinReordering(r),r}eliminateEmptyBGPInFilterJoin(e){if(e.type==="join"){if(e.left.type==="filter"){let t=e.left;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.right)}}if(e.right.type==="filter"){let t=e.right;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.left)}}return{type:"join",left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}}return e.type==="filter"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="leftjoin"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="union"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="minus"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="project"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="orderby"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="slice"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="distinct"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e}filterPushDown(e){return e.type==="filter"?this.pushDownFilter(e):e.type==="join"?{type:"join",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="leftjoin"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="union"?{type:"union",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="minus"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="project"?{...e,input:this.filterPushDown(e.input)}:e.type==="orderby"?{...e,input:this.filterPushDown(e.input)}:e.type==="slice"?{...e,input:this.filterPushDown(e.input)}:e.type==="distinct"?{...e,input:this.filterPushDown(e.input)}:e}pushDownFilter(e){let t=e.input;if(t.type==="join"){let r=this.getFilterVariables(e.expression),i=this.getOperationVariables(t.left),s=this.getOperationVariables(t.right),a=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return a&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!a?{type:"join",left:this.filterPushDown(t.left),right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:{type:"join",left:this.filterPushDown(t.left),right:this.filterPushDown(t.right)}}}return t.type==="union"?{type:"union",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:this.filterPushDown(t)}}getFilterVariables(e){let t=[];if(e.type==="variable")t.push(e.name);else if(e.type==="comparison")t.push(...this.getFilterVariables(e.left)),t.push(...this.getFilterVariables(e.right));else if(e.type==="logical")for(let r of e.operands)t.push(...this.getFilterVariables(r));else if(e.type==="function")for(let r of e.args)t.push(...this.getFilterVariables(r));return Array.from(new Set(t))}getOperationVariables(e){let t=new Set;if(e.type==="bgp")for(let r of e.triples)r.subject.type==="variable"&&t.add(r.subject.value),r.predicate.type==="variable"&&t.add(r.predicate.value),r.object.type==="variable"&&t.add(r.object.value);else if(e.type==="join"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="filter")return this.getOperationVariables(e.input);if(e.type==="leftjoin"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else if(e.type==="union"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="minus")return this.getOperationVariables(e.left);if(e.type==="project")return new Set(e.variables)}}return t}joinReordering(e){return e.type==="join"?this.reorderJoin(e):e.type==="filter"?{...e,input:this.joinReordering(e.input)}:e.type==="leftjoin"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="union"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="minus"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="project"?{...e,input:this.joinReordering(e.input)}:e.type==="orderby"?{...e,input:this.joinReordering(e.input)}:e.type==="slice"?{...e,input:this.joinReordering(e.input)}:e.type==="distinct"?{...e,input:this.joinReordering(e.input)}:e}reorderJoin(e){let t=this.isConstrained(e.left),r=this.isConstrained(e.right);if(r&&!t)return{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)};if(t&&!r)return{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)};let i=this.estimateCost(e.left);return this.estimateCost(e.right)<i?{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)}:{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)}}isConstrained(e){return e.type==="values"?!0:e.type==="bgp"?e.triples.some(t=>t.object.type!=="variable"||t.subject.type!=="variable"):e.type==="filter"?this.isConstrained(e.input):e.type==="join"?this.isConstrained(e.left)||this.isConstrained(e.right):e.type==="union"?this.isConstrained(e.left)&&this.isConstrained(e.right):!1}estimateCost(e){if(e.type==="bgp"){let t=0;for(let r of e.triples){let i=10;r.subject.type==="variable"&&(i*=10),r.predicate.type==="variable"&&(i*=20),r.object.type==="variable"&&(i*=5),t+=i}return t}if(e.type==="filter")return this.estimateCost(e.input)*.3;if(e.type==="join"){let t=this.estimateCost(e.left),r=this.estimateCost(e.right);return e.left.type==="values"||e.right.type==="values"?Math.min(t,r)*2:t*r}if(e.type==="leftjoin")return this.estimateCost(e.left)+this.estimateCost(e.right)*.5;if(e.type==="union")return this.estimateCost(e.left)+this.estimateCost(e.right);if(e.type==="values"){let t=e.bindings;return Array.isArray(t)?t.length*5:10}return e.type==="minus"?this.estimateCost(e.left)+this.estimateCost(e.right)*.3:100}setStatistics(e,t){this.stats.set(e,t)}getStatistics(e){return this.stats.get(e)}};mh.AlgebraOptimizer=Fy});var Sw=v(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.AlgebraSerializer=void 0;var Dy=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
283
|
+
`,s);l!==-1?(i+=e.substring(s,l),s=l):(i+=e.substring(s),s=e.length);continue}let c=this.tryReplacePrefixedName(e,s,r);if(c){i+=c.iri,s=c.endIndex;continue}i+=a,s++}return i}tryReplacePrefixedName(e,t,r){if(t>0&&/[a-zA-Z0-9_]/.test(e[t-1]))return null;for(let{prefix:i,baseIRI:s}of r){if(e.substring(t,t+i.length+1)!==i+":")continue;let a=t+i.length+1,c=a;for(;c<e.length&&/[a-zA-Z0-9_.%-]/.test(e[c]);)c++;if(c===a)continue;let l=e.substring(a,c);return{iri:`<${s}${l}.md>`,endIndex:c}}return null}findDeclaredPrefixes(e){let t=new Set,r=new RegExp(X5.source,"gi"),i;for(;(i=r.exec(e))!==null;)t.add(i[1].toLowerCase());return t}skipLiteral(e,t){let r=e[t];if(t+2<e.length&&e.substring(t,t+3)===r+r+r){let s=e.indexOf(r+r+r,t+3);return s!==-1?s+3:e.length}let i=t+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;return i<e.length?i+1:e.length}};dh.VaultPrefixTransformer=wy});var yw=v(wn=>{"use strict";var Z5=wn&&wn.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),eL=wn&&wn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),tL=wn&&wn.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&Z5(t,e,r[i]);return eL(t,e),t}})();Object.defineProperty(wn,"__esModule",{value:!0});wn.SPARQLParser=wn.SPARQLParseError=void 0;var mw=tL(fw()),Ty=gy(),xy=yy(),gw=hw(),Ay=_y(),rL=dw(),Cy=pw(),nL=Ey(),Mt=class extends Error{static{o(this,"SPARQLParseError")}constructor(e,t,r,i){super(e,i?{cause:i}:void 0),this.name="SPARQLParseError",this.line=t,this.column=r}};wn.SPARQLParseError=Mt;var Iy=class{static{o(this,"SPARQLParser")}constructor(e){this.lastDirectionMappings=new Map,this.parser=new mw.Parser({sparqlStar:!0}),this.generator=new mw.Generator({sparqlStar:!0}),this.caseWhenTransformer=new Ty.CaseWhenTransformer,this.lateralTransformer=new xy.LateralTransformer,this.prefixStarTransformer=new gw.PrefixStarTransformer(e?.vocabularyResolver),this.describeOptionsTransformer=new Ay.DescribeOptionsTransformer,this.directionalLangTagTransformer=new rL.DirectionalLangTagTransformer,this.tripleTermTransformer=new Cy.TripleTermTransformer,this.vaultPrefixTransformer=new nL.VaultPrefixTransformer}setVaultPrefixes(e){this.vaultPrefixTransformer.setVaultPrefixes(e)}parse(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof Ay.DescribeOptionsTransformerError)throw new Mt(t.message);if(t instanceof xy.LateralTransformerError)throw new Mt(t.message);if(t instanceof Ty.CaseWhenTransformerError)throw new Mt(t.message);if(t instanceof Cy.TripleTermTransformerError)throw new Mt(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new Mt(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}parseWithOptions(e){return{query:this.parse(e),describeOptions:this.lastDescribeOptions}}getLastDescribeOptions(){return this.lastDescribeOptions}async parseAsync(e){try{let t=this.vaultPrefixTransformer.transform(e),r=this.describeOptionsTransformer.transform(t);this.lastDescribeOptions=r.options;let i=r.query;i=this.directionalLangTagTransformer.transform(i),this.lastDirectionMappings=this.directionalLangTagTransformer.getAllMappings(),i=await this.prefixStarTransformer.transform(i),i=this.lateralTransformer.transform(i),i=this.caseWhenTransformer.transform(i),i=this.tripleTermTransformer.transform(i);let s=this.parser.parse(i);return this.validateQuery(s),this.lastDescribeOptions&&this.isDescribeQuery(s)&&(s.describeOptions=this.lastDescribeOptions),s}catch(t){if(t instanceof Ay.DescribeOptionsTransformerError)throw new Mt(t.message);if(t instanceof gw.PrefixStarTransformerError)throw new Mt(t.message);if(t instanceof xy.LateralTransformerError)throw new Mt(t.message);if(t instanceof Ty.CaseWhenTransformerError)throw new Mt(t.message);if(t instanceof Cy.TripleTermTransformerError)throw new Mt(t.message);if(t instanceof Error){let r=t.message.match(/line (\d+), column (\d+)/),i=r?parseInt(r[1],10):void 0,s=r?parseInt(r[2],10):void 0;throw new Mt(`SPARQL syntax error: ${t.message}`,i,s,t)}throw t}}async parseAsyncWithOptions(e){return{query:await this.parseAsync(e),describeOptions:this.lastDescribeOptions}}hasPrefixStar(e){return/PREFIX\s*\*/i.test(e)}hasLateral(e){return this.lateralTransformer.hasLateral(e)}hasDescribeOptions(e){return this.describeOptionsTransformer.hasDescribeOptions(e)}hasDirectionalLangTags(e){return this.directionalLangTagTransformer.hasDirectionalTags(e)}hasTripleTermSyntax(e){return this.tripleTermTransformer.hasTripleTermSyntax(e)}getLastDirectionMappings(){return new Map(this.lastDirectionMappings)}getDirectionForLanguage(e){return this.lastDirectionMappings.get(e.toLowerCase())}toString(e){try{return this.generator.stringify(e)}catch(t){throw t instanceof Error?new Mt(`Failed to serialize SPARQL query: ${t.message}`,void 0,void 0,t):t}}getQueryType(e){if("queryType"in e&&e.type==="query")return e.queryType;throw new Mt("Query does not have a valid queryType property")}isSelectQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="SELECT"}isConstructQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="CONSTRUCT"}isAskQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="ASK"}isDescribeQuery(e){return"queryType"in e&&e.type==="query"&&e.queryType==="DESCRIBE"}isUpdateQuery(e){return e.type==="update"}isInsertDataOperation(e){return"updateType"in e&&e.updateType==="insert"}isDeleteDataOperation(e){return"updateType"in e&&e.updateType==="delete"}validateQuery(e){if(!e||typeof e!="object")throw new Mt("Invalid query: not an object");if(e.type!=="query"&&e.type!=="update")throw new Mt(`Invalid type: expected "query" or "update", got "${e.type}"`);if(e.type==="query"){let t=["SELECT","CONSTRUCT","ASK","DESCRIBE"];if(!t.includes(e.queryType))throw new Mt(`Invalid query type: expected one of ${t.join(", ")}, got "${e.queryType}"`)}}};wn.SPARQLParser=Iy});var _w=v(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.AlgebraTranslator=So.AlgebraTranslatorError=void 0;var vw=yy(),ve=class extends Error{static{o(this,"AlgebraTranslatorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AlgebraTranslatorError"}};So.AlgebraTranslatorError=ve;var Oy=class{static{o(this,"AlgebraTranslator")}constructor(){this.directionMappings=new Map,this.aggregateCounter=0}setDirectionMappings(e){this.directionMappings=e}translate(e){if(e.type!=="query")throw new ve("Only query operations are supported (not updates)");if(e.queryType==="SELECT")return this.translateSelect(e);if(e.queryType==="CONSTRUCT")return this.translateConstruct(e);if(e.queryType==="ASK")return this.translateAsk(e);if(e.queryType==="DESCRIBE")return this.translateDescribe(e);throw new ve(`Query type ${e.queryType} not yet supported`)}translateSelect(e){let t;if(!e.where||e.where.length===0)throw new ve("SELECT query must have WHERE clause");t=this.translateWhere(e.where),this.aggregateCounter=0;let r=new Map,i=this.extractAggregatesWithMapping(e.variables,r),s=this.extractGroupVariables(e.group),a=this.extractHavingExpressions(e.having,i,r);if((i.length>0||s.length>0||a.length>0)&&(t={type:"group",variables:s,aggregates:i,having:a.length>0?a:void 0,input:t}),e.variables&&e.variables.length>0){for(let l of e.variables){let u=l;if(u.expression&&u.variable){if(u.expression.type==="aggregate")continue;let f=this.transformExpressionWithAggregateVars(u.expression,r);t={type:"extend",variable:u.variable.value,expression:f,input:t}}}let c=e.variables.filter(l=>l.termType==="Variable"||l.variable).map(l=>l.termType==="Variable"?l.value:l.variable.value);c.length>0&&(t={type:"project",variables:c,input:t})}return e.distinct&&(t={type:"distinct",input:t}),e.reduced&&(t={type:"reduced",input:t}),e.order&&e.order.length>0&&(t={type:"orderby",comparators:e.order.map(c=>this.translateOrderComparator(c)),input:t}),(e.limit!==void 0||e.offset!==void 0)&&(t={type:"slice",limit:e.limit,offset:e.offset,input:t}),t}translateConstruct(e){let t=this.translateConstructTemplate(e.template??[]);if(!e.where||e.where.length===0)throw new ve("CONSTRUCT query must have WHERE clause");let r=this.translateWhere(e.where),i=e;return(i.limit!==void 0||i.offset!==void 0)&&(r={type:"slice",limit:i.limit,offset:i.offset,input:r}),{type:"construct",template:t,where:r}}translateConstructTemplate(e){return!e||!Array.isArray(e)?[]:e.map(t=>this.translateTriple(t))}translateAsk(e){return{type:"ask",where:e.where&&e.where.length>0?this.translateWhere(e.where):{type:"bgp",triples:[]}}}extractAggregatesWithMapping(e,t){if(!e)return[];let r=[];for(let i of e)!i.expression||!i.variable||(i.expression.type==="aggregate"?(r.push({variable:i.variable.value,expression:this.translateAggregateExpression(i.expression)}),t.set(i.expression,i.variable.value)):this.collectNestedAggregates(i.expression,r,t));return r}collectNestedAggregates(e,t,r){if(e){if(e.type==="aggregate"){let i=`__agg${this.aggregateCounter++}`;t.push({variable:i,expression:this.translateAggregateExpression(e)}),r.set(e,i)}else if(e.type==="operation"&&e.args)for(let i of e.args)this.collectNestedAggregates(i,t,r)}}transformExpressionWithAggregateVars(e,t){if(t.has(e))return{type:"variable",name:t.get(e)};if(e.type==="operation"&&e.args){let r=e.args.map(c=>this.transformExpressionWithAggregateVars(c,t)),i=["=","!=","<",">","<=",">="],s=["&&","||","!"],a=["+","-","*","/"];return i.includes(e.operator)?{type:"comparison",operator:e.operator,left:r[0],right:r[1]}:s.includes(e.operator)?{type:"logical",operator:e.operator,operands:r}:a.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:r[0],right:r[1]}:{type:"function",function:e.operator,args:r}}return this.translateExpression(e)}extractGroupVariables(e){return e?e.filter(t=>t.expression&&t.expression.termType==="Variable").map(t=>t.expression.value):[]}extractHavingExpressions(e,t,r){if(!e||e.length===0)return[];for(let i of e)this.collectNestedAggregates(i,t,r);return e.map(i=>this.transformExpressionWithAggregateVars(i,r))}translateAggregateExpression(e){let t=e.aggregation;if(typeof t=="string"){let r=t.toLowerCase();return["count","sum","avg","min","max","group_concat","sample"].includes(r)?{type:"aggregate",aggregation:r,expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}:{type:"aggregate",aggregation:{type:"custom",iri:t},expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}}if(t&&typeof t=="object"){let r;if(t.termType==="NamedNode"&&t.value)r=t.value;else if("value"in t)r=String(t.value);else throw new ve(`Invalid custom aggregate: expected IRI but got ${JSON.stringify(t)}`);return{type:"aggregate",aggregation:{type:"custom",iri:r},expression:e.expression?this.translateExpression(e.expression):void 0,distinct:e.distinct||!1,separator:e.separator}}throw new ve(`Unknown aggregate format: ${JSON.stringify(t)}`)}isLateralPattern(e){if(e.type==="query"&&this.isLateralSubquery(e))return!0;if(e.type==="group"&&e.patterns?.length===1){let t=e.patterns[0];if(t.type==="query"&&this.isLateralSubquery(t))return!0}return!1}extractLateralSubquery(e){if(e.type==="query")return e;if(e.type==="group"&&e.patterns?.length===1)return e.patterns[0];throw new ve("Invalid lateral pattern structure")}translateWhere(e){if(e.length===0)throw new ve("Empty WHERE clause");let t=e.filter(a=>a.type==="filter"),r=e.filter(a=>a.type==="bind"),i=e.filter(a=>a.type!=="filter"&&a.type!=="bind"),s;if(i.length===0)s={type:"bgp",triples:[]};else if(i.length===1)i[0].type==="optional"?s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:i[0].expression?this.translateExpression(i[0].expression):void 0}:s=this.translatePattern(i[0]);else{i[0].type==="optional"?s={type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(i[0].patterns),expression:i[0].expression?this.translateExpression(i[0].expression):void 0}:s=this.translatePattern(i[0]);for(let a=1;a<i.length;a++){let c=i[a];if(this.isLateralPattern(c)){let l=this.extractLateralSubquery(c),u=this.removeLateralMarker(l),f=this.translateSelect(u);s={type:"lateraljoin",left:s,right:f}}else if(c.type==="optional")s={type:"leftjoin",left:s,right:this.translateWhere(c.patterns),expression:c.expression?this.translateExpression(c.expression):void 0};else{let l=this.translatePattern(c);s={type:"join",left:s,right:l}}}}for(let a of r)s=this.translateBind(a,s);for(let a of t)s={type:"filter",expression:this.translateExpression(a.expression),input:s};return s}translatePattern(e){if(!e||!e.type)throw new ve("Invalid pattern: missing type");switch(e.type){case"bgp":return this.translateBGP(e);case"filter":return this.translateFilter(e);case"optional":return this.translateOptional(e);case"union":return this.translateUnion(e);case"minus":return this.translateMinus(e);case"values":return this.translateValues(e);case"group":return this.translateWhere(e.patterns);case"query":return this.translateSubquery(e);case"service":return this.translateService(e);case"graph":return this.translateGraph(e);default:throw new ve(`Unsupported pattern type: ${e.type}`)}}translateBGP(e){if(!e.triples||!Array.isArray(e.triples))throw new ve("BGP pattern must have triples array");return{type:"bgp",triples:e.triples.map(t=>this.translateTriple(t))}}translateTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ve("Triple must have subject, predicate, and object");return{subject:this.translateTripleElement(e.subject),predicate:this.translatePredicate(e.predicate),object:this.translateTripleElement(e.object)}}translatePredicate(e){return e.type==="path"?this.translatePropertyPath(e):this.translateTripleElement(e)}translatePropertyPath(e){if(!e.pathType)throw new ve("Property path must have pathType");if(!e.items||!Array.isArray(e.items))throw new ve("Property path must have items array");let t=e.items.map(r=>this.translatePathItem(r));switch(e.pathType){case"/":return{type:"path",pathType:"/",items:t};case"|":return{type:"path",pathType:"|",items:t};case"^":if(t.length!==1)throw new ve("Inverse path must have exactly one item");return{type:"path",pathType:"^",items:[t[0]]};case"+":if(t.length!==1)throw new ve("OneOrMore path must have exactly one item");return{type:"path",pathType:"+",items:[t[0]]};case"*":if(t.length!==1)throw new ve("ZeroOrMore path must have exactly one item");return{type:"path",pathType:"*",items:[t[0]]};case"?":if(t.length!==1)throw new ve("ZeroOrOne path must have exactly one item");return{type:"path",pathType:"?",items:[t[0]]};default:throw new ve(`Unsupported property path type: ${e.pathType}`)}}translatePathItem(e){if(e.type==="path")return this.translatePropertyPath(e);if(e.termType==="NamedNode")return{type:"iri",value:e.value};throw new ve(`Unsupported path item type: ${e.type||e.termType}`)}translateTripleElement(e){if(!e||!e.termType)throw new ve("Triple element must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};case"Literal":{let t={type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language};if(e.language){let r=this.directionMappings.get(e.language.toLowerCase());r&&(t.direction=r)}return t}case"BlankNode":return{type:"blank",value:e.value};case"Quad":return this.translateQuotedTriple(e);default:throw new ve(`Unsupported term type: ${e.termType}`)}}translateQuotedTriple(e){if(!e.subject||!e.predicate||!e.object)throw new ve("Quoted triple must have subject, predicate, and object");let t=this.translateTripleElement(e.subject),r=this.translateQuotedTriplePredicate(e.predicate),i=this.translateTripleElement(e.object);return{type:"quoted",subject:t,predicate:r,object:i}}translateQuotedTriplePredicate(e){if(!e||!e.termType)throw new ve("Quoted triple predicate must have termType");switch(e.termType){case"Variable":return{type:"variable",value:e.value};case"NamedNode":return{type:"iri",value:e.value};default:throw new ve(`Quoted triple predicate must be IRI or Variable, got: ${e.termType}`)}}translateFilter(e){if(!e.expression)throw new ve("Filter pattern must have expression");let t=e.patterns?this.translateWhere(e.patterns):{type:"bgp",triples:[]};return{type:"filter",expression:this.translateExpression(e.expression),input:t}}translateExpression(e){if(!e)throw new ve("Expression cannot be null or undefined");if(e.type==="operation")return this.translateOperationExpression(e);if(e.type==="functioncall"||e.type==="functionCall")return{type:"functionCall",function:e.function,args:e.args.map(t=>this.translateExpression(t))};if(e.termType)return this.translateTermExpression(e);throw new ve(`Unsupported expression structure: ${JSON.stringify(e)}`)}translateOperationExpression(e){let t=["=","!=","<",">","<=",">="],r=["&&","||","!"],i=["+","-","*","/"];return t.includes(e.operator)?{type:"comparison",operator:e.operator,left:this.translateExpression(e.args[0]),right:this.translateExpression(e.args[1])}:r.includes(e.operator)?{type:"logical",operator:e.operator,operands:e.args.map(s=>this.translateExpression(s))}:i.includes(e.operator)?{type:"arithmetic",operator:e.operator,left:this.translateExpression(e.args[0]),right:this.translateExpression(e.args[1])}:e.operator==="exists"||e.operator==="notexists"?this.translateExistsExpression(e):e.operator==="in"||e.operator==="notin"?this.translateInExpression(e):{type:"function",function:e.operator,args:e.args.map(s=>this.translateExpression(s))}}translateExistsExpression(e){if(!e.args||e.args.length!==1)throw new ve("EXISTS/NOT EXISTS must have exactly one pattern argument");let t=e.args[0],r;return t.type==="group"&&t.patterns?r=this.translateWhere(t.patterns):t.type==="bgp"?r=this.translateBGP(t):r=this.translatePattern(t),{type:"exists",negated:e.operator==="notexists",pattern:r}}translateInExpression(e){if(!e.args||e.args.length!==2)throw new ve("IN/NOT IN must have exactly 2 arguments (expression and list)");let t=e.args[0],r=e.args[1];if(!Array.isArray(r))throw new ve("IN/NOT IN second argument must be an array of values");return{type:"in",expression:this.translateExpression(t),list:r.map(i=>this.translateExpression(i)),negated:e.operator==="notin"}}translateTermExpression(e){if(e.termType==="Variable")return{type:"variable",name:e.value};if(e.termType==="Literal"){let t=e.value;return e.datatype&&(e.datatype.value.includes("#integer")||e.datatype.value.includes("#decimal")?t=parseFloat(e.value):e.datatype.value.includes("#boolean")&&(t=e.value==="true")),{type:"literal",value:t,datatype:e.datatype?.value}}return{type:"literal",value:String(e.value||e)}}translateOptional(e){if(!e.patterns||e.patterns.length===0)throw new ve("OPTIONAL pattern must have patterns");return{type:"leftjoin",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns),expression:e.expression?this.translateExpression(e.expression):void 0}}translateUnion(e){if(!e.patterns||e.patterns.length<2)throw new ve("UNION pattern must have at least 2 patterns");let t=o(i=>i.type==="graph"?this.translateGraph(i):i.type==="service"?this.translateService(i):i.patterns&&Array.isArray(i.patterns)?this.translateWhere(i.patterns):this.translateWhere([i]),"translateBranch"),r={type:"union",left:t(e.patterns[0]),right:t(e.patterns[1])};for(let i=2;i<e.patterns.length;i++)r={type:"union",left:r,right:t(e.patterns[i])};return r}translateMinus(e){if(!e.patterns||e.patterns.length===0)throw new ve("MINUS pattern must have patterns");return{type:"minus",left:{type:"bgp",triples:[]},right:this.translateWhere(e.patterns)}}translateValues(e){if(!e.values||!Array.isArray(e.values))throw new ve("VALUES pattern must have values array");let t=new Set;for(let i of e.values)for(let s of Object.keys(i)){let a=s.startsWith("?")?s.slice(1):s;t.add(a)}let r=e.values.map(i=>this.translateValuesBinding(i));return{type:"values",variables:Array.from(t),bindings:r}}translateValuesBinding(e){let t={};for(let[r,i]of Object.entries(e)){let s=r.startsWith("?")?r.slice(1):r,a=i;if(a)if(a.termType==="NamedNode")t[s]={type:"iri",value:a.value};else if(a.termType==="Literal"){let c={type:"literal",value:a.value,datatype:a.datatype?.value,language:a.language||void 0};if(a.language){let l=this.directionMappings.get(a.language.toLowerCase());l&&(c.direction=l)}t[s]=c}else throw new ve(`Unsupported VALUES term type: ${a.termType}`)}return t}translateBind(e,t){if(!e.variable||!e.expression)throw new ve("BIND pattern must have variable and expression");return{type:"extend",variable:e.variable.value,expression:this.translateExpression(e.expression),input:t}}translateOrderComparator(e){return{expression:this.translateExpression(e.expression),descending:e.descending||!1}}isLateralSubquery(e){return e.queryType!=="SELECT"||!e.variables?!1:e.variables.some(t=>t.termType==="Variable"&&t.value===vw.LateralTransformer.LATERAL_MARKER)}removeLateralMarker(e){return e.variables?{...e,variables:e.variables.filter(t=>!(t.termType==="Variable"&&t.value===vw.LateralTransformer.LATERAL_MARKER))}:e}translateSubquery(e){if(e.queryType!=="SELECT")throw new ve(`Only SELECT subqueries are supported, got: ${e.queryType}`);let t=this.removeLateralMarker(e);return{type:"subquery",query:this.translateSelect(t)}}translateService(e){if(!e.name||e.name.termType!=="NamedNode")throw new ve("SERVICE pattern must have a NamedNode endpoint");if(!e.patterns||!Array.isArray(e.patterns))throw new ve("SERVICE pattern must have patterns array");let t=this.translateWhere(e.patterns);return{type:"service",endpoint:e.name.value,pattern:t,silent:e.silent||!1}}translateGraph(e){if(!e.name)throw new ve("GRAPH pattern must have a name (IRI or variable)");if(!e.patterns||!Array.isArray(e.patterns))throw new ve("GRAPH pattern must have patterns array");let t;if(e.name.termType==="NamedNode")t={type:"iri",value:e.name.value};else if(e.name.termType==="Variable")t={type:"variable",value:e.name.value};else throw new ve(`GRAPH pattern name must be NamedNode or Variable, got: ${e.name.termType}`);let r=this.translateWhere(e.patterns);return{type:"graph",name:t,pattern:r}}translateDescribe(e){let t=[];if(e.variables&&Array.isArray(e.variables))for(let s of e.variables){let a=s;a.termType==="Wildcard"||a.value==="*"||(a.termType==="Variable"?t.push({type:"variable",value:a.value}):a.termType==="NamedNode"&&t.push({type:"iri",value:a.value}))}let r;e.where&&e.where.length>0&&(r=this.translateWhere(e.where));let i=e.describeOptions;return{type:"describe",resources:t,where:r,depth:i?.depth,symmetric:i?.symmetric}}};So.AlgebraTranslator=Oy});var Ry=v(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.FilterContainsOptimizer=void 0;var iL=We(),sL=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,Py=class{static{o(this,"FilterContainsOptimizer")}constructor(){this.tripleStore=null,this.lastOptimizationHints=[]}setTripleStore(e){this.tripleStore=e}getLastOptimizationHints(){return this.lastOptimizationHints}clearHints(){this.lastOptimizationHints=[]}async optimize(e){return this.clearHints(),this.optimizeRecursive(e)}optimizeSync(e,t){return this.clearHints(),this.optimizeSyncRecursive(e,t)}async optimizeRecursive(e){return e.type==="filter"?this.optimizeFilter(e):e.type==="join"?{type:"join",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="leftjoin"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="union"?{type:"union",left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="minus"?{...e,left:await this.optimizeRecursive(e.left),right:await this.optimizeRecursive(e.right)}:e.type==="project"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="orderby"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="slice"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="distinct"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="reduced"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="group"?{...e,input:await this.optimizeRecursive(e.input)}:e.type==="extend"?{...e,input:await this.optimizeRecursive(e.input)}:e}optimizeSyncRecursive(e,t){return e.type==="filter"?this.optimizeFilterSync(e,t):e.type==="join"?{type:"join",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="leftjoin"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="union"?{type:"union",left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="minus"?{...e,left:this.optimizeSyncRecursive(e.left,t),right:this.optimizeSyncRecursive(e.right,t)}:e.type==="project"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="orderby"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="slice"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="distinct"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="reduced"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="group"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e.type==="extend"?{...e,input:this.optimizeSyncRecursive(e.input,t)}:e}async optimizeFilter(e){let t=this.detectContainsUUIDPattern(e.expression);if(!t)return{type:"filter",expression:e.expression,input:await this.optimizeRecursive(e.input)};let r=[];return this.tripleStore&&(r=await this.findSubjectsContainingUUID(t.uuid)),this.rewriteFilter(e,t,r)}optimizeFilterSync(e,t){let r=this.detectContainsUUIDPattern(e.expression);if(!r)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input,t)};let i=t?t.filter(s=>s.includes(r.uuid)):[];return this.rewriteFilter(e,r,i)}rewriteFilter(e,t,r){if(this.lastOptimizationHints.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${t.variable}), "${t.uuid}"))`,suggestedRewrite:r.length===1?`VALUES ?${t.variable} { <${r[0]}> }`:r.length>1?`VALUES ?${t.variable} { ${r.map(i=>`<${i}>`).join(" ")} }`:"No matching URIs found for UUID",estimatedSpeedup:r.length>0?"O(n) \u2192 O(1)":"N/A",matchedUri:r.length===1?r[0]:void 0}),r.length===0)return{type:"filter",expression:e.expression,input:this.optimizeSyncRecursive(e.input)};if(r.length===1){let i=this.injectSubjectConstraint(e.input,t.variable,r[0]);if(i!==e.input)return i}return this.createValuesJoin(e,t,r)}detectContainsUUIDPattern(e){if(e.type==="function"||e.type==="functionCall"){let t=e;if((typeof t.function=="string"?t.function.toLowerCase():t.function?.value?.toLowerCase()??"")==="contains"&&t.args.length===2)return this.analyzeContainsArgs(t.args[0],t.args[1],e)}if(e.type==="logical"&&e.operator==="&&")for(let t of e.operands){let r=this.detectContainsUUIDPattern(t);if(r)return r}return null}analyzeContainsArgs(e,t,r){let i=null;if(e.type==="function"||e.type==="functionCall"){let s=e;if((typeof s.function=="string"?s.function.toLowerCase():s.function?.value?.toLowerCase()??"")==="str"&&s.args.length===1){let c=s.args[0];c.type==="variable"&&(i=c.name)}}if(!i&&e.type==="variable"&&(i=e.name),!i)return null;if(t.type==="literal"){let c=String(t.value).match(sL);if(c)return{variable:i,uuid:c[0].toLowerCase(),originalExpression:r}}return null}async findSubjectsContainingUUID(e){if(!this.tripleStore)return[];if(this.tripleStore.findSubjectsByUUID)return(await this.tripleStore.findSubjectsByUUID(e)).map(s=>s.value);let t=await this.tripleStore.subjects(),r=[];for(let i of t)i instanceof iL.IRI&&i.value.toLowerCase().includes(e.toLowerCase())&&r.push(i.value);return r}injectSubjectConstraint(e,t,r){if(e.type==="bgp"){let i=e.triples.map(a=>a.subject.type==="variable"&&a.subject.value===t?{...a,subject:{type:"iri",value:r}}:a);if(i.some((a,c)=>a.subject!==e.triples[c].subject))return{type:"bgp",triples:i}}if(e.type==="join"){let i=this.injectSubjectConstraint(e.left,t,r),s=this.injectSubjectConstraint(e.right,t,r);if(i!==e.left||s!==e.right)return{type:"join",left:i,right:s}}if(e.type==="filter"){let i=this.injectSubjectConstraint(e.input,t,r);if(i!==e.input)return{...e,input:i}}return e}createValuesJoin(e,t,r){return{type:"join",left:{type:"values",variables:[t.variable],bindings:r.map(a=>({[t.variable]:{type:"iri",value:a}}))},right:this.optimizeSyncRecursive(e.input)}}analyzeQuery(e){let t=[];return this.analyzeRecursive(e,t),t}analyzeRecursive(e,t){if(e.type==="filter"){let r=this.detectContainsUUIDPattern(e.expression);r&&t.push({type:"uuid-index-lookup",originalPattern:`FILTER(CONTAINS(STR(?${r.variable}), "${r.uuid}"))`,suggestedRewrite:`Use --optimize flag or rewrite as VALUES ?${r.variable} { <uri-containing-uuid> }`,estimatedSpeedup:"O(n) \u2192 O(1) with UUID index lookup"}),this.analyzeRecursive(e.input,t);return}e.type==="join"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="leftjoin"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="union"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="minus"?(this.analyzeRecursive(e.left,t),this.analyzeRecursive(e.right,t)):e.type==="project"?this.analyzeRecursive(e.input,t):e.type==="orderby"?this.analyzeRecursive(e.input,t):e.type==="slice"?this.analyzeRecursive(e.input,t):e.type==="distinct"?this.analyzeRecursive(e.input,t):e.type==="reduced"?this.analyzeRecursive(e.input,t):e.type==="group"?this.analyzeRecursive(e.input,t):e.type==="extend"&&this.analyzeRecursive(e.input,t)}};ph.FilterContainsOptimizer=Py});var bw=v(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.AlgebraOptimizer=void 0;var aL=Ry(),Fy=class{static{o(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new aL.FilterContainsOptimizer}setTripleStore(e){this.tripleStore=e,this.filterContainsOptimizer.setTripleStore(e)}getOptimizationHints(){return this.filterContainsOptimizer.getLastOptimizationHints()}analyzeQuery(e){return this.filterContainsOptimizer.analyzeQuery(e)}optimize(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),t=this.filterPushDown(t),t=this.joinReordering(t),t}async optimizeAsync(e){let t=e;return t=this.eliminateEmptyBGPInFilterJoin(t),this.tripleStore&&(t=await this.filterContainsOptimizer.optimize(t)),t=this.filterPushDown(t),t=this.joinReordering(t),t}optimizeWithSubjects(e,t){let r=e;return r=this.eliminateEmptyBGPInFilterJoin(r),r=this.filterContainsOptimizer.optimizeSync(r,t),r=this.filterPushDown(r),r=this.joinReordering(r),r}eliminateEmptyBGPInFilterJoin(e){if(e.type==="join"){if(e.left.type==="filter"){let t=e.left;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.right)}}if(e.right.type==="filter"){let t=e.right;if(t.input.type==="bgp"&&t.input.triples.length===0)return{type:"filter",expression:t.expression,input:this.eliminateEmptyBGPInFilterJoin(e.left)}}return{type:"join",left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}}return e.type==="filter"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="leftjoin"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="union"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="minus"?{...e,left:this.eliminateEmptyBGPInFilterJoin(e.left),right:this.eliminateEmptyBGPInFilterJoin(e.right)}:e.type==="project"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="orderby"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="slice"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e.type==="distinct"?{...e,input:this.eliminateEmptyBGPInFilterJoin(e.input)}:e}filterPushDown(e){return e.type==="filter"?this.pushDownFilter(e):e.type==="join"?{type:"join",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="leftjoin"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="union"?{type:"union",left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="minus"?{...e,left:this.filterPushDown(e.left),right:this.filterPushDown(e.right)}:e.type==="project"?{...e,input:this.filterPushDown(e.input)}:e.type==="orderby"?{...e,input:this.filterPushDown(e.input)}:e.type==="slice"?{...e,input:this.filterPushDown(e.input)}:e.type==="distinct"?{...e,input:this.filterPushDown(e.input)}:e}pushDownFilter(e){let t=e.input;if(t.type==="join"){let r=this.getFilterVariables(e.expression),i=this.getOperationVariables(t.left),s=this.getOperationVariables(t.right),a=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return a&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!a?{type:"join",left:this.filterPushDown(t.left),right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:{type:"join",left:this.filterPushDown(t.left),right:this.filterPushDown(t.right)}}}return t.type==="union"?{type:"union",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:{type:"filter",expression:e.expression,input:this.filterPushDown(t.right)}}:{type:"filter",expression:e.expression,input:this.filterPushDown(t)}}getFilterVariables(e){let t=[];if(e.type==="variable")t.push(e.name);else if(e.type==="comparison")t.push(...this.getFilterVariables(e.left)),t.push(...this.getFilterVariables(e.right));else if(e.type==="logical")for(let r of e.operands)t.push(...this.getFilterVariables(r));else if(e.type==="function")for(let r of e.args)t.push(...this.getFilterVariables(r));return Array.from(new Set(t))}getOperationVariables(e){let t=new Set;if(e.type==="bgp")for(let r of e.triples)r.subject.type==="variable"&&t.add(r.subject.value),r.predicate.type==="variable"&&t.add(r.predicate.value),r.object.type==="variable"&&t.add(r.object.value);else if(e.type==="join"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="filter")return this.getOperationVariables(e.input);if(e.type==="leftjoin"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else if(e.type==="union"){let r=this.getOperationVariables(e.left),i=this.getOperationVariables(e.right);return new Set([...r,...i])}else{if(e.type==="minus")return this.getOperationVariables(e.left);if(e.type==="project")return new Set(e.variables)}}return t}joinReordering(e){return e.type==="join"?this.reorderJoin(e):e.type==="filter"?{...e,input:this.joinReordering(e.input)}:e.type==="leftjoin"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="union"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="minus"?{...e,left:this.joinReordering(e.left),right:this.joinReordering(e.right)}:e.type==="project"?{...e,input:this.joinReordering(e.input)}:e.type==="orderby"?{...e,input:this.joinReordering(e.input)}:e.type==="slice"?{...e,input:this.joinReordering(e.input)}:e.type==="distinct"?{...e,input:this.joinReordering(e.input)}:e}reorderJoin(e){let t=this.isConstrained(e.left),r=this.isConstrained(e.right);if(r&&!t)return{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)};if(t&&!r)return{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)};let i=this.estimateCost(e.left);return this.estimateCost(e.right)<i?{type:"join",left:this.joinReordering(e.right),right:this.joinReordering(e.left)}:{type:"join",left:this.joinReordering(e.left),right:this.joinReordering(e.right)}}isConstrained(e){return e.type==="values"?!0:e.type==="bgp"?e.triples.some(t=>t.object.type!=="variable"||t.subject.type!=="variable"):e.type==="filter"?this.isConstrained(e.input):e.type==="join"?this.isConstrained(e.left)||this.isConstrained(e.right):e.type==="union"?this.isConstrained(e.left)&&this.isConstrained(e.right):!1}estimateCost(e){if(e.type==="bgp"){let t=0;for(let r of e.triples){let i=10;r.subject.type==="variable"&&(i*=10),r.predicate.type==="variable"&&(i*=20),r.object.type==="variable"&&(i*=5),t+=i}return t}if(e.type==="filter")return this.estimateCost(e.input)*.3;if(e.type==="join"){let t=this.estimateCost(e.left),r=this.estimateCost(e.right);return e.left.type==="values"||e.right.type==="values"?Math.min(t,r)*2:t*r}if(e.type==="leftjoin")return this.estimateCost(e.left)+this.estimateCost(e.right)*.5;if(e.type==="union")return this.estimateCost(e.left)+this.estimateCost(e.right);if(e.type==="values"){let t=e.bindings;return Array.isArray(t)?t.length*5:10}return e.type==="minus"?this.estimateCost(e.left)+this.estimateCost(e.right)*.3:100}setStatistics(e,t){this.stats.set(e,t)}getStatistics(e){return this.stats.get(e)}};mh.AlgebraOptimizer=Fy});var Sw=v(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.AlgebraSerializer=void 0;var Dy=class{static{o(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
|
|
284
284
|
${e.triples.map(u=>`${r} ${this.tripleToString(u)}`).join(`
|
|
285
285
|
`)}
|
|
286
286
|
${r}]`;case"filter":return`${r}Filter(
|
|
@@ -312,7 +312,7 @@ ${r})`;case"extend":return`${r}Extend (?${e.variable} = ${this.expressionToStrin
|
|
|
312
312
|
${this.toString(e.input,t+1)}
|
|
313
313
|
${r})`;case"subquery":return`${r}Subquery(
|
|
314
314
|
${this.toString(e.query,t+1)}
|
|
315
|
-
${r})`;default:return`${r}Unknown(${e.type})`}}tripleToString(e){return`${this.elementToString(e.subject)} ${this.predicateToString(e.predicate)} ${this.elementToString(e.object)}`}predicateToString(e){return this.isPropertyPath(e)?this.propertyPathToString(e):this.elementToString(e)}isPropertyPath(e){return e.type==="path"}propertyPathToString(e){let t=e.items.map(r=>r.type==="path"?`(${this.propertyPathToString(r)})`:`<${r.value}>`);switch(e.pathType){case"/":return t.join("/");case"|":return t.join("|");case"^":return`^${t[0]}`;case"+":return`${t[0]}+`;case"*":return`${t[0]}*`;case"?":return`${t[0]}?`}}elementToString(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":let t=`"${e.value}"`;return e.language&&(t+=`@${e.language}`),e.datatype&&(t+=`^^<${e.datatype}>`),t;case"blank":return`_:${e.value}`;default:return String(e)}}expressionToString(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value}"`:String(e.value);case"comparison":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"logical":return e.operator==="!"?`!(${this.expressionToString(e.operands[0])})`:`(${e.operands.map(t=>this.expressionToString(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"function":return`${e.function}(${e.args.map(t=>this.expressionToString(t)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.toString(e.pattern,0)} }`;default:return"unknown"}}toJSON(e){return JSON.stringify(e,null,2)}};gh.AlgebraSerializer=Dy});var es=v(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.SolutionMapping=void 0;var ww=mt(),Ew=We(),Tw=kt(),Ny=class n{static{o(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,r]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(r,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new n(this.bindings);for(let[r,i]of e.getBindings().entries())t.set(r,i);return t}clone(){return new n(this.bindings)}areEqual(e,t){return e instanceof ww.Literal&&t instanceof ww.Literal?e.equals(t):e instanceof Ew.IRI&&t instanceof Ew.IRI?e.value===t.value:e instanceof Tw.BlankNode&&t instanceof Tw.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,r]of this.bindings.entries())e[t]=r.toString();return e}size(){return this.bindings.size}};yh.SolutionMapping=Ny});var Aw=v(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.PropertyPathExecutor=wo.PropertyPathExecutorError=void 0;var o9=es(),vh=We(),xw=kt(),sl=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};wo.PropertyPathExecutorError=sl;var Ly=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new o9.SolutionMapping;this.isVariable(e)&&u.set(e.value,a),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new sl("Predicate is not a property path");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.object,t);for await(let s of this.execute(r,e.predicate,i)){let a=t.merge(s);a!==null&&(yield a)}}async evaluatePath(e,t,r){switch(t.pathType){case"/":return this.evaluateSequencePath(e,t.items,r);case"|":return this.evaluateAlternativePath(e,t.items,r);case"^":return this.evaluateInversePath(e,t.items[0],r);case"+":return this.evaluateOneOrMorePath(e,t.items[0],r);case"*":return this.evaluateZeroOrMorePath(e,t.items[0],r);case"?":return this.evaluateZeroOrOnePath(e,t.items[0],r)}}async evaluateSequencePath(e,t,r){let i=new Set([e]);for(let s=0;s<t.length;s++){let a=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,a,c?r:null);for(let h of f)l.add(h)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let a=await this.evaluatePathItem(e,s,r);for(let c of a)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new vh.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let{node:c,depth:l}=a.shift();if(l>=this.MAX_DEPTH)continue;let u=await this.evaluatePathItem(c,t,null);for(let f of u){let h=this.nodeToKey(f);(r===null||this.nodeInSet(f,r))&&s.add(f),i.has(h)||(i.add(h),a.push({node:f,depth:l+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new vh.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"|":return{type:"path",pathType:"|",items:e.items.map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"+":case"*":case"?":let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new vh.IRI(e.value));break;case"blank":t.add(new xw.BlankNode(e.value));break;default:throw new sl(`Unsupported element type in subject/object position: ${e.type}`)}return t}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r){if(r instanceof vh.IRI)return{type:"iri",value:r.value};if(r instanceof xw.BlankNode)return{type:"blank",value:r.id}}}return e}isVariable(e){return e.type==="variable"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};wo.PropertyPathExecutor=Ly});var jy=v(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.BGPExecutor=Eo.BGPExecutorError=void 0;var _h=es(),Es=We(),ky=mt(),bh=kt(),Sh=Lc(),c9=Aw(),vr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Eo.BGPExecutorError=vr;var My=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new c9.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new _h.SolutionMapping;return}let t=this.matchTriplePattern(e.triples[0]);for(let r=1;r<e.triples.length;r++)t=this.joinWithPattern(t,e.triples[r]);for await(let r of t)yield r}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*executeInGraph(e,t){if(e.triples.length===0){yield new _h.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new vr("Property paths within named graphs are not yet supported");let r=e.predicate,i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new vr("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,a,t);for(let l of c){let u=new _h.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate,r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new _h.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,h]of u.entries())l.set(f,h)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,h]of u.entries())l.set(f,h)}yield l}}hasVariablesInQuotedTriple(e){return!!(this.isVariable(e.subject)||e.predicate.type==="variable"||this.isVariable(e.object)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object))}matchQuotedTriplePattern(e,t){if(!(t instanceof Sh.QuotedTriple))return null;let r=new Map;if(this.isVariable(e.subject))r.set(e.subject.value,t.subject);else if(this.isQuotedTriple(e.subject)){let i=this.matchQuotedTriplePattern(e.subject,t.subject);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.subject,t.subject))return null;if(e.predicate.type==="variable")r.set(e.predicate.value,t.predicate);else if(e.predicate.value!==t.predicate.value)return null;if(this.isVariable(e.object))r.set(e.object.value,t.object);else if(this.isQuotedTriple(e.object)){let i=this.matchQuotedTriplePattern(e.object,t.object);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof Es.IRI&&e.value===t.value;case"literal":return!(!(t instanceof ky.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof bh.BlankNode&&e.value===t.id;case"quoted":return t instanceof Sh.QuotedTriple?this.toRDFQuotedTriple(e).equals(t):!1;default:return!1}}isPropertyPath(e){return e.type==="path"}async*joinWithPattern(e,t){let r=[];for await(let i of e)r.push(i);for(let i of r){let s=this.instantiatePattern(t,i);for await(let a of this.matchTriplePattern(s)){let c=i.merge(a);c!==null&&(yield c)}}}instantiatePattern(e,t){let r=this.isPropertyPath(e.predicate)?e.predicate:this.instantiateElement(e.predicate,t);return{subject:this.instantiateElement(e.subject,t),predicate:r,object:this.instantiateElement(e.object,t)}}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r)return this.toAlgebraElement(r)}return this.isQuotedTriple(e)?this.instantiateQuotedTriple(e,t):e}instantiateQuotedTriple(e,t){let r=this.instantiateElement(e.subject,t),i=e.predicate.type==="variable"?this.instantiatePredicateVariable(e.predicate,t):e.predicate,s=this.instantiateElement(e.object,t);return{type:"quoted",subject:r,predicate:i,object:s}}instantiatePredicateVariable(e,t){let r=t.get(e.value);return r&&r instanceof Es.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Es.IRI(e.value);case"blank":return new bh.BlankNode(e.value);case"literal":throw new vr("Literals cannot appear in subject position");case"variable":throw new vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new vr(`Unknown element type: ${e.type}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Es.IRI(e.predicate.value):(()=>{throw new vr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new Sh.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Es.IRI(e.value);case"literal":throw new vr("Literals cannot appear in predicate position");case"blank":throw new vr("Blank nodes cannot appear in predicate position");case"variable":throw new vr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new vr(`Unknown element type: ${e.type}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Es.IRI(e.value);case"literal":return new ky.Literal(e.value,e.datatype?new Es.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new bh.BlankNode(e.value);case"variable":throw new vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new vr(`Unknown element type: ${e.type}`)}}toAlgebraElement(e){if(e instanceof Es.IRI)return{type:"iri",value:e.value};if(e instanceof ky.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof bh.BlankNode)return{type:"blank",value:e.id};if(e instanceof Sh.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new vr(`Unknown RDF term type: ${e.constructor?.name||"unknown"}`)}toAlgebraQuotedTriple(e){return{type:"quoted",subject:this.toAlgebraElement(e.subject),predicate:{type:"iri",value:e.predicate.value},object:this.toAlgebraElement(e.object)}}};Eo.BGPExecutor=My});var Eh=v(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.BuiltInFunctions=void 0;var be=We(),R=mt(),Lr=kt(),To=Lc(),$y=Pr(),al=class{static{o(this,"BuiltInFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof be.IRI||e instanceof R.Literal?e.value:e instanceof Lr.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof R.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof R.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=this.parseDirectionalLangTag(e),[s,a]=this.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":a&&i!==a?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof R.Literal)return e.datatype?e.datatype:e.language?new be.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new be.IRI("http://www.w3.org/2001/XMLSchema#string");throw new Error("DATATYPE: argument must be a literal")}static bound(e){return e!==void 0}static isIRI(e){return e===void 0?!1:e instanceof be.IRI}static isBlank(e){return e===void 0?!1:e instanceof Lr.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof R.Literal}static isTriple(e){return e===void 0?!1:e instanceof To.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof R.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof R.Literal))return!1;let t=e.datatype?.value;return t?["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float","http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedShort","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#positiveInteger"].includes(t):!1}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"u":"u";return new RegExp(t,i).test(e)}catch(i){throw new Error(`REGEX: invalid pattern '${t}': ${i.message}`)}}static compare(e,t,r){if(this.isDayTimeDurationValue(e)&&this.isDayTimeDurationValue(t))return this.compareDurations(e instanceof R.Literal?e:String(e),t instanceof R.Literal?t:String(t),r);let i=this.toComparableValue(e),s=this.toComparableValue(t);switch(r){case"=":return i===s;case"!=":return i!==s;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:throw new Error(`Unknown comparison operator: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static toComparableValue(e){if(typeof e=="string"||typeof e=="number")return e;if(e instanceof R.Literal){let t=e.datatype?.value;if(t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double")){let r=parseFloat(e.value);if(!isNaN(r))return r}if(t==="http://www.w3.org/2001/XMLSchema#dayTimeDuration")try{return this.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof be.IRI?e.value:e instanceof Lr.BlankNode?e.id:String(e)}static contains(e,t){return e.includes(t)}static strStarts(e,t){return e.startsWith(t)}static strEnds(e,t){return e.endsWith(t)}static strlen(e){return e.length}static ucase(e){return e.toUpperCase()}static lcase(e){return e.toLowerCase()}static substr(e,t,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",a=s.includes("u")?s:s+"u",c=new RegExp(t,a);return e.replace(c,r)}catch(s){throw new Error(`REPLACE: invalid pattern '${t}': ${s.message}`)}}static parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static dateBefore(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r<i}static dateAfter(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r>i}static dateInRange(e,t,r){let i=this.parseDate(e),s=this.parseDate(t),a=this.parseDate(r);return i>=s&&i<=a}static dateDiffMinutes(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),a=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);a===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${a}M`}else{let s=-t.getTimezoneOffset(),a=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${a}H`:r=`${l}PT${a}H${c}M`}}return new R.Literal(r,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static tz(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TZ: invalid date string '${e}'`);if(e.endsWith("Z"))return"Z";let r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static now(){return new Date().toISOString()}static msToMinutes(e){return Math.round(e/(1e3*60))}static msToHours(e){return Math.round(e/(1e3*60*60)*100)/100}static msToSeconds(e){return Math.round(e/1e3)}static abs(e){return Math.abs(e)}static round(e){return Math.round(e)}static ceil(e){return Math.ceil(e)}static floor(e){return Math.floor(e)}static rand(){return Math.random()}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new R.Literal(t.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static xsdInteger(e){let t=parseInt(e,10);if(isNaN(t))throw new Error(`xsd:integer: cannot convert '${e}' to integer`);return new R.Literal(String(t),new be.IRI("http://www.w3.org/2001/XMLSchema#integer"))}static xsdDecimal(e){let t=parseFloat(e);if(isNaN(t))throw new Error(`xsd:decimal: cannot convert '${e}' to decimal`);return new R.Literal(String(t),new be.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static encodeForUri(e){return encodeURIComponent(e)}static md5(e){return require("crypto").createHash("md5").update(e).digest("hex")}static sha1(e){return require("crypto").createHash("sha1").update(e).digest("hex")}static sha256(e){return require("crypto").createHash("sha256").update(e).digest("hex")}static sha384(e){return require("crypto").createHash("sha384").update(e).digest("hex")}static sha512(e){return require("crypto").createHash("sha512").update(e).digest("hex")}static sameTerm(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0||e.constructor!==t.constructor)return!1;if(e instanceof be.IRI&&t instanceof be.IRI)return e.value===t.value;if(e instanceof Lr.BlankNode&&t instanceof Lr.BlankNode)return e.id===t.id;if(e instanceof R.Literal&&t instanceof R.Literal){if(e.value!==t.value||e.language!==t.language)return!1;let r=e.datatype?.value,i=t.datatype?.value;return r===i}return!1}static iri(e){if(e===void 0)throw new Error("IRI: argument is undefined");if(e instanceof be.IRI)return e;if(e instanceof R.Literal)return new be.IRI(e.value);throw e instanceof Lr.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return this.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,$y.v4)().replace(/-/g,"").substring(0,12)}`;return new Lr.BlankNode(t)}if(e instanceof R.Literal)return new Lr.BlankNode(e.value);if(e instanceof Lr.BlankNode)return e;throw new Error("BNODE: argument must be a string literal or omitted")}static strdt(e,t){if(e===void 0)throw new Error("STRDT: lexical form is undefined");if(t===void 0)throw new Error("STRDT: datatype IRI is undefined");let r;if(e instanceof R.Literal){if(e.language)throw new Error("STRDT: lexical form must not have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRDT: lexical form must be a string literal");let i;if(t instanceof be.IRI)i=t;else if(t instanceof R.Literal)i=new be.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new R.Literal(r,i)}static strlang(e,t){if(e===void 0)throw new Error("STRLANG: lexical form is undefined");if(t===void 0)throw new Error("STRLANG: language tag is undefined");let r;if(e instanceof R.Literal){if(e.language)throw new Error("STRLANG: lexical form must not already have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRLANG: lexical form must be a string literal");let i;if(t instanceof R.Literal)i=t.value;else if(typeof t=="string")i=t;else throw new Error("STRLANG: language tag must be a string literal");if(i==="")throw new Error("STRLANG: language tag cannot be empty");return new R.Literal(r,void 0,i)}static strlangdir(e,t,r){if(e===void 0)throw new Error("STRLANGDIR: lexical form is undefined");if(t===void 0)throw new Error("STRLANGDIR: language tag is undefined");if(r===void 0)throw new Error("STRLANGDIR: direction is undefined");let i;if(e instanceof R.Literal){if(e.language)throw new Error("STRLANGDIR: lexical form must not already have a language tag");i=e.value}else if(typeof e=="string")i=e;else throw new Error("STRLANGDIR: lexical form must be a string literal");let s;if(t instanceof R.Literal)s=t.value;else if(typeof t=="string")s=t;else throw new Error("STRLANGDIR: language tag must be a string literal");if(s==="")throw new Error("STRLANGDIR: language tag cannot be empty");let a;if(r instanceof R.Literal)a=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(a!=="ltr"&&a!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${a}'. Must be 'ltr' or 'rtl'`);return new R.Literal(i,void 0,s,a)}static uuid(){let e=(0,$y.v4)();return new be.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,$y.v4)();return new R.Literal(e)}static parseDayTimeDuration(e){if(!e)throw new Error("parseDayTimeDuration: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDayTimeDuration: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=r.indexOf("T"),a="",c="";if(s===-1?a=r:(a=r.substring(0,s),c=r.substring(s+1)),a){let l=a.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(a!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${a}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let d=parseFloat(u[1]);i+=d*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let d=parseFloat(f[1]);i+=d*60*1e3,l=l.substring(f[0].length)}let h=l.match(/^(\d+(?:\.\d+)?)S$/);if(h){let d=parseFloat(h[1]);i+=d*1e3,l=l.substring(h[0].length)}if(l!=="")throw new Error(`parseDayTimeDuration: invalid time component: '${l}' in '${e}'`)}return t?-i:i}static formatDayTimeDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let a=Math.floor(r/(60*1e3));r=r%(60*1e3);let c=r/1e3,l=t?"-P":"P";return i>0&&(l+=`${i}D`),(s>0||a>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),a>0&&(l+=`${a}M`),(c>0||s===0&&a===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return this.parseDayTimeDuration(e),new R.Literal(e,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static compareDurations(e,t,r){let i=e instanceof R.Literal?e.value:e,s=t instanceof R.Literal?t.value:t,a=this.parseDayTimeDuration(i),c=this.parseDayTimeDuration(s);switch(r){case"=":return a===c;case"!=":return a!==c;case"<":return a<c;case">":return a>c;case"<=":return a<=c;case">=":return a>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static isDayTimeDuration(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static dateDiff(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r),a=this.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(a===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-a.getTime(),l=Math.round(c/(1440*60*1e3)),u=this.formatDateDuration(l);return new R.Literal(u,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,h=parseInt(u[2],10),d=parseInt(u[3],10),p=f*(h*60+d)*60*1e3;l=new Date(l.getTime()-p)}}return l}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static dateTimeDiff(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r),a=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(a.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-a.getTime(),l=this.formatDayTimeDuration(c);return new R.Literal(l,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new R.Literal(l.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new R.Literal(l.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new R.Literal(d,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new R.Literal(d,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static isYearMonthDuration(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static dateTimeAddYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new R.Literal(s.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new R.Literal(s.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),h=`${l}-${u}-${f}`;return new R.Literal(h,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),h=`${l}-${u}-${f}`;return new R.Literal(h,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s+a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s-a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof R.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i*t);return new R.Literal(s,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationDivide(e,t){if(t===0)throw new Error("durationDivide: division by zero");let r=e instanceof R.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i/t);return new R.Literal(s,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static yearMonthDurationAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s+a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s-a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static durationYears(e){let t=e instanceof R.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof R.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static durationToDays(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/1e3}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let h=u.match(/^(\d+(?:\.\d+)?)D$/);if(h)i=parseFloat(h[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let h=f,d=h.match(/^(\d+(?:\.\d+)?)H/);d&&(s=parseFloat(d[1]),h=h.substring(d[0].length));let p=h.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),h=h.substring(p[0].length));let _=h.match(/^(\d+(?:\.\d+)?)S$/);if(_&&(c=parseFloat(_[1]),h=h.substring(_[0].length)),h!=="")throw new Error(`parseDurationComponents: invalid time component: '${h}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}static durationDays(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static adjust(e,t){let r=e instanceof R.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let H=i.getUTCFullYear(),ee=String(i.getUTCMonth()+1).padStart(2,"0"),Se=String(i.getUTCDate()).padStart(2,"0"),N=String(i.getUTCHours()).padStart(2,"0"),Y=String(i.getUTCMinutes()).padStart(2,"0"),ge=String(i.getUTCSeconds()).padStart(2,"0"),dt=i.getUTCMilliseconds(),nt=`${H}-${ee}-${Se}T${N}:${Y}:${ge}`;return dt>0&&(nt+=`.${String(dt).padStart(3,"0")}`),new R.Literal(nt,new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof R.Literal?t.value:t,a=this.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),h=String(u.getUTCMonth()+1).padStart(2,"0"),d=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),_=String(u.getUTCMinutes()).padStart(2,"0"),b=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),A=a>=0?"+":"-",C=Math.floor(Math.abs(a)/(3600*1e3)),M=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),G=`${A}${String(C).padStart(2,"0")}:${String(M).padStart(2,"0")}`,Q=`${f}-${h}-${d}T${p}:${_}:${b}`;return E>0&&(Q+=`.${String(E).padStart(3,"0")}`),Q+=G,new R.Literal(Q,new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof R.Literal)r=e.value;else if(e instanceof be.IRI)r=e.value;else if(e instanceof Lr.BlankNode)r=e.id;else if(typeof e=="string")r=e;else throw new Error("NORMALIZE: first argument must be a string or literal");let i="NFC";if(t!==void 0)if(t instanceof R.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof be.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!this.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new R.Literal(s,new be.IRI("http://www.w3.org/2001/XMLSchema#string"))}static fold(e){if(e===void 0)throw new Error("FOLD: string argument is undefined");let t;if(e instanceof R.Literal)t=e.value;else if(e instanceof be.IRI)t=e.value;else if(e instanceof Lr.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=this.unicodeCaseFold(t);return new R.Literal(r,new be.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=this.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}static isTime(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static timeDiff(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDTime(r),a=this.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(a===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-a,l=this.formatDayTimeDuration(c);return new R.Literal(l,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==0))return null;let u=0;if(c){let h=c.padEnd(3,"0").slice(0,3);u=parseInt(h,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let h=l.match(/([+-])(\d{2}):(\d{2})/);if(h){let d=h[1]==="+"?1:-1,p=parseInt(h[2],10),_=parseInt(h[3],10),b=d*(p*60+_)*60*1e3;f-=b}}return f}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof R.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof be.IRI)){let c=t instanceof R.Literal?"Literal":t instanceof Lr.BlankNode?"BlankNode":t instanceof To.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new To.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof To.QuotedTriple)){let t=e instanceof be.IRI?"IRI":e instanceof R.Literal?"Literal":e instanceof Lr.BlankNode?"BlankNode":typeof e;throw new Error(`SUBJECT: argument must be QuotedTriple, got ${t}`)}return e.subject}static predicate(e){if(e===void 0)throw new Error("PREDICATE: argument is undefined");if(!(e instanceof To.QuotedTriple)){let t=e instanceof be.IRI?"IRI":e instanceof R.Literal?"Literal":e instanceof Lr.BlankNode?"BlankNode":typeof e;throw new Error(`PREDICATE: argument must be QuotedTriple, got ${t}`)}return e.predicate}static object(e){if(e===void 0)throw new Error("OBJECT: argument is undefined");if(!(e instanceof To.QuotedTriple)){let t=e instanceof be.IRI?"IRI":e instanceof R.Literal?"Literal":e instanceof Lr.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};wh.BuiltInFunctions=al;al.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];al.CASE_FOLDING_MAP=new Map([["\xDF","ss"],["\u1E9E","ss"],["\u03A3","\u03C3"],["\u03C2","\u03C3"],["\u0130","i\u0307"],["I","i"],["\u0587","\u0565\u0582"],["\uFB00","ff"],["\uFB01","fi"],["\uFB02","fl"],["\uFB03","ffi"],["\uFB04","ffl"],["\uFB05","st"],["\uFB06","st"],["\u0390","\u03B9\u0308\u0301"],["\u03B0","\u03C5\u0308\u0301"],["\u017F","s"],["\u1E9B","\u1E61"],["\u212A","k"],["\u212B","\xE5"]])});var Lw=v(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.functionHandlers=void 0;var j=Eh();L.functionHandlers=new Map;L.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.str(t)});L.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.lang(t)});L.functionHandlers.set("langmatches",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.langMatches(t,r)});L.functionHandlers.set("contains",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.contains(t,r)});L.functionHandlers.set("strstarts",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strStarts(t,r)});L.functionHandlers.set("strends",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strEnds(t,r)});L.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.strlen(t)});L.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.ucase(t)});L.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.lcase(t)});L.functionHandlers.set("substr",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=Number(e.evaluateExpression(n[1],e.solution));if(n[2]){let i=Number(e.evaluateExpression(n[2],e.solution));return j.BuiltInFunctions.substr(t,r,i)}return j.BuiltInFunctions.substr(t,r)});L.functionHandlers.set("strbefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strBefore(t,r)});L.functionHandlers.set("strafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.strAfter(t,r)});L.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return j.BuiltInFunctions.concat(...t)});L.functionHandlers.set("replace",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution)),s=n[3]?e.getStringValue(e.evaluateExpression(n[3],e.solution)):void 0;return j.BuiltInFunctions.replace(t,r,i,s)});L.functionHandlers.set("regex",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=n[2]?e.getStringValue(e.evaluateExpression(n[2],e.solution)):void 0;return j.BuiltInFunctions.regex(t,r,i)});L.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.encodeForUri(t)});L.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.datatype(t).value});L.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return j.BuiltInFunctions.bound(r)}return!0});var Cw=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isIRI(t)},"isIriHandler");L.functionHandlers.set("isiri",Cw);L.functionHandlers.set("isuri",Cw);L.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isBlank(t)});L.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isLiteral(t)});L.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isNumeric(t)});L.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.hasLangdir(t)});L.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.isTriple(t)});L.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return j.BuiltInFunctions.sameTerm(t,r)});L.functionHandlers.set("abs",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.abs(t)});L.functionHandlers.set("round",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.round(t)});L.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.ceil(t)});L.functionHandlers.set("floor",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.floor(t)});L.functionHandlers.set("rand",()=>j.BuiltInFunctions.rand());L.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.parseDate(t)});L.functionHandlers.set("datebefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateBefore(t,r)});L.functionHandlers.set("dateafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateAfter(t,r)});L.functionHandlers.set("dateinrange",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution));return j.BuiltInFunctions.dateInRange(t,r,i)});L.functionHandlers.set("datediffminutes",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateDiffMinutes(t,r)});L.functionHandlers.set("datediffhours",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return j.BuiltInFunctions.dateDiffHours(t,r)});var xo=o((n,e,t)=>(r,i)=>{let s=i.evaluateExpression(r[0],i.solution);return e&&i.isYearMonthDurationValue(s)?e(s):t&&i.isDayTimeDurationValue(s)?t(s):n(i.getStringValue(s))},"createDateTimeAccessor"),Iw=xo(j.BuiltInFunctions.year,j.BuiltInFunctions.durationYears,null);L.functionHandlers.set("year",Iw);L.functionHandlers.set("years",Iw);var Ow=xo(j.BuiltInFunctions.month,j.BuiltInFunctions.durationMonths,null);L.functionHandlers.set("month",Ow);L.functionHandlers.set("months",Ow);var Pw=xo(j.BuiltInFunctions.day,null,j.BuiltInFunctions.durationDays);L.functionHandlers.set("day",Pw);L.functionHandlers.set("days",Pw);L.functionHandlers.set("hours",xo(j.BuiltInFunctions.hours,null,j.BuiltInFunctions.durationHours));L.functionHandlers.set("minutes",xo(j.BuiltInFunctions.minutes,null,j.BuiltInFunctions.durationMinutes));L.functionHandlers.set("seconds",xo(j.BuiltInFunctions.seconds,null,j.BuiltInFunctions.durationSeconds));L.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.timezone(t)});L.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.tz(t)});L.functionHandlers.set("adjust",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=n.length>1?e.evaluateExpression(n[1],e.solution):void 0;return j.BuiltInFunctions.adjust(t,r)});L.functionHandlers.set("now",()=>j.BuiltInFunctions.now());var Rw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");L.functionHandlers.set("datetime",Rw);L.functionHandlers.set("xsd:datetime",Rw);var Fw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");L.functionHandlers.set("integer",Fw);L.functionHandlers.set("xsd:integer",Fw);var Dw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");L.functionHandlers.set("decimal",Dw);L.functionHandlers.set("xsd:decimal",Dw);var Nw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");L.functionHandlers.set("daytimeduration",Nw);L.functionHandlers.set("xsd:daytimeduration",Nw);L.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToDays(t)});L.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToHours(t)});L.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToMinutes(t)});L.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationToSeconds(t)});L.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationDays(t)});L.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationHours(t)});L.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationMinutes(t)});L.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationSeconds(t)});L.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationYears(t)});L.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return j.BuiltInFunctions.durationMonths(t)});L.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeDiff(t,r)});L.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeAdd(t,r)});L.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return j.BuiltInFunctions.dateTimeSubtract(t,r)});L.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToMinutes(t)});L.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToHours(t)});L.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.msToSeconds(t)});L.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.md5(t)});L.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha1(t)});L.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha256(t)});L.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha384(t)});L.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return j.BuiltInFunctions.sha512(t)});L.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.subject(t)});L.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.predicate(t)});L.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return j.BuiltInFunctions.object(t)});L.functionHandlers.set("triple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution),i=e.getTermFromExpression(n[2],e.solution);return j.BuiltInFunctions.triple(t,r,i)})});var Th=v(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.FilterExecutor=Ao.FilterExecutorError=void 0;var ft=Eh(),l9=Lw(),va=mt(),sr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Ao.FilterExecutorError=sr;var Vy=class{static{o(this,"FilterExecutor")}constructor(){this.existsEvaluator=null,this.tripleStore=null,this.uuidCache=new Map}setExistsEvaluator(e){this.existsEvaluator=e}setTripleStore(e){this.tripleStore=e,this.uuidCache.clear()}async*execute(e,t){let r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?s=await this.evaluateExpressionAsync(e.expression,i):s=this.evaluateExpression(e.expression,i),s===!0&&(yield i)}catch{continue}}expressionContainsExists(e){if(e.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison")return this.expressionContainsExists(e.left)||this.expressionContainsExists(e.right);if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}o(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if(r.termType)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":return r.value;case"NamedNode":return r.value;default:throw new sr(`Unsupported termType: ${r.termType}`)}switch(e.type){case"comparison":return this.evaluateComparison(e,t);case"logical":return this.evaluateLogical(e,t);case"arithmetic":return this.evaluateArithmetic(e,t);case"function":case"functionCall":return this.evaluateFunction(e,t);case"variable":return t.get(e.name);case"literal":return e.value;case"in":return this.evaluateIn(e,t);case"exists":throw new sr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new sr(`Unsupported expression type: ${e.type}, expr.termType=${r.termType}`)}}async evaluateExpressionAsync(e,t){return e.type==="exists"?this.evaluateExists(e,t):e.type==="logical"?this.evaluateLogicalAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new sr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return ft.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return ft.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return ft.BuiltInFunctions.logicalOr(r);throw new sr(`Unknown logical operator: ${e.operator}`)}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return ft.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return ft.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return ft.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return ft.BuiltInFunctions.logicalOr(r);throw new sr(`Unknown logical operator: ${e.operator}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return ft.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return ft.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return ft.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return ft.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return ft.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return ft.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new sr("Division by zero");return ft.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new sr("Division by zero");return s/a;default:throw new sr(`Unknown arithmetic operator: ${e.operator}`)}}isDayTimeDurationValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof va.Literal){let t=e.datatype?.value||"";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let i=parseFloat(e.value);if(!isNaN(i))return i}let r=parseFloat(e.value);if(!isNaN(r))return r}if(typeof e=="string"){let t=parseFloat(e);if(!isNaN(t))return t}if(e&&typeof e=="object"&&"value"in e){let t=parseFloat(String(e.value));if(!isNaN(t))return t}throw new sr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof va.Literal){let t=e.datatype?.value||"";return t.includes("#dateTime")||t.includes("#date")?!0:/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e.value)}return typeof e=="string"?/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e):!1}isDateValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=l9.functionHandlers.get(i);if(!a)throw new sr(`Unknown function: ${i}`);let c={evaluateExpression:o((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:o((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:o(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:o(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:o(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return a(r.args,c)}extractFunctionName(e){if(typeof e=="string")return e.toLowerCase();if(e&&typeof e=="object"&&"value"in e){let t=e.value;return((t.includes("#")?t.split("#").pop():t.split("/").pop())||t).toLowerCase()}throw new sr(`Unknown function format: ${e}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let c of t)try{let l=this.evaluateExpression(c,r);if(l!=null)return{value:l}}catch{continue}return{value:void 0};case"if":if(!t||t.length!==3)throw new sr("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)};case"byuuid":return{value:this.evaluateByUUID({args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof va.Literal){let t=e.datatype?.value||"";if(t.includes("#boolean"))return e.value==="true"||e.value==="1";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new sr("exo:byUUID requires exactly 1 argument (UUID string)");let r=this.evaluateExpression(e.args[0],t),i=this.getStringValue(r);if(!i)return;let s=i.toLowerCase();if(this.uuidCache.has(s))return this.uuidCache.get(s)??void 0;if(!this.tripleStore){this.uuidCache.set(s,null);return}if(this.tripleStore.findSubjectsByUUIDSync){let a=this.tripleStore.findSubjectsByUUIDSync(s);if(a.length===0){this.uuidCache.set(s,null);return}let c=a[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Ao.FilterExecutor=Vy});var By=v(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.OptionalExecutor=void 0;var Uy=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.add(u);let i=new Set;for(let l of t)for(let u of l.variables())i.add(u);let s=[];for(let l of r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),h=!1;if(f)for(let d of f){let p=l.merge(d);p!==null&&(yield p,h=!0)}h||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};xh.OptionalExecutor=Uy});var Gy=v(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.UnionExecutor=void 0;var qy=class{static{o(this,"UnionExecutor")}async*execute(e,t){let r=new Set;for await(let i of e){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}for await(let i of t){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};Ah.UnionExecutor=qy});var Qy=v(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ConstructExecutor=void 0;var u9=_i(),_a=We(),Wy=mt(),Hy=kt(),f9=Lc(),zy=class{static{o(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let a of e)try{let c=this.instantiateTriple(a,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),r.push(c))}catch{continue}return r}instantiateTriple(e,t){if(this.isPropertyPath(e.predicate))throw new Error("Property paths are not supported in CONSTRUCT templates");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.predicate,t),s=this.instantiateElement(e.object,t);return new u9.Triple(r,i,s)}isPropertyPath(e){return e.type==="path"}instantiateElement(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable: ${e.value}`);return r}if(e.type==="iri")return new _a.IRI(e.value);if(e.type==="literal")return new Wy.Literal(e.value,e.datatype?new _a.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new Hy.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Unknown element type: ${e.type}`)}instantiateQuotedTriple(e,t){let r=this.instantiateQuotedSubject(e.subject,t),i=this.instantiateQuotedPredicate(e.predicate,t),s=this.instantiateQuotedObject(e.object,t);return new f9.QuotedTriple(r,i,s)}instantiateQuotedSubject(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple subject: ${e.value}`);if(r instanceof Wy.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new _a.IRI(e.value);if(e.type==="blank")return new Hy.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Invalid element type for quoted triple subject: ${e.type}`)}instantiateQuotedPredicate(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple predicate: ${e.value}`);if(!(r instanceof _a.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new _a.IRI(e.value)}instantiateQuotedObject(e,t){if(e.type==="variable"){let i=t.get(e.value);if(!i)throw new Error(`Unbound variable in quoted triple object: ${e.value}`);return i}if(e.type==="iri")return new _a.IRI(e.value);if(e.type==="blank")return new Hy.BlankNode(e.value);if(e.type==="literal")return new Wy.Literal(e.value,e.datatype?new _a.IRI(e.datatype):void 0,e.language);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);let r=e;throw new Error(`Invalid element type for quoted triple object: ${r.type}`)}};Ch.ConstructExecutor=zy});var Mw=v(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.DescribeExecutor=void 0;var kw=We(),Yy=class{static{o(this,"DescribeExecutor")}constructor(e){this.tripleStore=e}async execute(e,t){let r=[],i=new Set,s=new Set,a=t?.depth;for(let c of e)await this.describeResourceWithDepth(c,a,1,t?.symmetric??!0,r,i,s);return r}async describeResourceWithDepth(e,t,r,i,s,a,c){let l=e.toString();if(c.has(l)||(c.add(l),t!==void 0&&r>t))return;let u=[],f=await this.tripleStore.match(e,void 0,void 0);if(u.push(...f),i){let d=await this.tripleStore.match(void 0,void 0,e);u.push(...d)}let h=[];for(let d of u){let p=`${d.subject.toString()}|${d.predicate.toString()}|${d.object.toString()}`;a.has(p)||(a.add(p),s.push(d),(t===void 0||r<t)&&(this.isIRI(d.subject)&&d.subject.toString()!==l&&h.push(d.subject),this.isIRI(d.object)&&d.object.toString()!==l&&h.push(d.object)))}for(let d of h)await this.describeResourceWithDepth(d,t,r+1,i,s,a,c)}isIRI(e){return e?e instanceof kw.IRI||e.termType==="NamedNode"||typeof e.value=="string"&&e.value.startsWith("http"):!1}async describeByIRI(e,t){let r=new kw.IRI(e);return this.execute([r],t)}};Ih.DescribeExecutor=Yy});var jw=v(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.MinusExecutor=void 0;var Ky=class{static{o(this,"MinusExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);for(let s of r){let a=!1;for(let c of i)if(this.areCompatible(s,c)){a=!0;break}a||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(a=>i.has(a));if(s.length===0)return!1;for(let a of s){let c=e.get(a),l=t.get(a);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};Oh.MinusExecutor=Ky});var Vw=v(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.ValuesExecutor=Co.ValuesExecutorError=void 0;var h9=es(),$w=We(),d9=mt(),Ph=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Co.ValuesExecutorError=Ph;var Xy=class{static{o(this,"ValuesExecutor")}async*execute(e){if(e.bindings.length!==0)for(let t of e.bindings)yield this.createSolutionMapping(t)}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new h9.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.toRDFTerm(i);t.set(r,s)}return t}toRDFTerm(e){if(e.type==="iri")return new $w.IRI(e.value);if(e.type==="literal")return new d9.Literal(e.value,e.datatype?new $w.IRI(e.datatype):void 0,e.language,e.direction);throw new Ph(`Unknown term type: ${e.type}`)}};Co.ValuesExecutor=Xy});var Jy=v(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.CustomAggregateRegistry=Oo.CustomAggregateError=void 0;var Io=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Oo.CustomAggregateError=Io;var Rh=class n{static{o(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance&&n.instance.clear(),n.instance=null}register(e,t){if(!e||typeof e!="string")throw new Io("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Io("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Io(`Aggregate with IRI "${e}" is already registered`,e);this.aggregates.set(e,t)}unregister(e){return this.aggregates.delete(e)}get(e){return this.aggregates.get(e)}has(e){return this.aggregates.has(e)}getRegisteredIris(){return Array.from(this.aggregates.keys())}clear(){this.aggregates.clear()}get size(){return this.aggregates.size}};Oo.CustomAggregateRegistry=Rh;Rh.instance=null});var Zy=v(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.BUILT_IN_AGGREGATES=qe.modeAggregate=qe.stddevAggregate=qe.varianceAggregate=qe.medianAggregate=qe.EXO_AGGREGATE_NS=void 0;qe.getNumericValue=Fh;qe.createDecimalLiteral=ri;qe.createDoubleLiteral=g9;qe.createPercentileAggregate=ba;var Sa=mt(),Po=We(),p9=new Po.IRI("http://www.w3.org/2001/XMLSchema#decimal"),m9=new Po.IRI("http://www.w3.org/2001/XMLSchema#double");qe.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Fh(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof Sa.Literal?parseFloat(n.value):n instanceof Po.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Fh,"getNumericValue");function ri(n){return new Sa.Literal(String(n),p9)}o(ri,"createDecimalLiteral");function g9(n){return new Sa.Literal(String(n),m9)}o(g9,"createDoubleLiteral");qe.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Fh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ri(0);let r=[...t].sort((a,c)=>a-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return ri(s)}};qe.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Fh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ri(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ri(i)}};qe.stddevAggregate={init(){return{values:[]}},step(n,e){qe.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ri(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ri(Math.sqrt(i))}};qe.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof Sa.Literal||e instanceof Po.IRI?e.value:e),i=t.counts.get(r)||0;t.counts.set(r,i+1),t.values.set(r,e)},finalize(n){let e=n;if(e.counts.size===0)return new Sa.Literal(" ",new Po.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[a,c]of e.counts)c>r&&(r=c,t=a);let i=e.values.get(t);if(i instanceof Sa.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Sa.Literal(t,new Po.IRI("http://www.w3.org/2001/XMLSchema#string")):ri(s)}};function ba(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Fh(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ri(0);let s=[...i].sort((h,d)=>h-d),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return ri(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ri(f)}}}o(ba,"createPercentileAggregate");qe.BUILT_IN_AGGREGATES={[`${qe.EXO_AGGREGATE_NS}median`]:qe.medianAggregate,[`${qe.EXO_AGGREGATE_NS}variance`]:qe.varianceAggregate,[`${qe.EXO_AGGREGATE_NS}stddev`]:qe.stddevAggregate,[`${qe.EXO_AGGREGATE_NS}mode`]:qe.modeAggregate,[`${qe.EXO_AGGREGATE_NS}percentile25`]:ba(25),[`${qe.EXO_AGGREGATE_NS}percentile50`]:ba(50),[`${qe.EXO_AGGREGATE_NS}percentile75`]:ba(75),[`${qe.EXO_AGGREGATE_NS}percentile90`]:ba(90),[`${qe.EXO_AGGREGATE_NS}percentile95`]:ba(95),[`${qe.EXO_AGGREGATE_NS}percentile99`]:ba(99)}});var qw=v(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.AggregateExecutor=Ro.AggregateExecutorError=void 0;var jt=mt(),t1=We(),y9=Th(),v9=Jy(),_9=Zy(),Uw=new t1.IRI("http://www.w3.org/2001/XMLSchema#integer"),wa=new t1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),Ai=new t1.IRI("http://www.w3.org/2001/XMLSchema#string");function Bw(n){return typeof n=="object"&&n.type==="custom"}o(Bw,"isCustomAggregation");var ol=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Ro.AggregateExecutorError=ol;var e1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new y9.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,a]of r.entries()){let c=new Map;for(let f of e.variables)if(a.length>0){let h=a[0].get(f);h&&c.set(f,h)}for(let f of e.aggregates){let h=this.computeAggregate(f.expression,a);c.set(f.variable,h)}let{SolutionMapping:l}=es(),u=new l;for(let[f,h]of c.entries())u.set(f,h);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),a=r.get(s);a?a.push(i):r.set(s,[i])}return r}computeGroupKey(e,t){return t.map(r=>{let i=e.get(r);return i?this.termToString(i):""}).join("|")}termToString(e){if(e&&typeof e=="object"){if("value"in e)return String(e.value);if("id"in e)return String(e.id)}return String(e)}computeAggregate(e,t){if(Bw(e.aggregation))return this.computeCustomAggregate(e,t);let r=this.extractValues(e,t),i=e.aggregation;switch(i){case"count":{let s=this.computeCount(r,e.distinct);return new jt.Literal(String(s),Uw)}case"sum":{let s=this.computeSum(r);return new jt.Literal(String(s),wa)}case"avg":{let s=this.computeAvg(r);return new jt.Literal(String(s),wa)}case"min":{let s=this.computeMin(r);return s===void 0?new jt.Literal("",Ai):typeof s=="number"?new jt.Literal(String(s),wa):new jt.Literal(String(s),Ai)}case"max":{let s=this.computeMax(r);return s===void 0?new jt.Literal("",Ai):typeof s=="number"?new jt.Literal(String(s),wa):new jt.Literal(String(s),Ai)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new jt.Literal(s||" ",Ai)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new jt.Literal(" ",Ai):typeof s=="number"?new jt.Literal(String(s),wa):new jt.Literal(String(s),Ai)}default:{let s=i;throw new ol(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=v9.CustomAggregateRegistry.getInstance().get(i);if(a||(a=_9.BUILT_IN_AGGREGATES[i]),!a)throw new ol(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=a.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;a.step(c,u)}return a.finalize(c)}extractValues(e,t){if(!e.expression)return t.map(()=>1);let r=[];for(let i of t){let s=this.evaluateExpression(e.expression,i);s!=null&&r.push(s)}return r}evaluateExpression(e,t){if(e.type==="variable"){let r=t.get(e.name);return r==null?void 0:typeof r=="number"||typeof r=="string"||typeof r=="boolean"?r:typeof r=="object"&&"value"in r?r.value:r}if(e.type==="literal")return e.value;try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}computeCount(e,t){return t?new Set(e.map(r=>String(r))).size:e.length}computeSum(e){return e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r)).reduce((r,i)=>r+i,0)}computeAvg(e){let t=e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r));return t.length===0?0:t.reduce((r,i)=>r+i,0)/t.length}computeMin(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.min(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s<i?s:i,r[0])}computeMax(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.max(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s>i?s:i,r[0])}computeGroupConcat(e,t,r){let i=e.map(s=>String(s));return r&&(i=[...new Set(i)]),i.join(t)}computeSample(e,t){if(e.length===0)return;if(t){let s=[...new Set(e.map(l=>String(l)))];if(s.length===0)return;let a=s[0],c=parseFloat(a);return isNaN(c)?a:c}let r=e[0];if(typeof r=="number")return r;let i=parseFloat(String(r));return isNaN(i)?String(r):i}createEmptyAggregateResult(e){let{SolutionMapping:t}=es(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(Bw(s)){r.set(i.variable,new jt.Literal("0",wa));continue}switch(s){case"count":r.set(i.variable,new jt.Literal("0",Uw));break;case"sum":case"avg":r.set(i.variable,new jt.Literal("0",wa));break;case"group_concat":r.set(i.variable,new jt.Literal(" ",Ai));break;case"min":case"max":case"sample":r.set(i.variable,new jt.Literal("",Ai));break;default:r.set(i.variable,new jt.Literal("",Ai))}}return r}};Ro.AggregateExecutor=e1});var Ww=v(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.ServiceExecutor=Fo.ServiceExecutorError=void 0;var b9=es(),Gw=We(),S9=mt(),w9=kt(),Ea=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Fo.ServiceExecutorError=Ea;var r1=class{static{o(this,"ServiceExecutor")}constructor(e={}){this.timeout=e.timeout??3e4,this.httpClient=e.httpClient??((t,r)=>fetch(t,r)),this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3}async*execute(e,t){try{let r=t(e.pattern),i=await this.executeRemoteQuery(e.endpoint,r);for(let s of i)yield s}catch(r){if(e.silent)return;throw r}}async executeRemoteQuery(e,t){let r;for(let i=0;i<=this.maxRetries;i++)try{let s=new AbortController,a=setTimeout(()=>s.abort(),this.timeout);try{let c=await this.httpClient(e,{method:"POST",headers:{"Content-Type":"application/sparql-query",Accept:"application/sparql-results+json"},body:t,signal:s.signal});if(!c.ok)throw new Ea(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(a)}}catch(s){if(r=s instanceof Error?s:new Error(String(s)),this.isRetryableError(r)&&i<this.maxRetries){await this.delay(this.retryDelay);continue}throw new Ea(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ea(`Failed to query remote SPARQL endpoint ${e} after ${this.maxRetries+1} attempts`,r)}parseJsonResults(e){return!e.results||!Array.isArray(e.results.bindings)?[]:e.results.bindings.map(t=>this.parseBinding(t))}parseBinding(e){let t=new b9.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.parseRDFTerm(i);t.set(r,s)}return t}parseRDFTerm(e){switch(e.type){case"uri":return new Gw.IRI(e.value);case"literal":{let t=e.datatype?new Gw.IRI(e.datatype):void 0;return new S9.Literal(e.value,t,e["xml:lang"])}case"bnode":return new w9.BlankNode(e.value);default:throw new Ea(`Unknown RDF term type: ${e.type}`)}}isRetryableError(e){let t=e.message.toLowerCase();return!!(e.name==="AbortError"||t.includes("network")||t.includes("econnreset")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("returned 5"))}delay(e){return new Promise(t=>setTimeout(t,e))}};Fo.ServiceExecutor=r1});var zw=v(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.GraphExecutor=Do.GraphExecutorError=void 0;var Hw=We(),Dh=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Do.GraphExecutorError=Dh;var n1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){let i=e.name;if(i.type==="iri")yield*this.executeWithGraph(e.pattern,i,t);else if(i.type==="variable")yield*this.executeWithGraphVariable(e,i,t,r);else throw new Dh(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new Hw.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let a=i.get(t.value);if(a&&a instanceof Hw.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:a.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let a of s)for await(let c of r(e.pattern,a)){let l=c.clone();l.set(t.value,a),yield l}}};Do.GraphExecutor=n1});var Qw=v(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.SPARQLGenerator=Lo.SPARQLGeneratorError=void 0;var No=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Lo.SPARQLGeneratorError=No;var i1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
315
|
+
${r})`;default:return`${r}Unknown(${e.type})`}}tripleToString(e){return`${this.elementToString(e.subject)} ${this.predicateToString(e.predicate)} ${this.elementToString(e.object)}`}predicateToString(e){return this.isPropertyPath(e)?this.propertyPathToString(e):this.elementToString(e)}isPropertyPath(e){return e.type==="path"}propertyPathToString(e){let t=e.items.map(r=>r.type==="path"?`(${this.propertyPathToString(r)})`:`<${r.value}>`);switch(e.pathType){case"/":return t.join("/");case"|":return t.join("|");case"^":return`^${t[0]}`;case"+":return`${t[0]}+`;case"*":return`${t[0]}*`;case"?":return`${t[0]}?`}}elementToString(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":let t=`"${e.value}"`;return e.language&&(t+=`@${e.language}`),e.datatype&&(t+=`^^<${e.datatype}>`),t;case"blank":return`_:${e.value}`;default:return String(e)}}expressionToString(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value}"`:String(e.value);case"comparison":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"logical":return e.operator==="!"?`!(${this.expressionToString(e.operands[0])})`:`(${e.operands.map(t=>this.expressionToString(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.expressionToString(e.left)} ${e.operator} ${this.expressionToString(e.right)})`;case"function":return`${e.function}(${e.args.map(t=>this.expressionToString(t)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.toString(e.pattern,0)} }`;default:return"unknown"}}toJSON(e){return JSON.stringify(e,null,2)}};gh.AlgebraSerializer=Dy});var es=v(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.SolutionMapping=void 0;var ww=mt(),Ew=We(),Tw=kt(),Ny=class n{static{o(this,"SolutionMapping")}constructor(e){this.bindings=e?new Map(e):new Map}get(e){return this.bindings.get(e)}set(e,t){this.bindings.set(e,t)}has(e){return this.bindings.has(e)}variables(){return Array.from(this.bindings.keys())}getBindings(){return new Map(this.bindings)}isCompatibleWith(e){for(let[t,r]of this.bindings.entries()){let i=e.get(t);if(i!==void 0&&!this.areEqual(r,i))return!1}return!0}merge(e){if(!this.isCompatibleWith(e))return null;let t=new n(this.bindings);for(let[r,i]of e.getBindings().entries())t.set(r,i);return t}clone(){return new n(this.bindings)}areEqual(e,t){return e instanceof ww.Literal&&t instanceof ww.Literal?e.equals(t):e instanceof Ew.IRI&&t instanceof Ew.IRI?e.value===t.value:e instanceof Tw.BlankNode&&t instanceof Tw.BlankNode?e.id===t.id:!1}toJSON(){let e={};for(let[t,r]of this.bindings.entries())e[t]=r.toString();return e}size(){return this.bindings.size}};yh.SolutionMapping=Ny});var Aw=v(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.PropertyPathExecutor=wo.PropertyPathExecutorError=void 0;var oL=es(),vh=We(),xw=kt(),sl=class extends Error{static{o(this,"PropertyPathExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="PropertyPathExecutorError"}};wo.PropertyPathExecutorError=sl;var Ly=class{static{o(this,"PropertyPathExecutor")}constructor(e){this.tripleStore=e,this.MAX_DEPTH=100}async*execute(e,t,r){let i=await this.resolveElement(e),s=this.isVariable(r)?null:await this.resolveElement(r);for(let a of i){let c=await this.evaluatePath(a,t,s);for(let l of c){let u=new oL.SolutionMapping;this.isVariable(e)&&u.set(e.value,a),this.isVariable(r)&&u.set(r.value,l),yield u}}}async*executeWithBindings(e,t){if(!this.isPropertyPath(e.predicate))throw new sl("Predicate is not a property path");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.object,t);for await(let s of this.execute(r,e.predicate,i)){let a=t.merge(s);a!==null&&(yield a)}}async evaluatePath(e,t,r){switch(t.pathType){case"/":return this.evaluateSequencePath(e,t.items,r);case"|":return this.evaluateAlternativePath(e,t.items,r);case"^":return this.evaluateInversePath(e,t.items[0],r);case"+":return this.evaluateOneOrMorePath(e,t.items[0],r);case"*":return this.evaluateZeroOrMorePath(e,t.items[0],r);case"?":return this.evaluateZeroOrOnePath(e,t.items[0],r)}}async evaluateSequencePath(e,t,r){let i=new Set([e]);for(let s=0;s<t.length;s++){let a=t[s],c=s===t.length-1,l=new Set;for(let u of i){let f=await this.evaluatePathItem(u,a,c?r:null);for(let h of f)l.add(h)}if(i=l,i.size===0)break}return i}async evaluateAlternativePath(e,t,r){let i=new Set;for(let s of t){let a=await this.evaluatePathItem(e,s,r);for(let c of a)i.add(c)}return i}async evaluateInversePath(e,t,r){if(t.type==="iri"){let i=new vh.IRI(t.value),s=await this.tripleStore.match(void 0,i,e),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.subject,r))&&a.add(c.subject);return a}else return this.evaluatePath(e,this.invertPath(t),r)}async evaluateOneOrMorePath(e,t,r){let i=new Set,s=new Set,a=[{node:e,depth:0}];for(;a.length>0;){let{node:c,depth:l}=a.shift();if(l>=this.MAX_DEPTH)continue;let u=await this.evaluatePathItem(c,t,null);for(let f of u){let h=this.nodeToKey(f);(r===null||this.nodeInSet(f,r))&&s.add(f),i.has(h)||(i.add(h),a.push({node:f,depth:l+1}))}}return s}async evaluateZeroOrMorePath(e,t,r){let i=await this.evaluateOneOrMorePath(e,t,r);return(r===null||this.nodeInSet(e,r))&&i.add(e),i}async evaluateZeroOrOnePath(e,t,r){let i=new Set;(r===null||this.nodeInSet(e,r))&&i.add(e);let s=await this.evaluatePathItem(e,t,r);for(let a of s)i.add(a);return i}async evaluatePathItem(e,t,r){if(t.type==="iri"){let i=new vh.IRI(t.value),s=await this.tripleStore.match(e,i,void 0),a=new Set;for(let c of s)(r===null||this.nodeInSet(c.object,r))&&a.add(c.object);return a}else return this.evaluatePath(e,t,r)}invertPath(e){switch(e.pathType){case"^":return e.items[0];case"/":return{type:"path",pathType:"/",items:[...e.items].reverse().map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"|":return{type:"path",pathType:"|",items:e.items.map(r=>r.type==="iri"?{type:"path",pathType:"^",items:[r]}:this.invertPath(r))};case"+":case"*":case"?":let t=e.items[0].type==="iri"?{type:"path",pathType:"^",items:[e.items[0]]}:this.invertPath(e.items[0]);return{type:"path",pathType:e.pathType,items:[t]}}}async resolveElement(e){if(this.isVariable(e)){let r=new Set,i=await this.tripleStore.match(void 0,void 0,void 0);for(let s of i)r.add(s.subject),r.add(s.object);return r}let t=new Set;switch(e.type){case"iri":t.add(new vh.IRI(e.value));break;case"blank":t.add(new xw.BlankNode(e.value));break;default:throw new sl(`Unsupported element type in subject/object position: ${e.type}`)}return t}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r){if(r instanceof vh.IRI)return{type:"iri",value:r.value};if(r instanceof xw.BlankNode)return{type:"blank",value:r.id}}}return e}isVariable(e){return e.type==="variable"}isPropertyPath(e){return e.type==="path"}nodeToKey(e){return e.toString()}nodeInSet(e,t){let r=this.nodeToKey(e);for(let i of t)if(this.nodeToKey(i)===r)return!0;return!1}};wo.PropertyPathExecutor=Ly});var jy=v(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.BGPExecutor=Eo.BGPExecutorError=void 0;var _h=es(),Es=We(),ky=mt(),bh=kt(),Sh=Lc(),cL=Aw(),vr=class extends Error{static{o(this,"BGPExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="BGPExecutorError"}};Eo.BGPExecutorError=vr;var My=class{static{o(this,"BGPExecutor")}constructor(e){this.tripleStore=e,this.propertyPathExecutor=new cL.PropertyPathExecutor(e)}async*execute(e){if(e.triples.length===0){yield new _h.SolutionMapping;return}let t=this.matchTriplePattern(e.triples[0]);for(let r=1;r<e.triples.length;r++)t=this.joinWithPattern(t,e.triples[r]);for await(let r of t)yield r}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*executeInGraph(e,t){if(e.triples.length===0){yield new _h.SolutionMapping;return}let r=this.matchTriplePatternInGraph(e.triples[0],t);for(let i=1;i<e.triples.length;i++)r=this.joinWithPatternInGraph(r,e.triples[i],t);for await(let i of r)yield i}async*matchTriplePatternInGraph(e,t){if(this.isPropertyPath(e.predicate))throw new vr("Property paths within named graphs are not yet supported");let r=e.predicate,i=this.isVariable(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),s=this.isVariable(r)?void 0:this.toRDFTermAsPredicate(r),a=this.isVariable(e.object)?void 0:this.toRDFTerm(e.object);if(!this.tripleStore.matchInGraph)throw new vr("Triple store does not support named graph operations");let c=await this.tripleStore.matchInGraph(i,s,a,t);for(let l of c){let u=new _h.SolutionMapping;this.isVariable(e.subject)&&u.set(e.subject.value,l.subject),this.isVariable(r)&&u.set(r.value,l.predicate),this.isVariable(e.object)&&u.set(e.object.value,l.object),yield u}}async*joinWithPatternInGraph(e,t,r){let i=[];for await(let s of e)i.push(s);for(let s of i){let a=this.instantiatePattern(t,s);for await(let c of this.matchTriplePatternInGraph(a,r)){let l=s.merge(c);l!==null&&(yield l)}}}async*matchTriplePattern(e){if(this.isPropertyPath(e.predicate)){yield*this.propertyPathExecutor.execute(e.subject,e.predicate,e.object);return}let t=e.predicate,r=this.isVariable(e.subject)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)?void 0:this.toRDFTermAsSubject(e.subject),i=this.isVariable(t)?void 0:this.toRDFTermAsPredicate(t),s=this.isVariable(e.object)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object)?void 0:this.toRDFTerm(e.object),a=await this.tripleStore.match(r,i,s);for(let c of a){let l=new _h.SolutionMapping;if(this.isVariable(e.subject))l.set(e.subject.value,c.subject);else if(this.isQuotedTriple(e.subject)){let u=this.matchQuotedTriplePattern(e.subject,c.subject);if(u===null)continue;for(let[f,h]of u.entries())l.set(f,h)}if(this.isVariable(t)&&l.set(t.value,c.predicate),this.isVariable(e.object))l.set(e.object.value,c.object);else if(this.isQuotedTriple(e.object)){let u=this.matchQuotedTriplePattern(e.object,c.object);if(u===null)continue;for(let[f,h]of u.entries())l.set(f,h)}yield l}}hasVariablesInQuotedTriple(e){return!!(this.isVariable(e.subject)||e.predicate.type==="variable"||this.isVariable(e.object)||this.isQuotedTriple(e.subject)&&this.hasVariablesInQuotedTriple(e.subject)||this.isQuotedTriple(e.object)&&this.hasVariablesInQuotedTriple(e.object))}matchQuotedTriplePattern(e,t){if(!(t instanceof Sh.QuotedTriple))return null;let r=new Map;if(this.isVariable(e.subject))r.set(e.subject.value,t.subject);else if(this.isQuotedTriple(e.subject)){let i=this.matchQuotedTriplePattern(e.subject,t.subject);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.subject,t.subject))return null;if(e.predicate.type==="variable")r.set(e.predicate.value,t.predicate);else if(e.predicate.value!==t.predicate.value)return null;if(this.isVariable(e.object))r.set(e.object.value,t.object);else if(this.isQuotedTriple(e.object)){let i=this.matchQuotedTriplePattern(e.object,t.object);if(i===null)return null;for(let[s,a]of i)r.set(s,a)}else if(!this.elementsMatch(e.object,t.object))return null;return r}elementsMatch(e,t){switch(e.type){case"iri":return t instanceof Es.IRI&&e.value===t.value;case"literal":return!(!(t instanceof ky.Literal)||e.value!==t.value||e.datatype!==t.datatype?.value||e.language!==t.language||e.direction!==t.direction);case"blank":return t instanceof bh.BlankNode&&e.value===t.id;case"quoted":return t instanceof Sh.QuotedTriple?this.toRDFQuotedTriple(e).equals(t):!1;default:return!1}}isPropertyPath(e){return e.type==="path"}async*joinWithPattern(e,t){let r=[];for await(let i of e)r.push(i);for(let i of r){let s=this.instantiatePattern(t,i);for await(let a of this.matchTriplePattern(s)){let c=i.merge(a);c!==null&&(yield c)}}}instantiatePattern(e,t){let r=this.isPropertyPath(e.predicate)?e.predicate:this.instantiateElement(e.predicate,t);return{subject:this.instantiateElement(e.subject,t),predicate:r,object:this.instantiateElement(e.object,t)}}instantiateElement(e,t){if(this.isVariable(e)){let r=t.get(e.value);if(r)return this.toAlgebraElement(r)}return this.isQuotedTriple(e)?this.instantiateQuotedTriple(e,t):e}instantiateQuotedTriple(e,t){let r=this.instantiateElement(e.subject,t),i=e.predicate.type==="variable"?this.instantiatePredicateVariable(e.predicate,t):e.predicate,s=this.instantiateElement(e.object,t);return{type:"quoted",subject:r,predicate:i,object:s}}instantiatePredicateVariable(e,t){let r=t.get(e.value);return r&&r instanceof Es.IRI?{type:"iri",value:r.value}:e}isVariable(e){return e.type==="variable"}isQuotedTriple(e){return e.type==="quoted"}toRDFTermAsSubject(e){switch(e.type){case"iri":return new Es.IRI(e.value);case"blank":return new bh.BlankNode(e.value);case"literal":throw new vr("Literals cannot appear in subject position");case"variable":throw new vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new vr(`Unknown element type: ${e.type}`)}}toRDFQuotedTriple(e){let t=this.toRDFTermAsSubject(e.subject),r=e.predicate.type==="iri"?new Es.IRI(e.predicate.value):(()=>{throw new vr("Quoted triple predicate must be IRI")})(),i=this.toRDFTerm(e.object);return new Sh.QuotedTriple(t,r,i)}toRDFTermAsPredicate(e){switch(e.type){case"iri":return new Es.IRI(e.value);case"literal":throw new vr("Literals cannot appear in predicate position");case"blank":throw new vr("Blank nodes cannot appear in predicate position");case"variable":throw new vr(`Cannot convert variable to RDF term: ${e.value}`);default:throw new vr(`Unknown element type: ${e.type}`)}}toRDFTerm(e){switch(e.type){case"iri":return new Es.IRI(e.value);case"literal":return new ky.Literal(e.value,e.datatype?new Es.IRI(e.datatype):void 0,e.language,e.direction);case"blank":return new bh.BlankNode(e.value);case"variable":throw new vr(`Cannot convert variable to RDF term: ${e.value}`);case"quoted":return this.toRDFQuotedTriple(e);default:throw new vr(`Unknown element type: ${e.type}`)}}toAlgebraElement(e){if(e instanceof Es.IRI)return{type:"iri",value:e.value};if(e instanceof ky.Literal)return{type:"literal",value:e.value,datatype:e.datatype?.value,language:e.language,direction:e.direction};if(e instanceof bh.BlankNode)return{type:"blank",value:e.id};if(e instanceof Sh.QuotedTriple)return this.toAlgebraQuotedTriple(e);throw new vr(`Unknown RDF term type: ${e.constructor?.name||"unknown"}`)}toAlgebraQuotedTriple(e){return{type:"quoted",subject:this.toAlgebraElement(e.subject),predicate:{type:"iri",value:e.predicate.value},object:this.toAlgebraElement(e.object)}}};Eo.BGPExecutor=My});var Eh=v(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.BuiltInFunctions=void 0;var be=We(),R=mt(),Lr=kt(),To=Lc(),$y=Pr(),al=class{static{o(this,"BuiltInFunctions")}static str(e){if(e===void 0)throw new Error("STR: argument is undefined");return e instanceof be.IRI||e instanceof R.Literal?e.value:e instanceof Lr.BlankNode?e.id:String(e)}static lang(e){if(e===void 0)throw new Error("LANG: argument is undefined");return e instanceof R.Literal&&e.language?e.language:""}static langdir(e){if(e===void 0)throw new Error("LANGDIR: argument is undefined");return!(e instanceof R.Literal)||!e.language?"":e.direction?`${e.language}--${e.direction}`:e.language}static langMatches(e,t){let[r,i]=this.parseDirectionalLangTag(e),[s,a]=this.parseDirectionalLangTag(t),c=r.toLowerCase(),l=s.toLowerCase();return l==="*"?c!=="":c===""?l==="":a&&i!==a?!1:c===l?!0:c.startsWith(l+"-")}static parseDirectionalLangTag(e){let t=e.indexOf("--");if(t===-1)return[e,void 0];let r=e.substring(0,t),i=e.substring(t+2).toLowerCase();return[r,i]}static datatype(e){if(e===void 0)throw new Error("DATATYPE: argument is undefined");if(e instanceof R.Literal)return e.datatype?e.datatype:e.language?new be.IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"):new be.IRI("http://www.w3.org/2001/XMLSchema#string");throw new Error("DATATYPE: argument must be a literal")}static bound(e){return e!==void 0}static isIRI(e){return e===void 0?!1:e instanceof be.IRI}static isBlank(e){return e===void 0?!1:e instanceof Lr.BlankNode}static isLiteral(e){return e===void 0?!1:e instanceof R.Literal}static isTriple(e){return e===void 0?!1:e instanceof To.QuotedTriple}static hasLangdir(e){return e===void 0||!(e instanceof R.Literal)?!1:!!e.language&&!!e.direction}static isNumeric(e){if(e===void 0||!(e instanceof R.Literal))return!1;let t=e.datatype?.value;return t?["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float","http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedShort","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#positiveInteger"].includes(t):!1}static regex(e,t,r){try{let i=r?r.includes("u")?r:r+"u":"u";return new RegExp(t,i).test(e)}catch(i){throw new Error(`REGEX: invalid pattern '${t}': ${i.message}`)}}static compare(e,t,r){if(this.isDayTimeDurationValue(e)&&this.isDayTimeDurationValue(t))return this.compareDurations(e instanceof R.Literal?e:String(e),t instanceof R.Literal?t:String(t),r);if(this.isDayTimeDurationValue(e)&&typeof t=="string"&&/^-?P/.test(t))return this.compareDurations(e instanceof R.Literal?e:String(e),t,r);if(typeof e=="string"&&/^-?P/.test(e)&&this.isDayTimeDurationValue(t))return this.compareDurations(e,t instanceof R.Literal?t:String(t),r);let i=this.toComparableValue(e),s=this.toComparableValue(t);switch(r){case"=":return i===s;case"!=":return i!==s;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:throw new Error(`Unknown comparison operator: ${r}`)}}static isDayTimeDurationValue(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static toComparableValue(e){if(typeof e=="string"||typeof e=="number")return e;if(e instanceof R.Literal){let t=e.datatype?.value;if(t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double")){let r=parseFloat(e.value);if(!isNaN(r))return r}if(t==="http://www.w3.org/2001/XMLSchema#dayTimeDuration")try{return this.parseDayTimeDuration(e.value)}catch{return e.value}return e.value}return e instanceof be.IRI?e.value:e instanceof Lr.BlankNode?e.id:String(e)}static contains(e,t){return e.includes(t)}static strStarts(e,t){return e.startsWith(t)}static strEnds(e,t){return e.endsWith(t)}static strlen(e){return e.length}static ucase(e){return e.toUpperCase()}static lcase(e){return e.toLowerCase()}static substr(e,t,r){let i=t-1;if(i<0){if(r!==void 0){let s=r+i;return s<=0?"":e.substring(0,s)}return e}return r!==void 0?e.substring(i,i+r):e.substring(i)}static strBefore(e,t){if(t==="")return"";let r=e.indexOf(t);return r===-1?"":e.substring(0,r)}static strAfter(e,t){if(t==="")return e;let r=e.indexOf(t);return r===-1?"":e.substring(r+t.length)}static concat(...e){return e.join("")}static replace(e,t,r,i){try{let s=i||"g",a=s.includes("u")?s:s+"u",c=new RegExp(t,a);return e.replace(c,r)}catch(s){throw new Error(`REPLACE: invalid pattern '${t}': ${s.message}`)}}static parseDate(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`PARSEDATE: invalid date string '${e}'`);return t.getTime()}static dateBefore(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r<i}static dateAfter(e,t){let r=this.parseDate(e),i=this.parseDate(t);return r>i}static dateInRange(e,t,r){let i=this.parseDate(e),s=this.parseDate(t),a=this.parseDate(r);return i>=s&&i<=a}static dateDiffMinutes(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60))}static dateDiffHours(e,t){let r=this.parseDate(e),i=this.parseDate(t),s=Math.abs(i-r);return Math.round(s/(1e3*60*60)*100)/100}static logicalAnd(e){return e.every(t=>t===!0)}static logicalOr(e){return e.some(t=>t===!0)}static logicalNot(e){return!e}static year(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`YEAR: invalid date string '${e}'`);return t.getFullYear()}static month(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MONTH: invalid date string '${e}'`);return t.getMonth()+1}static day(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`DAY: invalid date string '${e}'`);return t.getDate()}static hours(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`HOURS: invalid date string '${e}'`);return t.getHours()}static minutes(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`MINUTES: invalid date string '${e}'`);return t.getMinutes()}static seconds(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`SECONDS: invalid date string '${e}'`);return t.getSeconds()+t.getMilliseconds()/1e3}static timezone(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TIMEZONE: invalid date string '${e}'`);let r;if(e.endsWith("Z"))r="PT0S";else{let i=e.match(/([+-]\d{2}):?(\d{2})$/);if(i){let s=parseInt(i[1],10),a=parseInt(i[2],10),c=s>=0?"":"-",l=Math.abs(s);a===0?r=`${c}PT${l}H`:r=`${c}PT${l}H${a}M`}else{let s=-t.getTimezoneOffset(),a=Math.floor(Math.abs(s)/60),c=Math.abs(s)%60,l=s>=0?"":"-";c===0?r=`${l}PT${a}H`:r=`${l}PT${a}H${c}M`}}return new R.Literal(r,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static tz(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`TZ: invalid date string '${e}'`);if(e.endsWith("Z"))return"Z";let r=e.match(/([+-]\d{2}:\d{2})$/);if(r)return r[1];let i=e.match(/([+-])(\d{2})(\d{2})$/);return i?`${i[1]}${i[2]}:${i[3]}`:""}static now(){return new Date().toISOString()}static msToMinutes(e){return Math.round(e/(1e3*60))}static msToHours(e){return Math.round(e/(1e3*60*60)*100)/100}static msToSeconds(e){return Math.round(e/1e3)}static abs(e){return Math.abs(e)}static round(e){return Math.round(e)}static ceil(e){return Math.ceil(e)}static floor(e){return Math.floor(e)}static rand(){return Math.random()}static coalesce(e){for(let t of e)if(t!=null)return t}static if(e,t,r){return e?t:r}static xsdDateTime(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`xsd:dateTime: invalid date string '${e}'`);return new R.Literal(t.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static xsdInteger(e){let t=parseInt(e,10);if(isNaN(t))throw new Error(`xsd:integer: cannot convert '${e}' to integer`);return new R.Literal(String(t),new be.IRI("http://www.w3.org/2001/XMLSchema#integer"))}static xsdDecimal(e){let t=parseFloat(e);if(isNaN(t))throw new Error(`xsd:decimal: cannot convert '${e}' to decimal`);return new R.Literal(String(t),new be.IRI("http://www.w3.org/2001/XMLSchema#decimal"))}static encodeForUri(e){return encodeURIComponent(e)}static md5(e){return require("crypto").createHash("md5").update(e).digest("hex")}static sha1(e){return require("crypto").createHash("sha1").update(e).digest("hex")}static sha256(e){return require("crypto").createHash("sha256").update(e).digest("hex")}static sha384(e){return require("crypto").createHash("sha384").update(e).digest("hex")}static sha512(e){return require("crypto").createHash("sha512").update(e).digest("hex")}static sameTerm(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0||e.constructor!==t.constructor)return!1;if(e instanceof be.IRI&&t instanceof be.IRI)return e.value===t.value;if(e instanceof Lr.BlankNode&&t instanceof Lr.BlankNode)return e.id===t.id;if(e instanceof R.Literal&&t instanceof R.Literal){if(e.value!==t.value||e.language!==t.language)return!1;let r=e.datatype?.value,i=t.datatype?.value;return r===i}return!1}static iri(e){if(e===void 0)throw new Error("IRI: argument is undefined");if(e instanceof be.IRI)return e;if(e instanceof R.Literal)return new be.IRI(e.value);throw e instanceof Lr.BlankNode?new Error("IRI: cannot convert blank node to IRI"):new Error("IRI: unsupported term type")}static uri(e){return this.iri(e)}static bnode(e){if(e===void 0){let t=`b${(0,$y.v4)().replace(/-/g,"").substring(0,12)}`;return new Lr.BlankNode(t)}if(e instanceof R.Literal)return new Lr.BlankNode(e.value);if(e instanceof Lr.BlankNode)return e;throw new Error("BNODE: argument must be a string literal or omitted")}static strdt(e,t){if(e===void 0)throw new Error("STRDT: lexical form is undefined");if(t===void 0)throw new Error("STRDT: datatype IRI is undefined");let r;if(e instanceof R.Literal){if(e.language)throw new Error("STRDT: lexical form must not have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRDT: lexical form must be a string literal");let i;if(t instanceof be.IRI)i=t;else if(t instanceof R.Literal)i=new be.IRI(t.value);else throw new Error("STRDT: datatype must be an IRI");return new R.Literal(r,i)}static strlang(e,t){if(e===void 0)throw new Error("STRLANG: lexical form is undefined");if(t===void 0)throw new Error("STRLANG: language tag is undefined");let r;if(e instanceof R.Literal){if(e.language)throw new Error("STRLANG: lexical form must not already have a language tag");r=e.value}else if(typeof e=="string")r=e;else throw new Error("STRLANG: lexical form must be a string literal");let i;if(t instanceof R.Literal)i=t.value;else if(typeof t=="string")i=t;else throw new Error("STRLANG: language tag must be a string literal");if(i==="")throw new Error("STRLANG: language tag cannot be empty");return new R.Literal(r,void 0,i)}static strlangdir(e,t,r){if(e===void 0)throw new Error("STRLANGDIR: lexical form is undefined");if(t===void 0)throw new Error("STRLANGDIR: language tag is undefined");if(r===void 0)throw new Error("STRLANGDIR: direction is undefined");let i;if(e instanceof R.Literal){if(e.language)throw new Error("STRLANGDIR: lexical form must not already have a language tag");i=e.value}else if(typeof e=="string")i=e;else throw new Error("STRLANGDIR: lexical form must be a string literal");let s;if(t instanceof R.Literal)s=t.value;else if(typeof t=="string")s=t;else throw new Error("STRLANGDIR: language tag must be a string literal");if(s==="")throw new Error("STRLANGDIR: language tag cannot be empty");let a;if(r instanceof R.Literal)a=r.value.toLowerCase();else throw new Error("STRLANGDIR: direction must be a string literal");if(a!=="ltr"&&a!=="rtl")throw new Error(`STRLANGDIR: invalid direction '${a}'. Must be 'ltr' or 'rtl'`);return new R.Literal(i,void 0,s,a)}static uuid(){let e=(0,$y.v4)();return new be.IRI(`urn:uuid:${e}`)}static struuid(){let e=(0,$y.v4)();return new R.Literal(e)}static parseDayTimeDuration(e){if(!e)throw new Error("parseDayTimeDuration: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDayTimeDuration: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=r.indexOf("T"),a="",c="";if(s===-1?a=r:(a=r.substring(0,s),c=r.substring(s+1)),a){let l=a.match(/^(\d+(?:\.\d+)?)D$/);if(l){let u=parseFloat(l[1]);i+=u*24*60*60*1e3}else if(a!=="")throw new Error(`parseDayTimeDuration: invalid day component: '${a}' in '${e}'`)}if(c){let l=c,u=l.match(/^(\d+(?:\.\d+)?)H/);if(u){let d=parseFloat(u[1]);i+=d*60*60*1e3,l=l.substring(u[0].length)}let f=l.match(/^(\d+(?:\.\d+)?)M/);if(f){let d=parseFloat(f[1]);i+=d*60*1e3,l=l.substring(f[0].length)}let h=l.match(/^(\d+(?:\.\d+)?)S$/);if(h){let d=parseFloat(h[1]);i+=d*1e3,l=l.substring(h[0].length)}if(l!=="")throw new Error(`parseDayTimeDuration: invalid time component: '${l}' in '${e}'`)}return t?-i:i}static formatDayTimeDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/(1440*60*1e3));r=r%(1440*60*1e3);let s=Math.floor(r/(3600*1e3));r=r%(3600*1e3);let a=Math.floor(r/(60*1e3));r=r%(60*1e3);let c=r/1e3,l=t?"-P":"P";return i>0&&(l+=`${i}D`),(s>0||a>0||c>0||i===0)&&(l+="T",s>0&&(l+=`${s}H`),a>0&&(l+=`${a}M`),(c>0||s===0&&a===0)&&(Number.isInteger(c)?l+=`${c}S`:l+=`${parseFloat(c.toFixed(3))}S`)),l}static xsdDayTimeDuration(e){return this.parseDayTimeDuration(e),new R.Literal(e,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static compareDurations(e,t,r){let i=e instanceof R.Literal?e.value:e,s=t instanceof R.Literal?t.value:t,a=this.parseDayTimeDuration(i),c=this.parseDayTimeDuration(s);switch(r){case"=":return a===c;case"!=":return a!==c;case"<":return a<c;case">":return a>c;case"<=":return a<=c;case">=":return a>=c;default:throw new Error(`compareDurations: unknown operator: ${r}`)}}static isDayTimeDuration(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}static isDate(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}static dateDiff(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r),a=this.parseXSDDate(i);if(s===null)throw new Error(`dateDiff: invalid first date: '${r}'`);if(a===null)throw new Error(`dateDiff: invalid second date: '${i}'`);let c=s.getTime()-a.getTime(),l=Math.round(c/(1440*60*1e3)),u=this.formatDateDuration(l);return new R.Literal(u,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDDate(e){let t=/^(-?\d{4})-(\d{2})-(\d{2})(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r){let u=new Date(e);return isNaN(u.getTime())?null:new Date(Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()))}let i=parseInt(r[1],10),s=parseInt(r[2],10)-1,a=parseInt(r[3],10),c=r[4],l=new Date(Date.UTC(i,s,a));if(c&&c!=="Z"){let u=c.match(/([+-])(\d{2}):(\d{2})/);if(u){let f=u[1]==="+"?1:-1,h=parseInt(u[2],10),d=parseInt(u[3],10),p=f*(h*60+d)*60*1e3;l=new Date(l.getTime()-p)}}return l}static formatDateDuration(e){if(e===0)return"P0D";let t=e<0,r=Math.abs(e);return t?`-P${r}D`:`P${r}D`}static dateTimeDiff(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r),a=new Date(i);if(isNaN(s.getTime()))throw new Error(`dateTimeDiff: invalid first dateTime: '${r}'`);if(isNaN(a.getTime()))throw new Error(`dateTimeDiff: invalid second dateTime: '${i}'`);let c=s.getTime()-a.getTime(),l=this.formatDayTimeDuration(c);return new R.Literal(l,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static dateTimeAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAdd: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c);return new R.Literal(l.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtract: invalid dateTime: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c);return new R.Literal(l.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAdd: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()+a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new R.Literal(d,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtract: invalid date: '${r}'`);let a=this.parseDayTimeDuration(i),c=s.getTime()-a,l=new Date(c),u=l.getUTCFullYear(),f=String(l.getUTCMonth()+1).padStart(2,"0"),h=String(l.getUTCDate()).padStart(2,"0"),d=`${u}-${f}-${h}`;return new R.Literal(d,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static parseYearMonthDuration(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDuration: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDuration: invalid format (no duration components): '${e}'`);let c=s*12+a;return i?-c:c}static isYearMonthDuration(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}static dateTimeAddYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeAddYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0),new R.Literal(s.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateTimeSubtractYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=new Date(r);if(isNaN(s.getTime()))throw new Error(`dateTimeSubtractYearMonth: invalid dateTime: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();return s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0),new R.Literal(s.toISOString(),new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static dateAddYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateAddYearMonth: invalid date: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()+a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),h=`${l}-${u}-${f}`;return new R.Literal(h,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static dateSubtractYearMonth(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDDate(r);if(s===null)throw new Error(`dateSubtractYearMonth: invalid date: '${r}'`);let a=this.parseYearMonthDuration(i),c=s.getUTCDate();s.setUTCMonth(s.getUTCMonth()-a),s.getUTCDate()!==c&&s.setUTCDate(0);let l=s.getUTCFullYear(),u=String(s.getUTCMonth()+1).padStart(2,"0"),f=String(s.getUTCDate()).padStart(2,"0"),h=`${l}-${u}-${f}`;return new R.Literal(h,new be.IRI("http://www.w3.org/2001/XMLSchema#date"))}static durationAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s+a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseDayTimeDuration(r),a=this.parseDayTimeDuration(i),c=this.formatDayTimeDuration(s-a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationMultiply(e,t){let r=e instanceof R.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i*t);return new R.Literal(s,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static durationDivide(e,t){if(t===0)throw new Error("durationDivide: division by zero");let r=e instanceof R.Literal?e.value:e,i=this.parseDayTimeDuration(r),s=this.formatDayTimeDuration(i/t);return new R.Literal(s,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static formatYearMonthDuration(e){let t=e<0,r=Math.abs(e),i=Math.floor(r/12),s=r%12,a=t?"-P":"P";return i>0&&(a+=`${i}Y`),(s>0||i===0)&&(a+=`${s}M`),a}static yearMonthDurationAdd(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s+a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static yearMonthDurationSubtract(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseYearMonthDuration(r),a=this.parseYearMonthDuration(i),c=this.formatYearMonthDuration(s-a);return new R.Literal(c,new be.IRI("http://www.w3.org/2001/XMLSchema#yearMonthDuration"))}static parseYearMonthDurationComponents(e){let t=/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?$/,r=e.match(t);if(!r)throw new Error(`parseYearMonthDurationComponents: invalid format: '${e}'`);let i=r[1]==="-",s=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10);if(!r[2]&&!r[3])throw new Error(`parseYearMonthDurationComponents: invalid format (no duration components): '${e}'`);return{years:s,months:a,negative:i}}static durationYears(e){let t=e instanceof R.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.years:r.years}static durationMonths(e){let t=e instanceof R.Literal?e.value:e,r=this.parseYearMonthDurationComponents(t);return r.negative?-r.months:r.months}static durationToDays(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/(1440*60*1e3)}static durationToHours(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/(3600*1e3)}static durationToMinutes(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/(60*1e3)}static durationToSeconds(e){let t=e instanceof R.Literal?e.value:e;return this.parseDayTimeDuration(t)/1e3}static parseDurationComponents(e){if(!e)throw new Error("parseDurationComponents: duration string is empty");let t=!1,r=e.trim();if(r.startsWith("-")&&(t=!0,r=r.substring(1)),!r.startsWith("P"))throw new Error(`parseDurationComponents: invalid format, must start with 'P': '${e}'`);r=r.substring(1);let i=0,s=0,a=0,c=0,l=r.indexOf("T"),u="",f="";if(l===-1?u=r:(u=r.substring(0,l),f=r.substring(l+1)),u){let h=u.match(/^(\d+(?:\.\d+)?)D$/);if(h)i=parseFloat(h[1]);else if(u!=="")throw new Error(`parseDurationComponents: invalid day component: '${u}' in '${e}'`)}if(f){let h=f,d=h.match(/^(\d+(?:\.\d+)?)H/);d&&(s=parseFloat(d[1]),h=h.substring(d[0].length));let p=h.match(/^(\d+(?:\.\d+)?)M/);p&&(a=parseFloat(p[1]),h=h.substring(p[0].length));let _=h.match(/^(\d+(?:\.\d+)?)S$/);if(_&&(c=parseFloat(_[1]),h=h.substring(_[0].length)),h!=="")throw new Error(`parseDurationComponents: invalid time component: '${h}' in '${e}'`)}return{negative:t,days:i,hours:s,minutes:a,seconds:c}}static durationDays(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.days);return r.negative?-i:i}static durationHours(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.hours);return r.negative?-i:i}static durationMinutes(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t),i=Math.floor(r.minutes);return r.negative?-i:i}static durationSeconds(e){let t=e instanceof R.Literal?e.value:e,r=this.parseDurationComponents(t);return r.negative?-r.seconds:r.seconds}static adjust(e,t){let r=e instanceof R.Literal?e.value:e,i=new Date(r);if(isNaN(i.getTime()))throw new Error(`ADJUST: invalid dateTime: '${r}'`);if(t==null){let H=i.getUTCFullYear(),ee=String(i.getUTCMonth()+1).padStart(2,"0"),Se=String(i.getUTCDate()).padStart(2,"0"),L=String(i.getUTCHours()).padStart(2,"0"),Y=String(i.getUTCMinutes()).padStart(2,"0"),ge=String(i.getUTCSeconds()).padStart(2,"0"),dt=i.getUTCMilliseconds(),nt=`${H}-${ee}-${Se}T${L}:${Y}:${ge}`;return dt>0&&(nt+=`.${String(dt).padStart(3,"0")}`),new R.Literal(nt,new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}let s=t instanceof R.Literal?t.value:t,a=this.parseDayTimeDuration(s),c=840*60*1e3;if(Math.abs(a)>c)throw new Error(`ADJUST: timezone offset out of range: '${s}'`);let l=i.getTime(),u=new Date(l+a),f=u.getUTCFullYear(),h=String(u.getUTCMonth()+1).padStart(2,"0"),d=String(u.getUTCDate()).padStart(2,"0"),p=String(u.getUTCHours()).padStart(2,"0"),_=String(u.getUTCMinutes()).padStart(2,"0"),b=String(u.getUTCSeconds()).padStart(2,"0"),E=u.getUTCMilliseconds(),A=a>=0?"+":"-",C=Math.floor(Math.abs(a)/(3600*1e3)),j=Math.floor(Math.abs(a)%(3600*1e3)/(60*1e3)),G=`${A}${String(C).padStart(2,"0")}:${String(j).padStart(2,"0")}`,Q=`${f}-${h}-${d}T${p}:${_}:${b}`;return E>0&&(Q+=`.${String(E).padStart(3,"0")}`),Q+=G,new R.Literal(Q,new be.IRI("http://www.w3.org/2001/XMLSchema#dateTime"))}static normalize(e,t){if(e===void 0)throw new Error("NORMALIZE: string argument is undefined");let r;if(e instanceof R.Literal)r=e.value;else if(e instanceof be.IRI)r=e.value;else if(e instanceof Lr.BlankNode)r=e.id;else if(typeof e=="string")r=e;else throw new Error("NORMALIZE: first argument must be a string or literal");let i="NFC";if(t!==void 0)if(t instanceof R.Literal)i=t.value.toUpperCase();else if(typeof t=="string")i=t.toUpperCase();else if(t instanceof be.IRI)i=t.value.toUpperCase();else throw new Error("NORMALIZE: second argument must be a string literal");if(!this.VALID_NORMALIZATION_FORMS.includes(i))throw new Error(`NORMALIZE: invalid normalization form '${i}'. Valid forms are: NFC, NFD, NFKC, NFKD`);let s=r.normalize(i);return new R.Literal(s,new be.IRI("http://www.w3.org/2001/XMLSchema#string"))}static fold(e){if(e===void 0)throw new Error("FOLD: string argument is undefined");let t;if(e instanceof R.Literal)t=e.value;else if(e instanceof be.IRI)t=e.value;else if(e instanceof Lr.BlankNode)t=e.id;else if(typeof e=="string")t=e;else throw new Error("FOLD: argument must be a string or literal");let r=this.unicodeCaseFold(t);return new R.Literal(r,new be.IRI("http://www.w3.org/2001/XMLSchema#string"))}static unicodeCaseFold(e){let t="";for(let r of e){let i=this.CASE_FOLDING_MAP.get(r);i!==void 0?t+=i:t+=r.toLowerCase()}return t}static isTime(e){return e instanceof R.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}static timeDiff(e,t){let r=e instanceof R.Literal?e.value:e,i=t instanceof R.Literal?t.value:t,s=this.parseXSDTime(r),a=this.parseXSDTime(i);if(s===null)throw new Error(`timeDiff: invalid first time: '${r}'`);if(a===null)throw new Error(`timeDiff: invalid second time: '${i}'`);let c=s-a,l=this.formatDayTimeDuration(c);return new R.Literal(l,new be.IRI("http://www.w3.org/2001/XMLSchema#dayTimeDuration"))}static parseXSDTime(e){let t=/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:\d{2})?$/,r=e.match(t);if(!r)return null;let i=parseInt(r[1],10),s=parseInt(r[2],10),a=parseInt(r[3],10),c=r[4],l=r[5];if(i<0||i>24||s<0||s>59||a<0||a>59||i===24&&(s!==0||a!==0))return null;let u=0;if(c){let h=c.padEnd(3,"0").slice(0,3);u=parseInt(h,10)}let f=i*60*60*1e3+s*60*1e3+a*1e3+u;if(i===24&&(f=1440*60*1e3),l&&l!=="Z"){let h=l.match(/([+-])(\d{2}):(\d{2})/);if(h){let d=h[1]==="+"?1:-1,p=parseInt(h[2],10),_=parseInt(h[3],10),b=d*(p*60+_)*60*1e3;f-=b}}return f}static triple(e,t,r){if(e===void 0)throw new Error("TRIPLE: subject is undefined");if(t===void 0)throw new Error("TRIPLE: predicate is undefined");if(r===void 0)throw new Error("TRIPLE: object is undefined");if(e instanceof R.Literal)throw new Error("TRIPLE: subject must be IRI, BlankNode, or QuotedTriple, got Literal");if(!(t instanceof be.IRI)){let c=t instanceof R.Literal?"Literal":t instanceof Lr.BlankNode?"BlankNode":t instanceof To.QuotedTriple?"QuotedTriple":typeof t;throw new Error(`TRIPLE: predicate must be IRI, got ${c}`)}let i=e,s=t,a=r;return new To.QuotedTriple(i,s,a)}static subject(e){if(e===void 0)throw new Error("SUBJECT: argument is undefined");if(!(e instanceof To.QuotedTriple)){let t=e instanceof be.IRI?"IRI":e instanceof R.Literal?"Literal":e instanceof Lr.BlankNode?"BlankNode":typeof e;throw new Error(`SUBJECT: argument must be QuotedTriple, got ${t}`)}return e.subject}static predicate(e){if(e===void 0)throw new Error("PREDICATE: argument is undefined");if(!(e instanceof To.QuotedTriple)){let t=e instanceof be.IRI?"IRI":e instanceof R.Literal?"Literal":e instanceof Lr.BlankNode?"BlankNode":typeof e;throw new Error(`PREDICATE: argument must be QuotedTriple, got ${t}`)}return e.predicate}static object(e){if(e===void 0)throw new Error("OBJECT: argument is undefined");if(!(e instanceof To.QuotedTriple)){let t=e instanceof be.IRI?"IRI":e instanceof R.Literal?"Literal":e instanceof Lr.BlankNode?"BlankNode":typeof e;throw new Error(`OBJECT: argument must be QuotedTriple, got ${t}`)}return e.object}};wh.BuiltInFunctions=al;al.VALID_NORMALIZATION_FORMS=["NFC","NFD","NFKC","NFKD"];al.CASE_FOLDING_MAP=new Map([["\xDF","ss"],["\u1E9E","ss"],["\u03A3","\u03C3"],["\u03C2","\u03C3"],["\u0130","i\u0307"],["I","i"],["\u0587","\u0565\u0582"],["\uFB00","ff"],["\uFB01","fi"],["\uFB02","fl"],["\uFB03","ffi"],["\uFB04","ffl"],["\uFB05","st"],["\uFB06","st"],["\u0390","\u03B9\u0308\u0301"],["\u03B0","\u03C5\u0308\u0301"],["\u017F","s"],["\u1E9B","\u1E61"],["\u212A","k"],["\u212B","\xE5"]])});var Lw=v(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.functionHandlers=void 0;var N=Eh();k.functionHandlers=new Map;k.functionHandlers.set("str",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.str(t)});k.functionHandlers.set("lang",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.lang(t)});k.functionHandlers.set("langmatches",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.langMatches(t,r)});k.functionHandlers.set("contains",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.contains(t,r)});k.functionHandlers.set("strstarts",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.strStarts(t,r)});k.functionHandlers.set("strends",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.strEnds(t,r)});k.functionHandlers.set("strlen",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.strlen(t)});k.functionHandlers.set("ucase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.ucase(t)});k.functionHandlers.set("lcase",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.lcase(t)});k.functionHandlers.set("substr",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=Number(e.evaluateExpression(n[1],e.solution));if(n[2]){let i=Number(e.evaluateExpression(n[2],e.solution));return N.BuiltInFunctions.substr(t,r,i)}return N.BuiltInFunctions.substr(t,r)});k.functionHandlers.set("strbefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.strBefore(t,r)});k.functionHandlers.set("strafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.strAfter(t,r)});k.functionHandlers.set("concat",(n,e)=>{let t=n.map(r=>e.getStringValue(e.evaluateExpression(r,e.solution)));return N.BuiltInFunctions.concat(...t)});k.functionHandlers.set("replace",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution)),s=n[3]?e.getStringValue(e.evaluateExpression(n[3],e.solution)):void 0;return N.BuiltInFunctions.replace(t,r,i,s)});k.functionHandlers.set("regex",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=n[2]?e.getStringValue(e.evaluateExpression(n[2],e.solution)):void 0;return N.BuiltInFunctions.regex(t,r,i)});k.functionHandlers.set("encode_for_uri",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.encodeForUri(t)});k.functionHandlers.set("datatype",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.datatype(t).value});k.functionHandlers.set("bound",(n,e)=>{let t=n[0];if(t.type==="variable"&&t.name){let r=e.solution.get(t.name);return N.BuiltInFunctions.bound(r)}return!0});var Cw=o((n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.isIRI(t)},"isIriHandler");k.functionHandlers.set("isiri",Cw);k.functionHandlers.set("isuri",Cw);k.functionHandlers.set("isblank",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.isBlank(t)});k.functionHandlers.set("isliteral",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.isLiteral(t)});k.functionHandlers.set("isnumeric",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.isNumeric(t)});k.functionHandlers.set("haslangdir",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.hasLangdir(t)});k.functionHandlers.set("istriple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.isTriple(t)});k.functionHandlers.set("sameterm",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution);return N.BuiltInFunctions.sameTerm(t,r)});k.functionHandlers.set("abs",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return N.BuiltInFunctions.abs(t)});k.functionHandlers.set("round",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return N.BuiltInFunctions.round(t)});k.functionHandlers.set("ceil",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return N.BuiltInFunctions.ceil(t)});k.functionHandlers.set("floor",(n,e)=>{let t=Number(e.getStringValue(e.evaluateExpression(n[0],e.solution)));return N.BuiltInFunctions.floor(t)});k.functionHandlers.set("rand",()=>N.BuiltInFunctions.rand());k.functionHandlers.set("parsedate",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.parseDate(t)});k.functionHandlers.set("datebefore",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.dateBefore(t,r)});k.functionHandlers.set("dateafter",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.dateAfter(t,r)});k.functionHandlers.set("dateinrange",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution)),i=e.getStringValue(e.evaluateExpression(n[2],e.solution));return N.BuiltInFunctions.dateInRange(t,r,i)});k.functionHandlers.set("datediffminutes",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.dateDiffMinutes(t,r)});k.functionHandlers.set("datediffhours",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution)),r=e.getStringValue(e.evaluateExpression(n[1],e.solution));return N.BuiltInFunctions.dateDiffHours(t,r)});var xo=o((n,e,t)=>(r,i)=>{let s=i.evaluateExpression(r[0],i.solution);return e&&i.isYearMonthDurationValue(s)?e(s):t&&i.isDayTimeDurationValue(s)?t(s):n(i.getStringValue(s))},"createDateTimeAccessor"),Iw=xo(N.BuiltInFunctions.year.bind(N.BuiltInFunctions),N.BuiltInFunctions.durationYears.bind(N.BuiltInFunctions),null);k.functionHandlers.set("year",Iw);k.functionHandlers.set("years",Iw);var Ow=xo(N.BuiltInFunctions.month.bind(N.BuiltInFunctions),N.BuiltInFunctions.durationMonths.bind(N.BuiltInFunctions),null);k.functionHandlers.set("month",Ow);k.functionHandlers.set("months",Ow);var Pw=xo(N.BuiltInFunctions.day.bind(N.BuiltInFunctions),null,N.BuiltInFunctions.durationDays.bind(N.BuiltInFunctions));k.functionHandlers.set("day",Pw);k.functionHandlers.set("days",Pw);k.functionHandlers.set("hours",xo(N.BuiltInFunctions.hours.bind(N.BuiltInFunctions),null,N.BuiltInFunctions.durationHours.bind(N.BuiltInFunctions)));k.functionHandlers.set("minutes",xo(N.BuiltInFunctions.minutes.bind(N.BuiltInFunctions),null,N.BuiltInFunctions.durationMinutes.bind(N.BuiltInFunctions)));k.functionHandlers.set("seconds",xo(N.BuiltInFunctions.seconds.bind(N.BuiltInFunctions),null,N.BuiltInFunctions.durationSeconds.bind(N.BuiltInFunctions)));k.functionHandlers.set("timezone",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.timezone(t)});k.functionHandlers.set("tz",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.tz(t)});k.functionHandlers.set("adjust",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=n.length>1?e.evaluateExpression(n[1],e.solution):void 0;return N.BuiltInFunctions.adjust(t,r)});k.functionHandlers.set("now",()=>N.BuiltInFunctions.now());var Rw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.xsdDateTime(e.getStringValue(t))},"dateTimeHandler");k.functionHandlers.set("datetime",Rw);k.functionHandlers.set("xsd:datetime",Rw);var Fw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.xsdInteger(e.getStringValue(t))},"integerHandler");k.functionHandlers.set("integer",Fw);k.functionHandlers.set("xsd:integer",Fw);var Dw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.xsdDecimal(e.getStringValue(t))},"decimalHandler");k.functionHandlers.set("decimal",Dw);k.functionHandlers.set("xsd:decimal",Dw);var Nw=o((n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.xsdDayTimeDuration(e.getStringValue(t))},"dayTimeDurationHandler");k.functionHandlers.set("daytimeduration",Nw);k.functionHandlers.set("xsd:daytimeduration",Nw);k.functionHandlers.set("durationtodays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationToDays(t)});k.functionHandlers.set("durationtohours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationToHours(t)});k.functionHandlers.set("durationtominutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationToMinutes(t)});k.functionHandlers.set("durationtoseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationToSeconds(t)});k.functionHandlers.set("durationdays",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationDays(t)});k.functionHandlers.set("durationhours",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationHours(t)});k.functionHandlers.set("durationminutes",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationMinutes(t)});k.functionHandlers.set("durationseconds",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationSeconds(t)});k.functionHandlers.set("durationyears",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationYears(t)});k.functionHandlers.set("durationmonths",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution);return N.BuiltInFunctions.durationMonths(t)});k.functionHandlers.set("datetimediff",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return N.BuiltInFunctions.dateTimeDiff(t,r)});k.functionHandlers.set("datetimeadd",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return N.BuiltInFunctions.dateTimeAdd(t,r)});k.functionHandlers.set("datetimesubtract",(n,e)=>{let t=e.evaluateExpression(n[0],e.solution),r=e.evaluateExpression(n[1],e.solution);return N.BuiltInFunctions.dateTimeSubtract(t,r)});k.functionHandlers.set("mstominutes",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.msToMinutes(t)});k.functionHandlers.set("mstohours",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.msToHours(t)});k.functionHandlers.set("mstoseconds",(n,e)=>{let t=Number(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.msToSeconds(t)});k.functionHandlers.set("md5",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.md5(t)});k.functionHandlers.set("sha1",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.sha1(t)});k.functionHandlers.set("sha256",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.sha256(t)});k.functionHandlers.set("sha384",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.sha384(t)});k.functionHandlers.set("sha512",(n,e)=>{let t=e.getStringValue(e.evaluateExpression(n[0],e.solution));return N.BuiltInFunctions.sha512(t)});k.functionHandlers.set("subject",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.subject(t)});k.functionHandlers.set("predicate",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.predicate(t)});k.functionHandlers.set("object",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution);return N.BuiltInFunctions.object(t)});k.functionHandlers.set("triple",(n,e)=>{let t=e.getTermFromExpression(n[0],e.solution),r=e.getTermFromExpression(n[1],e.solution),i=e.getTermFromExpression(n[2],e.solution);return N.BuiltInFunctions.triple(t,r,i)})});var Th=v(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.FilterExecutor=Ao.FilterExecutorError=void 0;var ft=Eh(),lL=Lw(),va=mt(),sr=class extends Error{static{o(this,"FilterExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="FilterExecutorError"}};Ao.FilterExecutorError=sr;var Vy=class{static{o(this,"FilterExecutor")}constructor(){this.existsEvaluator=null,this.tripleStore=null,this.uuidCache=new Map}setExistsEvaluator(e){this.existsEvaluator=e}setTripleStore(e){this.tripleStore=e,this.uuidCache.clear()}async*execute(e,t){let r=this.expressionContainsExists(e.expression);for await(let i of t)try{let s;r?s=await this.evaluateExpressionAsync(e.expression,i):s=this.evaluateExpression(e.expression,i),s===!0&&(yield i)}catch{continue}}expressionContainsExists(e){if(e.type==="exists")return!0;if(e.type==="logical")return e.operands.some(t=>this.expressionContainsExists(t));if(e.type==="comparison")return this.expressionContainsExists(e.left)||this.expressionContainsExists(e.right);if(e.type==="in"){let t=e;return this.expressionContainsExists(t.expression)||t.list.some(r=>this.expressionContainsExists(r))}return!1}async executeAll(e,t){let r=[];async function*i(){for(let s of t)yield s}o(i,"generator");for await(let s of this.execute(e,i()))r.push(s);return r}evaluateExpression(e,t){let r=e;if(r.termType)switch(r.termType){case"Variable":return t.get(r.value);case"Literal":return r.value;case"NamedNode":return r.value;default:throw new sr(`Unsupported termType: ${r.termType}`)}switch(e.type){case"comparison":return this.evaluateComparison(e,t);case"logical":return this.evaluateLogical(e,t);case"arithmetic":return this.evaluateArithmetic(e,t);case"function":case"functionCall":return this.evaluateFunction(e,t);case"variable":return t.get(e.name);case"literal":return e.value;case"in":return this.evaluateIn(e,t);case"exists":throw new sr("EXISTS expressions require async evaluation. Use evaluateExpressionAsync instead.");default:throw new sr(`Unsupported expression type: ${e.type}, expr.termType=${r.termType}`)}}async evaluateExpressionAsync(e,t){return e.type==="exists"?this.evaluateExists(e,t):e.type==="logical"?this.evaluateLogicalAsync(e,t):this.evaluateExpression(e,t)}async evaluateExists(e,t){if(!this.existsEvaluator)throw new sr("EXISTS evaluator not set. Call setExistsEvaluator before evaluating EXISTS expressions.");let r=await this.existsEvaluator(e.pattern,t);return e.negated?!r:r}async evaluateLogicalAsync(e,t){if(e.operator==="!"){let i=await this.evaluateExpressionAsync(e.operands[0],t);return ft.BuiltInFunctions.logicalNot(i)}let r=[];for(let i of e.operands){let s=await this.evaluateExpressionAsync(i,t);r.push(s)}if(e.operator==="&&")return ft.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return ft.BuiltInFunctions.logicalOr(r);throw new sr(`Unknown logical operator: ${e.operator}`)}evaluateComparison(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);return ft.BuiltInFunctions.compare(r,i,e.operator)}evaluateLogical(e,t){if(e.operator==="!"){let i=this.evaluateExpression(e.operands[0],t);return ft.BuiltInFunctions.logicalNot(i)}let r=e.operands.map(i=>this.evaluateExpression(i,t));if(e.operator==="&&")return ft.BuiltInFunctions.logicalAnd(r);if(e.operator==="||")return ft.BuiltInFunctions.logicalOr(r);throw new sr(`Unknown logical operator: ${e.operator}`)}evaluateIn(e,t){let r=this.evaluateExpression(e.expression,t),i=e.list.some(s=>{let a=this.evaluateExpression(s,t);return ft.BuiltInFunctions.compare(r,a,"=")});return e.negated?!i:i}evaluateArithmetic(e,t){let r=this.evaluateExpression(e.left,t),i=this.evaluateExpression(e.right,t);if(e.operator==="-"&&this.isDateValue(r)&&this.isDateValue(i))return ft.BuiltInFunctions.dateDiff(r,i);if(e.operator==="-"&&this.isTimeValue(r)&&this.isTimeValue(i))return ft.BuiltInFunctions.timeDiff(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDateTimeValue(i))return ft.BuiltInFunctions.dateTimeDiff(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateAdd(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateSubtract(r,i);if(e.operator==="+"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateAddYearMonth(r,i);if(e.operator==="-"&&this.isDateValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateTimeAdd(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.dateTimeSubtract(r,i);if(e.operator==="+"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateTimeAddYearMonth(r,i);if(e.operator==="-"&&this.isDateTimeValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.dateTimeSubtractYearMonth(r,i);if(e.operator==="+"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.durationAdd(r,i);if(e.operator==="-"&&this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i))return ft.BuiltInFunctions.durationSubtract(r,i);if(e.operator==="*"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);return ft.BuiltInFunctions.durationMultiply(r,c)}if(e.operator==="*"&&!this.isDayTimeDurationValue(r)&&this.isDayTimeDurationValue(i)){let c=this.toNumericValue(r);return ft.BuiltInFunctions.durationMultiply(i,c)}if(e.operator==="/"&&this.isDayTimeDurationValue(r)&&!this.isDayTimeDurationValue(i)){let c=this.toNumericValue(i);if(c===0)throw new sr("Division by zero");return ft.BuiltInFunctions.durationDivide(r,c)}if(e.operator==="+"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.yearMonthDurationAdd(r,i);if(e.operator==="-"&&this.isYearMonthDurationValue(r)&&this.isYearMonthDurationValue(i))return ft.BuiltInFunctions.yearMonthDurationSubtract(r,i);let s=this.toNumericValue(r),a=this.toNumericValue(i);switch(e.operator){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":if(a===0)throw new sr("Division by zero");return s/a;default:throw new sr(`Unknown arithmetic operator: ${e.operator}`)}}isDayTimeDurationValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#dayTimeDuration":!1}isYearMonthDurationValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#yearMonthDuration":!1}toNumericValue(e){if(typeof e=="number")return e;if(e instanceof va.Literal){let t=e.datatype?.value||"";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let i=parseFloat(e.value);if(!isNaN(i))return i}let r=parseFloat(e.value);if(!isNaN(r))return r}if(typeof e=="string"){let t=parseFloat(e);if(!isNaN(t))return t}if(e&&typeof e=="object"&&"value"in e){let t=parseFloat(String(e.value));if(!isNaN(t))return t}throw new sr(`Cannot convert to number: ${e}`)}isDateTimeValue(e){if(e instanceof va.Literal){let t=e.datatype?.value||"";return t.includes("#dateTime")||t.includes("#date")?!0:/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e.value)}return typeof e=="string"?/^\d{4}-\d{2}-\d{2}(T|\s)/.test(e):!1}isDateValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#date":!1}isTimeValue(e){return e instanceof va.Literal?(e.datatype?.value||"")==="http://www.w3.org/2001/XMLSchema#time":!1}evaluateFunction(e,t){let r=e,i=this.extractFunctionName(r.function),s=this.evaluateSpecialFunction(i,r.args,t);if(s!==void 0)return s.value;let a=lL.functionHandlers.get(i);if(!a)throw new sr(`Unknown function: ${i}`);let c={evaluateExpression:o((l,u)=>this.evaluateExpression(l,u),"evaluateExpression"),getTermFromExpression:o((l,u)=>this.getTermFromExpression(l,u),"getTermFromExpression"),getStringValue:o(l=>this.getStringValue(l),"getStringValue"),solution:t,isYearMonthDurationValue:o(l=>this.isYearMonthDurationValue(l),"isYearMonthDurationValue"),isDayTimeDurationValue:o(l=>this.isDayTimeDurationValue(l),"isDayTimeDurationValue")};return a(r.args,c)}extractFunctionName(e){if(typeof e=="string")return e.toLowerCase();if(e&&typeof e=="object"&&"value"in e){let t=e.value;return((t.includes("#")?t.split("#").pop():t.split("/").pop())||t).toLowerCase()}throw new sr(`Unknown function format: ${e}`)}evaluateSpecialFunction(e,t,r){switch(e){case"coalesce":for(let c of t)try{let l=this.evaluateExpression(c,r);if(l!=null)return{value:l}}catch{continue}return{value:void 0};case"if":if(!t||t.length!==3)throw new sr("IF requires exactly 3 arguments");let i=this.evaluateExpression(t[0],r);return{value:this.toBoolean(i)?this.evaluateExpression(t[1],r):this.evaluateExpression(t[2],r)};case"byuuid":return{value:this.evaluateByUUID({args:t},r)};default:return}}getTermFromExpression(e,t){let r=e;if(r.type==="variable"&&r.name)return t.get(r.name)}getStringValue(e){return e==null?"":typeof e=="object"&&"value"in e?String(e.value):String(e)}toBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="number")return!isNaN(e)&&e!==0;if(typeof e=="string")return e.length>0;if(e instanceof va.Literal){let t=e.datatype?.value||"";if(t.includes("#boolean"))return e.value==="true"||e.value==="1";if(t.includes("#integer")||t.includes("#decimal")||t.includes("#double")||t.includes("#float")){let r=parseFloat(e.value);return!isNaN(r)&&r!==0}return e.value.length>0}return!!e}evaluateByUUID(e,t){if(!e.args||e.args.length!==1)throw new sr("exo:byUUID requires exactly 1 argument (UUID string)");let r=this.evaluateExpression(e.args[0],t),i=this.getStringValue(r);if(!i)return;let s=i.toLowerCase();if(this.uuidCache.has(s))return this.uuidCache.get(s)??void 0;if(!this.tripleStore){this.uuidCache.set(s,null);return}if(this.tripleStore.findSubjectsByUUIDSync){let a=this.tripleStore.findSubjectsByUUIDSync(s);if(a.length===0){this.uuidCache.set(s,null);return}let c=a[0];return this.uuidCache.set(s,c),c}this.uuidCache.set(s,null)}cacheUUIDResult(e,t){let r=e.toLowerCase();this.uuidCache.set(r,t)}getCachedUUID(e){let t=e.toLowerCase();if(this.uuidCache.has(t))return this.uuidCache.get(t)}};Ao.FilterExecutor=Vy});var By=v(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.OptionalExecutor=void 0;var Uy=class{static{o(this,"OptionalExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);yield*this.hashJoin(r,i)}async executeAll(e,t){let r=[];for(let i of this.hashJoin(e,t))r.push(i);return r}*hashJoin(e,t){if(e.length===0)return;if(t.length===0){yield*e;return}let r=new Set;for(let l of e)for(let u of l.variables())r.add(u);let i=new Set;for(let l of t)for(let u of l.variables())i.add(u);let s=[];for(let l of r)i.has(l)&&s.push(l);if(s.sort(),s.length===0){yield*this.nestedLoopJoin(e,t);return}let a="\0",c=new Map;for(let l of t){let u=this.computeHashKey(l,s,a),f=c.get(u);f||(f=[],c.set(u,f)),f.push(l)}for(let l of e){let u=this.computeHashKey(l,s,a),f=c.get(u),h=!1;if(f)for(let d of f){let p=l.merge(d);p!==null&&(yield p,h=!0)}h||(yield l)}}computeHashKey(e,t,r){let i=[];for(let s of t){let a=e.get(s);i.push(a!==void 0?a.toString():"UNBOUND")}return i.join(r)}*nestedLoopJoin(e,t){for(let r of e){let i=!1;for(let s of t){let a=r.merge(s);a!==null&&(yield a,i=!0)}i||(yield r)}}};xh.OptionalExecutor=Uy});var Gy=v(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.UnionExecutor=void 0;var qy=class{static{o(this,"UnionExecutor")}async*execute(e,t){let r=new Set;for await(let i of e){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}for await(let i of t){let s=this.getSolutionKey(i);r.has(s)||(r.add(s),yield i)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}};Ah.UnionExecutor=qy});var Qy=v(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.ConstructExecutor=void 0;var uL=_i(),_a=We(),Wy=mt(),Hy=kt(),fL=Lc(),zy=class{static{o(this,"ConstructExecutor")}async execute(e,t){let r=[],i=new Set;for(let s of t)for(let a of e)try{let c=this.instantiateTriple(a,s),l=`${c.subject.toString()}|${c.predicate.toString()}|${c.object.toString()}`;i.has(l)||(i.add(l),r.push(c))}catch{continue}return r}instantiateTriple(e,t){if(this.isPropertyPath(e.predicate))throw new Error("Property paths are not supported in CONSTRUCT templates");let r=this.instantiateElement(e.subject,t),i=this.instantiateElement(e.predicate,t),s=this.instantiateElement(e.object,t);return new uL.Triple(r,i,s)}isPropertyPath(e){return e.type==="path"}instantiateElement(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable: ${e.value}`);return r}if(e.type==="iri")return new _a.IRI(e.value);if(e.type==="literal")return new Wy.Literal(e.value,e.datatype?new _a.IRI(e.datatype):void 0,e.language);if(e.type==="blank")return new Hy.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Unknown element type: ${e.type}`)}instantiateQuotedTriple(e,t){let r=this.instantiateQuotedSubject(e.subject,t),i=this.instantiateQuotedPredicate(e.predicate,t),s=this.instantiateQuotedObject(e.object,t);return new fL.QuotedTriple(r,i,s)}instantiateQuotedSubject(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple subject: ${e.value}`);if(r instanceof Wy.Literal)throw new Error("Literals cannot appear in quoted triple subject position");return r}if(e.type==="iri")return new _a.IRI(e.value);if(e.type==="blank")return new Hy.BlankNode(e.value);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);throw new Error(`Invalid element type for quoted triple subject: ${e.type}`)}instantiateQuotedPredicate(e,t){if(e.type==="variable"){let r=t.get(e.value);if(!r)throw new Error(`Unbound variable in quoted triple predicate: ${e.value}`);if(!(r instanceof _a.IRI))throw new Error("Quoted triple predicate must be an IRI");return r}return new _a.IRI(e.value)}instantiateQuotedObject(e,t){if(e.type==="variable"){let i=t.get(e.value);if(!i)throw new Error(`Unbound variable in quoted triple object: ${e.value}`);return i}if(e.type==="iri")return new _a.IRI(e.value);if(e.type==="blank")return new Hy.BlankNode(e.value);if(e.type==="literal")return new Wy.Literal(e.value,e.datatype?new _a.IRI(e.datatype):void 0,e.language);if(e.type==="quoted")return this.instantiateQuotedTriple(e,t);let r=e;throw new Error(`Invalid element type for quoted triple object: ${r.type}`)}};Ch.ConstructExecutor=zy});var Mw=v(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.DescribeExecutor=void 0;var kw=We(),Yy=class{static{o(this,"DescribeExecutor")}constructor(e){this.tripleStore=e}async execute(e,t){let r=[],i=new Set,s=new Set,a=t?.depth;for(let c of e)await this.describeResourceWithDepth(c,a,1,t?.symmetric??!0,r,i,s);return r}async describeResourceWithDepth(e,t,r,i,s,a,c){let l=e.toString();if(c.has(l)||(c.add(l),t!==void 0&&r>t))return;let u=[],f=await this.tripleStore.match(e,void 0,void 0);if(u.push(...f),i){let d=await this.tripleStore.match(void 0,void 0,e);u.push(...d)}let h=[];for(let d of u){let p=`${d.subject.toString()}|${d.predicate.toString()}|${d.object.toString()}`;a.has(p)||(a.add(p),s.push(d),(t===void 0||r<t)&&(this.isIRI(d.subject)&&d.subject.toString()!==l&&h.push(d.subject),this.isIRI(d.object)&&d.object.toString()!==l&&h.push(d.object)))}for(let d of h)await this.describeResourceWithDepth(d,t,r+1,i,s,a,c)}isIRI(e){return e?e instanceof kw.IRI||e.termType==="NamedNode"||typeof e.value=="string"&&e.value.startsWith("http"):!1}async describeByIRI(e,t){let r=new kw.IRI(e);return this.execute([r],t)}};Ih.DescribeExecutor=Yy});var jw=v(Oh=>{"use strict";Object.defineProperty(Oh,"__esModule",{value:!0});Oh.MinusExecutor=void 0;var Ky=class{static{o(this,"MinusExecutor")}async*execute(e,t){let r=[];for await(let s of e)r.push(s);let i=[];for await(let s of t)i.push(s);for(let s of r){let a=!1;for(let c of i)if(this.areCompatible(s,c)){a=!0;break}a||(yield s)}}async executeAll(e,t){let r=[];async function*i(){for(let a of e)yield a}o(i,"generateLeft");async function*s(){for(let a of t)yield a}o(s,"generateRight");for await(let a of this.execute(i(),s()))r.push(a);return r}areCompatible(e,t){let r=e.variables(),i=new Set(t.variables()),s=r.filter(a=>i.has(a));if(s.length===0)return!1;for(let a of s){let c=e.get(a),l=t.get(a);if(c===void 0||l===void 0||c.toString()!==l.toString())return!1}return!0}};Oh.MinusExecutor=Ky});var Vw=v(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.ValuesExecutor=Co.ValuesExecutorError=void 0;var hL=es(),$w=We(),dL=mt(),Ph=class extends Error{static{o(this,"ValuesExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ValuesExecutorError"}};Co.ValuesExecutorError=Ph;var Xy=class{static{o(this,"ValuesExecutor")}async*execute(e){if(e.bindings.length!==0)for(let t of e.bindings)yield this.createSolutionMapping(t)}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}createSolutionMapping(e){let t=new hL.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.toRDFTerm(i);t.set(r,s)}return t}toRDFTerm(e){if(e.type==="iri")return new $w.IRI(e.value);if(e.type==="literal")return new dL.Literal(e.value,e.datatype?new $w.IRI(e.datatype):void 0,e.language,e.direction);throw new Ph(`Unknown term type: ${e.type}`)}};Co.ValuesExecutor=Xy});var Jy=v(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.CustomAggregateRegistry=Oo.CustomAggregateError=void 0;var Io=class extends Error{static{o(this,"CustomAggregateError")}constructor(e,t){super(e),this.iri=t,this.name="CustomAggregateError"}};Oo.CustomAggregateError=Io;var Rh=class n{static{o(this,"CustomAggregateRegistry")}constructor(){this.aggregates=new Map}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance&&n.instance.clear(),n.instance=null}register(e,t){if(!e||typeof e!="string")throw new Io("Aggregate IRI must be a non-empty string");if(!t||typeof t.init!="function"||typeof t.step!="function"||typeof t.finalize!="function")throw new Io("Aggregate must implement init(), step(), and finalize() methods",e);if(this.aggregates.has(e))throw new Io(`Aggregate with IRI "${e}" is already registered`,e);this.aggregates.set(e,t)}unregister(e){return this.aggregates.delete(e)}get(e){return this.aggregates.get(e)}has(e){return this.aggregates.has(e)}getRegisteredIris(){return Array.from(this.aggregates.keys())}clear(){this.aggregates.clear()}get size(){return this.aggregates.size}};Oo.CustomAggregateRegistry=Rh;Rh.instance=null});var Zy=v(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.BUILT_IN_AGGREGATES=qe.modeAggregate=qe.stddevAggregate=qe.varianceAggregate=qe.medianAggregate=qe.EXO_AGGREGATE_NS=void 0;qe.getNumericValue=Fh;qe.createDecimalLiteral=ri;qe.createDoubleLiteral=gL;qe.createPercentileAggregate=ba;var Sa=mt(),Po=We(),pL=new Po.IRI("http://www.w3.org/2001/XMLSchema#decimal"),mL=new Po.IRI("http://www.w3.org/2001/XMLSchema#double");qe.EXO_AGGREGATE_NS="https://exocortex.my/ontology/agg#";function Fh(n){return n==null?NaN:typeof n=="number"?n:typeof n=="string"?parseFloat(n):n instanceof Sa.Literal?parseFloat(n.value):n instanceof Po.IRI?NaN:typeof n=="boolean"?n?1:0:NaN}o(Fh,"getNumericValue");function ri(n){return new Sa.Literal(String(n),pL)}o(ri,"createDecimalLiteral");function gL(n){return new Sa.Literal(String(n),mL)}o(gL,"createDoubleLiteral");qe.medianAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Fh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ri(0);let r=[...t].sort((a,c)=>a-c),i=Math.floor(r.length/2),s=r.length%2!==0?r[i]:(r[i-1]+r[i])/2;return ri(s)}};qe.varianceAggregate={init(){return{values:[]}},step(n,e){let t=n,r=Fh(e);isNaN(r)||t.values.push(r)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ri(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ri(i)}};qe.stddevAggregate={init(){return{values:[]}},step(n,e){qe.varianceAggregate.step(n,e)},finalize(n){let e=n,{values:t}=e;if(t.length===0)return ri(0);let r=t.reduce((s,a)=>s+a,0)/t.length,i=t.reduce((s,a)=>s+Math.pow(a-r,2),0)/t.length;return ri(Math.sqrt(i))}};qe.modeAggregate={init(){return{counts:new Map,values:new Map}},step(n,e){if(e==null)return;let t=n,r=String(e instanceof Sa.Literal||e instanceof Po.IRI?e.value:e),i=t.counts.get(r)||0;t.counts.set(r,i+1),t.values.set(r,e)},finalize(n){let e=n;if(e.counts.size===0)return new Sa.Literal(" ",new Po.IRI("http://www.w3.org/2001/XMLSchema#string"));let t="",r=0;for(let[a,c]of e.counts)c>r&&(r=c,t=a);let i=e.values.get(t);if(i instanceof Sa.Literal)return i;let s=parseFloat(t);return isNaN(s)?new Sa.Literal(t,new Po.IRI("http://www.w3.org/2001/XMLSchema#string")):ri(s)}};function ba(n){let e=Math.max(0,Math.min(100,n))/100;return{init(){return{values:[],percentile:e}},step(t,r){let i=t,s=Fh(r);isNaN(s)||i.values.push(s)},finalize(t){let r=t,{values:i}=r;if(i.length===0)return ri(0);let s=[...i].sort((h,d)=>h-d),a=r.percentile*(s.length-1),c=Math.floor(a),l=Math.ceil(a);if(c===l)return ri(s[c]);let u=a-c,f=s[c]*(1-u)+s[l]*u;return ri(f)}}}o(ba,"createPercentileAggregate");qe.BUILT_IN_AGGREGATES={[`${qe.EXO_AGGREGATE_NS}median`]:qe.medianAggregate,[`${qe.EXO_AGGREGATE_NS}variance`]:qe.varianceAggregate,[`${qe.EXO_AGGREGATE_NS}stddev`]:qe.stddevAggregate,[`${qe.EXO_AGGREGATE_NS}mode`]:qe.modeAggregate,[`${qe.EXO_AGGREGATE_NS}percentile25`]:ba(25),[`${qe.EXO_AGGREGATE_NS}percentile50`]:ba(50),[`${qe.EXO_AGGREGATE_NS}percentile75`]:ba(75),[`${qe.EXO_AGGREGATE_NS}percentile90`]:ba(90),[`${qe.EXO_AGGREGATE_NS}percentile95`]:ba(95),[`${qe.EXO_AGGREGATE_NS}percentile99`]:ba(99)}});var qw=v(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.AggregateExecutor=Ro.AggregateExecutorError=void 0;var jt=mt(),t1=We(),yL=Th(),vL=Jy(),_L=Zy(),Uw=new t1.IRI("http://www.w3.org/2001/XMLSchema#integer"),wa=new t1.IRI("http://www.w3.org/2001/XMLSchema#decimal"),Ai=new t1.IRI("http://www.w3.org/2001/XMLSchema#string");function Bw(n){return typeof n=="object"&&n.type==="custom"}o(Bw,"isCustomAggregation");var ol=class extends Error{static{o(this,"AggregateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="AggregateExecutorError"}};Ro.AggregateExecutorError=ol;var e1=class{static{o(this,"AggregateExecutor")}constructor(){this.filterExecutor=new yL.FilterExecutor}execute(e,t){let r=this.groupSolutions(t,e.variables),i=[];for(let[s,a]of r.entries()){let c=new Map;for(let f of e.variables)if(a.length>0){let h=a[0].get(f);h&&c.set(f,h)}for(let f of e.aggregates){let h=this.computeAggregate(f.expression,a);c.set(f.variable,h)}let{SolutionMapping:l}=es(),u=new l;for(let[f,h]of c.entries())u.set(f,h);i.push(u)}if(i.length===0&&e.aggregates.length>0){let s=this.createEmptyAggregateResult(e);s&&i.push(s)}return i}groupSolutions(e,t){let r=new Map;if(t.length===0)return r.set("",e),r;for(let i of e){let s=this.computeGroupKey(i,t),a=r.get(s);a?a.push(i):r.set(s,[i])}return r}computeGroupKey(e,t){return t.map(r=>{let i=e.get(r);return i?this.termToString(i):""}).join("|")}termToString(e){if(e&&typeof e=="object"){if("value"in e)return String(e.value);if("id"in e)return String(e.id)}return String(e)}computeAggregate(e,t){if(Bw(e.aggregation))return this.computeCustomAggregate(e,t);let r=this.extractValues(e,t),i=e.aggregation;switch(i){case"count":{let s=this.computeCount(r,e.distinct);return new jt.Literal(String(s),Uw)}case"sum":{let s=this.computeSum(r);return new jt.Literal(String(s),wa)}case"avg":{let s=this.computeAvg(r);return new jt.Literal(String(s),wa)}case"min":{let s=this.computeMin(r);return s===void 0?new jt.Literal("",Ai):typeof s=="number"?new jt.Literal(String(s),wa):new jt.Literal(String(s),Ai)}case"max":{let s=this.computeMax(r);return s===void 0?new jt.Literal("",Ai):typeof s=="number"?new jt.Literal(String(s),wa):new jt.Literal(String(s),Ai)}case"group_concat":{let s=this.computeGroupConcat(r,e.separator||" ",e.distinct);return new jt.Literal(s||" ",Ai)}case"sample":{let s=this.computeSample(r,e.distinct);return s===void 0?new jt.Literal(" ",Ai):typeof s=="number"?new jt.Literal(String(s),wa):new jt.Literal(String(s),Ai)}default:{let s=i;throw new ol(`Unknown aggregation function: ${s}`)}}}computeCustomAggregate(e,t){let i=e.aggregation.iri,a=vL.CustomAggregateRegistry.getInstance().get(i);if(a||(a=_L.BUILT_IN_AGGREGATES[i]),!a)throw new ol(`Unknown custom aggregate function: ${i}. Register it with CustomAggregateRegistry.getInstance().register() or use a built-in aggregate.`);let c=a.init();for(let l of t){let u=null;if(e.expression){let f=this.evaluateExpression(e.expression,l);f!==void 0&&(u=f)}else u=1;a.step(c,u)}return a.finalize(c)}extractValues(e,t){if(!e.expression)return t.map(()=>1);let r=[];for(let i of t){let s=this.evaluateExpression(e.expression,i);s!=null&&r.push(s)}return r}evaluateExpression(e,t){if(e.type==="variable"){let r=t.get(e.name);return r==null?void 0:typeof r=="number"||typeof r=="string"||typeof r=="boolean"?r:typeof r=="object"&&"value"in r?r.value:r}if(e.type==="literal")return e.value;try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}computeCount(e,t){return t?new Set(e.map(r=>String(r))).size:e.length}computeSum(e){return e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r)).reduce((r,i)=>r+i,0)}computeAvg(e){let t=e.map(r=>parseFloat(String(r))).filter(r=>!isNaN(r));return t.length===0?0:t.reduce((r,i)=>r+i,0)/t.length}computeMin(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.min(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s<i?s:i,r[0])}computeMax(e){if(e.length===0)return;let t=e.map(i=>parseFloat(String(i))).filter(i=>!isNaN(i));if(t.length>0)return Math.max(...t);let r=e.map(i=>String(i));return r.reduce((i,s)=>s>i?s:i,r[0])}computeGroupConcat(e,t,r){let i=e.map(s=>String(s));return r&&(i=[...new Set(i)]),i.join(t)}computeSample(e,t){if(e.length===0)return;if(t){let s=[...new Set(e.map(l=>String(l)))];if(s.length===0)return;let a=s[0],c=parseFloat(a);return isNaN(c)?a:c}let r=e[0];if(typeof r=="number")return r;let i=parseFloat(String(r));return isNaN(i)?String(r):i}createEmptyAggregateResult(e){let{SolutionMapping:t}=es(),r=new t;for(let i of e.aggregates){let s=i.expression.aggregation;if(Bw(s)){r.set(i.variable,new jt.Literal("0",wa));continue}switch(s){case"count":r.set(i.variable,new jt.Literal("0",Uw));break;case"sum":case"avg":r.set(i.variable,new jt.Literal("0",wa));break;case"group_concat":r.set(i.variable,new jt.Literal(" ",Ai));break;case"min":case"max":case"sample":r.set(i.variable,new jt.Literal("",Ai));break;default:r.set(i.variable,new jt.Literal("",Ai))}}return r}};Ro.AggregateExecutor=e1});var Ww=v(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.ServiceExecutor=Fo.ServiceExecutorError=void 0;var bL=es(),Gw=We(),SL=mt(),wL=kt(),Ea=class extends Error{static{o(this,"ServiceExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="ServiceExecutorError"}};Fo.ServiceExecutorError=Ea;var r1=class{static{o(this,"ServiceExecutor")}constructor(e={}){this.timeout=e.timeout??3e4,this.httpClient=e.httpClient??((t,r)=>fetch(t,r)),this.maxRetries=e.maxRetries??2,this.retryDelay=e.retryDelay??1e3}async*execute(e,t){try{let r=t(e.pattern),i=await this.executeRemoteQuery(e.endpoint,r);for(let s of i)yield s}catch(r){if(e.silent)return;throw r}}async executeRemoteQuery(e,t){let r;for(let i=0;i<=this.maxRetries;i++)try{let s=new AbortController,a=setTimeout(()=>s.abort(),this.timeout);try{let c=await this.httpClient(e,{method:"POST",headers:{"Content-Type":"application/sparql-query",Accept:"application/sparql-results+json"},body:t,signal:s.signal});if(!c.ok)throw new Ea(`Remote SPARQL endpoint returned ${c.status}: ${c.statusText}`);let l=await c.json();return this.parseJsonResults(l)}finally{clearTimeout(a)}}catch(s){if(r=s instanceof Error?s:new Error(String(s)),this.isRetryableError(r)&&i<this.maxRetries){await this.delay(this.retryDelay);continue}throw new Ea(`Failed to query remote SPARQL endpoint ${e}: ${r.message}`,r)}throw new Ea(`Failed to query remote SPARQL endpoint ${e} after ${this.maxRetries+1} attempts`,r)}parseJsonResults(e){return!e.results||!Array.isArray(e.results.bindings)?[]:e.results.bindings.map(t=>this.parseBinding(t))}parseBinding(e){let t=new bL.SolutionMapping;for(let[r,i]of Object.entries(e)){let s=this.parseRDFTerm(i);t.set(r,s)}return t}parseRDFTerm(e){switch(e.type){case"uri":return new Gw.IRI(e.value);case"literal":{let t=e.datatype?new Gw.IRI(e.datatype):void 0;return new SL.Literal(e.value,t,e["xml:lang"])}case"bnode":return new wL.BlankNode(e.value);default:throw new Ea(`Unknown RDF term type: ${e.type}`)}}isRetryableError(e){let t=e.message.toLowerCase();return!!(e.name==="AbortError"||t.includes("network")||t.includes("econnreset")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("returned 5"))}delay(e){return new Promise(t=>setTimeout(t,e))}};Fo.ServiceExecutor=r1});var zw=v(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.GraphExecutor=Do.GraphExecutorError=void 0;var Hw=We(),Dh=class extends Error{static{o(this,"GraphExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="GraphExecutorError"}};Do.GraphExecutorError=Dh;var n1=class{static{o(this,"GraphExecutor")}constructor(e){this.tripleStore=e}async*execute(e,t,r){let i=e.name;if(i.type==="iri")yield*this.executeWithGraph(e.pattern,i,t);else if(i.type==="variable")yield*this.executeWithGraphVariable(e,i,t,r);else throw new Dh(`Invalid graph name type: ${i.type}`)}async*executeWithGraph(e,t,r){let i=new Hw.IRI(t.value);this.tripleStore.hasGraph&&!await this.tripleStore.hasGraph(i)||(yield*r(e,i))}async*executeWithGraphVariable(e,t,r,i){if(i){let a=i.get(t.value);if(a&&a instanceof Hw.IRI){yield*this.executeWithGraph(e.pattern,{type:"iri",value:a.value},r);return}}if(!this.tripleStore.getNamedGraphs)return;let s=await this.tripleStore.getNamedGraphs();for(let a of s)for await(let c of r(e.pattern,a)){let l=c.clone();l.set(t.value,a),yield l}}};Do.GraphExecutor=n1});var Qw=v(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.SPARQLGenerator=Lo.SPARQLGeneratorError=void 0;var No=class extends Error{static{o(this,"SPARQLGeneratorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="SPARQLGeneratorError"}};Lo.SPARQLGeneratorError=No;var i1=class{static{o(this,"SPARQLGenerator")}collectVariables(e){let t=new Set;return this.collectVariablesFromOperation(e,t),t}generateSelect(e){let t=this.collectVariables(e),r=t.size>0?Array.from(t).map(s=>`?${s}`).join(" "):"*",i=this.generateWhereClause(e);return`SELECT ${r} WHERE {
|
|
316
316
|
${i}
|
|
317
317
|
}`}generateWhereClause(e,t=2){let r=" ".repeat(t);switch(e.type){case"bgp":return this.generateBGP(e,t);case"filter":return`${this.generateWhereClause(e.input,t)}
|
|
318
318
|
${r}FILTER(${this.generateExpression(e.expression)})`;case"join":return`${this.generateWhereClause(e.left,t)}
|
|
@@ -334,59 +334,59 @@ ${r}}`}default:throw new No(`Unsupported operation type for SPARQL generation: $
|
|
|
334
334
|
`)}generateTriple(e){let t=this.generateElement(e.subject),r=this.generatePredicate(e.predicate),i=this.generateElement(e.object);return`${t} ${r} ${i}`}generatePredicate(e){return"pathType"in e?this.generatePropertyPath(e):this.generateElement(e)}generatePropertyPath(e){let t=e.items.map(r=>"pathType"in r?`(${this.generatePropertyPath(r)})`:`<${r.value}>`);switch(e.pathType){case"/":return t.join("/");case"|":return t.join("|");case"^":return`^${t[0]}`;case"+":return`${t[0]}+`;case"*":return`${t[0]}*`;case"?":return`${t[0]}?`}}generateElement(e){switch(e.type){case"variable":return`?${e.value}`;case"iri":return`<${e.value}>`;case"literal":{let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}case"blank":return`_:${e.value}`;default:throw new No(`Unknown element type: ${e.type}`)}}generateValues(e,t){let r=" ".repeat(t);if(e.variables.length===0||e.bindings.length===0)return"";if(e.variables.length===1){let a=e.variables[0],c=e.bindings.map(l=>{let u=l[a];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ");return`${r}VALUES ?${a} { ${c} }`}let i=e.variables.map(a=>`?${a}`).join(" "),s=e.bindings.map(a=>`(${e.variables.map(l=>{let u=a[l];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ")})`);return`${r}VALUES (${i}) {
|
|
335
335
|
${s.map(a=>`${r} ${a}`).join(`
|
|
336
336
|
`)}
|
|
337
|
-
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new No(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};Lo.SPARQLGenerator=i1});var Yw=v(En=>{"use strict";var E9=En&&En.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),T9=En&&En.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),x9=En&&En.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&E9(t,e,r[i]);return T9(t,e),t}})();Object.defineProperty(En,"__esModule",{value:!0});En.QueryExecutor=En.QueryExecutorError=void 0;var A9=jy(),C9=Th(),I9=By(),O9=Gy(),P9=jw(),R9=Vw(),F9=qw(),D9=Qy(),N9=Ww(),L9=zw(),k9=Qw(),M9=We(),ko=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};En.QueryExecutorError=ko;var s1=class{static{o(this,"QueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new A9.BGPExecutor(e),this.filterExecutor=new C9.FilterExecutor,this.optionalExecutor=new I9.OptionalExecutor,this.unionExecutor=new O9.UnionExecutor,this.minusExecutor=new P9.MinusExecutor,this.valuesExecutor=new R9.ValuesExecutor,this.aggregateExecutor=new F9.AggregateExecutor,this.constructExecutor=new D9.ConstructExecutor,this.serviceExecutor=new N9.ServiceExecutor(t.serviceConfig),this.graphExecutor=new L9.GraphExecutor(e),this.sparqlGenerator=new k9.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new ko(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);if(t.length===0)return;let r=new Set;for(let a of t)for(let c of a.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(a=>i.has(a)))for(let a of t){let c=this.substituteVariables(e.right,a);for await(let l of this.execute(c)){let u=a.merge(l);u!==null&&(yield u)}}else{let a=[];for await(let c of this.execute(e.right))a.push(c);for(let c of t)for(let l of a){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){for await(let t of this.execute(e.input))yield t}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let a=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(a===void 0&&c===void 0?l=0:a===void 0?l=1:c===void 0?l=-1:typeof a=="number"&&typeof c=="number"?l=a-c:l=String(a).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(a=>this.filterExecutor.evaluateExpression(a,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){for await(let t of this.execute(e.input)){let r=t.clone(),i=this.evaluateExtendExpression(e.expression,t);i!==void 0&&r.set(e.variable,i),yield r}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let a=r.merge(s);a!==null&&(yield a)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return r.type==="bgp"&&r.triples?(r.triples=r.triples.map(i=>this.substituteInTriple(i,t)),r):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),r)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){if(r instanceof M9.IRI||r.termType==="NamedNode")return{type:"iri",value:r.value};if(r.termType==="Literal"||typeof r.value=="string"){let i=r;return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>x9(es()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);return r?r.value??r.id??String(r):void 0}return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!(!e||typeof e!="object")){if(e.type==="bgp"&&e.triples)for(let r of e.triples)this.collectVarsFromElement(r.subject,t),r.predicate?.type!=="path"&&this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t);if(e.type==="values"&&e.variables)for(let r of e.variables)t.add(r);e.expression&&this.collectVarsFromExpressionTree(e.expression,t),e.type==="extend"&&e.variable&&t.add(e.variable),e.input&&this.collectVarsFromOperation(e.input,t),e.left&&this.collectVarsFromOperation(e.left,t),e.right&&this.collectVarsFromOperation(e.right,t),e.pattern&&this.collectVarsFromOperation(e.pattern,t),e.query&&this.collectVarsFromOperation(e.query,t),e.where&&this.collectVarsFromOperation(e.where,t)}}collectVarsFromElement(e,t){e&&(e.type==="variable"&&t.add(e.value),e.type==="quoted"&&(this.collectVarsFromElement(e.subject,t),this.collectVarsFromElement(e.predicate,t),this.collectVarsFromElement(e.object,t)))}collectVarsFromExpressionTree(e,t){if(!(!e||typeof e!="object")){if(e.type==="variable"&&e.name&&t.add(e.name),e.type==="exists"&&e.pattern&&this.collectVarsFromOperation(e.pattern,t),e.left&&this.collectVarsFromExpressionTree(e.left,t),e.right&&this.collectVarsFromExpressionTree(e.right,t),e.operands)for(let r of e.operands)this.collectVarsFromExpressionTree(r,t);if(e.args)for(let r of e.args)this.collectVarsFromExpressionTree(r,t);if(e.expression&&this.collectVarsFromExpressionTree(e.expression,t),e.list)for(let r of e.list)this.collectVarsFromExpressionTree(r,t)}}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new ko("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new ko("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};En.QueryExecutor=s1});var Xw=v(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.UpdateExecutor=jo.UpdateExecutorError=void 0;var j9=_i(),Mo=We(),a1=mt(),Kw=kt(),_r=class extends Error{static{o(this,"UpdateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="UpdateExecutorError"}};jo.UpdateExecutorError=_r;var o1=class{static{o(this,"UpdateExecutor")}constructor(e){this.tripleStore=e}async execute(e){if(e.type!=="update")throw new _r("Expected UPDATE request");let t=[];for(let r of e.updates){let i=await this.executeOperation(r);t.push(i)}return t}async executeOperation(e){if("updateType"in e)switch(e.updateType){case"insert":return this.executeInsertData(e);case"delete":return this.executeDeleteData(e);case"insertdelete":throw new _r("INSERT/DELETE with WHERE clause not yet implemented");case"deletewhere":throw new _r("DELETE WHERE not yet implemented");default:throw new _r(`Unknown update type: ${e.updateType}`)}if("type"in e)switch(e.type){case"clear":case"drop":case"load":case"create":case"copy":case"move":case"add":throw new _r(`${e.type.toUpperCase()} operation not yet implemented`);default:throw new _r(`Unknown operation type: ${e.type}`)}throw new _r("Unknown update operation structure")}async executeInsertData(e){if(e.updateType!=="insert")throw new _r("Expected INSERT DATA operation");let t=e,r=0;for(let i of t.insert)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.insertTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.insertTriples(s.triples,a)}return{type:"insert",inserted:r,success:!0}}async executeDeleteData(e){if(e.updateType!=="delete")throw new _r("Expected DELETE DATA operation");let t=e,r=0;for(let i of t.delete)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.deleteTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.deleteTriples(s.triples,a)}return{type:"delete",deleted:r,success:!0}}async insertTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i);t&&this.tripleStore.addToGraph?await this.tripleStore.addToGraph(s,t):await this.tripleStore.add(s),r++}return r}async deleteTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i),a;t&&this.tripleStore.removeFromGraph?a=await this.tripleStore.removeFromGraph(s,t):a=await this.tripleStore.remove(s),a&&r++}return r}convertTriple(e){return new j9.Triple(this.convertSubject(e.subject),this.convertPredicate(e.predicate),this.convertObject(e.object))}convertSubject(e){if(e.termType==="NamedNode")return new Mo.IRI(e.value);if(e.termType==="BlankNode")return new Kw.BlankNode(e.value);throw new _r(`Invalid subject term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}convertPredicate(e){if("termType"in e&&e.termType==="NamedNode")return new Mo.IRI(e.value);throw new _r("Invalid predicate term type. Only IRIs are allowed in INSERT DATA.")}convertObject(e){if(e.termType==="NamedNode")return new Mo.IRI(e.value);if(e.termType==="BlankNode")return new Kw.BlankNode(e.value);if(e.termType==="Literal"){let t=e;return t.language?new a1.Literal(t.value,void 0,t.language):t.datatype?new a1.Literal(t.value,new Mo.IRI(t.datatype.value)):new a1.Literal(t.value)}throw new _r(`Invalid object term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}resolveGraphName(e){if(e&&!e.default&&e.name)return new Mo.IRI(e.name.value)}parseGraphName(e){if(e.termType==="Variable")throw new _r("Variables are not allowed as graph names in INSERT DATA / DELETE DATA.");return new Mo.IRI(e.value)}};jo.UpdateExecutor=o1});var Zw=v(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.AggregateFunctions=void 0;var c1=mt(),Jw=We(),l1=class{static{o(this,"AggregateFunctions")}static count(e,t){if(!t)return e.length;let r=0;for(let i of e)i.has(t)&&r++;return r}static countDistinct(e,t){let r=new Set;for(let i of e){let s=i.get(t);s&&r.add(s.toString())}return r.size}static sum(e,t){let r=0;for(let i of e){let s=i.get(t);if(s instanceof c1.Literal){let a=this.toNumber(s);isNaN(a)||(r+=a)}}return r}static avg(e,t){let r=this.sum(e,t),i=this.count(e,t);return i>0?r/i:0}static min(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a<r)&&(r=a)}return r}static max(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a>r)&&(r=a)}return r}static groupConcat(e,t,r=" "){let i=[];for(let s of e){let a=s.get(t);a&&(a instanceof c1.Literal||a instanceof Jw.IRI?i.push(a.value):i.push(a.toString()))}return i.join(r)}static sample(e,t){for(let r of e){let i=r.get(t);if(i)return this.toComparable(i)}return null}static sampleDistinct(e,t){return this.sample(e,t)}static toNumber(e){let t=e.datatype?.value;return t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double"),parseFloat(e.value)}static toComparable(e){if(e instanceof c1.Literal){let t=this.toNumber(e);return isNaN(t)?e.value:t}return e instanceof Jw.IRI?e.value:String(e)}};Nh.AggregateFunctions=l1});var eE=v(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.QueryPlanCache=void 0;var $9=Qf(),u1=class{static{o(this,"QueryPlanCache")}constructor(e=100){this.hits=0,this.misses=0,this.cache=new $9.LRUCache(e)}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r!==void 0?this.hits++:this.misses++,r}set(e,t){let r=this.normalizeQuery(e);this.cache.set(r,t)}has(e){let t=this.normalizeQuery(e);return this.cache.get(t)!==void 0}clear(){this.cache.clear()}getStats(){let e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,size:this.cache.size()}}resetStats(){this.hits=0,this.misses=0}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}};Lh.QueryPlanCache=u1});var tE=v(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.SPARQLResultCache=void 0;cl.createSPARQLResultCache=B9;var V9=Qf(),U9={maxSize:500,ttlMs:300*1e3,enableFileInvalidation:!0,maxResultSizeBytes:10*1024*1024},kh=class{static{o(this,"SPARQLResultCache")}constructor(e={}){this.fileToQueries=new Map,this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0},this.avgQueryTimeMs=100,this.options={...U9,...e},this.cache=new V9.LRUCache(this.options.maxSize)}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}hashResult(e){return this.isTripleArray(e)?`T:${e.length}`:`S:${e.length}`}isTripleArray(e){return e.length>0&&"subject"in e[0]}estimateResultSize(e){return this.isTripleArray(e)?e.length*300:e.length*200}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);if(r===void 0){this.stats.misses++;return}if(Date.now()-r.timestamp>this.options.ttlMs){this.cache.set(t,void 0),this.stats.ttlInvalidations++,this.stats.misses++;return}return this.stats.hits++,this.stats.totalTimeSavedMs+=this.avgQueryTimeMs,r.result}set(e,t,r,i){if(this.estimateResultSize(t)>this.options.maxResultSizeBytes)return;i!==void 0&&(this.avgQueryTimeMs=(this.avgQueryTimeMs+i)/2);let a=this.normalizeQuery(e),c=r??new Set,l={result:t,timestamp:Date.now(),affectedFiles:c,resultHash:this.hashResult(t)};if(this.cache.size()>=this.options.maxSize&&this.stats.evictions++,this.cache.set(a,l),this.options.enableFileInvalidation)for(let f of c){let h=this.fileToQueries.get(f);h||(h=new Set,this.fileToQueries.set(f,h)),h.add(a)}}has(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r===void 0?!1:Date.now()-r.timestamp<=this.options.ttlMs}invalidateByFile(e){if(!this.options.enableFileInvalidation)return 0;let t=this.fileToQueries.get(e);if(!t)return 0;let r=0;for(let i of t)this.cache.set(i,void 0),r++,this.stats.fileInvalidations++;return this.fileToQueries.delete(e),r}clear(){this.cache.clear(),this.fileToQueries.clear()}getStats(){let e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{hits:this.stats.hits,misses:this.stats.misses,hitRate:t,size:this.cache.size(),maxSize:this.options.maxSize,evictions:this.stats.evictions,ttlInvalidations:this.stats.ttlInvalidations,fileInvalidations:this.stats.fileInvalidations,avgTimeSavedMs:this.stats.hits>0?this.stats.totalTimeSavedMs/this.stats.hits:0}}resetStats(){this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0}}size(){return this.cache.size()}pruneExpired(){return 0}};cl.SPARQLResultCache=kh;function B9(n){return new kh(n)}o(B9,"createSPARQLResultCache")});var rE=v(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.IncrementalIndexer=void 0;ll.createIncrementalIndexer=G9;var q9={throttleMs:500,maxBatchSize:100,useContentHashing:!1},Mh=class{static{o(this,"IncrementalIndexer")}constructor(e={}){this.fileMetadata=new Map,this.pendingChanges=[],this.throttleTimer=null,this.invalidateCallbacks=[],this.lastIndexTime=0,this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]},this.options={...q9,...e}}recordChange(e){this.pendingChanges.push(e),this.stats.totalChanges++,this.throttleTimer===null&&(this.throttleTimer=setTimeout(()=>{this.processPendingChanges(),this.throttleTimer=null},this.options.throttleMs))}processPendingChanges(){if(this.pendingChanges.length===0)return;let e=performance.now(),t=new Map;for(let a of this.pendingChanges)t.set(a.path,a);let r=Array.from(t.values()),i=[];for(let a of r)switch(a.type){case"deleted":this.fileMetadata.delete(a.path),i.push(a);break;case"renamed":a.oldPath&&this.fileMetadata.delete(a.oldPath),i.push(a);break;case"created":case"modified":i.push(a);break}if(i.length>0){this.stats.invalidations+=i.length;for(let a of this.invalidateCallbacks)try{a(i)}catch(c){console.error("IncrementalIndexer: Error in invalidation callback:",c)}}let s=performance.now()-e;this.stats.indexDurations.push(s),this.stats.indexDurations.length>100&&this.stats.indexDurations.shift(),this.lastIndexTime=Date.now(),this.pendingChanges=[]}flush(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.processPendingChanges()}updateMetadata(e,t,r,i){this.fileMetadata.set(e,{mtime:t,size:r,contentHash:i})}hasChanged(e,t,r){let i=this.fileMetadata.get(e);return i===void 0||i.mtime!==t||r!==void 0&&i.size!==r}getChangedFiles(e){let t=[];for(let[r,i]of this.fileMetadata.entries())i.mtime>e&&t.push(r);return t}onInvalidate(e){return this.invalidateCallbacks.push(e),()=>{let t=this.invalidateCallbacks.indexOf(e);t!==-1&&this.invalidateCallbacks.splice(t,1)}}getStats(){let e=this.stats.indexDurations,t=e.length>0?e.reduce((i,s)=>i+s,0)/e.length:0,r=e.length>0?e[e.length-1]:0;return{trackedFiles:this.fileMetadata.size,totalChanges:this.stats.totalChanges,invalidations:this.stats.invalidations,noOpChanges:this.stats.noOpChanges,lastIndexDurationMs:r,avgIndexDurationMs:t,lastIndexTime:this.lastIndexTime}}resetStats(){this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]}}clear(){this.fileMetadata.clear(),this.pendingChanges=[],this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null)}size(){return this.fileMetadata.size}isTracked(e){return this.fileMetadata.has(e)}getMetadata(e){return this.fileMetadata.get(e)}dispose(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.invalidateCallbacks=[],this.pendingChanges=[],this.fileMetadata.clear()}};ll.IncrementalIndexer=Mh;function G9(n){return new Mh(n)}o(G9,"createIncrementalIndexer")});var nE=v(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.ResultSerializer=void 0;var jh=mt(),$h=We(),Vh=kt(),f1=class{static{o(this,"ResultSerializer")}serialize(e,t,r={}){switch(t){case"json":return this.serializeJSON(e,r);case"xml":return this.serializeXML(e,r);case"csv":return this.serializeCSV(e,r);case"turtle":return this.serializeTurtle(e,r);default:throw new Error(`Unsupported result format: ${t}`)}}serializeJSON(e,t={}){let r=this.toJSONResultSet(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}toJSONResultSet(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=e.map(a=>{let c={};for(let l of i){let u=a.get(l);u!==void 0&&(c[l]=this.termToJSONBinding(u))}return c});return{head:{vars:i},results:{bindings:s}}}termToJSONBinding(e){return e instanceof $h.IRI?{type:"uri",value:e.value}:e instanceof Vh.BlankNode?{type:"bnode",value:e.id}:e instanceof jh.Literal?this.literalToJSONBinding(e):{type:"literal",value:String(e)}}literalToJSONBinding(e){let t={type:"literal",value:e.value};return e.datatype?t.datatype=e.datatype.value:e.language&&(t["xml:lang"]=e.language,e.hasDirection()&&e.direction&&(t.direction=e.direction)),t}serializeXML(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=['<?xml version="1.0"?>','<sparql xmlns="http://www.w3.org/2005/sparql-results#">'," <head>"];for(let a of i)s.push(` <variable name="${this.escapeXML(a)}"/>`);s.push(" </head>"),s.push(" <results>");for(let a of e){s.push(" <result>");for(let c of i){let l=a.get(c);l!==void 0&&(s.push(` <binding name="${this.escapeXML(c)}">`),s.push(" "+this.termToXML(l)),s.push(" </binding>"))}s.push(" </result>")}return s.push(" </results>"),s.push("</sparql>"),s.join(`
|
|
337
|
+
${r}}`}generateValuesTerm(e){if(e.type==="iri")return`<${e.value}>`;let r=`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`;return e.language?r+=`@${e.language}`:e.datatype&&(r+=`^^<${e.datatype}>`),r}generateExpression(e){switch(e.type){case"variable":return`?${e.name}`;case"literal":return typeof e.value=="string"?`"${e.value.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:typeof e.value=="boolean"?e.value?"true":"false":String(e.value);case"comparison":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"logical":return e.operator==="!"?`!(${this.generateExpression(e.operands[0])})`:`(${e.operands.map(t=>this.generateExpression(t)).join(` ${e.operator} `)})`;case"arithmetic":return`(${this.generateExpression(e.left)} ${e.operator} ${this.generateExpression(e.right)})`;case"function":return`${e.function.toUpperCase()}(${e.args.map(t=>this.generateExpression(t)).join(", ")})`;case"functionCall":return`${(typeof e.function=="string"?e.function:e.function.value).toUpperCase()}(${e.args.map(r=>this.generateExpression(r)).join(", ")})`;case"exists":return`${e.negated?"NOT EXISTS":"EXISTS"} { ${this.generateWhereClause(e.pattern,0)} }`;case"in":{let t=this.generateExpression(e.expression),r=e.list.map(i=>this.generateExpression(i)).join(", ");return e.negated?`${t} NOT IN (${r})`:`${t} IN (${r})`}default:throw new No(`Unknown expression type: ${e.type}`)}}collectVariablesFromOperation(e,t){switch(e.type){case"bgp":for(let r of e.triples)this.collectVariablesFromTriple(r,t);break;case"filter":this.collectVariablesFromOperation(e.input,t),this.collectVariablesFromExpression(e.expression,t);break;case"join":case"leftjoin":case"union":case"minus":this.collectVariablesFromOperation(e.left,t),this.collectVariablesFromOperation(e.right,t);break;case"values":for(let r of e.variables)t.add(r);break;case"project":for(let r of e.variables)t.add(r);this.collectVariablesFromOperation(e.input,t);break;case"extend":t.add(e.variable),this.collectVariablesFromOperation(e.input,t);break;case"orderby":case"slice":case"distinct":case"reduced":this.collectVariablesFromOperation(e.input,t);break;case"group":for(let r of e.variables)t.add(r);for(let r of e.aggregates)t.add(r.variable);this.collectVariablesFromOperation(e.input,t);break;case"subquery":this.collectVariablesFromOperation(e.query,t);break}}collectVariablesFromTriple(e,t){e.subject.type==="variable"&&t.add(e.subject.value),"type"in e.predicate&&e.predicate.type==="variable"&&t.add(e.predicate.value),e.object.type==="variable"&&t.add(e.object.value)}collectVariablesFromExpression(e,t){switch(e.type){case"variable":t.add(e.name);break;case"comparison":case"arithmetic":this.collectVariablesFromExpression(e.left,t),this.collectVariablesFromExpression(e.right,t);break;case"logical":for(let r of e.operands)this.collectVariablesFromExpression(r,t);break;case"function":case"functionCall":for(let r of e.args)this.collectVariablesFromExpression(r,t);break;case"exists":this.collectVariablesFromOperation(e.pattern,t);break;case"in":this.collectVariablesFromExpression(e.expression,t);for(let r of e.list)this.collectVariablesFromExpression(r,t);break}}};Lo.SPARQLGenerator=i1});var Yw=v(En=>{"use strict";var EL=En&&En.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),TL=En&&En.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),xL=En&&En.__importStar||(function(){var n=o(function(e){return n=Object.getOwnPropertyNames||function(t){var r=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[r.length]=i);return r},n(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=n(e),i=0;i<r.length;i++)r[i]!=="default"&&EL(t,e,r[i]);return TL(t,e),t}})();Object.defineProperty(En,"__esModule",{value:!0});En.QueryExecutor=En.QueryExecutorError=void 0;var AL=jy(),CL=Th(),IL=By(),OL=Gy(),PL=jw(),RL=Vw(),FL=qw(),DL=Qy(),NL=Ww(),LL=zw(),kL=Qw(),ML=We(),ko=class extends Error{static{o(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};En.QueryExecutorError=ko;var s1=class{static{o(this,"QueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new AL.BGPExecutor(e),this.filterExecutor=new CL.FilterExecutor,this.optionalExecutor=new IL.OptionalExecutor,this.unionExecutor=new OL.UnionExecutor,this.minusExecutor=new PL.MinusExecutor,this.valuesExecutor=new RL.ValuesExecutor,this.aggregateExecutor=new FL.AggregateExecutor,this.constructExecutor=new DL.ConstructExecutor,this.serviceExecutor=new NL.ServiceExecutor(t.serviceConfig),this.graphExecutor=new LL.GraphExecutor(e),this.sparqlGenerator=new kL.SPARQLGenerator,this.filterExecutor.setExistsEvaluator(async(r,i)=>this.evaluateExistsPattern(r,i)),this.filterExecutor.setTripleStore(e)}async evaluateExistsPattern(e,t){for await(let r of this.execute(e))if(t.merge(r)!==null)return!0;return!1}async executeAll(e){let t=[];for await(let r of this.execute(e))t.push(r);return t}async*execute(e){switch(e.type){case"bgp":yield*this.executeBGP(e);break;case"filter":yield*this.executeFilter(e);break;case"join":yield*this.executeJoin(e);break;case"leftjoin":yield*this.executeLeftJoin(e);break;case"union":yield*this.executeUnion(e);break;case"minus":yield*this.executeMinus(e);break;case"values":yield*this.executeValues(e);break;case"project":yield*this.executeProject(e);break;case"orderby":yield*this.executeOrderBy(e);break;case"slice":yield*this.executeSlice(e);break;case"distinct":yield*this.executeDistinct(e);break;case"reduced":yield*this.executeReduced(e);break;case"group":yield*this.executeGroup(e);break;case"extend":yield*this.executeExtend(e);break;case"subquery":yield*this.executeSubquery(e);break;case"lateraljoin":yield*this.executeLateralJoin(e);break;case"service":yield*this.executeService(e);break;case"graph":yield*this.executeGraph(e);break;default:throw new ko(`Unknown operation type: ${e.type}`)}}async*executeBGP(e){yield*this.bgpExecutor.execute(e)}async*executeFilter(e){let t=this.execute(e.input);yield*this.filterExecutor.execute(e,t)}async*executeJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);if(t.length===0)return;let r=new Set;for(let a of t)for(let c of a.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(a=>i.has(a)))for(let a of t){let c=this.substituteVariables(e.right,a);for await(let l of this.execute(c)){let u=a.merge(l);u!==null&&(yield u)}}else{let a=[];for await(let c of this.execute(e.right))a.push(c);for(let c of t)for(let l of a){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let a of this.execute(e.left))t.push(a);let r=[];for await(let a of this.execute(e.right))r.push(a);async function*i(){for(let a of t)yield a}o(i,"leftGen");async function*s(){for(let a of r)yield a}o(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){for await(let t of this.execute(e.input))yield t}async*executeOrderBy(e){let t=[];for await(let r of this.execute(e.input))t.push(r);t.sort((r,i)=>{for(let s of e.comparators){let a=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(a===void 0&&c===void 0?l=0:a===void 0?l=1:c===void 0?l=-1:typeof a=="number"&&typeof c=="number"?l=a-c:l=String(a).localeCompare(String(c)),s.descending&&(l=-l),l!==0)return l}return 0});for(let r of t)yield r}async*executeSlice(e){let t=0,r=e.offset??0,i=e.limit;for await(let s of this.execute(e.input)){if(t>=r){if(i!==void 0&&t-r>=i)break;yield s}t++}}async*executeDistinct(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeReduced(e){let t=new Set;for await(let r of this.execute(e.input)){let i=this.getSolutionKey(r);t.has(i)||(t.add(i),yield r)}}async*executeGroup(e){let t=[];for await(let i of this.execute(e.input))t.push(i);let r=this.aggregateExecutor.execute(e,t);if(e.having&&e.having.length>0)for(let i of r)e.having.every(a=>this.filterExecutor.evaluateExpression(a,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){for await(let t of this.execute(e.input)){let r=t.clone(),i=this.evaluateExtendExpression(e.expression,t);i!==void 0&&r.set(e.variable,i),yield r}}async*executeSubquery(e){yield*this.execute(e.query)}async*executeLateralJoin(e){let t=[];for await(let r of this.execute(e.left))t.push(r);for(let r of t){let i=this.substituteVariables(e.right,r);for await(let s of this.execute(i)){let a=r.merge(s);a!==null&&(yield a)}}}substituteVariables(e,t){let r=JSON.parse(JSON.stringify(e));return this.substituteInOperation(r,t)}substituteInOperation(e,t){if(!e||typeof e!="object")return e;let r=e;return r.type==="bgp"&&r.triples?(r.triples=r.triples.map(i=>this.substituteInTriple(i,t)),r):(r.input&&(r.input=this.substituteInOperation(r.input,t)),r.left&&(r.left=this.substituteInOperation(r.left,t)),r.right&&(r.right=this.substituteInOperation(r.right,t)),r.pattern&&(r.pattern=this.substituteInOperation(r.pattern,t)),r.query&&(r.query=this.substituteInOperation(r.query,t)),r.where&&(r.where=this.substituteInOperation(r.where,t)),r.expression&&this.substituteInExpression(r.expression,t),r)}substituteInExpression(e,t){if(!(!e||typeof e!="object")){if(e.type==="exists"&&e.pattern&&(e.pattern=this.substituteInOperation(e.pattern,t)),e.left&&this.substituteInExpression(e.left,t),e.right&&this.substituteInExpression(e.right,t),e.operands)for(let r of e.operands)this.substituteInExpression(r,t);if(e.args)for(let r of e.args)this.substituteInExpression(r,t);if(e.expression&&this.substituteInExpression(e.expression,t),e.list)for(let r of e.list)this.substituteInExpression(r,t)}}substituteInTriple(e,t){return{subject:this.substituteInTripleElement(e.subject,t),predicate:e.predicate,object:this.substituteInTripleElement(e.object,t)}}substituteInTripleElement(e,t){if(e&&e.type==="variable"){let r=t.get(e.value);if(r!=null){if(r instanceof ML.IRI||r.termType==="NamedNode")return{type:"iri",value:r.value};if(r.termType==="Literal"||typeof r.value=="string"){let i=r;return{type:"literal",value:i.value,datatype:i.datatype?.value??i._datatype?.value,language:i.language??i._language}}}}return e}async*executeService(e){yield*this.serviceExecutor.execute(e,t=>this.sparqlGenerator.generateSelect(t))}async*executeGraph(e){let t=async function*(r,i){let s=this.currentGraphContext;this.currentGraphContext=i;try{r.type==="bgp"&&i&&this.tripleStore.matchInGraph?yield*this.executeBGPInGraph(r,i):yield*this.execute(r)}finally{this.currentGraphContext=s}}.bind(this);yield*this.graphExecutor.execute(e,t)}async*executeBGPInGraph(e,t){if(e.triples.length===0){let{SolutionMapping:r}=await Promise.resolve().then(()=>xL(es()));yield new r;return}yield*this.bgpExecutor.executeInGraph(e,t)}evaluateExtendExpression(e,t){if(e.type!=="aggregate")try{return this.filterExecutor.evaluateExpression(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);return r?r.value??r.id??String(r):void 0}return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!(!e||typeof e!="object")){if(e.type==="bgp"&&e.triples)for(let r of e.triples)this.collectVarsFromElement(r.subject,t),r.predicate?.type!=="path"&&this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t);if(e.type==="values"&&e.variables)for(let r of e.variables)t.add(r);e.expression&&this.collectVarsFromExpressionTree(e.expression,t),e.type==="extend"&&e.variable&&t.add(e.variable),e.input&&this.collectVarsFromOperation(e.input,t),e.left&&this.collectVarsFromOperation(e.left,t),e.right&&this.collectVarsFromOperation(e.right,t),e.pattern&&this.collectVarsFromOperation(e.pattern,t),e.query&&this.collectVarsFromOperation(e.query,t),e.where&&this.collectVarsFromOperation(e.where,t)}}collectVarsFromElement(e,t){e&&(e.type==="variable"&&t.add(e.value),e.type==="quoted"&&(this.collectVarsFromElement(e.subject,t),this.collectVarsFromElement(e.predicate,t),this.collectVarsFromElement(e.object,t)))}collectVarsFromExpressionTree(e,t){if(!(!e||typeof e!="object")){if(e.type==="variable"&&e.name&&t.add(e.name),e.type==="exists"&&e.pattern&&this.collectVarsFromOperation(e.pattern,t),e.left&&this.collectVarsFromExpressionTree(e.left,t),e.right&&this.collectVarsFromExpressionTree(e.right,t),e.operands)for(let r of e.operands)this.collectVarsFromExpressionTree(r,t);if(e.args)for(let r of e.args)this.collectVarsFromExpressionTree(r,t);if(e.expression&&this.collectVarsFromExpressionTree(e.expression,t),e.list)for(let r of e.list)this.collectVarsFromExpressionTree(r,t)}}getSolutionKey(e){let t=e.toJSON();return Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("|")}isConstructQuery(e){return e.type==="construct"}async executeConstruct(e){if(e.type!=="construct")throw new ko("executeConstruct requires a CONSTRUCT operation");let t=await this.executeAll(e.where);return this.constructExecutor.execute(e.template,t)}isAskQuery(e){return e.type==="ask"}async executeAsk(e){if(e.type!=="ask")throw new ko("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};En.QueryExecutor=s1});var Xw=v(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.UpdateExecutor=jo.UpdateExecutorError=void 0;var jL=_i(),Mo=We(),a1=mt(),Kw=kt(),_r=class extends Error{static{o(this,"UpdateExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="UpdateExecutorError"}};jo.UpdateExecutorError=_r;var o1=class{static{o(this,"UpdateExecutor")}constructor(e){this.tripleStore=e}async execute(e){if(e.type!=="update")throw new _r("Expected UPDATE request");let t=[];for(let r of e.updates){let i=await this.executeOperation(r);t.push(i)}return t}async executeOperation(e){if("updateType"in e)switch(e.updateType){case"insert":return this.executeInsertData(e);case"delete":return this.executeDeleteData(e);case"insertdelete":throw new _r("INSERT/DELETE with WHERE clause not yet implemented");case"deletewhere":throw new _r("DELETE WHERE not yet implemented");default:throw new _r(`Unknown update type: ${e.updateType}`)}if("type"in e)switch(e.type){case"clear":case"drop":case"load":case"create":case"copy":case"move":case"add":throw new _r(`${e.type.toUpperCase()} operation not yet implemented`);default:throw new _r(`Unknown operation type: ${e.type}`)}throw new _r("Unknown update operation structure")}async executeInsertData(e){if(e.updateType!=="insert")throw new _r("Expected INSERT DATA operation");let t=e,r=0;for(let i of t.insert)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.insertTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.insertTriples(s.triples,a)}return{type:"insert",inserted:r,success:!0}}async executeDeleteData(e){if(e.updateType!=="delete")throw new _r("Expected DELETE DATA operation");let t=e,r=0;for(let i of t.delete)if(i.type==="bgp"){let s=this.resolveGraphName(t.graph);r+=await this.deleteTriples(i.triples,s)}else if(i.type==="graph"){let s=i,a=this.parseGraphName(s.name);r+=await this.deleteTriples(s.triples,a)}return{type:"delete",deleted:r,success:!0}}async insertTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i);t&&this.tripleStore.addToGraph?await this.tripleStore.addToGraph(s,t):await this.tripleStore.add(s),r++}return r}async deleteTriples(e,t){let r=0;for(let i of e){let s=this.convertTriple(i),a;t&&this.tripleStore.removeFromGraph?a=await this.tripleStore.removeFromGraph(s,t):a=await this.tripleStore.remove(s),a&&r++}return r}convertTriple(e){return new jL.Triple(this.convertSubject(e.subject),this.convertPredicate(e.predicate),this.convertObject(e.object))}convertSubject(e){if(e.termType==="NamedNode")return new Mo.IRI(e.value);if(e.termType==="BlankNode")return new Kw.BlankNode(e.value);throw new _r(`Invalid subject term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}convertPredicate(e){if("termType"in e&&e.termType==="NamedNode")return new Mo.IRI(e.value);throw new _r("Invalid predicate term type. Only IRIs are allowed in INSERT DATA.")}convertObject(e){if(e.termType==="NamedNode")return new Mo.IRI(e.value);if(e.termType==="BlankNode")return new Kw.BlankNode(e.value);if(e.termType==="Literal"){let t=e;return t.language?new a1.Literal(t.value,void 0,t.language):t.datatype?new a1.Literal(t.value,new Mo.IRI(t.datatype.value)):new a1.Literal(t.value)}throw new _r(`Invalid object term type: ${e.termType}. Variables are not allowed in INSERT DATA.`)}resolveGraphName(e){if(e&&!e.default&&e.name)return new Mo.IRI(e.name.value)}parseGraphName(e){if(e.termType==="Variable")throw new _r("Variables are not allowed as graph names in INSERT DATA / DELETE DATA.");return new Mo.IRI(e.value)}};jo.UpdateExecutor=o1});var Zw=v(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.AggregateFunctions=void 0;var c1=mt(),Jw=We(),l1=class{static{o(this,"AggregateFunctions")}static count(e,t){if(!t)return e.length;let r=0;for(let i of e)i.has(t)&&r++;return r}static countDistinct(e,t){let r=new Set;for(let i of e){let s=i.get(t);s&&r.add(s.toString())}return r.size}static sum(e,t){let r=0;for(let i of e){let s=i.get(t);if(s instanceof c1.Literal){let a=this.toNumber(s);isNaN(a)||(r+=a)}}return r}static avg(e,t){let r=this.sum(e,t),i=this.count(e,t);return i>0?r/i:0}static min(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a<r)&&(r=a)}return r}static max(e,t){let r=null;for(let i of e){let s=i.get(t);if(!s)continue;let a=this.toComparable(s);(r===null||a>r)&&(r=a)}return r}static groupConcat(e,t,r=" "){let i=[];for(let s of e){let a=s.get(t);a&&(a instanceof c1.Literal||a instanceof Jw.IRI?i.push(a.value):i.push(a.toString()))}return i.join(r)}static sample(e,t){for(let r of e){let i=r.get(t);if(i)return this.toComparable(i)}return null}static sampleDistinct(e,t){return this.sample(e,t)}static toNumber(e){let t=e.datatype?.value;return t?.includes("#integer")||t?.includes("#decimal")||t?.includes("#double"),parseFloat(e.value)}static toComparable(e){if(e instanceof c1.Literal){let t=this.toNumber(e);return isNaN(t)?e.value:t}return e instanceof Jw.IRI?e.value:String(e)}};Nh.AggregateFunctions=l1});var eE=v(Lh=>{"use strict";Object.defineProperty(Lh,"__esModule",{value:!0});Lh.QueryPlanCache=void 0;var $L=Qf(),u1=class{static{o(this,"QueryPlanCache")}constructor(e=100){this.hits=0,this.misses=0,this.cache=new $L.LRUCache(e)}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r!==void 0?this.hits++:this.misses++,r}set(e,t){let r=this.normalizeQuery(e);this.cache.set(r,t)}has(e){let t=this.normalizeQuery(e);return this.cache.get(t)!==void 0}clear(){this.cache.clear()}getStats(){let e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,size:this.cache.size()}}resetStats(){this.hits=0,this.misses=0}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}};Lh.QueryPlanCache=u1});var tE=v(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.SPARQLResultCache=void 0;cl.createSPARQLResultCache=BL;var VL=Qf(),UL={maxSize:500,ttlMs:300*1e3,enableFileInvalidation:!0,maxResultSizeBytes:10*1024*1024},kh=class{static{o(this,"SPARQLResultCache")}constructor(e={}){this.fileToQueries=new Map,this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0},this.avgQueryTimeMs=100,this.options={...UL,...e},this.cache=new VL.LRUCache(this.options.maxSize)}normalizeQuery(e){return e.replace(/\s+/g," ").trim()}hashResult(e){return this.isTripleArray(e)?`T:${e.length}`:`S:${e.length}`}isTripleArray(e){return e.length>0&&"subject"in e[0]}estimateResultSize(e){return this.isTripleArray(e)?e.length*300:e.length*200}get(e){let t=this.normalizeQuery(e),r=this.cache.get(t);if(r===void 0){this.stats.misses++;return}if(Date.now()-r.timestamp>this.options.ttlMs){this.cache.set(t,void 0),this.stats.ttlInvalidations++,this.stats.misses++;return}return this.stats.hits++,this.stats.totalTimeSavedMs+=this.avgQueryTimeMs,r.result}set(e,t,r,i){if(this.estimateResultSize(t)>this.options.maxResultSizeBytes)return;i!==void 0&&(this.avgQueryTimeMs=(this.avgQueryTimeMs+i)/2);let a=this.normalizeQuery(e),c=r??new Set,l={result:t,timestamp:Date.now(),affectedFiles:c,resultHash:this.hashResult(t)};if(this.cache.size()>=this.options.maxSize&&this.stats.evictions++,this.cache.set(a,l),this.options.enableFileInvalidation)for(let f of c){let h=this.fileToQueries.get(f);h||(h=new Set,this.fileToQueries.set(f,h)),h.add(a)}}has(e){let t=this.normalizeQuery(e),r=this.cache.get(t);return r===void 0?!1:Date.now()-r.timestamp<=this.options.ttlMs}invalidateByFile(e){if(!this.options.enableFileInvalidation)return 0;let t=this.fileToQueries.get(e);if(!t)return 0;let r=0;for(let i of t)this.cache.set(i,void 0),r++,this.stats.fileInvalidations++;return this.fileToQueries.delete(e),r}clear(){this.cache.clear(),this.fileToQueries.clear()}getStats(){let e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{hits:this.stats.hits,misses:this.stats.misses,hitRate:t,size:this.cache.size(),maxSize:this.options.maxSize,evictions:this.stats.evictions,ttlInvalidations:this.stats.ttlInvalidations,fileInvalidations:this.stats.fileInvalidations,avgTimeSavedMs:this.stats.hits>0?this.stats.totalTimeSavedMs/this.stats.hits:0}}resetStats(){this.stats={hits:0,misses:0,evictions:0,ttlInvalidations:0,fileInvalidations:0,totalTimeSavedMs:0}}size(){return this.cache.size()}pruneExpired(){return 0}};cl.SPARQLResultCache=kh;function BL(n){return new kh(n)}o(BL,"createSPARQLResultCache")});var rE=v(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.IncrementalIndexer=void 0;ll.createIncrementalIndexer=GL;var qL={throttleMs:500,maxBatchSize:100,useContentHashing:!1},Mh=class{static{o(this,"IncrementalIndexer")}constructor(e={}){this.fileMetadata=new Map,this.pendingChanges=[],this.throttleTimer=null,this.invalidateCallbacks=[],this.lastIndexTime=0,this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]},this.options={...qL,...e}}recordChange(e){this.pendingChanges.push(e),this.stats.totalChanges++,this.throttleTimer===null&&(this.throttleTimer=setTimeout(()=>{this.processPendingChanges(),this.throttleTimer=null},this.options.throttleMs))}processPendingChanges(){if(this.pendingChanges.length===0)return;let e=performance.now(),t=new Map;for(let a of this.pendingChanges)t.set(a.path,a);let r=Array.from(t.values()),i=[];for(let a of r)switch(a.type){case"deleted":this.fileMetadata.delete(a.path),i.push(a);break;case"renamed":a.oldPath&&this.fileMetadata.delete(a.oldPath),i.push(a);break;case"created":case"modified":i.push(a);break}if(i.length>0){this.stats.invalidations+=i.length;for(let a of this.invalidateCallbacks)try{a(i)}catch(c){console.error("IncrementalIndexer: Error in invalidation callback:",c)}}let s=performance.now()-e;this.stats.indexDurations.push(s),this.stats.indexDurations.length>100&&this.stats.indexDurations.shift(),this.lastIndexTime=Date.now(),this.pendingChanges=[]}flush(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.processPendingChanges()}updateMetadata(e,t,r,i){this.fileMetadata.set(e,{mtime:t,size:r,contentHash:i})}hasChanged(e,t,r){let i=this.fileMetadata.get(e);return i===void 0||i.mtime!==t||r!==void 0&&i.size!==r}getChangedFiles(e){let t=[];for(let[r,i]of this.fileMetadata.entries())i.mtime>e&&t.push(r);return t}onInvalidate(e){return this.invalidateCallbacks.push(e),()=>{let t=this.invalidateCallbacks.indexOf(e);t!==-1&&this.invalidateCallbacks.splice(t,1)}}getStats(){let e=this.stats.indexDurations,t=e.length>0?e.reduce((i,s)=>i+s,0)/e.length:0,r=e.length>0?e[e.length-1]:0;return{trackedFiles:this.fileMetadata.size,totalChanges:this.stats.totalChanges,invalidations:this.stats.invalidations,noOpChanges:this.stats.noOpChanges,lastIndexDurationMs:r,avgIndexDurationMs:t,lastIndexTime:this.lastIndexTime}}resetStats(){this.stats={totalChanges:0,invalidations:0,noOpChanges:0,indexDurations:[]}}clear(){this.fileMetadata.clear(),this.pendingChanges=[],this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null)}size(){return this.fileMetadata.size}isTracked(e){return this.fileMetadata.has(e)}getMetadata(e){return this.fileMetadata.get(e)}dispose(){this.throttleTimer!==null&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.invalidateCallbacks=[],this.pendingChanges=[],this.fileMetadata.clear()}};ll.IncrementalIndexer=Mh;function GL(n){return new Mh(n)}o(GL,"createIncrementalIndexer")});var nE=v(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.ResultSerializer=void 0;var jh=mt(),$h=We(),Vh=kt(),f1=class{static{o(this,"ResultSerializer")}serialize(e,t,r={}){switch(t){case"json":return this.serializeJSON(e,r);case"xml":return this.serializeXML(e,r);case"csv":return this.serializeCSV(e,r);case"turtle":return this.serializeTurtle(e,r);default:throw new Error(`Unsupported result format: ${t}`)}}serializeJSON(e,t={}){let r=this.toJSONResultSet(e,t),i=t.pretty?t.indent??2:void 0;return JSON.stringify(r,null,i)}toJSONResultSet(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=e.map(a=>{let c={};for(let l of i){let u=a.get(l);u!==void 0&&(c[l]=this.termToJSONBinding(u))}return c});return{head:{vars:i},results:{bindings:s}}}termToJSONBinding(e){return e instanceof $h.IRI?{type:"uri",value:e.value}:e instanceof Vh.BlankNode?{type:"bnode",value:e.id}:e instanceof jh.Literal?this.literalToJSONBinding(e):{type:"literal",value:String(e)}}literalToJSONBinding(e){let t={type:"literal",value:e.value};return e.datatype?t.datatype=e.datatype.value:e.language&&(t["xml:lang"]=e.language,e.hasDirection()&&e.direction&&(t.direction=e.direction)),t}serializeXML(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=['<?xml version="1.0"?>','<sparql xmlns="http://www.w3.org/2005/sparql-results#">'," <head>"];for(let a of i)s.push(` <variable name="${this.escapeXML(a)}"/>`);s.push(" </head>"),s.push(" <results>");for(let a of e){s.push(" <result>");for(let c of i){let l=a.get(c);l!==void 0&&(s.push(` <binding name="${this.escapeXML(c)}">`),s.push(" "+this.termToXML(l)),s.push(" </binding>"))}s.push(" </result>")}return s.push(" </results>"),s.push("</sparql>"),s.join(`
|
|
338
338
|
`)}termToXML(e){return e instanceof $h.IRI?`<uri>${this.escapeXML(e.value)}</uri>`:e instanceof Vh.BlankNode?`<bnode>${this.escapeXML(e.id)}</bnode>`:e instanceof jh.Literal?this.literalToXML(e):`<literal>${this.escapeXML(String(e))}</literal>`}literalToXML(e){let t=this.escapeXML(e.value);if(e.datatype)return`<literal datatype="${this.escapeXML(e.datatype.value)}">${t}</literal>`;if(e.language){let r=`xml:lang="${this.escapeXML(e.language)}"`;return e.hasDirection()&&e.direction&&(r+=` direction="${e.direction}"`),`<literal ${r}>${t}</literal>`}return`<literal>${t}</literal>`}serializeCSV(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(i.map(a=>this.escapeCSV(a)).join(","));for(let a of e){let c=i.map(l=>{let u=a.get(l);return u===void 0?"":this.escapeCSV(this.termToCSV(u))});s.push(c.join(","))}return s.join(`
|
|
339
339
|
`)}termToCSV(e){return e instanceof $h.IRI?e.value:e instanceof Vh.BlankNode?`_:${e.id}`:e instanceof jh.Literal?this.literalToCSV(e):String(e)}literalToCSV(e){if(e.datatype)return`${e.value}^^<${e.datatype.value}>`;if(e.language){let t=e.language;return e.hasDirection()&&e.direction&&(t+=`--${e.direction}`),`${e.value}@${t}`}return e.value}serializeTurtle(e,t={}){let r=new Set;for(let a of e)for(let c of a.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(`# SPARQL Results - ${e.length} solution(s)`),s.push(`# Variables: ${i.join(", ")}`),s.push("");for(let a=0;a<e.length;a++){let c=e[a];s.push(`# Solution ${a+1}`);for(let l of i){let u=c.get(l);u!==void 0&&s.push(`?${l} = ${this.termToTurtle(u)}`)}s.push("")}return s.join(`
|
|
340
340
|
`).trimEnd()}termToTurtle(e){return e instanceof $h.IRI?`<${e.value}>`:e instanceof Vh.BlankNode?`_:${e.id}`:e instanceof jh.Literal?e.toString():`"${String(e)}"`}escapeXML(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}escapeCSV(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
341
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}};Uh.ResultSerializer=f1});var iE=v($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.FileAlreadyExistsError=$o.FileNotFoundError=void 0;var h1=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};$o.FileNotFoundError=h1;var d1=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};$o.FileAlreadyExistsError=d1});var sE=v(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.container=void 0;Ts.registerCoreServices=yL;Ts.createChildContainer=vL;Ts.getContainer=_L;Ts.resetContainer=bL;Pu();var ul=Ve();Object.defineProperty(Ts,"container",{enumerable:!0,get:o(function(){return ul.container},"get")});var ht=lt(),W9=Fg(),H9=xf(),z9=l0(),Q9=Af(),Y9=t0(),K9=Ng(),X9=Vg(),J9=jg(),Z9=Rf(),eL=Ff(),tL=Kg(),rL=Jg(),nL=n0(),iL=Qg(),sL=f0(),aL=m0(),oL=d0(),cL=Gg(),lL=Hg(),uL=o0(),fL=s0(),hL=ny(),dL=Bg(),pL=y0(),mL=_0(),gL=L0();function yL(n){let e=n||ul.container;e.registerSingleton(ht.DI_TOKENS.TaskFrontmatterGenerator,H9.TaskFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.DynamicFrontmatterGenerator,z9.DynamicFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.AlgorithmExtractor,Q9.AlgorithmExtractor),e.registerSingleton(ht.DI_TOKENS.EffortStatusWorkflow,Z9.EffortStatusWorkflow),e.registerSingleton(ht.DI_TOKENS.StatusTimestampService,eL.StatusTimestampService),e.registerSingleton(ht.DI_TOKENS.TaskStatusService,J9.TaskStatusService),e.registerSingleton(ht.DI_TOKENS.TaskCreationService,W9.TaskCreationService),e.registerSingleton(ht.DI_TOKENS.ProjectCreationService,K9.ProjectCreationService),e.registerSingleton(ht.DI_TOKENS.AreaCreationService,X9.AreaCreationService),e.registerSingleton(ht.DI_TOKENS.ClassCreationService,cL.ClassCreationService),e.registerSingleton(ht.DI_TOKENS.ConceptCreationService,lL.ConceptCreationService),e.registerSingleton(ht.DI_TOKENS.FleetingNoteCreationService,uL.FleetingNoteCreationService),e.registerSingleton(ht.DI_TOKENS.SupervisionCreationService,fL.SupervisionCreationService),e.registerSingleton(ht.DI_TOKENS.GenericAssetCreationService,mL.GenericAssetCreationService),e.registerSingleton(ht.DI_TOKENS.PropertyCleanupService,Y9.PropertyCleanupService),e.registerSingleton(ht.DI_TOKENS.FolderRepairService,tL.FolderRepairService),e.registerSingleton(ht.DI_TOKENS.LabelToAliasService,rL.LabelToAliasService),e.registerSingleton(ht.DI_TOKENS.RenameToUidService,nL.RenameToUidService),e.registerSingleton(ht.DI_TOKENS.PlanningService,sL.PlanningService),e.registerSingleton(ht.DI_TOKENS.EffortVotingService,iL.EffortVotingService),e.registerSingleton(ht.DI_TOKENS.SessionEventService,aL.SessionEventService),e.registerSingleton(ht.DI_TOKENS.AssetConversionService,oL.AssetConversionService),e.registerSingleton(ht.DI_TOKENS.NoteToRDFConverter,hL.NoteToRDFConverter),e.registerSingleton(ht.DI_TOKENS.AreaHierarchyBuilder,dL.AreaHierarchyBuilder),e.registerSingleton(ht.DI_TOKENS.URIConstructionService,pL.URIConstructionService),e.registerSingleton(ht.DI_TOKENS.CriticalityZoneService,gL.CriticalityZoneService)}o(yL,"registerCoreServices");function vL(){return ul.container.createChildContainer()}o(vL,"createChildContainer");function _L(){return ul.container}o(_L,"getContainer");function bL(){ul.container.reset()}o(bL,"resetContainer")});var p1=v(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.DEFAULT_COLORS=Vo.NODE_FLAGS=void 0;Vo.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};Vo.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var g1=v(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.StringTable=void 0;var m1=class n{static{o(this,"StringTable")}constructor(e){if(this.stringToIndex=new Map,this.strings=[],this.memoryBytes=0,e)for(let t of e)this.intern(t)}intern(e){let t=this.stringToIndex.get(e);if(t!==void 0)return t;let r=this.strings.length;return this.strings.push(e),this.stringToIndex.set(e,r),this.memoryBytes+=e.length*2+50,r}getIndex(e){return this.stringToIndex.get(e)??-1}getString(e){if(e<0||e>=this.strings.length)throw new RangeError(`StringTable index out of bounds: ${e}`);return this.strings[e]}has(e){return this.stringToIndex.has(e)}hasIndex(e){return e>=0&&e<this.strings.length}get size(){return this.strings.length}getMemoryBytes(){return this.memoryBytes}*entries(){for(let e=0;e<this.strings.length;e++)yield[e,this.strings[e]]}*values(){for(let e of this.strings)yield e}toArray(){return[...this.strings]}clear(){this.stringToIndex.clear(),this.strings=[],this.memoryBytes=0}static fromJSON(e){return new n(e)}toJSON(){return this.strings}internAll(e){return e.map(t=>this.intern(t))}getStrings(e){return e.map(t=>this.getString(t))}search(e){let t=typeof e=="string"?new RegExp(e):e,r=[];for(let i=0;i<this.strings.length;i++)t.test(this.strings[i])&&r.push([i,this.strings[i]]);return r}getStats(){let e=this.strings.reduce((t,r)=>t+r.length,0);return{count:this.strings.length,memoryBytes:this.memoryBytes,avgStringLength:this.strings.length>0?e/this.strings.length:0}}};Bh.StringTable=m1});var aE=v(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.CompactGraphStore=void 0;var qh=g1(),Qr=p1(),SL={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function y1(n,e){if(n===void 0)return e;if(typeof n=="number")return n;if(n.startsWith("#")){let t=n.slice(1);if(t.length===6)return parseInt(t,16)<<8|255;if(t.length===8)return parseInt(t,16)}return e}o(y1,"parseColor");var v1=class{static{o(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...SL,...e},this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity),this.uriTable=new qh.StringTable,this.labelTable=new qh.StringTable,this.typeTable=new qh.StringTable,this.predicateTable=new qh.StringTable}allocateNodeArrays(e){return{positions:new Float32Array(e*2),radii:new Float32Array(e),colors:new Uint32Array(e),types:new Uint16Array(e),flags:new Uint8Array(e)}}allocateEdgeArrays(e){return{sourceIndices:new Uint32Array(e),targetIndices:new Uint32Array(e),predicateIndices:new Uint16Array(e),widths:new Float32Array(e),colors:new Uint32Array(e)}}resizeNodeArrays(e){if(e<=this.nodeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateNodeArrays(e);t.positions.set(this.nodes.positions.subarray(0,this.nodeCount*2)),t.radii.set(this.nodes.radii.subarray(0,this.nodeCount)),t.colors.set(this.nodes.colors.subarray(0,this.nodeCount)),t.types.set(this.nodes.types.subarray(0,this.nodeCount)),t.flags.set(this.nodes.flags.subarray(0,this.nodeCount)),this.nodes=t,this.nodeCapacity=e}resizeEdgeArrays(e){if(e<=this.edgeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateEdgeArrays(e);t.sourceIndices.set(this.edges.sourceIndices.subarray(0,this.edgeCount)),t.targetIndices.set(this.edges.targetIndices.subarray(0,this.edgeCount)),t.predicateIndices.set(this.edges.predicateIndices.subarray(0,this.edgeCount)),t.widths.set(this.edges.widths.subarray(0,this.edgeCount)),t.colors.set(this.edges.colors.subarray(0,this.edgeCount)),this.edges=t,this.edgeCapacity=e}ensureNodeCapacity(e){let t=this.nodeCount+e;if(t>this.nodeCapacity){let r=Math.max(t,Math.floor(this.nodeCapacity*this.config.growthFactor));this.resizeNodeArrays(r)}}ensureEdgeCapacity(e){let t=this.edgeCount+e;if(t>this.edgeCapacity){let r=Math.max(t,Math.floor(this.edgeCapacity*this.config.growthFactor));this.resizeEdgeArrays(r)}}addNode(e){let t=this.nodeIdToIndex.get(e.id);if(t!==void 0)return this.updateNodeAt(t,e),t;this.ensureNodeCapacity(1);let r=this.nodeCount++,i=r*2;this.nodes.positions[i]=e.x??Math.random()*1e3-500,this.nodes.positions[i+1]=e.y??Math.random()*1e3-500,this.nodes.radii[r]=e.radius??8,this.nodes.colors[r]=y1(e.color,Qr.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=Qr.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=Qr.NODE_FLAGS.PINNED),e.isArchived&&(s|=Qr.NODE_FLAGS.ARCHIVED),this.nodes.flags[r]=s,this.nodeIdToIndex.set(e.id,r),this.indexToNodeId[r]=e.id,this.uriTable.intern(e.id),e.label&&this.labelTable.intern(e.label),r}updateNodeAt(e,t){let r=e*2;t.x!==void 0&&(this.nodes.positions[r]=t.x),t.y!==void 0&&(this.nodes.positions[r+1]=t.y),t.radius!==void 0&&(this.nodes.radii[e]=t.radius),t.color!==void 0&&(this.nodes.colors[e]=y1(t.color,Qr.DEFAULT_COLORS.NODE)),t.assetClass!==void 0&&(this.nodes.types[e]=this.typeTable.intern(t.assetClass));let i=this.nodes.flags[e];t.isPinned!==void 0&&(i=t.isPinned?i|Qr.NODE_FLAGS.PINNED:i&~Qr.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|Qr.NODE_FLAGS.ARCHIVED:i&~Qr.NODE_FLAGS.ARCHIVED),this.nodes.flags[e]=i}addEdge(e){let t=this.nodeIdToIndex.get(e.sourceId),r=this.nodeIdToIndex.get(e.targetId);if(t===void 0||r===void 0)return-1;let i=`${e.sourceId}->${e.targetId}:${e.predicate??"link"}`,s=this.edgeIdToIndex.get(i);if(s!==void 0)return s;this.ensureEdgeCapacity(1);let a=this.edgeCount++;return this.edges.sourceIndices[a]=t,this.edges.targetIndices[a]=r,this.edges.widths[a]=e.width??1,this.edges.colors[a]=y1(e.color,Qr.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[a]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[a]=0,this.edgeIdToIndex.set(i,a),a}addNodes(e){return this.ensureNodeCapacity(e.length),e.map(t=>this.addNode(t))}addEdges(e){return this.ensureEdgeCapacity(e.length),e.map(t=>this.addEdge(t))}loadChunk(e){let r=this.addNodes(e.nodes).filter(a=>a>=0).length,s=this.addEdges(e.edges).filter(a=>a>=0).length;return{nodesAdded:r,edgesAdded:s}}getNodePosition(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return null;let r=t*2;return{x:this.nodes.positions[r],y:this.nodes.positions[r+1]}}getNodePositionByIndex(e){let t=e*2;return{x:this.nodes.positions[t],y:this.nodes.positions[t+1]}}setNodePosition(e,t,r){let i=this.nodeIdToIndex.get(e);if(i===void 0)return!1;let s=i*2;return this.nodes.positions[s]=t,this.nodes.positions[s+1]=r,!0}setNodePositionByIndex(e,t,r){let i=e*2;this.nodes.positions[i]=t,this.nodes.positions[i+1]=r}updateNodePositions(e){let t=0;for(let[r,i]of e)this.setNodePosition(r,i.x,i.y)&&t++;return t}applyNodeUpdates(e){let t=performance.now(),r=0;for(let i of e){let s=i.index;if(!(s<0||s>=this.nodeCount)){if(i.x!==void 0||i.y!==void 0){let a=s*2;i.x!==void 0&&(this.nodes.positions[a]=i.x),i.y!==void 0&&(this.nodes.positions[a+1]=i.y)}i.radius!==void 0&&(this.nodes.radii[s]=i.radius),i.color!==void 0&&(this.nodes.colors[s]=i.color),i.setFlags!==void 0&&(this.nodes.flags[s]|=i.setFlags),i.clearFlags!==void 0&&(this.nodes.flags[s]&=~i.clearFlags),r++}}return{nodesUpdated:r,edgesUpdated:0,timeMs:performance.now()-t}}getNodeFlags(e){let t=this.nodeIdToIndex.get(e);return t===void 0?0:this.nodes.flags[t]}setNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]|=t,!0)}clearNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]&=~t,!0)}hasNodeFlag(e,t){return(this.getNodeFlags(e)&t)!==0}selectNode(e){return this.setNodeFlag(e,Qr.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,Qr.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~Qr.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&Qr.NODE_FLAGS.SELECTED&&e.push(this.indexToNodeId[t]);return e}getNodeId(e){return this.indexToNodeId[e]}getNodeIndex(e){return this.nodeIdToIndex.get(e)}hasNode(e){return this.nodeIdToIndex.has(e)}getNodeCount(){return this.nodeCount}getEdgeCount(){return this.edgeCount}getNodeEdges(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=[];for(let i=0;i<this.edgeCount;i++)this.edges.sourceIndices[i]===t?r.push({edgeIndex:i,isSource:!0}):this.edges.targetIndices[i]===t&&r.push({edgeIndex:i,isSource:!1});return r}getNeighbors(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=new Set;for(let i=0;i<this.edgeCount;i++)if(this.edges.sourceIndices[i]===t){let s=this.edges.targetIndices[i];r.add(this.indexToNodeId[s])}else if(this.edges.targetIndices[i]===t){let s=this.edges.sourceIndices[i];r.add(this.indexToNodeId[s])}return Array.from(r)}getRawArrays(){return{nodes:this.nodes,edges:this.edges,nodeCount:this.nodeCount,edgeCount:this.edgeCount}}getPositionsArray(){return this.nodes.positions.subarray(0,this.nodeCount*2)}getMemoryStats(){let e=this.nodeCapacity*2*4+this.nodeCapacity*4+this.nodeCapacity*4+this.nodeCapacity*2+this.nodeCapacity,t=this.edgeCapacity*4+this.edgeCapacity*4+this.edgeCapacity*2+this.edgeCapacity*4+this.edgeCapacity*4,r=this.uriTable.getMemoryBytes()+this.labelTable.getMemoryBytes()+this.typeTable.getMemoryBytes()+this.predicateTable.getMemoryBytes();return{nodeCount:this.nodeCount,edgeCount:this.edgeCount,nodeCapacity:this.nodeCapacity,edgeCapacity:this.edgeCapacity,nodeMemoryBytes:e,edgeMemoryBytes:t,stringTableBytes:r,totalBytes:e+t+r,internedStringCount:this.uriTable.size+this.labelTable.size+this.typeTable.size+this.predicateTable.size}}clear(){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex.clear(),this.indexToNodeId=[],this.edgeIdToIndex.clear(),this.uriTable.clear(),this.labelTable.clear(),this.typeTable.clear(),this.predicateTable.clear(),this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity)}getTypeTable(){return this.typeTable}getLabelTable(){return this.labelTable}getUriTable(){return this.uriTable}getPredicateTable(){return this.predicateTable}};Gh.CompactGraphStore=v1});var oE=v(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.MemoryPool=void 0;Bo.getGlobalPool=EL;Bo.resetGlobalPool=TL;var wL={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},Wh=class{static{o(this,"MemoryPool")}constructor(e){this.float32Pool=new Map,this.uint32Pool=new Map,this.uint16Pool=new Map,this.uint8Pool=new Map,this.stats={poolHits:0,poolMisses:0,pooledArrays:0,pooledMemory:0,returned:0,rejected:0},this.config={...wL,...e};for(let t of this.config.sizeBuckets)this.float32Pool.set(t,[]),this.uint32Pool.set(t,[]),this.uint16Pool.set(t,[]),this.uint8Pool.set(t,[])}getBucketSize(e){for(let t of this.config.sizeBuckets)if(t>=e)return t;return e}getFloat32(e){let t=this.getBucketSize(e),r=this.float32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Float32Array(t)}getUint32(e){let t=this.getBucketSize(e),r=this.uint32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint32Array(t)}getUint16(e){let t=this.getBucketSize(e),r=this.uint16Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*2;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint16Array(t)}getUint8(e){let t=this.getBucketSize(e),r=this.uint8Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint8Array(t)}releaseFloat32(e){this.releaseToPool(this.float32Pool,e,4)}releaseUint32(e){this.releaseToPool(this.uint32Pool,e,4)}releaseUint16(e){this.releaseToPool(this.uint16Pool,e,2)}releaseUint8(e){this.releaseToPool(this.uint8Pool,e,1)}releaseToPool(e,t,r){let i=t.length,s=e.get(i);if(s&&s.length<this.config.maxPooledArrays){if(this.config.autoCleanup&&this.stats.pooledMemory+i*r>this.config.maxPoolMemory){this.stats.rejected++;return}s.push(t),this.stats.returned++,this.stats.pooledArrays++,this.stats.pooledMemory+=i*r}else this.stats.rejected++}getStats(){return{...this.stats}}getHitRatio(){let e=this.stats.poolHits+this.stats.poolMisses;return e>0?this.stats.poolHits/e:0}clear(){for(let e of this.float32Pool.values())e.length=0;for(let e of this.uint32Pool.values())e.length=0;for(let e of this.uint16Pool.values())e.length=0;for(let e of this.uint8Pool.values())e.length=0;this.stats.pooledArrays=0,this.stats.pooledMemory=0}cleanup(e){if(this.stats.pooledMemory<=e)return;let t=[...this.config.sizeBuckets].sort((r,i)=>i-r);for(let r of t){if(this.stats.pooledMemory<=e)break;for(let[i,s]of[[this.float32Pool,4],[this.uint32Pool,4],[this.uint16Pool,2],[this.uint8Pool,1]]){let a=i.get(r);if(a)for(;a.length>0&&this.stats.pooledMemory>e;)a.pop(),this.stats.pooledArrays--,this.stats.pooledMemory-=r*s}}}resetStats(){this.stats.poolHits=0,this.stats.poolMisses=0,this.stats.returned=0,this.stats.rejected=0}};Bo.MemoryPool=Wh;var Uo=null;function EL(){return Uo||(Uo=new Wh),Uo}o(EL,"getGlobalPool");function TL(){Uo&&Uo.clear(),Uo=null}o(TL,"resetGlobalPool")});var cE=v(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.StreamingLoader=void 0;fl.createStreamingSource=AL;var xL={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},_1=class{static{o(this,"StreamingLoader")}constructor(e,t){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.progressCallbacks=[],this.abortController=null,this.store=e,this.config={...xL,...t}}getState(){return this.state}getProgress(){let e=this.totalChunks!==void 0&&this.totalChunks>0?this.chunksProcessed/this.totalChunks:0;return{currentChunk:this.chunksProcessed,totalChunks:this.totalChunks,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,progress:e,isComplete:this.state==="completed"}}onProgress(e){return this.progressCallbacks.push(e),()=>{let t=this.progressCallbacks.indexOf(e);t>=0&&this.progressCallbacks.splice(t,1)}}notifyProgress(){let e=this.getProgress();for(let t of this.progressCallbacks)t(e)}loadChunk(e){if(this.state==="error")throw new Error("Loader is in error state");this.state="loading",e.totalChunks!==void 0&&(this.totalChunks=e.totalChunks);for(let t of e.nodes)this.store.addNode(t),this.nodesLoaded++;for(let t of e.edges)this.store.addEdge(t)>=0?this.edgesLoaded++:this.pendingEdges.push(t);this.chunksProcessed++,e.isLast&&this.finishLoading(),this.notifyProgress()}finishLoading(){if(this.config.autoResolveEdges&&this.pendingEdges.length>0){for(let e of this.pendingEdges)this.store.addEdge(e)>=0&&this.edgesLoaded++;this.pendingEdges=[]}this.state="completed",this.notifyProgress()}async loadFromIterator(e){this.reset(),this.state="loading",this.abortController=new AbortController;try{for await(let r of e){if(this.abortController.signal.aborted){this.state="paused";return}this.loadChunk(r),this.config.chunkDelay>0&&await this.delay(this.config.chunkDelay)}this.state!=="completed"&&this.finishLoading()}catch(t){throw this.state="error",t}finally{this.abortController=null}}async loadFromArrays(e,t){let r=this.createChunks(e,t);await this.loadFromIterator(this.arrayToAsyncIterator(r))}createChunks(e,t){let r=[],{chunkSize:i}=this.config,s=Math.ceil(e.length/i),a=Array(s).fill(null).map(()=>[]);for(let c of t){let l=e.findIndex(u=>u.id===c.sourceId);if(l>=0){let u=Math.floor(l/i);a[u].push(c)}}for(let c=0;c<s;c++){let l=c*i,u=Math.min(l+i,e.length);r.push({chunkIndex:c,totalChunks:s,nodes:e.slice(l,u),edges:a[c],isLast:c===s-1})}return r}async*arrayToAsyncIterator(e){for(let t of e)yield t}delay(e){return new Promise(t=>setTimeout(t,e))}cancel(){this.abortController&&this.abortController.abort(),this.state="paused"}reset(){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.totalChunks=void 0,this.abortController=null}getPendingEdgeCount(){return this.pendingEdges.length}getStats(){return{state:this.state,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,chunksProcessed:this.chunksProcessed,totalChunks:this.totalChunks,pendingEdges:this.pendingEdges.length,storeStats:this.store.getMemoryStats()}}};fl.StreamingLoader=_1;async function*AL(n,e,t=1e3){let r=0,i=0,s;for(;;){let a=await e(n,r,t);if(a.totalCount!==void 0&&s===void 0&&(s=Math.ceil(a.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:a.nodes,edges:a.edges,isLast:!a.hasMore},!a.hasMore)break;r+=t,i++}}o(AL,"createStreamingSource")});var fE=v(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.createStreamingSource=Dt.StreamingLoader=Dt.resetGlobalPool=Dt.getGlobalPool=Dt.MemoryPool=Dt.CompactGraphStore=Dt.StringTable=Dt.DEFAULT_COLORS=Dt.NODE_FLAGS=void 0;var lE=p1();Object.defineProperty(Dt,"NODE_FLAGS",{enumerable:!0,get:o(function(){return lE.NODE_FLAGS},"get")});Object.defineProperty(Dt,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return lE.DEFAULT_COLORS},"get")});var CL=g1();Object.defineProperty(Dt,"StringTable",{enumerable:!0,get:o(function(){return CL.StringTable},"get")});var IL=aE();Object.defineProperty(Dt,"CompactGraphStore",{enumerable:!0,get:o(function(){return IL.CompactGraphStore},"get")});var b1=oE();Object.defineProperty(Dt,"MemoryPool",{enumerable:!0,get:o(function(){return b1.MemoryPool},"get")});Object.defineProperty(Dt,"getGlobalPool",{enumerable:!0,get:o(function(){return b1.getGlobalPool},"get")});Object.defineProperty(Dt,"resetGlobalPool",{enumerable:!0,get:o(function(){return b1.resetGlobalPool},"get")});var uE=cE();Object.defineProperty(Dt,"StreamingLoader",{enumerable:!0,get:o(function(){return uE.StreamingLoader},"get")});Object.defineProperty(Dt,"createStreamingSource",{enumerable:!0,get:o(function(){return uE.createStreamingSource},"get")})});var Ci=v(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.ErrorCode=void 0;var hE;(function(n){n[n.INVALID_INPUT=1e3]="INVALID_INPUT",n[n.INVALID_FORMAT=1001]="INVALID_FORMAT",n[n.MISSING_REQUIRED_FIELD=1002]="MISSING_REQUIRED_FIELD",n[n.INVALID_SCHEMA=1003]="INVALID_SCHEMA",n[n.NETWORK_ERROR=2e3]="NETWORK_ERROR",n[n.REQUEST_TIMEOUT=2001]="REQUEST_TIMEOUT",n[n.CONNECTION_FAILED=2002]="CONNECTION_FAILED",n[n.FILE_READ_ERROR=2003]="FILE_READ_ERROR",n[n.FILE_WRITE_ERROR=2004]="FILE_WRITE_ERROR",n[n.INVALID_STATE=3e3]="INVALID_STATE",n[n.INVALID_TRANSITION=3001]="INVALID_TRANSITION",n[n.OPERATION_FAILED=3002]="OPERATION_FAILED",n[n.CONCURRENT_MODIFICATION=3003]="CONCURRENT_MODIFICATION",n[n.PERMISSION_DENIED=4e3]="PERMISSION_DENIED",n[n.UNAUTHORIZED=4001]="UNAUTHORIZED",n[n.FORBIDDEN=4003]="FORBIDDEN",n[n.NOT_FOUND=5e3]="NOT_FOUND",n[n.RESOURCE_EXHAUSTED=5001]="RESOURCE_EXHAUSTED",n[n.ALREADY_EXISTS=5002]="ALREADY_EXISTS",n[n.UNKNOWN_ERROR=9e3]="UNKNOWN_ERROR",n[n.INTERNAL_ERROR=9001]="INTERNAL_ERROR"})(hE||(Hh.ErrorCode=hE={}))});var Ii=v(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.ApplicationError=void 0;var S1=class extends Error{static{o(this,"ApplicationError")}constructor(e,t){super(e),this.name=this.constructor.name,this.context=t,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
|
|
341
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}};Uh.ResultSerializer=f1});var iE=v($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.FileAlreadyExistsError=$o.FileNotFoundError=void 0;var h1=class extends Error{static{o(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};$o.FileNotFoundError=h1;var d1=class extends Error{static{o(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};$o.FileAlreadyExistsError=d1});var sE=v(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.container=void 0;Ts.registerCoreServices=y9;Ts.createChildContainer=v9;Ts.getContainer=_9;Ts.resetContainer=b9;Pu();var ul=Ve();Object.defineProperty(Ts,"container",{enumerable:!0,get:o(function(){return ul.container},"get")});var ht=lt(),WL=Fg(),HL=xf(),zL=l0(),QL=Af(),YL=t0(),KL=Ng(),XL=Vg(),JL=jg(),ZL=Rf(),e9=Ff(),t9=Kg(),r9=Jg(),n9=n0(),i9=Qg(),s9=f0(),a9=m0(),o9=d0(),c9=Gg(),l9=Hg(),u9=o0(),f9=s0(),h9=ny(),d9=Bg(),p9=y0(),m9=_0(),g9=L0();function y9(n){let e=n||ul.container;e.registerSingleton(ht.DI_TOKENS.TaskFrontmatterGenerator,HL.TaskFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.DynamicFrontmatterGenerator,zL.DynamicFrontmatterGenerator),e.registerSingleton(ht.DI_TOKENS.AlgorithmExtractor,QL.AlgorithmExtractor),e.registerSingleton(ht.DI_TOKENS.EffortStatusWorkflow,ZL.EffortStatusWorkflow),e.registerSingleton(ht.DI_TOKENS.StatusTimestampService,e9.StatusTimestampService),e.registerSingleton(ht.DI_TOKENS.TaskStatusService,JL.TaskStatusService),e.registerSingleton(ht.DI_TOKENS.TaskCreationService,WL.TaskCreationService),e.registerSingleton(ht.DI_TOKENS.ProjectCreationService,KL.ProjectCreationService),e.registerSingleton(ht.DI_TOKENS.AreaCreationService,XL.AreaCreationService),e.registerSingleton(ht.DI_TOKENS.ClassCreationService,c9.ClassCreationService),e.registerSingleton(ht.DI_TOKENS.ConceptCreationService,l9.ConceptCreationService),e.registerSingleton(ht.DI_TOKENS.FleetingNoteCreationService,u9.FleetingNoteCreationService),e.registerSingleton(ht.DI_TOKENS.SupervisionCreationService,f9.SupervisionCreationService),e.registerSingleton(ht.DI_TOKENS.GenericAssetCreationService,m9.GenericAssetCreationService),e.registerSingleton(ht.DI_TOKENS.PropertyCleanupService,YL.PropertyCleanupService),e.registerSingleton(ht.DI_TOKENS.FolderRepairService,t9.FolderRepairService),e.registerSingleton(ht.DI_TOKENS.LabelToAliasService,r9.LabelToAliasService),e.registerSingleton(ht.DI_TOKENS.RenameToUidService,n9.RenameToUidService),e.registerSingleton(ht.DI_TOKENS.PlanningService,s9.PlanningService),e.registerSingleton(ht.DI_TOKENS.EffortVotingService,i9.EffortVotingService),e.registerSingleton(ht.DI_TOKENS.SessionEventService,a9.SessionEventService),e.registerSingleton(ht.DI_TOKENS.AssetConversionService,o9.AssetConversionService),e.registerSingleton(ht.DI_TOKENS.NoteToRDFConverter,h9.NoteToRDFConverter),e.registerSingleton(ht.DI_TOKENS.AreaHierarchyBuilder,d9.AreaHierarchyBuilder),e.registerSingleton(ht.DI_TOKENS.URIConstructionService,p9.URIConstructionService),e.registerSingleton(ht.DI_TOKENS.CriticalityZoneService,g9.CriticalityZoneService)}o(y9,"registerCoreServices");function v9(){return ul.container.createChildContainer()}o(v9,"createChildContainer");function _9(){return ul.container}o(_9,"getContainer");function b9(){ul.container.reset()}o(b9,"resetContainer")});var p1=v(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.DEFAULT_COLORS=Vo.NODE_FLAGS=void 0;Vo.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};Vo.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var g1=v(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.StringTable=void 0;var m1=class n{static{o(this,"StringTable")}constructor(e){if(this.stringToIndex=new Map,this.strings=[],this.memoryBytes=0,e)for(let t of e)this.intern(t)}intern(e){let t=this.stringToIndex.get(e);if(t!==void 0)return t;let r=this.strings.length;return this.strings.push(e),this.stringToIndex.set(e,r),this.memoryBytes+=e.length*2+50,r}getIndex(e){return this.stringToIndex.get(e)??-1}getString(e){if(e<0||e>=this.strings.length)throw new RangeError(`StringTable index out of bounds: ${e}`);return this.strings[e]}has(e){return this.stringToIndex.has(e)}hasIndex(e){return e>=0&&e<this.strings.length}get size(){return this.strings.length}getMemoryBytes(){return this.memoryBytes}*entries(){for(let e=0;e<this.strings.length;e++)yield[e,this.strings[e]]}*values(){for(let e of this.strings)yield e}toArray(){return[...this.strings]}clear(){this.stringToIndex.clear(),this.strings=[],this.memoryBytes=0}static fromJSON(e){return new n(e)}toJSON(){return this.strings}internAll(e){return e.map(t=>this.intern(t))}getStrings(e){return e.map(t=>this.getString(t))}search(e){let t=typeof e=="string"?new RegExp(e):e,r=[];for(let i=0;i<this.strings.length;i++)t.test(this.strings[i])&&r.push([i,this.strings[i]]);return r}getStats(){let e=this.strings.reduce((t,r)=>t+r.length,0);return{count:this.strings.length,memoryBytes:this.memoryBytes,avgStringLength:this.strings.length>0?e/this.strings.length:0}}};Bh.StringTable=m1});var aE=v(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.CompactGraphStore=void 0;var qh=g1(),Qr=p1(),S9={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function y1(n,e){if(n===void 0)return e;if(typeof n=="number")return n;if(n.startsWith("#")){let t=n.slice(1);if(t.length===6)return parseInt(t,16)<<8|255;if(t.length===8)return parseInt(t,16)}return e}o(y1,"parseColor");var v1=class{static{o(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...S9,...e},this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity),this.uriTable=new qh.StringTable,this.labelTable=new qh.StringTable,this.typeTable=new qh.StringTable,this.predicateTable=new qh.StringTable}allocateNodeArrays(e){return{positions:new Float32Array(e*2),radii:new Float32Array(e),colors:new Uint32Array(e),types:new Uint16Array(e),flags:new Uint8Array(e)}}allocateEdgeArrays(e){return{sourceIndices:new Uint32Array(e),targetIndices:new Uint32Array(e),predicateIndices:new Uint16Array(e),widths:new Float32Array(e),colors:new Uint32Array(e)}}resizeNodeArrays(e){if(e<=this.nodeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateNodeArrays(e);t.positions.set(this.nodes.positions.subarray(0,this.nodeCount*2)),t.radii.set(this.nodes.radii.subarray(0,this.nodeCount)),t.colors.set(this.nodes.colors.subarray(0,this.nodeCount)),t.types.set(this.nodes.types.subarray(0,this.nodeCount)),t.flags.set(this.nodes.flags.subarray(0,this.nodeCount)),this.nodes=t,this.nodeCapacity=e}resizeEdgeArrays(e){if(e<=this.edgeCapacity)return;if(e>this.config.maxCapacity)throw new Error(`Cannot resize beyond max capacity (${this.config.maxCapacity})`);let t=this.allocateEdgeArrays(e);t.sourceIndices.set(this.edges.sourceIndices.subarray(0,this.edgeCount)),t.targetIndices.set(this.edges.targetIndices.subarray(0,this.edgeCount)),t.predicateIndices.set(this.edges.predicateIndices.subarray(0,this.edgeCount)),t.widths.set(this.edges.widths.subarray(0,this.edgeCount)),t.colors.set(this.edges.colors.subarray(0,this.edgeCount)),this.edges=t,this.edgeCapacity=e}ensureNodeCapacity(e){let t=this.nodeCount+e;if(t>this.nodeCapacity){let r=Math.max(t,Math.floor(this.nodeCapacity*this.config.growthFactor));this.resizeNodeArrays(r)}}ensureEdgeCapacity(e){let t=this.edgeCount+e;if(t>this.edgeCapacity){let r=Math.max(t,Math.floor(this.edgeCapacity*this.config.growthFactor));this.resizeEdgeArrays(r)}}addNode(e){let t=this.nodeIdToIndex.get(e.id);if(t!==void 0)return this.updateNodeAt(t,e),t;this.ensureNodeCapacity(1);let r=this.nodeCount++,i=r*2;this.nodes.positions[i]=e.x??Math.random()*1e3-500,this.nodes.positions[i+1]=e.y??Math.random()*1e3-500,this.nodes.radii[r]=e.radius??8,this.nodes.colors[r]=y1(e.color,Qr.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=Qr.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=Qr.NODE_FLAGS.PINNED),e.isArchived&&(s|=Qr.NODE_FLAGS.ARCHIVED),this.nodes.flags[r]=s,this.nodeIdToIndex.set(e.id,r),this.indexToNodeId[r]=e.id,this.uriTable.intern(e.id),e.label&&this.labelTable.intern(e.label),r}updateNodeAt(e,t){let r=e*2;t.x!==void 0&&(this.nodes.positions[r]=t.x),t.y!==void 0&&(this.nodes.positions[r+1]=t.y),t.radius!==void 0&&(this.nodes.radii[e]=t.radius),t.color!==void 0&&(this.nodes.colors[e]=y1(t.color,Qr.DEFAULT_COLORS.NODE)),t.assetClass!==void 0&&(this.nodes.types[e]=this.typeTable.intern(t.assetClass));let i=this.nodes.flags[e];t.isPinned!==void 0&&(i=t.isPinned?i|Qr.NODE_FLAGS.PINNED:i&~Qr.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|Qr.NODE_FLAGS.ARCHIVED:i&~Qr.NODE_FLAGS.ARCHIVED),this.nodes.flags[e]=i}addEdge(e){let t=this.nodeIdToIndex.get(e.sourceId),r=this.nodeIdToIndex.get(e.targetId);if(t===void 0||r===void 0)return-1;let i=`${e.sourceId}->${e.targetId}:${e.predicate??"link"}`,s=this.edgeIdToIndex.get(i);if(s!==void 0)return s;this.ensureEdgeCapacity(1);let a=this.edgeCount++;return this.edges.sourceIndices[a]=t,this.edges.targetIndices[a]=r,this.edges.widths[a]=e.width??1,this.edges.colors[a]=y1(e.color,Qr.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[a]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[a]=0,this.edgeIdToIndex.set(i,a),a}addNodes(e){return this.ensureNodeCapacity(e.length),e.map(t=>this.addNode(t))}addEdges(e){return this.ensureEdgeCapacity(e.length),e.map(t=>this.addEdge(t))}loadChunk(e){let r=this.addNodes(e.nodes).filter(a=>a>=0).length,s=this.addEdges(e.edges).filter(a=>a>=0).length;return{nodesAdded:r,edgesAdded:s}}getNodePosition(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return null;let r=t*2;return{x:this.nodes.positions[r],y:this.nodes.positions[r+1]}}getNodePositionByIndex(e){let t=e*2;return{x:this.nodes.positions[t],y:this.nodes.positions[t+1]}}setNodePosition(e,t,r){let i=this.nodeIdToIndex.get(e);if(i===void 0)return!1;let s=i*2;return this.nodes.positions[s]=t,this.nodes.positions[s+1]=r,!0}setNodePositionByIndex(e,t,r){let i=e*2;this.nodes.positions[i]=t,this.nodes.positions[i+1]=r}updateNodePositions(e){let t=0;for(let[r,i]of e)this.setNodePosition(r,i.x,i.y)&&t++;return t}applyNodeUpdates(e){let t=performance.now(),r=0;for(let i of e){let s=i.index;if(!(s<0||s>=this.nodeCount)){if(i.x!==void 0||i.y!==void 0){let a=s*2;i.x!==void 0&&(this.nodes.positions[a]=i.x),i.y!==void 0&&(this.nodes.positions[a+1]=i.y)}i.radius!==void 0&&(this.nodes.radii[s]=i.radius),i.color!==void 0&&(this.nodes.colors[s]=i.color),i.setFlags!==void 0&&(this.nodes.flags[s]|=i.setFlags),i.clearFlags!==void 0&&(this.nodes.flags[s]&=~i.clearFlags),r++}}return{nodesUpdated:r,edgesUpdated:0,timeMs:performance.now()-t}}getNodeFlags(e){let t=this.nodeIdToIndex.get(e);return t===void 0?0:this.nodes.flags[t]}setNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]|=t,!0)}clearNodeFlag(e,t){let r=this.nodeIdToIndex.get(e);return r===void 0?!1:(this.nodes.flags[r]&=~t,!0)}hasNodeFlag(e,t){return(this.getNodeFlags(e)&t)!==0}selectNode(e){return this.setNodeFlag(e,Qr.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,Qr.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~Qr.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&Qr.NODE_FLAGS.SELECTED&&e.push(this.indexToNodeId[t]);return e}getNodeId(e){return this.indexToNodeId[e]}getNodeIndex(e){return this.nodeIdToIndex.get(e)}hasNode(e){return this.nodeIdToIndex.has(e)}getNodeCount(){return this.nodeCount}getEdgeCount(){return this.edgeCount}getNodeEdges(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=[];for(let i=0;i<this.edgeCount;i++)this.edges.sourceIndices[i]===t?r.push({edgeIndex:i,isSource:!0}):this.edges.targetIndices[i]===t&&r.push({edgeIndex:i,isSource:!1});return r}getNeighbors(e){let t=this.nodeIdToIndex.get(e);if(t===void 0)return[];let r=new Set;for(let i=0;i<this.edgeCount;i++)if(this.edges.sourceIndices[i]===t){let s=this.edges.targetIndices[i];r.add(this.indexToNodeId[s])}else if(this.edges.targetIndices[i]===t){let s=this.edges.sourceIndices[i];r.add(this.indexToNodeId[s])}return Array.from(r)}getRawArrays(){return{nodes:this.nodes,edges:this.edges,nodeCount:this.nodeCount,edgeCount:this.edgeCount}}getPositionsArray(){return this.nodes.positions.subarray(0,this.nodeCount*2)}getMemoryStats(){let e=this.nodeCapacity*2*4+this.nodeCapacity*4+this.nodeCapacity*4+this.nodeCapacity*2+this.nodeCapacity,t=this.edgeCapacity*4+this.edgeCapacity*4+this.edgeCapacity*2+this.edgeCapacity*4+this.edgeCapacity*4,r=this.uriTable.getMemoryBytes()+this.labelTable.getMemoryBytes()+this.typeTable.getMemoryBytes()+this.predicateTable.getMemoryBytes();return{nodeCount:this.nodeCount,edgeCount:this.edgeCount,nodeCapacity:this.nodeCapacity,edgeCapacity:this.edgeCapacity,nodeMemoryBytes:e,edgeMemoryBytes:t,stringTableBytes:r,totalBytes:e+t+r,internedStringCount:this.uriTable.size+this.labelTable.size+this.typeTable.size+this.predicateTable.size}}clear(){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex.clear(),this.indexToNodeId=[],this.edgeIdToIndex.clear(),this.uriTable.clear(),this.labelTable.clear(),this.typeTable.clear(),this.predicateTable.clear(),this.nodeCapacity=this.config.initialNodeCapacity,this.edgeCapacity=this.config.initialEdgeCapacity,this.nodes=this.allocateNodeArrays(this.nodeCapacity),this.edges=this.allocateEdgeArrays(this.edgeCapacity)}getTypeTable(){return this.typeTable}getLabelTable(){return this.labelTable}getUriTable(){return this.uriTable}getPredicateTable(){return this.predicateTable}};Gh.CompactGraphStore=v1});var oE=v(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});Bo.MemoryPool=void 0;Bo.getGlobalPool=E9;Bo.resetGlobalPool=T9;var w9={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},Wh=class{static{o(this,"MemoryPool")}constructor(e){this.float32Pool=new Map,this.uint32Pool=new Map,this.uint16Pool=new Map,this.uint8Pool=new Map,this.stats={poolHits:0,poolMisses:0,pooledArrays:0,pooledMemory:0,returned:0,rejected:0},this.config={...w9,...e};for(let t of this.config.sizeBuckets)this.float32Pool.set(t,[]),this.uint32Pool.set(t,[]),this.uint16Pool.set(t,[]),this.uint8Pool.set(t,[])}getBucketSize(e){for(let t of this.config.sizeBuckets)if(t>=e)return t;return e}getFloat32(e){let t=this.getBucketSize(e),r=this.float32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Float32Array(t)}getUint32(e){let t=this.getBucketSize(e),r=this.uint32Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*4;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint32Array(t)}getUint16(e){let t=this.getBucketSize(e),r=this.uint16Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t*2;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint16Array(t)}getUint8(e){let t=this.getBucketSize(e),r=this.uint8Pool.get(t);if(r&&r.length>0){this.stats.poolHits++,this.stats.pooledArrays--,this.stats.pooledMemory-=t;let i=r.pop();return i.fill(0),i}return this.stats.poolMisses++,new Uint8Array(t)}releaseFloat32(e){this.releaseToPool(this.float32Pool,e,4)}releaseUint32(e){this.releaseToPool(this.uint32Pool,e,4)}releaseUint16(e){this.releaseToPool(this.uint16Pool,e,2)}releaseUint8(e){this.releaseToPool(this.uint8Pool,e,1)}releaseToPool(e,t,r){let i=t.length,s=e.get(i);if(s&&s.length<this.config.maxPooledArrays){if(this.config.autoCleanup&&this.stats.pooledMemory+i*r>this.config.maxPoolMemory){this.stats.rejected++;return}s.push(t),this.stats.returned++,this.stats.pooledArrays++,this.stats.pooledMemory+=i*r}else this.stats.rejected++}getStats(){return{...this.stats}}getHitRatio(){let e=this.stats.poolHits+this.stats.poolMisses;return e>0?this.stats.poolHits/e:0}clear(){for(let e of this.float32Pool.values())e.length=0;for(let e of this.uint32Pool.values())e.length=0;for(let e of this.uint16Pool.values())e.length=0;for(let e of this.uint8Pool.values())e.length=0;this.stats.pooledArrays=0,this.stats.pooledMemory=0}cleanup(e){if(this.stats.pooledMemory<=e)return;let t=[...this.config.sizeBuckets].sort((r,i)=>i-r);for(let r of t){if(this.stats.pooledMemory<=e)break;for(let[i,s]of[[this.float32Pool,4],[this.uint32Pool,4],[this.uint16Pool,2],[this.uint8Pool,1]]){let a=i.get(r);if(a)for(;a.length>0&&this.stats.pooledMemory>e;)a.pop(),this.stats.pooledArrays--,this.stats.pooledMemory-=r*s}}}resetStats(){this.stats.poolHits=0,this.stats.poolMisses=0,this.stats.returned=0,this.stats.rejected=0}};Bo.MemoryPool=Wh;var Uo=null;function E9(){return Uo||(Uo=new Wh),Uo}o(E9,"getGlobalPool");function T9(){Uo&&Uo.clear(),Uo=null}o(T9,"resetGlobalPool")});var cE=v(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.StreamingLoader=void 0;fl.createStreamingSource=A9;var x9={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},_1=class{static{o(this,"StreamingLoader")}constructor(e,t){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.progressCallbacks=[],this.abortController=null,this.store=e,this.config={...x9,...t}}getState(){return this.state}getProgress(){let e=this.totalChunks!==void 0&&this.totalChunks>0?this.chunksProcessed/this.totalChunks:0;return{currentChunk:this.chunksProcessed,totalChunks:this.totalChunks,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,progress:e,isComplete:this.state==="completed"}}onProgress(e){return this.progressCallbacks.push(e),()=>{let t=this.progressCallbacks.indexOf(e);t>=0&&this.progressCallbacks.splice(t,1)}}notifyProgress(){let e=this.getProgress();for(let t of this.progressCallbacks)t(e)}loadChunk(e){if(this.state==="error")throw new Error("Loader is in error state");this.state="loading",e.totalChunks!==void 0&&(this.totalChunks=e.totalChunks);for(let t of e.nodes)this.store.addNode(t),this.nodesLoaded++;for(let t of e.edges)this.store.addEdge(t)>=0?this.edgesLoaded++:this.pendingEdges.push(t);this.chunksProcessed++,e.isLast&&this.finishLoading(),this.notifyProgress()}finishLoading(){if(this.config.autoResolveEdges&&this.pendingEdges.length>0){for(let e of this.pendingEdges)this.store.addEdge(e)>=0&&this.edgesLoaded++;this.pendingEdges=[]}this.state="completed",this.notifyProgress()}async loadFromIterator(e){this.reset(),this.state="loading",this.abortController=new AbortController;try{for await(let r of e){if(this.abortController.signal.aborted){this.state="paused";return}this.loadChunk(r),this.config.chunkDelay>0&&await this.delay(this.config.chunkDelay)}this.state!=="completed"&&this.finishLoading()}catch(t){throw this.state="error",t}finally{this.abortController=null}}async loadFromArrays(e,t){let r=this.createChunks(e,t);await this.loadFromIterator(this.arrayToAsyncIterator(r))}createChunks(e,t){let r=[],{chunkSize:i}=this.config,s=Math.ceil(e.length/i),a=Array(s).fill(null).map(()=>[]);for(let c of t){let l=e.findIndex(u=>u.id===c.sourceId);if(l>=0){let u=Math.floor(l/i);a[u].push(c)}}for(let c=0;c<s;c++){let l=c*i,u=Math.min(l+i,e.length);r.push({chunkIndex:c,totalChunks:s,nodes:e.slice(l,u),edges:a[c],isLast:c===s-1})}return r}async*arrayToAsyncIterator(e){for(let t of e)yield t}delay(e){return new Promise(t=>setTimeout(t,e))}cancel(){this.abortController&&this.abortController.abort(),this.state="paused"}reset(){this.state="idle",this.pendingEdges=[],this.nodesLoaded=0,this.edgesLoaded=0,this.chunksProcessed=0,this.totalChunks=void 0,this.abortController=null}getPendingEdgeCount(){return this.pendingEdges.length}getStats(){return{state:this.state,nodesLoaded:this.nodesLoaded,edgesLoaded:this.edgesLoaded,chunksProcessed:this.chunksProcessed,totalChunks:this.totalChunks,pendingEdges:this.pendingEdges.length,storeStats:this.store.getMemoryStats()}}};fl.StreamingLoader=_1;async function*A9(n,e,t=1e3){let r=0,i=0,s;for(;;){let a=await e(n,r,t);if(a.totalCount!==void 0&&s===void 0&&(s=Math.ceil(a.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:a.nodes,edges:a.edges,isLast:!a.hasMore},!a.hasMore)break;r+=t,i++}}o(A9,"createStreamingSource")});var fE=v(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.createStreamingSource=Dt.StreamingLoader=Dt.resetGlobalPool=Dt.getGlobalPool=Dt.MemoryPool=Dt.CompactGraphStore=Dt.StringTable=Dt.DEFAULT_COLORS=Dt.NODE_FLAGS=void 0;var lE=p1();Object.defineProperty(Dt,"NODE_FLAGS",{enumerable:!0,get:o(function(){return lE.NODE_FLAGS},"get")});Object.defineProperty(Dt,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return lE.DEFAULT_COLORS},"get")});var C9=g1();Object.defineProperty(Dt,"StringTable",{enumerable:!0,get:o(function(){return C9.StringTable},"get")});var I9=aE();Object.defineProperty(Dt,"CompactGraphStore",{enumerable:!0,get:o(function(){return I9.CompactGraphStore},"get")});var b1=oE();Object.defineProperty(Dt,"MemoryPool",{enumerable:!0,get:o(function(){return b1.MemoryPool},"get")});Object.defineProperty(Dt,"getGlobalPool",{enumerable:!0,get:o(function(){return b1.getGlobalPool},"get")});Object.defineProperty(Dt,"resetGlobalPool",{enumerable:!0,get:o(function(){return b1.resetGlobalPool},"get")});var uE=cE();Object.defineProperty(Dt,"StreamingLoader",{enumerable:!0,get:o(function(){return uE.StreamingLoader},"get")});Object.defineProperty(Dt,"createStreamingSource",{enumerable:!0,get:o(function(){return uE.createStreamingSource},"get")})});var Ci=v(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.ErrorCode=void 0;var hE;(function(n){n[n.INVALID_INPUT=1e3]="INVALID_INPUT",n[n.INVALID_FORMAT=1001]="INVALID_FORMAT",n[n.MISSING_REQUIRED_FIELD=1002]="MISSING_REQUIRED_FIELD",n[n.INVALID_SCHEMA=1003]="INVALID_SCHEMA",n[n.NETWORK_ERROR=2e3]="NETWORK_ERROR",n[n.REQUEST_TIMEOUT=2001]="REQUEST_TIMEOUT",n[n.CONNECTION_FAILED=2002]="CONNECTION_FAILED",n[n.FILE_READ_ERROR=2003]="FILE_READ_ERROR",n[n.FILE_WRITE_ERROR=2004]="FILE_WRITE_ERROR",n[n.INVALID_STATE=3e3]="INVALID_STATE",n[n.INVALID_TRANSITION=3001]="INVALID_TRANSITION",n[n.OPERATION_FAILED=3002]="OPERATION_FAILED",n[n.CONCURRENT_MODIFICATION=3003]="CONCURRENT_MODIFICATION",n[n.PERMISSION_DENIED=4e3]="PERMISSION_DENIED",n[n.UNAUTHORIZED=4001]="UNAUTHORIZED",n[n.FORBIDDEN=4003]="FORBIDDEN",n[n.NOT_FOUND=5e3]="NOT_FOUND",n[n.RESOURCE_EXHAUSTED=5001]="RESOURCE_EXHAUSTED",n[n.ALREADY_EXISTS=5002]="ALREADY_EXISTS",n[n.UNKNOWN_ERROR=9e3]="UNKNOWN_ERROR",n[n.INTERNAL_ERROR=9001]="INTERNAL_ERROR"})(hE||(Hh.ErrorCode=hE={}))});var Ii=v(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.ApplicationError=void 0;var S1=class extends Error{static{o(this,"ApplicationError")}constructor(e,t){super(e),this.name=this.constructor.name,this.context=t,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}format(){let e=`\u274C ${this.name}: ${this.message}`;if(this.guidance&&(e+=`
|
|
342
342
|
|
|
343
343
|
\u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
|
|
344
344
|
|
|
345
345
|
\u{1F4CB} Context:`;for(let[t,r]of Object.entries(this.context))e+=`
|
|
346
|
-
${t}: ${JSON.stringify(r)}`}return e}toJSON(){return{name:this.name,message:this.message,code:this.code,retriable:this.retriable,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}};zh.ApplicationError=S1});var dE=v(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.ValidationError=void 0;var
|
|
346
|
+
${t}: ${JSON.stringify(r)}`}return e}toJSON(){return{name:this.name,message:this.message,code:this.code,retriable:this.retriable,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}};zh.ApplicationError=S1});var dE=v(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.ValidationError=void 0;var O9=Ii(),P9=Ci(),w1=class extends O9.ApplicationError{static{o(this,"ValidationError")}constructor(e,t){super(e,t),this.code=P9.ErrorCode.INVALID_INPUT,this.retriable=!1,this.guidance=`Check the input data for correctness.
|
|
347
347
|
Common issues:
|
|
348
348
|
\u2022 Missing required fields
|
|
349
349
|
\u2022 Invalid data format or type
|
|
350
350
|
\u2022 Values outside allowed range
|
|
351
|
-
\u2022 Schema validation failed`}};Qh.ValidationError=w1});var pE=v(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.NetworkError=void 0;var
|
|
351
|
+
\u2022 Schema validation failed`}};Qh.ValidationError=w1});var pE=v(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.NetworkError=void 0;var R9=Ii(),F9=Ci(),E1=class extends R9.ApplicationError{static{o(this,"NetworkError")}constructor(e,t){super(e,t),this.code=F9.ErrorCode.NETWORK_ERROR,this.retriable=!0,this.guidance=`This is typically a transient network issue.
|
|
352
352
|
To resolve:
|
|
353
353
|
\u2022 Check your internet connection
|
|
354
354
|
\u2022 Retry the operation
|
|
355
355
|
\u2022 Verify external services are available
|
|
356
|
-
\u2022 Check firewall/proxy settings`}};Yh.NetworkError=E1});var mE=v(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.StateTransitionError=void 0;var
|
|
356
|
+
\u2022 Check firewall/proxy settings`}};Yh.NetworkError=E1});var mE=v(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.StateTransitionError=void 0;var D9=Ii(),N9=Ci(),T1=class extends D9.ApplicationError{static{o(this,"StateTransitionError")}constructor(e,t){super(e,t),this.code=N9.ErrorCode.INVALID_TRANSITION,this.retriable=!1,this.guidance=`The requested state transition is not allowed.
|
|
357
357
|
To fix:
|
|
358
358
|
\u2022 Check the current state of the resource
|
|
359
359
|
\u2022 Verify the transition is valid for this workflow
|
|
360
360
|
\u2022 Review state machine documentation
|
|
361
|
-
\u2022 Ensure no concurrent modifications occurred`}};Kh.StateTransitionError=T1});var gE=v(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.PermissionError=void 0;var
|
|
361
|
+
\u2022 Ensure no concurrent modifications occurred`}};Kh.StateTransitionError=T1});var gE=v(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.PermissionError=void 0;var L9=Ii(),k9=Ci(),x1=class extends L9.ApplicationError{static{o(this,"PermissionError")}constructor(e,t){super(e,t),this.code=k9.ErrorCode.PERMISSION_DENIED,this.retriable=!1,this.guidance=`You don't have permission to perform this operation.
|
|
362
362
|
To resolve:
|
|
363
363
|
\u2022 Check file/directory permissions
|
|
364
364
|
\u2022 Verify you're authenticated
|
|
365
365
|
\u2022 Ensure you have sufficient privileges
|
|
366
|
-
\u2022 Contact administrator if access is needed`}};Xh.PermissionError=x1});var yE=v(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.NotFoundError=void 0;var
|
|
366
|
+
\u2022 Contact administrator if access is needed`}};Xh.PermissionError=x1});var yE=v(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.NotFoundError=void 0;var M9=Ii(),j9=Ci(),A1=class extends M9.ApplicationError{static{o(this,"NotFoundError")}constructor(e,t){super(e,t),this.code=j9.ErrorCode.NOT_FOUND,this.retriable=!1,this.guidance=`The requested resource could not be found.
|
|
367
367
|
To resolve:
|
|
368
368
|
\u2022 Verify the resource path/ID is correct
|
|
369
369
|
\u2022 Check the resource exists
|
|
370
370
|
\u2022 Ensure proper file extension (.md for notes)
|
|
371
|
-
\u2022 Verify resource hasn't been deleted`}};Jh.NotFoundError=A1});var vE=v(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.ResourceExhaustedError=void 0;var $
|
|
371
|
+
\u2022 Verify resource hasn't been deleted`}};Jh.NotFoundError=A1});var vE=v(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.ResourceExhaustedError=void 0;var $9=Ii(),V9=Ci(),C1=class extends $9.ApplicationError{static{o(this,"ResourceExhaustedError")}constructor(e,t){super(e,t),this.code=V9.ErrorCode.RESOURCE_EXHAUSTED,this.retriable=!0,this.guidance=`A resource limit has been exceeded.
|
|
372
372
|
To resolve:
|
|
373
373
|
\u2022 Free up system resources (memory, disk space)
|
|
374
374
|
\u2022 Reduce the size of your request
|
|
375
375
|
\u2022 Wait and retry (for rate limits)
|
|
376
376
|
\u2022 Close unused files/connections
|
|
377
|
-
\u2022 Paginate large queries`}};Zh.ResourceExhaustedError=C1});var _E=v(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.ServiceError=void 0;var
|
|
377
|
+
\u2022 Paginate large queries`}};Zh.ResourceExhaustedError=C1});var _E=v(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});ed.ServiceError=void 0;var U9=Ii(),B9=Ci(),I1=class extends U9.ApplicationError{static{o(this,"ServiceError")}constructor(e,t){super(e,t),this.code=B9.ErrorCode.INTERNAL_ERROR,this.retriable=!1,this.guidance=`This is an internal service error.
|
|
378
378
|
To resolve:
|
|
379
379
|
\u2022 Check service initialization parameters
|
|
380
380
|
\u2022 Verify all required dependencies are available
|
|
381
381
|
\u2022 Review service logs for detailed error information
|
|
382
|
-
\u2022 Contact support if the issue persists`}};ed.ServiceError=I1});var bE=v(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.ServiceError=Nt.ResourceExhaustedError=Nt.NotFoundError=Nt.PermissionError=Nt.StateTransitionError=Nt.NetworkError=Nt.ValidationError=Nt.ApplicationError=Nt.ErrorCode=void 0;var
|
|
383
|
-
`)}calculateDelay(e){let t=this.retryConfig.initialDelayMs*Math.pow(this.retryConfig.backoffMultiplier,e);return Math.min(t,this.retryConfig.maxDelayMs)}sleep(e){return new Promise(t=>setTimeout(t,e))}callTelemetryHooks(e,...t){for(let r of this.telemetryHooks)try{let i=r[e];i&&i.apply(r,t)}catch(i){console.error("Error in telemetry hook:",i)}}};td.ApplicationErrorHandler=P1});var wE=v(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.ApplicationErrorHandler=void 0;var ZL=SE();Object.defineProperty(rd,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return ZL.ApplicationErrorHandler},"get")})});var ar=v(y=>{"use strict";var e6=y&&y.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Tn=y&&y.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&e6(e,n,t)};Object.defineProperty(y,"__esModule",{value:!0});y.fillTemplate=y.findMatchingTemplates=y.findClassByTerm=y.KNOWN_CLASSES=y.KNOWN_PROTOTYPES=y.EFFORT_STATUSES=y.ASSET_CLASSES=y.PREDICATES=y.SPARQL_PREFIXES=y.SPARQL_TEMPLATES=y.DEFAULT_NL_TO_SPARQL_CONFIG=y.NLToSPARQLService=y.TypeRegistry=y.GraphQueryService=y.DEFAULT_SEMANTIC_SEARCH_CONFIG=y.SemanticSearchService=y.DEFAULT_VECTOR_STORE_CONFIG=y.VectorStore=y.DEFAULT_EMBEDDING_CONFIG=y.EmbeddingService=y.GenericAssetCreationService=y.URIConstructionService=y.SessionEventService=y.AssetConversionService=y.PlanningService=y.AlgorithmExtractor=y.DynamicFrontmatterGenerator=y.TaskFrontmatterGenerator=y.FleetingNoteCreationService=y.SupervisionCreationService=y.StatusTimestampService=y.RenameToUidService=y.PropertyCleanupService=y.LoggingService=y.LabelToAliasService=y.FolderRepairService=y.EffortVotingService=y.EffortStatusWorkflow=y.ConceptCreationService=y.ClassCreationService=y.AreaHierarchyBuilder=y.AreaCreationService=y.TaskStatusService=y.ProjectCreationService=y.TaskCreationService=y.extractPropertyLabel=y.uriToPropertyName=y.propertyNameToUri=y.rangeToFieldType=y.PropertyFieldType=void 0;y.getNumericValue=y.createPercentileAggregate=y.modeAggregate=y.stddevAggregate=y.varianceAggregate=y.medianAggregate=y.EXO_AGGREGATE_NS=y.BUILT_IN_AGGREGATES=y.CustomAggregateError=y.CustomAggregateRegistry=y.AggregateFunctions=y.BuiltInFunctions=y.SolutionMapping=y.UpdateExecutorError=y.UpdateExecutor=y.QueryExecutor=y.DescribeExecutor=y.ConstructExecutor=y.UnionExecutor=y.OptionalExecutor=y.FilterExecutor=y.BGPExecutor=y.AlgebraSerializer=y.AlgebraOptimizer=y.AlgebraTranslator=y.DescribeOptionsTransformerError=y.DescribeOptionsTransformer=y.SPARQLParseError=y.SPARQLParser=y.NoteToRDFConverter=y.RDFSInferenceEngine=y.RDFVocabularyMapper=y.InMemoryTripleStore=y.RDFSerializer=y.FilenameValidator=y.EffortSortingHelpers=y.MetadataExtractor=y.MetadataHelpers=y.WikiLinkHelpers=y.DateFormatter=y.FrontmatterService=y.CriticalityZoneUUIDs=y.CriticalityZoneService=y.DailyReviewService=y.DEFAULT_AUTOCOMPLETE_CONFIG=y.AutocompleteService=y.TrendDetectionService=y.AnalyticsService=y.getTemplateByName=y.validateParameters=void 0;y.createStreamingSource=y.StreamingLoader=y.resetGlobalPool=y.getGlobalPool=y.MemoryPool=y.CompactGraphStore=y.StringTable=y.DEFAULT_COLORS=y.NODE_FLAGS=y.container=y.resetContainer=y.getContainer=y.createChildContainer=y.registerCoreServices=y.DI_TOKENS=y.TransactionError=y.TripleNotFoundError=y.TripleAlreadyExistsError=y.FileAlreadyExistsError=y.FileNotFoundError=y.FilterContainsOptimizer=y.VaultPrefixTransformer=y.CaseWhenTransformerError=y.CaseWhenTransformer=y.ResultSerializer=y.createIncrementalIndexer=y.IncrementalIndexer=y.createSPARQLResultCache=y.SPARQLResultCache=y.QueryPlanCache=y.createDoubleLiteral=y.createDecimalLiteral=void 0;Tn(em(),y);Tn(tm(),y);Tn(E_(),y);Tn(T_(),y);Tn(rm(),y);Tn(nm(),y);Tn(A_(),y);Tn(O_(),y);Tn(jm(),y);Tn(yb(),y);var EE=Bm();Object.defineProperty(y,"PropertyFieldType",{enumerable:!0,get:o(function(){return EE.PropertyFieldType},"get")});Object.defineProperty(y,"rangeToFieldType",{enumerable:!0,get:o(function(){return EE.rangeToFieldType},"get")});var R1=bb();Object.defineProperty(y,"propertyNameToUri",{enumerable:!0,get:o(function(){return R1.propertyNameToUri},"get")});Object.defineProperty(y,"uriToPropertyName",{enumerable:!0,get:o(function(){return R1.uriToPropertyName},"get")});Object.defineProperty(y,"extractPropertyLabel",{enumerable:!0,get:o(function(){return R1.extractPropertyLabel},"get")});var t6=Fg();Object.defineProperty(y,"TaskCreationService",{enumerable:!0,get:o(function(){return t6.TaskCreationService},"get")});var r6=Ng();Object.defineProperty(y,"ProjectCreationService",{enumerable:!0,get:o(function(){return r6.ProjectCreationService},"get")});var n6=jg();Object.defineProperty(y,"TaskStatusService",{enumerable:!0,get:o(function(){return n6.TaskStatusService},"get")});var i6=Vg();Object.defineProperty(y,"AreaCreationService",{enumerable:!0,get:o(function(){return i6.AreaCreationService},"get")});var s6=Bg();Object.defineProperty(y,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return s6.AreaHierarchyBuilder},"get")});var a6=Gg();Object.defineProperty(y,"ClassCreationService",{enumerable:!0,get:o(function(){return a6.ClassCreationService},"get")});var o6=Hg();Object.defineProperty(y,"ConceptCreationService",{enumerable:!0,get:o(function(){return o6.ConceptCreationService},"get")});var c6=Rf();Object.defineProperty(y,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return c6.EffortStatusWorkflow},"get")});var l6=Qg();Object.defineProperty(y,"EffortVotingService",{enumerable:!0,get:o(function(){return l6.EffortVotingService},"get")});var u6=Kg();Object.defineProperty(y,"FolderRepairService",{enumerable:!0,get:o(function(){return u6.FolderRepairService},"get")});var f6=Jg();Object.defineProperty(y,"LabelToAliasService",{enumerable:!0,get:o(function(){return f6.LabelToAliasService},"get")});var h6=la();Object.defineProperty(y,"LoggingService",{enumerable:!0,get:o(function(){return h6.LoggingService},"get")});var d6=t0();Object.defineProperty(y,"PropertyCleanupService",{enumerable:!0,get:o(function(){return d6.PropertyCleanupService},"get")});var p6=n0();Object.defineProperty(y,"RenameToUidService",{enumerable:!0,get:o(function(){return p6.RenameToUidService},"get")});var m6=Ff();Object.defineProperty(y,"StatusTimestampService",{enumerable:!0,get:o(function(){return m6.StatusTimestampService},"get")});var g6=s0();Object.defineProperty(y,"SupervisionCreationService",{enumerable:!0,get:o(function(){return g6.SupervisionCreationService},"get")});var y6=o0();Object.defineProperty(y,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return y6.FleetingNoteCreationService},"get")});var v6=xf();Object.defineProperty(y,"TaskFrontmatterGenerator",{enumerable:!0,get:o(function(){return v6.TaskFrontmatterGenerator},"get")});var _6=l0();Object.defineProperty(y,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return _6.DynamicFrontmatterGenerator},"get")});var b6=Af();Object.defineProperty(y,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return b6.AlgorithmExtractor},"get")});var S6=f0();Object.defineProperty(y,"PlanningService",{enumerable:!0,get:o(function(){return S6.PlanningService},"get")});var w6=d0();Object.defineProperty(y,"AssetConversionService",{enumerable:!0,get:o(function(){return w6.AssetConversionService},"get")});var E6=m0();Object.defineProperty(y,"SessionEventService",{enumerable:!0,get:o(function(){return E6.SessionEventService},"get")});var T6=y0();Object.defineProperty(y,"URIConstructionService",{enumerable:!0,get:o(function(){return T6.URIConstructionService},"get")});var x6=_0();Object.defineProperty(y,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return x6.GenericAssetCreationService},"get")});var TE=S0();Object.defineProperty(y,"EmbeddingService",{enumerable:!0,get:o(function(){return TE.EmbeddingService},"get")});Object.defineProperty(y,"DEFAULT_EMBEDDING_CONFIG",{enumerable:!0,get:o(function(){return TE.DEFAULT_EMBEDDING_CONFIG},"get")});var xE=T0();Object.defineProperty(y,"VectorStore",{enumerable:!0,get:o(function(){return xE.VectorStore},"get")});Object.defineProperty(y,"DEFAULT_VECTOR_STORE_CONFIG",{enumerable:!0,get:o(function(){return xE.DEFAULT_VECTOR_STORE_CONFIG},"get")});var AE=AS();Object.defineProperty(y,"SemanticSearchService",{enumerable:!0,get:o(function(){return AE.SemanticSearchService},"get")});Object.defineProperty(y,"DEFAULT_SEMANTIC_SEARCH_CONFIG",{enumerable:!0,get:o(function(){return AE.DEFAULT_SEMANTIC_SEARCH_CONFIG},"get")});var A6=CS();Object.defineProperty(y,"GraphQueryService",{enumerable:!0,get:o(function(){return A6.GraphQueryService},"get")});var C6=OS();Object.defineProperty(y,"TypeRegistry",{enumerable:!0,get:o(function(){return C6.TypeRegistry},"get")});var CE=PS();Object.defineProperty(y,"NLToSPARQLService",{enumerable:!0,get:o(function(){return CE.NLToSPARQLService},"get")});Object.defineProperty(y,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return CE.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var xn=I0();Object.defineProperty(y,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return xn.SPARQL_TEMPLATES},"get")});Object.defineProperty(y,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return xn.SPARQL_PREFIXES},"get")});Object.defineProperty(y,"PREDICATES",{enumerable:!0,get:o(function(){return xn.PREDICATES},"get")});Object.defineProperty(y,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return xn.ASSET_CLASSES},"get")});Object.defineProperty(y,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return xn.EFFORT_STATUSES},"get")});Object.defineProperty(y,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return xn.KNOWN_PROTOTYPES},"get")});Object.defineProperty(y,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return xn.KNOWN_CLASSES},"get")});Object.defineProperty(y,"findClassByTerm",{enumerable:!0,get:o(function(){return xn.findClassByTerm},"get")});Object.defineProperty(y,"findMatchingTemplates",{enumerable:!0,get:o(function(){return xn.findMatchingTemplates},"get")});Object.defineProperty(y,"fillTemplate",{enumerable:!0,get:o(function(){return xn.fillTemplate},"get")});Object.defineProperty(y,"validateParameters",{enumerable:!0,get:o(function(){return xn.validateParameters},"get")});Object.defineProperty(y,"getTemplateByName",{enumerable:!0,get:o(function(){return xn.getTemplateByName},"get")});var I6=FS();Object.defineProperty(y,"AnalyticsService",{enumerable:!0,get:o(function(){return I6.AnalyticsService},"get")});var O6=DS();Object.defineProperty(y,"TrendDetectionService",{enumerable:!0,get:o(function(){return O6.TrendDetectionService},"get")});var IE=LS();Object.defineProperty(y,"AutocompleteService",{enumerable:!0,get:o(function(){return IE.AutocompleteService},"get")});Object.defineProperty(y,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return IE.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var P6=MS();Object.defineProperty(y,"DailyReviewService",{enumerable:!0,get:o(function(){return P6.DailyReviewService},"get")});var OE=L0();Object.defineProperty(y,"CriticalityZoneService",{enumerable:!0,get:o(function(){return OE.CriticalityZoneService},"get")});Object.defineProperty(y,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return OE.CriticalityZoneUUIDs},"get")});var R6=Xi();Object.defineProperty(y,"FrontmatterService",{enumerable:!0,get:o(function(){return R6.FrontmatterService},"get")});var F6=nr();Object.defineProperty(y,"DateFormatter",{enumerable:!0,get:o(function(){return F6.DateFormatter},"get")});var D6=Js();Object.defineProperty(y,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return D6.WikiLinkHelpers},"get")});var N6=yn();Object.defineProperty(y,"MetadataHelpers",{enumerable:!0,get:o(function(){return N6.MetadataHelpers},"get")});var L6=Yc();Object.defineProperty(y,"MetadataExtractor",{enumerable:!0,get:o(function(){return L6.MetadataExtractor},"get")});var k6=$S();Object.defineProperty(y,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return k6.EffortSortingHelpers},"get")});var M6=VS();Object.defineProperty(y,"FilenameValidator",{enumerable:!0,get:o(function(){return M6.FilenameValidator},"get")});var j6=zS();Object.defineProperty(y,"RDFSerializer",{enumerable:!0,get:o(function(){return j6.RDFSerializer},"get")});var $6=QS();Object.defineProperty(y,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return $6.InMemoryTripleStore},"get")});var V6=ty();Object.defineProperty(y,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return V6.RDFVocabularyMapper},"get")});var U6=KS();Object.defineProperty(y,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return U6.RDFSInferenceEngine},"get")});var B6=ny();Object.defineProperty(y,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return B6.NoteToRDFConverter},"get")});var PE=yw();Object.defineProperty(y,"SPARQLParser",{enumerable:!0,get:o(function(){return PE.SPARQLParser},"get")});Object.defineProperty(y,"SPARQLParseError",{enumerable:!0,get:o(function(){return PE.SPARQLParseError},"get")});var RE=_y();Object.defineProperty(y,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return RE.DescribeOptionsTransformer},"get")});Object.defineProperty(y,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return RE.DescribeOptionsTransformerError},"get")});var q6=_w();Object.defineProperty(y,"AlgebraTranslator",{enumerable:!0,get:o(function(){return q6.AlgebraTranslator},"get")});var G6=bw();Object.defineProperty(y,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return G6.AlgebraOptimizer},"get")});var W6=Sw();Object.defineProperty(y,"AlgebraSerializer",{enumerable:!0,get:o(function(){return W6.AlgebraSerializer},"get")});var H6=jy();Object.defineProperty(y,"BGPExecutor",{enumerable:!0,get:o(function(){return H6.BGPExecutor},"get")});var z6=Th();Object.defineProperty(y,"FilterExecutor",{enumerable:!0,get:o(function(){return z6.FilterExecutor},"get")});var Q6=By();Object.defineProperty(y,"OptionalExecutor",{enumerable:!0,get:o(function(){return Q6.OptionalExecutor},"get")});var Y6=Gy();Object.defineProperty(y,"UnionExecutor",{enumerable:!0,get:o(function(){return Y6.UnionExecutor},"get")});var K6=Qy();Object.defineProperty(y,"ConstructExecutor",{enumerable:!0,get:o(function(){return K6.ConstructExecutor},"get")});var X6=Mw();Object.defineProperty(y,"DescribeExecutor",{enumerable:!0,get:o(function(){return X6.DescribeExecutor},"get")});var J6=Yw();Object.defineProperty(y,"QueryExecutor",{enumerable:!0,get:o(function(){return J6.QueryExecutor},"get")});var FE=Xw();Object.defineProperty(y,"UpdateExecutor",{enumerable:!0,get:o(function(){return FE.UpdateExecutor},"get")});Object.defineProperty(y,"UpdateExecutorError",{enumerable:!0,get:o(function(){return FE.UpdateExecutorError},"get")});var Z6=es();Object.defineProperty(y,"SolutionMapping",{enumerable:!0,get:o(function(){return Z6.SolutionMapping},"get")});var ek=Eh();Object.defineProperty(y,"BuiltInFunctions",{enumerable:!0,get:o(function(){return ek.BuiltInFunctions},"get")});var tk=Zw();Object.defineProperty(y,"AggregateFunctions",{enumerable:!0,get:o(function(){return tk.AggregateFunctions},"get")});var DE=Jy();Object.defineProperty(y,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return DE.CustomAggregateRegistry},"get")});Object.defineProperty(y,"CustomAggregateError",{enumerable:!0,get:o(function(){return DE.CustomAggregateError},"get")});var Oi=Zy();Object.defineProperty(y,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return Oi.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(y,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return Oi.EXO_AGGREGATE_NS},"get")});Object.defineProperty(y,"medianAggregate",{enumerable:!0,get:o(function(){return Oi.medianAggregate},"get")});Object.defineProperty(y,"varianceAggregate",{enumerable:!0,get:o(function(){return Oi.varianceAggregate},"get")});Object.defineProperty(y,"stddevAggregate",{enumerable:!0,get:o(function(){return Oi.stddevAggregate},"get")});Object.defineProperty(y,"modeAggregate",{enumerable:!0,get:o(function(){return Oi.modeAggregate},"get")});Object.defineProperty(y,"createPercentileAggregate",{enumerable:!0,get:o(function(){return Oi.createPercentileAggregate},"get")});Object.defineProperty(y,"getNumericValue",{enumerable:!0,get:o(function(){return Oi.getNumericValue},"get")});Object.defineProperty(y,"createDecimalLiteral",{enumerable:!0,get:o(function(){return Oi.createDecimalLiteral},"get")});Object.defineProperty(y,"createDoubleLiteral",{enumerable:!0,get:o(function(){return Oi.createDoubleLiteral},"get")});var rk=eE();Object.defineProperty(y,"QueryPlanCache",{enumerable:!0,get:o(function(){return rk.QueryPlanCache},"get")});var NE=tE();Object.defineProperty(y,"SPARQLResultCache",{enumerable:!0,get:o(function(){return NE.SPARQLResultCache},"get")});Object.defineProperty(y,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return NE.createSPARQLResultCache},"get")});var LE=rE();Object.defineProperty(y,"IncrementalIndexer",{enumerable:!0,get:o(function(){return LE.IncrementalIndexer},"get")});Object.defineProperty(y,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return LE.createIncrementalIndexer},"get")});var nk=nE();Object.defineProperty(y,"ResultSerializer",{enumerable:!0,get:o(function(){return nk.ResultSerializer},"get")});var kE=gy();Object.defineProperty(y,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return kE.CaseWhenTransformer},"get")});Object.defineProperty(y,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return kE.CaseWhenTransformerError},"get")});var ik=Ey();Object.defineProperty(y,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return ik.VaultPrefixTransformer},"get")});var sk=Ry();Object.defineProperty(y,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return sk.FilterContainsOptimizer},"get")});var ME=iE();Object.defineProperty(y,"FileNotFoundError",{enumerable:!0,get:o(function(){return ME.FileNotFoundError},"get")});Object.defineProperty(y,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return ME.FileAlreadyExistsError},"get")});var F1=K0();Object.defineProperty(y,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return F1.TripleAlreadyExistsError},"get")});Object.defineProperty(y,"TripleNotFoundError",{enumerable:!0,get:o(function(){return F1.TripleNotFoundError},"get")});Object.defineProperty(y,"TransactionError",{enumerable:!0,get:o(function(){return F1.TransactionError},"get")});var ak=lt();Object.defineProperty(y,"DI_TOKENS",{enumerable:!0,get:o(function(){return ak.DI_TOKENS},"get")});var hl=sE();Object.defineProperty(y,"registerCoreServices",{enumerable:!0,get:o(function(){return hl.registerCoreServices},"get")});Object.defineProperty(y,"createChildContainer",{enumerable:!0,get:o(function(){return hl.createChildContainer},"get")});Object.defineProperty(y,"getContainer",{enumerable:!0,get:o(function(){return hl.getContainer},"get")});Object.defineProperty(y,"resetContainer",{enumerable:!0,get:o(function(){return hl.resetContainer},"get")});Object.defineProperty(y,"container",{enumerable:!0,get:o(function(){return hl.container},"get")});var ts=fE();Object.defineProperty(y,"NODE_FLAGS",{enumerable:!0,get:o(function(){return ts.NODE_FLAGS},"get")});Object.defineProperty(y,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return ts.DEFAULT_COLORS},"get")});Object.defineProperty(y,"StringTable",{enumerable:!0,get:o(function(){return ts.StringTable},"get")});Object.defineProperty(y,"CompactGraphStore",{enumerable:!0,get:o(function(){return ts.CompactGraphStore},"get")});Object.defineProperty(y,"MemoryPool",{enumerable:!0,get:o(function(){return ts.MemoryPool},"get")});Object.defineProperty(y,"getGlobalPool",{enumerable:!0,get:o(function(){return ts.getGlobalPool},"get")});Object.defineProperty(y,"resetGlobalPool",{enumerable:!0,get:o(function(){return ts.resetGlobalPool},"get")});Object.defineProperty(y,"StreamingLoader",{enumerable:!0,get:o(function(){return ts.StreamingLoader},"get")});Object.defineProperty(y,"createStreamingSource",{enumerable:!0,get:o(function(){return ts.createStreamingSource},"get")});Tn(bE(),y);Tn(wE(),y)});var qt=v(D1=>{"use strict";D1.fromCallback=function(n){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")n.apply(this,e);else return new Promise((t,r)=>{e.push((i,s)=>i!=null?r(i):t(s)),n.apply(this,e)})},"name",{value:n.name})};D1.fromPromise=function(n){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return n.apply(this,e);e.pop(),n.apply(this,e).then(r=>t(null,r),t)},"name",{value:n.name})}});var $E=v((SK,jE)=>{var xs=require("constants"),ok=process.cwd,nd=null,ck=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return nd||(nd=ok.call(process)),nd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(N1=process.chdir,process.chdir=function(n){nd=null,N1.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,N1));var N1;jE.exports=lk;function lk(n){xs.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(n),n.lutimes||t(n),n.chown=s(n.chown),n.fchown=s(n.fchown),n.lchown=s(n.lchown),n.chmod=r(n.chmod),n.fchmod=r(n.fchmod),n.lchmod=r(n.lchmod),n.chownSync=a(n.chownSync),n.fchownSync=a(n.fchownSync),n.lchownSync=a(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=c(n.stat),n.fstat=c(n.fstat),n.lstat=c(n.lstat),n.statSync=l(n.statSync),n.fstatSync=l(n.fstatSync),n.lstatSync=l(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(f,h,d){d&&process.nextTick(d)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,h,d,p){p&&process.nextTick(p)},n.lchownSync=function(){}),ck==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function h(d,p,_){var b=Date.now(),E=0;f(d,p,o(function A(C){if(C&&(C.code==="EACCES"||C.code==="EPERM"||C.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){n.stat(p,function(M,G){M&&M.code==="ENOENT"?f(d,p,A):_(C)})},E),E<100&&(E+=10);return}_&&_(C)},"CB"))}return o(h,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function h(d,p,_,b,E,A){var C;if(A&&typeof A=="function"){var M=0;C=o(function(G,Q,H){if(G&&G.code==="EAGAIN"&&M<10)return M++,f.call(n,d,p,_,b,E,C);A.apply(this,arguments)},"callback")}return f.call(n,d,p,_,b,E,C)}return o(h,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(h,d,p,_,b){for(var E=0;;)try{return f.call(n,h,d,p,_,b)}catch(A){if(A.code==="EAGAIN"&&E<10){E++;continue}throw A}}})(n.readSync);function e(f){f.lchmod=function(h,d,p){f.open(h,xs.O_WRONLY|xs.O_SYMLINK,d,function(_,b){if(_){p&&p(_);return}f.fchmod(b,d,function(E){f.close(b,function(A){p&&p(E||A)})})})},f.lchmodSync=function(h,d){var p=f.openSync(h,xs.O_WRONLY|xs.O_SYMLINK,d),_=!0,b;try{b=f.fchmodSync(p,d),_=!1}finally{if(_)try{f.closeSync(p)}catch{}else f.closeSync(p)}return b}}o(e,"patchLchmod");function t(f){xs.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(h,d,p,_){f.open(h,xs.O_SYMLINK,function(b,E){if(b){_&&_(b);return}f.futimes(E,d,p,function(A){f.close(E,function(C){_&&_(A||C)})})})},f.lutimesSync=function(h,d,p){var _=f.openSync(h,xs.O_SYMLINK),b,E=!0;try{b=f.futimesSync(_,d,p),E=!1}finally{if(E)try{f.closeSync(_)}catch{}else f.closeSync(_)}return b}):f.futimes&&(f.lutimes=function(h,d,p,_){_&&process.nextTick(_)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(h,d,p){return f.call(n,h,d,function(_){u(_)&&(_=null),p&&p.apply(this,arguments)})}}o(r,"chmodFix");function i(f){return f&&function(h,d){try{return f.call(n,h,d)}catch(p){if(!u(p))throw p}}}o(i,"chmodFixSync");function s(f){return f&&function(h,d,p,_){return f.call(n,h,d,p,function(b){u(b)&&(b=null),_&&_.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(h,d,p){try{return f.call(n,h,d,p)}catch(_){if(!u(_))throw _}}}o(a,"chownFixSync");function c(f){return f&&function(h,d,p){typeof d=="function"&&(p=d,d=null);function _(b,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),p&&p.apply(this,arguments)}return o(_,"callback"),d?f.call(n,h,d,_):f.call(n,h,_)}}o(c,"statFix");function l(f){return f&&function(h,d){var p=d?f.call(n,h,d):f.call(n,h);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}o(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(f.code==="EINVAL"||f.code==="EPERM"))}o(u,"chownErOk")}o(lk,"patch")});var BE=v((EK,UE)=>{var VE=require("stream").Stream;UE.exports=uk;function uk(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);VE.call(this);var s=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var a=Object.keys(i),c=0,l=a.length;c<l;c++){var u=a[c];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}n.open(this.path,this.flags,this.mode,function(f,h){if(f){s.emit("error",f),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function t(r,i){if(!(this instanceof t))return new t(r,i);VE.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),a=0,c=s.length;a<c;a++){var l=s[a];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}o(uk,"legacy")});var GE=v((xK,qE)=>{"use strict";qE.exports=hk;var fk=Object.getPrototypeOf||function(n){return n.__proto__};function hk(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:fk(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(hk,"clone")});var Go=v((CK,M1)=>{var wt=require("fs"),dk=$E(),pk=BE(),mk=GE(),id=require("util"),or,ad;typeof Symbol=="function"&&typeof Symbol.for=="function"?(or=Symbol.for("graceful-fs.queue"),ad=Symbol.for("graceful-fs.previous")):(or="___graceful-fs.queue",ad="___graceful-fs.previous");function gk(){}o(gk,"noop");function zE(n,e){Object.defineProperty(n,or,{get:o(function(){return e},"get")})}o(zE,"publishQueue");var Ta=gk;id.debuglog?Ta=id.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ta=o(function(){var n=id.format.apply(id,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
384
|
-
GFS4: `),console.error(n)},"debug"));wt[or]||(WE=global[or]||[],zE(wt,WE),wt.close=(function(n){function e(t,r){return n.call(wt,t,function(i){i||HE(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,ad,{value:n}),e})(wt.close),wt.closeSync=(function(n){function e(t){n.apply(wt,arguments),HE()}return o(e,"closeSync"),Object.defineProperty(e,ad,{value:n}),e})(wt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ta(wt[or]),require("assert").equal(wt[or].length,0)}));var WE;global[or]||zE(global,wt[or]);M1.exports=L1(mk(wt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!wt.__patched&&(M1.exports=L1(wt),wt.__patched=!0);function L1(n){dk(n),n.gracefulify=L1,n.createReadStream=Q,n.createWriteStream=H;var e=n.readFile;n.readFile=t;function t(N,Y,ge){return typeof Y=="function"&&(ge=Y,Y=null),dt(N,Y,ge);function dt(nt,vt,Ke,Je){return e(nt,vt,function(Ue){Ue&&(Ue.code==="EMFILE"||Ue.code==="ENFILE")?qo([dt,[nt,vt,Ke],Ue,Je||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(dt,"go$readFile")}o(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(N,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=null),nt(N,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return r(vt,Ke,Je,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$writeFile")}o(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=a);function a(N,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=null),nt(N,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return s(vt,Ke,Je,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$appendFile")}o(a,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(N,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=0),nt(N,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return c(vt,Ke,Je,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$copyFile")}o(l,"copyFile");var u=n.readdir;n.readdir=h;var f=/^v[0-5]\./;function h(N,Y,ge){typeof Y=="function"&&(ge=Y,Y=null);var dt=f.test(process.version)?o(function(Ke,Je,Ue,te){return u(Ke,nt(Ke,Je,Ue,te))},"go$readdir"):o(function(Ke,Je,Ue,te){return u(Ke,Je,nt(Ke,Je,Ue,te))},"go$readdir");return dt(N,Y,ge);function nt(vt,Ke,Je,Ue){return function(te,$){te&&(te.code==="EMFILE"||te.code==="ENFILE")?qo([dt,[vt,Ke,Je],te,Ue||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof Je=="function"&&Je.call(this,te,$))}}}if(o(h,"readdir"),process.version.substr(0,4)==="v0.8"){var d=pk(n);A=d.ReadStream,M=d.WriteStream}var p=n.ReadStream;p&&(A.prototype=Object.create(p.prototype),A.prototype.open=C);var _=n.WriteStream;_&&(M.prototype=Object.create(_.prototype),M.prototype.open=G),Object.defineProperty(n,"ReadStream",{get:o(function(){return A},"get"),set:o(function(N){A=N},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return M},"get"),set:o(function(N){M=N},"set"),enumerable:!0,configurable:!0});var b=A;Object.defineProperty(n,"FileReadStream",{get:o(function(){return b},"get"),set:o(function(N){b=N},"set"),enumerable:!0,configurable:!0});var E=M;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return E},"get"),set:o(function(N){E=N},"set"),enumerable:!0,configurable:!0});function A(N,Y){return this instanceof A?(p.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}o(A,"ReadStream");function C(){var N=this;Se(N.path,N.flags,N.mode,function(Y,ge){Y?(N.autoClose&&N.destroy(),N.emit("error",Y)):(N.fd=ge,N.emit("open",ge),N.read())})}o(C,"ReadStream$open");function M(N,Y){return this instanceof M?(_.apply(this,arguments),this):M.apply(Object.create(M.prototype),arguments)}o(M,"WriteStream");function G(){var N=this;Se(N.path,N.flags,N.mode,function(Y,ge){Y?(N.destroy(),N.emit("error",Y)):(N.fd=ge,N.emit("open",ge))})}o(G,"WriteStream$open");function Q(N,Y){return new n.ReadStream(N,Y)}o(Q,"createReadStream");function H(N,Y){return new n.WriteStream(N,Y)}o(H,"createWriteStream");var ee=n.open;n.open=Se;function Se(N,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=null),nt(N,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return ee(vt,Ke,Je,function($,Ze){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$open")}return o(Se,"open"),n}o(L1,"patch");function qo(n){Ta("ENQUEUE",n[0].name,n[1]),wt[or].push(n),k1()}o(qo,"enqueue");var sd;function HE(){for(var n=Date.now(),e=0;e<wt[or].length;++e)wt[or][e].length>2&&(wt[or][e][3]=n,wt[or][e][4]=n);k1()}o(HE,"resetQueue");function k1(){if(clearTimeout(sd),sd=void 0,wt[or].length!==0){var n=wt[or].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Ta("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Ta("TIMEOUT",e.name,t);var a=t.pop();typeof a=="function"&&a.call(null,r)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Ta("RETRY",e.name,t),e.apply(null,t.concat([i]))):wt[or].push(n)}sd===void 0&&(sd=setTimeout(k1,0))}}o(k1,"retry")});var Mr=v(rs=>{"use strict";var QE=qt().fromCallback,kr=Go(),yk=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(n=>typeof kr[n]=="function");Object.assign(rs,kr);yk.forEach(n=>{rs[n]=QE(kr[n])});rs.exists=function(n,e){return typeof e=="function"?kr.exists(n,e):new Promise(t=>kr.exists(n,t))};rs.read=function(n,e,t,r,i,s){return typeof s=="function"?kr.read(n,e,t,r,i,s):new Promise((a,c)=>{kr.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};rs.write=function(n,e,...t){return typeof t[t.length-1]=="function"?kr.write(n,e,...t):new Promise((r,i)=>{kr.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};rs.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?kr.readv(n,e,...t):new Promise((r,i)=>{kr.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};rs.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?kr.writev(n,e,...t):new Promise((r,i)=>{kr.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof kr.realpath.native=="function"?rs.realpath.native=QE(kr.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var KE=v((PK,YE)=>{"use strict";var vk=require("path");YE.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(vk.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var eT=v((FK,j1)=>{"use strict";var XE=Mr(),{checkPath:JE}=KE(),ZE=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");j1.exports.makeDir=async(n,e)=>(JE(n),XE.mkdir(n,{mode:ZE(e),recursive:!0}));j1.exports.makeDirSync=(n,e)=>(JE(n),XE.mkdirSync(n,{mode:ZE(e),recursive:!0}))});var ni=v((NK,tT)=>{"use strict";var _k=qt().fromPromise,{makeDir:bk,makeDirSync:$1}=eT(),V1=_k(bk);tT.exports={mkdirs:V1,mkdirsSync:$1,mkdirp:V1,mkdirpSync:$1,ensureDir:V1,ensureDirSync:$1}});var As=v((LK,nT)=>{"use strict";var Sk=qt().fromPromise,rT=Mr();function wk(n){return rT.access(n).then(()=>!0).catch(()=>!1)}o(wk,"pathExists");nT.exports={pathExists:Sk(wk),pathExistsSync:rT.existsSync}});var U1=v((MK,iT)=>{"use strict";var Wo=Mr(),Ek=qt().fromPromise;async function Tk(n,e,t){let r=await Wo.open(n,"r+"),i=null;try{await Wo.futimes(r,e,t)}finally{try{await Wo.close(r)}catch(s){i=s}}if(i)throw i}o(Tk,"utimesMillis");function xk(n,e,t){let r=Wo.openSync(n,"r+");return Wo.futimesSync(r,e,t),Wo.closeSync(r)}o(xk,"utimesMillisSync");iT.exports={utimesMillis:Ek(Tk),utimesMillisSync:xk}});var xa=v(($K,cT)=>{"use strict";var Ho=Mr(),Gt=require("path"),sT=qt().fromPromise;function Ak(n,e,t){let r=t.dereference?i=>Ho.stat(i,{bigint:!0}):i=>Ho.lstat(i,{bigint:!0});return Promise.all([r(n),r(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}o(Ak,"getStats");function Ck(n,e,t){let r,i=t.dereference?a=>Ho.statSync(a,{bigint:!0}):a=>Ho.lstatSync(a,{bigint:!0}),s=i(n);try{r=i(e)}catch(a){if(a.code==="ENOENT")return{srcStat:s,destStat:null};throw a}return{srcStat:s,destStat:r}}o(Ck,"getStatsSync");async function Ik(n,e,t,r){let{srcStat:i,destStat:s}=await Ak(n,e,r);if(s){if(dl(i,s)){let a=Gt.basename(n),c=Gt.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&B1(n,e))throw new Error(od(n,e,t));return{srcStat:i,destStat:s}}o(Ik,"checkPaths");function Ok(n,e,t,r){let{srcStat:i,destStat:s}=Ck(n,e,r);if(s){if(dl(i,s)){let a=Gt.basename(n),c=Gt.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&B1(n,e))throw new Error(od(n,e,t));return{srcStat:i,destStat:s}}o(Ok,"checkPathsSync");async function aT(n,e,t,r){let i=Gt.resolve(Gt.dirname(n)),s=Gt.resolve(Gt.dirname(t));if(s===i||s===Gt.parse(s).root)return;let a;try{a=await Ho.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(dl(e,a))throw new Error(od(n,t,r));return aT(n,e,s,r)}o(aT,"checkParentPaths");function oT(n,e,t,r){let i=Gt.resolve(Gt.dirname(n)),s=Gt.resolve(Gt.dirname(t));if(s===i||s===Gt.parse(s).root)return;let a;try{a=Ho.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(dl(e,a))throw new Error(od(n,t,r));return oT(n,e,s,r)}o(oT,"checkParentPathsSync");function dl(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(dl,"areIdentical");function B1(n,e){let t=Gt.resolve(n).split(Gt.sep).filter(i=>i),r=Gt.resolve(e).split(Gt.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(B1,"isSrcSubdir");function od(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(od,"errMsg");cT.exports={checkPaths:sT(Ik),checkPathsSync:Ok,checkParentPaths:sT(aT),checkParentPathsSync:oT,isSrcSubdir:B1,areIdentical:dl}});var uT=v((UK,lT)=>{"use strict";async function Pk(n,e){let t=[];for await(let r of n)t.push(e(r).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(r=>r.then(i=>{if(i!==null)throw i})))}o(Pk,"asyncIteratorConcurrentProcess");lT.exports={asyncIteratorConcurrentProcess:Pk}});var mT=v((qK,pT)=>{"use strict";var br=Mr(),pl=require("path"),{mkdirs:Rk}=ni(),{pathExists:Fk}=As(),{utimesMillis:Dk}=U1(),ml=xa(),{asyncIteratorConcurrentProcess:Nk}=uT();async function Lk(n,e,t={}){typeof t=="function"&&(t={filter:t}),t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
382
|
+
\u2022 Contact support if the issue persists`}};ed.ServiceError=I1});var bE=v(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.ServiceError=Nt.ResourceExhaustedError=Nt.NotFoundError=Nt.PermissionError=Nt.StateTransitionError=Nt.NetworkError=Nt.ValidationError=Nt.ApplicationError=Nt.ErrorCode=void 0;var q9=Ci();Object.defineProperty(Nt,"ErrorCode",{enumerable:!0,get:o(function(){return q9.ErrorCode},"get")});var G9=Ii();Object.defineProperty(Nt,"ApplicationError",{enumerable:!0,get:o(function(){return G9.ApplicationError},"get")});var W9=dE();Object.defineProperty(Nt,"ValidationError",{enumerable:!0,get:o(function(){return W9.ValidationError},"get")});var H9=pE();Object.defineProperty(Nt,"NetworkError",{enumerable:!0,get:o(function(){return H9.NetworkError},"get")});var z9=mE();Object.defineProperty(Nt,"StateTransitionError",{enumerable:!0,get:o(function(){return z9.StateTransitionError},"get")});var Q9=gE();Object.defineProperty(Nt,"PermissionError",{enumerable:!0,get:o(function(){return Q9.PermissionError},"get")});var Y9=yE();Object.defineProperty(Nt,"NotFoundError",{enumerable:!0,get:o(function(){return Y9.NotFoundError},"get")});var K9=vE();Object.defineProperty(Nt,"ResourceExhaustedError",{enumerable:!0,get:o(function(){return K9.ResourceExhaustedError},"get")});var X9=_E();Object.defineProperty(Nt,"ServiceError",{enumerable:!0,get:o(function(){return X9.ServiceError},"get")})});var SE=v(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.ApplicationErrorHandler=void 0;var O1=Ii(),J9=Ci(),P1=class{static{o(this,"ApplicationErrorHandler")}constructor(e={},t,r){this.logger=t,this.notifier=r,this.telemetryHooks=new Set,this.retryConfig={maxRetries:e.maxRetries??3,initialDelayMs:e.initialDelayMs??1e3,backoffMultiplier:e.backoffMultiplier??2,maxDelayMs:e.maxDelayMs??1e4}}handle(e,t){let r=this.ensureApplicationError(e,t);return this.notifier&&this.notifier.error(r.message),this.callTelemetryHooks("onError",r,t),this.formatError(r)}async executeWithRetry(e,t){let r,i=0;for(;i<=this.retryConfig.maxRetries;)try{return await e()}catch(s){if(r=this.ensureApplicationError(s,t),!r.retriable||i>=this.retryConfig.maxRetries)throw this.callTelemetryHooks("onError",r,t),i>=this.retryConfig.maxRetries&&r.retriable&&this.callTelemetryHooks("onRetryExhausted",r,i+1),r;let a=this.calculateDelay(i);this.callTelemetryHooks("onRetry",r,i+1,a),this.logger?.debug(`Retrying after ${a}ms (attempt ${i+1}/${this.retryConfig.maxRetries})`),await this.sleep(a),i++}throw r}registerTelemetryHook(e){this.telemetryHooks.add(e)}unregisterTelemetryHook(e){this.telemetryHooks.delete(e)}ensureApplicationError(e,t){if(e instanceof O1.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends O1.ApplicationError{constructor(){super(...arguments),this.code=i.code,this.retriable=i.retriable,this.guidance=i.guidance}}(e.message,s)}return e}return new class extends O1.ApplicationError{static{o(this,"UnknownError")}constructor(s,a){super(s,{originalError:a.name,...t}),this.code=J9.ErrorCode.UNKNOWN_ERROR,this.retriable=!1,this.guidance="An unexpected error occurred"}}(e.message,e)}formatError(e){let t=[];return t.push(`\u274C ${e.name}: ${e.message}`),e.guidance&&t.push(`\u{1F4A1} ${e.guidance}`),e.context&&Object.keys(e.context).length>0&&t.push(`Context: ${JSON.stringify(e.context,null,2)}`),t.join(`
|
|
383
|
+
`)}calculateDelay(e){let t=this.retryConfig.initialDelayMs*Math.pow(this.retryConfig.backoffMultiplier,e);return Math.min(t,this.retryConfig.maxDelayMs)}sleep(e){return new Promise(t=>setTimeout(t,e))}callTelemetryHooks(e,...t){for(let r of this.telemetryHooks)try{let i=r[e];i&&i.apply(r,t)}catch(i){console.error("Error in telemetry hook:",i)}}};td.ApplicationErrorHandler=P1});var wE=v(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.ApplicationErrorHandler=void 0;var Z9=SE();Object.defineProperty(rd,"ApplicationErrorHandler",{enumerable:!0,get:o(function(){return Z9.ApplicationErrorHandler},"get")})});var ar=v(y=>{"use strict";var e6=y&&y.__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:o(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),Tn=y&&y.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&e6(e,n,t)};Object.defineProperty(y,"__esModule",{value:!0});y.fillTemplate=y.findMatchingTemplates=y.findClassByTerm=y.KNOWN_CLASSES=y.KNOWN_PROTOTYPES=y.EFFORT_STATUSES=y.ASSET_CLASSES=y.PREDICATES=y.SPARQL_PREFIXES=y.SPARQL_TEMPLATES=y.DEFAULT_NL_TO_SPARQL_CONFIG=y.NLToSPARQLService=y.TypeRegistry=y.GraphQueryService=y.DEFAULT_SEMANTIC_SEARCH_CONFIG=y.SemanticSearchService=y.DEFAULT_VECTOR_STORE_CONFIG=y.VectorStore=y.DEFAULT_EMBEDDING_CONFIG=y.EmbeddingService=y.GenericAssetCreationService=y.URIConstructionService=y.SessionEventService=y.AssetConversionService=y.PlanningService=y.AlgorithmExtractor=y.DynamicFrontmatterGenerator=y.TaskFrontmatterGenerator=y.FleetingNoteCreationService=y.SupervisionCreationService=y.StatusTimestampService=y.RenameToUidService=y.PropertyCleanupService=y.LoggingService=y.LabelToAliasService=y.FolderRepairService=y.EffortVotingService=y.EffortStatusWorkflow=y.ConceptCreationService=y.ClassCreationService=y.AreaHierarchyBuilder=y.AreaCreationService=y.TaskStatusService=y.ProjectCreationService=y.TaskCreationService=y.extractPropertyLabel=y.uriToPropertyName=y.propertyNameToUri=y.rangeToFieldType=y.PropertyFieldType=void 0;y.getNumericValue=y.createPercentileAggregate=y.modeAggregate=y.stddevAggregate=y.varianceAggregate=y.medianAggregate=y.EXO_AGGREGATE_NS=y.BUILT_IN_AGGREGATES=y.CustomAggregateError=y.CustomAggregateRegistry=y.AggregateFunctions=y.BuiltInFunctions=y.SolutionMapping=y.UpdateExecutorError=y.UpdateExecutor=y.QueryExecutor=y.DescribeExecutor=y.ConstructExecutor=y.UnionExecutor=y.OptionalExecutor=y.FilterExecutor=y.BGPExecutor=y.AlgebraSerializer=y.AlgebraOptimizer=y.AlgebraTranslator=y.DescribeOptionsTransformerError=y.DescribeOptionsTransformer=y.SPARQLParseError=y.SPARQLParser=y.NoteToRDFConverter=y.RDFSInferenceEngine=y.RDFVocabularyMapper=y.InMemoryTripleStore=y.RDFSerializer=y.FilenameValidator=y.EffortSortingHelpers=y.MetadataExtractor=y.MetadataHelpers=y.WikiLinkHelpers=y.DateFormatter=y.FrontmatterService=y.CriticalityZoneUUIDs=y.CriticalityZoneService=y.DailyReviewService=y.DEFAULT_AUTOCOMPLETE_CONFIG=y.AutocompleteService=y.TrendDetectionService=y.AnalyticsService=y.getTemplateByName=y.validateParameters=void 0;y.createStreamingSource=y.StreamingLoader=y.resetGlobalPool=y.getGlobalPool=y.MemoryPool=y.CompactGraphStore=y.StringTable=y.DEFAULT_COLORS=y.NODE_FLAGS=y.container=y.resetContainer=y.getContainer=y.createChildContainer=y.registerCoreServices=y.DI_TOKENS=y.TransactionError=y.TripleNotFoundError=y.TripleAlreadyExistsError=y.FileAlreadyExistsError=y.FileNotFoundError=y.FilterContainsOptimizer=y.VaultPrefixTransformer=y.CaseWhenTransformerError=y.CaseWhenTransformer=y.ResultSerializer=y.createIncrementalIndexer=y.IncrementalIndexer=y.createSPARQLResultCache=y.SPARQLResultCache=y.QueryPlanCache=y.createDoubleLiteral=y.createDecimalLiteral=void 0;Tn(em(),y);Tn(tm(),y);Tn(E_(),y);Tn(T_(),y);Tn(rm(),y);Tn(nm(),y);Tn(A_(),y);Tn(O_(),y);Tn(jm(),y);Tn(yb(),y);var EE=Bm();Object.defineProperty(y,"PropertyFieldType",{enumerable:!0,get:o(function(){return EE.PropertyFieldType},"get")});Object.defineProperty(y,"rangeToFieldType",{enumerable:!0,get:o(function(){return EE.rangeToFieldType},"get")});var R1=bb();Object.defineProperty(y,"propertyNameToUri",{enumerable:!0,get:o(function(){return R1.propertyNameToUri},"get")});Object.defineProperty(y,"uriToPropertyName",{enumerable:!0,get:o(function(){return R1.uriToPropertyName},"get")});Object.defineProperty(y,"extractPropertyLabel",{enumerable:!0,get:o(function(){return R1.extractPropertyLabel},"get")});var t6=Fg();Object.defineProperty(y,"TaskCreationService",{enumerable:!0,get:o(function(){return t6.TaskCreationService},"get")});var r6=Ng();Object.defineProperty(y,"ProjectCreationService",{enumerable:!0,get:o(function(){return r6.ProjectCreationService},"get")});var n6=jg();Object.defineProperty(y,"TaskStatusService",{enumerable:!0,get:o(function(){return n6.TaskStatusService},"get")});var i6=Vg();Object.defineProperty(y,"AreaCreationService",{enumerable:!0,get:o(function(){return i6.AreaCreationService},"get")});var s6=Bg();Object.defineProperty(y,"AreaHierarchyBuilder",{enumerable:!0,get:o(function(){return s6.AreaHierarchyBuilder},"get")});var a6=Gg();Object.defineProperty(y,"ClassCreationService",{enumerable:!0,get:o(function(){return a6.ClassCreationService},"get")});var o6=Hg();Object.defineProperty(y,"ConceptCreationService",{enumerable:!0,get:o(function(){return o6.ConceptCreationService},"get")});var c6=Rf();Object.defineProperty(y,"EffortStatusWorkflow",{enumerable:!0,get:o(function(){return c6.EffortStatusWorkflow},"get")});var l6=Qg();Object.defineProperty(y,"EffortVotingService",{enumerable:!0,get:o(function(){return l6.EffortVotingService},"get")});var u6=Kg();Object.defineProperty(y,"FolderRepairService",{enumerable:!0,get:o(function(){return u6.FolderRepairService},"get")});var f6=Jg();Object.defineProperty(y,"LabelToAliasService",{enumerable:!0,get:o(function(){return f6.LabelToAliasService},"get")});var h6=la();Object.defineProperty(y,"LoggingService",{enumerable:!0,get:o(function(){return h6.LoggingService},"get")});var d6=t0();Object.defineProperty(y,"PropertyCleanupService",{enumerable:!0,get:o(function(){return d6.PropertyCleanupService},"get")});var p6=n0();Object.defineProperty(y,"RenameToUidService",{enumerable:!0,get:o(function(){return p6.RenameToUidService},"get")});var m6=Ff();Object.defineProperty(y,"StatusTimestampService",{enumerable:!0,get:o(function(){return m6.StatusTimestampService},"get")});var g6=s0();Object.defineProperty(y,"SupervisionCreationService",{enumerable:!0,get:o(function(){return g6.SupervisionCreationService},"get")});var y6=o0();Object.defineProperty(y,"FleetingNoteCreationService",{enumerable:!0,get:o(function(){return y6.FleetingNoteCreationService},"get")});var v6=xf();Object.defineProperty(y,"TaskFrontmatterGenerator",{enumerable:!0,get:o(function(){return v6.TaskFrontmatterGenerator},"get")});var _6=l0();Object.defineProperty(y,"DynamicFrontmatterGenerator",{enumerable:!0,get:o(function(){return _6.DynamicFrontmatterGenerator},"get")});var b6=Af();Object.defineProperty(y,"AlgorithmExtractor",{enumerable:!0,get:o(function(){return b6.AlgorithmExtractor},"get")});var S6=f0();Object.defineProperty(y,"PlanningService",{enumerable:!0,get:o(function(){return S6.PlanningService},"get")});var w6=d0();Object.defineProperty(y,"AssetConversionService",{enumerable:!0,get:o(function(){return w6.AssetConversionService},"get")});var E6=m0();Object.defineProperty(y,"SessionEventService",{enumerable:!0,get:o(function(){return E6.SessionEventService},"get")});var T6=y0();Object.defineProperty(y,"URIConstructionService",{enumerable:!0,get:o(function(){return T6.URIConstructionService},"get")});var x6=_0();Object.defineProperty(y,"GenericAssetCreationService",{enumerable:!0,get:o(function(){return x6.GenericAssetCreationService},"get")});var TE=S0();Object.defineProperty(y,"EmbeddingService",{enumerable:!0,get:o(function(){return TE.EmbeddingService},"get")});Object.defineProperty(y,"DEFAULT_EMBEDDING_CONFIG",{enumerable:!0,get:o(function(){return TE.DEFAULT_EMBEDDING_CONFIG},"get")});var xE=T0();Object.defineProperty(y,"VectorStore",{enumerable:!0,get:o(function(){return xE.VectorStore},"get")});Object.defineProperty(y,"DEFAULT_VECTOR_STORE_CONFIG",{enumerable:!0,get:o(function(){return xE.DEFAULT_VECTOR_STORE_CONFIG},"get")});var AE=AS();Object.defineProperty(y,"SemanticSearchService",{enumerable:!0,get:o(function(){return AE.SemanticSearchService},"get")});Object.defineProperty(y,"DEFAULT_SEMANTIC_SEARCH_CONFIG",{enumerable:!0,get:o(function(){return AE.DEFAULT_SEMANTIC_SEARCH_CONFIG},"get")});var A6=CS();Object.defineProperty(y,"GraphQueryService",{enumerable:!0,get:o(function(){return A6.GraphQueryService},"get")});var C6=OS();Object.defineProperty(y,"TypeRegistry",{enumerable:!0,get:o(function(){return C6.TypeRegistry},"get")});var CE=PS();Object.defineProperty(y,"NLToSPARQLService",{enumerable:!0,get:o(function(){return CE.NLToSPARQLService},"get")});Object.defineProperty(y,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:o(function(){return CE.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var xn=I0();Object.defineProperty(y,"SPARQL_TEMPLATES",{enumerable:!0,get:o(function(){return xn.SPARQL_TEMPLATES},"get")});Object.defineProperty(y,"SPARQL_PREFIXES",{enumerable:!0,get:o(function(){return xn.SPARQL_PREFIXES},"get")});Object.defineProperty(y,"PREDICATES",{enumerable:!0,get:o(function(){return xn.PREDICATES},"get")});Object.defineProperty(y,"ASSET_CLASSES",{enumerable:!0,get:o(function(){return xn.ASSET_CLASSES},"get")});Object.defineProperty(y,"EFFORT_STATUSES",{enumerable:!0,get:o(function(){return xn.EFFORT_STATUSES},"get")});Object.defineProperty(y,"KNOWN_PROTOTYPES",{enumerable:!0,get:o(function(){return xn.KNOWN_PROTOTYPES},"get")});Object.defineProperty(y,"KNOWN_CLASSES",{enumerable:!0,get:o(function(){return xn.KNOWN_CLASSES},"get")});Object.defineProperty(y,"findClassByTerm",{enumerable:!0,get:o(function(){return xn.findClassByTerm},"get")});Object.defineProperty(y,"findMatchingTemplates",{enumerable:!0,get:o(function(){return xn.findMatchingTemplates},"get")});Object.defineProperty(y,"fillTemplate",{enumerable:!0,get:o(function(){return xn.fillTemplate},"get")});Object.defineProperty(y,"validateParameters",{enumerable:!0,get:o(function(){return xn.validateParameters},"get")});Object.defineProperty(y,"getTemplateByName",{enumerable:!0,get:o(function(){return xn.getTemplateByName},"get")});var I6=FS();Object.defineProperty(y,"AnalyticsService",{enumerable:!0,get:o(function(){return I6.AnalyticsService},"get")});var O6=DS();Object.defineProperty(y,"TrendDetectionService",{enumerable:!0,get:o(function(){return O6.TrendDetectionService},"get")});var IE=LS();Object.defineProperty(y,"AutocompleteService",{enumerable:!0,get:o(function(){return IE.AutocompleteService},"get")});Object.defineProperty(y,"DEFAULT_AUTOCOMPLETE_CONFIG",{enumerable:!0,get:o(function(){return IE.DEFAULT_AUTOCOMPLETE_CONFIG},"get")});var P6=MS();Object.defineProperty(y,"DailyReviewService",{enumerable:!0,get:o(function(){return P6.DailyReviewService},"get")});var OE=L0();Object.defineProperty(y,"CriticalityZoneService",{enumerable:!0,get:o(function(){return OE.CriticalityZoneService},"get")});Object.defineProperty(y,"CriticalityZoneUUIDs",{enumerable:!0,get:o(function(){return OE.CriticalityZoneUUIDs},"get")});var R6=Xi();Object.defineProperty(y,"FrontmatterService",{enumerable:!0,get:o(function(){return R6.FrontmatterService},"get")});var F6=nr();Object.defineProperty(y,"DateFormatter",{enumerable:!0,get:o(function(){return F6.DateFormatter},"get")});var D6=Js();Object.defineProperty(y,"WikiLinkHelpers",{enumerable:!0,get:o(function(){return D6.WikiLinkHelpers},"get")});var N6=yn();Object.defineProperty(y,"MetadataHelpers",{enumerable:!0,get:o(function(){return N6.MetadataHelpers},"get")});var L6=Yc();Object.defineProperty(y,"MetadataExtractor",{enumerable:!0,get:o(function(){return L6.MetadataExtractor},"get")});var k6=$S();Object.defineProperty(y,"EffortSortingHelpers",{enumerable:!0,get:o(function(){return k6.EffortSortingHelpers},"get")});var M6=VS();Object.defineProperty(y,"FilenameValidator",{enumerable:!0,get:o(function(){return M6.FilenameValidator},"get")});var j6=zS();Object.defineProperty(y,"RDFSerializer",{enumerable:!0,get:o(function(){return j6.RDFSerializer},"get")});var $6=QS();Object.defineProperty(y,"InMemoryTripleStore",{enumerable:!0,get:o(function(){return $6.InMemoryTripleStore},"get")});var V6=ty();Object.defineProperty(y,"RDFVocabularyMapper",{enumerable:!0,get:o(function(){return V6.RDFVocabularyMapper},"get")});var U6=KS();Object.defineProperty(y,"RDFSInferenceEngine",{enumerable:!0,get:o(function(){return U6.RDFSInferenceEngine},"get")});var B6=ny();Object.defineProperty(y,"NoteToRDFConverter",{enumerable:!0,get:o(function(){return B6.NoteToRDFConverter},"get")});var PE=yw();Object.defineProperty(y,"SPARQLParser",{enumerable:!0,get:o(function(){return PE.SPARQLParser},"get")});Object.defineProperty(y,"SPARQLParseError",{enumerable:!0,get:o(function(){return PE.SPARQLParseError},"get")});var RE=_y();Object.defineProperty(y,"DescribeOptionsTransformer",{enumerable:!0,get:o(function(){return RE.DescribeOptionsTransformer},"get")});Object.defineProperty(y,"DescribeOptionsTransformerError",{enumerable:!0,get:o(function(){return RE.DescribeOptionsTransformerError},"get")});var q6=_w();Object.defineProperty(y,"AlgebraTranslator",{enumerable:!0,get:o(function(){return q6.AlgebraTranslator},"get")});var G6=bw();Object.defineProperty(y,"AlgebraOptimizer",{enumerable:!0,get:o(function(){return G6.AlgebraOptimizer},"get")});var W6=Sw();Object.defineProperty(y,"AlgebraSerializer",{enumerable:!0,get:o(function(){return W6.AlgebraSerializer},"get")});var H6=jy();Object.defineProperty(y,"BGPExecutor",{enumerable:!0,get:o(function(){return H6.BGPExecutor},"get")});var z6=Th();Object.defineProperty(y,"FilterExecutor",{enumerable:!0,get:o(function(){return z6.FilterExecutor},"get")});var Q6=By();Object.defineProperty(y,"OptionalExecutor",{enumerable:!0,get:o(function(){return Q6.OptionalExecutor},"get")});var Y6=Gy();Object.defineProperty(y,"UnionExecutor",{enumerable:!0,get:o(function(){return Y6.UnionExecutor},"get")});var K6=Qy();Object.defineProperty(y,"ConstructExecutor",{enumerable:!0,get:o(function(){return K6.ConstructExecutor},"get")});var X6=Mw();Object.defineProperty(y,"DescribeExecutor",{enumerable:!0,get:o(function(){return X6.DescribeExecutor},"get")});var J6=Yw();Object.defineProperty(y,"QueryExecutor",{enumerable:!0,get:o(function(){return J6.QueryExecutor},"get")});var FE=Xw();Object.defineProperty(y,"UpdateExecutor",{enumerable:!0,get:o(function(){return FE.UpdateExecutor},"get")});Object.defineProperty(y,"UpdateExecutorError",{enumerable:!0,get:o(function(){return FE.UpdateExecutorError},"get")});var Z6=es();Object.defineProperty(y,"SolutionMapping",{enumerable:!0,get:o(function(){return Z6.SolutionMapping},"get")});var ek=Eh();Object.defineProperty(y,"BuiltInFunctions",{enumerable:!0,get:o(function(){return ek.BuiltInFunctions},"get")});var tk=Zw();Object.defineProperty(y,"AggregateFunctions",{enumerable:!0,get:o(function(){return tk.AggregateFunctions},"get")});var DE=Jy();Object.defineProperty(y,"CustomAggregateRegistry",{enumerable:!0,get:o(function(){return DE.CustomAggregateRegistry},"get")});Object.defineProperty(y,"CustomAggregateError",{enumerable:!0,get:o(function(){return DE.CustomAggregateError},"get")});var Oi=Zy();Object.defineProperty(y,"BUILT_IN_AGGREGATES",{enumerable:!0,get:o(function(){return Oi.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(y,"EXO_AGGREGATE_NS",{enumerable:!0,get:o(function(){return Oi.EXO_AGGREGATE_NS},"get")});Object.defineProperty(y,"medianAggregate",{enumerable:!0,get:o(function(){return Oi.medianAggregate},"get")});Object.defineProperty(y,"varianceAggregate",{enumerable:!0,get:o(function(){return Oi.varianceAggregate},"get")});Object.defineProperty(y,"stddevAggregate",{enumerable:!0,get:o(function(){return Oi.stddevAggregate},"get")});Object.defineProperty(y,"modeAggregate",{enumerable:!0,get:o(function(){return Oi.modeAggregate},"get")});Object.defineProperty(y,"createPercentileAggregate",{enumerable:!0,get:o(function(){return Oi.createPercentileAggregate},"get")});Object.defineProperty(y,"getNumericValue",{enumerable:!0,get:o(function(){return Oi.getNumericValue},"get")});Object.defineProperty(y,"createDecimalLiteral",{enumerable:!0,get:o(function(){return Oi.createDecimalLiteral},"get")});Object.defineProperty(y,"createDoubleLiteral",{enumerable:!0,get:o(function(){return Oi.createDoubleLiteral},"get")});var rk=eE();Object.defineProperty(y,"QueryPlanCache",{enumerable:!0,get:o(function(){return rk.QueryPlanCache},"get")});var NE=tE();Object.defineProperty(y,"SPARQLResultCache",{enumerable:!0,get:o(function(){return NE.SPARQLResultCache},"get")});Object.defineProperty(y,"createSPARQLResultCache",{enumerable:!0,get:o(function(){return NE.createSPARQLResultCache},"get")});var LE=rE();Object.defineProperty(y,"IncrementalIndexer",{enumerable:!0,get:o(function(){return LE.IncrementalIndexer},"get")});Object.defineProperty(y,"createIncrementalIndexer",{enumerable:!0,get:o(function(){return LE.createIncrementalIndexer},"get")});var nk=nE();Object.defineProperty(y,"ResultSerializer",{enumerable:!0,get:o(function(){return nk.ResultSerializer},"get")});var kE=gy();Object.defineProperty(y,"CaseWhenTransformer",{enumerable:!0,get:o(function(){return kE.CaseWhenTransformer},"get")});Object.defineProperty(y,"CaseWhenTransformerError",{enumerable:!0,get:o(function(){return kE.CaseWhenTransformerError},"get")});var ik=Ey();Object.defineProperty(y,"VaultPrefixTransformer",{enumerable:!0,get:o(function(){return ik.VaultPrefixTransformer},"get")});var sk=Ry();Object.defineProperty(y,"FilterContainsOptimizer",{enumerable:!0,get:o(function(){return sk.FilterContainsOptimizer},"get")});var ME=iE();Object.defineProperty(y,"FileNotFoundError",{enumerable:!0,get:o(function(){return ME.FileNotFoundError},"get")});Object.defineProperty(y,"FileAlreadyExistsError",{enumerable:!0,get:o(function(){return ME.FileAlreadyExistsError},"get")});var F1=K0();Object.defineProperty(y,"TripleAlreadyExistsError",{enumerable:!0,get:o(function(){return F1.TripleAlreadyExistsError},"get")});Object.defineProperty(y,"TripleNotFoundError",{enumerable:!0,get:o(function(){return F1.TripleNotFoundError},"get")});Object.defineProperty(y,"TransactionError",{enumerable:!0,get:o(function(){return F1.TransactionError},"get")});var ak=lt();Object.defineProperty(y,"DI_TOKENS",{enumerable:!0,get:o(function(){return ak.DI_TOKENS},"get")});var hl=sE();Object.defineProperty(y,"registerCoreServices",{enumerable:!0,get:o(function(){return hl.registerCoreServices},"get")});Object.defineProperty(y,"createChildContainer",{enumerable:!0,get:o(function(){return hl.createChildContainer},"get")});Object.defineProperty(y,"getContainer",{enumerable:!0,get:o(function(){return hl.getContainer},"get")});Object.defineProperty(y,"resetContainer",{enumerable:!0,get:o(function(){return hl.resetContainer},"get")});Object.defineProperty(y,"container",{enumerable:!0,get:o(function(){return hl.container},"get")});var ts=fE();Object.defineProperty(y,"NODE_FLAGS",{enumerable:!0,get:o(function(){return ts.NODE_FLAGS},"get")});Object.defineProperty(y,"DEFAULT_COLORS",{enumerable:!0,get:o(function(){return ts.DEFAULT_COLORS},"get")});Object.defineProperty(y,"StringTable",{enumerable:!0,get:o(function(){return ts.StringTable},"get")});Object.defineProperty(y,"CompactGraphStore",{enumerable:!0,get:o(function(){return ts.CompactGraphStore},"get")});Object.defineProperty(y,"MemoryPool",{enumerable:!0,get:o(function(){return ts.MemoryPool},"get")});Object.defineProperty(y,"getGlobalPool",{enumerable:!0,get:o(function(){return ts.getGlobalPool},"get")});Object.defineProperty(y,"resetGlobalPool",{enumerable:!0,get:o(function(){return ts.resetGlobalPool},"get")});Object.defineProperty(y,"StreamingLoader",{enumerable:!0,get:o(function(){return ts.StreamingLoader},"get")});Object.defineProperty(y,"createStreamingSource",{enumerable:!0,get:o(function(){return ts.createStreamingSource},"get")});Tn(bE(),y);Tn(wE(),y)});var qt=v(D1=>{"use strict";D1.fromCallback=function(n){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")n.apply(this,e);else return new Promise((t,r)=>{e.push((i,s)=>i!=null?r(i):t(s)),n.apply(this,e)})},"name",{value:n.name})};D1.fromPromise=function(n){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return n.apply(this,e);e.pop(),n.apply(this,e).then(r=>t(null,r),t)},"name",{value:n.name})}});var $E=v((SK,jE)=>{var xs=require("constants"),ok=process.cwd,nd=null,ck=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return nd||(nd=ok.call(process)),nd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(N1=process.chdir,process.chdir=function(n){nd=null,N1.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,N1));var N1;jE.exports=lk;function lk(n){xs.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(n),n.lutimes||t(n),n.chown=s(n.chown),n.fchown=s(n.fchown),n.lchown=s(n.lchown),n.chmod=r(n.chmod),n.fchmod=r(n.fchmod),n.lchmod=r(n.lchmod),n.chownSync=a(n.chownSync),n.fchownSync=a(n.fchownSync),n.lchownSync=a(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=c(n.stat),n.fstat=c(n.fstat),n.lstat=c(n.lstat),n.statSync=l(n.statSync),n.fstatSync=l(n.fstatSync),n.lstatSync=l(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(f,h,d){d&&process.nextTick(d)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,h,d,p){p&&process.nextTick(p)},n.lchownSync=function(){}),ck==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function h(d,p,_){var b=Date.now(),E=0;f(d,p,o(function A(C){if(C&&(C.code==="EACCES"||C.code==="EPERM"||C.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){n.stat(p,function(j,G){j&&j.code==="ENOENT"?f(d,p,A):_(C)})},E),E<100&&(E+=10);return}_&&_(C)},"CB"))}return o(h,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function h(d,p,_,b,E,A){var C;if(A&&typeof A=="function"){var j=0;C=o(function(G,Q,H){if(G&&G.code==="EAGAIN"&&j<10)return j++,f.call(n,d,p,_,b,E,C);A.apply(this,arguments)},"callback")}return f.call(n,d,p,_,b,E,C)}return o(h,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(h,f),h})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(h,d,p,_,b){for(var E=0;;)try{return f.call(n,h,d,p,_,b)}catch(A){if(A.code==="EAGAIN"&&E<10){E++;continue}throw A}}})(n.readSync);function e(f){f.lchmod=function(h,d,p){f.open(h,xs.O_WRONLY|xs.O_SYMLINK,d,function(_,b){if(_){p&&p(_);return}f.fchmod(b,d,function(E){f.close(b,function(A){p&&p(E||A)})})})},f.lchmodSync=function(h,d){var p=f.openSync(h,xs.O_WRONLY|xs.O_SYMLINK,d),_=!0,b;try{b=f.fchmodSync(p,d),_=!1}finally{if(_)try{f.closeSync(p)}catch{}else f.closeSync(p)}return b}}o(e,"patchLchmod");function t(f){xs.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(h,d,p,_){f.open(h,xs.O_SYMLINK,function(b,E){if(b){_&&_(b);return}f.futimes(E,d,p,function(A){f.close(E,function(C){_&&_(A||C)})})})},f.lutimesSync=function(h,d,p){var _=f.openSync(h,xs.O_SYMLINK),b,E=!0;try{b=f.futimesSync(_,d,p),E=!1}finally{if(E)try{f.closeSync(_)}catch{}else f.closeSync(_)}return b}):f.futimes&&(f.lutimes=function(h,d,p,_){_&&process.nextTick(_)},f.lutimesSync=function(){})}o(t,"patchLutimes");function r(f){return f&&function(h,d,p){return f.call(n,h,d,function(_){u(_)&&(_=null),p&&p.apply(this,arguments)})}}o(r,"chmodFix");function i(f){return f&&function(h,d){try{return f.call(n,h,d)}catch(p){if(!u(p))throw p}}}o(i,"chmodFixSync");function s(f){return f&&function(h,d,p,_){return f.call(n,h,d,p,function(b){u(b)&&(b=null),_&&_.apply(this,arguments)})}}o(s,"chownFix");function a(f){return f&&function(h,d,p){try{return f.call(n,h,d,p)}catch(_){if(!u(_))throw _}}}o(a,"chownFixSync");function c(f){return f&&function(h,d,p){typeof d=="function"&&(p=d,d=null);function _(b,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),p&&p.apply(this,arguments)}return o(_,"callback"),d?f.call(n,h,d,_):f.call(n,h,_)}}o(c,"statFix");function l(f){return f&&function(h,d){var p=d?f.call(n,h,d):f.call(n,h);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}o(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(f.code==="EINVAL"||f.code==="EPERM"))}o(u,"chownErOk")}o(lk,"patch")});var BE=v((EK,UE)=>{var VE=require("stream").Stream;UE.exports=uk;function uk(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);VE.call(this);var s=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var a=Object.keys(i),c=0,l=a.length;c<l;c++){var u=a[c];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}n.open(this.path,this.flags,this.mode,function(f,h){if(f){s.emit("error",f),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function t(r,i){if(!(this instanceof t))return new t(r,i);VE.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),a=0,c=s.length;a<c;a++){var l=s[a];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}o(uk,"legacy")});var GE=v((xK,qE)=>{"use strict";qE.exports=hk;var fk=Object.getPrototypeOf||function(n){return n.__proto__};function hk(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:fk(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}o(hk,"clone")});var Go=v((CK,M1)=>{var wt=require("fs"),dk=$E(),pk=BE(),mk=GE(),id=require("util"),or,ad;typeof Symbol=="function"&&typeof Symbol.for=="function"?(or=Symbol.for("graceful-fs.queue"),ad=Symbol.for("graceful-fs.previous")):(or="___graceful-fs.queue",ad="___graceful-fs.previous");function gk(){}o(gk,"noop");function zE(n,e){Object.defineProperty(n,or,{get:o(function(){return e},"get")})}o(zE,"publishQueue");var Ta=gk;id.debuglog?Ta=id.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ta=o(function(){var n=id.format.apply(id,arguments);n="GFS4: "+n.split(/\n/).join(`
|
|
384
|
+
GFS4: `),console.error(n)},"debug"));wt[or]||(WE=global[or]||[],zE(wt,WE),wt.close=(function(n){function e(t,r){return n.call(wt,t,function(i){i||HE(),typeof r=="function"&&r.apply(this,arguments)})}return o(e,"close"),Object.defineProperty(e,ad,{value:n}),e})(wt.close),wt.closeSync=(function(n){function e(t){n.apply(wt,arguments),HE()}return o(e,"closeSync"),Object.defineProperty(e,ad,{value:n}),e})(wt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ta(wt[or]),require("assert").equal(wt[or].length,0)}));var WE;global[or]||zE(global,wt[or]);M1.exports=L1(mk(wt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!wt.__patched&&(M1.exports=L1(wt),wt.__patched=!0);function L1(n){dk(n),n.gracefulify=L1,n.createReadStream=Q,n.createWriteStream=H;var e=n.readFile;n.readFile=t;function t(L,Y,ge){return typeof Y=="function"&&(ge=Y,Y=null),dt(L,Y,ge);function dt(nt,vt,Ke,Je){return e(nt,vt,function(Ue){Ue&&(Ue.code==="EMFILE"||Ue.code==="ENFILE")?qo([dt,[nt,vt,Ke],Ue,Je||Date.now(),Date.now()]):typeof Ke=="function"&&Ke.apply(this,arguments)})}o(dt,"go$readFile")}o(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(L,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=null),nt(L,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return r(vt,Ke,Je,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$writeFile")}o(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=a);function a(L,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=null),nt(L,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return s(vt,Ke,Je,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$appendFile")}o(a,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(L,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=0),nt(L,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return c(vt,Ke,Je,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$copyFile")}o(l,"copyFile");var u=n.readdir;n.readdir=h;var f=/^v[0-5]\./;function h(L,Y,ge){typeof Y=="function"&&(ge=Y,Y=null);var dt=f.test(process.version)?o(function(Ke,Je,Ue,te){return u(Ke,nt(Ke,Je,Ue,te))},"go$readdir"):o(function(Ke,Je,Ue,te){return u(Ke,Je,nt(Ke,Je,Ue,te))},"go$readdir");return dt(L,Y,ge);function nt(vt,Ke,Je,Ue){return function(te,$){te&&(te.code==="EMFILE"||te.code==="ENFILE")?qo([dt,[vt,Ke,Je],te,Ue||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof Je=="function"&&Je.call(this,te,$))}}}if(o(h,"readdir"),process.version.substr(0,4)==="v0.8"){var d=pk(n);A=d.ReadStream,j=d.WriteStream}var p=n.ReadStream;p&&(A.prototype=Object.create(p.prototype),A.prototype.open=C);var _=n.WriteStream;_&&(j.prototype=Object.create(_.prototype),j.prototype.open=G),Object.defineProperty(n,"ReadStream",{get:o(function(){return A},"get"),set:o(function(L){A=L},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:o(function(){return j},"get"),set:o(function(L){j=L},"set"),enumerable:!0,configurable:!0});var b=A;Object.defineProperty(n,"FileReadStream",{get:o(function(){return b},"get"),set:o(function(L){b=L},"set"),enumerable:!0,configurable:!0});var E=j;Object.defineProperty(n,"FileWriteStream",{get:o(function(){return E},"get"),set:o(function(L){E=L},"set"),enumerable:!0,configurable:!0});function A(L,Y){return this instanceof A?(p.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}o(A,"ReadStream");function C(){var L=this;Se(L.path,L.flags,L.mode,function(Y,ge){Y?(L.autoClose&&L.destroy(),L.emit("error",Y)):(L.fd=ge,L.emit("open",ge),L.read())})}o(C,"ReadStream$open");function j(L,Y){return this instanceof j?(_.apply(this,arguments),this):j.apply(Object.create(j.prototype),arguments)}o(j,"WriteStream");function G(){var L=this;Se(L.path,L.flags,L.mode,function(Y,ge){Y?(L.destroy(),L.emit("error",Y)):(L.fd=ge,L.emit("open",ge))})}o(G,"WriteStream$open");function Q(L,Y){return new n.ReadStream(L,Y)}o(Q,"createReadStream");function H(L,Y){return new n.WriteStream(L,Y)}o(H,"createWriteStream");var ee=n.open;n.open=Se;function Se(L,Y,ge,dt){return typeof ge=="function"&&(dt=ge,ge=null),nt(L,Y,ge,dt);function nt(vt,Ke,Je,Ue,te){return ee(vt,Ke,Je,function($,Ze){$&&($.code==="EMFILE"||$.code==="ENFILE")?qo([nt,[vt,Ke,Je,Ue],$,te||Date.now(),Date.now()]):typeof Ue=="function"&&Ue.apply(this,arguments)})}o(nt,"go$open")}return o(Se,"open"),n}o(L1,"patch");function qo(n){Ta("ENQUEUE",n[0].name,n[1]),wt[or].push(n),k1()}o(qo,"enqueue");var sd;function HE(){for(var n=Date.now(),e=0;e<wt[or].length;++e)wt[or][e].length>2&&(wt[or][e][3]=n,wt[or][e][4]=n);k1()}o(HE,"resetQueue");function k1(){if(clearTimeout(sd),sd=void 0,wt[or].length!==0){var n=wt[or].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Ta("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Ta("TIMEOUT",e.name,t);var a=t.pop();typeof a=="function"&&a.call(null,r)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Ta("RETRY",e.name,t),e.apply(null,t.concat([i]))):wt[or].push(n)}sd===void 0&&(sd=setTimeout(k1,0))}}o(k1,"retry")});var Mr=v(rs=>{"use strict";var QE=qt().fromCallback,kr=Go(),yk=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(n=>typeof kr[n]=="function");Object.assign(rs,kr);yk.forEach(n=>{rs[n]=QE(kr[n])});rs.exists=function(n,e){return typeof e=="function"?kr.exists(n,e):new Promise(t=>kr.exists(n,t))};rs.read=function(n,e,t,r,i,s){return typeof s=="function"?kr.read(n,e,t,r,i,s):new Promise((a,c)=>{kr.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);a({bytesRead:u,buffer:f})})})};rs.write=function(n,e,...t){return typeof t[t.length-1]=="function"?kr.write(n,e,...t):new Promise((r,i)=>{kr.write(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffer:c})})})};rs.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?kr.readv(n,e,...t):new Promise((r,i)=>{kr.readv(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesRead:a,buffers:c})})})};rs.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?kr.writev(n,e,...t):new Promise((r,i)=>{kr.writev(n,e,...t,(s,a,c)=>{if(s)return i(s);r({bytesWritten:a,buffers:c})})})};typeof kr.realpath.native=="function"?rs.realpath.native=QE(kr.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var KE=v((PK,YE)=>{"use strict";var vk=require("path");YE.exports.checkPath=o(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(vk.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var eT=v((FK,j1)=>{"use strict";var XE=Mr(),{checkPath:JE}=KE(),ZE=o(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");j1.exports.makeDir=async(n,e)=>(JE(n),XE.mkdir(n,{mode:ZE(e),recursive:!0}));j1.exports.makeDirSync=(n,e)=>(JE(n),XE.mkdirSync(n,{mode:ZE(e),recursive:!0}))});var ni=v((NK,tT)=>{"use strict";var _k=qt().fromPromise,{makeDir:bk,makeDirSync:$1}=eT(),V1=_k(bk);tT.exports={mkdirs:V1,mkdirsSync:$1,mkdirp:V1,mkdirpSync:$1,ensureDir:V1,ensureDirSync:$1}});var As=v((LK,nT)=>{"use strict";var Sk=qt().fromPromise,rT=Mr();function wk(n){return rT.access(n).then(()=>!0).catch(()=>!1)}o(wk,"pathExists");nT.exports={pathExists:Sk(wk),pathExistsSync:rT.existsSync}});var U1=v((MK,iT)=>{"use strict";var Wo=Mr(),Ek=qt().fromPromise;async function Tk(n,e,t){let r=await Wo.open(n,"r+"),i=null;try{await Wo.futimes(r,e,t)}finally{try{await Wo.close(r)}catch(s){i=s}}if(i)throw i}o(Tk,"utimesMillis");function xk(n,e,t){let r=Wo.openSync(n,"r+");return Wo.futimesSync(r,e,t),Wo.closeSync(r)}o(xk,"utimesMillisSync");iT.exports={utimesMillis:Ek(Tk),utimesMillisSync:xk}});var xa=v(($K,cT)=>{"use strict";var Ho=Mr(),Gt=require("path"),sT=qt().fromPromise;function Ak(n,e,t){let r=t.dereference?i=>Ho.stat(i,{bigint:!0}):i=>Ho.lstat(i,{bigint:!0});return Promise.all([r(n),r(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}o(Ak,"getStats");function Ck(n,e,t){let r,i=t.dereference?a=>Ho.statSync(a,{bigint:!0}):a=>Ho.lstatSync(a,{bigint:!0}),s=i(n);try{r=i(e)}catch(a){if(a.code==="ENOENT")return{srcStat:s,destStat:null};throw a}return{srcStat:s,destStat:r}}o(Ck,"getStatsSync");async function Ik(n,e,t,r){let{srcStat:i,destStat:s}=await Ak(n,e,r);if(s){if(dl(i,s)){let a=Gt.basename(n),c=Gt.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&B1(n,e))throw new Error(od(n,e,t));return{srcStat:i,destStat:s}}o(Ik,"checkPaths");function Ok(n,e,t,r){let{srcStat:i,destStat:s}=Ck(n,e,r);if(s){if(dl(i,s)){let a=Gt.basename(n),c=Gt.basename(e);if(t==="move"&&a!==c&&a.toLowerCase()===c.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${n}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${n}'.`)}if(i.isDirectory()&&B1(n,e))throw new Error(od(n,e,t));return{srcStat:i,destStat:s}}o(Ok,"checkPathsSync");async function aT(n,e,t,r){let i=Gt.resolve(Gt.dirname(n)),s=Gt.resolve(Gt.dirname(t));if(s===i||s===Gt.parse(s).root)return;let a;try{a=await Ho.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(dl(e,a))throw new Error(od(n,t,r));return aT(n,e,s,r)}o(aT,"checkParentPaths");function oT(n,e,t,r){let i=Gt.resolve(Gt.dirname(n)),s=Gt.resolve(Gt.dirname(t));if(s===i||s===Gt.parse(s).root)return;let a;try{a=Ho.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(dl(e,a))throw new Error(od(n,t,r));return oT(n,e,s,r)}o(oT,"checkParentPathsSync");function dl(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}o(dl,"areIdentical");function B1(n,e){let t=Gt.resolve(n).split(Gt.sep).filter(i=>i),r=Gt.resolve(e).split(Gt.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}o(B1,"isSrcSubdir");function od(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}o(od,"errMsg");cT.exports={checkPaths:sT(Ik),checkPathsSync:Ok,checkParentPaths:sT(aT),checkParentPathsSync:oT,isSrcSubdir:B1,areIdentical:dl}});var uT=v((UK,lT)=>{"use strict";async function Pk(n,e){let t=[];for await(let r of n)t.push(e(r).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(t.map(r=>r.then(i=>{if(i!==null)throw i})))}o(Pk,"asyncIteratorConcurrentProcess");lT.exports={asyncIteratorConcurrentProcess:Pk}});var mT=v((qK,pT)=>{"use strict";var br=Mr(),pl=require("path"),{mkdirs:Rk}=ni(),{pathExists:Fk}=As(),{utimesMillis:Dk}=U1(),ml=xa(),{asyncIteratorConcurrentProcess:Nk}=uT();async function Lk(n,e,t={}){typeof t=="function"&&(t={filter:t}),t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
385
385
|
|
|
386
386
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await ml.checkPaths(n,e,"copy",t);if(await ml.checkParentPaths(n,r,e,"copy"),!await hT(n,e,t))return;let a=pl.dirname(e);await Fk(a)||await Rk(a),await dT(i,n,e,t)}o(Lk,"copy");async function hT(n,e,t){return t.filter?t.filter(n,e):!0}o(hT,"runFilter");async function dT(n,e,t,r){let s=await(r.dereference?br.stat:br.lstat)(e);if(s.isDirectory())return $k(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return kk(s,n,e,t,r);if(s.isSymbolicLink())return Vk(n,e,t,r);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}o(dT,"getStatsAndPerformCopy");async function kk(n,e,t,r,i){if(!e)return fT(n,t,r,i);if(i.overwrite)return await br.unlink(r),fT(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}o(kk,"onFile");async function fT(n,e,t,r){if(await br.copyFile(e,t),r.preserveTimestamps){Mk(n.mode)&&await jk(t,n.mode);let i=await br.stat(e);await Dk(t,i.atime,i.mtime)}return br.chmod(t,n.mode)}o(fT,"copyFile");function Mk(n){return(n&128)===0}o(Mk,"fileIsNotWritable");function jk(n,e){return br.chmod(n,e|128)}o(jk,"makeFileWritable");async function $k(n,e,t,r,i){e||await br.mkdir(r),await Nk(await br.opendir(t),async s=>{let a=pl.join(t,s.name),c=pl.join(r,s.name);if(await hT(a,c,i)){let{destStat:u}=await ml.checkPaths(a,c,"copy",i);await dT(u,a,c,i)}}),e||await br.chmod(r,n.mode)}o($k,"onDir");async function Vk(n,e,t,r){let i=await br.readlink(e);if(r.dereference&&(i=pl.resolve(process.cwd(),i)),!n)return br.symlink(i,t);let s=null;try{s=await br.readlink(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return br.symlink(i,t);throw a}if(r.dereference&&(s=pl.resolve(process.cwd(),s)),ml.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(ml.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await br.unlink(t),br.symlink(i,t)}o(Vk,"onLink");pT.exports=Lk});var bT=v((WK,_T)=>{"use strict";var jr=Go(),gl=require("path"),Uk=ni().mkdirsSync,Bk=U1().utimesMillisSync,yl=xa();function qk(n,e,t){typeof t=="function"&&(t={filter:t}),t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
387
387
|
|
|
388
388
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=yl.checkPathsSync(n,e,"copy",t);if(yl.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=gl.dirname(e);return jr.existsSync(s)||Uk(s),gT(i,n,e,t)}o(qk,"copySync");function gT(n,e,t,r){let s=(r.dereference?jr.statSync:jr.lstatSync)(e);if(s.isDirectory())return Kk(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Gk(s,n,e,t,r);if(s.isSymbolicLink())return Zk(n,e,t,r);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}o(gT,"getStats");function Gk(n,e,t,r,i){return e?Wk(n,t,r,i):yT(n,t,r,i)}o(Gk,"onFile");function Wk(n,e,t,r){if(r.overwrite)return jr.unlinkSync(t),yT(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}o(Wk,"mayCopyFile");function yT(n,e,t,r){return jr.copyFileSync(e,t),r.preserveTimestamps&&Hk(n.mode,e,t),q1(t,n.mode)}o(yT,"copyFile");function Hk(n,e,t){return zk(n)&&Qk(t,n),Yk(e,t)}o(Hk,"handleTimestamps");function zk(n){return(n&128)===0}o(zk,"fileIsNotWritable");function Qk(n,e){return q1(n,e|128)}o(Qk,"makeFileWritable");function q1(n,e){return jr.chmodSync(n,e)}o(q1,"setDestMode");function Yk(n,e){let t=jr.statSync(n);return Bk(e,t.atime,t.mtime)}o(Yk,"setDestTimestamps");function Kk(n,e,t,r,i){return e?vT(t,r,i):Xk(n.mode,t,r,i)}o(Kk,"onDir");function Xk(n,e,t,r){return jr.mkdirSync(t),vT(e,t,r),q1(t,n)}o(Xk,"mkDirAndCopy");function vT(n,e,t){let r=jr.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)Jk(i.name,n,e,t)}finally{r.closeSync()}}o(vT,"copyDir");function Jk(n,e,t,r){let i=gl.join(e,n),s=gl.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:a}=yl.checkPathsSync(i,s,"copy",r);return gT(a,i,s,r)}o(Jk,"copyDirItem");function Zk(n,e,t,r){let i=jr.readlinkSync(e);if(r.dereference&&(i=gl.resolve(process.cwd(),i)),n){let s;try{s=jr.readlinkSync(t)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return jr.symlinkSync(i,t);throw a}if(r.dereference&&(s=gl.resolve(process.cwd(),s)),yl.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(yl.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return eM(i,t)}else return jr.symlinkSync(i,t)}o(Zk,"onLink");function eM(n,e){return jr.unlinkSync(e),jr.symlinkSync(n,e)}o(eM,"copyLink");_T.exports=qk});var cd=v((zK,ST)=>{"use strict";var tM=qt().fromPromise;ST.exports={copy:tM(mT()),copySync:bT()}});var vl=v((QK,ET)=>{"use strict";var wT=Go(),rM=qt().fromCallback;function nM(n,e){wT.rm(n,{recursive:!0,force:!0},e)}o(nM,"remove");function iM(n){wT.rmSync(n,{recursive:!0,force:!0})}o(iM,"removeSync");ET.exports={remove:rM(nM),removeSync:iM}});var RT=v((KK,PT)=>{"use strict";var sM=qt().fromPromise,AT=Mr(),CT=require("path"),IT=ni(),OT=vl(),TT=sM(o(async function(e){let t;try{t=await AT.readdir(e)}catch{return IT.mkdirs(e)}return Promise.all(t.map(r=>OT.remove(CT.join(e,r))))},"emptyDir"));function xT(n){let e;try{e=AT.readdirSync(n)}catch{return IT.mkdirsSync(n)}e.forEach(t=>{t=CT.join(n,t),OT.removeSync(t)})}o(xT,"emptyDirSync");PT.exports={emptyDirSync:xT,emptydirSync:xT,emptyDir:TT,emptydir:TT}});var LT=v((JK,NT)=>{"use strict";var aM=qt().fromPromise,FT=require("path"),ns=Mr(),DT=ni();async function oM(n){let e;try{e=await ns.stat(n)}catch{}if(e&&e.isFile())return;let t=FT.dirname(n),r=null;try{r=await ns.stat(t)}catch(i){if(i.code==="ENOENT"){await DT.mkdirs(t),await ns.writeFile(n,"");return}else throw i}r.isDirectory()?await ns.writeFile(n,""):await ns.readdir(t)}o(oM,"createFile");function cM(n){let e;try{e=ns.statSync(n)}catch{}if(e&&e.isFile())return;let t=FT.dirname(n);try{ns.statSync(t).isDirectory()||ns.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")DT.mkdirsSync(t);else throw r}ns.writeFileSync(n,"")}o(cM,"createFileSync");NT.exports={createFile:aM(oM),createFileSync:cM}});var VT=v((eX,$T)=>{"use strict";var lM=qt().fromPromise,kT=require("path"),Cs=Mr(),MT=ni(),{pathExists:uM}=As(),{areIdentical:jT}=xa();async function fM(n,e){let t;try{t=await Cs.lstat(e)}catch{}let r;try{r=await Cs.lstat(n)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(t&&jT(r,t))return;let i=kT.dirname(e);await uM(i)||await MT.mkdirs(i),await Cs.link(n,e)}o(fM,"createLink");function hM(n,e){let t;try{t=Cs.lstatSync(e)}catch{}try{let s=Cs.lstatSync(n);if(t&&jT(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=kT.dirname(e);return Cs.existsSync(r)||MT.mkdirsSync(r),Cs.linkSync(n,e)}o(hM,"createLinkSync");$T.exports={createLink:lM(fM),createLinkSync:hM}});var BT=v((rX,UT)=>{"use strict";var Is=require("path"),_l=Mr(),{pathExists:dM}=As(),pM=qt().fromPromise;async function mM(n,e){if(Is.isAbsolute(n)){try{await _l.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=Is.dirname(e),r=Is.join(t,n);if(await dM(r))return{toCwd:r,toDst:n};try{await _l.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:Is.relative(t,n)}}o(mM,"symlinkPaths");function gM(n,e){if(Is.isAbsolute(n)){if(!_l.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=Is.dirname(e),r=Is.join(t,n);if(_l.existsSync(r))return{toCwd:r,toDst:n};if(!_l.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:Is.relative(t,n)}}o(gM,"symlinkPathsSync");UT.exports={symlinkPaths:pM(mM),symlinkPathsSync:gM}});var WT=v((iX,GT)=>{"use strict";var qT=Mr(),yM=qt().fromPromise;async function vM(n,e){if(e)return e;let t;try{t=await qT.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(vM,"symlinkType");function _M(n,e){if(e)return e;let t;try{t=qT.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}o(_M,"symlinkTypeSync");GT.exports={symlinkType:yM(vM),symlinkTypeSync:_M}});var YT=v((aX,QT)=>{"use strict";var bM=qt().fromPromise,HT=require("path"),Pi=Mr(),{mkdirs:SM,mkdirsSync:wM}=ni(),{symlinkPaths:EM,symlinkPathsSync:TM}=BT(),{symlinkType:xM,symlinkTypeSync:AM}=WT(),{pathExists:CM}=As(),{areIdentical:zT}=xa();async function IM(n,e,t){let r;try{r=await Pi.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([Pi.stat(n),Pi.stat(e)]);if(zT(c,l))return}let i=await EM(n,e);n=i.toDst;let s=await xM(i.toCwd,t),a=HT.dirname(e);return await CM(a)||await SM(a),Pi.symlink(n,e,s)}o(IM,"createSymlink");function OM(n,e,t){let r;try{r=Pi.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=Pi.statSync(n),l=Pi.statSync(e);if(zT(c,l))return}let i=TM(n,e);n=i.toDst,t=AM(i.toCwd,t);let s=HT.dirname(e);return Pi.existsSync(s)||wM(s),Pi.symlinkSync(n,e,t)}o(OM,"createSymlinkSync");QT.exports={createSymlink:bM(IM),createSymlinkSync:OM}});var n3=v((cX,r3)=>{"use strict";var{createFile:KT,createFileSync:XT}=LT(),{createLink:JT,createLinkSync:ZT}=VT(),{createSymlink:e3,createSymlinkSync:t3}=YT();r3.exports={createFile:KT,createFileSync:XT,ensureFile:KT,ensureFileSync:XT,createLink:JT,createLinkSync:ZT,ensureLink:JT,ensureLinkSync:ZT,createSymlink:e3,createSymlinkSync:t3,ensureSymlink:e3,ensureSymlinkSync:t3}});var ld=v((lX,i3)=>{function PM(n,{EOL:e=`
|
|
389
|
-
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(PM,"stringify");function RM(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(RM,"stripBom");i3.exports={stringify:PM,stripBom:RM}});var c3=v((fX,o3)=>{var zo;try{zo=Go()}catch{zo=require("fs")}var ud=qt(),{stringify:s3,stripBom:a3}=ld();async function FM(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||zo,r="throws"in e?e.throws:!0,i=await ud.fromCallback(t.readFile)(n,e);i=a3(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(a){if(r)throw a.message=`${n}: ${a.message}`,a;return null}return s}o(FM,"_readFile");var DM=ud.fromPromise(FM);function NM(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||zo,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=a3(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(NM,"readFileSync");async function LM(n,e,t={}){let r=t.fs||zo,i=s3(e,t);await ud.fromCallback(r.writeFile)(n,i,t)}o(LM,"_writeFile");var kM=ud.fromPromise(LM);function MM(n,e,t={}){let r=t.fs||zo,i=s3(e,t);return r.writeFileSync(n,i,t)}o(MM,"writeFileSync");o3.exports={readFile:DM,readFileSync:NM,writeFile:kM,writeFileSync:MM}});var u3=v((dX,l3)=>{"use strict";var fd=c3();l3.exports={readJson:fd.readFile,readJsonSync:fd.readFileSync,writeJson:fd.writeFile,writeJsonSync:fd.writeFileSync}});var hd=v((pX,d3)=>{"use strict";var jM=qt().fromPromise,G1=Mr(),f3=require("path"),h3=ni(),$M=As().pathExists;async function VM(n,e,t="utf-8"){let r=f3.dirname(n);return await $M(r)||await h3.mkdirs(r),G1.writeFile(n,e,t)}o(VM,"outputFile");function UM(n,...e){let t=f3.dirname(n);G1.existsSync(t)||h3.mkdirsSync(t),G1.writeFileSync(n,...e)}o(UM,"outputFileSync");d3.exports={outputFile:jM(VM),outputFileSync:UM}});var m3=v((gX,p3)=>{"use strict";var{stringify:BM}=ld(),{outputFile:qM}=hd();async function GM(n,e,t={}){let r=BM(e,t);await qM(n,r,t)}o(GM,"outputJson");p3.exports=GM});var y3=v((vX,g3)=>{"use strict";var{stringify:WM}=ld(),{outputFileSync:HM}=hd();function zM(n,e,t){let r=WM(e,t);HM(n,r,t)}o(zM,"outputJsonSync");g3.exports=zM});var _3=v((bX,v3)=>{"use strict";var QM=qt().fromPromise,$r=u3();$r.outputJson=QM(m3());$r.outputJsonSync=y3();$r.outputJSON=$r.outputJson;$r.outputJSONSync=$r.outputJsonSync;$r.writeJSON=$r.writeJson;$r.writeJSONSync=$r.writeJsonSync;$r.readJSON=$r.readJson;$r.readJSONSync=$r.readJsonSync;v3.exports=$r});var T3=v((SX,E3)=>{"use strict";var YM=Mr(),b3=require("path"),{copy:KM}=cd(),{remove:w3}=vl(),{mkdirp:XM}=ni(),{pathExists:JM}=As(),S3=xa();async function ZM(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await S3.checkPaths(n,e,"move",t);await S3.checkParentPaths(n,i,e,"move");let a=b3.dirname(e);return b3.parse(a).root!==a&&await XM(a),e7(n,e,r,s)}o(ZM,"move");async function e7(n,e,t,r){if(!r){if(t)await w3(e);else if(await JM(e))throw new Error("dest already exists.")}try{await YM.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await t7(n,e,t)}}o(e7,"doRename");async function t7(n,e,t){return await KM(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),w3(n)}o(t7,"moveAcrossDevice");E3.exports=ZM});var O3=v((EX,I3)=>{"use strict";var A3=Go(),H1=require("path"),r7=cd().copySync,C3=vl().removeSync,n7=ni().mkdirpSync,x3=xa();function i7(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=x3.checkPathsSync(n,e,"move",t);return x3.checkParentPathsSync(n,i,e,"move"),s7(e)||n7(H1.dirname(e)),a7(n,e,r,s)}o(i7,"moveSync");function s7(n){let e=H1.dirname(n);return H1.parse(e).root===e}o(s7,"isParentRoot");function a7(n,e,t,r){if(r)return W1(n,e,t);if(t)return C3(e),W1(n,e,t);if(A3.existsSync(e))throw new Error("dest already exists.");return W1(n,e,t)}o(a7,"doRename");function W1(n,e,t){try{A3.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return o7(n,e,t)}}o(W1,"rename");function o7(n,e,t){return r7(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),C3(n)}o(o7,"moveAcrossDevice");I3.exports=i7});var R3=v((xX,P3)=>{"use strict";var c7=qt().fromPromise;P3.exports={move:c7(T3()),moveSync:O3()}});var Os=v((AX,F3)=>{"use strict";F3.exports={...Mr(),...cd(),...RT(),...n3(),..._3(),...ni(),...R3(),...hd(),...As(),...vl()}});var IA=v((sre,CA)=>{"use strict";CA.exports=xA;function xA(n,e,t){n instanceof RegExp&&(n=TA(n,t)),e instanceof RegExp&&(e=TA(e,t));var r=AA(n,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+n.length,r[1]),post:t.slice(r[1]+e.length)}}o(xA,"balanced");function TA(n,e){var t=e.match(n);return t?t[0]:null}o(TA,"maybeMatch");xA.range=AA;function AA(n,e,t){var r,i,s,a,c,l=t.indexOf(n),u=t.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(n===e)return[l,u];for(r=[],s=t.length;f>=0&&!c;)f==l?(r.push(f),l=t.indexOf(n,f+1)):r.length==1?c=[r.pop(),u]:(i=r.pop(),i<s&&(s=i,a=u),u=t.indexOf(e,f+1)),f=l<u&&l>=0?l:u;r.length&&(c=[s,a])}return c}o(AA,"range")});var kA=v((ore,LA)=>{var OA=IA();LA.exports=B$;var PA="\0SLASH"+Math.random()+"\0",RA="\0OPEN"+Math.random()+"\0",$2="\0CLOSE"+Math.random()+"\0",FA="\0COMMA"+Math.random()+"\0",DA="\0PERIOD"+Math.random()+"\0";function j2(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(j2,"numeric");function V$(n){return n.split("\\\\").join(PA).split("\\{").join(RA).split("\\}").join($2).split("\\,").join(FA).split("\\.").join(DA)}o(V$,"escapeBraces");function U$(n){return n.split(PA).join("\\").split(RA).join("{").split($2).join("}").split(FA).join(",").split(DA).join(".")}o(U$,"unescapeBraces");function NA(n){if(!n)return[""];var e=[],t=OA("{","}",n);if(!t)return n.split(",");var r=t.pre,i=t.body,s=t.post,a=r.split(",");a[a.length-1]+="{"+i+"}";var c=NA(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(NA,"parseCommaParts");function B$(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),jl(V$(n),!0).map(U$)):[]}o(B$,"expandTop");function q$(n){return"{"+n+"}"}o(q$,"embrace");function G$(n){return/^-?0\d/.test(n)}o(G$,"isPadded");function W$(n,e){return n<=e}o(W$,"lte");function H$(n,e){return n>=e}o(H$,"gte");function jl(n,e){var t=[],r=OA("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?jl(r.post,!1):[""];if(/\$$/.test(r.pre))for(var a=0;a<s.length;a++){var c=i+"{"+r.body+"}"+s[a];t.push(c)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),f=l||u,h=r.body.indexOf(",")>=0;if(!f&&!h)return r.post.match(/,(?!,).*\}/)?(n=r.pre+"{"+r.body+$2+r.post,jl(n)):[n];var d;if(f)d=r.body.split(/\.\./);else if(d=NA(r.body),d.length===1&&(d=jl(d[0],!1).map(q$),d.length===1))return s.map(function(Y){return r.pre+d[0]+Y});var p;if(f){var _=j2(d[0]),b=j2(d[1]),E=Math.max(d[0].length,d[1].length),A=d.length==3?Math.abs(j2(d[2])):1,C=W$,
|
|
389
|
+
`,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}o(PM,"stringify");function RM(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}o(RM,"stripBom");i3.exports={stringify:PM,stripBom:RM}});var c3=v((fX,o3)=>{var zo;try{zo=Go()}catch{zo=require("fs")}var ud=qt(),{stringify:s3,stripBom:a3}=ld();async function FM(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||zo,r="throws"in e?e.throws:!0,i=await ud.fromCallback(t.readFile)(n,e);i=a3(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(a){if(r)throw a.message=`${n}: ${a.message}`,a;return null}return s}o(FM,"_readFile");var DM=ud.fromPromise(FM);function NM(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||zo,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=a3(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}o(NM,"readFileSync");async function LM(n,e,t={}){let r=t.fs||zo,i=s3(e,t);await ud.fromCallback(r.writeFile)(n,i,t)}o(LM,"_writeFile");var kM=ud.fromPromise(LM);function MM(n,e,t={}){let r=t.fs||zo,i=s3(e,t);return r.writeFileSync(n,i,t)}o(MM,"writeFileSync");o3.exports={readFile:DM,readFileSync:NM,writeFile:kM,writeFileSync:MM}});var u3=v((dX,l3)=>{"use strict";var fd=c3();l3.exports={readJson:fd.readFile,readJsonSync:fd.readFileSync,writeJson:fd.writeFile,writeJsonSync:fd.writeFileSync}});var hd=v((pX,d3)=>{"use strict";var jM=qt().fromPromise,G1=Mr(),f3=require("path"),h3=ni(),$M=As().pathExists;async function VM(n,e,t="utf-8"){let r=f3.dirname(n);return await $M(r)||await h3.mkdirs(r),G1.writeFile(n,e,t)}o(VM,"outputFile");function UM(n,...e){let t=f3.dirname(n);G1.existsSync(t)||h3.mkdirsSync(t),G1.writeFileSync(n,...e)}o(UM,"outputFileSync");d3.exports={outputFile:jM(VM),outputFileSync:UM}});var m3=v((gX,p3)=>{"use strict";var{stringify:BM}=ld(),{outputFile:qM}=hd();async function GM(n,e,t={}){let r=BM(e,t);await qM(n,r,t)}o(GM,"outputJson");p3.exports=GM});var y3=v((vX,g3)=>{"use strict";var{stringify:WM}=ld(),{outputFileSync:HM}=hd();function zM(n,e,t){let r=WM(e,t);HM(n,r,t)}o(zM,"outputJsonSync");g3.exports=zM});var _3=v((bX,v3)=>{"use strict";var QM=qt().fromPromise,$r=u3();$r.outputJson=QM(m3());$r.outputJsonSync=y3();$r.outputJSON=$r.outputJson;$r.outputJSONSync=$r.outputJsonSync;$r.writeJSON=$r.writeJson;$r.writeJSONSync=$r.writeJsonSync;$r.readJSON=$r.readJson;$r.readJSONSync=$r.readJsonSync;v3.exports=$r});var T3=v((SX,E3)=>{"use strict";var YM=Mr(),b3=require("path"),{copy:KM}=cd(),{remove:w3}=vl(),{mkdirp:XM}=ni(),{pathExists:JM}=As(),S3=xa();async function ZM(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await S3.checkPaths(n,e,"move",t);await S3.checkParentPaths(n,i,e,"move");let a=b3.dirname(e);return b3.parse(a).root!==a&&await XM(a),e7(n,e,r,s)}o(ZM,"move");async function e7(n,e,t,r){if(!r){if(t)await w3(e);else if(await JM(e))throw new Error("dest already exists.")}try{await YM.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await t7(n,e,t)}}o(e7,"doRename");async function t7(n,e,t){return await KM(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),w3(n)}o(t7,"moveAcrossDevice");E3.exports=ZM});var O3=v((EX,I3)=>{"use strict";var A3=Go(),H1=require("path"),r7=cd().copySync,C3=vl().removeSync,n7=ni().mkdirpSync,x3=xa();function i7(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=x3.checkPathsSync(n,e,"move",t);return x3.checkParentPathsSync(n,i,e,"move"),s7(e)||n7(H1.dirname(e)),a7(n,e,r,s)}o(i7,"moveSync");function s7(n){let e=H1.dirname(n);return H1.parse(e).root===e}o(s7,"isParentRoot");function a7(n,e,t,r){if(r)return W1(n,e,t);if(t)return C3(e),W1(n,e,t);if(A3.existsSync(e))throw new Error("dest already exists.");return W1(n,e,t)}o(a7,"doRename");function W1(n,e,t){try{A3.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return o7(n,e,t)}}o(W1,"rename");function o7(n,e,t){return r7(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),C3(n)}o(o7,"moveAcrossDevice");I3.exports=i7});var R3=v((xX,P3)=>{"use strict";var c7=qt().fromPromise;P3.exports={move:c7(T3()),moveSync:O3()}});var Os=v((AX,F3)=>{"use strict";F3.exports={...Mr(),...cd(),...RT(),...n3(),..._3(),...ni(),...R3(),...hd(),...As(),...vl()}});var IA=v((sre,CA)=>{"use strict";CA.exports=xA;function xA(n,e,t){n instanceof RegExp&&(n=TA(n,t)),e instanceof RegExp&&(e=TA(e,t));var r=AA(n,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+n.length,r[1]),post:t.slice(r[1]+e.length)}}o(xA,"balanced");function TA(n,e){var t=e.match(n);return t?t[0]:null}o(TA,"maybeMatch");xA.range=AA;function AA(n,e,t){var r,i,s,a,c,l=t.indexOf(n),u=t.indexOf(e,l+1),f=l;if(l>=0&&u>0){if(n===e)return[l,u];for(r=[],s=t.length;f>=0&&!c;)f==l?(r.push(f),l=t.indexOf(n,f+1)):r.length==1?c=[r.pop(),u]:(i=r.pop(),i<s&&(s=i,a=u),u=t.indexOf(e,f+1)),f=l<u&&l>=0?l:u;r.length&&(c=[s,a])}return c}o(AA,"range")});var kA=v((ore,LA)=>{var OA=IA();LA.exports=B$;var PA="\0SLASH"+Math.random()+"\0",RA="\0OPEN"+Math.random()+"\0",$2="\0CLOSE"+Math.random()+"\0",FA="\0COMMA"+Math.random()+"\0",DA="\0PERIOD"+Math.random()+"\0";function j2(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}o(j2,"numeric");function V$(n){return n.split("\\\\").join(PA).split("\\{").join(RA).split("\\}").join($2).split("\\,").join(FA).split("\\.").join(DA)}o(V$,"escapeBraces");function U$(n){return n.split(PA).join("\\").split(RA).join("{").split($2).join("}").split(FA).join(",").split(DA).join(".")}o(U$,"unescapeBraces");function NA(n){if(!n)return[""];var e=[],t=OA("{","}",n);if(!t)return n.split(",");var r=t.pre,i=t.body,s=t.post,a=r.split(",");a[a.length-1]+="{"+i+"}";var c=NA(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}o(NA,"parseCommaParts");function B$(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),jl(V$(n),!0).map(U$)):[]}o(B$,"expandTop");function q$(n){return"{"+n+"}"}o(q$,"embrace");function G$(n){return/^-?0\d/.test(n)}o(G$,"isPadded");function W$(n,e){return n<=e}o(W$,"lte");function H$(n,e){return n>=e}o(H$,"gte");function jl(n,e){var t=[],r=OA("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?jl(r.post,!1):[""];if(/\$$/.test(r.pre))for(var a=0;a<s.length;a++){var c=i+"{"+r.body+"}"+s[a];t.push(c)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),f=l||u,h=r.body.indexOf(",")>=0;if(!f&&!h)return r.post.match(/,(?!,).*\}/)?(n=r.pre+"{"+r.body+$2+r.post,jl(n)):[n];var d;if(f)d=r.body.split(/\.\./);else if(d=NA(r.body),d.length===1&&(d=jl(d[0],!1).map(q$),d.length===1))return s.map(function(Y){return r.pre+d[0]+Y});var p;if(f){var _=j2(d[0]),b=j2(d[1]),E=Math.max(d[0].length,d[1].length),A=d.length==3?Math.abs(j2(d[2])):1,C=W$,j=b<_;j&&(A*=-1,C=H$);var G=d.some(G$);p=[];for(var Q=_;C(Q,b);Q+=A){var H;if(u)H=String.fromCharCode(Q),H==="\\"&&(H="");else if(H=String(Q),G){var ee=E-H.length;if(ee>0){var Se=new Array(ee+1).join("0");Q<0?H="-"+Se+H.slice(1):H=Se+H}}p.push(H)}}else{p=[];for(var L=0;L<d.length;L++)p.push.apply(p,jl(d[L],!1))}for(var L=0;L<p.length;L++)for(var a=0;a<s.length;a++){var c=i+p[L]+s[a];(!e||f||c)&&t.push(c)}}return t}o(jl,"expand")});var kae=X(Pu());var b_=X(__(),1),{program:WU,createCommand:HU,createArgument:zU,createOption:QU,CommanderError:YU,InvalidArgumentError:KU,InvalidOptionArgumentError:XU,Command:st,Argument:JU,Option:ZU,Help:eB}=b_.default;var Ml=require("fs"),M2=require("path"),Ct=X(ar());var Vt=X(Os()),Wt=X(require("path"));function Q3(n){return typeof n>"u"||n===null}o(Q3,"isNothing");function l7(n){return typeof n=="object"&&n!==null}o(l7,"isObject");function u7(n){return Array.isArray(n)?n:Q3(n)?[]:[n]}o(u7,"toArray");function f7(n,e){var t,r,i,s;if(e)for(s=Object.keys(e),t=0,r=s.length;t<r;t+=1)i=s[t],n[i]=e[i];return n}o(f7,"extend");function h7(n,e){var t="",r;for(r=0;r<e;r+=1)t+=n;return t}o(h7,"repeat");function d7(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}o(d7,"isNegativeZero");var p7=Q3,m7=l7,g7=u7,y7=h7,v7=d7,_7=f7,$t={isNothing:p7,isObject:m7,toArray:g7,repeat:y7,isNegativeZero:v7,extend:_7};function Y3(n,e){var t="",r=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(t+='in "'+n.mark.name+'" '),t+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!e&&n.mark.snippet&&(t+=`
|
|
390
390
|
|
|
391
391
|
`+n.mark.snippet),r+" "+t):r}o(Y3,"formatError");function Sl(n,e){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=e,this.message=Y3(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}o(Sl,"YAMLException$1");Sl.prototype=Object.create(Error.prototype);Sl.prototype.constructor=Sl;Sl.prototype.toString=o(function(e){return this.name+": "+Y3(this,e)},"toString");var Vr=Sl;function z1(n,e,t,r,i){var s="",a="",c=Math.floor(i/2)-1;return r-e>c&&(s=" ... ",e=r-c+s.length),t-r>c&&(a=" ...",t=r+c-a.length),{str:s+n.slice(e,t).replace(/\t/g,"\u2192")+a,pos:r-e+s.length}}o(z1,"getLine");function Q1(n,e){return $t.repeat(" ",e-n.length)+n}o(Q1,"padStart");function b7(n,e){if(e=Object.create(e||null),!n.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var t=/\r?\n|\r|\0/g,r=[0],i=[],s,a=-1;s=t.exec(n.buffer);)i.push(s.index),r.push(s.index+s[0].length),n.position<=s.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var c="",l,u,f=Math.min(n.line+e.linesAfter,i.length).toString().length,h=e.maxLength-(e.indent+f+3);for(l=1;l<=e.linesBefore&&!(a-l<0);l++)u=z1(n.buffer,r[a-l],i[a-l],n.position-(r[a]-r[a-l]),h),c=$t.repeat(" ",e.indent)+Q1((n.line-l+1).toString(),f)+" | "+u.str+`
|
|
392
392
|
`+c;for(u=z1(n.buffer,r[a],i[a],n.position,h),c+=$t.repeat(" ",e.indent)+Q1((n.line+1).toString(),f)+" | "+u.str+`
|
|
@@ -526,19 +526,19 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
526
526
|
`)}formatForJSON(e){return{type:e.type,message:e.message,originalMessage:e.originalMessage,suggestions:e.suggestions,line:e.line,column:e.column,context:e.context?{startLine:e.context.startLine,endLine:e.context.endLine,errorLine:e.context.errorLine,errorColumn:e.context.errorColumn,lines:e.context.lines.map(t=>({number:t.number,content:t.content,isError:t.isError}))}:void 0}}};var Fd=class n{static{o(this,"NTriplesFormatter")}static escapeString(e){let t=e.replace(/\\/g,"\\\\");return t=t.replace(/"/g,'\\"'),t=t.replace(/\n/g,"\\n"),t=t.replace(/\r/g,"\\r"),t=t.replace(/\t/g,"\\t"),t}static formatObject(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("urn:")?`<${e}>`:`"${n.escapeString(e)}"`}};var Pa=require("fs"),L2=require("path");function uA(n){let e=new Map,t="obsidian://vault/",r;try{r=(0,Pa.readdirSync)(n)}catch{return e}for(let i of r){let s=(0,L2.join)(n,i);if(i.startsWith("."))continue;let a;try{a=(0,Pa.statSync)(s)}catch{continue}if(!a.isDirectory())continue;let c;try{c=(0,Pa.readdirSync)(s)}catch{continue}for(let l of c){let u=(0,L2.join)(s,l);if(l.startsWith("."))continue;let f;try{f=(0,Pa.statSync)(u)}catch{continue}if(!f.isDirectory())continue;let h=!1;try{h=(0,Pa.readdirSync)(u).some(p=>p.endsWith(".md"))}catch{continue}if(h){let d=`${i}/${l}`,p=encodeURI(d),_=`${t}${p}/`;/^[a-zA-Z][a-zA-Z0-9_]*$/.test(l)&&e.set(l,_)}}}return e}o(uA,"scanVaultNamespaces");var fA=X(ar());var hA=new Set(["exo","ems","ims","gtd","period","lit","inbox","rdf","rdfs","owl","xsd"]),T$=/(<)([a-zA-Z][a-zA-Z0-9]*)__([a-zA-Z][a-zA-Z0-9_]*)(>)/g;function dA(n){let e=new Set,t=/PREFIX\s+(\w+)\s*:/gi,r;for(;(r=t.exec(n))!==null;)e.add(r[1].toLowerCase());let i=fA.SPARQL_PREFIXES.split(`
|
|
527
527
|
`).filter(a=>a.trim().length>0),s=[];for(let a of i){let c=/PREFIX\s+(\w+)\s*:/i.exec(a);c&&!e.has(c[1].toLowerCase())&&s.push(a)}return s.length===0?n:s.join(`
|
|
528
528
|
`)+`
|
|
529
|
-
`+n}o(dA,"injectExocortexPrefixes");function pA(n){return n.replace(T$,(e,t,r,i,s)=>hA.has(r.toLowerCase())?`${r}:${i}`:e)}o(pA,"transformShorthandNotation");function mA(n){let e=new Map(n);for(let t of hA)e.delete(t);return e}o(mA,"filterOntologyPrefixes");var x$=300,gA=3e4,A$="EXOCORTEX_SPARQL_TIMEOUT";function C$(){let n=process.env[A$];if(!n)return gA;try{let e=I$(n);if(e!==null&&e>0)return e}catch{}return gA}o(C$,"getDefaultTimeout");function I$(n){let e=n.trim().toLowerCase();if(!e)return null;if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);return isNaN(r)||r<=0?null:r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);return isNaN(r)||r<=0?null:r*1e3}let t=parseInt(e,10);return isNaN(t)||t<=0?null:t*1e3}o(I$,"parseTimeoutSafe");function O$(n){if(!n)return x$;let e=parseInt(n.trim(),10);if(isNaN(e)||e<=0)throw new Be(`Invalid cache TTL: "${n}". Must be a positive number (seconds).`,'exocortex sparql query --cache-ttl 600 "SELECT * WHERE { ?s ?p ?o }"');return e}o(O$,"parseCacheTtl");function P$(n){let e=n.trim().toLowerCase();if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);if(isNaN(r)||r<=0)throw new Be(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);if(isNaN(r)||r<=0)throw new Be(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r*1e3}let t=parseInt(e,10);if(isNaN(t)||t<=0)throw new Be(`Invalid timeout format: "${n}". Use formats like "30s", "5000ms", or just a number (seconds).`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return t*1e3}o(P$,"parseTimeout");async function k2(n,e,t=Date.now()){let r=new Promise((i,s)=>{setTimeout(()=>{let a=Date.now()-t;s(new Cl(e,a))},e)});return Promise.race([n,r])}o(k2,"executeWithTimeout");function vA(){return new st("query").description("Execute SPARQL query against Obsidian vault").argument("[query]","SPARQL query string or path to .sparql file (optional if --template is used)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json|csv|ntriples","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--timeout <duration>","Query timeout (e.g., 30s, 5000ms)","30s").option("--dry-run","Validate query syntax without executing (no vault loading)").option("--explain","Show optimized query plan").option("--stats","Show execution statistics").option("--no-optimize","Disable query optimization").option("--use-cache","Use persistent triple cache (faster vault loading)").option("--cache-ttl <seconds>","Query result cache TTL in seconds (default: 300)").option("--no-cache","Bypass query result cache").option("--template <name>","Use a predefined query template").option("--param <params>","Template parameters (format: key=value,key2=value2)").action(async(n,e)=>{let t=e.output||"text";W.setFormat(t);let r="";try{let i=Date.now(),s=e.timeout?P$(e.timeout):C$(),a=O$(e.cacheTtl),c=e.cache!==!1;if(e.template){let H=new sc,ee=e.param?H.parseParamString(e.param):{};if(r=H.applyTemplate(e.template,ee),t==="text"){let Se=H.getTemplate(e.template);console.log(`\u{1F4CB} Using template: ${e.template}`),Object.keys(ee).length>0&&console.log(` Parameters: ${Object.entries(ee).map(([
|
|
530
|
-
`);let
|
|
531
|
-
`),L$(
|
|
532
|
-
`),k$(
|
|
533
|
-
`),console.log("\u{1F50D} Parsing SPARQL query...")}let _=new Ct.SPARQLParser;r=pA(r),r=dA(r);let b=mA(uA(l));b.size>0&&_.setVaultPrefixes(b);let E=_.parse(r);if(E.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let H=Date.now(),ee=new Ct.UpdateExecutor(d),Se=await k2(ee.execute(E),s,H),
|
|
534
|
-
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${p}ms${h?" (from cache)":""}`),console.log(` Query execution: ${
|
|
529
|
+
`+n}o(dA,"injectExocortexPrefixes");function pA(n){return n.replace(T$,(e,t,r,i,s)=>hA.has(r.toLowerCase())?`${r}:${i}`:e)}o(pA,"transformShorthandNotation");function mA(n){let e=new Map(n);for(let t of hA)e.delete(t);return e}o(mA,"filterOntologyPrefixes");var x$=300,gA=3e4,A$="EXOCORTEX_SPARQL_TIMEOUT";function C$(){let n=process.env[A$];if(!n)return gA;try{let e=I$(n);if(e!==null&&e>0)return e}catch{}return gA}o(C$,"getDefaultTimeout");function I$(n){let e=n.trim().toLowerCase();if(!e)return null;if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);return isNaN(r)||r<=0?null:r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);return isNaN(r)||r<=0?null:r*1e3}let t=parseInt(e,10);return isNaN(t)||t<=0?null:t*1e3}o(I$,"parseTimeoutSafe");function O$(n){if(!n)return x$;let e=parseInt(n.trim(),10);if(isNaN(e)||e<=0)throw new Be(`Invalid cache TTL: "${n}". Must be a positive number (seconds).`,'exocortex sparql query --cache-ttl 600 "SELECT * WHERE { ?s ?p ?o }"');return e}o(O$,"parseCacheTtl");function P$(n){let e=n.trim().toLowerCase();if(e.endsWith("ms")){let r=parseInt(e.slice(0,-2),10);if(isNaN(r)||r<=0)throw new Be(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r}if(e.endsWith("s")){let r=parseInt(e.slice(0,-1),10);if(isNaN(r)||r<=0)throw new Be(`Invalid timeout format: "${n}". Value must be a positive number.`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return r*1e3}let t=parseInt(e,10);if(isNaN(t)||t<=0)throw new Be(`Invalid timeout format: "${n}". Use formats like "30s", "5000ms", or just a number (seconds).`,'exocortex sparql query --timeout "30s" or --timeout "5000ms"');return t*1e3}o(P$,"parseTimeout");async function k2(n,e,t=Date.now()){let r=new Promise((i,s)=>{setTimeout(()=>{let a=Date.now()-t;s(new Cl(e,a))},e)});return Promise.race([n,r])}o(k2,"executeWithTimeout");function vA(){return new st("query").description("Execute SPARQL query against Obsidian vault").argument("[query]","SPARQL query string or path to .sparql file (optional if --template is used)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json|csv|ntriples","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--timeout <duration>","Query timeout (e.g., 30s, 5000ms)","30s").option("--dry-run","Validate query syntax without executing (no vault loading)").option("--explain","Show optimized query plan").option("--stats","Show execution statistics").option("--no-optimize","Disable query optimization").option("--use-cache","Use persistent triple cache (faster vault loading)").option("--cache-ttl <seconds>","Query result cache TTL in seconds (default: 300)").option("--no-cache","Bypass query result cache").option("--template <name>","Use a predefined query template").option("--param <params>","Template parameters (format: key=value,key2=value2)").action(async(n,e)=>{let t=e.output||"text";W.setFormat(t);let r="";try{let i=Date.now(),s=e.timeout?P$(e.timeout):C$(),a=O$(e.cacheTtl),c=e.cache!==!1;if(e.template){let H=new sc,ee=e.param?H.parseParamString(e.param):{};if(r=H.applyTemplate(e.template,ee),t==="text"){let Se=H.getTemplate(e.template);console.log(`\u{1F4CB} Using template: ${e.template}`),Object.keys(ee).length>0&&console.log(` Parameters: ${Object.entries(ee).map(([L,Y])=>`${L}=${Y}`).join(", ")}`),console.log()}}else if(n)r=R$(n);else throw new Be("Either a query argument or --template flag is required.",'exocortex sparql query "SELECT * WHERE { ?s ?p ?o }" or exocortex sparql query --template tasks-by-date --param date=2024-01-15');if(e.dryRun){await F$(r,e,t);return}let l=(0,M2.resolve)(e.vault);if(c){let ee=await new tc().get(r,a);if(ee!==null){let Se=Date.now()-i;if(t==="json"){let L=_e.success(ee,{durationMs:Se,itemCount:ee.count||0,queryResultCacheHit:!0});console.log(JSON.stringify(L,null,2))}else{console.log(`\u{1F4E6} (cached) Query result loaded from cache in ${Se}ms
|
|
530
|
+
`);let L=ee;L.type==="select"&&L.bindings?(console.log(`\u2705 Found ${L.bindings.length} result(s)
|
|
531
|
+
`),L$(L.bindings,e.format)):L.type==="construct"&&L.triples&&(console.log(`\u2705 Generated ${L.triples.length} triple(s)
|
|
532
|
+
`),k$(L.triples,e.format))}return}}if(!(0,Ml.existsSync)(l))throw new yt(l);t==="text"&&console.log(`\u{1F4E6} Loading vault: ${l}...`);let u=Date.now(),f,h=!1;if(e.useCache){let ee=await new Fi(l).loadOrBuild();f=ee.triples,h=ee.cacheHit,t==="text"&&h&&console.log("\u{1F680} Cache hit! Loading from persistent cache...")}else{let H=new an(l);f=await new Ct.NoteToRDFConverter(H).convertVault()}let d=new Ct.InMemoryTripleStore;await d.addAll(f);let p=Date.now()-u;if(t==="text"){let H=h?" (from cache)":"";console.log(`\u2705 Loaded ${f.length} triples in ${p}ms${H}
|
|
533
|
+
`),console.log("\u{1F50D} Parsing SPARQL query...")}let _=new Ct.SPARQLParser;r=pA(r),r=dA(r);let b=mA(uA(l));b.size>0&&_.setVaultPrefixes(b);let E=_.parse(r);if(E.type==="update"){t==="text"&&console.log("\u{1F504} Executing SPARQL UPDATE...");let H=Date.now(),ee=new Ct.UpdateExecutor(d),Se=await k2(ee.execute(E),s,H),L=Date.now()-H,Y=Date.now()-i;if(t==="json"){let ge=_e.success({query:r,type:"update",results:Se},{durationMs:Y,itemCount:Se.length,loadDurationMs:p,execDurationMs:L,triplesScanned:f.length,cacheHit:h});console.log(JSON.stringify(ge,null,2))}else j$(Se,e.format),console.log(),console.log("\u26A0\uFE0F Changes applied to in-memory store only (not persisted to vault files)"),e.stats&&(console.log(`
|
|
534
|
+
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${p}ms${h?" (from cache)":""}`),console.log(` Query execution: ${L}ms`),console.log(` Total time: ${Y}ms`),console.log(` Triples scanned: ${f.length}`));return}t==="text"&&console.log("\u{1F504} Translating to algebra...");let C=new Ct.AlgebraTranslator().translate(E);if(!e.noOptimize&&C.type!=="construct")C=new Ct.AlgebraOptimizer().optimize(C);else if(!e.noOptimize&&C.type==="construct"){let H=new Ct.AlgebraOptimizer,ee=C;C={...ee,where:H.optimize(ee.where)}}if(e.explain&&t==="text"){console.log("\u{1F4CA} Query Plan:");let H=new Ct.AlgebraSerializer;if(C.type==="construct"){let ee=C;console.log("CONSTRUCT Template:"),console.log(" (template patterns)"),console.log("WHERE:"),console.log(H.toString(ee.where))}else console.log(H.toString(C));console.log()}let j=Date.now(),G=new Ct.QueryExecutor(d);typeof G.setTimeout=="function"&&G.setTimeout(s);let Q=t==="text"?new Id("Executing query",{delayMs:2e3}):null;if(G.isConstructQuery(C)){Q?.start();let H=await k2(G.executeConstruct(C),s,j),ee=Date.now()-j;Q?.stop();let Se=Date.now()-i;if(c){let L=new ec,Y={type:"construct",count:H.length,triples:JSON.parse(L.formatJson(H))};await new tc().set(r,Y,a)}if(t==="json"){let L=new ec,Y={query:r,count:H.length,triples:JSON.parse(L.formatJson(H))},ge=_e.success(Y,{durationMs:Se,itemCount:H.length,loadDurationMs:p,execDurationMs:ee,triplesScanned:f.length,cacheHit:h,queryResultCacheHit:!1});console.log(JSON.stringify(ge,null,2))}else console.log(`\u2705 Generated ${H.length} triple(s) in ${ee}ms
|
|
535
535
|
`),H.length>0?N$(H,e.format):console.log("No triples generated."),e.stats&&(console.log(`
|
|
536
|
-
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${p}ms${h?" (from cache)":""}`),console.log(` Query execution: ${ee}ms`),console.log(` Total time: ${Se}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Triples generated: ${H.length}`),e.useCache&&console.log(` Triple cache: ${h?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}else{Q?.start();let H=await k2(G.executeAll(C),s,
|
|
536
|
+
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${p}ms${h?" (from cache)":""}`),console.log(` Query execution: ${ee}ms`),console.log(` Total time: ${Se}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Triples generated: ${H.length}`),e.useCache&&console.log(` Triple cache: ${h?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}else{Q?.start();let H=await k2(G.executeAll(C),s,j),ee=Date.now()-j;Q?.stop();let Se=Date.now()-i,L=H.map(Y=>Y.toJSON());if(c){let Y={type:"select",count:H.length,bindings:L};await new tc().set(r,Y,a)}if(t==="json"){let Y={query:r,count:H.length,bindings:L},ge=_e.success(Y,{durationMs:Se,itemCount:H.length,loadDurationMs:p,execDurationMs:ee,triplesScanned:f.length,cacheHit:h,queryResultCacheHit:!1});console.log(JSON.stringify(ge,null,2))}else console.log(`\u2705 Found ${H.length} result(s) in ${ee}ms
|
|
537
537
|
`),H.length>0?D$(H,e.format):console.log("No results found."),e.stats&&(console.log(`
|
|
538
538
|
\u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${p}ms${h?" (from cache)":""}`),console.log(` Query execution: ${ee}ms`),console.log(` Total time: ${Se}ms`),console.log(` Triples scanned: ${f.length}`),console.log(` Results returned: ${H.length}`),e.useCache&&console.log(` Triple cache: ${h?"HIT":"MISS (rebuilt)"}`),c&&console.log(" Query result cache: MISS (cached for next run)"))}}catch(i){_A(i,r,t)}})}o(vA,"sparqlQueryCommand");function _A(n,e,t){let r=new Rd;if(r.classifyError(n)!=="unknown"){let s=r.enhanceError(n,e);if(t==="json"){let a=_e.error("VALIDATION_INVALID_FORMAT",s.message,2,{context:{errorType:s.type,suggestions:s.suggestions,line:s.line,column:s.column,queryContext:s.context?{startLine:s.context.startLine,endLine:s.context.endLine,errorLine:s.context.errorLine}:void 0},recovery:{message:s.suggestions?.[0]||"Check query syntax"}});console.log(JSON.stringify(a,null,2)),process.exit(2)}else console.error(r.formatForText(s)),process.exit(2)}W.handle(n)}o(_A,"handleSparqlError");function R$(n){if(n.includes("SELECT")||n.includes("CONSTRUCT")||n.includes("INSERT")||n.includes("DELETE"))return n;let e=(0,M2.resolve)(n);return(0,Ml.existsSync)(e)?(0,Ml.readFileSync)(e,"utf-8"):n}o(R$,"loadQuery");async function F$(n,e,t){if(e.explain){let i=new Od,s=await i.analyze(n,{includeAlgebraPlan:!0,optimize:!e.noOptimize});if(t==="json"){let a=_e.success(s);console.log(JSON.stringify(a,null,2))}else s.valid?(console.log(`\u2705 Query syntax is valid
|
|
539
539
|
`),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new Ct.SPARQLParser;try{let i=r.parse(n);if(i.type!=="update"){let a=new Ct.AlgebraTranslator().translate(i);if(!e.noOptimize&&a.type!=="construct")a=new Ct.AlgebraOptimizer().optimize(a);else if(!e.noOptimize&&a.type==="construct"){let c=new Ct.AlgebraOptimizer,l=a;a={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=_e.success({valid:!0,queryType:yA(i),message:"Query syntax is valid"});console.log(JSON.stringify(s,null,2))}else console.log("\u2705 Query syntax is valid"),console.log(` Query type: ${yA(i)}`)}catch(i){_A(i,n,t)}}o(F$,"executeDryRun");function yA(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}o(yA,"getQueryType");function D$(n,e){switch(e){case"json":let t=new Zo;console.log(t.format(n));break;case"csv":let r=new _d;console.log(r.format(n));break;case"table":default:let i=new Jo;console.log(i.format(n));break}}o(D$,"formatSelectResults");function N$(n,e){let t=new ec;switch(e){case"json":console.log(t.formatJson(n));break;case"ntriples":console.log(t.formatNTriples(n));break;case"table":default:console.log(t.formatTable(n));break}}o(N$,"formatConstructResults");function L$(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"csv":if(n.length===0){console.log("");return}let t=Object.keys(n[0]);console.log(t.join(","));for(let i of n){let s=t.map(a=>{let c=i[a];return c==null?"":String(c).includes(",")?`"${c}"`:String(c)});console.log(s.join(","))}break;case"table":default:if(n.length===0){console.log("No results.");return}let r=Object.keys(n[0]);console.log(r.join(" ")),console.log(r.map(()=>"---").join(" "));for(let i of n){let s=r.map(a=>String(i[a]??""));console.log(s.join(" "))}break}}o(L$,"formatCachedSelectResults");function k$(n,e){switch(e){case"json":console.log(JSON.stringify(n,null,2));break;case"ntriples":for(let t of n)console.log(`<${t.subject}> <${t.predicate}> ${M$(t.object)} .`);break;case"table":default:console.log("Subject Predicate Object"),console.log("--- --- ---");for(let t of n)console.log(`${t.subject} ${t.predicate} ${t.object}`);break}}o(k$,"formatCachedConstructResults");function M$(n){return Fd.formatObject(n)}o(M$,"formatNTriplesObject");function j$(n,e){for(let t of n){let r=[`${t.type.toUpperCase()}`];switch(t.inserted!==void 0&&r.push(`inserted: ${t.inserted}`),t.deleted!==void 0&&r.push(`deleted: ${t.deleted}`),r.push(t.success?"OK":"FAILED"),e){case"json":console.log(JSON.stringify(t,null,2));break;case"csv":n.indexOf(t)===0&&console.log("type,inserted,deleted,success"),console.log(`${t.type},${t.inserted??""},${t.deleted??""},${t.success}`);break;case"table":default:console.log(`\u2705 ${r.join(" | ")}`);break}}}o(j$,"formatUpdateResults");var bA=require("fs"),SA=require("path"),Dd=X(ar());function wA(){return new st("index").description("Build or refresh the triple cache for faster SPARQL queries").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--output <type>","Response format: text|json (for MCP tools)","text").option("--stats","Show cache statistics after building").option("--force","Force rebuild even if cache is valid").option("--strict","Fail on first invalid IRI instead of skipping").option("--no-inference","Disable RDFS subClassOf inference materialization").action(async n=>{let e=n.output||"text";W.setFormat(e);try{let t=(0,SA.resolve)(n.vault);if(!(0,bA.existsSync)(t))throw new yt(t);let r=new Fi(t),i=r.getCachePath();n.force&&(e==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing cache..."),await r.invalidate()),e==="text"&&console.log(`\u{1F4E6} Building triple cache for: ${t}...`);let s=Date.now(),a=await r.buildCacheWithValidation({strict:n.strict??!1}),c=0;if(n.inference!==!1){let{triples:u}=await r.loadOrBuild(),f=new Dd.InMemoryTripleStore;if(await f.addAll(u),c=await new Dd.RDFSInferenceEngine().materialize(f),c>0){let d=await f.match();await r.saveTriples(d),a.tripleCount+=c}e==="text"&&c>0&&console.log(`\u{1F9E0} Materialized ${c} inferred Instance_class triples`)}let l=Date.now()-s;if(e==="json"){let u={action:"build",cachePath:i,tripleCount:a.tripleCount,durationMs:a.durationMs},f={summary:a.summary,skippedFiles:a.skippedFiles};if(n.stats){let h=await r.getCacheStats();if(h){let d={tripleCount:h.tripleCount,createdAt:h.createdAt.toISOString(),isValid:h.isValid,sizeBytes:h.sizeBytes,cachePath:i},p=_e.success({cache:u,stats:d,validation:f},{durationMs:l});console.log(JSON.stringify(p,null,2))}}else{let h=_e.success({cache:u,validation:f},{durationMs:l});console.log(JSON.stringify(h,null,2))}}else{if(a.skippedFiles.length>0){console.log(`
|
|
540
540
|
\u26A0\uFE0F Files skipped due to IRI issues:`);for(let u of a.skippedFiles)console.log(` - ${u.path}`),console.log(` ${u.reason}`);console.log("")}if(console.log(`\u2705 Indexed ${a.summary.indexed} files, skipped ${a.summary.skipped} (total: ${a.summary.total})`),console.log(`\u{1F4CA} Created cache with ${a.tripleCount.toLocaleString()} triples at ${i}`),console.log(`\u23F1\uFE0F Build time: ${a.durationMs}ms`),n.stats){let u=await r.getCacheStats();u&&(console.log(`
|
|
541
|
-
\u{1F4CA} Cache Statistics:`),console.log(` Triples: ${u.tripleCount.toLocaleString()}`),console.log(` Created: ${u.createdAt.toISOString()}`),console.log(` Valid: ${u.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${$$(u.sizeBytes)}`))}}}catch(t){W.handle(t)}})}o(wA,"sparqlIndexCommand");function $$(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o($$,"formatBytes");function EA(){return new st("templates").description("List available SPARQL query templates").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";W.setFormat(e);try{let t=new sc,r=t.listTemplates();if(e==="json"){let i=_e.success({templates:r,count:r.length});console.log(JSON.stringify(i,null,2))}else console.log(t.formatList("text"))}catch(t){W.handle(t)}})}o(EA,"sparqlTemplatesCommand");var PC=require("path");var Ut=X(Os()),ks=X(require("path"));var WA=X(kA(),1);var $l=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var z$={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Vl=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Q$=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),MA=o(n=>n.join(""),"rangesToString"),jA=o((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,a=!1,c=!1,l=!1,u=!1,f=t,h="";e:for(;s<n.length;){let b=n.charAt(s);if((b==="!"||b==="^")&&s===t+1){u=!0,s++;continue}if(b==="]"&&a&&!l){f=s+1;break}if(a=!0,b==="\\"&&!l){l=!0,s++;continue}if(b==="["&&!l){for(let[E,[A,C,M]]of Object.entries(z$))if(n.startsWith(E,s)){if(h)return["$.",!1,n.length-t,!0];s+=E.length,M?i.push(A):r.push(A),c=c||C;continue e}}if(l=!1,h){b>h?r.push(Vl(h)+"-"+Vl(b)):b===h&&r.push(Vl(b)),h="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Vl(b+"-")),s+=2;continue}if(n.startsWith("-",s+1)){h=b,s+=2;continue}r.push(Vl(b)),s++}if(f<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let b=r[0].length===2?r[0].slice(-1):r[0];return[Q$(b),!1,f-t,!1]}let d="["+(u?"^":"")+MA(r)+"]",p="["+(u?"":"^")+MA(i)+"]";return[r.length&&i.length?"("+d+"|"+p+")":r.length?d:p,c,f-t,!0]},"parseClass");var ai=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Kr,Y$=new Set(["!","?","+","*","@"]),V2=o(n=>Y$.has(n),"isExtglobType"),$A=o(n=>V2(n.type),"isExtglobAST"),K$=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),X$=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),J$=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),VA=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Z$="(?!(?:^|/)\\.\\.?(?:$|/))",Nd="(?!\\.)",eV=new Set(["[","."]),tV=new Set(["..","."]),rV=new Set("().*{}+?[]^$\\!"),nV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),U2="[^/]",UA=U2+"*?",BA=U2+"+?",Ra=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#v;#i;#u=!1;#s;#l;#a=!1;constructor(e,t,r={}){this.type=e,e&&(this.#n=!0),this.#c=t,this.#e=this.#c?this.#c.#e:this,this.#s=this.#e===this?r:this.#e.#s,this.#i=this.#e===this?[]:this.#e.#i,e==="!"&&!this.#e.#u&&this.#i.push(this),this.#v=this.#c?this.#c.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#l=this.#t.map(e=>String(e)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#i.pop();){if(e.type!=="!")continue;let t=e,r=t.#c;for(;r;){for(let i=t.#v+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}t=r,r=t.#c}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Kr&&t.#c===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#c?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#c?.isStart())return!1;if(this.#v===0)return!0;let e=this.#c;for(let t=0;t<this.#v;t++){let r=e.#t[t];if(!(r instanceof Kr&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#c?.type==="!")return!0;if(!this.#c?.isEnd())return!1;if(!this.type)return this.#c?.isEnd();let e=this.#c?this.#c.#t.length:0;return this.#v===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Kr(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let a=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let b=r,E="";for(;b<e.length;){let A=e.charAt(b++);if(c||A==="\\"){c=!c,E+=A;continue}if(l){b===u+1?(A==="^"||A==="!")&&(f=!0):A==="]"&&!(b===u+2&&f)&&(l=!1),E+=A;continue}else if(A==="["){l=!0,u=b,f=!1,E+=A;continue}if(!i.noext&&V2(A)&&e.charAt(b)==="("&&s<=a){t.push(E),E="";let M=new Kr(A,t);b=Kr.#g(e,M,b,i,s+1),t.push(M);continue}E+=A}return t.push(E),b}let h=r+1,d=new Kr(null,t),p=[],_="";for(;h<e.length;){let b=e.charAt(h++);if(c||b==="\\"){c=!c,_+=b;continue}if(l){h===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(h===u+2&&f)&&(l=!1),_+=b;continue}else if(b==="["){l=!0,u=h,f=!1,_+=b;continue}if(V2(b)&&e.charAt(h)==="("&&(s<=a||t&&t.#y(b))){let A=t&&t.#y(b)?0:1;d.push(_),_="";let C=new Kr(b,d);d.push(C),h=Kr.#g(e,C,h,i,s+A);continue}if(b==="|"){d.push(_),_="",p.push(d),d=new Kr(null,t);continue}if(b===")")return _===""&&t.#t.length===0&&(t.#a=!0),d.push(_),_="",t.push(...p,d),h;_+=b}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],h}#h(e){return this.#m(e,X$)}#m(e,t=K$){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,t)}#y(e,t=J$){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Kr(null,r,this.options);i.#t.push(""),r.push(i),this.#E(e,t)}#E(e,t){let r=e.#t[0];this.#t.splice(t,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#c=this);this.#l=void 0}#T(e){return!!VA.get(this.type)?.has(e)}#_(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#T(t.type)}#w(e){let t=VA.get(this.type),r=e.#t[0],i=t?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#c=this);this.type=i,this.#l=void 0,this.#a=!1}#b(){if($A(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#b(),this.#m(i)?(t=!1,this.#E(i,r)):this.#h(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#w(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#b();this.#l=void 0}static fromGlob(e,t={}){let r=new Kr(null,void 0,t);return Kr.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#b(),this.#p()),!$A(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[_,b,E,A]=typeof p=="string"?Kr.#A(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||E,this.#r=this.#r||A,_}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&tV.has(this.#t[0]))){let _=eV,b=t&&_.has(u.charAt(0))||u.startsWith("\\.")&&_.has(u.charAt(2))||u.startsWith("\\.\\.")&&_.has(u.charAt(4)),E=!t&&!e&&_.has(u.charAt(0));f=b?Z$:E?Nd:""}let h="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(h="(?:$|\\/)"),[f+u+h,ai(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#S(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,ai(this.toString()),!1,!1]}let a=!r||e||t||!Nd?"":this.#S(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Nd:"")+BA;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Nd:"")+UA+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,ai(s),this.#n=!!this.#n,this.#r]}#S(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,a]=t.toRegExpSource(e);return this.#r=this.#r||a,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#A(e,t,r=!1){let i=!1,s="",a=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(rV.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,h,d,p]=jA(e,l);if(d){s+=f,a=a||h,l+=d-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?BA:UA,t=!0;continue}else c=!1;if(u==="?"){s+=U2,t=!0;continue}s+=nV(u)}return[s,ai(e),!!t,a]}};Kr=Ra;var ac=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var ur=o((n,e,t={})=>($l(e),!t.nocomment&&e.charAt(0)==="#"?!1:new cn(e,t).match(n)),"minimatch"),iV=/^\*+([^+@!?\*\[\(]*)$/,sV=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),aV=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),oV=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),cV=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),lV=/^\*+\.\*+$/,uV=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),fV=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),hV=/^\.\*+$/,dV=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),pV=/^\*+$/,mV=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),gV=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),yV=/^\?+([^+@!?\*\[\(]*)?$/,vV=o(([n,e=""])=>{let t=HA([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),_V=o(([n,e=""])=>{let t=zA([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),bV=o(([n,e=""])=>{let t=zA([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),SV=o(([n,e=""])=>{let t=HA([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),HA=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),zA=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),QA=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",qA={win32:{sep:"\\"},posix:{sep:"/"}},wV=QA==="win32"?qA.win32.sep:qA.posix.sep;ur.sep=wV;var It=Symbol("globstar **");ur.GLOBSTAR=It;var EV="[^/]",TV=EV+"*?",xV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",AV="(?:(?!(?:\\/|^)\\.).)*?",CV=o((n,e={})=>t=>ur(t,n,e),"filter");ur.filter=CV;var In=o((n,e={})=>Object.assign({},n,e),"ext"),IV=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return ur;let e=ur;return Object.assign(o((r,i,s={})=>e(r,i,In(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,In(n,s))}static defaults(i){return e.defaults(In(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,In(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,In(n,s))}},unescape:o((r,i={})=>e.unescape(r,In(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,In(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,In(n,i)),"filter"),defaults:o(r=>e.defaults(In(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,In(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,In(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,In(n,s)),"match"),sep:e.sep,GLOBSTAR:It})},"defaults");ur.defaults=IV;var YA=o((n,e={})=>($l(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,WA.default)(n)),"braceExpand");ur.braceExpand=YA;var OV=o((n,e={})=>new cn(n,e).makeRe(),"makeRe");ur.makeRe=OV;var PV=o((n,e,t={})=>{let r=new cn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");ur.match=PV;var GA=/[?*]|[+@!]\(.*?\)|\[|\]/,RV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),cn=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){$l(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||QA,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,a,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!GA.test(s[2]))&&!GA.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",a.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),h=l?3:c?0:void 0,d=f?3:u?0:void 0;if(typeof h=="number"&&typeof d=="number"){let[p,_]=[e[h],t[d]];p.toLowerCase()===_.toLowerCase()&&(t[d]=p,s=d,i=h)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(It)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(It,s),c=t.lastIndexOf(It),[l,u,f]=r?[t.slice(s,a),t.slice(a+1),[]]:[t.slice(s,a),t.slice(a+1,c),t.slice(c+1)];if(l.length){let C=e.slice(i,i+l.length);if(!this.#r(C,l,r,0,0))return!1;i+=l.length}let h=0;if(f.length){if(f.length+i>e.length)return!1;let C=e.length-f.length;if(this.#r(e,f,r,C,0))h=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(C--,!this.#r(e,f,r,C,0)))return!1;h=f.length+1}}if(!u.length){let C=!!h;for(let M=i;M<e.length-h;M++){let G=String(e[M]);if(C=!0,G==="."||G===".."||!this.options.dot&&G.startsWith("."))return!1}return r||C}let d=[[[],0]],p=d[0],_=0,b=[0];for(let C of u)C===It?(b.push(_),p=[[],0],d.push(p)):(p[0].push(C),_++);let E=d.length-1,A=e.length-h;for(let C of d)C[1]=A-(b[E--]+C[0].length);return!!this.#n(e,d,i,0,r,0,!!h)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let h=r;h<e.length;h++){c=!0;let d=e[h];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&a<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,a+1,c);if(p!==!1)return p}let d=e[r];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let a,c,l,u;for(a=i,c=s,u=e.length,l=t.length;a<u&&c<l;a++,c++){this.debug("matchOne loop");let f=t[c],h=e[a];if(this.debug(t,f,h),f===!1||f===It)return!1;let d;if(typeof f=="string"?(d=h===f,this.debug("string match",f,h,d)):(d=f.test(h),this.debug("pattern match",f,h,d)),!d)return!1}if(a===u&&c===l)return!0;if(a===u)return r;if(c===l)return a===u-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return YA(this.pattern,this.options)}parse(e){$l(e);let t=this.options;if(e==="**")return It;if(e==="")return"";let r,i=null;(r=e.match(pV))?i=t.dot?gV:mV:(r=e.match(iV))?i=(t.nocase?t.dot?cV:oV:t.dot?aV:sV)(r[1]):(r=e.match(yV))?i=(t.nocase?t.dot?_V:vV:t.dot?bV:SV)(r):(r=e.match(lV))?i=t.dot?fV:uV:(r=e.match(hV))&&(i=dV);let s=Ra.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,r=t.noglobstar?TV:t.dot?xV:AV,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))i.add(h);return typeof f=="string"?RV(f):f===It?It:f._src});return u.forEach((f,h)=>{let d=u[h+1],p=u[h-1];f!==It||p===It||(p===void 0?d!==void 0&&d!==It?u[h+1]="(?:\\/|"+r+"\\/)?"+d:u[h]=r:d===void 0?u[h-1]=p+"(?:\\/|"+r+")?":d!==It&&(u[h-1]=p+"(?:\\/|\\/"+r+"\\/)"+d,u[h+1]=It))}),u.filter(f=>f!==It).join("/")}).join("|"),[a,c]=e.length>1?["(?:",")"]:["",""];s="^"+a+s+c+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let a=i[i.length-1];if(!a)for(let c=i.length-2;!a&&c>=0;c--)a=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return ur.defaults(e).Minimatch}};ur.AST=Ra;ur.Minimatch=cn;ur.escape=ac;ur.unescape=ai;var _C=require("node:url");var oc=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,XA=new Set,B2=typeof process=="object"&&process?process:{},JA=o((n,e,t,r)=>{typeof B2.emitWarning=="function"?B2.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Ld=globalThis.AbortController,KA=globalThis.AbortSignal;if(typeof Ld>"u"){KA=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Ld=class{static{o(this,"AbortController")}constructor(){e()}signal=new KA;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=B2.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,JA("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))},"warnACPolyfill")}var FV=o(n=>!XA.has(n),"shouldWarn");var Fs=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),ZA=o(n=>Fs(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?cc:null:null,"getUintArray"),cc=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},q2=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=ZA(e);if(!t)return[];n.#e=!0;let r=new n(e,t);return n.#e=!1,r}constructor(e,t){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Ul=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#v;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#h;#m;#y;#f;#E;#T;#_;#w;#b;#S;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#h},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#d(t),"isBackgroundFetch"),backgroundFetch:o((t,r,i,s)=>e.#j(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#V(t),"moveToTail"),indexes:o(t=>e.#I(t),"indexes"),rindexes:o(t=>e.#O(t),"rindexes"),isStale:o(t=>e.#x(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#v}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:h,noUpdateTTL:d,maxSize:p=0,maxEntrySize:_=0,sizeCalculation:b,fetchMethod:E,memoMethod:A,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:M,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:Q,ignoreFetchAbort:H}=e;if(t!==0&&!Fs(t))throw new TypeError("max option must be a nonnegative integer");let ee=t?ZA(t):Array;if(!ee)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=_||this.#n,this.sizeCalculation=b,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(A!==void 0&&typeof A!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#v=A,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=E,this.#b=!!E,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new ee(t),this.#g=new ee(t),this.#h=0,this.#m=0,this.#y=q2.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#w=!!this.#r,this.#S=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!G,this.allowStaleOnFetchAbort=!!Q,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(this.#n!==0&&!Fs(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Fs(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!M,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Fs(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Fs(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#A()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let Se="LRU_CACHE_UNBOUNDED";FV(Se)&&(XA.add(Se),JA("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Se,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#A(){let e=new cc(this.#e),t=new cc(this.#e);this.#_=e,this.#T=t,this.#F=(s,a,c=oc.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#x(s)&&this.#R(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#C=s=>{t[s]=e[s]!==0?oc.now():0},this.#o=(s,a)=>{if(e[a]){let c=e[a],l=t[a];if(!c||!l)return;s.ttl=c,s.start=l,s.now=r||i();let u=s.now-l;s.remainingTTL=c-u}};let r=0,i=o(()=>{let s=oc.now();if(this.ttlResolution>0){r=s;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return s},"getNow");this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],l=t[a];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#x=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#C=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#x=o(()=>!1,"#isStale");#P(){let e=new cc(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#L=(t,r,i,s)=>{if(this.#d(r))return 0;if(!Fs(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Fs(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#N=(t,r,i)=>{if(e[t]=r,this.#n){let s=this.#n-e[t];for(;this.#u>s;)this.#M(!0)}this.#u+=e[t],i&&(i.entrySize=r,i.totalCalculatedSize=this.#u)}}#D=o(e=>{},"#removeItemSize");#N=o((e,t,r)=>{},"#addItemSize");#L=o((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#I({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#x(t))&&(yield t),t===this.#h));)t=this.#g[t]}*#O({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#h;!(!this.#k(t)||((e||!this.#x(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#I())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#O())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*keys(){for(let e of this.#I()){let t=this.#l[e];t!==void 0&&!this.#d(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#O()){let t=this.#l[e];t!==void 0&&!this.#d(this.#a[e])&&(yield t)}}*values(){for(let e of this.#I())this.#a[e]!==void 0&&!this.#d(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#O())this.#a[e]!==void 0&&!this.#d(this.#a[e])&&(yield this.#a[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#I()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#I()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#O()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#O({allowStale:!0}))this.#x(t)&&(this.#R(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#d(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let a=this.#_[t],c=this.#T[t];if(a&&c){let l=a-(oc.now()-c);s.ttl=l,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let r=this.#l[t],i=this.#a[t],s=this.#d(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#_&&this.#T){a.ttl=this.#_[t];let c=oc.now()-this.#T[t];a.start=Math.floor(Date.now()-c)}this.#E&&(a.size=this.#E[t]),e.unshift([r,a])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=oc.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#L(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#R(e,"set"),this;let h=this.#i===0?void 0:this.#s.get(e);if(h===void 0)h=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[h]=e,this.#a[h]=t,this.#s.set(e,h),this.#p[this.#m]=h,this.#g[h]=this.#m,this.#m=h,this.#i++,this.#N(h,f,l),l&&(l.set="add"),u=!1;else{this.#V(h);let d=this.#a[h];if(t!==d){if(this.#b&&this.#d(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=d;p!==void 0&&!a&&(this.#w&&this.#r?.(p,e,"set"),this.#S&&this.#f?.push([p,e,"set"]))}else a||(this.#w&&this.#r?.(d,e,"set"),this.#S&&this.#f?.push([d,e,"set"]));if(this.#D(h),this.#N(h,f,l),this.#a[h]=t,l){l.set="replace";let p=d&&this.#d(d)?d.__staleWhileFetching:d;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#A(),this.#_&&(u||this.#F(h,i,s),l&&this.#o(l,h)),!a&&this.#S&&this.#f){let d=this.#f,p;for(;p=d?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#h];if(this.#M(!0),this.#d(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#S&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#h,r=this.#l[t],i=this.#a[t];return this.#b&&this.#d(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#S)&&(this.#w&&this.#r?.(i,r,"evict"),this.#S&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#a[t]=void 0,this.#y.push(t)),this.#i===1?(this.#h=this.#m=0,this.#y.length=0):this.#h=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let a=this.#a[s];if(this.#d(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#x(s))i&&(i.has="stale",this.#o(i,s));else return r&&this.#C(s),i&&(i.has="hit",this.#o(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#x(i))return;let s=this.#a[i];return this.#d(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#d(s))return s;let a=new Ld,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((b,E=!1)=>{let{aborted:A}=a.signal,C=r.ignoreFetchAbort&&b!==void 0;if(r.status&&(A&&!E?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,C&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),A&&!C&&!E)return h(a.signal.reason);let M=p;return this.#a[t]===p&&(b===void 0?M.__staleWhileFetching?this.#a[t]=M.__staleWhileFetching:this.#R(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,b,l.options))),b},"cb"),f=o(b=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=b),h(b)),"eb"),h=o(b=>{let{aborted:E}=a.signal,A=E&&r.allowStaleOnFetchAbort,C=A||r.allowStaleOnFetchRejection,M=C||r.noDeleteOnFetchRejection,G=p;if(this.#a[t]===p&&(!M||G.__staleWhileFetching===void 0?this.#R(e,"fetch"):A||(this.#a[t]=G.__staleWhileFetching)),C)return r.status&&G.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),G.__staleWhileFetching;if(G.__returned===G)throw b},"fetchFail"),d=o((b,E)=>{let A=this.#c?.(e,s,l);A&&A instanceof Promise&&A.then(C=>b(C===void 0?void 0:C),E),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=o(C=>u(C,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(d).then(u,f),_=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,_,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=_,_}#d(e){if(!this.#b)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ld}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:b,forceRefresh:E=!1,status:A,signal:C}=t;if(!this.#b)return A&&(A.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:A});let M={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:_,ignoreFetchAbort:p,status:A,signal:C},G=this.#s.get(e);if(G===void 0){A&&(A.fetch="miss");let Q=this.#j(e,G,M,b);return Q.__returned=Q}else{let Q=this.#a[G];if(this.#d(Q)){let Y=r&&Q.__staleWhileFetching!==void 0;return A&&(A.fetch="inflight",Y&&(A.returnedStale=!0)),Y?Q.__staleWhileFetching:Q.__returned=Q}let H=this.#x(G);if(!E&&!H)return A&&(A.fetch="hit"),this.#V(G),i&&this.#C(G),A&&this.#o(A,G),Q;let ee=this.#j(e,G,M,b),N=ee.__staleWhileFetching!==void 0&&r;return A&&(A.fetch=H?"stale":"refresh",N&&H&&(A.returnedStale=!0)),N?ee.__staleWhileFetching:ee.__returned=ee}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#v;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,c=this.get(e,a);if(!s&&c!==void 0)return c;let l=r(e,c,{options:a,context:i});return this.set(e,l,a),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#a[c],u=this.#d(l);return a&&this.#o(a,c),this.#x(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#R(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#C(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#h?this.#h=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#R(e,"delete")}#R(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#U(t);else{this.#D(i);let s=this.#a[i];if(this.#d(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#S)&&(this.#w&&this.#r?.(s,e,t),this.#S&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#a[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#h)this.#h=this.#p[i];else{let a=this.#g[i];this.#p[a]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#S&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#U("delete")}#U(e){for(let t of this.#O({allowStale:!0})){let r=this.#a[t];if(this.#d(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#w&&this.#r?.(r,i,e),this.#S&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#_&&this.#T&&(this.#_.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#h=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#S&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var fc=require("node:path"),lC=require("node:url"),ki=require("fs"),BV=X(require("node:fs"),1),Ls=require("node:fs/promises");var Bd=require("node:events"),K2=X(require("node:stream"),1),iC=require("node:string_decoder");var eC=typeof process=="object"&&process?process:{stdout:null,stderr:null},DV=o(n=>!!n&&typeof n=="object"&&(n instanceof Ns||n instanceof K2.default||NV(n)||LV(n)),"isStream"),NV=o(n=>!!n&&typeof n=="object"&&n instanceof Bd.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==K2.default.Writable.prototype.pipe,"isReadable"),LV=o(n=>!!n&&typeof n=="object"&&n instanceof Bd.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),ss=Symbol("EOF"),as=Symbol("maybeEmitEnd"),Ds=Symbol("emittedEnd"),kd=Symbol("emittingEnd"),Bl=Symbol("emittedError"),Md=Symbol("closed"),tC=Symbol("read"),jd=Symbol("flush"),rC=Symbol("flushChunk"),oi=Symbol("encoding"),lc=Symbol("decoder"),Qt=Symbol("flowing"),ql=Symbol("paused"),uc=Symbol("resume"),Yt=Symbol("buffer"),Ur=Symbol("pipes"),Kt=Symbol("bufferLength"),G2=Symbol("bufferPush"),$d=Symbol("bufferShift"),Er=Symbol("objectMode"),Ot=Symbol("destroyed"),W2=Symbol("error"),H2=Symbol("emitData"),nC=Symbol("emitEnd"),z2=Symbol("emitEnd2"),Ni=Symbol("async"),Q2=Symbol("abort"),Vd=Symbol("aborted"),Gl=Symbol("signal"),Fa=Symbol("dataListeners"),ln=Symbol("discarded"),Wl=o(n=>Promise.resolve().then(n),"defer"),kV=o(n=>n(),"nodefer"),MV=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),jV=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),$V=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Ud=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[uc](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Y2=class extends Ud{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},VV=o(n=>!!n.objectMode,"isObjectModeOptions"),UV=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Ns=class extends Bd.EventEmitter{static{o(this,"Minipass")}[Qt]=!1;[ql]=!1;[Ur]=[];[Yt]=[];[Er];[oi];[Ni];[lc];[ss]=!1;[Ds]=!1;[kd]=!1;[Md]=!1;[Bl]=null;[Kt]=0;[Ot]=!1;[Gl];[Vd]=!1;[Fa]=0;[ln]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");VV(t)?(this[Er]=!0,this[oi]=null):UV(t)?(this[oi]=t.encoding,this[Er]=!1):(this[Er]=!1,this[oi]=null),this[Ni]=!!t.async,this[lc]=this[oi]?new iC.StringDecoder(this[oi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Yt],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[Ur],"get")});let{signal:r}=t;r&&(this[Gl]=r,r.aborted?this[Q2]():r.addEventListener("abort",()=>this[Q2]()))}get bufferLength(){return this[Kt]}get encoding(){return this[oi]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Er]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ni]}set async(e){this[Ni]=this[Ni]||!!e}[Q2](){this[Vd]=!0,this.emit("abort",this[Gl]?.reason),this.destroy(this[Gl]?.reason)}get aborted(){return this[Vd]}set aborted(e){}write(e,t,r){if(this[Vd])return!1;if(this[ss])throw new Error("write after end");if(this[Ot])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let i=this[Ni]?Wl:kV;if(!this[Er]&&!Buffer.isBuffer(e)){if($V(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(jV(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Er]?(this[Qt]&&this[Kt]!==0&&this[jd](!0),this[Qt]?this.emit("data",e):this[G2](e),this[Kt]!==0&&this.emit("readable"),r&&i(r),this[Qt]):e.length?(typeof e=="string"&&!(t===this[oi]&&!this[lc]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[oi]&&(e=this[lc].write(e)),this[Qt]&&this[Kt]!==0&&this[jd](!0),this[Qt]?this.emit("data",e):this[G2](e),this[Kt]!==0&&this.emit("readable"),r&&i(r),this[Qt]):(this[Kt]!==0&&this.emit("readable"),r&&i(r),this[Qt])}read(e){if(this[Ot])return null;if(this[ln]=!1,this[Kt]===0||e===0||e&&e>this[Kt])return this[as](),null;this[Er]&&(e=null),this[Yt].length>1&&!this[Er]&&(this[Yt]=[this[oi]?this[Yt].join(""):Buffer.concat(this[Yt],this[Kt])]);let t=this[tC](e||null,this[Yt][0]);return this[as](),t}[tC](e,t){if(this[Er])this[$d]();else{let r=t;e===r.length||e===null?this[$d]():typeof r=="string"?(this[Yt][0]=r.slice(e),t=r.slice(0,e),this[Kt]-=e):(this[Yt][0]=r.subarray(e),t=r.subarray(0,e),this[Kt]-=e)}return this.emit("data",t),!this[Yt].length&&!this[ss]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[ss]=!0,this.writable=!1,(this[Qt]||!this[ql])&&this[as](),this}[uc](){this[Ot]||(!this[Fa]&&!this[Ur].length&&(this[ln]=!0),this[ql]=!1,this[Qt]=!0,this.emit("resume"),this[Yt].length?this[jd]():this[ss]?this[as]():this.emit("drain"))}resume(){return this[uc]()}pause(){this[Qt]=!1,this[ql]=!0,this[ln]=!1}get destroyed(){return this[Ot]}get flowing(){return this[Qt]}get paused(){return this[ql]}[G2](e){this[Er]?this[Kt]+=1:this[Kt]+=e.length,this[Yt].push(e)}[$d](){return this[Er]?this[Kt]-=1:this[Kt]-=this[Yt][0].length,this[Yt].shift()}[jd](e=!1){do;while(this[rC](this[$d]())&&this[Yt].length);!e&&!this[Yt].length&&!this[ss]&&this.emit("drain")}[rC](e){return this.emit("data",e),this[Qt]}pipe(e,t){if(this[Ot])return e;this[ln]=!1;let r=this[Ds];return t=t||{},e===eC.stdout||e===eC.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[Ur].push(t.proxyErrors?new Y2(this,e,t):new Ud(this,e,t)),this[Ni]?Wl(()=>this[uc]()):this[uc]()),e}unpipe(e){let t=this[Ur].find(r=>r.dest===e);t&&(this[Ur].length===1?(this[Qt]&&this[Fa]===0&&(this[Qt]=!1),this[Ur]=[]):this[Ur].splice(this[Ur].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[ln]=!1,this[Fa]++,!this[Ur].length&&!this[Qt]&&this[uc]();else if(e==="readable"&&this[Kt]!==0)super.emit("readable");else if(MV(e)&&this[Ds])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Bl]){let i=t;this[Ni]?Wl(()=>i.call(this,this[Bl])):i.call(this,this[Bl])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Fa]=this.listeners("data").length,this[Fa]===0&&!this[ln]&&!this[Ur].length&&(this[Qt]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Fa]=0,!this[ln]&&!this[Ur].length&&(this[Qt]=!1)),t}get emittedEnd(){return this[Ds]}[as](){!this[kd]&&!this[Ds]&&!this[Ot]&&this[Yt].length===0&&this[ss]&&(this[kd]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Md]&&this.emit("close"),this[kd]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Ot&&this[Ot])return!1;if(e==="data")return!this[Er]&&!r?!1:this[Ni]?(Wl(()=>this[H2](r)),!0):this[H2](r);if(e==="end")return this[nC]();if(e==="close"){if(this[Md]=!0,!this[Ds]&&!this[Ot])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Bl]=r,super.emit(W2,r);let s=!this[Gl]||this.listeners("error").length?super.emit("error",r):!1;return this[as](),s}else if(e==="resume"){let s=super.emit("resume");return this[as](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...t);return this[as](),i}[H2](e){for(let r of this[Ur])r.dest.write(e)===!1&&this.pause();let t=this[ln]?!1:super.emit("data",e);return this[as](),t}[nC](){return this[Ds]?!1:(this[Ds]=!0,this.readable=!1,this[Ni]?(Wl(()=>this[z2]()),!0):this[z2]())}[z2](){if(this[lc]){let t=this[lc].end();if(t){for(let r of this[Ur])r.dest.write(t);this[ln]||super.emit("data",t)}}for(let t of this[Ur])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Er]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Er]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Er])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[oi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Ot,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ln]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ss])return t();let s,a,c=o(h=>{this.off("data",l),this.off("end",u),this.off(Ot,f),t(),a(h)},"onerr"),l=o(h=>{this.off("error",c),this.off("end",u),this.off(Ot,f),this.pause(),s({value:h,done:!!this[ss]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Ot,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((h,d)=>{a=d,s=h,this.once(Ot,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ln]=!1;let e=!1,t=o(()=>(this.pause(),this.off(W2,t),this.off(Ot,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(W2,t),this.once(Ot,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Ot])return e?this.emit("error",e):this.emit(Ot),this;this[Ot]=!0,this[ln]=!0,this[Yt].length=0,this[Kt]=0;let t=this;return typeof t.close=="function"&&!this[Md]&&t.close(),e?this.emit("error",e):this.emit(Ot),this}static get isStream(){return DV}};var qV=ki.realpathSync.native,zl={lstatSync:ki.lstatSync,readdir:ki.readdir,readdirSync:ki.readdirSync,readlinkSync:ki.readlinkSync,realpathSync:qV,promises:{lstat:Ls.lstat,readdir:Ls.readdir,readlink:Ls.readlink,realpath:Ls.realpath}},uC=o(n=>!n||n===zl||n===BV?zl:{...zl,...n,promises:{...zl.promises,...n.promises||{}}},"fsFromOption"),fC=/^\\\\\?\\([a-z]:)\\?$/i,GV=o(n=>n.replace(/\//g,"\\").replace(fC,"$1\\"),"uncToDrive"),WV=/[\\\/]/,Pn=0,hC=1,dC=2,Li=4,pC=6,mC=8,Da=10,gC=12,On=15,Hl=~On,X2=16,sC=32,Ql=64,ci=128,qd=256,Wd=512,aC=Ql|ci|Wd,HV=1023,J2=o(n=>n.isFile()?mC:n.isDirectory()?Li:n.isSymbolicLink()?Da:n.isCharacterDevice()?dC:n.isBlockDevice()?pC:n.isSocket()?gC:n.isFIFO()?hC:Pn,"entToType"),oC=new Map,Yl=o(n=>{let e=oC.get(n);if(e)return e;let t=n.normalize("NFKD");return oC.set(n,t),t},"normalize"),cC=new Map,Gd=o(n=>{let e=cC.get(n);if(e)return e;let t=Yl(n.toLowerCase());return cC.set(n,t),t},"normalizeNocase"),Hd=class extends Ul{static{o(this,"ResolveCache")}constructor(){super({max:256})}},Z2=class extends Ul{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},yC=Symbol("PathScurry setAsCwd"),Tr=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#c;get uid(){return this.#c}#v;get gid(){return this.#v}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#a;get blocks(){return this.#a}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#h;get ctimeMs(){return this.#h}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#_;#w;#b;#S;#A;#C;#o;#F;#x;#P;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Pn,r,i,s,a,c){this.name=e,this.#_=s?Gd(e):Yl(e),this.#o=t&HV,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#b=c.fullpath,this.#A=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=uC(c.fs)}depth(){return this.#w!==void 0?this.#w:this.parent?this.#w=this.parent.depth()+1:this.#w=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#o&=~X2,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Gd(e):Yl(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",a=this.#b?this.#b+s+e:void 0,c=this.newChild(e,Pn,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=ci),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,t=this.parent;if(!t)return this.#A=this.name;let r=t.relative();return r+(!r||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#b!==void 0)return this.#b;let e=this.name,t=this.parent;if(!t)return this.#b=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#b=i}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#S=`//?/${i}`:this.#S=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#S=r}isUnknown(){return(this.#o&On)===Pn}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#o&On)===mC}isDirectory(){return(this.#o&On)===Li}isCharacterDevice(){return(this.#o&On)===dC}isBlockDevice(){return(this.#o&On)===pC}isFIFO(){return(this.#o&On)===hC}isSocket(){return(this.#o&On)===gC}isSymbolicLink(){return(this.#o&Da)===Da}lstatCached(){return this.#o&sC?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#P}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let e=this.#o&On;return!(e!==Pn&&e!==Da||this.#o&qd||this.#o&ci)}calledReaddir(){return!!(this.#o&X2)}isENOENT(){return!!(this.#o&ci)}isNamed(e){return this.nocase?this.#_===Gd(e):this.#_===Yl(e)}async readlink(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#x=r}catch(t){this.#d(t.code);return}}readlinkSync(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#x=r}catch(t){this.#d(t.code);return}}#N(e){this.#o|=X2;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&ci||(this.#o=(this.#o|ci)&Hl,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#O(){this.#o|=Wd,this.#k()}#k(){if(this.#o&Ql)return;let e=this.#o;(e&On)===Li&&(e&=Hl),this.#o=e|Ql,this.#I()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#d(e=""){let t=this.#o;t|=qd,e==="ENOENT"&&(t|=ci),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Hl),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#R(e,t)||this.#V(e,t)}#V(e,t){let r=J2(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&On;return s!==Li&&s!==Da&&s!==Pn&&(i.#o|=Ql),t.unshift(i),t.provisional++,i}#R(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Gd(e.name):Yl(e.name))===i.#_)return this.#U(e,i,r,t)}}#U(e,t,r,i){let s=t.name;return t.#o=t.#o&Hl|J2(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&ci)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&ci)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#j(e.code)}}#W(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:h,ino:d,mode:p,mtime:_,mtimeMs:b,nlink:E,rdev:A,size:C,uid:M}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#h=u,this.#n=f,this.#v=h,this.#s=d,this.#r=p,this.#f=_,this.#g=b,this.#t=E,this.#i=A,this.#l=C,this.#c=M;let G=J2(e);this.#o=this.#o&Hl|G|sC,G!==Pn&&G!==Li&&G!==Da&&(this.#o|=Ql)}#q=[];#G=!1;#H(e){this.#G=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(r=>r(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#G)return;this.#G=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,a)=>{if(s)this.#M(s.code),r.provisional=0;else{for(let c of a)this.#$(c,r);this.#N(r)}this.#H(r.slice(0,r.provisional))})}#B;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#B)await this.#B;else{let r=o(()=>{},"resolve");this.#B=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#N(e)}catch(i){this.#M(i.code),e.provisional=0}this.#B=void 0,r()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let r of this.#e.readdirSync(t,{withFileTypes:!0}))this.#$(r,e);this.#N(e)}catch(r){this.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&aC)return!1;let e=On&this.#o;return e===Pn||e===Li||e===Da}shouldWalk(e,t){return(this.#o&Li)===Li&&!(this.#o&aC)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#P)return this.#P;if(!((Wd|qd|ci)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#P=this.resolve(e)}catch{this.#O()}}realpathSync(){if(this.#P)return this.#P;if(!((Wd|qd|ci)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#P=this.resolve(e)}catch{this.#O()}}[yC](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),r=[],i=this;for(;i&&i.parent;)t.add(i),i.#A=r.join(this.sep),i.#C=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#A=void 0,i.#C=void 0,i=i.parent}},zd=class n extends Tr{static{o(this,"PathWin32")}sep="\\";splitSep=WV;constructor(e,t=Pn,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=Pn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return fc.win32.parse(e).root}getRoot(e){if(e=GV(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,r]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=r;return this.roots[e]=new hc(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(fC,"$1\\"),e===t}},Qd=class n extends Tr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=Pn,r,i,s,a,c){super(e,t,r,i,s,a,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=Pn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Yd=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:a=zl}={}){this.#t=uC(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,lC.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new Hd,this.#n=new Hd,this.#r=new Z2(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,h=t.sep,d=this.rootPath,p=!1;for(let _ of l){let b=f--;u=u.child(_,{relative:new Array(b).fill("..").join(h),relativePosix:new Array(b).fill("..").join("/"),fullpath:d+=(p?"":h)+_}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r}=t;if(e.canReaddir()){let i=await e.readdir();return r?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0}=t;return e.canReaddir()?r?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=await e.readlink();return t?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return t?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=await e.realpath();return t?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return t?r:r?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((h,d)=>{l.add(h),h.readdirCB((p,_)=>{if(p)return d(p);let b=_.length;if(!b)return d();let E=o(()=>{--b===0&&d()},"next");for(let A of _)(!s||s(A))&&c.push(r?A:A.fullpath()),i&&A.isSymbolicLink()?A.realpath().then(C=>C?.isUnknown()?C.lstat():C).then(C=>C?.shouldWalk(l,a)?u(C,E):E()):A.shouldWalk(l,a)?u(A,E):E()},!0)},"walk"),f=e;return new Promise((h,d)=>{u(f,p=>{if(p)return d(p);h(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let h of f){(!s||s(h))&&c.push(r?h:h.fullpath());let d=h;if(h.isSymbolicLink()){if(!(i&&(d=h.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(l,a)&&l.add(d)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t;(!s||s(e))&&(yield r?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield r?f:f.fullpath());let h=f;if(f.isSymbolicLink()){if(!(i&&(h=f.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(c,a)&&c.add(h)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ns({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let _=o((E,A,C=!1)=>{if(E)return c.emit("error",E);if(i&&!C){let M=[];for(let G of A)G.isSymbolicLink()&&M.push(G.realpath().then(Q=>Q?.isUnknown()?Q.lstat():Q));if(M.length){Promise.all(M).then(()=>_(null,A,!0));return}}for(let M of A)M&&(!s||s(M))&&(c.write(r?M:M.fullpath())||(d=!0));f--;for(let M of A){let G=M.realpathCached()||M;G.shouldWalk(l,a)&&u.push(G)}d&&!c.flowing?c.once("drain",h):b||h()},"onReaddir"),b=!0;p.readdirCB(_,!0),b=!1}},"process");return h(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ns({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let _=p.readdirSync();for(let b of _)(!s||s(b))&&(c.write(r?b:b.fullpath())||(d=!0));f--;for(let b of _){let E=b;if(b.isSymbolicLink()){if(!(i&&(E=b.realpathSync())))continue;E.isUnknown()&&E.lstatSync()}E.shouldWalk(l,a)&&u.push(E)}}d&&!c.flowing&&c.once("drain",h)},"process");return h(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[yC](t)}},hc=class extends Yd{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,fc.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return fc.win32.parse(e).root.toUpperCase()}newRoot(e){return new zd(this.rootPath,Li,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},dc=class extends Yd{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,fc.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new Qd(this.rootPath,Li,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Kl=class extends dc{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Vre=process.platform==="win32"?zd:Qd,vC=process.platform==="win32"?hc:process.platform==="darwin"?Kl:dc;var zV=o(n=>n.length>=1,"isPatternList"),QV=o(n=>n.length>=1,"isGlobList"),pc=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#v;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!zV(e))throw new TypeError("empty pattern list");if(!QV(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,h,d,p,..._]=this.#n;u[0]===""&&(u.shift(),_.shift());let b=[s,a,c,l,""].join("/"),E=[f,h,d,p,""].join("/");this.#e=[b,...u],this.#n=[E,..._],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===It}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#v=this.#v||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#c!==void 0?this.#c:this.hasMore()?(this.#c=new n(this.#e,this.#n,this.#r+1,this.#t),this.#c.#s=this.#s,this.#c.#u=this.#u,this.#c.#i=this.#i,this.#c):this.#c=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#i!==void 0?this.#i:this.#i=this.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var YV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",mc=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=YV}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new cn(e,this.mmopts);for(let r=0;r<t.set.length;r++){let i=t.set[r],s=t.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let a=new pc(i,s,0,this.platform),c=new cn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var ev=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},tv=class{static{o(this,"MatchRecord")}store=new Map;add(e,t,r){let i=(t?2:0)|(r?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},rv=class{static{o(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===t.globString())||r.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Xl=class n{static{o(this,"Processor")}hasWalkedCache;matches=new tv;subwalks=new rv;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new ev}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let h=s.rest();if(h)s=h;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let h=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,h);continue}else if(l===It){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let h=u?.pattern(),d=u?.rest();if(!u||(h===""||h===".")&&!d)this.matches.add(i,c,h===""||h===".");else if(h===".."){let p=i.parent||i;d?this.hasWalkedCache.hasWalked(p,d)||this.subwalks.add(p,d):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let a of r){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===It?i.testGlobstar(s,a,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,r,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(r&&t.checkFollowGlobstar()?this.subwalks.add(e,r):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let a=e.parent||e;this.subwalks.add(a,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,t,r,i){t.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,t,r,i){e.isNamed(t)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var KV=o((n,e)=>typeof n=="string"?new mc([n],e):Array.isArray(n)?new mc(n,e):n,"makeIgnore"),Kd=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,t,r){if(this.patterns=e,this.path=t,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=KV(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#c(e){return!!this.#n?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=await s.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=s.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?a+s+i:"."+i)}}async match(e,t,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,t)}matchSync(e,t,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,t)}walkCB(e,t,r){this.signal?.aborted&&r(),this.walkCB2(e,t,new Xl(this.opts),r)}walkCB2(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,r,a):c.readdirCB((u,f)=>this.walkCB3(c,f,r,a),!0)}a()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),a);a()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Xl(this.opts),r)}walkCB2Sync(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,r,a)}a()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let[c,l]of r.subwalks.entries())s++,this.walkCB2Sync(c,l,r.child(),a);a()}},Jl=class extends Kd{static{o(this,"GlobWalker")}matches=new Set;constructor(e,t,r){super(e,t,r)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Zl=class extends Kd{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Ns({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var XV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",li=class{static{o(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,_C.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||XV,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?hc:t.platform==="darwin"?Kl:t.platform?dc:vC;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(l=>new cn(l,i)),[a,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new pc(l,f,0,this.platform)})}async walk(){return[...await new Jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Zl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Zl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var nv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new cn(t,e).hasMagic())return!0;return!1},"hasMagic");function Jd(n,e={}){return new li(n,e).streamSync()}o(Jd,"globStreamSync");function SC(n,e={}){return new li(n,e).stream()}o(SC,"globStream");function wC(n,e={}){return new li(n,e).walkSync()}o(wC,"globSync");async function bC(n,e={}){return new li(n,e).walk()}o(bC,"glob_");function Zd(n,e={}){return new li(n,e).iterateSync()}o(Zd,"globIterateSync");function EC(n,e={}){return new li(n,e).iterate()}o(EC,"globIterate");var JV=Jd,ZV=Object.assign(SC,{sync:Jd}),eU=Zd,tU=Object.assign(EC,{sync:Zd}),rU=Object.assign(wC,{stream:Jd,iterate:Zd}),Xd=Object.assign(bC,{glob:bC,globSync:wC,sync:rU,globStream:SC,stream:ZV,globStreamSync:Jd,streamSync:JV,globIterate:EC,iterate:tU,globIterateSync:Zd,iterateSync:eU,Glob:li,hasMagic:nv,escape:ac,unescape:ai});Xd.glob=Xd;var Na=X(ar());var Mi=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await Ut.default.pathExists(t))throw new Na.FileNotFoundError(e);return Ut.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return Ut.default.pathExists(t)}async getFileMetadata(e){let t=await this.readFile(e);return this.extractFrontmatter(t)}async createFile(e,t){let r=this.resolvePath(e);if(await Ut.default.pathExists(r))throw new Na.FileAlreadyExistsError(e);return await Ut.default.ensureDir(ks.default.dirname(r)),await Ut.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await Ut.default.pathExists(r))throw new Na.FileNotFoundError(e);await Ut.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await Ut.default.ensureDir(ks.default.dirname(r)),await Ut.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await Ut.default.pathExists(t))throw new Na.FileNotFoundError(e);await Ut.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await Ut.default.pathExists(r))throw new Na.FileNotFoundError(e);await Ut.default.ensureDir(ks.default.dirname(i)),await Ut.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await Ut.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await Ut.default.pathExists(t)?(await Ut.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=ks.default.join(t,"**/*.md");return(await Xd(r,{nodir:!0})).map(a=>ks.default.relative(this.rootPath,a))}async findFilesByMetadata(e){let t=await this.getMarkdownFiles(),r=[];for(let i of t)try{let s=await this.getFileMetadata(i);this.matchesQuery(s,e)&&r.push(i)}catch{continue}return r}async findFileByUID(e){let t=await this.findFilesByMetadata({exo__Asset_uid:e});return t.length>0?t[0]:null}resolvePath(e){return ks.default.isAbsolute(e)?e:ks.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=xl.load(r[1]);return typeof i=="object"&&i!==null?i:{}}catch{return{}}}matchesQuery(e,t){for(let[r,i]of Object.entries(t)){let s=e[r];if(Array.isArray(s)){if(!s.some(a=>this.normalizeValue(a)===this.normalizeValue(i)))return!1}else if(this.normalizeValue(s)!==this.normalizeValue(i))return!1}return!0}normalizeValue(e){return e==null?"":String(e).replace(/["'[\]]/g,"").trim()}};var eu=X(require("path")),iv=X(Os());var gc=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!eu.default.isAbsolute(e))return eu.default.resolve(this.vaultRoot,e);let t=eu.default.resolve(e),r=eu.default.resolve(this.vaultRoot);if(!t.startsWith(r))throw new Be(`File path ${e} is outside vault root ${this.vaultRoot}`,"Provide a file path within the vault directory.",{filepath:e,vaultRoot:this.vaultRoot});return t}validate(e){if(!iv.default.existsSync(e))throw new Al(e);if(!iv.default.statSync(e).isFile())throw new Be(`Not a file: ${e}`,"Provide a path to a file, not a directory.",{filepath:e});if(!e.endsWith(".md"))throw new Be(`Not a Markdown file: ${e}`,"Provide a path to a .md file.",{filepath:e})}getVaultRoot(){return this.vaultRoot}};var OC=X(ar());var TC=X(ar());var ui=class{static{o(this,"BaseCommandExecutor")}constructor(e){this.pathResolver=e.pathResolver,this.fsAdapter=e.fsAdapter,this.frontmatterService=e.frontmatterService,this.dryRun=e.dryRun}resolveAndValidate(e){let t=this.pathResolver.resolve(e);this.pathResolver.validate(t);let r=t.replace(this.pathResolver.getVaultRoot()+"/","");return{resolvedPath:t,relativePath:r}}getCurrentTimestamp(){return TC.DateFormatter.toLocalTimestamp(new Date)}isAssetArchived(e){if(e?.exo__Asset_isArchived===!0)return!0;let t=e?.archived;if(t==null)return!1;if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){let r=t.toLowerCase().trim();return r==="true"||r==="yes"||r==="1"}return!1}extractAliasesFromFrontmatter(e){let t=e.match(/aliases:\s*\n((?: - .*\n?)*)/);return t?t[1].split(`
|
|
541
|
+
\u{1F4CA} Cache Statistics:`),console.log(` Triples: ${u.tripleCount.toLocaleString()}`),console.log(` Created: ${u.createdAt.toISOString()}`),console.log(` Valid: ${u.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${$$(u.sizeBytes)}`))}}}catch(t){W.handle(t)}})}o(wA,"sparqlIndexCommand");function $$(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}o($$,"formatBytes");function EA(){return new st("templates").description("List available SPARQL query templates").option("--output <type>","Response format: text|json (for MCP tools)","text").action(async n=>{let e=n.output||"text";W.setFormat(e);try{let t=new sc,r=t.listTemplates();if(e==="json"){let i=_e.success({templates:r,count:r.length});console.log(JSON.stringify(i,null,2))}else console.log(t.formatList("text"))}catch(t){W.handle(t)}})}o(EA,"sparqlTemplatesCommand");var PC=require("path");var Ut=X(Os()),ks=X(require("path"));var WA=X(kA(),1);var $l=o(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var z$={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Vl=o(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Q$=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),MA=o(n=>n.join(""),"rangesToString"),jA=o((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,a=!1,c=!1,l=!1,u=!1,f=t,h="";e:for(;s<n.length;){let b=n.charAt(s);if((b==="!"||b==="^")&&s===t+1){u=!0,s++;continue}if(b==="]"&&a&&!l){f=s+1;break}if(a=!0,b==="\\"&&!l){l=!0,s++;continue}if(b==="["&&!l){for(let[E,[A,C,j]]of Object.entries(z$))if(n.startsWith(E,s)){if(h)return["$.",!1,n.length-t,!0];s+=E.length,j?i.push(A):r.push(A),c=c||C;continue e}}if(l=!1,h){b>h?r.push(Vl(h)+"-"+Vl(b)):b===h&&r.push(Vl(b)),h="",s++;continue}if(n.startsWith("-]",s+1)){r.push(Vl(b+"-")),s+=2;continue}if(n.startsWith("-",s+1)){h=b,s+=2;continue}r.push(Vl(b)),s++}if(f<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,n.length-t,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!u){let b=r[0].length===2?r[0].slice(-1):r[0];return[Q$(b),!1,f-t,!1]}let d="["+(u?"^":"")+MA(r)+"]",p="["+(u?"":"^")+MA(i)+"]";return[r.length&&i.length?"("+d+"|"+p+")":r.length?d:p,c,f-t,!0]},"parseClass");var ai=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Kr,Y$=new Set(["!","?","+","*","@"]),V2=o(n=>Y$.has(n),"isExtglobType"),$A=o(n=>V2(n.type),"isExtglobAST"),K$=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),X$=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),J$=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),VA=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Z$="(?!(?:^|/)\\.\\.?(?:$|/))",Nd="(?!\\.)",eV=new Set(["[","."]),tV=new Set(["..","."]),rV=new Set("().*{}+?[]^$\\!"),nV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),U2="[^/]",UA=U2+"*?",BA=U2+"+?",Ra=class{static{o(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#v;#i;#u=!1;#s;#l;#a=!1;constructor(e,t,r={}){this.type=e,e&&(this.#n=!0),this.#c=t,this.#e=this.#c?this.#c.#e:this,this.#s=this.#e===this?r:this.#e.#s,this.#i=this.#e===this?[]:this.#e.#i,e==="!"&&!this.#e.#u&&this.#i.push(this),this.#v=this.#c?this.#c.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#l=this.#t.map(e=>String(e)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let e;for(;e=this.#i.pop();){if(e.type!=="!")continue;let t=e,r=t.#c;for(;r;){for(let i=t.#v+1;!r.type&&i<r.#t.length;i++)for(let s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#t[i])}t=r,r=t.#c}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Kr&&t.#c===this))throw new Error("invalid part: "+t);this.#t.push(t)}}toJSON(){let e=this.type===null?this.#t.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#t.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#c?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#c?.isStart())return!1;if(this.#v===0)return!0;let e=this.#c;for(let t=0;t<this.#v;t++){let r=e.#t[t];if(!(r instanceof Kr&&r.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#c?.type==="!")return!0;if(!this.#c?.isEnd())return!1;if(!this.type)return this.#c?.isEnd();let e=this.#c?this.#c.#t.length:0;return this.#v===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Kr(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let a=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let b=r,E="";for(;b<e.length;){let A=e.charAt(b++);if(c||A==="\\"){c=!c,E+=A;continue}if(l){b===u+1?(A==="^"||A==="!")&&(f=!0):A==="]"&&!(b===u+2&&f)&&(l=!1),E+=A;continue}else if(A==="["){l=!0,u=b,f=!1,E+=A;continue}if(!i.noext&&V2(A)&&e.charAt(b)==="("&&s<=a){t.push(E),E="";let j=new Kr(A,t);b=Kr.#g(e,j,b,i,s+1),t.push(j);continue}E+=A}return t.push(E),b}let h=r+1,d=new Kr(null,t),p=[],_="";for(;h<e.length;){let b=e.charAt(h++);if(c||b==="\\"){c=!c,_+=b;continue}if(l){h===u+1?(b==="^"||b==="!")&&(f=!0):b==="]"&&!(h===u+2&&f)&&(l=!1),_+=b;continue}else if(b==="["){l=!0,u=h,f=!1,_+=b;continue}if(V2(b)&&e.charAt(h)==="("&&(s<=a||t&&t.#y(b))){let A=t&&t.#y(b)?0:1;d.push(_),_="";let C=new Kr(b,d);d.push(C),h=Kr.#g(e,C,h,i,s+A);continue}if(b==="|"){d.push(_),_="",p.push(d),d=new Kr(null,t);continue}if(b===")")return _===""&&t.#t.length===0&&(t.#a=!0),d.push(_),_="",t.push(...p,d),h;_+=b}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],h}#h(e){return this.#m(e,X$)}#m(e,t=K$){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type,t)}#y(e,t=J$){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Kr(null,r,this.options);i.#t.push(""),r.push(i),this.#E(e,t)}#E(e,t){let r=e.#t[0];this.#t.splice(t,1,...r.#t);for(let i of r.#t)typeof i=="object"&&(i.#c=this);this.#l=void 0}#T(e){return!!VA.get(this.type)?.has(e)}#_(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let t=e.#t[0];return!t||typeof t!="object"||t.type===null?!1:this.#T(t.type)}#w(e){let t=VA.get(this.type),r=e.#t[0],i=t?.get(r.type);if(!i)return!1;this.#t=r.#t;for(let s of this.#t)typeof s=="object"&&(s.#c=this);this.type=i,this.#l=void 0,this.#a=!1}#b(){if($A(this)){let e=0,t=!1;do{t=!0;for(let r=0;r<this.#t.length;r++){let i=this.#t[r];typeof i=="object"&&(i.#b(),this.#m(i)?(t=!1,this.#E(i,r)):this.#h(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#w(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#b();this.#l=void 0}static fromGlob(e,t={}){let r=new Kr(null,void 0,t);return Kr.#g(e,r,0,t,0),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,r,i,s]=this.toRegExpSource();if(!(i||this.#n||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let c=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,c),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#e===this&&(this.#b(),this.#p()),!$A(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[_,b,E,A]=typeof p=="string"?Kr.#A(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||E,this.#r=this.#r||A,_}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&tV.has(this.#t[0]))){let _=eV,b=t&&_.has(u.charAt(0))||u.startsWith("\\.")&&_.has(u.charAt(2))||u.startsWith("\\.\\.")&&_.has(u.charAt(4)),E=!t&&!e&&_.has(u.charAt(0));f=b?Z$:E?Nd:""}let h="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(h="(?:$|\\/)"),[f+u+h,ai(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#S(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),u=this;return u.#t=[l],u.type=null,u.#n=void 0,[l,ai(this.toString()),!1,!1]}let a=!r||e||t||!Nd?"":this.#S(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let c="";if(this.type==="!"&&this.#a)c=(this.isStart()&&!t?Nd:"")+BA;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Nd:"")+UA+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;c=i+s+l}return[c,ai(s),this.#n=!!this.#n,this.#r]}#S(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,a]=t.toRegExpSource(e);return this.#r=this.#r||a,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#A(e,t,r=!1){let i=!1,s="",a=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(rV.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,h,d,p]=jA(e,l);if(d){s+=f,a=a||h,l+=d-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?BA:UA,t=!0;continue}else c=!1;if(u==="?"){s+=U2,t=!0;continue}s+=nV(u)}return[s,ai(e),!!t,a]}};Kr=Ra;var ac=o((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var ur=o((n,e,t={})=>($l(e),!t.nocomment&&e.charAt(0)==="#"?!1:new cn(e,t).match(n)),"minimatch"),iV=/^\*+([^+@!?\*\[\(]*)$/,sV=o(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),aV=o(n=>e=>e.endsWith(n),"starDotExtTestDot"),oV=o(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),cV=o(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),lV=/^\*+\.\*+$/,uV=o(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),fV=o(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),hV=/^\.\*+$/,dV=o(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),pV=/^\*+$/,mV=o(n=>n.length!==0&&!n.startsWith("."),"starTest"),gV=o(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),yV=/^\?+([^+@!?\*\[\(]*)?$/,vV=o(([n,e=""])=>{let t=HA([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),_V=o(([n,e=""])=>{let t=zA([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),bV=o(([n,e=""])=>{let t=zA([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),SV=o(([n,e=""])=>{let t=HA([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),HA=o(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),zA=o(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),QA=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",qA={win32:{sep:"\\"},posix:{sep:"/"}},wV=QA==="win32"?qA.win32.sep:qA.posix.sep;ur.sep=wV;var It=Symbol("globstar **");ur.GLOBSTAR=It;var EV="[^/]",TV=EV+"*?",xV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",AV="(?:(?!(?:\\/|^)\\.).)*?",CV=o((n,e={})=>t=>ur(t,n,e),"filter");ur.filter=CV;var In=o((n,e={})=>Object.assign({},n,e),"ext"),IV=o(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return ur;let e=ur;return Object.assign(o((r,i,s={})=>e(r,i,In(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{o(this,"Minimatch")}constructor(i,s={}){super(i,In(n,s))}static defaults(i){return e.defaults(In(n,i)).Minimatch}},AST:class extends e.AST{static{o(this,"AST")}constructor(i,s,a={}){super(i,s,In(n,a))}static fromGlob(i,s={}){return e.AST.fromGlob(i,In(n,s))}},unescape:o((r,i={})=>e.unescape(r,In(n,i)),"unescape"),escape:o((r,i={})=>e.escape(r,In(n,i)),"escape"),filter:o((r,i={})=>e.filter(r,In(n,i)),"filter"),defaults:o(r=>e.defaults(In(n,r)),"defaults"),makeRe:o((r,i={})=>e.makeRe(r,In(n,i)),"makeRe"),braceExpand:o((r,i={})=>e.braceExpand(r,In(n,i)),"braceExpand"),match:o((r,i,s={})=>e.match(r,i,In(n,s)),"match"),sep:e.sep,GLOBSTAR:It})},"defaults");ur.defaults=IV;var YA=o((n,e={})=>($l(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,WA.default)(n)),"braceExpand");ur.braceExpand=YA;var OV=o((n,e={})=>new cn(n,e).makeRe(),"makeRe");ur.makeRe=OV;var PV=o((n,e,t={})=>{let r=new cn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");ur.match=PV;var GA=/[?*]|[+@!]\(.*?\)|\[|\]/,RV=o(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),cn=class{static{o(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){$l(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||QA,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,a,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!GA.test(s[2]))&&!GA.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(f=>this.parse(f))];if(u)return[s[0],...s.slice(1).map(f=>this.parse(f))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r=0;r<e.length;r++)for(let i=0;i<e[r].length;i++)e[r][i]==="**"&&(e[r][i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let r=-1;for(;(r=t.indexOf("**",r+1))!==-1;){let i=r;for(;t[i+1]==="**";)i++;i!==r&&t.splice(r,i-r)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(t=!0,e.splice(r-1,2),r-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let a=i;for(;r[a+1]==="**";)a++;a>i&&r.splice(i+1,a-i);let c=r[i+1],l=r[i+2],u=r[i+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;t=!0,r.splice(i,1);let f=r.slice(0);f[i]="**",e.push(f),i--}if(!this.preserveMultipleSlashes){for(let a=1;a<r.length-1;a++){let c=r[a];a===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(a,1),a--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let a=r[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){t=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let r=t+1;r<e.length;r++){let i=this.partsMatch(e[t],e[r],!this.preserveMultipleSlashes);if(i){e[t]=[],e[r]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,r=!1){let i=0,s=0,a=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])a.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])a.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])a.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="b")return!1;c="a",a.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(c==="a")return!1;c="b",a.push(t[s]),i++,s++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,r++;r&&(this.pattern=e.slice(r)),this.negate=t}matchOne(e,t,r=!1){let i=0,s=0;if(this.isWindows){let c=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!c&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),u=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),f=!u&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),h=l?3:c?0:void 0,d=f?3:u?0:void 0;if(typeof h=="number"&&typeof d=="number"){let[p,_]=[e[h],t[d]];p.toLowerCase()===_.toLowerCase()&&(t[d]=p,s=d,i=h)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(It)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let a=t.indexOf(It,s),c=t.lastIndexOf(It),[l,u,f]=r?[t.slice(s,a),t.slice(a+1),[]]:[t.slice(s,a),t.slice(a+1,c),t.slice(c+1)];if(l.length){let C=e.slice(i,i+l.length);if(!this.#r(C,l,r,0,0))return!1;i+=l.length}let h=0;if(f.length){if(f.length+i>e.length)return!1;let C=e.length-f.length;if(this.#r(e,f,r,C,0))h=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(C--,!this.#r(e,f,r,C,0)))return!1;h=f.length+1}}if(!u.length){let C=!!h;for(let j=i;j<e.length-h;j++){let G=String(e[j]);if(C=!0,G==="."||G===".."||!this.options.dot&&G.startsWith("."))return!1}return r||C}let d=[[[],0]],p=d[0],_=0,b=[0];for(let C of u)C===It?(b.push(_),p=[[],0],d.push(p)):(p[0].push(C),_++);let E=d.length-1,A=e.length-h;for(let C of d)C[1]=A-(b[E--]+C[0].length);return!!this.#n(e,d,i,0,r,0,!!h)}#n(e,t,r,i,s,a,c){let l=t[i];if(!l){for(let h=r;h<e.length;h++){c=!0;let d=e[h];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return c}let[u,f]=l;for(;r<=f;){if(this.#r(e.slice(0,r+u.length),u,s,r,0)&&a<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,a+1,c);if(p!==!1)return p}let d=e[r];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let a,c,l,u;for(a=i,c=s,u=e.length,l=t.length;a<u&&c<l;a++,c++){this.debug("matchOne loop");let f=t[c],h=e[a];if(this.debug(t,f,h),f===!1||f===It)return!1;let d;if(typeof f=="string"?(d=h===f,this.debug("string match",f,h,d)):(d=f.test(h),this.debug("pattern match",f,h,d)),!d)return!1}if(a===u&&c===l)return!0;if(a===u)return r;if(c===l)return a===u-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return YA(this.pattern,this.options)}parse(e){$l(e);let t=this.options;if(e==="**")return It;if(e==="")return"";let r,i=null;(r=e.match(pV))?i=t.dot?gV:mV:(r=e.match(iV))?i=(t.nocase?t.dot?cV:oV:t.dot?aV:sV)(r[1]):(r=e.match(yV))?i=(t.nocase?t.dot?_V:vV:t.dot?bV:SV)(r):(r=e.match(lV))?i=t.dot?fV:uV:(r=e.match(hV))&&(i=dV);let s=Ra.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,r=t.noglobstar?TV:t.dot?xV:AV,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))i.add(h);return typeof f=="string"?RV(f):f===It?It:f._src});return u.forEach((f,h)=>{let d=u[h+1],p=u[h-1];f!==It||p===It||(p===void 0?d!==void 0&&d!==It?u[h+1]="(?:\\/|"+r+"\\/)?"+d:u[h]=r:d===void 0?u[h-1]=p+"(?:\\/|"+r+")?":d!==It&&(u[h-1]=p+"(?:\\/|\\/"+r+"\\/)"+d,u[h+1]=It))}),u.filter(f=>f!==It).join("/")}).join("|"),[a,c]=e.length>1?["(?:",")"]:["",""];s="^"+a+s+c+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let a=i[i.length-1];if(!a)for(let c=i.length-2;!a&&c>=0;c--)a=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return ur.defaults(e).Minimatch}};ur.AST=Ra;ur.Minimatch=cn;ur.escape=ac;ur.unescape=ai;var _C=require("node:url");var oc=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,XA=new Set,B2=typeof process=="object"&&process?process:{},JA=o((n,e,t,r)=>{typeof B2.emitWarning=="function"?B2.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Ld=globalThis.AbortController,KA=globalThis.AbortSignal;if(typeof Ld>"u"){KA=class{static{o(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Ld=class{static{o(this,"AbortController")}constructor(){e()}signal=new KA;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let n=B2.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=o(()=>{n&&(n=!1,JA("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))},"warnACPolyfill")}var FV=o(n=>!XA.has(n),"shouldWarn");var Fs=o(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),ZA=o(n=>Fs(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?cc:null:null,"getUintArray"),cc=class extends Array{static{o(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},q2=class n{static{o(this,"Stack")}heap;length;static#e=!1;static create(e){let t=ZA(e);if(!t)return[];n.#e=!0;let r=new n(e,t);return n.#e=!1,r}constructor(e,t){if(!n.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Ul=class n{static{o(this,"LRUCache")}#e;#n;#r;#t;#c;#v;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#a;#p;#g;#h;#m;#y;#f;#E;#T;#_;#w;#b;#S;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#a,next:e.#p,prev:e.#g,get head(){return e.#h},get tail(){return e.#m},free:e.#y,isBackgroundFetch:o(t=>e.#d(t),"isBackgroundFetch"),backgroundFetch:o((t,r,i,s)=>e.#j(t,r,i,s),"backgroundFetch"),moveToTail:o(t=>e.#V(t),"moveToTail"),indexes:o(t=>e.#I(t),"indexes"),rindexes:o(t=>e.#O(t),"rindexes"),isStale:o(t=>e.#x(t),"isStale")}}get max(){return this.#e}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#i}get fetchMethod(){return this.#c}get memoMethod(){return this.#v}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:h,noUpdateTTL:d,maxSize:p=0,maxEntrySize:_=0,sizeCalculation:b,fetchMethod:E,memoMethod:A,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:j,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:Q,ignoreFetchAbort:H}=e;if(t!==0&&!Fs(t))throw new TypeError("max option must be a nonnegative integer");let ee=t?ZA(t):Array;if(!ee)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=_||this.#n,this.sizeCalculation=b,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(A!==void 0&&typeof A!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#v=A,E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=E,this.#b=!!E,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#a=new Array(t).fill(void 0),this.#p=new ee(t),this.#g=new ee(t),this.#h=0,this.#m=0,this.#y=q2.create(t),this.#i=0,this.#u=0,typeof u=="function"&&(this.#r=u),typeof f=="function"?(this.#t=f,this.#f=[]):(this.#t=void 0,this.#f=void 0),this.#w=!!this.#r,this.#S=!!this.#t,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!G,this.allowStaleOnFetchAbort=!!Q,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(this.#n!==0&&!Fs(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Fs(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!j,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!c,this.ttlResolution=Fs(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Fs(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#A()}if(this.#e===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#n){let Se="LRU_CACHE_UNBOUNDED";FV(Se)&&(XA.add(Se),JA("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Se,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#A(){let e=new cc(this.#e),t=new cc(this.#e);this.#_=e,this.#T=t,this.#F=(s,a,c=oc.now())=>{if(t[s]=a!==0?c:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#x(s)&&this.#R(this.#l[s],"expire")},a+1);l.unref&&l.unref()}},this.#C=s=>{t[s]=e[s]!==0?oc.now():0},this.#o=(s,a)=>{if(e[a]){let c=e[a],l=t[a];if(!c||!l)return;s.ttl=c,s.start=l,s.now=r||i();let u=s.now-l;s.remainingTTL=c-u}};let r=0,i=o(()=>{let s=oc.now();if(this.ttlResolution>0){r=s;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref()}return s},"getNow");this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let c=e[a],l=t[a];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#x=s=>{let a=t[s],c=e[s];return!!c&&!!a&&(r||i())-a>c}}#C=o(()=>{},"#updateItemAge");#o=o(()=>{},"#statusTTL");#F=o(()=>{},"#setItemTTL");#x=o(()=>!1,"#isStale");#P(){let e=new cc(this.#e);this.#u=0,this.#E=e,this.#D=t=>{this.#u-=e[t],e[t]=0},this.#L=(t,r,i,s)=>{if(this.#d(r))return 0;if(!Fs(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Fs(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#N=(t,r,i)=>{if(e[t]=r,this.#n){let s=this.#n-e[t];for(;this.#u>s;)this.#M(!0)}this.#u+=e[t],i&&(i.entrySize=r,i.totalCalculatedSize=this.#u)}}#D=o(e=>{},"#removeItemSize");#N=o((e,t,r)=>{},"#addItemSize");#L=o((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#I({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#x(t))&&(yield t),t===this.#h));)t=this.#g[t]}*#O({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#h;!(!this.#k(t)||((e||!this.#x(t))&&(yield t),t===this.#m));)t=this.#p[t]}#k(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#I())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*rentries(){for(let e of this.#O())this.#a[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(this.#a[e])&&(yield[this.#l[e],this.#a[e]])}*keys(){for(let e of this.#I()){let t=this.#l[e];t!==void 0&&!this.#d(this.#a[e])&&(yield t)}}*rkeys(){for(let e of this.#O()){let t=this.#l[e];t!==void 0&&!this.#d(this.#a[e])&&(yield t)}}*values(){for(let e of this.#I())this.#a[e]!==void 0&&!this.#d(this.#a[e])&&(yield this.#a[e])}*rvalues(){for(let e of this.#O())this.#a[e]!==void 0&&!this.#d(this.#a[e])&&(yield this.#a[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#I()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[r],this))return this.get(this.#l[r],t)}}forEach(e,t=this){for(let r of this.#I()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#O()){let i=this.#a[r],s=this.#d(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#O({allowStale:!0}))this.#x(t)&&(this.#R(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#a[t],i=this.#d(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let a=this.#_[t],c=this.#T[t];if(a&&c){let l=a-(oc.now()-c);s.ttl=l,s.start=Date.now()}}return this.#E&&(s.size=this.#E[t]),s}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let r=this.#l[t],i=this.#a[t],s=this.#d(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(this.#_&&this.#T){a.ttl=this.#_[t];let c=oc.now()-this.#T[t];a.start=Math.floor(Date.now()-c)}this.#E&&(a.size=this.#E[t]),e.unshift([r,a])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=oc.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#L(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#R(e,"set"),this;let h=this.#i===0?void 0:this.#s.get(e);if(h===void 0)h=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[h]=e,this.#a[h]=t,this.#s.set(e,h),this.#p[this.#m]=h,this.#g[h]=this.#m,this.#m=h,this.#i++,this.#N(h,f,l),l&&(l.set="add"),u=!1;else{this.#V(h);let d=this.#a[h];if(t!==d){if(this.#b&&this.#d(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=d;p!==void 0&&!a&&(this.#w&&this.#r?.(p,e,"set"),this.#S&&this.#f?.push([p,e,"set"]))}else a||(this.#w&&this.#r?.(d,e,"set"),this.#S&&this.#f?.push([d,e,"set"]));if(this.#D(h),this.#N(h,f,l),this.#a[h]=t,l){l.set="replace";let p=d&&this.#d(d)?d.__staleWhileFetching:d;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#A(),this.#_&&(u||this.#F(h,i,s),l&&this.#o(l,h)),!a&&this.#S&&this.#f){let d=this.#f,p;for(;p=d?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#a[this.#h];if(this.#M(!0),this.#d(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#S&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#h,r=this.#l[t],i=this.#a[t];return this.#b&&this.#d(i)?i.__abortController.abort(new Error("evicted")):(this.#w||this.#S)&&(this.#w&&this.#r?.(i,r,"evict"),this.#S&&this.#f?.push([i,r,"evict"])),this.#D(t),e&&(this.#l[t]=void 0,this.#a[t]=void 0,this.#y.push(t)),this.#i===1?(this.#h=this.#m=0,this.#y.length=0):this.#h=this.#p[t],this.#s.delete(r),this.#i--,t}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=this.#s.get(e);if(s!==void 0){let a=this.#a[s];if(this.#d(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#x(s))i&&(i.has="stale",this.#o(i,s));else return r&&this.#C(s),i&&(i.has="hit",this.#o(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=this.#s.get(e);if(i===void 0||!r&&this.#x(i))return;let s=this.#a[i];return this.#d(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#a[t];if(this.#d(s))return s;let a=new Ld,{signal:c}=r;c?.addEventListener("abort",()=>a.abort(c.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:i},u=o((b,E=!1)=>{let{aborted:A}=a.signal,C=r.ignoreFetchAbort&&b!==void 0;if(r.status&&(A&&!E?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,C&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),A&&!C&&!E)return h(a.signal.reason);let j=p;return this.#a[t]===p&&(b===void 0?j.__staleWhileFetching?this.#a[t]=j.__staleWhileFetching:this.#R(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,b,l.options))),b},"cb"),f=o(b=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=b),h(b)),"eb"),h=o(b=>{let{aborted:E}=a.signal,A=E&&r.allowStaleOnFetchAbort,C=A||r.allowStaleOnFetchRejection,j=C||r.noDeleteOnFetchRejection,G=p;if(this.#a[t]===p&&(!j||G.__staleWhileFetching===void 0?this.#R(e,"fetch"):A||(this.#a[t]=G.__staleWhileFetching)),C)return r.status&&G.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),G.__staleWhileFetching;if(G.__returned===G)throw b},"fetchFail"),d=o((b,E)=>{let A=this.#c?.(e,s,l);A&&A instanceof Promise&&A.then(C=>b(C===void 0?void 0:C),E),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=o(C=>u(C,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(d).then(u,f),_=Object.assign(p,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,_,{...l.options,status:void 0}),t=this.#s.get(e)):this.#a[t]=_,_}#d(e){if(!this.#b)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ld}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:b,forceRefresh:E=!1,status:A,signal:C}=t;if(!this.#b)return A&&(A.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:A});let j={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:_,ignoreFetchAbort:p,status:A,signal:C},G=this.#s.get(e);if(G===void 0){A&&(A.fetch="miss");let Q=this.#j(e,G,j,b);return Q.__returned=Q}else{let Q=this.#a[G];if(this.#d(Q)){let Y=r&&Q.__staleWhileFetching!==void 0;return A&&(A.fetch="inflight",Y&&(A.returnedStale=!0)),Y?Q.__staleWhileFetching:Q.__returned=Q}let H=this.#x(G);if(!E&&!H)return A&&(A.fetch="hit"),this.#V(G),i&&this.#C(G),A&&this.#o(A,G),Q;let ee=this.#j(e,G,j,b),L=ee.__staleWhileFetching!==void 0&&r;return A&&(A.fetch=H?"stale":"refresh",L&&H&&(A.returnedStale=!0)),L?ee.__staleWhileFetching:ee.__returned=ee}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=this.#v;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,c=this.get(e,a);if(!s&&c!==void 0)return c;let l=r(e,c,{options:a,context:i});return this.set(e,l,a),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#a[c],u=this.#d(l);return a&&this.#o(a,c),this.#x(c)?(a&&(a.get="stale"),u?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#R(e,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#V(c),i&&this.#C(c),l))}else a&&(a.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#V(e){e!==this.#m&&(e===this.#h?this.#h=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#R(e,"delete")}#R(e,t){let r=!1;if(this.#i!==0){let i=this.#s.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.#U(t);else{this.#D(i);let s=this.#a[i];if(this.#d(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#S)&&(this.#w&&this.#r?.(s,e,t),this.#S&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#a[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#h)this.#h=this.#p[i];else{let a=this.#g[i];this.#p[a]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#S&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#U("delete")}#U(e){for(let t of this.#O({allowStale:!0})){let r=this.#a[t];if(this.#d(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#w&&this.#r?.(r,i,e),this.#S&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#_&&this.#T&&(this.#_.fill(0),this.#T.fill(0)),this.#E&&this.#E.fill(0),this.#h=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#S&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var fc=require("node:path"),lC=require("node:url"),ki=require("fs"),BV=X(require("node:fs"),1),Ls=require("node:fs/promises");var Bd=require("node:events"),K2=X(require("node:stream"),1),iC=require("node:string_decoder");var eC=typeof process=="object"&&process?process:{stdout:null,stderr:null},DV=o(n=>!!n&&typeof n=="object"&&(n instanceof Ns||n instanceof K2.default||NV(n)||LV(n)),"isStream"),NV=o(n=>!!n&&typeof n=="object"&&n instanceof Bd.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==K2.default.Writable.prototype.pipe,"isReadable"),LV=o(n=>!!n&&typeof n=="object"&&n instanceof Bd.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),ss=Symbol("EOF"),as=Symbol("maybeEmitEnd"),Ds=Symbol("emittedEnd"),kd=Symbol("emittingEnd"),Bl=Symbol("emittedError"),Md=Symbol("closed"),tC=Symbol("read"),jd=Symbol("flush"),rC=Symbol("flushChunk"),oi=Symbol("encoding"),lc=Symbol("decoder"),Qt=Symbol("flowing"),ql=Symbol("paused"),uc=Symbol("resume"),Yt=Symbol("buffer"),Ur=Symbol("pipes"),Kt=Symbol("bufferLength"),G2=Symbol("bufferPush"),$d=Symbol("bufferShift"),Er=Symbol("objectMode"),Ot=Symbol("destroyed"),W2=Symbol("error"),H2=Symbol("emitData"),nC=Symbol("emitEnd"),z2=Symbol("emitEnd2"),Ni=Symbol("async"),Q2=Symbol("abort"),Vd=Symbol("aborted"),Gl=Symbol("signal"),Fa=Symbol("dataListeners"),ln=Symbol("discarded"),Wl=o(n=>Promise.resolve().then(n),"defer"),kV=o(n=>n(),"nodefer"),MV=o(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),jV=o(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),$V=o(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Ud=class{static{o(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[uc](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Y2=class extends Ud{static{o(this,"PipeProxyErrors")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},VV=o(n=>!!n.objectMode,"isObjectModeOptions"),UV=o(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Ns=class extends Bd.EventEmitter{static{o(this,"Minipass")}[Qt]=!1;[ql]=!1;[Ur]=[];[Yt]=[];[Er];[oi];[Ni];[lc];[ss]=!1;[Ds]=!1;[kd]=!1;[Md]=!1;[Bl]=null;[Kt]=0;[Ot]=!1;[Gl];[Vd]=!1;[Fa]=0;[ln]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");VV(t)?(this[Er]=!0,this[oi]=null):UV(t)?(this[oi]=t.encoding,this[Er]=!1):(this[Er]=!1,this[oi]=null),this[Ni]=!!t.async,this[lc]=this[oi]?new iC.StringDecoder(this[oi]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[Yt],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[Ur],"get")});let{signal:r}=t;r&&(this[Gl]=r,r.aborted?this[Q2]():r.addEventListener("abort",()=>this[Q2]()))}get bufferLength(){return this[Kt]}get encoding(){return this[oi]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Er]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ni]}set async(e){this[Ni]=this[Ni]||!!e}[Q2](){this[Vd]=!0,this.emit("abort",this[Gl]?.reason),this.destroy(this[Gl]?.reason)}get aborted(){return this[Vd]}set aborted(e){}write(e,t,r){if(this[Vd])return!1;if(this[ss])throw new Error("write after end");if(this[Ot])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||(t="utf8");let i=this[Ni]?Wl:kV;if(!this[Er]&&!Buffer.isBuffer(e)){if($V(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(jV(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Er]?(this[Qt]&&this[Kt]!==0&&this[jd](!0),this[Qt]?this.emit("data",e):this[G2](e),this[Kt]!==0&&this.emit("readable"),r&&i(r),this[Qt]):e.length?(typeof e=="string"&&!(t===this[oi]&&!this[lc]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[oi]&&(e=this[lc].write(e)),this[Qt]&&this[Kt]!==0&&this[jd](!0),this[Qt]?this.emit("data",e):this[G2](e),this[Kt]!==0&&this.emit("readable"),r&&i(r),this[Qt]):(this[Kt]!==0&&this.emit("readable"),r&&i(r),this[Qt])}read(e){if(this[Ot])return null;if(this[ln]=!1,this[Kt]===0||e===0||e&&e>this[Kt])return this[as](),null;this[Er]&&(e=null),this[Yt].length>1&&!this[Er]&&(this[Yt]=[this[oi]?this[Yt].join(""):Buffer.concat(this[Yt],this[Kt])]);let t=this[tC](e||null,this[Yt][0]);return this[as](),t}[tC](e,t){if(this[Er])this[$d]();else{let r=t;e===r.length||e===null?this[$d]():typeof r=="string"?(this[Yt][0]=r.slice(e),t=r.slice(0,e),this[Kt]-=e):(this[Yt][0]=r.subarray(e),t=r.subarray(0,e),this[Kt]-=e)}return this.emit("data",t),!this[Yt].length&&!this[ss]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[ss]=!0,this.writable=!1,(this[Qt]||!this[ql])&&this[as](),this}[uc](){this[Ot]||(!this[Fa]&&!this[Ur].length&&(this[ln]=!0),this[ql]=!1,this[Qt]=!0,this.emit("resume"),this[Yt].length?this[jd]():this[ss]?this[as]():this.emit("drain"))}resume(){return this[uc]()}pause(){this[Qt]=!1,this[ql]=!0,this[ln]=!1}get destroyed(){return this[Ot]}get flowing(){return this[Qt]}get paused(){return this[ql]}[G2](e){this[Er]?this[Kt]+=1:this[Kt]+=e.length,this[Yt].push(e)}[$d](){return this[Er]?this[Kt]-=1:this[Kt]-=this[Yt][0].length,this[Yt].shift()}[jd](e=!1){do;while(this[rC](this[$d]())&&this[Yt].length);!e&&!this[Yt].length&&!this[ss]&&this.emit("drain")}[rC](e){return this.emit("data",e),this[Qt]}pipe(e,t){if(this[Ot])return e;this[ln]=!1;let r=this[Ds];return t=t||{},e===eC.stdout||e===eC.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[Ur].push(t.proxyErrors?new Y2(this,e,t):new Ud(this,e,t)),this[Ni]?Wl(()=>this[uc]()):this[uc]()),e}unpipe(e){let t=this[Ur].find(r=>r.dest===e);t&&(this[Ur].length===1?(this[Qt]&&this[Fa]===0&&(this[Qt]=!1),this[Ur]=[]):this[Ur].splice(this[Ur].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[ln]=!1,this[Fa]++,!this[Ur].length&&!this[Qt]&&this[uc]();else if(e==="readable"&&this[Kt]!==0)super.emit("readable");else if(MV(e)&&this[Ds])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Bl]){let i=t;this[Ni]?Wl(()=>i.call(this,this[Bl])):i.call(this,this[Bl])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Fa]=this.listeners("data").length,this[Fa]===0&&!this[ln]&&!this[Ur].length&&(this[Qt]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Fa]=0,!this[ln]&&!this[Ur].length&&(this[Qt]=!1)),t}get emittedEnd(){return this[Ds]}[as](){!this[kd]&&!this[Ds]&&!this[Ot]&&this[Yt].length===0&&this[ss]&&(this[kd]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Md]&&this.emit("close"),this[kd]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==Ot&&this[Ot])return!1;if(e==="data")return!this[Er]&&!r?!1:this[Ni]?(Wl(()=>this[H2](r)),!0):this[H2](r);if(e==="end")return this[nC]();if(e==="close"){if(this[Md]=!0,!this[Ds]&&!this[Ot])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Bl]=r,super.emit(W2,r);let s=!this[Gl]||this.listeners("error").length?super.emit("error",r):!1;return this[as](),s}else if(e==="resume"){let s=super.emit("resume");return this[as](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...t);return this[as](),i}[H2](e){for(let r of this[Ur])r.dest.write(e)===!1&&this.pause();let t=this[ln]?!1:super.emit("data",e);return this[as](),t}[nC](){return this[Ds]?!1:(this[Ds]=!0,this.readable=!1,this[Ni]?(Wl(()=>this[z2]()),!0):this[z2]())}[z2](){if(this[lc]){let t=this[lc].end();if(t){for(let r of this[Ur])r.dest.write(t);this[ln]||super.emit("data",t)}}for(let t of this[Ur])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Er]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[Er]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[Er])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[oi]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(Ot,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ln]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[ss])return t();let s,a,c=o(h=>{this.off("data",l),this.off("end",u),this.off(Ot,f),t(),a(h)},"onerr"),l=o(h=>{this.off("error",c),this.off("end",u),this.off(Ot,f),this.pause(),s({value:h,done:!!this[ss]})},"ondata"),u=o(()=>{this.off("error",c),this.off("data",l),this.off(Ot,f),t(),s({done:!0,value:void 0})},"onend"),f=o(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((h,d)=>{a=d,s=h,this.once(Ot,f),this.once("error",c),this.once("end",u),this.once("data",l)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ln]=!1;let e=!1,t=o(()=>(this.pause(),this.off(W2,t),this.off(Ot,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(W2,t),this.once(Ot,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[Ot])return e?this.emit("error",e):this.emit(Ot),this;this[Ot]=!0,this[ln]=!0,this[Yt].length=0,this[Kt]=0;let t=this;return typeof t.close=="function"&&!this[Md]&&t.close(),e?this.emit("error",e):this.emit(Ot),this}static get isStream(){return DV}};var qV=ki.realpathSync.native,zl={lstatSync:ki.lstatSync,readdir:ki.readdir,readdirSync:ki.readdirSync,readlinkSync:ki.readlinkSync,realpathSync:qV,promises:{lstat:Ls.lstat,readdir:Ls.readdir,readlink:Ls.readlink,realpath:Ls.realpath}},uC=o(n=>!n||n===zl||n===BV?zl:{...zl,...n,promises:{...zl.promises,...n.promises||{}}},"fsFromOption"),fC=/^\\\\\?\\([a-z]:)\\?$/i,GV=o(n=>n.replace(/\//g,"\\").replace(fC,"$1\\"),"uncToDrive"),WV=/[\\\/]/,Pn=0,hC=1,dC=2,Li=4,pC=6,mC=8,Da=10,gC=12,On=15,Hl=~On,X2=16,sC=32,Ql=64,ci=128,qd=256,Wd=512,aC=Ql|ci|Wd,HV=1023,J2=o(n=>n.isFile()?mC:n.isDirectory()?Li:n.isSymbolicLink()?Da:n.isCharacterDevice()?dC:n.isBlockDevice()?pC:n.isSocket()?gC:n.isFIFO()?hC:Pn,"entToType"),oC=new Map,Yl=o(n=>{let e=oC.get(n);if(e)return e;let t=n.normalize("NFKD");return oC.set(n,t),t},"normalize"),cC=new Map,Gd=o(n=>{let e=cC.get(n);if(e)return e;let t=Yl(n.toLowerCase());return cC.set(n,t),t},"normalizeNocase"),Hd=class extends Ul{static{o(this,"ResolveCache")}constructor(){super({max:256})}},Z2=class extends Ul{static{o(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:o(t=>t.length+1,"sizeCalculation")})}},yC=Symbol("PathScurry setAsCwd"),Tr=class{static{o(this,"PathBase")}name;root;roots;parent;nocase;isCWD=!1;#e;#n;get dev(){return this.#n}#r;get mode(){return this.#r}#t;get nlink(){return this.#t}#c;get uid(){return this.#c}#v;get gid(){return this.#v}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#a;get blocks(){return this.#a}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#h;get ctimeMs(){return this.#h}#m;get birthtimeMs(){return this.#m}#y;get atime(){return this.#y}#f;get mtime(){return this.#f}#E;get ctime(){return this.#E}#T;get birthtime(){return this.#T}#_;#w;#b;#S;#A;#C;#o;#F;#x;#P;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=Pn,r,i,s,a,c){this.name=e,this.#_=s?Gd(e):Yl(e),this.#o=t&HV,this.nocase=s,this.roots=i,this.root=r||this,this.#F=a,this.#b=c.fullpath,this.#A=c.relative,this.#C=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=uC(c.fs)}depth(){return this.#w!==void 0?this.#w:this.parent?this.#w=this.parent.depth()+1:this.#w=0}childrenCache(){return this.#F}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#D(i):this.#D(i)}#D(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#F.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#F.set(this,t),this.#o&=~X2,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Gd(e):Yl(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",a=this.#b?this.#b+s+e:void 0,c=this.newChild(e,Pn,{...t,parent:this,fullpath:a});return this.canReaddir()||(c.#o|=ci),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#A!==void 0)return this.#A;let e=this.name,t=this.parent;if(!t)return this.#A=this.name;let r=t.relative();return r+(!r||!t.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#b!==void 0)return this.#b;let e=this.name,t=this.parent;if(!t)return this.#b=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#b=i}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#S=`//?/${i}`:this.#S=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#S=r}isUnknown(){return(this.#o&On)===Pn}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#o&On)===mC}isDirectory(){return(this.#o&On)===Li}isCharacterDevice(){return(this.#o&On)===dC}isBlockDevice(){return(this.#o&On)===pC}isFIFO(){return(this.#o&On)===hC}isSocket(){return(this.#o&On)===gC}isSymbolicLink(){return(this.#o&Da)===Da}lstatCached(){return this.#o&sC?this:void 0}readlinkCached(){return this.#x}realpathCached(){return this.#P}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#x)return!0;if(!this.parent)return!1;let e=this.#o&On;return!(e!==Pn&&e!==Da||this.#o&qd||this.#o&ci)}calledReaddir(){return!!(this.#o&X2)}isENOENT(){return!!(this.#o&ci)}isNamed(e){return this.nocase?this.#_===Gd(e):this.#_===Yl(e)}async readlink(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=await this.#e.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(t);if(r)return this.#x=r}catch(t){this.#d(t.code);return}}readlinkSync(){let e=this.#x;if(e)return e;if(this.canReadlink()&&this.parent)try{let t=this.#e.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(t);if(r)return this.#x=r}catch(t){this.#d(t.code);return}}#N(e){this.#o|=X2;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#L()}}#L(){this.#o&ci||(this.#o=(this.#o|ci)&Hl,this.#I())}#I(){let e=this.children();e.provisional=0;for(let t of e)t.#L()}#O(){this.#o|=Wd,this.#k()}#k(){if(this.#o&Ql)return;let e=this.#o;(e&On)===Li&&(e&=Hl),this.#o=e|Ql,this.#I()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#L():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#L()}#d(e=""){let t=this.#o;t|=qd,e==="ENOENT"&&(t|=ci),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Hl),this.#o=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#R(e,t)||this.#V(e,t)}#V(e,t){let r=J2(e),i=this.newChild(e.name,r,{parent:this}),s=i.#o&On;return s!==Li&&s!==Da&&s!==Pn&&(i.#o|=Ql),t.unshift(i),t.provisional++,i}#R(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Gd(e.name):Yl(e.name))===i.#_)return this.#U(e,i,r,t)}}#U(e,t,r,i){let s=t.name;return t.#o=t.#o&Hl|J2(e),s!==e.name&&(t.name=e.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(t)),i.provisional++,t}async lstat(){if((this.#o&ci)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#o&ci)===0)try{return this.#W(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#j(e.code)}}#W(e){let{atime:t,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:a,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:h,ino:d,mode:p,mtime:_,mtimeMs:b,nlink:E,rdev:A,size:C,uid:j}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=a,this.#a=c,this.#E=l,this.#h=u,this.#n=f,this.#v=h,this.#s=d,this.#r=p,this.#f=_,this.#g=b,this.#t=E,this.#i=A,this.#l=C,this.#c=j;let G=J2(e);this.#o=this.#o&Hl|G|sC,G!==Pn&&G!==Li&&G!==Da&&(this.#o|=Ql)}#q=[];#G=!1;#H(e){this.#G=!1;let t=this.#q.slice();this.#q.length=0,t.forEach(r=>r(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);t?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#q.push(e),this.#G)return;this.#G=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,a)=>{if(s)this.#M(s.code),r.provisional=0;else{for(let c of a)this.#$(c,r);this.#N(r)}this.#H(r.slice(0,r.provisional))})}#B;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#B)await this.#B;else{let r=o(()=>{},"resolve");this.#B=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#N(e)}catch(i){this.#M(i.code),e.provisional=0}this.#B=void 0,r()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let r of this.#e.readdirSync(t,{withFileTypes:!0}))this.#$(r,e);this.#N(e)}catch(r){this.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#o&aC)return!1;let e=On&this.#o;return e===Pn||e===Li||e===Da}shouldWalk(e,t){return(this.#o&Li)===Li&&!(this.#o&aC)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#P)return this.#P;if(!((Wd|qd|ci)&this.#o))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#P=this.resolve(e)}catch{this.#O()}}realpathSync(){if(this.#P)return this.#P;if(!((Wd|qd|ci)&this.#o))try{let e=this.#e.realpathSync(this.fullpath());return this.#P=this.resolve(e)}catch{this.#O()}}[yC](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),r=[],i=this;for(;i&&i.parent;)t.add(i),i.#A=r.join(this.sep),i.#C=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#A=void 0,i.#C=void 0,i=i.parent}},zd=class n extends Tr{static{o(this,"PathWin32")}sep="\\";splitSep=WV;constructor(e,t=Pn,r,i,s,a,c){super(e,t,r,i,s,a,c)}newChild(e,t=Pn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return fc.win32.parse(e).root}getRoot(e){if(e=GV(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,r]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=r;return this.roots[e]=new hc(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(fC,"$1\\"),e===t}},Qd=class n extends Tr{static{o(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=Pn,r,i,s,a,c){super(e,t,r,i,s,a,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=Pn,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Yd=class{static{o(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:a=zl}={}){this.#t=uC(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,lC.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new Hd,this.#n=new Hd,this.#r=new Z2(s);let l=c.substring(this.rootPath.length).split(r);if(l.length===1&&!l[0]&&l.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let u=this.root,f=l.length-1,h=t.sep,d=this.rootPath,p=!1;for(let _ of l){let b=f--;u=u.child(_,{relative:new Array(b).fill("..").join(h),relativePosix:new Array(b).fill("..").join("/"),fullpath:d+=(p?"":h)+_}),p=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#r}resolve(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#e.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpath();return this.#e.set(t,i),i}resolvePosix(...e){let t="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(t=t?`${a}/${t}`:a,this.isAbsolute(a)))break}let r=this.#n.get(t);if(r!==void 0)return r;let i=this.cwd.resolve(t).fullpathPosix();return this.#n.set(t,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r}=t;if(e.canReaddir()){let i=await e.readdir();return r?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0}=t;return e.canReaddir()?r?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=await e.readlink();return t?r:r?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=e.readlinkSync();return t?r:r?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=await e.realpath();return t?r:r?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e.withFileTypes,e=this.cwd);let r=e.realpathSync();return t?r:r?.fullpath()}async walk(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=o((h,d)=>{l.add(h),h.readdirCB((p,_)=>{if(p)return d(p);let b=_.length;if(!b)return d();let E=o(()=>{--b===0&&d()},"next");for(let A of _)(!s||s(A))&&c.push(r?A:A.fullpath()),i&&A.isSymbolicLink()?A.realpath().then(C=>C?.isUnknown()?C.lstat():C).then(C=>C?.shouldWalk(l,a)?u(C,E):E()):A.shouldWalk(l,a)?u(A,E):E()},!0)},"walk"),f=e;return new Promise((h,d)=>{u(f,p=>{if(p)return d(p);h(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set([e]);for(let u of l){let f=u.readdirSync();for(let h of f){(!s||s(h))&&c.push(r?h:h.fullpath());let d=h;if(h.isSymbolicLink()){if(!(i&&(d=h.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(l,a)&&l.add(d)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t;(!s||s(e))&&(yield r?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let f of u){(!s||s(f))&&(yield r?f:f.fullpath());let h=f;if(f.isSymbolicLink()){if(!(i&&(h=f.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(c,a)&&c.add(h)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ns({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let _=o((E,A,C=!1)=>{if(E)return c.emit("error",E);if(i&&!C){let j=[];for(let G of A)G.isSymbolicLink()&&j.push(G.realpath().then(Q=>Q?.isUnknown()?Q.lstat():Q));if(j.length){Promise.all(j).then(()=>_(null,A,!0));return}}for(let j of A)j&&(!s||s(j))&&(c.write(r?j:j.fullpath())||(d=!0));f--;for(let j of A){let G=j.realpathCached()||j;G.shouldWalk(l,a)&&u.push(G)}d&&!c.flowing?c.once("drain",h):b||h()},"onReaddir"),b=!0;p.readdirCB(_,!0),b=!1}},"process");return h(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof Tr||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:a}=t,c=new Ns({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,h=o(()=>{let d=!1;for(;!d;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let _=p.readdirSync();for(let b of _)(!s||s(b))&&(c.write(r?b:b.fullpath())||(d=!0));f--;for(let b of _){let E=b;if(b.isSymbolicLink()){if(!(i&&(E=b.realpathSync())))continue;E.isUnknown()&&E.lstatSync()}E.shouldWalk(l,a)&&u.push(E)}}d&&!c.flowing&&c.once("drain",h)},"process");return h(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[yC](t)}},hc=class extends Yd{static{o(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,fc.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return fc.win32.parse(e).root.toUpperCase()}newRoot(e){return new zd(this.rootPath,Li,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},dc=class extends Yd{static{o(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,fc.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new Qd(this.rootPath,Li,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Kl=class extends dc{static{o(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},Vre=process.platform==="win32"?zd:Qd,vC=process.platform==="win32"?hc:process.platform==="darwin"?Kl:dc;var zV=o(n=>n.length>=1,"isPatternList"),QV=o(n=>n.length>=1,"isGlobList"),pc=class n{static{o(this,"Pattern")}#e;#n;#r;length;#t;#c;#v;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!zV(e))throw new TypeError("empty pattern list");if(!QV(t))throw new TypeError("empty glob list");if(t.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,r<0||r>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#n=t,this.#r=r,this.#t=i,this.#r===0){if(this.isUNC()){let[s,a,c,l,...u]=this.#e,[f,h,d,p,..._]=this.#n;u[0]===""&&(u.shift(),_.shift());let b=[s,a,c,l,""].join("/"),E=[f,h,d,p,""].join("/");this.#e=[b,...u],this.#n=[E,..._],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[c,...l]=this.#n;a[0]===""&&(a.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...a],this.#n=[f,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#r]}isString(){return typeof this.#e[this.#r]=="string"}isGlobstar(){return this.#e[this.#r]===It}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#v=this.#v||(this.#r===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#r).join("/"))}hasMore(){return this.length>this.#r+1}rest(){return this.#c!==void 0?this.#c:this.hasMore()?(this.#c=new n(this.#e,this.#n,this.#r+1,this.#t),this.#c.#s=this.#s,this.#c.#u=this.#u,this.#c.#i=this.#i,this.#c):this.#c=null}isUNC(){let e=this.#e;return this.#u!==void 0?this.#u:this.#u=this.#t==="win32"&&this.#r===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#i!==void 0?this.#i:this.#i=this.#t==="win32"&&this.#r===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#s!==void 0?this.#s:this.#s=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#r===0?e:""}checkFollowGlobstar(){return!(this.#r===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#r===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var YV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",mc=class{static{o(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:a=YV}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new cn(e,this.mmopts);for(let r=0;r<t.set.length;r++){let i=t.set[r],s=t.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let a=new pc(i,s,0,this.platform),c=new cn(a.globString(),this.mmopts),l=s[s.length-1]==="**",u=a.isAbsolute();u?this.absolute.push(c):this.relative.push(c),l&&(u?this.absoluteChildren.push(c):this.relativeChildren.push(c))}}ignored(e){let t=e.fullpath(),r=`${t}/`,i=e.relative()||".",s=`${i}/`;for(let a of this.relative)if(a.match(i)||a.match(s))return!0;for(let a of this.absolute)if(a.match(t)||a.match(r))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",r=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(t))return!0;return!1}};var ev=class n{static{o(this,"HasWalkedCache")}store;constructor(e=new Map){this.store=e}copy(){return new n(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let r=e.fullpath(),i=this.store.get(r);i?i.add(t.globString()):this.store.set(r,new Set([t.globString()]))}},tv=class{static{o(this,"MatchRecord")}store=new Map;add(e,t,r){let i=(t?2:0)|(r?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},rv=class{static{o(this,"SubWalks")}store=new Map;add(e,t){if(!e.canReaddir())return;let r=this.store.get(e);r?r.find(i=>i.globString()===t.globString())||r.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw new Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Xl=class n{static{o(this,"Processor")}hasWalkedCache;matches=new tv;subwalks=new rv;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new ev}processPatterns(e,t){this.patterns=t;let r=t.map(i=>[e,i]);for(let[i,s]of r){this.hasWalkedCache.storeWalked(i,s);let a=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(a){i=i.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let h=s.rest();if(h)s=h;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let l,u,f=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)i=i.resolve(l),s=u,f=!0;if(l=s.pattern(),u=s.rest(),f){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof l=="string"){let h=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,h);continue}else if(l===It){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let h=u?.pattern(),d=u?.rest();if(!u||(h===""||h===".")&&!d)this.matches.add(i,c,h===""||h===".");else if(h===".."){let p=i.parent||i;d?this.hasWalkedCache.hasWalked(p,d)||this.subwalks.add(p,d):this.matches.add(p,c,!0)}}else l instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(e,t){let r=this.subwalks.get(e),i=this.child();for(let s of t)for(let a of r){let c=a.isAbsolute(),l=a.pattern(),u=a.rest();l===It?i.testGlobstar(s,a,u,c):l instanceof RegExp?i.testRegExp(s,l,u,c):i.testString(s,l,u,c)}return i}testGlobstar(e,t,r,i){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(r&&t.checkFollowGlobstar()?this.subwalks.add(e,r):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),r){let s=r.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,r.rest(),i);else if(s===".."){let a=e.parent||e;this.subwalks.add(a,r)}else s instanceof RegExp&&this.testRegExp(e,s,r.rest(),i)}}testRegExp(e,t,r,i){t.test(e.name)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}testString(e,t,r,i){e.isNamed(t)&&(r?this.subwalks.add(e,r):this.matches.add(e,i,!1))}};var KV=o((n,e)=>typeof n=="string"?new mc([n],e):Array.isArray(n)?new mc(n,e):n,"makeIgnore"),Kd=class{static{o(this,"GlobUtil")}path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#n;#r;signal;maxDepth;includeChildMatches;constructor(e,t,r){if(this.patterns=e,this.path=t,this.opts=r,this.#r=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#n=KV(r.ignore??[],r),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(e){return this.seen.has(e)||!!this.#n?.ignored?.(e)}#c(e){return!!this.#n?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=await s.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(s,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#t(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=s.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(s,t)}matchFinish(e,t){if(this.#t(e))return;if(!this.includeChildMatches&&this.#n?.add){let s=`${e.relativePosix()}/**`;this.#n.add(s)}let r=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#r:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(r){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?a+s+i:"."+i)}}async match(e,t,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,t)}matchSync(e,t,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,t)}walkCB(e,t,r){this.signal?.aborted&&r(),this.walkCB2(e,t,new Xl(this.opts),r)}walkCB2(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirCached();c.calledReaddir()?this.walkCB3(c,l,r,a):c.readdirCB((u,f)=>this.walkCB3(c,f,r,a),!0)}a()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>a()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),a);a()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Xl(this.opts),r)}walkCB2Sync(e,t,r,i){if(this.#c(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,r,i));return}r.processPatterns(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let c of r.subwalkTargets()){if(this.maxDepth!==1/0&&c.depth()>=this.maxDepth)continue;s++;let l=c.readdirSync();this.walkCB3Sync(c,l,r,a)}a()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,a=o(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||this.matchSync(c,l,u);for(let[c,l]of r.subwalks.entries())s++,this.walkCB2Sync(c,l,r.child(),a);a()}},Jl=class extends Kd{static{o(this,"GlobWalker")}matches=new Set;constructor(e,t,r){super(e,t,r)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Zl=class extends Kd{static{o(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Ns({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var XV=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",li=class{static{o(this,"Glob")}absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw new TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,_C.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth=="number"?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=t.platform||XV,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=t.platform==="win32"?hc:t.platform==="darwin"?Kl:t.platform?dc:vC;this.scurry=new l(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(l=>new cn(l,i)),[a,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new pc(l,f,0,this.platform)})}async walk(){return[...await new Jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new Jl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Zl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Zl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var nv=o((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new cn(t,e).hasMagic())return!0;return!1},"hasMagic");function Jd(n,e={}){return new li(n,e).streamSync()}o(Jd,"globStreamSync");function SC(n,e={}){return new li(n,e).stream()}o(SC,"globStream");function wC(n,e={}){return new li(n,e).walkSync()}o(wC,"globSync");async function bC(n,e={}){return new li(n,e).walk()}o(bC,"glob_");function Zd(n,e={}){return new li(n,e).iterateSync()}o(Zd,"globIterateSync");function EC(n,e={}){return new li(n,e).iterate()}o(EC,"globIterate");var JV=Jd,ZV=Object.assign(SC,{sync:Jd}),eU=Zd,tU=Object.assign(EC,{sync:Zd}),rU=Object.assign(wC,{stream:Jd,iterate:Zd}),Xd=Object.assign(bC,{glob:bC,globSync:wC,sync:rU,globStream:SC,stream:ZV,globStreamSync:Jd,streamSync:JV,globIterate:EC,iterate:tU,globIterateSync:Zd,iterateSync:eU,Glob:li,hasMagic:nv,escape:ac,unescape:ai});Xd.glob=Xd;var Na=X(ar());var Mi=class{constructor(e){this.rootPath=e}static{o(this,"NodeFsAdapter")}async readFile(e){let t=this.resolvePath(e);if(!await Ut.default.pathExists(t))throw new Na.FileNotFoundError(e);return Ut.default.readFile(t,"utf-8")}async fileExists(e){let t=this.resolvePath(e);return Ut.default.pathExists(t)}async getFileMetadata(e){let t=await this.readFile(e);return this.extractFrontmatter(t)}async createFile(e,t){let r=this.resolvePath(e);if(await Ut.default.pathExists(r))throw new Na.FileAlreadyExistsError(e);return await Ut.default.ensureDir(ks.default.dirname(r)),await Ut.default.writeFile(r,t,"utf-8"),e}async updateFile(e,t){let r=this.resolvePath(e);if(!await Ut.default.pathExists(r))throw new Na.FileNotFoundError(e);await Ut.default.writeFile(r,t,"utf-8")}async writeFile(e,t){let r=this.resolvePath(e);await Ut.default.ensureDir(ks.default.dirname(r)),await Ut.default.writeFile(r,t,"utf-8")}async deleteFile(e){let t=this.resolvePath(e);if(!await Ut.default.pathExists(t))throw new Na.FileNotFoundError(e);await Ut.default.remove(t)}async renameFile(e,t){let r=this.resolvePath(e),i=this.resolvePath(t);if(!await Ut.default.pathExists(r))throw new Na.FileNotFoundError(e);await Ut.default.ensureDir(ks.default.dirname(i)),await Ut.default.move(r,i)}async createDirectory(e){let t=this.resolvePath(e);await Ut.default.ensureDir(t)}async directoryExists(e){let t=this.resolvePath(e);return await Ut.default.pathExists(t)?(await Ut.default.stat(t)).isDirectory():!1}async getMarkdownFiles(e){let t=e?this.resolvePath(e):this.rootPath,r=ks.default.join(t,"**/*.md");return(await Xd(r,{nodir:!0})).map(a=>ks.default.relative(this.rootPath,a))}async findFilesByMetadata(e){let t=await this.getMarkdownFiles(),r=[];for(let i of t)try{let s=await this.getFileMetadata(i);this.matchesQuery(s,e)&&r.push(i)}catch{continue}return r}async findFileByUID(e){let t=await this.findFilesByMetadata({exo__Asset_uid:e});return t.length>0?t[0]:null}resolvePath(e){return ks.default.isAbsolute(e)?e:ks.default.join(this.rootPath,e)}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return{};try{let i=xl.load(r[1]);return typeof i=="object"&&i!==null?i:{}}catch{return{}}}matchesQuery(e,t){for(let[r,i]of Object.entries(t)){let s=e[r];if(Array.isArray(s)){if(!s.some(a=>this.normalizeValue(a)===this.normalizeValue(i)))return!1}else if(this.normalizeValue(s)!==this.normalizeValue(i))return!1}return!0}normalizeValue(e){return e==null?"":String(e).replace(/["'[\]]/g,"").trim()}};var eu=X(require("path")),iv=X(Os());var gc=class{constructor(e){this.vaultRoot=e}static{o(this,"PathResolver")}resolve(e){if(!eu.default.isAbsolute(e))return eu.default.resolve(this.vaultRoot,e);let t=eu.default.resolve(e),r=eu.default.resolve(this.vaultRoot);if(!t.startsWith(r))throw new Be(`File path ${e} is outside vault root ${this.vaultRoot}`,"Provide a file path within the vault directory.",{filepath:e,vaultRoot:this.vaultRoot});return t}validate(e){if(!iv.default.existsSync(e))throw new Al(e);if(!iv.default.statSync(e).isFile())throw new Be(`Not a file: ${e}`,"Provide a path to a file, not a directory.",{filepath:e});if(!e.endsWith(".md"))throw new Be(`Not a Markdown file: ${e}`,"Provide a path to a .md file.",{filepath:e})}getVaultRoot(){return this.vaultRoot}};var OC=X(ar());var TC=X(ar());var ui=class{static{o(this,"BaseCommandExecutor")}constructor(e){this.pathResolver=e.pathResolver,this.fsAdapter=e.fsAdapter,this.frontmatterService=e.frontmatterService,this.dryRun=e.dryRun}resolveAndValidate(e){let t=this.pathResolver.resolve(e);this.pathResolver.validate(t);let r=t.replace(this.pathResolver.getVaultRoot()+"/","");return{resolvedPath:t,relativePath:r}}getCurrentTimestamp(){return TC.DateFormatter.toLocalTimestamp(new Date)}isAssetArchived(e){if(e?.exo__Asset_isArchived===!0)return!0;let t=e?.archived;if(t==null)return!1;if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){let r=t.toLowerCase().trim();return r==="true"||r==="yes"||r==="1"}return!1}extractAliasesFromFrontmatter(e){let t=e.match(/aliases:\s*\n((?: - .*\n?)*)/);return t?t[1].split(`
|
|
542
542
|
`).filter(i=>i.trim()).map(i=>i.replace(/^\s*-\s*/,"").trim()):[]}};var tu=class extends ui{static{o(this,"StatusCommandExecutor")}constructor(e){super(e)}async executeStart(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDoing]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_startTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Started: ${e}`),console.log(" Status: Doing"),console.log(` Start time: ${i}`),process.exit(0)}catch(t){W.handle(t)}}async executeComplete(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusDone]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_endTimestamp",i),s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Completed: ${e}`),console.log(" Status: Done"),console.log(` Completion time: ${i}`),process.exit(0)}catch(t){W.handle(t)}}async executeTrash(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.getCurrentTimestamp(),s=this.frontmatterService.updateProperty(r,"ems__Effort_status",'"[[ems__EffortStatusTrashed]]"');s=this.frontmatterService.updateProperty(s,"ems__Effort_resolutionTimestamp",i),await this.fsAdapter.updateFile(t,s),console.log(`\u2705 Trashed: ${e}`),console.log(" Status: Trashed"),console.log(` Resolution time: ${i}`),process.exit(0)}catch(t){W.handle(t)}}async executeArchive(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.readFile(t),i=this.frontmatterService.updateProperty(r,"archived","true");i=this.frontmatterService.removeProperty(i,"aliases"),await this.fsAdapter.updateFile(t,i),console.log(`\u2705 Archived: ${e}`),console.log(" Archived: true"),console.log(" Aliases removed"),process.exit(0)}catch(t){W.handle(t)}}async executeMoveToBacklog(e){try{await this.updateStatus(e,"ems__EffortStatusBacklog","Backlog"),process.exit(0)}catch(t){W.handle(t)}}async executeMoveToAnalysis(e){try{await this.updateStatus(e,"ems__EffortStatusAnalysis","Analysis"),process.exit(0)}catch(t){W.handle(t)}}async executeMoveToToDo(e){try{await this.updateStatus(e,"ems__EffortStatusToDo","ToDo"),process.exit(0)}catch(t){W.handle(t)}}async updateStatus(e,t,r){let{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"ems__Effort_status",`"[[${t}]]"`);await this.fsAdapter.updateFile(i,a),console.log(`\u2705 Moved to ${r}: ${e}`),console.log(` Status: ${r}`)}};var fr=[];for(let n=0;n<256;++n)fr.push((n+256).toString(16).slice(1));function xC(n,e=0){return(fr[n[e+0]]+fr[n[e+1]]+fr[n[e+2]]+fr[n[e+3]]+"-"+fr[n[e+4]]+fr[n[e+5]]+"-"+fr[n[e+6]]+fr[n[e+7]]+"-"+fr[n[e+8]]+fr[n[e+9]]+"-"+fr[n[e+10]]+fr[n[e+11]]+fr[n[e+12]]+fr[n[e+13]]+fr[n[e+14]]+fr[n[e+15]]).toLowerCase()}o(xC,"unsafeStringify");var AC=require("node:crypto");var tp=new Uint8Array(256),ep=tp.length;function sv(){return ep>tp.length-16&&((0,AC.randomFillSync)(tp),ep=0),tp.slice(ep,ep+=16)}o(sv,"rng");var CC=require("node:crypto"),av={randomUUID:CC.randomUUID};function iU(n,e,t){n=n||{};let r=n.random??n.rng?.()??sv();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=r[i];return e}return xC(r)}o(iU,"_v4");function sU(n,e,t){return av.randomUUID&&!e&&!n?av.randomUUID():iU(n,e,t)}o(sU,"v4");var ru=sU;var yc=X(ar());var nu=class extends ui{static{o(this,"AssetCreationExecutor")}constructor(e){super(e)}async executeCreateTask(e,t,r={}){try{await this.createAsset(e,t,"ems__Task",r),process.exit(0)}catch(i){W.handle(i)}}async executeCreateMeeting(e,t,r={}){try{await this.createAsset(e,t,"ems__Meeting",r),process.exit(0)}catch(i){W.handle(i)}}async executeCreateProject(e,t,r={}){try{await this.createAsset(e,t,"ems__Project",r),process.exit(0)}catch(i){W.handle(i)}}async executeCreateArea(e,t,r={}){try{await this.createAsset(e,t,"ems__Area",r),process.exit(0)}catch(i){W.handle(i)}}async createAsset(e,t,r,i={}){if(!t||t.trim().length===0)throw new Error("Label cannot be empty");let s=t.trim(),{relativePath:a}=this.resolveAndValidate(e);if(await this.fsAdapter.fileExists(a))throw new yc.FileAlreadyExistsError(e);let l=ru(),u=this.buildAssetFrontmatter(r,l,s,i),f=yc.MetadataHelpers.buildFileContent(u);await this.fsAdapter.createFile(a,f),console.log(`\u2705 Created ${this.getAssetTypeName(r)}: ${e}`),console.log(` UID: ${l}`),console.log(` Label: ${s}`),console.log(` Class: ${r}`)}buildAssetFrontmatter(e,t,r,i={}){let s=yc.DateFormatter.toLocalTimestamp(new Date),a={exo__Asset_isDefinedBy:'"[[Ontology/EMS]]"',exo__Asset_uid:t,exo__Asset_label:r,exo__Asset_createdAt:s,exo__Instance_class:[`"[[${e}]]"`],aliases:[r]};return(e==="ems__Task"||e==="ems__Project"||e==="ems__Meeting")&&(a.ems__Effort_status='"[[ems__EffortStatusDraft]]"'),i.prototype&&(a.ems__Effort_prototype=`"[[${i.prototype}]]"`),i.area&&(a.ems__Effort_area=`"[[${i.area}]]"`),i.parent&&(a.ems__Effort_parent=`"[[${i.parent}]]"`),a}getAssetTypeName(e){return{ems__Task:"task",ems__Meeting:"meeting",ems__Project:"project",ems__Area:"area"}[e]||"asset"}};var ov=X(require("path"));var IC=X(ar());var iu=class extends ui{static{o(this,"PropertyCommandExecutor")}constructor(e){super(e)}async executeRenameToUid(e){try{let{relativePath:t}=this.resolveAndValidate(e),r=await this.fsAdapter.getFileMetadata(t);if(!r.exo__Asset_uid)throw new Error("Asset missing exo__Asset_uid property");let i=ov.default.basename(t,".md"),s=r.exo__Asset_uid;if(i===s&&(console.log(`\u2705 Already renamed: ${e}`),console.log(` Current filename matches UID: ${s}.md`),process.exit(0)),!r.exo__Asset_label||r.exo__Asset_label.trim()===""){let l=await this.fsAdapter.readFile(t),u=this.frontmatterService.updateProperty(l,"exo__Asset_label",i),f=this.isAssetArchived(r),h=u;f||(h=this.frontmatterService.updateProperty(u,"aliases",`
|
|
543
543
|
- ${i}`)),await this.fsAdapter.updateFile(t,h),console.log(` Updated label: "${i}"`)}let a=ov.default.dirname(t),c=a!=="."?`${a}/${s}.md`:`${s}.md`;await this.fsAdapter.renameFile(t,c),console.log("\u2705 Renamed to UID format"),console.log(` Old: ${t}`),console.log(` New: ${c}`),process.exit(0)}catch(t){W.handle(t)}}async executeUpdateLabel(e,t){try{if(!t||t.trim().length===0)throw new Error("Label cannot be empty");let r=t.trim(),{relativePath:i}=this.resolveAndValidate(e),s=await this.fsAdapter.readFile(i),a=this.frontmatterService.updateProperty(s,"exo__Asset_label",r),c=this.frontmatterService.parse(a),l=this.extractAliasesFromFrontmatter(c.content);if(l.includes(r)||(l.length===0?a=this.frontmatterService.updateProperty(a,"aliases",`
|
|
544
544
|
- ${r}`):a=this.frontmatterService.updateProperty(a,"aliases",`${l.map(u=>`
|
|
@@ -556,7 +556,7 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
|
|
|
556
556
|
\u{1F4C2} No markdown files found in ${s}`);process.exit(0)}let l=c.map(A=>({command:"repair-folder",filepath:A})),u=e.progress!==!1&&t==="text",f=0;u&&console.log(`
|
|
557
557
|
\u{1F50D} Processing ${c.length} files in ${s}...`);let d=await new Ma(r,e.dryRun).executeBatch(l,!1),p=0,_=0,b=0;for(let A of d.results)if(A.success?A.changes?.moved?p++:_++:b++,u&&!e.dryRun){f++;let C=Math.round(f/c.length*100);process.stdout.write(`\r Processing ${f}/${c.length} (${C}%)...`)}u&&process.stdout.write("\r"+" ".repeat(60)+"\r");let E={...d,movedCount:p,alreadyCorrectCount:_,errorCount:b};cU(t,E),process.exit(E.success?0:5)}catch(r){W.handle(r)}})}o(MC,"batchRepairCommand");var sp=require("fs"),hi=require("path");function jC(){return new st("resolve").description("Resolve UUID to file path").argument("<uuid>","Full or partial UUID to resolve").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: uri|path|json (default: uri)","uri").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--partial","Match partial UUIDs (returns all matches)").action(async(n,e)=>{let t=e.output||"text";W.setFormat(t);try{let r=Date.now();if(!lU(n))throw new Be(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,hi.resolve)(e.vault);if(!(0,sp.existsSync)(i))throw new yt(i);let s=uU(i,n,e.partial??!1),a=Date.now()-r;if(s.length===0){if(t==="json"){let c=_e.error("VALIDATION_FILE_NOT_FOUND",`UUID not found: ${n}`,3,{context:{uuid:n}});console.log(JSON.stringify(c,null,2))}else console.error(`UUID not found: ${n}`);process.exit(1)}e.partial||s.length>1?hU(s,i,e.format,t,n,a):fU(s[0],i,e.format,t,n,a)}catch(r){W.handle(r)}})}o(jC,"resolveCommand");function lU(n){if(n.length<4)return!1;let e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t=/^[0-9a-f-]+$/i;return e.test(n)||t.test(n)}o(lU,"isValidUuidFormat");function uU(n,e,t){let r=[],i=e.toLowerCase();function s(a){let c=(0,sp.readdirSync)(a,{withFileTypes:!0});for(let l of c){let u=(0,hi.join)(a,l.name);if(l.isDirectory())!l.name.startsWith(".")&&l.name!=="node_modules"&&s(u);else if(l.isFile()&&l.name.endsWith(".md")){let f=l.name.toLowerCase();t?f.includes(i)&&r.push(u):(f.startsWith(i+".md")||f.startsWith(i+" ")||f.startsWith(i+"-"))&&r.push(u)}}}return o(s,"walk"),s(n),r}o(uU,"findFilesWithUuid");function $C(n){return`obsidian://vault/${encodeURI(n)}`}o($C,"pathToObsidianUri");function VC(n){let e=n.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);return e?e[1]:(0,hi.basename)(n,".md")}o(VC,"extractUuidFromFilename");function fU(n,e,t,r,i,s){let a=(0,hi.relative)(e,n),c=$C(a),l=VC((0,hi.basename)(n));if(r==="json"){let u={uuid:l,path:a,absolutePath:n,uri:c},f=_e.success(u,{durationMs:s,searchUuid:i});console.log(JSON.stringify(f,null,2))}else switch(t){case"path":console.log(n);break;case"json":console.log(JSON.stringify({uuid:l,path:a,absolutePath:n,uri:c},null,2));break;case"uri":default:console.log(c);break}}o(fU,"outputSingleResult");function hU(n,e,t,r,i,s){let a=n.map(c=>{let l=(0,hi.relative)(e,c),u=$C(l);return{uuid:VC((0,hi.basename)(c)),path:l,absolutePath:c,uri:u}});if(r==="json"){let c=_e.success({matches:a,count:a.length},{durationMs:s,searchUuid:i,itemCount:a.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of a)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(a,null,2));break;case"uri":default:for(let c of a)console.log(c.uri);break}}o(hU,"outputMultipleResults");var UC=require("fs"),BC=require("path"),Xr=X(ar());function qC(){return new st("ask").description("Ask a question in natural language about your vault").argument("<question>","Question in natural language (Russian or English)").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--format <type>","Output format: table|json","table").option("--output <type>","Response format: text|json (for MCP tools)","text").option("--show-query","Show the generated SPARQL query").option("--explain","Show explanation of the query conversion").action(async(n,e)=>{let t=e.output||"text";W.setFormat(t);try{let r=Date.now(),i=(0,BC.resolve)(e.vault);if(!(0,UC.existsSync)(i))throw new yt(i);let s=new Xr.NLToSPARQLService;t==="text"&&console.log(`\u{1F9E0} Analyzing question: "${n}"
|
|
558
558
|
`);let a=s.convert(n);e.showQuery&&t==="text"&&(console.log("\u{1F4DD} Generated SPARQL Query:"),console.log("\u2500".repeat(50)),console.log(a.query),console.log("\u2500".repeat(50)),console.log()),e.explain&&t==="text"&&(console.log(`\u{1F4D6} Explanation: ${a.explanation}`),console.log(`\u{1F3AF} Confidence: ${(a.confidence*100).toFixed(0)}%`),a.templateName&&console.log(`\u{1F4CB} Template: ${a.templateName}`),a.isFallback&&console.log("\u26A0\uFE0F Using fallback generic search query"),console.log()),t==="text"&&console.log(`\u{1F4E6} Loading vault: ${i}...`);let c=Date.now(),l=new an(i),f=await new Xr.NoteToRDFConverter(l).convertVault(),h=new Xr.InMemoryTripleStore;await h.addAll(f);let d=Date.now()-c;t==="text"&&console.log(`\u2705 Loaded ${f.length} triples in ${d}ms
|
|
559
|
-
`);let _=new Xr.SPARQLParser().parse(a.query),E=new Xr.AlgebraTranslator().translate(_);E=new Xr.AlgebraOptimizer().optimize(E);let C=Date.now(),G=await new Xr.QueryExecutor(h).executeAll(E),Q=Date.now()-C,H=Date.now()-r,ee=s.getSuggestions(n);if(t==="json"){let Se=G.map(ge=>ge.toJSON()),
|
|
559
|
+
`);let _=new Xr.SPARQLParser().parse(a.query),E=new Xr.AlgebraTranslator().translate(_);E=new Xr.AlgebraOptimizer().optimize(E);let C=Date.now(),G=await new Xr.QueryExecutor(h).executeAll(E),Q=Date.now()-C,H=Date.now()-r,ee=s.getSuggestions(n);if(t==="json"){let Se=G.map(ge=>ge.toJSON()),L={question:n,query:a.query,template:a.templateName,parameters:a.parameters,confidence:a.confidence,explanation:a.explanation,count:G.length,bindings:Se,suggestions:ee.length>0?ee:void 0},Y=_e.success(L,{durationMs:H,itemCount:G.length,loadDurationMs:d,execDurationMs:Q,triplesScanned:f.length});console.log(JSON.stringify(Y,null,2))}else{if(console.log(`\u2705 Found ${G.length} result(s) in ${Q}ms
|
|
560
560
|
`),G.length>0?dU(G,e.format):console.log("No results found."),ee.length>0){console.log(`
|
|
561
561
|
\u{1F4A1} Suggestions:`);for(let Se of ee)console.log(` \u2022 ${Se}`)}if(a.confidence<.6&&a.alternatives.length>0){console.log(`
|
|
562
562
|
\u{1F504} Alternative queries that might work better:`);for(let Se=0;Se<Math.min(2,a.alternatives.length);Se++)console.log(` ${Se+1}. ${a.alternatives[Se].split(`
|
|
@@ -596,14 +596,14 @@ Continue? (y/n): `,s=>{r.close(),i(s.toLowerCase()==="y"||s.toLowerCase()==="yes
|
|
|
596
596
|
}
|
|
597
597
|
GROUP BY ?property
|
|
598
598
|
ORDER BY DESC(?usageCount)
|
|
599
|
-
`;a=s.parse(p),c=new Xt.AlgebraTranslator,l=c.translate(a),u=new Xt.AlgebraOptimizer,l=u.optimize(l);let b=(await f.executeAll(l)).map(A=>{let C=A.get("property"),
|
|
599
|
+
`;a=s.parse(p),c=new Xt.AlgebraTranslator,l=c.translate(a),u=new Xt.AlgebraOptimizer,l=u.optimize(l);let b=(await f.executeAll(l)).map(A=>{let C=A.get("property"),j=A.get("usageCount");return{name:C?eI(C.toString()):"unknown",usageCount:j?parseInt(j.toString(),10):0}}),E={name:e,instanceCount:d,properties:b};if(r==="json"||t.format==="json"){let A=_e.success(E);console.log(JSON.stringify(A,null,2))}else{if(console.log(`\u{1F4CB} Class: ${e}
|
|
600
600
|
`),console.log(` Instances: ${d}`),console.log(` Properties: ${b.length}
|
|
601
601
|
`),b.length===0){console.log(" No properties found.");return}let A=Math.max(...b.map(C=>C.name.length),10);console.log(" \u250C"+"\u2500".repeat(A+2)+"\u252C"+"\u2500".repeat(10)+"\u2510"),console.log(" \u2502 "+"Property".padEnd(A)+" \u2502 "+"Usage".padEnd(8)+" \u2502"),console.log(" \u251C"+"\u2500".repeat(A+2)+"\u253C"+"\u2500".repeat(10)+"\u2524");for(let C of b)console.log(" \u2502 "+C.name.padEnd(A)+" \u2502 "+C.usageCount.toString().padStart(8)+" \u2502");console.log(" \u2514"+"\u2500".repeat(A+2)+"\u2534"+"\u2500".repeat(10)+"\u2518")}}o(yU,"showClassDetails");function eI(n){let e=n.replace(/^<|>$/g,""),t=e.lastIndexOf("#");if(t!==-1)return e.substring(t+1);let r=e.lastIndexOf("/");return r!==-1?e.substring(r+1):e}o(eI,"extractLocalName");var rI=require("path"),mv=require("fs"),nI=require("fs");var dv=class extends Error{static{o(this,"ClassNotFoundError")}constructor(e,t){let r=`Class '${e}' not found in vault`;t&&t.length>0&&(r+=`
|
|
602
|
-
Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},hp=class{constructor(e){this.fsAdapter=e;this.cache=new Map}static{o(this,"ClassResolverService")}async resolve(e,t){if(this.isUUID(t))return t;let r=await this.getOrBuildIndex(e),i=r.get(t);if(!i){let s=Array.from(r.keys()).filter(a=>!this.isUUID(a));throw new dv(t,s)}return i}async listClasses(e){let t=await this.getOrBuildIndex(e);return Array.from(t.keys())}async getOrBuildIndex(e){if(this.cache.has(e))return this.cache.get(e);let t=await this.buildIndex(e);return this.cache.set(e,t),t}async buildIndex(e){let t=new Map,r=await this.fsAdapter.getMarkdownFiles();for(let i of r)try{let s=await this.fsAdapter.getFileMetadata(i);if(!this.isClassDefinition(s))continue;let a=this.getBasename(i),c=s.exo__Asset_uid;if(!c&&this.isUUID(a)&&(c=a),!c)continue;let l=String(c);a&&t.set(a,l);let u=s.exo__Asset_label;u&&typeof u=="string"&&u!==a&&t.set(u,l)}catch{continue}return t}isClassDefinition(e){let t=e.exo__Instance_class;return t?(Array.isArray(t)?t:[t]).some(i=>{let s=String(i);return s.includes("ims__Class")||s.includes("exo__Class")}):!1}getBasename(e){let t=e.split("/");return t[t.length-1].replace(/\.md$/,"")}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};var pv=class extends Error{static{o(this,"WikilinkNotFoundError")}constructor(e,t){let r=t?`|${t}`:"";super(`Wikilink [[${e}${r}]] \u2014 file not found in vault`),this.name="WikilinkNotFoundError"}},dp=class{constructor(e){this.fsAdapter=e}static{o(this,"WikilinkValidator")}static{this.WIKILINK_PATTERN=/\[\[([^\]|]+)(?:\|[^\]]*)?]]/g}async validatePropertyValues(e){for(let[,t]of Object.entries(e))await this.validateValue(t)}async validateValue(e){let t=this.extractWikilinks(e);for(let r of t)await this.validateWikilink(r.uuid,r.label)}extractWikilinks(e){let t=[],r=/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]/g,i;for(;(i=r.exec(e))!==null;)t.push({uuid:i[1].trim(),label:i[2]?.trim()});return t}async validateWikilink(e,t){if(!this.looksLikeUUID(e))return;if(!await this.fsAdapter.fileExists(`${e}.md`)&&!await this.fsAdapter.findFileByUID(e))throw new pv(e,t)}looksLikeUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};var tI=X(ar());var vU="de20a3f1-7483-4714-ab28-b45f5cf02c76",_U="Asia/Almaty",pp=class{constructor(e,t,r){this.fsAdapter=e;this.classResolver=t;this.wikilinkValidator=r}static{o(this,"AssetCreationService")}async create(e){if(!e.label||e.label.trim().length===0)throw new Error("Label cannot be empty");let t=e.label.trim(),r=await this.classResolver.resolve(e.vault,e.classShortName);e.properties&&!e.skipWikilinkValidation&&await this.wikilinkValidator.validatePropertyValues(e.properties);let i=ru(),s=this.generateTimestamp(e.timezone),a=this.buildFrontmatter({assetUuid:i,classShortName:e.classShortName,classUuid:r,label:t,aliases:e.aliases,properties:e.properties,createdBy:e.createdBy||vU,timestamp:s}),c=tI.MetadataHelpers.buildFileContent(a,e.body),l=`01 Inbox/${i}.md`;return e.dryRun||await this.fsAdapter.createFile(l,c),{uuid:i,path:l,label:t,frontmatter:a}}buildFrontmatter(e){let t={};t.exo__Asset_uid=e.assetUuid,t.exo__Asset_label=e.label,t.exo__Asset_createdAt=e.timestamp,t.exo__Asset_createdBy=`"[[${e.createdBy}]]"`,t.exo__Instance_class=[`"[[${e.classUuid}|${e.classShortName}]]"`];let r=[e.label];if(e.aliases&&e.aliases.length>0)for(let i of e.aliases)r.includes(i)||r.push(i);if(t.aliases=r,e.properties)for(let[i,s]of Object.entries(e.properties))i==="exo__Asset_uid"||i==="exo__Asset_label"||i==="exo__Asset_createdAt"||i==="exo__Asset_createdBy"||i==="exo__Instance_class"||i==="aliases"||(t[i]=s);return t}generateTimestamp(e){let t=e||_U,r=new Date,s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(r),a=o(c=>s.find(l=>l.type===c)?.value||"00","get");return`${a("year")}-${a("month")}-${a("day")}T${a("hour")}:${a("minute")}:${a("second")}`}};function bU(n){if(!n||n.length===0)return{};let e={};for(let t of n){let r=t.indexOf("=");if(r===-1)throw new Error(`Invalid property format: "${t}". Expected "key=value" format.`);let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();if(!i)throw new Error(`Invalid property format: "${t}". Key cannot be empty.`);e[i]=s}return e}o(bU,"parseProperties");async function SU(n){if(n.bodyFile){if(!(0,mv.existsSync)(n.bodyFile))throw new Error(`Body file not found: ${n.bodyFile}`);return(0,nI.readFileSync)(n.bodyFile,"utf-8")}if(n.body==="-")return wU(3e4);if(n.body)return n.body}o(SU,"resolveBody");function wU(n){return new Promise((e,t)=>{let r=[],i=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.destroy(),t(new Error(`Stdin read timed out after ${n}ms. Ensure you pipe content to stdin or close the pipe.`))},n);process.stdin.on("data",s=>{r.push(s)}),process.stdin.on("end",()=>{clearTimeout(i),e(Buffer.concat(r).toString("utf-8"))}),process.stdin.on("error",s=>{clearTimeout(i),t(s)}),process.stdin.isTTY&&(clearTimeout(i),e("")),process.stdin.resume()})}o(wU,"readStdin");function iI(){return new st("create").description("Create a new vault asset with auto-generated UUID, timestamp, and frontmatter").requiredOption("--class <name>","Class short name (e.g. ztlk__PermanentNote) or UUID").requiredOption("--label <text>","Human-readable label for the asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--aliases <names...>","Additional aliases for the asset").option("--property <key=value...>","Property key-value pairs (repeatable)",EU,[]).option("--body <text>","Markdown body content (use '-' to read from stdin)").option("--body-file <path>","Read body content from file").option("--dry-run","Preview frontmatter without writing file").option("--created-by <uuid>","Creator UUID (defaults to ExoAssistant)").option("--timezone <tz>","Timezone for timestamps (defaults to Asia/Almaty)").option("--skip-wikilink-validation","Skip wikilink existence validation").action(async n=>{try{let e=(0,rI.resolve)(n.vault);if(!(0,mv.existsSync)(e))throw new yt(e);let t=bU(n.property),r=await SU(n);r&&(r=r.replace(/\\n/g,`
|
|
602
|
+
Available classes: ${t.join(", ")}`),super(r),this.name="ClassNotFoundError"}},hp=class{constructor(e){this.fsAdapter=e;this.cache=new Map}static{o(this,"ClassResolverService")}async resolve(e,t){if(this.isUUID(t))return t;let r=await this.getOrBuildIndex(e),i=r.get(t);if(!i){let s=Array.from(r.keys()).filter(a=>!this.isUUID(a));throw new dv(t,s)}return i}async listClasses(e){let t=await this.getOrBuildIndex(e);return Array.from(t.keys())}async getOrBuildIndex(e){if(this.cache.has(e))return this.cache.get(e);let t=await this.buildIndex(e);return this.cache.set(e,t),t}async buildIndex(e){let t=new Map,r=await this.fsAdapter.getMarkdownFiles();for(let i of r)try{let s=await this.fsAdapter.getFileMetadata(i);if(!this.isClassDefinition(s))continue;let a=this.getBasename(i),c=s.exo__Asset_uid;if(!c&&this.isUUID(a)&&(c=a),!c)continue;let l=String(c);a&&t.set(a,l);let u=s.exo__Asset_label;u&&typeof u=="string"&&u!==a&&t.set(u,l)}catch{continue}return t}isClassDefinition(e){let t=e.exo__Instance_class;return t?(Array.isArray(t)?t:[t]).some(i=>{let s=String(i);return s.includes("ims__Class")||s.includes("exo__Class")}):!1}getBasename(e){let t=e.split("/");return t[t.length-1].replace(/\.md$/,"")}isUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};var pv=class extends Error{static{o(this,"WikilinkNotFoundError")}constructor(e,t){let r=t?`|${t}`:"";super(`Wikilink [[${e}${r}]] \u2014 file not found in vault`),this.name="WikilinkNotFoundError"}},dp=class{constructor(e){this.fsAdapter=e}static{o(this,"WikilinkValidator")}static{this.WIKILINK_PATTERN=/\[\[([^\]|]+)(?:\|[^\]]*)?]]/g}async validatePropertyValues(e){for(let[,t]of Object.entries(e))await this.validateValue(t)}async validateValue(e){let t=this.extractWikilinks(e);for(let r of t)await this.validateWikilink(r.uuid,r.label)}extractWikilinks(e){let t=[],r=/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]/g,i;for(;(i=r.exec(e))!==null;)t.push({uuid:i[1].trim(),label:i[2]?.trim()});return t}async validateWikilink(e,t){if(!this.looksLikeUUID(e))return;if(!await this.fsAdapter.fileExists(`${e}.md`)&&!await this.fsAdapter.findFileByUID(e))throw new pv(e,t)}looksLikeUUID(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}};var tI=X(ar());var vU="de20a3f1-7483-4714-ab28-b45f5cf02c76",_U="Asia/Almaty",pp=class{constructor(e,t,r){this.fsAdapter=e;this.classResolver=t;this.wikilinkValidator=r}static{o(this,"AssetCreationService")}async create(e){if(!e.label||e.label.trim().length===0)throw new Error("Label cannot be empty");let t=e.label.trim(),r=await this.classResolver.resolve(e.vault,e.classShortName);e.properties&&!e.skipWikilinkValidation&&await this.wikilinkValidator.validatePropertyValues(e.properties);let i=ru(),s=this.generateTimestamp(e.timezone),a=this.buildFrontmatter({assetUuid:i,classShortName:e.classShortName,classUuid:r,label:t,aliases:e.aliases,properties:e.properties,createdBy:e.createdBy||vU,timestamp:s}),c=tI.MetadataHelpers.buildFileContent(a,e.body),l=`01 Inbox/${i}.md`;return e.dryRun||await this.fsAdapter.createFile(l,c),{uuid:i,path:l,label:t,frontmatter:a}}buildFrontmatter(e){let t={};t.exo__Asset_uid=e.assetUuid,t.exo__Asset_label=e.label,t.exo__Asset_createdAt=e.timestamp,t.exo__Asset_createdBy=`"[[${e.createdBy}]]"`,t.exo__Instance_class=[`"[[${e.classUuid}|${e.classShortName}]]"`];let r=[e.label];if(e.aliases&&e.aliases.length>0)for(let i of e.aliases)r.includes(i)||r.push(i);if(t.aliases=r,e.properties)for(let[i,s]of Object.entries(e.properties))i==="exo__Asset_uid"||i==="exo__Asset_label"||i==="exo__Asset_createdAt"||i==="exo__Asset_createdBy"||i==="exo__Instance_class"||i==="aliases"||(t[i]=this.formatPropertyValue(s));return t}formatPropertyValue(e){return e.includes("[[")?[e.startsWith('"')&&e.endsWith('"')?e:`"${e}"`]:e}generateTimestamp(e){let t=e||_U,r=new Date,s=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(r),a=o(c=>s.find(l=>l.type===c)?.value||"00","get");return`${a("year")}-${a("month")}-${a("day")}T${a("hour")}:${a("minute")}:${a("second")}`}};function bU(n){if(!n||n.length===0)return{};let e={};for(let t of n){let r=t.indexOf("=");if(r===-1)throw new Error(`Invalid property format: "${t}". Expected "key=value" format.`);let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();if(!i)throw new Error(`Invalid property format: "${t}". Key cannot be empty.`);e[i]=s}return e}o(bU,"parseProperties");async function SU(n){if(n.bodyFile){if(!(0,mv.existsSync)(n.bodyFile))throw new Error(`Body file not found: ${n.bodyFile}`);return(0,nI.readFileSync)(n.bodyFile,"utf-8")}if(n.body==="-")return wU(3e4);if(n.body)return n.body}o(SU,"resolveBody");function wU(n){return new Promise((e,t)=>{let r=[],i=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.destroy(),t(new Error(`Stdin read timed out after ${n}ms. Ensure you pipe content to stdin or close the pipe.`))},n);process.stdin.on("data",s=>{r.push(s)}),process.stdin.on("end",()=>{clearTimeout(i),e(Buffer.concat(r).toString("utf-8"))}),process.stdin.on("error",s=>{clearTimeout(i),t(s)}),process.stdin.isTTY&&(clearTimeout(i),e("")),process.stdin.resume()})}o(wU,"readStdin");function iI(){return new st("create").description("Create a new vault asset with auto-generated UUID, timestamp, and frontmatter").requiredOption("--class <name>","Class short name (e.g. ztlk__PermanentNote) or UUID").requiredOption("--label <text>","Human-readable label for the asset").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--aliases <names...>","Additional aliases for the asset").option("--property <key=value...>","Property key-value pairs (repeatable)",EU,[]).option("--body <text>","Markdown body content (use '-' to read from stdin)").option("--body-file <path>","Read body content from file").option("--dry-run","Preview frontmatter without writing file").option("--created-by <uuid>","Creator UUID (defaults to ExoAssistant)").option("--timezone <tz>","Timezone for timestamps (defaults to Asia/Almaty)").option("--skip-wikilink-validation","Skip wikilink existence validation").action(async n=>{try{let e=(0,rI.resolve)(n.vault);if(!(0,mv.existsSync)(e))throw new yt(e);let t=bU(n.property),r=await SU(n);r&&(r=r.replace(/\\n/g,`
|
|
603
603
|
`));let i=new Mi(e),s=new hp(i),a=new dp(i),l=await new pp(i,s,a).create({classShortName:n.class,label:n.label,aliases:n.aliases,properties:Object.keys(t).length>0?t:void 0,body:r,vault:e,dryRun:n.dryRun,createdBy:n.createdBy,timezone:n.timezone,skipWikilinkValidation:n.skipWikilinkValidation});if(n.dryRun){let f=TU(l.frontmatter,r);process.stderr.write(f+`
|
|
604
604
|
`)}let u={uuid:l.uuid,path:l.path,label:l.label};process.stdout.write(JSON.stringify(u)+`
|
|
605
605
|
`),process.exit(0)}catch(e){W.handle(e)}})}o(iI,"createCommand");function EU(n,e){return e.concat([n])}o(EU,"collect");function TU(n,e){let t=["--- DRY RUN PREVIEW ---","---"];for(let[r,i]of Object.entries(n))if(Array.isArray(i)){t.push(`${r}:`);for(let s of i)t.push(` - ${s}`)}else t.push(`${r}: ${i}`);return t.push("---"),e&&(t.push(""),t.push(e)),t.push("--- END PREVIEW ---"),t.join(`
|
|
606
|
-
`)}o(TU,"formatFrontmatterPreview");var un=new st;un.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("15.32.
|
|
606
|
+
`)}o(TU,"formatFrontmatterPreview");var un=new st;un.name("exocortex").description("CLI tool for Exocortex knowledge management system").version("15.32.4");var gv=un.command("sparql").description("SPARQL query execution and cache management");gv.addCommand(vA());gv.addCommand(wA());gv.addCommand(EA());un.addCommand(RC());un.addCommand(NC());un.addCommand(LC());un.addCommand(MC());un.addCommand(jC());un.addCommand(qC());un.addCommand(zC());un.addCommand(KC());un.addCommand(ZC());un.addCommand(iI());un.parse();
|
|
607
607
|
/*! Bundled license information:
|
|
608
608
|
|
|
609
609
|
reflect-metadata/Reflect.js:
|