@kitelev/exocortex-cli 16.96.13 → 16.96.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +40 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @kitelev/exocortex-cli v16.96.13
2
+ // @kitelev/exocortex-cli v16.96.15
3
3
  // CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
4
4
  // License: MIT
5
5
 
@@ -15,31 +15,31 @@ ${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),i
15
15
  - too many long flags`):new Error(`${c}
16
16
  - unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${n}'.`);return{shortFlag:e,longFlag:t}}a(ej,"splitOptionFlags");Ob.Option=Pb;Ob.DualOptions=Cb});var fI=w(uI=>{function tj(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let r=0;r<=n.length;r++)t[r]=[r];for(let r=0;r<=e.length;r++)t[0][r]=r;for(let r=1;r<=e.length;r++)for(let i=1;i<=n.length;i++){let s=1;n[i-1]===e[r-1]?s=0:s=1,t[i][r]=Math.min(t[i-1][r]+1,t[i][r-1]+1,t[i-1][r-1]+s),i>1&&r>1&&n[i-1]===e[r-2]&&n[i-2]===e[r-1]&&(t[i][r]=Math.min(t[i][r],t[i-2][r-2]+1))}return t[n.length][e.length]}a(tj,"editDistance");function rj(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(o=>o.slice(2)));let r=[],i=3,s=.4;return e.forEach(o=>{if(o.length<=1)return;let c=tj(n,o),l=Math.max(n.length,o.length);(l-c)/l>s&&(c<i?(i=c,r=[o]):c===i&&r.push(o))}),r.sort((o,c)=>o.localeCompare(c)),t&&(r=r.map(o=>`--${o}`)),r.length>1?`
17
17
  (Did you mean one of ${r.join(", ")}?)`:r.length===1?`
18
- (Did you mean ${r[0]}?)`:""}a(rj,"suggestSimilar");uI.suggestSimilar=rj});var mI=w(Mb=>{var nj=require("node:events").EventEmitter,Fb=require("node:child_process"),Xs=require("node:path"),jh=require("node:fs"),ft=require("node:process"),{Argument:ij,humanReadableArgName:sj}=Mh(),{CommanderError:Lb}=hf(),{Help:oj,stripColor:aj}=Rb(),{Option:dI,DualOptions:cj}=Db(),{suggestSimilar:hI}=fI(),Nb=class n extends nj{static{a(this,"Command")}constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:a(t=>ft.stdout.write(t),"writeOut"),writeErr:a(t=>ft.stderr.write(t),"writeErr"),outputError:a((t,r)=>r(t),"outputError"),getOutHelpWidth:a(()=>ft.stdout.isTTY?ft.stdout.columns:void 0,"getOutHelpWidth"),getErrHelpWidth:a(()=>ft.stderr.isTTY?ft.stderr.columns:void 0,"getErrHelpWidth"),getOutHasColors:a(()=>kb()??(ft.stdout.isTTY&&ft.stdout.hasColors?.()),"getOutHasColors"),getErrHasColors:a(()=>kb()??(ft.stderr.isTTY&&ft.stderr.hasColors?.()),"getErrHasColors"),stripColor:a(t=>aj(t),"stripColor")},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let i=t,s=r;typeof i=="object"&&i!==null&&(s=i,i=null),s=s||{};let[,o,c]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),s.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(s.noHelp||s.hidden),l._executableFile=s.executableFile||null,c&&l.arguments(c),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(e){return new n(e)}createHelp(){return Object.assign(new oj,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
18
+ (Did you mean ${r[0]}?)`:""}a(rj,"suggestSimilar");uI.suggestSimilar=rj});var mI=w(Mb=>{var nj=require("node:events").EventEmitter,Fb=require("node:child_process"),Ys=require("node:path"),jh=require("node:fs"),ft=require("node:process"),{Argument:ij,humanReadableArgName:sj}=Mh(),{CommanderError:Lb}=hf(),{Help:oj,stripColor:aj}=Rb(),{Option:dI,DualOptions:cj}=Db(),{suggestSimilar:hI}=fI(),Nb=class n extends nj{static{a(this,"Command")}constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:a(t=>ft.stdout.write(t),"writeOut"),writeErr:a(t=>ft.stderr.write(t),"writeErr"),outputError:a((t,r)=>r(t),"outputError"),getOutHelpWidth:a(()=>ft.stdout.isTTY?ft.stdout.columns:void 0,"getOutHelpWidth"),getErrHelpWidth:a(()=>ft.stderr.isTTY?ft.stderr.columns:void 0,"getErrHelpWidth"),getOutHasColors:a(()=>kb()??(ft.stdout.isTTY&&ft.stdout.hasColors?.()),"getOutHasColors"),getErrHasColors:a(()=>kb()??(ft.stderr.isTTY&&ft.stderr.hasColors?.()),"getErrHasColors"),stripColor:a(t=>aj(t),"stripColor")},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let i=t,s=r;typeof i=="object"&&i!==null&&(s=i,i=null),s=s||{};let[,o,c]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),s.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(s.noHelp||s.hidden),l._executableFile=s.executableFile||null,c&&l.arguments(c),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(e){return new n(e)}createHelp(){return Object.assign(new oj,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
19
19
  - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ij(e,t)}argument(e,t,r,i){let s=this.createArgument(e,t);return typeof r=="function"?s.default(i).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let r=e??"help [command]",[,i,s]=r.match(/([^ ]+) *(.*)/),o=t??"display help for command",c=this.createCommand(i);return c.helpOption(!1),s&&c.arguments(s),o&&c.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=c,(e||t)&&this._initCommandGroup(c),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
20
20
  Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new Lb(e,t,r)),ft.exit(e)}action(e){let t=a(r=>{let i=this.registeredArguments.length,s=r.slice(0,i);return this._storeOptionsAsProperties?s[i]=this:s[i]=this.opts(),s.push(this),e.apply(this,s)},"listener");return this._actionHandler=t,this}createOption(e,t){return new dI(e,t)}_callParseArg(e,t,r,i){try{return e.parseArg(t,r)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${i} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let r=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
21
21
  - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=a(i=>[i.name()].concat(i.aliases()),"knownBy"),r=t(e).find(i=>this._findCommand(i));if(r){let i=t(this._findCommand(r)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(r,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(r,e.defaultValue,"default");let i=a((s,o,c)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let l=this.getOptionValue(r);s!==null&&e.parseArg?s=this._callParseArg(e,s,l,o):s!==null&&e.variadic&&(s=e._collectValue(s,l)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(r,s,c)},"handleOptionValue");return this.on("option:"+t,s=>{let o=`error: option '${e.flags}' argument '${s}' is invalid.`;i(s,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let o=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;i(s,o,"env")}),this}_optionEx(e,t,r,i,s){if(typeof t=="object"&&t instanceof dI)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,r);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(s).argParser(i);else if(i instanceof RegExp){let c=i;i=a((l,u)=>{let f=c.exec(l);return f?f[0]:u},"fn"),o.default(s).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:!0},e,t,r,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(r=>{r.getOptionValueSource(e)!==void 0&&(t=r.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){ft.versions?.electron&&(t.from="electron");let i=ft.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=ft.argv),this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":ft.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
22
22
  - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,r){if(jh.existsSync(e))return;let i=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${e}' does not exist
23
23
  - if '${r}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
24
24
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
25
- - ${i}`;throw new Error(s)}_executeSubCommand(e,t){t=t.slice();let r=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function s(f,d){let h=Xs.resolve(f,d);if(jh.existsSync(h))return h;if(i.includes(Xs.extname(d)))return;let p=i.find(y=>jh.existsSync(`${h}${y}`));if(p)return`${h}${p}`}a(s,"findFile"),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,c=this._executableDir||"";if(this._scriptPath){let f;try{f=jh.realpathSync(this._scriptPath)}catch{f=this._scriptPath}c=Xs.resolve(Xs.dirname(f),c)}if(c){let f=s(c,o);if(!f&&!e._executableFile&&this._scriptPath){let d=Xs.basename(this._scriptPath,Xs.extname(this._scriptPath));d!==this._name&&(f=s(c,`${d}-${e._name}`))}o=f||o}r=i.includes(Xs.extname(o));let l;ft.platform!=="win32"?r?(t.unshift(o),t=pI(ft.execArgv).concat(t),l=Fb.spawn(ft.argv[0],t,{stdio:"inherit"})):l=Fb.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,c,e._name),t.unshift(o),t=pI(ft.execArgv).concat(t),l=Fb.spawn(ft.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{ft.on(d,()=>{l.killed===!1&&l.exitCode===null&&l.kill(d)})});let u=this._exitCallback;l.on("close",f=>{f=f??1,u?u(new Lb(f,"commander.executeSubCommandAsync","(close)")):ft.exit(f)}),l.on("error",f=>{if(f.code==="ENOENT")this._checkForMissingExecutable(o,c,e._name);else if(f.code==="EACCES")throw new Error(`'${o}' not executable`);if(!u)ft.exit(1);else{let d=new Lb(1,"commander.executeSubCommandAsync","(error)");d.nestedError=f,u(d)}}),this.runningCommand=l}_dispatchSubcommand(e,t,r){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,i,"preSubcommand"),s=this._chainOrCall(s,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(r));else return i._parseCommand(t,r)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=a((r,i,s)=>{let o=i;if(i!==null&&r.parseArg){let c=`error: command-argument value '${i}' is invalid for argument '${r.name()}'.`;o=this._callParseArg(r,i,s,c)}return o},"myParseArg");this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,i)=>{let s=r.defaultValue;r.variadic?i<this.args.length?(s=this.args.slice(i),r.parseArg&&(s=s.reduce((o,c)=>e(r,c,o),r.defaultValue))):s===void 0&&(s=[]):i<this.args.length&&(s=this.args[i],r.parseArg&&(s=e(r,s,r.defaultValue))),t[i]=s}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e,i=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:s,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(s=>{r=this._chainOrCall(r,()=>s.callback(s.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let i=e;return this._lifeCycleHooks[r]!==void 0&&this._lifeCycleHooks[r].forEach(s=>{i=this._chainOrCall(i,()=>s(this,t))}),i}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=a(()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},"checkForUnknownOptions"),s=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent?.listenerCount(s))i(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(r=>{let i=r.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(r=>r.conflictsWith.length>0).forEach(r=>{let i=e.find(s=>r.conflictsWith.includes(s.attributeName()));i&&this._conflictingOption(r,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],i=t;function s(f){return f.length>1&&f[0]==="-"}a(s,"maybeOption");let o=a(f=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(f)?!this._getCommandAndAncestors().some(d=>d.options.map(h=>h.short).some(h=>/^-\d$/.test(h))):!1,"negativeNumberArg"),c=null,l=null,u=0;for(;u<e.length||l;){let f=l??e[u++];if(l=null,f==="--"){i===r&&i.push(f),i.push(...e.slice(u));break}if(c&&(!s(f)||o(f))){this.emit(`option:${c.name()}`,f);continue}if(c=null,s(f)){let d=this._findOption(f);if(d){if(d.required){let h=e[u++];h===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,h)}else if(d.optional){let h=null;u<e.length&&(!s(e[u])||o(e[u]))&&(h=e[u++]),this.emit(`option:${d.name()}`,h)}else this.emit(`option:${d.name()}`);c=d.variadic?d:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let d=this._findOption(`-${f[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,f.slice(2)):(this.emit(`option:${d.name()}`),l=`-${f.slice(2)}`);continue}}if(/^--[^=]+=/.test(f)){let d=f.indexOf("="),h=this._findOption(f.slice(0,d));if(h&&(h.required||h.optional)){this.emit(`option:${h.name()}`,f.slice(d+1));continue}}if(i===t&&s(f)&&!(this.commands.length===0&&o(f))&&(i=r),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(f)){t.push(f),r.push(...e.slice(u));break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){t.push(f,...e.slice(u));break}else if(this._defaultCommandName){r.push(f,...e.slice(u));break}}if(this._passThroughOptions){i.push(f,...e.slice(u));break}i.push(f)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let i=this.options[r].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
25
+ - ${i}`;throw new Error(s)}_executeSubCommand(e,t){t=t.slice();let r=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function s(f,d){let h=Ys.resolve(f,d);if(jh.existsSync(h))return h;if(i.includes(Ys.extname(d)))return;let p=i.find(y=>jh.existsSync(`${h}${y}`));if(p)return`${h}${p}`}a(s,"findFile"),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,c=this._executableDir||"";if(this._scriptPath){let f;try{f=jh.realpathSync(this._scriptPath)}catch{f=this._scriptPath}c=Ys.resolve(Ys.dirname(f),c)}if(c){let f=s(c,o);if(!f&&!e._executableFile&&this._scriptPath){let d=Ys.basename(this._scriptPath,Ys.extname(this._scriptPath));d!==this._name&&(f=s(c,`${d}-${e._name}`))}o=f||o}r=i.includes(Ys.extname(o));let l;ft.platform!=="win32"?r?(t.unshift(o),t=pI(ft.execArgv).concat(t),l=Fb.spawn(ft.argv[0],t,{stdio:"inherit"})):l=Fb.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,c,e._name),t.unshift(o),t=pI(ft.execArgv).concat(t),l=Fb.spawn(ft.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{ft.on(d,()=>{l.killed===!1&&l.exitCode===null&&l.kill(d)})});let u=this._exitCallback;l.on("close",f=>{f=f??1,u?u(new Lb(f,"commander.executeSubCommandAsync","(close)")):ft.exit(f)}),l.on("error",f=>{if(f.code==="ENOENT")this._checkForMissingExecutable(o,c,e._name);else if(f.code==="EACCES")throw new Error(`'${o}' not executable`);if(!u)ft.exit(1);else{let d=new Lb(1,"commander.executeSubCommandAsync","(error)");d.nestedError=f,u(d)}}),this.runningCommand=l}_dispatchSubcommand(e,t,r){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,i,"preSubcommand"),s=this._chainOrCall(s,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(r));else return i._parseCommand(t,r)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=a((r,i,s)=>{let o=i;if(i!==null&&r.parseArg){let c=`error: command-argument value '${i}' is invalid for argument '${r.name()}'.`;o=this._callParseArg(r,i,s,c)}return o},"myParseArg");this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,i)=>{let s=r.defaultValue;r.variadic?i<this.args.length?(s=this.args.slice(i),r.parseArg&&(s=s.reduce((o,c)=>e(r,c,o),r.defaultValue))):s===void 0&&(s=[]):i<this.args.length&&(s=this.args[i],r.parseArg&&(s=e(r,s,r.defaultValue))),t[i]=s}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e,i=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:s,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(s=>{r=this._chainOrCall(r,()=>s.callback(s.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let i=e;return this._lifeCycleHooks[r]!==void 0&&this._lifeCycleHooks[r].forEach(s=>{i=this._chainOrCall(i,()=>s(this,t))}),i}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=a(()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},"checkForUnknownOptions"),s=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent?.listenerCount(s))i(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(r=>{let i=r.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(r=>r.conflictsWith.length>0).forEach(r=>{let i=e.find(s=>r.conflictsWith.includes(s.attributeName()));i&&this._conflictingOption(r,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],i=t;function s(f){return f.length>1&&f[0]==="-"}a(s,"maybeOption");let o=a(f=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(f)?!this._getCommandAndAncestors().some(d=>d.options.map(h=>h.short).some(h=>/^-\d$/.test(h))):!1,"negativeNumberArg"),c=null,l=null,u=0;for(;u<e.length||l;){let f=l??e[u++];if(l=null,f==="--"){i===r&&i.push(f),i.push(...e.slice(u));break}if(c&&(!s(f)||o(f))){this.emit(`option:${c.name()}`,f);continue}if(c=null,s(f)){let d=this._findOption(f);if(d){if(d.required){let h=e[u++];h===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,h)}else if(d.optional){let h=null;u<e.length&&(!s(e[u])||o(e[u]))&&(h=e[u++]),this.emit(`option:${d.name()}`,h)}else this.emit(`option:${d.name()}`);c=d.variadic?d:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let d=this._findOption(`-${f[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,f.slice(2)):(this.emit(`option:${d.name()}`),l=`-${f.slice(2)}`);continue}}if(/^--[^=]+=/.test(f)){let d=f.indexOf("="),h=this._findOption(f.slice(0,d));if(h&&(h.required||h.optional)){this.emit(`option:${h.name()}`,f.slice(d+1));continue}}if(i===t&&s(f)&&!(this.commands.length===0&&o(f))&&(i=r),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(f)){t.push(f),r.push(...e.slice(u));break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){t.push(f,...e.slice(u));break}else if(this._defaultCommandName){r.push(f,...e.slice(u));break}}if(this._passThroughOptions){i.push(f,...e.slice(u));break}i.push(f)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let i=this.options[r].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
26
26
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
27
27
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
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 ft.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()}`,ft.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new cj(this.options),t=a(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=a(o=>{let c=o.attributeName(),l=this.getOptionValue(c),u=this.options.find(d=>d.negate&&c===d.attributeName()),f=this.options.find(d=>!d.negate&&c===d.attributeName());return u&&(u.presetArg===void 0&&l===!1||u.presetArg!==void 0&&l===u.presetArg)?u:f||o},"findBestOptionFromValue"),i=a(o=>{let c=r(o),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 o=s.createHelp().visibleOptions(s).filter(c=>c.long).map(c=>c.long);i=i.concat(o),s=s.parent}while(s&&!s._enablePositionalOptions);t=hI(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=hI(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
- `),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=>sj(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=Xs.basename(e,Xs.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=a(c=>this._outputConfiguration.writeErr(c),"baseWrite"),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=a(c=>this._outputConfiguration.writeOut(c),"baseWrite"),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a(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(o=>o.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(o=>o.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(ft.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.
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=>sj(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=Ys.basename(e,Ys.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=a(c=>this._outputConfiguration.writeErr(c),"baseWrite"),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(r=a(c=>this._outputConfiguration.writeOut(c),"baseWrite"),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a(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(o=>o.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(o=>o.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(ft.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 o;typeof t=="function"?o=t({error:s.error,command:s.command}):o=t,o&&s.write(`${o}
31
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function pI(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})}a(pI,"incrementNodeInspectorPort");function kb(){if(ft.env.NO_COLOR||ft.env.FORCE_COLOR==="0"||ft.env.FORCE_COLOR==="false")return!1;if(ft.env.FORCE_COLOR||ft.env.CLICOLOR_FORCE!==void 0)return!0}a(kb,"useColor");Mb.Command=Nb;Mb.useColor=kb});var _I=w(ii=>{var{Argument:gI}=Mh(),{Command:jb}=mI(),{CommanderError:lj,InvalidArgumentError:yI}=hf(),{Help:uj}=Rb(),{Option:bI}=Db();ii.program=new jb;ii.createCommand=n=>new jb(n);ii.createOption=(n,e)=>new bI(n,e);ii.createArgument=(n,e)=>new gI(n,e);ii.Command=jb;ii.Option=bI;ii.Argument=gI;ii.Help=uj;ii.CommanderError=lj;ii.InvalidArgumentError=yI;ii.InvalidOptionArgumentError=yI});var Jc=w($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.AssetClass=void 0;var wI;(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.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.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition",n.COMMAND="exocmd__Command",n.PRECONDITION="exocmd__Precondition",n.GROUNDING="exocmd__Grounding",n.COMMAND_BINDING="exocmd__CommandBinding"})(wI||($h.AssetClass=wI={}))});var Zc=w(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.EffortStatus=void 0;var vI;(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"})(vI||(Uh.EffortStatus=vI={}))});var $b=w(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.EFFORT_STATUS_OPTIONS=void 0;Bh.EFFORT_STATUS_OPTIONS=[{value:"[[ems__EffortStatusDraft]]",label:"Draft"},{value:"[[ems__EffortStatusBacklog]]",label:"Backlog"},{value:"[[ems__EffortStatusAnalysis]]",label:"Analysis"},{value:"[[ems__EffortStatusToDo]]",label:"To Do"},{value:"[[ems__EffortStatusDoing]]",label:"Doing"},{value:"[[ems__EffortStatusDone]]",label:"Done"},{value:"[[ems__EffortStatusTrashed]]",label:"Trashed"}]});var Vo=w(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.GroundingType=void 0;var EI;(function(n){n.SPARQL_UPDATE="sparql_update",n.PROPERTY_DELETE="property_delete",n.PROPERTY_SET="property_set",n.COMPOSITE="composite",n.SERVICE_CALL="service_call",n.CREATE_INSTANCE="create_instance",n.PROPERTY_APPEND="property_append",n.PROPERTY_INCREMENT="property_increment",n.PROPERTY_SHIFT="property_shift",n.WORKFLOW_TRANSITION="workflow_transition"})(EI||(Vh.GroundingType=EI={}))});var pf=w(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.GROUNDING_TYPE_IRI_TO_ENUM=Cn.GROUNDING_TYPE_UID_TO_ENUM=Cn.GROUNDING_TYPE_UIDS=void 0;Cn.resolveGroundingTypeFromIRI=dj;Cn.resolveGroundingTypeFromWikilinkLiteral=hj;var ir=Vo();Cn.GROUNDING_TYPE_UIDS={[ir.GroundingType.PROPERTY_SET]:"cf3bb923-f1f1-40be-b728-782844402426",[ir.GroundingType.PROPERTY_DELETE]:"4bdf1d0b-e9da-4d96-bafe-c5aaef8c2bd5",[ir.GroundingType.COMPOSITE]:"8f9a57db-3865-4886-92fb-c5ab7f3c3fa3",[ir.GroundingType.SERVICE_CALL]:"9bf9fc99-ac37-4e51-b9f5-bd920099947c",[ir.GroundingType.CREATE_INSTANCE]:"4367e2d6-6c92-450a-becb-abce1fb07682",[ir.GroundingType.PROPERTY_APPEND]:"572f7e69-a8a1-42f6-8113-5aa65cc4b552",[ir.GroundingType.PROPERTY_INCREMENT]:"afc29f90-45eb-4f94-9fe2-2ce738759161",[ir.GroundingType.PROPERTY_SHIFT]:"f4e5266f-f3cc-49fd-a5a5-ce1e8b7847a4",[ir.GroundingType.SPARQL_UPDATE]:"79c3e709-8d1d-4694-bcc6-b9ff07d59b86",[ir.GroundingType.WORKFLOW_TRANSITION]:"5c1a2552-d576-496d-8823-563573dd1e2f"};Cn.GROUNDING_TYPE_UID_TO_ENUM=Object.freeze(Object.fromEntries(Object.entries(Cn.GROUNDING_TYPE_UIDS).map(([n,e])=>[e,n])));var ms="https://exocortex.my/ontology/exocmd#";Cn.GROUNDING_TYPE_IRI_TO_ENUM=Object.freeze({[`${ms}GroundingTypePropertySet`]:ir.GroundingType.PROPERTY_SET,[`${ms}GroundingTypePropertyDelete`]:ir.GroundingType.PROPERTY_DELETE,[`${ms}GroundingTypeComposite`]:ir.GroundingType.COMPOSITE,[`${ms}GroundingTypeServiceCall`]:ir.GroundingType.SERVICE_CALL,[`${ms}GroundingTypeCreateInstance`]:ir.GroundingType.CREATE_INSTANCE,[`${ms}GroundingTypePropertyAppend`]:ir.GroundingType.PROPERTY_APPEND,[`${ms}GroundingTypePropertyIncrement`]:ir.GroundingType.PROPERTY_INCREMENT,[`${ms}GroundingTypePropertyShift`]:ir.GroundingType.PROPERTY_SHIFT,[`${ms}GroundingTypeSparqlUpdate`]:ir.GroundingType.SPARQL_UPDATE,[`${ms}GroundingTypeWorkflowTransition`]:ir.GroundingType.WORKFLOW_TRANSITION});var fj=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;function dj(n){let e=Cn.GROUNDING_TYPE_IRI_TO_ENUM[n];if(e!==void 0)return e;let t=n.match(fj);return t?Cn.GROUNDING_TYPE_UID_TO_ENUM[t[1].toLowerCase()]??null:null}a(dj,"resolveGroundingTypeFromIRI");function hj(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?Cn.GROUNDING_TYPE_UID_TO_ENUM[e[1].toLowerCase()]??null:null}a(hj,"resolveGroundingTypeFromWikilinkLiteral")});var Ub=w(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.CommandBindingStyleProperty=si.CommandBindingProperty=si.GroundingProperty=si.PreconditionProperty=si.CommandProperty=void 0;si.CommandProperty={ICON:"exocmd__Command_icon",PRECONDITION:"exocmd__Command_precondition",GROUNDING:"exocmd__Command_grounding",CONFIRM_MESSAGE:"exocmd__Command_confirmMessage",SUCCESS_MESSAGE:"exocmd__Command_successMessage",CATEGORY:"exocmd__Command_category",OPEN_IN_SAME_TAB:"exocmd__Command_openInSameTab"};si.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};si.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",STEPS:"exocmd__Grounding_steps",IS_DEFINED_BY:"exocmd__Grounding_isDefinedBy",LABEL_TEMPLATE:"exocmd__Grounding_labelTemplate"};si.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};si.CommandBindingStyleProperty={VARIANT:"exocmd__CommandBindingStyle_variant",SHOW_ICON:"exocmd__CommandBindingStyle_showIcon",LABEL_CLASS:"exocmd__CommandBindingStyle_labelClass",ARIA_LABEL:"exocmd__CommandBindingStyle_ariaLabel",TOOLTIP:"exocmd__CommandBindingStyle_tooltip",KEYBOARD_SHORTCUT:"exocmd__CommandBindingStyle_keyboardShortcut",SOURCE:"exocmd__CommandBindingStyle_source"}});var Bb=w(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.STYLE_SOURCE_VALUES=On.LABEL_CLASS_VALUES=On.COMMAND_VARIANT_VALUES=void 0;On.isCommandVariant=pj;On.isLabelClass=mj;On.isStyleSource=gj;On.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);On.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);On.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function pj(n){return typeof n=="string"&&On.COMMAND_VARIANT_VALUES.includes(n)}a(pj,"isCommandVariant");function mj(n){return typeof n=="string"&&On.LABEL_CLASS_VALUES.includes(n)}a(mj,"isLabelClass");function gj(n){return typeof n=="string"&&On.STYLE_SOURCE_VALUES.includes(n)}a(gj,"isStyleSource")});var TI=w(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.isCommandFrontmatter=yj;el.isPreconditionFrontmatter=bj;el.isGroundingFrontmatter=_j;el.isCommandBindingFrontmatter=Sj;function yj(n){return Gh(n,"exocmd__Command")}a(yj,"isCommandFrontmatter");function bj(n){return Gh(n,"exocmd__Precondition")}a(bj,"isPreconditionFrontmatter");function _j(n){return Gh(n,"exocmd__Grounding")}a(_j,"isGroundingFrontmatter");function Sj(n){return Gh(n,"exocmd__CommandBinding")}a(Sj,"isCommandBindingFrontmatter");function Gh(n,e){let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}a(Gh,"hasInstanceClass")});var II=w(Vb=>{"use strict";Object.defineProperty(Vb,"__esModule",{value:!0});Vb.parseGroundingDefinitionFromFrontmatter=vj;var wj=pf();function AI(n){if(typeof n!="string")return"";let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t>=0?e.slice(0,t).trim():e}a(AI,"normalizeGroundingRef");function vj(n,e,t){let r=e.exocmd__Grounding_type,i=(()=>{if(typeof r!="string")return r;let d=(0,wj.resolveGroundingTypeFromWikilinkLiteral)(r);if(d!==null)return d;throw new Error(`[exocmd-grounding-type-literal-form] legacy literal-string '${r}' for exocmd__Grounding_type in fixture ${n}. Migrate to wikilink form per RFC 9d20c91f Phase 3.`)})(),s=i==="service_call"?e.exocmd__Grounding_serviceId??e.exocmd__Grounding_targetProperty:e.exocmd__Grounding_targetProperty,o;if(i==="composite"){let d=e.exocmd__Grounding_steps;Array.isArray(d)&&(o=d.map(h=>t(AI(h))))}let c=e.exocmd__Grounding_incrementBy,l;if(c!=null&&c!==""){let d=Number.parseInt(String(c),10);Number.isFinite(d)&&(l=d)}let u=e.exocmd__Grounding_targetValueRef,f=u?AI(u):void 0;return{id:n,label:e.exo__Asset_label??"",type:i,targetProperty:s,targetValueRef:f,targetValueLiteral:e.exocmd__Grounding_targetValueLiteral,targetValueSubstitution:e.exocmd__Grounding_targetValueSubstitution,serviceCallPayload:e.exocmd__Grounding_serviceCallPayload,appendExpression:e.exocmd__Grounding_appendExpression,targetClass:e.exocmd__Grounding_targetClass,targetPrototype:e.exocmd__Grounding_targetPrototype,targetFolder:e.exocmd__Grounding_targetFolder,shiftDelta:e.exocmd__Grounding_shiftDelta,incrementBy:l,linkBackProperty:e.exocmd__Grounding_linkBackProperty,steps:o}}a(vj,"parseGroundingDefinitionFromFrontmatter")});var xI=w(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.hasPosition=Ej;qh.isFixed=Tj;function Ej(n){return typeof n.x=="number"&&typeof n.y=="number"}a(Ej,"hasPosition");function Tj(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}a(Tj,"isFixed")});var RI=w(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.createEmptyGraphData=Aj;Wh.mergeGraphData=Ij;function Aj(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}a(Aj,"createEmptyGraphData");function Ij(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 o=`${s.source}->${s.target}:${s.type}`;r.has(o)||(r.add(o),i.push(s))}for(let s of e.edges){let o=`${s.source}->${s.target}:${s.type}`;r.has(o)||(r.add(o),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}a(Ij,"mergeGraphData")});var Gb=w(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.createEdgeId=xj;zh.edgesEqual=Rj;function xj(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}a(xj,"createEdgeId");function Rj(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}a(Rj,"edgesEqual")});var qb=w(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.BUILT_IN_EDGE_STYLES=Kt.BUILT_IN_NODE_STYLES=Kt.DEFAULT_EDGE_STYLE=Kt.DEFAULT_NODE_STYLE=Kt.RDF_TYPE_PREDICATES=void 0;Kt.mergeNodeStyles=Pj;Kt.mergeEdgeStyles=Cj;Kt.extractLocalName=Oj;Kt.isClassType=Dj;Kt.isTypePredicate=Fj;Kt.isSubClassPredicate=Lj;Kt.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"};Kt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Kt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Kt.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"}};Kt.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 Pj(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}a(Pj,"mergeNodeStyles");function Cj(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}a(Cj,"mergeEdgeStyles");function Oj(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}a(Oj,"extractLocalName");function Dj(n){return n===Kt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Kt.RDF_TYPE_PREDICATES.OWL_CLASS}a(Dj,"isClassType");function Fj(n){return n===Kt.RDF_TYPE_PREDICATES.RDF_TYPE}a(Fj,"isTypePredicate");function Lj(n){return n===Kt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}a(Lj,"isSubClassPredicate")});var CI=w(PI=>{"use strict";Object.defineProperty(PI,"__esModule",{value:!0})});var Oe=w(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.IRI=void 0;var Wb=class n{static{a(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)}}};Hh.IRI=Wb});var qe=w(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.Literal=void 0;Ha.parseLanguageTag=OI;Ha.createDirectionalLiteral=kj;Ha.createLiteralFromLanguageTag=Mj;var Nj="http://www.w3.org/2001/XMLSchema#string",mf=class{static{a(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===Nj?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}};Ha.Literal=mf;function OI(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()}}a(OI,"parseLanguageTag");function kj(n,e,t){return new mf(n,void 0,e,t)}a(kj,"createDirectionalLiteral");function Mj(n,e){let{language:t,direction:r}=OI(e);return new mf(n,void 0,t,r)}a(Mj,"createLiteralFromLanguageTag")});var Bt=w(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.BlankNode=void 0;var Kh=class n{static{a(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())}};Qh.BlankNode=Kh;Kh.counter=0});var Jt=w(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.Namespace=void 0;var DI=Oe(),et=class n{static{a(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new DI.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new DI.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)}static forPrefix(e){if(!/^[a-z][a-zA-Z0-9]*$/.test(e))return null;let t=n.KNOWN_NAMESPACES.find(r=>r.prefix===e);return t||new n(e,`${n.EXOCORTEX_ONTOLOGY_BASE}${e}#`)}static fromPropertyKey(e){let t=/^([a-z][a-zA-Z0-9]*)__(.+)$/.exec(e);if(!t)return null;let r=n.forPrefix(t[1]);return r?{namespace:r,localName:t[2]}:null}};Xh.Namespace=et;et.RDF=new et("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");et.RDFS=new et("rdfs","http://www.w3.org/2000/01/rdf-schema#");et.OWL=new et("owl","http://www.w3.org/2002/07/owl#");et.XSD=new et("xsd","http://www.w3.org/2001/XMLSchema#");et.EXO=new et("exo","https://exocortex.my/ontology/exo#");et.EMS=new et("ems","https://exocortex.my/ontology/ems#");et.EXOCMD=new et("exocmd","https://exocortex.my/ontology/exocmd#");et.IMS=new et("ims","https://exocortex.my/ontology/ims#");et.ZTLK=new et("ztlk","https://exocortex.my/ontology/ztlk#");et.PTMS=new et("ptms","https://exocortex.my/ontology/ptms#");et.LIT=new et("lit","https://exocortex.my/ontology/lit#");et.INBOX=new et("inbox","https://exocortex.my/ontology/inbox#");et.PMBOK=new et("pmbok","https://exocortex.my/ontology/pmbok#");et.EXOCORTEX_ONTOLOGY_BASE="https://exocortex.my/ontology/";et.KNOWN_NAMESPACES=[et.EXO,et.EMS,et.EXOCMD,et.IMS,et.ZTLK,et.PTMS,et.LIT,et.INBOX,et.PMBOK]});var Wn=w(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.Triple=void 0;var zb=Oe(),Hb=qe(),Kb=Bt(),Qb=class{static{a(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 zb.IRI&&t instanceof zb.IRI||e instanceof Kb.BlankNode&&t instanceof Kb.BlankNode||e instanceof Hb.Literal&&t instanceof Hb.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 zb.IRI?`<${e.value}>`:e instanceof Kb.BlankNode||e instanceof Hb.Literal||this.isQuotedTriple(e)?e.toString():""}};Yh.Triple=Qb});var gf=w(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.QuotedTriple=void 0;var Xb=Oe(),Yb=qe(),Jb=Bt(),Zb=class n{static{a(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 Xb.IRI&&t instanceof Xb.IRI||e instanceof Jb.BlankNode&&t instanceof Jb.BlankNode||e instanceof Yb.Literal&&t instanceof Yb.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 Xb.IRI?`<${e.value}>`:e instanceof Jb.BlankNode||e instanceof Yb.Literal||e instanceof n?e.toString():""}};Jh.QuotedTriple=Zb});var FI=w(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.QuotedTriple=sr.Triple=sr.Namespace=sr.BlankNode=sr.createLiteralFromLanguageTag=sr.createDirectionalLiteral=sr.parseLanguageTag=sr.Literal=sr.IRI=void 0;var jj=Oe();Object.defineProperty(sr,"IRI",{enumerable:!0,get:a(function(){return jj.IRI},"get")});var Zh=qe();Object.defineProperty(sr,"Literal",{enumerable:!0,get:a(function(){return Zh.Literal},"get")});Object.defineProperty(sr,"parseLanguageTag",{enumerable:!0,get:a(function(){return Zh.parseLanguageTag},"get")});Object.defineProperty(sr,"createDirectionalLiteral",{enumerable:!0,get:a(function(){return Zh.createDirectionalLiteral},"get")});Object.defineProperty(sr,"createLiteralFromLanguageTag",{enumerable:!0,get:a(function(){return Zh.createLiteralFromLanguageTag},"get")});var $j=Bt();Object.defineProperty(sr,"BlankNode",{enumerable:!0,get:a(function(){return $j.BlankNode},"get")});var Uj=Jt();Object.defineProperty(sr,"Namespace",{enumerable:!0,get:a(function(){return Uj.Namespace},"get")});var Bj=Wn();Object.defineProperty(sr,"Triple",{enumerable:!0,get:a(function(){return Bj.Triple},"get")});var Vj=gf();Object.defineProperty(sr,"QuotedTriple",{enumerable:!0,get:a(function(){return Vj.QuotedTriple},"get")})});var ep=w(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.UUID_URL_NAMESPACE=ai.DEFAULT_LANGUAGE_TAG=ai.REQUIRED_PROPERTIES=ai.ALLOWED_PROPERTIES=ai.Exo003MetadataType=void 0;var oi;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(oi||(ai.Exo003MetadataType=oi={}));ai.ALLOWED_PROPERTIES={[oi.Namespace]:["metadata","uri","aliases"],[oi.Anchor]:["metadata","uri","aliases"],[oi.BlankNode]:["metadata","uri","aliases"],[oi.Statement]:["metadata","subject","predicate","object","aliases"],[oi.Body]:["metadata","subject","predicate","aliases"]};ai.REQUIRED_PROPERTIES={[oi.Namespace]:["metadata","uri"],[oi.Anchor]:["metadata","uri"],[oi.BlankNode]:["metadata","uri"],[oi.Statement]:["metadata","subject","predicate","object"],[oi.Body]:["metadata","subject","predicate"]};ai.DEFAULT_LANGUAGE_TAG="ru";ai.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var LI=w(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});e_.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var NI=w(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});t_.default="00000000-0000-0000-0000-000000000000"});var kI=w(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});r_.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 yf=w(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var Gj=kI();function qj(n){return typeof n=="string"&&Gj.default.test(n)}a(qj,"validate");n_.default=qj});var bf=w(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var Wj=yf();function zj(n){if(!(0,Wj.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)}a(zj,"parse");i_.default=zj});var Ys=w(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.unsafeStringify=void 0;var Hj=yf(),Mr=[];for(let n=0;n<256;++n)Mr.push((n+256).toString(16).slice(1));function MI(n,e=0){return(Mr[n[e+0]]+Mr[n[e+1]]+Mr[n[e+2]]+Mr[n[e+3]]+"-"+Mr[n[e+4]]+Mr[n[e+5]]+"-"+Mr[n[e+6]]+Mr[n[e+7]]+"-"+Mr[n[e+8]]+Mr[n[e+9]]+"-"+Mr[n[e+10]]+Mr[n[e+11]]+Mr[n[e+12]]+Mr[n[e+13]]+Mr[n[e+14]]+Mr[n[e+15]]).toLowerCase()}a(MI,"unsafeStringify");_f.unsafeStringify=MI;function Kj(n,e=0){let t=MI(n,e);if(!(0,Hj.default)(t))throw TypeError("Stringified UUID is invalid");return t}a(Kj,"stringify");_f.default=Kj});var np=w(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var Qj=require("crypto"),rp=new Uint8Array(256),tp=rp.length;function Xj(){return tp>rp.length-16&&((0,Qj.randomFillSync)(rp),tp=0),rp.slice(tp,tp+=16)}a(Xj,"rng");s_.default=Xj});var o_=w(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.updateV1State=void 0;var jI=np(),Yj=Ys(),Sf={};function Jj(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=$I(n.random??n.rng?.()??(0,jI.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),o=(0,jI.default)();UI(Sf,s,o),r=$I(o,Sf.msecs,Sf.nsecs,i?void 0:Sf.clockseq,i?void 0:Sf.node,e,t)}return e??(0,Yj.unsafeStringify)(r)}a(Jj,"v1");function UI(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}a(UI,"updateV1State");wf.updateV1State=UI;function $I(n,e,t,r,i,s,o=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),o=0;else if(o<0||o+16>s.length)throw new RangeError(`UUID byte range ${o}:${o+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[o++]=c>>>24&255,s[o++]=c>>>16&255,s[o++]=c>>>8&255,s[o++]=c&255;let l=e/4294967296*1e4&268435455;s[o++]=l>>>8&255,s[o++]=l&255,s[o++]=l>>>24&15|16,s[o++]=l>>>16&255,s[o++]=r>>>8|128,s[o++]=r&255;for(let u=0;u<6;++u)s[o++]=i[u];return s}a($I,"v1Bytes");wf.default=Jj});var c_=w(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var Zj=bf(),e9=Ys();function t9(n){let e=typeof n=="string"?(0,Zj.default)(n):n,t=r9(e);return typeof n=="string"?(0,e9.unsafeStringify)(t):t}a(t9,"v1ToV6");a_.default=t9;function r9(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])}a(r9,"_v1ToV6")});var BI=w(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var n9=require("crypto");function i9(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,n9.createHash)("md5").update(n).digest()}a(i9,"md5");l_.default=i9});var vf=w(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.URL=Js.DNS=Js.stringToBytes=void 0;var VI=bf(),s9=Ys();function GI(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}a(GI,"stringToBytes");Js.stringToBytes=GI;Js.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Js.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function o9(n,e,t,r,i,s){let o=typeof t=="string"?GI(t):t,c=typeof r=="string"?(0,VI.default)(r):r;if(typeof r=="string"&&(r=(0,VI.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(c),l.set(o,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,s9.unsafeStringify)(l)}a(o9,"v35");Js.default=o9});var WI=w(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.URL=Ka.DNS=void 0;var a9=BI(),u_=vf(),qI=vf();Object.defineProperty(Ka,"DNS",{enumerable:!0,get:a(function(){return qI.DNS},"get")});Object.defineProperty(Ka,"URL",{enumerable:!0,get:a(function(){return qI.URL},"get")});function f_(n,e,t,r){return(0,u_.default)(48,a9.default,n,e,t,r)}a(f_,"v3");f_.DNS=u_.DNS;f_.URL=u_.URL;Ka.default=f_});var zI=w(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var c9=require("crypto");d_.default={randomUUID:c9.randomUUID}});var KI=w(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var HI=zI(),l9=np(),u9=Ys();function f9(n,e,t){if(HI.default.randomUUID&&!e&&!n)return HI.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,l9.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,u9.unsafeStringify)(r)}a(f9,"v4");h_.default=f9});var QI=w(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var d9=require("crypto");function h9(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,d9.createHash)("sha1").update(n).digest()}a(h9,"sha1");p_.default=h9});var YI=w(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.URL=Qa.DNS=void 0;var p9=QI(),m_=vf(),XI=vf();Object.defineProperty(Qa,"DNS",{enumerable:!0,get:a(function(){return XI.DNS},"get")});Object.defineProperty(Qa,"URL",{enumerable:!0,get:a(function(){return XI.URL},"get")});function g_(n,e,t,r){return(0,m_.default)(80,p9.default,n,e,t,r)}a(g_,"v5");g_.DNS=m_.DNS;g_.URL=m_.URL;Qa.default=g_});var JI=w(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var m9=Ys(),g9=o_(),y9=c_();function b9(n,e,t){n??={},t??=0;let r=(0,g9.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,y9.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,m9.unsafeStringify)(r)}a(b9,"v6");y_.default=b9});var ZI=w(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var _9=bf(),S9=Ys();function w9(n){let e=typeof n=="string"?(0,_9.default)(n):n,t=v9(e);return typeof n=="string"?(0,S9.unsafeStringify)(t):t}a(w9,"v6ToV1");b_.default=w9;function v9(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])}a(v9,"_v6ToV1")});var nx=w(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.updateV7State=void 0;var ex=np(),E9=Ys(),__={};function T9(n,e,t){let r;if(n)r=tx(n.random??n.rng?.()??(0,ex.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,ex.default)();rx(__,i,s),r=tx(s,__.msecs,__.seq,e,t)}return e??(0,E9.unsafeStringify)(r)}a(T9,"v7");function rx(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}a(rx,"updateV7State");Ef.updateV7State=rx;function tx(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}a(tx,"v7Bytes");Ef.default=T9});var ix=w(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var A9=yf();function I9(n){if(!(0,A9.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}a(I9,"version");S_.default=I9});var Ai=w(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.version=ht.validate=ht.v7=ht.v6ToV1=ht.v6=ht.v5=ht.v4=ht.v3=ht.v1ToV6=ht.v1=ht.stringify=ht.parse=ht.NIL=ht.MAX=void 0;var x9=LI();Object.defineProperty(ht,"MAX",{enumerable:!0,get:a(function(){return x9.default},"get")});var R9=NI();Object.defineProperty(ht,"NIL",{enumerable:!0,get:a(function(){return R9.default},"get")});var P9=bf();Object.defineProperty(ht,"parse",{enumerable:!0,get:a(function(){return P9.default},"get")});var C9=Ys();Object.defineProperty(ht,"stringify",{enumerable:!0,get:a(function(){return C9.default},"get")});var O9=o_();Object.defineProperty(ht,"v1",{enumerable:!0,get:a(function(){return O9.default},"get")});var D9=c_();Object.defineProperty(ht,"v1ToV6",{enumerable:!0,get:a(function(){return D9.default},"get")});var F9=WI();Object.defineProperty(ht,"v3",{enumerable:!0,get:a(function(){return F9.default},"get")});var L9=KI();Object.defineProperty(ht,"v4",{enumerable:!0,get:a(function(){return L9.default},"get")});var N9=YI();Object.defineProperty(ht,"v5",{enumerable:!0,get:a(function(){return N9.default},"get")});var k9=JI();Object.defineProperty(ht,"v6",{enumerable:!0,get:a(function(){return k9.default},"get")});var M9=ZI();Object.defineProperty(ht,"v6ToV1",{enumerable:!0,get:a(function(){return M9.default},"get")});var j9=nx();Object.defineProperty(ht,"v7",{enumerable:!0,get:a(function(){return j9.default},"get")});var $9=yf();Object.defineProperty(ht,"validate",{enumerable:!0,get:a(function(){return $9.default},"get")});var U9=ix();Object.defineProperty(ht,"version",{enumerable:!0,get:a(function(){return U9.default},"get")})});var E_=w(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.Exo003UUIDGenerator=void 0;var w_=Ai(),sx=ep(),v_=class{static{a(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,w_.v5)(e,sx.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,w_.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,w_.v5)(e,sx.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)}};ip.Exo003UUIDGenerator=v_});var ax=w(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.Exo003Parser=void 0;var bt=ep(),Tf=E_(),Go=Oe(),sp=qe(),ox=Bt(),B9=Wn(),T_=class{static{a(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===bt.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(bt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(bt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,o=bt.ALLOWED_PROPERTIES[s],c=bt.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))o.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case bt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case bt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case bt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case bt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case bt.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 bt.Exo003MetadataType.Namespace:return{...r,metadata:bt.Exo003MetadataType.Namespace,uri:e.uri};case bt.Exo003MetadataType.Anchor:return{...r,metadata:bt.Exo003MetadataType.Anchor,uri:e.uri};case bt.Exo003MetadataType.BlankNode:return{...r,metadata:bt.Exo003MetadataType.BlankNode,uri:e.uri};case bt.Exo003MetadataType.Statement:return{...r,metadata:bt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case bt.Exo003MetadataType.Body:return{...r,metadata:bt.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 Go.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 Go.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 Go.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,o=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of o)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 Go.IRI(i.value);else if(i.type==="blank")s=new ox.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let o=t(e.predicate);if(o.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new Go.IRI(o.value),l=t(e.object),u;if(l.type==="iri")u=new Go.IRI(l.value);else if(l.type==="blank")u=new ox.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new sp.Literal(f,new Go.IRI(l.datatype));else{let d=l.language||bt.DEFAULT_LANGUAGE_TAG;u=(0,sp.createDirectionalLiteral)(f,d,l.direction)}}return new B9.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new sp.Literal(t,new Go.IRI(r.datatype));let i=r?.language||bt.DEFAULT_LANGUAGE_TAG;return(0,sp.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(bt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case bt.Exo003MetadataType.Namespace:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case bt.Exo003MetadataType.Anchor:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case bt.Exo003MetadataType.BlankNode:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case bt.Exo003MetadataType.Statement:{let r=e;return Tf.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case bt.Exo003MetadataType.Body:{let r=e;return Tf.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};op.Exo003Parser=T_});var A_=w(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.Exo003Parser=Hr.Exo003UUIDGenerator=Hr.UUID_URL_NAMESPACE=Hr.DEFAULT_LANGUAGE_TAG=Hr.REQUIRED_PROPERTIES=Hr.ALLOWED_PROPERTIES=Hr.Exo003MetadataType=void 0;var Af=ep();Object.defineProperty(Hr,"Exo003MetadataType",{enumerable:!0,get:a(function(){return Af.Exo003MetadataType},"get")});Object.defineProperty(Hr,"ALLOWED_PROPERTIES",{enumerable:!0,get:a(function(){return Af.ALLOWED_PROPERTIES},"get")});Object.defineProperty(Hr,"REQUIRED_PROPERTIES",{enumerable:!0,get:a(function(){return Af.REQUIRED_PROPERTIES},"get")});Object.defineProperty(Hr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:a(function(){return Af.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(Hr,"UUID_URL_NAMESPACE",{enumerable:!0,get:a(function(){return Af.UUID_URL_NAMESPACE},"get")});var V9=E_();Object.defineProperty(Hr,"Exo003UUIDGenerator",{enumerable:!0,get:a(function(){return V9.Exo003UUIDGenerator},"get")});var G9=ax();Object.defineProperty(Hr,"Exo003Parser",{enumerable:!0,get:a(function(){return G9.Exo003Parser},"get")})});var Zs=w(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.WikiLinkHelpers=void 0;var If=class{static{a(this,"WikiLinkHelpers")}static normalize(e){if(!e)return"";let t=e.replace(this.WIKI_LINK_PATTERN,"").trim();if(!t)return"";let r=t.indexOf("|");if(r===-1)return t;let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();return this.UUID_PATTERN.test(i)&&s||i}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)}static resolveSymbolic(e,t){let r=this.normalize(e);if(!r)return"";if(this.UUID_PATTERN.test(r)){let i=t(r);return i&&i.length>0?i:r}return r}static resolveSymbolicArray(e,t){return e?(Array.isArray(e)?e:[e]).map(i=>this.resolveSymbolic(i,t)).filter(i=>i.length>0):[]}};ap.WikiLinkHelpers=If;If.WIKI_LINK_PATTERN=/\[\[|\]\]/g;If.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var qo=w(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.CommandBindingProperty=_t.GroundingProperty=_t.PreconditionProperty=_t.CommandProperty=_t.resolveGroundingTypeFromWikilinkLiteral=_t.resolveGroundingTypeFromIRI=_t.GROUNDING_TYPE_IRI_TO_ENUM=_t.GROUNDING_TYPE_UID_TO_ENUM=_t.GROUNDING_TYPE_UIDS=_t.GroundingType=_t.EFFORT_STATUS_OPTIONS=_t.EffortStatus=_t.AssetClass=void 0;var q9=Jc();Object.defineProperty(_t,"AssetClass",{enumerable:!0,get:a(function(){return q9.AssetClass},"get")});var W9=Zc();Object.defineProperty(_t,"EffortStatus",{enumerable:!0,get:a(function(){return W9.EffortStatus},"get")});var z9=$b();Object.defineProperty(_t,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return z9.EFFORT_STATUS_OPTIONS},"get")});var H9=Vo();Object.defineProperty(_t,"GroundingType",{enumerable:!0,get:a(function(){return H9.GroundingType},"get")});var xf=pf();Object.defineProperty(_t,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(_t,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(_t,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(_t,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return xf.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(_t,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return xf.resolveGroundingTypeFromWikilinkLiteral},"get")});var cp=Ub();Object.defineProperty(_t,"CommandProperty",{enumerable:!0,get:a(function(){return cp.CommandProperty},"get")});Object.defineProperty(_t,"PreconditionProperty",{enumerable:!0,get:a(function(){return cp.PreconditionProperty},"get")});Object.defineProperty(_t,"GroundingProperty",{enumerable:!0,get:a(function(){return cp.GroundingProperty},"get")});Object.defineProperty(_t,"CommandBindingProperty",{enumerable:!0,get:a(function(){return cp.CommandBindingProperty},"get")})});var fx=w(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.hasClass=Ya;Kr.isAreaOrProject=K9;Kr.isEffort=Q9;Kr.hasStatus=X9;Kr.isAssetArchived=Y9;Kr.hasEmptyProperties=J9;Kr.needsFolderRepair=Z9;Kr.getTodayDateString=I_;Kr.isPlannedForToday=e5;Kr.hasPlannedStartTimestamp=t5;Kr.extractDailyNoteDate=r5;Kr.isCurrentDateGteDay=n5;Kr.inheritsFromPrototype=ux;Kr.isPrototypeClass=s5;var lx=Zs(),Xa=qo();function Ya(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>lx.WikiLinkHelpers.normalize(r)===e):!1}a(Ya,"hasClass");function K9(n){return Ya(n,Xa.AssetClass.AREA)||Ya(n,Xa.AssetClass.PROJECT)}a(K9,"isAreaOrProject");function Q9(n){return Ya(n,Xa.AssetClass.TASK)||Ya(n,Xa.AssetClass.PROJECT)||Ya(n,Xa.AssetClass.MEETING)}a(Q9,"isEffort");function X9(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?lx.WikiLinkHelpers.normalize(t)===e:!1}a(X9,"hasStatus");function Y9(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}a(Y9,"isAssetArchived");function J9(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))}a(J9,"hasEmptyProperties");function Z9(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}a(Z9,"needsFolderRepair");function I_(){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}`}a(I_,"getTodayDateString");function e5(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=I_();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}a(e5,"isPlannedForToday");function t5(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}a(t5,"hasPlannedStartTimestamp");function r5(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}a(r5,"extractDailyNoteDate");function n5(n){return I_()>=n}a(n5,"isCurrentDateGteDay");function cx(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}a(cx,"normalizeWithQuotes");var i5=10;function ux(n,e=i5){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let o of s){let c=cx(o);c&&i.push({className:c,depth:0})}for(;i.length>0;){let o=i.shift();if(!o)continue;let{className:c,depth:l}=o;if(l>e)continue;if(c===Xa.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let d=Array.isArray(f)?f:[f];for(let h of d){let p=cx(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}a(ux,"inheritsFromPrototype");function s5(n,e){return Ya(n,Xa.AssetClass.CLASS)?ux(e):!1}a(s5,"isPrototypeClass")});var dx=w(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.isPrototypeClass=pt.inheritsFromPrototype=pt.isCurrentDateGteDay=pt.extractDailyNoteDate=pt.hasPlannedStartTimestamp=pt.isPlannedForToday=pt.getTodayDateString=pt.needsFolderRepair=pt.hasEmptyProperties=pt.isAssetArchived=pt.hasStatus=pt.isEffort=pt.isAreaOrProject=pt.hasClass=void 0;var Dn=fx();Object.defineProperty(pt,"hasClass",{enumerable:!0,get:a(function(){return Dn.hasClass},"get")});Object.defineProperty(pt,"isAreaOrProject",{enumerable:!0,get:a(function(){return Dn.isAreaOrProject},"get")});Object.defineProperty(pt,"isEffort",{enumerable:!0,get:a(function(){return Dn.isEffort},"get")});Object.defineProperty(pt,"hasStatus",{enumerable:!0,get:a(function(){return Dn.hasStatus},"get")});Object.defineProperty(pt,"isAssetArchived",{enumerable:!0,get:a(function(){return Dn.isAssetArchived},"get")});Object.defineProperty(pt,"hasEmptyProperties",{enumerable:!0,get:a(function(){return Dn.hasEmptyProperties},"get")});Object.defineProperty(pt,"needsFolderRepair",{enumerable:!0,get:a(function(){return Dn.needsFolderRepair},"get")});Object.defineProperty(pt,"getTodayDateString",{enumerable:!0,get:a(function(){return Dn.getTodayDateString},"get")});Object.defineProperty(pt,"isPlannedForToday",{enumerable:!0,get:a(function(){return Dn.isPlannedForToday},"get")});Object.defineProperty(pt,"hasPlannedStartTimestamp",{enumerable:!0,get:a(function(){return Dn.hasPlannedStartTimestamp},"get")});Object.defineProperty(pt,"extractDailyNoteDate",{enumerable:!0,get:a(function(){return Dn.extractDailyNoteDate},"get")});Object.defineProperty(pt,"isCurrentDateGteDay",{enumerable:!0,get:a(function(){return Dn.isCurrentDateGteDay},"get")});Object.defineProperty(pt,"inheritsFromPrototype",{enumerable:!0,get:a(function(){return Dn.inheritsFromPrototype},"get")});Object.defineProperty(pt,"isPrototypeClass",{enumerable:!0,get:a(function(){return Dn.isPrototypeClass},"get")})});var hx=w(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.TsFloorViolationError=xt.CATALOG_KEEP_NAMESPACES=xt.PLUGIN_UI_FLOOR=xt.SDK_FLOOR=xt.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=xt.SDK_FLOOR_ASSETSPACE_UIDS=xt.TS_FLOOR_AS_UID_SHARED_IDENTITIES=xt.TS_FLOOR_AS_UID_EXOCMD=xt.TS_FLOOR_AS_UID_EXO=void 0;xt.assertTsFloor=o5;xt.assertTsFloorReconciled=a5;xt.TS_FLOOR_AS_UID_EXO="49fd2e56-4656-4ca7-a789-f472b16ea260";xt.TS_FLOOR_AS_UID_EXOCMD="c9c65b0f-1e01-47c1-a1f9-1bf70b11df6a";xt.TS_FLOOR_AS_UID_SHARED_IDENTITIES="0cde1557-6320-4bd0-a7c4-8b72afc38720";xt.SDK_FLOOR_ASSETSPACE_UIDS=new Set([xt.TS_FLOOR_AS_UID_EXO]);xt.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=new Set([xt.TS_FLOOR_AS_UID_EXO]);xt.SDK_FLOOR=[{uid:xt.TS_FLOOR_AS_UID_EXO,namespace:"exo"}];xt.PLUGIN_UI_FLOOR=xt.SDK_FLOOR;xt.CATALOG_KEEP_NAMESPACES=new Set(["registry","profiles"]);var Rf=class extends Error{static{a(this,"TsFloorViolationError")}constructor(e){super(e),this.name="TsFloorViolationError"}};xt.TsFloorViolationError=Rf;function o5(n,e){let t=[];for(let r of e)n.has(r)||t.push(r);if(t.length>0)throw new Rf(`Target profile's declared set excludes TS-floor AssetSpace UID(s): ${t.join(", ")}. Profile switch aborted to prevent runtime self-brick (R24).`)}a(o5,"assertTsFloor");function a5(n,e,t){let r=[];for(let i of t)n.has(i.uid)||e.has(i.namespace)||r.push(`${i.namespace} (${i.uid})`);if(r.length>0)throw new Rf(`Target profile's declared set excludes TS-floor AssetSpace(s): ${r.join(", ")}. Profile switch aborted to prevent runtime self-brick (R24).`)}a(a5,"assertTsFloorReconciled")});var px=w(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_.transitiveDependsOnClosure=c5;function c5(n,e){let t=new Set,r=[];for(let i of n)t.has(i)||(t.add(i),r.push(i));for(;r.length>0;){let i=r.shift();if(i===void 0)break;let s=e.get(i);if(s!==void 0)for(let o of s)t.has(o)||(t.add(o),r.push(o))}return t}a(c5,"transitiveDependsOnClosure")});var lp=w(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.PropertyFieldType=void 0;Pf.rangeToFieldType=f5;var jr;(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"})(jr||(Pf.PropertyFieldType=jr={}));var mx="http://www.w3.org/2001/XMLSchema#",l5="https://exocortex.my/ontology/exo#",u5="https://exocortex.my/ontology/ems#";function f5(n){if(!n)return jr.Unknown;let e=n.trim();if(!e)return jr.Unknown;if(e.startsWith(mx)){let t=e.substring(mx.length);return R_(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return R_(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return R_(r)}return e.startsWith(u5)||e.startsWith("ems:")?d5(e):e.startsWith(l5)||e.startsWith("exo:")||h5(e)?jr.Reference:jr.Text}a(f5,"rangeToFieldType");function R_(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return jr.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 jr.Number;case"date":return jr.Date;case"datetime":case"datetimestamp":return jr.DateTime;case"boolean":return jr.Boolean;case"time":return jr.Timestamp;default:return jr.Text}}a(R_,"xsdTypeToFieldType");function d5(n){let e=n.toLowerCase();return e.includes("effortstatus")?jr.StatusSelect:e.includes("tasksize")?jr.SizeSelect:jr.Reference}a(d5,"emsTypeToFieldType");function h5(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))}a(h5,"isClassReference")});var P_=w(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.propertyNameToUri=p5;Cf.uriToPropertyName=gx;Cf.extractPropertyLabel=m5;function p5(n){return n.replace(/^([a-z]+)__/,"$1:")}a(p5,"propertyNameToUri");function gx(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__")}a(gx,"uriToPropertyName");function m5(n){let r=(n.includes(":")?gx(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())}a(m5,"extractPropertyLabel")});var up={};Sb(up,{__assign:()=>O_,__asyncDelegator:()=>R5,__asyncGenerator:()=>x5,__asyncValues:()=>P5,__await:()=>Of,__awaiter:()=>w5,__classPrivateFieldGet:()=>F5,__classPrivateFieldSet:()=>L5,__createBinding:()=>E5,__decorate:()=>b5,__exportStar:()=>T5,__extends:()=>g5,__generator:()=>v5,__importDefault:()=>D5,__importStar:()=>O5,__makeTemplateObject:()=>C5,__metadata:()=>S5,__param:()=>_5,__read:()=>yx,__rest:()=>y5,__spread:()=>A5,__spreadArrays:()=>I5,__values:()=>D_});function g5(n,e){C_(n,e);function t(){this.constructor=n}a(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function y5(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 b5(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function _5(n,e){return function(t,r){e(t,r,n)}}function S5(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function w5(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return a(i,"adopt"),new(t||(t=Promise))(function(s,o){function c(f){try{u(r.next(f))}catch(d){o(d)}}a(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(d){o(d)}}a(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}a(u,"step"),u((r=r.apply(n,e||[])).next())})}function v5(n,e){var t={label:0,sent:a(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;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 E5(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function T5(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function D_(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:a(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 yx(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){o={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function A5(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(yx(arguments[e]));return n}function I5(){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],o=0,c=s.length;o<c;o++,i++)r[i]=s[o];return r}function Of(n){return this instanceof Of?(this.v=n,this):new Of(n)}function x5(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(h){r[h]&&(i[h]=function(p){return new Promise(function(y,g){s.push([h,p,y,g])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(y){d(s[0][3],y)}}function l(h){h.value instanceof Of?Promise.resolve(h.value.v).then(u,f):d(s[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function R5(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(o){return(t=!t)?{value:Of(n[i](o)),done:i==="return"}:s?s(o):o}:s}}function P5(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 D_=="function"?D_(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(o){return new Promise(function(c,l){o=n[s](o),i(c,l,o.done,o.value)})}}function i(s,o,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},o)}}function C5(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function O5(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 D5(n){return n&&n.__esModule?n:{default:n}}function F5(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function L5(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 C_,O_,fp=Q4(()=>{C_=a(function(n,e){return C_=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])},C_(n,e)},"extendStatics");a(g5,"__extends");O_=a(function(){return O_=Object.assign||a(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"),O_.apply(this,arguments)},"__assign");a(y5,"__rest");a(b5,"__decorate");a(_5,"__param");a(S5,"__metadata");a(w5,"__awaiter");a(v5,"__generator");a(E5,"__createBinding");a(T5,"__exportStar");a(D_,"__values");a(yx,"__read");a(A5,"__spread");a(I5,"__spreadArrays");a(Of,"__await");a(x5,"__asyncGenerator");a(R5,"__asyncDelegator");a(P5,"__asyncValues");a(C5,"__makeTemplateObject");a(O5,"__importStar");a(D5,"__importDefault");a(F5,"__classPrivateFieldGet");a(L5,"__classPrivateFieldSet")});var N_=w(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var F_;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(F_||(F_={}));L_.default=F_});var bx=w(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var N5=N_();Object.defineProperty(k_,"Lifecycle",{enumerable:!0,get:a(function(){return N5.default},"get")})});var Ja=w(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.defineInjectionTokenMetadata=Ii.getParamInfo=Ii.INJECTION_TOKEN_METADATA_KEY=void 0;Ii.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function k5(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(Ii.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}a(k5,"getParamInfo");Ii.getParamInfo=k5;function M5(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(Ii.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(Ii.INJECTION_TOKEN_METADATA_KEY,s,t)}}a(M5,"defineInjectionTokenMetadata");Ii.defineInjectionTokenMetadata=M5});var M_=w(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.isClassProvider=void 0;function j5(n){return!!n.useClass}a(j5,"isClassProvider");dp.isClassProvider=j5});var j_=w(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});hp.isFactoryProvider=void 0;function $5(n){return!!n.useFactory}a($5,"isFactoryProvider");hp.isFactoryProvider=$5});var mp=w(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.delay=tl.DelayedConstructor=void 0;var pp=class{static{a(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=a(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=a(i=>{t[i]=(...s)=>{s[0]=e();let o=Reflect[i];return o(...s)}},"install");return this.reflectMethods.forEach(r),t}};tl.DelayedConstructor=pp;function U5(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new pp(n)}a(U5,"delay");tl.delay=U5});var gp=w(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.isConstructorToken=gs.isTransformDescriptor=gs.isTokenDescriptor=gs.isNormalToken=void 0;var B5=mp();function V5(n){return typeof n=="string"||typeof n=="symbol"}a(V5,"isNormalToken");gs.isNormalToken=V5;function G5(n){return typeof n=="object"&&"token"in n&&"multiple"in n}a(G5,"isTokenDescriptor");gs.isTokenDescriptor=G5;function q5(n){return typeof n=="object"&&"token"in n&&"transform"in n}a(q5,"isTransformDescriptor");gs.isTransformDescriptor=q5;function W5(n){return typeof n=="function"||n instanceof B5.DelayedConstructor}a(W5,"isConstructorToken");gs.isConstructorToken=W5});var $_=w(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.isTokenProvider=void 0;function z5(n){return!!n.useToken}a(z5,"isTokenProvider");yp.isTokenProvider=z5});var U_=w(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.isValueProvider=void 0;function H5(n){return n.useValue!=null}a(H5,"isValueProvider");bp.isValueProvider=H5});var B_=w(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var K5=M_();Object.defineProperty(Za,"isClassProvider",{enumerable:!0,get:a(function(){return K5.isClassProvider},"get")});var Q5=j_();Object.defineProperty(Za,"isFactoryProvider",{enumerable:!0,get:a(function(){return Q5.isFactoryProvider},"get")});var X5=gp();Object.defineProperty(Za,"isNormalToken",{enumerable:!0,get:a(function(){return X5.isNormalToken},"get")});var Y5=$_();Object.defineProperty(Za,"isTokenProvider",{enumerable:!0,get:a(function(){return Y5.isTokenProvider},"get")});var J5=U_();Object.defineProperty(Za,"isValueProvider",{enumerable:!0,get:a(function(){return J5.isValueProvider},"get")})});var _x=w(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.isProvider=void 0;var Z5=M_(),e$=U_(),t$=$_(),r$=j_();function n$(n){return Z5.isClassProvider(n)||e$.isValueProvider(n)||t$.isTokenProvider(n)||r$.isFactoryProvider(n)}a(n$,"isProvider");_p.isProvider=n$});var q_=w(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var V_=class{static{a(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,[])}};G_.default=V_});var Sx=w(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var i$=q_(),W_=class extends i$.default{static{a(this,"Registry")}};z_.default=W_});var wx=w(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});var H_=class{static{a(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};K_.default=H_});var Q_=w(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.formatErrorCtor=void 0;function s$(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}a(s$,"formatDependency");function o$(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 pI(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})}a(pI,"incrementNodeInspectorPort");function kb(){if(ft.env.NO_COLOR||ft.env.FORCE_COLOR==="0"||ft.env.FORCE_COLOR==="false")return!1;if(ft.env.FORCE_COLOR||ft.env.CLICOLOR_FORCE!==void 0)return!0}a(kb,"useColor");Mb.Command=Nb;Mb.useColor=kb});var _I=w(ii=>{var{Argument:gI}=Mh(),{Command:jb}=mI(),{CommanderError:lj,InvalidArgumentError:yI}=hf(),{Help:uj}=Rb(),{Option:bI}=Db();ii.program=new jb;ii.createCommand=n=>new jb(n);ii.createOption=(n,e)=>new bI(n,e);ii.createArgument=(n,e)=>new gI(n,e);ii.Command=jb;ii.Option=bI;ii.Argument=gI;ii.Help=uj;ii.CommanderError=lj;ii.InvalidArgumentError=yI;ii.InvalidOptionArgumentError=yI});var Jc=w($h=>{"use strict";Object.defineProperty($h,"__esModule",{value:!0});$h.AssetClass=void 0;var wI;(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.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.WORKFLOW="ems__Workflow",n.WORKFLOW_STATE="ems__WorkflowState",n.WORKFLOW_TRANSITION="ems__WorkflowTransition",n.COMMAND="exocmd__Command",n.PRECONDITION="exocmd__Precondition",n.GROUNDING="exocmd__Grounding",n.COMMAND_BINDING="exocmd__CommandBinding"})(wI||($h.AssetClass=wI={}))});var Zc=w(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});Uh.EffortStatus=void 0;var vI;(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"})(vI||(Uh.EffortStatus=vI={}))});var $b=w(Bh=>{"use strict";Object.defineProperty(Bh,"__esModule",{value:!0});Bh.EFFORT_STATUS_OPTIONS=void 0;Bh.EFFORT_STATUS_OPTIONS=[{value:"[[ems__EffortStatusDraft]]",label:"Draft"},{value:"[[ems__EffortStatusBacklog]]",label:"Backlog"},{value:"[[ems__EffortStatusAnalysis]]",label:"Analysis"},{value:"[[ems__EffortStatusToDo]]",label:"To Do"},{value:"[[ems__EffortStatusDoing]]",label:"Doing"},{value:"[[ems__EffortStatusDone]]",label:"Done"},{value:"[[ems__EffortStatusTrashed]]",label:"Trashed"}]});var Vo=w(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.GroundingType=void 0;var EI;(function(n){n.SPARQL_UPDATE="sparql_update",n.PROPERTY_DELETE="property_delete",n.PROPERTY_SET="property_set",n.COMPOSITE="composite",n.SERVICE_CALL="service_call",n.CREATE_INSTANCE="create_instance",n.PROPERTY_APPEND="property_append",n.PROPERTY_INCREMENT="property_increment",n.PROPERTY_SHIFT="property_shift",n.WORKFLOW_TRANSITION="workflow_transition"})(EI||(Vh.GroundingType=EI={}))});var pf=w(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.GROUNDING_TYPE_IRI_TO_ENUM=Cn.GROUNDING_TYPE_UID_TO_ENUM=Cn.GROUNDING_TYPE_UIDS=void 0;Cn.resolveGroundingTypeFromIRI=dj;Cn.resolveGroundingTypeFromWikilinkLiteral=hj;var ir=Vo();Cn.GROUNDING_TYPE_UIDS={[ir.GroundingType.PROPERTY_SET]:"cf3bb923-f1f1-40be-b728-782844402426",[ir.GroundingType.PROPERTY_DELETE]:"4bdf1d0b-e9da-4d96-bafe-c5aaef8c2bd5",[ir.GroundingType.COMPOSITE]:"8f9a57db-3865-4886-92fb-c5ab7f3c3fa3",[ir.GroundingType.SERVICE_CALL]:"9bf9fc99-ac37-4e51-b9f5-bd920099947c",[ir.GroundingType.CREATE_INSTANCE]:"4367e2d6-6c92-450a-becb-abce1fb07682",[ir.GroundingType.PROPERTY_APPEND]:"572f7e69-a8a1-42f6-8113-5aa65cc4b552",[ir.GroundingType.PROPERTY_INCREMENT]:"afc29f90-45eb-4f94-9fe2-2ce738759161",[ir.GroundingType.PROPERTY_SHIFT]:"f4e5266f-f3cc-49fd-a5a5-ce1e8b7847a4",[ir.GroundingType.SPARQL_UPDATE]:"79c3e709-8d1d-4694-bcc6-b9ff07d59b86",[ir.GroundingType.WORKFLOW_TRANSITION]:"5c1a2552-d576-496d-8823-563573dd1e2f"};Cn.GROUNDING_TYPE_UID_TO_ENUM=Object.freeze(Object.fromEntries(Object.entries(Cn.GROUNDING_TYPE_UIDS).map(([n,e])=>[e,n])));var ms="https://exocortex.my/ontology/exocmd#";Cn.GROUNDING_TYPE_IRI_TO_ENUM=Object.freeze({[`${ms}GroundingTypePropertySet`]:ir.GroundingType.PROPERTY_SET,[`${ms}GroundingTypePropertyDelete`]:ir.GroundingType.PROPERTY_DELETE,[`${ms}GroundingTypeComposite`]:ir.GroundingType.COMPOSITE,[`${ms}GroundingTypeServiceCall`]:ir.GroundingType.SERVICE_CALL,[`${ms}GroundingTypeCreateInstance`]:ir.GroundingType.CREATE_INSTANCE,[`${ms}GroundingTypePropertyAppend`]:ir.GroundingType.PROPERTY_APPEND,[`${ms}GroundingTypePropertyIncrement`]:ir.GroundingType.PROPERTY_INCREMENT,[`${ms}GroundingTypePropertyShift`]:ir.GroundingType.PROPERTY_SHIFT,[`${ms}GroundingTypeSparqlUpdate`]:ir.GroundingType.SPARQL_UPDATE,[`${ms}GroundingTypeWorkflowTransition`]:ir.GroundingType.WORKFLOW_TRANSITION});var fj=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;function dj(n){let e=Cn.GROUNDING_TYPE_IRI_TO_ENUM[n];if(e!==void 0)return e;let t=n.match(fj);return t?Cn.GROUNDING_TYPE_UID_TO_ENUM[t[1].toLowerCase()]??null:null}a(dj,"resolveGroundingTypeFromIRI");function hj(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?Cn.GROUNDING_TYPE_UID_TO_ENUM[e[1].toLowerCase()]??null:null}a(hj,"resolveGroundingTypeFromWikilinkLiteral")});var Ub=w(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.CommandBindingStyleProperty=si.CommandBindingProperty=si.GroundingProperty=si.PreconditionProperty=si.CommandProperty=void 0;si.CommandProperty={ICON:"exocmd__Command_icon",PRECONDITION:"exocmd__Command_precondition",GROUNDING:"exocmd__Command_grounding",CONFIRM_MESSAGE:"exocmd__Command_confirmMessage",SUCCESS_MESSAGE:"exocmd__Command_successMessage",CATEGORY:"exocmd__Command_category",OPEN_IN_SAME_TAB:"exocmd__Command_openInSameTab"};si.PreconditionProperty={SPARQL_ASK:"exocmd__Precondition_sparqlAsk",QUERY:"exocmd__Precondition_query"};si.GroundingProperty={TYPE:"exocmd__Grounding_type",SPARQL_UPDATE:"exocmd__Grounding_sparqlUpdate",TARGET_PROPERTY:"exocmd__Grounding_targetProperty",STEPS:"exocmd__Grounding_steps",IS_DEFINED_BY:"exocmd__Grounding_isDefinedBy",LABEL_TEMPLATE:"exocmd__Grounding_labelTemplate"};si.CommandBindingProperty={COMMAND:"exocmd__CommandBinding_command",TARGET_CLASS:"exocmd__CommandBinding_targetClass",TARGET_PROTOTYPE:"exocmd__CommandBinding_targetPrototype",TARGET_ASSET:"exocmd__CommandBinding_targetAsset",POSITION:"exocmd__CommandBinding_position",ORDER:"exocmd__CommandBinding_order",PRECONDITION:"exocmd__CommandBinding_precondition",STYLE:"exocmd__CommandBinding_style",VARIANT:"exocmd__CommandBinding_variant"};si.CommandBindingStyleProperty={VARIANT:"exocmd__CommandBindingStyle_variant",SHOW_ICON:"exocmd__CommandBindingStyle_showIcon",LABEL_CLASS:"exocmd__CommandBindingStyle_labelClass",ARIA_LABEL:"exocmd__CommandBindingStyle_ariaLabel",TOOLTIP:"exocmd__CommandBindingStyle_tooltip",KEYBOARD_SHORTCUT:"exocmd__CommandBindingStyle_keyboardShortcut",SOURCE:"exocmd__CommandBindingStyle_source"}});var Bb=w(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.STYLE_SOURCE_VALUES=On.LABEL_CLASS_VALUES=On.COMMAND_VARIANT_VALUES=void 0;On.isCommandVariant=pj;On.isLabelClass=mj;On.isStyleSource=gj;On.COMMAND_VARIANT_VALUES=Object.freeze(["primary","secondary","success","warning","danger","muted"]);On.LABEL_CLASS_VALUES=Object.freeze(["muted","bold","uppercase","compact"]);On.STYLE_SOURCE_VALUES=Object.freeze(["vendor","user"]);function pj(n){return typeof n=="string"&&On.COMMAND_VARIANT_VALUES.includes(n)}a(pj,"isCommandVariant");function mj(n){return typeof n=="string"&&On.LABEL_CLASS_VALUES.includes(n)}a(mj,"isLabelClass");function gj(n){return typeof n=="string"&&On.STYLE_SOURCE_VALUES.includes(n)}a(gj,"isStyleSource")});var TI=w(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.isCommandFrontmatter=yj;el.isPreconditionFrontmatter=bj;el.isGroundingFrontmatter=_j;el.isCommandBindingFrontmatter=Sj;function yj(n){return Gh(n,"exocmd__Command")}a(yj,"isCommandFrontmatter");function bj(n){return Gh(n,"exocmd__Precondition")}a(bj,"isPreconditionFrontmatter");function _j(n){return Gh(n,"exocmd__Grounding")}a(_j,"isGroundingFrontmatter");function Sj(n){return Gh(n,"exocmd__CommandBinding")}a(Sj,"isCommandBindingFrontmatter");function Gh(n,e){let t=n.exo__Instance_class;if(t==null)return!1;let r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;let s=i.match(/\[\[([^|\]]+)/);if((s?s[1]:i)===e)return!0}return!1}a(Gh,"hasInstanceClass")});var II=w(Vb=>{"use strict";Object.defineProperty(Vb,"__esModule",{value:!0});Vb.parseGroundingDefinitionFromFrontmatter=vj;var wj=pf();function AI(n){if(typeof n!="string")return"";let e=n.replace(/["'[\]]/g,"").trim(),t=e.indexOf("|");return t>=0?e.slice(0,t).trim():e}a(AI,"normalizeGroundingRef");function vj(n,e,t){let r=e.exocmd__Grounding_type,i=(()=>{if(typeof r!="string")return r;let d=(0,wj.resolveGroundingTypeFromWikilinkLiteral)(r);if(d!==null)return d;throw new Error(`[exocmd-grounding-type-literal-form] legacy literal-string '${r}' for exocmd__Grounding_type in fixture ${n}. Migrate to wikilink form per RFC 9d20c91f Phase 3.`)})(),s=i==="service_call"?e.exocmd__Grounding_serviceId??e.exocmd__Grounding_targetProperty:e.exocmd__Grounding_targetProperty,o;if(i==="composite"){let d=e.exocmd__Grounding_steps;Array.isArray(d)&&(o=d.map(h=>t(AI(h))))}let c=e.exocmd__Grounding_incrementBy,l;if(c!=null&&c!==""){let d=Number.parseInt(String(c),10);Number.isFinite(d)&&(l=d)}let u=e.exocmd__Grounding_targetValueRef,f=u?AI(u):void 0;return{id:n,label:e.exo__Asset_label??"",type:i,targetProperty:s,targetValueRef:f,targetValueLiteral:e.exocmd__Grounding_targetValueLiteral,targetValueSubstitution:e.exocmd__Grounding_targetValueSubstitution,serviceCallPayload:e.exocmd__Grounding_serviceCallPayload,appendExpression:e.exocmd__Grounding_appendExpression,targetClass:e.exocmd__Grounding_targetClass,targetPrototype:e.exocmd__Grounding_targetPrototype,targetFolder:e.exocmd__Grounding_targetFolder,shiftDelta:e.exocmd__Grounding_shiftDelta,incrementBy:l,linkBackProperty:e.exocmd__Grounding_linkBackProperty,steps:o}}a(vj,"parseGroundingDefinitionFromFrontmatter")});var xI=w(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.hasPosition=Ej;qh.isFixed=Tj;function Ej(n){return typeof n.x=="number"&&typeof n.y=="number"}a(Ej,"hasPosition");function Tj(n){return n.fx!==null&&n.fx!==void 0&&n.fy!==null&&n.fy!==void 0}a(Tj,"isFixed")});var RI=w(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.createEmptyGraphData=Aj;Wh.mergeGraphData=Ij;function Aj(){return{nodes:[],edges:[],lastUpdated:Date.now(),version:0}}a(Aj,"createEmptyGraphData");function Ij(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 o=`${s.source}->${s.target}:${s.type}`;r.has(o)||(r.add(o),i.push(s))}for(let s of e.edges){let o=`${s.source}->${s.target}:${s.type}`;r.has(o)||(r.add(o),i.push(s))}return{nodes:Array.from(t.values()),edges:i,lastUpdated:Date.now(),version:Math.max(n.version??0,e.version??0)+1}}a(Ij,"mergeGraphData")});var Gb=w(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.createEdgeId=xj;zh.edgesEqual=Rj;function xj(n,e,t,r){let i=r?`|${r}`:"";return`${n}->${e}:${t}${i}`}a(xj,"createEdgeId");function Rj(n,e){return n.source===e.source&&n.target===e.target&&n.type===e.type&&n.predicate===e.predicate}a(Rj,"edgesEqual")});var qb=w(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.BUILT_IN_EDGE_STYLES=Kt.BUILT_IN_NODE_STYLES=Kt.DEFAULT_EDGE_STYLE=Kt.DEFAULT_NODE_STYLE=Kt.RDF_TYPE_PREDICATES=void 0;Kt.mergeNodeStyles=Pj;Kt.mergeEdgeStyles=Cj;Kt.extractLocalName=Oj;Kt.isClassType=Dj;Kt.isTypePredicate=Fj;Kt.isSubClassPredicate=Lj;Kt.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"};Kt.DEFAULT_NODE_STYLE={color:"#6366f1",borderColor:"#4f46e5",borderWidth:2,size:30,shape:"circle",icon:"",opacity:1,shadow:!1,animation:"none"};Kt.DEFAULT_EDGE_STYLE={color:"#9ca3af",width:1,lineStyle:"solid",arrow:"standard",curvature:0,opacity:.6,showLabel:!1,labelPosition:.5};Kt.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"}};Kt.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 Pj(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}a(Pj,"mergeNodeStyles");function Cj(n,e){return{...n,...Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}}a(Cj,"mergeEdgeStyles");function Oj(n){let e=n.lastIndexOf("#"),t=n.lastIndexOf("/"),r=Math.max(e,t);return r>=0?n.substring(r+1):n}a(Oj,"extractLocalName");function Dj(n){return n===Kt.RDF_TYPE_PREDICATES.RDFS_CLASS||n===Kt.RDF_TYPE_PREDICATES.OWL_CLASS}a(Dj,"isClassType");function Fj(n){return n===Kt.RDF_TYPE_PREDICATES.RDF_TYPE}a(Fj,"isTypePredicate");function Lj(n){return n===Kt.RDF_TYPE_PREDICATES.RDFS_SUBCLASS_OF}a(Lj,"isSubClassPredicate")});var CI=w(PI=>{"use strict";Object.defineProperty(PI,"__esModule",{value:!0})});var Oe=w(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});Hh.IRI=void 0;var Wb=class n{static{a(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)}}};Hh.IRI=Wb});var qe=w(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.Literal=void 0;Ha.parseLanguageTag=OI;Ha.createDirectionalLiteral=kj;Ha.createLiteralFromLanguageTag=Mj;var Nj="http://www.w3.org/2001/XMLSchema#string",mf=class{static{a(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===Nj?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}};Ha.Literal=mf;function OI(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()}}a(OI,"parseLanguageTag");function kj(n,e,t){return new mf(n,void 0,e,t)}a(kj,"createDirectionalLiteral");function Mj(n,e){let{language:t,direction:r}=OI(e);return new mf(n,void 0,t,r)}a(Mj,"createLiteralFromLanguageTag")});var Bt=w(Qh=>{"use strict";Object.defineProperty(Qh,"__esModule",{value:!0});Qh.BlankNode=void 0;var Kh=class n{static{a(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())}};Qh.BlankNode=Kh;Kh.counter=0});var Jt=w(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.Namespace=void 0;var DI=Oe(),et=class n{static{a(this,"Namespace")}constructor(e,t){if(e.trim().length===0)throw new Error("Namespace prefix cannot be empty");this._prefix=e,this._iri=new DI.IRI(t)}get prefix(){return this._prefix}get iri(){return this._iri}term(e){return new DI.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)}static forPrefix(e){if(!/^[a-z][a-zA-Z0-9]*$/.test(e))return null;let t=n.KNOWN_NAMESPACES.find(r=>r.prefix===e);return t||new n(e,`${n.EXOCORTEX_ONTOLOGY_BASE}${e}#`)}static fromPropertyKey(e){let t=/^([a-z][a-zA-Z0-9]*)__(.+)$/.exec(e);if(!t)return null;let r=n.forPrefix(t[1]);return r?{namespace:r,localName:t[2]}:null}};Xh.Namespace=et;et.RDF=new et("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");et.RDFS=new et("rdfs","http://www.w3.org/2000/01/rdf-schema#");et.OWL=new et("owl","http://www.w3.org/2002/07/owl#");et.XSD=new et("xsd","http://www.w3.org/2001/XMLSchema#");et.EXO=new et("exo","https://exocortex.my/ontology/exo#");et.EMS=new et("ems","https://exocortex.my/ontology/ems#");et.EXOCMD=new et("exocmd","https://exocortex.my/ontology/exocmd#");et.IMS=new et("ims","https://exocortex.my/ontology/ims#");et.ZTLK=new et("ztlk","https://exocortex.my/ontology/ztlk#");et.PTMS=new et("ptms","https://exocortex.my/ontology/ptms#");et.LIT=new et("lit","https://exocortex.my/ontology/lit#");et.INBOX=new et("inbox","https://exocortex.my/ontology/inbox#");et.PMBOK=new et("pmbok","https://exocortex.my/ontology/pmbok#");et.EXOCORTEX_ONTOLOGY_BASE="https://exocortex.my/ontology/";et.KNOWN_NAMESPACES=[et.EXO,et.EMS,et.EXOCMD,et.IMS,et.ZTLK,et.PTMS,et.LIT,et.INBOX,et.PMBOK]});var Wn=w(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.Triple=void 0;var zb=Oe(),Hb=qe(),Kb=Bt(),Qb=class{static{a(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 zb.IRI&&t instanceof zb.IRI||e instanceof Kb.BlankNode&&t instanceof Kb.BlankNode||e instanceof Hb.Literal&&t instanceof Hb.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 zb.IRI?`<${e.value}>`:e instanceof Kb.BlankNode||e instanceof Hb.Literal||this.isQuotedTriple(e)?e.toString():""}};Yh.Triple=Qb});var gf=w(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.QuotedTriple=void 0;var Xb=Oe(),Yb=qe(),Jb=Bt(),Zb=class n{static{a(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 Xb.IRI&&t instanceof Xb.IRI||e instanceof Jb.BlankNode&&t instanceof Jb.BlankNode||e instanceof Yb.Literal&&t instanceof Yb.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 Xb.IRI?`<${e.value}>`:e instanceof Jb.BlankNode||e instanceof Yb.Literal||e instanceof n?e.toString():""}};Jh.QuotedTriple=Zb});var FI=w(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.QuotedTriple=sr.Triple=sr.Namespace=sr.BlankNode=sr.createLiteralFromLanguageTag=sr.createDirectionalLiteral=sr.parseLanguageTag=sr.Literal=sr.IRI=void 0;var jj=Oe();Object.defineProperty(sr,"IRI",{enumerable:!0,get:a(function(){return jj.IRI},"get")});var Zh=qe();Object.defineProperty(sr,"Literal",{enumerable:!0,get:a(function(){return Zh.Literal},"get")});Object.defineProperty(sr,"parseLanguageTag",{enumerable:!0,get:a(function(){return Zh.parseLanguageTag},"get")});Object.defineProperty(sr,"createDirectionalLiteral",{enumerable:!0,get:a(function(){return Zh.createDirectionalLiteral},"get")});Object.defineProperty(sr,"createLiteralFromLanguageTag",{enumerable:!0,get:a(function(){return Zh.createLiteralFromLanguageTag},"get")});var $j=Bt();Object.defineProperty(sr,"BlankNode",{enumerable:!0,get:a(function(){return $j.BlankNode},"get")});var Uj=Jt();Object.defineProperty(sr,"Namespace",{enumerable:!0,get:a(function(){return Uj.Namespace},"get")});var Bj=Wn();Object.defineProperty(sr,"Triple",{enumerable:!0,get:a(function(){return Bj.Triple},"get")});var Vj=gf();Object.defineProperty(sr,"QuotedTriple",{enumerable:!0,get:a(function(){return Vj.QuotedTriple},"get")})});var ep=w(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.UUID_URL_NAMESPACE=ai.DEFAULT_LANGUAGE_TAG=ai.REQUIRED_PROPERTIES=ai.ALLOWED_PROPERTIES=ai.Exo003MetadataType=void 0;var oi;(function(n){n.Namespace="namespace",n.Anchor="anchor",n.BlankNode="blank_node",n.Statement="statement",n.Body="body"})(oi||(ai.Exo003MetadataType=oi={}));ai.ALLOWED_PROPERTIES={[oi.Namespace]:["metadata","uri","aliases"],[oi.Anchor]:["metadata","uri","aliases"],[oi.BlankNode]:["metadata","uri","aliases"],[oi.Statement]:["metadata","subject","predicate","object","aliases"],[oi.Body]:["metadata","subject","predicate","aliases"]};ai.REQUIRED_PROPERTIES={[oi.Namespace]:["metadata","uri"],[oi.Anchor]:["metadata","uri"],[oi.BlankNode]:["metadata","uri"],[oi.Statement]:["metadata","subject","predicate","object"],[oi.Body]:["metadata","subject","predicate"]};ai.DEFAULT_LANGUAGE_TAG="ru";ai.UUID_URL_NAMESPACE="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var LI=w(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});e_.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var NI=w(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});t_.default="00000000-0000-0000-0000-000000000000"});var kI=w(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});r_.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 yf=w(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var Gj=kI();function qj(n){return typeof n=="string"&&Gj.default.test(n)}a(qj,"validate");n_.default=qj});var bf=w(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var Wj=yf();function zj(n){if(!(0,Wj.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)}a(zj,"parse");i_.default=zj});var Js=w(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.unsafeStringify=void 0;var Hj=yf(),Mr=[];for(let n=0;n<256;++n)Mr.push((n+256).toString(16).slice(1));function MI(n,e=0){return(Mr[n[e+0]]+Mr[n[e+1]]+Mr[n[e+2]]+Mr[n[e+3]]+"-"+Mr[n[e+4]]+Mr[n[e+5]]+"-"+Mr[n[e+6]]+Mr[n[e+7]]+"-"+Mr[n[e+8]]+Mr[n[e+9]]+"-"+Mr[n[e+10]]+Mr[n[e+11]]+Mr[n[e+12]]+Mr[n[e+13]]+Mr[n[e+14]]+Mr[n[e+15]]).toLowerCase()}a(MI,"unsafeStringify");_f.unsafeStringify=MI;function Kj(n,e=0){let t=MI(n,e);if(!(0,Hj.default)(t))throw TypeError("Stringified UUID is invalid");return t}a(Kj,"stringify");_f.default=Kj});var np=w(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var Qj=require("crypto"),rp=new Uint8Array(256),tp=rp.length;function Xj(){return tp>rp.length-16&&((0,Qj.randomFillSync)(rp),tp=0),rp.slice(tp,tp+=16)}a(Xj,"rng");s_.default=Xj});var o_=w(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});wf.updateV1State=void 0;var jI=np(),Yj=Js(),Sf={};function Jj(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=$I(n.random??n.rng?.()??(0,jI.default)(),n.msecs,n.nsecs,n.clockseq,n.node,e,t);else{let s=Date.now(),o=(0,jI.default)();UI(Sf,s,o),r=$I(o,Sf.msecs,Sf.nsecs,i?void 0:Sf.clockseq,i?void 0:Sf.node,e,t)}return e??(0,Yj.unsafeStringify)(r)}a(Jj,"v1");function UI(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}a(UI,"updateV1State");wf.updateV1State=UI;function $I(n,e,t,r,i,s,o=0){if(n.length<16)throw new Error("Random bytes length must be >= 16");if(!s)s=new Uint8Array(16),o=0;else if(o<0||o+16>s.length)throw new RangeError(`UUID byte range ${o}:${o+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[o++]=c>>>24&255,s[o++]=c>>>16&255,s[o++]=c>>>8&255,s[o++]=c&255;let l=e/4294967296*1e4&268435455;s[o++]=l>>>8&255,s[o++]=l&255,s[o++]=l>>>24&15|16,s[o++]=l>>>16&255,s[o++]=r>>>8|128,s[o++]=r&255;for(let u=0;u<6;++u)s[o++]=i[u];return s}a($I,"v1Bytes");wf.default=Jj});var c_=w(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var Zj=bf(),e9=Js();function t9(n){let e=typeof n=="string"?(0,Zj.default)(n):n,t=r9(e);return typeof n=="string"?(0,e9.unsafeStringify)(t):t}a(t9,"v1ToV6");a_.default=t9;function r9(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])}a(r9,"_v1ToV6")});var BI=w(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var n9=require("crypto");function i9(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,n9.createHash)("md5").update(n).digest()}a(i9,"md5");l_.default=i9});var vf=w(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.URL=Zs.DNS=Zs.stringToBytes=void 0;var VI=bf(),s9=Js();function GI(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}a(GI,"stringToBytes");Zs.stringToBytes=GI;Zs.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Zs.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function o9(n,e,t,r,i,s){let o=typeof t=="string"?GI(t):t,c=typeof r=="string"?(0,VI.default)(r):r;if(typeof r=="string"&&(r=(0,VI.default)(r)),r?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(c),l.set(o,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,s9.unsafeStringify)(l)}a(o9,"v35");Zs.default=o9});var WI=w(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.URL=Ka.DNS=void 0;var a9=BI(),u_=vf(),qI=vf();Object.defineProperty(Ka,"DNS",{enumerable:!0,get:a(function(){return qI.DNS},"get")});Object.defineProperty(Ka,"URL",{enumerable:!0,get:a(function(){return qI.URL},"get")});function f_(n,e,t,r){return(0,u_.default)(48,a9.default,n,e,t,r)}a(f_,"v3");f_.DNS=u_.DNS;f_.URL=u_.URL;Ka.default=f_});var zI=w(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var c9=require("crypto");d_.default={randomUUID:c9.randomUUID}});var KI=w(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var HI=zI(),l9=np(),u9=Js();function f9(n,e,t){if(HI.default.randomUUID&&!e&&!n)return HI.default.randomUUID();n=n||{};let r=n.random??n.rng?.()??(0,l9.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,u9.unsafeStringify)(r)}a(f9,"v4");h_.default=f9});var QI=w(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var d9=require("crypto");function h9(n){return Array.isArray(n)?n=Buffer.from(n):typeof n=="string"&&(n=Buffer.from(n,"utf8")),(0,d9.createHash)("sha1").update(n).digest()}a(h9,"sha1");p_.default=h9});var YI=w(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.URL=Qa.DNS=void 0;var p9=QI(),m_=vf(),XI=vf();Object.defineProperty(Qa,"DNS",{enumerable:!0,get:a(function(){return XI.DNS},"get")});Object.defineProperty(Qa,"URL",{enumerable:!0,get:a(function(){return XI.URL},"get")});function g_(n,e,t,r){return(0,m_.default)(80,p9.default,n,e,t,r)}a(g_,"v5");g_.DNS=m_.DNS;g_.URL=m_.URL;Qa.default=g_});var JI=w(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var m9=Js(),g9=o_(),y9=c_();function b9(n,e,t){n??={},t??=0;let r=(0,g9.default)({...n,_v6:!0},new Uint8Array(16));if(r=(0,y9.default)(r),e){for(let i=0;i<16;i++)e[t+i]=r[i];return e}return(0,m9.unsafeStringify)(r)}a(b9,"v6");y_.default=b9});var ZI=w(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var _9=bf(),S9=Js();function w9(n){let e=typeof n=="string"?(0,_9.default)(n):n,t=v9(e);return typeof n=="string"?(0,S9.unsafeStringify)(t):t}a(w9,"v6ToV1");b_.default=w9;function v9(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])}a(v9,"_v6ToV1")});var nx=w(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.updateV7State=void 0;var ex=np(),E9=Js(),__={};function T9(n,e,t){let r;if(n)r=tx(n.random??n.rng?.()??(0,ex.default)(),n.msecs,n.seq,e,t);else{let i=Date.now(),s=(0,ex.default)();rx(__,i,s),r=tx(s,__.msecs,__.seq,e,t)}return e??(0,E9.unsafeStringify)(r)}a(T9,"v7");function rx(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}a(rx,"updateV7State");Ef.updateV7State=rx;function tx(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}a(tx,"v7Bytes");Ef.default=T9});var ix=w(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var A9=yf();function I9(n){if(!(0,A9.default)(n))throw TypeError("Invalid UUID");return parseInt(n.slice(14,15),16)}a(I9,"version");S_.default=I9});var Ai=w(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.version=ht.validate=ht.v7=ht.v6ToV1=ht.v6=ht.v5=ht.v4=ht.v3=ht.v1ToV6=ht.v1=ht.stringify=ht.parse=ht.NIL=ht.MAX=void 0;var x9=LI();Object.defineProperty(ht,"MAX",{enumerable:!0,get:a(function(){return x9.default},"get")});var R9=NI();Object.defineProperty(ht,"NIL",{enumerable:!0,get:a(function(){return R9.default},"get")});var P9=bf();Object.defineProperty(ht,"parse",{enumerable:!0,get:a(function(){return P9.default},"get")});var C9=Js();Object.defineProperty(ht,"stringify",{enumerable:!0,get:a(function(){return C9.default},"get")});var O9=o_();Object.defineProperty(ht,"v1",{enumerable:!0,get:a(function(){return O9.default},"get")});var D9=c_();Object.defineProperty(ht,"v1ToV6",{enumerable:!0,get:a(function(){return D9.default},"get")});var F9=WI();Object.defineProperty(ht,"v3",{enumerable:!0,get:a(function(){return F9.default},"get")});var L9=KI();Object.defineProperty(ht,"v4",{enumerable:!0,get:a(function(){return L9.default},"get")});var N9=YI();Object.defineProperty(ht,"v5",{enumerable:!0,get:a(function(){return N9.default},"get")});var k9=JI();Object.defineProperty(ht,"v6",{enumerable:!0,get:a(function(){return k9.default},"get")});var M9=ZI();Object.defineProperty(ht,"v6ToV1",{enumerable:!0,get:a(function(){return M9.default},"get")});var j9=nx();Object.defineProperty(ht,"v7",{enumerable:!0,get:a(function(){return j9.default},"get")});var $9=yf();Object.defineProperty(ht,"validate",{enumerable:!0,get:a(function(){return $9.default},"get")});var U9=ix();Object.defineProperty(ht,"version",{enumerable:!0,get:a(function(){return U9.default},"get")})});var E_=w(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.Exo003UUIDGenerator=void 0;var w_=Ai(),sx=ep(),v_=class{static{a(this,"Exo003UUIDGenerator")}static generateNamespaceUUID(e){if(!e||e.trim().length===0)throw new Error("Namespace URI cannot be empty");return(0,w_.v5)(e,sx.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,w_.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,w_.v5)(e,sx.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)}};ip.Exo003UUIDGenerator=v_});var ax=w(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.Exo003Parser=void 0;var bt=ep(),Tf=E_(),Go=Oe(),sp=qe(),ox=Bt(),B9=Wn(),T_=class{static{a(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===bt.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(bt.Exo003MetadataType).includes(i))return t.push(`Invalid metadata: ${i}. Valid types: ${Object.values(bt.Exo003MetadataType).join(", ")}`),{valid:!1,errors:t,warnings:r};let s=i,o=bt.ALLOWED_PROPERTIES[s],c=bt.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))o.includes(l)||t.push(`Forbidden property for ${s}: ${l}`);switch(s){case bt.Exo003MetadataType.Namespace:this.validateNamespaceMetadata(e,t);break;case bt.Exo003MetadataType.Anchor:this.validateAnchorMetadata(e,t);break;case bt.Exo003MetadataType.BlankNode:this.validateBlankNodeMetadata(e,t);break;case bt.Exo003MetadataType.Statement:this.validateStatementMetadata(e,t);break;case bt.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 bt.Exo003MetadataType.Namespace:return{...r,metadata:bt.Exo003MetadataType.Namespace,uri:e.uri};case bt.Exo003MetadataType.Anchor:return{...r,metadata:bt.Exo003MetadataType.Anchor,uri:e.uri};case bt.Exo003MetadataType.BlankNode:return{...r,metadata:bt.Exo003MetadataType.BlankNode,uri:e.uri};case bt.Exo003MetadataType.Statement:return{...r,metadata:bt.Exo003MetadataType.Statement,subject:e.subject,predicate:e.predicate,object:e.object};case bt.Exo003MetadataType.Body:return{...r,metadata:bt.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 Go.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 Go.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 Go.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,o=[["subject",r],["predicate",i],["object",s]];for(let[c,l]of o)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 Go.IRI(i.value);else if(i.type==="blank")s=new ox.BlankNode(i.value);else throw new Error("Statement subject cannot be a literal");let o=t(e.predicate);if(o.type!=="iri")throw new Error("Statement predicate must be an IRI");let c=new Go.IRI(o.value),l=t(e.object),u;if(l.type==="iri")u=new Go.IRI(l.value);else if(l.type==="blank")u=new ox.BlankNode(l.value);else{let f=r||l.value;if(l.datatype)u=new sp.Literal(f,new Go.IRI(l.datatype));else{let d=l.language||bt.DEFAULT_LANGUAGE_TAG;u=(0,sp.createDirectionalLiteral)(f,d,l.direction)}}return new B9.Triple(s,c,u)}static toLiteral(e,t,r){if(r?.datatype)return new sp.Literal(t,new Go.IRI(r.datatype));let i=r?.language||bt.DEFAULT_LANGUAGE_TAG;return(0,sp.createDirectionalLiteral)(t,i,r?.direction)}static isExo003Format(e){let t=e.metadata;return typeof t=="string"&&Object.values(bt.Exo003MetadataType).includes(t)}static generateUUID(e,t){switch(e.metadata){case bt.Exo003MetadataType.Namespace:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case bt.Exo003MetadataType.Anchor:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case bt.Exo003MetadataType.BlankNode:return Tf.Exo003UUIDGenerator.generateNamespaceUUID(e.uri);case bt.Exo003MetadataType.Statement:{let r=e;return Tf.Exo003UUIDGenerator.generateStatementUUID(r.subject,r.predicate,r.object)}case bt.Exo003MetadataType.Body:{let r=e;return Tf.Exo003UUIDGenerator.generateBodyUUID(r.subject+"|"+r.predicate)}}}};op.Exo003Parser=T_});var A_=w(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.Exo003Parser=Hr.Exo003UUIDGenerator=Hr.UUID_URL_NAMESPACE=Hr.DEFAULT_LANGUAGE_TAG=Hr.REQUIRED_PROPERTIES=Hr.ALLOWED_PROPERTIES=Hr.Exo003MetadataType=void 0;var Af=ep();Object.defineProperty(Hr,"Exo003MetadataType",{enumerable:!0,get:a(function(){return Af.Exo003MetadataType},"get")});Object.defineProperty(Hr,"ALLOWED_PROPERTIES",{enumerable:!0,get:a(function(){return Af.ALLOWED_PROPERTIES},"get")});Object.defineProperty(Hr,"REQUIRED_PROPERTIES",{enumerable:!0,get:a(function(){return Af.REQUIRED_PROPERTIES},"get")});Object.defineProperty(Hr,"DEFAULT_LANGUAGE_TAG",{enumerable:!0,get:a(function(){return Af.DEFAULT_LANGUAGE_TAG},"get")});Object.defineProperty(Hr,"UUID_URL_NAMESPACE",{enumerable:!0,get:a(function(){return Af.UUID_URL_NAMESPACE},"get")});var V9=E_();Object.defineProperty(Hr,"Exo003UUIDGenerator",{enumerable:!0,get:a(function(){return V9.Exo003UUIDGenerator},"get")});var G9=ax();Object.defineProperty(Hr,"Exo003Parser",{enumerable:!0,get:a(function(){return G9.Exo003Parser},"get")})});var eo=w(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});ap.WikiLinkHelpers=void 0;var If=class{static{a(this,"WikiLinkHelpers")}static normalize(e){if(!e)return"";let t=e.replace(this.WIKI_LINK_PATTERN,"").trim();if(!t)return"";let r=t.indexOf("|");if(r===-1)return t;let i=t.substring(0,r).trim(),s=t.substring(r+1).trim();return this.UUID_PATTERN.test(i)&&s||i}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)}static resolveSymbolic(e,t){let r=this.normalize(e);if(!r)return"";if(this.UUID_PATTERN.test(r)){let i=t(r);return i&&i.length>0?i:r}return r}static resolveSymbolicArray(e,t){return e?(Array.isArray(e)?e:[e]).map(i=>this.resolveSymbolic(i,t)).filter(i=>i.length>0):[]}};ap.WikiLinkHelpers=If;If.WIKI_LINK_PATTERN=/\[\[|\]\]/g;If.UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var qo=w(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.CommandBindingProperty=_t.GroundingProperty=_t.PreconditionProperty=_t.CommandProperty=_t.resolveGroundingTypeFromWikilinkLiteral=_t.resolveGroundingTypeFromIRI=_t.GROUNDING_TYPE_IRI_TO_ENUM=_t.GROUNDING_TYPE_UID_TO_ENUM=_t.GROUNDING_TYPE_UIDS=_t.GroundingType=_t.EFFORT_STATUS_OPTIONS=_t.EffortStatus=_t.AssetClass=void 0;var q9=Jc();Object.defineProperty(_t,"AssetClass",{enumerable:!0,get:a(function(){return q9.AssetClass},"get")});var W9=Zc();Object.defineProperty(_t,"EffortStatus",{enumerable:!0,get:a(function(){return W9.EffortStatus},"get")});var z9=$b();Object.defineProperty(_t,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return z9.EFFORT_STATUS_OPTIONS},"get")});var H9=Vo();Object.defineProperty(_t,"GroundingType",{enumerable:!0,get:a(function(){return H9.GroundingType},"get")});var xf=pf();Object.defineProperty(_t,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(_t,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(_t,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return xf.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(_t,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return xf.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(_t,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return xf.resolveGroundingTypeFromWikilinkLiteral},"get")});var cp=Ub();Object.defineProperty(_t,"CommandProperty",{enumerable:!0,get:a(function(){return cp.CommandProperty},"get")});Object.defineProperty(_t,"PreconditionProperty",{enumerable:!0,get:a(function(){return cp.PreconditionProperty},"get")});Object.defineProperty(_t,"GroundingProperty",{enumerable:!0,get:a(function(){return cp.GroundingProperty},"get")});Object.defineProperty(_t,"CommandBindingProperty",{enumerable:!0,get:a(function(){return cp.CommandBindingProperty},"get")})});var fx=w(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.hasClass=Ya;Kr.isAreaOrProject=K9;Kr.isEffort=Q9;Kr.hasStatus=X9;Kr.isAssetArchived=Y9;Kr.hasEmptyProperties=J9;Kr.needsFolderRepair=Z9;Kr.getTodayDateString=I_;Kr.isPlannedForToday=e5;Kr.hasPlannedStartTimestamp=t5;Kr.extractDailyNoteDate=r5;Kr.isCurrentDateGteDay=n5;Kr.inheritsFromPrototype=ux;Kr.isPrototypeClass=s5;var lx=eo(),Xa=qo();function Ya(n,e){return n?(Array.isArray(n)?n:[n]).some(r=>lx.WikiLinkHelpers.normalize(r)===e):!1}a(Ya,"hasClass");function K9(n){return Ya(n,Xa.AssetClass.AREA)||Ya(n,Xa.AssetClass.PROJECT)}a(K9,"isAreaOrProject");function Q9(n){return Ya(n,Xa.AssetClass.TASK)||Ya(n,Xa.AssetClass.PROJECT)||Ya(n,Xa.AssetClass.MEETING)}a(Q9,"isEffort");function X9(n,e){if(!n)return!1;let t=Array.isArray(n)?n[0]:n;return t?lx.WikiLinkHelpers.normalize(t)===e:!1}a(X9,"hasStatus");function Y9(n){if(n===!0||n===1)return!0;if(typeof n=="string"){let e=n.toLowerCase();return e==="true"||e==="yes"}return!1}a(Y9,"isAssetArchived");function J9(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))}a(J9,"hasEmptyProperties");function Z9(n,e){if(!e)return!1;let t=n.replace(/\/$/,""),r=e.replace(/\/$/,"");return t!==r}a(Z9,"needsFolderRepair");function I_(){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}`}a(I_,"getTodayDateString");function e5(n){let e=n.ems__Effort_plannedStartTimestamp;if(!e)return!1;let t=I_();return typeof e=="string"?e.split("T")[0]===t:Array.isArray(e)&&e.length>0?String(e[0]).split("T")[0]===t:!1}a(e5,"isPlannedForToday");function t5(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}a(t5,"hasPlannedStartTimestamp");function r5(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}a(r5,"extractDailyNoteDate");function n5(n){return I_()>=n}a(n5,"isCurrentDateGteDay");function cx(n){return n?n.replace(/^["']|["']$/g,"").replace(/\[\[|\]\]/g,"").trim():""}a(cx,"normalizeWithQuotes");var i5=10;function ux(n,e=i5){let t=n.exo__Class_superClass;if(!t)return!1;let r=new Set,i=[],s=Array.isArray(t)?t:[t];for(let o of s){let c=cx(o);c&&i.push({className:c,depth:0})}for(;i.length>0;){let o=i.shift();if(!o)continue;let{className:c,depth:l}=o;if(l>e)continue;if(c===Xa.AssetClass.PROTOTYPE)return!0;if(r.has(c))continue;r.add(c);let u=`${c}__exo__Class_superClass`,f=n[u];if(f){let d=Array.isArray(f)?f:[f];for(let h of d){let p=cx(h);p&&!r.has(p)&&i.push({className:p,depth:l+1})}}}return!1}a(ux,"inheritsFromPrototype");function s5(n,e){return Ya(n,Xa.AssetClass.CLASS)?ux(e):!1}a(s5,"isPrototypeClass")});var dx=w(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.isPrototypeClass=pt.inheritsFromPrototype=pt.isCurrentDateGteDay=pt.extractDailyNoteDate=pt.hasPlannedStartTimestamp=pt.isPlannedForToday=pt.getTodayDateString=pt.needsFolderRepair=pt.hasEmptyProperties=pt.isAssetArchived=pt.hasStatus=pt.isEffort=pt.isAreaOrProject=pt.hasClass=void 0;var Dn=fx();Object.defineProperty(pt,"hasClass",{enumerable:!0,get:a(function(){return Dn.hasClass},"get")});Object.defineProperty(pt,"isAreaOrProject",{enumerable:!0,get:a(function(){return Dn.isAreaOrProject},"get")});Object.defineProperty(pt,"isEffort",{enumerable:!0,get:a(function(){return Dn.isEffort},"get")});Object.defineProperty(pt,"hasStatus",{enumerable:!0,get:a(function(){return Dn.hasStatus},"get")});Object.defineProperty(pt,"isAssetArchived",{enumerable:!0,get:a(function(){return Dn.isAssetArchived},"get")});Object.defineProperty(pt,"hasEmptyProperties",{enumerable:!0,get:a(function(){return Dn.hasEmptyProperties},"get")});Object.defineProperty(pt,"needsFolderRepair",{enumerable:!0,get:a(function(){return Dn.needsFolderRepair},"get")});Object.defineProperty(pt,"getTodayDateString",{enumerable:!0,get:a(function(){return Dn.getTodayDateString},"get")});Object.defineProperty(pt,"isPlannedForToday",{enumerable:!0,get:a(function(){return Dn.isPlannedForToday},"get")});Object.defineProperty(pt,"hasPlannedStartTimestamp",{enumerable:!0,get:a(function(){return Dn.hasPlannedStartTimestamp},"get")});Object.defineProperty(pt,"extractDailyNoteDate",{enumerable:!0,get:a(function(){return Dn.extractDailyNoteDate},"get")});Object.defineProperty(pt,"isCurrentDateGteDay",{enumerable:!0,get:a(function(){return Dn.isCurrentDateGteDay},"get")});Object.defineProperty(pt,"inheritsFromPrototype",{enumerable:!0,get:a(function(){return Dn.inheritsFromPrototype},"get")});Object.defineProperty(pt,"isPrototypeClass",{enumerable:!0,get:a(function(){return Dn.isPrototypeClass},"get")})});var hx=w(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.TsFloorViolationError=xt.CATALOG_KEEP_NAMESPACES=xt.PLUGIN_UI_FLOOR=xt.SDK_FLOOR=xt.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=xt.SDK_FLOOR_ASSETSPACE_UIDS=xt.TS_FLOOR_AS_UID_SHARED_IDENTITIES=xt.TS_FLOOR_AS_UID_EXOCMD=xt.TS_FLOOR_AS_UID_EXO=void 0;xt.assertTsFloor=o5;xt.assertTsFloorReconciled=a5;xt.TS_FLOOR_AS_UID_EXO="49fd2e56-4656-4ca7-a789-f472b16ea260";xt.TS_FLOOR_AS_UID_EXOCMD="c9c65b0f-1e01-47c1-a1f9-1bf70b11df6a";xt.TS_FLOOR_AS_UID_SHARED_IDENTITIES="0cde1557-6320-4bd0-a7c4-8b72afc38720";xt.SDK_FLOOR_ASSETSPACE_UIDS=new Set([xt.TS_FLOOR_AS_UID_EXO]);xt.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=new Set([xt.TS_FLOOR_AS_UID_EXO]);xt.SDK_FLOOR=[{uid:xt.TS_FLOOR_AS_UID_EXO,namespace:"exo"}];xt.PLUGIN_UI_FLOOR=xt.SDK_FLOOR;xt.CATALOG_KEEP_NAMESPACES=new Set(["registry","profiles"]);var Rf=class extends Error{static{a(this,"TsFloorViolationError")}constructor(e){super(e),this.name="TsFloorViolationError"}};xt.TsFloorViolationError=Rf;function o5(n,e){let t=[];for(let r of e)n.has(r)||t.push(r);if(t.length>0)throw new Rf(`Target profile's declared set excludes TS-floor AssetSpace UID(s): ${t.join(", ")}. Profile switch aborted to prevent runtime self-brick (R24).`)}a(o5,"assertTsFloor");function a5(n,e,t){let r=[];for(let i of t)n.has(i.uid)||e.has(i.namespace)||r.push(`${i.namespace} (${i.uid})`);if(r.length>0)throw new Rf(`Target profile's declared set excludes TS-floor AssetSpace(s): ${r.join(", ")}. Profile switch aborted to prevent runtime self-brick (R24).`)}a(a5,"assertTsFloorReconciled")});var px=w(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});x_.transitiveDependsOnClosure=c5;function c5(n,e){let t=new Set,r=[];for(let i of n)t.has(i)||(t.add(i),r.push(i));for(;r.length>0;){let i=r.shift();if(i===void 0)break;let s=e.get(i);if(s!==void 0)for(let o of s)t.has(o)||(t.add(o),r.push(o))}return t}a(c5,"transitiveDependsOnClosure")});var lp=w(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});Pf.PropertyFieldType=void 0;Pf.rangeToFieldType=f5;var jr;(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"})(jr||(Pf.PropertyFieldType=jr={}));var mx="http://www.w3.org/2001/XMLSchema#",l5="https://exocortex.my/ontology/exo#",u5="https://exocortex.my/ontology/ems#";function f5(n){if(!n)return jr.Unknown;let e=n.trim();if(!e)return jr.Unknown;if(e.startsWith(mx)){let t=e.substring(mx.length);return R_(t)}if(e.startsWith("xsd:")){let t=e.substring(4);return R_(t)}if(e.includes("XMLSchema#")){let t=e.indexOf("XMLSchema#"),r=e.substring(t+10);return R_(r)}return e.startsWith(u5)||e.startsWith("ems:")?d5(e):e.startsWith(l5)||e.startsWith("exo:")||h5(e)?jr.Reference:jr.Text}a(f5,"rangeToFieldType");function R_(n){switch(n.toLowerCase()){case"string":case"normalizedstring":case"token":case"language":case"nmtoken":case"name":case"ncname":case"anyuri":return jr.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 jr.Number;case"date":return jr.Date;case"datetime":case"datetimestamp":return jr.DateTime;case"boolean":return jr.Boolean;case"time":return jr.Timestamp;default:return jr.Text}}a(R_,"xsdTypeToFieldType");function d5(n){let e=n.toLowerCase();return e.includes("effortstatus")?jr.StatusSelect:e.includes("tasksize")?jr.SizeSelect:jr.Reference}a(d5,"emsTypeToFieldType");function h5(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))}a(h5,"isClassReference")});var P_=w(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.propertyNameToUri=p5;Cf.uriToPropertyName=gx;Cf.extractPropertyLabel=m5;function p5(n){return n.replace(/^([a-z]+)__/,"$1:")}a(p5,"propertyNameToUri");function gx(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__")}a(gx,"uriToPropertyName");function m5(n){let r=(n.includes(":")?gx(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())}a(m5,"extractPropertyLabel")});var up={};Sb(up,{__assign:()=>O_,__asyncDelegator:()=>R5,__asyncGenerator:()=>x5,__asyncValues:()=>P5,__await:()=>Of,__awaiter:()=>w5,__classPrivateFieldGet:()=>F5,__classPrivateFieldSet:()=>L5,__createBinding:()=>E5,__decorate:()=>b5,__exportStar:()=>T5,__extends:()=>g5,__generator:()=>v5,__importDefault:()=>D5,__importStar:()=>O5,__makeTemplateObject:()=>C5,__metadata:()=>S5,__param:()=>_5,__read:()=>yx,__rest:()=>y5,__spread:()=>A5,__spreadArrays:()=>I5,__values:()=>D_});function g5(n,e){C_(n,e);function t(){this.constructor=n}a(t,"__"),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function y5(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 b5(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s}function _5(n,e){return function(t,r){e(t,r,n)}}function S5(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function w5(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return a(i,"adopt"),new(t||(t=Promise))(function(s,o){function c(f){try{u(r.next(f))}catch(d){o(d)}}a(c,"fulfilled");function l(f){try{u(r.throw(f))}catch(d){o(d)}}a(l,"rejected");function u(f){f.done?s(f.value):i(f.value).then(c,l)}a(u,"step"),u((r=r.apply(n,e||[])).next())})}function v5(n,e){var t={label:0,sent:a(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},r,i,s,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;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 E5(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]}function T5(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function D_(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:a(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 yx(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){o={error:c}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function A5(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(yx(arguments[e]));return n}function I5(){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],o=0,c=s.length;o<c;o++,i++)r[i]=s[o];return r}function Of(n){return this instanceof Of?(this.v=n,this):new Of(n)}function x5(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(h){r[h]&&(i[h]=function(p){return new Promise(function(y,g){s.push([h,p,y,g])>1||c(h,p)})})}function c(h,p){try{l(r[h](p))}catch(y){d(s[0][3],y)}}function l(h){h.value instanceof Of?Promise.resolve(h.value.v).then(u,f):d(s[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function R5(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(o){return(t=!t)?{value:Of(n[i](o)),done:i==="return"}:s?s(o):o}:s}}function P5(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 D_=="function"?D_(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(o){return new Promise(function(c,l){o=n[s](o),i(c,l,o.done,o.value)})}}function i(s,o,c,l){Promise.resolve(l).then(function(u){s({value:u,done:c})},o)}}function C5(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function O5(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 D5(n){return n&&n.__esModule?n:{default:n}}function F5(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function L5(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 C_,O_,fp=Q4(()=>{C_=a(function(n,e){return C_=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])},C_(n,e)},"extendStatics");a(g5,"__extends");O_=a(function(){return O_=Object.assign||a(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"),O_.apply(this,arguments)},"__assign");a(y5,"__rest");a(b5,"__decorate");a(_5,"__param");a(S5,"__metadata");a(w5,"__awaiter");a(v5,"__generator");a(E5,"__createBinding");a(T5,"__exportStar");a(D_,"__values");a(yx,"__read");a(A5,"__spread");a(I5,"__spreadArrays");a(Of,"__await");a(x5,"__asyncGenerator");a(R5,"__asyncDelegator");a(P5,"__asyncValues");a(C5,"__makeTemplateObject");a(O5,"__importStar");a(D5,"__importDefault");a(F5,"__classPrivateFieldGet");a(L5,"__classPrivateFieldSet")});var N_=w(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var F_;(function(n){n[n.Transient=0]="Transient",n[n.Singleton=1]="Singleton",n[n.ResolutionScoped=2]="ResolutionScoped",n[n.ContainerScoped=3]="ContainerScoped"})(F_||(F_={}));L_.default=F_});var bx=w(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var N5=N_();Object.defineProperty(k_,"Lifecycle",{enumerable:!0,get:a(function(){return N5.default},"get")})});var Ja=w(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.defineInjectionTokenMetadata=Ii.getParamInfo=Ii.INJECTION_TOKEN_METADATA_KEY=void 0;Ii.INJECTION_TOKEN_METADATA_KEY="injectionTokens";function k5(n){let e=Reflect.getMetadata("design:paramtypes",n)||[],t=Reflect.getOwnMetadata(Ii.INJECTION_TOKEN_METADATA_KEY,n)||{};return Object.keys(t).forEach(r=>{e[+r]=t[r]}),e}a(k5,"getParamInfo");Ii.getParamInfo=k5;function M5(n,e){return function(t,r,i){let s=Reflect.getOwnMetadata(Ii.INJECTION_TOKEN_METADATA_KEY,t)||{};s[i]=e?{token:n,transform:e.transformToken,transformArgs:e.args||[]}:n,Reflect.defineMetadata(Ii.INJECTION_TOKEN_METADATA_KEY,s,t)}}a(M5,"defineInjectionTokenMetadata");Ii.defineInjectionTokenMetadata=M5});var M_=w(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.isClassProvider=void 0;function j5(n){return!!n.useClass}a(j5,"isClassProvider");dp.isClassProvider=j5});var j_=w(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});hp.isFactoryProvider=void 0;function $5(n){return!!n.useFactory}a($5,"isFactoryProvider");hp.isFactoryProvider=$5});var mp=w(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.delay=tl.DelayedConstructor=void 0;var pp=class{static{a(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=a(()=>(r||(i=e(this.wrap()),r=!0),i),"delayedObject");return new Proxy(t,this.createHandler(s))}createHandler(e){let t={},r=a(i=>{t[i]=(...s)=>{s[0]=e();let o=Reflect[i];return o(...s)}},"install");return this.reflectMethods.forEach(r),t}};tl.DelayedConstructor=pp;function U5(n){if(typeof n>"u")throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback");return new pp(n)}a(U5,"delay");tl.delay=U5});var gp=w(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.isConstructorToken=gs.isTransformDescriptor=gs.isTokenDescriptor=gs.isNormalToken=void 0;var B5=mp();function V5(n){return typeof n=="string"||typeof n=="symbol"}a(V5,"isNormalToken");gs.isNormalToken=V5;function G5(n){return typeof n=="object"&&"token"in n&&"multiple"in n}a(G5,"isTokenDescriptor");gs.isTokenDescriptor=G5;function q5(n){return typeof n=="object"&&"token"in n&&"transform"in n}a(q5,"isTransformDescriptor");gs.isTransformDescriptor=q5;function W5(n){return typeof n=="function"||n instanceof B5.DelayedConstructor}a(W5,"isConstructorToken");gs.isConstructorToken=W5});var $_=w(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.isTokenProvider=void 0;function z5(n){return!!n.useToken}a(z5,"isTokenProvider");yp.isTokenProvider=z5});var U_=w(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.isValueProvider=void 0;function H5(n){return n.useValue!=null}a(H5,"isValueProvider");bp.isValueProvider=H5});var B_=w(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var K5=M_();Object.defineProperty(Za,"isClassProvider",{enumerable:!0,get:a(function(){return K5.isClassProvider},"get")});var Q5=j_();Object.defineProperty(Za,"isFactoryProvider",{enumerable:!0,get:a(function(){return Q5.isFactoryProvider},"get")});var X5=gp();Object.defineProperty(Za,"isNormalToken",{enumerable:!0,get:a(function(){return X5.isNormalToken},"get")});var Y5=$_();Object.defineProperty(Za,"isTokenProvider",{enumerable:!0,get:a(function(){return Y5.isTokenProvider},"get")});var J5=U_();Object.defineProperty(Za,"isValueProvider",{enumerable:!0,get:a(function(){return J5.isValueProvider},"get")})});var _x=w(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.isProvider=void 0;var Z5=M_(),e$=U_(),t$=$_(),r$=j_();function n$(n){return Z5.isClassProvider(n)||e$.isValueProvider(n)||t$.isTokenProvider(n)||r$.isFactoryProvider(n)}a(n$,"isProvider");_p.isProvider=n$});var q_=w(G_=>{"use strict";Object.defineProperty(G_,"__esModule",{value:!0});var V_=class{static{a(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,[])}};G_.default=V_});var Sx=w(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var i$=q_(),W_=class extends i$.default{static{a(this,"Registry")}};z_.default=W_});var wx=w(K_=>{"use strict";Object.defineProperty(K_,"__esModule",{value:!0});var H_=class{static{a(this,"ResolutionContext")}constructor(){this.scopedResolutions=new Map}};K_.default=H_});var Q_=w(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.formatErrorCtor=void 0;function s$(n,e){return n===null?`at position #${e}`:`"${n.split(",")[e].trim()}" at position #${e}`}a(s$,"formatDependency");function o$(n,e,t=" "){return[n,...e.message.split(`
32
32
  `).map(r=>t+r)].join(`
33
- `)}a(o$,"composeErrorMessage");function a$(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=s$(r,e);return o$(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}a(a$,"formatErrorCtor");Sp.formatErrorCtor=a$});var vx=w(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.isDisposable=void 0;function c$(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}a(c$,"isDisposable");wp.isDisposable=c$});var Tx=w(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.PostResolutionInterceptors=ec.PreResolutionInterceptors=void 0;var Ex=q_(),vp=class extends Ex.default{static{a(this,"PreResolutionInterceptors")}};ec.PreResolutionInterceptors=vp;var Ep=class extends Ex.default{static{a(this,"PostResolutionInterceptors")}};ec.PostResolutionInterceptors=Ep;var X_=class{static{a(this,"Interceptors")}constructor(){this.preResolution=new vp,this.postResolution=new Ep}};ec.default=X_});var Wo=w(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.instance=eo.typeInfo=void 0;var l$=(fp(),Nh(up)),dn=B_(),u$=_x(),Tp=gp(),f$=Sx(),Fn=N_(),Ap=wx(),d$=Q_(),h$=mp(),p$=vx(),m$=Tx();eo.typeInfo=new Map;var Y_=class n{static{a(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new f$.default,this.interceptors=new m$.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:Fn.default.Transient}){this.ensureNotDisposed();let i;if(u$.isProvider(t)?i=t:i={useClass:t},dn.isTokenProvider(i)){let s=[e],o=i;for(;o!=null;){let c=o.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&&dn.isTokenProvider(l.provider)?o=l.provider:o=null}}if((r.lifecycle===Fn.default.Singleton||r.lifecycle==Fn.default.ContainerScoped||r.lifecycle==Fn.default.ResolutionScoped)&&(dn.isValueProvider(i)||dn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${Fn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),dn.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(),dn.isNormalToken(e)){if(dn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:Fn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Fn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!dn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Fn.default.Singleton})}resolve(e,t=new Ap.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&dn.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(Tp.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===Fn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===Fn.default.Singleton,i=e.options.lifecycle===Fn.default.ContainerScoped,s=r||i,o;return dn.isValueProvider(e.provider)?o=e.provider.useValue:dn.isTokenProvider(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):dn.isClassProvider(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):dn.isFactoryProvider(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===Fn.default.ResolutionScoped&&t.scopedResolutions.set(e,o),o}resolveAll(e,t=new Ap.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&dn.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let o=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,o,"All"),o}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=>!dn.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===Fn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===Fn.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 l$.__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 h$.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=eo.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 p$.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return Tp.isTokenDescriptor(r)?Tp.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Ap.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 Ap.default,r.isOptional):this.resolve(r.token,e,r.isOptional):Tp.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(d$.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};eo.instance=new Y_;eo.default=eo.instance});var Ax=w(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});var g$=Ja(),to=Wo(),J_=gp(),y$=Q_();function b$(){return function(n){let e=g$.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return J_.isTokenDescriptor(r)?J_.isTransformDescriptor(r)?r.multiple?to.instance.resolve(r.transform).transform(to.instance.resolveAll(r.token),...r.transformArgs):to.instance.resolve(r.transform).transform(to.instance.resolve(r.token),...r.transformArgs):r.multiple?to.instance.resolveAll(r.token):to.instance.resolve(r.token):J_.isTransformDescriptor(r)?to.instance.resolve(r.transform).transform(to.instance.resolve(r.token),...r.transformArgs):to.instance.resolve(r)}catch(s){let o=i+t.length;throw new Error(y$.formatErrorCtor(n,o,s))}})))}}}}a(b$,"autoInjectable");Z_.default=b$});var Ix=w(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});var _$=Ja();function S$(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return _$.defineInjectionTokenMetadata(t)}a(S$,"inject");eS.default=S$});var Ip=w(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});var w$=Ja(),v$=Wo(),xx=Wo();function E$(n){return function(e){v$.typeInfo.set(e,w$.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{xx.instance.register(t,e)}):xx.instance.register(n.token,e))}}a(E$,"injectable");tS.default=E$});var Rx=w(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});var T$=(fp(),Nh(up)),A$=Wo();function I$(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=T$.__rest(t,["token","options"]);return A$.instance.register(r,s,i)}),e}}a(I$,"registry");rS.default=I$});var Px=w(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});var x$=Ip(),R$=Wo();function P$(){return function(n){x$.default()(n),R$.instance.registerSingleton(n)}}a(P$,"singleton");nS.default=P$});var Cx=w(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var C$=Ja();function O$(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return C$.defineInjectionTokenMetadata(t)}a(O$,"injectAll");iS.default=O$});var Ox=w(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});var D$=Ja();function F$(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return D$.defineInjectionTokenMetadata(r)}a(F$,"injectAllWithTransform");sS.default=F$});var Dx=w(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var L$=Ja();function N$(n,e,...t){return L$.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}a(N$,"injectWithTransform");oS.default=N$});var Fx=w(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});var k$=Ip(),M$=Wo();function j$(n,e){return function(t){k$.default()(t),M$.instance.register(e||t,t,{lifecycle:n})}}a(j$,"scoped");aS.default=j$});var Lx=w(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});var $$=Ax();Object.defineProperty(xi,"autoInjectable",{enumerable:!0,get:a(function(){return $$.default},"get")});var U$=Ix();Object.defineProperty(xi,"inject",{enumerable:!0,get:a(function(){return U$.default},"get")});var B$=Ip();Object.defineProperty(xi,"injectable",{enumerable:!0,get:a(function(){return B$.default},"get")});var V$=Rx();Object.defineProperty(xi,"registry",{enumerable:!0,get:a(function(){return V$.default},"get")});var G$=Px();Object.defineProperty(xi,"singleton",{enumerable:!0,get:a(function(){return G$.default},"get")});var q$=Cx();Object.defineProperty(xi,"injectAll",{enumerable:!0,get:a(function(){return q$.default},"get")});var W$=Ox();Object.defineProperty(xi,"injectAllWithTransform",{enumerable:!0,get:a(function(){return W$.default},"get")});var z$=Dx();Object.defineProperty(xi,"injectWithTransform",{enumerable:!0,get:a(function(){return z$.default},"get")});var H$=Fx();Object.defineProperty(xi,"scoped",{enumerable:!0,get:a(function(){return H$.default},"get")})});var Nx=w(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});function K$(n){let e;return t=>(e==null&&(e=n(t)),e)}a(K$,"instanceCachingFactory");cS.default=K$});var kx=w(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});function Q$(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}a(Q$,"instancePerContainerCachingFactory");lS.default=Q$});var Mx=w(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});function X$(n,e,t,r=!0){let i,s;return o=>{let c=n(o);return(!r||s!==c)&&((s=c)?i=o.resolve(e):i=o.resolve(t)),i}}a(X$,"predicateAwareClassFactory");uS.default=X$});var jx=w(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var Y$=Nx();Object.defineProperty(Df,"instanceCachingFactory",{enumerable:!0,get:a(function(){return Y$.default},"get")});var J$=kx();Object.defineProperty(Df,"instancePerContainerCachingFactory",{enumerable:!0,get:a(function(){return J$.default},"get")});var Z$=Mx();Object.defineProperty(Df,"predicateAwareClassFactory",{enumerable:!0,get:a(function(){return Z$.default},"get")})});var je=w(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});var fS=(fp(),Nh(up));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 e6=bx();Object.defineProperty(zo,"Lifecycle",{enumerable:!0,get:a(function(){return e6.Lifecycle},"get")});fS.__exportStar(Lx(),zo);fS.__exportStar(jx(),zo);fS.__exportStar(B_(),zo);var t6=mp();Object.defineProperty(zo,"delay",{enumerable:!0,get:a(function(){return t6.delay},"get")});var r6=Wo();Object.defineProperty(zo,"container",{enumerable:!0,get:a(function(){return r6.instance},"get")})});var rl=w(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});xp.NullLogger=void 0;xp.NullLogger={debug(){},info(){},warn(){},error(){}}});var il=w(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.bytesToBase64=Ux;nl.base64ToBytes=Bx;nl.base64ToUtf8=n6;nl.utf8ToBase64=i6;var $x=32768;function Ux(n){let e="";for(let t=0;t<n.length;t+=$x)e+=String.fromCharCode(...n.subarray(t,t+$x));return btoa(e)}a(Ux,"bytesToBase64");function Bx(n){let e=n.replace(/\s/g,""),t=e.length%4,r=t===2||t===3?e+"=".repeat(4-t):e,i=atob(r),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);return s}a(Bx,"base64ToBytes");function n6(n){return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(Bx(n))}a(n6,"base64ToUtf8");function i6(n){return Ux(new TextEncoder().encode(n))}a(i6,"utf8ToBase64")});var Rp=w(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.iriToObsidianName=s6;function s6(n){let e=n.match(/^https:\/\/exocortex\.my\/ontology\/([a-z][a-zA-Z0-9]*)#([^#]+)$/);if(e){let[,r,i]=e;return`${r}__${i}`}let t=n.match(/\/([^/]+)\.md$/);return t?t[1]:null}a(s6,"iriToObsidianName")});var Vx=w(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.registerUniversalDefaultLoader=o6;Ho.clearUniversalDefaultLoader=a6;Ho.clearUniversalDefault=c6;Ho.loadUniversalDefault=l6;Ho.mergePropertyDefaults=u6;Ho.mergeInheritanceRules=f6;var Pp=null,ro,Ff=!1;function o6(n){Pp=n,ro=void 0,Ff=!1}a(o6,"registerUniversalDefaultLoader");function a6(){Pp=null,ro=void 0,Ff=!1}a(a6,"clearUniversalDefaultLoader");function c6(){ro=void 0,Ff=!1}a(c6,"clearUniversalDefault");async function l6(){if(ro!==void 0)return ro;if(!Pp)return ro=null,null;try{ro=await Pp()??null}catch(n){Ff||(console.warn("[UniversalDefaultTemplateResolver] loader threw, falling back to legacy primitives:",n),Ff=!0),ro=null}return ro}a(l6,"loadUniversalDefault");function u6(n,e){let t=new Map;for(let s of e)t.set(s.propertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.propertyName);o?(r.push(o),i.add(o.propertyName)):r.push(s)}for(let s of e)i.has(s.propertyName)||r.push(s);return r}a(u6,"mergePropertyDefaults");function f6(n,e){let t=new Map;for(let s of e)t.set(s.targetPropertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.targetPropertyName);o?(r.push(o),i.add(o.targetPropertyName)):r.push(s)}for(let s of e)i.has(s.targetPropertyName)||r.push(s);return r}a(f6,"mergeInheritanceRules")});var hS=w((Uce,Gx)=>{var sl=class{static{a(this,"Wildcard")}constructor(){return d6||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(sl.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(sl.prototype,"termType",{enumerable:!0,value:"Wildcard"});var d6=new sl;Gx.exports.Wildcard=sl});var Wx=w((Vce,qx)=>{var h6=(function(){var n=a(function(L,F,$,z){for($=$||{},z=L.length;z--;$[L[z]]=F);return $},"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],o=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],y=[123,126],g=[1,67],v=[39,45,87],_=[13,16,45,197,224,308],S=[1,87],T=[2,281],I=[1,86],A=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],R=[6,28,29,53,63,70,73,81,83,85],q=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],Y=[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],C=[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],O=[13,16,308],k=[112,132,327,334],H=[13,16,112,132,308],G=[1,111],B=[1,117],Z=[112,132,327,328,334],_e=[13,16,112,132,308,328],ie=[28,29,45,53,87],N=[1,138],j=[1,151],se=[1,128],be=[1,127],W=[1,129],Ee=[1,140],Ve=[1,141],ye=[1,142],ze=[1,143],He=[1,144],Ye=[1,145],Je=[1,147],Ne=[1,148],Ke=[2,457],Be=[1,158],M=[1,159],ee=[1,160],ue=[1,152],de=[1,153],he=[1,156],oe=[1,171],pe=[1,172],me=[1,173],ge=[1,174],we=[1,175],xe=[1,176],Re=[1,167],Pe=[1,168],Se=[1,169],Fe=[1,170],ot=[1,157],nt=[1,166],rt=[1,161],x=[1,162],P=[1,163],D=[1,164],U=[1,165],fe=[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],Et=[1,195],Ot=[6,31,73,81,83,85],Qe=[2,285],te=[1,199],re=[1,201],ne=[6,31,70,73,81,83,85],ae=[2,283],Ge=[1,207],ct=[1,218],lt=[1,223],Lr=[1,219],Rn=[1,225],qn=[1,226],cn=[1,224],bA=[6,63,70,73,81,83,85],_A=[1,236],SA=[2,334],wA=[1,243],vA=[1,241],Nr=[6,193],hh=[2,349],EA=[2,339],$o=[28,128],TA=[47,48,193,272],ph=[47,48,193,242,272],Bc=[47,48,193,242,246,272],Vc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Sr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],AA=[1,271],IA=[1,270],rr=[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],xA=[1,281],RA=[1,280],ln=[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],tf=[45,89],mh=[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],gh=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],yh=[31,89],bh=[48,87],Ma=[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],ls=[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],PA=[1,313],Gc=[6,85],Z0=[6,31,81,83,85],CA=[2,361],Vs=[2,353],ja=[1,343],rf=[31,112,335],Gs=[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],eb=[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],OA=[6,109,193],$a=[31,112],nr=[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],tb=[1,390],rb=[1,391],Uo=[13,16,87,197,308,314],DA=[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],_h=[1,417],Sh=[1,418],FA=[13,16,48,197,229,308],Bo=[6,31,85],LA=[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],nb=[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],Ua=[29,31,85,112,159,160,161,163,164],wh=[1,443],vh=[1,444],NA=[1,449],Ba=[31,112,193,232,318,335],Eh=[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],kA=[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],ib=[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],nf=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],sf=[31,45],MA=[1,507],jA=[1,508],$A=[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],Th=[29,31,85,112,159,160,161,163,164,335],Va=[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],UA=[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],BA=[2,352],sb=[13,16,197,308,314],VA=[1,565],qc=[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],GA=[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],qs=[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],qA=[13,16,87,308],Ws=[2,364],Wc=[29,31,85,112,159,160,161,163,164,193,232,318,335],Ah=[31,112,193,232,272,318,335],zs=[2,359],WA=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ih=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],zA=[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],HA=[2,347],ob={trace:a(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:a(function(F,$,z,ve,We,b,fn){var E=b.length-1;switch(We){case 1:if(b[E-1]=b[E-1]||{},Ze.base&&(b[E-1].base=Ze.base),Ze.base="",b[E-1].prefixes=Ze.prefixes,Ze.prefixes=null,Ze.pathOnly){if(b[E-1].type==="path"||"termType"in b[E-1])return b[E-1];throw new Error("Received full SPARQL query in path only mode")}else if(b[E-1].type==="path"||"termType"in b[E-1])throw new Error("Received only path in full SPARQL mode");if(b[E-1].type==="update"){let Tt={};for(let Ut of b[E-1].updates)if(Ut.updateType==="insert"){let ut={};for(let gt of Ut.insert)if(gt.type==="bgp"||gt.type==="graph")for(let Pn of gt.triples)Pn.subject.termType==="BlankNode"&&(ut[Pn.subject.value]=!0),Pn.predicate.termType==="BlankNode"&&(ut[Pn.predicate.value]=!0),Pn.object.termType==="BlankNode"&&(ut[Pn.object.value]=!0);for(let gt of Object.keys(ut)){if(Tt[gt])throw new Error("Detected reuse blank node across different INSERT DATA clauses");Tt[gt]=!0}}}return b[E-1];case 2:this.$={...b[E-1],...b[E],type:"query"};break;case 4:Ze.base=of(b[E]);break;case 5:Ze.prefixes||(Ze.prefixes={}),b[E-1]=b[E-1].substr(0,b[E-1].length-1),b[E]=of(b[E]),Ze.prefixes[b[E-1]]=b[E];break;case 6:this.$={...b[E-3],...Wa(b[E-2]),...b[E-1],...b[E]};break;case 7:if(!Ze.skipValidation&&(pb(b[E-3].variables.map(Ut=>hb(Ut.expression))).some(Ut=>Ut.aggregation==="count"&&!(Ut.expression instanceof xh))||b[E].group)){for(let Ut of b[E-3].variables)if(Ut.termType==="Variable"){if(!b[E].group||!b[E].group.map(ut=>Qc(ut)).includes(Qc(Ut)))throw Error("Projection of ungrouped variable (?"+Qc(Ut)+")")}else if(hb(Ut.expression).length===0){let ut=B4(Ut.expression);for(let gt of ut)if(!b[E].group||!b[E].group.map||!b[E].group.map(Pn=>Qc(Pn)).includes(Qc(gt)))throw Error("Use of ungrouped variable in projection of operation (?"+Qc(gt)+")")}}let hs=b[E-1].where.filter(Tt=>Tt.type==="query");if(hs.length>0){let Tt=b[E-3].variables.filter(ut=>ut.variable&&ut.variable.value).map(ut=>ut.variable.value),Ut=pb(hs.map(ut=>ut.variables)).map(ut=>ut.value||ut.variable.value);for(let ut of Tt)if(Ut.indexOf(ut)>=0)throw Error("Target id of 'AS' (?"+ut+") already used in subquery")}this.$=Yt(b[E-3],Wa(b[E-2]),b[E-1],b[E]);break;case 8:this.$=Yt({queryType:"CONSTRUCT",template:b[E-3]},Wa(b[E-2]),b[E-1],b[E]);break;case 9:this.$=Yt({queryType:"CONSTRUCT",template:b[E-2]=b[E-2]?b[E-2].triples:[]},Wa(b[E-5]),{where:[{type:"bgp",triples:qa([],b[E-2])}]},b[E]);break;case 10:this.$=Yt({queryType:"DESCRIBE",variables:b[E-3]==="*"?[new xh]:b[E-3]},Wa(b[E-2]),b[E-1],b[E]);break;case 11:this.$=Yt({queryType:"ASK"},Wa(b[E-2]),b[E-1],b[E]);break;case 12:this.$=Yt(b[E-1],{variables:[new xh]});break;case 13:let ff=b[E].map(Tt=>Tt.value||Tt.variable.value),Xc=V4(ff);if(Xc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Xc[0]+")");this.$=Yt(b[E-1],{variables:b[E]});break;case 14:this.$=Yt({queryType:"SELECT"},b[E]&&(b[E-1]=un(b[E]),b[E]={},b[E][b[E-1]]=!0,b[E]));break;case 16:case 27:this.$=zc(b[E-3],{variable:b[E-1]});break;case 17:case 18:this.$=Yt(b[E-3],b[E-2],b[E-1],b[E],{type:"query"});break;case 19:case 58:this.$={iri:b[E],named:!!b[E-1]};break;case 20:this.$={where:b[E].patterns};break;case 21:this.$=Yt(b[E-1],b[E]);break;case 22:this.$=Yt(b[E-2],b[E-1],b[E]);break;case 23:this.$={group:b[E]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=zc(b[E]);break;case 26:this.$=zc(b[E-1]);break;case 29:this.$={having:b[E]};break;case 30:this.$={order:b[E]};break;case 32:this.$=zc(b[E],{descending:!0});break;case 35:this.$={limit:Kc(b[E])};break;case 36:this.$={offset:Kc(b[E])};break;case 37:this.$={limit:Kc(b[E-2]),offset:Kc(b[E])};break;case 38:this.$={limit:Kc(b[E]),offset:Kc(b[E-2])};break;case 39:case 43:this.$={type:"values",values:b[E]};break;case 40:case 84:this.$=b[E-1].map(Tt=>({[b[E-3]]:Tt}));break;case 41:case 85:this.$=b[E-1].map(()=>({}));break;case 42:case 86:var ds=b[E-4].length;b[E-4]=b[E-4].map(ab),this.$=b[E-1].map(function(Tt){if(Tt.length!==ds)throw Error("Inconsistent VALUES length");for(var Ut={},ut=0;ut<ds;ut++)Ut["?"+b[E-4][ut].value]=Tt[ut];return Ut});break;case 44:case 65:case 100:case 126:case 175:this.$=b[E-1];break;case 45:this.$={type:"update",updates:Hs(b[E-2],b[E-1])};break;case 46:this.$=Yt({type:"load",silent:!!b[E-2],source:b[E-1]},b[E]&&{destination:b[E]});break;case 47:this.$={type:un(b[E-2]),silent:!!b[E-1],graph:b[E]};break;case 48:this.$={type:un(b[E-4]),silent:!!b[E-3],source:b[E-2],destination:b[E]};break;case 49:this.$={type:"create",silent:!!b[E-2],graph:{type:"graph",name:b[E]}};break;case 50:this.$={updateType:"insert",insert:iI(b[E])};break;case 51:this.$={updateType:"delete",delete:yb(iI(b[E]))};break;case 52:this.$={updateType:"deletewhere",delete:yb(b[E])};break;case 53:this.$={updateType:"insertdelete",...b[E-4],...b[E-3],...Wa(b[E-2],"using"),where:b[E].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=b[E];break;case 55:this.$={delete:yb(b[E-1]),insert:b[E]||[]};break;case 56:this.$={delete:[],insert:b[E]};break;case 59:this.$={graph:b[E]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:b[E]};break;case 64:this.$={[un(b[E])]:!0};break;case 66:this.$=b[E-1]?us(b[E],[b[E-1]]):us(b[E]);break;case 67:var lf=Yt(b[E-3]||{triples:[]},{type:"graph",name:b[E-5]});this.$=b[E]?[lf,b[E]]:[lf];break;case 68:case 73:this.$={type:"bgp",triples:us(b[E-2],[b[E-1]])};break;case 69:this.$={type:"group",patterns:[b[E-1]]};break;case 70:for(let Tt of b[E-1].filter(Ut=>Ut.type==="bind")){let Ut=b[E-1].indexOf(Tt),ut=new Set;for(let gt of b[E-1].slice(0,Ut))(gt.type==="group"||gt.type==="bgp")&&rI(gt).forEach(Pn=>ut.add(Pn));if(ut.has(Tt.variable.value))throw Error("Variable used to bind is already bound (?"+Tt.variable.value+")")}this.$={type:"group",patterns:b[E-1]};break;case 71:this.$=b[E-1]?us([b[E-1]],b[E]):us(b[E]);break;case 72:this.$=b[E]?[b[E-2],b[E]]:b[E-2];break;case 75:this.$=Yt(b[E],{type:"optional"});break;case 76:this.$=Yt(b[E],{type:"minus"});break;case 77:this.$=Yt(b[E],{type:"graph",name:b[E-1]});break;case 78:this.$=Yt(b[E],{type:"service",name:b[E-1],silent:!!b[E-2]});break;case 79:this.$={type:"filter",expression:b[E]};break;case 80:this.$={type:"bind",variable:b[E-1],expression:b[E-3]};break;case 89:this.$=cf(b[E]);break;case 90:this.$=void 0;break;case 91:this.$=b[E-1].length?{type:"union",patterns:us(b[E-1].map(lb),[lb(b[E])])}:b[E];break;case 95:this.$={...b[E],function:b[E-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Hs(b[E-2],b[E-1]),distinct:!!b[E-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.$=Hs(b[E-2],b[E-1]);break;case 101:this.$=us(b[E-2],[b[E-1]]);break;case 102:case 112:this.$=gb(b[E].map(Tt=>Yt(Ks(b[E-1]),Tt)));break;case 103:this.$=gb(qa(b[E].map(Tt=>Yt(Ks(b[E-1].entity),Tt)),b[E-1].triples));break;case 105:this.$=us([b[E-1]],b[E]);break;case 106:this.$=us(b[E]);break;case 107:this.$=db(b[E-1],b[E]);break;case 109:case 237:this.$=Ze.factory.namedNode(O4);break;case 110:case 118:this.$=Hs(b[E-1],b[E]);break;case 111:this.$=b[E]?{annotation:b[E],object:b[E-1]}:b[E-1];break;case 113:this.$=b[E]?gb(qa(b[E].map(Tt=>Yt(Ks(b[E-1].entity),Tt)),b[E-1].triples)):b[E-1].triples;break;case 114:this.$=db(...b[E-1],b[E]);break;case 116:this.$=db(...b[E]);break;case 117:case 159:case 163:this.$=[b[E-1],b[E]];break;case 119:this.$=b[E]?{object:b[E-1],annotation:b[E]}:b[E-1];break;case 120:this.$=b[E-1].length?Hc("|",Hs(b[E-1],b[E])):b[E];break;case 121:this.$=b[E-1].length?Hc("/",Hs(b[E-1],b[E])):b[E];break;case 122:this.$=b[E]?Hc(b[E],[b[E-1]]):b[E-1];break;case 123:this.$=b[E-1]?Hc(b[E-1],[b[E]]):b[E];break;case 125:case 131:this.$=Hc(b[E-1],[b[E]]);break;case 129:this.$=Hc("|",Hs(b[E-2],b[E-1]));break;case 132:case 134:this.$=$4(b[E-1]);break;case 133:case 135:this.$=U4(b[E-1]);break;case 140:this.$={entity:b[E],triples:[]};break;case 145:this.$=ab(b[E]);break;case 149:this.$=Ze.factory.namedNode(KA);break;case 151:case 153:case 158:case 162:this.$=cb(b[E-1],b[E]);break;case 152:this.$=["||",b[E]];break;case 154:this.$=["&&",b[E]];break;case 156:this.$=kr(b[E-1],[b[E-2],b[E]]);break;case 157:this.$=kr(b[E-2]?"notin":"in",[b[E-3],b[E]]);break;case 160:this.$=["+",cb(b[E-1],b[E])];break;case 161:var Ch=fs(b[E-1].value.replace("-",""),b[E-1].datatype);this.$=["-",cb(Ch,b[E])];break;case 164:this.$=kr("UPLUS",[b[E]]);break;case 165:this.$=kr(b[E-1],[b[E]]);break;case 166:this.$=kr("UMINUS",[b[E]]);break;case 177:this.$=kr(un(b[E-1]));break;case 178:this.$=kr(un(b[E-3]),[b[E-1]]);break;case 179:this.$=cf(kr(un(b[E-3]),[b[E-1]]));break;case 180:this.$=kr(un(b[E-5]),[b[E-3],b[E-1]]);break;case 181:this.$=kr(un(b[E-7]),[b[E-5],b[E-3],b[E-1]]);break;case 182:this.$=cf(kr(un(b[E-7]),[b[E-5],b[E-3],b[E-1]]));break;case 183:this.$=kr(un(b[E-1]),b[E]);break;case 184:this.$=kr("bound",[ab(b[E-1])]);break;case 185:this.$=kr(b[E-1],[]);break;case 186:this.$=kr(b[E-3],[b[E-1]]);break;case 187:this.$=kr(b[E-2]?"notexists":"exists",[lb(b[E])]);break;case 188:case 189:this.$=zc(b[E-1],{type:"aggregate",aggregation:un(b[E-4]),distinct:!!b[E-2]});break;case 190:this.$=zc(b[E-2],{type:"aggregate",aggregation:un(b[E-5]),distinct:!!b[E-3],separator:typeof b[E-1]=="string"?b[E-1]:" "});break;case 192:this.$=fs(b[E]);break;case 193:this.$=N4(b[E-1],un(b[E].substr(1)));break;case 194:this.$=fs(b[E-2],b[E]);break;case 195:case 204:this.$=fs(b[E],QA);break;case 196:case 205:this.$=fs(b[E],XA);break;case 197:case 206:this.$=fs(un(b[E]),YA);break;case 200:this.$=fs(b[E].toLowerCase(),L4);break;case 201:this.$=fs(b[E].substr(1),QA);break;case 202:this.$=fs(b[E].substr(1),XA);break;case 203:this.$=fs(b[E].substr(1).toLowerCase(),YA);break;case 207:case 208:this.$=tI(b[E],1);break;case 209:case 210:this.$=tI(b[E],3);break;case 211:this.$=Ze.factory.namedNode(of(b[E]));break;case 213:var Oh=b[E].indexOf(":"),uf=b[E].substr(0,Oh),Dh=Ze.prefixes[uf];if(!Dh)throw new Error("Unknown prefix: "+uf);var Ht=of(Dh+b[E].substr(Oh+1));this.$=Ze.factory.namedNode(Ht);break;case 214:if(b[E]=b[E].substr(0,b[E].length-1),!(b[E]in Ze.prefixes))throw new Error("Unknown prefix: "+b[E]);var Ht=of(Ze.prefixes[b[E]]);this.$=Ze.factory.namedNode(Ht);break;case 215:this.$=af(b[E].replace(/^(_:)/,""));break;case 216:this.$=af();break;case 217:case 218:case 232:this.$=cf(ub(b[E-3],b[E-2],b[E-1]));break;case 230:case 231:this.$=cf(b[E-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:b[E-1].push(b[E]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[b[E]];break;case 308:b[E-3].push(b[E-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:b[E-2].push(b[E-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:o},{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:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(y,[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:g,87:h},n(v,[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(_,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:S,29:T,52:84,53:I,56:85},{19:88,28:S,29:T,52:89,53:I,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:I},n(A,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(R,[2,263],{34:96}),n(R,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(R,[2,262]),n(q,[2,259]),n(Y,[2,143]),n(Y,[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(C,[2,211]),n(C,[2,212]),n(C,[2,213]),n(C,[2,214]),{19:98,28:S,29:T,52:99,53:I,56:85},{6:[2,309],99:100,193:[1,101]},n(O,[2,311],{101:102,328:[1,103]}),n(k,[2,317],{104:104,328:[1,105]}),n(H,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:G,114:110},{29:G,114:112},{29:G,114:113},{118:114,123:[1,115],125:116,126:B},n(Z,[2,315]),n(Z,[2,316]),n(_e,[2,319]),n(_e,[2,320]),n(_e,[2,321]),n(y,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:g,87:h}),n(ie,[2,269]),n(ie,[2,15]),{13:f,16:d,44:136,45:N,46:120,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(v,[2,14]),n(v,[2,274]),n(v,[2,271]),n(v,[2,272]),n(e,[2,4]),{13:[1,177]},n(fe,[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:d,45:[1,193],55:194,197:Et,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(_,[2,419]),n(Ot,Qe,{20:196,59:197,69:198,70:te}),n(l,[2,250]),{29:re,57:200},n(O,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(ne,ae,{23:204,58:205,62:206,63:Ge}),n(l,[2,252]),{19:208,28:S,29:T,52:209,53:I,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,145:212,172:221,185:213,187:214,231:Lr,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(bA,[2,265],{56:85,35:227,52:228,19:229,28:S,29:T,53:I}),n(q,[2,260]),n(ne,ae,{58:205,62:206,23:230,63:Ge}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:p},n(O,[2,312]),{105:233,112:_A,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(k,[2,318]),n(O,SA,{108:240,133:242,112:wA,132:vA}),n(H,[2,323]),{112:[1,244]},{112:[2,325]},n(Nr,[2,50]),n(A,hh,{135:245,136:246,143:247,144:248,31:EA,112:EA}),n(Nr,[2,51]),n(Nr,[2,52]),n($o,[2,328],{119:249}),{29:G,114:250},n($o,[2,56]),{29:G,114:251},n(y,[2,59]),n(ie,[2,270]),{47:[1,252]},n(TA,[2,150]),n(ph,[2,428],{240:253}),n(Bc,[2,430],{244:254}),n(Bc,[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(Vc,[2,440],{252:264}),n(Sr,[2,448],{260:265}),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Sr,[2,167]),n(Sr,[2,168]),n(Sr,[2,169]),n(Sr,[2,170],{176:269,45:AA,89:IA}),n(Sr,[2,171]),n(Sr,[2,172]),n(Sr,[2,173]),n(Sr,[2,174]),{13:f,16:d,44:136,45:N,46:272,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:xA,89:RA,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(ln,[2,192],{292:[1,286],293:[1,287]}),n(ln,[2,195]),n(ln,[2,196]),n(ln,[2,197]),n(ln,[2,198]),n(ln,[2,199]),n(ln,[2,200]),{13:f,16:d,44:39,55:40,82:j,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(tf,[2,452]),n(tf,[2,453]),n(tf,[2,454]),n(tf,[2,455]),n(tf,[2,456]),{279:[2,458]},n(mh,[2,207]),n(mh,[2,208]),n(mh,[2,209]),n(mh,[2,210]),n(ln,[2,201]),n(ln,[2,202]),n(ln,[2,203]),n(ln,[2,204]),n(ln,[2,205]),n(ln,[2,206]),n(e,[2,5]),n(gh,[2,297],{88:295}),n(yh,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(bh,[2,301]),n(fe,[2,43]),n(fe,[2,82]),n(fe,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(Ma,[2,123]),n(Ma,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(ls,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:Et,223:312,225:308,226:309,229:PA,307:43,308:p},n(c,i,{215:10,214:314}),n(ls,[2,236]),n(ls,[2,237]),n(Gc,[2,6]),n(Z0,[2,287],{60:315,72:316,73:[1,317]}),n(Ot,[2,286]),{13:f,16:d,45:N,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},n([6,31,63,70,73,81,83,85],[2,20]),n(A,CA,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Vs,31:Vs,85:Vs,112:Vs,159:Vs,160:Vs,161:Vs,163:Vs,164:Vs,41:s}),{13:f,16:d,55:331,307:43,308:p},n(O,[2,280]),n(Gc,[2,7]),n(Ot,Qe,{59:197,69:198,20:332,70:te}),n(ne,[2,284]),{64:[1,333]},n(ne,ae,{58:205,62:206,23:334,63:Ge}),n(l,[2,254]),n(A,hh,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:h,139:342,186:339,190:340,195:341,197:ja,307:43,308:p},n(rf,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:d,87:h,197:ja,308:p}),n(Gs,[2,227]),n(Gs,[2,228]),n(Gs,[2,229]),{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,172:221,185:351,187:350,200:348,230:347,231:Lr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:ja,307:43,308:p},n(Gs,[2,146]),n(Gs,[2,147]),n(Gs,[2,148]),n(Gs,[2,149]),{13:f,16:d,44:354,55:355,82:j,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:358,312:cn,313:353},n(eb,[2,215]),n(eb,[2,216]),n(ne,ae,{58:205,62:206,23:359,63:Ge}),n(R,[2,264]),n(bA,[2,266]),n(Gc,[2,11]),n(r,[2,308],{6:[2,310]}),n(Nr,[2,313],{102:360,120:361,121:[1,362]}),n(Nr,[2,47]),n(Nr,[2,63]),n(Nr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Nr,[2,336]),n(Nr,[2,337]),n(Nr,[2,338]),{109:[1,364]},n(OA,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(O,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n($a,[2,341],{137:368}),n($a,[2,340]),{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,145:369,172:221,185:213,187:214,231:Lr,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},{28:[1,370],127:371,128:[1,372]},n($o,[2,330],{124:373,125:374,126:B}),n($o,[2,57]),{44:375,87:h},n(TA,[2,151],{241:376,242:[1,377]}),n(ph,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,247:380,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{250:[1,381]},n(nr,[2,432]),n(nr,[2,433]),n(nr,[2,434]),n(nr,[2,435]),n(nr,[2,436]),n(nr,[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:oe,298:pe,299:me,300:ge,301:we,302:xe}),n(Vc,[2,162],{261:388,262:389,39:tb,338:rb}),n(Sr,[2,164]),n(Sr,[2,165]),n(Sr,[2,166]),n(rr,[2,95]),n(rr,[2,96]),n(nr,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(rr,[2,177]),{13:f,16:d,44:136,45:N,46:395,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:396,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:397,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:398,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:399,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,183]),n(rr,[2,98]),n(nr,[2,381],{180:400}),{87:[1,401]},n(rr,[2,185]),{13:f,16:d,44:136,45:N,46:402,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{29:re,57:403},n(ln,[2,193]),{13:f,16:d,55:404,307:43,308:p},{13:f,16:d,44:39,55:40,87:h,139:342,195:405,197:ja,307:43,308:p},n(Uo,[2,233]),n(Uo,[2,234]),n(Uo,[2,235]),n(DA,[2,459],{281:406,325:[1,407]}),n(nr,[2,463],{284:408,325:[1,409]}),n(nr,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:j,171:413,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},{31:[1,419],89:[1,420]},{29:[1,421]},n(bh,[2,302]),n(gh,[2,367],{167:422}),n(yh,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(bh,[2,371]),n(Ma,[2,122]),n(Ma,[2,417]),n(Ma,[2,413]),n(Ma,[2,414]),n(Ma,[2,415]),n(ls,[2,125]),n(ls,[2,127]),n(ls,[2,128]),n(FA,[2,420],{227:426}),n(ls,[2,130]),{13:f,16:d,55:194,197:Et,223:427,307:43,308:p},{48:[1,428]},n(Bo,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Z0,[2,288]),{64:[1,433]},n(Ot,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:d,45:N,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,276:Je,277:Ne,279:Ke,280:Be,283:M,285:ee,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U}),n(LA,[2,293]),n(nb,[2,92]),n(nb,[2,93]),n(nb,[2,94]),{45:AA,89:IA,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:S,29:T,56:85},{19:438,28:S,29:T,56:85},n(Ua,[2,355],{149:439}),n(Ua,[2,354]),{13:f,16:d,44:215,45:wh,55:220,82:j,87:h,89:lt,156:440,172:221,185:441,203:442,231:vh,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(R,[2,19]),n(Bo,[2,21]),{13:f,16:d,44:450,45:NA,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Gc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(A,[2,386],{31:[2,388]}),n(rf,[2,102]),n(Ba,[2,391],{191:452}),n(A,[2,395],{196:453,198:454}),n(A,[2,108]),n(A,[2,109]),n(rf,[2,103]),n(rf,[2,104]),n(rf,[2,390]),{13:f,16:d,44:215,45:ct,48:[1,455],55:220,82:j,87:h,89:lt,172:221,185:351,187:350,200:456,231:Lr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(Eh,[2,424]),n(kA,[2,136]),n(kA,[2,137]),n(ib,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:ja,307:43,308:p},n(Uo,[2,219]),n(Uo,[2,220]),n(Uo,[2,221]),n(Uo,[2,222]),n(Uo,[2,223]),n(Gc,[2,10]),n(Nr,[2,46]),n(Nr,[2,314]),{112:_A,122:459},n(Nr,[2,62]),n(O,SA,{133:242,108:460,112:wA,132:vA}),n(OA,[2,61]),n(Nr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n($a,[2,351],{146:463,335:[1,464]}),{29:re,57:465},n($o,[2,329]),n(O,[2,332],{129:466,327:[1,467]}),n($o,[2,55]),n($o,[2,331]),{48:[1,468]},n(ph,[2,429]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Bc,[2,431]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,243:470,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Bc,[2,156]),{45:xA,89:RA,179:471},n(Vc,[2,441]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,251:472,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Sr,[2,444],{256:473}),n(Sr,[2,446],{258:474}),n(nr,[2,442]),n(nr,[2,443]),n(Sr,[2,449]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,255:154,257:155,259:475,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(nr,[2,450]),n(nr,[2,451]),n(nr,[2,379],{178:476}),n(nr,[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:d,44:136,45:N,46:482,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{48:[1,483]},{48:[1,484]},n(rr,[2,187]),n(ln,[2,194]),{13:f,16:d,44:39,55:40,82:j,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,320:485},{13:f,16:d,39:[1,487],44:136,45:N,46:488,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,282:486,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(DA,[2,460]),{13:f,16:d,44:136,45:N,46:489,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(nr,[2,464]),{13:f,16:d,44:136,45:N,46:490,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(nr,[2,466]),n(fe,[2,40]),n(gh,[2,298]),n(nf,[2,87]),n(nf,[2,88]),n(nf,[2,89]),n(nf,[2,90]),{13:f,16:d,55:492,82:j,172:493,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,311:494,312:cn,315:491},n(fe,[2,41]),n(yh,[2,300]),n(sf,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:j,171:497,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},{31:[1,498],89:[1,499]},{29:[1,500]},n(bh,[2,372]),{13:f,16:d,48:[2,422],55:194,197:Et,223:312,226:502,228:501,229:PA,307:43,308:p},n(ls,[2,131]),n(ls,[2,126]),n(Bo,[2,22]),n(Bo,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:N,55:323,67:321,68:322,74:505,75:506,76:MA,77:320,78:jA,79:509,87:h,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},n(LA,[2,294]),n($A,[2,69]),n($A,[2,70]),n(Ot,Qe,{59:197,69:198,20:511,70:te}),n(ne,ae,{58:205,62:206,23:512,63:Ge}),{29:[2,375],31:[2,71],84:522,85:o,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(Ua,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:h}),n(Th,[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:h}),{13:f,16:d,44:215,45:wh,55:220,82:j,87:h,89:lt,172:221,185:351,203:536,212:534,231:vh,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(ne,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:d,45:NA,87:h,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,276:Je,277:Ne,279:Ke,280:Be,283:M,285:ee,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U}),n(Va,[2,291]),n(Va,[2,24]),n(Va,[2,25]),{13:f,16:d,44:136,45:N,46:539,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Va,[2,28]),n(ne,ae,{58:205,62:206,23:540,63:Ge}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(Ba,[2,107]),{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,172:221,185:351,187:350,199:543,200:544,231:Lr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(UA,[2,132]),n(Eh,[2,425]),n(UA,[2,133]),{13:f,16:d,44:354,55:355,82:j,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:358,312:cn,313:545},n(Nr,[2,54]),n(Nr,[2,48]),n($a,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n($a,[2,68]),n(A,[2,350],{31:BA,112:BA}),n(Nr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(O,[2,333]),n(ie,[2,16]),n(ph,[2,152]),n(Bc,[2,154]),n(Bc,[2,157]),n(Vc,[2,159]),n(Vc,[2,160],{262:389,261:548,39:tb,338:rb}),n(Vc,[2,161],{262:389,261:549,39:tb,338:rb}),n(Sr,[2,163]),{13:f,16:d,44:136,45:N,46:550,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,178]),n(rr,[2,179]),{13:f,16:d,44:136,45:N,46:551,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:552,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:553,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{48:[1,554],272:[1,555]},n(rr,[2,184]),n(rr,[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:d,55:194,197:Et,223:562,307:43,308:p},n(sb,[2,224]),n(sb,[2,225]),n(sb,[2,226]),{31:[1,563],45:VA,94:564},n(fe,[2,84]),n(gh,[2,368]),n(fe,[2,85]),n(yh,[2,370]),n(sf,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(Bo,[2,35],{83:[1,569]}),n(Bo,[2,36],{81:[1,570]}),n(Z0,[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:d,45:N,76:MA,78:jA,87:h,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,276:Je,277:Ne,279:Ke,280:Be,283:M,285:ee,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U}),n(qc,[2,295]),{45:N,77:572},{45:N,77:573},n(qc,[2,33]),n(qc,[2,34]),{31:[2,275],50:574,84:575,85:o},{31:[2,277],51:576,84:577,85:o},n(Ua,[2,356]),n(GA,[2,357],{152:578,335:[1,579]}),n(qs,[2,74]),{29:re,57:580},{29:re,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(qA,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:N,55:323,67:321,68:322,77:320,79:585,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},{45:[1,586]},n(qs,[2,81]),{29:re,57:587},n(Ua,[2,73]),n(A,[2,362],{29:Ws,31:Ws,85:Ws,112:Ws,159:Ws,160:Ws,161:Ws,163:Ws,164:Ws}),n(Th,[2,112]),n(Wc,[2,401],{206:588}),n(A,[2,405],{209:589,210:590}),n(A,[2,403]),n(A,[2,404]),n(Th,[2,113]),n(Th,[2,400]),{13:f,16:d,44:215,45:wh,48:[1,591],55:220,82:j,87:h,89:lt,172:221,185:351,203:536,212:592,231:vh,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(Eh,[2,426]),n(ib,[2,138]),n(ib,[2,139]),{232:[1,593]},n(Va,[2,292]),{47:[1,595],48:[1,594]},n(Gc,[2,9]),n(Ba,[2,392]),n(Ba,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:ja,308:p}),n(Ba,[2,110],{272:[1,598]}),n(Ah,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n($o,[2,58]),n(Sr,[2,445]),n(Sr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(rr,[2,99]),n(nr,[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(rr,[2,188]),n(rr,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:j,172:493,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,311:494,312:cn,315:611},n(fe,[2,42]),n(sf,[2,304]),{13:f,16:d,55:414,82:j,95:612,171:613,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},{31:[1,614],45:VA,94:615},n(ls,[2,129]),n(FA,[2,421]),{82:[1,616]},{82:[1,617]},n(qc,[2,296]),n(qc,[2,31]),n(qc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(A,CA,{155:330,153:618,154:619,29:zs,31:zs,85:zs,112:zs,159:zs,160:zs,161:zs,163:zs,164:zs}),n(GA,[2,358]),n(qs,[2,75]),n(qs,[2,76]),{29:re,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(qA,[2,366]),n(qs,[2,79]),{13:f,16:d,44:136,45:N,46:622,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(qs,[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(Wc,[2,117]),{13:f,16:d,44:215,45:wh,55:220,82:j,87:h,89:lt,172:221,185:351,203:536,211:626,212:627,231:vh,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(Gs,[2,134]),n(Eh,[2,427]),n(Gs,[2,135]),n(Va,[2,26]),{44:628,87:h},n(Ba,[2,106]),n(Ba,[2,394]),n(A,[2,396]),n(Ah,[2,111]),n(Ah,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:ja,307:43,308:p},n(eb,[2,217]),n(A,hh,{144:248,140:630,143:631,31:[2,343]}),n(rr,[2,97]),n(nr,[2,380]),n(rr,[2,180]),{13:f,16:d,44:136,45:N,46:632,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:633,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:j,171:637,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},n(WA,[2,305]),n(fe,[2,86]),n(sf,[2,374]),n(Bo,[2,37]),n(Bo,[2,38]),n(Ua,[2,72]),n(Ua,[2,360]),n(qs,[2,77]),{29:re,57:638},{47:[1,639]},{29:[2,376]},n(Wc,[2,402]),n(Wc,[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:h}),n(Wc,[2,118],{272:[1,641]}),n(Ih,[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:Re,304:Pe,305:Se,306:Fe},n(nf,[2,218]),n(sf,[2,44]),n(WA,[2,306]),n(qs,[2,78]),{44:651,87:h},n(Wc,[2,116]),n(A,[2,406]),n(Ih,[2,119]),n(Ih,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(Va,[2,27]),n(Ah,[2,230]),n(zA,[2,345],{141:653,335:[1,654]}),n(rr,[2,181]),n(rr,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(A,hh,{144:248,142:657,143:658,31:HA,112:HA}),n(zA,[2,346]),n(qs,[2,80]),n(Ih,[2,231]),n($a,[2,67]),n($a,[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:a(function(F,$){if($.recoverable)this.trace(F);else{var z=new Error(F);throw z.hash=$,z}},"parseError"),parse:a(function(F){var $=this,z=[0],ve=[],We=[null],b=[],fn=this.table,E="",ds=0,lf=0,Ch=0,Oh=2,uf=1,Dh=b.slice.call(arguments,1),Ht=Object.create(this.lexer),hs={yy:{}};for(var ff in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ff)&&(hs.yy[ff]=this.yy[ff]);Ht.setInput(F,hs.yy),hs.yy.lexer=Ht,hs.yy.parser=this,typeof Ht.yylloc>"u"&&(Ht.yylloc={});var Xc=Ht.yylloc;b.push(Xc);var Tt=Ht.options&&Ht.options.ranges;typeof hs.yy.parseError=="function"?this.parseError=hs.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ut(ps){z.length=z.length-2*ps,We.length=We.length-ps,b.length=b.length-ps}a(Ut,"popStack");for(var ut=a(function(){var ps;return ps=Ht.lex()||uf,typeof ps!="number"&&(ps=$.symbols_[ps]||ps),ps},"lex"),gt,Pn,za,ni,rse,bb,Yc={},Fh,Qs,sI,Lh;;){if(za=z[z.length-1],this.defaultActions[za]?ni=this.defaultActions[za]:((gt===null||typeof gt>"u")&&(gt=ut()),ni=fn[za]&&fn[za][gt]),typeof ni>"u"||!ni.length||!ni[0]){var _b="";Lh=[];for(Fh in fn[za])this.terminals_[Fh]&&Fh>Oh&&Lh.push("'"+this.terminals_[Fh]+"'");Ht.showPosition?_b="Parse error on line "+(ds+1)+`:
33
+ `)}a(o$,"composeErrorMessage");function a$(n,e,t){let[,r=null]=n.toString().match(/constructor\(([\w, ]+)\)/)||[],i=s$(r,e);return o$(`Cannot inject the dependency ${i} of "${n.name}" constructor. Reason:`,t)}a(a$,"formatErrorCtor");Sp.formatErrorCtor=a$});var vx=w(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.isDisposable=void 0;function c$(n){return!(typeof n.dispose!="function"||n.dispose.length>0)}a(c$,"isDisposable");wp.isDisposable=c$});var Tx=w(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.PostResolutionInterceptors=ec.PreResolutionInterceptors=void 0;var Ex=q_(),vp=class extends Ex.default{static{a(this,"PreResolutionInterceptors")}};ec.PreResolutionInterceptors=vp;var Ep=class extends Ex.default{static{a(this,"PostResolutionInterceptors")}};ec.PostResolutionInterceptors=Ep;var X_=class{static{a(this,"Interceptors")}constructor(){this.preResolution=new vp,this.postResolution=new Ep}};ec.default=X_});var Wo=w(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.instance=to.typeInfo=void 0;var l$=(fp(),Nh(up)),dn=B_(),u$=_x(),Tp=gp(),f$=Sx(),Fn=N_(),Ap=wx(),d$=Q_(),h$=mp(),p$=vx(),m$=Tx();to.typeInfo=new Map;var Y_=class n{static{a(this,"InternalDependencyContainer")}constructor(e){this.parent=e,this._registry=new f$.default,this.interceptors=new m$.default,this.disposed=!1,this.disposables=new Set}register(e,t,r={lifecycle:Fn.default.Transient}){this.ensureNotDisposed();let i;if(u$.isProvider(t)?i=t:i={useClass:t},dn.isTokenProvider(i)){let s=[e],o=i;for(;o!=null;){let c=o.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&&dn.isTokenProvider(l.provider)?o=l.provider:o=null}}if((r.lifecycle===Fn.default.Singleton||r.lifecycle==Fn.default.ContainerScoped||r.lifecycle==Fn.default.ResolutionScoped)&&(dn.isValueProvider(i)||dn.isFactoryProvider(i)))throw new Error(`Cannot use lifecycle "${Fn.default[r.lifecycle]}" with ValueProviders or FactoryProviders`);return this._registry.set(e,{provider:i,options:r}),this}registerType(e,t){return this.ensureNotDisposed(),dn.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(),dn.isNormalToken(e)){if(dn.isNormalToken(t))return this.register(e,{useToken:t},{lifecycle:Fn.default.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Fn.default.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}let r=e;return t&&!dn.isNormalToken(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Fn.default.Singleton})}resolve(e,t=new Ap.default,r=!1){this.ensureNotDisposed();let i=this.getRegistration(e);if(!i&&dn.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(Tp.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===Fn.default.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);let r=e.options.lifecycle===Fn.default.Singleton,i=e.options.lifecycle===Fn.default.ContainerScoped,s=r||i,o;return dn.isValueProvider(e.provider)?o=e.provider.useValue:dn.isTokenProvider(e.provider)?o=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):dn.isClassProvider(e.provider)?o=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):dn.isFactoryProvider(e.provider)?o=e.provider.useFactory(this):o=this.construct(e.provider,t),e.options.lifecycle===Fn.default.ResolutionScoped&&t.scopedResolutions.set(e,o),o}resolveAll(e,t=new Ap.default,r=!1){this.ensureNotDisposed();let i=this.getAllRegistrations(e);if(!i&&dn.isNormalToken(e)){if(r)return[];throw new Error(`Attempted to resolve unregistered dependency token: "${e.toString()}"`)}if(this.executePreResolutionInterceptor(e,"All"),i){let o=i.map(c=>this.resolveRegistration(c,t));return this.executePostResolutionInterceptor(e,o,"All"),o}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=>!dn.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===Fn.default.ContainerScoped)&&e._registry.setAll(t,r.map(i=>i.options.lifecycle===Fn.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 l$.__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 h$.DelayedConstructor)return e.createProxy(i=>this.resolve(i,t));let r=(()=>{let i=to.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 p$.isDisposable(r)&&this.disposables.add(r),r}resolveParams(e,t){return(r,i)=>{try{return Tp.isTokenDescriptor(r)?Tp.isTransformDescriptor(r)?r.multiple?this.resolve(r.transform).transform(this.resolveAll(r.token,new Ap.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 Ap.default,r.isOptional):this.resolve(r.token,e,r.isOptional):Tp.isTransformDescriptor(r)?this.resolve(r.transform,e).transform(this.resolve(r.token,e),...r.transformArgs):this.resolve(r,e)}catch(s){throw new Error(d$.formatErrorCtor(t,i,s))}}}ensureNotDisposed(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")}};to.instance=new Y_;to.default=to.instance});var Ax=w(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0});var g$=Ja(),ro=Wo(),J_=gp(),y$=Q_();function b$(){return function(n){let e=g$.getParamInfo(n);return class extends n{constructor(...t){super(...t.concat(e.slice(t.length).map((r,i)=>{try{return J_.isTokenDescriptor(r)?J_.isTransformDescriptor(r)?r.multiple?ro.instance.resolve(r.transform).transform(ro.instance.resolveAll(r.token),...r.transformArgs):ro.instance.resolve(r.transform).transform(ro.instance.resolve(r.token),...r.transformArgs):r.multiple?ro.instance.resolveAll(r.token):ro.instance.resolve(r.token):J_.isTransformDescriptor(r)?ro.instance.resolve(r.transform).transform(ro.instance.resolve(r.token),...r.transformArgs):ro.instance.resolve(r)}catch(s){let o=i+t.length;throw new Error(y$.formatErrorCtor(n,o,s))}})))}}}}a(b$,"autoInjectable");Z_.default=b$});var Ix=w(eS=>{"use strict";Object.defineProperty(eS,"__esModule",{value:!0});var _$=Ja();function S$(n,e){let t={token:n,multiple:!1,isOptional:e&&e.isOptional};return _$.defineInjectionTokenMetadata(t)}a(S$,"inject");eS.default=S$});var Ip=w(tS=>{"use strict";Object.defineProperty(tS,"__esModule",{value:!0});var w$=Ja(),v$=Wo(),xx=Wo();function E$(n){return function(e){v$.typeInfo.set(e,w$.getParamInfo(e)),n&&n.token&&(Array.isArray(n.token)?n.token.forEach(t=>{xx.instance.register(t,e)}):xx.instance.register(n.token,e))}}a(E$,"injectable");tS.default=E$});var Rx=w(rS=>{"use strict";Object.defineProperty(rS,"__esModule",{value:!0});var T$=(fp(),Nh(up)),A$=Wo();function I$(n=[]){return function(e){return n.forEach(t=>{var{token:r,options:i}=t,s=T$.__rest(t,["token","options"]);return A$.instance.register(r,s,i)}),e}}a(I$,"registry");rS.default=I$});var Px=w(nS=>{"use strict";Object.defineProperty(nS,"__esModule",{value:!0});var x$=Ip(),R$=Wo();function P$(){return function(n){x$.default()(n),R$.instance.registerSingleton(n)}}a(P$,"singleton");nS.default=P$});var Cx=w(iS=>{"use strict";Object.defineProperty(iS,"__esModule",{value:!0});var C$=Ja();function O$(n,e){let t={token:n,multiple:!0,isOptional:e&&e.isOptional};return C$.defineInjectionTokenMetadata(t)}a(O$,"injectAll");iS.default=O$});var Ox=w(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});var D$=Ja();function F$(n,e,...t){let r={token:n,multiple:!0,transform:e,transformArgs:t};return D$.defineInjectionTokenMetadata(r)}a(F$,"injectAllWithTransform");sS.default=F$});var Dx=w(oS=>{"use strict";Object.defineProperty(oS,"__esModule",{value:!0});var L$=Ja();function N$(n,e,...t){return L$.defineInjectionTokenMetadata(n,{transformToken:e,args:t})}a(N$,"injectWithTransform");oS.default=N$});var Fx=w(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});var k$=Ip(),M$=Wo();function j$(n,e){return function(t){k$.default()(t),M$.instance.register(e||t,t,{lifecycle:n})}}a(j$,"scoped");aS.default=j$});var Lx=w(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});var $$=Ax();Object.defineProperty(xi,"autoInjectable",{enumerable:!0,get:a(function(){return $$.default},"get")});var U$=Ix();Object.defineProperty(xi,"inject",{enumerable:!0,get:a(function(){return U$.default},"get")});var B$=Ip();Object.defineProperty(xi,"injectable",{enumerable:!0,get:a(function(){return B$.default},"get")});var V$=Rx();Object.defineProperty(xi,"registry",{enumerable:!0,get:a(function(){return V$.default},"get")});var G$=Px();Object.defineProperty(xi,"singleton",{enumerable:!0,get:a(function(){return G$.default},"get")});var q$=Cx();Object.defineProperty(xi,"injectAll",{enumerable:!0,get:a(function(){return q$.default},"get")});var W$=Ox();Object.defineProperty(xi,"injectAllWithTransform",{enumerable:!0,get:a(function(){return W$.default},"get")});var z$=Dx();Object.defineProperty(xi,"injectWithTransform",{enumerable:!0,get:a(function(){return z$.default},"get")});var H$=Fx();Object.defineProperty(xi,"scoped",{enumerable:!0,get:a(function(){return H$.default},"get")})});var Nx=w(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});function K$(n){let e;return t=>(e==null&&(e=n(t)),e)}a(K$,"instanceCachingFactory");cS.default=K$});var kx=w(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});function Q$(n){let e=new WeakMap;return t=>{let r=e.get(t);return r==null&&(r=n(t),e.set(t,r)),r}}a(Q$,"instancePerContainerCachingFactory");lS.default=Q$});var Mx=w(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});function X$(n,e,t,r=!0){let i,s;return o=>{let c=n(o);return(!r||s!==c)&&((s=c)?i=o.resolve(e):i=o.resolve(t)),i}}a(X$,"predicateAwareClassFactory");uS.default=X$});var jx=w(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});var Y$=Nx();Object.defineProperty(Df,"instanceCachingFactory",{enumerable:!0,get:a(function(){return Y$.default},"get")});var J$=kx();Object.defineProperty(Df,"instancePerContainerCachingFactory",{enumerable:!0,get:a(function(){return J$.default},"get")});var Z$=Mx();Object.defineProperty(Df,"predicateAwareClassFactory",{enumerable:!0,get:a(function(){return Z$.default},"get")})});var je=w(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});var fS=(fp(),Nh(up));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 e6=bx();Object.defineProperty(zo,"Lifecycle",{enumerable:!0,get:a(function(){return e6.Lifecycle},"get")});fS.__exportStar(Lx(),zo);fS.__exportStar(jx(),zo);fS.__exportStar(B_(),zo);var t6=mp();Object.defineProperty(zo,"delay",{enumerable:!0,get:a(function(){return t6.delay},"get")});var r6=Wo();Object.defineProperty(zo,"container",{enumerable:!0,get:a(function(){return r6.instance},"get")})});var rl=w(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});xp.NullLogger=void 0;xp.NullLogger={debug(){},info(){},warn(){},error(){}}});var il=w(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.bytesToBase64=Ux;nl.base64ToBytes=Bx;nl.base64ToUtf8=n6;nl.utf8ToBase64=i6;var $x=32768;function Ux(n){let e="";for(let t=0;t<n.length;t+=$x)e+=String.fromCharCode(...n.subarray(t,t+$x));return btoa(e)}a(Ux,"bytesToBase64");function Bx(n){let e=n.replace(/\s/g,""),t=e.length%4,r=t===2||t===3?e+"=".repeat(4-t):e,i=atob(r),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);return s}a(Bx,"base64ToBytes");function n6(n){return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(Bx(n))}a(n6,"base64ToUtf8");function i6(n){return Ux(new TextEncoder().encode(n))}a(i6,"utf8ToBase64")});var Rp=w(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.iriToObsidianName=s6;function s6(n){let e=n.match(/^https:\/\/exocortex\.my\/ontology\/([a-z][a-zA-Z0-9]*)#([^#]+)$/);if(e){let[,r,i]=e;return`${r}__${i}`}let t=n.match(/\/([^/]+)\.md$/);return t?t[1]:null}a(s6,"iriToObsidianName")});var Vx=w(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.registerUniversalDefaultLoader=o6;Ho.clearUniversalDefaultLoader=a6;Ho.clearUniversalDefault=c6;Ho.loadUniversalDefault=l6;Ho.mergePropertyDefaults=u6;Ho.mergeInheritanceRules=f6;var Pp=null,no,Ff=!1;function o6(n){Pp=n,no=void 0,Ff=!1}a(o6,"registerUniversalDefaultLoader");function a6(){Pp=null,no=void 0,Ff=!1}a(a6,"clearUniversalDefaultLoader");function c6(){no=void 0,Ff=!1}a(c6,"clearUniversalDefault");async function l6(){if(no!==void 0)return no;if(!Pp)return no=null,null;try{no=await Pp()??null}catch(n){Ff||(console.warn("[UniversalDefaultTemplateResolver] loader threw, falling back to legacy primitives:",n),Ff=!0),no=null}return no}a(l6,"loadUniversalDefault");function u6(n,e){let t=new Map;for(let s of e)t.set(s.propertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.propertyName);o?(r.push(o),i.add(o.propertyName)):r.push(s)}for(let s of e)i.has(s.propertyName)||r.push(s);return r}a(u6,"mergePropertyDefaults");function f6(n,e){let t=new Map;for(let s of e)t.set(s.targetPropertyName,s);let r=[],i=new Set;for(let s of n){let o=t.get(s.targetPropertyName);o?(r.push(o),i.add(o.targetPropertyName)):r.push(s)}for(let s of e)i.has(s.targetPropertyName)||r.push(s);return r}a(f6,"mergeInheritanceRules")});var hS=w((Uce,Gx)=>{var sl=class{static{a(this,"Wildcard")}constructor(){return d6||this}equals(e){return e&&this.termType===e.termType}};Object.defineProperty(sl.prototype,"value",{enumerable:!0,value:"*"});Object.defineProperty(sl.prototype,"termType",{enumerable:!0,value:"Wildcard"});var d6=new sl;Gx.exports.Wildcard=sl});var Wx=w((Vce,qx)=>{var h6=(function(){var n=a(function(L,F,$,z){for($=$||{},z=L.length;z--;$[L[z]]=F);return $},"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],o=[1,27],c=[13,16,45,197,224,229,308],l=[28,29,53],u=[28,53],f=[1,42],d=[1,45],h=[1,41],p=[1,44],y=[123,126],g=[1,67],v=[39,45,87],_=[13,16,45,197,224,308],S=[1,87],T=[2,281],I=[1,86],A=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],R=[6,28,29,53,63,70,73,81,83,85],q=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],Y=[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],C=[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],O=[13,16,308],k=[112,132,327,334],H=[13,16,112,132,308],G=[1,111],B=[1,117],Z=[112,132,327,328,334],_e=[13,16,112,132,308,328],ie=[28,29,45,53,87],N=[1,138],j=[1,151],se=[1,128],be=[1,127],W=[1,129],Ee=[1,140],Ve=[1,141],ye=[1,142],ze=[1,143],He=[1,144],Ye=[1,145],Je=[1,147],Ne=[1,148],Ke=[2,457],Be=[1,158],M=[1,159],ee=[1,160],ue=[1,152],de=[1,153],he=[1,156],oe=[1,171],pe=[1,172],me=[1,173],ge=[1,174],we=[1,175],xe=[1,176],Re=[1,167],Pe=[1,168],Se=[1,169],Fe=[1,170],ot=[1,157],nt=[1,166],rt=[1,161],x=[1,162],P=[1,163],D=[1,164],U=[1,165],fe=[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],Et=[1,195],Ot=[6,31,73,81,83,85],Qe=[2,285],te=[1,199],re=[1,201],ne=[6,31,70,73,81,83,85],ae=[2,283],Ge=[1,207],ct=[1,218],lt=[1,223],Lr=[1,219],Rn=[1,225],qn=[1,226],cn=[1,224],bA=[6,63,70,73,81,83,85],_A=[1,236],SA=[2,334],wA=[1,243],vA=[1,241],Nr=[6,193],hh=[2,349],EA=[2,339],$o=[28,128],TA=[47,48,193,272],ph=[47,48,193,242,272],Bc=[47,48,193,242,246,272],Vc=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],Sr=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],AA=[1,271],IA=[1,270],rr=[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],xA=[1,281],RA=[1,280],ln=[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],tf=[45,89],mh=[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],gh=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],yh=[31,89],bh=[48,87],Ma=[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],ls=[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],PA=[1,313],Gc=[6,85],Z0=[6,31,81,83,85],CA=[2,361],Gs=[2,353],ja=[1,343],rf=[31,112,335],qs=[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],eb=[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],OA=[6,109,193],$a=[31,112],nr=[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],tb=[1,390],rb=[1,391],Uo=[13,16,87,197,308,314],DA=[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],_h=[1,417],Sh=[1,418],FA=[13,16,48,197,229,308],Bo=[6,31,85],LA=[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],nb=[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],Ua=[29,31,85,112,159,160,161,163,164],wh=[1,443],vh=[1,444],NA=[1,449],Ba=[31,112,193,232,318,335],Eh=[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],kA=[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],ib=[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],nf=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],sf=[31,45],MA=[1,507],jA=[1,508],$A=[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],Th=[29,31,85,112,159,160,161,163,164,335],Va=[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],UA=[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],BA=[2,352],sb=[13,16,197,308,314],VA=[1,565],qc=[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],GA=[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],Ws=[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],qA=[13,16,87,308],zs=[2,364],Wc=[29,31,85,112,159,160,161,163,164,193,232,318,335],Ah=[31,112,193,232,272,318,335],Hs=[2,359],WA=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Ih=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],zA=[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],HA=[2,347],ob={trace:a(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:a(function(F,$,z,ve,We,b,fn){var E=b.length-1;switch(We){case 1:if(b[E-1]=b[E-1]||{},Ze.base&&(b[E-1].base=Ze.base),Ze.base="",b[E-1].prefixes=Ze.prefixes,Ze.prefixes=null,Ze.pathOnly){if(b[E-1].type==="path"||"termType"in b[E-1])return b[E-1];throw new Error("Received full SPARQL query in path only mode")}else if(b[E-1].type==="path"||"termType"in b[E-1])throw new Error("Received only path in full SPARQL mode");if(b[E-1].type==="update"){let Tt={};for(let Ut of b[E-1].updates)if(Ut.updateType==="insert"){let ut={};for(let gt of Ut.insert)if(gt.type==="bgp"||gt.type==="graph")for(let Pn of gt.triples)Pn.subject.termType==="BlankNode"&&(ut[Pn.subject.value]=!0),Pn.predicate.termType==="BlankNode"&&(ut[Pn.predicate.value]=!0),Pn.object.termType==="BlankNode"&&(ut[Pn.object.value]=!0);for(let gt of Object.keys(ut)){if(Tt[gt])throw new Error("Detected reuse blank node across different INSERT DATA clauses");Tt[gt]=!0}}}return b[E-1];case 2:this.$={...b[E-1],...b[E],type:"query"};break;case 4:Ze.base=of(b[E]);break;case 5:Ze.prefixes||(Ze.prefixes={}),b[E-1]=b[E-1].substr(0,b[E-1].length-1),b[E]=of(b[E]),Ze.prefixes[b[E-1]]=b[E];break;case 6:this.$={...b[E-3],...Wa(b[E-2]),...b[E-1],...b[E]};break;case 7:if(!Ze.skipValidation&&(pb(b[E-3].variables.map(Ut=>hb(Ut.expression))).some(Ut=>Ut.aggregation==="count"&&!(Ut.expression instanceof xh))||b[E].group)){for(let Ut of b[E-3].variables)if(Ut.termType==="Variable"){if(!b[E].group||!b[E].group.map(ut=>Qc(ut)).includes(Qc(Ut)))throw Error("Projection of ungrouped variable (?"+Qc(Ut)+")")}else if(hb(Ut.expression).length===0){let ut=B4(Ut.expression);for(let gt of ut)if(!b[E].group||!b[E].group.map||!b[E].group.map(Pn=>Qc(Pn)).includes(Qc(gt)))throw Error("Use of ungrouped variable in projection of operation (?"+Qc(gt)+")")}}let hs=b[E-1].where.filter(Tt=>Tt.type==="query");if(hs.length>0){let Tt=b[E-3].variables.filter(ut=>ut.variable&&ut.variable.value).map(ut=>ut.variable.value),Ut=pb(hs.map(ut=>ut.variables)).map(ut=>ut.value||ut.variable.value);for(let ut of Tt)if(Ut.indexOf(ut)>=0)throw Error("Target id of 'AS' (?"+ut+") already used in subquery")}this.$=Yt(b[E-3],Wa(b[E-2]),b[E-1],b[E]);break;case 8:this.$=Yt({queryType:"CONSTRUCT",template:b[E-3]},Wa(b[E-2]),b[E-1],b[E]);break;case 9:this.$=Yt({queryType:"CONSTRUCT",template:b[E-2]=b[E-2]?b[E-2].triples:[]},Wa(b[E-5]),{where:[{type:"bgp",triples:qa([],b[E-2])}]},b[E]);break;case 10:this.$=Yt({queryType:"DESCRIBE",variables:b[E-3]==="*"?[new xh]:b[E-3]},Wa(b[E-2]),b[E-1],b[E]);break;case 11:this.$=Yt({queryType:"ASK"},Wa(b[E-2]),b[E-1],b[E]);break;case 12:this.$=Yt(b[E-1],{variables:[new xh]});break;case 13:let ff=b[E].map(Tt=>Tt.value||Tt.variable.value),Xc=V4(ff);if(Xc.length>0)throw Error("Two or more of the resulting columns have the same name (?"+Xc[0]+")");this.$=Yt(b[E-1],{variables:b[E]});break;case 14:this.$=Yt({queryType:"SELECT"},b[E]&&(b[E-1]=un(b[E]),b[E]={},b[E][b[E-1]]=!0,b[E]));break;case 16:case 27:this.$=zc(b[E-3],{variable:b[E-1]});break;case 17:case 18:this.$=Yt(b[E-3],b[E-2],b[E-1],b[E],{type:"query"});break;case 19:case 58:this.$={iri:b[E],named:!!b[E-1]};break;case 20:this.$={where:b[E].patterns};break;case 21:this.$=Yt(b[E-1],b[E]);break;case 22:this.$=Yt(b[E-2],b[E-1],b[E]);break;case 23:this.$={group:b[E]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=zc(b[E]);break;case 26:this.$=zc(b[E-1]);break;case 29:this.$={having:b[E]};break;case 30:this.$={order:b[E]};break;case 32:this.$=zc(b[E],{descending:!0});break;case 35:this.$={limit:Kc(b[E])};break;case 36:this.$={offset:Kc(b[E])};break;case 37:this.$={limit:Kc(b[E-2]),offset:Kc(b[E])};break;case 38:this.$={limit:Kc(b[E]),offset:Kc(b[E-2])};break;case 39:case 43:this.$={type:"values",values:b[E]};break;case 40:case 84:this.$=b[E-1].map(Tt=>({[b[E-3]]:Tt}));break;case 41:case 85:this.$=b[E-1].map(()=>({}));break;case 42:case 86:var ds=b[E-4].length;b[E-4]=b[E-4].map(ab),this.$=b[E-1].map(function(Tt){if(Tt.length!==ds)throw Error("Inconsistent VALUES length");for(var Ut={},ut=0;ut<ds;ut++)Ut["?"+b[E-4][ut].value]=Tt[ut];return Ut});break;case 44:case 65:case 100:case 126:case 175:this.$=b[E-1];break;case 45:this.$={type:"update",updates:Ks(b[E-2],b[E-1])};break;case 46:this.$=Yt({type:"load",silent:!!b[E-2],source:b[E-1]},b[E]&&{destination:b[E]});break;case 47:this.$={type:un(b[E-2]),silent:!!b[E-1],graph:b[E]};break;case 48:this.$={type:un(b[E-4]),silent:!!b[E-3],source:b[E-2],destination:b[E]};break;case 49:this.$={type:"create",silent:!!b[E-2],graph:{type:"graph",name:b[E]}};break;case 50:this.$={updateType:"insert",insert:iI(b[E])};break;case 51:this.$={updateType:"delete",delete:yb(iI(b[E]))};break;case 52:this.$={updateType:"deletewhere",delete:yb(b[E])};break;case 53:this.$={updateType:"insertdelete",...b[E-4],...b[E-3],...Wa(b[E-2],"using"),where:b[E].patterns};break;case 54:case 57:case 62:case 167:case 191:case 236:this.$=b[E];break;case 55:this.$={delete:yb(b[E-1]),insert:b[E]||[]};break;case 56:this.$={delete:[],insert:b[E]};break;case 59:this.$={graph:b[E]};break;case 60:this.$={type:"graph",default:!0};break;case 61:case 63:this.$={type:"graph",name:b[E]};break;case 64:this.$={[un(b[E])]:!0};break;case 66:this.$=b[E-1]?us(b[E],[b[E-1]]):us(b[E]);break;case 67:var lf=Yt(b[E-3]||{triples:[]},{type:"graph",name:b[E-5]});this.$=b[E]?[lf,b[E]]:[lf];break;case 68:case 73:this.$={type:"bgp",triples:us(b[E-2],[b[E-1]])};break;case 69:this.$={type:"group",patterns:[b[E-1]]};break;case 70:for(let Tt of b[E-1].filter(Ut=>Ut.type==="bind")){let Ut=b[E-1].indexOf(Tt),ut=new Set;for(let gt of b[E-1].slice(0,Ut))(gt.type==="group"||gt.type==="bgp")&&rI(gt).forEach(Pn=>ut.add(Pn));if(ut.has(Tt.variable.value))throw Error("Variable used to bind is already bound (?"+Tt.variable.value+")")}this.$={type:"group",patterns:b[E-1]};break;case 71:this.$=b[E-1]?us([b[E-1]],b[E]):us(b[E]);break;case 72:this.$=b[E]?[b[E-2],b[E]]:b[E-2];break;case 75:this.$=Yt(b[E],{type:"optional"});break;case 76:this.$=Yt(b[E],{type:"minus"});break;case 77:this.$=Yt(b[E],{type:"graph",name:b[E-1]});break;case 78:this.$=Yt(b[E],{type:"service",name:b[E-1],silent:!!b[E-2]});break;case 79:this.$={type:"filter",expression:b[E]};break;case 80:this.$={type:"bind",variable:b[E-1],expression:b[E-3]};break;case 89:this.$=cf(b[E]);break;case 90:this.$=void 0;break;case 91:this.$=b[E-1].length?{type:"union",patterns:us(b[E-1].map(lb),[lb(b[E])])}:b[E];break;case 95:this.$={...b[E],function:b[E-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:Ks(b[E-2],b[E-1]),distinct:!!b[E-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.$=Ks(b[E-2],b[E-1]);break;case 101:this.$=us(b[E-2],[b[E-1]]);break;case 102:case 112:this.$=gb(b[E].map(Tt=>Yt(Qs(b[E-1]),Tt)));break;case 103:this.$=gb(qa(b[E].map(Tt=>Yt(Qs(b[E-1].entity),Tt)),b[E-1].triples));break;case 105:this.$=us([b[E-1]],b[E]);break;case 106:this.$=us(b[E]);break;case 107:this.$=db(b[E-1],b[E]);break;case 109:case 237:this.$=Ze.factory.namedNode(O4);break;case 110:case 118:this.$=Ks(b[E-1],b[E]);break;case 111:this.$=b[E]?{annotation:b[E],object:b[E-1]}:b[E-1];break;case 113:this.$=b[E]?gb(qa(b[E].map(Tt=>Yt(Qs(b[E-1].entity),Tt)),b[E-1].triples)):b[E-1].triples;break;case 114:this.$=db(...b[E-1],b[E]);break;case 116:this.$=db(...b[E]);break;case 117:case 159:case 163:this.$=[b[E-1],b[E]];break;case 119:this.$=b[E]?{object:b[E-1],annotation:b[E]}:b[E-1];break;case 120:this.$=b[E-1].length?Hc("|",Ks(b[E-1],b[E])):b[E];break;case 121:this.$=b[E-1].length?Hc("/",Ks(b[E-1],b[E])):b[E];break;case 122:this.$=b[E]?Hc(b[E],[b[E-1]]):b[E-1];break;case 123:this.$=b[E-1]?Hc(b[E-1],[b[E]]):b[E];break;case 125:case 131:this.$=Hc(b[E-1],[b[E]]);break;case 129:this.$=Hc("|",Ks(b[E-2],b[E-1]));break;case 132:case 134:this.$=$4(b[E-1]);break;case 133:case 135:this.$=U4(b[E-1]);break;case 140:this.$={entity:b[E],triples:[]};break;case 145:this.$=ab(b[E]);break;case 149:this.$=Ze.factory.namedNode(KA);break;case 151:case 153:case 158:case 162:this.$=cb(b[E-1],b[E]);break;case 152:this.$=["||",b[E]];break;case 154:this.$=["&&",b[E]];break;case 156:this.$=kr(b[E-1],[b[E-2],b[E]]);break;case 157:this.$=kr(b[E-2]?"notin":"in",[b[E-3],b[E]]);break;case 160:this.$=["+",cb(b[E-1],b[E])];break;case 161:var Ch=fs(b[E-1].value.replace("-",""),b[E-1].datatype);this.$=["-",cb(Ch,b[E])];break;case 164:this.$=kr("UPLUS",[b[E]]);break;case 165:this.$=kr(b[E-1],[b[E]]);break;case 166:this.$=kr("UMINUS",[b[E]]);break;case 177:this.$=kr(un(b[E-1]));break;case 178:this.$=kr(un(b[E-3]),[b[E-1]]);break;case 179:this.$=cf(kr(un(b[E-3]),[b[E-1]]));break;case 180:this.$=kr(un(b[E-5]),[b[E-3],b[E-1]]);break;case 181:this.$=kr(un(b[E-7]),[b[E-5],b[E-3],b[E-1]]);break;case 182:this.$=cf(kr(un(b[E-7]),[b[E-5],b[E-3],b[E-1]]));break;case 183:this.$=kr(un(b[E-1]),b[E]);break;case 184:this.$=kr("bound",[ab(b[E-1])]);break;case 185:this.$=kr(b[E-1],[]);break;case 186:this.$=kr(b[E-3],[b[E-1]]);break;case 187:this.$=kr(b[E-2]?"notexists":"exists",[lb(b[E])]);break;case 188:case 189:this.$=zc(b[E-1],{type:"aggregate",aggregation:un(b[E-4]),distinct:!!b[E-2]});break;case 190:this.$=zc(b[E-2],{type:"aggregate",aggregation:un(b[E-5]),distinct:!!b[E-3],separator:typeof b[E-1]=="string"?b[E-1]:" "});break;case 192:this.$=fs(b[E]);break;case 193:this.$=N4(b[E-1],un(b[E].substr(1)));break;case 194:this.$=fs(b[E-2],b[E]);break;case 195:case 204:this.$=fs(b[E],QA);break;case 196:case 205:this.$=fs(b[E],XA);break;case 197:case 206:this.$=fs(un(b[E]),YA);break;case 200:this.$=fs(b[E].toLowerCase(),L4);break;case 201:this.$=fs(b[E].substr(1),QA);break;case 202:this.$=fs(b[E].substr(1),XA);break;case 203:this.$=fs(b[E].substr(1).toLowerCase(),YA);break;case 207:case 208:this.$=tI(b[E],1);break;case 209:case 210:this.$=tI(b[E],3);break;case 211:this.$=Ze.factory.namedNode(of(b[E]));break;case 213:var Oh=b[E].indexOf(":"),uf=b[E].substr(0,Oh),Dh=Ze.prefixes[uf];if(!Dh)throw new Error("Unknown prefix: "+uf);var Ht=of(Dh+b[E].substr(Oh+1));this.$=Ze.factory.namedNode(Ht);break;case 214:if(b[E]=b[E].substr(0,b[E].length-1),!(b[E]in Ze.prefixes))throw new Error("Unknown prefix: "+b[E]);var Ht=of(Ze.prefixes[b[E]]);this.$=Ze.factory.namedNode(Ht);break;case 215:this.$=af(b[E].replace(/^(_:)/,""));break;case 216:this.$=af();break;case 217:case 218:case 232:this.$=cf(ub(b[E-3],b[E-2],b[E-1]));break;case 230:case 231:this.$=cf(b[E-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:b[E-1].push(b[E]);break;case 259:case 269:case 291:case 293:case 295:case 301:case 305:case 371:case 424:case 426:this.$=[b[E]];break;case 308:b[E-3].push(b[E-2]);break;case 350:case 362:case 376:case 380:case 382:case 386:case 396:case 406:case 410:case 412:case 421:b[E-2].push(b[E-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:o},{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:d,33:35,39:[1,37],44:39,55:40,87:h,139:38,307:43,308:p,323:36},n(l,[2,267],{37:46}),n(y,[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:g,87:h},n(v,[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(_,[2,418],{218:80,222:81,229:[1,82]}),{19:83,28:S,29:T,52:84,53:I,56:85},{19:88,28:S,29:T,52:89,53:I,56:85},n(l,[2,253],{26:90}),{28:[1,91],52:92,53:I},n(A,[2,385],{181:93,182:94,183:95,31:[2,383]}),n(R,[2,263],{34:96}),n(R,[2,261],{44:39,55:40,307:43,139:97,13:f,16:d,87:h,308:p}),n(R,[2,262]),n(q,[2,259]),n(Y,[2,143]),n(Y,[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(C,[2,211]),n(C,[2,212]),n(C,[2,213]),n(C,[2,214]),{19:98,28:S,29:T,52:99,53:I,56:85},{6:[2,309],99:100,193:[1,101]},n(O,[2,311],{101:102,328:[1,103]}),n(k,[2,317],{104:104,328:[1,105]}),n(H,[2,322],{107:106,328:[1,107]}),{111:108,112:[2,324],328:[1,109]},{29:G,114:110},{29:G,114:112},{29:G,114:113},{118:114,123:[1,115],125:116,126:B},n(Z,[2,315]),n(Z,[2,316]),n(_e,[2,319]),n(_e,[2,320]),n(_e,[2,321]),n(y,[2,327]),{13:f,16:d,55:118,307:43,308:p},n(l,[2,12]),n(l,[2,13],{44:66,43:119,45:g,87:h}),n(ie,[2,269]),n(ie,[2,15]),{13:f,16:d,44:136,45:N,46:120,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(v,[2,14]),n(v,[2,274]),n(v,[2,271]),n(v,[2,272]),n(e,[2,4]),{13:[1,177]},n(fe,[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:d,45:[1,193],55:194,197:Et,219:189,220:190,223:191,224:[1,192],307:43,308:p},n(_,[2,419]),n(Ot,Qe,{20:196,59:197,69:198,70:te}),n(l,[2,250]),{29:re,57:200},n(O,[2,279],{54:202,327:[1,203]}),{29:[2,282]},n(ne,ae,{23:204,58:205,62:206,63:Ge}),n(l,[2,252]),{19:208,28:S,29:T,52:209,53:I,56:85},{29:[1,210]},n(u,[2,256]),{31:[1,211]},{31:[2,384]},{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,145:212,172:221,185:213,187:214,231:Lr,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(bA,[2,265],{56:85,35:227,52:228,19:229,28:S,29:T,53:I}),n(q,[2,260]),n(ne,ae,{58:205,62:206,23:230,63:Ge}),n(l,[2,268]),{6:[2,45]},n(e,t,{10:3,4:231}),{13:f,16:d,55:232,307:43,308:p},n(O,[2,312]),{105:233,112:_A,122:234,132:[1,237],134:235,327:[1,238],334:[1,239]},n(k,[2,318]),n(O,SA,{108:240,133:242,112:wA,132:vA}),n(H,[2,323]),{112:[1,244]},{112:[2,325]},n(Nr,[2,50]),n(A,hh,{135:245,136:246,143:247,144:248,31:EA,112:EA}),n(Nr,[2,51]),n(Nr,[2,52]),n($o,[2,328],{119:249}),{29:G,114:250},n($o,[2,56]),{29:G,114:251},n(y,[2,59]),n(ie,[2,270]),{47:[1,252]},n(TA,[2,150]),n(ph,[2,428],{240:253}),n(Bc,[2,430],{244:254}),n(Bc,[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(Vc,[2,440],{252:264}),n(Sr,[2,448],{260:265}),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,255:154,257:155,264:266,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,255:154,257:155,264:267,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,255:154,257:155,264:268,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Sr,[2,167]),n(Sr,[2,168]),n(Sr,[2,169]),n(Sr,[2,170],{176:269,45:AA,89:IA}),n(Sr,[2,171]),n(Sr,[2,172]),n(Sr,[2,173]),n(Sr,[2,174]),{13:f,16:d,44:136,45:N,46:272,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,176]),{89:[1,273]},{45:[1,274]},{45:[1,275]},{45:[1,276]},{45:[1,277]},{45:[1,278]},{45:xA,89:RA,179:279},{45:[1,282]},{45:[1,284],89:[1,283]},{279:[1,285]},n(ln,[2,192],{292:[1,286],293:[1,287]}),n(ln,[2,195]),n(ln,[2,196]),n(ln,[2,197]),n(ln,[2,198]),n(ln,[2,199]),n(ln,[2,200]),{13:f,16:d,44:39,55:40,82:j,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,320:288},{45:[1,292]},{45:[1,293]},{45:[1,294]},n(tf,[2,452]),n(tf,[2,453]),n(tf,[2,454]),n(tf,[2,455]),n(tf,[2,456]),{279:[2,458]},n(mh,[2,207]),n(mh,[2,208]),n(mh,[2,209]),n(mh,[2,210]),n(ln,[2,201]),n(ln,[2,202]),n(ln,[2,203]),n(ln,[2,204]),n(ln,[2,205]),n(ln,[2,206]),n(e,[2,5]),n(gh,[2,297],{88:295}),n(yh,[2,299],{90:296}),{48:[1,297],87:[1,298]},n(bh,[2,301]),n(fe,[2,43]),n(fe,[2,82]),n(fe,[2,83]),{29:[1,299]},{29:[1,300]},{87:[1,302],169:301},n(c,[2,412]),n(Ma,[2,123]),n(Ma,[2,416],{221:303,339:304,39:[1,306],263:[1,307],340:[1,305]}),n(ls,[2,124]),{13:f,16:d,45:[1,311],55:194,89:[1,310],197:Et,223:312,225:308,226:309,229:PA,307:43,308:p},n(c,i,{215:10,214:314}),n(ls,[2,236]),n(ls,[2,237]),n(Gc,[2,6]),n(Z0,[2,287],{60:315,72:316,73:[1,317]}),n(Ot,[2,286]),{13:f,16:d,45:N,55:323,67:321,68:322,71:318,77:320,79:319,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},n([6,31,63,70,73,81,83,85],[2,20]),n(A,CA,{38:17,49:324,147:325,17:326,21:327,148:328,154:329,155:330,29:Gs,31:Gs,85:Gs,112:Gs,159:Gs,160:Gs,161:Gs,163:Gs,164:Gs,41:s}),{13:f,16:d,55:331,307:43,308:p},n(O,[2,280]),n(Gc,[2,7]),n(Ot,Qe,{59:197,69:198,20:332,70:te}),n(ne,[2,284]),{64:[1,333]},n(ne,ae,{58:205,62:206,23:334,63:Ge}),n(l,[2,254]),n(A,hh,{144:248,30:335,143:336,31:[2,257]}),n(l,[2,100]),{31:[2,387],184:337,335:[1,338]},{13:f,16:d,44:39,55:40,87:h,139:342,186:339,190:340,195:341,197:ja,307:43,308:p},n(rf,[2,389],{44:39,55:40,307:43,190:340,195:341,139:342,188:344,189:345,186:346,13:f,16:d,87:h,197:ja,308:p}),n(qs,[2,227]),n(qs,[2,228]),n(qs,[2,229]),{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,172:221,185:351,187:350,200:348,230:347,231:Lr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},{13:f,16:d,44:39,55:40,87:h,139:342,186:352,190:340,195:341,197:ja,307:43,308:p},n(qs,[2,146]),n(qs,[2,147]),n(qs,[2,148]),n(qs,[2,149]),{13:f,16:d,44:354,55:355,82:j,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:358,312:cn,313:353},n(eb,[2,215]),n(eb,[2,216]),n(ne,ae,{58:205,62:206,23:359,63:Ge}),n(R,[2,264]),n(bA,[2,266]),n(Gc,[2,11]),n(r,[2,308],{6:[2,310]}),n(Nr,[2,313],{102:360,120:361,121:[1,362]}),n(Nr,[2,47]),n(Nr,[2,63]),n(Nr,[2,64]),{13:f,16:d,55:363,307:43,308:p},n(Nr,[2,336]),n(Nr,[2,337]),n(Nr,[2,338]),{109:[1,364]},n(OA,[2,60]),{13:f,16:d,55:365,307:43,308:p},n(O,[2,335]),{13:f,16:d,55:366,307:43,308:p},{31:[1,367]},n($a,[2,341],{137:368}),n($a,[2,340]),{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,145:369,172:221,185:213,187:214,231:Lr,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},{28:[1,370],127:371,128:[1,372]},n($o,[2,330],{124:373,125:374,126:B}),n($o,[2,57]),{44:375,87:h},n(TA,[2,151],{241:376,242:[1,377]}),n(ph,[2,153],{245:378,246:[1,379]}),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,247:380,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{250:[1,381]},n(nr,[2,432]),n(nr,[2,433]),n(nr,[2,434]),n(nr,[2,435]),n(nr,[2,436]),n(nr,[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:oe,298:pe,299:me,300:ge,301:we,302:xe}),n(Vc,[2,162],{261:388,262:389,39:tb,338:rb}),n(Sr,[2,164]),n(Sr,[2,165]),n(Sr,[2,166]),n(rr,[2,95]),n(rr,[2,96]),n(nr,[2,377],{177:392,325:[1,393]}),{48:[1,394]},n(rr,[2,177]),{13:f,16:d,44:136,45:N,46:395,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:396,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:397,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:398,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:399,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,183]),n(rr,[2,98]),n(nr,[2,381],{180:400}),{87:[1,401]},n(rr,[2,185]),{13:f,16:d,44:136,45:N,46:402,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{29:re,57:403},n(ln,[2,193]),{13:f,16:d,55:404,307:43,308:p},{13:f,16:d,44:39,55:40,87:h,139:342,195:405,197:ja,307:43,308:p},n(Uo,[2,233]),n(Uo,[2,234]),n(Uo,[2,235]),n(DA,[2,459],{281:406,325:[1,407]}),n(nr,[2,463],{284:408,325:[1,409]}),n(nr,[2,465],{286:410,325:[1,411]}),{13:f,16:d,31:[1,412],55:414,82:j,171:413,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},{31:[1,419],89:[1,420]},{29:[1,421]},n(bh,[2,302]),n(gh,[2,367],{167:422}),n(yh,[2,369],{168:423}),{48:[1,424],87:[1,425]},n(bh,[2,371]),n(Ma,[2,122]),n(Ma,[2,417]),n(Ma,[2,413]),n(Ma,[2,414]),n(Ma,[2,415]),n(ls,[2,125]),n(ls,[2,127]),n(ls,[2,128]),n(FA,[2,420],{227:426}),n(ls,[2,130]),{13:f,16:d,55:194,197:Et,223:427,307:43,308:p},{48:[1,428]},n(Bo,[2,289],{61:429,80:430,81:[1,431],83:[1,432]}),n(Z0,[2,288]),{64:[1,433]},n(Ot,[2,29],{307:43,267:139,275:146,278:149,77:320,67:321,68:322,55:323,79:434,13:f,16:d,45:N,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,276:Je,277:Ne,279:Ke,280:Be,283:M,285:ee,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U}),n(LA,[2,293]),n(nb,[2,92]),n(nb,[2,93]),n(nb,[2,94]),{45:AA,89:IA,176:269},{31:[1,435]},{31:[1,436]},{19:437,28:S,29:T,56:85},{19:438,28:S,29:T,56:85},n(Ua,[2,355],{149:439}),n(Ua,[2,354]),{13:f,16:d,44:215,45:wh,55:220,82:j,87:h,89:lt,156:440,172:221,185:441,203:442,231:vh,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(R,[2,19]),n(Bo,[2,21]),{13:f,16:d,44:450,45:NA,55:323,65:445,66:446,67:447,68:448,87:h,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Gc,[2,8]),{31:[1,451]},{31:[2,258]},{31:[2,101]},n(A,[2,386],{31:[2,388]}),n(rf,[2,102]),n(Ba,[2,391],{191:452}),n(A,[2,395],{196:453,198:454}),n(A,[2,108]),n(A,[2,109]),n(rf,[2,103]),n(rf,[2,104]),n(rf,[2,390]),{13:f,16:d,44:215,45:ct,48:[1,455],55:220,82:j,87:h,89:lt,172:221,185:351,187:350,200:456,231:Lr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(Eh,[2,424]),n(kA,[2,136]),n(kA,[2,137]),n(ib,[2,140]),{232:[1,457]},{13:f,16:d,44:39,55:40,87:h,139:342,195:458,197:ja,307:43,308:p},n(Uo,[2,219]),n(Uo,[2,220]),n(Uo,[2,221]),n(Uo,[2,222]),n(Uo,[2,223]),n(Gc,[2,10]),n(Nr,[2,46]),n(Nr,[2,314]),{112:_A,122:459},n(Nr,[2,62]),n(O,SA,{133:242,108:460,112:wA,132:vA}),n(OA,[2,61]),n(Nr,[2,49]),n([6,28,126,128,193],[2,65]),{31:[2,66],112:[1,462],138:461},n($a,[2,351],{146:463,335:[1,464]}),{29:re,57:465},n($o,[2,329]),n(O,[2,332],{129:466,327:[1,467]}),n($o,[2,55]),n($o,[2,331]),{48:[1,468]},n(ph,[2,429]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,239:469,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Bc,[2,431]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,243:470,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Bc,[2,156]),{45:xA,89:RA,179:471},n(Vc,[2,441]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,251:472,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Sr,[2,444],{256:473}),n(Sr,[2,446],{258:474}),n(nr,[2,442]),n(nr,[2,443]),n(Sr,[2,449]),{13:f,16:d,44:136,45:N,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,255:154,257:155,259:475,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(nr,[2,450]),n(nr,[2,451]),n(nr,[2,379],{178:476}),n(nr,[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:d,44:136,45:N,46:482,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{48:[1,483]},{48:[1,484]},n(rr,[2,187]),n(ln,[2,194]),{13:f,16:d,44:39,55:40,82:j,87:h,139:289,172:291,255:154,257:155,266:290,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,320:485},{13:f,16:d,39:[1,487],44:136,45:N,46:488,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,282:486,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(DA,[2,460]),{13:f,16:d,44:136,45:N,46:489,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(nr,[2,464]),{13:f,16:d,44:136,45:N,46:490,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(nr,[2,466]),n(fe,[2,40]),n(gh,[2,298]),n(nf,[2,87]),n(nf,[2,88]),n(nf,[2,89]),n(nf,[2,90]),{13:f,16:d,55:492,82:j,172:493,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,311:494,312:cn,315:491},n(fe,[2,41]),n(yh,[2,300]),n(sf,[2,303],{92:495}),{13:f,16:d,31:[1,496],55:414,82:j,171:497,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},{31:[1,498],89:[1,499]},{29:[1,500]},n(bh,[2,372]),{13:f,16:d,48:[2,422],55:194,197:Et,223:312,226:502,228:501,229:PA,307:43,308:p},n(ls,[2,131]),n(ls,[2,126]),n(Bo,[2,22]),n(Bo,[2,290]),{82:[1,503]},{82:[1,504]},{13:f,16:d,44:510,45:N,55:323,67:321,68:322,74:505,75:506,76:MA,77:320,78:jA,79:509,87:h,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},n(LA,[2,294]),n($A,[2,69]),n($A,[2,70]),n(Ot,Qe,{59:197,69:198,20:511,70:te}),n(ne,ae,{58:205,62:206,23:512,63:Ge}),{29:[2,375],31:[2,71],84:522,85:o,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(Ua,[2,363],{157:524,335:[1,525]}),n(c,i,{215:10,202:526,205:527,208:528,214:529,44:530,87:h}),n(Th,[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:h}),{13:f,16:d,44:215,45:wh,55:220,82:j,87:h,89:lt,172:221,185:351,203:536,212:534,231:vh,233:533,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(c,i,{215:10,205:527,208:528,214:529,44:530,202:537,87:h}),n(ne,[2,23],{307:43,267:139,275:146,278:149,55:323,67:447,68:448,44:450,66:538,13:f,16:d,45:NA,87:h,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,276:Je,277:Ne,279:Ke,280:Be,283:M,285:ee,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U}),n(Va,[2,291]),n(Va,[2,24]),n(Va,[2,25]),{13:f,16:d,44:136,45:N,46:539,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Va,[2,28]),n(ne,ae,{58:205,62:206,23:540,63:Ge}),n([31,112,232,318,335],[2,105],{192:541,193:[1,542]}),n(Ba,[2,107]),{13:f,16:d,44:215,45:ct,55:220,82:j,87:h,89:lt,172:221,185:351,187:350,199:543,200:544,231:Lr,234:349,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(UA,[2,132]),n(Eh,[2,425]),n(UA,[2,133]),{13:f,16:d,44:354,55:355,82:j,87:h,172:357,237:356,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:358,312:cn,313:545},n(Nr,[2,54]),n(Nr,[2,48]),n($a,[2,342]),{13:f,16:d,44:39,55:40,87:h,139:546,307:43,308:p},n($a,[2,68]),n(A,[2,350],{31:BA,112:BA}),n(Nr,[2,53]),{13:f,16:d,55:547,307:43,308:p},n(O,[2,333]),n(ie,[2,16]),n(ph,[2,152]),n(Bc,[2,154]),n(Bc,[2,157]),n(Vc,[2,159]),n(Vc,[2,160],{262:389,261:548,39:tb,338:rb}),n(Vc,[2,161],{262:389,261:549,39:tb,338:rb}),n(Sr,[2,163]),{13:f,16:d,44:136,45:N,46:550,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,178]),n(rr,[2,179]),{13:f,16:d,44:136,45:N,46:551,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:552,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:553,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{48:[1,554],272:[1,555]},n(rr,[2,184]),n(rr,[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:d,55:194,197:Et,223:562,307:43,308:p},n(sb,[2,224]),n(sb,[2,225]),n(sb,[2,226]),{31:[1,563],45:VA,94:564},n(fe,[2,84]),n(gh,[2,368]),n(fe,[2,85]),n(yh,[2,370]),n(sf,[2,373],{170:566}),{48:[1,567]},{48:[2,423],337:[1,568]},n(Bo,[2,35],{83:[1,569]}),n(Bo,[2,36],{81:[1,570]}),n(Z0,[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:d,45:N,76:MA,78:jA,87:h,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,276:Je,277:Ne,279:Ke,280:Be,283:M,285:ee,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U}),n(qc,[2,295]),{45:N,77:572},{45:N,77:573},n(qc,[2,33]),n(qc,[2,34]),{31:[2,275],50:574,84:575,85:o},{31:[2,277],51:576,84:577,85:o},n(Ua,[2,356]),n(GA,[2,357],{152:578,335:[1,579]}),n(Ws,[2,74]),{29:re,57:580},{29:re,57:581},{13:f,16:d,44:39,55:40,87:h,139:582,307:43,308:p},n(qA,[2,365],{162:583,328:[1,584]}),{13:f,16:d,45:N,55:323,67:321,68:322,77:320,79:585,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,307:43,308:p,346:nt,347:rt,348:x,349:P,350:D,351:U},{45:[1,586]},n(Ws,[2,81]),{29:re,57:587},n(Ua,[2,73]),n(A,[2,362],{29:zs,31:zs,85:zs,112:zs,159:zs,160:zs,161:zs,163:zs,164:zs}),n(Th,[2,112]),n(Wc,[2,401],{206:588}),n(A,[2,405],{209:589,210:590}),n(A,[2,403]),n(A,[2,404]),n(Th,[2,113]),n(Th,[2,400]),{13:f,16:d,44:215,45:wh,48:[1,591],55:220,82:j,87:h,89:lt,172:221,185:351,203:536,212:592,231:vh,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(Eh,[2,426]),n(ib,[2,138]),n(ib,[2,139]),{232:[1,593]},n(Va,[2,292]),{47:[1,595],48:[1,594]},n(Gc,[2,9]),n(Ba,[2,392]),n(Ba,[2,393],{44:39,55:40,307:43,195:341,139:342,194:596,190:597,13:f,16:d,87:h,197:ja,308:p}),n(Ba,[2,110],{272:[1,598]}),n(Ah,[2,397],{201:599,316:600,317:[1,601]}),{314:[1,602]},{29:[1,603]},n($o,[2,58]),n(Sr,[2,445]),n(Sr,[2,447]),{48:[1,604],272:[1,605]},{48:[1,606]},{272:[1,607]},{272:[1,608]},n(rr,[2,99]),n(nr,[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(rr,[2,188]),n(rr,[2,189]),{48:[1,609]},{48:[2,468]},{289:[1,610]},{13:f,16:d,55:492,82:j,172:493,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,311:494,312:cn,315:611},n(fe,[2,42]),n(sf,[2,304]),{13:f,16:d,55:414,82:j,95:612,171:613,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},{31:[1,614],45:VA,94:615},n(ls,[2,129]),n(FA,[2,421]),{82:[1,616]},{82:[1,617]},n(qc,[2,296]),n(qc,[2,31]),n(qc,[2,32]),{31:[2,17]},{31:[2,276]},{31:[2,18]},{31:[2,278]},n(A,CA,{155:330,153:618,154:619,29:Hs,31:Hs,85:Hs,112:Hs,159:Hs,160:Hs,161:Hs,163:Hs,164:Hs}),n(GA,[2,358]),n(Ws,[2,75]),n(Ws,[2,76]),{29:re,57:620},{13:f,16:d,44:39,55:40,87:h,139:621,307:43,308:p},n(qA,[2,366]),n(Ws,[2,79]),{13:f,16:d,44:136,45:N,46:622,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(Ws,[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(Wc,[2,117]),{13:f,16:d,44:215,45:wh,55:220,82:j,87:h,89:lt,172:221,185:351,203:536,211:626,212:627,231:vh,234:535,236:216,237:222,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,309:Rn,310:qn,311:217,312:cn},n(qs,[2,134]),n(Eh,[2,427]),n(qs,[2,135]),n(Va,[2,26]),{44:628,87:h},n(Ba,[2,106]),n(Ba,[2,394]),n(A,[2,396]),n(Ah,[2,111]),n(Ah,[2,398]),{13:f,16:d,44:39,55:40,87:h,139:342,186:629,190:340,195:341,197:ja,307:43,308:p},n(eb,[2,217]),n(A,hh,{144:248,140:630,143:631,31:[2,343]}),n(rr,[2,97]),n(nr,[2,380]),n(rr,[2,180]),{13:f,16:d,44:136,45:N,46:632,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},{13:f,16:d,44:136,45:N,46:633,55:133,67:132,68:134,77:131,82:j,87:h,172:135,224:se,238:121,239:122,243:123,247:124,251:125,255:154,257:155,259:126,263:be,264:130,265:W,266:137,267:139,268:Ee,269:Ve,270:ye,271:ze,273:He,274:Ye,275:146,276:Je,277:Ne,278:149,279:Ke,280:Be,283:M,285:ee,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:ot,346:nt,347:rt,348:x,349:P,350:D,351:U},n(rr,[2,190]),{290:[1,634]},{314:[1,635]},{13:f,16:d,48:[1,636],55:414,82:j,171:637,172:415,173:416,174:_h,255:154,257:155,291:150,294:ue,295:de,296:he,297:oe,298:pe,299:me,300:ge,301:we,302:xe,303:Re,304:Pe,305:Se,306:Fe,307:43,308:p,312:Sh},n(WA,[2,305]),n(fe,[2,86]),n(sf,[2,374]),n(Bo,[2,37]),n(Bo,[2,38]),n(Ua,[2,72]),n(Ua,[2,360]),n(Ws,[2,77]),{29:re,57:638},{47:[1,639]},{29:[2,376]},n(Wc,[2,402]),n(Wc,[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:h}),n(Wc,[2,118],{272:[1,641]}),n(Ih,[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:Re,304:Pe,305:Se,306:Fe},n(nf,[2,218]),n(sf,[2,44]),n(WA,[2,306]),n(Ws,[2,78]),{44:651,87:h},n(Wc,[2,116]),n(A,[2,406]),n(Ih,[2,119]),n(Ih,[2,408]),n(c,i,{215:10,205:527,208:528,214:529,44:530,202:652,87:h}),n(Va,[2,27]),n(Ah,[2,230]),n(zA,[2,345],{141:653,335:[1,654]}),n(rr,[2,181]),n(rr,[2,182]),{48:[2,191]},{48:[1,655]},{318:[1,656]},n(A,hh,{144:248,142:657,143:658,31:HA,112:HA}),n(zA,[2,346]),n(Ws,[2,80]),n(Ih,[2,231]),n($a,[2,67]),n($a,[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:a(function(F,$){if($.recoverable)this.trace(F);else{var z=new Error(F);throw z.hash=$,z}},"parseError"),parse:a(function(F){var $=this,z=[0],ve=[],We=[null],b=[],fn=this.table,E="",ds=0,lf=0,Ch=0,Oh=2,uf=1,Dh=b.slice.call(arguments,1),Ht=Object.create(this.lexer),hs={yy:{}};for(var ff in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ff)&&(hs.yy[ff]=this.yy[ff]);Ht.setInput(F,hs.yy),hs.yy.lexer=Ht,hs.yy.parser=this,typeof Ht.yylloc>"u"&&(Ht.yylloc={});var Xc=Ht.yylloc;b.push(Xc);var Tt=Ht.options&&Ht.options.ranges;typeof hs.yy.parseError=="function"?this.parseError=hs.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ut(ps){z.length=z.length-2*ps,We.length=We.length-ps,b.length=b.length-ps}a(Ut,"popStack");for(var ut=a(function(){var ps;return ps=Ht.lex()||uf,typeof ps!="number"&&(ps=$.symbols_[ps]||ps),ps},"lex"),gt,Pn,za,ni,rse,bb,Yc={},Fh,Xs,sI,Lh;;){if(za=z[z.length-1],this.defaultActions[za]?ni=this.defaultActions[za]:((gt===null||typeof gt>"u")&&(gt=ut()),ni=fn[za]&&fn[za][gt]),typeof ni>"u"||!ni.length||!ni[0]){var _b="";Lh=[];for(Fh in fn[za])this.terminals_[Fh]&&Fh>Oh&&Lh.push("'"+this.terminals_[Fh]+"'");Ht.showPosition?_b="Parse error on line "+(ds+1)+`:
34
34
  `+Ht.showPosition()+`
35
- Expecting `+Lh.join(", ")+", got '"+(this.terminals_[gt]||gt)+"'":_b="Parse error on line "+(ds+1)+": Unexpected "+(gt==uf?"end of input":"'"+(this.terminals_[gt]||gt)+"'"),this.parseError(_b,{text:Ht.match,token:this.terminals_[gt]||gt,line:Ht.yylineno,loc:Xc,expected:Lh})}if(ni[0]instanceof Array&&ni.length>1)throw new Error("Parse Error: multiple actions possible at state: "+za+", token: "+gt);switch(ni[0]){case 1:z.push(gt),We.push(Ht.yytext),b.push(Ht.yylloc),z.push(ni[1]),gt=null,Pn?(gt=Pn,Pn=null):(lf=Ht.yyleng,E=Ht.yytext,ds=Ht.yylineno,Xc=Ht.yylloc,Ch>0&&Ch--);break;case 2:if(Qs=this.productions_[ni[1]][1],Yc.$=We[We.length-Qs],Yc._$={first_line:b[b.length-(Qs||1)].first_line,last_line:b[b.length-1].last_line,first_column:b[b.length-(Qs||1)].first_column,last_column:b[b.length-1].last_column},Tt&&(Yc._$.range=[b[b.length-(Qs||1)].range[0],b[b.length-1].range[1]]),bb=this.performAction.apply(Yc,[E,lf,ds,hs.yy,ni[1],We,b].concat(Dh)),typeof bb<"u")return bb;Qs&&(z=z.slice(0,-1*Qs*2),We=We.slice(0,-1*Qs),b=b.slice(0,-1*Qs)),z.push(this.productions_[ni[1]][0]),We.push(Yc.$),b.push(Yc._$),sI=fn[z[z.length-2]][z[z.length-1]],z.push(sI);break;case 3:return!0}}return!0},"parse")},xh=hS().Wildcard,Rh="http://www.w3.org/1999/02/22-rdf-syntax-ns#",O4=Rh+"type",D4=Rh+"first",F4=Rh+"rest",KA=Rh+"nil",Ph="http://www.w3.org/2001/XMLSchema#",QA=Ph+"integer",XA=Ph+"decimal",YA=Ph+"double",L4=Ph+"boolean",Ga="",JA="",ZA="";function un(L){return L.toLowerCase()}a(un,"lowercase");function Hs(L,F){return L.push(F),L}a(Hs,"appendTo");function qa(L,F){return L.push.apply(L,F),L}a(qa,"appendAllTo");function Yt(L){L||(L={});for(var F=1,$=arguments.length,z;F<$&&(z=arguments[F]||{});F++)for(var ve in z)L[ve]=z[ve];return L}a(Yt,"extend");function us(){for(var L=[],F=0,$=arguments.length;F<$;F++)L=L.concat.apply(L,arguments[F]);return L}a(us,"unionAll");function of(L){if(L[0]==="<"&&(L=L.substring(1,L.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(L))return L;if(!Ze.base)throw new Error("Cannot resolve relative IRI "+L+" because no base IRI was set.");switch(Ga!==Ze.base&&(Ga=Ze.base,JA=Ga.replace(/[^\/:]*$/,""),ZA=Ga.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),L[0]){case void 0:return Ga;case"#":return Ga+L;case"?":return Ga.replace(/(?:\?.*)?$/,L);case"/":return ZA+L;default:return JA+L}}a(of,"resolveIRI");function ab(L){if(L){var F=L[0];if(F==="?"||F==="$")return Ze.factory.variable(L.substr(1))}return L}a(ab,"toVar");function kr(L,F){return{type:"operation",operator:L,args:F||[]}}a(kr,"operation");function zc(L,F){var $={expression:L==="*"?new xh:L};if(F)for(var z in F)$[z]=F[z];return $}a(zc,"expression");function Hc(L,F){return{type:"path",pathType:L,items:F}}a(Hc,"path");function cb(L,F){for(var $=0,z=F.length,ve;$<z&&(ve=F[$]);$++)L=kr(ve[0],[L,ve[1]]);return L}a(cb,"createOperationTree");function Wa(L,F){var $=[],z=[],ve=L.length,We,b={};if(!ve)return null;for(var fn=0;fn<ve&&(We=L[fn]);fn++)(We.named?z:$).push(We.iri);return b[F||"from"]={default:$,named:z},b}a(Wa,"groupDatasets");function Kc(L){return parseInt(L,10)}a(Kc,"toInt");function lb(L){return L.type==="group"&&L.patterns.length===1?L.patterns[0]:L}a(lb,"degroupSingle");function fs(L,F){return F&&F.termType!=="NamedNode"&&(F=Ze.factory.namedNode(F)),Ze.factory.literal(L,F)}a(fs,"createTypedLiteral");function N4(L,F){return Ze.factory.literal(L,F)}a(N4,"createLangLiteral");function ub(L,F,$){if(!("termType"in F))throw new Error("Nested triples cannot contain paths");return Ze.factory.quad(L,F,$)}a(ub,"nestedTriple");function Ks(L,F,$,z){var ve={};return L!=null&&(ve.subject=L),F!=null&&(ve.predicate=F),$!=null&&(ve.object=$),z!=null&&(ve.annotations=z),ve}a(Ks,"triple");function af(L){return typeof L=="string"?L.startsWith("e_")?Ze.factory.blankNode(L):Ze.factory.blankNode("e_"+L):Ze.factory.blankNode("g_"+eI++)}a(af,"blank");var eI=0;Ze._resetBlanks=function(){eI=0};var k4=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,M4={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
36
- `,r:"\r",f:"\f"},j4=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,fb=String.fromCharCode;function tI(L,F){L=L.substring(F,L.length-F);try{L=L.replace(k4,function($,z,ve,We){var b;if(z){if(b=parseInt(z,16),isNaN(b))throw new Error;return fb(b)}else if(ve){if(b=parseInt(ve,16),isNaN(b))throw new Error;return b<65535?fb(b):fb(55296+((b-=65536)>>10),56320+(b&1023))}else{var fn=M4[We];if(!fn)throw new Error;return fn}})}catch{return""}if(j4.exec(L))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+L);return L}a(tI,"unescapeString");function $4(L){var F=af(),$=F,z=[],ve,We=[];L.forEach(function(ds){z.push(ds.entity),qa(We,ds.triples)});for(var b=0,fn=0,E=z.length,ve=Array(E*2);b<E;)ve[fn++]=Ks($,Ze.factory.namedNode(D4),z[b]),ve[fn++]=Ks($,Ze.factory.namedNode(F4),$=++b<E?af():Ze.factory.namedNode(KA));return{entity:F,triples:qa(ve,We)}}a($4,"createList");function U4(L){var F=af();return{entity:F,triples:L.map(function($){return Yt(Ks(F),$)})}}a(U4,"createAnonymousObject");function db(L,F,$){var z=[],ve=[];return F.forEach(function(We){let b=null;We.annotation&&(b=We.annotation,We=We.object),z.push(Ks(null,L,We.entity,b)),qa(ve,We.triples)}),us(z,$||[],ve)}a(db,"objectListToTriples");function ese(L){for(var F=[],$,z=0,ve;ve=L[z];z++)switch(ve.type){case"bgp":ve.triples.length&&($?qa($.triples,ve.triples):Hs(F,$=ve));break;default:(!ve.patterns||ve.patterns.length>0)&&(Hs(F,ve),$=null)}return F}a(ese,"mergeAdjacentBGPs");function Qc(L){return L.variable?L.variable.value:L.value||L.expression.value}a(Qc,"getExpressionId");function hb(L){if(!L)return[];if(L.type==="aggregate")return[L];if(L.type==="operation"){let F=[];for(let $ of L.args)F.push(...hb($));return F}return[]}a(hb,"getAggregatesOfExpression");function B4(L){let F=new Set,$=a(function(z){z&&(z.termType==="Variable"?F.add(z):z.type==="operation"&&z.args.forEach($))},"visitExpression");return $(L),F}a(B4,"getVariablesFromExpression");function pb(L,F=1,$=[]){for(let z of L)F>0&&z instanceof Array?pb(z,F-1,$):$.push(z);return $}a(pb,"flatten");function mb(L){return L.termType==="Variable"}a(mb,"isVariable");function rI(L){if(L.triples){let F=[];for(let $ of L.triples)mb($.subject)&&F.push($.subject.value),mb($.predicate)&&F.push($.predicate.value),mb($.object)&&F.push($.object.value);return F}else if(L.patterns){let F=[];for(let $ of L.patterns)F.push(...rI($));return F}return[]}a(rI,"getBoundVarsFromGroupGraphPattern");function V4(L){let F=L.slice().sort(),$=[];for(let z=0;z<F.length-1;z++)F[z+1]==F[z]&&$.push(F[z]);return $}a(V4,"getDuplicatesInArray");function cf(L){if(!Ze.sparqlStar)throw new Error("SPARQL-star support is not enabled");return L}a(cf,"ensureSparqlStar");function nI(L,F,$){for(let z of F){let ve=Ks("subject"in z?z.subject:L,z.predicate,z.object);$.push(ve),z.annotations&&nI(ub(L,z.predicate,z.object),z.annotations,$)}}a(nI,"_applyAnnotations");function gb(L){if(Ze.sparqlStar){let F=[];return L.forEach($=>{let z=Ks($.subject,$.predicate,$.object);F.push(z),$.annotations&&nI(ub($.subject,$.predicate,$.object),$.annotations,F)}),F}return L}a(gb,"applyAnnotations");function tse(L){if(!Ze.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return L}a(tse,"ensureSparqlStarNestedQuads");function iI(L){for(let F of L){if(F.type==="graph"&&F.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(F.type==="bgp"||F.type==="graph"){for(let $ of F.triples)if($.subject.termType==="Variable"||$.predicate.termType==="Variable"||$.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return L}a(iI,"ensureNoVariables");function yb(L){for(let F of L)if(F.type==="bgp"){for(let $ of F.triples)if($.subject.termType==="BlankNode"||$.predicate.termType==="BlankNode"||$.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return L}a(yb,"ensureNoBnodes");var G4=(function(){var L={EOF:1,parseError:a(function($,z){if(this.yy.parser)this.yy.parser.parseError($,z);else throw new Error($)},"parseError"),setInput:a(function(F,$){return this.yy=$||this.yy||{},this._input=F,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:a(function(){var F=this._input[0];this.yytext+=F,this.yyleng++,this.offset++,this.match+=F,this.matched+=F;var $=F.match(/(?:\r\n?|\n).*/g);return $?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),F},"input"),unput:a(function(F){var $=F.length,z=F.split(/(?:\r\n?|\n)/g);this._input=F+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-$),this.offset-=$;var ve=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),z.length-1&&(this.yylineno-=z.length-1);var We=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:z?(z.length===ve.length?this.yylloc.first_column:0)+ve[ve.length-z.length].length-z[0].length:this.yylloc.first_column-$},this.options.ranges&&(this.yylloc.range=[We[0],We[0]+this.yyleng-$]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(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).
35
+ Expecting `+Lh.join(", ")+", got '"+(this.terminals_[gt]||gt)+"'":_b="Parse error on line "+(ds+1)+": Unexpected "+(gt==uf?"end of input":"'"+(this.terminals_[gt]||gt)+"'"),this.parseError(_b,{text:Ht.match,token:this.terminals_[gt]||gt,line:Ht.yylineno,loc:Xc,expected:Lh})}if(ni[0]instanceof Array&&ni.length>1)throw new Error("Parse Error: multiple actions possible at state: "+za+", token: "+gt);switch(ni[0]){case 1:z.push(gt),We.push(Ht.yytext),b.push(Ht.yylloc),z.push(ni[1]),gt=null,Pn?(gt=Pn,Pn=null):(lf=Ht.yyleng,E=Ht.yytext,ds=Ht.yylineno,Xc=Ht.yylloc,Ch>0&&Ch--);break;case 2:if(Xs=this.productions_[ni[1]][1],Yc.$=We[We.length-Xs],Yc._$={first_line:b[b.length-(Xs||1)].first_line,last_line:b[b.length-1].last_line,first_column:b[b.length-(Xs||1)].first_column,last_column:b[b.length-1].last_column},Tt&&(Yc._$.range=[b[b.length-(Xs||1)].range[0],b[b.length-1].range[1]]),bb=this.performAction.apply(Yc,[E,lf,ds,hs.yy,ni[1],We,b].concat(Dh)),typeof bb<"u")return bb;Xs&&(z=z.slice(0,-1*Xs*2),We=We.slice(0,-1*Xs),b=b.slice(0,-1*Xs)),z.push(this.productions_[ni[1]][0]),We.push(Yc.$),b.push(Yc._$),sI=fn[z[z.length-2]][z[z.length-1]],z.push(sI);break;case 3:return!0}}return!0},"parse")},xh=hS().Wildcard,Rh="http://www.w3.org/1999/02/22-rdf-syntax-ns#",O4=Rh+"type",D4=Rh+"first",F4=Rh+"rest",KA=Rh+"nil",Ph="http://www.w3.org/2001/XMLSchema#",QA=Ph+"integer",XA=Ph+"decimal",YA=Ph+"double",L4=Ph+"boolean",Ga="",JA="",ZA="";function un(L){return L.toLowerCase()}a(un,"lowercase");function Ks(L,F){return L.push(F),L}a(Ks,"appendTo");function qa(L,F){return L.push.apply(L,F),L}a(qa,"appendAllTo");function Yt(L){L||(L={});for(var F=1,$=arguments.length,z;F<$&&(z=arguments[F]||{});F++)for(var ve in z)L[ve]=z[ve];return L}a(Yt,"extend");function us(){for(var L=[],F=0,$=arguments.length;F<$;F++)L=L.concat.apply(L,arguments[F]);return L}a(us,"unionAll");function of(L){if(L[0]==="<"&&(L=L.substring(1,L.length-1)),/^[a-z][a-z0-9.+-]*:/i.test(L))return L;if(!Ze.base)throw new Error("Cannot resolve relative IRI "+L+" because no base IRI was set.");switch(Ga!==Ze.base&&(Ga=Ze.base,JA=Ga.replace(/[^\/:]*$/,""),ZA=Ga.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0]),L[0]){case void 0:return Ga;case"#":return Ga+L;case"?":return Ga.replace(/(?:\?.*)?$/,L);case"/":return ZA+L;default:return JA+L}}a(of,"resolveIRI");function ab(L){if(L){var F=L[0];if(F==="?"||F==="$")return Ze.factory.variable(L.substr(1))}return L}a(ab,"toVar");function kr(L,F){return{type:"operation",operator:L,args:F||[]}}a(kr,"operation");function zc(L,F){var $={expression:L==="*"?new xh:L};if(F)for(var z in F)$[z]=F[z];return $}a(zc,"expression");function Hc(L,F){return{type:"path",pathType:L,items:F}}a(Hc,"path");function cb(L,F){for(var $=0,z=F.length,ve;$<z&&(ve=F[$]);$++)L=kr(ve[0],[L,ve[1]]);return L}a(cb,"createOperationTree");function Wa(L,F){var $=[],z=[],ve=L.length,We,b={};if(!ve)return null;for(var fn=0;fn<ve&&(We=L[fn]);fn++)(We.named?z:$).push(We.iri);return b[F||"from"]={default:$,named:z},b}a(Wa,"groupDatasets");function Kc(L){return parseInt(L,10)}a(Kc,"toInt");function lb(L){return L.type==="group"&&L.patterns.length===1?L.patterns[0]:L}a(lb,"degroupSingle");function fs(L,F){return F&&F.termType!=="NamedNode"&&(F=Ze.factory.namedNode(F)),Ze.factory.literal(L,F)}a(fs,"createTypedLiteral");function N4(L,F){return Ze.factory.literal(L,F)}a(N4,"createLangLiteral");function ub(L,F,$){if(!("termType"in F))throw new Error("Nested triples cannot contain paths");return Ze.factory.quad(L,F,$)}a(ub,"nestedTriple");function Qs(L,F,$,z){var ve={};return L!=null&&(ve.subject=L),F!=null&&(ve.predicate=F),$!=null&&(ve.object=$),z!=null&&(ve.annotations=z),ve}a(Qs,"triple");function af(L){return typeof L=="string"?L.startsWith("e_")?Ze.factory.blankNode(L):Ze.factory.blankNode("e_"+L):Ze.factory.blankNode("g_"+eI++)}a(af,"blank");var eI=0;Ze._resetBlanks=function(){eI=0};var k4=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,M4={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:`
36
+ `,r:"\r",f:"\f"},j4=/[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/,fb=String.fromCharCode;function tI(L,F){L=L.substring(F,L.length-F);try{L=L.replace(k4,function($,z,ve,We){var b;if(z){if(b=parseInt(z,16),isNaN(b))throw new Error;return fb(b)}else if(ve){if(b=parseInt(ve,16),isNaN(b))throw new Error;return b<65535?fb(b):fb(55296+((b-=65536)>>10),56320+(b&1023))}else{var fn=M4[We];if(!fn)throw new Error;return fn}})}catch{return""}if(j4.exec(L))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+L);return L}a(tI,"unescapeString");function $4(L){var F=af(),$=F,z=[],ve,We=[];L.forEach(function(ds){z.push(ds.entity),qa(We,ds.triples)});for(var b=0,fn=0,E=z.length,ve=Array(E*2);b<E;)ve[fn++]=Qs($,Ze.factory.namedNode(D4),z[b]),ve[fn++]=Qs($,Ze.factory.namedNode(F4),$=++b<E?af():Ze.factory.namedNode(KA));return{entity:F,triples:qa(ve,We)}}a($4,"createList");function U4(L){var F=af();return{entity:F,triples:L.map(function($){return Yt(Qs(F),$)})}}a(U4,"createAnonymousObject");function db(L,F,$){var z=[],ve=[];return F.forEach(function(We){let b=null;We.annotation&&(b=We.annotation,We=We.object),z.push(Qs(null,L,We.entity,b)),qa(ve,We.triples)}),us(z,$||[],ve)}a(db,"objectListToTriples");function ese(L){for(var F=[],$,z=0,ve;ve=L[z];z++)switch(ve.type){case"bgp":ve.triples.length&&($?qa($.triples,ve.triples):Ks(F,$=ve));break;default:(!ve.patterns||ve.patterns.length>0)&&(Ks(F,ve),$=null)}return F}a(ese,"mergeAdjacentBGPs");function Qc(L){return L.variable?L.variable.value:L.value||L.expression.value}a(Qc,"getExpressionId");function hb(L){if(!L)return[];if(L.type==="aggregate")return[L];if(L.type==="operation"){let F=[];for(let $ of L.args)F.push(...hb($));return F}return[]}a(hb,"getAggregatesOfExpression");function B4(L){let F=new Set,$=a(function(z){z&&(z.termType==="Variable"?F.add(z):z.type==="operation"&&z.args.forEach($))},"visitExpression");return $(L),F}a(B4,"getVariablesFromExpression");function pb(L,F=1,$=[]){for(let z of L)F>0&&z instanceof Array?pb(z,F-1,$):$.push(z);return $}a(pb,"flatten");function mb(L){return L.termType==="Variable"}a(mb,"isVariable");function rI(L){if(L.triples){let F=[];for(let $ of L.triples)mb($.subject)&&F.push($.subject.value),mb($.predicate)&&F.push($.predicate.value),mb($.object)&&F.push($.object.value);return F}else if(L.patterns){let F=[];for(let $ of L.patterns)F.push(...rI($));return F}return[]}a(rI,"getBoundVarsFromGroupGraphPattern");function V4(L){let F=L.slice().sort(),$=[];for(let z=0;z<F.length-1;z++)F[z+1]==F[z]&&$.push(F[z]);return $}a(V4,"getDuplicatesInArray");function cf(L){if(!Ze.sparqlStar)throw new Error("SPARQL-star support is not enabled");return L}a(cf,"ensureSparqlStar");function nI(L,F,$){for(let z of F){let ve=Qs("subject"in z?z.subject:L,z.predicate,z.object);$.push(ve),z.annotations&&nI(ub(L,z.predicate,z.object),z.annotations,$)}}a(nI,"_applyAnnotations");function gb(L){if(Ze.sparqlStar){let F=[];return L.forEach($=>{let z=Qs($.subject,$.predicate,$.object);F.push(z),$.annotations&&nI(ub($.subject,$.predicate,$.object),$.annotations,F)}),F}return L}a(gb,"applyAnnotations");function tse(L){if(!Ze.sparqlStarNestedQuads)throw new Error("Lenient SPARQL-star support with nested quads is not enabled");return L}a(tse,"ensureSparqlStarNestedQuads");function iI(L){for(let F of L){if(F.type==="graph"&&F.name.termType==="Variable")throw new Error("Detected illegal variable in GRAPH");if(F.type==="bgp"||F.type==="graph"){for(let $ of F.triples)if($.subject.termType==="Variable"||$.predicate.termType==="Variable"||$.object.termType==="Variable")throw new Error("Detected illegal variable in BGP")}}return L}a(iI,"ensureNoVariables");function yb(L){for(let F of L)if(F.type==="bgp"){for(let $ of F.triples)if($.subject.termType==="BlankNode"||$.predicate.termType==="BlankNode"||$.object.termType==="BlankNode")throw new Error("Detected illegal blank node in BGP")}return L}a(yb,"ensureNoBnodes");var G4=(function(){var L={EOF:1,parseError:a(function($,z){if(this.yy.parser)this.yy.parser.parseError($,z);else throw new Error($)},"parseError"),setInput:a(function(F,$){return this.yy=$||this.yy||{},this._input=F,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:a(function(){var F=this._input[0];this.yytext+=F,this.yyleng++,this.offset++,this.match+=F,this.matched+=F;var $=F.match(/(?:\r\n?|\n).*/g);return $?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),F},"input"),unput:a(function(F){var $=F.length,z=F.split(/(?:\r\n?|\n)/g);this._input=F+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-$),this.offset-=$;var ve=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),z.length-1&&(this.yylineno-=z.length-1);var We=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:z?(z.length===ve.length?this.yylloc.first_column:0)+ve[ve.length-z.length].length-z[0].length:this.yylloc.first_column-$},this.options.ranges&&(this.yylloc.range=[We[0],We[0]+this.yyleng-$]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(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).
37
37
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(F){this.unput(this.match.slice(F))},"less"),pastInput:a(function(){var F=this.matched.substr(0,this.matched.length-this.match.length);return(F.length>20?"...":"")+F.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var F=this.match;return F.length<20&&(F+=this._input.substr(0,20-F.length)),(F.substr(0,20)+(F.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var F=this.pastInput(),$=new Array(F.length+1).join("-");return F+this.upcomingInput()+`
38
38
  `+$+"^"},"showPosition"),test_match:a(function(F,$){var z,ve,We;if(this.options.backtrack_lexer&&(We={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(We.yylloc.range=this.yylloc.range.slice(0))),ve=F[0].match(/(?:\r\n?|\n).*/g),ve&&(this.yylineno+=ve.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ve?ve[ve.length-1].length-ve[ve.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+F[0].length},this.yytext+=F[0],this.match+=F[0],this.matches=F,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(F[0].length),this.matched+=F[0],z=this.performAction.call(this,this.yy,this,$,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),z)return z;if(this._backtrack){for(var b in We)this[b]=We[b];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var F,$,z,ve;this._more||(this.yytext="",this.match="");for(var We=this._currentRules(),b=0;b<We.length;b++)if(z=this._input.match(this.rules[We[b]]),z&&(!$||z[0].length>$[0].length)){if($=z,ve=b,this.options.backtrack_lexer){if(F=this.test_match(z,We[b]),F!==!1)return F;if(this._backtrack){$=!1;continue}else return!1}else if(!this.options.flex)break}return $?(F=this.test_match($,We[ve]),F!==!1?F:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
39
39
  `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var $=this.next();return $||this.lex()},"lex"),begin:a(function($){this.conditionStack.push($)},"begin"),popState:a(function(){var $=this.conditionStack.length-1;return $>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function($){return $=this.conditionStack.length-1-Math.abs($||0),$>=0?this.conditionStack[$]:"INITIAL"},"topState"),pushState:a(function($){this.begin($)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{flex:!0,"case-insensitive":!0},performAction:a(function($,z,ve,We){var b=We;switch(ve){case 0:break;case 1:return 12;case 2:return 15;case 3:return 41;case 4:return 325;case 5:return 326;case 6:return 45;case 7:return 47;case 8:return 48;case 9:return 39;case 10:return 24;case 11:return 28;case 12:return 29;case 13:return 31;case 14:return 32;case 15:return 36;case 16:return 53;case 17:return 327;case 18:return 63;case 19:return 64;case 20:return 70;case 21:return 73;case 22:return 76;case 23:return 78;case 24:return 81;case 25:return 83;case 26:return 85;case 27:return 193;case 28:return 100;case 29:return 328;case 30:return 121;case 31:return 329;case 32:return 330;case 33:return 110;case 34:return 331;case 35:return 109;case 36:return 332;case 37:return 333;case 38:return 113;case 39:return 115;case 40:return 116;case 41:return 131;case 42:return 123;case 43:return 126;case 44:return 128;case 45:return 132;case 46:return 112;case 47:return 334;case 48:return 335;case 49:return 159;case 50:return 161;case 51:return 164;case 52:return 174;case 53:return 160;case 54:return 336;case 55:return 163;case 56:return 312;case 57:return 314;case 58:return 317;case 59:return 318;case 60:return 272;case 61:return 197;case 62:return 337;case 63:return 338;case 64:return 229;case 65:return 340;case 66:return 263;case 67:return 224;case 68:return 231;case 69:return 232;case 70:return 242;case 71:return 246;case 72:return 290;case 73:return 341;case 74:return 342;case 75:return 343;case 76:return 344;case 77:return 345;case 78:return 250;case 79:return 346;case 80:return 265;case 81:return 276;case 82:return 277;case 83:return 268;case 84:return 269;case 85:return 270;case 86:return 271;case 87:return 347;case 88:return 348;case 89:return 273;case 90:return 274;case 91:return 350;case 92:return 349;case 93:return 351;case 94:return 279;case 95:return 280;case 96:return 283;case 97:return 285;case 98:return 289;case 99:return 293;case 100:return 296;case 101:return 13;case 102:return 16;case 103:return 308;case 104:return 309;case 105:return 87;case 106:return 292;case 107:return 82;case 108:return 294;case 109:return 295;case 110:return 297;case 111:return 298;case 112:return 299;case 113:return 300;case 114:return 301;case 115:return 302;case 116:return"EXPONENT";case 117:return 303;case 118:return 304;case 119:return 305;case 120:return 306;case 121:return 89;case 122:return 310;case 123:return 6;case 124:return"INVALID";case 125:console.log(z.yytext);break}},"anonymous"),rules:[/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:\{\|)/i,/^(?:\|\})/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(SUBJECT|PREDICATE|OBJECT|isTRIPLE))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:TRIPLE)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],inclusive:!0}}};return L})();ob.lexer=G4;function Ze(){this.yy={}}return a(Ze,"Parser"),Ze.prototype=ob,ob.Parser=Ze,new Ze})();qx.exports=h6});var Qx=w((qce,Kx)=>{var p6="http://www.w3.org/2001/XMLSchema#integer",m6="http://www.w3.org/2001/XMLSchema#string";function Dt(n){this._options=n=n||{};var e=n.prefixes||{};this._prefixByIri={};var t=[];for(var r in e){var i=e[r];Lf(i)&&(this._prefixByIri[i]=r,t.push(i))}var s=t.join("|").replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^("+s+")([a-zA-Z][\\-_a-zA-Z0-9]*)$"),this._usedPrefixes={},this._sparqlStar=n.sparqlStar,this._indent=Lf(n.indent)?n.indent:" ",this._newline=Lf(n.newline)?n.newline:`
40
- `,this._explicitDatatype=!!n.explicitDatatype}a(Dt,"Generator");Dt.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=zn(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:Ko(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+Cp(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=zn(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+zn(n.group,void 0,function(t){var r=Ko(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+Cp(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+zn(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+zn(n.order,void 0,function(t){var r="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+r:r},this)+this._newline),n.offset&&(e+="OFFSET "+n.offset+this._newline),n.limit&&(e+="LIMIT "+n.limit+this._newline),n.values&&(e+=this.values(n)),e=this.baseAndPrefixes(n)+e,e.trim()};Dt.prototype.baseAndPrefixes=function(n){var e=n.base?"BASE <"+n.base+">"+this._newline:"",t="";for(var r in n.prefixes)(this._options.allPrefixes||this._usedPrefixes[r])&&(t+="PREFIX "+r+": <"+n.prefixes[r]+">"+this._newline);return e+t};Dt.prototype.toPattern=function(n){var e=n.type||n instanceof Array&&"array"||(n.subject&&n.predicate&&n.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](n)};Dt.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};Dt.prototype.array=function(n){return zn(n,this._newline,this.toPattern,this)};Dt.prototype.bgp=function(n){return this.encodeTriples(n.triples)};Dt.prototype.encodeTriples=function(n){if(!n.length)return"";for(var e=[],t=void 0,r=void 0,i=0;i<n.length;i++){var s=n[i];tc(s.subject,t)?tc(s.predicate,r)?e.push(","):(r=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(r))):(t&&e.push("."+this._newline),t=s.subject,r=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(r))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};Dt.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};Dt.prototype.graphs=function(n,e){return!e||e.length===0?"":zn(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};Dt.prototype.group=function(n,e){return n=e!==!0?this.array(n.patterns||n.triples):this.toPattern(n.type!=="group"?n:n.patterns),n.indexOf(this._newline)===-1?"{ "+n+" }":"{"+this._newline+this.indent(n)+this._newline+"}"};Dt.prototype.query=function(n){return this.toQuery(n)};Dt.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};Dt.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+Cp(n.variable)+")"};Dt.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};Dt.prototype.union=function(n){return zn(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};Dt.prototype.minus=function(n){return"MINUS "+this.group(n)};Dt.prototype.values=function(n){var e=Object.keys(n.values.reduce(function(i,s){for(var o in s)i[o]=!0;return i},{})),t,r;return e.length===1?t=r="":(t="(",r=")"),"VALUES "+t+e.join(" ")+r+" {"+this._newline+zn(n.values,this._newline,function(i){return" "+t+zn(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};Dt.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};Dt.prototype.toExpression=function(n){if(Ko(n))return this.toEntity(n);switch(n.type.toLowerCase()){case"aggregate":return n.aggregation.toUpperCase()+"("+(n.distinct?"DISTINCT ":"")+this.toExpression(n.expression)+(typeof n.separator=="string"?'; SEPARATOR = "'+n.separator.replace(zx,Hx)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+zn(n.args,", ",this.toExpression,this)+")";case"operation":var e=n.operator.toUpperCase(),t=n.args||[];switch(n.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(Ko(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Ko(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(Lf(t[1])?t[1]:zn(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+zn(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};Dt.prototype.toEntity=function(n){if(Ko(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return Cp(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(zx,Hx)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case m6:return n;case p6:if(/^\d+$/.test(e))return e+" "}n+="^^"+this.encodeIRI(r.value)}return n;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return n.graph&&n.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(n.graph)+" { "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" } >>":"<< "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" >>";default:return this.encodeIRI(n.value)}else{var i=n.items.map(this.toEntity,this),s=n.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var zx=/["\\\t\n\r\b\f]/g,Hx=a(function(n){return g6[n]},"escapeReplacer"),g6={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};Dt.prototype.encodeIRI=function(n){var e=this._prefixRegex.exec(n);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+n+">"};Dt.prototype.toUpdate=function(n){switch(n.type||n.updateType){case"load":return"LOAD"+(n.source?" "+this.toEntity(n.source):"")+(n.destination?" INTO GRAPH "+this.toEntity(n.destination):"");case"insert":return"INSERT DATA "+this.group(n.insert,!0);case"delete":return"DELETE DATA "+this.group(n.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(n.delete,!0);case"insertdelete":return(n.graph?"WITH "+this.toEntity(n.graph)+this._newline:"")+(n.delete.length?"DELETE "+this.group(n.delete,!0)+this._newline:"")+(n.insert.length?"INSERT "+this.group(n.insert,!0)+this._newline:"")+(n.using?this.graphs("USING ",n.using.default):"")+(n.using?this.graphs("USING NAMED ",n.using.named):"")+"WHERE "+this.group(n.where,!0);case"add":case"copy":case"move":return n.type.toUpperCase()+" "+(n.silent?"SILENT ":"")+(n.source.default?"DEFAULT":this.toEntity(n.source.name))+" TO "+this.toEntity(n.destination.name);case"create":case"clear":case"drop":return n.type.toUpperCase()+(n.silent?" SILENT ":" ")+(n.graph.default?"DEFAULT":n.graph.named?"NAMED":n.graph.all?"ALL":"GRAPH "+this.toEntity(n.graph.name));default:throw new Error("Unknown update query type: "+n.type)}};Dt.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function Cp(n){return"?"+n.value}a(Cp,"variableToString");function Lf(n){return typeof n=="string"}a(Lf,"isString");function Ko(n){return typeof n.termType=="string"}a(Ko,"isTerm");function tc(n,e){if(!n||!Ko(n)||!e||!Ko(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&tc(n.datatype,e.datatype);case"Quad":return tc(n.subject,e.subject)&&tc(n.predicate,e.predicate)&&tc(n.object,e.object)&&tc(n.graph,e.graph);default:return n.value===e.value}}a(tc,"equalTerms");function zn(n,e,t,r){return n.map(t,r).join(Lf(e)?e:" ")}a(zn,"mapJoin");function y6(n={}){return{stringify:a(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new Dt(t).toQuery(e)},"stringify"),createGenerator:a(function(){return new Dt(n)},"createGenerator")}}a(y6,"_Generator");Kx.exports={Generator:y6}});var mS=w(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.BlankNode=void 0;var pS=class{static{a(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};Op.BlankNode=pS});var gS=w(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.DefaultGraph=void 0;var Nf=class{static{a(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};Dp.DefaultGraph=Nf;Nf.INSTANCE=new Nf});var Lp=w(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.NamedNode=void 0;var yS=class{static{a(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};Fp.NamedNode=yS});var bS=w(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});Np.Literal=void 0;var Xx=Lp(),kf=class n{static{a(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=n.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=n.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};Np.Literal=kf;kf.RDF_LANGUAGE_STRING=new Xx.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");kf.XSD_STRING=new Xx.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var SS=w(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});kp.Quad=void 0;var _S=class{static{a(this,"Quad")}constructor(e,t,r,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};kp.Quad=_S});var vS=w(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});Mp.Variable=void 0;var wS=class{static{a(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};Mp.Variable=wS});var Jx=w(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.DataFactory=void 0;var b6=mS(),_6=gS(),Yx=bS(),S6=Lp(),w6=SS(),v6=vS(),E6=0,ES=class{static{a(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${E6++}_`}namedNode(e){return new S6.NamedNode(e)}blankNode(e){return new b6.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new Yx.Literal(e,t)}variable(e){return new v6.Variable(e)}defaultGraph(){return _6.DefaultGraph.INSTANCE}quad(e,t,r,i){return new w6.Quad(e,t,r,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(Yx.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};jp.DataFactory=ES});var Zx=w(Hn=>{"use strict";var T6=Hn&&Hn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),rc=Hn&&Hn.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&T6(e,n,t)};Object.defineProperty(Hn,"__esModule",{value:!0});rc(mS(),Hn);rc(Jx(),Hn);rc(gS(),Hn);rc(bS(),Hn);rc(Lp(),Hn);rc(SS(),Hn);rc(vS(),Hn)});var tR=w((cle,eR)=>{var{Parser:no}=Wx(),{Generator:A6}=Qx(),{Wildcard:I6}=hS(),{DataFactory:x6}=Zx();function R6({prefixes:n,baseIRI:e,factory:t,pathOnly:r,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:o}={}){let c={};for(let u in n??{})c[u]=n[u];let l=new no;return l.parse=function(){return no.base=e||"",no.prefixes=Object.create(c),no.factory=t||new x6,no.sparqlStar=!!i,no.pathOnly=!!r,no.skipValidation=!!s||!!o,no.prototype.parse.apply(l,arguments)},l._resetBlanks=no._resetBlanks,l}a(R6,"_Parser");eR.exports={Parser:R6,Generator:A6,Wildcard:I6}});var AS=w(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.CaseWhenTransformerError=ol.CaseWhenTransformer=void 0;var TS=class{static{a(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new io("Too many nested CASE expressions (max 100 iterations)");while(t!==r);return t}stripLineComments(e){let t="",r=0;for(;r<e.length;){let i=e[r];if(i==="'"||i==='"'){let s=i;for(t+=i,r++;r<e.length&&e[r]!==s;){if(e[r]==="\\"&&r+1<e.length){t+=e[r]+e[r+1],r+=2;continue}t+=e[r],r++}r<e.length&&(t+=e[r],r++);continue}if(i==="<"){let s=e.indexOf(">",r),o=e.indexOf(`
40
+ `,this._explicitDatatype=!!n.explicitDatatype}a(Dt,"Generator");Dt.prototype.toQuery=function(n){var e="";return n.queryType&&(e+=n.queryType.toUpperCase()+" "),n.reduced&&(e+="REDUCED "),n.distinct&&(e+="DISTINCT "),n.variables?e+=zn(n.variables,void 0,function(t){return/^[?$]/.test(t)?t:Ko(t)?this.toEntity(t):"("+this.toExpression(t.expression)+" AS "+Cp(t.variable)+")"},this)+" ":n.template&&(e+=this.group(n.template,!0)+this._newline),n.from&&(e+=this.graphs("FROM ",n.from.default)+this.graphs("FROM NAMED ",n.from.named)),n.where&&(e+="WHERE "+this.group(n.where,!0)+this._newline),n.updates&&(e+=zn(n.updates,";"+this._newline,this.toUpdate,this)),n.group&&(e+="GROUP BY "+zn(n.group,void 0,function(t){var r=Ko(t.expression)?this.toEntity(t.expression):"("+this.toExpression(t.expression)+")";return t.variable?"("+r+" AS "+Cp(t.variable)+")":r},this)+this._newline),n.having&&(e+="HAVING ("+zn(n.having,void 0,this.toExpression,this)+")"+this._newline),n.order&&(e+="ORDER BY "+zn(n.order,void 0,function(t){var r="("+this.toExpression(t.expression)+")";return t.descending?"DESC "+r:r},this)+this._newline),n.offset&&(e+="OFFSET "+n.offset+this._newline),n.limit&&(e+="LIMIT "+n.limit+this._newline),n.values&&(e+=this.values(n)),e=this.baseAndPrefixes(n)+e,e.trim()};Dt.prototype.baseAndPrefixes=function(n){var e=n.base?"BASE <"+n.base+">"+this._newline:"",t="";for(var r in n.prefixes)(this._options.allPrefixes||this._usedPrefixes[r])&&(t+="PREFIX "+r+": <"+n.prefixes[r]+">"+this._newline);return e+t};Dt.prototype.toPattern=function(n){var e=n.type||n instanceof Array&&"array"||(n.subject&&n.predicate&&n.object?"triple":"");if(!(e in this))throw new Error("Unknown entry type: "+e);return this[e](n)};Dt.prototype.triple=function(n){return this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+"."};Dt.prototype.array=function(n){return zn(n,this._newline,this.toPattern,this)};Dt.prototype.bgp=function(n){return this.encodeTriples(n.triples)};Dt.prototype.encodeTriples=function(n){if(!n.length)return"";for(var e=[],t=void 0,r=void 0,i=0;i<n.length;i++){var s=n[i];tc(s.subject,t)?tc(s.predicate,r)?e.push(","):(r=s.predicate,e.push(";"+this._newline,this._indent,this.toEntity(r))):(t&&e.push("."+this._newline),t=s.subject,r=s.predicate,e.push(this.toEntity(t)," ",this.toEntity(r))),e.push(" ",this.toEntity(s.object))}return e.push("."),e.join("")};Dt.prototype.graph=function(n){return"GRAPH "+this.toEntity(n.name)+" "+this.group(n)};Dt.prototype.graphs=function(n,e){return!e||e.length===0?"":zn(e,"",function(t){return n+this.toEntity(t)+this._newline},this)};Dt.prototype.group=function(n,e){return n=e!==!0?this.array(n.patterns||n.triples):this.toPattern(n.type!=="group"?n:n.patterns),n.indexOf(this._newline)===-1?"{ "+n+" }":"{"+this._newline+this.indent(n)+this._newline+"}"};Dt.prototype.query=function(n){return this.toQuery(n)};Dt.prototype.filter=function(n){return"FILTER("+this.toExpression(n.expression)+")"};Dt.prototype.bind=function(n){return"BIND("+this.toExpression(n.expression)+" AS "+Cp(n.variable)+")"};Dt.prototype.optional=function(n){return"OPTIONAL "+this.group(n)};Dt.prototype.union=function(n){return zn(n.patterns,this._newline+"UNION"+this._newline,function(e){return this.group(e,!0)},this)};Dt.prototype.minus=function(n){return"MINUS "+this.group(n)};Dt.prototype.values=function(n){var e=Object.keys(n.values.reduce(function(i,s){for(var o in s)i[o]=!0;return i},{})),t,r;return e.length===1?t=r="":(t="(",r=")"),"VALUES "+t+e.join(" ")+r+" {"+this._newline+zn(n.values,this._newline,function(i){return" "+t+zn(e,void 0,function(s){return i[s]?this.toEntity(i[s]):"UNDEF"},this)+r},this)+this._newline+"}"};Dt.prototype.service=function(n){return"SERVICE "+(n.silent?"SILENT ":"")+this.toEntity(n.name)+" "+this.group(n)};Dt.prototype.toExpression=function(n){if(Ko(n))return this.toEntity(n);switch(n.type.toLowerCase()){case"aggregate":return n.aggregation.toUpperCase()+"("+(n.distinct?"DISTINCT ":"")+this.toExpression(n.expression)+(typeof n.separator=="string"?'; SEPARATOR = "'+n.separator.replace(zx,Hx)+'"':"")+")";case"functioncall":return this.toEntity(n.function)+"("+zn(n.args,", ",this.toExpression,this)+")";case"operation":var e=n.operator.toUpperCase(),t=n.args||[];switch(n.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(Ko(t[0])?this.toEntity(t[0]):"("+this.toExpression(t[0])+")")+" "+e+" "+(Ko(t[1])?this.toEntity(t[1]):"("+this.toExpression(t[1])+")");case"!":return"!("+this.toExpression(t[0])+")";case"uplus":return"+("+this.toExpression(t[0])+")";case"uminus":return"-("+this.toExpression(t[0])+")";case"notin":e="NOT IN";case"in":return this.toExpression(t[0])+" "+e+"("+(Lf(t[1])?t[1]:zn(t[1],", ",this.toExpression,this))+")";case"notexists":e="NOT EXISTS";case"exists":return e+" "+this.group(t[0],!0);default:return e+"("+zn(t,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+n.type)}};Dt.prototype.toEntity=function(n){if(Ko(n))switch(n.termType){case"Wildcard":return"*";case"Variable":return Cp(n);case"BlankNode":return"_:"+n.value;case"Literal":var e=n.value||"",t=n.language||"",r=n.datatype;if(n='"'+e.replace(zx,Hx)+'"',t)n+="@"+t;else if(r){if(!this._explicitDatatype)switch(r.value){case m6:return n;case p6:if(/^\d+$/.test(e))return e+" "}n+="^^"+this.encodeIRI(r.value)}return n;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return n.graph&&n.graph.termType!=="DefaultGraph"?"<< GRAPH "+this.toEntity(n.graph)+" { "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" } >>":"<< "+this.toEntity(n.subject)+" "+this.toEntity(n.predicate)+" "+this.toEntity(n.object)+" >>";default:return this.encodeIRI(n.value)}else{var i=n.items.map(this.toEntity,this),s=n.pathType;switch(s){case"^":case"!":return s+i[0];case"*":case"+":case"?":return"("+i[0]+s+")";default:return"("+i.join(s)+")"}}};var zx=/["\\\t\n\r\b\f]/g,Hx=a(function(n){return g6[n]},"escapeReplacer"),g6={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};Dt.prototype.encodeIRI=function(n){var e=this._prefixRegex.exec(n);if(e){var t=this._prefixByIri[e[1]];return this._usedPrefixes[t]=!0,t+":"+e[2]}return"<"+n+">"};Dt.prototype.toUpdate=function(n){switch(n.type||n.updateType){case"load":return"LOAD"+(n.source?" "+this.toEntity(n.source):"")+(n.destination?" INTO GRAPH "+this.toEntity(n.destination):"");case"insert":return"INSERT DATA "+this.group(n.insert,!0);case"delete":return"DELETE DATA "+this.group(n.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(n.delete,!0);case"insertdelete":return(n.graph?"WITH "+this.toEntity(n.graph)+this._newline:"")+(n.delete.length?"DELETE "+this.group(n.delete,!0)+this._newline:"")+(n.insert.length?"INSERT "+this.group(n.insert,!0)+this._newline:"")+(n.using?this.graphs("USING ",n.using.default):"")+(n.using?this.graphs("USING NAMED ",n.using.named):"")+"WHERE "+this.group(n.where,!0);case"add":case"copy":case"move":return n.type.toUpperCase()+" "+(n.silent?"SILENT ":"")+(n.source.default?"DEFAULT":this.toEntity(n.source.name))+" TO "+this.toEntity(n.destination.name);case"create":case"clear":case"drop":return n.type.toUpperCase()+(n.silent?" SILENT ":" ")+(n.graph.default?"DEFAULT":n.graph.named?"NAMED":n.graph.all?"ALL":"GRAPH "+this.toEntity(n.graph.name));default:throw new Error("Unknown update query type: "+n.type)}};Dt.prototype.indent=function(n){return n.replace(/^/gm,this._indent)};function Cp(n){return"?"+n.value}a(Cp,"variableToString");function Lf(n){return typeof n=="string"}a(Lf,"isString");function Ko(n){return typeof n.termType=="string"}a(Ko,"isTerm");function tc(n,e){if(!n||!Ko(n)||!e||!Ko(e)||n.termType!==e.termType)return!1;switch(n.termType){case"Literal":return n.value===e.value&&n.language===e.language&&tc(n.datatype,e.datatype);case"Quad":return tc(n.subject,e.subject)&&tc(n.predicate,e.predicate)&&tc(n.object,e.object)&&tc(n.graph,e.graph);default:return n.value===e.value}}a(tc,"equalTerms");function zn(n,e,t,r){return n.map(t,r).join(Lf(e)?e:" ")}a(zn,"mapJoin");function y6(n={}){return{stringify:a(function(e){var t=Object.create(n);return t.prefixes=e.prefixes,new Dt(t).toQuery(e)},"stringify"),createGenerator:a(function(){return new Dt(n)},"createGenerator")}}a(y6,"_Generator");Kx.exports={Generator:y6}});var mS=w(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.BlankNode=void 0;var pS=class{static{a(this,"BlankNode")}constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&e.termType==="BlankNode"&&e.value===this.value}};Op.BlankNode=pS});var gS=w(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});Dp.DefaultGraph=void 0;var Nf=class{static{a(this,"DefaultGraph")}constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&e.termType==="DefaultGraph"}};Dp.DefaultGraph=Nf;Nf.INSTANCE=new Nf});var Lp=w(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});Fp.NamedNode=void 0;var yS=class{static{a(this,"NamedNode")}constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&e.termType==="NamedNode"&&e.value===this.value}};Fp.NamedNode=yS});var bS=w(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});Np.Literal=void 0;var Xx=Lp(),kf=class n{static{a(this,"Literal")}constructor(e,t){this.termType="Literal",this.value=e,typeof t=="string"?(this.language=t,this.datatype=n.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=n.XSD_STRING)}equals(e){return!!e&&e.termType==="Literal"&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}};Np.Literal=kf;kf.RDF_LANGUAGE_STRING=new Xx.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");kf.XSD_STRING=new Xx.NamedNode("http://www.w3.org/2001/XMLSchema#string")});var SS=w(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});kp.Quad=void 0;var _S=class{static{a(this,"Quad")}constructor(e,t,r,i){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=i}equals(e){return!!e&&(e.termType==="Quad"||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}};kp.Quad=_S});var vS=w(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});Mp.Variable=void 0;var wS=class{static{a(this,"Variable")}constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&e.termType==="Variable"&&e.value===this.value}};Mp.Variable=wS});var Jx=w(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.DataFactory=void 0;var b6=mS(),_6=gS(),Yx=bS(),S6=Lp(),w6=SS(),v6=vS(),E6=0,ES=class{static{a(this,"DataFactory")}constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${E6++}_`}namedNode(e){return new S6.NamedNode(e)}blankNode(e){return new b6.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new Yx.Literal(e,t)}variable(e){return new v6.Variable(e)}defaultGraph(){return _6.DefaultGraph.INSTANCE}quad(e,t,r,i){return new w6.Quad(e,t,r,i||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(Yx.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}};jp.DataFactory=ES});var Zx=w(Hn=>{"use strict";var T6=Hn&&Hn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),rc=Hn&&Hn.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&T6(e,n,t)};Object.defineProperty(Hn,"__esModule",{value:!0});rc(mS(),Hn);rc(Jx(),Hn);rc(gS(),Hn);rc(bS(),Hn);rc(Lp(),Hn);rc(SS(),Hn);rc(vS(),Hn)});var tR=w((cle,eR)=>{var{Parser:io}=Wx(),{Generator:A6}=Qx(),{Wildcard:I6}=hS(),{DataFactory:x6}=Zx();function R6({prefixes:n,baseIRI:e,factory:t,pathOnly:r,sparqlStar:i,skipValidation:s,skipUngroupedVariableCheck:o}={}){let c={};for(let u in n??{})c[u]=n[u];let l=new io;return l.parse=function(){return io.base=e||"",io.prefixes=Object.create(c),io.factory=t||new x6,io.sparqlStar=!!i,io.pathOnly=!!r,io.skipValidation=!!s||!!o,io.prototype.parse.apply(l,arguments)},l._resetBlanks=io._resetBlanks,l}a(R6,"_Parser");eR.exports={Parser:R6,Generator:A6,Wildcard:I6}});var AS=w(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.CaseWhenTransformerError=ol.CaseWhenTransformer=void 0;var TS=class{static{a(this,"CaseWhenTransformer")}transform(e){let t=this.stripLineComments(e),r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new so("Too many nested CASE expressions (max 100 iterations)");while(t!==r);return t}stripLineComments(e){let t="",r=0;for(;r<e.length;){let i=e[r];if(i==="'"||i==='"'){let s=i;for(t+=i,r++;r<e.length&&e[r]!==s;){if(e[r]==="\\"&&r+1<e.length){t+=e[r]+e[r+1],r+=2;continue}t+=e[r],r++}r<e.length&&(t+=e[r],r++);continue}if(i==="<"){let s=e.indexOf(">",r),o=e.indexOf(`
41
41
  `,r);if(s!==-1&&(o===-1||s<o)){t+=e.substring(r,s+1),r=s+1;continue}}if(i==="#"){let s=e.indexOf(`
42
- `,r),o=s===-1?e.length:s;t+=" ".repeat(o-r),r=o;continue}t+=i,r++}return t}transformSinglePass(e){let t=this.findCasePositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],o=this.extractCaseExpression(r,s);if(o){let c=this.convertCaseToIf(o.content);r=r.substring(0,s)+c+r.substring(s+o.length)}}return r}findCasePositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(r.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){t.push(i),i+=4;continue}i++}return t}extractCaseExpression(e,t){let r=1,i=t+4,s=e.toUpperCase();for(;i<e.length&&r>0;){if(e[i]==="'"||e[i]==='"'){let o=e[i];for(i++;i<e.length&&e[i]!==o;)e[i]==="\\"&&i++,i++;i++;continue}if(s.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){r++,i+=4;continue}if(s.substring(i,i+3)==="END"&&this.isWordBoundary(e,i,3)){if(r--,r===0){let o=e.substring(t,i+3);return{content:o,length:o.length}}i+=3;continue}i++}if(r>0)throw new io(`Unclosed CASE expression at position ${t}`);return null}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_?$]/.test(i),o=t+r<e.length?e[t+r]:"",c=t+r>=e.length||!/[a-zA-Z0-9_]/.test(o);return s&&c}convertCaseToIf(e){let t=this.extractWhenClauses(e),r=this.extractElseClause(e);if(t.length===0)throw new io("CASE expression must have at least one WHEN clause");let i=r!==null?r:'""';for(let s=t.length-1;s>=0;s--){let{condition:o,result:c}=t[s];i=`IF(${o}, ${c}, ${i})`}return i}extractWhenClauses(e){let t=[],r=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),i=this.findKeywordPositions(r,"WHEN"),s=this.findKeywordPositions(r,"ELSE"),o=s.length>0?s[0]:r.length;for(let c=0;c<i.length;c++){let l=i[c]+4,u=c+1<i.length?i[c+1]:o,f=r.substring(l,u).trim(),d=this.parseWhenClause(f);d&&t.push(d)}return t}findKeywordPositions(e,t){let r=[],i=e.toUpperCase(),s=0,o=0;for(;s<e.length;){let c=e[s];if(c==="'"||c==='"'){let l=c;for(s++;s<e.length&&e[s]!==l;)e[s]==="\\"&&s++,s++;s++;continue}if(c==="("){o++,s++;continue}if(c===")"){o--,s++;continue}if(o===0&&i.substring(s,s+t.length)===t&&this.isWordBoundary(e,s,t.length)){r.push(s),s+=t.length;continue}s++}return r}parseWhenClause(e){let t=this.findKeywordPositions(e,"THEN");if(t.length===0)throw new io(`WHEN clause missing THEN keyword: ${e.substring(0,50)}...`);let r=t[0],i=e.substring(0,r).trim(),s=e.substring(r+4).trim();if(!i)throw new io("WHEN clause has empty condition");if(!s)throw new io("WHEN clause has empty result");return{condition:i,result:s}}extractElseClause(e){let t=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),r=this.findKeywordPositions(t,"ELSE");if(r.length>0){let i=r[0];return t.substring(i+4).trim()}return null}};ol.CaseWhenTransformer=TS;var io=class extends Error{static{a(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};ol.CaseWhenTransformerError=io});var IS=w(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.LateralTransformerError=al.LateralTransformer=void 0;var $p=class n{static{a(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Qo("Too many nested LATERAL joins (max 100 iterations)");while(t!==r);return t}hasLateral(e){return this.findLateralPositions(e).length>0}static isLateralJoin(e){if(e.type==="group"&&e.patterns){for(let t of e.patterns)if(t.type==="query"&&t.queryType==="SELECT"&&t.variables&&Array.isArray(t.variables)){for(let r of t.variables)if(r.termType==="Variable"&&r.value===n.LATERAL_MARKER)return!0}}if(e.type==="query"&&e.queryType==="SELECT"&&e.variables&&Array.isArray(e.variables)){for(let t of e.variables)if(t.termType==="Variable"&&t.value===n.LATERAL_MARKER)return!0}return!1}transformSinglePass(e){let t=this.findLateralPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],o=this.extractLateralExpression(r,s);if(o){let c=this.transformLateral(o.content);r=r.substring(0,s)+c+r.substring(s+o.length)}}return r}findLateralPositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(e[i]==="#"){for(;i<e.length&&e[i]!==`
42
+ `,r),o=s===-1?e.length:s;t+=" ".repeat(o-r),r=o;continue}t+=i,r++}return t}transformSinglePass(e){let t=this.findCasePositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],o=this.extractCaseExpression(r,s);if(o){let c=this.convertCaseToIf(o.content);r=r.substring(0,s)+c+r.substring(s+o.length)}}return r}findCasePositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(r.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){t.push(i),i+=4;continue}i++}return t}extractCaseExpression(e,t){let r=1,i=t+4,s=e.toUpperCase();for(;i<e.length&&r>0;){if(e[i]==="'"||e[i]==='"'){let o=e[i];for(i++;i<e.length&&e[i]!==o;)e[i]==="\\"&&i++,i++;i++;continue}if(s.substring(i,i+4)==="CASE"&&this.isWordBoundary(e,i,4)){r++,i+=4;continue}if(s.substring(i,i+3)==="END"&&this.isWordBoundary(e,i,3)){if(r--,r===0){let o=e.substring(t,i+3);return{content:o,length:o.length}}i+=3;continue}i++}if(r>0)throw new so(`Unclosed CASE expression at position ${t}`);return null}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_?$]/.test(i),o=t+r<e.length?e[t+r]:"",c=t+r>=e.length||!/[a-zA-Z0-9_]/.test(o);return s&&c}convertCaseToIf(e){let t=this.extractWhenClauses(e),r=this.extractElseClause(e);if(t.length===0)throw new so("CASE expression must have at least one WHEN clause");let i=r!==null?r:'""';for(let s=t.length-1;s>=0;s--){let{condition:o,result:c}=t[s];i=`IF(${o}, ${c}, ${i})`}return i}extractWhenClauses(e){let t=[],r=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),i=this.findKeywordPositions(r,"WHEN"),s=this.findKeywordPositions(r,"ELSE"),o=s.length>0?s[0]:r.length;for(let c=0;c<i.length;c++){let l=i[c]+4,u=c+1<i.length?i[c+1]:o,f=r.substring(l,u).trim(),d=this.parseWhenClause(f);d&&t.push(d)}return t}findKeywordPositions(e,t){let r=[],i=e.toUpperCase(),s=0,o=0;for(;s<e.length;){let c=e[s];if(c==="'"||c==='"'){let l=c;for(s++;s<e.length&&e[s]!==l;)e[s]==="\\"&&s++,s++;s++;continue}if(c==="("){o++,s++;continue}if(c===")"){o--,s++;continue}if(o===0&&i.substring(s,s+t.length)===t&&this.isWordBoundary(e,s,t.length)){r.push(s),s+=t.length;continue}s++}return r}parseWhenClause(e){let t=this.findKeywordPositions(e,"THEN");if(t.length===0)throw new so(`WHEN clause missing THEN keyword: ${e.substring(0,50)}...`);let r=t[0],i=e.substring(0,r).trim(),s=e.substring(r+4).trim();if(!i)throw new so("WHEN clause has empty condition");if(!s)throw new so("WHEN clause has empty result");return{condition:i,result:s}}extractElseClause(e){let t=e.replace(/^\s*CASE\s+/i,"").replace(/\s*END\s*$/i,""),r=this.findKeywordPositions(t,"ELSE");if(r.length>0){let i=r[0];return t.substring(i+4).trim()}return null}};ol.CaseWhenTransformer=TS;var so=class extends Error{static{a(this,"CaseWhenTransformerError")}constructor(e){super(`CASE WHEN transformation error: ${e}`),this.name="CaseWhenTransformerError"}};ol.CaseWhenTransformerError=so});var IS=w(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.LateralTransformerError=al.LateralTransformer=void 0;var $p=class n{static{a(this,"LateralTransformer")}transform(e){let t=e,r,i=0,s=100;do if(r=t,t=this.transformSinglePass(t),i++,i>s)throw new Qo("Too many nested LATERAL joins (max 100 iterations)");while(t!==r);return t}hasLateral(e){return this.findLateralPositions(e).length>0}static isLateralJoin(e){if(e.type==="group"&&e.patterns){for(let t of e.patterns)if(t.type==="query"&&t.queryType==="SELECT"&&t.variables&&Array.isArray(t.variables)){for(let r of t.variables)if(r.termType==="Variable"&&r.value===n.LATERAL_MARKER)return!0}}if(e.type==="query"&&e.queryType==="SELECT"&&e.variables&&Array.isArray(e.variables)){for(let t of e.variables)if(t.termType==="Variable"&&t.value===n.LATERAL_MARKER)return!0}return!1}transformSinglePass(e){let t=this.findLateralPositions(e);if(t.length===0)return e;let r=e;for(let i=t.length-1;i>=0;i--){let s=t[i],o=this.extractLateralExpression(r,s);if(o){let c=this.transformLateral(o.content);r=r.substring(0,s)+c+r.substring(s+o.length)}}return r}findLateralPositions(e){let t=[],r=e.toUpperCase(),i=0;for(;i<e.length;){if(e[i]==="'"||e[i]==='"'){let s=e[i];for(i++;i<e.length&&e[i]!==s;)e[i]==="\\"&&i++,i++;i++;continue}if(e[i]==="#"){for(;i<e.length&&e[i]!==`
43
43
  `;)i++;continue}if(r.substring(i,i+7)==="LATERAL"&&this.isWordBoundary(e,i,7)){t.push(i),i+=7;continue}i++}return t}extractLateralExpression(e,t){let r=t+7;for(;r<e.length&&/\s/.test(e[r]);)r++;if(e[r]!=="{")throw new Qo(`Expected '{' after LATERAL keyword at position ${t}`);let i=1;for(r++;r<e.length&&i>0;){if(e[r]==="'"||e[r]==='"'){let s=e[r];for(r++;r<e.length&&e[r]!==s;)e[r]==="\\"&&r++,r++;r++;continue}if(e[r]==="#"){for(;r<e.length&&e[r]!==`
44
44
  `;)r++;continue}if(e[r]==="{"){i++,r++;continue}if(e[r]==="}"){if(i--,i===0){let s=e.substring(t,r+1);return{content:s,length:s.length}}r++;continue}r++}if(i>0)throw new Qo(`Unclosed LATERAL block at position ${t}`);return null}transformLateral(e){let t=e.indexOf("{");if(t===-1)throw new Qo("LATERAL expression missing opening brace");let r=e.substring(t+1,e.length-1).trim();if(!r.toUpperCase().trim().startsWith("SELECT"))throw new Qo("LATERAL block must contain a SELECT subquery");let o=r.toUpperCase().indexOf("SELECT")+6;for(;o<r.length&&/\s/.test(r[o]);)o++;let c=r.substring(o).toUpperCase();return c.startsWith("DISTINCT")?o+=8:c.startsWith("REDUCED")&&(o+=7),`{ ${r.substring(0,o)+` ?${n.LATERAL_MARKER}`+r.substring(o)} }`}isWordBoundary(e,t,r){let i=t>0?e[t-1]:"",s=t===0||!/[a-zA-Z0-9_]/.test(i),o=t+r<e.length?e[t+r]:"",c=t+r>=e.length||!/[a-zA-Z0-9_]/.test(o);return s&&c}};al.LateralTransformer=$p;$p.LATERAL_MARKER="__LATERAL_JOIN__";var Qo=class extends Error{static{a(this,"LateralTransformerError")}constructor(e){super(`LATERAL transformation error: ${e}`),this.name="LateralTransformerError"}};al.LateralTransformerError=Qo});var rR=w(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.PrefixStarTransformerError=Xo.PrefixStarTransformer=Xo.WellKnownPrefixResolver=void 0;var Up=class{static{a(this,"WellKnownPrefixResolver")}constructor(){this.wellKnownPrefixes=new Map;let e=new Map;e.set("schema","http://schema.org/"),this.wellKnownPrefixes.set("http://schema.org/",e);let t=new Map;t.set("foaf","http://xmlns.com/foaf/0.1/"),this.wellKnownPrefixes.set("http://xmlns.com/foaf/0.1/",t);let r=new Map;r.set("dc","http://purl.org/dc/elements/1.1/"),r.set("dcterms","http://purl.org/dc/terms/"),this.wellKnownPrefixes.set("http://purl.org/dc/elements/1.1/",r),this.wellKnownPrefixes.set("http://purl.org/dc/terms/",r);let i=new Map;i.set("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),i.set("rdfs","http://www.w3.org/2000/01/rdf-schema#"),this.wellKnownPrefixes.set("http://www.w3.org/1999/02/22-rdf-syntax-ns#",i),this.wellKnownPrefixes.set("http://www.w3.org/2000/01/rdf-schema#",i);let s=new Map;s.set("owl","http://www.w3.org/2002/07/owl#"),this.wellKnownPrefixes.set("http://www.w3.org/2002/07/owl#",s);let o=new Map;o.set("xsd","http://www.w3.org/2001/XMLSchema#"),this.wellKnownPrefixes.set("http://www.w3.org/2001/XMLSchema#",o);let c=new Map;c.set("skos","http://www.w3.org/2004/02/skos/core#"),this.wellKnownPrefixes.set("http://www.w3.org/2004/02/skos/core#",c);let l=new Map;l.set("prov","http://www.w3.org/ns/prov#"),this.wellKnownPrefixes.set("http://www.w3.org/ns/prov#",l);let u=new Map;u.set("geo","http://www.w3.org/2003/01/geo/wgs84_pos#"),this.wellKnownPrefixes.set("http://www.w3.org/2003/01/geo/wgs84_pos#",u);let f=new Map;f.set("dcat","http://www.w3.org/ns/dcat#"),this.wellKnownPrefixes.set("http://www.w3.org/ns/dcat#",f)}async resolve(e){let t=e.endsWith("#")||e.endsWith("/")?e:e+(e.includes("#")?"":"/"),r=this.wellKnownPrefixes.get(t);if(r)return r;let i=t.slice(0,-1),s=this.wellKnownPrefixes.get(i);return s||new Map}addVocabulary(e,t){this.wellKnownPrefixes.set(e,t)}};Xo.WellKnownPrefixResolver=Up;var xS=class{static{a(this,"PrefixStarTransformer")}constructor(e){this.resolver=e??new Up}async transform(e){let t=this.findPrefixStarDeclarations(e);if(t.length===0)return e;let r=[],i=[];for(let o of t)try{let c=await this.resolver.resolve(o.uri);for(let[l,u]of c)r.push(`PREFIX ${l}: <${u}>`);if(c.size===0){let l=this.extractPrefixFromUri(o.uri);l&&r.push(`PREFIX ${l}: <${o.uri}>`)}}catch(c){let l=c instanceof Error?c.message:String(c);i.push(`Failed to resolve vocabulary ${o.uri}: ${l}`)}if(r.length===0&&i.length>0)throw new cl(i.join("; "));let s=e;for(let o=t.length-1;o>=0;o--){let c=t[o];s=s.substring(0,c.startPos)+s.substring(c.endPos)}return r.length>0&&(s=r.join(`
45
45
  `)+`
@@ -67,7 +67,7 @@ ${r}}`}default:throw new Ll(`Unsupported operation type for SPARQL generation: $
67
67
  `)}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 Ll(`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 o=e.variables[0],c=e.bindings.map(l=>{let u=l[o];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ");return`${r}VALUES ?${o} { ${c} }`}let i=e.variables.map(o=>`?${o}`).join(" "),s=e.bindings.map(o=>`(${e.variables.map(l=>{let u=o[l];return u?this.generateValuesTerm(u):"UNDEF"}).join(" ")})`);return`${r}VALUES (${i}) {
68
68
  ${s.map(o=>`${r} ${o}`).join(`
69
69
  `)}
70
- ${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 Ll(`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}}};Nl.SPARQLGenerator=Iw});var Ml=w(Nn=>{"use strict";var g7=Nn&&Nn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),y7=Nn&&Nn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),HR=Nn&&Nn.__importStar||(function(){var n=a(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"&&g7(t,e,r[i]);return y7(t,e),t}})();Object.defineProperty(Nn,"__esModule",{value:!0});Nn.QueryExecutor=Nn.ExoQLQueryExecutor=Nn.QueryExecutorError=void 0;var b7=zS(),_7=bm(),S7=fw(),w7=hw(),v7=kR(),E7=jR(),T7=BR(),A7=Ew(),I7=GR(),x7=WR(),R7=zR(),P7=Oe(),C7=qe(),O7=fm(),Vr="http://www.w3.org/2001/XMLSchema#",D7=new Set([`${Vr}integer`,`${Vr}decimal`,`${Vr}float`,`${Vr}double`,`${Vr}nonPositiveInteger`,`${Vr}negativeInteger`,`${Vr}long`,`${Vr}int`,`${Vr}short`,`${Vr}byte`,`${Vr}nonNegativeInteger`,`${Vr}unsignedLong`,`${Vr}unsignedInt`,`${Vr}unsignedShort`,`${Vr}unsignedByte`,`${Vr}positiveInteger`]),kl=class extends Error{static{a(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Nn.QueryExecutorError=kl;var xm=class{static{a(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new b7.BGPExecutor(e),this.filterExecutor=new _7.FilterExecutor,this.optionalExecutor=new S7.OptionalExecutor,this.unionExecutor=new w7.UnionExecutor,this.minusExecutor=new v7.MinusExecutor,this.valuesExecutor=new E7.ValuesExecutor,this.aggregateExecutor=new T7.AggregateExecutor,this.constructExecutor=new A7.ConstructExecutor,this.serviceExecutor=new I7.ServiceExecutor(t.serviceConfig),this.graphExecutor=new x7.GraphExecutor(e),this.sparqlGenerator=new R7.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 kl(`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 o of this.execute(e.left))t.push(o);if(t.length===0)return;let r=new Set;for(let o of t)for(let c of o.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(o=>i.has(o)))for(let o of t){let c=this.substituteVariables(e.right,o);for await(let l of this.execute(c)){let u=o.merge(l);u!==null&&(yield u)}}else{let o=[];for await(let c of this.execute(e.right))o.push(c);for(let c of t)for(let l of o){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>HR(bs())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let o of i.variables())if(r.has(o)){let c=i.get(o);c!==void 0&&s.set(o,c)}yield s}}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 o=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(o===void 0&&c===void 0?l=0:o===void 0?l=1:c===void 0?l=-1:typeof o=="number"&&typeof c=="number"?l=o-c:l=String(o).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(o=>this.filterExecutor.evaluateExpression(o,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}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 o=r.merge(s);o!==null&&(yield o)}}}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 e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(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),e)}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){let i=r;if(r instanceof P7.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")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(()=>HR(bs()));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}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);if(!r)return;if(r instanceof C7.Literal){let i=r.datatype?.value;if(i===`${Vr}dayTimeDuration`)try{return O7.DateTimeFunctions.parseDayTimeDuration(r.value)}catch{return r.value}if(i&&D7.has(i)){let s=parseFloat(r.value);if(!Number.isNaN(s))return s}return r.value}return r.value??r.id??String(r)}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,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 kl("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 kl("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Nn.ExoQLQueryExecutor=xm;Nn.QueryExecutor=xm});var tP=w(so=>{"use strict";var F7=so&&so.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},L7=so&&so.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},xw;Object.defineProperty(so,"__esModule",{value:!0});so.CommandResolver=void 0;var N7=je(),k7=rl(),Zt=Oe(),Gt=qe(),V=Jt(),KR=Vo(),QR=pf(),M7=il(),j7=Rp(),jl=Bb(),Rm=Vx(),$7=pl(),U7=gl(),B7=Ml(),Gf=10,Pm="exo__Asset",V7=Gf+1,XR="08cec529-90eb-4d43-88de-ceecccea12b0",G7=V.Namespace.EXOCMD.term("SubstitutionToken").value,YR=new Set(["today","todayStart","targetFolder","target","randomUUIDv4","nowTimestamp","nowDate","nowYear","nowMonth","userInputLabel","userInput","targetProperty","labelAsArray","groundingTargetClass"]);function q7(n,e){return`__SUBSTITUTE__${n}__${e}__`}a(q7,"buildSubstitutionMarker");function W7(n,e,t){let r=(0,M7.utf8ToBase64)(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`__SUBSTITUTE_P__${n}__${e}__${r}__`}a(W7,"buildParameterisedMarker");var JR="3f28af98-c031-4718-8ba2-44ad0b012c52",z7=V.Namespace.EXOCMD.term("TokenInvocation").value,ZR="29e2c8f8-2d27-4e58-b467-2e85d46f8122",eP="universal-default-template",H7=new Set(["today","todayStart","nowTimestamp","nowDate","nowYear","nowMonth"]),Rw=xw=class{static{a(this,"CommandResolver")}clearUniversalCache(){this._universalCacheReady=!1,this._universalCacheValue=null,(0,Rm.clearUniversalDefault)()}constructor(e,t=k7.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._ancestorDepthCache=new Map,this._legacyPropertyDefaultsWarnedGroundings=new Set,this._universalCacheReady=!1,this._universalCacheValue=null}async resolveForAssetMulti(e,t,r){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${r??""}`,o=this.multiCache.get(s);if(o)return o;let c=await this.expandClassHierarchy(t),l=new Map;for(let[h,p]of c){let y=await this.resolveForAsset(e,h,r);for(let g of y){let v=this.getBindingPriority(g.binding)===2?p:0,_=l.get(g.binding.id);(!_||v<_.depth)&&l.set(g.binding.id,{rc:g,depth:v})}}let u=new Set;for(let{rc:h}of l.values())if(h.binding.overrides)for(let p of h.binding.overrides)u.add(p);let f=Array.from(l.entries()).filter(([h])=>!u.has(h)).map(([,h])=>h);f.sort((h,p)=>{let y=this.getBindingPriority(h.rc.binding),g=this.getBindingPriority(p.rc.binding);return y!==g?y-g:h.depth!==p.depth?h.depth-p.depth:(h.rc.binding.order??100)-(p.rc.binding.order??100)});let d=f.map(h=>h.rc);return this.multiCache.set(s,d),d}async expandClassHierarchy(e){let t=new Map;for(let c of e){if(c===Pm){t.set(c,new Set);continue}let l=[];try{l=await this.getClassAncestors(c)}catch{l=[]}t.set(c,new Set(l))}let r=a(c=>{for(let l of e)if(l!==c&&t.get(l)?.has(c)&&!t.get(c)?.has(l))return!0;return!1},"isAncestorOfSibling"),i=e.filter(c=>!r(c)),s=new Map,o=a((c,l)=>{let u=s.get(c);(u===void 0||l<u)&&s.set(c,l)},"setMin");for(let c of i){if(o(c,0),this.looksLikeUUID(c))try{let u=await this.resolveLabelByUID(c);u&&o(u,0)}catch{}if(c===Pm)continue;let l=[];try{l=await this.getClassAncestorsWithDepth(c)}catch{l=[]}for(let{ref:u,depth:f}of l)o(u,f)}return s.has(Pm)||s.set(Pm,V7),s}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let o=await this.findBindings(t,r,e),c=[];for(let l of o){let u=await this.loadCommand(l.commandRef,{targetClass:l.targetClass});if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e,t){let r=await this.findSubjectByUID(e);if(!r||(await this.tripleStore.match(r,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command"))).length===0)return null;let s=await this.getLiteralValue(r,V.Namespace.EXO.term("Asset_label"))??"Unknown Command",o=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_labelTemplate")),c=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_icon")),l=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_confirmMessage")),u=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_successMessage")),f=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_category")),d=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_openInSameTab")),h=d!==null&&String(d).trim().toLowerCase()==="true",p=await this.loadLinkedPrecondition(r),y=await this.loadLinkedGrounding(r,0,t);return y?{id:e,name:s,labelTemplate:o??void 0,icon:c??void 0,precondition:p??void 0,grounding:y,confirmMessage:l??void 0,successMessage:u??void 0,category:f??void 0,openInSameTab:h||void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let o of i){let c=o.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command")),t=[],r=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid"));if(!c){this.logger.warn(`[CommandResolver] paletteEnabled command at ${s.value} has no exo__Asset_uid \u2014 skipped`);continue}let l=await this.loadCommand(c);if(!l){this.logger.warn(`[CommandResolver] paletteEnabled command ${c} could not be loaded (missing grounding?) \u2014 skipped`);continue}let u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(r.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}r.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear(),this._ancestorDepthCache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:o}of i){let c=await this.evaluateSelectSnippet(o,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let o=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:o,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new $7.ExoQLParser().parse(r),c=new U7.ExoQLAlgebraTranslator().translate(s),u=await new B7.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof Gt.Literal||h instanceof Zt.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,V.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetClass")),o=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!o&&!c)return null;let l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,h=await this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("CommandBinding_precondition")),p=await this.loadLinkedStyle(e,t),y=await this.getLinkedUIDs(e,V.Namespace.EXOCMD.term("CommandBinding_overrides"));return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:o??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,variant:d,precondition:h??void 0,style:p??void 0,overrides:y.length>0?y:void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,o=null;if(s instanceof Zt.IRI)o=s;else if(s instanceof Gt.Literal){let c=this.normalizeWikilink(s.value);o=await this.findSubjectByUID(c)}if(o){let c=await this.loadStyleAsset(o);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,o=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(o),l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_source")),y=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:y,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(jl.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${jl.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(jl.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${jl.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(jl.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${jl.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let o=this.extractPathBasename(r);if(o&&o===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Zt.IRI)s=i;else if(i instanceof Gt.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let o=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,V.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof Zt.IRI){let p=await this.getLiteralValue(h,V.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof Gt.Literal&&(d=this.normalizeWikilink(h.value))}return!o||!l&&!u&&!d?null:{id:o,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t,r){if(t>=Gf)return null;let i=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Command_grounding"),void 0);if(i.length===0)return null;if(i.length===1||!r?.targetClass){let o=await this.resolveGroundingRef(i[0].object);return o?this.loadGroundingDefinition(o,t):null}for(let o of i){let c=await this.resolveGroundingRef(o.object);if(!c)continue;let l=await this.getObsidianName(c,V.Namespace.EXOCMD.term("Grounding_targetPrototype"));if(l&&this.matchesReference(l,r.targetClass))return this.loadGroundingDefinition(c,t)}this.logger.warn(`Command ${e.value}: ${i.length} groundings declared, none matched context.targetClass='${r.targetClass}' via Grounding_targetPrototype \u2014 falling back to first grounding by iteration order (legacy behaviour). Check that one grounding's Grounding_targetPrototype references this targetClass.`);let s=await this.resolveGroundingRef(i[0].object);return s?this.loadGroundingDefinition(s,t):null}async resolveGroundingRef(e){if(e instanceof Zt.IRI)return e;if(e instanceof Gt.Literal){let t=this.normalizeWikilink(e.value);return await this.findSubjectByUID(t)}return null}async loadGroundingByUid(e){let t=await this.findSubjectByUID(e);return t?this.loadGroundingDefinition(t,0):null}async loadGroundingDefinition(e,t){if(t>=Gf)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",s=await this.resolveGroundingTypeReference(e);if(!s)return null;let o=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetProperty"));if(o&&this.looksLikeUUID(o)){let j=await this.resolveLabelByUID(o);if(!j)return this.logger.warn(`Grounding ${r}: targetProperty wikilink UID '${o}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;o=j}if(s===KR.GroundingType.SERVICE_CALL){let j=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_serviceId"));j&&(o=j)}let c=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueRef")),l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),u=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),f=null;if(u&&this.looksLikeUUID(u)){let j=await this.resolveLabelByUID(u);if(!j)return this.logger.warn(`Grounding ${r}: targetValueSubstitution UID '${u}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;f=j}else u&&(f=u);let d=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueQuery")),h=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_serviceCallPayload")),p=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_appendExpression")),y=await this.getObsidianWikilinkValue(e,V.Namespace.EXOCMD.term("Grounding_isDefinedBy")),g=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),v=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetClass"));if(v&&!this.looksLikeUUID(v)){let j=await this.findUidByLabel(v);j&&(v=j)}let _=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetPrototype")),S=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetFolder")),T=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_linkBackProperty")),I=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_inputSchema")),A=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_incrementBy")),R=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_shiftDelta")),q;if(A!=null&&A!==""){let j=Number.parseInt(String(A),10);Number.isFinite(j)&&(q=j)}let Y=await this.resolvePropertyDefaults(e,r),C=await this.resolveInheritanceRules(e,r),O=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_propertyDefaults"));O!==null&&O!==""&&!this._legacyPropertyDefaultsWarnedGroundings.has(r)&&(this.logger.warn(`Grounding ${r}: deprecated exocmd__Grounding_propertyDefaults (plural) JSON predicate detected \u2014 the parser was removed in RFC v2 Phase 5 (#3167); value is ignored. Migrate to ref-form exocmd__Grounding_propertyDefault (singular) pointing to exocmd__PropertyDefault assets. See vault TBox c8f87363-d39c-45cb-9d4d-1be96d70f892 for the canonical replacement.`),this._legacyPropertyDefaultsWarnedGroundings.add(r));let k;s===KR.GroundingType.COMPOSITE&&(k=await this.loadCompositeSteps(e,t+1));let H;if(I)try{let j=JSON.parse(I);j?.properties&&(H=Object.entries(j.properties).map(([se,be])=>{let W=be.type,Ee=W==="string"?"text":W,Ve=be.defaultValue!==void 0?be.defaultValue:be.default,ye={name:se,type:Ee,label:be.title??se,required:Array.isArray(j.required)&&j.required.includes(se)};return Ve!=null&&(ye.defaultValue=String(Ve)),ye}))}catch{}let G=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),B=G!==null&&String(G).trim().toLowerCase()==="true",Z=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_labelTemplate")),_e=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_direction")),ie;if(_e!=null){let j=String(_e).trim().toLowerCase();j==="forward"||j==="rollback"?ie=j:j!==""&&this.logger.warn(`Grounding ${r}: exocmd__Grounding_direction value '${_e}' is not 'forward' or 'rollback' \u2014 treating as undefined (will default to 'forward' at dispatch).`)}let N={id:r,label:i,type:s,targetProperty:o??void 0,targetValueRef:c??void 0,targetValueLiteral:l??void 0,targetValueSubstitution:f??void 0,targetValueQuery:d??void 0,serviceCallPayload:h??void 0,appendExpression:p??void 0,sparqlUpdate:g??void 0,steps:k,targetClass:v??void 0,targetPrototype:_??void 0,targetFolder:S??void 0,linkBackProperty:T??void 0,incrementBy:q,shiftDelta:R??void 0,propertyDefault:Y.length>0?Y:void 0,inheritanceRule:C.length>0?C:void 0,isDefinedBy:y??void 0,prefillLabelWithDate:B||void 0,labelTemplate:Z??void 0,direction:ie};return H&&(N.inputSchema=H),N}async loadCompositeSteps(e,t){if(t>=Gf)return[];let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let o=null;if(s.object instanceof Zt.IRI)o=s.object;else if(s.object instanceof Gt.Literal){let l=this.normalizeWikilink(s.object.value);o=await this.findSubjectByUID(l)}if(!o)continue;let c=await this.loadGroundingDefinition(o,t);c&&i.push(c)}return i}async resolvePropertyDefaults(e,t){let r=await this.resolvePropertyDefaultsForSubject(e,t,V.Namespace.EXOCMD.term("Grounding_propertyDefault")),i=await this.getUniversalCache();return i&&i.propertyDefaults.length>0?(0,Rm.mergePropertyDefaults)(i.propertyDefaults,r):r}async resolvePropertyDefaultsForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[];for(let o of i){let c=await this.resolveRefTripleObject(o.object);if(!c)continue;let l=await this.getObsidianName(c,V.Namespace.EXOCMD.term("PropertyDefault_property"));if(!l){this.logger.warn(`Grounding ${t}: PropertyDefault asset missing exocmd__PropertyDefault_property \u2014 entry skipped.`);continue}let u=this.looksLikeUUID(l)?await this.resolveLabelByUID(l):l;if(!u){this.logger.warn(`Grounding ${t}: PropertyDefault property UID '${l}' is not resolvable to exo__Asset_label \u2014 entry skipped.`);continue}let f=await this.getObsidianName(c,V.Namespace.EXOCMD.term("PropertyDefault_value"));if(!f){this.logger.warn(`Grounding ${t}: PropertyDefault '${u}' missing exocmd__PropertyDefault_value \u2014 entry skipped.`);continue}let d=await this.resolvePropertyDefaultValue(f,t,u);d!==null&&s.push({propertyName:u,value:d})}return s}async getUniversalCache(){if(this._universalCacheReady)return this._universalCacheValue;this._universalCacheReady=!0;let e=await(0,Rm.loadUniversalDefault)();if(e)return this._universalCacheValue=e,e;let t=await this.findUniversalSingleton();if(!t)return this._universalCacheValue=null,null;let r=await this.resolvePropertyDefaultsForSubject(t,eP,V.Namespace.EXOCMD.term("Template_propertyDefault")),i=await this.resolveInheritanceRulesForSubject(t,eP,V.Namespace.EXOCMD.term("Template_inheritanceRule"));return this._universalCacheValue={propertyDefaults:r,inheritanceRules:i},this._universalCacheValue}async findUniversalSingleton(){let e=V.Namespace.EXOCMD.term("UniversalDefaultTemplate").value,t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Instance_class"),void 0),r=[];for(let i of t){let s=!1;if(i.object instanceof Zt.IRI)s=i.object.value===e||i.object.value.includes(ZR);else if(i.object instanceof Gt.Literal){let o=this.unwrapWikilink(i.object.value);s=o==="exocmd__UniversalDefaultTemplate"||o===ZR}s&&i.subject instanceof Zt.IRI&&r.push(i.subject)}return r.length===0?null:(r.length===1||(r.sort((i,s)=>i.value.localeCompare(s.value)),this.logger.warn(`Multiple UniversalDefaultTemplate singletons found (${r.length}); selecting deterministically by lexicographic UID order: ${r[0].value}`)),r[0])}async resolveInheritanceRules(e,t){let r=await this.resolveInheritanceRulesForSubject(e,t,V.Namespace.EXOCMD.term("Grounding_inheritanceRule")),i=await this.getUniversalCache();return i&&i.inheritanceRules.length>0?(0,Rm.mergeInheritanceRules)(i.inheritanceRules,r):r}async resolveInheritanceRulesForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[],o=t;for(let c of i){let l=await this.resolveRefTripleObject(c.object);if(!l)continue;let u=await this.resolveLabelRef(l,V.Namespace.EXOCMD.term("InheritanceRule_sourceProperty"));if(!u){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_sourceProperty \u2014 entry skipped.`);continue}let f=await this.resolveLabelRef(l,V.Namespace.EXOCMD.term("InheritanceRule_targetProperty"));if(!f){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_targetProperty \u2014 entry skipped.`);continue}let d=await this.tripleStore.match(l,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),h,p;if(d.length>0){let I=await this.getObsidianName(l,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!I||!I.trim()){this.logger.warn(`Grounding ${o}: InheritanceRule has exocmd__InheritanceRule_targetClassCondition triple but ref is unresolvable \u2014 entire rule skipped (would otherwise apply unconditionally, broadening scope).`);continue}this.looksLikeUUID(I)?(p=I,h=await this.resolveLabelByUID(I)??void 0):h=I}let y=await this.tripleStore.match(l,V.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),g=[],v=[],_=!1;for(let I of y){let A=null;if(I.object instanceof Zt.IRI?A=this.iriToObsidianName(I.object.value)??I.object.value:I.object instanceof Gt.Literal&&(A=this.unwrapWikilink(I.object.value)),!A){_=!0;continue}if(this.looksLikeUUID(A)){v.push(A);let R=await this.resolveLabelByUID(A);R&&g.push(R)}else g.push(A)}if(_){this.logger.warn(`Grounding ${o}: InheritanceRule has unresolvable exocmd__InheritanceRule_targetClassExclusion entry \u2014 entire rule skipped (would otherwise expand scope by silently dropping the excluded class).`);continue}let S=await this.getLiteralValue(l,V.Namespace.EXOCMD.term("InheritanceRule_priority")),T=50;if(S!==null&&S!==""){let I=Number.parseInt(String(S),10);Number.isFinite(I)&&(T=I)}s.push({sourcePropertyName:u,targetPropertyName:f,targetClassCondition:h,targetClassConditionUid:p,targetClassExclusion:g,targetClassExclusionUids:v,priority:T})}return s}async resolveRefTripleObject(e){if(e instanceof Zt.IRI)return e;if(e instanceof Gt.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let r=await this.getObsidianName(e,t);return r?this.looksLikeUUID(r)?this.resolveLabelByUID(r):r:null}async resolvePropertyDefaultValue(e,t,r){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);return i?await this.assetIsTokenInvocation(i)?this.resolveTokenInvocation(i,e,t,r):await this.assetIsSubstitutionToken(i)?this.dispatchSubstitutionToken(i,e,t,r,void 0):`"[[${e}]]"`:`"[[${e}]]"`}async dispatchSubstitutionToken(e,t,r,i,s){let o=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!o||!o.trim())return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' references SubstitutionToken '${t}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${t}]]"`;let c=o.trim();return YR.has(c)?s!==void 0?W7(c,t,s):H7.has(c)?xw.parseTimeResolve(c):q7(c,t):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' SubstitutionToken '${t}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(YR).join(", ")}.`),`"[[${t}]]"`)}static parseTimeResolve(e){let t=new Date,r=a(i=>i<10?`0${i}`:String(i),"pad");switch(e){case"today":return t.toISOString().slice(0,10);case"todayStart":return new Date(new Date().setHours(0,0,0,0)).toISOString();case"nowTimestamp":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`;case"nowDate":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`;case"nowYear":return String(t.getFullYear());case"nowMonth":return r(t.getMonth()+1);default:return""}}async resolveTokenInvocation(e,t,r,i){let s=await this.getObsidianName(e,V.Namespace.EXOCMD.term("TokenInvocation_token"));if(!s)return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' missing exocmd__TokenInvocation_token \u2014 entry skipped.`),null;let o=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("TokenInvocation_parameter"))??"";if(!this.looksLikeUUID(s))return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' references non-UUID token '${s}' \u2014 entry skipped.`),null;let c=await this.findSubjectByUID(s);return c?this.dispatchSubstitutionToken(c,s,r,i,o):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' token ref '${s}' not found in store \u2014 entry skipped.`),null)}async assetIsTokenInvocation(e){let t=await this.tripleStore.match(e,V.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===z7||r.object.value.includes(JR))return!0}else if(r.object instanceof Gt.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__TokenInvocation"||i===JR)return!0}return!1}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,V.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===G7||r.object.value.includes(XR))return!0}else if(r.object instanceof Gt.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__SubstitutionToken"||i===XR)return!0}return!1}async resolveGroundingTypeReference(e){let t=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_type"),void 0);if(t.length===0)return null;let r=t[0].object;if(r instanceof Zt.IRI)return(0,QR.resolveGroundingTypeFromIRI)(r.value);if(r instanceof Gt.Literal){let i=r.value,s=i.match(/^\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]$/i);return s?(0,QR.resolveGroundingTypeFromIRI)(`obsidian://vault/${s[1].toLowerCase()}.md`):(this.logger.warn(`[exocmd-grounding-type-literal-form] legacy literal-string form '${i}' for exocmd__Grounding_type on <${e.value}>. Migrate to wikilink form per RFC 9d20c91f Phase 3.`),null)}return null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof Gt.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Gt.Literal||i instanceof Zt.IRI?i.value:null}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)}async resolveLabelByUID(e){let t=await this.findSubjectByUID(e);return t?this.getLiteralValue(t,V.Namespace.EXO.term("Asset_label")):null}async getClassAncestors(e){return(await this.getClassAncestorsWithDepth(e)).map(r=>r.ref)}async getClassAncestorsWithDepth(e){let t=this._ancestorDepthCache.get(e);if(t)return t;let r=new Map,i=new Set,s=await this.resolveClassFileIRI(e);if(!s)return[];let o=new Set([e]),c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid"));c&&o.add(c);let l=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_label"));l&&o.add(l);let u=a((h,p)=>{if(o.has(h))return;let y=r.get(h);(y===void 0||p<y)&&r.set(h,p)},"setMin"),f=[{fileIRI:s,depth:0}];for(;f.length>0;){let h=f.shift();if(!h)break;let{fileIRI:p,depth:y}=h;if(y>=Gf||i.has(p.value))continue;i.add(p.value);let g=await this.tripleStore.match(p,V.Namespace.EXO.term("Class_superClass"),void 0);for(let v of g){let _=v.object;if(!(_ instanceof Zt.IRI))continue;let S=y+1,T=_.value.startsWith("obsidian://vault/"),I=this.iriToObsidianName(_.value);I&&u(I,S);let A=null;if(T?A=_:I&&(A=await this.resolveClassFileIRI(I)),!A)continue;let R=await this.getLiteralValue(A,V.Namespace.EXO.term("Asset_uid"));R&&u(R,S),i.has(A.value)||f.push({fileIRI:A,depth:S})}}let d=Array.from(r.entries()).map(([h,p])=>({ref:h,depth:p}));return this._ancestorDepthCache.set(e,d),d}async resolveClassFileIRI(e){if(this.looksLikeUUID(e))return this.findSubjectByUID(e);let t=await this.findUidByLabel(e);return t?this.findSubjectByUID(t):null}async findUidByLabel(e){let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_label"),void 0);for(let r of t)if(r.object instanceof Gt.Literal&&r.object.value===e&&r.subject instanceof Zt.IRI){let i=await this.tripleStore.match(r.subject,V.Namespace.EXO.term("Asset_uid"),void 0);if(i.length>0&&i[0].object instanceof Gt.Literal)return i[0].object.value}return null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Zt.IRI){let s=await this.tripleStore.match(i,V.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof Gt.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof Gt.Literal?this.normalizeWikilink(i.value):null}async getLinkedUIDs(e,t){let r=await this.tripleStore.match(e,t,void 0),i=[];for(let s of r){let o=s.object;if(o instanceof Zt.IRI){let c=await this.tripleStore.match(o,V.Namespace.EXO.term("Asset_uid"),void 0);if(c.length>0&&c[0].object instanceof Gt.Literal)i.push(c[0].object.value);else{let l=o.value.split("/").pop()?.replace(".md","");l&&i.push(l)}}else if(o instanceof Gt.Literal){let c=this.normalizeWikilink(o.value);c&&i.push(c)}}return i}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Gt.Literal?this.normalizeWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Gt.Literal?this.unwrapWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}unwrapWikilink(e){if(!e)return e;let t=e.trim().replace(/^"|"$/g,"");if(t.startsWith("http://")||t.startsWith("https://"))return this.iriToObsidianName(t)??t;let r=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(r)return r[2].trim();let i=t.match(/^\[\[([^\]|]+)\]\]$/);if(i){let s=i[1].trim();return s.startsWith("http://")||s.startsWith("https://")?this.iriToObsidianName(s)??s:s}return t}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Gt.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Zt.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,V.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){return(0,j7.iriToObsidianName)(e)}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};so.CommandResolver=Rw;so.CommandResolver=Rw=xw=F7([(0,N7.injectable)(),L7("design:paramtypes",[Object,Object])],Rw)});var Cw=w(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});Pw.validateExoQLAllowlist=K7;var Cm=Bf();function K7(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new Cm.ExoQLForbiddenKeywordError("LOAD");throw new Cm.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new Cm.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)Om(t);if(Array.isArray(e.template))for(let t of e.template)Om(t)}}a(K7,"validateExoQLAllowlist");function Om(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new Cm.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)Om(t);let e=n.where;if(Array.isArray(e))for(let t of e)Om(t)}a(Om,"walkPatternForBannedKeywords")});var Ow=w(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.DEFAULT_EVAL_CONFIG=void 0;Dm.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var Fm=w(Dw=>{"use strict";Object.defineProperty(Dw,"__esModule",{value:!0});Dw.evaluateWithExoEval=t8;var Q7=pl(),X7=gl(),Y7=Ml(),J7=Cw(),Z7=Ow(),e8=Bf();async function t8(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new Q7.ExoQLParser().parse(n);if((0,J7.validateExoQLAllowlist)(r),!{...Z7.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new e8.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new X7.ExoQLAlgebraTranslator().translate(r),l=new Y7.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}a(t8,"evaluateWithExoEval")});var qf=w(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});Lm.liveClock=r8;Lm.frozenClock=n8;function r8(){return{now:a(()=>new Date,"now")}}a(r8,"liveClock");function n8(n){let e=new Date(n);return{now:a(()=>new Date(e.getTime()),"now")}}a(n8,"frozenClock")});var nP=w(oo=>{"use strict";var i8=oo&&oo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},s8=oo&&oo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Wf;Object.defineProperty(oo,"__esModule",{value:!0});oo.PreconditionEvaluator=void 0;var o8=je(),a8=pl(),c8=gl(),rP=Ml(),l8=Fm(),u8=qf(),zf=Wf=class{static{a(this,"PreconditionEvaluator")}constructor(e,t,r){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=r?.clock??(0,u8.liveClock)()}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,l8.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}evaluateHostFunctionSync(e,t,r){return this.hostFunctions.has(e)?this.evaluateHostFunction(e,t,r):null}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Wf.SENTINEL_IRI),i=new a8.ExoQLParser().parse(t),o=new c8.ExoQLAlgebraTranslator().translate(i);return new rP.ExoQLQueryExecutor(this.tripleStore).isAskQuery(o)?o:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};return i(s)}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let o=this.compileAsk(e);if(!o)return!1;r=o,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Wf.SENTINEL_IRI,t));return await new rP.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=this.clock.now(),i=r.toISOString(),s=i.slice(0,10),o=new Date(r.getTime()+Wf.ALMATY_OFFSET_MS),c=o.getUTCFullYear(),l=o.getUTCMonth(),u=o.getUTCDate(),f=o.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,y=new Date(Date.UTC(c,l,u-p)),g=y.toISOString().slice(0,10),_=new Date(y.getTime()-10080*60*1e3).toISOString().slice(0,10),S=`${c}-${String(l+1).padStart(2,"0")}-01`,T=l===0?11:l-1,A=`${l===0?c-1:c}-${String(T+1).padStart(2,"0")}-01`,R=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${g}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${_}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${S}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${A}"^^xsd:date`).replace(/\$thisYearStart/g,`"${R}"^^xsd:date`).replace(/\$today/g,`"${s}"^^xsd:date`)}};oo.PreconditionEvaluator=zf;zf.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";zf.ALMATY_OFFSET_MS=300*60*1e3;oo.PreconditionEvaluator=zf=Wf=i8([(0,o8.injectable)(),s8("design:paramtypes",[Object,Object,Object])],zf)});var iP=w(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.hasUidFilename=ao.hasNonUidFilename=void 0;ao.registerDefaultHostFunctions=h8;var f8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");ao.hasNonUidFilename=f8;var d8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t===e},"hasUidFilename");ao.hasUidFilename=d8;function h8(n){n.registerHostFunction("hasNonUidFilename",ao.hasNonUidFilename),n.registerHostFunction("hasUidFilename",ao.hasUidFilename)}a(h8,"registerDefaultHostFunctions")});var km=w(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});Nm.liveUidGenerator=p8;Nm.seededUidGenerator=g8;var Fw=Ai();function p8(){return{next:a(()=>(0,Fw.v4)(),"next")}}a(p8,"liveUidGenerator");var m8="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function g8(n){let e=0,t=(0,Fw.v5)(n,m8);return{next:a(()=>{let r=`${n}#${e}`;return e+=1,(0,Fw.v5)(r,t)},"next")}}a(g8,"seededUidGenerator")});var Hf=w($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.registerOrderSpecLoader=y8;$l.clearOrderSpecLoader=b8;$l.loadDefaultSpec=_8;$l.orderProperties=S8;var Mm=null,ta,jm=!1;function y8(n){Mm=n,ta=void 0,jm=!1}a(y8,"registerOrderSpecLoader");function b8(){Mm=null,ta=void 0,jm=!1}a(b8,"clearOrderSpecLoader");function _8(){if(ta!==void 0)return ta;if(!Mm)return ta=null,null;try{ta=Mm()}catch(n){jm||(console.warn("[OrderSpecResolver] loader threw, falling back to insertion order:",n),jm=!0),ta=null}return ta}a(_8,"loadDefaultSpec");function S8(n,e){if(!e||e.head.length===0&&e.tail.length===0)return n;let t=Object.keys(n),r=new Set(e.head),i=new Set(e.tail),s=e.head.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),o=e.tail.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),c=t.filter(u=>!r.has(u)&&!i.has(u));e.middleStrategy==="alphabetical"&&c.sort((u,f)=>u.localeCompare(f));let l={};for(let u of s)l[u]=n[u];for(let u of c)l[u]=n[u];for(let u of o)l[u]=n[u];return l}a(S8,"orderProperties")});var vs=w($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.FrontmatterService=void 0;var sP=Hf(),Kf=class n{static{a(this,"FrontmatterService")}parse(e){let t=e.match(n.FRONTMATTER_REGEX);return t?{exists:!0,content:t[1],originalContent:e}:{exists:!1,content:"",originalContent:e}}parseObject(e){let t=this.parse(e);if(!t.exists)return null;let r={},i=t.content.split(/\r?\n/),s=null,o=null,c=a(()=>{s!==null&&o!==null&&(r[s]=o),s=null,o=null},"flushArray");for(let l of i){let u=/^ {2}- (.*)$/.exec(l);if(u){s!==null&&o!==null&&o.push(u[1].trim());continue}c();let f=/^([^:\s][^:]*):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(s=d,o=[]):r[d]=h}return c(),r}updateProperty(e,t,r){t=n.normalizeIRI(t),typeof r=="string"&&(r=n.normalizeIRIValue(r));let i=this.parse(e),s=this.serializeValue(t,r);if(!i.exists)return`---
70
+ ${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 Ll(`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}}};Nl.SPARQLGenerator=Iw});var Ml=w(Nn=>{"use strict";var g7=Nn&&Nn.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),y7=Nn&&Nn.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),HR=Nn&&Nn.__importStar||(function(){var n=a(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"&&g7(t,e,r[i]);return y7(t,e),t}})();Object.defineProperty(Nn,"__esModule",{value:!0});Nn.QueryExecutor=Nn.ExoQLQueryExecutor=Nn.QueryExecutorError=void 0;var b7=zS(),_7=bm(),S7=fw(),w7=hw(),v7=kR(),E7=jR(),T7=BR(),A7=Ew(),I7=GR(),x7=WR(),R7=zR(),P7=Oe(),C7=qe(),O7=fm(),Vr="http://www.w3.org/2001/XMLSchema#",D7=new Set([`${Vr}integer`,`${Vr}decimal`,`${Vr}float`,`${Vr}double`,`${Vr}nonPositiveInteger`,`${Vr}negativeInteger`,`${Vr}long`,`${Vr}int`,`${Vr}short`,`${Vr}byte`,`${Vr}nonNegativeInteger`,`${Vr}unsignedLong`,`${Vr}unsignedInt`,`${Vr}unsignedShort`,`${Vr}unsignedByte`,`${Vr}positiveInteger`]),kl=class extends Error{static{a(this,"QueryExecutorError")}constructor(e,t){super(e,t?{cause:t}:void 0),this.name="QueryExecutorError"}};Nn.QueryExecutorError=kl;var xm=class{static{a(this,"ExoQLQueryExecutor")}constructor(e,t={}){this.tripleStore=e,this.bgpExecutor=new b7.BGPExecutor(e),this.filterExecutor=new _7.FilterExecutor,this.optionalExecutor=new S7.OptionalExecutor,this.unionExecutor=new w7.UnionExecutor,this.minusExecutor=new v7.MinusExecutor,this.valuesExecutor=new E7.ValuesExecutor,this.aggregateExecutor=new T7.AggregateExecutor,this.constructExecutor=new A7.ConstructExecutor,this.serviceExecutor=new I7.ServiceExecutor(t.serviceConfig),this.graphExecutor=new x7.GraphExecutor(e),this.sparqlGenerator=new R7.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 kl(`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 o of this.execute(e.left))t.push(o);if(t.length===0)return;let r=new Set;for(let o of t)for(let c of o.variables())r.add(c);let i=this.collectOperationVariables(e.right);if([...r].some(o=>i.has(o)))for(let o of t){let c=this.substituteVariables(e.right,o);for await(let l of this.execute(c)){let u=o.merge(l);u!==null&&(yield u)}}else{let o=[];for await(let c of this.execute(e.right))o.push(c);for(let c of t)for(let l of o){let u=c.merge(l);u!==null&&(yield u)}}}async*executeLeftJoin(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.optionalExecutor.execute(i(),s())}async*executeUnion(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.unionExecutor.execute(i(),s())}async*executeMinus(e){let t=[];for await(let o of this.execute(e.left))t.push(o);let r=[];for await(let o of this.execute(e.right))r.push(o);async function*i(){for(let o of t)yield o}a(i,"leftGen");async function*s(){for(let o of r)yield o}a(s,"rightGen"),yield*this.minusExecutor.execute(i(),s())}async*executeValues(e){yield*this.valuesExecutor.execute(e)}async*executeProject(e){let{SolutionMapping:t}=await Promise.resolve().then(()=>HR(bs())),r=new Set(e.variables);for await(let i of this.execute(e.input)){let s=new t;for(let o of i.variables())if(r.has(o)){let c=i.get(o);c!==void 0&&s.set(o,c)}yield s}}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 o=this.getExpressionValue(s.expression,r),c=this.getExpressionValue(s.expression,i),l=0;if(o===void 0&&c===void 0?l=0:o===void 0?l=1:c===void 0?l=-1:typeof o=="number"&&typeof c=="number"?l=o-c:l=String(o).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(o=>this.filterExecutor.evaluateExpression(o,i)===!0)&&(yield i);else for(let i of r)yield i}async*executeExtend(e){let t=e.expression.type!=="aggregate"&&this.filterExecutor.expressionContainsExists(e.expression);for await(let r of this.execute(e.input)){let i=r.clone(),s=t?await this.evaluateExtendExpressionAsync(e.expression,r):this.evaluateExtendExpression(e.expression,r);s!==void 0&&i.set(e.variable,s),yield i}}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 o=r.merge(s);o!==null&&(yield o)}}}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 e.type==="bgp"&&e.triples?(e.triples=e.triples.map(i=>this.substituteInTriple(i,t)),e):(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),e)}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){let i=r;if(r instanceof P7.IRI||i.termType==="NamedNode")return{type:"iri",value:r.value};if(i.termType==="Literal"||typeof i.value=="string")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(()=>HR(bs()));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}}async evaluateExtendExpressionAsync(e,t){if(e.type!=="aggregate")try{return await this.filterExecutor.evaluateExpressionAsync(e,t)}catch{return}}getExpressionValue(e,t){if(e.type==="variable"){let r=t.get(e.name);if(!r)return;if(r instanceof C7.Literal){let i=r.datatype?.value;if(i===`${Vr}dayTimeDuration`)try{return O7.DateTimeFunctions.parseDayTimeDuration(r.value)}catch{return r.value}if(i&&D7.has(i)){let s=parseFloat(r.value);if(!Number.isNaN(s))return s}return r.value}return r.value??r.id??String(r)}if(e.type==="literal")return e.value}collectOperationVariables(e){let t=new Set;return this.collectVarsFromOperation(e,t),t}collectVarsFromOperation(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="bgp"&&r.triples)for(let i of r.triples)this.collectVarsFromElement(i.subject,t),i.predicate?.type!=="path"&&this.collectVarsFromElement(i.predicate,t),this.collectVarsFromElement(i.object,t);if(r.type==="values"&&r.variables)for(let i of r.variables)t.add(i);r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.type==="extend"&&r.variable&&t.add(r.variable),r.input&&this.collectVarsFromOperation(r.input,t),r.left&&this.collectVarsFromOperation(r.left,t),r.right&&this.collectVarsFromOperation(r.right,t),r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.query&&this.collectVarsFromOperation(r.query,t),r.where&&this.collectVarsFromOperation(r.where,t)}collectVarsFromElement(e,t){if(!e||typeof e!="object")return;let r=e;r.type==="variable"&&t.add(r.value),r.type==="quoted"&&(this.collectVarsFromElement(r.subject,t),this.collectVarsFromElement(r.predicate,t),this.collectVarsFromElement(r.object,t))}collectVarsFromExpressionTree(e,t){if(!e||typeof e!="object")return;let r=e;if(r.type==="variable"&&r.name&&t.add(r.name),r.type==="exists"&&r.pattern&&this.collectVarsFromOperation(r.pattern,t),r.left&&this.collectVarsFromExpressionTree(r.left,t),r.right&&this.collectVarsFromExpressionTree(r.right,t),r.operands)for(let i of r.operands)this.collectVarsFromExpressionTree(i,t);if(r.args)for(let i of r.args)this.collectVarsFromExpressionTree(i,t);if(r.expression&&this.collectVarsFromExpressionTree(r.expression,t),r.list)for(let i of r.list)this.collectVarsFromExpressionTree(i,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 kl("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 kl("executeAsk requires an ASK operation");for await(let t of this.execute(e.where))return!0;return!1}};Nn.ExoQLQueryExecutor=xm;Nn.QueryExecutor=xm});var tP=w(oo=>{"use strict";var F7=oo&&oo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},L7=oo&&oo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},xw;Object.defineProperty(oo,"__esModule",{value:!0});oo.CommandResolver=void 0;var N7=je(),k7=rl(),Zt=Oe(),Gt=qe(),V=Jt(),KR=Vo(),QR=pf(),M7=il(),j7=Rp(),jl=Bb(),Rm=Vx(),$7=pl(),U7=gl(),B7=Ml(),Gf=10,Pm="exo__Asset",V7=Gf+1,XR="08cec529-90eb-4d43-88de-ceecccea12b0",G7=V.Namespace.EXOCMD.term("SubstitutionToken").value,YR=new Set(["today","todayStart","targetFolder","target","randomUUIDv4","nowTimestamp","nowDate","nowYear","nowMonth","userInputLabel","userInput","targetProperty","labelAsArray","groundingTargetClass"]);function q7(n,e){return`__SUBSTITUTE__${n}__${e}__`}a(q7,"buildSubstitutionMarker");function W7(n,e,t){let r=(0,M7.utf8ToBase64)(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`__SUBSTITUTE_P__${n}__${e}__${r}__`}a(W7,"buildParameterisedMarker");var JR="3f28af98-c031-4718-8ba2-44ad0b012c52",z7=V.Namespace.EXOCMD.term("TokenInvocation").value,ZR="29e2c8f8-2d27-4e58-b467-2e85d46f8122",eP="universal-default-template",H7=new Set(["today","todayStart","nowTimestamp","nowDate","nowYear","nowMonth"]),Rw=xw=class{static{a(this,"CommandResolver")}clearUniversalCache(){this._universalCacheReady=!1,this._universalCacheValue=null,(0,Rm.clearUniversalDefault)()}constructor(e,t=k7.NullLogger){this.tripleStore=e,this.logger=t,this.cache=new Map,this.multiCache=new Map,this._ancestorDepthCache=new Map,this._legacyPropertyDefaultsWarnedGroundings=new Set,this._universalCacheReady=!1,this._universalCacheValue=null}async resolveForAssetMulti(e,t,r){if(t.length===0)return[];let i=[...t].sort().join(","),s=`${e}::${i}::${r??""}`,o=this.multiCache.get(s);if(o)return o;let c=await this.expandClassHierarchy(t),l=new Map;for(let[h,p]of c){let y=await this.resolveForAsset(e,h,r);for(let g of y){let v=this.getBindingPriority(g.binding)===2?p:0,_=l.get(g.binding.id);(!_||v<_.depth)&&l.set(g.binding.id,{rc:g,depth:v})}}let u=new Set;for(let{rc:h}of l.values())if(h.binding.overrides)for(let p of h.binding.overrides)u.add(p);let f=Array.from(l.entries()).filter(([h])=>!u.has(h)).map(([,h])=>h);f.sort((h,p)=>{let y=this.getBindingPriority(h.rc.binding),g=this.getBindingPriority(p.rc.binding);return y!==g?y-g:h.depth!==p.depth?h.depth-p.depth:(h.rc.binding.order??100)-(p.rc.binding.order??100)});let d=f.map(h=>h.rc);return this.multiCache.set(s,d),d}async expandClassHierarchy(e){let t=new Map;for(let c of e){if(c===Pm){t.set(c,new Set);continue}let l=[];try{l=await this.getClassAncestors(c)}catch{l=[]}t.set(c,new Set(l))}let r=a(c=>{for(let l of e)if(l!==c&&t.get(l)?.has(c)&&!t.get(c)?.has(l))return!0;return!1},"isAncestorOfSibling"),i=e.filter(c=>!r(c)),s=new Map,o=a((c,l)=>{let u=s.get(c);(u===void 0||l<u)&&s.set(c,l)},"setMin");for(let c of i){if(o(c,0),this.looksLikeUUID(c))try{let u=await this.resolveLabelByUID(c);u&&o(u,0)}catch{}if(c===Pm)continue;let l=[];try{l=await this.getClassAncestorsWithDepth(c)}catch{l=[]}for(let{ref:u,depth:f}of l)o(u,f)}return s.has(Pm)||s.set(Pm,V7),s}async resolveForAsset(e,t,r){let i=`${e}:${t}:${r??""}`,s=this.cache.get(i);if(s)return s;let o=await this.findBindings(t,r,e),c=[];for(let l of o){let u=await this.loadCommand(l.commandRef,{targetClass:l.targetClass});if(!u)continue;let f=l.precondition?{...u,precondition:l.precondition}:u;c.push({command:f,binding:l})}return c.sort((l,u)=>{let f=this.getBindingPriority(l.binding),d=this.getBindingPriority(u.binding);return f!==d?f-d:(l.binding.order??100)-(u.binding.order??100)}),this.cache.set(i,c),c}async loadCommand(e,t){let r=await this.findSubjectByUID(e);if(!r||(await this.tripleStore.match(r,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command"))).length===0)return null;let s=await this.getLiteralValue(r,V.Namespace.EXO.term("Asset_label"))??"Unknown Command",o=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_labelTemplate")),c=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_icon")),l=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_confirmMessage")),u=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_successMessage")),f=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_category")),d=await this.getLiteralValue(r,V.Namespace.EXOCMD.term("Command_openInSameTab")),h=d!==null&&String(d).trim().toLowerCase()==="true",p=await this.loadLinkedPrecondition(r),y=await this.loadLinkedGrounding(r,0,t);return y?{id:e,name:s,labelTemplate:o??void 0,icon:c??void 0,precondition:p??void 0,grounding:y,confirmMessage:l??void 0,successMessage:u??void 0,category:f??void 0,openInSameTab:h||void 0}:null}async findBindings(e,t,r){let i=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("CommandBinding")),s=[];for(let o of i){let c=o.subject,l=await this.loadBindingDefinition(c);l&&this.bindingMatches(l,e,t,r)&&s.push(l)}return s}async findPaletteEnabledCommands(){let e=await this.tripleStore.match(void 0,V.Namespace.RDF.term("type"),V.Namespace.EXOCMD.term("Command")),t=[],r=new Set;for(let i of e){let s=i.subject;if((await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteEnabled")))?.toLowerCase()!=="true")continue;let c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid"));if(!c){this.logger.warn(`[CommandResolver] paletteEnabled command at ${s.value} has no exo__Asset_uid \u2014 skipped`);continue}let l=await this.loadCommand(c);if(!l){this.logger.warn(`[CommandResolver] paletteEnabled command ${c} could not be loaded (missing grounding?) \u2014 skipped`);continue}let u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_paletteId")),f=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Command_cliName")),d=u??f??c;if(r.has(d)){this.logger.warn(`[CommandResolver] duplicate paletteId "${d}" \u2014 first registration wins, dropping ${c}`);continue}r.add(d),t.push({command:l,paletteId:d})}return t}invalidateCache(){this.cache.clear(),this.multiCache.clear(),this._ancestorDepthCache.clear()}async resolveLabel(e,t){if(!e.labelTemplate)return e.name;let r=e.labelTemplate,i=this.extractPlaceholders(e.labelTemplate);for(let{full:s,body:o}of i){let c=await this.evaluateSelectSnippet(o,t);r=r.replace(s,c)}return r}extractPlaceholders(e){let t=[],r=0;for(;r<e.length;)if(e[r]==="{"){let i=1,s=r+1;for(;s<e.length&&i>0;)e[s]==="{"?i++:e[s]==="}"&&i--,s++;if(i===0){let o=e.slice(r,s),c=e.slice(r+1,s-1);t.push({full:o,body:c})}r=s}else r++;return t}async evaluateSelectSnippet(e,t){try{let r=e.replace(/\$target/g,`<${t}>`),s=new $7.ExoQLParser().parse(r),c=new U7.ExoQLAlgebraTranslator().translate(s),u=await new B7.ExoQLQueryExecutor(this.tripleStore).executeAll(c);if(u.length===0)return"";let f=u[0],d=f.variables();if(d.length===0)return"";let h=f.get(d[0]);return h?h instanceof Gt.Literal||h instanceof Zt.IRI?h.value:String(h):""}catch{return""}}async loadBindingDefinition(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLinkedUID(e,V.Namespace.EXOCMD.term("CommandBinding_command"));if(!i)return null;let s=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetClass")),o=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetPrototype")),c=await this.getLinkedValue(e,V.Namespace.EXOCMD.term("CommandBinding_targetAsset"));if(!s&&!o&&!c)return null;let l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_position")),u=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_order")),f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant")),d=f!==null?this.coerceVariant(f,t):void 0,h=await this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("CommandBinding_precondition")),p=await this.loadLinkedStyle(e,t),y=await this.getLinkedUIDs(e,V.Namespace.EXOCMD.term("CommandBinding_overrides"));return{id:t,label:r,commandRef:i,targetClass:s??void 0,targetPrototype:o??void 0,targetAsset:c??void 0,position:l??void 0,order:u?parseInt(u,10):void 0,variant:d,precondition:h??void 0,style:p??void 0,overrides:y.length>0?y:void 0}}async loadLinkedStyle(e,t){let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("CommandBinding_style"),void 0);if(r.length>0){let s=r[0].object,o=null;if(s instanceof Zt.IRI)o=s;else if(s instanceof Gt.Literal){let c=this.normalizeWikilink(s.value);o=await this.findSubjectByUID(c)}if(o){let c=await this.loadStyleAsset(o);if(c)return c}this.logger.warn(this.capWarning(`CommandBinding ${t}: style reference unresolved, falling back to inline variant`))}let i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBinding_variant"));if(i!==null){let s=this.coerceVariant(i,t);if(s!==void 0)return{id:`inline:${t}`,label:"",variant:s,inline:!0}}return null}async loadStyleAsset(e){let t=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!t)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",i=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_variant")),s=i!==null?this.coerceVariant(i,t):void 0,o=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_showIcon")),c=this.coerceBoolean(o),l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_labelClass")),u=l!==null?this.coerceLabelClass(l,t):void 0,f=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_ariaLabel")),d=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_tooltip")),h=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_keyboardShortcut")),p=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("CommandBindingStyle_source")),y=p!==null?this.coerceStyleSource(p,t):void 0;return{id:t,label:r,variant:s,showIcon:c,labelClass:u,ariaLabel:f??void 0,tooltip:d??void 0,keyboardShortcut:h??void 0,source:y,inline:!1}}coerceVariant(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(jl.COMMAND_VARIANT_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle variant "${r}" not in whitelist [${jl.COMMAND_VARIANT_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceLabelClass(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(jl.LABEL_CLASS_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle labelClass "${r}" not in whitelist [${jl.LABEL_CLASS_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceStyleSource(e,t){if(e==null)return;let r=String(e).trim().toLowerCase();if(r!==""){if(jl.STYLE_SOURCE_VALUES.includes(r))return r;this.logger.warn(this.capWarning(`CommandBindingStyle source "${r}" not in whitelist [${jl.STYLE_SOURCE_VALUES.join(",")}]; dropped (asset ${t})`))}}coerceBoolean(e){if(e===null)return;let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}capWarning(e){return e.length<=200?e:e.slice(0,197)+"..."}bindingMatches(e,t,r,i){return!!(e.targetAsset&&i&&this.matchesReference(e.targetAsset,i)||e.targetPrototype&&r&&this.matchesReference(e.targetPrototype,r)||e.targetClass&&t&&this.matchesReference(e.targetClass,t))}matchesReference(e,t){let r=this.normalizeWikilink(e),i=this.normalizeWikilink(t);if(r===i)return!0;let s=this.extractPathBasename(i);if(s&&s===r)return!0;let o=this.extractPathBasename(r);if(o&&o===i)return!0;let c=this.extractAlias(t);if(c&&r===c)return!0;let l=this.extractAlias(e);return!!(l&&l===i)}extractPathBasename(e){let t=e.match(/\/([^/]+)\.md$/);return t?t[1]:null}extractAlias(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(r+1).trim():null}getBindingPriority(e){return e.targetAsset?0:e.targetPrototype?1:2}async loadLinkedPrecondition(e){return this.loadLinkedPreconditionFromProperty(e,V.Namespace.EXOCMD.term("Command_precondition"))}async loadLinkedPreconditionFromProperty(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object,s=null;if(i instanceof Zt.IRI)s=i;else if(i instanceof Gt.Literal){let h=this.normalizeWikilink(i.value);s=await this.findSubjectByUID(h)}if(!s)return null;let o=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid")),c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_label"))??"",l=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_sparqlAsk")),u=await this.getLiteralValue(s,V.Namespace.EXOCMD.term("Precondition_hostFunction")),f=await this.tripleStore.match(s,V.Namespace.EXOCMD.term("Precondition_query"),void 0),d;if(f.length>0){let h=f[0].object;if(h instanceof Zt.IRI){let p=await this.getLiteralValue(h,V.Namespace.EXO.term("Asset_uid"));p&&(d=p)}else h instanceof Gt.Literal&&(d=this.normalizeWikilink(h.value))}return!o||!l&&!u&&!d?null:{id:o,label:c,...l&&{sparqlAsk:l},...u&&{hostFunction:u},...d&&{query:d}}}async loadLinkedGrounding(e,t,r){if(t>=Gf)return null;let i=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Command_grounding"),void 0);if(i.length===0)return null;if(i.length===1||!r?.targetClass){let o=await this.resolveGroundingRef(i[0].object);return o?this.loadGroundingDefinition(o,t):null}for(let o of i){let c=await this.resolveGroundingRef(o.object);if(!c)continue;let l=await this.getObsidianName(c,V.Namespace.EXOCMD.term("Grounding_targetPrototype"));if(l&&this.matchesReference(l,r.targetClass))return this.loadGroundingDefinition(c,t)}this.logger.warn(`Command ${e.value}: ${i.length} groundings declared, none matched context.targetClass='${r.targetClass}' via Grounding_targetPrototype \u2014 falling back to first grounding by iteration order (legacy behaviour). Check that one grounding's Grounding_targetPrototype references this targetClass.`);let s=await this.resolveGroundingRef(i[0].object);return s?this.loadGroundingDefinition(s,t):null}async resolveGroundingRef(e){if(e instanceof Zt.IRI)return e;if(e instanceof Gt.Literal){let t=this.normalizeWikilink(e.value);return await this.findSubjectByUID(t)}return null}async loadGroundingByUid(e){let t=await this.findSubjectByUID(e);return t?this.loadGroundingDefinition(t,0):null}async loadGroundingDefinition(e,t){if(t>=Gf)return null;let r=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_uid"));if(!r)return null;let i=await this.getLiteralValue(e,V.Namespace.EXO.term("Asset_label"))??"",s=await this.resolveGroundingTypeReference(e);if(!s)return null;let o=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetProperty"));if(o&&this.looksLikeUUID(o)){let j=await this.resolveLabelByUID(o);if(!j)return this.logger.warn(`Grounding ${r}: targetProperty wikilink UID '${o}' is not resolvable to exo__Asset_label \u2014 grounding skipped (would otherwise write a UUID-named frontmatter key).`),null;o=j}if(s===KR.GroundingType.SERVICE_CALL){let j=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_serviceId"));j&&(o=j)}let c=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueRef")),l=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetValueLiteral")),u=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueSubstitution")),f=null;if(u&&this.looksLikeUUID(u)){let j=await this.resolveLabelByUID(u);if(!j)return this.logger.warn(`Grounding ${r}: targetValueSubstitution UID '${u}' is not resolvable to exo__Asset_label (SubstitutionToken instance missing or unlabelled) \u2014 grounding skipped.`),null;f=j}else u&&(f=u);let d=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetValueQuery")),h=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_serviceCallPayload")),p=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_appendExpression")),y=await this.getObsidianWikilinkValue(e,V.Namespace.EXOCMD.term("Grounding_isDefinedBy")),g=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_sparqlUpdate")),v=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetClass"));if(v&&!this.looksLikeUUID(v)){let j=await this.findUidByLabel(v);j&&(v=j)}let _=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_targetPrototype")),S=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_targetFolder")),T=await this.getObsidianName(e,V.Namespace.EXOCMD.term("Grounding_linkBackProperty")),I=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_inputSchema")),A=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_incrementBy")),R=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_shiftDelta")),q;if(A!=null&&A!==""){let j=Number.parseInt(String(A),10);Number.isFinite(j)&&(q=j)}let Y=await this.resolvePropertyDefaults(e,r),C=await this.resolveInheritanceRules(e,r),O=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_propertyDefaults"));O!==null&&O!==""&&!this._legacyPropertyDefaultsWarnedGroundings.has(r)&&(this.logger.warn(`Grounding ${r}: deprecated exocmd__Grounding_propertyDefaults (plural) JSON predicate detected \u2014 the parser was removed in RFC v2 Phase 5 (#3167); value is ignored. Migrate to ref-form exocmd__Grounding_propertyDefault (singular) pointing to exocmd__PropertyDefault assets. See vault TBox c8f87363-d39c-45cb-9d4d-1be96d70f892 for the canonical replacement.`),this._legacyPropertyDefaultsWarnedGroundings.add(r));let k;s===KR.GroundingType.COMPOSITE&&(k=await this.loadCompositeSteps(e,t+1));let H;if(I)try{let j=JSON.parse(I);j?.properties&&(H=Object.entries(j.properties).map(([se,be])=>{let W=be.type,Ee=W==="string"?"text":W,Ve=be.defaultValue!==void 0?be.defaultValue:be.default,ye={name:se,type:Ee,label:be.title??se,required:Array.isArray(j.required)&&j.required.includes(se)};return Ve!=null&&(ye.defaultValue=String(Ve)),ye}))}catch{}let G=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_prefillLabelWithDate")),B=G!==null&&String(G).trim().toLowerCase()==="true",Z=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_labelTemplate")),_e=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("Grounding_direction")),ie;if(_e!=null){let j=String(_e).trim().toLowerCase();j==="forward"||j==="rollback"?ie=j:j!==""&&this.logger.warn(`Grounding ${r}: exocmd__Grounding_direction value '${_e}' is not 'forward' or 'rollback' \u2014 treating as undefined (will default to 'forward' at dispatch).`)}let N={id:r,label:i,type:s,targetProperty:o??void 0,targetValueRef:c??void 0,targetValueLiteral:l??void 0,targetValueSubstitution:f??void 0,targetValueQuery:d??void 0,serviceCallPayload:h??void 0,appendExpression:p??void 0,sparqlUpdate:g??void 0,steps:k,targetClass:v??void 0,targetPrototype:_??void 0,targetFolder:S??void 0,linkBackProperty:T??void 0,incrementBy:q,shiftDelta:R??void 0,propertyDefault:Y.length>0?Y:void 0,inheritanceRule:C.length>0?C:void 0,isDefinedBy:y??void 0,prefillLabelWithDate:B||void 0,labelTemplate:Z??void 0,direction:ie};return H&&(N.inputSchema=H),N}async loadCompositeSteps(e,t){if(t>=Gf)return[];let r=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_steps"),void 0),i=[];for(let s of r){let o=null;if(s.object instanceof Zt.IRI)o=s.object;else if(s.object instanceof Gt.Literal){let l=this.normalizeWikilink(s.object.value);o=await this.findSubjectByUID(l)}if(!o)continue;let c=await this.loadGroundingDefinition(o,t);c&&i.push(c)}return i}async resolvePropertyDefaults(e,t){let r=await this.resolvePropertyDefaultsForSubject(e,t,V.Namespace.EXOCMD.term("Grounding_propertyDefault")),i=await this.getUniversalCache();return i&&i.propertyDefaults.length>0?(0,Rm.mergePropertyDefaults)(i.propertyDefaults,r):r}async resolvePropertyDefaultsForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[];for(let o of i){let c=await this.resolveRefTripleObject(o.object);if(!c)continue;let l=await this.getObsidianName(c,V.Namespace.EXOCMD.term("PropertyDefault_property"));if(!l){this.logger.warn(`Grounding ${t}: PropertyDefault asset missing exocmd__PropertyDefault_property \u2014 entry skipped.`);continue}let u=this.looksLikeUUID(l)?await this.resolveLabelByUID(l):l;if(!u){this.logger.warn(`Grounding ${t}: PropertyDefault property UID '${l}' is not resolvable to exo__Asset_label \u2014 entry skipped.`);continue}let f=await this.getObsidianName(c,V.Namespace.EXOCMD.term("PropertyDefault_value"));if(!f){this.logger.warn(`Grounding ${t}: PropertyDefault '${u}' missing exocmd__PropertyDefault_value \u2014 entry skipped.`);continue}let d=await this.resolvePropertyDefaultValue(f,t,u);d!==null&&s.push({propertyName:u,value:d})}return s}async getUniversalCache(){if(this._universalCacheReady)return this._universalCacheValue;this._universalCacheReady=!0;let e=await(0,Rm.loadUniversalDefault)();if(e)return this._universalCacheValue=e,e;let t=await this.findUniversalSingleton();if(!t)return this._universalCacheValue=null,null;let r=await this.resolvePropertyDefaultsForSubject(t,eP,V.Namespace.EXOCMD.term("Template_propertyDefault")),i=await this.resolveInheritanceRulesForSubject(t,eP,V.Namespace.EXOCMD.term("Template_inheritanceRule"));return this._universalCacheValue={propertyDefaults:r,inheritanceRules:i},this._universalCacheValue}async findUniversalSingleton(){let e=V.Namespace.EXOCMD.term("UniversalDefaultTemplate").value,t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Instance_class"),void 0),r=[];for(let i of t){let s=!1;if(i.object instanceof Zt.IRI)s=i.object.value===e||i.object.value.includes(ZR);else if(i.object instanceof Gt.Literal){let o=this.unwrapWikilink(i.object.value);s=o==="exocmd__UniversalDefaultTemplate"||o===ZR}s&&i.subject instanceof Zt.IRI&&r.push(i.subject)}return r.length===0?null:(r.length===1||(r.sort((i,s)=>i.value.localeCompare(s.value)),this.logger.warn(`Multiple UniversalDefaultTemplate singletons found (${r.length}); selecting deterministically by lexicographic UID order: ${r[0].value}`)),r[0])}async resolveInheritanceRules(e,t){let r=await this.resolveInheritanceRulesForSubject(e,t,V.Namespace.EXOCMD.term("Grounding_inheritanceRule")),i=await this.getUniversalCache();return i&&i.inheritanceRules.length>0?(0,Rm.mergeInheritanceRules)(i.inheritanceRules,r):r}async resolveInheritanceRulesForSubject(e,t,r){let i=await this.tripleStore.match(e,r,void 0),s=[],o=t;for(let c of i){let l=await this.resolveRefTripleObject(c.object);if(!l)continue;let u=await this.resolveLabelRef(l,V.Namespace.EXOCMD.term("InheritanceRule_sourceProperty"));if(!u){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_sourceProperty \u2014 entry skipped.`);continue}let f=await this.resolveLabelRef(l,V.Namespace.EXOCMD.term("InheritanceRule_targetProperty"));if(!f){this.logger.warn(`Grounding ${o}: InheritanceRule missing/unresolvable exocmd__InheritanceRule_targetProperty \u2014 entry skipped.`);continue}let d=await this.tripleStore.match(l,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"),void 0),h,p;if(d.length>0){let I=await this.getObsidianName(l,V.Namespace.EXOCMD.term("InheritanceRule_targetClassCondition"));if(!I||!I.trim()){this.logger.warn(`Grounding ${o}: InheritanceRule has exocmd__InheritanceRule_targetClassCondition triple but ref is unresolvable \u2014 entire rule skipped (would otherwise apply unconditionally, broadening scope).`);continue}this.looksLikeUUID(I)?(p=I,h=await this.resolveLabelByUID(I)??void 0):h=I}let y=await this.tripleStore.match(l,V.Namespace.EXOCMD.term("InheritanceRule_targetClassExclusion"),void 0),g=[],v=[],_=!1;for(let I of y){let A=null;if(I.object instanceof Zt.IRI?A=this.iriToObsidianName(I.object.value)??I.object.value:I.object instanceof Gt.Literal&&(A=this.unwrapWikilink(I.object.value)),!A){_=!0;continue}if(this.looksLikeUUID(A)){v.push(A);let R=await this.resolveLabelByUID(A);R&&g.push(R)}else g.push(A)}if(_){this.logger.warn(`Grounding ${o}: InheritanceRule has unresolvable exocmd__InheritanceRule_targetClassExclusion entry \u2014 entire rule skipped (would otherwise expand scope by silently dropping the excluded class).`);continue}let S=await this.getLiteralValue(l,V.Namespace.EXOCMD.term("InheritanceRule_priority")),T=50;if(S!==null&&S!==""){let I=Number.parseInt(String(S),10);Number.isFinite(I)&&(T=I)}s.push({sourcePropertyName:u,targetPropertyName:f,targetClassCondition:h,targetClassConditionUid:p,targetClassExclusion:g,targetClassExclusionUids:v,priority:T})}return s}async resolveRefTripleObject(e){if(e instanceof Zt.IRI)return e;if(e instanceof Gt.Literal){let t=this.normalizeWikilink(e.value);return t?this.findSubjectByUID(t):null}return null}async resolveLabelRef(e,t){let r=await this.getObsidianName(e,t);return r?this.looksLikeUUID(r)?this.resolveLabelByUID(r):r:null}async resolvePropertyDefaultValue(e,t,r){if(!this.looksLikeUUID(e))return`"[[${e}]]"`;let i=await this.findSubjectByUID(e);return i?await this.assetIsTokenInvocation(i)?this.resolveTokenInvocation(i,e,t,r):await this.assetIsSubstitutionToken(i)?this.dispatchSubstitutionToken(i,e,t,r,void 0):`"[[${e}]]"`:`"[[${e}]]"`}async dispatchSubstitutionToken(e,t,r,i,s){let o=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("SubstitutionToken_resolver"));if(!o||!o.trim())return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' references SubstitutionToken '${t}' with no exocmd__SubstitutionToken_resolver \u2014 falling back to wikilink form.`),`"[[${t}]]"`;let c=o.trim();return YR.has(c)?s!==void 0?W7(c,t,s):H7.has(c)?xw.parseTimeResolve(c):q7(c,t):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' SubstitutionToken '${t}' declares unknown resolver-id '${c}' \u2014 falling back to wikilink form. Known ids: ${Array.from(YR).join(", ")}.`),`"[[${t}]]"`)}static parseTimeResolve(e){let t=new Date,r=a(i=>i<10?`0${i}`:String(i),"pad");switch(e){case"today":return t.toISOString().slice(0,10);case"todayStart":return new Date(new Date().setHours(0,0,0,0)).toISOString();case"nowTimestamp":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}:${r(t.getSeconds())}`;case"nowDate":return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`;case"nowYear":return String(t.getFullYear());case"nowMonth":return r(t.getMonth()+1);default:return""}}async resolveTokenInvocation(e,t,r,i){let s=await this.getObsidianName(e,V.Namespace.EXOCMD.term("TokenInvocation_token"));if(!s)return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' missing exocmd__TokenInvocation_token \u2014 entry skipped.`),null;let o=await this.getLiteralValue(e,V.Namespace.EXOCMD.term("TokenInvocation_parameter"))??"";if(!this.looksLikeUUID(s))return this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' references non-UUID token '${s}' \u2014 entry skipped.`),null;let c=await this.findSubjectByUID(s);return c?this.dispatchSubstitutionToken(c,s,r,i,o):(this.logger.warn(`Grounding ${r}: PropertyDefault '${i}' TokenInvocation '${t}' token ref '${s}' not found in store \u2014 entry skipped.`),null)}async assetIsTokenInvocation(e){let t=await this.tripleStore.match(e,V.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===z7||r.object.value.includes(JR))return!0}else if(r.object instanceof Gt.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__TokenInvocation"||i===JR)return!0}return!1}async assetIsSubstitutionToken(e){let t=await this.tripleStore.match(e,V.Namespace.EXO.term("Instance_class"),void 0);for(let r of t)if(r.object instanceof Zt.IRI){if(r.object.value===G7||r.object.value.includes(XR))return!0}else if(r.object instanceof Gt.Literal){let i=this.unwrapWikilink(r.object.value);if(i==="exocmd__SubstitutionToken"||i===XR)return!0}return!1}async resolveGroundingTypeReference(e){let t=await this.tripleStore.match(e,V.Namespace.EXOCMD.term("Grounding_type"),void 0);if(t.length===0)return null;let r=t[0].object;if(r instanceof Zt.IRI)return(0,QR.resolveGroundingTypeFromIRI)(r.value);if(r instanceof Gt.Literal){let i=r.value,s=i.match(/^\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]$/i);return s?(0,QR.resolveGroundingTypeFromIRI)(`obsidian://vault/${s[1].toLowerCase()}.md`):(this.logger.warn(`[exocmd-grounding-type-literal-form] legacy literal-string form '${i}' for exocmd__Grounding_type on <${e.value}>. Migrate to wikilink form per RFC 9d20c91f Phase 3.`),null)}return null}async findSubjectByUID(e){if(this.tripleStore.findSubjectsByUUID){let r=await this.tripleStore.findSubjectsByUUID(e);if(r.length>0)return r[0]}let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_uid"),void 0);for(let r of t)if(r.object instanceof Gt.Literal&&r.object.value===e)return r.subject;return null}async getLiteralValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Gt.Literal||i instanceof Zt.IRI?i.value:null}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)}async resolveLabelByUID(e){let t=await this.findSubjectByUID(e);return t?this.getLiteralValue(t,V.Namespace.EXO.term("Asset_label")):null}async getClassAncestors(e){return(await this.getClassAncestorsWithDepth(e)).map(r=>r.ref)}async getClassAncestorsWithDepth(e){let t=this._ancestorDepthCache.get(e);if(t)return t;let r=new Map,i=new Set,s=await this.resolveClassFileIRI(e);if(!s)return[];let o=new Set([e]),c=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_uid"));c&&o.add(c);let l=await this.getLiteralValue(s,V.Namespace.EXO.term("Asset_label"));l&&o.add(l);let u=a((h,p)=>{if(o.has(h))return;let y=r.get(h);(y===void 0||p<y)&&r.set(h,p)},"setMin"),f=[{fileIRI:s,depth:0}];for(;f.length>0;){let h=f.shift();if(!h)break;let{fileIRI:p,depth:y}=h;if(y>=Gf||i.has(p.value))continue;i.add(p.value);let g=await this.tripleStore.match(p,V.Namespace.EXO.term("Class_superClass"),void 0);for(let v of g){let _=v.object;if(!(_ instanceof Zt.IRI))continue;let S=y+1,T=_.value.startsWith("obsidian://vault/"),I=this.iriToObsidianName(_.value);I&&u(I,S);let A=null;if(T?A=_:I&&(A=await this.resolveClassFileIRI(I)),!A)continue;let R=await this.getLiteralValue(A,V.Namespace.EXO.term("Asset_uid"));R&&u(R,S),i.has(A.value)||f.push({fileIRI:A,depth:S})}}let d=Array.from(r.entries()).map(([h,p])=>({ref:h,depth:p}));return this._ancestorDepthCache.set(e,d),d}async resolveClassFileIRI(e){if(this.looksLikeUUID(e))return this.findSubjectByUID(e);let t=await this.findUidByLabel(e);return t?this.findSubjectByUID(t):null}async findUidByLabel(e){let t=await this.tripleStore.match(void 0,V.Namespace.EXO.term("Asset_label"),void 0);for(let r of t)if(r.object instanceof Gt.Literal&&r.object.value===e&&r.subject instanceof Zt.IRI){let i=await this.tripleStore.match(r.subject,V.Namespace.EXO.term("Asset_uid"),void 0);if(i.length>0&&i[0].object instanceof Gt.Literal)return i[0].object.value}return null}async getLinkedUID(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Zt.IRI){let s=await this.tripleStore.match(i,V.Namespace.EXO.term("Asset_uid"),void 0);return s.length>0&&s[0].object instanceof Gt.Literal?s[0].object.value:i.value.split("/").pop()?.replace(".md","")??null}return i instanceof Gt.Literal?this.normalizeWikilink(i.value):null}async getLinkedUIDs(e,t){let r=await this.tripleStore.match(e,t,void 0),i=[];for(let s of r){let o=s.object;if(o instanceof Zt.IRI){let c=await this.tripleStore.match(o,V.Namespace.EXO.term("Asset_uid"),void 0);if(c.length>0&&c[0].object instanceof Gt.Literal)i.push(c[0].object.value);else{let l=o.value.split("/").pop()?.replace(".md","");l&&i.push(l)}}else if(o instanceof Gt.Literal){let c=this.normalizeWikilink(o.value);c&&i.push(c)}}return i}async getLinkedValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Gt.Literal?this.normalizeWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}async getObsidianName(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;return i instanceof Gt.Literal?this.unwrapWikilink(i.value):i instanceof Zt.IRI?this.iriToObsidianName(i.value)??i.value:null}unwrapWikilink(e){if(!e)return e;let t=e.trim().replace(/^"|"$/g,"");if(t.startsWith("http://")||t.startsWith("https://"))return this.iriToObsidianName(t)??t;let r=t.match(/^\[\[([^\]|]+)\|([^\]]+)\]\]$/);if(r)return r[2].trim();let i=t.match(/^\[\[([^\]|]+)\]\]$/);if(i){let s=i[1].trim();return s.startsWith("http://")||s.startsWith("https://")?this.iriToObsidianName(s)??s:s}return t}async getObsidianWikilinkValue(e,t){let r=await this.tripleStore.match(e,t,void 0);if(r.length===0)return null;let i=r[0].object;if(i instanceof Gt.Literal)return this.resolveWikilinkAlias(i.value);if(i instanceof Zt.IRI){let s=this.iriToObsidianName(i.value);return s?`"[[${s}]]"`:i.value}return null}async resolveWikilinkAlias(e){let t=e.match(/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\]\]/);if(!t)return e;let r=t[1],i=await this.findSubjectByUID(r);if(!i)return e;let s=await this.getLiteralValue(i,V.Namespace.EXO.term("Asset_label"));return s?e.replace(`[[${r}]]`,`[[${r}|${s}]]`):e}iriToObsidianName(e){return(0,j7.iriToObsidianName)(e)}normalizeWikilink(e){let t=e.replace(/["'[\]]/g,"").trim(),r=t.indexOf("|");return r>=0?t.substring(0,r):t}};oo.CommandResolver=Rw;oo.CommandResolver=Rw=xw=F7([(0,N7.injectable)(),L7("design:paramtypes",[Object,Object])],Rw)});var Cw=w(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});Pw.validateExoQLAllowlist=K7;var Cm=Bf();function K7(n){if(!n||typeof n!="object")return;let e=n;if(e.type==="update"){let t=n.updates??[];for(let r of t)if(r?.type==="load")throw new Cm.ExoQLForbiddenKeywordError("LOAD");throw new Cm.ExoQLForbiddenKeywordError("UPDATE")}if(e.type==="query"){if(e.from){let t=Array.isArray(e.from.default)&&e.from.default.length>0,r=Array.isArray(e.from.named)&&e.from.named.length>0;if(t||r)throw new Cm.ExoQLForbiddenKeywordError("FROM")}if(Array.isArray(e.where))for(let t of e.where)Om(t);if(Array.isArray(e.template))for(let t of e.template)Om(t)}}a(K7,"validateExoQLAllowlist");function Om(n){if(!n||typeof n!="object")return;if(n.type==="service")throw new Cm.ExoQLForbiddenKeywordError("SERVICE");if(Array.isArray(n.patterns))for(let t of n.patterns)Om(t);let e=n.where;if(Array.isArray(e))for(let t of e)Om(t)}a(Om,"walkPatternForBannedKeywords")});var Ow=w(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.DEFAULT_EVAL_CONFIG=void 0;Dm.DEFAULT_EVAL_CONFIG=Object.freeze({enabled:!0,maxNestedEvalCount:100,maxAggregateEvalMillis:1e4})});var Fm=w(Dw=>{"use strict";Object.defineProperty(Dw,"__esModule",{value:!0});Dw.evaluateWithExoEval=t8;var Q7=pl(),X7=gl(),Y7=Ml(),J7=Cw(),Z7=Ow(),e8=Bf();async function t8(n,e={}){if(typeof n!="string")throw new TypeError("evaluateWithExoEval: sparql must be a string");let r=new Q7.ExoQLParser().parse(n);if((0,J7.validateExoQLAllowlist)(r),!{...Z7.DEFAULT_EVAL_CONFIG,...e.config??{}}.enabled)throw new e8.ExoQLEvalDisabledError;let s="queryType"in r&&typeof r.queryType=="string"?r.queryType:"SELECT";if(!e.store)return s==="ASK"?{kind:"ask",result:!1}:s==="CONSTRUCT"?{kind:"construct",triples:[]}:{kind:"select",rows:[]};let c=new X7.ExoQLAlgebraTranslator().translate(r),l=new Y7.ExoQLQueryExecutor(e.store);return l.isAskQuery(c)?{kind:"ask",result:await l.executeAsk(c)}:l.isConstructQuery(c)?{kind:"construct",triples:await l.executeConstruct(c)}:{kind:"select",rows:await l.executeAll(c)}}a(t8,"evaluateWithExoEval")});var qf=w(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});Lm.liveClock=r8;Lm.frozenClock=n8;function r8(){return{now:a(()=>new Date,"now")}}a(r8,"liveClock");function n8(n){let e=new Date(n);return{now:a(()=>new Date(e.getTime()),"now")}}a(n8,"frozenClock")});var nP=w(ao=>{"use strict";var i8=ao&&ao.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},s8=ao&&ao.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Wf;Object.defineProperty(ao,"__esModule",{value:!0});ao.PreconditionEvaluator=void 0;var o8=je(),a8=pl(),c8=gl(),rP=Ml(),l8=Fm(),u8=qf(),zf=Wf=class{static{a(this,"PreconditionEvaluator")}constructor(e,t,r){this.hostFunctions=new Map,this.askCache=new Map,this.tripleStore=e,this.queryBodyResolver=t,this.clock=r?.clock??(0,u8.liveClock)()}async evaluate(e,t,r){return e?e.sparqlAsk?this.evaluateSparqlAsk(e.sparqlAsk,t):e.query?this.evaluateQueryRef(e.query,t):e.hostFunction?this.evaluateHostFunction(e.hostFunction,t,r):!0:!0}async evaluateQueryRef(e,t){if(!this.queryBodyResolver)return!1;try{let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return!1;let i=this.substituteVariables(r,t),s=await(0,l8.evaluateWithExoEval)(i,{store:this.tripleStore});return s.kind!=="ask"?!1:s.result}catch{return!1}}registerHostFunction(e,t){this.hostFunctions.set(e,t)}hasHostFunction(e){return this.hostFunctions.has(e)}evaluateHostFunctionSync(e,t,r){return this.hostFunctions.has(e)?this.evaluateHostFunction(e,t,r):null}invalidateCache(){this.askCache.clear()}compileAsk(e){let t=this.substituteVariables(e,Wf.SENTINEL_IRI),i=new a8.ExoQLParser().parse(t),o=new c8.ExoQLAlgebraTranslator().translate(i);return new rP.ExoQLQueryExecutor(this.tripleStore).isAskQuery(o)?o:null}evaluateHostFunction(e,t,r){let i=this.hostFunctions.get(e);if(!i)return!0;let s=r?{...r,targetIRI:t}:{targetIRI:t};return i(s)}async evaluateSparqlAsk(e,t){try{let r=this.askCache.get(e);if(r===void 0){let o=this.compileAsk(e);if(!o)return!1;r=o,this.askCache.set(e,r)}let i=JSON.parse(JSON.stringify(r).replaceAll(Wf.SENTINEL_IRI,t));return await new rP.ExoQLQueryExecutor(this.tripleStore).executeAsk(i)}catch{return!1}}substituteVariables(e,t){let r=this.clock.now(),i=r.toISOString(),s=i.slice(0,10),o=new Date(r.getTime()+Wf.ALMATY_OFFSET_MS),c=o.getUTCFullYear(),l=o.getUTCMonth(),u=o.getUTCDate(),f=o.getUTCDay(),h=new Date(Date.UTC(c,l,u-1)).toISOString().slice(0,10),p=(f+6)%7,y=new Date(Date.UTC(c,l,u-p)),g=y.toISOString().slice(0,10),_=new Date(y.getTime()-10080*60*1e3).toISOString().slice(0,10),S=`${c}-${String(l+1).padStart(2,"0")}-01`,T=l===0?11:l-1,A=`${l===0?c-1:c}-${String(T+1).padStart(2,"0")}-01`,R=`${c}-01-01`;return e.replace(/\$target/g,`<${t}>`).replace(/\$now/g,`"${i}"^^xsd:dateTime`).replace(/\$yesterday/g,`"${h}"^^xsd:date`).replace(/\$thisWeekStart/g,`"${g}"^^xsd:date`).replace(/\$lastWeekStart/g,`"${_}"^^xsd:date`).replace(/\$thisMonthStart/g,`"${S}"^^xsd:date`).replace(/\$lastMonthStart/g,`"${A}"^^xsd:date`).replace(/\$thisYearStart/g,`"${R}"^^xsd:date`).replace(/\$today/g,`"${s}"^^xsd:date`)}};ao.PreconditionEvaluator=zf;zf.SENTINEL_IRI="urn:exocortex:cache-sentinel:target";zf.ALMATY_OFFSET_MS=300*60*1e3;ao.PreconditionEvaluator=zf=Wf=i8([(0,o8.injectable)(),s8("design:paramtypes",[Object,Object,Object])],zf)});var iP=w(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.hasUidFilename=co.hasNonUidFilename=void 0;co.registerDefaultHostFunctions=h8;var f8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t!==e},"hasNonUidFilename");co.hasNonUidFilename=f8;var d8=a(n=>{let e=n.assetUid;if(typeof e!="string"||e.trim()==="")return!1;let t=n.fileBasename;return typeof t!="string"?!1:t===e},"hasUidFilename");co.hasUidFilename=d8;function h8(n){n.registerHostFunction("hasNonUidFilename",co.hasNonUidFilename),n.registerHostFunction("hasUidFilename",co.hasUidFilename)}a(h8,"registerDefaultHostFunctions")});var km=w(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});Nm.liveUidGenerator=p8;Nm.seededUidGenerator=g8;var Fw=Ai();function p8(){return{next:a(()=>(0,Fw.v4)(),"next")}}a(p8,"liveUidGenerator");var m8="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function g8(n){let e=0,t=(0,Fw.v5)(n,m8);return{next:a(()=>{let r=`${n}#${e}`;return e+=1,(0,Fw.v5)(r,t)},"next")}}a(g8,"seededUidGenerator")});var Hf=w($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.registerOrderSpecLoader=y8;$l.clearOrderSpecLoader=b8;$l.loadDefaultSpec=_8;$l.orderProperties=S8;var Mm=null,ta,jm=!1;function y8(n){Mm=n,ta=void 0,jm=!1}a(y8,"registerOrderSpecLoader");function b8(){Mm=null,ta=void 0,jm=!1}a(b8,"clearOrderSpecLoader");function _8(){if(ta!==void 0)return ta;if(!Mm)return ta=null,null;try{ta=Mm()}catch(n){jm||(console.warn("[OrderSpecResolver] loader threw, falling back to insertion order:",n),jm=!0),ta=null}return ta}a(_8,"loadDefaultSpec");function S8(n,e){if(!e||e.head.length===0&&e.tail.length===0)return n;let t=Object.keys(n),r=new Set(e.head),i=new Set(e.tail),s=e.head.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),o=e.tail.filter(u=>Object.prototype.hasOwnProperty.call(n,u)),c=t.filter(u=>!r.has(u)&&!i.has(u));e.middleStrategy==="alphabetical"&&c.sort((u,f)=>u.localeCompare(f));let l={};for(let u of s)l[u]=n[u];for(let u of c)l[u]=n[u];for(let u of o)l[u]=n[u];return l}a(S8,"orderProperties")});var vs=w($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.FrontmatterService=void 0;var sP=Hf(),Kf=class n{static{a(this,"FrontmatterService")}parse(e){let t=e.match(n.FRONTMATTER_REGEX);return t?{exists:!0,content:t[1],originalContent:e}:{exists:!1,content:"",originalContent:e}}parseObject(e){let t=this.parse(e);if(!t.exists)return null;let r={},i=t.content.split(/\r?\n/),s=null,o=null,c=a(()=>{s!==null&&o!==null&&(r[s]=o),s=null,o=null},"flushArray");for(let l of i){let u=/^ {2}- (.*)$/.exec(l);if(u){s!==null&&o!==null&&o.push(u[1].trim());continue}c();let f=/^([^:\s][^:]*):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(s=d,o=[]):r[d]=h}return c(),r}updateProperty(e,t,r){t=n.normalizeIRI(t),typeof r=="string"&&(r=n.normalizeIRIValue(r));let i=this.parse(e),s=this.serializeValue(t,r);if(!i.exists)return`---
71
71
  ${s}
72
72
  ---
73
73
  ${e}`;let o=i.content;if(this.hasProperty(o,t)){let c=new RegExp(`${this.escapeRegex(t)}:.*(?:
@@ -88,8 +88,8 @@ ${Object.entries(r).map(([c,l])=>this.serializeValue(c,l)).join(`
88
88
  ${r}`}return`${e}: ${String(t)}`}escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};$m.FrontmatterService=Kf;Kf.FRONTMATTER_REGEX=/^---\n([\s\S]*?)\n---/;Kf.IRI_PREFIX_MAP={"https://exocortex.my/ontology/ems#":"ems__","https://exocortex.my/ontology/exo#":"exo__","https://exocortex.my/ontology/exocmd#":"exocmd__","https://exocortex.my/ontology/ims#":"ims__","https://exocortex.my/ontology/ztlk#":"ztlk__","https://exocortex.my/ontology/ptms#":"ptms__","https://exocortex.my/ontology/lit#":"lit__","https://exocortex.my/ontology/inbox#":"inbox__","https://exocortex.my/ontology/pmbok#":"pmbok__"}});var kn=w(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.DateFormatter=void 0;var Lw=class n{static{a(this,"DateFormatter")}static toISOTimestamp(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}static toLocalTimestamp(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),c=String(e.getSeconds()).padStart(2,"0");return`${t}-${r}-${i}T${s}:${o}:${c}`}static toDateWikilink(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`"[[${t}-${r}-${i}]]"`}static getTodayWikilink(){return n.toDateWikilink(new Date)}static toDateString(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${i}`}static parseWikilink(e){let r=e.replace(/^["']|["']$/g,"").match(/\[\[(\d{4}-\d{2}-\d{2})\]\]/);return r?r[1]:null}static addDays(e,t){let r=new Date(e);return r.setDate(r.getDate()+t),r}static isSameDay(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}static getTodayStartTimestamp(){let e=new Date;return e.setHours(0,0,0,0),n.toLocalTimestamp(e)}static toTimestampAtStartOfDay(e){let t=e.split("-").map(Number);if(t.length!==3||t.some(isNaN))throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD`);let[r,i,s]=t,o=new Date(r,i-1,s,0,0,0,0);if(isNaN(o.getTime()))throw new Error(`Invalid date values: ${e}`);return n.toLocalTimestamp(o)}static normalizeTimestamp(e){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e;let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid timestamp format: ${e}`);return n.toISOTimestamp(t)}static isISOTimestamp(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e)}};Um.DateFormatter=Lw});var ra=w(Bm=>{"use strict";Object.defineProperty(Bm,"__esModule",{value:!0});Bm.LoggingService=void 0;var Qf=class{static{a(this,"LoggingService")}static setVerbose(e){this.isVerbose=e}static setDevelopmentMode(e){this.isDevelopment=e}static checkIsDevelopment(){return this.isDevelopment!==void 0?this.isDevelopment:typeof process<"u"?(this.isDevelopment=!1,this.isDevelopment):(this.isDevelopment=!1,this.isDevelopment)}static debug(e,t){this.isVerbose&&console.debug(`[Exocortex] ${e}`,t??"")}static info(e,t){console.log(`[Exocortex] ${e}`,t??"")}static warn(e,t){console.warn(`[Exocortex] ${e}`,t??"")}static error(e,t,r){let i=this.checkIsDevelopment(),s=r?` [${r}]`:"";if(i){let o=t?.stack?`
89
89
  Stack trace:
90
90
  ${t.stack}`:"";console.error(`[Exocortex ERROR]${s} ${e}${o}`,t??"")}else{let o=t?.message?`
91
- Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${o}`)}}};Bm.LoggingService=Qf;Qf.isVerbose=!1;Qf.isDevelopment=void 0});var oP=w(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.registerResolver=mn;lc.getResolver=w8;lc.getRegisteredResolverIds=v8;lc.clearResolvers=E8;lc.installDefaultResolvers=T8;var Vm=new Map;function mn(n,e){Vm.set(n,e)}a(mn,"registerResolver");function w8(n){return Vm.get(n)}a(w8,"getResolver");function v8(){return Array.from(Vm.keys())}a(v8,"getRegisteredResolverIds");function E8(){Vm.clear()}a(E8,"clearResolvers");function na(n){return n<10?`0${n}`:String(n)}a(na,"pad2");function T8(){mn("today",()=>new Date().toISOString().slice(0,10)),mn("todayStart",()=>new Date(new Date().setHours(0,0,0,0)).toISOString()),mn("target",n=>n.targetIRI?`"[[${n.targetIRI}]]"`:""),mn("targetFolder",n=>{if(!n.targetFilePath)return"";let e=n.targetFilePath.replace(/^\/+/,""),t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}),mn("randomUUIDv4",()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();throw new Error("randomUUIDv4 resolver requires crypto.randomUUID() \u2014 runtime is missing Node crypto / Web Crypto API.")}),mn("nowTimestamp",()=>{let n=new Date;return`${n.getFullYear()}-${na(n.getMonth()+1)}-${na(n.getDate())}T${na(n.getHours())}:${na(n.getMinutes())}:${na(n.getSeconds())}`}),mn("nowDate",()=>{let n=new Date;return`${n.getFullYear()}-${na(n.getMonth()+1)}-${na(n.getDate())}`}),mn("nowYear",()=>String(new Date().getFullYear())),mn("nowMonth",()=>na(new Date().getMonth()+1)),mn("userInputLabel",n=>{let e=n.userInput?.label;return typeof e=="string"?e:""}),mn("userInput",(n,e)=>{if(!e)return null;let t=n.userInput?.[e];return typeof t=="string"?t:t==null?null:String(t)}),mn("targetProperty",(n,e)=>{if(!e||!n.targetFm)return null;let t=n.targetFm[e];return t==null?null:Array.isArray(t)?t.map(String):String(t)}),mn("labelAsArray",n=>{let e=n.userInput?.label;return typeof e=="string"&&e.length>0?[e]:[]}),mn("groundingTargetClass",n=>n.groundingTargetClassUid?`"[[${n.groundingTargetClassUid}]]"`:null)}a(T8,"installDefaultResolvers")});var uP=w(vr=>{"use strict";var A8=vr&&vr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},I8=vr&&vr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},co;Object.defineProperty(vr,"__esModule",{value:!0});vr.GroundingExecutor=vr.ServiceRegistry=vr.CLASS_UID_TO_LABEL=vr.STATUS_UID_BY_ENUM=void 0;var x8=je(),R8=qf(),P8=km(),ci=Vo(),Gm=Jc(),C8=il(),uc=Zc(),O8=Oe(),D8=vs(),Nw=kn(),aP=jf(),Ul=ra();vr.STATUS_UID_BY_ENUM={[uc.EffortStatus.DRAFT]:"c42245d0-01de-4c35-bfcf-d910445ea28e",[uc.EffortStatus.BACKLOG]:"753a44d5-846c-4b82-9196-4fd9a4d48777",[uc.EffortStatus.ANALYSIS]:"cde3525c-57ea-4efc-b477-2e7e7ccd3a1e",[uc.EffortStatus.TODO]:"6a0e933a-6653-46f4-95ae-ed7508177c73",[uc.EffortStatus.DOING]:"027e78f4-6e16-4b36-b8fb-5510507d5745",[uc.EffortStatus.DONE]:"7b9b3116-7c3c-438c-9618-94fe301320a6",[uc.EffortStatus.TRASHED]:"5d14f18d-db2b-4847-9ac1-144cb93b2541"};var F8=Object.freeze(Object.fromEntries(Object.entries(vr.STATUS_UID_BY_ENUM).map(([n,e])=>[e,n])));vr.CLASS_UID_TO_LABEL=Object.freeze({"1b20a8f0-d745-4e93-91db-4531b3df120e":Gm.AssetClass.TASK,"7db5eeff-718a-49b0-8d2b-39b084a356e3":Gm.AssetClass.PROJECT,"1b0a5e34-dd7f-4ead-b43a-6c7c5a5ecaca":Gm.AssetClass.MEETING});var kw=oP();(0,kw.installDefaultResolvers)();function L8(n){if(n){if(n==="1b20a8f0-d745-4e93-91db-4531b3df120e")return"ems__Task";if(n==="7db5eeff-718a-49b0-8d2b-39b084a356e3")return"ems__Project";if(n==="ems__Task"||n==="ems__Project")return n}}a(L8,"resolveClassFlipTarget");var cP=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,N8=/^__SUBSTITUTE__([a-zA-Z][a-zA-Z0-9_]*)__[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}__$/,k8=/^__SUBSTITUTE_P__([a-zA-Z][a-zA-Z0-9_]*)__[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}__([A-Za-z0-9_-]*)__$/,qm=class{static{a(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};vr.ServiceRegistry=qm;var lP=20,Wm=co=class{static{a(this,"GroundingExecutor")}constructor(e,t,r,i,s){this.frontmatterService=new D8.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r,this.classLabelToUid=i,this.workflowResolver=s?.workflowResolver,this.groundingLoader=s?.groundingLoader,this.namedQueryRunner=s?.namedQueryRunner,this.clock=s?.clock??(0,R8.liveClock)(),this.uidGen=s?.uidGenerator??(0,P8.liveUidGenerator)()}async execute(e,t,r,i){try{switch(e.type){case ci.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case ci.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case ci.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case ci.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case ci.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,r,i);case ci.GroundingType.PROPERTY_APPEND:return await this.executePropertyAppend(e,t,r,i);case ci.GroundingType.PROPERTY_INCREMENT:return await this.executePropertyIncrement(e,r);case ci.GroundingType.PROPERTY_SHIFT:return await this.executePropertyShift(e,r);case ci.GroundingType.SPARQL_UPDATE:return{success:!1,error:"sparql_update grounding not yet implemented. Use property_set/property_delete instead."};case ci.GroundingType.WORKFLOW_TRANSITION:return await this.executeWorkflowTransition(e,t,r,i);default:return{success:!1,error:`Unknown grounding type: ${e.type}`}}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}async executePropertySet(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_set requires targetProperty"};let s;if([e.targetValueRef!==void 0,e.targetValueLiteral!==void 0,e.targetValueSubstitution!==void 0,e.targetValueQuery!==void 0].filter(Boolean).length>1)return{success:!1,error:"property_set: more than one of targetValueRef/targetValueLiteral/targetValueSubstitution/targetValueQuery set (cardinality 0..1 each, mutually exclusive)"};if(e.targetValueRef!==void 0)s=`"[[${e.targetValueRef}]]"`;else if(e.targetValueLiteral!==void 0)s=e.targetValueLiteral;else if(e.targetValueSubstitution!==void 0)s=e.targetValueSubstitution;else if(e.targetValueQuery!==void 0){let d=await this.resolveTargetValueQuery(e.targetValueQuery,t);if(!d.success)return d;s=d.value}else return{success:!1,error:"property_set requires one of targetValueRef/targetValueLiteral/targetValueSubstitution/targetValueQuery"};if(/\$(input|value)\b/.test(s)&&(i===void 0||i.value===void 0||i.value===null))return{success:!1,error:"property_set: substituted value contains $input/$value placeholder but no userInput.value provided"};let l=this.substituteVariables(s,t,i),u=await this.fileReader.readFile(r),f=this.frontmatterService.updateProperty(u,e.targetProperty,l);return await this.fileWriter.updateFile(r,f),{success:!0}}async resolveTargetValueQuery(e,t){if(!this.namedQueryRunner)return{success:!1,error:"property_set targetValueQuery requires NamedQueryRunner injection (options.namedQueryRunner). Wire the plugin/CLI before using this value-source."};let r;try{r=await this.namedQueryRunner.runScalar(e,{currentAsset:t})}catch(s){return{success:!1,error:`property_set targetValueQuery: NamedQuery '${e}' failed \u2014 ${s instanceof Error?s.message:String(s)}`}}return r===null?{success:!1,error:`property_set targetValueQuery: NamedQuery '${e}' returned no scalar value (empty result set or non-scalar shape).`}:{success:!0,value:r.kind==="iri"?`"[[${r.value}]]"`:r.value}}async executePropertyDelete(e,t){if(!e.targetProperty)return{success:!1,error:"property_delete requires targetProperty"};let r=await this.fileReader.readFile(t),i=this.frontmatterService.removeProperty(r,e.targetProperty);return await this.fileWriter.updateFile(t,i),{success:!0}}async executeComposite(e,t,r,i,s){if(s>=lP)return{success:!1,error:`Composite grounding exceeded maximum depth of ${lP}`};let o=e.steps??[];if(o.length===0)return{success:!0};let c;try{c=await this.fileReader.readFile(r)}catch{}let l=[];try{for(let u=0;u<o.length;u++){let f=o[u],d=await this.executeStep(f,t,r,i,s+1);if(!d.success)return await this.rollback(c,r,l),{success:!1,error:`Composite step ${u} failed: ${d.error}`};l.push(u)}return{success:!0}}catch(u){return await this.rollback(c,r,l),{success:!1,error:`Composite execution failed: ${u instanceof Error?u.message:String(u)}`}}}async executeServiceCall(e,t,r,i){let s=e.targetProperty;if(!s)return{success:!1,error:"service_call requires targetProperty as serviceId"};if(s==="convertToTask")return await this.executeConvertToTask(r);if(s==="updateProperty"){let l=L8(e.targetValueRef);if(l==="ems__Task")return await this.executeConvertToTask(r);if(l==="ems__Project")return await this.executeConvertToProject(r)}let o=this.serviceRegistry.get(s);if(!o)return{success:!1,error:`Service not found: "${s}". Registered services: ${this.serviceRegistry.getRegisteredIds().join(", ")||"none"}`};let c=i;if(e.isDefinedBy&&(c={isDefinedBy:e.isDefinedBy,...c??{}}),e.serviceCallPayload)try{let l=this.substituteVariables(e.serviceCallPayload,t,i),u=JSON.parse(l);typeof u=="object"&&u!==null&&(c={...u,...c??{}})}catch{}return await o.execute(t,c),{success:!0}}async executeConvertToTask(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Task"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeConvertToProject(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Project"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeCreateInstance(e,t,r,i){if(!e.targetFolder)return{success:!1,error:"create_instance requires targetFolder"};let s={},o=null;if((e.inheritanceRule&&e.inheritanceRule.length>0||e.propertyDefault&&e.propertyDefault.some(y=>typeof y.value=="string"&&y.value.includes("__SUBSTITUTE"))||e.labelTemplate!==void 0&&/\$target\./.test(e.labelTemplate))&&t&&r){let y;try{y=await this.fileReader.readFile(r)}catch(g){return{success:!1,error:`create_instance: failed to read $target file "${r}": ${g instanceof Error?g.message:String(g)}`}}o=this.frontmatterService.parseObject(y)??null}let l;e.targetClass&&(l=await this.resolveClassRefToUid(e.targetClass));let u={userInput:i,targetIRI:t,targetFilePath:r,targetFm:o??void 0,groundingTargetClassUid:l};if(e.propertyDefault&&e.propertyDefault.length>0&&this.applyPropertyDefaultStep(s,e.propertyDefault,u),this.applyMissingScalarPrimitives(s,i,l,e,t,o,r),i)for(let[y,g]of Object.entries(i))y!=="label"&&g!=null&&(s[y]=g);if(e.inheritanceRule&&e.inheritanceRule.length>0&&o&&await this.applyInheritanceRuleStep(s,e.inheritanceRule,o),this.applyMissingBacklinkTopUp(s,e,t,r),t&&e.linkBackProperty&&s[e.linkBackProperty]===void 0){let y=co.extractBacklinkTarget(t,r);s[e.linkBackProperty]=`"[[${y}]]"`}let f=s.exo__Asset_uid,d=this.frontmatterService.createFrontmatter("",s),h=this.substituteVariables(e.targetFolder,t,i,void 0,r),p=h?`${h}/${f}.md`:`${f}.md`;return await this.fileWriter.createFile(p,d),{success:!0,openPath:p}}async resolveClassRefToUid(e){if(cP.test(e)||!this.classLabelToUid)return e;try{let t=await this.classLabelToUid(e);return t&&t.length>0?t:e}catch{return e}}applyPropertyDefaultStep(e,t,r){for(let{propertyName:i,value:s}of t){if(e[i]!==void 0)continue;let o=this.resolveSubstitutionMarker(s,r);if(o!=null){if(Array.isArray(o)){if(o.length===0)continue;e[i]=o;continue}if(i==="exo__Instance_class"&&typeof o=="string"){e[i]=[o];continue}e[i]=o}}}applyMissingScalarPrimitives(e,t,r,i,s,o,c){let l=[];e.exo__Asset_uid===void 0&&(e.exo__Asset_uid=this.uidGen.next(),l.push("exo__Asset_uid")),e.exo__Asset_createdAt===void 0&&(e.exo__Asset_createdAt=Nw.DateFormatter.toLocalTimestamp(this.clock.now()),l.push("exo__Asset_createdAt"));let u=typeof e.exo__Asset_label=="string"&&e.exo__Asset_label.trim().length===0;if(e.exo__Asset_label===void 0||u){let f=t?.label;if(f===void 0&&i?.labelTemplate)try{let h=this.substituteVariables(i.labelTemplate,s??"",t,o??void 0,c);h.trim().length>0&&(f=h)}catch(h){Ul.LoggingService.error(`[GroundingExecutor] labelTemplate substitution failed: ${h instanceof Error?h.message:String(h)}. Falling back to "Untitled".`)}let d=f??"Untitled";e.exo__Asset_label=d,d!=="Untitled"&&e.aliases===void 0&&(e.aliases=[d]),l.push("exo__Asset_label")}e.exo__Instance_class===void 0&&r&&(e.exo__Instance_class=[`"[[${r}]]"`],l.push("exo__Instance_class")),l.length>0&&Ul.LoggingService.error(`[GroundingExecutor] Universal Default Template did not cover essential scalar primitives: ${l.join(", ")}. Filled from legacy TS fallback. Vault may be in an unhealthy state \u2014 verify UniversalDefaultTemplate singleton is present and complete.`)}applyMissingBacklinkTopUp(e,t,r,i){if(!r||t.linkBackProperty||e.exo__Asset_prototype!==void 0||e.ems__Effort_parent!==void 0)return;let s=co.extractBacklinkTarget(r,i);e.exo__Asset_prototype=`"[[${s}]]"`,Ul.LoggingService.error("[GroundingExecutor] No backlink rule fired (Universal IRs absent or no class match). Falling back to legacy exo__Asset_prototype default. Bug #5 may surface if target is not a prototype-instance.")}resolveSubstitutionMarker(e,t){let r=e.match(k8);if(r){let c=r[1],l=r[2],u=co.decodeBase64UrlSafe(l),f=(0,kw.getResolver)(c);return f?f(t,u):(Ul.LoggingService.warn(`[GroundingExecutor] Parameterised marker references unknown resolver '${c}' \u2014 value left as marker.`),e)}let i=e.match(N8);if(!i)return e;let s=i[1];if(s==="target"){let c=t.targetIRI??"",l=t.targetFilePath??"";return`"[[${co.extractBacklinkTarget(c,l)}]]"`}if(s==="targetFolder"){let c=t.targetFilePath??"";if(!c)return"";let l=c.replace(/^\/+/,""),u=l.lastIndexOf("/");return u>=0?l.slice(0,u):""}let o=(0,kw.getResolver)(s);return o?o(t):(Ul.LoggingService.warn(`[GroundingExecutor] Marker references unknown resolver '${s}' \u2014 value left as marker.`),e)}static decodeBase64UrlSafe(e){return(0,C8.base64ToUtf8)(e.replace(/-/g,"+").replace(/_/g,"/"))}async applyInheritanceRuleStep(e,t,r){let i=this.extractTargetClassNames(r),s=[];for(let o of t)!await this.inheritanceConditionMatches(o.targetClassCondition,o.targetClassConditionUid,i)||await this.inheritanceExclusionMatches(o.targetClassExclusion,o.targetClassExclusionUids,i)||s.push(o);s.sort((o,c)=>c.priority-o.priority);for(let o of s){if(e[o.targetPropertyName]!==void 0)continue;let c=r[o.sourcePropertyName];c!=null&&(e[o.targetPropertyName]=this.formatInheritedValue(c))}}async inheritanceConditionMatches(e,t,r){return!e&&!t?!0:this.classRefMatchesAny(e,t,r)}async inheritanceExclusionMatches(e,t,r){for(let i of t??[])if(i&&r.includes(i))return!0;for(let i of e)if(await this.classRefMatchesAny(i,void 0,r))return!0;return!1}async classRefMatchesAny(e,t,r){if(t&&r.includes(t)||e&&r.includes(e))return!0;if(e&&this.classLabelToUid)try{let i=await this.classLabelToUid(e);if(i&&i.length>0&&r.includes(i))return!0}catch{}return!1}extractTargetClassNames(e){let t=e.exo__Instance_class;if(t==null)return[];let r=Array.isArray(t)?t:[t],i=[];for(let s of r){let o=this.extractWikilinkInner(String(s));o&&i.push(o)}return i}extractWikilinkInner(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/);return t?t[1].trim():e.replace(/^["']|["']$/g,"").trim()}formatInheritedValue(e){return Array.isArray(e)?e.map(t=>this.formatInheritedScalar(String(t))):this.formatInheritedScalar(String(e))}formatInheritedScalar(e){return/^"?\[\[.+\]\]"?$/.test(e)?this.reformatWikilink(e):cP.test(e)?`"[[${e}]]"`:e}reformatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:e}async executeStep(e,t,r,i,s){return e.type===ci.GroundingType.COMPOSITE?this.executeComposite(e,t,r,i,s):this.execute(e,t,r,i)}async rollback(e,t,r){if(e!==void 0)try{await this.fileWriter.updateFile(t,e)}catch(i){Ul.LoggingService.error(`[GroundingExecutor] Rollback failed for ${t}`,i instanceof Error?i:new Error(String(i)))}}substituteVariables(e,t,r,i,s){let o=this.clock.now(),c=o.toISOString(),l=Nw.DateFormatter.toLocalTimestamp(o),u=c.slice(0,10),f=`${u}T00:00:00`,d=`${l.slice(0,10)}-${l.slice(11,13)}-${l.slice(14,16)}`,h=e.replace(/\$target\.([A-Za-z_][\w]*)/g,(p,y)=>{if(!i)throw new Error(`$target.${y} substitution requires target frontmatter context; none was supplied (asset IRI: ${t})`);let g=i[y];if(g==null)throw new Error(`$target.${y} is undefined on asset ${t}`);if(Array.isArray(g))throw new Error(`$target.${y} resolved to an array on asset ${t}; only scalar properties are supported for substitution`);return String(g).replace(/^["'](.*)["']$/,"$1")});if(/\$targetFolder\b/.test(h)){if(!s)throw new Error("$targetFolder substitution requires targetFilePath context; none was supplied (asset IRI: "+t+")");let p=s.replace(/^\/+/,""),y=p.lastIndexOf("/"),g=y>=0?p.slice(0,y):"";h=h.replace(/\$targetFolder\b/g,g)}if(h=h.replace(/\$target/g,t).replace(/\$nowCompact\b/g,d).replace(/\$nowLocal/g,l).replace(/\$now/g,c).replace(/\$todayStart\b/g,f).replace(/\$today/g,u),r?.value!==void 0&&r.value!==null){let p=String(r.value);h=h.replace(/\$input\b/g,p).replace(/\$value\b/g,p)}return h}async executePropertyAppend(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_append requires targetProperty"};if(e.appendExpression===void 0)return{success:!1,error:"property_append requires appendExpression"};let s=await this.fileReader.readFile(r),o=this.frontmatterService.parseObject(s)??{},c=this.substituteVariables(e.appendExpression,t,i,o),l=o[e.targetProperty],u=Array.isArray(l)?l:l!==void 0?[String(l)]:[],f=a(y=>y.replace(/^["'](.*)["']$/,"$1"),"stripQuotes"),d=new Set(u.map(f)),h;if(d.has(f(c)))h=u;else{let y=`"${f(c)}"`;h=[...u,y]}let p=this.frontmatterService.updateProperty(s,e.targetProperty,h);return await this.fileWriter.updateFile(r,p),{success:!0}}async executePropertyIncrement(e,t){if(!e.targetProperty)return{success:!1,error:"property_increment requires targetProperty"};let r=e.incrementBy??1;if(!Number.isFinite(r)||!Number.isInteger(r))return{success:!1,error:`property_increment: incrementBy must be an integer (got ${String(e.incrementBy)})`};let i=await this.fileReader.readFile(t),o=(this.frontmatterService.parseObject(i)??{})[e.targetProperty],c;if(o==null||o==="")c=0;else{if(Array.isArray(o))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" is an array, expected integer`};{let f=String(o).replace(/^["'](.*)["']$/,"$1").trim();if(!/^-?\d+$/.test(f))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" current value "${String(o)}" is not a valid integer`};c=Number.parseInt(f,10)}}let l=c+r,u=this.frontmatterService.updateProperty(i,e.targetProperty,l);return await this.fileWriter.updateFile(t,u),{success:!0}}async executePropertyShift(e,t){if(!e.targetProperty)return{success:!1,error:"property_shift requires targetProperty"};if(!e.shiftDelta)return{success:!1,error:"property_shift requires shiftDelta (ISO-8601 duration literal)"};let r=await this.fileReader.readFile(t),s=(this.frontmatterService.parseObject(r)??{})[e.targetProperty];if(s==null||s==="")return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is not set on target asset`};if(Array.isArray(s))return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is an array, expected single datetime`};let o=String(s).replace(/^["'](.*)["']$/,"$1").trim(),c=new Date(o);if(Number.isNaN(c.getTime()))return{success:!1,error:`property_shift: current value "${o}" is not a valid datetime`};let l;try{l=co.applyIsoDuration(c,e.shiftDelta)}catch(d){return{success:!1,error:`property_shift: invalid shiftDelta "${e.shiftDelta}": ${d instanceof Error?d.message:String(d)}`}}let u=Nw.DateFormatter.toLocalTimestamp(l),f=this.frontmatterService.updateProperty(r,e.targetProperty,u);return await this.fileWriter.updateFile(t,f),{success:!0}}async executeWorkflowTransition(e,t,r,i){if(!this.workflowResolver)return{success:!1,error:"workflow_transition requires WorkflowResolver injection (options.workflowResolver). Wire the plugin/CLI before using this grounding type."};let s=await this.fileReader.readFile(r),o=this.frontmatterService.parseObject(s)??{},c=this.resolveAssetClassFromFrontmatter(o);if(!c)return{success:!1,error:"workflow_transition: target asset has no recognised ems__* class in exo__Instance_class (cannot resolve workflow)."};let l=this.resolveStatusFromFrontmatter(o);if(!l)return{success:!1,error:"workflow_transition: target asset has no parseable ems__Effort_status value (need wikilink to an ems__EffortStatus* asset)."};let u;try{u=new O8.IRI(t)}catch(T){return{success:!1,error:`workflow_transition: invalid targetIRI "${t}" \u2014 ${T instanceof Error?T.message:String(T)}`}}let f=await this.workflowResolver.resolveForAsset(u,c),d=e.direction??"forward",h=d==="rollback",p=f.transitions.find(T=>T.from===l&&T.isRollback===h);if(!p)return{success:!1,error:`workflow_transition: no ${d} transition from "${l}" defined in workflow "${f.name}" (target class: ${c}).`};let y=vr.STATUS_UID_BY_ENUM[p.to];if(!y)return{success:!1,error:`workflow_transition: no UID mapping for destination status "${p.to}" (transition target unreachable).`};let g={id:`${e.id}.statusMutation`,label:`workflow_transition: ${p.from} \u2192 ${p.to}`,type:ci.GroundingType.PROPERTY_SET,targetProperty:"ems__Effort_status",targetValueRef:y},v=await this.executePropertySet(g,t,r,i);if(!v.success)return{success:!1,error:`workflow_transition: status mutation failed \u2014 ${v.error}`};let _=p.postActions??[],S=this.groundingLoader;if(_.length>0&&S===void 0)return{success:!1,error:"workflow_transition: transition has postActions but no GroundingLoader injected (options.groundingLoader). Wire commandResolver.loadGroundingByUid in plugin/CLI."};for(let T of _){if(S===void 0)break;let I=await S(T);if(!I)return{success:!1,error:`workflow_transition: postAction grounding UID "${T}" could not be loaded (asset missing or invalid Grounding shape).`};let A=await this.execute(I,t,r,i);if(!A.success)return{success:!1,error:`workflow_transition: postAction "${I.label}" (UID ${T}) failed \u2014 ${A.error}`}}return{success:!0}}resolveAssetClassFromFrontmatter(e){let t=e.exo__Instance_class;if(t==null)return null;let r=Array.isArray(t)?t:[t],i=new Set(Object.values(Gm.AssetClass));for(let s of r){if(typeof s!="string")continue;let o=s.replace(/^\s*"?\[\[/,"").replace(/\]\]"?\s*$/,""),l=(o.includes("|")?o.split("|")[1]:o).trim();if(i.has(l))return l;let u=o.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(u){let f=vr.CLASS_UID_TO_LABEL[u[1].toLowerCase()];if(f&&i.has(f))return f}}return null}resolveStatusFromFrontmatter(e){let t=e.ems__Effort_status;if(t==null)return null;if(Array.isArray(t)){if(t.length!==1)return null;t=t[0]}let i=String(t).trim().replace(/^["']/,"").replace(/["']$/,"").replace(/^\[\[/,"").replace(/\]\]$/,"");if(/^ems__EffortStatus[A-Za-z]+$/.test(i))return i;if(i.includes("|")){let o=i.split("|")[1].trim();if(/^ems__EffortStatus[A-Za-z]+$/.test(o))return o}let s=i.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(s){let o=F8[s[1].toLowerCase()];if(o)return o}return null}static applyIsoDuration(e,t){let r=t.trim();if(/^-?P(\d+Y)(\d+M)?$|^-?P\d+M$/.test(r)){let o=aP.DateTimeParsing.parseYearMonthDuration(r),c=new Date(e.getTime());return c.setMonth(c.getMonth()+o),c}let s=aP.DateTimeParsing.parseDayTimeDuration(r);return new Date(e.getTime()+s)}static extractBacklinkTarget(e,t){let r=co.resolveTargetPath(e,t),i=r.split("/").pop()??r;return co.UUID_BASENAME_RE.test(i)?i:r}static resolveTargetPath(e,t){if(t)return t.replace(/\.md$/i,"").replace(/^\/+/,"");if(e){let r=e.match(/^obsidian:\/\/vault\/(.+?)(?:\.md)?(?:\?|#|$)/i);if(r&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}}return e}};vr.GroundingExecutor=Wm;Wm.UUID_BASENAME_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;vr.GroundingExecutor=Wm=co=A8([(0,x8.injectable)(),I8("design:paramtypes",[Object,Object,qm,Function,Object])],Wm)});var fP=w(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});Mw.createVaultFrontmatterClassLabelResolver=M8;function M8(n){return async e=>{if(!e)return null;let t=await n.findFilesByMetadata({exo__Asset_label:e});if(t.length>0){let s=(await n.getFileMetadata(t[0])).exo__Asset_uid;if(typeof s=="string"&&s.length>0)return s}let r=await n.findFilesByMetadata({aliases:e});if(r.length>0){let s=(await n.getFileMetadata(r[0])).exo__Asset_uid;if(typeof s=="string"&&s.length>0)return s}return null}}a(M8,"createVaultFrontmatterClassLabelResolver")});var hP=w(lo=>{"use strict";var j8=lo&&lo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},$8=lo&&lo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Bl;Object.defineProperty(lo,"__esModule",{value:!0});lo.NamedQueryRunner=void 0;var U8=je(),B8=Oe(),V8=qe(),dP=Fm(),G8=Rp(),jw=Bl=class{static{a(this,"NamedQueryRunner")}constructor(e,t){this.queryBodyResolver=e,this.tripleStore=t}async run(e,t={}){if(!e)return null;let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return null;let i=this.substitute(r,t);return(0,dP.evaluateWithExoEval)(i,{store:this.tripleStore})}async runScalar(e,t={},r){if(!e)throw new Error("NamedQueryRunner.runScalar: empty queryUid");let i=await this.queryBodyResolver.resolveSparql(e);if(!i)throw new Error(`NamedQueryRunner: query__NamedQuery '${e}' has no resolvable SPARQL body (asset missing or no \`\`\`sparql block).`);let s=this.substitute(i,t),o=await(0,dP.evaluateWithExoEval)(s,{store:this.tripleStore});if(o.kind==="ask")return{value:o.result?"true":"false",kind:"literal"};if(o.kind==="construct")return null;let c=o.rows[0];if(!c)return null;let l=c.variables(),u=r??l[0];if(!u)return null;let f=c.get(u);return f===void 0?null:f instanceof B8.IRI?{value:(0,G8.iriToObsidianName)(f.value)??f.value,kind:"iri"}:f instanceof V8.Literal?{value:f.value,kind:"literal"}:null}substitute(e,t){let r=e;t.currentAsset&&(r=r.replace(/\$currentAsset\b/g,Bl.formatIri(t.currentAsset))),t.currentClass&&(r=r.replace(/\$currentClass\b/g,Bl.formatIri(t.currentClass)));let i=t.params;if(i){let s=Object.keys(i).sort((o,c)=>c.length-o.length);for(let o of s){let c=i[o],l=c.kind==="iri"?Bl.formatIri(c.value):`"${Bl.escapeLiteral(c.value)}"`,u=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(`\\$${u}\\b`,"g"),l)}}return r}static formatIri(e){if(/[\s<>"{}|\\^`]/.test(e))throw new Error(`NamedQueryRunner: refusing to inject malformed IRI "${e}" \u2014 contains a character illegal in a SPARQL IRIREF (would break out of <...>). Pass a percent-encoded IRI.`);return`<${e}>`}static escapeLiteral(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}};lo.NamedQueryRunner=jw;lo.NamedQueryRunner=jw=Bl=j8([(0,U8.injectable)(),$8("design:paramtypes",[Object,Object])],jw)});var pP=w(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.extractSparqlBlock=q8;zm.stripFrontmatter=W8;function q8(n){let e=n.match(/```sparql\s*\n([\s\S]*?)\n```/);if(!e)return null;let t=e[1].trim();return t.length>0?t:null}a(q8,"extractSparqlBlock");function W8(n){if(!n.startsWith("---"))return n;let e=n.indexOf(`
92
- ---`,3);return e<0?n:n.slice(e+4)}a(W8,"stripFrontmatter")});var mP=w(uo=>{"use strict";var z8=uo&&uo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},H8=uo&&uo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},$w;Object.defineProperty(uo,"__esModule",{value:!0});uo.CommandExecutionFlow=void 0;var K8=je(),Q8=Vo(),X8=Oe(),Y8=qe(),J8=Jt(),Z8=kn(),Uw=$w=class{static{a(this,"CommandExecutionFlow")}constructor(e,t,r,i,s,o){this.groundingExecutor=e,this.notificationService=t,this.logger=r,this.prompts=i,this.tripleStore=s,this.fileOpener=o}async run(e,t){let{command:r}=e;if(r.confirmMessage&&!await this.prompts.confirm(r.confirmMessage))return;let i=t.injectedUserInput,s=$w.extractInputSchema(e);if(s!==null&&s.length>0){let l=await this.applyLabelDatePrefill(s,r.grounding,t.targetIRI),u=await this.prompts.promptInputSchema(l);if(u===null)return;i={...t.injectedUserInput??{},...u}}let o=await this.groundingExecutor.execute(r.grounding,t.targetIRI??"",t.filePath??"",i),c=t.filePath??"<no-file>";if(o.success){if(r.successMessage&&this.notificationService.success(r.successMessage),await new Promise(l=>setTimeout(l,100)),t.onComplete&&await t.onComplete(),o.openPath&&this.fileOpener)try{await this.fileOpener.open(o.openPath,{sameTab:r.openInSameTab})}catch(l){this.logger.info(`[CommandExecutionFlow] Failed to open created file "${o.openPath}": ${l instanceof Error?l.message:String(l)}`)}this.logger.info(`[CommandExecutionFlow] Executed "${r.name}" on ${c}`)}else this.notificationService.error(`Command failed: ${o.error??"unknown error"}`),this.logger.info(`[CommandExecutionFlow] Failed "${r.name}": ${o.error}`)}static extractInputSchema(e){let r=e.command.grounding.inputSchema;return!r||!Array.isArray(r)?null:r}async applyLabelDatePrefill(e,t,r){if(t.type!==Q8.GroundingType.CREATE_INSTANCE||!t.prefillLabelWithDate||!r||!this.tripleStore)return e;let i=await this.resolveAssetLabel(r);if(!i)return e;let s=Z8.DateFormatter.toDateString(new Date),o=`${i} ${s}`;return e.map(c=>{if(typeof c!="object"||c===null)return c;let l=c;if(l.name!=="label")return c;let u=l.defaultValue;return typeof u=="string"&&u.length>0?c:{...l,defaultValue:o}})}async resolveAssetLabel(e){if(!this.tripleStore)return;let t=new X8.IRI(e),r=await this.tripleStore.match(t,J8.Namespace.EXO.term("Asset_label"),void 0);if(r.length===0)return;let i=r[0].object;if(i instanceof Y8.Literal)return i.value.length>0?i.value:void 0}};uo.CommandExecutionFlow=Uw;uo.CommandExecutionFlow=Uw=$w=z8([(0,K8.injectable)(),H8("design:paramtypes",[Function,Object,Object,Object,Object,Object])],Uw)});var Xf=w(fo=>{"use strict";var eU=fo&&fo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},tU=fo&&fo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(fo,"__esModule",{value:!0});fo.WorkflowEngine=void 0;var rU=je(),Bw=class{static{a(this,"WorkflowEngine")}constructor(e){this.definition=e}getAvailableTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&!t.isRollback)}getRollbackTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&t.isRollback)}getAllTransitions(e){return this.definition.transitions.filter(t=>t.from===e)}canTransition(e,t){return this.definition.transitions.some(r=>r.from===e&&r.to===t)}getPreviousStatus(e){return this.definition.transitions.find(r=>r.from===e&&r.isRollback)?.to??null}getNextStates(e){return this.getAvailableTransitions(e).map(t=>t.to)}isTerminalState(e){return this.definition.terminalStates.includes(e)}isInitialState(e){return this.definition.initialState===e}getTimestampsForStatus(e){return this.definition.states.find(r=>r.status===e)?.timestampOnEnter??[]}getTransition(e,t){return this.definition.transitions.find(r=>r.from===e&&r.to===t)}getOrderedStates(){return this.definition.states.map(e=>e.status)}getDefinition(){return this.definition}validate(){let e=[],t=new Set(this.definition.states.map(i=>i.status));this.definition.states.length===0&&e.push("Workflow must have at least one state"),t.has(this.definition.initialState)||e.push(`Initial state "${this.definition.initialState}" is not in the states list`);for(let i of this.definition.terminalStates)t.has(i)||e.push(`Terminal state "${i}" is not in the states list`);for(let i of this.definition.transitions)t.has(i.from)||e.push(`Transition "${i.label}" references unknown source state "${i.from}"`),t.has(i.to)||e.push(`Transition "${i.label}" references unknown target state "${i.to}"`);for(let i of this.definition.states){if(this.definition.terminalStates.includes(i.status))continue;this.definition.transitions.filter(o=>o.from===i.status&&!o.isRollback).length===0&&e.push(`State "${i.status}" has no outgoing forward transitions (dead end)`)}let r=new Set;for(let i of this.definition.transitions){let s=`${i.from}\u2192${i.to}`;r.has(s)&&e.push(`Duplicate transition: ${s}`),r.add(s)}return{valid:e.length===0,errors:e}}};fo.WorkflowEngine=Bw;fo.WorkflowEngine=Bw=eU([(0,rU.injectable)(),tU("design:paramtypes",[Object])],Bw)});var gP=w(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0});Es.EFFORT_WORKFLOW_PROPERTY=Es.WorkflowTransitionProperty=Es.WorkflowStateProperty=Es.WorkflowProperty=void 0;Es.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};Es.WorkflowStateProperty={WORKFLOW:"ems__WorkflowState_workflow",STATUS:"ems__WorkflowState_status",ORDER:"ems__WorkflowState_order",OPTIONAL:"ems__WorkflowState_optional",TIMESTAMP_ON_ENTER:"ems__WorkflowState_timestampOnEnter",BADGE_COLOR:"ems__WorkflowState_badgeColor"};Es.WorkflowTransitionProperty={WORKFLOW:"ems__WorkflowTransition_workflow",FROM:"ems__WorkflowTransition_from",TO:"ems__WorkflowTransition_to",LABEL:"ems__WorkflowTransition_label",ICON:"ems__WorkflowTransition_icon",IS_ROLLBACK:"ems__WorkflowTransition_isRollback"};Es.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var ho=w(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.MetadataHelpers=void 0;var yP=Hf(),Vw=class{static{a(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=(0,yP.orderProperties)(e,(0,yP.loadDefaultSpec)()),i=Object.entries(r).map(([c,l])=>{if(Array.isArray(l)){let u=l.map(f=>` - ${String(f)}`).join(`
91
+ Details: ${t.message}`:"";console.error(`[Exocortex ERROR]${s} ${e}${o}`)}}};Bm.LoggingService=Qf;Qf.isVerbose=!1;Qf.isDevelopment=void 0});var oP=w(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.registerResolver=mn;lc.getResolver=w8;lc.getRegisteredResolverIds=v8;lc.clearResolvers=E8;lc.installDefaultResolvers=T8;var Vm=new Map;function mn(n,e){Vm.set(n,e)}a(mn,"registerResolver");function w8(n){return Vm.get(n)}a(w8,"getResolver");function v8(){return Array.from(Vm.keys())}a(v8,"getRegisteredResolverIds");function E8(){Vm.clear()}a(E8,"clearResolvers");function na(n){return n<10?`0${n}`:String(n)}a(na,"pad2");function T8(){mn("today",()=>new Date().toISOString().slice(0,10)),mn("todayStart",()=>new Date(new Date().setHours(0,0,0,0)).toISOString()),mn("target",n=>n.targetIRI?`"[[${n.targetIRI}]]"`:""),mn("targetFolder",n=>{if(!n.targetFilePath)return"";let e=n.targetFilePath.replace(/^\/+/,""),t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}),mn("randomUUIDv4",()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();throw new Error("randomUUIDv4 resolver requires crypto.randomUUID() \u2014 runtime is missing Node crypto / Web Crypto API.")}),mn("nowTimestamp",()=>{let n=new Date;return`${n.getFullYear()}-${na(n.getMonth()+1)}-${na(n.getDate())}T${na(n.getHours())}:${na(n.getMinutes())}:${na(n.getSeconds())}`}),mn("nowDate",()=>{let n=new Date;return`${n.getFullYear()}-${na(n.getMonth()+1)}-${na(n.getDate())}`}),mn("nowYear",()=>String(new Date().getFullYear())),mn("nowMonth",()=>na(new Date().getMonth()+1)),mn("userInputLabel",n=>{let e=n.userInput?.label;return typeof e=="string"?e:""}),mn("userInput",(n,e)=>{if(!e)return null;let t=n.userInput?.[e];return typeof t=="string"?t:t==null?null:String(t)}),mn("targetProperty",(n,e)=>{if(!e||!n.targetFm)return null;let t=n.targetFm[e];return t==null?null:Array.isArray(t)?t.map(String):String(t)}),mn("labelAsArray",n=>{let e=n.userInput?.label;return typeof e=="string"&&e.length>0?[e]:[]}),mn("groundingTargetClass",n=>n.groundingTargetClassUid?`"[[${n.groundingTargetClassUid}]]"`:null)}a(T8,"installDefaultResolvers")});var uP=w(vr=>{"use strict";var A8=vr&&vr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},I8=vr&&vr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Es;Object.defineProperty(vr,"__esModule",{value:!0});vr.GroundingExecutor=vr.ServiceRegistry=vr.CLASS_UID_TO_LABEL=vr.STATUS_UID_BY_ENUM=void 0;var x8=je(),R8=qf(),P8=km(),ci=Vo(),Gm=Jc(),C8=il(),uc=Zc(),O8=Oe(),D8=vs(),Nw=kn(),aP=jf(),Ul=ra();vr.STATUS_UID_BY_ENUM={[uc.EffortStatus.DRAFT]:"c42245d0-01de-4c35-bfcf-d910445ea28e",[uc.EffortStatus.BACKLOG]:"753a44d5-846c-4b82-9196-4fd9a4d48777",[uc.EffortStatus.ANALYSIS]:"cde3525c-57ea-4efc-b477-2e7e7ccd3a1e",[uc.EffortStatus.TODO]:"6a0e933a-6653-46f4-95ae-ed7508177c73",[uc.EffortStatus.DOING]:"027e78f4-6e16-4b36-b8fb-5510507d5745",[uc.EffortStatus.DONE]:"7b9b3116-7c3c-438c-9618-94fe301320a6",[uc.EffortStatus.TRASHED]:"5d14f18d-db2b-4847-9ac1-144cb93b2541"};var F8=Object.freeze(Object.fromEntries(Object.entries(vr.STATUS_UID_BY_ENUM).map(([n,e])=>[e,n])));vr.CLASS_UID_TO_LABEL=Object.freeze({"1b20a8f0-d745-4e93-91db-4531b3df120e":Gm.AssetClass.TASK,"7db5eeff-718a-49b0-8d2b-39b084a356e3":Gm.AssetClass.PROJECT,"1b0a5e34-dd7f-4ead-b43a-6c7c5a5ecaca":Gm.AssetClass.MEETING});var kw=oP();(0,kw.installDefaultResolvers)();function L8(n){if(n){if(n==="1b20a8f0-d745-4e93-91db-4531b3df120e")return"ems__Task";if(n==="7db5eeff-718a-49b0-8d2b-39b084a356e3")return"ems__Project";if(n==="ems__Task"||n==="ems__Project")return n}}a(L8,"resolveClassFlipTarget");var cP=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,N8=/^__SUBSTITUTE__([a-zA-Z][a-zA-Z0-9_]*)__[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}__$/,k8=/^__SUBSTITUTE_P__([a-zA-Z][a-zA-Z0-9_]*)__[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}__([A-Za-z0-9_-]*)__$/,qm=class{static{a(this,"ServiceRegistry")}constructor(){this.services=new Map}register(e,t){this.services.set(e,t)}get(e){return this.services.get(e)}has(e){return this.services.has(e)}getRegisteredIds(){return Array.from(this.services.keys())}};vr.ServiceRegistry=qm;var lP=20,Wm=Es=class{static{a(this,"GroundingExecutor")}constructor(e,t,r,i,s){this.frontmatterService=new D8.FrontmatterService,this.fileReader=e,this.fileWriter=t,this.serviceRegistry=r,this.classLabelToUid=i,this.workflowResolver=s?.workflowResolver,this.groundingLoader=s?.groundingLoader,this.namedQueryRunner=s?.namedQueryRunner,this.clock=s?.clock??(0,R8.liveClock)(),this.uidGen=s?.uidGenerator??(0,P8.liveUidGenerator)()}async execute(e,t,r,i){try{switch(e.type){case ci.GroundingType.PROPERTY_SET:return await this.executePropertySet(e,t,r,i);case ci.GroundingType.PROPERTY_DELETE:return await this.executePropertyDelete(e,r);case ci.GroundingType.COMPOSITE:return await this.executeComposite(e,t,r,i,0);case ci.GroundingType.SERVICE_CALL:return await this.executeServiceCall(e,t,r,i);case ci.GroundingType.CREATE_INSTANCE:return await this.executeCreateInstance(e,t,r,i);case ci.GroundingType.PROPERTY_APPEND:return await this.executePropertyAppend(e,t,r,i);case ci.GroundingType.PROPERTY_INCREMENT:return await this.executePropertyIncrement(e,r);case ci.GroundingType.PROPERTY_SHIFT:return await this.executePropertyShift(e,r);case ci.GroundingType.SPARQL_UPDATE:return{success:!1,error:"sparql_update grounding not yet implemented. Use property_set/property_delete instead."};case ci.GroundingType.WORKFLOW_TRANSITION:return await this.executeWorkflowTransition(e,t,r,i);default:return{success:!1,error:`Unknown grounding type: ${e.type}`}}}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}}async executePropertySet(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_set requires targetProperty"};let s;if([e.targetValueRef!==void 0,e.targetValueLiteral!==void 0,e.targetValueSubstitution!==void 0,e.targetValueQuery!==void 0].filter(Boolean).length>1)return{success:!1,error:"property_set: more than one of targetValueRef/targetValueLiteral/targetValueSubstitution/targetValueQuery set (cardinality 0..1 each, mutually exclusive)"};if(e.targetValueRef!==void 0)s=`"[[${e.targetValueRef}]]"`;else if(e.targetValueLiteral!==void 0)s=e.targetValueLiteral;else if(e.targetValueSubstitution!==void 0)s=e.targetValueSubstitution;else if(e.targetValueQuery!==void 0){let d=await this.resolveTargetValueQuery(e.targetValueQuery,t);if(!d.success)return d;s=d.value}else return{success:!1,error:"property_set requires one of targetValueRef/targetValueLiteral/targetValueSubstitution/targetValueQuery"};if(/\$(input|value)\b/.test(s)&&(i===void 0||i.value===void 0||i.value===null))return{success:!1,error:"property_set: substituted value contains $input/$value placeholder but no userInput.value provided"};let l=this.substituteVariables(s,t,i),u=await this.fileReader.readFile(r),f=this.frontmatterService.updateProperty(u,e.targetProperty,l);return await this.fileWriter.updateFile(r,f),{success:!0}}async resolveTargetValueQuery(e,t){if(!this.namedQueryRunner)return{success:!1,error:"property_set targetValueQuery requires NamedQueryRunner injection (options.namedQueryRunner). Wire the plugin/CLI before using this value-source."};let r;try{r=await this.namedQueryRunner.runScalar(e,{currentAsset:t})}catch(s){return{success:!1,error:`property_set targetValueQuery: NamedQuery '${e}' failed \u2014 ${s instanceof Error?s.message:String(s)}`}}return r===null?{success:!1,error:`property_set targetValueQuery: NamedQuery '${e}' returned no scalar value (empty result set or non-scalar shape).`}:{success:!0,value:r.kind==="iri"?`"[[${r.value}]]"`:r.value}}async executePropertyDelete(e,t){if(!e.targetProperty)return{success:!1,error:"property_delete requires targetProperty"};let r=await this.fileReader.readFile(t),i=this.frontmatterService.removeProperty(r,e.targetProperty);return await this.fileWriter.updateFile(t,i),{success:!0}}async executeComposite(e,t,r,i,s){if(s>=lP)return{success:!1,error:`Composite grounding exceeded maximum depth of ${lP}`};let o=e.steps??[];if(o.length===0)return{success:!0};let c;try{c=await this.fileReader.readFile(r)}catch{}let l=[];try{for(let u=0;u<o.length;u++){let f=o[u],d=await this.executeStep(f,t,r,i,s+1);if(!d.success)return await this.rollback(c,r,l),{success:!1,error:`Composite step ${u} failed: ${d.error}`};l.push(u)}return{success:!0}}catch(u){return await this.rollback(c,r,l),{success:!1,error:`Composite execution failed: ${u instanceof Error?u.message:String(u)}`}}}async executeServiceCall(e,t,r,i){let s=e.targetProperty;if(!s)return{success:!1,error:"service_call requires targetProperty as serviceId"};if(s==="convertToTask")return await this.executeConvertToTask(r);if(s==="updateProperty"){let l=L8(e.targetValueRef);if(l==="ems__Task")return await this.executeConvertToTask(r);if(l==="ems__Project")return await this.executeConvertToProject(r)}let o=this.serviceRegistry.get(s);if(!o)return{success:!1,error:`Service not found: "${s}". Registered services: ${this.serviceRegistry.getRegisteredIds().join(", ")||"none"}`};let c=i;if(e.isDefinedBy&&(c={isDefinedBy:e.isDefinedBy,...c??{}}),e.serviceCallPayload)try{let l=this.substituteVariables(e.serviceCallPayload,t,i),u=JSON.parse(l);typeof u=="object"&&u!==null&&(c={...u,...c??{}})}catch{}return await o.execute(t,c),{success:!0}}async executeConvertToTask(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Task"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeConvertToProject(e){let t=await this.fileReader.readFile(e),r=await this.resolveClassRefToUid("ems__Project"),i=this.frontmatterService.updateProperty(t,"exo__Instance_class",`["[[${r}]]"]`);return await this.fileWriter.updateFile(e,i),{success:!0}}async executeCreateInstance(e,t,r,i){if(!e.targetFolder)return{success:!1,error:"create_instance requires targetFolder"};let s={},o=null;if((e.inheritanceRule&&e.inheritanceRule.length>0||e.propertyDefault&&e.propertyDefault.some(y=>typeof y.value=="string"&&y.value.includes("__SUBSTITUTE"))||e.labelTemplate!==void 0&&/\$target\./.test(e.labelTemplate))&&t&&r){let y;try{y=await this.fileReader.readFile(r)}catch(g){return{success:!1,error:`create_instance: failed to read $target file "${r}": ${g instanceof Error?g.message:String(g)}`}}o=this.frontmatterService.parseObject(y)??null}let l;e.targetClass&&(l=await this.resolveClassRefToUid(e.targetClass));let u={userInput:i,targetIRI:t,targetFilePath:r,targetFm:o??void 0,groundingTargetClassUid:l};if(e.propertyDefault&&e.propertyDefault.length>0&&this.applyPropertyDefaultStep(s,e.propertyDefault,u),this.applyMissingScalarPrimitives(s,i,l,e,t,o,r),i)for(let[y,g]of Object.entries(i))y!=="label"&&g!=null&&(s[y]=g);if(e.inheritanceRule&&e.inheritanceRule.length>0&&o&&await this.applyInheritanceRuleStep(s,e.inheritanceRule,o),this.applyMissingBacklinkTopUp(s,e,t,r),t&&e.linkBackProperty&&s[e.linkBackProperty]===void 0){let y=Es.extractBacklinkTarget(t,r);s[e.linkBackProperty]=`"[[${y}]]"`}let f=s.exo__Asset_uid,d=this.frontmatterService.createFrontmatter("",s),h=this.substituteVariables(e.targetFolder,t,i,void 0,r),p=h?`${h}/${f}.md`:`${f}.md`;return await this.fileWriter.createFile(p,d),{success:!0,openPath:p}}async resolveClassRefToUid(e){if(cP.test(e)||!this.classLabelToUid)return e;try{let t=await this.classLabelToUid(e);return t&&t.length>0?t:e}catch{return e}}applyPropertyDefaultStep(e,t,r){for(let{propertyName:i,value:s}of t){if(e[i]!==void 0)continue;let o=this.resolveSubstitutionMarker(s,r);if(o!=null){if(Array.isArray(o)){if(o.length===0)continue;e[i]=o;continue}if(i==="exo__Instance_class"&&typeof o=="string"){e[i]=[o];continue}e[i]=o}}}applyMissingScalarPrimitives(e,t,r,i,s,o,c){let l=[];e.exo__Asset_uid===void 0&&(e.exo__Asset_uid=this.uidGen.next(),l.push("exo__Asset_uid")),e.exo__Asset_createdAt===void 0&&(e.exo__Asset_createdAt=Nw.DateFormatter.toLocalTimestamp(this.clock.now()),l.push("exo__Asset_createdAt"));let u=typeof e.exo__Asset_label=="string"&&e.exo__Asset_label.trim().length===0;if(e.exo__Asset_label===void 0||u){let f=t?.label;if(f===void 0&&i?.labelTemplate)try{let h=this.substituteVariables(i.labelTemplate,s??"",t,o??void 0,c);h.trim().length>0&&(f=h)}catch(h){Ul.LoggingService.error(`[GroundingExecutor] labelTemplate substitution failed: ${h instanceof Error?h.message:String(h)}. Falling back to "Untitled".`)}let d=f??"Untitled";e.exo__Asset_label=d,d!=="Untitled"&&e.aliases===void 0&&(e.aliases=[d]),l.push("exo__Asset_label")}e.exo__Instance_class===void 0&&r&&(e.exo__Instance_class=[`"[[${r}]]"`],l.push("exo__Instance_class")),l.length>0&&Ul.LoggingService.error(`[GroundingExecutor] Universal Default Template did not cover essential scalar primitives: ${l.join(", ")}. Filled from legacy TS fallback. Vault may be in an unhealthy state \u2014 verify UniversalDefaultTemplate singleton is present and complete.`)}applyMissingBacklinkTopUp(e,t,r,i){if(!r||t.linkBackProperty||e.exo__Asset_prototype!==void 0||e.ems__Effort_parent!==void 0)return;let s=Es.extractBacklinkTarget(r,i);Es.propertiesReferenceTarget(e,s)||(e.exo__Asset_prototype=`"[[${s}]]"`,Ul.LoggingService.error("[GroundingExecutor] No backlink rule fired (Universal IRs absent or no class match). Falling back to legacy exo__Asset_prototype default. Bug #5 may surface if target is not a prototype-instance."))}static propertiesReferenceTarget(e,t){if(!t)return!1;let r=`[[${t}]]`,i=a(s=>typeof s=="string"&&s.includes(r),"refs");for(let s of Object.values(e))if(i(s)||Array.isArray(s)&&s.some(i))return!0;return!1}resolveSubstitutionMarker(e,t){let r=e.match(k8);if(r){let c=r[1],l=r[2],u=Es.decodeBase64UrlSafe(l),f=(0,kw.getResolver)(c);return f?f(t,u):(Ul.LoggingService.warn(`[GroundingExecutor] Parameterised marker references unknown resolver '${c}' \u2014 value left as marker.`),e)}let i=e.match(N8);if(!i)return e;let s=i[1];if(s==="target"){let c=t.targetIRI??"",l=t.targetFilePath??"";return`"[[${Es.extractBacklinkTarget(c,l)}]]"`}if(s==="targetFolder"){let c=t.targetFilePath??"";if(!c)return"";let l=c.replace(/^\/+/,""),u=l.lastIndexOf("/");return u>=0?l.slice(0,u):""}let o=(0,kw.getResolver)(s);return o?o(t):(Ul.LoggingService.warn(`[GroundingExecutor] Marker references unknown resolver '${s}' \u2014 value left as marker.`),e)}static decodeBase64UrlSafe(e){return(0,C8.base64ToUtf8)(e.replace(/-/g,"+").replace(/_/g,"/"))}async applyInheritanceRuleStep(e,t,r){let i=this.extractTargetClassNames(r),s=[];for(let o of t)!await this.inheritanceConditionMatches(o.targetClassCondition,o.targetClassConditionUid,i)||await this.inheritanceExclusionMatches(o.targetClassExclusion,o.targetClassExclusionUids,i)||s.push(o);s.sort((o,c)=>c.priority-o.priority);for(let o of s){if(e[o.targetPropertyName]!==void 0)continue;let c=r[o.sourcePropertyName];c!=null&&(e[o.targetPropertyName]=this.formatInheritedValue(c))}}async inheritanceConditionMatches(e,t,r){return!e&&!t?!0:this.classRefMatchesAny(e,t,r)}async inheritanceExclusionMatches(e,t,r){for(let i of t??[])if(i&&r.includes(i))return!0;for(let i of e)if(await this.classRefMatchesAny(i,void 0,r))return!0;return!1}async classRefMatchesAny(e,t,r){if(t&&r.includes(t)||e&&r.includes(e))return!0;if(e&&this.classLabelToUid)try{let i=await this.classLabelToUid(e);if(i&&i.length>0&&r.includes(i))return!0}catch{}return!1}extractTargetClassNames(e){let t=e.exo__Instance_class;if(t==null)return[];let r=Array.isArray(t)?t:[t],i=[];for(let s of r){let o=this.extractWikilinkInner(String(s));o&&i.push(o)}return i}extractWikilinkInner(e){let t=e.match(/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/);return t?t[1].trim():e.replace(/^["']|["']$/g,"").trim()}formatInheritedValue(e){return Array.isArray(e)?e.map(t=>this.formatInheritedScalar(String(t))):this.formatInheritedScalar(String(e))}formatInheritedScalar(e){return/^"?\[\[.+\]\]"?$/.test(e)?this.reformatWikilink(e):cP.test(e)?`"[[${e}]]"`:e}reformatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:e}async executeStep(e,t,r,i,s){return e.type===ci.GroundingType.COMPOSITE?this.executeComposite(e,t,r,i,s):this.execute(e,t,r,i)}async rollback(e,t,r){if(e!==void 0)try{await this.fileWriter.updateFile(t,e)}catch(i){Ul.LoggingService.error(`[GroundingExecutor] Rollback failed for ${t}`,i instanceof Error?i:new Error(String(i)))}}substituteVariables(e,t,r,i,s){let o=this.clock.now(),c=o.toISOString(),l=Nw.DateFormatter.toLocalTimestamp(o),u=c.slice(0,10),f=`${u}T00:00:00`,d=`${l.slice(0,10)}-${l.slice(11,13)}-${l.slice(14,16)}`,h=e.replace(/\$target\.([A-Za-z_][\w]*)/g,(p,y)=>{if(!i)throw new Error(`$target.${y} substitution requires target frontmatter context; none was supplied (asset IRI: ${t})`);let g=i[y];if(g==null)throw new Error(`$target.${y} is undefined on asset ${t}`);if(Array.isArray(g))throw new Error(`$target.${y} resolved to an array on asset ${t}; only scalar properties are supported for substitution`);return String(g).replace(/^["'](.*)["']$/,"$1")});if(/\$targetFolder\b/.test(h)){if(!s)throw new Error("$targetFolder substitution requires targetFilePath context; none was supplied (asset IRI: "+t+")");let p=s.replace(/^\/+/,""),y=p.lastIndexOf("/"),g=y>=0?p.slice(0,y):"";h=h.replace(/\$targetFolder\b/g,g)}if(h=h.replace(/\$target/g,t).replace(/\$nowCompact\b/g,d).replace(/\$nowLocal/g,l).replace(/\$now/g,c).replace(/\$todayStart\b/g,f).replace(/\$today/g,u),r?.value!==void 0&&r.value!==null){let p=String(r.value);h=h.replace(/\$input\b/g,p).replace(/\$value\b/g,p)}return h}async executePropertyAppend(e,t,r,i){if(!e.targetProperty)return{success:!1,error:"property_append requires targetProperty"};if(e.appendExpression===void 0)return{success:!1,error:"property_append requires appendExpression"};let s=await this.fileReader.readFile(r),o=this.frontmatterService.parseObject(s)??{},c=this.substituteVariables(e.appendExpression,t,i,o),l=o[e.targetProperty],u=Array.isArray(l)?l:l!==void 0?[String(l)]:[],f=a(y=>y.replace(/^["'](.*)["']$/,"$1"),"stripQuotes"),d=new Set(u.map(f)),h;if(d.has(f(c)))h=u;else{let y=`"${f(c)}"`;h=[...u,y]}let p=this.frontmatterService.updateProperty(s,e.targetProperty,h);return await this.fileWriter.updateFile(r,p),{success:!0}}async executePropertyIncrement(e,t){if(!e.targetProperty)return{success:!1,error:"property_increment requires targetProperty"};let r=e.incrementBy??1;if(!Number.isFinite(r)||!Number.isInteger(r))return{success:!1,error:`property_increment: incrementBy must be an integer (got ${String(e.incrementBy)})`};let i=await this.fileReader.readFile(t),o=(this.frontmatterService.parseObject(i)??{})[e.targetProperty],c;if(o==null||o==="")c=0;else{if(Array.isArray(o))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" is an array, expected integer`};{let f=String(o).replace(/^["'](.*)["']$/,"$1").trim();if(!/^-?\d+$/.test(f))return{success:!1,error:`property_increment: targetProperty "${e.targetProperty}" current value "${String(o)}" is not a valid integer`};c=Number.parseInt(f,10)}}let l=c+r,u=this.frontmatterService.updateProperty(i,e.targetProperty,l);return await this.fileWriter.updateFile(t,u),{success:!0}}async executePropertyShift(e,t){if(!e.targetProperty)return{success:!1,error:"property_shift requires targetProperty"};if(!e.shiftDelta)return{success:!1,error:"property_shift requires shiftDelta (ISO-8601 duration literal)"};let r=await this.fileReader.readFile(t),s=(this.frontmatterService.parseObject(r)??{})[e.targetProperty];if(s==null||s==="")return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is not set on target asset`};if(Array.isArray(s))return{success:!1,error:`property_shift: targetProperty "${e.targetProperty}" is an array, expected single datetime`};let o=String(s).replace(/^["'](.*)["']$/,"$1").trim(),c=new Date(o);if(Number.isNaN(c.getTime()))return{success:!1,error:`property_shift: current value "${o}" is not a valid datetime`};let l;try{l=Es.applyIsoDuration(c,e.shiftDelta)}catch(d){return{success:!1,error:`property_shift: invalid shiftDelta "${e.shiftDelta}": ${d instanceof Error?d.message:String(d)}`}}let u=Nw.DateFormatter.toLocalTimestamp(l),f=this.frontmatterService.updateProperty(r,e.targetProperty,u);return await this.fileWriter.updateFile(t,f),{success:!0}}async executeWorkflowTransition(e,t,r,i){if(!this.workflowResolver)return{success:!1,error:"workflow_transition requires WorkflowResolver injection (options.workflowResolver). Wire the plugin/CLI before using this grounding type."};let s=await this.fileReader.readFile(r),o=this.frontmatterService.parseObject(s)??{},c=this.resolveAssetClassFromFrontmatter(o);if(!c)return{success:!1,error:"workflow_transition: target asset has no recognised ems__* class in exo__Instance_class (cannot resolve workflow)."};let l=this.resolveStatusFromFrontmatter(o);if(!l)return{success:!1,error:"workflow_transition: target asset has no parseable ems__Effort_status value (need wikilink to an ems__EffortStatus* asset)."};let u;try{u=new O8.IRI(t)}catch(T){return{success:!1,error:`workflow_transition: invalid targetIRI "${t}" \u2014 ${T instanceof Error?T.message:String(T)}`}}let f=await this.workflowResolver.resolveForAsset(u,c),d=e.direction??"forward",h=d==="rollback",p=f.transitions.find(T=>T.from===l&&T.isRollback===h);if(!p)return{success:!1,error:`workflow_transition: no ${d} transition from "${l}" defined in workflow "${f.name}" (target class: ${c}).`};let y=vr.STATUS_UID_BY_ENUM[p.to];if(!y)return{success:!1,error:`workflow_transition: no UID mapping for destination status "${p.to}" (transition target unreachable).`};let g={id:`${e.id}.statusMutation`,label:`workflow_transition: ${p.from} \u2192 ${p.to}`,type:ci.GroundingType.PROPERTY_SET,targetProperty:"ems__Effort_status",targetValueRef:y},v=await this.executePropertySet(g,t,r,i);if(!v.success)return{success:!1,error:`workflow_transition: status mutation failed \u2014 ${v.error}`};let _=p.postActions??[],S=this.groundingLoader;if(_.length>0&&S===void 0)return{success:!1,error:"workflow_transition: transition has postActions but no GroundingLoader injected (options.groundingLoader). Wire commandResolver.loadGroundingByUid in plugin/CLI."};for(let T of _){if(S===void 0)break;let I=await S(T);if(!I)return{success:!1,error:`workflow_transition: postAction grounding UID "${T}" could not be loaded (asset missing or invalid Grounding shape).`};let A=await this.execute(I,t,r,i);if(!A.success)return{success:!1,error:`workflow_transition: postAction "${I.label}" (UID ${T}) failed \u2014 ${A.error}`}}return{success:!0}}resolveAssetClassFromFrontmatter(e){let t=e.exo__Instance_class;if(t==null)return null;let r=Array.isArray(t)?t:[t],i=new Set(Object.values(Gm.AssetClass));for(let s of r){if(typeof s!="string")continue;let o=s.replace(/^\s*"?\[\[/,"").replace(/\]\]"?\s*$/,""),l=(o.includes("|")?o.split("|")[1]:o).trim();if(i.has(l))return l;let u=o.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(u){let f=vr.CLASS_UID_TO_LABEL[u[1].toLowerCase()];if(f&&i.has(f))return f}}return null}resolveStatusFromFrontmatter(e){let t=e.ems__Effort_status;if(t==null)return null;if(Array.isArray(t)){if(t.length!==1)return null;t=t[0]}let i=String(t).trim().replace(/^["']/,"").replace(/["']$/,"").replace(/^\[\[/,"").replace(/\]\]$/,"");if(/^ems__EffortStatus[A-Za-z]+$/.test(i))return i;if(i.includes("|")){let o=i.split("|")[1].trim();if(/^ems__EffortStatus[A-Za-z]+$/.test(o))return o}let s=i.match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(s){let o=F8[s[1].toLowerCase()];if(o)return o}return null}static applyIsoDuration(e,t){let r=t.trim();if(/^-?P(\d+Y)(\d+M)?$|^-?P\d+M$/.test(r)){let o=aP.DateTimeParsing.parseYearMonthDuration(r),c=new Date(e.getTime());return c.setMonth(c.getMonth()+o),c}let s=aP.DateTimeParsing.parseDayTimeDuration(r);return new Date(e.getTime()+s)}static extractBacklinkTarget(e,t){let r=Es.resolveTargetPath(e,t),i=r.split("/").pop()??r;return Es.UUID_BASENAME_RE.test(i)?i:r}static resolveTargetPath(e,t){if(t)return t.replace(/\.md$/i,"").replace(/^\/+/,"");if(e){let r=e.match(/^obsidian:\/\/vault\/(.+?)(?:\.md)?(?:\?|#|$)/i);if(r&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}}return e}};vr.GroundingExecutor=Wm;Wm.UUID_BASENAME_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;vr.GroundingExecutor=Wm=Es=A8([(0,x8.injectable)(),I8("design:paramtypes",[Object,Object,qm,Function,Object])],Wm)});var fP=w(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});Mw.createVaultFrontmatterClassLabelResolver=M8;function M8(n){return async e=>{if(!e)return null;let t=await n.findFilesByMetadata({exo__Asset_label:e});if(t.length>0){let s=(await n.getFileMetadata(t[0])).exo__Asset_uid;if(typeof s=="string"&&s.length>0)return s}let r=await n.findFilesByMetadata({aliases:e});if(r.length>0){let s=(await n.getFileMetadata(r[0])).exo__Asset_uid;if(typeof s=="string"&&s.length>0)return s}return null}}a(M8,"createVaultFrontmatterClassLabelResolver")});var hP=w(lo=>{"use strict";var j8=lo&&lo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},$8=lo&&lo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},Bl;Object.defineProperty(lo,"__esModule",{value:!0});lo.NamedQueryRunner=void 0;var U8=je(),B8=Oe(),V8=qe(),dP=Fm(),G8=Rp(),jw=Bl=class{static{a(this,"NamedQueryRunner")}constructor(e,t){this.queryBodyResolver=e,this.tripleStore=t}async run(e,t={}){if(!e)return null;let r=await this.queryBodyResolver.resolveSparql(e);if(!r)return null;let i=this.substitute(r,t);return(0,dP.evaluateWithExoEval)(i,{store:this.tripleStore})}async runScalar(e,t={},r){if(!e)throw new Error("NamedQueryRunner.runScalar: empty queryUid");let i=await this.queryBodyResolver.resolveSparql(e);if(!i)throw new Error(`NamedQueryRunner: query__NamedQuery '${e}' has no resolvable SPARQL body (asset missing or no \`\`\`sparql block).`);let s=this.substitute(i,t),o=await(0,dP.evaluateWithExoEval)(s,{store:this.tripleStore});if(o.kind==="ask")return{value:o.result?"true":"false",kind:"literal"};if(o.kind==="construct")return null;let c=o.rows[0];if(!c)return null;let l=c.variables(),u=r??l[0];if(!u)return null;let f=c.get(u);return f===void 0?null:f instanceof B8.IRI?{value:(0,G8.iriToObsidianName)(f.value)??f.value,kind:"iri"}:f instanceof V8.Literal?{value:f.value,kind:"literal"}:null}substitute(e,t){let r=e;t.currentAsset&&(r=r.replace(/\$currentAsset\b/g,Bl.formatIri(t.currentAsset))),t.currentClass&&(r=r.replace(/\$currentClass\b/g,Bl.formatIri(t.currentClass)));let i=t.params;if(i){let s=Object.keys(i).sort((o,c)=>c.length-o.length);for(let o of s){let c=i[o],l=c.kind==="iri"?Bl.formatIri(c.value):`"${Bl.escapeLiteral(c.value)}"`,u=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(`\\$${u}\\b`,"g"),l)}}return r}static formatIri(e){if(/[\s<>"{}|\\^`]/.test(e))throw new Error(`NamedQueryRunner: refusing to inject malformed IRI "${e}" \u2014 contains a character illegal in a SPARQL IRIREF (would break out of <...>). Pass a percent-encoded IRI.`);return`<${e}>`}static escapeLiteral(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}};lo.NamedQueryRunner=jw;lo.NamedQueryRunner=jw=Bl=j8([(0,U8.injectable)(),$8("design:paramtypes",[Object,Object])],jw)});var pP=w(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});zm.extractSparqlBlock=q8;zm.stripFrontmatter=W8;function q8(n){let e=n.match(/```sparql\s*\n([\s\S]*?)\n```/);if(!e)return null;let t=e[1].trim();return t.length>0?t:null}a(q8,"extractSparqlBlock");function W8(n){if(!n.startsWith("---"))return n;let e=n.indexOf(`
92
+ ---`,3);return e<0?n:n.slice(e+4)}a(W8,"stripFrontmatter")});var mP=w(uo=>{"use strict";var z8=uo&&uo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},H8=uo&&uo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},$w;Object.defineProperty(uo,"__esModule",{value:!0});uo.CommandExecutionFlow=void 0;var K8=je(),Q8=Vo(),X8=Oe(),Y8=qe(),J8=Jt(),Z8=kn(),Uw=$w=class{static{a(this,"CommandExecutionFlow")}constructor(e,t,r,i,s,o){this.groundingExecutor=e,this.notificationService=t,this.logger=r,this.prompts=i,this.tripleStore=s,this.fileOpener=o}async run(e,t){let{command:r}=e;if(r.confirmMessage&&!await this.prompts.confirm(r.confirmMessage))return;let i=t.injectedUserInput,s=$w.extractInputSchema(e);if(s!==null&&s.length>0){let l=await this.applyLabelDatePrefill(s,r.grounding,t.targetIRI),u=await this.prompts.promptInputSchema(l);if(u===null)return;i={...t.injectedUserInput??{},...u}}let o=await this.groundingExecutor.execute(r.grounding,t.targetIRI??"",t.filePath??"",i),c=t.filePath??"<no-file>";if(o.success){if(r.successMessage&&this.notificationService.success(r.successMessage),await new Promise(l=>setTimeout(l,100)),t.onComplete&&await t.onComplete(),o.openPath&&this.fileOpener)try{await this.fileOpener.open(o.openPath,{sameTab:r.openInSameTab})}catch(l){this.logger.info(`[CommandExecutionFlow] Failed to open created file "${o.openPath}": ${l instanceof Error?l.message:String(l)}`)}this.logger.info(`[CommandExecutionFlow] Executed "${r.name}" on ${c}`)}else this.notificationService.error(`Command failed: ${o.error??"unknown error"}`),this.logger.info(`[CommandExecutionFlow] Failed "${r.name}": ${o.error}`)}static extractInputSchema(e){let r=e.command.grounding.inputSchema;return!r||!Array.isArray(r)?null:r}async applyLabelDatePrefill(e,t,r){if(t.type!==Q8.GroundingType.CREATE_INSTANCE||!t.prefillLabelWithDate||!r||!this.tripleStore)return e;let i=await this.resolveAssetLabel(r);if(!i)return e;let s=Z8.DateFormatter.toDateString(new Date),o=`${i} ${s}`;return e.map(c=>{if(typeof c!="object"||c===null)return c;let l=c;if(l.name!=="label")return c;let u=l.defaultValue;return typeof u=="string"&&u.length>0?c:{...l,defaultValue:o}})}async resolveAssetLabel(e){if(!this.tripleStore)return;let t=new X8.IRI(e),r=await this.tripleStore.match(t,J8.Namespace.EXO.term("Asset_label"),void 0);if(r.length===0)return;let i=r[0].object;if(i instanceof Y8.Literal)return i.value.length>0?i.value:void 0}};uo.CommandExecutionFlow=Uw;uo.CommandExecutionFlow=Uw=$w=z8([(0,K8.injectable)(),H8("design:paramtypes",[Function,Object,Object,Object,Object,Object])],Uw)});var Xf=w(fo=>{"use strict";var eU=fo&&fo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},tU=fo&&fo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(fo,"__esModule",{value:!0});fo.WorkflowEngine=void 0;var rU=je(),Bw=class{static{a(this,"WorkflowEngine")}constructor(e){this.definition=e}getAvailableTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&!t.isRollback)}getRollbackTransitions(e){return this.definition.transitions.filter(t=>t.from===e&&t.isRollback)}getAllTransitions(e){return this.definition.transitions.filter(t=>t.from===e)}canTransition(e,t){return this.definition.transitions.some(r=>r.from===e&&r.to===t)}getPreviousStatus(e){return this.definition.transitions.find(r=>r.from===e&&r.isRollback)?.to??null}getNextStates(e){return this.getAvailableTransitions(e).map(t=>t.to)}isTerminalState(e){return this.definition.terminalStates.includes(e)}isInitialState(e){return this.definition.initialState===e}getTimestampsForStatus(e){return this.definition.states.find(r=>r.status===e)?.timestampOnEnter??[]}getTransition(e,t){return this.definition.transitions.find(r=>r.from===e&&r.to===t)}getOrderedStates(){return this.definition.states.map(e=>e.status)}getDefinition(){return this.definition}validate(){let e=[],t=new Set(this.definition.states.map(i=>i.status));this.definition.states.length===0&&e.push("Workflow must have at least one state"),t.has(this.definition.initialState)||e.push(`Initial state "${this.definition.initialState}" is not in the states list`);for(let i of this.definition.terminalStates)t.has(i)||e.push(`Terminal state "${i}" is not in the states list`);for(let i of this.definition.transitions)t.has(i.from)||e.push(`Transition "${i.label}" references unknown source state "${i.from}"`),t.has(i.to)||e.push(`Transition "${i.label}" references unknown target state "${i.to}"`);for(let i of this.definition.states){if(this.definition.terminalStates.includes(i.status))continue;this.definition.transitions.filter(o=>o.from===i.status&&!o.isRollback).length===0&&e.push(`State "${i.status}" has no outgoing forward transitions (dead end)`)}let r=new Set;for(let i of this.definition.transitions){let s=`${i.from}\u2192${i.to}`;r.has(s)&&e.push(`Duplicate transition: ${s}`),r.add(s)}return{valid:e.length===0,errors:e}}};fo.WorkflowEngine=Bw;fo.WorkflowEngine=Bw=eU([(0,rU.injectable)(),tU("design:paramtypes",[Object])],Bw)});var gP=w(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.EFFORT_WORKFLOW_PROPERTY=Ts.WorkflowTransitionProperty=Ts.WorkflowStateProperty=Ts.WorkflowProperty=void 0;Ts.WorkflowProperty={TARGET_CLASS:"ems__Workflow_targetClass",INITIAL_STATE:"ems__Workflow_initialState",TERMINAL_STATES:"ems__Workflow_terminalStates",IS_DEFAULT:"ems__Workflow_isDefault"};Ts.WorkflowStateProperty={WORKFLOW:"ems__WorkflowState_workflow",STATUS:"ems__WorkflowState_status",ORDER:"ems__WorkflowState_order",OPTIONAL:"ems__WorkflowState_optional",TIMESTAMP_ON_ENTER:"ems__WorkflowState_timestampOnEnter",BADGE_COLOR:"ems__WorkflowState_badgeColor"};Ts.WorkflowTransitionProperty={WORKFLOW:"ems__WorkflowTransition_workflow",FROM:"ems__WorkflowTransition_from",TO:"ems__WorkflowTransition_to",LABEL:"ems__WorkflowTransition_label",ICON:"ems__WorkflowTransition_icon",IS_ROLLBACK:"ems__WorkflowTransition_isRollback"};Ts.EFFORT_WORKFLOW_PROPERTY="ems__Effort_workflow"});var ho=w(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});Hm.MetadataHelpers=void 0;var yP=Hf(),Vw=class{static{a(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=(0,yP.orderProperties)(e,(0,yP.loadDefaultSpec)()),i=Object.entries(r).map(([c,l])=>{if(Array.isArray(l)){let u=l.map(f=>` - ${String(f)}`).join(`
93
93
  `);return`${c}:
94
94
  ${u}`}return`${c}: ${String(l)}`}).join(`
95
95
  `),s=t;if(s===void 0){let c=r.exo__Asset_label;typeof c=="string"&&c.trim()!==""&&(s=`# ${c}`)}let o=s?`
@@ -98,7 +98,7 @@ ${s}
98
98
  `;return`---
99
99
  ${i}
100
100
  ---
101
- ${o}`}};Hm.MetadataHelpers=Vw});var _P=w(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.TASK_DEFAULT_WORKFLOW=fc.PROJECT_DEFAULT_WORKFLOW=void 0;fc.buildWorkflowAssetContent=nU;var bP=Ai(),Yf=Jc(),Le=Zc(),Qr=gP(),Gw=ho();fc.PROJECT_DEFAULT_WORKFLOW={id:"a1b2c3d4-1111-4000-a000-000000000001",name:"Project Default Workflow",targetClass:Yf.AssetClass.PROJECT,initialState:Le.EffortStatus.DRAFT,terminalStates:[Le.EffortStatus.DONE,Le.EffortStatus.TRASHED],isDefault:!0,states:[{status:Le.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:Le.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:Le.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:Le.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:Le.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:Le.EffortStatus.DRAFT,to:Le.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:Le.EffortStatus.ANALYSIS,to:Le.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:Le.EffortStatus.TODO,to:Le.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:Le.EffortStatus.ANALYSIS,to:Le.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:Le.EffortStatus.TODO,to:Le.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:Le.EffortStatus.DONE,to:Le.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};fc.TASK_DEFAULT_WORKFLOW={id:"a1b2c3d4-2222-4000-a000-000000000002",name:"Task Default Workflow",targetClass:Yf.AssetClass.TASK,initialState:Le.EffortStatus.DRAFT,terminalStates:[Le.EffortStatus.DONE,Le.EffortStatus.TRASHED],isDefault:!0,states:[{status:Le.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:Le.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:Le.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:Le.EffortStatus.DRAFT,to:Le.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:Le.EffortStatus.DONE,to:Le.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};function nU(n){let e=new Date().toISOString(),t=[],r=n.id,i={exo__Asset_uid:r,exo__Asset_label:`"${n.name}"`,exo__Asset_createdAt:e,exo__Instance_class:Yf.AssetClass.WORKFLOW,[Qr.WorkflowProperty.TARGET_CLASS]:`"[[${n.targetClass}]]"`,[Qr.WorkflowProperty.INITIAL_STATE]:`"[[${n.initialState}]]"`,[Qr.WorkflowProperty.TERMINAL_STATES]:n.terminalStates.map(s=>`"[[${s}]]"`),[Qr.WorkflowProperty.IS_DEFAULT]:n.isDefault};t.push({filename:`${r}.md`,content:Gw.MetadataHelpers.buildFileContent(i)});for(let s of n.states){let o=(0,bP.v4)(),c={exo__Asset_uid:o,exo__Asset_label:`"${n.name} - ${s.status}"`,exo__Asset_createdAt:e,exo__Instance_class:Yf.AssetClass.WORKFLOW_STATE,[Qr.WorkflowStateProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowStateProperty.STATUS]:`"[[${s.status}]]"`,[Qr.WorkflowStateProperty.ORDER]:s.order,[Qr.WorkflowStateProperty.OPTIONAL]:s.optional};s.timestampOnEnter.length>0&&(c[Qr.WorkflowStateProperty.TIMESTAMP_ON_ENTER]=s.timestampOnEnter),s.badgeColor&&(c[Qr.WorkflowStateProperty.BADGE_COLOR]=`"${s.badgeColor}"`),t.push({filename:`${o}.md`,content:Gw.MetadataHelpers.buildFileContent(c)})}for(let s of n.transitions){let o=(0,bP.v4)(),c={exo__Asset_uid:o,exo__Asset_label:`"${n.name} - ${s.label}"`,exo__Asset_createdAt:e,exo__Instance_class:Yf.AssetClass.WORKFLOW_TRANSITION,[Qr.WorkflowTransitionProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowTransitionProperty.FROM]:`"[[${s.from}]]"`,[Qr.WorkflowTransitionProperty.TO]:`"[[${s.to}]]"`,[Qr.WorkflowTransitionProperty.LABEL]:`"${s.label}"`,[Qr.WorkflowTransitionProperty.IS_ROLLBACK]:s.isRollback};s.icon&&(c[Qr.WorkflowTransitionProperty.ICON]=`"${s.icon}"`),t.push({filename:`${o}.md`,content:Gw.MetadataHelpers.buildFileContent(c)})}return t}a(nU,"buildWorkflowAssetContent")});var Ww=w(po=>{"use strict";var iU=po&&po.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},sU=po&&po.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(po,"__esModule",{value:!0});po.WorkflowResolver=void 0;var oU=je(),Vl=Oe(),Xr=qe(),vt=Jt(),dc=Jc(),Km=Zc(),SP=_P(),qw=class{static{a(this,"WorkflowResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async resolveForClass(e){let t=`class:${e}`,r=this.cache.get(t);if(r)return r;let s=await this.findDefaultWorkflow(e)??this.getHardcodedFallback(e);return this.cache.set(t,s),s}async resolveForAsset(e,t){let r=await this.tripleStore.match(e,vt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof Vl.IRI){let s=await this.loadWorkflowBySubject(i);if(s)return s}}return this.resolveForClass(t)}invalidateCache(){this.cache.clear()}async findDefaultWorkflow(e){let t=await this.tripleStore.match(void 0,vt.Namespace.RDF.term("type"),vt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,vt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof Vl.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof Xr.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,vt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof Xr.Literal?u.object.value:"";return f==="true"||f==="1"})))return this.loadWorkflowBySubject(i)}return null}async loadWorkflowBySubject(e){let t=await this.tripleStore.match(e,vt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof Xr.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,vt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof Xr.Literal?i[0].object.value:e.value,o=await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(o),l=await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??Km.EffortStatus.DRAFT,f=await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_terminalStates"),void 0),d=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(v=>{let _=v.object instanceof Xr.Literal?v.object.value:"";return _==="true"||_==="1"}),y=await this.loadStates(e),g=await this.loadTransitions(e);return y.length===0&&g.length===0?null:{id:s,name:r,targetClass:c,states:y,transitions:g,initialState:u,terminalStates:d.length>0?d:[Km.EffortStatus.DONE,Km.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,vt.Namespace.RDF.term("type"),vt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(S=>this.isSameSubject(S.object,e)))continue;let l=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_order"),void 0),d=f.length>0&&f[0].object instanceof Xr.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(S=>{let T=S.object instanceof Xr.Literal?S.object.value:"";return T==="true"||T==="1"}),g=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(S=>S.object instanceof Xr.Literal?S.object.value:"").filter(S=>S.length>0),v=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),_=v.length>0&&v[0].object instanceof Xr.Literal?v[0].object.value:void 0;r.push({status:u,order:d,optional:p,timestampOnEnter:g,badgeColor:_})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,vt.Namespace.RDF.term("type"),vt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(I=>this.isSameSubject(I.object,e)))continue;let l=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_to"),void 0),d=this.resolveEffortStatus(f);if(!u||!d)continue;let h=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=h.length>0&&h[0].object instanceof Xr.Literal?h[0].object.value:`${u} \u2192 ${d}`,y=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),g=y.length>0&&y[0].object instanceof Xr.Literal?y[0].object.value:void 0,_=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(I=>{let A=I.object instanceof Xr.Literal?I.object.value:"";return A==="true"||A==="1"}),T=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_postActions"),void 0)).map(I=>this.extractUid(I.object)).filter(I=>I!==null);r.push({from:u,to:d,label:p,icon:g,isRollback:_,postActions:T.length>0?T:void 0})}return r}extractUid(e){let t=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i,r=e instanceof Vl.IRI||e instanceof Xr.Literal?e.value:null;if(r===null)return null;let i=r.match(t);return i?i[1].toLowerCase():null}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return dc.AssetClass.TASK;let t=e[0].object;if(t instanceof Vl.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(dc.AssetClass).includes(i)?i:dc.AssetClass.TASK}if(t instanceof Xr.Literal){let r=this.normalizeWikilink(t.value);return Object.values(dc.AssetClass).includes(r)?r:dc.AssetClass.TASK}return dc.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof Vl.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof Xr.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(Km.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof Vl.IRI)return e.value===t.value;if(e instanceof Xr.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===dc.AssetClass.PROJECT?{...SP.PROJECT_DEFAULT_WORKFLOW}:{...SP.TASK_DEFAULT_WORKFLOW}}};po.WorkflowResolver=qw;po.WorkflowResolver=qw=iU([(0,oU.injectable)(),sU("design:paramtypes",[Object])],qw)});var Qw=w(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.TransactionError=ia.TripleNotFoundError=ia.TripleAlreadyExistsError=void 0;var zw=class extends Error{static{a(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};ia.TripleAlreadyExistsError=zw;var Hw=class extends Error{static{a(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};ia.TripleNotFoundError=Hw;var Kw=class extends Error{static{a(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};ia.TransactionError=Kw});var Xm=w(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.LRUCache=void 0;var Xw=class{static{a(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}};Qm.LRUCache=Xw});var Zw=w(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.InMemoryTripleStore=void 0;var sa=Qw(),Ym=Oe(),aU=Bt(),cU=qe(),lU=Jt(),uU=Xm(),fU=lU.Namespace.XSD.term("string").value,dU=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,Gl="__default__",Yw=class n{static{a(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 uU.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 o;return!e&&!t&&!r?o=Array.from(this.triples.values()):e&&t&&r?o=this.matchSPO(e,t,r):e&&t?o=this.matchSP(e,t):e&&r?o=this.matchSO(e,r):t&&r?o=this.matchPO(t,r):e?o=this.matchS(e):t?o=this.matchP(t):r?o=this.matchO(r):o=[],this.queryCache.set(i,o),o}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 Jw(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 Ym.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof Ym.IRI))return;let t=e.value,r=t.match(dU);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),o=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(o)){let u=this.buildTripleKey(i,s,o),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 o=s.get(i);return o?this.getTriplesByKeys(Array.from(o).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 o=s.get(i);return o?this.getTriplesByKeys(Array.from(o).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 o=s.get(i);return o?this.getTriplesByKeys(Array.from(o).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,o]of r.entries())for(let c of o)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,o]of r.entries())for(let c of o)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,o]of r.entries())for(let c of o)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 o=s.get(r);o&&(o.delete(i),o.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 Ym.IRI)return`i:${e.value}`;if(e instanceof aU.BlankNode)return`b:${e.id}`;if(e instanceof cU.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==fU?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):"?",o=r?this.getNodeKey(r):"?";return`${i}|${s}|${o}`}getGraphKey(e){return e?e.value:Gl}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===Gl?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===Gl)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===Gl)return this.match(e,t,r);let o=this.namedGraphs.get(s);return o?o.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new Ym.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===Gl){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===Gl)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Jm.InMemoryTripleStore=Yw;var Jw=class{static{a(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.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 sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var eg=w(mo=>{"use strict";var hU=mo&&mo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},pU=mo&&mo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(mo,"__esModule",{value:!0});mo.EffortStatusWorkflow=void 0;var mU=je(),Zm=qo(),gU=Xf(),yU=Ww(),bU=Zw(),e1=class{static{a(this,"EffortStatusWorkflow")}constructor(){this.resolver=new yU.WorkflowResolver(new bU.InMemoryTripleStore)}setResolver(e){this.resolver=e}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new gU.WorkflowEngine(i);if(s.isInitialState(r))return null;let o=s.getPreviousStatus(r);if(o!==null)return this.wrapStatus(o)}normalizeStatus(e){return e.replace(/["'[\]]/g,"").trim()}wrapStatus(e){return`"[[${e}]]"`}resolveDefinition(e){return this.hasInstanceClass(e,Zm.AssetClass.TASK)||this.hasInstanceClass(e,Zm.AssetClass.MEETING)?this.resolver.getHardcodedFallback(Zm.AssetClass.TASK):this.resolver.getHardcodedFallback(Zm.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};mo.EffortStatusWorkflow=e1;mo.EffortStatusWorkflow=e1=hU([(0,mU.injectable)(),pU("design:paramtypes",[])],e1)});var qt=w(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});tg.DI_TOKENS=void 0;tg.DI_TOKENS={IFileSystemAdapter:Symbol.for("IFileSystemAdapter"),IVaultAdapter:Symbol.for("IVaultAdapter"),IVaultContext:Symbol.for("IVaultContext"),IMultiVaultManager:Symbol.for("IMultiVaultManager"),ILogger:Symbol.for("ILogger"),IEventBus:Symbol.for("IEventBus"),IConfiguration:Symbol.for("IConfiguration"),INotificationService:Symbol.for("INotificationService"),AreaCreationService:Symbol.for("AreaCreationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),SupervisionCreationService:Symbol.for("SupervisionCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),DynamicFrontmatterGenerator:Symbol.for("DynamicFrontmatterGenerator"),AlgorithmExtractor:Symbol.for("AlgorithmExtractor"),TaskStatusService:Symbol.for("TaskStatusService"),EffortStatusWorkflow:Symbol.for("EffortStatusWorkflow"),StatusTimestampService:Symbol.for("StatusTimestampService"),PropertyCleanupService:Symbol.for("PropertyCleanupService"),FolderRepairService:Symbol.for("FolderRepairService"),RenameToUidService:Symbol.for("RenameToUidService"),PlanningService:Symbol.for("PlanningService"),EffortVotingService:Symbol.for("EffortVotingService"),SessionEventService:Symbol.for("SessionEventService"),CriticalityZoneService:Symbol.for("CriticalityZoneService"),AssetConversionService:Symbol.for("AssetConversionService"),NoteToRDFConverter:Symbol.for("NoteToRDFConverter"),IVaultSettings:Symbol.for("IVaultSettings"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),URIConstructionService:Symbol.for("URIConstructionService"),ClassHierarchyResolver:Symbol.for("ClassHierarchyResolver")}});var rg=w(Ci=>{"use strict";var _U=Ci&&Ci.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},SU=Ci&&Ci.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},wU=Ci&&Ci.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.StatusTimestampService=void 0;var wP=je(),vU=vs(),ql=kn(),EU=qt(),t1=class{static{a(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new vU.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=ql.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_startTimestamp",r);await this.vault.modify(e,i)}async addEndTimestamp(e,t){let r=await this.vault.read(e),i=t||new Date,s=ql.DateFormatter.toLocalTimestamp(i),o=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);await this.vault.modify(e,o)}async addResolutionTimestamp(e){let t=await this.vault.read(e),r=ql.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_resolutionTimestamp",r);await this.vault.modify(e,i)}async addReviewTimestamp(e){let t=await this.vault.read(e),r=ql.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_lastReviewTimestamp",r);await this.vault.modify(e,i)}async addEndAndResolutionTimestamps(e,t){let r=await this.vault.read(e),i=t||new Date,s=ql.DateFormatter.toLocalTimestamp(i),o=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);o=this.frontmatterService.updateProperty(o,"ems__Effort_resolutionTimestamp",s),await this.vault.modify(e,o)}async removeStartTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_startTimestamp");await this.vault.modify(e,r)}async removeEndTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");await this.vault.modify(e,r)}async removeResolutionTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_resolutionTimestamp");await this.vault.modify(e,r)}async removeEndAndResolutionTimestamps(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");r=this.frontmatterService.removeProperty(r,"ems__Effort_resolutionTimestamp"),await this.vault.modify(e,r)}async shiftPlannedEndTimestamp(e,t){let r=await this.vault.read(e),i=this.frontmatterService.parse(r);if(!i.exists)return;let s=this.frontmatterService.getPropertyValue(i.content,"ems__Effort_plannedEndTimestamp");if(!s)return;let o=new Date(s.replace(/["']/g,""));if(isNaN(o.getTime()))return;let c=new Date(o.getTime()+t),l=ql.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};Ci.StatusTimestampService=t1;Ci.StatusTimestampService=t1=_U([(0,wP.injectable)(),wU(0,(0,wP.inject)(EU.DI_TOKENS.IVaultAdapter)),SU("design:paramtypes",[Object])],t1)});var n1=w(Oi=>{"use strict";var TU=Oi&&Oi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},AU=Oi&&Oi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},IU=Oi&&Oi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.TaskStatusService=void 0;var vP=je(),xU=vs(),RU=kn(),PU=eg(),CU=rg(),OU=qt(),r1=class{static{a(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.timestampService=r,this.frontmatterService=new xU.FrontmatterService}async syncEffortEndTimestamp(e,t){await this.timestampService.addEndAndResolutionTimestamps(e,t)}async shiftPlannedEndTimestamp(e,t){await this.timestampService.shiftPlannedEndTimestamp(e,t)}async planForEvening(e){let t=await this.vault.read(e),r=new Date;r.setHours(19,0,0,0);let i=RU.DateFormatter.toLocalTimestamp(r),s=this.frontmatterService.updateProperty(t,"ems__Effort_plannedStartTimestamp",i);await this.vault.modify(e,s)}};Oi.TaskStatusService=r1;Oi.TaskStatusService=r1=TU([(0,vP.injectable)(),IU(0,(0,vP.inject)(OU.DI_TOKENS.IVaultAdapter)),AU("design:paramtypes",[Object,PU.EffortStatusWorkflow,CU.StatusTimestampService])],r1)});var s1=w(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});ng.MetadataExtractor=void 0;var DU=ho(),i1=class{static{a(this,"MetadataExtractor")}constructor(e){this.vault=e}extractMetadata(e){return e?this.vault.getFrontmatter(e)||{}:{}}extractInstanceClass(e){return e.exo__Instance_class||null}extractStatus(e){return e.ems__Effort_status||null}extractIsArchived(e){return DU.MetadataHelpers.isAssetArchived(e)}static extractIsDefinedBy(e){let t=e.exo__Asset_isDefinedBy||'""';return Array.isArray(t)&&(t=t[0]||'""'),String(t)}extractExpectedFolder(e){let t=e.exo__Asset_isDefinedBy;if(!t)return null;let r=Array.isArray(t)?t[0]:t;if(!r||typeof r!="string")return null;let i=r.replace(/["'[\]]/g,"").trim();if(!i)return null;let s=i.split("/");return s.pop(),s.join("/")}extractCommandVisibilityContext(e){let t=this.extractMetadata(e),r=this.extractInstanceClass(t),i=this.extractStatus(t),s=this.extractIsArchived(t),o=e.parent?.path||"",c=this.extractExpectedFolder(t);return{instanceClass:r,currentStatus:i,metadata:t,isArchived:s,currentFolder:o,expectedFolder:c}}extractCache(e){return e?this.vault.getFrontmatter(e):null}};ng.MetadataExtractor=i1});var a1=w(Di=>{"use strict";var FU=Di&&Di.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},LU=Di&&Di.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},NU=Di&&Di.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Di,"__esModule",{value:!0});Di.AreaCreationService=void 0;var EP=je(),TP=Ai(),kU=qo(),MU=kn(),jU=s1(),AP=ho(),$U=qt(),o1=class{static{a(this,"AreaCreationService")}constructor(e){this.vault=e}async createChildArea(e,t,r){let i=(0,TP.v4)(),s=`${i}.md`,o=this.generateChildAreaFrontmatter(t,e.basename,r,i),c=AP.MetadataHelpers.buildFileContent(o),l=e.parent?.path||"",u=l?`${l}/${s}`:s;return await this.vault.create(u,c)}generateChildAreaFrontmatter(e,t,r,i){let s=new Date,o=MU.DateFormatter.toLocalTimestamp(s),c=jU.MetadataExtractor.extractIsDefinedBy(e),l={};if(l.exo__Asset_isDefinedBy=AP.MetadataHelpers.ensureQuoted(c),l.exo__Asset_uid=i||(0,TP.v4)(),l.exo__Asset_createdAt=o,l.exo__Instance_class=[`"[[${kU.AssetClass.AREA}]]"`],l.ems__Area_parent=`"[[${t}]]"`,r&&r.trim()!==""){let u=r.trim();l.exo__Asset_label=u,l.aliases=[u]}return l}};Di.AreaCreationService=o1;Di.AreaCreationService=o1=FU([(0,EP.injectable)(),NU(0,(0,EP.inject)($U.DI_TOKENS.IVaultAdapter)),LU("design:paramtypes",[Object])],o1)});var l1=w(Fi=>{"use strict";var UU=Fi&&Fi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},BU=Fi&&Fi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},VU=Fi&&Fi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.AreaHierarchyBuilder=void 0;var IP=je(),xP=qo(),GU=qt(),ig=Zs(),c1=class{static{a(this,"AreaHierarchyBuilder")}constructor(e){this.vault=e}buildHierarchy(e,t){let r=this.vault.getAbstractFileByPath(e);if(!this.isFile(r))return null;let i=this.vault.getFrontmatter(r)||{};if(this.extractInstanceClass(i)!==xP.AssetClass.AREA)return null;let o=this.collectAllAreasFromVault(),c=new Set;return this.buildTree(e,o,c,0)}isFile(e){return!!e&&typeof e=="object"&&"basename"in e&&"path"in e}extractInstanceClass(e){let t=e.exo__Instance_class||"";return Array.isArray(t)?ig.WikiLinkHelpers.normalize(String(t[0]||"")):ig.WikiLinkHelpers.normalize(String(t))}collectAllAreasFromVault(){let e=new Map,t=new Map,r=this.vault.getAllFiles();for(let i of r){let s=this.vault.getFrontmatter(i)||{};if(this.extractInstanceClass(s)===xP.AssetClass.AREA){let c=this.extractParentPath(s);e.set(i.path,{path:i.path,title:i.basename,label:s.exo__Asset_label||void 0,isArchived:this.isArchived(s),depth:0,parentPath:c||void 0}),t.set(i.basename,i.path)}}for(let[,i]of e.entries())i.parentPath&&t.has(i.parentPath)&&(i.parentPath=t.get(i.parentPath));return e}extractParentPath(e){let t=e.ems__Area_parent;if(!t)return null;if(Array.isArray(t)){let r=t[0]||"";return ig.WikiLinkHelpers.normalize(String(r))}return ig.WikiLinkHelpers.normalize(String(t))}isArchived(e){let t=e.exo__Asset_archived;if(t===!0||t==="true")return!0;if(Array.isArray(t)&&t.length>0){let r=t[0];return r===!0||r==="true"}return!1}buildTree(e,t,r,i){if(r.has(e))return null;r.add(e);let s=t.get(e);if(!s)return null;let o=[];for(let[c,l]of t.entries())if(l.parentPath===e){let u=this.buildTree(c,t,r,i+1);u&&o.push(u)}return o.sort((c,l)=>{let u=c.label||c.title,f=l.label||l.title;return u.localeCompare(f)}),{path:s.path,title:s.title,label:s.label,isArchived:s.isArchived,depth:i,parentPath:s.parentPath,children:o}}};Fi.AreaHierarchyBuilder=c1;Fi.AreaHierarchyBuilder=c1=UU([(0,IP.injectable)(),VU(0,(0,IP.inject)(GU.DI_TOKENS.IVaultAdapter)),BU("design:paramtypes",[Object])],c1)});var f1=w(Li=>{"use strict";var qU=Li&&Li.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},WU=Li&&Li.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},zU=Li&&Li.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Li,"__esModule",{value:!0});Li.ClassCreationService=void 0;var RP=je(),HU=Ai(),KU=kn(),QU=ho(),XU=qt(),u1=class{static{a(this,"ClassCreationService")}constructor(e){this.vault=e}async createSubclass(e,t,r){let i=(0,HU.v4)(),s=this.generateFileName(t),o=s.endsWith(".md")?s:`${s}.md`,c=this.generateClassFrontmatter(e.basename,t,i,r),l=QU.MetadataHelpers.buildFileContent(c),u="classes",f=`${u}/${o}`;return this.vault.getAbstractFileByPath(u)||await this.vault.createFolder(u),await this.vault.create(f,l)}generateFileName(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-");for(;t.startsWith("-");)t=t.slice(1);for(;t.endsWith("-");)t=t.slice(0,-1);return t}generateClassFrontmatter(e,t,r,i){let s=new Date,o=KU.DateFormatter.toLocalTimestamp(s),c={};c.exo__Asset_uid=r,c.exo__Asset_label=t,c.exo__Asset_createdAt=o,c.exo__Instance_class=['"[[exo__Class]]"'],c.exo__Class_superClass=`"[[${e}]]"`;let l=i.exo__Asset_isDefinedBy||'"[[Ontology/EXO]]"';return c.exo__Asset_isDefinedBy=l,c.aliases=[t],c}};Li.ClassCreationService=u1;Li.ClassCreationService=u1=qU([(0,RP.injectable)(),zU(0,(0,RP.inject)(XU.DI_TOKENS.IVaultAdapter)),WU("design:paramtypes",[Object])],u1)});var h1=w(Ni=>{"use strict";var YU=Ni&&Ni.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},JU=Ni&&Ni.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},ZU=Ni&&Ni.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ConceptCreationService=void 0;var PP=je(),eB=Ai(),tB=kn(),rB=ho(),nB=qo(),iB=qt(),d1=class{static{a(this,"ConceptCreationService")}constructor(e){this.vault=e}async createNarrowerConcept(e,t,r,i){let s=(0,eB.v4)(),o=t.endsWith(".md")?t:`${t}.md`,c=this.generateConceptFrontmatter(e.basename,r,i,s),l=rB.MetadataHelpers.buildFileContent(c),u="concepts",f=`${u}/${o}`;return this.vault.getAbstractFileByPath(u)||await this.vault.createFolder(u),await this.vault.create(f,l)}generateConceptFrontmatter(e,t,r,i){let s=new Date,o=tB.DateFormatter.toLocalTimestamp(s),c={};return c.exo__Asset_isDefinedBy='"[[!concepts]]"',c.exo__Asset_uid=i,c.exo__Asset_createdAt=o,c.exo__Instance_class=[`"[[${nB.AssetClass.CONCEPT}]]"`],c.ims__Concept_broader=`"[[${e}]]"`,c.ims__Concept_definition=t,r.length>0&&(c.aliases=r),c}};Ni.ConceptCreationService=d1;Ni.ConceptCreationService=d1=YU([(0,PP.injectable)(),ZU(0,(0,PP.inject)(iB.DI_TOKENS.IVaultAdapter)),JU("design:paramtypes",[Object])],d1)});var CP=w(yo=>{"use strict";var sB=yo&&yo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},oB=yo&&yo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(yo,"__esModule",{value:!0});yo.InstantiationRuleResolver=void 0;var aB=je(),p1=Oe(),Wl=qe(),go=Jt(),m1=class{static{a(this,"InstantiationRuleResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async getRule(e){let t=this.cache.get(e);if(t!==void 0)return t;let r=await this.findRuleForClass(e);return this.cache.set(e,r),r}invalidateCache(){this.cache.clear()}async findRuleForClass(e){let t=await this.tripleStore.match(void 0,go.Namespace.RDF.term("type"),go.Namespace.EXO.term("InstantiationRule"));for(let r of t){let i=r.subject;if((await this.tripleStore.match(i,go.Namespace.EXO.term("rule_targetClass"),void 0)).some(c=>this.matchesTargetClass(c.object,e)))return this.loadRule(i)}return null}async loadRule(e){let t=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_prototypeUID"),void 0),r=t.length>0&&t[0].object instanceof Wl.Literal?t[0].object.value:null,i=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_defaultFolder"),void 0),s=i.length>0&&i[0].object instanceof Wl.Literal?i[0].object.value:null,o=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_propertySetRules"),void 0),c=[];for(let l of o){let u=l.object;if(!(u instanceof p1.IRI))continue;let f=await this.loadPropertySetRule(u);f&&c.push(f)}return{prototypeUID:r,defaultFolder:s,propertySetRules:c}}async loadPropertySetRule(e){let t=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_property"),void 0);if(t.length===0)return null;let r=t[0].object,i=r instanceof p1.IRI?this.extractLocalName(r):r instanceof Wl.Literal?this.normalizeWikilink(r.value):null;if(!i)return null;let s=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_value"),void 0),o=s.length>0&&s[0].object instanceof Wl.Literal?s[0].object.value:"",c=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_valueType"),void 0),l=c.length>0&&c[0].object instanceof Wl.Literal?c[0].object.value:"literal";return{property:i,value:o,valueType:l}}matchesTargetClass(e,t){return e instanceof p1.IRI?this.extractLocalName(e)===t:e instanceof Wl.Literal?this.normalizeWikilink(e.value)===t:!1}extractLocalName(e){let t=e.value,r=t.lastIndexOf("#");if(r>=0){let s=t.substring(r+1);return t.includes("/ems#")?`ems__${s}`:t.includes("/exo#")?`exo__${s}`:t.includes("/ims#")?`ims__${s}`:s}let i=t.lastIndexOf("/");return i>=0?t.substring(i+1):t}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}};yo.InstantiationRuleResolver=m1;yo.InstantiationRuleResolver=m1=sB([(0,aB.injectable)(),oB("design:paramtypes",[Object])],m1)});var OP=w(bo=>{"use strict";var cB=bo&&bo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},lB=bo&&bo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(bo,"__esModule",{value:!0});bo.VisibilityGenerator=void 0;var uB=je(),fB=Xf(),g1=class{static{a(this,"VisibilityGenerator")}constructor(e){this.engine=e}getVisibleCommands(e){return this.engine.getAllTransitions(e).map(t=>this.toCommand(t))}getForwardCommands(e){return this.engine.getAvailableTransitions(e).map(t=>this.toCommand(t))}getRollbackCommands(e){return this.engine.getRollbackTransitions(e).map(t=>this.toCommand(t))}toCommand(e){let t=e.from.replace("ems__EffortStatus","").toLowerCase(),r=e.to.replace("ems__EffortStatus","").toLowerCase();return{commandId:`workflow-${t}-to-${r}`,label:e.label,icon:e.icon,targetStatus:e.to,isRollback:e.isRollback}}};bo.VisibilityGenerator=g1;bo.VisibilityGenerator=g1=cB([(0,uB.injectable)(),lB("design:paramtypes",[fB.WorkflowEngine])],g1)});var DP=w(_o=>{"use strict";var dB=_o&&_o.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},hB=_o&&_o.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(_o,"__esModule",{value:!0});_o.WorkflowCommandAdapter=void 0;var pB=je(),y1=Vo(),mB=Xf(),b1=class{static{a(this,"WorkflowCommandAdapter")}constructor(e){this.workflow=e,this.engine=new mB.WorkflowEngine(e)}adaptTransitions(e){return this.engine.getAllTransitions(e).map(r=>this.transitionToCommand(r))}adaptForwardTransitions(e){return this.engine.getAvailableTransitions(e).map(r=>this.transitionToCommand(r))}adaptRollbackTransitions(e){return this.engine.getRollbackTransitions(e).map(r=>this.transitionToCommand(r))}getEngine(){return this.engine}getWorkflow(){return this.workflow}transitionToCommand(e){let t=this.generateCommandId(e),r=this.buildPrecondition(e),i=this.buildGrounding(e),s=e.isRollback?"rollback":"workflow";return{id:t,name:e.label,icon:e.icon,precondition:r,grounding:i,category:s,confirmMessage:e.isRollback?`Rollback to ${this.shortStatus(e.to)}?`:void 0,successMessage:`Status changed to ${this.shortStatus(e.to)}`}}generateCommandId(e){let t=this.shortStatus(e.from),r=this.shortStatus(e.to);return`workflow-${t}-to-${r}`}buildPrecondition(e){return{id:`precond-${this.generateCommandId(e)}`,label:`Asset status is ${this.shortStatus(e.from)}`,sparqlAsk:`ASK { $target ems:Effort_status "${e.from}" }`}}buildGrounding(e){let t=[];t.push({id:`gnd-status-${this.shortStatus(e.to)}`,label:`Set status to ${this.shortStatus(e.to)}`,type:y1.GroundingType.PROPERTY_SET,targetProperty:"ems__Effort_status",targetValueRef:e.to});let r=this.engine.getTimestampsForStatus(e.to);for(let i of r)t.push({id:`gnd-ts-${i}`,label:`Set ${i}`,type:y1.GroundingType.PROPERTY_SET,targetProperty:i,targetValueSubstitution:"$now"});return t.length===1?t[0]:{id:`gnd-composite-${this.generateCommandId(e)}`,label:`Transition to ${this.shortStatus(e.to)}`,type:y1.GroundingType.COMPOSITE,steps:t}}shortStatus(e){return e.replace("ems__EffortStatus","").toLowerCase()}};_o.WorkflowCommandAdapter=b1;_o.WorkflowCommandAdapter=b1=dB([(0,pB.injectable)(),hB("design:paramtypes",[Object])],b1)});var S1=w(ki=>{"use strict";var gB=ki&&ki.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},yB=ki&&ki.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},bB=ki&&ki.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ki,"__esModule",{value:!0});ki.EffortVotingService=void 0;var FP=je(),_B=qt(),_1=class{static{a(this,"EffortVotingService")}constructor(e){this.vault=e}async incrementEffortVotes(e){let t=await this.vault.read(e),i=this.extractVoteCount(t)+1,s=this.updateFrontmatterWithVotes(t,i);return await this.vault.modify(e,s),i}extractVoteCount(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/,r=e.match(t);if(!r)return 0;let s=r[1].match(/ems__Effort_votes:\s*(\d+)/);return s&&s[1]?parseInt(s[1],10):0}updateFrontmatterWithVotes(e,t){let r=/^---\r?\n([\s\S]*?)\r?\n---/,i=e.match(r),s=e.includes(`\r
101
+ ${o}`}};Hm.MetadataHelpers=Vw});var _P=w(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.TASK_DEFAULT_WORKFLOW=fc.PROJECT_DEFAULT_WORKFLOW=void 0;fc.buildWorkflowAssetContent=nU;var bP=Ai(),Yf=Jc(),Le=Zc(),Qr=gP(),Gw=ho();fc.PROJECT_DEFAULT_WORKFLOW={id:"a1b2c3d4-1111-4000-a000-000000000001",name:"Project Default Workflow",targetClass:Yf.AssetClass.PROJECT,initialState:Le.EffortStatus.DRAFT,terminalStates:[Le.EffortStatus.DONE,Le.EffortStatus.TRASHED],isDefault:!0,states:[{status:Le.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.ANALYSIS,order:3,optional:!0,timestampOnEnter:[]},{status:Le.EffortStatus.TODO,order:4,optional:!0,timestampOnEnter:[]},{status:Le.EffortStatus.DOING,order:5,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:Le.EffortStatus.DONE,order:6,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:Le.EffortStatus.TRASHED,order:7,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:Le.EffortStatus.DRAFT,to:Le.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.ANALYSIS,label:"\u2192 Analysis",isRollback:!1},{from:Le.EffortStatus.ANALYSIS,to:Le.EffortStatus.TODO,label:"\u2192 ToDo",isRollback:!1},{from:Le.EffortStatus.TODO,to:Le.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:Le.EffortStatus.ANALYSIS,to:Le.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:Le.EffortStatus.TODO,to:Le.EffortStatus.ANALYSIS,label:"\u2190 Analysis",isRollback:!0},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.TODO,label:"\u2190 ToDo",isRollback:!0},{from:Le.EffortStatus.DONE,to:Le.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};fc.TASK_DEFAULT_WORKFLOW={id:"a1b2c3d4-2222-4000-a000-000000000002",name:"Task Default Workflow",targetClass:Yf.AssetClass.TASK,initialState:Le.EffortStatus.DRAFT,terminalStates:[Le.EffortStatus.DONE,Le.EffortStatus.TRASHED],isDefault:!0,states:[{status:Le.EffortStatus.DRAFT,order:1,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.BACKLOG,order:2,optional:!1,timestampOnEnter:[]},{status:Le.EffortStatus.DOING,order:3,optional:!1,timestampOnEnter:["ems__Effort_startTimestamp"]},{status:Le.EffortStatus.DONE,order:4,optional:!1,timestampOnEnter:["ems__Effort_endTimestamp","ems__Effort_resolutionTimestamp"]},{status:Le.EffortStatus.TRASHED,order:5,optional:!1,timestampOnEnter:["ems__Effort_resolutionTimestamp"]}],transitions:[{from:Le.EffortStatus.DRAFT,to:Le.EffortStatus.BACKLOG,label:"\u2192 Backlog",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.DOING,label:"\u25B6 Start",isRollback:!1},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.DONE,label:"\u2713 Done",isRollback:!1},{from:Le.EffortStatus.BACKLOG,to:Le.EffortStatus.DRAFT,label:"\u2190 Draft",isRollback:!0},{from:Le.EffortStatus.DOING,to:Le.EffortStatus.BACKLOG,label:"\u2190 Backlog",isRollback:!0},{from:Le.EffortStatus.DONE,to:Le.EffortStatus.DOING,label:"\u2190 Doing",isRollback:!0}]};function nU(n){let e=new Date().toISOString(),t=[],r=n.id,i={exo__Asset_uid:r,exo__Asset_label:`"${n.name}"`,exo__Asset_createdAt:e,exo__Instance_class:Yf.AssetClass.WORKFLOW,[Qr.WorkflowProperty.TARGET_CLASS]:`"[[${n.targetClass}]]"`,[Qr.WorkflowProperty.INITIAL_STATE]:`"[[${n.initialState}]]"`,[Qr.WorkflowProperty.TERMINAL_STATES]:n.terminalStates.map(s=>`"[[${s}]]"`),[Qr.WorkflowProperty.IS_DEFAULT]:n.isDefault};t.push({filename:`${r}.md`,content:Gw.MetadataHelpers.buildFileContent(i)});for(let s of n.states){let o=(0,bP.v4)(),c={exo__Asset_uid:o,exo__Asset_label:`"${n.name} - ${s.status}"`,exo__Asset_createdAt:e,exo__Instance_class:Yf.AssetClass.WORKFLOW_STATE,[Qr.WorkflowStateProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowStateProperty.STATUS]:`"[[${s.status}]]"`,[Qr.WorkflowStateProperty.ORDER]:s.order,[Qr.WorkflowStateProperty.OPTIONAL]:s.optional};s.timestampOnEnter.length>0&&(c[Qr.WorkflowStateProperty.TIMESTAMP_ON_ENTER]=s.timestampOnEnter),s.badgeColor&&(c[Qr.WorkflowStateProperty.BADGE_COLOR]=`"${s.badgeColor}"`),t.push({filename:`${o}.md`,content:Gw.MetadataHelpers.buildFileContent(c)})}for(let s of n.transitions){let o=(0,bP.v4)(),c={exo__Asset_uid:o,exo__Asset_label:`"${n.name} - ${s.label}"`,exo__Asset_createdAt:e,exo__Instance_class:Yf.AssetClass.WORKFLOW_TRANSITION,[Qr.WorkflowTransitionProperty.WORKFLOW]:`"[[${r}]]"`,[Qr.WorkflowTransitionProperty.FROM]:`"[[${s.from}]]"`,[Qr.WorkflowTransitionProperty.TO]:`"[[${s.to}]]"`,[Qr.WorkflowTransitionProperty.LABEL]:`"${s.label}"`,[Qr.WorkflowTransitionProperty.IS_ROLLBACK]:s.isRollback};s.icon&&(c[Qr.WorkflowTransitionProperty.ICON]=`"${s.icon}"`),t.push({filename:`${o}.md`,content:Gw.MetadataHelpers.buildFileContent(c)})}return t}a(nU,"buildWorkflowAssetContent")});var Ww=w(po=>{"use strict";var iU=po&&po.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},sU=po&&po.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(po,"__esModule",{value:!0});po.WorkflowResolver=void 0;var oU=je(),Vl=Oe(),Xr=qe(),vt=Jt(),dc=Jc(),Km=Zc(),SP=_P(),qw=class{static{a(this,"WorkflowResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async resolveForClass(e){let t=`class:${e}`,r=this.cache.get(t);if(r)return r;let s=await this.findDefaultWorkflow(e)??this.getHardcodedFallback(e);return this.cache.set(t,s),s}async resolveForAsset(e,t){let r=await this.tripleStore.match(e,vt.Namespace.EMS.term("Effort_workflow"),void 0);if(r.length>0){let i=r[0].object;if(i instanceof Vl.IRI){let s=await this.loadWorkflowBySubject(i);if(s)return s}}return this.resolveForClass(t)}invalidateCache(){this.cache.clear()}async findDefaultWorkflow(e){let t=await this.tripleStore.match(void 0,vt.Namespace.RDF.term("type"),vt.Namespace.EMS.term("Workflow"));for(let r of t){let i=r.subject;if(!(!(await this.tripleStore.match(i,vt.Namespace.EMS.term("Workflow_targetClass"),void 0)).some(u=>{let f=u.object;return f instanceof Vl.IRI?f.value.endsWith(e.replace(/^ems__/,"")):f instanceof Xr.Literal?this.normalizeWikilink(f.value)===e:!1})||!(await this.tripleStore.match(i,vt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(u=>{let f=u.object instanceof Xr.Literal?u.object.value:"";return f==="true"||f==="1"})))return this.loadWorkflowBySubject(i)}return null}async loadWorkflowBySubject(e){let t=await this.tripleStore.match(e,vt.Namespace.EXO.term("Asset_label"),void 0),r=t.length>0&&t[0].object instanceof Xr.Literal?t[0].object.value:"Unknown Workflow",i=await this.tripleStore.match(e,vt.Namespace.EXO.term("Asset_uid"),void 0),s=i.length>0&&i[0].object instanceof Xr.Literal?i[0].object.value:e.value,o=await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_targetClass"),void 0),c=this.resolveAssetClass(o),l=await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_initialState"),void 0),u=this.resolveEffortStatus(l)??Km.EffortStatus.DRAFT,f=await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_terminalStates"),void 0),d=this.resolveEffortStatuses(f),p=(await this.tripleStore.match(e,vt.Namespace.EMS.term("Workflow_isDefault"),void 0)).some(v=>{let _=v.object instanceof Xr.Literal?v.object.value:"";return _==="true"||_==="1"}),y=await this.loadStates(e),g=await this.loadTransitions(e);return y.length===0&&g.length===0?null:{id:s,name:r,targetClass:c,states:y,transitions:g,initialState:u,terminalStates:d.length>0?d:[Km.EffortStatus.DONE,Km.EffortStatus.TRASHED],isDefault:p}}async loadStates(e){let t=await this.tripleStore.match(void 0,vt.Namespace.RDF.term("type"),vt.Namespace.EMS.term("WorkflowState")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_workflow"),void 0)).some(S=>this.isSameSubject(S.object,e)))continue;let l=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_status"),void 0),u=this.resolveEffortStatus(l);if(!u)continue;let f=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_order"),void 0),d=f.length>0&&f[0].object instanceof Xr.Literal&&parseInt(f[0].object.value,10)||0,p=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_optional"),void 0)).some(S=>{let T=S.object instanceof Xr.Literal?S.object.value:"";return T==="true"||T==="1"}),g=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_timestampOnEnter"),void 0)).map(S=>S.object instanceof Xr.Literal?S.object.value:"").filter(S=>S.length>0),v=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowState_badgeColor"),void 0),_=v.length>0&&v[0].object instanceof Xr.Literal?v[0].object.value:void 0;r.push({status:u,order:d,optional:p,timestampOnEnter:g,badgeColor:_})}return r.sort((i,s)=>i.order-s.order)}async loadTransitions(e){let t=await this.tripleStore.match(void 0,vt.Namespace.RDF.term("type"),vt.Namespace.EMS.term("WorkflowTransition")),r=[];for(let i of t){let s=i.subject;if(!(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_workflow"),void 0)).some(I=>this.isSameSubject(I.object,e)))continue;let l=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_from"),void 0),u=this.resolveEffortStatus(l),f=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_to"),void 0),d=this.resolveEffortStatus(f);if(!u||!d)continue;let h=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_label"),void 0),p=h.length>0&&h[0].object instanceof Xr.Literal?h[0].object.value:`${u} \u2192 ${d}`,y=await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_icon"),void 0),g=y.length>0&&y[0].object instanceof Xr.Literal?y[0].object.value:void 0,_=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_isRollback"),void 0)).some(I=>{let A=I.object instanceof Xr.Literal?I.object.value:"";return A==="true"||A==="1"}),T=(await this.tripleStore.match(s,vt.Namespace.EMS.term("WorkflowTransition_postActions"),void 0)).map(I=>this.extractUid(I.object)).filter(I=>I!==null);r.push({from:u,to:d,label:p,icon:g,isRollback:_,postActions:T.length>0?T:void 0})}return r}extractUid(e){let t=/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i,r=e instanceof Vl.IRI||e instanceof Xr.Literal?e.value:null;if(r===null)return null;let i=r.match(t);return i?i[1].toLowerCase():null}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}resolveAssetClass(e){if(e.length===0)return dc.AssetClass.TASK;let t=e[0].object;if(t instanceof Vl.IRI){let i=`ems__${t.value.split("#").pop()??""}`;return Object.values(dc.AssetClass).includes(i)?i:dc.AssetClass.TASK}if(t instanceof Xr.Literal){let r=this.normalizeWikilink(t.value);return Object.values(dc.AssetClass).includes(r)?r:dc.AssetClass.TASK}return dc.AssetClass.TASK}resolveEffortStatus(e){if(e.length===0)return null;let t=e[0].object,r;if(t instanceof Vl.IRI)r=`ems__${t.value.split("#").pop()??""}`;else if(t instanceof Xr.Literal)r=this.normalizeWikilink(t.value);else return null;return Object.values(Km.EffortStatus).includes(r)?r:null}resolveEffortStatuses(e){return e.map(t=>this.resolveEffortStatus([t])).filter(t=>t!==null)}isSameSubject(e,t){if(e instanceof Vl.IRI)return e.value===t.value;if(e instanceof Xr.Literal){let r=this.normalizeWikilink(e.value);return t.value.includes(r)}return!1}getHardcodedFallback(e){return e===dc.AssetClass.PROJECT?{...SP.PROJECT_DEFAULT_WORKFLOW}:{...SP.TASK_DEFAULT_WORKFLOW}}};po.WorkflowResolver=qw;po.WorkflowResolver=qw=iU([(0,oU.injectable)(),sU("design:paramtypes",[Object])],qw)});var Qw=w(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.TransactionError=ia.TripleNotFoundError=ia.TripleAlreadyExistsError=void 0;var zw=class extends Error{static{a(this,"TripleAlreadyExistsError")}constructor(e){super(`Triple already exists: ${e.toString()}`),this.name="TripleAlreadyExistsError"}};ia.TripleAlreadyExistsError=zw;var Hw=class extends Error{static{a(this,"TripleNotFoundError")}constructor(e){super(`Triple not found: ${e.toString()}`),this.name="TripleNotFoundError"}};ia.TripleNotFoundError=Hw;var Kw=class extends Error{static{a(this,"TransactionError")}constructor(e){super(e),this.name="TransactionError"}};ia.TransactionError=Kw});var Xm=w(Qm=>{"use strict";Object.defineProperty(Qm,"__esModule",{value:!0});Qm.LRUCache=void 0;var Xw=class{static{a(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}};Qm.LRUCache=Xw});var Zw=w(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});Jm.InMemoryTripleStore=void 0;var sa=Qw(),Ym=Oe(),aU=Bt(),cU=qe(),lU=Jt(),uU=Xm(),fU=lU.Namespace.XSD.term("string").value,dU=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,Gl="__default__",Yw=class n{static{a(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 uU.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 o;return!e&&!t&&!r?o=Array.from(this.triples.values()):e&&t&&r?o=this.matchSPO(e,t,r):e&&t?o=this.matchSP(e,t):e&&r?o=this.matchSO(e,r):t&&r?o=this.matchPO(t,r):e?o=this.matchS(e):t?o=this.matchP(t):r?o=this.matchO(r):o=[],this.queryCache.set(i,o),o}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 Jw(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 Ym.IRI(s));return i}addToUUIDIndex(e){if(!(e instanceof Ym.IRI))return;let t=e.value,r=t.match(dU);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),o=this.getNodeKey(r),c=this.spo.get(i);if(!c)return[];let l=c.get(s);if(!l)return[];if(l.has(o)){let u=this.buildTripleKey(i,s,o),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 o=s.get(i);return o?this.getTriplesByKeys(Array.from(o).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 o=s.get(i);return o?this.getTriplesByKeys(Array.from(o).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 o=s.get(i);return o?this.getTriplesByKeys(Array.from(o).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,o]of r.entries())for(let c of o)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,o]of r.entries())for(let c of o)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,o]of r.entries())for(let c of o)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 o=s.get(r);o&&(o.delete(i),o.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 Ym.IRI)return`i:${e.value}`;if(e instanceof aU.BlankNode)return`b:${e.id}`;if(e instanceof cU.Literal){let t=`l:${e.value}`;return e.datatype&&e.datatype.value!==fU?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):"?",o=r?this.getNodeKey(r):"?";return`${i}|${s}|${o}`}getGraphKey(e){return e?e.value:Gl}getOrCreateGraphStore(e){let t=this.getGraphKey(e);return t===Gl?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===Gl)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===Gl)return this.match(e,t,r);let o=this.namedGraphs.get(s);return o?o.match(e,t,r):[]}async getNamedGraphs(){return Array.from(this.namedGraphs.keys()).map(e=>new Ym.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===Gl){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===Gl)return this.count();let r=this.namedGraphs.get(t);return r?r.count():0}};Jm.InMemoryTripleStore=Yw;var Jw=class{static{a(this,"InMemoryTransaction")}constructor(e){this.store=e,this.operations=[],this.committed=!1,this.rolledBack=!1}async add(e){if(this.committed)throw new sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.TransactionError("Transaction already rolled back");this.operations.push({type:"add",triple:e})}async remove(e){if(this.committed)throw new sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.TransactionError("Transaction already rolled back");return this.operations.push({type:"remove",triple:e}),!0}async commit(){if(this.committed)throw new sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.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 sa.TransactionError("Transaction already committed");if(this.rolledBack)throw new sa.TransactionError("Transaction already rolled back");this.operations=[],this.rolledBack=!0}}});var eg=w(mo=>{"use strict";var hU=mo&&mo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},pU=mo&&mo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(mo,"__esModule",{value:!0});mo.EffortStatusWorkflow=void 0;var mU=je(),Zm=qo(),gU=Xf(),yU=Ww(),bU=Zw(),e1=class{static{a(this,"EffortStatusWorkflow")}constructor(){this.resolver=new yU.WorkflowResolver(new bU.InMemoryTripleStore)}setResolver(e){this.resolver=e}getPreviousStatus(e,t){let r=this.normalizeStatus(e),i=this.resolveDefinition(t),s=new gU.WorkflowEngine(i);if(s.isInitialState(r))return null;let o=s.getPreviousStatus(r);if(o!==null)return this.wrapStatus(o)}normalizeStatus(e){return e.replace(/["'[\]]/g,"").trim()}wrapStatus(e){return`"[[${e}]]"`}resolveDefinition(e){return this.hasInstanceClass(e,Zm.AssetClass.TASK)||this.hasInstanceClass(e,Zm.AssetClass.MEETING)?this.resolver.getHardcodedFallback(Zm.AssetClass.TASK):this.resolver.getHardcodedFallback(Zm.AssetClass.PROJECT)}hasInstanceClass(e,t){return e?(Array.isArray(e)?e:[e]).some(i=>i.replace(/["'[\]]/g,"").trim()===t):!1}};mo.EffortStatusWorkflow=e1;mo.EffortStatusWorkflow=e1=hU([(0,mU.injectable)(),pU("design:paramtypes",[])],e1)});var qt=w(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});tg.DI_TOKENS=void 0;tg.DI_TOKENS={IFileSystemAdapter:Symbol.for("IFileSystemAdapter"),IVaultAdapter:Symbol.for("IVaultAdapter"),IVaultContext:Symbol.for("IVaultContext"),IMultiVaultManager:Symbol.for("IMultiVaultManager"),ILogger:Symbol.for("ILogger"),IEventBus:Symbol.for("IEventBus"),IConfiguration:Symbol.for("IConfiguration"),INotificationService:Symbol.for("INotificationService"),AreaCreationService:Symbol.for("AreaCreationService"),ClassCreationService:Symbol.for("ClassCreationService"),ConceptCreationService:Symbol.for("ConceptCreationService"),SupervisionCreationService:Symbol.for("SupervisionCreationService"),GenericAssetCreationService:Symbol.for("GenericAssetCreationService"),DynamicFrontmatterGenerator:Symbol.for("DynamicFrontmatterGenerator"),AlgorithmExtractor:Symbol.for("AlgorithmExtractor"),TaskStatusService:Symbol.for("TaskStatusService"),EffortStatusWorkflow:Symbol.for("EffortStatusWorkflow"),StatusTimestampService:Symbol.for("StatusTimestampService"),PropertyCleanupService:Symbol.for("PropertyCleanupService"),FolderRepairService:Symbol.for("FolderRepairService"),RenameToUidService:Symbol.for("RenameToUidService"),PlanningService:Symbol.for("PlanningService"),EffortVotingService:Symbol.for("EffortVotingService"),SessionEventService:Symbol.for("SessionEventService"),CriticalityZoneService:Symbol.for("CriticalityZoneService"),AssetConversionService:Symbol.for("AssetConversionService"),NoteToRDFConverter:Symbol.for("NoteToRDFConverter"),IVaultSettings:Symbol.for("IVaultSettings"),AreaHierarchyBuilder:Symbol.for("AreaHierarchyBuilder"),URIConstructionService:Symbol.for("URIConstructionService"),ClassHierarchyResolver:Symbol.for("ClassHierarchyResolver")}});var rg=w(Ci=>{"use strict";var _U=Ci&&Ci.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},SU=Ci&&Ci.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},wU=Ci&&Ci.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.StatusTimestampService=void 0;var wP=je(),vU=vs(),ql=kn(),EU=qt(),t1=class{static{a(this,"StatusTimestampService")}constructor(e){this.vault=e,this.frontmatterService=new vU.FrontmatterService}async addStartTimestamp(e){let t=await this.vault.read(e),r=ql.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_startTimestamp",r);await this.vault.modify(e,i)}async addEndTimestamp(e,t){let r=await this.vault.read(e),i=t||new Date,s=ql.DateFormatter.toLocalTimestamp(i),o=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);await this.vault.modify(e,o)}async addResolutionTimestamp(e){let t=await this.vault.read(e),r=ql.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_resolutionTimestamp",r);await this.vault.modify(e,i)}async addReviewTimestamp(e){let t=await this.vault.read(e),r=ql.DateFormatter.toLocalTimestamp(new Date),i=this.frontmatterService.updateProperty(t,"ems__Effort_lastReviewTimestamp",r);await this.vault.modify(e,i)}async addEndAndResolutionTimestamps(e,t){let r=await this.vault.read(e),i=t||new Date,s=ql.DateFormatter.toLocalTimestamp(i),o=this.frontmatterService.updateProperty(r,"ems__Effort_endTimestamp",s);o=this.frontmatterService.updateProperty(o,"ems__Effort_resolutionTimestamp",s),await this.vault.modify(e,o)}async removeStartTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_startTimestamp");await this.vault.modify(e,r)}async removeEndTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");await this.vault.modify(e,r)}async removeResolutionTimestamp(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_resolutionTimestamp");await this.vault.modify(e,r)}async removeEndAndResolutionTimestamps(e){let t=await this.vault.read(e),r=this.frontmatterService.removeProperty(t,"ems__Effort_endTimestamp");r=this.frontmatterService.removeProperty(r,"ems__Effort_resolutionTimestamp"),await this.vault.modify(e,r)}async shiftPlannedEndTimestamp(e,t){let r=await this.vault.read(e),i=this.frontmatterService.parse(r);if(!i.exists)return;let s=this.frontmatterService.getPropertyValue(i.content,"ems__Effort_plannedEndTimestamp");if(!s)return;let o=new Date(s.replace(/["']/g,""));if(isNaN(o.getTime()))return;let c=new Date(o.getTime()+t),l=ql.DateFormatter.toLocalTimestamp(c),u=this.frontmatterService.updateProperty(r,"ems__Effort_plannedEndTimestamp",l);await this.vault.modify(e,u)}};Ci.StatusTimestampService=t1;Ci.StatusTimestampService=t1=_U([(0,wP.injectable)(),wU(0,(0,wP.inject)(EU.DI_TOKENS.IVaultAdapter)),SU("design:paramtypes",[Object])],t1)});var n1=w(Oi=>{"use strict";var TU=Oi&&Oi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},AU=Oi&&Oi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},IU=Oi&&Oi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.TaskStatusService=void 0;var vP=je(),xU=vs(),RU=kn(),PU=eg(),CU=rg(),OU=qt(),r1=class{static{a(this,"TaskStatusService")}constructor(e,t,r){this.vault=e,this.timestampService=r,this.frontmatterService=new xU.FrontmatterService}async syncEffortEndTimestamp(e,t){await this.timestampService.addEndAndResolutionTimestamps(e,t)}async shiftPlannedEndTimestamp(e,t){await this.timestampService.shiftPlannedEndTimestamp(e,t)}async planForEvening(e){let t=await this.vault.read(e),r=new Date;r.setHours(19,0,0,0);let i=RU.DateFormatter.toLocalTimestamp(r),s=this.frontmatterService.updateProperty(t,"ems__Effort_plannedStartTimestamp",i);await this.vault.modify(e,s)}};Oi.TaskStatusService=r1;Oi.TaskStatusService=r1=TU([(0,vP.injectable)(),IU(0,(0,vP.inject)(OU.DI_TOKENS.IVaultAdapter)),AU("design:paramtypes",[Object,PU.EffortStatusWorkflow,CU.StatusTimestampService])],r1)});var s1=w(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});ng.MetadataExtractor=void 0;var DU=ho(),i1=class{static{a(this,"MetadataExtractor")}constructor(e){this.vault=e}extractMetadata(e){return e?this.vault.getFrontmatter(e)||{}:{}}extractInstanceClass(e){return e.exo__Instance_class||null}extractStatus(e){return e.ems__Effort_status||null}extractIsArchived(e){return DU.MetadataHelpers.isAssetArchived(e)}static extractIsDefinedBy(e){let t=e.exo__Asset_isDefinedBy||'""';return Array.isArray(t)&&(t=t[0]||'""'),String(t)}extractExpectedFolder(e){let t=e.exo__Asset_isDefinedBy;if(!t)return null;let r=Array.isArray(t)?t[0]:t;if(!r||typeof r!="string")return null;let i=r.replace(/["'[\]]/g,"").trim();if(!i)return null;let s=i.split("/");return s.pop(),s.join("/")}extractCommandVisibilityContext(e){let t=this.extractMetadata(e),r=this.extractInstanceClass(t),i=this.extractStatus(t),s=this.extractIsArchived(t),o=e.parent?.path||"",c=this.extractExpectedFolder(t);return{instanceClass:r,currentStatus:i,metadata:t,isArchived:s,currentFolder:o,expectedFolder:c}}extractCache(e){return e?this.vault.getFrontmatter(e):null}};ng.MetadataExtractor=i1});var a1=w(Di=>{"use strict";var FU=Di&&Di.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},LU=Di&&Di.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},NU=Di&&Di.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Di,"__esModule",{value:!0});Di.AreaCreationService=void 0;var EP=je(),TP=Ai(),kU=qo(),MU=kn(),jU=s1(),AP=ho(),$U=qt(),o1=class{static{a(this,"AreaCreationService")}constructor(e){this.vault=e}async createChildArea(e,t,r){let i=(0,TP.v4)(),s=`${i}.md`,o=this.generateChildAreaFrontmatter(t,e.basename,r,i),c=AP.MetadataHelpers.buildFileContent(o),l=e.parent?.path||"",u=l?`${l}/${s}`:s;return await this.vault.create(u,c)}generateChildAreaFrontmatter(e,t,r,i){let s=new Date,o=MU.DateFormatter.toLocalTimestamp(s),c=jU.MetadataExtractor.extractIsDefinedBy(e),l={};if(l.exo__Asset_isDefinedBy=AP.MetadataHelpers.ensureQuoted(c),l.exo__Asset_uid=i||(0,TP.v4)(),l.exo__Asset_createdAt=o,l.exo__Instance_class=[`"[[${kU.AssetClass.AREA}]]"`],l.ems__Area_parent=`"[[${t}]]"`,r&&r.trim()!==""){let u=r.trim();l.exo__Asset_label=u,l.aliases=[u]}return l}};Di.AreaCreationService=o1;Di.AreaCreationService=o1=FU([(0,EP.injectable)(),NU(0,(0,EP.inject)($U.DI_TOKENS.IVaultAdapter)),LU("design:paramtypes",[Object])],o1)});var l1=w(Fi=>{"use strict";var UU=Fi&&Fi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},BU=Fi&&Fi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},VU=Fi&&Fi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.AreaHierarchyBuilder=void 0;var IP=je(),xP=qo(),GU=qt(),ig=eo(),c1=class{static{a(this,"AreaHierarchyBuilder")}constructor(e){this.vault=e}buildHierarchy(e,t){let r=this.vault.getAbstractFileByPath(e);if(!this.isFile(r))return null;let i=this.vault.getFrontmatter(r)||{};if(this.extractInstanceClass(i)!==xP.AssetClass.AREA)return null;let o=this.collectAllAreasFromVault(),c=new Set;return this.buildTree(e,o,c,0)}isFile(e){return!!e&&typeof e=="object"&&"basename"in e&&"path"in e}extractInstanceClass(e){let t=e.exo__Instance_class||"";return Array.isArray(t)?ig.WikiLinkHelpers.normalize(String(t[0]||"")):ig.WikiLinkHelpers.normalize(String(t))}collectAllAreasFromVault(){let e=new Map,t=new Map,r=this.vault.getAllFiles();for(let i of r){let s=this.vault.getFrontmatter(i)||{};if(this.extractInstanceClass(s)===xP.AssetClass.AREA){let c=this.extractParentPath(s);e.set(i.path,{path:i.path,title:i.basename,label:s.exo__Asset_label||void 0,isArchived:this.isArchived(s),depth:0,parentPath:c||void 0}),t.set(i.basename,i.path)}}for(let[,i]of e.entries())i.parentPath&&t.has(i.parentPath)&&(i.parentPath=t.get(i.parentPath));return e}extractParentPath(e){let t=e.ems__Area_parent;if(!t)return null;if(Array.isArray(t)){let r=t[0]||"";return ig.WikiLinkHelpers.normalize(String(r))}return ig.WikiLinkHelpers.normalize(String(t))}isArchived(e){let t=e.exo__Asset_archived;if(t===!0||t==="true")return!0;if(Array.isArray(t)&&t.length>0){let r=t[0];return r===!0||r==="true"}return!1}buildTree(e,t,r,i){if(r.has(e))return null;r.add(e);let s=t.get(e);if(!s)return null;let o=[];for(let[c,l]of t.entries())if(l.parentPath===e){let u=this.buildTree(c,t,r,i+1);u&&o.push(u)}return o.sort((c,l)=>{let u=c.label||c.title,f=l.label||l.title;return u.localeCompare(f)}),{path:s.path,title:s.title,label:s.label,isArchived:s.isArchived,depth:i,parentPath:s.parentPath,children:o}}};Fi.AreaHierarchyBuilder=c1;Fi.AreaHierarchyBuilder=c1=UU([(0,IP.injectable)(),VU(0,(0,IP.inject)(GU.DI_TOKENS.IVaultAdapter)),BU("design:paramtypes",[Object])],c1)});var f1=w(Li=>{"use strict";var qU=Li&&Li.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},WU=Li&&Li.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},zU=Li&&Li.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Li,"__esModule",{value:!0});Li.ClassCreationService=void 0;var RP=je(),HU=Ai(),KU=kn(),QU=ho(),XU=qt(),u1=class{static{a(this,"ClassCreationService")}constructor(e){this.vault=e}async createSubclass(e,t,r){let i=(0,HU.v4)(),s=this.generateFileName(t),o=s.endsWith(".md")?s:`${s}.md`,c=this.generateClassFrontmatter(e.basename,t,i,r),l=QU.MetadataHelpers.buildFileContent(c),u="classes",f=`${u}/${o}`;return this.vault.getAbstractFileByPath(u)||await this.vault.createFolder(u),await this.vault.create(f,l)}generateFileName(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-");for(;t.startsWith("-");)t=t.slice(1);for(;t.endsWith("-");)t=t.slice(0,-1);return t}generateClassFrontmatter(e,t,r,i){let s=new Date,o=KU.DateFormatter.toLocalTimestamp(s),c={};c.exo__Asset_uid=r,c.exo__Asset_label=t,c.exo__Asset_createdAt=o,c.exo__Instance_class=['"[[exo__Class]]"'],c.exo__Class_superClass=`"[[${e}]]"`;let l=i.exo__Asset_isDefinedBy||'"[[Ontology/EXO]]"';return c.exo__Asset_isDefinedBy=l,c.aliases=[t],c}};Li.ClassCreationService=u1;Li.ClassCreationService=u1=qU([(0,RP.injectable)(),zU(0,(0,RP.inject)(XU.DI_TOKENS.IVaultAdapter)),WU("design:paramtypes",[Object])],u1)});var h1=w(Ni=>{"use strict";var YU=Ni&&Ni.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},JU=Ni&&Ni.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},ZU=Ni&&Ni.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ConceptCreationService=void 0;var PP=je(),eB=Ai(),tB=kn(),rB=ho(),nB=qo(),iB=qt(),d1=class{static{a(this,"ConceptCreationService")}constructor(e){this.vault=e}async createNarrowerConcept(e,t,r,i){let s=(0,eB.v4)(),o=t.endsWith(".md")?t:`${t}.md`,c=this.generateConceptFrontmatter(e.basename,r,i,s),l=rB.MetadataHelpers.buildFileContent(c),u="concepts",f=`${u}/${o}`;return this.vault.getAbstractFileByPath(u)||await this.vault.createFolder(u),await this.vault.create(f,l)}generateConceptFrontmatter(e,t,r,i){let s=new Date,o=tB.DateFormatter.toLocalTimestamp(s),c={};return c.exo__Asset_isDefinedBy='"[[!concepts]]"',c.exo__Asset_uid=i,c.exo__Asset_createdAt=o,c.exo__Instance_class=[`"[[${nB.AssetClass.CONCEPT}]]"`],c.ims__Concept_broader=`"[[${e}]]"`,c.ims__Concept_definition=t,r.length>0&&(c.aliases=r),c}};Ni.ConceptCreationService=d1;Ni.ConceptCreationService=d1=YU([(0,PP.injectable)(),ZU(0,(0,PP.inject)(iB.DI_TOKENS.IVaultAdapter)),JU("design:paramtypes",[Object])],d1)});var CP=w(yo=>{"use strict";var sB=yo&&yo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},oB=yo&&yo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(yo,"__esModule",{value:!0});yo.InstantiationRuleResolver=void 0;var aB=je(),p1=Oe(),Wl=qe(),go=Jt(),m1=class{static{a(this,"InstantiationRuleResolver")}constructor(e){this.tripleStore=e,this.cache=new Map}async getRule(e){let t=this.cache.get(e);if(t!==void 0)return t;let r=await this.findRuleForClass(e);return this.cache.set(e,r),r}invalidateCache(){this.cache.clear()}async findRuleForClass(e){let t=await this.tripleStore.match(void 0,go.Namespace.RDF.term("type"),go.Namespace.EXO.term("InstantiationRule"));for(let r of t){let i=r.subject;if((await this.tripleStore.match(i,go.Namespace.EXO.term("rule_targetClass"),void 0)).some(c=>this.matchesTargetClass(c.object,e)))return this.loadRule(i)}return null}async loadRule(e){let t=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_prototypeUID"),void 0),r=t.length>0&&t[0].object instanceof Wl.Literal?t[0].object.value:null,i=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_defaultFolder"),void 0),s=i.length>0&&i[0].object instanceof Wl.Literal?i[0].object.value:null,o=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_propertySetRules"),void 0),c=[];for(let l of o){let u=l.object;if(!(u instanceof p1.IRI))continue;let f=await this.loadPropertySetRule(u);f&&c.push(f)}return{prototypeUID:r,defaultFolder:s,propertySetRules:c}}async loadPropertySetRule(e){let t=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_property"),void 0);if(t.length===0)return null;let r=t[0].object,i=r instanceof p1.IRI?this.extractLocalName(r):r instanceof Wl.Literal?this.normalizeWikilink(r.value):null;if(!i)return null;let s=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_value"),void 0),o=s.length>0&&s[0].object instanceof Wl.Literal?s[0].object.value:"",c=await this.tripleStore.match(e,go.Namespace.EXO.term("rule_valueType"),void 0),l=c.length>0&&c[0].object instanceof Wl.Literal?c[0].object.value:"literal";return{property:i,value:o,valueType:l}}matchesTargetClass(e,t){return e instanceof p1.IRI?this.extractLocalName(e)===t:e instanceof Wl.Literal?this.normalizeWikilink(e.value)===t:!1}extractLocalName(e){let t=e.value,r=t.lastIndexOf("#");if(r>=0){let s=t.substring(r+1);return t.includes("/ems#")?`ems__${s}`:t.includes("/exo#")?`exo__${s}`:t.includes("/ims#")?`ims__${s}`:s}let i=t.lastIndexOf("/");return i>=0?t.substring(i+1):t}normalizeWikilink(e){return e.replace(/["'[\]]/g,"").trim()}};yo.InstantiationRuleResolver=m1;yo.InstantiationRuleResolver=m1=sB([(0,aB.injectable)(),oB("design:paramtypes",[Object])],m1)});var OP=w(bo=>{"use strict";var cB=bo&&bo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},lB=bo&&bo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(bo,"__esModule",{value:!0});bo.VisibilityGenerator=void 0;var uB=je(),fB=Xf(),g1=class{static{a(this,"VisibilityGenerator")}constructor(e){this.engine=e}getVisibleCommands(e){return this.engine.getAllTransitions(e).map(t=>this.toCommand(t))}getForwardCommands(e){return this.engine.getAvailableTransitions(e).map(t=>this.toCommand(t))}getRollbackCommands(e){return this.engine.getRollbackTransitions(e).map(t=>this.toCommand(t))}toCommand(e){let t=e.from.replace("ems__EffortStatus","").toLowerCase(),r=e.to.replace("ems__EffortStatus","").toLowerCase();return{commandId:`workflow-${t}-to-${r}`,label:e.label,icon:e.icon,targetStatus:e.to,isRollback:e.isRollback}}};bo.VisibilityGenerator=g1;bo.VisibilityGenerator=g1=cB([(0,uB.injectable)(),lB("design:paramtypes",[fB.WorkflowEngine])],g1)});var DP=w(_o=>{"use strict";var dB=_o&&_o.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},hB=_o&&_o.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(_o,"__esModule",{value:!0});_o.WorkflowCommandAdapter=void 0;var pB=je(),y1=Vo(),mB=Xf(),b1=class{static{a(this,"WorkflowCommandAdapter")}constructor(e){this.workflow=e,this.engine=new mB.WorkflowEngine(e)}adaptTransitions(e){return this.engine.getAllTransitions(e).map(r=>this.transitionToCommand(r))}adaptForwardTransitions(e){return this.engine.getAvailableTransitions(e).map(r=>this.transitionToCommand(r))}adaptRollbackTransitions(e){return this.engine.getRollbackTransitions(e).map(r=>this.transitionToCommand(r))}getEngine(){return this.engine}getWorkflow(){return this.workflow}transitionToCommand(e){let t=this.generateCommandId(e),r=this.buildPrecondition(e),i=this.buildGrounding(e),s=e.isRollback?"rollback":"workflow";return{id:t,name:e.label,icon:e.icon,precondition:r,grounding:i,category:s,confirmMessage:e.isRollback?`Rollback to ${this.shortStatus(e.to)}?`:void 0,successMessage:`Status changed to ${this.shortStatus(e.to)}`}}generateCommandId(e){let t=this.shortStatus(e.from),r=this.shortStatus(e.to);return`workflow-${t}-to-${r}`}buildPrecondition(e){return{id:`precond-${this.generateCommandId(e)}`,label:`Asset status is ${this.shortStatus(e.from)}`,sparqlAsk:`ASK { $target ems:Effort_status "${e.from}" }`}}buildGrounding(e){let t=[];t.push({id:`gnd-status-${this.shortStatus(e.to)}`,label:`Set status to ${this.shortStatus(e.to)}`,type:y1.GroundingType.PROPERTY_SET,targetProperty:"ems__Effort_status",targetValueRef:e.to});let r=this.engine.getTimestampsForStatus(e.to);for(let i of r)t.push({id:`gnd-ts-${i}`,label:`Set ${i}`,type:y1.GroundingType.PROPERTY_SET,targetProperty:i,targetValueSubstitution:"$now"});return t.length===1?t[0]:{id:`gnd-composite-${this.generateCommandId(e)}`,label:`Transition to ${this.shortStatus(e.to)}`,type:y1.GroundingType.COMPOSITE,steps:t}}shortStatus(e){return e.replace("ems__EffortStatus","").toLowerCase()}};_o.WorkflowCommandAdapter=b1;_o.WorkflowCommandAdapter=b1=dB([(0,pB.injectable)(),hB("design:paramtypes",[Object])],b1)});var S1=w(ki=>{"use strict";var gB=ki&&ki.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},yB=ki&&ki.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},bB=ki&&ki.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ki,"__esModule",{value:!0});ki.EffortVotingService=void 0;var FP=je(),_B=qt(),_1=class{static{a(this,"EffortVotingService")}constructor(e){this.vault=e}async incrementEffortVotes(e){let t=await this.vault.read(e),i=this.extractVoteCount(t)+1,s=this.updateFrontmatterWithVotes(t,i);return await this.vault.modify(e,s),i}extractVoteCount(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/,r=e.match(t);if(!r)return 0;let s=r[1].match(/ems__Effort_votes:\s*(\d+)/);return s&&s[1]?parseInt(s[1],10):0}updateFrontmatterWithVotes(e,t){let r=/^---\r?\n([\s\S]*?)\r?\n---/,i=e.match(r),s=e.includes(`\r
102
102
  `)?`\r
103
103
  `:`
104
104
  `;if(!i)return`---${s}ems__Effort_votes: ${t}${s}---${s}${e}`;let c=i[1];return c.includes("ems__Effort_votes:")?c=c.replace(/ems__Effort_votes:.*$/m,`ems__Effort_votes: ${t}`):c+=`${s}ems__Effort_votes: ${t}`,e.replace(r,`---${s}${c}${s}---`)}};ki.EffortVotingService=_1;ki.EffortVotingService=_1=gB([(0,FP.injectable)(),bB(0,(0,FP.inject)(_B.DI_TOKENS.IVaultAdapter)),yB("design:paramtypes",[Object])],_1)});var v1=w(w1=>{"use strict";Object.defineProperty(w1,"__esModule",{value:!0});w1.extractAssetReference=SB;function SB(n){if(typeof n!="string")return null;let e=n.trim().replace(/^["']|["']$/g,"");e=e.replace(/^\[\[|\]\]$/g,"");let t=e.indexOf("|");return t!==-1&&(e=e.slice(0,t).trim()),e||null}a(SB,"extractAssetReference")});var T1=w(Mi=>{"use strict";var wB=Mi&&Mi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},vB=Mi&&Mi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},EB=Mi&&Mi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.FolderRepairService=void 0;var LP=je(),TB=qt(),AB=v1(),E1=class{static{a(this,"FolderRepairService")}constructor(e){this.vault=e}async getExpectedFolder(e,t){return this.getExpectedFolderSync(e,t)}getExpectedFolderSync(e,t){let r=t?.exo__Asset_isDefinedBy;if(!r)return null;let i=(0,AB.extractAssetReference)(r);if(!i)return null;let s=this.vault.getFirstLinkpathDest(i,e.path);return s?this.getFileFolder(s):null}async repairFolder(e,t){let r=`${t}/${e.name}`;if(this.vault.getAbstractFileByPath(r))throw new Error(`Cannot move file: ${r} already exists`);await this.ensureFolderExists(t),await this.vault.rename(e,r)}getFileFolder(e){return e.parent?.path||""}async ensureFolderExists(e){if(!e)return;let t=this.vault.getAbstractFileByPath(e);if(!(t&&"children"in t))try{await this.vault.createFolder(e)}catch(r){if(r instanceof Error&&r.message.includes("Folder already exists"))return;throw r}}};Mi.FolderRepairService=E1;Mi.FolderRepairService=E1=wB([(0,LP.injectable)(),EB(0,(0,LP.inject)(TB.DI_TOKENS.IVaultAdapter)),vB("design:paramtypes",[Object])],E1)});var x1=w(ji=>{"use strict";var IB=ji&&ji.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},xB=ji&&ji.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},NP=ji&&ji.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(ji,"__esModule",{value:!0});ji.PropertyCleanupService=void 0;var A1=je(),kP=qt(),RB=rl(),I1=class{static{a(this,"PropertyCleanupService")}constructor(e,t=RB.NullLogger){this.vault=e,this.logger=t,this.logger.debug("PropertyCleanupService initialized")}async cleanEmptyProperties(e){this.logger.debug("Cleaning empty properties",{path:e.path});let t=await this.vault.read(e),r=this.removeEmptyPropertiesFromContent(t);await this.vault.modify(e,r),this.logger.info("Empty properties cleaned",{path:e.path})}removeEmptyPropertiesFromContent(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return e;let s=r[1].split(`
@@ -207,7 +207,7 @@ ${s}`}return`${r}: ${i}`}).join(`
207
207
  `,o=await this.sparqlService.query(s);return this.buildEnumValues(o)}buildEnumValues(e){let t=[],r=new Set;for(let i of e){let s=this.getBindingValue(i,"instance");if(!s||r.has(s))continue;r.add(s);let o=this.getBindingValue(i,"label")??s,l=`[[${this.fromFullIRI(s)}]]`;t.push({value:l,label:o})}return t}buildRankProperty(e){let t=e.match(/^([a-z]+)__(.+)$/);if(!t)return null;let[,r,i]=t;return`${r}__${i}_rank`}normalizeClassName(e){return e.replace(/\[\[|\]\]/g,"").trim()}getBindingValue(e,t){let r=e.get(t);if(r!=null)return String(r)}toFullIRI(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;let t=e.match(/^([a-z]+)__(.+)$/);if(t){let[,r,i]=t;return`https://exocortex.my/ontology/${r}#${i}`}return e}fromFullIRI(e){let t=e.match(/https:\/\/exocortex\.my\/ontology\/([a-z]+)#(.+)$/);if(t){let[,r,i]=t;return`${r}__${i}`}return e}};vo.EnumValueResolver=B1;vo.EnumValueResolver=B1=tV([(0,nV.injectable)(),rV("design:paramtypes",[Object,Object])],B1)});var G1=w(Vi=>{"use strict";var iV=Vi&&Vi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},sV=Vi&&Vi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},oV=Vi&&Vi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Vi,"__esModule",{value:!0});Vi.AssetConversionService=void 0;var zP=je(),HP=qo(),aV=vs(),sg=ra(),cV=qt(),V1=class{static{a(this,"AssetConversionService")}constructor(e){this.vault=e,this.frontmatterService=new aV.FrontmatterService}async convertTaskToProject(e){try{let t=await this.vault.read(e),r=this.removeInstanceClassProperty(t);return r=this.frontmatterService.updateProperty(r,"exo__Instance_class",`["[[${HP.AssetClass.PROJECT}]]"]`),await this.vault.modify(e,r),sg.LoggingService.info(`Converted Task to Project: ${e.basename} (${e.path})`),e}catch(t){let r=`Failed to convert Task to Project: ${e.path}`;throw sg.LoggingService.error(r,t instanceof Error?t:void 0),new Error(r)}}async convertProjectToTask(e){try{let t=await this.vault.read(e),r=this.removeInstanceClassProperty(t);return r=this.frontmatterService.updateProperty(r,"exo__Instance_class",`["[[${HP.AssetClass.TASK}]]"]`),await this.vault.modify(e,r),sg.LoggingService.info(`Converted Project to Task: ${e.basename} (${e.path})`),e}catch(t){let r=`Failed to convert Project to Task: ${e.path}`;throw sg.LoggingService.error(r,t instanceof Error?t:void 0),new Error(r)}}removeInstanceClassProperty(e){let t=this.frontmatterService.parse(e);if(!t.exists)return e;let r=/^exo__Instance_class:.*$(\n -.*$)*/gm,i=t.content.replace(r,"").replace(/\n\n+/g,`
208
208
  `).trim();return e.replace(/^---\n[\s\S]*?\n---/,`---
209
209
  ${i}
210
- ---`)}};Vi.AssetConversionService=V1;Vi.AssetConversionService=V1=iV([(0,zP.injectable)(),oV(0,(0,zP.inject)(cV.DI_TOKENS.IVaultAdapter)),sV("design:paramtypes",[Object])],V1)});var z1=w(Gi=>{"use strict";var lV=Gi&&Gi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},uV=Gi&&Gi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},KP=Gi&&Gi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Gi,"__esModule",{value:!0});Gi.SessionEventService=void 0;var q1=je(),fV=Ai(),QP=qo(),dV=kn(),hV=ho(),XP=qt(),W1=class{static{a(this,"SessionEventService")}constructor(e,t){this.vault=e,this.vaultSettings=t,this.folderPathCache=null}async createSessionStartEvent(e){return this.createSessionEvent(e,QP.AssetClass.SESSION_START_EVENT)}async createSessionEndEvent(e){return this.createSessionEvent(e,QP.AssetClass.SESSION_END_EVENT)}getSessionEventFolder(){if(this.folderPathCache!==null)return this.folderPathCache;let e=this.vault.getDefaultNewFileParent();return this.folderPathCache=e?.path||"",this.folderPathCache}async createSessionEvent(e,t){let r=(0,fV.v4)(),i=dV.DateFormatter.toLocalTimestamp(new Date),s={exo__Asset_uid:r,exo__Asset_createdAt:i,exo__Asset_isDefinedBy:this.vaultSettings.getOwnerIdentity(),exo__Instance_class:[`"[[${t}]]"`],ems__SessionEvent_timestamp:i,ems__Session_area:`"[[${e}]]"`},o=hV.MetadataHelpers.buildFileContent(s),c=this.getSessionEventFolder();c&&!await this.vault.exists(c)&&await this.vault.createFolder(c);let l=c?`${c}/${r}.md`:`${r}.md`;return await this.vault.create(l,o)}};Gi.SessionEventService=W1;Gi.SessionEventService=W1=lV([(0,q1.injectable)(),KP(0,(0,q1.inject)(XP.DI_TOKENS.IVaultAdapter)),KP(1,(0,q1.inject)(XP.DI_TOKENS.IVaultSettings)),uV("design:paramtypes",[Object,Object])],W1)});var Q1=w(qi=>{"use strict";var pV=qi&&qi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},mV=qi&&qi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},YP=qi&&qi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(qi,"__esModule",{value:!0});qi.URIConstructionService=void 0;var H1=je(),JP=qt(),gV=rl(),K1=class{static{a(this,"URIConstructionService")}constructor(e,t=gV.NullLogger){this.fileSystem=e,this.logger=t,this.defaultOntologyURL="https://exocortex.my/default/",this.strictValidation=!0}configure(e){e?.defaultOntologyURL&&(this.defaultOntologyURL=e.defaultOntologyURL),e?.strictValidation!==void 0&&(this.strictValidation=e.strictValidation)}async constructAssetURI(e){let t=this.extractUID(e);if(!t){if(this.strictValidation)throw new Error(`Asset missing exo__Asset_uid: ${e.path}`);return this.logger.warn(`Asset ${e.path} missing UID, using filename fallback`),this.constructFallbackURI(e)}let r=await this.resolveOntologyURL(e);if(!this.validateOntologyURL(r))throw new Error(`Invalid ontology URL: ${r}`);return`${r.endsWith("/")?r:`${r}/`}${t}`}validateOntologyURL(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async resolveOntologyURL(e){let t=e.frontmatter?.exo__Asset_isDefinedBy;if(!t||typeof t!="string")return this.defaultOntologyURL;let r=this.extractWikiLink(t),i=r,s=await this.fileSystem.fileExists(r);return!s&&!r.endsWith(".md")&&(i=`${r}.md`,s=await this.fileSystem.fileExists(i)),s?(await this.fileSystem.getFileMetadata(i))?.exo__Ontology_url||this.defaultOntologyURL:(this.logger.warn(`Ontology file not found: ${r}, using default`),this.defaultOntologyURL)}extractUID(e){let t=e.frontmatter?.exo__Asset_uid;return typeof t=="string"?t:null}extractWikiLink(e){return e.replace(/^\[\[|\]\]$/g,"")}constructFallbackURI(e){let t=e.path.split("/").pop()?.replace(".md","")||"unknown";return`${this.defaultOntologyURL}${t}`}};qi.URIConstructionService=K1;qi.URIConstructionService=K1=pV([(0,H1.injectable)(),YP(0,(0,H1.inject)(JP.DI_TOKENS.IFileSystemAdapter)),YP(1,(0,H1.inject)(JP.DI_TOKENS.ILogger)),mV("design:paramtypes",[Object,Object])],K1)});var Y1=w(Wi=>{"use strict";var yV=Wi&&Wi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},bV=Wi&&Wi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},_V=Wi&&Wi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Wi,"__esModule",{value:!0});Wi.GenericAssetCreationService=void 0;var ZP=je(),Zf=kn(),SV=ho(),wV=Zs(),vV=Jt(),EV=qt(),Ts=lp(),TV=qf(),AV=km(),X1=class{static{a(this,"GenericAssetCreationService")}constructor(e){this.vault=e,this.clock=(0,TV.liveClock)(),this.uidGen=(0,AV.liveUidGenerator)()}withDeterminism(e){return e.clock&&(this.clock=e.clock),e.uidGenerator&&(this.uidGen=e.uidGenerator),this}async createAsset(e,t){let{folderPath:r,path:i,content:s}=this.buildAsset(e,t);return this.vault.getAbstractFileByPath(r)||await this.vault.createFolder(r),await this.vault.create(i,s)}buildAsset(e,t){let r=this.uidGen.next(),i=this.generateFrontmatter(e,t||[],r),s=SV.MetadataHelpers.buildFileContent(i,e.body),o=e.folderPath||this.getDefaultFolderPath(e),c=`${r}.md`,l=o?`${o}/${c}`:c;return{uid:r,folderPath:o,path:l,frontmatter:i,content:s}}generateFrontmatter(e,t=[],r=this.uidGen.next()){let i={},s=new Map;for(let c of t)s.set(c.name,c.fieldType);i.exo__Asset_uid=r,i.exo__Asset_createdAt=e.timezone?this.generateTimestampInTimezone(e.timezone):Zf.DateFormatter.toLocalTimestamp(this.clock.now());let o=e.classRefForm==="uuid"&&e.classUid?e.classUid:e.className;if(i.exo__Instance_class=[this.formatWikilink(o)],e.createdBy&&e.createdBy.trim()!==""&&(i.exo__Asset_createdBy=this.formatWikilink(e.createdBy.trim())),e.label&&e.label.trim()!==""){let c=e.label.trim();i.exo__Asset_label=c;let l=[c];if(e.aliases)for(let u of e.aliases)l.includes(u)||l.push(u);i.aliases=l}if(e.parentFile&&e.parentMetadata&&this.inheritParentContext(i,e),e.propertyValues){for(let[c,l]of Object.entries(e.propertyValues))if(!(c==="exo__Asset_uid"||c==="exo__Asset_createdAt"||c==="exo__Asset_createdBy"||c==="exo__Instance_class"||c==="exo__Asset_label"||c==="aliases")&&l!=null)if(e.shapeRegistry!==void 0)i[c]=this.formatPropertyValueWithCardinality(c,String(l),e.shapeRegistry);else{let u=s.get(c);i[c]=this.formatValue(l,u)}}return i}inheritParentContext(e,t){let r=t.parentMetadata||{},i=t.parentFile?.basename;if(t.className==="ems__Task"||t.className.startsWith("ems__Task")){let s=r.exo__Instance_class,c=this.isAreaClass(s,t.classResolver)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(t.className==="ems__Project"||t.className.startsWith("ems__Project")){let s=r.exo__Instance_class,c=this.isAreaClass(s,t.classResolver)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(r.exo__Asset_isDefinedBy){let s=r.exo__Asset_isDefinedBy;e.exo__Asset_isDefinedBy=typeof s=="string"?this.formatWikilink(s):s}}isAreaClass(e,t){if(!e)return!1;let r=Array.isArray(e)?e:[e],i=a(()=>null,"noopResolver");return r.some(s=>{let o=wV.WikiLinkHelpers.resolveSymbolic(String(s),t??i);return o.includes("Area")||o.includes("ems__Area")})}getDefaultFolderPath(e){if(e.parentFile?.parent?.path)return e.parentFile.parent.path;let t={ems__Task:"tasks",ems__Project:"projects",ems__Area:"areas",ems__Meeting:"meetings",exo__Event:"events",ims__Concept:"concepts"};if(t[e.className])return t[e.className];for(let[r,i]of Object.entries(t))if(e.className.startsWith(r))return i;return"assets"}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case Ts.PropertyFieldType.Text:return String(e);case Ts.PropertyFieldType.Wikilink:case Ts.PropertyFieldType.Reference:case Ts.PropertyFieldType.StatusSelect:case Ts.PropertyFieldType.SizeSelect:return this.formatWikilink(String(e));case Ts.PropertyFieldType.Number:return typeof e=="number"?e:Number(e)||0;case Ts.PropertyFieldType.Boolean:return this.formatBoolean(e);case Ts.PropertyFieldType.Date:case Ts.PropertyFieldType.DateTime:case Ts.PropertyFieldType.Timestamp:return this.formatTimestamp(e);default:return String(e)}}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?Zf.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}formatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:`"[[${e}]]"`}formatBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"}return typeof e=="number"?e!==0:!!e}formatTimestamp(e){if(e instanceof Date)return Zf.DateFormatter.toLocalTimestamp(e);if(typeof e=="string"){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))return e;if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e.replace("Z","");let t=new Date(e);return isNaN(t.getTime())?e:Zf.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return Zf.DateFormatter.toLocalTimestamp(t)}return String(e)}formatPropertyValueWithCardinality(e,t,r){if(!t.includes("[["))return t;let i=t.startsWith('"')&&t.endsWith('"')?t:`"${t}"`;return this.shouldEmitAsArray(e,r)?[i]:i}shouldEmitAsArray(e,t){if(!t)return!1;let r=vV.Namespace.fromPropertyKey(e);if(!r)return!1;let i=r.namespace.term(r.localName).value;return t.get(i)?.cardinality==="Multiple"}generateTimestampInTimezone(e){let t=this.clock.now(),i=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(t),s=a(o=>i.find(c=>c.type===o)?.value||"00","get");return`${s("year")}-${s("month")}-${s("day")}T${s("hour")}:${s("minute")}:${s("second")}`}};Wi.GenericAssetCreationService=X1;Wi.GenericAssetCreationService=X1=yV([(0,ZP.injectable)(),_V(0,(0,ZP.inject)(EV.DI_TOKENS.IVaultAdapter)),bV("design:paramtypes",[Object])],X1)});var tC=w(zi=>{"use strict";var IV=zi&&zi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},xV=zi&&zi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},RV=zi&&zi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(zi,"__esModule",{value:!0});zi.ArchiveAssetService=void 0;var eC=je(),PV=qt(),CV=vs(),J1=class{static{a(this,"ArchiveAssetService")}constructor(e){this.vault=e,this.frontmatterService=new CV.FrontmatterService}async archiveAsset(e){let t=await this.vault.read(e),r=this.frontmatterService.updateProperty(t,"archived","true");r=this.frontmatterService.removeProperty(r,"aliases"),r!==t&&await this.vault.modify(e,r)}};zi.ArchiveAssetService=J1;zi.ArchiveAssetService=J1=IV([(0,eC.injectable)(),RV(0,(0,eC.inject)(PV.DI_TOKENS.IVaultAdapter)),xV("design:paramtypes",[Object])],J1)});var nC=w(Hi=>{"use strict";var OV=Hi&&Hi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},DV=Hi&&Hi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},FV=Hi&&Hi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Hi,"__esModule",{value:!0});Hi.FixMissingLabelService=void 0;var rC=je(),LV=qt(),NV=vs(),Z1=class{static{a(this,"FixMissingLabelService")}constructor(e){this.vault=e,this.frontmatterService=new NV.FrontmatterService}async fixMissingLabel(e){let t=await this.vault.read(e);if(this.hasNonEmptyLabel(t))return;let r=this.frontmatterService.updateProperty(t,"exo__Asset_label",e.basename);r!==t&&await this.vault.modify(e,r)}hasNonEmptyLabel(e){let t=this.frontmatterService.parse(e);if(!t.exists)return!1;let r=t.content.match(/^exo__Asset_label:\s*(.*)$/m);if(!r)return!1;let i=r[1].trim();return!(i===""||i==='""'||i==="''")}};Hi.FixMissingLabelService=Z1;Hi.FixMissingLabelService=Z1=OV([(0,rC.injectable)(),FV(0,(0,rC.inject)(LV.DI_TOKENS.IVaultAdapter)),DV("design:paramtypes",[Object])],Z1)});var iC=w(Eo=>{"use strict";var kV=Eo&&Eo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},MV=Eo&&Eo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.GraphQueryService=void 0;var jV=je(),ed=Oe(),$V=qe(),oa=Jt(),UV=Gb(),As={INSTANCE_CLASS:oa.Namespace.EXO.term("Instance_class"),ASSET_LABEL:oa.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:oa.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:oa.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:oa.Namespace.EMS.term("Effort_parent"),REFERENCES:oa.Namespace.EXO.term("references"),REFERENCED_BY:oa.Namespace.EXO.term("referencedBy"),RDF_TYPE:oa.Namespace.RDF.term("type")},ev=class{static{a(this,"GraphQueryService")}constructor(e,t={},r){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.logger=r,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),o=Date.now()-t;return o>100&&r.length>0&&this.logger?.debug(`GraphQueryService: loaded ${r.length} nodes in ${o}ms (${(o/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,o=s?i.slice(0,t):i,c=await this.loadEdges(o,e);return{nodes:o,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,o=[{id:e,currentDepth:0}],c=[];for(;o.length>0&&c.length<i;){let u=o.shift();if(!u)break;let{id:f,currentDepth:d}=u;if(s.has(f))continue;s.add(f);let h=await this.getNodeById(f,t);if(h&&(c.push(h),d<r)){let p=await this.getConnectedNodeIds(f);for(let y of p)s.has(y)||o.push({id:y,currentDepth:d+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:o.length>0,totalCount:s.size+o.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 o=this.triplesToNode(e,s,t);return o&&this.cacheNode(o),o}subscribe(e){return this.subscribers.add(e),{unsubscribe:a(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){this.logger?.error("GraphQueryService: error in subscriber callback",r instanceof Error?r:new Error(String(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,As.INSTANCE_CLASS,void 0),o=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);o=s.filter(y=>{let g=this.getObjectValue(y.object);return g&&p.has(g)})}let c=new Set;for(let p of o)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(o=>o.id)),i=[],s=new Set;for(let o of e){let c=this.idToIRI(o.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(o.id,u,r);f&&f.id&&!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 o of i){let c=this.objectToId(o.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let o of s)r.push(this.subjectToId(o.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,o,c,l,u=!1;for(let h of t){let p=h.predicate.value,y=this.getObjectValue(h.object);if(p===As.INSTANCE_CLASS.value)s=y;else if(p===As.ASSET_LABEL.value)o=y;else if(p===As.ASSET_PROTOTYPE.value)c=this.objectToId(h.object)??y;else if(p===As.EFFORT_PARENT.value)l=this.objectToId(h.object)??y;else if(p===As.ASSET_IS_ARCHIVED.value)u=y==="true"||y==="1";else{let g=this.predicateToPropertyName(p);g&&(i[g]=y)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),d=o??this.pathToTitle(f);return{id:e,path:f,title:d,label:d,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 o=this.predicateToEdgeType(i);if(!o)return null;let c=(0,UV.createEdgeId)(e,s,o,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:o,predicate:i,label:l}}predicateToEdgeType(e){return e===As.EFFORT_PARENT.value?"hierarchy":e===As.ASSET_PROTOTYPE.value?"prototype":e===As.REFERENCES.value?"forward-link":e===As.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,o=new Map;for(let c of t)o.set(c.source,(o.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=o.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 ed.IRI(e):new ed.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof ed.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof ed.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof $V.Literal||e instanceof ed.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()}};Eo.GraphQueryService=ev;Eo.GraphQueryService=ev=kV([(0,jV.injectable)(),MV("design:paramtypes",[Object,Object,Object])],ev)});var oC=w(To=>{"use strict";var BV=To&&To.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},VV=To&&To.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(To,"__esModule",{value:!0});To.TypeRegistry=void 0;var GV=je(),Is=Oe(),sC=Bt(),qV=qe(),WV=ra(),yt=qb(),tv=class{static{a(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:yt.DEFAULT_NODE_STYLE,defaultEdgeStyle:yt.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 o=s.shift();if(!o)break;let{uri:c,currentDepth:l}=o;if(i.has(c)||(i.add(c),l>=t))continue;let u=this.typeHierarchy.get(c)??[];for(let f of u)i.has(f)||(r.push(f),s.push({uri:f,currentDepth:l+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?.[yt.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 o=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:o,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 o of e){let c=this.nodeTypes.get(o);c&&s.push(c)}if(s.sort((o,c)=>o.priority-c.priority),t)for(let o of s)i=(0,yt.mergeNodeStyles)(i,o.style);else if(s.length>0){let o=s[s.length-1];i=(0,yt.mergeNodeStyles)(i,o.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,yt.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(o=>i.types.includes(o)||t.includeInferred&&this.isSubtypeOf(i.primaryType,o))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(o=>i.types.includes(o)||t.includeInferred&&this.isSubtypeOf(i.primaryType,o))||!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:o=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let h of e){let p=this.resolveNodeType(h),y;if(l?y=l(p.types):s&&p.types.length>o?y=p.types[o]??p.primaryType:i?y=p.primaryType:y="all",!u.has(y)){let _=this.nodeTypes.get(y)?.label??(0,yt.extractLocalName)(y);u.set(y,{nodeIds:new Set,label:_})}let g=u.get(y);g&&g.nodeIds.add(h.id)}let f=Array.from(u.entries()).map(([h,p])=>({id:h,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((y,g)=>g.nodeIds.length-y.nodeIds.length);let h=f.slice(0,c-1),p=f.slice(c-1).flatMap(y=>y.nodeIds);h.push({id:"other",label:"Other",nodeIds:p}),f=h}let d=new Map;for(let h of f)for(let p of h.nodeIds)d.set(p,h.id);return f.map((h,p)=>{let y=new Set(h.nodeIds),g=[],v=[];for(let T of t){let I=y.has(T.source),A=y.has(T.target);I&&A?T.id&&g.push(T.id):(I||A)&&T.id&&v.push(T.id)}let S=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:h.id,label:h.label,nodeIds:h.nodeIds,internalEdgeIds:g,externalEdgeIds:v,color:S,stats:{nodeCount:h.nodeIds.length,internalEdgeCount:g.length,externalEdgeCount:v.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let o=this.resolveNodeType(s);if(o.primaryType!=="unknown"){let c=this.nodeTypes.get(o.primaryType);!c&&o.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${o.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 "${o.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 o=s.predicate??s.type,c=this.edgeTypes.get(o);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(d=>u.types.includes(d))||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(d=>u.types.includes(d))||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 Is.IRI(yt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,yt.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new Is.IRI(yt.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 o=this.typeHierarchy.get(i)??[];if(!o.includes(s)){o.push(s),this.typeHierarchy.set(i,o);let c=this.nodeTypes.get(i);c&&(c.parentTypes=o)}}}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(yt.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,yt.extractLocalName)(e),source:"custom",style:(0,yt.mergeNodeStyles)(yt.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(yt.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,yt.extractLocalName)(e),source:"custom",style:(0,yt.mergeEdgeStyles)(yt.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new Is.IRI(e),new Is.IRI(yt.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new Is.IRI(e),new Is.IRI(yt.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,yt.extractLocalName)(e):(0,yt.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,o="rdfs:Class",c=await this.tripleStore.match(new Is.IRI(e),new Is.IRI(yt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===yt.RDF_TYPE_PREDICATES.OWL_CLASS){o="owl:Class";break}let l=yt.BUILT_IN_NODE_STYLES[e]??yt.BUILT_IN_NODE_STYLES[(0,yt.extractLocalName)(e)],u={uri:e,label:i,description:s,source:o,style:(0,yt.mergeNodeStyles)(yt.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 Is.IRI)return e.value;if(e instanceof sC.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof qV.Literal||e instanceof Is.IRI)return e.value;if(e instanceof sC.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()){let i=this.typeHierarchy.get(r);(!i||i.length===0)&&e.has(r)&&t.push(r)}return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){WV.LoggingService.error("TypeRegistry: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}}};To.TypeRegistry=tv;To.TypeRegistry=tv=BV([(0,GV.injectable)(),VV("design:paramtypes",[Object,Object])],tv)});var rv=w(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.SPARQL_TEMPLATES=X.KNOWN_CLASSES=X.KNOWN_PROTOTYPES=X.EFFORT_STATUSES=X.ASSET_CLASSES=X.PREDICATES=X.SPARQL_PREFIXES=void 0;X.findClassByTerm=zV;X.getTemplateByName=HV;X.findMatchingTemplates=KV;X.fillTemplate=QV;X.validateParameters=XV;X.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
210
+ ---`)}};Vi.AssetConversionService=V1;Vi.AssetConversionService=V1=iV([(0,zP.injectable)(),oV(0,(0,zP.inject)(cV.DI_TOKENS.IVaultAdapter)),sV("design:paramtypes",[Object])],V1)});var z1=w(Gi=>{"use strict";var lV=Gi&&Gi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},uV=Gi&&Gi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},KP=Gi&&Gi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Gi,"__esModule",{value:!0});Gi.SessionEventService=void 0;var q1=je(),fV=Ai(),QP=qo(),dV=kn(),hV=ho(),XP=qt(),W1=class{static{a(this,"SessionEventService")}constructor(e,t){this.vault=e,this.vaultSettings=t,this.folderPathCache=null}async createSessionStartEvent(e){return this.createSessionEvent(e,QP.AssetClass.SESSION_START_EVENT)}async createSessionEndEvent(e){return this.createSessionEvent(e,QP.AssetClass.SESSION_END_EVENT)}getSessionEventFolder(){if(this.folderPathCache!==null)return this.folderPathCache;let e=this.vault.getDefaultNewFileParent();return this.folderPathCache=e?.path||"",this.folderPathCache}async createSessionEvent(e,t){let r=(0,fV.v4)(),i=dV.DateFormatter.toLocalTimestamp(new Date),s={exo__Asset_uid:r,exo__Asset_createdAt:i,exo__Asset_isDefinedBy:this.vaultSettings.getOwnerIdentity(),exo__Instance_class:[`"[[${t}]]"`],ems__SessionEvent_timestamp:i,ems__Session_area:`"[[${e}]]"`},o=hV.MetadataHelpers.buildFileContent(s),c=this.getSessionEventFolder();c&&!await this.vault.exists(c)&&await this.vault.createFolder(c);let l=c?`${c}/${r}.md`:`${r}.md`;return await this.vault.create(l,o)}};Gi.SessionEventService=W1;Gi.SessionEventService=W1=lV([(0,q1.injectable)(),KP(0,(0,q1.inject)(XP.DI_TOKENS.IVaultAdapter)),KP(1,(0,q1.inject)(XP.DI_TOKENS.IVaultSettings)),uV("design:paramtypes",[Object,Object])],W1)});var Q1=w(qi=>{"use strict";var pV=qi&&qi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},mV=qi&&qi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},YP=qi&&qi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(qi,"__esModule",{value:!0});qi.URIConstructionService=void 0;var H1=je(),JP=qt(),gV=rl(),K1=class{static{a(this,"URIConstructionService")}constructor(e,t=gV.NullLogger){this.fileSystem=e,this.logger=t,this.defaultOntologyURL="https://exocortex.my/default/",this.strictValidation=!0}configure(e){e?.defaultOntologyURL&&(this.defaultOntologyURL=e.defaultOntologyURL),e?.strictValidation!==void 0&&(this.strictValidation=e.strictValidation)}async constructAssetURI(e){let t=this.extractUID(e);if(!t){if(this.strictValidation)throw new Error(`Asset missing exo__Asset_uid: ${e.path}`);return this.logger.warn(`Asset ${e.path} missing UID, using filename fallback`),this.constructFallbackURI(e)}let r=await this.resolveOntologyURL(e);if(!this.validateOntologyURL(r))throw new Error(`Invalid ontology URL: ${r}`);return`${r.endsWith("/")?r:`${r}/`}${t}`}validateOntologyURL(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async resolveOntologyURL(e){let t=e.frontmatter?.exo__Asset_isDefinedBy;if(!t||typeof t!="string")return this.defaultOntologyURL;let r=this.extractWikiLink(t),i=r,s=await this.fileSystem.fileExists(r);return!s&&!r.endsWith(".md")&&(i=`${r}.md`,s=await this.fileSystem.fileExists(i)),s?(await this.fileSystem.getFileMetadata(i))?.exo__Ontology_url||this.defaultOntologyURL:(this.logger.warn(`Ontology file not found: ${r}, using default`),this.defaultOntologyURL)}extractUID(e){let t=e.frontmatter?.exo__Asset_uid;return typeof t=="string"?t:null}extractWikiLink(e){return e.replace(/^\[\[|\]\]$/g,"")}constructFallbackURI(e){let t=e.path.split("/").pop()?.replace(".md","")||"unknown";return`${this.defaultOntologyURL}${t}`}};qi.URIConstructionService=K1;qi.URIConstructionService=K1=pV([(0,H1.injectable)(),YP(0,(0,H1.inject)(JP.DI_TOKENS.IFileSystemAdapter)),YP(1,(0,H1.inject)(JP.DI_TOKENS.ILogger)),mV("design:paramtypes",[Object,Object])],K1)});var Y1=w(Wi=>{"use strict";var yV=Wi&&Wi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},bV=Wi&&Wi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},_V=Wi&&Wi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Wi,"__esModule",{value:!0});Wi.GenericAssetCreationService=void 0;var ZP=je(),Zf=kn(),SV=ho(),wV=eo(),vV=Jt(),EV=qt(),As=lp(),TV=qf(),AV=km(),X1=class{static{a(this,"GenericAssetCreationService")}constructor(e){this.vault=e,this.clock=(0,TV.liveClock)(),this.uidGen=(0,AV.liveUidGenerator)()}withDeterminism(e){return e.clock&&(this.clock=e.clock),e.uidGenerator&&(this.uidGen=e.uidGenerator),this}async createAsset(e,t){let{folderPath:r,path:i,content:s}=this.buildAsset(e,t);return this.vault.getAbstractFileByPath(r)||await this.vault.createFolder(r),await this.vault.create(i,s)}buildAsset(e,t){let r=this.uidGen.next(),i=this.generateFrontmatter(e,t||[],r),s=SV.MetadataHelpers.buildFileContent(i,e.body),o=e.folderPath||this.getDefaultFolderPath(e),c=`${r}.md`,l=o?`${o}/${c}`:c;return{uid:r,folderPath:o,path:l,frontmatter:i,content:s}}generateFrontmatter(e,t=[],r=this.uidGen.next()){let i={},s=new Map;for(let c of t)s.set(c.name,c.fieldType);i.exo__Asset_uid=r,i.exo__Asset_createdAt=e.timezone?this.generateTimestampInTimezone(e.timezone):Zf.DateFormatter.toLocalTimestamp(this.clock.now());let o=e.classRefForm==="uuid"&&e.classUid?e.classUid:e.className;if(i.exo__Instance_class=[this.formatWikilink(o)],e.createdBy&&e.createdBy.trim()!==""&&(i.exo__Asset_createdBy=this.formatWikilink(e.createdBy.trim())),e.label&&e.label.trim()!==""){let c=e.label.trim();i.exo__Asset_label=c;let l=[c];if(e.aliases)for(let u of e.aliases)l.includes(u)||l.push(u);i.aliases=l}if(e.parentFile&&e.parentMetadata&&this.inheritParentContext(i,e),e.propertyValues){for(let[c,l]of Object.entries(e.propertyValues))if(!(c==="exo__Asset_uid"||c==="exo__Asset_createdAt"||c==="exo__Asset_createdBy"||c==="exo__Instance_class"||c==="exo__Asset_label"||c==="aliases")&&l!=null)if(e.shapeRegistry!==void 0)i[c]=this.formatPropertyValueWithCardinality(c,String(l),e.shapeRegistry);else{let u=s.get(c);i[c]=this.formatValue(l,u)}}return i}inheritParentContext(e,t){let r=t.parentMetadata||{},i=t.parentFile?.basename;if(t.className==="ems__Task"||t.className.startsWith("ems__Task")){let s=r.exo__Instance_class,c=this.isAreaClass(s,t.classResolver)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(t.className==="ems__Project"||t.className.startsWith("ems__Project")){let s=r.exo__Instance_class,c=this.isAreaClass(s,t.classResolver)?"ems__Effort_area":"ems__Effort_parent";e[c]=i?this.formatWikilink(i):null}if(r.exo__Asset_isDefinedBy){let s=r.exo__Asset_isDefinedBy;e.exo__Asset_isDefinedBy=typeof s=="string"?this.formatWikilink(s):s}}isAreaClass(e,t){if(!e)return!1;let r=Array.isArray(e)?e:[e],i=a(()=>null,"noopResolver");return r.some(s=>{let o=wV.WikiLinkHelpers.resolveSymbolic(String(s),t??i);return o.includes("Area")||o.includes("ems__Area")})}getDefaultFolderPath(e){if(e.parentFile?.parent?.path)return e.parentFile.parent.path;let t={ems__Task:"tasks",ems__Project:"projects",ems__Area:"areas",ems__Meeting:"meetings",exo__Event:"events",ims__Concept:"concepts"};if(t[e.className])return t[e.className];for(let[r,i]of Object.entries(t))if(e.className.startsWith(r))return i;return"assets"}formatValue(e,t){if(e==null)return null;if(!t)return this.formatInferredValue(e);switch(t){case As.PropertyFieldType.Text:return String(e);case As.PropertyFieldType.Wikilink:case As.PropertyFieldType.Reference:case As.PropertyFieldType.StatusSelect:case As.PropertyFieldType.SizeSelect:return this.formatWikilink(String(e));case As.PropertyFieldType.Number:return typeof e=="number"?e:Number(e)||0;case As.PropertyFieldType.Boolean:return this.formatBoolean(e);case As.PropertyFieldType.Date:case As.PropertyFieldType.DateTime:case As.PropertyFieldType.Timestamp:return this.formatTimestamp(e);default:return String(e)}}formatInferredValue(e){return typeof e=="boolean"||typeof e=="number"?e:e instanceof Date?Zf.DateFormatter.toLocalTimestamp(e):typeof e=="string"?e.startsWith("[[")||e.startsWith('"[[')?this.formatWikilink(e):e:String(e)}formatWikilink(e){return e.startsWith('"[[')&&e.endsWith(']]"')?e:e.startsWith("[[")&&e.endsWith("]]")?`"${e}"`:`"[[${e}]]"`}formatBoolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"}return typeof e=="number"?e!==0:!!e}formatTimestamp(e){if(e instanceof Date)return Zf.DateFormatter.toLocalTimestamp(e);if(typeof e=="string"){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))return e;if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e.replace("Z","");let t=new Date(e);return isNaN(t.getTime())?e:Zf.DateFormatter.toLocalTimestamp(t)}if(typeof e=="number"){let t=new Date(e);if(!isNaN(t.getTime()))return Zf.DateFormatter.toLocalTimestamp(t)}return String(e)}formatPropertyValueWithCardinality(e,t,r){if(!t.includes("[["))return t;let i=t.startsWith('"')&&t.endsWith('"')?t:`"${t}"`;return this.shouldEmitAsArray(e,r)?[i]:i}shouldEmitAsArray(e,t){if(!t)return!1;let r=vV.Namespace.fromPropertyKey(e);if(!r)return!1;let i=r.namespace.term(r.localName).value;return t.get(i)?.cardinality==="Multiple"}generateTimestampInTimezone(e){let t=this.clock.now(),i=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(t),s=a(o=>i.find(c=>c.type===o)?.value||"00","get");return`${s("year")}-${s("month")}-${s("day")}T${s("hour")}:${s("minute")}:${s("second")}`}};Wi.GenericAssetCreationService=X1;Wi.GenericAssetCreationService=X1=yV([(0,ZP.injectable)(),_V(0,(0,ZP.inject)(EV.DI_TOKENS.IVaultAdapter)),bV("design:paramtypes",[Object])],X1)});var tC=w(zi=>{"use strict";var IV=zi&&zi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},xV=zi&&zi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},RV=zi&&zi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(zi,"__esModule",{value:!0});zi.ArchiveAssetService=void 0;var eC=je(),PV=qt(),CV=vs(),J1=class{static{a(this,"ArchiveAssetService")}constructor(e){this.vault=e,this.frontmatterService=new CV.FrontmatterService}async archiveAsset(e){let t=await this.vault.read(e),r=this.frontmatterService.updateProperty(t,"archived","true");r=this.frontmatterService.removeProperty(r,"aliases"),r!==t&&await this.vault.modify(e,r)}};zi.ArchiveAssetService=J1;zi.ArchiveAssetService=J1=IV([(0,eC.injectable)(),RV(0,(0,eC.inject)(PV.DI_TOKENS.IVaultAdapter)),xV("design:paramtypes",[Object])],J1)});var nC=w(Hi=>{"use strict";var OV=Hi&&Hi.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},DV=Hi&&Hi.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},FV=Hi&&Hi.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Hi,"__esModule",{value:!0});Hi.FixMissingLabelService=void 0;var rC=je(),LV=qt(),NV=vs(),Z1=class{static{a(this,"FixMissingLabelService")}constructor(e){this.vault=e,this.frontmatterService=new NV.FrontmatterService}async fixMissingLabel(e){let t=await this.vault.read(e);if(this.hasNonEmptyLabel(t))return;let r=this.frontmatterService.updateProperty(t,"exo__Asset_label",e.basename);r!==t&&await this.vault.modify(e,r)}hasNonEmptyLabel(e){let t=this.frontmatterService.parse(e);if(!t.exists)return!1;let r=t.content.match(/^exo__Asset_label:\s*(.*)$/m);if(!r)return!1;let i=r[1].trim();return!(i===""||i==='""'||i==="''")}};Hi.FixMissingLabelService=Z1;Hi.FixMissingLabelService=Z1=OV([(0,rC.injectable)(),FV(0,(0,rC.inject)(LV.DI_TOKENS.IVaultAdapter)),DV("design:paramtypes",[Object])],Z1)});var iC=w(Eo=>{"use strict";var kV=Eo&&Eo.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},MV=Eo&&Eo.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.GraphQueryService=void 0;var jV=je(),ed=Oe(),$V=qe(),oa=Jt(),UV=Gb(),Is={INSTANCE_CLASS:oa.Namespace.EXO.term("Instance_class"),ASSET_LABEL:oa.Namespace.EXO.term("Asset_label"),ASSET_PROTOTYPE:oa.Namespace.EXO.term("Asset_prototype"),ASSET_IS_ARCHIVED:oa.Namespace.EXO.term("Asset_isArchived"),EFFORT_PARENT:oa.Namespace.EMS.term("Effort_parent"),REFERENCES:oa.Namespace.EXO.term("references"),REFERENCED_BY:oa.Namespace.EXO.term("referencedBy"),RDF_TYPE:oa.Namespace.RDF.term("type")},ev=class{static{a(this,"GraphQueryService")}constructor(e,t={},r){this.subscribers=new Set,this.nodeCache=new Map,this.lastCacheUpdate=0,this.tripleStore=e,this.logger=r,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),o=Date.now()-t;return o>100&&r.length>0&&this.logger?.debug(`GraphQueryService: loaded ${r.length} nodes in ${o}ms (${(o/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,o=s?i.slice(0,t):i,c=await this.loadEdges(o,e);return{nodes:o,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,o=[{id:e,currentDepth:0}],c=[];for(;o.length>0&&c.length<i;){let u=o.shift();if(!u)break;let{id:f,currentDepth:d}=u;if(s.has(f))continue;s.add(f);let h=await this.getNodeById(f,t);if(h&&(c.push(h),d<r)){let p=await this.getConnectedNodeIds(f);for(let y of p)s.has(y)||o.push({id:y,currentDepth:d+1})}}let l=await this.loadEdges(c,t);return{nodes:c,edges:l,hasMore:o.length>0,totalCount:s.size+o.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 o=this.triplesToNode(e,s,t);return o&&this.cacheNode(o),o}subscribe(e){return this.subscribers.add(e),{unsubscribe:a(()=>{this.subscribers.delete(e)},"unsubscribe")}}notifyChange(e){for(let t of this.subscribers)try{t(e)}catch(r){this.logger?.error("GraphQueryService: error in subscriber callback",r instanceof Error?r:new Error(String(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,Is.INSTANCE_CLASS,void 0),o=s;if(e.classes&&e.classes.length>0){let p=new Set(e.classes);o=s.filter(y=>{let g=this.getObjectValue(y.object);return g&&p.has(g)})}let c=new Set;for(let p of o)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(o=>o.id)),i=[],s=new Set;for(let o of e){let c=this.idToIRI(o.id),l=await this.tripleStore.match(c,void 0,void 0);for(let u of l){let f=this.tripleToEdge(o.id,u,r);f&&f.id&&!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 o of i){let c=this.objectToId(o.object);c&&r.push(c)}let s=await this.tripleStore.match(void 0,void 0,t);for(let o of s)r.push(this.subjectToId(o.subject));return[...new Set(r)]}triplesToNode(e,t,r){let i={},s,o,c,l,u=!1;for(let h of t){let p=h.predicate.value,y=this.getObjectValue(h.object);if(p===Is.INSTANCE_CLASS.value)s=y;else if(p===Is.ASSET_LABEL.value)o=y;else if(p===Is.ASSET_PROTOTYPE.value)c=this.objectToId(h.object)??y;else if(p===Is.EFFORT_PARENT.value)l=this.objectToId(h.object)??y;else if(p===Is.ASSET_IS_ARCHIVED.value)u=y==="true"||y==="1";else{let g=this.predicateToPropertyName(p);g&&(i[g]=y)}}if(u&&!(r.includeArchived??this.config.includeArchivedByDefault))return null;let f=this.idToPath(e),d=o??this.pathToTitle(f);return{id:e,path:f,title:d,label:d,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 o=this.predicateToEdgeType(i);if(!o)return null;let c=(0,UV.createEdgeId)(e,s,o,i),l=this.predicateToLabel(i);return{id:c,source:e,target:s,type:o,predicate:i,label:l}}predicateToEdgeType(e){return e===Is.EFFORT_PARENT.value?"hierarchy":e===Is.ASSET_PROTOTYPE.value?"prototype":e===Is.REFERENCES.value?"forward-link":e===Is.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,o=new Map;for(let c of t)o.set(c.source,(o.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=o.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 ed.IRI(e):new ed.IRI(`obsidian://vault/${encodeURIComponent(e)}`)}subjectToId(e){if(e instanceof ed.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return e.toString()}objectToId(e){if(e instanceof ed.IRI){let t=e.value;return t.startsWith("obsidian://vault/")?decodeURIComponent(t.replace("obsidian://vault/","")):t}return null}getObjectValue(e){if(e instanceof $V.Literal||e instanceof ed.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()}};Eo.GraphQueryService=ev;Eo.GraphQueryService=ev=kV([(0,jV.injectable)(),MV("design:paramtypes",[Object,Object,Object])],ev)});var oC=w(To=>{"use strict";var BV=To&&To.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},VV=To&&To.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(To,"__esModule",{value:!0});To.TypeRegistry=void 0;var GV=je(),xs=Oe(),sC=Bt(),qV=qe(),WV=ra(),yt=qb(),tv=class{static{a(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:yt.DEFAULT_NODE_STYLE,defaultEdgeStyle:yt.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 o=s.shift();if(!o)break;let{uri:c,currentDepth:l}=o;if(i.has(c)||(i.add(c),l>=t))continue;let u=this.typeHierarchy.get(c)??[];for(let f of u)i.has(f)||(r.push(f),s.push({uri:f,currentDepth:l+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?.[yt.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 o=this.resolveNodeStyle(t);return{primaryType:r,types:t,resolvedStyle:o,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 o of e){let c=this.nodeTypes.get(o);c&&s.push(c)}if(s.sort((o,c)=>o.priority-c.priority),t)for(let o of s)i=(0,yt.mergeNodeStyles)(i,o.style);else if(s.length>0){let o=s[s.length-1];i=(0,yt.mergeNodeStyles)(i,o.style)}return i}resolveEdgeStyle(e){let{defaultEdgeStyle:t}=this.config.styleResolution,r={...t},i=this.edgeTypes.get(e);return i&&(r=(0,yt.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(o=>i.types.includes(o)||t.includeInferred&&this.isSubtypeOf(i.primaryType,o))||t.excludeNodeTypes&&t.excludeNodeTypes.length>0&&t.excludeNodeTypes.some(o=>i.types.includes(o)||t.includeInferred&&this.isSubtypeOf(i.primaryType,o))||!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:o=0,maxGroups:c=20,customGroupFn:l}=r,u=new Map;for(let h of e){let p=this.resolveNodeType(h),y;if(l?y=l(p.types):s&&p.types.length>o?y=p.types[o]??p.primaryType:i?y=p.primaryType:y="all",!u.has(y)){let _=this.nodeTypes.get(y)?.label??(0,yt.extractLocalName)(y);u.set(y,{nodeIds:new Set,label:_})}let g=u.get(y);g&&g.nodeIds.add(h.id)}let f=Array.from(u.entries()).map(([h,p])=>({id:h,label:p.label,nodeIds:Array.from(p.nodeIds)}));if(f.length>c){f.sort((y,g)=>g.nodeIds.length-y.nodeIds.length);let h=f.slice(0,c-1),p=f.slice(c-1).flatMap(y=>y.nodeIds);h.push({id:"other",label:"Other",nodeIds:p}),f=h}let d=new Map;for(let h of f)for(let p of h.nodeIds)d.set(p,h.id);return f.map((h,p)=>{let y=new Set(h.nodeIds),g=[],v=[];for(let T of t){let I=y.has(T.source),A=y.has(T.target);I&&A?T.id&&g.push(T.id):(I||A)&&T.id&&v.push(T.id)}let S=`hsl(${p*137.5%360}, 70%, 50%)`;return{id:h.id,label:h.label,nodeIds:h.nodeIds,internalEdgeIds:g,externalEdgeIds:v,color:S,stats:{nodeCount:h.nodeIds.length,internalEdgeCount:g.length,externalEdgeCount:v.length}}})}validateTypes(e,t){let r=[],i=[];for(let s of e){let o=this.resolveNodeType(s);if(o.primaryType!=="unknown"){let c=this.nodeTypes.get(o.primaryType);!c&&o.source!=="inferred"&&i.push({code:"UNREGISTERED_NODE_TYPE",message:`Node type "${o.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 "${o.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 o=s.predicate??s.type,c=this.edgeTypes.get(o);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(d=>u.types.includes(d))||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(d=>u.types.includes(d))||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 xs.IRI(yt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let r of e){let i=this.getObjectValue(r.object);if(i&&(0,yt.isClassType)(i)){let s=this.getSubjectValue(r.subject);s&&await this.discoverNodeType(s)}}let t=await this.tripleStore.match(void 0,new xs.IRI(yt.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 o=this.typeHierarchy.get(i)??[];if(!o.includes(s)){o.push(s),this.typeHierarchy.set(i,o);let c=this.nodeTypes.get(i);c&&(c.parentTypes=o)}}}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(yt.BUILT_IN_NODE_STYLES))this.nodeTypes.set(e,{uri:e,label:(0,yt.extractLocalName)(e),source:"custom",style:(0,yt.mergeNodeStyles)(yt.DEFAULT_NODE_STYLE,t),priority:1});for(let[e,t]of Object.entries(yt.BUILT_IN_EDGE_STYLES))this.edgeTypes.set(e,{uri:e,label:(0,yt.extractLocalName)(e),source:"custom",style:(0,yt.mergeEdgeStyles)(yt.DEFAULT_EDGE_STYLE,t),priority:1})}async discoverNodeType(e){if(this.nodeTypes.has(e)||!this.tripleStore)return;let t=await this.tripleStore.match(new xs.IRI(e),new xs.IRI(yt.RDF_TYPE_PREDICATES.RDFS_LABEL),void 0),r=await this.tripleStore.match(new xs.IRI(e),new xs.IRI(yt.RDF_TYPE_PREDICATES.RDFS_COMMENT),void 0),i=t.length>0?this.getObjectValue(t[0].object)??(0,yt.extractLocalName)(e):(0,yt.extractLocalName)(e),s=r.length>0?this.getObjectValue(r[0].object):void 0,o="rdfs:Class",c=await this.tripleStore.match(new xs.IRI(e),new xs.IRI(yt.RDF_TYPE_PREDICATES.RDF_TYPE),void 0);for(let f of c)if(this.getObjectValue(f.object)===yt.RDF_TYPE_PREDICATES.OWL_CLASS){o="owl:Class";break}let l=yt.BUILT_IN_NODE_STYLES[e]??yt.BUILT_IN_NODE_STYLES[(0,yt.extractLocalName)(e)],u={uri:e,label:i,description:s,source:o,style:(0,yt.mergeNodeStyles)(yt.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 xs.IRI)return e.value;if(e instanceof sC.BlankNode)return`_:${e.id}`;if(typeof e=="object"&&e!==null&&"termType"in e)return e.toString()}getObjectValue(e){if(e instanceof qV.Literal||e instanceof xs.IRI)return e.value;if(e instanceof sC.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()){let i=this.typeHierarchy.get(r);(!i||i.length===0)&&e.has(r)&&t.push(r)}return t}emit(e){for(let t of this.subscribers)try{t(e)}catch(r){WV.LoggingService.error("TypeRegistry: error in subscriber callback",r instanceof Error?r:new Error(String(r)))}}};To.TypeRegistry=tv;To.TypeRegistry=tv=BV([(0,GV.injectable)(),VV("design:paramtypes",[Object,Object])],tv)});var rv=w(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.SPARQL_TEMPLATES=X.KNOWN_CLASSES=X.KNOWN_PROTOTYPES=X.EFFORT_STATUSES=X.ASSET_CLASSES=X.PREDICATES=X.SPARQL_PREFIXES=void 0;X.findClassByTerm=zV;X.getTemplateByName=HV;X.findMatchingTemplates=KV;X.fillTemplate=QV;X.validateParameters=XV;X.SPARQL_PREFIXES=`PREFIX exo: <https://exocortex.my/ontology/exo#>
211
211
  PREFIX ems: <https://exocortex.my/ontology/ems#>
212
212
  PREFIX ims: <https://exocortex.my/ontology/ims#>
213
213
  PREFIX gtd: <https://exocortex.my/ontology/gtd#>
@@ -371,8 +371,8 @@ ORDER BY ?label
371
371
  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),o=s.filter(c=>r[c.name]&&r[c.name].length>0);s.length>0?i+=o.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[...It.SPARQL_TEMPLATES]}getTemplate(e){return(0,It.getTemplateByName)(e)}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}addTemplate(e){It.SPARQL_TEMPLATES.push(e),eG.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))}};li.NLToSPARQLService=nv;li.NLToSPARQLService=nv=YV([(0,ZV.injectable)(),JV("design:paramtypes",[Object])],nv)});var sv=w(Yr=>{"use strict";var tG=Yr&&Yr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},rG=Yr&&Yr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},nG=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 cC=je(),iG=vs(),sG=qt();Yr.CriticalityZoneUUIDs={TODAY:"e266a2e9-9eb0-431d-b1fe-b95b9d3e9a3f",THIS_WEEK:"c7f1a968-0959-4ac7-ac82-31b0cdc2aba7",SOMEDAY:"6968a0fc-7a41-4393-82b1-17d767c7ad7c"};var iv=class{static{a(this,"CriticalityZoneService")}constructor(e){this.vault=e,this.frontmatterService=new iG.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=iv;Yr.CriticalityZoneService=iv=tG([(0,cC.injectable)(),nG(0,(0,cC.inject)(sG.DI_TOKENS.IVaultAdapter)),rG("design:paramtypes",[Object])],iv)});var lC=w(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});og.EffortSortingHelpers=void 0;var ov=class n{static{a(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",o=i==="00:00:00";return s&&!o?1:!s&&o?-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}};og.EffortSortingHelpers=ov});var uC=w(ag=>{"use strict";Object.defineProperty(ag,"__esModule",{value:!0});ag.FilenameValidator=void 0;var mc=class{static{a(this,"FilenameValidator")}static validate(e,t={}){let{maxLength:r=this.DEFAULT_MAX_LENGTH,replacementChar:i=this.DEFAULT_REPLACEMENT,allowEmpty:s=!1}=t,o=[];if(!e||e.trim().length===0)return s||o.push("Filename cannot be empty"),{valid:o.length===0,sanitized:"",errors:o};e.endsWith(" ")&&o.push("Filename should not end with a space");let c=e.trim();this.INVALID_CHARS_PATTERN.test(c)&&o.push('Filename contains invalid characters: / \\ : * ? " < > |');let l=this.getBaseName(c);this.RESERVED_NAMES.has(l.toUpperCase())&&o.push(`"${l}" is a reserved filename on Windows`),c.length>r&&o.push(`Filename exceeds maximum length of ${r} characters`),c.startsWith(".")&&o.push("Filename should not start with a dot"),c.endsWith(".")&&o.push("Filename should not end with a dot");let u=this.sanitize(e,{maxLength:r,replacementChar:i});return{valid:o.length===0,sanitized:u,errors:o}}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 o=this.getBaseName(s);if(this.RESERVED_NAMES.has(o.toUpperCase())){let c=this.getExtension(s);s=o+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)}};ag.FilenameValidator=mc;mc.INVALID_CHARS_PATTERN=/[/\\:*?"<>|\x00-\x1F]/g;mc.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"]);mc.DEFAULT_MAX_LENGTH=200;mc.DEFAULT_REPLACEMENT="_"});var cv=w(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});cg.NTriplesSerializer=void 0;var av=class{static{a(this,"NTriplesSerializer")}serialize(e,t={}){let r=t.newline??`
372
372
  `;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}};cg.NTriplesSerializer=av});var fC=w(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});lg.TurtleSerializer=void 0;var zl=Jt(),oG=cv(),aG={rdf:zl.Namespace.RDF.iri.value,rdfs:zl.Namespace.RDFS.iri.value,owl:zl.Namespace.OWL.iri.value,xsd:zl.Namespace.XSD.iri.value,exo:zl.Namespace.EXO.iri.value,ems:zl.Namespace.EMS.iri.value},lv=class{static{a(this,"TurtleSerializer")}constructor(){this.nTriplesSerializer=new oG.NTriplesSerializer}serialize(e,t={}){let r=t.newline??`
373
373
  `,i=this.composePrefixes(t),s=this.serializePrefixes(i,r),o=this.nTriplesSerializer.serialize(e,{newline:r}).trimEnd();return s?o?`${s}${r}${r}${o}${r}`:`${s}${r}`:o?`${o}${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?{...aG,...e.prefixes??{}}:{...e.prefixes??{}}}serializeTriplesOnly(e,t){return this.nTriplesSerializer.serializeChunk(e,t).trimEnd()}};lg.TurtleSerializer=lv});var pC=w(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});ug.JSONLDSerializer=void 0;var dC=Oe(),hC=Bt(),cG=qe(),Hl=Jt(),lG={rdf:Hl.Namespace.RDF.iri.value,rdfs:Hl.Namespace.RDFS.iri.value,owl:Hl.Namespace.OWL.iri.value,xsd:Hl.Namespace.XSD.iri.value,exo:Hl.Namespace.EXO.iri.value,ems:Hl.Namespace.EMS.iri.value},uv=class{static{a(this,"JSONLDSerializer")}toDocument(e,t={}){let r={...lG,...t.context??{}},i=new Map;for(let s of e){let o=this.subjectToId(s.subject),c=this.compactIri(s.predicate.value,r),l=this.objectToJSONLD(s.object,r),u=i.get(o)??{"@id":o},f=u[c];f===void 0?u[c]=l:Array.isArray(f)?f.push(l):u[c]=[f,l],i.set(o,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 dC.IRI?e.value:e instanceof hC.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 dC.IRI)return{"@id":e.value};if(e instanceof hC.BlankNode)return{"@id":`_:${e.id}`};if(e instanceof cG.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}};ug.JSONLDSerializer=uv});var hv=w(fg=>{"use strict";Object.defineProperty(fg,"__esModule",{value:!0});fg.NTriplesParser=void 0;var uG=Wn(),mC=Oe(),fv=qe(),fG=Bt(),Kl=Jt(),dG={rdf:Kl.Namespace.RDF.iri.value,rdfs:Kl.Namespace.RDFS.iri.value,owl:Kl.Namespace.OWL.iri.value,xsd:Kl.Namespace.XSD.iri.value,exo:Kl.Namespace.EXO.iri.value,ems:Kl.Namespace.EMS.iri.value},dv=class{static{a(this,"NTriplesParser")}parse(e,t={}){let r={prefixes:{...dG,...t.prefixes??{}},strict:t.strict??!1},i=[];return e.split(/\r?\n/).forEach((o,c)=>{let l=o.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(),o=this.parseSubject(s,t,r);s=o.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 uG.Triple(o.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,o,c]=i,l=r.prefixes[s];if(!l)throw new Error(`Unknown prefix "${s}" at line ${t}`);return{node:new mC.IRI(`${l}${o}`),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),o=new mC.IRI(s),c=e.slice(i+1).trimStart();return{node:o,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 fG.BlankNode(i),rest:(s??"").trimStart()}}consumeLiteral(e,t,r){let{value:i,rest:s}=this.consumeQuotedString(e,t),o=s.trimStart();if(o.startsWith("^^")){o=o.slice(2).trimStart();let c=o.startsWith("<")?this.consumeIRI(o,t,r):this.consumePrefixedName(o,t,r);return{node:new fv.Literal(i,c.node),rest:c.rest}}if(o.startsWith("@")){let c=o.match(/^@([a-zA-Z-]+)(?:\s+(.*))?$/);if(!c)throw new Error(`Invalid language tag at line ${t}`);let[,l,u]=c;return{node:new fv.Literal(i,void 0,l),rest:(u??"").trimStart()}}return{node:new fv.Literal(i),rest:o}}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 o=e[i+1];switch(o){case"t":r+=" ",i+=1;break;case"b":r+="\b",i+=1;break;case"n":r+=`
374
- `,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 \\${o} at line ${t}`)}continue}if(s==='"'){let o=e.slice(i+1);return{value:r,rest:o}}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 o=e[s];if(o===t){i++;continue}if(o===r&&(i--,i===0))return s}return-1}};fg.NTriplesParser=dv});var gC=w(dg=>{"use strict";Object.defineProperty(dg,"__esModule",{value:!0});dg.TurtleParser=void 0;var Ql=Jt(),hG=hv(),pG={rdf:Ql.Namespace.RDF.iri.value,rdfs:Ql.Namespace.RDFS.iri.value,owl:Ql.Namespace.OWL.iri.value,xsd:Ql.Namespace.XSD.iri.value,exo:Ql.Namespace.EXO.iri.value,ems:Ql.Namespace.EMS.iri.value},mG=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,pv=class{static{a(this,"TurtleParser")}constructor(){this.nTriplesParser=new hG.NTriplesParser}parse(e,t={}){let r={...pG,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:o,lineNumber:c})=>{if(this.isPrefixStatement(o)){let u=o.match(mG);if(!u)throw new Error(`Invalid prefix declaration at line ${c}`);let[,f,d]=u;r[f]=d;return}if(o.includes(";")||o.includes(","))throw new Error(`Complex Turtle statements with ';' or ',' are not supported (line ${c})`);let l=this.normalizeShortcuts(o);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((o,c)=>{let l=o.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}};dg.TurtleParser=pv});var yC=w(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0});hg.RDFSerializer=void 0;var Xl=Wn(),gc=Oe(),yc=qe(),mv=Bt(),xs=Jt(),gG=fC(),yG=cv(),bG=pC(),_G=gC(),SG=hv(),wG=1024,vG=`
375
- `,EG={rdf:xs.Namespace.RDF.iri.value,rdfs:xs.Namespace.RDFS.iri.value,owl:xs.Namespace.OWL.iri.value,xsd:xs.Namespace.XSD.iri.value,exo:xs.Namespace.EXO.iri.value,ems:xs.Namespace.EMS.iri.value},gv=class{static{a(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new gG.TurtleSerializer,this.nTriplesSerializer=new yG.NTriplesSerializer,this.jsonldSerializer=new bG.JSONLDSerializer,this.turtleParser=new _G.TurtleParser,this.nTriplesParser=new SG.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??vG,i=t.batchSize??wG,s=t.includeDefaultPrefixes,o=t.prefixes,c=this,l=!1,u=[],f=[],d=0,h=a(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let y=c.jsonldSerializer.toDocument(f,{context:o,pretty:!1});u.push(...c.buildJsonLdChunks(y))}else if(e==="turtle"){let y=c.turtleSerializer.serializePrefixes(c.composePrefixes(o,s),r);y&&u.push(`${y}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await h(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(d>=f.length)return{value:void 0,done:!0};let y=f.slice(d,d+i);d+=y.length;let g="";if(e==="turtle"){let v=c.turtleSerializer.serializeTriplesOnly(y,r);v&&(g=`${v}${r}`)}else e==="n-triples"&&(g=c.nTriplesSerializer.serializeChunk(y,r));return g?{value:g,done:!1}:this.next()},async return(){return u=[],f=[],d=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?{...EG,...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),o={...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 d=this.parseSubjectFromNode(u,o,f),h=Object.entries(u);for(let[p,y]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,y,l,o);continue}let g=this.expandTerm(p,o),v=new gc.IRI(g);this.collectTriplesForValue(d,v,y,l,o)}}),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 mv.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new gc.IRI(i);let s=this.expandTerm(i,t);return new gc.IRI(s)}return new mv.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=xs.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 Xl.Triple(e,s,new gc.IRI(l)))})}collectTriplesForValue(e,t,r,i,s){if(r!=null){if(Array.isArray(r)){r.forEach(o=>this.collectTriplesForValue(e,t,o,i,s));return}if(typeof r=="object"){let o=r;if(typeof o["@id"]=="string"){let c=this.parseIdNode(o["@id"],s);i.push(new Xl.Triple(e,t,c));return}if(o["@value"]!==void 0){let c=this.parseLiteralObject(o,s);i.push(new Xl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new Xl.Triple(e,t,new yc.Literal(r)));return}if(typeof r=="number"){let o=Number.isInteger(r)?xs.Namespace.XSD.term("integer"):xs.Namespace.XSD.term("decimal");i.push(new Xl.Triple(e,t,new yc.Literal(r.toString(),o)));return}if(typeof r=="boolean"){let o=xs.Namespace.XSD.term("boolean");i.push(new Xl.Triple(e,t,new yc.Literal(r.toString(),o)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new mv.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new gc.IRI(e);let r=this.expandTerm(e,t);return new gc.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 yc.Literal(r,void 0,e["@language"],i):new yc.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new yc.Literal(r,new gc.IRI(i))}return new yc.Literal(r)}expandTerm(e,t){if(this.isAbsoluteIri(e))return e;let r=e.indexOf(":");if(r>0){let s=e.slice(0,r),o=e.slice(r+1),c=t[s];if(!c)throw new Error(`Unknown prefix "${s}" in JSON-LD document`);return`${c}${o}`}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 o=JSON.stringify(i);s>0?t.push(`,${o}`):t.push(o)}),t.push(`]}
374
+ `,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 \\${o} at line ${t}`)}continue}if(s==='"'){let o=e.slice(i+1);return{value:r,rest:o}}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 o=e[s];if(o===t){i++;continue}if(o===r&&(i--,i===0))return s}return-1}};fg.NTriplesParser=dv});var gC=w(dg=>{"use strict";Object.defineProperty(dg,"__esModule",{value:!0});dg.TurtleParser=void 0;var Ql=Jt(),hG=hv(),pG={rdf:Ql.Namespace.RDF.iri.value,rdfs:Ql.Namespace.RDFS.iri.value,owl:Ql.Namespace.OWL.iri.value,xsd:Ql.Namespace.XSD.iri.value,exo:Ql.Namespace.EXO.iri.value,ems:Ql.Namespace.EMS.iri.value},mG=/^@prefix\s+([a-zA-Z_][\w-]*):\s*<([^>]+)>\s*\.$/,pv=class{static{a(this,"TurtleParser")}constructor(){this.nTriplesParser=new hG.NTriplesParser}parse(e,t={}){let r={...pG,...t.prefixes??{}},i=this.collectStatements(e),s=[];return i.forEach(({statement:o,lineNumber:c})=>{if(this.isPrefixStatement(o)){let u=o.match(mG);if(!u)throw new Error(`Invalid prefix declaration at line ${c}`);let[,f,d]=u;r[f]=d;return}if(o.includes(";")||o.includes(","))throw new Error(`Complex Turtle statements with ';' or ',' are not supported (line ${c})`);let l=this.normalizeShortcuts(o);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((o,c)=>{let l=o.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}};dg.TurtleParser=pv});var yC=w(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0});hg.RDFSerializer=void 0;var Xl=Wn(),gc=Oe(),yc=qe(),mv=Bt(),Rs=Jt(),gG=fC(),yG=cv(),bG=pC(),_G=gC(),SG=hv(),wG=1024,vG=`
375
+ `,EG={rdf:Rs.Namespace.RDF.iri.value,rdfs:Rs.Namespace.RDFS.iri.value,owl:Rs.Namespace.OWL.iri.value,xsd:Rs.Namespace.XSD.iri.value,exo:Rs.Namespace.EXO.iri.value,ems:Rs.Namespace.EMS.iri.value},gv=class{static{a(this,"RDFSerializer")}constructor(e){this.store=e,this.turtleSerializer=new gG.TurtleSerializer,this.nTriplesSerializer=new yG.NTriplesSerializer,this.jsonldSerializer=new bG.JSONLDSerializer,this.turtleParser=new _G.TurtleParser,this.nTriplesParser=new SG.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??vG,i=t.batchSize??wG,s=t.includeDefaultPrefixes,o=t.prefixes,c=this,l=!1,u=[],f=[],d=0,h=a(async()=>{if(!l){if(f=await c.store.match(),e==="json-ld"){let y=c.jsonldSerializer.toDocument(f,{context:o,pretty:!1});u.push(...c.buildJsonLdChunks(y))}else if(e==="turtle"){let y=c.turtleSerializer.serializePrefixes(c.composePrefixes(o,s),r);y&&u.push(`${y}${r}${r}`)}l=!0}},"ensureInitialized");return{async next(){if(await h(),u.length>0)return{value:u.shift(),done:!1};if(e==="json-ld")return{value:void 0,done:!0};if(d>=f.length)return{value:void 0,done:!0};let y=f.slice(d,d+i);d+=y.length;let g="";if(e==="turtle"){let v=c.turtleSerializer.serializeTriplesOnly(y,r);v&&(g=`${v}${r}`)}else e==="n-triples"&&(g=c.nTriplesSerializer.serializeChunk(y,r));return g?{value:g,done:!1}:this.next()},async return(){return u=[],f=[],d=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?{...EG,...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),o={...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 d=this.parseSubjectFromNode(u,o,f),h=Object.entries(u);for(let[p,y]of h){if(p==="@id"||p==="@context")continue;if(p==="@type"){this.collectTypeTriples(d,y,l,o);continue}let g=this.expandTerm(p,o),v=new gc.IRI(g);this.collectTriplesForValue(d,v,y,l,o)}}),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 mv.BlankNode(i.slice(2));if(this.isAbsoluteIri(i))return new gc.IRI(i);let s=this.expandTerm(i,t);return new gc.IRI(s)}return new mv.BlankNode(`jsonld_${r}`)}collectTypeTriples(e,t,r,i){let s=Rs.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 Xl.Triple(e,s,new gc.IRI(l)))})}collectTriplesForValue(e,t,r,i,s){if(r!=null){if(Array.isArray(r)){r.forEach(o=>this.collectTriplesForValue(e,t,o,i,s));return}if(typeof r=="object"){let o=r;if(typeof o["@id"]=="string"){let c=this.parseIdNode(o["@id"],s);i.push(new Xl.Triple(e,t,c));return}if(o["@value"]!==void 0){let c=this.parseLiteralObject(o,s);i.push(new Xl.Triple(e,t,c));return}}if(typeof r=="string"){i.push(new Xl.Triple(e,t,new yc.Literal(r)));return}if(typeof r=="number"){let o=Number.isInteger(r)?Rs.Namespace.XSD.term("integer"):Rs.Namespace.XSD.term("decimal");i.push(new Xl.Triple(e,t,new yc.Literal(r.toString(),o)));return}if(typeof r=="boolean"){let o=Rs.Namespace.XSD.term("boolean");i.push(new Xl.Triple(e,t,new yc.Literal(r.toString(),o)));return}throw new Error("Unsupported JSON-LD value encountered")}}parseIdNode(e,t){if(e.startsWith("_:"))return new mv.BlankNode(e.slice(2));if(this.isAbsoluteIri(e))return new gc.IRI(e);let r=this.expandTerm(e,t);return new gc.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 yc.Literal(r,void 0,e["@language"],i):new yc.Literal(r,void 0,e["@language"])}if(typeof e["@type"]=="string"){let i=this.expandTerm(e["@type"],t);return new yc.Literal(r,new gc.IRI(i))}return new yc.Literal(r)}expandTerm(e,t){if(this.isAbsoluteIri(e))return e;let r=e.indexOf(":");if(r>0){let s=e.slice(0,r),o=e.slice(r+1),c=t[s];if(!c)throw new Error(`Unknown prefix "${s}" in JSON-LD document`);return`${c}${o}`}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 o=JSON.stringify(i);s>0?t.push(`,${o}`):t.push(o)}),t.push(`]}
376
376
  `),t}};hg.RDFSerializer=gv});var yv=w(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.OBSIDIAN_VAULT_SCHEME=void 0;Ao.vaultPathToIRI=TG;Ao.iriToVaultPath=AG;Ao.OBSIDIAN_VAULT_SCHEME="obsidian://vault/";function TG(n){let e=n.startsWith("./")?n.slice(2):n;return`${Ao.OBSIDIAN_VAULT_SCHEME}${encodeURI(e)}`}a(TG,"vaultPathToIRI");function AG(n){if(!n.startsWith(Ao.OBSIDIAN_VAULT_SCHEME))return null;let e=n.slice(Ao.OBSIDIAN_VAULT_SCHEME.length);try{return decodeURI(e)}catch{return null}}a(AG,"iriToVaultPath")});var _v=w(pg=>{"use strict";Object.defineProperty(pg,"__esModule",{value:!0});pg.RDFVocabularyMapper=void 0;var or=Wn(),bC=Oe(),ce=Jt(),bv=class{static{a(this,"RDFVocabularyMapper")}constructor(){this.propertyMappings=new Map([["exo__Instance_class",ce.Namespace.RDF.term("type")],["exo__Asset_isDefinedBy",ce.Namespace.RDFS.term("isDefinedBy")],["exo__Class_superClass",ce.Namespace.RDFS.term("subClassOf")],["exo__Property_range",ce.Namespace.RDFS.term("range")],["exo__Property_domain",ce.Namespace.RDFS.term("domain")],["exo__Property_superProperty",ce.Namespace.RDFS.term("subPropertyOf")]])}generateClassHierarchyTriples(){let e=[];return e.push(new or.Triple(ce.Namespace.EXO.term("Asset"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.RDFS.term("Resource"))),e.push(new or.Triple(ce.Namespace.EXO.term("Class"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.RDFS.term("Class"))),e.push(new or.Triple(ce.Namespace.EXO.term("Property"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.RDF.term("Property"))),e.push(new or.Triple(ce.Namespace.EMS.term("Task"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EMS.term("Project"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EMS.term("Area"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EMS.term("Workflow"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EMS.term("WorkflowState"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EMS.term("WorkflowTransition"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EXOCMD.term("Command"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EXOCMD.term("Precondition"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EXOCMD.term("Grounding"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e.push(new or.Triple(ce.Namespace.EXOCMD.term("CommandBinding"),ce.Namespace.RDFS.term("subClassOf"),ce.Namespace.EXO.term("Asset"))),e}generatePropertyHierarchyTriples(){let e=[];return e.push(new or.Triple(ce.Namespace.EXO.term("Instance_class"),ce.Namespace.RDFS.term("subPropertyOf"),ce.Namespace.RDF.term("type"))),e.push(new or.Triple(ce.Namespace.EXO.term("Asset_isDefinedBy"),ce.Namespace.RDFS.term("subPropertyOf"),ce.Namespace.RDFS.term("isDefinedBy"))),e.push(new or.Triple(ce.Namespace.EXO.term("Class_superClass"),ce.Namespace.RDFS.term("subPropertyOf"),ce.Namespace.RDFS.term("subClassOf"))),e.push(new or.Triple(ce.Namespace.EXO.term("Property_range"),ce.Namespace.RDFS.term("subPropertyOf"),ce.Namespace.RDFS.term("range"))),e.push(new or.Triple(ce.Namespace.EXO.term("Property_domain"),ce.Namespace.RDFS.term("subPropertyOf"),ce.Namespace.RDFS.term("domain"))),e.push(new or.Triple(ce.Namespace.EXO.term("Property_superProperty"),ce.Namespace.RDFS.term("subPropertyOf"),ce.Namespace.RDFS.term("subPropertyOf"))),e}generateMappedTriple(e,t,r){let i=this.propertyMappings.get(t);if(!i)return null;let s;if(r instanceof bC.IRI)s=r;else{let o=r.match(/^(ems|exo|exocmd)__(.+)$/);if(o){let[,c,l]=o;s=(c==="ems"?ce.Namespace.EMS:c==="exocmd"?ce.Namespace.EXOCMD:ce.Namespace.EXO).term(l)}else s=new bC.IRI(r)}return new or.Triple(e,i,s)}hasMappingFor(e){return this.propertyMappings.has(e)}};pg.RDFVocabularyMapper=bv});var _C=w(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});gg.RDFSInferenceEngine=void 0;var IG=Wn(),mg=Oe(),Sv=class{static{a(this,"RDFSInferenceEngine")}async materialize(e){let t=await e.predicates(),r=t.find(d=>d.value.includes("Class_superClass")),i=t.find(d=>d.value.includes("Instance_class"));if(!r||!i)return 0;let s=await this.buildDirectParentMap(e,r);if(s.size===0)return 0;let o=this.computeAllAncestors(s),c=await e.count(),l=await e.match(void 0,i),u=[];for(let d of l)if(d.object instanceof mg.IRI){let h=o.get(d.object.value);if(h)for(let p of h)u.push(new IG.Triple(d.subject,i,new mg.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 mg.IRI&&s.object instanceof mg.IRI){let o=s.subject.value,c=s.object.value;i.has(o)||i.set(o,new Set),i.get(o).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=[],o=t.get(e);if(o)for(let c of o)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}};gg.RDFSInferenceEngine=Sv});var Ev=w(bc=>{"use strict";var xG=bc&&bc.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(bc,"__esModule",{value:!0});bc.NonInheritablePropertyRegistry=void 0;var RG=je(),SC=Oe(),wC=qe(),wv=Jt(),vv=class{static{a(this,"NonInheritablePropertyRegistry")}constructor(){this.nonInheritableIRIs=new Set,this.initialized=!1}async initialize(e){this.nonInheritableIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Instance_class"));if(!r){this.initialized=!0;return}let i=await this.findNonInheritableClassIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let o=t.find(c=>c.value.includes("Asset_label"));if(!o){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,o,void 0);for(let u of l)if(u.object instanceof wC.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.nonInheritableIRIs.add(d)}}}catch{}this.initialized=!0}isNonInheritable(e){return this.nonInheritableIRIs.has(e)}get size(){return this.nonInheritableIRIs.size}get isInitialized(){return this.initialized}async findNonInheritableClassIRI(e,t){let r=t.find(o=>o.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new wC.Literal("exo__NonInheritableProperty"));if(i.length>0&&i[0].subject instanceof SC.IRI)return i[0].subject;let s=t.find(o=>o.value.includes("Instance_class"));if(s){let o=await e.match(void 0,s,void 0);for(let c of o)if(c.object instanceof SC.IRI&&c.object.value.includes("NonInheritableProperty"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?wv.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?wv.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?wv.Namespace.EXOCMD.term(e.substring(8)).value:null}};bc.NonInheritablePropertyRegistry=vv;bc.NonInheritablePropertyRegistry=vv=xG([(0,RG.injectable)()],vv)});var Iv=w(_c=>{"use strict";var PG=_c&&_c.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};Object.defineProperty(_c,"__esModule",{value:!0});_c.PropertyCardinalityRegistry=void 0;var CG=je(),vC=Oe(),EC=qe(),Tv=Jt(),Av=class{static{a(this,"PropertyCardinalityRegistry")}constructor(){this.multiValuedIRIs=new Set,this.initialized=!1}async initialize(e){this.multiValuedIRIs.clear();try{let t=await e.predicates(),r=t.find(c=>c.value.includes("Property_cardinality"));if(!r){this.initialized=!0;return}let i=await this.findMultipleCardinalityIRI(e,t);if(!i){this.initialized=!0;return}let s=await e.match(void 0,r,i);if(s.length===0){this.initialized=!0;return}let o=t.find(c=>c.value.includes("Asset_label"));if(!o){this.initialized=!0;return}for(let c of s){let l=await e.match(c.subject,o,void 0);for(let u of l)if(u.object instanceof EC.Literal){let f=u.object.value,d=this.propertyKeyToIRI(f);d&&this.multiValuedIRIs.add(d)}}}catch{}this.initialized=!0}isMultiValued(e){return this.multiValuedIRIs.has(e)}get size(){return this.multiValuedIRIs.size}get isInitialized(){return this.initialized}async findMultipleCardinalityIRI(e,t){let r=t.find(o=>o.value.includes("Asset_label"));if(!r)return null;let i=await e.match(void 0,r,new EC.Literal("exo__PropertyCardinalityMultiple"));if(i.length>0&&i[0].subject instanceof vC.IRI)return i[0].subject;let s=t.find(o=>o.value.includes("Instance_class"));if(s){let o=await e.match(void 0,s,void 0);for(let c of o)if(c.object instanceof vC.IRI&&c.object.value.includes("PropertyCardinalityMultiple"))return c.object}return null}propertyKeyToIRI(e){return e.startsWith("exo__")?Tv.Namespace.EXO.term(e.substring(5)).value:e.startsWith("ems__")?Tv.Namespace.EMS.term(e.substring(5)).value:e.startsWith("exocmd__")?Tv.Namespace.EXOCMD.term(e.substring(8)).value:null}};_c.PropertyCardinalityRegistry=Av;_c.PropertyCardinalityRegistry=Av=PG([(0,CG.injectable)()],Av)});var Pv=w(Er=>{"use strict";var OG=Er&&Er.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},DG=Er&&Er.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Er,"__esModule",{value:!0});Er.PrototypeChainMaterializer=Er.MAX_PROTOTYPE_DEPTH=Er.INFERRED_GRAPH=void 0;Er.inferredGraphForDepth=xv;var FG=je(),TC=Wn(),aa=Oe(),LG=Ev(),NG=Iv();Er.INFERRED_GRAPH=new aa.IRI("https://exocortex.my/ontology/exo#inferred");var kG="https://exocortex.my/ontology/exo#inferred/";function xv(n){return new aa.IRI(`${kG}${n}`)}a(xv,"inferredGraphForDepth");Er.MAX_PROTOTYPE_DEPTH=10;var Rv=class{static{a(this,"PrototypeChainMaterializer")}constructor(e,t){this.registry=e,this.cardinalityRegistry=t??null}async materialize(e){let r=(await e.predicates()).find(c=>c.value.includes("Asset_prototype"));if(!r)return 0;let i=await e.match(void 0,r,void 0);if(i.length===0)return 0;let s=new Map;for(let c of i)if(c.subject instanceof aa.IRI&&c.object instanceof aa.IRI){let l=c.subject.value,u=c.object.value;l!==u&&s.set(l,c.object)}if(s.size===0)return 0;let o=0;for(let[c]of s){let l=new aa.IRI(c),u=this.resolveChain(c,s);if(u.length===0)continue;let f=await e.match(l,void 0,void 0),d=new Set,h=new Map;for(let p of f)if(d.add(p.predicate.value),this.isMultiValued(p.predicate.value)){let y=p.object instanceof aa.IRI?p.object.value:String(p.object),g=h.get(p.predicate.value);g||(g=new Set,h.set(p.predicate.value,g)),g.add(y)}for(let p=0;p<u.length;p++){let y=u[p],g=p+1,v=new aa.IRI(y),_=await e.match(v,void 0,void 0),S=new Set;if(e.matchInGraph){let T=await e.matchInGraph(v,void 0,void 0,Er.INFERRED_GRAPH);for(let I of T)S.add(I.predicate.value)}for(let T of _){let I=T.predicate.value;if(this.registry.isNonInheritable(I)||S.has(I))continue;if(d.has(I)&&this.isMultiValued(I)){let R=T.object instanceof aa.IRI?T.object.value:String(T.object);if(h.get(I)?.has(R))continue;let Y=h.get(I);Y||(Y=new Set,h.set(I,Y)),Y.add(R);let C=new TC.Triple(l,T.predicate,T.object);await e.add(C),e.addToGraph&&(await e.addToGraph(C,Er.INFERRED_GRAPH),await e.addToGraph(C,xv(g))),o++;continue}if(d.has(I))continue;let A=new TC.Triple(l,T.predicate,T.object);await e.add(A),e.addToGraph&&(await e.addToGraph(A,Er.INFERRED_GRAPH),await e.addToGraph(A,xv(g))),d.add(I),o++}}}return o}isMultiValued(e){return this.cardinalityRegistry?this.cardinalityRegistry.isMultiValued(e):!1}resolveChain(e,t){let r=[],i=new Set;i.add(e);let s=[],o=t.get(e);for(o&&s.push(o.value);s.length>0&&r.length<Er.MAX_PROTOTYPE_DEPTH;){let c=s.shift();if(c===void 0)break;if(i.has(c))continue;i.add(c),r.push(c);let l=t.get(c);l&&!i.has(l.value)&&s.push(l.value)}return r}};Er.PrototypeChainMaterializer=Rv;Er.PrototypeChainMaterializer=Rv=OG([(0,FG.injectable)(),DG("design:paramtypes",[LG.NonInheritablePropertyRegistry,NG.PropertyCardinalityRegistry])],Rv)});var IC=w(bg=>{"use strict";Object.defineProperty(bg,"__esModule",{value:!0});bg.IRICanonicalizer=void 0;var AC=Oe(),MG=qe(),jG=Bt(),$G=Wn(),Cv=/^obsidian:\/\/vault\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i,yg=class n{static{a(this,"IRICanonicalizer")}static extractSynthAUid(e){let t=Cv.exec(e);return t?t[1].toLowerCase():null}static canonicalize(e,t){if(t.size===0)return{triples:e,remapCount:0,uniqueRemapCount:0};let r=new Map,i=new Set,s=0;return{triples:e.map(c=>{let l=n.remapIfSynthA(c.subject,t,r,i),u=n.remapIfSynthA(c.object,t,r,i);return l===c.subject&&u===c.object?c:(s++,new $G.Triple(l,c.predicate,u))}),remapCount:s,uniqueRemapCount:i.size}}static remapIfSynthA(e,t,r,i){if(e instanceof MG.Literal||e instanceof jG.BlankNode||!(e instanceof AC.IRI))return e;let s=Cv.exec(e.value);if(!s)return e;let o=s[1].toLowerCase(),c=t.get(o);if(!c||c===e.value)return e;i.add(o);let l=r.get(c);return l||(l=new AC.IRI(c),r.set(c,l)),l}};bg.IRICanonicalizer=yg;yg.SYNTH_A_IRI_PATTERN=Cv});var Sg=w(_g=>{"use strict";Object.defineProperty(_g,"__esModule",{value:!0});_g.derivePath=PC;_g.deriveLegacyFlatPath=UG;var RC="assetspaces",xC=/^[A-Za-z0-9._-]+$/;function PC(n){if(typeof n!="string")return null;let e=n.trim();if(e.length===0||/^file:\/\//i.test(e))return null;e=e.replace(/\/+$/,""),e=e.replace(/\.git$/i,"");let t=null;if(!e.includes("://")){let o=/^[^/@\s]+@[^/:\s]+:(.+)$/.exec(e);o&&(t=o[1])}if(t===null){let o=e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"");o=o.replace(/^[^/@]+@/,"");let c=o.indexOf("/");if(c<0)return null;t=o.slice(c+1)}let r=t.split("/").filter(o=>o.length>0);if(r.length<2)return null;let i=r[0],s=r[1];return i==="."||i===".."||s==="."||s===".."||!xC.test(i)||!xC.test(s)?null:`${RC}/${i}/${s}`}a(PC,"derivePath");function UG(n){let e=PC(n);if(e===null)return null;let t=e.split("/")[2];if(t===void 0||t.length===0)return null;let r=t.startsWith("exoas-")?t.slice(6):t;return r.length===0?null:`${RC}/${r}`}a(UG,"deriveLegacyFlatPath")});var wg=w(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.FILE_SPACE_CLASS_UID=void 0;Ki.frontmatterDeclaresFileSpace=VG;Ki.discoverFileSpaceExclusions=qG;var BG=Sg();Ki.FILE_SPACE_CLASS_UID="aad8913e-5e9f-4047-879d-93cc46befd52";var CC=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,Ov=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(n){let e=Array.isArray(n)?n:[n],t=[];for(let r of e){if(typeof r!="string")continue;CC.lastIndex=0;let i;for(;(i=CC.exec(r))!==null;)t.push(i[1].trim())}return t}a(DC,"wikilinkTargets");function VG(n){return n?DC(n.exo__Instance_class).some(e=>Ov.test(e)&&e.toLowerCase()===Ki.FILE_SPACE_CLASS_UID):!1}a(VG,"frontmatterDeclaresFileSpace");function OC(n,e){try{return n.getFrontmatter(e)}catch{return null}}a(OC,"readFrontmatterSafe");function GG(n){let e=n.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=n.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(GG,"readSource");function qG(n){let e=[],t=[],r=[],i=new Map,s=a((c,l)=>{if(Ov.test(c))return c.toLowerCase()===Ki.FILE_SPACE_CLASS_UID;let u=n.getFirstLinkpathDest(c,l);if(u==null)return!1;let f=i.get(u.path);if(f!==void 0)return f;let h=OC(n,u)?.exo__Asset_uid,p=typeof h=="string"&&h.toLowerCase()===Ki.FILE_SPACE_CLASS_UID;return i.set(u.path,p),p},"isFileSpaceClassRef"),o=a(c=>c.some(l=>Ov.test(l)&&l.toLowerCase()===Ki.FILE_SPACE_CLASS_UID),"hasUuidFormRef");for(let c of n.getAllFiles()){let l=OC(n,c);if(!l)continue;let u=DC(l.exo__Instance_class);if(!u.some(p=>s(p,c.path)))continue;t.push(c.path),o(u)||r.push(`FileSpace declaration ${c.path} references the class via a label-form link only \u2014 the sync layer will not pick it up; use the UUID-form wikilink [[${Ki.FILE_SPACE_CLASS_UID}]] (UID-canon)`);let f=GG(l);if(f===null){r.push(`FileSpace declaration ${c.path} has no exo__AssetSpace_source/_git \u2014 mount path underivable, content NOT excluded from the index`);continue}let d=(0,BG.derivePath)(f);if(d===null){r.push(`FileSpace declaration ${c.path}: cannot derive mount path from source "${f}" \u2014 content NOT excluded from the index`);continue}let h=`${d}/`;c.path.startsWith(h)&&r.push(`FileSpace declaration ${c.path} lies INSIDE its own mount ${h} \u2014 it will be excluded from the index together with the content; move the declaration outside the mount folder`),e.push(h)}return{prefixes:e,declarationPaths:t,warnings:r}}a(qG,"discoverFileSpaceExclusions")});var FC=w(Kn=>{"use strict";var WG=Kn&&Kn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},zG=Kn&&Kn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Kn,"__esModule",{value:!0});Kn.LazyAssetGraphLoader=Kn.MAX_LAZY_DEPTH=void 0;var HG=je(),KG=Oe(),Dv=Jt();Kn.MAX_LAZY_DEPTH=10;var Fv=class{static{a(this,"LazyAssetGraphLoader")}constructor(e,t,r){this.converter=e,this.fileResolver=t,this.store=r,this.loadedIRIs=new Set,this.instanceClassPredicate=Dv.Namespace.EXO.term("Instance_class"),this.superClassPredicate=Dv.Namespace.EXO.term("Class_superClass"),this.prototypePredicate=Dv.Namespace.EXO.term("Asset_prototype")}async ensureFileLoaded(e,t=0){if(t>=Kn.MAX_LAZY_DEPTH)return;let r=this.converter.notePathToIRI(e.path).value;if(!this.loadedIRIs.has(r)){this.loadedIRIs.add(r);try{let i=await this.converter.convertNote(e);if(!this.loadedIRIs.has(r)||(await this.store.addAll(i),!this.loadedIRIs.has(r)))return;await this.walkClassAndPrototypeRelations(i,t+1)}catch(i){throw this.loadedIRIs.delete(r),i}}}async ensureLoadedByIRI(e,t=0){if(t>=Kn.MAX_LAZY_DEPTH||this.loadedIRIs.has(e.value))return;let r=this.fileResolver.resolveByIRI(e);r!==null&&await this.ensureFileLoaded(r,t)}isLoaded(e){return this.loadedIRIs.has(e.value)}forget(e){this.loadedIRIs.delete(e.value)}clearAll(){this.loadedIRIs.clear()}get loadedCount(){return this.loadedIRIs.size}clearForTests(){this.loadedIRIs.clear()}async walkClassAndPrototypeRelations(e,t){let r=[];for(let i of e){if(!(i.object instanceof KG.IRI))continue;let s=i.predicate.value;(s===this.instanceClassPredicate.value||s===this.superClassPredicate.value||s===this.prototypePredicate.value)&&r.push(i.object)}for(let i of r)await this.ensureLoadedByIRI(i,t)}};Kn.LazyAssetGraphLoader=Fv;Kn.LazyAssetGraphLoader=Fv=WG([(0,HG.injectable)(),zG("design:paramtypes",[Object,Object,Object])],Fv)});var Nv=w(yr=>{"use strict";var QG=yr&&yr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},XG=yr&&yr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(yr,"__esModule",{value:!0});yr.SourceAnnotator=yr.DEPTH_VARIABLE=yr.SOURCE_VARIABLE=void 0;var YG=je(),Yl=qe(),JG=Oe(),vg=Pv();yr.SOURCE_VARIABLE="_source";yr.DEPTH_VARIABLE="_depth";var Lv=class{static{a(this,"SourceAnnotator")}constructor(e){this.tripleStore=e}async annotate(e,t,r,i){if(!this.tripleStore.matchInGraph)return e.map(o=>{let c=o.clone();return c.set(yr.SOURCE_VARIABLE,new Yl.Literal("own")),c});let s=[];for(let o of e){let c=o.get(t),l=o.get(r),u=o.get(i),f=o.clone();if(!c||!l||!u)f.set(yr.SOURCE_VARIABLE,new Yl.Literal("own"));else{let d=await this.determineSource(c,l,u);f.set(yr.SOURCE_VARIABLE,new Yl.Literal(d))}s.push(f)}return s}async annotateSingle(e,t,r,i){return(await this.annotate([e],t,r,i))[0]}async determineSource(e,t,r){return this.tripleStore.matchInGraph&&(await this.tripleStore.matchInGraph(e,t,r,vg.INFERRED_GRAPH)).length>0?"inherited":"own"}async getInheritanceDepth(e,t,r){if(!this.tripleStore.matchInGraph)return 0;for(let i=1;i<=vg.MAX_PROTOTYPE_DEPTH;i++){let s=(0,vg.inferredGraphForDepth)(i);if((await this.tripleStore.matchInGraph(e,t,r,s)).length>0)return i}return 0}async annotateBySubject(e,t){if(!this.tripleStore.matchInGraph)return e.map(s=>{let o=s.clone();return o.set(yr.SOURCE_VARIABLE,new Yl.Literal("own")),o});let r=[],i=new Map;for(let s of e){let o=s.get(t),c=s.clone();if(!o||!(o instanceof JG.IRI))c.set(yr.SOURCE_VARIABLE,new Yl.Literal("own"));else{let l=o.value;if(!i.has(l)){let f=await this.tripleStore.matchInGraph(o,void 0,void 0,vg.INFERRED_GRAPH);i.set(l,f.length>0?"inherited":"own")}let u=i.get(l)??"own";c.set(yr.SOURCE_VARIABLE,new Yl.Literal(u))}r.push(c)}return r}};yr.SourceAnnotator=Lv;yr.SourceAnnotator=Lv=QG([(0,YG.injectable)(),XG("design:paramtypes",[Object])],Lv)});var jv=w(Qn=>{"use strict";var ZG=Qn&&Qn.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},eq=Qn&&Qn.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)},LC=Qn&&Qn.__param||function(n,e){return function(t,r){e(t,r,n)}};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.NoteToRDFConverter=void 0;Qn.normaliseExcludedFolders=jC;Qn.isPathExcluded=$C;var kv=je(),ar=Wn(),Qi=Oe(),gn=qe(),NC=Bt(),Qt=Jt(),kC=qt(),tq=_v(),rq=rl(),Mv=yv(),Mn=A_(),nq=wg(),MC=new Set(["archived","draft","pinned","aliases"]);function jC(n){return Array.isArray(n)?n.map(e=>String(e).replace(/\\/g,"/").trim()).filter(e=>e.length>0).map(e=>e.endsWith("/")?e:`${e}/`):[]}a(jC,"normaliseExcludedFolders");function $C(n,e){if(e.length===0)return!1;let t=n.replace(/\\/g,"/");for(let r of e)if(t.startsWith(r))return!0;return!1}a($C,"isPathExcluded");function iq(n){if(!n)return"";let e=n.replace(/\\/g,"/");for(;e.startsWith("/");)e=e.slice(1);for(;e.endsWith("/");)e=e.slice(0,-1);return e.length>0?`${e}/`:""}a(iq,"normaliseSubjectIriPrefix");var Jl=class{static{a(this,"NoteToRDFConverter")}constructor(e,t=rq.NullLogger,r={}){this.vault=e,this.logger=t,this.BODY_WIKILINK_PATTERN=/(?<!!)\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g,this.pendingExtraTriples=[],this.vocabularyMapper=new tq.RDFVocabularyMapper,this.subjectIriPrefix=iq(r.subjectIriPrefix)}async convertNote(e){let t=this.vault.getFrontmatter(e);if(!t)return[];let r=this.notePathToIRI(e.path),i=Qt.Namespace.EXO.term("Asset_filename"),s=new ar.Triple(r,i,new gn.Literal(e.basename));if(Mn.Exo003Parser.isExo003Format(t)){let o=await this.convertExo003Note(e,t);return[s,...o]}return this.convertLegacyNote(e,t,s)}async convertLegacyNote(e,t,r){this.pendingExtraTriples=[];let i=[r],s=this.notePathToIRI(e.path),o,c,l,u=!1,f=Qt.Namespace.EXO.term("Statement").value;for(let[g,v]of Object.entries(t)){let _=MC.has(g)?`exo__Asset_${g}`:g;if(!this.isExocortexProperty(_))continue;let S=this.propertyKeyToIRI(_),T=Array.isArray(v)?v:[v];for(let I of T)if(!((g==="exo__Asset_label"||MC.has(g))&&(I==null||typeof I=="string"&&I.trim()==="")))if(g==="exo__Instance_class"){let A=this.valueToClassURI(I);i.push(new ar.Triple(s,S,A))}else{let A=await this.valueToRDFObject(I,e,S);if(_==="exo__Statement_subject"&&o===void 0){let R=A.find(q=>q instanceof Qi.IRI);R&&(o=R)}else if(_==="exo__Statement_predicate"&&c===void 0){let R=A.find(q=>q instanceof Qi.IRI);R&&(c=R)}else _==="exo__Statement_object"&&l===void 0&&(l=A[0]);for(let R of A)if(i.push(new ar.Triple(s,S,R)),this.vocabularyMapper.hasMappingFor(g)&&R instanceof Qi.IRI){let q=this.vocabularyMapper.generateMappedTriple(s,g,R);q&&i.push(q)}}if(g==="exo__Instance_class")for(let I of T){let A=this.valueToClassURI(I);if(A instanceof Qi.IRI){let R=Qt.Namespace.RDF.term("type");i.push(new ar.Triple(s,R,A)),A.value===f&&(u=!0)}}if(g==="exo__Asset_label"){let I=Qt.Namespace.RDFS.term("label");for(let A of T)typeof A=="string"&&A.length>0&&i.push(new ar.Triple(s,I,new gn.Literal(A)))}}let d="exo__Instance_class"in t||"exo__Asset_uid"in t,h=t.exo__Asset_label,p="exo__Asset_label"in t&&h!==null&&h!==void 0&&!(typeof h=="string"&&h.trim()==="")&&!(Array.isArray(h)&&h.length===0);if(d&&!p){let g=Qt.Namespace.RDFS.term("label"),v=Qt.Namespace.EXO.term("Asset_label"),_=new gn.Literal(e.basename);i.push(new ar.Triple(s,g,_)),i.push(new ar.Triple(s,v,_))}i.push(...this.pendingExtraTriples),this.pendingExtraTriples=[],u&&o&&c&&l&&i.push(new ar.Triple(o,c,l));let y=await this.convertBodyWikilinks(e,s);return i.push(...y),i}async convertExo003Note(e,t){let r=Mn.Exo003Parser.parse(t);if(!r.success||!r.metadata)return[];let i=r.metadata,s=[];switch(i.metadata){case Mn.Exo003MetadataType.Namespace:break;case Mn.Exo003MetadataType.Anchor:s.push(...this.convertExo003Anchor(e,i));break;case Mn.Exo003MetadataType.BlankNode:s.push(...this.convertExo003BlankNode(e,i));break;case Mn.Exo003MetadataType.Statement:s.push(...this.convertExo003Statement(e,i));break;case Mn.Exo003MetadataType.Body:s.push(...await this.convertExo003Body(e,i));break}return s}convertExo003Anchor(e,t){let r=this.notePathToIRI(e.path),i=new Qi.IRI(t.uri);return[new ar.Triple(r,Qt.Namespace.OWL.term("sameAs"),i),new ar.Triple(i,Qt.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 ar.Triple(r,Qt.Namespace.OWL.term("sameAs"),new NC.BlankNode(i))]}convertExo003Statement(e,t){let r=[];try{let i=this.createExo003ReferenceResolver(e),s=Mn.Exo003Parser.toTriple(t,i);r.push(s);let o=this.notePathToIRI(e.path);r.push(new ar.Triple(o,Qt.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),o=this.createExo003ReferenceResolver(e),c=o(t.subject),l=o(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 Qi.IRI(c.value):new NC.BlankNode(c.value),f=new Qi.IRI(l.value),d=Mn.Exo003Parser.toLiteral(t,s.trim());r.push(new ar.Triple(u,f,d));let h=this.notePathToIRI(e.path);r.push(new ar.Triple(h,Qt.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 o=this.vault.getFrontmatter(s);if(o&&Mn.Exo003Parser.isExo003Format(o)){let c=Mn.Exo003Parser.parse(o);if(c.success&&c.metadata){let l=c.metadata;if(l.metadata===Mn.Exo003MetadataType.Anchor||l.metadata===Mn.Exo003MetadataType.Namespace)return{type:"iri",value:l.uri};if(l.metadata===Mn.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(e={}){return(await this.convertVaultWithValidation({strict:!1,excludedFolders:e.excludedFolders})).triples}async convertVaultWithValidation(e={}){let t=this.vault.getAllFiles(),r=[],i=[],s=e.strict??!1,o=0,c=0,l=(0,nq.discoverFileSpaceExclusions)(this.vault);for(let d of l.warnings)this.logger.warn(`FileSpace discovery: ${d}`);let u=[...jC(e.excludedFolders),...l.prefixes],f=u.length===0?t:t.filter(d=>!$C(d.path,u));for(let d of f)try{let h=this.vault.getFrontmatter(d),p=h?this.validateExocortexAsset(h,d.basename):null;if(p){if(s)throw new Error(`Invariant violation in "${d.path}": ${p.message}`);i.push({path:d.path,reason:`Invariant violation: ${p.message}`}),o++,this.logger.info(`Skipping file with invariant violation: ${d.path}`,{code:p.code,property:p.property,reason:p.message});continue}let y=await this.convertNote(d);r.push(...y)}catch(h){let p=h instanceof Error?h.message:String(h);if(s)throw new Error(`Invalid IRI for file "${d.path}": ${p}`);i.push({path:d.path,reason:`Invalid IRI: ${p}`}),c++,this.logger.info(`Skipping file with invalid IRI: ${d.path}`,{reason:p})}return o>0&&this.logger.warn(`Skipped ${o} file${o===1?"":"s"} with invariant violations during indexing (paths in developer console)`,{count:o}),c>0&&this.logger.warn(`Skipped ${c} file${c===1?"":"s"} with invalid IRI during indexing (paths in developer console)`,{count:c}),{triples:r,skippedFiles:i,summary:{total:f.length,indexed:f.length-i.length,skipped:i.length},fileSpaces:l}}static inferLabelFromBasename(e){return Qt.Namespace.fromPropertyKey(e)!==null?e:null}validateExocortexAsset(e,t){let r=a(d=>d==null?!0:typeof d=="string"?d.trim()==="":Array.isArray(d)?d.length===0||d.every(r):!1,"isEmpty");if(!("exo__Instance_class"in e||"exo__Asset_uid"in e))return null;let s=["exo__Asset_uid","exo__Instance_class"];for(let d of s){if(!(d in e))return{code:"MISSING_PROPERTY",property:d,message:`Required property "${d}" is missing`};if(r(e[d]))return{code:"EMPTY_PROPERTY",property:d,message:`Required property "${d}" is empty`}}let o=["ems__Effort_status","ems__Effort_parent","ems__Effort_lockedBy","ems__Effort_lockExpires","exo__Asset_updatedAt","ems__Effort_startTimestamp"];for(let d of o)if(d in e&&r(e[d]))return{code:"EMPTY_OPTIONAL_PROPERTY",property:d,message:`Optional property "${d}" is present but empty`};let c=e.exo__Instance_class,l=Array.isArray(c)?c:[c],u=null,f=!1;for(let d of l){if(typeof d!="string")continue;let h=this.removeQuotes(d),y=(this.extractWikilink(h)??h).trim();/^[a-z][a-zA-Z0-9]*__/.test(y)&&/[\s()]/.test(y)?u||(u={candidate:d}):f=!0}return u&&!f?{code:"INVALID_INSTANCE_CLASS_IRI",property:"exo__Instance_class",message:`Invalid Instance_class IRI: "${u.candidate}"`}:null}async validateVault(){let e=this.vault.getAllFiles(),t=[];for(let r of e){let i=(0,Mv.vaultPathToIRI)(r.path);Qi.IRI.isValidIRI(i)||t.push({path:r.path,reason:`Path "${r.path}" cannot be converted to a valid IRI`})}return t}notePathToIRI(e){return new Qi.IRI((0,Mv.vaultPathToIRI)(`${this.subjectIriPrefix}${e}`))}synthesizeWikilinkTargetIRI(e){return new Qi.IRI((0,Mv.vaultPathToIRI)(e))}isExocortexProperty(e){return Qt.Namespace.fromPropertyKey(e)!==null}propertyKeyToIRI(e){let t=Qt.Namespace.fromPropertyKey(e);if(!t)throw new Error(`Invalid property key: ${e}`);return t.namespace.term(t.localName)}emitTypeTripleForEnumInstance(e,t){let r=this.vault.getFrontmatter(t);if(!r)return;let i=r.exo__Instance_class,s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return;let o=this.valueToClassURI(s);o instanceof Qi.IRI&&(this.pendingExtraTriples.push(new ar.Triple(e,Qt.Namespace.RDF.term("type"),o)),this.pendingExtraTriples.push(new ar.Triple(e,Qt.Namespace.EXO.term("Instance_class"),o)))}async valueToRDFObject(e,t,r){if(typeof e=="string"){let i=this.removeQuotes(e),s=this.extractWikilink(i);if(s){let o=this.vault.getFirstLinkpathDest(s,t.path);if(o){let l=this.notePathToIRI(o.path),u=s.includes("|")?s.split("|")[0]:s;if(this.isUUID(u)){let d=new gn.Literal(u);if(r?.value.endsWith("#Grounding_targetValueRef")||r?.value.endsWith("#Grounding_targetValueSubstitution")||r?.value.endsWith("#Grounding_targetClass")||r?.value.endsWith("#Grounding_type")||r?.value.endsWith("#PropertyDefault_value"))return[l];let p=this.expandClassValue(o.basename);if(p)return this.emitTypeTripleForEnumInstance(p,o),[p];let y=this.vault.getFrontmatter(o);if(y){let T=y.exo__Asset_label;if(typeof T=="string"){let I=this.expandClassValue(T);if(I)return this.emitTypeTripleForEnumInstance(I,o),[I]}}let g=r?.value.endsWith("#Asset_prototype")||r?.value.endsWith("/Asset_prototype"),_=((typeof process<"u"?process.env:void 0)?.EXOCORTEX_DUAL_STORAGE_PREDICATES??"").split(",").map(T=>T.trim()).filter(Boolean),S=_.length>0&&_.some(T=>r?.value.endsWith(`#${T}`));return g||S?[l,d]:[l]}let f=this.expandClassValue(o.basename);return f?(this.emitTypeTripleForEnumInstance(f,o),[f]):[l]}if(this.isClassReference(s)){let l=this.expandClassValue(s);if(l)return[l]}let c=s.includes("|")?s.split("|")[0]:s;return this.isUUID(c)?[this.synthesizeWikilinkTargetIRI(`${c}.md`)]:[new gn.Literal(i)]}if(this.isClassReference(i)){let o=this.expandClassValue(i);if(o)return[o]}return this.isISO8601DateTime(i)?[new gn.Literal(i,Qt.Namespace.XSD.term("dateTime"))]:[new gn.Literal(i)]}return typeof e=="boolean"?[new gn.Literal(e.toString())]:typeof e=="number"?[new gn.Literal(e.toString(),Qt.Namespace.XSD.term("decimal"))]:e instanceof Date?[new gn.Literal(e.toISOString(),Qt.Namespace.XSD.term("dateTime"))]:[new gn.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(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1];return r.includes("|")?r.split("|")[0]:r}extractWikilinkAlias(e){let t=e.match(/^\[\[([^\]]+)\]\]$/);if(!t)return null;let r=t[1],i=r.indexOf("|");return i>=0?r.substring(i+1).trim():null}valueToClassURI(e){if(typeof e!="string")return new gn.Literal(String(e));let t=this.removeQuotes(e),i=this.extractWikilink(t)||t,s=this.expandClassValue(i);if(s)return s;let o=this.extractWikilinkAlias(t);if(o){let c=this.expandClassValue(o);if(c)return c}if(this.isUUID(i)){let c=this.vault.getFirstLinkpathDest(i,"");if(c){let l=this.expandClassValue(c.basename);if(l)return l;let u=this.vault.getFrontmatter(c);if(u){let f=u.exo__Asset_label;if(typeof f=="string"){let d=this.expandClassValue(f);if(d)return d}}return this.notePathToIRI(c.path)}}return new gn.Literal(t)}isClassReference(e){return/\s/.test(e)?!1:Qt.Namespace.fromPropertyKey(e)!==null}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),r=Qt.Namespace.fromPropertyKey(t);return!r||/[\s()]/.test(r.localName)?null:r.namespace.term(r.localName)}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),o=this.extractBodyWikilinks(s),c=Qt.Namespace.EXO.term("Asset_bodyLink");for(let l of o){let u=this.vault.getFirstLinkpathDest(l,e.path);if(u){let f=this.notePathToIRI(u.path);r.push(new ar.Triple(t,c,f))}else if(this.isClassReference(l)){let f=this.expandClassValue(l);f?r.push(new ar.Triple(t,c,f)):r.push(new ar.Triple(t,c,new gn.Literal(l)))}else r.push(new ar.Triple(t,c,new gn.Literal(l)))}}catch{}return r}};Qn.NoteToRDFConverter=Jl;Jl.SkippedFileInfo=class{constructor(n,e){this.path=n,this.reason=e}};Jl.VaultValidationResult=class{constructor(n,e,t){this.triples=n,this.skippedFiles=e,this.summary=t}};Jl.VaultValidationOptions=class{constructor(n=!1){this.strict=n}};Qn.NoteToRDFConverter=Jl=ZG([(0,kv.injectable)(),LC(0,(0,kv.inject)(kC.DI_TOKENS.IVaultAdapter)),LC(1,(0,kv.inject)(kC.DI_TOKENS.ILogger)),eq("design:paramtypes",[Object,Object,Object])],Jl)});var Uv=w(Eg=>{"use strict";Object.defineProperty(Eg,"__esModule",{value:!0});Eg.FilterContainsOptimizer=void 0;var sq=Oe(),oq=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,$v=class{static{a(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(oq);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 sq.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(o=>o.subject.type==="variable"&&o.subject.value===t?{...o,subject:{type:"iri",value:r}}:o);if(i.some((o,c)=>o.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(o=>({[t.variable]:{type:"iri",value:o}}))},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)}};Eg.FilterContainsOptimizer=$v});var UC=w(Tg=>{"use strict";Object.defineProperty(Tg,"__esModule",{value:!0});Tg.AlgebraOptimizer=void 0;var aq=Uv(),Bv=class{static{a(this,"AlgebraOptimizer")}constructor(){this.stats=new Map,this.tripleStore=null,this.filterContainsOptimizer=new aq.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),o=r.every(l=>i.has(l)),c=r.every(l=>s.has(l));return o&&!c?{type:"join",left:{type:"filter",expression:e.expression,input:this.filterPushDown(t.left)},right:this.filterPushDown(t.right)}:c&&!o?{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)}};Tg.AlgebraOptimizer=Bv});var BC=w(Ag=>{"use strict";Object.defineProperty(Ag,"__esModule",{value:!0});Ag.AlgebraSerializer=void 0;var Vv=class{static{a(this,"AlgebraSerializer")}toString(e,t=0){let r=" ".repeat(t);switch(e.type){case"bgp":return`${r}BGP [
377
377
  ${e.triples.map(u=>`${r} ${this.tripleToString(u)}`).join(`
378
378
  `)}
@@ -409,58 +409,58 @@ ${r})`;default:return`${r}Unknown(${e.type})`}}tripleToString(e){return`${this.e
409
409
  `)}termToXML(e){return e instanceof Dg.IRI?`<uri>${this.escapeXML(e.value)}</uri>`:e instanceof Fg.BlankNode?`<bnode>${this.escapeXML(e.id)}</bnode>`:e instanceof Og.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 o of e)for(let c of o.variables())r.add(c);let i=t.variables??Array.from(r).sort(),s=[];s.push(i.map(o=>this.escapeCSV(o)).join(","));for(let o of e){let c=i.map(l=>{let u=o.get(l);return u===void 0?"":this.escapeCSV(this.termToCSV(u))});s.push(c.join(","))}return s.join(`
410
410
  `)}termToCSV(e){return e instanceof Dg.IRI?e.value:e instanceof Fg.BlankNode?`_:${e.id}`:e instanceof Og.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 o of e)for(let c of o.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 o=0;o<e.length;o++){let c=e[o];s.push(`# Solution ${o+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(`
411
411
  `).trimEnd()}termToTurtle(e){return e instanceof Dg.IRI?`<${e.value}>`:e instanceof Fg.BlankNode?`_:${e.id}`:e instanceof Og.Literal?e.toString():`"${String(e)}"`}escapeXML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}escapeCSV(e){return e.includes(",")||e.includes('"')||e.includes(`
412
- `)?`"${e.replace(/"/g,'""')}"`:e}};Lg.ResultSerializer=Qv});var JC=w(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.FileAlreadyExistsError=tu.FileNotFoundError=void 0;var Xv=class extends Error{static{a(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};tu.FileNotFoundError=Xv;var Yv=class extends Error{static{a(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};tu.FileAlreadyExistsError=Yv});var Zv=w(Tr=>{"use strict";var gq=Tr&&Tr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},yq=Tr&&Tr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.VaultSettings=Tr.DEFAULT_FLEETING_NOTE_CLASS_UID=Tr.DEFAULT_INBOX_FOLDER=Tr.DEFAULT_OWNER_IDENTITY=void 0;var bq=je();Tr.DEFAULT_OWNER_IDENTITY='"[[!kitelev]]"';Tr.DEFAULT_INBOX_FOLDER="01 Inbox";Tr.DEFAULT_FLEETING_NOTE_CLASS_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7";var Jv=class{static{a(this,"VaultSettings")}constructor(e){this.ownerIdentity=e?.ownerIdentity??Tr.DEFAULT_OWNER_IDENTITY,this.defaultInboxFolder=e?.defaultInboxFolder??Tr.DEFAULT_INBOX_FOLDER,this.fleetingNoteClassUID=e?.fleetingNoteClassUID??Tr.DEFAULT_FLEETING_NOTE_CLASS_UID}getOwnerIdentity(){return this.ownerIdentity}getDefaultInboxFolder(){return this.defaultInboxFolder}getFleetingNoteClassUID(){return this.fleetingNoteClassUID}};Tr.VaultSettings=Jv;Tr.VaultSettings=Jv=gq([(0,bq.injectable)(),yq("design:paramtypes",[Object])],Jv)});var ZC=w(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.container=void 0;ca.registerCoreServices=Bq;ca.createChildContainer=Vq;ca.getContainer=Gq;ca.resetContainer=qq;wb();var nd=je();Object.defineProperty(ca,"container",{enumerable:!0,get:a(function(){return nd.container},"get")});var Wt=qt(),_q=L1(),Sq=k1(),wq=x1(),vq=a1(),Eq=n1(),Tq=eg(),Aq=rg(),Iq=T1(),xq=P1(),Rq=S1(),Pq=j1(),Cq=z1(),Oq=G1(),Dq=f1(),Fq=h1(),Lq=D1(),Nq=jv(),kq=l1(),Mq=Q1(),jq=Y1(),$q=sv(),Uq=Zv();function Bq(n){let e=n||nd.container;e.registerSingleton(Wt.DI_TOKENS.DynamicFrontmatterGenerator,_q.DynamicFrontmatterGenerator),e.registerSingleton(Wt.DI_TOKENS.AlgorithmExtractor,Sq.AlgorithmExtractor),e.isRegistered(Wt.DI_TOKENS.IVaultSettings)||e.register(Wt.DI_TOKENS.IVaultSettings,{useValue:new Uq.VaultSettings}),e.registerSingleton(Wt.DI_TOKENS.EffortStatusWorkflow,Tq.EffortStatusWorkflow),e.registerSingleton(Wt.DI_TOKENS.StatusTimestampService,Aq.StatusTimestampService),e.registerSingleton(Wt.DI_TOKENS.TaskStatusService,Eq.TaskStatusService),e.registerSingleton(Wt.DI_TOKENS.AreaCreationService,vq.AreaCreationService),e.registerSingleton(Wt.DI_TOKENS.ClassCreationService,Dq.ClassCreationService),e.registerSingleton(Wt.DI_TOKENS.ConceptCreationService,Fq.ConceptCreationService),e.registerSingleton(Wt.DI_TOKENS.SupervisionCreationService,Lq.SupervisionCreationService),e.registerSingleton(Wt.DI_TOKENS.GenericAssetCreationService,jq.GenericAssetCreationService),e.registerSingleton(Wt.DI_TOKENS.PropertyCleanupService,wq.PropertyCleanupService),e.registerSingleton(Wt.DI_TOKENS.FolderRepairService,Iq.FolderRepairService),e.registerSingleton(Wt.DI_TOKENS.RenameToUidService,xq.RenameToUidService),e.registerSingleton(Wt.DI_TOKENS.PlanningService,Pq.PlanningService),e.registerSingleton(Wt.DI_TOKENS.EffortVotingService,Rq.EffortVotingService),e.registerSingleton(Wt.DI_TOKENS.SessionEventService,Cq.SessionEventService),e.registerSingleton(Wt.DI_TOKENS.AssetConversionService,Oq.AssetConversionService),e.registerSingleton(Wt.DI_TOKENS.NoteToRDFConverter,Nq.NoteToRDFConverter),e.registerSingleton(Wt.DI_TOKENS.AreaHierarchyBuilder,kq.AreaHierarchyBuilder),e.registerSingleton(Wt.DI_TOKENS.URIConstructionService,Mq.URIConstructionService),e.registerSingleton(Wt.DI_TOKENS.CriticalityZoneService,$q.CriticalityZoneService)}a(Bq,"registerCoreServices");function Vq(){return nd.container.createChildContainer()}a(Vq,"createChildContainer");function Gq(){return nd.container}a(Gq,"getContainer");function qq(){nd.container.reset()}a(qq,"resetContainer")});var eE=w(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.DEFAULT_COLORS=ru.NODE_FLAGS=void 0;ru.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};ru.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var rE=w(Ng=>{"use strict";Object.defineProperty(Ng,"__esModule",{value:!0});Ng.StringTable=void 0;var tE=class n{static{a(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}}};Ng.StringTable=tE});var e3=w(Mg=>{"use strict";Object.defineProperty(Mg,"__esModule",{value:!0});Mg.CompactGraphStore=void 0;var kg=rE(),jn=eE(),Wq={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function nE(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}a(nE,"parseColor");var iE=class{static{a(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...Wq,...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 kg.StringTable,this.labelTable=new kg.StringTable,this.typeTable=new kg.StringTable,this.predicateTable=new kg.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]=nE(e.color,jn.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=jn.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=jn.NODE_FLAGS.PINNED),e.isArchived&&(s|=jn.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]=nE(t.color,jn.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|jn.NODE_FLAGS.PINNED:i&~jn.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|jn.NODE_FLAGS.ARCHIVED:i&~jn.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 o=this.edgeCount++;return this.edges.sourceIndices[o]=t,this.edges.targetIndices[o]=r,this.edges.widths[o]=e.width??1,this.edges.colors[o]=nE(e.color,jn.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[o]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[o]=0,this.edgeIdToIndex.set(i,o),o}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(o=>o>=0).length,s=this.addEdges(e.edges).filter(o=>o>=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 o=s*2;i.x!==void 0&&(this.nodes.positions[o]=i.x),i.y!==void 0&&(this.nodes.positions[o+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,jn.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,jn.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~jn.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&jn.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}};Mg.CompactGraphStore=iE});var t3=w(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.MemoryPool=void 0;iu.getGlobalPool=Hq;iu.resetGlobalPool=Kq;var zq={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},jg=class{static{a(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={...zq,...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 o=i.get(r);if(o)for(;o.length>0&&this.stats.pooledMemory>e;)o.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}};iu.MemoryPool=jg;var nu=null;function Hq(){return nu||(nu=new jg),nu}a(Hq,"getGlobalPool");function Kq(){nu&&nu.clear(),nu=null}a(Kq,"resetGlobalPool")});var r3=w(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.StreamingLoader=void 0;id.createStreamingSource=Xq;var Qq={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},sE=class{static{a(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={...Qq,...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),o=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);o[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:o[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()}}};id.StreamingLoader=sE;async function*Xq(n,e,t=1e3){let r=0,i=0,s;for(;;){let o=await e(n,r,t);if(o.totalCount!==void 0&&s===void 0&&(s=Math.ceil(o.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:o.nodes,edges:o.edges,isLast:!o.hasMore},!o.hasMore)break;r+=t,i++}}a(Xq,"createStreamingSource")});var s3=w(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.createStreamingSource=cr.StreamingLoader=cr.resetGlobalPool=cr.getGlobalPool=cr.MemoryPool=cr.CompactGraphStore=cr.StringTable=cr.DEFAULT_COLORS=cr.NODE_FLAGS=void 0;var n3=eE();Object.defineProperty(cr,"NODE_FLAGS",{enumerable:!0,get:a(function(){return n3.NODE_FLAGS},"get")});Object.defineProperty(cr,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return n3.DEFAULT_COLORS},"get")});var Yq=rE();Object.defineProperty(cr,"StringTable",{enumerable:!0,get:a(function(){return Yq.StringTable},"get")});var Jq=e3();Object.defineProperty(cr,"CompactGraphStore",{enumerable:!0,get:a(function(){return Jq.CompactGraphStore},"get")});var oE=t3();Object.defineProperty(cr,"MemoryPool",{enumerable:!0,get:a(function(){return oE.MemoryPool},"get")});Object.defineProperty(cr,"getGlobalPool",{enumerable:!0,get:a(function(){return oE.getGlobalPool},"get")});Object.defineProperty(cr,"resetGlobalPool",{enumerable:!0,get:a(function(){return oE.resetGlobalPool},"get")});var i3=r3();Object.defineProperty(cr,"StreamingLoader",{enumerable:!0,get:a(function(){return i3.StreamingLoader},"get")});Object.defineProperty(cr,"createStreamingSource",{enumerable:!0,get:a(function(){return i3.createStreamingSource},"get")})});var o3=w(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.ExoQLError=lr.ExoQL=lr.ExoQLBudgetExceededError=lr.ExoQLCycleError=lr.ExoQLEvalDisabledError=lr.ExoQLForbiddenKeywordError=lr.DEFAULT_EVAL_CONFIG=lr.validateExoQLAllowlist=lr.evaluateWithExoEval=void 0;var Zq=pl(),eW=gl(),tW=Ml(),aE=Nv(),rW=qe(),nW=Fm();Object.defineProperty(lr,"evaluateWithExoEval",{enumerable:!0,get:a(function(){return nW.evaluateWithExoEval},"get")});var iW=Cw();Object.defineProperty(lr,"validateExoQLAllowlist",{enumerable:!0,get:a(function(){return iW.validateExoQLAllowlist},"get")});var sW=Ow();Object.defineProperty(lr,"DEFAULT_EVAL_CONFIG",{enumerable:!0,get:a(function(){return sW.DEFAULT_EVAL_CONFIG},"get")});var $g=Bf();Object.defineProperty(lr,"ExoQLForbiddenKeywordError",{enumerable:!0,get:a(function(){return $g.ExoQLForbiddenKeywordError},"get")});Object.defineProperty(lr,"ExoQLEvalDisabledError",{enumerable:!0,get:a(function(){return $g.ExoQLEvalDisabledError},"get")});Object.defineProperty(lr,"ExoQLCycleError",{enumerable:!0,get:a(function(){return $g.ExoQLCycleError},"get")});Object.defineProperty(lr,"ExoQLBudgetExceededError",{enumerable:!0,get:a(function(){return $g.ExoQLBudgetExceededError},"get")});var cE=class n{static{a(this,"ExoQL")}static async query(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);return s.executeAll(i)}static async ask(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isAskQuery(i))throw new sd("ExoQL.ask() requires an ASK query");return s.executeAsk(i)}static async construct(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isConstructQuery(i))throw new sd("ExoQL.construct() requires a CONSTRUCT query");return s.executeConstruct(i)}static async queryOwn(e,t,r,i){let s=await n.query(e,t,i);if(s.length===0)return[];let o=r?.subjectVar??"s",c=r?.predicateVar??"p",l=r?.objectVar??"o";return(await new aE.SourceAnnotator(t).annotate(s,o,c,l)).filter(d=>{let h=d.get(aE.SOURCE_VARIABLE);return h instanceof rW.Literal&&h.value==="own"})}static async isOwn(e,t,r,i){return await new aE.SourceAnnotator(i).determineSource(e,t,r)==="own"}static prepare(e,t,r){let i=new Zq.ExoQLParser,s=new eW.ExoQLAlgebraTranslator,o=i.parse(e),c=s.translate(o),l=new tW.ExoQLQueryExecutor(t,r);return{algebra:c,executor:l}}};lr.ExoQL=cE;var sd=class extends Error{static{a(this,"ExoQLError")}constructor(e){super(e),this.name="ExoQLError"}};lr.ExoQLError=sd});var Ug=w(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.normalizeRef=aW;var oW=Zs();function aW(n){if(typeof n!="string")return null;let e=oW.WikiLinkHelpers.normalize(n);return e.length>0?e:null}a(aW,"normalizeRef")});var c3=w(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.LAYOUT_CLASS_UID=Xi.LAYOUT_CLASS_IRI=void 0;Xi.createLayoutFromFrontmatter=hW;Xi.isLayout=pW;Xi.isLayoutFrontmatter=gW;var cW=Zs(),lW=Ug();Xi.LAYOUT_CLASS_IRI="exo__Layout";Xi.LAYOUT_CLASS_UID="08d00289-a5c8-4df1-8885-40a00a014004";function a3(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}a(a3,"toStringArray");function uW(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}a(uW,"basenameFromPath");function fW(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}a(fW,"parseBoolean");function dW(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let e=Number.parseFloat(n);if(Number.isFinite(e))return e}return 0}a(dW,"parsePriority");function hW(n,e){let t=e.warn??(()=>{}),r=e.sourcePath;if(!n||typeof n!="object")return t(`Layout: missing frontmatter at ${r}`),null;let i=n.exo__Asset_uid,s=typeof i=="string"?i.trim():"";if(s.length===0)return t(`Layout: exo__Asset_uid missing at ${r}`),null;let o=(0,lW.normalizeRef)(n.exo__Layout_targetClass);if(o===null)return t(`Layout ${s}: exo__Layout_targetClass required (${r})`),null;let c=a3(n.exo__Layout_blocks),l=[];for(let p of c){let y=cW.WikiLinkHelpers.normalize(p);y.length>0&&l.push(y)}if(l.length===0)return t(`Layout ${s}: exo__Layout_blocks must contain at least one block (${r})`),null;let u=n.exo__Asset_label,f=typeof u=="string"&&u.trim().length>0?u.trim():uW(r),d=dW(n.exo__Layout_priority),h=fW(n.exo__Layout_coexistsWithDefault,!1);return{uid:s,label:f,targetClass:o,blocks:l,priority:d,coexistsWithDefault:h,sourcePath:r}}a(hW,"createLayoutFromFrontmatter");function pW(n){if(!n||typeof n!="object")return!1;let e=n;return!(typeof e.uid!="string"||e.uid.length===0||typeof e.label!="string"||typeof e.targetClass!="string"||e.targetClass.length===0||!Array.isArray(e.blocks)||e.blocks.length===0||e.blocks.some(t=>typeof t!="string")||typeof e.priority!="number"||!Number.isFinite(e.priority)||typeof e.coexistsWithDefault!="boolean"||typeof e.sourcePath!="string")}a(pW,"isLayout");function mW(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}a(mW,"extractClassIdentifiers");function gW(n){if(!n)return!1;let e=a3(n.exo__Instance_class);for(let t of e)for(let r of mW(t))if(r===Xi.LAYOUT_CLASS_IRI||r===Xi.LAYOUT_CLASS_UID)return!0;return!1}a(gW,"isLayoutFrontmatter")});var f3=w(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID=Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI=Xt.PROPERTIES_BLOCK_CLASS_UID=Xt.PROPERTIES_BLOCK_CLASS_IRI=void 0;Xt.createLayoutBlockFromFrontmatter=vW;Xt.isLayoutBlockFrontmatter=EW;Xt.isPropertiesBlock=TW;Xt.isBacklinksTableBlock=AW;var yW=Zs(),uE=Ug();Xt.PROPERTIES_BLOCK_CLASS_IRI="exo__PropertiesBlock";Xt.PROPERTIES_BLOCK_CLASS_UID="fd039b3c-ed2b-41c2-a42e-bbfcdd074bfe";Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI="exo__BacklinksTableBlock";Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID="2e868956-d81e-43fd-9817-1addde9cb311";function l3(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}a(l3,"toStringArray");function bW(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}a(bW,"basenameFromPath");function u3(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}a(u3,"parseBoolean");function _W(n){if(typeof n=="number"&&Number.isFinite(n)&&Number.isInteger(n))return n;if(typeof n=="string"){let e=Number.parseInt(n,10);if(Number.isFinite(e))return e}return null}a(_W,"parseInteger");function SW(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}a(SW,"extractClassIdentifiers");function Bg(n,e,t){let r=l3(n.exo__Instance_class);for(let i of r)for(let s of SW(i))if(s===e||s===t)return!0;return!1}a(Bg,"classOf");function wW(n,e){let t=e.warn??(()=>{}),r=n.exo__Asset_uid,i=typeof r=="string"?r.trim():"";if(i.length===0)return t(`LayoutBlock: exo__Asset_uid missing at ${e.sourcePath}`),null;let s=n.exo__LayoutBlock_title,o=n.exo__Asset_label,c=typeof s=="string"&&s.trim().length>0?s.trim():typeof o=="string"&&o.trim().length>0?o.trim():bW(e.sourcePath),l=u3(n.exo__LayoutBlock_collapsed,!1);return{uid:i,title:c,collapsed:l,sourcePath:e.sourcePath}}a(wW,"extractBase");function vW(n,e){let t=e.warn??(()=>{});if(!n||typeof n!="object")return t(`LayoutBlock: missing frontmatter at ${e.sourcePath}`),null;let r=wW(n,e);if(r===null)return null;if(Bg(n,Xt.PROPERTIES_BLOCK_CLASS_IRI,Xt.PROPERTIES_BLOCK_CLASS_UID))return{...r,kind:"properties"};if(Bg(n,Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID)){let i=(0,uE.normalizeRef)(n.exo__BacklinksTableBlock_rowClass),s=(0,uE.normalizeRef)(n.exo__BacklinksTableBlock_referencingProperty);if(i===null||s===null)return t(`BacklinksTableBlock ${r.uid}: rowClass and referencingProperty required (${e.sourcePath})`),null;let o=l3(n.exo__BacklinksTableBlock_columns),c=[];for(let p of o){let y=yW.WikiLinkHelpers.normalize(p);y.length>0&&c.push(y)}let l=(0,uE.normalizeRef)(n.exo__BacklinksTableBlock_sortBy),u=n.exo__BacklinksTableBlock_sortOrder,f=typeof u=="string"&&u.trim().toLowerCase()==="desc"?"desc":"asc",d=_W(n.exo__BacklinksTableBlock_limit),h=u3(n.exo__BacklinksTableBlock_showArchived,!1);return{...r,kind:"backlinks-table",rowClass:i,referencingProperty:s,columns:c,sortBy:l,sortOrder:f,limit:d,showArchived:h}}return t(`LayoutBlock ${r.uid}: unknown block class at ${e.sourcePath} \u2014 expected exo__PropertiesBlock or exo__BacklinksTableBlock`),null}a(vW,"createLayoutBlockFromFrontmatter");function EW(n){return n?Bg(n,Xt.PROPERTIES_BLOCK_CLASS_IRI,Xt.PROPERTIES_BLOCK_CLASS_UID)||Bg(n,Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID):!1}a(EW,"isLayoutBlockFrontmatter");function TW(n){return n.kind==="properties"}a(TW,"isPropertiesBlock");function AW(n){return n.kind==="backlinks-table"}a(AW,"isBacklinksTableBlock")});var fE=w(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.isPropertiesBlock=mt.isLayoutBlockFrontmatter=mt.isBacklinksTableBlock=mt.createLayoutBlockFromFrontmatter=mt.PROPERTIES_BLOCK_CLASS_UID=mt.PROPERTIES_BLOCK_CLASS_IRI=mt.BACKLINKS_TABLE_BLOCK_CLASS_UID=mt.BACKLINKS_TABLE_BLOCK_CLASS_IRI=mt.isLayoutFrontmatter=mt.isLayout=mt.createLayoutFromFrontmatter=mt.LAYOUT_CLASS_UID=mt.LAYOUT_CLASS_IRI=mt.normalizeRef=void 0;var IW=Ug();Object.defineProperty(mt,"normalizeRef",{enumerable:!0,get:a(function(){return IW.normalizeRef},"get")});var od=c3();Object.defineProperty(mt,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return od.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(mt,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return od.LAYOUT_CLASS_UID},"get")});Object.defineProperty(mt,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return od.createLayoutFromFrontmatter},"get")});Object.defineProperty(mt,"isLayout",{enumerable:!0,get:a(function(){return od.isLayout},"get")});Object.defineProperty(mt,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return od.isLayoutFrontmatter},"get")});var la=f3();Object.defineProperty(mt,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return la.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(mt,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return la.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(mt,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return la.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(mt,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return la.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(mt,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return la.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(mt,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return la.isBacklinksTableBlock},"get")});Object.defineProperty(mt,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return la.isLayoutBlockFrontmatter},"get")});Object.defineProperty(mt,"isPropertiesBlock",{enumerable:!0,get:a(function(){return la.isPropertiesBlock},"get")})});var h3=w(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.LayoutSelector=void 0;ad.selectByPriority=d3;var xW=Zs(),dE=class{static{a(this,"LayoutSelector")}constructor(e){this.source=e}resolve(e){if(!Array.isArray(e)||e.length===0)return null;let t=this.source.all;if(t.length===0)return null;for(let r of e){if(typeof r!="string")continue;let i=xW.WikiLinkHelpers.normalize(r);if(i.length===0)continue;let s=t.filter(o=>o.targetClass===i);if(s.length!==0)return d3(s)}return null}};ad.LayoutSelector=dE;function d3(n){if(n.length===0)throw new Error("selectByPriority: expected at least one candidate");return n.length===1?n[0]:[...n].sort((t,r)=>t.priority!==r.priority?r.priority-t.priority:t.uid<r.uid?-1:t.uid>r.uid?1:0)[0]}a(d3,"selectByPriority")});var Rs=w(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});Vg.ErrorCode=void 0;var p3;(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"})(p3||(Vg.ErrorCode=p3={}))});var Ps=w(Gg=>{"use strict";Object.defineProperty(Gg,"__esModule",{value:!0});Gg.ApplicationError=void 0;var hE=class extends Error{static{a(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+=`
412
+ `)?`"${e.replace(/"/g,'""')}"`:e}};Lg.ResultSerializer=Qv});var JC=w(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.FileAlreadyExistsError=tu.FileNotFoundError=void 0;var Xv=class extends Error{static{a(this,"FileNotFoundError")}constructor(e){super(`File not found: ${e}`),this.name="FileNotFoundError"}};tu.FileNotFoundError=Xv;var Yv=class extends Error{static{a(this,"FileAlreadyExistsError")}constructor(e){super(`File already exists: ${e}`),this.name="FileAlreadyExistsError"}};tu.FileAlreadyExistsError=Yv});var Zv=w(Tr=>{"use strict";var gq=Tr&&Tr.__decorate||function(n,e,t,r){var i=arguments.length,s=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;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--)(o=n[c])&&(s=(i<3?o(s):i>3?o(e,t,s):o(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},yq=Tr&&Tr.__metadata||function(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.VaultSettings=Tr.DEFAULT_FLEETING_NOTE_CLASS_UID=Tr.DEFAULT_INBOX_FOLDER=Tr.DEFAULT_OWNER_IDENTITY=void 0;var bq=je();Tr.DEFAULT_OWNER_IDENTITY='"[[!kitelev]]"';Tr.DEFAULT_INBOX_FOLDER="01 Inbox";Tr.DEFAULT_FLEETING_NOTE_CLASS_UID="fca0a931-a01f-48e4-b72a-4af206c94bc7";var Jv=class{static{a(this,"VaultSettings")}constructor(e){this.ownerIdentity=e?.ownerIdentity??Tr.DEFAULT_OWNER_IDENTITY,this.defaultInboxFolder=e?.defaultInboxFolder??Tr.DEFAULT_INBOX_FOLDER,this.fleetingNoteClassUID=e?.fleetingNoteClassUID??Tr.DEFAULT_FLEETING_NOTE_CLASS_UID}getOwnerIdentity(){return this.ownerIdentity}getDefaultInboxFolder(){return this.defaultInboxFolder}getFleetingNoteClassUID(){return this.fleetingNoteClassUID}};Tr.VaultSettings=Jv;Tr.VaultSettings=Jv=gq([(0,bq.injectable)(),yq("design:paramtypes",[Object])],Jv)});var ZC=w(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.container=void 0;ca.registerCoreServices=Bq;ca.createChildContainer=Vq;ca.getContainer=Gq;ca.resetContainer=qq;wb();var nd=je();Object.defineProperty(ca,"container",{enumerable:!0,get:a(function(){return nd.container},"get")});var Wt=qt(),_q=L1(),Sq=k1(),wq=x1(),vq=a1(),Eq=n1(),Tq=eg(),Aq=rg(),Iq=T1(),xq=P1(),Rq=S1(),Pq=j1(),Cq=z1(),Oq=G1(),Dq=f1(),Fq=h1(),Lq=D1(),Nq=jv(),kq=l1(),Mq=Q1(),jq=Y1(),$q=sv(),Uq=Zv();function Bq(n){let e=n||nd.container;e.registerSingleton(Wt.DI_TOKENS.DynamicFrontmatterGenerator,_q.DynamicFrontmatterGenerator),e.registerSingleton(Wt.DI_TOKENS.AlgorithmExtractor,Sq.AlgorithmExtractor),e.isRegistered(Wt.DI_TOKENS.IVaultSettings)||e.register(Wt.DI_TOKENS.IVaultSettings,{useValue:new Uq.VaultSettings}),e.registerSingleton(Wt.DI_TOKENS.EffortStatusWorkflow,Tq.EffortStatusWorkflow),e.registerSingleton(Wt.DI_TOKENS.StatusTimestampService,Aq.StatusTimestampService),e.registerSingleton(Wt.DI_TOKENS.TaskStatusService,Eq.TaskStatusService),e.registerSingleton(Wt.DI_TOKENS.AreaCreationService,vq.AreaCreationService),e.registerSingleton(Wt.DI_TOKENS.ClassCreationService,Dq.ClassCreationService),e.registerSingleton(Wt.DI_TOKENS.ConceptCreationService,Fq.ConceptCreationService),e.registerSingleton(Wt.DI_TOKENS.SupervisionCreationService,Lq.SupervisionCreationService),e.registerSingleton(Wt.DI_TOKENS.GenericAssetCreationService,jq.GenericAssetCreationService),e.registerSingleton(Wt.DI_TOKENS.PropertyCleanupService,wq.PropertyCleanupService),e.registerSingleton(Wt.DI_TOKENS.FolderRepairService,Iq.FolderRepairService),e.registerSingleton(Wt.DI_TOKENS.RenameToUidService,xq.RenameToUidService),e.registerSingleton(Wt.DI_TOKENS.PlanningService,Pq.PlanningService),e.registerSingleton(Wt.DI_TOKENS.EffortVotingService,Rq.EffortVotingService),e.registerSingleton(Wt.DI_TOKENS.SessionEventService,Cq.SessionEventService),e.registerSingleton(Wt.DI_TOKENS.AssetConversionService,Oq.AssetConversionService),e.registerSingleton(Wt.DI_TOKENS.NoteToRDFConverter,Nq.NoteToRDFConverter),e.registerSingleton(Wt.DI_TOKENS.AreaHierarchyBuilder,kq.AreaHierarchyBuilder),e.registerSingleton(Wt.DI_TOKENS.URIConstructionService,Mq.URIConstructionService),e.registerSingleton(Wt.DI_TOKENS.CriticalityZoneService,$q.CriticalityZoneService)}a(Bq,"registerCoreServices");function Vq(){return nd.container.createChildContainer()}a(Vq,"createChildContainer");function Gq(){return nd.container}a(Gq,"getContainer");function qq(){nd.container.reset()}a(qq,"resetContainer")});var eE=w(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.DEFAULT_COLORS=ru.NODE_FLAGS=void 0;ru.NODE_FLAGS={PINNED:1,VISIBLE:2,SELECTED:4,HOVERED:8,ARCHIVED:16,SEARCH_MATCH:32,HIGHLIGHTED:64};ru.DEFAULT_COLORS={NODE:1251006975,NODE_SELECTED:4290840575,NODE_HOVERED:1723558655,EDGE:2576980479,EDGE_SELECTED:4288151807,EDGE_HIERARCHY:2619846911}});var rE=w(Ng=>{"use strict";Object.defineProperty(Ng,"__esModule",{value:!0});Ng.StringTable=void 0;var tE=class n{static{a(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}}};Ng.StringTable=tE});var e3=w(Mg=>{"use strict";Object.defineProperty(Mg,"__esModule",{value:!0});Mg.CompactGraphStore=void 0;var kg=rE(),jn=eE(),Wq={initialNodeCapacity:1e4,initialEdgeCapacity:5e4,growthFactor:2,maxCapacity:1e6};function nE(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}a(nE,"parseColor");var iE=class{static{a(this,"CompactGraphStore")}constructor(e){this.nodeCount=0,this.edgeCount=0,this.nodeIdToIndex=new Map,this.indexToNodeId=[],this.edgeIdToIndex=new Map,this.config={...Wq,...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 kg.StringTable,this.labelTable=new kg.StringTable,this.typeTable=new kg.StringTable,this.predicateTable=new kg.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]=nE(e.color,jn.DEFAULT_COLORS.NODE),e.assetClass?this.nodes.types[r]=this.typeTable.intern(e.assetClass):this.nodes.types[r]=0;let s=jn.NODE_FLAGS.VISIBLE;return e.isPinned&&(s|=jn.NODE_FLAGS.PINNED),e.isArchived&&(s|=jn.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]=nE(t.color,jn.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|jn.NODE_FLAGS.PINNED:i&~jn.NODE_FLAGS.PINNED),t.isArchived!==void 0&&(i=t.isArchived?i|jn.NODE_FLAGS.ARCHIVED:i&~jn.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 o=this.edgeCount++;return this.edges.sourceIndices[o]=t,this.edges.targetIndices[o]=r,this.edges.widths[o]=e.width??1,this.edges.colors[o]=nE(e.color,jn.DEFAULT_COLORS.EDGE),e.predicate?this.edges.predicateIndices[o]=this.predicateTable.intern(e.predicate):this.edges.predicateIndices[o]=0,this.edgeIdToIndex.set(i,o),o}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(o=>o>=0).length,s=this.addEdges(e.edges).filter(o=>o>=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 o=s*2;i.x!==void 0&&(this.nodes.positions[o]=i.x),i.y!==void 0&&(this.nodes.positions[o+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,jn.NODE_FLAGS.SELECTED)}deselectNode(e){return this.clearNodeFlag(e,jn.NODE_FLAGS.SELECTED)}clearSelection(){for(let e=0;e<this.nodeCount;e++)this.nodes.flags[e]&=~jn.NODE_FLAGS.SELECTED}getSelectedNodeIds(){let e=[];for(let t=0;t<this.nodeCount;t++)this.nodes.flags[t]&jn.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}};Mg.CompactGraphStore=iE});var t3=w(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.MemoryPool=void 0;iu.getGlobalPool=Hq;iu.resetGlobalPool=Kq;var zq={maxPooledArrays:16,sizeBuckets:[64,256,1024,4096,16384,65536,262144],autoCleanup:!0,maxPoolMemory:50*1024*1024},jg=class{static{a(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={...zq,...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 o=i.get(r);if(o)for(;o.length>0&&this.stats.pooledMemory>e;)o.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}};iu.MemoryPool=jg;var nu=null;function Hq(){return nu||(nu=new jg),nu}a(Hq,"getGlobalPool");function Kq(){nu&&nu.clear(),nu=null}a(Kq,"resetGlobalPool")});var r3=w(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.StreamingLoader=void 0;id.createStreamingSource=Xq;var Qq={chunkSize:1e3,chunkDelay:0,autoResolveEdges:!0,maxConcurrency:1},sE=class{static{a(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={...Qq,...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),o=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);o[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:o[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()}}};id.StreamingLoader=sE;async function*Xq(n,e,t=1e3){let r=0,i=0,s;for(;;){let o=await e(n,r,t);if(o.totalCount!==void 0&&s===void 0&&(s=Math.ceil(o.totalCount/t)),yield{chunkIndex:i,totalChunks:s,nodes:o.nodes,edges:o.edges,isLast:!o.hasMore},!o.hasMore)break;r+=t,i++}}a(Xq,"createStreamingSource")});var s3=w(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.createStreamingSource=cr.StreamingLoader=cr.resetGlobalPool=cr.getGlobalPool=cr.MemoryPool=cr.CompactGraphStore=cr.StringTable=cr.DEFAULT_COLORS=cr.NODE_FLAGS=void 0;var n3=eE();Object.defineProperty(cr,"NODE_FLAGS",{enumerable:!0,get:a(function(){return n3.NODE_FLAGS},"get")});Object.defineProperty(cr,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return n3.DEFAULT_COLORS},"get")});var Yq=rE();Object.defineProperty(cr,"StringTable",{enumerable:!0,get:a(function(){return Yq.StringTable},"get")});var Jq=e3();Object.defineProperty(cr,"CompactGraphStore",{enumerable:!0,get:a(function(){return Jq.CompactGraphStore},"get")});var oE=t3();Object.defineProperty(cr,"MemoryPool",{enumerable:!0,get:a(function(){return oE.MemoryPool},"get")});Object.defineProperty(cr,"getGlobalPool",{enumerable:!0,get:a(function(){return oE.getGlobalPool},"get")});Object.defineProperty(cr,"resetGlobalPool",{enumerable:!0,get:a(function(){return oE.resetGlobalPool},"get")});var i3=r3();Object.defineProperty(cr,"StreamingLoader",{enumerable:!0,get:a(function(){return i3.StreamingLoader},"get")});Object.defineProperty(cr,"createStreamingSource",{enumerable:!0,get:a(function(){return i3.createStreamingSource},"get")})});var o3=w(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.ExoQLError=lr.ExoQL=lr.ExoQLBudgetExceededError=lr.ExoQLCycleError=lr.ExoQLEvalDisabledError=lr.ExoQLForbiddenKeywordError=lr.DEFAULT_EVAL_CONFIG=lr.validateExoQLAllowlist=lr.evaluateWithExoEval=void 0;var Zq=pl(),eW=gl(),tW=Ml(),aE=Nv(),rW=qe(),nW=Fm();Object.defineProperty(lr,"evaluateWithExoEval",{enumerable:!0,get:a(function(){return nW.evaluateWithExoEval},"get")});var iW=Cw();Object.defineProperty(lr,"validateExoQLAllowlist",{enumerable:!0,get:a(function(){return iW.validateExoQLAllowlist},"get")});var sW=Ow();Object.defineProperty(lr,"DEFAULT_EVAL_CONFIG",{enumerable:!0,get:a(function(){return sW.DEFAULT_EVAL_CONFIG},"get")});var $g=Bf();Object.defineProperty(lr,"ExoQLForbiddenKeywordError",{enumerable:!0,get:a(function(){return $g.ExoQLForbiddenKeywordError},"get")});Object.defineProperty(lr,"ExoQLEvalDisabledError",{enumerable:!0,get:a(function(){return $g.ExoQLEvalDisabledError},"get")});Object.defineProperty(lr,"ExoQLCycleError",{enumerable:!0,get:a(function(){return $g.ExoQLCycleError},"get")});Object.defineProperty(lr,"ExoQLBudgetExceededError",{enumerable:!0,get:a(function(){return $g.ExoQLBudgetExceededError},"get")});var cE=class n{static{a(this,"ExoQL")}static async query(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);return s.executeAll(i)}static async ask(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isAskQuery(i))throw new sd("ExoQL.ask() requires an ASK query");return s.executeAsk(i)}static async construct(e,t,r){let{algebra:i,executor:s}=n.prepare(e,t,r);if(!s.isConstructQuery(i))throw new sd("ExoQL.construct() requires a CONSTRUCT query");return s.executeConstruct(i)}static async queryOwn(e,t,r,i){let s=await n.query(e,t,i);if(s.length===0)return[];let o=r?.subjectVar??"s",c=r?.predicateVar??"p",l=r?.objectVar??"o";return(await new aE.SourceAnnotator(t).annotate(s,o,c,l)).filter(d=>{let h=d.get(aE.SOURCE_VARIABLE);return h instanceof rW.Literal&&h.value==="own"})}static async isOwn(e,t,r,i){return await new aE.SourceAnnotator(i).determineSource(e,t,r)==="own"}static prepare(e,t,r){let i=new Zq.ExoQLParser,s=new eW.ExoQLAlgebraTranslator,o=i.parse(e),c=s.translate(o),l=new tW.ExoQLQueryExecutor(t,r);return{algebra:c,executor:l}}};lr.ExoQL=cE;var sd=class extends Error{static{a(this,"ExoQLError")}constructor(e){super(e),this.name="ExoQLError"}};lr.ExoQLError=sd});var Ug=w(lE=>{"use strict";Object.defineProperty(lE,"__esModule",{value:!0});lE.normalizeRef=aW;var oW=eo();function aW(n){if(typeof n!="string")return null;let e=oW.WikiLinkHelpers.normalize(n);return e.length>0?e:null}a(aW,"normalizeRef")});var c3=w(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.LAYOUT_CLASS_UID=Xi.LAYOUT_CLASS_IRI=void 0;Xi.createLayoutFromFrontmatter=hW;Xi.isLayout=pW;Xi.isLayoutFrontmatter=gW;var cW=eo(),lW=Ug();Xi.LAYOUT_CLASS_IRI="exo__Layout";Xi.LAYOUT_CLASS_UID="08d00289-a5c8-4df1-8885-40a00a014004";function a3(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}a(a3,"toStringArray");function uW(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}a(uW,"basenameFromPath");function fW(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}a(fW,"parseBoolean");function dW(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let e=Number.parseFloat(n);if(Number.isFinite(e))return e}return 0}a(dW,"parsePriority");function hW(n,e){let t=e.warn??(()=>{}),r=e.sourcePath;if(!n||typeof n!="object")return t(`Layout: missing frontmatter at ${r}`),null;let i=n.exo__Asset_uid,s=typeof i=="string"?i.trim():"";if(s.length===0)return t(`Layout: exo__Asset_uid missing at ${r}`),null;let o=(0,lW.normalizeRef)(n.exo__Layout_targetClass);if(o===null)return t(`Layout ${s}: exo__Layout_targetClass required (${r})`),null;let c=a3(n.exo__Layout_blocks),l=[];for(let p of c){let y=cW.WikiLinkHelpers.normalize(p);y.length>0&&l.push(y)}if(l.length===0)return t(`Layout ${s}: exo__Layout_blocks must contain at least one block (${r})`),null;let u=n.exo__Asset_label,f=typeof u=="string"&&u.trim().length>0?u.trim():uW(r),d=dW(n.exo__Layout_priority),h=fW(n.exo__Layout_coexistsWithDefault,!1);return{uid:s,label:f,targetClass:o,blocks:l,priority:d,coexistsWithDefault:h,sourcePath:r}}a(hW,"createLayoutFromFrontmatter");function pW(n){if(!n||typeof n!="object")return!1;let e=n;return!(typeof e.uid!="string"||e.uid.length===0||typeof e.label!="string"||typeof e.targetClass!="string"||e.targetClass.length===0||!Array.isArray(e.blocks)||e.blocks.length===0||e.blocks.some(t=>typeof t!="string")||typeof e.priority!="number"||!Number.isFinite(e.priority)||typeof e.coexistsWithDefault!="boolean"||typeof e.sourcePath!="string")}a(pW,"isLayout");function mW(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}a(mW,"extractClassIdentifiers");function gW(n){if(!n)return!1;let e=a3(n.exo__Instance_class);for(let t of e)for(let r of mW(t))if(r===Xi.LAYOUT_CLASS_IRI||r===Xi.LAYOUT_CLASS_UID)return!0;return!1}a(gW,"isLayoutFrontmatter")});var f3=w(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID=Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI=Xt.PROPERTIES_BLOCK_CLASS_UID=Xt.PROPERTIES_BLOCK_CLASS_IRI=void 0;Xt.createLayoutBlockFromFrontmatter=vW;Xt.isLayoutBlockFrontmatter=EW;Xt.isPropertiesBlock=TW;Xt.isBacklinksTableBlock=AW;var yW=eo(),uE=Ug();Xt.PROPERTIES_BLOCK_CLASS_IRI="exo__PropertiesBlock";Xt.PROPERTIES_BLOCK_CLASS_UID="fd039b3c-ed2b-41c2-a42e-bbfcdd074bfe";Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI="exo__BacklinksTableBlock";Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID="2e868956-d81e-43fd-9817-1addde9cb311";function l3(n){return n==null?[]:Array.isArray(n)?n.filter(e=>typeof e=="string"):typeof n=="string"?[n]:[]}a(l3,"toStringArray");function bW(n){let e=n.lastIndexOf("/"),t=e>=0?n.slice(e+1):n,r=t.lastIndexOf(".");return r>=0?t.slice(0,r):t}a(bW,"basenameFromPath");function u3(n,e){if(typeof n=="boolean")return n;if(typeof n=="string"){let t=n.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}a(u3,"parseBoolean");function _W(n){if(typeof n=="number"&&Number.isFinite(n)&&Number.isInteger(n))return n;if(typeof n=="string"){let e=Number.parseInt(n,10);if(Number.isFinite(e))return e}return null}a(_W,"parseInteger");function SW(n){let e=n.trim();if(e.length===0)return[];let t=e.match(/^\[\[([^\]]+)\]\]$/);return(t?t[1]:e).split("|").map(i=>i.trim()).filter(i=>i.length>0)}a(SW,"extractClassIdentifiers");function Bg(n,e,t){let r=l3(n.exo__Instance_class);for(let i of r)for(let s of SW(i))if(s===e||s===t)return!0;return!1}a(Bg,"classOf");function wW(n,e){let t=e.warn??(()=>{}),r=n.exo__Asset_uid,i=typeof r=="string"?r.trim():"";if(i.length===0)return t(`LayoutBlock: exo__Asset_uid missing at ${e.sourcePath}`),null;let s=n.exo__LayoutBlock_title,o=n.exo__Asset_label,c=typeof s=="string"&&s.trim().length>0?s.trim():typeof o=="string"&&o.trim().length>0?o.trim():bW(e.sourcePath),l=u3(n.exo__LayoutBlock_collapsed,!1);return{uid:i,title:c,collapsed:l,sourcePath:e.sourcePath}}a(wW,"extractBase");function vW(n,e){let t=e.warn??(()=>{});if(!n||typeof n!="object")return t(`LayoutBlock: missing frontmatter at ${e.sourcePath}`),null;let r=wW(n,e);if(r===null)return null;if(Bg(n,Xt.PROPERTIES_BLOCK_CLASS_IRI,Xt.PROPERTIES_BLOCK_CLASS_UID))return{...r,kind:"properties"};if(Bg(n,Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID)){let i=(0,uE.normalizeRef)(n.exo__BacklinksTableBlock_rowClass),s=(0,uE.normalizeRef)(n.exo__BacklinksTableBlock_referencingProperty);if(i===null||s===null)return t(`BacklinksTableBlock ${r.uid}: rowClass and referencingProperty required (${e.sourcePath})`),null;let o=l3(n.exo__BacklinksTableBlock_columns),c=[];for(let p of o){let y=yW.WikiLinkHelpers.normalize(p);y.length>0&&c.push(y)}let l=(0,uE.normalizeRef)(n.exo__BacklinksTableBlock_sortBy),u=n.exo__BacklinksTableBlock_sortOrder,f=typeof u=="string"&&u.trim().toLowerCase()==="desc"?"desc":"asc",d=_W(n.exo__BacklinksTableBlock_limit),h=u3(n.exo__BacklinksTableBlock_showArchived,!1);return{...r,kind:"backlinks-table",rowClass:i,referencingProperty:s,columns:c,sortBy:l,sortOrder:f,limit:d,showArchived:h}}return t(`LayoutBlock ${r.uid}: unknown block class at ${e.sourcePath} \u2014 expected exo__PropertiesBlock or exo__BacklinksTableBlock`),null}a(vW,"createLayoutBlockFromFrontmatter");function EW(n){return n?Bg(n,Xt.PROPERTIES_BLOCK_CLASS_IRI,Xt.PROPERTIES_BLOCK_CLASS_UID)||Bg(n,Xt.BACKLINKS_TABLE_BLOCK_CLASS_IRI,Xt.BACKLINKS_TABLE_BLOCK_CLASS_UID):!1}a(EW,"isLayoutBlockFrontmatter");function TW(n){return n.kind==="properties"}a(TW,"isPropertiesBlock");function AW(n){return n.kind==="backlinks-table"}a(AW,"isBacklinksTableBlock")});var fE=w(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.isPropertiesBlock=mt.isLayoutBlockFrontmatter=mt.isBacklinksTableBlock=mt.createLayoutBlockFromFrontmatter=mt.PROPERTIES_BLOCK_CLASS_UID=mt.PROPERTIES_BLOCK_CLASS_IRI=mt.BACKLINKS_TABLE_BLOCK_CLASS_UID=mt.BACKLINKS_TABLE_BLOCK_CLASS_IRI=mt.isLayoutFrontmatter=mt.isLayout=mt.createLayoutFromFrontmatter=mt.LAYOUT_CLASS_UID=mt.LAYOUT_CLASS_IRI=mt.normalizeRef=void 0;var IW=Ug();Object.defineProperty(mt,"normalizeRef",{enumerable:!0,get:a(function(){return IW.normalizeRef},"get")});var od=c3();Object.defineProperty(mt,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return od.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(mt,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return od.LAYOUT_CLASS_UID},"get")});Object.defineProperty(mt,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return od.createLayoutFromFrontmatter},"get")});Object.defineProperty(mt,"isLayout",{enumerable:!0,get:a(function(){return od.isLayout},"get")});Object.defineProperty(mt,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return od.isLayoutFrontmatter},"get")});var la=f3();Object.defineProperty(mt,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return la.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(mt,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return la.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(mt,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return la.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(mt,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return la.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(mt,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return la.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(mt,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return la.isBacklinksTableBlock},"get")});Object.defineProperty(mt,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return la.isLayoutBlockFrontmatter},"get")});Object.defineProperty(mt,"isPropertiesBlock",{enumerable:!0,get:a(function(){return la.isPropertiesBlock},"get")})});var h3=w(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.LayoutSelector=void 0;ad.selectByPriority=d3;var xW=eo(),dE=class{static{a(this,"LayoutSelector")}constructor(e){this.source=e}resolve(e){if(!Array.isArray(e)||e.length===0)return null;let t=this.source.all;if(t.length===0)return null;for(let r of e){if(typeof r!="string")continue;let i=xW.WikiLinkHelpers.normalize(r);if(i.length===0)continue;let s=t.filter(o=>o.targetClass===i);if(s.length!==0)return d3(s)}return null}};ad.LayoutSelector=dE;function d3(n){if(n.length===0)throw new Error("selectByPriority: expected at least one candidate");return n.length===1?n[0]:[...n].sort((t,r)=>t.priority!==r.priority?r.priority-t.priority:t.uid<r.uid?-1:t.uid>r.uid?1:0)[0]}a(d3,"selectByPriority")});var Ps=w(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});Vg.ErrorCode=void 0;var p3;(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"})(p3||(Vg.ErrorCode=p3={}))});var Cs=w(Gg=>{"use strict";Object.defineProperty(Gg,"__esModule",{value:!0});Gg.ApplicationError=void 0;var hE=class extends Error{static{a(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+=`
413
413
 
414
414
  \u{1F4A1} ${this.guidance}`),this.context&&Object.keys(this.context).length>0){e+=`
415
415
 
416
416
  \u{1F4CB} Context:`;for(let[t,r]of Object.entries(this.context))e+=`
417
- ${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}}};Gg.ApplicationError=hE});var m3=w(qg=>{"use strict";Object.defineProperty(qg,"__esModule",{value:!0});qg.ValidationError=void 0;var RW=Ps(),PW=Rs(),pE=class extends RW.ApplicationError{static{a(this,"ValidationError")}constructor(e,t){super(e,t),this.code=PW.ErrorCode.INVALID_INPUT,this.retriable=!1,this.guidance=`Check the input data for correctness.
417
+ ${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}}};Gg.ApplicationError=hE});var m3=w(qg=>{"use strict";Object.defineProperty(qg,"__esModule",{value:!0});qg.ValidationError=void 0;var RW=Cs(),PW=Ps(),pE=class extends RW.ApplicationError{static{a(this,"ValidationError")}constructor(e,t){super(e,t),this.code=PW.ErrorCode.INVALID_INPUT,this.retriable=!1,this.guidance=`Check the input data for correctness.
418
418
  Common issues:
419
419
  \u2022 Missing required fields
420
420
  \u2022 Invalid data format or type
421
421
  \u2022 Values outside allowed range
422
- \u2022 Schema validation failed`}};qg.ValidationError=pE});var g3=w(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});Wg.NetworkError=void 0;var CW=Ps(),OW=Rs(),mE=class extends CW.ApplicationError{static{a(this,"NetworkError")}constructor(e,t){super(e,t),this.code=OW.ErrorCode.NETWORK_ERROR,this.retriable=!0,this.guidance=`This is typically a transient network issue.
422
+ \u2022 Schema validation failed`}};qg.ValidationError=pE});var g3=w(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});Wg.NetworkError=void 0;var CW=Cs(),OW=Ps(),mE=class extends CW.ApplicationError{static{a(this,"NetworkError")}constructor(e,t){super(e,t),this.code=OW.ErrorCode.NETWORK_ERROR,this.retriable=!0,this.guidance=`This is typically a transient network issue.
423
423
  To resolve:
424
424
  \u2022 Check your internet connection
425
425
  \u2022 Retry the operation
426
426
  \u2022 Verify external services are available
427
- \u2022 Check firewall/proxy settings`}};Wg.NetworkError=mE});var y3=w(zg=>{"use strict";Object.defineProperty(zg,"__esModule",{value:!0});zg.StateTransitionError=void 0;var DW=Ps(),FW=Rs(),gE=class extends DW.ApplicationError{static{a(this,"StateTransitionError")}constructor(e,t){super(e,t),this.code=FW.ErrorCode.INVALID_TRANSITION,this.retriable=!1,this.guidance=`The requested state transition is not allowed.
427
+ \u2022 Check firewall/proxy settings`}};Wg.NetworkError=mE});var y3=w(zg=>{"use strict";Object.defineProperty(zg,"__esModule",{value:!0});zg.StateTransitionError=void 0;var DW=Cs(),FW=Ps(),gE=class extends DW.ApplicationError{static{a(this,"StateTransitionError")}constructor(e,t){super(e,t),this.code=FW.ErrorCode.INVALID_TRANSITION,this.retriable=!1,this.guidance=`The requested state transition is not allowed.
428
428
  To fix:
429
429
  \u2022 Check the current state of the resource
430
430
  \u2022 Verify the transition is valid for this workflow
431
431
  \u2022 Review state machine documentation
432
- \u2022 Ensure no concurrent modifications occurred`}};zg.StateTransitionError=gE});var b3=w(Hg=>{"use strict";Object.defineProperty(Hg,"__esModule",{value:!0});Hg.PermissionError=void 0;var LW=Ps(),NW=Rs(),yE=class extends LW.ApplicationError{static{a(this,"PermissionError")}constructor(e,t){super(e,t),this.code=NW.ErrorCode.PERMISSION_DENIED,this.retriable=!1,this.guidance=`You don't have permission to perform this operation.
432
+ \u2022 Ensure no concurrent modifications occurred`}};zg.StateTransitionError=gE});var b3=w(Hg=>{"use strict";Object.defineProperty(Hg,"__esModule",{value:!0});Hg.PermissionError=void 0;var LW=Cs(),NW=Ps(),yE=class extends LW.ApplicationError{static{a(this,"PermissionError")}constructor(e,t){super(e,t),this.code=NW.ErrorCode.PERMISSION_DENIED,this.retriable=!1,this.guidance=`You don't have permission to perform this operation.
433
433
  To resolve:
434
434
  \u2022 Check file/directory permissions
435
435
  \u2022 Verify you're authenticated
436
436
  \u2022 Ensure you have sufficient privileges
437
- \u2022 Contact administrator if access is needed`}};Hg.PermissionError=yE});var _3=w(Kg=>{"use strict";Object.defineProperty(Kg,"__esModule",{value:!0});Kg.NotFoundError=void 0;var kW=Ps(),MW=Rs(),bE=class extends kW.ApplicationError{static{a(this,"NotFoundError")}constructor(e,t){super(e,t),this.code=MW.ErrorCode.NOT_FOUND,this.retriable=!1,this.guidance=`The requested resource could not be found.
437
+ \u2022 Contact administrator if access is needed`}};Hg.PermissionError=yE});var _3=w(Kg=>{"use strict";Object.defineProperty(Kg,"__esModule",{value:!0});Kg.NotFoundError=void 0;var kW=Cs(),MW=Ps(),bE=class extends kW.ApplicationError{static{a(this,"NotFoundError")}constructor(e,t){super(e,t),this.code=MW.ErrorCode.NOT_FOUND,this.retriable=!1,this.guidance=`The requested resource could not be found.
438
438
  To resolve:
439
439
  \u2022 Verify the resource path/ID is correct
440
440
  \u2022 Check the resource exists
441
441
  \u2022 Ensure proper file extension (.md for notes)
442
- \u2022 Verify resource hasn't been deleted`}};Kg.NotFoundError=bE});var S3=w(Qg=>{"use strict";Object.defineProperty(Qg,"__esModule",{value:!0});Qg.ResourceExhaustedError=void 0;var jW=Ps(),$W=Rs(),_E=class extends jW.ApplicationError{static{a(this,"ResourceExhaustedError")}constructor(e,t){super(e,t),this.code=$W.ErrorCode.RESOURCE_EXHAUSTED,this.retriable=!0,this.guidance=`A resource limit has been exceeded.
442
+ \u2022 Verify resource hasn't been deleted`}};Kg.NotFoundError=bE});var S3=w(Qg=>{"use strict";Object.defineProperty(Qg,"__esModule",{value:!0});Qg.ResourceExhaustedError=void 0;var jW=Cs(),$W=Ps(),_E=class extends jW.ApplicationError{static{a(this,"ResourceExhaustedError")}constructor(e,t){super(e,t),this.code=$W.ErrorCode.RESOURCE_EXHAUSTED,this.retriable=!0,this.guidance=`A resource limit has been exceeded.
443
443
  To resolve:
444
444
  \u2022 Free up system resources (memory, disk space)
445
445
  \u2022 Reduce the size of your request
446
446
  \u2022 Wait and retry (for rate limits)
447
447
  \u2022 Close unused files/connections
448
- \u2022 Paginate large queries`}};Qg.ResourceExhaustedError=_E});var w3=w(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});Xg.ServiceError=void 0;var UW=Ps(),BW=Rs(),SE=class extends UW.ApplicationError{static{a(this,"ServiceError")}constructor(e,t){super(e,t),this.code=BW.ErrorCode.INTERNAL_ERROR,this.retriable=!1,this.guidance=`This is an internal service error.
448
+ \u2022 Paginate large queries`}};Qg.ResourceExhaustedError=_E});var w3=w(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});Xg.ServiceError=void 0;var UW=Cs(),BW=Ps(),SE=class extends UW.ApplicationError{static{a(this,"ServiceError")}constructor(e,t){super(e,t),this.code=BW.ErrorCode.INTERNAL_ERROR,this.retriable=!1,this.guidance=`This is an internal service error.
449
449
  To resolve:
450
450
  \u2022 Check service initialization parameters
451
451
  \u2022 Verify all required dependencies are available
452
452
  \u2022 Review service logs for detailed error information
453
- \u2022 Contact support if the issue persists`}};Xg.ServiceError=SE});var v3=w(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.ServiceError=ur.ResourceExhaustedError=ur.NotFoundError=ur.PermissionError=ur.StateTransitionError=ur.NetworkError=ur.ValidationError=ur.ApplicationError=ur.ErrorCode=void 0;var VW=Rs();Object.defineProperty(ur,"ErrorCode",{enumerable:!0,get:a(function(){return VW.ErrorCode},"get")});var GW=Ps();Object.defineProperty(ur,"ApplicationError",{enumerable:!0,get:a(function(){return GW.ApplicationError},"get")});var qW=m3();Object.defineProperty(ur,"ValidationError",{enumerable:!0,get:a(function(){return qW.ValidationError},"get")});var WW=g3();Object.defineProperty(ur,"NetworkError",{enumerable:!0,get:a(function(){return WW.NetworkError},"get")});var zW=y3();Object.defineProperty(ur,"StateTransitionError",{enumerable:!0,get:a(function(){return zW.StateTransitionError},"get")});var HW=b3();Object.defineProperty(ur,"PermissionError",{enumerable:!0,get:a(function(){return HW.PermissionError},"get")});var KW=_3();Object.defineProperty(ur,"NotFoundError",{enumerable:!0,get:a(function(){return KW.NotFoundError},"get")});var QW=S3();Object.defineProperty(ur,"ResourceExhaustedError",{enumerable:!0,get:a(function(){return QW.ResourceExhaustedError},"get")});var XW=w3();Object.defineProperty(ur,"ServiceError",{enumerable:!0,get:a(function(){return XW.ServiceError},"get")})});var vE=w(Yg=>{"use strict";Object.defineProperty(Yg,"__esModule",{value:!0});Yg.ShapeRegistry=void 0;var wE=class{static{a(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};Yg.ShapeRegistry=wE});var AE=w(Cs=>{"use strict";var YW=Cs&&Cs.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),JW=Cs&&Cs.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),EE=Cs&&Cs.__importStar||(function(){var n=a(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"&&YW(t,e,r[i]);return JW(t,e),t}})();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.ShapeLoader=void 0;var TE=vE(),ua=Oe(),su=qe(),Ar=Jt(),Jg="http://www.w3.org/ns/shacl#",ZW="http://www.w3.org/2001/XMLSchema#",Qme=[["exo__",Ar.Namespace.EXO],["ems__",Ar.Namespace.EMS],["exocmd__",Ar.Namespace.EXOCMD],["ims__",Ar.Namespace.IMS],["ztlk__",Ar.Namespace.ZTLK],["ptms__",Ar.Namespace.PTMS],["lit__",Ar.Namespace.LIT],["inbox__",Ar.Namespace.INBOX],["pmbok__",Ar.Namespace.PMBOK]],ou=class n{static{a(this,"ShapeLoader")}static async loadFromVaultFS(e){let{readdir:t,readFile:r}=await Promise.resolve().then(()=>EE(require("fs/promises"))),i=await Promise.resolve().then(()=>EE(require("path"))),s=new TE.ShapeRegistry;return await n.scanDir(e,s,{readdir:t,readFile:r,path:i}),s}static async loadFromRDFGraph(e){let t=new TE.ShapeRegistry,r=Ar.Namespace.EXO,i=Ar.Namespace.RDFS,s=Ar.Namespace.RDF,o=await n.buildUidClassIndex(e),[c,l]=await Promise.all([e.match(void 0,s.term("type"),r.term("ObjectProperty")),e.match(void 0,s.term("type"),r.term("Property"))]),u=new Set;for(let f of[...c,...l])f.subject instanceof ua.IRI&&u.add(f.subject.value);for(let f of u){let d;try{d=new ua.IRI(f)}catch{continue}let[h,p,y,g,v,_,S,T,I]=await Promise.all([e.match(d,i.term("domain"),void 0),e.match(d,r.term("Property_domain"),void 0),e.match(d,i.term("range"),void 0),e.match(d,r.term("Property_range"),void 0),e.match(d,r.term("Property_cardinality"),void 0),e.match(d,r.term("Property_severity"),void 0),e.match(d,r.term("Asset_label"),void 0),e.match(d,i.term("label"),void 0),e.match(d,r.term("Property_minCount"),void 0)]),A=[...S,...T],R=[...h,...p],q=[...y,...g];if(R.length===0)continue;let Y=null;for(let N of A)if(N.object instanceof su.Literal&&(Y=n.labelToIRI(N.object.value),Y))break;if(!Y)continue;let C=await Promise.all(R.map(async N=>N.object instanceof ua.IRI?await n.resolveClassIRI(N.object.value,e,o):null)),O=Array.from(new Set(C.filter(N=>N!==null))),k=await Promise.all(q.map(async N=>{if(N.object instanceof ua.IRI)return await n.resolveClassIRI(N.object.value,e,o);if(N.object instanceof su.Literal){let j=N.object.value;if(j.startsWith("http://")||j.startsWith("https://"))return j}return null})),H=Array.from(new Set(k.filter(N=>N!==null))),G=n.cardinalityFromIRI(v[0]?.object instanceof ua.IRI?v[0].object.value:void 0),B=n.severityFromValue(_[0]?.object instanceof su.Literal||_[0]?.object instanceof ua.IRI?_[0].object.value:void 0),Z=I[0]?.object,_e=Z instanceof su.Literal?parseInt(Z.value,10):NaN,ie=isNaN(_e)?void 0:_e;t.register({propertyIRI:Y,domain:O,range:H.length>0?H:void 0,cardinality:G,severity:B,minCount:ie})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>EE(require("fs/promises"))),r=await t(e,"utf-8"),i=JSON.parse(r),s=new TE.ShapeRegistry;for(let o of Object.values(i.shapes))s.register(o);return s}static extractUidFromFileIRI(e){let t=n.FILE_IRI_UID_RE.exec(e);return t?t[1].toLowerCase():null}static async buildUidClassIndex(e){let t=Ar.Namespace.RDFS,r=Ar.Namespace.EXO,[i,s]=await Promise.all([e.match(void 0,t.term("label"),void 0),e.match(void 0,r.term("Asset_label"),void 0)]),o=new Map;for(let c of[...i,...s]){if(!(c.subject instanceof ua.IRI)||!(c.object instanceof su.Literal))continue;let l=n.extractUidFromFileIRI(c.subject.value);if(!l||o.has(l))continue;let u=c.object.value.trim();if(/\s/.test(u))continue;let f=n.labelToIRI(u);f&&o.set(l,f)}return o}static async resolveClassIRI(e,t,r){if(e.startsWith("https://exocortex.my/ontology/")||e.startsWith("http://www.w3.org/"))return e;let i;try{i=new ua.IRI(e)}catch{return null}let s=Ar.Namespace.RDFS,o=Ar.Namespace.EXO,[c,l]=await Promise.all([t.match(i,s.term("label"),void 0),t.match(i,o.term("Asset_label"),void 0)]);for(let u of[...c,...l])if(u.object instanceof su.Literal){let f=n.labelToIRI(u.object.value);if(f)return f}if(r){let u=n.extractUidFromFileIRI(e);if(u){let f=r.get(u);if(f)return f}}return e}static async scanDir(e,t,r){let i;try{i=await r.readdir(e,{withFileTypes:!0})}catch{return}for(let s of i){let o=r.path.join(e,s.name);if(s.isDirectory())await n.scanDir(o,t,r);else if(s.isFile()&&s.name.endsWith(".md"))try{await n.processFile(o,t,r.readFile,r.path)}catch{}}}static async processFile(e,t,r,i){let s;try{s=await r(e,"utf-8")}catch{return}let o=n.parseFrontmatter(s);if(!o)return;let c="38277bfa-d7f9-4a75-b856-b23276ab0db3",l="9a1cf31c-9d41-4ef3-9023-584a8d087d16";if(!n.asArray(o.exo__Instance_class).some(C=>{let O=n.extractWikilinkRef(C);return O==="exo__Property"||O==="exo__ObjectProperty"||O===c||O===l||O?.includes("|exo__Property")||O?.includes("|exo__ObjectProperty")}))return;let d=null,h=o.exo__Asset_label;if(typeof h=="string"&&h.trim().length>0)d=h.trim();else if(i){let C=i.basename(e,".md");Ar.Namespace.fromPropertyKey(C)&&(d=C)}if(!d)return;let p=n.labelToIRI(d);if(!p)return;let y=o.exo__Property_domain,g=o.exo__Property_range,v=o.exo__Property_cardinality,_=o.exo__Property_severity,S=o.exo__Property_minCount,T=n.asArray(y).map(C=>n.wikilinkToIRI(C)).filter(C=>C!==null);if(T.length===0)return;let I=n.asArray(g).map(C=>n.wikilinkToIRI(C)).filter(C=>C!==null),A=n.cardinalityFromLabel(typeof v=="string"?v:void 0),R=n.severityFromValue(typeof _=="string"?_:void 0),q=typeof S=="string"?parseInt(S,10):void 0,Y=q!==void 0&&!isNaN(q)?q:void 0;t.register({propertyIRI:p,domain:T,range:I.length>0?I:void 0,cardinality:A,severity:R,minCount:Y})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let r=t[1],i={},s=r.split(/\r?\n/),o=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){o&&c&&c.push(u[1].trim());continue}o&&c&&(i[o]=c,o=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(o=d,c=[]):i[d]=h}return o&&c&&(i[o]=c),i}static labelToIRI(e){let t=Ar.Namespace.fromPropertyKey(e);if(!t)return null;try{return t.namespace.term(t.localName).value}catch{return null}}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),r=/\[\[([^\]]+)\]\]/.exec(t);return r?r[1]:t}static wikilinkToIRI(e){let t=n.extractWikilinkRef(e);if(!t)return null;let r=t.split("|"),i=r.length>1?[r[1],r[0]]:[r[0]];for(let s of i){let o=n.labelToIRI(s.trim());if(o)return o}return t.startsWith("http")?t:t.startsWith("sh:")?Jg+t.substring(3):t.startsWith("xsd:")?ZW+t.substring(4):null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple";if(e.includes(n.CARDINALITY_SINGLE_UID))return"Single";if(e.includes(n.CARDINALITY_MULTIPLE_UID))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=n.extractWikilinkRef(e)??e,r=t.split("|").pop()??t;if(r.includes("Single"))return"Single";if(r.includes("Multiple"))return"Multiple";if(t.includes(n.CARDINALITY_SINGLE_UID))return"Single";if(t.includes(n.CARDINALITY_MULTIPLE_UID))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===Jg+"Violation"?"sh:Violation":e.includes("Warning")||e===Jg+"Warning"?"sh:Warning":e.includes("Info")||e===Jg+"Info"?"sh:Info":"sh:Violation"}};Cs.ShapeLoader=ou;ou.FILE_IRI_UID_RE=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;ou.CARDINALITY_SINGLE_UID="c93c4b2f-b43d-4cc9-8dd0-31514d608da2";ou.CARDINALITY_MULTIPLE_UID="59a37aa7-ffbe-4e0d-ba60-06ae370d880f"});var Zg=w(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.ShapeRegistry=void 0;au.extractUidFromIRI=xE;au.validate=oz;var IE=class{static{a(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(r=>[r.propertyIRI,r])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};au.ShapeRegistry=IE;var ez="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",tz=["http://www.w3.org/2001/XMLSchema#","http://www.w3.org/1999/02/22-rdf-syntax-ns#","http://www.w3.org/2000/01/rdf-schema#","http://www.w3.org/2002/07/owl#","http://www.w3.org/2004/02/skos/core#","http://purl.org/dc/elements/1.1/","http://purl.org/dc/terms/","http://xmlns.com/foaf/0.1/","https://schema.org/","https://exocortex.my/ontology/xsd#","https://exocortex.my/ontology/rdf#","https://exocortex.my/ontology/rdfs#","https://exocortex.my/ontology/owl#","https://exocortex.my/ontology/skos#"];function rz(n){return tz.some(e=>n.startsWith(e))}a(rz,"isExternalOntologyIRI");var nz=["http://www.w3.org/2001/XMLSchema#","https://exocortex.my/ontology/xsd#"];function iz(n){return nz.some(e=>n.startsWith(e))}a(iz,"isXSDDatatypeIRI");var sz=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function xE(n){let e=sz.exec(n);return e?e[1].toLowerCase():null}a(xE,"extractUidFromIRI");function oz(n,e,t,r){let i=new Map,s=new Map;for(let l of n){let{subject:u,predicate:f,object:d}=l;if(u.type!=="iri"||f.type!=="iri"||d.type!=="iri"&&d.type!=="literal")continue;let h=u.value,p=f.value,y=d;if(p===e.typePredicateIRI||p===ez){if(y.type==="iri"){let v=i.get(h)??[];v.push(y.value),i.set(h,v);let _=xE(h);if(_){let S=`uid:${_}`,T=i.get(S)??[];T.push(y.value),i.set(S,T)}}}else{let v=s.get(h);v||(v=new Map,s.set(h,v));let _=v.get(p)??[];_.push(y),v.set(p,_)}}let o=[],c=new Set([...i.keys(),...s.keys()]);for(let l of c){if(l.startsWith("uid:"))continue;let u=i.get(l)??[],f=s.get(l)??new Map;for(let d of e.getAllShapes()){if(!(d.domain.length===0||d.domain.some(y=>u.some(g=>g===y||t.isSubClassOf(g,y)))))continue;let p=f.get(d.propertyIRI)??[];if(d.minCount!==void 0&&d.minCount>0&&p.length<d.minCount){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"minCount",message:d.message??`sh:minCount violation: expected at least ${d.minCount} value(s) for <${d.propertyIRI}>`});continue}if(p.length!==0){if(d.cardinality==="Single"&&p.length>1){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"maxCount",message:d.message??`sh:maxCount violation: expected at most 1 value for <${d.propertyIRI}>, got ${p.length}`});continue}if(d.range&&d.range.length>0){for(let y of p)if(y.type==="iri"){if(rz(y.value))continue;let g=i.get(y.value)??[];if(g.length===0){let _=xE(y.value);_&&(g=i.get(`uid:${_}`)??[])}if(!d.range.some(_=>g.some(S=>S===_||t.isSubClassOf(S,_)))){let _=g.length===0;o.push({focusNode:l,propertyPath:d.propertyIRI,severity:_?"sh:Warning":d.severity,constraint:"class",message:_?`sh:class unresolvable-ref: <${y.value}> has no resolvable type in this vault (cross-vault, symbolic, or external reference); not validated against ${d.range.join(" | ")}`:d.message??`sh:class violation: <${y.value}> does not conform to expected class ${d.range.join(" | ")}`,actualValue:y.value,expectedRange:d.range.join(" | ")})}}else if(y.type==="literal"){let g=d.range.filter(S=>iz(S));if(g.length===0)continue;let v=y.datatype??"http://www.w3.org/2001/XMLSchema#string";g.some(S=>S===v)||o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"datatype",message:d.message??`sh:datatype violation: literal "${y.value}" has datatype <${v}>, expected ${g.join(" | ")}`,actualValue:y.value,expectedRange:g.join(" | ")})}}}}}if(r?.closedWorldMode)for(let l of c){let u=s.get(l)??new Map;for(let f of u.keys())e.hasShape(f)||o.push({focusNode:l,propertyPath:f,severity:"sh:Warning",constraint:"unknown-property",message:`Unknown property: <${f}> has no registered shape`})}return o.sort((l,u)=>{let f=l.focusNode.localeCompare(u.focusNode);return f!==0?f:l.propertyPath.localeCompare(u.propertyPath)}),{conforms:!o.some(l=>l.severity==="sh:Violation"),violations:o}}a(oz,"validate")});var E3=w(ey=>{"use strict";Object.defineProperty(ey,"__esModule",{value:!0});ey.ApplicationErrorHandler=void 0;var RE=Ps(),az=Rs(),cz=ra(),PE=class{static{a(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 o=this.calculateDelay(i);this.callTelemetryHooks("onRetry",r,i+1,o),this.logger?.debug(`Retrying after ${o}ms (attempt ${i+1}/${this.retryConfig.maxRetries})`),await this.sleep(o),i++}throw r}registerTelemetryHook(e){this.telemetryHooks.add(e)}unregisterTelemetryHook(e){this.telemetryHooks.delete(e)}ensureApplicationError(e,t){if(e instanceof RE.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends RE.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 RE.ApplicationError{static{a(this,"UnknownError")}constructor(s,o){super(s,{originalError:o.name,...t}),this.code=az.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(`
454
- `)}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){cz.LoggingService.error("Error in telemetry hook",i instanceof Error?i:new Error(String(i)))}}};ey.ApplicationErrorHandler=PE});var T3=w(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.ApplicationErrorHandler=void 0;var lz=E3();Object.defineProperty(ty,"ApplicationErrorHandler",{enumerable:!0,get:a(function(){return lz.ApplicationErrorHandler},"get")})});var OE=w(ry=>{"use strict";Object.defineProperty(ry,"__esModule",{value:!0});ry.ClassHierarchy=void 0;var uz="http://www.w3.org/2000/01/rdf-schema#subClassOf",CE=class{static{a(this,"ClassHierarchy")}constructor(e){this.adjacency=new Map;for(let t of e){if(t.predicate.type!=="iri"||t.predicate.value!==uz||t.subject.type!=="iri"||t.object.type!=="iri")continue;let r=t.subject.value,i=t.object.value,s=this.adjacency.get(r);s||(s=new Set,this.adjacency.set(r,s)),s.add(i)}}isSubClassOf(e,t){if(e===t)return!0;let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let o=this.adjacency.get(s);if(o)for(let c of o){if(c===t)return!0;r.has(c)||i.push(c)}}return!1}getAncestors(e){let t=new Set,r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let o=this.adjacency.get(s);if(o)for(let c of o)t.add(c),r.has(c)||i.push(c)}return t}};ry.ClassHierarchy=CE});var I3=w(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.ValidatorDaemon=Os.IDLE_TIMEOUT_MS=Os.DEFAULT_SOCKET_PATH=void 0;var A3=Zg(),fz=AE(),dz=OE(),DE=typeof process<"u"?process.env:void 0;Os.DEFAULT_SOCKET_PATH=DE?`${DE.HOME??DE.USERPROFILE??"/tmp"}/.cache/exocortex/validator.sock`:"/tmp/.cache/exocortex/validator.sock";Os.IDLE_TIMEOUT_MS=300*1e3;var FE=class{static{a(this,"ValidatorDaemon")}constructor(e=Os.DEFAULT_SOCKET_PATH,t=Os.IDLE_TIMEOUT_MS){this.registryCache=new Map,this.server=null,this.idleTimer=null,this.socketPath=e,this.idleTimeoutMs=t}async start(){let e=require("net"),t=require("fs/promises"),r=require("path");await t.mkdir(r.dirname(this.socketPath),{recursive:!0});try{await t.unlink(this.socketPath)}catch{}this.server=e.createServer(c=>{this.handleConnection(c)});let i=this.server;await new Promise((c,l)=>{i.on("error",l),i.listen(this.socketPath,c)}),this.resetIdleTimer();let s=a(()=>{this.stop()},"handleSignal"),o=typeof process<"u"?process:void 0;o?.once("SIGTERM",s),o?.once("SIGINT",s)}async stop(){if(this.idleTimer!==null&&(clearTimeout(this.idleTimer),this.idleTimer=null),!this.server)return;let e=this.server;this.server=null,await new Promise(t=>{e.close(()=>t())})}resetIdleTimer(){this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{typeof process<"u"&&process.exit(0)},this.idleTimeoutMs)}handleConnection(e){let t="";e.setEncoding("utf-8"),e.on("data",r=>{t+=r;let i=t.split(`
453
+ \u2022 Contact support if the issue persists`}};Xg.ServiceError=SE});var v3=w(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.ServiceError=ur.ResourceExhaustedError=ur.NotFoundError=ur.PermissionError=ur.StateTransitionError=ur.NetworkError=ur.ValidationError=ur.ApplicationError=ur.ErrorCode=void 0;var VW=Ps();Object.defineProperty(ur,"ErrorCode",{enumerable:!0,get:a(function(){return VW.ErrorCode},"get")});var GW=Cs();Object.defineProperty(ur,"ApplicationError",{enumerable:!0,get:a(function(){return GW.ApplicationError},"get")});var qW=m3();Object.defineProperty(ur,"ValidationError",{enumerable:!0,get:a(function(){return qW.ValidationError},"get")});var WW=g3();Object.defineProperty(ur,"NetworkError",{enumerable:!0,get:a(function(){return WW.NetworkError},"get")});var zW=y3();Object.defineProperty(ur,"StateTransitionError",{enumerable:!0,get:a(function(){return zW.StateTransitionError},"get")});var HW=b3();Object.defineProperty(ur,"PermissionError",{enumerable:!0,get:a(function(){return HW.PermissionError},"get")});var KW=_3();Object.defineProperty(ur,"NotFoundError",{enumerable:!0,get:a(function(){return KW.NotFoundError},"get")});var QW=S3();Object.defineProperty(ur,"ResourceExhaustedError",{enumerable:!0,get:a(function(){return QW.ResourceExhaustedError},"get")});var XW=w3();Object.defineProperty(ur,"ServiceError",{enumerable:!0,get:a(function(){return XW.ServiceError},"get")})});var vE=w(Yg=>{"use strict";Object.defineProperty(Yg,"__esModule",{value:!0});Yg.ShapeRegistry=void 0;var wE=class{static{a(this,"ShapeRegistry")}constructor(){this.shapes=new Map}get(e){return this.shapes.get(e)}register(e){this.shapes.set(e.propertyIRI,e)}getAll(){return Array.from(this.shapes.values())}get size(){return this.shapes.size}};Yg.ShapeRegistry=wE});var AE=w(Os=>{"use strict";var YW=Os&&Os.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),JW=Os&&Os.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),EE=Os&&Os.__importStar||(function(){var n=a(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"&&YW(t,e,r[i]);return JW(t,e),t}})();Object.defineProperty(Os,"__esModule",{value:!0});Os.ShapeLoader=void 0;var TE=vE(),ua=Oe(),su=qe(),Ar=Jt(),Jg="http://www.w3.org/ns/shacl#",ZW="http://www.w3.org/2001/XMLSchema#",Qme=[["exo__",Ar.Namespace.EXO],["ems__",Ar.Namespace.EMS],["exocmd__",Ar.Namespace.EXOCMD],["ims__",Ar.Namespace.IMS],["ztlk__",Ar.Namespace.ZTLK],["ptms__",Ar.Namespace.PTMS],["lit__",Ar.Namespace.LIT],["inbox__",Ar.Namespace.INBOX],["pmbok__",Ar.Namespace.PMBOK]],ou=class n{static{a(this,"ShapeLoader")}static async loadFromVaultFS(e){let{readdir:t,readFile:r}=await Promise.resolve().then(()=>EE(require("fs/promises"))),i=await Promise.resolve().then(()=>EE(require("path"))),s=new TE.ShapeRegistry;return await n.scanDir(e,s,{readdir:t,readFile:r,path:i}),s}static async loadFromRDFGraph(e){let t=new TE.ShapeRegistry,r=Ar.Namespace.EXO,i=Ar.Namespace.RDFS,s=Ar.Namespace.RDF,o=await n.buildUidClassIndex(e),[c,l]=await Promise.all([e.match(void 0,s.term("type"),r.term("ObjectProperty")),e.match(void 0,s.term("type"),r.term("Property"))]),u=new Set;for(let f of[...c,...l])f.subject instanceof ua.IRI&&u.add(f.subject.value);for(let f of u){let d;try{d=new ua.IRI(f)}catch{continue}let[h,p,y,g,v,_,S,T,I]=await Promise.all([e.match(d,i.term("domain"),void 0),e.match(d,r.term("Property_domain"),void 0),e.match(d,i.term("range"),void 0),e.match(d,r.term("Property_range"),void 0),e.match(d,r.term("Property_cardinality"),void 0),e.match(d,r.term("Property_severity"),void 0),e.match(d,r.term("Asset_label"),void 0),e.match(d,i.term("label"),void 0),e.match(d,r.term("Property_minCount"),void 0)]),A=[...S,...T],R=[...h,...p],q=[...y,...g];if(R.length===0)continue;let Y=null;for(let N of A)if(N.object instanceof su.Literal&&(Y=n.labelToIRI(N.object.value),Y))break;if(!Y)continue;let C=await Promise.all(R.map(async N=>N.object instanceof ua.IRI?await n.resolveClassIRI(N.object.value,e,o):null)),O=Array.from(new Set(C.filter(N=>N!==null))),k=await Promise.all(q.map(async N=>{if(N.object instanceof ua.IRI)return await n.resolveClassIRI(N.object.value,e,o);if(N.object instanceof su.Literal){let j=N.object.value;if(j.startsWith("http://")||j.startsWith("https://"))return j}return null})),H=Array.from(new Set(k.filter(N=>N!==null))),G=n.cardinalityFromIRI(v[0]?.object instanceof ua.IRI?v[0].object.value:void 0),B=n.severityFromValue(_[0]?.object instanceof su.Literal||_[0]?.object instanceof ua.IRI?_[0].object.value:void 0),Z=I[0]?.object,_e=Z instanceof su.Literal?parseInt(Z.value,10):NaN,ie=isNaN(_e)?void 0:_e;t.register({propertyIRI:Y,domain:O,range:H.length>0?H:void 0,cardinality:G,severity:B,minCount:ie})}return t}static async loadFromShapeJSON(e){let{readFile:t}=await Promise.resolve().then(()=>EE(require("fs/promises"))),r=await t(e,"utf-8"),i=JSON.parse(r),s=new TE.ShapeRegistry;for(let o of Object.values(i.shapes))s.register(o);return s}static extractUidFromFileIRI(e){let t=n.FILE_IRI_UID_RE.exec(e);return t?t[1].toLowerCase():null}static async buildUidClassIndex(e){let t=Ar.Namespace.RDFS,r=Ar.Namespace.EXO,[i,s]=await Promise.all([e.match(void 0,t.term("label"),void 0),e.match(void 0,r.term("Asset_label"),void 0)]),o=new Map;for(let c of[...i,...s]){if(!(c.subject instanceof ua.IRI)||!(c.object instanceof su.Literal))continue;let l=n.extractUidFromFileIRI(c.subject.value);if(!l||o.has(l))continue;let u=c.object.value.trim();if(/\s/.test(u))continue;let f=n.labelToIRI(u);f&&o.set(l,f)}return o}static async resolveClassIRI(e,t,r){if(e.startsWith("https://exocortex.my/ontology/")||e.startsWith("http://www.w3.org/"))return e;let i;try{i=new ua.IRI(e)}catch{return null}let s=Ar.Namespace.RDFS,o=Ar.Namespace.EXO,[c,l]=await Promise.all([t.match(i,s.term("label"),void 0),t.match(i,o.term("Asset_label"),void 0)]);for(let u of[...c,...l])if(u.object instanceof su.Literal){let f=n.labelToIRI(u.object.value);if(f)return f}if(r){let u=n.extractUidFromFileIRI(e);if(u){let f=r.get(u);if(f)return f}}return e}static async scanDir(e,t,r){let i;try{i=await r.readdir(e,{withFileTypes:!0})}catch{return}for(let s of i){let o=r.path.join(e,s.name);if(s.isDirectory())await n.scanDir(o,t,r);else if(s.isFile()&&s.name.endsWith(".md"))try{await n.processFile(o,t,r.readFile,r.path)}catch{}}}static async processFile(e,t,r,i){let s;try{s=await r(e,"utf-8")}catch{return}let o=n.parseFrontmatter(s);if(!o)return;let c="38277bfa-d7f9-4a75-b856-b23276ab0db3",l="9a1cf31c-9d41-4ef3-9023-584a8d087d16";if(!n.asArray(o.exo__Instance_class).some(C=>{let O=n.extractWikilinkRef(C);return O==="exo__Property"||O==="exo__ObjectProperty"||O===c||O===l||O?.includes("|exo__Property")||O?.includes("|exo__ObjectProperty")}))return;let d=null,h=o.exo__Asset_label;if(typeof h=="string"&&h.trim().length>0)d=h.trim();else if(i){let C=i.basename(e,".md");Ar.Namespace.fromPropertyKey(C)&&(d=C)}if(!d)return;let p=n.labelToIRI(d);if(!p)return;let y=o.exo__Property_domain,g=o.exo__Property_range,v=o.exo__Property_cardinality,_=o.exo__Property_severity,S=o.exo__Property_minCount,T=n.asArray(y).map(C=>n.wikilinkToIRI(C)).filter(C=>C!==null);if(T.length===0)return;let I=n.asArray(g).map(C=>n.wikilinkToIRI(C)).filter(C=>C!==null),A=n.cardinalityFromLabel(typeof v=="string"?v:void 0),R=n.severityFromValue(typeof _=="string"?_:void 0),q=typeof S=="string"?parseInt(S,10):void 0,Y=q!==void 0&&!isNaN(q)?q:void 0;t.register({propertyIRI:p,domain:T,range:I.length>0?I:void 0,cardinality:A,severity:R,minCount:Y})}static parseFrontmatter(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);if(!t)return null;let r=t[1],i={},s=r.split(/\r?\n/),o=null,c=null;for(let l of s){let u=/^ {2}- (.*)$/.exec(l);if(u){o&&c&&c.push(u[1].trim());continue}o&&c&&(i[o]=c,o=null,c=null);let f=/^([^:]+):\s*(.*)$/.exec(l);if(!f)continue;let d=f[1].trim(),h=f[2].trim();h===""?(o=d,c=[]):i[d]=h}return o&&c&&(i[o]=c),i}static labelToIRI(e){let t=Ar.Namespace.fromPropertyKey(e);if(!t)return null;try{return t.namespace.term(t.localName).value}catch{return null}}static extractWikilinkRef(e){let t=e.replace(/^["']|["']$/g,""),r=/\[\[([^\]]+)\]\]/.exec(t);return r?r[1]:t}static wikilinkToIRI(e){let t=n.extractWikilinkRef(e);if(!t)return null;let r=t.split("|"),i=r.length>1?[r[1],r[0]]:[r[0]];for(let s of i){let o=n.labelToIRI(s.trim());if(o)return o}return t.startsWith("http")?t:t.startsWith("sh:")?Jg+t.substring(3):t.startsWith("xsd:")?ZW+t.substring(4):null}static asArray(e){return Array.isArray(e)?e.map(String):typeof e=="string"?[e]:[]}static cardinalityFromIRI(e){if(e){if(e.endsWith("PropertyCardinalitySingle"))return"Single";if(e.endsWith("PropertyCardinalityMultiple"))return"Multiple";if(e.includes(n.CARDINALITY_SINGLE_UID))return"Single";if(e.includes(n.CARDINALITY_MULTIPLE_UID))return"Multiple"}}static cardinalityFromLabel(e){if(!e)return;let t=n.extractWikilinkRef(e)??e,r=t.split("|").pop()??t;if(r.includes("Single"))return"Single";if(r.includes("Multiple"))return"Multiple";if(t.includes(n.CARDINALITY_SINGLE_UID))return"Single";if(t.includes(n.CARDINALITY_MULTIPLE_UID))return"Multiple"}static severityFromValue(e){return!e||e.includes("Violation")||e===Jg+"Violation"?"sh:Violation":e.includes("Warning")||e===Jg+"Warning"?"sh:Warning":e.includes("Info")||e===Jg+"Info"?"sh:Info":"sh:Violation"}};Os.ShapeLoader=ou;ou.FILE_IRI_UID_RE=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;ou.CARDINALITY_SINGLE_UID="c93c4b2f-b43d-4cc9-8dd0-31514d608da2";ou.CARDINALITY_MULTIPLE_UID="59a37aa7-ffbe-4e0d-ba60-06ae370d880f"});var Zg=w(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.ShapeRegistry=void 0;au.extractUidFromIRI=xE;au.validate=oz;var IE=class{static{a(this,"ShapeRegistry")}constructor(e=[],t="https://exocortex.my/ontology/exo#Instance_class"){this.shapeMap=new Map(e.map(r=>[r.propertyIRI,r])),this.typePredicateIRI=t}getShape(e){return this.shapeMap.get(e)}getAllShapes(){return Array.from(this.shapeMap.values())}hasShape(e){return this.shapeMap.has(e)}};au.ShapeRegistry=IE;var ez="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",tz=["http://www.w3.org/2001/XMLSchema#","http://www.w3.org/1999/02/22-rdf-syntax-ns#","http://www.w3.org/2000/01/rdf-schema#","http://www.w3.org/2002/07/owl#","http://www.w3.org/2004/02/skos/core#","http://purl.org/dc/elements/1.1/","http://purl.org/dc/terms/","http://xmlns.com/foaf/0.1/","https://schema.org/","https://exocortex.my/ontology/xsd#","https://exocortex.my/ontology/rdf#","https://exocortex.my/ontology/rdfs#","https://exocortex.my/ontology/owl#","https://exocortex.my/ontology/skos#"];function rz(n){return tz.some(e=>n.startsWith(e))}a(rz,"isExternalOntologyIRI");var nz=["http://www.w3.org/2001/XMLSchema#","https://exocortex.my/ontology/xsd#"];function iz(n){return nz.some(e=>n.startsWith(e))}a(iz,"isXSDDatatypeIRI");var sz=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.md$/i;function xE(n){let e=sz.exec(n);return e?e[1].toLowerCase():null}a(xE,"extractUidFromIRI");function oz(n,e,t,r){let i=new Map,s=new Map;for(let l of n){let{subject:u,predicate:f,object:d}=l;if(u.type!=="iri"||f.type!=="iri"||d.type!=="iri"&&d.type!=="literal")continue;let h=u.value,p=f.value,y=d;if(p===e.typePredicateIRI||p===ez){if(y.type==="iri"){let v=i.get(h)??[];v.push(y.value),i.set(h,v);let _=xE(h);if(_){let S=`uid:${_}`,T=i.get(S)??[];T.push(y.value),i.set(S,T)}}}else{let v=s.get(h);v||(v=new Map,s.set(h,v));let _=v.get(p)??[];_.push(y),v.set(p,_)}}let o=[],c=new Set([...i.keys(),...s.keys()]);for(let l of c){if(l.startsWith("uid:"))continue;let u=i.get(l)??[],f=s.get(l)??new Map;for(let d of e.getAllShapes()){if(!(d.domain.length===0||d.domain.some(y=>u.some(g=>g===y||t.isSubClassOf(g,y)))))continue;let p=f.get(d.propertyIRI)??[];if(d.minCount!==void 0&&d.minCount>0&&p.length<d.minCount){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"minCount",message:d.message??`sh:minCount violation: expected at least ${d.minCount} value(s) for <${d.propertyIRI}>`});continue}if(p.length!==0){if(d.cardinality==="Single"&&p.length>1){o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"maxCount",message:d.message??`sh:maxCount violation: expected at most 1 value for <${d.propertyIRI}>, got ${p.length}`});continue}if(d.range&&d.range.length>0){for(let y of p)if(y.type==="iri"){if(rz(y.value))continue;let g=i.get(y.value)??[];if(g.length===0){let _=xE(y.value);_&&(g=i.get(`uid:${_}`)??[])}if(!d.range.some(_=>g.some(S=>S===_||t.isSubClassOf(S,_)))){let _=g.length===0;o.push({focusNode:l,propertyPath:d.propertyIRI,severity:_?"sh:Warning":d.severity,constraint:"class",message:_?`sh:class unresolvable-ref: <${y.value}> has no resolvable type in this vault (cross-vault, symbolic, or external reference); not validated against ${d.range.join(" | ")}`:d.message??`sh:class violation: <${y.value}> does not conform to expected class ${d.range.join(" | ")}`,actualValue:y.value,expectedRange:d.range.join(" | ")})}}else if(y.type==="literal"){let g=d.range.filter(S=>iz(S));if(g.length===0)continue;let v=y.datatype??"http://www.w3.org/2001/XMLSchema#string";g.some(S=>S===v)||o.push({focusNode:l,propertyPath:d.propertyIRI,severity:d.severity,constraint:"datatype",message:d.message??`sh:datatype violation: literal "${y.value}" has datatype <${v}>, expected ${g.join(" | ")}`,actualValue:y.value,expectedRange:g.join(" | ")})}}}}}if(r?.closedWorldMode)for(let l of c){let u=s.get(l)??new Map;for(let f of u.keys())e.hasShape(f)||o.push({focusNode:l,propertyPath:f,severity:"sh:Warning",constraint:"unknown-property",message:`Unknown property: <${f}> has no registered shape`})}return o.sort((l,u)=>{let f=l.focusNode.localeCompare(u.focusNode);return f!==0?f:l.propertyPath.localeCompare(u.propertyPath)}),{conforms:!o.some(l=>l.severity==="sh:Violation"),violations:o}}a(oz,"validate")});var E3=w(ey=>{"use strict";Object.defineProperty(ey,"__esModule",{value:!0});ey.ApplicationErrorHandler=void 0;var RE=Cs(),az=Ps(),cz=ra(),PE=class{static{a(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 o=this.calculateDelay(i);this.callTelemetryHooks("onRetry",r,i+1,o),this.logger?.debug(`Retrying after ${o}ms (attempt ${i+1}/${this.retryConfig.maxRetries})`),await this.sleep(o),i++}throw r}registerTelemetryHook(e){this.telemetryHooks.add(e)}unregisterTelemetryHook(e){this.telemetryHooks.delete(e)}ensureApplicationError(e,t){if(e instanceof RE.ApplicationError){if(t){let i=e,s={...e.context,...t};return new class extends RE.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 RE.ApplicationError{static{a(this,"UnknownError")}constructor(s,o){super(s,{originalError:o.name,...t}),this.code=az.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(`
454
+ `)}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){cz.LoggingService.error("Error in telemetry hook",i instanceof Error?i:new Error(String(i)))}}};ey.ApplicationErrorHandler=PE});var T3=w(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.ApplicationErrorHandler=void 0;var lz=E3();Object.defineProperty(ty,"ApplicationErrorHandler",{enumerable:!0,get:a(function(){return lz.ApplicationErrorHandler},"get")})});var OE=w(ry=>{"use strict";Object.defineProperty(ry,"__esModule",{value:!0});ry.ClassHierarchy=void 0;var uz="http://www.w3.org/2000/01/rdf-schema#subClassOf",CE=class{static{a(this,"ClassHierarchy")}constructor(e){this.adjacency=new Map;for(let t of e){if(t.predicate.type!=="iri"||t.predicate.value!==uz||t.subject.type!=="iri"||t.object.type!=="iri")continue;let r=t.subject.value,i=t.object.value,s=this.adjacency.get(r);s||(s=new Set,this.adjacency.set(r,s)),s.add(i)}}isSubClassOf(e,t){if(e===t)return!0;let r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let o=this.adjacency.get(s);if(o)for(let c of o){if(c===t)return!0;r.has(c)||i.push(c)}}return!1}getAncestors(e){let t=new Set,r=new Set,i=[e];for(;i.length>0;){let s=i.shift();if(s===void 0)break;if(r.has(s))continue;r.add(s);let o=this.adjacency.get(s);if(o)for(let c of o)t.add(c),r.has(c)||i.push(c)}return t}};ry.ClassHierarchy=CE});var I3=w(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.ValidatorDaemon=Ds.IDLE_TIMEOUT_MS=Ds.DEFAULT_SOCKET_PATH=void 0;var A3=Zg(),fz=AE(),dz=OE(),DE=typeof process<"u"?process.env:void 0;Ds.DEFAULT_SOCKET_PATH=DE?`${DE.HOME??DE.USERPROFILE??"/tmp"}/.cache/exocortex/validator.sock`:"/tmp/.cache/exocortex/validator.sock";Ds.IDLE_TIMEOUT_MS=300*1e3;var FE=class{static{a(this,"ValidatorDaemon")}constructor(e=Ds.DEFAULT_SOCKET_PATH,t=Ds.IDLE_TIMEOUT_MS){this.registryCache=new Map,this.server=null,this.idleTimer=null,this.socketPath=e,this.idleTimeoutMs=t}async start(){let e=require("net"),t=require("fs/promises"),r=require("path");await t.mkdir(r.dirname(this.socketPath),{recursive:!0});try{await t.unlink(this.socketPath)}catch{}this.server=e.createServer(c=>{this.handleConnection(c)});let i=this.server;await new Promise((c,l)=>{i.on("error",l),i.listen(this.socketPath,c)}),this.resetIdleTimer();let s=a(()=>{this.stop()},"handleSignal"),o=typeof process<"u"?process:void 0;o?.once("SIGTERM",s),o?.once("SIGINT",s)}async stop(){if(this.idleTimer!==null&&(clearTimeout(this.idleTimer),this.idleTimer=null),!this.server)return;let e=this.server;this.server=null,await new Promise(t=>{e.close(()=>t())})}resetIdleTimer(){this.idleTimer!==null&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{typeof process<"u"&&process.exit(0)},this.idleTimeoutMs)}handleConnection(e){let t="";e.setEncoding("utf-8"),e.on("data",r=>{t+=r;let i=t.split(`
455
455
  `);t=i.pop()??"";for(let s of i){let o=s.trim();o&&this.handleRequest(o,e)}}),e.on("error",()=>{e.destroy()})}async handleRequest(e,t){this.resetIdleTimer();let r;try{let i=JSON.parse(e),s=await this.getRegistry(i.registryPath),o=new dz.ClassHierarchy(i.subclassTriples??[]);r={report:(0,A3.validate)(i.triples,s,o,{closedWorldMode:i.closedWorldMode})}}catch(i){r={error:i instanceof Error?i.message:String(i)}}t.destroyed||t.write(JSON.stringify(r)+`
456
- `)}async getRegistry(e){let t=this.registryCache.get(e);if(t)return t;let r=await fz.ShapeLoader.loadFromShapeJSON(e),i=new A3.ShapeRegistry(r.getAll());return this.registryCache.set(e,i),i}};Os.ValidatorDaemon=FE});var LE=w(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});ny.parseTarball=P3;ny.parseTarballGzip=bz;var hz={0:"file",1:"hardLink",2:"symbolicLink",3:"characterDevice",4:"blockDevice",5:"directory",6:"fifo",7:"contiguousFile",g:"globalExtendedHeader",x:"extendedHeader",D:"gnuDirectory",I:"gnuInodeMetadata",K:"gnuLongLinkName",L:"gnuLongFileName",N:"gnuOldLongFileName",M:"gnuMultiVolume",S:"gnuSparseFile",E:"gnuExtendedSparse"},pz=new Set(["extendedHeader","globalExtendedHeader","gnuLongFileName","gnuOldLongFileName","gnuLongLinkName"]),x3;function R3(){return x3??(x3=new TextDecoder)}a(R3,"getDecoder");function cd(n,e,t){let r=n.subarray(e,e+t),i=r.indexOf(0);return R3().decode(i===-1?r:r.subarray(0,i))}a(cd,"readString");function mz(n,e,t){let r="";for(let s=0;s<t;s++)r+=String.fromCodePoint(n[e+s]);let i=Number.parseInt(r,8);return Number.isNaN(i)?0:i}a(mz,"readNumber");function gz(n){let e=R3().decode(n),t={};for(let r of e.split(`
456
+ `)}async getRegistry(e){let t=this.registryCache.get(e);if(t)return t;let r=await fz.ShapeLoader.loadFromShapeJSON(e),i=new A3.ShapeRegistry(r.getAll());return this.registryCache.set(e,i),i}};Ds.ValidatorDaemon=FE});var LE=w(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});ny.parseTarball=P3;ny.parseTarballGzip=bz;var hz={0:"file",1:"hardLink",2:"symbolicLink",3:"characterDevice",4:"blockDevice",5:"directory",6:"fifo",7:"contiguousFile",g:"globalExtendedHeader",x:"extendedHeader",D:"gnuDirectory",I:"gnuInodeMetadata",K:"gnuLongLinkName",L:"gnuLongFileName",N:"gnuOldLongFileName",M:"gnuMultiVolume",S:"gnuSparseFile",E:"gnuExtendedSparse"},pz=new Set(["extendedHeader","globalExtendedHeader","gnuLongFileName","gnuOldLongFileName","gnuLongLinkName"]),x3;function R3(){return x3??(x3=new TextDecoder)}a(R3,"getDecoder");function cd(n,e,t){let r=n.subarray(e,e+t),i=r.indexOf(0);return R3().decode(i===-1?r:r.subarray(0,i))}a(cd,"readString");function mz(n,e,t){let r="";for(let s=0;s<t;s++)r+=String.fromCodePoint(n[e+s]);let i=Number.parseInt(r,8);return Number.isNaN(i)?0:i}a(mz,"readNumber");function gz(n){let e=R3().decode(n),t={};for(let r of e.split(`
457
457
  `)){let i=r.indexOf("=");if(i===-1)continue;let s=r.slice(r.indexOf(" ")+1,i),o=r.slice(i+1);s&&(t[s]=o)}return t}a(gz,"parseExtendedHeaders");function yz(n){let e=n.replace(/\\/g,"/");e=e.replace(/^[a-zA-Z]:\//,""),e=e.replace(/^\/+/,"");let t=e.startsWith("./"),r=e.split("/"),i=[];for(let o of r)o===".."?i.pop():o!=="."&&o!==""&&i.push(o);let s=i.join("/");return t&&!s.startsWith("./")&&(s="./"+s),n.endsWith("/")&&!s.endsWith("/")&&(s+="/"),s}a(yz,"sanitizePath");function P3(n){let e=n.byteOffset===0&&n.byteLength===n.buffer.byteLength?n:n.slice(),t=[],r=0,i,s;for(;r+512<=e.byteLength;){let o=cd(e,r,100);if(o.length===0)break;let c=!1;if(i){let p=i.path??i.linkpath;p&&(o=p,c=!0)}let l=mz(e,r+124,12),u=512+512*Math.trunc(l/512)+(l%512?512:0),f=cd(e,r+156,1)||"0",d=hz[f]??f;if(d==="extendedHeader"||d==="globalExtendedHeader"){let p=gz(e.subarray(r+512,r+512+l));d==="extendedHeader"?i=p:(i=void 0,s={...s,...p}),r+=u;continue}if(pz.has(d)){i={path:cd(e,r+512,l)},r+=u;continue}if(!c&&cd(e,r+257,6).startsWith("ustar")){let y=cd(e,r+345,155);y.length>0&&(o=`${y}/${o}`)}o=yz(o);let h=l===0?void 0:e.subarray(r+512,r+512+l);t.push({name:o,type:d,size:l,data:h}),i=void 0,r+=u}return t}a(P3,"parseTarball");async function bz(n){let e=new Uint8Array(n instanceof Uint8Array?n:new Uint8Array(n)),t=new DecompressionStream("gzip"),r=t.writable.getWriter(),[,i]=await Promise.all([r.write(e).then(()=>r.close()),new Response(t.readable).arrayBuffer()]);return P3(new Uint8Array(i))}a(bz,"parseTarballGzip")});var sy=w(iy=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});iy.isBinaryPayload=kE;iy.restCreateCommit=Sz;function kE(n){return typeof n!="string"}a(kE,"isBinaryPayload");var _z="https://api.github.com";function C3(n){if(n!==null&&typeof n=="object"&&"object"in n){let e=n.object;if(e!==null&&typeof e=="object"&&"sha"in e){let t=e.sha;return typeof t=="string"?t:void 0}}}a(C3,"readObjectSha");function NE(n){if(n!==null&&typeof n=="object"&&"sha"in n){let e=n.sha;return typeof e=="string"?e:void 0}}a(NE,"readSha");async function Sz(n,e){let{owner:t,repo:r,branch:i,files:s,message:o}=e,c=e.deletions??[],l=(e.baseURL??_z).replace(/\/$/,""),u=e.redact??(Y=>Y);if(typeof t!="string"||t.length===0)throw new Error("restCreateCommit: owner is required");if(typeof r!="string"||r.length===0)throw new Error("restCreateCommit: repo is required");if(typeof i!="string"||i.length===0)throw new Error("GitHub createCommit: branch is required");if(!(s instanceof Map)||s.size===0&&c.length===0)throw new Error("GitHub createCommit: files map must be non-empty (unless deletions are provided)");let f=new Set;for(let Y of c){if(typeof Y!="string"||Y.length===0)throw new Error("GitHub createCommit: deletion path must be a non-empty string");if(s.has(Y))throw new Error(u(`GitHub createCommit: path ${Y} is both written and deleted \u2014 ambiguous`));f.add(Y)}if(typeof o!="string"||o.length===0)throw new Error("GitHub createCommit: message is required");let d=encodeURIComponent(t),h=encodeURIComponent(r),p=encodeURIComponent(i),y=await n({method:"GET",url:`${l}/repos/${d}/${h}/git/refs/heads/${p}`}),g=C3(y?.json);if(typeof g!="string"||g.length===0)throw new Error(u(`GitHub createCommit: missing object.sha for ref heads/${i}`));let v=new Map;for(let[Y,C]of s){if(!kE(C))continue;let O=await n({method:"POST",url:`${l}/repos/${d}/${h}/git/blobs`,contentType:"application/json",body:JSON.stringify({content:C.base64,encoding:"base64"})}),k=NE(O?.json);if(typeof k!="string"||k.length===0)throw new Error(u(`GitHub createCommit: blob create returned no sha for ${Y}`));v.set(Y,k)}let _=Array.from(s.entries()).map(([Y,C])=>kE(C)?{path:Y,mode:"100644",type:"blob",sha:v.get(Y)}:{path:Y,mode:"100644",type:"blob",content:C});for(let Y of f)_.push({path:Y,mode:"100644",type:"blob",sha:null});let S=await n({method:"POST",url:`${l}/repos/${d}/${h}/git/trees`,contentType:"application/json",body:JSON.stringify({base_tree:g,tree:_})}),T=NE(S?.json);if(typeof T!="string"||T.length===0)throw new Error(u("GitHub createCommit: tree create returned no sha"));let I=await n({method:"POST",url:`${l}/repos/${d}/${h}/git/commits`,contentType:"application/json",body:JSON.stringify({message:o,tree:T,parents:[g]})}),A=NE(I?.json);if(typeof A!="string"||A.length===0)throw new Error(u("GitHub createCommit: commit create returned no sha"));let R=await n({method:"PATCH",url:`${l}/repos/${d}/${h}/git/refs/heads/${p}`,contentType:"application/json",body:JSON.stringify({sha:A,force:!1})}),q=C3(R?.json);if(q!==A)throw new Error(u(`GitHub createCommit: ref update mismatch (expected ${A}, got ${q})`));return A}a(Sz,"restCreateCommit")});var F3=w(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.discoverWrapperDir=O3;fa.extractShaFromWrapper=D3;fa.mountAssetSpaceFiles=Ez;fa.escapeGitmodulesRegex=jE;fa.appendGitmodulesEntry=Tz;fa.stripGitmodulesEntry=Az;var wz=LE(),ME=new Set(["globalExtendedHeader","extendedHeader"]);function oy(n){let e=n.replace(/\\/g,"/").replace(/\/+/g,"/");for(;e.startsWith("./");)e=e.slice(2);return e}a(oy,"normalizeEntryPath");function O3(n){let e=n.find(s=>!ME.has(s.type)&&oy(s.name).includes("/"));if(e===void 0)throw new Error("discoverWrapperDir: no wrapper-bearing entry in tarball");let t=oy(e.name),r=t.slice(0,t.indexOf("/"));if(r.length===0)throw new Error(`discoverWrapperDir: empty wrapper segment in entry "${e.name}"`);let i=r+"/";for(let s of n){if(ME.has(s.type))continue;let o=oy(s.name);if(!(o===r||o===i)&&!o.startsWith(i))throw new Error(`discoverWrapperDir: entry "${s.name}" not under wrapper "${r}"`)}return r}a(O3,"discoverWrapperDir");function D3(n){let e=n.match(/-([0-9a-fA-F]{7,40})$/);if(e===null)throw new Error(`extractShaFromWrapper: wrapper "${n}" does not match expected GitHub pattern <owner>-<repo>-<sha>`);return e[1].toLowerCase()}a(D3,"extractShaFromWrapper");function vz(n,e){let t=e+"/",r=[];for(let i of n){if(i.type==="symbolicLink"||i.type==="hardLink")throw new Error(`${i.type} entry "${i.name}" rejected for security`);if(ME.has(i.type)||i.type==="directory")continue;let s=oy(i.name);if(s===e||s===t)continue;if(!s.startsWith(t))throw new Error(`entry "${i.name}" not under wrapper "${e}"`);let o=s.slice(t.length);if(o.length!==0){if(o.split("/").some(c=>c===".."))throw new Error(`path traversal detected for entry "${i.name}"`);i.data!==void 0&&r.push({relPath:o,content:i.data})}}return r}a(vz,"buildMountFiles");async function Ez(n){let{http:e,fs:t,owner:r,repo:i,ref:s,targetPath:o}=n,c=await e.fetchTarball(r,i,s),l=await(0,wz.parseTarballGzip)(c);if(l.length===0)throw new Error(`tarball empty for ${r}/${i}@${s}`);let u=O3(l),f=D3(u),d=vz(l,u),h=await t.materialize(o,d);return{sha:f,fileCount:h}}a(Ez,"mountAssetSpaceFiles");function jE(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(jE,"escapeGitmodulesRegex");function Tz(n,e,t){let r=new RegExp(`^\\s*\\[submodule\\s+"${jE(e)}"\\]`,"m");if(n.length>0&&r.test(n))return{content:n,added:!1};let i=n.length===0||n.endsWith(`
458
458
  `)?"":`
459
459
  `,s=`[submodule "${e}"]
460
460
  path = ${e}
461
461
  url = ${t}
462
462
  `;return{content:n+i+s,added:!0}}a(Tz,"appendGitmodulesEntry");function Az(n,e){let t=n.split(/\r?\n/),r=[],i=!1,s=new RegExp(`^\\[submodule\\s+"${jE(e)}"\\]\\s*$`);for(let l of t){if(i){if(/^\[.+\]\s*$/.test(l)){i=!1,r.push(l);continue}continue}if(s.test(l)){i=!0;continue}r.push(l)}let o=[],c=!1;for(let l of r){let u=l.trim().length===0;u&&c||(o.push(l),c=u)}return o.join(`
463
- `)}a(Az,"stripGitmodulesEntry")});var ld=w($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.gitBlobSha=Iz;async function Iz(n,e){let t=new TextEncoder,r=typeof n=="string"?t.encode(n):n,i=t.encode(`blob ${r.byteLength}\0`),s=new Uint8Array(i.byteLength+r.byteLength);return s.set(i,0),s.set(r,i.byteLength),e(s)}a(Iz,"gitBlobSha")});var UE=w(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.extractAssetUid=L3;ay.detectChanges=Rz;var xz=ld();function L3(n){let e=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/.exec(n);if(!e)return;let t=/^exo__Asset_uid:[ \t]*["']?([^\s"']+)["']?[ \t]*$/m.exec(e[1]);return t?t[1]:void 0}a(L3,"extractAssetUid");async function Rz(n){let{localFiles:e,watermark:t,actualBaseTreeSha:r,sha1:i}=n;if(t===null)return{kind:"full-conflict",reason:"first-sync"};if(r===null)return{kind:"full-conflict",reason:"base-mismatch",detail:`watermark commit ${t.lastSyncedSha} not resolvable on remote`};if(r!==t.rootTreeSha)return{kind:"full-conflict",reason:"base-mismatch",detail:`stored root tree ${t.rootTreeSha} != actual ${r} at ${t.lastSyncedSha}`};let s=[],o=new Map;for(let[T,I]of e){let A=await(0,xz.gitBlobSha)(I,i);o.set(T,A),s.push({path:T,blobSha:A,uid:typeof I=="string"?L3(I):void 0})}let c=[],l=[],u=[],f=[],d=new Map;for(let T of s){if(T.uid===void 0)continue;let I=d.get(T.uid)??[];I.push(T.path),d.set(T.uid,I)}let h=new Map;for(let T of t.files){if(T.uid===void 0)continue;let I=h.get(T.uid)??[];I.push(T.path),h.set(T.uid,I)}let p=new Set;for(let[T,I]of d)I.length>1&&p.add(T);for(let[T,I]of h)I.length>1&&p.add(T);for(let T of[...p].sort()){let I=d.get(T)??[],A=I.length>1?`on disk (${I.join(", ")})`:`in the sync base (${(h.get(T)??[]).join(", ")})`;f.push(`duplicate uid ${T} ${A} \u2014 uid identity suppressed for the group; every path matched by path identity (#3477)`)}let y=new Map,g=[];for(let T of t.files)T.uid!==void 0&&!p.has(T.uid)?y.set(T.uid,T):g.push(T);let v=[],_=new Set;for(let T of s){let I=T.uid!==void 0&&!p.has(T.uid)?y.get(T.uid):void 0;T.uid!==void 0&&I!==void 0?(_.add(T.uid),(I.blobSha!==T.blobSha||I.path!==T.path)&&l.push({path:T.path,uid:T.uid,blobSha:T.blobSha,...I.path!==T.path?{basePath:I.path}:{}})):v.push(T)}let S=new Map;for(let T of g)S.set(T.path,T);for(let[T,I]of y)_.has(T)||S.set(I.path,I);for(let T of v){let I=S.get(T.path);I!==void 0?(S.delete(T.path),I.blobSha!==T.blobSha&&l.push({path:T.path,uid:T.uid,blobSha:T.blobSha})):c.push({path:T.path,uid:T.uid,blobSha:T.blobSha})}for(let T of S.values())u.push({path:T.path,uid:T.uid,blobSha:T.blobSha});return{kind:"changes",added:c,modified:l,deleted:u,warnings:f,diskBlobShas:o,duplicateUids:p}}a(Rz,"detectChanges")});var fd=w(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});wc.getHeadSha=Cz;wc.getCommitInfo=Oz;wc.getTree=Dz;wc.getBlobText=Fz;wc.getBlobBytes=Lz;var N3=il(),Pz="https://api.github.com";function ud(n){return(n??Pz).replace(/\/$/,"")}a(ud,"api");function Sc(n){return n!==null&&typeof n=="object"?n:void 0}a(Sc,"asRecord");function Ds(n,e){let r=Sc(n)?.[e];return typeof r=="string"?r:void 0}a(Ds,"readString");async function Cz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/refs/heads/${encodeURIComponent(r)}`}),o=Ds(Sc(s?.json)?.object,"sha");if(typeof o!="string"||o.length===0)throw new Error(`ExoSync: missing object.sha for ref heads/${r}`);return o}a(Cz,"getHeadSha");async function Oz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/commits/${encodeURIComponent(r)}`}),o=Sc(s?.json),c=Ds(o,"sha"),l=Ds(o?.tree,"sha");if(!c||!l)throw new Error(`ExoSync: malformed commit response for ${r}`);let u=o?.parents,f=Array.isArray(u)?u.map(d=>Ds(d,"sha")).filter(d=>typeof d=="string"):[];return{sha:c,treeSha:l,parents:f}}a(Oz,"getCommitInfo");async function Dz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/trees/${encodeURIComponent(r)}?recursive=1`}),o=Sc(s?.json);if(o?.truncated===!0)throw new Error(`ExoSync: tree ${r} is truncated by GitHub (repo too large for recursive listing) \u2014 refusing to diff`);let c=o?.tree;if(!Array.isArray(c))throw new Error(`ExoSync: malformed tree response for ${r}`);let l=[];for(let u of c){let f=Sc(u);if(f?.type!=="blob")continue;let d=Ds(f,"path"),h=Ds(f,"sha"),p=typeof f.size=="number"?f.size:void 0;d&&h&&l.push({path:d,blobSha:h,...p!==void 0?{size:p}:{}})}return l}a(Dz,"getTree");async function Fz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(r)}`}),o=Sc(s?.json),c=Ds(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${r}`);return Ds(o,"encoding")==="utf-8"?c:(0,N3.base64ToUtf8)(c)}a(Fz,"getBlobText");async function Lz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(r)}`}),o=Sc(s?.json),c=Ds(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${r}`);return Ds(o,"encoding")==="utf-8"?new TextEncoder().encode(c):(0,N3.base64ToBytes)(c)}a(Lz,"getBlobBytes")});var cy=w(BE=>{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.isAuthError=Nz;function Nz(n){let e=n instanceof Error?n.message:String(n);return/HTTP 401/.test(e)?!0:/HTTP 403/.test(e)&&!/rate limit/i.test(e)&&!/abuse detection/i.test(e)}a(Nz,"isAuthError")});var uy=w(ly=>{"use strict";Object.defineProperty(ly,"__esModule",{value:!0});ly.scanForSecrets=kz;ly.redactSecrets=Mz;var k3=[{kind:"github-token",re:/gh[pousr]_[A-Za-z0-9_]{36,}/},{kind:"github-fine-grained-token",re:/github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,}/},{kind:"private-key",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/}];function kz(n){let e=[];for(let[t,r]of n)for(let{kind:i,re:s}of k3)s.test(r)&&e.push({path:t,kind:i});return e}a(kz,"scanForSecrets");function Mz(n){let e=n;for(let{kind:t,re:r}of k3)e=e.replace(new RegExp(r.source,"g"),`[REDACTED:${t}]`);return e}a(Mz,"redactSecrets")});var dy=w(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});fy.isRateLimitError=M3;fy.withRateLimitBackoff=$z;function M3(n){let e=n instanceof Error?n.message:String(n);return/HTTP 429/.test(e)?!0:/HTTP 403/.test(e)&&(/rate limit/i.test(e)||/abuse detection/i.test(e))}a(M3,"isRateLimitError");var jz=a(n=>new Promise(e=>setTimeout(e,n)),"defaultSleep");function $z(n,e={}){let t=e.maxRetries??3,r=e.baseDelayMs??1e3,i=e.sleep??jz,s=e.random??Math.random;return async o=>{let c=0;for(;;)try{return await n(o)}catch(l){if(!M3(l)||c>=t)throw l;let u=r*2**c*(1+s());c++,await i(u)}}}a($z,"withRateLimitBackoff")});var hy=w(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.DEFAULT_MAX_FILE_BYTES=Io.InMemoryQuarantineStore=void 0;Io.contentEquals=Uz;Io.isSyncablePath=Bz;Io.isFileSpaceSyncablePath=Vz;function Uz(n,e){if(n===void 0||e===void 0||typeof n=="string"&&typeof e=="string")return n===e;if(typeof n=="string"||typeof e=="string"||n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.byteLength;t++)if(n[t]!==e[t])return!1;return!0}a(Uz,"contentEquals");var VE=class{static{a(this,"InMemoryQuarantineStore")}constructor(){this.entries=[]}async quarantine(e){this.entries.push(e)}};Io.InMemoryQuarantineStore=VE;function Bz(n){return n.endsWith(".md")&&!n.includes(".local.")&&!n.includes(".conflict.")}a(Bz,"isSyncablePath");function Vz(n){return!n.includes(".local.")&&!n.includes(".conflict.")}a(Vz,"isFileSpaceSyncablePath");Io.DEFAULT_MAX_FILE_BYTES=30*1024*1024});var WE=w(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.SyncEngine=Fs.DEFAULT_MAX_PUSH_RETRIES=void 0;Fs.isNonFastForwardError=V3;Fs.orderChildrenFirst=Yz;var Gz=sy(),Ft=fd(),vc=UE(),qz=il(),dd=ld(),Wz=cy(),zz=uy(),Hz=dy(),da=hy();Fs.DEFAULT_MAX_PUSH_RETRIES=3;function Kz(n){try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{return null}}a(Kz,"decodeUtf8Strict");function Qz(n){return typeof n=="string"?n:{base64:(0,qz.bytesToBase64)(n)}}a(Qz,"toCommitContent");async function j3(n,e){if(n.readBinary===void 0)throw new Error("LocalFilesPort.readBinary is required for file-mode sync (Phase C)");return n.readBinary(e)}a(j3,"readBinaryStrict");async function Xz(n,e,t){if(n.writeBinary===void 0)throw new Error("LocalFilesPort.writeBinary is required for file-mode sync (Phase C)");return n.writeBinary(e,t)}a(Xz,"writeBinaryStrict");function $3(n){return n.length===0||n.startsWith("/")||n.includes("\\")?!1:n.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a($3,"isSafeRepoRelativePath");function V3(n){let e=n instanceof Error?n.message:String(n);return/HTTP 422/.test(e)&&/git\/refs/.test(e)||/ref update mismatch/.test(e)||/HTTP 422/.test(e)&&/git\/trees/.test(e)&&/BadObjectState/.test(e)}a(V3,"isNonFastForwardError");function Yz(n){let e=a(t=>t.split("/").filter(r=>r.length>0).length,"depth");return[...n].sort((t,r)=>e(r.localPath)-e(t.localPath))}a(Yz,"orderChildrenFirst");function U3(n,e){let t=new Map(n.map(o=>[o.path,o])),r=new Set,i=[];for(let o of e){r.add(o.path);let c=t.get(o.path);(c===void 0||c.blobSha!==o.blobSha)&&i.push(o)}let s=n.filter(o=>!r.has(o.path));return{changed:i,deleted:s}}a(U3,"diffTrees");function cu(n){return n instanceof Error?n.message:String(n)}a(cu,"errMsg");function Jz(n,e,t){if(t.size===0)return n;let r=new Map(e.files.map(o=>[o.path,o])),i=new Set(n.map(o=>o.path)),s=[];for(let o of n){if(!t.has(o.path)){s.push(o);continue}let c=r.get(o.path);c!==void 0&&s.push(c)}for(let o of t){if(i.has(o))continue;let c=r.get(o);c!==void 0&&s.push(c)}return s}a(Jz,"applyWatermarkPins");var GE={mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:[],mergedCount:0,mergedPaths:[],warnings:[]};function B3(n){return new Map(n.map(e=>[e.path,e.blobSha]))}a(B3,"treeByPath");function py(n){return[...n.quarantineEntries.map(e=>e.path),...n.resolvedQuarantineEntries.map(e=>e.path)]}a(py,"quarantinedPathsOf");var qE=class{static{a(this,"SyncEngine")}constructor(e){this.opInProgress=!1,this.deps=e,this.transport=(0,Hz.withRateLimitBackoff)(e.transport,e.backoff)}busyResult(e){return{repoKey:e.repoKey,status:"busy",pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:[],deferredDeletes:[],detail:"another sync operation is in progress (D11 guard) \u2014 retry after it finishes"}}modeOps(e){let t=e.spaceKind==="file",r=t?da.isFileSpaceSyncablePath:da.isSyncablePath,i=this.deps.maxFileBytes??da.DEFAULT_MAX_FILE_BYTES;return{fileMode:t,syncable:r,treeFilter:a(s=>r(s.path)&&(!t||s.size===void 0||s.size<=i),"treeFilter")}}async buildFileModeFirstSyncBase(e,t,r,i){let s=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(r.treeFilter),l=[];for(let u of c){let f=t.get(u.path);f!==void 0&&await(0,dd.gitBlobSha)(f,this.deps.sha1)===u.blobSha&&l.push({path:u.path,blobSha:u.blobSha})}return i.push(`first-sync (file mode): synthetic base from ${l.length} already-identical file(s) at head ${s} \u2014 divergence resolves through the remote-wins layer (D22)`),{lastSyncedSha:s,rootTreeSha:o.treeSha,files:l,spaceKind:"file"}}async syncAll(e,t="sync",r){if(this.opInProgress)return e.map(i=>this.busyResult(i));this.opInProgress=!0;try{let i=[];for(let s of e)i.push(await this.syncLocked(s,t,r));return i}finally{this.opInProgress=!1}}async sync(e,t="sync",r){if(this.opInProgress)return this.busyResult(e);this.opInProgress=!0;try{return await this.syncLocked(e,t,r)}finally{this.opInProgress=!1}}emitProgress(e,t,r){if(e!==void 0)try{e({repoKey:t,phase:r})}catch{}}async syncLocked(e,t="sync",r){let i=[],s=[],o=[],c=a((l,u={})=>({repoKey:e.repoKey,status:l,pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:i,deferredDeletes:s,...u}),"result");try{let l=await this.deps.materializationCheck.check(e);if(!l.fullyMaterialized)return i.push(`skipped: repo not fully materialized${l.reason?` (${l.reason})`:""} \u2014 deletes NOT inferred (D19)`),c("skipped-not-materialized");let u=this.modeOps(e),f=this.deps.localFilesFor(e);if(u.fileMode&&(f.readBinary===void 0||f.writeBinary===void 0))return c("error",{detail:"file-mode repo requires a LocalFilesPort with readBinary/writeBinary \u2014 refusing to sync through the text-only port (binary would corrupt)"});if(u.fileMode&&this.deps.quarantine===void 0)return c("error",{detail:"file-mode repo requires a quarantine sink (D18 remote-wins preserves losing local bytes there) \u2014 configure the quarantine repo before syncing FileSpaces"});let d=this.deps.maxFileBytes??da.DEFAULT_MAX_FILE_BYTES,h=new Map,p=new Set;for(let N of(await f.list()).filter(u.syncable))if(u.fileMode){let j=await j3(f,N);if(j.byteLength>d){p.add(N),i.push(`skipped oversized file ${N} (${j.byteLength} bytes > ${d} cap) \u2014 excluded from sync symmetrically (Phase C size cap)`);continue}h.set(N,j)}else h.set(N,await f.read(N));let y=await this.deps.watermarkStore.get(e.repoKey);if(y?.spaceKind==="file"&&!u.fileMode)return c("error",{detail:"watermark was written by a FILE-mode sync but the spec now resolves to asset mode \u2014 refusing (fix the conflicting Space declarations, or clear the watermark to restart)"});y!==null&&u.fileMode&&y.spaceKind!=="file"&&(i.push("watermark was written by an ASSET-mode sync \u2014 rebuilding the base through the file-mode first-sync layer (kind flip)"),y=null);let g=!1;if(y===null)if(u.fileMode)g=!0,y=await this.buildFileModeFirstSyncBase(e,h,u,i);else{let N=await this.bootstrapWatermark(e,h,i,c);if(N.kind==="settled")return N.outcome;g=!0,y=N.base}let v=y;u.fileMode&&p.size>0&&(y={...y,files:y.files.filter(N=>!p.has(N.path))}),this.emitProgress(r,e.repoKey,"detecting");let _=await(0,vc.detectChanges)({localFiles:h,watermark:y,actualBaseTreeSha:await this.resolveBaseTreeSha(e,y),sha1:this.deps.sha1});if(_.kind==="full-conflict")return c("full-conflict",{detail:`${_.reason}${_.detail?`: ${_.detail}`:""} \u2014 divergence must go through merge/quarantine (A2/A3), not overwrite`});i.push(..._.warnings);let S=this.pinLocalChanges(_,h,i,s,t);o=[...S.pushDeletionsAll.keys()];let T=await this.runPushLoop(e,y,S,h,i,u,g,p,t,r);if(o=[],T.kind!=="done"&&S.pushDeletionsAll.size>0&&s.push(...S.pushDeletionsAll.keys()),T.kind==="conflict")return c("conflict",{detail:T.detail});if(T.kind==="secret-detected")return c("error",{detail:T.detail});if(T.kind==="retry-exhausted"){i.push(...T.merge.warnings);let N=await this.buildTerminalQuarantineEntries(e,y,T.pushFiles,T.merge.quarantineEntries,h),j=[...T.merge.quarantineEntries,...T.merge.resolvedQuarantineEntries,...N];return await this.flushQuarantine(j,i),c("retry-exhausted",{detail:T.detail,quarantinedCount:j.length,...j.length>0?{quarantinedPaths:j.map(se=>se.path)}:{}})}let{examinedHead:I,pushedSha:A,applyWrites:R,applyDeletes:q,pushFiles:Y}=T,C=T.merge;i.push(...C.warnings),i.push(...T.deferredWarnings),s.push(...T.withheldDeletions);let O=T.deferredPaths.size>0?{deferredPaths:[...T.deferredPaths]}:{},k=T.pushedDeletions.length>0?{pushedDeletes:T.pushedDeletions}:{},H=await this.flushQuarantine([...C.quarantineEntries,...C.resolvedQuarantineEntries],i),G=new Set;if(!H&&C.resolvedQuarantineEntries.length>0){for(let N of C.resolvedQuarantineEntries)G.add(N.path);i.push(`quarantine flush failed \u2014 remote-wins apply withheld for ${G.size} path(s); local files untouched, conflict re-derives next sync (D18 durability gate)`)}if(A===void 0&&I===y.lastSyncedSha&&R.length===0&&q.length===0&&C.mergedWrites.length===0&&C.quarantineEntries.length===0&&C.resolvedQuarantineEntries.length===0&&(y.pinnedPaths?.length??0)===0&&T.alreadyInHead.length===0&&T.deferredPaths.size===0&&!g)return c("synced");let B=A??I,Z=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,B,this.deps.baseURL);if(A!==void 0&&Z.parents[0]!==I)return await this.checkRaceWindow(e,y,I,Z.parents[0],Y,new Set(T.pushedDeletions),i,u),i.push(`race-window: watermark NOT advanced (pushed commit's parent ${Z.parents[0]} != examined head ${I}) \u2014 next sync reconciles the concurrent change`),c("synced",{pushedSha:A,pushedCount:Y.size,mergedCount:C.mergedCount,quarantinedCount:C.quarantineEntries.length+C.resolvedQuarantineEntries.length,...C.mergedPaths.length>0?{mergedPaths:C.mergedPaths}:{},...py(C).length>0?{quarantinedPaths:py(C)}:{},...O,...k});let{pulledCount:_e,pinnedPaths:ie}=await this.applyRemoteChanges(f,h,[...R,...C.mergedWrites].filter(N=>!G.has(N.path)),q.filter(N=>!G.has(N.path)),i);for(let N of C.quarantineEntries)ie.add(N.path);for(let N of T.deferredPaths)ie.add(N);for(let N of G)ie.add(N);if(u.fileMode){for(let N of p)ie.add(N);for(let N of T.remoteOversized)ie.add(N)}return await this.advanceWatermark(e,B,Z.treeSha,h,[...R,...C.mergedWrites,...T.deferredRemoteChanges],v,ie,_.diskBlobShas,u,p),await this.resolveClearedPins(e,v,ie,i,new Set(C.resolvedQuarantineEntries.map(N=>N.path))),c("synced",{pushedSha:A,pulledCount:_e,pushedCount:Y.size,mergedCount:C.mergedCount,quarantinedCount:C.quarantineEntries.length+C.resolvedQuarantineEntries.length,...C.mergedPaths.length>0?{mergedPaths:C.mergedPaths}:{},...py(C).length>0?{quarantinedPaths:py(C)}:{},...O,...k})}catch(l){let u=this.deps.redact??(f=>f);return o.length>0&&s.push(...o),(0,Wz.isAuthError)(l)?c("auth-required",{detail:u(`authentication failed: ${cu(l)} \u2014 the PAT is expired, revoked or under-scoped; update it in the per-device secure storage (R8). Never treated as success.`)}):(i.push(`sync failed: ${u(cu(l))}`),c("error",{detail:u(cu(l))}))}}async flushQuarantine(e,t){if(e.length===0)return!0;let r=this.deps.redact??(s=>s);for(let s of e)t.push(r(`quarantined ${s.path}: ${s.reason}`));let i=this.deps.quarantine;if(i===void 0)return!1;try{if(i.quarantineAll!==void 0)await i.quarantineAll(e);else for(let s of e)await i.quarantine(s);return!0}catch(s){let o=this.deps.redact??(c=>c);return t.push(`quarantine sink failed: ${o(cu(s))} \u2014 files untouched on disk; the conflict re-derives next sync (D17 degradation)`),!1}}async buildTerminalQuarantineEntries(e,t,r,i,s){let o=new Set(i.map(u=>u.path)),c=new Map;try{let u=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,(await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(d=>r.has(d.path));for(let d of f)c.set(d.path,await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,d.blobSha,this.deps.baseURL))}catch{}let l=[];for(let[u,f]of r){if(o.has(u))continue;let d=s.get(u),h=d??f,p=d!==void 0&&!(0,da.contentEquals)(d,f),y=typeof h=="string"?(0,vc.extractAssetUid)(h):void 0,g=c.get(u);l.push({repoKey:e.repoKey,path:u,...y!==void 0?{uid:y}:{},reason:`non-fast-forward push failed after ${this.deps.maxPushRetries??Fs.DEFAULT_MAX_PUSH_RETRIES} retries (D16) \u2014 a concurrent writer keeps moving ${e.branch}; base recoverable from git history at ${t.lastSyncedSha}${p?"; the contended push payload was a merged proposal (never applied to disk) \u2014 the merge re-derives next sync":""}`,...typeof h=="string"?{localContent:h}:{localContentBytes:h},...g!==void 0?{remoteContent:g}:{}})}return l}async resolveClearedPins(e,t,r,i,s=new Set){let o=this.deps.quarantine;if(o===void 0||o.markResolved===void 0)return;let c=(t.pinnedPaths??[]).filter(l=>!r.has(l)&&!s.has(l));for(let l of c)try{await o.markResolved?.(e.repoKey,l)}catch(u){let f=this.deps.redact??(d=>d);i.push(`quarantine markResolved failed for ${l}: ${f(cu(u))} \u2014 unresolved-count may overcount until the resolver UI reconciles (CQ4)`)}}async resolveBaseTreeSha(e,t){try{return(await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,t.lastSyncedSha,this.deps.baseURL)).treeSha}catch{return null}}pinLocalChanges(e,t,r,i,s){let o=e.modified.filter(h=>h.basePath!==void 0),c=[...e.added,...e.modified.filter(h=>h.basePath===void 0)],l=new Map;if(s==="pull"){for(let h of o)h.basePath!==void 0&&i.push(h.basePath),r.push(`pull-only: rename (uid ${h.uid??"?"}) ${h.basePath} \u2192 ${h.path} not pushed \u2014 propagates on the next push/Sync (#3473)`);for(let h of e.deleted)i.push(h.path),r.push(`pull-only: delete of ${h.path} not pushed \u2014 propagates on the next push/Sync (#3473)`)}else{for(let h of o)h.basePath!==void 0&&l.set(h.basePath,h.path);for(let h of e.deleted)l.set(h.path,h.path)}let u=[...c,...o,...e.deleted.map(h=>({...h}))],f=new Set(e.deleted.map(h=>h.path)),d=new Map;for(let h of[...c,...s==="pull"?[]:o]){let p=t.get(h.path);p!==void 0&&d.set(h.path,p)}return{localChanges:u,localDeletedPaths:f,pushFilesAll:d,pushDeletionsAll:l,dupUids:e.duplicateUids}}async runPushLoop(e,t,r,i,s,o,c=!1,l=new Set,u="sync",f){let{localChanges:d,localDeletedPaths:h,pushFilesAll:p,pushDeletionsAll:y,dupUids:g}=r,v=this.deps.maxPushRetries??Fs.DEFAULT_MAX_PUSH_RETRIES,_=0,S="",T,I=[],A=[],R=new Map,q=new Set,Y=[],C=GE,O=[],k=new Set,H=[],G=[],B=new Set;for(;;){S=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),I=[],A=[],C=GE,O=[],k=new Set,H=[],G=[];let Z,_e=new Set,ie=(t.pinnedPaths?.length??0)>0;if(S!==t.lastSyncedSha||ie||c){this.emitProgress(f,e.repoKey,"pulling-remote");let se=await this.collectRemoteChanges(e,t,S,o,l,s,B);Z=se.headTreeByPath;let be=this.matchLocalVsRemote(d,h,i,se.changes,_e,g,se.headTreeByPath);if(be.conflicts.length>0){if(u==="sync"&&this.emitProgress(f,e.repoKey,"merging"),u!=="sync"){for(let W of be.conflicts){k.add(W.local.path),W.local.basePath!==void 0&&k.add(W.local.basePath);for(let Ee of W.remotes)k.add(Ee.path),Ee.kind==="change"&&H.push(Ee)}G.push(`${u}-only: ${be.conflicts.length} conflict(s) deferred to a full Sync (${be.conflicts.map(W=>W.desc).join("; ")}) \u2014 paths pinned, nothing merged`)}else if(o.fileMode)C=this.resolveFileModeConflicts(e,be.conflicts,i,be.applyWrites,be.applyDeletes);else{if(this.deps.mergeLayer===void 0)return{kind:"conflict",detail:`overlapping change on ${be.conflicts[0].desc} \u2014 merge layer (A2/A3) required; nothing pushed, nothing written`};C=await this.resolveMergeConflicts(e,t,be.conflicts,i)}if(u==="sync")for(let W of be.conflicts)for(let Ee of W.remotes)Ee.path!==W.local.path&&(k.add(Ee.path),Ee.kind==="change"&&H.push(Ee),G.push(`conflict group ${W.desc}: remote change at ${Ee.path} NOT applied \u2014 pinned to re-derive on the next sync (#3477)`))}if(I=be.applyWrites,A=be.applyDeletes,u==="push"&&(I.length>0||A.length>0)){for(let W of I)k.add(W.path),H.push(W);for(let W of A)k.add(W.path);G.push(`push-only: ${I.length+A.length} remote change(s) NOT applied \u2014 pinned to re-derive on the next pull/Sync`),I=[],A=[]}}R=u==="pull"?new Map:new Map([...[...p].filter(([se])=>!_e.has(se)),...C.mergedFiles]),q=new Set,Y=[];for(let[se,be]of y){if(_e.has(be)){Y.push(se);continue}R.has(se)||q.add(se)}if((R.size>0||q.size>0)&&Z===void 0&&(Z=B3(await(0,Ft.getTree)(this.transport,e.owner,e.repo,t.rootTreeSha,this.deps.baseURL))),R.size>0&&Z!==void 0){for(let[se,be]of R){let W=Z.get(se);W!==void 0&&W===await(0,dd.gitBlobSha)(be,this.deps.sha1)&&(R.delete(se),O.push(se))}O.length>0&&s.push(`phantom push skipped: ${O.length} file(s) already identical in remote HEAD (${O.join(", ")}) \u2014 excluded from the commit (#3475)`)}if(q.size>0&&Z!==void 0){for(let se of[...q])Z.has(se)||q.delete(se);R.size===0&&q.size>=Z.size&&(Y.push(...q),G.push(`deletion of ALL ${q.size} remaining file(s) deferred \u2014 GitHub cannot create an empty tree; the deletes re-derive and propagate once the repo has at least one surviving file`),q.clear())}if(R.size===0&&q.size===0)break;let N=new Map;for(let[se,be]of R)if(typeof be=="string")N.set(se,be);else{let W=Kz(be);W!==null&&N.set(se,W)}let j=(0,zz.scanForSecrets)(N);if(j.length>0)return{kind:"secret-detected",detail:`secret-scan: refusing to push \u2014 ${j.map(se=>`${se.path} (${se.kind})`).join(", ")} (R5); remove the secret and re-sync`};try{T=await(0,Gz.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([...R].map(([se,be])=>[se,Qz(be)])),deletions:[...q],message:this.deps.commitMessage?.(e,R.size,q.size)??`chore(exosync): sync ${R.size} file(s)${q.size>0?`, ${q.size} deletion(s)`:""}`,baseURL:this.deps.baseURL,redact:this.deps.redact});break}catch(se){if(!V3(se))throw se;if(_++,_>v)return{kind:"retry-exhausted",detail:`non-fast-forward push failed after ${v} retries (D16 cap) \u2014 contended files routed to quarantine (D17)`,pushFiles:R,merge:C};s.push(`non-fast-forward push (attempt ${_}/${v}) \u2014 re-pulling and retrying (D16)`)}}return{kind:"done",examinedHead:S,pushedSha:T,applyWrites:I,applyDeletes:A,pushFiles:R,pushedDeletions:T!==void 0?[...q]:[],withheldDeletions:Y,merge:C,remoteOversized:B,alreadyInHead:O,deferredPaths:k,deferredRemoteChanges:H,deferredWarnings:G}}async resolveMergeConflicts(e,t,r,i){let s=this.deps.mergeLayer;if(s===void 0)return GE;let o=new Map(t.files.map(g=>[g.path,g])),c=new Map,l=[],u=[],f=[],d=[],h=0,p=a(g=>typeof g=="string"?g:void 0,"asText"),y=a((g,v,_)=>{let S=p(i.get(g.local.path)),T=p(g.remotes[0]?.content);return{repoKey:e.repoKey,path:g.local.path,...g.local.uid!==void 0?{uid:g.local.uid}:{},reason:v,..._!==void 0?{baseContent:_}:{},...S!==void 0?{localContent:S}:{},...T!==void 0?{remoteContent:T}:{}}},"entry");for(let g of r){let v=o.get(g.local.basePath??g.local.path)??o.get(g.remotes[0]?.path??""),_;if(v!==void 0&&(_=await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,v.blobSha,this.deps.baseURL)),g.remotes.length>1){u.push(y(g,`ambiguous conflict: local change overlaps ${g.remotes.length} remote changes (${g.remotes.map(R=>R.path).join(", ")})`,_));continue}let S=g.remotes[0],T=p(i.get(g.local.path)),I=await s.resolve({path:g.local.path,...g.local.uid!==void 0?{uid:g.local.uid}:{},..._!==void 0?{base:_}:{},...T!==void 0?{local:T}:{},...S.kind==="change"&&typeof S.content=="string"?{remote:S.content}:{}});if(I.action==="quarantine"){u.push(y(g,I.reason,_));continue}h++,d.push(g.local.path);for(let R of I.warnings??[])f.push(`merge(${g.local.path}): ${R}`);let A=S.kind==="change"?S.content:void 0;if(I.content!==A&&c.set(g.local.path,I.content),I.content!==i.get(g.local.path)){let R=(0,vc.extractAssetUid)(I.content)??g.local.uid;l.push({path:g.local.path,kind:"change",content:I.content,blobSha:await(0,dd.gitBlobSha)(I.content,this.deps.sha1),...R!==void 0?{uid:R}:{}})}}return{mergedFiles:c,mergedWrites:l,quarantineEntries:u,resolvedQuarantineEntries:[],mergedCount:h,mergedPaths:d,warnings:f}}resolveFileModeConflicts(e,t,r,i,s){let o=[],c=[];for(let l of t){l.remotes.length>1&&c.push(`file-mode conflict on ${l.local.path} unexpectedly overlaps ${l.remotes.length} remote changes \u2014 resolving against the first`);let u=l.remotes[0],f=r.get(l.local.path);u.kind==="change"?i.push(u):s.push(u),!(l.localIsDelete||f===void 0)&&o.push({repoKey:e.repoKey,path:l.local.path,reason:`file-mode remote-wins (D18): remote ${u.kind==="change"?`version ${u.blobSha}`:"delete"} wins; this is the losing LOCAL version, preserved byte-exact`,...typeof f=="string"?{localContent:f}:{localContentBytes:f}})}return{mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:o,mergedCount:0,mergedPaths:[],warnings:c}}async applyRemoteChanges(e,t,r,i,s){let o=0,c=new Set,l=a(async(f,d)=>{try{return d?await j3(e,f):await e.read(f)}catch{return}},"tryRead"),u=a(async(f,d)=>{typeof d=="string"?await e.write(f,d):await Xz(e,f,d)},"writeContent");for(let f of r){if(f.content===void 0)continue;if(!$3(f.path)){s.push(`unsafe remote path skipped on pull-apply: ${f.path}`),c.add(f.path);continue}let d=t.get(f.path),h=await l(f.path,typeof(d??f.content)!="string");if(!(0,da.contentEquals)(h,d)){s.push(`pull-apply skipped: ${f.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),c.add(f.path);continue}await u(f.path,f.content),o++}for(let f of i){if(!$3(f.path)){s.push(`unsafe remote path skipped on pull-delete: ${f.path}`),c.add(f.path);continue}let d=t.get(f.path);if(d!==void 0){let h=await l(f.path,typeof d!="string");if(h!==void 0&&!(0,da.contentEquals)(h,d)){s.push(`pull-delete skipped: ${f.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),c.add(f.path);continue}await e.delete(f.path),o++}}return{pulledCount:o,pinnedPaths:c}}async advanceWatermark(e,t,r,i,s,o,c,l,u,f=new Set){let d=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,r,this.deps.baseURL)).filter(p=>u.treeFilter(p)&&!f.has(p.path)),h=Jz(await this.buildWatermarkFiles(e,d,i,s,o,l,u),o,c);await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:t,rootTreeSha:r,files:h,...c.size>0?{pinnedPaths:[...c]}:{},...u.fileMode?{spaceKind:"file"}:{}})}async bootstrapWatermark(e,t,r,i){let s=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(f=>(0,da.isSyncablePath)(f.path));for(let f of c){let d=t.get(f.path);if(d===void 0||await(0,dd.gitBlobSha)(d,this.deps.sha1)!==f.blobSha)return{kind:"settled",outcome:i("full-conflict",{detail:`first-sync: no watermark and local content diverges from remote head at ${f.path} \u2014 A2/A3 scope`})}}let l=c.map(f=>{let d=t.get(f.path),h=typeof d=="string"?(0,vc.extractAssetUid)(d):void 0;return{path:f.path,blobSha:f.blobSha,...h?{uid:h}:{}}}),u={lastSyncedSha:s,rootTreeSha:o.treeSha,files:l};return t.size===c.length?(await this.deps.watermarkStore.set(e.repoKey,u),r.push(`watermark bootstrapped from head ${s} (local tree identical to remote)`),{kind:"settled",outcome:i("synced")}):(r.push(`first-sync (asset mode): local tree (${t.size} files) is a pure superset of remote head ${s} (${c.length} files) \u2014 ${t.size-c.length} local-only addition(s) derive as pushable adds (#3565)`),{kind:"additive-base",base:u})}async collectRemoteChanges(e,t,r,i,s=new Set,o=[],c=new Set){let l=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,r,this.deps.baseURL),u=await(0,Ft.getTree)(this.transport,e.owner,e.repo,l.treeSha,this.deps.baseURL);if(i.fileMode)for(let g of u)i.syncable(g.path)&&!i.treeFilter(g)&&!c.has(g.path)&&(c.add(g.path),o.push(`skipped oversized REMOTE file ${g.path} (${g.size??"?"} bytes over cap) \u2014 excluded from sync symmetrically (Phase C size cap)`));let f=u.filter(g=>i.treeFilter(g)&&!s.has(g.path)),d=t.files.filter(g=>!c.has(g.path)&&!s.has(g.path)),{changed:h,deleted:p}=U3(d,f),y=[];for(let g of h){if(i.fileMode){let _=await(0,Ft.getBlobBytes)(this.transport,e.owner,e.repo,g.blobSha,this.deps.baseURL);y.push({path:g.path,kind:"change",blobSha:g.blobSha,content:_});continue}let v=await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,g.blobSha,this.deps.baseURL);y.push({path:g.path,kind:"change",blobSha:g.blobSha,content:v,uid:(0,vc.extractAssetUid)(v)})}for(let g of p)y.push({path:g.path,kind:"delete",uid:g.uid});return{changes:y,headTreeByPath:B3(u)}}matchLocalVsRemote(e,t,r,i,s,o=new Set,c){let l=new Set,u=[],f=new Map;for(let g of i)g.kind==="change"&&g.uid!==void 0&&f.set(g.uid,(f.get(g.uid)??0)+1);let d=new Set(o);for(let[g,v]of f)v>1&&d.add(g);let h=new Map,p=new Map;for(let g of i){if(g.uid!==void 0&&!d.has(g.uid)){let v=h.get(g.uid)??[];v.push(g),h.set(g.uid,v)}p.set(g.path,g)}for(let g of e){let v=new Set;if(g.uid!==void 0&&!d.has(g.uid))for(let I of h.get(g.uid)??[])I.kind==="change"&&I.path!==g.path&&(c?.has(g.path)===!0||g.basePath!==void 0&&c?.has(g.basePath)===!0)||v.add(I);let _=p.get(g.path);if(_!==void 0&&v.add(_),g.basePath!==void 0){let I=p.get(g.basePath);I!==void 0&&v.add(I)}let S=[],T=!1;for(let I of v){if(T=t.has(g.path)&&!r.has(g.path),T&&I.kind==="delete"){l.add(I);continue}if(!T&&I.kind==="change"&&I.path===g.path&&I.blobSha===g.blobSha){l.add(I),s.add(g.path);continue}if(I.kind==="delete"&&g.basePath!==void 0&&I.path===g.basePath){let A=p.get(g.path);if(A!==void 0&&A.kind==="change"&&A.blobSha===g.blobSha){l.add(I);continue}}S.push(I),l.add(I)}S.length>0&&(u.push({local:g,localIsDelete:T,remotes:S,desc:`${g.uid!==void 0&&!d.has(g.uid)?g.uid:g.path} (local ${T?"delete":"change"} vs remote ${S[0].kind} at ${S[0].path})`}),s.add(g.path))}let y=i.filter(g=>!l.has(g));return{conflicts:u,applyWrites:y.filter(g=>g.kind==="change"),applyDeletes:y.filter(g=>g.kind==="delete")}}async checkRaceWindow(e,t,r,i,s,o,c,l){try{let u=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,i,this.deps.baseURL),f=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL)).filter(l.treeFilter),d=r===t.lastSyncedSha?t.files:(await(0,Ft.getTree)(this.transport,e.owner,e.repo,(await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,r,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(l.treeFilter),{changed:h,deleted:p}=U3(d,f);for(let y of h)s.has(y.path)&&c.push(`race-window: concurrent commit ${i} changed ${y.path} between conflict check (head ${r}) and push \u2014 local version won; previous version recoverable from git history`),o.has(y.path)&&c.push(`race-window: concurrent commit ${i} changed ${y.path} which this push DELETED \u2014 the delete won; the concurrent version is recoverable from git history`);for(let y of p)s.has(y.path)&&c.push(`race-window: concurrent commit ${i} deleted ${y.path}; push re-created it`)}catch(u){let f=this.deps.redact??(d=>d);c.push(`race-window check failed: ${f(cu(u))}`)}}async buildWatermarkFiles(e,t,r,i,s,o,c){if(c.fileMode)return t.map(f=>({path:f.path,blobSha:f.blobSha}));let l=new Map;for(let f of i)f.kind==="change"&&f.blobSha!==void 0&&l.set(f.blobSha,f.uid);for(let[f,d]of r){let h=o?.get(f)??await(0,dd.gitBlobSha)(d,this.deps.sha1);l.set(h,typeof d=="string"?(0,vc.extractAssetUid)(d):void 0)}for(let f of s.files)l.has(f.blobSha)||l.set(f.blobSha,f.uid);let u=[];for(let f of t){let d;if(l.has(f.blobSha))d=l.get(f.blobSha);else{let h=await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,f.blobSha,this.deps.baseURL);d=(0,vc.extractAssetUid)(h)}u.push({path:f.path,blobSha:f.blobSha,...d?{uid:d}:{}})}return u}};Fs.SyncEngine=qE});var KE=w(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.diff3=Zz;function G3(n,e){let t=n.length,r=e.length,i=Array.from({length:t+1},()=>new Int32Array(r+1));for(let l=t-1;l>=0;l--)for(let u=r-1;u>=0;u--)i[l][u]=n[l]===e[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);let s=new Map,o=0,c=0;for(;o<t&&c<r;)n[o]===e[c]?(s.set(o,c),o++,c++):i[o+1][c]>=i[o][c+1]?o++:c++;return s}a(G3,"lcsMatch");function zE(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}a(zE,"sliceEq");function Zz(n,e,t){let r=G3(n,e),i=G3(n,t),s=[],o=0,c=0,l=0;for(;;){let u=o;for(;u<n.length&&!(r.has(u)&&i.has(u));)u++;let f=u<n.length?r.get(u):e.length,d=u<n.length?i.get(u):t.length,h=n.slice(o,u),p=e.slice(c,f),y=t.slice(l,d),g=!zE(p,h),v=!zE(y,h);if(!g&&!v)s.push(...h);else if(!g)s.push(...y);else if(!v)s.push(...p);else if(zE(p,y))s.push(...p);else return{ok:!1,conflict:{base:h,local:p,remote:y}};if(u>=n.length)break;s.push(n[u]),o=u+1,c=f+1,l=d+1}return{ok:!0,merged:s}}a(Zz,"diff3")});var W3=w(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.StructuredMerger=void 0;md.splitSections=my;var q3=KE(),eH=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,hd="exo__Instance_class";function pd(n){if(n===null||typeof n!="object")return!0;if(Array.isArray(n))return n.every(pd);let e=Object.getPrototypeOf(n);return e!==Object.prototype&&e!==null?!1:Object.values(n).every(pd)}a(pd,"isPlainValue");function ha(n,e){if(n===e)return!0;if(n===null||e===null||n===void 0||e===void 0||typeof n!="object"||typeof e!="object"||Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)&&Array.isArray(e))return n.length!==e.length?!1:n.every((s,o)=>ha(s,e[o]));let t=n,r=e,i=Object.keys(t);return i.length!==Object.keys(r).length?!1:i.every(s=>ha(t[s],r[s]))}a(ha,"deepEqual");function Ec(n){return typeof n=="string"?`s:${n}`:`j:${JSON.stringify(n)}`}a(Ec,"setKey");function ui(n){return n==null?[]:Array.isArray(n)?n:[n]}a(ui,"toElements");function tH(n,e,t){let r=new Set(ui(n).map(Ec)),i=ui(e),s=ui(t),o=new Set(i.map(Ec)),c=new Set(s.map(Ec)),l=a(d=>o.has(d)&&c.has(d)||o.has(d)&&!r.has(d)||c.has(d)&&!r.has(d),"keep"),u=[],f=new Set;for(let d of[...i,...s]){let h=Ec(d);f.has(h)||!l(h)||(f.add(h),u.push(d))}return u}a(tH,"mergeSet");function rH(n,e,t){let r=[],i=[],s=new Set;for(let c of[...Object.keys(n),...Object.keys(e),...Object.keys(t)])s.has(c)||(s.add(c),i.push(c));let o={};for(let c of i){let l=n[c],u=e[c],f=t[c];if(!pd(l)||!pd(u)||!pd(f))return{ok:!1,reason:`frontmatter key "${c}" contains a non-plain value (Date?) \u2014 the codec must round-trip scalars as strings (CORE_SCHEMA contract)`};if(Array.isArray(l)||Array.isArray(u)||Array.isArray(f)){if(!(c in e)&&!(c in t))continue;let d=tH(l,u,f),h=new Set(ui(l).map(Ec)),p=ui(u).some(g=>!h.has(Ec(g))),y=ui(f).some(g=>!h.has(Ec(g)));p&&y&&!ha(ui(u),ui(f))&&r.push(`both sides added values to multi-valued key "${c}" \u2014 union kept (D20)`),d.length>0&&(o[c]=d);continue}if(ha(u,f)){u!==void 0&&(o[c]=u);continue}if(ha(u,l)){f!==void 0&&(o[c]=f);continue}if(ha(f,l)){u!==void 0&&(o[c]=u);continue}return{ok:!1,reason:`frontmatter key "${c}" changed differently on both sides`}}return{ok:!0,value:o,warnings:r}}a(rH,"mergeFrontmatter");var nH=/^(```|~~~)/,iH=/^#{1,6}\s/;function my(n){let e=n.split(`
463
+ `)}a(Az,"stripGitmodulesEntry")});var ld=w($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.gitBlobSha=Iz;async function Iz(n,e){let t=new TextEncoder,r=typeof n=="string"?t.encode(n):n,i=t.encode(`blob ${r.byteLength}\0`),s=new Uint8Array(i.byteLength+r.byteLength);return s.set(i,0),s.set(r,i.byteLength),e(s)}a(Iz,"gitBlobSha")});var UE=w(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.extractAssetUid=L3;ay.detectChanges=Rz;var xz=ld();function L3(n){let e=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/.exec(n);if(!e)return;let t=/^exo__Asset_uid:[ \t]*["']?([^\s"']+)["']?[ \t]*$/m.exec(e[1]);return t?t[1]:void 0}a(L3,"extractAssetUid");async function Rz(n){let{localFiles:e,watermark:t,actualBaseTreeSha:r,sha1:i}=n;if(t===null)return{kind:"full-conflict",reason:"first-sync"};if(r===null)return{kind:"full-conflict",reason:"base-mismatch",detail:`watermark commit ${t.lastSyncedSha} not resolvable on remote`};if(r!==t.rootTreeSha)return{kind:"full-conflict",reason:"base-mismatch",detail:`stored root tree ${t.rootTreeSha} != actual ${r} at ${t.lastSyncedSha}`};let s=[],o=new Map;for(let[T,I]of e){let A=await(0,xz.gitBlobSha)(I,i);o.set(T,A),s.push({path:T,blobSha:A,uid:typeof I=="string"?L3(I):void 0})}let c=[],l=[],u=[],f=[],d=new Map;for(let T of s){if(T.uid===void 0)continue;let I=d.get(T.uid)??[];I.push(T.path),d.set(T.uid,I)}let h=new Map;for(let T of t.files){if(T.uid===void 0)continue;let I=h.get(T.uid)??[];I.push(T.path),h.set(T.uid,I)}let p=new Set;for(let[T,I]of d)I.length>1&&p.add(T);for(let[T,I]of h)I.length>1&&p.add(T);for(let T of[...p].sort()){let I=d.get(T)??[],A=I.length>1?`on disk (${I.join(", ")})`:`in the sync base (${(h.get(T)??[]).join(", ")})`;f.push(`duplicate uid ${T} ${A} \u2014 uid identity suppressed for the group; every path matched by path identity (#3477)`)}let y=new Map,g=[];for(let T of t.files)T.uid!==void 0&&!p.has(T.uid)?y.set(T.uid,T):g.push(T);let v=[],_=new Set;for(let T of s){let I=T.uid!==void 0&&!p.has(T.uid)?y.get(T.uid):void 0;T.uid!==void 0&&I!==void 0?(_.add(T.uid),(I.blobSha!==T.blobSha||I.path!==T.path)&&l.push({path:T.path,uid:T.uid,blobSha:T.blobSha,...I.path!==T.path?{basePath:I.path}:{}})):v.push(T)}let S=new Map;for(let T of g)S.set(T.path,T);for(let[T,I]of y)_.has(T)||S.set(I.path,I);for(let T of v){let I=S.get(T.path);I!==void 0?(S.delete(T.path),I.blobSha!==T.blobSha&&l.push({path:T.path,uid:T.uid,blobSha:T.blobSha})):c.push({path:T.path,uid:T.uid,blobSha:T.blobSha})}for(let T of S.values())u.push({path:T.path,uid:T.uid,blobSha:T.blobSha});return{kind:"changes",added:c,modified:l,deleted:u,warnings:f,diskBlobShas:o,duplicateUids:p}}a(Rz,"detectChanges")});var fd=w(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});wc.getHeadSha=Cz;wc.getCommitInfo=Oz;wc.getTree=Dz;wc.getBlobText=Fz;wc.getBlobBytes=Lz;var N3=il(),Pz="https://api.github.com";function ud(n){return(n??Pz).replace(/\/$/,"")}a(ud,"api");function Sc(n){return n!==null&&typeof n=="object"?n:void 0}a(Sc,"asRecord");function Fs(n,e){let r=Sc(n)?.[e];return typeof r=="string"?r:void 0}a(Fs,"readString");async function Cz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/refs/heads/${encodeURIComponent(r)}`}),o=Fs(Sc(s?.json)?.object,"sha");if(typeof o!="string"||o.length===0)throw new Error(`ExoSync: missing object.sha for ref heads/${r}`);return o}a(Cz,"getHeadSha");async function Oz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/commits/${encodeURIComponent(r)}`}),o=Sc(s?.json),c=Fs(o,"sha"),l=Fs(o?.tree,"sha");if(!c||!l)throw new Error(`ExoSync: malformed commit response for ${r}`);let u=o?.parents,f=Array.isArray(u)?u.map(d=>Fs(d,"sha")).filter(d=>typeof d=="string"):[];return{sha:c,treeSha:l,parents:f}}a(Oz,"getCommitInfo");async function Dz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/trees/${encodeURIComponent(r)}?recursive=1`}),o=Sc(s?.json);if(o?.truncated===!0)throw new Error(`ExoSync: tree ${r} is truncated by GitHub (repo too large for recursive listing) \u2014 refusing to diff`);let c=o?.tree;if(!Array.isArray(c))throw new Error(`ExoSync: malformed tree response for ${r}`);let l=[];for(let u of c){let f=Sc(u);if(f?.type!=="blob")continue;let d=Fs(f,"path"),h=Fs(f,"sha"),p=typeof f.size=="number"?f.size:void 0;d&&h&&l.push({path:d,blobSha:h,...p!==void 0?{size:p}:{}})}return l}a(Dz,"getTree");async function Fz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(r)}`}),o=Sc(s?.json),c=Fs(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${r}`);return Fs(o,"encoding")==="utf-8"?c:(0,N3.base64ToUtf8)(c)}a(Fz,"getBlobText");async function Lz(n,e,t,r,i){let s=await n({method:"GET",url:`${ud(i)}/repos/${encodeURIComponent(e)}/${encodeURIComponent(t)}/git/blobs/${encodeURIComponent(r)}`}),o=Sc(s?.json),c=Fs(o,"content");if(typeof c!="string")throw new Error(`ExoSync: malformed blob response for ${r}`);return Fs(o,"encoding")==="utf-8"?new TextEncoder().encode(c):(0,N3.base64ToBytes)(c)}a(Lz,"getBlobBytes")});var cy=w(BE=>{"use strict";Object.defineProperty(BE,"__esModule",{value:!0});BE.isAuthError=Nz;function Nz(n){let e=n instanceof Error?n.message:String(n);return/HTTP 401/.test(e)?!0:/HTTP 403/.test(e)&&!/rate limit/i.test(e)&&!/abuse detection/i.test(e)}a(Nz,"isAuthError")});var uy=w(ly=>{"use strict";Object.defineProperty(ly,"__esModule",{value:!0});ly.scanForSecrets=kz;ly.redactSecrets=Mz;var k3=[{kind:"github-token",re:/gh[pousr]_[A-Za-z0-9_]{36,}/},{kind:"github-fine-grained-token",re:/github_pat_[A-Za-z0-9_]{22,}_[A-Za-z0-9_]{59,}/},{kind:"private-key",re:/-----BEGIN [A-Z ]*PRIVATE KEY-----/}];function kz(n){let e=[];for(let[t,r]of n)for(let{kind:i,re:s}of k3)s.test(r)&&e.push({path:t,kind:i});return e}a(kz,"scanForSecrets");function Mz(n){let e=n;for(let{kind:t,re:r}of k3)e=e.replace(new RegExp(r.source,"g"),`[REDACTED:${t}]`);return e}a(Mz,"redactSecrets")});var dy=w(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});fy.isRateLimitError=M3;fy.withRateLimitBackoff=$z;function M3(n){let e=n instanceof Error?n.message:String(n);return/HTTP 429/.test(e)?!0:/HTTP 403/.test(e)&&(/rate limit/i.test(e)||/abuse detection/i.test(e))}a(M3,"isRateLimitError");var jz=a(n=>new Promise(e=>setTimeout(e,n)),"defaultSleep");function $z(n,e={}){let t=e.maxRetries??3,r=e.baseDelayMs??1e3,i=e.sleep??jz,s=e.random??Math.random;return async o=>{let c=0;for(;;)try{return await n(o)}catch(l){if(!M3(l)||c>=t)throw l;let u=r*2**c*(1+s());c++,await i(u)}}}a($z,"withRateLimitBackoff")});var hy=w(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.DEFAULT_MAX_FILE_BYTES=Io.InMemoryQuarantineStore=void 0;Io.contentEquals=Uz;Io.isSyncablePath=Bz;Io.isFileSpaceSyncablePath=Vz;function Uz(n,e){if(n===void 0||e===void 0||typeof n=="string"&&typeof e=="string")return n===e;if(typeof n=="string"||typeof e=="string"||n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.byteLength;t++)if(n[t]!==e[t])return!1;return!0}a(Uz,"contentEquals");var VE=class{static{a(this,"InMemoryQuarantineStore")}constructor(){this.entries=[]}async quarantine(e){this.entries.push(e)}};Io.InMemoryQuarantineStore=VE;function Bz(n){return n.endsWith(".md")&&!n.includes(".local.")&&!n.includes(".conflict.")}a(Bz,"isSyncablePath");function Vz(n){return!n.includes(".local.")&&!n.includes(".conflict.")}a(Vz,"isFileSpaceSyncablePath");Io.DEFAULT_MAX_FILE_BYTES=30*1024*1024});var WE=w(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.SyncEngine=Ls.DEFAULT_MAX_PUSH_RETRIES=void 0;Ls.isNonFastForwardError=V3;Ls.orderChildrenFirst=Yz;var Gz=sy(),Ft=fd(),vc=UE(),qz=il(),dd=ld(),Wz=cy(),zz=uy(),Hz=dy(),da=hy();Ls.DEFAULT_MAX_PUSH_RETRIES=3;function Kz(n){try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{return null}}a(Kz,"decodeUtf8Strict");function Qz(n){return typeof n=="string"?n:{base64:(0,qz.bytesToBase64)(n)}}a(Qz,"toCommitContent");async function j3(n,e){if(n.readBinary===void 0)throw new Error("LocalFilesPort.readBinary is required for file-mode sync (Phase C)");return n.readBinary(e)}a(j3,"readBinaryStrict");async function Xz(n,e,t){if(n.writeBinary===void 0)throw new Error("LocalFilesPort.writeBinary is required for file-mode sync (Phase C)");return n.writeBinary(e,t)}a(Xz,"writeBinaryStrict");function $3(n){return n.length===0||n.startsWith("/")||n.includes("\\")?!1:n.split("/").every(e=>e.length>0&&e!=="."&&e!=="..")}a($3,"isSafeRepoRelativePath");function V3(n){let e=n instanceof Error?n.message:String(n);return/HTTP 422/.test(e)&&/git\/refs/.test(e)||/ref update mismatch/.test(e)||/HTTP 422/.test(e)&&/git\/trees/.test(e)&&/BadObjectState/.test(e)}a(V3,"isNonFastForwardError");function Yz(n){let e=a(t=>t.split("/").filter(r=>r.length>0).length,"depth");return[...n].sort((t,r)=>e(r.localPath)-e(t.localPath))}a(Yz,"orderChildrenFirst");function U3(n,e){let t=new Map(n.map(o=>[o.path,o])),r=new Set,i=[];for(let o of e){r.add(o.path);let c=t.get(o.path);(c===void 0||c.blobSha!==o.blobSha)&&i.push(o)}let s=n.filter(o=>!r.has(o.path));return{changed:i,deleted:s}}a(U3,"diffTrees");function cu(n){return n instanceof Error?n.message:String(n)}a(cu,"errMsg");function Jz(n,e,t){if(t.size===0)return n;let r=new Map(e.files.map(o=>[o.path,o])),i=new Set(n.map(o=>o.path)),s=[];for(let o of n){if(!t.has(o.path)){s.push(o);continue}let c=r.get(o.path);c!==void 0&&s.push(c)}for(let o of t){if(i.has(o))continue;let c=r.get(o);c!==void 0&&s.push(c)}return s}a(Jz,"applyWatermarkPins");var GE={mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:[],mergedCount:0,mergedPaths:[],warnings:[]};function B3(n){return new Map(n.map(e=>[e.path,e.blobSha]))}a(B3,"treeByPath");function py(n){return[...n.quarantineEntries.map(e=>e.path),...n.resolvedQuarantineEntries.map(e=>e.path)]}a(py,"quarantinedPathsOf");var qE=class{static{a(this,"SyncEngine")}constructor(e){this.opInProgress=!1,this.deps=e,this.transport=(0,Hz.withRateLimitBackoff)(e.transport,e.backoff)}busyResult(e){return{repoKey:e.repoKey,status:"busy",pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:[],deferredDeletes:[],detail:"another sync operation is in progress (D11 guard) \u2014 retry after it finishes"}}modeOps(e){let t=e.spaceKind==="file",r=t?da.isFileSpaceSyncablePath:da.isSyncablePath,i=this.deps.maxFileBytes??da.DEFAULT_MAX_FILE_BYTES;return{fileMode:t,syncable:r,treeFilter:a(s=>r(s.path)&&(!t||s.size===void 0||s.size<=i),"treeFilter")}}async buildFileModeFirstSyncBase(e,t,r,i){let s=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(r.treeFilter),l=[];for(let u of c){let f=t.get(u.path);f!==void 0&&await(0,dd.gitBlobSha)(f,this.deps.sha1)===u.blobSha&&l.push({path:u.path,blobSha:u.blobSha})}return i.push(`first-sync (file mode): synthetic base from ${l.length} already-identical file(s) at head ${s} \u2014 divergence resolves through the remote-wins layer (D22)`),{lastSyncedSha:s,rootTreeSha:o.treeSha,files:l,spaceKind:"file"}}async syncAll(e,t="sync",r){if(this.opInProgress)return e.map(i=>this.busyResult(i));this.opInProgress=!0;try{let i=[];for(let s of e)i.push(await this.syncLocked(s,t,r));return i}finally{this.opInProgress=!1}}async sync(e,t="sync",r){if(this.opInProgress)return this.busyResult(e);this.opInProgress=!0;try{return await this.syncLocked(e,t,r)}finally{this.opInProgress=!1}}emitProgress(e,t,r){if(e!==void 0)try{e({repoKey:t,phase:r})}catch{}}async syncLocked(e,t="sync",r){let i=[],s=[],o=[],c=a((l,u={})=>({repoKey:e.repoKey,status:l,pulledCount:0,pushedCount:0,mergedCount:0,quarantinedCount:0,warnings:i,deferredDeletes:s,...u}),"result");try{let l=await this.deps.materializationCheck.check(e);if(!l.fullyMaterialized)return i.push(`skipped: repo not fully materialized${l.reason?` (${l.reason})`:""} \u2014 deletes NOT inferred (D19)`),c("skipped-not-materialized");let u=this.modeOps(e),f=this.deps.localFilesFor(e);if(u.fileMode&&(f.readBinary===void 0||f.writeBinary===void 0))return c("error",{detail:"file-mode repo requires a LocalFilesPort with readBinary/writeBinary \u2014 refusing to sync through the text-only port (binary would corrupt)"});if(u.fileMode&&this.deps.quarantine===void 0)return c("error",{detail:"file-mode repo requires a quarantine sink (D18 remote-wins preserves losing local bytes there) \u2014 configure the quarantine repo before syncing FileSpaces"});let d=this.deps.maxFileBytes??da.DEFAULT_MAX_FILE_BYTES,h=new Map,p=new Set;for(let N of(await f.list()).filter(u.syncable))if(u.fileMode){let j=await j3(f,N);if(j.byteLength>d){p.add(N),i.push(`skipped oversized file ${N} (${j.byteLength} bytes > ${d} cap) \u2014 excluded from sync symmetrically (Phase C size cap)`);continue}h.set(N,j)}else h.set(N,await f.read(N));let y=await this.deps.watermarkStore.get(e.repoKey);if(y?.spaceKind==="file"&&!u.fileMode)return c("error",{detail:"watermark was written by a FILE-mode sync but the spec now resolves to asset mode \u2014 refusing (fix the conflicting Space declarations, or clear the watermark to restart)"});y!==null&&u.fileMode&&y.spaceKind!=="file"&&(i.push("watermark was written by an ASSET-mode sync \u2014 rebuilding the base through the file-mode first-sync layer (kind flip)"),y=null);let g=!1;if(y===null)if(u.fileMode)g=!0,y=await this.buildFileModeFirstSyncBase(e,h,u,i);else{let N=await this.bootstrapWatermark(e,h,i,c);if(N.kind==="settled")return N.outcome;g=!0,y=N.base}let v=y;u.fileMode&&p.size>0&&(y={...y,files:y.files.filter(N=>!p.has(N.path))}),this.emitProgress(r,e.repoKey,"detecting");let _=await(0,vc.detectChanges)({localFiles:h,watermark:y,actualBaseTreeSha:await this.resolveBaseTreeSha(e,y),sha1:this.deps.sha1});if(_.kind==="full-conflict")return c("full-conflict",{detail:`${_.reason}${_.detail?`: ${_.detail}`:""} \u2014 divergence must go through merge/quarantine (A2/A3), not overwrite`});i.push(..._.warnings);let S=this.pinLocalChanges(_,h,i,s,t);o=[...S.pushDeletionsAll.keys()];let T=await this.runPushLoop(e,y,S,h,i,u,g,p,t,r);if(o=[],T.kind!=="done"&&S.pushDeletionsAll.size>0&&s.push(...S.pushDeletionsAll.keys()),T.kind==="conflict")return c("conflict",{detail:T.detail});if(T.kind==="secret-detected")return c("error",{detail:T.detail});if(T.kind==="retry-exhausted"){i.push(...T.merge.warnings);let N=await this.buildTerminalQuarantineEntries(e,y,T.pushFiles,T.merge.quarantineEntries,h),j=[...T.merge.quarantineEntries,...T.merge.resolvedQuarantineEntries,...N];return await this.flushQuarantine(j,i),c("retry-exhausted",{detail:T.detail,quarantinedCount:j.length,...j.length>0?{quarantinedPaths:j.map(se=>se.path)}:{}})}let{examinedHead:I,pushedSha:A,applyWrites:R,applyDeletes:q,pushFiles:Y}=T,C=T.merge;i.push(...C.warnings),i.push(...T.deferredWarnings),s.push(...T.withheldDeletions);let O=T.deferredPaths.size>0?{deferredPaths:[...T.deferredPaths]}:{},k=T.pushedDeletions.length>0?{pushedDeletes:T.pushedDeletions}:{},H=await this.flushQuarantine([...C.quarantineEntries,...C.resolvedQuarantineEntries],i),G=new Set;if(!H&&C.resolvedQuarantineEntries.length>0){for(let N of C.resolvedQuarantineEntries)G.add(N.path);i.push(`quarantine flush failed \u2014 remote-wins apply withheld for ${G.size} path(s); local files untouched, conflict re-derives next sync (D18 durability gate)`)}if(A===void 0&&I===y.lastSyncedSha&&R.length===0&&q.length===0&&C.mergedWrites.length===0&&C.quarantineEntries.length===0&&C.resolvedQuarantineEntries.length===0&&(y.pinnedPaths?.length??0)===0&&T.alreadyInHead.length===0&&T.deferredPaths.size===0&&!g)return c("synced");let B=A??I,Z=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,B,this.deps.baseURL);if(A!==void 0&&Z.parents[0]!==I)return await this.checkRaceWindow(e,y,I,Z.parents[0],Y,new Set(T.pushedDeletions),i,u),i.push(`race-window: watermark NOT advanced (pushed commit's parent ${Z.parents[0]} != examined head ${I}) \u2014 next sync reconciles the concurrent change`),c("synced",{pushedSha:A,pushedCount:Y.size,mergedCount:C.mergedCount,quarantinedCount:C.quarantineEntries.length+C.resolvedQuarantineEntries.length,...C.mergedPaths.length>0?{mergedPaths:C.mergedPaths}:{},...py(C).length>0?{quarantinedPaths:py(C)}:{},...O,...k});let{pulledCount:_e,pinnedPaths:ie}=await this.applyRemoteChanges(f,h,[...R,...C.mergedWrites].filter(N=>!G.has(N.path)),q.filter(N=>!G.has(N.path)),i);for(let N of C.quarantineEntries)ie.add(N.path);for(let N of T.deferredPaths)ie.add(N);for(let N of G)ie.add(N);if(u.fileMode){for(let N of p)ie.add(N);for(let N of T.remoteOversized)ie.add(N)}return await this.advanceWatermark(e,B,Z.treeSha,h,[...R,...C.mergedWrites,...T.deferredRemoteChanges],v,ie,_.diskBlobShas,u,p),await this.resolveClearedPins(e,v,ie,i,new Set(C.resolvedQuarantineEntries.map(N=>N.path))),c("synced",{pushedSha:A,pulledCount:_e,pushedCount:Y.size,mergedCount:C.mergedCount,quarantinedCount:C.quarantineEntries.length+C.resolvedQuarantineEntries.length,...C.mergedPaths.length>0?{mergedPaths:C.mergedPaths}:{},...py(C).length>0?{quarantinedPaths:py(C)}:{},...O,...k})}catch(l){let u=this.deps.redact??(f=>f);return o.length>0&&s.push(...o),(0,Wz.isAuthError)(l)?c("auth-required",{detail:u(`authentication failed: ${cu(l)} \u2014 the PAT is expired, revoked or under-scoped; update it in the per-device secure storage (R8). Never treated as success.`)}):(i.push(`sync failed: ${u(cu(l))}`),c("error",{detail:u(cu(l))}))}}async flushQuarantine(e,t){if(e.length===0)return!0;let r=this.deps.redact??(s=>s);for(let s of e)t.push(r(`quarantined ${s.path}: ${s.reason}`));let i=this.deps.quarantine;if(i===void 0)return!1;try{if(i.quarantineAll!==void 0)await i.quarantineAll(e);else for(let s of e)await i.quarantine(s);return!0}catch(s){let o=this.deps.redact??(c=>c);return t.push(`quarantine sink failed: ${o(cu(s))} \u2014 files untouched on disk; the conflict re-derives next sync (D17 degradation)`),!1}}async buildTerminalQuarantineEntries(e,t,r,i,s){let o=new Set(i.map(u=>u.path)),c=new Map;try{let u=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,(await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(d=>r.has(d.path));for(let d of f)c.set(d.path,await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,d.blobSha,this.deps.baseURL))}catch{}let l=[];for(let[u,f]of r){if(o.has(u))continue;let d=s.get(u),h=d??f,p=d!==void 0&&!(0,da.contentEquals)(d,f),y=typeof h=="string"?(0,vc.extractAssetUid)(h):void 0,g=c.get(u);l.push({repoKey:e.repoKey,path:u,...y!==void 0?{uid:y}:{},reason:`non-fast-forward push failed after ${this.deps.maxPushRetries??Ls.DEFAULT_MAX_PUSH_RETRIES} retries (D16) \u2014 a concurrent writer keeps moving ${e.branch}; base recoverable from git history at ${t.lastSyncedSha}${p?"; the contended push payload was a merged proposal (never applied to disk) \u2014 the merge re-derives next sync":""}`,...typeof h=="string"?{localContent:h}:{localContentBytes:h},...g!==void 0?{remoteContent:g}:{}})}return l}async resolveClearedPins(e,t,r,i,s=new Set){let o=this.deps.quarantine;if(o===void 0||o.markResolved===void 0)return;let c=(t.pinnedPaths??[]).filter(l=>!r.has(l)&&!s.has(l));for(let l of c)try{await o.markResolved?.(e.repoKey,l)}catch(u){let f=this.deps.redact??(d=>d);i.push(`quarantine markResolved failed for ${l}: ${f(cu(u))} \u2014 unresolved-count may overcount until the resolver UI reconciles (CQ4)`)}}async resolveBaseTreeSha(e,t){try{return(await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,t.lastSyncedSha,this.deps.baseURL)).treeSha}catch{return null}}pinLocalChanges(e,t,r,i,s){let o=e.modified.filter(h=>h.basePath!==void 0),c=[...e.added,...e.modified.filter(h=>h.basePath===void 0)],l=new Map;if(s==="pull"){for(let h of o)h.basePath!==void 0&&i.push(h.basePath),r.push(`pull-only: rename (uid ${h.uid??"?"}) ${h.basePath} \u2192 ${h.path} not pushed \u2014 propagates on the next push/Sync (#3473)`);for(let h of e.deleted)i.push(h.path),r.push(`pull-only: delete of ${h.path} not pushed \u2014 propagates on the next push/Sync (#3473)`)}else{for(let h of o)h.basePath!==void 0&&l.set(h.basePath,h.path);for(let h of e.deleted)l.set(h.path,h.path)}let u=[...c,...o,...e.deleted.map(h=>({...h}))],f=new Set(e.deleted.map(h=>h.path)),d=new Map;for(let h of[...c,...s==="pull"?[]:o]){let p=t.get(h.path);p!==void 0&&d.set(h.path,p)}return{localChanges:u,localDeletedPaths:f,pushFilesAll:d,pushDeletionsAll:l,dupUids:e.duplicateUids}}async runPushLoop(e,t,r,i,s,o,c=!1,l=new Set,u="sync",f){let{localChanges:d,localDeletedPaths:h,pushFilesAll:p,pushDeletionsAll:y,dupUids:g}=r,v=this.deps.maxPushRetries??Ls.DEFAULT_MAX_PUSH_RETRIES,_=0,S="",T,I=[],A=[],R=new Map,q=new Set,Y=[],C=GE,O=[],k=new Set,H=[],G=[],B=new Set;for(;;){S=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),I=[],A=[],C=GE,O=[],k=new Set,H=[],G=[];let Z,_e=new Set,ie=(t.pinnedPaths?.length??0)>0;if(S!==t.lastSyncedSha||ie||c){this.emitProgress(f,e.repoKey,"pulling-remote");let se=await this.collectRemoteChanges(e,t,S,o,l,s,B);Z=se.headTreeByPath;let be=this.matchLocalVsRemote(d,h,i,se.changes,_e,g,se.headTreeByPath);if(be.conflicts.length>0){if(u==="sync"&&this.emitProgress(f,e.repoKey,"merging"),u!=="sync"){for(let W of be.conflicts){k.add(W.local.path),W.local.basePath!==void 0&&k.add(W.local.basePath);for(let Ee of W.remotes)k.add(Ee.path),Ee.kind==="change"&&H.push(Ee)}G.push(`${u}-only: ${be.conflicts.length} conflict(s) deferred to a full Sync (${be.conflicts.map(W=>W.desc).join("; ")}) \u2014 paths pinned, nothing merged`)}else if(o.fileMode)C=this.resolveFileModeConflicts(e,be.conflicts,i,be.applyWrites,be.applyDeletes);else{if(this.deps.mergeLayer===void 0)return{kind:"conflict",detail:`overlapping change on ${be.conflicts[0].desc} \u2014 merge layer (A2/A3) required; nothing pushed, nothing written`};C=await this.resolveMergeConflicts(e,t,be.conflicts,i)}if(u==="sync")for(let W of be.conflicts)for(let Ee of W.remotes)Ee.path!==W.local.path&&(k.add(Ee.path),Ee.kind==="change"&&H.push(Ee),G.push(`conflict group ${W.desc}: remote change at ${Ee.path} NOT applied \u2014 pinned to re-derive on the next sync (#3477)`))}if(I=be.applyWrites,A=be.applyDeletes,u==="push"&&(I.length>0||A.length>0)){for(let W of I)k.add(W.path),H.push(W);for(let W of A)k.add(W.path);G.push(`push-only: ${I.length+A.length} remote change(s) NOT applied \u2014 pinned to re-derive on the next pull/Sync`),I=[],A=[]}}R=u==="pull"?new Map:new Map([...[...p].filter(([se])=>!_e.has(se)),...C.mergedFiles]),q=new Set,Y=[];for(let[se,be]of y){if(_e.has(be)){Y.push(se);continue}R.has(se)||q.add(se)}if((R.size>0||q.size>0)&&Z===void 0&&(Z=B3(await(0,Ft.getTree)(this.transport,e.owner,e.repo,t.rootTreeSha,this.deps.baseURL))),R.size>0&&Z!==void 0){for(let[se,be]of R){let W=Z.get(se);W!==void 0&&W===await(0,dd.gitBlobSha)(be,this.deps.sha1)&&(R.delete(se),O.push(se))}O.length>0&&s.push(`phantom push skipped: ${O.length} file(s) already identical in remote HEAD (${O.join(", ")}) \u2014 excluded from the commit (#3475)`)}if(q.size>0&&Z!==void 0){for(let se of[...q])Z.has(se)||q.delete(se);R.size===0&&q.size>=Z.size&&(Y.push(...q),G.push(`deletion of ALL ${q.size} remaining file(s) deferred \u2014 GitHub cannot create an empty tree; the deletes re-derive and propagate once the repo has at least one surviving file`),q.clear())}if(R.size===0&&q.size===0)break;let N=new Map;for(let[se,be]of R)if(typeof be=="string")N.set(se,be);else{let W=Kz(be);W!==null&&N.set(se,W)}let j=(0,zz.scanForSecrets)(N);if(j.length>0)return{kind:"secret-detected",detail:`secret-scan: refusing to push \u2014 ${j.map(se=>`${se.path} (${se.kind})`).join(", ")} (R5); remove the secret and re-sync`};try{T=await(0,Gz.restCreateCommit)(this.transport,{owner:e.owner,repo:e.repo,branch:e.branch,files:new Map([...R].map(([se,be])=>[se,Qz(be)])),deletions:[...q],message:this.deps.commitMessage?.(e,R.size,q.size)??`chore(exosync): sync ${R.size} file(s)${q.size>0?`, ${q.size} deletion(s)`:""}`,baseURL:this.deps.baseURL,redact:this.deps.redact});break}catch(se){if(!V3(se))throw se;if(_++,_>v)return{kind:"retry-exhausted",detail:`non-fast-forward push failed after ${v} retries (D16 cap) \u2014 contended files routed to quarantine (D17)`,pushFiles:R,merge:C};s.push(`non-fast-forward push (attempt ${_}/${v}) \u2014 re-pulling and retrying (D16)`)}}return{kind:"done",examinedHead:S,pushedSha:T,applyWrites:I,applyDeletes:A,pushFiles:R,pushedDeletions:T!==void 0?[...q]:[],withheldDeletions:Y,merge:C,remoteOversized:B,alreadyInHead:O,deferredPaths:k,deferredRemoteChanges:H,deferredWarnings:G}}async resolveMergeConflicts(e,t,r,i){let s=this.deps.mergeLayer;if(s===void 0)return GE;let o=new Map(t.files.map(g=>[g.path,g])),c=new Map,l=[],u=[],f=[],d=[],h=0,p=a(g=>typeof g=="string"?g:void 0,"asText"),y=a((g,v,_)=>{let S=p(i.get(g.local.path)),T=p(g.remotes[0]?.content);return{repoKey:e.repoKey,path:g.local.path,...g.local.uid!==void 0?{uid:g.local.uid}:{},reason:v,..._!==void 0?{baseContent:_}:{},...S!==void 0?{localContent:S}:{},...T!==void 0?{remoteContent:T}:{}}},"entry");for(let g of r){let v=o.get(g.local.basePath??g.local.path)??o.get(g.remotes[0]?.path??""),_;if(v!==void 0&&(_=await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,v.blobSha,this.deps.baseURL)),g.remotes.length>1){u.push(y(g,`ambiguous conflict: local change overlaps ${g.remotes.length} remote changes (${g.remotes.map(R=>R.path).join(", ")})`,_));continue}let S=g.remotes[0],T=p(i.get(g.local.path)),I=await s.resolve({path:g.local.path,...g.local.uid!==void 0?{uid:g.local.uid}:{},..._!==void 0?{base:_}:{},...T!==void 0?{local:T}:{},...S.kind==="change"&&typeof S.content=="string"?{remote:S.content}:{}});if(I.action==="quarantine"){u.push(y(g,I.reason,_));continue}h++,d.push(g.local.path);for(let R of I.warnings??[])f.push(`merge(${g.local.path}): ${R}`);let A=S.kind==="change"?S.content:void 0;if(I.content!==A&&c.set(g.local.path,I.content),I.content!==i.get(g.local.path)){let R=(0,vc.extractAssetUid)(I.content)??g.local.uid;l.push({path:g.local.path,kind:"change",content:I.content,blobSha:await(0,dd.gitBlobSha)(I.content,this.deps.sha1),...R!==void 0?{uid:R}:{}})}}return{mergedFiles:c,mergedWrites:l,quarantineEntries:u,resolvedQuarantineEntries:[],mergedCount:h,mergedPaths:d,warnings:f}}resolveFileModeConflicts(e,t,r,i,s){let o=[],c=[];for(let l of t){l.remotes.length>1&&c.push(`file-mode conflict on ${l.local.path} unexpectedly overlaps ${l.remotes.length} remote changes \u2014 resolving against the first`);let u=l.remotes[0],f=r.get(l.local.path);u.kind==="change"?i.push(u):s.push(u),!(l.localIsDelete||f===void 0)&&o.push({repoKey:e.repoKey,path:l.local.path,reason:`file-mode remote-wins (D18): remote ${u.kind==="change"?`version ${u.blobSha}`:"delete"} wins; this is the losing LOCAL version, preserved byte-exact`,...typeof f=="string"?{localContent:f}:{localContentBytes:f}})}return{mergedFiles:new Map,mergedWrites:[],quarantineEntries:[],resolvedQuarantineEntries:o,mergedCount:0,mergedPaths:[],warnings:c}}async applyRemoteChanges(e,t,r,i,s){let o=0,c=new Set,l=a(async(f,d)=>{try{return d?await j3(e,f):await e.read(f)}catch{return}},"tryRead"),u=a(async(f,d)=>{typeof d=="string"?await e.write(f,d):await Xz(e,f,d)},"writeContent");for(let f of r){if(f.content===void 0)continue;if(!$3(f.path)){s.push(`unsafe remote path skipped on pull-apply: ${f.path}`),c.add(f.path);continue}let d=t.get(f.path),h=await l(f.path,typeof(d??f.content)!="string");if(!(0,da.contentEquals)(h,d)){s.push(`pull-apply skipped: ${f.path} changed on disk mid-sync (TOCTOU) \u2014 remote change re-derives next sync`),c.add(f.path);continue}await u(f.path,f.content),o++}for(let f of i){if(!$3(f.path)){s.push(`unsafe remote path skipped on pull-delete: ${f.path}`),c.add(f.path);continue}let d=t.get(f.path);if(d!==void 0){let h=await l(f.path,typeof d!="string");if(h!==void 0&&!(0,da.contentEquals)(h,d)){s.push(`pull-delete skipped: ${f.path} changed on disk mid-sync (TOCTOU) \u2014 delete-vs-modify re-derives next sync`),c.add(f.path);continue}await e.delete(f.path),o++}}return{pulledCount:o,pinnedPaths:c}}async advanceWatermark(e,t,r,i,s,o,c,l,u,f=new Set){let d=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,r,this.deps.baseURL)).filter(p=>u.treeFilter(p)&&!f.has(p.path)),h=Jz(await this.buildWatermarkFiles(e,d,i,s,o,l,u),o,c);await this.deps.watermarkStore.set(e.repoKey,{lastSyncedSha:t,rootTreeSha:r,files:h,...c.size>0?{pinnedPaths:[...c]}:{},...u.fileMode?{spaceKind:"file"}:{}})}async bootstrapWatermark(e,t,r,i){let s=await(0,Ft.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),o=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,s,this.deps.baseURL),c=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,o.treeSha,this.deps.baseURL)).filter(f=>(0,da.isSyncablePath)(f.path));for(let f of c){let d=t.get(f.path);if(d===void 0||await(0,dd.gitBlobSha)(d,this.deps.sha1)!==f.blobSha)return{kind:"settled",outcome:i("full-conflict",{detail:`first-sync: no watermark and local content diverges from remote head at ${f.path} \u2014 A2/A3 scope`})}}let l=c.map(f=>{let d=t.get(f.path),h=typeof d=="string"?(0,vc.extractAssetUid)(d):void 0;return{path:f.path,blobSha:f.blobSha,...h?{uid:h}:{}}}),u={lastSyncedSha:s,rootTreeSha:o.treeSha,files:l};return t.size===c.length?(await this.deps.watermarkStore.set(e.repoKey,u),r.push(`watermark bootstrapped from head ${s} (local tree identical to remote)`),{kind:"settled",outcome:i("synced")}):(r.push(`first-sync (asset mode): local tree (${t.size} files) is a pure superset of remote head ${s} (${c.length} files) \u2014 ${t.size-c.length} local-only addition(s) derive as pushable adds (#3565)`),{kind:"additive-base",base:u})}async collectRemoteChanges(e,t,r,i,s=new Set,o=[],c=new Set){let l=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,r,this.deps.baseURL),u=await(0,Ft.getTree)(this.transport,e.owner,e.repo,l.treeSha,this.deps.baseURL);if(i.fileMode)for(let g of u)i.syncable(g.path)&&!i.treeFilter(g)&&!c.has(g.path)&&(c.add(g.path),o.push(`skipped oversized REMOTE file ${g.path} (${g.size??"?"} bytes over cap) \u2014 excluded from sync symmetrically (Phase C size cap)`));let f=u.filter(g=>i.treeFilter(g)&&!s.has(g.path)),d=t.files.filter(g=>!c.has(g.path)&&!s.has(g.path)),{changed:h,deleted:p}=U3(d,f),y=[];for(let g of h){if(i.fileMode){let _=await(0,Ft.getBlobBytes)(this.transport,e.owner,e.repo,g.blobSha,this.deps.baseURL);y.push({path:g.path,kind:"change",blobSha:g.blobSha,content:_});continue}let v=await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,g.blobSha,this.deps.baseURL);y.push({path:g.path,kind:"change",blobSha:g.blobSha,content:v,uid:(0,vc.extractAssetUid)(v)})}for(let g of p)y.push({path:g.path,kind:"delete",uid:g.uid});return{changes:y,headTreeByPath:B3(u)}}matchLocalVsRemote(e,t,r,i,s,o=new Set,c){let l=new Set,u=[],f=new Map;for(let g of i)g.kind==="change"&&g.uid!==void 0&&f.set(g.uid,(f.get(g.uid)??0)+1);let d=new Set(o);for(let[g,v]of f)v>1&&d.add(g);let h=new Map,p=new Map;for(let g of i){if(g.uid!==void 0&&!d.has(g.uid)){let v=h.get(g.uid)??[];v.push(g),h.set(g.uid,v)}p.set(g.path,g)}for(let g of e){let v=new Set;if(g.uid!==void 0&&!d.has(g.uid))for(let I of h.get(g.uid)??[])I.kind==="change"&&I.path!==g.path&&(c?.has(g.path)===!0||g.basePath!==void 0&&c?.has(g.basePath)===!0)||v.add(I);let _=p.get(g.path);if(_!==void 0&&v.add(_),g.basePath!==void 0){let I=p.get(g.basePath);I!==void 0&&v.add(I)}let S=[],T=!1;for(let I of v){if(T=t.has(g.path)&&!r.has(g.path),T&&I.kind==="delete"){l.add(I);continue}if(!T&&I.kind==="change"&&I.path===g.path&&I.blobSha===g.blobSha){l.add(I),s.add(g.path);continue}if(I.kind==="delete"&&g.basePath!==void 0&&I.path===g.basePath){let A=p.get(g.path);if(A!==void 0&&A.kind==="change"&&A.blobSha===g.blobSha){l.add(I);continue}}S.push(I),l.add(I)}S.length>0&&(u.push({local:g,localIsDelete:T,remotes:S,desc:`${g.uid!==void 0&&!d.has(g.uid)?g.uid:g.path} (local ${T?"delete":"change"} vs remote ${S[0].kind} at ${S[0].path})`}),s.add(g.path))}let y=i.filter(g=>!l.has(g));return{conflicts:u,applyWrites:y.filter(g=>g.kind==="change"),applyDeletes:y.filter(g=>g.kind==="delete")}}async checkRaceWindow(e,t,r,i,s,o,c,l){try{let u=await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,i,this.deps.baseURL),f=(await(0,Ft.getTree)(this.transport,e.owner,e.repo,u.treeSha,this.deps.baseURL)).filter(l.treeFilter),d=r===t.lastSyncedSha?t.files:(await(0,Ft.getTree)(this.transport,e.owner,e.repo,(await(0,Ft.getCommitInfo)(this.transport,e.owner,e.repo,r,this.deps.baseURL)).treeSha,this.deps.baseURL)).filter(l.treeFilter),{changed:h,deleted:p}=U3(d,f);for(let y of h)s.has(y.path)&&c.push(`race-window: concurrent commit ${i} changed ${y.path} between conflict check (head ${r}) and push \u2014 local version won; previous version recoverable from git history`),o.has(y.path)&&c.push(`race-window: concurrent commit ${i} changed ${y.path} which this push DELETED \u2014 the delete won; the concurrent version is recoverable from git history`);for(let y of p)s.has(y.path)&&c.push(`race-window: concurrent commit ${i} deleted ${y.path}; push re-created it`)}catch(u){let f=this.deps.redact??(d=>d);c.push(`race-window check failed: ${f(cu(u))}`)}}async buildWatermarkFiles(e,t,r,i,s,o,c){if(c.fileMode)return t.map(f=>({path:f.path,blobSha:f.blobSha}));let l=new Map;for(let f of i)f.kind==="change"&&f.blobSha!==void 0&&l.set(f.blobSha,f.uid);for(let[f,d]of r){let h=o?.get(f)??await(0,dd.gitBlobSha)(d,this.deps.sha1);l.set(h,typeof d=="string"?(0,vc.extractAssetUid)(d):void 0)}for(let f of s.files)l.has(f.blobSha)||l.set(f.blobSha,f.uid);let u=[];for(let f of t){let d;if(l.has(f.blobSha))d=l.get(f.blobSha);else{let h=await(0,Ft.getBlobText)(this.transport,e.owner,e.repo,f.blobSha,this.deps.baseURL);d=(0,vc.extractAssetUid)(h)}u.push({path:f.path,blobSha:f.blobSha,...d?{uid:d}:{}})}return u}};Ls.SyncEngine=qE});var KE=w(HE=>{"use strict";Object.defineProperty(HE,"__esModule",{value:!0});HE.diff3=Zz;function G3(n,e){let t=n.length,r=e.length,i=Array.from({length:t+1},()=>new Int32Array(r+1));for(let l=t-1;l>=0;l--)for(let u=r-1;u>=0;u--)i[l][u]=n[l]===e[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);let s=new Map,o=0,c=0;for(;o<t&&c<r;)n[o]===e[c]?(s.set(o,c),o++,c++):i[o+1][c]>=i[o][c+1]?o++:c++;return s}a(G3,"lcsMatch");function zE(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}a(zE,"sliceEq");function Zz(n,e,t){let r=G3(n,e),i=G3(n,t),s=[],o=0,c=0,l=0;for(;;){let u=o;for(;u<n.length&&!(r.has(u)&&i.has(u));)u++;let f=u<n.length?r.get(u):e.length,d=u<n.length?i.get(u):t.length,h=n.slice(o,u),p=e.slice(c,f),y=t.slice(l,d),g=!zE(p,h),v=!zE(y,h);if(!g&&!v)s.push(...h);else if(!g)s.push(...y);else if(!v)s.push(...p);else if(zE(p,y))s.push(...p);else return{ok:!1,conflict:{base:h,local:p,remote:y}};if(u>=n.length)break;s.push(n[u]),o=u+1,c=f+1,l=d+1}return{ok:!0,merged:s}}a(Zz,"diff3")});var W3=w(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.StructuredMerger=void 0;md.splitSections=my;var q3=KE(),eH=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,hd="exo__Instance_class";function pd(n){if(n===null||typeof n!="object")return!0;if(Array.isArray(n))return n.every(pd);let e=Object.getPrototypeOf(n);return e!==Object.prototype&&e!==null?!1:Object.values(n).every(pd)}a(pd,"isPlainValue");function ha(n,e){if(n===e)return!0;if(n===null||e===null||n===void 0||e===void 0||typeof n!="object"||typeof e!="object"||Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)&&Array.isArray(e))return n.length!==e.length?!1:n.every((s,o)=>ha(s,e[o]));let t=n,r=e,i=Object.keys(t);return i.length!==Object.keys(r).length?!1:i.every(s=>ha(t[s],r[s]))}a(ha,"deepEqual");function Ec(n){return typeof n=="string"?`s:${n}`:`j:${JSON.stringify(n)}`}a(Ec,"setKey");function ui(n){return n==null?[]:Array.isArray(n)?n:[n]}a(ui,"toElements");function tH(n,e,t){let r=new Set(ui(n).map(Ec)),i=ui(e),s=ui(t),o=new Set(i.map(Ec)),c=new Set(s.map(Ec)),l=a(d=>o.has(d)&&c.has(d)||o.has(d)&&!r.has(d)||c.has(d)&&!r.has(d),"keep"),u=[],f=new Set;for(let d of[...i,...s]){let h=Ec(d);f.has(h)||!l(h)||(f.add(h),u.push(d))}return u}a(tH,"mergeSet");function rH(n,e,t){let r=[],i=[],s=new Set;for(let c of[...Object.keys(n),...Object.keys(e),...Object.keys(t)])s.has(c)||(s.add(c),i.push(c));let o={};for(let c of i){let l=n[c],u=e[c],f=t[c];if(!pd(l)||!pd(u)||!pd(f))return{ok:!1,reason:`frontmatter key "${c}" contains a non-plain value (Date?) \u2014 the codec must round-trip scalars as strings (CORE_SCHEMA contract)`};if(Array.isArray(l)||Array.isArray(u)||Array.isArray(f)){if(!(c in e)&&!(c in t))continue;let d=tH(l,u,f),h=new Set(ui(l).map(Ec)),p=ui(u).some(g=>!h.has(Ec(g))),y=ui(f).some(g=>!h.has(Ec(g)));p&&y&&!ha(ui(u),ui(f))&&r.push(`both sides added values to multi-valued key "${c}" \u2014 union kept (D20)`),d.length>0&&(o[c]=d);continue}if(ha(u,f)){u!==void 0&&(o[c]=u);continue}if(ha(u,l)){f!==void 0&&(o[c]=f);continue}if(ha(f,l)){u!==void 0&&(o[c]=u);continue}return{ok:!1,reason:`frontmatter key "${c}" changed differently on both sides`}}return{ok:!0,value:o,warnings:r}}a(rH,"mergeFrontmatter");var nH=/^(```|~~~)/,iH=/^#{1,6}\s/;function my(n){let e=n.split(`
464
464
  `),t=[],r=null,i="",s=!1,o=a(()=>{r!==null&&t.push({heading:i,text:r.join(`
465
465
  `)})},"flush");for(let c of e){if(nH.test(c.trimStart())&&(s=!s),!s&&iH.test(c)){o(),r=[c],i=c.trim();continue}r===null&&(r=[],i=""),r.push(c)}return o(),t}a(my,"splitSections");function QE(n){return n.split(/\n{2,}/)}a(QE,"splitParagraphs");function sH(n){return n.join(`
466
466
 
@@ -476,12 +476,12 @@ ${v}---
476
476
  ${y.body}`,warnings:g}}splitDoc(e){let t=eH.exec(e);if(!t)return{frontmatter:{},body:e};let r=e.slice(t[0].length);try{let i=this.codec.parse(t[1]);return i==null?{frontmatter:{},body:r}:typeof i!="object"||Array.isArray(i)?null:{frontmatter:i,body:r}}catch{return null}}};md.StructuredMerger=JE});var z3=w(gy=>{"use strict";Object.defineProperty(gy,"__esModule",{value:!0});gy.MergeShaclGate=void 0;var ZE=Zg(),aH="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function cH(n,e){let t=new Set;for(let r of n){if(r.subject.type!=="iri"||!("type"in r.predicate)||r.predicate.type!=="iri"||r.object.type!=="iri"||r.predicate.value!==e&&r.predicate.value!==aH)continue;t.add(r.subject.value);let i=(0,ZE.extractUidFromIRI)(r.subject.value);i&&t.add(`uid:${i}`)}return t}a(cH,"typedSubjects");var eT=class{static{a(this,"MergeShaclGate")}constructor(e){this.deps=e}async checkMergedAsset(e,t){let r=await this.deps.triplesFor(e,t),i=this.deps.contextTriples??[],s=[...r,...i],o=(0,ZE.validate)(s,this.deps.registry,this.deps.hierarchy),c=new Set;for(let h of r)h.subject.type==="iri"&&c.add(h.subject.value);let l=cH(s,this.deps.registry.typePredicateIRI),u=this.deps.isMountedRef??(h=>{if(l.has(h))return!0;let p=(0,ZE.extractUidFromIRI)(h);return p!==null&&l.has(`uid:${p}`)}),f=[],d=0;for(let h of o.violations)if(c.has(h.focusNode)){if(h.constraint==="class"){if(h.actualValue!==void 0&&!u(h.actualValue)){d++;continue}f.push(h);continue}h.severity==="sh:Violation"&&f.push(h)}return{ok:f.length===0,violations:f,skippedOpenWorld:d}}};gy.MergeShaclGate=eT});var H3=w(yy=>{"use strict";Object.defineProperty(yy,"__esModule",{value:!0});yy.GatedStructuredMerger=void 0;var tT=class{static{a(this,"GatedStructuredMerger")}constructor(e,t){this.merger=e,this.gate=t}async resolve(e){let t=this.merger.mergeAsset(e);if(t.status==="conflict")return{action:"quarantine",reason:t.reason};if(this.gate!==void 0){let r=await this.gate.checkMergedAsset(e.path,t.content);if(!r.ok)return{action:"quarantine",reason:`merged result is SHACL-invalid: ${r.violations.slice(0,3).map(s=>s.message).join("; ")}`}}return{action:"use-merged",content:t.content,warnings:t.warnings}}};yy.GatedStructuredMerger=tT});var K3=w(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.FileWatermarkStore=lu.WATERMARK_STORE_FILENAME=void 0;lu.WATERMARK_STORE_FILENAME="exosync-watermarks.local.json";function lH(n){if(n===null||typeof n!="object")return!1;let e=n;return typeof e.lastSyncedSha=="string"&&typeof e.rootTreeSha=="string"&&Array.isArray(e.files)}a(lH,"isWatermarkRecord");var rT=class{static{a(this,"FileWatermarkStore")}constructor(e){this.io=e,this.writeChain=Promise.resolve()}async get(e){let r=(await this.readRepos())[e];return lH(r)?r:null}async set(e,t){let r=this.writeChain.then(async()=>{let i=await this.readRepos();i[e]=t;let s={version:1,repos:i};await this.io.writeAtomic(JSON.stringify(s,null,2))});return this.writeChain=r.catch(()=>{}),r}async readRepos(){try{let e=await this.io.read();if(e===null)return{};let t=JSON.parse(e);if(t===null||typeof t!="object")return{};let r=t.repos;return r===null||typeof r!="object"?{}:{...r}}catch{return{}}}};lu.FileWatermarkStore=rT});var Y3=w(_y=>{"use strict";Object.defineProperty(_y,"__esModule",{value:!0});_y.SyncedQuarantineStore=void 0;var uH=sy(),gd=fd(),fH=WE(),by=uy(),dH=il(),Q3="entries/",hH=80;function nT(n){return n.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,hH)}a(nT,"slug");function X3(n){try{let e=JSON.parse(n);if(e===null||typeof e!="object")return null;let t=e;return typeof t.repoKey!="string"||typeof t.path!="string"||typeof t.reason!="string"||t.status!=="open"&&t.status!=="resolved"?null:e}catch{return null}}a(X3,"parseRecord");var iT=class{static{a(this,"SyncedQuarantineStore")}constructor(e){this.deps=e}async quarantine(e){await this.quarantineAll([e])}async quarantineAll(e){if(e.length===0)return;let t=await Promise.all(e.map(o=>this.entryPath(o.repoKey,o.path))),r=await this.readEntries(t),i=new Map,s=0;for(let o=0;o<e.length;o++){let c=e[o],l=t[o],u=r.get(l)??null,f=u!==null&&u.status==="open"?u.quarantinedAt:(this.deps.now??(()=>new Date().toISOString()))(),d,h;if(c.localContentBytes!==void 0){let g=l.replace(/\.json$/,""),v=c.path.lastIndexOf("."),_=v>0&&v<c.path.length-1?c.path.slice(v+1):"bin";d=`${g}.conflict.${nT(_)}`,h=await this.gitBlobShaOf(c.localContentBytes)}let p={version:1,repoKey:c.repoKey,path:c.path,...c.uid!==void 0?{uid:c.uid}:{},reason:(0,by.redactSecrets)(c.reason),status:"open",quarantinedAt:f,...c.baseContent!==void 0?{baseContent:(0,by.redactSecrets)(c.baseContent)}:{},...c.localContent!==void 0?{localContent:(0,by.redactSecrets)(c.localContent)}:{},...c.remoteContent!==void 0?{remoteContent:(0,by.redactSecrets)(c.remoteContent)}:{},...d!==void 0?{conflictCopyPath:d}:{},...h!==void 0?{localContentSha:h}:{}},y=JSON.stringify(p,null,2);u!==null&&JSON.stringify(u,null,2)===y||(i.set(l,y),s++,d!==void 0&&c.localContentBytes!==void 0&&i.set(d,{base64:(0,dH.bytesToBase64)(c.localContentBytes)}))}i.size!==0&&await this.push(i,`chore(exosync): quarantine ${s} conflict entr${s===1?"y":"ies"} (D17)`)}async gitBlobShaOf(e){let t=new TextEncoder().encode(`blob ${e.byteLength}\0`),r=new Uint8Array(t.byteLength+e.byteLength);return r.set(t,0),r.set(e,t.byteLength),this.deps.sha1(r)}async markResolved(e,t){let r=await this.entryPath(e,t),i=(await this.readEntries([r])).get(r);if(i==null||i.status==="resolved")return;let s={...i,status:"resolved",resolvedAt:(this.deps.now??(()=>new Date().toISOString()))()};await this.push(new Map([[r,JSON.stringify(s,null,2)]]),`chore(exosync): resolve quarantine entry for ${t}`)}async listOpen(){let e=await this.headTree();if(e===null)return[];let t=[];for(let r of e){if(!r.path.startsWith(Q3)||!r.path.endsWith(".json"))continue;let i=X3(await(0,gd.getBlobText)(this.deps.transport,this.deps.owner,this.deps.repo,r.blobSha,this.deps.baseURL));i===null||i.status!=="open"||t.push({entryPath:r.path,repoKey:i.repoKey,path:i.path,...i.uid!==void 0?{uid:i.uid}:{},reason:i.reason,quarantinedAt:i.quarantinedAt,...i.conflictCopyPath!==void 0?{conflictCopyPath:i.conflictCopyPath}:{}})}return t}async unresolvedCount(){return(await this.listOpen()).length}async entryPath(e,t){let r=(await this.deps.sha1(new TextEncoder().encode(`${e}\0${t}`))).slice(0,8);return`${Q3}${nT(e)}/${nT(t)}-${r}.json`}async headTree(){let{transport:e,owner:t,repo:r,branch:i,baseURL:s}=this.deps,o;try{o=await(0,gd.getHeadSha)(e,t,r,i,s)}catch(l){let u=l instanceof Error?l.message:String(l);if(/HTTP 404/.test(u))return null;throw l}let c=await(0,gd.getCommitInfo)(e,t,r,o,s);return(0,gd.getTree)(e,t,r,c.treeSha,s)}async readEntries(e){let t=new Map,r=await this.headTreeOrThrowInitHint(),i=new Map(r.map(s=>[s.path,s.blobSha]));for(let s of e){let o=i.get(s);if(o===void 0){t.set(s,null);continue}t.set(s,X3(await(0,gd.getBlobText)(this.deps.transport,this.deps.owner,this.deps.repo,o,this.deps.baseURL)))}return t}async headTreeOrThrowInitHint(){let e=await this.headTree();if(e===null)throw new Error(`SyncedQuarantineStore: branch ${this.deps.branch} not found on ${this.deps.owner}/${this.deps.repo} \u2014 initialize the quarantine repo (one initial commit) before syncing`);return e}async push(e,t){let r=this.deps.maxPushRetries??3,i=0;for(;;)try{await(0,uH.restCreateCommit)(this.deps.transport,{owner:this.deps.owner,repo:this.deps.repo,branch:this.deps.branch,files:e,message:t,...this.deps.baseURL!==void 0?{baseURL:this.deps.baseURL}:{},...this.deps.redact!==void 0?{redact:this.deps.redact}:{}});return}catch(s){if(i++,!(0,fH.isNonFastForwardError)(s)||i>r)throw s}}};_y.SyncedQuarantineStore=iT});var iO=w(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.SpaceSpecAccumulator=Zr.SYNC_BRANCH=Zr.ASSET_SPACE_CLASS_UID=void 0;Zr.isAssetSpaceFrontmatter=eO;Zr.isFileSpaceFrontmatter=tO;Zr.readSpaceSource=rO;Zr.parseStrictGitHubRepoURL=nO;Zr.classifySpaceDeclaration=yH;var pH=wg(),mH=Sg();Zr.ASSET_SPACE_CLASS_UID="73bd00e4-ccc0-4f3f-b20d-c4388c4588fb";Zr.SYNC_BRANCH="main";var J3=/\[\[([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\|[^\]]*)?\]\]/gi;function Z3(n,e){let t=n.exo__Instance_class,r=Array.isArray(t)?t:[t];for(let i of r){if(typeof i!="string")continue;J3.lastIndex=0;let s;for(;(s=J3.exec(i))!==null;)if(s[1].toLowerCase()===e)return!0}return!1}a(Z3,"instanceClassHasUid");function eO(n){return Z3(n,Zr.ASSET_SPACE_CLASS_UID)}a(eO,"isAssetSpaceFrontmatter");function tO(n){return Z3(n,pH.FILE_SPACE_CLASS_UID)}a(tO,"isFileSpaceFrontmatter");function rO(n){let e=n.exo__AssetSpace_source;if(typeof e=="string"&&e.length>0)return e;let t=n.exo__AssetSpace_git;return typeof t=="string"&&t.length>0?t:null}a(rO,"readSpaceSource");var gH=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/;function nO(n){if(typeof n!="string"||n.length===0||n.length>256||!gH.test(n))return null;let e=n.slice(19),[t,r,...i]=e.split("/");if(i.length>0||t===".."||r===".."||r.startsWith("."))return null;let s=r.replace(/\.git$/,"");return s.length===0?null:{owner:t,repo:s}}a(nO,"parseStrictGitHubRepoURL");function yH(n,e){let t=eO(n),r=tO(n);if(!t&&!r)return{kind:"not-space"};let i;t&&r&&(i=`declaration at ${e} carries BOTH exo__AssetSpace and exo__FileSpace classes (disjoint) \u2014 treating as AssetSpace (conservative)`);let s=t?"asset":"file",o=rO(n);if(o===null)return s==="file"?{kind:"skip",warning:`skipped FileSpace at ${e}: no exo__AssetSpace_source/_git \u2014 mount path underivable`}:{kind:"skip"};let c=o.replace(/\.git$/i,""),l=nO(c);if(l===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: source is not a plain https://github.com/<owner>/<repo> URL`};let u=(0,mH.derivePath)(c);if(u===null)return{kind:"skip",warning:`skipped AssetSpace at ${e}: cannot derive mount path from source`};let f=`${l.owner}/${l.repo}#${Zr.SYNC_BRANCH}`,d=n.exo__Asset_uid,h=typeof d=="string"&&d.trim().length>0?d.trim():void 0;return{kind:"candidate",candidate:{spec:{owner:l.owner,repo:l.repo,branch:Zr.SYNC_BRANCH,repoKey:f,localPath:u,...s==="file"?{spaceKind:s}:{}},spaceKind:s,...h!==void 0?{asUid:h}:{}},...i!==void 0?{warning:i}:{}}}a(yH,"classifySpaceDeclaration");var sT=class{static{a(this,"SpaceSpecAccumulator")}constructor(){this.specs=[],this.warnings=[],this.asUidByRepoKey=new Map,this.seen=new Set,this.kindByRepoKey=new Map}offer(e){let{spec:t,spaceKind:r}=e;if(this.seen.has(t.repoKey)){let i=this.kindByRepoKey.get(t.repoKey);if(i!==void 0&&i!==r&&(this.warnings.push(`repo ${t.repoKey} is declared as BOTH AssetSpace and FileSpace by different assets \u2014 treating as AssetSpace (deterministic, conservative); fix the vault (disjoint subtypes)`),i==="file")){this.kindByRepoKey.set(t.repoKey,"asset");let s=this.specs.find(o=>o.repoKey===t.repoKey);s!==void 0&&delete s.spaceKind}return null}return this.seen.add(t.repoKey),this.kindByRepoKey.set(t.repoKey,r),t}commit(e){this.specs.push(e.spec),e.asUid!==void 0&&this.asUidByRepoKey.set(e.spec.repoKey,e.asUid)}};Zr.SpaceSpecAccumulator=sT});var oT=w(wy=>{"use strict";Object.defineProperty(wy,"__esModule",{value:!0});wy.isFormatOnlyDrift=bH;wy.compareAssetSemantics=SH;function bH(n){return n.frontmatterEqual&&n.bodyEqual}a(bH,"isFormatOnlyDrift");var _H=/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/;function sO(n){let e=_H.exec(n);return e?{fm:e[1],body:n.slice(e[0].length)}:{fm:null,body:n}}a(sO,"splitDoc");function Sy(n){if(Array.isArray(n))return`[${n.map(Sy).sort().join(",")}]`;if(n!==null&&typeof n=="object"){let e=n;return`{${Object.keys(e).sort().map(r=>`${JSON.stringify(r)}:${Sy(e[r])}`).join(",")}}`}return JSON.stringify(n)??"undefined"}a(Sy,"canonicalise");function oO(n){return n.replace(/\r\n/g,`
477
477
  `).replace(/\s+$/,"")}a(oO,"normaliseBody");function SH(n,e,t){let r=sO(n),i=sO(e),s;if(r.fm===null&&i.fm===null)s=!0;else if(r.fm===null||i.fm===null)s=!1;else try{s=Sy(t.parse(r.fm))===Sy(t.parse(i.fm))}catch{s=!1}return{frontmatterEqual:s,bodyEqual:oO(r.body)===oO(i.body)}}a(SH,"compareAssetSemantics")});var uO=w(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});bd.ParityValidator=void 0;bd.summarizeParityRound=xH;var yd=fd(),aO=ld(),wH=cy(),vH=dy(),uu=hy(),cO=oT(),EH=50,TH=200,lO=new Set(["pending-local-edit","pending-remote-add","pending-remote-edit","pending-remote-delete","deferred-local-delete","pending-conflict","unverified-divergence"]),AH=new Set(["quarantine-pinned","format-only-drift"]);function pa(n){return n instanceof Error?n.message:String(n)}a(pa,"errMsg");function IH(n){return/HTTP 404/.test(pa(n))}a(IH,"isNotFoundError");var aT=class{static{a(this,"ParityValidator")}constructor(e){this.deps=e,this.transport=(0,vH.withRateLimitBackoff)(e.transport,e.backoff)}async captureSnapshot(e){let t=new Map,r=[],i=this.deps.redact??(s=>s);for(let s of e)try{let o=await this.deps.watermarks.get(s.repoKey);if(o===null)continue;let c=new Map(o.files.map(f=>[f.path,f.blobSha])),l=await this.readLocalSnapshot(s,s.spaceKind==="file"),u=new Map;for(let[f,d]of l.shas)c.get(f)!==d&&u.set(f,d);u.size>0&&t.set(s.repoKey,u)}catch(o){r.push(`${s.repoKey}: conservation snapshot failed (${i(pa(o))}) \u2014 no coverage this round`)}return{dirtyByRepo:t,warnings:r}}async runRound(e,t){let r=this.deps.now??(()=>new Date().toISOString()),i=this.deps.maxSemanticFetchesPerRun??TH,s=[];for(let u of e){let f=await this.checkRepo(u,t,{take:a(d=>i<d?!1:(i-=d,!0),"take")});s.push(f)}t.previousRound!=null&&t.trigger==="post-sync"&&this.escalatePersistentDivergence(s,t.previousRound,t.syncResults);let o=s.filter(u=>u.status==="checked").length,c=s.reduce((u,f)=>u+f.m1Violations.length,0),l=s.reduce((u,f)=>u+(f.status==="checked"?f.m2SemanticDiffs:0),0);return{version:1,ts:r(),trigger:t.trigger,repos:s,checkedRepos:o,m1Total:c,m2Total:l,ok:c===0&&l===0&&o>0,vacuous:o===0}}async checkRepo(e,t,r){let i=[],s=this.deps.redact??(l=>l),o=a((l,u={})=>({repoKey:e.repoKey,status:l,filesChecked:0,inParity:0,discrepancies:[],m2SemanticDiffs:0,accountedCount:0,m1Violations:[],warnings:i,...u}),"report"),c=t.syncResults?.find(l=>l.repoKey===e.repoKey);if(c?.warnings.some(l=>l.startsWith("race-window")))return o("inconclusive",{detail:"sync hit its race window (watermark not advanced) \u2014 parity deferred to the next round"});if(c?.status==="skipped-not-materialized")return o("inconclusive",{detail:"repo not fully materialized (D19) \u2014 local absence is not divergence; parity deferred to the next round"});try{let l=e.spaceKind==="file",u=await(0,yd.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL),f=await(0,yd.getCommitInfo)(this.transport,e.owner,e.repo,u,this.deps.baseURL),d=await(0,yd.getTree)(this.transport,e.owner,e.repo,f.treeSha,this.deps.baseURL),h=this.deps.maxFileBytes??uu.DEFAULT_MAX_FILE_BYTES,p=l?uu.isFileSpaceSyncablePath:uu.isSyncablePath,y=new Map;for(let k of d)if(p(k.path)){if(k.size!==void 0&&k.size>h){i.push(`remote ${k.path} exceeds the ${h}-byte cap \u2014 excluded symmetrically`);continue}y.set(k.path,k)}let g=await this.readLocalSnapshot(e,l);i.push(...g.warnings);let v=await this.deps.watermarks.get(e.repoKey);if(v===null){let k=0;for(let[G,B]of g.shas)y.get(G)?.blobSha===B&&k++;let H=new Set([...g.shas.keys(),...y.keys()]);return o("no-watermark",{filesChecked:H.size,inParity:k,headSha:u,detail:`repo has no sync watermark on this device (${H.size-k} raw diff(s)) \u2014 run a sync first; not counted toward M1/M2`})}let _=new Map(v.files.map(k=>[k.path,k.blobSha])),S=new Set(v.pinnedPaths??[]),{discrepancies:T,inParity:I,filesChecked:A}=await this.classifyAll(e,g,y,_,S,l,{warnings:i,runBudget:r}),R=await(0,yd.getHeadSha)(this.transport,e.owner,e.repo,e.branch,this.deps.baseURL);if(R!==u)return o("inconclusive",{headSha:u,detail:`remote head moved during the check (${u.slice(0,7)} \u2192 ${R.slice(0,7)}) \u2014 parity deferred to the next round`});let q=this.checkConservation(e,t,g,y,S,c),Y=T.filter(k=>!AH.has(k.cls)).length,C=T.length-Y,O;if(l){let k=[...g.shas.values()].sort().join(`
478
478
  `),H=[...y.values()].map(G=>G.blobSha).sort().join(`
479
- `);O=k===H}return o("checked",{filesChecked:A,inParity:I,discrepancies:T,m2SemanticDiffs:Y,accountedCount:C,m1Violations:q,headSha:u,...O!==void 0?{attachmentHashSetIdentical:O}:{}})}catch(l){return(0,wH.isAuthError)(l)?o("auth-required",{detail:s(`authentication failed: ${pa(l)} \u2014 the PAT is expired, revoked or under-scoped; update it (R8)`)}):IH(l)?(i.push("repo unreachable (HTTP 404): dead AssetSpace pointer, or the fine-grained PAT does not allowlist this repo \u2014 skipped"),o("error",{detail:s(pa(l))})):(i.push(`parity check failed: ${s(pa(l))}`),o("error",{detail:s(pa(l))}))}}async readLocalSnapshot(e,t){let r=this.deps.localFilesFor(e),i=t?uu.isFileSpaceSyncablePath:uu.isSyncablePath,s=this.deps.maxFileBytes??uu.DEFAULT_MAX_FILE_BYTES,o=new Map,c=new Map,l=[];if(t&&r.readBinary===void 0)throw new Error("file-mode repo requires a LocalFilesPort with readBinary \u2014 refusing to hash through the text-only port (binary would corrupt)");let u=new TextEncoder;for(let f of await r.list())if(i(f))try{if(t){let d=await r.readBinary(f);if(d.byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}o.set(f,await(0,aO.gitBlobSha)(d,this.deps.sha1))}else{let d=await r.read(f);if(u.encode(d).byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}c.set(f,d),o.set(f,await(0,aO.gitBlobSha)(d,this.deps.sha1))}}catch(d){let h=this.deps.redact??(p=>p);l.push(`local ${f} unreadable (${h(pa(d))}) \u2014 skipped`)}return{shas:o,texts:c,warnings:l}}async classifyAll(e,t,r,i,s,o,c){let l=[],u=0,f=this.deps.maxSemanticFetchesPerRepo??EH,d=new Set([...t.shas.keys(),...r.keys()]);for(let h of[...d].sort()){let p=t.shas.get(h),g=r.get(h)?.blobSha,v=i.get(h);if(p!==void 0&&g!==void 0){if(p===g){u++;continue}l.push(await this.classifyContentDiff(e,h,p,g,v,s,o,t,{...c,takeRepoFetch:a(()=>f-- >0,"takeRepoFetch")}));continue}if(p!==void 0){let _;s.has(h)?_={path:h,presence:"local-only",cls:"quarantine-pinned",localSha:p}:v===void 0?_={path:h,presence:"local-only",cls:"pending-local-add",localSha:p}:v===p?_={path:h,presence:"local-only",cls:"pending-remote-delete",localSha:p,detail:"remote deleted it; the local copy is unchanged"}:_={path:h,presence:"local-only",cls:"pending-conflict",localSha:p,detail:"remote deleted it AND the local copy was edited"},l.push(_);continue}if(g!==void 0){let _;s.has(h)?_={path:h,presence:"remote-only",cls:"quarantine-pinned",remoteSha:g}:v===void 0?_={path:h,presence:"remote-only",cls:"pending-remote-add",remoteSha:g}:v===g?_={path:h,presence:"remote-only",cls:"deferred-local-delete",remoteSha:g,detail:"locally deleted; the delete propagates on the next sync (#3476) \u2014 escalates if it survives a converged round"}:_={path:h,presence:"remote-only",cls:"pending-conflict",remoteSha:g,detail:"locally deleted AND the remote copy was edited"},l.push(_)}}return{discrepancies:l,inParity:u,filesChecked:d.size}}async classifyContentDiff(e,t,r,i,s,o,c,l,u){let f={localSha:r,remoteSha:i};if(o.has(t))return{path:t,presence:"both",cls:"quarantine-pinned",...f};if(s!==void 0&&s===r)return{path:t,presence:"both",cls:"pending-remote-edit",...f};if(s!==void 0&&s===i)return{path:t,presence:"both",cls:"pending-local-edit",...f};if(c)return{path:t,presence:"both",cls:"pending-conflict",...f,detail:"binary content differs on both sides"};if(!u.takeRepoFetch()||!u.runBudget.take(1))return u.warnings.push(`semantic-fetch cap reached \u2014 ${t} left unverified (counted into M2)`),{path:t,presence:"both",cls:"unverified-divergence",...f};let d=l.texts.get(t),h;try{h=await(0,yd.getBlobText)(this.transport,e.owner,e.repo,i,this.deps.baseURL)}catch(y){let g=this.deps.redact??(v=>v);return u.warnings.push(`blob fetch for ${t} failed (${g(pa(y))}) \u2014 left unverified`),{path:t,presence:"both",cls:"unverified-divergence",...f}}let p=(0,cO.compareAssetSemantics)(d??"",h,this.deps.yaml);return(0,cO.isFormatOnlyDrift)(p)?{path:t,presence:"both",cls:"format-only-drift",...f,frontmatterEqual:!0,bodyEqual:!0}:{path:t,presence:"both",cls:"pending-conflict",...f,frontmatterEqual:p.frontmatterEqual,bodyEqual:p.bodyEqual,detail:`semantic divergence (frontmatter ${p.frontmatterEqual?"equal":"differs"}, body ${p.bodyEqual?"equal":"differs"})`}}checkConservation(e,t,r,i,s,o){let c=t.snapshot?.dirtyByRepo.get(e.repoKey);if(c===void 0||c.size===0)return[];let l=new Set(o?.mergedPaths??[]),u=new Set(o?.quarantinedPaths??[]),f=[];for(let[d,h]of c)r.shas.get(d)!==h&&i.get(d)?.blobSha!==h&&(l.has(d)||u.has(d)||s.has(d)||f.push({repoKey:e.repoKey,path:d,kind:"conservation",detail:`pre-sync dirty content ${h.slice(0,7)} survived NOWHERE: disk now ${r.shas.get(d)?.slice(0,7)??"absent"}, not in head tree, not merged/quarantined/pinned \u2014 possible lost edit`}));return f}escalatePersistentDivergence(e,t,r){for(let i of e){if(i.status!=="checked")continue;let s=r?.find(u=>u.repoKey===i.repoKey);if(s!==void 0&&s.status!=="synced")continue;let o=new Set(s?.deferredDeletes??[]),c=t.repos.find(u=>u.repoKey===i.repoKey&&u.status==="checked");if(c===void 0)continue;let l=new Map(c.discrepancies.filter(u=>lO.has(u.cls)).map(u=>[u.path,u]));for(let u of i.discrepancies){if(!lO.has(u.cls)||u.cls==="deferred-local-delete"&&o.has(u.path))continue;let f=l.get(u.path);f!==void 0&&f.localSha===u.localSha&&f.remoteSha===u.remoteSha&&i.m1Violations.push({repoKey:i.repoKey,path:u.path,kind:"persistent-divergence",detail:`identical divergence (local ${u.localSha?.slice(0,7)??"absent"}, remote ${u.remoteSha?.slice(0,7)??"absent"}) survived a sync round unchanged (${f.cls} \u2192 ${u.cls}) \u2014 the engine failed to converge it`})}}}};bd.ParityValidator=aT;function xH(n){if(n.vacuous)return`ExoSync parity: VACUOUS \u2014 0 of ${n.repos.length} repo(s) checked (errors / never synced)`;let e=n.repos.length-n.checkedRepos,t=e>0?`, ${e} skipped`:"";return n.ok?`ExoSync parity: M1=0, M2=\u2205 (${n.checkedRepos} repo(s) checked${t})`:`ExoSync parity: M1=${n.m1Total}, M2=${n.m2Total} diff(s) (${n.checkedRepos} repo(s) checked${t}) \u2014 see log`}a(xH,"summarizeParityRound")});var tt=w(m=>{"use strict";var RH=m&&m.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),fi=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&RH(e,n,t)};Object.defineProperty(m,"__esModule",{value:!0});m.iriToObsidianName=m.NamedQueryRunner=m.createVaultFrontmatterClassLabelResolver=m.ServiceRegistry=m.GroundingExecutor=m.registerDefaultHostFunctions=m.hasUidFilename=m.hasNonUidFilename=m.PreconditionEvaluator=m.CommandResolver=m.extractPropertyLabel=m.uriToPropertyName=m.propertyNameToUri=m.rangeToFieldType=m.PropertyFieldType=m.transitiveDependsOnClosure=m.assertTsFloorReconciled=m.assertTsFloor=m.TsFloorViolationError=m.CATALOG_KEEP_NAMESPACES=m.PLUGIN_UI_FLOOR=m.SDK_FLOOR=m.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=m.SDK_FLOOR_ASSETSPACE_UIDS=m.TS_FLOOR_AS_UID_SHARED_IDENTITIES=m.TS_FLOOR_AS_UID_EXOCMD=m.TS_FLOOR_AS_UID_EXO=m.parseGroundingDefinitionFromFrontmatter=m.isCommandBindingFrontmatter=m.isGroundingFrontmatter=m.isPreconditionFrontmatter=m.isCommandFrontmatter=m.isStyleSource=m.isLabelClass=m.isCommandVariant=m.STYLE_SOURCE_VALUES=m.LABEL_CLASS_VALUES=m.COMMAND_VARIANT_VALUES=m.CommandBindingStyleProperty=m.CommandBindingProperty=m.GroundingProperty=m.PreconditionProperty=m.CommandProperty=m.resolveGroundingTypeFromWikilinkLiteral=m.resolveGroundingTypeFromIRI=m.GROUNDING_TYPE_IRI_TO_ENUM=m.GROUNDING_TYPE_UID_TO_ENUM=m.GROUNDING_TYPE_UIDS=m.GroundingType=m.EFFORT_STATUS_OPTIONS=void 0;m.findClassByTerm=m.KNOWN_CLASSES=m.KNOWN_PROTOTYPES=m.EFFORT_STATUSES=m.ASSET_CLASSES=m.PREDICATES=m.SPARQL_PREFIXES=m.SPARQL_TEMPLATES=m.DEFAULT_NL_TO_SPARQL_CONFIG=m.NLToSPARQLService=m.TypeRegistry=m.GraphQueryService=m.FixMissingLabelService=m.ArchiveAssetService=m.GenericAssetCreationService=m.URIConstructionService=m.SessionEventService=m.AssetConversionService=m.EnumValueResolver=m.ClassHierarchyResolver=m.PropertySchemaResolver=m.PlanningService=m.AlgorithmExtractor=m.orderProperties=m.loadDefaultSpec=m.clearOrderSpecLoader=m.registerOrderSpecLoader=m.DynamicFrontmatterGenerator=m.SupervisionCreationService=m.StatusTimestampService=m.RenameToUidService=m.PropertyCleanupService=m.LoggingService=m.extractAssetReference=m.FolderRepairService=m.EffortVotingService=m.WorkflowCommandAdapter=m.VisibilityGenerator=m.InstantiationRuleResolver=m.WorkflowResolver=m.WorkflowEngine=m.EffortStatusWorkflow=m.ConceptCreationService=m.ClassCreationService=m.AreaHierarchyBuilder=m.AreaCreationService=m.TaskStatusService=m.CommandExecutionFlow=m.stripFrontmatter=m.extractSparqlBlock=void 0;m.AlgebraOptimizer=m.AlgebraTranslator=m.ExoQLAlgebraTranslator=m.DescribeOptionsTransformerError=m.DescribeOptionsTransformer=m.SPARQLParseError=m.SPARQLParser=m.ExoQLParser=m.isPathExcluded=m.normaliseExcludedFolders=m.NoteToRDFConverter=m.SOURCE_VARIABLE=m.SourceAnnotator=m.MAX_LAZY_DEPTH=m.LazyAssetGraphLoader=m.FILE_SPACE_CLASS_UID=m.frontmatterDeclaresFileSpace=m.discoverFileSpaceExclusions=m.deriveLegacyFlatPath=m.derivePath=m.IRICanonicalizer=m.INFERRED_GRAPH=m.PrototypeChainMaterializer=m.PropertyCardinalityRegistry=m.NonInheritablePropertyRegistry=m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.DomainTriple=m.DomainBlankNode=m.DomainLiteral=m.DomainIRI=m.InMemoryTripleStore=m.OBSIDIAN_VAULT_SCHEME=m.iriToVaultPath=m.vaultPathToIRI=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.getTemplateByName=m.validateParameters=m.fillTemplate=m.findMatchingTemplates=void 0;m.DI_TOKENS=m.DEFAULT_FLEETING_NOTE_CLASS_UID=m.DEFAULT_INBOX_FOLDER=m.DEFAULT_OWNER_IDENTITY=m.VaultSettings=m.seededUidGenerator=m.liveUidGenerator=m.frozenClock=m.liveClock=m.TransactionError=m.TripleNotFoundError=m.TripleAlreadyExistsError=m.FileAlreadyExistsError=m.FileNotFoundError=m.FilterContainsOptimizer=m.VaultPrefixTransformer=m.CaseWhenTransformerError=m.CaseWhenTransformer=m.ResultSerializer=m.createIncrementalIndexer=m.IncrementalIndexer=m.createSPARQLResultCache=m.SPARQLResultCache=m.QueryPlanCache=m.createDoubleLiteral=m.createDecimalLiteral=m.getNumericValue=m.createPercentileAggregate=m.modeAggregate=m.stddevAggregate=m.varianceAggregate=m.medianAggregate=m.EXO_AGGREGATE_NS=m.BUILT_IN_AGGREGATES=m.CustomAggregateError=m.CustomAggregateRegistry=m.AggregateFunctions=m.BuiltInFunctions=m.SolutionMapping=m.UpdateExecutorError=m.UpdateExecutor=m.QueryExecutor=m.ExoQLQueryExecutor=m.DescribeExecutor=m.ConstructExecutor=m.UnionExecutor=m.OptionalExecutor=m.FilterExecutor=m.BGPExecutor=m.AlgebraSerializer=void 0;m.escapeGitmodulesRegex=m.stripGitmodulesEntry=m.appendGitmodulesEntry=m.extractAssetSpaceSha=m.discoverAssetSpaceWrapperDir=m.mountAssetSpaceFiles=m.isBinaryPayload=m.restCreateCommit=m.parseTarballGzip=m.parseTarball=m.TripleClassHierarchy=m.IDLE_TIMEOUT_MS=m.DEFAULT_SOCKET_PATH=m.ValidatorDaemon=m.ShaclShapeRegistry=m.shaclValidate=m.Namespace=m.ShapeRegistry=m.ShapeLoader=m.selectByPriority=m.LayoutSelector=m.isPropertiesBlock=m.isLayoutBlockFrontmatter=m.isBacklinksTableBlock=m.createLayoutBlockFromFrontmatter=m.PROPERTIES_BLOCK_CLASS_UID=m.PROPERTIES_BLOCK_CLASS_IRI=m.BACKLINKS_TABLE_BLOCK_CLASS_UID=m.BACKLINKS_TABLE_BLOCK_CLASS_IRI=m.isLayoutFrontmatter=m.isLayout=m.createLayoutFromFrontmatter=m.LAYOUT_CLASS_UID=m.LAYOUT_CLASS_IRI=m.ExoQLError=m.ExoQL=m.createStreamingSource=m.StreamingLoader=m.resetGlobalPool=m.getGlobalPool=m.MemoryPool=m.CompactGraphStore=m.StringTable=m.DEFAULT_COLORS=m.NODE_FLAGS=m.container=m.resetContainer=m.getContainer=m.createChildContainer=m.registerCoreServices=void 0;m.isFormatOnlyDrift=m.compareAssetSemantics=m.summarizeParityRound=m.ParityValidator=m.readSpaceSource=m.parseStrictGitHubRepoURL=m.isFileSpaceFrontmatter=m.isAssetSpaceFrontmatter=m.classifySpaceDeclaration=m.SpaceSpecAccumulator=m.SYNC_BRANCH=m.ASSET_SPACE_CLASS_UID=m.SyncedQuarantineStore=m.scanForSecrets=m.redactSecrets=m.withRateLimitBackoff=m.isRateLimitError=m.isAuthError=m.WATERMARK_STORE_FILENAME=m.FileWatermarkStore=m.GatedStructuredMerger=m.MergeShaclGate=m.splitSections=m.StructuredMerger=m.diff3=m.isSyncablePath=m.isFileSpaceSyncablePath=m.contentEquals=m.InMemoryQuarantineStore=m.DEFAULT_MAX_FILE_BYTES=m.orderChildrenFirst=m.isNonFastForwardError=m.SyncEngine=m.DEFAULT_MAX_PUSH_RETRIES=m.getTree=m.getHeadSha=m.getCommitInfo=m.getBlobText=m.getBlobBytes=m.gitBlobSha=m.extractAssetUid=m.detectChanges=void 0;fi(Jc(),m);fi(Zc(),m);var PH=$b();Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return PH.EFFORT_STATUS_OPTIONS},"get")});var CH=Vo();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:a(function(){return CH.GroundingType},"get")});var _d=pf();Object.defineProperty(m,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return _d.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(m,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return _d.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(m,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return _d.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(m,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return _d.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(m,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return _d.resolveGroundingTypeFromWikilinkLiteral},"get")});var Sd=Ub();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:a(function(){return Sd.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:a(function(){return Sd.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:a(function(){return Sd.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:a(function(){return Sd.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:a(function(){return Sd.CommandBindingStyleProperty},"get")});var fu=Bb();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:a(function(){return fu.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:a(function(){return fu.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:a(function(){return fu.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:a(function(){return fu.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:a(function(){return fu.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:a(function(){return fu.isStyleSource},"get")});var vy=TI();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:a(function(){return vy.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:a(function(){return vy.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:a(function(){return vy.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:a(function(){return vy.isCommandBindingFrontmatter},"get")});var OH=II();Object.defineProperty(m,"parseGroundingDefinitionFromFrontmatter",{enumerable:!0,get:a(function(){return OH.parseGroundingDefinitionFromFrontmatter},"get")});fi(xI(),m);fi(RI(),m);fi(Gb(),m);fi(qb(),m);fi(CI(),m);fi(FI(),m);fi(A_(),m);fi(dx(),m);var Yi=hx();Object.defineProperty(m,"TS_FLOOR_AS_UID_EXO",{enumerable:!0,get:a(function(){return Yi.TS_FLOOR_AS_UID_EXO},"get")});Object.defineProperty(m,"TS_FLOOR_AS_UID_EXOCMD",{enumerable:!0,get:a(function(){return Yi.TS_FLOOR_AS_UID_EXOCMD},"get")});Object.defineProperty(m,"TS_FLOOR_AS_UID_SHARED_IDENTITIES",{enumerable:!0,get:a(function(){return Yi.TS_FLOOR_AS_UID_SHARED_IDENTITIES},"get")});Object.defineProperty(m,"SDK_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Yi.SDK_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(m,"PLUGIN_UI_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Yi.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(m,"SDK_FLOOR",{enumerable:!0,get:a(function(){return Yi.SDK_FLOOR},"get")});Object.defineProperty(m,"PLUGIN_UI_FLOOR",{enumerable:!0,get:a(function(){return Yi.PLUGIN_UI_FLOOR},"get")});Object.defineProperty(m,"CATALOG_KEEP_NAMESPACES",{enumerable:!0,get:a(function(){return Yi.CATALOG_KEEP_NAMESPACES},"get")});Object.defineProperty(m,"TsFloorViolationError",{enumerable:!0,get:a(function(){return Yi.TsFloorViolationError},"get")});Object.defineProperty(m,"assertTsFloor",{enumerable:!0,get:a(function(){return Yi.assertTsFloor},"get")});Object.defineProperty(m,"assertTsFloorReconciled",{enumerable:!0,get:a(function(){return Yi.assertTsFloorReconciled},"get")});var DH=px();Object.defineProperty(m,"transitiveDependsOnClosure",{enumerable:!0,get:a(function(){return DH.transitiveDependsOnClosure},"get")});var fO=lp();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:a(function(){return fO.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:a(function(){return fO.rangeToFieldType},"get")});var cT=P_();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:a(function(){return cT.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:a(function(){return cT.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:a(function(){return cT.extractPropertyLabel},"get")});var FH=tP();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:a(function(){return FH.CommandResolver},"get")});var LH=nP();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:a(function(){return LH.PreconditionEvaluator},"get")});var lT=iP();Object.defineProperty(m,"hasNonUidFilename",{enumerable:!0,get:a(function(){return lT.hasNonUidFilename},"get")});Object.defineProperty(m,"hasUidFilename",{enumerable:!0,get:a(function(){return lT.hasUidFilename},"get")});Object.defineProperty(m,"registerDefaultHostFunctions",{enumerable:!0,get:a(function(){return lT.registerDefaultHostFunctions},"get")});var dO=uP();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:a(function(){return dO.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:a(function(){return dO.ServiceRegistry},"get")});var NH=fP();Object.defineProperty(m,"createVaultFrontmatterClassLabelResolver",{enumerable:!0,get:a(function(){return NH.createVaultFrontmatterClassLabelResolver},"get")});var kH=hP();Object.defineProperty(m,"NamedQueryRunner",{enumerable:!0,get:a(function(){return kH.NamedQueryRunner},"get")});var MH=Rp();Object.defineProperty(m,"iriToObsidianName",{enumerable:!0,get:a(function(){return MH.iriToObsidianName},"get")});var hO=pP();Object.defineProperty(m,"extractSparqlBlock",{enumerable:!0,get:a(function(){return hO.extractSparqlBlock},"get")});Object.defineProperty(m,"stripFrontmatter",{enumerable:!0,get:a(function(){return hO.stripFrontmatter},"get")});var jH=mP();Object.defineProperty(m,"CommandExecutionFlow",{enumerable:!0,get:a(function(){return jH.CommandExecutionFlow},"get")});var $H=n1();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:a(function(){return $H.TaskStatusService},"get")});var UH=a1();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:a(function(){return UH.AreaCreationService},"get")});var BH=l1();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:a(function(){return BH.AreaHierarchyBuilder},"get")});var VH=f1();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:a(function(){return VH.ClassCreationService},"get")});var GH=h1();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:a(function(){return GH.ConceptCreationService},"get")});var qH=eg();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:a(function(){return qH.EffortStatusWorkflow},"get")});var WH=Xf();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:a(function(){return WH.WorkflowEngine},"get")});var zH=Ww();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:a(function(){return zH.WorkflowResolver},"get")});var HH=CP();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:a(function(){return HH.InstantiationRuleResolver},"get")});var KH=OP();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:a(function(){return KH.VisibilityGenerator},"get")});var QH=DP();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:a(function(){return QH.WorkflowCommandAdapter},"get")});var XH=S1();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:a(function(){return XH.EffortVotingService},"get")});var YH=T1();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:a(function(){return YH.FolderRepairService},"get")});var JH=v1();Object.defineProperty(m,"extractAssetReference",{enumerable:!0,get:a(function(){return JH.extractAssetReference},"get")});var ZH=ra();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:a(function(){return ZH.LoggingService},"get")});var eK=x1();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:a(function(){return eK.PropertyCleanupService},"get")});var tK=P1();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:a(function(){return tK.RenameToUidService},"get")});var rK=rg();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:a(function(){return rK.StatusTimestampService},"get")});var nK=D1();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:a(function(){return nK.SupervisionCreationService},"get")});var iK=L1();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:a(function(){return iK.DynamicFrontmatterGenerator},"get")});var Ey=Hf();Object.defineProperty(m,"registerOrderSpecLoader",{enumerable:!0,get:a(function(){return Ey.registerOrderSpecLoader},"get")});Object.defineProperty(m,"clearOrderSpecLoader",{enumerable:!0,get:a(function(){return Ey.clearOrderSpecLoader},"get")});Object.defineProperty(m,"loadDefaultSpec",{enumerable:!0,get:a(function(){return Ey.loadDefaultSpec},"get")});Object.defineProperty(m,"orderProperties",{enumerable:!0,get:a(function(){return Ey.orderProperties},"get")});var sK=k1();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:a(function(){return sK.AlgorithmExtractor},"get")});var oK=j1();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:a(function(){return oK.PlanningService},"get")});var aK=GP();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:a(function(){return aK.PropertySchemaResolver},"get")});var cK=qP();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:a(function(){return cK.ClassHierarchyResolver},"get")});var lK=WP();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:a(function(){return lK.EnumValueResolver},"get")});var uK=G1();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:a(function(){return uK.AssetConversionService},"get")});var fK=z1();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:a(function(){return fK.SessionEventService},"get")});var dK=Q1();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:a(function(){return dK.URIConstructionService},"get")});var hK=Y1();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:a(function(){return hK.GenericAssetCreationService},"get")});var pK=tC();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:a(function(){return pK.ArchiveAssetService},"get")});var mK=nC();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:a(function(){return mK.FixMissingLabelService},"get")});var gK=iC();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:a(function(){return gK.GraphQueryService},"get")});var yK=oC();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:a(function(){return yK.TypeRegistry},"get")});var pO=aC();Object.defineProperty(m,"NLToSPARQLService",{enumerable:!0,get:a(function(){return pO.NLToSPARQLService},"get")});Object.defineProperty(m,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:a(function(){return pO.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var di=rv();Object.defineProperty(m,"SPARQL_TEMPLATES",{enumerable:!0,get:a(function(){return di.SPARQL_TEMPLATES},"get")});Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:a(function(){return di.SPARQL_PREFIXES},"get")});Object.defineProperty(m,"PREDICATES",{enumerable:!0,get:a(function(){return di.PREDICATES},"get")});Object.defineProperty(m,"ASSET_CLASSES",{enumerable:!0,get:a(function(){return di.ASSET_CLASSES},"get")});Object.defineProperty(m,"EFFORT_STATUSES",{enumerable:!0,get:a(function(){return di.EFFORT_STATUSES},"get")});Object.defineProperty(m,"KNOWN_PROTOTYPES",{enumerable:!0,get:a(function(){return di.KNOWN_PROTOTYPES},"get")});Object.defineProperty(m,"KNOWN_CLASSES",{enumerable:!0,get:a(function(){return di.KNOWN_CLASSES},"get")});Object.defineProperty(m,"findClassByTerm",{enumerable:!0,get:a(function(){return di.findClassByTerm},"get")});Object.defineProperty(m,"findMatchingTemplates",{enumerable:!0,get:a(function(){return di.findMatchingTemplates},"get")});Object.defineProperty(m,"fillTemplate",{enumerable:!0,get:a(function(){return di.fillTemplate},"get")});Object.defineProperty(m,"validateParameters",{enumerable:!0,get:a(function(){return di.validateParameters},"get")});Object.defineProperty(m,"getTemplateByName",{enumerable:!0,get:a(function(){return di.getTemplateByName},"get")});var mO=sv();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:a(function(){return mO.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:a(function(){return mO.CriticalityZoneUUIDs},"get")});var bK=vs();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:a(function(){return bK.FrontmatterService},"get")});var _K=kn();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:a(function(){return _K.DateFormatter},"get")});var SK=Zs();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:a(function(){return SK.WikiLinkHelpers},"get")});var wK=ho();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:a(function(){return wK.MetadataHelpers},"get")});var vK=s1();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:a(function(){return vK.MetadataExtractor},"get")});var EK=lC();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:a(function(){return EK.EffortSortingHelpers},"get")});var TK=uC();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:a(function(){return TK.FilenameValidator},"get")});var AK=yC();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:a(function(){return AK.RDFSerializer},"get")});var IK=rl();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:a(function(){return IK.NullLogger},"get")});var uT=yv();Object.defineProperty(m,"vaultPathToIRI",{enumerable:!0,get:a(function(){return uT.vaultPathToIRI},"get")});Object.defineProperty(m,"iriToVaultPath",{enumerable:!0,get:a(function(){return uT.iriToVaultPath},"get")});Object.defineProperty(m,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:a(function(){return uT.OBSIDIAN_VAULT_SCHEME},"get")});var xK=Zw();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:a(function(){return xK.InMemoryTripleStore},"get")});var RK=Oe();Object.defineProperty(m,"DomainIRI",{enumerable:!0,get:a(function(){return RK.IRI},"get")});var PK=qe();Object.defineProperty(m,"DomainLiteral",{enumerable:!0,get:a(function(){return PK.Literal},"get")});var CK=Bt();Object.defineProperty(m,"DomainBlankNode",{enumerable:!0,get:a(function(){return CK.BlankNode},"get")});var OK=Wn();Object.defineProperty(m,"DomainTriple",{enumerable:!0,get:a(function(){return OK.Triple},"get")});var DK=_v();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:a(function(){return DK.RDFVocabularyMapper},"get")});var FK=_C();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:a(function(){return FK.RDFSInferenceEngine},"get")});var LK=Ev();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:a(function(){return LK.NonInheritablePropertyRegistry},"get")});var NK=Iv();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:a(function(){return NK.PropertyCardinalityRegistry},"get")});var gO=Pv();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:a(function(){return gO.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:a(function(){return gO.INFERRED_GRAPH},"get")});var kK=IC();Object.defineProperty(m,"IRICanonicalizer",{enumerable:!0,get:a(function(){return kK.IRICanonicalizer},"get")});var yO=Sg();Object.defineProperty(m,"derivePath",{enumerable:!0,get:a(function(){return yO.derivePath},"get")});Object.defineProperty(m,"deriveLegacyFlatPath",{enumerable:!0,get:a(function(){return yO.deriveLegacyFlatPath},"get")});var fT=wg();Object.defineProperty(m,"discoverFileSpaceExclusions",{enumerable:!0,get:a(function(){return fT.discoverFileSpaceExclusions},"get")});Object.defineProperty(m,"frontmatterDeclaresFileSpace",{enumerable:!0,get:a(function(){return fT.frontmatterDeclaresFileSpace},"get")});Object.defineProperty(m,"FILE_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return fT.FILE_SPACE_CLASS_UID},"get")});var bO=FC();Object.defineProperty(m,"LazyAssetGraphLoader",{enumerable:!0,get:a(function(){return bO.LazyAssetGraphLoader},"get")});Object.defineProperty(m,"MAX_LAZY_DEPTH",{enumerable:!0,get:a(function(){return bO.MAX_LAZY_DEPTH},"get")});var _O=Nv();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:a(function(){return _O.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:a(function(){return _O.SOURCE_VARIABLE},"get")});var dT=jv();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:a(function(){return dT.NoteToRDFConverter},"get")});Object.defineProperty(m,"normaliseExcludedFolders",{enumerable:!0,get:a(function(){return dT.normaliseExcludedFolders},"get")});Object.defineProperty(m,"isPathExcluded",{enumerable:!0,get:a(function(){return dT.isPathExcluded},"get")});var hT=pl();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:a(function(){return hT.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:a(function(){return hT.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:a(function(){return hT.SPARQLParseError},"get")});var SO=RS();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:a(function(){return SO.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:a(function(){return SO.DescribeOptionsTransformerError},"get")});var wO=gl();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:a(function(){return wO.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:a(function(){return wO.AlgebraTranslator},"get")});var MK=UC();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:a(function(){return MK.AlgebraOptimizer},"get")});var jK=BC();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:a(function(){return jK.AlgebraSerializer},"get")});var $K=zS();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:a(function(){return $K.BGPExecutor},"get")});var UK=bm();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:a(function(){return UK.FilterExecutor},"get")});var BK=fw();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:a(function(){return BK.OptionalExecutor},"get")});var VK=hw();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:a(function(){return VK.UnionExecutor},"get")});var GK=Ew();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:a(function(){return GK.ConstructExecutor},"get")});var qK=GC();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:a(function(){return qK.DescribeExecutor},"get")});var vO=Ml();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:a(function(){return vO.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:a(function(){return vO.QueryExecutor},"get")});var EO=WC();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:a(function(){return EO.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:a(function(){return EO.UpdateExecutorError},"get")});var WK=bs();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:a(function(){return WK.SolutionMapping},"get")});var zK=ym();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:a(function(){return zK.BuiltInFunctions},"get")});var HK=HC();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:a(function(){return HK.AggregateFunctions},"get")});var TO=gw();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:a(function(){return TO.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:a(function(){return TO.CustomAggregateError},"get")});var Ls=yw();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:a(function(){return Ls.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:a(function(){return Ls.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:a(function(){return Ls.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:a(function(){return Ls.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:a(function(){return Ls.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:a(function(){return Ls.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:a(function(){return Ls.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:a(function(){return Ls.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:a(function(){return Ls.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:a(function(){return Ls.createDoubleLiteral},"get")});var KK=KC();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:a(function(){return KK.QueryPlanCache},"get")});var AO=QC();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:a(function(){return AO.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:a(function(){return AO.createSPARQLResultCache},"get")});var IO=XC();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:a(function(){return IO.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:a(function(){return IO.createIncrementalIndexer},"get")});var QK=YC();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:a(function(){return QK.ResultSerializer},"get")});var xO=AS();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:a(function(){return xO.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:a(function(){return xO.CaseWhenTransformerError},"get")});var XK=DS();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:a(function(){return XK.VaultPrefixTransformer},"get")});var YK=Uv();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:a(function(){return YK.FilterContainsOptimizer},"get")});var RO=JC();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:a(function(){return RO.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:a(function(){return RO.FileAlreadyExistsError},"get")});var pT=Qw();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:a(function(){return pT.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:a(function(){return pT.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:a(function(){return pT.TransactionError},"get")});var PO=qf();Object.defineProperty(m,"liveClock",{enumerable:!0,get:a(function(){return PO.liveClock},"get")});Object.defineProperty(m,"frozenClock",{enumerable:!0,get:a(function(){return PO.frozenClock},"get")});var CO=km();Object.defineProperty(m,"liveUidGenerator",{enumerable:!0,get:a(function(){return CO.liveUidGenerator},"get")});Object.defineProperty(m,"seededUidGenerator",{enumerable:!0,get:a(function(){return CO.seededUidGenerator},"get")});var Ty=Zv();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:a(function(){return Ty.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:a(function(){return Ty.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:a(function(){return Ty.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:a(function(){return Ty.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var JK=qt();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:a(function(){return JK.DI_TOKENS},"get")});var wd=ZC();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:a(function(){return wd.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:a(function(){return wd.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:a(function(){return wd.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:a(function(){return wd.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:a(function(){return wd.container},"get")});var xo=s3();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:a(function(){return xo.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return xo.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:a(function(){return xo.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:a(function(){return xo.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:a(function(){return xo.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:a(function(){return xo.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:a(function(){return xo.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:a(function(){return xo.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:a(function(){return xo.createStreamingSource},"get")});var OO=o3();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:a(function(){return OO.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:a(function(){return OO.ExoQLError},"get")});var vd=fE();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return vd.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return vd.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return vd.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:a(function(){return vd.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return vd.isLayoutFrontmatter},"get")});var ma=fE();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return ma.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return ma.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return ma.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return ma.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return ma.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return ma.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return ma.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:a(function(){return ma.isPropertiesBlock},"get")});var DO=h3();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:a(function(){return DO.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:a(function(){return DO.selectByPriority},"get")});fi(v3(),m);var ZK=AE();Object.defineProperty(m,"ShapeLoader",{enumerable:!0,get:a(function(){return ZK.ShapeLoader},"get")});var eQ=vE();Object.defineProperty(m,"ShapeRegistry",{enumerable:!0,get:a(function(){return eQ.ShapeRegistry},"get")});var tQ=Jt();Object.defineProperty(m,"Namespace",{enumerable:!0,get:a(function(){return tQ.Namespace},"get")});var FO=Zg();Object.defineProperty(m,"shaclValidate",{enumerable:!0,get:a(function(){return FO.validate},"get")});Object.defineProperty(m,"ShaclShapeRegistry",{enumerable:!0,get:a(function(){return FO.ShapeRegistry},"get")});fi(T3(),m);var mT=I3();Object.defineProperty(m,"ValidatorDaemon",{enumerable:!0,get:a(function(){return mT.ValidatorDaemon},"get")});Object.defineProperty(m,"DEFAULT_SOCKET_PATH",{enumerable:!0,get:a(function(){return mT.DEFAULT_SOCKET_PATH},"get")});Object.defineProperty(m,"IDLE_TIMEOUT_MS",{enumerable:!0,get:a(function(){return mT.IDLE_TIMEOUT_MS},"get")});var rQ=OE();Object.defineProperty(m,"TripleClassHierarchy",{enumerable:!0,get:a(function(){return rQ.ClassHierarchy},"get")});var LO=LE();Object.defineProperty(m,"parseTarball",{enumerable:!0,get:a(function(){return LO.parseTarball},"get")});Object.defineProperty(m,"parseTarballGzip",{enumerable:!0,get:a(function(){return LO.parseTarballGzip},"get")});var NO=sy();Object.defineProperty(m,"restCreateCommit",{enumerable:!0,get:a(function(){return NO.restCreateCommit},"get")});Object.defineProperty(m,"isBinaryPayload",{enumerable:!0,get:a(function(){return NO.isBinaryPayload},"get")});var du=F3();Object.defineProperty(m,"mountAssetSpaceFiles",{enumerable:!0,get:a(function(){return du.mountAssetSpaceFiles},"get")});Object.defineProperty(m,"discoverAssetSpaceWrapperDir",{enumerable:!0,get:a(function(){return du.discoverWrapperDir},"get")});Object.defineProperty(m,"extractAssetSpaceSha",{enumerable:!0,get:a(function(){return du.extractShaFromWrapper},"get")});Object.defineProperty(m,"appendGitmodulesEntry",{enumerable:!0,get:a(function(){return du.appendGitmodulesEntry},"get")});Object.defineProperty(m,"stripGitmodulesEntry",{enumerable:!0,get:a(function(){return du.stripGitmodulesEntry},"get")});Object.defineProperty(m,"escapeGitmodulesRegex",{enumerable:!0,get:a(function(){return du.escapeGitmodulesRegex},"get")});var kO=UE();Object.defineProperty(m,"detectChanges",{enumerable:!0,get:a(function(){return kO.detectChanges},"get")});Object.defineProperty(m,"extractAssetUid",{enumerable:!0,get:a(function(){return kO.extractAssetUid},"get")});var nQ=ld();Object.defineProperty(m,"gitBlobSha",{enumerable:!0,get:a(function(){return nQ.gitBlobSha},"get")});var Ed=fd();Object.defineProperty(m,"getBlobBytes",{enumerable:!0,get:a(function(){return Ed.getBlobBytes},"get")});Object.defineProperty(m,"getBlobText",{enumerable:!0,get:a(function(){return Ed.getBlobText},"get")});Object.defineProperty(m,"getCommitInfo",{enumerable:!0,get:a(function(){return Ed.getCommitInfo},"get")});Object.defineProperty(m,"getHeadSha",{enumerable:!0,get:a(function(){return Ed.getHeadSha},"get")});Object.defineProperty(m,"getTree",{enumerable:!0,get:a(function(){return Ed.getTree},"get")});var Ay=WE();Object.defineProperty(m,"DEFAULT_MAX_PUSH_RETRIES",{enumerable:!0,get:a(function(){return Ay.DEFAULT_MAX_PUSH_RETRIES},"get")});Object.defineProperty(m,"SyncEngine",{enumerable:!0,get:a(function(){return Ay.SyncEngine},"get")});Object.defineProperty(m,"isNonFastForwardError",{enumerable:!0,get:a(function(){return Ay.isNonFastForwardError},"get")});Object.defineProperty(m,"orderChildrenFirst",{enumerable:!0,get:a(function(){return Ay.orderChildrenFirst},"get")});var Td=hy();Object.defineProperty(m,"DEFAULT_MAX_FILE_BYTES",{enumerable:!0,get:a(function(){return Td.DEFAULT_MAX_FILE_BYTES},"get")});Object.defineProperty(m,"InMemoryQuarantineStore",{enumerable:!0,get:a(function(){return Td.InMemoryQuarantineStore},"get")});Object.defineProperty(m,"contentEquals",{enumerable:!0,get:a(function(){return Td.contentEquals},"get")});Object.defineProperty(m,"isFileSpaceSyncablePath",{enumerable:!0,get:a(function(){return Td.isFileSpaceSyncablePath},"get")});Object.defineProperty(m,"isSyncablePath",{enumerable:!0,get:a(function(){return Td.isSyncablePath},"get")});var iQ=KE();Object.defineProperty(m,"diff3",{enumerable:!0,get:a(function(){return iQ.diff3},"get")});var MO=W3();Object.defineProperty(m,"StructuredMerger",{enumerable:!0,get:a(function(){return MO.StructuredMerger},"get")});Object.defineProperty(m,"splitSections",{enumerable:!0,get:a(function(){return MO.splitSections},"get")});var sQ=z3();Object.defineProperty(m,"MergeShaclGate",{enumerable:!0,get:a(function(){return sQ.MergeShaclGate},"get")});var oQ=H3();Object.defineProperty(m,"GatedStructuredMerger",{enumerable:!0,get:a(function(){return oQ.GatedStructuredMerger},"get")});var jO=K3();Object.defineProperty(m,"FileWatermarkStore",{enumerable:!0,get:a(function(){return jO.FileWatermarkStore},"get")});Object.defineProperty(m,"WATERMARK_STORE_FILENAME",{enumerable:!0,get:a(function(){return jO.WATERMARK_STORE_FILENAME},"get")});var aQ=cy();Object.defineProperty(m,"isAuthError",{enumerable:!0,get:a(function(){return aQ.isAuthError},"get")});var $O=dy();Object.defineProperty(m,"isRateLimitError",{enumerable:!0,get:a(function(){return $O.isRateLimitError},"get")});Object.defineProperty(m,"withRateLimitBackoff",{enumerable:!0,get:a(function(){return $O.withRateLimitBackoff},"get")});var UO=uy();Object.defineProperty(m,"redactSecrets",{enumerable:!0,get:a(function(){return UO.redactSecrets},"get")});Object.defineProperty(m,"scanForSecrets",{enumerable:!0,get:a(function(){return UO.scanForSecrets},"get")});var cQ=Y3();Object.defineProperty(m,"SyncedQuarantineStore",{enumerable:!0,get:a(function(){return cQ.SyncedQuarantineStore},"get")});var ga=iO();Object.defineProperty(m,"ASSET_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return ga.ASSET_SPACE_CLASS_UID},"get")});Object.defineProperty(m,"SYNC_BRANCH",{enumerable:!0,get:a(function(){return ga.SYNC_BRANCH},"get")});Object.defineProperty(m,"SpaceSpecAccumulator",{enumerable:!0,get:a(function(){return ga.SpaceSpecAccumulator},"get")});Object.defineProperty(m,"classifySpaceDeclaration",{enumerable:!0,get:a(function(){return ga.classifySpaceDeclaration},"get")});Object.defineProperty(m,"isAssetSpaceFrontmatter",{enumerable:!0,get:a(function(){return ga.isAssetSpaceFrontmatter},"get")});Object.defineProperty(m,"isFileSpaceFrontmatter",{enumerable:!0,get:a(function(){return ga.isFileSpaceFrontmatter},"get")});Object.defineProperty(m,"parseStrictGitHubRepoURL",{enumerable:!0,get:a(function(){return ga.parseStrictGitHubRepoURL},"get")});Object.defineProperty(m,"readSpaceSource",{enumerable:!0,get:a(function(){return ga.readSpaceSource},"get")});var BO=uO();Object.defineProperty(m,"ParityValidator",{enumerable:!0,get:a(function(){return BO.ParityValidator},"get")});Object.defineProperty(m,"summarizeParityRound",{enumerable:!0,get:a(function(){return BO.summarizeParityRound},"get")});var VO=oT();Object.defineProperty(m,"compareAssetSemantics",{enumerable:!0,get:a(function(){return VO.compareAssetSemantics},"get")});Object.defineProperty(m,"isFormatOnlyDrift",{enumerable:!0,get:a(function(){return VO.isFormatOnlyDrift},"get")})});var Ir=w(gT=>{"use strict";gT.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})};gT.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 qO=w((Zge,GO)=>{var ya=require("constants"),lQ=process.cwd,Iy=null,uQ=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Iy||(Iy=lQ.call(process)),Iy};try{process.cwd()}catch{}typeof process.chdir=="function"&&(yT=process.chdir,process.chdir=function(n){Iy=null,yT.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,yT));var yT;GO.exports=fQ;function fQ(n){ya.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=o(n.chownSync),n.fchownSync=o(n.fchownSync),n.lchownSync=o(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,d,h){h&&process.nextTick(h)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,d,h,p){p&&process.nextTick(p)},n.lchownSync=function(){}),uQ==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,y){var g=Date.now(),v=0;f(h,p,a(function _(S){if(S&&(S.code==="EACCES"||S.code==="EPERM"||S.code==="EBUSY")&&Date.now()-g<6e4){setTimeout(function(){n.stat(p,function(T,I){T&&T.code==="ENOENT"?f(h,p,_):y(S)})},v),v<100&&(v+=10);return}y&&y(S)},"CB"))}return a(d,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function d(h,p,y,g,v,_){var S;if(_&&typeof _=="function"){var T=0;S=a(function(I,A,R){if(I&&I.code==="EAGAIN"&&T<10)return T++,f.call(n,h,p,y,g,v,S);_.apply(this,arguments)},"callback")}return f.call(n,h,p,y,g,v,S)}return a(d,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(d,h,p,y,g){for(var v=0;;)try{return f.call(n,d,h,p,y,g)}catch(_){if(_.code==="EAGAIN"&&v<10){v++;continue}throw _}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,ya.O_WRONLY|ya.O_SYMLINK,h,function(y,g){if(y){p&&p(y);return}f.fchmod(g,h,function(v){f.close(g,function(_){p&&p(v||_)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,ya.O_WRONLY|ya.O_SYMLINK,h),y=!0,g;try{g=f.fchmodSync(p,h),y=!1}finally{if(y)try{f.closeSync(p)}catch{}else f.closeSync(p)}return g}}a(e,"patchLchmod");function t(f){ya.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,y){f.open(d,ya.O_SYMLINK,function(g,v){if(g){y&&y(g);return}f.futimes(v,h,p,function(_){f.close(v,function(S){y&&y(_||S)})})})},f.lutimesSync=function(d,h,p){var y=f.openSync(d,ya.O_SYMLINK),g,v=!0;try{g=f.futimesSync(y,h,p),v=!1}finally{if(v)try{f.closeSync(y)}catch{}else f.closeSync(y)}return g}):f.futimes&&(f.lutimes=function(d,h,p,y){y&&process.nextTick(y)},f.lutimesSync=function(){})}a(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(y){u(y)&&(y=null),p&&p.apply(this,arguments)})}}a(r,"chmodFix");function i(f){return f&&function(d,h){try{return f.call(n,d,h)}catch(p){if(!u(p))throw p}}}a(i,"chmodFixSync");function s(f){return f&&function(d,h,p,y){return f.call(n,d,h,p,function(g){u(g)&&(g=null),y&&y.apply(this,arguments)})}}a(s,"chownFix");function o(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(y){if(!u(y))throw y}}}a(o,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function y(g,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),p&&p.apply(this,arguments)}return a(y,"callback"),h?f.call(n,d,h,y):f.call(n,d,y)}}a(c,"statFix");function l(f){return f&&function(d,h){var p=h?f.call(n,d,h):f.call(n,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}a(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}a(u,"chownErOk")}a(fQ,"patch")});var HO=w((tye,zO)=>{var WO=require("stream").Stream;zO.exports=dQ;function dQ(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);WO.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 o=Object.keys(i),c=0,l=o.length;c<l;c++){var u=o[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,d){if(f){s.emit("error",f),s.readable=!1;return}s.fd=d,s.emit("open",d),s._read()})}function t(r,i){if(!(this instanceof t))return new t(r,i);WO.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),o=0,c=s.length;o<c;o++){var l=s[o];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())}}a(dQ,"legacy")});var QO=w((nye,KO)=>{"use strict";KO.exports=pQ;var hQ=Object.getPrototypeOf||function(n){return n.__proto__};function pQ(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:hQ(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}a(pQ,"clone")});var pu=w((sye,ST)=>{var zt=require("fs"),mQ=qO(),gQ=HO(),yQ=QO(),xy=require("util"),Gr,Py;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Gr=Symbol.for("graceful-fs.queue"),Py=Symbol.for("graceful-fs.previous")):(Gr="___graceful-fs.queue",Py="___graceful-fs.previous");function bQ(){}a(bQ,"noop");function JO(n,e){Object.defineProperty(n,Gr,{get:a(function(){return e},"get")})}a(JO,"publishQueue");var Tc=bQ;xy.debuglog?Tc=xy.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Tc=a(function(){var n=xy.format.apply(xy,arguments);n="GFS4: "+n.split(/\n/).join(`
479
+ `);O=k===H}return o("checked",{filesChecked:A,inParity:I,discrepancies:T,m2SemanticDiffs:Y,accountedCount:C,m1Violations:q,headSha:u,...O!==void 0?{attachmentHashSetIdentical:O}:{}})}catch(l){return(0,wH.isAuthError)(l)?o("auth-required",{detail:s(`authentication failed: ${pa(l)} \u2014 the PAT is expired, revoked or under-scoped; update it (R8)`)}):IH(l)?(i.push("repo unreachable (HTTP 404): dead AssetSpace pointer, or the fine-grained PAT does not allowlist this repo \u2014 skipped"),o("error",{detail:s(pa(l))})):(i.push(`parity check failed: ${s(pa(l))}`),o("error",{detail:s(pa(l))}))}}async readLocalSnapshot(e,t){let r=this.deps.localFilesFor(e),i=t?uu.isFileSpaceSyncablePath:uu.isSyncablePath,s=this.deps.maxFileBytes??uu.DEFAULT_MAX_FILE_BYTES,o=new Map,c=new Map,l=[];if(t&&r.readBinary===void 0)throw new Error("file-mode repo requires a LocalFilesPort with readBinary \u2014 refusing to hash through the text-only port (binary would corrupt)");let u=new TextEncoder;for(let f of await r.list())if(i(f))try{if(t){let d=await r.readBinary(f);if(d.byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}o.set(f,await(0,aO.gitBlobSha)(d,this.deps.sha1))}else{let d=await r.read(f);if(u.encode(d).byteLength>s){l.push(`local ${f} exceeds the ${s}-byte cap \u2014 excluded symmetrically`);continue}c.set(f,d),o.set(f,await(0,aO.gitBlobSha)(d,this.deps.sha1))}}catch(d){let h=this.deps.redact??(p=>p);l.push(`local ${f} unreadable (${h(pa(d))}) \u2014 skipped`)}return{shas:o,texts:c,warnings:l}}async classifyAll(e,t,r,i,s,o,c){let l=[],u=0,f=this.deps.maxSemanticFetchesPerRepo??EH,d=new Set([...t.shas.keys(),...r.keys()]);for(let h of[...d].sort()){let p=t.shas.get(h),g=r.get(h)?.blobSha,v=i.get(h);if(p!==void 0&&g!==void 0){if(p===g){u++;continue}l.push(await this.classifyContentDiff(e,h,p,g,v,s,o,t,{...c,takeRepoFetch:a(()=>f-- >0,"takeRepoFetch")}));continue}if(p!==void 0){let _;s.has(h)?_={path:h,presence:"local-only",cls:"quarantine-pinned",localSha:p}:v===void 0?_={path:h,presence:"local-only",cls:"pending-local-add",localSha:p}:v===p?_={path:h,presence:"local-only",cls:"pending-remote-delete",localSha:p,detail:"remote deleted it; the local copy is unchanged"}:_={path:h,presence:"local-only",cls:"pending-conflict",localSha:p,detail:"remote deleted it AND the local copy was edited"},l.push(_);continue}if(g!==void 0){let _;s.has(h)?_={path:h,presence:"remote-only",cls:"quarantine-pinned",remoteSha:g}:v===void 0?_={path:h,presence:"remote-only",cls:"pending-remote-add",remoteSha:g}:v===g?_={path:h,presence:"remote-only",cls:"deferred-local-delete",remoteSha:g,detail:"locally deleted; the delete propagates on the next sync (#3476) \u2014 escalates if it survives a converged round"}:_={path:h,presence:"remote-only",cls:"pending-conflict",remoteSha:g,detail:"locally deleted AND the remote copy was edited"},l.push(_)}}return{discrepancies:l,inParity:u,filesChecked:d.size}}async classifyContentDiff(e,t,r,i,s,o,c,l,u){let f={localSha:r,remoteSha:i};if(o.has(t))return{path:t,presence:"both",cls:"quarantine-pinned",...f};if(s!==void 0&&s===r)return{path:t,presence:"both",cls:"pending-remote-edit",...f};if(s!==void 0&&s===i)return{path:t,presence:"both",cls:"pending-local-edit",...f};if(c)return{path:t,presence:"both",cls:"pending-conflict",...f,detail:"binary content differs on both sides"};if(!u.takeRepoFetch()||!u.runBudget.take(1))return u.warnings.push(`semantic-fetch cap reached \u2014 ${t} left unverified (counted into M2)`),{path:t,presence:"both",cls:"unverified-divergence",...f};let d=l.texts.get(t),h;try{h=await(0,yd.getBlobText)(this.transport,e.owner,e.repo,i,this.deps.baseURL)}catch(y){let g=this.deps.redact??(v=>v);return u.warnings.push(`blob fetch for ${t} failed (${g(pa(y))}) \u2014 left unverified`),{path:t,presence:"both",cls:"unverified-divergence",...f}}let p=(0,cO.compareAssetSemantics)(d??"",h,this.deps.yaml);return(0,cO.isFormatOnlyDrift)(p)?{path:t,presence:"both",cls:"format-only-drift",...f,frontmatterEqual:!0,bodyEqual:!0}:{path:t,presence:"both",cls:"pending-conflict",...f,frontmatterEqual:p.frontmatterEqual,bodyEqual:p.bodyEqual,detail:`semantic divergence (frontmatter ${p.frontmatterEqual?"equal":"differs"}, body ${p.bodyEqual?"equal":"differs"})`}}checkConservation(e,t,r,i,s,o){let c=t.snapshot?.dirtyByRepo.get(e.repoKey);if(c===void 0||c.size===0)return[];let l=new Set(o?.mergedPaths??[]),u=new Set(o?.quarantinedPaths??[]),f=[];for(let[d,h]of c)r.shas.get(d)!==h&&i.get(d)?.blobSha!==h&&(l.has(d)||u.has(d)||s.has(d)||f.push({repoKey:e.repoKey,path:d,kind:"conservation",detail:`pre-sync dirty content ${h.slice(0,7)} survived NOWHERE: disk now ${r.shas.get(d)?.slice(0,7)??"absent"}, not in head tree, not merged/quarantined/pinned \u2014 possible lost edit`}));return f}escalatePersistentDivergence(e,t,r){for(let i of e){if(i.status!=="checked")continue;let s=r?.find(u=>u.repoKey===i.repoKey);if(s!==void 0&&s.status!=="synced")continue;let o=new Set(s?.deferredDeletes??[]),c=t.repos.find(u=>u.repoKey===i.repoKey&&u.status==="checked");if(c===void 0)continue;let l=new Map(c.discrepancies.filter(u=>lO.has(u.cls)).map(u=>[u.path,u]));for(let u of i.discrepancies){if(!lO.has(u.cls)||u.cls==="deferred-local-delete"&&o.has(u.path))continue;let f=l.get(u.path);f!==void 0&&f.localSha===u.localSha&&f.remoteSha===u.remoteSha&&i.m1Violations.push({repoKey:i.repoKey,path:u.path,kind:"persistent-divergence",detail:`identical divergence (local ${u.localSha?.slice(0,7)??"absent"}, remote ${u.remoteSha?.slice(0,7)??"absent"}) survived a sync round unchanged (${f.cls} \u2192 ${u.cls}) \u2014 the engine failed to converge it`})}}}};bd.ParityValidator=aT;function xH(n){if(n.vacuous)return`ExoSync parity: VACUOUS \u2014 0 of ${n.repos.length} repo(s) checked (errors / never synced)`;let e=n.repos.length-n.checkedRepos,t=e>0?`, ${e} skipped`:"";return n.ok?`ExoSync parity: M1=0, M2=\u2205 (${n.checkedRepos} repo(s) checked${t})`:`ExoSync parity: M1=${n.m1Total}, M2=${n.m2Total} diff(s) (${n.checkedRepos} repo(s) checked${t}) \u2014 see log`}a(xH,"summarizeParityRound")});var tt=w(m=>{"use strict";var RH=m&&m.__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:a(function(){return e[t]},"get")}),Object.defineProperty(n,r,i)}):(function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]})),fi=m&&m.__exportStar||function(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&RH(e,n,t)};Object.defineProperty(m,"__esModule",{value:!0});m.iriToObsidianName=m.NamedQueryRunner=m.createVaultFrontmatterClassLabelResolver=m.ServiceRegistry=m.GroundingExecutor=m.registerDefaultHostFunctions=m.hasUidFilename=m.hasNonUidFilename=m.PreconditionEvaluator=m.CommandResolver=m.extractPropertyLabel=m.uriToPropertyName=m.propertyNameToUri=m.rangeToFieldType=m.PropertyFieldType=m.transitiveDependsOnClosure=m.assertTsFloorReconciled=m.assertTsFloor=m.TsFloorViolationError=m.CATALOG_KEEP_NAMESPACES=m.PLUGIN_UI_FLOOR=m.SDK_FLOOR=m.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS=m.SDK_FLOOR_ASSETSPACE_UIDS=m.TS_FLOOR_AS_UID_SHARED_IDENTITIES=m.TS_FLOOR_AS_UID_EXOCMD=m.TS_FLOOR_AS_UID_EXO=m.parseGroundingDefinitionFromFrontmatter=m.isCommandBindingFrontmatter=m.isGroundingFrontmatter=m.isPreconditionFrontmatter=m.isCommandFrontmatter=m.isStyleSource=m.isLabelClass=m.isCommandVariant=m.STYLE_SOURCE_VALUES=m.LABEL_CLASS_VALUES=m.COMMAND_VARIANT_VALUES=m.CommandBindingStyleProperty=m.CommandBindingProperty=m.GroundingProperty=m.PreconditionProperty=m.CommandProperty=m.resolveGroundingTypeFromWikilinkLiteral=m.resolveGroundingTypeFromIRI=m.GROUNDING_TYPE_IRI_TO_ENUM=m.GROUNDING_TYPE_UID_TO_ENUM=m.GROUNDING_TYPE_UIDS=m.GroundingType=m.EFFORT_STATUS_OPTIONS=void 0;m.findClassByTerm=m.KNOWN_CLASSES=m.KNOWN_PROTOTYPES=m.EFFORT_STATUSES=m.ASSET_CLASSES=m.PREDICATES=m.SPARQL_PREFIXES=m.SPARQL_TEMPLATES=m.DEFAULT_NL_TO_SPARQL_CONFIG=m.NLToSPARQLService=m.TypeRegistry=m.GraphQueryService=m.FixMissingLabelService=m.ArchiveAssetService=m.GenericAssetCreationService=m.URIConstructionService=m.SessionEventService=m.AssetConversionService=m.EnumValueResolver=m.ClassHierarchyResolver=m.PropertySchemaResolver=m.PlanningService=m.AlgorithmExtractor=m.orderProperties=m.loadDefaultSpec=m.clearOrderSpecLoader=m.registerOrderSpecLoader=m.DynamicFrontmatterGenerator=m.SupervisionCreationService=m.StatusTimestampService=m.RenameToUidService=m.PropertyCleanupService=m.LoggingService=m.extractAssetReference=m.FolderRepairService=m.EffortVotingService=m.WorkflowCommandAdapter=m.VisibilityGenerator=m.InstantiationRuleResolver=m.WorkflowResolver=m.WorkflowEngine=m.EffortStatusWorkflow=m.ConceptCreationService=m.ClassCreationService=m.AreaHierarchyBuilder=m.AreaCreationService=m.TaskStatusService=m.CommandExecutionFlow=m.stripFrontmatter=m.extractSparqlBlock=void 0;m.AlgebraOptimizer=m.AlgebraTranslator=m.ExoQLAlgebraTranslator=m.DescribeOptionsTransformerError=m.DescribeOptionsTransformer=m.SPARQLParseError=m.SPARQLParser=m.ExoQLParser=m.isPathExcluded=m.normaliseExcludedFolders=m.NoteToRDFConverter=m.SOURCE_VARIABLE=m.SourceAnnotator=m.MAX_LAZY_DEPTH=m.LazyAssetGraphLoader=m.FILE_SPACE_CLASS_UID=m.frontmatterDeclaresFileSpace=m.discoverFileSpaceExclusions=m.deriveLegacyFlatPath=m.derivePath=m.IRICanonicalizer=m.INFERRED_GRAPH=m.PrototypeChainMaterializer=m.PropertyCardinalityRegistry=m.NonInheritablePropertyRegistry=m.RDFSInferenceEngine=m.RDFVocabularyMapper=m.DomainTriple=m.DomainBlankNode=m.DomainLiteral=m.DomainIRI=m.InMemoryTripleStore=m.OBSIDIAN_VAULT_SCHEME=m.iriToVaultPath=m.vaultPathToIRI=m.NullLogger=m.RDFSerializer=m.FilenameValidator=m.EffortSortingHelpers=m.MetadataExtractor=m.MetadataHelpers=m.WikiLinkHelpers=m.DateFormatter=m.FrontmatterService=m.CriticalityZoneUUIDs=m.CriticalityZoneService=m.getTemplateByName=m.validateParameters=m.fillTemplate=m.findMatchingTemplates=void 0;m.DI_TOKENS=m.DEFAULT_FLEETING_NOTE_CLASS_UID=m.DEFAULT_INBOX_FOLDER=m.DEFAULT_OWNER_IDENTITY=m.VaultSettings=m.seededUidGenerator=m.liveUidGenerator=m.frozenClock=m.liveClock=m.TransactionError=m.TripleNotFoundError=m.TripleAlreadyExistsError=m.FileAlreadyExistsError=m.FileNotFoundError=m.FilterContainsOptimizer=m.VaultPrefixTransformer=m.CaseWhenTransformerError=m.CaseWhenTransformer=m.ResultSerializer=m.createIncrementalIndexer=m.IncrementalIndexer=m.createSPARQLResultCache=m.SPARQLResultCache=m.QueryPlanCache=m.createDoubleLiteral=m.createDecimalLiteral=m.getNumericValue=m.createPercentileAggregate=m.modeAggregate=m.stddevAggregate=m.varianceAggregate=m.medianAggregate=m.EXO_AGGREGATE_NS=m.BUILT_IN_AGGREGATES=m.CustomAggregateError=m.CustomAggregateRegistry=m.AggregateFunctions=m.BuiltInFunctions=m.SolutionMapping=m.UpdateExecutorError=m.UpdateExecutor=m.QueryExecutor=m.ExoQLQueryExecutor=m.DescribeExecutor=m.ConstructExecutor=m.UnionExecutor=m.OptionalExecutor=m.FilterExecutor=m.BGPExecutor=m.AlgebraSerializer=void 0;m.escapeGitmodulesRegex=m.stripGitmodulesEntry=m.appendGitmodulesEntry=m.extractAssetSpaceSha=m.discoverAssetSpaceWrapperDir=m.mountAssetSpaceFiles=m.isBinaryPayload=m.restCreateCommit=m.parseTarballGzip=m.parseTarball=m.TripleClassHierarchy=m.IDLE_TIMEOUT_MS=m.DEFAULT_SOCKET_PATH=m.ValidatorDaemon=m.ShaclShapeRegistry=m.shaclValidate=m.Namespace=m.ShapeRegistry=m.ShapeLoader=m.selectByPriority=m.LayoutSelector=m.isPropertiesBlock=m.isLayoutBlockFrontmatter=m.isBacklinksTableBlock=m.createLayoutBlockFromFrontmatter=m.PROPERTIES_BLOCK_CLASS_UID=m.PROPERTIES_BLOCK_CLASS_IRI=m.BACKLINKS_TABLE_BLOCK_CLASS_UID=m.BACKLINKS_TABLE_BLOCK_CLASS_IRI=m.isLayoutFrontmatter=m.isLayout=m.createLayoutFromFrontmatter=m.LAYOUT_CLASS_UID=m.LAYOUT_CLASS_IRI=m.ExoQLError=m.ExoQL=m.createStreamingSource=m.StreamingLoader=m.resetGlobalPool=m.getGlobalPool=m.MemoryPool=m.CompactGraphStore=m.StringTable=m.DEFAULT_COLORS=m.NODE_FLAGS=m.container=m.resetContainer=m.getContainer=m.createChildContainer=m.registerCoreServices=void 0;m.isFormatOnlyDrift=m.compareAssetSemantics=m.summarizeParityRound=m.ParityValidator=m.readSpaceSource=m.parseStrictGitHubRepoURL=m.isFileSpaceFrontmatter=m.isAssetSpaceFrontmatter=m.classifySpaceDeclaration=m.SpaceSpecAccumulator=m.SYNC_BRANCH=m.ASSET_SPACE_CLASS_UID=m.SyncedQuarantineStore=m.scanForSecrets=m.redactSecrets=m.withRateLimitBackoff=m.isRateLimitError=m.isAuthError=m.WATERMARK_STORE_FILENAME=m.FileWatermarkStore=m.GatedStructuredMerger=m.MergeShaclGate=m.splitSections=m.StructuredMerger=m.diff3=m.isSyncablePath=m.isFileSpaceSyncablePath=m.contentEquals=m.InMemoryQuarantineStore=m.DEFAULT_MAX_FILE_BYTES=m.orderChildrenFirst=m.isNonFastForwardError=m.SyncEngine=m.DEFAULT_MAX_PUSH_RETRIES=m.getTree=m.getHeadSha=m.getCommitInfo=m.getBlobText=m.getBlobBytes=m.gitBlobSha=m.extractAssetUid=m.detectChanges=void 0;fi(Jc(),m);fi(Zc(),m);var PH=$b();Object.defineProperty(m,"EFFORT_STATUS_OPTIONS",{enumerable:!0,get:a(function(){return PH.EFFORT_STATUS_OPTIONS},"get")});var CH=Vo();Object.defineProperty(m,"GroundingType",{enumerable:!0,get:a(function(){return CH.GroundingType},"get")});var _d=pf();Object.defineProperty(m,"GROUNDING_TYPE_UIDS",{enumerable:!0,get:a(function(){return _d.GROUNDING_TYPE_UIDS},"get")});Object.defineProperty(m,"GROUNDING_TYPE_UID_TO_ENUM",{enumerable:!0,get:a(function(){return _d.GROUNDING_TYPE_UID_TO_ENUM},"get")});Object.defineProperty(m,"GROUNDING_TYPE_IRI_TO_ENUM",{enumerable:!0,get:a(function(){return _d.GROUNDING_TYPE_IRI_TO_ENUM},"get")});Object.defineProperty(m,"resolveGroundingTypeFromIRI",{enumerable:!0,get:a(function(){return _d.resolveGroundingTypeFromIRI},"get")});Object.defineProperty(m,"resolveGroundingTypeFromWikilinkLiteral",{enumerable:!0,get:a(function(){return _d.resolveGroundingTypeFromWikilinkLiteral},"get")});var Sd=Ub();Object.defineProperty(m,"CommandProperty",{enumerable:!0,get:a(function(){return Sd.CommandProperty},"get")});Object.defineProperty(m,"PreconditionProperty",{enumerable:!0,get:a(function(){return Sd.PreconditionProperty},"get")});Object.defineProperty(m,"GroundingProperty",{enumerable:!0,get:a(function(){return Sd.GroundingProperty},"get")});Object.defineProperty(m,"CommandBindingProperty",{enumerable:!0,get:a(function(){return Sd.CommandBindingProperty},"get")});Object.defineProperty(m,"CommandBindingStyleProperty",{enumerable:!0,get:a(function(){return Sd.CommandBindingStyleProperty},"get")});var fu=Bb();Object.defineProperty(m,"COMMAND_VARIANT_VALUES",{enumerable:!0,get:a(function(){return fu.COMMAND_VARIANT_VALUES},"get")});Object.defineProperty(m,"LABEL_CLASS_VALUES",{enumerable:!0,get:a(function(){return fu.LABEL_CLASS_VALUES},"get")});Object.defineProperty(m,"STYLE_SOURCE_VALUES",{enumerable:!0,get:a(function(){return fu.STYLE_SOURCE_VALUES},"get")});Object.defineProperty(m,"isCommandVariant",{enumerable:!0,get:a(function(){return fu.isCommandVariant},"get")});Object.defineProperty(m,"isLabelClass",{enumerable:!0,get:a(function(){return fu.isLabelClass},"get")});Object.defineProperty(m,"isStyleSource",{enumerable:!0,get:a(function(){return fu.isStyleSource},"get")});var vy=TI();Object.defineProperty(m,"isCommandFrontmatter",{enumerable:!0,get:a(function(){return vy.isCommandFrontmatter},"get")});Object.defineProperty(m,"isPreconditionFrontmatter",{enumerable:!0,get:a(function(){return vy.isPreconditionFrontmatter},"get")});Object.defineProperty(m,"isGroundingFrontmatter",{enumerable:!0,get:a(function(){return vy.isGroundingFrontmatter},"get")});Object.defineProperty(m,"isCommandBindingFrontmatter",{enumerable:!0,get:a(function(){return vy.isCommandBindingFrontmatter},"get")});var OH=II();Object.defineProperty(m,"parseGroundingDefinitionFromFrontmatter",{enumerable:!0,get:a(function(){return OH.parseGroundingDefinitionFromFrontmatter},"get")});fi(xI(),m);fi(RI(),m);fi(Gb(),m);fi(qb(),m);fi(CI(),m);fi(FI(),m);fi(A_(),m);fi(dx(),m);var Yi=hx();Object.defineProperty(m,"TS_FLOOR_AS_UID_EXO",{enumerable:!0,get:a(function(){return Yi.TS_FLOOR_AS_UID_EXO},"get")});Object.defineProperty(m,"TS_FLOOR_AS_UID_EXOCMD",{enumerable:!0,get:a(function(){return Yi.TS_FLOOR_AS_UID_EXOCMD},"get")});Object.defineProperty(m,"TS_FLOOR_AS_UID_SHARED_IDENTITIES",{enumerable:!0,get:a(function(){return Yi.TS_FLOOR_AS_UID_SHARED_IDENTITIES},"get")});Object.defineProperty(m,"SDK_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Yi.SDK_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(m,"PLUGIN_UI_FLOOR_ASSETSPACE_UIDS",{enumerable:!0,get:a(function(){return Yi.PLUGIN_UI_FLOOR_ASSETSPACE_UIDS},"get")});Object.defineProperty(m,"SDK_FLOOR",{enumerable:!0,get:a(function(){return Yi.SDK_FLOOR},"get")});Object.defineProperty(m,"PLUGIN_UI_FLOOR",{enumerable:!0,get:a(function(){return Yi.PLUGIN_UI_FLOOR},"get")});Object.defineProperty(m,"CATALOG_KEEP_NAMESPACES",{enumerable:!0,get:a(function(){return Yi.CATALOG_KEEP_NAMESPACES},"get")});Object.defineProperty(m,"TsFloorViolationError",{enumerable:!0,get:a(function(){return Yi.TsFloorViolationError},"get")});Object.defineProperty(m,"assertTsFloor",{enumerable:!0,get:a(function(){return Yi.assertTsFloor},"get")});Object.defineProperty(m,"assertTsFloorReconciled",{enumerable:!0,get:a(function(){return Yi.assertTsFloorReconciled},"get")});var DH=px();Object.defineProperty(m,"transitiveDependsOnClosure",{enumerable:!0,get:a(function(){return DH.transitiveDependsOnClosure},"get")});var fO=lp();Object.defineProperty(m,"PropertyFieldType",{enumerable:!0,get:a(function(){return fO.PropertyFieldType},"get")});Object.defineProperty(m,"rangeToFieldType",{enumerable:!0,get:a(function(){return fO.rangeToFieldType},"get")});var cT=P_();Object.defineProperty(m,"propertyNameToUri",{enumerable:!0,get:a(function(){return cT.propertyNameToUri},"get")});Object.defineProperty(m,"uriToPropertyName",{enumerable:!0,get:a(function(){return cT.uriToPropertyName},"get")});Object.defineProperty(m,"extractPropertyLabel",{enumerable:!0,get:a(function(){return cT.extractPropertyLabel},"get")});var FH=tP();Object.defineProperty(m,"CommandResolver",{enumerable:!0,get:a(function(){return FH.CommandResolver},"get")});var LH=nP();Object.defineProperty(m,"PreconditionEvaluator",{enumerable:!0,get:a(function(){return LH.PreconditionEvaluator},"get")});var lT=iP();Object.defineProperty(m,"hasNonUidFilename",{enumerable:!0,get:a(function(){return lT.hasNonUidFilename},"get")});Object.defineProperty(m,"hasUidFilename",{enumerable:!0,get:a(function(){return lT.hasUidFilename},"get")});Object.defineProperty(m,"registerDefaultHostFunctions",{enumerable:!0,get:a(function(){return lT.registerDefaultHostFunctions},"get")});var dO=uP();Object.defineProperty(m,"GroundingExecutor",{enumerable:!0,get:a(function(){return dO.GroundingExecutor},"get")});Object.defineProperty(m,"ServiceRegistry",{enumerable:!0,get:a(function(){return dO.ServiceRegistry},"get")});var NH=fP();Object.defineProperty(m,"createVaultFrontmatterClassLabelResolver",{enumerable:!0,get:a(function(){return NH.createVaultFrontmatterClassLabelResolver},"get")});var kH=hP();Object.defineProperty(m,"NamedQueryRunner",{enumerable:!0,get:a(function(){return kH.NamedQueryRunner},"get")});var MH=Rp();Object.defineProperty(m,"iriToObsidianName",{enumerable:!0,get:a(function(){return MH.iriToObsidianName},"get")});var hO=pP();Object.defineProperty(m,"extractSparqlBlock",{enumerable:!0,get:a(function(){return hO.extractSparqlBlock},"get")});Object.defineProperty(m,"stripFrontmatter",{enumerable:!0,get:a(function(){return hO.stripFrontmatter},"get")});var jH=mP();Object.defineProperty(m,"CommandExecutionFlow",{enumerable:!0,get:a(function(){return jH.CommandExecutionFlow},"get")});var $H=n1();Object.defineProperty(m,"TaskStatusService",{enumerable:!0,get:a(function(){return $H.TaskStatusService},"get")});var UH=a1();Object.defineProperty(m,"AreaCreationService",{enumerable:!0,get:a(function(){return UH.AreaCreationService},"get")});var BH=l1();Object.defineProperty(m,"AreaHierarchyBuilder",{enumerable:!0,get:a(function(){return BH.AreaHierarchyBuilder},"get")});var VH=f1();Object.defineProperty(m,"ClassCreationService",{enumerable:!0,get:a(function(){return VH.ClassCreationService},"get")});var GH=h1();Object.defineProperty(m,"ConceptCreationService",{enumerable:!0,get:a(function(){return GH.ConceptCreationService},"get")});var qH=eg();Object.defineProperty(m,"EffortStatusWorkflow",{enumerable:!0,get:a(function(){return qH.EffortStatusWorkflow},"get")});var WH=Xf();Object.defineProperty(m,"WorkflowEngine",{enumerable:!0,get:a(function(){return WH.WorkflowEngine},"get")});var zH=Ww();Object.defineProperty(m,"WorkflowResolver",{enumerable:!0,get:a(function(){return zH.WorkflowResolver},"get")});var HH=CP();Object.defineProperty(m,"InstantiationRuleResolver",{enumerable:!0,get:a(function(){return HH.InstantiationRuleResolver},"get")});var KH=OP();Object.defineProperty(m,"VisibilityGenerator",{enumerable:!0,get:a(function(){return KH.VisibilityGenerator},"get")});var QH=DP();Object.defineProperty(m,"WorkflowCommandAdapter",{enumerable:!0,get:a(function(){return QH.WorkflowCommandAdapter},"get")});var XH=S1();Object.defineProperty(m,"EffortVotingService",{enumerable:!0,get:a(function(){return XH.EffortVotingService},"get")});var YH=T1();Object.defineProperty(m,"FolderRepairService",{enumerable:!0,get:a(function(){return YH.FolderRepairService},"get")});var JH=v1();Object.defineProperty(m,"extractAssetReference",{enumerable:!0,get:a(function(){return JH.extractAssetReference},"get")});var ZH=ra();Object.defineProperty(m,"LoggingService",{enumerable:!0,get:a(function(){return ZH.LoggingService},"get")});var eK=x1();Object.defineProperty(m,"PropertyCleanupService",{enumerable:!0,get:a(function(){return eK.PropertyCleanupService},"get")});var tK=P1();Object.defineProperty(m,"RenameToUidService",{enumerable:!0,get:a(function(){return tK.RenameToUidService},"get")});var rK=rg();Object.defineProperty(m,"StatusTimestampService",{enumerable:!0,get:a(function(){return rK.StatusTimestampService},"get")});var nK=D1();Object.defineProperty(m,"SupervisionCreationService",{enumerable:!0,get:a(function(){return nK.SupervisionCreationService},"get")});var iK=L1();Object.defineProperty(m,"DynamicFrontmatterGenerator",{enumerable:!0,get:a(function(){return iK.DynamicFrontmatterGenerator},"get")});var Ey=Hf();Object.defineProperty(m,"registerOrderSpecLoader",{enumerable:!0,get:a(function(){return Ey.registerOrderSpecLoader},"get")});Object.defineProperty(m,"clearOrderSpecLoader",{enumerable:!0,get:a(function(){return Ey.clearOrderSpecLoader},"get")});Object.defineProperty(m,"loadDefaultSpec",{enumerable:!0,get:a(function(){return Ey.loadDefaultSpec},"get")});Object.defineProperty(m,"orderProperties",{enumerable:!0,get:a(function(){return Ey.orderProperties},"get")});var sK=k1();Object.defineProperty(m,"AlgorithmExtractor",{enumerable:!0,get:a(function(){return sK.AlgorithmExtractor},"get")});var oK=j1();Object.defineProperty(m,"PlanningService",{enumerable:!0,get:a(function(){return oK.PlanningService},"get")});var aK=GP();Object.defineProperty(m,"PropertySchemaResolver",{enumerable:!0,get:a(function(){return aK.PropertySchemaResolver},"get")});var cK=qP();Object.defineProperty(m,"ClassHierarchyResolver",{enumerable:!0,get:a(function(){return cK.ClassHierarchyResolver},"get")});var lK=WP();Object.defineProperty(m,"EnumValueResolver",{enumerable:!0,get:a(function(){return lK.EnumValueResolver},"get")});var uK=G1();Object.defineProperty(m,"AssetConversionService",{enumerable:!0,get:a(function(){return uK.AssetConversionService},"get")});var fK=z1();Object.defineProperty(m,"SessionEventService",{enumerable:!0,get:a(function(){return fK.SessionEventService},"get")});var dK=Q1();Object.defineProperty(m,"URIConstructionService",{enumerable:!0,get:a(function(){return dK.URIConstructionService},"get")});var hK=Y1();Object.defineProperty(m,"GenericAssetCreationService",{enumerable:!0,get:a(function(){return hK.GenericAssetCreationService},"get")});var pK=tC();Object.defineProperty(m,"ArchiveAssetService",{enumerable:!0,get:a(function(){return pK.ArchiveAssetService},"get")});var mK=nC();Object.defineProperty(m,"FixMissingLabelService",{enumerable:!0,get:a(function(){return mK.FixMissingLabelService},"get")});var gK=iC();Object.defineProperty(m,"GraphQueryService",{enumerable:!0,get:a(function(){return gK.GraphQueryService},"get")});var yK=oC();Object.defineProperty(m,"TypeRegistry",{enumerable:!0,get:a(function(){return yK.TypeRegistry},"get")});var pO=aC();Object.defineProperty(m,"NLToSPARQLService",{enumerable:!0,get:a(function(){return pO.NLToSPARQLService},"get")});Object.defineProperty(m,"DEFAULT_NL_TO_SPARQL_CONFIG",{enumerable:!0,get:a(function(){return pO.DEFAULT_NL_TO_SPARQL_CONFIG},"get")});var di=rv();Object.defineProperty(m,"SPARQL_TEMPLATES",{enumerable:!0,get:a(function(){return di.SPARQL_TEMPLATES},"get")});Object.defineProperty(m,"SPARQL_PREFIXES",{enumerable:!0,get:a(function(){return di.SPARQL_PREFIXES},"get")});Object.defineProperty(m,"PREDICATES",{enumerable:!0,get:a(function(){return di.PREDICATES},"get")});Object.defineProperty(m,"ASSET_CLASSES",{enumerable:!0,get:a(function(){return di.ASSET_CLASSES},"get")});Object.defineProperty(m,"EFFORT_STATUSES",{enumerable:!0,get:a(function(){return di.EFFORT_STATUSES},"get")});Object.defineProperty(m,"KNOWN_PROTOTYPES",{enumerable:!0,get:a(function(){return di.KNOWN_PROTOTYPES},"get")});Object.defineProperty(m,"KNOWN_CLASSES",{enumerable:!0,get:a(function(){return di.KNOWN_CLASSES},"get")});Object.defineProperty(m,"findClassByTerm",{enumerable:!0,get:a(function(){return di.findClassByTerm},"get")});Object.defineProperty(m,"findMatchingTemplates",{enumerable:!0,get:a(function(){return di.findMatchingTemplates},"get")});Object.defineProperty(m,"fillTemplate",{enumerable:!0,get:a(function(){return di.fillTemplate},"get")});Object.defineProperty(m,"validateParameters",{enumerable:!0,get:a(function(){return di.validateParameters},"get")});Object.defineProperty(m,"getTemplateByName",{enumerable:!0,get:a(function(){return di.getTemplateByName},"get")});var mO=sv();Object.defineProperty(m,"CriticalityZoneService",{enumerable:!0,get:a(function(){return mO.CriticalityZoneService},"get")});Object.defineProperty(m,"CriticalityZoneUUIDs",{enumerable:!0,get:a(function(){return mO.CriticalityZoneUUIDs},"get")});var bK=vs();Object.defineProperty(m,"FrontmatterService",{enumerable:!0,get:a(function(){return bK.FrontmatterService},"get")});var _K=kn();Object.defineProperty(m,"DateFormatter",{enumerable:!0,get:a(function(){return _K.DateFormatter},"get")});var SK=eo();Object.defineProperty(m,"WikiLinkHelpers",{enumerable:!0,get:a(function(){return SK.WikiLinkHelpers},"get")});var wK=ho();Object.defineProperty(m,"MetadataHelpers",{enumerable:!0,get:a(function(){return wK.MetadataHelpers},"get")});var vK=s1();Object.defineProperty(m,"MetadataExtractor",{enumerable:!0,get:a(function(){return vK.MetadataExtractor},"get")});var EK=lC();Object.defineProperty(m,"EffortSortingHelpers",{enumerable:!0,get:a(function(){return EK.EffortSortingHelpers},"get")});var TK=uC();Object.defineProperty(m,"FilenameValidator",{enumerable:!0,get:a(function(){return TK.FilenameValidator},"get")});var AK=yC();Object.defineProperty(m,"RDFSerializer",{enumerable:!0,get:a(function(){return AK.RDFSerializer},"get")});var IK=rl();Object.defineProperty(m,"NullLogger",{enumerable:!0,get:a(function(){return IK.NullLogger},"get")});var uT=yv();Object.defineProperty(m,"vaultPathToIRI",{enumerable:!0,get:a(function(){return uT.vaultPathToIRI},"get")});Object.defineProperty(m,"iriToVaultPath",{enumerable:!0,get:a(function(){return uT.iriToVaultPath},"get")});Object.defineProperty(m,"OBSIDIAN_VAULT_SCHEME",{enumerable:!0,get:a(function(){return uT.OBSIDIAN_VAULT_SCHEME},"get")});var xK=Zw();Object.defineProperty(m,"InMemoryTripleStore",{enumerable:!0,get:a(function(){return xK.InMemoryTripleStore},"get")});var RK=Oe();Object.defineProperty(m,"DomainIRI",{enumerable:!0,get:a(function(){return RK.IRI},"get")});var PK=qe();Object.defineProperty(m,"DomainLiteral",{enumerable:!0,get:a(function(){return PK.Literal},"get")});var CK=Bt();Object.defineProperty(m,"DomainBlankNode",{enumerable:!0,get:a(function(){return CK.BlankNode},"get")});var OK=Wn();Object.defineProperty(m,"DomainTriple",{enumerable:!0,get:a(function(){return OK.Triple},"get")});var DK=_v();Object.defineProperty(m,"RDFVocabularyMapper",{enumerable:!0,get:a(function(){return DK.RDFVocabularyMapper},"get")});var FK=_C();Object.defineProperty(m,"RDFSInferenceEngine",{enumerable:!0,get:a(function(){return FK.RDFSInferenceEngine},"get")});var LK=Ev();Object.defineProperty(m,"NonInheritablePropertyRegistry",{enumerable:!0,get:a(function(){return LK.NonInheritablePropertyRegistry},"get")});var NK=Iv();Object.defineProperty(m,"PropertyCardinalityRegistry",{enumerable:!0,get:a(function(){return NK.PropertyCardinalityRegistry},"get")});var gO=Pv();Object.defineProperty(m,"PrototypeChainMaterializer",{enumerable:!0,get:a(function(){return gO.PrototypeChainMaterializer},"get")});Object.defineProperty(m,"INFERRED_GRAPH",{enumerable:!0,get:a(function(){return gO.INFERRED_GRAPH},"get")});var kK=IC();Object.defineProperty(m,"IRICanonicalizer",{enumerable:!0,get:a(function(){return kK.IRICanonicalizer},"get")});var yO=Sg();Object.defineProperty(m,"derivePath",{enumerable:!0,get:a(function(){return yO.derivePath},"get")});Object.defineProperty(m,"deriveLegacyFlatPath",{enumerable:!0,get:a(function(){return yO.deriveLegacyFlatPath},"get")});var fT=wg();Object.defineProperty(m,"discoverFileSpaceExclusions",{enumerable:!0,get:a(function(){return fT.discoverFileSpaceExclusions},"get")});Object.defineProperty(m,"frontmatterDeclaresFileSpace",{enumerable:!0,get:a(function(){return fT.frontmatterDeclaresFileSpace},"get")});Object.defineProperty(m,"FILE_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return fT.FILE_SPACE_CLASS_UID},"get")});var bO=FC();Object.defineProperty(m,"LazyAssetGraphLoader",{enumerable:!0,get:a(function(){return bO.LazyAssetGraphLoader},"get")});Object.defineProperty(m,"MAX_LAZY_DEPTH",{enumerable:!0,get:a(function(){return bO.MAX_LAZY_DEPTH},"get")});var _O=Nv();Object.defineProperty(m,"SourceAnnotator",{enumerable:!0,get:a(function(){return _O.SourceAnnotator},"get")});Object.defineProperty(m,"SOURCE_VARIABLE",{enumerable:!0,get:a(function(){return _O.SOURCE_VARIABLE},"get")});var dT=jv();Object.defineProperty(m,"NoteToRDFConverter",{enumerable:!0,get:a(function(){return dT.NoteToRDFConverter},"get")});Object.defineProperty(m,"normaliseExcludedFolders",{enumerable:!0,get:a(function(){return dT.normaliseExcludedFolders},"get")});Object.defineProperty(m,"isPathExcluded",{enumerable:!0,get:a(function(){return dT.isPathExcluded},"get")});var hT=pl();Object.defineProperty(m,"ExoQLParser",{enumerable:!0,get:a(function(){return hT.ExoQLParser},"get")});Object.defineProperty(m,"SPARQLParser",{enumerable:!0,get:a(function(){return hT.SPARQLParser},"get")});Object.defineProperty(m,"SPARQLParseError",{enumerable:!0,get:a(function(){return hT.SPARQLParseError},"get")});var SO=RS();Object.defineProperty(m,"DescribeOptionsTransformer",{enumerable:!0,get:a(function(){return SO.DescribeOptionsTransformer},"get")});Object.defineProperty(m,"DescribeOptionsTransformerError",{enumerable:!0,get:a(function(){return SO.DescribeOptionsTransformerError},"get")});var wO=gl();Object.defineProperty(m,"ExoQLAlgebraTranslator",{enumerable:!0,get:a(function(){return wO.ExoQLAlgebraTranslator},"get")});Object.defineProperty(m,"AlgebraTranslator",{enumerable:!0,get:a(function(){return wO.AlgebraTranslator},"get")});var MK=UC();Object.defineProperty(m,"AlgebraOptimizer",{enumerable:!0,get:a(function(){return MK.AlgebraOptimizer},"get")});var jK=BC();Object.defineProperty(m,"AlgebraSerializer",{enumerable:!0,get:a(function(){return jK.AlgebraSerializer},"get")});var $K=zS();Object.defineProperty(m,"BGPExecutor",{enumerable:!0,get:a(function(){return $K.BGPExecutor},"get")});var UK=bm();Object.defineProperty(m,"FilterExecutor",{enumerable:!0,get:a(function(){return UK.FilterExecutor},"get")});var BK=fw();Object.defineProperty(m,"OptionalExecutor",{enumerable:!0,get:a(function(){return BK.OptionalExecutor},"get")});var VK=hw();Object.defineProperty(m,"UnionExecutor",{enumerable:!0,get:a(function(){return VK.UnionExecutor},"get")});var GK=Ew();Object.defineProperty(m,"ConstructExecutor",{enumerable:!0,get:a(function(){return GK.ConstructExecutor},"get")});var qK=GC();Object.defineProperty(m,"DescribeExecutor",{enumerable:!0,get:a(function(){return qK.DescribeExecutor},"get")});var vO=Ml();Object.defineProperty(m,"ExoQLQueryExecutor",{enumerable:!0,get:a(function(){return vO.ExoQLQueryExecutor},"get")});Object.defineProperty(m,"QueryExecutor",{enumerable:!0,get:a(function(){return vO.QueryExecutor},"get")});var EO=WC();Object.defineProperty(m,"UpdateExecutor",{enumerable:!0,get:a(function(){return EO.UpdateExecutor},"get")});Object.defineProperty(m,"UpdateExecutorError",{enumerable:!0,get:a(function(){return EO.UpdateExecutorError},"get")});var WK=bs();Object.defineProperty(m,"SolutionMapping",{enumerable:!0,get:a(function(){return WK.SolutionMapping},"get")});var zK=ym();Object.defineProperty(m,"BuiltInFunctions",{enumerable:!0,get:a(function(){return zK.BuiltInFunctions},"get")});var HK=HC();Object.defineProperty(m,"AggregateFunctions",{enumerable:!0,get:a(function(){return HK.AggregateFunctions},"get")});var TO=gw();Object.defineProperty(m,"CustomAggregateRegistry",{enumerable:!0,get:a(function(){return TO.CustomAggregateRegistry},"get")});Object.defineProperty(m,"CustomAggregateError",{enumerable:!0,get:a(function(){return TO.CustomAggregateError},"get")});var Ns=yw();Object.defineProperty(m,"BUILT_IN_AGGREGATES",{enumerable:!0,get:a(function(){return Ns.BUILT_IN_AGGREGATES},"get")});Object.defineProperty(m,"EXO_AGGREGATE_NS",{enumerable:!0,get:a(function(){return Ns.EXO_AGGREGATE_NS},"get")});Object.defineProperty(m,"medianAggregate",{enumerable:!0,get:a(function(){return Ns.medianAggregate},"get")});Object.defineProperty(m,"varianceAggregate",{enumerable:!0,get:a(function(){return Ns.varianceAggregate},"get")});Object.defineProperty(m,"stddevAggregate",{enumerable:!0,get:a(function(){return Ns.stddevAggregate},"get")});Object.defineProperty(m,"modeAggregate",{enumerable:!0,get:a(function(){return Ns.modeAggregate},"get")});Object.defineProperty(m,"createPercentileAggregate",{enumerable:!0,get:a(function(){return Ns.createPercentileAggregate},"get")});Object.defineProperty(m,"getNumericValue",{enumerable:!0,get:a(function(){return Ns.getNumericValue},"get")});Object.defineProperty(m,"createDecimalLiteral",{enumerable:!0,get:a(function(){return Ns.createDecimalLiteral},"get")});Object.defineProperty(m,"createDoubleLiteral",{enumerable:!0,get:a(function(){return Ns.createDoubleLiteral},"get")});var KK=KC();Object.defineProperty(m,"QueryPlanCache",{enumerable:!0,get:a(function(){return KK.QueryPlanCache},"get")});var AO=QC();Object.defineProperty(m,"SPARQLResultCache",{enumerable:!0,get:a(function(){return AO.SPARQLResultCache},"get")});Object.defineProperty(m,"createSPARQLResultCache",{enumerable:!0,get:a(function(){return AO.createSPARQLResultCache},"get")});var IO=XC();Object.defineProperty(m,"IncrementalIndexer",{enumerable:!0,get:a(function(){return IO.IncrementalIndexer},"get")});Object.defineProperty(m,"createIncrementalIndexer",{enumerable:!0,get:a(function(){return IO.createIncrementalIndexer},"get")});var QK=YC();Object.defineProperty(m,"ResultSerializer",{enumerable:!0,get:a(function(){return QK.ResultSerializer},"get")});var xO=AS();Object.defineProperty(m,"CaseWhenTransformer",{enumerable:!0,get:a(function(){return xO.CaseWhenTransformer},"get")});Object.defineProperty(m,"CaseWhenTransformerError",{enumerable:!0,get:a(function(){return xO.CaseWhenTransformerError},"get")});var XK=DS();Object.defineProperty(m,"VaultPrefixTransformer",{enumerable:!0,get:a(function(){return XK.VaultPrefixTransformer},"get")});var YK=Uv();Object.defineProperty(m,"FilterContainsOptimizer",{enumerable:!0,get:a(function(){return YK.FilterContainsOptimizer},"get")});var RO=JC();Object.defineProperty(m,"FileNotFoundError",{enumerable:!0,get:a(function(){return RO.FileNotFoundError},"get")});Object.defineProperty(m,"FileAlreadyExistsError",{enumerable:!0,get:a(function(){return RO.FileAlreadyExistsError},"get")});var pT=Qw();Object.defineProperty(m,"TripleAlreadyExistsError",{enumerable:!0,get:a(function(){return pT.TripleAlreadyExistsError},"get")});Object.defineProperty(m,"TripleNotFoundError",{enumerable:!0,get:a(function(){return pT.TripleNotFoundError},"get")});Object.defineProperty(m,"TransactionError",{enumerable:!0,get:a(function(){return pT.TransactionError},"get")});var PO=qf();Object.defineProperty(m,"liveClock",{enumerable:!0,get:a(function(){return PO.liveClock},"get")});Object.defineProperty(m,"frozenClock",{enumerable:!0,get:a(function(){return PO.frozenClock},"get")});var CO=km();Object.defineProperty(m,"liveUidGenerator",{enumerable:!0,get:a(function(){return CO.liveUidGenerator},"get")});Object.defineProperty(m,"seededUidGenerator",{enumerable:!0,get:a(function(){return CO.seededUidGenerator},"get")});var Ty=Zv();Object.defineProperty(m,"VaultSettings",{enumerable:!0,get:a(function(){return Ty.VaultSettings},"get")});Object.defineProperty(m,"DEFAULT_OWNER_IDENTITY",{enumerable:!0,get:a(function(){return Ty.DEFAULT_OWNER_IDENTITY},"get")});Object.defineProperty(m,"DEFAULT_INBOX_FOLDER",{enumerable:!0,get:a(function(){return Ty.DEFAULT_INBOX_FOLDER},"get")});Object.defineProperty(m,"DEFAULT_FLEETING_NOTE_CLASS_UID",{enumerable:!0,get:a(function(){return Ty.DEFAULT_FLEETING_NOTE_CLASS_UID},"get")});var JK=qt();Object.defineProperty(m,"DI_TOKENS",{enumerable:!0,get:a(function(){return JK.DI_TOKENS},"get")});var wd=ZC();Object.defineProperty(m,"registerCoreServices",{enumerable:!0,get:a(function(){return wd.registerCoreServices},"get")});Object.defineProperty(m,"createChildContainer",{enumerable:!0,get:a(function(){return wd.createChildContainer},"get")});Object.defineProperty(m,"getContainer",{enumerable:!0,get:a(function(){return wd.getContainer},"get")});Object.defineProperty(m,"resetContainer",{enumerable:!0,get:a(function(){return wd.resetContainer},"get")});Object.defineProperty(m,"container",{enumerable:!0,get:a(function(){return wd.container},"get")});var xo=s3();Object.defineProperty(m,"NODE_FLAGS",{enumerable:!0,get:a(function(){return xo.NODE_FLAGS},"get")});Object.defineProperty(m,"DEFAULT_COLORS",{enumerable:!0,get:a(function(){return xo.DEFAULT_COLORS},"get")});Object.defineProperty(m,"StringTable",{enumerable:!0,get:a(function(){return xo.StringTable},"get")});Object.defineProperty(m,"CompactGraphStore",{enumerable:!0,get:a(function(){return xo.CompactGraphStore},"get")});Object.defineProperty(m,"MemoryPool",{enumerable:!0,get:a(function(){return xo.MemoryPool},"get")});Object.defineProperty(m,"getGlobalPool",{enumerable:!0,get:a(function(){return xo.getGlobalPool},"get")});Object.defineProperty(m,"resetGlobalPool",{enumerable:!0,get:a(function(){return xo.resetGlobalPool},"get")});Object.defineProperty(m,"StreamingLoader",{enumerable:!0,get:a(function(){return xo.StreamingLoader},"get")});Object.defineProperty(m,"createStreamingSource",{enumerable:!0,get:a(function(){return xo.createStreamingSource},"get")});var OO=o3();Object.defineProperty(m,"ExoQL",{enumerable:!0,get:a(function(){return OO.ExoQL},"get")});Object.defineProperty(m,"ExoQLError",{enumerable:!0,get:a(function(){return OO.ExoQLError},"get")});var vd=fE();Object.defineProperty(m,"LAYOUT_CLASS_IRI",{enumerable:!0,get:a(function(){return vd.LAYOUT_CLASS_IRI},"get")});Object.defineProperty(m,"LAYOUT_CLASS_UID",{enumerable:!0,get:a(function(){return vd.LAYOUT_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutFromFrontmatter",{enumerable:!0,get:a(function(){return vd.createLayoutFromFrontmatter},"get")});Object.defineProperty(m,"isLayout",{enumerable:!0,get:a(function(){return vd.isLayout},"get")});Object.defineProperty(m,"isLayoutFrontmatter",{enumerable:!0,get:a(function(){return vd.isLayoutFrontmatter},"get")});var ma=fE();Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return ma.BACKLINKS_TABLE_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"BACKLINKS_TABLE_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return ma.BACKLINKS_TABLE_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_IRI",{enumerable:!0,get:a(function(){return ma.PROPERTIES_BLOCK_CLASS_IRI},"get")});Object.defineProperty(m,"PROPERTIES_BLOCK_CLASS_UID",{enumerable:!0,get:a(function(){return ma.PROPERTIES_BLOCK_CLASS_UID},"get")});Object.defineProperty(m,"createLayoutBlockFromFrontmatter",{enumerable:!0,get:a(function(){return ma.createLayoutBlockFromFrontmatter},"get")});Object.defineProperty(m,"isBacklinksTableBlock",{enumerable:!0,get:a(function(){return ma.isBacklinksTableBlock},"get")});Object.defineProperty(m,"isLayoutBlockFrontmatter",{enumerable:!0,get:a(function(){return ma.isLayoutBlockFrontmatter},"get")});Object.defineProperty(m,"isPropertiesBlock",{enumerable:!0,get:a(function(){return ma.isPropertiesBlock},"get")});var DO=h3();Object.defineProperty(m,"LayoutSelector",{enumerable:!0,get:a(function(){return DO.LayoutSelector},"get")});Object.defineProperty(m,"selectByPriority",{enumerable:!0,get:a(function(){return DO.selectByPriority},"get")});fi(v3(),m);var ZK=AE();Object.defineProperty(m,"ShapeLoader",{enumerable:!0,get:a(function(){return ZK.ShapeLoader},"get")});var eQ=vE();Object.defineProperty(m,"ShapeRegistry",{enumerable:!0,get:a(function(){return eQ.ShapeRegistry},"get")});var tQ=Jt();Object.defineProperty(m,"Namespace",{enumerable:!0,get:a(function(){return tQ.Namespace},"get")});var FO=Zg();Object.defineProperty(m,"shaclValidate",{enumerable:!0,get:a(function(){return FO.validate},"get")});Object.defineProperty(m,"ShaclShapeRegistry",{enumerable:!0,get:a(function(){return FO.ShapeRegistry},"get")});fi(T3(),m);var mT=I3();Object.defineProperty(m,"ValidatorDaemon",{enumerable:!0,get:a(function(){return mT.ValidatorDaemon},"get")});Object.defineProperty(m,"DEFAULT_SOCKET_PATH",{enumerable:!0,get:a(function(){return mT.DEFAULT_SOCKET_PATH},"get")});Object.defineProperty(m,"IDLE_TIMEOUT_MS",{enumerable:!0,get:a(function(){return mT.IDLE_TIMEOUT_MS},"get")});var rQ=OE();Object.defineProperty(m,"TripleClassHierarchy",{enumerable:!0,get:a(function(){return rQ.ClassHierarchy},"get")});var LO=LE();Object.defineProperty(m,"parseTarball",{enumerable:!0,get:a(function(){return LO.parseTarball},"get")});Object.defineProperty(m,"parseTarballGzip",{enumerable:!0,get:a(function(){return LO.parseTarballGzip},"get")});var NO=sy();Object.defineProperty(m,"restCreateCommit",{enumerable:!0,get:a(function(){return NO.restCreateCommit},"get")});Object.defineProperty(m,"isBinaryPayload",{enumerable:!0,get:a(function(){return NO.isBinaryPayload},"get")});var du=F3();Object.defineProperty(m,"mountAssetSpaceFiles",{enumerable:!0,get:a(function(){return du.mountAssetSpaceFiles},"get")});Object.defineProperty(m,"discoverAssetSpaceWrapperDir",{enumerable:!0,get:a(function(){return du.discoverWrapperDir},"get")});Object.defineProperty(m,"extractAssetSpaceSha",{enumerable:!0,get:a(function(){return du.extractShaFromWrapper},"get")});Object.defineProperty(m,"appendGitmodulesEntry",{enumerable:!0,get:a(function(){return du.appendGitmodulesEntry},"get")});Object.defineProperty(m,"stripGitmodulesEntry",{enumerable:!0,get:a(function(){return du.stripGitmodulesEntry},"get")});Object.defineProperty(m,"escapeGitmodulesRegex",{enumerable:!0,get:a(function(){return du.escapeGitmodulesRegex},"get")});var kO=UE();Object.defineProperty(m,"detectChanges",{enumerable:!0,get:a(function(){return kO.detectChanges},"get")});Object.defineProperty(m,"extractAssetUid",{enumerable:!0,get:a(function(){return kO.extractAssetUid},"get")});var nQ=ld();Object.defineProperty(m,"gitBlobSha",{enumerable:!0,get:a(function(){return nQ.gitBlobSha},"get")});var Ed=fd();Object.defineProperty(m,"getBlobBytes",{enumerable:!0,get:a(function(){return Ed.getBlobBytes},"get")});Object.defineProperty(m,"getBlobText",{enumerable:!0,get:a(function(){return Ed.getBlobText},"get")});Object.defineProperty(m,"getCommitInfo",{enumerable:!0,get:a(function(){return Ed.getCommitInfo},"get")});Object.defineProperty(m,"getHeadSha",{enumerable:!0,get:a(function(){return Ed.getHeadSha},"get")});Object.defineProperty(m,"getTree",{enumerable:!0,get:a(function(){return Ed.getTree},"get")});var Ay=WE();Object.defineProperty(m,"DEFAULT_MAX_PUSH_RETRIES",{enumerable:!0,get:a(function(){return Ay.DEFAULT_MAX_PUSH_RETRIES},"get")});Object.defineProperty(m,"SyncEngine",{enumerable:!0,get:a(function(){return Ay.SyncEngine},"get")});Object.defineProperty(m,"isNonFastForwardError",{enumerable:!0,get:a(function(){return Ay.isNonFastForwardError},"get")});Object.defineProperty(m,"orderChildrenFirst",{enumerable:!0,get:a(function(){return Ay.orderChildrenFirst},"get")});var Td=hy();Object.defineProperty(m,"DEFAULT_MAX_FILE_BYTES",{enumerable:!0,get:a(function(){return Td.DEFAULT_MAX_FILE_BYTES},"get")});Object.defineProperty(m,"InMemoryQuarantineStore",{enumerable:!0,get:a(function(){return Td.InMemoryQuarantineStore},"get")});Object.defineProperty(m,"contentEquals",{enumerable:!0,get:a(function(){return Td.contentEquals},"get")});Object.defineProperty(m,"isFileSpaceSyncablePath",{enumerable:!0,get:a(function(){return Td.isFileSpaceSyncablePath},"get")});Object.defineProperty(m,"isSyncablePath",{enumerable:!0,get:a(function(){return Td.isSyncablePath},"get")});var iQ=KE();Object.defineProperty(m,"diff3",{enumerable:!0,get:a(function(){return iQ.diff3},"get")});var MO=W3();Object.defineProperty(m,"StructuredMerger",{enumerable:!0,get:a(function(){return MO.StructuredMerger},"get")});Object.defineProperty(m,"splitSections",{enumerable:!0,get:a(function(){return MO.splitSections},"get")});var sQ=z3();Object.defineProperty(m,"MergeShaclGate",{enumerable:!0,get:a(function(){return sQ.MergeShaclGate},"get")});var oQ=H3();Object.defineProperty(m,"GatedStructuredMerger",{enumerable:!0,get:a(function(){return oQ.GatedStructuredMerger},"get")});var jO=K3();Object.defineProperty(m,"FileWatermarkStore",{enumerable:!0,get:a(function(){return jO.FileWatermarkStore},"get")});Object.defineProperty(m,"WATERMARK_STORE_FILENAME",{enumerable:!0,get:a(function(){return jO.WATERMARK_STORE_FILENAME},"get")});var aQ=cy();Object.defineProperty(m,"isAuthError",{enumerable:!0,get:a(function(){return aQ.isAuthError},"get")});var $O=dy();Object.defineProperty(m,"isRateLimitError",{enumerable:!0,get:a(function(){return $O.isRateLimitError},"get")});Object.defineProperty(m,"withRateLimitBackoff",{enumerable:!0,get:a(function(){return $O.withRateLimitBackoff},"get")});var UO=uy();Object.defineProperty(m,"redactSecrets",{enumerable:!0,get:a(function(){return UO.redactSecrets},"get")});Object.defineProperty(m,"scanForSecrets",{enumerable:!0,get:a(function(){return UO.scanForSecrets},"get")});var cQ=Y3();Object.defineProperty(m,"SyncedQuarantineStore",{enumerable:!0,get:a(function(){return cQ.SyncedQuarantineStore},"get")});var ga=iO();Object.defineProperty(m,"ASSET_SPACE_CLASS_UID",{enumerable:!0,get:a(function(){return ga.ASSET_SPACE_CLASS_UID},"get")});Object.defineProperty(m,"SYNC_BRANCH",{enumerable:!0,get:a(function(){return ga.SYNC_BRANCH},"get")});Object.defineProperty(m,"SpaceSpecAccumulator",{enumerable:!0,get:a(function(){return ga.SpaceSpecAccumulator},"get")});Object.defineProperty(m,"classifySpaceDeclaration",{enumerable:!0,get:a(function(){return ga.classifySpaceDeclaration},"get")});Object.defineProperty(m,"isAssetSpaceFrontmatter",{enumerable:!0,get:a(function(){return ga.isAssetSpaceFrontmatter},"get")});Object.defineProperty(m,"isFileSpaceFrontmatter",{enumerable:!0,get:a(function(){return ga.isFileSpaceFrontmatter},"get")});Object.defineProperty(m,"parseStrictGitHubRepoURL",{enumerable:!0,get:a(function(){return ga.parseStrictGitHubRepoURL},"get")});Object.defineProperty(m,"readSpaceSource",{enumerable:!0,get:a(function(){return ga.readSpaceSource},"get")});var BO=uO();Object.defineProperty(m,"ParityValidator",{enumerable:!0,get:a(function(){return BO.ParityValidator},"get")});Object.defineProperty(m,"summarizeParityRound",{enumerable:!0,get:a(function(){return BO.summarizeParityRound},"get")});var VO=oT();Object.defineProperty(m,"compareAssetSemantics",{enumerable:!0,get:a(function(){return VO.compareAssetSemantics},"get")});Object.defineProperty(m,"isFormatOnlyDrift",{enumerable:!0,get:a(function(){return VO.isFormatOnlyDrift},"get")})});var Ir=w(gT=>{"use strict";gT.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})};gT.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 qO=w((Zge,GO)=>{var ya=require("constants"),lQ=process.cwd,Iy=null,uQ=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Iy||(Iy=lQ.call(process)),Iy};try{process.cwd()}catch{}typeof process.chdir=="function"&&(yT=process.chdir,process.chdir=function(n){Iy=null,yT.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,yT));var yT;GO.exports=fQ;function fQ(n){ya.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=o(n.chownSync),n.fchownSync=o(n.fchownSync),n.lchownSync=o(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,d,h){h&&process.nextTick(h)},n.lchmodSync=function(){}),n.chown&&!n.lchown&&(n.lchown=function(f,d,h,p){p&&process.nextTick(p)},n.lchownSync=function(){}),uQ==="win32"&&(n.rename=typeof n.rename!="function"?n.rename:(function(f){function d(h,p,y){var g=Date.now(),v=0;f(h,p,a(function _(S){if(S&&(S.code==="EACCES"||S.code==="EPERM"||S.code==="EBUSY")&&Date.now()-g<6e4){setTimeout(function(){n.stat(p,function(T,I){T&&T.code==="ENOENT"?f(h,p,_):y(S)})},v),v<100&&(v+=10);return}y&&y(S)},"CB"))}return a(d,"rename"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.rename)),n.read=typeof n.read!="function"?n.read:(function(f){function d(h,p,y,g,v,_){var S;if(_&&typeof _=="function"){var T=0;S=a(function(I,A,R){if(I&&I.code==="EAGAIN"&&T<10)return T++,f.call(n,h,p,y,g,v,S);_.apply(this,arguments)},"callback")}return f.call(n,h,p,y,g,v,S)}return a(d,"read"),Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(n.read),n.readSync=typeof n.readSync!="function"?n.readSync:(function(f){return function(d,h,p,y,g){for(var v=0;;)try{return f.call(n,d,h,p,y,g)}catch(_){if(_.code==="EAGAIN"&&v<10){v++;continue}throw _}}})(n.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,ya.O_WRONLY|ya.O_SYMLINK,h,function(y,g){if(y){p&&p(y);return}f.fchmod(g,h,function(v){f.close(g,function(_){p&&p(v||_)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,ya.O_WRONLY|ya.O_SYMLINK,h),y=!0,g;try{g=f.fchmodSync(p,h),y=!1}finally{if(y)try{f.closeSync(p)}catch{}else f.closeSync(p)}return g}}a(e,"patchLchmod");function t(f){ya.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,y){f.open(d,ya.O_SYMLINK,function(g,v){if(g){y&&y(g);return}f.futimes(v,h,p,function(_){f.close(v,function(S){y&&y(_||S)})})})},f.lutimesSync=function(d,h,p){var y=f.openSync(d,ya.O_SYMLINK),g,v=!0;try{g=f.futimesSync(y,h,p),v=!1}finally{if(v)try{f.closeSync(y)}catch{}else f.closeSync(y)}return g}):f.futimes&&(f.lutimes=function(d,h,p,y){y&&process.nextTick(y)},f.lutimesSync=function(){})}a(t,"patchLutimes");function r(f){return f&&function(d,h,p){return f.call(n,d,h,function(y){u(y)&&(y=null),p&&p.apply(this,arguments)})}}a(r,"chmodFix");function i(f){return f&&function(d,h){try{return f.call(n,d,h)}catch(p){if(!u(p))throw p}}}a(i,"chmodFixSync");function s(f){return f&&function(d,h,p,y){return f.call(n,d,h,p,function(g){u(g)&&(g=null),y&&y.apply(this,arguments)})}}a(s,"chownFix");function o(f){return f&&function(d,h,p){try{return f.call(n,d,h,p)}catch(y){if(!u(y))throw y}}}a(o,"chownFixSync");function c(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function y(g,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),p&&p.apply(this,arguments)}return a(y,"callback"),h?f.call(n,d,h,y):f.call(n,d,y)}}a(c,"statFix");function l(f){return f&&function(d,h){var p=h?f.call(n,d,h):f.call(n,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}a(l,"statFixSync");function u(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}a(u,"chownErOk")}a(fQ,"patch")});var HO=w((tye,zO)=>{var WO=require("stream").Stream;zO.exports=dQ;function dQ(n){return{ReadStream:e,WriteStream:t};function e(r,i){if(!(this instanceof e))return new e(r,i);WO.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 o=Object.keys(i),c=0,l=o.length;c<l;c++){var u=o[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,d){if(f){s.emit("error",f),s.readable=!1;return}s.fd=d,s.emit("open",d),s._read()})}function t(r,i){if(!(this instanceof t))return new t(r,i);WO.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),o=0,c=s.length;o<c;o++){var l=s[o];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())}}a(dQ,"legacy")});var QO=w((nye,KO)=>{"use strict";KO.exports=pQ;var hQ=Object.getPrototypeOf||function(n){return n.__proto__};function pQ(n){if(n===null||typeof n!="object")return n;if(n instanceof Object)var e={__proto__:hQ(n)};else var e=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}a(pQ,"clone")});var pu=w((sye,ST)=>{var zt=require("fs"),mQ=qO(),gQ=HO(),yQ=QO(),xy=require("util"),Gr,Py;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Gr=Symbol.for("graceful-fs.queue"),Py=Symbol.for("graceful-fs.previous")):(Gr="___graceful-fs.queue",Py="___graceful-fs.previous");function bQ(){}a(bQ,"noop");function JO(n,e){Object.defineProperty(n,Gr,{get:a(function(){return e},"get")})}a(JO,"publishQueue");var Tc=bQ;xy.debuglog?Tc=xy.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Tc=a(function(){var n=xy.format.apply(xy,arguments);n="GFS4: "+n.split(/\n/).join(`
480
480
  GFS4: `),console.error(n)},"debug"));zt[Gr]||(XO=global[Gr]||[],JO(zt,XO),zt.close=(function(n){function e(t,r){return n.call(zt,t,function(i){i||YO(),typeof r=="function"&&r.apply(this,arguments)})}return a(e,"close"),Object.defineProperty(e,Py,{value:n}),e})(zt.close),zt.closeSync=(function(n){function e(t){n.apply(zt,arguments),YO()}return a(e,"closeSync"),Object.defineProperty(e,Py,{value:n}),e})(zt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Tc(zt[Gr]),require("assert").equal(zt[Gr].length,0)}));var XO;global[Gr]||JO(global,zt[Gr]);ST.exports=bT(yQ(zt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!zt.__patched&&(ST.exports=bT(zt),zt.__patched=!0);function bT(n){mQ(n),n.gracefulify=bT,n.createReadStream=A,n.createWriteStream=R;var e=n.readFile;n.readFile=t;function t(C,O,k){return typeof O=="function"&&(k=O,O=null),H(C,O,k);function H(G,B,Z,_e){return e(G,B,function(ie){ie&&(ie.code==="EMFILE"||ie.code==="ENFILE")?hu([H,[G,B,Z],ie,_e||Date.now(),Date.now()]):typeof Z=="function"&&Z.apply(this,arguments)})}a(H,"go$readFile")}a(t,"readFile");var r=n.writeFile;n.writeFile=i;function i(C,O,k,H){return typeof k=="function"&&(H=k,k=null),G(C,O,k,H);function G(B,Z,_e,ie,N){return r(B,Z,_e,function(j){j&&(j.code==="EMFILE"||j.code==="ENFILE")?hu([G,[B,Z,_e,ie],j,N||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(G,"go$writeFile")}a(i,"writeFile");var s=n.appendFile;s&&(n.appendFile=o);function o(C,O,k,H){return typeof k=="function"&&(H=k,k=null),G(C,O,k,H);function G(B,Z,_e,ie,N){return s(B,Z,_e,function(j){j&&(j.code==="EMFILE"||j.code==="ENFILE")?hu([G,[B,Z,_e,ie],j,N||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(G,"go$appendFile")}a(o,"appendFile");var c=n.copyFile;c&&(n.copyFile=l);function l(C,O,k,H){return typeof k=="function"&&(H=k,k=0),G(C,O,k,H);function G(B,Z,_e,ie,N){return c(B,Z,_e,function(j){j&&(j.code==="EMFILE"||j.code==="ENFILE")?hu([G,[B,Z,_e,ie],j,N||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(G,"go$copyFile")}a(l,"copyFile");var u=n.readdir;n.readdir=d;var f=/^v[0-5]\./;function d(C,O,k){typeof O=="function"&&(k=O,O=null);var H=f.test(process.version)?a(function(Z,_e,ie,N){return u(Z,G(Z,_e,ie,N))},"go$readdir"):a(function(Z,_e,ie,N){return u(Z,_e,G(Z,_e,ie,N))},"go$readdir");return H(C,O,k);function G(B,Z,_e,ie){return function(N,j){N&&(N.code==="EMFILE"||N.code==="ENFILE")?hu([H,[B,Z,_e],N,ie||Date.now(),Date.now()]):(j&&j.sort&&j.sort(),typeof _e=="function"&&_e.call(this,N,j))}}}if(a(d,"readdir"),process.version.substr(0,4)==="v0.8"){var h=gQ(n);_=h.ReadStream,T=h.WriteStream}var p=n.ReadStream;p&&(_.prototype=Object.create(p.prototype),_.prototype.open=S);var y=n.WriteStream;y&&(T.prototype=Object.create(y.prototype),T.prototype.open=I),Object.defineProperty(n,"ReadStream",{get:a(function(){return _},"get"),set:a(function(C){_=C},"set"),enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:a(function(){return T},"get"),set:a(function(C){T=C},"set"),enumerable:!0,configurable:!0});var g=_;Object.defineProperty(n,"FileReadStream",{get:a(function(){return g},"get"),set:a(function(C){g=C},"set"),enumerable:!0,configurable:!0});var v=T;Object.defineProperty(n,"FileWriteStream",{get:a(function(){return v},"get"),set:a(function(C){v=C},"set"),enumerable:!0,configurable:!0});function _(C,O){return this instanceof _?(p.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}a(_,"ReadStream");function S(){var C=this;Y(C.path,C.flags,C.mode,function(O,k){O?(C.autoClose&&C.destroy(),C.emit("error",O)):(C.fd=k,C.emit("open",k),C.read())})}a(S,"ReadStream$open");function T(C,O){return this instanceof T?(y.apply(this,arguments),this):T.apply(Object.create(T.prototype),arguments)}a(T,"WriteStream");function I(){var C=this;Y(C.path,C.flags,C.mode,function(O,k){O?(C.destroy(),C.emit("error",O)):(C.fd=k,C.emit("open",k))})}a(I,"WriteStream$open");function A(C,O){return new n.ReadStream(C,O)}a(A,"createReadStream");function R(C,O){return new n.WriteStream(C,O)}a(R,"createWriteStream");var q=n.open;n.open=Y;function Y(C,O,k,H){return typeof k=="function"&&(H=k,k=null),G(C,O,k,H);function G(B,Z,_e,ie,N){return q(B,Z,_e,function(j,se){j&&(j.code==="EMFILE"||j.code==="ENFILE")?hu([G,[B,Z,_e,ie],j,N||Date.now(),Date.now()]):typeof ie=="function"&&ie.apply(this,arguments)})}a(G,"go$open")}return a(Y,"open"),n}a(bT,"patch");function hu(n){Tc("ENQUEUE",n[0].name,n[1]),zt[Gr].push(n),_T()}a(hu,"enqueue");var Ry;function YO(){for(var n=Date.now(),e=0;e<zt[Gr].length;++e)zt[Gr][e].length>2&&(zt[Gr][e][3]=n,zt[Gr][e][4]=n);_T()}a(YO,"resetQueue");function _T(){if(clearTimeout(Ry),Ry=void 0,zt[Gr].length!==0){var n=zt[Gr].shift(),e=n[0],t=n[1],r=n[2],i=n[3],s=n[4];if(i===void 0)Tc("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Tc("TIMEOUT",e.name,t);var o=t.pop();typeof o=="function"&&o.call(null,r)}else{var c=Date.now()-s,l=Math.max(s-i,1),u=Math.min(l*1.2,100);c>=u?(Tc("RETRY",e.name,t),e.apply(null,t.concat([i]))):zt[Gr].push(n)}Ry===void 0&&(Ry=setTimeout(_T,0))}}a(_T,"retry")});var bn=w(Ro=>{"use strict";var ZO=Ir().fromCallback,yn=pu(),_Q=["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 yn[n]=="function");Object.assign(Ro,yn);_Q.forEach(n=>{Ro[n]=ZO(yn[n])});Ro.exists=function(n,e){return typeof e=="function"?yn.exists(n,e):new Promise(t=>yn.exists(n,t))};Ro.read=function(n,e,t,r,i,s){return typeof s=="function"?yn.read(n,e,t,r,i,s):new Promise((o,c)=>{yn.read(n,e,t,r,i,(l,u,f)=>{if(l)return c(l);o({bytesRead:u,buffer:f})})})};Ro.write=function(n,e,...t){return typeof t[t.length-1]=="function"?yn.write(n,e,...t):new Promise((r,i)=>{yn.write(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesWritten:o,buffer:c})})})};Ro.readv=function(n,e,...t){return typeof t[t.length-1]=="function"?yn.readv(n,e,...t):new Promise((r,i)=>{yn.readv(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesRead:o,buffers:c})})})};Ro.writev=function(n,e,...t){return typeof t[t.length-1]=="function"?yn.writev(n,e,...t):new Promise((r,i)=>{yn.writev(n,e,...t,(s,o,c)=>{if(s)return i(s);r({bytesWritten:o,buffers:c})})})};typeof yn.realpath.native=="function"?Ro.realpath.native=ZO(yn.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var tD=w((cye,eD)=>{"use strict";var SQ=require("path");eD.exports.checkPath=a(function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(SQ.parse(e).root,""))){let r=new Error(`Path contains invalid characters: ${e}`);throw r.code="EINVAL",r}},"checkPath")});var sD=w((uye,wT)=>{"use strict";var rD=bn(),{checkPath:nD}=tD(),iD=a(n=>{let e={mode:511};return typeof n=="number"?n:{...e,...n}.mode},"getMode");wT.exports.makeDir=async(n,e)=>(nD(n),rD.mkdir(n,{mode:iD(e),recursive:!0}));wT.exports.makeDirSync=(n,e)=>(nD(n),rD.mkdirSync(n,{mode:iD(e),recursive:!0}))});var Ji=w((dye,oD)=>{"use strict";var wQ=Ir().fromPromise,{makeDir:vQ,makeDirSync:vT}=sD(),ET=wQ(vQ);oD.exports={mkdirs:ET,mkdirsSync:vT,mkdirp:ET,mkdirpSync:vT,ensureDir:ET,ensureDirSync:vT}});var ba=w((hye,cD)=>{"use strict";var EQ=Ir().fromPromise,aD=bn();function TQ(n){return aD.access(n).then(()=>!0).catch(()=>!1)}a(TQ,"pathExists");cD.exports={pathExists:EQ(TQ),pathExistsSync:aD.existsSync}});var TT=w((mye,lD)=>{"use strict";var mu=bn(),AQ=Ir().fromPromise;async function IQ(n,e,t){let r=await mu.open(n,"r+"),i=null;try{await mu.futimes(r,e,t)}finally{try{await mu.close(r)}catch(s){i=s}}if(i)throw i}a(IQ,"utimesMillis");function xQ(n,e,t){let r=mu.openSync(n,"r+");return mu.futimesSync(r,e,t),mu.closeSync(r)}a(xQ,"utimesMillisSync");lD.exports={utimesMillis:AQ(IQ),utimesMillisSync:xQ}});var Ac=w((yye,hD)=>{"use strict";var gu=bn(),xr=require("path"),uD=Ir().fromPromise;function RQ(n,e,t){let r=t.dereference?i=>gu.stat(i,{bigint:!0}):i=>gu.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}))}a(RQ,"getStats");function PQ(n,e,t){let r,i=t.dereference?o=>gu.statSync(o,{bigint:!0}):o=>gu.lstatSync(o,{bigint:!0}),s=i(n);try{r=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:r}}a(PQ,"getStatsSync");async function CQ(n,e,t,r){let{srcStat:i,destStat:s}=await RQ(n,e,r);if(s){if(Ad(i,s)){let o=xr.basename(n),c=xr.basename(e);if(t==="move"&&o!==c&&o.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()&&AT(n,e))throw new Error(Cy(n,e,t));return{srcStat:i,destStat:s}}a(CQ,"checkPaths");function OQ(n,e,t,r){let{srcStat:i,destStat:s}=PQ(n,e,r);if(s){if(Ad(i,s)){let o=xr.basename(n),c=xr.basename(e);if(t==="move"&&o!==c&&o.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()&&AT(n,e))throw new Error(Cy(n,e,t));return{srcStat:i,destStat:s}}a(OQ,"checkPathsSync");async function fD(n,e,t,r){let i=xr.resolve(xr.dirname(n)),s=xr.resolve(xr.dirname(t));if(s===i||s===xr.parse(s).root)return;let o;try{o=await gu.stat(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Ad(e,o))throw new Error(Cy(n,t,r));return fD(n,e,s,r)}a(fD,"checkParentPaths");function dD(n,e,t,r){let i=xr.resolve(xr.dirname(n)),s=xr.resolve(xr.dirname(t));if(s===i||s===xr.parse(s).root)return;let o;try{o=gu.statSync(s,{bigint:!0})}catch(c){if(c.code==="ENOENT")return;throw c}if(Ad(e,o))throw new Error(Cy(n,t,r));return dD(n,e,s,r)}a(dD,"checkParentPathsSync");function Ad(n,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===n.ino&&e.dev===n.dev}a(Ad,"areIdentical");function AT(n,e){let t=xr.resolve(n).split(xr.sep).filter(i=>i),r=xr.resolve(e).split(xr.sep).filter(i=>i);return t.every((i,s)=>r[s]===i)}a(AT,"isSrcSubdir");function Cy(n,e,t){return`Cannot ${t} '${n}' to a subdirectory of itself, '${e}'.`}a(Cy,"errMsg");hD.exports={checkPaths:uD(CQ),checkPathsSync:OQ,checkParentPaths:uD(fD),checkParentPathsSync:dD,isSrcSubdir:AT,areIdentical:Ad}});var mD=w((_ye,pD)=>{"use strict";async function DQ(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})))}a(DQ,"asyncIteratorConcurrentProcess");pD.exports={asyncIteratorConcurrentProcess:DQ}});var SD=w((wye,_D)=>{"use strict";var en=bn(),Id=require("path"),{mkdirs:FQ}=Ji(),{pathExists:LQ}=ba(),{utimesMillis:NQ}=TT(),xd=Ac(),{asyncIteratorConcurrentProcess:kQ}=mD();async function MQ(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;
481
481
 
482
482
  see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:r,destStat:i}=await xd.checkPaths(n,e,"copy",t);if(await xd.checkParentPaths(n,r,e,"copy"),!await yD(n,e,t))return;let o=Id.dirname(e);await LQ(o)||await FQ(o),await bD(i,n,e,t)}a(MQ,"copy");async function yD(n,e,t){return t.filter?t.filter(n,e):!0}a(yD,"runFilter");async function bD(n,e,t,r){let s=await(r.dereference?en.stat:en.lstat)(e);if(s.isDirectory())return BQ(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return jQ(s,n,e,t,r);if(s.isSymbolicLink())return VQ(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}`)}a(bD,"getStatsAndPerformCopy");async function jQ(n,e,t,r,i){if(!e)return gD(n,t,r,i);if(i.overwrite)return await en.unlink(r),gD(n,t,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}a(jQ,"onFile");async function gD(n,e,t,r){if(await en.copyFile(e,t),r.preserveTimestamps){$Q(n.mode)&&await UQ(t,n.mode);let i=await en.stat(e);await NQ(t,i.atime,i.mtime)}return en.chmod(t,n.mode)}a(gD,"copyFile");function $Q(n){return(n&128)===0}a($Q,"fileIsNotWritable");function UQ(n,e){return en.chmod(n,e|128)}a(UQ,"makeFileWritable");async function BQ(n,e,t,r,i){e||await en.mkdir(r),await kQ(await en.opendir(t),async s=>{let o=Id.join(t,s.name),c=Id.join(r,s.name);if(await yD(o,c,i)){let{destStat:u}=await xd.checkPaths(o,c,"copy",i);await bD(u,o,c,i)}}),e||await en.chmod(r,n.mode)}a(BQ,"onDir");async function VQ(n,e,t,r){let i=await en.readlink(e);if(r.dereference&&(i=Id.resolve(process.cwd(),i)),!n)return en.symlink(i,t);let s=null;try{s=await en.readlink(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return en.symlink(i,t);throw o}if(r.dereference&&(s=Id.resolve(process.cwd(),s)),xd.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(xd.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await en.unlink(t),en.symlink(i,t)}a(VQ,"onLink");_D.exports=MQ});var AD=w((Eye,TD)=>{"use strict";var _n=pu(),Rd=require("path"),GQ=Ji().mkdirsSync,qQ=TT().utimesMillisSync,Pd=Ac();function WQ(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;
483
483
 
484
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=Pd.checkPathsSync(n,e,"copy",t);if(Pd.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=Rd.dirname(e);return _n.existsSync(s)||GQ(s),wD(i,n,e,t)}a(WQ,"copySync");function wD(n,e,t,r){let s=(r.dereference?_n.statSync:_n.lstatSync)(e);if(s.isDirectory())return JQ(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return zQ(s,n,e,t,r);if(s.isSymbolicLink())return tX(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}`)}a(wD,"getStats");function zQ(n,e,t,r,i){return e?HQ(n,t,r,i):vD(n,t,r,i)}a(zQ,"onFile");function HQ(n,e,t,r){if(r.overwrite)return _n.unlinkSync(t),vD(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}a(HQ,"mayCopyFile");function vD(n,e,t,r){return _n.copyFileSync(e,t),r.preserveTimestamps&&KQ(n.mode,e,t),IT(t,n.mode)}a(vD,"copyFile");function KQ(n,e,t){return QQ(n)&&XQ(t,n),YQ(e,t)}a(KQ,"handleTimestamps");function QQ(n){return(n&128)===0}a(QQ,"fileIsNotWritable");function XQ(n,e){return IT(n,e|128)}a(XQ,"makeFileWritable");function IT(n,e){return _n.chmodSync(n,e)}a(IT,"setDestMode");function YQ(n,e){let t=_n.statSync(n);return qQ(e,t.atime,t.mtime)}a(YQ,"setDestTimestamps");function JQ(n,e,t,r,i){return e?ED(t,r,i):ZQ(n.mode,t,r,i)}a(JQ,"onDir");function ZQ(n,e,t,r){return _n.mkdirSync(t),ED(e,t,r),IT(t,n)}a(ZQ,"mkDirAndCopy");function ED(n,e,t){let r=_n.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)eX(i.name,n,e,t)}finally{r.closeSync()}}a(ED,"copyDir");function eX(n,e,t,r){let i=Rd.join(e,n),s=Rd.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:o}=Pd.checkPathsSync(i,s,"copy",r);return wD(o,i,s,r)}a(eX,"copyDirItem");function tX(n,e,t,r){let i=_n.readlinkSync(e);if(r.dereference&&(i=Rd.resolve(process.cwd(),i)),n){let s;try{s=_n.readlinkSync(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return _n.symlinkSync(i,t);throw o}if(r.dereference&&(s=Rd.resolve(process.cwd(),s)),Pd.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Pd.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return rX(i,t)}else return _n.symlinkSync(i,t)}a(tX,"onLink");function rX(n,e){return _n.unlinkSync(e),_n.symlinkSync(n,e)}a(rX,"copyLink");TD.exports=WQ});var Oy=w((Aye,ID)=>{"use strict";var nX=Ir().fromPromise;ID.exports={copy:nX(SD()),copySync:AD()}});var Cd=w((Iye,RD)=>{"use strict";var xD=pu(),iX=Ir().fromCallback;function sX(n,e){xD.rm(n,{recursive:!0,force:!0},e)}a(sX,"remove");function oX(n){xD.rmSync(n,{recursive:!0,force:!0})}a(oX,"removeSync");RD.exports={remove:iX(sX),removeSync:oX}});var kD=w((Rye,ND)=>{"use strict";var aX=Ir().fromPromise,OD=bn(),DD=require("path"),FD=Ji(),LD=Cd(),PD=aX(a(async function(e){let t;try{t=await OD.readdir(e)}catch{return FD.mkdirs(e)}return Promise.all(t.map(r=>LD.remove(DD.join(e,r))))},"emptyDir"));function CD(n){let e;try{e=OD.readdirSync(n)}catch{return FD.mkdirsSync(n)}e.forEach(t=>{t=DD.join(n,t),LD.removeSync(t)})}a(CD,"emptyDirSync");ND.exports={emptyDirSync:CD,emptydirSync:CD,emptyDir:PD,emptydir:PD}});var UD=w((Cye,$D)=>{"use strict";var cX=Ir().fromPromise,MD=require("path"),Po=bn(),jD=Ji();async function lX(n){let e;try{e=await Po.stat(n)}catch{}if(e&&e.isFile())return;let t=MD.dirname(n),r=null;try{r=await Po.stat(t)}catch(i){if(i.code==="ENOENT"){await jD.mkdirs(t),await Po.writeFile(n,"");return}else throw i}r.isDirectory()?await Po.writeFile(n,""):await Po.readdir(t)}a(lX,"createFile");function uX(n){let e;try{e=Po.statSync(n)}catch{}if(e&&e.isFile())return;let t=MD.dirname(n);try{Po.statSync(t).isDirectory()||Po.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")jD.mkdirsSync(t);else throw r}Po.writeFileSync(n,"")}a(uX,"createFileSync");$D.exports={createFile:cX(lX),createFileSync:uX}});var WD=w((Dye,qD)=>{"use strict";var fX=Ir().fromPromise,BD=require("path"),_a=bn(),VD=Ji(),{pathExists:dX}=ba(),{areIdentical:GD}=Ac();async function hX(n,e){let t;try{t=await _a.lstat(e)}catch{}let r;try{r=await _a.lstat(n)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(t&&GD(r,t))return;let i=BD.dirname(e);await dX(i)||await VD.mkdirs(i),await _a.link(n,e)}a(hX,"createLink");function pX(n,e){let t;try{t=_a.lstatSync(e)}catch{}try{let s=_a.lstatSync(n);if(t&&GD(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=BD.dirname(e);return _a.existsSync(r)||VD.mkdirsSync(r),_a.linkSync(n,e)}a(pX,"createLinkSync");qD.exports={createLink:fX(hX),createLinkSync:pX}});var HD=w((Lye,zD)=>{"use strict";var Sa=require("path"),Od=bn(),{pathExists:mX}=ba(),gX=Ir().fromPromise;async function yX(n,e){if(Sa.isAbsolute(n)){try{await Od.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=Sa.dirname(e),r=Sa.join(t,n);if(await mX(r))return{toCwd:r,toDst:n};try{await Od.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:Sa.relative(t,n)}}a(yX,"symlinkPaths");function bX(n,e){if(Sa.isAbsolute(n)){if(!Od.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=Sa.dirname(e),r=Sa.join(t,n);if(Od.existsSync(r))return{toCwd:r,toDst:n};if(!Od.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:Sa.relative(t,n)}}a(bX,"symlinkPathsSync");zD.exports={symlinkPaths:gX(yX),symlinkPathsSync:bX}});var XD=w((kye,QD)=>{"use strict";var KD=bn(),_X=Ir().fromPromise;async function SX(n,e){if(e)return e;let t;try{t=await KD.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(SX,"symlinkType");function wX(n,e){if(e)return e;let t;try{t=KD.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(wX,"symlinkTypeSync");QD.exports={symlinkType:_X(SX),symlinkTypeSync:wX}});var eF=w((jye,ZD)=>{"use strict";var vX=Ir().fromPromise,YD=require("path"),Ns=bn(),{mkdirs:EX,mkdirsSync:TX}=Ji(),{symlinkPaths:AX,symlinkPathsSync:IX}=HD(),{symlinkType:xX,symlinkTypeSync:RX}=XD(),{pathExists:PX}=ba(),{areIdentical:JD}=Ac();async function CX(n,e,t){let r;try{r=await Ns.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([Ns.stat(n),Ns.stat(e)]);if(JD(c,l))return}let i=await AX(n,e);n=i.toDst;let s=await xX(i.toCwd,t),o=YD.dirname(e);return await PX(o)||await EX(o),Ns.symlink(n,e,s)}a(CX,"createSymlink");function OX(n,e,t){let r;try{r=Ns.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=Ns.statSync(n),l=Ns.statSync(e);if(JD(c,l))return}let i=IX(n,e);n=i.toDst,t=RX(i.toCwd,t);let s=YD.dirname(e);return Ns.existsSync(s)||TX(s),Ns.symlinkSync(n,e,t)}a(OX,"createSymlinkSync");ZD.exports={createSymlink:vX(CX),createSymlinkSync:OX}});var cF=w((Uye,aF)=>{"use strict";var{createFile:tF,createFileSync:rF}=UD(),{createLink:nF,createLinkSync:iF}=WD(),{createSymlink:sF,createSymlinkSync:oF}=eF();aF.exports={createFile:tF,createFileSync:rF,ensureFile:tF,ensureFileSync:rF,createLink:nF,createLinkSync:iF,ensureLink:nF,ensureLinkSync:iF,createSymlink:sF,createSymlinkSync:oF,ensureSymlink:sF,ensureSymlinkSync:oF}});var Dy=w((Bye,lF)=>{function DX(n,{EOL:e=`
484
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:r,destStat:i}=Pd.checkPathsSync(n,e,"copy",t);if(Pd.checkParentPathsSync(n,r,e,"copy"),t.filter&&!t.filter(n,e))return;let s=Rd.dirname(e);return _n.existsSync(s)||GQ(s),wD(i,n,e,t)}a(WQ,"copySync");function wD(n,e,t,r){let s=(r.dereference?_n.statSync:_n.lstatSync)(e);if(s.isDirectory())return JQ(s,n,e,t,r);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return zQ(s,n,e,t,r);if(s.isSymbolicLink())return tX(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}`)}a(wD,"getStats");function zQ(n,e,t,r,i){return e?HQ(n,t,r,i):vD(n,t,r,i)}a(zQ,"onFile");function HQ(n,e,t,r){if(r.overwrite)return _n.unlinkSync(t),vD(n,e,t,r);if(r.errorOnExist)throw new Error(`'${t}' already exists`)}a(HQ,"mayCopyFile");function vD(n,e,t,r){return _n.copyFileSync(e,t),r.preserveTimestamps&&KQ(n.mode,e,t),IT(t,n.mode)}a(vD,"copyFile");function KQ(n,e,t){return QQ(n)&&XQ(t,n),YQ(e,t)}a(KQ,"handleTimestamps");function QQ(n){return(n&128)===0}a(QQ,"fileIsNotWritable");function XQ(n,e){return IT(n,e|128)}a(XQ,"makeFileWritable");function IT(n,e){return _n.chmodSync(n,e)}a(IT,"setDestMode");function YQ(n,e){let t=_n.statSync(n);return qQ(e,t.atime,t.mtime)}a(YQ,"setDestTimestamps");function JQ(n,e,t,r,i){return e?ED(t,r,i):ZQ(n.mode,t,r,i)}a(JQ,"onDir");function ZQ(n,e,t,r){return _n.mkdirSync(t),ED(e,t,r),IT(t,n)}a(ZQ,"mkDirAndCopy");function ED(n,e,t){let r=_n.opendirSync(n);try{let i;for(;(i=r.readSync())!==null;)eX(i.name,n,e,t)}finally{r.closeSync()}}a(ED,"copyDir");function eX(n,e,t,r){let i=Rd.join(e,n),s=Rd.join(t,n);if(r.filter&&!r.filter(i,s))return;let{destStat:o}=Pd.checkPathsSync(i,s,"copy",r);return wD(o,i,s,r)}a(eX,"copyDirItem");function tX(n,e,t,r){let i=_n.readlinkSync(e);if(r.dereference&&(i=Rd.resolve(process.cwd(),i)),n){let s;try{s=_n.readlinkSync(t)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return _n.symlinkSync(i,t);throw o}if(r.dereference&&(s=Rd.resolve(process.cwd(),s)),Pd.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Pd.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return rX(i,t)}else return _n.symlinkSync(i,t)}a(tX,"onLink");function rX(n,e){return _n.unlinkSync(e),_n.symlinkSync(n,e)}a(rX,"copyLink");TD.exports=WQ});var Oy=w((Aye,ID)=>{"use strict";var nX=Ir().fromPromise;ID.exports={copy:nX(SD()),copySync:AD()}});var Cd=w((Iye,RD)=>{"use strict";var xD=pu(),iX=Ir().fromCallback;function sX(n,e){xD.rm(n,{recursive:!0,force:!0},e)}a(sX,"remove");function oX(n){xD.rmSync(n,{recursive:!0,force:!0})}a(oX,"removeSync");RD.exports={remove:iX(sX),removeSync:oX}});var kD=w((Rye,ND)=>{"use strict";var aX=Ir().fromPromise,OD=bn(),DD=require("path"),FD=Ji(),LD=Cd(),PD=aX(a(async function(e){let t;try{t=await OD.readdir(e)}catch{return FD.mkdirs(e)}return Promise.all(t.map(r=>LD.remove(DD.join(e,r))))},"emptyDir"));function CD(n){let e;try{e=OD.readdirSync(n)}catch{return FD.mkdirsSync(n)}e.forEach(t=>{t=DD.join(n,t),LD.removeSync(t)})}a(CD,"emptyDirSync");ND.exports={emptyDirSync:CD,emptydirSync:CD,emptyDir:PD,emptydir:PD}});var UD=w((Cye,$D)=>{"use strict";var cX=Ir().fromPromise,MD=require("path"),Po=bn(),jD=Ji();async function lX(n){let e;try{e=await Po.stat(n)}catch{}if(e&&e.isFile())return;let t=MD.dirname(n),r=null;try{r=await Po.stat(t)}catch(i){if(i.code==="ENOENT"){await jD.mkdirs(t),await Po.writeFile(n,"");return}else throw i}r.isDirectory()?await Po.writeFile(n,""):await Po.readdir(t)}a(lX,"createFile");function uX(n){let e;try{e=Po.statSync(n)}catch{}if(e&&e.isFile())return;let t=MD.dirname(n);try{Po.statSync(t).isDirectory()||Po.readdirSync(t)}catch(r){if(r&&r.code==="ENOENT")jD.mkdirsSync(t);else throw r}Po.writeFileSync(n,"")}a(uX,"createFileSync");$D.exports={createFile:cX(lX),createFileSync:uX}});var WD=w((Dye,qD)=>{"use strict";var fX=Ir().fromPromise,BD=require("path"),_a=bn(),VD=Ji(),{pathExists:dX}=ba(),{areIdentical:GD}=Ac();async function hX(n,e){let t;try{t=await _a.lstat(e)}catch{}let r;try{r=await _a.lstat(n)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(t&&GD(r,t))return;let i=BD.dirname(e);await dX(i)||await VD.mkdirs(i),await _a.link(n,e)}a(hX,"createLink");function pX(n,e){let t;try{t=_a.lstatSync(e)}catch{}try{let s=_a.lstatSync(n);if(t&&GD(s,t))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let r=BD.dirname(e);return _a.existsSync(r)||VD.mkdirsSync(r),_a.linkSync(n,e)}a(pX,"createLinkSync");qD.exports={createLink:fX(hX),createLinkSync:pX}});var HD=w((Lye,zD)=>{"use strict";var Sa=require("path"),Od=bn(),{pathExists:mX}=ba(),gX=Ir().fromPromise;async function yX(n,e){if(Sa.isAbsolute(n)){try{await Od.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:n}}let t=Sa.dirname(e),r=Sa.join(t,n);if(await mX(r))return{toCwd:r,toDst:n};try{await Od.lstat(n)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:n,toDst:Sa.relative(t,n)}}a(yX,"symlinkPaths");function bX(n,e){if(Sa.isAbsolute(n)){if(!Od.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}let t=Sa.dirname(e),r=Sa.join(t,n);if(Od.existsSync(r))return{toCwd:r,toDst:n};if(!Od.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:Sa.relative(t,n)}}a(bX,"symlinkPathsSync");zD.exports={symlinkPaths:gX(yX),symlinkPathsSync:bX}});var XD=w((kye,QD)=>{"use strict";var KD=bn(),_X=Ir().fromPromise;async function SX(n,e){if(e)return e;let t;try{t=await KD.lstat(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(SX,"symlinkType");function wX(n,e){if(e)return e;let t;try{t=KD.lstatSync(n)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}a(wX,"symlinkTypeSync");QD.exports={symlinkType:_X(SX),symlinkTypeSync:wX}});var eF=w((jye,ZD)=>{"use strict";var vX=Ir().fromPromise,YD=require("path"),ks=bn(),{mkdirs:EX,mkdirsSync:TX}=Ji(),{symlinkPaths:AX,symlinkPathsSync:IX}=HD(),{symlinkType:xX,symlinkTypeSync:RX}=XD(),{pathExists:PX}=ba(),{areIdentical:JD}=Ac();async function CX(n,e,t){let r;try{r=await ks.lstat(e)}catch{}if(r&&r.isSymbolicLink()){let[c,l]=await Promise.all([ks.stat(n),ks.stat(e)]);if(JD(c,l))return}let i=await AX(n,e);n=i.toDst;let s=await xX(i.toCwd,t),o=YD.dirname(e);return await PX(o)||await EX(o),ks.symlink(n,e,s)}a(CX,"createSymlink");function OX(n,e,t){let r;try{r=ks.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){let c=ks.statSync(n),l=ks.statSync(e);if(JD(c,l))return}let i=IX(n,e);n=i.toDst,t=RX(i.toCwd,t);let s=YD.dirname(e);return ks.existsSync(s)||TX(s),ks.symlinkSync(n,e,t)}a(OX,"createSymlinkSync");ZD.exports={createSymlink:vX(CX),createSymlinkSync:OX}});var cF=w((Uye,aF)=>{"use strict";var{createFile:tF,createFileSync:rF}=UD(),{createLink:nF,createLinkSync:iF}=WD(),{createSymlink:sF,createSymlinkSync:oF}=eF();aF.exports={createFile:tF,createFileSync:rF,ensureFile:tF,ensureFileSync:rF,createLink:nF,createLinkSync:iF,ensureLink:nF,ensureLinkSync:iF,createSymlink:sF,createSymlinkSync:oF,ensureSymlink:sF,ensureSymlinkSync:oF}});var Dy=w((Bye,lF)=>{function DX(n,{EOL:e=`
485
485
  `,finalEOL:t=!0,replacer:r=null,spaces:i}={}){let s=t?e:"";return JSON.stringify(n,r,i).replace(/\n/g,e)+s}a(DX,"stringify");function FX(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}a(FX,"stripBom");lF.exports={stringify:DX,stripBom:FX}});var hF=w((Gye,dF)=>{var yu;try{yu=pu()}catch{yu=require("fs")}var Fy=Ir(),{stringify:uF,stripBom:fF}=Dy();async function LX(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||yu,r="throws"in e?e.throws:!0,i=await Fy.fromCallback(t.readFile)(n,e);i=fF(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(r)throw o.message=`${n}: ${o.message}`,o;return null}return s}a(LX,"_readFile");var NX=Fy.fromPromise(LX);function kX(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||yu,r="throws"in e?e.throws:!0;try{let i=t.readFileSync(n,e);return i=fF(i),JSON.parse(i,e.reviver)}catch(i){if(r)throw i.message=`${n}: ${i.message}`,i;return null}}a(kX,"readFileSync");async function MX(n,e,t={}){let r=t.fs||yu,i=uF(e,t);await Fy.fromCallback(r.writeFile)(n,i,t)}a(MX,"_writeFile");var jX=Fy.fromPromise(MX);function $X(n,e,t={}){let r=t.fs||yu,i=uF(e,t);return r.writeFileSync(n,i,t)}a($X,"writeFileSync");dF.exports={readFile:NX,readFileSync:kX,writeFile:jX,writeFileSync:$X}});var mF=w((Wye,pF)=>{"use strict";var Ly=hF();pF.exports={readJson:Ly.readFile,readJsonSync:Ly.readFileSync,writeJson:Ly.writeFile,writeJsonSync:Ly.writeFileSync}});var Ny=w((zye,bF)=>{"use strict";var UX=Ir().fromPromise,xT=bn(),gF=require("path"),yF=Ji(),BX=ba().pathExists;async function VX(n,e,t="utf-8"){let r=gF.dirname(n);return await BX(r)||await yF.mkdirs(r),xT.writeFile(n,e,t)}a(VX,"outputFile");function GX(n,...e){let t=gF.dirname(n);xT.existsSync(t)||yF.mkdirsSync(t),xT.writeFileSync(n,...e)}a(GX,"outputFileSync");bF.exports={outputFile:UX(VX),outputFileSync:GX}});var SF=w((Kye,_F)=>{"use strict";var{stringify:qX}=Dy(),{outputFile:WX}=Ny();async function zX(n,e,t={}){let r=qX(e,t);await WX(n,r,t)}a(zX,"outputJson");_F.exports=zX});var vF=w((Xye,wF)=>{"use strict";var{stringify:HX}=Dy(),{outputFileSync:KX}=Ny();function QX(n,e,t){let r=HX(e,t);KX(n,r,t)}a(QX,"outputJsonSync");wF.exports=QX});var TF=w((Jye,EF)=>{"use strict";var XX=Ir().fromPromise,Sn=mF();Sn.outputJson=XX(SF());Sn.outputJsonSync=vF();Sn.outputJSON=Sn.outputJson;Sn.outputJSONSync=Sn.outputJsonSync;Sn.writeJSON=Sn.writeJson;Sn.writeJSONSync=Sn.writeJsonSync;Sn.readJSON=Sn.readJson;Sn.readJSONSync=Sn.readJsonSync;EF.exports=Sn});var PF=w((Zye,RF)=>{"use strict";var YX=bn(),AF=require("path"),{copy:JX}=Oy(),{remove:xF}=Cd(),{mkdirp:ZX}=Ji(),{pathExists:eY}=ba(),IF=Ac();async function tY(n,e,t={}){let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await IF.checkPaths(n,e,"move",t);await IF.checkParentPaths(n,i,e,"move");let o=AF.dirname(e);return AF.parse(o).root!==o&&await ZX(o),rY(n,e,r,s)}a(tY,"move");async function rY(n,e,t,r){if(!r){if(t)await xF(e);else if(await eY(e))throw new Error("dest already exists.")}try{await YX.rename(n,e)}catch(i){if(i.code!=="EXDEV")throw i;await nY(n,e,t)}}a(rY,"doRename");async function nY(n,e,t){return await JX(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),xF(n)}a(nY,"moveAcrossDevice");RF.exports=tY});var LF=w((t0e,FF)=>{"use strict";var OF=pu(),PT=require("path"),iY=Oy().copySync,DF=Cd().removeSync,sY=Ji().mkdirpSync,CF=Ac();function oY(n,e,t){t=t||{};let r=t.overwrite||t.clobber||!1,{srcStat:i,isChangingCase:s=!1}=CF.checkPathsSync(n,e,"move",t);return CF.checkParentPathsSync(n,i,e,"move"),aY(e)||sY(PT.dirname(e)),cY(n,e,r,s)}a(oY,"moveSync");function aY(n){let e=PT.dirname(n);return PT.parse(e).root===e}a(aY,"isParentRoot");function cY(n,e,t,r){if(r)return RT(n,e,t);if(t)return DF(e),RT(n,e,t);if(OF.existsSync(e))throw new Error("dest already exists.");return RT(n,e,t)}a(cY,"doRename");function RT(n,e,t){try{OF.renameSync(n,e)}catch(r){if(r.code!=="EXDEV")throw r;return lY(n,e,t)}}a(RT,"rename");function lY(n,e,t){return iY(n,e,{overwrite:t,errorOnExist:!0,preserveTimestamps:!0}),DF(n)}a(lY,"moveAcrossDevice");FF.exports=oY});var kF=w((n0e,NF)=>{"use strict";var uY=Ir().fromPromise;NF.exports={move:uY(PF()),moveSync:LF()}});var Co=w((i0e,MF)=>{"use strict";MF.exports={...bn(),...Oy(),...kD(),...cF(),...TF(),...Ji(),...kF(),...Ny(),...ba(),...Cd()}});var WL=w((a0e,qL)=>{"use strict";qL.exports=VL;function VL(n,e,t){n instanceof RegExp&&(n=BL(n,t)),e instanceof RegExp&&(e=BL(e,t));var r=GL(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)}}a(VL,"balanced");function BL(n,e){var t=e.match(n);return t?t[0]:null}a(BL,"maybeMatch");VL.range=GL;function GL(n,e,t){var r,i,s,o,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,o=u),u=t.indexOf(e,f+1)),f=l<u&&l>=0?l:u;r.length&&(c=[s,o])}return c}a(GL,"range")});var ZL=w((l0e,JL)=>{var zL=WL();JL.exports=DZ;var HL="\0SLASH"+Math.random()+"\0",KL="\0OPEN"+Math.random()+"\0",WT="\0CLOSE"+Math.random()+"\0",QL="\0COMMA"+Math.random()+"\0",XL="\0PERIOD"+Math.random()+"\0";function qT(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}a(qT,"numeric");function CZ(n){return n.split("\\\\").join(HL).split("\\{").join(KL).split("\\}").join(WT).split("\\,").join(QL).split("\\.").join(XL)}a(CZ,"escapeBraces");function OZ(n){return n.split(HL).join("\\").split(KL).join("{").split(WT).join("}").split(QL).join(",").split(XL).join(".")}a(OZ,"unescapeBraces");function YL(n){if(!n)return[""];var e=[],t=zL("{","}",n);if(!t)return n.split(",");var r=t.pre,i=t.body,s=t.post,o=r.split(",");o[o.length-1]+="{"+i+"}";var c=YL(s);return s.length&&(o[o.length-1]+=c.shift(),o.push.apply(o,c)),e.push.apply(e,o),e}a(YL,"parseCommaParts");function DZ(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Md(CZ(n),!0).map(OZ)):[]}a(DZ,"expandTop");function FZ(n){return"{"+n+"}"}a(FZ,"embrace");function LZ(n){return/^-?0\d/.test(n)}a(LZ,"isPadded");function NZ(n,e){return n<=e}a(NZ,"lte");function kZ(n,e){return n>=e}a(kZ,"gte");function Md(n,e){var t=[],r=zL("{","}",n);if(!r)return[n];var i=r.pre,s=r.post.length?Md(r.post,!1):[""];if(/\$$/.test(r.pre))for(var o=0;o<s.length;o++){var c=i+"{"+r.body+"}"+s[o];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,d=r.body.indexOf(",")>=0;if(!f&&!d)return r.post.match(/,(?!,).*\}/)?(n=r.pre+"{"+r.body+WT+r.post,Md(n)):[n];var h;if(f)h=r.body.split(/\.\./);else if(h=YL(r.body),h.length===1&&(h=Md(h[0],!1).map(FZ),h.length===1))return s.map(function(O){return r.pre+h[0]+O});var p;if(f){var y=qT(h[0]),g=qT(h[1]),v=Math.max(h[0].length,h[1].length),_=h.length==3?Math.max(Math.abs(qT(h[2])),1):1,S=NZ,T=g<y;T&&(_*=-1,S=kZ);var I=h.some(LZ);p=[];for(var A=y;S(A,g);A+=_){var R;if(u)R=String.fromCharCode(A),R==="\\"&&(R="");else if(R=String(A),I){var q=v-R.length;if(q>0){var Y=new Array(q+1).join("0");A<0?R="-"+Y+R.slice(1):R=Y+R}}p.push(R)}}else{p=[];for(var C=0;C<h.length;C++)p.push.apply(p,Md(h[C],!1))}for(var C=0;C<p.length;C++)for(var o=0;o<s.length;o++){var c=i+p[C]+s[o];(!e||f||c)&&t.push(c)}}return t}a(Md,"expand")});var jM=w(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.createPathBasedTargetResolver=as;zr.createCreateRelatedTaskService=One;zr.createCreateRelatedProjectService=Dne;zr.createCreateAssetService=Fne;zr.createArchiveAssetService=Lne;zr.createCleanPropertiesService=Nne;zr.createFixMissingLabelService=kne;zr.createRenameToUidService=Mne;zr.createRepairFolderService=jne;zr.createPlanForEveningService=$ne;zr.createUpdatePropertyService=Une;zr.createRemovePropertyService=Bne;zr.createSetStatusService=Vne;zr.createDuplicateAssetService=Gne;zr.rewriteFrontmatterScalars=MM;var k0=tt();function as(n){return{resolveFile(e){let t=(0,k0.iriToVaultPath)(e)??e,r=t.endsWith(".md")?t:`${t}.md`,i=n.getAbstractFileByPath(r);if(!i||!("basename"in i))throw new Error(`Cannot resolve target file for IRI: ${e}`);return i}}}a(as,"createPathBasedTargetResolver");var eA=a(()=>null,"NULL_CLASS_RESOLVER");function N0(n){return n.startsWith('"[[')&&n.endsWith(']]"')?n:n.startsWith("[[")&&n.endsWith("]]")?`"${n}"`:`"[[${n}]]"`}a(N0,"toQuotedWikilink");function One(n,e,t=as(n),r,i=eA){return{async execute(s,o){let c=o?.label;if(!c)throw new Error("createRelatedTask requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=o?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Task",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}a(One,"createCreateRelatedTaskService");function Dne(n,e,t=as(n),r,i=eA){return{async execute(s,o){let c=o?.label;if(!c)throw new Error("createRelatedProject requires userInput.label");let l=t.resolveFile(s),u=n.getFrontmatter(l)??{},f=l.parent?.path||"",d={ems__Effort_status:'"[[c42245d0-01de-4c35-bfcf-d910445ea28e]]"'},h=o?.parentProperty;h&&l.basename&&(d[h]=`"[[${l.basename}]]"`);let p=await e.createAsset({className:"ems__Project",label:c,folderPath:f,propertyValues:d,parentFile:l,parentMetadata:u,classResolver:i});r&&await r(p)}}}a(Dne,"createCreateRelatedProjectService");function Fne(n,e,t=eA,r=as(n)){return{async execute(i,s){let o=s?.prototypeUID??s?.prototype,c=s?.label,l=s?.folder,u=s?.ownerIdentity,f=s?.isDefinedBy;if(!o)throw new Error("createAsset requires userInput.prototypeUID");if(!c)throw new Error("createAsset requires userInput.label");let d,h;if(i)try{let A=r.resolveFile(i);d=A.path,h=n.getFrontmatter(A)??void 0}catch{}if(!l&&d){let A=d.lastIndexOf("/");l=A>=0?d.substring(0,A):""}if(l===void 0)throw new Error("createAsset requires userInput.folder");let p=o.endsWith("Prototype")?o.slice(0,-9):o,y=crypto.randomUUID(),g=k0.DateFormatter.toISOTimestamp(new Date),v=`${y}.md`,_=l?`${l}/${v}`:v,S=["---",`exo__Asset_uid: ${y}`,`exo__Asset_createdAt: ${g}`,`exo__Asset_label: ${c}`,`exo__Asset_prototype: "[[${o}]]"`,"exo__Instance_class:",` - "[[${p}]]"`],T=!1;if(f&&(S.push(`exo__Asset_isDefinedBy: ${N0(f)}`),T=!0),h){let A=h.exo__Instance_class,q=(Array.isArray(A)?A:A!=null?[A]:[]).some(C=>k0.WikiLinkHelpers.resolveSymbolic(String(C),t).includes("Area")),Y=d?d.substring(d.lastIndexOf("/")+1).replace(/\.md$/,""):void 0;if(Y){let C=q?"ems__Effort_area":"ems__Effort_parent";S.push(`${C}: "[[${Y}]]"`)}!q&&h.ems__Effort_area&&S.push(`ems__Effort_area: ${N0(String(h.ems__Effort_area))}`),S.push('ems__Effort_status: "[[753a44d5-846c-4b82-9196-4fd9a4d48777]]"'),!T&&h.exo__Asset_isDefinedBy&&(S.push(`exo__Asset_isDefinedBy: ${N0(String(h.exo__Asset_isDefinedBy))}`),T=!0)}!T&&u&&S.push(`exo__Asset_isDefinedBy: ${N0(u)}`),S.push("---","");let I=S.join(`
486
486
  `);await e.createFile(_,I)}}}a(Fne,"createCreateAssetService");function Lne(n,e,t=as(n)){return{async execute(r){let i=t.resolveFile(r);await e.archiveAsset(i)}}}a(Lne,"createArchiveAssetService");function Nne(n,e,t=as(n)){return{async execute(r){let i=t.resolveFile(r);await e.cleanEmptyProperties(i)}}}a(Nne,"createCleanPropertiesService");function kne(n,e,t=as(n)){return{async execute(r){let i=t.resolveFile(r);await e.fixMissingLabel(i)}}}a(kne,"createFixMissingLabelService");function Mne(n,e,t=as(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{};await e.renameToUid(i,s)}}}a(Mne,"createRenameToUidService");function jne(n,e,t=as(n)){return{async execute(r){let i=t.resolveFile(r),s=n.getFrontmatter(i)??{},o=await e.getExpectedFolder(i,s);if(o===null)throw new Error("repairFolder: cannot determine expected folder (missing exo__Asset_isDefinedBy or referenced asset not found)");(i.parent?.path??"")!==o&&await e.repairFolder(i,o)}}}a(jne,"createRepairFolderService");function $ne(n,e,t=as(n)){return{async execute(r){let i=t.resolveFile(r);await e.planForEvening(i)}}}a($ne,"createPlanForEveningService");function Une(n,e,t){return{async execute(r,i){let s=i?.property,o=i?.value;if(!s)throw new Error("updateProperty requires userInput.property");if(o===void 0)throw new Error("updateProperty requires userInput.value");let c=await t.resolveTargetPath(r),l=await n.readFile(c),u=e.updateProperty(l,s,o);await n.updateFile(c,u)}}}a(Une,"createUpdatePropertyService");function Bne(n,e,t){return{async execute(r,i){let s=i?.property;if(!s)throw new Error("removeProperty requires userInput.property");let o=await t.resolveTargetPath(r),c=await n.readFile(o),l=e.removeProperty(c,s);await n.updateFile(o,l)}}}a(Bne,"createRemovePropertyService");function Vne(n,e,t){return{async execute(r,i){let s=i?.statusUID;if(!s)throw new Error("setStatus requires userInput.statusUID");let o=await t.resolveTargetPath(r),c=await n.readFile(o),l=e.updateProperty(c,"ems__Effort_status",`"[[${s}]]"`);await n.updateFile(o,l)}}}a(Vne,"createSetStatusService");function Gne(n,e=as(n),t){return{async execute(r){if(!r)throw new Error("duplicateAsset requires an active target \u2014 open an Exocortex asset before invoking");let i=e.resolveFile(r),s=await n.read(i),o=crypto.randomUUID(),c=k0.DateFormatter.toLocalTimestamp(new Date),l=MM(s,{exo__Asset_uid:o,exo__Asset_createdAt:c}),u=i.parent?.path??"",f=u?`${u}/${o}.md`:`${o}.md`,d=await n.create(f,l);t&&await t(d)}}}a(Gne,"createDuplicateAssetService");function MM(n,e){let t=n.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)throw new Error("duplicateAsset: source file has no YAML frontmatter block");let r=t[1],i=new Map(Object.entries(e)),s=r.split(`
487
487
  `).map(u=>{let f=u.match(/^([A-Za-z_][A-Za-z0-9_]*):/);if(!f)return u;let d=f[1],h=i.get(d);return h===void 0?u:(i.delete(d),`${d}: ${h}`)});for(let[u,f]of i)s.push(`${u}: ${f}`);let o=s.join(`
@@ -495,15 +495,15 @@ GFS4: `),console.error(n)},"debug"));zt[Gr]||(XO=global[Gr]||[],JO(zt,XO),zt.clo
495
495
  `,c+=br.repeat("-",e.indent+f+3+u.pos)+`^
496
496
  `,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)u=CT(n.buffer,r[o+l],i[o+l],n.position-(r[o]-r[o+l]),d),c+=br.repeat(" ",e.indent)+OT((n.line+l+1).toString(),f)+" | "+u.str+`
497
497
  `;return c.replace(/\n$/,"")}a(vY,"makeSnippet");var EY=vY,TY=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],AY=["scalar","sequence","mapping"];function IY(n){var e={};return n!==null&&Object.keys(n).forEach(function(t){n[t].forEach(function(r){e[String(r)]=t})}),e}a(IY,"compileStyleAliases");function xY(n,e){if(e=e||{},Object.keys(e).forEach(function(t){if(TY.indexOf(t)===-1)throw new wn('Unknown option "'+t+'" is met in definition of "'+n+'" YAML type.')}),this.options=e,this.tag=n,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=IY(e.styleAliases||null),AY.indexOf(this.kind)===-1)throw new wn('Unknown kind "'+this.kind+'" is specified for "'+n+'" YAML type.')}a(xY,"Type$1");var qr=xY;function jF(n,e){var t=[];return n[e].forEach(function(r){var i=t.length;t.forEach(function(s,o){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(i=o)}),t[i]=r}),t}a(jF,"compileList");function RY(){var n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,t;function r(i){i.multi?(n.multi[i.kind].push(i),n.multi.fallback.push(i)):n[i.kind][i.tag]=n.fallback[i.tag]=i}for(a(r,"collectType"),e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return n}a(RY,"compileMap");function FT(n){return this.extend(n)}a(FT,"Schema$1");FT.prototype.extend=a(function(e){var t=[],r=[];if(e instanceof qr)r.push(e);else if(Array.isArray(e))r=r.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(r=r.concat(e.explicit));else throw new wn("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(s){if(!(s instanceof qr))throw new wn("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new wn("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new wn("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof qr))throw new wn("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(FT.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=jF(i,"implicit"),i.compiledExplicit=jF(i,"explicit"),i.compiledTypeMap=RY(i.compiledImplicit,i.compiledExplicit),i},"extend");var tL=FT,rL=new qr("tag:yaml.org,2002:str",{kind:"scalar",construct:a(function(n){return n!==null?n:""},"construct")}),nL=new qr("tag:yaml.org,2002:seq",{kind:"sequence",construct:a(function(n){return n!==null?n:[]},"construct")}),iL=new qr("tag:yaml.org,2002:map",{kind:"mapping",construct:a(function(n){return n!==null?n:{}},"construct")}),sL=new tL({explicit:[rL,nL,iL]});function PY(n){if(n===null)return!0;var e=n.length;return e===1&&n==="~"||e===4&&(n==="null"||n==="Null"||n==="NULL")}a(PY,"resolveYamlNull");function CY(){return null}a(CY,"constructYamlNull");function OY(n){return n===null}a(OY,"isNull");var oL=new qr("tag:yaml.org,2002:null",{kind:"scalar",resolve:PY,construct:CY,predicate:OY,represent:{canonical:a(function(){return"~"},"canonical"),lowercase:a(function(){return"null"},"lowercase"),uppercase:a(function(){return"NULL"},"uppercase"),camelcase:a(function(){return"Null"},"camelcase"),empty:a(function(){return""},"empty")},defaultStyle:"lowercase"});function DY(n){if(n===null)return!1;var e=n.length;return e===4&&(n==="true"||n==="True"||n==="TRUE")||e===5&&(n==="false"||n==="False"||n==="FALSE")}a(DY,"resolveYamlBoolean");function FY(n){return n==="true"||n==="True"||n==="TRUE"}a(FY,"constructYamlBoolean");function LY(n){return Object.prototype.toString.call(n)==="[object Boolean]"}a(LY,"isBoolean");var aL=new qr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:DY,construct:FY,predicate:LY,represent:{lowercase:a(function(n){return n?"true":"false"},"lowercase"),uppercase:a(function(n){return n?"TRUE":"FALSE"},"uppercase"),camelcase:a(function(n){return n?"True":"False"},"camelcase")},defaultStyle:"lowercase"});function NY(n){return 48<=n&&n<=57||65<=n&&n<=70||97<=n&&n<=102}a(NY,"isHexCode");function kY(n){return 48<=n&&n<=55}a(kY,"isOctCode");function MY(n){return 48<=n&&n<=57}a(MY,"isDecCode");function jY(n){if(n===null)return!1;var e=n.length,t=0,r=!1,i;if(!e)return!1;if(i=n[t],(i==="-"||i==="+")&&(i=n[++t]),i==="0"){if(t+1===e)return!0;if(i=n[++t],i==="b"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(!NY(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(t++;t<e;t++)if(i=n[t],i!=="_"){if(!kY(n.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;t<e;t++)if(i=n[t],i!=="_"){if(!MY(n.charCodeAt(t)))return!1;r=!0}return!(!r||i==="_")}a(jY,"resolveYamlInteger");function $Y(n){var e=n,t=1,r;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),r=e[0],(r==="-"||r==="+")&&(r==="-"&&(t=-1),e=e.slice(1),r=e[0]),e==="0")return 0;if(r==="0"){if(e[1]==="b")return t*parseInt(e.slice(2),2);if(e[1]==="x")return t*parseInt(e.slice(2),16);if(e[1]==="o")return t*parseInt(e.slice(2),8)}return t*parseInt(e,10)}a($Y,"constructYamlInteger");function UY(n){return Object.prototype.toString.call(n)==="[object Number]"&&n%1===0&&!br.isNegativeZero(n)}a(UY,"isInteger");var cL=new qr("tag:yaml.org,2002:int",{kind:"scalar",resolve:jY,construct:$Y,predicate:UY,represent:{binary:a(function(n){return n>=0?"0b"+n.toString(2):"-0b"+n.toString(2).slice(1)},"binary"),octal:a(function(n){return n>=0?"0o"+n.toString(8):"-0o"+n.toString(8).slice(1)},"octal"),decimal:a(function(n){return n.toString(10)},"decimal"),hexadecimal:a(function(n){return n>=0?"0x"+n.toString(16).toUpperCase():"-0x"+n.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),BY=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function VY(n){return!(n===null||!BY.test(n)||n[n.length-1]==="_")}a(VY,"resolveYamlFloat");function GY(n){var e,t;return e=n.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:t*parseFloat(e,10)}a(GY,"constructYamlFloat");var qY=/^[-+]?[0-9]+e/;function WY(n,e){var t;if(isNaN(n))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===n)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===n)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(br.isNegativeZero(n))return"-0.0";return t=n.toString(10),qY.test(t)?t.replace("e",".e"):t}a(WY,"representYamlFloat");function zY(n){return Object.prototype.toString.call(n)==="[object Number]"&&(n%1!==0||br.isNegativeZero(n))}a(zY,"isFloat");var lL=new qr("tag:yaml.org,2002:float",{kind:"scalar",resolve:VY,construct:GY,predicate:zY,represent:WY,defaultStyle:"lowercase"}),uL=sL.extend({implicit:[oL,aL,cL,lL]}),fL=uL,dL=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),hL=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function HY(n){return n===null?!1:dL.exec(n)!==null||hL.exec(n)!==null}a(HY,"resolveYamlTimestamp");function KY(n){var e,t,r,i,s,o,c,l=0,u=null,f,d,h;if(e=dL.exec(n),e===null&&(e=hL.exec(n)),e===null)throw new Error("Date resolve error");if(t=+e[1],r=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(t,r,i));if(s=+e[4],o=+e[5],c=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(f=+e[10],d=+(e[11]||0),u=(f*60+d)*6e4,e[9]==="-"&&(u=-u)),h=new Date(Date.UTC(t,r,i,s,o,c,l)),u&&h.setTime(h.getTime()-u),h}a(KY,"constructYamlTimestamp");function QY(n){return n.toISOString()}a(QY,"representYamlTimestamp");var pL=new qr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:HY,construct:KY,instanceOf:Date,represent:QY});function XY(n){return n==="<<"||n===null}a(XY,"resolveYamlMerge");var mL=new qr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:XY}),jT=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
498
- \r`;function YY(n){if(n===null)return!1;var e,t,r=0,i=n.length,s=jT;for(t=0;t<i;t++)if(e=s.indexOf(n.charAt(t)),!(e>64)){if(e<0)return!1;r+=6}return r%8===0}a(YY,"resolveYamlBinary");function JY(n){var e,t,r=n.replace(/[\r\n=]/g,""),i=r.length,s=jT,o=0,c=[];for(e=0;e<i;e++)e%4===0&&e&&(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)),o=o<<6|s.indexOf(r.charAt(e));return t=i%4*6,t===0?(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)):t===18?(c.push(o>>10&255),c.push(o>>2&255)):t===12&&c.push(o>>4&255),new Uint8Array(c)}a(JY,"constructYamlBinary");function ZY(n){var e="",t=0,r,i,s=n.length,o=jT;for(r=0;r<s;r++)r%3===0&&r&&(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+n[r];return i=s%3,i===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):i===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):i===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}a(ZY,"representYamlBinary");function eJ(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}a(eJ,"isBinary");var gL=new qr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:YY,construct:JY,predicate:eJ,represent:ZY}),tJ=Object.prototype.hasOwnProperty,rJ=Object.prototype.toString;function nJ(n){if(n===null)return!0;var e=[],t,r,i,s,o,c=n;for(t=0,r=c.length;t<r;t+=1){if(i=c[t],o=!1,rJ.call(i)!=="[object Object]")return!1;for(s in i)if(tJ.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}a(nJ,"resolveYamlOmap");function iJ(n){return n!==null?n:[]}a(iJ,"constructYamlOmap");var yL=new qr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:nJ,construct:iJ}),sJ=Object.prototype.toString;function oJ(n){if(n===null)return!0;var e,t,r,i,s,o=n;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1){if(r=o[e],sJ.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[e]=[i[0],r[i[0]]]}return!0}a(oJ,"resolveYamlPairs");function aJ(n){if(n===null)return[];var e,t,r,i,s,o=n;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1)r=o[e],i=Object.keys(r),s[e]=[i[0],r[i[0]]];return s}a(aJ,"constructYamlPairs");var bL=new qr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:oJ,construct:aJ}),cJ=Object.prototype.hasOwnProperty;function lJ(n){if(n===null)return!0;var e,t=n;for(e in t)if(cJ.call(t,e)&&t[e]!==null)return!1;return!0}a(lJ,"resolveYamlSet");function uJ(n){return n!==null?n:{}}a(uJ,"constructYamlSet");var _L=new qr("tag:yaml.org,2002:set",{kind:"mapping",resolve:lJ,construct:uJ}),$T=fL.extend({implicit:[pL,mL],explicit:[gL,yL,bL,_L]}),va=Object.prototype.hasOwnProperty,ky=1,SL=2,wL=3,My=4,DT=1,fJ=2,$F=3,dJ=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,hJ=/[\x85\u2028\u2029]/,pJ=/[,\[\]\{\}]/,vL=/^(?:!|!!|![a-z\-]+!)$/i,EL=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function UF(n){return Object.prototype.toString.call(n)}a(UF,"_class");function ks(n){return n===10||n===13}a(ks,"is_EOL");function xc(n){return n===9||n===32}a(xc,"is_WHITE_SPACE");function $n(n){return n===9||n===32||n===10||n===13}a($n,"is_WS_OR_EOL");function _u(n){return n===44||n===91||n===93||n===123||n===125}a(_u,"is_FLOW_INDICATOR");function mJ(n){var e;return 48<=n&&n<=57?n-48:(e=n|32,97<=e&&e<=102?e-97+10:-1)}a(mJ,"fromHexCode");function gJ(n){return n===120?2:n===117?4:n===85?8:0}a(gJ,"escapedHexLen");function yJ(n){return 48<=n&&n<=57?n-48:-1}a(yJ,"fromDecimalCode");function BF(n){return n===48?"\0":n===97?"\x07":n===98?"\b":n===116||n===9?" ":n===110?`
499
- `:n===118?"\v":n===102?"\f":n===114?"\r":n===101?"\x1B":n===32?" ":n===34?'"':n===47?"/":n===92?"\\":n===78?"\x85":n===95?"\xA0":n===76?"\u2028":n===80?"\u2029":""}a(BF,"simpleEscapeSequence");function bJ(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}a(bJ,"charFromCodepoint");function TL(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}a(TL,"setProperty");var AL=new Array(256),IL=new Array(256);for(Ic=0;Ic<256;Ic++)AL[Ic]=BF(Ic)?1:0,IL[Ic]=BF(Ic);var Ic;function _J(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||$T,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}a(_J,"State$1");function xL(n,e){var t={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return t.snippet=EY(t),new wn(e,t)}a(xL,"generateError");function Te(n,e){throw xL(n,e)}a(Te,"throwError");function jy(n,e){n.onWarning&&n.onWarning.call(null,xL(n,e))}a(jy,"throwWarning");var VF={YAML:a(function(e,t,r){var i,s,o;e.version!==null&&Te(e,"duplication of %YAML directive"),r.length!==1&&Te(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&Te(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Te(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&jy(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:a(function(e,t,r){var i,s;r.length!==2&&Te(e,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],vL.test(i)||Te(e,"ill-formed tag handle (first argument) of the TAG directive"),va.call(e.tagMap,i)&&Te(e,'there is a previously declared suffix for "'+i+'" tag handle'),EL.test(s)||Te(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Te(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function wa(n,e,t,r){var i,s,o,c;if(e<t){if(c=n.input.slice(e,t),r)for(i=0,s=c.length;i<s;i+=1)o=c.charCodeAt(i),o===9||32<=o&&o<=1114111||Te(n,"expected valid JSON character");else dJ.test(c)&&Te(n,"the stream contains non-printable characters");n.result+=c}}a(wa,"captureSegment");function GF(n,e,t,r){var i,s,o,c;for(br.isObject(t)||Te(n,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),o=0,c=i.length;o<c;o+=1)s=i[o],va.call(e,s)||(TL(e,s,t[s]),r[s]=!0)}a(GF,"mergeMappings");function Su(n,e,t,r,i,s,o,c,l){var u,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,f=i.length;u<f;u+=1)Array.isArray(i[u])&&Te(n,"nested arrays are not supported inside keys"),typeof i=="object"&&UF(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&UF(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,f=s.length;u<f;u+=1)GF(n,e,s[u],t);else GF(n,e,s,t);else!n.json&&!va.call(t,i)&&va.call(e,i)&&(n.line=o||n.line,n.lineStart=c||n.lineStart,n.position=l||n.position,Te(n,"duplicated mapping key")),TL(e,i,s),delete t[i];return e}a(Su,"storeMappingPair");function UT(n){var e;e=n.input.charCodeAt(n.position),e===10?n.position++:e===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):Te(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}a(UT,"readLineBreak");function fr(n,e,t){for(var r=0,i=n.input.charCodeAt(n.position);i!==0;){for(;xc(i);)i===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),i=n.input.charCodeAt(++n.position);if(e&&i===35)do i=n.input.charCodeAt(++n.position);while(i!==10&&i!==13&&i!==0);if(ks(i))for(UT(n),i=n.input.charCodeAt(n.position),r++,n.lineIndent=0;i===32;)n.lineIndent++,i=n.input.charCodeAt(++n.position);else break}return t!==-1&&r!==0&&n.lineIndent<t&&jy(n,"deficient indentation"),r}a(fr,"skipSeparationSpace");function By(n){var e=n.position,t;return t=n.input.charCodeAt(e),!!((t===45||t===46)&&t===n.input.charCodeAt(e+1)&&t===n.input.charCodeAt(e+2)&&(e+=3,t=n.input.charCodeAt(e),t===0||$n(t)))}a(By,"testDocumentSeparator");function BT(n,e){e===1?n.result+=" ":e>1&&(n.result+=br.repeat(`
500
- `,e-1))}a(BT,"writeFoldedLines");function SJ(n,e,t){var r,i,s,o,c,l,u,f,d=n.kind,h=n.result,p;if(p=n.input.charCodeAt(n.position),$n(p)||_u(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=n.input.charCodeAt(n.position+1),$n(i)||t&&_u(i)))return!1;for(n.kind="scalar",n.result="",s=o=n.position,c=!1;p!==0;){if(p===58){if(i=n.input.charCodeAt(n.position+1),$n(i)||t&&_u(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),$n(r))break}else{if(n.position===n.lineStart&&By(n)||t&&_u(p))break;if(ks(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,fr(n,!1,-1),n.lineIndent>=e){c=!0,p=n.input.charCodeAt(n.position);continue}else{n.position=o,n.line=l,n.lineStart=u,n.lineIndent=f;break}}c&&(wa(n,s,o,!1),BT(n,n.line-l),s=o=n.position,c=!1),xc(p)||(o=n.position+1),p=n.input.charCodeAt(++n.position)}return wa(n,s,o,!1),n.result?!0:(n.kind=d,n.result=h,!1)}a(SJ,"readPlainScalar");function wJ(n,e){var t,r,i;if(t=n.input.charCodeAt(n.position),t!==39)return!1;for(n.kind="scalar",n.result="",n.position++,r=i=n.position;(t=n.input.charCodeAt(n.position))!==0;)if(t===39)if(wa(n,r,n.position,!0),t=n.input.charCodeAt(++n.position),t===39)r=n.position,n.position++,i=n.position;else return!0;else ks(t)?(wa(n,r,i,!0),BT(n,fr(n,!1,e)),r=i=n.position):n.position===n.lineStart&&By(n)?Te(n,"unexpected end of the document within a single quoted scalar"):(n.position++,i=n.position);Te(n,"unexpected end of the stream within a single quoted scalar")}a(wJ,"readSingleQuotedScalar");function vJ(n,e){var t,r,i,s,o,c;if(c=n.input.charCodeAt(n.position),c!==34)return!1;for(n.kind="scalar",n.result="",n.position++,t=r=n.position;(c=n.input.charCodeAt(n.position))!==0;){if(c===34)return wa(n,t,n.position,!0),n.position++,!0;if(c===92){if(wa(n,t,n.position,!0),c=n.input.charCodeAt(++n.position),ks(c))fr(n,!1,e);else if(c<256&&AL[c])n.result+=IL[c],n.position++;else if((o=gJ(c))>0){for(i=o,s=0;i>0;i--)c=n.input.charCodeAt(++n.position),(o=mJ(c))>=0?s=(s<<4)+o:Te(n,"expected hexadecimal character");n.result+=bJ(s),n.position++}else Te(n,"unknown escape sequence");t=r=n.position}else ks(c)?(wa(n,t,r,!0),BT(n,fr(n,!1,e)),t=r=n.position):n.position===n.lineStart&&By(n)?Te(n,"unexpected end of the document within a double quoted scalar"):(n.position++,r=n.position)}Te(n,"unexpected end of the stream within a double quoted scalar")}a(vJ,"readDoubleQuotedScalar");function EJ(n,e){var t=!0,r,i,s,o=n.tag,c,l=n.anchor,u,f,d,h,p,y=Object.create(null),g,v,_,S;if(S=n.input.charCodeAt(n.position),S===91)f=93,p=!1,c=[];else if(S===123)f=125,p=!0,c={};else return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=c),S=n.input.charCodeAt(++n.position);S!==0;){if(fr(n,!0,e),S=n.input.charCodeAt(n.position),S===f)return n.position++,n.tag=o,n.anchor=l,n.kind=p?"mapping":"sequence",n.result=c,!0;t?S===44&&Te(n,"expected the node content, but found ','"):Te(n,"missed comma between flow collection entries"),v=g=_=null,d=h=!1,S===63&&(u=n.input.charCodeAt(n.position+1),$n(u)&&(d=h=!0,n.position++,fr(n,!0,e))),r=n.line,i=n.lineStart,s=n.position,wu(n,e,ky,!1,!0),v=n.tag,g=n.result,fr(n,!0,e),S=n.input.charCodeAt(n.position),(h||n.line===r)&&S===58&&(d=!0,S=n.input.charCodeAt(++n.position),fr(n,!0,e),wu(n,e,ky,!1,!0),_=n.result),p?Su(n,c,y,v,g,_,r,i,s):d?c.push(Su(n,null,y,v,g,_,r,i,s)):c.push(g),fr(n,!0,e),S=n.input.charCodeAt(n.position),S===44?(t=!0,S=n.input.charCodeAt(++n.position)):t=!1}Te(n,"unexpected end of the stream within a flow collection")}a(EJ,"readFlowCollection");function TJ(n,e){var t,r,i=DT,s=!1,o=!1,c=e,l=0,u=!1,f,d;if(d=n.input.charCodeAt(n.position),d===124)r=!1;else if(d===62)r=!0;else return!1;for(n.kind="scalar",n.result="";d!==0;)if(d=n.input.charCodeAt(++n.position),d===43||d===45)DT===i?i=d===43?$F:fJ:Te(n,"repeat of a chomping mode identifier");else if((f=yJ(d))>=0)f===0?Te(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Te(n,"repeat of an indentation width identifier"):(c=e+f-1,o=!0);else break;if(xc(d)){do d=n.input.charCodeAt(++n.position);while(xc(d));if(d===35)do d=n.input.charCodeAt(++n.position);while(!ks(d)&&d!==0)}for(;d!==0;){for(UT(n),n.lineIndent=0,d=n.input.charCodeAt(n.position);(!o||n.lineIndent<c)&&d===32;)n.lineIndent++,d=n.input.charCodeAt(++n.position);if(!o&&n.lineIndent>c&&(c=n.lineIndent),ks(d)){l++;continue}if(n.lineIndent<c){i===$F?n.result+=br.repeat(`
498
+ \r`;function YY(n){if(n===null)return!1;var e,t,r=0,i=n.length,s=jT;for(t=0;t<i;t++)if(e=s.indexOf(n.charAt(t)),!(e>64)){if(e<0)return!1;r+=6}return r%8===0}a(YY,"resolveYamlBinary");function JY(n){var e,t,r=n.replace(/[\r\n=]/g,""),i=r.length,s=jT,o=0,c=[];for(e=0;e<i;e++)e%4===0&&e&&(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)),o=o<<6|s.indexOf(r.charAt(e));return t=i%4*6,t===0?(c.push(o>>16&255),c.push(o>>8&255),c.push(o&255)):t===18?(c.push(o>>10&255),c.push(o>>2&255)):t===12&&c.push(o>>4&255),new Uint8Array(c)}a(JY,"constructYamlBinary");function ZY(n){var e="",t=0,r,i,s=n.length,o=jT;for(r=0;r<s;r++)r%3===0&&r&&(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+n[r];return i=s%3,i===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):i===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):i===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}a(ZY,"representYamlBinary");function eJ(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}a(eJ,"isBinary");var gL=new qr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:YY,construct:JY,predicate:eJ,represent:ZY}),tJ=Object.prototype.hasOwnProperty,rJ=Object.prototype.toString;function nJ(n){if(n===null)return!0;var e=[],t,r,i,s,o,c=n;for(t=0,r=c.length;t<r;t+=1){if(i=c[t],o=!1,rJ.call(i)!=="[object Object]")return!1;for(s in i)if(tJ.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}a(nJ,"resolveYamlOmap");function iJ(n){return n!==null?n:[]}a(iJ,"constructYamlOmap");var yL=new qr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:nJ,construct:iJ}),sJ=Object.prototype.toString;function oJ(n){if(n===null)return!0;var e,t,r,i,s,o=n;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1){if(r=o[e],sJ.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[e]=[i[0],r[i[0]]]}return!0}a(oJ,"resolveYamlPairs");function aJ(n){if(n===null)return[];var e,t,r,i,s,o=n;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1)r=o[e],i=Object.keys(r),s[e]=[i[0],r[i[0]]];return s}a(aJ,"constructYamlPairs");var bL=new qr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:oJ,construct:aJ}),cJ=Object.prototype.hasOwnProperty;function lJ(n){if(n===null)return!0;var e,t=n;for(e in t)if(cJ.call(t,e)&&t[e]!==null)return!1;return!0}a(lJ,"resolveYamlSet");function uJ(n){return n!==null?n:{}}a(uJ,"constructYamlSet");var _L=new qr("tag:yaml.org,2002:set",{kind:"mapping",resolve:lJ,construct:uJ}),$T=fL.extend({implicit:[pL,mL],explicit:[gL,yL,bL,_L]}),va=Object.prototype.hasOwnProperty,ky=1,SL=2,wL=3,My=4,DT=1,fJ=2,$F=3,dJ=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,hJ=/[\x85\u2028\u2029]/,pJ=/[,\[\]\{\}]/,vL=/^(?:!|!!|![a-z\-]+!)$/i,EL=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function UF(n){return Object.prototype.toString.call(n)}a(UF,"_class");function Ms(n){return n===10||n===13}a(Ms,"is_EOL");function xc(n){return n===9||n===32}a(xc,"is_WHITE_SPACE");function $n(n){return n===9||n===32||n===10||n===13}a($n,"is_WS_OR_EOL");function _u(n){return n===44||n===91||n===93||n===123||n===125}a(_u,"is_FLOW_INDICATOR");function mJ(n){var e;return 48<=n&&n<=57?n-48:(e=n|32,97<=e&&e<=102?e-97+10:-1)}a(mJ,"fromHexCode");function gJ(n){return n===120?2:n===117?4:n===85?8:0}a(gJ,"escapedHexLen");function yJ(n){return 48<=n&&n<=57?n-48:-1}a(yJ,"fromDecimalCode");function BF(n){return n===48?"\0":n===97?"\x07":n===98?"\b":n===116||n===9?" ":n===110?`
499
+ `:n===118?"\v":n===102?"\f":n===114?"\r":n===101?"\x1B":n===32?" ":n===34?'"':n===47?"/":n===92?"\\":n===78?"\x85":n===95?"\xA0":n===76?"\u2028":n===80?"\u2029":""}a(BF,"simpleEscapeSequence");function bJ(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}a(bJ,"charFromCodepoint");function TL(n,e,t){e==="__proto__"?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[e]=t}a(TL,"setProperty");var AL=new Array(256),IL=new Array(256);for(Ic=0;Ic<256;Ic++)AL[Ic]=BF(Ic)?1:0,IL[Ic]=BF(Ic);var Ic;function _J(n,e){this.input=n,this.filename=e.filename||null,this.schema=e.schema||$T,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}a(_J,"State$1");function xL(n,e){var t={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return t.snippet=EY(t),new wn(e,t)}a(xL,"generateError");function Te(n,e){throw xL(n,e)}a(Te,"throwError");function jy(n,e){n.onWarning&&n.onWarning.call(null,xL(n,e))}a(jy,"throwWarning");var VF={YAML:a(function(e,t,r){var i,s,o;e.version!==null&&Te(e,"duplication of %YAML directive"),r.length!==1&&Te(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&Te(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Te(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&jy(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:a(function(e,t,r){var i,s;r.length!==2&&Te(e,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],vL.test(i)||Te(e,"ill-formed tag handle (first argument) of the TAG directive"),va.call(e.tagMap,i)&&Te(e,'there is a previously declared suffix for "'+i+'" tag handle'),EL.test(s)||Te(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Te(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function wa(n,e,t,r){var i,s,o,c;if(e<t){if(c=n.input.slice(e,t),r)for(i=0,s=c.length;i<s;i+=1)o=c.charCodeAt(i),o===9||32<=o&&o<=1114111||Te(n,"expected valid JSON character");else dJ.test(c)&&Te(n,"the stream contains non-printable characters");n.result+=c}}a(wa,"captureSegment");function GF(n,e,t,r){var i,s,o,c;for(br.isObject(t)||Te(n,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),o=0,c=i.length;o<c;o+=1)s=i[o],va.call(e,s)||(TL(e,s,t[s]),r[s]=!0)}a(GF,"mergeMappings");function Su(n,e,t,r,i,s,o,c,l){var u,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),u=0,f=i.length;u<f;u+=1)Array.isArray(i[u])&&Te(n,"nested arrays are not supported inside keys"),typeof i=="object"&&UF(i[u])==="[object Object]"&&(i[u]="[object Object]");if(typeof i=="object"&&UF(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,f=s.length;u<f;u+=1)GF(n,e,s[u],t);else GF(n,e,s,t);else!n.json&&!va.call(t,i)&&va.call(e,i)&&(n.line=o||n.line,n.lineStart=c||n.lineStart,n.position=l||n.position,Te(n,"duplicated mapping key")),TL(e,i,s),delete t[i];return e}a(Su,"storeMappingPair");function UT(n){var e;e=n.input.charCodeAt(n.position),e===10?n.position++:e===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):Te(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}a(UT,"readLineBreak");function fr(n,e,t){for(var r=0,i=n.input.charCodeAt(n.position);i!==0;){for(;xc(i);)i===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),i=n.input.charCodeAt(++n.position);if(e&&i===35)do i=n.input.charCodeAt(++n.position);while(i!==10&&i!==13&&i!==0);if(Ms(i))for(UT(n),i=n.input.charCodeAt(n.position),r++,n.lineIndent=0;i===32;)n.lineIndent++,i=n.input.charCodeAt(++n.position);else break}return t!==-1&&r!==0&&n.lineIndent<t&&jy(n,"deficient indentation"),r}a(fr,"skipSeparationSpace");function By(n){var e=n.position,t;return t=n.input.charCodeAt(e),!!((t===45||t===46)&&t===n.input.charCodeAt(e+1)&&t===n.input.charCodeAt(e+2)&&(e+=3,t=n.input.charCodeAt(e),t===0||$n(t)))}a(By,"testDocumentSeparator");function BT(n,e){e===1?n.result+=" ":e>1&&(n.result+=br.repeat(`
500
+ `,e-1))}a(BT,"writeFoldedLines");function SJ(n,e,t){var r,i,s,o,c,l,u,f,d=n.kind,h=n.result,p;if(p=n.input.charCodeAt(n.position),$n(p)||_u(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=n.input.charCodeAt(n.position+1),$n(i)||t&&_u(i)))return!1;for(n.kind="scalar",n.result="",s=o=n.position,c=!1;p!==0;){if(p===58){if(i=n.input.charCodeAt(n.position+1),$n(i)||t&&_u(i))break}else if(p===35){if(r=n.input.charCodeAt(n.position-1),$n(r))break}else{if(n.position===n.lineStart&&By(n)||t&&_u(p))break;if(Ms(p))if(l=n.line,u=n.lineStart,f=n.lineIndent,fr(n,!1,-1),n.lineIndent>=e){c=!0,p=n.input.charCodeAt(n.position);continue}else{n.position=o,n.line=l,n.lineStart=u,n.lineIndent=f;break}}c&&(wa(n,s,o,!1),BT(n,n.line-l),s=o=n.position,c=!1),xc(p)||(o=n.position+1),p=n.input.charCodeAt(++n.position)}return wa(n,s,o,!1),n.result?!0:(n.kind=d,n.result=h,!1)}a(SJ,"readPlainScalar");function wJ(n,e){var t,r,i;if(t=n.input.charCodeAt(n.position),t!==39)return!1;for(n.kind="scalar",n.result="",n.position++,r=i=n.position;(t=n.input.charCodeAt(n.position))!==0;)if(t===39)if(wa(n,r,n.position,!0),t=n.input.charCodeAt(++n.position),t===39)r=n.position,n.position++,i=n.position;else return!0;else Ms(t)?(wa(n,r,i,!0),BT(n,fr(n,!1,e)),r=i=n.position):n.position===n.lineStart&&By(n)?Te(n,"unexpected end of the document within a single quoted scalar"):(n.position++,i=n.position);Te(n,"unexpected end of the stream within a single quoted scalar")}a(wJ,"readSingleQuotedScalar");function vJ(n,e){var t,r,i,s,o,c;if(c=n.input.charCodeAt(n.position),c!==34)return!1;for(n.kind="scalar",n.result="",n.position++,t=r=n.position;(c=n.input.charCodeAt(n.position))!==0;){if(c===34)return wa(n,t,n.position,!0),n.position++,!0;if(c===92){if(wa(n,t,n.position,!0),c=n.input.charCodeAt(++n.position),Ms(c))fr(n,!1,e);else if(c<256&&AL[c])n.result+=IL[c],n.position++;else if((o=gJ(c))>0){for(i=o,s=0;i>0;i--)c=n.input.charCodeAt(++n.position),(o=mJ(c))>=0?s=(s<<4)+o:Te(n,"expected hexadecimal character");n.result+=bJ(s),n.position++}else Te(n,"unknown escape sequence");t=r=n.position}else Ms(c)?(wa(n,t,r,!0),BT(n,fr(n,!1,e)),t=r=n.position):n.position===n.lineStart&&By(n)?Te(n,"unexpected end of the document within a double quoted scalar"):(n.position++,r=n.position)}Te(n,"unexpected end of the stream within a double quoted scalar")}a(vJ,"readDoubleQuotedScalar");function EJ(n,e){var t=!0,r,i,s,o=n.tag,c,l=n.anchor,u,f,d,h,p,y=Object.create(null),g,v,_,S;if(S=n.input.charCodeAt(n.position),S===91)f=93,p=!1,c=[];else if(S===123)f=125,p=!0,c={};else return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=c),S=n.input.charCodeAt(++n.position);S!==0;){if(fr(n,!0,e),S=n.input.charCodeAt(n.position),S===f)return n.position++,n.tag=o,n.anchor=l,n.kind=p?"mapping":"sequence",n.result=c,!0;t?S===44&&Te(n,"expected the node content, but found ','"):Te(n,"missed comma between flow collection entries"),v=g=_=null,d=h=!1,S===63&&(u=n.input.charCodeAt(n.position+1),$n(u)&&(d=h=!0,n.position++,fr(n,!0,e))),r=n.line,i=n.lineStart,s=n.position,wu(n,e,ky,!1,!0),v=n.tag,g=n.result,fr(n,!0,e),S=n.input.charCodeAt(n.position),(h||n.line===r)&&S===58&&(d=!0,S=n.input.charCodeAt(++n.position),fr(n,!0,e),wu(n,e,ky,!1,!0),_=n.result),p?Su(n,c,y,v,g,_,r,i,s):d?c.push(Su(n,null,y,v,g,_,r,i,s)):c.push(g),fr(n,!0,e),S=n.input.charCodeAt(n.position),S===44?(t=!0,S=n.input.charCodeAt(++n.position)):t=!1}Te(n,"unexpected end of the stream within a flow collection")}a(EJ,"readFlowCollection");function TJ(n,e){var t,r,i=DT,s=!1,o=!1,c=e,l=0,u=!1,f,d;if(d=n.input.charCodeAt(n.position),d===124)r=!1;else if(d===62)r=!0;else return!1;for(n.kind="scalar",n.result="";d!==0;)if(d=n.input.charCodeAt(++n.position),d===43||d===45)DT===i?i=d===43?$F:fJ:Te(n,"repeat of a chomping mode identifier");else if((f=yJ(d))>=0)f===0?Te(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Te(n,"repeat of an indentation width identifier"):(c=e+f-1,o=!0);else break;if(xc(d)){do d=n.input.charCodeAt(++n.position);while(xc(d));if(d===35)do d=n.input.charCodeAt(++n.position);while(!Ms(d)&&d!==0)}for(;d!==0;){for(UT(n),n.lineIndent=0,d=n.input.charCodeAt(n.position);(!o||n.lineIndent<c)&&d===32;)n.lineIndent++,d=n.input.charCodeAt(++n.position);if(!o&&n.lineIndent>c&&(c=n.lineIndent),Ms(d)){l++;continue}if(n.lineIndent<c){i===$F?n.result+=br.repeat(`
501
501
  `,s?1+l:l):i===DT&&s&&(n.result+=`
502
502
  `);break}for(r?xc(d)?(u=!0,n.result+=br.repeat(`
503
503
  `,s?1+l:l)):u?(u=!1,n.result+=br.repeat(`
504
504
  `,l+1)):l===0?s&&(n.result+=" "):n.result+=br.repeat(`
505
505
  `,l):n.result+=br.repeat(`
506
- `,s?1+l:l),s=!0,o=!0,l=0,t=n.position;!ks(d)&&d!==0;)d=n.input.charCodeAt(++n.position);wa(n,t,n.position,!1)}return!0}a(TJ,"readBlockScalar");function qF(n,e){var t,r=n.tag,i=n.anchor,s=[],o,c=!1,l;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=s),l=n.input.charCodeAt(n.position);l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,Te(n,"tab characters must not be used in indentation")),!(l!==45||(o=n.input.charCodeAt(n.position+1),!$n(o))));){if(c=!0,n.position++,fr(n,!0,-1)&&n.lineIndent<=e){s.push(null),l=n.input.charCodeAt(n.position);continue}if(t=n.line,wu(n,e,wL,!1,!0),s.push(n.result),fr(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===t||n.lineIndent>e)&&l!==0)Te(n,"bad indentation of a sequence entry");else if(n.lineIndent<e)break}return c?(n.tag=r,n.anchor=i,n.kind="sequence",n.result=s,!0):!1}a(qF,"readBlockSequence");function AJ(n,e,t){var r,i,s,o,c,l,u=n.tag,f=n.anchor,d={},h=Object.create(null),p=null,y=null,g=null,v=!1,_=!1,S;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=d),S=n.input.charCodeAt(n.position);S!==0;){if(!v&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,Te(n,"tab characters must not be used in indentation")),r=n.input.charCodeAt(n.position+1),s=n.line,(S===63||S===58)&&$n(r))S===63?(v&&(Su(n,d,h,p,y,null,o,c,l),p=y=g=null),_=!0,v=!0,i=!0):v?(v=!1,i=!0):Te(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,S=r;else{if(o=n.line,c=n.lineStart,l=n.position,!wu(n,t,SL,!1,!0))break;if(n.line===s){for(S=n.input.charCodeAt(n.position);xc(S);)S=n.input.charCodeAt(++n.position);if(S===58)S=n.input.charCodeAt(++n.position),$n(S)||Te(n,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(Su(n,d,h,p,y,null,o,c,l),p=y=g=null),_=!0,v=!1,i=!1,p=n.tag,y=n.result;else if(_)Te(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=u,n.anchor=f,!0}else if(_)Te(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=u,n.anchor=f,!0}if((n.line===s||n.lineIndent>e)&&(v&&(o=n.line,c=n.lineStart,l=n.position),wu(n,e,My,!0,i)&&(v?y=n.result:g=n.result),v||(Su(n,d,h,p,y,g,o,c,l),p=y=g=null),fr(n,!0,-1),S=n.input.charCodeAt(n.position)),(n.line===s||n.lineIndent>e)&&S!==0)Te(n,"bad indentation of a mapping entry");else if(n.lineIndent<e)break}return v&&Su(n,d,h,p,y,null,o,c,l),_&&(n.tag=u,n.anchor=f,n.kind="mapping",n.result=d),_}a(AJ,"readBlockMapping");function IJ(n){var e,t=!1,r=!1,i,s,o;if(o=n.input.charCodeAt(n.position),o!==33)return!1;if(n.tag!==null&&Te(n,"duplication of a tag property"),o=n.input.charCodeAt(++n.position),o===60?(t=!0,o=n.input.charCodeAt(++n.position)):o===33?(r=!0,i="!!",o=n.input.charCodeAt(++n.position)):i="!",e=n.position,t){do o=n.input.charCodeAt(++n.position);while(o!==0&&o!==62);n.position<n.length?(s=n.input.slice(e,n.position),o=n.input.charCodeAt(++n.position)):Te(n,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!$n(o);)o===33&&(r?Te(n,"tag suffix cannot contain exclamation marks"):(i=n.input.slice(e-1,n.position+1),vL.test(i)||Te(n,"named tag handle cannot contain such characters"),r=!0,e=n.position+1)),o=n.input.charCodeAt(++n.position);s=n.input.slice(e,n.position),pJ.test(s)&&Te(n,"tag suffix cannot contain flow indicator characters")}s&&!EL.test(s)&&Te(n,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Te(n,"tag name is malformed: "+s)}return t?n.tag=s:va.call(n.tagMap,i)?n.tag=n.tagMap[i]+s:i==="!"?n.tag="!"+s:i==="!!"?n.tag="tag:yaml.org,2002:"+s:Te(n,'undeclared tag handle "'+i+'"'),!0}a(IJ,"readTagProperty");function xJ(n){var e,t;if(t=n.input.charCodeAt(n.position),t!==38)return!1;for(n.anchor!==null&&Te(n,"duplication of an anchor property"),t=n.input.charCodeAt(++n.position),e=n.position;t!==0&&!$n(t)&&!_u(t);)t=n.input.charCodeAt(++n.position);return n.position===e&&Te(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(e,n.position),!0}a(xJ,"readAnchorProperty");function RJ(n){var e,t,r;if(r=n.input.charCodeAt(n.position),r!==42)return!1;for(r=n.input.charCodeAt(++n.position),e=n.position;r!==0&&!$n(r)&&!_u(r);)r=n.input.charCodeAt(++n.position);return n.position===e&&Te(n,"name of an alias node must contain at least one character"),t=n.input.slice(e,n.position),va.call(n.anchorMap,t)||Te(n,'unidentified alias "'+t+'"'),n.result=n.anchorMap[t],fr(n,!0,-1),!0}a(RJ,"readAlias");function wu(n,e,t,r,i){var s,o,c,l=1,u=!1,f=!1,d,h,p,y,g,v;if(n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null,s=o=c=My===t||wL===t,r&&fr(n,!0,-1)&&(u=!0,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)),l===1)for(;IJ(n)||xJ(n);)fr(n,!0,-1)?(u=!0,c=s,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)):c=!1;if(c&&(c=u||i),(l===1||My===t)&&(ky===t||SL===t?g=e:g=e+1,v=n.position-n.lineStart,l===1?c&&(qF(n,v)||AJ(n,v,g))||EJ(n,g)?f=!0:(o&&TJ(n,g)||wJ(n,g)||vJ(n,g)?f=!0:RJ(n)?(f=!0,(n.tag!==null||n.anchor!==null)&&Te(n,"alias node should not have any properties")):SJ(n,g,ky===t)&&(f=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):l===0&&(f=c&&qF(n,v))),n.tag===null)n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);else if(n.tag==="?"){for(n.result!==null&&n.kind!=="scalar"&&Te(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"'),d=0,h=n.implicitTypes.length;d<h;d+=1)if(y=n.implicitTypes[d],y.resolve(n.result)){n.result=y.construct(n.result),n.tag=y.tag,n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);break}}else if(n.tag!=="!"){if(va.call(n.typeMap[n.kind||"fallback"],n.tag))y=n.typeMap[n.kind||"fallback"][n.tag];else for(y=null,p=n.typeMap.multi[n.kind||"fallback"],d=0,h=p.length;d<h;d+=1)if(n.tag.slice(0,p[d].tag.length)===p[d].tag){y=p[d];break}y||Te(n,"unknown tag !<"+n.tag+">"),n.result!==null&&y.kind!==n.kind&&Te(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+y.kind+'", not "'+n.kind+'"'),y.resolve(n.result,n.tag)?(n.result=y.construct(n.result,n.tag),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):Te(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.tag!==null||n.anchor!==null||f}a(wu,"composeNode");function PJ(n){var e=n.position,t,r,i,s=!1,o;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(o=n.input.charCodeAt(n.position))!==0&&(fr(n,!0,-1),o=n.input.charCodeAt(n.position),!(n.lineIndent>0||o!==37));){for(s=!0,o=n.input.charCodeAt(++n.position),t=n.position;o!==0&&!$n(o);)o=n.input.charCodeAt(++n.position);for(r=n.input.slice(t,n.position),i=[],r.length<1&&Te(n,"directive name must not be less than one character in length");o!==0;){for(;xc(o);)o=n.input.charCodeAt(++n.position);if(o===35){do o=n.input.charCodeAt(++n.position);while(o!==0&&!ks(o));break}if(ks(o))break;for(t=n.position;o!==0&&!$n(o);)o=n.input.charCodeAt(++n.position);i.push(n.input.slice(t,n.position))}o!==0&&UT(n),va.call(VF,r)?VF[r](n,r,i):jy(n,'unknown document directive "'+r+'"')}if(fr(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,fr(n,!0,-1)):s&&Te(n,"directives end mark is expected"),wu(n,n.lineIndent-1,My,!1,!0),fr(n,!0,-1),n.checkLineBreaks&&hJ.test(n.input.slice(e,n.position))&&jy(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&By(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,fr(n,!0,-1));return}if(n.position<n.length-1)Te(n,"end of the stream or a document separator is expected");else return}a(PJ,"readDocument");function RL(n,e){n=String(n),e=e||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
506
+ `,s?1+l:l),s=!0,o=!0,l=0,t=n.position;!Ms(d)&&d!==0;)d=n.input.charCodeAt(++n.position);wa(n,t,n.position,!1)}return!0}a(TJ,"readBlockScalar");function qF(n,e){var t,r=n.tag,i=n.anchor,s=[],o,c=!1,l;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=s),l=n.input.charCodeAt(n.position);l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,Te(n,"tab characters must not be used in indentation")),!(l!==45||(o=n.input.charCodeAt(n.position+1),!$n(o))));){if(c=!0,n.position++,fr(n,!0,-1)&&n.lineIndent<=e){s.push(null),l=n.input.charCodeAt(n.position);continue}if(t=n.line,wu(n,e,wL,!1,!0),s.push(n.result),fr(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===t||n.lineIndent>e)&&l!==0)Te(n,"bad indentation of a sequence entry");else if(n.lineIndent<e)break}return c?(n.tag=r,n.anchor=i,n.kind="sequence",n.result=s,!0):!1}a(qF,"readBlockSequence");function AJ(n,e,t){var r,i,s,o,c,l,u=n.tag,f=n.anchor,d={},h=Object.create(null),p=null,y=null,g=null,v=!1,_=!1,S;if(n.firstTabInLine!==-1)return!1;for(n.anchor!==null&&(n.anchorMap[n.anchor]=d),S=n.input.charCodeAt(n.position);S!==0;){if(!v&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,Te(n,"tab characters must not be used in indentation")),r=n.input.charCodeAt(n.position+1),s=n.line,(S===63||S===58)&&$n(r))S===63?(v&&(Su(n,d,h,p,y,null,o,c,l),p=y=g=null),_=!0,v=!0,i=!0):v?(v=!1,i=!0):Te(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,S=r;else{if(o=n.line,c=n.lineStart,l=n.position,!wu(n,t,SL,!1,!0))break;if(n.line===s){for(S=n.input.charCodeAt(n.position);xc(S);)S=n.input.charCodeAt(++n.position);if(S===58)S=n.input.charCodeAt(++n.position),$n(S)||Te(n,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(Su(n,d,h,p,y,null,o,c,l),p=y=g=null),_=!0,v=!1,i=!1,p=n.tag,y=n.result;else if(_)Te(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=u,n.anchor=f,!0}else if(_)Te(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=u,n.anchor=f,!0}if((n.line===s||n.lineIndent>e)&&(v&&(o=n.line,c=n.lineStart,l=n.position),wu(n,e,My,!0,i)&&(v?y=n.result:g=n.result),v||(Su(n,d,h,p,y,g,o,c,l),p=y=g=null),fr(n,!0,-1),S=n.input.charCodeAt(n.position)),(n.line===s||n.lineIndent>e)&&S!==0)Te(n,"bad indentation of a mapping entry");else if(n.lineIndent<e)break}return v&&Su(n,d,h,p,y,null,o,c,l),_&&(n.tag=u,n.anchor=f,n.kind="mapping",n.result=d),_}a(AJ,"readBlockMapping");function IJ(n){var e,t=!1,r=!1,i,s,o;if(o=n.input.charCodeAt(n.position),o!==33)return!1;if(n.tag!==null&&Te(n,"duplication of a tag property"),o=n.input.charCodeAt(++n.position),o===60?(t=!0,o=n.input.charCodeAt(++n.position)):o===33?(r=!0,i="!!",o=n.input.charCodeAt(++n.position)):i="!",e=n.position,t){do o=n.input.charCodeAt(++n.position);while(o!==0&&o!==62);n.position<n.length?(s=n.input.slice(e,n.position),o=n.input.charCodeAt(++n.position)):Te(n,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!$n(o);)o===33&&(r?Te(n,"tag suffix cannot contain exclamation marks"):(i=n.input.slice(e-1,n.position+1),vL.test(i)||Te(n,"named tag handle cannot contain such characters"),r=!0,e=n.position+1)),o=n.input.charCodeAt(++n.position);s=n.input.slice(e,n.position),pJ.test(s)&&Te(n,"tag suffix cannot contain flow indicator characters")}s&&!EL.test(s)&&Te(n,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Te(n,"tag name is malformed: "+s)}return t?n.tag=s:va.call(n.tagMap,i)?n.tag=n.tagMap[i]+s:i==="!"?n.tag="!"+s:i==="!!"?n.tag="tag:yaml.org,2002:"+s:Te(n,'undeclared tag handle "'+i+'"'),!0}a(IJ,"readTagProperty");function xJ(n){var e,t;if(t=n.input.charCodeAt(n.position),t!==38)return!1;for(n.anchor!==null&&Te(n,"duplication of an anchor property"),t=n.input.charCodeAt(++n.position),e=n.position;t!==0&&!$n(t)&&!_u(t);)t=n.input.charCodeAt(++n.position);return n.position===e&&Te(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(e,n.position),!0}a(xJ,"readAnchorProperty");function RJ(n){var e,t,r;if(r=n.input.charCodeAt(n.position),r!==42)return!1;for(r=n.input.charCodeAt(++n.position),e=n.position;r!==0&&!$n(r)&&!_u(r);)r=n.input.charCodeAt(++n.position);return n.position===e&&Te(n,"name of an alias node must contain at least one character"),t=n.input.slice(e,n.position),va.call(n.anchorMap,t)||Te(n,'unidentified alias "'+t+'"'),n.result=n.anchorMap[t],fr(n,!0,-1),!0}a(RJ,"readAlias");function wu(n,e,t,r,i){var s,o,c,l=1,u=!1,f=!1,d,h,p,y,g,v;if(n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null,s=o=c=My===t||wL===t,r&&fr(n,!0,-1)&&(u=!0,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)),l===1)for(;IJ(n)||xJ(n);)fr(n,!0,-1)?(u=!0,c=s,n.lineIndent>e?l=1:n.lineIndent===e?l=0:n.lineIndent<e&&(l=-1)):c=!1;if(c&&(c=u||i),(l===1||My===t)&&(ky===t||SL===t?g=e:g=e+1,v=n.position-n.lineStart,l===1?c&&(qF(n,v)||AJ(n,v,g))||EJ(n,g)?f=!0:(o&&TJ(n,g)||wJ(n,g)||vJ(n,g)?f=!0:RJ(n)?(f=!0,(n.tag!==null||n.anchor!==null)&&Te(n,"alias node should not have any properties")):SJ(n,g,ky===t)&&(f=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):l===0&&(f=c&&qF(n,v))),n.tag===null)n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);else if(n.tag==="?"){for(n.result!==null&&n.kind!=="scalar"&&Te(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"'),d=0,h=n.implicitTypes.length;d<h;d+=1)if(y=n.implicitTypes[d],y.resolve(n.result)){n.result=y.construct(n.result),n.tag=y.tag,n.anchor!==null&&(n.anchorMap[n.anchor]=n.result);break}}else if(n.tag!=="!"){if(va.call(n.typeMap[n.kind||"fallback"],n.tag))y=n.typeMap[n.kind||"fallback"][n.tag];else for(y=null,p=n.typeMap.multi[n.kind||"fallback"],d=0,h=p.length;d<h;d+=1)if(n.tag.slice(0,p[d].tag.length)===p[d].tag){y=p[d];break}y||Te(n,"unknown tag !<"+n.tag+">"),n.result!==null&&y.kind!==n.kind&&Te(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+y.kind+'", not "'+n.kind+'"'),y.resolve(n.result,n.tag)?(n.result=y.construct(n.result,n.tag),n.anchor!==null&&(n.anchorMap[n.anchor]=n.result)):Te(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.tag!==null||n.anchor!==null||f}a(wu,"composeNode");function PJ(n){var e=n.position,t,r,i,s=!1,o;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(o=n.input.charCodeAt(n.position))!==0&&(fr(n,!0,-1),o=n.input.charCodeAt(n.position),!(n.lineIndent>0||o!==37));){for(s=!0,o=n.input.charCodeAt(++n.position),t=n.position;o!==0&&!$n(o);)o=n.input.charCodeAt(++n.position);for(r=n.input.slice(t,n.position),i=[],r.length<1&&Te(n,"directive name must not be less than one character in length");o!==0;){for(;xc(o);)o=n.input.charCodeAt(++n.position);if(o===35){do o=n.input.charCodeAt(++n.position);while(o!==0&&!Ms(o));break}if(Ms(o))break;for(t=n.position;o!==0&&!$n(o);)o=n.input.charCodeAt(++n.position);i.push(n.input.slice(t,n.position))}o!==0&&UT(n),va.call(VF,r)?VF[r](n,r,i):jy(n,'unknown document directive "'+r+'"')}if(fr(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,fr(n,!0,-1)):s&&Te(n,"directives end mark is expected"),wu(n,n.lineIndent-1,My,!1,!0),fr(n,!0,-1),n.checkLineBreaks&&hJ.test(n.input.slice(e,n.position))&&jy(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&By(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,fr(n,!0,-1));return}if(n.position<n.length-1)Te(n,"end of the stream or a document separator is expected");else return}a(PJ,"readDocument");function RL(n,e){n=String(n),e=e||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
507
507
  `),n.charCodeAt(0)===65279&&(n=n.slice(1)));var t=new _J(n,e),r=n.indexOf("\0");for(r!==-1&&(t.position=r,Te(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)PJ(t);return t.documents}a(RL,"loadDocuments");function CJ(n,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var r=RL(n,t);if(typeof e!="function")return r;for(var i=0,s=r.length;i<s;i+=1)e(r[i])}a(CJ,"loadAll$1");function OJ(n,e){var t=RL(n,e);if(t.length!==0){if(t.length===1)return t[0];throw new wn("expected a single document in the stream, but found more")}}a(OJ,"load$1");var DJ=CJ,FJ=OJ,PL={loadAll:DJ,load:FJ},CL=Object.prototype.toString,OL=Object.prototype.hasOwnProperty,VT=65279,LJ=9,Ld=10,NJ=13,kJ=32,MJ=33,jJ=34,LT=35,$J=37,UJ=38,BJ=39,VJ=42,DL=44,GJ=45,$y=58,qJ=61,WJ=62,zJ=63,HJ=64,FL=91,LL=93,KJ=96,NL=123,QJ=124,kL=125,tn={};tn[0]="\\0";tn[7]="\\a";tn[8]="\\b";tn[9]="\\t";tn[10]="\\n";tn[11]="\\v";tn[12]="\\f";tn[13]="\\r";tn[27]="\\e";tn[34]='\\"';tn[92]="\\\\";tn[133]="\\N";tn[160]="\\_";tn[8232]="\\L";tn[8233]="\\P";var XJ=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],YJ=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function JJ(n,e){var t,r,i,s,o,c,l;if(e===null)return{};for(t={},r=Object.keys(e),i=0,s=r.length;i<s;i+=1)o=r[i],c=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=n.compiledTypeMap.fallback[o],l&&OL.call(l.styleAliases,c)&&(c=l.styleAliases[c]),t[o]=c;return t}a(JJ,"compileStyleMap");function ZJ(n){var e,t,r;if(e=n.toString(16).toUpperCase(),n<=255)t="x",r=2;else if(n<=65535)t="u",r=4;else if(n<=4294967295)t="U",r=8;else throw new wn("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+br.repeat("0",r-e.length)+e}a(ZJ,"encodeHex");var eZ=1,Nd=2;function tZ(n){this.schema=n.schema||$T,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=br.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=JJ(this.schema,n.styles||null),this.sortKeys=n.sortKeys||!1,this.lineWidth=n.lineWidth||80,this.noRefs=n.noRefs||!1,this.noCompatMode=n.noCompatMode||!1,this.condenseFlow=n.condenseFlow||!1,this.quotingType=n.quotingType==='"'?Nd:eZ,this.forceQuotes=n.forceQuotes||!1,this.replacer=typeof n.replacer=="function"?n.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}a(tZ,"State");function WF(n,e){for(var t=br.repeat(" ",e),r=0,i=-1,s="",o,c=n.length;r<c;)i=n.indexOf(`
508
508
  `,r),i===-1?(o=n.slice(r),r=c):(o=n.slice(r,i+1),r=i+1),o.length&&o!==`
509
509
  `&&(s+=t),s+=o;return s}a(WF,"indentString");function NT(n,e){return`
@@ -519,7 +519,7 @@ GFS4: `),console.error(n)},"debug"));zt[Gr]||(XO=global[Gr]||[],JO(zt,XO),zt.clo
519
519
  `+n.slice(i,s),i=s+1),o=c;return l+=`
520
520
  `,n.length-i>e&&o>i?l+=n.slice(i,o)+`
521
521
  `+n.slice(o+1):l+=n.slice(i),l.slice(1)}a(XF,"foldLine");function cZ(n){for(var e="",t=0,r,i=0;i<n.length;t>=65536?i+=2:i++)t=Dd(n,i),r=tn[t],!r&&kd(t)?(e+=n[i],t>=65536&&(e+=n[i+1])):e+=r||ZJ(t);return e}a(cZ,"escapeString");function lZ(n,e,t){var r="",i=n.tag,s,o,c;for(s=0,o=t.length;s<o;s+=1)c=t[s],n.replacer&&(c=n.replacer.call(t,String(s),c)),(Oo(n,e,c,!1,!1)||typeof c>"u"&&Oo(n,e,null,!1,!1))&&(r!==""&&(r+=","+(n.condenseFlow?"":" ")),r+=n.dump);n.tag=i,n.dump="["+r+"]"}a(lZ,"writeFlowSequence");function YF(n,e,t,r){var i="",s=n.tag,o,c,l;for(o=0,c=t.length;o<c;o+=1)l=t[o],n.replacer&&(l=n.replacer.call(t,String(o),l)),(Oo(n,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&Oo(n,e+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=NT(n,e)),n.dump&&Ld===n.dump.charCodeAt(0)?i+="-":i+="- ",i+=n.dump);n.tag=s,n.dump=i||"[]"}a(YF,"writeBlockSequence");function uZ(n,e,t){var r="",i=n.tag,s=Object.keys(t),o,c,l,u,f;for(o=0,c=s.length;o<c;o+=1)f="",r!==""&&(f+=", "),n.condenseFlow&&(f+='"'),l=s[o],u=t[l],n.replacer&&(u=n.replacer.call(t,l,u)),Oo(n,e,l,!1,!1)&&(n.dump.length>1024&&(f+="? "),f+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),Oo(n,e,u,!1,!1)&&(f+=n.dump,r+=f));n.tag=i,n.dump="{"+r+"}"}a(uZ,"writeFlowMapping");function fZ(n,e,t,r){var i="",s=n.tag,o=Object.keys(t),c,l,u,f,d,h;if(n.sortKeys===!0)o.sort();else if(typeof n.sortKeys=="function")o.sort(n.sortKeys);else if(n.sortKeys)throw new wn("sortKeys must be a boolean or a function");for(c=0,l=o.length;c<l;c+=1)h="",(!r||i!=="")&&(h+=NT(n,e)),u=o[c],f=t[u],n.replacer&&(f=n.replacer.call(t,u,f)),Oo(n,e+1,u,!0,!0,!0)&&(d=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024,d&&(n.dump&&Ld===n.dump.charCodeAt(0)?h+="?":h+="? "),h+=n.dump,d&&(h+=NT(n,e)),Oo(n,e+1,f,!0,d)&&(n.dump&&Ld===n.dump.charCodeAt(0)?h+=":":h+=": ",h+=n.dump,i+=h));n.tag=s,n.dump=i||"{}"}a(fZ,"writeBlockMapping");function JF(n,e,t){var r,i,s,o,c,l;for(i=t?n.explicitTypes:n.implicitTypes,s=0,o=i.length;s<o;s+=1)if(c=i[s],(c.instanceOf||c.predicate)&&(!c.instanceOf||typeof e=="object"&&e instanceof c.instanceOf)&&(!c.predicate||c.predicate(e))){if(t?c.multi&&c.representName?n.tag=c.representName(e):n.tag=c.tag:n.tag="?",c.represent){if(l=n.styleMap[c.tag]||c.defaultStyle,CL.call(c.represent)==="[object Function]")r=c.represent(e,l);else if(OL.call(c.represent,l))r=c.represent[l](e,l);else throw new wn("!<"+c.tag+'> tag resolver accepts not "'+l+'" style');n.dump=r}return!0}return!1}a(JF,"detectType");function Oo(n,e,t,r,i,s,o){n.tag=null,n.dump=t,JF(n,t,!1)||JF(n,t,!0);var c=CL.call(n.dump),l=r,u;r&&(r=n.flowLevel<0||n.flowLevel>e);var f=c==="[object Object]"||c==="[object Array]",d,h;if(f&&(d=n.duplicates.indexOf(t),h=d!==-1),(n.tag!==null&&n.tag!=="?"||h||n.indent!==2&&e>0)&&(i=!1),h&&n.usedDuplicates[d])n.dump="*ref_"+d;else{if(f&&h&&!n.usedDuplicates[d]&&(n.usedDuplicates[d]=!0),c==="[object Object]")r&&Object.keys(n.dump).length!==0?(fZ(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(uZ(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object Array]")r&&n.dump.length!==0?(n.noArrayIndent&&!o&&e>0?YF(n,e-1,n.dump,i):YF(n,e,n.dump,i),h&&(n.dump="&ref_"+d+n.dump)):(lZ(n,e,n.dump),h&&(n.dump="&ref_"+d+" "+n.dump));else if(c==="[object String]")n.tag!=="?"&&oZ(n,n.dump,e,s,l);else{if(c==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new wn("unacceptable kind of an object to dump "+c)}n.tag!==null&&n.tag!=="?"&&(u=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21"),n.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",n.dump=u+" "+n.dump)}return!0}a(Oo,"writeNode");function dZ(n,e){var t=[],r=[],i,s;for(MT(n,t,r),i=0,s=r.length;i<s;i+=1)e.duplicates.push(t[r[i]]);e.usedDuplicates=new Array(s)}a(dZ,"getDuplicateReferences");function MT(n,e,t){var r,i,s;if(n!==null&&typeof n=="object")if(i=e.indexOf(n),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(e.push(n),Array.isArray(n))for(i=0,s=n.length;i<s;i+=1)MT(n[i],e,t);else for(r=Object.keys(n),i=0,s=r.length;i<s;i+=1)MT(n[r[i]],e,t)}a(MT,"inspectNode");function hZ(n,e){e=e||{};var t=new tZ(e);t.noRefs||dZ(n,t);var r=n;return t.replacer&&(r=t.replacer.call({"":r},"",r)),Oo(t,0,r,!0,!0)?t.dump+`
522
- `:""}a(hZ,"dump$1");var pZ=hZ,mZ={dump:pZ};function GT(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}a(GT,"renamed");var gZ=qr,yZ=tL,bZ=sL,_Z=uL,SZ=fL,wZ=$T,vZ=PL.load,EZ=PL.loadAll,TZ=mZ.dump,AZ=wn,IZ={binary:gL,float:lL,map:iL,null:oL,pairs:bL,set:_L,timestamp:pL,bool:aL,int:cL,merge:mL,omap:yL,seq:nL,str:rL},xZ=GT("safeLoad","load"),RZ=GT("safeLoadAll","loadAll"),PZ=GT("safeDump","dump"),Nt={Type:gZ,Schema:yZ,FAILSAFE_SCHEMA:bZ,JSON_SCHEMA:_Z,CORE_SCHEMA:SZ,DEFAULT_SCHEMA:wZ,load:vZ,loadAll:EZ,dump:TZ,YAMLException:AZ,types:IZ,safeLoad:xZ,safeLoadAll:RZ,safeDump:PZ};var u2=J(Co()),Oc=J(require("path"));var cN=J(ZL(),1);var jd=a(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var MZ={"[: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]},$d=a(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),jZ=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),eN=a(n=>n.join(""),"rangesToString"),tN=a((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,o=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let g=n.charAt(s);if((g==="!"||g==="^")&&s===t+1){u=!0,s++;continue}if(g==="]"&&o&&!l){f=s+1;break}if(o=!0,g==="\\"&&!l){l=!0,s++;continue}if(g==="["&&!l){for(let[v,[_,S,T]]of Object.entries(MZ))if(n.startsWith(v,s)){if(d)return["$.",!1,n.length-t,!0];s+=v.length,T?i.push(_):r.push(_),c=c||S;continue e}}if(l=!1,d){g>d?r.push($d(d)+"-"+$d(g)):g===d&&r.push($d(g)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push($d(g+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=g,s+=2;continue}r.push($d(g)),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 g=r[0].length===2?r[0].slice(-1):r[0];return[jZ(g),!1,f-t,!1]}let h="["+(u?"^":"")+eN(r)+"]",p="["+(u?"":"^")+eN(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var Zi=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Un,$Z=new Set(["!","?","+","*","@"]),zT=a(n=>$Z.has(n),"isExtglobType"),rN=a(n=>zT(n.type),"isExtglobAST"),UZ=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),BZ=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),VZ=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),nN=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),GZ="(?!(?:^|/)\\.\\.?(?:$|/))",Vy="(?!\\.)",qZ=new Set(["[","."]),WZ=new Set(["..","."]),zZ=new Set("().*{}+?[]^$\\!"),HZ=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),HT="[^/]",iN=HT+"*?",sN=HT+"+?",Rc=class{static{a(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#b;#i;#u=!1;#s;#l;#o=!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.#b=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.#b+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 Un&&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.#b===0)return!0;let e=this.#c;for(let t=0;t<this.#b;t++){let r=e.#t[t];if(!(r instanceof Un&&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.#b===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Un(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let o=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let g=r,v="";for(;g<e.length;){let _=e.charAt(g++);if(c||_==="\\"){c=!c,v+=_;continue}if(l){g===u+1?(_==="^"||_==="!")&&(f=!0):_==="]"&&!(g===u+2&&f)&&(l=!1),v+=_;continue}else if(_==="["){l=!0,u=g,f=!1,v+=_;continue}if(!i.noext&&zT(_)&&e.charAt(g)==="("&&s<=o){t.push(v),v="";let T=new Un(_,t);g=Un.#g(e,T,g,i,s+1),t.push(T);continue}v+=_}return t.push(v),g}let d=r+1,h=new Un(null,t),p=[],y="";for(;d<e.length;){let g=e.charAt(d++);if(c||g==="\\"){c=!c,y+=g;continue}if(l){d===u+1?(g==="^"||g==="!")&&(f=!0):g==="]"&&!(d===u+2&&f)&&(l=!1),y+=g;continue}else if(g==="["){l=!0,u=d,f=!1,y+=g;continue}if(zT(g)&&e.charAt(d)==="("&&(s<=o||t&&t.#y(g))){let _=t&&t.#y(g)?0:1;h.push(y),y="";let S=new Un(g,h);h.push(S),d=Un.#g(e,S,d,i,s+_);continue}if(g==="|"){h.push(y),y="",p.push(h),h=new Un(null,t);continue}if(g===")")return y===""&&t.#t.length===0&&(t.#o=!0),h.push(y),y="",t.push(...p,h),d;y+=g}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,BZ)}#m(e,t=UZ){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=VZ){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Un(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!!nN.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)}#v(e){let t=nN.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.#o=!1}#S(){if(rN(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.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Un(null,void 0,t);return Un.#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.#S(),this.#p()),!rN(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,g,v,_]=typeof p=="string"?Un.#I(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||v,this.#r=this.#r||_,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&WZ.has(this.#t[0]))){let y=qZ,g=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),v=!t&&!e&&y.has(u.charAt(0));f=g?GZ:v?Vy:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,Zi(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(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,Zi(this.toString()),!1,!1]}let o=!r||e||t||!Vy?"":this.#w(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let c="";if(this.type==="!"&&this.#o)c=(this.isStart()&&!t?Vy:"")+sN;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Vy:"")+iN+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+s+l}return[c,Zi(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#I(e,t,r=!1){let i=!1,s="",o=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(zZ.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=tN(e,l);if(h){s+=f,o=o||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?sN:iN,t=!0;continue}else c=!1;if(u==="?"){s+=HT,t=!0;continue}s+=HZ(u)}return[s,Zi(e),!!t,o]}};Un=Rc;var vu=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Wr=a((n,e,t={})=>(jd(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Xn(e,t).match(n)),"minimatch"),KZ=/^\*+([^+@!?\*\[\(]*)$/,QZ=a(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),XZ=a(n=>e=>e.endsWith(n),"starDotExtTestDot"),YZ=a(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),JZ=a(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),ZZ=/^\*+\.\*+$/,eee=a(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),tee=a(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),ree=/^\.\*+$/,nee=a(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),iee=/^\*+$/,see=a(n=>n.length!==0&&!n.startsWith("."),"starTest"),oee=a(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),aee=/^\?+([^+@!?\*\[\(]*)?$/,cee=a(([n,e=""])=>{let t=lN([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),lee=a(([n,e=""])=>{let t=uN([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),uee=a(([n,e=""])=>{let t=uN([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),fee=a(([n,e=""])=>{let t=lN([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),lN=a(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),uN=a(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),fN=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",oN={win32:{sep:"\\"},posix:{sep:"/"}},dee=fN==="win32"?oN.win32.sep:oN.posix.sep;Wr.sep=dee;var er=Symbol("globstar **");Wr.GLOBSTAR=er;var hee="[^/]",pee=hee+"*?",mee="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gee="(?:(?!(?:\\/|^)\\.).)*?",yee=a((n,e={})=>t=>Wr(t,n,e),"filter");Wr.filter=yee;var hi=a((n,e={})=>Object.assign({},n,e),"ext"),bee=a(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Wr;let e=Wr;return Object.assign(a((r,i,s={})=>e(r,i,hi(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,hi(n,s))}static defaults(i){return e.defaults(hi(n,i)).Minimatch}},AST:class extends e.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,hi(n,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,hi(n,s))}},unescape:a((r,i={})=>e.unescape(r,hi(n,i)),"unescape"),escape:a((r,i={})=>e.escape(r,hi(n,i)),"escape"),filter:a((r,i={})=>e.filter(r,hi(n,i)),"filter"),defaults:a(r=>e.defaults(hi(n,r)),"defaults"),makeRe:a((r,i={})=>e.makeRe(r,hi(n,i)),"makeRe"),braceExpand:a((r,i={})=>e.braceExpand(r,hi(n,i)),"braceExpand"),match:a((r,i,s={})=>e.match(r,i,hi(n,s)),"match"),sep:e.sep,GLOBSTAR:er})},"defaults");Wr.defaults=bee;var dN=a((n,e={})=>(jd(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,cN.default)(n)),"braceExpand");Wr.braceExpand=dN;var _ee=a((n,e={})=>new Xn(n,e).makeRe(),"makeRe");Wr.makeRe=_ee;var See=a((n,e,t={})=>{let r=new Xn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Wr.match=See;var aN=/[?*]|[+@!]\(.*?\)|\[|\]/,wee=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Xn=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){jd(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||fN,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,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!aN.test(s[2]))&&!aN.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 o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[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 o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-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 o=1;o<r.length-1;o++){let c=r[o];o===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){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,o=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])o.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",o.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",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}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]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(er)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let o=t.indexOf(er,s),c=t.lastIndexOf(er),[l,u,f]=r?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,c),t.slice(c+1)];if(l.length){let S=e.slice(i,i+l.length);if(!this.#r(S,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let S=e.length-f.length;if(this.#r(e,f,r,S,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(S--,!this.#r(e,f,r,S,0)))return!1;d=f.length+1}}if(!u.length){let S=!!d;for(let T=i;T<e.length-d;T++){let I=String(e[T]);if(S=!0,I==="."||I===".."||!this.options.dot&&I.startsWith("."))return!1}return r||S}let h=[[[],0]],p=h[0],y=0,g=[0];for(let S of u)S===er?(g.push(y),p=[[],0],h.push(p)):(p[0].push(S),y++);let v=h.length-1,_=e.length-d;for(let S of h)S[1]=_-(g[v--]+S[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,o,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.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)&&o<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,o+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let o,c,l,u;for(o=i,c=s,u=e.length,l=t.length;o<u&&c<l;o++,c++){this.debug("matchOne loop");let f=t[c],d=e[o];if(this.debug(t,f,d),f===!1||f===er)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(o===u&&c===l)return!0;if(o===u)return r;if(c===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return dN(this.pattern,this.options)}parse(e){jd(e);let t=this.options;if(e==="**")return er;if(e==="")return"";let r,i=null;(r=e.match(iee))?i=t.dot?oee:see:(r=e.match(KZ))?i=(t.nocase?t.dot?JZ:YZ:t.dot?XZ:QZ)(r[1]):(r=e.match(aee))?i=(t.nocase?t.dot?lee:cee:t.dot?uee:fee)(r):(r=e.match(ZZ))?i=t.dot?tee:eee:(r=e.match(ree))&&(i=nee);let s=Rc.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?pee:t.dot?mee:gee,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?wee(f):f===er?er:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==er||p===er||(p===void 0?h!==void 0&&h!==er?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==er&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=er))}),u.filter(f=>f!==er).join("/")}).join("|"),[o,c]=e.length>1?["(?:",")"]:["",""];s="^"+o+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 o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[o]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Wr.defaults(e).Minimatch}};Wr.AST=Rc;Wr.Minimatch=Xn;Wr.escape=vu;Wr.unescape=Zi;var kN=require("node:url");var Eu=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,pN=new Set,KT=typeof process=="object"&&process?process:{},mN=a((n,e,t,r)=>{typeof KT.emitWarning=="function"?KT.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Gy=globalThis.AbortController,hN=globalThis.AbortSignal;if(typeof Gy>"u"){hN=class{static{a(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Gy=class{static{a(this,"AbortController")}constructor(){e()}signal=new hN;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=KT.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=a(()=>{n&&(n=!1,mN("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 vee=a(n=>!pN.has(n),"shouldWarn");var Ea=a(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),gN=a(n=>Ea(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Tu:null:null,"getUintArray"),Tu=class extends Array{static{a(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},QT=class n{static{a(this,"Stack")}heap;length;static#e=!1;static create(e){let t=gN(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]}},Ud=class n{static{a(this,"LRUCache")}#e;#n;#r;#t;#c;#b;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#o;#p;#g;#d;#m;#y;#f;#E;#T;#_;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#o,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:a(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:a((t,r,i,s)=>e.#j(t,r,i,s),"backgroundFetch"),moveToTail:a(t=>e.#U(t),"moveToTail"),indexes:a(t=>e.#R(t),"indexes"),rindexes:a(t=>e.#P(t),"rindexes"),isStale:a(t=>e.#A(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.#b}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:g,fetchMethod:v,memoMethod:_,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:I,allowStaleOnFetchAbort:A,ignoreFetchAbort:R}=e;if(t!==0&&!Ea(t))throw new TypeError("max option must be a nonnegative integer");let q=t?gN(t):Array;if(!q)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=g,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(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#b=_,v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=v,this.#S=!!v,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#o=new Array(t).fill(void 0),this.#p=new q(t),this.#g=new q(t),this.#d=0,this.#m=0,this.#y=QT.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.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!S,this.allowStaleOnFetchRejection=!!I,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!R,this.maxEntrySize!==0){if(this.#n!==0&&!Ea(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ea(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!T,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=Ea(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ea(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}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 Y="LRU_CACHE_UNBOUNDED";vee(Y)&&(pN.add(Y),mN("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Y,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#I(){let e=new Tu(this.#e),t=new Tu(this.#e);this.#_=e,this.#T=t,this.#D=(s,o,c=Eu.now())=>{if(t[s]=o!==0?c:0,e[s]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#O(this.#l[s],"expire")},o+1);l.unref&&l.unref()}},this.#x=s=>{t[s]=e[s]!==0?Eu.now():0},this.#a=(s,o)=>{if(e[o]){let c=e[o],l=t[o];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=a(()=>{let s=Eu.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref()}return s},"getNow");this.getRemainingTTL=s=>{let o=this.#s.get(s);if(o===void 0)return 0;let c=e[o],l=t[o];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let o=t[s],c=e[s];return!!c&&!!o&&(r||i())-o>c}}#x=a(()=>{},"#updateItemAge");#a=a(()=>{},"#statusTTL");#D=a(()=>{},"#setItemTTL");#A=a(()=>!1,"#isStale");#C(){let e=new Tu(this.#e);this.#u=0,this.#E=e,this.#F=t=>{this.#u-=e[t],e[t]=0},this.#N=(t,r,i,s)=>{if(this.#h(r))return 0;if(!Ea(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Ea(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.#L=(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)}}#F=a(e=>{},"#removeItemSize");#L=a((e,t,r)=>{},"#addItemSize");#N=a((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#P({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(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.#R())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*rentries(){for(let e of this.#P())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*keys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*rkeys(){for(let e of this.#P()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*values(){for(let e of this.#R())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#P())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#R()){let i=this.#o[r],s=this.#h(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.#R()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#P()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#P({allowStale:!0}))this.#A(t)&&(this.#O(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#o[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let o=this.#_[t],c=this.#T[t];if(o&&c){let l=o-(Eu.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.#R({allowStale:!0})){let r=this.#l[t],i=this.#o[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(this.#_&&this.#T){o.ttl=this.#_[t];let c=Eu.now()-this.#T[t];o.start=Math.floor(Date.now()-c)}this.#E&&(o.size=this.#E[t]),e.unshift([r,o])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=Eu.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:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#N(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#O(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[d]=e,this.#o[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#L(d,f,l),l&&(l.set="add"),u=!1;else{this.#U(d);let h=this.#o[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!o&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else o||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#F(d),this.#L(d,f,l),this.#o[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#I(),this.#_&&(u||this.#D(d,i,s),l&&this.#a(l,d)),!o&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#o[this.#d];if(this.#M(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#d,r=this.#l[t],i=this.#o[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#F(t),e&&(this.#l[t]=void 0,this.#o[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=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 o=this.#o[s];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#a(i,s));else return r&&this.#x(s),i&&(i.has="hit",this.#a(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.#A(i))return;let s=this.#o[i];return this.#h(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#o[t];if(this.#h(s))return s;let o=new Gy,{signal:c}=r;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let l={signal:o.signal,options:r,context:i},u=a((g,v=!1)=>{let{aborted:_}=o.signal,S=r.ignoreFetchAbort&&g!==void 0;if(r.status&&(_&&!v?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,S&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),_&&!S&&!v)return d(o.signal.reason);let T=p;return this.#o[t]===p&&(g===void 0?T.__staleWhileFetching?this.#o[t]=T.__staleWhileFetching:this.#O(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,g,l.options))),g},"cb"),f=a(g=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=g),d(g)),"eb"),d=a(g=>{let{aborted:v}=o.signal,_=v&&r.allowStaleOnFetchAbort,S=_||r.allowStaleOnFetchRejection,T=S||r.noDeleteOnFetchRejection,I=p;if(this.#o[t]===p&&(!T||I.__staleWhileFetching===void 0?this.#O(e,"fetch"):_||(this.#o[t]=I.__staleWhileFetching)),S)return r.status&&I.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),I.__staleWhileFetching;if(I.__returned===I)throw g},"fetchFail"),h=a((g,v)=>{let _=this.#c?.(e,s,l);_&&_ instanceof Promise&&_.then(S=>g(S===void 0?void 0:S),v),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(g(void 0),r.allowStaleOnFetchAbort&&(g=a(S=>u(S,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#o[t]=y,y}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Gy}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:g,forceRefresh:v=!1,status:_,signal:S}=t;if(!this.#S)return _&&(_.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:_});let T={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:_,signal:S},I=this.#s.get(e);if(I===void 0){_&&(_.fetch="miss");let A=this.#j(e,I,T,g);return A.__returned=A}else{let A=this.#o[I];if(this.#h(A)){let O=r&&A.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",O&&(_.returnedStale=!0)),O?A.__staleWhileFetching:A.__returned=A}let R=this.#A(I);if(!v&&!R)return _&&(_.fetch="hit"),this.#U(I),i&&this.#x(I),_&&this.#a(_,I),A;let q=this.#j(e,I,T,g),C=q.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=R?"stale":"refresh",C&&R&&(_.returnedStale=!0)),C?q.__staleWhileFetching:q.__returned=q}}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.#b;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,c=this.get(e,o);if(!s&&c!==void 0)return c;let l=r(e,c,{options:o,context:i});return this.set(e,l,o),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#o[c],u=this.#h(l);return o&&this.#a(o,c),this.#A(c)?(o&&(o.get="stale"),u?(o&&r&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#O(e,"expire"),o&&r&&(o.returnedStale=!0),r?l:void 0)):(o&&(o.get="hit"),u?l.__staleWhileFetching:(this.#U(c),i&&this.#x(c),l))}else o&&(o.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#U(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#O(e,"delete")}#O(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.#B(t);else{this.#F(i);let s=this.#o[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#o[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let o=this.#g[i];this.#p[o]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#P({allowStale:!0})){let r=this.#o[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#o.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.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var xu=require("node:path"),IN=require("node:url"),$s=require("fs"),Dee=J(require("node:fs"),1),Ia=require("node:fs/promises");var Xy=require("node:events"),r2=J(require("node:stream"),1),wN=require("node:string_decoder");var yN=typeof process=="object"&&process?process:{stdout:null,stderr:null},Eee=a(n=>!!n&&typeof n=="object"&&(n instanceof Aa||n instanceof r2.default||Tee(n)||Aee(n)),"isStream"),Tee=a(n=>!!n&&typeof n=="object"&&n instanceof Xy.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==r2.default.Writable.prototype.pipe,"isReadable"),Aee=a(n=>!!n&&typeof n=="object"&&n instanceof Xy.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),Do=Symbol("EOF"),Fo=Symbol("maybeEmitEnd"),Ta=Symbol("emittedEnd"),qy=Symbol("emittingEnd"),Bd=Symbol("emittedError"),Wy=Symbol("closed"),bN=Symbol("read"),zy=Symbol("flush"),_N=Symbol("flushChunk"),es=Symbol("encoding"),Au=Symbol("decoder"),Rr=Symbol("flowing"),Vd=Symbol("paused"),Iu=Symbol("resume"),Pr=Symbol("buffer"),vn=Symbol("pipes"),Cr=Symbol("bufferLength"),XT=Symbol("bufferPush"),Hy=Symbol("bufferShift"),rn=Symbol("objectMode"),tr=Symbol("destroyed"),YT=Symbol("error"),JT=Symbol("emitData"),SN=Symbol("emitEnd"),ZT=Symbol("emitEnd2"),Ms=Symbol("async"),e2=Symbol("abort"),Ky=Symbol("aborted"),Gd=Symbol("signal"),Pc=Symbol("dataListeners"),Yn=Symbol("discarded"),qd=a(n=>Promise.resolve().then(n),"defer"),Iee=a(n=>n(),"nodefer"),xee=a(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),Ree=a(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),Pee=a(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Qy=class{static{a(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Iu](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},t2=class extends Qy{static{a(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)}},Cee=a(n=>!!n.objectMode,"isObjectModeOptions"),Oee=a(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Aa=class extends Xy.EventEmitter{static{a(this,"Minipass")}[Rr]=!1;[Vd]=!1;[vn]=[];[Pr]=[];[rn];[es];[Ms];[Au];[Do]=!1;[Ta]=!1;[qy]=!1;[Wy]=!1;[Bd]=null;[Cr]=0;[tr]=!1;[Gd];[Ky]=!1;[Pc]=0;[Yn]=!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");Cee(t)?(this[rn]=!0,this[es]=null):Oee(t)?(this[es]=t.encoding,this[rn]=!1):(this[rn]=!1,this[es]=null),this[Ms]=!!t.async,this[Au]=this[es]?new wN.StringDecoder(this[es]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:a(()=>this[Pr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:a(()=>this[vn],"get")});let{signal:r}=t;r&&(this[Gd]=r,r.aborted?this[e2]():r.addEventListener("abort",()=>this[e2]()))}get bufferLength(){return this[Cr]}get encoding(){return this[es]}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[rn]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ms]}set async(e){this[Ms]=this[Ms]||!!e}[e2](){this[Ky]=!0,this.emit("abort",this[Gd]?.reason),this.destroy(this[Gd]?.reason)}get aborted(){return this[Ky]}set aborted(e){}write(e,t,r){if(this[Ky])return!1;if(this[Do])throw new Error("write after end");if(this[tr])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[Ms]?qd:Iee;if(!this[rn]&&!Buffer.isBuffer(e)){if(Pee(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Ree(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[rn]?(this[Rr]&&this[Cr]!==0&&this[zy](!0),this[Rr]?this.emit("data",e):this[XT](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Rr]):e.length?(typeof e=="string"&&!(t===this[es]&&!this[Au]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[es]&&(e=this[Au].write(e)),this[Rr]&&this[Cr]!==0&&this[zy](!0),this[Rr]?this.emit("data",e):this[XT](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Rr]):(this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Rr])}read(e){if(this[tr])return null;if(this[Yn]=!1,this[Cr]===0||e===0||e&&e>this[Cr])return this[Fo](),null;this[rn]&&(e=null),this[Pr].length>1&&!this[rn]&&(this[Pr]=[this[es]?this[Pr].join(""):Buffer.concat(this[Pr],this[Cr])]);let t=this[bN](e||null,this[Pr][0]);return this[Fo](),t}[bN](e,t){if(this[rn])this[Hy]();else{let r=t;e===r.length||e===null?this[Hy]():typeof r=="string"?(this[Pr][0]=r.slice(e),t=r.slice(0,e),this[Cr]-=e):(this[Pr][0]=r.subarray(e),t=r.subarray(0,e),this[Cr]-=e)}return this.emit("data",t),!this[Pr].length&&!this[Do]&&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[Do]=!0,this.writable=!1,(this[Rr]||!this[Vd])&&this[Fo](),this}[Iu](){this[tr]||(!this[Pc]&&!this[vn].length&&(this[Yn]=!0),this[Vd]=!1,this[Rr]=!0,this.emit("resume"),this[Pr].length?this[zy]():this[Do]?this[Fo]():this.emit("drain"))}resume(){return this[Iu]()}pause(){this[Rr]=!1,this[Vd]=!0,this[Yn]=!1}get destroyed(){return this[tr]}get flowing(){return this[Rr]}get paused(){return this[Vd]}[XT](e){this[rn]?this[Cr]+=1:this[Cr]+=e.length,this[Pr].push(e)}[Hy](){return this[rn]?this[Cr]-=1:this[Cr]-=this[Pr][0].length,this[Pr].shift()}[zy](e=!1){do;while(this[_N](this[Hy]())&&this[Pr].length);!e&&!this[Pr].length&&!this[Do]&&this.emit("drain")}[_N](e){return this.emit("data",e),this[Rr]}pipe(e,t){if(this[tr])return e;this[Yn]=!1;let r=this[Ta];return t=t||{},e===yN.stdout||e===yN.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[vn].push(t.proxyErrors?new t2(this,e,t):new Qy(this,e,t)),this[Ms]?qd(()=>this[Iu]()):this[Iu]()),e}unpipe(e){let t=this[vn].find(r=>r.dest===e);t&&(this[vn].length===1?(this[Rr]&&this[Pc]===0&&(this[Rr]=!1),this[vn]=[]):this[vn].splice(this[vn].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[Yn]=!1,this[Pc]++,!this[vn].length&&!this[Rr]&&this[Iu]();else if(e==="readable"&&this[Cr]!==0)super.emit("readable");else if(xee(e)&&this[Ta])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Bd]){let i=t;this[Ms]?qd(()=>i.call(this,this[Bd])):i.call(this,this[Bd])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Pc]=this.listeners("data").length,this[Pc]===0&&!this[Yn]&&!this[vn].length&&(this[Rr]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Pc]=0,!this[Yn]&&!this[vn].length&&(this[Rr]=!1)),t}get emittedEnd(){return this[Ta]}[Fo](){!this[qy]&&!this[Ta]&&!this[tr]&&this[Pr].length===0&&this[Do]&&(this[qy]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Wy]&&this.emit("close"),this[qy]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==tr&&this[tr])return!1;if(e==="data")return!this[rn]&&!r?!1:this[Ms]?(qd(()=>this[JT](r)),!0):this[JT](r);if(e==="end")return this[SN]();if(e==="close"){if(this[Wy]=!0,!this[Ta]&&!this[tr])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Bd]=r,super.emit(YT,r);let s=!this[Gd]||this.listeners("error").length?super.emit("error",r):!1;return this[Fo](),s}else if(e==="resume"){let s=super.emit("resume");return this[Fo](),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[Fo](),i}[JT](e){for(let r of this[vn])r.dest.write(e)===!1&&this.pause();let t=this[Yn]?!1:super.emit("data",e);return this[Fo](),t}[SN](){return this[Ta]?!1:(this[Ta]=!0,this.readable=!1,this[Ms]?(qd(()=>this[ZT]()),!0):this[ZT]())}[ZT](){if(this[Au]){let t=this[Au].end();if(t){for(let r of this[vn])r.dest.write(t);this[Yn]||super.emit("data",t)}}for(let t of this[vn])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[rn]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[rn]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[rn])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[es]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(tr,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Yn]=!1;let e=!1,t=a(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:a(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Do])return t();let s,o,c=a(d=>{this.off("data",l),this.off("end",u),this.off(tr,f),t(),o(d)},"onerr"),l=a(d=>{this.off("error",c),this.off("end",u),this.off(tr,f),this.pause(),s({value:d,done:!!this[Do]})},"ondata"),u=a(()=>{this.off("error",c),this.off("data",l),this.off(tr,f),t(),s({done:!0,value:void 0})},"onend"),f=a(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{o=h,s=d,this.once(tr,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[Yn]=!1;let e=!1,t=a(()=>(this.pause(),this.off(YT,t),this.off(tr,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=a(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(YT,t),this.once(tr,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[tr])return e?this.emit("error",e):this.emit(tr),this;this[tr]=!0,this[Yn]=!0,this[Pr].length=0,this[Cr]=0;let t=this;return typeof t.close=="function"&&!this[Wy]&&t.close(),e?this.emit("error",e):this.emit(tr),this}static get isStream(){return Eee}};var Fee=$s.realpathSync.native,zd={lstatSync:$s.lstatSync,readdir:$s.readdir,readdirSync:$s.readdirSync,readlinkSync:$s.readlinkSync,realpathSync:Fee,promises:{lstat:Ia.lstat,readdir:Ia.readdir,readlink:Ia.readlink,realpath:Ia.realpath}},xN=a(n=>!n||n===zd||n===Dee?zd:{...zd,...n,promises:{...zd.promises,...n.promises||{}}},"fsFromOption"),RN=/^\\\\\?\\([a-z]:)\\?$/i,Lee=a(n=>n.replace(/\//g,"\\").replace(RN,"$1\\"),"uncToDrive"),Nee=/[\\\/]/,mi=0,PN=1,CN=2,js=4,ON=6,DN=8,Cc=10,FN=12,pi=15,Wd=~pi,n2=16,vN=32,Hd=64,ts=128,Yy=256,Zy=512,EN=Hd|ts|Zy,kee=1023,i2=a(n=>n.isFile()?DN:n.isDirectory()?js:n.isSymbolicLink()?Cc:n.isCharacterDevice()?CN:n.isBlockDevice()?ON:n.isSocket()?FN:n.isFIFO()?PN:mi,"entToType"),TN=new Map,Kd=a(n=>{let e=TN.get(n);if(e)return e;let t=n.normalize("NFKD");return TN.set(n,t),t},"normalize"),AN=new Map,Jy=a(n=>{let e=AN.get(n);if(e)return e;let t=Kd(n.toLowerCase());return AN.set(n,t),t},"normalizeNocase"),e0=class extends Ud{static{a(this,"ResolveCache")}constructor(){super({max:256})}},s2=class extends Ud{static{a(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:a(t=>t.length+1,"sizeCalculation")})}},LN=Symbol("PathScurry setAsCwd"),nn=class{static{a(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}#b;get gid(){return this.#b}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#o;get blocks(){return this.#o}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#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}#_;#v;#S;#w;#I;#x;#a;#D;#A;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=mi,r,i,s,o,c){this.name=e,this.#_=s?Jy(e):Kd(e),this.#a=t&kee,this.nocase=s,this.roots=i,this.root=r||this,this.#D=o,this.#S=c.fullpath,this.#I=c.relative,this.#x=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=xN(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#D}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#F(i):this.#F(i)}#F(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#D.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#D.set(this,t),this.#a&=~n2,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Jy(e):Kd(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",o=this.#S?this.#S+s+e:void 0,c=this.newChild(e,mi,{...t,parent:this,fullpath:o});return this.canReaddir()||(c.#a|=ts),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=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.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#a&pi)===mi}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.#a&pi)===DN}isDirectory(){return(this.#a&pi)===js}isCharacterDevice(){return(this.#a&pi)===CN}isBlockDevice(){return(this.#a&pi)===ON}isFIFO(){return(this.#a&pi)===PN}isSocket(){return(this.#a&pi)===FN}isSymbolicLink(){return(this.#a&Cc)===Cc}lstatCached(){return this.#a&vN?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#C}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#a&pi;return!(e!==mi&&e!==Cc||this.#a&Yy||this.#a&ts)}calledReaddir(){return!!(this.#a&n2)}isENOENT(){return!!(this.#a&ts)}isNamed(e){return this.nocase?this.#_===Jy(e):this.#_===Kd(e)}async readlink(){let e=this.#A;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.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;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.#A=r}catch(t){this.#h(t.code);return}}#L(e){this.#a|=n2;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#N()}}#N(){this.#a&ts||(this.#a=(this.#a|ts)&Wd,this.#R())}#R(){let e=this.children();e.provisional=0;for(let t of e)t.#N()}#P(){this.#a|=Zy,this.#k()}#k(){if(this.#a&Hd)return;let e=this.#a;(e&pi)===js&&(e&=Wd),this.#a=e|Hd,this.#R()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#N():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#N()}#h(e=""){let t=this.#a;t|=Yy,e==="ENOENT"&&(t|=ts),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Wd),this.#a=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#O(e,t)||this.#U(e,t)}#U(e,t){let r=i2(e),i=this.newChild(e.name,r,{parent:this}),s=i.#a&pi;return s!==js&&s!==Cc&&s!==mi&&(i.#a|=Hd),t.unshift(i),t.provisional++,i}#O(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Jy(e.name):Kd(e.name))===i.#_)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#a=t.#a&Wd|i2(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.#a&ts)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#a&ts)===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:o,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:y,mtimeMs:g,nlink:v,rdev:_,size:S,uid:T}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=o,this.#o=c,this.#E=l,this.#d=u,this.#n=f,this.#b=d,this.#s=h,this.#r=p,this.#f=y,this.#g=g,this.#t=v,this.#i=_,this.#l=S,this.#c=T;let I=i2(e);this.#a=this.#a&Wd|I|vN,I!==mi&&I!==js&&I!==Cc&&(this.#a|=Hd)}#G=[];#q=!1;#z(e){this.#q=!1;let t=this.#G.slice();this.#G.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.#G.push(e),this.#q)return;this.#q=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#M(s.code),r.provisional=0;else{for(let c of o)this.#$(c,r);this.#L(r)}this.#z(r.slice(0,r.provisional))})}#V;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.#V)await this.#V;else{let r=a(()=>{},"resolve");this.#V=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#L(e)}catch(i){this.#M(i.code),e.provisional=0}this.#V=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.#L(e)}catch(r){this.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#a&EN)return!1;let e=pi&this.#a;return e===mi||e===js||e===Cc}shouldWalk(e,t){return(this.#a&js)===js&&!(this.#a&EN)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#C)return this.#C;if(!((Zy|Yy|ts)&this.#a))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#C=this.resolve(e)}catch{this.#P()}}realpathSync(){if(this.#C)return this.#C;if(!((Zy|Yy|ts)&this.#a))try{let e=this.#e.realpathSync(this.fullpath());return this.#C=this.resolve(e)}catch{this.#P()}}[LN](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.#I=r.join(this.sep),i.#x=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#I=void 0,i.#x=void 0,i=i.parent}},t0=class n extends nn{static{a(this,"PathWin32")}sep="\\";splitSep=Nee;constructor(e,t=mi,r,i,s,o,c){super(e,t,r,i,s,o,c)}newChild(e,t=mi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return xu.win32.parse(e).root}getRoot(e){if(e=Lee(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 Ru(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(RN,"$1\\"),e===t}},r0=class n extends nn{static{a(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=mi,r,i,s,o,c){super(e,t,r,i,s,o,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=mi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},n0=class{static{a(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:o=zd}={}){this.#t=xN(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,IN.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new e0,this.#n=new e0,this.#r=new s2(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,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let g=f--;u=u.child(y,{relative:new Array(g).fill("..").join(d),relativePosix:new Array(g).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 nn||(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 nn||(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 nn||(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 nn||(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 nn||(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 nn||(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 nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=a((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let g=y.length;if(!g)return h();let v=a(()=>{--g===0&&h()},"next");for(let _ of y)(!s||s(_))&&c.push(r?_:_.fullpath()),i&&_.isSymbolicLink()?_.realpath().then(S=>S?.isUnknown()?S.lstat():S).then(S=>S?.shouldWalk(l,o)?u(S,v):v()):_.shouldWalk(l,o)?u(_,v):v()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=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 d of f){(!s||s(d))&&c.push(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,o)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(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 nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=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 d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Aa({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=a((v,_,S=!1)=>{if(v)return c.emit("error",v);if(i&&!S){let T=[];for(let I of _)I.isSymbolicLink()&&T.push(I.realpath().then(A=>A?.isUnknown()?A.lstat():A));if(T.length){Promise.all(T).then(()=>y(null,_,!0));return}}for(let T of _)T&&(!s||s(T))&&(c.write(r?T:T.fullpath())||(h=!0));f--;for(let T of _){let I=T.realpathCached()||T;I.shouldWalk(l,o)&&u.push(I)}h&&!c.flowing?c.once("drain",d):g||d()},"onReaddir"),g=!0;p.readdirCB(y,!0),g=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Aa({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let g of y)(!s||s(g))&&(c.write(r?g:g.fullpath())||(h=!0));f--;for(let g of y){let v=g;if(g.isSymbolicLink()){if(!(i&&(v=g.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(l,o)&&u.push(v)}}h&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[LN](t)}},Ru=class extends n0{static{a(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,xu.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return xu.win32.parse(e).root.toUpperCase()}newRoot(e){return new t0(this.rootPath,js,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Pu=class extends n0{static{a(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,xu.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new r0(this.rootPath,js,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Qd=class extends Pu{static{a(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},V0e=process.platform==="win32"?t0:r0,NN=process.platform==="win32"?Ru:process.platform==="darwin"?Qd:Pu;var Mee=a(n=>n.length>=1,"isPatternList"),jee=a(n=>n.length>=1,"isGlobList"),Cu=class n{static{a(this,"Pattern")}#e;#n;#r;length;#t;#c;#b;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!Mee(e))throw new TypeError("empty pattern list");if(!jee(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,o,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let g=[s,o,c,l,""].join("/"),v=[f,d,h,p,""].join("/");this.#e=[g,...u],this.#n=[v,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[c,...l]=this.#n;o[0]===""&&(o.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...o],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]===er}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#b=this.#b||(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 $ee=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ou=class{static{a(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:o=$ee}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new Xn(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 o=new Cu(i,s,0,this.platform),c=new Xn(o.globString(),this.mmopts),l=s[s.length-1]==="**",u=o.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 o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(t)||o.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 o2=class n{static{a(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()]))}},a2=class{static{a(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)])}},c2=class{static{a(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())}},Xd=class n{static{a(this,"Processor")}hasWalkedCache;matches=new a2;subwalks=new c2;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new o2}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 o=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;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 d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===er){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):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 o of r){let c=o.isAbsolute(),l=o.pattern(),u=o.rest();l===er?i.testGlobstar(s,o,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 o=e.parent||e;this.subwalks.add(o,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 Uee=a((n,e)=>typeof n=="string"?new Ou([n],e):Array.isArray(n)?new Ou(n,e):n,"makeIgnore"),i0=class{static{a(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=Uee(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 o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.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 o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.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(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?o+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 Xd(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,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));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,o):c.readdirCB((u,f)=>this.walkCB3(c,f,r,o),!0)}o()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),o);o()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Xd(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,o=a(()=>{--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,o)}o()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--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(),o);o()}},Yd=class extends i0{static{a(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}},Jd=class extends i0{static{a(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Aa({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 Bee=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",rs=class{static{a(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,kN.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||Bee,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"?Ru:t.platform==="darwin"?Qd:t.platform?Pu:NN;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 Xn(l,i)),[o,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Cu(l,f,0,this.platform)})}async walk(){return[...await new Yd(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 Yd(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 Jd(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 Jd(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 l2=a((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Xn(t,e).hasMagic())return!0;return!1},"hasMagic");function s0(n,e={}){return new rs(n,e).streamSync()}a(s0,"globStreamSync");function jN(n,e={}){return new rs(n,e).stream()}a(jN,"globStream");function $N(n,e={}){return new rs(n,e).walkSync()}a($N,"globSync");async function MN(n,e={}){return new rs(n,e).walk()}a(MN,"glob_");function o0(n,e={}){return new rs(n,e).iterateSync()}a(o0,"globIterateSync");function UN(n,e={}){return new rs(n,e).iterate()}a(UN,"globIterate");var Vee=s0,Gee=Object.assign(jN,{sync:s0}),qee=o0,Wee=Object.assign(UN,{sync:o0}),zee=Object.assign($N,{stream:s0,iterate:o0}),Du=Object.assign(MN,{glob:MN,globSync:$N,sync:zee,globStream:jN,stream:Gee,globStreamSync:s0,streamSync:Vee,globIterate:UN,iterate:Wee,globIterateSync:o0,iterateSync:qee,Glob:rs,hasMagic:l2,escape:vu,unescape:Zi});Du.glob=Du;async function VN(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,o=Oc.default.join(n,"**/*.md"),c=await Du(o,{nodir:!0,ignore:[Oc.default.join(n,".obsidian/**"),Oc.default.join(n,".trash/**"),Oc.default.join(n,"**/.obsidian/**"),Oc.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=Oc.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await u2.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=Hee(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await u2.default.writeFile(u,h,"utf-8"))}return l}a(VN,"rewriteInboundWikilinks");function Hee(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=r[s],c=Kee(o,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}a(Hee,"rewriteContent");function Kee(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=Qee(r[s],e,t);i+=o.replacements,r[s]=o.updated}return{updated:r.join(""),replacements:i}}a(Kee,"rewriteProseSegment");function Qee(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(o,c,l)=>c.trim()!==e?o:(i+=1,`[[${t}${l}]]`)),replacements:i}}a(Qee,"replaceWikilinks");var Xee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,dt=class{constructor(e,t={}){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null;this.siblingAdapters=t.siblingAdapters??[],this.subjectIriPrefix=t.subjectIriPrefix??""}static{a(this,"FileSystemVaultAdapter")}getSubjectIriPrefix(){return this.subjectIriPrefix}async read(e){let t=this.resolvePath(e.path);if(!await dr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return dr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await dr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await dr.default.ensureDir(Pt.default.dirname(r)),await dr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await dr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await dr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await dr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await dr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return dr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=dr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=Pt.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=dr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),o=this.replaceFrontmatter(r,s);await this.modify(e,o)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await dr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await dr.default.ensureDir(Pt.default.dirname(i)),await dr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await dr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(Xee.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=Pt.default.dirname(this.resolvePath(t)),s;if(Pt.default.isAbsolute(r)?s=this.resolvePath(r):s=Pt.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),dr.default.existsSync(s)){let u=Pt.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let o=r.toLowerCase(),c=this.basenameIndex.get(o);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(o);if(l)return this.createFileObject(l);for(let u of this.siblingAdapters){let f=u.getSubjectIriPrefix();if(!f)continue;let d=u.getFirstLinkpathDest(r,"");if(d){let h=`${f}/${d.path}`;return this.createCrossVaultFileObject(h)}}return null}createCrossVaultFileObject(e){let t=Pt.default.basename(e),r=Pt.default.basename(e,Pt.default.extname(e)),i=Pt.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?{path:i,name:Pt.default.basename(i)}:null}}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=Pt.default.relative(this.rootPath,e),r=Pt.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=dr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let o=s.aliases,c=Array.isArray(o)?o:typeof o=="string"?[o]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=Pt.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(r){let i=r[1].toLowerCase(),s=Pt.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=Pt.default.basename(t,".md");await VN(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return Pt.default.isAbsolute(e)?e:Pt.default.join(this.rootPath,e)}createFileObject(e){let t=Pt.default.basename(e),r=Pt.default.basename(e,Pt.default.extname(e)),i=Pt.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:Pt.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=Nt.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=Nt.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
522
+ `:""}a(hZ,"dump$1");var pZ=hZ,mZ={dump:pZ};function GT(n,e){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}a(GT,"renamed");var gZ=qr,yZ=tL,bZ=sL,_Z=uL,SZ=fL,wZ=$T,vZ=PL.load,EZ=PL.loadAll,TZ=mZ.dump,AZ=wn,IZ={binary:gL,float:lL,map:iL,null:oL,pairs:bL,set:_L,timestamp:pL,bool:aL,int:cL,merge:mL,omap:yL,seq:nL,str:rL},xZ=GT("safeLoad","load"),RZ=GT("safeLoadAll","loadAll"),PZ=GT("safeDump","dump"),Nt={Type:gZ,Schema:yZ,FAILSAFE_SCHEMA:bZ,JSON_SCHEMA:_Z,CORE_SCHEMA:SZ,DEFAULT_SCHEMA:wZ,load:vZ,loadAll:EZ,dump:TZ,YAMLException:AZ,types:IZ,safeLoad:xZ,safeLoadAll:RZ,safeDump:PZ};var u2=J(Co()),Oc=J(require("path"));var cN=J(ZL(),1);var jd=a(n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var MZ={"[: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]},$d=a(n=>n.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),jZ=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),eN=a(n=>n.join(""),"rangesToString"),tN=a((n,e)=>{let t=e;if(n.charAt(t)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=t+1,o=!1,c=!1,l=!1,u=!1,f=t,d="";e:for(;s<n.length;){let g=n.charAt(s);if((g==="!"||g==="^")&&s===t+1){u=!0,s++;continue}if(g==="]"&&o&&!l){f=s+1;break}if(o=!0,g==="\\"&&!l){l=!0,s++;continue}if(g==="["&&!l){for(let[v,[_,S,T]]of Object.entries(MZ))if(n.startsWith(v,s)){if(d)return["$.",!1,n.length-t,!0];s+=v.length,T?i.push(_):r.push(_),c=c||S;continue e}}if(l=!1,d){g>d?r.push($d(d)+"-"+$d(g)):g===d&&r.push($d(g)),d="",s++;continue}if(n.startsWith("-]",s+1)){r.push($d(g+"-")),s+=2;continue}if(n.startsWith("-",s+1)){d=g,s+=2;continue}r.push($d(g)),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 g=r[0].length===2?r[0].slice(-1):r[0];return[jZ(g),!1,f-t,!1]}let h="["+(u?"^":"")+eN(r)+"]",p="["+(u?"":"^")+eN(i)+"]";return[r.length&&i.length?"("+h+"|"+p+")":r.length?h:p,c,f-t,!0]},"parseClass");var Zi=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Un,$Z=new Set(["!","?","+","*","@"]),zT=a(n=>$Z.has(n),"isExtglobType"),rN=a(n=>zT(n.type),"isExtglobAST"),UZ=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),BZ=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),VZ=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),nN=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),GZ="(?!(?:^|/)\\.\\.?(?:$|/))",Vy="(?!\\.)",qZ=new Set(["[","."]),WZ=new Set(["..","."]),zZ=new Set("().*{}+?[]^$\\!"),HZ=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),HT="[^/]",iN=HT+"*?",sN=HT+"+?",Rc=class{static{a(this,"AST")}type;#e;#n;#r=!1;#t=[];#c;#b;#i;#u=!1;#s;#l;#o=!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.#b=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.#b+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 Un&&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.#b===0)return!0;let e=this.#c;for(let t=0;t<this.#b;t++){let r=e.#t[t];if(!(r instanceof Un&&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.#b===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Un(this.type,e);for(let r of this.#t)t.copyIn(r);return t}static#g(e,t,r,i,s){let o=i.maxExtglobRecursion??2,c=!1,l=!1,u=-1,f=!1;if(t.type===null){let g=r,v="";for(;g<e.length;){let _=e.charAt(g++);if(c||_==="\\"){c=!c,v+=_;continue}if(l){g===u+1?(_==="^"||_==="!")&&(f=!0):_==="]"&&!(g===u+2&&f)&&(l=!1),v+=_;continue}else if(_==="["){l=!0,u=g,f=!1,v+=_;continue}if(!i.noext&&zT(_)&&e.charAt(g)==="("&&s<=o){t.push(v),v="";let T=new Un(_,t);g=Un.#g(e,T,g,i,s+1),t.push(T);continue}v+=_}return t.push(v),g}let d=r+1,h=new Un(null,t),p=[],y="";for(;d<e.length;){let g=e.charAt(d++);if(c||g==="\\"){c=!c,y+=g;continue}if(l){d===u+1?(g==="^"||g==="!")&&(f=!0):g==="]"&&!(d===u+2&&f)&&(l=!1),y+=g;continue}else if(g==="["){l=!0,u=d,f=!1,y+=g;continue}if(zT(g)&&e.charAt(d)==="("&&(s<=o||t&&t.#y(g))){let _=t&&t.#y(g)?0:1;h.push(y),y="";let S=new Un(g,h);h.push(S),d=Un.#g(e,S,d,i,s+_);continue}if(g==="|"){h.push(y),y="",p.push(h),h=new Un(null,t);continue}if(g===")")return y===""&&t.#t.length===0&&(t.#o=!0),h.push(y),y="",t.push(...p,h),d;y+=g}return t.type=null,t.#n=void 0,t.#t=[e.substring(r-1)],d}#d(e){return this.#m(e,BZ)}#m(e,t=UZ){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=VZ){return!!t.get(this.type)?.includes(e)}#f(e,t){let r=e.#t[0],i=new Un(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!!nN.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)}#v(e){let t=nN.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.#o=!1}#S(){if(rN(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.#S(),this.#m(i)?(t=!1,this.#E(i,r)):this.#d(i)?(t=!1,this.#f(i,r)):this.#_(i)&&(t=!1,this.#v(i)))}}while(!t&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#S();this.#l=void 0}static fromGlob(e,t={}){let r=new Un(null,void 0,t);return Un.#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.#S(),this.#p()),!rN(this)){let l=this.isStart()&&this.isEnd(),u=this.#t.map(p=>{let[y,g,v,_]=typeof p=="string"?Un.#I(p,this.#n,l):p.toRegExpSource(e);return this.#n=this.#n||v,this.#r=this.#r||_,y}).join(""),f="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&WZ.has(this.#t[0]))){let y=qZ,g=t&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),v=!t&&!e&&y.has(u.charAt(0));f=g?GZ:v?Vy:""}let d="";return this.isEnd()&&this.#e.#u&&this.#c?.type==="!"&&(d="(?:$|\\/)"),[f+u+d,Zi(u),this.#n=!!this.#n,this.#r]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#w(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,Zi(this.toString()),!1,!1]}let o=!r||e||t||!Vy?"":this.#w(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let c="";if(this.type==="!"&&this.#o)c=(this.isStart()&&!t?Vy:"")+sN;else{let l=this.type==="!"?"))"+(this.isStart()&&!t&&!e?Vy:"")+iN+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+s+l}return[c,Zi(s),this.#n=!!this.#n,this.#r]}#w(e){return this.#t.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,r}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#I(e,t,r=!1){let i=!1,s="",o=!1,c=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(i){i=!1,s+=(zZ.has(u)?"\\":"")+u,c=!1;continue}if(u==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[f,d,h,p]=tN(e,l);if(h){s+=f,o=o||d,l+=h-1,t=t||p,c=!1;continue}}if(u==="*"){if(c)continue;c=!0,s+=r&&/^[*]+$/.test(e)?sN:iN,t=!0;continue}else c=!1;if(u==="?"){s+=HT,t=!0;continue}s+=HZ(u)}return[s,Zi(e),!!t,o]}};Un=Rc;var vu=a((n,{windowsPathsNoEscape:e=!1}={})=>e?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Wr=a((n,e,t={})=>(jd(e),!t.nocomment&&e.charAt(0)==="#"?!1:new Xn(e,t).match(n)),"minimatch"),KZ=/^\*+([^+@!?\*\[\(]*)$/,QZ=a(n=>e=>!e.startsWith(".")&&e.endsWith(n),"starDotExtTest"),XZ=a(n=>e=>e.endsWith(n),"starDotExtTestDot"),YZ=a(n=>(n=n.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(n)),"starDotExtTestNocase"),JZ=a(n=>(n=n.toLowerCase(),e=>e.toLowerCase().endsWith(n)),"starDotExtTestNocaseDot"),ZZ=/^\*+\.\*+$/,eee=a(n=>!n.startsWith(".")&&n.includes("."),"starDotStarTest"),tee=a(n=>n!=="."&&n!==".."&&n.includes("."),"starDotStarTestDot"),ree=/^\.\*+$/,nee=a(n=>n!=="."&&n!==".."&&n.startsWith("."),"dotStarTest"),iee=/^\*+$/,see=a(n=>n.length!==0&&!n.startsWith("."),"starTest"),oee=a(n=>n.length!==0&&n!=="."&&n!=="..","starTestDot"),aee=/^\?+([^+@!?\*\[\(]*)?$/,cee=a(([n,e=""])=>{let t=lN([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocase"),lee=a(([n,e=""])=>{let t=uN([n]);return e?(e=e.toLowerCase(),r=>t(r)&&r.toLowerCase().endsWith(e)):t},"qmarksTestNocaseDot"),uee=a(([n,e=""])=>{let t=uN([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTestDot"),fee=a(([n,e=""])=>{let t=lN([n]);return e?r=>t(r)&&r.endsWith(e):t},"qmarksTest"),lN=a(([n])=>{let e=n.length;return t=>t.length===e&&!t.startsWith(".")},"qmarksTestNoExt"),uN=a(([n])=>{let e=n.length;return t=>t.length===e&&t!=="."&&t!==".."},"qmarksTestNoExtDot"),fN=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",oN={win32:{sep:"\\"},posix:{sep:"/"}},dee=fN==="win32"?oN.win32.sep:oN.posix.sep;Wr.sep=dee;var er=Symbol("globstar **");Wr.GLOBSTAR=er;var hee="[^/]",pee=hee+"*?",mee="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gee="(?:(?!(?:\\/|^)\\.).)*?",yee=a((n,e={})=>t=>Wr(t,n,e),"filter");Wr.filter=yee;var hi=a((n,e={})=>Object.assign({},n,e),"ext"),bee=a(n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return Wr;let e=Wr;return Object.assign(a((r,i,s={})=>e(r,i,hi(n,s)),"m"),{Minimatch:class extends e.Minimatch{static{a(this,"Minimatch")}constructor(i,s={}){super(i,hi(n,s))}static defaults(i){return e.defaults(hi(n,i)).Minimatch}},AST:class extends e.AST{static{a(this,"AST")}constructor(i,s,o={}){super(i,s,hi(n,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,hi(n,s))}},unescape:a((r,i={})=>e.unescape(r,hi(n,i)),"unescape"),escape:a((r,i={})=>e.escape(r,hi(n,i)),"escape"),filter:a((r,i={})=>e.filter(r,hi(n,i)),"filter"),defaults:a(r=>e.defaults(hi(n,r)),"defaults"),makeRe:a((r,i={})=>e.makeRe(r,hi(n,i)),"makeRe"),braceExpand:a((r,i={})=>e.braceExpand(r,hi(n,i)),"braceExpand"),match:a((r,i,s={})=>e.match(r,i,hi(n,s)),"match"),sep:e.sep,GLOBSTAR:er})},"defaults");Wr.defaults=bee;var dN=a((n,e={})=>(jd(n),e.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,cN.default)(n)),"braceExpand");Wr.braceExpand=dN;var _ee=a((n,e={})=>new Xn(n,e).makeRe(),"makeRe");Wr.makeRe=_ee;var See=a((n,e,t={})=>{let r=new Xn(e,t);return n=n.filter(i=>r.match(i)),r.options.nonull&&!n.length&&n.push(e),n},"match");Wr.match=See;var aN=/[?*]|[+@!]\(.*?\)|\[|\]/,wee=a(n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Xn=class{static{a(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){jd(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||fN,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,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!aN.test(s[2]))&&!aN.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 o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[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 o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-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 o=1;o<r.length-1;o++){let c=r[o];o===1&&c===""&&r[0]===""||(c==="."||c==="")&&(t=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(t=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){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,o=[],c="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(c==="b"?t[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(r&&t[s]==="**"&&e[i]===t[s+1])o.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",o.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",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}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]),d=l?3:c?0:void 0,h=f?3:u?0:void 0;if(typeof d=="number"&&typeof h=="number"){let[p,y]=[e[d],t[h]];p.toLowerCase()===y.toLowerCase()&&(t[h]=p,s=h,i=d)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(er)?this.#e(e,t,r,i,s):this.#r(e,t,r,i,s)}#e(e,t,r,i,s){let o=t.indexOf(er,s),c=t.lastIndexOf(er),[l,u,f]=r?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,c),t.slice(c+1)];if(l.length){let S=e.slice(i,i+l.length);if(!this.#r(S,l,r,0,0))return!1;i+=l.length}let d=0;if(f.length){if(f.length+i>e.length)return!1;let S=e.length-f.length;if(this.#r(e,f,r,S,0))d=f.length;else{if(e[e.length-1]!==""||i+f.length===e.length||(S--,!this.#r(e,f,r,S,0)))return!1;d=f.length+1}}if(!u.length){let S=!!d;for(let T=i;T<e.length-d;T++){let I=String(e[T]);if(S=!0,I==="."||I===".."||!this.options.dot&&I.startsWith("."))return!1}return r||S}let h=[[[],0]],p=h[0],y=0,g=[0];for(let S of u)S===er?(g.push(y),p=[[],0],h.push(p)):(p[0].push(S),y++);let v=h.length-1,_=e.length-d;for(let S of h)S[1]=_-(g[v--]+S[0].length);return!!this.#n(e,h,i,0,r,0,!!d)}#n(e,t,r,i,s,o,c){let l=t[i];if(!l){for(let d=r;d<e.length;d++){c=!0;let h=e[d];if(h==="."||h===".."||!this.options.dot&&h.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)&&o<this.maxGlobstarRecursion){let p=this.#n(e,t,r+u.length,i+1,s,o+1,c);if(p!==!1)return p}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#r(e,t,r,i,s){let o,c,l,u;for(o=i,c=s,u=e.length,l=t.length;o<u&&c<l;o++,c++){this.debug("matchOne loop");let f=t[c],d=e[o];if(this.debug(t,f,d),f===!1||f===er)return!1;let h;if(typeof f=="string"?(h=d===f,this.debug("string match",f,d,h)):(h=f.test(d),this.debug("pattern match",f,d,h)),!h)return!1}if(o===u&&c===l)return!0;if(o===u)return r;if(c===l)return o===u-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return dN(this.pattern,this.options)}parse(e){jd(e);let t=this.options;if(e==="**")return er;if(e==="")return"";let r,i=null;(r=e.match(iee))?i=t.dot?oee:see:(r=e.match(KZ))?i=(t.nocase?t.dot?JZ:YZ:t.dot?XZ:QZ)(r[1]):(r=e.match(aee))?i=(t.nocase?t.dot?lee:cee:t.dot?uee:fee)(r):(r=e.match(ZZ))?i=t.dot?tee:eee:(r=e.match(ree))&&(i=nee);let s=Rc.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?pee:t.dot?mee:gee,i=new Set(t.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(f=>{if(f instanceof RegExp)for(let d of f.flags.split(""))i.add(d);return typeof f=="string"?wee(f):f===er?er:f._src});return u.forEach((f,d)=>{let h=u[d+1],p=u[d-1];f!==er||p===er||(p===void 0?h!==void 0&&h!==er?u[d+1]="(?:\\/|"+r+"\\/)?"+h:u[d]=r:h===void 0?u[d-1]=p+"(?:\\/|"+r+")?":h!==er&&(u[d-1]=p+"(?:\\/|\\/"+r+"\\/)"+h,u[d+1]=er))}),u.filter(f=>f!==er).join("/")}).join("|"),[o,c]=e.length>1?["(?:",")"]:["",""];s="^"+o+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 o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c=0;c<s.length;c++){let l=s[c],u=i;if(r.matchBase&&l.length===1&&(u=[o]),this.matchOne(u,l,t))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return Wr.defaults(e).Minimatch}};Wr.AST=Rc;Wr.Minimatch=Xn;Wr.escape=vu;Wr.unescape=Zi;var kN=require("node:url");var Eu=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,pN=new Set,KT=typeof process=="object"&&process?process:{},mN=a((n,e,t,r)=>{typeof KT.emitWarning=="function"?KT.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)},"emitWarning"),Gy=globalThis.AbortController,hN=globalThis.AbortSignal;if(typeof Gy>"u"){hN=class{static{a(this,"AbortSignal")}onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Gy=class{static{a(this,"AbortController")}constructor(){e()}signal=new hN;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=KT.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=a(()=>{n&&(n=!1,mN("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 vee=a(n=>!pN.has(n),"shouldWarn");var Ea=a(n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),"isPosInt"),gN=a(n=>Ea(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Tu:null:null,"getUintArray"),Tu=class extends Array{static{a(this,"ZeroArray")}constructor(e){super(e),this.fill(0)}},QT=class n{static{a(this,"Stack")}heap;length;static#e=!1;static create(e){let t=gN(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]}},Ud=class n{static{a(this,"LRUCache")}#e;#n;#r;#t;#c;#b;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#u;#s;#l;#o;#p;#g;#d;#m;#y;#f;#E;#T;#_;#v;#S;#w;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#E,keyMap:e.#s,keyList:e.#l,valList:e.#o,next:e.#p,prev:e.#g,get head(){return e.#d},get tail(){return e.#m},free:e.#y,isBackgroundFetch:a(t=>e.#h(t),"isBackgroundFetch"),backgroundFetch:a((t,r,i,s)=>e.#j(t,r,i,s),"backgroundFetch"),moveToTail:a(t=>e.#U(t),"moveToTail"),indexes:a(t=>e.#R(t),"indexes"),rindexes:a(t=>e.#P(t),"rindexes"),isStale:a(t=>e.#A(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.#b}get dispose(){return this.#r}get disposeAfter(){return this.#t}constructor(e){let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:l,dispose:u,disposeAfter:f,noDisposeOnSet:d,noUpdateTTL:h,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:g,fetchMethod:v,memoMethod:_,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:I,allowStaleOnFetchAbort:A,ignoreFetchAbort:R}=e;if(t!==0&&!Ea(t))throw new TypeError("max option must be a nonnegative integer");let q=t?gN(t):Array;if(!q)throw new Error("invalid max value: "+t);if(this.#e=t,this.#n=p,this.maxEntrySize=y||this.#n,this.sizeCalculation=g,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(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#b=_,v!==void 0&&typeof v!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#c=v,this.#S=!!v,this.#s=new Map,this.#l=new Array(t).fill(void 0),this.#o=new Array(t).fill(void 0),this.#p=new q(t),this.#g=new q(t),this.#d=0,this.#m=0,this.#y=QT.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.#v=!!this.#r,this.#w=!!this.#t,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!S,this.allowStaleOnFetchRejection=!!I,this.allowStaleOnFetchAbort=!!A,this.ignoreFetchAbort=!!R,this.maxEntrySize!==0){if(this.#n!==0&&!Ea(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!Ea(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#C()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!T,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=Ea(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Ea(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#I()}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 Y="LRU_CACHE_UNBOUNDED";vee(Y)&&(pN.add(Y),mN("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Y,n))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#I(){let e=new Tu(this.#e),t=new Tu(this.#e);this.#_=e,this.#T=t,this.#D=(s,o,c=Eu.now())=>{if(t[s]=o!==0?c:0,e[s]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#A(s)&&this.#O(this.#l[s],"expire")},o+1);l.unref&&l.unref()}},this.#x=s=>{t[s]=e[s]!==0?Eu.now():0},this.#a=(s,o)=>{if(e[o]){let c=e[o],l=t[o];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=a(()=>{let s=Eu.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref()}return s},"getNow");this.getRemainingTTL=s=>{let o=this.#s.get(s);if(o===void 0)return 0;let c=e[o],l=t[o];if(!c||!l)return 1/0;let u=(r||i())-l;return c-u},this.#A=s=>{let o=t[s],c=e[s];return!!c&&!!o&&(r||i())-o>c}}#x=a(()=>{},"#updateItemAge");#a=a(()=>{},"#statusTTL");#D=a(()=>{},"#setItemTTL");#A=a(()=>!1,"#isStale");#C(){let e=new Tu(this.#e);this.#u=0,this.#E=e,this.#F=t=>{this.#u-=e[t],e[t]=0},this.#N=(t,r,i,s)=>{if(this.#h(r))return 0;if(!Ea(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!Ea(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.#L=(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)}}#F=a(e=>{},"#removeItemSize");#L=a((e,t,r)=>{},"#addItemSize");#N=a((e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0},"#requireSize");*#R({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#m;!(!this.#k(t)||((e||!this.#A(t))&&(yield t),t===this.#d));)t=this.#g[t]}*#P({allowStale:e=this.allowStale}={}){if(this.#i)for(let t=this.#d;!(!this.#k(t)||((e||!this.#A(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.#R())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*rentries(){for(let e of this.#P())this.#o[e]!==void 0&&this.#l[e]!==void 0&&!this.#h(this.#o[e])&&(yield[this.#l[e],this.#o[e]])}*keys(){for(let e of this.#R()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*rkeys(){for(let e of this.#P()){let t=this.#l[e];t!==void 0&&!this.#h(this.#o[e])&&(yield t)}}*values(){for(let e of this.#R())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}*rvalues(){for(let e of this.#P())this.#o[e]!==void 0&&!this.#h(this.#o[e])&&(yield this.#o[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let r of this.#R()){let i=this.#o[r],s=this.#h(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.#R()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}rforEach(e,t=this){for(let r of this.#P()){let i=this.#o[r],s=this.#h(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,this.#l[r],this)}}purgeStale(){let e=!1;for(let t of this.#P({allowStale:!0}))this.#A(t)&&(this.#O(this.#l[t],"expire"),e=!0);return e}info(e){let t=this.#s.get(e);if(t===void 0)return;let r=this.#o[t],i=this.#h(r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(this.#_&&this.#T){let o=this.#_[t],c=this.#T[t];if(o&&c){let l=o-(Eu.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.#R({allowStale:!0})){let r=this.#l[t],i=this.#o[t],s=this.#h(i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(this.#_&&this.#T){o.ttl=this.#_[t];let c=Eu.now()-this.#T[t];o.start=Math.floor(Date.now()-c)}this.#E&&(o.size=this.#E[t]),e.unshift([r,o])}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=Eu.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:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:l}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#N(e,t,r.size||0,c);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#O(e,"set"),this;let d=this.#i===0?void 0:this.#s.get(e);if(d===void 0)d=this.#i===0?this.#m:this.#y.length!==0?this.#y.pop():this.#i===this.#e?this.#M(!1):this.#i,this.#l[d]=e,this.#o[d]=t,this.#s.set(e,d),this.#p[this.#m]=d,this.#g[d]=this.#m,this.#m=d,this.#i++,this.#L(d,f,l),l&&(l.set="add"),u=!1;else{this.#U(d);let h=this.#o[d];if(t!==h){if(this.#S&&this.#h(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!o&&(this.#v&&this.#r?.(p,e,"set"),this.#w&&this.#f?.push([p,e,"set"]))}else o||(this.#v&&this.#r?.(h,e,"set"),this.#w&&this.#f?.push([h,e,"set"]));if(this.#F(d),this.#L(d,f,l),this.#o[d]=t,l){l.set="replace";let p=h&&this.#h(h)?h.__staleWhileFetching:h;p!==void 0&&(l.oldValue=p)}}else l&&(l.set="update")}if(i!==0&&!this.#_&&this.#I(),this.#_&&(u||this.#D(d,i,s),l&&this.#a(l,d)),!o&&this.#w&&this.#f){let h=this.#f,p;for(;p=h?.shift();)this.#t?.(...p)}return this}pop(){try{for(;this.#i;){let e=this.#o[this.#d];if(this.#M(!0),this.#h(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#w&&this.#f){let e=this.#f,t;for(;t=e?.shift();)this.#t?.(...t)}}}#M(e){let t=this.#d,r=this.#l[t],i=this.#o[t];return this.#S&&this.#h(i)?i.__abortController.abort(new Error("evicted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(i,r,"evict"),this.#w&&this.#f?.push([i,r,"evict"])),this.#F(t),e&&(this.#l[t]=void 0,this.#o[t]=void 0,this.#y.push(t)),this.#i===1?(this.#d=this.#m=0,this.#y.length=0):this.#d=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 o=this.#o[s];if(this.#h(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#A(s))i&&(i.has="stale",this.#a(i,s));else return r&&this.#x(s),i&&(i.has="hit",this.#a(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.#A(i))return;let s=this.#o[i];return this.#h(s)?s.__staleWhileFetching:s}#j(e,t,r,i){let s=t===void 0?void 0:this.#o[t];if(this.#h(s))return s;let o=new Gy,{signal:c}=r;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let l={signal:o.signal,options:r,context:i},u=a((g,v=!1)=>{let{aborted:_}=o.signal,S=r.ignoreFetchAbort&&g!==void 0;if(r.status&&(_&&!v?(r.status.fetchAborted=!0,r.status.fetchError=o.signal.reason,S&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),_&&!S&&!v)return d(o.signal.reason);let T=p;return this.#o[t]===p&&(g===void 0?T.__staleWhileFetching?this.#o[t]=T.__staleWhileFetching:this.#O(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,g,l.options))),g},"cb"),f=a(g=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=g),d(g)),"eb"),d=a(g=>{let{aborted:v}=o.signal,_=v&&r.allowStaleOnFetchAbort,S=_||r.allowStaleOnFetchRejection,T=S||r.noDeleteOnFetchRejection,I=p;if(this.#o[t]===p&&(!T||I.__staleWhileFetching===void 0?this.#O(e,"fetch"):_||(this.#o[t]=I.__staleWhileFetching)),S)return r.status&&I.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),I.__staleWhileFetching;if(I.__returned===I)throw g},"fetchFail"),h=a((g,v)=>{let _=this.#c?.(e,s,l);_&&_ instanceof Promise&&_.then(S=>g(S===void 0?void 0:S),v),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(g(void 0),r.allowStaleOnFetchAbort&&(g=a(S=>u(S,!0),"res")))})},"pcall");r.status&&(r.status.fetchDispatched=!0);let p=new Promise(h).then(u,f),y=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,y,{...l.options,status:void 0}),t=this.#s.get(e)):this.#o[t]=y,y}#h(e){if(!this.#S)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Gy}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:g,forceRefresh:v=!1,status:_,signal:S}=t;if(!this.#S)return _&&(_.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:_});let T={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:c,size:l,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:_,signal:S},I=this.#s.get(e);if(I===void 0){_&&(_.fetch="miss");let A=this.#j(e,I,T,g);return A.__returned=A}else{let A=this.#o[I];if(this.#h(A)){let O=r&&A.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",O&&(_.returnedStale=!0)),O?A.__staleWhileFetching:A.__returned=A}let R=this.#A(I);if(!v&&!R)return _&&(_.fetch="hit"),this.#U(I),i&&this.#x(I),_&&this.#a(_,I),A;let q=this.#j(e,I,T,g),C=q.__staleWhileFetching!==void 0&&r;return _&&(_.fetch=R?"stale":"refresh",C&&R&&(_.returnedStale=!0)),C?q.__staleWhileFetching:q.__returned=q}}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.#b;if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,c=this.get(e,o);if(!s&&c!==void 0)return c;let l=r(e,c,{options:o,context:i});return this.set(e,l,o),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,c=this.#s.get(e);if(c!==void 0){let l=this.#o[c],u=this.#h(l);return o&&this.#a(o,c),this.#A(c)?(o&&(o.get="stale"),u?(o&&r&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),r?l.__staleWhileFetching:void 0):(s||this.#O(e,"expire"),o&&r&&(o.returnedStale=!0),r?l:void 0)):(o&&(o.get="hit"),u?l.__staleWhileFetching:(this.#U(c),i&&this.#x(c),l))}else o&&(o.get="miss")}#$(e,t){this.#g[t]=e,this.#p[e]=t}#U(e){e!==this.#m&&(e===this.#d?this.#d=this.#p[e]:this.#$(this.#g[e],this.#p[e]),this.#$(this.#m,e),this.#m=e)}delete(e){return this.#O(e,"delete")}#O(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.#B(t);else{this.#F(i);let s=this.#o[i];if(this.#h(s)?s.__abortController.abort(new Error("deleted")):(this.#v||this.#w)&&(this.#v&&this.#r?.(s,e,t),this.#w&&this.#f?.push([s,e,t])),this.#s.delete(e),this.#l[i]=void 0,this.#o[i]=void 0,i===this.#m)this.#m=this.#g[i];else if(i===this.#d)this.#d=this.#p[i];else{let o=this.#g[i];this.#p[o]=this.#p[i];let c=this.#p[i];this.#g[c]=this.#g[i]}this.#i--,this.#y.push(i)}}if(this.#w&&this.#f?.length){let i=this.#f,s;for(;s=i?.shift();)this.#t?.(...s)}return r}clear(){return this.#B("delete")}#B(e){for(let t of this.#P({allowStale:!0})){let r=this.#o[t];if(this.#h(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#l[t];this.#v&&this.#r?.(r,i,e),this.#w&&this.#f?.push([r,i,e])}}if(this.#s.clear(),this.#o.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.#d=0,this.#m=0,this.#y.length=0,this.#u=0,this.#i=0,this.#w&&this.#f){let t=this.#f,r;for(;r=t?.shift();)this.#t?.(...r)}}};var xu=require("node:path"),IN=require("node:url"),Us=require("fs"),Dee=J(require("node:fs"),1),Ia=require("node:fs/promises");var Xy=require("node:events"),r2=J(require("node:stream"),1),wN=require("node:string_decoder");var yN=typeof process=="object"&&process?process:{stdout:null,stderr:null},Eee=a(n=>!!n&&typeof n=="object"&&(n instanceof Aa||n instanceof r2.default||Tee(n)||Aee(n)),"isStream"),Tee=a(n=>!!n&&typeof n=="object"&&n instanceof Xy.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==r2.default.Writable.prototype.pipe,"isReadable"),Aee=a(n=>!!n&&typeof n=="object"&&n instanceof Xy.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function","isWritable"),Do=Symbol("EOF"),Fo=Symbol("maybeEmitEnd"),Ta=Symbol("emittedEnd"),qy=Symbol("emittingEnd"),Bd=Symbol("emittedError"),Wy=Symbol("closed"),bN=Symbol("read"),zy=Symbol("flush"),_N=Symbol("flushChunk"),es=Symbol("encoding"),Au=Symbol("decoder"),Rr=Symbol("flowing"),Vd=Symbol("paused"),Iu=Symbol("resume"),Pr=Symbol("buffer"),vn=Symbol("pipes"),Cr=Symbol("bufferLength"),XT=Symbol("bufferPush"),Hy=Symbol("bufferShift"),rn=Symbol("objectMode"),tr=Symbol("destroyed"),YT=Symbol("error"),JT=Symbol("emitData"),SN=Symbol("emitEnd"),ZT=Symbol("emitEnd2"),js=Symbol("async"),e2=Symbol("abort"),Ky=Symbol("aborted"),Gd=Symbol("signal"),Pc=Symbol("dataListeners"),Yn=Symbol("discarded"),qd=a(n=>Promise.resolve().then(n),"defer"),Iee=a(n=>n(),"nodefer"),xee=a(n=>n==="end"||n==="finish"||n==="prefinish","isEndish"),Ree=a(n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,"isArrayBufferLike"),Pee=a(n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),"isArrayBufferView"),Qy=class{static{a(this,"Pipe")}src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Iu](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},t2=class extends Qy{static{a(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)}},Cee=a(n=>!!n.objectMode,"isObjectModeOptions"),Oee=a(n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer","isEncodingOptions"),Aa=class extends Xy.EventEmitter{static{a(this,"Minipass")}[Rr]=!1;[Vd]=!1;[vn]=[];[Pr]=[];[rn];[es];[js];[Au];[Do]=!1;[Ta]=!1;[qy]=!1;[Wy]=!1;[Bd]=null;[Cr]=0;[tr]=!1;[Gd];[Ky]=!1;[Pc]=0;[Yn]=!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");Cee(t)?(this[rn]=!0,this[es]=null):Oee(t)?(this[es]=t.encoding,this[rn]=!1):(this[rn]=!1,this[es]=null),this[js]=!!t.async,this[Au]=this[es]?new wN.StringDecoder(this[es]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:a(()=>this[Pr],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:a(()=>this[vn],"get")});let{signal:r}=t;r&&(this[Gd]=r,r.aborted?this[e2]():r.addEventListener("abort",()=>this[e2]()))}get bufferLength(){return this[Cr]}get encoding(){return this[es]}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[rn]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[js]}set async(e){this[js]=this[js]||!!e}[e2](){this[Ky]=!0,this.emit("abort",this[Gd]?.reason),this.destroy(this[Gd]?.reason)}get aborted(){return this[Ky]}set aborted(e){}write(e,t,r){if(this[Ky])return!1;if(this[Do])throw new Error("write after end");if(this[tr])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[js]?qd:Iee;if(!this[rn]&&!Buffer.isBuffer(e)){if(Pee(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Ree(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[rn]?(this[Rr]&&this[Cr]!==0&&this[zy](!0),this[Rr]?this.emit("data",e):this[XT](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Rr]):e.length?(typeof e=="string"&&!(t===this[es]&&!this[Au]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[es]&&(e=this[Au].write(e)),this[Rr]&&this[Cr]!==0&&this[zy](!0),this[Rr]?this.emit("data",e):this[XT](e),this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Rr]):(this[Cr]!==0&&this.emit("readable"),r&&i(r),this[Rr])}read(e){if(this[tr])return null;if(this[Yn]=!1,this[Cr]===0||e===0||e&&e>this[Cr])return this[Fo](),null;this[rn]&&(e=null),this[Pr].length>1&&!this[rn]&&(this[Pr]=[this[es]?this[Pr].join(""):Buffer.concat(this[Pr],this[Cr])]);let t=this[bN](e||null,this[Pr][0]);return this[Fo](),t}[bN](e,t){if(this[rn])this[Hy]();else{let r=t;e===r.length||e===null?this[Hy]():typeof r=="string"?(this[Pr][0]=r.slice(e),t=r.slice(0,e),this[Cr]-=e):(this[Pr][0]=r.subarray(e),t=r.subarray(0,e),this[Cr]-=e)}return this.emit("data",t),!this[Pr].length&&!this[Do]&&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[Do]=!0,this.writable=!1,(this[Rr]||!this[Vd])&&this[Fo](),this}[Iu](){this[tr]||(!this[Pc]&&!this[vn].length&&(this[Yn]=!0),this[Vd]=!1,this[Rr]=!0,this.emit("resume"),this[Pr].length?this[zy]():this[Do]?this[Fo]():this.emit("drain"))}resume(){return this[Iu]()}pause(){this[Rr]=!1,this[Vd]=!0,this[Yn]=!1}get destroyed(){return this[tr]}get flowing(){return this[Rr]}get paused(){return this[Vd]}[XT](e){this[rn]?this[Cr]+=1:this[Cr]+=e.length,this[Pr].push(e)}[Hy](){return this[rn]?this[Cr]-=1:this[Cr]-=this[Pr][0].length,this[Pr].shift()}[zy](e=!1){do;while(this[_N](this[Hy]())&&this[Pr].length);!e&&!this[Pr].length&&!this[Do]&&this.emit("drain")}[_N](e){return this.emit("data",e),this[Rr]}pipe(e,t){if(this[tr])return e;this[Yn]=!1;let r=this[Ta];return t=t||{},e===yN.stdout||e===yN.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[vn].push(t.proxyErrors?new t2(this,e,t):new Qy(this,e,t)),this[js]?qd(()=>this[Iu]()):this[Iu]()),e}unpipe(e){let t=this[vn].find(r=>r.dest===e);t&&(this[vn].length===1?(this[Rr]&&this[Pc]===0&&(this[Rr]=!1),this[vn]=[]):this[vn].splice(this[vn].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[Yn]=!1,this[Pc]++,!this[vn].length&&!this[Rr]&&this[Iu]();else if(e==="readable"&&this[Cr]!==0)super.emit("readable");else if(xee(e)&&this[Ta])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Bd]){let i=t;this[js]?qd(()=>i.call(this,this[Bd])):i.call(this,this[Bd])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Pc]=this.listeners("data").length,this[Pc]===0&&!this[Yn]&&!this[vn].length&&(this[Rr]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Pc]=0,!this[Yn]&&!this[vn].length&&(this[Rr]=!1)),t}get emittedEnd(){return this[Ta]}[Fo](){!this[qy]&&!this[Ta]&&!this[tr]&&this[Pr].length===0&&this[Do]&&(this[qy]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Wy]&&this.emit("close"),this[qy]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==tr&&this[tr])return!1;if(e==="data")return!this[rn]&&!r?!1:this[js]?(qd(()=>this[JT](r)),!0):this[JT](r);if(e==="end")return this[SN]();if(e==="close"){if(this[Wy]=!0,!this[Ta]&&!this[tr])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Bd]=r,super.emit(YT,r);let s=!this[Gd]||this.listeners("error").length?super.emit("error",r):!1;return this[Fo](),s}else if(e==="resume"){let s=super.emit("resume");return this[Fo](),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[Fo](),i}[JT](e){for(let r of this[vn])r.dest.write(e)===!1&&this.pause();let t=this[Yn]?!1:super.emit("data",e);return this[Fo](),t}[SN](){return this[Ta]?!1:(this[Ta]=!0,this.readable=!1,this[js]?(qd(()=>this[ZT]()),!0):this[ZT]())}[ZT](){if(this[Au]){let t=this[Au].end();if(t){for(let r of this[vn])r.dest.write(t);this[Yn]||super.emit("data",t)}}for(let t of this[vn])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[rn]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[rn]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[rn])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[es]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(tr,()=>t(new Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[Yn]=!1;let e=!1,t=a(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"stop");return{next:a(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Do])return t();let s,o,c=a(d=>{this.off("data",l),this.off("end",u),this.off(tr,f),t(),o(d)},"onerr"),l=a(d=>{this.off("error",c),this.off("end",u),this.off(tr,f),this.pause(),s({value:d,done:!!this[Do]})},"ondata"),u=a(()=>{this.off("error",c),this.off("data",l),this.off(tr,f),t(),s({done:!0,value:void 0})},"onend"),f=a(()=>c(new Error("stream destroyed")),"ondestroy");return new Promise((d,h)=>{o=h,s=d,this.once(tr,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[Yn]=!1;let e=!1,t=a(()=>(this.pause(),this.off(YT,t),this.off(tr,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"stop"),r=a(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next");return this.once("end",t),this.once(YT,t),this.once(tr,t),{next:r,throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[tr])return e?this.emit("error",e):this.emit(tr),this;this[tr]=!0,this[Yn]=!0,this[Pr].length=0,this[Cr]=0;let t=this;return typeof t.close=="function"&&!this[Wy]&&t.close(),e?this.emit("error",e):this.emit(tr),this}static get isStream(){return Eee}};var Fee=Us.realpathSync.native,zd={lstatSync:Us.lstatSync,readdir:Us.readdir,readdirSync:Us.readdirSync,readlinkSync:Us.readlinkSync,realpathSync:Fee,promises:{lstat:Ia.lstat,readdir:Ia.readdir,readlink:Ia.readlink,realpath:Ia.realpath}},xN=a(n=>!n||n===zd||n===Dee?zd:{...zd,...n,promises:{...zd.promises,...n.promises||{}}},"fsFromOption"),RN=/^\\\\\?\\([a-z]:)\\?$/i,Lee=a(n=>n.replace(/\//g,"\\").replace(RN,"$1\\"),"uncToDrive"),Nee=/[\\\/]/,mi=0,PN=1,CN=2,$s=4,ON=6,DN=8,Cc=10,FN=12,pi=15,Wd=~pi,n2=16,vN=32,Hd=64,ts=128,Yy=256,Zy=512,EN=Hd|ts|Zy,kee=1023,i2=a(n=>n.isFile()?DN:n.isDirectory()?$s:n.isSymbolicLink()?Cc:n.isCharacterDevice()?CN:n.isBlockDevice()?ON:n.isSocket()?FN:n.isFIFO()?PN:mi,"entToType"),TN=new Map,Kd=a(n=>{let e=TN.get(n);if(e)return e;let t=n.normalize("NFKD");return TN.set(n,t),t},"normalize"),AN=new Map,Jy=a(n=>{let e=AN.get(n);if(e)return e;let t=Kd(n.toLowerCase());return AN.set(n,t),t},"normalizeNocase"),e0=class extends Ud{static{a(this,"ResolveCache")}constructor(){super({max:256})}},s2=class extends Ud{static{a(this,"ChildrenCache")}constructor(e=16*1024){super({maxSize:e,sizeCalculation:a(t=>t.length+1,"sizeCalculation")})}},LN=Symbol("PathScurry setAsCwd"),nn=class{static{a(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}#b;get gid(){return this.#b}#i;get rdev(){return this.#i}#u;get blksize(){return this.#u}#s;get ino(){return this.#s}#l;get size(){return this.#l}#o;get blocks(){return this.#o}#p;get atimeMs(){return this.#p}#g;get mtimeMs(){return this.#g}#d;get ctimeMs(){return this.#d}#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}#_;#v;#S;#w;#I;#x;#a;#D;#A;#C;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=mi,r,i,s,o,c){this.name=e,this.#_=s?Jy(e):Kd(e),this.#a=t&kee,this.nocase=s,this.roots=i,this.root=r||this,this.#D=o,this.#S=c.fullpath,this.#I=c.relative,this.#x=c.relativePosix,this.parent=c.parent,this.parent?this.#e=this.parent.#e:this.#e=xN(c.fs)}depth(){return this.#v!==void 0?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#D}resolve(e){if(!e)return this;let t=this.getRootString(e),i=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#F(i):this.#F(i)}#F(e){let t=this;for(let r of e)t=t.child(r);return t}children(){let e=this.#D.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#D.set(this,t),this.#a&=~n2,t}child(e,t){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let r=this.children(),i=this.nocase?Jy(e):Kd(e);for(let l of r)if(l.#_===i)return l;let s=this.parent?this.sep:"",o=this.#S?this.#S+s+e:void 0,c=this.newChild(e,mi,{...t,parent:this,fullpath:o});return this.canReaddir()||(c.#a|=ts),r.push(c),c}relative(){if(this.isCWD)return"";if(this.#I!==void 0)return this.#I;let e=this.name,t=this.parent;if(!t)return this.#I=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.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.fullpathPosix();let r=t.relativePosix();return r+(!r||!t.parent?"":"/")+e}fullpath(){if(this.#S!==void 0)return this.#S;let e=this.name,t=this.parent;if(!t)return this.#S=this.name;let i=t.fullpath()+(t.parent?this.sep:"")+e;return this.#S=i}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let e=this.parent,t=e.fullpathPosix(),r=t+(!t||!e.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#a&pi)===mi}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.#a&pi)===DN}isDirectory(){return(this.#a&pi)===$s}isCharacterDevice(){return(this.#a&pi)===CN}isBlockDevice(){return(this.#a&pi)===ON}isFIFO(){return(this.#a&pi)===PN}isSocket(){return(this.#a&pi)===FN}isSymbolicLink(){return(this.#a&Cc)===Cc}lstatCached(){return this.#a&vN?this:void 0}readlinkCached(){return this.#A}realpathCached(){return this.#C}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#A)return!0;if(!this.parent)return!1;let e=this.#a&pi;return!(e!==mi&&e!==Cc||this.#a&Yy||this.#a&ts)}calledReaddir(){return!!(this.#a&n2)}isENOENT(){return!!(this.#a&ts)}isNamed(e){return this.nocase?this.#_===Jy(e):this.#_===Kd(e)}async readlink(){let e=this.#A;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.#A=r}catch(t){this.#h(t.code);return}}readlinkSync(){let e=this.#A;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.#A=r}catch(t){this.#h(t.code);return}}#L(e){this.#a|=n2;for(let t=e.provisional;t<e.length;t++){let r=e[t];r&&r.#N()}}#N(){this.#a&ts||(this.#a=(this.#a|ts)&Wd,this.#R())}#R(){let e=this.children();e.provisional=0;for(let t of e)t.#N()}#P(){this.#a|=Zy,this.#k()}#k(){if(this.#a&Hd)return;let e=this.#a;(e&pi)===$s&&(e&=Wd),this.#a=e|Hd,this.#R()}#M(e=""){e==="ENOTDIR"||e==="EPERM"?this.#k():e==="ENOENT"?this.#N():this.children().provisional=0}#j(e=""){e==="ENOTDIR"?this.parent.#k():e==="ENOENT"&&this.#N()}#h(e=""){let t=this.#a;t|=Yy,e==="ENOENT"&&(t|=ts),(e==="EINVAL"||e==="UNKNOWN")&&(t&=Wd),this.#a=t,e==="ENOTDIR"&&this.parent&&this.parent.#k()}#$(e,t){return this.#O(e,t)||this.#U(e,t)}#U(e,t){let r=i2(e),i=this.newChild(e.name,r,{parent:this}),s=i.#a&pi;return s!==$s&&s!==Cc&&s!==mi&&(i.#a|=Hd),t.unshift(i),t.provisional++,i}#O(e,t){for(let r=t.provisional;r<t.length;r++){let i=t[r];if((this.nocase?Jy(e.name):Kd(e.name))===i.#_)return this.#B(e,i,r,t)}}#B(e,t,r,i){let s=t.name;return t.#a=t.#a&Wd|i2(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.#a&ts)===0)try{return this.#W(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#j(e.code)}}lstatSync(){if((this.#a&ts)===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:o,blocks:c,ctime:l,ctimeMs:u,dev:f,gid:d,ino:h,mode:p,mtime:y,mtimeMs:g,nlink:v,rdev:_,size:S,uid:T}=e;this.#y=t,this.#p=r,this.#T=i,this.#m=s,this.#u=o,this.#o=c,this.#E=l,this.#d=u,this.#n=f,this.#b=d,this.#s=h,this.#r=p,this.#f=y,this.#g=g,this.#t=v,this.#i=_,this.#l=S,this.#c=T;let I=i2(e);this.#a=this.#a&Wd|I|vN,I!==mi&&I!==$s&&I!==Cc&&(this.#a|=Hd)}#G=[];#q=!1;#z(e){this.#q=!1;let t=this.#G.slice();this.#G.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.#G.push(e),this.#q)return;this.#q=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#M(s.code),r.provisional=0;else{for(let c of o)this.#$(c,r);this.#L(r)}this.#z(r.slice(0,r.provisional))})}#V;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.#V)await this.#V;else{let r=a(()=>{},"resolve");this.#V=new Promise(i=>r=i);try{for(let i of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#$(i,e);this.#L(e)}catch(i){this.#M(i.code),e.provisional=0}this.#V=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.#L(e)}catch(r){this.#M(r.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#a&EN)return!1;let e=pi&this.#a;return e===mi||e===$s||e===Cc}shouldWalk(e,t){return(this.#a&$s)===$s&&!(this.#a&EN)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#C)return this.#C;if(!((Zy|Yy|ts)&this.#a))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#C=this.resolve(e)}catch{this.#P()}}realpathSync(){if(this.#C)return this.#C;if(!((Zy|Yy|ts)&this.#a))try{let e=this.#e.realpathSync(this.fullpath());return this.#C=this.resolve(e)}catch{this.#P()}}[LN](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.#I=r.join(this.sep),i.#x=r.join("/"),i=i.parent,r.push("..");for(i=e;i&&i.parent&&!t.has(i);)i.#I=void 0,i.#x=void 0,i=i.parent}},t0=class n extends nn{static{a(this,"PathWin32")}sep="\\";splitSep=Nee;constructor(e,t=mi,r,i,s,o,c){super(e,t,r,i,s,o,c)}newChild(e,t=mi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return xu.win32.parse(e).root}getRoot(e){if(e=Lee(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 Ru(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(RN,"$1\\"),e===t}},r0=class n extends nn{static{a(this,"PathPosix")}splitSep="/";sep="/";constructor(e,t=mi,r,i,s,o,c){super(e,t,r,i,s,o,c)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=mi,r={}){return new n(e,t,this.root,this.roots,this.nocase,this.childrenCache(),r)}},n0=class{static{a(this,"PathScurryBase")}root;rootPath;roots;cwd;#e;#n;#r;nocase;#t;constructor(e=process.cwd(),t,r,{nocase:i,childrenCacheSize:s=16*1024,fs:o=zd}={}){this.#t=xN(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,IN.fileURLToPath)(e));let c=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(c),this.#e=new e0,this.#n=new e0,this.#r=new s2(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,d=t.sep,h=this.rootPath,p=!1;for(let y of l){let g=f--;u=u.child(y,{relative:new Array(g).fill("..").join(d),relativePosix:new Array(g).fill("..").join("/"),fullpath:h+=(p?"":d)+y}),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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 o=e[s];if(!(!o||o===".")&&(t=t?`${o}/${t}`:o,this.isAbsolute(o)))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 nn||(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 nn||(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 nn||(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 nn||(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 nn||(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 nn||(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 nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=[];(!s||s(e))&&c.push(r?e:e.fullpath());let l=new Set,u=a((d,h)=>{l.add(d),d.readdirCB((p,y)=>{if(p)return h(p);let g=y.length;if(!g)return h();let v=a(()=>{--g===0&&h()},"next");for(let _ of y)(!s||s(_))&&c.push(r?_:_.fullpath()),i&&_.isSymbolicLink()?_.realpath().then(S=>S?.isUnknown()?S.lstat():S).then(S=>S?.shouldWalk(l,o)?u(S,v):v()):_.shouldWalk(l,o)?u(_,v):v()},!0)},"walk"),f=e;return new Promise((d,h)=>{u(f,p=>{if(p)return h(p);d(c)})})}walkSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=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 d of f){(!s||s(d))&&c.push(r?d:d.fullpath());let h=d;if(d.isSymbolicLink()){if(!(i&&(h=d.realpathSync())))continue;h.isUnknown()&&h.lstatSync()}h.shouldWalk(l,o)&&l.add(h)}}return c}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(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 nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=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 d=f;if(f.isSymbolicLink()){if(!(i&&(d=f.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(c,o)&&c.add(d)}}}stream(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Aa({objectMode:!0});(!s||s(e))&&c.write(r?e:e.fullpath());let l=new Set,u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=a((v,_,S=!1)=>{if(v)return c.emit("error",v);if(i&&!S){let T=[];for(let I of _)I.isSymbolicLink()&&T.push(I.realpath().then(A=>A?.isUnknown()?A.lstat():A));if(T.length){Promise.all(T).then(()=>y(null,_,!0));return}}for(let T of _)T&&(!s||s(T))&&(c.write(r?T:T.fullpath())||(h=!0));f--;for(let T of _){let I=T.realpathCached()||T;I.shouldWalk(l,o)&&u.push(I)}h&&!c.flowing?c.once("drain",d):g||d()},"onReaddir"),g=!0;p.readdirCB(y,!0),g=!1}},"process");return d(),c}streamSync(e=this.cwd,t={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof nn||(t=e,e=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:o}=t,c=new Aa({objectMode:!0}),l=new Set;(!s||s(e))&&c.write(r?e:e.fullpath());let u=[e],f=0,d=a(()=>{let h=!1;for(;!h;){let p=u.shift();if(!p){f===0&&c.end();return}f++,l.add(p);let y=p.readdirSync();for(let g of y)(!s||s(g))&&(c.write(r?g:g.fullpath())||(h=!0));f--;for(let g of y){let v=g;if(g.isSymbolicLink()){if(!(i&&(v=g.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(l,o)&&u.push(v)}}h&&!c.flowing&&c.once("drain",d)},"process");return d(),c}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[LN](t)}},Ru=class extends n0{static{a(this,"PathScurryWin32")}sep="\\";constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,xu.win32,"\\",{...t,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return xu.win32.parse(e).root.toUpperCase()}newRoot(e){return new t0(this.rootPath,$s,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Pu=class extends n0{static{a(this,"PathScurryPosix")}sep="/";constructor(e=process.cwd(),t={}){let{nocase:r=!1}=t;super(e,xu.posix,"/",{...t,nocase:r}),this.nocase=r}parseRootPath(e){return"/"}newRoot(e){return new r0(this.rootPath,$s,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Qd=class extends Pu{static{a(this,"PathScurryDarwin")}constructor(e=process.cwd(),t={}){let{nocase:r=!0}=t;super(e,{...t,nocase:r})}},V0e=process.platform==="win32"?t0:r0,NN=process.platform==="win32"?Ru:process.platform==="darwin"?Qd:Pu;var Mee=a(n=>n.length>=1,"isPatternList"),jee=a(n=>n.length>=1,"isGlobList"),Cu=class n{static{a(this,"Pattern")}#e;#n;#r;length;#t;#c;#b;#i;#u;#s;#l=!0;constructor(e,t,r,i){if(!Mee(e))throw new TypeError("empty pattern list");if(!jee(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,o,c,l,...u]=this.#e,[f,d,h,p,...y]=this.#n;u[0]===""&&(u.shift(),y.shift());let g=[s,o,c,l,""].join("/"),v=[f,d,h,p,""].join("/");this.#e=[g,...u],this.#n=[v,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[c,...l]=this.#n;o[0]===""&&(o.shift(),l.shift());let u=s+"/",f=c+"/";this.#e=[u,...o],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]===er}isRegExp(){return this.#e[this.#r]instanceof RegExp}globString(){return this.#b=this.#b||(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 $ee=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ou=class{static{a(this,"Ignore")}relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:r,noext:i,noglobstar:s,platform:o=$ee}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let c of e)this.add(c)}add(e){let t=new Xn(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 o=new Cu(i,s,0,this.platform),c=new Xn(o.globString(),this.mmopts),l=s[s.length-1]==="**",u=o.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 o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(t)||o.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 o2=class n{static{a(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()]))}},a2=class{static{a(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)])}},c2=class{static{a(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())}},Xd=class n{static{a(this,"Processor")}hasWalkedCache;matches=new a2;subwalks=new c2;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new o2}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 o=s.root(),c=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;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 d=l===".."||l===""||l===".";this.matches.add(i.resolve(l),c,d);continue}else if(l===er){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=u?.pattern(),h=u?.rest();if(!u||(d===""||d===".")&&!h)this.matches.add(i,c,d===""||d===".");else if(d===".."){let p=i.parent||i;h?this.hasWalkedCache.hasWalked(p,h)||this.subwalks.add(p,h):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 o of r){let c=o.isAbsolute(),l=o.pattern(),u=o.rest();l===er?i.testGlobstar(s,o,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 o=e.parent||e;this.subwalks.add(o,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 Uee=a((n,e)=>typeof n=="string"?new Ou([n],e):Array.isArray(n)?new Ou(n,e):n,"makeIgnore"),i0=class{static{a(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=Uee(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 o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.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 o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.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(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#r)?"."+this.#r:"";this.matchEmit(s?o+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 Xd(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,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));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,o):c.readdirCB((u,f)=>this.walkCB3(c,f,r,o),!0)}o()}walkCB3(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--s===0&&i()},"next");for(let[c,l,u]of r.matches.entries())this.#t(c)||(s++,this.match(c,l,u).then(()=>o()));for(let[c,l]of r.subwalks.entries())s++,this.walkCB2(c,l,r.child(),o);o()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new Xd(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,o=a(()=>{--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,o)}o()}walkCB3Sync(e,t,r,i){r=r.filterEntries(e,t);let s=1,o=a(()=>{--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(),o);o()}},Yd=class extends i0{static{a(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}},Jd=class extends i0{static{a(this,"GlobStream")}results;constructor(e,t,r){super(e,t,r),this.results=new Aa({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 Bee=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",rs=class{static{a(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,kN.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||Bee,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"?Ru:t.platform==="darwin"?Qd:t.platform?Pu:NN;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 Xn(l,i)),[o,c]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=o.map((l,u)=>{let f=c[u];if(!f)throw new Error("invalid pattern object");return new Cu(l,f,0,this.platform)})}async walk(){return[...await new Yd(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 Yd(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 Jd(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 Jd(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 l2=a((n,e={})=>{Array.isArray(n)||(n=[n]);for(let t of n)if(new Xn(t,e).hasMagic())return!0;return!1},"hasMagic");function s0(n,e={}){return new rs(n,e).streamSync()}a(s0,"globStreamSync");function jN(n,e={}){return new rs(n,e).stream()}a(jN,"globStream");function $N(n,e={}){return new rs(n,e).walkSync()}a($N,"globSync");async function MN(n,e={}){return new rs(n,e).walk()}a(MN,"glob_");function o0(n,e={}){return new rs(n,e).iterateSync()}a(o0,"globIterateSync");function UN(n,e={}){return new rs(n,e).iterate()}a(UN,"globIterate");var Vee=s0,Gee=Object.assign(jN,{sync:s0}),qee=o0,Wee=Object.assign(UN,{sync:o0}),zee=Object.assign($N,{stream:s0,iterate:o0}),Du=Object.assign(MN,{glob:MN,globSync:$N,sync:zee,globStream:jN,stream:Gee,globStreamSync:s0,streamSync:Vee,globIterate:UN,iterate:Wee,globIterateSync:o0,iterateSync:qee,Glob:rs,hasMagic:l2,escape:vu,unescape:Zi});Du.glob=Du;async function VN(n,e,t,r={}){let{dryRun:i=!1,excludeRelPath:s}=r,o=Oc.default.join(n,"**/*.md"),c=await Du(o,{nodir:!0,ignore:[Oc.default.join(n,".obsidian/**"),Oc.default.join(n,".trash/**"),Oc.default.join(n,"**/.obsidian/**"),Oc.default.join(n,"**/.trash/**")]}),l={filesScanned:0,filesModified:0,replacements:0,modifiedFiles:[]};for(let u of c){let f=Oc.default.relative(n,u);if(s&&f===s)continue;l.filesScanned+=1;let d;try{d=await u2.default.readFile(u,"utf-8")}catch{continue}let{updated:h,replacements:p}=Hee(d,e,t);p>0&&(l.filesModified+=1,l.replacements+=p,l.modifiedFiles.push(f),i||await u2.default.writeFile(u,h,"utf-8"))}return l}a(VN,"rewriteInboundWikilinks");function Hee(n,e,t){let r=n.split(/(^```[\s\S]*?^```)/m),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=r[s],c=Kee(o,e,t);i+=c.replacements,r[s]=c.updated}return{updated:r.join(""),replacements:i}}a(Hee,"rewriteContent");function Kee(n,e,t){let r=n.split(/(`[^`\n]*`)/),i=0;for(let s=0;s<r.length;s++){if(s%2===1)continue;let o=Qee(r[s],e,t);i+=o.replacements,r[s]=o.updated}return{updated:r.join(""),replacements:i}}a(Kee,"rewriteProseSegment");function Qee(n,e,t){let r=/(?<!!)\[\[([^\[\]\n|#^]+)((?:[#^][^\[\]\n|]*)?)(?:\|[^\[\]\n]*)?\]\]/g,i=0;return{updated:n.replace(r,(o,c,l)=>c.trim()!==e?o:(i+=1,`[[${t}${l}]]`)),replacements:i}}a(Qee,"replaceWikilinks");var Xee=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,dt=class{constructor(e,t={}){this.rootPath=e;this.uuidIndex=null;this.basenameIndex=null;this.aliasIndex=null;this.siblingAdapters=t.siblingAdapters??[],this.subjectIriPrefix=t.subjectIriPrefix??""}static{a(this,"FileSystemVaultAdapter")}getSubjectIriPrefix(){return this.subjectIriPrefix}async read(e){let t=this.resolvePath(e.path);if(!await dr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);return dr.default.readFile(t,"utf-8")}async create(e,t){let r=this.resolvePath(e);if(await dr.default.pathExists(r))throw new Error(`File already exists: ${e}`);return await dr.default.ensureDir(Pt.default.dirname(r)),await dr.default.writeFile(r,t,"utf-8"),this.createFileObject(e)}async modify(e,t){let r=this.resolvePath(e.path);if(!await dr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await dr.default.writeFile(r,t,"utf-8")}async delete(e){let t=this.resolvePath(e.path);if(!await dr.default.pathExists(t))throw new Error(`File not found: ${e.path}`);await dr.default.remove(t)}async exists(e){let t=this.resolvePath(e);return dr.default.pathExists(t)}getAbstractFileByPath(e){let t=this.resolvePath(e);try{let r=dr.default.statSync(t);if(r.isFile())return this.createFileObject(e);if(r.isDirectory())return this.createFolderObject(e)}catch{return null}return null}getAllFiles(){let e=[];return this.walkDirectory(this.rootPath,t=>{if(t.endsWith(".md")){let r=Pt.default.relative(this.rootPath,t);e.push(this.createFileObject(r))}}),e}getFrontmatter(e){try{let t=dr.default.readFileSync(this.resolvePath(e.path),"utf-8");return this.extractFrontmatter(t)}catch{return null}}async updateFrontmatter(e,t){let r=await this.read(e),i=this.extractFrontmatter(r)||{},s=t(i),o=this.replaceFrontmatter(r,s);await this.modify(e,o)}async rename(e,t){let r=this.resolvePath(e.path),i=this.resolvePath(t);if(!await dr.default.pathExists(r))throw new Error(`File not found: ${e.path}`);await dr.default.ensureDir(Pt.default.dirname(i)),await dr.default.move(r,i)}async createFolder(e){let t=this.resolvePath(e);await dr.default.ensureDir(t)}getFirstLinkpathDest(e,t){let r=e.split("|")[0].trim();if(!r)return null;if(Xee.test(r)){this.uuidIndex===null&&this.buildUuidIndex();let u=r.toLowerCase(),f=this.uuidIndex.get(u);return f?this.createFileObject(f):null}let i=Pt.default.dirname(this.resolvePath(t)),s;if(Pt.default.isAbsolute(r)?s=this.resolvePath(r):s=Pt.default.resolve(i,r),r.endsWith(".md")||(s+=".md"),dr.default.existsSync(s)){let u=Pt.default.relative(this.rootPath,s);return this.createFileObject(u)}(this.basenameIndex===null||this.aliasIndex===null)&&this.buildLinkpathIndex();let o=r.toLowerCase(),c=this.basenameIndex.get(o);if(c)return this.createFileObject(c);let l=this.aliasIndex.get(o);if(l)return this.createFileObject(l);for(let u of this.siblingAdapters){let f=u.getSubjectIriPrefix();if(!f)continue;let d=u.getFirstLinkpathDest(r,"");if(d){let h=`${f}/${d.path}`;return this.createCrossVaultFileObject(h)}}return null}createCrossVaultFileObject(e){let t=Pt.default.basename(e),r=Pt.default.basename(e,Pt.default.extname(e)),i=Pt.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?{path:i,name:Pt.default.basename(i)}:null}}buildLinkpathIndex(){this.basenameIndex=new Map,this.aliasIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(!e.endsWith(".md"))return;let t=Pt.default.relative(this.rootPath,e),r=Pt.default.basename(e,".md").toLowerCase();this.basenameIndex.has(r)||this.basenameIndex.set(r,t);let i;try{i=dr.default.readFileSync(e,"utf-8")}catch{return}let s=this.extractFrontmatter(i);if(!s)return;let o=s.aliases,c=Array.isArray(o)?o:typeof o=="string"?[o]:[];for(let l of c){if(typeof l!="string")continue;let u=l.trim().toLowerCase();u&&(this.aliasIndex.has(u)||this.aliasIndex.set(u,t))}})}buildUuidIndex(){this.uuidIndex=new Map,this.walkDirectory(this.rootPath,e=>{if(e.endsWith(".md")){let r=Pt.default.basename(e,".md").match(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);if(r){let i=r[1].toLowerCase(),s=Pt.default.relative(this.rootPath,e);this.uuidIndex.set(i,s)}}})}async process(e,t){let r=await this.read(e),i=t(r);return await this.modify(e,i),i}getDefaultNewFileParent(){return{path:"",name:""}}async updateLinks(e,t,r){let i=Pt.default.basename(t,".md");await VN(this.rootPath,r,i,{excludeRelPath:e})}resolvePath(e){return Pt.default.isAbsolute(e)?e:Pt.default.join(this.rootPath,e)}createFileObject(e){let t=Pt.default.basename(e),r=Pt.default.basename(e,Pt.default.extname(e)),i=Pt.default.dirname(e);return{path:e,basename:r,name:t,parent:i!=="."?this.createFolderObject(i):null}}createFolderObject(e){return{path:e,name:Pt.default.basename(e)}}extractFrontmatter(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);if(!r)return null;try{let i=Nt.load(r[1]);return typeof i=="object"&&i!==null?i:null}catch{return null}}replaceFrontmatter(e,t){let r=Nt.dump(t,{lineWidth:-1,noRefs:!0,quotingType:'"'}),i=/^---\n([\s\S]*?)\n---/;return e.match(i)?e.replace(i,`---
523
523
  ${r.trim()}
524
524
  ---`):`---
525
525
  ${r.trim()}
@@ -559,8 +559,8 @@ ${e}`,"wrappedToString"),gte=Object.getOwnPropertyDescriptor(Function.prototype,
559
559
  `),o=i-1;e=[...s.slice(0,o),"... (content truncated to fit terminal)"].join(`
560
560
  `)}return this.#s.write(e),this.#e=this.#v(e,t),this}start(e){if(e&&(this.text=e),this.#g)return this;if(!this.#p){let t=" ".repeat(this.#d)+this.#T(this.#y," ")+(this.text?`- ${this.text}`:"")+this.#_(this.#f," ");return t.trim()!==""&&this.#s.write(t+`
561
561
  `),this}return this.isSpinning?this:(this.#i.hideCursor&&E2.hide(this.#s),this.#i.discardStdin&&uh.default.stdin.isTTY&&(this.#n=!0,O2.start()),this.render(),this.#l=setInterval(this.render.bind(this),this.interval),this)}stop(){return clearInterval(this.#l),this.#l=void 0,this.#t=0,this.#p&&(this.clear(),this.#i.hideCursor&&E2.show(this.#s)),this.#i.discardStdin&&uh.default.stdin.isTTY&&this.#n&&(O2.stop(),this.#n=!1),this}succeed(e){return this.stopAndPersist({symbol:Lc.success,text:e})}fail(e){return this.stopAndPersist({symbol:Lc.error,text:e})}warn(e){return this.stopAndPersist({symbol:Lc.warning,text:e})}info(e){return this.stopAndPersist({symbol:Lc.info,text:e})}stopAndPersist(e={}){if(this.#g)return this;let t=e.prefixText??this.#y,r=this.#T(t," "),i=e.symbol??" ",s=e.text??this.text,c=typeof s=="string"?(i?" ":"")+s:"",l=e.suffixText??this.#f,u=this.#_(l," "),f=r+i+c+u+`
562
- `;return this.stop(),this.#s.write(f),this}};function F2(n){return new D2(n)}a(F2,"ora");var y0=class{constructor(e,t={}){this.delayTimeout=null;this.updateInterval=null;this.startTime=0;this.isSpinnerVisible=!1;this.message=e,this.delayMs=t.delayMs??2e3,this.isTTY=!!process.stdout.isTTY,this.spinner=F2({text:e,isEnabled:this.isTTY})}static{a(this,"ProgressIndicator")}start(){this.isTTY&&(this.startTime=Date.now(),this.delayTimeout=setTimeout(()=>{this.showSpinner()},this.delayMs))}showSpinner(){!this.isTTY||this.isSpinnerVisible||(this.isSpinnerVisible=!0,this.updateSpinnerText(),this.spinner.start(),this.updateInterval=setInterval(()=>{this.updateSpinnerText()},1e3))}updateSpinnerText(){let e=Date.now()-this.startTime,t=this.formatElapsedTime(e);this.spinner.text=`${this.message} (${t})`}formatElapsedTime(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),i=t%60;return r>0?`${r}m ${i}s`:`${i}s`}cleanup(){this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),this.updateInterval&&(clearInterval(this.updateInterval),this.updateInterval=null)}succeed(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.succeed(e),this.isSpinnerVisible=!1}fail(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.fail(e),this.isSpinnerVisible=!1}stop(){this.cleanup(),this.isSpinnerVisible&&this.spinner.stop(),this.isSpinnerVisible=!1}async wrap(e,t){this.start();try{let r=await e();return this.succeed(t),r}catch(r){let i=r instanceof Error?r.message:"Operation failed";throw this.fail(i),r}}};var Us=J(tt());var b0=class{static{a(this,"QueryAnalyzer")}constructor(){this.parser=new Us.ExoQLParser,this.translator=new Us.ExoQLAlgebraTranslator,this.optimizer=new Us.AlgebraOptimizer,this.serializer=new Us.AlgebraSerializer}async analyze(e,t={}){try{let r=this.parser.parse(e),i={valid:!0,queryType:this.extractQueryType(r),prefixes:this.extractPrefixes(r),variables:this.extractVariables(r),triplePatternCount:this.countTriplePatterns(r),hasFilter:this.hasPatternType(r,"filter"),hasUnion:this.hasPatternType(r,"union"),hasOptional:this.hasPatternType(r,"optional")};if(i.complexity=this.estimateComplexity(i),t.includeAlgebraPlan){let s=this.translator.translate(r);t.optimize!==!1&&(s.type==="construct"?s={...s,where:this.optimizer.optimize(s.where)}:s=this.optimizer.optimize(s)),i.algebraPlan=this.serializer.toString(s)}return i}catch(r){return this.handleParseError(r)}}formatAnalysis(e,t){if(t==="json")return JSON.stringify(e,null,2);if(!e.valid)return this.formatError(e.error);let r=[];if(r.push(`Query Type: ${e.queryType}`),r.push(""),e.prefixes&&e.prefixes.length>0){r.push("Prefixes:");for(let s of e.prefixes)r.push(` ${s.prefix}: <${s.iri}>`);r.push("")}e.variables&&(r.push("Variables:"),e.variables.length===1&&e.variables[0]==="*"?r.push(" * (all variables)"):r.push(` ${e.variables.join(", ")}`),r.push("")),r.push(`Triple Patterns: ${e.triplePatternCount??0}`),r.push("");let i=[];return e.hasFilter&&i.push("FILTER"),e.hasUnion&&i.push("UNION"),e.hasOptional&&i.push("OPTIONAL"),i.length>0&&(r.push(`Features: ${i.join(", ")}`),r.push("")),r.push(`Complexity: ${e.complexity}`),e.algebraPlan&&(r.push(""),r.push("Query Plan:"),r.push(e.algebraPlan)),r.join(`
563
- `)}extractQueryType(e){return e.type==="update"?"UPDATE":"queryType"in e?e.queryType:"UNKNOWN"}extractPrefixes(e){let t=[];if(e.prefixes&&typeof e.prefixes=="object")for(let[r,i]of Object.entries(e.prefixes))t.push({prefix:r,iri:i});return t}extractVariables(e){return e.variables?Array.isArray(e.variables)?e.variables.length===1&&e.variables[0]==="*"?["*"]:e.variables.map(t=>typeof t=="string"?t:t.termType==="Variable"?`?${t.value}`:t.variable&&t.variable.termType==="Variable"?`?${t.variable.value}`:String(t)):[]:[]}countTriplePatterns(e){let t=e.where||[];return this.countTriplesInPatterns(t)}countTriplesInPatterns(e){let t=0;for(let r of e)r&&(r.type==="bgp"&&Array.isArray(r.triples)?t+=r.triples.length:r.patterns&&Array.isArray(r.patterns)&&(t+=this.countTriplesInPatterns(r.patterns)));return t}hasPatternType(e,t){let r=e.where||[];return this.containsPatternType(r,t)}containsPatternType(e,t){for(let r of e)if(r&&(r.type===t||r.patterns&&this.containsPatternType(r.patterns,t)))return!0;return!1}estimateComplexity(e){let t=0,r=e.triplePatternCount??0;return r<=3?t+=1:r<=7?t+=2:t+=3,e.hasOptional&&(t+=1),e.hasUnion&&(t+=2),e.hasFilter&&(t+=.5),t<=2?"low":t<=4?"medium":"high"}handleParseError(e){return e instanceof Us.SPARQLParseError?{valid:!1,error:{message:e.message,line:e.line,column:e.column,suggestions:this.generateSuggestions(e.message)}}:e instanceof Error?{valid:!1,error:{message:e.message,suggestions:this.generateSuggestions(e.message)}}:{valid:!1,error:{message:String(e)}}}generateSuggestions(e){let t=[],r=e.toLowerCase();if(r.includes("unknown prefix")||r.includes("prefix")){let i=e.match(/prefix[:\s]+(\w+)/i);if(i){let s=i[1].toLowerCase(),o={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",xsd:"http://www.w3.org/2001/XMLSchema#",owl:"http://www.w3.org/2002/07/owl#",ems:"http://exocortex.local/ems#",exo:"http://exocortex.local/exo#",ims:"http://exocortex.local/ims#"};o[s]?t.push(`Add prefix declaration: PREFIX ${s}: <${o[s]}>`):t.push(`Add a PREFIX declaration for '${s}' at the start of your query`)}}return(r.includes("where")||r.includes("expected"))&&t.push("Ensure your query has a WHERE clause: SELECT ?s WHERE { ... }"),(r.includes("bracket")||r.includes("brace")||r.includes("{")||r.includes("}"))&&t.push("Check that all braces { } are properly balanced"),(r.includes("variable")||r.includes("?"))&&t.push("Variables must start with '?' (e.g., ?subject, ?predicate, ?object)"),t.length===0&&t.push("Check SPARQL syntax - see https://www.w3.org/TR/sparql11-query/"),t}formatError(e){let t=[];if(t.push("Syntax Error:"),e.line!==void 0){let r=e.column!==void 0?`line ${e.line}, column ${e.column}`:`line ${e.line}`;t.push(` Position: ${r}`)}if(t.push(` ${e.message}`),e.suggestions&&e.suggestions.length>0){t.push(""),t.push("Suggestions:");for(let r of e.suggestions)t.push(` - ${r}`)}return t.join(`
562
+ `;return this.stop(),this.#s.write(f),this}};function F2(n){return new D2(n)}a(F2,"ora");var y0=class{constructor(e,t={}){this.delayTimeout=null;this.updateInterval=null;this.startTime=0;this.isSpinnerVisible=!1;this.message=e,this.delayMs=t.delayMs??2e3,this.isTTY=!!process.stdout.isTTY,this.spinner=F2({text:e,isEnabled:this.isTTY})}static{a(this,"ProgressIndicator")}start(){this.isTTY&&(this.startTime=Date.now(),this.delayTimeout=setTimeout(()=>{this.showSpinner()},this.delayMs))}showSpinner(){!this.isTTY||this.isSpinnerVisible||(this.isSpinnerVisible=!0,this.updateSpinnerText(),this.spinner.start(),this.updateInterval=setInterval(()=>{this.updateSpinnerText()},1e3))}updateSpinnerText(){let e=Date.now()-this.startTime,t=this.formatElapsedTime(e);this.spinner.text=`${this.message} (${t})`}formatElapsedTime(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),i=t%60;return r>0?`${r}m ${i}s`:`${i}s`}cleanup(){this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),this.updateInterval&&(clearInterval(this.updateInterval),this.updateInterval=null)}succeed(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.succeed(e),this.isSpinnerVisible=!1}fail(e){this.cleanup(),this.isSpinnerVisible&&this.spinner.fail(e),this.isSpinnerVisible=!1}stop(){this.cleanup(),this.isSpinnerVisible&&this.spinner.stop(),this.isSpinnerVisible=!1}async wrap(e,t){this.start();try{let r=await e();return this.succeed(t),r}catch(r){let i=r instanceof Error?r.message:"Operation failed";throw this.fail(i),r}}};var Bs=J(tt());var b0=class{static{a(this,"QueryAnalyzer")}constructor(){this.parser=new Bs.ExoQLParser,this.translator=new Bs.ExoQLAlgebraTranslator,this.optimizer=new Bs.AlgebraOptimizer,this.serializer=new Bs.AlgebraSerializer}async analyze(e,t={}){try{let r=this.parser.parse(e),i={valid:!0,queryType:this.extractQueryType(r),prefixes:this.extractPrefixes(r),variables:this.extractVariables(r),triplePatternCount:this.countTriplePatterns(r),hasFilter:this.hasPatternType(r,"filter"),hasUnion:this.hasPatternType(r,"union"),hasOptional:this.hasPatternType(r,"optional")};if(i.complexity=this.estimateComplexity(i),t.includeAlgebraPlan){let s=this.translator.translate(r);t.optimize!==!1&&(s.type==="construct"?s={...s,where:this.optimizer.optimize(s.where)}:s=this.optimizer.optimize(s)),i.algebraPlan=this.serializer.toString(s)}return i}catch(r){return this.handleParseError(r)}}formatAnalysis(e,t){if(t==="json")return JSON.stringify(e,null,2);if(!e.valid)return this.formatError(e.error);let r=[];if(r.push(`Query Type: ${e.queryType}`),r.push(""),e.prefixes&&e.prefixes.length>0){r.push("Prefixes:");for(let s of e.prefixes)r.push(` ${s.prefix}: <${s.iri}>`);r.push("")}e.variables&&(r.push("Variables:"),e.variables.length===1&&e.variables[0]==="*"?r.push(" * (all variables)"):r.push(` ${e.variables.join(", ")}`),r.push("")),r.push(`Triple Patterns: ${e.triplePatternCount??0}`),r.push("");let i=[];return e.hasFilter&&i.push("FILTER"),e.hasUnion&&i.push("UNION"),e.hasOptional&&i.push("OPTIONAL"),i.length>0&&(r.push(`Features: ${i.join(", ")}`),r.push("")),r.push(`Complexity: ${e.complexity}`),e.algebraPlan&&(r.push(""),r.push("Query Plan:"),r.push(e.algebraPlan)),r.join(`
563
+ `)}extractQueryType(e){return e.type==="update"?"UPDATE":"queryType"in e?e.queryType:"UNKNOWN"}extractPrefixes(e){let t=[];if(e.prefixes&&typeof e.prefixes=="object")for(let[r,i]of Object.entries(e.prefixes))t.push({prefix:r,iri:i});return t}extractVariables(e){return e.variables?Array.isArray(e.variables)?e.variables.length===1&&e.variables[0]==="*"?["*"]:e.variables.map(t=>typeof t=="string"?t:t.termType==="Variable"?`?${t.value}`:t.variable&&t.variable.termType==="Variable"?`?${t.variable.value}`:String(t)):[]:[]}countTriplePatterns(e){let t=e.where||[];return this.countTriplesInPatterns(t)}countTriplesInPatterns(e){let t=0;for(let r of e)r&&(r.type==="bgp"&&Array.isArray(r.triples)?t+=r.triples.length:r.patterns&&Array.isArray(r.patterns)&&(t+=this.countTriplesInPatterns(r.patterns)));return t}hasPatternType(e,t){let r=e.where||[];return this.containsPatternType(r,t)}containsPatternType(e,t){for(let r of e)if(r&&(r.type===t||r.patterns&&this.containsPatternType(r.patterns,t)))return!0;return!1}estimateComplexity(e){let t=0,r=e.triplePatternCount??0;return r<=3?t+=1:r<=7?t+=2:t+=3,e.hasOptional&&(t+=1),e.hasUnion&&(t+=2),e.hasFilter&&(t+=.5),t<=2?"low":t<=4?"medium":"high"}handleParseError(e){return e instanceof Bs.SPARQLParseError?{valid:!1,error:{message:e.message,line:e.line,column:e.column,suggestions:this.generateSuggestions(e.message)}}:e instanceof Error?{valid:!1,error:{message:e.message,suggestions:this.generateSuggestions(e.message)}}:{valid:!1,error:{message:String(e)}}}generateSuggestions(e){let t=[],r=e.toLowerCase();if(r.includes("unknown prefix")||r.includes("prefix")){let i=e.match(/prefix[:\s]+(\w+)/i);if(i){let s=i[1].toLowerCase(),o={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",xsd:"http://www.w3.org/2001/XMLSchema#",owl:"http://www.w3.org/2002/07/owl#",ems:"http://exocortex.local/ems#",exo:"http://exocortex.local/exo#",ims:"http://exocortex.local/ims#"};o[s]?t.push(`Add prefix declaration: PREFIX ${s}: <${o[s]}>`):t.push(`Add a PREFIX declaration for '${s}' at the start of your query`)}}return(r.includes("where")||r.includes("expected"))&&t.push("Ensure your query has a WHERE clause: SELECT ?s WHERE { ... }"),(r.includes("bracket")||r.includes("brace")||r.includes("{")||r.includes("}"))&&t.push("Check that all braces { } are properly balanced"),(r.includes("variable")||r.includes("?"))&&t.push("Variables must start with '?' (e.g., ?subject, ?predicate, ?object)"),t.length===0&&t.push("Check SPARQL syntax - see https://www.w3.org/TR/sparql11-query/"),t}formatError(e){let t=[];if(t.push("Syntax Error:"),e.line!==void 0){let r=e.column!==void 0?`line ${e.line}, column ${e.column}`:`line ${e.line}`;t.push(` Position: ${r}`)}if(t.push(` ${e.message}`),e.suggestions&&e.suggestions.length>0){t.push(""),t.push("Suggestions:");for(let r of e.suggestions)t.push(` - ${r}`)}return t.join(`
564
564
  `)}};var L2=class extends Error{static{a(this,"TemplateNotFoundError")}constructor(e){super(`Template not found: "${e}". Use --list-templates to see available templates.`),this.name="TemplateNotFoundError"}},N2=class extends Error{static{a(this,"InvalidParameterError")}constructor(e,t,r){super(`Invalid parameter "${e}" for template "${t}". Valid parameters: ${r.length>0?r.join(", "):"none"}`),this.name="InvalidParameterError"}},k2=class extends Error{static{a(this,"MissingParameterError")}constructor(e,t){super(`Missing required parameter(s) for template "${t}": ${e.join(", ")}. Use --param to provide values.`),this.name="MissingParameterError"}},_0=class extends Error{static{a(this,"InvalidParamFormatError")}constructor(e){super(`Invalid parameter format: "${e}". Use format: key=value or key1=value1,key2=value2`),this.name="InvalidParamFormatError"}},$te=[{name:"tasks-by-date",description:"Find tasks scheduled for a specific date",query:`PREFIX ems: <http://example.org/ems#>
565
565
  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
566
566
  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
@@ -635,7 +635,7 @@ Available prefixes: ${u}`,this.wellKnownPrefixes[r]&&c.push(`Add: PREFIX ${r}: <
635
635
  \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${_}ms${y?" (from cache)":""}`),console.log(` Query execution: ${k}ms`),console.log(` Total time: ${H}ms`),console.log(` Triples scanned: ${p.length}`),console.log(` Triples generated: ${O.length}`),e.useCache&&console.log(` Triple cache: ${y?"HIT":"MISS (rebuilt)"}`),l&&console.log(" Query result cache: MISS (cached for next run)"))}else{C?.start();let O=await j2(Y.executeAll(R),o,q),k=Date.now()-q;C?.stop();let H=Date.now()-s,G=O.map(B=>B.toJSON());if(l){let B={type:"select",count:O.length,bindings:G};await new Mu().set(i,B,c)}if(t==="json"){let B={query:i,count:O.length,bindings:G},Z=Ue.success(B,{durationMs:H,itemCount:O.length,loadDurationMs:_,execDurationMs:k,triplesScanned:p.length,cacheHit:y,queryResultCacheHit:!1});console.log(JSON.stringify(Z,null,2))}else console.log(`\u2705 Found ${O.length} result(s) in ${k}ms
636
636
  `),O.length>0?hre(O,e.format):console.log("No results found."),e.stats&&(console.log(`
637
637
  \u{1F4CA} Execution Statistics:`),console.log(` Vault loading: ${_}ms${y?" (from cache)":""}`),console.log(` Query execution: ${k}ms`),console.log(` Total time: ${H}ms`),console.log(` Triples scanned: ${p.length}`),console.log(` Results returned: ${O.length}`),e.useCache&&console.log(` Triple cache: ${y?"HIT":"MISS (rebuilt)"}`),l&&console.log(" Query result cache: MISS (cached for next run)"))}}catch(s){xk(s,i,t)}finally{e.strict&&(r===void 0?delete process.env.EXOCORTEX_SPARQL_STRICT:process.env.EXOCORTEX_SPARQL_STRICT=r)}})}a(Ik,"sparqlQueryCommand");function xk(n,e,t){let r=new w0;if(r.classifyError(n)!=="unknown"){let s=r.enhanceError(n,e);if(t==="json"){let o=Ue.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(o,null,2)),process.exit(2)}else console.error(r.formatForText(s)),process.exit(2)}le.handle(n)}a(xk,"handleSparqlError");function fre(n){if(n.includes("SELECT")||n.includes("CONSTRUCT")||n.includes("INSERT")||n.includes("DELETE"))return n;let e=(0,Vu.resolve)(n);return(0,Gu.existsSync)(e)?(0,Gu.readFileSync)(e,"utf-8"):n}a(fre,"loadQuery");async function dre(n,e,t){if(e.explain){let i=new b0,s=await i.analyze(n,{includeAlgebraPlan:!0,optimize:!e.noOptimize});if(t==="json"){let o=Ue.success(s);console.log(JSON.stringify(o,null,2))}else s.valid?(console.log(`\u2705 Query syntax is valid
638
- `),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new jt.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let o=new jt.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&o.type!=="construct")o=new jt.AlgebraOptimizer().optimize(o);else if(!e.noOptimize&&o.type==="construct"){let c=new jt.AlgebraOptimizer,l=o;o={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=Ue.success({valid:!0,queryType:Ak(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: ${Ak(i)}`)}catch(i){xk(i,n,t)}}a(dre,"executeDryRun");function Ak(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}a(Ak,"getQueryType");function hre(n,e){switch(e){case"json":let t=new Lu;console.log(t.format(n));break;case"csv":let r=new a0;console.log(r.format(n));break;case"table":default:let i=new Fu;console.log(i.format(n));break}}a(hre,"formatSelectResults");function pre(n,e){let t=new Nu;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}}a(pre,"formatConstructResults");function mre(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(o=>{let c=i[o];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(o=>String(i[o]??""));console.log(s.join(" "))}break}}a(mre,"formatCachedSelectResults");function gre(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}> ${yre(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}}a(gre,"formatCachedConstructResults");function yre(n){return v0.formatObject(n)}a(yre,"formatNTriplesObject");function bre(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}}}a(bre,"formatUpdateResults");var B2=require("fs"),V2=require("path"),Bs=J(tt());var $2=require("fs"),U2=require("path"),En=J(tt());async function Rk(n,e,t={}){let r=t.silent??!1,i=t.log??(_=>console.log(_)),s=(0,U2.resolve)(n);if(!(0,$2.existsSync)(s))throw new Me(s);let o=[];for(let _ of e){let S=(0,U2.resolve)(_);if(!(0,$2.existsSync)(S))throw new Me(S);S===s||o.includes(S)||o.push(S)}let c=[],l=[];for(let _ of o){let S=E0(_);c.push(new dt(_,{subjectIriPrefix:S})),l.push(S)}r||i(`\u{1F4E6} Loading primary vault: ${s}...`);let u=[],f=new dt(s,{siblingAdapters:c}),h=await new En.NoteToRDFConverter(f).convertVault();u=u.concat(h),r||i(` \u2795 Added ${h.length} triples from primary vault`);for(let _=0;_<c.length;_++){let S=o[_],T=c[_],I=l[_];r||i(`\u{1F4E6} Loading additional vault: ${S}...`);let R=await new En.NoteToRDFConverter(T,void 0,{subjectIriPrefix:I}).convertVault();u=u.concat(R),r||i(` \u2795 Added ${R.length} triples from ${S}`)}let p=u.length,y=0;if(o.length>0){let _=u.length;u=T0(u),y=u.length-_,!r&&y>0&&i(` \u{1F517} Cross-vault Instance_class resolution: emitted ${y} canonical-IRI triple(s)`)}let g=0;if(Dc()&&o.length>0){let _=c0([f,...c]),S=En.IRICanonicalizer.canonicalize(u,_);u=S.triples,g=S.remapCount,!r&&g>0&&i(` \u{1FA84} IRI canonicalization (Issue #3286): remapped ${g} triple(s) covering ${S.uniqueRemapCount} distinct synth-A IRI(s)`)}let v=0;if(t.noInference!==!0){let _=new En.InMemoryTripleStore;await _.addAll(u);let T=await new En.RDFSInferenceEngine().materialize(_);v+=T;let I=new En.NonInheritablePropertyRegistry;await I.initialize(_);let A=new En.PropertyCardinalityRegistry;await A.initialize(_);let q=await new En.PrototypeChainMaterializer(I,A).materialize(_);v+=q,v>0&&(u=await _.match(),r||i(`\u{1F9E0} Materialized ${v} inferred triples on combined store (RDFS + prototype chain)`))}return{triples:u,rawTripleCount:p,crossVaultAddedTripleCount:y,inferredTripleCount:v,canonicalizedTripleCount:g}}a(Rk,"buildCombinedTriples");function _re(n,e){return e.concat([n])}a(_re,"collectAlso");function Pk(){return new Ae("index").description("Build or refresh the triple cache for faster SPARQL queries").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to include in combined index (repeatable, Issue #3281)",_re,[]).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";le.setFormat(e);try{let t=(0,V2.resolve)(n.vault);if(!(0,B2.existsSync)(t))throw new Me(t);let r=n.also??[];if(r.length>0){await Sre(t,r,n,e);return}let i=new yi(t),s=i.getCachePath();n.force&&(e==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing cache..."),await i.invalidate()),e==="text"&&console.log(`\u{1F4E6} Building triple cache for: ${t}...`);let o=Date.now(),c=await i.buildCacheWithValidation({strict:n.strict??!1}),l=0;if(n.inference!==!1){let{triples:f}=await i.loadOrBuild(),d=new Bs.InMemoryTripleStore;await d.addAll(f),l=await new Bs.RDFSInferenceEngine().materialize(d);let p=new Bs.NonInheritablePropertyRegistry;await p.initialize(d);let y=new Bs.PropertyCardinalityRegistry;await y.initialize(d);let v=await new Bs.PrototypeChainMaterializer(p,y).materialize(d);if(l+=v,l>0){let _=await d.match();await i.saveTriples(_),c.tripleCount+=l}e==="text"&&l>0&&console.log(`\u{1F9E0} Materialized ${l} inferred triples (RDFS + prototype chain)`)}let u=Date.now()-o;if(e==="json"){let f={action:"build",cachePath:s,tripleCount:c.tripleCount,durationMs:c.durationMs},d={summary:c.summary,skippedFiles:c.skippedFiles};if(n.stats){let h=await i.getCacheStats();if(h){let p={tripleCount:h.tripleCount,createdAt:h.createdAt.toISOString(),isValid:h.isValid,sizeBytes:h.sizeBytes,cachePath:s},y=Ue.success({cache:f,stats:p,validation:d},{durationMs:u});console.log(JSON.stringify(y,null,2))}}else{let h=Ue.success({cache:f,validation:d},{durationMs:u});console.log(JSON.stringify(h,null,2))}}else{if(c.skippedFiles.length>0){console.log(`
638
+ `),console.log(i.formatAnalysis(s,"text"))):(console.log(i.formatAnalysis(s,"text")),process.exit(2));return}let r=new jt.ExoQLParser;try{let i=r.parse(n);if(i.type!=="update"){let o=new jt.ExoQLAlgebraTranslator().translate(i);if(!e.noOptimize&&o.type!=="construct")o=new jt.AlgebraOptimizer().optimize(o);else if(!e.noOptimize&&o.type==="construct"){let c=new jt.AlgebraOptimizer,l=o;o={...l,where:c.optimize(l.where)}}}if(t==="json"){let s=Ue.success({valid:!0,queryType:Ak(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: ${Ak(i)}`)}catch(i){xk(i,n,t)}}a(dre,"executeDryRun");function Ak(n){return n.type==="update"?"UPDATE":"queryType"in n?n.queryType:"UNKNOWN"}a(Ak,"getQueryType");function hre(n,e){switch(e){case"json":let t=new Lu;console.log(t.format(n));break;case"csv":let r=new a0;console.log(r.format(n));break;case"table":default:let i=new Fu;console.log(i.format(n));break}}a(hre,"formatSelectResults");function pre(n,e){let t=new Nu;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}}a(pre,"formatConstructResults");function mre(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(o=>{let c=i[o];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(o=>String(i[o]??""));console.log(s.join(" "))}break}}a(mre,"formatCachedSelectResults");function gre(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}> ${yre(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}}a(gre,"formatCachedConstructResults");function yre(n){return v0.formatObject(n)}a(yre,"formatNTriplesObject");function bre(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}}}a(bre,"formatUpdateResults");var B2=require("fs"),V2=require("path"),Vs=J(tt());var $2=require("fs"),U2=require("path"),En=J(tt());async function Rk(n,e,t={}){let r=t.silent??!1,i=t.log??(_=>console.log(_)),s=(0,U2.resolve)(n);if(!(0,$2.existsSync)(s))throw new Me(s);let o=[];for(let _ of e){let S=(0,U2.resolve)(_);if(!(0,$2.existsSync)(S))throw new Me(S);S===s||o.includes(S)||o.push(S)}let c=[],l=[];for(let _ of o){let S=E0(_);c.push(new dt(_,{subjectIriPrefix:S})),l.push(S)}r||i(`\u{1F4E6} Loading primary vault: ${s}...`);let u=[],f=new dt(s,{siblingAdapters:c}),h=await new En.NoteToRDFConverter(f).convertVault();u=u.concat(h),r||i(` \u2795 Added ${h.length} triples from primary vault`);for(let _=0;_<c.length;_++){let S=o[_],T=c[_],I=l[_];r||i(`\u{1F4E6} Loading additional vault: ${S}...`);let R=await new En.NoteToRDFConverter(T,void 0,{subjectIriPrefix:I}).convertVault();u=u.concat(R),r||i(` \u2795 Added ${R.length} triples from ${S}`)}let p=u.length,y=0;if(o.length>0){let _=u.length;u=T0(u),y=u.length-_,!r&&y>0&&i(` \u{1F517} Cross-vault Instance_class resolution: emitted ${y} canonical-IRI triple(s)`)}let g=0;if(Dc()&&o.length>0){let _=c0([f,...c]),S=En.IRICanonicalizer.canonicalize(u,_);u=S.triples,g=S.remapCount,!r&&g>0&&i(` \u{1FA84} IRI canonicalization (Issue #3286): remapped ${g} triple(s) covering ${S.uniqueRemapCount} distinct synth-A IRI(s)`)}let v=0;if(t.noInference!==!0){let _=new En.InMemoryTripleStore;await _.addAll(u);let T=await new En.RDFSInferenceEngine().materialize(_);v+=T;let I=new En.NonInheritablePropertyRegistry;await I.initialize(_);let A=new En.PropertyCardinalityRegistry;await A.initialize(_);let q=await new En.PrototypeChainMaterializer(I,A).materialize(_);v+=q,v>0&&(u=await _.match(),r||i(`\u{1F9E0} Materialized ${v} inferred triples on combined store (RDFS + prototype chain)`))}return{triples:u,rawTripleCount:p,crossVaultAddedTripleCount:y,inferredTripleCount:v,canonicalizedTripleCount:g}}a(Rk,"buildCombinedTriples");function _re(n,e){return e.concat([n])}a(_re,"collectAlso");function Pk(){return new Ae("index").description("Build or refresh the triple cache for faster SPARQL queries").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--also <path>","Additional vault to include in combined index (repeatable, Issue #3281)",_re,[]).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";le.setFormat(e);try{let t=(0,V2.resolve)(n.vault);if(!(0,B2.existsSync)(t))throw new Me(t);let r=n.also??[];if(r.length>0){await Sre(t,r,n,e);return}let i=new yi(t),s=i.getCachePath();n.force&&(e==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing cache..."),await i.invalidate()),e==="text"&&console.log(`\u{1F4E6} Building triple cache for: ${t}...`);let o=Date.now(),c=await i.buildCacheWithValidation({strict:n.strict??!1}),l=0;if(n.inference!==!1){let{triples:f}=await i.loadOrBuild(),d=new Vs.InMemoryTripleStore;await d.addAll(f),l=await new Vs.RDFSInferenceEngine().materialize(d);let p=new Vs.NonInheritablePropertyRegistry;await p.initialize(d);let y=new Vs.PropertyCardinalityRegistry;await y.initialize(d);let v=await new Vs.PrototypeChainMaterializer(p,y).materialize(d);if(l+=v,l>0){let _=await d.match();await i.saveTriples(_),c.tripleCount+=l}e==="text"&&l>0&&console.log(`\u{1F9E0} Materialized ${l} inferred triples (RDFS + prototype chain)`)}let u=Date.now()-o;if(e==="json"){let f={action:"build",cachePath:s,tripleCount:c.tripleCount,durationMs:c.durationMs},d={summary:c.summary,skippedFiles:c.skippedFiles};if(n.stats){let h=await i.getCacheStats();if(h){let p={tripleCount:h.tripleCount,createdAt:h.createdAt.toISOString(),isValid:h.isValid,sizeBytes:h.sizeBytes,cachePath:s},y=Ue.success({cache:f,stats:p,validation:d},{durationMs:u});console.log(JSON.stringify(y,null,2))}}else{let h=Ue.success({cache:f,validation:d},{durationMs:u});console.log(JSON.stringify(h,null,2))}}else{if(c.skippedFiles.length>0){console.log(`
639
639
  \u26A0\uFE0F Files skipped due to IRI issues:`);for(let f of c.skippedFiles)console.log(` - ${f.path}`),console.log(` ${f.reason}`);console.log("")}if(console.log(`\u2705 Indexed ${c.summary.indexed} files, skipped ${c.summary.skipped} (total: ${c.summary.total})`),console.log(`\u{1F4CA} Created cache with ${c.tripleCount.toLocaleString()} triples at ${s}`),console.log(`\u23F1\uFE0F Build time: ${c.durationMs}ms`),n.stats){let f=await i.getCacheStats();f&&(console.log(`
640
640
  \u{1F4CA} Cache Statistics:`),console.log(` Triples: ${f.tripleCount.toLocaleString()}`),console.log(` Created: ${f.createdAt.toISOString()}`),console.log(` Valid: ${f.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${Ck(f.sizeBytes)}`))}}}catch(t){le.handle(t)}})}a(Pk,"sparqlIndexCommand");async function Sre(n,e,t,r){for(let f of e){let d=(0,V2.resolve)(f);if(!(0,B2.existsSync)(d))throw new Me(d)}let i=new ku(n,e),s=i.getCachePath();t.force&&(r==="text"&&console.log("\u{1F5D1}\uFE0F Invalidating existing combined cache..."),await i.invalidate()),r==="text"&&console.log(`\u{1F4E6} Building combined triple cache (${i.getAllVaultPaths().length} vaults)...`);let o=Date.now(),c=await Rk(n,e,{noInference:t.inference===!1,silent:r!=="text"});await i.saveTriples(c.triples);let l=Date.now()-o,u=c.triples.length;if(r==="json"){let f={action:"build",cachePath:s,tripleCount:u,durationMs:l};if(t.stats){let h=await i.getCacheStats();if(h){let p={tripleCount:h.tripleCount,createdAt:h.createdAt.toISOString(),isValid:h.isValid,sizeBytes:h.sizeBytes,cachePath:s},y=Ue.success({cache:f,stats:p,combined:{vaultPaths:i.getAllVaultPaths(),rawTripleCount:c.rawTripleCount,crossVaultAddedTripleCount:c.crossVaultAddedTripleCount,inferredTripleCount:c.inferredTripleCount,canonicalizedTripleCount:c.canonicalizedTripleCount}},{durationMs:l});console.log(JSON.stringify(y,null,2));return}}let d=Ue.success({cache:f,combined:{vaultPaths:i.getAllVaultPaths(),rawTripleCount:c.rawTripleCount,crossVaultAddedTripleCount:c.crossVaultAddedTripleCount,inferredTripleCount:c.inferredTripleCount,canonicalizedTripleCount:c.canonicalizedTripleCount}},{durationMs:l});console.log(JSON.stringify(d,null,2))}else if(console.log(`\u{1F4CA} Created combined cache with ${u.toLocaleString()} triples at ${s}`),console.log(`\u23F1\uFE0F Build time: ${l}ms`),t.stats){let f=await i.getCacheStats();if(f){console.log(`
641
641
  \u{1F4CA} Combined Cache Statistics:`),console.log(` Triples: ${f.tripleCount.toLocaleString()}`),console.log(` Created: ${f.createdAt.toISOString()}`),console.log(` Valid: ${f.isValid?"\u2705 Yes":"\u274C No"}`),console.log(` Size: ${Ck(f.sizeBytes)}`),console.log(` Vaults (${f.vaultPaths.length}):`);for(let d of f.vaultPaths)console.log(` - ${d}`)}}}a(Sre,"runCombinedIndex");function Ck(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}a(Ck,"formatBytes");var Dk=require("path");var Lo=J(require("fs")),G2=J(require("path")),Ok=require("events");var wre={watch:Lo.default.watch.bind(Lo.default),existsSync:Lo.default.existsSync.bind(Lo.default),statSync:Lo.default.statSync.bind(Lo.default),readFileSync:Lo.default.readFileSync.bind(Lo.default)},A0=class extends Ok.EventEmitter{constructor(t,r={}){super();this.watcher=null;this.debounceTimers=new Map;this.isRunning=!1;this.vaultPath=G2.default.resolve(t),this.fsAdapter=r.fsAdapter??wre,this.options={pattern:r.pattern??"**/*.md",assetType:r.assetType??"",debounceMs:r.debounceMs??100,recursive:r.recursive??!0}}static{a(this,"FileSystemWatcher")}start(){this.isRunning||(this.watcher=this.fsAdapter.watch(this.vaultPath,{recursive:this.options.recursive},(t,r)=>{r&&this.handleFileEvent(t,r.toString())}),this.watcher.on("error",t=>{this.emit("error",t)}),this.isRunning=!0,this.emit("started"))}stop(){if(this.isRunning){for(let t of this.debounceTimers.values())clearTimeout(t);this.debounceTimers.clear(),this.watcher&&(this.watcher.close(),this.watcher=null),this.isRunning=!1,this.emit("stopped")}}isWatching(){return this.isRunning}handleFileEvent(t,r){let i=G2.default.join(this.vaultPath,r),s=r;if(!this.matchesPattern(s))return;let o=this.debounceTimers.get(i);o&&clearTimeout(o);let c=setTimeout(()=>{this.debounceTimers.delete(i),this.processFileEvent(i,s)},this.options.debounceMs);this.debounceTimers.set(i,c)}processFileEvent(t,r){let i=this.fsAdapter.existsSync(t),s;if(!i)s="delete";else{let l=this.fsAdapter.statSync(t);s=Date.now()-l.birthtimeMs<1e3?"create":"modify"}let o;if(i&&t.endsWith(".md")&&(o=this.extractAssetType(t)),this.options.assetType&&o!==this.options.assetType)return;let c={type:s,path:t,relativePath:r,timestamp:new Date().toISOString(),assetType:o};this.emit("change",c)}matchesPattern(t){return this.options.pattern?Wr(t,this.options.pattern):!0}extractAssetType(t){try{let i=this.fsAdapter.readFileSync(t,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(!i)return;let o=i[1].match(/exo__Instance_class:\s*(?:\[?"?\[\[([^\]]+)\]\]"?\]?|"?\[\[([^\]]+)\]\]"?)/);return o?o[1]||o[2]:void 0}catch{return}}};var q2=J(require("fs"));function Fk(){return new Ae("watch").description("Watch vault for file changes and emit NDJSON events").option("--vault <path>","Path to Obsidian vault",process.cwd()).option("--pattern <glob>","Glob pattern to filter files (e.g., '*.md', 'tasks/**')").option("--asset-type <type>","Filter by asset type (e.g., 'ems__Task', 'ems__Project')").option("--debounce <ms>","Debounce interval in milliseconds","100").action(async n=>{le.setFormat("json");try{let e=(0,Dk.resolve)(n.vault);if(!q2.default.existsSync(e))throw new Me(e);if(!q2.default.statSync(e).isDirectory())throw new ke(`Vault path is not a directory: ${e}`,"Provide a path to a directory, not a file",{vaultPath:e});let t=parseInt(n.debounce?.toString()??"100",10);if(isNaN(t)||t<0)throw new ke("--debounce must be a non-negative integer","Use a positive integer value for debounce",{debounce:n.debounce});let r=new A0(e,{pattern:n.pattern,assetType:n.assetType,debounceMs:t});r.on("change",s=>{console.log(JSON.stringify(s))}),r.on("error",s=>{let o=Ue.error("INTERNAL_OPERATION_FAILED",s.message,5,{recovery:{message:"Check file permissions and vault access",suggestion:"Ensure the vault directory is accessible"}});console.log(JSON.stringify(o))});let i=a(()=>{r.stop(),process.exit(0)},"shutdown");process.on("SIGINT",i),process.on("SIGTERM",i),console.error(`Watching vault: ${e}`),n.pattern&&console.error(` Pattern filter: ${n.pattern}`),n.assetType&&console.error(` Asset type filter: ${n.assetType}`),console.error(` Debounce: ${t}ms`),console.error("Press Ctrl+C to stop"),r.start()}catch(e){le.handle(e)}})}a(Fk,"watchCommand");var I0=require("fs"),ss=require("path");function Lk(){return new Ae("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";le.setFormat(t);try{let r=Date.now();if(!vre(n))throw new ke(`Invalid UUID format: ${n}`,"exocortex resolve <uuid> [--format uri|path|json] [--partial]",{uuid:n});let i=(0,ss.resolve)(e.vault);if(!(0,I0.existsSync)(i))throw new Me(i);let s=Ere(i,n,e.partial??!1),o=Date.now()-r;if(s.length===0){if(t==="json"){let c=Ue.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?Are(s,i,e.format,t,n,o):Tre(s[0],i,e.format,t,n,o)}catch(r){le.handle(r)}})}a(Lk,"resolveCommand");function vre(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)}a(vre,"isValidUuidFormat");function Ere(n,e,t){let r=[],i=e.toLowerCase();function s(o){let c=(0,I0.readdirSync)(o,{withFileTypes:!0});for(let l of c){let u=(0,ss.join)(o,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 a(s,"walk"),s(n),r}a(Ere,"findFilesWithUuid");function Nk(n){return`obsidian://vault/${encodeURI(n)}`}a(Nk,"pathToObsidianUri");function kk(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,ss.basename)(n,".md")}a(kk,"extractUuidFromFilename");function Tre(n,e,t,r,i,s){let o=(0,ss.relative)(e,n),c=Nk(o),l=kk((0,ss.basename)(n));if(r==="json"){let u={uuid:l,path:o,absolutePath:n,uri:c},f=Ue.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:o,absolutePath:n,uri:c},null,2));break;case"uri":default:console.log(c);break}}a(Tre,"outputSingleResult");function Are(n,e,t,r,i,s){let o=n.map(c=>{let l=(0,ss.relative)(e,c),u=Nk(l);return{uuid:kk((0,ss.basename)(c)),path:l,absolutePath:c,uri:u}});if(r==="json"){let c=Ue.success({matches:o,count:o.length},{durationMs:s,searchUuid:i,itemCount:o.length});console.log(JSON.stringify(c,null,2))}else switch(t){case"path":for(let c of o)console.log(c.absolutePath);break;case"json":console.log(JSON.stringify(o,null,2));break;case"uri":default:for(let c of o)console.log(c.uri);break}}a(Are,"outputMultipleResults");var Mk=require("fs"),jk=require("path"),Gn=J(tt());function $k(){return new Ae("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";le.setFormat(t);try{let r=Date.now(),i=(0,jk.resolve)(e.vault);if(!(0,Mk.existsSync)(i))throw new Me(i);let s=new Gn.NLToSPARQLService;t==="text"&&console.log(`\u{1F9E0} Analyzing question: "${n}"
@@ -775,7 +775,7 @@ Next steps:
775
775
  `),process.stdout.write(` File: ${e.file}
776
776
  `),process.stdout.write(` Commit: ${e.sha}
777
777
  `),process.stdout.write(` URL: ${e.url}
778
- `)),process.exit(0)}catch(e){let t=e instanceof Error?e:new Error(String(e)),r=new vi;t.message=r.redact(t.message),t.stack&&(t.stack=r.redact(t.stack)),le.handle(t)}})}a(Mie,"restPushCommand");var jo=require("node:fs"),A4=require("node:crypto"),Ei=J(require("node:path"));var Ti=J(tt());var jie=a(async n=>{let e=await A4.webcrypto.subtle.digest("SHA-1",n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")},"nodeSha1"),$ie={parse:a(n=>Nt.load(n,{schema:Nt.CORE_SCHEMA}),"parse"),stringify:a(n=>Nt.dump(n,{schema:Nt.CORE_SCHEMA,lineWidth:-1}),"stringify")};function Uie(n,e){if(n.tokenFromGh===!0)return vi.resolveGhToken(e.ghTokenRunner);let t=e.env??process.env,r=n.token||t.GITHUB_TOKEN||t.GH_TOKEN||"";if(r.length===0)throw new Error("A GitHub token is required (private sync units read as 404 without one). Use --token-from-gh, --token <pat>, or set GITHUB_TOKEN / GH_TOKEN.");return r}a(Uie,"resolveToken");function Bie(n){let e=a(r=>Ei.join(n,r),"abs"),t=a(async(r,i)=>{let s;try{s=await jo.promises.readdir(r,{withFileTypes:!0})}catch{return}for(let o of s){let c=Ei.join(r,o.name);if(o.isDirectory()){if(o.name===".git")continue;await t(c,i)}else o.isFile()&&i.push(Ei.relative(n,c).split(Ei.sep).join("/"))}},"walk");return{async list(){let r=[];return(0,jo.existsSync)(n)&&await t(n,r),r},read:a(r=>jo.promises.readFile(e(r),"utf-8"),"read"),async readBinary(r){return new Uint8Array(await jo.promises.readFile(e(r)))},async write(){throw new Error("exosync-parity is read-only \u2014 write refused")},async delete(){throw new Error("exosync-parity is read-only \u2014 delete refused")}}}a(Bie,"nodeLocalFilesPort");function mA(n){let e=new dt(n),t=new Ti.SpaceSpecAccumulator;for(let r of e.getAllFiles()){let i=e.getFrontmatter(r);if(!i)continue;let s=(0,Ti.classifySpaceDeclaration)(i,r.path);if(s.kind==="not-space"||(s.warning!==void 0&&t.warnings.push(s.warning),s.kind==="skip"))continue;let o=t.offer(s.candidate);o!==null&&(0,jo.existsSync)(Ei.join(n,o.localPath))&&t.commit(s.candidate)}return{specs:t.specs,warnings:t.warnings}}a(mA,"collectVaultSpecs");function Vie(n,e){for(let t of n.repos){let r=t.headSha!==void 0?` @${t.headSha.slice(0,7)}`:"";e(`${t.repoKey}${r}: ${t.status} \u2014 ${t.inParity}/${t.filesChecked} in parity, M2 diffs ${t.m2SemanticDiffs}, accounted ${t.accountedCount}, M1 violations ${t.m1Violations.length}${t.attachmentHashSetIdentical!==void 0?`, attachment hash-set ${t.attachmentHashSetIdentical?"identical":"DIFFERS"}`:""}`),t.detail!==void 0&&e(` ${t.detail}`);for(let i of t.warnings)e(` warn: ${i}`);for(let i of t.discrepancies)e(` ${i.cls}: ${i.path}${i.detail!==void 0?` (${i.detail})`:""}`);for(let i of t.m1Violations)e(` M1 VIOLATION: ${i.path} \u2014 ${i.detail}`)}e((0,Ti.summarizeParityRound)(n))}a(Vie,"printHumanReport");async function Gie(n,e={}){let t=e.out??(y=>console.log(y)),r=Ei.resolve(n.vault);if(!(0,jo.existsSync)(r))throw new Error(`Vault path does not exist: ${r}`);let i=Uie(n,e),s=new vi({token:i,...n.apiBase!==void 0?{apiBase:n.apiBase}:{}}),o=e.transportFactory?.(i,n.apiBase)??s.transport(),{specs:c,warnings:l}=mA(r);for(let y of l)t(`warn: ${y}`);if(c.length===0)return t("Nothing to check \u2014 no materialized AssetSpaces with a GitHub source found in this vault."),2;let u=n.configDir??".obsidian",f=Ei.join(r,u,"plugins","exocortex",Ti.WATERMARK_STORE_FILENAME),d=new Ti.FileWatermarkStore({read:a(async()=>{try{return await jo.promises.readFile(f,"utf-8")}catch{return null}},"read"),writeAtomic:a(async()=>{throw new Error("exosync-parity: watermark access is read-only by contract")},"writeAtomic")}),h=new Ti.ParityValidator({transport:o,sha1:jie,localFilesFor:a(y=>Bie(Ei.join(r,y.localPath)),"localFilesFor"),watermarks:{get:a(y=>d.get(y),"get")},yaml:$ie,redact:a(y=>s.redact(y),"redact"),...n.apiBase!==void 0?{baseURL:n.apiBase}:{}});t(`ExoSync parity check: ${c.length} repo(s), vault ${r}`);let p=await h.runRound(c,{trigger:"standalone"});return n.json===!0?t(JSON.stringify(p,null,2)):Vie(p,t),p.vacuous?2:p.ok?0:1}a(Gie,"runExosyncParity");function I4(){return new Ae("exosync-parity").description("ExoSync M1/M2 parity report: compare materialized sync units against their remote heads (read-only; RFC 4e4dc453 Phase E)").requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--json","Print the full round record as JSON").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--api-base <url>","GitHub API base (testing)").action(async n=>{try{process.exitCode=await Gie(n)}catch(e){le.handle(e,{command:"exosync-parity"}),process.exitCode=1}})}a(I4,"exosyncParityCommand");var Dr=require("node:fs"),R4=require("node:crypto"),xn=J(require("node:path"));var Fr=J(tt());var x4=a(async n=>{let e=await R4.webcrypto.subtle.digest("SHA-1",n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")},"nodeSha1"),qie={parse:a(n=>Nt.load(n,{schema:Nt.CORE_SCHEMA}),"parse"),stringify:a(n=>Nt.dump(n,{schema:Nt.CORE_SCHEMA,lineWidth:-1}),"stringify")};function Wie(n,e){if(n.tokenFromGh===!0)return vi.resolveGhToken(e.ghTokenRunner);let t=e.env??process.env,r=n.token||t.GITHUB_TOKEN||t.GH_TOKEN||"";if(r.length===0)throw new Error("A GitHub token is required (private sync units read as 404 and push needs write scope). Use --token-from-gh, --token <pat>, or set GITHUB_TOKEN / GH_TOKEN.");return r}a(Wie,"resolveToken");function zie(n){let e=/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(n.trim());if(e===null)throw new Error(`Invalid quarantine repo URL (expected https://github.com/<owner>/<repo>): ${n}`);return{owner:e[1],repo:e[2]}}a(zie,"parseGitHubRepoUrl");function Hie(n){let e=a(i=>xn.join(n,i),"abs"),t=a(async(i,s)=>{let o;try{o=await Dr.promises.readdir(i,{withFileTypes:!0})}catch{return}for(let c of o){let l=xn.join(i,c.name);if(c.isDirectory()){if(c.name===".git")continue;await t(l,s)}else c.isFile()&&s.push(xn.relative(n,l).split(xn.sep).join("/"))}},"walk"),r=a(async(i,s)=>{let o=xn.dirname(i);await Dr.promises.mkdir(o,{recursive:!0});let c=`${i}.local.tmp`;await s(c),await Dr.promises.rename(c,i)},"writeAtomic");return{async list(){let i=[];return(0,Dr.existsSync)(n)&&await t(n,i),i},read:a(i=>Dr.promises.readFile(e(i),"utf-8"),"read"),async write(i,s){await r(e(i),o=>Dr.promises.writeFile(o,s,"utf-8"))},async delete(i){await Dr.promises.rm(e(i),{force:!0})},async readBinary(i){return new Uint8Array(await Dr.promises.readFile(e(i)))},async writeBinary(i,s){let o=s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);await r(e(i),c=>Dr.promises.writeFile(c,Buffer.from(o)))}}}a(Hie,"nodeLocalFilesPort");function Kie(n){return{async read(){try{return await Dr.promises.readFile(n,"utf-8")}catch{return null}},async writeAtomic(e){await Dr.promises.mkdir(xn.dirname(n),{recursive:!0});let t=`${n}.local.tmp`;await Dr.promises.writeFile(t,e,"utf-8"),await Dr.promises.rename(t,n)}}}a(Kie,"nodeWatermarkFileIO");function Qie(n){return{async check(e){let t=xn.join(n,e.localPath);if(!(0,Dr.existsSync)(t))return{fullyMaterialized:!1,reason:`mount folder ${e.localPath} does not exist`};let r=0;try{r=(await Dr.promises.readdir(t)).length}catch{return{fullyMaterialized:!1,reason:`mount folder ${e.localPath} is not readable`}}return r===0&&e.spaceKind!=="file"?{fullyMaterialized:!1,reason:`mount folder ${e.localPath} is empty (mid-mount?)`}:{fullyMaterialized:!0}}}}a(Qie,"nodeMaterializationCheck");function Xie(n,e){let t=n.pushedSha!==void 0?` \u2192@${n.pushedSha.slice(0,7)}`:"";e(`${n.repoKey}${t}: ${n.status} \u2014 pulled ${n.pulledCount}, pushed ${n.pushedCount}, merged ${n.mergedCount}, quarantined ${n.quarantinedCount}${(n.pushedDeletes?.length??0)>0?`, deleted ${n.pushedDeletes.length}`:""}`),n.detail!==void 0&&e(` ${n.detail}`);for(let r of n.warnings)e(` warn: ${r}`);(n.deferredPaths?.length??0)>0&&e(` deferred (\u2192 full sync): ${n.deferredPaths.join(", ")}`),(n.deferredDeletes?.length??0)>0&&e(` deferred deletes: ${n.deferredDeletes.join(", ")}`)}a(Xie,"printRepoResult");function Yie(n){return n==="conflict"||n==="full-conflict"||n==="retry-exhausted"||n==="busy"||n==="auth-required"||n==="error"}a(Yie,"isFailureStatus");async function Jie(n,e,t={}){let r=t.out??(_=>console.log(_)),i=xn.resolve(e.vault);if(!(0,Dr.existsSync)(i))throw new Error(`Vault path does not exist: ${i}`);let s=Wie(e,t),o=new vi({token:s,...e.apiBase!==void 0?{apiBase:e.apiBase}:{}}),c=t.transportFactory?.(s,e.apiBase)??o.transport(),{specs:l,warnings:u}=mA(i);for(let _ of u)r(`warn: ${_}`);if(l.length===0)return r("Nothing to sync \u2014 no materialized AssetSpaces with a GitHub source found in this vault."),2;let f=e.configDir??".obsidian",d=xn.join(i,f,"plugins","exocortex",Fr.WATERMARK_STORE_FILENAME),h,p=e.quarantineRepo?.trim()??"";if(p.length>0){let{owner:_,repo:S}=zie(p);h=new Fr.SyncedQuarantineStore({transport:(0,Fr.withRateLimitBackoff)(c),sha1:x4,owner:_,repo:S,branch:Fr.SYNC_BRANCH,redact:a(T=>o.redact(T),"redact")})}let y=new Fr.SyncEngine({transport:c,watermarkStore:new Fr.FileWatermarkStore(Kie(d)),materializationCheck:Qie(i),localFilesFor:a(_=>Hie(xn.join(i,_.localPath)),"localFilesFor"),sha1:x4,redact:a(_=>o.redact(_),"redact"),commitMessage:a((_,S,T=0)=>`exosync: ${S} change(s)${T>0?`, ${T} deletion(s)`:""} (CLI)`,"commitMessage"),mergeLayer:new Fr.GatedStructuredMerger(new Fr.StructuredMerger(qie)),...h!==void 0?{quarantine:h}:{},...e.apiBase!==void 0?{baseURL:e.apiBase}:{}});r(`ExoSync ${n}: ${l.length} repo(s), vault ${i}${h!==void 0?" (quarantine configured)":""}`);let g=(0,Fr.orderChildrenFirst)(l),v=await y.syncAll(g,n);if(e.json===!0)r(JSON.stringify(v,null,2));else{for(let S of v)Xie(S,r);let _=v.reduce((S,T)=>({pulled:S.pulled+T.pulledCount,pushed:S.pushed+T.pushedCount,merged:S.merged+T.mergedCount,quarantined:S.quarantined+T.quarantinedCount}),{pulled:0,pushed:0,merged:0,quarantined:0});r(`Summary: ${v.length} repo(s) \u2014 pulled ${_.pulled}, pushed ${_.pushed}, merged ${_.merged}, quarantined ${_.quarantined}`)}return v.some(_=>Yie(_.status))?1:0}a(Jie,"runExosyncSync");function gA(n){return n.requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--quarantine-repo <url>","Quarantine repo URL (https://github.com/<owner>/<repo>) \u2014 required for FileSpaces").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--json","Print the full per-repo result array as JSON").option("--api-base <url>","GitHub API base (testing)")}a(gA,"withSyncOptions");function yA(n){return async e=>{try{process.exitCode=await Jie(n,e)}catch(t){le.handle(t,{command:`exosync ${n}`}),process.exitCode=1}}}a(yA,"makeDirectionAction");function P4(){let n=new Ae("exosync").description("ExoSync over the GitHub REST API: sync/pull/push the materialized AssetSpace set (CLI parity with the plugin; RFC 4e4dc453 Phase B). Read-only divergence check: `exosync-parity`.");return gA(n.command("sync").description("Full pull\u2192merge\u2192push cycle for every materialized repo")).action(yA("sync")),gA(n.command("pull").description("Apply remote changes only (nothing leaves the device; local changes re-derive)")).action(yA("pull")),gA(n.command("push").description("Send the local delta only (remote changes are pinned to re-derive on the next pull/sync)")).action(yA("push")),n}a(P4,"exosyncCommand");function C4(n){let e=new Ae;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.96.13"),e.addCommand(LM()),e.addCommand(qM()),e.addCommand(Ik()),e.addCommand(Pk()),e.addCommand(iM()),e.addCommand(Fk()),e.addCommand(Lk()),e.addCommand($k()),e.addCommand(aM()),e.addCommand(gM()),e.addCommand(bM()),e.addCommand(EM()),e.addCommand(FM()),e.addCommand(s4()),e.addCommand(f4()),e.addCommand(d4()),e.addCommand(m4()),e.addCommand(_4()),e.addCommand(T4()),e.addCommand(I4()),e.addCommand(P4()),e}a(C4,"createProgram");C4().parse();0&&(module.exports={createProgram});
778
+ `)),process.exit(0)}catch(e){let t=e instanceof Error?e:new Error(String(e)),r=new vi;t.message=r.redact(t.message),t.stack&&(t.stack=r.redact(t.stack)),le.handle(t)}})}a(Mie,"restPushCommand");var jo=require("node:fs"),A4=require("node:crypto"),Ei=J(require("node:path"));var Ti=J(tt());var jie=a(async n=>{let e=await A4.webcrypto.subtle.digest("SHA-1",n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")},"nodeSha1"),$ie={parse:a(n=>Nt.load(n,{schema:Nt.CORE_SCHEMA}),"parse"),stringify:a(n=>Nt.dump(n,{schema:Nt.CORE_SCHEMA,lineWidth:-1}),"stringify")};function Uie(n,e){if(n.tokenFromGh===!0)return vi.resolveGhToken(e.ghTokenRunner);let t=e.env??process.env,r=n.token||t.GITHUB_TOKEN||t.GH_TOKEN||"";if(r.length===0)throw new Error("A GitHub token is required (private sync units read as 404 without one). Use --token-from-gh, --token <pat>, or set GITHUB_TOKEN / GH_TOKEN.");return r}a(Uie,"resolveToken");function Bie(n){let e=a(r=>Ei.join(n,r),"abs"),t=a(async(r,i)=>{let s;try{s=await jo.promises.readdir(r,{withFileTypes:!0})}catch{return}for(let o of s){let c=Ei.join(r,o.name);if(o.isDirectory()){if(o.name===".git")continue;await t(c,i)}else o.isFile()&&i.push(Ei.relative(n,c).split(Ei.sep).join("/"))}},"walk");return{async list(){let r=[];return(0,jo.existsSync)(n)&&await t(n,r),r},read:a(r=>jo.promises.readFile(e(r),"utf-8"),"read"),async readBinary(r){return new Uint8Array(await jo.promises.readFile(e(r)))},async write(){throw new Error("exosync-parity is read-only \u2014 write refused")},async delete(){throw new Error("exosync-parity is read-only \u2014 delete refused")}}}a(Bie,"nodeLocalFilesPort");function mA(n){let e=new dt(n),t=new Ti.SpaceSpecAccumulator;for(let r of e.getAllFiles()){let i=e.getFrontmatter(r);if(!i)continue;let s=(0,Ti.classifySpaceDeclaration)(i,r.path);if(s.kind==="not-space"||(s.warning!==void 0&&t.warnings.push(s.warning),s.kind==="skip"))continue;let o=t.offer(s.candidate);o!==null&&(0,jo.existsSync)(Ei.join(n,o.localPath))&&t.commit(s.candidate)}return{specs:t.specs,warnings:t.warnings}}a(mA,"collectVaultSpecs");function Vie(n,e){for(let t of n.repos){let r=t.headSha!==void 0?` @${t.headSha.slice(0,7)}`:"";e(`${t.repoKey}${r}: ${t.status} \u2014 ${t.inParity}/${t.filesChecked} in parity, M2 diffs ${t.m2SemanticDiffs}, accounted ${t.accountedCount}, M1 violations ${t.m1Violations.length}${t.attachmentHashSetIdentical!==void 0?`, attachment hash-set ${t.attachmentHashSetIdentical?"identical":"DIFFERS"}`:""}`),t.detail!==void 0&&e(` ${t.detail}`);for(let i of t.warnings)e(` warn: ${i}`);for(let i of t.discrepancies)e(` ${i.cls}: ${i.path}${i.detail!==void 0?` (${i.detail})`:""}`);for(let i of t.m1Violations)e(` M1 VIOLATION: ${i.path} \u2014 ${i.detail}`)}e((0,Ti.summarizeParityRound)(n))}a(Vie,"printHumanReport");async function Gie(n,e={}){let t=e.out??(y=>console.log(y)),r=Ei.resolve(n.vault);if(!(0,jo.existsSync)(r))throw new Error(`Vault path does not exist: ${r}`);let i=Uie(n,e),s=new vi({token:i,...n.apiBase!==void 0?{apiBase:n.apiBase}:{}}),o=e.transportFactory?.(i,n.apiBase)??s.transport(),{specs:c,warnings:l}=mA(r);for(let y of l)t(`warn: ${y}`);if(c.length===0)return t("Nothing to check \u2014 no materialized AssetSpaces with a GitHub source found in this vault."),2;let u=n.configDir??".obsidian",f=Ei.join(r,u,"plugins","exocortex",Ti.WATERMARK_STORE_FILENAME),d=new Ti.FileWatermarkStore({read:a(async()=>{try{return await jo.promises.readFile(f,"utf-8")}catch{return null}},"read"),writeAtomic:a(async()=>{throw new Error("exosync-parity: watermark access is read-only by contract")},"writeAtomic")}),h=new Ti.ParityValidator({transport:o,sha1:jie,localFilesFor:a(y=>Bie(Ei.join(r,y.localPath)),"localFilesFor"),watermarks:{get:a(y=>d.get(y),"get")},yaml:$ie,redact:a(y=>s.redact(y),"redact"),...n.apiBase!==void 0?{baseURL:n.apiBase}:{}});t(`ExoSync parity check: ${c.length} repo(s), vault ${r}`);let p=await h.runRound(c,{trigger:"standalone"});return n.json===!0?t(JSON.stringify(p,null,2)):Vie(p,t),p.vacuous?2:p.ok?0:1}a(Gie,"runExosyncParity");function I4(){return new Ae("exosync-parity").description("ExoSync M1/M2 parity report: compare materialized sync units against their remote heads (read-only; RFC 4e4dc453 Phase E)").requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--json","Print the full round record as JSON").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--api-base <url>","GitHub API base (testing)").action(async n=>{try{process.exitCode=await Gie(n)}catch(e){le.handle(e,{command:"exosync-parity"}),process.exitCode=1}})}a(I4,"exosyncParityCommand");var Dr=require("node:fs"),R4=require("node:crypto"),xn=J(require("node:path"));var Fr=J(tt());var x4=a(async n=>{let e=await R4.webcrypto.subtle.digest("SHA-1",n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength));return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")},"nodeSha1"),qie={parse:a(n=>Nt.load(n,{schema:Nt.CORE_SCHEMA}),"parse"),stringify:a(n=>Nt.dump(n,{schema:Nt.CORE_SCHEMA,lineWidth:-1}),"stringify")};function Wie(n,e){if(n.tokenFromGh===!0)return vi.resolveGhToken(e.ghTokenRunner);let t=e.env??process.env,r=n.token||t.GITHUB_TOKEN||t.GH_TOKEN||"";if(r.length===0)throw new Error("A GitHub token is required (private sync units read as 404 and push needs write scope). Use --token-from-gh, --token <pat>, or set GITHUB_TOKEN / GH_TOKEN.");return r}a(Wie,"resolveToken");function zie(n){let e=/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(n.trim());if(e===null)throw new Error(`Invalid quarantine repo URL (expected https://github.com/<owner>/<repo>): ${n}`);return{owner:e[1],repo:e[2]}}a(zie,"parseGitHubRepoUrl");function Hie(n){let e=a(i=>xn.join(n,i),"abs"),t=a(async(i,s)=>{let o;try{o=await Dr.promises.readdir(i,{withFileTypes:!0})}catch{return}for(let c of o){let l=xn.join(i,c.name);if(c.isDirectory()){if(c.name===".git")continue;await t(l,s)}else c.isFile()&&s.push(xn.relative(n,l).split(xn.sep).join("/"))}},"walk"),r=a(async(i,s)=>{let o=xn.dirname(i);await Dr.promises.mkdir(o,{recursive:!0});let c=`${i}.local.tmp`;await s(c),await Dr.promises.rename(c,i)},"writeAtomic");return{async list(){let i=[];return(0,Dr.existsSync)(n)&&await t(n,i),i},read:a(i=>Dr.promises.readFile(e(i),"utf-8"),"read"),async write(i,s){await r(e(i),o=>Dr.promises.writeFile(o,s,"utf-8"))},async delete(i){await Dr.promises.rm(e(i),{force:!0})},async readBinary(i){return new Uint8Array(await Dr.promises.readFile(e(i)))},async writeBinary(i,s){let o=s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);await r(e(i),c=>Dr.promises.writeFile(c,Buffer.from(o)))}}}a(Hie,"nodeLocalFilesPort");function Kie(n){return{async read(){try{return await Dr.promises.readFile(n,"utf-8")}catch{return null}},async writeAtomic(e){await Dr.promises.mkdir(xn.dirname(n),{recursive:!0});let t=`${n}.local.tmp`;await Dr.promises.writeFile(t,e,"utf-8"),await Dr.promises.rename(t,n)}}}a(Kie,"nodeWatermarkFileIO");function Qie(n){return{async check(e){let t=xn.join(n,e.localPath);if(!(0,Dr.existsSync)(t))return{fullyMaterialized:!1,reason:`mount folder ${e.localPath} does not exist`};let r=0;try{r=(await Dr.promises.readdir(t)).length}catch{return{fullyMaterialized:!1,reason:`mount folder ${e.localPath} is not readable`}}return r===0&&e.spaceKind!=="file"?{fullyMaterialized:!1,reason:`mount folder ${e.localPath} is empty (mid-mount?)`}:{fullyMaterialized:!0}}}}a(Qie,"nodeMaterializationCheck");function Xie(n,e){let t=n.pushedSha!==void 0?` \u2192@${n.pushedSha.slice(0,7)}`:"";e(`${n.repoKey}${t}: ${n.status} \u2014 pulled ${n.pulledCount}, pushed ${n.pushedCount}, merged ${n.mergedCount}, quarantined ${n.quarantinedCount}${(n.pushedDeletes?.length??0)>0?`, deleted ${n.pushedDeletes.length}`:""}`),n.detail!==void 0&&e(` ${n.detail}`);for(let r of n.warnings)e(` warn: ${r}`);(n.deferredPaths?.length??0)>0&&e(` deferred (\u2192 full sync): ${n.deferredPaths.join(", ")}`),(n.deferredDeletes?.length??0)>0&&e(` deferred deletes: ${n.deferredDeletes.join(", ")}`)}a(Xie,"printRepoResult");function Yie(n){return n==="conflict"||n==="full-conflict"||n==="retry-exhausted"||n==="busy"||n==="auth-required"||n==="error"}a(Yie,"isFailureStatus");async function Jie(n,e,t={}){let r=t.out??(_=>console.log(_)),i=xn.resolve(e.vault);if(!(0,Dr.existsSync)(i))throw new Error(`Vault path does not exist: ${i}`);let s=Wie(e,t),o=new vi({token:s,...e.apiBase!==void 0?{apiBase:e.apiBase}:{}}),c=t.transportFactory?.(s,e.apiBase)??o.transport(),{specs:l,warnings:u}=mA(i);for(let _ of u)r(`warn: ${_}`);if(l.length===0)return r("Nothing to sync \u2014 no materialized AssetSpaces with a GitHub source found in this vault."),2;let f=e.configDir??".obsidian",d=xn.join(i,f,"plugins","exocortex",Fr.WATERMARK_STORE_FILENAME),h,p=e.quarantineRepo?.trim()??"";if(p.length>0){let{owner:_,repo:S}=zie(p);h=new Fr.SyncedQuarantineStore({transport:(0,Fr.withRateLimitBackoff)(c),sha1:x4,owner:_,repo:S,branch:Fr.SYNC_BRANCH,redact:a(T=>o.redact(T),"redact")})}let y=new Fr.SyncEngine({transport:c,watermarkStore:new Fr.FileWatermarkStore(Kie(d)),materializationCheck:Qie(i),localFilesFor:a(_=>Hie(xn.join(i,_.localPath)),"localFilesFor"),sha1:x4,redact:a(_=>o.redact(_),"redact"),commitMessage:a((_,S,T=0)=>`exosync: ${S} change(s)${T>0?`, ${T} deletion(s)`:""} (CLI)`,"commitMessage"),mergeLayer:new Fr.GatedStructuredMerger(new Fr.StructuredMerger(qie)),...h!==void 0?{quarantine:h}:{},...e.apiBase!==void 0?{baseURL:e.apiBase}:{}});r(`ExoSync ${n}: ${l.length} repo(s), vault ${i}${h!==void 0?" (quarantine configured)":""}`);let g=(0,Fr.orderChildrenFirst)(l),v=await y.syncAll(g,n);if(e.json===!0)r(JSON.stringify(v,null,2));else{for(let S of v)Xie(S,r);let _=v.reduce((S,T)=>({pulled:S.pulled+T.pulledCount,pushed:S.pushed+T.pushedCount,merged:S.merged+T.mergedCount,quarantined:S.quarantined+T.quarantinedCount}),{pulled:0,pushed:0,merged:0,quarantined:0});r(`Summary: ${v.length} repo(s) \u2014 pulled ${_.pulled}, pushed ${_.pushed}, merged ${_.merged}, quarantined ${_.quarantined}`)}return v.some(_=>Yie(_.status))?1:0}a(Jie,"runExosyncSync");function gA(n){return n.requiredOption("--vault <path>","Vault root path").option("--config-dir <name>","Obsidian config dir name (watermark location)",".obsidian").option("--quarantine-repo <url>","Quarantine repo URL (https://github.com/<owner>/<repo>) \u2014 required for FileSpaces").option("--token <pat>","GitHub PAT (or env GITHUB_TOKEN / GH_TOKEN). Prefer --token-from-gh.").option("--token-from-gh","Resolve the PAT via `gh auth token`").option("--json","Print the full per-repo result array as JSON").option("--api-base <url>","GitHub API base (testing)")}a(gA,"withSyncOptions");function yA(n){return async e=>{try{process.exitCode=await Jie(n,e)}catch(t){le.handle(t,{command:`exosync ${n}`}),process.exitCode=1}}}a(yA,"makeDirectionAction");function P4(){let n=new Ae("exosync").description("ExoSync over the GitHub REST API: sync/pull/push the materialized AssetSpace set (CLI parity with the plugin; RFC 4e4dc453 Phase B). Read-only divergence check: `exosync-parity`.");return gA(n.command("sync").description("Full pull\u2192merge\u2192push cycle for every materialized repo")).action(yA("sync")),gA(n.command("pull").description("Apply remote changes only (nothing leaves the device; local changes re-derive)")).action(yA("pull")),gA(n.command("push").description("Send the local delta only (remote changes are pinned to re-derive on the next pull/sync)")).action(yA("push")),n}a(P4,"exosyncCommand");function C4(n){let e=new Ae;return e.name("exocortex").description("CLI tool for Exocortex knowledge management system").version(n??"16.96.15"),e.addCommand(LM()),e.addCommand(qM()),e.addCommand(Ik()),e.addCommand(Pk()),e.addCommand(iM()),e.addCommand(Fk()),e.addCommand(Lk()),e.addCommand($k()),e.addCommand(aM()),e.addCommand(gM()),e.addCommand(bM()),e.addCommand(EM()),e.addCommand(FM()),e.addCommand(s4()),e.addCommand(f4()),e.addCommand(d4()),e.addCommand(m4()),e.addCommand(_4()),e.addCommand(T4()),e.addCommand(I4()),e.addCommand(P4()),e}a(C4,"createProgram");C4().parse();0&&(module.exports={createProgram});
779
779
  /*! Bundled license information:
780
780
 
781
781
  reflect-metadata/Reflect.js: