@aventusjs/cli 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/RealInteraction.js +1 -1
- package/out/RealServer.js +1 -1
- package/out/cli.js +1 -1
- package/package.json +4 -1
package/out/RealServer.js
CHANGED
|
@@ -302,7 +302,7 @@ var callSiteToString=__webpack_require__(11567).callSiteToString,eventListenerCo
|
|
|
302
302
|
* toidentifier
|
|
303
303
|
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
304
304
|
* MIT Licensed
|
|
305
|
-
*/e.exports=function(e){return e.split(" ").map((function(e){return e.slice(0,1).toUpperCase()+e.slice(1)})).join("").replace(/[^ _0-9a-z]/gi,"")}},24964:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GenericServer=void 0;const r=n(83693),i=n(71743),s=n(19490),a=n(40529),o=n(29495),l=n(19408),c=n(32377),u=n(53784),p=n(71017),_=n(46492),d=n(5441),h=n(2741);class f{static instance;static delayBetweenBuild(){return this.instance.connection.delayBetweenBuild()}static isDebug(){return this.instance.isDebug}static get isIDE(){return this.instance.isIDE}static sendNotification(e,...t){this.instance.connection.sendNotification(e,t)}static showErrorMessage(e){this.instance.connection.showErrorMessage(e)}static showWarningMessage(e){this.instance.connection.showWarningMessage(e)}static showInformationMessage(e){this.instance.connection.showInformationMessage(e)}static sendDiagnostics(e,t){this.instance.connection.sendDiagnostics(e,t?.buildConfig.name)}static Input(e){return this.instance.connection.Input(e)}static Select(e,t){return this.instance.connection.Select(e,t)}static SelectMultiple(e,t){return this.instance.connection.SelectMultiple(e,t)}static SelectFolder(e,t){return this.instance.connection.SelectFolder(e,t)}static Popup(e,...t){return this.instance.connection.Popup(e,...t)}static get savePath(){return this.instance._savePath}static get extensionPath(){return this.instance._extensionPath}static getWorkspaceUri(){return this.instance.workspaces[0]??""}static get templateManager(){return this.instance._template}static get localTemplateManager(){return this.instance._localTemplate}static refreshSettings(){return this.instance.loadSettings()}connection;isLoading=!0;workspaces=[];isDebug=!1;isIDE=!1;_savePath="";_extensionPath="";_template;_localTemplate;constructor(e){this.connection=e,this.bindEvent()}start(){f.instance=this,this.connection.open()}bindEvent(){this.connection.onInitialize((e=>{this.onInitialize(e)})),this.connection.onInitialized((async()=>{this.onInitialized()})),this.connection.onShutdown((async()=>{await this.onShutdown()})),this.connection.onCompletion((async(e,t)=>await this.onCompletion(e,t))),this.connection.onCompletionResolve((async(e,t)=>await this.onCompletionResolve(e,t))),this.connection.onHover((async(e,t)=>await this.onHover(e,t))),this.connection.onDefinition((async(e,t)=>await this.onDefinition(e,t))),this.connection.onDocumentFormatting((async(e,t)=>await this.onDocumentFormatting(e,t))),this.connection.onCodeAction((async(e,t)=>await this.onCodeAction(e,t))),this.connection.onCodeLens((async e=>await this.onCodeLens(e))),this.connection.onReferences((async(e,t)=>await this.onReferences(e,t))),this.connection.onRenameRequest((async(e,t,n)=>await this.onRenameRequest(e,t,n))),this.connection.onDocumentColor((async e=>await this.onDocumentColor(e))),this.connection.onColorPresentation((async(e,t,n)=>await this.onColorPresentation(e,t,n))),this.connection.onExecuteCommand((async e=>await this.onExecuteCommand(e))),this.connection.onDidChangeConfiguration((async()=>await this.onDidChangeConfiguration()))}onInitialize(e){if(e.workspaceFolders)for(let t of e.workspaceFolders)this.workspaces.push(t.uri);if(!e.savePath){let t=process.env.APPDATA||("darwin"==process.platform?process.env.HOME+"/Library/Preferences":process.env.HOME+"/.local/share");e.savePath=(0,p.join)(t,"aventus")}this.isIDE=e.isIDE,this._savePath=e.savePath,this._extensionPath=e.extensionPath,this._template=new d.TemplateManager,this._localTemplate=new _.LocalTemplateManager(this._template)}async onInitialized(){await this.loadSettings(),await this.startServer()}async onShutdown(){await i.FilesWatcher.getInstance().destroy(),a.ProjectManager.getInstance().destroyAll(),s.TemplateManager.getInstance().destroy(),h.CSharpManager.getInstance().destroy(),await r.FilesManager.getInstance().onShutdown()}async onCompletion(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCompletion(e,t):null}async onCompletionResolve(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCompletionResolve(e,t):t}async onHover(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onHover(e,t):null}async onDefinition(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onDefinition(e,t):null}async onDocumentFormatting(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onFormatting(e,t):null}async onCodeAction(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCodeAction(e,t):null}async onCodeLens(e){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCodeLens(e):null}async onReferences(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onReferences(e,t):null}async onRenameRequest(e,t,n){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onRename(e,t,n):null}async onDocumentColor(e){return e&&this.isStyleDocument(e)?c.ColorPicker.onDocumentColor(e):null}async onColorPresentation(e,t,n){return e&&this.isStyleDocument(e)?c.ColorPicker.onColorPresentations(e,t,n):null}async onExecuteCommand(e){u.Commands.execute(e)}async onDidChangeConfiguration(){this.loadSettings()}isAllowed(e){return f.isAllowed(e)}static isAllowed(e){return!this.instance.isLoading&&!(!e.uri.endsWith(l.AventusExtension.Base)&&!e.uri.endsWith(l.AventusExtension.Config))}isStyleDocument(e){return!!e.uri.endsWith(l.AventusExtension.ComponentStyle)||(!!e.uri.endsWith(l.AventusExtension.Component)||!!e.uri.endsWith(l.AventusExtension.GlobalStyle))}async loadSettings(){let e=await this.connection.getSettings();e||(e={}),o.SettingsManager.getInstance().setSettings(e),this.isDebug=o.SettingsManager.getInstance().settings.debug}async startServer(){const e=o.SettingsManager.getInstance().settings;e.onlyBuild||(s.TemplateManager.getInstance(),h.CSharpManager.getInstance()),a.ProjectManager.getInstance(),e.onlyBuild?e.configPath?await r.FilesManager.getInstance().loadConfigFile(e.configPath,e.builds,e.statics):await r.FilesManager.getInstance().loadConfigFileNotSet(this.workspaces,e.builds,e.statics):await r.FilesManager.getInstance().loadAllAventusFiles(this.workspaces),this.isLoading=!1,this.isDebug&&console.log("start server done")}}t.GenericServer=f},25655:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddConfigSection=void 0;const r=n(57147),i=n(49404),s=n(1539),a=n(24964),o=n(40529);t.AddConfigSection=class{static cmd="aventus.addConfigSection";static async run(e){try{if(!e){let t=[],n=o.ProjectManager.getInstance().getAllConfigFiles();for(let e of n)t.push({label:e});let r=await a.GenericServer.Select(t,{placeHolder:"Project to compile"});if(!r)return;e=r.label}const t=await a.GenericServer.Input({title:"Provide a name for your config section"});if(!t)return;let n=(0,r.readFileSync)((0,s.uriToPath)(e),"utf8"),l=JSON.parse(n),c=t.replace(/ /g,"-"),u={name:t,inputPath:[],outputFile:"./dist/"+c+".js"};l.build.push(u),(0,r.writeFileSync)((0,s.uriToPath)(e),JSON.stringify(l,null,4)),i.OpenFile.send(e)}catch(e){console.error(e)}}}},11932:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BuildProject=void 0;const r=n(40529),i=n(24964);t.BuildProject=class{static cmd="aventus.compile";static async run(){let e=[],t=r.ProjectManager.getInstance().getAllBuilds();for(let n of t)e.push({label:n.name,detail:n.uri});let n=await i.GenericServer.Select(e,{placeHolder:"Project to compile"});if(n){let e=n.detail??"",t=n.label;r.ProjectManager.getInstance().getProjectByUri(e)?.getBuild(t)?.build()}}}},15993:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Create=void 0;const r=n(1539),i=n(40529),s=n(24964),a=n(71017);class o{static cmd="aventus.create";static async run(e){if(!e)return;let t=(0,a.normalize)((0,r.uriToPath)(e));if(o.checkIfProject(e)){if(!s.GenericServer.isIDE){let n=await s.GenericServer.SelectFolder("Select where to create",t);if(!n)return;e=n,t=(0,r.uriToPath)(e)}await(s.GenericServer.localTemplateManager?.createTemplate(t))}else{await s.GenericServer.Select([{label:"Init",detail:"Create a project"}],{placeHolder:"What do you want to create?"})&&await(s.GenericServer.templateManager?.createProject(t))}}static checkIfProject(e){let t=i.ProjectManager.getInstance().getAllConfigFiles(),n=e.replace(/\\/g,"/");for(let e of t)if(n.startsWith(e.replace("/aventus.conf.avt","")))return!0;return!1}}t.Create=o},35614:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MergeComponent=void 0;const r=n(18952),i=n(57147),s=n(19408),a=n(83693),o=n(64945),l=n(49404),c=n(1539);function u(e){return e.split("\n").join("\n\t")}t.MergeComponent=class{static cmd="aventus.component.merge";static async run(e){if(!e)return;let t=new RegExp("("+s.AventusExtension.ComponentLogic+")|("+s.AventusExtension.ComponentView+")|("+s.AventusExtension.ComponentView+")$"),n=e.replace(t,""),p=n.split("/"),_=p.pop(),d=p.pop(),h=p.join("/")+"/"+_,f=0,m=a.FilesManager.getInstance().getByUri(n+s.AventusExtension.ComponentLogic);m&&m.versionUser>f&&(f=m.versionUser);let g=m?m.contentUser:"",y=a.FilesManager.getInstance().getByUri(n+s.AventusExtension.ComponentStyle);y&&y.versionUser>f&&(f=y.versionUser);let v=y?y.contentUser:"",$=a.FilesManager.getInstance().getByUri(n+s.AventusExtension.ComponentView);$&&$.versionUser>f&&(f=$.versionUser);let b=$?$.contentUser:"",S=`\n<script>\n\t${u(g)}\n<\/script>\n\n<template>\n\t${u(b)}\n</template>\n\n<style>\n\t${u(v)}\n</style>\n`,x=r.TextDocument.create(h+s.AventusExtension.Component,s.AventusLanguageId.WebComponent,f+1,S);(0,i.writeFileSync)((0,c.uriToPath)(x.uri),S),y&&((0,i.unlinkSync)(y.path),a.FilesManager.getInstance().onClose(y.documentUser),o.CloseFile.send(y.uri)),m&&((0,i.unlinkSync)(m.path),a.FilesManager.getInstance().onClose(m.documentUser),o.CloseFile.send(m.uri)),$&&((0,i.unlinkSync)($.path),a.FilesManager.getInstance().onClose($.documentUser),o.CloseFile.send($.uri)),(0,i.rmdirSync)((0,c.uriToPath)(p.join("/")+"/"+d)),a.FilesManager.getInstance().registerFile(x),l.OpenFile.send(x.uri)}}},20079:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PopupResponse=void 0;const r=n(43438);t.PopupResponse=class{static cmd="aventus.popupresponse";static run(e,t){r.Popup.resolve(e,t)}}},67687:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveInput=void 0;const r=n(93401);t.ReceiveInput=class{static cmd="aventus.receiveinput";static run(e,t){r.AskInput.resolve(e,t)}}},811:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveSelect=void 0;const r=n(64961);t.ReceiveSelect=class{static cmd="aventus.receiveselect";static run(e,t){r.AskSelect.resolve(e,t)}}},70140:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveSelectMultiple=void 0;const r=n(39567);t.ReceiveSelectMultiple=class{static cmd="aventus.receiveselectmultiple";static run(e,t){r.AskSelectMultiple.resolve(e,t)}}},17519:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReloadSettings=void 0;const r=n(24964);t.ReloadSettings=class{static cmd="aventus.reloadSettings";static async run(){r.GenericServer.refreshSettings()}}},88933:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rename=void 0;const r=n(1539),i=n(57147),s=n(71017),a=n(40529),o=n(29495),l=n(83693);t.Rename=class{static cmd="aventus.rename";static async run(e){if(!o.SettingsManager.getInstance().settings.updateImportOnRename)return;if(!e)return;let t=[];for(let n of e){let e,a=n.newUri,o=n.oldUri,l=(0,r.uriToPath)(a),c=(0,r.uriToPath)(o),u=!0;if((0,i.existsSync)(l)?e=l:(u=!1,e=c),(0,i.statSync)(e).isDirectory()){const n=e=>{let l=(0,i.readdirSync)(e);for(let c of l){let l=(0,s.join)(e,c);if((0,i.statSync)(l).isDirectory())n(l);else{let e=(0,r.pathToUri)(l);u?t.push({newUri:e,oldUri:e.replace(a,o)}):t.push({newUri:e.replace(o,a),oldUri:e})}}};n(e)}else t.push({oldUri:o,newUri:a})}let n=await a.ProjectManager.getInstance().onRename(t),c={},u=l.FilesManager.getInstance();for(let e in n){let t=u.getByUri(e);t&&(await t.applyTextEdits(n[e]),c[(0,r.uriToPath)(t.uri)]=t.contentUser)}setTimeout((()=>{for(let e in c)(0,i.writeFileSync)(e,c[e])}),500)}}},79993:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SplitComponent=void 0;const r=n(57147),i=n(18952),s=n(19408),a=n(83693),o=n(22163),l=n(64945),c=n(49404),u=n(1539);t.SplitComponent=class{static cmd="aventus.component.split";static async run(e){if(!e)return;let t=e.split("/").pop()?.replace(s.AventusExtension.Component,""),n=a.FilesManager.getInstance().getByUri(e);if(n){let p=(0,u.uriToPath)(e.replace(s.AventusExtension.Component,""));(0,r.existsSync)(p)||(0,r.mkdirSync)(p);const _=e.replace(s.AventusExtension.Component,"")+"/"+t;let d=o.AventusWebComponentSingleFile.getRegion(n),h=_+s.AventusExtension.ComponentStyle,f=i.TextDocument.create(h,s.AventusLanguageId.SCSS,n.versionUser+1,d.cssText??"");(0,r.writeFileSync)((0,u.uriToPath)(h),f.getText());let m=_+s.AventusExtension.ComponentView,g=i.TextDocument.create(m,s.AventusLanguageId.HTML,n.versionUser+1,d.htmlText??"");(0,r.writeFileSync)((0,u.uriToPath)(m),g.getText());let y=_+s.AventusExtension.ComponentLogic,v=i.TextDocument.create(y,s.AventusLanguageId.TypeScript,n.versionUser+1,d.scriptText??"");(0,r.writeFileSync)((0,u.uriToPath)(y),v.getText()),(0,r.unlinkSync)(n.path),a.FilesManager.getInstance().onClose(n.documentUser),l.CloseFile.send(n.uri),a.FilesManager.getInstance().registerFile(f),a.FilesManager.getInstance().registerFile(g),a.FilesManager.getInstance().registerFile(v),c.OpenFile.send(v.uri)}}}},67112:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StaticExport=void 0;const r=n(40529),i=n(24964);t.StaticExport=class{static cmd="aventus.static";static async run(){let e=[],t=r.ProjectManager.getInstance().getAllStatics();for(let n of t)e.push({label:n.name,detail:n.uri});let n=await i.GenericServer.Select(e,{placeHolder:"Static to export"});if(n){let e=n.detail??"",t=n.label;await(r.ProjectManager.getInstance().getProjectByUri(e)?.getStatic(t)?.export())}}}},4855:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileCreated=void 0;const r=n(83693);t.FileCreated=class{static cmd="aventus.filesystem.created";static run(e){e&&r.FilesManager.getInstance().onCreatedUri(e)}}},82786:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDeleted=void 0;const r=n(83693);t.FileDeleted=class{static cmd="aventus.filesystem.deleted";static async run(e){e&&r.FilesManager.getInstance().onDeletedUri(e)}}},51525:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileUpdated=void 0;const r=n(83693);t.FileUpdated=class{static cmd="aventus.filesystem.updated";static async run(e){e&&r.FilesManager.getInstance().onUpdatedUri(e)}}},75206:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportProject=void 0;const r=n(24964);t.ImportProject=class{static cmd="aventus.template.import_project";static async run(){await(r.GenericServer.templateManager?.selectProjectToImport())}}},2816:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportTemplate=void 0;const r=n(24964);t.ImportTemplate=class{static cmd="aventus.template.import";static async run(){await(r.GenericServer.templateManager?.selectTemplateToImport())}}},8681:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenAventusFolder=void 0;const r=n(24964),i=n(57147),s=n(22037),a=n(32081);t.OpenAventusFolder=class{static cmd="aventus.filesystem.openAventus";static async run(){let e,t=r.GenericServer.savePath;switch((0,i.existsSync)(t)||(0,i.mkdirSync)(t),(0,s.platform)()){case"win32":e="explorer";break;case"linux":e="xdg-open";break;case"darwin":e="open"}let n=[t];(0,a.spawn)(e,n,{detached:!0}).unref()}}},53784:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Commands=void 0;const r=n(25655),i=n(11932),s=n(15993),a=n(4855),o=n(82786),l=n(51525),c=n(35614),u=n(79993),p=n(76914),_=n(1064),d=n(67112),h=n(36954),f=n(87152),m=n(72810),g=n(73480),y=n(71018),v=n(3650),$=n(88933),b=n(14043),S=n(8681),x=n(20079),w=n(67687),C=n(811),E=n(70140),k=n(2816),A=n(71171),T=n(17519),I=n(37779),F=n(18980),N=n(75206);t.Commands={allCommandes:{[i.BuildProject.cmd]:i.BuildProject,[p.StartServer.cmd]:p.StartServer,[h.StopServer.cmd]:h.StopServer,[_.ToggleServer.cmd]:_.ToggleServer,[s.Create.cmd]:s.Create,[$.Rename.cmd]:$.Rename,[b.Rename.cmd]:b.Rename,[c.MergeComponent.cmd]:c.MergeComponent,[u.SplitComponent.cmd]:u.SplitComponent,[d.StaticExport.cmd]:d.StaticExport,[r.AddConfigSection.cmd]:r.AddConfigSection,[I.CreateCSSVariable.cmd]:I.CreateCSSVariable,[f.CreateAttribute.cmd]:f.CreateAttribute,[m.CreateProperty.cmd]:m.CreateProperty,[g.CreateWatch.cmd]:g.CreateWatch,[y.ImportViewElement.cmd]:y.ImportViewElement,[v.ImportViewMethod.cmd]:v.ImportViewMethod,[a.FileCreated.cmd]:a.FileCreated,[l.FileUpdated.cmd]:l.FileUpdated,[o.FileDeleted.cmd]:o.FileDeleted,[S.OpenAventusFolder.cmd]:S.OpenAventusFolder,[x.PopupResponse.cmd]:x.PopupResponse,[w.ReceiveInput.cmd]:w.ReceiveInput,[C.ReceiveSelect.cmd]:C.ReceiveSelect,[E.ReceiveSelectMultiple.cmd]:E.ReceiveSelectMultiple,[k.ImportTemplate.cmd]:k.ImportTemplate,[N.ImportProject.cmd]:N.ImportProject,[A.SharpExport.cmd]:A.SharpExport,[T.ReloadSettings.cmd]:T.ReloadSettings,[F.StorybookBuild.cmd]:F.StorybookBuild},execute:function(e){let t=this.allCommandes[e.command];if(t){let n=e.arguments??[];t.run.call(t,...n)}}}},76914:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StartServer=void 0;const r=n(60206);t.StartServer=class{static cmd="aventus.liveserver.start";static run(){r.HttpServer.getInstance().start()}}},36954:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StopServer=void 0;const r=n(60206);t.StopServer=class{static cmd="aventus.liveserver.stop";static run(){r.HttpServer.getInstance().stop()}}},1064:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToggleServer=void 0;const r=n(60206);t.ToggleServer=class{static cmd="aventus.liveserver.toggle";static run(){r.HttpServer.getInstance().toggle()}}},71171:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SharpExport=void 0;const r=n(13211),i=n(24964),s=n(71017),a=n(32081),o=n(1539),l=n(19408),c=n(57147),u=n(96693),p=n(49387),_=n(2741);t.SharpExport=class{static cmd="aventus.sharp.export";static isCompiling=!1;static async run(e){if(this.isCompiling)return;if(!e||!e.endsWith(l.AventusExtension.CsharpConfig)){let t=Object.keys(_.CSharpManager.getInstance().files);if(1==t.length)e=t[0];else{if(!(t.length>1))return void i.GenericServer.showErrorMessage("No aventus.sharp.avt found");{let n=[];for(let e of t)n.push({label:e});let r=await i.GenericServer.Select(n,{placeHolder:"Project to compile"});if(!r)return;e=r.label}}}if(!(0,r.sync)("dotnet"))return void i.GenericServer.showErrorMessage("Dotnet isn't installed on your system");let t="";try{let n=(0,c.readFileSync)((0,o.uriToPath)(e),"utf-8");t=JSON.parse(n).csProj}catch(e){console.log(e)}this.isCompiling=!0,u.Compiling.send(t,"compiling");try{let n=(0,s.join)(i.GenericServer.extensionPath,"lib","bin","CSharpToTypescript","CSharpToTypescript.dll"),r=(0,o.uriToPath)(e),l=(0,a.execSync)("dotnet "+n+" "+r).toString();if(-1==l.indexOf("Error : "))u.Compiling.send(t,"success");else{console.clear(),console.log(l);let e="csharp_errors";p.DebugFileAdd.send(e,l),u.Compiling.send(t,"error",[{title:"C# error",file:e}])}}catch(e){i.GenericServer.showErrorMessage(e+"")}this.isCompiling=!1}}},18980:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StorybookBuild=void 0;const r=n(24964),i=n(40529);t.StorybookBuild=class{static cmd="aventus.storybook.build";static async run(){let e=[],t=i.ProjectManager.getInstance().getAllBuildsWithStory();for(let n of t)e.push({label:n.name,detail:n.uri});let n=await r.GenericServer.Select(e,{placeHolder:"Story to build"});if(n){let e=n.detail??"",t=n.label;i.ProjectManager.getInstance().getProjectByUri(e)?.getBuild(t)?.buildStorybook()}}}},87152:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateAttribute=void 0;const r=n(22037),i=n(18952),s=n(19408),a=n(83693),o=n(22296),l=n(24964),c=n(1539);class u{static cmd="aventus.wc.create.attribute";static attrType=[{label:"Number",detail:"number"},{label:"String",detail:"string"},{label:"Boolean",detail:"boolean"},{label:"Date",detail:"Date"},{label:"Datetime",detail:"Datetime"},{label:"Custom",detail:""}];static async run(e,t){if(!e)return;if(!t)return;let n=await l.GenericServer.Input({title:"Provide a name for your Attribute",validations:[{message:"A property must be with lowercase, number or _",regex:"^[_a-z0-9]+$"}]});if(!n)return;let p=await l.GenericServer.Select(u.attrType,{placeHolder:"Choose a type?"});if(!p)return;(0,c.reorderList)(u.attrType,p);let _=p.detail,d=a.FilesManager.getInstance().getByUri(e);if(d){let a="?";"boolean"!=_&&"number"!=_||(a="!");let l=d.documentUser.positionAt(d.contentUser.length),c="@Attribute()"+r.EOL+"public "+n+a+":"+_+";"+r.EOL,u=d.contentUser.slice(0,t)+c+d.contentUser.slice(t+1,d.contentUser.length),p=i.TextDocument.create(d.uri,s.AventusLanguageId.TypeScript,d.versionUser+1,u);await d.triggerContentChange(p);let h=await d.getFormatting({insertSpaces:!0,tabSize:4});await d.applyTextEdits(h);let f=[{newText:d.contentUser,range:{start:{character:0,line:0},end:l}}];o.EditFile.send(e,[f])}}}t.CreateAttribute=u},37779:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateCSSVariable=void 0;const r=n(18952),i=n(19408),s=n(83693),a=n(22296),o=n(24964);t.CreateCSSVariable=class{static cmd="aventus.wc.create.cssvar";static async run(e,t){if(!e)return;if(!t)return;let n=await o.GenericServer.Input({title:"Provide a name for your variable"});if(!n)return;let l=await o.GenericServer.Input({title:"Provide a default value for your variable"}),c=s.FilesManager.getInstance().getByUri(e);if(c){let s=c.name.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g)?.join("-").toLowerCase()??c.name,o=n.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g)?.join("-").toLowerCase()??n,u=l?", "+l:"",p=c.documentUser.positionAt(c.contentUser.length),_=`--_${s}-${o}: var(--${s}-${o}${u});`,d=c.contentUser.slice(0,t)+_+c.contentUser.slice(t+1,c.contentUser.length),h=r.TextDocument.create(c.uri,i.AventusLanguageId.SCSS,c.versionUser+1,d);await c.triggerContentChange(h);let f=await c.getFormatting({insertSpaces:!0,tabSize:4});await c.applyTextEdits(f);let m=[{newText:c.contentUser,range:{start:{character:0,line:0},end:p}}];a.EditFile.send(e,[m])}}}},72810:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateProperty=void 0;const r=n(22037),i=n(18952),s=n(19408),a=n(83693),o=n(16286),l=n(22296),c=n(24964),u=n(1539);class p{static cmd="aventus.wc.create.property";static attrType=[{label:"Number",detail:"number"},{label:"String",detail:"string"},{label:"Boolean",detail:"boolean"},{label:"Date",detail:"Date"},{label:"Datetime",detail:"Datetime"},{label:"Custom",detail:""}];static async run(e,t,n){if(!e)return;if(!t)return;const _=await c.GenericServer.Input({title:"Provide a name for your Property",validations:[{message:"A property must be with lowercase, number or _",regex:"^[_a-z0-9]+$"}],value:n});if(!_)return;let d=await c.GenericServer.Select(p.attrType,{placeHolder:"Choose a type?"});if(!d)return;(0,u.reorderList)(p.attrType,d);let h=d.detail;const f=await c.GenericServer.Select([{label:"Yes"},{label:"No"}],{placeHolder:"Do you need a callback function?"});if(!f)return;let m="Yes"==f.label,g=a.FilesManager.getInstance().getByUri(e);if(g){let n=g.documentUser.positionAt(g.contentUser.length),c=a.FilesManager.getInstance().getBuild(g.documentUser),u="";if(c.length>0){let t=c[0].tsFiles[e];t instanceof o.AventusWebComponentLogicalFile&&(u=t.getComponentName())}if(""==u)return;let p="";m&&(p="(target: "+u+") => {"+r.EOL+r.EOL+"}");let d="?";"boolean"!=h&&"number"!=h||(d="!");let f="@Property("+p+")"+r.EOL+"public "+_+d+":"+h+";"+r.EOL,y=g.contentUser.slice(0,t)+f+g.contentUser.slice(t+1,g.contentUser.length),v=i.TextDocument.create(g.uri,s.AventusLanguageId.TypeScript,g.versionUser+1,y);await g.triggerContentChange(v);let $=await g.getFormatting({insertSpaces:!0,tabSize:4});await g.applyTextEdits($);let b=[{newText:g.contentUser,range:{start:g.documentUser.positionAt(0),end:n}}];l.EditFile.send(e,[b])}}}t.CreateProperty=p},73480:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateWatch=void 0;const r=n(83693),i=n(16286),s=n(22037),a=n(18952),o=n(19408),l=n(22296),c=n(24964);t.CreateWatch=class{static cmd="aventus.wc.create.watch";static async run(e,t,n){if(!e)return;if(!t)return;const u=await c.GenericServer.Input({title:"Provide a name for your Watch variable",value:n});if(!u)return;const p=await c.GenericServer.Input({title:"Provide a type for your Watch"});if(!p)return;const _=await c.GenericServer.Select([{label:"Yes"},{label:"No"}],{placeHolder:"Do you need a callback function?"});if(!_)return;let d="Yes"==_.label,h=r.FilesManager.getInstance().getByUri(e);if(h){let n=h.documentUser.positionAt(h.contentUser.length),c=r.FilesManager.getInstance().getBuild(h.documentUser),_="";if(c.length>0){let t=c[0].tsFiles[e];t instanceof i.AventusWebComponentLogicalFile&&(_=t.getComponentName())}if(""==_)return;let f="";d&&(f="(target: "+_+", action: Aventus.WatchAction, path: string, value: any) => {"+s.EOL+s.EOL+"}");let m="@Watch("+f+")"+s.EOL+"public "+u+"?:"+p+";"+s.EOL,g=h.contentUser.slice(0,t)+m+h.contentUser.slice(t+1,h.contentUser.length),y=a.TextDocument.create(h.uri,o.AventusLanguageId.TypeScript,h.versionUser+1,g);await h.triggerContentChange(y);let v=await h.getFormatting({insertSpaces:!0,tabSize:4});await h.applyTextEdits(v);let $=[{newText:h.contentUser,range:{start:h.documentUser.positionAt(0),end:n}}];l.EditFile.send(e,[$])}}}},71018:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportViewElement=void 0;const r=n(18952),i=n(19408),s=n(83693),a=n(16286),o=n(22296);t.ImportViewElement=class{static cmd="aventus.wc.import.viewElement";static async run(e,t){let n=s.FilesManager.getInstance().getByUri(e);if(n){let l=n.documentUser.positionAt(n.contentUser.length),c=s.FilesManager.getInstance().getBuild(n.documentUser);if(c.length>0){let s=c[0].tsFiles[e];if(s instanceof a.AventusWebComponentLogicalFile){let a=s.getMissingVariablesInfo();if(-1==t&&(t=a.start),-1==t)return;if(""!=a.text){let s=n.contentUser.slice(0,t),c=n.contentUser.slice(t+1,n.contentUser.length),u=s+a.text+c,p=r.TextDocument.create(n.uri,i.AventusLanguageId.TypeScript,n.versionUser+1,u);await n.triggerContentChange(p);let _=await n.getFormatting({insertSpaces:!0,tabSize:4});await n.applyTextEdits(_);let d=[{newText:n.contentUser,range:{start:n.documentUser.positionAt(0),end:l}}];o.EditFile.send(e,[d])}}}}}}},3650:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportViewMethod=void 0;const r=n(18952),i=n(19408),s=n(83693),a=n(16286),o=n(22296);t.ImportViewMethod=class{static cmd="aventus.wc.import.viewMethod";static async run(e,t){let n=s.FilesManager.getInstance().getByUri(e);if(n){let l=n.documentUser.positionAt(n.contentUser.length),c=s.FilesManager.getInstance().getBuild(n.documentUser);if(c.length>0){let s=c[0].tsFiles[e];if(s instanceof a.AventusWebComponentLogicalFile){let a=s.getMissingMethodsInfo();if(-1==t&&(t=a.start),-1==t)return;if(""!=a.text){let s=n.contentUser.slice(0,t),c=n.contentUser.slice(t+1,n.contentUser.length),u=s+a.text+c,p=r.TextDocument.create(n.uri,i.AventusLanguageId.TypeScript,n.versionUser+1,u);await n.triggerContentChange(p);let _=await n.getFormatting({insertSpaces:!0,tabSize:4});await n.applyTextEdits(_);let d=[{newText:n.contentUser,range:{start:n.documentUser.positionAt(0),end:l}}];o.EditFile.send(e,[d])}}}}}}},14043:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rename=void 0;const r=n(19408),i=n(72375),s=n(83693),a=n(57147),o=n(40529),l=n(1539),c=n(64945),u=n(18952),p=n(24964);t.Rename=class{static cmd="aventus.component.rename";static async run(e){if(!e)return;let t=(e=e.toString().replace(/\.wcv\.avt$/,".wcl.avt").replace(/\.wcs\.avt$/,".wcl.avt")).split("/"),n=t[t.length-1].replace(".wcl.avt",""),_=await p.GenericServer.Input({title:"New name",value:n,validations:[{message:"Your name isn't valid",regex:"^[_A-Za-z0-9-]+$"}]});if(!_)return;let d=s.FilesManager.getInstance().getByUri(e);if(d&&d instanceof i.InternalAventusFile){let e=s.FilesManager.getInstance(),t=d.documentUser.uri.split("/"),n=t[t.length-1].replace(r.AventusExtension.ComponentLogic,""),i=(0,l.escapeRegex)(n),p=d.folderUri,h=p.replace(new RegExp(i+"$"),_),f=new RegExp("(class +)"+i+" ").exec(d.contentUser),m={};if(f){let t=f.index+f[1].length,n=d.documentUser.positionAt(t),r=await d.getRename(n,_);if(r&&r.changes)for(let t in r.changes){if(!m[t]){let n=e.getByUri(t);if(!n)continue;m[t]=n}let n=r.changes[t];await m[t].applyTextEdits(n)}}let g=[],y=e=>{let t=p+"/"+n+e;if((0,a.existsSync)((0,l.uriToPath)(t))){let n=h+"/"+_+e;g.push({oldUri:t,newUri:n})}};y(r.AventusExtension.ComponentLogic),y(r.AventusExtension.ComponentStyle),y(r.AventusExtension.ComponentView);let v=await o.ProjectManager.getInstance().onRename(g);for(let t in v){if(!m[t]){let n=e.getByUri(t);if(!n)continue;m[t]=n}await m[t].applyTextEdits(v[t])}setTimeout((()=>{for(let e in m)(0,a.writeFileSync)((0,l.uriToPath)(e),m[e].contentUser);(0,a.mkdirSync)((0,l.uriToPath)(h));for(let t of g){let n=t.oldUri,r=t.newUri,i=(0,l.uriToPath)(n);(0,a.renameSync)(i,(0,l.uriToPath)(r)),c.CloseFile.send(n);let s=e.getByUri(n);s&&(e.registerFile(u.TextDocument.create(r,(0,l.getLanguageIdByUri)(r),1,s.contentUser)),e.onClose(s?.documentUser))}let t=(0,l.uriToPath)(p),n=(0,a.readdirSync)(t);0==n.length?(0,a.rmdirSync)(t):1==n.length&&n[0].endsWith(".js")&&(0,a.rmSync)(t,{recursive:!0,force:!0})}),500)}}}},9648:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorInfo=void 0;class n{static tc(e,t){if(typeof e!=t)throw new TypeError(`required type ${t} got ${typeof e}`);return e}static ic(e,t){if(!(e instanceof t))throw new TypeError(`required type ${t} got ${typeof e}`);return e}static nc(e){return isNaN(e)?0:e}static oc(e){return{angle:e&&e.angle?e.angle:15,results:e&&e.results?e.results:3}}static clmp(e,t,n){return void 0!==n&&e<n?n:e>t?t:e}static shift(e,t){for(e+=t;e>=360;)e-=360;for(;e<0;)e+=360;return e}#e;#t;#n;alpha;static Colors=class{static get BLACK(){return n.fromHex("#000000")}static get SILVER(){return n.fromHex("#c0c0c0")}static get GRAY(){return n.fromHex("#808080")}static get WHITE(){return n.fromHex("#ffffff")}static get MAROON(){return n.fromHex("#800000")}static get RED(){return n.fromHex("#ff0000")}static get PURPLE(){return n.fromHex("#800080")}static get GREEN(){return n.fromHex("#008000")}static get LIME(){return n.fromHex("#00ff00")}static get OLIVE(){return n.fromHex("#808000")}static get YELLOW(){return n.fromHex("#ffff00")}static get NAVY(){return n.fromHex("#000080")}static get BLUE(){return n.fromHex("#0000ff")}static get TEAL(){return n.fromHex("#008080")}static get AQUA(){return n.fromHex("#00ffff")}static get ORANGE(){return n.fromHex("#ffa500")}static get ALICEBLUE(){return n.fromHex("#f0f8ff")}static get ANTIQUEWHITE(){return n.fromHex("#faebd7")}static get AQUAMARINE(){return n.fromHex("#7fffd4")}static get AZURE(){return n.fromHex("#f0ffff")}static get BEIGE(){return n.fromHex("#f5f5dc")}static get BISQUE(){return n.fromHex("#ffe4c4")}static get BLANCHEDALMOND(){return n.fromHex("#ffebcd")}static get BLUEVIOLET(){return n.fromHex("#8a2be2")}static get BROWN(){return n.fromHex("#a52a2a")}static get BURLYWOOD(){return n.fromHex("#deb887")}static get CADETBLUE(){return n.fromHex("#5f9ea0")}static get CHARTREUSE(){return n.fromHex("#7fff00")}static get CHOCOLATE(){return n.fromHex("#d2691e")}static get CORAL(){return n.fromHex("#ff7f50")}static get CORNFLOWERBLUE(){return n.fromHex("#6495ed")}static get CORNSILK(){return n.fromHex("#fff8dc")}static get CRIMSON(){return n.fromHex("#dc143c")}static get CYAN(){return n.fromHex("#00ffff")}static get DARKBLUE(){return n.fromHex("#00008b")}static get DARKCYAN(){return n.fromHex("#008b8b")}static get DARKGOLDENROD(){return n.fromHex("#b8860b")}static get DARKGRAY(){return n.fromHex("#a9a9a9")}static get DARKGREEN(){return n.fromHex("#006400")}static get DARKGREY(){return n.fromHex("#a9a9a9")}static get DARKKHAKI(){return n.fromHex("#bdb76b")}static get DARKMAGENTA(){return n.fromHex("#8b008b")}static get DARKOLIVEGREEN(){return n.fromHex("#556b2f")}static get DARKORANGE(){return n.fromHex("#ff8c00")}static get DARKORCHID(){return n.fromHex("#9932cc")}static get DARKRED(){return n.fromHex("#8b0000")}static get DARKSALMON(){return n.fromHex("#e9967a")}static get DARKSEAGREEN(){return n.fromHex("#8fbc8f")}static get DARKSLATEBLUE(){return n.fromHex("#483d8b")}static get DARKSLATEGRAY(){return n.fromHex("#2f4f4f")}static get DARKSLATEGREY(){return n.fromHex("#2f4f4f")}static get DARKTURQUOISE(){return n.fromHex("#00ced1")}static get DARKVIOLET(){return n.fromHex("#9400d3")}static get DEEPPINK(){return n.fromHex("#ff1493")}static get DEEPSKYBLUE(){return n.fromHex("#00bfff")}static get DIMGRAY(){return n.fromHex("#696969")}static get DIMGREY(){return n.fromHex("#696969")}static get DODGERBLUE(){return n.fromHex("#1e90ff")}static get FIREBRICK(){return n.fromHex("#b22222")}static get FLORALWHITE(){return n.fromHex("#fffaf0")}static get FORESTGREEN(){return n.fromHex("#228b22")}static get GAINSBORO(){return n.fromHex("#dcdcdc")}static get GHOSTWHITE(){return n.fromHex("#f8f8ff")}static get GOLD(){return n.fromHex("#ffd700")}static get GOLDENROD(){return n.fromHex("#daa520")}static get GREENYELLOW(){return n.fromHex("#adff2f")}static get GREY(){return n.fromHex("#808080")}static get HONEYDEW(){return n.fromHex("#f0fff0")}static get HOTPINK(){return n.fromHex("#ff69b4")}static get INDIANRED(){return n.fromHex("#cd5c5c")}static get INDIGO(){return n.fromHex("#4b0082")}static get IVORY(){return n.fromHex("#fffff0")}static get KHAKI(){return n.fromHex("#f0e68c")}static get LAVENDER(){return n.fromHex("#e6e6fa")}static get LAVENDERBLUSH(){return n.fromHex("#fff0f5")}static get LAWNGREEN(){return n.fromHex("#7cfc00")}static get LEMONCHIFFON(){return n.fromHex("#fffacd")}static get LIGHTBLUE(){return n.fromHex("#add8e6")}static get LIGHTCORAL(){return n.fromHex("#f08080")}static get LIGHTCYAN(){return n.fromHex("#e0ffff")}static get LIGHTGOLDENRODYELLOW(){return n.fromHex("#fafad2")}static get LIGHTGRAY(){return n.fromHex("#d3d3d3")}static get LIGHTGREEN(){return n.fromHex("#90ee90")}static get LIGHTGREY(){return n.fromHex("#d3d3d3")}static get LIGHTPINK(){return n.fromHex("#ffb6c1")}static get LIGHTSALMON(){return n.fromHex("#ffa07a")}static get LIGHTSEAGREEN(){return n.fromHex("#20b2aa")}static get LIGHTSKYBLUE(){return n.fromHex("#87cefa")}static get LIGHTSLATEGRAY(){return n.fromHex("#778899")}static get LIGHTSLATEGREY(){return n.fromHex("#778899")}static get LIGHTSTEELBLUE(){return n.fromHex("#b0c4de")}static get LIGHTYELLOW(){return n.fromHex("#ffffe0")}static get LIMEGREEN(){return n.fromHex("#32cd32")}static get LINEN(){return n.fromHex("#faf0e6")}static get MAGENTA(){return n.fromHex("#ff00ff")}static get FUCHSIA(){return n.fromHex("#ff00ff")}static get MEDIUMAQUAMARINE(){return n.fromHex("#66cdaa")}static get MEDIUMBLUE(){return n.fromHex("#0000cd")}static get MEDIUMORCHID(){return n.fromHex("#ba55d3")}static get MEDIUMPURPLE(){return n.fromHex("#9370db")}static get MEDIUMSEAGREEN(){return n.fromHex("#3cb371")}static get MEDIUMSLATEBLUE(){return n.fromHex("#7b68ee")}static get MEDIUMSPRINGGREEN(){return n.fromHex("#00fa9a")}static get MEDIUMTURQUOISE(){return n.fromHex("#48d1cc")}static get MEDIUMVIOLETRED(){return n.fromHex("#c71585")}static get MIDNIGHTBLUE(){return n.fromHex("#191970")}static get MINTCREAM(){return n.fromHex("#f5fffa")}static get MISTYROSE(){return n.fromHex("#ffe4e1")}static get MOCCASIN(){return n.fromHex("#ffe4b5")}static get NAVAJOWHITE(){return n.fromHex("#ffdead")}static get OLDLACE(){return n.fromHex("#fdf5e6")}static get OLIVEDRAB(){return n.fromHex("#6b8e23")}static get ORANGERED(){return n.fromHex("#ff4500")}static get ORCHID(){return n.fromHex("#da70d6")}static get PALEGOLDENROD(){return n.fromHex("#eee8aa")}static get PALEGREEN(){return n.fromHex("#98fb98")}static get PALETURQUOISE(){return n.fromHex("#afeeee")}static get PALEVIOLETRED(){return n.fromHex("#db7093")}static get PAPAYAWHIP(){return n.fromHex("#ffefd5")}static get PEACHPUFF(){return n.fromHex("#ffdab9")}static get PERU(){return n.fromHex("#cd853f")}static get PINK(){return n.fromHex("#ffc0cb")}static get PLUM(){return n.fromHex("#dda0dd")}static get POWDERBLUE(){return n.fromHex("#b0e0e6")}static get ROSYBROWN(){return n.fromHex("#bc8f8f")}static get ROYALBLUE(){return n.fromHex("#4169e1")}static get SADDLEBROWN(){return n.fromHex("#8b4513")}static get SALMON(){return n.fromHex("#fa8072")}static get SANDYBROWN(){return n.fromHex("#f4a460")}static get SEAGREEN(){return n.fromHex("#2e8b57")}static get SEASHELL(){return n.fromHex("#fff5ee")}static get SIENNA(){return n.fromHex("#a0522d")}static get SKYBLUE(){return n.fromHex("#87ceeb")}static get SLATEBLUE(){return n.fromHex("#6a5acd")}static get SLATEGRAY(){return n.fromHex("#708090")}static get SLATEGREY(){return n.fromHex("#708090")}static get SNOW(){return n.fromHex("#fffafa")}static get SPRINGGREEN(){return n.fromHex("#00ff7f")}static get STEELBLUE(){return n.fromHex("#4682b4")}static get TAN(){return n.fromHex("#d2b48c")}static get THISTLE(){return n.fromHex("#d8bfd8")}static get TOMATO(){return n.fromHex("#ff6347")}static get TURQUOISE(){return n.fromHex("#40e0d0")}static get VIOLET(){return n.fromHex("#ee82ee")}static get WHEAT(){return n.fromHex("#f5deb3")}static get WHITESMOKE(){return n.fromHex("#f5f5f5")}static get YELLOWGREEN(){return n.fromHex("#9acd32")}static get REBECCAPURPLE(){return n.fromHex("#663399")}};getScheme(e,t){return n.createScheme(this,e,t)}static getScheme(e,t,r){return n.createScheme(e,t,r)}static monochromatic(e,t){this.ic(e,n);let r=this.oc(t).results||3,i=n.toHsv(e),s=i.h,a=i.s,o=i.v/100,l=[],c=1/r;for(;r--;)l.push(n.fromHsv(s,a,this.clmp(100*o,100,0))),o=(o-c)%1;return l}monochromatic(e){return n.monochromatic(this,e)}static complementary(e){this.ic(e,n);let t=n.toHsl(e),r=t.h,i=t.s,s=t.l;return n.fromHsl(this.shift(r,180),i,s)}complementary(){return n.complementary(this)}static splitComplementary(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle||15,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,180+i),a,o),n.fromHsl(this.shift(s,180-i),a,o)]}splitComplementary(e){return n.splitComplementary(this,e)}static doubleComplementary(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle||15,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,180),a,o),n.fromHsl(this.shift(s,i),a,o),n.fromHsl(this.shift(s,180+i),a,o)]}doubleComplementary(e){return n.doubleComplementary(this,e)}static square(e){this.ic(e,n);let t=n.toHsl(e),r=t.h,i=t.s,s=t.l;const a=[e];for(let e=1;e<4;e++)r=this.shift(r,90),a.push(n.fromHsl(r,i,s));return a}square(){return n.square(this)}static tetradic(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,180),a,o),n.fromHsl(this.shift(s,180-i),a,o),n.fromHsl(this.shift(s,-i),a,o)]}tetradic(e){return n.tetradic(this,e)}static triadic(e){this.ic(e,n);let t=n.toHsl(e),r=t.h,i=t.s,s=t.l;return[e,n.fromHsl(this.shift(r,120),i,s),n.fromHsl(this.shift(r,240),i,s)]}triadic(){return n.triadic(this)}static analogous(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,-i),a,o),n.fromHsl(this.shift(s,+i),a,o)]}analogous(e){return n.analogous(this,e)}static createScheme(e,t,r){switch(t.toLowerCase()){case"analogous":case"analog":return n.analogous(e,r);case"triadic":case"triad":return n.triadic(e);case"tetradic":case"tetra":return n.tetradic(e,r);case"monochromatic":case"monochrome":case"mono":return n.monochromatic(e,r);case"complementary":case"complement":case"comp":return n.complementary(e);case"double-complementary":case"double-complement":case"double":return n.doubleComplementary(e,r);case"split-complementary":case"split-complement":case"split":return n.splitComplementary(e,r);case"square":return n.square(e)}return null}constructor(e,t,r){if(!(0<=e&&e<=255&&0<=t&&t<=255&&0<=r&&r<=255))throw new Error("Color values out of bounds (0 - 255)");this.#e=n.nc(n.tc(e,"number")),this.#t=n.nc(n.tc(t,"number")),this.#n=n.nc(n.tc(r,"number")),this.alpha=1}static saturate(e,t){this.ic(e,n),this.tc(t,"number");let r=e.toHsl(),i=r.h,s=this.clmp(r.s+t,100,0),a=r.l;return n.fromHsl(i,s,a)}saturate(e){return n.saturate(this,e)}static desaturate(e,t){this.ic(e,n),this.tc(t,"number");let r=e.toHsl(),i=r.h,s=this.clmp(r.s-t,100,0),a=r.l;return n.fromHsl(i,s,a)}desaturate(e){return n.desaturate(this,e)}static grayscale(e){return n.desaturate(e,100)}grayscale(){return n.greyscale(this)}static greyscale(e){return n.desaturate(e,100)}greyscale(){return n.greyscale(this)}static lighten(e,t){this.ic(e,n),this.tc(t,"number");const r=e.toHsl();let i=r.h,s=r.s,a=this.clmp(r.l+t,100,0);return n.fromHsl(i,s,a)}lighten(e){return n.lighten(this,e)}static darken(e,t){return n.lighten(e,-t)}darken(e){return n.darken(this,e)}static brighten(e,t){let r=e.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-t/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-t/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-t/100*255))),new n(r.r,r.g,r.b)}brighten(e){return n.brighten(this,e)}static shiftHue(e,t){this.ic(e,n),this.tc(t,Number);let{h:r,s:i,l:s}=e.toHsl();return r=this.shift(r,t),n.fromHsl(r,i,s)}shiftHue(e){return n.shiftHue(this,e)}static multiply(e,t){this.ic(e,n),this.ic(t,n);let{r1:r,g1:i,b1:s}=e.toRgb(),{r2:a,g2:o,b2:l}=t.toRgb();return n.fromRgb(r*a/255,i*o/255,s*l/255)}multiply(e){return n.multiply(this,e)}static mix(e,t,r=50){this.ic(e,n),this.ic(e,n),this.tc(r,"number");const i=e.toRgb(),s=t.toRgb(),a=this.clmp(r,100,0)/100,o=Math.round((s.r-i.r)*a+i.r),l=Math.round((s.g-i.g)*a+i.g),c=Math.round((s.b-i.b)*a+i.b);return n.fromRgb(o,l,c)}mix(e,t){return n.mix(this,e,t)}static lerp(e,t,r=.5){this.tc(r,"number"),this.ic(e,n),this.ic(t,n),r=this.clmp(r,1,0);let i=e.toRgb(),s=t.toRgb(),a=i.r/255,o=i.g/255,l=i.b/255,c=s.r/255,u=s.g/255,p=s.b/255;return n.fromRgb(255*(a+(c-a)*r),255*(o+(u-o)*r),255*(l+(p-l)*r))}lerp(e,t){return n.lerp(this,e,t)}static add(e,t){this.ic(e,n),this.ic(t,n);let r=e.toRgb(),i=t.toRgb(),s=r.r,a=r.g,o=r.b,l=i.r,c=i.g,u=i.b;return n.fromRgb(Math.round((s+l)/2),Math.round((a+c)/2),Math.round((o+u)/2))}add(e){return n.add(this,e)}static fromHex(e){if(!e.match(/^#?(?:[0-9a-fA-F]{3}){1,2}$/i))throw new Error('Invalid Hex code: "'+e+'"');let t="0x00",r="0x00",i="0x00";4==e.length?(t="0x"+e[1]+e[1],r="0x"+e[2]+e[2],i="0x"+e[3]+e[3]):3==e.length?(t="0x"+e[0]+e[0],r="0x"+e[1]+e[1],i="0x"+e[2]+e[2]):7==e.length?(t="0x"+e[1]+e[2],r="0x"+e[3]+e[4],i="0x"+e[5]+e[6]):6==e.length&&(t="0x"+e[0]+e[1],r="0x"+e[2]+e[3],i="0x"+e[4]+e[5]);return new n(parseInt(t,16),parseInt(r,16),parseInt(i,16))}static fromRgb(e,t,r){return new n(e,t,r)}static fromHsl(e,t,r){if(e=this.tc(e,"number"),t=this.tc(t,"number"),r=this.tc(r,"number"),!(0<=e&&e<=360))throw new Error("HSL color values out of range, hue (0 - 360)");if(!(0<=t&&t<=100))throw new Error("HSL color values out of range, sat (0 - 100)");if(!(0<=r&&r<=100))throw new Error("HSL color values out of range, lum (0 - 100)");t/=100,r/=100;let i=(1-Math.abs(2*r-1))*t,s=i*(1-Math.abs(e/60%2-1)),a=r-i/2,o=0,l=0,c=0;0<=e&&e<60?(o=i,l=s,c=0):60<=e&&e<120?(o=s,l=i,c=0):120<=e&&e<180?(o=0,l=i,c=s):180<=e&&e<240?(o=0,l=s,c=i):240<=e&&e<300?(o=s,l=0,c=i):300<=e&&e<=360&&(o=i,l=0,c=s);const u=Math.round(255*(o+a)),p=Math.round(255*(l+a)),_=Math.round(255*(c+a));return new n(u,p,_)}static fromHsv(e,t,r){if(e=this.tc(e,"number"),t=this.tc(t,"number"),r=this.tc(r,"number"),!(0<=e&&e<=360))throw new Error("HSL color values out of range, hue (0 - 360)");if(!(0<=t&&t<=100))throw new Error("HSL color values out of range, sat (0 - 100)");if(!(0<=r&&r<=100))throw new Error("HSL color values out of range, lum (0 - 100)");let i=(r/=100)*(t/=100),s=i*(1-Math.abs(e/60%2-1)),a=r-i,o=0,l=0,c=0;0<=e&&e<60?(o=i,l=s,c=0):60<=e&&e<120?(o=s,l=i,c=0):120<=e&&e<180?(o=0,l=i,c=s):180<=e&&e<240?(o=0,l=s,c=i):240<=e&&e<300?(o=s,l=0,c=i):300<=e&&e<=360&&(o=i,l=0,c=s);return new n(255*(o+a),255*(l+a),255*(c+a))}static fromCssString(e){this.tc(e,"string");var t=document.createElement("canvas").getContext("2d");let r;if(t&&(t.fillStyle=e,r=t.fillStyle),!r)throw new Error("Invalid Color string");return n.fromHex(r)}static fromName(e){e=this.tc(e,"string");const t=this.Colors[e.toUpperCase()];if(!t)throw new Error("Invalid Color name");return t}static toHex(e){e=this.ic(e,n);let t=Math.round(e.#e).toString(16),r=Math.round(e.#t).toString(16),i=Math.round(e.#n).toString(16);return 1==t.length&&(t="0"+t),1==r.length&&(r="0"+r),1==i.length&&(i="0"+i),"#"+t+r+i}static toHsl(e){let t=0,r=0,i=0,s=(e=this.ic(e,n)).#e/255,a=e.#t/255,o=e.#n/255,l=Math.min(Math.min(s,a),o),c=Math.max(Math.max(s,a),o),u=c-l;return t=0===u?0:c===s?(a-o)/u%6:c===a?(o-s)/u+2:(s-a)/u+4,t=Math.round(60*t),t<0&&(t+=360),i=(c+l)/2,r=0===u?0:u/(1-Math.abs(2*i-1)),r=parseFloat(Math.abs(100*r)+""),i=parseFloat(Math.abs(100*i)+""),{h:this.nc(t),s:this.nc(r),l:this.nc(i)}}static toHsv(e){let t=0,n=0,r=0,i=e.#e/255,s=e.#t/255,a=e.#n/255,o=Math.min(Math.min(i,s),a),l=Math.max(Math.max(i,s),a),c=l-o;return t=0===c?0:l===i?(s-a)/c%6:l===s?(a-i)/c+2:(i-s)/c+4,t=Math.round(60*t),t<0&&(t+=360),0!==l&&(n=c/l*100),r=100*l,{h:this.nc(t),s:this.nc(n),v:this.nc(r)}}static toRgb(e){return this.ic(e,n),{r:e.#e,g:e.#t,b:e.#n}}static toCmyk(e){this.ic(e,n);let{r:t,g:r,b:i}=e.toRgb(),s=1-t/255,a=1-r/255,o=1-i/255,l=Math.min(s,Math.min(a,o));return s=(s-l)/(1-l),a=(a-l)/(1-l),o=(o-l)/(1-l),s=this.nc(Math.round(1e4*s)/100),a=this.nc(Math.round(1e4*a)/100),o=this.nc(Math.round(1e4*o)/100),l=this.nc(Math.round(1e4*l)/100),{c:s,m:a,y:o,k:l}}toHsl(){return n.toHsl(this)}toHsv(){return n.toHsv(this)}toHex(){return n.toHex(this)}toRgb(){return n.toRgb(this)}toCmyk(){return n.toCmyk(this)}static random(){const e=Math.floor(255*Math.random()),t=Math.floor(255*Math.random()),r=Math.floor(255*Math.random());return new n(e,t,r)}toString(e="hex"){n.tc(e,"string");const t=this.toRgb(),r=this.toHsl();switch(e.toLowerCase()){case"hex":return this.toHex();case"hexa":let e=Math.round(255*this.alpha).toString(16);return 1===e.length&&(e="0"+e),this.toHex()+e;case"rgb":return`rgb(${Math.round(t.r)}, ${Math.round(t.g)}, ${Math.round(t.b)})`;case"rgba":return`rgba(${Math.round(t.r)}, ${Math.round(t.g)}, ${Math.round(t.b)}, ${this.alpha})`;case"hsl":return`hsl(${Math.round(r.h)}, ${Math.round(r.s)}%, ${Math.round(r.l)}%)`;case"hsla":return`hsla(${Math.round(r.h)}, ${Math.round(r.s)}%, ${Math.round(r.l)}%, ${this.alpha})`;case"hsv":const n=this.toHsv();return`hsv(${Math.round(n.h)}, ${Math.round(n.s)}%, ${Math.round(n.v)}%)`;case"cmyk":const i=this.toCmyk();return`cmyk(${Math.round(i.c)}%, ${Math.round(i.m)}%, ${Math.round(i.y)}%, ${Math.round(i.k)}%)`}return""}valueOf(){return parseInt("0x"+this.toHex().slice(1))}}t.ColorInfo=n},32377:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorPicker=void 0;const r=n(9648),i=n(42374),s=n(25392);class a{static colorTxtList=[];static parseColorString(e){try{const t=s(e);if(!t)throw new Error("invalid color string");const n=t.rgba[0],r=t.rgba[1],a=t.rgba[2],o=t.rgba[3];return i.Color.create(n/255,r/255,a/255,o)}catch(e){return console.log(e),null}}static getPos(e,t){const n=Array.from(e.slice(0,t).matchAll(/\n/g)),r=n.length;let s=n[r-1],a=0;s.index&&(a=s.index);const o=t-a;return i.Position.create(r,o-1)}static getMatches(e){let t=[];const n=e.matchAll(/(#(?:[\da-f]{3,4}){2}|#(?:[\da-f]{3})|rgb\((?:\d{1,3},\s*){2}\d{1,3}\)|rgba\((?:\d{1,3},\s*){3}\d*\.?\d+\)|hsl\(\d{1,3}(?:,\s*\d{1,3}%){2}\)|hsla\(\d{1,3}(?:,\s*\d{1,3}%){2},\s*\d*\.?\d+\))/gi);if(n)for(let r of n){const n=r[0];if(!r.index)continue;const s=n.length;let a="";n.startsWith("hsl(")?a="hsl":n.startsWith("hsla(")?a="hsla":n.startsWith("rgb(")?a="rgb":n.startsWith("rgba(")?a="rgba":n.startsWith("#")&&(a="hex");const o=i.Range.create(this.getPos(e,r.index),this.getPos(e,r.index+n.length)),l=this.parseColorString(n);l&&t.push({color:l,type:a,length:s,range:o})}if(0==this.colorTxtList.length){let e=Object.getOwnPropertyNames(r.ColorInfo.Colors),t=[];for(let n of e)"name"!=n&&"length"!=n&&"prototype"!=n&&t.push(n);this.colorTxtList=t}let s=new RegExp("(?<![\\w\\d.\"'&$-])("+this.colorTxtList.join("|")+")(?![-\\w\\d])","gi");const a=e.matchAll(s);if(a)for(let n of a){const s=n[0];if(!n.index)continue;const a=s.length;let o="hex";const l=i.Range.create(this.getPos(e,n.index),this.getPos(e,n.index+s.length)),c=this.parseColorString(r.ColorInfo.fromName(s).toHex());c&&t.push({color:c,type:o,length:a,range:l})}return t}static onDocumentColor(e){return a.getMatches(e.getText()).map((e=>i.ColorInformation.create(e.range,e.color)))}static onColorPresentations(e,t,n){let s=r.ColorInfo.fromRgb(255*n.red,255*n.green,255*n.blue);s.alpha=n.alpha;s.toString("hex"),s.toString("hsl");let a=e.getText(t);const o=i.ColorPresentation.create(s.toString("hex")),l=i.ColorPresentation.create(s.toString("hexa")),c=i.ColorPresentation.create(s.toString("hsl")),u=i.ColorPresentation.create(s.toString("hsla")),p=i.ColorPresentation.create(s.toString("rgb")),_=i.ColorPresentation.create(s.toString("rgba"));let d=!1;return a.startsWith("#")&&9===a.length&&(d=!0),a.startsWith("hsla")&&(d=!0),a.startsWith("rgba")&&(d=!0),1!==n.alpha&&(d=!0),d?[l,u,_]:[o,c,p]}}t.ColorPicker=a},19408:(e,t)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AventusErrorCode=t.AventusExtension=t.AventusLanguageId=t.AventusType=void 0,function(e){e[e.Component=0]="Component",e[e.Lib=1]="Lib",e[e.Data=2]="Data",e[e.RAM=3]="RAM",e[e.Static=4]="Static",e[e.Definition=5]="Definition",e[e.Unknow=6]="Unknow"}(n||(t.AventusType=n={})),t.AventusLanguageId={Base:"Aventus",TypeScript:"Aventus Ts",HTML:"Aventus HTML",SCSS:"Aventus SCSS",WebComponent:"Aventus WebComponent",Package:"Aventus Ts"},t.AventusExtension={Base:".avt",Config:"aventus.conf.avt",CsharpConfig:"aventus.sharp.avt",ComponentLogic:".wcl.avt",ComponentView:".wcv.avt",ComponentStyle:".wcs.avt",Component:".wc.avt",GlobalStyle:".gs.avt",Data:".data.avt",Lib:".lib.avt",RAM:".ram.avt",State:".state.avt",Static:".static.avt",Definition:".def.avt",DefinitionNpm:".defnpm.avt",Template:"template.avt",Package:".package.avt"},function(e){e[e.Unknow=1e3]="Unknow",e[e.ConfigJsonError=1001]="ConfigJsonError",e[e.NoWebComponent=1002]="NoWebComponent",e[e.MultipleWebComponent=1003]="MultipleWebComponent",e[e.TagLower=1004]="TagLower",e[e.AttributeLower=1005]="AttributeLower",e[e.MissingVariable=1006]="MissingVariable",e[e.ParsingParentFailed=1007]="ParsingParentFailed",e[e.OutsideInterpolation=1008]="OutsideInterpolation",e[e.UsedKeyword=1009]="UsedKeyword",e[e.MissingAttributeForLoop=1010]="MissingAttributeForLoop",e[e.MissingViewElement=1011]="MissingViewElement",e[e.viewElementNotFound=1012]="viewElementNotFound",e[e.MissingInit=1013]="MissingInit",e[e.MissingProp=1014]="MissingProp",e[e.MissingWatchable=1015]="MissingWatchable",e[e.WrongTypeDefinition=1016]="WrongTypeDefinition",e[e.MissingExtension=1017]="MissingExtension",e[e.MissingImplementation=1018]="MissingImplementation",e[e.MissingMethod=1019]="MissingMethod",e[e.FunctionNotAllowed=1020]="FunctionNotAllowed",e[e.VariableNotAllowed=1021]="VariableNotAllowed",e[e.MissingFullName=1022]="MissingFullName",e[e.SameNameFound=1023]="SameNameFound",e[e.ConvertionImpossible=1024]="ConvertionImpossible",e[e.ExclamationMarkMissing=1025]="ExclamationMarkMissing",e[e.QuestionMarkMissing=1026]="QuestionMarkMissing"}(r||(t.AventusErrorCode=r={}))},72375:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalAventusFile=void 0;const r=n(18952),i=n(36790),s=n(1539),a=n(19408),o=n(24964),l=n(29495);t.InternalAventusFile=class{_documentUser;_documentInternal;get documentUser(){return this._documentUser}get documentInternal(){return this._documentInternal}linkInternalAndUser=!0;setDocumentInternal(e){this._documentInternal=e,this._versionInternal=e.version}constructor(e){this._documentUser=e,this._documentInternal=e,this._versionUser=e.version,this._versionInternal=e.version}get uri(){return this.documentUser.uri}get path(){return(0,s.uriToPath)(this.uri)}get name(){return this.path.split("/").pop()??""}_versionUser=0;get versionUser(){return this._versionUser}_versionInternal=0;get versionInternal(){return this._versionInternal}get contentUser(){return this.documentUser.getText()}get contentInternal(){return this.documentInternal.getText()}get folderUri(){return(0,s.getFolder)(this.uri)}get folderPath(){return(0,s.getFolder)(this.path)}_shortname="";get shortname(){if(!this._shortname){let e=this.uri.split("/");this._shortname=e[e.length-1]}return this._shortname}onGetBuildCb={};getBuild(){let e=[];for(let t in this.onGetBuildCb){let n=this.onGetBuildCb[t]();for(let t of n)-1==e.indexOf(t)&&e.push(t)}return e}onGetBuild(e){let t=(0,i.v4)();for(;null!=this.onGetBuildCb[t];)t=(0,i.v4)();return this.onGetBuildCb[t]=e,t}removeOnGetBuild(e){delete this.onGetBuildCb[e]}onValidateCb={};async validate(e=!0){let t={};for(let e in this.onValidateCb){let n=await this.onValidateCb[e](this);for(let e of n){let n=e.message+"**"+e.range.start.line+":"+e.range.start.character+","+e.range.end.line+":"+e.range.end.character;t[n]||(t[n]=e)}}if(e)if(l.SettingsManager.getInstance().settings.errorByBuild){const e=this.getBuild();for(let n of e)o.GenericServer.sendDiagnostics({uri:this.uri,diagnostics:Object.values(t)},n)}else o.GenericServer.sendDiagnostics({uri:this.uri,diagnostics:Object.values(t)});return Object.values(t)}onValidate(e){let t=(0,i.v4)();for(;null!=this.onValidateCb[t];)t=(0,i.v4)();return this.onValidateCb[t]=e,t}removeOnValidate(e){delete this.onValidateCb[e]}onContentChangeCb={};delayValidate;waitingDocContentChange={};resolveContentChange={};triggerContentChange(e){return new Promise((t=>{this.triggerCanContentChange(e)?setTimeout((()=>{this.waitingDocContentChange[e.uri]?(this.resolveContentChange[e.uri]||(this.resolveContentChange[e.uri]={}),this.resolveContentChange[e.uri][e.version]||(this.resolveContentChange[e.uri][e.version]=[]),this.resolveContentChange[e.uri][e.version].push(t),this.waitingDocContentChange[e.uri]=e):(this.waitingDocContentChange[e.uri]=!0,this.resolveContentChange[e.uri]={[e.version]:[t]},this.triggerContentChangeNoBuffer(e))}),0):t()}))}async triggerContentChangeNoBuffer(e){let t=e.version;this._documentUser=e,this._versionUser=e.version,this.linkInternalAndUser&&(this._documentInternal=e,this._versionInternal=e.version);let n=[];for(let e in this.onContentChangeCb)n.push(this.onContentChangeCb[e](this));if(await Promise.all(n),this.delayValidate&&clearTimeout(this.delayValidate),this.delayValidate=setTimeout((async()=>{this.validate()}),500),this.resolveContentChange[e.uri]){let n=Object.keys(this.resolveContentChange[e.uri]);for(let r of n){if(Number(r)>t)break;if(this.resolveContentChange[e.uri][r]){for(let t of this.resolveContentChange[e.uri][r])t();delete this.resolveContentChange[e.uri][r]}}0==Object.keys(this.resolveContentChange[e.uri]).length&&delete this.resolveContentChange[e.uri]}let r=this.waitingDocContentChange[e.uri];r&&"boolean"!=typeof r?(this.waitingDocContentChange[e.uri]=!0,this.triggerContentChangeNoBuffer(r)):delete this.waitingDocContentChange[e.uri]}onContentChange(e){let t=(0,i.v4)();for(;null!=this.onContentChangeCb[t];)t=(0,i.v4)();return this.onContentChangeCb[t]=e,t}removeOnContentChange(e){delete this.onContentChangeCb[e]}onCanContentChangeCb={};triggerCanContentChange(e){for(let t in this.onCanContentChangeCb)if(!this.onCanContentChangeCb[t](e))return!1;return!0}onCanContentChange(e){let t=(0,i.v4)();for(;null!=this.onCanContentChangeCb[t];)t=(0,i.v4)();return this.onCanContentChangeCb[t]=e,t}removeOnCanContentChange(e){delete this.onCanContentChangeCb[e]}async applyTextEdits(e){let t=this.contentUser;e.sort(((e,t)=>this.documentUser.offsetAt(t.range.end)-this.documentUser.offsetAt(e.range.end)));for(let n of e){let e=this.documentUser.offsetAt(n.range.start),r=this.documentUser.offsetAt(n.range.end);t=t.slice(0,e)+n.newText+t.slice(r,t.length)}let n=r.TextDocument.create(this.uri,a.AventusLanguageId.TypeScript,this.documentUser.version+1,t);await this.triggerContentChange(n)}onSaveCb={};async triggerSave(){for(let e in this.onSaveCb)await this.onSaveCb[e](this)}onSave(e){let t=(0,i.v4)();for(;null!=this.onSaveCb[t];)t=(0,i.v4)();return this.onSaveCb[t]=e,t}removeOnSave(e){delete this.onSaveCb[e]}onDeleteCb={};async triggerDelete(){let e=[];for(let t in this.onDeleteCb)e.push(this.onDeleteCb[t](this));await Promise.all(e),this.removeAllCallbacks()}removeAllCallbacks(){this.onCodeActionCb={},this.onCompletionCb={},this.onCompletionResolveCb={},this.onContentChangeCb={},this.onDefinitionCb={},this.onDeleteCb={},this.onFormattingCb={},this.onHoverCb={},this.onSaveCb={}}onDelete(e){let t=(0,i.v4)();for(;null!=this.onDeleteCb[t];)t=(0,i.v4)();return this.onDeleteCb[t]=e,t}removeOnDelete(e){delete this.onDeleteCb[e]}onCompletionCb={};async getCompletion(e){let t={isIncomplete:!1,items:[]},n=[];for(let t in this.onCompletionCb)n.push(this.onCompletionCb[t](this,e));let r=await Promise.all(n),i={};for(let e of r)for(let t of e.items){let e=JSON.stringify(t);i[e]||(i[e]=t)}return t.items=Object.values(i),t}onCompletion(e){let t=(0,i.v4)();for(;null!=this.onCompletionCb[t];)t=(0,i.v4)();return this.onCompletionCb[t]=e,t}removeOnCompletion(e){delete this.onCompletionCb[e]}onCompletionResolveCb={};async getCompletionResolve(e){let t=e,n=[];for(let t in this.onCompletionResolveCb)n.push(this.onCompletionResolveCb[t](this,e));return t}onCompletionResolve(e){let t=(0,i.v4)();for(;null!=this.onCompletionResolveCb[t];)t=(0,i.v4)();return this.onCompletionResolveCb[t]=e,t}removeOnCompletionResolve(e){delete this.onCompletionResolveCb[e]}onHoverCb={};async getHover(e){let t=[];for(let n in this.onHoverCb)t.push(this.onHoverCb[n](this,e));let n=await Promise.all(t);for(let e of n)if(e)return e;return null}onHover(e){let t=(0,i.v4)();for(;null!=this.onHoverCb[t];)t=(0,i.v4)();return this.onHoverCb[t]=e,t}removeOnHover(e){delete this.onHoverCb[e]}onDefinitionCb={};async getDefinition(e){let t=[];for(let n in this.onDefinitionCb)t.push(this.onDefinitionCb[n](this,e));let n=await Promise.all(t);for(let e of n)if(e)return e;return null}onDefinition(e){let t=(0,i.v4)();for(;null!=this.onDefinitionCb[t];)t=(0,i.v4)();return this.onDefinitionCb[t]=e,t}removeOnDefinition(e){delete this.onDefinitionCb[e]}onFormattingCb={};async getFormatting(e){let t={},n=[],r={start:this.documentUser.positionAt(0),end:this.documentUser.positionAt(this.documentUser.getText().length)};for(let t in this.onFormattingCb)n.push(this.onFormattingCb[t](this,r,e));let i=await Promise.all(n);for(let e of i)for(let n of e){let e=JSON.stringify(n);t[e]||(t[e]=n)}return Object.values(t)}onFormatting(e){let t=(0,i.v4)();for(;null!=this.onFormattingCb[t];)t=(0,i.v4)();return this.onFormattingCb[t]=e,t}removeOnFormatting(e){delete this.onFormattingCb[e]}onCodeActionCb={};async getCodeAction(e){let t=[],n=[];for(let t in this.onCodeActionCb)n.push(this.onCodeActionCb[t](this,e));let r=await Promise.all(n);for(let e of r)t=[...t,...e];return t}onCodeAction(e){let t=(0,i.v4)();for(;null!=this.onCodeActionCb[t];)t=(0,i.v4)();return this.onCodeActionCb[t]=e,t}removeOnCodeAction(e){delete this.onCodeActionCb[e]}onReferencesCb={};async getReferences(e){let t=[],n=[];for(let t in this.onReferencesCb)n.push(this.onReferencesCb[t](this,e));let r=await Promise.all(n);for(let e of r)t=[...t,...e];return t}onReferences(e){let t=(0,i.v4)();for(;null!=this.onReferencesCb[t];)t=(0,i.v4)();return this.onReferencesCb[t]=e,t}removeOnReferences(e){delete this.onReferencesCb[e]}onCodeLensCb={};async getCodeLens(){let e=[],t=[];for(let e in this.onCodeLensCb)t.push(this.onCodeLensCb[e](this));let n=await Promise.all(t);for(let t of n)e=[...e,...t];return e}onCodeLens(e){let t=(0,i.v4)();for(;null!=this.onCodeLensCb[t];)t=(0,i.v4)();return this.onCodeLensCb[t]=e,t}removeOnCodeLens(e){delete this.onCodeLensCb[e]}onRenameCb={};async getRename(e,t){let n=[];for(let r in this.onRenameCb)n.push(this.onRenameCb[r](this,e,t));let r=await Promise.all(n);for(let e of r)if(e)return e;return null}onRename(e){let t=(0,i.v4)();for(;null!=this.onRenameCb[t];)t=(0,i.v4)();return this.onRenameCb[t]=e,t}removeOnRename(e){delete this.onRenameCb[e]}}},83693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilesManager=void 0;const r=n(57147),i=n(18952),s=n(19408),a=n(1539),o=n(72375),l=n(36790),c=n(16378),u=n(24964),p=n(71743),_=n(29495),d=n(71017),h=n(40529),f=n(62814);class m{static instance;static getInstance(){return this.instance||(this.instance=new m),this.instance}constructor(){}files={};lockedUpdatedUri={};loadingInProgress=!0;preventUpdateUri(e){this.lockedUpdatedUri[e]&&clearTimeout(this.lockedUpdatedUri[e]),this.lockedUpdatedUri[e]=setTimeout((()=>{delete this.lockedUpdatedUri[e]}),2e3)}async onCreatedUri(e){if(!this.files[e]){let t=(0,a.getLanguageIdByUri)(e),n=(0,a.uriToPath)(e),s=i.TextDocument.create(e,t,0,(0,r.readFileSync)(n,"utf8"));this.registerFile(s)}}async onUpdatedUri(e){if(this.lockedUpdatedUri[e])return;let t=(0,a.getLanguageIdByUri)(e),n=(0,a.uriToPath)(e),s="";if((0,r.existsSync)(n))if(s=(0,r.readFileSync)(n,"utf8"),this.files[e]){let n=this.files[e].versionUser+1,r=i.TextDocument.create(e,t,n,s);await this.onContentChange(r),this.onSave(r)}else{let n=i.TextDocument.create(e,t,0,s);this.registerFile(n)}else this.onDeletedUri(e)}async onDeletedUri(e){if(this.files[e]){if(_.SettingsManager.getInstance().settings.errorByBuild){const t=this.files[e].getBuild();for(let n of t)u.GenericServer.sendDiagnostics({uri:e,diagnostics:[]},n)}else u.GenericServer.sendDiagnostics({uri:e,diagnostics:[]});await this.files[e].triggerDelete(),delete this.files[e],p.FilesWatcher.getInstance().unwatch(e)}}async loadConfigFileNotSet(e,t,n){for(let i=0;i<e.length;i++){let o=(0,a.uriToPath)(e[i]),l=async e=>{let i=(0,r.readdirSync)(e);for(let o=0;o<i.length;o++){let c=e+"/"+i[o];if((0,r.lstatSync)(c).isDirectory()){if("node_modules"!=i[o]&&await l(c))return!0}else{let e=(0,a.pathToUri)(c);if(i[o]==s.AventusExtension.Config)return await this.loadConfigFile(e,t,n),!0}}return!1};if(await l(o))return}u.GenericServer.showErrorMessage("Can't find a aventus.config.avt inside the workspaces "+e.join(", "))}async loadConfigFile(e,t,n){h.ProjectManager.autoLoad=!1;let o=(0,a.uriToPath)(e);e=(0,a.pathToUri)(o);const l=i.TextDocument.create((0,a.pathToUri)(o),s.AventusExtension.Config,0,(0,r.readFileSync)(o,"utf8"));this.loadingInProgress=!1,await this.registerFile(l),this.loadingInProgress=!0;const u=h.ProjectManager.getInstance().getProjectByUri(e);if(u){await u.loadConfig(),u.buildsAllowed=t,u.staticsAllowed=n;const e=u.getConfig();if(e){let n=async e=>{if(!(0,r.existsSync)(e))return;let t=(0,r.readdirSync)(e);for(let o=0;o<t.length;o++){let l=e+"/"+t[o];if((0,r.lstatSync)(l).isDirectory())"node_modules"!=t[o]&&await n(l);else{let e=(0,a.pathToUri)(l),n=(0,a.getLanguageIdByUri)(e);if(t[o]==s.AventusExtension.Config);else if(t[o].endsWith(s.AventusExtension.Base)){let t=i.TextDocument.create(e,n,0,(0,r.readFileSync)(l,"utf8"));await this.registerFile(t)}}}};for(let r of e.build)if(!t||t.includes(r.name))for(let e of r.srcPath)await n(e);f.Statistics.startSendLoadFile(),u.loadFiles(),f.Statistics.sendLoadFile(),this.loadingInProgress=!1,await u.init(),c.InitStep.sendDone()}}}async loadAllAventusFiles(e){this.loadingInProgress=!0;let t=[],n=_.SettingsManager.getInstance().settings.readDirs;c.InitStep.send("$(loading~spin) Aventus : Loading files");for(let o=0;o<e.length;o++){let l=(0,a.uriToPath)(e[o]),c=e=>!0;if(n.length>0){let t=[];const r=[];for(let i of n){let n="",s=i.replace(/\\/g,"/");s.startsWith("/")||(n="/");let l=s.split("/");""==l[l.length-1]||"*"==l[l.length-1]?l[l.length-1]="*":-1==l[l.length-1].indexOf(".")&&l.push("*"),s=l.join("/");let c=(0,d.normalize)((0,a.uriToPath)(e[o])+n+s).replace(/\\/g,"/");c=(0,a.escapeRegex)(c,!0).replace("*",".*");let u=c.split("/"),p="";for(let e of u)".*"!=e&&(""==p?p=e:p+="/"+e,r.includes(p)||r.push(p));t.push("(^"+c+"$)")}let i=t.join("|");""==i&&(i="(?!)");const s=new RegExp(i);c=e=>{const t=null!=(e+"/").match(s),n=r.includes(e);return t||n}}let u=async e=>{if(!c(e))return;let n=(0,r.readdirSync)(e);for(let o=0;o<n.length;o++){let l=e+"/"+n[o];if((0,r.lstatSync)(l).isDirectory())"node_modules"!=n[o]&&await u(l);else{let e=(0,a.pathToUri)(l),c=(0,a.getLanguageIdByUri)(e);if(n[o]==s.AventusExtension.Config)t.push(i.TextDocument.create(e,c,0,(0,r.readFileSync)(l,"utf8")));else if(n[o].endsWith(s.AventusExtension.Base)){let t=i.TextDocument.create(e,c,0,(0,r.readFileSync)(l,"utf8"));await this.registerFile(t)}}}};await u(l)}c.InitStep.send("$(loading~spin) Aventus : Register config"),this.loadingInProgress=!1;for(let e of t)await this.registerFile(e);c.InitStep.sendDone()}async onShutdown(){for(let e in this.files)await this.files[e].triggerDelete(),delete this.files[e],p.FilesWatcher.getInstance().unwatch(e)}async registerFilePackage(e){let t=(0,a.uriToPath)(e),n="";(0,r.existsSync)(t)&&(n=(0,r.readFileSync)(t,"utf8"));let o=i.TextDocument.create(e,s.AventusLanguageId.Package,0,n);return p.FilesWatcher.getInstance().watch(e),await this.registerFile(o)}async registerFile(e){return u.GenericServer.isDebug()&&console.log("registering "+e.uri),this.files[e.uri]?await this.files[e.uri].triggerContentChange(e):await this.triggerOnNewFile(e),this.files[e.uri]}async onContentChange(e){this.files[e.uri]?await this.files[e.uri].triggerContentChange(e):await this.triggerOnNewFile(e)}async onSave(e){this.files[e.uri]?await this.files[e.uri].triggerSave():await this.triggerOnNewFile(e)}async onClose(e){(0,r.existsSync)((0,a.uriToPath)(e.uri))||this.onDeletedUri(e.uri)}async onCompletion(e,t){return this.files[e.uri]?this.files[e.uri].getCompletion(t):{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return this.files[e.uri]?this.files[e.uri].getCompletionResolve(t):t}async onHover(e,t){return this.files[e.uri]?this.files[e.uri].getHover(t):null}async onDefinition(e,t){return this.files[e.uri]?this.files[e.uri].getDefinition(t):null}async onFormatting(e,t){return this.files[e.uri]?this.files[e.uri].getFormatting(t):[]}async onCodeAction(e,t){return this.files[e.uri]?this.files[e.uri].getCodeAction(t):[]}async onReferences(e,t){return this.files[e.uri]?this.files[e.uri].getReferences(t):[]}async onCodeLens(e){return this.files[e.uri]?this.files[e.uri].getCodeLens():[]}async onRename(e,t,n){return this.files[e.uri]?this.files[e.uri].getRename(t,n):null}getBuild(e){return this.files[e.uri]?this.files[e.uri].getBuild():[]}onNewFileCb={};async triggerOnNewFile(e){if(u.GenericServer.isDebug()&&console.log("triggerOnNewFile "+e.uri),this.loadingInProgress&&e.uri.endsWith(s.AventusExtension.Config))return;this.files[e.uri]=new o.InternalAventusFile(e);let t=[];for(let n in this.onNewFileCb)t.push(this.onNewFileCb[n](this.files[e.uri]));await Promise.all(t)}onNewFile(e){let t=(0,l.v4)();for(;null!=this.onNewFileCb[t];)t=(0,l.v4)();return this.onNewFileCb[t]=e,t}removeOnNewFile(e){delete this.onNewFileCb[e]}onFileRemoveCb={};async triggerOnFileRemove(e){u.GenericServer.isDebug()&&console.log("triggerOnFileRemove "+e);let t=[];for(let n in this.onFileRemoveCb)t.push(this.onFileRemoveCb[n](e));await Promise.all(t)}onFileRemove(e){let t=(0,l.v4)();for(;null!=this.onNewFileCb[t];)t=(0,l.v4)();return this.onFileRemoveCb[t]=e,t}removeOnFileRemove(e){delete this.onFileRemoveCb[e]}getFilesMatching(e){let t=[];for(let n in this.files){this.files[n].path.match(e)&&t.push(this.files[n])}return t}getFilesWithExtension(e){Array.isArray(e)||(e=[e]);let t=[];for(let n in this.files)for(let r of e)this.files[n].path.endsWith(r)&&t.push(this.files[n]);return t}getByPath(e){return this.files[(0,a.pathToUri)(e)]}getByUri(e){return this.files[e]}}t.FilesManager=m},71743:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilesWatcher=void 0;const r=n(17452),i=n(1539),s=n(83693),a=n(29495);class o{static instance;static getInstance(){return this.instance||(this.instance=new o),this.instance}watcher;constructor(){a.SettingsManager.getInstance().settings.onlyBuild||(this.watcher=(0,r.watch)("\t",{ignored:/(^|[\/\\])\../,persistent:!0}),this.watcher.on("add",this.onContentChange.bind(this)).on("change",this.onContentChange.bind(this)).on("unlink",this.onRemove.bind(this)))}watcheUris=[];watch(e){if(this.watcheUris.includes(e))return;if(!this.watcher)return;this.watcheUris.push(e);let t=(0,i.uriToPath)(e);this.watcher.add(t)}unwatch(e){let t=this.watcheUris.indexOf(e);-1!=t&&this.watcheUris.splice(t,1)}async onContentChange(e){let t=(0,i.pathToUri)(e);this.watcheUris.includes(t)&&s.FilesManager.getInstance().onUpdatedUri(t)}async onRemove(e){let t=(0,i.pathToUri)(e);this.watcheUris.includes(t)&&s.FilesManager.getInstance().onDeletedUri(t)}async destroy(){await(this.watcher?.close()),o.instance=void 0}}t.FilesWatcher=o},46492:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocalTemplateManager=void 0;const r=n(24964),i=n(1539);t.LocalTemplateManager=class{templateManager;constructor(e){this.templateManager=e}async createTemplate(e){let t=this.readTemplates();const n=await this.templateManager.query(t.templates);n&&await n.init(e)}readTemplates(){let e=this.templateManager.getGeneralTemplates(),t=this.templateManager.getGeneralTemplatesLength(),n=r.GenericServer.getWorkspaceUri();if(n){let r=(0,i.uriToPath)(n)+"/.aventus/templates";return this.templateManager.readTemplates([r],e,t)}return{templates:e,nb:t}}}},74647:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Template=void 0;const r=n(57147),i=n(71017),s=n(57310),a=n(32081),o=n(1539),l=n(40529),c=n(83693),u=n(24964),p=n(17111);t.Template=class{config;folderPath;currentVars={};configVars;currentConfig;filesToOpen=[];constructor(e,t){this.config=e,this.currentConfig=e,this.folderPath=t}async init(e){try{if(this.currentVars={},this.loadConfigVars(),await this.defineDefaultVars(e),await this.prepareNeededVars()){let t=this.moveFiles(e);await this.runCmds();for(let e of t)c.FilesManager.getInstance().onCreatedUri(e);this.openFiles()}}catch(e){console.log(e)}}loadConfigVars(){if(!this.configVars){this.configVars=[];let e=JSON.stringify(this.config);const t=/\$\{\{(.*?)\}\}/gm;let n;for(;null!==(n=t.exec(e));)this.configVars.includes(n[1])||this.configVars.push(n[1])}}async defineDefaultVars(e){let t=e.split(i.sep);this.setVar("folderName",t[t.length-1]),this.setVar("path",e);const n=this.getProjectInfo(e);this.setVar("namespace",n.namespace),this.setVar("module",n.module)}getProjectInfo(e){let t={namespace:"",module:""},n=(0,o.pathToUri)(e),r=l.ProjectManager.getInstance().getMatchingBuildsByUri(n);return r.length>0&&(t.namespace=r[0].getNamespaceForUri(n,!1),t.module=r[0].project.getConfig()?.module??""),t}async prepareNeededVars(){for(let e in this.currentConfig.variables){let t=this.currentConfig.variables[e];if("input"==t.type){let n=t.defaultValue??"";const r=await u.GenericServer.Input({title:t.question,value:n,validations:t.validation?.map((e=>({regex:e.pattern,message:e.errorMsg??"Error"})))});if(!r)return!1;this.setVar(e,r)}}return!0}moveFiles(e){let t=[],n={},s=[];const a=l=>{let c=(0,r.readdirSync)(l);for(let u of c){let c=l+i.sep+u,p=c.replace(this.folderPath,e);for(let e in this.currentVars){const t=new RegExp("\\$\\{\\{"+e+"\\}\\}","gm");p=p.replace(t,this.currentVars[e])}if(p=(0,i.normalize)(p),(0,r.statSync)(c).isDirectory()){if(".git"==u)continue;(0,r.mkdirSync)(p),a(c)}else{if(c==this.folderPath+i.sep+"template.avt")continue;let e=(0,r.readFileSync)(c,"utf-8");for(let t in this.currentVars){const n=new RegExp("\\$\\{\\{"+t+"\\}\\}","gm");e=e.replace(n,this.currentVars[t]);const r=new RegExp("\\$\\{\\{"+t+"\\|lower\\}\\}","gm");e=e.replace(r,this.currentVars[t].toLowerCase())}if(this.currentConfig.filesToOpen)for(let e of this.currentConfig.filesToOpen)this.comparePath(p,e)&&t.push(p);"aventus.conf.avt"!=u?((0,r.writeFileSync)(p,e),p.endsWith(".avt")&&s.push((0,o.pathToUri)(p))):n[p]=e}}};a(this.folderPath);for(let e in n)(0,r.writeFileSync)(e,n[e]),s.push((0,o.pathToUri)(e));return this.filesToOpen=t,s}openFiles(){for(let e of this.filesToOpen)u.GenericServer.sendNotification("aventus/openfile",(0,s.pathToFileURL)(e).toString())}comparePath(e,t){let n=[e],r=(0,o.uriToPath)(u.GenericServer.getWorkspaceUri()),s="."+e.replace(r,"").replace(/\\/g,"/");if(n.push(s),t.match(/\/\S+\/g?m?s?i?x?s?u?/g)){let e=t.split("/"),r=new RegExp(e[1],e[2]);for(let e of n)if(e.match(r))return!0}else{if((0,i.normalize)(e)==(0,i.normalize)(t))return!0;if(n.length>1&&(0,i.normalize)(n[1])==(0,i.normalize)(t))return!0}return!1}setVar(e,t){if(!this.currentVars[e]&&(this.currentVars[e]=t,this.configVars?.includes(e))){const n=new RegExp("\\$\\{\\{"+e+"\\}\\}","gm");let r=JSON.stringify(t).slice(1,-1),i=JSON.stringify(this.currentConfig).replace(n,r);this.currentConfig=JSON.parse(i)}}runCmds(){return new Promise((e=>{setTimeout((()=>{let t={},n=(0,o.uriToPath)(u.GenericServer.getWorkspaceUri());if(t.cwd=n,this.currentConfig.cmdsAfter)for(let e of this.currentConfig.cmdsAfter)try{(0,a.execSync)(e,t)}catch(t){console.log(t),u.GenericServer.showErrorMessage("The command "+e+" failed")}if(this.currentConfig.cmdsAfterAdmin)for(let e of this.currentConfig.cmdsAfterAdmin)try{let t=`cd /d "${n}"`;"darwin"==process.platform&&(t=`cd "${n}"`),(0,p.exec)("cd "+n+" && "+e,((e,t,n)=>{e&&(console.log("error: "+e),console.log("stdout: "+t),console.log("stderr: "+n))}))}catch(t){console.log(t),u.GenericServer.showErrorMessage("The command "+e+" failed")}e()}),500)}))}}},5441:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateManager=void 0;const r=n(57147),i=n(24964),s=n(71017),a=n(74647),o=n(29495),l=n(1539),c=n(61721),u=n(56668),p=n(32081);t.TemplateManager=class{templatePath=[];projectPath=[];loadedTemplates={};loadedProjects={};loadedProjectsLength=0;loadedTemplatesLength=0;getGeneralTemplates(){return this.loadedTemplates}getGeneralTemplatesLength(){return this.loadedTemplatesLength}constructor(){this.loadTemplates(),o.SettingsManager.getInstance().onSettingsChange((()=>{this.loadTemplates()})),this.validateEmptyFolder()}loadTemplates(){let e=i.GenericServer.savePath;(0,r.existsSync)(e)||(0,r.mkdirSync)(e),this.templatePath=o.SettingsManager.getInstance().settings.templatePath;let t=(0,s.normalize)(e+s.sep+"templates");this.prepareFolders(this.templatePath,t),this.projectPath=o.SettingsManager.getInstance().settings.projectPath;let n=(0,s.normalize)(e+s.sep+"projects"),a=!(0,r.existsSync)(n);this.prepareFolders(this.projectPath,n),a&&this.askTemplate(),this.reloadTemplates(),this.reloadProjects()}reloadTemplates(){const e=this.readBaseTemplates(),t=this.readTemplates(this.templatePath,e.templates,e.nb);this.loadedTemplates=t.templates,this.loadedTemplatesLength=t.nb}reloadProjects(){const e=this.readTemplates(this.projectPath);this.loadedProjects=e.templates,this.loadedProjectsLength=e.nb}prepareFolders(e,t){e.includes(t)||e.splice(0,0,t);for(let t=0;t<e.length;t++)e[t]=(0,s.normalize)(e[t]),(0,r.existsSync)(e[t])||(0,r.mkdirSync)(e[t])}async createProject(e){if(0==this.loadedProjectsLength){return void("Yes"==await i.GenericServer.Popup("You have no template for project!! Do you want to load some?","Yes","No")&&this.selectTemplateToImport())}const t=await this.query(this.loadedProjects);t&&await t.init(e)}readBaseTemplates(){const e={};for(let t in u.BaseTemplateList){let n=new u.BaseTemplateList[t];(0,l.setValueToObject)(n.name(),e,n)}return{templates:e,nb:Object.keys(u.BaseTemplateList).length}}readTemplates(e,t={},n=0){const o=e=>{let c=(0,s.join)(e,"template.avt");if((0,r.existsSync)(c)){try{let i=JSON.parse((0,r.readFileSync)(c,"utf-8")),s=new a.Template(i,e);(0,l.setValueToObject)(s.config.name,t,s),n++}catch{i.GenericServer.showErrorMessage("Error when parsing file "+c)}return}let u=(0,r.readdirSync)(e);for(let t of u)try{let n=(0,s.join)(e,t);(0,r.statSync)(n).isDirectory()&&o(n)}catch(e){console.log(e)}};for(let t of e)(0,r.existsSync)(t)&&o(t);return{templates:t,nb:n}}async getGitURL(){return await i.GenericServer.Input({title:"Git url",validations:[{message:"Provide an http(s):// url ending with .git",regex:"^https?:\\//\\S*\\.git$"}]})}async askTemplate(){this.selectProjectToImport()}async selectProjectToImport(){if(0==this.projectPath.length)return void i.GenericServer.showErrorMessage("No project path registered");let e=i.GenericServer.extensionPath+s.sep+"projects",t=(0,r.readdirSync)(e),n=new Map;for(let i of t){let t=e+s.sep+i;if((0,r.statSync)(t).isDirectory()){let e=t+s.sep+"template.avt";if((0,r.existsSync)(e))try{let i=JSON.parse((0,r.readFileSync)(e,"utf-8")),s={label:i.name,detail:i.description??"",picked:!0};n.set(s,t)}catch{}}}n.set({label:"Git",detail:"Provide an http(s) url ending with .git"},"@Git");let a=await i.GenericServer.SelectMultiple(Array.from(n.keys()),{title:"Select projects to import"});if(a){for(let e of a){let t=this.getSelectItem(n,e);if("@Git"==t){const e=await this.getGitURL();e&&(0,p.execSync)("git clone "+e,{cwd:this.projectPath[0]})}else if(t){let e=t.split(s.sep).pop(),n=this.projectPath[0]+s.sep+e;(0,r.existsSync)(n)&&(0,r.rmSync)(n,{recursive:!0,force:!0}),(0,r.cpSync)(t,n,{force:!0,recursive:!0})}}this.reloadProjects()}}async selectTemplateToImport(){if(0==this.templatePath.length)return void i.GenericServer.showErrorMessage("No template path registered");let e=[];e.push({label:"Git",detail:"Provide an http url ending with .git"});let t=await i.GenericServer.Select(e,{title:"Select templates to import"});if(t&&"Git"==t.label){const e=await this.getGitURL();e&&((0,p.execSync)("git clone "+e,{cwd:this.templatePath[0]}),this.reloadTemplates())}}validateEmptyFolder(){let e=i.GenericServer.extensionPath+s.sep+"projects";const t=e=>{try{Array.isArray(e)&&(e=e.join(s.sep)),(0,r.existsSync)(e)||(0,r.mkdirSync)(e)}catch(e){}};t([e,"Default"]),t([e,"Default","src"]),t([e,"Default","src","components"]),t([e,"Default","src","data"]),t([e,"Default","src","lib"]),t([e,"Default","src","ram"]),t([e,"Default","src","states"]),t([e,"Default","src","static"]),t([e,"Empty"]),t([e,"Empty","src"])}getSelectItem(e,t){for(let n of e.keys())if(n.label==t.label)return e.get(n);return null}async query(e){let t=new Map,n=new Map,r=new Map;const s=[];for(let i in e){const o=e[i];let l;o instanceof a.Template?(l={label:i,detail:o.config.description??""},n.set(l,o)):o instanceof c.BaseTemplate?(l={label:i,detail:o.definition()},r.set(l,o)):(l={label:i},t.set(l,o)),s.push(l)}const o=await i.GenericServer.Select(s,{placeHolder:"Choose a template"});if(o){let e=this.getSelectItem(n,o);if(e)return e;let i=this.getSelectItem(r,o);if(i)return i;let s=this.getSelectItem(t,o);if(s)return this.query(s)}return null}}},61721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTemplate=void 0;const r=n(22037),i=n(40529);t.BaseTemplate=class{addNamespace(e,t,n=!1){let s=i.ProjectManager.getInstance().getMatchingBuildsByUri(t);if(s.length>0){let i=s[0].getNamespaceForUri(t,n);""!=i&&(e="\t"+e.split("\n").join("\n\t"),e=`namespace ${i} {${r.EOL}${e}${r.EOL}}`)}return e}}},69342:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ComponentTemplate=void 0;const r=n(57147),i=n(24964),s=n(1539),a=n(61721),o=n(19408),l=n(18952),c=n(22037),u=n(83693),p=n(49404);class _ extends a.BaseTemplate{static componentFormatOptions=[{label:"Single",detail:"Single file"},{label:"Multiple",detail:"Splitted file"}];name(){return"Component.Basic"}definition(){return"Create a basic webcomponent"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your Component"});if(!t)return;const n=await i.GenericServer.Select(_.componentFormatOptions,{placeHolder:"How should I setup your component?"});n&&((0,s.reorderList)(_.componentFormatOptions,n),this.createComponent(t,e,"Multiple"==n.label))}createComponent(e,t,n){let i=(0,s.uriToPath)(t+"/"+e),a=(e=e.replace(/_|-([a-z])/g,((e,t)=>t.toUpperCase()))).charAt(0).toUpperCase()+e.slice(1);if(n){(0,r.mkdirSync)(i);let t=i+"/"+e,n=`export class ${a} extends Aventus.WebComponent implements Aventus.DefaultComponent {\n\n\t//#region static\n\t\n\t//#endregion\n\t\n\t\n\t//#region props\n\t\n\t//#endregion\n\t\n\t\n\t//#region variables\n\t\n\t//#endregion\n\t\n\t\n\t//#region constructor\n\t\n\t//#endregion\n\t\n\t\n\t//#region methods\n\t\n\t//#endregion\n\t\n}`;n=this.addNamespace(n,(0,s.pathToUri)(t+o.AventusExtension.ComponentLogic),!0),(0,r.writeFileSync)(t+o.AventusExtension.ComponentLogic,n);let _=l.TextDocument.create((0,s.pathToUri)(t+o.AventusExtension.ComponentLogic),o.AventusLanguageId.TypeScript,0,n),d=":host {"+c.EOL+"\t"+c.EOL+"}"+c.EOL;(0,r.writeFileSync)(t+o.AventusExtension.ComponentStyle,d);let h=l.TextDocument.create((0,s.pathToUri)(t+o.AventusExtension.ComponentStyle),o.AventusLanguageId.SCSS,0,d),f="<slot></slot>";(0,r.writeFileSync)(t+o.AventusExtension.ComponentView,f);let m=l.TextDocument.create((0,s.pathToUri)(t+o.AventusExtension.ComponentView),o.AventusLanguageId.HTML,0,f);u.FilesManager.getInstance().registerFile(m),u.FilesManager.getInstance().registerFile(h),u.FilesManager.getInstance().registerFile(_),p.OpenFile.send(_.uri)}else{let e=`<script>\n\texport class ${a} extends Aventus.WebComponent implements Aventus.DefaultComponent {\n\n\t}\n<\/script>\n\n<template>\n\t<slot></slot>\n</template>\n\n<style>\n\t:host {\n\n\t}\n</style>\n`;(0,r.writeFileSync)(i+o.AventusExtension.Component,e);let t=l.TextDocument.create((0,s.pathToUri)(i+o.AventusExtension.Component),o.AventusLanguageId.WebComponent,0,e);u.FilesManager.getInstance().registerFile(t),p.OpenFile.send(t.uri)}}}t.ComponentTemplate=_},44502:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataTemplate=void 0;const r=n(22037),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(57147),c=n(18952),u=n(83693),p=n(49404);class _ extends o.BaseTemplate{name(){return"Data.Basic"}definition(){return"Create a basic data"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your Data"});t&&this.createData(t,e)}createData(e,t){let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.Data),i=(0,a.pathToUri)(n),o=`export class ${(e=e.replace(/_|-([a-z])/g,((e,t)=>t.toUpperCase()))).charAt(0).toUpperCase()+e.slice(1)} extends Aventus.Data implements Aventus.IData {${r.EOL}\tpublic id: number = 0;${r.EOL}}`;o=this.addNamespace(o,i),(0,l.writeFileSync)(n,o);let _=c.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);u.FilesManager.getInstance().registerFile(_),p.OpenFile.send(_.uri)}}t.DataTemplate=_},45905:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LibraryTemplate=void 0;const r=n(22037),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(57147),c=n(18952),u=n(83693),p=n(49404);class _ extends o.BaseTemplate{name(){return"Library.Default Class Library"}definition(){return"Create a basic library class"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your Library"});t&&this.createLib(t,e)}createLib(e,t){let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.Lib),i=(0,a.pathToUri)(n),o=`export class ${(e=e.replace(/_|-([a-z])/g,((e,t)=>t.toUpperCase()))).charAt(0).toUpperCase()+e.slice(1)} {${r.EOL}\t${r.EOL}}`;o=this.addNamespace(o,i),(0,l.writeFileSync)(n,o);let _=c.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);u.FilesManager.getInstance().registerFile(_),p.OpenFile.send(_.uri)}}t.LibraryTemplate=_},86147:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RamTemplate=void 0;const r=n(57147),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(18952),c=n(83693),u=n(49404);class p extends o.BaseTemplate{definition(){return"Create a basic RAM"}name(){return"RAM.Basic"}async init(e){const t=await i.GenericServer.Input({title:"Provide a data name for your RAM"});if(!t)return;const n=await i.GenericServer.Select([{label:"Yes"},{label:"No"}],{title:"Do you need to add custom methods on RAM"});if(!n)return;let r="Yes"==n.label;this.createRAM(t,e,r)}createRAM(e,t,n){e=e.charAt(0).toUpperCase()+e.slice(1);let i=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.RAM),o=(0,a.pathToUri)(i),p=e+"RAM",_="";_=n?`\ninterface ${e}Method {\n\t// define your methods here\n\t\n}\n\nexport type ${e}Extended = ${e} & ${e}Method;\n\nexport class ${p} extends Aventus.Ram<${e}, ${e}Extended> implements Aventus.IRam {\n\n\t/**\n\t * Create a singleton to store data\n\t */\n\tpublic static getInstance(): ${p} {\n\t\treturn Aventus.Instance.get(${p});\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic override defineIndexKey(): keyof ${e} {\n\t\treturn 'id';\n\t}\n\t/**\n\t * @inheritdoc\n\t */\n\tprotected override getTypeForData(objJson: Aventus.KeysObject<${e}> | ${e}): new () => ${e}Extended {\n\t\treturn this.add${e}Method(${e});\n\t}\n\n\t/**\n\t * Mixin pattern to add methods\n\t */\n\tprivate add${e}Method<B extends (new (...args: any[]) => ${e}) & { className?: string; }>(Base: B) {\n\t\treturn class Extension extends Base implements ${e}Extended {\n\t\t\tpublic static override get className(): string {\n return Base.className || Base.name;\n }\n public override get className(): string {\n return Base.className || Base.name;\n }\n\n\t\t\t// code your methods here\n\n\t\t\t\n\t\t};\n\t}\n\n}`:`\nexport class ${p} extends Aventus.Ram<${e}> implements Aventus.IRam {\n\n\t/**\n\t * Create a singleton to store data\n\t */\n\tpublic static getInstance(): ${p} {\n\t\treturn Aventus.Instance.get(${p});\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic override defineIndexKey(): keyof ${e} {\n\t\treturn 'id';\n\t}\n\t/**\n\t * @inheritdoc\n\t */\n\tprotected override getTypeForData(objJson: Aventus.KeysObject<${e}> | ${e}): new () => ${e} {\n\t\treturn ${e};\n\t}\n}`,_=this.addNamespace(_,o),(0,r.writeFileSync)(i,_);let d=l.TextDocument.create(o,s.AventusLanguageId.TypeScript,0,_);c.FilesManager.getInstance().registerFile(d),u.OpenFile.send(o)}}t.RamTemplate=p},54850:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateManagerTemplate=void 0;const r=n(57147),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(18952),c=n(83693),u=n(49404);class p extends o.BaseTemplate{name(){return"State.Basic State Manager"}definition(){return"Create a basic state manager"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your State Manager"});t&&this.createState(t,e)}createState(e,t){e=e.charAt(0).toUpperCase()+e.slice(1);let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.State),i=(0,a.pathToUri)(n),o="";e.endsWith("Manager")&&e.replace("Manager",""),o=`export class ${e}StateManager extends Aventus.StateManager implements Aventus.IStateManager {\n\t/**\n\t * Get the instance of the StateManager\n\t */\n\tpublic static getInstance(): ${e}StateManager {\n\t\treturn Aventus.Instance.get(${e}StateManager);\n\t}\n\n}`,o=this.addNamespace(o,i),(0,r.writeFileSync)(n,o);let p=l.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);c.FilesManager.getInstance().registerFile(p),u.OpenFile.send(i)}}t.StateManagerTemplate=p},97771:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateTemplate=void 0;const r=n(57147),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(18952),c=n(83693),u=n(49404);class p extends o.BaseTemplate{name(){return"State.Basic State"}definition(){return"Create a basic state"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your State"});t&&this.createState(t,e)}createState(e,t){e=e.charAt(0).toUpperCase()+e.slice(1);let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.State),i=(0,a.pathToUri)(n),o="";o=`export class ${e} extends Aventus.State implements Aventus.IState {\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic override get name(): string {\n\t\treturn ;\n\t}\n}`,o=this.addNamespace(o,i),(0,r.writeFileSync)(n,o);let p=l.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);c.FilesManager.getInstance().registerFile(p),u.OpenFile.send(i)}}t.StateTemplate=p},56668:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTemplateList=void 0;const r=n(69342),i=n(44502),s=n(45905),a=n(86147),o=n(54850),l=n(97771);t.BaseTemplateList={ComponentTemplate:r.ComponentTemplate,DataTemplate:i.DataTemplate,LibraryTemplate:s.LibraryTemplate,RamTemplate:a.RamTemplate,StateManagerTemplate:o.StateManagerTemplate,StateTemplate:l.StateTemplate}},67246:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusBaseFile=void 0;const r=n(42374),i=n(72375);t.AventusBaseFile=class{_file;_build;get file(){return this._file}get build(){return this._build}constructor(e,t){this._file=e,this._build=t,this.addEvents()}uuidEvents={onCanContentChange:"",onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onGetBuild:"",onRename:""};addEvents(){this.uuidEvents.onCanContentChange=this.file.onCanContentChange(this.onCanContentChange.bind(this)),this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onGetBuild=this.file.onGetBuild(this.onGetBuild.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnCanContentChange(this.uuidEvents.onCanContentChange),this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnGetBuild(this.uuidEvents.onGetBuild),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof i.InternalAventusFile&&await this.file.validate()}async triggerSave(){this.file instanceof i.InternalAventusFile&&await this.file.triggerSave()}async triggerDelete(){this.file instanceof i.InternalAventusFile&&await this.file.triggerDelete()}async triggerContentChange(e){this.file instanceof i.InternalAventusFile&&await this.file.triggerContentChange(e)}onCanContentChange(e){return this._file.versionUser!=e.version}oldResult=[];async _onValidate(){let e=this._build.diagnostics.get(this)??[];return e=[...e,...await this.onValidate()],this.build&&this.build.hideWarnings&&(e=e.filter((e=>e.severity!=r.DiagnosticSeverity.Warning))),this.oldResult=e,e}async _onDelete(){await this.onDelete(),this.removeEvents()}}},37071:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusGlobalBaseFile=void 0;const r=n(72375);t.AventusGlobalBaseFile=class{_file;_project;get file(){return this._file}get project(){return this._project}constructor(e,t){this._file=e,this._project=t,this.addEvents()}uuidEvents={onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onRename:""};addEvents(){this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof r.InternalAventusFile&&await this.file.validate()}triggerSave(){this.file instanceof r.InternalAventusFile&&this.file.triggerSave()}async triggerContentChange(){this.file instanceof r.InternalAventusFile&&await this.file.triggerContentChange(this.file.documentUser)}async _onValidate(){return await this.onValidate()}async _onDelete(){await this.onDelete(),this.removeEvents()}}},95896:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusHTMLFile=void 0;const r=n(19408),i=n(67246),s=n(16286),a=n(57999),o=n(56733),l=n(18952),c=n(28180);class u extends i.AventusBaseFile{fileParsed;tsErrors=[];version=-1;get compiledVersion(){return this.version}get tsFile(){let e=this.build.tsFiles[this.file.uri.replace(r.AventusExtension.ComponentView,r.AventusExtension.ComponentLogic)];return e instanceof s.AventusWebComponentLogicalFile?e:null}get scssFile(){let e=this.build.scssFiles[this.file.uri.replace(r.AventusExtension.ComponentView,r.AventusExtension.ComponentStyle)];return e instanceof o.AventusWebSCSSFile?e:null}constructor(e,t){super(e,t)}async init(){await this.refreshFileParsed()}refreshFileParsed(){this.fileParsed=a.ParserHtml.parse(this,this.build);let e=a.ParserHtml.getVersion(this);return this.version!=e&&(this.version=e,this.file.validate(),!0)}async onValidate(){let e=await this.build.htmlLanguageService.doValidation(this.file);return this.fileParsed&&(e=[...e,...this.fileParsed.errors]),e=[...e,...this.tsErrors],this.tsFile&&(e=[...e,...this.tsFile.htmlDiagnostics]),e}async onContentChange(){await this.compile()}async onSave(){await(this.tsFile?.triggerSave())}async compile(){try{this.refreshFileParsed()&&await(this.tsFile?.validate())}catch(e){console.error(e)}}async onDelete(){}async onCompletion(e,t){let n=await(this.tsFile?.doViewCompletion(t));return n||this.build.htmlLanguageService.doComplete(this,t)}async onCompletionResolve(e,t){return t}async getHover(e){return this.onHover(this.file,this.file.documentUser.positionAt(e))}async onHover(e,t){let n=await(this.tsFile?.doHover(t));return n||await this.build.htmlLanguageService.doHover(this,t)}async onDefinition(e,t){let n=await(this.tsFile?.doDefinition(t));return n||this.build.htmlLanguageService.onDefinition(this,t)}async onFormatting(e,t,n){await this.compile();let r=await this.applyJsFormatting(t,n);return this.applyHtmlFormatting(e,t,n,r)}async applyJsFormatting(e,t){let n=await(this.tsFile?.doFormatting(e,t))??[];if(!this.fileParsed)return{};let r=new Map,i=new Map,s=new Map;for(let e of n)if("fct"==e.kind)for(let t in this.fileParsed.fcts){let n=this.fileParsed.fcts[t];if(n.positions.find((t=>t.start==e.start&&t.end==e.end))){let t=r.get(n);t||(t=[],r.set(n,t)),t.push({start:e.edit.range.start-e.start,end:e.edit.range.end-e.start,txt:e.edit.newText});break}}else if("loop"==e.kind){for(let t of this.fileParsed.loops)if(t.start==e.start&&t.startBlock==e.end){let n=i.get(t);n||(n=[],i.set(t,n)),n.push({start:e.edit.range.start-e.start,end:e.edit.range.end-e.start,txt:e.edit.newText})}}else if("if"==e.kind)for(let t of this.fileParsed.ifs)for(let n of t.conditions)if(n.start==e.start&&n.end==e.end){let t=s.get(n);t||(t=[],s.set(n,t)),t.push({start:e.edit.range.start-e.start,end:e.edit.range.end-e.start,txt:e.edit.newText})}let a={};for(let[e,t]of r){let n="{{"+e.txt+"}}";a[n]=n,t.sort(((e,t)=>t.end-e.end));for(let e of t)a[n]=a[n].slice(0,e.start)+e.txt+a[n].slice(e.end)}for(let[e,t]of i){let n=e.idTemplate,r=e.loopTxt;t.sort(((e,t)=>t.end-e.end));for(let e of t)r=r.slice(0,e.start)+e.txt+r.slice(e.end);r=r.slice(0,r.length-1),a["<"+c.ForLoop.tagName+' id="'+n+'">']=r}for(let e of this.fileParsed.loops)i.has(e)||(a["<"+c.ForLoop.tagName+' id="'+e.idTemplate+'">']=e.loopTxt.slice(0,e.loopTxt.length-1));for(let[e,t]of s){let n=e.idTemplate,r=e.txt;t.sort(((e,t)=>t.end-e.end));for(let e of t)r=r.slice(0,e.start)+e.txt+r.slice(e.end);"if"==e.type?r="if("+r+") {":"elif"==e.type&&(r="else if("+r+") {"),a["<"+c.IfInfo.tagName+' id="'+n+'">']=r}for(let e of this.fileParsed.ifs){for(let t of e.conditions)if(!s.has(t)){let e=t.txt;"if"==t.type?e="if("+e+") {":"elif"==t.type&&(e="else if("+e+") {"),a["<"+c.IfInfo.tagName+' id="'+t.idTemplate+'">']=e}e.conditions.length!=e.idsTemplate.length&&(a["<"+c.IfInfo.tagName+' id="'+e.idsTemplate[e.idsTemplate.length-1]+'">']="else {")}for(let e of this.fileParsed.contextEdits){let t="@Context("+(e.mapping.length>0?e.mapping[0]:"")+", "+(e.mapping.length>1?e.mapping[1]:"")+")";a["<"+c.ContextEditing.tagName+' id="'+e.id+'"></'+c.ContextEditing.tagName+">"]=t}return a["</"+c.ForLoop.tagName+">"]="}",a["</"+c.IfInfo.tagName+">"]="}",a}async applyHtmlFormatting(e,t,n,r){if(!this.fileParsed)return[];let i=this.fileParsed?.compiledTxt,s=l.TextDocument.create(e.documentUser.uri,e.documentUser.languageId,e.documentUser.version,i),a=(await this.build.htmlLanguageService.format(s,t,n))[0].newText;for(let e in r){let t=new RegExp(e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"g");a=a.replace(t,r[e])}return a=a.replace(/\{\{ *([^\n][\s|\S]*?) *\n?\}\}/g,"{{ $1 }}"),[{newText:a,range:{start:e.documentUser.positionAt(0),end:e.documentUser.positionAt(e.contentUser.length)}}]}async onCodeAction(e,t){return[]}async onReferences(e,t){let n=await(this.tsFile?.doReferences(t));return n||this.build.htmlLanguageService.getLinkToStyle(this,t)}async onCodeLens(e){return[]}onGetBuild(){return[this.build]}async onRename(e,t,n){let r=await(this.tsFile?.doRename(t,n));return r||null}}t.AventusHTMLFile=u},38344:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusHTMLLanguageService=void 0;const r=n(7082),i=n(42374),s=n(19408),a=n(61949),o=n(46057),l=n(37559),c=n(65887),u=n(1539);t.AventusHTMLLanguageService=class{languageService;id=0;isAutoComplete=!1;customTagsData=[];documentationInfo={};extenalDocumentation={};internalDocumentation={};internalDocumentationReverse={};internalTagUri={};constructor(e){this.languageService=this.getHTMLLanguageService()}getInternalDocumentation(){let e={};for(let t in this.internalDocumentation)try{e={...e,...this.internalDocumentation[t]}}catch(e){}return e}getClassByTag(e){let t=this.documentationInfo[e];return t?t.class:null}getGenericHTML(e){return a.allGenericTags[e]?a.allGenericTags[e]:null}getHTMLLanguageService(){return(0,r.getLanguageService)({useDefaultDataProvider:!0,customDataProviders:[{getId:this.getId.bind(this),isApplicable:e=>e==s.AventusLanguageId.HTML,provideTags:this.provideTags.bind(this),provideAttributes:this.provideAttributes.bind(this),provideValues:this.provideValues.bind(this)}]})}getId(){return this.id+""}provideTags(){return this.customTagsData}provideAttributes(e){let t=[...a.defaultAttrs];if(this.documentationInfo[e]){let n=this.documentationInfo[e].attributes;for(let e in n){let r=n[e];this.isAutoComplete?t.push({name:"!!"+r.name,description:JSON.stringify({description:r.description,type:r.type})}):t.push({name:r.name,description:r.description})}}return t}provideValues(e,t){return this.documentationInfo[e]&&this.documentationInfo[e].attributes[t]?this.documentationInfo[e].attributes[t].values:[]}async doValidation(e){return[]}async doComplete(e,t){let n=this.languageService.parseHTMLDocument(e.file.documentUser);if(n){this.isAutoComplete=!0;let r=this.languageService.doComplete(e.file.documentUser,t,n);this.isAutoComplete=!1;for(let e of r.items){if(e.label.startsWith("!!")&&(e.kind=i.CompletionItemKind.Snippet,e.textEdit)){let t=e.label.replace("!!","");if(e.textEdit.newText=e.textEdit.newText.replace(e.label,t),e.documentation){let t=JSON.parse(e.documentation.value);""==t.description&&delete e.documentation,"boolean"==t.type&&(e.textEdit.newText=e.textEdit.newText.split("=")[0])}e.label=t}e.kind==i.CompletionItemKind.Property&&e.textEdit&&(e.textEdit.newText.endsWith(">")||(e.textEdit.newText+="></"+e.textEdit.newText+">"))}return r.items=r.items.concat(this.doCustomComplete(e,t)),r}return{isIncomplete:!1,items:[]}}doCustomComplete(e,t){let n=[];if(!e.fileParsed)return n;let s=e.file.documentUser,o=s.offsetAt(t);for(let t of e.fileParsed.tags){if(o<t.start)break;if(o>=t.openTagStart&&o<=t.openTagEnd)return n}let l=(0,u.convertRange)(s,(0,u.getWordAtText)(s.getText(),o)),c=s.getText().slice(s.offsetAt(l.start),s.offsetAt(l.end));for(let e in a.defaultSnippet)e.startsWith(c)&&n.push({label:e,kind:i.CompletionItemKind.Snippet,insertText:a.defaultSnippet[e],insertTextFormat:r.InsertTextFormat.Snippet,insertTextMode:r.InsertTextMode.adjustIndentation});return n}async doHover(e,t){let n=this.getLinkToLogic(e,t);if(n)return{contents:{kind:"markdown",value:n.documentation?.fullDefinitions.join("\n")??""}};{let n=this.languageService.parseHTMLDocument(e.file.documentUser);if(n)return this.languageService.doHover(e.file.documentUser,t,n)}return null}async format(e,t,n){return this.languageService.format(e,t,n)}async onDefinition(e,t){let n=this.getLinkToLogic(e,t),r=e.tsFile;return(n instanceof o.MethodInfo||n instanceof l.PropertyInfo)&&r?{uri:r.file.uri,range:{start:r.file.documentUser.positionAt(n.nameStart),end:r.file.documentUser.positionAt(n.nameEnd)}}:n instanceof c.ClassInfo?{uri:n.document.uri,range:{start:n.document.positionAt(n.nameStart),end:n.document.positionAt(n.nameEnd)}}:null}getLinkToLogic(e,t){let n=e.file.documentUser.offsetAt(t),r=e.tsFile,i=r?.fileParsed?.classes[r.getComponentName()];if(r&&i&&e.fileParsed)for(let t of e.fileParsed.interestPoints){if(n>=t.start&&n<=t.end){let n=null;if("method"==t.type)n=i.methods[t.name];else if("property"==t.type)n=i.properties[t.name];else if("tag"==t.type){let n=this.documentationInfo[t.name];if(n){let t=this.internalDocumentationReverse[n.class];if(t&&t.fileParsed)for(let e in t.fileParsed.classes)if(e==n.class)return t.fileParsed.classes[e];let r=e.build.getWebComponentDefinition(n.name,!0);if(r)return r.class}}return n}if(t.end>=n)return null}return null}getLinkToStyle(e,t){let n=[],r=e.file.documentUser.offsetAt(t),i=e.scssFile;if(i&&e.fileParsed)for(let t of e.fileParsed.styleLinks){let e=t[0];r>=e.start&&r<=e.end&&n.push({uri:i.file.uri,range:{start:i.file.documentUser.positionAt(t[1].start),end:i.file.documentUser.positionAt(t[1].end)}})}return n}rebuildDefinition(){this.documentationInfo={};for(let e in this.extenalDocumentation){let t=this.extenalDocumentation[e];this.documentationInfo={...this.documentationInfo,...t}}for(let e in this.internalDocumentation){let t=this.internalDocumentation[e];try{this.documentationInfo={...this.documentationInfo,...t}}catch(e){}}this.customTagsData=[{name:"block",attributes:[{name:"name"}]}];let e=[];for(let t in this.documentationInfo){let n=this.documentationInfo[t];if(-1==e.indexOf(n.name)){e.push(n.name);let t=[],r={name:n.name,description:n.description,attributes:t};for(let e in n.attributes){let r=n.attributes[e];t.push({name:r.name,description:r.description,values:r.values})}this.customTagsData.push(r)}}}addExternalDefinition(e,t){this.extenalDocumentation[e]=t,this.rebuildDefinition()}removeExternalDefinition(e){delete this.extenalDocumentation[e],this.rebuildDefinition()}getInternalDefinition(e){let t=this.documentationInfo[e];if(t)return this.internalDocumentationReverse[t.class]}addInternalDefinition(e,t,n){this.internalDocumentation[e]=t;for(let e in t)this.internalDocumentationReverse[t[e].class]=n;this.rebuildDefinition()}removeInternalDefinition(e){let t=this.internalDocumentation[e];if(t)for(let e in t)delete this.internalDocumentationReverse[t[e].class];delete this.internalDocumentation[e],this.rebuildDefinition()}getInternalTagUri(e){return this.internalTagUri[e]}addInternalTagUri(e,t,n){this.internalTagUri[e]={uri:t,fullname:n}}removeInternalTagUri(e){for(let t in this.internalTagUri)if(this.internalTagUri[t].uri==e)return void delete this.internalTagUri[t]}}},61949:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultSnippet=t.allGenericTags=t.defaultAttrs=void 0,t.defaultTags=function(){return[]},t.defaultAttrs=[{name:"@element",description:"Add a selector for the element inside your logical part"},{name:"@bind",description:"Bind a watcher to a variable"},{name:"@press",description:"Add an event for when the element is clicked"},{name:"@press-start",description:"Add an event for when mouse down or touch start on the element"},{name:"@press-stop",description:"Add an event for when mouse up or touch start on the element"},{name:"@longpress",description:"Add an event for when the element is long pressed"},{name:"@longpress-delay",description:"Add the delay for the long press"},{name:"@dblpress",description:"Add an event for when the element is double press"},{name:"@dblpress-delay",description:"Add the delay for the double press"},{name:"@drag",description:"Add an event for when the element is dragged"},{name:"@drag-start",description:"Add an event for when the element first drag"},{name:"@drag-end",description:"Add an event for when the element drag end"}],t.allGenericTags={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",footer:"HTMLElement",form:"HTMLFormElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement",acronym:"HTMLElement",applet:"HTMLUnknownElement",basefont:"HTMLElement",bgsound:"HTMLUnknownElement",big:"HTMLElement",blink:"HTMLUnknownElement",center:"HTMLElement",dir:"HTMLDirectoryElement",font:"HTMLFontElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",isindex:"HTMLUnknownElement",keygen:"HTMLUnknownElement",listing:"HTMLPreElement",marquee:"HTMLMarqueeElement",menuitem:"HTMLElement",multicol:"HTMLUnknownElement",nextid:"HTMLUnknownElement",nobr:"HTMLElement",noembed:"HTMLElement",noframes:"HTMLElement",param:"HTMLParamElement",plaintext:"HTMLElement",rb:"HTMLElement",rtc:"HTMLElement",spacer:"HTMLUnknownElement",strike:"HTMLElement",tt:"HTMLElement",xmp:"HTMLPreElement",animate:"SVGAnimateElement",animateMotion:"SVGAnimateMotionElement",animateTransform:"SVGAnimateTransformElement",circle:"SVGCircleElement",clipPath:"SVGClipPathElement",defs:"SVGDefsElement",desc:"SVGDescElement",ellipse:"SVGEllipseElement",feBlend:"SVGFEBlendElement",feColorMatrix:"SVGFEColorMatrixElement",feComponentTransfer:"SVGFEComponentTransferElement",feComposite:"SVGFECompositeElement",feConvolveMatrix:"SVGFEConvolveMatrixElement",feDiffuseLighting:"SVGFEDiffuseLightingElement",feDisplacementMap:"SVGFEDisplacementMapElement",feDistantLight:"SVGFEDistantLightElement",feDropShadow:"SVGFEDropShadowElement",feFlood:"SVGFEFloodElement",feFuncA:"SVGFEFuncAElement",feFuncB:"SVGFEFuncBElement",feFuncG:"SVGFEFuncGElement",feFuncR:"SVGFEFuncRElement",feGaussianBlur:"SVGFEGaussianBlurElement",feImage:"SVGFEImageElement",feMerge:"SVGFEMergeElement",feMergeNode:"SVGFEMergeNodeElement",feMorphology:"SVGFEMorphologyElement",feOffset:"SVGFEOffsetElement",fePointLight:"SVGFEPointLightElement",feSpecularLighting:"SVGFESpecularLightingElement",feSpotLight:"SVGFESpotLightElement",feTile:"SVGFETileElement",feTurbulence:"SVGFETurbulenceElement",filter:"SVGFilterElement",foreignObject:"SVGForeignObjectElement",g:"SVGGElement",image:"SVGImageElement",line:"SVGLineElement",linearGradient:"SVGLinearGradientElement",marker:"SVGMarkerElement",mask:"SVGMaskElement",metadata:"SVGMetadataElement",mpath:"SVGMPathElement",path:"SVGPathElement",pattern:"SVGPatternElement",polygon:"SVGPolygonElement",polyline:"SVGPolylineElement",radialGradient:"SVGRadialGradientElement",rect:"SVGRectElement",set:"SVGSetElement",stop:"SVGStopElement",svg:"SVGSVGElement",switch:"SVGSwitchElement",symbol:"SVGSymbolElement",text:"SVGTextElement",textPath:"SVGTextPathElement",tspan:"SVGTSpanElement",use:"SVGUseElement",view:"SVGViewElement"},t.defaultSnippet={for:"for(let ${1:i} = 0; ${1:i} < ${2:this.elements}; ${1:i}++) {\n\t${3}\n}",forIn:"for(let ${1:index} in ${2:this.elements}) {\n\t${3}\n}",forOf:"for(let ${1:element} of ${2:this.elements}) {\n\t${3}\n}",if:"if(${1:true}) {\n\t${2}\n}","else if":"else if(${1:true}) {\n\t${2}\n}",else:"else {\n\t${1}\n}","@Context":"@Context('${1:element}', ${2:this.elements[i]})"}},57999:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParserHtml=void 0;const r=n(42374),i=n(18952),s=n(19408),a=n(7082),o=n(28180),l=n(1539),c=n(94625),u=n(61586);class p{static languageService=(0,a.getLanguageService)();static parsedDoc={};static getVersion(e){return p.parsedDoc[e.file.uri]?this.parsedDoc[e.file.uri].version:0}static parse(e,t){return p.parsedDoc[e.file.uri]&&this.parsedDoc[e.file.uri].version==e.file.versionUser?this.parsedDoc[e.file.uri].result:(new p(e,t),p.parsedDoc[e.file.uri].result)}static currentParsingDoc;static addError(e,t,n){if(this.currentParsingDoc){let i={range:r.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:r.DiagnosticSeverity.Error,source:s.AventusLanguageId.HTML,message:n};this.currentParsingDoc.errors.push(i)}}static addWarning(e,t,n){if(this.currentParsingDoc){let i={range:r.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:r.DiagnosticSeverity.Warning,source:s.AventusLanguageId.TypeScript,message:n};this.currentParsingDoc.errors.push(i)}}static mergeTemplateResult(e,t){e.events=[...e.events,...t.events],e.pressEvents=[...e.pressEvents,...t.pressEvents],e.loops=[...e.loops,...t.loops],e.ifs=[...e.ifs,...t.ifs],e.content={...e.content,...t.content},e.contextEdits=[...e.contextEdits,...t.contextEdits],e.injection=[...e.injection,...t.injection],e.bindings=[...e.bindings,...t.bindings];for(let n of t.elements){let t=!1;for(let r of e.elements)if(r.name==n.name){t=!0;for(let e of n.ids)r.ids.includes(e)||r.ids.push(e);for(let e in n.tags)r.tags[e]?r.tags[e]+=n.tags[e]:r.tags[e]=n.tags[e];if(!r.isArray)if(n.isArray)r.isArray=!0;else{let e=Object.values(r.tags).reduce(((e,t)=>e+t),0);r.isArray=e>1}r.positions=[...r.positions,...n.positions]}t||e.elements.push(n)}}static addInterestPoint(e){this.currentParsingDoc&&this.currentParsingDoc.interestPoints.push(e)}static addStyleLink(e){this.currentParsingDoc&&this.currentParsingDoc.styleLinks.push(e)}static getRules(){return this.currentParsingDoc?this.currentParsingDoc.rules:new Map}static refreshStyle(e,t){if(p.parsedDoc[e.file.uri]&&this.parsedDoc[e.file.uri].version==e.file.versionUser){let t=this.parsedDoc[e.file.uri];t.result.styleLinks=[],t.result.rules=e.scssFile?.rules??new Map;for(let e of t.result.tags)e.checkStyle(t.result.rules,(e=>{t.result.styleLinks.push(e)}))}this.parse(e,t)}static idElement=0;static idTemplate=0;static createIdTemplate(){let e=this.idTemplate;return this.idTemplate++,e}static getCustomFctName(e=0){if(this.currentParsingDoc?.htmlFile.tsFile){let t=this.currentParsingDoc.ifs.reduce(((e,t)=>e+t.conditions.length),0),n=this.currentParsingDoc.loops.length+this.currentParsingDoc.loops.reduce(((e,t)=>t.isSimple?e:e+1),0),r=e+Object.keys(this.currentParsingDoc.fcts).length+n+t+this.currentParsingDoc.contextEdits.length+this.currentParsingDoc.injections.length+2*this.currentParsingDoc.bindings.length;return this.currentParsingDoc.htmlFile.tsFile?.viewMethodName+r}return null}static createChange(e){if(this.currentParsingDoc){let t=u(e.txt);if(this.currentParsingDoc.fcts[t])return this.currentParsingDoc.fcts[t].positions.push({start:e.start,end:e.end}),this.currentParsingDoc.fcts[t];{let n=this.getCustomFctName(),r=this.getVariables();if(n){let i={name:n,positions:[{start:e.start,end:e.end}],txt:e.txt,variables:r};return this.currentParsingDoc.fcts[t]=i,i}}}return null}static fromRawToCompiled(e){return this.currentParsingDoc?this.currentParsingDoc.fromRawToCompiled(e):e}static fromCompiledToRaw(e){return this.currentParsingDoc?this.currentParsingDoc.fromCompiledToRaw(e):e}static addLoopStack(e){if(this.currentParsingDoc){let t=this.currentParsingDoc.loops.find((t=>t.idTemplate==e));if(t)return t.recalculateVariables(),this.currentParsingDoc?.stacks.push(t),t}return null}static addIfStack(e){if(this.currentParsingDoc)for(let t of this.currentParsingDoc.ifs)if(t.idsTemplate.includes(e))return t.recalculateVariables(e),this.currentParsingDoc?.stacks.push({idTemplate:e}),t;return null}static addInjection(e){this.currentParsingDoc?.injections.push(e)}static addBinding(e){this.currentParsingDoc?.bindings.push(e)}static addTagInfoStack(e){this.currentParsingDoc?.stacks.push(e)}static getContextEditing(e){return this.currentParsingDoc?.contextEdits.find((t=>t.id==e))}static removeStack(){this.currentParsingDoc?.stacks.pop()}static getParentId(){if(this.currentParsingDoc&&this.currentParsingDoc.stacks.length>0)for(let e=this.currentParsingDoc.stacks.length-1;e>=0;e--){let t=this.currentParsingDoc.stacks[e];if(t instanceof o.ForLoop)return t.idTemplate;if(!(t instanceof o.TagInfo))return t.idTemplate}}static getVariables(){let e=[];if(this.currentParsingDoc)for(let t of this.currentParsingDoc.stacks)if(t instanceof o.ForLoop||t instanceof o.TagInfo)for(let n of t.variableNames)e.includes(n)||e.push(n);return e}uri;errors=[];document;rootTags=[];tags=[];blocksInfo={};slotsInfo={};resultsByClassName={};interestPoints=[];rules;styleLinks=[];fcts={};htmlFile;loops=[];ifs=[];injections=[];bindings=[];contextEdits=[];diffRawToCompiled={};diffCompiledToRaw={};stacks=[];compiledTxt="";fromRawToCompiled(e){let t=e;for(let n in this.diffRawToCompiled){if(Number(n)>e)break;t+=this.diffRawToCompiled[n]}return t}fromCompiledToRaw(e){let t=e;for(let n in this.diffCompiledToRaw){if(Number(n)>e)break;t+=this.diffCompiledToRaw[n]}return t}getBlocksInfoTxt(){let e=[];for(let t in this.blocksInfo)e.push("'"+t+"':`"+this.blocksInfo[t]+"`");return e.join(",")}getSlotsInfoTxt(){let e=[];for(let t in this.slotsInfo)e.push("'"+t+"':`"+this.slotsInfo[t]+"`");return e.join(",")}isReady=!1;build;constructor(e,t){this.build=t,this.htmlFile=e,p.parsedDoc[e.file.uri]={version:e.file.versionUser,result:this};let n=this.getFileContent(e.file.documentUser);this.rules=e.scssFile?.rules??new Map,this.document=i.TextDocument.create(e.file.uri,e.file.documentUser.languageId,e.file.versionUser,n),p.currentParsingDoc=this,this.uri=e.file.uri,p.idElement=0,p.idTemplate=0,p.idTemplate=0,this.parse(this.document),p.currentParsingDoc=null,this.isReady=!0;for(let e of this.readyCb)e()}getFileContent(e){let t=e.getText();return t=t.replace(/\\\{\{(.*?)\}\}/g,"{{$1}}"),t=t.replace(/\\if/g,"if"),t=t.replace(/\\else/g,"else"),t=t.replace(/\\for/g,"for"),t=t.replace(/\\@Context/g,"@Context"),t}readyCb=[];onReady(e){this.isReady||this.readyCb.push(e)}parseJs(e){let t,n=e.getText(),r={},i=/<!--(.|\s)*?-->/g;for(;t=i.exec(n);){let e="";for(let n=0;n<t[0].length;n++)e+=" ";r[t.index]=t[0],n=n.slice(0,t.index)+e+n.slice(t.index+t[0].length)}let s=n;const a=(e,t)=>s.slice(e,t);let l=(0,c.createSourceFile)("sample.ts",n.replace(/\{\{|\}\}/g," ").replace(/<(\/?.*?)>/g,"'$1'"),c.ScriptTarget.ESNext,!0),u=[];const p=(e,t)=>{(0,c.forEachChild)(e,(n=>{let r;if(n.kind==c.SyntaxKind.IfStatement){let e=n,t=!0;if(e.parent.kind==c.SyntaxKind.IfStatement){e.parent.elseStatement==e&&(t=!1)}if(t){let e=new o.IfInfo(n,a);e.isValid&&(this.ifs.push(e),u=[...u,...e.transformations])}}else if([c.SyntaxKind.ForInStatement,c.SyntaxKind.ForOfStatement,c.SyntaxKind.ForStatement].includes(n.kind)){if("for"!==n.getText()){let e=new o.ForLoop(n,a);e.isValid&&(r=e,u=[...u,...r.transformations],this.loops.push(r),this.stacks.push(r))}}else if(n.kind==c.SyntaxKind.Decorator){if(n.getText().startsWith("@Context(")){let e=new o.ContextEditing(n,a);u=[...u,...e.transformations],this.contextEdits.push(e)}}n.kind==c.SyntaxKind.Block&&e.kind==c.SyntaxKind.Block||(p(n,t+1),r&&this.stacks.pop())}))};p(l,0),u.sort(((e,t)=>t.end-e.end));let _=n.length;this.diffRawToCompiled={};for(let e of u){if(e.end>_)continue;let t=Math.min(e.newText.length,e.end-e.start);this.diffRawToCompiled[e.start+t]=e.newText.length-(e.end-e.start),n=n.slice(0,e.start)+e.newText+n.slice(e.end,n.length),_=e.start}let d=0;for(let e in this.diffRawToCompiled){let t=Number(e)+d,n=-1*this.diffRawToCompiled[e];d+=this.diffRawToCompiled[e],this.diffCompiledToRaw[t]=n}for(let e in r){let t=r[e],i=this.fromRawToCompiled(Number(e));n=n.slice(0,i)+t+n.slice(i+t.length)}return n}parse(e){let t=this.parseJs(e);this.compiledTxt=t;let n=[],r=!1,i=p.languageService.createScanner(t,0),s=[],c=null;try{for(;i.scan()!=a.TokenType.EOS;)if(n.length>0){if(i.getTokenType()==a.TokenType.EndTagClose&&r){r=!1;let t=s.pop(),a=n.pop();if(t&&a){let n=i.getTokenEnd(),r=e.getText().slice(a,n);t.addContent(new o.ContentInfo(r,a,n,t,!1))}}else if(i.getTokenType()==a.TokenType.EndTag){let e=i.getTokenText(),t=s[s.length-1];t&&t.tagName==e&&(r=!0,t.afterClose(i.getTokenOffset(),i.getTokenEnd()))}}else if(i.getTokenType()==a.TokenType.StartTagOpen);else if(i.getTokenType()==a.TokenType.StartTagClose){if(s.length>0){let e=s[s.length-1];e.validateAllProps(i.getTokenOffset()),e.selfClosing&&(s.pop(),e.afterClose(i.getTokenOffset(),i.getTokenEnd())),this.build.getAvoidParsingTags().includes(e.tagName)&&n.push(i.getTokenEnd())}}else if(i.getTokenType()==a.TokenType.StartTagSelfClose){let e=s.pop();e&&(e.validateAllProps(i.getTokenOffset()),e.afterClose(i.getTokenOffset(),i.getTokenEnd()))}else if(i.getTokenType()==a.TokenType.StartTag){let e=i.getTokenText(),t=i.getTokenOffset(),n=i.getTokenEnd(),r=new o.TagInfo(this,e,t,n);if(s.length>0){s[s.length-1].addChild(r)}else this.rootTags.push(r);this.tags.push(r),s.push(r)}else if(i.getTokenType()==a.TokenType.EndTagOpen);else if(i.getTokenType()==a.TokenType.EndTagClose);else if(i.getTokenType()==a.TokenType.EndTag){let t=i.getTokenText(),n=s.pop();if(!n||n.tagName!=t)return void(n?this.errors.push((0,l.createErrorHTMLPos)(e,"The tag "+n?.tagName+" isn't correctly closed",n?.start,n?.end)):this.errors.push((0,l.createErrorHTMLPos)(e,"No opening tag found for "+t,i.getTokenOffset(),i.getTokenEnd())));n.afterClose(i.getTokenOffset(),i.getTokenEnd())}else if(i.getTokenType()==a.TokenType.DelimiterAssign);else if(i.getTokenType()==a.TokenType.AttributeName){let e=i.getTokenText();if(s.length>0){let t=s[s.length-1],n=i.getTokenOffset(),r=i.getTokenEnd();c=new o.AttributeInfo(e,n,r,t),t.addAttribute(c)}}else if(i.getTokenType()==a.TokenType.AttributeValue){if(c){let e=i.getTokenText(),t=i.getTokenOffset(),n=i.getTokenEnd();c.setValue(e,t,n),c=null}}else if(i.getTokenType()==a.TokenType.Content){if(s.length>0){let e=s[s.length-1],t=i.getTokenText(),n=i.getTokenOffset(),r=i.getTokenEnd();e.addContent(new o.ContentInfo(t,n,r,e))}}else i.getTokenType()==a.TokenType.Whitespace||i.getTokenType()==a.TokenType.Unknown||i.getTokenType()==a.TokenType.Script||(i.getTokenType(),a.TokenType.Styles)}catch(e){console.log(e)}let u="";for(let e of this.rootTags)u+=e.render();this.manageSlotAndBlock(u)}getParsedInfo(e){if(e=e.toLowerCase(),this.resultsByClassName[e])return this.resultsByClassName[e];let t={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]};for(let n of this.rootTags){let r=n.getTemplateInfo(e);p.mergeTemplateResult(t,r)}return this.resultsByClassName[e]=t,t}manageSlotAndBlock(e){let t,n=e,r=n,i=/<block.*?( name="(.*?)")?>((\s|\S)*?)<\/block>/g;for(;t=i.exec(n);)this.blocksInfo[t[2]]=t[3],r=r.replace(t[0],"");r=r.trim(),(r.length>0||0==e.trim().length)&&(this.blocksInfo.default=r);let s=/<slot.*?( name="(.*?)")?>(\s|\S)*?<\/slot>/g;for(;t=s.exec(n);)t[2]||(t[2]="default"),this.slotsInfo[t[2]]=t[0]}}t.ParserHtml=p},28180:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Binding=t.Injection=t.ContextEditing=t.IfInfo=t.ForLoop=t.ContentInfo=t.AttributeInfo=t.TagInfo=void 0;const r=n(94625),i=n(57999),s=n(47506);class a{tagName="";children=[];attributes={};hasClose=!1;selfClosing=!1;id="";start=0;end=0;parent=null;parentTemplateId;openTagStart=0;openTagEnd=0;alias=null;aliasMultiple=void 0;pressEvent=null;eventsPerso=[];injections=[];bindings=[];changes={};variableNames=[];parser;get componentClassName(){return this.parser.htmlFile.tsFile?.componentClassName.toLowerCase()??""}get isLoop(){return this.tagName==c.tagName}get isIf(){return this.tagName==u.tagName}get isContextEditing(){return this.tagName==p.tagName}loopInfo;ifInfo;contextEdit;constructor(e,t,n,r){this.parser=e,this.tagName=t,this.start=n,this.openTagStart=n,this.end=r,this.isLoop?this.createId():this.isIf||this.isContextEditing||(i.ParserHtml.addInterestPoint({name:t,start:n,end:r,type:"tag"}),o.includes(t)&&(this.selfClosing=!0))}createId(){return this.id||(this.id=this.componentClassName+"_"+i.ParserHtml.idElement,i.ParserHtml.idElement++),this.id}addAttribute(e){"@for"!=e.name?this.attributes[e.name]?i.ParserHtml.addError(e.nameStart,e.nameEnd,"Duplicate attribute "+e.name):this.attributes[e.name]=e:i.ParserHtml.addError(e.nameStart,e.nameEnd,"Deprecated : use for directly inside template")}addChild(e){this.children.push(e),e.parent=this}addContent(e){this.children.push(e)}addChanges(e,t,n){let r=this.createId()+"°"+e;this.changes[r]={fct:t,once:n}}validateAllProps(e){if(this.openTagEnd=e,this.alias){let e=this.alias.endsWith("[]");e&&(this.alias=this.alias.replace("[]","")),e&&(this.aliasMultiple=e)}if(this.isLoop){this.parentTemplateId=i.ParserHtml.getParentId();let e=i.ParserHtml.addLoopStack(Number(this.attributes.id.value));e&&(this.loopInfo=e)}else if(this.isIf){this.parentTemplateId=i.ParserHtml.getParentId();let e=Number(this.attributes.id.value),t=i.ParserHtml.addIfStack(e);if(t&&(this.ifInfo=t,e==t.idsTemplate[0])){let e=this.createId();t._id=e}}else if(this.isContextEditing){this.parentTemplateId=i.ParserHtml.getParentId();let e=Number(this.attributes.id.value),t=i.ParserHtml.getContextEditing(e);if(t&&(this.contextEdit=t,this.parent))for(let e of t.variableNames)this.parent.variableNames.includes(e)||this.parent.variableNames.push(e)}i.ParserHtml.addTagInfoStack(this)}afterClose(e,t){this.hasClose=!0,this.selfClosing||i.ParserHtml.addInterestPoint({name:this.tagName,start:e,end:t,type:"tag"}),this.checkStyle(i.ParserHtml.getRules(),(e=>i.ParserHtml.addStyleLink(e))),i.ParserHtml.removeStack(),(this.isLoop||this.isIf)&&i.ParserHtml.removeStack()}checkStyle(e,t){for(let[n,r]of e)if(n(this)){t([{start:this.openTagStart,end:this.openTagEnd},r])}}_render(){let e=[];for(let t in this.attributes){let n=this.attributes[t];n.mustBeAdded&&(null!=n.value?e.push(n.name+'="'+n.value+'"'):e.push(n.name))}this.id&&e.push('_id="'+this.id+'"');let t="";return e.length>0&&(t=" "+e.join(" ")),this.selfClosing?`<${this.tagName}${t} />`:`<${this.tagName}${t}>${this.children.map((e=>e.render())).join("")}</${this.tagName}>`}render(){return this.isContextEditing?"":this.isLoop?'<template _id="'+this.id+'"></template>':this.isIf?this.id?'<template _id="'+this.id+'"></template>':"":this._render()}getTemplateInfo(e){let t={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]},n=this.id;const r=e=>{if(this.alias){let t=this.aliasMultiple?2:1;e.elements.push({name:this.alias,ids:[n],tags:{[this.tagName]:t},useLive:!1,isArray:t>1,positions:[{start:this.attributes["@element"].valueStart,end:this.attributes["@element"].valueEnd}]})}for(let t in this.changes)e.content[t]=this.changes[t];for(let t of this.injections){let r={id:n,injectionName:t.attr,inject:`@_@${t.injectTxt}@_@`};t.computedOnce&&(r.once=!0),e.injection.push(r)}for(let t of this.bindings){let r=[];r=t.event?[t.event]:["input","textarea"].includes(this.tagName)?["change","input"]:["change"];let i={id:n,eventNames:r,injectionName:t.valueName,tagName:this.tagName,inject:`@_@${t.injectTxt}@_@`,extract:`@_@${t.extractTxt}@_@`};t.computedOnce&&(i.once=!0),e.bindings.push(i)}for(let t of this.eventsPerso)e.events.push({eventName:t.event,id:n,fct:t.fct,tagName:this.tagName,position:{start:t.start,end:t.end}});if(this.pressEvent&&e.pressEvents.push({...this.pressEvent,id:n}),this.contextEdit){let t={fct:this.contextEdit.fctJs};this.contextEdit.computedOnce&&(t.once=!0),e.contextEdits.push(t)}};if(this.loopInfo){let n={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]},r="";for(let t of this.children){if(t instanceof a){let r=t.getTemplateInfo(e);i.ParserHtml.mergeTemplateResult(n,r)}r+=t.render()}let s={templateId:this.loopInfo.idTemplate||0,anchorId:this.id,template:r,actions:n,parentId:this.parentTemplateId};this.loopInfo.isSimple?s.simple=this.loopInfo.simple:s.func=this.loopInfo.complex.fct,t.loops.push(s)}else if(this.isIf&&this.ifInfo){let n=Number(this.attributes.id.value),r={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]},s="";for(let t of this.children){if(t instanceof a){let n=t.getTemplateInfo(e);i.ParserHtml.mergeTemplateResult(r,n)}s+=t.render()}if(this.ifInfo.registerPart({template:s,templateId:n,templateAction:r,condition:""}),n==this.ifInfo.idsTemplate[this.ifInfo.idsTemplate.length-1]){let e={anchorId:this.ifInfo._id,parts:this.ifInfo.parts,parentId:this.parentTemplateId};t.ifs.push(e)}}else{r(t);for(let n of this.children)if(n instanceof a){let r=n.getTemplateInfo(e);i.ParserHtml.mergeTemplateResult(t,r)}}return t}}t.TagInfo=a;const o=["area","base","br","col","embed","img","input","link","meta","param","source","track","wbr"],l=["_id"];t.AttributeInfo=class{name="";value=null;nameStart=0;nameEnd=0;valueStart=0;valueEnd=0;tag;mustBeAdded=!0;constructor(e,t,n,r){this.name=e,this.nameStart=i.ParserHtml.fromCompiledToRaw(t),this.nameEnd=i.ParserHtml.fromCompiledToRaw(n),this.tag=r,this.manageSpecialAttribute()}manageSpecialAttribute(){this.name.startsWith("@")||this.name.startsWith(":")?(this.tag.createId(),this.mustBeAdded=!1):l.includes(this.name)&&(i.ParserHtml.addError(this.nameStart,this.nameEnd,"The attribute "+this.name+" is used by Aventus internally"),this.mustBeAdded=!1)}setValue(e,t,n){if(e=e.replace(/"/g,""),this.value=e,this.valueStart=i.ParserHtml.fromCompiledToRaw(t),this.valueEnd=i.ParserHtml.fromCompiledToRaw(n),"@for"!=this.name)if("@element"===this.name)this.tag.alias=e,i.ParserHtml.addInterestPoint({name:e,start:this.nameStart,end:this.valueEnd,type:"property"});else if(this.name.startsWith("@bind")||this.name.startsWith("$")){let r=new d(this.name,e,t,n);this.tag.bindings.push(r),i.ParserHtml.addBinding(r)}else if(this.name.startsWith(":")){let r=new _(this.name.slice(1),e,t,n);this.tag.injections.push(r),i.ParserHtml.addInjection(r)}else if(s.pressEventMap.hasOwnProperty(this.name))this.tag.pressEvent||(this.tag.pressEvent={}),this.tag.pressEvent[s.pressEventMap[this.name]]={value:e,start:this.valueStart,end:this.valueEnd},i.ParserHtml.addInterestPoint({name:e,start:this.nameStart,end:this.valueEnd,type:"method"});else if(this.name.startsWith("@"))this.tag.eventsPerso.push({event:this.name.slice(1),fct:e,start:this.valueStart,end:this.valueEnd}),i.ParserHtml.addInterestPoint({name:e,start:this.nameStart,end:this.valueEnd,type:"method"});else{let t=h(e,this.valueStart);t.changes.length>0&&(this.tag.addChanges(this.name,t.txt,t.once),this.mustBeAdded=!1)}}};t.ContentInfo=class{content="";start=0;end=0;tag;mustBeAdded=!0;constructor(e,t,n,r,s=!0){this.content=e,this.start=i.ParserHtml.fromCompiledToRaw(t),this.end=i.ParserHtml.fromCompiledToRaw(n),this.tag=r,s&&this.manageVariables()}manageVariables(){let e=h(this.content,this.start);e.changes.length>0&&(this.tag.addChanges("@HTML",e.txt,e.once),this.mustBeAdded=!1);for(let t of e.variables)this.tag.variableNames.includes(t)||this.tag.variableNames.push(t)}render(){return this.mustBeAdded?this.content:""}};class c{static tagName="l";idTemplate=0;isSimple=!1;transformations=[];start=0;startBlock=0;end=0;loopTxt="";loopName="";isValid=!0;typeToLoad=[];simple={data:""};complex={init:[],condition:"",transform:[],apply:[],loopName:"",fct:""};get variableNames(){return this.typeToLoad.map((e=>e.txt))}variables=[];sliceText;constructor(e,t){this.sliceText=t,this.idTemplate=i.ParserHtml.createIdTemplate(),this.variables=i.ParserHtml.getVariables(),e.kind==r.SyntaxKind.ForOfStatement||e.kind==r.SyntaxKind.ForInStatement?(this.isSimple=!0,this.loadForInOf(e)):this.loadFor(e),this.loopName=i.ParserHtml.getCustomFctName()??""}loadForInOf(e){let t=0;(0,r.forEachChild)(e,(n=>{if(0==t){let t=n.getChildAt(1),i=t.getStart(),s=t.getEnd(),a=this.sliceText(i,s);e.kind==r.SyntaxKind.ForInStatement?this.simple.index=a:this.simple.item=a,this.typeToLoad.push({txt:a,start:i,end:s})}else if(1==t)this.simple.data=this.sliceText(n.getStart(),n.getEnd());else if(2==t){let t=e.getStart(),r=n.getStart()+1;this.loopTxt=this.sliceText(t,r)+" }";let i="<"+c.tagName+' id="'+this.idTemplate+'">',s="</"+c.tagName+">";this.transformations.push({start:t,end:r,newText:i});let a=n.getEnd();this.transformations.push({start:a-1,end:a,newText:s}),this.start=t,this.startBlock=r,this.end=a}t++}))}loadFor(e){let t=[],n=[],s="",a=[],o=0,l="";if((0,r.forEachChild)(e,(i=>{if(0==o&&i.kind==r.SyntaxKind.VariableDeclarationList)(0,r.forEachChild)(i,(e=>{let r=e.getChildAt(0),i=r.getStart(),s=r.getEnd(),a=this.sliceText(i,s);t.push("let "+e.getText()),n.push(e.getChildAt(0).getText()),this.typeToLoad.push({txt:a,start:i,end:s})}));else if(1==o&&i.kind==r.SyntaxKind.BinaryExpression)s=i.getText();else if(2==o){let e=t=>{t.kind==r.SyntaxKind.BinaryExpression&&","==t.getChildAt(1).getText()?(e(t.getChildAt(0)),e(t.getChildAt(2))):a.push(t.getText())};e(i)}else if(3==o&&i.kind==r.SyntaxKind.Block){let t=e.getStart(),n=i.getStart()+1;l=this.sliceText(t,n)+" }",this.loopTxt=l;let r="<"+c.tagName+' id="'+this.idTemplate+'">',s="</"+c.tagName+">";this.transformations.push({start:t,end:n,newText:r});let a=i.getEnd();this.transformations.push({start:a-1,end:a,newText:s}),this.start=t,this.startBlock=n,this.end=a}o++})),0==this.transformations.length&&(this.isValid=!1),!this.checkIsSimple(t,s,a)){let e=i.ParserHtml.getCustomFctName(1)??"";this.complex={init:t,condition:s,transform:a,apply:n,loopName:e,fct:`(c) => c.comp.${e}`}}}recalculateVariables(){if(this.variables=f(this.loopTxt,i.ParserHtml.getVariables()),!this.isSimple){let e=this.variables.map((e=>"c.data."+e)).join(",");this.complex.fct+=`(${e})`}}checkIsSimple(e,t,n){if(1!=e.length)return!1;let r=e[0].split("=");if(2!=r.length)return!1;let i=r[0].replace("let ","").trim();if("0"!=r[1].trim())return!1;let s=new RegExp("\\s*"+i+"\\s*<\\s*([a-zA-Z0-9\\._\\[\\]-]+)\\.length").exec(t);if(!s)return!1;let a=s[1];return 1==n.length&&(!!new RegExp("\\s*"+i+"\\+\\+\\s*").exec(n[0])&&(this.isSimple=!0,this.simple={data:a,index:i},!0))}}t.ForLoop=c;class u{static tagName="if";statements=[];idsTemplate=[];defaultVariables=[];transformations=[];end=0;_id="";parts=[];isValid=!0;conditions=[];sliceText;constructor(e,t){this.sliceText=t,this.defaultVariables=i.ParserHtml.getVariables(),this.loadIf(e)}loadIf(e){let t=[];const n=()=>{let e=i.ParserHtml.createIdTemplate();return this.idsTemplate.push(e),e},s=(e,t,n)=>{let r=n.getStart()+1,i="<"+u.tagName+' id="'+e+'">',s="</"+u.tagName+">";this.transformations.push({start:t,end:r,newText:i});let a=n.getEnd();this.transformations.push({start:a-1,end:a,newText:s})},a=(e,o=0,l)=>{let c=0;void 0===l&&(l=e.getStart());let u,p=l;for(let t of e.getChildren())t.kind==r.SyntaxKind.ElseKeyword&&(u=t.getStart());let _=n();(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.Block){if(c++,2==c){if(null==u)throw"impossible";s(n(),u,e)}else s(_,p,e);t.push(e)}else if(e.kind==r.SyntaxKind.IfStatement){if(null==u)throw"impossible";a(e,o+1,u)}else if(r.SyntaxKind[e.kind].includes("Expression")){let t=i.ParserHtml.getCustomFctName(this.conditions.length)??"",n=this.sliceText(e.getStart(),e.getEnd());this.conditions.push({fctName:t,txt:n,fctTxt:`(c) => c.comp.${t}`,start:e.getStart(),end:e.getEnd(),offsetAfter:0,offsetBefore:0,idTemplate:_,type:0==o?"if":"elif",variables:[],computedOnce:m(n)})}})),0==c&&(this.isValid=!1)};a(e)}registerPart(e){this.conditions.length>this.parts.length?(e.condition=this.conditions[this.parts.length].fctTxt,e.once=this.conditions[this.parts.length].computedOnce):(e.condition="(c) => true",e.once=!0),this.parts.push(e)}recalculateVariables(e){let t=i.ParserHtml.getVariables();for(let n of this.conditions)if(n.idTemplate==e){let e=f(n.txt,t),r=e.map((e=>"c.data."+e)).join(",");n.fctTxt+=`(${r})`,n.variables=e}}}t.IfInfo=u;class p{static tagName="c";sliceText;variables=[];transformations=[];id;fctTs="";fctJs="";editName;start=0;end=0;mapping=["",""];computedOnce=!1;typeToLoad=[];get variableNames(){return this.typeToLoad.map((e=>e.txt))}constructor(e,t){this.sliceText=t,this.editName=i.ParserHtml.getCustomFctName()??"",this.id=i.ParserHtml.createIdTemplate(),this.loadContextEditing(e)}loadContextEditing(e){this.start=e.getStart(),this.end=e.getEnd(),this.transformations.push({start:e.getStart(),end:e.getEnd(),newText:"<"+p.tagName+' id="'+this.id+'"></'+p.tagName+">"}),(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.CallExpression){let t=e,n="{ ",r=0;for(let e of t.arguments)n+=e.getText(),0==r&&(this.typeToLoad.push({txt:e.getText().replace(/['`"]/g,""),start:e.getStart(),end:e.getEnd()}),n+=": "),this.mapping[r]=e.getText(),r++;n+=" }",this.fctTs="return "+n,this.computedOnce=m(this.fctTs)}})),this.variables=f(this.fctTs,i.ParserHtml.getVariables());let t=this.variables.map((e=>"c.data."+e)).join(",");this.fctJs=`@_@(c) => c.comp.${this.editName}(${t})@_@`}}t.ContextEditing=p;class _{start=0;end=0;attr;injectFctName;injectTsTxt;injectTxt;variables=[];computedOnce=!1;constructor(e,t,n,r){this.attr=e,this.start=i.ParserHtml.fromCompiledToRaw(n),this.end=i.ParserHtml.fromCompiledToRaw(r),this.injectFctName=i.ParserHtml.getCustomFctName()??"",this.injectTsTxt=t,this.computedOnce=m(t),this.variables=f(t,i.ParserHtml.getVariables());let s=this.variables.map((e=>"c.data."+e)).join(",");this.injectTxt=`(c) => c.comp.${this.injectFctName}(${s})`}}t.Injection=_;class d{start=0;end=0;event;valueName="value";injectFctName;extractFctName;injectTsTxt;extractTsCond;extractTsTxt;injectTxt;extractTxt;variables=[];computedOnce=!1;constructor(e,t,n,r){let s=e.split(":"),a=s[0];a.startsWith("@bind_")?this.event=a.replace("@bind_",""):a.startsWith("$")&&a.length>0&&(this.event=a.replace("$","")),s.length>1&&(this.valueName=s[1]),this.start=i.ParserHtml.fromCompiledToRaw(n),this.end=i.ParserHtml.fromCompiledToRaw(r),this.injectFctName=i.ParserHtml.getCustomFctName()??"",this.extractFctName=i.ParserHtml.getCustomFctName(1)??"",this.injectTsTxt=t,this.computedOnce=m(t);let o=t.split(".");o.pop(),this.extractTsCond=o.join(".").trim(),this.extractTsCond.endsWith("?")&&(this.extractTsCond=this.extractTsCond.slice(0,this.extractTsCond.length-1)),this.extractTsTxt=t.replace(/\?/g,""),this.variables=f(t,i.ParserHtml.getVariables());let l=this.variables.map((e=>"c.data."+e)),c=["v"].concat(l).join(","),u=l.join(",");this.injectTxt=`(c) => c.comp.${this.injectFctName}(${u})`,this.extractTxt=`(c, v) => c.comp.${this.extractFctName}(${c})`}}function h(e,t){let n,r=/\{\{([\s|\S]*?)\}\}/g,s={changes:[],txt:e,variables:[],once:!0};for(;n=r.exec(e);){let e=t+n.index,r=t+n.index+n[0].length,a=i.ParserHtml.createChange({txt:n[1],start:e,end:r});if(s.once&&!m(n[1])&&(s.once=!1),a){a.variables=f(n[1],a.variables);let e=a.variables.map((e=>"c.data."+e)).join(","),t="${c.print(c.comp."+a.name+"("+e+"))}";s.txt=s.txt.replace(n[0],t),s.changes.push(a)}}return s.changes.length>0&&(s.txt="(c) => `"+s.txt+"`"),s}function f(e,t){if(0==t.length)return t;let n=[],i=(0,r.createSourceFile)("sample.ts",e,r.ScriptTarget.ESNext,!0),s=e=>{(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.Identifier)if(e.parent.kind!=r.SyntaxKind.PropertyAccessExpression){let r=e.getText();t.includes(r)&&!n.includes(r)&&n.push(r)}else{if(e.parent.getChildAt(0)==e){let r=e.getText();t.includes(r)&&!n.includes(r)&&n.push(r)}}s(e)}))};return s(i),n}function m(e){return!/if|switch|\?|\[.+?\]/g.test(e)}t.Binding=d},47506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pressEventMap=void 0,t.pressEventMap={"@press":"onPress","@press-start":"onPressStart","@press-stop":"onPressEnd","@longpress":"onLongPress","@longpress-delay":"delayLongPress","@dblpress":"onDblPress","@dblpress-delay":"delayDblPress","@drag":"onDrag","@drag-start":"onDragStart","@drag-end":"onDragEnd"}},2741:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CSharpFile=t.CSharpManager=void 0;const r=n(72375),i=n(83693),s=n(50857),a=n(19408);class o{static instance;static getInstance(){return this.instance||(this.instance=new o),this.instance}files={};onNewFileUUID;onFileRemoveUUID;constructor(){this.onNewFile=this.onNewFile.bind(this),this.onFileRemove=this.onFileRemove.bind(this),this.onNewFileUUID=i.FilesManager.getInstance().onNewFile(this.onNewFile),this.onFileRemoveUUID=i.FilesManager.getInstance().onFileRemove(this.onFileRemove)}async onNewFile(e){e.uri.endsWith(a.AventusExtension.CsharpConfig)&&(this.files[e.uri]=new l(e))}async onFileRemove(e){delete this.files[e]}destroy(){i.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID),i.FilesManager.getInstance().removeOnFileRemove(this.onFileRemoveUUID)}}t.CSharpManager=o;class l{_file;get file(){return this._file}constructor(e){this._file=e,this.addEvents()}uuidEvents={onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onRename:""};addEvents(){this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof r.InternalAventusFile&&await this.file.validate()}triggerSave(){this.file instanceof r.InternalAventusFile&&this.file.triggerSave()}async triggerContentChange(){this.file instanceof r.InternalAventusFile&&await this.file.triggerContentChange(this.file.documentUser)}async _onValidate(){return await this.onValidate()}async onContentChange(){}async onValidate(){return s.AventusJSONLanguageService.getInstance().validate(this.file)}async onSave(){}async onDelete(){}async _onDelete(){await this.onDelete(),this.removeEvents()}async onCompletion(e,t){return s.AventusJSONLanguageService.getInstance().doComplete(e,t)}async onCompletionResolve(e,t){return s.AventusJSONLanguageService.getInstance().doResolve(t)}async onHover(e,t){return s.AventusJSONLanguageService.getInstance().doHover(e,t)}async onDefinition(e,t){return null}async onFormatting(e,t,n){return s.AventusJSONLanguageService.getInstance().format(e,t,n)}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.CSharpFile=l},50857:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusJSONLanguageService=void 0;const r=n(71017),i=n(39459),s=n(42374),a=n(19408),o=n(1539),l=n(51833),c=n(77282);class u{static instance;static getInstance(){return this.instance||(this.instance=new u),this.instance}languageService;constructor(){this.languageService=(0,i.getLanguageService)({schemaRequestService:async e=>JSON.stringify(l.AventusConfigSchema)}),this.languageService.configure({allowComments:!0,schemas:[{fileMatch:["**"+a.AventusExtension.Config],uri:l.AventusConfigSchema.$schema??"",schema:l.AventusConfigSchema},{fileMatch:["**"+a.AventusExtension.Template],uri:l.AventusTemplateSchema.$schema??"",schema:l.AventusTemplateSchema},{fileMatch:["**"+a.AventusExtension.CsharpConfig],uri:l.AventusSharpSchema.$schema??"",schema:l.AventusSharpSchema}]})}async format(e,t,n){let r=e.documentUser;return await this.languageService.format(r,t,n)}async doComplete(e,t){let n=e.documentUser,r=this.languageService.parseJSONDocument(n),i=await this.languageService.doComplete(e.documentUser,t,r);return i||{isIncomplete:!1,items:[]}}async doResolve(e){return await this.languageService.doResolve(e)}async doHover(e,t){let n=e.documentUser,r=this.languageService.parseJSONDocument(n);return await this.languageService.doHover(n,t,r)}async validate(e){let t=e.documentUser,n=this.languageService.parseJSONDocument(t),r=await this.languageService.doValidation(t,n);if(0==r.length){let e=this.removeComments(t.getText());try{return JSON.parse(e),r}catch(e){r.push((0,o.createErrorTs)(t,"Can't parse the json",a.AventusErrorCode.ConfigJsonError))}}for(let e of r)e.severity=s.DiagnosticSeverity.Error;return r}async getConfig(e){let t=e.documentUser,n=this.languageService.parseJSONDocument(t),r=await this.languageService.doValidation(t,n,void 0,l.AventusConfigSchema);if(0==r.length){let e=this.removeComments(t.getText());try{let n=JSON.parse(e);return n=this.prepareConfigFile(t.uri,n),n}catch(e){r.push((0,o.createErrorTs)(t,"Can't parse the json",a.AventusErrorCode.ConfigJsonError))}}return null}prepareConfigFile(e,t){if(""==(t={...this.defaultConfigValue(),...t}).componentPrefix){let e=t.module.match(/([A-Z][a-z]*)|([0-9][a-z]*)/g);t.componentPrefix=e?e.join("-").toLowerCase():"av"}let n=[];for(let r of t.build)n.push(this.prepareBuild(e,r,t));if(t.build=n,t.static){let n=[];for(let r of t.static)n.push(this.prepareStatic(e,r));t.static=n}return t}replaceEnvVar(e,t){if(e.startsWith("@"))return e;let n,i=/%(.*?)%/gm;for(;n=i.exec(e);){let t=n[1],r=c.env[t]??"undefined";e=e.replace(n[0],r)}return e.startsWith("/")||/^[a-zA-Z]:/gm.test(e)?e=(0,r.normalize)(e):(e="/"+e,e=(0,r.normalize)((0,o.uriToPath)(t)+e)),e}prepareBuild(e,t,n){let i=(0,o.getFolder)(e);(t={...this.defaultConfigBuildValue(n),...t}).fullname=t.module+"@"+t.name;const s=e=>this.replaceEnvVar(e,i);let a=t.compile;for(let e of a){if(e.input){Array.isArray(e.input)||(e.input=[e.input]);let t=[];for(let n of e.input){let e="";n=n.replace(/\\/g,"/"),n.startsWith("/")||(e="/");let s=n.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),n=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+e+n).replace(/\\/g,"/");a=(0,o.escapeRegex)(a,!0).replace("*",".*"),t.push("(^"+a+"$)")}let n=t.join("|");""==n&&(n="(?!)"),e.inputPathRegex=new RegExp(n)}else e.inputPathRegex=new RegExp(".*");if(e.output){Array.isArray(e.output)||(e.output=[e.output]);for(let t=0;t<e.output.length;t++)e.output[t]=e.output[t].trim(),e.output[t].length>0&&(e.output[t]=s(e.output[t]))}else e.output=[];if(e.outputNpm){"string"==typeof e.outputNpm?e.outputNpm={path:[e.outputNpm],packageJson:!0,npmName:""}:Array.isArray(e.outputNpm)&&(e.outputNpm={path:e.outputNpm,packageJson:!0,npmName:""}),Array.isArray(e.outputNpm.path)||(e.outputNpm.path=[e.outputNpm.path]),void 0===e.outputNpm.packageJson&&(e.outputNpm.packageJson=!0),void 0===e.outputNpm.npmName&&(e.outputNpm.npmName="");for(let t=0;t<e.outputNpm.path.length;t++){let n=s(e.outputNpm.path[t]);n.endsWith("*")&&(n=n.slice(0,-1)),n.endsWith("/")&&(n=n.slice(0,-1)),n=n.replace(/\\/g,"/"),e.outputNpm.path[t]=n}}else e.outputNpm={path:[],packageJson:!1,npmName:""};if(e.package){Array.isArray(e.package)||(e.package=[e.package]);for(let t=0;t<e.package.length;t++)e.package[t]=e.package[t].trim(),e.package[t].length>0&&(e.package[t]=s(e.package[t]))}else e.package=[]}let l=[];for(let e of t.src){let n="";e=e.replace(/\\/g,"/"),e.startsWith("/")||(n="/");let s=e.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),e=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+n+e).replace(/\\/g,"/"),c=a.replace("*","");c.endsWith("/")&&(c=c.slice(0,-1)),t.srcPath.push(c),a=(0,o.escapeRegex)(a,!0).replace("*",".*"),l.push("(^"+a+"$)")}if(t.stories){t.stories={...this.defaultConfigBuildStories(i,n),...t.stories};let e=s(t.stories.output);e.endsWith("*")&&(e=e.slice(0,-1)),e.endsWith("/")&&(e=e.slice(0,-1)),e=e.replace(/\\/g,"/"),t.stories.output=e}let c=l.join("|");""==c&&(c="(?!)"),t.srcPathRegex=new RegExp(c),t.nodeModulesDir=t.nodeModulesDir.trim(),""==t.nodeModulesDir?t.nodeModulesDir=(0,r.normalize)((0,o.uriToPath)(i)+"/node_modules"):t.nodeModulesDir=s(t.nodeModulesDir);let u=[];for(let e of t.dependances){u.push({...this.defaultConfigBuildDependanceValue(e),...e});const t=u[u.length-1];t.subDependancesInclude["*"]||(t.subDependancesInclude["*"]=e.include),t.uri=s(t.uri)}if(t.dependances=u,t.outsideModule){let e=[];for(let n of t.outsideModule){let t="";n=n.replace(/\\/g,"/"),n.startsWith("/")||(t="/");let s=n.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),n=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+t+n).replace(/\\/g,"/");a=(0,o.escapeRegex)(a,!0).replace("*",".*"),e.push("(^"+a+"$)")}let n=e.join("|");""==n&&(n="(?!)"),t.outsideModulePathRegex=new RegExp(n)}if("rules"==t.namespaceStrategy)for(let e in t.namespaceRules){let n=[],s=t.namespaceRules[e];for(let e of s){let t="";e=e.replace(/\\/g,"/"),e.startsWith("/")||(t="/");let s=e.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),e=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+t+e).replace(/\\/g,"/");a=(0,o.escapeRegex)(a,!0).replace("*",".*"),n.push("(^"+a+"$)")}let a=n.join("|");""==a&&(a="(?!)"),t.namespaceRulesRegex[e]=new RegExp(a)}else if("followFolders"==t.namespaceStrategy||"followFoldersCamelCase"==t.namespaceStrategy){let e="";t.namespaceRoot.startsWith("/")||(e="/"),t.namespaceRoot=(0,r.normalize)((0,o.uriToPath)(i)+e+t.namespaceRoot).replace(/\\/g,"/")}return t}prepareStatic(e,t){let n=(0,o.getFolder)(e),i="";t.input.startsWith("/")||(i="/"),t.input.endsWith("*")&&(t.input=t.input.slice(0,-1)),t.input.endsWith("/")&&(t.input=t.input.slice(0,-1)),t.inputPathFolder=(0,r.normalize)((0,o.uriToPath)(n)+i+t.input),t.inputPathFolder=t.inputPathFolder.replace(/\\/g,"/"),i="",Array.isArray(t.output)||(t.output=[t.output]),t.outputPathFolder=[];for(let e of t.output)e=this.replaceEnvVar(e,n),e.endsWith("*")&&(e=e.slice(0,-1)),e.endsWith("/")&&(e=e.slice(0,-1)),e=e.replace(/\\/g,"/"),t.outputPathFolder.push(e);return t}defaultConfigValue(){return{module:"",hideWarnings:!1,version:"1.0.0",componentPrefix:"",dependances:[],build:[],static:[],avoidParsingInsideTags:[],aliases:{},namespaceRules:{},namespaceRulesRegex:{},namespaceStrategy:"manual",namespaceRoot:"./"}}defaultConfigBuildValue(e){return{fullname:"",name:"",version:e.version,disabled:!1,hideWarnings:e.hideWarnings,src:[],srcPath:[],stories:void 0,compile:[],srcPathRegex:new RegExp("(?!)"),outsideModule:[],outsideModulePathRegex:new RegExp("(?!)"),module:e.module,componentPrefix:e.componentPrefix,namespaceStrategy:e.namespaceStrategy,namespaceRules:{...e.namespaceRules},namespaceRulesRegex:{...e.namespaceRulesRegex},namespaceRoot:e.namespaceRoot,dependances:[...e.dependances],avoidParsingInsideTags:[...e.avoidParsingInsideTags],nodeModulesDir:""}}defaultConfigBuildStories(e,t){return{output:e+"/stories",format:"all"}}defaultConfigBuildDependanceValue(e){return{include:"need",subDependancesInclude:{},version:"x.x.x",uri:"",npm:""}}removeComments(e){return e=e.replace(/(\".*?\"|\'.*?\')|(\/\*.*?\*\/|\/\/[^(\r\n|\n)]*$)/gm,((e,t,n)=>{if(n){let e="";for(let t=0;t<n.length;t++)e+=" ";return e}return t})),e}}t.AventusJSONLanguageService=u},19490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateFile=t.TemplateManager=void 0;const r=n(72375),i=n(83693),s=n(50857),a=n(19408);class o{static instance;static getInstance(){return this.instance||(this.instance=new o),this.instance}onNewFileUUID;constructor(){this.onNewFile=this.onNewFile.bind(this),this.onNewFileUUID=i.FilesManager.getInstance().onNewFile(this.onNewFile)}async onNewFile(e){e.uri.endsWith(a.AventusExtension.Template)&&new l(e)}destroy(){i.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID)}}t.TemplateManager=o;class l{_file;get file(){return this._file}constructor(e){this._file=e,this.addEvents()}uuidEvents={onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onRename:""};addEvents(){this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof r.InternalAventusFile&&await this.file.validate()}triggerSave(){this.file instanceof r.InternalAventusFile&&this.file.triggerSave()}async triggerContentChange(){this.file instanceof r.InternalAventusFile&&await this.file.triggerContentChange(this.file.documentUser)}async _onValidate(){return await this.onValidate()}async onContentChange(){}async onValidate(){return s.AventusJSONLanguageService.getInstance().validate(this.file)}async onSave(){}async onDelete(){}async _onDelete(){await this.onDelete(),this.removeEvents()}async onCompletion(e,t){return s.AventusJSONLanguageService.getInstance().doComplete(e,t)}async onCompletionResolve(e,t){return s.AventusJSONLanguageService.getInstance().doResolve(t)}async onHover(e,t){return s.AventusJSONLanguageService.getInstance().doHover(e,t)}async onDefinition(e,t){return null}async onFormatting(e,t,n){return s.AventusJSONLanguageService.getInstance().format(e,t,n)}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.TemplateFile=l},51833:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusSharpSchema=t.AventusTemplateSchema=t.AventusConfigSchema=void 0,t.AventusConfigSchema={$schema:"foo://aventus/conf.json",title:"JSON Schema for Aventus",description:"JSON Schema for Aventus",type:"object",additionalProperties:!1,properties:{module:{type:"string",pattern:"^[a-zA-Z0-9_]+$",description:"Name of the exported module"},version:{type:"string",pattern:"^[0-9]+.[0-9]+.[0-9]+$",description:"Version for all your builds (x.x.x)"},hideWarnings:{type:"boolean",description:"Hide warnings for all your builds"},componentPrefix:{type:"string",description:"Identifier to prefix all your components (in lower case)",pattern:"^[a-z-]{2,}$"},dependances:{$ref:"#/$defs/dependances"},namespaceStrategy:{type:"string",enum:["manual","followFolders","followFoldersCamelCase","rules"],description:"Stragety to generate namespace",default:"manual"},namespaceRules:{type:"object",description:"Rules to define namespace when namespaceStrategy is rules"},namespaceRoot:{type:"string",description:"Root directory to define namespace when namespaceStrategy is followFolders"},build:{type:"array",items:{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:"Part name for the module. The export file will be ${module}@${name}",pattern:"^[a-zA-Z0-9_]+$"},version:{type:"string",pattern:"^[0-9]+.[0-9]+.[0-9]+$",description:"Version for this build (x.x.x)"},disabled:{type:"boolean",description:"Disable auto-build",default:!0},hideWarnings:{type:"boolean",description:"Hide warnings for this build"},componentPrefix:{type:"string",description:"Identifier to prefix all your components (in lower case)",pattern:"^[a-z-]{2,}$"},src:{type:"array",items:{type:"string"},description:"List of all pathes to listen watch"},stories:{type:"object",additionalProperties:!1,properties:{output:{type:"string",description:"Define where to export your stories"},workspace:{type:"string",description:"Define where to add the .storybook"},live:{type:"boolean",description:"Define if the story content must be recompiled on change"},format:{type:"string",enum:["all","public","protected","manual"],default:"all",description:"All will export all elements, public only public elements, protected only public and protected elements, manual only elements with tag Storybook"},prefix:{type:"string",description:"Define a prefix for all your stories name. Allow to group stories"},srcBaseUrl:{type:"string",description:"Define a base url to link file to your repo"}}},outsideModule:{type:"array",items:{type:"string"},description:"List of all pathes to import outside the module"},compile:{type:"array",items:{type:"object",additionalProperties:!1,properties:{input:{type:["string","array"],items:{type:"string"},description:"List of all pathes to import inside this build"},output:{type:["string","array"],items:{type:"string",pattern:"^\\S+\\.js"},pattern:"^\\S+\\.js",description:"The script file generated path"},outputNpm:{type:["string","array","object"],additionalProperties:!1,properties:{path:{type:["string","array"]},packageJson:{type:"boolean",description:"Define if you need to generate a package.json"},npmName:{type:"string",description:"Define the name set inside your package.json"}},items:{type:"string"},description:"Define where to export as npm files"},compressed:{type:"boolean"},package:{type:["string","array"],items:{type:"string",pattern:"^\\S+\\.package\\.avt"},pattern:"^\\S+\\.package\\.avt",description:"The package file generated path (for lib)"}}}},dependances:{$ref:"#/$defs/dependances"},module:{type:"string",pattern:"^[a-zA-Z0-9_]+$",description:"Name of the exported module for this build"},namespaceStrategy:{type:"string",enum:["manual","followFolders","followFoldersCamelCase","rules"],description:"Stragety to generate namespace",default:"manual"},namespaceRules:{type:"object",description:"Rules to define namespace when namespaceStrategy is rules"},namespaceRoot:{type:"string",description:"Root directory to define namespace when namespaceStrategy is followFolders"},avoidParsingInsideTags:{type:"array",items:{type:"string",pattern:"^[a-z-]+$"},description:"List of html tag that mustn't be parsed by the html compiler"},nodeModulesDir:{type:["string","array"],items:{type:"string"},description:"The dirs where node_modules are located"}},required:["name","src"]},minItems:1},static:{type:"array",items:{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:"Part name for the static export",pattern:"^[a-zA-Z0-9_]+$"},input:{type:"string",description:"Input path to watch to export as static files"},output:{type:["string","array"],items:{type:"string"},description:"Define where to export static files"}},required:["name","input","output"]}},avoidParsingInsideTags:{type:"array",items:{type:"string",pattern:"^[a-z-]+$"},description:"List of html tag that mustn't be parsed by the html compiler"},aliases:{type:"object"}},required:["build","module"],$defs:{dependances:{type:"array",description:"List of dependances for this build",items:{type:"object",additionalProperties:!1,properties:{uri:{type:"string",description:"Where to find the package or the json file"},npm:{type:"string",description:"The npm package name"},version:{type:"string",pattern:"^[0-9x]+.[0-9x]+.[0-9x]+$",description:"The version to use for this file. (default is x.x.x)",default:"x.x.x"},include:{type:"string",description:"Determine if the package must be included inside the final export. (default is need)",enum:["none","need","full"],default:"need"},subDependancesInclude:{type:"object",description:"Inclusion pattern for each lib. You can use a star to select everythink. If nothink find for a lib, the need value ll be used",patternProperties:{"^\\S+$":{type:"string",enum:["none","need","full"],default:"need"}}}},required:["uri"]}}}},t.AventusTemplateSchema={$schema:"foo://aventus/template.json",title:"JSON Schema for Aventus Template",description:"JSON Schema for Aventus Template",type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"},version:{type:"string",pattern:"^[0-9]+.[0-9]+.[0-9]+$"},variables:{type:"object",patternProperties:{"^.*$":{type:"object",additionalProperties:!1,properties:{question:{type:"string"},type:{type:"string",enum:["input","select"]},defaultValue:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"}]},list:{type:"object"},validation:{type:"array",items:{type:"object",additionalProperties:!1,properties:{pattern:{type:"string"},errorMsg:{type:"string"}},required:["pattern"]}}},required:["question","type"]}}},filesToOpen:{type:"array",items:{type:"string"}},cmdsAfter:{type:"array",items:{type:"string"}},cmdsAfterAdmin:{type:"array",items:{type:"string"}}},required:["name","description","version","variables"]},t.AventusSharpSchema={$schema:"foo://aventus/sharp.json",title:"JSON Schema for Aventus",description:"JSON Schema for Aventus",type:"object",additionalProperties:!1,properties:{csProj:{type:"string",pattern:"^\\S+\\.csproj"},outputPath:{type:"string"},exportEnumByDefault:{type:"boolean",default:!1},exportStorableByDefault:{type:"boolean",default:!0},exportHttpRouteByDefault:{type:"boolean",default:!0},exportErrorsByDefault:{type:"boolean",default:!0},exportWsEndPointByDefault:{type:"boolean",default:!0},exportWsEventByDefault:{type:"boolean",default:!0},exportWsRouteByDefault:{type:"boolean",default:!0},replacer:{type:"object",additionalProperties:!1,properties:{all:{$ref:"#/$defs/replacerPart"},genericError:{$ref:"#/$defs/replacerPart"},httpRouter:{$ref:"#/$defs/replacerPart"},normalClass:{$ref:"#/$defs/replacerPart"},storable:{$ref:"#/$defs/replacerPart"},withError:{$ref:"#/$defs/replacerPart"},wsEndPoint:{$ref:"#/$defs/replacerPart"},wsEvent:{$ref:"#/$defs/replacerPart"},wsRouter:{$ref:"#/$defs/replacerPart"}}},httpRouter:{type:"object",additionalProperties:!1,properties:{createRouter:{type:"boolean",default:!0},autobindRoute:{type:"string",enum:["none","auto","full"],default:"auto"},routerName:{type:"string",default:"GeneratedRouter"},variableRoutesName:{type:"string",default:"generatedHttpRoutes"},uri:{type:"string",default:"",pattern:"^(?=s*$)|^(\\/[a-zA-Z0-9_-]+?){1,}$"},host:{type:"string",default:"https://localhost:5000",pattern:"^http(s)?:\\/\\/[a-zA-Z0-9_-]*?(:[0-9]{3,4})?$"},parent:{type:"string",default:"Aventus.HttpRouter"},namespace:{type:"string",default:"Routes"}}},wsEndpoint:{type:"object",additionalProperties:!1,properties:{prefix:{type:"string",default:""}}}},required:["csProj","outputPath"],$defs:{replacerPart:{type:"object",additionalProperties:!1,properties:{type:{type:"object",patternProperties:{"^\\S+$":{type:"object",additionalProperties:!1,properties:{result:{type:"string"},file:{type:"string"},useTypeImport:{type:"boolean"}},required:["result"]}}},result:{type:"object",patternProperties:{"^\\S+$":{type:"object",additionalProperties:!1,properties:{result:{type:"string"},file:{type:"string"},useTypeImport:{type:"boolean"}},required:["result"]}}}}}}}},56733:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebSCSSFile=void 0;const r=n(71017),i=n(19408),s=n(83693),a=n(60206),o=n(1539),l=n(67246),c=n(16286),u=n(99007),p=n(95896),_=n(57999),d=n(69916),h=n(57147),f=n(18952),m=n(24964);class g extends l.AventusBaseFile{compiledVersion=-1;usedBy={};dependances={};diagnostics=[];diagnosticCompile;compiledTxt="";namespace="";_rules=new Map;customProperties=[];get compileResult(){return this.compiledTxt}get rules(){return this._rules}get htmlFile(){let e=this.build.htmlFiles[this.file.uri.replace(i.AventusExtension.ComponentStyle,i.AventusExtension.ComponentView)];return e instanceof p.AventusHTMLFile?e:null}get isGlobal(){return this.file.name.startsWith("@")}get globalName(){return this.file.name.replace(i.AventusExtension.ComponentStyle,"")}constructor(e,t){super(e,t),this.namespace=this.build.getNamespace(e.uri)}async init(){await this.loadDependances(),await this.compile(!1)}async onValidate(){return this.diagnostics=await this.build.scssLanguageService.doValidation(this.file),await this.loadDependances(),this.diagnosticCompile?[...this.diagnostics,this.diagnosticCompile]:this.diagnostics}async onContentChange(){}async onSave(){await this.compileRoot()}async compileRoot(){if(0==Object.values(this.usedBy).length)await this.compile();else for(let e in this.usedBy)this.usedBy[e].onSave()}async compile(e=!0){try{let t=this.compiledTxt,n="|error|";const r=async e=>{let t=e.contentUser;t=t.replace(/\/\*[\s\S]*?@import[\s\S]*?\*\/|\/\/.*@import.*/g,"");let i=/@import *?('|")(\S*?)('|");?/g,s=null;for(;s=i.exec(t);){let i=s[2],a=await this.resolvePath(i,e.folderPath);if(!a)return n;{let e=await r(a);if(e==n)return e;t=t.replace(s[0],e)}}return t};let s=await r(this.file);if("|error|"!=s)try{this.customProperties=u.AventusSCSSLanguageService.getCustomProperty(s),s=s.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1"),t=(0,d.compileString)(s,{style:"compressed"}).css.toString().trim(),this.diagnosticCompile&&(this.diagnosticCompile=void 0,m.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:this.diagnostics},this.build))}catch(e){if(e instanceof d.Exception){this.diagnosticCompile=(0,o.createErrorScss)(this.file.documentUser,e.message);const t=[...this.diagnostics,this.diagnosticCompile];m.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:t},this.build)}else console.log(e)}if(t!=this.compiledTxt)if(this.compiledVersion++,this.compiledTxt=t,this.isGlobal)a.HttpServer.getInstance().updateGlobalCSS(this.globalName,this.compiledTxt),this.build.build();else{let t=this.build.tsFiles[this.file.uri.replace(i.AventusExtension.ComponentStyle,i.AventusExtension.ComponentLogic)];if(t instanceof c.AventusWebComponentLogicalFile&&e&&(t.canUpdateComponent=!1,await t.triggerSave(),t.compilationResult)){let e=this.namespace,n=t.fileParsed?.classes[t.compilationResult.componentName].namespace;n&&(e+=n),e.length>0&&!e.endsWith(".")&&(e+="."),a.HttpServer.getInstance().updateCSS(this.compiledTxt,e+t.compilationResult.componentName,[])}}this._rules=this.build.scssLanguageService.getRules(this.file);let l=this.build.htmlFiles[this.file.uri.replace(i.AventusExtension.ComponentStyle,i.AventusExtension.ComponentView)];l instanceof p.AventusHTMLFile&&_.ParserHtml.refreshStyle(l,this._build)}catch(e){console.error(e)}}async onDelete(){for(let e in this.dependances)this.removeDependance(e);for(let e in this.usedBy)delete this.usedBy[e].dependances[this.file.uri],delete this.usedBy[e],await this.usedBy[e].onContentChange()}async onCompletion(e,t){let n={isIncomplete:!1,items:[]};return n=await this.build.scssLanguageService.doComplete(e,t),n}async onCompletionResolve(e,t){return t}async onHover(e,t){return this.build.scssLanguageService.doHover(e,t)}async onDefinition(e,t){return this.build.scssLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return this.build.scssLanguageService.format(e,t,n)}async onCodeAction(e,t){return this.build.scssLanguageService.doCodeAction(e,t)}async onReferences(e,t){let n=await this.build.scssLanguageService.onReferences(e,t);return n=[...n,...this.build.scssLanguageService.getLinkToHtml(this,t)],n}async onCodeLens(e){return[]}onGetBuild(){return[this.build]}async onRename(e,t,n){return null}async loadDependances(){let e=this.file.contentUser,t=e.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1"),n=/@import *?('|")(\S*?)('|");?/g,r=null;for(let e in this.dependances)this.removeDependance(e);for(;r=n.exec(t);){let t=r[2],n=await this.resolvePath(t,this.file.folderPath);if(n)await this.addDependance(n);else{let t=e.indexOf(r[0]),n=t+r[0].length;this.diagnostics.push((0,o.createErrorScssPos)(this.file.documentUser,"Can't load this file",t,n))}}}removeDependance(e){this.dependances[e]&&(delete this.dependances[e].usedBy[this.file.uri],delete this.dependances[e])}async addDependance(e){this.build.scssFiles[e.uri]?(this.dependances[e.uri]=this.build.scssFiles[e.uri],this.build.scssFiles[e.uri].usedBy[this.file.uri]=this):e.uri.endsWith(i.AventusExtension.ComponentStyle)&&(this.build.scssFiles[e.uri]=new g(e,this.build),await this.build.scssFiles[e.uri].init(),this.dependances[e.uri]=this.build.scssFiles[e.uri],this.build.scssFiles[e.uri].usedBy[this.file.uri]=this)}async getByPath(e){let t=s.FilesManager.getInstance().getByPath(e);if(t)return t;if((0,h.existsSync)(e)&&(0,h.lstatSync)(e).isFile()){let t=f.TextDocument.create((0,o.pathToUri)(e),i.AventusLanguageId.SCSS,1,(0,h.readFileSync)(e,"utf-8"));return await s.FilesManager.getInstance().registerFile(t),s.FilesManager.getInstance().getByPath(e)}}async resolvePath(e,t){e=this.build.project.resolveAlias(e,t),e=(0,r.normalize)(t+"/"+e);let n=await this.getByPath(e);if(n)return n;let s=e+i.AventusExtension.ComponentStyle;if(n=await this.getByPath(s),n)return n;let a=e.split(r.sep);a[a.length-1]="_"+a[a.length-1];let o=a.join(r.sep);if(n=await this.getByPath(o),n)return n;let l=o+i.AventusExtension.ComponentStyle;return n=await this.getByPath(l),n||void 0}}t.AventusWebSCSSFile=g},81940:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusGlobalSCSSFile=void 0;const r=n(37071),i=n(71017),s=n(83693),a=n(19408),o=n(1539),l=n(57147),c=n(69916),u=n(24964),p=n(29495);class _ extends r.AventusGlobalBaseFile{compiledVersion=-1;usedBy={};dependances={};diagnostics=[];diagnosticCompile;compiledTxt="";savedOnce=!1;staticNamebyOutPath={};get resultCompiled(){return this.compiledTxt}constructor(e,t){super(e,t),this.loadDependances(),this.project.globalSCSSLanguageService.loadVariables(this,this.file.uri)}async onContentChange(){}async onValidate(){return this.diagnostics=await this.project.globalSCSSLanguageService.doValidation(this.file),this.loadDependances(),this.diagnosticCompile?[...this.diagnostics,this.diagnosticCompile]:this.diagnostics}async onSave(){this.savedOnce=!0,this.compileRoot(),this.project.globalSCSSLanguageService.loadVariables(this,this.file.uri)}compileRoot(){if(0==Object.values(this.usedBy).length)this.compile();else for(let e in this.usedBy)this.usedBy[e].onSave()}compile(){try{let e=this.compiledTxt,t="|error|";const n=e=>{let r=e.contentUser;r=r.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1");let i=/@import *?('|")(\S*?)('|");?/g,s=null;for(;s=i.exec(r);){let i=s[2],a=this.resolvePath(i,e.folderPath);if(!a)return t;{let e=n(a);if(e==t)return e;r=r.replace(s[0],e)}}return r};let r=n(this.file);if("|error|"!=r){const t=e=>{if(p.SettingsManager.getInstance().settings.errorByBuild){const t=this.project.getBuilds();for(let n of t)u.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:e},n)}else u.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:e})};try{e=(0,c.compileString)(r,{style:"compressed"}).css.toString().trim(),this.diagnosticCompile&&(this.diagnosticCompile=void 0,t(this.diagnostics))}catch(e){if(e instanceof c.Exception){this.diagnosticCompile=(0,o.createErrorScss)(this.file.documentUser,e.message);t([...this.diagnostics,this.diagnosticCompile])}}}e!=this.compiledTxt&&(this.compiledVersion++,this.compiledTxt=e,this.export())}catch(e){console.error(e)}}async onDelete(){for(let e in this.dependances)this.removeDependance(e);for(let e in this.usedBy)delete this.usedBy[e].dependances[this.file.uri],delete this.usedBy[e],await this.usedBy[e].onContentChange();this.project.globalSCSSLanguageService.removeVariables(this.file.uri)}async onCompletion(e,t){let n={isIncomplete:!1,items:[]};return n=await this.project.globalSCSSLanguageService.doComplete(e,t),n}async onCompletionResolve(e,t){return t}async onHover(e,t){return this.project.globalSCSSLanguageService.doHover(e,t)}async onDefinition(e,t){return this.project.globalSCSSLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return this.project.globalSCSSLanguageService.format(e,t,n)}async onCodeAction(e,t){return this.project.globalSCSSLanguageService.doCodeAction(e,t)}async onReferences(e,t){return await this.project.globalSCSSLanguageService.onReferences(e,t)}async onCodeLens(e){return[]}async onRename(e,t,n){return null}addOutPath(e,t){this.file.shortname.startsWith("_")||this.staticNamebyOutPath[e]||(this.staticNamebyOutPath[e]=t,this.savedOnce?this.export():this.onSave())}export(){for(let e in this.staticNamebyOutPath){let t=(0,i.normalize)(e),n=t.split(i.sep);n.pop();let r=n.join(i.sep);(0,l.existsSync)(r)||(0,l.mkdirSync)(r,{recursive:!0}),(0,o.writeFile)(t,this.compiledTxt,"static",this.staticNamebyOutPath[e])}}loadDependances(){let e=this.file.contentUser,t=e.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1"),n=/@import *?('|")(\S*?)('|");?/g,r=null;for(let e in this.dependances)this.removeDependance(e);for(;r=n.exec(t);){let t=r[2],n=this.resolvePath(t,this.file.folderPath);if(n)this.addDependance(n);else{let t=e.indexOf(r[0]),n=t+r[0].length;this.diagnostics.push((0,o.createErrorScssPos)(this.file.documentUser,"Can't load this file",t,n))}}}removeDependance(e){this.dependances[e]&&(delete this.dependances[e].usedBy[this.file.uri],delete this.dependances[e])}addDependance(e){this.project.scssFiles[e.uri]?(this.dependances[e.uri]=this.project.scssFiles[e.uri],this.project.scssFiles[e.uri].usedBy[this.file.uri]=this):e.uri.endsWith(a.AventusExtension.GlobalStyle)&&(this.project.scssFiles[e.uri]=new _(e,this.project),this.dependances[e.uri]=this.project.scssFiles[e.uri],this.project.scssFiles[e.uri].usedBy[this.file.uri]=this)}resolvePath(e,t){e=this.project.resolveAlias(e,t),e=(0,i.normalize)(t+"/"+e);let n=s.FilesManager.getInstance().getByPath(e);if(n)return n;let r=e+a.AventusExtension.GlobalStyle;if(n=s.FilesManager.getInstance().getByPath(r),n)return n;let o=e.split(i.sep);o[o.length-1]="_"+o[o.length-1];let l=o.join(i.sep);if(n=s.FilesManager.getInstance().getByPath(l),n)return n;let c=l+a.AventusExtension.GlobalStyle;return n=s.FilesManager.getInstance().getByPath(c),n||void 0}}t.AventusGlobalSCSSFile=_},22399:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusGlobalSCSSLanguageService=void 0;const r=n(51722),i=n(50009),s=n(82285),a=n(12056),o=n(42374),l=n(24560);t.AventusGlobalSCSSLanguageService=class{languageService;variablesByUri={};variablesByName={};constructor(){this.languageService=(0,a.getSCSSLanguageService)()}async doValidation(e){return this.languageService.doValidation(e.documentUser,this.languageService.parseStylesheet(e.documentUser))}async doComplete(e,t){return this.languageService.doComplete(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async doHover(e,t){return this.languageService.doHover(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async findDefinition(e,t){return this.languageService.findDefinition(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async format(e,t,n){let a={...n,preserveNewLines:!0,spaceAroundSelectorSeparator:!0,insertFinalNewline:!0,insertSpaces:!1,tabSize:4},o=e.documentUser,l=await this.languageService.format(o,t,a);if(1==l.length){let e=o.offsetAt(l[0].range.start),t=o.offsetAt(l[0].range.end),n=o.getText().length;if(0==e&&t==n){let e=await(0,r.default)([i({order:["custom-properties","dollar-variables","declarations","at-rules","rules"],"properties-order":"alphabetical"})]).process(l[0].newText,{parser:s,from:"./temp.scss",to:"./temp.scss"});l[0].newText=e.css}}return l}async doCodeAction(e,t){let n=this.languageService.parseStylesheet(e.documentUser),r=o.CodeActionContext.create(this.languageService.doValidation(e.documentUser,n));return this.languageService.doCodeActions2(e.documentUser,t,r,n)}async onReferences(e,t){let n=this.languageService.parseStylesheet(e.documentUser);return this.languageService.findReferences(e.documentUser,t,n)}loadVariables(e,t){let n=e.file.documentUser,r={};const i=e=>{if(e.type==l.NodeType.CustomPropertyDeclaration){let i=e;for(;i&&null==i.selectors;)i=i.parent;if(i){if(":root"==i.selectors.getText()){let i=e.getChild(0),s=e.getChild(1);if(i&&s){let e=i.getText();e.startsWith("--")&&(i.offset,r[e]||(r[e]={name:e,uri:t,range:{start:n.positionAt(i.offset),end:n.positionAt(i.end)},value:s.getText()}))}}}}else if(e.hasChildren())for(let t of e.getChildren())i(t)};let s=(0,a.getSCSSLanguageService)().parseStylesheet(n),o=(0,l.getNodePath)(s,0);for(let e of o)i(e);this.variablesByUri[t]=Object.values(r),this.reloadVariables()}reloadVariables(){this.variablesByName={};for(let e in this.variablesByUri)for(let t of this.variablesByUri[e])this.variablesByName[t.name]||(this.variablesByName[t.name]=t)}removeVariables(e){delete this.variablesByUri[e],this.reloadVariables()}getDefinition(e){return this.variablesByName[e]}}},99007:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusSCSSLanguageService=void 0;const r=n(51722),i=n(50009),s=n(82285),a=n(12056),o=n(42374),l=n(24560),c=n(18952);t.AventusSCSSLanguageService=class{languageService;documentationInfo={};externalDocumentation={};internalDocumentation={};build;getInternalDocumentation(){let e={};for(let t in this.internalDocumentation)try{e={...e,...this.internalDocumentation[t]}}catch(e){}return e}constructor(e){this.build=e,this.languageService=(0,a.getSCSSLanguageService)()}async doValidation(e){let t=[];t=this.languageService.doValidation(e.documentUser,this.languageService.parseStylesheet(e.documentUser));for(let e=0;e<t.length;e++)"emptyRules"==t[e].code&&(t.splice(e,1),e--);return t}async doComplete(e,t){let n=[],r={isIncomplete:!1,items:[]};r=this.languageService.doComplete(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser));let i={};for(let e of r.items)i[e.label]=e;let s=this.getTree(e,t).reverse()[0];if(this.documentationInfo[s])for(let e of this.documentationInfo[s])-1==n.indexOf(e.name)&&(n.push(e.name),i[e.name]={label:e.name});const a=/^(#([\da-f]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))$/i;for(let e in this.build.globalSCSSLanguageService.variablesByName){this.build.globalSCSSLanguageService.variablesByName[e].value.match(a)?i[e]={label:e}:i[""+e]={label:""+e}}return r.items=Object.values(i),r}async doHover(e,t){let n=this.getElementAtPosition(e,t);if(n?.type==l.NodeType.Identifier){let e=this.build.globalSCSSLanguageService.getDefinition(n.getText());if(e)return{contents:{kind:"plaintext",value:e.name+": "+e.value}}}return this.languageService.doHover(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async findDefinition(e,t){let n=this.getElementAtPosition(e,t);if(n?.type==l.NodeType.Identifier){let e=this.build.globalSCSSLanguageService.getDefinition(n.getText());if(e)return{uri:e.uri,range:e.range}}return this.languageService.findDefinition(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async format(e,t,n){let a={...n,preserveNewLines:!0,spaceAroundSelectorSeparator:!0,insertFinalNewline:!0,insertSpaces:!1,tabSize:4},o=e.documentUser,l=await this.languageService.format(o,t,a);if(1==l.length){let e=o.offsetAt(l[0].range.start),t=o.offsetAt(l[0].range.end),n=o.getText().length;if(0==e&&t==n){let e=await(0,r.default)([i({order:["custom-properties","dollar-variables","declarations","at-rules","rules"],"properties-order":"alphabetical"})]).process(l[0].newText,{parser:s,syntax:s,from:"./temp.scss",to:"./temp.scss"});l[0].newText=e.css}}return l}async doCodeAction(e,t){let n=this.languageService.parseStylesheet(e.documentUser),r=o.CodeActionContext.create(this.languageService.doValidation(e.documentUser,n));return this.languageService.doCodeActions2(e.documentUser,t,r,n)}async onReferences(e,t){let n=this.languageService.parseStylesheet(e.documentUser);return this.languageService.findReferences(e.documentUser,t,n)}rebuildDefinition(){this.documentationInfo={};for(let e in this.externalDocumentation){let t=this.externalDocumentation[e];this.documentationInfo={...this.documentationInfo,...t}}for(let e in this.internalDocumentation){let t=this.internalDocumentation[e];try{this.documentationInfo={...this.documentationInfo,...t}}catch(e){}}}addExternalDefinition(e,t){this.externalDocumentation[e]=t,this.rebuildDefinition()}removeExternalDefinition(e){delete this.externalDocumentation[e],this.rebuildDefinition()}addInternalDefinition(e,t){this.internalDocumentation[e]=t,this.rebuildDefinition()}removeInternalDefinition(e){delete this.internalDocumentation[e],this.rebuildDefinition()}getLinkToHtml(e,t){let n=[],r=e.file.documentUser.offsetAt(t),i=e.htmlFile;if(i&&i.fileParsed)for(let e of i.fileParsed.styleLinks){let t=e[1];r>=t.start&&r<=t.end&&n.push({uri:i.file.uri,range:{start:i.file.documentUser.positionAt(e[0].start),end:i.file.documentUser.positionAt(e[0].end)}})}return n}getTree(e,t){let n=[];if(this.languageService){let r=this.languageService.parseStylesheet(e.documentUser),i=e.documentUser.offsetAt(t),s=(0,l.getNodePath)(r,i);for(let e of s)if(e.type==l.NodeType.Ruleset){let t=e.getChild(0);if(t){let e=t.getText();n.push(e)}}}return n}getRules(e){let t=new Map,n=this.languageService.parseStylesheet(e.documentUser);const r=e=>t=>{let n=e.getText().replace(".",""),r=new RegExp("((?:^|\\W))("+n+")(?:$|\\W)","gi");return!!t.attributes.class?.value?.match(r)},i=e=>t=>{let n=e.getText();return t.tagName==n},s=(e=null,t)=>n=>{if(e){let t=!1,r=n.parent;for(;r;){if(e(r)){t=!0;break}r=r.parent}if(!t)return!1}for(let e of t)if(!e(n))return!1;return!0},a=(e,n=null)=>{if(e.type==l.NodeType.Ruleset){let a=!1,o=e.getChildren();if(o.length>1)for(let e of o[1].getChildren())if(e.type==l.NodeType.Declaration||e.type==l.NodeType.CustomPropertyDeclaration||e.type==l.NodeType.MixinDeclaration||e.type==l.NodeType.FunctionDeclaration||e.type==l.NodeType.VariableDeclaration){a=!0;break}if(o.length>0){let e=o[0]?.getChildren()[0],a=null;if(e){for(let t of e.getChildren())if(t.type==l.NodeType.SimpleSelector){a?a.start>t.offset?a.start=t.offset:a.end<t.offset+t.length&&(a.end=t.offset+t.length):a={start:t.offset,end:t.offset+t.length};let e=[];for(let n of t.getChildren())n.type==l.NodeType.ClassSelector?e.push(r(n)):n.type==l.NodeType.ElementNameSelector&&e.push(i(n));e.length>0&&(n=s(n,e))}else{t.getText();console.log("css node to implement")}n&&a&&t.set(n,a)}}}else if(e.type==l.NodeType.Property)return;if(e.hasChildren())for(let t of e.getChildren())a(t,n)};let o=(0,l.getNodePath)(n,0);return o.length>0&&a(o[0]),t}getElementAtPosition(e,t){if(this.languageService){let n=this.languageService.parseStylesheet(e.documentUser),r=e.documentUser.offsetAt(t),i=e=>{let t=e.getChildren();for(let e of t)if(e.offset<=r&&e.end>=r)return e.hasChildren()?i(e):e;return null};return i(n)}return null}static getCustomProperty(e){let t=c.TextDocument.create("temp.scss","scss",1,e),n={};const r=e=>{if(e.type==l.NodeType.CustomPropertyDeclaration){let t=e;for(;t&&null==t.selectors;)t=t.parent;if(t){if(":host"==t.selectors.getText()){let t=e.getChild(0),r=e.getChild(1);if(t&&r){let i=null;t.getText().startsWith("--internal")?i=t.getText().replace("--internal-","--"):t.getText().startsWith("--_")&&(i=t.getText().replace("--_","--"));const s=((e,t)=>{let n=e.parent?.getText()??"";const r=new RegExp(`/\\*([\\s\\S]*?)\\*/\\s*${t}\\s*:\\s*[^;]+;`,"g").exec(n);if(r&&r[1]){const e={documentation:[],type:"*"},t=r[1].trim().split("\n");let n=!1;for(let r of t)r=r.replace("*","").trim(),r.startsWith("@")?(n=!0,r.startsWith("@type")&&(e.type=r.replace("@type","").trim()),r.startsWith("@default")&&(e.default=r.replace("@default","").trim())):n||e.documentation.push(r);return e}return null})(e,t.getText());if(i&&-1!=r.getText().indexOf(i)){const e={name:i};s?.documentation&&(e.documentation=s.documentation.join("\n")),s?.type&&(e.type=s.type),s?.default&&(e.defaultValue=s.default);let t=r,a=[],o="";for(;t&&t.getChildren().length>0;){let e=t.getChildren(),n=t.getText();n&&n.startsWith("--")&&(n=n.split(",")[0],o!=n&&n!=i&&(o=n,a.push(n))),t=e[e.length-1]}let l=t.getText()??"";l&&(l.startsWith("--")||a.push(l)),a.length>0&&(e.chainValues=a),n[e.name]=e}}}}}else if(e.hasChildren())for(let t of e.getChildren())r(t)};let i=(0,a.getSCSSLanguageService)().parseStylesheet(t),s=(0,l.getNodePath)(i,0);for(let e of s)r(e);return Object.values(n)}}},24560:(e,t)=>{"use strict";var n,r;function i(e,t){let n=null;return!e||t<e.offset||t>e.end?null:(e.accept((e=>-1===e.offset&&-1===e.length||e.offset<=t&&e.end>=t&&(n?e.length<=n.length&&(n=e):n=e,!0))),n)}Object.defineProperty(t,"__esModule",{value:!0}),t.BinaryExpression=t.Expression=t.PageBoxMarginBox=t.Page=t.SupportsCondition=t.MediaFeature=t.MediaCondition=t.MediaQuery=t.Medialist=t.Document=t.Supports=t.Media=t.Namespace=t.ForwardVisibility=t.Forward=t.ModuleConfiguration=t.Use=t.Import=t.KeyframeSelector=t.Keyframe=t.NestedProperties=t.FontFace=t.ViewPort=t.FunctionDeclaration=t.ElseStatement=t.WhileStatement=t.EachStatement=t.ForStatement=t.IfStatement=t.FunctionArgument=t.FunctionParameter=t.Function=t.Invocation=t.Property=t.CustomPropertyDeclaration=t.Declaration=t.CustomPropertySet=t.AbstractDeclaration=t.AtApplyRule=t.SimpleSelector=t.Selector=t.RuleSet=t.BodyDeclaration=t.Declarations=t.Stylesheet=t.Identifier=t.Nodelist=t.Node=t.ReferenceType=t.NodeType=void 0,t.ParseErrorCollector=t.Marker=t.Level=t.Module=t.GuardCondition=t.LessGuard=t.ListEntry=t.UnknownAtRule=t.MixinDeclaration=t.MixinReference=t.MixinContentDeclaration=t.MixinContentReference=t.ExtendsReference=t.Variable=t.Interpolation=t.VariableDeclaration=t.NumericValue=t.RatioValue=t.HexColorValue=t.Operator=t.AttributeSelector=t.Term=void 0,t.getNodeAtOffset=i,t.getNodePath=function(e,t){let n=i(e,t);const r=[];for(;n;)r.unshift(n),n=n.parent;return r},t.getParentDeclaration=function(e){const t=e.findParent(n.Declaration),r=t&&t.getValue();if(r&&r.encloses(e))return t;return null},function(e){e[e.Undefined=0]="Undefined",e[e.Identifier=1]="Identifier",e[e.Stylesheet=2]="Stylesheet",e[e.Ruleset=3]="Ruleset",e[e.Selector=4]="Selector",e[e.SimpleSelector=5]="SimpleSelector",e[e.SelectorInterpolation=6]="SelectorInterpolation",e[e.SelectorCombinator=7]="SelectorCombinator",e[e.SelectorCombinatorParent=8]="SelectorCombinatorParent",e[e.SelectorCombinatorSibling=9]="SelectorCombinatorSibling",e[e.SelectorCombinatorAllSiblings=10]="SelectorCombinatorAllSiblings",e[e.SelectorCombinatorShadowPiercingDescendant=11]="SelectorCombinatorShadowPiercingDescendant",e[e.Page=12]="Page",e[e.PageBoxMarginBox=13]="PageBoxMarginBox",e[e.ClassSelector=14]="ClassSelector",e[e.IdentifierSelector=15]="IdentifierSelector",e[e.ElementNameSelector=16]="ElementNameSelector",e[e.PseudoSelector=17]="PseudoSelector",e[e.AttributeSelector=18]="AttributeSelector",e[e.Declaration=19]="Declaration",e[e.Declarations=20]="Declarations",e[e.Property=21]="Property",e[e.Expression=22]="Expression",e[e.BinaryExpression=23]="BinaryExpression",e[e.Term=24]="Term",e[e.Operator=25]="Operator",e[e.Value=26]="Value",e[e.StringLiteral=27]="StringLiteral",e[e.URILiteral=28]="URILiteral",e[e.EscapedValue=29]="EscapedValue",e[e.Function=30]="Function",e[e.NumericValue=31]="NumericValue",e[e.HexColorValue=32]="HexColorValue",e[e.RatioValue=33]="RatioValue",e[e.MixinDeclaration=34]="MixinDeclaration",e[e.MixinReference=35]="MixinReference",e[e.VariableName=36]="VariableName",e[e.VariableDeclaration=37]="VariableDeclaration",e[e.Prio=38]="Prio",e[e.Interpolation=39]="Interpolation",e[e.NestedProperties=40]="NestedProperties",e[e.ExtendsReference=41]="ExtendsReference",e[e.SelectorPlaceholder=42]="SelectorPlaceholder",e[e.Debug=43]="Debug",e[e.If=44]="If",e[e.Else=45]="Else",e[e.For=46]="For",e[e.Each=47]="Each",e[e.While=48]="While",e[e.MixinContentReference=49]="MixinContentReference",e[e.MixinContentDeclaration=50]="MixinContentDeclaration",e[e.Media=51]="Media",e[e.Keyframe=52]="Keyframe",e[e.FontFace=53]="FontFace",e[e.Import=54]="Import",e[e.Namespace=55]="Namespace",e[e.Invocation=56]="Invocation",e[e.FunctionDeclaration=57]="FunctionDeclaration",e[e.ReturnStatement=58]="ReturnStatement",e[e.MediaQuery=59]="MediaQuery",e[e.MediaCondition=60]="MediaCondition",e[e.MediaFeature=61]="MediaFeature",e[e.FunctionParameter=62]="FunctionParameter",e[e.FunctionArgument=63]="FunctionArgument",e[e.KeyframeSelector=64]="KeyframeSelector",e[e.ViewPort=65]="ViewPort",e[e.Document=66]="Document",e[e.AtApplyRule=67]="AtApplyRule",e[e.CustomPropertyDeclaration=68]="CustomPropertyDeclaration",e[e.CustomPropertySet=69]="CustomPropertySet",e[e.ListEntry=70]="ListEntry",e[e.Supports=71]="Supports",e[e.SupportsCondition=72]="SupportsCondition",e[e.NamespacePrefix=73]="NamespacePrefix",e[e.GridLine=74]="GridLine",e[e.Plugin=75]="Plugin",e[e.UnknownAtRule=76]="UnknownAtRule",e[e.Use=77]="Use",e[e.ModuleConfiguration=78]="ModuleConfiguration",e[e.Forward=79]="Forward",e[e.ForwardVisibility=80]="ForwardVisibility",e[e.Module=81]="Module"}(n||(t.NodeType=n={})),function(e){e[e.Mixin=0]="Mixin",e[e.Rule=1]="Rule",e[e.Variable=2]="Variable",e[e.Function=3]="Function",e[e.Keyframe=4]="Keyframe",e[e.Unknown=5]="Unknown",e[e.Module=6]="Module",e[e.Forward=7]="Forward",e[e.ForwardVisibility=8]="ForwardVisibility"}(r||(t.ReferenceType=r={}));class s{parent;offset;length;get end(){return this.offset+this.length}options;textProvider;children;issues;nodeType;constructor(e=-1,t=-1,n){this.parent=null,this.offset=e,this.length=t,n&&(this.nodeType=n)}set type(e){this.nodeType=e}get type(){return this.nodeType||n.Undefined}getTextProvider(){let e=this;for(;e&&!e.textProvider;)e=e.parent;return e?e.textProvider:()=>"unknown"}getText(){return this.getTextProvider()(this.offset,this.length)}matches(e){return this.length===e.length&&this.getTextProvider()(this.offset,this.length)===e}startsWith(e){return this.length>=e.length&&this.getTextProvider()(this.offset,e.length)===e}endsWith(e){return this.length>=e.length&&this.getTextProvider()(this.end-e.length,e.length)===e}accept(e){if(e(this)&&this.children)for(const t of this.children)t.accept(e)}acceptVisitor(e){this.accept(e.visitNode.bind(e))}adoptChild(e,t=-1){if(e.parent&&e.parent.children){const t=e.parent.children.indexOf(e);t>=0&&e.parent.children.splice(t,1)}e.parent=this;let n=this.children;return n||(n=this.children=[]),-1!==t?n.splice(t,0,e):n.push(e),e}attachTo(e,t=-1){return e&&e.adoptChild(this,t),this}collectIssues(e){this.issues&&e.push.apply(e,this.issues)}addIssue(e){this.issues||(this.issues=[]),this.issues.push(e)}hasIssue(e){return Array.isArray(this.issues)&&this.issues.some((t=>t.getRule()===e))}isErroneous(e=!1){return!!(this.issues&&this.issues.length>0)||e&&Array.isArray(this.children)&&this.children.some((e=>e.isErroneous(!0)))}setNode(e,t,n=-1){return!!t&&(t.attachTo(this,n),this[e]=t,!0)}addChild(e){return!!e&&(this.children||(this.children=[]),e.attachTo(this),this.updateOffsetAndLength(e),!0)}updateOffsetAndLength(e){(e.offset<this.offset||-1===this.offset)&&(this.offset=e.offset);const t=e.end;(t>this.end||-1===this.length)&&(this.length=t-this.offset)}hasChildren(){return!!this.children&&this.children.length>0}getChildren(){return this.children?this.children.slice(0):[]}getChild(e){return this.children&&e<this.children.length?this.children[e]:null}addChildren(e){for(const t of e)this.addChild(t)}findFirstChildBeforeOffset(e){if(this.children){let t=null;for(let n=this.children.length-1;n>=0;n--)if(t=this.children[n],t.offset<=e)return t}return null}findChildAtOffset(e,t){const n=this.findFirstChildBeforeOffset(e);return n&&n.end>=e?t&&n.findChildAtOffset(e,!0)||n:null}encloses(e){return this.offset<=e.offset&&this.offset+this.length>=e.offset+e.length}getParent(){let e=this.parent;for(;e instanceof a;)e=e.parent;return e}findParent(e){let t=this;for(;t&&t.type!==e;)t=t.parent;return t}findAParent(...e){let t=this;for(;t&&!e.some((e=>t.type===e));)t=t.parent;return t}setData(e,t){this.options||(this.options={}),this.options[e]=t}getData(e){return this.options&&this.options.hasOwnProperty(e)?this.options[e]:null}}t.Node=s;class a extends s{constructor(e,t=-1){super(-1,-1),this.attachTo(e,t),this.offset=-1,this.length=-1}}t.Nodelist=a;t.Identifier=class extends s{referenceTypes;isCustomProperty=!1;constructor(e,t){super(e,t)}get type(){return n.Identifier}containsInterpolation(){return this.hasChildren()}};t.Stylesheet=class extends s{constructor(e,t){super(e,t)}get type(){return n.Stylesheet}};class o extends s{constructor(e,t){super(e,t)}get type(){return n.Declarations}}t.Declarations=o;class l extends s{declarations;constructor(e,t){super(e,t)}getDeclarations(){return this.declarations}setDeclarations(e){return this.setNode("declarations",e)}}t.BodyDeclaration=l;t.RuleSet=class extends l{selectors;constructor(e,t){super(e,t)}get type(){return n.Ruleset}getSelectors(){return this.selectors||(this.selectors=new a(this)),this.selectors}isNested(){return!!this.parent&&null!==this.parent.findParent(n.Declarations)}};t.Selector=class extends s{constructor(e,t){super(e,t)}get type(){return n.Selector}};t.SimpleSelector=class extends s{constructor(e,t){super(e,t)}get type(){return n.SimpleSelector}};t.AtApplyRule=class extends s{identifier;constructor(e,t){super(e,t)}get type(){return n.AtApplyRule}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}};class c extends s{colonPosition;semicolonPosition;constructor(e,t){super(e,t)}}t.AbstractDeclaration=c;t.CustomPropertySet=class extends l{constructor(e,t){super(e,t)}get type(){return n.CustomPropertySet}};class u extends c{property=null;value;nestedProperties;constructor(e,t){super(e,t)}get type(){return n.Declaration}setProperty(e){return this.setNode("property",e)}getProperty(){return this.property}getFullPropertyName(){const e=this.property?this.property.getName():"unknown";if(this.parent instanceof o&&this.parent.getParent()instanceof _){const t=this.parent.getParent().getParent();if(t instanceof u)return t.getFullPropertyName()+e}return e}getNonPrefixedPropertyName(){const e=this.getFullPropertyName();if(e&&"-"===e.charAt(0)){const t=e.indexOf("-",1);if(-1!==t)return e.substring(t+1)}return e}setValue(e){return this.setNode("value",e)}getValue(){return this.value}setNestedProperties(e){return this.setNode("nestedProperties",e)}getNestedProperties(){return this.nestedProperties}}t.Declaration=u;t.CustomPropertyDeclaration=class extends u{propertySet;constructor(e,t){super(e,t)}get type(){return n.CustomPropertyDeclaration}setPropertySet(e){return this.setNode("propertySet",e)}getPropertySet(){return this.propertySet}};t.Property=class extends s{identifier;constructor(e,t){super(e,t)}get type(){return n.Property}setIdentifier(e){return this.setNode("identifier",e)}getIdentifier(){return this.identifier}getName(){return this.trim(this.getText(),/[_\+]+$/)}isCustomProperty(){return!!this.identifier&&this.identifier.isCustomProperty}trim(e,t){const n=t.exec(e);return n&&n[0].length?e.substr(0,e.length-n[0].length):e}};class p extends s{arguments;constructor(e,t){super(e,t)}get type(){return n.Invocation}getArguments(){return this.arguments||(this.arguments=new a(this)),this.arguments}}t.Invocation=p;t.Function=class extends p{identifier;constructor(e,t){super(e,t)}get type(){return n.Function}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}};t.FunctionParameter=class extends s{identifier;defaultValue;constructor(e,t){super(e,t)}get type(){return n.FunctionParameter}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}setDefaultValue(e){return this.setNode("defaultValue",e,0)}getDefaultValue(){return this.defaultValue}};t.FunctionArgument=class extends s{identifier;value;constructor(e,t){super(e,t)}get type(){return n.FunctionArgument}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}setValue(e){return this.setNode("value",e,0)}getValue(){return this.value}};t.IfStatement=class extends l{expression;elseClause;constructor(e,t){super(e,t)}get type(){return n.If}setExpression(e){return this.setNode("expression",e,0)}setElseClause(e){return this.setNode("elseClause",e)}};t.ForStatement=class extends l{variable;constructor(e,t){super(e,t)}get type(){return n.For}setVariable(e){return this.setNode("variable",e,0)}};t.EachStatement=class extends l{variables;constructor(e,t){super(e,t)}get type(){return n.Each}getVariables(){return this.variables||(this.variables=new a(this)),this.variables}};t.WhileStatement=class extends l{constructor(e,t){super(e,t)}get type(){return n.While}};t.ElseStatement=class extends l{constructor(e,t){super(e,t)}get type(){return n.Else}};t.FunctionDeclaration=class extends l{identifier;parameters;constructor(e,t){super(e,t)}get type(){return n.FunctionDeclaration}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}};t.ViewPort=class extends l{constructor(e,t){super(e,t)}get type(){return n.ViewPort}};t.FontFace=class extends l{constructor(e,t){super(e,t)}get type(){return n.FontFace}};class _ extends l{constructor(e,t){super(e,t)}get type(){return n.NestedProperties}}t.NestedProperties=_;t.Keyframe=class extends l{keyword;identifier;constructor(e,t){super(e,t)}get type(){return n.Keyframe}setKeyword(e){return this.setNode("keyword",e,0)}getKeyword(){return this.keyword}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}};t.KeyframeSelector=class extends l{constructor(e,t){super(e,t)}get type(){return n.KeyframeSelector}};t.Import=class extends s{constructor(e,t){super(e,t)}get type(){return n.Import}setMedialist(e){return!!e&&(e.attachTo(this),!0)}};t.Use=class extends s{identifier;parameters;get type(){return n.Use}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}};t.ModuleConfiguration=class extends s{identifier;value;get type(){return n.ModuleConfiguration}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}setValue(e){return this.setNode("value",e,0)}getValue(){return this.value}};t.Forward=class extends s{identifier;members;parameters;get type(){return n.Forward}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getMembers(){return this.members||(this.members=new a(this)),this.members}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}};t.ForwardVisibility=class extends s{identifier;get type(){return n.ForwardVisibility}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}};t.Namespace=class extends s{constructor(e,t){super(e,t)}get type(){return n.Namespace}};t.Media=class extends l{constructor(e,t){super(e,t)}get type(){return n.Media}};t.Supports=class extends l{constructor(e,t){super(e,t)}get type(){return n.Supports}};t.Document=class extends l{constructor(e,t){super(e,t)}get type(){return n.Document}};t.Medialist=class extends s{mediums;constructor(e,t){super(e,t)}getMediums(){return this.mediums||(this.mediums=new a(this)),this.mediums}};t.MediaQuery=class extends s{constructor(e,t){super(e,t)}get type(){return n.MediaQuery}};t.MediaCondition=class extends s{constructor(e,t){super(e,t)}get type(){return n.MediaCondition}};t.MediaFeature=class extends s{constructor(e,t){super(e,t)}get type(){return n.MediaFeature}};t.SupportsCondition=class extends s{lParent;rParent;constructor(e,t){super(e,t)}get type(){return n.SupportsCondition}};t.Page=class extends l{constructor(e,t){super(e,t)}get type(){return n.Page}};t.PageBoxMarginBox=class extends l{constructor(e,t){super(e,t)}get type(){return n.PageBoxMarginBox}};t.Expression=class extends s{constructor(e,t){super(e,t)}get type(){return n.Expression}};t.BinaryExpression=class extends s{left;right;operator;constructor(e,t){super(e,t)}get type(){return n.BinaryExpression}setLeft(e){return this.setNode("left",e)}getLeft(){return this.left}setRight(e){return this.setNode("right",e)}getRight(){return this.right}setOperator(e){return this.setNode("operator",e)}getOperator(){return this.operator}};t.Term=class extends s{operator;expression;constructor(e,t){super(e,t)}get type(){return n.Term}setOperator(e){return this.setNode("operator",e)}getOperator(){return this.operator}setExpression(e){return this.setNode("expression",e)}getExpression(){return this.expression}};t.AttributeSelector=class extends s{namespacePrefix;identifier;operator;value;constructor(e,t){super(e,t)}get type(){return n.AttributeSelector}setNamespacePrefix(e){return this.setNode("namespacePrefix",e)}getNamespacePrefix(){return this.namespacePrefix}setIdentifier(e){return this.setNode("identifier",e)}getIdentifier(){return this.identifier}setOperator(e){return this.setNode("operator",e)}getOperator(){return this.operator}setValue(e){return this.setNode("value",e)}getValue(){return this.value}};t.Operator=class extends s{constructor(e,t){super(e,t)}get type(){return n.Operator}};t.HexColorValue=class extends s{constructor(e,t){super(e,t)}get type(){return n.HexColorValue}};t.RatioValue=class extends s{constructor(e,t){super(e,t)}get type(){return n.RatioValue}};const d=".".charCodeAt(0),h="0".charCodeAt(0),f="9".charCodeAt(0);t.NumericValue=class extends s{constructor(e,t){super(e,t)}get type(){return n.NumericValue}getValue(){const e=this.getText();let t,n=0;for(let r=0,i=e.length;r<i&&(t=e.charCodeAt(r),h<=t&&t<=f||t===d);r++)n+=1;return{value:e.substring(0,n),unit:n<e.length?e.substring(n):void 0}}};t.VariableDeclaration=class extends c{variable=null;value=null;needsSemicolon=!0;constructor(e,t){super(e,t)}get type(){return n.VariableDeclaration}setVariable(e){return!!e&&(e.attachTo(this),this.variable=e,!0)}getVariable(){return this.variable}getName(){return this.variable?this.variable.getName():""}setValue(e){return!!e&&(e.attachTo(this),this.value=e,!0)}getValue(){return this.value}};t.Interpolation=class extends s{constructor(e,t){super(e,t)}get type(){return n.Interpolation}};t.Variable=class extends s{module;constructor(e,t){super(e,t)}get type(){return n.VariableName}getName(){return this.getText()}};t.ExtendsReference=class extends s{selectors;constructor(e,t){super(e,t)}get type(){return n.ExtendsReference}getSelectors(){return this.selectors||(this.selectors=new a(this)),this.selectors}};t.MixinContentReference=class extends s{arguments;constructor(e,t){super(e,t)}get type(){return n.MixinContentReference}getArguments(){return this.arguments||(this.arguments=new a(this)),this.arguments}};t.MixinContentDeclaration=class extends l{parameters;constructor(e,t){super(e,t)}get type(){return n.MixinContentReference}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}};t.MixinReference=class extends s{namespaces;identifier;arguments;content;constructor(e,t){super(e,t)}get type(){return n.MixinReference}getNamespaces(){return this.namespaces||(this.namespaces=new a(this)),this.namespaces}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}getArguments(){return this.arguments||(this.arguments=new a(this)),this.arguments}setContent(e){return this.setNode("content",e)}getContent(){return this.content}};t.MixinDeclaration=class extends l{identifier;parameters;constructor(e,t){super(e,t)}get type(){return n.MixinDeclaration}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}setGuard(e){return e&&e.attachTo(this),!1}};t.UnknownAtRule=class extends l{atRuleName;constructor(e,t){super(e,t)}get type(){return n.UnknownAtRule}setAtRuleName(e){this.atRuleName=e}getAtRuleName(){return this.atRuleName}};t.ListEntry=class extends s{key;value;get type(){return n.ListEntry}setKey(e){return this.setNode("key",e,0)}setValue(e){return this.setNode("value",e,1)}};t.LessGuard=class extends s{isNegated;conditions;getConditions(){return this.conditions||(this.conditions=new a(this)),this.conditions}};t.GuardCondition=class extends s{variable;isEquals;isGreater;isEqualsGreater;isLess;isEqualsLess;setVariable(e){return this.setNode("variable",e)}};var m;t.Module=class extends s{identifier;get type(){return n.Module}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}},function(e){e[e.Ignore=1]="Ignore",e[e.Warning=2]="Warning",e[e.Error=4]="Error"}(m||(t.Level=m={}));t.Marker=class{node;rule;level;message;offset;length;constructor(e,t,n,r,i=e.offset,s=e.length){this.node=e,this.rule=t,this.level=n,this.message=r||t.message,this.offset=i,this.length=s}getRule(){return this.rule}getLevel(){return this.level}getOffset(){return this.offset}getLength(){return this.length}getNode(){return this.node}getMessage(){return this.message}};class g{static entries(e){const t=new g;return e.acceptVisitor(t),t.entries}entries;constructor(){this.entries=[]}visitNode(e){return e.isErroneous()&&e.collectIssues(this.entries),!0}}t.ParseErrorCollector=g},54145:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusTsFile=void 0;const r=n(19408),i=n(1539),s=n(67246),a=n(10604);class o extends s.AventusBaseFile{get tsLanguageService(){return this.build.tsLanguageService}_compileResult=[];get compileResult(){return this._compileResult}diagnostics=[];getDiagnostics(){return[...this.diagnostics]}get version(){return this.file.versionUser}fileParsed=null;get contentForLanguageService(){return this._contentForLanguageService}_contentForLanguageService="";buildNamespace="";constructor(e,t){super(e,t),this.buildNamespace=this.build.getNamespace(e.uri),this.mustBeAddedToLanguageService()&&this.tsLanguageService.addFile(this)}refreshFileParsed(e=!1){this.fileParsed=a.ParserTs.parse(this.file,e,this.build),this._contentForLanguageService=this.file.documentInternal.getText(),e||this.replaceNamespace()}replaceNamespace(){if(this.fileParsed)for(let e of this.fileParsed.namespaces){let t=e.bodyStart-e.start,n="";for(let e=0;e<t;e++)n+=" ";let r=this._contentForLanguageService.substring(0,e.start),i=this._contentForLanguageService.substring(e.bodyStart,this._contentForLanguageService.length);this._contentForLanguageService=r+n+i,t=e.end-e.bodyEnd,n="";for(let e=0;e<t;e++)n+=" ";r=this._contentForLanguageService.substring(0,e.bodyEnd),i=this._contentForLanguageService.substring(e.end,this._contentForLanguageService.length),this._contentForLanguageService=r+n+i}}validateRules(e){const t=this.fileParsed;if(t){if(!e.allow_function)for(let e in t.functions){let n=t.functions[e];this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Function can only be used inside lib.avt file",n.nameStart,n.nameEnd,r.AventusErrorCode.FunctionNotAllowed))}if(!e.allow_variables)for(let e in t.variables){let n=t.variables[e];this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Variables can only be used inside lib.avt file",n.nameStart,n.nameEnd,r.AventusErrorCode.VariableNotAllowed))}if(e.class_extend||e.class_implement||e.interface||e.customClassRules){e.class_extend||(e.class_extend=[]),e.class_implement||(e.class_implement=[]),e.interface||(e.interface=[]),e.customClassRules||(e.customClassRules=[]);for(let n in t.classes){let s=t.classes[n];for(let t of e.customClassRules)t(s);if(s.isInterface){let t=0==e.interface.length;for(let n of s.extends)if(-1!=e.interface.indexOf(n)){t=!0;break}t||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Interface "+s.name+" must extend "+e.interface.join(" or "),s.nameStart,s.nameEnd,r.AventusErrorCode.MissingExtension))}else{let t=0==e.class_extend.length,n=0==e.class_implement.length;for(let t of s.implements)if(-1!=e.class_implement.indexOf(t)){n=!0;break}for(let n of s.extends)if(-1!=e.class_extend.indexOf(n)){t=!0;break}n||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Class "+s.name+" must implement "+e.class_implement.join(" or "),s.nameStart,s.nameEnd,r.AventusErrorCode.MissingImplementation)),t||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Class "+s.name+" must extend "+e.class_extend.join(" or "),s.nameStart,s.nameEnd,r.AventusErrorCode.MissingExtension))}}}e.enum,e.alias}}async onDelete(){this.mustBeAddedToLanguageService()&&this.tsLanguageService.removeFile(this),this.build.npmBuilder.unregister(this.file.uri)}oldFullSrc=[];oldFullDocVisible="";oldFullDocInvisible="";oldFullClassScript="";setCompileResult(e){let t=!1,n="",r=[],i="",s="",a="";for(let t of e)n+=t.compiled,""!=t.classScript&&r.push({name:t.classScript,src:t.compiled}),i+=t.docVisible,s+=t.docInvisible,a+=t.classScript+"#";let o="";for(let e of this.oldFullSrc)o+=e.src;(e.length!=this.compileResult.length||this.oldFullClassScript!=a||o!=n||this.oldFullDocVisible!=i||this.oldFullDocInvisible!=s)&&(t=!0);let l=this.oldFullSrc;t&&(this.oldFullDocInvisible=s,this.oldFullDocVisible=i,this.oldFullSrc=r,this.oldFullClassScript=a),this._compileResult=e,t&&(this.emitToHtttpServer(l),this.build.build())}mustBeAddedToLanguageService(){return!0}emitToHtttpServer(e){this.build.reloadPage=!0}onGetBuild(){return[this.build]}}t.AventusTsFile=o},56941:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusTsFileSelector=function(e,t){let n=null;e.uri.endsWith(r.AventusExtension.ComponentLogic)?n=new i.AventusWebComponentLogicalFile(e,t):e.uri.endsWith(r.AventusExtension.Data)?n=new s.AventusDataFile(e,t):e.uri.endsWith(r.AventusExtension.Lib)?n=new o.AventusLibFile(e,t):e.uri.endsWith(r.AventusExtension.RAM)?n=new l.AventusRamFile(e,t):e.uri.endsWith(r.AventusExtension.State)?n=new c.AventusStateFile(e,t):e.uri.endsWith(r.AventusExtension.Static)?n=new u.AventusStaticFile(e,t):e.uri.endsWith(r.AventusExtension.Definition)&&(n=new a.AventusDefinitionFile(e,t));return n};const r=n(19408),i=n(16286),s=n(36353),a=n(20973),o=n(2054),l=n(7304),c=n(98060),u=n(76578)},37439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusTsLanguageService=void 0,t.simplifyPath=N,t.getSectionStart=R;const r=n(22037),i=n(71017),s=n(94625),a=n(42374),o=n(19408),l=n(1539),c=n(12842),u=n(90946),p=n(65887),_=n(50789),d=n(48117),h=n(76248),f=n(71159),m=n(10604),g=n(57147),y=n(83693),v=n(89403),$=n(92724),b=n(25779),S=n(60206),x=n(2044),w=n(18952),C=n(29495);class E{languageService;languageServiceNamespace;build;filesNeeded=[];filesNpm=[];filesNpmLoaded=!1;filesLoaded={};constructor(e){this.build=e,(0,c.loadTypescriptLib)(),this.onSettingsChanged(e),C.SettingsManager.getInstance().onSettingsChange((()=>{this.onSettingsChanged(e)})),this.languageService=(0,s.createLanguageService)(this.createHost()),this.languageServiceNamespace=(0,s.createLanguageService)(this.createHostNamespace())}onSettingsChanged(e){const t=C.SettingsManager.getInstance().settings.readNodeModules;t!=this.filesNpmLoaded&&(this.filesNpm=t?(0,c.loadNodeModules)((0,i.join)(e.project.getConfigFile().folderPath,"node_modules")):[],this.filesNpmLoaded=t)}createHostNamespace(){const e=this;return{getCompilationSettings:()=>k,getScriptFileNames:()=>[...this.filesNeeded,...this.filesNpm],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>this.filesLoaded[e]?String(this.filesLoaded[e].file.versionUser+1):"1",getScriptSnapshot:e=>{let t="";if(t=this.filesLoaded[e]?this.filesLoaded[e].file.contentInternal:(0,c.loadLibrary)(e),void 0!==t)return{getText:(e,n)=>t?.substring(e,n)||"",getLength:()=>t?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"es2022.full",readFile:(e,t)=>this.filesLoaded[e]?this.filesLoaded[e].file.contentInternal:(0,c.loadLibrary)(e),fileExists:e=>(e.endsWith(o.AventusExtension.Base+".ts")&&(e=e.replace(o.AventusExtension.Base+".ts",o.AventusExtension.Base)),!!this.filesLoaded[e]||!!(0,c.loadLibrary)(e)),directoryExists:e=>(0,g.existsSync)((0,l.uriToPath)(e)),resolveModuleNames(t,n,r,i,s,a){return e.resolveModuleNames(this,t,n,r,i,s,a)}}}createHost(){const e=this;return{getCompilationSettings:()=>k,getScriptFileNames:()=>[...this.filesNeeded,...this.filesNpm],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>this.filesLoaded[e]?String(this.filesLoaded[e].version+1):"1",getScriptSnapshot:e=>{let t="";if(t=this.filesLoaded[e]?this.filesLoaded[e].contentForLanguageService:(0,c.loadLibrary)(e),void 0!==t)return{getText:(e,n)=>t?.substring(e,n)||"",getLength:()=>t?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"es2022.full",readFile:(e,t)=>{let n;return n=this.filesLoaded[e]?this.filesLoaded[e].contentForLanguageService:(0,c.loadLibrary)(e),n},fileExists:e=>{let t=!1;return e.endsWith(o.AventusExtension.Base+".ts")&&(e=e.replace(o.AventusExtension.Base+".ts",o.AventusExtension.Base)),t=!!this.filesLoaded[e]||!!(0,c.loadLibrary)(e),t},directoryExists:e=>(0,g.existsSync)((0,l.uriToPath)(e)),resolveModuleNames(t,n,r,i,s,a){return e.resolveModuleNames(this,t,n,r,i,s,a)}}}resolveModuleNames(e,t,n,r,i,a,l){const c=[];for(let r of t){if(!r.startsWith(".")&&r.endsWith(o.AventusExtension.Package)){let e={extension:s.Extension.Ts,resolvedFileName:"file:///"+r};c.push(e);continue}let t=y.FilesManager.getInstance().getByUri(n);t&&(r=this.build.project.resolveAlias(r,t));let i=(0,s.resolveModuleName)(r,n,k,e);if(i.resolvedModule)i.resolvedModule.resolvedFileName.endsWith(".avt.ts")&&(i.resolvedModule.resolvedFileName=i.resolvedModule.resolvedFileName.replace(".avt.ts",".avt")),c.push(i.resolvedModule);else{let e={extension:s.Extension.Ts,resolvedFileName:r};c.push(e)}}return c}addFile(e){-1==this.filesNeeded.indexOf(e.file.uri)&&(this.filesNeeded.push(e.file.uri),this.filesLoaded[e.file.uri]=e)}removeFile(e){let t=this.filesNeeded.indexOf(e.file.uri);-1!=t&&(this.filesNeeded.splice(t,1),delete this.filesLoaded[e.file.uri])}doValidation(e){try{const t=[1206,1249,2612];let n=[];const r=this.languageService.getSyntacticDiagnostics(e.uri),i=this.languageService.getSemanticDiagnostics(e.uri),c=r.concat(i);for(let r of c){if(t.includes(r.code))continue;let i=`${(0,s.flattenDiagnosticMessageText)(r.messageText,"\n")}`;r.reportsUnnecessary?n.push({range:(0,l.convertRange)(e.documentInternal,r),severity:a.DiagnosticSeverity.Hint,source:o.AventusLanguageId.TypeScript,message:i,tags:[a.DiagnosticTag.Unnecessary]}):n.push({range:(0,l.convertRange)(e.documentInternal,r),severity:a.DiagnosticSeverity.Error,source:o.AventusLanguageId.TypeScript,message:i})}return n}catch(e){this.printCatchError(e)}return[]}async doComplete(e,t){try{let n,r=e.documentInternal,i=r.offsetAt(t),s=(0,l.convertRange)(r,(0,l.getWordAtText)(r.getText(),i));try{n=this.languageService.getCompletionsAtPosition(r.uri,i,T)}catch(e){this.printCatchError(e)}if(!n)return{isIncomplete:!1,items:[]};let c=[];for(let e=0;e<n.entries.length;e++){let t,l=n.entries[e],u=l.insertText?l.insertText:l.name;if(u=u.replace(/\.\?\./g,"?."),u.startsWith("?")){let e=r.offsetAt(s.start)-1;"."==r.getText()[e]&&(t=[{newText:"",range:{start:{line:s.start.line,character:s.start.character-1},end:{line:s.start.line,character:s.start.character}}}])}let p={languageId:o.AventusLanguageId.TypeScript,offset:i,uri:r.uri},_={label:l.name,sortText:l.sortText,kind:F(l.kind),textEdit:a.TextEdit.replace(s,u),additionalTextEdits:t,data:{...l.data,...p}};c.push(_)}return{isIncomplete:!1,items:c}}catch(e){this.printCatchError(e)}return{isIncomplete:!1,items:[]}}async doResolve(e){try{if(e.data){let t=this.build.tsFiles[e.data.uri];if(null!=t){let n={languageId:e.data.languageIdJs,offset:e.data.offset,uri:e.data.uri};delete e.data.languageId,delete e.data.offset,delete e.data.uri,0==Object.keys(e.data).length&&(e.data=void 0);let r=this.languageService.getCompletionEntryDetails(n.uri,n.offset,e.label,{},t.file.contentInternal,T,e.data);if(r){if(e.detail=(0,s.displayPartsToString)(r.displayParts),e.documentation=(0,s.displayPartsToString)(r.documentation),e.additionalTextEdits=[],r.codeActions)for(let n=0;n<r.codeActions.length;n++)for(let i of r.codeActions[n].changes)for(let n of i.textChanges){n.newText=(0,l.normalizePath)(n.newText.replace(/'/g,'"'));let r=/"(.*)"/g.exec(n.newText);if(r&&r.length>1)if(r[0].includes(o.AventusExtension.Package)){let e=r[1];e=this.filesNeeded.find((t=>t.toLowerCase()==e))??e,e=e.replace("file:///",""),n.newText=n.newText.replace(r[1],e)}else if(r[1].startsWith(".")){let i=N(r[1],t.file.uri);e.detail+="\r\nimport from "+i,n.newText=n.newText.replace(r[1],i)}e.additionalTextEdits.push({newText:n.newText,range:(0,l.convertRange)(t.file.documentInternal,n.span)})}delete e.data}}}}catch(e){this.printCatchError(e)}return e}async doHover(e,t){try{let n=this.languageService.getQuickInfoAtPosition(e.uri,e.documentInternal.offsetAt(t));if(n){let t=[],r=[];if(n.documentation)for(let e of n.documentation)t.push(`${e.text.trim()}`),r.push(e.text.trim());if(n.tags){r.push(" ");for(let e of n.tags){if("inheritdoc"===e.name)continue;let n=!0;const i=[];if(e.text)for(let t of e.text){if("text"==t.kind&&t.text==r.join("")){n=!1;break}i.push(t.text)}if(!n)continue;let s=i.join("").trim();"example"===e.name?t.push(`\`@${e.name}\`\n\`\`\`typescript\n${s}\n\`\`\``):t.push(`\`@${e.name}\` ${s}`)}}let i="";return n.displayParts&&(i+="\n```typescript\n",i+=(0,s.displayPartsToString)(n.displayParts).trim(),i+="\n```\n***\n"),i+=t.join("\n\n"),{range:(0,l.convertRange)(e.documentInternal,n.textSpan),contents:{kind:"markdown",value:i}}}}catch(e){this.printCatchError(e)}return null}getType(e,t){try{let n=this.languageService.getProgram();if(!n)return;let r=n.getSourceFile(e.file.uri);if(!r)return;let i=n.getTypeChecker(),a=(0,s.getTokenAtPosition)(r,t),o=i.getTypeAtLocation(a),l=i.typeToString(o,a,s.TypeFormatFlags.UseFullyQualifiedType);if(l.includes("."))return l;if(e.fileParsed)for(let t in e.fileParsed.importsLocal){if(t==l)return l;let n=e.fileParsed.importsLocal[t];if(void 0===n.realName){let e=(0,s.getTokenAtPosition)(r,(n.nameEnd+n.nameStart)/2),t=i.getTypeAtLocation(e);n.realName=i.typeToString(t)}if(l==n.realName)return t}return l}catch(e){this.printCatchError(e)}}async findDefinition(e,t){try{let n=this.languageService.getDefinitionAtPosition(e.uri,e.documentInternal.offsetAt(t));if(n&&n.length>0){let e=n[0];e.fileName.endsWith(".avt.ts")&&(e.fileName=e.fileName.replace(".avt.ts",".avt"));let t=this.filesLoaded[e.fileName];if(t instanceof x.AventusPackageNamespaceFileTs)return t.goToDefinition((0,l.convertRange)(t.file.documentInternal,e.textSpan));if(t)return{uri:t.file.uri,range:(0,l.convertRange)(t.file.documentInternal,e.textSpan)};{let t=(0,c.loadLibrary)(e.fileName);if(t){const n=w.TextDocument.create(e.fileName,"typescript",1,t);return{uri:e.fileName,range:(0,l.convertRange)(n,e.textSpan)}}}}}catch(e){this.printCatchError(e)}return null}async format(e,t,n,r=!0){try{let o=e.documentInternal,c=o.offsetAt(t.start),u=o.offsetAt(t.end),p=null;t.end.line>t.start.line&&(0===t.end.character||(i=o.getText().substr(u-t.end.character,t.end.character),/^\s*$/.test(i)))&&(u-=t.end.character,p=a.Range.create(a.Position.create(t.end.line,0),t.end));let _={...I};_.semicolons=r?s.SemicolonPreference.Insert:s.SemicolonPreference.Remove;let d=this.languageServiceNamespace.getFormattingEditsForRange(o.uri,c,u,_);if(d){let e=[];for(let t of d)t.span.start>=c&&t.span.start+t.span.length<=u&&e.push({range:(0,l.convertRange)(o,t.span),newText:t.newText});return p&&e.push({range:p,newText:M(0,n)}),e}}catch(e){this.printCatchError(e)}var i;return[]}async doCodeAction(e,t){let n=[];try{let r=m.ParserTs.parse(e,!1,this.build),i=e.documentInternal;const s=this.languageService.getSyntacticDiagnostics(i.uri),a=this.languageService.getSemanticDiagnostics(i.uri);let o=[];for(let e of s)o.push(e.code);for(let e of a)6133!=e.code&&o.push(e.code);let c=[];try{c=this.languageService.getCodeFixesAtPosition(i.uri,i.offsetAt(t.start),i.offsetAt(t.end),o,I,T)}catch(e){}for(let t of c){let s=[],a={changes:{[i.uri]:s}};for(let n of t.changes)for(let a of n.textChanges){if(t.description.startsWith("Add import from")){a.newText=a.newText.replace(/'/g,'"');let e=/"(.*)"/g.exec(a.newText);if(e&&e.length>1){let n=N(e[1],i.uri);t.description="Add import from "+n,a.newText=a.newText.replace(e[1],n)}}else if("fixClassDoesntImplementInheritedAbstractMember"===t.fixName){let t=!1;for(let e in r.classes){let n=r.classes[e];a.span.start>=n.start&&a.span.start<=n.end&&(t=!0)}if(t){let t=R(e,"methods");-1!=t&&(a.span.start=t),a.newText.match(/ (public|protected) /g)||(a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1public $2")),a.newText.match(/(public|protected)[ ]*?override/g)||(a.newText=a.newText.replace(/((public|protected)[ ]*?)([a-z])/g,"$1override $3")),a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1/**$1 * @inheritdoc$1 */$1$2")}else if(a.newText.startsWith("import ")){a.newText=a.newText.replace(/'/g,'"');let e=/"(.*)"/g.exec(a.newText);if(e&&e.length>1){let t=N(e[1],i.uri);a.newText=a.newText.replace(e[1],t)}}}else if("fixClassIncorrectlyImplementsInterface"==t.fixName){let t=!1;for(let e in r.classes){let n=r.classes[e];a.span.start>=n.start&&a.span.start<=n.end&&(t=!0)}if(t){let t=R(e,"methods");-1!=t&&(a.span.start=t),a.newText.includes(" protected ")||a.newText.includes(" public ")||(a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1public $2")),a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1/**$1 * @inheritdoc$1 */$1$2")}else if(a.newText.startsWith("import ")){a.newText=a.newText.replace(/'/g,'"');let e=/"(.*)"/g.exec(a.newText);if(e&&e.length>1){let t=N(e[1],i.uri);a.newText=a.newText.replace(e[1],t)}}}s.push({newText:a.newText,range:(0,l.convertRange)(i,a.span)})}n.push({title:t.description,edit:a})}}catch(e){this.printCatchError(e)}return n}async onReferences(e,t){let n=[];try{let r=e.documentInternal.offsetAt(t),i=this.languageService.findReferences(e.uri,r);if(i)for(let e of i)for(let t of e.references)if(this.filesLoaded[t.fileName]){let e=this.filesLoaded[t.fileName].file.documentInternal.positionAt(t.textSpan.start),r=this.filesLoaded[t.fileName].file.documentInternal.positionAt(t.textSpan.start+t.textSpan.length);n.push(a.Location.create(t.fileName,{start:e,end:r}))}}catch(e){this.printCatchError(e)}return n}async onCodeLens(e){let t=[];try{let n=this.filesLoaded[e.uri];if(n&&n.fileParsed){let r=async n=>{for(let r of n){let n=e.documentInternal.positionAt(r.start),i=await this.onReferences(e,n),s=i.length>1?i.length+" references":i.length+" reference";t.push({range:{start:n,end:n},command:{title:s,command:i.length?"editor.action.showReferences":"",arguments:[e.uri,n,i]}})}};await r(Object.values(n.fileParsed.classes)),await r(Object.values(n.fileParsed.enums)),await r(Object.values(n.fileParsed.aliases))}let r=R(e,"props");if(-1!=r){let n=e.documentInternal.positionAt(r);t.push({range:{start:n,end:n},command:{title:"Add property | attribute",command:"editor.action.showReferences",arguments:[e.uri]}})}}catch(e){this.printCatchError(e)}return t}async onRename(e,t,n){this.languageService.getFileReferences(e.uri);let r=e.documentInternal.offsetAt(t),i={};if(!this.languageService.getRenameInfo(e.uri,r,i).canRename)return null;let s=this.languageService.findRenameLocations(e.uri,r,!1,!1,i);if(!s)return null;let a={changes:{}};if(a.changes)for(let e of s){if(this.filesLoaded[e.fileName]){a.changes[e.fileName]||(a.changes[e.fileName]=[]);let t={newText:n,range:{start:this.filesLoaded[e.fileName].file.documentInternal.positionAt(e.textSpan.start),end:this.filesLoaded[e.fileName].file.documentInternal.positionAt(e.textSpan.start+e.textSpan.length)}};a.changes[e.fileName].push(t)}}return a}async onRenameFile(e,t){let n={},r=this.languageService.getFileReferences(e);for(let e of r){let r=y.FilesManager.getInstance().getByUri(e.fileName);if(r){let i=[],s=r.folderUri.split("/"),a=t.split("/");for(;s.length>0&&a.length>0&&s[0]==a[0];)s.splice(0,1),a.splice(0,1);let o=[];if(s.length>0)for(let e=0;e<s.length;e++)o.push("..");else o.push(".");for(let e of a)o.push(e);i.push({newText:o.join("/"),range:{start:r.documentInternal.positionAt(e.textSpan.start),end:r.documentInternal.positionAt(e.textSpan.start+e.textSpan.length)}}),n[r.uri]=i}}return n}static removeComments(e){return e=e.replace(/(\".*?\"|\'.*?\')|(\/\*.*?\*\/|\/\/[^(\r\n|\n)]*$)/gm,((e,t,n)=>n?"":t))}static replaceFirstExport(e){return e.replace(/^\s*export\s+(class|interface|enum|type|abstract|function)/m,"$1")}static prepareDataSchema(e,t,n){let r={};const i=r=>{if("boolean"==r.kind)return"boolean";if("number"==r.kind)return"number";if("string"==r.kind)return"string";if("type"==r.kind){if(r.value.includes("."))return r.value;{let i=e.parserInfo.importsLocal[r.value]?.info;if(i){return n?i.name:t+"."+i.fullName}return r.value}}return"literal"==r.kind||"typeLiteral"==r.kind?"literal":null};for(let s in e.properties){let a=e.properties[s];if(a.isStatic)continue;let o=!1;for(let i of a.decorators){let a=f.ForeignKeyDecorator.is(i);if(a){o=!0;let i=e.parserInfo.importsLocal[a.refType]?.info;if(a.refType.includes("."))r[s]="ref:"+a.refType;else if(i){let e=n?i.name:t+"."+i.fullName;r[s]="ref:"+e}else r[s]="ref:"+a.refType}}if(!o){let e=i(a.type);e&&(r[s]=e)}}let s=JSON.stringify(r).replace(/\\"/g,'"');if(e.parentClass){s=`{...(${n?e.extendsNpm[0]:e.parentClass.fullName}?.$schema ?? {}), ${s.slice(1)}`}return s}static addBindThis(e,t){let n=[];for(let t in e.methods)for(let r of e.methods[t].decorators)$.BindThisDecorator.is(r)&&n.push(`this.${t}=this.${t}.bind(this)`);if(n.length>0){let i=e.constructorContent;if(i.length>0){let e=i;e=e.slice(0,e.length-1),e+=r.EOL+n.join(r.EOL),e+=" }",t=t.replace(i,e)}else{let i=Object.values(e.methods)[0].fullStart,s=t.slice(0,i)+r.EOL;s+="constructor() { super(); "+r.EOL+n.join(r.EOL)+" }",s+=t.slice(i),t=s}}return t}static compileTs(e,t){let n={compiled:"",hotReload:"",docVisible:"",docInvisible:"",dependances:e.dependances,classScript:"",classDoc:"",debugTxt:"",uri:t.file.uri,required:!1,type:e.infoType,isExported:{external:e.isExported,internal:e.isInternalExported},convertibleName:"",npm:{defTs:"",namespace:"",exportPath:"",uri:t.file.uri,src:""},story:{}};try{let i="",a="",o=e.compiledContent,l=e.compiledContentHotReload,c=t.build.module;if(e instanceof p.ClassInfo&&!e.isInterface){let t="";e.namespace&&(t="."+e.namespace),i+=e.fullName+".Namespace=`"+c+t+"`;"+r.EOL,a+=e.name+".Namespace=`"+c+t+"`;"+r.EOL,e.implements.includes("Aventus.IData")&&(n.type=u.InfoType.classData),e.convertibleName?(i+=e.fullName+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,a+=e.name+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,i+="Aventus.Converter.register("+e.fullName+"."+e.convertibleName+", "+e.fullName+");"+r.EOL,a+="Aventus.Converter.register("+e.fullName+"."+e.convertibleName+", "+e.fullName+");"+r.EOL):e.implements.includes("Aventus.IData")&&(i+=e.fullName+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,a+=e.name+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,i+="Aventus.Converter.register("+e.fullName+".Fullname, "+e.fullName+");"+r.EOL,a+="Aventus.Converter.register("+e.fullName+".Fullname, "+e.fullName+");"+r.EOL),n.convertibleName=e.convertibleName,o=this.addBindThis(e,o)}else e instanceof v.VariableInfo&&(o=e.type+" "+e.compiledContent,l=e.type+" "+e.compiledContentHotReload);o=this.removeComments(o),o=this.replaceFirstExport(o);const f=(0,s.transpile)(o,A);n.compiled=f+i,S.HttpServer.isRunning&&(l=this.removeComments(l),l=this.replaceFirstExport(l),n.hotReload=(0,s.transpile)(l,A));let m=this.compileDocTs(o),g=h.DefinitionCorrector.correct(m,e),y=this.compileTsToNpm(e,t);if(y&&(n.npm=y),g.length>0){let t=e.namespace;t.length>0&&(m="namespace "+t+" {\r\n"+m+"}\r\n",g="namespace "+t+" {\r\n"+g+"}\r\n"),e.isExported?n.docVisible=g:n.docInvisible=g}const $=()=>{let i="",s=t.build.namespaces.includes(e.fullName);s&&(i+="_n = "+e.fullName+";"+r.EOL);let a=n.compiled;if(e instanceof v.VariableInfo)a=a.slice(a.indexOf("=")+1),a=e.fullName.includes(".")?e.fullName+"="+a:"let "+e.fullName+"="+a;else if(e instanceof b.EnumInfo){let t=`})(${e.name} || (${e.name} = {}))`,n=`})(${e.fullName} || (${e.fullName} = {}))`;if(a=a.replaceAll(t,n),e.fullName.includes(".")){let e=a.split("\n");e.splice(0,1),a=e.join("\n")}}else a=e.fullName+"="+n.compiled,e.fullName.includes(".")||(a=`let ${a}`);return e.isExported&&(a+="_."+e.fullName+"="+e.fullName+";",a+=r.EOL),i+=a,s&&(i+=r.EOL+"Object.assign("+e.fullName+", _n);"+r.EOL),i};let x=n.compiled;n.compiled.length>0&&(n.classScript=e.fullName,n.compiled=$()),(n.docVisible.length>0||n.docInvisible.length>0)&&(n.classDoc=e.fullName);for(let t of e.decorators){let e=_.DebuggerDecorator.is(t);e&&e.writeCompiled&&(n.debugTxt=x),d.RequiredDecorator.is(t)&&(n.required=!0)}}catch(e){this.printCatchError(e)}return n}static compileTsToNpm(e,t){try{if(!t.build.hasNpmOutput)return null;const n={defTs:"",namespace:"",exportPath:"",uri:t.file.uri,src:""};let i="",a=e.compiledContentNpm,l=t.build.module;if(e instanceof p.ClassInfo&&!e.isInterface){let n="";if(e.namespace&&(n="."+e.namespace),i+=e.name+".Namespace=`"+l+n+"`;"+r.EOL,e.convertibleName){i+=e.name+".$schema="+this.prepareDataSchema(e,l,!0)+";"+r.EOL;const n=t.build.getNpmReplacementName("","Aventus.Converter");i+=n+".register("+e.name+"."+e.convertibleName+", "+e.name+");"+r.EOL,t.fileParsed&&t.fileParsed.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"Converter",compiled:!0,alias:n,forced:!1})}else if(e.implements.includes("Aventus.IData")){i+=e.name+".$schema="+this.prepareDataSchema(e,l,!0)+";"+r.EOL;const n=t.build.getNpmReplacementName("","Aventus.Converter");i+=n+".register("+e.name+".Fullname, "+e.name+");"+r.EOL,t.fileParsed&&t.fileParsed.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"Converter",compiled:!0,alias:n,forced:!1})}a=this.addBindThis(e,a)}else e instanceof v.VariableInfo&&(a=e.type+" "+e.compiledContentNpm);a=this.removeComments(a),a=this.replaceFirstExport(a);const c=(0,s.transpile)(a,A),u=this.compileDocTs(a);n.namespace=t.build.module,e.namespace.length>0&&(n.namespace+="."+e.namespace),n.defTs=u,n.src=c+i;let _=t.file.path.replace(t.build.project.getConfigFile().path.replace(o.AventusExtension.Config,""),"");return _=_.replace(o.AventusExtension.Base,".js"),n.exportPath=_,n}catch(e){this.printCatchError(e)}return null}static compileDocTs(e){try{const t={getCompilationSettings:()=>({allowJs:!0,declaration:!0}),getScriptFileNames:()=>["temp.js"],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>"1",getScriptSnapshot:t=>{let n=e;return{getText:(e,t)=>n?.substring(e,t)||"",getLength:()=>n?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"",readFile:(t,n)=>e,fileExists:e=>!0,directoryExists:e=>!e.startsWith("node_modules")};return(0,s.createLanguageService)(t).getEmitOutput("temp.js",!0,!0).outputFiles[0].text.replace(/^declare /g,"")}catch(e){this.printCatchError(e)}return""}static removeUnusedImport(e,t){try{let n=w.TextDocument.create("temp.js","js",1,e);const r={getCompilationSettings:()=>({noUnusedLocals:!0,allowNonTsExtensions:!0,allowJs:!0}),getScriptFileNames:()=>["temp.js"],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>"1",getScriptSnapshot:t=>{let n=e;return{getText:(e,t)=>n?.substring(e,t)||"",getLength:()=>n?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"",readFile:(t,n)=>"temp.js"==t?e:"",fileExists:e=>!1,directoryExists:e=>!1};const i=(0,s.createLanguageService)(r).getSemanticDiagnostics("temp.js"),a=[];for(let r of i)if(r.reportsUnnecessary&&null!=r.start){const i=n.positionAt(r.start),s={line:i.line,character:0},o={line:i.line,character:6};if("import"==e.slice(n.offsetAt(s),n.offsetAt(o))){const e=/'(\S*)'/.exec(r.messageText+"");if(e&&e[1]&&t.includes(e[1]))continue;a.push({start:r.start,length:r.length})}}a.sort(((e,t)=>t.start-e.start));for(let t of a)e=e.slice(0,t.start)+e.slice(t.start+t.length);return e=e.replace(/import\s*\{[^}]*\}\s*from\s*['"][^'"]*['"];\s*/g,(e=>{let t=e.replace(/(,|{)(?:\s*(\S+)\s+as\s+)(?=,|})/g,"$1");return t=t.replace(/(,\s*)+/g,", ").replace(/,\s*}/g," }").replace(/{\s*,/g,"{ "),t.match(/\{\s*\}/)?"":t}))}catch(e){this.printCatchError(e)}return""}static getCompilerOptionsCompile(){return A}printCatchError(e){E.printCatchError(e)}static printCatchError(e){/^Debug Failure\. Expected \d+ <= \d+$/g.test(e.message)||console.error(e)}}t.AventusTsLanguageService=E;const k={allowNonTsExtensions:!0,jsx:s.JsxEmit.None,importHelpers:!1,allowJs:!0,checkJs:!1,lib:["lib.es2022.full.d.ts"],target:s.ScriptTarget.ES2022,moduleDetection:s.ModuleDetectionKind.Force,moduleResolution:s.ModuleResolutionKind.NodeNext,experimentalDecorators:!0,noImplicitOverride:!0,strictPropertyInitialization:!0,noImplicitReturns:!0,noUnusedLocals:!0,strictNullChecks:!0,verbatimModuleSyntax:!0},A={allowNonTsExtensions:!0,jsx:s.JsxEmit.None,importHelpers:!1,allowJs:!0,checkJs:!1,lib:["lib.es2022.full.d.ts"],target:s.ScriptTarget.ES2022,moduleDetection:s.ModuleDetectionKind.Auto,moduleResolution:s.ModuleResolutionKind.NodeNext,experimentalDecorators:!0,noImplicitOverride:!0,strictPropertyInitialization:!0,noImplicitReturns:!0,strictNullChecks:!0,verbatimModuleSyntax:!0},T={includeExternalModuleExports:!0,includeInsertTextCompletions:!0,includeCompletionsWithClassMemberSnippets:!0,includeAutomaticOptionalChainCompletions:!0,includeCompletionsForImportStatements:!0,includeCompletionsForModuleExports:!0,includeCompletionsWithInsertText:!0,includeInlayEnumMemberValueHints:!0,includeInlayFunctionLikeReturnTypeHints:!0,includeInlayFunctionParameterTypeHints:!0,includeInlayParameterNameHints:"all",includeInlayParameterNameHintsWhenArgumentMatchesName:!0,includeInlayPropertyDeclarationTypeHints:!0,useLabelDetailsInCompletionEntries:!0,importModuleSpecifierEnding:"index",importModuleSpecifierPreference:"relative"},I={convertTabsToSpaces:!0,tabSize:4,indentSize:4,indentStyle:s.IndentStyle.Smart,newLineCharacter:"\n",baseIndentSize:0,insertSpaceAfterCommaDelimiter:!0,insertSpaceAfterConstructor:!1,insertSpaceAfterSemicolonInForStatements:!0,insertSpaceBeforeAndAfterBinaryOperators:!0,insertSpaceAfterKeywordsInControlFlowStatements:!1,insertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,insertSpaceBeforeFunctionParenthesis:!1,insertSpaceAfterTypeAssertion:!0,placeOpenBraceOnNewLineForControlBlocks:!1,placeOpenBraceOnNewLineForFunctions:!1,semicolons:s.SemicolonPreference.Insert,insertSpaceBeforeTypeAnnotation:!1};function F(e){switch(e){case"primitive type":case"keyword":return a.CompletionItemKind.Keyword;case"const":case"let":case"var":case"local var":case"alias":case"parameter":return a.CompletionItemKind.Variable;case"property":case"getter":case"setter":return a.CompletionItemKind.Field;case"function":case"local function":return a.CompletionItemKind.Function;case"method":case"construct":case"call":case"index":return a.CompletionItemKind.Method;case"enum":return a.CompletionItemKind.Enum;case"enum member":return a.CompletionItemKind.EnumMember;case"module":case"external module name":return a.CompletionItemKind.Module;case"class":case"type":return a.CompletionItemKind.Class;case"interface":return a.CompletionItemKind.Interface;case"warning":return a.CompletionItemKind.Text;case"script":return a.CompletionItemKind.File;case"directory":return a.CompletionItemKind.Folder;case"string":return a.CompletionItemKind.Constant;default:return a.CompletionItemKind.Property}}function N(e,t){if((e=decodeURIComponent(e)).startsWith("custom://"))return e;let n=[];n="/"===i.sep?decodeURIComponent(t).replace("file://","").split("/"):decodeURIComponent(t).replace("file:///","").split("/"),n.pop();let r=(0,i.normalize)(n.join("/")).split(i.sep),s=(0,i.normalize)(n.join("/")+"/"+e).split(i.sep);for(let e=0;e<r.length;e++)if(s.length>e){if(r[e]!=s[e])break;r.splice(e,1),s.splice(e,1),e--}let a="";for(let e=0;e<r.length;e++)a+="../";return""==a&&(a+="./"),a+=s.join("/"),a}function M(e,t){return t.insertSpaces?D(" ",e*t.tabSize):D("\t",e)}function D(e,t){let n="";for(;t>0;)1==(1&t)&&(n+=e),e+=e,t>>>=1;return n}function R(e,t){let n=new RegExp("//#region "+t+"(\\s|\\S)*?//#endregion").exec(e.documentInternal.getText());return n?n.index+10+t.length:-1}},6045:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genericTsCompile=function(e){let t="",n=[],s=r=>{for(let s of r){let r=i.AventusTsLanguageService.compileTs(s,e);e.build.addNamespace(s.namespace),n.push(r),t+=r.debugTxt}};e.fileParsed&&(s(Object.values(e.fileParsed.classes)),s(Object.values(e.fileParsed.enums)),s(Object.values(e.fileParsed.aliases)),s(Object.values(e.fileParsed.functions)),s(Object.values(e.fileParsed.variables)));let a=e.file.path.replace(".avt",".js");""!=t?(0,r.writeFileSync)(a,t):(0,r.existsSync)(a)&&(0,r.unlinkSync)(a);return n};const r=n(57147),i=n(37439)},16286:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebComponentLogicalFile=void 0;const r=n(57147),i=n(22037),s=n(18952),a=n(19408),o=n(72375),l=n(60206),c=n(54145),u=n(43559),p=n(1539),_=n(87957),d=n(61586),h=n(71017);class f extends c.AventusTsFile{_compilationResult;canUpdateComponent=!0;viewMethodsInfo=[];storyBookInfo={argsTypes:{},args:{}};get compilationResult(){return this._compilationResult}get extension(){return a.AventusExtension.ComponentLogic}get version(){return this.file.documentInternal.version}get HTMLFile(){return this.file.uri.endsWith(a.AventusExtension.Component)?this.build.wcFiles[this.file.uri].view:this.build.htmlFiles[this.file.uri.replace(a.AventusExtension.ComponentLogic,a.AventusExtension.ComponentView)]}_fullname="";get fullName(){return this._fullname}get viewMethodName(){return"__"+d(this.fullName)+"method"}_componentEnd=0;get componentEnd(){return this._componentEnd}_componentClassName="";get componentClassName(){return this._componentClassName}_space="";writeHtml=!1;writeTs=!1;htmlDiagnostics=[];constructor(e,t){super(e,t),e.linkInternalAndUser=!1,this.quickParse(),this.refreshFileParsed()}waitingFct={};mergedVersion="-1_-1_-1";isCompiling=!1;runWebCompiler(){return new Promise((e=>{let t=u.AventusWebcomponentCompiler.getVersion(this,this.build),n=t.ts+"_"+t.scss+"_"+t.html,r=this.build.insideRebuildAll;if(n!=this.mergedVersion||r)if(this.isCompiling)this.waitingFct[n]||(this.waitingFct[n]=[]),this.waitingFct[n].push((()=>{e()}));else{this.isCompiling=!0,this.recreateFileContent();let t=new u.AventusWebcomponentCompiler(this,this.build);if(this._compilationResult=t.compile(),this.build.scssLanguageService.addInternalDefinition(this.file.uri,this._compilationResult.scssDoc),this.build.htmlLanguageService.addInternalDefinition(this.file.uri,this._compilationResult.htmlDoc,this),this.isCompiling=!1,this.mergedVersion=n,this.storyBookInfo.argsTypes=t.storyArgTypes,this.storyBookInfo.args=t.storyArgs,this.waitingFct[n])for(let e of this.waitingFct[n])e();e()}else e()}))}lastFileVersionCreated={html:-1,js:-1};typeInfered={};recreateFileContent(){let e=this.HTMLFile,t=e?.file.versionUser??0,n=this.file.documentUser.version+t+1;if(e){let i=!1,a=!1;if(this.lastFileVersionCreated.js!=this.file.documentUser.version?(i=!0,a=!0):this.lastFileVersionCreated.html!=t&&(i=!0),i){this.lastFileVersionCreated={html:t,js:this.file.documentUser.version};let i="";if(this.componentEnd>=0){let t=this.file.documentUser.getText(),r=1;for(;["}"," ","\t"].includes(t[this.componentEnd-r]);)r++;i=t.slice(0,this.componentEnd-r),this.viewMethodsInfo=[];let l=0;const c=e=>{let t=[];for(let n of e){let e=this.typeInfered[n]??"any";t.push(n+":"+e)}return t};if(a){const t=()=>{if(!e)return;let t=e.fileParsed?.loops??[],r=0;for(let e of t){let t=c(e.variables),a=i;a+=`/** */\n@NoCompile()\nprivate ${e.loopName}(${t.join(",")}): void {\n`;let l=a.length;a+=e.loopTxt+"\n",a+="}\n",a+="}",this.file instanceof o.InternalAventusFile&&(this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,-1*(n+r),a)),this._contentForLanguageService=a);for(let t of e.typeToLoad){let n=l+(Math.floor((t.start+t.end)/2)-e.start),r=e.loopTxt.slice(t.start-e.start,t.end-e.start),i=this.tsLanguageService.getType(this,n)??"any";this.typeInfered[r]=i}r++}let a=e.fileParsed?.contextEdits??[];for(let e of a){let t=c(e.variables),a=i;a+=`/** */\n@NoCompile()\nprivate ${e.editName}(${t.join(",")}): void {\n`;let l=a.length;a+=e.fctTs+"\n",a+="}\n",a+="}",this.file instanceof o.InternalAventusFile&&(this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,-1*(n+r),a)),this._contentForLanguageService=a);for(let t of e.typeToLoad){let n=l+(Math.floor((t.start+t.end)/2)-e.start),r=this.tsLanguageService.getType(this,n)??"any";this.typeInfered[t.txt]=r}}};t()}let u=e.fileParsed?.loops??[];for(let e of u){let t=i.length,n=c(e.variables),r=this._space;i+=`\n${r}/** */\n${r}@NoCompile()\n${r}private ${e.loopName}(${n.join(",")}): void {\n`;let s=i.length;i+=e.loopTxt+"\n";let a=i.length;i+=r+"}";const o=function(){return{name:e.loopName,fullStart:t,start:s,end:a,offsetBefore:0,offsetAfter:0,kind:"loop",fct:{txt:e.loopTxt,positions:[{start:e.start,end:e.startBlock}]},transform:(e,t)=>t}};this.viewMethodsInfo.push(o()),e.isSimple||(i+=`\n${r}/** */\n${r}private ${e.complex.loopName}(${n.join(",")}) {\n\n ${e.complex.init.join(";\n")}\n return {\n transform:() => {\n ${e.complex.transform.join(";\n")}\n },\n condition: () => {\n return (${e.complex.condition})\n },\n apply: () => {\n return ({${e.complex.apply}})\n }\n }\n }`)}let p=e.fileParsed?.fcts??{};for(let e of Object.values(p)){let t=e.txt.replace(/\n/g,";"),n=-1,r=t.split(";");if(!t.includes("return ")&&r.length>0){let e=r.pop();n=r.join("\n").length,e?.startsWith(" ")?(r.push("return"+e),l=6):(r.push("return "+e),l=7)}t=r.join("\n");let s=i.length,a=c(e.variables),o="NotVoid",u=this._space;i+=`\n${u}/** */\n${u}private ${e.name}(${a.join(",")}): ${o} {\n`;let p=i.length;i+=t+"\n";let _=i.length;i+=u+"}";const d=function(t,n){let r={name:e.name,fullStart:s,start:p,end:_,fct:e,offsetBefore:2,offsetAfter:2,kind:"fct",transform:(e,r)=>(e>=t&&(r+=n),r)};return r};this.viewMethodsInfo.push(d(n,l))}let _=e.fileParsed?.ifs??[];for(let e of _)for(let t of e.conditions){let e=t.txt.replace(/\n/g,";"),n=-1,r=e.split(";");if(!e.includes("return ")&&r.length>0){let e=r.pop();n=r.join("\n").length,e?.startsWith(" ")?(r.push("return"+e),l=6):(r.push("return "+e),l=7)}e=r.join("\n");let s=i.length,a=c(t.variables),o=this._space;i+=`\n${o}/** */\n${o}private ${t.fctName}(${a.join(",")}): NotVoid {\n`;let u=i.length;i+=e+"\n";let p=i.length;i+=o+"}";const _=function(n,r){let i={name:t.fctName,fullStart:s,start:u,end:p,kind:"if",fct:{positions:[{start:t.start,end:t.end}],txt:e},offsetBefore:t.offsetBefore,offsetAfter:t.offsetAfter,transform:(e,t)=>(e>=n&&(t+=r),t)};return i};this.viewMethodsInfo.push(_(n,l))}let d=e.fileParsed?.contextEdits??[];for(let e of d){let t=i.length,n=c(e.variables),r=this._space;i+=`\n${r}/** */\n${r}private ${e.editName}(${n.join(",")}): { [key: string]: any } {\n`;let s=i.length;i+=e.fctTs+"\n";let a=i.length;i+=r+"}";const o=function(){return{name:e.editName,fullStart:t,start:s,end:a,offsetBefore:0,offsetAfter:0,kind:"context",fct:{txt:e.fctTs,positions:[{start:e.start,end:e.end}]},transform:(e,t)=>t}};this.viewMethodsInfo.push(o())}const h=e=>{let t=e.injectTsTxt.replace(/\n/g,";"),n=-1,r=t.split(";");if(!t.includes("return ")&&r.length>0){let e=r.pop();n=r.join("\n").length,e?.startsWith(" ")?(r.push("return"+e),l=6):(r.push("return "+e),l=7)}t=r.join("\n");let s=i.length,a=c(e.variables),o=this._space;i+=`\n${o}/** */\n${o}private ${e.injectFctName}(${a.join(",")}): NotVoid {\n`;let u=i.length;i+=t+"\n";let p=i.length;i+=o+"}";this.viewMethodsInfo.push(function(t,n){let r={name:e.injectFctName,fullStart:s,start:u,end:p,fct:{txt:e.injectTsTxt,positions:[{start:e.start,end:e.end}]},offsetBefore:1,offsetAfter:1,kind:"fct",transform:(e,r)=>(e>=t&&(r+=n),r)};return r}(n,l))};let f=e.fileParsed?.injections??[];for(let e of f)h(e);let m=e.fileParsed?.bindings??[];for(let e of m){let t;h(e);let n=c(e.variables),r=0,s="v";for(;e.variables.includes(s);)r++,s="v"+r;n=[s+": any"].concat(n),t=0==e.extractTsCond.length?e.extractTsTxt.replace(/\n/g,";")+" = "+s:"if( "+e.extractTsCond+" ) { "+e.extractTsTxt.replace(/\n/g,";")+" = "+s+" }";let a=this._space;i+=`\n${a}/** */\n${a}private ${e.extractFctName}(${n.join(",")}): void {\n`;i.length;i+=t+"\n";i.length;i+=a+"}"}i+=t.slice(this.componentEnd-r),this.file instanceof o.InternalAventusFile&&this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,n,i))}this.refreshFileParsed();let l=(0,h.join)(this.file.folderPath,"compiled.html"),c=(0,h.join)(this.file.folderPath,"compiled.ts");this.writeHtml?(0,r.writeFileSync)(l,this.HTMLFile?.fileParsed?.compiledTxt??""):(0,r.existsSync)(l)&&(0,r.unlinkSync)(l),this.writeTs?(0,r.writeFileSync)(c,i):(0,r.existsSync)(c)&&(0,r.unlinkSync)(c)}}else this.file instanceof o.InternalAventusFile&&this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,n,this.file.contentUser)),this.refreshFileParsed()}async onValidate(){return await this.runWebCompiler(),this.diagnostics=this.compilationResult?.diagnostics||[],this.transformDiagnosticForView(),this.HTMLFile?.validate(),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.diagnostics}transformDiagnosticForView(){let e=this.HTMLFile;if(e){let t=[],n=[],r=[];for(let i of this.diagnostics){let s=this.file.documentInternal.offsetAt(i.range.start),o=this.file.documentInternal.offsetAt(i.range.end),l=!1,c=s>=this.file.contentUser.length;for(let t=0;t<this.viewMethodsInfo.length;t++){let c=this.viewMethodsInfo[t].fullStart,u=this.viewMethodsInfo[t].end;if(s>c&&o<u){i.source=a.AventusLanguageId.HTML;let c=this.viewMethodsInfo[t].fct,u=this.viewMethodsInfo[t].offsetAfter,p=this.viewMethodsInfo[t].offsetBefore;if(-1==r.indexOf(i.range)){let a=this.viewMethodsInfo[t].transform(s,0);r.push(i.range);let l=s-this.viewMethodsInfo[t].start-a,_=o-this.viewMethodsInfo[t].start-a;for(let t=0;t<c.positions.length;t++){let r=c.positions[t].start,s=c.positions[t].end,a=i;t>0&&(a={...i});let o=r+p+l,d=r+p+_;a.range=o<r||d>s-u?{start:e.file.documentInternal.positionAt(r),end:e.file.documentInternal.positionAt(s)}:{start:e.file.documentInternal.positionAt(o),end:e.file.documentInternal.positionAt(d)},t>0&&n.push(a)}}l=!0;break}}l?n.push(i):c||t.push(i)}this.diagnostics=t,this.htmlDiagnostics=n}else this.htmlDiagnostics=[]}quickParse(){let e=_.QuickParser.parse(this.file.documentUser.getText(),this.build);this._componentEnd=e.end,this._fullname=e.fullname,this._componentClassName=e.className,this.writeHtml=e.writeHtml,this.writeTs=e.writeTs,e.tagName&&this.build.htmlLanguageService.addInternalTagUri(e.tagName,this.file.uri,this._componentClassName);let t="";for(let n=0;n<e.whiteSpaceBefore+4;n++)t+=" ";this._space=t}async onContentChange(){this.quickParse(),await this.runWebCompiler()}async onSave(){await this.runWebCompiler(),this.compilationResult?this.setCompileResult(this.compilationResult.result):this.setCompileResult([]),this.compilationResult?.writeCompiled?(0,r.writeFileSync)(this.file.folderPath+"/compiled.js",(0,p.replaceNotImportAliases)(this.compilationResult.debug,this.build.project.getConfig())):(0,r.existsSync)(this.file.folderPath+"/compiled.js")&&(0,r.unlinkSync)(this.file.folderPath+"/compiled.js"),this.canUpdateComponent||(this.canUpdateComponent=!0)}emitToHtttpServer(e){if(!this.canUpdateComponent)return;let t={};for(let n of e)t[n.name]=n.src;let n,r=!1,i="",s="";if(this.compilationResult)for(let e of this.compileResult)""!=e.classScript&&t[e.classScript]&&t[e.classScript]!=e.compiled&&(e.classScript!=this.compilationResult.componentName?this.build.reloadPage=!0:(r=!0,i=e.hotReload,s=e.classScript,n=this.fileParsed?.classes[s]));if(!this.build.reloadPage&&r&&n){let e=this.buildNamespace;n.namespace&&(e+=n.namespace),e.length>0&&!e.endsWith(".")&&(e+="."),l.HttpServer.getInstance().updateComponent(i,e+s,[])}}async onDelete(){await super.onDelete(),this.build.scssLanguageService.removeInternalDefinition(this.file.uri),this.build.htmlLanguageService.removeInternalDefinition(this.file.uri),this.build.htmlLanguageService.removeInternalTagUri(this.file.uri)}async doViewCompletion(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let r of e.fct.positions)if(n>=r.start+e.offsetBefore&&n<=r.end){let i=n-r.start-e.offsetAfter,s=e.start+i;s=e.transform(s,s);let o=this.file.documentInternal.positionAt(s),l=await this.onCompletion(this.file,o),c=[],u=[];for(let n of l.items)if(!this.viewMethodName||!n.label.startsWith(this.viewMethodName)){if(n.data&&n.data.uri&&(n.data.languageId=a.AventusLanguageId.HTML,n.data.uri=t.file.uri),n.textEdit){let i=n.textEdit;if(i.range&&-1==u.indexOf(i.range)){u.push(i.range);e.fct;let n=this.file.documentInternal.offsetAt(i.range.start),s=this.file.documentInternal.offsetAt(i.range.end),a=e.transform(n,0),o=n-e.start-a,l=s-e.start-a;i.range.start=t.file.documentInternal.positionAt(r.start+e.offsetBefore+o),i.range.end=t.file.documentInternal.positionAt(r.start+e.offsetBefore+l)}}if(n.additionalTextEdits)for(let i of n.additionalTextEdits)if(i.range&&-1==u.indexOf(i.range)){u.push(i.range);e.fct;let n=this.file.documentInternal.offsetAt(i.range.start),s=this.file.documentInternal.offsetAt(i.range.end),a=e.transform(n,0),o=n-e.start-a,l=s-e.start-a;i.range.start=t.file.documentInternal.positionAt(r.start+e.offsetBefore+o),i.range.end=t.file.documentInternal.positionAt(r.start+e.offsetBefore+l)}c.push(n)}return l.items=c,l}return null}async onCompletion(e,t){return await this.runWebCompiler(),this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}async doHover(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let r of e.fct.positions)if(n>=r.start+e.offsetBefore&&n<=r.end){let i=n-r.start-e.offsetAfter,s=e.start+i;s=e.transform(s,s);let a=this.file.documentInternal.positionAt(s),o=await this.onHover(this.file,a);if(o&&o.range){let n=this.file.documentInternal.offsetAt(o.range.start),i=this.file.documentInternal.offsetAt(o.range.end),s=e.transform(n,0),a=n-e.start-s,l=i-e.start-s;o.range.start=t.file.documentInternal.positionAt(r.start+e.offsetBefore+a),o.range.end=t.file.documentInternal.positionAt(r.start+e.offsetBefore+l)}return o}return null}onHover(e,t){return this.tsLanguageService.doHover(e,t)}async doDefinition(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let t of e.fct.positions)if(n>=t.start+e.offsetBefore&&n<=t.end){let r=n-t.start-e.offsetAfter,i=e.start+r;i=e.transform(r,i);let s=this.file.documentInternal.positionAt(i);return await this.onDefinition(this.file,s)}return null}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async doFormatting(e,t){return this.HTMLFile?(await this.getFormatting(t,!1)).html:null}async onFormatting(e,t,n){return(await this.getFormatting(n,!0)).js}async getFormatting(e,t){let n={js:[],html:[]},r={start:{character:0,line:0},end:this.file.documentInternal.positionAt(this.file.contentInternal.length)},i=await this.tsLanguageService.format(this.file,r,e,t),s=this.HTMLFile,a=[];for(let e of i){let t=this.file.documentInternal.offsetAt(e.range.start),r=this.file.documentInternal.offsetAt(e.range.end),i=!1,o=t>=this.file.contentUser.length;if(s)for(let s=0;s<this.viewMethodsInfo.length;s++){let o=this.viewMethodsInfo[s].start,l=this.viewMethodsInfo[s].end,c=this.viewMethodsInfo[s].transform(t,0);if(t>=o+c&&r<l){if(t==o&&!/\S/.test(e.newText)){i=!0;break}let l=this.viewMethodsInfo[s].fct,u=this.viewMethodsInfo[s].offsetBefore;if(-1==a.indexOf(e.range)){a.push(e.range);let i=t-this.viewMethodsInfo[s].start-c,o=r-this.viewMethodsInfo[s].start-c;for(let t=0;t<l.positions.length;t++){let r=l.positions[t].start+u+i,a=l.positions[t].start+u+o;n.html.push({edit:{newText:e.newText,range:{start:r,end:a}},start:l.positions[t].start,end:l.positions[t].end,kind:this.viewMethodsInfo[s].kind})}}i=!0;break}if(t>=this.viewMethodsInfo[s].fullStart&&r<=l){i=!0;break}}i||o||n.js.push(e)}return n}async onCodeAction(e,t){let n=await this.tsLanguageService.doCodeAction(e,t);return this.addCustomCodeAction(n),n}async doReferences(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let t of e.fct.positions)if(n>=t.start+e.offsetBefore&&n<=t.end){let r=n-t.start-e.offsetAfter,i=e.start+r;i=e.transform(i,i);let s=this.file.documentInternal.positionAt(i);return await this.onReferences(this.file,s)}return null}async onReferences(e,t){let n=[],r=await this.tsLanguageService.onReferences(e,t)||[];if(this._compilationResult?.componentName&&this.fileParsed?.classes[this._compilationResult.componentName]){let e=this.file.documentInternal.offsetAt(t),r=this.fileParsed?.classes[this._compilationResult.componentName];if(e>=r.nameStart&&e<=r.nameEnd)for(let[e,t]of this.reverseViewClassInfoDependances)for(let r of t)n.push({uri:e.file.uri,range:{start:e.file.documentInternal.positionAt(r.start),end:e.file.documentInternal.positionAt(r.end)}})}let i=[...r,...n];return i=this.transformRefrencesToView(i),i}transformRefrencesToView(e){let t=[];for(let n of e){if(n.uri.endsWith(a.AventusExtension.ComponentLogic)){let e=this.build.tsFiles[n.uri];if(!e)continue;if(e instanceof f){let r=e.HTMLFile;if(r){let i=[],s=e._file.documentInternal.offsetAt(n.range.start),a=e._file.documentInternal.offsetAt(n.range.end);for(let e=0;e<this.viewMethodsInfo.length;e++){let o=this.viewMethodsInfo[e].fullStart,l=this.viewMethodsInfo[e].end;if(s>o&&a<l){n.uri=r.file.uri;let o=this.viewMethodsInfo[e].fct,l=this.viewMethodsInfo[e].offsetBefore;this.viewMethodsInfo[e].offsetAfter;if(-1==i.indexOf(n.range)){let c=this.viewMethodsInfo[e].transform(s,0);i.push(n.range);let u=s-this.viewMethodsInfo[e].start-c,p=a-this.viewMethodsInfo[e].start-c;for(let e=0;e<o.positions.length;e++){let i=o.positions[e].start+l+u,s=o.positions[e].start+l+p,a=n;e>0&&(a={...a}),a.range={start:r.file.documentInternal.positionAt(i),end:r.file.documentInternal.positionAt(s)},e>0&&t.push(a)}}break}}}}}t.push(n)}return t}async onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async doRename(e,t){const n=this.HTMLFile;if(!n)return null;let r=n.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let n of e.fct.positions)if(r>=n.start+e.offsetBefore&&r<=n.end){let i=r-n.start-e.offsetAfter,s=e.start+i;s=e.transform(s,s);let a=this.file.documentInternal.positionAt(s);return await this.onRename(this.file,a,t)}return null}async onRename(e,t,n){let r=await this.tsLanguageService.onRename(e,t,n);return r&&this.transformRenameToView(r),r}transformRenameToView(e){if(e.changes){let t={};for(let n in e.changes)if(n.endsWith(a.AventusExtension.ComponentLogic)){let r=e.changes[n],i=this.build.tsFiles[n];if(!i)continue;if(i instanceof f){let e=i.HTMLFile;if(e)for(let n=0;n<r.length;n++){let s=r[n],a=i._file.documentInternal.offsetAt(s.range.start),o=i._file.documentInternal.offsetAt(s.range.end);for(let i=0;i<this.viewMethodsInfo.length;i++){let l=this.viewMethodsInfo[i].fullStart,c=this.viewMethodsInfo[i].end;if(a>l&&o<c){t[e.file.uri]||(t[e.file.uri]=[]);let l=this.viewMethodsInfo[i].fct,c=this.viewMethodsInfo[i].transform(a,0),u=a-this.viewMethodsInfo[i].start-c,p=o-this.viewMethodsInfo[i].start-c;for(let n of l.positions){let r=n.start+this.viewMethodsInfo[i].offsetBefore+u,a=n.start+this.viewMethodsInfo[i].offsetBefore+p;t[e.file.uri].push({newText:s.newText,range:{start:e.file.documentInternal.positionAt(r),end:e.file.documentInternal.positionAt(a)}})}r.splice(n,1),n--;break}}}}}for(let n in t)if(e.changes[n])for(let r of t[n])e.changes[n].push(r);else e.changes[n]=t[n]}}addCustomCodeAction(e){let t=!1,n=!1;for(let r of this.diagnostics)if(r.code!=a.AventusErrorCode.MissingViewElement||t)if(r.code==a.AventusErrorCode.MissingProp){let t=r.message.match(/#[a-zA-Z0-9_]+/g);if(t){let n=t[0].replace("#","");e.push({title:"Import missing property "+n,command:{command:"aventus.wc.create.property",title:"Create property",arguments:["prefill:"+n]}})}}else if(r.code!=a.AventusErrorCode.MissingMethod||n){if(r.code==a.AventusErrorCode.viewElementNotFound&&r.data){let t=r.data;e.push({title:"Remove element",edit:{changes:{[this.file.uri]:[{newText:"",range:{start:this.file.documentInternal.positionAt(t.start),end:this.file.documentInternal.positionAt(t.end)}}]}}})}}else n=!0,e.push({title:"Import missing methods",command:{command:"aventus.wc.import.viewMethod",title:"Import missing methods"}});else t=!0,e.push({title:"Import missing view elements",command:{command:"aventus.wc.import.viewElement",title:"Import missing view elements"}})}getMissingVariablesInfo(){let e="",t=-1;if(this.compilationResult){t=this.compilationResult?.missingViewElements.position;for(let t in this.compilationResult.missingViewElements.elements)e+="@ViewElement()"+i.EOL+"protected "+t+"!: "+this.compilationResult.missingViewElements.elements[t]+";"+i.EOL}return{start:t,text:e}}getMissingMethodsInfo(){let e="",t=-1;if(this.compilationResult){t=this.compilationResult?.missingMethods.position;for(let t of this.compilationResult.missingMethods.elements)e+=`/**${i.EOL} * ${i.EOL} */${i.EOL}protected ${t}(){${i.EOL}throw new Error("Method not implemented.");${i.EOL}}${i.EOL}`}return""!=e&&(e=i.EOL+e),{start:t,text:e}}getComponentName(){return this.compilationResult?.componentName||""}viewClassInfoDependances=[];reverseViewClassInfoDependances=new Map;resetViewClassInfoDep(){let e=this.HTMLFile;if(e){for(let t of this.viewClassInfoDependances)t instanceof f&&t.reverseViewClassInfoDependances.delete(e);this.viewClassInfoDependances=[]}}addViewClassInfoDep(e,t,n){let r=this.HTMLFile;r&&(this.viewClassInfoDependances.includes(e)||this.viewClassInfoDependances.push(e),e instanceof f&&(e.reverseViewClassInfoDependances.has(r)||e.reverseViewClassInfoDependances.set(r,[]),e.reverseViewClassInfoDependances.get(r)?.push({start:t,end:n})))}}t.AventusWebComponentLogicalFile=f},87957:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QuickParser=void 0;const r=n(94625),i=n(25850),s=n(74950),a=n(50789),o=n(95553);class l{static parse(e,t){return new l(e,t)}AventusDefaultComponent="Aventus.DefaultComponent";end=-1;currentNamespace=[];fullname="";className="";tagName=null;whiteSpaceBefore=0;writeHtml=!1;writeTs=!1;prefixes;isAbstract=!1;constructor(e,t){this.currentNamespace.push(t.module),t.isCoreBuild&&(this.AventusDefaultComponent="DefaultComponent"),this.prefixes=t.getComponentPrefix().split("-"),this.loadRoot((0,r.createSourceFile)("sample.ts",e,r.ScriptTarget.ESNext,!0))}loadRoot(e){return e.kind==r.SyntaxKind.ModuleDeclaration?this.loadNamespace(e):((0,r.forEachChild)(e,(e=>e.kind==r.SyntaxKind.ModuleDeclaration?this.loadNamespace(e):e.kind==r.SyntaxKind.ClassDeclaration?this.loadClass(e):void 0)),!!this.end||void 0)}loadNamespace(e){if((0,i.hasFlag)(e.flags,r.NodeFlags.Namespace)&&e.body){this.currentNamespace.push(e.name.getText());let t=this.loadRoot(e.body);return this.currentNamespace.splice(this.currentNamespace.length-1,1),t}if((0,i.hasFlag)(e.flags,r.NodeFlags.GlobalAugmentation)&&e.body)return this.loadRoot(e.body)}loadClass(e){let t=/^(\s)*/.exec(e.getText());if(t&&(this.whiteSpaceBefore=t[0].length),e.modifiers)for(let t of e.modifiers)t.kind==r.SyntaxKind.AbstractKeyword&&(this.isAbstract=!0);if(e.name&&e.heritageClauses){let t=e.name;for(let n of e.heritageClauses)if(n.token==r.SyntaxKind.ImplementsKeyword&&((0,r.forEachChild)(n,(n=>{if(n.kind==r.SyntaxKind.ExpressionWithTypeArguments&&n.getText()==this.AventusDefaultComponent){this.end=e.getEnd(),this.fullname=[...this.currentNamespace,t.getText()].join("."),this.className=t.getText();let n=s.DecoratorInfo.buildDecorator(e);for(let e of n){let t=a.DebuggerDecorator.is(e);if(t)t.writeHTML&&(this.writeHtml=!0),t.writeComponentTs&&(this.writeTs=!0);else if(!this.isAbstract){let t=o.TagNameDecorator.is(e);t&&(this.tagName=t.tagName)}}if(!this.isAbstract&&null==this.tagName){let e=this.className.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g);if(e){for(let t=0;t<this.prefixes.length;t++){let n=this.prefixes[t];if(n.length>0&&e[t].toLowerCase()!=n.toLowerCase()){e.splice(0,0,this.prefixes.join("-").toLowerCase());break}}this.tagName=e.join("-").toLowerCase()}}return!0}})),this.end))return!0}}}t.QuickParser=l},22163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebComponentSingleFile=void 0;const r=n(22037),i=n(18952),s=n(19408),a=n(72375),o=n(67246),l=n(95896),c=n(56733),u=n(16286);class p extends o.AventusBaseFile{regionLogic={start:0,end:0};regionStyle={start:0,end:0};regionView={start:0,end:0};get logic(){if(this.regionLogic.file)return this.regionLogic.file;throw"should not append"}get style(){return this.regionStyle.file}get view(){return this.regionView.file}get extension(){return s.AventusExtension.Component}constructor(e,t){super(e,t);let n=this.getDocuments();this.regionLogic.file=n.ts,this.regionStyle.file=n.scss,this.regionView.file=n.html}async init(){await(this.regionView.file?.init()),await(this.regionStyle.file?.init()),this.regionView.file&&this.regionStyle.file||await this.file.validate()}async onValidate(){await this.transformDocument();let e=[],t=[];const n=async n=>{if(n.file){let r=await n.file.file.validate(),i=n.file.file.documentInternal;for(let a of r)a.source=s.AventusLanguageId.WebComponent,-1==t.indexOf(a.range)&&(t.push(a.range),a.range.start=this.file.documentInternal.positionAt(i.offsetAt(a.range.start)+n.start),a.range.end=this.file.documentInternal.positionAt(i.offsetAt(a.range.end)+n.start)),e.push(a)}};return await n(this.regionStyle),await n(this.regionView),await n(this.regionLogic),e}waitingFct={};currentVersion="";isCompiling=!1;transformDocument(){return new Promise((async e=>{let t=this.file.versionInternal+"",n=this.build.insideRebuildAll;if(t!=this.currentVersion||n)if(this.isCompiling)this.waitingFct[t]||(this.waitingFct[t]=[]),this.waitingFct[t].push((()=>{e()}));else{this.isCompiling=!0;let n=this.splitDocument();const r=async(e,t,n)=>{let r=i.TextDocument.create(this.file.uri,t,this.file.versionUser,n);if(e.file)await e.file.triggerContentChange(r);else if(t==s.AventusLanguageId.HTML){let t=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.HTML,this.file.versionUser,n)),r=new l.AventusHTMLFile(t,this.build);e.file=r,await r.init()}else if(t==s.AventusLanguageId.SCSS){let t=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.SCSS,this.file.versionUser,n)),r=new c.AventusWebSCSSFile(t,this.build);e.file=r,await r.init()}};if(null!==n.cssText?await r(this.regionStyle,s.AventusLanguageId.SCSS,n.cssText):this.regionStyle.file&&(this.regionStyle.file.triggerDelete(),this.regionStyle.file=void 0),null!==n.htmlText?await r(this.regionView,s.AventusLanguageId.HTML,n.htmlText):this.regionView.file&&(this.regionView.file.triggerDelete(),this.regionView.file=void 0),null!==n.scriptText&&await r(this.regionLogic,s.AventusLanguageId.TypeScript,n.scriptText),this.isCompiling=!1,this.currentVersion=t,this.waitingFct[t])for(let e of this.waitingFct[t])e();e()}else e()}))}async onContentChange(){await this.transformDocument()}async onSave(){this.build.disableBuild(),this.style&&await this.style.file.triggerSave(),this.view&&await this.view.file.triggerSave(),this.build.enableBuild(),await this.logic.file.triggerSave()}async onCompletion(e,t){await this.transformDocument();let n=e.documentInternal.offsetAt(t),r=[];const i=async e=>{if(n>=e.start&&n<=e.end&&e.file){let t=await(e.file?.file).getCompletion(e.file.file.documentInternal.positionAt(n-e.start));for(let n of t.items)if(n.data&&n.data.uri&&(n.data.previousLanguageId=n.data.languageId,n.data.languageId=s.AventusLanguageId.WebComponent),n.textEdit){let t=n.textEdit;t.range&&-1==r.indexOf(t.range)&&(r.push(t.range),t.range.start=this.transformPosition(e.file,t.range.start,this,-1*e.start),t.range.end=this.transformPosition(e.file,t.range.end,this,-1*e.start))}return t}};let a=await i(this.regionStyle);if(a)return a;let o=await i(this.regionView);if(o)return o;let l=await i(this.regionLogic);return l||{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){let n=[];if(t.data&&t.data.previousLanguageId){let e=t.data.previousLanguageId;delete t.data.previousLanguageId;const i=async(i,s)=>{if(e==s){let e=i.file;if(e){let s=await e.file.getCompletionResolve(t);if(s.additionalTextEdits)for(let t of s.additionalTextEdits)0==e.file.documentInternal.offsetAt(t.range.start)&&(t.newText=r.EOL+t.newText),-1!=n.indexOf(t.range)||t.range.wc_transformed||(n.push(t.range),t.range.wc_transformed=!0,t.range.start=this.transformPosition(e,t.range.start,this,-1*i.start),t.range.end=this.transformPosition(e,t.range.end,this,-1*i.start));return s}}};let a=await i(this.regionStyle,s.AventusLanguageId.SCSS);if(a)return a;let o=await i(this.regionView,s.AventusLanguageId.HTML);if(o)return o;let l=await i(this.regionLogic,s.AventusLanguageId.TypeScript);if(l)return l}return t}async onHover(e,t){let n=e.documentInternal.offsetAt(t),r=[];const i=async e=>{if(n>=e.start&&n<=e.end&&e.file){let t=await e.file.file.getHover(e.file.file.documentInternal.positionAt(n-e.start));return t?.range&&-1==r.indexOf(t.range)&&(r.push(t.range),t.range.start=this.transformPosition(e.file,t.range.start,this,-1*e.start),t.range.end=this.transformPosition(e.file,t.range.end,this,-1*e.start)),t}return null};let s=await i(this.regionStyle);if(s)return s;let a=await i(this.regionView);if(a)return a;let o=await i(this.regionLogic);return o||null}async onDefinition(e,t){let n=e.documentInternal.offsetAt(t),r=null;return this.style&&n>=this.regionStyle.start&&n<=this.regionStyle.end?r=await this.style.file.getDefinition(this.style.file.documentInternal.positionAt(n-this.regionStyle.start)):this.view&&n>=this.regionView.start&&n<=this.regionView.end?r=await this.view.file.getDefinition(this.view.file.documentInternal.positionAt(n-this.regionView.start)):n>=this.regionLogic.start&&n<=this.regionLogic.end&&(r=await this.logic.file.getDefinition(this.logic.file.documentInternal.positionAt(n-this.regionLogic.start))),r}async onFormatting(e,t,n){let i=[],s=[];const a=e=>{let t="";for(let n=0;n<4*e;n++)t+=" ";return t},o=async(e,t)=>{if(e.file){let o=await e.file.file.getFormatting(n);for(let n of o)t.tab&&(n.newText=n.newText.split("\n").join("\n"+a(1))),t.firstLast&&(n.newText=n.newText.trim(),0==n.range.start.character&&0==n.range.start.line&&(n.newText=t.tab?r.EOL+a(1)+n.newText:r.EOL+n.newText),e.file.file.documentInternal.offsetAt(n.range.end)==e.file.file.documentInternal.getText().length&&(n.newText=n.newText+r.EOL)),-1==s.indexOf(n.range)&&(s.push(n.range),n.range.start=this.transformPosition(e.file,n.range.start,this,-1*e.start),n.range.end=this.transformPosition(e.file,n.range.end,this,-1*e.start)),i.push(n)}};return await o(this.regionStyle,{firstLast:!0,tab:!0}),await o(this.regionView,{firstLast:!0,tab:!0}),await o(this.regionLogic,{firstLast:!1,tab:!1}),i}async onCodeAction(e,t){let n={start:e.documentInternal.offsetAt(t.start),end:e.documentInternal.offsetAt(t.end)},r=[];const i=async i=>{if(this.isOverlapping(n,i)&&i.file){let n=await i.file.file.getCodeAction({start:this.transformPosition(this,t.start,i.file,i.start),end:this.transformPosition(this,t.end,i.file,i.start)});for(let t of n)if(t.edit&&t.edit.changes){let n=[];for(let e in t.edit.changes){let s=t.edit.changes[e];for(let e of s)-1==r.indexOf(e.range)&&(r.push(e.range),e.range.start=this.transformPosition(i.file,e.range.start,this,-1*i.start),e.range.end=this.transformPosition(i.file,e.range.end,this,-1*i.start)),n.push(e)}n.length>0&&(delete t.edit.changes[i.file.file.uri],t.edit.changes[e.uri]=n)}return n}};let s;return s=await i(this.regionStyle),s||(s=await i(this.regionView),s||(s=await i(this.regionLogic),s||[]))}async onDelete(){delete this.build.tsFiles[this.file.uri]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}getDocuments(){let e,t,n=this.splitDocument();if(null!==n.htmlText){let e=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.HTML,this.file.versionUser,n.htmlText));new l.AventusHTMLFile(e,this.build)}if(null!==n.cssText){let e=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.SCSS,this.file.versionUser,n.cssText));t=new c.AventusWebSCSSFile(e,this.build)}let r=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.TypeScript,this.file.versionUser,n.scriptText??""));const o={html:e,scss:t,ts:new u.AventusWebComponentLogicalFile(r,this.build)};return this.build.tsFiles[o.ts.file.uri]=o.ts,o}splitDocument(){let e={cssText:null,htmlText:null,scriptText:null},t=/<script>((\s|\S)*)<\/script>/g.exec(this.file.contentInternal);if(t){let n=t.index+8;this.regionLogic.start=n;let r=t.index+t[0].length-9;this.regionLogic.end=r,e.scriptText=this.file.contentInternal.substring(n,r)}let n=/<style>((\s|\S)*)<\/style>/g.exec(this.file.contentInternal);if(n){let t=n.index+7;this.regionStyle.start=t;let r=n.index+n[0].length-8;this.regionStyle.end=r,e.cssText=this.file.contentInternal.substring(t,r)}let r=/<template>((\s|\S)*)<\/template>/g.exec(this.file.contentInternal);if(r){let t=r.index+10;this.regionView.start=t;let n=r.index+r[0].length-11;this.regionView.end=n,e.htmlText=this.file.contentInternal.substring(t,n)}return e}transformPosition(e,t,n,r){let i=e.file.documentInternal.offsetAt(t);return n.file.documentInternal.positionAt(i-r)}isOverlapping(e,t){return t.start<e.start&&t.end>e.start||t.start<e.end&&t.end>e.end||t.start>e.start&&t.end<e.end}static getRegion(e){let t={cssText:null,htmlText:null,scriptText:null},n=/<script>((\s|\S)*)<\/script>/g.exec(e.contentInternal);if(n){let r=n.index+8,i=n.index+n[0].length-9;t.scriptText=e.contentInternal.substring(r,i)}let r=/<style>((\s|\S)*)<\/style>/g.exec(e.contentInternal);if(r){let n=r.index+7,i=r.index+r[0].length-8;t.cssText=e.contentInternal.substring(n,i)}let i=/<template>((\s|\S)*)<\/template>/g.exec(e.contentInternal);if(i){let n=i.index+10,r=i.index+i[0].length-11;t.htmlText=e.contentInternal.substring(n,r)}return t}onGetBuild(){return[this.build]}}t.AventusWebComponentSingleFile=p},79573:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebcomponentTemplate=function(){return'$namespaceStart$$fullname$ = class $classname$ extends $parentClass$ {\n $watchingAttributes$\n \n $getterSetterAttr$\n $getterSetterProp$\n $getterSetterWatch$\n $getterSetterSignal$\n $variables$\n $watchesChangeCb$\n $registerSignal$\n $propertiesChangeCb$\n static __style = `$style$`;\n $constructor$\n __getStatic() {\n return $classname$;\n }\n __getStyle() {\n let arrStyle = super.__getStyle();\n arrStyle.push($classname$.__style);\n return arrStyle;\n }\n $slotBlock$\n\n $states$\n \n $variablesInViewDynamic$\n $templateAction$\n\n getClassName() {\n return "$classname$";\n }\n\n $defaultValue$\n $defaultValueWatch$\n $defaultValueSignal$\n $upgradeAttributes$\n $listBool$\n\n $methods$\n}//todelete for hmr °\n$namespace$\n$tag$\n$exported$\n$definition$\n$namespaceEnd$\n'},t.AventusSimpleWebcomponentTemplate=function(){return"$namespaceStart$$fullname$ = class $classname$ extends $parentClass$ {\n $watchingAttributes$\n\n $getterSetterAttr$\n $getterSetterProp$\n $getterSetterWatch$\n $variables$\n $propertiesChangeCb$\n \n $variablesInViewDynamic$\n $templateAction$\n\n\n $defaultValue$\n $upgradeAttributes$\n $listBool$\n\n constructor() {\n super();\n let template = document.createElement('template');\n template.innerHTML = this.__getHtml();\n let content = template.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n\n let style = new CSSStyleSheet();\n style.replaceSync(this.__getStyle());\n \n const shadowRoot = this.attachShadow({ mode: \"open\" });\n shadowRoot.adoptedStyleSheets = []\n shadowRoot.appendChild(templateContent.cloneNode(true));\n }\n\n __getHtml() {\n return `$html$`;\n }\n\n __getStyle() {\n return `$style$`;\n }\n\n $methods$\n}//todelete for hmr °\n$namespace$\n$tag$\n$exported$\n$definition$\n$namespaceEnd$\n"}},43559:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebcomponentCompiler=void 0;const r=n(19408),i=n(1539),s=n(16286),a=n(7635),o=n(79573),l=n(94625),c=n(37439),u=n(22037),p=n(10604),_=n(65887),d=n(91430),h=n(50789),f=n(95553),m=n(90946),g=n(14710),y=n(55969),v=n(89018),$=n(72471),b=n(91562),S=n(48117),x=n(99071),w=n(29383),C=n(47506),E=n(17509),k=n(49507),A=n(92724),T=n(51907),I=n(60206),F=n(66450);t.AventusWebcomponentCompiler=class{static getVersion(e,t){let n,i,s={ts:e.file.documentUser.version,scss:-1,html:-1};return e.file.uri.endsWith(r.AventusExtension.Component)?(n=t.wcFiles[e.file.uri].style,i=t.wcFiles[e.file.uri].view):(n=t.scssFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentStyle)],i=t.htmlFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentView)]),n&&(s.scss=n.compiledVersion),i&&(s.html=i.compiledVersion),s}file;logicalFile;scssTxt="";template;templateHotReload;templateNpm;document;build;fileParsed;classInfo;className="";fullName="";tagName="";htmlParsed;htmlParsedResult;htmlDoc;htmlFile;scssFile;allFields={};methodsName=[];listBoolProperties=[];defaultValueTxt="";defaultValueHotReloadTxt="";defaultValueNpmTxt="";result={diagnostics:[],writeCompiled:!1,missingViewElements:{position:-1,elements:{}},missingMethods:{position:-1,elements:[]},componentName:"",result:[],htmlDoc:{},scssDoc:{},debug:""};componentResult={hotReload:"",compiled:"",docVisible:"",npm:{defTs:"",namespace:"",exportPath:"",uri:"",src:""},docInvisible:"",dependances:[],classScript:"",classDoc:"",debugTxt:"",uri:"",required:!1,type:m.InfoType.class,isExported:{internal:!0,external:!0},convertibleName:"",tagName:"",story:{}};parentClassName="";parentClassNameNpm="";overrideViewDecorator=null;debuggerDecorator=null;extraConstructorCode=[];AventusWebComponent="Aventus.WebComponent";AventusDefaultComponent="Aventus.DefaultComponent";hasStory;constructor(e,t){let n,i;this.logicalFile=e,this.hasStory=t.hasStories,t.isCoreBuild&&(this.AventusDefaultComponent="DefaultComponent",this.AventusWebComponent="WebComponent"),e.file.uri.endsWith(r.AventusExtension.Component)?(this.file=t.wcFiles[e.file.uri].logic.file,n=t.wcFiles[e.file.uri].style,i=t.wcFiles[e.file.uri].view):(this.file=e.file,n=t.scssFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentStyle)],i=t.htmlFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentView)]),this.scssFile=n,this.scssTxt=n?n.compileResult:"",this.htmlFile=i,this.htmlFile&&(this.htmlParsed=this.htmlFile.fileParsed,this.htmlFile.tsErrors=[]);let s=t.tsLanguageService.doValidation(this.file),a=this.logicalFile.viewMethodName;for(let e=0;e<s.length;e++)s[e].message.startsWith("'"+a)&&(s.splice(e,1),e--);this.result.diagnostics=s,this.template=(0,o.AventusWebcomponentTemplate)(),this.templateHotReload=(0,o.AventusWebcomponentTemplate)(),t.hasNpmOutput&&(this.templateNpm=(0,o.AventusWebcomponentTemplate)()),this.document=e.file.documentInternal,this.build=t,this.fileParsed=e.fileParsed}compile(){if(this.fileParsed){for(let e in this.fileParsed.aliases)this.result.result.push(c.AventusTsLanguageService.compileTs(this.fileParsed.aliases[e],this.logicalFile));for(let e in this.fileParsed.enums)this.result.result.push(c.AventusTsLanguageService.compileTs(this.fileParsed.enums[e],this.logicalFile));for(let e in this.fileParsed.classes){let t=this.fileParsed.classes[e];if(this.isComponentClassInfo(t))if(null!=this.classInfo){let e="Only one class is allowed inside a file. Get "+t.name+" and "+this.classInfo.name;this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,e,t.nameStart,t.nameEnd,r.AventusErrorCode.MultipleWebComponent)),this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,e,this.classInfo.nameStart,this.classInfo.nameEnd,r.AventusErrorCode.MultipleWebComponent))}else this.classInfo=t;else this.result.result.push(c.AventusTsLanguageService.compileTs(t,this.logicalFile))}}if(this.classInfo){this.logicalFile.build.addNamespace(this.classInfo.namespace),this.compileComponentClassInfo(),this.result.htmlDoc=this.htmlDoc??{},this.result.scssDoc=this.prepareDocSCSS(),this.result.componentName=this.className,this.result.writeCompiled=null!==this.debuggerDecorator&&this.debuggerDecorator.writeCompiled;for(let e of this.result.result)e.debugTxt&&(this.result.debug+=e.debugTxt+u.EOL);if(this.htmlParsed&&this.hasStory&&this.classInfo.storieContent){let e=this.classInfo.storieContent;delete e.slots;const t=[];this.classInfo.storieDecorator?.slots?.inject&&this.classInfo.storieDecorator.slots.inject;for(let e in this.htmlParsed.slotsInfo){const n={name:e};this.storyArgTypes["@"+e]={control:"text",table:{category:"Slot"}},this.classInfo.documentation?.documentationSlots[e]&&(n.documentation=this.classInfo.documentation.documentationSlots[e],this.storyArgTypes["@"+e].description=n.documentation),this.classInfo.storieDecorator?.slots?.values&&this.classInfo.storieDecorator.slots.values[e]?this.storyArgs["@"+e]=this.classInfo.storieDecorator.slots.values[e].slice(1,-1):this.storyArgs["@"+e]="",t.push(n)}this.classInfo.loadStoryBookInject(),t.length>0&&(e.slots=t)}}else this.result.diagnostics.push((0,i.createErrorTs)(this.document,"Can't found a web component class to compile inside",r.AventusErrorCode.NoWebComponent));return this.result}isComponentClassInfo(e){return!(!(e instanceof _.ClassInfo&&e.implements.includes(this.AventusDefaultComponent))||e.isInterface)}compileComponentClassInfo(){if(this.classInfo){this.prepareComponentClassInfo(this.classInfo);let e=c.AventusTsLanguageService.compileTs(this.classInfo,this.logicalFile);this.componentResult.classScript=e.classScript,this.componentResult.classDoc=e.classDoc,this.componentResult.dependances=e.dependances,this.componentResult.docInvisible=e.docInvisible,this.componentResult.docVisible=e.docVisible,this.componentResult.npm=e.npm,this.componentResult.type=e.type,this.componentResult.isExported=e.isExported,this.componentResult.uri=e.uri,this.prepareHTMLDocObject(),this.loadParent(this.classInfo),this.addViewElementToDependance(),this.writeFile(),this.classInfo.isAbstract||this.classInfo.isInterface||(this.componentResult.tagName=this.tagName),this.componentResult.compiled=this.template.replace("//todelete for hmr °",""),this.componentResult.npm.src=this.templateNpm?.replace("//todelete for hmr °","")??"",I.HttpServer.isRunning&&(this.componentResult.hotReload=this.templateHotReload.split("//todelete for hmr °")[0],this.componentResult.hotReload=this.componentResult.hotReload.slice(this.componentResult.hotReload.indexOf("=")+1)),this.debuggerDecorator&&this.debuggerDecorator.writeCompiled&&(this.componentResult.debugTxt=this.componentResult.compiled),this.result.result.push(this.componentResult)}}prepareComponentClassInfo(e){for(let t of e.decorators){let e=d.OverrideViewDecorator.is(t);if(e){this.overrideViewDecorator=e;continue}let n=h.DebuggerDecorator.is(t);if(n){this.debuggerDecorator=n;continue}let s=f.TagNameDecorator.is(t);s&&s.tagName?-1==s.tagName.indexOf("-")||s.tagName.toLowerCase()!=s.tagName?this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"tag name must be in lower case and have a - inside",t.contentStart,t.contentEnd,r.AventusErrorCode.TagLower)):this.tagName=s.tagName:S.RequiredDecorator.is(t)&&(this.componentResult.required=!0)}e.extends.length>0&&e.extends[0]==this.AventusWebComponent&&(this.overrideViewDecorator=new d.OverrideViewDecorator),this.getClassName(e),this.htmlParsed&&(this.htmlParsedResult=this.htmlParsed.getParsedInfo(this.className))}prepareHTMLDocObject(){this.classInfo&&!this.classInfo.isAbstract&&(this.htmlDoc={[this.tagName]:{class:this.classInfo.fullName,name:this.tagName,description:this.classInfo.documentation?.fullDefinitions.join(u.EOL)??"",attributes:{}}})}getClassName(e){let t=e.name.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g);if(t){let n=this.build.getComponentPrefix().split("-");for(let e=0;e<n.length;e++){let r=n[e];if(r.length>0&&t[e].toLowerCase()!=r.toLowerCase()){t.splice(0,0,n.join("-").toLowerCase());break}}""==this.tagName&&(this.tagName=t.join("-").toLowerCase()),this.className=e.name,this.fullName=e.fullName,this.parentClassName="Aventus.WebComponent",this.parentClassNameNpm=this.build.getNpmReplacementName([this.build.module,this.fullName].join("."),"Aventus.WebComponent"),e.extends.length>0&&e.extends[0]&&(this.parentClassName=e.extends[0],this.parentClassNameNpm=e.extendsNpm[0])}}loadParent(e,t=!0){let n=this.loadFields(e,t);this.allFields={...n,...this.allFields};for(let t in e.methods)this.methodsName.includes(t)||this.methodsName.push(t);if(e.extends.length>0&&e.extends[0]!=this.AventusWebComponent){let t=e.parentClass;t?this.loadParent(t,!1):this.classInfo&&this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"can't found the path for parent "+e.extends[0],this.classInfo.nameStart,this.classInfo.nameEnd,r.AventusErrorCode.ParsingParentFailed))}}loadFields(e,t){let n={};for(let r in e.properties){let i=e.properties[r];if(this.allFields[i.name])continue;let s=!1,o=new a.CustomFieldModel(i.prop,i.isInsideInterface,e);for(let e of i.decorators){if(["Attribute","Property","Watch","Signal","ViewElement"].includes(e.name)&&(o.propType=e.name,s=!0),s){n[i.name]=o,o.inParent=!t;break}}s||(o.propType="Simple",o.inParent=!t,n[r]=o)}return n}addViewElementToDependance(){if(this.htmlParsed&&this.htmlFile&&this.classInfo){this.logicalFile.resetViewClassInfoDep();let e=[],t={};for(let n of this.htmlParsed.interestPoints)if("tag"==n.type){if(e.includes(n.name)||(e.push(n.name),this.classInfo.addDependanceTag(n.name,this.componentResult)),!t.hasOwnProperty(n.name)){let e=this.build.getWebComponentDefinitionFile(n.name);e instanceof s.AventusWebComponentLogicalFile?t[n.name]=e:t[n.name]=null}let r=t[n.name];r&&this.logicalFile.addViewClassInfoDep(r,n.start,n.end)}}}writeFile(){this.writeFileName(),this.writeFileTemplateHtml(),this.writeFileReplaceVar("style",this.scssTxt),this.writeFileHotReloadReplaceVar("style",this.scssTxt),this.writeFileNpmReplaceVar("style",this.scssTxt),this.writeFileFields(),this.writeFileMethods(),this.writeWatchableElements(),this.writeFileConstructor(),this.template=this.template.replace(/\|\!\*(.*?)\*\!\|/g,"{{$1}}"),this.template=this.removeWhiteSpaceLines(this.template),this.templateHotReload=this.templateHotReload.replace(/\|\!\*(.*?)\*\!\|/g,"{{$1}}"),this.templateHotReload=this.removeWhiteSpaceLines(this.templateHotReload),this.templateNpm&&(this.templateNpm=this.templateNpm.replace(/\|\!\*(.*?)\*\!\|/g,"{{$1}}"),this.templateNpm=this.removeWhiteSpaceLines(this.templateNpm))}writeFileName(){this.writeFileReplaceVar("classname",this.className),this.writeFileHotReloadReplaceVar("classname",this.className),this.writeFileNpmReplaceVar("classname",this.className),this.writeFileReplaceVar("parentClass",this.parentClassName),this.writeFileHotReloadReplaceVar("parentClass",this.parentClassName),this.writeFileNpmReplaceVar("parentClass",this.parentClassNameNpm);let e=this.build.module;if(this.fullName.includes(".")){this.writeFileReplaceVar("fullname",this.fullName),this.writeFileHotReloadReplaceVar("fullname",this.fullName),this.writeFileNpmReplaceVar("fullname","const "+this.className);let t="."+this.classInfo?.namespace;this.writeFileReplaceVar("namespace",this.fullName+".Namespace=`"+e+t+"`;"),this.writeFileHotReloadReplaceVar("namespace",this.fullName+".Namespace=`"+e+t+"`;"),this.writeFileNpmReplaceVar("namespace",this.className+".Namespace=`"+e+t+"`;")}else this.writeFileReplaceVar("fullname","const "+this.fullName),this.writeFileHotReloadReplaceVar("fullname","const "+this.fullName),this.writeFileNpmReplaceVar("fullname","const "+this.fullName),this.writeFileReplaceVar("namespace",this.fullName+".Namespace=`"+e+"`;"),this.writeFileHotReloadReplaceVar("namespace",this.fullName+".Namespace=`"+e+"`;"),this.writeFileNpmReplaceVar("namespace",this.className+".Namespace=`"+e+"`;");if(this.classInfo?.isAbstract?(this.writeFileReplaceVar("tag",""),this.writeFileHotReloadReplaceVar("tag",""),this.writeFileNpmReplaceVar("tag","")):(this.writeFileReplaceVar("tag",this.fullName+".Tag=`"+this.tagName+"`;"),this.writeFileHotReloadReplaceVar("tag",this.fullName+".Tag=`"+this.tagName+"`;"),this.writeFileNpmReplaceVar("tag",this.className+".Tag=`"+this.tagName+"`;")),this.build.namespaces.includes(this.fullName)?(this.writeFileReplaceVar("namespaceStart","_n = "+this.fullName+";"+u.EOL),this.writeFileHotReloadReplaceVar("namespaceStart","_n = "+this.fullName+";"+u.EOL),this.writeFileNpmReplaceVar("namespaceStart","_n = "+this.fullName+";"+u.EOL),this.writeFileReplaceVar("namespaceEnd",u.EOL+"Object.assign("+this.fullName+", _n);"+u.EOL),this.writeFileHotReloadReplaceVar("namespaceEnd",u.EOL+"Object.assign("+this.fullName+", _n);"+u.EOL),this.writeFileNpmReplaceVar("namespaceEnd",u.EOL+"Object.assign("+this.fullName+", _n);"+u.EOL)):(this.writeFileReplaceVar("namespaceStart",""),this.writeFileHotReloadReplaceVar("namespaceStart",""),this.writeFileNpmReplaceVar("namespaceStart",""),this.writeFileReplaceVar("namespaceEnd",""),this.writeFileHotReloadReplaceVar("namespaceEnd",""),this.writeFileNpmReplaceVar("namespaceEnd","")),this.classInfo?.isExported?(this.writeFileReplaceVar("exported","_."+this.fullName+"="+this.fullName+";"),this.writeFileHotReloadReplaceVar("exported","_."+this.fullName+"="+this.fullName+";")):(this.writeFileReplaceVar("exported",""),this.writeFileHotReloadReplaceVar("exported","")),this.writeFileNpmReplaceVar("exported",""),this.classInfo?.isAbstract)this.writeFileReplaceVar("definition",""),this.writeFileHotReloadReplaceVar("definition",""),this.writeFileNpmReplaceVar("definition",""),this.writeFileReplaceVar("customImport",""),this.writeFileHotReloadReplaceVar("customImport",""),this.writeFileNpmReplaceVar("customImport","");else{let e=this.build.isCoreBuild?"":"Aventus.";if(this.writeFileReplaceVar("definition","if(!window.customElements.get('"+this.tagName+"')){window.customElements.define('"+this.tagName+"', "+this.fullName+");"+e+"WebComponentInstance.registerDefinition("+this.fullName+");}"),this.writeFileHotReloadReplaceVar("definition","if(!window.customElements.get('"+this.tagName+"')){window.customElements.define('"+this.tagName+"', "+this.fullName+");"+e+"WebComponentInstance.registerDefinition("+this.fullName+");}"),this.templateNpm&&this.fileParsed){const e=this.build.getNpmReplacementName("","Aventus.WebComponentInstance");this.writeFileNpmReplaceVar("definition","if(!window.customElements.get('"+this.tagName+"')){window.customElements.define('"+this.tagName+"', "+this.className+");"+e+".registerDefinition("+this.className+");}"),this.fileParsed.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"WebComponentInstance",compiled:!0,alias:e,forced:!1})}}}writeFileTemplateHtml(){let e="";if(this.htmlParsed){let t=this.htmlParsed.getSlotsInfoTxt(),n=this.htmlParsed.getBlocksInfoTxt();if(t.length+n.length>0){let r=u.EOL+"super.__getHtml();",i="",s="";t.length>0&&(i=`slots: { ${t} },`),n.length>0&&(s=`blocks: { ${n} }`),this.overrideViewDecorator&&(r=""),e=`__getHtml() {${r}\n this.__getStatic().__template.setHTML({\n ${i} \n ${s}\n });\n}`}}this.writeFileReplaceVar("slotBlock",e),this.writeFileHotReloadReplaceVar("slotBlock",e),this.writeFileNpmReplaceVar("slotBlock",e)}writeFileConstructor(){if(this.classInfo){const e=this.classInfo,t=t=>{let n="";return t.length>0&&(n="constructor() "+t),e.isAbstract&&(n.length>0?(n=n.slice(0,n.length-1),n+=u.EOL+"if (this.constructor == "+this.className+') { throw "can\'t instanciate an abstract class"; }',n+=" }"):n="constructor() { super(); if (this.constructor == "+this.className+') { throw "can\'t instanciate an abstract class"; } }'),this.extraConstructorCode.length>0&&(n.length>0?(n=n.slice(0,n.length-1),n+=u.EOL+this.extraConstructorCode.join(u.EOL),n+=" }"):n="constructor() { super(); "+u.EOL+this.extraConstructorCode.join(u.EOL)+" }"),n};this.writeFileReplaceVar("constructor",t(this.classInfo.constructorContent)),this.writeFileHotReloadReplaceVar("constructor",t(this.classInfo.constructorContentHotReload)),this.writeFileNpmReplaceVar("constructor",t(this.classInfo.constructorContentNpm))}}viewsElements={};upgradeAttributes="";storyArgTypes={};storyArgs={};addStoryField(e){if("Simple"==e.propType)return;if(!this.hasStory||!this.classInfo?.storieContent)return;let t="";if("Attribute"==e.propType?t="Attributes":"Property"==e.propType?t="Properties":"Watch"==e.propType?t="Watches":"Signal"==e.propType&&(t="Signals"),"class"==this.classInfo.storieContent.kind){const t=this.classInfo.storieContent,n=t.properties?.find((t=>t.name==e.name));n&&(n.modifiers?n.modifiers.includes(e.propType)||n.modifiers.push(e.propType):n.modifiers=[e.propType])}if("ViewElement"==e.propType)return;let n=e.type;if(!n)return;let r,i="text",s=[],a=e.defaultValue??void 0;const o=e=>{if("string"==e.kind)i="text",r="string";else if("literal"==e.kind){i="select";let t=e.value;(t.startsWith("'")||t.startsWith('"'))&&(t=t.substring(1)),(t.endsWith("'")||t.endsWith('"'))&&(t=t.substring(0,t.length-1)),s.push(t),r="string"}else if("union"==e.kind){i="select";for(let t of e.nested){let e=t.value;(e.startsWith("'")||e.startsWith('"'))&&(e=e.substring(1)),(e.endsWith("'")||e.endsWith('"'))&&(e=e.substring(0,e.length-1)),s.push(e)}r="string"}else if("number"==e.kind)i="number",r="number";else if("boolean"==e.kind)i="boolean",r="boolean";else if("type"==e.kind)if("Date"==e.value||"DateTime"==e.value)i="date";else{let t=p.ParserTs.getBaseInfo(e.value);t&&t instanceof x.AliasInfo?o(t.type):i="object"}else i="object"};o(n),this.storyArgTypes[e.name]={control:i,table:{category:t}},r&&(this.storyArgTypes[e.name].type=r),s.length>0&&(this.storyArgTypes[e.name].options=s),null!==e.defaultValueStory&&(a=e.defaultValueStory),this.storyArgs[e.name]=a}writeFileFields(){let e=[],t=[],n=[],s=[],a=[],o={};for(let l in this.allFields){let c=this.allFields[l];if(c.inParent)"Attribute"!=c.propType&&"Property"!=c.propType||this.createHtmlDoc(c,c.type);else if(this.addStoryField(c),"Attribute"!=c.propType)if("Property"!=c.propType)if("Signal"!=c.propType)if("Watch"==c.propType)for(let e of c.decorators){let t=w.WatchDecorator.is(e);t&&a.push({field:c,fctTxt:t.fctTxt})}else"ViewElement"==c.propType?(o[c.name]=c,c.overrideNullable||this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add ! after the name to avoid undefined value",c.nameStart,c.nameEnd,r.AventusErrorCode.ExclamationMarkMissing))):"Simple"==c.propType&&e.push(c);else for(let e of c.decorators){let t=F.SignalDecorator.is(e);t&&s.push({field:c,fctTxt:t.fctTxt})}else for(let e of c.decorators){let t=g.PropertyDecorator.is(e);t&&n.push({field:c,fctTxt:t.fctTxt})}else t.push(c)}if(this.viewsElements=o,this.writeFileFieldsSimpleVariable(e),this.writeFileFieldsAttribute(t),this.writeFileFieldsProperty(n),this.writeFileFieldsSignal(s),this.writeFileFieldsWatch(a),this.upgradeAttributes.length>0&&(this.upgradeAttributes=`__upgradeAttributes() { super.__upgradeAttributes(); ${this.upgradeAttributes} }`),this.writeFileReplaceVar("upgradeAttributes",this.upgradeAttributes),this.writeFileHotReloadReplaceVar("upgradeAttributes",this.upgradeAttributes),this.writeFileNpmReplaceVar("upgradeAttributes",this.upgradeAttributes),this.htmlParsedResult){this.writeViewInfo(this.htmlParsedResult,!0);for(let e in o)this.createUnusedViewElement(o[e])}else this.writeFileReplaceVar("templateAction",""),this.writeFileHotReloadReplaceVar("templateAction",""),this.writeFileNpmReplaceVar("templateAction",""),this.writeFileReplaceVar("variablesInViewDynamic",""),this.writeFileHotReloadReplaceVar("variablesInViewDynamic",""),this.writeFileNpmReplaceVar("variablesInViewDynamic","");this.writeViewGlobalVariables()}writeFileFieldsSimpleVariable(e){if(!this.htmlParsedResult)return this.writeFileReplaceVar("variables",""),this.writeFileHotReloadReplaceVar("variables",""),void this.writeFileNpmReplaceVar("variables","");let t="",n="",r="",i=[],s="",a="",o="";if(this.classInfo)for(let e in this.classInfo.propertiesStatic){let t=this.classInfo.propertiesStatic[e];s+=t.compiledContent+u.EOL,a+=t.compiledContentHotReload+u.EOL,this.templateNpm&&(o+=t.compiledContentNpm+u.EOL)}for(let t of e)s+=t.compiledContent+u.EOL,a+=t.compiledContentHotReload+u.EOL,this.templateNpm&&(o+=t.compiledContentNpm+u.EOL),(t.isGet||t.isSet)&&(i.includes(t.name)||(i.push(t.name),this.upgradeAttributes+="this.__correctGetter('"+t.name+"');"+u.EOL));let p=`class MyCompilationClassAventus {${s}}`,_="";try{_=(0,l.transpile)(p,c.AventusTsLanguageService.getCompilerOptionsCompile())}catch(e){}let d=/\{((\s|\S)*)\}/gm.exec(_);if(d&&(t=d[1].trim()),this.writeFileReplaceVar("variables",t),I.HttpServer.isRunning){let e=`class MyCompilationClassAventus {${a}}`,t="";try{t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile())}catch(e){}let r=/\{((\s|\S)*)\}/gm.exec(t);r&&(n=r[1].trim()),this.writeFileHotReloadReplaceVar("variables",n)}if(this.templateNpm){let e=`class MyCompilationClassAventus {${o}}`,t="";try{t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile())}catch(e){}let n=/\{((\s|\S)*)\}/gm.exec(t);n&&(r=n[1].trim()),this.writeFileNpmReplaceVar("variables",r)}}getGetterAndSetter(e,t,n){let r="",i=e.name,s=n?"Prop":"Attr";return"string"==t.kind||"literal"==t.kind||"union"==t.kind?r+=`get '${i}'() { return this.getString${s}('${i}') }\n set '${i}'(val) { this.setStringAttr('${i}', val) }${u.EOL}`:"number"==t.kind?r+=`get '${i}'() { return this.getNumber${s}('${i}') }\n set '${i}'(val) { this.setNumberAttr('${i}', val) }${u.EOL}`:"boolean"==t.kind?(this.listBoolProperties.push('"'+i+'"'),r+=`get '${i}'() { return this.getBool${s}('${i}') }\n set '${i}'(val) { this.setBoolAttr('${i}', val) }${u.EOL}`):"type"===t.kind&&"Date"==t.value?r+=`get '${i}'() { return this.getDate${s}('${i}') }\n set '${i}'(val) { this.setDateAttr('${i}', val) }${u.EOL}`:"type"===t.kind&&"DateTime"==t.value&&(r+=`get '${i}'() { return this.getDateTime${s}('${i}') }\n set '${i}'(val) { this.setDateTimeAttr('${i}', val) }${u.EOL}`),r}getDefaultValueAttr(e,t,n){let r="",i=e.name,s=null;return 1==n?s=e.defaultValue:2==n?s=e.defaultValueHotReload:3==n&&(s=e.defaultValueNpm),"boolean"==t.kind?r+=null!==s&&"false"!==s?"if(!this.hasAttribute('"+i+"')) {this.setAttribute('"+i+"' ,'true'); }"+u.EOL:"if(!this.hasAttribute('"+i+"')) { this.attributeChangedCallback('"+i+"', false, false); }"+u.EOL:("type"!=t.kind||"Date"!=t.value&&t.value,r+=null!==s?"if(!this.hasAttribute('"+i+"')){ this['"+i+"'] = "+s+"; }"+u.EOL:"if(!this.hasAttribute('"+i+"')){ this['"+i+"'] = undefined; }"+u.EOL),r}writeFileFieldsAttribute(e){let t="",n="",r="",i="";for(let s of e){let e=this.validateTypeForProp(this.document,s);e&&(t+=this.getDefaultValueAttr(s,e,1),n+=this.getGetterAndSetter(s,e,!1),this.createHtmlDoc(s,e),this.upgradeAttributes+="this.__upgradeProperty('"+s.name.toLowerCase()+"');"+u.EOL,I.HttpServer.isRunning&&(r+=this.getDefaultValueAttr(s,e,2)),this.templateNpm&&(i+=this.getDefaultValueAttr(s,e,3)))}t.length>0&&(this.defaultValueTxt+=t),r.length>0&&(this.defaultValueHotReloadTxt+=r),i.length>0&&(this.defaultValueNpmTxt+=i),this.writeFileReplaceVar("getterSetterAttr",n),this.writeFileHotReloadReplaceVar("getterSetterAttr",n),this.writeFileNpmReplaceVar("getterSetterAttr",n)}writeFileFieldsProperty(e){let t="",n="",r="",i=[],s="",a="";for(let o of e){let e=o.field,l=this.validateTypeForProp(this.document,e);if(l){if(t+=this.getDefaultValueAttr(e,l,1),n+=this.getGetterAndSetter(e,l,!0),this.createHtmlDoc(e,l),this.upgradeAttributes+="this.__upgradeProperty('"+e.name.toLowerCase()+"');"+u.EOL,i.push(e.name.toLowerCase()),o.fctTxt){let t=this.transpileMethodNoRun(o.fctTxt);r+=`this.__addPropertyActions("${e.name}", ${t});`+u.EOL}I.HttpServer.isRunning&&(s+=this.getDefaultValueAttr(e,l,2)),this.templateNpm&&(a+=this.getDefaultValueAttr(e,l,3))}}t.length>0&&(this.defaultValueTxt+=t),s.length>0&&(this.defaultValueHotReloadTxt+=s),a.length>0&&(this.defaultValueNpmTxt+=a),this.writeFileReplaceVar("getterSetterProp",n),this.writeFileHotReloadReplaceVar("getterSetterProp",n),this.writeFileNpmReplaceVar("getterSetterProp",n),r.length>0&&(r=`__registerPropertiesActions() { super.__registerPropertiesActions(); ${r} }`),this.writeFileReplaceVar("propertiesChangeCb",r),this.writeFileHotReloadReplaceVar("propertiesChangeCb",r),this.writeFileNpmReplaceVar("propertiesChangeCb",r);let o="";i.length>0&&(o='"'+i.join('", "')+'"',o=`static get observedAttributes() {return [${o}].concat(super.observedAttributes).filter((v, i, a) => a.indexOf(v) === i);}`),this.writeFileReplaceVar("watchingAttributes",o),this.writeFileHotReloadReplaceVar("watchingAttributes",o),this.writeFileNpmReplaceVar("watchingAttributes",o)}writeFileFieldsSignal(e){let t="",n="",r="",i="",s="",a="";for(let o of e){let e=o.field;if(o.fctTxt){let t=this.transpileMethodNoRun(o.fctTxt);n+=`this.__addSignalActions("${e.name}", ${t});`+u.EOL}r+=`this.__signals["${e.name}"] = null;`+u.EOL,t+=`get '${e.name}'() {\n\t\t\t\t\t\treturn this.__signals["${e.name}"].value;\n\t\t\t\t\t}\n\t\t\t\t\tset '${e.name}'(val) {\n\t\t\t\t\t\tthis.__signals["${e.name}"].value = val;\n\t\t\t\t\t}`+u.EOL,i+=`s["${e.name}"] = ${e.defaultValue?.replace(/\\"/g,"")};`+u.EOL,this.upgradeAttributes+="this.__correctGetter('"+e.name+"');"+u.EOL,I.HttpServer.isRunning&&(s+=`s["${e.name}"] = ${e.defaultValueHotReload?.replace(/\\"/g,"")};`+u.EOL),this.templateNpm&&(a+=`s["${e.name}"] = ${e.defaultValueNpm?.replace(/\\"/g,"")};`+u.EOL)}i.length>0&&(i=`__defaultValuesSignal(s) { super.__defaultValuesSignal(s); ${i} }`),this.writeFileReplaceVar("defaultValueSignal",i),s.length>0&&(s=`__defaultValuesSignal(s) { super.__defaultValuesSignal(s); ${s} }`),this.writeFileHotReloadReplaceVar("defaultValueSignal",s),a.length>0&&(a=`__defaultValuesSignal(s) { super.__defaultValuesSignal(s); ${a} }`),this.writeFileNpmReplaceVar("defaultValueSignal",a),r.length>0&&(r=`__registerSignalsActions() { ${r} super.__registerSignalsActions(); ${n} }`),this.writeFileReplaceVar("registerSignal",r),this.writeFileHotReloadReplaceVar("registerSignal",r),this.writeFileNpmReplaceVar("registerSignal",r),this.writeFileReplaceVar("getterSetterSignal",t),this.writeFileHotReloadReplaceVar("getterSetterSignal",t),this.writeFileNpmReplaceVar("getterSetterSignal",t)}writeFileFieldsWatch(e){let t="",n="",r="",i="";for(let s of e){let e=s.field;s.fctTxt?this.watchProperties[e.name]=this.transpileMethodNoRun(s.fctTxt):this.watchProperties[e.name]="",t+=`get '${e.name}'() {\n\t\t\t\t\t\treturn this.__watch["${e.name}"];\n\t\t\t\t\t}\n\t\t\t\t\tset '${e.name}'(val) {\n\t\t\t\t\t\tthis.__watch["${e.name}"] = val;\n\t\t\t\t\t}`+u.EOL,n+=`w["${e.name}"] = ${e.defaultValue?.replace(/\\"/g,"")};`+u.EOL,this.upgradeAttributes+="this.__correctGetter('"+e.name+"');"+u.EOL,I.HttpServer.isRunning&&(r+=`w["${e.name}"] = ${e.defaultValueHotReload?.replace(/\\"/g,"")};`+u.EOL),this.templateNpm&&(i+=`w["${e.name}"] = ${e.defaultValueNpm?.replace(/\\"/g,"")};`+u.EOL)}n.length>0&&(n=`__defaultValuesWatch(w) { super.__defaultValuesWatch(w); ${n} }`),this.writeFileReplaceVar("defaultValueWatch",n),r.length>0&&(r=`__defaultValuesWatch(w) { super.__defaultValuesWatch(w); ${r} }`),this.writeFileHotReloadReplaceVar("defaultValueWatch",r),i.length>0&&(i=`__defaultValuesWatch(w) { super.__defaultValuesWatch(w); ${i} }`),this.writeFileNpmReplaceVar("defaultValueWatch",i),this.writeFileReplaceVar("getterSetterWatch",t),this.writeFileHotReloadReplaceVar("getterSetterWatch",t),this.writeFileNpmReplaceVar("getterSetterWatch",t)}writeViewGlobalVariables(){let e="";if(this.defaultValueTxt.length>0&&(e=`__defaultValues() { super.__defaultValues(); ${this.defaultValueTxt} }`),this.writeFileReplaceVar("defaultValue",e),I.HttpServer.isRunning){let e="";this.defaultValueHotReloadTxt.length>0&&(e=`__defaultValues() { super.__defaultValues(); ${this.defaultValueHotReloadTxt} }`),this.writeFileHotReloadReplaceVar("defaultValue",e)}if(this.templateNpm){let e="";this.defaultValueNpmTxt.length>0&&(e=`__defaultValues() { super.__defaultValues(); ${this.defaultValueNpmTxt} }`),this.writeFileNpmReplaceVar("defaultValue",e)}let t="";this.listBoolProperties.length>0&&(t=`__listBoolProps() { return [${this.listBoolProperties.join(",")}].concat(super.__listBoolProps()).filter((v, i, a) => a.indexOf(v) === i); }`),this.writeFileReplaceVar("listBool",t),this.writeFileHotReloadReplaceVar("listBool",t),this.writeFileNpmReplaceVar("listBool",t)}writeFileMethods(){try{let e={},t="",n="",r="",i="";if(this.classInfo){let s="",a="",o="";const p=[...Object.values(this.classInfo.methods),...Object.values(this.classInfo.methodsStatic)];for(let t of p){if(!t.mustBeCompiled)continue;let n=t.name;if(s+=t.compiledContent+u.EOL,I.HttpServer.isRunning&&(a+=t.compiledContentHotReload+u.EOL),this.templateNpm&&(o+=t.compiledContentNpm+u.EOL),!t.isStatic)for(let r of t.decorators){if(A.BindThisDecorator.is(r)){this.extraConstructorCode.push(`this.${n}=this.${n}.bind(this)`);continue}let s=T.EffectDecorator.is(r);if(s){this.watchFunctions[n]=s.options;continue}let a,o,l=null,c=v.StateChangeDecorator.is(r);if(c)l=c;else{let e=$.StateActiveDecorator.is(r);if(e)l=e;else{let e=b.StateInactiveDecorator.is(r);e&&(l=e)}}null!==l?r.arguments.length>0&&(e[l.stateName]||(e[l.stateName]={}),e[l.stateName][l.managerName]||(e[l.stateName][l.managerName]={active:[],inactive:[],askChange:[]}),e[l.stateName][l.managerName][l.functionName].push(t.name)):(a=E.DefaultStateActiveDecorator.is(r))?i+=`this.__addActiveDefState(${a.managerName}, this.${t.name});`+u.EOL:(o=k.DefaultStateInactiveDecorator.is(r))&&(i+=`this.__addInactiveDefState(${o.managerName}, this.${t.name});`+u.EOL)}}let _=`class MyCompilationClassAventus {${s}}`,d=(0,l.transpile)(_,c.AventusTsLanguageService.getCompilerOptionsCompile()),h=/\{((\s|\S)*)\}/gm.exec(d);if(h&&(t=h[1].trim()),I.HttpServer.isRunning){let e=`class MyCompilationClassAventus {${a}}`,t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile()),r=/\{((\s|\S)*)\}/gm.exec(t);r&&(n=r[1].trim())}if(this.templateNpm){let e=`class MyCompilationClassAventus {${o}}`,t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile()),n=/\{((\s|\S)*)\}/gm.exec(t);n&&(r=n[1].trim())}}this.writeFileReplaceVar("methods",t),this.writeFileHotReloadReplaceVar("methods",n),this.writeFileNpmReplaceVar("methods",r);let s="";for(let t in e)for(let n in e[t]){let r=e[t][n];if(s+=`this.__createStatesList(${t}, ${n});`,r.active.length>0){let e="";for(let t of r.active)e+="that."+t+"(state, slugs);";s+=`this.__addActiveState(${t}, ${n}, (state, slugs) => { that.__inactiveDefaultState(${n}); ${e}})`+u.EOL}if(r.inactive.length>0){let e="";for(let t of r.inactive)e+="that."+t+"(state, nextState, slugs);";s+=`this.__addInactiveState(${t}, ${n}, (state, nextState, slugs) => { ${e}that.__activeDefaultState(nextState, ${n});})`+u.EOL}if(r.askChange.length>0){let e="";for(let t of r.askChange)e+="if(!await that."+t+"(state, nextState, slugs)){return false;}"+u.EOL;s+=`this.__addAskChangeState(${t}, ${n}, async (state, nextState, slugs) => { ${e} return true;})`+u.EOL}}(s.length>0||i.length>0)&&(s=`__createStates() { super.__createStates(); let that = this; ${i} ${s} }`),this.writeFileReplaceVar("states",s),this.writeFileHotReloadReplaceVar("states",s),this.writeFileNpmReplaceVar("states",s)}catch(e){}}variablesInViewDynamic="";writeViewInfo(e,t,n,s){const a={};let o="",l="",c=e.elements,p=[];for(let e of c){let n=e.name;if(this.allFields[n]){let s=this.allFields[n];if("ViewElement"==s.propType){e.useLive=!t;for(let t of s.decorators){let n=y.ViewElementDecorator.is(t);if(n&&void 0!==n.useLive){e.useLive=n.useLive;break}}if(e.useLive){let t=e.ids.map((e=>`[_id="${e}"]`)).join("|");s.type.isArray||e.isArray?this.variablesInViewDynamic+=`get ${n} () { var list = Array.from(this.shadowRoot.querySelectorAll('${t}')); return list; }`+u.EOL:this.variablesInViewDynamic+=`get ${n} () { return this.shadowRoot.querySelector('${t}'); }`+u.EOL}else e.isArray?p.push({name:e.name,ids:e.ids,isArray:!0}):p.push({name:e.name,ids:e.ids})}else this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add the decorator @ViewElement for "+n,s.nameStart,s.nameEnd,r.AventusErrorCode.MissingViewElement));delete this.viewsElements[n]}else this.createMissingViewElement(e)}p.length>0&&(a.elements=p);let _=e.content,d={};for(let e in _)d[e]={fct:`@_@${_[e].fct}@_@`},_[e].once&&(d[e].once=!0);Object.keys(d).length>0&&(a.content=d),e.injection.length>0&&(a.injection=e.injection);let h=e.bindings,f=[];for(let e of h){let t={id:e.id,injectionName:e.injectionName,eventNames:e.eventNames,inject:e.inject,extract:e.extract};if(e.once&&(t.once=e.once),1==e.eventNames.length&&e.tagName){let n=this.build.getWebComponentDefinition(e.tagName);if(n){let r=this.isCallback(n.class,e.eventNames[0]);null!=r&&(t.isCallback=!0,t.eventNames[0]=r)}}f.push(t)}f.length>0&&(a.bindings=f);let m=[];for(let t of e.events)if(this.methodsName.includes(t.fct)){let e={eventName:t.eventName,id:t.id,fct:`@_@(e, c) => c.comp.${t.fct}(e)@_@`};if(t.tagName){let n=this.build.getWebComponentDefinition(t.tagName);if(n){let r=this.isCallback(n.class,t.eventName);null!=r&&(e.isCallback=!0,e.eventName=r,e.fct=`@_@(c, ...args) => c.comp.${t.fct}.apply(c.comp, ...args)@_@`)}}m.push(e)}else t.position&&this.createMissingMethod(t.fct,t.position.start,t.position.end);m.length>0&&(a.events=m);let g=[],v=[C.pressEventMap["@dblpress"],C.pressEventMap["@drag"],C.pressEventMap["@drag-end"],C.pressEventMap["@drag-start"],C.pressEventMap["@longpress"],C.pressEventMap["@press"],C.pressEventMap["@press-start"],C.pressEventMap["@press-stop"]],$=[C.pressEventMap["@dblpress-delay"],C.pressEventMap["@longpress-delay"]];for(let t of e.pressEvents){let e={id:t.id};for(let n in t){let r=t[n];r instanceof Object&&(v.includes(n)?this.methodsName.includes(r.value)?e[n]=`@_@(e, pressInstance, c) => { c.comp.${r.value}(e, pressInstance); }@_@`:this.createMissingMethod(r.value,r.start,r.end):$.includes(n)&&(e[n]=`@_@${r.value}@_@`))}g.push(e)}if(g.length>0&&(a.pressEvents=g),e.contextEdits.length>0&&(a.contextEdits=e.contextEdits),Object.keys(a).length>0||n||s){let e=JSON.stringify(a,null,2).replace(/"@_@(.*?)@_@"/g,"$1").replace(/\\"/g,'"');if(t)o=`this.__getStatic().__template.setActions(${e});`+u.EOL;else if(n){o=`const templ${n.templateId} = new Aventus.Template(this);`+u.EOL,o+=`templ${n.templateId}.setTemplate(\`${n.template}\`);`+u.EOL,Object.keys(a).length>0&&(o+=`templ${n.templateId}.setActions(${e});`+u.EOL);o+=`${void 0===n.parentId?"this.__getStatic().__template":`templ${n.parentId}`}.addLoop({\n anchorId: '${n.anchorId}',\n template: templ${n.templateId},\n `,n.simple?(o+=`simple:{data: "${n.simple.data.replace(/[\!|\?]/g,"")}"`,n.simple.index&&(o+=`,index:"${n.simple.index.replace(/[\!|\?]/g,"")}"`),n.simple.item&&(o+=`,item:"${n.simple.item.replace(/[\!|\?]/g,"")}"`),o+="}"+u.EOL):o+=`func: ${n.func}`+u.EOL,o+="});"+u.EOL}else s&&(o=`const templ${s.templateId} = new Aventus.Template(this);`+u.EOL,o+=`templ${s.templateId}.setTemplate(\`${s.template}\`);`+u.EOL,Object.keys(a).length>0&&(o+=`templ${s.templateId}.setActions(${e});`+u.EOL))}for(let t of e.loops)o+=this.writeViewInfo(t.actions,!1,t);for(let t of e.ifs){let e="";for(let n of t.parts){o+=this.writeViewInfo(n.templateAction,!1,void 0,n),e+=`{${n.once?"once: true,":""}\n condition: ${n.condition},\n template: templ${n.templateId}\n },`}e.length>0&&(e=e.slice(0,e.length-1));o+=`${void 0===t.parentId?"this.__getStatic().__template":`templ${t.parentId}`}.addIf({\n anchorId: '${t.anchorId}',\n parts: [${e}]\n });`+u.EOL}if(t){if(o.length>0&&(o=`__registerTemplateAction() { super.__registerTemplateAction();${u.EOL}${o} }`),this.templateNpm){const e=this.build.getNpmReplacementName([this.build.module,this.fullName].join("."),"Aventus.Template");l=o.replace(/new Aventus.Template\(this\)/g,`new ${e}(this)`),this.fileParsed?.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"Template",compiled:!0,alias:e,forced:!1})}this.writeFileReplaceVar("templateAction",o),this.writeFileHotReloadReplaceVar("templateAction",o),this.writeFileNpmReplaceVar("templateAction",l),this.writeFileReplaceVar("variablesInViewDynamic",this.variablesInViewDynamic),this.writeFileHotReloadReplaceVar("variablesInViewDynamic",this.variablesInViewDynamic),this.writeFileNpmReplaceVar("variablesInViewDynamic",this.variablesInViewDynamic)}else o.length>0&&(o+=u.EOL);return o}watchProperties={};watchFunctions={};writeWatchableElements(){let e="";for(let t in this.watchProperties)this.watchProperties[t]?e+=`this.__addWatchesActions("${t}", ${this.watchProperties[t]});`+u.EOL:e+=`this.__addWatchesActions("${t}");`+u.EOL;if(Object.keys(this.watchFunctions).length>0){let t=[];for(let e in this.watchFunctions)this.watchFunctions[e].autoInit?t.push(`{ name: "${e}", autoInit: true }`):t.push(`"${e}"`);e+=`this.__addWatchesFunctions([${u.EOL}${t.join(",\n")}${u.EOL}]);`+u.EOL}let t="";this.debuggerDecorator?.enableWatchHistory&&(t="if(this.__watch){\nthis.__watch.enableHistory();\nthis.getWatchHistory = () => {\n return this.__watch.getHistory();\n}\nthis.clearWatchHistory = () => {\n return this.__watch.clearHistory();\n}\n}"),e.length>0?e=`__registerWatchesActions() {\n ${e}\n super.__registerWatchesActions();\n ${t}\n}`:t.length>0&&(e=`__registerWatchesActions() {\n super.__registerWatchesActions();\n ${t}\n}`),this.writeFileReplaceVar("watchesChangeCb",e),this.writeFileHotReloadReplaceVar("watchesChangeCb",e),this.writeFileNpmReplaceVar("watchesChangeCb",e)}createHtmlDoc(e,t){if(this.htmlDoc){let n=[];if(e.isProtected||e.isPrivate)return;let r="string";if("literal"==t.kind){let e=t.value;(e.startsWith("'")||e.startsWith('"'))&&(e=e.substring(1)),(e.endsWith("'")||e.endsWith('"'))&&(e=e.substring(0,e.length-1)),n.push({name:e,description:""})}else if("union"==t.kind)for(let e of t.nested){let t=e.value;(t.startsWith("'")||t.startsWith('"'))&&(t=t.substring(1)),(t.endsWith("'")||t.endsWith('"'))&&(t=t.substring(0,t.length-1)),n.push({name:t,description:""})}else"boolean"==t.kind?r="boolean":"number"==t.kind?r="number":"type"==t.kind&&"Date"==t.value?r="Date":"type"==t.kind&&"DateTime"==t.value&&(r="DateTime");this.htmlDoc[this.tagName].attributes[e.name]={name:e.name,description:e.documentation?.fullDefinitions.join(u.EOL)??"",type:r,values:n}}}writeFileReplaceVar(e,t){let n=new RegExp("\\$"+e+"\\$","g");this.template=this.template.replace(n,t+"")}writeFileHotReloadReplaceVar(e,t){if(I.HttpServer.isRunning){let n=new RegExp("\\$"+e+"\\$","g");this.templateHotReload=this.templateHotReload.replace(n,t+"")}}writeFileNpmReplaceVar(e,t){if(this.templateNpm){let n=new RegExp("\\$"+e+"\\$","g");this.templateNpm=this.templateNpm.replace(n,t+"")}}createMissingMethod(e,t,n){if(!this.htmlParsed)return;if(-1==this.result.missingMethods.position){let e=(0,c.getSectionStart)(this.file,"methods");this.result.missingMethods.position=e}let s="missing method "+e;-1!=this.result.missingMethods.position?this.result.missingMethods.elements.includes(e)||(this.result.missingMethods.elements.push(e),this.result.diagnostics.push((0,i.createErrorTsSection)(this.document,s,"methods",r.AventusErrorCode.MissingMethod))):this.result.diagnostics.push((0,i.createErrorTsSection)(this.document,s,"methods",r.AventusErrorCode.MissingMethod)),this.htmlFile&&this.htmlFile.tsErrors.push((0,i.createErrorHTMLPos)(this.htmlFile.file.documentUser,s,t,n))}createMissingViewElement(e){let t=[];for(let n in e.tags){let r=this.build.htmlLanguageService.getClassByTag(n),i="";if(r)i=r;else{let e=this.build.htmlLanguageService.getGenericHTML(n);i=e||"HTMLElement"}e.tags[n]>1&&(i+="[]"),t.push(i)}let n="";if(1==t.length)n=t[0];else if(t.length>1){for(let e=0;e<t.length;e++)t[e]=t[e].replace("[]","");n="("+t.join(" | ")+")[]"}let s="Missing variable view element"+e.name;if(this.result.missingViewElements.elements[e.name]=n,this.result.diagnostics.push((0,i.createErrorTsSection)(this.document,s,"variables",r.AventusErrorCode.MissingViewElement)),this.htmlFile)for(let t of e.positions)this.htmlFile.tsErrors.push((0,i.createErrorHTMLPos)(this.htmlFile.file.documentUser,s,t.start,t.end))}createUnusedViewElement(e){let t=e.name;this.overrideViewDecorator?-1==this.overrideViewDecorator.removeViewVariables.indexOf(t)&&this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"Can't find the variable "+t+" inside the view",e.nameStart,e.nameEnd,r.AventusErrorCode.viewElementNotFound,{start:e.start,end:e.end})):this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"Can't find the variable "+t+" inside the view",e.nameStart,e.nameEnd,r.AventusErrorCode.viewElementNotFound,{start:e.start,end:e.end}))}isCallback(e,t){let n;n=t.startsWith("on")?[t]:[t,"on"+t,"on"+t.charAt(0).toUpperCase()+t.slice(1)];for(let t of n){let n=e.getField(t);if(n){let e=n.type.value;if(a.ListCallbacks.includes(e))return t}}return null}prepareDocSCSS(){const e=this.scssFile?.customProperties??[];let t={[this.tagName]:e};if(this.hasStory&&this.classInfo?.storieContent){let t=this.classInfo.storieContent;delete t.style;let n=[];for(let t of e){this.storyArgTypes[t.name]={table:{category:"Style"}};const e={name:t.name};t.documentation&&(this.storyArgTypes[t.name].description=t.documentation,e.documentation=t.documentation),t.type&&(e.type=t.type),"color"==t.type?(this.storyArgTypes[t.name].control="color",this.storyArgTypes[t.name].type="color"):(this.storyArgTypes[t.name].type="string",this.storyArgTypes[t.name].control="text"),t.defaultValue&&(this.storyArgs[t.name]=t.defaultValue),t.chainValues&&(e.value=t.chainValues.join(" | ")),n.push(e)}n.length>0&&(t.style=n)}return t}prepareMethodToTranspile(e){if((e=e.trim()).startsWith("function")&&(e=(e=e.replace("function","")).trim()),!e.match(/^\(.*?\)( *?)=>/g)&&!e.match(/^\S*?( *?)=>/g)){let t=(e=e.replace(/^.*?\(/g,"(")).match(/^\(.*?\)/g);t&&(e=e.replace(t[0],t[0]+" => "))}return e}transpileMethodNoRun(e){try{e=this.prepareMethodToTranspile(e);let t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile()).trim();return t=t.substring(0,t.length-1),t="("+t+")",t}catch(e){}return""}_validateTypeForProp(e,t,n){if("boolean"==n.kind||"number"==n.kind||"string"==n.kind)return n;if("type"==n.kind){if("Date"==n.value||"DateTime"==n.value)return n;{let r=p.ParserTs.getBaseInfo(n.value);if(r&&r instanceof x.AliasInfo)return this._validateTypeForProp(e,t,r.type)}}else{if("literal"==n.kind)return n;if("union"==n.kind){let r;for(let e of n.nested)if("undefined"==e.kind&&(t.isNullable=!0),r){if(e.kind!=r.kind&&"undefined"!=e.kind){r=void 0;break}}else"undefined"!=e.kind&&(r=e);if(r)return"literal"==r.kind?n:this._validateTypeForProp(e,t,r)}}return this.result.diagnostics.push((0,i.createErrorTsPos)(e,"can't use the the type "+n.kind+"("+n.value+") as attribute / property",t.nameStart,t.nameEnd,r.AventusErrorCode.WrongTypeDefinition)),null}validateTypeForProp(e,t){t.name.toLowerCase()!=t.name&&this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"an attribute must be in lower case",t.nameStart,t.nameEnd,r.AventusErrorCode.AttributeLower));let n=this._validateTypeForProp(e,t,t.type);return n&&("boolean"==n.kind||"number"==n.kind?t.overrideNullable||null!==t.defaultValue||this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add ! after the name to avoid undefined value",t.nameStart,t.nameEnd,r.AventusErrorCode.ExclamationMarkMissing)):t.isNullable||null!==t.defaultValue||this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add ? after the name to allow undefined value",t.nameStart,t.nameEnd,r.AventusErrorCode.QuestionMarkMissing))),n}removeWhiteSpaceLines(e){return e.replace(/^(?:[\t ]*(?:\r?\n|\r))+/gm,"")}}},7635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TYPES=t.configTS=t.CustomFieldModel=t.ListCallbacks=void 0;const r=n(37559);t.ListCallbacks=["Callback","Aventus.Callback","CallbackGroup","Aventus.CallbackGroup"];class i extends r.PropertyInfo{propType="Simple";inParent=!1;arguments}t.CustomFieldModel=i,t.configTS={noImplicitOverride:!1,target:"ES6"},t.TYPES={date:"Date",datetime:"DateTime",string:"string",number:"number",boolean:"boolean",literal:"literal"}},36353:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusDataFile=void 0;const r=n(19408),i=n(1539),s=n(6045),a=n(54145);class o extends a.AventusTsFile{get extension(){return r.AventusExtension.Data}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){let e=this.file.documentUser;this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.build.isCoreBuild?this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["IData"]}):this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["Aventus.IData"],customClassRules:[e=>{!e.isInterface&&e.convertibleName&&(e.hasStaticField(e.convertibleName)||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentUser,`Missing static property ${e.convertibleName}`,e.nameStart,e.nameEnd,r.AventusErrorCode.MissingFullName)))}]});const t=this.fileParsed;if(t)for(let n in t.classes){let s=t.classes[n];if(!s.isInterface){for(let t in s.properties){let n=s.properties[t];n.isAbstract||!n.isGetSet||n.overrideNullable||null!==n.defaultValue||this.diagnostics.push((0,i.createErrorTsPos)(e,`Property '${n.name}' has no initializer and is not definitely assigned.`,n.nameStart,n.nameEnd,r.AventusErrorCode.MissingInit))}let t=s,n=!1;for(;null!=t;){if(null!=t.propertiesStatic.Fullname){n=!0;break}t=t.parentClass}n||this.diagnostics.push((0,i.createErrorTsPos)(e,"Missing static property Fullname",s.nameStart,s.nameEnd,r.AventusErrorCode.MissingFullName))}}return this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,s.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return await this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusDataFile=o},20973:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusDefinitionFile=void 0;const r=n(19408),i=n(54145);class s extends i.AventusTsFile{get extension(){return r.AventusExtension.Definition}constructor(e,t){super(e,t),this._contentForLanguageService=this.file.contentUser}async onContentChange(){this._contentForLanguageService=this.file.contentUser}async onValidate(){return[]}async onSave(){}async onCompletion(e,t){return this.build.tsLanguageService.doComplete(e,t)}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return null}async onFormatting(e,t,n){return this.build.tsLanguageService.format(e,t,n)}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return this.build.tsLanguageService.onRename(e,t,n)}}t.AventusDefinitionFile=s},12842:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AVENTUS_DEF_SHARP_PATH=t.AVENTUS_DEF_UI_PATH=t.AVENTUS_DEF_BASE_PATH=t.TYPESCRIPT_LIB_SOURCE=void 0,t.loadTypescriptLib=function(){if(p.length>0)return;let e=(0,i.readdirSync)((0,t.TYPESCRIPT_LIB_SOURCE)());for(let t of e)t.endsWith(".d.ts")&&p.push(t)},t.loadNodeModules=function(e){if(!(0,i.existsSync)(e))return[];const t=(0,i.readdirSync)(e),n=[],s=e=>{const t=(0,r.join)(e,"package.json");if(!(0,i.existsSync)(t))return;const s=JSON.parse((0,i.readFileSync)(t,"utf8")),l=[];let c=!1;const u=t=>{try{const n=(0,r.resolve)(e,t);(0,i.existsSync)(n)&&!l.includes(n)&&l.push(n),t.endsWith(".ts")&&(c=!0)}catch(e){console.error(e)}};if(s.main&&u(s.main),s.module&&u(s.module),s.types&&u(s.types),s.typings&&u(s.typings),s.exports){const e=(e,t)=>e.startsWith("<=")?t<=e.substring(2):e.startsWith("<")?t<e.substring(1):e.startsWith(">=")?t>=e.substring(2):e.startsWith(">")?t>e.substring(1):e===t,t=n=>{if(n)if("object"==typeof n){let r=null,i=!1;if(Object.keys(n).some((e=>e.includes("@")))){for(let s of Object.keys(n)){const a=s.split("@");if(2===a.length){const r=a[1];if(e(r,o.version)){t(n[s]),i=!0;break}}else r=s}!i&&r&&t(n[r])}else{const e=n.node||n.import||n.types||n.require||n.default;t(e)}}else u(n)};for(let e in s.exports){const n=Array.isArray(s.exports[e])?s.exports[e]:[s.exports[e]];for(let e of n)t(e)}}if(c)for(let e of l)e.endsWith(".ts")&&n.push((0,a.pathToUri)(e));else for(let e of l)n.push((0,a.pathToUri)(e))};for(let n of t)if(!n.startsWith("."))if(n.startsWith("@")){const t=(0,i.readdirSync)((0,r.join)(e,n));for(let i of t)s((0,r.join)(e,n,i))}else s((0,r.join)(e,n));return n},t.loadLibrary=function(e){let n,s=l[e];if("string"==typeof s)return s;let a=!0;e.startsWith("custom://@types")?(n=(0,r.join)(u(),e.replace("custom://@types","@types")),a=!1):e.startsWith("file:///")?(n="/"===r.sep?decodeURIComponent(e.replace("file://","")):decodeURIComponent(e.replace("file:///","")),-1!=n.indexOf("/node_modules/@typescript")||-1!=n.indexOf("/node_modules/@types/typescript__")||(a=!1)):e.startsWith("node_modules/@types/typescript__")?a=!1:n=p.includes(e)?(0,r.join)((0,t.TYPESCRIPT_LIB_SOURCE)(),e):e;"string"!=typeof s&&((0,i.existsSync)(n)&&(0,i.lstatSync)(n).isFile()&&(s=(0,i.readFileSync)(n).toString()),void 0!==s&&(l[e]=s));return s};const r=n(71017),i=n(57147),s=n(24964),a=n(1539),o=n(94625),l={},c=()=>s.GenericServer.extensionPath;t.TYPESCRIPT_LIB_SOURCE=()=>(0,r.join)(c(),"node_modules/typescript/lib");t.AVENTUS_DEF_BASE_PATH=()=>(0,r.join)(c(),"lib/Aventus@Main.package.avt");t.AVENTUS_DEF_UI_PATH=()=>(0,r.join)(c(),"lib/Aventus@UI.package.avt");t.AVENTUS_DEF_SHARP_PATH=()=>(0,r.join)(c(),"lib/Aventus@Sharp.package.avt");const u=()=>(0,r.join)(c(),"node_modules"),p=[]},2054:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusLibFile=void 0;const r=n(19408),i=n(6045),s=n(54145),a=n(1539);class o extends s.AventusTsFile{get extension(){return r.AventusExtension.Lib}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){return this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.validateRules({allow_variables:!0,allow_function:!0,customClassRules:[e=>{!e.isInterface&&e.convertibleName&&(e.hasStaticField(e.convertibleName)||this.diagnostics.push((0,a.createErrorTsPos)(this.file.documentUser,`Missing static property ${e.convertibleName}`,e.nameStart,e.nameEnd,r.AventusErrorCode.MissingFullName)))}]}),this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,i.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}onFormatting(e,t,n){return this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusLibFile=o},2044:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusPackageNamespaceFileTs=t.AventusPackageFileTs=t.AventusPackageFile=void 0;const r=n(72375),i=n(67246),s=n(54145),a=n(18952),o=n(19408),l=n(24964),c=n(22037);class u extends i.AventusBaseFile{tsFile=null;tsDef=null;srcInfo={namespace:"",available:[],existing:[]};externalCSS={};name="";npmUri="";version={major:1,minor:0,patch:0};get versionTxt(){return this.version.major+"."+this.version.minor+"."+this.version.patch}get classInfoByName(){return this.tsDef?.classInfoByName||{}}get fileParsed(){return this.tsDef?.fileParsed||null}dependances=[];constructor(e,t){super(e,t),this.prepareFile()}loadWebComponents(){this.tsDef?.loadWebComponents()}prepareFile(){let e=this.separeSection();if(e){let t=a.TextDocument.create(this.file.uri,o.AventusLanguageId.TypeScript,this.file.versionUser,e.jsDef);this.tsFile?this.tsFile.triggerContentChange(t):(this.tsFile=new r.InternalAventusFile(t),this.tsDef=new p(this.tsFile,this.build));try{this.srcInfo=JSON.parse(e.jsSrc)}catch(e){}try{let t=JSON.parse(e.scssDefTxt);this.build.scssLanguageService.addExternalDefinition(this.file.uri,t)}catch(e){}try{this.externalCSS=JSON.parse(e.scssTxt)}catch(e){}try{let t=JSON.parse(e.htmlTxt);this.build.htmlLanguageService.addExternalDefinition(this.file.uri,t)}catch(e){}try{this.dependances=JSON.parse(e.depsTxt)}catch(e){}this.build.externalPackageInformation.rebuild()}}separeSection(){if(this.file.contentUser.match(/\/\/#region js def \/\/((\s|\S)*)\/\/#endregion js def \/\//g)){let e=/^\/\/ (\S+):([0-9]+)\.([0-9]+)\.([0-9]+)$/gm.exec(this.file.contentUser);e&&(this.name=e[1],this.version.major=Number(e[2]),this.version.minor=Number(e[3]),this.version.patch=Number(e[4]));let t=/((\s|\S)*)\/\/#endregion js def \/\//g.exec(this.file.contentUser),n="";t&&(n=t[0]);let r=/\/\/#region js src \/\/((\s|\S)*)\/\/#endregion js src \/\//g.exec(this.file.contentUser),i="";r&&(i=r[1]);let s=/\/\/#region css \/\/((\s|\S)*)\/\/#endregion css \/\//g.exec(this.file.contentUser),a="";s&&(a=s[1]);let o=/\/\/#region css def \/\/((\s|\S)*)\/\/#endregion css def \/\//g.exec(this.file.contentUser),l="";o&&(l=o[1]);let c=/\/\/#region html \/\/((\s|\S)*)\/\/#endregion html \/\//g.exec(this.file.contentUser),u="";c&&(u=c[1]);let p=/\/\/#region dependances \/\/((\s|\S)*)\/\/#endregion dependances \/\//g.exec(this.file.contentUser),_="";return p&&(_=p[1]),{jsDef:n,jsSrc:i,scssDefTxt:l,scssTxt:a,htmlTxt:u,depsTxt:_}}return null}async onContentChange(){this.prepareFile()}async onValidate(){return[]}async onSave(){}async onDelete(){this.build.scssLanguageService.removeExternalDefinition(this.file.uri),this.build.htmlLanguageService.removeExternalDefinition(this.file.uri),this.tsFile&&this.tsFile.triggerDelete()}async onCompletion(e,t){return{isIncomplete:!0,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return this.tsFile?this.tsFile.getHover(t):null}async onDefinition(e,t){return this.tsFile?await this.tsFile.getDefinition(t):null}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return this.tsFile?this.tsFile.getReferences(t):[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}onGetBuild(){return[this.build]}transformPosition(e,t,n,r){let i=e.file.documentUser.offsetAt(t);return n.file.documentUser.positionAt(i-r)}}t.AventusPackageFile=u;class p extends s.AventusTsFile{_classInfoByName={};packagesFiles=[];get extension(){return o.AventusExtension.Package}get classInfoByName(){return this._classInfoByName}constructor(e,t){super(e,t)}loadWebComponents(){try{this.refreshFileParsed(!0);let e=this.fileParsed;if(e){this.loadFilePackage();let t="Aventus.DefaultComponent",n="Aventus.IData";for(let r in e.classes){let i=e.classes[r],s=!1,a=!1;for(let e of i.implements){if(e==t){s=!0;break}if(e==n){a=!0;break}}s&&(this._classInfoByName[i.fullName]=i)}}}catch(e){let t=this.file.uri.split("/"),n=t[t.length-1];l.GenericServer.showErrorMessage("There is an error inside file :"+n),console.log(e)}}loadFilePackage(){try{this.deletePackageFile();let e=this.fileParsed;if(e){let t={};const n=e=>{for(let n in e){let r=e[n],i=r.fullName.split(".");i.pop();let s=i.join(".");t[s]||(t[s]={text:"",parts:[]});let a=t[s].text.length;t[s].text+=`export import ${n} = ${r.fullName};`+c.EOL,t[s].parts.push({startDef:r.start,endDef:r.end,startVirtual:a,endVirtual:t[s].text.length})}};n(e.classes),n(e.aliases),n(e.enums),n(e.functions),n(e.variables);for(let e in t)if(e){const n=this.file.name.replace(o.AventusExtension.Package,"")+":"+e+o.AventusExtension.Package;this.packagesFiles.push(new _(t[e],n,this.build,this))}}}catch(e){console.log(e)}}deletePackageFile(){const e=[...this.packagesFiles];this.packagesFiles=[];for(let t of e)t.internalFile.triggerDelete()}async onContentChange(){this.loadWebComponents()}async onValidate(){return[]}async onSave(){}async onCompletion(e,t){return{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}async onDelete(){await super.onDelete()}}t.AventusPackageFileTs=p;class _ extends s.AventusTsFile{get extension(){return o.AventusExtension.Package}internalFile;info;packageFile;constructor(e,t,n,i){const s=a.TextDocument.create("file:///"+t,o.AventusLanguageId.TypeScript,1,e.text),l=new r.InternalAventusFile(s);l.triggerDelete(),super(l,n),this.info=e,this.internalFile=l,this._contentForLanguageService=e.text,this.fileParsed=i.fileParsed,this.packageFile=i}async goToDefinition(e){let t=this.file.documentInternal.offsetAt(e.start),n=this.file.documentInternal.offsetAt(e.end),r=n-t;for(let e of this.info.parts)if(t>=e.startVirtual&&n<=e.endVirtual){let n=t-e.startVirtual,i=e.startDef+n-7,s=i+r,a=this.packageFile.file.documentInternal.positionAt(i),o=this.packageFile.file.documentInternal.positionAt(s);return{uri:this.packageFile.file.uri,range:{start:a,end:o}}}return null}async onContentChange(){}async onValidate(){return[]}async onSave(){}async onCompletion(e,t){return{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return null}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.AventusPackageNamespaceFileTs=_},99071:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AliasInfo=void 0;const r=n(90946),i=n(73218);class s extends r.BaseInfo{node;type;constructor(e,t,n){super(e,t,n),this.node=e,this.type=new i.TypeInfo(this.node.type),this.loadOnlyDependancesRecu(e)}defineStoryContent(){let e={kind:"type",name:this.name};this.setNamespaceForStroy(e),this.setDocumentationForStroy(e),this.setAccessibilityForStroy(e);const t=this.transformTypeForStory(new i.TypeInfo(this.node.type),this);if(t&&(e.type=t),this.node.typeParameters){e.generics=[];for(let t of this.node.typeParameters)e.generics.push(this.loadGenericForStory(t))}return e}}t.AliasInfo=s},90946:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseInfo=t.InfoType=void 0;const r=n(94625),i=n(10604),s=n(76025),a=n(73218),o=n(74950),l=n(84900),c=n(61586),u=n(24964),p=n(34385),_=n(57315),d=n(80352),h=n(71017),f=n(1539),m=n(48703),g=n(19408),y=n(82599);var v;!function(e){e[e.none=0]="none",e[e.class=1]="class",e[e.classData=2]="classData",e[e.interface=3]="interface",e[e.function=4]="function",e[e.variable=5]="variable",e[e.enum=6]="enum"}(v||(t.InfoType=v={}));class ${static infoByShortName={};static infoByFullName={};static getInfoByShortName(e){return this.infoByShortName[e]}static getInfoByFullName(e,t){e=e.replace(/<.*>/,"");let n=this.infoByFullName[e];return n||(n=this.infoByFullName[t.fullName.split(".")[0]+"."+e]),n}static isExported(e){if(e.modifiers)for(let t of e.modifiers)if(t.kind==r.SyntaxKind.ExportKeyword)return!0;return!1}static isStoryExported(e,t){if(!t.buildConfig.stories)return!1;let n=o.DecoratorInfo.buildDecorator(e).find((e=>"Storybook"==e.name));if(n){const e=_.StorybookDecorator.is(n);if(e)return!e.exportType||("all"==e.exportType||"public"==e.exportType||"protected"==e.exportType)}return"all"==t.buildConfig.stories.format||"public"==t.buildConfig.stories.format||"protected"==t.buildConfig.stories.format}name="";nameStart=0;nameEnd=0;start=0;end=0;fullName="";namespace="";decorators=[];storieContent;storieInject={};storieDecorator;storyType="none";dependances=[];compiled="";documentation;isExported=!1;isInternalExported=!1;_parserInfo;content="";compileTransformations={};get compiledContent(){return $.getContent(this.content,this.start,this.end,this.dependancesLocations,this.compileTransformations)}get compiledContentHotReload(){return $.getContentHotReload(this.content,this.start,this.end,this.dependancesLocations,this.compileTransformations)}get compiledContentNpm(){return $.getContentNpm(this.content,this.start,this.end,this.dependancesLocations,this.compileTransformations)}get fileUri(){return this.document.uri}debug=!1;document;dependanceNameLoaded=[];dependancePrevented=[];dependancesLocations={};infoType=v.none;build;willBeCompiled;get parserInfo(){return this._parserInfo}constructor(e,t,n,i=!0){if(this._parserInfo=n,this.document=n.document,this.decorators=o.DecoratorInfo.buildDecorator(e,this),this.dependancesLocations={},this.build=n.build,this.willBeCompiled=e.kind!=r.SyntaxKind.InterfaceDeclaration&&e.kind!=r.SyntaxKind.TypeAliasDeclaration,e.name){this.start=e.getStart(),this.end=e.getEnd(),this.name=e.name.getText(),this.nameStart=e.name.getStart(),this.nameEnd=e.name.getEnd(),this.namespace=t.join("."),this.fullName=[...t,this.name].join("."),this.content=e.getText(),n.isLib||($.infoByShortName[this.name]=this);let s=new d.DocumentationInfo(e);if(s.hasDoc&&(this.documentation=s),i&&this.loadDependancesDecorator(),e.kind!=r.SyntaxKind.VariableDeclaration){this.isExported=$.isExported(e),this.isInternalExported=this.isExported;for(let e of this.decorators){if(p.InternalDecorator.is(e)){this.isExported=!1;break}}}$.infoByFullName[this.fullName]=this}}loadDependancesDecorator(){for(let e of this.decorators){let t=l.DependancesDecorator.is(e);if(t)for(let e of t.dependances)this.addDependanceName(e.type,e.strong,0,0)}}preventDependanceAdd(e){this.dependancePrevented.includes(e)||this.dependancePrevented.push(e)}loadExpression(e,t=0,n=!1){if(this.debug&&(console.log("***"+t+". "+e.getText()),console.log(r.SyntaxKind[e.kind])),e.kind==r.SyntaxKind.ExpressionWithTypeArguments)this.addDependance(e,n);else if(e.kind==r.SyntaxKind.NewExpression){let r=e;this.loadExpression(r.expression,t+1,n)}else if(e.kind==r.SyntaxKind.PropertyAccessExpression){let r=e,s=r.name.getText(),a=i.ParserTs.getBaseInfo(s);if(a&&r.expression.getText()+"."+s==a.fullName)this.addDependanceName(a.fullName,n,r.getStart(),r.getEnd());else{let e=r.expression.getText();"this"==e||e.includes(".")||(i.ParserTs.hasLocal(e)||i.ParserTs.hasImport(e))&&this.addDependanceName(e,n,r.expression.getStart(),r.expression.getEnd())}this.loadExpression(r.expression,t+1,n)}else if(e.kind==r.SyntaxKind.Identifier){if(e.parent.kind==r.SyntaxKind.PropertyAccessExpression)return;if(e.parent.kind==r.SyntaxKind.GetAccessor||e.parent.kind==r.SyntaxKind.SetAccessor)return;if(!this.checkParentIdentifier(e))return;let t=e.getText();if("this"!=t&&!t.includes(".")){(i.ParserTs.getBaseInfo(t)||i.ParserTs.hasLocal(t)||i.ParserTs.hasImport(t))&&this.addDependanceName(t,n,e.getStart(),e.getEnd())}}else if(e.kind==r.SyntaxKind.CallExpression){let r=e;this.loadExpression(r.expression,t+1,n)}}checkParentIdentifier(e){const t=[r.SyntaxKind.VariableDeclaration,r.SyntaxKind.FunctionDeclaration,r.SyntaxKind.ClassDeclaration,r.SyntaxKind.InterfaceDeclaration,r.SyntaxKind.TypeAliasDeclaration,r.SyntaxKind.EnumDeclaration,r.SyntaxKind.ModuleDeclaration,r.SyntaxKind.NamespaceExportDeclaration,r.SyntaxKind.ImportEqualsDeclaration,r.SyntaxKind.ExportAssignment,r.SyntaxKind.ExportDeclaration,r.SyntaxKind.NamespaceExport,r.SyntaxKind.ExportSpecifier,r.SyntaxKind.MissingDeclaration,r.SyntaxKind.MethodDeclaration,r.SyntaxKind.ClassStaticBlockDeclaration],n=[r.SyntaxKind.ImportDeclaration,r.SyntaxKind.ImportClause,r.SyntaxKind.NamespaceImport,r.SyntaxKind.NamedImports,r.SyntaxKind.ImportSpecifier];if(t.includes(e.parent.kind)){return e.parent.name!=e}return!n.includes(e.parent.kind)&&!(e.parent.kind>=r.SyntaxKind.JsxElement&&e.parent.kind<=r.SyntaxKind.JsxExpression)}loadDependanceContext=void 0;maybeDependances={};loadOnlyDependancesRecu(e,t=0,n=!1){this.parserInfo.isLib||(e.kind==r.SyntaxKind.Decorator&&(this.loadDependanceContext="Decorator"),(0,r.forEachChild)(e,(e=>{e.kind!=r.SyntaxKind.TypeReference?(this.loadExpression(e,t,n),this.loadOnlyDependancesRecu(e,t+1,n)):this.addDependance(e,n)})),e.kind==r.SyntaxKind.Decorator&&(this.loadDependanceContext=void 0))}addDependance(e,t){if(this.parserInfo.isLib)return;const n=e=>{if("type"==e.kind){this.addDependanceName(e.value,t,e.start,e.endNonGeneric);for(let t of e.nested)n(t);for(let t of e.genericValue)n(t)}else if("typeLiteral"==e.kind||"function"==e.kind)for(let t of e.nested)n(t);else if("union"==e.kind)for(let t of e.nested)n(t)};n(new a.TypeInfo(e))}addDependanceWaitName(e,t,n){if(this.parserInfo.isLib)return void n([e.getText()],[e.getText()]);let r=[],i=[],s=0,o=!1;const l=()=>{o||0!=s||(o=!0,n(r,i))},c=(e,n)=>{if("type"==e.kind){s++,this.addDependanceName(e.value,t,e.start,e.endNonGeneric,((e,t)=>{0==n&&(e&&r.push(e),t&&i.push(t)),s--,l()}));for(let t of e.nested)c(t,n+1);for(let r of e.genericValue)t=!1,c(r,n+1)}else if("typeLiteral"==e.kind||"function"==e.kind)for(let t of e.nested)c(t,n+1);else if("union"==e.kind)for(let t of e.nested)c(t,n+1)};c(new a.TypeInfo(e),0),l()}loadStoryBookInject(){const e=this.build.buildConfig.stories;if(!e)return;const t=this.storieContent;if(!t)return;const n=(e,t)=>{this.storieInject[e]?this.storieInject[e].includes(t)||this.storieInject[e].push(t):this.storieInject[e]=[t]},r=r=>{let i=(0,h.join)(e.output,"generated"),s=(0,h.join)(e.output,"auto",...this.fullName.split(".")),a=(0,h.join)(i,...t.namespace.split(".")),o=(0,f.simplifyUri)((0,f.pathToUri)(a),(0,f.pathToUri)(s)),l=this.fullName.split(".");l.pop();let c=r.split(".");const u=c.pop()??"";for(let e=0;e<l.length;e++)if(c.length>e){if(c[e]!=l[e])break;c.splice(e,1),l.splice(e,1),e--}let p="";for(let e=0;e<l.length;e++)p+="../";""==p&&(p+="./"),p+=c.join("/"),p=(0,h.normalize)((0,h.join)(o,p)).replace(/\\/g,"/"),n(p,u)};if(this.storieDecorator?.slots?.inject)for(let e of this.storieDecorator.slots.inject)if(e.includes(".")){let t=this.build.externalPackageInformation.getNpmUri(e);t&&n(t.uri,t.name)}else this.parserInfo.internalObjects[e]?r(this.parserInfo.internalObjects[e].fullname):this.parserInfo.importsLocal[e]?.info?r(this.parserInfo.importsLocal[e].info.fullName):this.parserInfo.packages[e]||this.parserInfo.npmImports[e]&&n(this.parserInfo.npmImports[e].uri,e)}getNpmReplacementName(e){let t=[this.build.module,this.fullName].join(".");return this.parserInfo.getNpmReplacementName(t,e)}addDependanceTag(e,t){let n=this.build.getWebComponentTagDependance(e);if(n){for(let e of t.dependances)if(e.fullName==n.fullName)return;let e=n.uri;if("@external"==e){const e=n.fullName;let t=this.build.externalPackageInformation.getNpmUri(e);const r=this.getNpmReplacementName(e);t&&this._parserInfo.registerGeneratedImport({uri:t.uri,name:t.name,compiled:t.compiled,alias:r,forced:!0})}else if("@npm"==e){const e=n.fullName;let t=c(this.parserInfo.npmImports[e].uri);const r=this.getNpmReplacementName(t+"."+e);this._parserInfo.registerGeneratedImport({uri:this.parserInfo.npmImports[e].uri,name:e,compiled:!0,alias:r,forced:!0})}else{const e=y.ImportInfo.ManualLocalImport(this,n.fullName,n.uri),t=n.fullName;let r=this.fullName.split(".");r.pop();let i=t.split(".");const s=i.pop()??"";for(let e=0;e<r.length;e++)if(i.length>e){if(i[e]!=r[e])break;i.splice(e,1),r.splice(e,1),e--}const a=0==r.length&&0==i.length;let o="";for(let e=0;e<r.length;e++)o+="../";""==o&&(o+="./"),o+=i.join("/");const l=this.getNpmReplacementName([this.build.module,t].join("."));this._parserInfo.registerGeneratedImport({uri:o,nameAlias:e?.alias,name:s,compiled:!0,alias:l,onlySrc:a,forced:!0})}t.dependances.push(n)}}addDependanceName(e,t,n,i,a){if(this.parserInfo.isLib)return;let o;if(o=a||(()=>{}),!e||"constructor"==e||"toString"==e)return void o();this.debug&&console.log("try add dependance "+e);let l=/<.*>/g.exec(e);if(l&&(i-=l[0].length,e=e.replace(l[0],"")),e==this.fullName)return void o();if(s.BaseLibInfo.exists(e)&&!(this.parserInfo.internalObjects[e]||this.parserInfo.importsLocal[e]||this.parserInfo.waitingImports[e]||this.parserInfo.npmImports[e]))return void o();if(n>0&&i>0){this.dependancesLocations[e]||(this.dependancesLocations[e]={locations:{},typeRemplacement:null,replacement:null,hotReloadReplacement:null,npmReplacement:null});let t=n+"_"+i;if(!this.dependancesLocations[e].locations)return u.GenericServer.showErrorMessage("For the admin : you can add "+e+" as dependance to avoid"),void o();if(!this.dependancesLocations[e].locations[t]){let s=(0,r.getTokenAtPosition)(this.parserInfo.srcFile,(n+i)/2),a=(0,r.isTypeReferenceNode)(s)||(0,r.isTypeReferenceNode)(s.parent);this.dependancesLocations[e].locations[t]={start:n,end:i,isType:a}}}if(!this.addDependanceNameCustomCheck(e))return void o();if(this.dependancePrevented.includes(e))return void o();if(this.dependanceNameLoaded.includes(e)){if(o(),void 0===this.loadDependanceContext&&this.maybeDependances[e]){const t=this.getNpmReplacementName(this.maybeDependances[e].name);this._parserInfo.registerGeneratedImport({uri:this.maybeDependances[e].uri,name:this.maybeDependances[e].name,compiled:this.maybeDependances[e].compiled,alias:t,forced:!1})}return}if(this.dependanceNameLoaded.push(e),e.includes(".")){this.dependances.push({fullName:e,uri:"@external",isStrong:t});let n=this.build.externalPackageInformation.getNpmUri(e);const r=this.getNpmReplacementName(e);return n&&(this.dependancesLocations[e].npmReplacement=r,void 0===this.loadDependanceContext?this._parserInfo.registerGeneratedImport({uri:n.uri,name:n.name,compiled:n.compiled,alias:r,forced:!1}):this.maybeDependances[e]=n),void o(e,r)}const p=(t,n,r)=>{let i=this.fullName.split(".");i.pop();let s=t.split(".");const a=s.pop()??"";for(let e=0;e<i.length;e++)if(s.length>e){if(s[e]!=i[e])break;s.splice(e,1),i.splice(e,1),e--}const o=0==i.length&&0==s.length;let l="";for(let e=0;e<i.length;e++)l+="../";""==l&&(l+="./"),l+=s.join("/"),void 0===this.loadDependanceContext?this._parserInfo.registerGeneratedImport({uri:l,name:a,compiled:n,alias:r,onlySrc:o,forced:!1}):this.maybeDependances[e]={uri:l,name:a,compiled:n}};if(this.parserInfo.internalObjects[e]){let n=this.parserInfo.internalObjects[e].fullname,r=[this.build.module,...this.build.namespaces,n].join(".");if(n==this.fullName&&(t=!1),this.dependances.push({fullName:"$namespace$"+n,uri:"@local",isStrong:t}),this.debug&&console.log("add dependance "+e+" : same file"),this.dependancesLocations[e]){let t=n;this.isExported!=this.parserInfo.internalObjects[e].isExported&&(t=this.isExported?["___"+this.build.module,n].join("."):["globalThis",this.build.module,n].join(".")),this.dependancesLocations[e].typeRemplacement=t,this.dependancesLocations[e].replacement=n,this.dependancesLocations[e].npmReplacement=e,this.dependancesLocations[e].hotReloadReplacement=r,p(n,this.parserInfo.internalObjects[e].isCompiled,e)}return void o(n,e)}let _=this.parserInfo.importsLocal[e]?.info;if(_){let n=_.fullName,r=[this.build.module,...this.build.namespaces,n].join(".");this.dependances.push({fullName:"$namespace$"+n,uri:_.fileUri,isStrong:t}),this.debug&&console.log("add dependance "+e+" : imported file");const i=this.getNpmReplacementName([this.build.module,n].join("."));if(this.dependancesLocations[e]){let t=n;this.isExported!=_.isExported&&(t=this.isExported?["___"+this.build.module,n].join("."):["globalThis",this.build.module,n].join(".")),this.dependancesLocations[e].typeRemplacement=t,this.dependancesLocations[e].replacement=n,this.dependancesLocations[e].npmReplacement=i,this.dependancesLocations[e].hotReloadReplacement=r,p(n,_.willBeCompiled,i)}o(n,i)}else{if(this.parserInfo.waitingImports[e])return this.debug&&console.log("add dependance "+e+" : but waiting import file"),void this.parserInfo.waitingImports[e].push((n=>{let r=n.fullName,i=[this.build.module,...this.build.namespaces,r].join(".");const s=this.getNpmReplacementName([this.build.module,r].join("."));if(this.dependancesLocations[e]){let t=r;this.isExported!=n.isExported&&(t=this.isExported?["___"+this.build.module,r].join("."):["globalThis",this.build.module,r].join(".")),this.dependancesLocations[e].typeRemplacement=t,this.dependancesLocations[e].replacement=r,this.dependancesLocations[e].npmReplacement=s,this.dependancesLocations[e].hotReloadReplacement=i,p(r,n.willBeCompiled,s)}this.dependances.push({fullName:"$namespace$"+r,uri:n.fileUri,isStrong:t}),o(r,s)}));if(this.parserInfo.packages[e]){let n=this.parserInfo.packages[e].fullname,r=this.build.externalPackageInformation.getNpmUri(n);this.dependances.push({fullName:n,uri:"@external",isStrong:t});const i=this.getNpmReplacementName(n);return this.dependancesLocations[e]&&(this.dependancesLocations[e].typeRemplacement=n,this.dependancesLocations[e].replacement=n,this.dependancesLocations[e].npmReplacement=i,this.dependancesLocations[e].hotReloadReplacement=n),r&&this._parserInfo.registerGeneratedImport({uri:r.uri,name:r.name,compiled:r.compiled,alias:i,forced:!1}),void o(n,i)}if(this.parserInfo.npmImports[e]){this.dependances.push({fullName:e,uri:"@npm",isStrong:t}),this.debug&&console.log("add dependance "+e+" : npm");let n=c(this.parserInfo.npmImports[e].uri);const r=this.getNpmReplacementName(n+"."+e);return this.dependancesLocations[e]&&(this.dependancesLocations[e].replacement="npmCompilation['"+n+"']."+e,r!=e&&(this.dependancesLocations[e].npmReplacement=r),void 0===this.loadDependanceContext?this._parserInfo.registerGeneratedImport({uri:this.parserInfo.npmImports[e].uri,name:e,compiled:!0,alias:r,forced:!1}):this.maybeDependances[e]={uri:this.parserInfo.npmImports[e].uri,name:e,compiled:!0}),void o(e,r)}this.dependances.push({fullName:e,uri:"@external",isStrong:t}),this.debug&&console.log("add dependance "+e+" : external"),o(e,e)}}addDependanceNameCustomCheck(e){return!0}static getContent(e,t,n,r,i){return this._getContent(e,t,n,r,i,1)}static getContentHotReload(e,t,n,r,i){return this._getContent(e,t,n,r,i,2)}static getContentNpm(e,t,n,r,i){return this._getContent(e,t,n,r,i,3)}static _getContent(e,t,n,r,i,s){let a=[];for(let e in r){let i=null;1==s?i=r[e].replacement:2==s?i=r[e].hotReloadReplacement:3==s&&(i=r[e].npmReplacement);let o=r[e].typeRemplacement;if(i)for(let l in r[e].locations){let c=r[e].locations[l];c.start>=t&&c.end<=n&&(c.isType&&o&&3!=s?a.push({newText:o,start:c.start-t,end:c.end-t}):a.push({newText:i,start:c.start-t,end:c.end-t}))}}for(let e in i){let r=i[e];r.start>=t&&r.end<=n&&a.push({newText:r.newText,start:r.start-t,end:r.end-t})}a.sort(((e,t)=>t.end-e.end));let o=e.length;for(let t of a)t.end>o||(e=e.slice(0,t.start)+t.newText+e.slice(t.end,e.length),o=t.start);return e}loadStorieContent(){if(this.build.buildConfig.stories&&!this._parserInfo.isLib){for(let e of this.decorators){const t=_.StorybookDecorator.is(e);if(t){this.storieDecorator=t;break}}const e=this.build.buildConfig.stories.format;if(this.storieDecorator?this.storieDecorator.exportType?this.storyType=this.storieDecorator.exportType:this.storyType=e?"manual"==e?"all":e:"none":this.storyType=e?"manual"==e?"none":e:"none","public"==this.storyType||"protected"==this.storyType?(this.storieDecorator||this.isExported)&&(this.storieContent=this.defineStoryContent(this.storieDecorator)):"all"==this.storyType&&(this.storieContent=this.defineStoryContent(this.storieDecorator)),this.storieContent&&this.build.buildConfig.stories.srcBaseUrl){let e=this.build.project.getConfigFile().uri.replace(g.AventusExtension.Config,""),t=(0,f.uriToPath)(this.fileUri.replace(e,"")).replace(/\\/g,"/");this.storieContent.srcUrl=this.build.buildConfig.stories.srcBaseUrl+"/"+t}}}transformTypeForStory(e,t){if(e){if("type"==e.kind){const n={kind:"simple",name:e.value};if(e.isArray&&(n.isArray=!0),e.genericValue.length>0){const r=[];for(let n of e.genericValue){const e=this.transformTypeForStory(n,t);e&&r.push(e)}r.length>0&&(n.generics=r)}let r=t.parserInfo.importsLocal[e.value]?.info;if(r)"none"!=r.storyType&&(n.ref=m.Storie.getFullname(r));else{let r=t.parserInfo.internalObjects[e.value];r?.isStoryExported&&(n.ref=r.fullname)}return n}if("any"==e.kind||"never"==e.kind||"unknown"==e.kind||"boolean"==e.kind||"null"==e.kind||"number"==e.kind||"string"==e.kind||"undefined"==e.kind||"void"==e.kind||"object"==e.kind||"symbol"==e.kind||"this"==e.kind){return{kind:"simple",name:e.kind}}if("literal"==e.kind){return{kind:"simple",name:e.value.slice(1,-1)}}if("function"==e.kind||"constructor"==e.kind){if(!e.fctType)return;const t={kind:"function"};if(Object.keys(e.fctType.parameters).length>0){t.parameters=[];for(let n in e.fctType.parameters){const r={name:n},i=this.transformTypeForStory(e.fctType.parameters[n],this);i&&(r.type=i),t.parameters.push(r)}}const n=this.transformTypeForStory(e.fctType.return,this);n&&(t.return=n),"constructor"==e.kind&&(t.isConstructor=!0);let r=e.node;if(r.typeParameters){t.generics=[];for(let e of r.typeParameters){const n={name:e.name.getText()},r=this.transformTypeForStory(new a.TypeInfo(e.default),this);r&&(n.default=r);const i=this.transformTypeForStory(new a.TypeInfo(e.constraint),this);i&&(n.constraint=i),t.generics.push(n)}}return t}if("tuple"==e.kind){const n={kind:"tupple",tupples:[]};for(let r of e.nested){const e=this.transformTypeForStory(r,t);e&&n.tupples.push(e)}return n}if("typeLiteral"==e.kind){const n={kind:"object"};let i=e.node;return(0,r.forEachChild)(i,(e=>{if(e.kind==r.SyntaxKind.PropertySignature){let i=e;if(i.type){let e=i.name.getText(),r=new a.TypeInfo(i.type);const s=this.transformTypeForStory(r,t);s&&(n.keys||(n.keys={}),n.keys[e]=s)}else console.log("need implements property signature no type "+r.SyntaxKind[e.kind]+" "+t.fileUri)}else if(e.kind==r.SyntaxKind.IndexSignature){let r=e;if(r.parameters.length>0&&r.parameters[0].type){n.indexSignatures||(n.indexSignatures=[]);const e=this.transformTypeForStory(new a.TypeInfo(r.type),t),i=this.transformTypeForStory(new a.TypeInfo(r.parameters[0].type),t);e&&i&&n.indexSignatures.push({keyName:r.parameters[0].name.getText(),keyType:i,type:e})}}else if(e.kind==r.SyntaxKind.TypeLiteral){const r=e;let i=this.transformTypeForStory(new a.TypeInfo(r),t);i&&(n.array=i)}else console.log("need implements for "+r.SyntaxKind[e.kind]+" "+t.fileUri)})),n}if("union"==e.kind){const n={kind:"union",types:[]};for(let r of e.nested){const e=this.transformTypeForStory(r,t);e&&n.types.push(e)}return n}if("intersection"==e.kind){const n={kind:"intersection",types:[]};for(let r of e.nested){const e=this.transformTypeForStory(r,t);e&&n.types.push(e)}return n}if("typeOperator"!=e.kind){if("indexedAccess"!=e.kind){if("mappedType"!=e.kind){if("infer"==e.kind){return{kind:"infer",name:e.value}}if("conditional"!=e.kind)"mock"==e.kind&&console.log("mock type");else if(e.conditionalType){const n=this.transformTypeForStory(e.conditionalType.check,t),r=this.transformTypeForStory(e.conditionalType.extends,t),i=this.transformTypeForStory(e.conditionalType.true,t),s=this.transformTypeForStory(e.conditionalType.false,t);if(r&&i&&s&&n){return{kind:"conditional",check:n,extends:r,true:i,false:s}}}}else if(e.mappedType){const n=this.transformTypeForStory(e.mappedType.parameterType,t),r=this.transformTypeForStory(e.mappedType.type,t);if(n&&r){const t={kind:"mappedType",parameterName:e.mappedType.parameterName,parameterType:n,type:r};return e.mappedType.modifier&&(t.modifier=e.mappedType.modifier),t}}}else if(2==e.nested.length){const n=this.transformTypeForStory(e.nested[0],t),r=this.transformTypeForStory(e.nested[1],t);if(r&&n){return{kind:"indexAccess",obj:n,key:r}}}}else if(e.nested.length>0){const n=this.transformTypeForStory(e.nested[0],t);if(n){return{kind:"typeOperator",value:e.value,type:n}}}}}loadGenericForStory(e,t){const n=e.name.getText(),r={name:n};if(t||(t=this.documentation),t?.documentationTemplates[n]&&(r.documentation=t.documentationTemplates[n]),e.constraint){const t=this.transformTypeForStory(new a.TypeInfo(e.constraint),this);t&&(r.constraint=t)}if(e.default){const t=this.transformTypeForStory(new a.TypeInfo(e.default),this);t&&(r.default=t)}return r}loadParameterForStory(e,t){const n=e.name.getText(),r={name:n},i=this.transformTypeForStory(new a.TypeInfo(e.type),this);return i&&(r.type=i),t||(t=this.documentation),t?.documentationParameters[n]&&(r.documentation=t.documentationParameters[n]),r}setAccessibilityForStroy(e){this.isExported||(e.accessibility="internal")}setNamespaceForStroy(e){this.build.noNamespaceUri[this.fileUri]?this.namespace.length>0&&(e.namespace=this.namespace):(e.namespace=this.build.module,this.namespace.length>0&&(e.namespace+="."+this.namespace))}setDocumentationForStroy(e){this.documentation&&(e.documentation=this.documentation.definitions.join("\n"))}}t.BaseInfo=$},76025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseLibInfo=void 0;const r=n(71017),i=n(94625),s=n(12842);t.BaseLibInfo=class{static libInfo=[];static init(){let e=(0,i.createProgram)([(0,r.join)((0,s.TYPESCRIPT_LIB_SOURCE)(),"lib.es2022.full.d.ts")],{}).getSourceFiles();for(let t of e)if(t.statements)for(let e of t.statements)try{if(e.kind==i.SyntaxKind.FunctionDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.EnumDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.ClassDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.MethodDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.VariableDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.InterfaceDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.TypeAliasDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}}catch{}}static exists(e){return 0==this.libInfo.length&&this.init(),this.libInfo.includes(e)}}},65887:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClassInfo=void 0;const r=n(94625),i=n(90946),s=n(46057),a=n(10604),o=n(37559),l=n(66145),c=n(73218),u=n(61586);class p extends i.BaseInfo{extends=[];extendsNpm=[];implements=[];parentClass=null;methods={};methodsStatic={};properties={};propertiesStatic={};isInterface=!1;isAbstract=!1;constructorBody;parameters=[];methodParameters=[];convertibleName="";extendsType;implementsType=[];get constructorContent(){if(!this.constructorBody)return"";let e=this.constructorBody.getText();return e=i.BaseInfo.getContent(e,this.constructorBody.getStart(),this.constructorBody.getEnd(),this.dependancesLocations,this.compileTransformations),e}get constructorContentHotReload(){if(!this.constructorBody)return"";let e=this.constructorBody.getText();return e=i.BaseInfo.getContentHotReload(e,this.constructorBody.getStart(),this.constructorBody.getEnd(),this.dependancesLocations,this.compileTransformations),e}get constructorContentNpm(){if(!this.constructorBody)return"";let e=this.constructorBody.getText();return e=i.BaseInfo.getContentNpm(e,this.constructorBody.getStart(),this.constructorBody.getEnd(),this.dependancesLocations,this.compileTransformations),e}node;constructor(e,t,n){if(super(e,t,n,!1),this.node=e,this.isInterface=e.kind==r.SyntaxKind.InterfaceDeclaration,this.infoType=this.isInterface?i.InfoType.interface:i.InfoType.class,e.typeParameters)for(let t of e.typeParameters)this.parameters.push(t.name.getText());if(e.modifiers)for(let t of e.modifiers)t.kind==r.SyntaxKind.AbstractKeyword&&(this.isAbstract=!0);if(e.heritageClauses)for(let t of e.heritageClauses)this.getClassInheritance(t);(0,r.forEachChild)(e,(e=>{let t=!1,n=null;if(e.kind==r.SyntaxKind.Constructor){let t=e;t.body&&(this.constructorBody=t.body)}else if(e.kind==r.SyntaxKind.PropertyDeclaration){let r=new o.PropertyInfo(e,this.isInterface,this);r.isStatic?(this.propertiesStatic[r.name]=r,t=!0):this.properties[r.name]=r;let i=e;i.type||a.ParserTs.addError(i.getStart(),i.getEnd(),"You must define a type for the prop "+r.name),n=r}else if(e.kind==r.SyntaxKind.GetAccessor){let t=e,r=new o.PropertyInfo(t,this.isInterface,this);r.isStatic?this.propertiesStatic[r.name]=r:this.properties[r.name]=r,t.type||a.ParserTs.addError(t.getStart(),t.getEnd(),"You must define a type for the prop "+r.name),n=r}else if(e.kind==r.SyntaxKind.SetAccessor){let t=e,r=new o.PropertyInfo(t,this.isInterface,this);r.isStatic?this.propertiesStatic["°set°"+r.name]=r:this.properties["°set°"+r.name]=r,n=r}else if(e.kind==r.SyntaxKind.MethodDeclaration){let t=e;if(t.typeParameters)for(let e of t.typeParameters)this.methodParameters.push(e.name.getText());let r=new s.MethodInfo(e,this);r.isStatic?this.methodsStatic[r.name]=r:this.methods[r.name]=r,this.methodParameters=[],n=r}else if(e.kind==r.SyntaxKind.MethodSignature){let t=e;if(t.typeParameters)for(let e of t.typeParameters)this.methodParameters.push(e.name.getText());let r=new s.MethodInfo(e,this);r.isStatic?this.methodsStatic[r.name]=r:this.methods[r.name]=r,this.methodParameters=[],n=r}else if(e.kind==r.SyntaxKind.PropertySignature){let r=new o.PropertyInfo(e,this.isInterface,this);r.isStatic?(this.propertiesStatic[r.name]=r,t=!0):this.properties[r.name]=r;let i=e;i.type||a.ParserTs.addError(i.getStart(),i.getEnd(),"You must define a type for the prop "+r.name),n=r}if(n&&n.accessibilityModifierTransformation){let e=n.accessibilityModifierTransformation.start+"_"+n.accessibilityModifierTransformation.end;this.compileTransformations[e]=n.accessibilityModifierTransformation}this.loadOnlyDependancesRecu(e,0,t)})),this.loadConvertible(),this.loadDependancesDecorator()}getClassInheritance(e){e.token==r.SyntaxKind.ExtendsKeyword?(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ExpressionWithTypeArguments&&(this.build.hasStories&&(this.extendsType=new c.TypeInfo(e)),this.addDependanceWaitName(e,!0,((e,t)=>{if(e.length>0&&(this.extends.push(e[0]),1==this.extends.length)){let t=i.BaseInfo.getInfoByFullName(e[0],this);if(t&&t instanceof p&&(this.parentClass=t,this.parentClass==this))throw this.parentClass=null,"The parent is the child => impossible. Please send it to an admin"}t.length>0&&this.extendsNpm.push(t[0])})),(0,r.forEachChild)(e,(e=>{this.loadOnlyDependancesRecu(e,0,!0)})))})):e.token==r.SyntaxKind.ImplementsKeyword&&(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ExpressionWithTypeArguments&&(this.build.hasStories&&this.implementsType.push(new c.TypeInfo(e)),this.addDependanceWaitName(e,!0,(e=>{if(e.length>0)for(let t of e)this.implements.push(t)})))}))}loadConvertible(){let e=this;for(;null!=e;){for(let t of e.decorators){let e=l.ConvertibleDecorator.is(t);if(e)return void(this.convertibleName=e.name)}e=e.parentClass}}addDependanceNameCustomCheck(e){return!this.parameters.includes(e)&&!this.methodParameters.includes(e)}hasStaticField(e){let t=this;for(;null!=t;){if(null!=t.propertiesStatic[e])return!0;t=t.parentClass}return!1}hasField(e){return null!=this.getField(e)}getField(e){let t=this;for(;null!=t;){if(null!=t.properties[e])return t.properties[e];t=t.parentClass}return null}defineStoryContent(e){let t={kind:this.isInterface?"interface":"class",name:this.name};if(this.setNamespaceForStroy(t),this.setDocumentationForStroy(t),this.setAccessibilityForStroy(t),this.isAbstract&&"class"==t.kind&&(t.modifier="abstract"),this.extendsType){const e=this.transformTypeForStory(this.extendsType,this);e&&(t.extends=e)}if(this.implementsType.length>0&&"class"==t.kind){t.implements=[];for(let e of this.implementsType){const n=this.transformTypeForStory(e,this);n&&t.implements.push(n)}}if(this.node.typeParameters){t.generics=[];for(let e of this.node.typeParameters)t.generics.push(this.loadGenericForStory(e))}for(let e in this.methods)this.addMethodStoryContent(t,this.methods[e]);for(let e in this.methodsStatic)this.addMethodStoryContent(t,this.methodsStatic[e]);for(let e in this.properties)this.addPropertyStoryContent(t,this.properties[e]);for(let e in this.propertiesStatic)this.addPropertyStoryContent(t,this.propertiesStatic[e]);return t}addMethodStoryContent(e,t){if(!this.canAddToStory(t))return;let n=[this.build.module,this.fullName].join(".");if(t.name.startsWith("__"+u(n)+"method"))return;e.methods||(e.methods=[]);const r={name:t.name,accessibility:t.isPrivate?"private":t.isProtected?"protected":"public"};e.methods.push(r);const i=e=>{r.modifiers||(r.modifiers=[]),r.modifiers.push(e)};if(t.documentation&&(r.documentation=t.documentation.definitions.join("\n")),t.isAbstract&&i("abstract"),t.isOverride&&i("override"),t.isStatic&&i("static"),t.node.typeParameters){r.generics=[];for(let e of t.node.typeParameters)r.generics.push(this.loadGenericForStory(e,t.documentation))}if(t.node.parameters.length>0){r.parameters=[];for(let e of t.node.parameters)r.parameters.push(this.loadParameterForStory(e,t.documentation))}if(t.node.type){const e=new c.TypeInfo(t.node.type),n=this.transformTypeForStory(e,this);if(n){const e={type:n};t.documentation?.documentationReturn&&(e.documentation=t.documentation?.documentationReturn),r.return=e}}}addPropertyStoryContent(e,t){if(!this.canAddToStory(t))return;e.properties||(e.properties=[]);const n={name:t.name,accessibility:t.isPrivate?"private":t.isProtected?"protected":"public"};e.properties.push(n),t.documentation&&(n.documentation=t.documentation.definitions.join("\n"));const r=e=>{n.modifiers||(n.modifiers=[]),n.modifiers.push(e)};t.isOverride&&r("override"),t.isAbstract&&r("abstract"),t.isGet&&r("readonly"),t.isSet&&r("writeonly"),t.isStatic&&r("static");const i=this.transformTypeForStory(t.type,this);i&&(n.type=i)}canAddToStory(e){if(!this.build.buildConfig.stories)return!1;const t=this.storyType;if("public"==t){if(e.isPrivate||e.isProtected){return void 0!==e.decorators.find((e=>"AddToStory"==e.name))}return void 0===e.decorators.find((e=>"NoStory"==e.name))}if("protected"==t){if(e.isPrivate){return void 0!==e.decorators.find((e=>"AddToStory"==e.name))}return void 0===e.decorators.find((e=>"NoStory"==e.name))}if("all"==t){return void 0===e.decorators.find((e=>"NoStory"==e.name))}return!1}mergeClassInfo(e){for(let t of e.extends)this.extends.includes(t)||this.extends.push(t);for(let t of e.implements)this.implements.includes(t)||this.implements.push(t);this.methods={...e.methods,...this.methods},this.methodsStatic={...e.methodsStatic,...this.methodsStatic},this.properties={...e.properties,...this.properties},this.propertiesStatic={...e.propertiesStatic,...this.propertiesStatic}}}t.ClassInfo=p},74950:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DecoratorInfo=void 0;const r=n(94625),i=n(10604),s=n(25850),a=n(24964);class o{name="";content="";start=0;end=0;contentStart=0;contentEnd=0;arguments=[];baseInfo;constructor(e){this.baseInfo=e}static buildDecorator(e,t){let n=[];try{let a=(0,r.getDecorators)(e)||[];for(let e of a){let a=e.expression,c=new o(t);if(c.content="@"+a.getText(),a.kind===r.SyntaxKind.CallExpression){var l=a;c.name=l.expression.getText(),c.start=e.getStart(),c.end=e.getEnd(),c.contentStart=a.getStart(),c.contentEnd=a.getEnd(),t&&(t.compileTransformations[c.start+"_"+c.end]={newText:"",start:c.start,end:c.end});for(let e of l.arguments){let t=(0,s.getArg)(e);t&&c.arguments.push(t)}n.push(c)}else i.ParserTs.addError(e.getStart(),e.getEnd(),"Missing paramaters for Decorator")}}catch(e){a.GenericServer.showErrorMessage(e+"")}return n}}t.DecoratorInfo=o},76248:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionCorrector=void 0;const r=n(94625),i=n(65887);t.DefinitionCorrector=class{static allChanges=[];static currentElement;static correct(e,t){var n=(0,r.createSourceFile)("sample.ts",e,r.ScriptTarget.ESNext,!0);if(this.allChanges=[],t instanceof i.ClassInfo&&!this.currentElement){this.currentElement=t,(0,r.forEachChild)(n,(e=>{var n=e.kind===r.SyntaxKind.InterfaceDeclaration,i=e.kind===r.SyntaxKind.ClassDeclaration;if(n||i){var s=e;for(let e of t.decorators)"Debugger"!=e.name&&this.addChange(e.content+"\r\n",s.getStart(),s.getStart());if(s.typeParameters&&s.typeParameters.forEach((e=>{e.constraint&&this.correctType(e.constraint)})),s.heritageClauses)for(let e of s.heritageClauses)this.correctClassInheritance(e);(0,r.forEachChild)(s,(e=>{e.kind==r.SyntaxKind.Constructor||e.kind==r.SyntaxKind.MethodDeclaration?this.correctMethod(e):e.kind==r.SyntaxKind.PropertyDeclaration&&this.correctProperty(e)}))}})),this.allChanges.sort(((e,t)=>t.end-e.end));for(let t of this.allChanges)e=e.slice(0,t.start)+t.value+e.slice(t.end,e.length);this.currentElement=null}return e}static correctClassInheritance(e){e.token!=r.SyntaxKind.ExtendsKeyword&&e.token!=r.SyntaxKind.ImplementsKeyword||(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ExpressionWithTypeArguments&&this.correctType(e)}))}static correctMethod(e){e.type&&this.correctType(e.type),e.typeParameters&&e.typeParameters.forEach((e=>{e.constraint&&this.correctType(e.constraint)})),e.parameters.forEach((e=>{this.correctType(e.type)}))}static correctProperty(e){if(e.type&&this.correctType(e.type),this.currentElement&&this.currentElement.properties[e.name.getText()]){let t=this.currentElement.properties[e.name.getText()].decorators;for(let n of t)this.addChange(n.content+"\r\n\t",e.getStart(),e.getStart())}}static addChange(e,t,n){this.allChanges.push({start:t,end:n,value:e})}static addChangeType(e,t,n){if(this.currentElement){let r=this.currentElement.parserInfo.getBaseInfo(e);r&&e!=r.fullName&&this.addChange(r.fullName,t,n)}}static correctType(e){if(e)if(e.kind===r.SyntaxKind.TypeReference){var t=e;let n=this.parseQualified(t.typeName);n&&(this.addChangeType(n,t.getStart(),t.getEnd()),t.typeArguments&&t.typeArguments.forEach((e=>{this.correctType(e)})))}else if(e.kind===r.SyntaxKind.ArrayType){var n=e;this.correctType(n.elementType)}else if(e.kind===r.SyntaxKind.UnionType){var i=e;for(let e of i.types)this.correctType(e)}else if(e.kind===r.SyntaxKind.ExpressionWithTypeArguments){var s=e;let t=this.parseQualified2(s.expression);t&&(this.addChangeType(t,s.expression.getStart(),s.expression.getEnd()),s.typeArguments&&s.typeArguments.forEach((e=>{this.correctType(e)})))}}static parseQualified2(e){let t="";if(e.expression)if(e.expression.kind===r.SyntaxKind.PropertyAccessExpression){let n=this.parseQualified2(e.expression);n&&(t=n+".")}else e.expression.kind===r.SyntaxKind.Identifier&&(t=e.expression.text+".");return e.name?t+e.name.text:t+e.text}static parseQualified(e){if(e.kind===r.SyntaxKind.Identifier)return e.text;var t=e;return this.parseQualified(t.left)+"."+this.parseQualified(t.right)}}},80352:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentationInfo=void 0;const r=n(94625);t.DocumentationInfo=class{hasDoc=!1;definitions=[];documentationParameters={};documentationTemplates={};documentationSlots={};documentationReturn;fullDefinitions=[];constructor(e){if(e.jsDoc){this.hasDoc=!0;for(let t of e.jsDoc)if("string"==typeof t.comment&&(this.fullDefinitions.push(t.getText()),this.definitions.push(t.comment)),t.tags)for(let e of t.tags)if(this.fullDefinitions.push(e.getText()),e.kind==r.SyntaxKind.JSDocParameterTag){let t=e;"string"==typeof t.comment&&(this.documentationParameters[t.name.getText()]=t.comment)}else if(e.kind==r.SyntaxKind.JSDocReturnTag){let t=e;"string"==typeof t.comment&&(this.documentationReturn=t.comment)}else if(e.kind==r.SyntaxKind.JSDocTemplateTag){let t=e;if("string"==typeof t.comment)for(let e of t.typeParameters)this.documentationTemplates[e.name.getText()]=t.comment}else if(e.kind==r.SyntaxKind.JSDocTag){let t=e.getText().trim();if(t.startsWith("@slot")){const e=/@slot\s*([a-zA-z\-]*)\s*?(-|$)(.*)/gm.exec(t);if(e){let t=e[1];t||(t="default");let n=e[3];n&&(this.documentationSlots[t]=n)}}}}}}},25779:(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EnumInfo=void 0;const BaseInfo_1=__webpack_require__(90946),DocumentationInfo_1=__webpack_require__(80352);class EnumInfo extends BaseInfo_1.BaseInfo{node;constructor(e,t,n){super(e,t,n,!1),this.infoType=BaseInfo_1.InfoType.enum,this.node=e}defineStoryContent(){let result={kind:"enum",name:this.name,properties:[]};this.setNamespaceForStroy(result),this.setDocumentationForStroy(result),this.setAccessibilityForStroy(result);let inferredValue=0;for(let member of this.node.members){const propertyTemp={name:member.name.getText()};let value;member.initializer?(value=eval(member.initializer.getText()),inferredValue=value+1):value=inferredValue++,propertyTemp.value=value+"";let docTemp=new DocumentationInfo_1.DocumentationInfo(member);docTemp.hasDoc&&(propertyTemp.documentation=docTemp.definitions.join("\n")),result.properties.push(propertyTemp)}return result}}exports.EnumInfo=EnumInfo},43884:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FunctionInfo=void 0;const r=n(94625),i=n(90946),s=n(73218);class a extends i.BaseInfo{node;constructor(e,t,n){if(super(e,t,n),this.node=e,this.infoType=i.InfoType.function,e.typeParameters)for(let t of e.typeParameters)this.preventDependanceAdd(t.name.getText()),t.constraint&&this.addDependance(t.constraint,!0);for(let t of e.parameters)t.type&&this.addDependance(t.type,!1);(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.Block&&this.loadOnlyDependancesRecu(e,0,!1)}))}defineStoryContent(){let e={kind:"function",name:this.name};if(this.setNamespaceForStroy(e),this.setDocumentationForStroy(e),this.setAccessibilityForStroy(e),this.node.typeParameters){e.generics=[];for(let t of this.node.typeParameters)e.generics.push(this.loadGenericForStory(t))}if(this.node.parameters.length>0){e.parameters=[];for(let t of this.node.parameters)e.parameters.push(this.loadParameterForStory(t))}if(this.node.type){const t=new s.TypeInfo(this.node.type),n=this.transformTypeForStory(t,this);if(n){const t={type:n};this.documentation?.documentationReturn&&(t.documentation=this.documentation.documentationReturn),e.return=t}}return e}}t.FunctionInfo=a},82599:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportInfo=void 0;const r=n(94625),i=n(10604),s=n(42374),a=n(19408),o=n(1539),l=n(71017),c=n(83693),u=n(57147),p=n(72375),_=n(18952);class d{static Parse(e,t,n){if(e.importClause)if(e.importClause.namedBindings){if(e.importClause.namedBindings.kind==r.SyntaxKind.NamespaceImport){let i=e.moduleSpecifier.getText().replace(/"/g,"").replace(/'/g,"");if(i=n.build.project.resolveAlias(i,t),i.startsWith("."))n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("error can't use namespace import","\n")});else{let t=e.importClause.namedBindings.name.getText();e.importClause.isTypeOnly||(n.build.npmBuilder.register(n.document.uri,{libName:"*",uri:i,alias:t}),n.npmImports[t]={uri:i,nameInsideLib:"*"})}}else if(e.importClause.namedBindings.kind==r.SyntaxKind.NamedImports){let i=e.moduleSpecifier.getText().replace(/"/g,"").replace(/'/g,"");if(i=n.build.project.resolveAlias(i,t),i.startsWith("."))for(let t of e.importClause.namedBindings.elements)if(t.propertyName)n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("error can't use renamed import","\n")});else{let r=t.isTypeOnly||e.importClause.isTypeOnly;const s={parserInfo:n,moduleName:i,identifier:t.name,isTypeImport:r};let a=new d(s);n.importsLocal[a.name]=a}else if(!i.startsWith(".")&&i.includes(a.AventusExtension.Package))for(let t of e.importClause.namedBindings.elements)if(t.propertyName)n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("error can't use renamed import","\n")});else{let o=t.name.getText(),l=i.split(":");if(l.length>1){let e=l[1].replace(a.AventusExtension.Package,"")+"."+o;n.packages[o]={fullname:e}}else n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("The package import is malformated","\n")})}else for(let t of e.importClause.namedBindings.elements){let r=t.name.getText(),s=r;t.propertyName&&(s=t.propertyName.getText()),e.importClause.isTypeOnly||t.isTypeOnly||(n.build.npmBuilder.register(n.document.uri,{libName:s,uri:i,alias:r}),n.npmImports[r]={uri:i,nameInsideLib:s})}}}else if(e.importClause.name){let r=e.moduleSpecifier.getText().replace(/"/g,"").replace(/'/g,"");if(r=n.build.project.resolveAlias(r,t),r.startsWith(".")){const t={parserInfo:n,moduleName:r,identifier:e.importClause.name,isTypeImport:e.importClause.isTypeOnly};let i=new d(t);n.importsLocal[i.name]=i}else e.importClause.isTypeOnly||(n.build.npmBuilder.register(n.document.uri,{libName:"default",uri:r,alias:this.name}),n.npmImports[this.name]={uri:r,nameInsideLib:"default"})}}static ManualLocalImport(e,t,n){const r=e.parserInfo;let i=t.split(".").pop();if(!i)return;const s={parserInfo:e.parserInfo,name:i,moduleUri:n};let a=new d(s);if(r.manualImportLocal[a.name]){let e=0,t=i+e;for(;r.manualImportLocal[t];)e++,t=i+e;i=t,a.alias=i}return r.manualImportLocal[i]=a,a}nameStart=0;nameEnd=0;name="";info;realName;isTypeImport;alias;_parserInfo;get parserInfo(){return this._parserInfo}isCst1(e){return!!e.identifier}constructor(e){let t;if(this._parserInfo=e.parserInfo,this.isCst1(e)?(this.name=e.identifier.getText(),this.nameStart=e.identifier.getStart(),this.nameEnd=e.identifier.getEnd(),this.isTypeImport=e.isTypeImport,t=(0,o.pathToUri)((0,l.normalize)((0,o.getFolder)((0,o.uriToPath)(this.parserInfo.document.uri))+"/"+e.moduleName))):(this.name=e.name,this.nameStart=0,this.nameEnd=0,this.isTypeImport=!1,t=e.moduleUri),!i.ParserTs.parsedDoc[t]){let e=c.FilesManager.getInstance().getByUri(t);if(e)i.ParserTs.parse(e,!1,this.parserInfo.build);else{let e=(0,o.uriToPath)(t),n=(0,u.existsSync)(e)?(0,u.readFileSync)(e,"utf8"):"",r=new p.InternalAventusFile(_.TextDocument.create(t,a.AventusLanguageId.TypeScript,1,n));i.ParserTs.parse(r,!1,this.parserInfo.build)}}if(i.ParserTs.parsedDoc[t]?.result.isReady){let e=i.ParserTs.parsedDoc[t].result.getBaseInfo(this.name);e?this.info=e:i.ParserTs.addError(this.nameStart,this.nameEnd,"Can't load "+t+" "+this.name+" from "+this.parserInfo.document.uri)}else{if(this.parserInfo.waitingImports[this.name])return;this.parserInfo.waitingImports[this.name]=[],i.ParserTs.parsedDoc[t].result.onReady((()=>{this.asyncImportLocal(t,this.name)}))}}asyncImportLocal(e,t){let n=i.ParserTs.parsedDoc[e].result.getBaseInfo(t);if(n){this.info=n;let e=[this.parserInfo.classes,this.parserInfo.enums,this.parserInfo.aliases,this.parserInfo.functions,this.parserInfo.variables];for(let r of e)for(let e in r){let i=r[e];for(let e of i.dependances)"@external"==e.uri&&e.fullName==t&&(e.uri="@local",e.fullName="$namespace$"+n.fullName)}for(let e of this.parserInfo.waitingImports[t])e(n);delete this.parserInfo.waitingImports[t]}else i.ParserTs.addError(this.nameStart,this.nameEnd,"Can't load "+e+" "+t+" from "+this.parserInfo.document.uri)}}t.ImportInfo=d},46057:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MethodInfo=void 0;const r=n(94625),i=n(74950),s=n(10604),a=n(34385),o=n(90946),l=n(61698),c=n(80352);t.MethodInfo=class{fullStart=0;start=0;end=0;name="";nameStart=0;nameEnd=0;content="";documentation;decorators=[];_class;accessibilityModifierTransformation;mustBeCompiled=!0;isStatic=!1;isOverride=!1;isAbstract=!1;isPrivate=!1;isProtected=!1;node;get compiledContent(){return o.BaseInfo.getContent(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentHotReload(){return o.BaseInfo.getContentHotReload(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentNpm(){return o.BaseInfo.getContentNpm(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}constructor(e,t){this.node=e,this._class=t,this.fullStart=e.getFullStart(),this.start=e.getStart(),this.end=e.getEnd(),this.name=e.name.getText(),this.nameStart=e.name.getStart(),this.nameEnd=e.name.getEnd(),this.content=e.getText(),this.decorators=i.DecoratorInfo.buildDecorator(e,t);let n=new c.DocumentationInfo(e);n.hasDoc&&(this.documentation=n),this.loadAccessibilityModifier(e);for(let e of this.decorators)if(l.NoCompileDecorator.is(e)){this.mustBeCompiled=!1;break}}loadAccessibilityModifier(e){let t=!1,n=null;for(let e of this.decorators){let t=a.InternalDecorator.is(e);if(t){n=t;break}let r=a.InternalProtectedDecorator.is(e);if(r){n=r;break}}if(e.modifiers)for(let i of e.modifiers)if(i.kind==r.SyntaxKind.PublicKeyword){if(n){let e=n instanceof a.InternalDecorator?"private":"protected";this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:e},"private"==e?this.isPrivate=!0:"protected"==e&&(this.isProtected=!0)}t=!0}else i.kind==r.SyntaxKind.ProtectedKeyword?(n instanceof a.InternalDecorator?(this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:"private"},this.isPrivate=!0):this.isProtected=!0,t=!0):i.kind==r.SyntaxKind.PrivateKeyword?(t=!0,this.isPrivate=!0):i.kind==r.SyntaxKind.OverrideKeyword?this.isOverride=!0:i.kind==r.SyntaxKind.StaticKeyword?this.isStatic=!0:i.kind==r.SyntaxKind.AbstractKeyword&&(this.isAbstract=!0);this.documentation||this.isOverride||this.isPrivate||s.ParserTs.addWarning(this.nameStart,this.nameEnd,"You should add documentation for "+this.name),!1!==t||this._class.isInterface||s.ParserTs.addError(this.nameStart,this.nameEnd,"A accessibility modifier (public / private / protected) is mandatory for "+this.name)}}},10278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NamespaceInfo=void 0;t.NamespaceInfo=class{start=0;end=0;name="";bodyStart=0;bodyEnd=0;constructor(e){this.name=e.name.getText(),this.start=e.getStart(),this.end=e.getEnd(),e.body&&(this.bodyStart=e.body.getStart()+1,this.bodyEnd=e.body.getEnd()-1)}}},10604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParserTs=void 0;const r=n(94625),i=n(42374),s=n(19408),a=n(99071),o=n(90946),l=n(65887),c=n(25779),u=n(10278),p=n(25850),_=n(43884),d=n(89403),h=n(82599);class f{static waitingUri={};static parsedDoc={};static parse(e,t,n){return f.parsedDoc[e.uri]&&this.parsedDoc[e.uri].version==e.versionInternal?this.parsedDoc[e.uri].result:(new f(e,t,n),f.parsedDoc[e.uri].result)}static parsingDocs=[];static get currentParsingDoc(){return this.parsingDocs.length>0?this.parsingDocs[this.parsingDocs.length-1]:null}static addError(e,t,n){if(this.currentParsingDoc&&!this.currentParsingDoc.isLib){let a={range:i.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:i.DiagnosticSeverity.Error,source:s.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)(n,"\n")};this.currentParsingDoc.errors.push(a)}}static addWarning(e,t,n){if(this.currentParsingDoc&&!this.currentParsingDoc.isLib){let a={range:i.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:i.DiagnosticSeverity.Warning,source:s.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)(n,"\n")};this.currentParsingDoc.errors.push(a)}}static getBaseInfo(e){for(let t in this.parsedDoc){let n=this.parsedDoc[t].result.getBaseInfo(e);if(n)return n}return null}static hasImport(e){return!!f.currentParsingDoc&&(!!f.currentParsingDoc.importsLocal[e]||(!!f.currentParsingDoc.waitingImports[e]||(!!f.currentParsingDoc.npmImports[e]||!!f.currentParsingDoc.packages[e])))}static hasLocal(e){return!!f.currentParsingDoc&&!!f.currentParsingDoc.internalObjects[e]}content;errors=[];_document;get document(){return this._document}currentNamespace=[];namespaces=[];classes={};functions={};enums={};importsLocal={};manualImportLocal={};packages={};npmImports={};npmGeneratedImport={};internalObjects={};waitingImports={};aliases={};variables={};isLib=!1;isReady=!1;build;file;srcFile;npmAliases={};constructor(e,t,n){this.build=n,this.build.npmBuilder.unregister(e.documentUser.uri),this.file=e,f.parsedDoc[e.uri]={version:e.versionInternal,result:this},f.parsingDocs.push(this),this.content=e.documentInternal.getText(),this._document=e.documentInternal,this.isLib=t;let i=(0,r.createSourceFile)("sample.ts",this.content,r.ScriptTarget.ESNext,!0);this.srcFile=i,this.quickLoadRoot(i),this.loadRoot(i),f.parsingDocs.pop(),this.isReady=!0;for(let e of this.readyCb)e();if(this.readyCb=[],f.waitingUri[e.uri]){for(let t of f.waitingUri[e.uri])t();delete f.waitingUri[e.uri]}}readyCb=[];onReady(e){this.isReady||this.readyCb.push(e)}quickLoadRoot(e){(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.ModuleDeclaration){let t=e;(0,p.hasFlag)(t.flags,r.NodeFlags.Namespace)&&t.body?(this.currentNamespace.push(t.name.getText()),this.quickLoadRoot(t),this.currentNamespace.splice(this.currentNamespace.length-1,1)):(0,p.hasFlag)(t.flags,r.NodeFlags.GlobalAugmentation)&&t.body&&this.quickLoadRoot(t)}else if(e.kind==r.SyntaxKind.ClassDeclaration||e.kind==r.SyntaxKind.InterfaceDeclaration){let t=e;if(t.name){let n=t.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:e.kind==r.SyntaxKind.ClassDeclaration}}}else if(e.kind==r.SyntaxKind.EnumDeclaration){let t=e,n=t.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!0}}else if(e.kind==r.SyntaxKind.TypeAliasDeclaration){let t=e,n=t.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!1}}else if(e.kind==r.SyntaxKind.FunctionDeclaration){let t=e;if(t.name){let e=t.name.getText();this.internalObjects[e]={fullname:[...this.currentNamespace,e].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!0}}}else if(e.kind==r.SyntaxKind.VariableStatement){let t=e;for(let e of t.declarationList.declarations)if(e.kind==r.SyntaxKind.VariableDeclaration){let n=e.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!0}}}else e.kind==r.SyntaxKind.ModuleBlock&&this.quickLoadRoot(e)}))}loadRoot(e){(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ImportDeclaration?this.loadImport(e):e.kind==r.SyntaxKind.ModuleDeclaration?this.loadNamespace(e):e.kind==r.SyntaxKind.ClassDeclaration||e.kind==r.SyntaxKind.InterfaceDeclaration?this.loadClass(e):e.kind==r.SyntaxKind.EnumDeclaration?this.loadEnum(e):e.kind==r.SyntaxKind.TypeAliasDeclaration?this.loadAlias(e):e.kind==r.SyntaxKind.FunctionDeclaration?this.loadFunction(e):e.kind==r.SyntaxKind.VariableStatement?this.loadVariableStatement(e):e.kind==r.SyntaxKind.ModuleBlock?this.loadRoot(e):(e.kind,r.SyntaxKind.EndOfFileToken)}))}loadImport(e){h.ImportInfo.Parse(e,this.file,this)}loadNamespace(e){(0,p.hasFlag)(e.flags,r.NodeFlags.Namespace)&&e.body?(this.namespaces.push(new u.NamespaceInfo(e)),this.currentNamespace.push(e.name.getText()),this.loadRoot(e),this.currentNamespace.splice(this.currentNamespace.length-1,1)):(0,p.hasFlag)(e.flags,r.NodeFlags.GlobalAugmentation)&&e.body?this.loadRoot(e):this.errors.push({range:i.Range.create(this.document.positionAt(e.getStart()),this.document.positionAt(e.getEnd())),severity:i.DiagnosticSeverity.Error,source:s.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("Can't use a module, use namespace instead","\n")})}loadClass(e){if(e.name){let t=new l.ClassInfo(e,this.currentNamespace,this);this.classes[t.name]?t.isInterface?this.classes[t.name].mergeClassInfo(t):(t.mergeClassInfo(this.classes[t.name]),this.classes[t.name]=t):this.classes[t.name]=t,this.defineStorie(this.classes[t.name])}}loadFunction(e){if(e.name){let t=new _.FunctionInfo(e,this.currentNamespace,this);this.defineStorie(t),this.functions[t.name]=t}}loadEnum(e){let t=new c.EnumInfo(e,this.currentNamespace,this);this.defineStorie(t),this.enums[t.name]=t}loadAlias(e){let t=new a.AliasInfo(e,this.currentNamespace,this);this.defineStorie(t),this.aliases[t.name]=t}loadVariableStatement(e){o.BaseInfo.isExported(e);for(let t of e.declarationList.declarations)t.kind==r.SyntaxKind.VariableDeclaration&&(t.jsDoc=e.jsDoc,this.loadVariable(t,e))}loadVariable(e,t){let n=new d.VariableInfo(e,this.currentNamespace,this,t);this.defineStorie(n),this.variables[n.name]=n}defineStorie(e){e.loadStorieContent()}getBaseInfo(e){return this.classes[e]?this.classes[e]:this.aliases[e]?this.aliases[e]:this.enums[e]?this.enums[e]:this.functions[e]?this.functions[e]:this.variables[e]?this.variables[e]:null}getBaseInfoFullName(e){const t=e.split(".").pop()??e;return this.getBaseInfo(t)}registerGeneratedImport(e){if(!this.build.hasNpmOutput)return;const{uri:t,name:n,compiled:r,alias:i,onlySrc:s,nameAlias:a,forced:o}=e,l=n==i?void 0:i;if(this.npmGeneratedImport[t]){-1==this.npmGeneratedImport[t].findIndex((e=>e.name==n))&&this.npmGeneratedImport[t].push({name:n,nameAlias:a,compiled:r,alias:l,onlySrc:s,forced:o})}else this.npmGeneratedImport[t]=[{name:n,nameAlias:a,compiled:r,alias:l,onlySrc:s,forced:o}]}getNpmReplacementName(e,t){return this.build.getNpmReplacementName(e,t)}}t.ParserTs=f},37559:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PropertyInfo=void 0;const r=n(94625),i=n(74950),s=n(10604),a=n(73218),o=n(34385),l=n(90946),c=n(80352),u=n(95396);t.PropertyInfo=class{name="";nameStart=0;nameEnd=0;documentation;decorators=[];defaultValueTxt=null;defaultValueStart=0;defaultValueEnd=0;content="";type;prop;isAbstract=!1;isGet=!1;isSet=!1;isGetSet=!1;isInsideInterface=!1;isStatic=!1;isProtected=!1;isPrivate=!1;isOverride=!1;start=0;end=0;isNullable=!1;overrideNullable=!1;_class;accessibilityModifierTransformation;get compiledContent(){return l.BaseInfo.getContent(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentHotReload(){return l.BaseInfo.getContentHotReload(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentNpm(){return l.BaseInfo.getContentNpm(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get defaultValue(){return null===this.defaultValueTxt?null:l.BaseInfo.getContent(this.defaultValueTxt,this.defaultValueStart,this.defaultValueEnd,this._class.dependancesLocations,this._class.compileTransformations)}get defaultValueHotReload(){return null===this.defaultValueTxt?null:l.BaseInfo.getContentHotReload(this.defaultValueTxt,this.defaultValueStart,this.defaultValueEnd,this._class.dependancesLocations,this._class.compileTransformations)}get defaultValueNpm(){return null===this.defaultValueTxt?null:l.BaseInfo.getContentNpm(this.defaultValueTxt,this.defaultValueStart,this.defaultValueEnd,this._class.dependancesLocations,this._class.compileTransformations)}defaultValueStory=null;constructor(e,t,n){this.isInsideInterface=t,this._class=n,this.prop=e,this.name=e.name.getText(),this.nameStart=e.name.getStart(),this.nameEnd=e.name.getEnd(),this.start=e.getStart(),this.end=e.getEnd(),this.content=e.getText(),this.decorators=i.DecoratorInfo.buildDecorator(e,n),e.kind==r.SyntaxKind.GetAccessor?this.isGet=!0:e.kind==r.SyntaxKind.SetAccessor?this.isSet=!0:this.isGetSet=!0;let s=new c.DocumentationInfo(e);s.hasDoc&&(this.documentation=s),e.questionToken&&(this.isNullable=!0),e.exclamationToken&&(this.overrideNullable=!0),this.loadAccessibilityModifier(e),this.type=this.loadType(e),this.loadInitializer(e);for(let e of this.decorators){let t=u.StoryValueDecorator.is(e);t&&(this.defaultValueStory=t.value)}}loadAccessibilityModifier(e){if(this.isInsideInterface)return;let t=!1,n=null;for(let e of this.decorators){let t=o.InternalDecorator.is(e);if(t){n=t;break}let r=o.InternalProtectedDecorator.is(e);if(r){n=r;break}}if(e.modifiers)for(let i of e.modifiers)if(i.kind==r.SyntaxKind.PublicKeyword){if(n){let e=n instanceof o.InternalDecorator?"private":"protected";this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:e},"private"==e?this.isPrivate=!0:"protected"==e&&(this.isProtected=!0)}t=!0}else i.kind==r.SyntaxKind.ProtectedKeyword?(n instanceof o.InternalDecorator?(this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:"private"},this.isPrivate=!0):this.isProtected=!0,t=!0):i.kind==r.SyntaxKind.PrivateKeyword?(t=!0,this.isPrivate=!0):i.kind==r.SyntaxKind.AbstractKeyword?this.isAbstract=!0:i.kind==r.SyntaxKind.OverrideKeyword?this.isOverride=!0:i.kind==r.SyntaxKind.StaticKeyword&&(this.isStatic=!0);this.documentation||this.isOverride||this.isPrivate||s.ParserTs.addWarning(this.nameStart,this.nameEnd,"You should add documentation for "+this.name),!1===t&&s.ParserTs.addError(e.getStart(),e.getEnd(),"A accessibility modifier (public / private / protected) is mandatory for "+this.name)}loadType(e){let t,n=e;return t=n.type?new a.TypeInfo(n.type):n.initializer&&n.initializer.kind==r.SyntaxKind.ExpressionWithTypeArguments?new a.TypeInfo(n.initializer):new a.TypeInfo(null),t}loadInitializer(e){let t=e;t.initializer&&(this.defaultValueTxt=t.initializer.getText(),this.defaultValueStart=t.initializer.getStart(),this.defaultValueEnd=t.initializer.getEnd())}}},73218:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeInfo=void 0;const r=n(94625);class i{kind="mock";value="";isArray=!1;genericValue=[];nested=[];start=0;end=0;endNonGeneric=0;fctType;conditionalType;mappedType;node;constructor(e){if(e)if(this.node=e,this.start=e.getStart(),this.end=e.getEnd(),this.endNonGeneric=this.end,e.kind==r.SyntaxKind.StringKeyword)this.kind="string";else if(e.kind===r.SyntaxKind.NumberKeyword)this.kind="number";else if(e.kind===r.SyntaxKind.BooleanKeyword)this.kind="boolean";else if(e.kind===r.SyntaxKind.NullKeyword)this.kind="null";else if(e.kind===r.SyntaxKind.UndefinedKeyword)this.kind="undefined";else if(e.kind===r.SyntaxKind.AnyKeyword)this.kind="any";else if(e.kind===r.SyntaxKind.NeverKeyword)this.kind="never";else if(e.kind===r.SyntaxKind.VoidKeyword)this.kind="void";else if(e.kind===r.SyntaxKind.UnknownKeyword)this.kind="unknown";else if(e.kind===r.SyntaxKind.ObjectKeyword)this.kind="object";else if(e.kind===r.SyntaxKind.SymbolKeyword)this.kind="symbol";else if(e.kind===r.SyntaxKind.ThisType)this.kind="this";else if(e.kind===r.SyntaxKind.LiteralType)this.kind="literal",this.value=e.literal.getText();else if(e.kind===r.SyntaxKind.TypeReference){this.kind="type";let t=e;if(this.value=t.typeName.getText(),this.endNonGeneric=t.typeName.end,"const"==this.value)return this.value="",void(this.kind="mock");if(t.typeArguments)for(let e of t.typeArguments)this.genericValue.push(new i(e))}else if(e.kind===r.SyntaxKind.ArrayType){let t=e;this.isArray=!0;let n=new i(t.elementType);this.genericValue=n.genericValue,this.nested=n.nested,this.kind=n.kind,this.value=n.value,this.endNonGeneric=n.endNonGeneric}else if(e.kind===r.SyntaxKind.UnionType){let t=e;this.kind="union";for(let e of t.types)this.nested.push(new i(e))}else if(e.kind===r.SyntaxKind.IntersectionType){let t=e;this.kind="intersection";for(let e of t.types)this.nested.push(new i(e))}else if(e.kind===r.SyntaxKind.TypeOperator){let t=e;this.kind="typeOperator",t.operator==r.SyntaxKind.KeyOfKeyword?this.value="keyof":t.operator==r.SyntaxKind.UniqueKeyword?this.value="unique":t.operator==r.SyntaxKind.ReadonlyKeyword&&(this.value="readonly"),this.nested.push(new i(t.type))}else if(e.kind==r.SyntaxKind.TypeQuery){let t=e;this.kind="typeOperator",this.value="typeof";let n=new i(null);n.kind="type",n.value=t.exprName.getText(),this.nested.push(n)}else if(e.kind===r.SyntaxKind.ExpressionWithTypeArguments){let t=e;if(this.kind="type",this.value=t.expression.getText(),this.endNonGeneric=t.expression.getEnd(),t.typeArguments)for(let e of t.typeArguments)this.genericValue.push(new i(e))}else if(e.kind===r.SyntaxKind.TypeLiteral){let t=e;this.kind="typeLiteral",this.value=t.getText();for(let e of t.members)if(e.kind==r.SyntaxKind.IndexSignature){let t=e;this.nested.push(new i(t.type))}else if(e.kind==r.SyntaxKind.PropertySignature){let t=e;t.type&&this.nested.push(new i(t.type))}}else if(e.kind==r.SyntaxKind.ParenthesizedType){let t=new i(e.type);this.genericValue=t.genericValue,this.nested=t.nested,this.kind=t.kind,this.value=t.value,this.isArray=t.isArray,this.endNonGeneric=t.endNonGeneric}else if(e.kind==r.SyntaxKind.ConstructorType){let t=e;this.kind="constructor",this.value=e.getText();const n={};for(let e of t.parameters)if(e.type){const t=new i(e.type);n[e.name.getText()]=t,this.nested.push(t)}this.fctType={return:new i(t.type),parameters:n},this.nested.push(this.fctType.return)}else if(e.kind==r.SyntaxKind.FunctionType){let t=e;this.kind="function",this.value=e.getText();const n={};for(let e of t.parameters)if(e.type){const t=new i(e.type);n[e.name.getText()]=t,this.nested.push(t)}this.fctType={return:new i(t.type),parameters:n},this.nested.push(this.fctType.return)}else if(e.kind==r.SyntaxKind.TupleType){let t=e;this.kind="tuple";for(let e of t.elements)this.nested.push(new i(e))}else if(e.kind==r.SyntaxKind.ConditionalType){let t=e;this.kind="conditional",this.conditionalType={check:new i(t.checkType),extends:new i(t.extendsType),false:new i(t.falseType),true:new i(t.trueType)}}else if(e.kind==r.SyntaxKind.MappedType){this.kind="mappedType";let t=e;t.type&&t.typeParameter.constraint?(t.questionToken,this.mappedType={parameterName:t.typeParameter.name.getText(),parameterType:new i(t.typeParameter.constraint),type:new i(t.type)},t.questionToken?.kind==r.SyntaxKind.QuestionToken?this.mappedType.modifier="?":t.questionToken?.kind==r.SyntaxKind.PlusToken?this.mappedType.modifier="+":t.questionToken?.kind==r.SyntaxKind.MinusToken&&(this.mappedType.modifier="-")):console.log("you must add the new type : MappedType like "+e.getText())}else if(e.kind==r.SyntaxKind.IndexedAccessType){this.kind="indexedAccess";let t=e;this.nested.push(new i(t.objectType)),this.nested.push(new i(t.indexType))}else if(e.kind==r.SyntaxKind.InferType){let t=e;this.kind="infer",this.value=t.typeParameter.name.getText()}else{e.kind,e.getText()}else this.kind="notype"}}t.TypeInfo=i},89403:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VariableInfo=t.VariableInfoType=void 0;const r=n(94625),i=n(90946),s=n(73218),a=n(34385),o=n(74950);var l;!function(e){e.var="var",e.let="let",e.const="const"}(l||(t.VariableInfoType=l={}));class c extends i.BaseInfo{type=l.var;node;constructor(e,t,n,s){super(e,t,n),this.decorators=o.DecoratorInfo.buildDecorator(s,this),this.node=e,this.infoType=i.InfoType.variable,e.parent.flags==r.NodeFlags.Let?this.type=l.let:e.parent.flags==r.NodeFlags.Const&&(this.type=l.const),this.isExported=i.BaseInfo.isExported(s),this.isInternalExported=this.isExported;for(let e of this.decorators){if(a.InternalDecorator.is(e)){this.isExported=!1;break}}this.loadOnlyDependancesRecu(e,0,!0)}defineStoryContent(){let e={kind:"variable",name:this.name,modifier:this.type==l.const?"const":this.type==l.let?"let":"var"};if(this.setNamespaceForStroy(e),this.setDocumentationForStroy(e),this.setAccessibilityForStroy(e),this.node.type){const t=new s.TypeInfo(this.node.type),n=this.transformTypeForStory(t,this);n&&(e.type=n)}return e}}t.VariableInfo=c},92724:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindThisDecorator=void 0;class n{static is(e){if("BindThis"==e.name){return new n}return null}}t.BindThisDecorator=n},66145:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConvertibleDecorator=void 0;class n{name="Fullname";static is(e){if("Convertible"==e.name){let t=new n;if(e.arguments.length>0)try{t.name=e.arguments[0].value}catch(e){}return t}return null}}t.ConvertibleDecorator=n},50789:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DebuggerDecorator=void 0;class n{writeCompiled=!1;enableWatchHistory=!1;writeHTML=!1;writeComponentTs=!1;static is(e){if("Debugger"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);t.writeCompiled=1==n.writeCompiled,t.enableWatchHistory=1==n.enableWatchHistory,t.writeHTML=1==n.writeHTML,t.writeComponentTs=1==n.writeComponentTs}catch(e){}return t}return null}}t.DebuggerDecorator=n},17509:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultStateParser=t.DefaultStateActiveDecorator=void 0;class n{managerName="";static is(e){if("DefaultStateActive"==e.name){let t=new n;if(e.arguments.length>0)try{let n=r.parse(e);t.managerName=n.managerName}catch(e){}return t}return null}}t.DefaultStateActiveDecorator=n;class r{static parse(e){let t={managerName:""};try{let n=e.arguments[0].value;const r=e.baseInfo?.dependancesLocations[n]?.replacement;r&&(n=r),t.managerName=n}catch(e){}return t}}t.DefaultStateParser=r},49507:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultStateInactiveDecorator=void 0;const r=n(17509);class i{managerName="";static is(e){if("DefaultStateInactive"==e.name){let t=new i;if(e.arguments.length>0)try{let n=r.DefaultStateParser.parse(e);t.managerName=n.managerName}catch(e){}return t}return null}}t.DefaultStateInactiveDecorator=i},84900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DependancesDecorator=void 0;class n{dependances=[];static is(e){if("Dependances"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);for(let e of n){let n=1==e.strong;t.dependances.push({type:e.type,strong:n})}}catch(e){}return t}return null}}t.DependancesDecorator=n},51907:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EffectDecorator=void 0;class n{options={autoInit:!0};static is(e){if("Effect"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);void 0!==n.autoInit&&(t.options.autoInit=n.autoInit)}catch(e){}return t}return null}}t.EffectDecorator=n},71159:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForeignKeyDecorator=void 0;class n{refType="";constructor(e){this.refType=e}static is(e){if("ForeignKey"==e.name&&e.arguments.length>0)try{if("identifier"==e.arguments[0].type){return new n(e.arguments[0].value)}}catch(e){}return null}}t.ForeignKeyDecorator=n},34385:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalProtectedDecorator=t.InternalDecorator=void 0;class n{static is(e){if("Internal"==e.name){return new n}return null}}t.InternalDecorator=n;class r{static is(e){if("InternalProtected"==e.name){return new r}return null}}t.InternalProtectedDecorator=r},61698:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoCompileDecorator=void 0;class n{static is(e){if("NoCompile"==e.name){return new n}return null}}t.NoCompileDecorator=n},91430:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverrideViewDecorator=void 0;class n{removeViewVariables=[];static is(e){if("OverrideView"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);n.removeViewVariables&&(t.removeViewVariables=n.removeViewVariables)}catch(e){}return t}return null}}t.OverrideViewDecorator=n},14710:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PropertyDecorator=void 0;class n{fctTxt=null;static is(e){if("Property"==e.name){let t=new n;if(e.arguments.length>0)try{"call"==e.arguments[0].type&&(t.fctTxt=e.arguments[0].value)}catch(e){}return t}return null}}t.PropertyDecorator=n},48117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredDecorator=void 0;class n{static is(e){if("Required"==e.name){return new n}return null}}t.RequiredDecorator=n},66450:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SignalDecorator=void 0;class n{fctTxt=null;static is(e){if("Signal"==e.name){let t=new n;if(e.arguments.length>0)try{"call"==e.arguments[0].type&&(t.fctTxt=e.arguments[0].value)}catch(e){}return t}return null}}t.SignalDecorator=n},72471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateParser=t.StateActiveDecorator=void 0;class n{stateName="";managerName="";functionName="active";static is(e){if("StateActive"==e.name){let t=new n;if(e.arguments.length>0)try{let n=r.parse(e);t.stateName=n.stateName,t.managerName=n.managerName??""}catch(e){}return t}return null}}t.StateActiveDecorator=n;class r{static parse(e){let t={stateName:""};try{let n=e.arguments[0].value;if("identifier"==e.arguments[0].type){let t=e.arguments[0].value.split(".");const r=e.baseInfo?.dependancesLocations[t[0]]?.replacement;r&&(t[0]=r),n=t.join(".")}if(t.stateName=n,e.arguments.length>1){let n=e.arguments[1].value;const r=e.baseInfo?.dependancesLocations[n]?.replacement;r&&(n=r),t.managerName=n}}catch(e){}return t}}t.StateParser=r},89018:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateChangeDecorator=void 0;const r=n(72471);class i{stateName="";managerName="";functionName="askChange";static is(e){if("StateChange"==e.name){let t=new i;if(e.arguments.length>0)try{let n=r.StateParser.parse(e);t.stateName=n.stateName,t.managerName=n.managerName??""}catch(e){}return t}return null}}t.StateChangeDecorator=i},91562:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateInactiveDecorator=void 0;const r=n(72471);class i{stateName="";managerName="";functionName="inactive";static is(e){if("StateInactive"==e.name){let t=new i;if(e.arguments.length>0)try{let n=r.StateParser.parse(e);t.stateName=n.stateName,t.managerName=n.managerName??""}catch(e){}return t}return null}}t.StateInactiveDecorator=i},95396:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoryValueDecorator=void 0;class n{static is(e){if("StoryValue"==e.name){if(e.arguments.length>0){let t=e.arguments[0].value;return new n(t)}return null}return null}value;constructor(e){this.value=e}}t.StoryValueDecorator=n},57315:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StorybookDecorator=void 0;class n{prefix;exportType;noLive;noDefaultStory;group;slots;static is(e){if("Storybook"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);if(n.prefix&&(t.prefix=n.prefix.replace(/(^('|"))|(('|")$)/g,"")),n.export&&(t.exportType=n.export.replace(/(^('|"))|(('|")$)/g,"")),n.group&&(t.group=n.group.replace(/(^('|"))|(('|")$)/g,"")),!0===n.noLive&&(t.noLive=!0),!0===n.noDefaultStory&&(t.noDefaultStory=!0),n.slots){if(t.slots={},n.slots.values){t.slots.values={};for(let e in n.slots.values)t.slots.values[e.replace(/(^('|"))|(('|")$)/g,"")]=n.slots.values[e]}n.slots.inject&&(t.slots.inject=n.slots.inject)}}catch(e){}return t}return null}}t.StorybookDecorator=n},95553:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagNameDecorator=void 0;class n{tagName="";static is(e){if("TagName"==e.name){let t=new n;return e.arguments.length>0&&(t.tagName=e.arguments[0].value),t}return null}}t.TagNameDecorator=n},55969:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ViewElementDecorator=void 0;class n{useLive=void 0;static is(e){if("ViewElement"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);!0===n.useLive?t.useLive=!0:!1===n.useLive&&(t.useLive=!1)}catch(e){}return t}return null}}t.ViewElementDecorator=n},29383:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WatchDecorator=void 0;class n{fctTxt=null;static is(e){if("Watch"==e.name){let t=new n;if(e.arguments.length>0)try{"call"==e.arguments[0].type&&(t.fctTxt=e.arguments[0].value)}catch(e){}return t}return null}}t.WatchDecorator=n},25850:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasFlag=function(e,t){return 0!=(e&t)},t.buildJSON=i,t.getArg=function(e){if(e.kind==r.SyntaxKind.StringLiteral)return{type:"string",value:e.getText()};if(e.kind==r.SyntaxKind.NoSubstitutionTemplateLiteral)return{type:"string",value:e.getText()};if(e.kind==r.SyntaxKind.NumericLiteral)return{type:"number",value:e.getText()};if(e.kind==r.SyntaxKind.FalseKeyword)return{type:"boolean",value:"false"};if(e.kind==r.SyntaxKind.TrueKeyword)return{type:"boolean",value:"true"};if(e.kind==r.SyntaxKind.ObjectLiteralExpression)return{type:"object",value:i(e)};if(e.kind==r.SyntaxKind.ArrayLiteralExpression)return{type:"array",value:i(e)};if(e.kind==r.SyntaxKind.Identifier)return{type:"identifier",value:e.getText()};if(e.kind==r.SyntaxKind.CallExpression||e.kind==r.SyntaxKind.ArrowFunction||e.kind==r.SyntaxKind.FunctionExpression)return{type:"call",value:e.getText()};if(e.kind==r.SyntaxKind.PropertyAccessExpression)return{type:"identifier",value:e.getText()};return null};const r=n(94625);function i(e,t=null){if(e.kind==r.SyntaxKind.ObjectLiteralExpression){null==t&&(t={});for(let n of e.properties)if(n.kind==r.SyntaxKind.PropertyAssignment)if(n.initializer.kind==r.SyntaxKind.StringLiteral)t[n.name.getText()]=n.initializer.getText();else if(n.initializer.kind==r.SyntaxKind.NoSubstitutionTemplateLiteral)t[n.name.getText()]=n.initializer.getText();else if(n.initializer.kind==r.SyntaxKind.NumericLiteral)t[n.name.getText()]=Number(n.initializer.getText());else if(n.initializer.kind==r.SyntaxKind.FalseKeyword)t[n.name.getText()]=!1;else if(n.initializer.kind==r.SyntaxKind.TrueKeyword)t[n.name.getText()]=!0;else if(n.initializer.kind==r.SyntaxKind.Identifier)t[n.name.getText()]=n.initializer.getText();else if(n.initializer.kind==r.SyntaxKind.ObjectLiteralExpression){let e={};i(n.initializer,e),t[n.name.getText()]=e}else if(n.initializer.kind==r.SyntaxKind.ArrayLiteralExpression){let e=[];i(n.initializer,e),t[n.name.getText()]=e}}else if(e.kind==r.SyntaxKind.ArrayLiteralExpression){null==t&&(t=[]);for(let n of e.elements)if(n.kind==r.SyntaxKind.StringLiteral)t.push(n.getText());else if(n.kind==r.SyntaxKind.NoSubstitutionTemplateLiteral)t.push(n.getText());else if(n.kind==r.SyntaxKind.NumericLiteral)t.push(Number(n.getText()));else if(n.kind==r.SyntaxKind.FalseKeyword)t.push(!1);else if(n.kind==r.SyntaxKind.TrueKeyword)t.push(!0);else if(n.kind==r.SyntaxKind.ObjectLiteralExpression){let e={};i(n,e),t.push(e)}else if(n.kind==r.SyntaxKind.ArrayLiteralExpression){let e=[];i(n,e),t.push(e)}else n.kind==r.SyntaxKind.Identifier&&t.push(n.getText())}return JSON.stringify(t)}},7304:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusRamFile=void 0;const r=n(19408),i=n(6045),s=n(54145);class a extends s.AventusTsFile{get extension(){return r.AventusExtension.RAM}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){return this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.build.isCoreBuild?this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["IRam"]}):this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["Aventus.IRam"]}),this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,i.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}onFormatting(e,t,n){return this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusRamFile=a},98060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusStateFile=void 0;const r=n(19408),i=n(6045),s=n(54145);class a extends s.AventusTsFile{get extension(){return r.AventusExtension.State}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){this.file.documentUser;return this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.build.isCoreBuild?this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["IStateManager","IState"]}):this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["Aventus.IStateManager","Aventus.IState"]}),this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,i.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return await this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusStateFile=a},76578:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusStaticFile=void 0;const r=n(57147),i=n(19408),s=n(54145),a=n(90946),o=n(6113);class l extends s.AventusTsFile{get extension(){return i.AventusExtension.Static}mustBeAddedToLanguageService(){return!1}async onValidate(){return[]}async onContentChange(){}async onSave(){let e=this.file.path,t=e.replace(this.extension,i.AventusExtension.Definition),n="",s="";t.endsWith(i.AventusExtension.Definition)&&(0,r.existsSync)(t)&&(n=(0,r.readFileSync)(t,"utf8").replace(/declare global \{((\s|\S)*)\}/gm,"$1"));let l=e.replace(this.extension,i.AventusExtension.DefinitionNpm);s=l.endsWith(i.AventusExtension.DefinitionNpm)&&(0,r.existsSync)(l)?(0,r.readFileSync)(l,"utf8"):n;let c=(0,o.createHash)("md5").update(e+this.file.contentUser).digest("hex"),u=this.file.path.replace(this.build.project.getConfigFile().path.replace(i.AventusExtension.Config,""),"");u=u.replace(this.extension,".js"),this.setCompileResult([{classDoc:"",classScript:"!staticClass_"+c,compiled:this.file.contentUser,hotReload:"",docVisible:n,npm:{namespace:"",defTs:s,src:this.file.contentUser,exportPath:u,uri:this.file.uri},docInvisible:"",debugTxt:"",dependances:[],uri:this.file.uri,required:!0,type:a.InfoType.none,isExported:{external:!1,internal:!1},convertibleName:"",story:{}}])}async onCompletion(e,t){return{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return null}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.AventusStaticFile=l},60206:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpServer=void 0;const r=n(91385),i=n(68633),s=n(57310),a=n(13685),o=n(41808),l=n(71017),c=n(57147),u=n(44131),p=n(45497),_=n(2685),d=n(89398),h=n(97750),f=n(93035),m=n(31814),g=n(29495),y=n(24964);class v{static instance;static getInstance(){return this.instance||(this.instance=new v),this.instance}static get isRunning(){return!(!this.instance?.server||!this.instance.server.listening)}config;server;wss;reloadTimeout;clients=[];port=8080;constructor(){this.config=g.SettingsManager.getInstance().settings.liveserver}toggle(){this.server&&this.server.listening?this.stop():this.start()}async start(){if(!this.server||!this.server.listening){this.config=g.SettingsManager.getInstance().settings.liveserver,this.port=this.config.port;var e=r();let t=this.createStaticServer();if(e.use(t).use(this.entryPoint(t,this.config.indexFile)).use(p(this.config.rootFolder,{icons:!0})),this.server=(0,a.createServer)(e),this.server.addListener("listening",(()=>{let e=this.config.host;if("0.0.0.0"==e&&(e="127.0.0.1"),h.ServerStart.send(e,this.port),this.config.launch_browser){let t={};this.config.browser&&(t={app:{name:this.config.browser}}),m(`http://${e}:${this.port}`,t)}else{let e=`http://${this.config.host}:${this.port}`;y.GenericServer.showInformationMessage("Liver server started on "+e)}})),this.clients=[],this.wss=new d.WebSocketServer({server:this.server}),this.wss.on("connection",(e=>{e.onclose=()=>{this.clients=this.clients.filter((function(t){return t!==e}))},this.clients.push(e)})),this.config.autoIncrementPort)for(;await this.portInUse(this.config.host,this.port);)this.port++;else if(await this.portInUse(this.config.host,this.port))return void y.GenericServer.showErrorMessage("The port "+this.port+" is already in use");this.server.listen(this.port,this.config.host)}}stop(){for(let e of this.clients)e.close();this.clients=[],this.server&&(this.server.close(),this.server=void 0),this.wss&&(this.wss.close(),this.wss=void 0),f.ServerStop.send()}portInUse(e,t){return new Promise(((n,r)=>{var i=(0,o.createServer)((function(e){e.write("Echo server\r\n"),e.pipe(e)}));i.on("error",(function(e){n(!0)})),i.on("listening",(function(e){i.close(),n(!1)})),i.listen(t,e)}))}updateCSS(e,t,n){this.send("update_css",{css:e,element:t,children:n})}updateComponent(e,t,n){this.send("update_component",{js:e,element:t,children:n})}updateGlobalCSS(e,t){this.send("update_global_css",{name:e,css:t})}reload(){this.reloadTimeout&&clearTimeout(this.reloadTimeout),this.reloadTimeout=setTimeout((()=>{this._reload()}),this.config.delay)}_reload(){this.send("reload",{})}send(e,t){let n={cmd:e,params:t},r=JSON.stringify(n);for(let e of this.clients)e.readyState==d.WebSocket.OPEN&&e.send(r)}escape(e){return String(e).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}entryPoint(e,t){return function(n,r,i){n.url="/"+t,e(n,r,i)}}createStaticServer(){return(e,t,n)=>{if("GET"!==e.method&&"HEAD"!==e.method)return n();var r=s.parse(e.url||"").pathname||"",a=!e.headers.origin,o=[new RegExp("</head>","i"),new RegExp("</body>","i")],p=null;if(e.url?.startsWith("/?get_injected_code")){let n=e.headers.host;if(!n){n=this.config.host;let t=e.url.split("&");t.length>1&&(n=t[1].replace("host=","")),"0.0.0.0"==n&&(n="127.0.0.1"),n+=":"+this.port}let r="ws://"+n+"/ws",i=_.INJECTED_CODE.replace('<script type="text/javascript">',"");return i=i.replace("var address = protocol + window.location.host + window.location.pathname + '/ws';","var address = '"+r+"';"),i=i.replace("<\/script>",""),t.setHeader("Content-Length",i.length),t.setHeader("Content-type","text/javascript"),t.setHeader("Access-Control-Allow-Origin","*"),t.write(i,"utf8"),void t.end()}i(e,r,{root:this.config.rootFolder}).on("error",(function(e){if(404===e.status)return n();n(e)})).on("directory",(()=>{var n=s.parse(e.originalUrl||"").pathname;t.statusCode=301,t.setHeader("Location",n+"/"),t.end("Redirecting to "+this.escape(n||"")+"/")})).on("file",(function(e){var t,n=(0,l.extname)(e).toLocaleLowerCase();if(a&&["",".html"].indexOf(n)>-1)for(var r=(0,c.readFileSync)(e,"utf8"),i=0;i<o.length;++i)if(t=o[i].exec(r)){p=t[0];break}})).on("stream",(e=>{if(p){let i=p,s=_.INJECTED_CODE;this.config.auto_close&&(s=s.replace("//onclose","socket.onclose = function () { setTimeout(() => window.close(), 100); }"));var n=s.length+Number(t.getHeader("Content-Length"));t.setHeader("Content-Length",n);var r=e.pipe;e.pipe=function(t){r.call(e,(0,u.replace)(new RegExp(i,"i"),s+p)).pipe(t)}}})).pipe(t)}}}t.HttpServer=v},2685:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.INJECTED_CODE=void 0,t.INJECTED_CODE="<script type=\"text/javascript\">\nif ('WebSocket' in window) {\n\t(function () {\n\n\t\tvar protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';\n\t\tvar address = protocol + window.location.host + window.location.pathname + '/ws';\n\t\tvar socket = new WebSocket(address);\n\t\tconst getElement = function (name) {\n\t\t\tlet current = window\n\t\t\tlet splitted = name.split(\".\")\n\t\t\tfor (let part of splitted) {\n\t\t\t\tif (!current[part]) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\t\t\treturn current;\n\t\t}\n\t\tconst setElement = function (name, cst) {\n\t\t\tlet current = window\n\t\t\tlet splitted = name.split(\".\")\n\t\t\tfor (let i = 0; i < splitted.length - 1; i++) {\n\t\t\t\tlet part = splitted[i];\n\t\t\t\tif (!current[part]) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\t\t\tif(current){\n\t\t\t\tcurrent[splitted[splitted.length - 1]] = cst;\n\t\t\t}\n\t\t\treturn current;\n\t\t}\n\t\tsocket.onmessage = function (ev) {\n\t\t\ttry {\n\t\t\t\tlet content = ev.data;\n\t\t\t\tlet message = JSON.parse(content);\n\t\t\t\tif (message.cmd == \"reload\") {\n\t\t\t\t\twindow.location.reload(true);\n\t\t\t\t}\n\t\t\t\telse if (message.cmd == \"update_css\") {\n\t\t\t\t\tlet element = getElement(message.params.element);\n\t\t\t\t\tif (element) {\n\t\t\t\t\t\telement.__style = message.params.css;\n\t\t\t\t\t\tlet allInstances = Aventus.WebComponentInstance.getAllInstances(element);\n\t\t\t\t\t\tlet checkedType = [];\n\t\t\t\t\t\tfor (let webComp of allInstances) {\n\t\t\t\t\t\t\tlet cst = webComp.constructor;\n\t\t\t\t\t\t\tif (!checkedType.includes(cst) && cst.__styleSheets['@local']) {\n\t\t\t\t\t\t\t\tcheckedType.push(cst);\n\t\t\t\t\t\t\t\tlet styleTxt = webComp.__getStyle().join(\"\\r\\n\");\n\t\t\t\t\t\t\t\tcst.__styleSheets['@local'].replaceSync(styleTxt)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (message.cmd == \"update_global_css\") {\n\t\t\t\t\tAventus.Style.store(message.params.name, message.params.css)\n\t\t\t\t}\n\t\t\t\telse if (message.cmd == \"update_component\") {\n\t\t\t\t\tlet element = getElement(message.params.element);\n\t\t\t\t\tif (element) {\n\t\t\t\t\t\teval(`var __aventusHotReload = ${message.params.js}`);\n\t\t\t\t\t\tlet oldProps = Object.getOwnPropertyNames(element.prototype);\n\t\t\t\t\t\tlet newProps = Object.getOwnPropertyNames(__aventusHotReload.prototype);\n\t\t\t\t\t\tlet avoidProps = ['__getStatic', '__getStyle'];\n\t\t\t\t\t\tfor (let newPropName of newProps) {\n\t\t\t\t\t\t\tlet index = oldProps.indexOf(newPropName)\n\t\t\t\t\t\t\tif (index != -1) {\n\t\t\t\t\t\t\t\toldProps.splice(index, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(avoidProps.includes(newPropName)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet descriptor = Object.getOwnPropertyDescriptor(element.prototype, newPropName);\n\t\t\t\t\t\t\tlet descriptor2 = Object.getOwnPropertyDescriptor(__aventusHotReload.prototype, newPropName);\n\t\t\t\t\t\t\tif (descriptor && descriptor.writable) {\n\t\t\t\t\t\t\t\telement.prototype[newPropName] = __aventusHotReload.prototype[newPropName];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (descriptor && descriptor2) {\n\t\t\t\t\t\t\t\tif (descriptor.get) {\n\t\t\t\t\t\t\t\t\tdescriptor.get = descriptor2.get;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (descriptor.set) {\n\t\t\t\t\t\t\t\t\tdescriptor.set = descriptor2.set;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (let oldPropName of oldProps) {\n\t\t\t\t\t\t\tdelete element.prototype[oldPropName];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tObject.defineProperty(__aventusHotReload, '__styleSheets', {\n\t\t\t\t\t\t\tget() { return element.__styleSheets }\n\t\t\t\t\t\t})\n\t\t\t\t\t\telement.__template = null;\n\t\t\t\t\t\tlet allInstances = Aventus.WebComponentInstance.getAllInstances(element)\n\t\t\t\t\t\tfor (let webComp of allInstances) {\n\t\t\t\t\t\t\tlet newInstance = new element();\n\n\t\t\t\t\t\t\tfor (let attr of webComp.attributes) {\n\t\t\t\t\t\t\t\tnewInstance[attr.name] = attr.value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (webComp.parentNode) {\n\t\t\t\t\t\t\t\twebComp.parentNode.insertBefore(newInstance, webComp);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twebComp.remove();\n\t\t\t\t\t\t\twebComp.destructor();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (e) { console.log(e); }\n\t\t}\n\t\tsocket.onerror = function () {\n\t\t\twindow.close();\n\t\t}\n\t\t//onclose\n\t})();\n}\n<\/script>"},93401:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskInput=void 0;const r=n(24964),i=n(36790);t.AskInput=class{static waitingResponse={};static send(e){return new Promise((t=>{let n=(0,i.v4)();for(;null!=this.waitingResponse[n];)n=(0,i.v4)();this.waitingResponse[n]=e=>{t(e)},r.GenericServer.sendNotification("aventus/askinput",n,e)}))}static resolve(e,t){this.waitingResponse[e]&&(this.waitingResponse[e](t),delete this.waitingResponse[e])}}},64961:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskSelect=void 0;const r=n(24964),i=n(36790);t.AskSelect=class{static waitingResponse={};static waitingOptions={};static send(e,t){return new Promise((n=>{let s=(0,i.v4)();for(;null!=this.waitingResponse[s];)s=(0,i.v4)();this.waitingOptions[s]=e,this.waitingResponse[s]=e=>{n(e)},r.GenericServer.sendNotification("aventus/askselect",s,e,t)}))}static resolve(e,t){if(this.waitingResponse[e]){if(t)for(let n of this.waitingOptions[e])n.label==t.label&&(t=n);this.waitingResponse[e](t),delete this.waitingResponse[e],delete this.waitingOptions[e]}}}},39567:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskSelectMultiple=void 0;const r=n(24964),i=n(36790);t.AskSelectMultiple=class{static waitingResponse={};static send(e,t){return new Promise((n=>{let s=(0,i.v4)();for(;null!=this.waitingResponse[s];)s=(0,i.v4)();this.waitingResponse[s]=e=>{n(e)},r.GenericServer.sendNotification("aventus/askselectmultiple",s,e,t)}))}static resolve(e,t){this.waitingResponse[e]&&(this.waitingResponse[e](t),delete this.waitingResponse[e])}}},64945:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CloseFile=void 0;const r=n(24964);t.CloseFile=class{static send(e){r.GenericServer.sendNotification("aventus/closefile",e)}}},49177:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Compiled=void 0;const r=n(24964);t.Compiled=class{static send(e,t){r.GenericServer.sendNotification("aventus/compiled",e,t)}static part(e){r.GenericServer.sendNotification("aventus/compiled/part",e)}}},49387:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DebugFileAdd=void 0;const r=n(24964);t.DebugFileAdd=class{static send(e,t){r.GenericServer.sendNotification("aventus/addDebugFile",e,t)}}},22296:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFile=void 0;const r=n(24964);t.EditFile=class{static send(e,t){r.GenericServer.sendNotification("aventus/editFile",{uri:e,transformations:t})}}},16378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InitStep=void 0;const r=n(24964);class i{static isInit=!1;static send(e){console.log(e),r.GenericServer.sendNotification("aventus/initStep",e)}static sendDone(){r.GenericServer.sendNotification("aventus/initStep","Aventus : Done"),i.isInit=!0}}t.InitStep=i},49404:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenFile=void 0;const r=n(24964);t.OpenFile=class{static send(e){r.GenericServer.sendNotification("aventus/openfile",e)}}},43438:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Popup=void 0;const r=n(24964),i=n(36790);t.Popup=class{static waitingResponse={};static send(e,...t){return new Promise((n=>{let s=(0,i.v4)();for(;null!=this.waitingResponse[s];)s=(0,i.v4)();this.waitingResponse[s]=e=>{n(e)},r.GenericServer.sendNotification("aventus/popup",s,e,t)}))}static resolve(e,t){this.waitingResponse[e]&&(this.waitingResponse[e](t),delete this.waitingResponse[e])}}},80013:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegisterBuild=void 0;const r=n(24964);t.RegisterBuild=class{static send(e,t){r.GenericServer.sendNotification("aventus/registerBuild",{pathConfig:e,buildName:t})}}},62814:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Statistics=void 0;const r=n(57147),i=n(24964),s=n(29495),a=n(1539);t.Statistics=class{static get isEnable(){return s.SettingsManager.getInstance().settings.useStats}static startSendLoadFile(){this.isEnable&&a.Timer.start("load_files")}static sendLoadFile(){this.isEnable&&i.GenericServer.sendNotification("aventus/statistics/loadFileTime",a.Timer.stop("load_files"))}static startSendBuildTime(e){this.isEnable&&a.Timer.start("full_build_"+e)}static sendBuildTime(e){this.isEnable&&i.GenericServer.sendNotification("aventus/statistics/buildTime",e,a.Timer.stop("full_build_"+e))}static startSendStaticTime(e){this.isEnable&&a.Timer.start("full_static_"+e)}static sendStaticTime(e){this.isEnable&&i.GenericServer.sendNotification("aventus/statistics/staticTime",e,a.Timer.stop("full_static_"+e))}static sendFileSize(e,t,n,s){if(this.isEnable){let a=0;a="string"==typeof t?Buffer.from(t).length:(0,r.statSync)(e).size,i.GenericServer.sendNotification("aventus/statistics/fileSize",e,a,n,s)}}}},91908:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnregisterBuild=void 0;const r=n(24964);t.UnregisterBuild=class{static send(e,t){r.GenericServer.sendNotification("aventus/unregisterBuild",{pathConfig:e,buildName:t})}}},97750:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerStart=void 0;const r=n(24964);t.ServerStart=class{static send(e,t){r.GenericServer.sendNotification("aventus/server/start","http://"+e+":"+t)}}},93035:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerStop=void 0;const r=n(24964);t.ServerStop=class{static send(){r.GenericServer.sendNotification("aventus/server/stop",{})}}},96693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Compiling=void 0;const r=n(24964);t.Compiling=class{static send(e,t,n){r.GenericServer.sendNotification("aventus/sharp/compiling",e,t,n)}}},3006:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Build=void 0;const r=n(57147),i=n(22037),s=n(71017),a=n(42374),o=n(19408),l=n(83693),c=n(95896),u=n(38344),p=n(56733),_=n(99007),d=n(16286),h=n(54145),f=n(56941),m=n(37439),g=n(60206),y=n(49177),v=n(80013),$=n(91908),b=n(1539),S=n(6268),x=n(19601),w=n(24964),C=n(79875),E=n(22163),k=n(49387),A=n(48703),T=n(62814);t.Build=class{project;buildConfig;stories;onNewFileUUID;onFileDeleteUUIDs={};globalComponentSCSSFiles={};scssFiles={};tsFiles={};noNamespaceUri={};htmlFiles={};wcFiles={};namespaces=[];externalPackageInformation=new I(this);dependanceNeedUris=[];dependanceFullUris=[];dependanceUris=[];diagnostics=new Map;tsLanguageService;get globalSCSSLanguageService(){return this.project.globalSCSSLanguageService}scssLanguageService;htmlLanguageService;allowBuild=!0;initDone=!1;_filesLoaded=!1;reloadPage=!1;_outputPathes=[];npmBuilder;get fullname(){return this.buildConfig.fullname}get module(){return this.buildConfig.module}get isCoreBuild(){return this.project.isCoreBuild}get hideWarnings(){return this.buildConfig.hideWarnings}get nodeModulesDir(){return this.buildConfig.nodeModulesDir}get outputPathes(){return this._outputPathes}_hasNpmOutput;get hasNpmOutput(){if(void 0===this._hasNpmOutput){const e=-1!=this.buildConfig.compile.findIndex((e=>e.outputNpm.path.length>0));this._hasNpmOutput=e||this.hasStories}return this._hasNpmOutput}get hasStories(){return void 0!==this.buildConfig.stories}get filesLoaded(){return this._filesLoaded}constructor(e,t){this.project=e,this.buildConfig=t,this.onNewFileUUID=l.FilesManager.getInstance().onNewFile(this.onNewFile.bind(this)),this.tsLanguageService=new m.AventusTsLanguageService(this),this.scssLanguageService=new _.AventusSCSSLanguageService(this),this.htmlLanguageService=new u.AventusHTMLLanguageService(this),this.stories=new A.Storie(this,t),this._outputPathes=[(0,s.join)(S.DependanceManager.getInstance().getPath(),"@locals",this.buildConfig.fullname+o.AventusExtension.Package).replace(/\\/g,"/")];for(let e of t.compile)for(let t of e.package)this._outputPathes.push(t.replace(/\\/g,"/"));this.npmBuilder=new C.NpmBuilder(this),v.RegisterBuild.send(e.getConfigFile().path,t.fullname)}async init(){await this.loadFiles(),this.initDone=!0}getComponentPrefix(){return this.buildConfig.componentPrefix}getAvoidParsingTags(){return this.buildConfig.avoidParsingInsideTags}getAliases(){return this.project.getConfig()?.aliases??{}}isFileInside(e){return null!=(0,b.uriToPath)(e).match(this.buildConfig.srcPathRegex)}getNamespace(e){return this.noNamespaceUri[e]?"":""!=this.buildConfig.module?this.buildConfig.module+".":""}enableBuild(){this.allowBuild=!0}disableBuild(){this.allowBuild=!1}get isBuildAllowed(){return this.allowBuild}timerBuild=void 0;insideRebuildAll=!1;async rebuildAll(e=!1){if(this.allowBuild=!1,this.insideRebuildAll=!0,e){for(let e in this.wcFiles)await this.wcFiles[e].init();for(let e in this.scssFiles)await this.scssFiles[e].init(),await this.scssFiles[e].validate();for(let e in this.htmlFiles)await this.htmlFiles[e].init(),await this.htmlFiles[e].validate();for(let e in this.tsFiles)await this.tsFiles[e].validate()}else{for(let e in this.scssFiles)await this.scssFiles[e].validate();for(let e in this.htmlFiles)await this.htmlFiles[e].validate();for(let e in this.tsFiles)await this.tsFiles[e].validate()}for(let e in this.scssFiles)await this.scssFiles[e].triggerSave();for(let e in this.htmlFiles)await this.htmlFiles[e].triggerSave();for(let e in this.wcFiles)await this.wcFiles[e].triggerSave();for(let e in this.tsFiles)await this.tsFiles[e].triggerSave();this.insideRebuildAll=!1,this.allowBuild=!0,this.npmBuilder.rebuildInfo(),this.initDone?await this.build():await this._build()}async build(){if(!this.initDone)return;let e=w.GenericServer.delayBetweenBuild();0==e?await this._build():(this.timerBuild&&clearTimeout(this.timerBuild),this.timerBuild=setTimeout((async()=>{await this._build()}),e))}addDiagnostic(e,t){this.diagnostics.has(e)||this.diagnostics.set(e,[]),this.diagnostics.get(e)?.push(t)}clearDiagnostics(){for(let[e,t]of this.diagnostics.entries())e instanceof h.AventusTsFile&&w.GenericServer.sendDiagnostics({uri:e.file.uri,diagnostics:e.getDiagnostics()},this);this.diagnostics.clear()}emitDiagnostics(){for(let[e,t]of this.diagnostics.entries())if(e instanceof h.AventusTsFile){let n=[...t,...e.getDiagnostics()];this.hideWarnings&&(n=n.filter((e=>e.severity!=a.DiagnosticSeverity.Warning))),w.GenericServer.sendDiagnostics({uri:e.file.uri,diagnostics:n},this)}}async _build(){if(!this.allowBuild)return;w.GenericServer.isDebug()&&console.log("building "+this.buildConfig.fullname),this.clearDiagnostics();let e=[];for(let t of this.buildConfig.compile){let n=await this.buildOrderCompilationInfo(t),r=await this.buildLocalCode(n.toCompile,this.buildConfig.module);e=await this.writeBuildCode(r,n.libSrc,t.output,t.compressed),e=[...e,...n.errors];let i={namespace:this.buildConfig.module,available:r.codeRenderInJs,existing:r.codeNotRenderInJs};this.writeBuildDocumentation(t.package,r,i,t.outputNpm),this.writeBuildNpm(t.outputNpm,r),this.buildConfig.stories&&this.buildConfig.stories.live&&(await this.stories.check(),this.writeBuildNpm({path:[(0,s.join)(this.buildConfig.stories.output,"generated")],packageJson:!1,npmName:""},r),this.stories.write(this.tsFiles))}y.Compiled.send(this.buildConfig.fullname,e),this.reloadPage&&(this.reloadPage=!1,g.HttpServer.getInstance().reload()),this.emitDiagnostics()}_buildStringModule(e,t,n,r,s,a){let o="",l=e.split(".");if(o+=t.join(i.EOL)+i.EOL,n.length>0){let t="";o+="var "+l[0]+";"+i.EOL;for(let e=0;e<l.length;e++)""!=t?t+="."+l[e]:t=l[e],o+="("+t+"||("+t+" = {}));"+i.EOL;let s=[],c=[],u=[];for(let e in r)if(""!=e){let n=e.split("."),r="";for(let e=0;e<n.length-1;e++)if(0==r.length?r=n[e]:r+="."+n[e],-1==u.indexOf(r)){u.push(r),r.includes(".")?s.push(`${r} = {};`):s.push(`let ${r} = {};`);const e=r.replace(/\./g,"?.");s.push(`_.${r} = ${t}.${e} ?? {};`)}}o+="(function ("+l[0]+") {"+i.EOL,o+="const moduleName = `"+t+"`;"+i.EOL,o+="const _ = {};"+i.EOL,o+=a.join(i.EOL)+i.EOL,o+=s.join(i.EOL)+i.EOL,o+="let _n;"+i.EOL,o+=n.join(i.EOL)+i.EOL,o+=c.join(i.EOL)+i.EOL,o+=`for(let key in _) { ${e}[key] = _[key] }`,o=o.trim()+i.EOL,o+="})("+l[0]+");"+i.EOL}return o+=s.join(i.EOL)+i.EOL,o=o.trim()+i.EOL,o}async buildStorybook(){if(this.buildConfig.stories){await this.stories.check();for(let e of this.buildConfig.compile){let t=await this.buildOrderCompilationInfo(e),n=await this.buildLocalCode(t.toCompile,this.buildConfig.module);this.writeBuildNpm({path:[(0,s.join)(this.buildConfig.stories.output,"generated")],packageJson:!1,npmName:""},n)}this.stories.write(this.tsFiles,!0)}}async writeBuildCode(e,t,n,s){let a=[];if(n&&n.length>0){let o="",l=await this.npmBuilder.compile();a=[...a,...l.errors],o+=l.result,o+=t+i.EOL;let c=[];for(let t in e.stylesheets)c.push(`Aventus.Style.store("${t}", \`${e.stylesheets[t]}\`)`);o+=this._buildStringModule(this.buildConfig.module,e.codeNoNamespaceBefore,e.code,e.classesName,e.codeNoNamespaceAfter,c);for(let e of n){let t=(0,b.getFolder)(e.replace(/\\/g,"/"));if((0,r.existsSync)(t)||(0,r.mkdirSync)(t,{recursive:!0}),s)try{o=(await(0,x.minify)({"file1.js":o},{compress:!1,format:{comments:!1}})).code??""}catch(e){console.log(e)}this.writeFile(e,o)}}return a}writeBuildDocumentation(e,t,n,a){let l="";l="declare global {"+i.EOL,l+="\nnamespace "+this.buildConfig.module+"{"+i.EOL,l+=t.doc.join(i.EOL)+i.EOL,l+="\t}",t.docNoNamespace.length>0?l+=i.EOL+t.docNoNamespace.join(i.EOL)+i.EOL:l+=i.EOL,l+="}"+i.EOL,t.docInvisible.length>0&&(l+="declare module ___"+this.buildConfig.module+" {"+i.EOL,l+=t.docInvisible.join(i.EOL),l+="}");let c="// "+this.buildConfig.fullname+":"+this.buildConfig.version+i.EOL;if(a.path.length>0){c+="// npm:"+(""==a.npmName?("@"+this.buildConfig.module+"/"+this.buildConfig.name).toLowerCase():a.npmName)+i.EOL}c+="//#region js def //"+i.EOL+l,c+="//#endregion js def //"+i.EOL,c+="//#region js src //"+i.EOL+JSON.stringify(n)+i.EOL,c+="//#endregion js src //"+i.EOL,c+="//#region css def //"+i.EOL,c+=JSON.stringify(this.scssLanguageService.getInternalDocumentation())+i.EOL,c+="//#endregion css def //"+i.EOL,c+="//#region css //"+i.EOL,c+=JSON.stringify(t.stylesheets)+i.EOL,c+="//#endregion css //"+i.EOL,c+="//#region html //"+i.EOL,c+=JSON.stringify(t.htmlDoc)+i.EOL,c+="//#endregion html //"+i.EOL,c+="//#region dependances //"+i.EOL,c+=JSON.stringify(this.buildConfig.dependances)+i.EOL,c+="//#endregion dependances //"+i.EOL;for(let t of e)t?this.writeFile(t,c):(0,r.existsSync)(t)&&(0,r.unlinkSync)(t);let u=(0,s.join)(S.DependanceManager.getInstance().getPath(),"@locals");(0,r.existsSync)(u)||(0,r.mkdirSync)(u,{recursive:!0}),this.writeFile((0,s.join)(u,this.buildConfig.fullname+o.AventusExtension.Package),c)}writeBuildNpm(e,t){let n=Object.keys(t.npm);n.includes("")||n.push("");for(let e of n){let t=e.split("."),r="";for(let e of t)r=r?`${r}.${e}`:e,n.includes(r)||n.push(r)}n.sort(((e,t)=>(e.match(/\./g)||[]).length-(t.match(/\./g)||[]).length));const a={};for(let n in t.npmsrc){let o="";for(let e in t.npmsrc[n].imports){const r=t.npmsrc[n].imports[e];r.length>0&&(o+=`import { ${r.join(", ")} } from "${e}";`+i.EOL)}""!=o&&(o+=i.EOL),o+=t.npmsrc[n].content.join(i.EOL),o=m.AventusTsLanguageService.removeUnusedImport(o,t.npmsrc[n].forcedDependances);for(let t of e.path){const e=(0,b.getFolder)(n),i=(0,s.join)(t,"__src",...e.split(s.sep)),a=(0,s.join)(t,"__src",...n.split(s.sep));(0,r.existsSync)(i)||(0,r.mkdirSync)(i,{recursive:!0}),this.writeFile(a,o)}for(let e of t.npmsrc[n].names){let t=e.split("."),r=t.pop()??"",i=[];for(let e=0;e<t.length;e++)i.push("..");i=[...i,"__src",...n.split(s.sep)];let o=t.join(".");a[o]||(a[o]={});let l=i.join("/");a[o][l]||(a[o][l]=[]),a[o][l].push(r)}}const o=(t,a)=>{a||(a={content:[],imports:{}});let o="",l="",c=""==t?0:t.split(".").length,u=[];for(let e of n)if(e.startsWith(t)&&e!=t){let t=e.split(".");if(t.length==c+1){const e=t[t.length-1];o+=`import * as ${e} from "./${e}";`+i.EOL,l+=`export { ${e} };`+i.EOL,u.push(`./${e}`)}}for(let e in a.imports){const t=a.imports[e];t.length>0&&(o+=`import { ${t.join(", ")} } from "${e}";`+i.EOL)}o+=i.EOL+a.content.join(i.EOL)+i.EOL,o+=l,o=o.replaceAll("globalThis.Aventus.",""),o=o.replaceAll("___Aventus.",""),o=m.AventusTsLanguageService.removeUnusedImport(o,[]);for(let n of e.path){const e=(0,s.join)(n,...t.split("."));(0,r.existsSync)(e)||(0,r.mkdirSync)(e,{recursive:!0});let i=(0,s.join)(e,"index.d.ts");this.writeFile(i,o)}},l=t=>{let o="",l="",c=""==t?0:t.split(".").length;for(let e of n)if(e.startsWith(t)&&e!=t){let t=e.split(".");if(t.length==c+1){const e=t[t.length-1];o+=`import * as ${e} from "./${e}/index.js";`+i.EOL,l+=`export { ${e} };`+i.EOL}}const u=a[t];if(u)for(let e in u){o+=`export { ${u[e].join(", ")} } from "${e}"`+i.EOL}o+=l,o=m.AventusTsLanguageService.removeUnusedImport(o,[]);for(let n of e.path){const e=(0,s.join)(n,...t.split("."));(0,r.existsSync)(e)||(0,r.mkdirSync)(e,{recursive:!0});let i=(0,s.join)(e,"index.js");this.writeFile(i,o)}};for(let e of n)o(e,t.npm[e]),l(e);if(e.packageJson){const t=(0,s.join)(this.project.getConfigFile().folderPath,"package.json");let n={};(0,r.existsSync)(t)&&(n=JSON.parse((0,r.readFileSync)(t,"utf-8")));const i={};for(let e of this.externalPackageInformation.filesUri){let t=this.externalPackageInformation.getByUri(e);t&&(t.npmUri&&t.name!=this.buildConfig.fullname&&(n.dependencies&&n.dependencies[t.npmUri]?i[t.npmUri]=n.dependencies[t.npmUri]:i[t.npmUri]="^"+t.versionTxt))}let a={name:""==e.npmName?("@"+this.buildConfig.module+"/"+this.buildConfig.name).toLowerCase():e.npmName,displayName:this.buildConfig.module+" "+this.buildConfig.name,description:"Aventus build for @"+this.buildConfig.module+"/"+this.buildConfig.name,version:this.buildConfig.version,author:{name:"Cobwebsite",email:"info@cobwebsite.ch",url:"https://cobwesbite.ch"},type:"module",main:"index.js",types:"index.d.ts",dependencies:i};for(let t of e.path)(0,r.existsSync)(t)||(0,r.mkdirSync)(t,{recursive:!0}),this.writeFile((0,s.join)(t,"package.json"),JSON.stringify(a,null,2))}}async buildLocalCode(e,t){let n={codeNoNamespaceBefore:[],code:[],codeNoNamespaceAfter:[],doc:[],docNoNamespace:[],docInvisible:[],classesName:{},stylesheets:{},codeRenderInJs:[],codeNotRenderInJs:[],npm:{},npmsrc:{},htmlDoc:{}},r={},i={},s=!1,a="";""!=t&&(a=t+".");const l=(e,t)=>{let n=[];for(let r of e){let e="";e="@local"==r.uri?this.noNamespaceUri[t]?r.fullName.replace("$namespace$",""):r.fullName.replace("$namespace$",a):"@external"==r.uri||"@npm"==r.uri?r.fullName:this.noNamespaceUri[r.uri]?r.fullName.replace("$namespace$",""):r.fullName.replace("$namespace$",a),n.push({fullName:e,isStrong:r.isStrong})}return n},c=(e,t)=>{let r=this.tsFiles[e.uri];if(r instanceof d.AventusWebComponentLogicalFile&&r.compilationResult)if(t){let e=JSON.parse(JSON.stringify(r.compilationResult.htmlDoc));for(let t in e)e[t].class=this.buildConfig.module+"."+e[t].class,n.htmlDoc[t]=e[t]}else n.htmlDoc={...n.htmlDoc,...r.compilationResult.htmlDoc}};for(let t of e)if(this.noNamespaceUri[t.uri]){if(""!=t.compiled){let e;t.compiled.startsWith("@After()")?(n.codeNoNamespaceAfter.push(t.compiled.slice(8)),e="after"):t.compiled.startsWith("@Before()")?(n.codeNoNamespaceBefore.push(t.compiled.slice(9)),e="before"):s?(n.codeNoNamespaceAfter.push(t.compiled),e="after"):(n.codeNoNamespaceBefore.push(t.compiled),e="before"),r[t.classScript]||(r[t.classScript]={code:(0,b.replaceNotImportAliases)(t.compiled,this.project.getConfig()),dependances:l(t.dependances,t.uri),fullName:t.classScript,required:t.required,noNamespace:e,type:t.type,isExported:t.isExported.external,convertibleName:t.convertibleName,tagName:t.tagName})}else""==t.classScript||i[t.classScript]||t.classScript.startsWith("!staticClass_")||(i[t.classScript]={fullName:t.classScript,dependances:l(t.dependances,t.uri)}),""==t.classDoc||i[t.classDoc]||t.classDoc.startsWith("!staticClass_")||(i[t.classDoc]={fullName:t.classScript,dependances:l(t.dependances,t.uri)});if(""!=t.docVisible&&n.docNoNamespace.push(t.docVisible),""!=t.docInvisible&&n.docInvisible.push(t.docInvisible),t.npm.defTs&&(n.npm[""]||(n.npm[""]={content:[],imports:{}}),n.npm[""].content.push(t.npm.defTs)),t.npm.src){n.npmsrc[t.npm.exportPath]||(n.npmsrc[t.npm.exportPath]={content:[],imports:{},names:[],forcedDependances:[]});const e=t.isExported.internal?"export "+t.npm.src:t.npm.src;n.npmsrc[t.npm.exportPath].content.push(e)}c(t,!1)}else{if(s=!0,""==t.classScript||t.classScript.startsWith("!staticClass_")||(n.classesName[t.classScript]={type:t.type,isExported:t.isExported.external,convertibleName:t.convertibleName}),""!=t.compiled){n.code.push((0,b.replaceNotImportAliases)(t.compiled,this.project.getConfig()));let e=a+t.classScript;r[e]||(r[e]={code:(0,b.replaceNotImportAliases)(t.compiled,this.project.getConfig()),dependances:l(t.dependances,t.uri),fullName:e,required:t.required,type:t.type,isExported:t.isExported.external,convertibleName:t.convertibleName,tagName:t.tagName})}else{if(""!=t.classScript&&!i[t.classScript]&&!t.classScript.startsWith("!staticClass_")){let e=a+t.classScript;i[t.classScript]={fullName:e,dependances:l(t.dependances,t.uri)}}if(""!=t.classDoc&&!i[t.classDoc]&&!t.classDoc.startsWith("!staticClass_")){let e=a+t.classDoc;i[t.classDoc]={fullName:e,dependances:l(t.dependances,t.uri)}}}if(""!=t.docVisible&&n.doc.push(t.docVisible),""!=t.docInvisible&&n.docInvisible.push(t.docInvisible),t.npm.defTs){n.npm[t.npm.namespace]||(n.npm[t.npm.namespace]={content:[],imports:{}});const e=t.isExported.external?"export "+t.npm.defTs:t.npm.defTs;n.npm[t.npm.namespace].content.push(e);let r=this.tsFiles[t.npm.uri].fileParsed?.npmGeneratedImport;if(r)for(let e in r){const i=n.npm[t.npm.namespace].imports;i[e]||(i[e]=[]);for(let t of r[e]){if(t.onlySrc)continue;const n=t.alias?t.name+" as "+t.alias:t.name;i[e].includes(n)||i[e].push(n)}}}if(t.npm.src){if(!n.npmsrc[t.npm.exportPath]){n.npmsrc[t.npm.exportPath]={content:[],imports:{},names:[],forcedDependances:[]};let e=this.tsFiles[t.npm.uri].fileParsed,r=e?.npmGeneratedImport;if(r)for(let i in r)if(i.startsWith(".")){let s=e?.importsLocal??{},a=e?.manualImportLocal??{};for(let e of r[i]){let r=s[e.name]??a[e.nameAlias??e.name];if(!r)continue;if(r.isTypeImport)continue;let i=r.info?.fileUri??"",l=t.npm.uri,c=(0,b.simplifyUri)(i,l);c=c.replace(o.AventusExtension.Base,".js"),n.npmsrc[t.npm.exportPath].imports[c]||(n.npmsrc[t.npm.exportPath].imports[c]=[]);const u=e.alias?e.name+" as "+e.alias:e.name;n.npmsrc[t.npm.exportPath].imports[c].push(u),e.forced&&n.npmsrc[t.npm.exportPath].forcedDependances.push(e.alias??e.name)}}else{n.npmsrc[t.npm.exportPath].imports[i+"/index.js"]||(n.npmsrc[t.npm.exportPath].imports[i+"/index.js"]=[]);for(let e of r[i])if(e.compiled){const r=e.alias?e.name+" as "+e.alias:e.name;n.npmsrc[t.npm.exportPath].imports[i+"/index.js"].push(r),e.forced&&n.npmsrc[t.npm.exportPath].forcedDependances.push(e.alias??e.name)}}}const e=t.isExported.internal?"export "+t.npm.src:t.npm.src;n.npmsrc[t.npm.exportPath].content.push(e),t.isExported.internal&&t.classScript&&n.npmsrc[t.npm.exportPath].names.push(this.module+"."+t.classScript)}c(t,!0)}n.codeRenderInJs=Object.values(r),n.codeNotRenderInJs=Object.values(i);for(let e in this.globalComponentSCSSFiles){let t=this.globalComponentSCSSFiles[e];n.stylesheets[t.globalName]=t.compileResult}return n}async buildOrderCompilationInfo(e){let t={toCompile:[],libSrc:"",errors:[]},n={},r=[],s={},a={};for(let e in this.tsFiles){let t=this.tsFiles[e];for(let e of t.compileResult){if(""!==e.classScript)if(a[e.classScript]){let n=!1,r="The name "+e.classScript+" is registered more than once.",i=t.fileParsed?.getBaseInfoFullName(e.classScript);i&&(this.addDiagnostic(t,(0,b.createErrorTsPos)(t.file.documentUser,r,i.nameStart,i.nameEnd,o.AventusErrorCode.SameNameFound)),n=!0);let s=this.tsFiles[a[e.classScript].uri];i=s.fileParsed?.getBaseInfoFullName(e.classScript),i&&(this.addDiagnostic(s,(0,b.createErrorTsPos)(s.file.documentUser,r,i.nameStart,i.nameEnd,o.AventusErrorCode.SameNameFound)),n=!0),n||w.GenericServer.showErrorMessage(r)}else s[e.classScript]=e,a[e.classScript]=e;""===e.classDoc||s[e.classDoc]||(s[e.classDoc]=e)}}let l=[],c=[],u={};const p=(e,i,a,o,_)=>{const d=e.fullName.replace("$namespace$","");let h="",f=null;if(i)h="@local";else{if(f=this.externalPackageInformation.getByFullName(d),!f)return a;h=f.uri}if(void 0!==o[d]){if(e.isStrong){if(void 0!==_[d])return r.push("You have an infinite loop with your strong dependance ["+d+"]"),a;const e=new Promise((e=>{o[d].push((()=>{e({[h]:d})}))}));return l.push(e),e}return a}o[d]=[],e.isStrong&&(_[d]=!0);const m=[];if((()=>{if(i){if(!s[d])return void(void 0===a[h]&&(a[h]=-1));let e=c.indexOf(d);if(-1!=e)return void(void 0===a[h]&&(a[h]=e+1));let i=s[d],l=0,u=[...i.dependances];if(d.includes(".")){const e=d.split(".");e.pop();const t=e.join("."),n=s[t];n&&n!=i&&u.push({fullName:n.classScript,isStrong:!0,uri:n.uri})}for(let e of u){if("@npm"==e.uri)continue;let n={...a};if("@external"==e.uri){const t=p(e,!1,a,o,{});t instanceof Promise?e.isStrong&&m.push(t):a=t}else if(e.isStrong){if(e.fullName.replace("$namespace$","")!=d){const t=p(e,!0,a,o,_);t instanceof Promise?m.push(t):(a=t)[h]&&a[h]>=0&&a[h]>l&&(l=a[h])}}else{let n=t.toCompile.length;const r=p(e,!0,a,o,{});r instanceof Promise||(a=r)[h]&&a[h]>=0&&a[h]>l&&(l=a[h]);let i=t.toCompile.length;a[h]&&a[h]>=0&&a[h]>l&&l>0&&(l+=i-n)}a=n}if(-1!=c.indexOf(d))return void(t[h]=c.indexOf(d));if(0==m.length){i.tagName&&(n[i.tagName]?r.push("The tag <"+i.tagName+"> is declared by "+n[i.tagName]+" and "+i.classScript):n[i.tagName]=i.classScript),t.toCompile.splice(l,0,i),c.splice(l,0,d);for(const e of o[d])e();o[d]=[]}a[h]=t.toCompile.length}else{if(!f)return;if(!this.dependanceUris.includes(h))return;u[h]||(u[h]=[]);let e=u[h].indexOf(d);if(-1!=e)return void(a[h]=e+1);let t=0;if("noCode"!=f.content)for(let e of f.content.dependances){let n={...a},r=e.isStrong?_:{};const i=p(e,!1,a,o,r);i instanceof Promise?e.isStrong&&m.push(i):(a=i)[h]&&a[h]>=0&&a[h]>t&&(t=a[h]),a=n}if(u[h].includes(d))return void(a[h]=u[h].indexOf(d));if(0==m.length){if("noCode"!=f.content&&f.content.tagName){let e=f.content.tagName;n[e]?r.push("The tag <"+f.content.tagName+"> is declared by "+n[e]+" and "+f.content.fullName):n[e]=f.content.fullName}u[h].splice(t,0,d),a[h]=u[h].length;for(const e of o[d])e();o[d]=[]}}})(),e.isStrong&&delete _[d],0==m.length)return o[d]&&0==o[d].length&&delete o[d],a;{const e=new Promise((async e=>{const n=await Promise.all(m);let r=a[h]??0;for(const e of n)if(e[h]){let t=e[h];if(i){let e=c.indexOf(t)+1;e>r&&(r=e)}else{let e=u[h].indexOf(t)+1;e>r&&(r=e)}}if(i){let e=s[d];c.includes(d)||(t.toCompile.splice(r,0,e),c.splice(r,0,d))}else u[h].includes(d)||u[h].splice(r,0,d);for(const e of o[d])e();delete o[d],e({[h]:d})}));return l.push(e),e}};for(let t in this.tsFiles){let n=this.tsFiles[t],r=n.file.path.match(e.inputPathRegex);for(let e of n.compileResult)(e.required||r)&&(""!==e.classScript&&p({fullName:e.classScript,isStrong:!0},!0,{},{},{}),""!==e.classDoc&&p({fullName:e.classDoc,isStrong:!0},!0,{},{},{}))}await Promise.all(l),l=[];for(let e of this.dependanceNeedUris){let t=this.externalPackageInformation.getInformationsRequired(e);u[e]||(u[e]=[]);for(let n of t)u[e].includes(n.fullName)||p({fullName:n.fullName,isStrong:!0},!1,{},{},{})}await Promise.all(l),l=[];for(let e of this.dependanceFullUris){u[e]||(u[e]=[]);let t=this.externalPackageInformation.getFullInformations(e);for(let n of t)u[e].includes(n.fullName)||p({fullName:n.fullName,isStrong:!0},!1,{},{},{})}await Promise.all(l),l=[];let _=[];for(let e of this.dependanceUris){let t={namespace:this.externalPackageInformation.getNamespaceByUri(e),before:[],code:[],after:[],classesName:{}};if(!u[e])continue;for(let n of u[e]){let e=this.externalPackageInformation.getByFullName(n);if("noCode"!=e.content){let n=(0,b.replaceNotImportAliases)(e.content.code,this.project.getConfig());if(e.content.noNamespace)"before"==e.content.noNamespace?t.before.push(n):"after"==e.content.noNamespace&&t.after.push(n);else{t.code.push(n);let r=new RegExp("^"+this.externalPackageInformation.getNamespaceByUri(e.uri)+"."),i=e.content.fullName.replace(r,"");t.classesName[i]={type:e.content.type,isExported:e.content.isExported,convertibleName:e.content.convertibleName}}}}let n=this.externalPackageInformation.getStyleByUri(e),r=[];for(let e in n)r.push(`Aventus.Style.store("${e}", \`${n[e]}\`)`);let i=this._buildStringModule(t.namespace,t.before,t.code,t.classesName,t.after,r);_.push(i)}if(t.libSrc=_.join(i.EOL),r.length>0){let e=this.buildConfig.fullname+"_dependanceErrors";k.DebugFileAdd.send(e,r.join("\r\n")),t.errors.push({title:"Dependances errors",file:e})}return t}getAllFullnames(){let e={};const t=t=>{if(t.startsWith("!staticClass_"))return;let n=t.split(".")[0];e[n]||(e[n]=[]),e[n].push(t)};for(let e in this.tsFiles){let n=this.tsFiles[e];for(let e of n.compileResult)""!==e.classScript&&t(e.classScript)}for(let e of this.dependanceNeedUris){let n=this.externalPackageInformation.getInformationsRequired(e);for(let e of n)e.code&&t(e.fullName)}for(let e of this.dependanceFullUris){let n=this.externalPackageInformation.getFullInformations(e);for(let e of n)e.code&&t(e.fullName)}return e}async onNewFile(e){this.buildConfig.srcPathRegex&&e.path.match(this.buildConfig.srcPathRegex)&&this.registerFile(e,!1),this.buildConfig.outsideModulePathRegex&&e.path.match(this.buildConfig.outsideModulePathRegex)&&(this.registerFile(e,!1),this.noNamespaceUri[e.uri]=!0)}async loadFiles(){T.Statistics.startSendBuildTime(this.buildConfig.name),this.allowBuild=!1;let e=await S.DependanceManager.getInstance().loadDependancesFromBuild(this.buildConfig,this);this.dependanceFullUris=e.dependanceFullUris,this.dependanceNeedUris=e.dependanceNeedUris,this.dependanceUris=e.dependanceUris,this.externalPackageInformation.init(e.files);let t=l.FilesManager.getInstance();if(this.buildConfig.srcPathRegex){let e=t.getFilesMatching(this.buildConfig.srcPathRegex);for(let t of e)this.registerFile(t,!0)}if(this.buildConfig.outsideModulePathRegex){let e=t.getFilesMatching(this.buildConfig.outsideModulePathRegex);for(let t of e)this.registerFile(t,!0),this.noNamespaceUri[t.uri]=!0}w.GenericServer.isDebug()&&console.log("loaded all files needed"),this.allowBuild=!0,this._filesLoaded=!0,await this.rebuildAll(!0),T.Statistics.sendBuildTime(this.buildConfig.name)}async registerFile(e,t){if(e.uri.endsWith(o.AventusExtension.ComponentStyle))this.scssFiles[e.uri]||(this.scssFiles[e.uri]=new p.AventusWebSCSSFile(e,this),t||await this.scssFiles[e.uri].init(),this.registerOnFileDelete(e),this.scssFiles[e.uri].isGlobal&&(this.globalComponentSCSSFiles[e.uri]=this.scssFiles[e.uri]));else if(e.uri.endsWith(o.AventusExtension.ComponentView))this.htmlFiles[e.uri]||(this.htmlFiles[e.uri]=new c.AventusHTMLFile(e,this),t||await this.htmlFiles[e.uri].init(),this.registerOnFileDelete(e));else if(e.uri.endsWith(o.AventusExtension.Component))this.wcFiles[e.uri]||(this.wcFiles[e.uri]=new E.AventusWebComponentSingleFile(e,this),t||await this.wcFiles[e.uri].init(),this.registerOnFileDelete(e));else if(!this.tsFiles[e.uri]){let t=(0,f.AventusTsFileSelector)(e,this);t&&(this.tsFiles[e.uri]=t,this.registerOnFileDelete(e))}}registerOnFileDelete(e){this.onFileDeleteUUIDs[e.uri]=e.onDelete(this.onFileDelete.bind(this))}async onFileDelete(e){e.removeOnDelete(this.onFileDeleteUUIDs[e.uri]),delete this.onFileDeleteUUIDs[e.uri],e.uri.endsWith(o.AventusExtension.ComponentStyle)?delete this.scssFiles[e.uri]:e.uri.endsWith(o.AventusExtension.ComponentView)?delete this.htmlFiles[e.uri]:e.uri.endsWith(o.AventusExtension.Component)?delete this.wcFiles[e.uri]:delete this.tsFiles[e.uri],await this.rebuildAll()}getLocalWebComponentDefinition(e,t=!1){let n=this.htmlLanguageService.getInternalDefinition(e);if(n&&n.fileParsed){let e=n.getComponentName();if(e){let t=n.fileParsed.classes[e];if(t)return t}}}getWebComponentTagDependance(e){let t=this.htmlLanguageService.getInternalTagUri(e);if(t)return{fullName:t.fullname,uri:t.uri,isStrong:!1};let n=this.getWebComponentDefinition(e);if(n){let e=n.class.fileUri;return n.isLocal||(e="@external"),{fullName:n.class.fullName,uri:e,isStrong:!1}}return null}getWebComponentDefinition(e,t=!1){let n=this.htmlLanguageService.getInternalDefinition(e);if(n&&n.fileParsed){let e=n.getComponentName();if(e){let t=n.fileParsed.classes[e];if(t)return{class:t,isLocal:!0}}}let r=this.htmlLanguageService.getClassByTag(e);if(r){let n=this.externalPackageInformation.getExternalWebComponentDefinition(r);if(n){if(t){let t=this.project.getInternalWebComponentDefinition((0,b.uriToPath)(n.fileUri),e);if(t)return{class:t,isLocal:!1}}return{class:n,isLocal:!1}}}}getWebComponentDefinitionFile(e){let t=this.htmlLanguageService.getInternalDefinition(e);if(t)return t;let n=this.htmlLanguageService.getClassByTag(e);return n?this.externalPackageInformation.getExternalWebComponentDefinitionFile(n):void 0}getNamespaceForUri(e,t){if("manual"==this.buildConfig.namespaceStrategy)return"";if("rules"==this.buildConfig.namespaceStrategy){let t=(0,b.uriToPath)(e);for(let e in this.buildConfig.namespaceRulesRegex){let n=this.buildConfig.namespaceRulesRegex[e];if(t.match(n))return e}}else if("followFolders"==this.buildConfig.namespaceStrategy||"followFoldersCamelCase"==this.buildConfig.namespaceStrategy){let n=(0,b.uriToPath)(e),r=n.split("/");r.pop(),t&&r.pop(),n=r.join("/")+"/";let i=n.replace(this.buildConfig.namespaceRoot,"").replace(/\//g,".");return i.endsWith(".")&&(i=i.slice(0,-1)),i.startsWith(".")&&(i=i.slice(1)),i.includes(":")?"":"followFoldersCamelCase"==this.buildConfig.namespaceStrategy?(i=i.slice(0,1).toUpperCase()+i.slice(1),i.replace(/(([-_\.]|^)[a-z])/g,(e=>e.toUpperCase().replace("-","").replace("_","")))):i}return""}addNamespace(e){if(!this.namespaces.includes(e)){const t=e.split(".");let n="";for(let e of t)n+=e,n&&!this.namespaces.includes(n)&&this.namespaces.push(n),n+="."}}async onRename(e){for(let t of e)if(t.oldUri.endsWith(o.AventusExtension.Component)||t.oldUri.endsWith(o.AventusExtension.ComponentLogic)||t.oldUri.endsWith(o.AventusExtension.Data)||t.oldUri.endsWith(o.AventusExtension.Lib)||t.oldUri.endsWith(o.AventusExtension.RAM))return await this.tsLanguageService.onRenameFile(t.oldUri,t.newUri);return{}}npmAliases={};npmNameCount={};getNpmReplacementName(e,t){if(!this.hasNpmOutput)return"";const n=t.split(".");let r=n.pop();const i=e.split(".");return i.pop(),n.join(".")==i.join(".")?r:(this.npmAliases[t]||(this.npmNameCount[r]||(this.npmNameCount[r]=0),this.npmNameCount[r]++,this.npmAliases[t]=r+this.npmNameCount[r]),this.npmAliases[t])}destroy(){l.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID);for(let e in this.scssFiles)this.scssFiles[e].removeEvents(),this.scssFiles[e].file.removeOnDelete(this.onFileDeleteUUIDs[e]);for(let e in this.htmlFiles)this.htmlFiles[e].removeEvents(),this.htmlFiles[e].file.removeOnDelete(this.onFileDeleteUUIDs[e]);for(let e in this.tsFiles)this.tsFiles[e].removeEvents(),this.tsFiles[e].file.removeOnDelete(this.onFileDeleteUUIDs[e]);$.UnregisterBuild.send(this.project.getConfigFile().path,this.buildConfig.fullname)}writeFile(e,t){(0,b.writeFile)(e,t,"build",this.buildConfig.name)}};class I{files={};informations={};informationsRequired={};webComponentByName={};build;constructor(e){this.build=e}get filesUri(){return Object.keys(this.files)}init(e){for(let t of e)this.files[t.file.uri]=t;this.rebuild()}getByFullName(e){return this.informations[e]}getByUri(e){return this.files[e]}getNpmUri(e){if(!this.build.hasNpmOutput)return null;if(this.informations[e]){let t=this.files[this.informations[e].uri];!t.npmUri&&this.build.initDone&&w.GenericServer.showErrorMessage("Can't find a npm package for "+t.name);const n=e.split(".");let r=n.pop();n.splice(0,0,t.npmUri);const i=t.fileParsed?.getBaseInfo(r);let s=i?.willBeCompiled??!1;return{name:r,uri:n.join("/"),compiled:s}}return null}getNamespaceByUri(e){return this.files[e].srcInfo.namespace}getInformationsRequired(e){return this.informationsRequired[e]}getFullInformations(e){return this.files[e]?.srcInfo.available||[]}getStyleByUri(e){return this.files[e]?this.files[e].externalCSS:{}}rebuild(){this.informations={},this.webComponentByName={};let e=[];for(let t in this.files){let n=this.files[t];this.informationsRequired[t]=[];for(let r of n.srcInfo.available)r.required&&this.informationsRequired[t].push(r),r.fullName&&(this.informations[r.fullName]?this.informations[r.fullName].uri!=t&&e.push({range:{start:{line:0,character:0},end:{line:0,character:0}},severity:a.DiagnosticSeverity.Error,source:o.AventusLanguageId.TypeScript,message:"The name "+r.fullName+" exist inside "+t+" and "+this.informations[r.fullName].uri}):this.informations[r.fullName]={content:r,uri:t});for(let r of n.srcInfo.existing)r.fullName&&(this.informations[r.fullName]?this.informations[r.fullName].uri!=t&&e.push({range:{start:{line:0,character:0},end:{line:0,character:0}},severity:a.DiagnosticSeverity.Error,source:o.AventusLanguageId.TypeScript,message:"The name "+r.fullName+" exist inside "+t+" and "+this.informations[r.fullName].uri}):this.informations[r.fullName]={content:"noCode",uri:t});this.webComponentByName={...this.webComponentByName,...n.classInfoByName}}w.GenericServer.sendDiagnostics({uri:"@Import lib",diagnostics:e},this.build)}getExternalWebComponentDefinition(e){return this.webComponentByName[e]}getExternalWebComponentDefinitionFile(e){let t=this.webComponentByName[e];if(t){let e=t.fileUri,n=this.files[e];if(n)return n}}}},79875:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NpmBuilder=void 0;const r=n(22037),i=n(11298),s=n(23240),a=n(81762),o=n(15100),l=(n(19601),n(61586)),c=n(49177),u=n(49387);t.NpmBuilder=class{infos={};lastInfo="";lastInfoToCompile="";internalNames=[];build;storedInfo={};constructor(e){this.build=e}getInternalName(e){if("default"==e&&(e="_default"),!this.internalNames.includes(e))return this.internalNames.push(e),e;let t=0,n=e+"_"+t;for(;this.internalNames.includes(n);)t++,n=e+"_"+t;return this.internalNames.push(n),n}register(e,t){this.storedInfo[e]||(this.storedInfo[e]=[]),this.storedInfo[e].push(t),this.rebuildInfo()}unregister(e){this.storedInfo[e]&&(delete this.storedInfo[e],this.rebuildInfo())}rebuildInfo(){if(this.build.isBuildAllowed){this.infos={},this.internalNames=[];for(let e in this.storedInfo)for(let t of this.storedInfo[e]){const n=t.uri;if(this.infos[n]||(this.infos[n]={md5:l(n),part:{}}),"*"==t.libName){if(!t.alias)throw`The lib ${n} inside the file ${e} has no alias => impossible`;let r=this.infos[n].all;r||(r={externalAlias:[],internalAlias:this.getInternalName("_default")},this.infos[n].all=r),r.externalAlias.includes(t.alias)||r.externalAlias.push(t.alias)}else{let e=this.infos[n].part;e[t.libName]||(e[t.libName]={externalAlias:[],internalAlias:this.getInternalName(t.libName)});let r=t.alias?t.alias:t.libName;e[t.libName].externalAlias.includes(r)||e[t.libName].externalAlias.push(r)}}}}npmBuildTxt="";npmDepBuildTxt={result:"",errors:[]};async compile(){if(0==Object.keys(this.infos).length)return{result:"",errors:[]};let e=JSON.stringify(this.infos);if(this.lastInfo!=e){this.lastInfo=e;let t=this.writeFileToCompile();this.lastInfoToCompile!=t.buildTxt&&(c.Compiled.part("Compiling node modules"),this.lastInfoToCompile=t.buildTxt,this.npmDepBuildTxt=await this.rollupBuild(this.lastInfoToCompile),c.Compiled.part("Compiling node modules done")),this.npmBuildTxt="var npmCompilation;"+r.EOL,this.npmBuildTxt+="(npmCompilation||(npmCompilation = {}));"+r.EOL,this.npmBuildTxt+=`(function (npmCompilation) {\n\t${this.npmDepBuildTxt.result+r.EOL}\n\t${t.toExport}\n})(npmCompilation);`+r.EOL}return{result:this.npmBuildTxt,errors:this.npmDepBuildTxt.errors}}writeFileToCompile(){let e="",t="",n=[],i=Object.keys(this.infos);i.sort();for(let s of i){let i=this.infos[s];if(t+=`npmCompilation['${i.md5}'] = {};`+r.EOL,i.all){e+=`import * as ${i.all.internalAlias} from "${s}";`+r.EOL,n.push(i.all.internalAlias);for(let e of i.all.externalAlias)t+=`npmCompilation['${i.md5}']['${e}'] = _['${i.all.internalAlias}'];`+r.EOL;for(let e in i.part)for(let n of i.part[e].externalAlias)t+=`npmCompilation['${i.md5}']['${n}'] = _['${i.all.internalAlias}'];`+r.EOL}else{let a=[],o=Object.keys(i.part);o.sort();for(let e of o){a.push(`${e} as ${i.part[e].internalAlias}`),n.push(i.part[e].internalAlias);for(let n of i.part[e].externalAlias)t+=`npmCompilation['${i.md5}']['${n}'] = _['${i.part[e].internalAlias}'];`+r.EOL}e+=`import {${Object.values(a).join(", ")}} from "${s}";`+r.EOL}}return e+=`export default { ${n.join(", ")} }`,{buildTxt:e,toExport:t}}async rollupBuild(e){let t="{}",n={result:"",errors:[]};try{let n=await(0,i.rollup)({input:"index.js",onwarn:e=>{},output:{format:"iife",name:"_",inlineDynamicImports:!0},plugins:[(0,s.default)({include:[this.build.nodeModulesDir+"/**"],ignoreGlobal:!0,sourceMap:!1}),(0,a.default)({"index.js":e}),(0,o.default)({rootDir:this.build.nodeModulesDir})]}),r=await n.generate({format:"iife",name:"_",inlineDynamicImports:!0});t="";for(let e of r.output)t+=e.code;t=t.replace(/process\.env\.NODE_ENV/g,'"production"')}catch(e){let t=this.build.fullname+"_npmErrors";u.DebugFileAdd.send(t,(e+"").replace(/\0/g,"")),n.errors.push({title:"Npm compilation errors",file:t})}return n.result=t,n}}},6268:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DependanceManager=void 0;const r=n(57147),i=n(61586),s=n(71017),a=n(12842),o=n(1539),l=n(19408),c=n(2044),u=n(13685),p=n(95687),_=n(24964),d=n(83693);class h{path;static instance;static getInstance(){return this.instance||(this.instance=new h),this.instance}getPath(){return this.path}constructor(){this.path=(0,s.join)(_.GenericServer.savePath,"packages"),(0,r.existsSync)(this.path)||(0,r.mkdirSync)(this.path,{recursive:!0})}predefinedPaths={"@Aventus":(0,a.AVENTUS_DEF_BASE_PATH)(),"@AventusUI":(0,a.AVENTUS_DEF_UI_PATH)(),"Aventus@UI":(0,a.AVENTUS_DEF_UI_PATH)(),"@AventusSharp":(0,a.AVENTUS_DEF_SHARP_PATH)(),"Aventus@Sharp":(0,a.AVENTUS_DEF_SHARP_PATH)()};predefinedNpm={[(0,a.AVENTUS_DEF_BASE_PATH)()]:"@aventusjs/main",[(0,a.AVENTUS_DEF_UI_PATH)()]:"@aventusjs/ui",[(0,a.AVENTUS_DEF_SHARP_PATH)()]:"@aventussharp/main"};aventusLoaded=!1;async loadDependancesFromBuild(e,t){this.aventusLoaded=!1;let n={files:[],dependanceNeedUris:[],dependanceFullUris:[],dependanceUris:[]},r={},i={};for(let n of e.dependances){let s=await this.loadDependance(n,e,t,r);s&&(i[s.name]=n.include),i={...i,...n.subDependancesInclude}}if(!this.aventusLoaded){let e=(0,o.pathToUri)((0,a.AVENTUS_DEF_BASE_PATH)()),n=await this.loadByUri(t,e);n.npmUri=this.predefinedNpm[(0,a.AVENTUS_DEF_BASE_PATH)()],r["Aventus@Main"]={dependances:[],file:n,uri:e,version:n.version}}let s=[];for(let e in r){let t=r[e];this.orderLoop(e,t,r,s)}for(let e of s){let t=r[e];t.file.loadWebComponents(),n.files.push(t.file);let s=i[e]?e:"*";i[s]?"full"==i[s]?(n.dependanceFullUris.push(t.uri),n.dependanceUris.push(t.uri)):"need"==i[s]&&(n.dependanceNeedUris.push(t.uri),n.dependanceUris.push(t.uri)):n.dependanceUris.push(t.uri)}return n}orderLoop(e,t,n,r){let i=r.indexOf(e);if(-1!=i)return i+1;let s=0;for(let e of t.dependances)if(n[e]){let t=this.orderLoop(e,n[e],n,r);t>=0&&t>s&&(s=t)}return r.splice(s,0,e),r.length}async loadDependance(e,t,n,r){let i,a;if(e.uri.match("^(@|&)")){let r;if(this.predefinedPaths[e.uri]){let t=(0,o.pathToUri)(this.predefinedPaths[e.uri]);i=await this.loadByUri(n,t),a=t,"@Aventus"==e.uri&&(this.aventusLoaded=!0)}else if(r=/@local:(\S+)/g.exec(e.uri)){let e=await this.loadLocal(r[1],n);i=e.file,a=e.uri}else if(r=/&:(\S+)/g.exec(e.uri)){let e=t.module+"@"+r[1]+l.AventusExtension.Package,s=await this.loadLocal(e,n);i=s.file,a=s.uri}else if(r=/@npm:(\S+)/g.exec(e.uri)){r[1]}}else if(e.uri.startsWith("http")){let t=await this.loadHttp(e.uri,e.version,n);t&&(i=t.file,a=t.uri)}else{let t=e.uri;e.uri.startsWith(".")&&(t=n.project.getConfigFile().folderPath+"/"+e.uri),t=(0,s.normalize)(t);let r=(0,o.pathToUri)(t);i=await this.loadByUri(n,r),a=r}if(a&&i){const s=this.parseVersion(e.version);if(e.npm)i.npmUri=e.npm;else if(this.predefinedNpm[e.uri])i.npmUri=this.predefinedNpm[e.uri];else{let e=/\/\/ npm:(.*)$/m.exec(i.file.contentUser);e&&(i.npmUri=e[1])}const o=async(e,i)=>{r[e.name]={file:e,uri:i,version:s,dependances:[]},"Aventus@Main"!=e.name&&(r[e.name].dependances=["Aventus@Main"]);for(let i of e.dependances){let s=await this.loadDependance(i,t,n,r);s&&(r[e.name].dependances.includes(s.name)||r[e.name].dependances.push(s.name))}};if(r[i.name]){let e=r[i.name].version;this.compareVersion(e,s,i.name)==s&&await o(i,a)}else await o(i,a)}return i}async loadByUri(e,t){let n=await d.FilesManager.getInstance().registerFilePackage(t);return new c.AventusPackageFile(n,e)}async loadLocal(e,t){let n=(0,o.pathToUri)((0,s.join)(this.path,"@locals",e));n.endsWith(l.AventusExtension.Package)||(n+=l.AventusExtension.Package);let r=await d.FilesManager.getInstance().registerFilePackage(n);return{uri:n,file:new c.AventusPackageFile(r,t)}}async loadHttp(e,t,n){try{let a=i(e),u=(0,s.join)(this.path,"http",a),p=(0,s.join)(u,"info.json"),_=(0,r.existsSync)(u);const{major:h,minor:f,patch:m}=this.parseVersion(t);if(!_||!(0,r.existsSync)(p))if(e.endsWith(l.AventusExtension.Package)){_||(0,r.mkdirSync)(u,{recursive:!0});let t=(0,s.join)(u,"temp.package.avt");if(!await this.downloadFile(t,e))return null;let n=await this.readFirstLine(t),i=/\/\/ (\S+):([0-9]+)\.([0-9]+)\.([0-9]+)/g.exec(n);if(i){let n=i[1],a=Number(i[2]),o=Number(i[3]),c=Number(i[4]),_={name:n,versions:{[a]:{[o]:{[c]:{uri:e,localUri:n+"#"+a+"."+o+"."+c+l.AventusExtension.Package}}}}};(0,r.writeFileSync)(p,JSON.stringify(_,null,4)),(0,r.renameSync)(t,(0,s.join)(u,n+"#"+a+"."+o+"."+c+l.AventusExtension.Package))}}else if(!await this.downloadFile(p,e))return null;let g=JSON.parse((0,r.readFileSync)(p,"utf8")),y=(e,t)=>{if(-1==e){let e=Math.max.apply(null,Object.keys(t));return{obj:t[e+""],v:e}}return{obj:t[e+""],v:e}},v=(()=>{let e=y(h,g.versions);if(void 0!==e.obj){let t=y(f,e.obj);if(void 0!==t.obj){let n=y(m,t.obj);if(void 0!==n.obj)return{info:n.obj,number:e.v+"."+t.v+"."+n.v}}}return null})();if(v){if(v.info.localUri&&(0,r.existsSync)((0,s.join)(u,v.info.localUri))){let e=(0,o.pathToUri)((0,s.join)(u,v.info.localUri)),t=await d.FilesManager.getInstance().registerFilePackage(e);return{uri:e,file:new c.AventusPackageFile(t,n)}}{let e=g.name+"#"+v.number+l.AventusExtension.Package,t=(0,o.pathToUri)((0,s.join)(u,e));if(!await this.downloadFile((0,s.join)(u,e),v.info.uri))return null;v.info.localUri=e;let i=await d.FilesManager.getInstance().registerFilePackage(t);return(0,r.writeFileSync)(p,JSON.stringify(g,null,4)),{uri:t,file:new c.AventusPackageFile(i,n)}}}}catch(e){}return null}downloadFile(e,t){return new Promise((n=>{const i=(0,r.createWriteStream)(e);try{(t.startsWith("https")?p.get:u.get)(t,(function(t){t.pipe(i),i.on("finish",(()=>{i.close(),n(!0)})),i.on("error",(()=>{i.close(),(0,r.unlinkSync)(e),n(!1)}))}))}catch(t){i.close(),(0,r.unlinkSync)(e),n(!1)}}))}readFirstLine(e){return new Promise((function(t,n){var i,s=(0,r.createReadStream)(e,{encoding:"utf8"}),a="",o=0;s.on("data",(function(e){i=e.indexOf("\n"),a+=e,-1!==i?s.close():o+=e.length})).on("close",(function(){t(a.slice(0,o+i))})).on("error",(function(e){n(e)}))}))}parseVersion(e){let t=/([0-9xX]+)\.([0-9xX]+)\.([0-9xX]+)/g.exec(e)??[0,-1,-1,-1];return{major:isNaN(Number(t[1]))?-1:Number(t[1]),minor:isNaN(Number(t[2]))?-1:Number(t[2]),patch:isNaN(Number(t[3]))?-1:Number(t[3])}}compareVersion(e,t,n){let r=r=>{if(-1==e[r])return-1==t[r]?null:t;if(-1==t[r])return e;if(e[r]==t[r])return null;{let r=Object.values(e).join("."),i=Object.values(t).join(".");return _.GenericServer.showErrorMessage(`Can't resolve version for dependance ${n} between ${r} and ${i}`),-1}},i=["major","minor","patch"];for(let e of i){let t=r(e);if("number"==typeof t)return null;if(t)return t}return e}}t.DependanceManager=h},50408:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Project=void 0;const r=n(71017),i=n(19408),s=n(50857),a=n(3006),o=n(3539),l=n(22399),c=n(83693),u=n(81940);t.Project=class{configFile;config=null;builds=[];statics=[];_isCoreBuild=!1;scssFiles={};onValidateUUID;onSaveUUID;onFormattingUUID;onCompletionUUID;onCompletionResolveUUID;onHoverUUID;onNewFileUUID;onFileDeleteUUIDs={};buildsAllowed;staticsAllowed;globalSCSSLanguageService;get isCoreBuild(){return this._isCoreBuild}getConfigFile(){return this.configFile}getConfig(){return this.config}resolveAlias(e,t){if(e.startsWith("@")){let n=e.split("/"),i=n[0],s=this.config?.aliases[i];if(s){let e=(0,r.normalize)(this.configFile.folderPath+"/"+s);"string"!=typeof t&&(t=t.folderPath);let i=(0,r.normalize)(t);e.endsWith(r.sep)&&(e=e.substring(0,e.length-1)),i.endsWith(r.sep)&&(i=i.substring(0,i.length-1));let a=e.split(r.sep),o=i.split(r.sep);for(let e=0;e<a.length;e++)if(o.length>e){if(a[e]!=o[e])break;a.splice(e,1),o.splice(e,1),e--}let l="";for(let e=0;e<o.length;e++)l+="../";return""==l&&(l+="./"),l+=a.join("/"),n.splice(0,1,l),n.join("/").replace(/\/\//g,"/")}}return e}getInternalWebComponentDefinition(e,t){for(let n of this.builds)if(n.outputPathes.includes(e))return n.getLocalWebComponentDefinition(t)}constructor(e,t){this.configFile=e,this.onValidateUUID=this.configFile.onValidate(this.onValidate.bind(this)),this.onSaveUUID=this.configFile.onSave(this.onConfigSave.bind(this)),this.onFormattingUUID=this.configFile.onFormatting(this.onFormatting.bind(this)),this.onCompletionUUID=this.configFile.onCompletion(this.onCompletion.bind(this)),this.onCompletionResolveUUID=this.configFile.onCompletionResolve(this.onCompletionResolve.bind(this)),this.onHoverUUID=this.configFile.onHover(this.onHover.bind(this)),this.onNewFileUUID=c.FilesManager.getInstance().onNewFile(this.onNewFile.bind(this)),e.folderUri.toLowerCase().endsWith("/aventus/base/src")&&(this._isCoreBuild=!0),this.globalSCSSLanguageService=new l.AventusGlobalSCSSLanguageService,t&&this.loadFiles(),e.validate()}async init(){await this.onConfigSave()}async onValidate(){return await s.AventusJSONLanguageService.getInstance().validate(this.configFile)}async loadConfig(){let e=await s.AventusJSONLanguageService.getInstance().getConfig(this.configFile);if(this.config){let t=JSON.stringify(this.config),n="";if(e&&(n=JSON.stringify(e)),t==n)return;for(let e of this.builds)e.destroy()}this.builds=[],this.config=e}async onConfigSave(){if(await this.loadConfig(),this.config){for(let e of this.config.build){if(this.buildsAllowed){if(!this.buildsAllowed.includes(e.name))continue}else if(e.disabled)continue;let t=new a.Build(this,e);this.builds.push(t),await t.init()}if(this.config.static)for(let e of this.config.static){if(this.staticsAllowed&&!this.staticsAllowed.includes(e.name))continue;let t=new o.Static(this,e);await t.export(),this.statics.push(t)}}}async onFormatting(e,t,n){return await s.AventusJSONLanguageService.getInstance().format(e,t,n)}async onCompletion(e,t){return await s.AventusJSONLanguageService.getInstance().doComplete(e,t)}async onCompletionResolve(e,t){return await s.AventusJSONLanguageService.getInstance().doResolve(t)}async onHover(e,t){return await s.AventusJSONLanguageService.getInstance().doHover(e,t)}getBuildsName(){let e=[];for(let t of this.builds)e.push(t.fullname);return e}getBuildsNameWithStory(){let e=[];for(let t of this.builds)t.hasStories&&e.push(t.fullname);return e}getBuild(e){for(let t of this.builds)if(t.fullname==e)return t}getBuilds(){return this.builds}getMatchingBuildsByUri(e){let t=[];for(let n of this.builds)n.isFileInside(e)&&t.push(n);return t}getStaticsName(){let e=[];for(let t of this.statics)e.push(t.name);return e}getStatic(e){for(let t of this.statics)if(t.name==e)return t}loadFiles(){let e=c.FilesManager.getInstance().getFilesWithExtension(i.AventusExtension.GlobalStyle);for(let t of e)this.onNewFile(t)}async onNewFile(e){e.path.endsWith(i.AventusExtension.GlobalStyle)&&(this.scssFiles[e.uri]||(this.scssFiles[e.uri]=new u.AventusGlobalSCSSFile(e,this),this.registerOnFileDelete(e)))}registerOnFileDelete(e){this.onFileDeleteUUIDs[e.uri]=e.onDelete(this.onFileDelete.bind(this))}async onFileDelete(e){e.removeOnDelete(this.onFileDeleteUUIDs[e.uri]),delete this.onFileDeleteUUIDs[e.uri],e.uri.endsWith(i.AventusExtension.GlobalStyle)&&delete this.scssFiles[e.uri]}async onRename(e){let t={};for(let n of this.builds){let r=await n.onRename(e);for(let e in r)t[e]||(t[e]=[]),t[e]=t[e].concat(r[e])}return t}destroy(){c.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID),this.configFile.removeOnSave(this.onSaveUUID),this.configFile.removeOnValidate(this.onValidateUUID),this.configFile.removeOnFormatting(this.onFormattingUUID),this.configFile.removeOnCompletion(this.onCompletionUUID),this.configFile.removeOnCompletionResolve(this.onCompletionResolveUUID),this.configFile.removeOnHover(this.onHoverUUID);for(let e of this.builds)e.destroy();for(let e of this.statics)e.destroy()}}},40529:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProjectManager=void 0;const r=n(19408),i=n(83693),s=n(50408);class a{static autoLoad=!0;static instance;static getInstance(){return this.instance||(this.instance=new a),this.instance}projects={};constructor(){i.FilesManager.getInstance().onNewFile(this.onNewFile.bind(this))}async onNewFile(e){if(e.documentUser.uri.endsWith(r.AventusExtension.Config)){let t=e.documentUser.uri.replace(r.AventusExtension.Config,r.AventusExtension.Template);if(i.FilesManager.getInstance().getByUri(t))return;this.projects[e.documentUser.uri]?console.error("a config file with the uri :"+e.documentUser.uri+" is already inside project manager"):(this.projects[e.documentUser.uri]=new s.Project(e,a.autoLoad),a.autoLoad&&await this.projects[e.documentUser.uri].init(),e.onDelete(this.onDeleteFile.bind(this)))}}async onDeleteFile(e){this.projects[e.documentUser.uri]&&(this.projects[e.documentUser.uri].destroy(),delete this.projects[e.documentUser.uri])}getProjectByUri(e){return this.projects[e]}getMatchingBuildsByUri(e){let t=[];for(let n in this.projects){let r=this.projects[n].getMatchingBuildsByUri(e);for(let e of r)t.push(e)}return t}destroyAll(){for(let e in this.projects)this.projects[e].destroy()}async onRename(e){let t={};for(let n in this.projects){let r=await this.projects[n].onRename(e);for(let e in r)t[e]||(t[e]=[]),t[e]=t[e].concat(r[e])}return t}getAllConfigFiles(){let e=[];for(let t in this.projects)e.push(this.projects[t].getConfigFile().uri);return e}getAllBuilds(){let e=[];for(let t in this.projects){let n=this.projects[t],r=n.getBuildsName();for(let t of r)e.push({name:t,uri:n.getConfigFile().uri})}return e}getAllBuildsWithStory(){let e=[];for(let t in this.projects){let n=this.projects[t],r=n.getBuildsNameWithStory();for(let t of r)e.push({name:t,uri:n.getConfigFile().uri})}return e}getAllStatics(){let e=[];for(let t in this.projects){let n=this.projects[t],r=n.getBuildsName();for(let t of r)e.push({name:t,uri:n.getConfigFile().uri})}return e}}t.ProjectManager=a},3539:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Static=void 0;const r=n(17452),i=n(71017),s=n(57147),a=n(69916),o=n(60206),l=n(19408),c=n(1539),u=n(29495),p=n(62814),_=n(83693),d=n(18952);t.Static=class{staticConfig;watcher;isReady=!1;project;get name(){return this.staticConfig.name}constructor(e,t){this.project=e,this.staticConfig=t,this.registerWatcher(),this.isReady=!0}async export(){if(this.isReady){p.Statistics.startSendStaticTime(this.name);const e=(e,t)=>{try{let n=(t=(0,i.normalize)(t)).split(i.sep),r=n.pop(),o=n.join(i.sep);if((0,s.existsSync)(o)||(0,s.mkdirSync)(o,{recursive:!0}),r.endsWith(".scss")){if(!r.startsWith("_")){let n=(0,a.compile)(e,{style:"compressed"}).css.toString().trim();(0,c.writeFile)(t.replace(".scss",".css"),n,"static",this.name)}}else(0,s.copyFileSync)(e,t),p.Statistics.sendFileSize(t,void 0,"static",this.name)}catch(e){console.log(e)}};let t=(e=>{var t=[],n=e=>{if((0,s.existsSync)(e)){(0,s.readdirSync)(e).forEach((r=>{let i=e+"/"+r;if((0,s.lstatSync)(i).isDirectory()){let e=n(i);e.length>0&&t.concat(e)}else t.push(i)}))}return t};return t=n(e)})(this.staticConfig.inputPathFolder);for(let n of t){n=n.replace(/\\/g,"/");for(let t of this.staticConfig.outputPathFolder){let r=n.replace(this.staticConfig.inputPathFolder,t);if(n.endsWith(l.AventusExtension.Base)){if(n.endsWith(l.AventusExtension.GlobalStyle)){r=r.replace(l.AventusExtension.GlobalStyle,".css");let e=this.project.scssFiles[(0,c.pathToUri)(n)];if(!e){const t=d.TextDocument.create((0,c.pathToUri)(n),l.AventusExtension.GlobalStyle,1,(0,s.readFileSync)(n,"utf8"));await _.FilesManager.getInstance().registerFile(t),e=this.project.scssFiles[(0,c.pathToUri)(n)]}e.addOutPath(r,this.name)}}else e(n,r)}}o.HttpServer.getInstance().reload(),p.Statistics.sendStaticTime(this.name)}}registerWatcher(){u.SettingsManager.getInstance().settings.onlyBuild||(this.watcher=(0,r.watch)(this.staticConfig.inputPathFolder,{ignored:/^\./,persistent:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:100},ignoreInitial:!0}),this.watcher.on("add",(e=>{this.export()})),this.watcher.on("change",(e=>{this.export()})),this.watcher.on("unlink",(e=>{this.export()})),this.watcher.on("error",(function(e){})))}destroy(){this.watcher&&this.watcher.close()}}},20239:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultMdxTempate=function(){return"import Meta from './$name$.stories'\n$blocks$\n$render$\n\n$tag$\n\n$live$\n"}},43150:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultStoryTempate=function(){return"import type { Meta, Story } from '@aventusjs/storybook'\nimport Template from './$name$_.mdx'\n\nconst meta: Meta = {\n\ttitle: '$fullname$',\n\tparameters: {\n docs: {\n page: Template,\n description: {\n component: `$description$`\n },\n }\n },\n $argTypes$\n $args$\n $aventus$\n}\n\nexport default meta;\n\n$defaultStory$\n"},t.defaultStoryTempateComponent=function(){return"import { type Meta, type Story, render } from '@aventusjs/storybook'\nimport Template from './$name$_.mdx'\n$importPathes$\n\nconst meta: Meta = {\n\ttitle: '$fullname$',\n render: (args) => render(args, $name$),\n\tparameters: {\n docs: {\n page: Template,\n description: {\n component: `$description$`\n },\n }\n },\n $argTypes$\n $args$\n $aventus$\n}\n\nexport default meta;\n\n$defaultStory$\n"}},7295:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mainTemplate=function(){return'import type { StorybookConfig } from "@storybook/web-components-vite";\nimport remarkGfm from \'remark-gfm\';\n\nconst config: StorybookConfig = {\n stories: ["$path$/**/!(*_).mdx", "$path$/**/*.stories.@(js|jsx|mjs|ts|tsx)"],\n addons: [\n "@storybook/addon-links",\n "@storybook/addon-essentials",\n "@storybook/addon-styling-webpack",\n {\n name: \'@storybook/addon-docs\',\n options: {\n csfPluginOptions: null,\n mdxPluginOptions: {\n mdxCompileOptions: {\n remarkPlugins: [remarkGfm],\n },\n },\n },\n },\n ],\n framework: {\n name: "@storybook/web-components-vite",\n options: {},\n },\n managerHead: (head) => `\n ${head}\n <style>.sidebar-item[data-item-id$="--default-story"] { display: none; }</style>\n `,\n staticDirs: [\'../static\'],\n docs: {\n autodocs: true\n }\n};\nexport default config;\n'}},80861:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.previewTemplate=function(){return"import { Preview } from '@storybook/web-components';\n \nconst preview: Preview = {\n parameters: {\n options: {\n storySort: (a, b) => a.title.localeCompare(b.title),\n },\n },\n};\n \nexport default preview;"}},48703:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Storie=void 0;const r=n(71017),i=n(57147),s=n(24964),a=n(22037),o=n(1539),l=n(7295),c=n(20239),u=n(43150),p=n(80861),_=n(16286);class d{static getFullname(e){let t=e.fullName.replace(/\./g,"/"),n=!1,r=e.build.buildConfig;const i=e=>{""===e||(t=e.endsWith("/")?e+t:e+"/"+t)};return e.storieDecorator&&(void 0!==e.storieDecorator.group&&(t=e.storieDecorator.group?e.storieDecorator.group+"/"+e.name:e.name),void 0!==e.storieDecorator.prefix&&(n=!0,i(e.storieDecorator.prefix))),n||void 0===r.stories?.prefix||i(r.stories.prefix),t}build;buildConfig;constructor(e,t){this.build=e,this.buildConfig=t}async check(){this.readEnvStoryBook()}write(e,t=!1){t&&this.clear();for(let t in e){let n=e[t];if(n.fileParsed){for(let e in n.fileParsed.classes){const t=n.fileParsed.classes[e];this.writeStory(t,n)}for(let e in n.fileParsed.aliases){const t=n.fileParsed.aliases[e];this.writeStory(t)}for(let e in n.fileParsed.enums){const t=n.fileParsed.enums[e];this.writeStory(t)}for(let e in n.fileParsed.functions){const t=n.fileParsed.functions[e];this.writeStory(t)}for(let e in n.fileParsed.variables){const t=n.fileParsed.variables[e];this.writeStory(t)}}}}clear(){if(!this.buildConfig.stories)return;(0,r.join)(this.buildConfig.stories.output,"auto")}writeStory(e,t){if(!e.storieContent)return;if(!this.buildConfig.stories)return;const n=e.storieContent;let s=(0,r.join)(this.buildConfig.stories.output,"generated"),l=(0,r.join)(this.buildConfig.stories.output,"auto",...e.fullName.split(".")),p=(0,o.uriToPath)((0,o.getFolder)((0,o.pathToUri)(l)));(0,i.existsSync)(p)||(0,i.mkdirSync)(p,{recursive:!0});const h=()=>{let n=!1;return e.storieDecorator&&(e.storieDecorator.noLive||e.storieDecorator.noDefaultStory)&&(n=!0),t instanceof _.AventusWebComponentLogicalFile&&t.fileParsed?.classes[t.componentClassName]&&!t.fileParsed.classes[t.componentClassName].isAbstract&&!n};(()=>{let t=(0,c.defaultMdxTempate)();t=this.replaceVariable(t,"name",e.name);let r=`<av-story-${n.kind}-render json={JSON.stringify(Meta.aventus)}></av-story-${n.kind}-render>`;t=this.replaceVariable(t,"tag",r),t=h()?this.replaceVariable(t,"live","\n<div>\n <Title>Live</Title>\n <Canvas />\n <Controls />\n</div>"):this.replaceVariable(t,"live",""),t=this.replaceVariable(t,"blocks","import { Canvas, Controls, Title } from '@storybook/blocks'");let i=n.kind[0].toUpperCase()+n.kind.slice(1);t=this.replaceVariable(t,"render",`import { Story${i}Render } from '@aventusjs/storybook-render/AventusStorybook'`),this.writeFile(l+"_.mdx",t)})(),(()=>{let i=!0;e.storieDecorator&&e.storieDecorator.noDefaultStory&&(i=!1);let c=h()?(0,u.defaultStoryTempateComponent)():(0,u.defaultStoryTempate)(),p=e.name,f=d.getFullname(e);if(c=this.replaceVariable(c,"name",p),c=this.replaceVariable(c,"fullname",f),c=this.replaceVariable(c,"description",e.documentation?.definitions.join("\n").replace(/`/g,"\\`")??""),c=this.replaceVariable(c,"aventus","aventus: "+JSON.stringify(n,null,2)+","),c=this.replaceVariable(c,"defaultStory",i?"export const DefaultStory: Story = {}":""),t instanceof _.AventusWebComponentLogicalFile){c=this.replaceVariable(c,"argTypes","argTypes: "+JSON.stringify(t.storyBookInfo.argsTypes,null,2)+","),c=this.replaceVariable(c,"args","args: "+(e=>{let t="{"+a.EOL;for(let n in e){let r=e[n];"string"==typeof r&&(r=r.replace(/\\"/g,"")),""==r&&(r='""'),t+='\t"'+n+'":'+r+","+a.EOL}return t+="}",t})(t.storyBookInfo.args)+",");let e=t.fileParsed?.classes[t.componentClassName].storieInject??{},i=(0,r.join)(s,...n.namespace.split(".")),u=(0,o.simplifyUri)((0,o.pathToUri)(i),(0,o.pathToUri)(l));e[u]?e[u].includes(p)||e[u].push(p):e[u]=[p];const _=[];for(let t in e)_.push(`import { ${e[t].join(", ")} } from '${t}';`);c=this.replaceVariable(c,"importPathes",_.join("\n"))}else c=this.replaceVariable(c,"argTypes",""),c=this.replaceVariable(c,"args","");this.writeFile(l+".stories.ts",c)})()}readEnvStoryBook(){if(!this.buildConfig.stories)return;(0,i.existsSync)(this.buildConfig.stories.output)||(0,i.mkdirSync)(this.buildConfig.stories.output,{recursive:!0});const e=this.buildConfig.stories.output,t={name:("@"+this.buildConfig.module+"/"+this.buildConfig.name+"_storybook").toLowerCase(),displayName:this.buildConfig.module+" "+this.buildConfig.name+"_storybook",description:"Aventus storybook for @"+this.buildConfig.module+"/"+this.buildConfig.name,version:this.buildConfig.version};if(0==(0,i.readdirSync)(this.buildConfig.stories.output).length){let n=s.GenericServer.extensionPath+r.sep+"templates"+r.sep+"storybook",a=(0,i.readdirSync)(n),o="";const l=n=>{let s=(0,i.readdirSync)(n);for(let a of s){let s=n+r.sep+a,c=s.replace(o,e);for(let e in t){const n=new RegExp("\\$\\{\\{"+e+"\\}\\}","gm");c=c.replace(n,t[e])}if(c=(0,r.normalize)(c),(0,i.statSync)(s).isDirectory()){if(".git"==a)continue;(0,i.mkdirSync)(c),l(s)}else if(/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(s.toLowerCase()))(0,i.copyFileSync)(s,c);else{let e=(0,i.readFileSync)(s,"utf-8");for(let n in t){const r=new RegExp("\\$\\{\\{"+n+"\\}\\}","gm");e=e.replace(r,t[n])}if("package.json"==a){let t=JSON.parse(e);t.devDependencies||(t.devDependencies={});for(let e of this.build.externalPackageInformation.filesUri){let n=this.build.externalPackageInformation.getByUri(e);n&&(n.npmUri&&n.name!=this.buildConfig.fullname&&(t.devDependencies[n.npmUri]="^"+n.versionTxt))}const n=Object.keys(t.devDependencies).sort().reduce(((e,n)=>(e[n]=t.devDependencies[n],e)),{});t.devDependencies=n,e=JSON.stringify(t,null,4)}this.writeFile(c,e)}}};if(1!=a.length)throw"TODO code multiple template";o=n+r.sep+a[0],l(o)}const n=this.buildConfig.stories.workspace?(0,r.resolve)(this.build.project.getConfigFile().folderPath,this.buildConfig.stories.workspace):e,a=(0,r.join)(n,".storybook");(0,i.existsSync)(a)||(0,i.mkdirSync)(a,{recursive:!0});const c=(0,r.join)(a,"main.ts");if(!(0,i.existsSync)(c)){let e=(0,l.mainTemplate)(),t=(0,o.simplifyUri)((0,o.pathToUri)(this.buildConfig.stories.output),(0,o.pathToUri)(c));e=this.replaceVariable(e,"path",t),this.writeFile(c,e)}const u=(0,r.join)(a,"preview.ts");if(!(0,i.existsSync)(u)){let e=(0,p.previewTemplate)();this.writeFile(u,e)}}replaceVariable(e,t,n){let r=new RegExp("\\$"+t+"\\$","g");return e=e.replace(r,n)}writeFile(e,t){(0,o.writeFile)(e,t,"storybook")}}t.Storie=d},29495:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsManager=void 0;const n={liveserver:{host:"0.0.0.0",autoIncrementPort:!0,port:8080,rootFolder:"./dist",indexFile:"index.html",delay:200,launch_browser:!0,browser:"",auto_close:!0},updateImportOnRename:!0,readNodeModules:!1,templatePath:[],projectPath:[],readDirs:[],onlyBuild:!1,debug:!1,useStats:!1};function r(){return JSON.parse(JSON.stringify(n))}class i{static instance;_settings=r();get settings(){return this._settings}static getInstance(){return this.instance||(this.instance=new i),this.instance}constructor(){}setSettings(e){this._settings=this.mergeDeep(r(),e);let t=[...this.cbOnSettingsChange];for(let e of t)e()}cbOnSettingsChange=[];onSettingsChange(e){this.cbOnSettingsChange.push(e)}isObject(e){return e&&"object"==typeof e&&!Array.isArray(e)}mergeDeep(e,...t){if(!t.length)return e;const n=t.shift();if(this.isObject(e)&&this.isObject(n))for(const t in n)this.isObject(n[t])?(e[t]||Object.assign(e,{[t]:{}}),this.mergeDeep(e[t],n[t])):Object.assign(e,{[t]:n[t]});return this.mergeDeep(e,...t)}}t.SettingsManager=i},1539:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Timer=t.JS_WORD_REGEX=void 0,t.pathToUri=function(e){if(e.startsWith("file://"))return e;if("/"===r.sep)return"file://"+u(encodeURI(e.replace(/\\/g,"/")));return"file:///"+u(encodeURI(e.replace(/\\/g,"/")))},t.normalizeUri=u,t.normalizePath=function(e){return e.replace(/%3A/g,":").replace(/%40/g,"@")},t.uriToPath=function(e){if("/"===r.sep)return decodeURIComponent(e.replace("file://",""));return decodeURIComponent(e.replace("file:///",""))},t.reorderList=function(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1);e.splice(0,0,t)},t.getLanguageIdByUri=function(e){let t=Object.keys(a.AventusExtension).reverse();for(let n of t)if(e.endsWith(a.AventusExtension[n]))return p(a.AventusExtension[n]);return""},t.getLanguageIdByExtension=p,t.createErrorTs=_,t.createErrorTsSection=function(e,t,n,r,o){let l=new RegExp("//#region "+n+"(\\s|\\S)*?//#endregion").exec(e.getText());if(l){let c=l.index+10+n.length,u=l.index+l[0].length,p={range:s.Range.create(e.positionAt(c),e.positionAt(u)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,i.flattenDiagnosticMessageText)(t,"\n"),code:r};return o&&(p.data=o),p}return _(e,t,r)},t.createErrorTsPos=d,t.createErrorScss=function(e,t){return h(e,t,0,e.getText().length)},t.createErrorScssPos=h,t.createErrorHTMLPos=function(e,t,n,r){return{range:s.Range.create(e.positionAt(n),e.positionAt(r)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.HTML,message:(0,i.flattenDiagnosticMessageText)(t,"\n")}},t.getFolder=function(e){let t=e.split("/");return t.pop(),t.join("/")},t.convertRange=function(e,t){if(void 0===t.start){const t=e.positionAt(0);return s.Range.create(t,t)}const n=e.positionAt(t.start),r=e.positionAt(t.start+(t.length||0));return s.Range.create(n,r)},t.checkTxtBefore=function(e,t,n){let r=e.documentUser.offsetAt(t)-1,i=n.length-1,s=n[i];for(;r>0;)if(" "!=e.contentUser[r]){if(e.contentUser[r]!=s)return!1;if(i--,-1==i)return!0;s=n[i],r--}return!1},t.checkTxtAfter=function(e,t,n){let r=e.documentUser.offsetAt(t),i=e.documentUser.getText().length,s=0,a=n[s];for(;r<=i;)if(" "!=e.contentUser[r]){if(e.contentUser[r]!=a)return!1;if(s++,s==n.length)return!0;a=n[s],r++}return!1},t.replaceNotImportAliases=function(e,t){if(!t)return e;let n=t.aliases;for(let t in n)if(!t.startsWith("@")){let r=f(t),i=new RegExp("(?<!\\\\)"+r,"g");e=e.replace(i,n[t])}return e},t.escapeRegex=f,t.getWordAtText=function(e,n){let r=t.JS_WORD_REGEX,i=n;for(;i>0&&(s=e.charCodeAt(i-1),s!=="\r".charCodeAt(0)&&s!=="\n".charCodeAt(0));)i--;var s;const a=n-i,o=e.substr(i),l=r.ignoreCase?"gi":"g";r=new RegExp(r.source,l);let c=r.exec(o);for(;c&&c.index+c[0].length<a;)c=r.exec(o);if(c&&c.index<=a)return{start:c.index+i,length:c[0].length};return{start:n,length:0}},t.simplifyUri=function(e,t){e=decodeURIComponent(e);let n=(t=decodeURIComponent(t)).split("/");n.pop();let r=e.split("/");for(let e=0;e<n.length;e++)if(r.length>e){if(n[e]!=r[e])break;n.splice(e,1),r.splice(e,1),e--}let i="";for(let e=0;e<n.length;e++)i+="../";""==i&&(i+="./");return i+=r.join("/"),i},t.setValueToObject=function(e,t,n){e=e.replace(/\[(.*?)\]/g,".$1");let r=e.split(".");for(let e=0;e<r.length-1;e++){let n=r[e],s=(i=n,t instanceof Map?t.get(i):t[i]);s||(t[n]={},s=t[n]),t=s}var i;t instanceof Map?t.set(r[r.length-1],n):t[r[r.length-1]]=n},t.writeFile=function(e,t,n,r){let i=l(t),s=(0,o.existsSync)(e);m[e]&&m[e]==i&&s||(m[e]=i,c.Statistics.sendFileSize(e,t,n,r),(0,o.writeFileSync)(e,t))};const r=n(71017),i=n(94625),s=n(42374),a=n(19408),o=n(57147),l=n(61586),c=n(62814);function u(e){return e.replace(/:/g,"%3A").replace(/@/g,"%40")}function p(e){return".wcv.avt"==e?a.AventusLanguageId.HTML:".wcs.avt"==e?a.AventusLanguageId.SCSS:a.AventusLanguageId.TypeScript}function _(e,t,n,r){return d(e,t,0,e.getText().length,n,r)}function d(e,t,n,r,o,l){let c={range:s.Range.create(e.positionAt(n),e.positionAt(r)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,i.flattenDiagnosticMessageText)(t,"\n"),code:o};return l&&(c.data=l),c}function h(e,t,n,r){return{range:s.Range.create(e.positionAt(n),e.positionAt(r)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.SCSS,message:(0,i.flattenDiagnosticMessageText)(t,"\n")}}function f(e,t=!1){return t?e.replace(/[\\^$+?.()|[\]{}]/g,"\\$&"):e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}t.JS_WORD_REGEX=/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g;const m={};t.Timer=class{static timers={};static start(e){this.timers[e]=process.hrtime()}static stop(e){const t=process.hrtime(this.timers[e]),n=t[1]/1e6;return delete this.timers[e],1e3*t[0]+Math.round(n)}}},94625:(e,t,n)=>{
|
|
305
|
+
*/e.exports=function(e){return e.split(" ").map((function(e){return e.slice(0,1).toUpperCase()+e.slice(1)})).join("").replace(/[^ _0-9a-z]/gi,"")}},24964:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GenericServer=void 0;const r=n(83693),i=n(71743),s=n(19490),a=n(40529),o=n(29495),l=n(19408),c=n(32377),u=n(53784),p=n(71017),_=n(46492),d=n(5441),h=n(2741);class f{static instance;static delayBetweenBuild(){return this.instance.connection.delayBetweenBuild()}static isDebug(){return this.instance.isDebug}static get isIDE(){return this.instance.isIDE}static sendNotification(e,...t){this.instance.connection.sendNotification(e,t)}static showErrorMessage(e){this.instance.connection.showErrorMessage(e)}static showWarningMessage(e){this.instance.connection.showWarningMessage(e)}static showInformationMessage(e){this.instance.connection.showInformationMessage(e)}static sendDiagnostics(e,t){this.instance.connection.sendDiagnostics(e,t?.buildConfig.name)}static Input(e){return this.instance.connection.Input(e)}static Select(e,t){return this.instance.connection.Select(e,t)}static SelectMultiple(e,t){return this.instance.connection.SelectMultiple(e,t)}static SelectFolder(e,t){return this.instance.connection.SelectFolder(e,t)}static Popup(e,...t){return this.instance.connection.Popup(e,...t)}static get savePath(){return this.instance._savePath}static get extensionPath(){return this.instance._extensionPath}static getWorkspaceUri(){return this.instance.workspaces[0]??""}static get templateManager(){return this.instance._template}static get localTemplateManager(){return this.instance._localTemplate}static refreshSettings(){return this.instance.loadSettings()}connection;isLoading=!0;workspaces=[];isDebug=!1;isIDE=!1;_savePath="";_extensionPath="";_template;_localTemplate;constructor(e){this.connection=e,this.bindEvent()}start(){f.instance=this,this.connection.open()}bindEvent(){this.connection.onInitialize((e=>{this.onInitialize(e)})),this.connection.onInitialized((async()=>{this.onInitialized()})),this.connection.onShutdown((async()=>{await this.onShutdown()})),this.connection.onCompletion((async(e,t)=>await this.onCompletion(e,t))),this.connection.onCompletionResolve((async(e,t)=>await this.onCompletionResolve(e,t))),this.connection.onHover((async(e,t)=>await this.onHover(e,t))),this.connection.onDefinition((async(e,t)=>await this.onDefinition(e,t))),this.connection.onDocumentFormatting((async(e,t)=>await this.onDocumentFormatting(e,t))),this.connection.onCodeAction((async(e,t)=>await this.onCodeAction(e,t))),this.connection.onCodeLens((async e=>await this.onCodeLens(e))),this.connection.onReferences((async(e,t)=>await this.onReferences(e,t))),this.connection.onRenameRequest((async(e,t,n)=>await this.onRenameRequest(e,t,n))),this.connection.onDocumentColor((async e=>await this.onDocumentColor(e))),this.connection.onColorPresentation((async(e,t,n)=>await this.onColorPresentation(e,t,n))),this.connection.onExecuteCommand((async e=>await this.onExecuteCommand(e))),this.connection.onDidChangeConfiguration((async()=>await this.onDidChangeConfiguration()))}onInitialize(e){if(e.workspaceFolders)for(let t of e.workspaceFolders)this.workspaces.push(t.uri);if(!e.savePath){let t=process.env.APPDATA||("darwin"==process.platform?process.env.HOME+"/Library/Preferences":process.env.HOME+"/.local/share");e.savePath=(0,p.join)(t,"aventus")}this.isIDE=e.isIDE,this._savePath=e.savePath,this._extensionPath=e.extensionPath,this._template=new d.TemplateManager,this._localTemplate=new _.LocalTemplateManager(this._template)}async onInitialized(){await this.loadSettings(),await this.startServer()}async onShutdown(){await i.FilesWatcher.getInstance().destroy(),a.ProjectManager.getInstance().destroyAll(),s.TemplateManager.getInstance().destroy(),h.CSharpManager.getInstance().destroy(),await r.FilesManager.getInstance().onShutdown()}async onCompletion(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCompletion(e,t):null}async onCompletionResolve(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCompletionResolve(e,t):t}async onHover(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onHover(e,t):null}async onDefinition(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onDefinition(e,t):null}async onDocumentFormatting(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onFormatting(e,t):null}async onCodeAction(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCodeAction(e,t):null}async onCodeLens(e){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onCodeLens(e):null}async onReferences(e,t){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onReferences(e,t):null}async onRenameRequest(e,t,n){return e&&this.isAllowed(e)?await r.FilesManager.getInstance().onRename(e,t,n):null}async onDocumentColor(e){return e&&this.isStyleDocument(e)?c.ColorPicker.onDocumentColor(e):null}async onColorPresentation(e,t,n){return e&&this.isStyleDocument(e)?c.ColorPicker.onColorPresentations(e,t,n):null}async onExecuteCommand(e){u.Commands.execute(e)}async onDidChangeConfiguration(){this.loadSettings()}isAllowed(e){return f.isAllowed(e)}static isAllowed(e){return!this.instance.isLoading&&!(!e.uri.endsWith(l.AventusExtension.Base)&&!e.uri.endsWith(l.AventusExtension.Config))}isStyleDocument(e){return!!e.uri.endsWith(l.AventusExtension.ComponentStyle)||(!!e.uri.endsWith(l.AventusExtension.Component)||!!e.uri.endsWith(l.AventusExtension.GlobalStyle))}async loadSettings(){let e=await this.connection.getSettings();e||(e={}),o.SettingsManager.getInstance().setSettings(e),this.isDebug=o.SettingsManager.getInstance().settings.debug}async startServer(){const e=o.SettingsManager.getInstance().settings;e.onlyBuild||(s.TemplateManager.getInstance(),h.CSharpManager.getInstance()),a.ProjectManager.getInstance(),e.onlyBuild?e.configPath?await r.FilesManager.getInstance().loadConfigFile(e.configPath,e.builds,e.statics):await r.FilesManager.getInstance().loadConfigFileNotSet(this.workspaces,e.builds,e.statics):await r.FilesManager.getInstance().loadAllAventusFiles(this.workspaces),this.isLoading=!1,this.isDebug&&console.log("start server done")}}t.GenericServer=f},25655:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddConfigSection=void 0;const r=n(57147),i=n(49404),s=n(1539),a=n(24964),o=n(40529);t.AddConfigSection=class{static cmd="aventus.addConfigSection";static async run(e){try{if(!e){let t=[],n=o.ProjectManager.getInstance().getAllConfigFiles();for(let e of n)t.push({label:e});let r=await a.GenericServer.Select(t,{placeHolder:"Project to compile"});if(!r)return;e=r.label}const t=await a.GenericServer.Input({title:"Provide a name for your config section"});if(!t)return;let n=(0,r.readFileSync)((0,s.uriToPath)(e),"utf8"),l=JSON.parse(n),c=t.replace(/ /g,"-"),u={name:t,inputPath:[],outputFile:"./dist/"+c+".js"};l.build.push(u),(0,r.writeFileSync)((0,s.uriToPath)(e),JSON.stringify(l,null,4)),i.OpenFile.send(e)}catch(e){console.error(e)}}}},11932:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BuildProject=void 0;const r=n(40529),i=n(24964);t.BuildProject=class{static cmd="aventus.compile";static async run(){let e=[],t=r.ProjectManager.getInstance().getAllBuilds();for(let n of t)e.push({label:n.name,detail:n.uri});let n=await i.GenericServer.Select(e,{placeHolder:"Project to compile"});if(n){let e=n.detail??"",t=n.label;r.ProjectManager.getInstance().getProjectByUri(e)?.getBuild(t)?.build()}}}},15993:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Create=void 0;const r=n(1539),i=n(40529),s=n(24964),a=n(71017);class o{static cmd="aventus.create";static async run(e){if(!e)return;let t=(0,a.normalize)((0,r.uriToPath)(e));if(o.checkIfProject(e)){if(!s.GenericServer.isIDE){let n=await s.GenericServer.SelectFolder("Select where to create",t);if(!n)return;e=n,t=(0,r.uriToPath)(e)}await(s.GenericServer.localTemplateManager?.createTemplate(t))}else{await s.GenericServer.Select([{label:"Init",detail:"Create a project"}],{placeHolder:"What do you want to create?"})&&await(s.GenericServer.templateManager?.createProject(t))}}static checkIfProject(e){let t=i.ProjectManager.getInstance().getAllConfigFiles(),n=e.replace(/\\/g,"/");for(let e of t)if(n.startsWith(e.replace("/aventus.conf.avt","")))return!0;return!1}}t.Create=o},35614:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MergeComponent=void 0;const r=n(18952),i=n(57147),s=n(19408),a=n(83693),o=n(64945),l=n(49404),c=n(1539);function u(e){return e.split("\n").join("\n\t")}t.MergeComponent=class{static cmd="aventus.component.merge";static async run(e){if(!e)return;let t=new RegExp("("+s.AventusExtension.ComponentLogic+")|("+s.AventusExtension.ComponentView+")|("+s.AventusExtension.ComponentView+")$"),n=e.replace(t,""),p=n.split("/"),_=p.pop(),d=p.pop(),h=p.join("/")+"/"+_,f=0,m=a.FilesManager.getInstance().getByUri(n+s.AventusExtension.ComponentLogic);m&&m.versionUser>f&&(f=m.versionUser);let g=m?m.contentUser:"",y=a.FilesManager.getInstance().getByUri(n+s.AventusExtension.ComponentStyle);y&&y.versionUser>f&&(f=y.versionUser);let v=y?y.contentUser:"",$=a.FilesManager.getInstance().getByUri(n+s.AventusExtension.ComponentView);$&&$.versionUser>f&&(f=$.versionUser);let b=$?$.contentUser:"",S=`\n<script>\n\t${u(g)}\n<\/script>\n\n<template>\n\t${u(b)}\n</template>\n\n<style>\n\t${u(v)}\n</style>\n`,x=r.TextDocument.create(h+s.AventusExtension.Component,s.AventusLanguageId.WebComponent,f+1,S);(0,i.writeFileSync)((0,c.uriToPath)(x.uri),S),y&&((0,i.unlinkSync)(y.path),a.FilesManager.getInstance().onClose(y.documentUser),o.CloseFile.send(y.uri)),m&&((0,i.unlinkSync)(m.path),a.FilesManager.getInstance().onClose(m.documentUser),o.CloseFile.send(m.uri)),$&&((0,i.unlinkSync)($.path),a.FilesManager.getInstance().onClose($.documentUser),o.CloseFile.send($.uri)),(0,i.rmdirSync)((0,c.uriToPath)(p.join("/")+"/"+d)),a.FilesManager.getInstance().registerFile(x),l.OpenFile.send(x.uri)}}},20079:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PopupResponse=void 0;const r=n(43438);t.PopupResponse=class{static cmd="aventus.popupresponse";static run(e,t){r.Popup.resolve(e,t)}}},67687:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveInput=void 0;const r=n(93401);t.ReceiveInput=class{static cmd="aventus.receiveinput";static run(e,t){r.AskInput.resolve(e,t)}}},811:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveSelect=void 0;const r=n(64961);t.ReceiveSelect=class{static cmd="aventus.receiveselect";static run(e,t){r.AskSelect.resolve(e,t)}}},70140:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveSelectMultiple=void 0;const r=n(39567);t.ReceiveSelectMultiple=class{static cmd="aventus.receiveselectmultiple";static run(e,t){r.AskSelectMultiple.resolve(e,t)}}},17519:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReloadSettings=void 0;const r=n(24964);t.ReloadSettings=class{static cmd="aventus.reloadSettings";static async run(){r.GenericServer.refreshSettings()}}},88933:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rename=void 0;const r=n(1539),i=n(57147),s=n(71017),a=n(40529),o=n(29495),l=n(83693);t.Rename=class{static cmd="aventus.rename";static async run(e){if(!o.SettingsManager.getInstance().settings.updateImportOnRename)return;if(!e)return;let t=[];for(let n of e){let e,a=n.newUri,o=n.oldUri,l=(0,r.uriToPath)(a),c=(0,r.uriToPath)(o),u=!0;if((0,i.existsSync)(l)?e=l:(u=!1,e=c),(0,i.statSync)(e).isDirectory()){const n=e=>{let l=(0,i.readdirSync)(e);for(let c of l){let l=(0,s.join)(e,c);if((0,i.statSync)(l).isDirectory())n(l);else{let e=(0,r.pathToUri)(l);u?t.push({newUri:e,oldUri:e.replace(a,o)}):t.push({newUri:e.replace(o,a),oldUri:e})}}};n(e)}else t.push({oldUri:o,newUri:a})}let n=await a.ProjectManager.getInstance().onRename(t),c={},u=l.FilesManager.getInstance();for(let e in n){let t=u.getByUri(e);t&&(await t.applyTextEdits(n[e]),c[(0,r.uriToPath)(t.uri)]=t.contentUser)}setTimeout((()=>{for(let e in c)(0,i.writeFileSync)(e,c[e])}),500)}}},79993:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SplitComponent=void 0;const r=n(57147),i=n(18952),s=n(19408),a=n(83693),o=n(22163),l=n(64945),c=n(49404),u=n(1539);t.SplitComponent=class{static cmd="aventus.component.split";static async run(e){if(!e)return;let t=e.split("/").pop()?.replace(s.AventusExtension.Component,""),n=a.FilesManager.getInstance().getByUri(e);if(n){let p=(0,u.uriToPath)(e.replace(s.AventusExtension.Component,""));(0,r.existsSync)(p)||(0,r.mkdirSync)(p);const _=e.replace(s.AventusExtension.Component,"")+"/"+t;let d=o.AventusWebComponentSingleFile.getRegion(n),h=_+s.AventusExtension.ComponentStyle,f=i.TextDocument.create(h,s.AventusLanguageId.SCSS,n.versionUser+1,d.cssText??"");(0,r.writeFileSync)((0,u.uriToPath)(h),f.getText());let m=_+s.AventusExtension.ComponentView,g=i.TextDocument.create(m,s.AventusLanguageId.HTML,n.versionUser+1,d.htmlText??"");(0,r.writeFileSync)((0,u.uriToPath)(m),g.getText());let y=_+s.AventusExtension.ComponentLogic,v=i.TextDocument.create(y,s.AventusLanguageId.TypeScript,n.versionUser+1,d.scriptText??"");(0,r.writeFileSync)((0,u.uriToPath)(y),v.getText()),(0,r.unlinkSync)(n.path),a.FilesManager.getInstance().onClose(n.documentUser),l.CloseFile.send(n.uri),a.FilesManager.getInstance().registerFile(f),a.FilesManager.getInstance().registerFile(g),a.FilesManager.getInstance().registerFile(v),c.OpenFile.send(v.uri)}}}},67112:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StaticExport=void 0;const r=n(40529),i=n(24964);t.StaticExport=class{static cmd="aventus.static";static async run(){let e=[],t=r.ProjectManager.getInstance().getAllStatics();for(let n of t)e.push({label:n.name,detail:n.uri});let n=await i.GenericServer.Select(e,{placeHolder:"Static to export"});if(n){let e=n.detail??"",t=n.label;await(r.ProjectManager.getInstance().getProjectByUri(e)?.getStatic(t)?.export())}}}},4855:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileCreated=void 0;const r=n(83693);t.FileCreated=class{static cmd="aventus.filesystem.created";static run(e){e&&r.FilesManager.getInstance().onCreatedUri(e)}}},82786:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDeleted=void 0;const r=n(83693);t.FileDeleted=class{static cmd="aventus.filesystem.deleted";static async run(e){e&&r.FilesManager.getInstance().onDeletedUri(e)}}},51525:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileUpdated=void 0;const r=n(83693);t.FileUpdated=class{static cmd="aventus.filesystem.updated";static async run(e){e&&r.FilesManager.getInstance().onUpdatedUri(e)}}},75206:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportProject=void 0;const r=n(24964);t.ImportProject=class{static cmd="aventus.template.import_project";static async run(){await(r.GenericServer.templateManager?.selectProjectToImport())}}},2816:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportTemplate=void 0;const r=n(24964);t.ImportTemplate=class{static cmd="aventus.template.import";static async run(){await(r.GenericServer.templateManager?.selectTemplateToImport())}}},8681:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenAventusFolder=void 0;const r=n(24964),i=n(57147),s=n(22037),a=n(32081);t.OpenAventusFolder=class{static cmd="aventus.filesystem.openAventus";static async run(){let e,t=r.GenericServer.savePath;switch((0,i.existsSync)(t)||(0,i.mkdirSync)(t),(0,s.platform)()){case"win32":e="explorer";break;case"linux":e="xdg-open";break;case"darwin":e="open"}let n=[t];(0,a.spawn)(e,n,{detached:!0}).unref()}}},53784:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Commands=void 0;const r=n(25655),i=n(11932),s=n(15993),a=n(4855),o=n(82786),l=n(51525),c=n(35614),u=n(79993),p=n(76914),_=n(1064),d=n(67112),h=n(36954),f=n(87152),m=n(72810),g=n(73480),y=n(71018),v=n(3650),$=n(88933),b=n(14043),S=n(8681),x=n(20079),w=n(67687),C=n(811),E=n(70140),k=n(2816),A=n(71171),T=n(17519),I=n(37779),F=n(18980),N=n(75206);t.Commands={allCommandes:{[i.BuildProject.cmd]:i.BuildProject,[p.StartServer.cmd]:p.StartServer,[h.StopServer.cmd]:h.StopServer,[_.ToggleServer.cmd]:_.ToggleServer,[s.Create.cmd]:s.Create,[$.Rename.cmd]:$.Rename,[b.Rename.cmd]:b.Rename,[c.MergeComponent.cmd]:c.MergeComponent,[u.SplitComponent.cmd]:u.SplitComponent,[d.StaticExport.cmd]:d.StaticExport,[r.AddConfigSection.cmd]:r.AddConfigSection,[I.CreateCSSVariable.cmd]:I.CreateCSSVariable,[f.CreateAttribute.cmd]:f.CreateAttribute,[m.CreateProperty.cmd]:m.CreateProperty,[g.CreateWatch.cmd]:g.CreateWatch,[y.ImportViewElement.cmd]:y.ImportViewElement,[v.ImportViewMethod.cmd]:v.ImportViewMethod,[a.FileCreated.cmd]:a.FileCreated,[l.FileUpdated.cmd]:l.FileUpdated,[o.FileDeleted.cmd]:o.FileDeleted,[S.OpenAventusFolder.cmd]:S.OpenAventusFolder,[x.PopupResponse.cmd]:x.PopupResponse,[w.ReceiveInput.cmd]:w.ReceiveInput,[C.ReceiveSelect.cmd]:C.ReceiveSelect,[E.ReceiveSelectMultiple.cmd]:E.ReceiveSelectMultiple,[k.ImportTemplate.cmd]:k.ImportTemplate,[N.ImportProject.cmd]:N.ImportProject,[A.SharpExport.cmd]:A.SharpExport,[T.ReloadSettings.cmd]:T.ReloadSettings,[F.StorybookBuild.cmd]:F.StorybookBuild},execute:function(e){let t=this.allCommandes[e.command];if(t){let n=e.arguments??[];t.run.call(t,...n)}}}},76914:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StartServer=void 0;const r=n(60206);t.StartServer=class{static cmd="aventus.liveserver.start";static run(){r.HttpServer.getInstance().start()}}},36954:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StopServer=void 0;const r=n(60206);t.StopServer=class{static cmd="aventus.liveserver.stop";static run(){r.HttpServer.getInstance().stop()}}},1064:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToggleServer=void 0;const r=n(60206);t.ToggleServer=class{static cmd="aventus.liveserver.toggle";static run(){r.HttpServer.getInstance().toggle()}}},71171:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SharpExport=void 0;const r=n(13211),i=n(24964),s=n(71017),a=n(32081),o=n(1539),l=n(19408),c=n(57147),u=n(96693),p=n(49387),_=n(2741);t.SharpExport=class{static cmd="aventus.sharp.export";static isCompiling=!1;static async run(e){if(this.isCompiling)return;if(!e||!e.endsWith(l.AventusExtension.CsharpConfig)){let t=Object.keys(_.CSharpManager.getInstance().files);if(1==t.length)e=t[0];else{if(!(t.length>1))return void i.GenericServer.showErrorMessage("No aventus.sharp.avt found");{let n=[];for(let e of t)n.push({label:e});let r=await i.GenericServer.Select(n,{placeHolder:"Project to compile"});if(!r)return;e=r.label}}}if(!(0,r.sync)("dotnet"))return void i.GenericServer.showErrorMessage("Dotnet isn't installed on your system");let t="";try{let n=(0,c.readFileSync)((0,o.uriToPath)(e),"utf-8");t=JSON.parse(n).csProj}catch(e){console.log(e)}this.isCompiling=!0,u.Compiling.send(t,"compiling");try{let n=(0,s.join)(i.GenericServer.extensionPath,"lib","bin","CSharpToTypescript","CSharpToTypescript.dll"),r=(0,o.uriToPath)(e),l=(0,a.execSync)("dotnet "+n+" "+r).toString();if(-1==l.indexOf("Error : "))u.Compiling.send(t,"success");else{console.clear(),console.log(l);let e="csharp_errors";p.DebugFileAdd.send(e,l),u.Compiling.send(t,"error",[{title:"C# error",file:e}])}}catch(e){i.GenericServer.showErrorMessage(e+"")}this.isCompiling=!1}}},18980:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StorybookBuild=void 0;const r=n(24964),i=n(40529);t.StorybookBuild=class{static cmd="aventus.storybook.build";static async run(){let e=[],t=i.ProjectManager.getInstance().getAllBuildsWithStory();for(let n of t)e.push({label:n.name,detail:n.uri});let n=await r.GenericServer.Select(e,{placeHolder:"Story to build"});if(n){let e=n.detail??"",t=n.label;i.ProjectManager.getInstance().getProjectByUri(e)?.getBuild(t)?.buildStorybook()}}}},87152:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateAttribute=void 0;const r=n(22037),i=n(18952),s=n(19408),a=n(83693),o=n(22296),l=n(24964),c=n(1539);class u{static cmd="aventus.wc.create.attribute";static attrType=[{label:"Number",detail:"number"},{label:"String",detail:"string"},{label:"Boolean",detail:"boolean"},{label:"Date",detail:"Date"},{label:"Datetime",detail:"Datetime"},{label:"Custom",detail:""}];static async run(e,t){if(!e)return;if(!t)return;let n=await l.GenericServer.Input({title:"Provide a name for your Attribute",validations:[{message:"A property must be with lowercase, number or _",regex:"^[_a-z0-9]+$"}]});if(!n)return;let p=await l.GenericServer.Select(u.attrType,{placeHolder:"Choose a type?"});if(!p)return;(0,c.reorderList)(u.attrType,p);let _=p.detail,d=a.FilesManager.getInstance().getByUri(e);if(d){let a="?";"boolean"!=_&&"number"!=_||(a="!");let l=d.documentUser.positionAt(d.contentUser.length),c="@Attribute()"+r.EOL+"public "+n+a+":"+_+";"+r.EOL,u=d.contentUser.slice(0,t)+c+d.contentUser.slice(t+1,d.contentUser.length),p=i.TextDocument.create(d.uri,s.AventusLanguageId.TypeScript,d.versionUser+1,u);await d.triggerContentChange(p);let h=await d.getFormatting({insertSpaces:!0,tabSize:4});await d.applyTextEdits(h);let f=[{newText:d.contentUser,range:{start:{character:0,line:0},end:l}}];o.EditFile.send(e,[f])}}}t.CreateAttribute=u},37779:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateCSSVariable=void 0;const r=n(18952),i=n(19408),s=n(83693),a=n(22296),o=n(24964);t.CreateCSSVariable=class{static cmd="aventus.wc.create.cssvar";static async run(e,t){if(!e)return;if(!t)return;let n=await o.GenericServer.Input({title:"Provide a name for your variable"});if(!n)return;let l=await o.GenericServer.Input({title:"Provide a default value for your variable"}),c=s.FilesManager.getInstance().getByUri(e);if(c){let s=c.name.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g)?.join("-").toLowerCase()??c.name,o=n.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g)?.join("-").toLowerCase()??n,u=l?", "+l:"",p=c.documentUser.positionAt(c.contentUser.length),_=`--_${s}-${o}: var(--${s}-${o}${u});`,d=c.contentUser.slice(0,t)+_+c.contentUser.slice(t+1,c.contentUser.length),h=r.TextDocument.create(c.uri,i.AventusLanguageId.SCSS,c.versionUser+1,d);await c.triggerContentChange(h);let f=await c.getFormatting({insertSpaces:!0,tabSize:4});await c.applyTextEdits(f);let m=[{newText:c.contentUser,range:{start:{character:0,line:0},end:p}}];a.EditFile.send(e,[m])}}}},72810:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateProperty=void 0;const r=n(22037),i=n(18952),s=n(19408),a=n(83693),o=n(16286),l=n(22296),c=n(24964),u=n(1539);class p{static cmd="aventus.wc.create.property";static attrType=[{label:"Number",detail:"number"},{label:"String",detail:"string"},{label:"Boolean",detail:"boolean"},{label:"Date",detail:"Date"},{label:"Datetime",detail:"Datetime"},{label:"Custom",detail:""}];static async run(e,t,n){if(!e)return;if(!t)return;const _=await c.GenericServer.Input({title:"Provide a name for your Property",validations:[{message:"A property must be with lowercase, number or _",regex:"^[_a-z0-9]+$"}],value:n});if(!_)return;let d=await c.GenericServer.Select(p.attrType,{placeHolder:"Choose a type?"});if(!d)return;(0,u.reorderList)(p.attrType,d);let h=d.detail;const f=await c.GenericServer.Select([{label:"Yes"},{label:"No"}],{placeHolder:"Do you need a callback function?"});if(!f)return;let m="Yes"==f.label,g=a.FilesManager.getInstance().getByUri(e);if(g){let n=g.documentUser.positionAt(g.contentUser.length),c=a.FilesManager.getInstance().getBuild(g.documentUser),u="";if(c.length>0){let t=c[0].tsFiles[e];t instanceof o.AventusWebComponentLogicalFile&&(u=t.getComponentName())}if(""==u)return;let p="";m&&(p="(target: "+u+") => {"+r.EOL+r.EOL+"}");let d="?";"boolean"!=h&&"number"!=h||(d="!");let f="@Property("+p+")"+r.EOL+"public "+_+d+":"+h+";"+r.EOL,y=g.contentUser.slice(0,t)+f+g.contentUser.slice(t+1,g.contentUser.length),v=i.TextDocument.create(g.uri,s.AventusLanguageId.TypeScript,g.versionUser+1,y);await g.triggerContentChange(v);let $=await g.getFormatting({insertSpaces:!0,tabSize:4});await g.applyTextEdits($);let b=[{newText:g.contentUser,range:{start:g.documentUser.positionAt(0),end:n}}];l.EditFile.send(e,[b])}}}t.CreateProperty=p},73480:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateWatch=void 0;const r=n(83693),i=n(16286),s=n(22037),a=n(18952),o=n(19408),l=n(22296),c=n(24964);t.CreateWatch=class{static cmd="aventus.wc.create.watch";static async run(e,t,n){if(!e)return;if(!t)return;const u=await c.GenericServer.Input({title:"Provide a name for your Watch variable",value:n});if(!u)return;const p=await c.GenericServer.Input({title:"Provide a type for your Watch"});if(!p)return;const _=await c.GenericServer.Select([{label:"Yes"},{label:"No"}],{placeHolder:"Do you need a callback function?"});if(!_)return;let d="Yes"==_.label,h=r.FilesManager.getInstance().getByUri(e);if(h){let n=h.documentUser.positionAt(h.contentUser.length),c=r.FilesManager.getInstance().getBuild(h.documentUser),_="";if(c.length>0){let t=c[0].tsFiles[e];t instanceof i.AventusWebComponentLogicalFile&&(_=t.getComponentName())}if(""==_)return;let f="";d&&(f="(target: "+_+", action: Aventus.WatchAction, path: string, value: any) => {"+s.EOL+s.EOL+"}");let m="@Watch("+f+")"+s.EOL+"public "+u+"?:"+p+";"+s.EOL,g=h.contentUser.slice(0,t)+m+h.contentUser.slice(t+1,h.contentUser.length),y=a.TextDocument.create(h.uri,o.AventusLanguageId.TypeScript,h.versionUser+1,g);await h.triggerContentChange(y);let v=await h.getFormatting({insertSpaces:!0,tabSize:4});await h.applyTextEdits(v);let $=[{newText:h.contentUser,range:{start:h.documentUser.positionAt(0),end:n}}];l.EditFile.send(e,[$])}}}},71018:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportViewElement=void 0;const r=n(18952),i=n(19408),s=n(83693),a=n(16286),o=n(22296);t.ImportViewElement=class{static cmd="aventus.wc.import.viewElement";static async run(e,t){let n=s.FilesManager.getInstance().getByUri(e);if(n){let l=n.documentUser.positionAt(n.contentUser.length),c=s.FilesManager.getInstance().getBuild(n.documentUser);if(c.length>0){let s=c[0].tsFiles[e];if(s instanceof a.AventusWebComponentLogicalFile){let a=s.getMissingVariablesInfo();if(-1==t&&(t=a.start),-1==t)return;if(""!=a.text){let s=n.contentUser.slice(0,t),c=n.contentUser.slice(t+1,n.contentUser.length),u=s+a.text+c,p=r.TextDocument.create(n.uri,i.AventusLanguageId.TypeScript,n.versionUser+1,u);await n.triggerContentChange(p);let _=await n.getFormatting({insertSpaces:!0,tabSize:4});await n.applyTextEdits(_);let d=[{newText:n.contentUser,range:{start:n.documentUser.positionAt(0),end:l}}];o.EditFile.send(e,[d])}}}}}}},3650:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportViewMethod=void 0;const r=n(18952),i=n(19408),s=n(83693),a=n(16286),o=n(22296);t.ImportViewMethod=class{static cmd="aventus.wc.import.viewMethod";static async run(e,t){let n=s.FilesManager.getInstance().getByUri(e);if(n){let l=n.documentUser.positionAt(n.contentUser.length),c=s.FilesManager.getInstance().getBuild(n.documentUser);if(c.length>0){let s=c[0].tsFiles[e];if(s instanceof a.AventusWebComponentLogicalFile){let a=s.getMissingMethodsInfo();if(-1==t&&(t=a.start),-1==t)return;if(""!=a.text){let s=n.contentUser.slice(0,t),c=n.contentUser.slice(t+1,n.contentUser.length),u=s+a.text+c,p=r.TextDocument.create(n.uri,i.AventusLanguageId.TypeScript,n.versionUser+1,u);await n.triggerContentChange(p);let _=await n.getFormatting({insertSpaces:!0,tabSize:4});await n.applyTextEdits(_);let d=[{newText:n.contentUser,range:{start:n.documentUser.positionAt(0),end:l}}];o.EditFile.send(e,[d])}}}}}}},14043:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Rename=void 0;const r=n(19408),i=n(72375),s=n(83693),a=n(57147),o=n(40529),l=n(1539),c=n(64945),u=n(18952),p=n(24964);t.Rename=class{static cmd="aventus.component.rename";static async run(e){if(!e)return;let t=(e=e.toString().replace(/\.wcv\.avt$/,".wcl.avt").replace(/\.wcs\.avt$/,".wcl.avt")).split("/"),n=t[t.length-1].replace(".wcl.avt",""),_=await p.GenericServer.Input({title:"New name",value:n,validations:[{message:"Your name isn't valid",regex:"^[_A-Za-z0-9-]+$"}]});if(!_)return;let d=s.FilesManager.getInstance().getByUri(e);if(d&&d instanceof i.InternalAventusFile){let e=s.FilesManager.getInstance(),t=d.documentUser.uri.split("/"),n=t[t.length-1].replace(r.AventusExtension.ComponentLogic,""),i=(0,l.escapeRegex)(n),p=d.folderUri,h=p.replace(new RegExp(i+"$"),_),f=new RegExp("(class +)"+i+" ").exec(d.contentUser),m={};if(f){let t=f.index+f[1].length,n=d.documentUser.positionAt(t),r=await d.getRename(n,_);if(r&&r.changes)for(let t in r.changes){if(!m[t]){let n=e.getByUri(t);if(!n)continue;m[t]=n}let n=r.changes[t];await m[t].applyTextEdits(n)}}let g=[],y=e=>{let t=p+"/"+n+e;if((0,a.existsSync)((0,l.uriToPath)(t))){let n=h+"/"+_+e;g.push({oldUri:t,newUri:n})}};y(r.AventusExtension.ComponentLogic),y(r.AventusExtension.ComponentStyle),y(r.AventusExtension.ComponentView);let v=await o.ProjectManager.getInstance().onRename(g);for(let t in v){if(!m[t]){let n=e.getByUri(t);if(!n)continue;m[t]=n}await m[t].applyTextEdits(v[t])}setTimeout((()=>{for(let e in m)(0,a.writeFileSync)((0,l.uriToPath)(e),m[e].contentUser);(0,a.mkdirSync)((0,l.uriToPath)(h));for(let t of g){let n=t.oldUri,r=t.newUri,i=(0,l.uriToPath)(n);(0,a.renameSync)(i,(0,l.uriToPath)(r)),c.CloseFile.send(n);let s=e.getByUri(n);s&&(e.registerFile(u.TextDocument.create(r,(0,l.getLanguageIdByUri)(r),1,s.contentUser)),e.onClose(s?.documentUser))}let t=(0,l.uriToPath)(p),n=(0,a.readdirSync)(t);0==n.length?(0,a.rmdirSync)(t):1==n.length&&n[0].endsWith(".js")&&(0,a.rmSync)(t,{recursive:!0,force:!0})}),500)}}}},9648:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorInfo=void 0;class n{static tc(e,t){if(typeof e!=t)throw new TypeError(`required type ${t} got ${typeof e}`);return e}static ic(e,t){if(!(e instanceof t))throw new TypeError(`required type ${t} got ${typeof e}`);return e}static nc(e){return isNaN(e)?0:e}static oc(e){return{angle:e&&e.angle?e.angle:15,results:e&&e.results?e.results:3}}static clmp(e,t,n){return void 0!==n&&e<n?n:e>t?t:e}static shift(e,t){for(e+=t;e>=360;)e-=360;for(;e<0;)e+=360;return e}#e;#t;#n;alpha;static Colors=class{static get BLACK(){return n.fromHex("#000000")}static get SILVER(){return n.fromHex("#c0c0c0")}static get GRAY(){return n.fromHex("#808080")}static get WHITE(){return n.fromHex("#ffffff")}static get MAROON(){return n.fromHex("#800000")}static get RED(){return n.fromHex("#ff0000")}static get PURPLE(){return n.fromHex("#800080")}static get GREEN(){return n.fromHex("#008000")}static get LIME(){return n.fromHex("#00ff00")}static get OLIVE(){return n.fromHex("#808000")}static get YELLOW(){return n.fromHex("#ffff00")}static get NAVY(){return n.fromHex("#000080")}static get BLUE(){return n.fromHex("#0000ff")}static get TEAL(){return n.fromHex("#008080")}static get AQUA(){return n.fromHex("#00ffff")}static get ORANGE(){return n.fromHex("#ffa500")}static get ALICEBLUE(){return n.fromHex("#f0f8ff")}static get ANTIQUEWHITE(){return n.fromHex("#faebd7")}static get AQUAMARINE(){return n.fromHex("#7fffd4")}static get AZURE(){return n.fromHex("#f0ffff")}static get BEIGE(){return n.fromHex("#f5f5dc")}static get BISQUE(){return n.fromHex("#ffe4c4")}static get BLANCHEDALMOND(){return n.fromHex("#ffebcd")}static get BLUEVIOLET(){return n.fromHex("#8a2be2")}static get BROWN(){return n.fromHex("#a52a2a")}static get BURLYWOOD(){return n.fromHex("#deb887")}static get CADETBLUE(){return n.fromHex("#5f9ea0")}static get CHARTREUSE(){return n.fromHex("#7fff00")}static get CHOCOLATE(){return n.fromHex("#d2691e")}static get CORAL(){return n.fromHex("#ff7f50")}static get CORNFLOWERBLUE(){return n.fromHex("#6495ed")}static get CORNSILK(){return n.fromHex("#fff8dc")}static get CRIMSON(){return n.fromHex("#dc143c")}static get CYAN(){return n.fromHex("#00ffff")}static get DARKBLUE(){return n.fromHex("#00008b")}static get DARKCYAN(){return n.fromHex("#008b8b")}static get DARKGOLDENROD(){return n.fromHex("#b8860b")}static get DARKGRAY(){return n.fromHex("#a9a9a9")}static get DARKGREEN(){return n.fromHex("#006400")}static get DARKGREY(){return n.fromHex("#a9a9a9")}static get DARKKHAKI(){return n.fromHex("#bdb76b")}static get DARKMAGENTA(){return n.fromHex("#8b008b")}static get DARKOLIVEGREEN(){return n.fromHex("#556b2f")}static get DARKORANGE(){return n.fromHex("#ff8c00")}static get DARKORCHID(){return n.fromHex("#9932cc")}static get DARKRED(){return n.fromHex("#8b0000")}static get DARKSALMON(){return n.fromHex("#e9967a")}static get DARKSEAGREEN(){return n.fromHex("#8fbc8f")}static get DARKSLATEBLUE(){return n.fromHex("#483d8b")}static get DARKSLATEGRAY(){return n.fromHex("#2f4f4f")}static get DARKSLATEGREY(){return n.fromHex("#2f4f4f")}static get DARKTURQUOISE(){return n.fromHex("#00ced1")}static get DARKVIOLET(){return n.fromHex("#9400d3")}static get DEEPPINK(){return n.fromHex("#ff1493")}static get DEEPSKYBLUE(){return n.fromHex("#00bfff")}static get DIMGRAY(){return n.fromHex("#696969")}static get DIMGREY(){return n.fromHex("#696969")}static get DODGERBLUE(){return n.fromHex("#1e90ff")}static get FIREBRICK(){return n.fromHex("#b22222")}static get FLORALWHITE(){return n.fromHex("#fffaf0")}static get FORESTGREEN(){return n.fromHex("#228b22")}static get GAINSBORO(){return n.fromHex("#dcdcdc")}static get GHOSTWHITE(){return n.fromHex("#f8f8ff")}static get GOLD(){return n.fromHex("#ffd700")}static get GOLDENROD(){return n.fromHex("#daa520")}static get GREENYELLOW(){return n.fromHex("#adff2f")}static get GREY(){return n.fromHex("#808080")}static get HONEYDEW(){return n.fromHex("#f0fff0")}static get HOTPINK(){return n.fromHex("#ff69b4")}static get INDIANRED(){return n.fromHex("#cd5c5c")}static get INDIGO(){return n.fromHex("#4b0082")}static get IVORY(){return n.fromHex("#fffff0")}static get KHAKI(){return n.fromHex("#f0e68c")}static get LAVENDER(){return n.fromHex("#e6e6fa")}static get LAVENDERBLUSH(){return n.fromHex("#fff0f5")}static get LAWNGREEN(){return n.fromHex("#7cfc00")}static get LEMONCHIFFON(){return n.fromHex("#fffacd")}static get LIGHTBLUE(){return n.fromHex("#add8e6")}static get LIGHTCORAL(){return n.fromHex("#f08080")}static get LIGHTCYAN(){return n.fromHex("#e0ffff")}static get LIGHTGOLDENRODYELLOW(){return n.fromHex("#fafad2")}static get LIGHTGRAY(){return n.fromHex("#d3d3d3")}static get LIGHTGREEN(){return n.fromHex("#90ee90")}static get LIGHTGREY(){return n.fromHex("#d3d3d3")}static get LIGHTPINK(){return n.fromHex("#ffb6c1")}static get LIGHTSALMON(){return n.fromHex("#ffa07a")}static get LIGHTSEAGREEN(){return n.fromHex("#20b2aa")}static get LIGHTSKYBLUE(){return n.fromHex("#87cefa")}static get LIGHTSLATEGRAY(){return n.fromHex("#778899")}static get LIGHTSLATEGREY(){return n.fromHex("#778899")}static get LIGHTSTEELBLUE(){return n.fromHex("#b0c4de")}static get LIGHTYELLOW(){return n.fromHex("#ffffe0")}static get LIMEGREEN(){return n.fromHex("#32cd32")}static get LINEN(){return n.fromHex("#faf0e6")}static get MAGENTA(){return n.fromHex("#ff00ff")}static get FUCHSIA(){return n.fromHex("#ff00ff")}static get MEDIUMAQUAMARINE(){return n.fromHex("#66cdaa")}static get MEDIUMBLUE(){return n.fromHex("#0000cd")}static get MEDIUMORCHID(){return n.fromHex("#ba55d3")}static get MEDIUMPURPLE(){return n.fromHex("#9370db")}static get MEDIUMSEAGREEN(){return n.fromHex("#3cb371")}static get MEDIUMSLATEBLUE(){return n.fromHex("#7b68ee")}static get MEDIUMSPRINGGREEN(){return n.fromHex("#00fa9a")}static get MEDIUMTURQUOISE(){return n.fromHex("#48d1cc")}static get MEDIUMVIOLETRED(){return n.fromHex("#c71585")}static get MIDNIGHTBLUE(){return n.fromHex("#191970")}static get MINTCREAM(){return n.fromHex("#f5fffa")}static get MISTYROSE(){return n.fromHex("#ffe4e1")}static get MOCCASIN(){return n.fromHex("#ffe4b5")}static get NAVAJOWHITE(){return n.fromHex("#ffdead")}static get OLDLACE(){return n.fromHex("#fdf5e6")}static get OLIVEDRAB(){return n.fromHex("#6b8e23")}static get ORANGERED(){return n.fromHex("#ff4500")}static get ORCHID(){return n.fromHex("#da70d6")}static get PALEGOLDENROD(){return n.fromHex("#eee8aa")}static get PALEGREEN(){return n.fromHex("#98fb98")}static get PALETURQUOISE(){return n.fromHex("#afeeee")}static get PALEVIOLETRED(){return n.fromHex("#db7093")}static get PAPAYAWHIP(){return n.fromHex("#ffefd5")}static get PEACHPUFF(){return n.fromHex("#ffdab9")}static get PERU(){return n.fromHex("#cd853f")}static get PINK(){return n.fromHex("#ffc0cb")}static get PLUM(){return n.fromHex("#dda0dd")}static get POWDERBLUE(){return n.fromHex("#b0e0e6")}static get ROSYBROWN(){return n.fromHex("#bc8f8f")}static get ROYALBLUE(){return n.fromHex("#4169e1")}static get SADDLEBROWN(){return n.fromHex("#8b4513")}static get SALMON(){return n.fromHex("#fa8072")}static get SANDYBROWN(){return n.fromHex("#f4a460")}static get SEAGREEN(){return n.fromHex("#2e8b57")}static get SEASHELL(){return n.fromHex("#fff5ee")}static get SIENNA(){return n.fromHex("#a0522d")}static get SKYBLUE(){return n.fromHex("#87ceeb")}static get SLATEBLUE(){return n.fromHex("#6a5acd")}static get SLATEGRAY(){return n.fromHex("#708090")}static get SLATEGREY(){return n.fromHex("#708090")}static get SNOW(){return n.fromHex("#fffafa")}static get SPRINGGREEN(){return n.fromHex("#00ff7f")}static get STEELBLUE(){return n.fromHex("#4682b4")}static get TAN(){return n.fromHex("#d2b48c")}static get THISTLE(){return n.fromHex("#d8bfd8")}static get TOMATO(){return n.fromHex("#ff6347")}static get TURQUOISE(){return n.fromHex("#40e0d0")}static get VIOLET(){return n.fromHex("#ee82ee")}static get WHEAT(){return n.fromHex("#f5deb3")}static get WHITESMOKE(){return n.fromHex("#f5f5f5")}static get YELLOWGREEN(){return n.fromHex("#9acd32")}static get REBECCAPURPLE(){return n.fromHex("#663399")}};getScheme(e,t){return n.createScheme(this,e,t)}static getScheme(e,t,r){return n.createScheme(e,t,r)}static monochromatic(e,t){this.ic(e,n);let r=this.oc(t).results||3,i=n.toHsv(e),s=i.h,a=i.s,o=i.v/100,l=[],c=1/r;for(;r--;)l.push(n.fromHsv(s,a,this.clmp(100*o,100,0))),o=(o-c)%1;return l}monochromatic(e){return n.monochromatic(this,e)}static complementary(e){this.ic(e,n);let t=n.toHsl(e),r=t.h,i=t.s,s=t.l;return n.fromHsl(this.shift(r,180),i,s)}complementary(){return n.complementary(this)}static splitComplementary(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle||15,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,180+i),a,o),n.fromHsl(this.shift(s,180-i),a,o)]}splitComplementary(e){return n.splitComplementary(this,e)}static doubleComplementary(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle||15,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,180),a,o),n.fromHsl(this.shift(s,i),a,o),n.fromHsl(this.shift(s,180+i),a,o)]}doubleComplementary(e){return n.doubleComplementary(this,e)}static square(e){this.ic(e,n);let t=n.toHsl(e),r=t.h,i=t.s,s=t.l;const a=[e];for(let e=1;e<4;e++)r=this.shift(r,90),a.push(n.fromHsl(r,i,s));return a}square(){return n.square(this)}static tetradic(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,180),a,o),n.fromHsl(this.shift(s,180-i),a,o),n.fromHsl(this.shift(s,-i),a,o)]}tetradic(e){return n.tetradic(this,e)}static triadic(e){this.ic(e,n);let t=n.toHsl(e),r=t.h,i=t.s,s=t.l;return[e,n.fromHsl(this.shift(r,120),i,s),n.fromHsl(this.shift(r,240),i,s)]}triadic(){return n.triadic(this)}static analogous(e,t){this.ic(e,n);let r=n.toHsl(e),i=this.oc(t).angle,s=r.h,a=r.s,o=r.l;return[e,n.fromHsl(this.shift(s,-i),a,o),n.fromHsl(this.shift(s,+i),a,o)]}analogous(e){return n.analogous(this,e)}static createScheme(e,t,r){switch(t.toLowerCase()){case"analogous":case"analog":return n.analogous(e,r);case"triadic":case"triad":return n.triadic(e);case"tetradic":case"tetra":return n.tetradic(e,r);case"monochromatic":case"monochrome":case"mono":return n.monochromatic(e,r);case"complementary":case"complement":case"comp":return n.complementary(e);case"double-complementary":case"double-complement":case"double":return n.doubleComplementary(e,r);case"split-complementary":case"split-complement":case"split":return n.splitComplementary(e,r);case"square":return n.square(e)}return null}constructor(e,t,r){if(!(0<=e&&e<=255&&0<=t&&t<=255&&0<=r&&r<=255))throw new Error("Color values out of bounds (0 - 255)");this.#e=n.nc(n.tc(e,"number")),this.#t=n.nc(n.tc(t,"number")),this.#n=n.nc(n.tc(r,"number")),this.alpha=1}static saturate(e,t){this.ic(e,n),this.tc(t,"number");let r=e.toHsl(),i=r.h,s=this.clmp(r.s+t,100,0),a=r.l;return n.fromHsl(i,s,a)}saturate(e){return n.saturate(this,e)}static desaturate(e,t){this.ic(e,n),this.tc(t,"number");let r=e.toHsl(),i=r.h,s=this.clmp(r.s-t,100,0),a=r.l;return n.fromHsl(i,s,a)}desaturate(e){return n.desaturate(this,e)}static grayscale(e){return n.desaturate(e,100)}grayscale(){return n.greyscale(this)}static greyscale(e){return n.desaturate(e,100)}greyscale(){return n.greyscale(this)}static lighten(e,t){this.ic(e,n),this.tc(t,"number");const r=e.toHsl();let i=r.h,s=r.s,a=this.clmp(r.l+t,100,0);return n.fromHsl(i,s,a)}lighten(e){return n.lighten(this,e)}static darken(e,t){return n.lighten(e,-t)}darken(e){return n.darken(this,e)}static brighten(e,t){let r=e.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-t/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-t/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-t/100*255))),new n(r.r,r.g,r.b)}brighten(e){return n.brighten(this,e)}static shiftHue(e,t){this.ic(e,n),this.tc(t,Number);let{h:r,s:i,l:s}=e.toHsl();return r=this.shift(r,t),n.fromHsl(r,i,s)}shiftHue(e){return n.shiftHue(this,e)}static multiply(e,t){this.ic(e,n),this.ic(t,n);let{r1:r,g1:i,b1:s}=e.toRgb(),{r2:a,g2:o,b2:l}=t.toRgb();return n.fromRgb(r*a/255,i*o/255,s*l/255)}multiply(e){return n.multiply(this,e)}static mix(e,t,r=50){this.ic(e,n),this.ic(e,n),this.tc(r,"number");const i=e.toRgb(),s=t.toRgb(),a=this.clmp(r,100,0)/100,o=Math.round((s.r-i.r)*a+i.r),l=Math.round((s.g-i.g)*a+i.g),c=Math.round((s.b-i.b)*a+i.b);return n.fromRgb(o,l,c)}mix(e,t){return n.mix(this,e,t)}static lerp(e,t,r=.5){this.tc(r,"number"),this.ic(e,n),this.ic(t,n),r=this.clmp(r,1,0);let i=e.toRgb(),s=t.toRgb(),a=i.r/255,o=i.g/255,l=i.b/255,c=s.r/255,u=s.g/255,p=s.b/255;return n.fromRgb(255*(a+(c-a)*r),255*(o+(u-o)*r),255*(l+(p-l)*r))}lerp(e,t){return n.lerp(this,e,t)}static add(e,t){this.ic(e,n),this.ic(t,n);let r=e.toRgb(),i=t.toRgb(),s=r.r,a=r.g,o=r.b,l=i.r,c=i.g,u=i.b;return n.fromRgb(Math.round((s+l)/2),Math.round((a+c)/2),Math.round((o+u)/2))}add(e){return n.add(this,e)}static fromHex(e){if(!e.match(/^#?(?:[0-9a-fA-F]{3}){1,2}$/i))throw new Error('Invalid Hex code: "'+e+'"');let t="0x00",r="0x00",i="0x00";4==e.length?(t="0x"+e[1]+e[1],r="0x"+e[2]+e[2],i="0x"+e[3]+e[3]):3==e.length?(t="0x"+e[0]+e[0],r="0x"+e[1]+e[1],i="0x"+e[2]+e[2]):7==e.length?(t="0x"+e[1]+e[2],r="0x"+e[3]+e[4],i="0x"+e[5]+e[6]):6==e.length&&(t="0x"+e[0]+e[1],r="0x"+e[2]+e[3],i="0x"+e[4]+e[5]);return new n(parseInt(t,16),parseInt(r,16),parseInt(i,16))}static fromRgb(e,t,r){return new n(e,t,r)}static fromHsl(e,t,r){if(e=this.tc(e,"number"),t=this.tc(t,"number"),r=this.tc(r,"number"),!(0<=e&&e<=360))throw new Error("HSL color values out of range, hue (0 - 360)");if(!(0<=t&&t<=100))throw new Error("HSL color values out of range, sat (0 - 100)");if(!(0<=r&&r<=100))throw new Error("HSL color values out of range, lum (0 - 100)");t/=100,r/=100;let i=(1-Math.abs(2*r-1))*t,s=i*(1-Math.abs(e/60%2-1)),a=r-i/2,o=0,l=0,c=0;0<=e&&e<60?(o=i,l=s,c=0):60<=e&&e<120?(o=s,l=i,c=0):120<=e&&e<180?(o=0,l=i,c=s):180<=e&&e<240?(o=0,l=s,c=i):240<=e&&e<300?(o=s,l=0,c=i):300<=e&&e<=360&&(o=i,l=0,c=s);const u=Math.round(255*(o+a)),p=Math.round(255*(l+a)),_=Math.round(255*(c+a));return new n(u,p,_)}static fromHsv(e,t,r){if(e=this.tc(e,"number"),t=this.tc(t,"number"),r=this.tc(r,"number"),!(0<=e&&e<=360))throw new Error("HSL color values out of range, hue (0 - 360)");if(!(0<=t&&t<=100))throw new Error("HSL color values out of range, sat (0 - 100)");if(!(0<=r&&r<=100))throw new Error("HSL color values out of range, lum (0 - 100)");let i=(r/=100)*(t/=100),s=i*(1-Math.abs(e/60%2-1)),a=r-i,o=0,l=0,c=0;0<=e&&e<60?(o=i,l=s,c=0):60<=e&&e<120?(o=s,l=i,c=0):120<=e&&e<180?(o=0,l=i,c=s):180<=e&&e<240?(o=0,l=s,c=i):240<=e&&e<300?(o=s,l=0,c=i):300<=e&&e<=360&&(o=i,l=0,c=s);return new n(255*(o+a),255*(l+a),255*(c+a))}static fromCssString(e){this.tc(e,"string");var t=document.createElement("canvas").getContext("2d");let r;if(t&&(t.fillStyle=e,r=t.fillStyle),!r)throw new Error("Invalid Color string");return n.fromHex(r)}static fromName(e){e=this.tc(e,"string");const t=this.Colors[e.toUpperCase()];if(!t)throw new Error("Invalid Color name");return t}static toHex(e){e=this.ic(e,n);let t=Math.round(e.#e).toString(16),r=Math.round(e.#t).toString(16),i=Math.round(e.#n).toString(16);return 1==t.length&&(t="0"+t),1==r.length&&(r="0"+r),1==i.length&&(i="0"+i),"#"+t+r+i}static toHsl(e){let t=0,r=0,i=0,s=(e=this.ic(e,n)).#e/255,a=e.#t/255,o=e.#n/255,l=Math.min(Math.min(s,a),o),c=Math.max(Math.max(s,a),o),u=c-l;return t=0===u?0:c===s?(a-o)/u%6:c===a?(o-s)/u+2:(s-a)/u+4,t=Math.round(60*t),t<0&&(t+=360),i=(c+l)/2,r=0===u?0:u/(1-Math.abs(2*i-1)),r=parseFloat(Math.abs(100*r)+""),i=parseFloat(Math.abs(100*i)+""),{h:this.nc(t),s:this.nc(r),l:this.nc(i)}}static toHsv(e){let t=0,n=0,r=0,i=e.#e/255,s=e.#t/255,a=e.#n/255,o=Math.min(Math.min(i,s),a),l=Math.max(Math.max(i,s),a),c=l-o;return t=0===c?0:l===i?(s-a)/c%6:l===s?(a-i)/c+2:(i-s)/c+4,t=Math.round(60*t),t<0&&(t+=360),0!==l&&(n=c/l*100),r=100*l,{h:this.nc(t),s:this.nc(n),v:this.nc(r)}}static toRgb(e){return this.ic(e,n),{r:e.#e,g:e.#t,b:e.#n}}static toCmyk(e){this.ic(e,n);let{r:t,g:r,b:i}=e.toRgb(),s=1-t/255,a=1-r/255,o=1-i/255,l=Math.min(s,Math.min(a,o));return s=(s-l)/(1-l),a=(a-l)/(1-l),o=(o-l)/(1-l),s=this.nc(Math.round(1e4*s)/100),a=this.nc(Math.round(1e4*a)/100),o=this.nc(Math.round(1e4*o)/100),l=this.nc(Math.round(1e4*l)/100),{c:s,m:a,y:o,k:l}}toHsl(){return n.toHsl(this)}toHsv(){return n.toHsv(this)}toHex(){return n.toHex(this)}toRgb(){return n.toRgb(this)}toCmyk(){return n.toCmyk(this)}static random(){const e=Math.floor(255*Math.random()),t=Math.floor(255*Math.random()),r=Math.floor(255*Math.random());return new n(e,t,r)}toString(e="hex"){n.tc(e,"string");const t=this.toRgb(),r=this.toHsl();switch(e.toLowerCase()){case"hex":return this.toHex();case"hexa":let e=Math.round(255*this.alpha).toString(16);return 1===e.length&&(e="0"+e),this.toHex()+e;case"rgb":return`rgb(${Math.round(t.r)}, ${Math.round(t.g)}, ${Math.round(t.b)})`;case"rgba":return`rgba(${Math.round(t.r)}, ${Math.round(t.g)}, ${Math.round(t.b)}, ${this.alpha})`;case"hsl":return`hsl(${Math.round(r.h)}, ${Math.round(r.s)}%, ${Math.round(r.l)}%)`;case"hsla":return`hsla(${Math.round(r.h)}, ${Math.round(r.s)}%, ${Math.round(r.l)}%, ${this.alpha})`;case"hsv":const n=this.toHsv();return`hsv(${Math.round(n.h)}, ${Math.round(n.s)}%, ${Math.round(n.v)}%)`;case"cmyk":const i=this.toCmyk();return`cmyk(${Math.round(i.c)}%, ${Math.round(i.m)}%, ${Math.round(i.y)}%, ${Math.round(i.k)}%)`}return""}valueOf(){return parseInt("0x"+this.toHex().slice(1))}}t.ColorInfo=n},32377:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorPicker=void 0;const r=n(9648),i=n(42374),s=n(25392);class a{static colorTxtList=[];static parseColorString(e){try{const t=s(e);if(!t)throw new Error("invalid color string");const n=t.rgba[0],r=t.rgba[1],a=t.rgba[2],o=t.rgba[3];return i.Color.create(n/255,r/255,a/255,o)}catch(e){return console.log(e),null}}static getPos(e,t){const n=Array.from(e.slice(0,t).matchAll(/\n/g)),r=n.length;let s=n[r-1],a=0;s.index&&(a=s.index);const o=t-a;return i.Position.create(r,o-1)}static getMatches(e){let t=[];const n=e.matchAll(/(#(?:[\da-f]{3,4}){2}|#(?:[\da-f]{3})|rgb\((?:\d{1,3},\s*){2}\d{1,3}\)|rgba\((?:\d{1,3},\s*){3}\d*\.?\d+\)|hsl\(\d{1,3}(?:,\s*\d{1,3}%){2}\)|hsla\(\d{1,3}(?:,\s*\d{1,3}%){2},\s*\d*\.?\d+\))/gi);if(n)for(let r of n){const n=r[0];if(!r.index)continue;const s=n.length;let a="";n.startsWith("hsl(")?a="hsl":n.startsWith("hsla(")?a="hsla":n.startsWith("rgb(")?a="rgb":n.startsWith("rgba(")?a="rgba":n.startsWith("#")&&(a="hex");const o=i.Range.create(this.getPos(e,r.index),this.getPos(e,r.index+n.length)),l=this.parseColorString(n);l&&t.push({color:l,type:a,length:s,range:o})}if(0==this.colorTxtList.length){let e=Object.getOwnPropertyNames(r.ColorInfo.Colors),t=[];for(let n of e)"name"!=n&&"length"!=n&&"prototype"!=n&&t.push(n);this.colorTxtList=t}let s=new RegExp("(?<![\\w\\d.\"'&$-])("+this.colorTxtList.join("|")+")(?![-\\w\\d])","gi");const a=e.matchAll(s);if(a)for(let n of a){const s=n[0];if(!n.index)continue;const a=s.length;let o="hex";const l=i.Range.create(this.getPos(e,n.index),this.getPos(e,n.index+s.length)),c=this.parseColorString(r.ColorInfo.fromName(s).toHex());c&&t.push({color:c,type:o,length:a,range:l})}return t}static onDocumentColor(e){return a.getMatches(e.getText()).map((e=>i.ColorInformation.create(e.range,e.color)))}static onColorPresentations(e,t,n){let s=r.ColorInfo.fromRgb(255*n.red,255*n.green,255*n.blue);s.alpha=n.alpha;s.toString("hex"),s.toString("hsl");let a=e.getText(t);const o=i.ColorPresentation.create(s.toString("hex")),l=i.ColorPresentation.create(s.toString("hexa")),c=i.ColorPresentation.create(s.toString("hsl")),u=i.ColorPresentation.create(s.toString("hsla")),p=i.ColorPresentation.create(s.toString("rgb")),_=i.ColorPresentation.create(s.toString("rgba"));let d=!1;return a.startsWith("#")&&9===a.length&&(d=!0),a.startsWith("hsla")&&(d=!0),a.startsWith("rgba")&&(d=!0),1!==n.alpha&&(d=!0),d?[l,u,_]:[o,c,p]}}t.ColorPicker=a},19408:(e,t)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AventusErrorCode=t.AventusExtension=t.AventusLanguageId=t.AventusType=void 0,function(e){e[e.Component=0]="Component",e[e.Lib=1]="Lib",e[e.Data=2]="Data",e[e.RAM=3]="RAM",e[e.Static=4]="Static",e[e.Definition=5]="Definition",e[e.Unknow=6]="Unknow"}(n||(t.AventusType=n={})),t.AventusLanguageId={Base:"Aventus",TypeScript:"Aventus Ts",HTML:"Aventus HTML",SCSS:"Aventus SCSS",WebComponent:"Aventus WebComponent",Package:"Aventus Ts"},t.AventusExtension={Base:".avt",Config:"aventus.conf.avt",CsharpConfig:"aventus.sharp.avt",ComponentLogic:".wcl.avt",ComponentView:".wcv.avt",ComponentStyle:".wcs.avt",Component:".wc.avt",GlobalStyle:".gs.avt",Data:".data.avt",Lib:".lib.avt",RAM:".ram.avt",State:".state.avt",Static:".static.avt",Definition:".def.avt",DefinitionNpm:".defnpm.avt",Template:"template.avt",Package:".package.avt"},function(e){e[e.Unknow=1e3]="Unknow",e[e.ConfigJsonError=1001]="ConfigJsonError",e[e.NoWebComponent=1002]="NoWebComponent",e[e.MultipleWebComponent=1003]="MultipleWebComponent",e[e.TagLower=1004]="TagLower",e[e.AttributeLower=1005]="AttributeLower",e[e.MissingVariable=1006]="MissingVariable",e[e.ParsingParentFailed=1007]="ParsingParentFailed",e[e.OutsideInterpolation=1008]="OutsideInterpolation",e[e.UsedKeyword=1009]="UsedKeyword",e[e.MissingAttributeForLoop=1010]="MissingAttributeForLoop",e[e.MissingViewElement=1011]="MissingViewElement",e[e.viewElementNotFound=1012]="viewElementNotFound",e[e.MissingInit=1013]="MissingInit",e[e.MissingProp=1014]="MissingProp",e[e.MissingWatchable=1015]="MissingWatchable",e[e.WrongTypeDefinition=1016]="WrongTypeDefinition",e[e.MissingExtension=1017]="MissingExtension",e[e.MissingImplementation=1018]="MissingImplementation",e[e.MissingMethod=1019]="MissingMethod",e[e.FunctionNotAllowed=1020]="FunctionNotAllowed",e[e.VariableNotAllowed=1021]="VariableNotAllowed",e[e.MissingFullName=1022]="MissingFullName",e[e.SameNameFound=1023]="SameNameFound",e[e.ConvertionImpossible=1024]="ConvertionImpossible",e[e.ExclamationMarkMissing=1025]="ExclamationMarkMissing",e[e.QuestionMarkMissing=1026]="QuestionMarkMissing"}(r||(t.AventusErrorCode=r={}))},72375:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalAventusFile=void 0;const r=n(18952),i=n(36790),s=n(1539),a=n(19408),o=n(24964),l=n(29495);t.InternalAventusFile=class{_documentUser;_documentInternal;get documentUser(){return this._documentUser}get documentInternal(){return this._documentInternal}linkInternalAndUser=!0;setDocumentInternal(e){this._documentInternal=e,this._versionInternal=e.version}constructor(e){this._documentUser=e,this._documentInternal=e,this._versionUser=e.version,this._versionInternal=e.version}get uri(){return this.documentUser.uri}get path(){return(0,s.uriToPath)(this.uri)}get name(){return this.path.split("/").pop()??""}_versionUser=0;get versionUser(){return this._versionUser}_versionInternal=0;get versionInternal(){return this._versionInternal}get contentUser(){return this.documentUser.getText()}get contentInternal(){return this.documentInternal.getText()}get folderUri(){return(0,s.getFolder)(this.uri)}get folderPath(){return(0,s.getFolder)(this.path)}_shortname="";get shortname(){if(!this._shortname){let e=this.uri.split("/");this._shortname=e[e.length-1]}return this._shortname}onGetBuildCb={};getBuild(){let e=[];for(let t in this.onGetBuildCb){let n=this.onGetBuildCb[t]();for(let t of n)-1==e.indexOf(t)&&e.push(t)}return e}onGetBuild(e){let t=(0,i.v4)();for(;null!=this.onGetBuildCb[t];)t=(0,i.v4)();return this.onGetBuildCb[t]=e,t}removeOnGetBuild(e){delete this.onGetBuildCb[e]}onValidateCb={};async validate(e=!0){let t={};for(let e in this.onValidateCb){let n=await this.onValidateCb[e](this);for(let e of n){let n=e.message+"**"+e.range.start.line+":"+e.range.start.character+","+e.range.end.line+":"+e.range.end.character;t[n]||(t[n]=e)}}if(e)if(l.SettingsManager.getInstance().settings.errorByBuild){const e=this.getBuild();for(let n of e)o.GenericServer.sendDiagnostics({uri:this.uri,diagnostics:Object.values(t)},n)}else o.GenericServer.sendDiagnostics({uri:this.uri,diagnostics:Object.values(t)});return Object.values(t)}onValidate(e){let t=(0,i.v4)();for(;null!=this.onValidateCb[t];)t=(0,i.v4)();return this.onValidateCb[t]=e,t}removeOnValidate(e){delete this.onValidateCb[e]}onContentChangeCb={};delayValidate;waitingDocContentChange={};resolveContentChange={};triggerContentChange(e){return new Promise((t=>{this.triggerCanContentChange(e)?setTimeout((()=>{this.waitingDocContentChange[e.uri]?(this.resolveContentChange[e.uri]||(this.resolveContentChange[e.uri]={}),this.resolveContentChange[e.uri][e.version]||(this.resolveContentChange[e.uri][e.version]=[]),this.resolveContentChange[e.uri][e.version].push(t),this.waitingDocContentChange[e.uri]=e):(this.waitingDocContentChange[e.uri]=!0,this.resolveContentChange[e.uri]={[e.version]:[t]},this.triggerContentChangeNoBuffer(e))}),0):t()}))}async triggerContentChangeNoBuffer(e){let t=e.version;this._documentUser=e,this._versionUser=e.version,this.linkInternalAndUser&&(this._documentInternal=e,this._versionInternal=e.version);let n=[];for(let e in this.onContentChangeCb)n.push(this.onContentChangeCb[e](this));if(await Promise.all(n),this.delayValidate&&clearTimeout(this.delayValidate),this.delayValidate=setTimeout((async()=>{this.validate()}),500),this.resolveContentChange[e.uri]){let n=Object.keys(this.resolveContentChange[e.uri]);for(let r of n){if(Number(r)>t)break;if(this.resolveContentChange[e.uri][r]){for(let t of this.resolveContentChange[e.uri][r])t();delete this.resolveContentChange[e.uri][r]}}0==Object.keys(this.resolveContentChange[e.uri]).length&&delete this.resolveContentChange[e.uri]}let r=this.waitingDocContentChange[e.uri];r&&"boolean"!=typeof r?(this.waitingDocContentChange[e.uri]=!0,this.triggerContentChangeNoBuffer(r)):delete this.waitingDocContentChange[e.uri]}onContentChange(e){let t=(0,i.v4)();for(;null!=this.onContentChangeCb[t];)t=(0,i.v4)();return this.onContentChangeCb[t]=e,t}removeOnContentChange(e){delete this.onContentChangeCb[e]}onCanContentChangeCb={};triggerCanContentChange(e){for(let t in this.onCanContentChangeCb)if(!this.onCanContentChangeCb[t](e))return!1;return!0}onCanContentChange(e){let t=(0,i.v4)();for(;null!=this.onCanContentChangeCb[t];)t=(0,i.v4)();return this.onCanContentChangeCb[t]=e,t}removeOnCanContentChange(e){delete this.onCanContentChangeCb[e]}async applyTextEdits(e){let t=this.contentUser;e.sort(((e,t)=>this.documentUser.offsetAt(t.range.end)-this.documentUser.offsetAt(e.range.end)));for(let n of e){let e=this.documentUser.offsetAt(n.range.start),r=this.documentUser.offsetAt(n.range.end);t=t.slice(0,e)+n.newText+t.slice(r,t.length)}let n=r.TextDocument.create(this.uri,a.AventusLanguageId.TypeScript,this.documentUser.version+1,t);await this.triggerContentChange(n)}onSaveCb={};async triggerSave(){for(let e in this.onSaveCb)await this.onSaveCb[e](this)}onSave(e){let t=(0,i.v4)();for(;null!=this.onSaveCb[t];)t=(0,i.v4)();return this.onSaveCb[t]=e,t}removeOnSave(e){delete this.onSaveCb[e]}onDeleteCb={};async triggerDelete(){let e=[];for(let t in this.onDeleteCb)e.push(this.onDeleteCb[t](this));await Promise.all(e),this.removeAllCallbacks()}removeAllCallbacks(){this.onCodeActionCb={},this.onCompletionCb={},this.onCompletionResolveCb={},this.onContentChangeCb={},this.onDefinitionCb={},this.onDeleteCb={},this.onFormattingCb={},this.onHoverCb={},this.onSaveCb={}}onDelete(e){let t=(0,i.v4)();for(;null!=this.onDeleteCb[t];)t=(0,i.v4)();return this.onDeleteCb[t]=e,t}removeOnDelete(e){delete this.onDeleteCb[e]}onCompletionCb={};async getCompletion(e){let t={isIncomplete:!1,items:[]},n=[];for(let t in this.onCompletionCb)n.push(this.onCompletionCb[t](this,e));let r=await Promise.all(n),i={};for(let e of r)for(let t of e.items){let e=JSON.stringify(t);i[e]||(i[e]=t)}return t.items=Object.values(i),t}onCompletion(e){let t=(0,i.v4)();for(;null!=this.onCompletionCb[t];)t=(0,i.v4)();return this.onCompletionCb[t]=e,t}removeOnCompletion(e){delete this.onCompletionCb[e]}onCompletionResolveCb={};async getCompletionResolve(e){let t=e,n=[];for(let t in this.onCompletionResolveCb)n.push(this.onCompletionResolveCb[t](this,e));return t}onCompletionResolve(e){let t=(0,i.v4)();for(;null!=this.onCompletionResolveCb[t];)t=(0,i.v4)();return this.onCompletionResolveCb[t]=e,t}removeOnCompletionResolve(e){delete this.onCompletionResolveCb[e]}onHoverCb={};async getHover(e){let t=[];for(let n in this.onHoverCb)t.push(this.onHoverCb[n](this,e));let n=await Promise.all(t);for(let e of n)if(e)return e;return null}onHover(e){let t=(0,i.v4)();for(;null!=this.onHoverCb[t];)t=(0,i.v4)();return this.onHoverCb[t]=e,t}removeOnHover(e){delete this.onHoverCb[e]}onDefinitionCb={};async getDefinition(e){let t=[];for(let n in this.onDefinitionCb)t.push(this.onDefinitionCb[n](this,e));let n=await Promise.all(t);for(let e of n)if(e)return e;return null}onDefinition(e){let t=(0,i.v4)();for(;null!=this.onDefinitionCb[t];)t=(0,i.v4)();return this.onDefinitionCb[t]=e,t}removeOnDefinition(e){delete this.onDefinitionCb[e]}onFormattingCb={};async getFormatting(e){let t={},n=[],r={start:this.documentUser.positionAt(0),end:this.documentUser.positionAt(this.documentUser.getText().length)};for(let t in this.onFormattingCb)n.push(this.onFormattingCb[t](this,r,e));let i=await Promise.all(n);for(let e of i)for(let n of e){let e=JSON.stringify(n);t[e]||(t[e]=n)}return Object.values(t)}onFormatting(e){let t=(0,i.v4)();for(;null!=this.onFormattingCb[t];)t=(0,i.v4)();return this.onFormattingCb[t]=e,t}removeOnFormatting(e){delete this.onFormattingCb[e]}onCodeActionCb={};async getCodeAction(e){let t=[],n=[];for(let t in this.onCodeActionCb)n.push(this.onCodeActionCb[t](this,e));let r=await Promise.all(n);for(let e of r)t=[...t,...e];return t}onCodeAction(e){let t=(0,i.v4)();for(;null!=this.onCodeActionCb[t];)t=(0,i.v4)();return this.onCodeActionCb[t]=e,t}removeOnCodeAction(e){delete this.onCodeActionCb[e]}onReferencesCb={};async getReferences(e){let t=[],n=[];for(let t in this.onReferencesCb)n.push(this.onReferencesCb[t](this,e));let r=await Promise.all(n);for(let e of r)t=[...t,...e];return t}onReferences(e){let t=(0,i.v4)();for(;null!=this.onReferencesCb[t];)t=(0,i.v4)();return this.onReferencesCb[t]=e,t}removeOnReferences(e){delete this.onReferencesCb[e]}onCodeLensCb={};async getCodeLens(){let e=[],t=[];for(let e in this.onCodeLensCb)t.push(this.onCodeLensCb[e](this));let n=await Promise.all(t);for(let t of n)e=[...e,...t];return e}onCodeLens(e){let t=(0,i.v4)();for(;null!=this.onCodeLensCb[t];)t=(0,i.v4)();return this.onCodeLensCb[t]=e,t}removeOnCodeLens(e){delete this.onCodeLensCb[e]}onRenameCb={};async getRename(e,t){let n=[];for(let r in this.onRenameCb)n.push(this.onRenameCb[r](this,e,t));let r=await Promise.all(n);for(let e of r)if(e)return e;return null}onRename(e){let t=(0,i.v4)();for(;null!=this.onRenameCb[t];)t=(0,i.v4)();return this.onRenameCb[t]=e,t}removeOnRename(e){delete this.onRenameCb[e]}}},83693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilesManager=void 0;const r=n(57147),i=n(18952),s=n(19408),a=n(1539),o=n(72375),l=n(36790),c=n(16378),u=n(24964),p=n(71743),_=n(29495),d=n(71017),h=n(40529),f=n(62814);class m{static instance;static getInstance(){return this.instance||(this.instance=new m),this.instance}constructor(){}files={};lockedUpdatedUri={};loadingInProgress=!0;preventUpdateUri(e){this.lockedUpdatedUri[e]&&clearTimeout(this.lockedUpdatedUri[e]),this.lockedUpdatedUri[e]=setTimeout((()=>{delete this.lockedUpdatedUri[e]}),2e3)}async onCreatedUri(e){if(!this.files[e]){let t=(0,a.getLanguageIdByUri)(e),n=(0,a.uriToPath)(e),s=i.TextDocument.create(e,t,0,(0,r.readFileSync)(n,"utf8"));this.registerFile(s)}}async onUpdatedUri(e){if(this.lockedUpdatedUri[e])return;let t=(0,a.getLanguageIdByUri)(e),n=(0,a.uriToPath)(e),s="";if((0,r.existsSync)(n))if(s=(0,r.readFileSync)(n,"utf8"),this.files[e]){let n=this.files[e].versionUser+1,r=i.TextDocument.create(e,t,n,s);await this.onContentChange(r),this.onSave(r)}else{let n=i.TextDocument.create(e,t,0,s);this.registerFile(n)}else this.onDeletedUri(e)}async onDeletedUri(e){if(this.files[e]){if(_.SettingsManager.getInstance().settings.errorByBuild){const t=this.files[e].getBuild();for(let n of t)u.GenericServer.sendDiagnostics({uri:e,diagnostics:[]},n)}else u.GenericServer.sendDiagnostics({uri:e,diagnostics:[]});await this.files[e].triggerDelete(),delete this.files[e],p.FilesWatcher.getInstance().unwatch(e)}}async loadConfigFileNotSet(e,t,n){for(let i=0;i<e.length;i++){let o=(0,a.uriToPath)(e[i]),l=async e=>{let i=(0,r.readdirSync)(e);for(let o=0;o<i.length;o++){let c=e+"/"+i[o];if((0,r.lstatSync)(c).isDirectory()){if("node_modules"!=i[o]&&await l(c))return!0}else{let e=(0,a.pathToUri)(c);if(i[o]==s.AventusExtension.Config)return await this.loadConfigFile(e,t,n),!0}}return!1};if(await l(o))return}u.GenericServer.showErrorMessage("Can't find a aventus.config.avt inside the workspaces "+e.join(", "))}async loadConfigFile(e,t,n){h.ProjectManager.autoLoad=!1;let o=(0,a.uriToPath)(e);e=(0,a.pathToUri)(o);const l=i.TextDocument.create((0,a.pathToUri)(o),s.AventusExtension.Config,0,(0,r.readFileSync)(o,"utf8"));this.loadingInProgress=!1,await this.registerFile(l),this.loadingInProgress=!0;const u=h.ProjectManager.getInstance().getProjectByUri(e);if(u){await u.loadConfig(),u.buildsAllowed=t,u.staticsAllowed=n;const e=u.getConfig();if(e){let n=async e=>{if(!(0,r.existsSync)(e))return;let t=(0,r.readdirSync)(e);for(let o=0;o<t.length;o++){let l=e+"/"+t[o];if((0,r.lstatSync)(l).isDirectory())"node_modules"!=t[o]&&await n(l);else{let e=(0,a.pathToUri)(l),n=(0,a.getLanguageIdByUri)(e);if(t[o]==s.AventusExtension.Config);else if(t[o].endsWith(s.AventusExtension.Base)){let t=i.TextDocument.create(e,n,0,(0,r.readFileSync)(l,"utf8"));await this.registerFile(t)}}}};for(let r of e.build)if(!t||t.includes(r.name))for(let e of r.srcPath)await n(e);f.Statistics.startSendLoadFile(),u.loadFiles(),f.Statistics.sendLoadFile(),this.loadingInProgress=!1,await u.init(),c.InitStep.sendDone()}}}async loadAllAventusFiles(e){this.loadingInProgress=!0;let t=[],n=_.SettingsManager.getInstance().settings.readDirs;c.InitStep.send("$(loading~spin) Aventus : Loading files");for(let o=0;o<e.length;o++){let l=(0,a.uriToPath)(e[o]),c=e=>!0;if(n.length>0){let t=[];const r=[];for(let i of n){let n="",s=i.replace(/\\/g,"/");s.startsWith("/")||(n="/");let l=s.split("/");""==l[l.length-1]||"*"==l[l.length-1]?l[l.length-1]="*":-1==l[l.length-1].indexOf(".")&&l.push("*"),s=l.join("/");let c=(0,d.normalize)((0,a.uriToPath)(e[o])+n+s).replace(/\\/g,"/");c=(0,a.escapeRegex)(c,!0).replace("*",".*");let u=c.split("/"),p="";for(let e of u)".*"!=e&&(""==p?p=e:p+="/"+e,r.includes(p)||r.push(p));t.push("(^"+c+"$)")}let i=t.join("|");""==i&&(i="(?!)");const s=new RegExp(i);c=e=>{const t=null!=(e+"/").match(s),n=r.includes(e);return t||n}}let u=async e=>{if(!c(e))return;let n=(0,r.readdirSync)(e);for(let o=0;o<n.length;o++){let l=e+"/"+n[o];if((0,r.lstatSync)(l).isDirectory())"node_modules"!=n[o]&&await u(l);else{let e=(0,a.pathToUri)(l),c=(0,a.getLanguageIdByUri)(e);if(n[o]==s.AventusExtension.Config)t.push(i.TextDocument.create(e,c,0,(0,r.readFileSync)(l,"utf8")));else if(n[o].endsWith(s.AventusExtension.Base)){let t=i.TextDocument.create(e,c,0,(0,r.readFileSync)(l,"utf8"));await this.registerFile(t)}}}};await u(l)}c.InitStep.send("$(loading~spin) Aventus : Register config"),this.loadingInProgress=!1;for(let e of t)await this.registerFile(e);c.InitStep.sendDone()}async onShutdown(){for(let e in this.files)await this.files[e].triggerDelete(),delete this.files[e],p.FilesWatcher.getInstance().unwatch(e)}async registerFilePackage(e){let t=(0,a.uriToPath)(e),n="";(0,r.existsSync)(t)&&(n=(0,r.readFileSync)(t,"utf8"));let o=i.TextDocument.create(e,s.AventusLanguageId.Package,0,n);return p.FilesWatcher.getInstance().watch(e),await this.registerFile(o)}async registerFile(e){return u.GenericServer.isDebug()&&console.log("registering "+e.uri),this.files[e.uri]?await this.files[e.uri].triggerContentChange(e):await this.triggerOnNewFile(e),this.files[e.uri]}async onContentChange(e){this.files[e.uri]?await this.files[e.uri].triggerContentChange(e):await this.triggerOnNewFile(e)}async onSave(e){this.files[e.uri]?await this.files[e.uri].triggerSave():await this.triggerOnNewFile(e)}async onClose(e){(0,r.existsSync)((0,a.uriToPath)(e.uri))||this.onDeletedUri(e.uri)}async onCompletion(e,t){return this.files[e.uri]?this.files[e.uri].getCompletion(t):{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return this.files[e.uri]?this.files[e.uri].getCompletionResolve(t):t}async onHover(e,t){return this.files[e.uri]?this.files[e.uri].getHover(t):null}async onDefinition(e,t){return this.files[e.uri]?this.files[e.uri].getDefinition(t):null}async onFormatting(e,t){return this.files[e.uri]?this.files[e.uri].getFormatting(t):[]}async onCodeAction(e,t){return this.files[e.uri]?this.files[e.uri].getCodeAction(t):[]}async onReferences(e,t){return this.files[e.uri]?this.files[e.uri].getReferences(t):[]}async onCodeLens(e){return this.files[e.uri]?this.files[e.uri].getCodeLens():[]}async onRename(e,t,n){return this.files[e.uri]?this.files[e.uri].getRename(t,n):null}getBuild(e){return this.files[e.uri]?this.files[e.uri].getBuild():[]}onNewFileCb={};async triggerOnNewFile(e){if(u.GenericServer.isDebug()&&console.log("triggerOnNewFile "+e.uri),this.loadingInProgress&&e.uri.endsWith(s.AventusExtension.Config))return;this.files[e.uri]=new o.InternalAventusFile(e);let t=[];for(let n in this.onNewFileCb)t.push(this.onNewFileCb[n](this.files[e.uri]));await Promise.all(t)}onNewFile(e){let t=(0,l.v4)();for(;null!=this.onNewFileCb[t];)t=(0,l.v4)();return this.onNewFileCb[t]=e,t}removeOnNewFile(e){delete this.onNewFileCb[e]}onFileRemoveCb={};async triggerOnFileRemove(e){u.GenericServer.isDebug()&&console.log("triggerOnFileRemove "+e);let t=[];for(let n in this.onFileRemoveCb)t.push(this.onFileRemoveCb[n](e));await Promise.all(t)}onFileRemove(e){let t=(0,l.v4)();for(;null!=this.onNewFileCb[t];)t=(0,l.v4)();return this.onFileRemoveCb[t]=e,t}removeOnFileRemove(e){delete this.onFileRemoveCb[e]}getFilesMatching(e){let t=[];for(let n in this.files){this.files[n].path.match(e)&&t.push(this.files[n])}return t}getFilesWithExtension(e){Array.isArray(e)||(e=[e]);let t=[];for(let n in this.files)for(let r of e)this.files[n].path.endsWith(r)&&t.push(this.files[n]);return t}getByPath(e){return this.files[(0,a.pathToUri)(e)]}getByUri(e){return this.files[e]}}t.FilesManager=m},71743:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilesWatcher=void 0;const r=n(17452),i=n(1539),s=n(83693),a=n(29495);class o{static instance;static getInstance(){return this.instance||(this.instance=new o),this.instance}watcher;constructor(){a.SettingsManager.getInstance().settings.onlyBuild||(this.watcher=(0,r.watch)("\t",{ignored:/(^|[\/\\])\../,persistent:!0}),this.watcher.on("add",this.onContentChange.bind(this)).on("change",this.onContentChange.bind(this)).on("unlink",this.onRemove.bind(this)))}watcheUris=[];watch(e){if(this.watcheUris.includes(e))return;if(!this.watcher)return;this.watcheUris.push(e);let t=(0,i.uriToPath)(e);this.watcher.add(t)}unwatch(e){let t=this.watcheUris.indexOf(e);-1!=t&&this.watcheUris.splice(t,1)}async onContentChange(e){let t=(0,i.pathToUri)(e);this.watcheUris.includes(t)&&s.FilesManager.getInstance().onUpdatedUri(t)}async onRemove(e){let t=(0,i.pathToUri)(e);this.watcheUris.includes(t)&&s.FilesManager.getInstance().onDeletedUri(t)}async destroy(){await(this.watcher?.close()),o.instance=void 0}}t.FilesWatcher=o},46492:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocalTemplateManager=void 0;const r=n(24964),i=n(1539);t.LocalTemplateManager=class{templateManager;constructor(e){this.templateManager=e}async createTemplate(e){let t=this.readTemplates();const n=await this.templateManager.query(t.templates);n&&await n.init(e)}readTemplates(){let e=this.templateManager.getGeneralTemplates(),t=this.templateManager.getGeneralTemplatesLength(),n=r.GenericServer.getWorkspaceUri();if(n){let r=(0,i.uriToPath)(n)+"/.aventus/templates";return this.templateManager.readTemplates([r],e,t)}return{templates:e,nb:t}}}},74647:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Template=void 0;const r=n(57147),i=n(71017),s=n(57310),a=n(32081),o=n(1539),l=n(40529),c=n(83693),u=n(24964),p=n(17111);t.Template=class{config;folderPath;currentVars={};configVars;currentConfig;filesToOpen=[];constructor(e,t){this.config=e,this.currentConfig=e,this.folderPath=t}async init(e){try{if(this.currentVars={},this.loadConfigVars(),await this.defineDefaultVars(e),await this.prepareNeededVars()){let t=this.moveFiles(e);await this.runCmds();for(let e of t)c.FilesManager.getInstance().onCreatedUri(e);this.openFiles()}}catch(e){console.log(e)}}loadConfigVars(){if(!this.configVars){this.configVars=[];let e=JSON.stringify(this.config);const t=/\$\{\{(.*?)\}\}/gm;let n;for(;null!==(n=t.exec(e));)this.configVars.includes(n[1])||this.configVars.push(n[1])}}async defineDefaultVars(e){let t=e.split(i.sep);this.setVar("folderName",t[t.length-1]),this.setVar("path",e);const n=this.getProjectInfo(e);this.setVar("namespace",n.namespace),this.setVar("module",n.module)}getProjectInfo(e){let t={namespace:"",module:""},n=(0,o.pathToUri)(e),r=l.ProjectManager.getInstance().getMatchingBuildsByUri(n);return r.length>0&&(t.namespace=r[0].getNamespaceForUri(n,!1),t.module=r[0].project.getConfig()?.module??""),t}async prepareNeededVars(){for(let e in this.currentConfig.variables){let t=this.currentConfig.variables[e];if("input"==t.type){let n=t.defaultValue??"";const r=await u.GenericServer.Input({title:t.question,value:n,validations:t.validation?.map((e=>({regex:e.pattern,message:e.errorMsg??"Error"})))});if(!r)return!1;this.setVar(e,r)}}return!0}moveFiles(e){let t=[],n={},s=[];const a=l=>{let c=(0,r.readdirSync)(l);for(let u of c){let c=l+i.sep+u,p=c.replace(this.folderPath,e);for(let e in this.currentVars){const t=new RegExp("\\$\\{\\{"+e+"\\}\\}","gm");p=p.replace(t,this.currentVars[e])}if(p=(0,i.normalize)(p),(0,r.statSync)(c).isDirectory()){if(".git"==u)continue;(0,r.mkdirSync)(p),a(c)}else{if(c==this.folderPath+i.sep+"template.avt")continue;let e=(0,r.readFileSync)(c,"utf-8");for(let t in this.currentVars){const n=new RegExp("\\$\\{\\{"+t+"\\}\\}","gm");e=e.replace(n,this.currentVars[t]);const r=new RegExp("\\$\\{\\{"+t+"\\|lower\\}\\}","gm");e=e.replace(r,this.currentVars[t].toLowerCase())}if(this.currentConfig.filesToOpen)for(let e of this.currentConfig.filesToOpen)this.comparePath(p,e)&&t.push(p);"aventus.conf.avt"!=u?((0,r.writeFileSync)(p,e),p.endsWith(".avt")&&s.push((0,o.pathToUri)(p))):n[p]=e}}};a(this.folderPath);for(let e in n)(0,r.writeFileSync)(e,n[e]),s.push((0,o.pathToUri)(e));return this.filesToOpen=t,s}openFiles(){for(let e of this.filesToOpen)u.GenericServer.sendNotification("aventus/openfile",(0,s.pathToFileURL)(e).toString())}comparePath(e,t){let n=[e],r=(0,o.uriToPath)(u.GenericServer.getWorkspaceUri()),s="."+e.replace(r,"").replace(/\\/g,"/");if(n.push(s),t.match(/\/\S+\/g?m?s?i?x?s?u?/g)){let e=t.split("/"),r=new RegExp(e[1],e[2]);for(let e of n)if(e.match(r))return!0}else{if((0,i.normalize)(e)==(0,i.normalize)(t))return!0;if(n.length>1&&(0,i.normalize)(n[1])==(0,i.normalize)(t))return!0}return!1}setVar(e,t){if(!this.currentVars[e]&&(this.currentVars[e]=t,this.configVars?.includes(e))){const n=new RegExp("\\$\\{\\{"+e+"\\}\\}","gm");let r=JSON.stringify(t).slice(1,-1),i=JSON.stringify(this.currentConfig).replace(n,r);this.currentConfig=JSON.parse(i)}}runCmds(){return new Promise((e=>{setTimeout((()=>{let t={},n=(0,o.uriToPath)(u.GenericServer.getWorkspaceUri());if(t.cwd=n,this.currentConfig.cmdsAfter)for(let e of this.currentConfig.cmdsAfter)try{(0,a.execSync)(e,t)}catch(t){console.log(t),u.GenericServer.showErrorMessage("The command "+e+" failed")}if(this.currentConfig.cmdsAfterAdmin)for(let e of this.currentConfig.cmdsAfterAdmin)try{let t=`cd /d "${n}"`;"darwin"==process.platform&&(t=`cd "${n}"`),(0,p.exec)("cd "+n+" && "+e,((e,t,n)=>{e&&(console.log("error: "+e),console.log("stdout: "+t),console.log("stderr: "+n))}))}catch(t){console.log(t),u.GenericServer.showErrorMessage("The command "+e+" failed")}e()}),500)}))}}},5441:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateManager=void 0;const r=n(57147),i=n(24964),s=n(71017),a=n(74647),o=n(29495),l=n(1539),c=n(61721),u=n(56668),p=n(32081);t.TemplateManager=class{templatePath=[];projectPath=[];loadedTemplates={};loadedProjects={};loadedProjectsLength=0;loadedTemplatesLength=0;getGeneralTemplates(){return this.loadedTemplates}getGeneralTemplatesLength(){return this.loadedTemplatesLength}constructor(){this.loadTemplates(),o.SettingsManager.getInstance().onSettingsChange((()=>{this.loadTemplates()})),this.validateEmptyFolder()}loadTemplates(){let e=i.GenericServer.savePath;(0,r.existsSync)(e)||(0,r.mkdirSync)(e),this.templatePath=o.SettingsManager.getInstance().settings.templatePath;let t=(0,s.normalize)(e+s.sep+"templates");this.prepareFolders(this.templatePath,t),this.projectPath=o.SettingsManager.getInstance().settings.projectPath;let n=(0,s.normalize)(e+s.sep+"projects"),a=!(0,r.existsSync)(n);this.prepareFolders(this.projectPath,n),a&&this.askTemplate(),this.reloadTemplates(),this.reloadProjects()}reloadTemplates(){const e=this.readBaseTemplates(),t=this.readTemplates(this.templatePath,e.templates,e.nb);this.loadedTemplates=t.templates,this.loadedTemplatesLength=t.nb}reloadProjects(){const e=this.readTemplates(this.projectPath);this.loadedProjects=e.templates,this.loadedProjectsLength=e.nb}prepareFolders(e,t){e.includes(t)||e.splice(0,0,t);for(let t=0;t<e.length;t++)e[t]=(0,s.normalize)(e[t]),(0,r.existsSync)(e[t])||(0,r.mkdirSync)(e[t])}async createProject(e){if(0==this.loadedProjectsLength){return void("Yes"==await i.GenericServer.Popup("You have no template for project!! Do you want to load some?","Yes","No")&&this.selectTemplateToImport())}const t=await this.query(this.loadedProjects);t&&await t.init(e)}readBaseTemplates(){const e={};for(let t in u.BaseTemplateList){let n=new u.BaseTemplateList[t];(0,l.setValueToObject)(n.name(),e,n)}return{templates:e,nb:Object.keys(u.BaseTemplateList).length}}readTemplates(e,t={},n=0){const o=e=>{let c=(0,s.join)(e,"template.avt");if((0,r.existsSync)(c)){try{let i=JSON.parse((0,r.readFileSync)(c,"utf-8")),s=new a.Template(i,e);(0,l.setValueToObject)(s.config.name,t,s),n++}catch{i.GenericServer.showErrorMessage("Error when parsing file "+c)}return}let u=(0,r.readdirSync)(e);for(let t of u)try{let n=(0,s.join)(e,t);(0,r.statSync)(n).isDirectory()&&o(n)}catch(e){console.log(e)}};for(let t of e)(0,r.existsSync)(t)&&o(t);return{templates:t,nb:n}}async getGitURL(){return await i.GenericServer.Input({title:"Git url",validations:[{message:"Provide an http(s):// url ending with .git",regex:"^https?:\\//\\S*\\.git$"}]})}async askTemplate(){this.selectProjectToImport()}async selectProjectToImport(){if(0==this.projectPath.length)return void i.GenericServer.showErrorMessage("No project path registered");let e=i.GenericServer.extensionPath+s.sep+"projects",t=(0,r.readdirSync)(e),n=new Map;for(let i of t){let t=e+s.sep+i;if((0,r.statSync)(t).isDirectory()){let e=t+s.sep+"template.avt";if((0,r.existsSync)(e))try{let i=JSON.parse((0,r.readFileSync)(e,"utf-8")),s={label:i.name,detail:i.description??"",picked:!0};n.set(s,t)}catch{}}}n.set({label:"Git",detail:"Provide an http(s) url ending with .git"},"@Git");let a=await i.GenericServer.SelectMultiple(Array.from(n.keys()),{title:"Select projects to import"});if(a){for(let e of a){let t=this.getSelectItem(n,e);if("@Git"==t){const e=await this.getGitURL();e&&(0,p.execSync)("git clone "+e,{cwd:this.projectPath[0]})}else if(t){let e=t.split(s.sep).pop(),n=this.projectPath[0]+s.sep+e;(0,r.existsSync)(n)&&(0,r.rmSync)(n,{recursive:!0,force:!0}),(0,r.cpSync)(t,n,{force:!0,recursive:!0})}}this.reloadProjects()}}async selectTemplateToImport(){if(0==this.templatePath.length)return void i.GenericServer.showErrorMessage("No template path registered");let e=[];e.push({label:"Git",detail:"Provide an http url ending with .git"});let t=await i.GenericServer.Select(e,{title:"Select templates to import"});if(t&&"Git"==t.label){const e=await this.getGitURL();e&&((0,p.execSync)("git clone "+e,{cwd:this.templatePath[0]}),this.reloadTemplates())}}validateEmptyFolder(){let e=i.GenericServer.extensionPath+s.sep+"projects";const t=e=>{try{Array.isArray(e)&&(e=e.join(s.sep)),(0,r.existsSync)(e)||(0,r.mkdirSync)(e)}catch(e){}};t([e,"Default"]),t([e,"Default","src"]),t([e,"Default","src","components"]),t([e,"Default","src","data"]),t([e,"Default","src","lib"]),t([e,"Default","src","ram"]),t([e,"Default","src","states"]),t([e,"Default","src","static"]),t([e,"Empty"]),t([e,"Empty","src"])}getSelectItem(e,t){for(let n of e.keys())if(n.label==t.label)return e.get(n);return null}async query(e){let t=new Map,n=new Map,r=new Map;const s=[];for(let i in e){const o=e[i];let l;o instanceof a.Template?(l={label:i,detail:o.config.description??""},n.set(l,o)):o instanceof c.BaseTemplate?(l={label:i,detail:o.definition()},r.set(l,o)):(l={label:i},t.set(l,o)),s.push(l)}const o=await i.GenericServer.Select(s,{placeHolder:"Choose a template"});if(o){let e=this.getSelectItem(n,o);if(e)return e;let i=this.getSelectItem(r,o);if(i)return i;let s=this.getSelectItem(t,o);if(s)return this.query(s)}return null}}},61721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTemplate=void 0;const r=n(22037),i=n(40529);t.BaseTemplate=class{addNamespace(e,t,n=!1){let s=i.ProjectManager.getInstance().getMatchingBuildsByUri(t);if(s.length>0){let i=s[0].getNamespaceForUri(t,n);""!=i&&(e="\t"+e.split("\n").join("\n\t"),e=`namespace ${i} {${r.EOL}${e}${r.EOL}}`)}return e}}},69342:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ComponentTemplate=void 0;const r=n(57147),i=n(24964),s=n(1539),a=n(61721),o=n(19408),l=n(18952),c=n(22037),u=n(83693),p=n(49404);class _ extends a.BaseTemplate{static componentFormatOptions=[{label:"Single",detail:"Single file"},{label:"Multiple",detail:"Splitted file"}];name(){return"Component.Basic"}definition(){return"Create a basic webcomponent"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your Component"});if(!t)return;const n=await i.GenericServer.Select(_.componentFormatOptions,{placeHolder:"How should I setup your component?"});n&&((0,s.reorderList)(_.componentFormatOptions,n),this.createComponent(t,e,"Multiple"==n.label))}createComponent(e,t,n){let i=(0,s.uriToPath)(t+"/"+e),a=(e=e.replace(/_|-([a-z])/g,((e,t)=>t.toUpperCase()))).charAt(0).toUpperCase()+e.slice(1);if(n){(0,r.mkdirSync)(i);let t=i+"/"+e,n=`export class ${a} extends Aventus.WebComponent implements Aventus.DefaultComponent {\n\n\t//#region static\n\t\n\t//#endregion\n\t\n\t\n\t//#region props\n\t\n\t//#endregion\n\t\n\t\n\t//#region variables\n\t\n\t//#endregion\n\t\n\t\n\t//#region constructor\n\t\n\t//#endregion\n\t\n\t\n\t//#region methods\n\t\n\t//#endregion\n\t\n}`;n=this.addNamespace(n,(0,s.pathToUri)(t+o.AventusExtension.ComponentLogic),!0),(0,r.writeFileSync)(t+o.AventusExtension.ComponentLogic,n);let _=l.TextDocument.create((0,s.pathToUri)(t+o.AventusExtension.ComponentLogic),o.AventusLanguageId.TypeScript,0,n),d=":host {"+c.EOL+"\t"+c.EOL+"}"+c.EOL;(0,r.writeFileSync)(t+o.AventusExtension.ComponentStyle,d);let h=l.TextDocument.create((0,s.pathToUri)(t+o.AventusExtension.ComponentStyle),o.AventusLanguageId.SCSS,0,d),f="<slot></slot>";(0,r.writeFileSync)(t+o.AventusExtension.ComponentView,f);let m=l.TextDocument.create((0,s.pathToUri)(t+o.AventusExtension.ComponentView),o.AventusLanguageId.HTML,0,f);u.FilesManager.getInstance().registerFile(m),u.FilesManager.getInstance().registerFile(h),u.FilesManager.getInstance().registerFile(_),p.OpenFile.send(_.uri)}else{let e=`<script>\n\texport class ${a} extends Aventus.WebComponent implements Aventus.DefaultComponent {\n\n\t}\n<\/script>\n\n<template>\n\t<slot></slot>\n</template>\n\n<style>\n\t:host {\n\n\t}\n</style>\n`;(0,r.writeFileSync)(i+o.AventusExtension.Component,e);let t=l.TextDocument.create((0,s.pathToUri)(i+o.AventusExtension.Component),o.AventusLanguageId.WebComponent,0,e);u.FilesManager.getInstance().registerFile(t),p.OpenFile.send(t.uri)}}}t.ComponentTemplate=_},44502:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataTemplate=void 0;const r=n(22037),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(57147),c=n(18952),u=n(83693),p=n(49404);class _ extends o.BaseTemplate{name(){return"Data.Basic"}definition(){return"Create a basic data"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your Data"});t&&this.createData(t,e)}createData(e,t){let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.Data),i=(0,a.pathToUri)(n),o=`export class ${(e=e.replace(/_|-([a-z])/g,((e,t)=>t.toUpperCase()))).charAt(0).toUpperCase()+e.slice(1)} extends Aventus.Data implements Aventus.IData {${r.EOL}\tpublic id: number = 0;${r.EOL}}`;o=this.addNamespace(o,i),(0,l.writeFileSync)(n,o);let _=c.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);u.FilesManager.getInstance().registerFile(_),p.OpenFile.send(_.uri)}}t.DataTemplate=_},45905:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LibraryTemplate=void 0;const r=n(22037),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(57147),c=n(18952),u=n(83693),p=n(49404);class _ extends o.BaseTemplate{name(){return"Library.Default Class Library"}definition(){return"Create a basic library class"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your Library"});t&&this.createLib(t,e)}createLib(e,t){let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.Lib),i=(0,a.pathToUri)(n),o=`export class ${(e=e.replace(/_|-([a-z])/g,((e,t)=>t.toUpperCase()))).charAt(0).toUpperCase()+e.slice(1)} {${r.EOL}\t${r.EOL}}`;o=this.addNamespace(o,i),(0,l.writeFileSync)(n,o);let _=c.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);u.FilesManager.getInstance().registerFile(_),p.OpenFile.send(_.uri)}}t.LibraryTemplate=_},86147:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RamTemplate=void 0;const r=n(57147),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(18952),c=n(83693),u=n(49404);class p extends o.BaseTemplate{definition(){return"Create a basic RAM"}name(){return"RAM.Basic"}async init(e){const t=await i.GenericServer.Input({title:"Provide a data name for your RAM"});if(!t)return;const n=await i.GenericServer.Select([{label:"Yes"},{label:"No"}],{title:"Do you need to add custom methods on RAM"});if(!n)return;let r="Yes"==n.label;this.createRAM(t,e,r)}createRAM(e,t,n){e=e.charAt(0).toUpperCase()+e.slice(1);let i=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.RAM),o=(0,a.pathToUri)(i),p=e+"RAM",_="";_=n?`\ninterface ${e}Method {\n\t// define your methods here\n\t\n}\n\nexport type ${e}Extended = ${e} & ${e}Method;\n\nexport class ${p} extends Aventus.Ram<${e}, ${e}Extended> implements Aventus.IRam {\n\n\t/**\n\t * Create a singleton to store data\n\t */\n\tpublic static getInstance(): ${p} {\n\t\treturn Aventus.Instance.get(${p});\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic override defineIndexKey(): keyof ${e} {\n\t\treturn 'id';\n\t}\n\t/**\n\t * @inheritdoc\n\t */\n\tprotected override getTypeForData(objJson: Aventus.KeysObject<${e}> | ${e}): new () => ${e}Extended {\n\t\treturn this.add${e}Method(${e});\n\t}\n\n\t/**\n\t * Mixin pattern to add methods\n\t */\n\tprivate add${e}Method<B extends (new (...args: any[]) => ${e}) & { className?: string; }>(Base: B) {\n\t\treturn class Extension extends Base implements ${e}Extended {\n\t\t\tpublic static override get className(): string {\n return Base.className || Base.name;\n }\n public override get className(): string {\n return Base.className || Base.name;\n }\n\n\t\t\t// code your methods here\n\n\t\t\t\n\t\t};\n\t}\n\n}`:`\nexport class ${p} extends Aventus.Ram<${e}> implements Aventus.IRam {\n\n\t/**\n\t * Create a singleton to store data\n\t */\n\tpublic static getInstance(): ${p} {\n\t\treturn Aventus.Instance.get(${p});\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic override defineIndexKey(): keyof ${e} {\n\t\treturn 'id';\n\t}\n\t/**\n\t * @inheritdoc\n\t */\n\tprotected override getTypeForData(objJson: Aventus.KeysObject<${e}> | ${e}): new () => ${e} {\n\t\treturn ${e};\n\t}\n}`,_=this.addNamespace(_,o),(0,r.writeFileSync)(i,_);let d=l.TextDocument.create(o,s.AventusLanguageId.TypeScript,0,_);c.FilesManager.getInstance().registerFile(d),u.OpenFile.send(o)}}t.RamTemplate=p},54850:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateManagerTemplate=void 0;const r=n(57147),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(18952),c=n(83693),u=n(49404);class p extends o.BaseTemplate{name(){return"State.Basic State Manager"}definition(){return"Create a basic state manager"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your State Manager"});t&&this.createState(t,e)}createState(e,t){e=e.charAt(0).toUpperCase()+e.slice(1);let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.State),i=(0,a.pathToUri)(n),o="";e.endsWith("Manager")&&e.replace("Manager",""),o=`export class ${e}StateManager extends Aventus.StateManager implements Aventus.IStateManager {\n\t/**\n\t * Get the instance of the StateManager\n\t */\n\tpublic static getInstance(): ${e}StateManager {\n\t\treturn Aventus.Instance.get(${e}StateManager);\n\t}\n\n}`,o=this.addNamespace(o,i),(0,r.writeFileSync)(n,o);let p=l.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);c.FilesManager.getInstance().registerFile(p),u.OpenFile.send(i)}}t.StateManagerTemplate=p},97771:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateTemplate=void 0;const r=n(57147),i=n(24964),s=n(19408),a=n(1539),o=n(61721),l=n(18952),c=n(83693),u=n(49404);class p extends o.BaseTemplate{name(){return"State.Basic State"}definition(){return"Create a basic state"}async init(e){const t=await i.GenericServer.Input({title:"Provide a name for your State"});t&&this.createState(t,e)}createState(e,t){e=e.charAt(0).toUpperCase()+e.slice(1);let n=(0,a.uriToPath)(t+"/"+e+s.AventusExtension.State),i=(0,a.pathToUri)(n),o="";o=`export class ${e} extends Aventus.State implements Aventus.IState {\n\t/**\n\t * @inheritdoc\n\t */\n\tpublic override get name(): string {\n\t\treturn ;\n\t}\n}`,o=this.addNamespace(o,i),(0,r.writeFileSync)(n,o);let p=l.TextDocument.create(i,s.AventusLanguageId.TypeScript,0,o);c.FilesManager.getInstance().registerFile(p),u.OpenFile.send(i)}}t.StateTemplate=p},56668:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTemplateList=void 0;const r=n(69342),i=n(44502),s=n(45905),a=n(86147),o=n(54850),l=n(97771);t.BaseTemplateList={ComponentTemplate:r.ComponentTemplate,DataTemplate:i.DataTemplate,LibraryTemplate:s.LibraryTemplate,RamTemplate:a.RamTemplate,StateManagerTemplate:o.StateManagerTemplate,StateTemplate:l.StateTemplate}},67246:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusBaseFile=void 0;const r=n(42374),i=n(72375);t.AventusBaseFile=class{_file;_build;get file(){return this._file}get build(){return this._build}constructor(e,t){this._file=e,this._build=t,this.addEvents()}uuidEvents={onCanContentChange:"",onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onGetBuild:"",onRename:""};addEvents(){this.uuidEvents.onCanContentChange=this.file.onCanContentChange(this.onCanContentChange.bind(this)),this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onGetBuild=this.file.onGetBuild(this.onGetBuild.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnCanContentChange(this.uuidEvents.onCanContentChange),this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnGetBuild(this.uuidEvents.onGetBuild),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof i.InternalAventusFile&&await this.file.validate()}async triggerSave(){this.file instanceof i.InternalAventusFile&&await this.file.triggerSave()}async triggerDelete(){this.file instanceof i.InternalAventusFile&&await this.file.triggerDelete()}async triggerContentChange(e){this.file instanceof i.InternalAventusFile&&await this.file.triggerContentChange(e)}onCanContentChange(e){return this._file.versionUser!=e.version}oldResult=[];async _onValidate(){let e=this._build.diagnostics.get(this)??[];return e=[...e,...await this.onValidate()],this.build&&this.build.hideWarnings&&(e=e.filter((e=>e.severity!=r.DiagnosticSeverity.Warning))),this.oldResult=e,e}async _onDelete(){await this.onDelete(),this.removeEvents()}}},37071:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusGlobalBaseFile=void 0;const r=n(72375);t.AventusGlobalBaseFile=class{_file;_project;get file(){return this._file}get project(){return this._project}constructor(e,t){this._file=e,this._project=t,this.addEvents()}uuidEvents={onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onRename:""};addEvents(){this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof r.InternalAventusFile&&await this.file.validate()}triggerSave(){this.file instanceof r.InternalAventusFile&&this.file.triggerSave()}async triggerContentChange(){this.file instanceof r.InternalAventusFile&&await this.file.triggerContentChange(this.file.documentUser)}async _onValidate(){return await this.onValidate()}async _onDelete(){await this.onDelete(),this.removeEvents()}}},95896:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusHTMLFile=void 0;const r=n(19408),i=n(67246),s=n(16286),a=n(57999),o=n(56733),l=n(18952),c=n(28180);class u extends i.AventusBaseFile{fileParsed;tsErrors=[];version=-1;get compiledVersion(){return this.version}get tsFile(){let e=this.build.tsFiles[this.file.uri.replace(r.AventusExtension.ComponentView,r.AventusExtension.ComponentLogic)];return e instanceof s.AventusWebComponentLogicalFile?e:null}get scssFile(){let e=this.build.scssFiles[this.file.uri.replace(r.AventusExtension.ComponentView,r.AventusExtension.ComponentStyle)];return e instanceof o.AventusWebSCSSFile?e:null}constructor(e,t){super(e,t)}async init(){await this.refreshFileParsed()}refreshFileParsed(){this.fileParsed=a.ParserHtml.parse(this,this.build);let e=a.ParserHtml.getVersion(this);return this.version!=e&&(this.version=e,this.file.validate(),!0)}async onValidate(){let e=await this.build.htmlLanguageService.doValidation(this.file);return this.fileParsed&&(e=[...e,...this.fileParsed.errors]),e=[...e,...this.tsErrors],this.tsFile&&(e=[...e,...this.tsFile.htmlDiagnostics]),e}async onContentChange(){await this.compile()}async onSave(){await(this.tsFile?.triggerSave())}async compile(){try{this.refreshFileParsed()&&await(this.tsFile?.validate())}catch(e){console.error(e)}}async onDelete(){}async onCompletion(e,t){let n=await(this.tsFile?.doViewCompletion(t));return n||this.build.htmlLanguageService.doComplete(this,t)}async onCompletionResolve(e,t){return t}async getHover(e){return this.onHover(this.file,this.file.documentUser.positionAt(e))}async onHover(e,t){let n=await(this.tsFile?.doHover(t));return n||await this.build.htmlLanguageService.doHover(this,t)}async onDefinition(e,t){let n=await(this.tsFile?.doDefinition(t));return n||this.build.htmlLanguageService.onDefinition(this,t)}async onFormatting(e,t,n){await this.compile();let r=await this.applyJsFormatting(t,n);return this.applyHtmlFormatting(e,t,n,r)}async applyJsFormatting(e,t){let n=await(this.tsFile?.doFormatting(e,t))??[];if(!this.fileParsed)return{};let r=new Map,i=new Map,s=new Map;for(let e of n)if("fct"==e.kind)for(let t in this.fileParsed.fcts){let n=this.fileParsed.fcts[t];if(n.positions.find((t=>t.start==e.start&&t.end==e.end))){let t=r.get(n);t||(t=[],r.set(n,t)),t.push({start:e.edit.range.start-e.start,end:e.edit.range.end-e.start,txt:e.edit.newText});break}}else if("loop"==e.kind){for(let t of this.fileParsed.loops)if(t.start==e.start&&t.startBlock==e.end){let n=i.get(t);n||(n=[],i.set(t,n)),n.push({start:e.edit.range.start-e.start,end:e.edit.range.end-e.start,txt:e.edit.newText})}}else if("if"==e.kind)for(let t of this.fileParsed.ifs)for(let n of t.conditions)if(n.start==e.start&&n.end==e.end){let t=s.get(n);t||(t=[],s.set(n,t)),t.push({start:e.edit.range.start-e.start,end:e.edit.range.end-e.start,txt:e.edit.newText})}let a={};for(let[e,t]of r){let n="{{"+e.txt+"}}";a[n]=n,t.sort(((e,t)=>t.end-e.end));for(let e of t)a[n]=a[n].slice(0,e.start)+e.txt+a[n].slice(e.end)}for(let[e,t]of i){let n=e.idTemplate,r=e.loopTxt;t.sort(((e,t)=>t.end-e.end));for(let e of t)r=r.slice(0,e.start)+e.txt+r.slice(e.end);r=r.slice(0,r.length-1),a["<"+c.ForLoop.tagName+' id="'+n+'">']=r}for(let e of this.fileParsed.loops)i.has(e)||(a["<"+c.ForLoop.tagName+' id="'+e.idTemplate+'">']=e.loopTxt.slice(0,e.loopTxt.length-1));for(let[e,t]of s){let n=e.idTemplate,r=e.txt;t.sort(((e,t)=>t.end-e.end));for(let e of t)r=r.slice(0,e.start)+e.txt+r.slice(e.end);"if"==e.type?r="if("+r+") {":"elif"==e.type&&(r="else if("+r+") {"),a["<"+c.IfInfo.tagName+' id="'+n+'">']=r}for(let e of this.fileParsed.ifs){for(let t of e.conditions)if(!s.has(t)){let e=t.txt;"if"==t.type?e="if("+e+") {":"elif"==t.type&&(e="else if("+e+") {"),a["<"+c.IfInfo.tagName+' id="'+t.idTemplate+'">']=e}e.conditions.length!=e.idsTemplate.length&&(a["<"+c.IfInfo.tagName+' id="'+e.idsTemplate[e.idsTemplate.length-1]+'">']="else {")}for(let e of this.fileParsed.contextEdits){let t="@Context("+(e.mapping.length>0?e.mapping[0]:"")+", "+(e.mapping.length>1?e.mapping[1]:"")+")";a["<"+c.ContextEditing.tagName+' id="'+e.id+'"></'+c.ContextEditing.tagName+">"]=t}return a["</"+c.ForLoop.tagName+">"]="}",a["</"+c.IfInfo.tagName+">"]="}",a}async applyHtmlFormatting(e,t,n,r){if(!this.fileParsed)return[];let i=this.fileParsed?.compiledTxt,s=l.TextDocument.create(e.documentUser.uri,e.documentUser.languageId,e.documentUser.version,i),a=(await this.build.htmlLanguageService.format(s,t,n))[0].newText;for(let e in r){let t=new RegExp(e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"g");a=a.replace(t,r[e])}return a=a.replace(/\{\{ *([^\n][\s|\S]*?) *\n?\}\}/g,"{{ $1 }}"),[{newText:a,range:{start:e.documentUser.positionAt(0),end:e.documentUser.positionAt(e.contentUser.length)}}]}async onCodeAction(e,t){return[]}async onReferences(e,t){let n=await(this.tsFile?.doReferences(t));return n||this.build.htmlLanguageService.getLinkToStyle(this,t)}async onCodeLens(e){return[]}onGetBuild(){return[this.build]}async onRename(e,t,n){let r=await(this.tsFile?.doRename(t,n));return r||null}}t.AventusHTMLFile=u},38344:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusHTMLLanguageService=void 0;const r=n(7082),i=n(42374),s=n(19408),a=n(61949),o=n(46057),l=n(37559),c=n(65887),u=n(1539);t.AventusHTMLLanguageService=class{languageService;id=0;isAutoComplete=!1;customTagsData=[];documentationInfo={};extenalDocumentation={};internalDocumentation={};internalDocumentationReverse={};internalTagUri={};constructor(e){this.languageService=this.getHTMLLanguageService()}getInternalDocumentation(){let e={};for(let t in this.internalDocumentation)try{e={...e,...this.internalDocumentation[t]}}catch(e){}return e}getClassByTag(e){let t=this.documentationInfo[e];return t?t.class:null}getGenericHTML(e){return a.allGenericTags[e]?a.allGenericTags[e]:null}getHTMLLanguageService(){return(0,r.getLanguageService)({useDefaultDataProvider:!0,customDataProviders:[{getId:this.getId.bind(this),isApplicable:e=>e==s.AventusLanguageId.HTML,provideTags:this.provideTags.bind(this),provideAttributes:this.provideAttributes.bind(this),provideValues:this.provideValues.bind(this)}]})}getId(){return this.id+""}provideTags(){return this.customTagsData}provideAttributes(e){let t=[...a.defaultAttrs];if(this.documentationInfo[e]){let n=this.documentationInfo[e].attributes;for(let e in n){let r=n[e];this.isAutoComplete?t.push({name:"!!"+r.name,description:JSON.stringify({description:r.description,type:r.type})}):t.push({name:r.name,description:r.description})}}return t}provideValues(e,t){return this.documentationInfo[e]&&this.documentationInfo[e].attributes[t]?this.documentationInfo[e].attributes[t].values:[]}async doValidation(e){return[]}async doComplete(e,t){let n=this.languageService.parseHTMLDocument(e.file.documentUser);if(n){this.isAutoComplete=!0;let r=this.languageService.doComplete(e.file.documentUser,t,n);this.isAutoComplete=!1;for(let e of r.items){if(e.label.startsWith("!!")&&(e.kind=i.CompletionItemKind.Snippet,e.textEdit)){let t=e.label.replace("!!","");if(e.textEdit.newText=e.textEdit.newText.replace(e.label,t),e.documentation){let t=JSON.parse(e.documentation.value);""==t.description&&delete e.documentation,"boolean"==t.type&&(e.textEdit.newText=e.textEdit.newText.split("=")[0])}e.label=t}e.kind==i.CompletionItemKind.Property&&e.textEdit&&(e.textEdit.newText.endsWith(">")||(e.textEdit.newText+="></"+e.textEdit.newText+">"))}return r.items=r.items.concat(this.doCustomComplete(e,t)),r}return{isIncomplete:!1,items:[]}}doCustomComplete(e,t){let n=[];if(!e.fileParsed)return n;let s=e.file.documentUser,o=s.offsetAt(t);for(let t of e.fileParsed.tags){if(o<t.start)break;if(o>=t.openTagStart&&o<=t.openTagEnd)return n}let l=(0,u.convertRange)(s,(0,u.getWordAtText)(s.getText(),o)),c=s.getText().slice(s.offsetAt(l.start),s.offsetAt(l.end));for(let e in a.defaultSnippet)e.startsWith(c)&&n.push({label:e,kind:i.CompletionItemKind.Snippet,insertText:a.defaultSnippet[e],insertTextFormat:r.InsertTextFormat.Snippet,insertTextMode:r.InsertTextMode.adjustIndentation});return n}async doHover(e,t){let n=this.getLinkToLogic(e,t);if(n)return{contents:{kind:"markdown",value:n.documentation?.fullDefinitions.join("\n")??""}};{let n=this.languageService.parseHTMLDocument(e.file.documentUser);if(n)return this.languageService.doHover(e.file.documentUser,t,n)}return null}async format(e,t,n){return this.languageService.format(e,t,n)}async onDefinition(e,t){let n=this.getLinkToLogic(e,t),r=e.tsFile;return(n instanceof o.MethodInfo||n instanceof l.PropertyInfo)&&r?{uri:r.file.uri,range:{start:r.file.documentUser.positionAt(n.nameStart),end:r.file.documentUser.positionAt(n.nameEnd)}}:n instanceof c.ClassInfo?{uri:n.document.uri,range:{start:n.document.positionAt(n.nameStart),end:n.document.positionAt(n.nameEnd)}}:null}getLinkToLogic(e,t){let n=e.file.documentUser.offsetAt(t),r=e.tsFile,i=r?.fileParsed?.classes[r.getComponentName()];if(r&&i&&e.fileParsed)for(let t of e.fileParsed.interestPoints){if(n>=t.start&&n<=t.end){let n=null;if("method"==t.type)n=i.methods[t.name];else if("property"==t.type)n=i.properties[t.name];else if("tag"==t.type){let n=this.documentationInfo[t.name];if(n){let t=this.internalDocumentationReverse[n.class];if(t&&t.fileParsed)for(let e in t.fileParsed.classes)if(e==n.class)return t.fileParsed.classes[e];let r=e.build.getWebComponentDefinition(n.name,!0);if(r)return r.class}}return n}if(t.end>=n)return null}return null}getLinkToStyle(e,t){let n=[],r=e.file.documentUser.offsetAt(t),i=e.scssFile;if(i&&e.fileParsed)for(let t of e.fileParsed.styleLinks){let e=t[0];r>=e.start&&r<=e.end&&n.push({uri:i.file.uri,range:{start:i.file.documentUser.positionAt(t[1].start),end:i.file.documentUser.positionAt(t[1].end)}})}return n}rebuildDefinition(){this.documentationInfo={};for(let e in this.extenalDocumentation){let t=this.extenalDocumentation[e];this.documentationInfo={...this.documentationInfo,...t}}for(let e in this.internalDocumentation){let t=this.internalDocumentation[e];try{this.documentationInfo={...this.documentationInfo,...t}}catch(e){}}this.customTagsData=[{name:"block",attributes:[{name:"name"}]}];let e=[];for(let t in this.documentationInfo){let n=this.documentationInfo[t];if(-1==e.indexOf(n.name)){e.push(n.name);let t=[],r={name:n.name,description:n.description,attributes:t};for(let e in n.attributes){let r=n.attributes[e];t.push({name:r.name,description:r.description,values:r.values})}this.customTagsData.push(r)}}}addExternalDefinition(e,t){this.extenalDocumentation[e]=t,this.rebuildDefinition()}removeExternalDefinition(e){delete this.extenalDocumentation[e],this.rebuildDefinition()}getInternalDefinition(e){let t=this.documentationInfo[e];if(t)return this.internalDocumentationReverse[t.class]}addInternalDefinition(e,t,n){this.internalDocumentation[e]=t;for(let e in t)this.internalDocumentationReverse[t[e].class]=n;this.rebuildDefinition()}removeInternalDefinition(e){let t=this.internalDocumentation[e];if(t)for(let e in t)delete this.internalDocumentationReverse[t[e].class];delete this.internalDocumentation[e],this.rebuildDefinition()}getInternalTagUri(e){return this.internalTagUri[e]}addInternalTagUri(e,t,n){this.internalTagUri[e]={uri:t,fullname:n}}removeInternalTagUri(e){for(let t in this.internalTagUri)if(this.internalTagUri[t].uri==e)return void delete this.internalTagUri[t]}}},61949:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultSnippet=t.allGenericTags=t.defaultAttrs=void 0,t.defaultTags=function(){return[]},t.defaultAttrs=[{name:"@element",description:"Add a selector for the element inside your logical part"},{name:"@bind",description:"Bind a watcher to a variable"},{name:"@press",description:"Add an event for when the element is clicked"},{name:"@press-start",description:"Add an event for when mouse down or touch start on the element"},{name:"@press-stop",description:"Add an event for when mouse up or touch start on the element"},{name:"@longpress",description:"Add an event for when the element is long pressed"},{name:"@longpress-delay",description:"Add the delay for the long press"},{name:"@dblpress",description:"Add an event for when the element is double press"},{name:"@dblpress-delay",description:"Add the delay for the double press"},{name:"@drag",description:"Add an event for when the element is dragged"},{name:"@drag-start",description:"Add an event for when the element first drag"},{name:"@drag-end",description:"Add an event for when the element drag end"}],t.allGenericTags={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",footer:"HTMLElement",form:"HTMLFormElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement",acronym:"HTMLElement",applet:"HTMLUnknownElement",basefont:"HTMLElement",bgsound:"HTMLUnknownElement",big:"HTMLElement",blink:"HTMLUnknownElement",center:"HTMLElement",dir:"HTMLDirectoryElement",font:"HTMLFontElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",isindex:"HTMLUnknownElement",keygen:"HTMLUnknownElement",listing:"HTMLPreElement",marquee:"HTMLMarqueeElement",menuitem:"HTMLElement",multicol:"HTMLUnknownElement",nextid:"HTMLUnknownElement",nobr:"HTMLElement",noembed:"HTMLElement",noframes:"HTMLElement",param:"HTMLParamElement",plaintext:"HTMLElement",rb:"HTMLElement",rtc:"HTMLElement",spacer:"HTMLUnknownElement",strike:"HTMLElement",tt:"HTMLElement",xmp:"HTMLPreElement",animate:"SVGAnimateElement",animateMotion:"SVGAnimateMotionElement",animateTransform:"SVGAnimateTransformElement",circle:"SVGCircleElement",clipPath:"SVGClipPathElement",defs:"SVGDefsElement",desc:"SVGDescElement",ellipse:"SVGEllipseElement",feBlend:"SVGFEBlendElement",feColorMatrix:"SVGFEColorMatrixElement",feComponentTransfer:"SVGFEComponentTransferElement",feComposite:"SVGFECompositeElement",feConvolveMatrix:"SVGFEConvolveMatrixElement",feDiffuseLighting:"SVGFEDiffuseLightingElement",feDisplacementMap:"SVGFEDisplacementMapElement",feDistantLight:"SVGFEDistantLightElement",feDropShadow:"SVGFEDropShadowElement",feFlood:"SVGFEFloodElement",feFuncA:"SVGFEFuncAElement",feFuncB:"SVGFEFuncBElement",feFuncG:"SVGFEFuncGElement",feFuncR:"SVGFEFuncRElement",feGaussianBlur:"SVGFEGaussianBlurElement",feImage:"SVGFEImageElement",feMerge:"SVGFEMergeElement",feMergeNode:"SVGFEMergeNodeElement",feMorphology:"SVGFEMorphologyElement",feOffset:"SVGFEOffsetElement",fePointLight:"SVGFEPointLightElement",feSpecularLighting:"SVGFESpecularLightingElement",feSpotLight:"SVGFESpotLightElement",feTile:"SVGFETileElement",feTurbulence:"SVGFETurbulenceElement",filter:"SVGFilterElement",foreignObject:"SVGForeignObjectElement",g:"SVGGElement",image:"SVGImageElement",line:"SVGLineElement",linearGradient:"SVGLinearGradientElement",marker:"SVGMarkerElement",mask:"SVGMaskElement",metadata:"SVGMetadataElement",mpath:"SVGMPathElement",path:"SVGPathElement",pattern:"SVGPatternElement",polygon:"SVGPolygonElement",polyline:"SVGPolylineElement",radialGradient:"SVGRadialGradientElement",rect:"SVGRectElement",set:"SVGSetElement",stop:"SVGStopElement",svg:"SVGSVGElement",switch:"SVGSwitchElement",symbol:"SVGSymbolElement",text:"SVGTextElement",textPath:"SVGTextPathElement",tspan:"SVGTSpanElement",use:"SVGUseElement",view:"SVGViewElement"},t.defaultSnippet={for:"for(let ${1:i} = 0; ${1:i} < ${2:this.elements}; ${1:i}++) {\n\t${3}\n}",forIn:"for(let ${1:index} in ${2:this.elements}) {\n\t${3}\n}",forOf:"for(let ${1:element} of ${2:this.elements}) {\n\t${3}\n}",if:"if(${1:true}) {\n\t${2}\n}","else if":"else if(${1:true}) {\n\t${2}\n}",else:"else {\n\t${1}\n}","@Context":"@Context('${1:element}', ${2:this.elements[i]})"}},57999:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParserHtml=void 0;const r=n(42374),i=n(18952),s=n(19408),a=n(7082),o=n(28180),l=n(1539),c=n(94625),u=n(61586);class p{static languageService=(0,a.getLanguageService)();static parsedDoc={};static getVersion(e){return p.parsedDoc[e.file.uri]?this.parsedDoc[e.file.uri].version:0}static parse(e,t){return p.parsedDoc[e.file.uri]&&this.parsedDoc[e.file.uri].version==e.file.versionUser?this.parsedDoc[e.file.uri].result:(new p(e,t),p.parsedDoc[e.file.uri].result)}static currentParsingDoc;static addError(e,t,n){if(this.currentParsingDoc){let i={range:r.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:r.DiagnosticSeverity.Error,source:s.AventusLanguageId.HTML,message:n};this.currentParsingDoc.errors.push(i)}}static addWarning(e,t,n){if(this.currentParsingDoc){let i={range:r.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:r.DiagnosticSeverity.Warning,source:s.AventusLanguageId.TypeScript,message:n};this.currentParsingDoc.errors.push(i)}}static mergeTemplateResult(e,t){e.events=[...e.events,...t.events],e.pressEvents=[...e.pressEvents,...t.pressEvents],e.loops=[...e.loops,...t.loops],e.ifs=[...e.ifs,...t.ifs],e.content={...e.content,...t.content},e.contextEdits=[...e.contextEdits,...t.contextEdits],e.injection=[...e.injection,...t.injection],e.bindings=[...e.bindings,...t.bindings];for(let n of t.elements){let t=!1;for(let r of e.elements)if(r.name==n.name){t=!0;for(let e of n.ids)r.ids.includes(e)||r.ids.push(e);for(let e in n.tags)r.tags[e]?r.tags[e]+=n.tags[e]:r.tags[e]=n.tags[e];if(!r.isArray)if(n.isArray)r.isArray=!0;else{let e=Object.values(r.tags).reduce(((e,t)=>e+t),0);r.isArray=e>1}r.positions=[...r.positions,...n.positions]}t||e.elements.push(n)}}static addInterestPoint(e){this.currentParsingDoc&&this.currentParsingDoc.interestPoints.push(e)}static addStyleLink(e){this.currentParsingDoc&&this.currentParsingDoc.styleLinks.push(e)}static getRules(){return this.currentParsingDoc?this.currentParsingDoc.rules:new Map}static refreshStyle(e,t){if(p.parsedDoc[e.file.uri]&&this.parsedDoc[e.file.uri].version==e.file.versionUser){let t=this.parsedDoc[e.file.uri];t.result.styleLinks=[],t.result.rules=e.scssFile?.rules??new Map;for(let e of t.result.tags)e.checkStyle(t.result.rules,(e=>{t.result.styleLinks.push(e)}))}this.parse(e,t)}static idElement=0;static idTemplate=0;static createIdTemplate(){let e=this.idTemplate;return this.idTemplate++,e}static getCustomFctName(e=0){if(this.currentParsingDoc?.htmlFile.tsFile){let t=this.currentParsingDoc.ifs.reduce(((e,t)=>e+t.conditions.length),0),n=this.currentParsingDoc.loops.length+this.currentParsingDoc.loops.reduce(((e,t)=>t.isSimple?e:e+1),0),r=e+Object.keys(this.currentParsingDoc.fcts).length+n+t+this.currentParsingDoc.contextEdits.length+this.currentParsingDoc.injections.length+2*this.currentParsingDoc.bindings.length;return this.currentParsingDoc.htmlFile.tsFile?.viewMethodName+r}return null}static createChange(e){if(this.currentParsingDoc){let t=u(e.txt);if(this.currentParsingDoc.fcts[t])return this.currentParsingDoc.fcts[t].positions.push({start:e.start,end:e.end}),this.currentParsingDoc.fcts[t];{let n=this.getCustomFctName(),r=this.getVariables();if(n){let i={name:n,positions:[{start:e.start,end:e.end}],txt:e.txt,variables:r};return this.currentParsingDoc.fcts[t]=i,i}}}return null}static fromRawToCompiled(e){return this.currentParsingDoc?this.currentParsingDoc.fromRawToCompiled(e):e}static fromCompiledToRaw(e){return this.currentParsingDoc?this.currentParsingDoc.fromCompiledToRaw(e):e}static addLoopStack(e){if(this.currentParsingDoc){let t=this.currentParsingDoc.loops.find((t=>t.idTemplate==e));if(t)return t.recalculateVariables(),this.currentParsingDoc?.stacks.push(t),t}return null}static addIfStack(e){if(this.currentParsingDoc)for(let t of this.currentParsingDoc.ifs)if(t.idsTemplate.includes(e))return t.recalculateVariables(e),this.currentParsingDoc?.stacks.push({idTemplate:e}),t;return null}static addInjection(e){this.currentParsingDoc?.injections.push(e)}static addBinding(e){this.currentParsingDoc?.bindings.push(e)}static addTagInfoStack(e){this.currentParsingDoc?.stacks.push(e)}static getContextEditing(e){return this.currentParsingDoc?.contextEdits.find((t=>t.id==e))}static removeStack(){this.currentParsingDoc?.stacks.pop()}static getParentId(){if(this.currentParsingDoc&&this.currentParsingDoc.stacks.length>0)for(let e=this.currentParsingDoc.stacks.length-1;e>=0;e--){let t=this.currentParsingDoc.stacks[e];if(t instanceof o.ForLoop)return t.idTemplate;if(!(t instanceof o.TagInfo))return t.idTemplate}}static getVariables(){let e=[];if(this.currentParsingDoc)for(let t of this.currentParsingDoc.stacks)if(t instanceof o.ForLoop||t instanceof o.TagInfo)for(let n of t.variableNames)e.includes(n)||e.push(n);return e}uri;errors=[];document;rootTags=[];tags=[];blocksInfo={};slotsInfo={};resultsByClassName={};interestPoints=[];rules;styleLinks=[];fcts={};htmlFile;loops=[];ifs=[];injections=[];bindings=[];contextEdits=[];diffRawToCompiled={};diffCompiledToRaw={};stacks=[];compiledTxt="";fromRawToCompiled(e){let t=e;for(let n in this.diffRawToCompiled){if(Number(n)>e)break;t+=this.diffRawToCompiled[n]}return t}fromCompiledToRaw(e){let t=e;for(let n in this.diffCompiledToRaw){if(Number(n)>e)break;t+=this.diffCompiledToRaw[n]}return t}getBlocksInfoTxt(){let e=[];for(let t in this.blocksInfo)e.push("'"+t+"':`"+this.blocksInfo[t]+"`");return e.join(",")}getSlotsInfoTxt(){let e=[];for(let t in this.slotsInfo)e.push("'"+t+"':`"+this.slotsInfo[t]+"`");return e.join(",")}isReady=!1;build;constructor(e,t){this.build=t,this.htmlFile=e,p.parsedDoc[e.file.uri]={version:e.file.versionUser,result:this};let n=this.getFileContent(e.file.documentUser);this.rules=e.scssFile?.rules??new Map,this.document=i.TextDocument.create(e.file.uri,e.file.documentUser.languageId,e.file.versionUser,n),p.currentParsingDoc=this,this.uri=e.file.uri,p.idElement=0,p.idTemplate=0,p.idTemplate=0,this.parse(this.document),p.currentParsingDoc=null,this.isReady=!0;for(let e of this.readyCb)e()}getFileContent(e){let t=e.getText();return t=t.replace(/\\\{\{(.*?)\}\}/g,"{{$1}}"),t=t.replace(/\\if/g,"if"),t=t.replace(/\\else/g,"else"),t=t.replace(/\\for/g,"for"),t=t.replace(/\\@Context/g,"@Context"),t}readyCb=[];onReady(e){this.isReady||this.readyCb.push(e)}parseJs(e){let t,n=e.getText(),r={},i=/<!--(.|\s)*?-->/g;for(;t=i.exec(n);){let e="";for(let n=0;n<t[0].length;n++)e+=" ";r[t.index]=t[0],n=n.slice(0,t.index)+e+n.slice(t.index+t[0].length)}let s=n;const a=(e,t)=>s.slice(e,t);let l=(0,c.createSourceFile)("sample.ts",n.replace(/\{\{|\}\}/g," ").replace(/<(\/?.*?)>/g,"'$1'"),c.ScriptTarget.ESNext,!0),u=[];const p=(e,t)=>{(0,c.forEachChild)(e,(n=>{let r;if(n.kind==c.SyntaxKind.IfStatement){let e=n,t=!0;if(e.parent.kind==c.SyntaxKind.IfStatement){e.parent.elseStatement==e&&(t=!1)}if(t){let e=new o.IfInfo(n,a);e.isValid&&(this.ifs.push(e),u=[...u,...e.transformations])}}else if([c.SyntaxKind.ForInStatement,c.SyntaxKind.ForOfStatement,c.SyntaxKind.ForStatement].includes(n.kind)){if("for"!==n.getText()){let e=new o.ForLoop(n,a);e.isValid&&(r=e,u=[...u,...r.transformations],this.loops.push(r),this.stacks.push(r))}}else if(n.kind==c.SyntaxKind.Decorator){if(n.getText().startsWith("@Context(")){let e=new o.ContextEditing(n,a);u=[...u,...e.transformations],this.contextEdits.push(e)}}n.kind==c.SyntaxKind.Block&&e.kind==c.SyntaxKind.Block||(p(n,t+1),r&&this.stacks.pop())}))};p(l,0),u.sort(((e,t)=>t.end-e.end));let _=n.length;this.diffRawToCompiled={};for(let e of u){if(e.end>_)continue;let t=Math.min(e.newText.length,e.end-e.start);this.diffRawToCompiled[e.start+t]=e.newText.length-(e.end-e.start),n=n.slice(0,e.start)+e.newText+n.slice(e.end,n.length),_=e.start}let d=0;for(let e in this.diffRawToCompiled){let t=Number(e)+d,n=-1*this.diffRawToCompiled[e];d+=this.diffRawToCompiled[e],this.diffCompiledToRaw[t]=n}for(let e in r){let t=r[e],i=this.fromRawToCompiled(Number(e));n=n.slice(0,i)+t+n.slice(i+t.length)}return n}parse(e){let t=this.parseJs(e);this.compiledTxt=t;let n=[],r=!1,i=p.languageService.createScanner(t,0),s=[],c=null;try{for(;i.scan()!=a.TokenType.EOS;)if(n.length>0){if(i.getTokenType()==a.TokenType.EndTagClose&&r){r=!1;let t=s.pop(),a=n.pop();if(t&&a){let n=i.getTokenEnd(),r=e.getText().slice(a,n);t.addContent(new o.ContentInfo(r,a,n,t,!1))}}else if(i.getTokenType()==a.TokenType.EndTag){let e=i.getTokenText(),t=s[s.length-1];t&&t.tagName==e&&(r=!0,t.afterClose(i.getTokenOffset(),i.getTokenEnd()))}}else if(i.getTokenType()==a.TokenType.StartTagOpen);else if(i.getTokenType()==a.TokenType.StartTagClose){if(s.length>0){let e=s[s.length-1];e.validateAllProps(i.getTokenOffset()),e.selfClosing&&(s.pop(),e.afterClose(i.getTokenOffset(),i.getTokenEnd())),this.build.getAvoidParsingTags().includes(e.tagName)&&n.push(i.getTokenEnd())}}else if(i.getTokenType()==a.TokenType.StartTagSelfClose){let e=s.pop();e&&(e.validateAllProps(i.getTokenOffset()),e.afterClose(i.getTokenOffset(),i.getTokenEnd()))}else if(i.getTokenType()==a.TokenType.StartTag){let e=i.getTokenText(),t=i.getTokenOffset(),n=i.getTokenEnd(),r=new o.TagInfo(this,e,t,n);if(s.length>0){s[s.length-1].addChild(r)}else this.rootTags.push(r);this.tags.push(r),s.push(r)}else if(i.getTokenType()==a.TokenType.EndTagOpen);else if(i.getTokenType()==a.TokenType.EndTagClose);else if(i.getTokenType()==a.TokenType.EndTag){let t=i.getTokenText(),n=s.pop();if(!n||n.tagName!=t)return void(n?this.errors.push((0,l.createErrorHTMLPos)(e,"The tag "+n?.tagName+" isn't correctly closed",n?.start,n?.end)):this.errors.push((0,l.createErrorHTMLPos)(e,"No opening tag found for "+t,i.getTokenOffset(),i.getTokenEnd())));n.afterClose(i.getTokenOffset(),i.getTokenEnd())}else if(i.getTokenType()==a.TokenType.DelimiterAssign);else if(i.getTokenType()==a.TokenType.AttributeName){let e=i.getTokenText();if(s.length>0){let t=s[s.length-1],n=i.getTokenOffset(),r=i.getTokenEnd();c=new o.AttributeInfo(e,n,r,t),t.addAttribute(c)}}else if(i.getTokenType()==a.TokenType.AttributeValue){if(c){let e=i.getTokenText(),t=i.getTokenOffset(),n=i.getTokenEnd();c.setValue(e,t,n),c=null}}else if(i.getTokenType()==a.TokenType.Content){if(s.length>0){let e=s[s.length-1],t=i.getTokenText(),n=i.getTokenOffset(),r=i.getTokenEnd();e.addContent(new o.ContentInfo(t,n,r,e))}}else i.getTokenType()==a.TokenType.Whitespace||i.getTokenType()==a.TokenType.Unknown||i.getTokenType()==a.TokenType.Script||(i.getTokenType(),a.TokenType.Styles)}catch(e){console.log(e)}let u="";for(let e of this.rootTags)u+=e.render();this.manageSlotAndBlock(u)}getParsedInfo(e){if(e=e.toLowerCase(),this.resultsByClassName[e])return this.resultsByClassName[e];let t={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]};for(let n of this.rootTags){let r=n.getTemplateInfo(e);p.mergeTemplateResult(t,r)}return this.resultsByClassName[e]=t,t}manageSlotAndBlock(e){let t,n=e,r=n,i=/<block.*?( name="(.*?)")?>((\s|\S)*?)<\/block>/g;for(;t=i.exec(n);)this.blocksInfo[t[2]]=t[3],r=r.replace(t[0],"");r=r.trim(),(r.length>0||0==e.trim().length)&&(this.blocksInfo.default=r);let s=/<slot.*?( name="(.*?)")?>(\s|\S)*?<\/slot>/g;for(;t=s.exec(n);)t[2]||(t[2]="default"),this.slotsInfo[t[2]]=t[0]}}t.ParserHtml=p},28180:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Binding=t.Injection=t.ContextEditing=t.IfInfo=t.ForLoop=t.ContentInfo=t.AttributeInfo=t.TagInfo=void 0;const r=n(94625),i=n(57999),s=n(47506);class a{tagName="";children=[];attributes={};hasClose=!1;selfClosing=!1;id="";start=0;end=0;parent=null;parentTemplateId;openTagStart=0;openTagEnd=0;alias=null;aliasMultiple=void 0;pressEvent=null;eventsPerso=[];injections=[];bindings=[];changes={};variableNames=[];parser;get componentClassName(){return this.parser.htmlFile.tsFile?.componentClassName.toLowerCase()??""}get isLoop(){return this.tagName==c.tagName}get isIf(){return this.tagName==u.tagName}get isContextEditing(){return this.tagName==p.tagName}loopInfo;ifInfo;contextEdit;constructor(e,t,n,r){this.parser=e,this.tagName=t,this.start=n,this.openTagStart=n,this.end=r,this.isLoop?this.createId():this.isIf||this.isContextEditing||(i.ParserHtml.addInterestPoint({name:t,start:n,end:r,type:"tag"}),o.includes(t)&&(this.selfClosing=!0))}createId(){return this.id||(this.id=this.componentClassName+"_"+i.ParserHtml.idElement,i.ParserHtml.idElement++),this.id}addAttribute(e){"@for"!=e.name?this.attributes[e.name]?i.ParserHtml.addError(e.nameStart,e.nameEnd,"Duplicate attribute "+e.name):this.attributes[e.name]=e:i.ParserHtml.addError(e.nameStart,e.nameEnd,"Deprecated : use for directly inside template")}addChild(e){this.children.push(e),e.parent=this}addContent(e){this.children.push(e)}addChanges(e,t,n){let r=this.createId()+"°"+e;this.changes[r]={fct:t,once:n}}validateAllProps(e){if(this.openTagEnd=e,this.alias){let e=this.alias.endsWith("[]");e&&(this.alias=this.alias.replace("[]","")),e&&(this.aliasMultiple=e)}if(this.isLoop){this.parentTemplateId=i.ParserHtml.getParentId();let e=i.ParserHtml.addLoopStack(Number(this.attributes.id.value));e&&(this.loopInfo=e)}else if(this.isIf){this.parentTemplateId=i.ParserHtml.getParentId();let e=Number(this.attributes.id.value),t=i.ParserHtml.addIfStack(e);if(t&&(this.ifInfo=t,e==t.idsTemplate[0])){let e=this.createId();t._id=e}}else if(this.isContextEditing){this.parentTemplateId=i.ParserHtml.getParentId();let e=Number(this.attributes.id.value),t=i.ParserHtml.getContextEditing(e);if(t&&(this.contextEdit=t,this.parent))for(let e of t.variableNames)this.parent.variableNames.includes(e)||this.parent.variableNames.push(e)}i.ParserHtml.addTagInfoStack(this)}afterClose(e,t){this.hasClose=!0,this.selfClosing||i.ParserHtml.addInterestPoint({name:this.tagName,start:e,end:t,type:"tag"}),this.checkStyle(i.ParserHtml.getRules(),(e=>i.ParserHtml.addStyleLink(e))),i.ParserHtml.removeStack(),(this.isLoop||this.isIf)&&i.ParserHtml.removeStack()}checkStyle(e,t){for(let[n,r]of e)if(n(this)){t([{start:this.openTagStart,end:this.openTagEnd},r])}}_render(){let e=[];for(let t in this.attributes){let n=this.attributes[t];n.mustBeAdded&&(null!=n.value?e.push(n.name+'="'+n.value+'"'):e.push(n.name))}this.id&&e.push('_id="'+this.id+'"');let t="";return e.length>0&&(t=" "+e.join(" ")),this.selfClosing?`<${this.tagName}${t} />`:`<${this.tagName}${t}>${this.children.map((e=>e.render())).join("")}</${this.tagName}>`}render(){return this.isContextEditing?"":this.isLoop?'<template _id="'+this.id+'"></template>':this.isIf?this.id?'<template _id="'+this.id+'"></template>':"":this._render()}getTemplateInfo(e){let t={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]},n=this.id;const r=e=>{if(this.alias){let t=this.aliasMultiple?2:1;e.elements.push({name:this.alias,ids:[n],tags:{[this.tagName]:t},useLive:!1,isArray:t>1,positions:[{start:this.attributes["@element"].valueStart,end:this.attributes["@element"].valueEnd}]})}for(let t in this.changes)e.content[t]=this.changes[t];for(let t of this.injections){let r={id:n,injectionName:t.attr,inject:`@_@${t.injectTxt}@_@`};t.computedOnce&&(r.once=!0),e.injection.push(r)}for(let t of this.bindings){let r=[];r=t.event?[t.event]:["input","textarea"].includes(this.tagName)?["change","input"]:["change"];let i={id:n,eventNames:r,injectionName:t.valueName,tagName:this.tagName,inject:`@_@${t.injectTxt}@_@`,extract:`@_@${t.extractTxt}@_@`};t.computedOnce&&(i.once=!0),e.bindings.push(i)}for(let t of this.eventsPerso)e.events.push({eventName:t.event,id:n,fct:t.fct,tagName:this.tagName,position:{start:t.start,end:t.end}});if(this.pressEvent&&e.pressEvents.push({...this.pressEvent,id:n}),this.contextEdit){let t={fct:this.contextEdit.fctJs};this.contextEdit.computedOnce&&(t.once=!0),e.contextEdits.push(t)}};if(this.loopInfo){let n={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]},r="";for(let t of this.children){if(t instanceof a){let r=t.getTemplateInfo(e);i.ParserHtml.mergeTemplateResult(n,r)}r+=t.render()}let s={templateId:this.loopInfo.idTemplate||0,anchorId:this.id,template:r,actions:n,parentId:this.parentTemplateId};this.loopInfo.isSimple?s.simple=this.loopInfo.simple:s.func=this.loopInfo.complex.fct,t.loops.push(s)}else if(this.isIf&&this.ifInfo){let n=Number(this.attributes.id.value),r={elements:[],content:{},injection:[],bindings:[],events:[],pressEvents:[],loops:[],ifs:[],contextEdits:[]},s="";for(let t of this.children){if(t instanceof a){let n=t.getTemplateInfo(e);i.ParserHtml.mergeTemplateResult(r,n)}s+=t.render()}if(this.ifInfo.registerPart({template:s,templateId:n,templateAction:r,condition:""}),n==this.ifInfo.idsTemplate[this.ifInfo.idsTemplate.length-1]){let e={anchorId:this.ifInfo._id,parts:this.ifInfo.parts,parentId:this.parentTemplateId};t.ifs.push(e)}}else{r(t);for(let n of this.children)if(n instanceof a){let r=n.getTemplateInfo(e);i.ParserHtml.mergeTemplateResult(t,r)}}return t}}t.TagInfo=a;const o=["area","base","br","col","embed","img","input","link","meta","param","source","track","wbr"],l=["_id"];t.AttributeInfo=class{name="";value=null;nameStart=0;nameEnd=0;valueStart=0;valueEnd=0;tag;mustBeAdded=!0;constructor(e,t,n,r){this.name=e,this.nameStart=i.ParserHtml.fromCompiledToRaw(t),this.nameEnd=i.ParserHtml.fromCompiledToRaw(n),this.tag=r,this.manageSpecialAttribute()}manageSpecialAttribute(){this.name.startsWith("@")||this.name.startsWith(":")?(this.tag.createId(),this.mustBeAdded=!1):l.includes(this.name)&&(i.ParserHtml.addError(this.nameStart,this.nameEnd,"The attribute "+this.name+" is used by Aventus internally"),this.mustBeAdded=!1)}setValue(e,t,n){if(e=e.replace(/"/g,""),this.value=e,this.valueStart=i.ParserHtml.fromCompiledToRaw(t),this.valueEnd=i.ParserHtml.fromCompiledToRaw(n),"@for"!=this.name)if("@element"===this.name)this.tag.alias=e,i.ParserHtml.addInterestPoint({name:e,start:this.nameStart,end:this.valueEnd,type:"property"});else if(this.name.startsWith("@bind")||this.name.startsWith("$")){let r=new d(this.name,e,t,n);this.tag.bindings.push(r),i.ParserHtml.addBinding(r)}else if(this.name.startsWith(":")){let r=new _(this.name.slice(1),e,t,n);this.tag.injections.push(r),i.ParserHtml.addInjection(r)}else if(s.pressEventMap.hasOwnProperty(this.name))this.tag.pressEvent||(this.tag.pressEvent={}),this.tag.pressEvent[s.pressEventMap[this.name]]={value:e,start:this.valueStart,end:this.valueEnd},i.ParserHtml.addInterestPoint({name:e,start:this.nameStart,end:this.valueEnd,type:"method"});else if(this.name.startsWith("@"))this.tag.eventsPerso.push({event:this.name.slice(1),fct:e,start:this.valueStart,end:this.valueEnd}),i.ParserHtml.addInterestPoint({name:e,start:this.nameStart,end:this.valueEnd,type:"method"});else{let t=h(e,this.valueStart);t.changes.length>0&&(this.tag.addChanges(this.name,t.txt,t.once),this.mustBeAdded=!1)}}};t.ContentInfo=class{content="";start=0;end=0;tag;mustBeAdded=!0;constructor(e,t,n,r,s=!0){this.content=e,this.start=i.ParserHtml.fromCompiledToRaw(t),this.end=i.ParserHtml.fromCompiledToRaw(n),this.tag=r,s&&this.manageVariables()}manageVariables(){let e=h(this.content,this.start);e.changes.length>0&&(this.tag.addChanges("@HTML",e.txt,e.once),this.mustBeAdded=!1);for(let t of e.variables)this.tag.variableNames.includes(t)||this.tag.variableNames.push(t)}render(){return this.mustBeAdded?this.content:""}};class c{static tagName="l";idTemplate=0;isSimple=!1;transformations=[];start=0;startBlock=0;end=0;loopTxt="";loopName="";isValid=!0;typeToLoad=[];simple={data:""};complex={init:[],condition:"",transform:[],apply:[],loopName:"",fct:""};get variableNames(){return this.typeToLoad.map((e=>e.txt))}variables=[];sliceText;constructor(e,t){this.sliceText=t,this.idTemplate=i.ParserHtml.createIdTemplate(),this.variables=i.ParserHtml.getVariables(),e.kind==r.SyntaxKind.ForOfStatement||e.kind==r.SyntaxKind.ForInStatement?(this.isSimple=!0,this.loadForInOf(e)):this.loadFor(e),this.loopName=i.ParserHtml.getCustomFctName()??""}loadForInOf(e){let t=0;(0,r.forEachChild)(e,(n=>{if(0==t){let t=n.getChildAt(1),i=t.getStart(),s=t.getEnd(),a=this.sliceText(i,s);e.kind==r.SyntaxKind.ForInStatement?this.simple.index=a:this.simple.item=a,this.typeToLoad.push({txt:a,start:i,end:s})}else if(1==t)this.simple.data=this.sliceText(n.getStart(),n.getEnd());else if(2==t){let t=e.getStart(),r=n.getStart()+1;this.loopTxt=this.sliceText(t,r)+" }";let i="<"+c.tagName+' id="'+this.idTemplate+'">',s="</"+c.tagName+">";this.transformations.push({start:t,end:r,newText:i});let a=n.getEnd();this.transformations.push({start:a-1,end:a,newText:s}),this.start=t,this.startBlock=r,this.end=a}t++}))}loadFor(e){let t=[],n=[],s="",a=[],o=0,l="";if((0,r.forEachChild)(e,(i=>{if(0==o&&i.kind==r.SyntaxKind.VariableDeclarationList)(0,r.forEachChild)(i,(e=>{let r=e.getChildAt(0),i=r.getStart(),s=r.getEnd(),a=this.sliceText(i,s);t.push("let "+e.getText()),n.push(e.getChildAt(0).getText()),this.typeToLoad.push({txt:a,start:i,end:s})}));else if(1==o&&i.kind==r.SyntaxKind.BinaryExpression)s=i.getText();else if(2==o){let e=t=>{t.kind==r.SyntaxKind.BinaryExpression&&","==t.getChildAt(1).getText()?(e(t.getChildAt(0)),e(t.getChildAt(2))):a.push(t.getText())};e(i)}else if(3==o&&i.kind==r.SyntaxKind.Block){let t=e.getStart(),n=i.getStart()+1;l=this.sliceText(t,n)+" }",this.loopTxt=l;let r="<"+c.tagName+' id="'+this.idTemplate+'">',s="</"+c.tagName+">";this.transformations.push({start:t,end:n,newText:r});let a=i.getEnd();this.transformations.push({start:a-1,end:a,newText:s}),this.start=t,this.startBlock=n,this.end=a}o++})),0==this.transformations.length&&(this.isValid=!1),!this.checkIsSimple(t,s,a)){let e=i.ParserHtml.getCustomFctName(1)??"";this.complex={init:t,condition:s,transform:a,apply:n,loopName:e,fct:`(c) => c.comp.${e}`}}}recalculateVariables(){if(this.variables=f(this.loopTxt,i.ParserHtml.getVariables()),!this.isSimple){let e=this.variables.map((e=>"c.data."+e)).join(",");this.complex.fct+=`(${e})`}}checkIsSimple(e,t,n){if(1!=e.length)return!1;let r=e[0].split("=");if(2!=r.length)return!1;let i=r[0].replace("let ","").trim();if("0"!=r[1].trim())return!1;let s=new RegExp("\\s*"+i+"\\s*<\\s*([a-zA-Z0-9\\._\\[\\]-]+)\\.length").exec(t);if(!s)return!1;let a=s[1];return 1==n.length&&(!!new RegExp("\\s*"+i+"\\+\\+\\s*").exec(n[0])&&(this.isSimple=!0,this.simple={data:a,index:i},!0))}}t.ForLoop=c;class u{static tagName="if";statements=[];idsTemplate=[];defaultVariables=[];transformations=[];end=0;_id="";parts=[];isValid=!0;conditions=[];sliceText;constructor(e,t){this.sliceText=t,this.defaultVariables=i.ParserHtml.getVariables(),this.loadIf(e)}loadIf(e){let t=[];const n=()=>{let e=i.ParserHtml.createIdTemplate();return this.idsTemplate.push(e),e},s=(e,t,n)=>{let r=n.getStart()+1,i="<"+u.tagName+' id="'+e+'">',s="</"+u.tagName+">";this.transformations.push({start:t,end:r,newText:i});let a=n.getEnd();this.transformations.push({start:a-1,end:a,newText:s})},a=(e,o=0,l)=>{let c=0;void 0===l&&(l=e.getStart());let u,p=l;for(let t of e.getChildren())t.kind==r.SyntaxKind.ElseKeyword&&(u=t.getStart());let _=n();(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.Block){if(c++,2==c){if(null==u)throw"impossible";s(n(),u,e)}else s(_,p,e);t.push(e)}else if(e.kind==r.SyntaxKind.IfStatement){if(null==u)throw"impossible";a(e,o+1,u)}else if(r.SyntaxKind[e.kind].includes("Expression")){let t=i.ParserHtml.getCustomFctName(this.conditions.length)??"",n=this.sliceText(e.getStart(),e.getEnd());this.conditions.push({fctName:t,txt:n,fctTxt:`(c) => c.comp.${t}`,start:e.getStart(),end:e.getEnd(),offsetAfter:0,offsetBefore:0,idTemplate:_,type:0==o?"if":"elif",variables:[],computedOnce:m(n)})}})),0==c&&(this.isValid=!1)};a(e)}registerPart(e){this.conditions.length>this.parts.length?(e.condition=this.conditions[this.parts.length].fctTxt,e.once=this.conditions[this.parts.length].computedOnce):(e.condition="(c) => true",e.once=!0),this.parts.push(e)}recalculateVariables(e){let t=i.ParserHtml.getVariables();for(let n of this.conditions)if(n.idTemplate==e){let e=f(n.txt,t),r=e.map((e=>"c.data."+e)).join(",");n.fctTxt+=`(${r})`,n.variables=e}}}t.IfInfo=u;class p{static tagName="c";sliceText;variables=[];transformations=[];id;fctTs="";fctJs="";editName;start=0;end=0;mapping=["",""];computedOnce=!1;typeToLoad=[];get variableNames(){return this.typeToLoad.map((e=>e.txt))}constructor(e,t){this.sliceText=t,this.editName=i.ParserHtml.getCustomFctName()??"",this.id=i.ParserHtml.createIdTemplate(),this.loadContextEditing(e)}loadContextEditing(e){this.start=e.getStart(),this.end=e.getEnd(),this.transformations.push({start:e.getStart(),end:e.getEnd(),newText:"<"+p.tagName+' id="'+this.id+'"></'+p.tagName+">"}),(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.CallExpression){let t=e,n="{ ",r=0;for(let e of t.arguments)n+=e.getText(),0==r&&(this.typeToLoad.push({txt:e.getText().replace(/['`"]/g,""),start:e.getStart(),end:e.getEnd()}),n+=": "),this.mapping[r]=e.getText(),r++;n+=" }",this.fctTs="return "+n,this.computedOnce=m(this.fctTs)}})),this.variables=f(this.fctTs,i.ParserHtml.getVariables());let t=this.variables.map((e=>"c.data."+e)).join(",");this.fctJs=`@_@(c) => c.comp.${this.editName}(${t})@_@`}}t.ContextEditing=p;class _{start=0;end=0;attr;injectFctName;injectTsTxt;injectTxt;variables=[];computedOnce=!1;constructor(e,t,n,r){this.attr=e,this.start=i.ParserHtml.fromCompiledToRaw(n),this.end=i.ParserHtml.fromCompiledToRaw(r),this.injectFctName=i.ParserHtml.getCustomFctName()??"",this.injectTsTxt=t,this.computedOnce=m(t),this.variables=f(t,i.ParserHtml.getVariables());let s=this.variables.map((e=>"c.data."+e)).join(",");this.injectTxt=`(c) => c.comp.${this.injectFctName}(${s})`}}t.Injection=_;class d{start=0;end=0;event;valueName="value";injectFctName;extractFctName;injectTsTxt;extractTsCond;extractTsTxt;injectTxt;extractTxt;variables=[];computedOnce=!1;constructor(e,t,n,r){let s=e.split(":"),a=s[0];a.startsWith("@bind_")?this.event=a.replace("@bind_",""):a.startsWith("$")&&a.length>0&&(this.event=a.replace("$","")),s.length>1&&(this.valueName=s[1]),this.start=i.ParserHtml.fromCompiledToRaw(n),this.end=i.ParserHtml.fromCompiledToRaw(r),this.injectFctName=i.ParserHtml.getCustomFctName()??"",this.extractFctName=i.ParserHtml.getCustomFctName(1)??"",this.injectTsTxt=t,this.computedOnce=m(t);let o=t.split(".");o.pop(),this.extractTsCond=o.join(".").trim(),this.extractTsCond.endsWith("?")&&(this.extractTsCond=this.extractTsCond.slice(0,this.extractTsCond.length-1)),this.extractTsTxt=t.replace(/\?/g,""),this.variables=f(t,i.ParserHtml.getVariables());let l=this.variables.map((e=>"c.data."+e)),c=["v"].concat(l).join(","),u=l.join(",");this.injectTxt=`(c) => c.comp.${this.injectFctName}(${u})`,this.extractTxt=`(c, v) => c.comp.${this.extractFctName}(${c})`}}function h(e,t){let n,r=/\{\{([\s|\S]*?)\}\}/g,s={changes:[],txt:e,variables:[],once:!0};for(;n=r.exec(e);){let e=t+n.index,r=t+n.index+n[0].length,a=i.ParserHtml.createChange({txt:n[1],start:e,end:r});if(s.once&&!m(n[1])&&(s.once=!1),a){a.variables=f(n[1],a.variables);let e=a.variables.map((e=>"c.data."+e)).join(","),t="${c.print(c.comp."+a.name+"("+e+"))}";s.txt=s.txt.replace(n[0],t),s.changes.push(a)}}return s.changes.length>0&&(s.txt="(c) => `"+s.txt+"`"),s}function f(e,t){if(0==t.length)return t;let n=[],i=(0,r.createSourceFile)("sample.ts",e,r.ScriptTarget.ESNext,!0),s=e=>{(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.Identifier)if(e.parent.kind!=r.SyntaxKind.PropertyAccessExpression){let r=e.getText();t.includes(r)&&!n.includes(r)&&n.push(r)}else{if(e.parent.getChildAt(0)==e){let r=e.getText();t.includes(r)&&!n.includes(r)&&n.push(r)}}s(e)}))};return s(i),n}function m(e){return!/if|switch|\?|\[.+?\]/g.test(e)}t.Binding=d},47506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pressEventMap=void 0,t.pressEventMap={"@press":"onPress","@press-start":"onPressStart","@press-stop":"onPressEnd","@longpress":"onLongPress","@longpress-delay":"delayLongPress","@dblpress":"onDblPress","@dblpress-delay":"delayDblPress","@drag":"onDrag","@drag-start":"onDragStart","@drag-end":"onDragEnd"}},2741:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CSharpFile=t.CSharpManager=void 0;const r=n(72375),i=n(83693),s=n(50857),a=n(19408);class o{static instance;static getInstance(){return this.instance||(this.instance=new o),this.instance}files={};onNewFileUUID;onFileRemoveUUID;constructor(){this.onNewFile=this.onNewFile.bind(this),this.onFileRemove=this.onFileRemove.bind(this),this.onNewFileUUID=i.FilesManager.getInstance().onNewFile(this.onNewFile),this.onFileRemoveUUID=i.FilesManager.getInstance().onFileRemove(this.onFileRemove)}async onNewFile(e){e.uri.endsWith(a.AventusExtension.CsharpConfig)&&(this.files[e.uri]=new l(e))}async onFileRemove(e){delete this.files[e]}destroy(){i.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID),i.FilesManager.getInstance().removeOnFileRemove(this.onFileRemoveUUID)}}t.CSharpManager=o;class l{_file;get file(){return this._file}constructor(e){this._file=e,this.addEvents()}uuidEvents={onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onRename:""};addEvents(){this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof r.InternalAventusFile&&await this.file.validate()}triggerSave(){this.file instanceof r.InternalAventusFile&&this.file.triggerSave()}async triggerContentChange(){this.file instanceof r.InternalAventusFile&&await this.file.triggerContentChange(this.file.documentUser)}async _onValidate(){return await this.onValidate()}async onContentChange(){}async onValidate(){return s.AventusJSONLanguageService.getInstance().validate(this.file)}async onSave(){}async onDelete(){}async _onDelete(){await this.onDelete(),this.removeEvents()}async onCompletion(e,t){return s.AventusJSONLanguageService.getInstance().doComplete(e,t)}async onCompletionResolve(e,t){return s.AventusJSONLanguageService.getInstance().doResolve(t)}async onHover(e,t){return s.AventusJSONLanguageService.getInstance().doHover(e,t)}async onDefinition(e,t){return null}async onFormatting(e,t,n){return s.AventusJSONLanguageService.getInstance().format(e,t,n)}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.CSharpFile=l},50857:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusJSONLanguageService=void 0;const r=n(71017),i=n(39459),s=n(42374),a=n(19408),o=n(1539),l=n(51833),c=n(77282);class u{static instance;static getInstance(){return this.instance||(this.instance=new u),this.instance}languageService;constructor(){this.languageService=(0,i.getLanguageService)({schemaRequestService:async e=>JSON.stringify(l.AventusConfigSchema)}),this.languageService.configure({allowComments:!0,schemas:[{fileMatch:["**"+a.AventusExtension.Config],uri:l.AventusConfigSchema.$schema??"",schema:l.AventusConfigSchema},{fileMatch:["**"+a.AventusExtension.Template],uri:l.AventusTemplateSchema.$schema??"",schema:l.AventusTemplateSchema},{fileMatch:["**"+a.AventusExtension.CsharpConfig],uri:l.AventusSharpSchema.$schema??"",schema:l.AventusSharpSchema}]})}async format(e,t,n){let r=e.documentUser;return await this.languageService.format(r,t,n)}async doComplete(e,t){let n=e.documentUser,r=this.languageService.parseJSONDocument(n),i=await this.languageService.doComplete(e.documentUser,t,r);return i||{isIncomplete:!1,items:[]}}async doResolve(e){return await this.languageService.doResolve(e)}async doHover(e,t){let n=e.documentUser,r=this.languageService.parseJSONDocument(n);return await this.languageService.doHover(n,t,r)}async validate(e){let t=e.documentUser,n=this.languageService.parseJSONDocument(t),r=await this.languageService.doValidation(t,n);if(0==r.length){let e=this.removeComments(t.getText());try{return JSON.parse(e),r}catch(e){r.push((0,o.createErrorTs)(t,"Can't parse the json",a.AventusErrorCode.ConfigJsonError))}}for(let e of r)e.severity=s.DiagnosticSeverity.Error;return r}async getConfig(e){let t=e.documentUser,n=this.languageService.parseJSONDocument(t),r=await this.languageService.doValidation(t,n,void 0,l.AventusConfigSchema);if(0==r.length){let e=this.removeComments(t.getText());try{let n=JSON.parse(e);return n=this.prepareConfigFile(t.uri,n),n}catch(e){r.push((0,o.createErrorTs)(t,"Can't parse the json",a.AventusErrorCode.ConfigJsonError))}}return null}prepareConfigFile(e,t){if(""==(t={...this.defaultConfigValue(),...t}).componentPrefix){let e=t.module.match(/([A-Z][a-z]*)|([0-9][a-z]*)/g);t.componentPrefix=e?e.join("-").toLowerCase():"av"}let n=[];for(let r of t.build)n.push(this.prepareBuild(e,r,t));if(t.build=n,t.static){let n=[];for(let r of t.static)n.push(this.prepareStatic(e,r));t.static=n}return t}replaceEnvVar(e,t){if(e.startsWith("@"))return e;let n,i=/%(.*?)%/gm;for(;n=i.exec(e);){let t=n[1],r=c.env[t]??"undefined";e=e.replace(n[0],r)}return e.startsWith("/")||/^[a-zA-Z]:/gm.test(e)?e=(0,r.normalize)(e):(e="/"+e,e=(0,r.normalize)((0,o.uriToPath)(t)+e)),e}prepareBuild(e,t,n){let i=(0,o.getFolder)(e);(t={...this.defaultConfigBuildValue(n),...t}).fullname=t.module+"@"+t.name;const s=e=>this.replaceEnvVar(e,i);let a=t.compile;for(let e of a){if(e.input){Array.isArray(e.input)||(e.input=[e.input]);let t=[];for(let n of e.input){let e="";n=n.replace(/\\/g,"/"),n.startsWith("/")||(e="/");let s=n.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),n=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+e+n).replace(/\\/g,"/");a=(0,o.escapeRegex)(a,!0).replace("*",".*"),t.push("(^"+a+"$)")}let n=t.join("|");""==n&&(n="(?!)"),e.inputPathRegex=new RegExp(n)}else e.inputPathRegex=new RegExp(".*");if(e.output){Array.isArray(e.output)||(e.output=[e.output]);for(let t=0;t<e.output.length;t++)e.output[t]=e.output[t].trim(),e.output[t].length>0&&(e.output[t]=s(e.output[t]))}else e.output=[];if(e.outputNpm){"string"==typeof e.outputNpm?e.outputNpm={path:[e.outputNpm],packageJson:!0,npmName:""}:Array.isArray(e.outputNpm)&&(e.outputNpm={path:e.outputNpm,packageJson:!0,npmName:""}),Array.isArray(e.outputNpm.path)||(e.outputNpm.path=[e.outputNpm.path]),void 0===e.outputNpm.packageJson&&(e.outputNpm.packageJson=!0),void 0===e.outputNpm.npmName&&(e.outputNpm.npmName="");for(let t=0;t<e.outputNpm.path.length;t++){let n=s(e.outputNpm.path[t]);n.endsWith("*")&&(n=n.slice(0,-1)),n.endsWith("/")&&(n=n.slice(0,-1)),n=n.replace(/\\/g,"/"),e.outputNpm.path[t]=n}}else e.outputNpm={path:[],packageJson:!1,npmName:""};if(e.package){Array.isArray(e.package)||(e.package=[e.package]);for(let t=0;t<e.package.length;t++)e.package[t]=e.package[t].trim(),e.package[t].length>0&&(e.package[t]=s(e.package[t]))}else e.package=[]}let l=[];for(let e of t.src){let n="";e=e.replace(/\\/g,"/"),e.startsWith("/")||(n="/");let s=e.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),e=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+n+e).replace(/\\/g,"/"),c=a.replace("*","");c.endsWith("/")&&(c=c.slice(0,-1)),t.srcPath.push(c),a=(0,o.escapeRegex)(a,!0).replace("*",".*"),l.push("(^"+a+"$)")}if(t.stories){t.stories={...this.defaultConfigBuildStories(i,n),...t.stories};let e=s(t.stories.output);e.endsWith("*")&&(e=e.slice(0,-1)),e.endsWith("/")&&(e=e.slice(0,-1)),e=e.replace(/\\/g,"/"),t.stories.output=e}let c=l.join("|");""==c&&(c="(?!)"),t.srcPathRegex=new RegExp(c),t.nodeModulesDir=t.nodeModulesDir.trim(),""==t.nodeModulesDir?t.nodeModulesDir=(0,r.normalize)((0,o.uriToPath)(i)+"/node_modules"):t.nodeModulesDir=s(t.nodeModulesDir);let u=[];for(let e of t.dependances){u.push({...this.defaultConfigBuildDependanceValue(e),...e});const t=u[u.length-1];t.subDependancesInclude["*"]||(t.subDependancesInclude["*"]=e.include),t.uri=s(t.uri)}if(t.dependances=u,t.outsideModule){let e=[];for(let n of t.outsideModule){let t="";n=n.replace(/\\/g,"/"),n.startsWith("/")||(t="/");let s=n.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),n=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+t+n).replace(/\\/g,"/");a=(0,o.escapeRegex)(a,!0).replace("*",".*"),e.push("(^"+a+"$)")}let n=e.join("|");""==n&&(n="(?!)"),t.outsideModulePathRegex=new RegExp(n)}if("rules"==t.namespaceStrategy)for(let e in t.namespaceRules){let n=[],s=t.namespaceRules[e];for(let e of s){let t="";e=e.replace(/\\/g,"/"),e.startsWith("/")||(t="/");let s=e.split("/");""==s[s.length-1]||"*"==s[s.length-1]?s[s.length-1]="*":-1==s[s.length-1].indexOf(".")&&s.push("*"),e=s.join("/");let a=(0,r.normalize)((0,o.uriToPath)(i)+t+e).replace(/\\/g,"/");a=(0,o.escapeRegex)(a,!0).replace("*",".*"),n.push("(^"+a+"$)")}let a=n.join("|");""==a&&(a="(?!)"),t.namespaceRulesRegex[e]=new RegExp(a)}else if("followFolders"==t.namespaceStrategy||"followFoldersCamelCase"==t.namespaceStrategy){let e="";t.namespaceRoot.startsWith("/")||(e="/"),t.namespaceRoot=(0,r.normalize)((0,o.uriToPath)(i)+e+t.namespaceRoot).replace(/\\/g,"/")}return t}prepareStatic(e,t){let n=(0,o.getFolder)(e),i="";t.input.startsWith("/")||(i="/"),t.input.endsWith("*")&&(t.input=t.input.slice(0,-1)),t.input.endsWith("/")&&(t.input=t.input.slice(0,-1)),t.inputPathFolder=(0,r.normalize)((0,o.uriToPath)(n)+i+t.input),t.inputPathFolder=t.inputPathFolder.replace(/\\/g,"/"),i="",Array.isArray(t.output)||(t.output=[t.output]),t.outputPathFolder=[];for(let e of t.output)e=this.replaceEnvVar(e,n),e.endsWith("*")&&(e=e.slice(0,-1)),e.endsWith("/")&&(e=e.slice(0,-1)),e=e.replace(/\\/g,"/"),t.outputPathFolder.push(e);return t}defaultConfigValue(){return{module:"",hideWarnings:!1,version:"1.0.0",componentPrefix:"",dependances:[],build:[],static:[],avoidParsingInsideTags:[],aliases:{},namespaceRules:{},namespaceRulesRegex:{},namespaceStrategy:"manual",namespaceRoot:"./"}}defaultConfigBuildValue(e){return{fullname:"",name:"",version:e.version,disabled:!1,hideWarnings:e.hideWarnings,src:[],srcPath:[],stories:void 0,compile:[],srcPathRegex:new RegExp("(?!)"),outsideModule:[],outsideModulePathRegex:new RegExp("(?!)"),module:e.module,componentPrefix:e.componentPrefix,namespaceStrategy:e.namespaceStrategy,namespaceRules:{...e.namespaceRules},namespaceRulesRegex:{...e.namespaceRulesRegex},namespaceRoot:e.namespaceRoot,dependances:[...e.dependances],avoidParsingInsideTags:[...e.avoidParsingInsideTags],nodeModulesDir:""}}defaultConfigBuildStories(e,t){return{output:e+"/stories",format:"all"}}defaultConfigBuildDependanceValue(e){return{include:"need",subDependancesInclude:{},version:"x.x.x",uri:"",npm:""}}removeComments(e){return e=e.replace(/(\".*?\"|\'.*?\')|(\/\*.*?\*\/|\/\/[^(\r\n|\n)]*$)/gm,((e,t,n)=>{if(n){let e="";for(let t=0;t<n.length;t++)e+=" ";return e}return t})),e}}t.AventusJSONLanguageService=u},19490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateFile=t.TemplateManager=void 0;const r=n(72375),i=n(83693),s=n(50857),a=n(19408);class o{static instance;static getInstance(){return this.instance||(this.instance=new o),this.instance}onNewFileUUID;constructor(){this.onNewFile=this.onNewFile.bind(this),this.onNewFileUUID=i.FilesManager.getInstance().onNewFile(this.onNewFile)}async onNewFile(e){e.uri.endsWith(a.AventusExtension.Template)&&new l(e)}destroy(){i.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID)}}t.TemplateManager=o;class l{_file;get file(){return this._file}constructor(e){this._file=e,this.addEvents()}uuidEvents={onContentChange:"",onValidate:"",onSave:"",onDelete:"",onCompletion:"",onCompletionResolve:"",onHover:"",onDefinition:"",onFormatting:"",onCodeAction:"",onReferences:"",onCodeLens:"",onRename:""};addEvents(){this.uuidEvents.onContentChange=this.file.onContentChange(this.onContentChange.bind(this)),this.uuidEvents.onValidate=this.file.onValidate(this._onValidate.bind(this)),this.uuidEvents.onSave=this.file.onSave(this.onSave.bind(this)),this.uuidEvents.onDelete=this.file.onDelete(this._onDelete.bind(this)),this.uuidEvents.onCompletion=this.file.onCompletion(this.onCompletion.bind(this)),this.uuidEvents.onCompletionResolve=this.file.onCompletionResolve(this.onCompletionResolve.bind(this)),this.uuidEvents.onHover=this.file.onHover(this.onHover.bind(this)),this.uuidEvents.onDefinition=this.file.onDefinition(this.onDefinition.bind(this)),this.uuidEvents.onFormatting=this.file.onFormatting(this.onFormatting.bind(this)),this.uuidEvents.onCodeAction=this.file.onCodeAction(this.onCodeAction.bind(this)),this.uuidEvents.onReferences=this.file.onReferences(this.onReferences.bind(this)),this.uuidEvents.onCodeLens=this.file.onCodeLens(this.onCodeLens.bind(this)),this.uuidEvents.onRename=this.file.onRename(this.onRename.bind(this))}removeEvents(){this.file.removeOnContentChange(this.uuidEvents.onContentChange),this.file.removeOnValidate(this.uuidEvents.onValidate),this.file.removeOnSave(this.uuidEvents.onSave),this.file.removeOnDelete(this.uuidEvents.onDelete),this.file.removeOnCompletion(this.uuidEvents.onCompletion),this.file.removeOnCompletionResolve(this.uuidEvents.onCompletionResolve),this.file.removeOnHover(this.uuidEvents.onHover),this.file.removeOnDefinition(this.uuidEvents.onDefinition),this.file.removeOnFormatting(this.uuidEvents.onFormatting),this.file.removeOnCodeAction(this.uuidEvents.onCodeAction),this.file.removeOnReferences(this.uuidEvents.onReferences),this.file.removeOnCodeLens(this.uuidEvents.onCodeLens),this.file.removeOnRename(this.uuidEvents.onRename)}async validate(){this.file instanceof r.InternalAventusFile&&await this.file.validate()}triggerSave(){this.file instanceof r.InternalAventusFile&&this.file.triggerSave()}async triggerContentChange(){this.file instanceof r.InternalAventusFile&&await this.file.triggerContentChange(this.file.documentUser)}async _onValidate(){return await this.onValidate()}async onContentChange(){}async onValidate(){return s.AventusJSONLanguageService.getInstance().validate(this.file)}async onSave(){}async onDelete(){}async _onDelete(){await this.onDelete(),this.removeEvents()}async onCompletion(e,t){return s.AventusJSONLanguageService.getInstance().doComplete(e,t)}async onCompletionResolve(e,t){return s.AventusJSONLanguageService.getInstance().doResolve(t)}async onHover(e,t){return s.AventusJSONLanguageService.getInstance().doHover(e,t)}async onDefinition(e,t){return null}async onFormatting(e,t,n){return s.AventusJSONLanguageService.getInstance().format(e,t,n)}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.TemplateFile=l},51833:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusSharpSchema=t.AventusTemplateSchema=t.AventusConfigSchema=void 0,t.AventusConfigSchema={$schema:"foo://aventus/conf.json",title:"JSON Schema for Aventus",description:"JSON Schema for Aventus",type:"object",additionalProperties:!1,properties:{module:{type:"string",pattern:"^[a-zA-Z0-9_]+$",description:"Name of the exported module"},version:{type:"string",pattern:"^[0-9]+.[0-9]+.[0-9]+$",description:"Version for all your builds (x.x.x)"},hideWarnings:{type:"boolean",description:"Hide warnings for all your builds"},componentPrefix:{type:"string",description:"Identifier to prefix all your components (in lower case)",pattern:"^[a-z-]{2,}$"},dependances:{$ref:"#/$defs/dependances"},namespaceStrategy:{type:"string",enum:["manual","followFolders","followFoldersCamelCase","rules"],description:"Stragety to generate namespace",default:"manual"},namespaceRules:{type:"object",description:"Rules to define namespace when namespaceStrategy is rules"},namespaceRoot:{type:"string",description:"Root directory to define namespace when namespaceStrategy is followFolders"},build:{type:"array",items:{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:"Part name for the module. The export file will be ${module}@${name}",pattern:"^[a-zA-Z0-9_]+$"},version:{type:"string",pattern:"^[0-9]+.[0-9]+.[0-9]+$",description:"Version for this build (x.x.x)"},disabled:{type:"boolean",description:"Disable auto-build",default:!0},hideWarnings:{type:"boolean",description:"Hide warnings for this build"},componentPrefix:{type:"string",description:"Identifier to prefix all your components (in lower case)",pattern:"^[a-z-]{2,}$"},src:{type:"array",items:{type:"string"},description:"List of all pathes to listen watch"},stories:{type:"object",additionalProperties:!1,properties:{output:{type:"string",description:"Define where to export your stories"},workspace:{type:"string",description:"Define where to add the .storybook"},live:{type:"boolean",description:"Define if the story content must be recompiled on change"},format:{type:"string",enum:["all","public","protected","manual"],default:"all",description:"All will export all elements, public only public elements, protected only public and protected elements, manual only elements with tag Storybook"},prefix:{type:"string",description:"Define a prefix for all your stories name. Allow to group stories"},srcBaseUrl:{type:"string",description:"Define a base url to link file to your repo"}}},outsideModule:{type:"array",items:{type:"string"},description:"List of all pathes to import outside the module"},compile:{type:"array",items:{type:"object",additionalProperties:!1,properties:{input:{type:["string","array"],items:{type:"string"},description:"List of all pathes to import inside this build"},output:{type:["string","array"],items:{type:"string",pattern:"^\\S+\\.js"},pattern:"^\\S+\\.js",description:"The script file generated path"},outputNpm:{type:["string","array","object"],additionalProperties:!1,properties:{path:{type:["string","array"]},packageJson:{type:"boolean",description:"Define if you need to generate a package.json"},npmName:{type:"string",description:"Define the name set inside your package.json"}},items:{type:"string"},description:"Define where to export as npm files"},compressed:{type:"boolean"},package:{type:["string","array"],items:{type:"string",pattern:"^\\S+\\.package\\.avt"},pattern:"^\\S+\\.package\\.avt",description:"The package file generated path (for lib)"}}}},dependances:{$ref:"#/$defs/dependances"},module:{type:"string",pattern:"^[a-zA-Z0-9_]+$",description:"Name of the exported module for this build"},namespaceStrategy:{type:"string",enum:["manual","followFolders","followFoldersCamelCase","rules"],description:"Stragety to generate namespace",default:"manual"},namespaceRules:{type:"object",description:"Rules to define namespace when namespaceStrategy is rules"},namespaceRoot:{type:"string",description:"Root directory to define namespace when namespaceStrategy is followFolders"},avoidParsingInsideTags:{type:"array",items:{type:"string",pattern:"^[a-z-]+$"},description:"List of html tag that mustn't be parsed by the html compiler"},nodeModulesDir:{type:["string","array"],items:{type:"string"},description:"The dirs where node_modules are located"}},required:["name","src"]},minItems:1},static:{type:"array",items:{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:"Part name for the static export",pattern:"^[a-zA-Z0-9_]+$"},input:{type:"string",description:"Input path to watch to export as static files"},output:{type:["string","array"],items:{type:"string"},description:"Define where to export static files"}},required:["name","input","output"]}},avoidParsingInsideTags:{type:"array",items:{type:"string",pattern:"^[a-z-]+$"},description:"List of html tag that mustn't be parsed by the html compiler"},aliases:{type:"object"}},required:["build","module"],$defs:{dependances:{type:"array",description:"List of dependances for this build",items:{type:"object",additionalProperties:!1,properties:{uri:{type:"string",description:"Where to find the package or the json file"},npm:{type:"string",description:"The npm package name"},version:{type:"string",pattern:"^[0-9x]+.[0-9x]+.[0-9x]+$",description:"The version to use for this file. (default is x.x.x)",default:"x.x.x"},include:{type:"string",description:"Determine if the package must be included inside the final export. (default is need)",enum:["none","need","full"],default:"need"},subDependancesInclude:{type:"object",description:"Inclusion pattern for each lib. You can use a star to select everythink. If nothink find for a lib, the need value ll be used",patternProperties:{"^\\S+$":{type:"string",enum:["none","need","full"],default:"need"}}}},required:["uri"]}}}},t.AventusTemplateSchema={$schema:"foo://aventus/template.json",title:"JSON Schema for Aventus Template",description:"JSON Schema for Aventus Template",type:"object",additionalProperties:!1,properties:{name:{type:"string"},description:{type:"string"},version:{type:"string",pattern:"^[0-9]+.[0-9]+.[0-9]+$"},variables:{type:"object",patternProperties:{"^.*$":{type:"object",additionalProperties:!1,properties:{question:{type:"string"},type:{type:"string",enum:["input","select"]},defaultValue:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"}]},list:{type:"object"},validation:{type:"array",items:{type:"object",additionalProperties:!1,properties:{pattern:{type:"string"},errorMsg:{type:"string"}},required:["pattern"]}}},required:["question","type"]}}},filesToOpen:{type:"array",items:{type:"string"}},cmdsAfter:{type:"array",items:{type:"string"}},cmdsAfterAdmin:{type:"array",items:{type:"string"}}},required:["name","description","version","variables"]},t.AventusSharpSchema={$schema:"foo://aventus/sharp.json",title:"JSON Schema for Aventus",description:"JSON Schema for Aventus",type:"object",additionalProperties:!1,properties:{csProj:{type:"string",pattern:"^\\S+\\.csproj"},outputPath:{type:"string"},exportEnumByDefault:{type:"boolean",default:!1},exportStorableByDefault:{type:"boolean",default:!0},exportHttpRouteByDefault:{type:"boolean",default:!0},exportErrorsByDefault:{type:"boolean",default:!0},exportWsEndPointByDefault:{type:"boolean",default:!0},exportWsEventByDefault:{type:"boolean",default:!0},exportWsRouteByDefault:{type:"boolean",default:!0},replacer:{type:"object",additionalProperties:!1,properties:{all:{$ref:"#/$defs/replacerPart"},genericError:{$ref:"#/$defs/replacerPart"},httpRouter:{$ref:"#/$defs/replacerPart"},normalClass:{$ref:"#/$defs/replacerPart"},storable:{$ref:"#/$defs/replacerPart"},withError:{$ref:"#/$defs/replacerPart"},wsEndPoint:{$ref:"#/$defs/replacerPart"},wsEvent:{$ref:"#/$defs/replacerPart"},wsRouter:{$ref:"#/$defs/replacerPart"}}},httpRouter:{type:"object",additionalProperties:!1,properties:{createRouter:{type:"boolean",default:!0},autobindRoute:{type:"string",enum:["none","auto","full"],default:"auto"},routerName:{type:"string",default:"GeneratedRouter"},variableRoutesName:{type:"string",default:"generatedHttpRoutes"},uri:{type:"string",default:"",pattern:"^(?=s*$)|^(\\/[a-zA-Z0-9_-]+?){1,}$"},host:{type:"string",default:"https://localhost:5000",pattern:"^http(s)?:\\/\\/[a-zA-Z0-9_-]*?(:[0-9]{3,4})?$"},parent:{type:"string",default:"Aventus.HttpRouter"},namespace:{type:"string",default:"Routes"}}},wsEndpoint:{type:"object",additionalProperties:!1,properties:{prefix:{type:"string",default:""}}}},required:["csProj","outputPath"],$defs:{replacerPart:{type:"object",additionalProperties:!1,properties:{type:{type:"object",patternProperties:{"^\\S+$":{type:"object",additionalProperties:!1,properties:{result:{type:"string"},file:{type:"string"},useTypeImport:{type:"boolean"}},required:["result"]}}},result:{type:"object",patternProperties:{"^\\S+$":{type:"object",additionalProperties:!1,properties:{result:{type:"string"},file:{type:"string"},useTypeImport:{type:"boolean"}},required:["result"]}}}}}}}},56733:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebSCSSFile=void 0;const r=n(71017),i=n(19408),s=n(83693),a=n(60206),o=n(1539),l=n(67246),c=n(16286),u=n(99007),p=n(95896),_=n(57999),d=n(69916),h=n(57147),f=n(18952),m=n(24964);class g extends l.AventusBaseFile{compiledVersion=-1;usedBy={};dependances={};diagnostics=[];diagnosticCompile;compiledTxt="";namespace="";_rules=new Map;customProperties=[];get compileResult(){return this.compiledTxt}get rules(){return this._rules}get htmlFile(){let e=this.build.htmlFiles[this.file.uri.replace(i.AventusExtension.ComponentStyle,i.AventusExtension.ComponentView)];return e instanceof p.AventusHTMLFile?e:null}get isGlobal(){return this.file.name.startsWith("@")}get globalName(){return this.file.name.replace(i.AventusExtension.ComponentStyle,"")}constructor(e,t){super(e,t),this.namespace=this.build.getNamespace(e.uri)}async init(){await this.loadDependances(),await this.compile(!1)}async onValidate(){return this.diagnostics=await this.build.scssLanguageService.doValidation(this.file),await this.loadDependances(),this.diagnosticCompile?[...this.diagnostics,this.diagnosticCompile]:this.diagnostics}async onContentChange(){}async onSave(){await this.compileRoot()}async compileRoot(){if(0==Object.values(this.usedBy).length)await this.compile();else for(let e in this.usedBy)this.usedBy[e].onSave()}async compile(e=!0){try{let t=this.compiledTxt,n="|error|";const r=async e=>{let t=e.contentUser;t=t.replace(/\/\*[\s\S]*?@import[\s\S]*?\*\/|\/\/.*@import.*/g,"");let i=/@import *?('|")(\S*?)('|");?/g,s=null;for(;s=i.exec(t);){let i=s[2],a=await this.resolvePath(i,e.folderPath);if(!a)return n;{let e=await r(a);if(e==n)return e;t=t.replace(s[0],e)}}return t};let s=await r(this.file);if("|error|"!=s)try{this.customProperties=u.AventusSCSSLanguageService.getCustomProperty(s),s=s.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1"),t=(0,d.compileString)(s,{style:"compressed"}).css.toString().trim(),this.diagnosticCompile&&(this.diagnosticCompile=void 0,m.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:this.diagnostics},this.build))}catch(e){if(e instanceof d.Exception){this.diagnosticCompile=(0,o.createErrorScss)(this.file.documentUser,e.message);const t=[...this.diagnostics,this.diagnosticCompile];m.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:t},this.build)}else console.log(e)}if(t!=this.compiledTxt)if(this.compiledVersion++,this.compiledTxt=t,this.isGlobal)a.HttpServer.getInstance().updateGlobalCSS(this.globalName,this.compiledTxt),this.build.build();else{let t=this.build.tsFiles[this.file.uri.replace(i.AventusExtension.ComponentStyle,i.AventusExtension.ComponentLogic)];if(t instanceof c.AventusWebComponentLogicalFile&&e&&(t.canUpdateComponent=!1,await t.triggerSave(),t.compilationResult)){let e=this.namespace,n=t.fileParsed?.classes[t.compilationResult.componentName].namespace;n&&(e+=n),e.length>0&&!e.endsWith(".")&&(e+="."),a.HttpServer.getInstance().updateCSS(this.compiledTxt,e+t.compilationResult.componentName,[])}}this._rules=this.build.scssLanguageService.getRules(this.file);let l=this.build.htmlFiles[this.file.uri.replace(i.AventusExtension.ComponentStyle,i.AventusExtension.ComponentView)];l instanceof p.AventusHTMLFile&&_.ParserHtml.refreshStyle(l,this._build)}catch(e){console.error(e)}}async onDelete(){for(let e in this.dependances)this.removeDependance(e);for(let e in this.usedBy)delete this.usedBy[e].dependances[this.file.uri],delete this.usedBy[e],await this.usedBy[e].onContentChange()}async onCompletion(e,t){let n={isIncomplete:!1,items:[]};return n=await this.build.scssLanguageService.doComplete(e,t),n}async onCompletionResolve(e,t){return t}async onHover(e,t){return this.build.scssLanguageService.doHover(e,t)}async onDefinition(e,t){return this.build.scssLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return this.build.scssLanguageService.format(e,t,n)}async onCodeAction(e,t){return this.build.scssLanguageService.doCodeAction(e,t)}async onReferences(e,t){let n=await this.build.scssLanguageService.onReferences(e,t);return n=[...n,...this.build.scssLanguageService.getLinkToHtml(this,t)],n}async onCodeLens(e){return[]}onGetBuild(){return[this.build]}async onRename(e,t,n){return null}async loadDependances(){let e=this.file.contentUser,t=e.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1"),n=/@import *?('|")(\S*?)('|");?/g,r=null;for(let e in this.dependances)this.removeDependance(e);for(;r=n.exec(t);){let t=r[2],n=await this.resolvePath(t,this.file.folderPath);if(n)await this.addDependance(n);else{let t=e.indexOf(r[0]),n=t+r[0].length;this.diagnostics.push((0,o.createErrorScssPos)(this.file.documentUser,"Can't load this file",t,n))}}}removeDependance(e){this.dependances[e]&&(delete this.dependances[e].usedBy[this.file.uri],delete this.dependances[e])}async addDependance(e){this.build.scssFiles[e.uri]?(this.dependances[e.uri]=this.build.scssFiles[e.uri],this.build.scssFiles[e.uri].usedBy[this.file.uri]=this):e.uri.endsWith(i.AventusExtension.ComponentStyle)&&(this.build.scssFiles[e.uri]=new g(e,this.build),await this.build.scssFiles[e.uri].init(),this.dependances[e.uri]=this.build.scssFiles[e.uri],this.build.scssFiles[e.uri].usedBy[this.file.uri]=this)}async getByPath(e){let t=s.FilesManager.getInstance().getByPath(e);if(t)return t;if((0,h.existsSync)(e)&&(0,h.lstatSync)(e).isFile()){let t=f.TextDocument.create((0,o.pathToUri)(e),i.AventusLanguageId.SCSS,1,(0,h.readFileSync)(e,"utf-8"));return await s.FilesManager.getInstance().registerFile(t),s.FilesManager.getInstance().getByPath(e)}}async resolvePath(e,t){e=this.build.project.resolveAlias(e,t),e=(0,r.normalize)(t+"/"+e);let n=await this.getByPath(e);if(n)return n;let s=e+i.AventusExtension.ComponentStyle;if(n=await this.getByPath(s),n)return n;let a=e.split(r.sep);a[a.length-1]="_"+a[a.length-1];let o=a.join(r.sep);if(n=await this.getByPath(o),n)return n;let l=o+i.AventusExtension.ComponentStyle;return n=await this.getByPath(l),n||void 0}}t.AventusWebSCSSFile=g},81940:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusGlobalSCSSFile=void 0;const r=n(37071),i=n(71017),s=n(83693),a=n(19408),o=n(1539),l=n(57147),c=n(69916),u=n(24964),p=n(29495);class _ extends r.AventusGlobalBaseFile{compiledVersion=-1;usedBy={};dependances={};diagnostics=[];diagnosticCompile;compiledTxt="";savedOnce=!1;staticNamebyOutPath={};get resultCompiled(){return this.compiledTxt}constructor(e,t){super(e,t),this.loadDependances(),this.project.globalSCSSLanguageService.loadVariables(this,this.file.uri)}async onContentChange(){}async onValidate(){return this.diagnostics=await this.project.globalSCSSLanguageService.doValidation(this.file),this.loadDependances(),this.diagnosticCompile?[...this.diagnostics,this.diagnosticCompile]:this.diagnostics}async onSave(){this.savedOnce=!0,this.compileRoot(),this.project.globalSCSSLanguageService.loadVariables(this,this.file.uri)}compileRoot(){if(0==Object.values(this.usedBy).length)this.compile();else for(let e in this.usedBy)this.usedBy[e].onSave()}compile(){try{let e=this.compiledTxt,t="|error|";const n=e=>{let r=e.contentUser;r=r.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1");let i=/@import *?('|")(\S*?)('|");?/g,s=null;for(;s=i.exec(r);){let i=s[2],a=this.resolvePath(i,e.folderPath);if(!a)return t;{let e=n(a);if(e==t)return e;r=r.replace(s[0],e)}}return r};let r=n(this.file);if("|error|"!=r){const t=e=>{if(p.SettingsManager.getInstance().settings.errorByBuild){const t=this.project.getBuilds();for(let n of t)u.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:e},n)}else u.GenericServer.sendDiagnostics({uri:this.file.uri,diagnostics:e})};try{e=(0,c.compileString)(r,{style:"compressed"}).css.toString().trim(),this.diagnosticCompile&&(this.diagnosticCompile=void 0,t(this.diagnostics))}catch(e){if(e instanceof c.Exception){this.diagnosticCompile=(0,o.createErrorScss)(this.file.documentUser,e.message);t([...this.diagnostics,this.diagnosticCompile])}}}e!=this.compiledTxt&&(this.compiledVersion++,this.compiledTxt=e,this.export())}catch(e){console.error(e)}}async onDelete(){for(let e in this.dependances)this.removeDependance(e);for(let e in this.usedBy)delete this.usedBy[e].dependances[this.file.uri],delete this.usedBy[e],await this.usedBy[e].onContentChange();this.project.globalSCSSLanguageService.removeVariables(this.file.uri)}async onCompletion(e,t){let n={isIncomplete:!1,items:[]};return n=await this.project.globalSCSSLanguageService.doComplete(e,t),n}async onCompletionResolve(e,t){return t}async onHover(e,t){return this.project.globalSCSSLanguageService.doHover(e,t)}async onDefinition(e,t){return this.project.globalSCSSLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return this.project.globalSCSSLanguageService.format(e,t,n)}async onCodeAction(e,t){return this.project.globalSCSSLanguageService.doCodeAction(e,t)}async onReferences(e,t){return await this.project.globalSCSSLanguageService.onReferences(e,t)}async onCodeLens(e){return[]}async onRename(e,t,n){return null}addOutPath(e,t){this.file.shortname.startsWith("_")||this.staticNamebyOutPath[e]||(this.staticNamebyOutPath[e]=t,this.savedOnce?this.export():this.onSave())}export(){for(let e in this.staticNamebyOutPath){let t=(0,i.normalize)(e),n=t.split(i.sep);n.pop();let r=n.join(i.sep);(0,l.existsSync)(r)||(0,l.mkdirSync)(r,{recursive:!0}),(0,o.writeFile)(t,this.compiledTxt,"static",this.staticNamebyOutPath[e])}}loadDependances(){let e=this.file.contentUser,t=e.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"$1"),n=/@import *?('|")(\S*?)('|");?/g,r=null;for(let e in this.dependances)this.removeDependance(e);for(;r=n.exec(t);){let t=r[2],n=this.resolvePath(t,this.file.folderPath);if(n)this.addDependance(n);else{let t=e.indexOf(r[0]),n=t+r[0].length;this.diagnostics.push((0,o.createErrorScssPos)(this.file.documentUser,"Can't load this file",t,n))}}}removeDependance(e){this.dependances[e]&&(delete this.dependances[e].usedBy[this.file.uri],delete this.dependances[e])}addDependance(e){this.project.scssFiles[e.uri]?(this.dependances[e.uri]=this.project.scssFiles[e.uri],this.project.scssFiles[e.uri].usedBy[this.file.uri]=this):e.uri.endsWith(a.AventusExtension.GlobalStyle)&&(this.project.scssFiles[e.uri]=new _(e,this.project),this.dependances[e.uri]=this.project.scssFiles[e.uri],this.project.scssFiles[e.uri].usedBy[this.file.uri]=this)}resolvePath(e,t){e=this.project.resolveAlias(e,t),e=(0,i.normalize)(t+"/"+e);let n=s.FilesManager.getInstance().getByPath(e);if(n)return n;let r=e+a.AventusExtension.GlobalStyle;if(n=s.FilesManager.getInstance().getByPath(r),n)return n;let o=e.split(i.sep);o[o.length-1]="_"+o[o.length-1];let l=o.join(i.sep);if(n=s.FilesManager.getInstance().getByPath(l),n)return n;let c=l+a.AventusExtension.GlobalStyle;return n=s.FilesManager.getInstance().getByPath(c),n||void 0}}t.AventusGlobalSCSSFile=_},22399:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusGlobalSCSSLanguageService=void 0;const r=n(51722),i=n(50009),s=n(82285),a=n(12056),o=n(42374),l=n(24560);t.AventusGlobalSCSSLanguageService=class{languageService;variablesByUri={};variablesByName={};constructor(){this.languageService=(0,a.getSCSSLanguageService)()}async doValidation(e){return this.languageService.doValidation(e.documentUser,this.languageService.parseStylesheet(e.documentUser))}async doComplete(e,t){return this.languageService.doComplete(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async doHover(e,t){return this.languageService.doHover(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async findDefinition(e,t){return this.languageService.findDefinition(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async format(e,t,n){let a={...n,preserveNewLines:!0,spaceAroundSelectorSeparator:!0,insertFinalNewline:!0,insertSpaces:!1,tabSize:4},o=e.documentUser,l=await this.languageService.format(o,t,a);if(1==l.length){let e=o.offsetAt(l[0].range.start),t=o.offsetAt(l[0].range.end),n=o.getText().length;if(0==e&&t==n){let e=await(0,r.default)([i({order:["custom-properties","dollar-variables","declarations","at-rules","rules"],"properties-order":"alphabetical"})]).process(l[0].newText,{parser:s,from:"./temp.scss",to:"./temp.scss"});l[0].newText=e.css}}return l}async doCodeAction(e,t){let n=this.languageService.parseStylesheet(e.documentUser),r=o.CodeActionContext.create(this.languageService.doValidation(e.documentUser,n));return this.languageService.doCodeActions2(e.documentUser,t,r,n)}async onReferences(e,t){let n=this.languageService.parseStylesheet(e.documentUser);return this.languageService.findReferences(e.documentUser,t,n)}loadVariables(e,t){let n=e.file.documentUser,r={};const i=e=>{if(e.type==l.NodeType.CustomPropertyDeclaration){let i=e;for(;i&&null==i.selectors;)i=i.parent;if(i){if(":root"==i.selectors.getText()){let i=e.getChild(0),s=e.getChild(1);if(i&&s){let e=i.getText();e.startsWith("--")&&(i.offset,r[e]||(r[e]={name:e,uri:t,range:{start:n.positionAt(i.offset),end:n.positionAt(i.end)},value:s.getText()}))}}}}else if(e.hasChildren())for(let t of e.getChildren())i(t)};let s=(0,a.getSCSSLanguageService)().parseStylesheet(n),o=(0,l.getNodePath)(s,0);for(let e of o)i(e);this.variablesByUri[t]=Object.values(r),this.reloadVariables()}reloadVariables(){this.variablesByName={};for(let e in this.variablesByUri)for(let t of this.variablesByUri[e])this.variablesByName[t.name]||(this.variablesByName[t.name]=t)}removeVariables(e){delete this.variablesByUri[e],this.reloadVariables()}getDefinition(e){return this.variablesByName[e]}}},99007:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusSCSSLanguageService=void 0;const r=n(51722),i=n(50009),s=n(82285),a=n(12056),o=n(42374),l=n(24560),c=n(18952);t.AventusSCSSLanguageService=class{languageService;documentationInfo={};externalDocumentation={};internalDocumentation={};build;getInternalDocumentation(){let e={};for(let t in this.internalDocumentation)try{e={...e,...this.internalDocumentation[t]}}catch(e){}return e}constructor(e){this.build=e,this.languageService=(0,a.getSCSSLanguageService)()}async doValidation(e){let t=[];t=this.languageService.doValidation(e.documentUser,this.languageService.parseStylesheet(e.documentUser));for(let e=0;e<t.length;e++)"emptyRules"==t[e].code&&(t.splice(e,1),e--);return t}async doComplete(e,t){let n=[],r={isIncomplete:!1,items:[]};r=this.languageService.doComplete(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser));let i={};for(let e of r.items)i[e.label]=e;let s=this.getTree(e,t).reverse()[0];if(this.documentationInfo[s])for(let e of this.documentationInfo[s])-1==n.indexOf(e.name)&&(n.push(e.name),i[e.name]={label:e.name});const a=/^(#([\da-f]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))$/i;for(let e in this.build.globalSCSSLanguageService.variablesByName){this.build.globalSCSSLanguageService.variablesByName[e].value.match(a)?i[e]={label:e}:i[""+e]={label:""+e}}return r.items=Object.values(i),r}async doHover(e,t){let n=this.getElementAtPosition(e,t);if(n?.type==l.NodeType.Identifier){let e=this.build.globalSCSSLanguageService.getDefinition(n.getText());if(e)return{contents:{kind:"plaintext",value:e.name+": "+e.value}}}return this.languageService.doHover(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async findDefinition(e,t){let n=this.getElementAtPosition(e,t);if(n?.type==l.NodeType.Identifier){let e=this.build.globalSCSSLanguageService.getDefinition(n.getText());if(e)return{uri:e.uri,range:e.range}}return this.languageService.findDefinition(e.documentUser,t,this.languageService.parseStylesheet(e.documentUser))}async format(e,t,n){let a={...n,preserveNewLines:!0,spaceAroundSelectorSeparator:!0,insertFinalNewline:!0,insertSpaces:!1,tabSize:4},o=e.documentUser,l=await this.languageService.format(o,t,a);if(1==l.length){let e=o.offsetAt(l[0].range.start),t=o.offsetAt(l[0].range.end),n=o.getText().length;if(0==e&&t==n){let e=await(0,r.default)([i({order:["custom-properties","dollar-variables","declarations","at-rules","rules"],"properties-order":"alphabetical"})]).process(l[0].newText,{parser:s,syntax:s,from:"./temp.scss",to:"./temp.scss"});l[0].newText=e.css}}return l}async doCodeAction(e,t){let n=this.languageService.parseStylesheet(e.documentUser),r=o.CodeActionContext.create(this.languageService.doValidation(e.documentUser,n));return this.languageService.doCodeActions2(e.documentUser,t,r,n)}async onReferences(e,t){let n=this.languageService.parseStylesheet(e.documentUser);return this.languageService.findReferences(e.documentUser,t,n)}rebuildDefinition(){this.documentationInfo={};for(let e in this.externalDocumentation){let t=this.externalDocumentation[e];this.documentationInfo={...this.documentationInfo,...t}}for(let e in this.internalDocumentation){let t=this.internalDocumentation[e];try{this.documentationInfo={...this.documentationInfo,...t}}catch(e){}}}addExternalDefinition(e,t){this.externalDocumentation[e]=t,this.rebuildDefinition()}removeExternalDefinition(e){delete this.externalDocumentation[e],this.rebuildDefinition()}addInternalDefinition(e,t){this.internalDocumentation[e]=t,this.rebuildDefinition()}removeInternalDefinition(e){delete this.internalDocumentation[e],this.rebuildDefinition()}getLinkToHtml(e,t){let n=[],r=e.file.documentUser.offsetAt(t),i=e.htmlFile;if(i&&i.fileParsed)for(let e of i.fileParsed.styleLinks){let t=e[1];r>=t.start&&r<=t.end&&n.push({uri:i.file.uri,range:{start:i.file.documentUser.positionAt(e[0].start),end:i.file.documentUser.positionAt(e[0].end)}})}return n}getTree(e,t){let n=[];if(this.languageService){let r=this.languageService.parseStylesheet(e.documentUser),i=e.documentUser.offsetAt(t),s=(0,l.getNodePath)(r,i);for(let e of s)if(e.type==l.NodeType.Ruleset){let t=e.getChild(0);if(t){let e=t.getText();n.push(e)}}}return n}getRules(e){let t=new Map,n=this.languageService.parseStylesheet(e.documentUser);const r=e=>t=>{let n=e.getText().replace(".",""),r=new RegExp("((?:^|\\W))("+n+")(?:$|\\W)","gi");return!!t.attributes.class?.value?.match(r)},i=e=>t=>{let n=e.getText();return t.tagName==n},s=(e=null,t)=>n=>{if(e){let t=!1,r=n.parent;for(;r;){if(e(r)){t=!0;break}r=r.parent}if(!t)return!1}for(let e of t)if(!e(n))return!1;return!0},a=(e,n=null)=>{if(e.type==l.NodeType.Ruleset){let a=!1,o=e.getChildren();if(o.length>1)for(let e of o[1].getChildren())if(e.type==l.NodeType.Declaration||e.type==l.NodeType.CustomPropertyDeclaration||e.type==l.NodeType.MixinDeclaration||e.type==l.NodeType.FunctionDeclaration||e.type==l.NodeType.VariableDeclaration){a=!0;break}if(o.length>0){let e=o[0]?.getChildren()[0],a=null;if(e){for(let t of e.getChildren())if(t.type==l.NodeType.SimpleSelector){a?a.start>t.offset?a.start=t.offset:a.end<t.offset+t.length&&(a.end=t.offset+t.length):a={start:t.offset,end:t.offset+t.length};let e=[];for(let n of t.getChildren())n.type==l.NodeType.ClassSelector?e.push(r(n)):n.type==l.NodeType.ElementNameSelector&&e.push(i(n));e.length>0&&(n=s(n,e))}else{t.getText();console.log("css node to implement")}n&&a&&t.set(n,a)}}}else if(e.type==l.NodeType.Property)return;if(e.hasChildren())for(let t of e.getChildren())a(t,n)};let o=(0,l.getNodePath)(n,0);return o.length>0&&a(o[0]),t}getElementAtPosition(e,t){if(this.languageService){let n=this.languageService.parseStylesheet(e.documentUser),r=e.documentUser.offsetAt(t),i=e=>{let t=e.getChildren();for(let e of t)if(e.offset<=r&&e.end>=r)return e.hasChildren()?i(e):e;return null};return i(n)}return null}static getCustomProperty(e){let t=c.TextDocument.create("temp.scss","scss",1,e),n={};const r=e=>{if(e.type==l.NodeType.CustomPropertyDeclaration){let t=e;for(;t&&null==t.selectors;)t=t.parent;if(t){if(":host"==t.selectors.getText()){let t=e.getChild(0),r=e.getChild(1);if(t&&r){let i=null;t.getText().startsWith("--internal")?i=t.getText().replace("--internal-","--"):t.getText().startsWith("--_")&&(i=t.getText().replace("--_","--"));const s=((e,t)=>{let n=e.parent?.getText()??"";const r=new RegExp(`/\\*([\\s\\S]*?)\\*/\\s*${t}\\s*:\\s*[^;]+;`,"g").exec(n);if(r&&r[1]){const e={documentation:[],type:"*"},t=r[1].trim().split("\n");let n=!1;for(let r of t)r=r.replace("*","").trim(),r.startsWith("@")?(n=!0,r.startsWith("@type")&&(e.type=r.replace("@type","").trim()),r.startsWith("@default")&&(e.default=r.replace("@default","").trim())):n||e.documentation.push(r);return e}return null})(e,t.getText());if(i&&-1!=r.getText().indexOf(i)){const e={name:i};s?.documentation&&(e.documentation=s.documentation.join("\n")),s?.type&&(e.type=s.type),s?.default&&(e.defaultValue=s.default);let t=r,a=[],o="";for(;t&&t.getChildren().length>0;){let e=t.getChildren(),n=t.getText();n&&n.startsWith("--")&&(n=n.split(",")[0],o!=n&&n!=i&&(o=n,a.push(n))),t=e[e.length-1]}let l=t.getText()??"";l&&(l.startsWith("--")||a.push(l)),a.length>0&&(e.chainValues=a),n[e.name]=e}}}}}else if(e.hasChildren())for(let t of e.getChildren())r(t)};let i=(0,a.getSCSSLanguageService)().parseStylesheet(t),s=(0,l.getNodePath)(i,0);for(let e of s)r(e);return Object.values(n)}}},24560:(e,t)=>{"use strict";var n,r;function i(e,t){let n=null;return!e||t<e.offset||t>e.end?null:(e.accept((e=>-1===e.offset&&-1===e.length||e.offset<=t&&e.end>=t&&(n?e.length<=n.length&&(n=e):n=e,!0))),n)}Object.defineProperty(t,"__esModule",{value:!0}),t.BinaryExpression=t.Expression=t.PageBoxMarginBox=t.Page=t.SupportsCondition=t.MediaFeature=t.MediaCondition=t.MediaQuery=t.Medialist=t.Document=t.Supports=t.Media=t.Namespace=t.ForwardVisibility=t.Forward=t.ModuleConfiguration=t.Use=t.Import=t.KeyframeSelector=t.Keyframe=t.NestedProperties=t.FontFace=t.ViewPort=t.FunctionDeclaration=t.ElseStatement=t.WhileStatement=t.EachStatement=t.ForStatement=t.IfStatement=t.FunctionArgument=t.FunctionParameter=t.Function=t.Invocation=t.Property=t.CustomPropertyDeclaration=t.Declaration=t.CustomPropertySet=t.AbstractDeclaration=t.AtApplyRule=t.SimpleSelector=t.Selector=t.RuleSet=t.BodyDeclaration=t.Declarations=t.Stylesheet=t.Identifier=t.Nodelist=t.Node=t.ReferenceType=t.NodeType=void 0,t.ParseErrorCollector=t.Marker=t.Level=t.Module=t.GuardCondition=t.LessGuard=t.ListEntry=t.UnknownAtRule=t.MixinDeclaration=t.MixinReference=t.MixinContentDeclaration=t.MixinContentReference=t.ExtendsReference=t.Variable=t.Interpolation=t.VariableDeclaration=t.NumericValue=t.RatioValue=t.HexColorValue=t.Operator=t.AttributeSelector=t.Term=void 0,t.getNodeAtOffset=i,t.getNodePath=function(e,t){let n=i(e,t);const r=[];for(;n;)r.unshift(n),n=n.parent;return r},t.getParentDeclaration=function(e){const t=e.findParent(n.Declaration),r=t&&t.getValue();if(r&&r.encloses(e))return t;return null},function(e){e[e.Undefined=0]="Undefined",e[e.Identifier=1]="Identifier",e[e.Stylesheet=2]="Stylesheet",e[e.Ruleset=3]="Ruleset",e[e.Selector=4]="Selector",e[e.SimpleSelector=5]="SimpleSelector",e[e.SelectorInterpolation=6]="SelectorInterpolation",e[e.SelectorCombinator=7]="SelectorCombinator",e[e.SelectorCombinatorParent=8]="SelectorCombinatorParent",e[e.SelectorCombinatorSibling=9]="SelectorCombinatorSibling",e[e.SelectorCombinatorAllSiblings=10]="SelectorCombinatorAllSiblings",e[e.SelectorCombinatorShadowPiercingDescendant=11]="SelectorCombinatorShadowPiercingDescendant",e[e.Page=12]="Page",e[e.PageBoxMarginBox=13]="PageBoxMarginBox",e[e.ClassSelector=14]="ClassSelector",e[e.IdentifierSelector=15]="IdentifierSelector",e[e.ElementNameSelector=16]="ElementNameSelector",e[e.PseudoSelector=17]="PseudoSelector",e[e.AttributeSelector=18]="AttributeSelector",e[e.Declaration=19]="Declaration",e[e.Declarations=20]="Declarations",e[e.Property=21]="Property",e[e.Expression=22]="Expression",e[e.BinaryExpression=23]="BinaryExpression",e[e.Term=24]="Term",e[e.Operator=25]="Operator",e[e.Value=26]="Value",e[e.StringLiteral=27]="StringLiteral",e[e.URILiteral=28]="URILiteral",e[e.EscapedValue=29]="EscapedValue",e[e.Function=30]="Function",e[e.NumericValue=31]="NumericValue",e[e.HexColorValue=32]="HexColorValue",e[e.RatioValue=33]="RatioValue",e[e.MixinDeclaration=34]="MixinDeclaration",e[e.MixinReference=35]="MixinReference",e[e.VariableName=36]="VariableName",e[e.VariableDeclaration=37]="VariableDeclaration",e[e.Prio=38]="Prio",e[e.Interpolation=39]="Interpolation",e[e.NestedProperties=40]="NestedProperties",e[e.ExtendsReference=41]="ExtendsReference",e[e.SelectorPlaceholder=42]="SelectorPlaceholder",e[e.Debug=43]="Debug",e[e.If=44]="If",e[e.Else=45]="Else",e[e.For=46]="For",e[e.Each=47]="Each",e[e.While=48]="While",e[e.MixinContentReference=49]="MixinContentReference",e[e.MixinContentDeclaration=50]="MixinContentDeclaration",e[e.Media=51]="Media",e[e.Keyframe=52]="Keyframe",e[e.FontFace=53]="FontFace",e[e.Import=54]="Import",e[e.Namespace=55]="Namespace",e[e.Invocation=56]="Invocation",e[e.FunctionDeclaration=57]="FunctionDeclaration",e[e.ReturnStatement=58]="ReturnStatement",e[e.MediaQuery=59]="MediaQuery",e[e.MediaCondition=60]="MediaCondition",e[e.MediaFeature=61]="MediaFeature",e[e.FunctionParameter=62]="FunctionParameter",e[e.FunctionArgument=63]="FunctionArgument",e[e.KeyframeSelector=64]="KeyframeSelector",e[e.ViewPort=65]="ViewPort",e[e.Document=66]="Document",e[e.AtApplyRule=67]="AtApplyRule",e[e.CustomPropertyDeclaration=68]="CustomPropertyDeclaration",e[e.CustomPropertySet=69]="CustomPropertySet",e[e.ListEntry=70]="ListEntry",e[e.Supports=71]="Supports",e[e.SupportsCondition=72]="SupportsCondition",e[e.NamespacePrefix=73]="NamespacePrefix",e[e.GridLine=74]="GridLine",e[e.Plugin=75]="Plugin",e[e.UnknownAtRule=76]="UnknownAtRule",e[e.Use=77]="Use",e[e.ModuleConfiguration=78]="ModuleConfiguration",e[e.Forward=79]="Forward",e[e.ForwardVisibility=80]="ForwardVisibility",e[e.Module=81]="Module"}(n||(t.NodeType=n={})),function(e){e[e.Mixin=0]="Mixin",e[e.Rule=1]="Rule",e[e.Variable=2]="Variable",e[e.Function=3]="Function",e[e.Keyframe=4]="Keyframe",e[e.Unknown=5]="Unknown",e[e.Module=6]="Module",e[e.Forward=7]="Forward",e[e.ForwardVisibility=8]="ForwardVisibility"}(r||(t.ReferenceType=r={}));class s{parent;offset;length;get end(){return this.offset+this.length}options;textProvider;children;issues;nodeType;constructor(e=-1,t=-1,n){this.parent=null,this.offset=e,this.length=t,n&&(this.nodeType=n)}set type(e){this.nodeType=e}get type(){return this.nodeType||n.Undefined}getTextProvider(){let e=this;for(;e&&!e.textProvider;)e=e.parent;return e?e.textProvider:()=>"unknown"}getText(){return this.getTextProvider()(this.offset,this.length)}matches(e){return this.length===e.length&&this.getTextProvider()(this.offset,this.length)===e}startsWith(e){return this.length>=e.length&&this.getTextProvider()(this.offset,e.length)===e}endsWith(e){return this.length>=e.length&&this.getTextProvider()(this.end-e.length,e.length)===e}accept(e){if(e(this)&&this.children)for(const t of this.children)t.accept(e)}acceptVisitor(e){this.accept(e.visitNode.bind(e))}adoptChild(e,t=-1){if(e.parent&&e.parent.children){const t=e.parent.children.indexOf(e);t>=0&&e.parent.children.splice(t,1)}e.parent=this;let n=this.children;return n||(n=this.children=[]),-1!==t?n.splice(t,0,e):n.push(e),e}attachTo(e,t=-1){return e&&e.adoptChild(this,t),this}collectIssues(e){this.issues&&e.push.apply(e,this.issues)}addIssue(e){this.issues||(this.issues=[]),this.issues.push(e)}hasIssue(e){return Array.isArray(this.issues)&&this.issues.some((t=>t.getRule()===e))}isErroneous(e=!1){return!!(this.issues&&this.issues.length>0)||e&&Array.isArray(this.children)&&this.children.some((e=>e.isErroneous(!0)))}setNode(e,t,n=-1){return!!t&&(t.attachTo(this,n),this[e]=t,!0)}addChild(e){return!!e&&(this.children||(this.children=[]),e.attachTo(this),this.updateOffsetAndLength(e),!0)}updateOffsetAndLength(e){(e.offset<this.offset||-1===this.offset)&&(this.offset=e.offset);const t=e.end;(t>this.end||-1===this.length)&&(this.length=t-this.offset)}hasChildren(){return!!this.children&&this.children.length>0}getChildren(){return this.children?this.children.slice(0):[]}getChild(e){return this.children&&e<this.children.length?this.children[e]:null}addChildren(e){for(const t of e)this.addChild(t)}findFirstChildBeforeOffset(e){if(this.children){let t=null;for(let n=this.children.length-1;n>=0;n--)if(t=this.children[n],t.offset<=e)return t}return null}findChildAtOffset(e,t){const n=this.findFirstChildBeforeOffset(e);return n&&n.end>=e?t&&n.findChildAtOffset(e,!0)||n:null}encloses(e){return this.offset<=e.offset&&this.offset+this.length>=e.offset+e.length}getParent(){let e=this.parent;for(;e instanceof a;)e=e.parent;return e}findParent(e){let t=this;for(;t&&t.type!==e;)t=t.parent;return t}findAParent(...e){let t=this;for(;t&&!e.some((e=>t.type===e));)t=t.parent;return t}setData(e,t){this.options||(this.options={}),this.options[e]=t}getData(e){return this.options&&this.options.hasOwnProperty(e)?this.options[e]:null}}t.Node=s;class a extends s{constructor(e,t=-1){super(-1,-1),this.attachTo(e,t),this.offset=-1,this.length=-1}}t.Nodelist=a;t.Identifier=class extends s{referenceTypes;isCustomProperty=!1;constructor(e,t){super(e,t)}get type(){return n.Identifier}containsInterpolation(){return this.hasChildren()}};t.Stylesheet=class extends s{constructor(e,t){super(e,t)}get type(){return n.Stylesheet}};class o extends s{constructor(e,t){super(e,t)}get type(){return n.Declarations}}t.Declarations=o;class l extends s{declarations;constructor(e,t){super(e,t)}getDeclarations(){return this.declarations}setDeclarations(e){return this.setNode("declarations",e)}}t.BodyDeclaration=l;t.RuleSet=class extends l{selectors;constructor(e,t){super(e,t)}get type(){return n.Ruleset}getSelectors(){return this.selectors||(this.selectors=new a(this)),this.selectors}isNested(){return!!this.parent&&null!==this.parent.findParent(n.Declarations)}};t.Selector=class extends s{constructor(e,t){super(e,t)}get type(){return n.Selector}};t.SimpleSelector=class extends s{constructor(e,t){super(e,t)}get type(){return n.SimpleSelector}};t.AtApplyRule=class extends s{identifier;constructor(e,t){super(e,t)}get type(){return n.AtApplyRule}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}};class c extends s{colonPosition;semicolonPosition;constructor(e,t){super(e,t)}}t.AbstractDeclaration=c;t.CustomPropertySet=class extends l{constructor(e,t){super(e,t)}get type(){return n.CustomPropertySet}};class u extends c{property=null;value;nestedProperties;constructor(e,t){super(e,t)}get type(){return n.Declaration}setProperty(e){return this.setNode("property",e)}getProperty(){return this.property}getFullPropertyName(){const e=this.property?this.property.getName():"unknown";if(this.parent instanceof o&&this.parent.getParent()instanceof _){const t=this.parent.getParent().getParent();if(t instanceof u)return t.getFullPropertyName()+e}return e}getNonPrefixedPropertyName(){const e=this.getFullPropertyName();if(e&&"-"===e.charAt(0)){const t=e.indexOf("-",1);if(-1!==t)return e.substring(t+1)}return e}setValue(e){return this.setNode("value",e)}getValue(){return this.value}setNestedProperties(e){return this.setNode("nestedProperties",e)}getNestedProperties(){return this.nestedProperties}}t.Declaration=u;t.CustomPropertyDeclaration=class extends u{propertySet;constructor(e,t){super(e,t)}get type(){return n.CustomPropertyDeclaration}setPropertySet(e){return this.setNode("propertySet",e)}getPropertySet(){return this.propertySet}};t.Property=class extends s{identifier;constructor(e,t){super(e,t)}get type(){return n.Property}setIdentifier(e){return this.setNode("identifier",e)}getIdentifier(){return this.identifier}getName(){return this.trim(this.getText(),/[_\+]+$/)}isCustomProperty(){return!!this.identifier&&this.identifier.isCustomProperty}trim(e,t){const n=t.exec(e);return n&&n[0].length?e.substr(0,e.length-n[0].length):e}};class p extends s{arguments;constructor(e,t){super(e,t)}get type(){return n.Invocation}getArguments(){return this.arguments||(this.arguments=new a(this)),this.arguments}}t.Invocation=p;t.Function=class extends p{identifier;constructor(e,t){super(e,t)}get type(){return n.Function}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}};t.FunctionParameter=class extends s{identifier;defaultValue;constructor(e,t){super(e,t)}get type(){return n.FunctionParameter}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}setDefaultValue(e){return this.setNode("defaultValue",e,0)}getDefaultValue(){return this.defaultValue}};t.FunctionArgument=class extends s{identifier;value;constructor(e,t){super(e,t)}get type(){return n.FunctionArgument}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}setValue(e){return this.setNode("value",e,0)}getValue(){return this.value}};t.IfStatement=class extends l{expression;elseClause;constructor(e,t){super(e,t)}get type(){return n.If}setExpression(e){return this.setNode("expression",e,0)}setElseClause(e){return this.setNode("elseClause",e)}};t.ForStatement=class extends l{variable;constructor(e,t){super(e,t)}get type(){return n.For}setVariable(e){return this.setNode("variable",e,0)}};t.EachStatement=class extends l{variables;constructor(e,t){super(e,t)}get type(){return n.Each}getVariables(){return this.variables||(this.variables=new a(this)),this.variables}};t.WhileStatement=class extends l{constructor(e,t){super(e,t)}get type(){return n.While}};t.ElseStatement=class extends l{constructor(e,t){super(e,t)}get type(){return n.Else}};t.FunctionDeclaration=class extends l{identifier;parameters;constructor(e,t){super(e,t)}get type(){return n.FunctionDeclaration}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}};t.ViewPort=class extends l{constructor(e,t){super(e,t)}get type(){return n.ViewPort}};t.FontFace=class extends l{constructor(e,t){super(e,t)}get type(){return n.FontFace}};class _ extends l{constructor(e,t){super(e,t)}get type(){return n.NestedProperties}}t.NestedProperties=_;t.Keyframe=class extends l{keyword;identifier;constructor(e,t){super(e,t)}get type(){return n.Keyframe}setKeyword(e){return this.setNode("keyword",e,0)}getKeyword(){return this.keyword}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}};t.KeyframeSelector=class extends l{constructor(e,t){super(e,t)}get type(){return n.KeyframeSelector}};t.Import=class extends s{constructor(e,t){super(e,t)}get type(){return n.Import}setMedialist(e){return!!e&&(e.attachTo(this),!0)}};t.Use=class extends s{identifier;parameters;get type(){return n.Use}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}};t.ModuleConfiguration=class extends s{identifier;value;get type(){return n.ModuleConfiguration}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}setValue(e){return this.setNode("value",e,0)}getValue(){return this.value}};t.Forward=class extends s{identifier;members;parameters;get type(){return n.Forward}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getMembers(){return this.members||(this.members=new a(this)),this.members}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}};t.ForwardVisibility=class extends s{identifier;get type(){return n.ForwardVisibility}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}};t.Namespace=class extends s{constructor(e,t){super(e,t)}get type(){return n.Namespace}};t.Media=class extends l{constructor(e,t){super(e,t)}get type(){return n.Media}};t.Supports=class extends l{constructor(e,t){super(e,t)}get type(){return n.Supports}};t.Document=class extends l{constructor(e,t){super(e,t)}get type(){return n.Document}};t.Medialist=class extends s{mediums;constructor(e,t){super(e,t)}getMediums(){return this.mediums||(this.mediums=new a(this)),this.mediums}};t.MediaQuery=class extends s{constructor(e,t){super(e,t)}get type(){return n.MediaQuery}};t.MediaCondition=class extends s{constructor(e,t){super(e,t)}get type(){return n.MediaCondition}};t.MediaFeature=class extends s{constructor(e,t){super(e,t)}get type(){return n.MediaFeature}};t.SupportsCondition=class extends s{lParent;rParent;constructor(e,t){super(e,t)}get type(){return n.SupportsCondition}};t.Page=class extends l{constructor(e,t){super(e,t)}get type(){return n.Page}};t.PageBoxMarginBox=class extends l{constructor(e,t){super(e,t)}get type(){return n.PageBoxMarginBox}};t.Expression=class extends s{constructor(e,t){super(e,t)}get type(){return n.Expression}};t.BinaryExpression=class extends s{left;right;operator;constructor(e,t){super(e,t)}get type(){return n.BinaryExpression}setLeft(e){return this.setNode("left",e)}getLeft(){return this.left}setRight(e){return this.setNode("right",e)}getRight(){return this.right}setOperator(e){return this.setNode("operator",e)}getOperator(){return this.operator}};t.Term=class extends s{operator;expression;constructor(e,t){super(e,t)}get type(){return n.Term}setOperator(e){return this.setNode("operator",e)}getOperator(){return this.operator}setExpression(e){return this.setNode("expression",e)}getExpression(){return this.expression}};t.AttributeSelector=class extends s{namespacePrefix;identifier;operator;value;constructor(e,t){super(e,t)}get type(){return n.AttributeSelector}setNamespacePrefix(e){return this.setNode("namespacePrefix",e)}getNamespacePrefix(){return this.namespacePrefix}setIdentifier(e){return this.setNode("identifier",e)}getIdentifier(){return this.identifier}setOperator(e){return this.setNode("operator",e)}getOperator(){return this.operator}setValue(e){return this.setNode("value",e)}getValue(){return this.value}};t.Operator=class extends s{constructor(e,t){super(e,t)}get type(){return n.Operator}};t.HexColorValue=class extends s{constructor(e,t){super(e,t)}get type(){return n.HexColorValue}};t.RatioValue=class extends s{constructor(e,t){super(e,t)}get type(){return n.RatioValue}};const d=".".charCodeAt(0),h="0".charCodeAt(0),f="9".charCodeAt(0);t.NumericValue=class extends s{constructor(e,t){super(e,t)}get type(){return n.NumericValue}getValue(){const e=this.getText();let t,n=0;for(let r=0,i=e.length;r<i&&(t=e.charCodeAt(r),h<=t&&t<=f||t===d);r++)n+=1;return{value:e.substring(0,n),unit:n<e.length?e.substring(n):void 0}}};t.VariableDeclaration=class extends c{variable=null;value=null;needsSemicolon=!0;constructor(e,t){super(e,t)}get type(){return n.VariableDeclaration}setVariable(e){return!!e&&(e.attachTo(this),this.variable=e,!0)}getVariable(){return this.variable}getName(){return this.variable?this.variable.getName():""}setValue(e){return!!e&&(e.attachTo(this),this.value=e,!0)}getValue(){return this.value}};t.Interpolation=class extends s{constructor(e,t){super(e,t)}get type(){return n.Interpolation}};t.Variable=class extends s{module;constructor(e,t){super(e,t)}get type(){return n.VariableName}getName(){return this.getText()}};t.ExtendsReference=class extends s{selectors;constructor(e,t){super(e,t)}get type(){return n.ExtendsReference}getSelectors(){return this.selectors||(this.selectors=new a(this)),this.selectors}};t.MixinContentReference=class extends s{arguments;constructor(e,t){super(e,t)}get type(){return n.MixinContentReference}getArguments(){return this.arguments||(this.arguments=new a(this)),this.arguments}};t.MixinContentDeclaration=class extends l{parameters;constructor(e,t){super(e,t)}get type(){return n.MixinContentReference}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}};t.MixinReference=class extends s{namespaces;identifier;arguments;content;constructor(e,t){super(e,t)}get type(){return n.MixinReference}getNamespaces(){return this.namespaces||(this.namespaces=new a(this)),this.namespaces}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}getArguments(){return this.arguments||(this.arguments=new a(this)),this.arguments}setContent(e){return this.setNode("content",e)}getContent(){return this.content}};t.MixinDeclaration=class extends l{identifier;parameters;constructor(e,t){super(e,t)}get type(){return n.MixinDeclaration}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}getName(){return this.identifier?this.identifier.getText():""}getParameters(){return this.parameters||(this.parameters=new a(this)),this.parameters}setGuard(e){return e&&e.attachTo(this),!1}};t.UnknownAtRule=class extends l{atRuleName;constructor(e,t){super(e,t)}get type(){return n.UnknownAtRule}setAtRuleName(e){this.atRuleName=e}getAtRuleName(){return this.atRuleName}};t.ListEntry=class extends s{key;value;get type(){return n.ListEntry}setKey(e){return this.setNode("key",e,0)}setValue(e){return this.setNode("value",e,1)}};t.LessGuard=class extends s{isNegated;conditions;getConditions(){return this.conditions||(this.conditions=new a(this)),this.conditions}};t.GuardCondition=class extends s{variable;isEquals;isGreater;isEqualsGreater;isLess;isEqualsLess;setVariable(e){return this.setNode("variable",e)}};var m;t.Module=class extends s{identifier;get type(){return n.Module}setIdentifier(e){return this.setNode("identifier",e,0)}getIdentifier(){return this.identifier}},function(e){e[e.Ignore=1]="Ignore",e[e.Warning=2]="Warning",e[e.Error=4]="Error"}(m||(t.Level=m={}));t.Marker=class{node;rule;level;message;offset;length;constructor(e,t,n,r,i=e.offset,s=e.length){this.node=e,this.rule=t,this.level=n,this.message=r||t.message,this.offset=i,this.length=s}getRule(){return this.rule}getLevel(){return this.level}getOffset(){return this.offset}getLength(){return this.length}getNode(){return this.node}getMessage(){return this.message}};class g{static entries(e){const t=new g;return e.acceptVisitor(t),t.entries}entries;constructor(){this.entries=[]}visitNode(e){return e.isErroneous()&&e.collectIssues(this.entries),!0}}t.ParseErrorCollector=g},54145:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusTsFile=void 0;const r=n(19408),i=n(1539),s=n(67246),a=n(10604);class o extends s.AventusBaseFile{get tsLanguageService(){return this.build.tsLanguageService}_compileResult=[];get compileResult(){return this._compileResult}diagnostics=[];getDiagnostics(){return[...this.diagnostics]}get version(){return this.file.versionUser}fileParsed=null;get contentForLanguageService(){return this._contentForLanguageService}_contentForLanguageService="";buildNamespace="";constructor(e,t){super(e,t),this.buildNamespace=this.build.getNamespace(e.uri),this.mustBeAddedToLanguageService()&&this.tsLanguageService.addFile(this)}refreshFileParsed(e=!1){this.fileParsed=a.ParserTs.parse(this.file,e,this.build),this._contentForLanguageService=this.file.documentInternal.getText(),e||this.replaceNamespace()}replaceNamespace(){if(this.fileParsed)for(let e of this.fileParsed.namespaces){let t=e.bodyStart-e.start,n="";for(let e=0;e<t;e++)n+=" ";let r=this._contentForLanguageService.substring(0,e.start),i=this._contentForLanguageService.substring(e.bodyStart,this._contentForLanguageService.length);this._contentForLanguageService=r+n+i,t=e.end-e.bodyEnd,n="";for(let e=0;e<t;e++)n+=" ";r=this._contentForLanguageService.substring(0,e.bodyEnd),i=this._contentForLanguageService.substring(e.end,this._contentForLanguageService.length),this._contentForLanguageService=r+n+i}}validateRules(e){const t=this.fileParsed;if(t){if(!e.allow_function)for(let e in t.functions){let n=t.functions[e];this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Function can only be used inside lib.avt file",n.nameStart,n.nameEnd,r.AventusErrorCode.FunctionNotAllowed))}if(!e.allow_variables)for(let e in t.variables){let n=t.variables[e];this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Variables can only be used inside lib.avt file",n.nameStart,n.nameEnd,r.AventusErrorCode.VariableNotAllowed))}if(e.class_extend||e.class_implement||e.interface||e.customClassRules){e.class_extend||(e.class_extend=[]),e.class_implement||(e.class_implement=[]),e.interface||(e.interface=[]),e.customClassRules||(e.customClassRules=[]);for(let n in t.classes){let s=t.classes[n];for(let t of e.customClassRules)t(s);if(s.isInterface){let t=0==e.interface.length;for(let n of s.extends)if(-1!=e.interface.indexOf(n)){t=!0;break}t||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Interface "+s.name+" must extend "+e.interface.join(" or "),s.nameStart,s.nameEnd,r.AventusErrorCode.MissingExtension))}else{let t=0==e.class_extend.length,n=0==e.class_implement.length;for(let t of s.implements)if(-1!=e.class_implement.indexOf(t)){n=!0;break}for(let n of s.extends)if(-1!=e.class_extend.indexOf(n)){t=!0;break}n||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Class "+s.name+" must implement "+e.class_implement.join(" or "),s.nameStart,s.nameEnd,r.AventusErrorCode.MissingImplementation)),t||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentInternal,"Class "+s.name+" must extend "+e.class_extend.join(" or "),s.nameStart,s.nameEnd,r.AventusErrorCode.MissingExtension))}}}e.enum,e.alias}}async onDelete(){this.mustBeAddedToLanguageService()&&this.tsLanguageService.removeFile(this),this.build.npmBuilder.unregister(this.file.uri)}oldFullSrc=[];oldFullDocVisible="";oldFullDocInvisible="";oldFullClassScript="";setCompileResult(e){let t=!1,n="",r=[],i="",s="",a="";for(let t of e)n+=t.compiled,""!=t.classScript&&r.push({name:t.classScript,src:t.compiled}),i+=t.docVisible,s+=t.docInvisible,a+=t.classScript+"#";let o="";for(let e of this.oldFullSrc)o+=e.src;(e.length!=this.compileResult.length||this.oldFullClassScript!=a||o!=n||this.oldFullDocVisible!=i||this.oldFullDocInvisible!=s)&&(t=!0);let l=this.oldFullSrc;t&&(this.oldFullDocInvisible=s,this.oldFullDocVisible=i,this.oldFullSrc=r,this.oldFullClassScript=a),this._compileResult=e,t&&(this.emitToHtttpServer(l),this.build.build())}mustBeAddedToLanguageService(){return!0}emitToHtttpServer(e){this.build.reloadPage=!0}onGetBuild(){return[this.build]}}t.AventusTsFile=o},56941:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusTsFileSelector=function(e,t){let n=null;e.uri.endsWith(r.AventusExtension.ComponentLogic)?n=new i.AventusWebComponentLogicalFile(e,t):e.uri.endsWith(r.AventusExtension.Data)?n=new s.AventusDataFile(e,t):e.uri.endsWith(r.AventusExtension.Lib)?n=new o.AventusLibFile(e,t):e.uri.endsWith(r.AventusExtension.RAM)?n=new l.AventusRamFile(e,t):e.uri.endsWith(r.AventusExtension.State)?n=new c.AventusStateFile(e,t):e.uri.endsWith(r.AventusExtension.Static)?n=new u.AventusStaticFile(e,t):e.uri.endsWith(r.AventusExtension.Definition)&&(n=new a.AventusDefinitionFile(e,t));return n};const r=n(19408),i=n(16286),s=n(36353),a=n(20973),o=n(2054),l=n(7304),c=n(98060),u=n(76578)},37439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusTsLanguageService=void 0,t.simplifyPath=N,t.getSectionStart=R;const r=n(22037),i=n(71017),s=n(94625),a=n(42374),o=n(19408),l=n(1539),c=n(12842),u=n(90946),p=n(65887),_=n(50789),d=n(48117),h=n(76248),f=n(71159),m=n(10604),g=n(57147),y=n(83693),v=n(89403),$=n(92724),b=n(25779),S=n(60206),x=n(2044),w=n(18952),C=n(29495);class E{languageService;languageServiceNamespace;build;filesNeeded=[];filesNpm=[];filesNpmLoaded=!1;filesLoaded={};constructor(e){this.build=e,(0,c.loadTypescriptLib)(),this.onSettingsChanged(e),C.SettingsManager.getInstance().onSettingsChange((()=>{this.onSettingsChanged(e)})),this.languageService=(0,s.createLanguageService)(this.createHost()),this.languageServiceNamespace=(0,s.createLanguageService)(this.createHostNamespace())}onSettingsChanged(e){const t=C.SettingsManager.getInstance().settings.readNodeModules;t!=this.filesNpmLoaded&&(this.filesNpm=t?(0,c.loadNodeModules)((0,i.join)(e.project.getConfigFile().folderPath,"node_modules")):[],this.filesNpmLoaded=t)}createHostNamespace(){const e=this;return{getCompilationSettings:()=>k,getScriptFileNames:()=>[...this.filesNeeded,...this.filesNpm],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>this.filesLoaded[e]?String(this.filesLoaded[e].file.versionUser+1):"1",getScriptSnapshot:e=>{let t="";if(t=this.filesLoaded[e]?this.filesLoaded[e].file.contentInternal:(0,c.loadLibrary)(e),void 0!==t)return{getText:(e,n)=>t?.substring(e,n)||"",getLength:()=>t?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"es2022.full",readFile:(e,t)=>this.filesLoaded[e]?this.filesLoaded[e].file.contentInternal:(0,c.loadLibrary)(e),fileExists:e=>(e.endsWith(o.AventusExtension.Base+".ts")&&(e=e.replace(o.AventusExtension.Base+".ts",o.AventusExtension.Base)),!!this.filesLoaded[e]||!!(0,c.loadLibrary)(e)),directoryExists:e=>(0,g.existsSync)((0,l.uriToPath)(e)),resolveModuleNames(t,n,r,i,s,a){return e.resolveModuleNames(this,t,n,r,i,s,a)}}}createHost(){const e=this;return{getCompilationSettings:()=>k,getScriptFileNames:()=>[...this.filesNeeded,...this.filesNpm],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>this.filesLoaded[e]?String(this.filesLoaded[e].version+1):"1",getScriptSnapshot:e=>{let t="";if(t=this.filesLoaded[e]?this.filesLoaded[e].contentForLanguageService:(0,c.loadLibrary)(e),void 0!==t)return{getText:(e,n)=>t?.substring(e,n)||"",getLength:()=>t?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"es2022.full",readFile:(e,t)=>{let n;return n=this.filesLoaded[e]?this.filesLoaded[e].contentForLanguageService:(0,c.loadLibrary)(e),n},fileExists:e=>{let t=!1;return e.endsWith(o.AventusExtension.Base+".ts")&&(e=e.replace(o.AventusExtension.Base+".ts",o.AventusExtension.Base)),t=!!this.filesLoaded[e]||!!(0,c.loadLibrary)(e),t},directoryExists:e=>(0,g.existsSync)((0,l.uriToPath)(e)),resolveModuleNames(t,n,r,i,s,a){return e.resolveModuleNames(this,t,n,r,i,s,a)}}}resolveModuleNames(e,t,n,r,i,a,l){const c=[];for(let r of t){if(!r.startsWith(".")&&r.endsWith(o.AventusExtension.Package)){let e={extension:s.Extension.Ts,resolvedFileName:"file:///"+r};c.push(e);continue}let t=y.FilesManager.getInstance().getByUri(n);t&&(r=this.build.project.resolveAlias(r,t));let i=(0,s.resolveModuleName)(r,n,k,e);if(i.resolvedModule)i.resolvedModule.resolvedFileName.endsWith(".avt.ts")&&(i.resolvedModule.resolvedFileName=i.resolvedModule.resolvedFileName.replace(".avt.ts",".avt")),c.push(i.resolvedModule);else{let e={extension:s.Extension.Ts,resolvedFileName:r};c.push(e)}}return c}addFile(e){-1==this.filesNeeded.indexOf(e.file.uri)&&(this.filesNeeded.push(e.file.uri),this.filesLoaded[e.file.uri]=e)}removeFile(e){let t=this.filesNeeded.indexOf(e.file.uri);-1!=t&&(this.filesNeeded.splice(t,1),delete this.filesLoaded[e.file.uri])}doValidation(e){try{const t=[1206,1249,2612];let n=[];const r=this.languageService.getSyntacticDiagnostics(e.uri),i=this.languageService.getSemanticDiagnostics(e.uri),c=r.concat(i);for(let r of c){if(t.includes(r.code))continue;let i=`${(0,s.flattenDiagnosticMessageText)(r.messageText,"\n")}`;r.reportsUnnecessary?n.push({range:(0,l.convertRange)(e.documentInternal,r),severity:a.DiagnosticSeverity.Hint,source:o.AventusLanguageId.TypeScript,message:i,tags:[a.DiagnosticTag.Unnecessary]}):n.push({range:(0,l.convertRange)(e.documentInternal,r),severity:a.DiagnosticSeverity.Error,source:o.AventusLanguageId.TypeScript,message:i})}return n}catch(e){this.printCatchError(e)}return[]}async doComplete(e,t){try{let n,r=e.documentInternal,i=r.offsetAt(t),s=(0,l.convertRange)(r,(0,l.getWordAtText)(r.getText(),i));try{n=this.languageService.getCompletionsAtPosition(r.uri,i,T)}catch(e){this.printCatchError(e)}if(!n)return{isIncomplete:!1,items:[]};let c=[];for(let e=0;e<n.entries.length;e++){let t,l=n.entries[e],u=l.insertText?l.insertText:l.name;if(u=u.replace(/\.\?\./g,"?."),u.startsWith("?")){let e=r.offsetAt(s.start)-1;"."==r.getText()[e]&&(t=[{newText:"",range:{start:{line:s.start.line,character:s.start.character-1},end:{line:s.start.line,character:s.start.character}}}])}let p={languageId:o.AventusLanguageId.TypeScript,offset:i,uri:r.uri},_={label:l.name,sortText:l.sortText,kind:F(l.kind),textEdit:a.TextEdit.replace(s,u),additionalTextEdits:t,data:{...l.data,...p}};c.push(_)}return{isIncomplete:!1,items:c}}catch(e){this.printCatchError(e)}return{isIncomplete:!1,items:[]}}async doResolve(e){try{if(e.data){let t=this.build.tsFiles[e.data.uri];if(null!=t){let n={languageId:e.data.languageIdJs,offset:e.data.offset,uri:e.data.uri};delete e.data.languageId,delete e.data.offset,delete e.data.uri,0==Object.keys(e.data).length&&(e.data=void 0);let r=this.languageService.getCompletionEntryDetails(n.uri,n.offset,e.label,{},t.file.contentInternal,T,e.data);if(r){if(e.detail=(0,s.displayPartsToString)(r.displayParts),e.documentation=(0,s.displayPartsToString)(r.documentation),e.additionalTextEdits=[],r.codeActions)for(let n=0;n<r.codeActions.length;n++)for(let i of r.codeActions[n].changes)for(let n of i.textChanges){n.newText=(0,l.normalizePath)(n.newText.replace(/'/g,'"'));let r=/"(.*)"/g.exec(n.newText);if(r&&r.length>1)if(r[0].includes(o.AventusExtension.Package)){let e=r[1];e=this.filesNeeded.find((t=>t.toLowerCase()==e))??e,e=e.replace("file:///",""),n.newText=n.newText.replace(r[1],e)}else if(r[1].startsWith(".")){let i=N(r[1],t.file.uri);e.detail+="\r\nimport from "+i,n.newText=n.newText.replace(r[1],i)}e.additionalTextEdits.push({newText:n.newText,range:(0,l.convertRange)(t.file.documentInternal,n.span)})}delete e.data}}}}catch(e){this.printCatchError(e)}return e}async doHover(e,t){try{let n=this.languageService.getQuickInfoAtPosition(e.uri,e.documentInternal.offsetAt(t));if(n){let t=[],r=[];if(n.documentation)for(let e of n.documentation)t.push(`${e.text.trim()}`),r.push(e.text.trim());if(n.tags){r.push(" ");for(let e of n.tags){if("inheritdoc"===e.name)continue;let n=!0;const i=[];if(e.text)for(let t of e.text){if("text"==t.kind&&t.text==r.join("")){n=!1;break}i.push(t.text)}if(!n)continue;let s=i.join("").trim();"example"===e.name?t.push(`\`@${e.name}\`\n\`\`\`typescript\n${s}\n\`\`\``):t.push(`\`@${e.name}\` ${s}`)}}let i="";return n.displayParts&&(i+="\n```typescript\n",i+=(0,s.displayPartsToString)(n.displayParts).trim(),i+="\n```\n***\n"),i+=t.join("\n\n"),{range:(0,l.convertRange)(e.documentInternal,n.textSpan),contents:{kind:"markdown",value:i}}}}catch(e){this.printCatchError(e)}return null}getType(e,t){try{let n=this.languageService.getProgram();if(!n)return;let r=n.getSourceFile(e.file.uri);if(!r)return;let i=n.getTypeChecker(),a=(0,s.getTokenAtPosition)(r,t),o=i.getTypeAtLocation(a),l=i.typeToString(o,a,s.TypeFormatFlags.UseFullyQualifiedType);if(l.includes("."))return l;if(e.fileParsed)for(let t in e.fileParsed.importsLocal){if(t==l)return l;let n=e.fileParsed.importsLocal[t];if(void 0===n.realName){let e=(0,s.getTokenAtPosition)(r,(n.nameEnd+n.nameStart)/2),t=i.getTypeAtLocation(e);n.realName=i.typeToString(t)}if(l==n.realName)return t}return l}catch(e){this.printCatchError(e)}}async findDefinition(e,t){try{let n=this.languageService.getDefinitionAtPosition(e.uri,e.documentInternal.offsetAt(t));if(n&&n.length>0){let e=n[0];e.fileName.endsWith(".avt.ts")&&(e.fileName=e.fileName.replace(".avt.ts",".avt"));let t=this.filesLoaded[e.fileName];if(t instanceof x.AventusPackageNamespaceFileTs)return t.goToDefinition((0,l.convertRange)(t.file.documentInternal,e.textSpan));if(t)return{uri:t.file.uri,range:(0,l.convertRange)(t.file.documentInternal,e.textSpan)};{let t=(0,c.loadLibrary)(e.fileName);if(t){const n=w.TextDocument.create(e.fileName,"typescript",1,t);return{uri:e.fileName,range:(0,l.convertRange)(n,e.textSpan)}}}}}catch(e){this.printCatchError(e)}return null}async format(e,t,n,r=!0){try{let o=e.documentInternal,c=o.offsetAt(t.start),u=o.offsetAt(t.end),p=null;t.end.line>t.start.line&&(0===t.end.character||(i=o.getText().substr(u-t.end.character,t.end.character),/^\s*$/.test(i)))&&(u-=t.end.character,p=a.Range.create(a.Position.create(t.end.line,0),t.end));let _={...I};_.semicolons=r?s.SemicolonPreference.Insert:s.SemicolonPreference.Remove;let d=this.languageServiceNamespace.getFormattingEditsForRange(o.uri,c,u,_);if(d){let e=[];for(let t of d)t.span.start>=c&&t.span.start+t.span.length<=u&&e.push({range:(0,l.convertRange)(o,t.span),newText:t.newText});return p&&e.push({range:p,newText:M(0,n)}),e}}catch(e){this.printCatchError(e)}var i;return[]}async doCodeAction(e,t){let n=[];try{let r=m.ParserTs.parse(e,!1,this.build),i=e.documentInternal;const s=this.languageService.getSyntacticDiagnostics(i.uri),a=this.languageService.getSemanticDiagnostics(i.uri);let o=[];for(let e of s)o.push(e.code);for(let e of a)6133!=e.code&&o.push(e.code);let c=[];try{c=this.languageService.getCodeFixesAtPosition(i.uri,i.offsetAt(t.start),i.offsetAt(t.end),o,I,T)}catch(e){}for(let t of c){let s=[],a={changes:{[i.uri]:s}};for(let n of t.changes)for(let a of n.textChanges){if(t.description.startsWith("Add import from")){a.newText=a.newText.replace(/'/g,'"');let e=/"(.*)"/g.exec(a.newText);if(e&&e.length>1){let n=N(e[1],i.uri);t.description="Add import from "+n,a.newText=a.newText.replace(e[1],n)}}else if("fixClassDoesntImplementInheritedAbstractMember"===t.fixName){let t=!1;for(let e in r.classes){let n=r.classes[e];a.span.start>=n.start&&a.span.start<=n.end&&(t=!0)}if(t){let t=R(e,"methods");-1!=t&&(a.span.start=t),a.newText.match(/ (public|protected) /g)||(a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1public $2")),a.newText.match(/(public|protected)[ ]*?override/g)||(a.newText=a.newText.replace(/((public|protected)[ ]*?)([a-z])/g,"$1override $3")),a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1/**$1 * @inheritdoc$1 */$1$2")}else if(a.newText.startsWith("import ")){a.newText=a.newText.replace(/'/g,'"');let e=/"(.*)"/g.exec(a.newText);if(e&&e.length>1){let t=N(e[1],i.uri);a.newText=a.newText.replace(e[1],t)}}}else if("fixClassIncorrectlyImplementsInterface"==t.fixName){let t=!1;for(let e in r.classes){let n=r.classes[e];a.span.start>=n.start&&a.span.start<=n.end&&(t=!0)}if(t){let t=R(e,"methods");-1!=t&&(a.span.start=t),a.newText.includes(" protected ")||a.newText.includes(" public ")||(a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1public $2")),a.newText=a.newText.replace(/^([\s|\S]*?)([a-z])/g,"$1/**$1 * @inheritdoc$1 */$1$2")}else if(a.newText.startsWith("import ")){a.newText=a.newText.replace(/'/g,'"');let e=/"(.*)"/g.exec(a.newText);if(e&&e.length>1){let t=N(e[1],i.uri);a.newText=a.newText.replace(e[1],t)}}}s.push({newText:a.newText,range:(0,l.convertRange)(i,a.span)})}n.push({title:t.description,edit:a})}}catch(e){this.printCatchError(e)}return n}async onReferences(e,t){let n=[];try{let r=e.documentInternal.offsetAt(t),i=this.languageService.findReferences(e.uri,r);if(i)for(let e of i)for(let t of e.references)if(this.filesLoaded[t.fileName]){let e=this.filesLoaded[t.fileName].file.documentInternal.positionAt(t.textSpan.start),r=this.filesLoaded[t.fileName].file.documentInternal.positionAt(t.textSpan.start+t.textSpan.length);n.push(a.Location.create(t.fileName,{start:e,end:r}))}}catch(e){this.printCatchError(e)}return n}async onCodeLens(e){let t=[];try{let n=this.filesLoaded[e.uri];if(n&&n.fileParsed){let r=async n=>{for(let r of n){let n=e.documentInternal.positionAt(r.start),i=await this.onReferences(e,n),s=i.length>1?i.length+" references":i.length+" reference";t.push({range:{start:n,end:n},command:{title:s,command:i.length?"editor.action.showReferences":"",arguments:[e.uri,n,i]}})}};await r(Object.values(n.fileParsed.classes)),await r(Object.values(n.fileParsed.enums)),await r(Object.values(n.fileParsed.aliases))}let r=R(e,"props");if(-1!=r){let n=e.documentInternal.positionAt(r);t.push({range:{start:n,end:n},command:{title:"Add property | attribute",command:"editor.action.showReferences",arguments:[e.uri]}})}}catch(e){this.printCatchError(e)}return t}async onRename(e,t,n){this.languageService.getFileReferences(e.uri);let r=e.documentInternal.offsetAt(t),i={};if(!this.languageService.getRenameInfo(e.uri,r,i).canRename)return null;let s=this.languageService.findRenameLocations(e.uri,r,!1,!1,i);if(!s)return null;let a={changes:{}};if(a.changes)for(let e of s){if(this.filesLoaded[e.fileName]){a.changes[e.fileName]||(a.changes[e.fileName]=[]);let t={newText:n,range:{start:this.filesLoaded[e.fileName].file.documentInternal.positionAt(e.textSpan.start),end:this.filesLoaded[e.fileName].file.documentInternal.positionAt(e.textSpan.start+e.textSpan.length)}};a.changes[e.fileName].push(t)}}return a}async onRenameFile(e,t){let n={},r=this.languageService.getFileReferences(e);for(let e of r){let r=y.FilesManager.getInstance().getByUri(e.fileName);if(r){let i=[],s=r.folderUri.split("/"),a=t.split("/");for(;s.length>0&&a.length>0&&s[0]==a[0];)s.splice(0,1),a.splice(0,1);let o=[];if(s.length>0)for(let e=0;e<s.length;e++)o.push("..");else o.push(".");for(let e of a)o.push(e);i.push({newText:o.join("/"),range:{start:r.documentInternal.positionAt(e.textSpan.start),end:r.documentInternal.positionAt(e.textSpan.start+e.textSpan.length)}}),n[r.uri]=i}}return n}static removeComments(e){return e=e.replace(/(\".*?\"|\'.*?\')|(\/\*.*?\*\/|\/\/[^(\r\n|\n)]*$)/gm,((e,t,n)=>n?"":t))}static replaceFirstExport(e){return e.replace(/^\s*export\s+(class|interface|enum|type|abstract|function)/m,"$1")}static prepareDataSchema(e,t,n){let r={};const i=r=>{if("boolean"==r.kind)return"boolean";if("number"==r.kind)return"number";if("string"==r.kind)return"string";if("type"==r.kind){if(r.value.includes("."))return r.value;{let i=e.parserInfo.importsLocal[r.value]?.info;if(i){return n?i.name:t+"."+i.fullName}return r.value}}return"literal"==r.kind||"typeLiteral"==r.kind?"literal":null};for(let s in e.properties){let a=e.properties[s];if(a.isStatic)continue;let o=!1;for(let i of a.decorators){let a=f.ForeignKeyDecorator.is(i);if(a){o=!0;let i=e.parserInfo.importsLocal[a.refType]?.info;if(a.refType.includes("."))r[s]="ref:"+a.refType;else if(i){let e=n?i.name:t+"."+i.fullName;r[s]="ref:"+e}else r[s]="ref:"+a.refType}}if(!o){let e=i(a.type);e&&(r[s]=e)}}let s=JSON.stringify(r).replace(/\\"/g,'"');if(e.parentClass){s=`{...(${n?e.extendsNpm[0]:e.parentClass.fullName}?.$schema ?? {}), ${s.slice(1)}`}return s}static addBindThis(e,t){let n=[];for(let t in e.methods)for(let r of e.methods[t].decorators)$.BindThisDecorator.is(r)&&n.push(`this.${t}=this.${t}.bind(this)`);if(n.length>0){let i=e.constructorContent;if(i.length>0){let e=i;e=e.slice(0,e.length-1),e+=r.EOL+n.join(r.EOL),e+=" }",t=t.replace(i,e)}else{let i=Object.values(e.methods)[0].fullStart,s=t.slice(0,i)+r.EOL;s+="constructor() { super(); "+r.EOL+n.join(r.EOL)+" }",s+=t.slice(i),t=s}}return t}static compileTs(e,t){let n={compiled:"",hotReload:"",docVisible:"",docInvisible:"",dependances:e.dependances,classScript:"",classDoc:"",debugTxt:"",uri:t.file.uri,required:!1,type:e.infoType,isExported:{external:e.isExported,internal:e.isInternalExported},convertibleName:"",npm:{defTs:"",namespace:"",exportPath:"",uri:t.file.uri,src:""},story:{}};try{let i="",a="",o=e.compiledContent,l=e.compiledContentHotReload,c=t.build.module;if(e instanceof p.ClassInfo&&!e.isInterface){let t="";e.namespace&&(t="."+e.namespace),i+=e.fullName+".Namespace=`"+c+t+"`;"+r.EOL,a+=e.name+".Namespace=`"+c+t+"`;"+r.EOL,e.implements.includes("Aventus.IData")&&(n.type=u.InfoType.classData),e.convertibleName?(i+=e.fullName+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,a+=e.name+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,i+="Aventus.Converter.register("+e.fullName+"."+e.convertibleName+", "+e.fullName+");"+r.EOL,a+="Aventus.Converter.register("+e.fullName+"."+e.convertibleName+", "+e.fullName+");"+r.EOL):e.implements.includes("Aventus.IData")&&(i+=e.fullName+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,a+=e.name+".$schema="+this.prepareDataSchema(e,c)+";"+r.EOL,i+="Aventus.Converter.register("+e.fullName+".Fullname, "+e.fullName+");"+r.EOL,a+="Aventus.Converter.register("+e.fullName+".Fullname, "+e.fullName+");"+r.EOL),n.convertibleName=e.convertibleName,o=this.addBindThis(e,o)}else e instanceof v.VariableInfo&&(o=e.type+" "+e.compiledContent,l=e.type+" "+e.compiledContentHotReload);o=this.removeComments(o),o=this.replaceFirstExport(o);const f=(0,s.transpile)(o,A);n.compiled=f+i,S.HttpServer.isRunning&&(l=this.removeComments(l),l=this.replaceFirstExport(l),n.hotReload=(0,s.transpile)(l,A));let m=this.compileDocTs(o),g=h.DefinitionCorrector.correct(m,e),y=this.compileTsToNpm(e,t);if(y&&(n.npm=y),g.length>0){let t=e.namespace;t.length>0&&(m="namespace "+t+" {\r\n"+m+"}\r\n",g="namespace "+t+" {\r\n"+g+"}\r\n"),e.isExported?n.docVisible=g:n.docInvisible=g}const $=()=>{let i="",s=t.build.namespaces.includes(e.fullName);s&&(i+="_n = "+e.fullName+";"+r.EOL);let a=n.compiled;if(e instanceof v.VariableInfo)a=a.slice(a.indexOf("=")+1),a=e.fullName.includes(".")?e.fullName+"="+a:"let "+e.fullName+"="+a;else if(e instanceof b.EnumInfo){let t=`})(${e.name} || (${e.name} = {}))`,n=`})(${e.fullName} || (${e.fullName} = {}))`;if(a=a.replaceAll(t,n),e.fullName.includes(".")){let e=a.split("\n");e.splice(0,1),a=e.join("\n")}}else a=e.fullName+"="+n.compiled,e.fullName.includes(".")||(a=`let ${a}`);return e.isExported&&(a+="_."+e.fullName+"="+e.fullName+";",a+=r.EOL),i+=a,s&&(i+=r.EOL+"Object.assign("+e.fullName+", _n);"+r.EOL),i};let x=n.compiled;n.compiled.length>0&&(n.classScript=e.fullName,n.compiled=$()),(n.docVisible.length>0||n.docInvisible.length>0)&&(n.classDoc=e.fullName);for(let t of e.decorators){let e=_.DebuggerDecorator.is(t);e&&e.writeCompiled&&(n.debugTxt=x),d.RequiredDecorator.is(t)&&(n.required=!0)}}catch(e){this.printCatchError(e)}return n}static compileTsToNpm(e,t){try{if(!t.build.hasNpmOutput)return null;const n={defTs:"",namespace:"",exportPath:"",uri:t.file.uri,src:""};let i="",a=e.compiledContentNpm,l=t.build.module;if(e instanceof p.ClassInfo&&!e.isInterface){let n="";if(e.namespace&&(n="."+e.namespace),i+=e.name+".Namespace=`"+l+n+"`;"+r.EOL,e.convertibleName){i+=e.name+".$schema="+this.prepareDataSchema(e,l,!0)+";"+r.EOL;const n=t.build.getNpmReplacementName("","Aventus.Converter");i+=n+".register("+e.name+"."+e.convertibleName+", "+e.name+");"+r.EOL,t.fileParsed&&t.fileParsed.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"Converter",compiled:!0,alias:n,forced:!1})}else if(e.implements.includes("Aventus.IData")){i+=e.name+".$schema="+this.prepareDataSchema(e,l,!0)+";"+r.EOL;const n=t.build.getNpmReplacementName("","Aventus.Converter");i+=n+".register("+e.name+".Fullname, "+e.name+");"+r.EOL,t.fileParsed&&t.fileParsed.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"Converter",compiled:!0,alias:n,forced:!1})}a=this.addBindThis(e,a)}else e instanceof v.VariableInfo&&(a=e.type+" "+e.compiledContentNpm);a=this.removeComments(a),a=this.replaceFirstExport(a);const c=(0,s.transpile)(a,A),u=this.compileDocTs(a);n.namespace=t.build.module,e.namespace.length>0&&(n.namespace+="."+e.namespace),n.defTs=u,n.src=c+i;let _=t.file.path.replace(t.build.project.getConfigFile().path.replace(o.AventusExtension.Config,""),"");return _=_.replace(o.AventusExtension.Base,".js"),n.exportPath=_,n}catch(e){this.printCatchError(e)}return null}static compileDocTs(e){try{const t={getCompilationSettings:()=>({allowJs:!0,declaration:!0}),getScriptFileNames:()=>["temp.js"],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>"1",getScriptSnapshot:t=>{let n=e;return{getText:(e,t)=>n?.substring(e,t)||"",getLength:()=>n?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"",readFile:(t,n)=>e,fileExists:e=>!0,directoryExists:e=>!e.startsWith("node_modules")};return(0,s.createLanguageService)(t).getEmitOutput("temp.js",!0,!0).outputFiles[0].text.replace(/^declare /g,"")}catch(e){this.printCatchError(e)}return""}static removeUnusedImport(e,t){try{let n=w.TextDocument.create("temp.js","js",1,e);const r={getCompilationSettings:()=>({noUnusedLocals:!0,allowNonTsExtensions:!0,allowJs:!0}),getScriptFileNames:()=>["temp.js"],getScriptKind:e=>s.ScriptKind.TS,getScriptVersion:e=>"1",getScriptSnapshot:t=>{let n=e;return{getText:(e,t)=>n?.substring(e,t)||"",getLength:()=>n?.length||0,getChangeRange:()=>{}}},getCurrentDirectory:()=>"",getDefaultLibFileName:e=>"",readFile:(t,n)=>"temp.js"==t?e:"",fileExists:e=>!1,directoryExists:e=>!1};const i=(0,s.createLanguageService)(r).getSemanticDiagnostics("temp.js"),a=[];for(let r of i)if(r.reportsUnnecessary&&null!=r.start){const i=n.positionAt(r.start),s={line:i.line,character:0},o={line:i.line,character:6};if("import"==e.slice(n.offsetAt(s),n.offsetAt(o))){const e=/'(\S*)'/.exec(r.messageText+"");if(e&&e[1]&&t.includes(e[1]))continue;a.push({start:r.start,length:r.length})}}a.sort(((e,t)=>t.start-e.start));for(let t of a)e=e.slice(0,t.start)+e.slice(t.start+t.length);return e=e.replace(/import\s*\{[^}]*\}\s*from\s*['"][^'"]*['"];\s*/g,(e=>{let t=e.replace(/(,|{)(?:\s*(\S+)\s+as\s+)(?=,|})/g,"$1");return t=t.replace(/(,\s*)+/g,", ").replace(/,\s*}/g," }").replace(/{\s*,/g,"{ "),t.match(/\{\s*\}/)?"":t}))}catch(e){this.printCatchError(e)}return""}static getCompilerOptionsCompile(){return A}printCatchError(e){E.printCatchError(e)}static printCatchError(e){/^Debug Failure\. Expected \d+ <= \d+$/g.test(e.message)||console.error(e)}}t.AventusTsLanguageService=E;const k={allowNonTsExtensions:!0,jsx:s.JsxEmit.None,importHelpers:!1,allowJs:!0,checkJs:!1,lib:["lib.es2022.full.d.ts"],target:s.ScriptTarget.ES2022,moduleDetection:s.ModuleDetectionKind.Force,moduleResolution:s.ModuleResolutionKind.NodeNext,experimentalDecorators:!0,noImplicitOverride:!0,strictPropertyInitialization:!0,noImplicitReturns:!0,noUnusedLocals:!0,strictNullChecks:!0,verbatimModuleSyntax:!0},A={allowNonTsExtensions:!0,jsx:s.JsxEmit.None,importHelpers:!1,allowJs:!0,checkJs:!1,lib:["lib.es2022.full.d.ts"],target:s.ScriptTarget.ES2022,moduleDetection:s.ModuleDetectionKind.Auto,moduleResolution:s.ModuleResolutionKind.NodeNext,experimentalDecorators:!0,noImplicitOverride:!0,strictPropertyInitialization:!0,noImplicitReturns:!0,strictNullChecks:!0,verbatimModuleSyntax:!0},T={includeExternalModuleExports:!0,includeInsertTextCompletions:!0,includeCompletionsWithClassMemberSnippets:!0,includeAutomaticOptionalChainCompletions:!0,includeCompletionsForImportStatements:!0,includeCompletionsForModuleExports:!0,includeCompletionsWithInsertText:!0,includeInlayEnumMemberValueHints:!0,includeInlayFunctionLikeReturnTypeHints:!0,includeInlayFunctionParameterTypeHints:!0,includeInlayParameterNameHints:"all",includeInlayParameterNameHintsWhenArgumentMatchesName:!0,includeInlayPropertyDeclarationTypeHints:!0,useLabelDetailsInCompletionEntries:!0,importModuleSpecifierEnding:"index",importModuleSpecifierPreference:"relative"},I={convertTabsToSpaces:!0,tabSize:4,indentSize:4,indentStyle:s.IndentStyle.Smart,newLineCharacter:"\n",baseIndentSize:0,insertSpaceAfterCommaDelimiter:!0,insertSpaceAfterConstructor:!1,insertSpaceAfterSemicolonInForStatements:!0,insertSpaceBeforeAndAfterBinaryOperators:!0,insertSpaceAfterKeywordsInControlFlowStatements:!1,insertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,insertSpaceBeforeFunctionParenthesis:!1,insertSpaceAfterTypeAssertion:!0,placeOpenBraceOnNewLineForControlBlocks:!1,placeOpenBraceOnNewLineForFunctions:!1,semicolons:s.SemicolonPreference.Insert,insertSpaceBeforeTypeAnnotation:!1};function F(e){switch(e){case"primitive type":case"keyword":return a.CompletionItemKind.Keyword;case"const":case"let":case"var":case"local var":case"alias":case"parameter":return a.CompletionItemKind.Variable;case"property":case"getter":case"setter":return a.CompletionItemKind.Field;case"function":case"local function":return a.CompletionItemKind.Function;case"method":case"construct":case"call":case"index":return a.CompletionItemKind.Method;case"enum":return a.CompletionItemKind.Enum;case"enum member":return a.CompletionItemKind.EnumMember;case"module":case"external module name":return a.CompletionItemKind.Module;case"class":case"type":return a.CompletionItemKind.Class;case"interface":return a.CompletionItemKind.Interface;case"warning":return a.CompletionItemKind.Text;case"script":return a.CompletionItemKind.File;case"directory":return a.CompletionItemKind.Folder;case"string":return a.CompletionItemKind.Constant;default:return a.CompletionItemKind.Property}}function N(e,t){if((e=decodeURIComponent(e)).startsWith("custom://"))return e;let n=[];n="/"===i.sep?decodeURIComponent(t).replace("file://","").split("/"):decodeURIComponent(t).replace("file:///","").split("/"),n.pop();let r=(0,i.normalize)(n.join("/")).split(i.sep),s=(0,i.normalize)(n.join("/")+"/"+e).split(i.sep);for(let e=0;e<r.length;e++)if(s.length>e){if(r[e]!=s[e])break;r.splice(e,1),s.splice(e,1),e--}let a="";for(let e=0;e<r.length;e++)a+="../";return""==a&&(a+="./"),a+=s.join("/"),a}function M(e,t){return t.insertSpaces?D(" ",e*t.tabSize):D("\t",e)}function D(e,t){let n="";for(;t>0;)1==(1&t)&&(n+=e),e+=e,t>>>=1;return n}function R(e,t){let n=new RegExp("//#region "+t+"(\\s|\\S)*?//#endregion").exec(e.documentInternal.getText());return n?n.index+10+t.length:-1}},6045:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genericTsCompile=function(e){let t="",n=[],s=r=>{for(let s of r){let r=i.AventusTsLanguageService.compileTs(s,e);e.build.addNamespace(s.namespace),n.push(r),t+=r.debugTxt}};e.fileParsed&&(s(Object.values(e.fileParsed.classes)),s(Object.values(e.fileParsed.enums)),s(Object.values(e.fileParsed.aliases)),s(Object.values(e.fileParsed.functions)),s(Object.values(e.fileParsed.variables)));let a=e.file.path.replace(".avt",".js");""!=t?(0,r.writeFileSync)(a,t):(0,r.existsSync)(a)&&(0,r.unlinkSync)(a);return n};const r=n(57147),i=n(37439)},16286:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebComponentLogicalFile=void 0;const r=n(57147),i=n(22037),s=n(18952),a=n(19408),o=n(72375),l=n(60206),c=n(54145),u=n(43559),p=n(1539),_=n(87957),d=n(61586),h=n(71017);class f extends c.AventusTsFile{_compilationResult;canUpdateComponent=!0;viewMethodsInfo=[];storyBookInfo={argsTypes:{},args:{}};get compilationResult(){return this._compilationResult}get extension(){return a.AventusExtension.ComponentLogic}get version(){return this.file.documentInternal.version}get HTMLFile(){return this.file.uri.endsWith(a.AventusExtension.Component)?this.build.wcFiles[this.file.uri].view:this.build.htmlFiles[this.file.uri.replace(a.AventusExtension.ComponentLogic,a.AventusExtension.ComponentView)]}_fullname="";get fullName(){return this._fullname}get viewMethodName(){return"__"+d(this.fullName)+"method"}_componentEnd=0;get componentEnd(){return this._componentEnd}_componentClassName="";get componentClassName(){return this._componentClassName}_space="";writeHtml=!1;writeTs=!1;htmlDiagnostics=[];constructor(e,t){super(e,t),e.linkInternalAndUser=!1,this.quickParse(),this.refreshFileParsed()}waitingFct={};mergedVersion="-1_-1_-1";isCompiling=!1;runWebCompiler(){return new Promise((e=>{let t=u.AventusWebcomponentCompiler.getVersion(this,this.build),n=t.ts+"_"+t.scss+"_"+t.html,r=this.build.insideRebuildAll;if(n!=this.mergedVersion||r)if(this.isCompiling)this.waitingFct[n]||(this.waitingFct[n]=[]),this.waitingFct[n].push((()=>{e()}));else{this.isCompiling=!0,this.recreateFileContent();let t=new u.AventusWebcomponentCompiler(this,this.build);if(this._compilationResult=t.compile(),this.build.scssLanguageService.addInternalDefinition(this.file.uri,this._compilationResult.scssDoc),this.build.htmlLanguageService.addInternalDefinition(this.file.uri,this._compilationResult.htmlDoc,this),this.isCompiling=!1,this.mergedVersion=n,this.storyBookInfo.argsTypes=t.storyArgTypes,this.storyBookInfo.args=t.storyArgs,this.waitingFct[n])for(let e of this.waitingFct[n])e();e()}else e()}))}lastFileVersionCreated={html:-1,js:-1};typeInfered={};recreateFileContent(){let e=this.HTMLFile,t=e?.file.versionUser??0,n=this.file.documentUser.version+t+1;if(e){let i=!1,a=!1;if(this.lastFileVersionCreated.js!=this.file.documentUser.version?(i=!0,a=!0):this.lastFileVersionCreated.html!=t&&(i=!0),i){this.lastFileVersionCreated={html:t,js:this.file.documentUser.version};let i="";if(this.componentEnd>=0){let t=this.file.documentUser.getText(),r=1;for(;["}"," ","\t"].includes(t[this.componentEnd-r]);)r++;i=t.slice(0,this.componentEnd-r),this.viewMethodsInfo=[];let l=0;const c=e=>{let t=[];for(let n of e){let e=this.typeInfered[n]??"any";t.push(n+":"+e)}return t};if(a){const t=()=>{if(!e)return;let t=e.fileParsed?.loops??[],r=0;for(let e of t){let t=c(e.variables),a=i;a+=`/** */\n@NoCompile()\nprivate ${e.loopName}(${t.join(",")}): void {\n`;let l=a.length;a+=e.loopTxt+"\n",a+="}\n",a+="}",this.file instanceof o.InternalAventusFile&&(this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,-1*(n+r),a)),this._contentForLanguageService=a);for(let t of e.typeToLoad){let n=l+(Math.floor((t.start+t.end)/2)-e.start),r=e.loopTxt.slice(t.start-e.start,t.end-e.start),i=this.tsLanguageService.getType(this,n)??"any";this.typeInfered[r]=i}r++}let a=e.fileParsed?.contextEdits??[];for(let e of a){let t=c(e.variables),a=i;a+=`/** */\n@NoCompile()\nprivate ${e.editName}(${t.join(",")}): void {\n`;let l=a.length;a+=e.fctTs+"\n",a+="}\n",a+="}",this.file instanceof o.InternalAventusFile&&(this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,-1*(n+r),a)),this._contentForLanguageService=a);for(let t of e.typeToLoad){let n=l+(Math.floor((t.start+t.end)/2)-e.start),r=this.tsLanguageService.getType(this,n)??"any";this.typeInfered[t.txt]=r}}};t()}let u=e.fileParsed?.loops??[];for(let e of u){let t=i.length,n=c(e.variables),r=this._space;i+=`\n${r}/** */\n${r}@NoCompile()\n${r}private ${e.loopName}(${n.join(",")}): void {\n`;let s=i.length;i+=e.loopTxt+"\n";let a=i.length;i+=r+"}";const o=function(){return{name:e.loopName,fullStart:t,start:s,end:a,offsetBefore:0,offsetAfter:0,kind:"loop",fct:{txt:e.loopTxt,positions:[{start:e.start,end:e.startBlock}]},transform:(e,t)=>t}};this.viewMethodsInfo.push(o()),e.isSimple||(i+=`\n${r}/** */\n${r}private ${e.complex.loopName}(${n.join(",")}) {\n\n ${e.complex.init.join(";\n")}\n return {\n transform:() => {\n ${e.complex.transform.join(";\n")}\n },\n condition: () => {\n return (${e.complex.condition})\n },\n apply: () => {\n return ({${e.complex.apply}})\n }\n }\n }`)}let p=e.fileParsed?.fcts??{};for(let e of Object.values(p)){let t=e.txt.replace(/\n/g,";"),n=-1,r=t.split(";");if(!t.includes("return ")&&r.length>0){let e=r.pop();n=r.join("\n").length,e?.startsWith(" ")?(r.push("return"+e),l=6):(r.push("return "+e),l=7)}t=r.join("\n");let s=i.length,a=c(e.variables),o="NotVoid",u=this._space;i+=`\n${u}/** */\n${u}private ${e.name}(${a.join(",")}): ${o} {\n`;let p=i.length;i+=t+"\n";let _=i.length;i+=u+"}";const d=function(t,n){let r={name:e.name,fullStart:s,start:p,end:_,fct:e,offsetBefore:2,offsetAfter:2,kind:"fct",transform:(e,r)=>(e>=t&&(r+=n),r)};return r};this.viewMethodsInfo.push(d(n,l))}let _=e.fileParsed?.ifs??[];for(let e of _)for(let t of e.conditions){let e=t.txt.replace(/\n/g,";"),n=-1,r=e.split(";");if(!e.includes("return ")&&r.length>0){let e=r.pop();n=r.join("\n").length,e?.startsWith(" ")?(r.push("return"+e),l=6):(r.push("return "+e),l=7)}e=r.join("\n");let s=i.length,a=c(t.variables),o=this._space;i+=`\n${o}/** */\n${o}private ${t.fctName}(${a.join(",")}): NotVoid {\n`;let u=i.length;i+=e+"\n";let p=i.length;i+=o+"}";const _=function(n,r){let i={name:t.fctName,fullStart:s,start:u,end:p,kind:"if",fct:{positions:[{start:t.start,end:t.end}],txt:e},offsetBefore:t.offsetBefore,offsetAfter:t.offsetAfter,transform:(e,t)=>(e>=n&&(t+=r),t)};return i};this.viewMethodsInfo.push(_(n,l))}let d=e.fileParsed?.contextEdits??[];for(let e of d){let t=i.length,n=c(e.variables),r=this._space;i+=`\n${r}/** */\n${r}private ${e.editName}(${n.join(",")}): { [key: string]: any } {\n`;let s=i.length;i+=e.fctTs+"\n";let a=i.length;i+=r+"}";const o=function(){return{name:e.editName,fullStart:t,start:s,end:a,offsetBefore:0,offsetAfter:0,kind:"context",fct:{txt:e.fctTs,positions:[{start:e.start,end:e.end}]},transform:(e,t)=>t}};this.viewMethodsInfo.push(o())}const h=e=>{let t=e.injectTsTxt.replace(/\n/g,";"),n=-1,r=t.split(";");if(!t.includes("return ")&&r.length>0){let e=r.pop();n=r.join("\n").length,e?.startsWith(" ")?(r.push("return"+e),l=6):(r.push("return "+e),l=7)}t=r.join("\n");let s=i.length,a=c(e.variables),o=this._space;i+=`\n${o}/** */\n${o}private ${e.injectFctName}(${a.join(",")}): NotVoid {\n`;let u=i.length;i+=t+"\n";let p=i.length;i+=o+"}";this.viewMethodsInfo.push(function(t,n){let r={name:e.injectFctName,fullStart:s,start:u,end:p,fct:{txt:e.injectTsTxt,positions:[{start:e.start,end:e.end}]},offsetBefore:1,offsetAfter:1,kind:"fct",transform:(e,r)=>(e>=t&&(r+=n),r)};return r}(n,l))};let f=e.fileParsed?.injections??[];for(let e of f)h(e);let m=e.fileParsed?.bindings??[];for(let e of m){let t;h(e);let n=c(e.variables),r=0,s="v";for(;e.variables.includes(s);)r++,s="v"+r;n=[s+": any"].concat(n),t=0==e.extractTsCond.length?e.extractTsTxt.replace(/\n/g,";")+" = "+s:"if( "+e.extractTsCond+" ) { "+e.extractTsTxt.replace(/\n/g,";")+" = "+s+" }";let a=this._space;i+=`\n${a}/** */\n${a}private ${e.extractFctName}(${n.join(",")}): void {\n`;i.length;i+=t+"\n";i.length;i+=a+"}"}i+=t.slice(this.componentEnd-r),this.file instanceof o.InternalAventusFile&&this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,n,i))}this.refreshFileParsed();let l=(0,h.join)(this.file.folderPath,"compiled.html"),c=(0,h.join)(this.file.folderPath,"compiled.ts");this.writeHtml?(0,r.writeFileSync)(l,this.HTMLFile?.fileParsed?.compiledTxt??""):(0,r.existsSync)(l)&&(0,r.unlinkSync)(l),this.writeTs?(0,r.writeFileSync)(c,i):(0,r.existsSync)(c)&&(0,r.unlinkSync)(c)}}else this.file instanceof o.InternalAventusFile&&this.file.setDocumentInternal(s.TextDocument.create(this.file.documentUser.uri,this.file.documentUser.languageId,n,this.file.contentUser)),this.refreshFileParsed()}async onValidate(){return await this.runWebCompiler(),this.diagnostics=this.compilationResult?.diagnostics||[],this.transformDiagnosticForView(),this.HTMLFile?.validate(),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.diagnostics}transformDiagnosticForView(){let e=this.HTMLFile;if(e){let t=[],n=[],r=[];for(let i of this.diagnostics){let s=this.file.documentInternal.offsetAt(i.range.start),o=this.file.documentInternal.offsetAt(i.range.end),l=!1,c=s>=this.file.contentUser.length;for(let t=0;t<this.viewMethodsInfo.length;t++){let c=this.viewMethodsInfo[t].fullStart,u=this.viewMethodsInfo[t].end;if(s>c&&o<u){i.source=a.AventusLanguageId.HTML;let c=this.viewMethodsInfo[t].fct,u=this.viewMethodsInfo[t].offsetAfter,p=this.viewMethodsInfo[t].offsetBefore;if(-1==r.indexOf(i.range)){let a=this.viewMethodsInfo[t].transform(s,0);r.push(i.range);let l=s-this.viewMethodsInfo[t].start-a,_=o-this.viewMethodsInfo[t].start-a;for(let t=0;t<c.positions.length;t++){let r=c.positions[t].start,s=c.positions[t].end,a=i;t>0&&(a={...i});let o=r+p+l,d=r+p+_;a.range=o<r||d>s-u?{start:e.file.documentInternal.positionAt(r),end:e.file.documentInternal.positionAt(s)}:{start:e.file.documentInternal.positionAt(o),end:e.file.documentInternal.positionAt(d)},t>0&&n.push(a)}}l=!0;break}}l?n.push(i):c||t.push(i)}this.diagnostics=t,this.htmlDiagnostics=n}else this.htmlDiagnostics=[]}quickParse(){let e=_.QuickParser.parse(this.file.documentUser.getText(),this.build);this._componentEnd=e.end,this._fullname=e.fullname,this._componentClassName=e.className,this.writeHtml=e.writeHtml,this.writeTs=e.writeTs,e.tagName&&this.build.htmlLanguageService.addInternalTagUri(e.tagName,this.file.uri,this._componentClassName);let t="";for(let n=0;n<e.whiteSpaceBefore+4;n++)t+=" ";this._space=t}async onContentChange(){this.quickParse(),await this.runWebCompiler()}async onSave(){await this.runWebCompiler(),this.compilationResult?this.setCompileResult(this.compilationResult.result):this.setCompileResult([]),this.compilationResult?.writeCompiled?(0,r.writeFileSync)(this.file.folderPath+"/compiled.js",(0,p.replaceNotImportAliases)(this.compilationResult.debug,this.build.project.getConfig())):(0,r.existsSync)(this.file.folderPath+"/compiled.js")&&(0,r.unlinkSync)(this.file.folderPath+"/compiled.js"),this.canUpdateComponent||(this.canUpdateComponent=!0)}emitToHtttpServer(e){if(!this.canUpdateComponent)return;let t={};for(let n of e)t[n.name]=n.src;let n,r=!1,i="",s="";if(this.compilationResult)for(let e of this.compileResult)""!=e.classScript&&t[e.classScript]&&t[e.classScript]!=e.compiled&&(e.classScript!=this.compilationResult.componentName?this.build.reloadPage=!0:(r=!0,i=e.hotReload,s=e.classScript,n=this.fileParsed?.classes[s]));if(!this.build.reloadPage&&r&&n){let e=this.buildNamespace;n.namespace&&(e+=n.namespace),e.length>0&&!e.endsWith(".")&&(e+="."),l.HttpServer.getInstance().updateComponent(i,e+s,[])}}async onDelete(){await super.onDelete(),this.build.scssLanguageService.removeInternalDefinition(this.file.uri),this.build.htmlLanguageService.removeInternalDefinition(this.file.uri),this.build.htmlLanguageService.removeInternalTagUri(this.file.uri)}async doViewCompletion(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let r of e.fct.positions)if(n>=r.start+e.offsetBefore&&n<=r.end){let i=n-r.start-e.offsetAfter,s=e.start+i;s=e.transform(s,s);let o=this.file.documentInternal.positionAt(s),l=await this.onCompletion(this.file,o),c=[],u=[];for(let n of l.items)if(!this.viewMethodName||!n.label.startsWith(this.viewMethodName)){if(n.data&&n.data.uri&&(n.data.languageId=a.AventusLanguageId.HTML,n.data.uri=t.file.uri),n.textEdit){let i=n.textEdit;if(i.range&&-1==u.indexOf(i.range)){u.push(i.range);e.fct;let n=this.file.documentInternal.offsetAt(i.range.start),s=this.file.documentInternal.offsetAt(i.range.end),a=e.transform(n,0),o=n-e.start-a,l=s-e.start-a;i.range.start=t.file.documentInternal.positionAt(r.start+e.offsetBefore+o),i.range.end=t.file.documentInternal.positionAt(r.start+e.offsetBefore+l)}}if(n.additionalTextEdits)for(let i of n.additionalTextEdits)if(i.range&&-1==u.indexOf(i.range)){u.push(i.range);e.fct;let n=this.file.documentInternal.offsetAt(i.range.start),s=this.file.documentInternal.offsetAt(i.range.end),a=e.transform(n,0),o=n-e.start-a,l=s-e.start-a;i.range.start=t.file.documentInternal.positionAt(r.start+e.offsetBefore+o),i.range.end=t.file.documentInternal.positionAt(r.start+e.offsetBefore+l)}c.push(n)}return l.items=c,l}return null}async onCompletion(e,t){return await this.runWebCompiler(),this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}async doHover(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let r of e.fct.positions)if(n>=r.start+e.offsetBefore&&n<=r.end){let i=n-r.start-e.offsetAfter,s=e.start+i;s=e.transform(s,s);let a=this.file.documentInternal.positionAt(s),o=await this.onHover(this.file,a);if(o&&o.range){let n=this.file.documentInternal.offsetAt(o.range.start),i=this.file.documentInternal.offsetAt(o.range.end),s=e.transform(n,0),a=n-e.start-s,l=i-e.start-s;o.range.start=t.file.documentInternal.positionAt(r.start+e.offsetBefore+a),o.range.end=t.file.documentInternal.positionAt(r.start+e.offsetBefore+l)}return o}return null}onHover(e,t){return this.tsLanguageService.doHover(e,t)}async doDefinition(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let t of e.fct.positions)if(n>=t.start+e.offsetBefore&&n<=t.end){let r=n-t.start-e.offsetAfter,i=e.start+r;i=e.transform(r,i);let s=this.file.documentInternal.positionAt(i);return await this.onDefinition(this.file,s)}return null}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async doFormatting(e,t){return this.HTMLFile?(await this.getFormatting(t,!1)).html:null}async onFormatting(e,t,n){return(await this.getFormatting(n,!0)).js}async getFormatting(e,t){let n={js:[],html:[]},r={start:{character:0,line:0},end:this.file.documentInternal.positionAt(this.file.contentInternal.length)},i=await this.tsLanguageService.format(this.file,r,e,t),s=this.HTMLFile,a=[];for(let e of i){let t=this.file.documentInternal.offsetAt(e.range.start),r=this.file.documentInternal.offsetAt(e.range.end),i=!1,o=t>=this.file.contentUser.length;if(s)for(let s=0;s<this.viewMethodsInfo.length;s++){let o=this.viewMethodsInfo[s].start,l=this.viewMethodsInfo[s].end,c=this.viewMethodsInfo[s].transform(t,0);if(t>=o+c&&r<l){if(t==o&&!/\S/.test(e.newText)){i=!0;break}let l=this.viewMethodsInfo[s].fct,u=this.viewMethodsInfo[s].offsetBefore;if(-1==a.indexOf(e.range)){a.push(e.range);let i=t-this.viewMethodsInfo[s].start-c,o=r-this.viewMethodsInfo[s].start-c;for(let t=0;t<l.positions.length;t++){let r=l.positions[t].start+u+i,a=l.positions[t].start+u+o;n.html.push({edit:{newText:e.newText,range:{start:r,end:a}},start:l.positions[t].start,end:l.positions[t].end,kind:this.viewMethodsInfo[s].kind})}}i=!0;break}if(t>=this.viewMethodsInfo[s].fullStart&&r<=l){i=!0;break}}i||o||n.js.push(e)}return n}async onCodeAction(e,t){let n=await this.tsLanguageService.doCodeAction(e,t);return this.addCustomCodeAction(n),n}async doReferences(e){const t=this.HTMLFile;if(!t)return null;let n=t.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let t of e.fct.positions)if(n>=t.start+e.offsetBefore&&n<=t.end){let r=n-t.start-e.offsetAfter,i=e.start+r;i=e.transform(i,i);let s=this.file.documentInternal.positionAt(i);return await this.onReferences(this.file,s)}return null}async onReferences(e,t){let n=[],r=await this.tsLanguageService.onReferences(e,t)||[];if(this._compilationResult?.componentName&&this.fileParsed?.classes[this._compilationResult.componentName]){let e=this.file.documentInternal.offsetAt(t),r=this.fileParsed?.classes[this._compilationResult.componentName];if(e>=r.nameStart&&e<=r.nameEnd)for(let[e,t]of this.reverseViewClassInfoDependances)for(let r of t)n.push({uri:e.file.uri,range:{start:e.file.documentInternal.positionAt(r.start),end:e.file.documentInternal.positionAt(r.end)}})}let i=[...r,...n];return i=this.transformRefrencesToView(i),i}transformRefrencesToView(e){let t=[];for(let n of e){if(n.uri.endsWith(a.AventusExtension.ComponentLogic)){let e=this.build.tsFiles[n.uri];if(!e)continue;if(e instanceof f){let r=e.HTMLFile;if(r){let i=[],s=e._file.documentInternal.offsetAt(n.range.start),a=e._file.documentInternal.offsetAt(n.range.end);for(let e=0;e<this.viewMethodsInfo.length;e++){let o=this.viewMethodsInfo[e].fullStart,l=this.viewMethodsInfo[e].end;if(s>o&&a<l){n.uri=r.file.uri;let o=this.viewMethodsInfo[e].fct,l=this.viewMethodsInfo[e].offsetBefore;this.viewMethodsInfo[e].offsetAfter;if(-1==i.indexOf(n.range)){let c=this.viewMethodsInfo[e].transform(s,0);i.push(n.range);let u=s-this.viewMethodsInfo[e].start-c,p=a-this.viewMethodsInfo[e].start-c;for(let e=0;e<o.positions.length;e++){let i=o.positions[e].start+l+u,s=o.positions[e].start+l+p,a=n;e>0&&(a={...a}),a.range={start:r.file.documentInternal.positionAt(i),end:r.file.documentInternal.positionAt(s)},e>0&&t.push(a)}}break}}}}}t.push(n)}return t}async onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async doRename(e,t){const n=this.HTMLFile;if(!n)return null;let r=n.file.documentInternal.offsetAt(e);for(let e of this.viewMethodsInfo)for(let n of e.fct.positions)if(r>=n.start+e.offsetBefore&&r<=n.end){let i=r-n.start-e.offsetAfter,s=e.start+i;s=e.transform(s,s);let a=this.file.documentInternal.positionAt(s);return await this.onRename(this.file,a,t)}return null}async onRename(e,t,n){let r=await this.tsLanguageService.onRename(e,t,n);return r&&this.transformRenameToView(r),r}transformRenameToView(e){if(e.changes){let t={};for(let n in e.changes)if(n.endsWith(a.AventusExtension.ComponentLogic)){let r=e.changes[n],i=this.build.tsFiles[n];if(!i)continue;if(i instanceof f){let e=i.HTMLFile;if(e)for(let n=0;n<r.length;n++){let s=r[n],a=i._file.documentInternal.offsetAt(s.range.start),o=i._file.documentInternal.offsetAt(s.range.end);for(let i=0;i<this.viewMethodsInfo.length;i++){let l=this.viewMethodsInfo[i].fullStart,c=this.viewMethodsInfo[i].end;if(a>l&&o<c){t[e.file.uri]||(t[e.file.uri]=[]);let l=this.viewMethodsInfo[i].fct,c=this.viewMethodsInfo[i].transform(a,0),u=a-this.viewMethodsInfo[i].start-c,p=o-this.viewMethodsInfo[i].start-c;for(let n of l.positions){let r=n.start+this.viewMethodsInfo[i].offsetBefore+u,a=n.start+this.viewMethodsInfo[i].offsetBefore+p;t[e.file.uri].push({newText:s.newText,range:{start:e.file.documentInternal.positionAt(r),end:e.file.documentInternal.positionAt(a)}})}r.splice(n,1),n--;break}}}}}for(let n in t)if(e.changes[n])for(let r of t[n])e.changes[n].push(r);else e.changes[n]=t[n]}}addCustomCodeAction(e){let t=!1,n=!1;for(let r of this.diagnostics)if(r.code!=a.AventusErrorCode.MissingViewElement||t)if(r.code==a.AventusErrorCode.MissingProp){let t=r.message.match(/#[a-zA-Z0-9_]+/g);if(t){let n=t[0].replace("#","");e.push({title:"Import missing property "+n,command:{command:"aventus.wc.create.property",title:"Create property",arguments:["prefill:"+n]}})}}else if(r.code!=a.AventusErrorCode.MissingMethod||n){if(r.code==a.AventusErrorCode.viewElementNotFound&&r.data){let t=r.data;e.push({title:"Remove element",edit:{changes:{[this.file.uri]:[{newText:"",range:{start:this.file.documentInternal.positionAt(t.start),end:this.file.documentInternal.positionAt(t.end)}}]}}})}}else n=!0,e.push({title:"Import missing methods",command:{command:"aventus.wc.import.viewMethod",title:"Import missing methods"}});else t=!0,e.push({title:"Import missing view elements",command:{command:"aventus.wc.import.viewElement",title:"Import missing view elements"}})}getMissingVariablesInfo(){let e="",t=-1;if(this.compilationResult){t=this.compilationResult?.missingViewElements.position;for(let t in this.compilationResult.missingViewElements.elements)e+="@ViewElement()"+i.EOL+"protected "+t+"!: "+this.compilationResult.missingViewElements.elements[t]+";"+i.EOL}return{start:t,text:e}}getMissingMethodsInfo(){let e="",t=-1;if(this.compilationResult){t=this.compilationResult?.missingMethods.position;for(let t of this.compilationResult.missingMethods.elements)e+=`/**${i.EOL} * ${i.EOL} */${i.EOL}protected ${t}(){${i.EOL}throw new Error("Method not implemented.");${i.EOL}}${i.EOL}`}return""!=e&&(e=i.EOL+e),{start:t,text:e}}getComponentName(){return this.compilationResult?.componentName||""}viewClassInfoDependances=[];reverseViewClassInfoDependances=new Map;resetViewClassInfoDep(){let e=this.HTMLFile;if(e){for(let t of this.viewClassInfoDependances)t instanceof f&&t.reverseViewClassInfoDependances.delete(e);this.viewClassInfoDependances=[]}}addViewClassInfoDep(e,t,n){let r=this.HTMLFile;r&&(this.viewClassInfoDependances.includes(e)||this.viewClassInfoDependances.push(e),e instanceof f&&(e.reverseViewClassInfoDependances.has(r)||e.reverseViewClassInfoDependances.set(r,[]),e.reverseViewClassInfoDependances.get(r)?.push({start:t,end:n})))}}t.AventusWebComponentLogicalFile=f},87957:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QuickParser=void 0;const r=n(94625),i=n(25850),s=n(74950),a=n(50789),o=n(95553);class l{static parse(e,t){return new l(e,t)}AventusDefaultComponent="Aventus.DefaultComponent";end=-1;currentNamespace=[];fullname="";className="";tagName=null;whiteSpaceBefore=0;writeHtml=!1;writeTs=!1;prefixes;isAbstract=!1;constructor(e,t){this.currentNamespace.push(t.module),t.isCoreBuild&&(this.AventusDefaultComponent="DefaultComponent"),this.prefixes=t.getComponentPrefix().split("-"),this.loadRoot((0,r.createSourceFile)("sample.ts",e,r.ScriptTarget.ESNext,!0))}loadRoot(e){return e.kind==r.SyntaxKind.ModuleDeclaration?this.loadNamespace(e):((0,r.forEachChild)(e,(e=>e.kind==r.SyntaxKind.ModuleDeclaration?this.loadNamespace(e):e.kind==r.SyntaxKind.ClassDeclaration?this.loadClass(e):void 0)),!!this.end||void 0)}loadNamespace(e){if((0,i.hasFlag)(e.flags,r.NodeFlags.Namespace)&&e.body){this.currentNamespace.push(e.name.getText());let t=this.loadRoot(e.body);return this.currentNamespace.splice(this.currentNamespace.length-1,1),t}if((0,i.hasFlag)(e.flags,r.NodeFlags.GlobalAugmentation)&&e.body)return this.loadRoot(e.body)}loadClass(e){let t=/^(\s)*/.exec(e.getText());if(t&&(this.whiteSpaceBefore=t[0].length),e.modifiers)for(let t of e.modifiers)t.kind==r.SyntaxKind.AbstractKeyword&&(this.isAbstract=!0);if(e.name&&e.heritageClauses){let t=e.name;for(let n of e.heritageClauses)if(n.token==r.SyntaxKind.ImplementsKeyword&&((0,r.forEachChild)(n,(n=>{if(n.kind==r.SyntaxKind.ExpressionWithTypeArguments&&n.getText()==this.AventusDefaultComponent){this.end=e.getEnd(),this.fullname=[...this.currentNamespace,t.getText()].join("."),this.className=t.getText();let n=s.DecoratorInfo.buildDecorator(e);for(let e of n){let t=a.DebuggerDecorator.is(e);if(t)t.writeHTML&&(this.writeHtml=!0),t.writeComponentTs&&(this.writeTs=!0);else if(!this.isAbstract){let t=o.TagNameDecorator.is(e);t&&(this.tagName=t.tagName)}}if(!this.isAbstract&&null==this.tagName){let e=this.className.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g);if(e){for(let t=0;t<this.prefixes.length;t++){let n=this.prefixes[t];if(n.length>0&&e[t].toLowerCase()!=n.toLowerCase()){e.splice(0,0,this.prefixes.join("-").toLowerCase());break}}this.tagName=e.join("-").toLowerCase()}}return!0}})),this.end))return!0}}}t.QuickParser=l},22163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebComponentSingleFile=void 0;const r=n(22037),i=n(18952),s=n(19408),a=n(72375),o=n(67246),l=n(95896),c=n(56733),u=n(16286);class p extends o.AventusBaseFile{regionLogic={start:0,end:0};regionStyle={start:0,end:0};regionView={start:0,end:0};get logic(){if(this.regionLogic.file)return this.regionLogic.file;throw"should not append"}get style(){return this.regionStyle.file}get view(){return this.regionView.file}get extension(){return s.AventusExtension.Component}constructor(e,t){super(e,t);let n=this.getDocuments();this.regionLogic.file=n.ts,this.regionStyle.file=n.scss,this.regionView.file=n.html}async init(){await(this.regionView.file?.init()),await(this.regionStyle.file?.init()),this.regionView.file&&this.regionStyle.file||await this.file.validate()}async onValidate(){await this.transformDocument();let e=[],t=[];const n=async n=>{if(n.file){let r=await n.file.file.validate(),i=n.file.file.documentInternal;for(let a of r)a.source=s.AventusLanguageId.WebComponent,-1==t.indexOf(a.range)&&(t.push(a.range),a.range.start=this.file.documentInternal.positionAt(i.offsetAt(a.range.start)+n.start),a.range.end=this.file.documentInternal.positionAt(i.offsetAt(a.range.end)+n.start)),e.push(a)}};return await n(this.regionStyle),await n(this.regionView),await n(this.regionLogic),e}waitingFct={};currentVersion="";isCompiling=!1;transformDocument(){return new Promise((async e=>{let t=this.file.versionInternal+"",n=this.build.insideRebuildAll;if(t!=this.currentVersion||n)if(this.isCompiling)this.waitingFct[t]||(this.waitingFct[t]=[]),this.waitingFct[t].push((()=>{e()}));else{this.isCompiling=!0;let n=this.splitDocument();const r=async(e,t,n)=>{let r=i.TextDocument.create(this.file.uri,t,this.file.versionUser,n);if(e.file)await e.file.triggerContentChange(r);else if(t==s.AventusLanguageId.HTML){let t=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.HTML,this.file.versionUser,n)),r=new l.AventusHTMLFile(t,this.build);e.file=r,await r.init()}else if(t==s.AventusLanguageId.SCSS){let t=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.SCSS,this.file.versionUser,n)),r=new c.AventusWebSCSSFile(t,this.build);e.file=r,await r.init()}};if(null!==n.cssText?await r(this.regionStyle,s.AventusLanguageId.SCSS,n.cssText):this.regionStyle.file&&(this.regionStyle.file.triggerDelete(),this.regionStyle.file=void 0),null!==n.htmlText?await r(this.regionView,s.AventusLanguageId.HTML,n.htmlText):this.regionView.file&&(this.regionView.file.triggerDelete(),this.regionView.file=void 0),null!==n.scriptText&&await r(this.regionLogic,s.AventusLanguageId.TypeScript,n.scriptText),this.isCompiling=!1,this.currentVersion=t,this.waitingFct[t])for(let e of this.waitingFct[t])e();e()}else e()}))}async onContentChange(){await this.transformDocument()}async onSave(){this.build.disableBuild(),this.style&&await this.style.file.triggerSave(),this.view&&await this.view.file.triggerSave(),this.build.enableBuild(),await this.logic.file.triggerSave()}async onCompletion(e,t){await this.transformDocument();let n=e.documentInternal.offsetAt(t),r=[];const i=async e=>{if(n>=e.start&&n<=e.end&&e.file){let t=await(e.file?.file).getCompletion(e.file.file.documentInternal.positionAt(n-e.start));for(let n of t.items)if(n.data&&n.data.uri&&(n.data.previousLanguageId=n.data.languageId,n.data.languageId=s.AventusLanguageId.WebComponent),n.textEdit){let t=n.textEdit;t.range&&-1==r.indexOf(t.range)&&(r.push(t.range),t.range.start=this.transformPosition(e.file,t.range.start,this,-1*e.start),t.range.end=this.transformPosition(e.file,t.range.end,this,-1*e.start))}return t}};let a=await i(this.regionStyle);if(a)return a;let o=await i(this.regionView);if(o)return o;let l=await i(this.regionLogic);return l||{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){let n=[];if(t.data&&t.data.previousLanguageId){let e=t.data.previousLanguageId;delete t.data.previousLanguageId;const i=async(i,s)=>{if(e==s){let e=i.file;if(e){let s=await e.file.getCompletionResolve(t);if(s.additionalTextEdits)for(let t of s.additionalTextEdits)0==e.file.documentInternal.offsetAt(t.range.start)&&(t.newText=r.EOL+t.newText),-1!=n.indexOf(t.range)||t.range.wc_transformed||(n.push(t.range),t.range.wc_transformed=!0,t.range.start=this.transformPosition(e,t.range.start,this,-1*i.start),t.range.end=this.transformPosition(e,t.range.end,this,-1*i.start));return s}}};let a=await i(this.regionStyle,s.AventusLanguageId.SCSS);if(a)return a;let o=await i(this.regionView,s.AventusLanguageId.HTML);if(o)return o;let l=await i(this.regionLogic,s.AventusLanguageId.TypeScript);if(l)return l}return t}async onHover(e,t){let n=e.documentInternal.offsetAt(t),r=[];const i=async e=>{if(n>=e.start&&n<=e.end&&e.file){let t=await e.file.file.getHover(e.file.file.documentInternal.positionAt(n-e.start));return t?.range&&-1==r.indexOf(t.range)&&(r.push(t.range),t.range.start=this.transformPosition(e.file,t.range.start,this,-1*e.start),t.range.end=this.transformPosition(e.file,t.range.end,this,-1*e.start)),t}return null};let s=await i(this.regionStyle);if(s)return s;let a=await i(this.regionView);if(a)return a;let o=await i(this.regionLogic);return o||null}async onDefinition(e,t){let n=e.documentInternal.offsetAt(t),r=null;return this.style&&n>=this.regionStyle.start&&n<=this.regionStyle.end?r=await this.style.file.getDefinition(this.style.file.documentInternal.positionAt(n-this.regionStyle.start)):this.view&&n>=this.regionView.start&&n<=this.regionView.end?r=await this.view.file.getDefinition(this.view.file.documentInternal.positionAt(n-this.regionView.start)):n>=this.regionLogic.start&&n<=this.regionLogic.end&&(r=await this.logic.file.getDefinition(this.logic.file.documentInternal.positionAt(n-this.regionLogic.start))),r}async onFormatting(e,t,n){let i=[],s=[];const a=e=>{let t="";for(let n=0;n<4*e;n++)t+=" ";return t},o=async(e,t)=>{if(e.file){let o=await e.file.file.getFormatting(n);for(let n of o)t.tab&&(n.newText=n.newText.split("\n").join("\n"+a(1))),t.firstLast&&(n.newText=n.newText.trim(),0==n.range.start.character&&0==n.range.start.line&&(n.newText=t.tab?r.EOL+a(1)+n.newText:r.EOL+n.newText),e.file.file.documentInternal.offsetAt(n.range.end)==e.file.file.documentInternal.getText().length&&(n.newText=n.newText+r.EOL)),-1==s.indexOf(n.range)&&(s.push(n.range),n.range.start=this.transformPosition(e.file,n.range.start,this,-1*e.start),n.range.end=this.transformPosition(e.file,n.range.end,this,-1*e.start)),i.push(n)}};return await o(this.regionStyle,{firstLast:!0,tab:!0}),await o(this.regionView,{firstLast:!0,tab:!0}),await o(this.regionLogic,{firstLast:!1,tab:!1}),i}async onCodeAction(e,t){let n={start:e.documentInternal.offsetAt(t.start),end:e.documentInternal.offsetAt(t.end)},r=[];const i=async i=>{if(this.isOverlapping(n,i)&&i.file){let n=await i.file.file.getCodeAction({start:this.transformPosition(this,t.start,i.file,i.start),end:this.transformPosition(this,t.end,i.file,i.start)});for(let t of n)if(t.edit&&t.edit.changes){let n=[];for(let e in t.edit.changes){let s=t.edit.changes[e];for(let e of s)-1==r.indexOf(e.range)&&(r.push(e.range),e.range.start=this.transformPosition(i.file,e.range.start,this,-1*i.start),e.range.end=this.transformPosition(i.file,e.range.end,this,-1*i.start)),n.push(e)}n.length>0&&(delete t.edit.changes[i.file.file.uri],t.edit.changes[e.uri]=n)}return n}};let s;return s=await i(this.regionStyle),s||(s=await i(this.regionView),s||(s=await i(this.regionLogic),s||[]))}async onDelete(){delete this.build.tsFiles[this.file.uri]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}getDocuments(){let e,t,n=this.splitDocument();if(null!==n.htmlText){let e=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.HTML,this.file.versionUser,n.htmlText));new l.AventusHTMLFile(e,this.build)}if(null!==n.cssText){let e=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.SCSS,this.file.versionUser,n.cssText));t=new c.AventusWebSCSSFile(e,this.build)}let r=new a.InternalAventusFile(i.TextDocument.create(this.file.uri,s.AventusLanguageId.TypeScript,this.file.versionUser,n.scriptText??""));const o={html:e,scss:t,ts:new u.AventusWebComponentLogicalFile(r,this.build)};return this.build.tsFiles[o.ts.file.uri]=o.ts,o}splitDocument(){let e={cssText:null,htmlText:null,scriptText:null},t=/<script>((\s|\S)*)<\/script>/g.exec(this.file.contentInternal);if(t){let n=t.index+8;this.regionLogic.start=n;let r=t.index+t[0].length-9;this.regionLogic.end=r,e.scriptText=this.file.contentInternal.substring(n,r)}let n=/<style>((\s|\S)*)<\/style>/g.exec(this.file.contentInternal);if(n){let t=n.index+7;this.regionStyle.start=t;let r=n.index+n[0].length-8;this.regionStyle.end=r,e.cssText=this.file.contentInternal.substring(t,r)}let r=/<template>((\s|\S)*)<\/template>/g.exec(this.file.contentInternal);if(r){let t=r.index+10;this.regionView.start=t;let n=r.index+r[0].length-11;this.regionView.end=n,e.htmlText=this.file.contentInternal.substring(t,n)}return e}transformPosition(e,t,n,r){let i=e.file.documentInternal.offsetAt(t);return n.file.documentInternal.positionAt(i-r)}isOverlapping(e,t){return t.start<e.start&&t.end>e.start||t.start<e.end&&t.end>e.end||t.start>e.start&&t.end<e.end}static getRegion(e){let t={cssText:null,htmlText:null,scriptText:null},n=/<script>((\s|\S)*)<\/script>/g.exec(e.contentInternal);if(n){let r=n.index+8,i=n.index+n[0].length-9;t.scriptText=e.contentInternal.substring(r,i)}let r=/<style>((\s|\S)*)<\/style>/g.exec(e.contentInternal);if(r){let n=r.index+7,i=r.index+r[0].length-8;t.cssText=e.contentInternal.substring(n,i)}let i=/<template>((\s|\S)*)<\/template>/g.exec(e.contentInternal);if(i){let n=i.index+10,r=i.index+i[0].length-11;t.htmlText=e.contentInternal.substring(n,r)}return t}onGetBuild(){return[this.build]}}t.AventusWebComponentSingleFile=p},79573:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebcomponentTemplate=function(){return'$namespaceStart$$fullname$ = class $classname$ extends $parentClass$ {\n $watchingAttributes$\n \n $getterSetterAttr$\n $getterSetterProp$\n $getterSetterWatch$\n $getterSetterSignal$\n $variables$\n $watchesChangeCb$\n $registerSignal$\n $propertiesChangeCb$\n static __style = `$style$`;\n $constructor$\n __getStatic() {\n return $classname$;\n }\n __getStyle() {\n let arrStyle = super.__getStyle();\n arrStyle.push($classname$.__style);\n return arrStyle;\n }\n $slotBlock$\n\n $states$\n \n $variablesInViewDynamic$\n $templateAction$\n\n getClassName() {\n return "$classname$";\n }\n\n $defaultValue$\n $defaultValueWatch$\n $defaultValueSignal$\n $upgradeAttributes$\n $listBool$\n\n $methods$\n}//todelete for hmr °\n$namespace$\n$tag$\n$exported$\n$definition$\n$namespaceEnd$\n'},t.AventusSimpleWebcomponentTemplate=function(){return"$namespaceStart$$fullname$ = class $classname$ extends $parentClass$ {\n $watchingAttributes$\n\n $getterSetterAttr$\n $getterSetterProp$\n $getterSetterWatch$\n $variables$\n $propertiesChangeCb$\n \n $variablesInViewDynamic$\n $templateAction$\n\n\n $defaultValue$\n $upgradeAttributes$\n $listBool$\n\n constructor() {\n super();\n let template = document.createElement('template');\n template.innerHTML = this.__getHtml();\n let content = template.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n\n let style = new CSSStyleSheet();\n style.replaceSync(this.__getStyle());\n \n const shadowRoot = this.attachShadow({ mode: \"open\" });\n shadowRoot.adoptedStyleSheets = []\n shadowRoot.appendChild(templateContent.cloneNode(true));\n }\n\n __getHtml() {\n return `$html$`;\n }\n\n __getStyle() {\n return `$style$`;\n }\n\n $methods$\n}//todelete for hmr °\n$namespace$\n$tag$\n$exported$\n$definition$\n$namespaceEnd$\n"}},43559:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusWebcomponentCompiler=void 0;const r=n(19408),i=n(1539),s=n(16286),a=n(7635),o=n(79573),l=n(94625),c=n(37439),u=n(22037),p=n(10604),_=n(65887),d=n(91430),h=n(50789),f=n(95553),m=n(90946),g=n(14710),y=n(55969),v=n(89018),$=n(72471),b=n(91562),S=n(48117),x=n(99071),w=n(29383),C=n(47506),E=n(17509),k=n(49507),A=n(92724),T=n(51907),I=n(60206),F=n(66450);t.AventusWebcomponentCompiler=class{static getVersion(e,t){let n,i,s={ts:e.file.documentUser.version,scss:-1,html:-1};return e.file.uri.endsWith(r.AventusExtension.Component)?(n=t.wcFiles[e.file.uri].style,i=t.wcFiles[e.file.uri].view):(n=t.scssFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentStyle)],i=t.htmlFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentView)]),n&&(s.scss=n.compiledVersion),i&&(s.html=i.compiledVersion),s}file;logicalFile;scssTxt="";template;templateHotReload;templateNpm;document;build;fileParsed;classInfo;className="";fullName="";tagName="";htmlParsed;htmlParsedResult;htmlDoc;htmlFile;scssFile;allFields={};methodsName=[];listBoolProperties=[];defaultValueTxt="";defaultValueHotReloadTxt="";defaultValueNpmTxt="";result={diagnostics:[],writeCompiled:!1,missingViewElements:{position:-1,elements:{}},missingMethods:{position:-1,elements:[]},componentName:"",result:[],htmlDoc:{},scssDoc:{},debug:""};componentResult={hotReload:"",compiled:"",docVisible:"",npm:{defTs:"",namespace:"",exportPath:"",uri:"",src:""},docInvisible:"",dependances:[],classScript:"",classDoc:"",debugTxt:"",uri:"",required:!1,type:m.InfoType.class,isExported:{internal:!0,external:!0},convertibleName:"",tagName:"",story:{}};parentClassName="";parentClassNameNpm="";overrideViewDecorator=null;debuggerDecorator=null;extraConstructorCode=[];AventusWebComponent="Aventus.WebComponent";AventusDefaultComponent="Aventus.DefaultComponent";hasStory;constructor(e,t){let n,i;this.logicalFile=e,this.hasStory=t.hasStories,t.isCoreBuild&&(this.AventusDefaultComponent="DefaultComponent",this.AventusWebComponent="WebComponent"),e.file.uri.endsWith(r.AventusExtension.Component)?(this.file=t.wcFiles[e.file.uri].logic.file,n=t.wcFiles[e.file.uri].style,i=t.wcFiles[e.file.uri].view):(this.file=e.file,n=t.scssFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentStyle)],i=t.htmlFiles[e.file.uri.replace(r.AventusExtension.ComponentLogic,r.AventusExtension.ComponentView)]),this.scssFile=n,this.scssTxt=n?n.compileResult:"",this.htmlFile=i,this.htmlFile&&(this.htmlParsed=this.htmlFile.fileParsed,this.htmlFile.tsErrors=[]);let s=t.tsLanguageService.doValidation(this.file),a=this.logicalFile.viewMethodName;for(let e=0;e<s.length;e++)s[e].message.startsWith("'"+a)&&(s.splice(e,1),e--);this.result.diagnostics=s,this.template=(0,o.AventusWebcomponentTemplate)(),this.templateHotReload=(0,o.AventusWebcomponentTemplate)(),t.hasNpmOutput&&(this.templateNpm=(0,o.AventusWebcomponentTemplate)()),this.document=e.file.documentInternal,this.build=t,this.fileParsed=e.fileParsed}compile(){if(this.fileParsed){for(let e in this.fileParsed.aliases)this.result.result.push(c.AventusTsLanguageService.compileTs(this.fileParsed.aliases[e],this.logicalFile));for(let e in this.fileParsed.enums)this.result.result.push(c.AventusTsLanguageService.compileTs(this.fileParsed.enums[e],this.logicalFile));for(let e in this.fileParsed.classes){let t=this.fileParsed.classes[e];if(this.isComponentClassInfo(t))if(null!=this.classInfo){let e="Only one class is allowed inside a file. Get "+t.name+" and "+this.classInfo.name;this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,e,t.nameStart,t.nameEnd,r.AventusErrorCode.MultipleWebComponent)),this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,e,this.classInfo.nameStart,this.classInfo.nameEnd,r.AventusErrorCode.MultipleWebComponent))}else this.classInfo=t;else this.result.result.push(c.AventusTsLanguageService.compileTs(t,this.logicalFile))}}if(this.classInfo){this.logicalFile.build.addNamespace(this.classInfo.namespace),this.compileComponentClassInfo(),this.result.htmlDoc=this.htmlDoc??{},this.result.scssDoc=this.prepareDocSCSS(),this.result.componentName=this.className,this.result.writeCompiled=null!==this.debuggerDecorator&&this.debuggerDecorator.writeCompiled;for(let e of this.result.result)e.debugTxt&&(this.result.debug+=e.debugTxt+u.EOL);if(this.htmlParsed&&this.hasStory&&this.classInfo.storieContent){let e=this.classInfo.storieContent;delete e.slots;const t=[];this.classInfo.storieDecorator?.slots?.inject&&this.classInfo.storieDecorator.slots.inject;for(let e in this.htmlParsed.slotsInfo){const n={name:e};this.storyArgTypes["@"+e]={control:"text",table:{category:"Slot"}},this.classInfo.documentation?.documentationSlots[e]&&(n.documentation=this.classInfo.documentation.documentationSlots[e],this.storyArgTypes["@"+e].description=n.documentation),this.classInfo.storieDecorator?.slots?.values&&this.classInfo.storieDecorator.slots.values[e]?this.storyArgs["@"+e]=this.classInfo.storieDecorator.slots.values[e].slice(1,-1):this.storyArgs["@"+e]="",t.push(n)}this.classInfo.loadStoryBookInject(),t.length>0&&(e.slots=t)}}else this.result.diagnostics.push((0,i.createErrorTs)(this.document,"Can't found a web component class to compile inside",r.AventusErrorCode.NoWebComponent));return this.result}isComponentClassInfo(e){return!(!(e instanceof _.ClassInfo&&e.implements.includes(this.AventusDefaultComponent))||e.isInterface)}compileComponentClassInfo(){if(this.classInfo){this.prepareComponentClassInfo(this.classInfo);let e=c.AventusTsLanguageService.compileTs(this.classInfo,this.logicalFile);this.componentResult.classScript=e.classScript,this.componentResult.classDoc=e.classDoc,this.componentResult.dependances=e.dependances,this.componentResult.docInvisible=e.docInvisible,this.componentResult.docVisible=e.docVisible,this.componentResult.npm=e.npm,this.componentResult.type=e.type,this.componentResult.isExported=e.isExported,this.componentResult.uri=e.uri,this.prepareHTMLDocObject(),this.loadParent(this.classInfo),this.addViewElementToDependance(),this.writeFile(),this.classInfo.isAbstract||this.classInfo.isInterface||(this.componentResult.tagName=this.tagName),this.componentResult.compiled=this.template.replace("//todelete for hmr °",""),this.componentResult.npm.src=this.templateNpm?.replace("//todelete for hmr °","")??"",I.HttpServer.isRunning&&(this.componentResult.hotReload=this.templateHotReload.split("//todelete for hmr °")[0],this.componentResult.hotReload=this.componentResult.hotReload.slice(this.componentResult.hotReload.indexOf("=")+1)),this.debuggerDecorator&&this.debuggerDecorator.writeCompiled&&(this.componentResult.debugTxt=this.componentResult.compiled),this.result.result.push(this.componentResult)}}prepareComponentClassInfo(e){for(let t of e.decorators){let e=d.OverrideViewDecorator.is(t);if(e){this.overrideViewDecorator=e;continue}let n=h.DebuggerDecorator.is(t);if(n){this.debuggerDecorator=n;continue}let s=f.TagNameDecorator.is(t);s&&s.tagName?-1==s.tagName.indexOf("-")||s.tagName.toLowerCase()!=s.tagName?this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"tag name must be in lower case and have a - inside",t.contentStart,t.contentEnd,r.AventusErrorCode.TagLower)):this.tagName=s.tagName:S.RequiredDecorator.is(t)&&(this.componentResult.required=!0)}e.extends.length>0&&e.extends[0]==this.AventusWebComponent&&(this.overrideViewDecorator=new d.OverrideViewDecorator),this.getClassName(e),this.htmlParsed&&(this.htmlParsedResult=this.htmlParsed.getParsedInfo(this.className))}prepareHTMLDocObject(){this.classInfo&&!this.classInfo.isAbstract&&(this.htmlDoc={[this.tagName]:{class:this.classInfo.fullName,name:this.tagName,description:this.classInfo.documentation?.fullDefinitions.join(u.EOL)??"",attributes:{}}})}getClassName(e){let t=e.name.match(/([A-Z][a-z]*)|([0-9]+[a-z]*)/g);if(t){let n=this.build.getComponentPrefix().split("-");for(let e=0;e<n.length;e++){let r=n[e];if(r.length>0&&t[e].toLowerCase()!=r.toLowerCase()){t.splice(0,0,n.join("-").toLowerCase());break}}""==this.tagName&&(this.tagName=t.join("-").toLowerCase()),this.className=e.name,this.fullName=e.fullName,this.parentClassName="Aventus.WebComponent",this.parentClassNameNpm=this.build.getNpmReplacementName([this.build.module,this.fullName].join("."),"Aventus.WebComponent"),e.extends.length>0&&e.extends[0]&&(this.parentClassName=e.extends[0],this.parentClassNameNpm=e.extendsNpm[0])}}loadParent(e,t=!0){let n=this.loadFields(e,t);this.allFields={...n,...this.allFields};for(let t in e.methods)this.methodsName.includes(t)||this.methodsName.push(t);if(e.extends.length>0&&e.extends[0]!=this.AventusWebComponent){let t=e.parentClass;t?this.loadParent(t,!1):this.classInfo&&this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"can't found the path for parent "+e.extends[0],this.classInfo.nameStart,this.classInfo.nameEnd,r.AventusErrorCode.ParsingParentFailed))}}loadFields(e,t){let n={};for(let r in e.properties){let i=e.properties[r];if(this.allFields[i.name])continue;let s=!1,o=new a.CustomFieldModel(i.prop,i.isInsideInterface,e);for(let e of i.decorators){if(["Attribute","Property","Watch","Signal","ViewElement"].includes(e.name)&&(o.propType=e.name,s=!0),s){n[i.name]=o,o.inParent=!t;break}}s||(o.propType="Simple",o.inParent=!t,n[r]=o)}return n}addViewElementToDependance(){if(this.htmlParsed&&this.htmlFile&&this.classInfo){this.logicalFile.resetViewClassInfoDep();let e=[],t={};for(let n of this.htmlParsed.interestPoints)if("tag"==n.type){if(e.includes(n.name)||(e.push(n.name),this.classInfo.addDependanceTag(n.name,this.componentResult)),!t.hasOwnProperty(n.name)){let e=this.build.getWebComponentDefinitionFile(n.name);e instanceof s.AventusWebComponentLogicalFile?t[n.name]=e:t[n.name]=null}let r=t[n.name];r&&this.logicalFile.addViewClassInfoDep(r,n.start,n.end)}}}writeFile(){this.writeFileName(),this.writeFileTemplateHtml(),this.writeFileReplaceVar("style",this.scssTxt),this.writeFileHotReloadReplaceVar("style",this.scssTxt),this.writeFileNpmReplaceVar("style",this.scssTxt),this.writeFileFields(),this.writeFileMethods(),this.writeWatchableElements(),this.writeFileConstructor(),this.template=this.template.replace(/\|\!\*(.*?)\*\!\|/g,"{{$1}}"),this.template=this.removeWhiteSpaceLines(this.template),this.templateHotReload=this.templateHotReload.replace(/\|\!\*(.*?)\*\!\|/g,"{{$1}}"),this.templateHotReload=this.removeWhiteSpaceLines(this.templateHotReload),this.templateNpm&&(this.templateNpm=this.templateNpm.replace(/\|\!\*(.*?)\*\!\|/g,"{{$1}}"),this.templateNpm=this.removeWhiteSpaceLines(this.templateNpm))}writeFileName(){this.writeFileReplaceVar("classname",this.className),this.writeFileHotReloadReplaceVar("classname",this.className),this.writeFileNpmReplaceVar("classname",this.className),this.writeFileReplaceVar("parentClass",this.parentClassName),this.writeFileHotReloadReplaceVar("parentClass",this.parentClassName),this.writeFileNpmReplaceVar("parentClass",this.parentClassNameNpm);let e=this.build.module;if(this.fullName.includes(".")){this.writeFileReplaceVar("fullname",this.fullName),this.writeFileHotReloadReplaceVar("fullname",this.fullName),this.writeFileNpmReplaceVar("fullname","const "+this.className);let t="."+this.classInfo?.namespace;this.writeFileReplaceVar("namespace",this.fullName+".Namespace=`"+e+t+"`;"),this.writeFileHotReloadReplaceVar("namespace",this.fullName+".Namespace=`"+e+t+"`;"),this.writeFileNpmReplaceVar("namespace",this.className+".Namespace=`"+e+t+"`;")}else this.writeFileReplaceVar("fullname","const "+this.fullName),this.writeFileHotReloadReplaceVar("fullname","const "+this.fullName),this.writeFileNpmReplaceVar("fullname","const "+this.fullName),this.writeFileReplaceVar("namespace",this.fullName+".Namespace=`"+e+"`;"),this.writeFileHotReloadReplaceVar("namespace",this.fullName+".Namespace=`"+e+"`;"),this.writeFileNpmReplaceVar("namespace",this.className+".Namespace=`"+e+"`;");if(this.classInfo?.isAbstract?(this.writeFileReplaceVar("tag",""),this.writeFileHotReloadReplaceVar("tag",""),this.writeFileNpmReplaceVar("tag","")):(this.writeFileReplaceVar("tag",this.fullName+".Tag=`"+this.tagName+"`;"),this.writeFileHotReloadReplaceVar("tag",this.fullName+".Tag=`"+this.tagName+"`;"),this.writeFileNpmReplaceVar("tag",this.className+".Tag=`"+this.tagName+"`;")),this.build.namespaces.includes(this.fullName)?(this.writeFileReplaceVar("namespaceStart","_n = "+this.fullName+";"+u.EOL),this.writeFileHotReloadReplaceVar("namespaceStart","_n = "+this.fullName+";"+u.EOL),this.writeFileNpmReplaceVar("namespaceStart","_n = "+this.fullName+";"+u.EOL),this.writeFileReplaceVar("namespaceEnd",u.EOL+"Object.assign("+this.fullName+", _n);"+u.EOL),this.writeFileHotReloadReplaceVar("namespaceEnd",u.EOL+"Object.assign("+this.fullName+", _n);"+u.EOL),this.writeFileNpmReplaceVar("namespaceEnd",u.EOL+"Object.assign("+this.fullName+", _n);"+u.EOL)):(this.writeFileReplaceVar("namespaceStart",""),this.writeFileHotReloadReplaceVar("namespaceStart",""),this.writeFileNpmReplaceVar("namespaceStart",""),this.writeFileReplaceVar("namespaceEnd",""),this.writeFileHotReloadReplaceVar("namespaceEnd",""),this.writeFileNpmReplaceVar("namespaceEnd","")),this.classInfo?.isExported?(this.writeFileReplaceVar("exported","_."+this.fullName+"="+this.fullName+";"),this.writeFileHotReloadReplaceVar("exported","_."+this.fullName+"="+this.fullName+";")):(this.writeFileReplaceVar("exported",""),this.writeFileHotReloadReplaceVar("exported","")),this.writeFileNpmReplaceVar("exported",""),this.classInfo?.isAbstract)this.writeFileReplaceVar("definition",""),this.writeFileHotReloadReplaceVar("definition",""),this.writeFileNpmReplaceVar("definition",""),this.writeFileReplaceVar("customImport",""),this.writeFileHotReloadReplaceVar("customImport",""),this.writeFileNpmReplaceVar("customImport","");else{let e=this.build.isCoreBuild?"":"Aventus.";if(this.writeFileReplaceVar("definition","if(!window.customElements.get('"+this.tagName+"')){window.customElements.define('"+this.tagName+"', "+this.fullName+");"+e+"WebComponentInstance.registerDefinition("+this.fullName+");}"),this.writeFileHotReloadReplaceVar("definition","if(!window.customElements.get('"+this.tagName+"')){window.customElements.define('"+this.tagName+"', "+this.fullName+");"+e+"WebComponentInstance.registerDefinition("+this.fullName+");}"),this.templateNpm&&this.fileParsed){const e=this.build.getNpmReplacementName("","Aventus.WebComponentInstance");this.writeFileNpmReplaceVar("definition","if(!window.customElements.get('"+this.tagName+"')){window.customElements.define('"+this.tagName+"', "+this.className+");"+e+".registerDefinition("+this.className+");}"),this.fileParsed.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"WebComponentInstance",compiled:!0,alias:e,forced:!1})}}}writeFileTemplateHtml(){let e="";if(this.htmlParsed){let t=this.htmlParsed.getSlotsInfoTxt(),n=this.htmlParsed.getBlocksInfoTxt();if(t.length+n.length>0){let r=u.EOL+"super.__getHtml();",i="",s="";t.length>0&&(i=`slots: { ${t} },`),n.length>0&&(s=`blocks: { ${n} }`),this.overrideViewDecorator&&(r=""),e=`__getHtml() {${r}\n this.__getStatic().__template.setHTML({\n ${i} \n ${s}\n });\n}`}}this.writeFileReplaceVar("slotBlock",e),this.writeFileHotReloadReplaceVar("slotBlock",e),this.writeFileNpmReplaceVar("slotBlock",e)}writeFileConstructor(){if(this.classInfo){const e=this.classInfo,t=t=>{let n="";return t.length>0&&(n="constructor() "+t),e.isAbstract&&(n.length>0?(n=n.slice(0,n.length-1),n+=u.EOL+"if (this.constructor == "+this.className+') { throw "can\'t instanciate an abstract class"; }',n+=" }"):n="constructor() { super(); if (this.constructor == "+this.className+') { throw "can\'t instanciate an abstract class"; } }'),this.extraConstructorCode.length>0&&(n.length>0?(n=n.slice(0,n.length-1),n+=u.EOL+this.extraConstructorCode.join(u.EOL),n+=" }"):n="constructor() { super(); "+u.EOL+this.extraConstructorCode.join(u.EOL)+" }"),n};this.writeFileReplaceVar("constructor",t(this.classInfo.constructorContent)),this.writeFileHotReloadReplaceVar("constructor",t(this.classInfo.constructorContentHotReload)),this.writeFileNpmReplaceVar("constructor",t(this.classInfo.constructorContentNpm))}}viewsElements={};upgradeAttributes="";storyArgTypes={};storyArgs={};addStoryField(e){if("Simple"==e.propType)return;if(!this.hasStory||!this.classInfo?.storieContent)return;let t="";if("Attribute"==e.propType?t="Attributes":"Property"==e.propType?t="Properties":"Watch"==e.propType?t="Watches":"Signal"==e.propType&&(t="Signals"),"class"==this.classInfo.storieContent.kind){const t=this.classInfo.storieContent,n=t.properties?.find((t=>t.name==e.name));n&&(n.modifiers?n.modifiers.includes(e.propType)||n.modifiers.push(e.propType):n.modifiers=[e.propType])}if("ViewElement"==e.propType)return;let n=e.type;if(!n)return;let r,i="text",s=[],a=e.defaultValue??void 0;const o=e=>{if("string"==e.kind)i="text",r="string";else if("literal"==e.kind){i="select";let t=e.value;(t.startsWith("'")||t.startsWith('"'))&&(t=t.substring(1)),(t.endsWith("'")||t.endsWith('"'))&&(t=t.substring(0,t.length-1)),s.push(t),r="string"}else if("union"==e.kind){i="select";for(let t of e.nested){let e=t.value;(e.startsWith("'")||e.startsWith('"'))&&(e=e.substring(1)),(e.endsWith("'")||e.endsWith('"'))&&(e=e.substring(0,e.length-1)),s.push(e)}r="string"}else if("number"==e.kind)i="number",r="number";else if("boolean"==e.kind)i="boolean",r="boolean";else if("type"==e.kind)if("Date"==e.value||"DateTime"==e.value)i="date";else{let t=p.ParserTs.getBaseInfo(e.value);t&&t instanceof x.AliasInfo?o(t.type):i="object"}else i="object"};o(n),this.storyArgTypes[e.name]={control:i,table:{category:t}},r&&(this.storyArgTypes[e.name].type=r),s.length>0&&(this.storyArgTypes[e.name].options=s),null!==e.defaultValueStory&&(a=e.defaultValueStory),this.storyArgs[e.name]=a}writeFileFields(){let e=[],t=[],n=[],s=[],a=[],o={};for(let l in this.allFields){let c=this.allFields[l];if(c.inParent)"Attribute"!=c.propType&&"Property"!=c.propType||this.createHtmlDoc(c,c.type);else if(this.addStoryField(c),"Attribute"!=c.propType)if("Property"!=c.propType)if("Signal"!=c.propType)if("Watch"==c.propType)for(let e of c.decorators){let t=w.WatchDecorator.is(e);t&&a.push({field:c,fctTxt:t.fctTxt})}else"ViewElement"==c.propType?(o[c.name]=c,c.overrideNullable||this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add ! after the name to avoid undefined value",c.nameStart,c.nameEnd,r.AventusErrorCode.ExclamationMarkMissing))):"Simple"==c.propType&&e.push(c);else for(let e of c.decorators){let t=F.SignalDecorator.is(e);t&&s.push({field:c,fctTxt:t.fctTxt})}else for(let e of c.decorators){let t=g.PropertyDecorator.is(e);t&&n.push({field:c,fctTxt:t.fctTxt})}else t.push(c)}if(this.viewsElements=o,this.writeFileFieldsSimpleVariable(e),this.writeFileFieldsAttribute(t),this.writeFileFieldsProperty(n),this.writeFileFieldsSignal(s),this.writeFileFieldsWatch(a),this.upgradeAttributes.length>0&&(this.upgradeAttributes=`__upgradeAttributes() { super.__upgradeAttributes(); ${this.upgradeAttributes} }`),this.writeFileReplaceVar("upgradeAttributes",this.upgradeAttributes),this.writeFileHotReloadReplaceVar("upgradeAttributes",this.upgradeAttributes),this.writeFileNpmReplaceVar("upgradeAttributes",this.upgradeAttributes),this.htmlParsedResult){this.writeViewInfo(this.htmlParsedResult,!0);for(let e in o)this.createUnusedViewElement(o[e])}else this.writeFileReplaceVar("templateAction",""),this.writeFileHotReloadReplaceVar("templateAction",""),this.writeFileNpmReplaceVar("templateAction",""),this.writeFileReplaceVar("variablesInViewDynamic",""),this.writeFileHotReloadReplaceVar("variablesInViewDynamic",""),this.writeFileNpmReplaceVar("variablesInViewDynamic","");this.writeViewGlobalVariables()}writeFileFieldsSimpleVariable(e){if(!this.htmlParsedResult)return this.writeFileReplaceVar("variables",""),this.writeFileHotReloadReplaceVar("variables",""),void this.writeFileNpmReplaceVar("variables","");let t="",n="",r="",i=[],s="",a="",o="";if(this.classInfo)for(let e in this.classInfo.propertiesStatic){let t=this.classInfo.propertiesStatic[e];s+=t.compiledContent+u.EOL,a+=t.compiledContentHotReload+u.EOL,this.templateNpm&&(o+=t.compiledContentNpm+u.EOL)}for(let t of e)s+=t.compiledContent+u.EOL,a+=t.compiledContentHotReload+u.EOL,this.templateNpm&&(o+=t.compiledContentNpm+u.EOL),(t.isGet||t.isSet)&&(i.includes(t.name)||(i.push(t.name),this.upgradeAttributes+="this.__correctGetter('"+t.name+"');"+u.EOL));let p=`class MyCompilationClassAventus {${s}}`,_="";try{_=(0,l.transpile)(p,c.AventusTsLanguageService.getCompilerOptionsCompile())}catch(e){}let d=/\{((\s|\S)*)\}/gm.exec(_);if(d&&(t=d[1].trim()),this.writeFileReplaceVar("variables",t),I.HttpServer.isRunning){let e=`class MyCompilationClassAventus {${a}}`,t="";try{t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile())}catch(e){}let r=/\{((\s|\S)*)\}/gm.exec(t);r&&(n=r[1].trim()),this.writeFileHotReloadReplaceVar("variables",n)}if(this.templateNpm){let e=`class MyCompilationClassAventus {${o}}`,t="";try{t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile())}catch(e){}let n=/\{((\s|\S)*)\}/gm.exec(t);n&&(r=n[1].trim()),this.writeFileNpmReplaceVar("variables",r)}}getGetterAndSetter(e,t,n){let r="",i=e.name,s=n?"Prop":"Attr";return"string"==t.kind||"literal"==t.kind||"union"==t.kind?r+=`get '${i}'() { return this.getString${s}('${i}') }\n set '${i}'(val) { this.setStringAttr('${i}', val) }${u.EOL}`:"number"==t.kind?r+=`get '${i}'() { return this.getNumber${s}('${i}') }\n set '${i}'(val) { this.setNumberAttr('${i}', val) }${u.EOL}`:"boolean"==t.kind?(this.listBoolProperties.push('"'+i+'"'),r+=`get '${i}'() { return this.getBool${s}('${i}') }\n set '${i}'(val) { this.setBoolAttr('${i}', val) }${u.EOL}`):"type"===t.kind&&"Date"==t.value?r+=`get '${i}'() { return this.getDate${s}('${i}') }\n set '${i}'(val) { this.setDateAttr('${i}', val) }${u.EOL}`:"type"===t.kind&&"DateTime"==t.value&&(r+=`get '${i}'() { return this.getDateTime${s}('${i}') }\n set '${i}'(val) { this.setDateTimeAttr('${i}', val) }${u.EOL}`),r}getDefaultValueAttr(e,t,n){let r="",i=e.name,s=null;return 1==n?s=e.defaultValue:2==n?s=e.defaultValueHotReload:3==n&&(s=e.defaultValueNpm),"boolean"==t.kind?r+=null!==s&&"false"!==s?"if(!this.hasAttribute('"+i+"')) {this.setAttribute('"+i+"' ,'true'); }"+u.EOL:"if(!this.hasAttribute('"+i+"')) { this.attributeChangedCallback('"+i+"', false, false); }"+u.EOL:("type"!=t.kind||"Date"!=t.value&&t.value,r+=null!==s?"if(!this.hasAttribute('"+i+"')){ this['"+i+"'] = "+s+"; }"+u.EOL:"if(!this.hasAttribute('"+i+"')){ this['"+i+"'] = undefined; }"+u.EOL),r}writeFileFieldsAttribute(e){let t="",n="",r="",i="";for(let s of e){let e=this.validateTypeForProp(this.document,s);e&&(t+=this.getDefaultValueAttr(s,e,1),n+=this.getGetterAndSetter(s,e,!1),this.createHtmlDoc(s,e),this.upgradeAttributes+="this.__upgradeProperty('"+s.name.toLowerCase()+"');"+u.EOL,I.HttpServer.isRunning&&(r+=this.getDefaultValueAttr(s,e,2)),this.templateNpm&&(i+=this.getDefaultValueAttr(s,e,3)))}t.length>0&&(this.defaultValueTxt+=t),r.length>0&&(this.defaultValueHotReloadTxt+=r),i.length>0&&(this.defaultValueNpmTxt+=i),this.writeFileReplaceVar("getterSetterAttr",n),this.writeFileHotReloadReplaceVar("getterSetterAttr",n),this.writeFileNpmReplaceVar("getterSetterAttr",n)}writeFileFieldsProperty(e){let t="",n="",r="",i=[],s="",a="";for(let o of e){let e=o.field,l=this.validateTypeForProp(this.document,e);if(l){if(t+=this.getDefaultValueAttr(e,l,1),n+=this.getGetterAndSetter(e,l,!0),this.createHtmlDoc(e,l),this.upgradeAttributes+="this.__upgradeProperty('"+e.name.toLowerCase()+"');"+u.EOL,i.push(e.name.toLowerCase()),o.fctTxt){let t=this.transpileMethodNoRun(o.fctTxt);r+=`this.__addPropertyActions("${e.name}", ${t});`+u.EOL}I.HttpServer.isRunning&&(s+=this.getDefaultValueAttr(e,l,2)),this.templateNpm&&(a+=this.getDefaultValueAttr(e,l,3))}}t.length>0&&(this.defaultValueTxt+=t),s.length>0&&(this.defaultValueHotReloadTxt+=s),a.length>0&&(this.defaultValueNpmTxt+=a),this.writeFileReplaceVar("getterSetterProp",n),this.writeFileHotReloadReplaceVar("getterSetterProp",n),this.writeFileNpmReplaceVar("getterSetterProp",n),r.length>0&&(r=`__registerPropertiesActions() { super.__registerPropertiesActions(); ${r} }`),this.writeFileReplaceVar("propertiesChangeCb",r),this.writeFileHotReloadReplaceVar("propertiesChangeCb",r),this.writeFileNpmReplaceVar("propertiesChangeCb",r);let o="";i.length>0&&(o='"'+i.join('", "')+'"',o=`static get observedAttributes() {return [${o}].concat(super.observedAttributes).filter((v, i, a) => a.indexOf(v) === i);}`),this.writeFileReplaceVar("watchingAttributes",o),this.writeFileHotReloadReplaceVar("watchingAttributes",o),this.writeFileNpmReplaceVar("watchingAttributes",o)}writeFileFieldsSignal(e){let t="",n="",r="",i="",s="",a="";for(let o of e){let e=o.field;if(o.fctTxt){let t=this.transpileMethodNoRun(o.fctTxt);n+=`this.__addSignalActions("${e.name}", ${t});`+u.EOL}r+=`this.__signals["${e.name}"] = null;`+u.EOL,t+=`get '${e.name}'() {\n\t\t\t\t\t\treturn this.__signals["${e.name}"].value;\n\t\t\t\t\t}\n\t\t\t\t\tset '${e.name}'(val) {\n\t\t\t\t\t\tthis.__signals["${e.name}"].value = val;\n\t\t\t\t\t}`+u.EOL,i+=`s["${e.name}"] = ${e.defaultValue?.replace(/\\"/g,"")};`+u.EOL,this.upgradeAttributes+="this.__correctGetter('"+e.name+"');"+u.EOL,I.HttpServer.isRunning&&(s+=`s["${e.name}"] = ${e.defaultValueHotReload?.replace(/\\"/g,"")};`+u.EOL),this.templateNpm&&(a+=`s["${e.name}"] = ${e.defaultValueNpm?.replace(/\\"/g,"")};`+u.EOL)}i.length>0&&(i=`__defaultValuesSignal(s) { super.__defaultValuesSignal(s); ${i} }`),this.writeFileReplaceVar("defaultValueSignal",i),s.length>0&&(s=`__defaultValuesSignal(s) { super.__defaultValuesSignal(s); ${s} }`),this.writeFileHotReloadReplaceVar("defaultValueSignal",s),a.length>0&&(a=`__defaultValuesSignal(s) { super.__defaultValuesSignal(s); ${a} }`),this.writeFileNpmReplaceVar("defaultValueSignal",a),r.length>0&&(r=`__registerSignalsActions() { ${r} super.__registerSignalsActions(); ${n} }`),this.writeFileReplaceVar("registerSignal",r),this.writeFileHotReloadReplaceVar("registerSignal",r),this.writeFileNpmReplaceVar("registerSignal",r),this.writeFileReplaceVar("getterSetterSignal",t),this.writeFileHotReloadReplaceVar("getterSetterSignal",t),this.writeFileNpmReplaceVar("getterSetterSignal",t)}writeFileFieldsWatch(e){let t="",n="",r="",i="";for(let s of e){let e=s.field;s.fctTxt?this.watchProperties[e.name]=this.transpileMethodNoRun(s.fctTxt):this.watchProperties[e.name]="",t+=`get '${e.name}'() {\n\t\t\t\t\t\treturn this.__watch["${e.name}"];\n\t\t\t\t\t}\n\t\t\t\t\tset '${e.name}'(val) {\n\t\t\t\t\t\tthis.__watch["${e.name}"] = val;\n\t\t\t\t\t}`+u.EOL,n+=`w["${e.name}"] = ${e.defaultValue?.replace(/\\"/g,"")};`+u.EOL,this.upgradeAttributes+="this.__correctGetter('"+e.name+"');"+u.EOL,I.HttpServer.isRunning&&(r+=`w["${e.name}"] = ${e.defaultValueHotReload?.replace(/\\"/g,"")};`+u.EOL),this.templateNpm&&(i+=`w["${e.name}"] = ${e.defaultValueNpm?.replace(/\\"/g,"")};`+u.EOL)}n.length>0&&(n=`__defaultValuesWatch(w) { super.__defaultValuesWatch(w); ${n} }`),this.writeFileReplaceVar("defaultValueWatch",n),r.length>0&&(r=`__defaultValuesWatch(w) { super.__defaultValuesWatch(w); ${r} }`),this.writeFileHotReloadReplaceVar("defaultValueWatch",r),i.length>0&&(i=`__defaultValuesWatch(w) { super.__defaultValuesWatch(w); ${i} }`),this.writeFileNpmReplaceVar("defaultValueWatch",i),this.writeFileReplaceVar("getterSetterWatch",t),this.writeFileHotReloadReplaceVar("getterSetterWatch",t),this.writeFileNpmReplaceVar("getterSetterWatch",t)}writeViewGlobalVariables(){let e="";if(this.defaultValueTxt.length>0&&(e=`__defaultValues() { super.__defaultValues(); ${this.defaultValueTxt} }`),this.writeFileReplaceVar("defaultValue",e),I.HttpServer.isRunning){let e="";this.defaultValueHotReloadTxt.length>0&&(e=`__defaultValues() { super.__defaultValues(); ${this.defaultValueHotReloadTxt} }`),this.writeFileHotReloadReplaceVar("defaultValue",e)}if(this.templateNpm){let e="";this.defaultValueNpmTxt.length>0&&(e=`__defaultValues() { super.__defaultValues(); ${this.defaultValueNpmTxt} }`),this.writeFileNpmReplaceVar("defaultValue",e)}let t="";this.listBoolProperties.length>0&&(t=`__listBoolProps() { return [${this.listBoolProperties.join(",")}].concat(super.__listBoolProps()).filter((v, i, a) => a.indexOf(v) === i); }`),this.writeFileReplaceVar("listBool",t),this.writeFileHotReloadReplaceVar("listBool",t),this.writeFileNpmReplaceVar("listBool",t)}writeFileMethods(){try{let e={},t="",n="",r="",i="";if(this.classInfo){let s="",a="",o="";const p=[...Object.values(this.classInfo.methods),...Object.values(this.classInfo.methodsStatic)];for(let t of p){if(!t.mustBeCompiled)continue;let n=t.name;if(s+=t.compiledContent+u.EOL,I.HttpServer.isRunning&&(a+=t.compiledContentHotReload+u.EOL),this.templateNpm&&(o+=t.compiledContentNpm+u.EOL),!t.isStatic)for(let r of t.decorators){if(A.BindThisDecorator.is(r)){this.extraConstructorCode.push(`this.${n}=this.${n}.bind(this)`);continue}let s=T.EffectDecorator.is(r);if(s){this.watchFunctions[n]=s.options;continue}let a,o,l=null,c=v.StateChangeDecorator.is(r);if(c)l=c;else{let e=$.StateActiveDecorator.is(r);if(e)l=e;else{let e=b.StateInactiveDecorator.is(r);e&&(l=e)}}null!==l?r.arguments.length>0&&(e[l.stateName]||(e[l.stateName]={}),e[l.stateName][l.managerName]||(e[l.stateName][l.managerName]={active:[],inactive:[],askChange:[]}),e[l.stateName][l.managerName][l.functionName].push(t.name)):(a=E.DefaultStateActiveDecorator.is(r))?i+=`this.__addActiveDefState(${a.managerName}, this.${t.name});`+u.EOL:(o=k.DefaultStateInactiveDecorator.is(r))&&(i+=`this.__addInactiveDefState(${o.managerName}, this.${t.name});`+u.EOL)}}let _=`class MyCompilationClassAventus {${s}}`,d=(0,l.transpile)(_,c.AventusTsLanguageService.getCompilerOptionsCompile()),h=/\{((\s|\S)*)\}/gm.exec(d);if(h&&(t=h[1].trim()),I.HttpServer.isRunning){let e=`class MyCompilationClassAventus {${a}}`,t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile()),r=/\{((\s|\S)*)\}/gm.exec(t);r&&(n=r[1].trim())}if(this.templateNpm){let e=`class MyCompilationClassAventus {${o}}`,t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile()),n=/\{((\s|\S)*)\}/gm.exec(t);n&&(r=n[1].trim())}}this.writeFileReplaceVar("methods",t),this.writeFileHotReloadReplaceVar("methods",n),this.writeFileNpmReplaceVar("methods",r);let s="";for(let t in e)for(let n in e[t]){let r=e[t][n];if(s+=`this.__createStatesList(${t}, ${n});`,r.active.length>0){let e="";for(let t of r.active)e+="that."+t+"(state, slugs);";s+=`this.__addActiveState(${t}, ${n}, (state, slugs) => { that.__inactiveDefaultState(${n}); ${e}})`+u.EOL}if(r.inactive.length>0){let e="";for(let t of r.inactive)e+="that."+t+"(state, nextState, slugs);";s+=`this.__addInactiveState(${t}, ${n}, (state, nextState, slugs) => { ${e}that.__activeDefaultState(nextState, ${n});})`+u.EOL}if(r.askChange.length>0){let e="";for(let t of r.askChange)e+="if(!await that."+t+"(state, nextState, slugs)){return false;}"+u.EOL;s+=`this.__addAskChangeState(${t}, ${n}, async (state, nextState, slugs) => { ${e} return true;})`+u.EOL}}(s.length>0||i.length>0)&&(s=`__createStates() { super.__createStates(); let that = this; ${i} ${s} }`),this.writeFileReplaceVar("states",s),this.writeFileHotReloadReplaceVar("states",s),this.writeFileNpmReplaceVar("states",s)}catch(e){}}variablesInViewDynamic="";writeViewInfo(e,t,n,s){const a={};let o="",l="",c=e.elements,p=[];for(let e of c){let n=e.name;if(this.allFields[n]){let s=this.allFields[n];if("ViewElement"==s.propType){e.useLive=!t;for(let t of s.decorators){let n=y.ViewElementDecorator.is(t);if(n&&void 0!==n.useLive){e.useLive=n.useLive;break}}if(e.useLive){let t=e.ids.map((e=>`[_id="${e}"]`)).join("|");s.type.isArray||e.isArray?this.variablesInViewDynamic+=`get ${n} () { var list = Array.from(this.shadowRoot.querySelectorAll('${t}')); return list; }`+u.EOL:this.variablesInViewDynamic+=`get ${n} () { return this.shadowRoot.querySelector('${t}'); }`+u.EOL}else e.isArray?p.push({name:e.name,ids:e.ids,isArray:!0}):p.push({name:e.name,ids:e.ids})}else this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add the decorator @ViewElement for "+n,s.nameStart,s.nameEnd,r.AventusErrorCode.MissingViewElement));delete this.viewsElements[n]}else this.createMissingViewElement(e)}p.length>0&&(a.elements=p);let _=e.content,d={};for(let e in _)d[e]={fct:`@_@${_[e].fct}@_@`},_[e].once&&(d[e].once=!0);Object.keys(d).length>0&&(a.content=d),e.injection.length>0&&(a.injection=e.injection);let h=e.bindings,f=[];for(let e of h){let t={id:e.id,injectionName:e.injectionName,eventNames:e.eventNames,inject:e.inject,extract:e.extract};if(e.once&&(t.once=e.once),1==e.eventNames.length&&e.tagName){let n=this.build.getWebComponentDefinition(e.tagName);if(n){let r=this.isCallback(n.class,e.eventNames[0]);null!=r&&(t.isCallback=!0,t.eventNames[0]=r)}}f.push(t)}f.length>0&&(a.bindings=f);let m=[];for(let t of e.events)if(this.methodsName.includes(t.fct)){let e={eventName:t.eventName,id:t.id,fct:`@_@(e, c) => c.comp.${t.fct}(e)@_@`};if(t.tagName){let n=this.build.getWebComponentDefinition(t.tagName);if(n){let r=this.isCallback(n.class,t.eventName);null!=r&&(e.isCallback=!0,e.eventName=r,e.fct=`@_@(c, ...args) => c.comp.${t.fct}.apply(c.comp, ...args)@_@`)}}m.push(e)}else t.position&&this.createMissingMethod(t.fct,t.position.start,t.position.end);m.length>0&&(a.events=m);let g=[],v=[C.pressEventMap["@dblpress"],C.pressEventMap["@drag"],C.pressEventMap["@drag-end"],C.pressEventMap["@drag-start"],C.pressEventMap["@longpress"],C.pressEventMap["@press"],C.pressEventMap["@press-start"],C.pressEventMap["@press-stop"]],$=[C.pressEventMap["@dblpress-delay"],C.pressEventMap["@longpress-delay"]];for(let t of e.pressEvents){let e={id:t.id};for(let n in t){let r=t[n];r instanceof Object&&(v.includes(n)?this.methodsName.includes(r.value)?e[n]=`@_@(e, pressInstance, c) => { c.comp.${r.value}(e, pressInstance); }@_@`:this.createMissingMethod(r.value,r.start,r.end):$.includes(n)&&(e[n]=`@_@${r.value}@_@`))}g.push(e)}if(g.length>0&&(a.pressEvents=g),e.contextEdits.length>0&&(a.contextEdits=e.contextEdits),Object.keys(a).length>0||n||s){let e=JSON.stringify(a,null,2).replace(/"@_@(.*?)@_@"/g,"$1").replace(/\\"/g,'"');if(t)o=`this.__getStatic().__template.setActions(${e});`+u.EOL;else if(n){o=`const templ${n.templateId} = new Aventus.Template(this);`+u.EOL,o+=`templ${n.templateId}.setTemplate(\`${n.template}\`);`+u.EOL,Object.keys(a).length>0&&(o+=`templ${n.templateId}.setActions(${e});`+u.EOL);o+=`${void 0===n.parentId?"this.__getStatic().__template":`templ${n.parentId}`}.addLoop({\n anchorId: '${n.anchorId}',\n template: templ${n.templateId},\n `,n.simple?(o+=`simple:{data: "${n.simple.data.replace(/[\!|\?]/g,"")}"`,n.simple.index&&(o+=`,index:"${n.simple.index.replace(/[\!|\?]/g,"")}"`),n.simple.item&&(o+=`,item:"${n.simple.item.replace(/[\!|\?]/g,"")}"`),o+="}"+u.EOL):o+=`func: ${n.func}`+u.EOL,o+="});"+u.EOL}else s&&(o=`const templ${s.templateId} = new Aventus.Template(this);`+u.EOL,o+=`templ${s.templateId}.setTemplate(\`${s.template}\`);`+u.EOL,Object.keys(a).length>0&&(o+=`templ${s.templateId}.setActions(${e});`+u.EOL))}for(let t of e.loops)o+=this.writeViewInfo(t.actions,!1,t);for(let t of e.ifs){let e="";for(let n of t.parts){o+=this.writeViewInfo(n.templateAction,!1,void 0,n),e+=`{${n.once?"once: true,":""}\n condition: ${n.condition},\n template: templ${n.templateId}\n },`}e.length>0&&(e=e.slice(0,e.length-1));o+=`${void 0===t.parentId?"this.__getStatic().__template":`templ${t.parentId}`}.addIf({\n anchorId: '${t.anchorId}',\n parts: [${e}]\n });`+u.EOL}if(t){if(o.length>0&&(o=`__registerTemplateAction() { super.__registerTemplateAction();${u.EOL}${o} }`),this.templateNpm){const e=this.build.getNpmReplacementName([this.build.module,this.fullName].join("."),"Aventus.Template");l=o.replace(/new Aventus.Template\(this\)/g,`new ${e}(this)`),this.fileParsed?.registerGeneratedImport({uri:"@aventusjs/main/Aventus",name:"Template",compiled:!0,alias:e,forced:!1})}this.writeFileReplaceVar("templateAction",o),this.writeFileHotReloadReplaceVar("templateAction",o),this.writeFileNpmReplaceVar("templateAction",l),this.writeFileReplaceVar("variablesInViewDynamic",this.variablesInViewDynamic),this.writeFileHotReloadReplaceVar("variablesInViewDynamic",this.variablesInViewDynamic),this.writeFileNpmReplaceVar("variablesInViewDynamic",this.variablesInViewDynamic)}else o.length>0&&(o+=u.EOL);return o}watchProperties={};watchFunctions={};writeWatchableElements(){let e="";for(let t in this.watchProperties)this.watchProperties[t]?e+=`this.__addWatchesActions("${t}", ${this.watchProperties[t]});`+u.EOL:e+=`this.__addWatchesActions("${t}");`+u.EOL;if(Object.keys(this.watchFunctions).length>0){let t=[];for(let e in this.watchFunctions)this.watchFunctions[e].autoInit?t.push(`{ name: "${e}", autoInit: true }`):t.push(`"${e}"`);e+=`this.__addWatchesFunctions([${u.EOL}${t.join(",\n")}${u.EOL}]);`+u.EOL}let t="";this.debuggerDecorator?.enableWatchHistory&&(t="if(this.__watch){\nthis.__watch.enableHistory();\nthis.getWatchHistory = () => {\n return this.__watch.getHistory();\n}\nthis.clearWatchHistory = () => {\n return this.__watch.clearHistory();\n}\n}"),e.length>0?e=`__registerWatchesActions() {\n ${e}\n super.__registerWatchesActions();\n ${t}\n}`:t.length>0&&(e=`__registerWatchesActions() {\n super.__registerWatchesActions();\n ${t}\n}`),this.writeFileReplaceVar("watchesChangeCb",e),this.writeFileHotReloadReplaceVar("watchesChangeCb",e),this.writeFileNpmReplaceVar("watchesChangeCb",e)}createHtmlDoc(e,t){if(this.htmlDoc){let n=[];if(e.isProtected||e.isPrivate)return;let r="string";if("literal"==t.kind){let e=t.value;(e.startsWith("'")||e.startsWith('"'))&&(e=e.substring(1)),(e.endsWith("'")||e.endsWith('"'))&&(e=e.substring(0,e.length-1)),n.push({name:e,description:""})}else if("union"==t.kind)for(let e of t.nested){let t=e.value;(t.startsWith("'")||t.startsWith('"'))&&(t=t.substring(1)),(t.endsWith("'")||t.endsWith('"'))&&(t=t.substring(0,t.length-1)),n.push({name:t,description:""})}else"boolean"==t.kind?r="boolean":"number"==t.kind?r="number":"type"==t.kind&&"Date"==t.value?r="Date":"type"==t.kind&&"DateTime"==t.value&&(r="DateTime");this.htmlDoc[this.tagName].attributes[e.name]={name:e.name,description:e.documentation?.fullDefinitions.join(u.EOL)??"",type:r,values:n}}}writeFileReplaceVar(e,t){let n=new RegExp("\\$"+e+"\\$","g");this.template=this.template.replace(n,t+"")}writeFileHotReloadReplaceVar(e,t){if(I.HttpServer.isRunning){let n=new RegExp("\\$"+e+"\\$","g");this.templateHotReload=this.templateHotReload.replace(n,t+"")}}writeFileNpmReplaceVar(e,t){if(this.templateNpm){let n=new RegExp("\\$"+e+"\\$","g");this.templateNpm=this.templateNpm.replace(n,t+"")}}createMissingMethod(e,t,n){if(!this.htmlParsed)return;if(-1==this.result.missingMethods.position){let e=(0,c.getSectionStart)(this.file,"methods");this.result.missingMethods.position=e}let s="missing method "+e;-1!=this.result.missingMethods.position?this.result.missingMethods.elements.includes(e)||(this.result.missingMethods.elements.push(e),this.result.diagnostics.push((0,i.createErrorTsSection)(this.document,s,"methods",r.AventusErrorCode.MissingMethod))):this.result.diagnostics.push((0,i.createErrorTsSection)(this.document,s,"methods",r.AventusErrorCode.MissingMethod)),this.htmlFile&&this.htmlFile.tsErrors.push((0,i.createErrorHTMLPos)(this.htmlFile.file.documentUser,s,t,n))}createMissingViewElement(e){let t=[];for(let n in e.tags){let r=this.build.htmlLanguageService.getClassByTag(n),i="";if(r)i=r;else{let e=this.build.htmlLanguageService.getGenericHTML(n);i=e||"HTMLElement"}e.tags[n]>1&&(i+="[]"),t.push(i)}let n="";if(1==t.length)n=t[0];else if(t.length>1){for(let e=0;e<t.length;e++)t[e]=t[e].replace("[]","");n="("+t.join(" | ")+")[]"}let s="Missing variable view element"+e.name;if(this.result.missingViewElements.elements[e.name]=n,this.result.diagnostics.push((0,i.createErrorTsSection)(this.document,s,"variables",r.AventusErrorCode.MissingViewElement)),this.htmlFile)for(let t of e.positions)this.htmlFile.tsErrors.push((0,i.createErrorHTMLPos)(this.htmlFile.file.documentUser,s,t.start,t.end))}createUnusedViewElement(e){let t=e.name;this.overrideViewDecorator?-1==this.overrideViewDecorator.removeViewVariables.indexOf(t)&&this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"Can't find the variable "+t+" inside the view",e.nameStart,e.nameEnd,r.AventusErrorCode.viewElementNotFound,{start:e.start,end:e.end})):this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"Can't find the variable "+t+" inside the view",e.nameStart,e.nameEnd,r.AventusErrorCode.viewElementNotFound,{start:e.start,end:e.end}))}isCallback(e,t){let n;n=t.startsWith("on")?[t]:[t,"on"+t,"on"+t.charAt(0).toUpperCase()+t.slice(1)];for(let t of n){let n=e.getField(t);if(n){let e=n.type.value;if(a.ListCallbacks.includes(e))return t}}return null}prepareDocSCSS(){const e=this.scssFile?.customProperties??[];let t={[this.tagName]:e};if(this.hasStory&&this.classInfo?.storieContent){let t=this.classInfo.storieContent;delete t.style;let n=[];for(let t of e){this.storyArgTypes[t.name]={table:{category:"Style"}};const e={name:t.name};t.documentation&&(this.storyArgTypes[t.name].description=t.documentation,e.documentation=t.documentation),t.type&&(e.type=t.type),"color"==t.type?(this.storyArgTypes[t.name].control="color",this.storyArgTypes[t.name].type="color"):(this.storyArgTypes[t.name].type="string",this.storyArgTypes[t.name].control="text"),t.defaultValue&&(this.storyArgs[t.name]=t.defaultValue),t.chainValues&&(e.value=t.chainValues.join(" | ")),n.push(e)}n.length>0&&(t.style=n)}return t}prepareMethodToTranspile(e){if((e=e.trim()).startsWith("function")&&(e=(e=e.replace("function","")).trim()),!e.match(/^\(.*?\)( *?)=>/g)&&!e.match(/^\S*?( *?)=>/g)){let t=(e=e.replace(/^.*?\(/g,"(")).match(/^\(.*?\)/g);t&&(e=e.replace(t[0],t[0]+" => "))}return e}transpileMethodNoRun(e){try{e=this.prepareMethodToTranspile(e);let t=(0,l.transpile)(e,c.AventusTsLanguageService.getCompilerOptionsCompile()).trim();return t=t.substring(0,t.length-1),t="("+t+")",t}catch(e){}return""}_validateTypeForProp(e,t,n){if("boolean"==n.kind||"number"==n.kind||"string"==n.kind)return n;if("type"==n.kind){if("Date"==n.value||"DateTime"==n.value)return n;{let r=p.ParserTs.getBaseInfo(n.value);if(r&&r instanceof x.AliasInfo)return this._validateTypeForProp(e,t,r.type)}}else{if("literal"==n.kind)return n;if("union"==n.kind){let r;for(let e of n.nested)if("undefined"==e.kind&&(t.isNullable=!0),r){if(e.kind!=r.kind&&"undefined"!=e.kind){r=void 0;break}}else"undefined"!=e.kind&&(r=e);if(r)return"literal"==r.kind?n:this._validateTypeForProp(e,t,r)}}return this.result.diagnostics.push((0,i.createErrorTsPos)(e,"can't use the the type "+n.kind+"("+n.value+") as attribute / property",t.nameStart,t.nameEnd,r.AventusErrorCode.WrongTypeDefinition)),null}validateTypeForProp(e,t){t.name.toLowerCase()!=t.name&&this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"an attribute must be in lower case",t.nameStart,t.nameEnd,r.AventusErrorCode.AttributeLower));let n=this._validateTypeForProp(e,t,t.type);return n&&("boolean"==n.kind||"number"==n.kind?t.overrideNullable||null!==t.defaultValue||this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add ! after the name to avoid undefined value",t.nameStart,t.nameEnd,r.AventusErrorCode.ExclamationMarkMissing)):t.isNullable||null!==t.defaultValue||this.result.diagnostics.push((0,i.createErrorTsPos)(this.document,"You must add ? after the name to allow undefined value",t.nameStart,t.nameEnd,r.AventusErrorCode.QuestionMarkMissing))),n}removeWhiteSpaceLines(e){return e.replace(/^(?:[\t ]*(?:\r?\n|\r))+/gm,"")}}},7635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TYPES=t.configTS=t.CustomFieldModel=t.ListCallbacks=void 0;const r=n(37559);t.ListCallbacks=["Callback","Aventus.Callback","CallbackGroup","Aventus.CallbackGroup"];class i extends r.PropertyInfo{propType="Simple";inParent=!1;arguments}t.CustomFieldModel=i,t.configTS={noImplicitOverride:!1,target:"ES6"},t.TYPES={date:"Date",datetime:"DateTime",string:"string",number:"number",boolean:"boolean",literal:"literal"}},36353:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusDataFile=void 0;const r=n(19408),i=n(1539),s=n(6045),a=n(54145);class o extends a.AventusTsFile{get extension(){return r.AventusExtension.Data}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){let e=this.file.documentUser;this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.build.isCoreBuild?this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["IData"]}):this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["Aventus.IData"],customClassRules:[e=>{!e.isInterface&&e.convertibleName&&(e.hasStaticField(e.convertibleName)||this.diagnostics.push((0,i.createErrorTsPos)(this.file.documentUser,`Missing static property ${e.convertibleName}`,e.nameStart,e.nameEnd,r.AventusErrorCode.MissingFullName)))}]});const t=this.fileParsed;if(t)for(let n in t.classes){let s=t.classes[n];if(!s.isInterface){for(let t in s.properties){let n=s.properties[t];n.isAbstract||!n.isGetSet||n.overrideNullable||null!==n.defaultValue||this.diagnostics.push((0,i.createErrorTsPos)(e,`Property '${n.name}' has no initializer and is not definitely assigned.`,n.nameStart,n.nameEnd,r.AventusErrorCode.MissingInit))}let t=s,n=!1;for(;null!=t;){if(null!=t.propertiesStatic.Fullname){n=!0;break}t=t.parentClass}n||this.diagnostics.push((0,i.createErrorTsPos)(e,"Missing static property Fullname",s.nameStart,s.nameEnd,r.AventusErrorCode.MissingFullName))}}return this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,s.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return await this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusDataFile=o},20973:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusDefinitionFile=void 0;const r=n(19408),i=n(54145);class s extends i.AventusTsFile{get extension(){return r.AventusExtension.Definition}constructor(e,t){super(e,t),this._contentForLanguageService=this.file.contentUser}async onContentChange(){this._contentForLanguageService=this.file.contentUser}async onValidate(){return[]}async onSave(){}async onCompletion(e,t){return this.build.tsLanguageService.doComplete(e,t)}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return null}async onFormatting(e,t,n){return this.build.tsLanguageService.format(e,t,n)}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return this.build.tsLanguageService.onRename(e,t,n)}}t.AventusDefinitionFile=s},12842:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AVENTUS_DEF_SHARP_PATH=t.AVENTUS_DEF_UI_PATH=t.AVENTUS_DEF_BASE_PATH=t.TYPESCRIPT_LIB_SOURCE=void 0,t.loadTypescriptLib=function(){if(p.length>0)return;let e=(0,i.readdirSync)((0,t.TYPESCRIPT_LIB_SOURCE)());for(let t of e)t.endsWith(".d.ts")&&p.push(t)},t.loadNodeModules=function(e){if(!(0,i.existsSync)(e))return[];const t=(0,i.readdirSync)(e),n=[],s=e=>{const t=(0,r.join)(e,"package.json");if(!(0,i.existsSync)(t))return;const s=JSON.parse((0,i.readFileSync)(t,"utf8")),l=[];let c=!1;const u=t=>{try{const n=(0,r.resolve)(e,t);(0,i.existsSync)(n)&&!l.includes(n)&&l.push(n),t.endsWith(".ts")&&(c=!0)}catch(e){console.error(e)}};if(s.main&&u(s.main),s.module&&u(s.module),s.types&&u(s.types),s.typings&&u(s.typings),s.exports){const e=(e,t)=>e.startsWith("<=")?t<=e.substring(2):e.startsWith("<")?t<e.substring(1):e.startsWith(">=")?t>=e.substring(2):e.startsWith(">")?t>e.substring(1):e===t,t=n=>{if(n)if("object"==typeof n){let r=null,i=!1;if(Object.keys(n).some((e=>e.includes("@")))){for(let s of Object.keys(n)){const a=s.split("@");if(2===a.length){const r=a[1];if(e(r,o.version)){t(n[s]),i=!0;break}}else r=s}!i&&r&&t(n[r])}else{const e=n.node||n.import||n.types||n.require||n.default;t(e)}}else u(n)};for(let e in s.exports){const n=Array.isArray(s.exports[e])?s.exports[e]:[s.exports[e]];for(let e of n)t(e)}}if(c)for(let e of l)e.endsWith(".ts")&&n.push((0,a.pathToUri)(e));else for(let e of l)n.push((0,a.pathToUri)(e))};for(let n of t)if(!n.startsWith("."))if(n.startsWith("@")){const t=(0,i.readdirSync)((0,r.join)(e,n));for(let i of t)s((0,r.join)(e,n,i))}else s((0,r.join)(e,n));return n},t.loadLibrary=function(e){let n,s=l[e];if("string"==typeof s)return s;let a=!0;e.startsWith("custom://@types")?(n=(0,r.join)(u(),e.replace("custom://@types","@types")),a=!1):e.startsWith("file:///")?(n="/"===r.sep?decodeURIComponent(e.replace("file://","")):decodeURIComponent(e.replace("file:///","")),-1!=n.indexOf("/node_modules/@typescript")||-1!=n.indexOf("/node_modules/@types/typescript__")||(a=!1)):e.startsWith("node_modules/@types/typescript__")?a=!1:n=p.includes(e)?(0,r.join)((0,t.TYPESCRIPT_LIB_SOURCE)(),e):e;"string"!=typeof s&&((0,i.existsSync)(n)&&(0,i.lstatSync)(n).isFile()&&(s=(0,i.readFileSync)(n).toString()),void 0!==s&&(l[e]=s));return s};const r=n(71017),i=n(57147),s=n(24964),a=n(1539),o=n(94625),l={},c=()=>s.GenericServer.extensionPath;t.TYPESCRIPT_LIB_SOURCE=()=>(0,r.join)(c(),"node_modules/typescript/lib");t.AVENTUS_DEF_BASE_PATH=()=>(0,r.join)(c(),"lib/Aventus@Main.package.avt");t.AVENTUS_DEF_UI_PATH=()=>(0,r.join)(c(),"lib/Aventus@UI.package.avt");t.AVENTUS_DEF_SHARP_PATH=()=>(0,r.join)(c(),"lib/Aventus@Sharp.package.avt");const u=()=>(0,r.join)(c(),"node_modules"),p=[]},2054:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusLibFile=void 0;const r=n(19408),i=n(6045),s=n(54145),a=n(1539);class o extends s.AventusTsFile{get extension(){return r.AventusExtension.Lib}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){return this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.validateRules({allow_variables:!0,allow_function:!0,customClassRules:[e=>{!e.isInterface&&e.convertibleName&&(e.hasStaticField(e.convertibleName)||this.diagnostics.push((0,a.createErrorTsPos)(this.file.documentUser,`Missing static property ${e.convertibleName}`,e.nameStart,e.nameEnd,r.AventusErrorCode.MissingFullName)))}]}),this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,i.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}onFormatting(e,t,n){return this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusLibFile=o},2044:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusPackageNamespaceFileTs=t.AventusPackageFileTs=t.AventusPackageFile=void 0;const r=n(72375),i=n(67246),s=n(54145),a=n(18952),o=n(19408),l=n(24964),c=n(22037);class u extends i.AventusBaseFile{tsFile=null;tsDef=null;srcInfo={namespace:"",available:[],existing:[]};externalCSS={};name="";npmUri="";version={major:1,minor:0,patch:0};get versionTxt(){return this.version.major+"."+this.version.minor+"."+this.version.patch}get classInfoByName(){return this.tsDef?.classInfoByName||{}}get fileParsed(){return this.tsDef?.fileParsed||null}dependances=[];constructor(e,t){super(e,t),this.prepareFile()}loadWebComponents(){this.tsDef?.loadWebComponents()}prepareFile(){let e=this.separeSection();if(e){let t=a.TextDocument.create(this.file.uri,o.AventusLanguageId.TypeScript,this.file.versionUser,e.jsDef);this.tsFile?this.tsFile.triggerContentChange(t):(this.tsFile=new r.InternalAventusFile(t),this.tsDef=new p(this.tsFile,this.build));try{this.srcInfo=JSON.parse(e.jsSrc)}catch(e){}try{let t=JSON.parse(e.scssDefTxt);this.build.scssLanguageService.addExternalDefinition(this.file.uri,t)}catch(e){}try{this.externalCSS=JSON.parse(e.scssTxt)}catch(e){}try{let t=JSON.parse(e.htmlTxt);this.build.htmlLanguageService.addExternalDefinition(this.file.uri,t)}catch(e){}try{this.dependances=JSON.parse(e.depsTxt)}catch(e){}this.build.externalPackageInformation.rebuild()}}separeSection(){if(this.file.contentUser.match(/\/\/#region js def \/\/((\s|\S)*)\/\/#endregion js def \/\//g)){let e=/^\/\/ (\S+):([0-9]+)\.([0-9]+)\.([0-9]+)$/gm.exec(this.file.contentUser);e&&(this.name=e[1],this.version.major=Number(e[2]),this.version.minor=Number(e[3]),this.version.patch=Number(e[4]));let t=/((\s|\S)*)\/\/#endregion js def \/\//g.exec(this.file.contentUser),n="";t&&(n=t[0]);let r=/\/\/#region js src \/\/((\s|\S)*)\/\/#endregion js src \/\//g.exec(this.file.contentUser),i="";r&&(i=r[1]);let s=/\/\/#region css \/\/((\s|\S)*)\/\/#endregion css \/\//g.exec(this.file.contentUser),a="";s&&(a=s[1]);let o=/\/\/#region css def \/\/((\s|\S)*)\/\/#endregion css def \/\//g.exec(this.file.contentUser),l="";o&&(l=o[1]);let c=/\/\/#region html \/\/((\s|\S)*)\/\/#endregion html \/\//g.exec(this.file.contentUser),u="";c&&(u=c[1]);let p=/\/\/#region dependances \/\/((\s|\S)*)\/\/#endregion dependances \/\//g.exec(this.file.contentUser),_="";return p&&(_=p[1]),{jsDef:n,jsSrc:i,scssDefTxt:l,scssTxt:a,htmlTxt:u,depsTxt:_}}return null}async onContentChange(){this.prepareFile()}async onValidate(){return[]}async onSave(){}async onDelete(){this.build.scssLanguageService.removeExternalDefinition(this.file.uri),this.build.htmlLanguageService.removeExternalDefinition(this.file.uri),this.tsFile&&this.tsFile.triggerDelete()}async onCompletion(e,t){return{isIncomplete:!0,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return this.tsFile?this.tsFile.getHover(t):null}async onDefinition(e,t){return this.tsFile?await this.tsFile.getDefinition(t):null}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return this.tsFile?this.tsFile.getReferences(t):[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}onGetBuild(){return[this.build]}transformPosition(e,t,n,r){let i=e.file.documentUser.offsetAt(t);return n.file.documentUser.positionAt(i-r)}}t.AventusPackageFile=u;class p extends s.AventusTsFile{_classInfoByName={};packagesFiles=[];get extension(){return o.AventusExtension.Package}get classInfoByName(){return this._classInfoByName}constructor(e,t){super(e,t)}loadWebComponents(){try{this.refreshFileParsed(!0);let e=this.fileParsed;if(e){this.loadFilePackage();let t="Aventus.DefaultComponent",n="Aventus.IData";for(let r in e.classes){let i=e.classes[r],s=!1,a=!1;for(let e of i.implements){if(e==t){s=!0;break}if(e==n){a=!0;break}}s&&(this._classInfoByName[i.fullName]=i)}}}catch(e){let t=this.file.uri.split("/"),n=t[t.length-1];l.GenericServer.showErrorMessage("There is an error inside file :"+n),console.log(e)}}loadFilePackage(){try{this.deletePackageFile();let e=this.fileParsed;if(e){let t={};const n=e=>{for(let n in e){let r=e[n],i=r.fullName.split(".");i.pop();let s=i.join(".");t[s]||(t[s]={text:"",parts:[]});let a=t[s].text.length;t[s].text+=`export import ${n} = ${r.fullName};`+c.EOL,t[s].parts.push({startDef:r.start,endDef:r.end,startVirtual:a,endVirtual:t[s].text.length})}};n(e.classes),n(e.aliases),n(e.enums),n(e.functions),n(e.variables);for(let e in t)if(e){const n=this.file.name.replace(o.AventusExtension.Package,"")+":"+e+o.AventusExtension.Package;this.packagesFiles.push(new _(t[e],n,this.build,this))}}}catch(e){console.log(e)}}deletePackageFile(){const e=[...this.packagesFiles];this.packagesFiles=[];for(let t of e)t.internalFile.triggerDelete()}async onContentChange(){this.loadWebComponents()}async onValidate(){return[]}async onSave(){}async onCompletion(e,t){return{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}async onDelete(){await super.onDelete()}}t.AventusPackageFileTs=p;class _ extends s.AventusTsFile{get extension(){return o.AventusExtension.Package}internalFile;info;packageFile;constructor(e,t,n,i){const s=a.TextDocument.create("file:///"+t,o.AventusLanguageId.TypeScript,1,e.text),l=new r.InternalAventusFile(s);l.triggerDelete(),super(l,n),this.info=e,this.internalFile=l,this._contentForLanguageService=e.text,this.fileParsed=i.fileParsed,this.packageFile=i}async goToDefinition(e){let t=this.file.documentInternal.offsetAt(e.start),n=this.file.documentInternal.offsetAt(e.end),r=n-t;for(let e of this.info.parts)if(t>=e.startVirtual&&n<=e.endVirtual){let n=t-e.startVirtual,i=e.startDef+n-7,s=i+r,a=this.packageFile.file.documentInternal.positionAt(i),o=this.packageFile.file.documentInternal.positionAt(s);return{uri:this.packageFile.file.uri,range:{start:a,end:o}}}return null}async onContentChange(){}async onValidate(){return[]}async onSave(){}async onCompletion(e,t){return{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return null}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.AventusPackageNamespaceFileTs=_},99071:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AliasInfo=void 0;const r=n(90946),i=n(73218);class s extends r.BaseInfo{node;type;constructor(e,t,n){super(e,t,n),this.node=e,this.type=new i.TypeInfo(this.node.type),this.loadOnlyDependancesRecu(e)}defineStoryContent(){let e={kind:"type",name:this.name};this.setNamespaceForStroy(e),this.setDocumentationForStroy(e),this.setAccessibilityForStroy(e);const t=this.transformTypeForStory(new i.TypeInfo(this.node.type),this);if(t&&(e.type=t),this.node.typeParameters){e.generics=[];for(let t of this.node.typeParameters)e.generics.push(this.loadGenericForStory(t))}return e}}t.AliasInfo=s},90946:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseInfo=t.InfoType=void 0;const r=n(94625),i=n(10604),s=n(76025),a=n(73218),o=n(74950),l=n(84900),c=n(61586),u=n(24964),p=n(34385),_=n(57315),d=n(80352),h=n(71017),f=n(1539),m=n(48703),g=n(19408),y=n(82599);var v;!function(e){e[e.none=0]="none",e[e.class=1]="class",e[e.classData=2]="classData",e[e.interface=3]="interface",e[e.function=4]="function",e[e.variable=5]="variable",e[e.enum=6]="enum"}(v||(t.InfoType=v={}));class ${static infoByShortName={};static infoByFullName={};static getInfoByShortName(e){return this.infoByShortName[e]}static getInfoByFullName(e,t){e=e.replace(/<.*>/,"");let n=this.infoByFullName[e];return n||(n=this.infoByFullName[t.fullName.split(".")[0]+"."+e]),n}static isExported(e){if(e.modifiers)for(let t of e.modifiers)if(t.kind==r.SyntaxKind.ExportKeyword)return!0;return!1}static isStoryExported(e,t){if(!t.buildConfig.stories)return!1;let n=o.DecoratorInfo.buildDecorator(e).find((e=>"Storybook"==e.name));if(n){const e=_.StorybookDecorator.is(n);if(e)return!e.exportType||("all"==e.exportType||"public"==e.exportType||"protected"==e.exportType)}return"all"==t.buildConfig.stories.format||"public"==t.buildConfig.stories.format||"protected"==t.buildConfig.stories.format}name="";nameStart=0;nameEnd=0;start=0;end=0;fullName="";namespace="";decorators=[];storieContent;storieInject={};storieDecorator;storyType="none";dependances=[];compiled="";documentation;isExported=!1;isInternalExported=!1;_parserInfo;content="";compileTransformations={};get compiledContent(){return $.getContent(this.content,this.start,this.end,this.dependancesLocations,this.compileTransformations)}get compiledContentHotReload(){return $.getContentHotReload(this.content,this.start,this.end,this.dependancesLocations,this.compileTransformations)}get compiledContentNpm(){return $.getContentNpm(this.content,this.start,this.end,this.dependancesLocations,this.compileTransformations)}get fileUri(){return this.document.uri}debug=!1;document;dependanceNameLoaded=[];dependancePrevented=[];dependancesLocations={};infoType=v.none;build;willBeCompiled;get parserInfo(){return this._parserInfo}constructor(e,t,n,i=!0){if(this._parserInfo=n,this.document=n.document,this.decorators=o.DecoratorInfo.buildDecorator(e,this),this.dependancesLocations={},this.build=n.build,this.willBeCompiled=e.kind!=r.SyntaxKind.InterfaceDeclaration&&e.kind!=r.SyntaxKind.TypeAliasDeclaration,e.name){this.start=e.getStart(),this.end=e.getEnd(),this.name=e.name.getText(),this.nameStart=e.name.getStart(),this.nameEnd=e.name.getEnd(),this.namespace=t.join("."),this.fullName=[...t,this.name].join("."),this.content=e.getText(),n.isLib||($.infoByShortName[this.name]=this);let s=new d.DocumentationInfo(e);if(s.hasDoc&&(this.documentation=s),i&&this.loadDependancesDecorator(),e.kind!=r.SyntaxKind.VariableDeclaration){this.isExported=$.isExported(e),this.isInternalExported=this.isExported;for(let e of this.decorators){if(p.InternalDecorator.is(e)){this.isExported=!1;break}}}$.infoByFullName[this.fullName]=this}}loadDependancesDecorator(){for(let e of this.decorators){let t=l.DependancesDecorator.is(e);if(t)for(let e of t.dependances)this.addDependanceName(e.type,e.strong,0,0)}}preventDependanceAdd(e){this.dependancePrevented.includes(e)||this.dependancePrevented.push(e)}loadExpression(e,t=0,n=!1){if(this.debug&&(console.log("***"+t+". "+e.getText()),console.log(r.SyntaxKind[e.kind])),e.kind==r.SyntaxKind.ExpressionWithTypeArguments)this.addDependance(e,n);else if(e.kind==r.SyntaxKind.NewExpression){let r=e;this.loadExpression(r.expression,t+1,n)}else if(e.kind==r.SyntaxKind.PropertyAccessExpression){let r=e,s=r.name.getText(),a=i.ParserTs.getBaseInfo(s);if(a&&r.expression.getText()+"."+s==a.fullName)this.addDependanceName(a.fullName,n,r.getStart(),r.getEnd());else{let e=r.expression.getText();"this"==e||e.includes(".")||(i.ParserTs.hasLocal(e)||i.ParserTs.hasImport(e))&&this.addDependanceName(e,n,r.expression.getStart(),r.expression.getEnd())}this.loadExpression(r.expression,t+1,n)}else if(e.kind==r.SyntaxKind.Identifier){if(e.parent.kind==r.SyntaxKind.PropertyAccessExpression)return;if(e.parent.kind==r.SyntaxKind.GetAccessor||e.parent.kind==r.SyntaxKind.SetAccessor)return;if(!this.checkParentIdentifier(e))return;let t=e.getText();if("this"!=t&&!t.includes(".")){(i.ParserTs.getBaseInfo(t)||i.ParserTs.hasLocal(t)||i.ParserTs.hasImport(t))&&this.addDependanceName(t,n,e.getStart(),e.getEnd())}}else if(e.kind==r.SyntaxKind.CallExpression){let r=e;this.loadExpression(r.expression,t+1,n)}}checkParentIdentifier(e){const t=[r.SyntaxKind.VariableDeclaration,r.SyntaxKind.FunctionDeclaration,r.SyntaxKind.ClassDeclaration,r.SyntaxKind.InterfaceDeclaration,r.SyntaxKind.TypeAliasDeclaration,r.SyntaxKind.EnumDeclaration,r.SyntaxKind.ModuleDeclaration,r.SyntaxKind.NamespaceExportDeclaration,r.SyntaxKind.ImportEqualsDeclaration,r.SyntaxKind.ExportAssignment,r.SyntaxKind.ExportDeclaration,r.SyntaxKind.NamespaceExport,r.SyntaxKind.ExportSpecifier,r.SyntaxKind.MissingDeclaration,r.SyntaxKind.MethodDeclaration,r.SyntaxKind.ClassStaticBlockDeclaration],n=[r.SyntaxKind.ImportDeclaration,r.SyntaxKind.ImportClause,r.SyntaxKind.NamespaceImport,r.SyntaxKind.NamedImports,r.SyntaxKind.ImportSpecifier];if(t.includes(e.parent.kind)){return e.parent.name!=e}return!n.includes(e.parent.kind)&&!(e.parent.kind>=r.SyntaxKind.JsxElement&&e.parent.kind<=r.SyntaxKind.JsxExpression)}loadDependanceContext=void 0;maybeDependances={};loadOnlyDependancesRecu(e,t=0,n=!1){this.parserInfo.isLib||(e.kind==r.SyntaxKind.Decorator&&(this.loadDependanceContext="Decorator"),(0,r.forEachChild)(e,(e=>{e.kind!=r.SyntaxKind.TypeReference?(this.loadExpression(e,t,n),this.loadOnlyDependancesRecu(e,t+1,n)):this.addDependance(e,n)})),e.kind==r.SyntaxKind.Decorator&&(this.loadDependanceContext=void 0))}addDependance(e,t){if(this.parserInfo.isLib)return;const n=e=>{if("type"==e.kind){this.addDependanceName(e.value,t,e.start,e.endNonGeneric);for(let t of e.nested)n(t);for(let t of e.genericValue)n(t)}else if("typeLiteral"==e.kind||"function"==e.kind)for(let t of e.nested)n(t);else if("union"==e.kind)for(let t of e.nested)n(t)};n(new a.TypeInfo(e))}addDependanceWaitName(e,t,n){if(this.parserInfo.isLib)return void n([e.getText()],[e.getText()]);let r=[],i=[],s=0,o=!1;const l=()=>{o||0!=s||(o=!0,n(r,i))},c=(e,n)=>{if("type"==e.kind){s++,this.addDependanceName(e.value,t,e.start,e.endNonGeneric,((e,t)=>{0==n&&(e&&r.push(e),t&&i.push(t)),s--,l()}));for(let t of e.nested)c(t,n+1);for(let r of e.genericValue)t=!1,c(r,n+1)}else if("typeLiteral"==e.kind||"function"==e.kind)for(let t of e.nested)c(t,n+1);else if("union"==e.kind)for(let t of e.nested)c(t,n+1)};c(new a.TypeInfo(e),0),l()}loadStoryBookInject(){const e=this.build.buildConfig.stories;if(!e)return;const t=this.storieContent;if(!t)return;const n=(e,t)=>{this.storieInject[e]?this.storieInject[e].includes(t)||this.storieInject[e].push(t):this.storieInject[e]=[t]},r=r=>{let i=(0,h.join)(e.output,"generated"),s=(0,h.join)(e.output,"auto",...this.fullName.split(".")),a=(0,h.join)(i,...t.namespace.split(".")),o=(0,f.simplifyUri)((0,f.pathToUri)(a),(0,f.pathToUri)(s)),l=this.fullName.split(".");l.pop();let c=r.split(".");const u=c.pop()??"";for(let e=0;e<l.length;e++)if(c.length>e){if(c[e]!=l[e])break;c.splice(e,1),l.splice(e,1),e--}let p="";for(let e=0;e<l.length;e++)p+="../";""==p&&(p+="./"),p+=c.join("/"),p=(0,h.normalize)((0,h.join)(o,p)).replace(/\\/g,"/"),n(p,u)};if(this.storieDecorator?.slots?.inject)for(let e of this.storieDecorator.slots.inject)if(e.includes(".")){let t=this.build.externalPackageInformation.getNpmUri(e);t&&n(t.uri,t.name)}else this.parserInfo.internalObjects[e]?r(this.parserInfo.internalObjects[e].fullname):this.parserInfo.importsLocal[e]?.info?r(this.parserInfo.importsLocal[e].info.fullName):this.parserInfo.packages[e]||this.parserInfo.npmImports[e]&&n(this.parserInfo.npmImports[e].uri,e)}getNpmReplacementName(e){let t=[this.build.module,this.fullName].join(".");return this.parserInfo.getNpmReplacementName(t,e)}addDependanceTag(e,t){let n=this.build.getWebComponentTagDependance(e);if(n){for(let e of t.dependances)if(e.fullName==n.fullName)return;let e=n.uri;if("@external"==e){const e=n.fullName;let t=this.build.externalPackageInformation.getNpmUri(e);const r=this.getNpmReplacementName(e);t&&this._parserInfo.registerGeneratedImport({uri:t.uri,name:t.name,compiled:t.compiled,alias:r,forced:!0})}else if("@npm"==e){const e=n.fullName;let t=c(this.parserInfo.npmImports[e].uri);const r=this.getNpmReplacementName(t+"."+e);this._parserInfo.registerGeneratedImport({uri:this.parserInfo.npmImports[e].uri,name:e,compiled:!0,alias:r,forced:!0})}else{const e=y.ImportInfo.ManualLocalImport(this,n.fullName,n.uri),t=n.fullName;let r=this.fullName.split(".");r.pop();let i=t.split(".");const s=i.pop()??"";for(let e=0;e<r.length;e++)if(i.length>e){if(i[e]!=r[e])break;i.splice(e,1),r.splice(e,1),e--}const a=0==r.length&&0==i.length;let o="";for(let e=0;e<r.length;e++)o+="../";""==o&&(o+="./"),o+=i.join("/");const l=this.getNpmReplacementName([this.build.module,t].join("."));this._parserInfo.registerGeneratedImport({uri:o,nameAlias:e?.alias,name:s,compiled:!0,alias:l,onlySrc:a,forced:!0})}t.dependances.push(n)}}addDependanceName(e,t,n,i,a){if(this.parserInfo.isLib)return;let o;if(o=a||(()=>{}),!e||"constructor"==e||"toString"==e)return void o();this.debug&&console.log("try add dependance "+e);let l=/<.*>/g.exec(e);if(l&&(i-=l[0].length,e=e.replace(l[0],"")),e==this.fullName)return void o();if(s.BaseLibInfo.exists(e)&&!(this.parserInfo.internalObjects[e]||this.parserInfo.importsLocal[e]||this.parserInfo.waitingImports[e]||this.parserInfo.npmImports[e]))return void o();if(n>0&&i>0){this.dependancesLocations[e]||(this.dependancesLocations[e]={locations:{},typeRemplacement:null,replacement:null,hotReloadReplacement:null,npmReplacement:null});let t=n+"_"+i;if(!this.dependancesLocations[e].locations)return u.GenericServer.showErrorMessage("For the admin : you can add "+e+" as dependance to avoid"),void o();if(!this.dependancesLocations[e].locations[t]){let s=(0,r.getTokenAtPosition)(this.parserInfo.srcFile,(n+i)/2),a=(0,r.isTypeReferenceNode)(s)||(0,r.isTypeReferenceNode)(s.parent);this.dependancesLocations[e].locations[t]={start:n,end:i,isType:a}}}if(!this.addDependanceNameCustomCheck(e))return void o();if(this.dependancePrevented.includes(e))return void o();if(this.dependanceNameLoaded.includes(e)){if(o(),void 0===this.loadDependanceContext&&this.maybeDependances[e]){const t=this.getNpmReplacementName(this.maybeDependances[e].name);this._parserInfo.registerGeneratedImport({uri:this.maybeDependances[e].uri,name:this.maybeDependances[e].name,compiled:this.maybeDependances[e].compiled,alias:t,forced:!1})}return}if(this.dependanceNameLoaded.push(e),e.includes(".")){this.dependances.push({fullName:e,uri:"@external",isStrong:t});let n=this.build.externalPackageInformation.getNpmUri(e);const r=this.getNpmReplacementName(e);return n&&(this.dependancesLocations[e].npmReplacement=r,void 0===this.loadDependanceContext?this._parserInfo.registerGeneratedImport({uri:n.uri,name:n.name,compiled:n.compiled,alias:r,forced:!1}):this.maybeDependances[e]=n),void o(e,r)}const p=(t,n,r)=>{let i=this.fullName.split(".");i.pop();let s=t.split(".");const a=s.pop()??"";for(let e=0;e<i.length;e++)if(s.length>e){if(s[e]!=i[e])break;s.splice(e,1),i.splice(e,1),e--}const o=0==i.length&&0==s.length;let l="";for(let e=0;e<i.length;e++)l+="../";""==l&&(l+="./"),l+=s.join("/"),void 0===this.loadDependanceContext?this._parserInfo.registerGeneratedImport({uri:l,name:a,compiled:n,alias:r,onlySrc:o,forced:!1}):this.maybeDependances[e]={uri:l,name:a,compiled:n}};if(this.parserInfo.internalObjects[e]){let n=this.parserInfo.internalObjects[e].fullname,r=[this.build.module,...this.build.namespaces,n].join(".");if(n==this.fullName&&(t=!1),this.dependances.push({fullName:"$namespace$"+n,uri:"@local",isStrong:t}),this.debug&&console.log("add dependance "+e+" : same file"),this.dependancesLocations[e]){let t=n;this.isExported!=this.parserInfo.internalObjects[e].isExported&&(t=this.isExported?["___"+this.build.module,n].join("."):["globalThis",this.build.module,n].join(".")),this.dependancesLocations[e].typeRemplacement=t,this.dependancesLocations[e].replacement=n,this.dependancesLocations[e].npmReplacement=e,this.dependancesLocations[e].hotReloadReplacement=r,p(n,this.parserInfo.internalObjects[e].isCompiled,e)}return void o(n,e)}let _=this.parserInfo.importsLocal[e]?.info;if(_){let n=_.fullName,r=[this.build.module,...this.build.namespaces,n].join(".");this.dependances.push({fullName:"$namespace$"+n,uri:_.fileUri,isStrong:t}),this.debug&&console.log("add dependance "+e+" : imported file");const i=this.getNpmReplacementName([this.build.module,n].join("."));if(this.dependancesLocations[e]){let t=n;this.isExported!=_.isExported&&(t=this.isExported?["___"+this.build.module,n].join("."):["globalThis",this.build.module,n].join(".")),this.dependancesLocations[e].typeRemplacement=t,this.dependancesLocations[e].replacement=n,this.dependancesLocations[e].npmReplacement=i,this.dependancesLocations[e].hotReloadReplacement=r,p(n,_.willBeCompiled,i)}o(n,i)}else{if(this.parserInfo.waitingImports[e])return this.debug&&console.log("add dependance "+e+" : but waiting import file"),void this.parserInfo.waitingImports[e].push((n=>{let r=n.fullName,i=[this.build.module,...this.build.namespaces,r].join(".");const s=this.getNpmReplacementName([this.build.module,r].join("."));if(this.dependancesLocations[e]){let t=r;this.isExported!=n.isExported&&(t=this.isExported?["___"+this.build.module,r].join("."):["globalThis",this.build.module,r].join(".")),this.dependancesLocations[e].typeRemplacement=t,this.dependancesLocations[e].replacement=r,this.dependancesLocations[e].npmReplacement=s,this.dependancesLocations[e].hotReloadReplacement=i,p(r,n.willBeCompiled,s)}this.dependances.push({fullName:"$namespace$"+r,uri:n.fileUri,isStrong:t}),o(r,s)}));if(this.parserInfo.packages[e]){let n=this.parserInfo.packages[e].fullname,r=this.build.externalPackageInformation.getNpmUri(n);this.dependances.push({fullName:n,uri:"@external",isStrong:t});const i=this.getNpmReplacementName(n);return this.dependancesLocations[e]&&(this.dependancesLocations[e].typeRemplacement=n,this.dependancesLocations[e].replacement=n,this.dependancesLocations[e].npmReplacement=i,this.dependancesLocations[e].hotReloadReplacement=n),r&&this._parserInfo.registerGeneratedImport({uri:r.uri,name:r.name,compiled:r.compiled,alias:i,forced:!1}),void o(n,i)}if(this.parserInfo.npmImports[e]){this.dependances.push({fullName:e,uri:"@npm",isStrong:t}),this.debug&&console.log("add dependance "+e+" : npm");let n=c(this.parserInfo.npmImports[e].uri);const r=this.getNpmReplacementName(n+"."+e);return this.dependancesLocations[e]&&(this.dependancesLocations[e].replacement="npmCompilation['"+n+"']."+e,r!=e&&(this.dependancesLocations[e].npmReplacement=r),void 0===this.loadDependanceContext?this._parserInfo.registerGeneratedImport({uri:this.parserInfo.npmImports[e].uri,name:e,compiled:!0,alias:r,forced:!1}):this.maybeDependances[e]={uri:this.parserInfo.npmImports[e].uri,name:e,compiled:!0}),void o(e,r)}this.dependances.push({fullName:e,uri:"@external",isStrong:t}),this.debug&&console.log("add dependance "+e+" : external"),o(e,e)}}addDependanceNameCustomCheck(e){return!0}static getContent(e,t,n,r,i){return this._getContent(e,t,n,r,i,1)}static getContentHotReload(e,t,n,r,i){return this._getContent(e,t,n,r,i,2)}static getContentNpm(e,t,n,r,i){return this._getContent(e,t,n,r,i,3)}static _getContent(e,t,n,r,i,s){let a=[];for(let e in r){let i=null;1==s?i=r[e].replacement:2==s?i=r[e].hotReloadReplacement:3==s&&(i=r[e].npmReplacement);let o=r[e].typeRemplacement;if(i)for(let l in r[e].locations){let c=r[e].locations[l];c.start>=t&&c.end<=n&&(c.isType&&o&&3!=s?a.push({newText:o,start:c.start-t,end:c.end-t}):a.push({newText:i,start:c.start-t,end:c.end-t}))}}for(let e in i){let r=i[e];r.start>=t&&r.end<=n&&a.push({newText:r.newText,start:r.start-t,end:r.end-t})}a.sort(((e,t)=>t.end-e.end));let o=e.length;for(let t of a)t.end>o||(e=e.slice(0,t.start)+t.newText+e.slice(t.end,e.length),o=t.start);return e}loadStorieContent(){if(this.build.buildConfig.stories&&!this._parserInfo.isLib){for(let e of this.decorators){const t=_.StorybookDecorator.is(e);if(t){this.storieDecorator=t;break}}const e=this.build.buildConfig.stories.format;if(this.storieDecorator?this.storieDecorator.exportType?this.storyType=this.storieDecorator.exportType:this.storyType=e?"manual"==e?"all":e:"none":this.storyType=e?"manual"==e?"none":e:"none","public"==this.storyType||"protected"==this.storyType?(this.storieDecorator||this.isExported)&&(this.storieContent=this.defineStoryContent(this.storieDecorator)):"all"==this.storyType&&(this.storieContent=this.defineStoryContent(this.storieDecorator)),this.storieContent&&this.build.buildConfig.stories.srcBaseUrl){let e=this.build.project.getConfigFile().uri.replace(g.AventusExtension.Config,""),t=(0,f.uriToPath)(this.fileUri.replace(e,"")).replace(/\\/g,"/");this.storieContent.srcUrl=this.build.buildConfig.stories.srcBaseUrl+"/"+t}}}transformTypeForStory(e,t){if(e){if("type"==e.kind){const n={kind:"simple",name:e.value};if(e.isArray&&(n.isArray=!0),e.genericValue.length>0){const r=[];for(let n of e.genericValue){const e=this.transformTypeForStory(n,t);e&&r.push(e)}r.length>0&&(n.generics=r)}let r=t.parserInfo.importsLocal[e.value]?.info;if(r)"none"!=r.storyType&&(n.ref=m.Storie.getFullname(r));else{let r=t.parserInfo.internalObjects[e.value];r?.isStoryExported&&(n.ref=r.fullname)}return n}if("any"==e.kind||"never"==e.kind||"unknown"==e.kind||"boolean"==e.kind||"null"==e.kind||"number"==e.kind||"string"==e.kind||"undefined"==e.kind||"void"==e.kind||"object"==e.kind||"symbol"==e.kind||"this"==e.kind){return{kind:"simple",name:e.kind}}if("literal"==e.kind){return{kind:"simple",name:e.value.slice(1,-1)}}if("function"==e.kind||"constructor"==e.kind){if(!e.fctType)return;const t={kind:"function"};if(Object.keys(e.fctType.parameters).length>0){t.parameters=[];for(let n in e.fctType.parameters){const r={name:n},i=this.transformTypeForStory(e.fctType.parameters[n],this);i&&(r.type=i),t.parameters.push(r)}}const n=this.transformTypeForStory(e.fctType.return,this);n&&(t.return=n),"constructor"==e.kind&&(t.isConstructor=!0);let r=e.node;if(r.typeParameters){t.generics=[];for(let e of r.typeParameters){const n={name:e.name.getText()},r=this.transformTypeForStory(new a.TypeInfo(e.default),this);r&&(n.default=r);const i=this.transformTypeForStory(new a.TypeInfo(e.constraint),this);i&&(n.constraint=i),t.generics.push(n)}}return t}if("tuple"==e.kind){const n={kind:"tupple",tupples:[]};for(let r of e.nested){const e=this.transformTypeForStory(r,t);e&&n.tupples.push(e)}return n}if("typeLiteral"==e.kind){const n={kind:"object"};let i=e.node;return(0,r.forEachChild)(i,(e=>{if(e.kind==r.SyntaxKind.PropertySignature){let i=e;if(i.type){let e=i.name.getText(),r=new a.TypeInfo(i.type);const s=this.transformTypeForStory(r,t);s&&(n.keys||(n.keys={}),n.keys[e]=s)}else console.log("need implements property signature no type "+r.SyntaxKind[e.kind]+" "+t.fileUri)}else if(e.kind==r.SyntaxKind.IndexSignature){let r=e;if(r.parameters.length>0&&r.parameters[0].type){n.indexSignatures||(n.indexSignatures=[]);const e=this.transformTypeForStory(new a.TypeInfo(r.type),t),i=this.transformTypeForStory(new a.TypeInfo(r.parameters[0].type),t);e&&i&&n.indexSignatures.push({keyName:r.parameters[0].name.getText(),keyType:i,type:e})}}else if(e.kind==r.SyntaxKind.TypeLiteral){const r=e;let i=this.transformTypeForStory(new a.TypeInfo(r),t);i&&(n.array=i)}else console.log("need implements for "+r.SyntaxKind[e.kind]+" "+t.fileUri)})),n}if("union"==e.kind){const n={kind:"union",types:[]};for(let r of e.nested){const e=this.transformTypeForStory(r,t);e&&n.types.push(e)}return n}if("intersection"==e.kind){const n={kind:"intersection",types:[]};for(let r of e.nested){const e=this.transformTypeForStory(r,t);e&&n.types.push(e)}return n}if("typeOperator"!=e.kind){if("indexedAccess"!=e.kind){if("mappedType"!=e.kind){if("infer"==e.kind){return{kind:"infer",name:e.value}}if("conditional"!=e.kind)"mock"==e.kind&&console.log("mock type");else if(e.conditionalType){const n=this.transformTypeForStory(e.conditionalType.check,t),r=this.transformTypeForStory(e.conditionalType.extends,t),i=this.transformTypeForStory(e.conditionalType.true,t),s=this.transformTypeForStory(e.conditionalType.false,t);if(r&&i&&s&&n){return{kind:"conditional",check:n,extends:r,true:i,false:s}}}}else if(e.mappedType){const n=this.transformTypeForStory(e.mappedType.parameterType,t),r=this.transformTypeForStory(e.mappedType.type,t);if(n&&r){const t={kind:"mappedType",parameterName:e.mappedType.parameterName,parameterType:n,type:r};return e.mappedType.modifier&&(t.modifier=e.mappedType.modifier),t}}}else if(2==e.nested.length){const n=this.transformTypeForStory(e.nested[0],t),r=this.transformTypeForStory(e.nested[1],t);if(r&&n){return{kind:"indexAccess",obj:n,key:r}}}}else if(e.nested.length>0){const n=this.transformTypeForStory(e.nested[0],t);if(n){return{kind:"typeOperator",value:e.value,type:n}}}}}loadGenericForStory(e,t){const n=e.name.getText(),r={name:n};if(t||(t=this.documentation),t?.documentationTemplates[n]&&(r.documentation=t.documentationTemplates[n]),e.constraint){const t=this.transformTypeForStory(new a.TypeInfo(e.constraint),this);t&&(r.constraint=t)}if(e.default){const t=this.transformTypeForStory(new a.TypeInfo(e.default),this);t&&(r.default=t)}return r}loadParameterForStory(e,t){const n=e.name.getText(),r={name:n},i=this.transformTypeForStory(new a.TypeInfo(e.type),this);return i&&(r.type=i),t||(t=this.documentation),t?.documentationParameters[n]&&(r.documentation=t.documentationParameters[n]),r}setAccessibilityForStroy(e){this.isExported||(e.accessibility="internal")}setNamespaceForStroy(e){this.build.noNamespaceUri[this.fileUri]?this.namespace.length>0&&(e.namespace=this.namespace):(e.namespace=this.build.module,this.namespace.length>0&&(e.namespace+="."+this.namespace))}setDocumentationForStroy(e){this.documentation&&(e.documentation=this.documentation.definitions.join("\n"))}}t.BaseInfo=$},76025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseLibInfo=void 0;const r=n(71017),i=n(94625),s=n(12842);t.BaseLibInfo=class{static libInfo=[];static init(){let e=(0,i.createProgram)([(0,r.join)((0,s.TYPESCRIPT_LIB_SOURCE)(),"lib.es2022.full.d.ts")],{}).getSourceFiles();for(let t of e)if(t.statements)for(let e of t.statements)try{if(e.kind==i.SyntaxKind.FunctionDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.EnumDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.ClassDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.MethodDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.VariableDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.InterfaceDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}else if(e.kind==i.SyntaxKind.TypeAliasDeclaration){let n=e.name?.getText(t);n&&(this.libInfo.includes(n)||this.libInfo.push(n))}}catch{}}static exists(e){return 0==this.libInfo.length&&this.init(),this.libInfo.includes(e)}}},65887:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClassInfo=void 0;const r=n(94625),i=n(90946),s=n(46057),a=n(10604),o=n(37559),l=n(66145),c=n(73218),u=n(61586);class p extends i.BaseInfo{extends=[];extendsNpm=[];implements=[];parentClass=null;methods={};methodsStatic={};properties={};propertiesStatic={};isInterface=!1;isAbstract=!1;constructorBody;parameters=[];methodParameters=[];convertibleName="";extendsType;implementsType=[];get constructorContent(){if(!this.constructorBody)return"";let e=this.constructorBody.getText();return e=i.BaseInfo.getContent(e,this.constructorBody.getStart(),this.constructorBody.getEnd(),this.dependancesLocations,this.compileTransformations),e}get constructorContentHotReload(){if(!this.constructorBody)return"";let e=this.constructorBody.getText();return e=i.BaseInfo.getContentHotReload(e,this.constructorBody.getStart(),this.constructorBody.getEnd(),this.dependancesLocations,this.compileTransformations),e}get constructorContentNpm(){if(!this.constructorBody)return"";let e=this.constructorBody.getText();return e=i.BaseInfo.getContentNpm(e,this.constructorBody.getStart(),this.constructorBody.getEnd(),this.dependancesLocations,this.compileTransformations),e}node;constructor(e,t,n){if(super(e,t,n,!1),this.node=e,this.isInterface=e.kind==r.SyntaxKind.InterfaceDeclaration,this.infoType=this.isInterface?i.InfoType.interface:i.InfoType.class,e.typeParameters)for(let t of e.typeParameters)this.parameters.push(t.name.getText());if(e.modifiers)for(let t of e.modifiers)t.kind==r.SyntaxKind.AbstractKeyword&&(this.isAbstract=!0);if(e.heritageClauses)for(let t of e.heritageClauses)this.getClassInheritance(t);(0,r.forEachChild)(e,(e=>{let t=!1,n=null;if(e.kind==r.SyntaxKind.Constructor){let t=e;t.body&&(this.constructorBody=t.body)}else if(e.kind==r.SyntaxKind.PropertyDeclaration){let r=new o.PropertyInfo(e,this.isInterface,this);r.isStatic?(this.propertiesStatic[r.name]=r,t=!0):this.properties[r.name]=r;let i=e;i.type||a.ParserTs.addError(i.getStart(),i.getEnd(),"You must define a type for the prop "+r.name),n=r}else if(e.kind==r.SyntaxKind.GetAccessor){let t=e,r=new o.PropertyInfo(t,this.isInterface,this);r.isStatic?this.propertiesStatic[r.name]=r:this.properties[r.name]=r,t.type||a.ParserTs.addError(t.getStart(),t.getEnd(),"You must define a type for the prop "+r.name),n=r}else if(e.kind==r.SyntaxKind.SetAccessor){let t=e,r=new o.PropertyInfo(t,this.isInterface,this);r.isStatic?this.propertiesStatic["°set°"+r.name]=r:this.properties["°set°"+r.name]=r,n=r}else if(e.kind==r.SyntaxKind.MethodDeclaration){let t=e;if(t.typeParameters)for(let e of t.typeParameters)this.methodParameters.push(e.name.getText());let r=new s.MethodInfo(e,this);r.isStatic?this.methodsStatic[r.name]=r:this.methods[r.name]=r,this.methodParameters=[],n=r}else if(e.kind==r.SyntaxKind.MethodSignature){let t=e;if(t.typeParameters)for(let e of t.typeParameters)this.methodParameters.push(e.name.getText());let r=new s.MethodInfo(e,this);r.isStatic?this.methodsStatic[r.name]=r:this.methods[r.name]=r,this.methodParameters=[],n=r}else if(e.kind==r.SyntaxKind.PropertySignature){let r=new o.PropertyInfo(e,this.isInterface,this);r.isStatic?(this.propertiesStatic[r.name]=r,t=!0):this.properties[r.name]=r;let i=e;i.type||a.ParserTs.addError(i.getStart(),i.getEnd(),"You must define a type for the prop "+r.name),n=r}if(n&&n.accessibilityModifierTransformation){let e=n.accessibilityModifierTransformation.start+"_"+n.accessibilityModifierTransformation.end;this.compileTransformations[e]=n.accessibilityModifierTransformation}this.loadOnlyDependancesRecu(e,0,t)})),this.loadConvertible(),this.loadDependancesDecorator()}getClassInheritance(e){e.token==r.SyntaxKind.ExtendsKeyword?(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ExpressionWithTypeArguments&&(this.build.hasStories&&(this.extendsType=new c.TypeInfo(e)),this.addDependanceWaitName(e,!0,((e,t)=>{if(e.length>0&&(this.extends.push(e[0]),1==this.extends.length)){let t=i.BaseInfo.getInfoByFullName(e[0],this);if(t&&t instanceof p&&(this.parentClass=t,this.parentClass==this))throw this.parentClass=null,"The parent is the child => impossible. Please send it to an admin"}t.length>0&&this.extendsNpm.push(t[0])})),(0,r.forEachChild)(e,(e=>{this.loadOnlyDependancesRecu(e,0,!0)})))})):e.token==r.SyntaxKind.ImplementsKeyword&&(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ExpressionWithTypeArguments&&(this.build.hasStories&&this.implementsType.push(new c.TypeInfo(e)),this.addDependanceWaitName(e,!0,(e=>{if(e.length>0)for(let t of e)this.implements.push(t)})))}))}loadConvertible(){let e=this;for(;null!=e;){for(let t of e.decorators){let e=l.ConvertibleDecorator.is(t);if(e)return void(this.convertibleName=e.name)}e=e.parentClass}}addDependanceNameCustomCheck(e){return!this.parameters.includes(e)&&!this.methodParameters.includes(e)}hasStaticField(e){let t=this;for(;null!=t;){if(null!=t.propertiesStatic[e])return!0;t=t.parentClass}return!1}hasField(e){return null!=this.getField(e)}getField(e){let t=this;for(;null!=t;){if(null!=t.properties[e])return t.properties[e];t=t.parentClass}return null}defineStoryContent(e){let t={kind:this.isInterface?"interface":"class",name:this.name};if(this.setNamespaceForStroy(t),this.setDocumentationForStroy(t),this.setAccessibilityForStroy(t),this.isAbstract&&"class"==t.kind&&(t.modifier="abstract"),this.extendsType){const e=this.transformTypeForStory(this.extendsType,this);e&&(t.extends=e)}if(this.implementsType.length>0&&"class"==t.kind){t.implements=[];for(let e of this.implementsType){const n=this.transformTypeForStory(e,this);n&&t.implements.push(n)}}if(this.node.typeParameters){t.generics=[];for(let e of this.node.typeParameters)t.generics.push(this.loadGenericForStory(e))}for(let e in this.methods)this.addMethodStoryContent(t,this.methods[e]);for(let e in this.methodsStatic)this.addMethodStoryContent(t,this.methodsStatic[e]);for(let e in this.properties)this.addPropertyStoryContent(t,this.properties[e]);for(let e in this.propertiesStatic)this.addPropertyStoryContent(t,this.propertiesStatic[e]);return t}addMethodStoryContent(e,t){if(!this.canAddToStory(t))return;let n=[this.build.module,this.fullName].join(".");if(t.name.startsWith("__"+u(n)+"method"))return;e.methods||(e.methods=[]);const r={name:t.name,accessibility:t.isPrivate?"private":t.isProtected?"protected":"public"};e.methods.push(r);const i=e=>{r.modifiers||(r.modifiers=[]),r.modifiers.push(e)};if(t.documentation&&(r.documentation=t.documentation.definitions.join("\n")),t.isAbstract&&i("abstract"),t.isOverride&&i("override"),t.isStatic&&i("static"),t.node.typeParameters){r.generics=[];for(let e of t.node.typeParameters)r.generics.push(this.loadGenericForStory(e,t.documentation))}if(t.node.parameters.length>0){r.parameters=[];for(let e of t.node.parameters)r.parameters.push(this.loadParameterForStory(e,t.documentation))}if(t.node.type){const e=new c.TypeInfo(t.node.type),n=this.transformTypeForStory(e,this);if(n){const e={type:n};t.documentation?.documentationReturn&&(e.documentation=t.documentation?.documentationReturn),r.return=e}}}addPropertyStoryContent(e,t){if(!this.canAddToStory(t))return;e.properties||(e.properties=[]);const n={name:t.name,accessibility:t.isPrivate?"private":t.isProtected?"protected":"public"};e.properties.push(n),t.documentation&&(n.documentation=t.documentation.definitions.join("\n"));const r=e=>{n.modifiers||(n.modifiers=[]),n.modifiers.push(e)};t.isOverride&&r("override"),t.isAbstract&&r("abstract"),t.isGet&&r("readonly"),t.isSet&&r("writeonly"),t.isStatic&&r("static");const i=this.transformTypeForStory(t.type,this);i&&(n.type=i)}canAddToStory(e){if(!this.build.buildConfig.stories)return!1;const t=this.storyType;if("public"==t){if(e.isPrivate||e.isProtected){return void 0!==e.decorators.find((e=>"AddToStory"==e.name))}return void 0===e.decorators.find((e=>"NoStory"==e.name))}if("protected"==t){if(e.isPrivate){return void 0!==e.decorators.find((e=>"AddToStory"==e.name))}return void 0===e.decorators.find((e=>"NoStory"==e.name))}if("all"==t){return void 0===e.decorators.find((e=>"NoStory"==e.name))}return!1}mergeClassInfo(e){for(let t of e.extends)this.extends.includes(t)||this.extends.push(t);for(let t of e.implements)this.implements.includes(t)||this.implements.push(t);this.methods={...e.methods,...this.methods},this.methodsStatic={...e.methodsStatic,...this.methodsStatic},this.properties={...e.properties,...this.properties},this.propertiesStatic={...e.propertiesStatic,...this.propertiesStatic}}}t.ClassInfo=p},74950:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DecoratorInfo=void 0;const r=n(94625),i=n(10604),s=n(25850),a=n(24964);class o{name="";content="";start=0;end=0;contentStart=0;contentEnd=0;arguments=[];baseInfo;constructor(e){this.baseInfo=e}static buildDecorator(e,t){let n=[];try{let a=(0,r.getDecorators)(e)||[];for(let e of a){let a=e.expression,c=new o(t);if(c.content="@"+a.getText(),a.kind===r.SyntaxKind.CallExpression){var l=a;c.name=l.expression.getText(),c.start=e.getStart(),c.end=e.getEnd(),c.contentStart=a.getStart(),c.contentEnd=a.getEnd(),t&&(t.compileTransformations[c.start+"_"+c.end]={newText:"",start:c.start,end:c.end});for(let e of l.arguments){let t=(0,s.getArg)(e);t&&c.arguments.push(t)}n.push(c)}else i.ParserTs.addError(e.getStart(),e.getEnd(),"Missing paramaters for Decorator")}}catch(e){a.GenericServer.showErrorMessage(e+"")}return n}}t.DecoratorInfo=o},76248:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionCorrector=void 0;const r=n(94625),i=n(65887);t.DefinitionCorrector=class{static allChanges=[];static currentElement;static correct(e,t){var n=(0,r.createSourceFile)("sample.ts",e,r.ScriptTarget.ESNext,!0);if(this.allChanges=[],t instanceof i.ClassInfo&&!this.currentElement){this.currentElement=t,(0,r.forEachChild)(n,(e=>{var n=e.kind===r.SyntaxKind.InterfaceDeclaration,i=e.kind===r.SyntaxKind.ClassDeclaration;if(n||i){var s=e;for(let e of t.decorators)"Debugger"!=e.name&&this.addChange(e.content+"\r\n",s.getStart(),s.getStart());if(s.typeParameters&&s.typeParameters.forEach((e=>{e.constraint&&this.correctType(e.constraint)})),s.heritageClauses)for(let e of s.heritageClauses)this.correctClassInheritance(e);(0,r.forEachChild)(s,(e=>{e.kind==r.SyntaxKind.Constructor||e.kind==r.SyntaxKind.MethodDeclaration?this.correctMethod(e):e.kind==r.SyntaxKind.PropertyDeclaration&&this.correctProperty(e)}))}})),this.allChanges.sort(((e,t)=>t.end-e.end));for(let t of this.allChanges)e=e.slice(0,t.start)+t.value+e.slice(t.end,e.length);this.currentElement=null}return e}static correctClassInheritance(e){e.token!=r.SyntaxKind.ExtendsKeyword&&e.token!=r.SyntaxKind.ImplementsKeyword||(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ExpressionWithTypeArguments&&this.correctType(e)}))}static correctMethod(e){e.type&&this.correctType(e.type),e.typeParameters&&e.typeParameters.forEach((e=>{e.constraint&&this.correctType(e.constraint)})),e.parameters.forEach((e=>{this.correctType(e.type)}))}static correctProperty(e){if(e.type&&this.correctType(e.type),this.currentElement&&this.currentElement.properties[e.name.getText()]){let t=this.currentElement.properties[e.name.getText()].decorators;for(let n of t)this.addChange(n.content+"\r\n\t",e.getStart(),e.getStart())}}static addChange(e,t,n){this.allChanges.push({start:t,end:n,value:e})}static addChangeType(e,t,n){if(this.currentElement){let r=this.currentElement.parserInfo.getBaseInfo(e);r&&e!=r.fullName&&this.addChange(r.fullName,t,n)}}static correctType(e){if(e)if(e.kind===r.SyntaxKind.TypeReference){var t=e;let n=this.parseQualified(t.typeName);n&&(this.addChangeType(n,t.getStart(),t.getEnd()),t.typeArguments&&t.typeArguments.forEach((e=>{this.correctType(e)})))}else if(e.kind===r.SyntaxKind.ArrayType){var n=e;this.correctType(n.elementType)}else if(e.kind===r.SyntaxKind.UnionType){var i=e;for(let e of i.types)this.correctType(e)}else if(e.kind===r.SyntaxKind.ExpressionWithTypeArguments){var s=e;let t=this.parseQualified2(s.expression);t&&(this.addChangeType(t,s.expression.getStart(),s.expression.getEnd()),s.typeArguments&&s.typeArguments.forEach((e=>{this.correctType(e)})))}}static parseQualified2(e){let t="";if(e.expression)if(e.expression.kind===r.SyntaxKind.PropertyAccessExpression){let n=this.parseQualified2(e.expression);n&&(t=n+".")}else e.expression.kind===r.SyntaxKind.Identifier&&(t=e.expression.text+".");return e.name?t+e.name.text:t+e.text}static parseQualified(e){if(e.kind===r.SyntaxKind.Identifier)return e.text;var t=e;return this.parseQualified(t.left)+"."+this.parseQualified(t.right)}}},80352:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentationInfo=void 0;const r=n(94625);t.DocumentationInfo=class{hasDoc=!1;definitions=[];documentationParameters={};documentationTemplates={};documentationSlots={};documentationReturn;fullDefinitions=[];constructor(e){if(e.jsDoc){this.hasDoc=!0;for(let t of e.jsDoc)if("string"==typeof t.comment&&(this.fullDefinitions.push(t.getText()),this.definitions.push(t.comment)),t.tags)for(let e of t.tags)if(this.fullDefinitions.push(e.getText()),e.kind==r.SyntaxKind.JSDocParameterTag){let t=e;"string"==typeof t.comment&&(this.documentationParameters[t.name.getText()]=t.comment)}else if(e.kind==r.SyntaxKind.JSDocReturnTag){let t=e;"string"==typeof t.comment&&(this.documentationReturn=t.comment)}else if(e.kind==r.SyntaxKind.JSDocTemplateTag){let t=e;if("string"==typeof t.comment)for(let e of t.typeParameters)this.documentationTemplates[e.name.getText()]=t.comment}else if(e.kind==r.SyntaxKind.JSDocTag){let t=e.getText().trim();if(t.startsWith("@slot")){const e=/@slot\s*([a-zA-z\-]*)\s*?(-|$)(.*)/gm.exec(t);if(e){let t=e[1];t||(t="default");let n=e[3];n&&(this.documentationSlots[t]=n)}}}}}}},25779:(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EnumInfo=void 0;const BaseInfo_1=__webpack_require__(90946),DocumentationInfo_1=__webpack_require__(80352);class EnumInfo extends BaseInfo_1.BaseInfo{node;constructor(e,t,n){super(e,t,n,!1),this.infoType=BaseInfo_1.InfoType.enum,this.node=e}defineStoryContent(){let result={kind:"enum",name:this.name,properties:[]};this.setNamespaceForStroy(result),this.setDocumentationForStroy(result),this.setAccessibilityForStroy(result);let inferredValue=0;for(let member of this.node.members){const propertyTemp={name:member.name.getText()};let value;member.initializer?(value=eval(member.initializer.getText()),inferredValue=value+1):value=inferredValue++,propertyTemp.value=value+"";let docTemp=new DocumentationInfo_1.DocumentationInfo(member);docTemp.hasDoc&&(propertyTemp.documentation=docTemp.definitions.join("\n")),result.properties.push(propertyTemp)}return result}}exports.EnumInfo=EnumInfo},43884:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FunctionInfo=void 0;const r=n(94625),i=n(90946),s=n(73218);class a extends i.BaseInfo{node;constructor(e,t,n){if(super(e,t,n),this.node=e,this.infoType=i.InfoType.function,e.typeParameters)for(let t of e.typeParameters)this.preventDependanceAdd(t.name.getText()),t.constraint&&this.addDependance(t.constraint,!0);for(let t of e.parameters)t.type&&this.addDependance(t.type,!1);(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.Block&&this.loadOnlyDependancesRecu(e,0,!1)}))}defineStoryContent(){let e={kind:"function",name:this.name};if(this.setNamespaceForStroy(e),this.setDocumentationForStroy(e),this.setAccessibilityForStroy(e),this.node.typeParameters){e.generics=[];for(let t of this.node.typeParameters)e.generics.push(this.loadGenericForStory(t))}if(this.node.parameters.length>0){e.parameters=[];for(let t of this.node.parameters)e.parameters.push(this.loadParameterForStory(t))}if(this.node.type){const t=new s.TypeInfo(this.node.type),n=this.transformTypeForStory(t,this);if(n){const t={type:n};this.documentation?.documentationReturn&&(t.documentation=this.documentation.documentationReturn),e.return=t}}return e}}t.FunctionInfo=a},82599:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportInfo=void 0;const r=n(94625),i=n(10604),s=n(42374),a=n(19408),o=n(1539),l=n(71017),c=n(83693),u=n(57147),p=n(72375),_=n(18952);class d{static Parse(e,t,n){if(e.importClause)if(e.importClause.namedBindings){if(e.importClause.namedBindings.kind==r.SyntaxKind.NamespaceImport){let i=e.moduleSpecifier.getText().replace(/"/g,"").replace(/'/g,"");if(i=n.build.project.resolveAlias(i,t),i.startsWith("."))n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("error can't use namespace import","\n")});else{let t=e.importClause.namedBindings.name.getText();e.importClause.isTypeOnly||(n.build.npmBuilder.register(n.document.uri,{libName:"*",uri:i,alias:t}),n.npmImports[t]={uri:i,nameInsideLib:"*"})}}else if(e.importClause.namedBindings.kind==r.SyntaxKind.NamedImports){let i=e.moduleSpecifier.getText().replace(/"/g,"").replace(/'/g,"");if(i=n.build.project.resolveAlias(i,t),i.startsWith("."))for(let t of e.importClause.namedBindings.elements)if(t.propertyName)n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("error can't use renamed import","\n")});else{let r=t.isTypeOnly||e.importClause.isTypeOnly;const s={parserInfo:n,moduleName:i,identifier:t.name,isTypeImport:r};let a=new d(s);n.importsLocal[a.name]=a}else if(!i.startsWith(".")&&i.includes(a.AventusExtension.Package))for(let t of e.importClause.namedBindings.elements)if(t.propertyName)n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("error can't use renamed import","\n")});else{let o=t.name.getText(),l=i.split(":");if(l.length>1){let e=l[1].replace(a.AventusExtension.Package,"")+"."+o;n.packages[o]={fullname:e}}else n.errors.push({range:s.Range.create(n.document.positionAt(e.getStart()),n.document.positionAt(e.getEnd())),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("The package import is malformated","\n")})}else for(let t of e.importClause.namedBindings.elements){let r=t.name.getText(),s=r;t.propertyName&&(s=t.propertyName.getText()),e.importClause.isTypeOnly||t.isTypeOnly||(n.build.npmBuilder.register(n.document.uri,{libName:s,uri:i,alias:r}),n.npmImports[r]={uri:i,nameInsideLib:s})}}}else if(e.importClause.name){let r=e.moduleSpecifier.getText().replace(/"/g,"").replace(/'/g,"");if(r=n.build.project.resolveAlias(r,t),r.startsWith(".")){const t={parserInfo:n,moduleName:r,identifier:e.importClause.name,isTypeImport:e.importClause.isTypeOnly};let i=new d(t);n.importsLocal[i.name]=i}else e.importClause.isTypeOnly||(n.build.npmBuilder.register(n.document.uri,{libName:"default",uri:r,alias:this.name}),n.npmImports[this.name]={uri:r,nameInsideLib:"default"})}}static ManualLocalImport(e,t,n){const r=e.parserInfo;let i=t.split(".").pop();if(!i)return;const s={parserInfo:e.parserInfo,name:i,moduleUri:n};let a=new d(s);if(r.manualImportLocal[a.name]){let e=0,t=i+e;for(;r.manualImportLocal[t];)e++,t=i+e;i=t,a.alias=i}return r.manualImportLocal[i]=a,a}nameStart=0;nameEnd=0;name="";info;realName;isTypeImport;alias;_parserInfo;get parserInfo(){return this._parserInfo}isCst1(e){return!!e.identifier}constructor(e){let t;if(this._parserInfo=e.parserInfo,this.isCst1(e)?(this.name=e.identifier.getText(),this.nameStart=e.identifier.getStart(),this.nameEnd=e.identifier.getEnd(),this.isTypeImport=e.isTypeImport,t=(0,o.pathToUri)((0,l.normalize)((0,o.getFolder)((0,o.uriToPath)(this.parserInfo.document.uri))+"/"+e.moduleName))):(this.name=e.name,this.nameStart=0,this.nameEnd=0,this.isTypeImport=!1,t=e.moduleUri),!i.ParserTs.parsedDoc[t]){let e=c.FilesManager.getInstance().getByUri(t);if(e)i.ParserTs.parse(e,!1,this.parserInfo.build);else{let e=(0,o.uriToPath)(t),n=(0,u.existsSync)(e)?(0,u.readFileSync)(e,"utf8"):"",r=new p.InternalAventusFile(_.TextDocument.create(t,a.AventusLanguageId.TypeScript,1,n));i.ParserTs.parse(r,!1,this.parserInfo.build)}}if(i.ParserTs.parsedDoc[t]?.result.isReady){let e=i.ParserTs.parsedDoc[t].result.getBaseInfo(this.name);e?this.info=e:i.ParserTs.addError(this.nameStart,this.nameEnd,"Can't load "+t+" "+this.name+" from "+this.parserInfo.document.uri)}else{if(this.parserInfo.waitingImports[this.name])return;this.parserInfo.waitingImports[this.name]=[],i.ParserTs.parsedDoc[t].result.onReady((()=>{this.asyncImportLocal(t,this.name)}))}}asyncImportLocal(e,t){let n=i.ParserTs.parsedDoc[e].result.getBaseInfo(t);if(n){this.info=n;let e=[this.parserInfo.classes,this.parserInfo.enums,this.parserInfo.aliases,this.parserInfo.functions,this.parserInfo.variables];for(let r of e)for(let e in r){let i=r[e];for(let e of i.dependances)"@external"==e.uri&&e.fullName==t&&(e.uri="@local",e.fullName="$namespace$"+n.fullName)}for(let e of this.parserInfo.waitingImports[t])e(n);delete this.parserInfo.waitingImports[t]}else i.ParserTs.addError(this.nameStart,this.nameEnd,"Can't load "+e+" "+t+" from "+this.parserInfo.document.uri)}}t.ImportInfo=d},46057:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MethodInfo=void 0;const r=n(94625),i=n(74950),s=n(10604),a=n(34385),o=n(90946),l=n(61698),c=n(80352);t.MethodInfo=class{fullStart=0;start=0;end=0;name="";nameStart=0;nameEnd=0;content="";documentation;decorators=[];_class;accessibilityModifierTransformation;mustBeCompiled=!0;isStatic=!1;isOverride=!1;isAbstract=!1;isPrivate=!1;isProtected=!1;node;get compiledContent(){return o.BaseInfo.getContent(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentHotReload(){return o.BaseInfo.getContentHotReload(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentNpm(){return o.BaseInfo.getContentNpm(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}constructor(e,t){this.node=e,this._class=t,this.fullStart=e.getFullStart(),this.start=e.getStart(),this.end=e.getEnd(),this.name=e.name.getText(),this.nameStart=e.name.getStart(),this.nameEnd=e.name.getEnd(),this.content=e.getText(),this.decorators=i.DecoratorInfo.buildDecorator(e,t);let n=new c.DocumentationInfo(e);n.hasDoc&&(this.documentation=n),this.loadAccessibilityModifier(e);for(let e of this.decorators)if(l.NoCompileDecorator.is(e)){this.mustBeCompiled=!1;break}}loadAccessibilityModifier(e){let t=!1,n=null;for(let e of this.decorators){let t=a.InternalDecorator.is(e);if(t){n=t;break}let r=a.InternalProtectedDecorator.is(e);if(r){n=r;break}}if(e.modifiers)for(let i of e.modifiers)if(i.kind==r.SyntaxKind.PublicKeyword){if(n){let e=n instanceof a.InternalDecorator?"private":"protected";this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:e},"private"==e?this.isPrivate=!0:"protected"==e&&(this.isProtected=!0)}t=!0}else i.kind==r.SyntaxKind.ProtectedKeyword?(n instanceof a.InternalDecorator?(this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:"private"},this.isPrivate=!0):this.isProtected=!0,t=!0):i.kind==r.SyntaxKind.PrivateKeyword?(t=!0,this.isPrivate=!0):i.kind==r.SyntaxKind.OverrideKeyword?this.isOverride=!0:i.kind==r.SyntaxKind.StaticKeyword?this.isStatic=!0:i.kind==r.SyntaxKind.AbstractKeyword&&(this.isAbstract=!0);this.documentation||this.isOverride||this.isPrivate||s.ParserTs.addWarning(this.nameStart,this.nameEnd,"You should add documentation for "+this.name),!1!==t||this._class.isInterface||s.ParserTs.addError(this.nameStart,this.nameEnd,"A accessibility modifier (public / private / protected) is mandatory for "+this.name)}}},10278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NamespaceInfo=void 0;t.NamespaceInfo=class{start=0;end=0;name="";bodyStart=0;bodyEnd=0;constructor(e){this.name=e.name.getText(),this.start=e.getStart(),this.end=e.getEnd(),e.body&&(this.bodyStart=e.body.getStart()+1,this.bodyEnd=e.body.getEnd()-1)}}},10604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParserTs=void 0;const r=n(94625),i=n(42374),s=n(19408),a=n(99071),o=n(90946),l=n(65887),c=n(25779),u=n(10278),p=n(25850),_=n(43884),d=n(89403),h=n(82599);class f{static waitingUri={};static parsedDoc={};static parse(e,t,n){return f.parsedDoc[e.uri]&&this.parsedDoc[e.uri].version==e.versionInternal?this.parsedDoc[e.uri].result:(new f(e,t,n),f.parsedDoc[e.uri].result)}static parsingDocs=[];static get currentParsingDoc(){return this.parsingDocs.length>0?this.parsingDocs[this.parsingDocs.length-1]:null}static addError(e,t,n){if(this.currentParsingDoc&&!this.currentParsingDoc.isLib){let a={range:i.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:i.DiagnosticSeverity.Error,source:s.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)(n,"\n")};this.currentParsingDoc.errors.push(a)}}static addWarning(e,t,n){if(this.currentParsingDoc&&!this.currentParsingDoc.isLib){let a={range:i.Range.create(this.currentParsingDoc.document.positionAt(e),this.currentParsingDoc.document.positionAt(t)),severity:i.DiagnosticSeverity.Warning,source:s.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)(n,"\n")};this.currentParsingDoc.errors.push(a)}}static getBaseInfo(e){for(let t in this.parsedDoc){let n=this.parsedDoc[t].result.getBaseInfo(e);if(n)return n}return null}static hasImport(e){return!!f.currentParsingDoc&&(!!f.currentParsingDoc.importsLocal[e]||(!!f.currentParsingDoc.waitingImports[e]||(!!f.currentParsingDoc.npmImports[e]||!!f.currentParsingDoc.packages[e])))}static hasLocal(e){return!!f.currentParsingDoc&&!!f.currentParsingDoc.internalObjects[e]}content;errors=[];_document;get document(){return this._document}currentNamespace=[];namespaces=[];classes={};functions={};enums={};importsLocal={};manualImportLocal={};packages={};npmImports={};npmGeneratedImport={};internalObjects={};waitingImports={};aliases={};variables={};isLib=!1;isReady=!1;build;file;srcFile;npmAliases={};constructor(e,t,n){this.build=n,this.build.npmBuilder.unregister(e.documentUser.uri),this.file=e,f.parsedDoc[e.uri]={version:e.versionInternal,result:this},f.parsingDocs.push(this),this.content=e.documentInternal.getText(),this._document=e.documentInternal,this.isLib=t;let i=(0,r.createSourceFile)("sample.ts",this.content,r.ScriptTarget.ESNext,!0);this.srcFile=i,this.quickLoadRoot(i),this.loadRoot(i),f.parsingDocs.pop(),this.isReady=!0;for(let e of this.readyCb)e();if(this.readyCb=[],f.waitingUri[e.uri]){for(let t of f.waitingUri[e.uri])t();delete f.waitingUri[e.uri]}}readyCb=[];onReady(e){this.isReady||this.readyCb.push(e)}quickLoadRoot(e){(0,r.forEachChild)(e,(e=>{if(e.kind==r.SyntaxKind.ModuleDeclaration){let t=e;(0,p.hasFlag)(t.flags,r.NodeFlags.Namespace)&&t.body?(this.currentNamespace.push(t.name.getText()),this.quickLoadRoot(t),this.currentNamespace.splice(this.currentNamespace.length-1,1)):(0,p.hasFlag)(t.flags,r.NodeFlags.GlobalAugmentation)&&t.body&&this.quickLoadRoot(t)}else if(e.kind==r.SyntaxKind.ClassDeclaration||e.kind==r.SyntaxKind.InterfaceDeclaration){let t=e;if(t.name){let n=t.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:e.kind==r.SyntaxKind.ClassDeclaration}}}else if(e.kind==r.SyntaxKind.EnumDeclaration){let t=e,n=t.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!0}}else if(e.kind==r.SyntaxKind.TypeAliasDeclaration){let t=e,n=t.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!1}}else if(e.kind==r.SyntaxKind.FunctionDeclaration){let t=e;if(t.name){let e=t.name.getText();this.internalObjects[e]={fullname:[...this.currentNamespace,e].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!0}}}else if(e.kind==r.SyntaxKind.VariableStatement){let t=e;for(let e of t.declarationList.declarations)if(e.kind==r.SyntaxKind.VariableDeclaration){let n=e.name.getText();this.internalObjects[n]={fullname:[...this.currentNamespace,n].join("."),isExported:o.BaseInfo.isExported(t),isStoryExported:!!this.build.buildConfig.stories&&o.BaseInfo.isStoryExported(t,this.build),isCompiled:!0}}}else e.kind==r.SyntaxKind.ModuleBlock&&this.quickLoadRoot(e)}))}loadRoot(e){(0,r.forEachChild)(e,(e=>{e.kind==r.SyntaxKind.ImportDeclaration?this.loadImport(e):e.kind==r.SyntaxKind.ModuleDeclaration?this.loadNamespace(e):e.kind==r.SyntaxKind.ClassDeclaration||e.kind==r.SyntaxKind.InterfaceDeclaration?this.loadClass(e):e.kind==r.SyntaxKind.EnumDeclaration?this.loadEnum(e):e.kind==r.SyntaxKind.TypeAliasDeclaration?this.loadAlias(e):e.kind==r.SyntaxKind.FunctionDeclaration?this.loadFunction(e):e.kind==r.SyntaxKind.VariableStatement?this.loadVariableStatement(e):e.kind==r.SyntaxKind.ModuleBlock?this.loadRoot(e):(e.kind,r.SyntaxKind.EndOfFileToken)}))}loadImport(e){h.ImportInfo.Parse(e,this.file,this)}loadNamespace(e){(0,p.hasFlag)(e.flags,r.NodeFlags.Namespace)&&e.body?(this.namespaces.push(new u.NamespaceInfo(e)),this.currentNamespace.push(e.name.getText()),this.loadRoot(e),this.currentNamespace.splice(this.currentNamespace.length-1,1)):(0,p.hasFlag)(e.flags,r.NodeFlags.GlobalAugmentation)&&e.body?this.loadRoot(e):this.errors.push({range:i.Range.create(this.document.positionAt(e.getStart()),this.document.positionAt(e.getEnd())),severity:i.DiagnosticSeverity.Error,source:s.AventusLanguageId.TypeScript,message:(0,r.flattenDiagnosticMessageText)("Can't use a module, use namespace instead","\n")})}loadClass(e){if(e.name){let t=new l.ClassInfo(e,this.currentNamespace,this);this.classes[t.name]?t.isInterface?this.classes[t.name].mergeClassInfo(t):(t.mergeClassInfo(this.classes[t.name]),this.classes[t.name]=t):this.classes[t.name]=t,this.defineStorie(this.classes[t.name])}}loadFunction(e){if(e.name){let t=new _.FunctionInfo(e,this.currentNamespace,this);this.defineStorie(t),this.functions[t.name]=t}}loadEnum(e){let t=new c.EnumInfo(e,this.currentNamespace,this);this.defineStorie(t),this.enums[t.name]=t}loadAlias(e){let t=new a.AliasInfo(e,this.currentNamespace,this);this.defineStorie(t),this.aliases[t.name]=t}loadVariableStatement(e){o.BaseInfo.isExported(e);for(let t of e.declarationList.declarations)t.kind==r.SyntaxKind.VariableDeclaration&&(t.jsDoc=e.jsDoc,this.loadVariable(t,e))}loadVariable(e,t){let n=new d.VariableInfo(e,this.currentNamespace,this,t);this.defineStorie(n),this.variables[n.name]=n}defineStorie(e){e.loadStorieContent()}getBaseInfo(e){return this.classes[e]?this.classes[e]:this.aliases[e]?this.aliases[e]:this.enums[e]?this.enums[e]:this.functions[e]?this.functions[e]:this.variables[e]?this.variables[e]:null}getBaseInfoFullName(e){const t=e.split(".").pop()??e;return this.getBaseInfo(t)}registerGeneratedImport(e){if(!this.build.hasNpmOutput)return;const{uri:t,name:n,compiled:r,alias:i,onlySrc:s,nameAlias:a,forced:o}=e,l=n==i?void 0:i;if(this.npmGeneratedImport[t]){-1==this.npmGeneratedImport[t].findIndex((e=>e.name==n))&&this.npmGeneratedImport[t].push({name:n,nameAlias:a,compiled:r,alias:l,onlySrc:s,forced:o})}else this.npmGeneratedImport[t]=[{name:n,nameAlias:a,compiled:r,alias:l,onlySrc:s,forced:o}]}getNpmReplacementName(e,t){return this.build.getNpmReplacementName(e,t)}}t.ParserTs=f},37559:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PropertyInfo=void 0;const r=n(94625),i=n(74950),s=n(10604),a=n(73218),o=n(34385),l=n(90946),c=n(80352),u=n(95396);t.PropertyInfo=class{name="";nameStart=0;nameEnd=0;documentation;decorators=[];defaultValueTxt=null;defaultValueStart=0;defaultValueEnd=0;content="";type;prop;isAbstract=!1;isGet=!1;isSet=!1;isGetSet=!1;isInsideInterface=!1;isStatic=!1;isProtected=!1;isPrivate=!1;isOverride=!1;start=0;end=0;isNullable=!1;overrideNullable=!1;_class;accessibilityModifierTransformation;get compiledContent(){return l.BaseInfo.getContent(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentHotReload(){return l.BaseInfo.getContentHotReload(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get compiledContentNpm(){return l.BaseInfo.getContentNpm(this.content,this.start,this.end,this._class.dependancesLocations,this._class.compileTransformations)}get defaultValue(){return null===this.defaultValueTxt?null:l.BaseInfo.getContent(this.defaultValueTxt,this.defaultValueStart,this.defaultValueEnd,this._class.dependancesLocations,this._class.compileTransformations)}get defaultValueHotReload(){return null===this.defaultValueTxt?null:l.BaseInfo.getContentHotReload(this.defaultValueTxt,this.defaultValueStart,this.defaultValueEnd,this._class.dependancesLocations,this._class.compileTransformations)}get defaultValueNpm(){return null===this.defaultValueTxt?null:l.BaseInfo.getContentNpm(this.defaultValueTxt,this.defaultValueStart,this.defaultValueEnd,this._class.dependancesLocations,this._class.compileTransformations)}defaultValueStory=null;constructor(e,t,n){this.isInsideInterface=t,this._class=n,this.prop=e,this.name=e.name.getText(),this.nameStart=e.name.getStart(),this.nameEnd=e.name.getEnd(),this.start=e.getStart(),this.end=e.getEnd(),this.content=e.getText(),this.decorators=i.DecoratorInfo.buildDecorator(e,n),e.kind==r.SyntaxKind.GetAccessor?this.isGet=!0:e.kind==r.SyntaxKind.SetAccessor?this.isSet=!0:this.isGetSet=!0;let s=new c.DocumentationInfo(e);s.hasDoc&&(this.documentation=s),e.questionToken&&(this.isNullable=!0),e.exclamationToken&&(this.overrideNullable=!0),this.loadAccessibilityModifier(e),this.type=this.loadType(e),this.loadInitializer(e);for(let e of this.decorators){let t=u.StoryValueDecorator.is(e);t&&(this.defaultValueStory=t.value)}}loadAccessibilityModifier(e){if(this.isInsideInterface)return;let t=!1,n=null;for(let e of this.decorators){let t=o.InternalDecorator.is(e);if(t){n=t;break}let r=o.InternalProtectedDecorator.is(e);if(r){n=r;break}}if(e.modifiers)for(let i of e.modifiers)if(i.kind==r.SyntaxKind.PublicKeyword){if(n){let e=n instanceof o.InternalDecorator?"private":"protected";this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:e},"private"==e?this.isPrivate=!0:"protected"==e&&(this.isProtected=!0)}t=!0}else i.kind==r.SyntaxKind.ProtectedKeyword?(n instanceof o.InternalDecorator?(this.accessibilityModifierTransformation={start:i.getStart(),end:i.getEnd(),newText:"private"},this.isPrivate=!0):this.isProtected=!0,t=!0):i.kind==r.SyntaxKind.PrivateKeyword?(t=!0,this.isPrivate=!0):i.kind==r.SyntaxKind.AbstractKeyword?this.isAbstract=!0:i.kind==r.SyntaxKind.OverrideKeyword?this.isOverride=!0:i.kind==r.SyntaxKind.StaticKeyword&&(this.isStatic=!0);this.documentation||this.isOverride||this.isPrivate||s.ParserTs.addWarning(this.nameStart,this.nameEnd,"You should add documentation for "+this.name),!1===t&&s.ParserTs.addError(e.getStart(),e.getEnd(),"A accessibility modifier (public / private / protected) is mandatory for "+this.name)}loadType(e){let t,n=e;return t=n.type?new a.TypeInfo(n.type):n.initializer&&n.initializer.kind==r.SyntaxKind.ExpressionWithTypeArguments?new a.TypeInfo(n.initializer):new a.TypeInfo(null),t}loadInitializer(e){let t=e;t.initializer&&(this.defaultValueTxt=t.initializer.getText(),this.defaultValueStart=t.initializer.getStart(),this.defaultValueEnd=t.initializer.getEnd())}}},73218:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeInfo=void 0;const r=n(94625);class i{kind="mock";value="";isArray=!1;genericValue=[];nested=[];start=0;end=0;endNonGeneric=0;fctType;conditionalType;mappedType;node;constructor(e){if(e)if(this.node=e,this.start=e.getStart(),this.end=e.getEnd(),this.endNonGeneric=this.end,e.kind==r.SyntaxKind.StringKeyword)this.kind="string";else if(e.kind===r.SyntaxKind.NumberKeyword)this.kind="number";else if(e.kind===r.SyntaxKind.BooleanKeyword)this.kind="boolean";else if(e.kind===r.SyntaxKind.NullKeyword)this.kind="null";else if(e.kind===r.SyntaxKind.UndefinedKeyword)this.kind="undefined";else if(e.kind===r.SyntaxKind.AnyKeyword)this.kind="any";else if(e.kind===r.SyntaxKind.NeverKeyword)this.kind="never";else if(e.kind===r.SyntaxKind.VoidKeyword)this.kind="void";else if(e.kind===r.SyntaxKind.UnknownKeyword)this.kind="unknown";else if(e.kind===r.SyntaxKind.ObjectKeyword)this.kind="object";else if(e.kind===r.SyntaxKind.SymbolKeyword)this.kind="symbol";else if(e.kind===r.SyntaxKind.ThisType)this.kind="this";else if(e.kind===r.SyntaxKind.LiteralType)this.kind="literal",this.value=e.literal.getText();else if(e.kind===r.SyntaxKind.TypeReference){this.kind="type";let t=e;if(this.value=t.typeName.getText(),this.endNonGeneric=t.typeName.end,"const"==this.value)return this.value="",void(this.kind="mock");if(t.typeArguments)for(let e of t.typeArguments)this.genericValue.push(new i(e))}else if(e.kind===r.SyntaxKind.ArrayType){let t=e;this.isArray=!0;let n=new i(t.elementType);this.genericValue=n.genericValue,this.nested=n.nested,this.kind=n.kind,this.value=n.value,this.endNonGeneric=n.endNonGeneric}else if(e.kind===r.SyntaxKind.UnionType){let t=e;this.kind="union";for(let e of t.types)this.nested.push(new i(e))}else if(e.kind===r.SyntaxKind.IntersectionType){let t=e;this.kind="intersection";for(let e of t.types)this.nested.push(new i(e))}else if(e.kind===r.SyntaxKind.TypeOperator){let t=e;this.kind="typeOperator",t.operator==r.SyntaxKind.KeyOfKeyword?this.value="keyof":t.operator==r.SyntaxKind.UniqueKeyword?this.value="unique":t.operator==r.SyntaxKind.ReadonlyKeyword&&(this.value="readonly"),this.nested.push(new i(t.type))}else if(e.kind==r.SyntaxKind.TypeQuery){let t=e;this.kind="typeOperator",this.value="typeof";let n=new i(null);n.kind="type",n.value=t.exprName.getText(),this.nested.push(n)}else if(e.kind===r.SyntaxKind.ExpressionWithTypeArguments){let t=e;if(this.kind="type",this.value=t.expression.getText(),this.endNonGeneric=t.expression.getEnd(),t.typeArguments)for(let e of t.typeArguments)this.genericValue.push(new i(e))}else if(e.kind===r.SyntaxKind.TypeLiteral){let t=e;this.kind="typeLiteral",this.value=t.getText();for(let e of t.members)if(e.kind==r.SyntaxKind.IndexSignature){let t=e;this.nested.push(new i(t.type))}else if(e.kind==r.SyntaxKind.PropertySignature){let t=e;t.type&&this.nested.push(new i(t.type))}}else if(e.kind==r.SyntaxKind.ParenthesizedType){let t=new i(e.type);this.genericValue=t.genericValue,this.nested=t.nested,this.kind=t.kind,this.value=t.value,this.isArray=t.isArray,this.endNonGeneric=t.endNonGeneric}else if(e.kind==r.SyntaxKind.ConstructorType){let t=e;this.kind="constructor",this.value=e.getText();const n={};for(let e of t.parameters)if(e.type){const t=new i(e.type);n[e.name.getText()]=t,this.nested.push(t)}this.fctType={return:new i(t.type),parameters:n},this.nested.push(this.fctType.return)}else if(e.kind==r.SyntaxKind.FunctionType){let t=e;this.kind="function",this.value=e.getText();const n={};for(let e of t.parameters)if(e.type){const t=new i(e.type);n[e.name.getText()]=t,this.nested.push(t)}this.fctType={return:new i(t.type),parameters:n},this.nested.push(this.fctType.return)}else if(e.kind==r.SyntaxKind.TupleType){let t=e;this.kind="tuple";for(let e of t.elements)this.nested.push(new i(e))}else if(e.kind==r.SyntaxKind.ConditionalType){let t=e;this.kind="conditional",this.conditionalType={check:new i(t.checkType),extends:new i(t.extendsType),false:new i(t.falseType),true:new i(t.trueType)}}else if(e.kind==r.SyntaxKind.MappedType){this.kind="mappedType";let t=e;t.type&&t.typeParameter.constraint?(t.questionToken,this.mappedType={parameterName:t.typeParameter.name.getText(),parameterType:new i(t.typeParameter.constraint),type:new i(t.type)},t.questionToken?.kind==r.SyntaxKind.QuestionToken?this.mappedType.modifier="?":t.questionToken?.kind==r.SyntaxKind.PlusToken?this.mappedType.modifier="+":t.questionToken?.kind==r.SyntaxKind.MinusToken&&(this.mappedType.modifier="-")):console.log("you must add the new type : MappedType like "+e.getText())}else if(e.kind==r.SyntaxKind.IndexedAccessType){this.kind="indexedAccess";let t=e;this.nested.push(new i(t.objectType)),this.nested.push(new i(t.indexType))}else if(e.kind==r.SyntaxKind.InferType){let t=e;this.kind="infer",this.value=t.typeParameter.name.getText()}else{e.kind,e.getText()}else this.kind="notype"}}t.TypeInfo=i},89403:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VariableInfo=t.VariableInfoType=void 0;const r=n(94625),i=n(90946),s=n(73218),a=n(34385),o=n(74950);var l;!function(e){e.var="var",e.let="let",e.const="const"}(l||(t.VariableInfoType=l={}));class c extends i.BaseInfo{type=l.var;node;constructor(e,t,n,s){super(e,t,n),this.decorators=o.DecoratorInfo.buildDecorator(s,this),this.node=e,this.infoType=i.InfoType.variable,e.parent.flags==r.NodeFlags.Let?this.type=l.let:e.parent.flags==r.NodeFlags.Const&&(this.type=l.const),this.isExported=i.BaseInfo.isExported(s),this.isInternalExported=this.isExported;for(let e of this.decorators){if(a.InternalDecorator.is(e)){this.isExported=!1;break}}this.loadOnlyDependancesRecu(e,0,!0)}defineStoryContent(){let e={kind:"variable",name:this.name,modifier:this.type==l.const?"const":this.type==l.let?"let":"var"};if(this.setNamespaceForStroy(e),this.setDocumentationForStroy(e),this.setAccessibilityForStroy(e),this.node.type){const t=new s.TypeInfo(this.node.type),n=this.transformTypeForStory(t,this);n&&(e.type=n)}return e}}t.VariableInfo=c},92724:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindThisDecorator=void 0;class n{static is(e){if("BindThis"==e.name){return new n}return null}}t.BindThisDecorator=n},66145:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConvertibleDecorator=void 0;class n{name="Fullname";static is(e){if("Convertible"==e.name){let t=new n;if(e.arguments.length>0)try{t.name=e.arguments[0].value}catch(e){}return t}return null}}t.ConvertibleDecorator=n},50789:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DebuggerDecorator=void 0;class n{writeCompiled=!1;enableWatchHistory=!1;writeHTML=!1;writeComponentTs=!1;static is(e){if("Debugger"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);t.writeCompiled=1==n.writeCompiled,t.enableWatchHistory=1==n.enableWatchHistory,t.writeHTML=1==n.writeHTML,t.writeComponentTs=1==n.writeComponentTs}catch(e){}return t}return null}}t.DebuggerDecorator=n},17509:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultStateParser=t.DefaultStateActiveDecorator=void 0;class n{managerName="";static is(e){if("DefaultStateActive"==e.name){let t=new n;if(e.arguments.length>0)try{let n=r.parse(e);t.managerName=n.managerName}catch(e){}return t}return null}}t.DefaultStateActiveDecorator=n;class r{static parse(e){let t={managerName:""};try{let n=e.arguments[0].value;const r=e.baseInfo?.dependancesLocations[n]?.replacement;r&&(n=r),t.managerName=n}catch(e){}return t}}t.DefaultStateParser=r},49507:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultStateInactiveDecorator=void 0;const r=n(17509);class i{managerName="";static is(e){if("DefaultStateInactive"==e.name){let t=new i;if(e.arguments.length>0)try{let n=r.DefaultStateParser.parse(e);t.managerName=n.managerName}catch(e){}return t}return null}}t.DefaultStateInactiveDecorator=i},84900:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DependancesDecorator=void 0;class n{dependances=[];static is(e){if("Dependances"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);for(let e of n){let n=1==e.strong;t.dependances.push({type:e.type,strong:n})}}catch(e){}return t}return null}}t.DependancesDecorator=n},51907:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EffectDecorator=void 0;class n{options={autoInit:!0};static is(e){if("Effect"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);void 0!==n.autoInit&&(t.options.autoInit=n.autoInit)}catch(e){}return t}return null}}t.EffectDecorator=n},71159:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForeignKeyDecorator=void 0;class n{refType="";constructor(e){this.refType=e}static is(e){if("ForeignKey"==e.name&&e.arguments.length>0)try{if("identifier"==e.arguments[0].type){return new n(e.arguments[0].value)}}catch(e){}return null}}t.ForeignKeyDecorator=n},34385:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalProtectedDecorator=t.InternalDecorator=void 0;class n{static is(e){if("Internal"==e.name){return new n}return null}}t.InternalDecorator=n;class r{static is(e){if("InternalProtected"==e.name){return new r}return null}}t.InternalProtectedDecorator=r},61698:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoCompileDecorator=void 0;class n{static is(e){if("NoCompile"==e.name){return new n}return null}}t.NoCompileDecorator=n},91430:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverrideViewDecorator=void 0;class n{removeViewVariables=[];static is(e){if("OverrideView"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);n.removeViewVariables&&(t.removeViewVariables=n.removeViewVariables)}catch(e){}return t}return null}}t.OverrideViewDecorator=n},14710:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PropertyDecorator=void 0;class n{fctTxt=null;static is(e){if("Property"==e.name){let t=new n;if(e.arguments.length>0)try{"call"==e.arguments[0].type&&(t.fctTxt=e.arguments[0].value)}catch(e){}return t}return null}}t.PropertyDecorator=n},48117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredDecorator=void 0;class n{static is(e){if("Required"==e.name){return new n}return null}}t.RequiredDecorator=n},66450:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SignalDecorator=void 0;class n{fctTxt=null;static is(e){if("Signal"==e.name){let t=new n;if(e.arguments.length>0)try{"call"==e.arguments[0].type&&(t.fctTxt=e.arguments[0].value)}catch(e){}return t}return null}}t.SignalDecorator=n},72471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateParser=t.StateActiveDecorator=void 0;class n{stateName="";managerName="";functionName="active";static is(e){if("StateActive"==e.name){let t=new n;if(e.arguments.length>0)try{let n=r.parse(e);t.stateName=n.stateName,t.managerName=n.managerName??""}catch(e){}return t}return null}}t.StateActiveDecorator=n;class r{static parse(e){let t={stateName:""};try{let n=e.arguments[0].value;if("identifier"==e.arguments[0].type){let t=e.arguments[0].value.split(".");const r=e.baseInfo?.dependancesLocations[t[0]]?.replacement;r&&(t[0]=r),n=t.join(".")}if(t.stateName=n,e.arguments.length>1){let n=e.arguments[1].value;const r=e.baseInfo?.dependancesLocations[n]?.replacement;r&&(n=r),t.managerName=n}}catch(e){}return t}}t.StateParser=r},89018:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateChangeDecorator=void 0;const r=n(72471);class i{stateName="";managerName="";functionName="askChange";static is(e){if("StateChange"==e.name){let t=new i;if(e.arguments.length>0)try{let n=r.StateParser.parse(e);t.stateName=n.stateName,t.managerName=n.managerName??""}catch(e){}return t}return null}}t.StateChangeDecorator=i},91562:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateInactiveDecorator=void 0;const r=n(72471);class i{stateName="";managerName="";functionName="inactive";static is(e){if("StateInactive"==e.name){let t=new i;if(e.arguments.length>0)try{let n=r.StateParser.parse(e);t.stateName=n.stateName,t.managerName=n.managerName??""}catch(e){}return t}return null}}t.StateInactiveDecorator=i},95396:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoryValueDecorator=void 0;class n{static is(e){if("StoryValue"==e.name){if(e.arguments.length>0){let t=e.arguments[0].value;return new n(t)}return null}return null}value;constructor(e){this.value=e}}t.StoryValueDecorator=n},57315:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StorybookDecorator=void 0;class n{prefix;exportType;noLive;noDefaultStory;group;slots;static is(e){if("Storybook"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);if(n.prefix&&(t.prefix=n.prefix.replace(/(^('|"))|(('|")$)/g,"")),n.export&&(t.exportType=n.export.replace(/(^('|"))|(('|")$)/g,"")),n.group&&(t.group=n.group.replace(/(^('|"))|(('|")$)/g,"")),!0===n.noLive&&(t.noLive=!0),!0===n.noDefaultStory&&(t.noDefaultStory=!0),n.slots){if(t.slots={},n.slots.values){t.slots.values={};for(let e in n.slots.values)t.slots.values[e.replace(/(^('|"))|(('|")$)/g,"")]=n.slots.values[e]}n.slots.inject&&(t.slots.inject=n.slots.inject)}}catch(e){}return t}return null}}t.StorybookDecorator=n},95553:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagNameDecorator=void 0;class n{tagName="";static is(e){if("TagName"==e.name){let t=new n;return e.arguments.length>0&&(t.tagName=e.arguments[0].value),t}return null}}t.TagNameDecorator=n},55969:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ViewElementDecorator=void 0;class n{useLive=void 0;static is(e){if("ViewElement"==e.name){let t=new n;if(e.arguments.length>0)try{let n=JSON.parse(e.arguments[0].value);!0===n.useLive?t.useLive=!0:!1===n.useLive&&(t.useLive=!1)}catch(e){}return t}return null}}t.ViewElementDecorator=n},29383:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WatchDecorator=void 0;class n{fctTxt=null;static is(e){if("Watch"==e.name){let t=new n;if(e.arguments.length>0)try{"call"==e.arguments[0].type&&(t.fctTxt=e.arguments[0].value)}catch(e){}return t}return null}}t.WatchDecorator=n},25850:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasFlag=function(e,t){return 0!=(e&t)},t.buildJSON=i,t.getArg=function(e){if(e.kind==r.SyntaxKind.StringLiteral)return{type:"string",value:e.getText()};if(e.kind==r.SyntaxKind.NoSubstitutionTemplateLiteral)return{type:"string",value:e.getText()};if(e.kind==r.SyntaxKind.NumericLiteral)return{type:"number",value:e.getText()};if(e.kind==r.SyntaxKind.FalseKeyword)return{type:"boolean",value:"false"};if(e.kind==r.SyntaxKind.TrueKeyword)return{type:"boolean",value:"true"};if(e.kind==r.SyntaxKind.ObjectLiteralExpression)return{type:"object",value:i(e)};if(e.kind==r.SyntaxKind.ArrayLiteralExpression)return{type:"array",value:i(e)};if(e.kind==r.SyntaxKind.Identifier)return{type:"identifier",value:e.getText()};if(e.kind==r.SyntaxKind.CallExpression||e.kind==r.SyntaxKind.ArrowFunction||e.kind==r.SyntaxKind.FunctionExpression)return{type:"call",value:e.getText()};if(e.kind==r.SyntaxKind.PropertyAccessExpression)return{type:"identifier",value:e.getText()};return null};const r=n(94625);function i(e,t=null){if(e.kind==r.SyntaxKind.ObjectLiteralExpression){null==t&&(t={});for(let n of e.properties)if(n.kind==r.SyntaxKind.PropertyAssignment)if(n.initializer.kind==r.SyntaxKind.StringLiteral)t[n.name.getText()]=n.initializer.getText();else if(n.initializer.kind==r.SyntaxKind.NoSubstitutionTemplateLiteral)t[n.name.getText()]=n.initializer.getText();else if(n.initializer.kind==r.SyntaxKind.NumericLiteral)t[n.name.getText()]=Number(n.initializer.getText());else if(n.initializer.kind==r.SyntaxKind.FalseKeyword)t[n.name.getText()]=!1;else if(n.initializer.kind==r.SyntaxKind.TrueKeyword)t[n.name.getText()]=!0;else if(n.initializer.kind==r.SyntaxKind.Identifier)t[n.name.getText()]=n.initializer.getText();else if(n.initializer.kind==r.SyntaxKind.ObjectLiteralExpression){let e={};i(n.initializer,e),t[n.name.getText()]=e}else if(n.initializer.kind==r.SyntaxKind.ArrayLiteralExpression){let e=[];i(n.initializer,e),t[n.name.getText()]=e}}else if(e.kind==r.SyntaxKind.ArrayLiteralExpression){null==t&&(t=[]);for(let n of e.elements)if(n.kind==r.SyntaxKind.StringLiteral)t.push(n.getText());else if(n.kind==r.SyntaxKind.NoSubstitutionTemplateLiteral)t.push(n.getText());else if(n.kind==r.SyntaxKind.NumericLiteral)t.push(Number(n.getText()));else if(n.kind==r.SyntaxKind.FalseKeyword)t.push(!1);else if(n.kind==r.SyntaxKind.TrueKeyword)t.push(!0);else if(n.kind==r.SyntaxKind.ObjectLiteralExpression){let e={};i(n,e),t.push(e)}else if(n.kind==r.SyntaxKind.ArrayLiteralExpression){let e=[];i(n,e),t.push(e)}else n.kind==r.SyntaxKind.Identifier&&t.push(n.getText())}return JSON.stringify(t)}},7304:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusRamFile=void 0;const r=n(19408),i=n(6045),s=n(54145);class a extends s.AventusTsFile{get extension(){return r.AventusExtension.RAM}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){return this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.build.isCoreBuild?this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["IRam"]}):this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["Aventus.IRam"]}),this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,i.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}onFormatting(e,t,n){return this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusRamFile=a},98060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusStateFile=void 0;const r=n(19408),i=n(6045),s=n(54145);class a extends s.AventusTsFile{get extension(){return r.AventusExtension.State}constructor(e,t){super(e,t),this.refreshFileParsed()}async onValidate(){this.file.documentUser;return this.diagnostics=this.tsLanguageService.doValidation(this.file),this.fileParsed&&(this.diagnostics=this.diagnostics.concat(this.fileParsed.errors)),this.build.isCoreBuild?this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["IStateManager","IState"]}):this.validateRules({allow_variables:!1,allow_function:!1,class_implement:["Aventus.IStateManager","Aventus.IState"]}),this.diagnostics}async onContentChange(){this.refreshFileParsed()}async onSave(){this.setCompileResult((0,i.genericTsCompile)(this))}onCompletion(e,t){return this.tsLanguageService.doComplete(e,t)}onCompletionResolve(e,t){return this.tsLanguageService.doResolve(t)}onHover(e,t){return this.tsLanguageService.doHover(e,t)}onDefinition(e,t){return this.tsLanguageService.findDefinition(e,t)}async onFormatting(e,t,n){return await this.tsLanguageService.format(e,t,n)}onCodeAction(e,t){return this.tsLanguageService.doCodeAction(e,t)}onReferences(e,t){return this.tsLanguageService.onReferences(e,t)}onCodeLens(e){return this.tsLanguageService.onCodeLens(e)}async onRename(e,t,n){return this.tsLanguageService.onRename(e,t,n)}}t.AventusStateFile=a},76578:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AventusStaticFile=void 0;const r=n(57147),i=n(19408),s=n(54145),a=n(90946),o=n(6113);class l extends s.AventusTsFile{get extension(){return i.AventusExtension.Static}mustBeAddedToLanguageService(){return!1}async onValidate(){return[]}async onContentChange(){}async onSave(){let e=this.file.path,t=e.replace(this.extension,i.AventusExtension.Definition),n="",s="";t.endsWith(i.AventusExtension.Definition)&&(0,r.existsSync)(t)&&(n=(0,r.readFileSync)(t,"utf8").replace(/declare global \{((\s|\S)*)\}/gm,"$1"));let l=e.replace(this.extension,i.AventusExtension.DefinitionNpm);s=l.endsWith(i.AventusExtension.DefinitionNpm)&&(0,r.existsSync)(l)?(0,r.readFileSync)(l,"utf8"):n;let c=(0,o.createHash)("md5").update(e+this.file.contentUser).digest("hex"),u=this.file.path.replace(this.build.project.getConfigFile().path.replace(i.AventusExtension.Config,""),"");u=u.replace(this.extension,".js"),this.setCompileResult([{classDoc:"",classScript:"!staticClass_"+c,compiled:this.file.contentUser,hotReload:"",docVisible:n,npm:{namespace:"",defTs:s,src:this.file.contentUser,exportPath:u,uri:this.file.uri},docInvisible:"",debugTxt:"",dependances:[],uri:this.file.uri,required:!0,type:a.InfoType.none,isExported:{external:!1,internal:!1},convertibleName:"",story:{}}])}async onCompletion(e,t){return{isIncomplete:!1,items:[]}}async onCompletionResolve(e,t){return t}async onHover(e,t){return null}async onDefinition(e,t){return null}async onFormatting(e,t,n){return[]}async onCodeAction(e,t){return[]}async onReferences(e,t){return[]}async onCodeLens(e){return[]}async onRename(e,t,n){return null}}t.AventusStaticFile=l},60206:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpServer=void 0;const r=n(91385),i=n(68633),s=n(57310),a=n(13685),o=n(41808),l=n(71017),c=n(57147),u=n(44131),p=n(45497),_=n(2685),d=n(89398),h=n(97750),f=n(93035),m=n(31814),g=n(29495),y=n(24964);class v{static instance;static getInstance(){return this.instance||(this.instance=new v),this.instance}static get isRunning(){return!(!this.instance?.server||!this.instance.server.listening)}config;server;wss;reloadTimeout;clients=[];port=8080;constructor(){this.config=g.SettingsManager.getInstance().settings.liveserver}toggle(){this.server&&this.server.listening?this.stop():this.start()}async start(){if(!this.server||!this.server.listening){this.config=g.SettingsManager.getInstance().settings.liveserver,this.port=this.config.port;var e=r();let t=this.createStaticServer();if(e.use(t).use(this.entryPoint(t,this.config.indexFile)).use(p(this.config.rootFolder,{icons:!0})),this.server=(0,a.createServer)(e),this.server.addListener("listening",(()=>{let e=this.config.host;if("0.0.0.0"==e&&(e="127.0.0.1"),h.ServerStart.send(e,this.port),this.config.launch_browser){let t={};this.config.browser&&(t={app:{name:this.config.browser}}),m(`http://${e}:${this.port}`,t)}else{let e=`http://${this.config.host}:${this.port}`;y.GenericServer.showInformationMessage("Liver server started on "+e)}})),this.clients=[],this.wss=new d.WebSocketServer({server:this.server}),this.wss.on("connection",(e=>{e.onclose=()=>{this.clients=this.clients.filter((function(t){return t!==e}))},this.clients.push(e)})),this.config.autoIncrementPort)for(;await this.portInUse(this.config.host,this.port);)this.port++;else if(await this.portInUse(this.config.host,this.port))return void y.GenericServer.showErrorMessage("The port "+this.port+" is already in use");this.server.listen(this.port,this.config.host)}}stop(){for(let e of this.clients)e.close();this.clients=[],this.server&&(this.server.close(),this.server=void 0),this.wss&&(this.wss.close(),this.wss=void 0),f.ServerStop.send()}portInUse(e,t){return new Promise(((n,r)=>{var i=(0,o.createServer)((function(e){e.write("Echo server\r\n"),e.pipe(e)}));i.on("error",(function(e){n(!0)})),i.on("listening",(function(e){i.close(),n(!1)})),i.listen(t,e)}))}updateCSS(e,t,n){this.send("update_css",{css:e,element:t,children:n})}updateComponent(e,t,n){this.send("update_component",{js:e,element:t,children:n})}updateGlobalCSS(e,t){this.send("update_global_css",{name:e,css:t})}reload(){this.reloadTimeout&&clearTimeout(this.reloadTimeout),this.reloadTimeout=setTimeout((()=>{this._reload()}),this.config.delay)}_reload(){this.send("reload",{})}send(e,t){let n={cmd:e,params:t},r=JSON.stringify(n);for(let e of this.clients)e.readyState==d.WebSocket.OPEN&&e.send(r)}escape(e){return String(e).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}entryPoint(e,t){return function(n,r,i){n.url="/"+t,e(n,r,i)}}createStaticServer(){return(e,t,n)=>{if("GET"!==e.method&&"HEAD"!==e.method)return n();var r=s.parse(e.url||"").pathname||"",a=!e.headers.origin,o=[new RegExp("</head>","i"),new RegExp("</body>","i")],p=null;if(e.url?.startsWith("/?get_injected_code")){let n=e.headers.host;if(!n){n=this.config.host;let t=e.url.split("&");t.length>1&&(n=t[1].replace("host=","")),"0.0.0.0"==n&&(n="127.0.0.1"),n+=":"+this.port}let r="ws://"+n+"/ws",i=_.INJECTED_CODE.replace('<script type="text/javascript">',"");return i=i.replace("var address = protocol + window.location.host + window.location.pathname + '/ws';","var address = '"+r+"';"),i=i.replace("<\/script>",""),t.setHeader("Content-Length",i.length),t.setHeader("Content-type","text/javascript"),t.setHeader("Access-Control-Allow-Origin","*"),t.write(i,"utf8"),void t.end()}i(e,r,{root:this.config.rootFolder}).on("error",(function(e){if(404===e.status)return n();n(e)})).on("directory",(()=>{var n=s.parse(e.originalUrl||"").pathname;t.statusCode=301,t.setHeader("Location",n+"/"),t.end("Redirecting to "+this.escape(n||"")+"/")})).on("file",(function(e){var t,n=(0,l.extname)(e).toLocaleLowerCase();if(a&&["",".html"].indexOf(n)>-1)for(var r=(0,c.readFileSync)(e,"utf8"),i=0;i<o.length;++i)if(t=o[i].exec(r)){p=t[0];break}})).on("stream",(e=>{if(p){let i=p,s=_.INJECTED_CODE;this.config.auto_close&&(s=s.replace("//onclose","socket.onclose = function () { setTimeout(() => window.close(), 100); }"));var n=s.length+Number(t.getHeader("Content-Length"));t.setHeader("Content-Length",n);var r=e.pipe;e.pipe=function(t){r.call(e,(0,u.replace)(new RegExp(i,"i"),s+p)).pipe(t)}}})).pipe(t)}}}t.HttpServer=v},2685:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.INJECTED_CODE=void 0,t.INJECTED_CODE="<script type=\"text/javascript\">\nif ('WebSocket' in window) {\n\t(function () {\n\n\t\tvar protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';\n\t\tvar address = protocol + window.location.host + window.location.pathname + '/ws';\n\t\tvar socket = new WebSocket(address);\n\t\tconst getElement = function (name) {\n\t\t\tlet current = window\n\t\t\tlet splitted = name.split(\".\")\n\t\t\tfor (let part of splitted) {\n\t\t\t\tif (!current[part]) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\t\t\treturn current;\n\t\t}\n\t\tconst setElement = function (name, cst) {\n\t\t\tlet current = window\n\t\t\tlet splitted = name.split(\".\")\n\t\t\tfor (let i = 0; i < splitted.length - 1; i++) {\n\t\t\t\tlet part = splitted[i];\n\t\t\t\tif (!current[part]) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrent = current[part];\n\t\t\t}\n\t\t\tif(current){\n\t\t\t\tcurrent[splitted[splitted.length - 1]] = cst;\n\t\t\t}\n\t\t\treturn current;\n\t\t}\n\t\tsocket.onmessage = function (ev) {\n\t\t\ttry {\n\t\t\t\tlet content = ev.data;\n\t\t\t\tlet message = JSON.parse(content);\n\t\t\t\tif (message.cmd == \"reload\") {\n\t\t\t\t\twindow.location.reload(true);\n\t\t\t\t}\n\t\t\t\telse if (message.cmd == \"update_css\") {\n\t\t\t\t\tlet element = getElement(message.params.element);\n\t\t\t\t\tif (element) {\n\t\t\t\t\t\telement.__style = message.params.css;\n\t\t\t\t\t\tlet allInstances = Aventus.WebComponentInstance.getAllInstances(element);\n\t\t\t\t\t\tlet checkedType = [];\n\t\t\t\t\t\tfor (let webComp of allInstances) {\n\t\t\t\t\t\t\tlet cst = webComp.constructor;\n\t\t\t\t\t\t\tif (!checkedType.includes(cst) && cst.__styleSheets['@local']) {\n\t\t\t\t\t\t\t\tcheckedType.push(cst);\n\t\t\t\t\t\t\t\tlet styleTxt = webComp.__getStyle().join(\"\\r\\n\");\n\t\t\t\t\t\t\t\tcst.__styleSheets['@local'].replaceSync(styleTxt)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (message.cmd == \"update_global_css\") {\n\t\t\t\t\tAventus.Style.store(message.params.name, message.params.css)\n\t\t\t\t}\n\t\t\t\telse if (message.cmd == \"update_component\") {\n\t\t\t\t\tlet element = getElement(message.params.element);\n\t\t\t\t\tif (element) {\n\t\t\t\t\t\teval(`var __aventusHotReload = ${message.params.js}`);\n\t\t\t\t\t\tlet oldProps = Object.getOwnPropertyNames(element.prototype);\n\t\t\t\t\t\tlet newProps = Object.getOwnPropertyNames(__aventusHotReload.prototype);\n\t\t\t\t\t\tlet avoidProps = ['__getStatic', '__getStyle'];\n\t\t\t\t\t\tfor (let newPropName of newProps) {\n\t\t\t\t\t\t\tlet index = oldProps.indexOf(newPropName)\n\t\t\t\t\t\t\tif (index != -1) {\n\t\t\t\t\t\t\t\toldProps.splice(index, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(avoidProps.includes(newPropName)) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet descriptor = Object.getOwnPropertyDescriptor(element.prototype, newPropName);\n\t\t\t\t\t\t\tlet descriptor2 = Object.getOwnPropertyDescriptor(__aventusHotReload.prototype, newPropName);\n\t\t\t\t\t\t\tif (descriptor && descriptor.writable) {\n\t\t\t\t\t\t\t\telement.prototype[newPropName] = __aventusHotReload.prototype[newPropName];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (descriptor && descriptor2) {\n\t\t\t\t\t\t\t\tif (descriptor.get) {\n\t\t\t\t\t\t\t\t\tdescriptor.get = descriptor2.get;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (descriptor.set) {\n\t\t\t\t\t\t\t\t\tdescriptor.set = descriptor2.set;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (let oldPropName of oldProps) {\n\t\t\t\t\t\t\tdelete element.prototype[oldPropName];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tObject.defineProperty(__aventusHotReload, '__styleSheets', {\n\t\t\t\t\t\t\tget() { return element.__styleSheets }\n\t\t\t\t\t\t})\n\t\t\t\t\t\telement.__template = null;\n\t\t\t\t\t\tlet allInstances = Aventus.WebComponentInstance.getAllInstances(element)\n\t\t\t\t\t\tfor (let webComp of allInstances) {\n\t\t\t\t\t\t\tlet newInstance = new element();\n\n\t\t\t\t\t\t\tfor (let attr of webComp.attributes) {\n\t\t\t\t\t\t\t\tnewInstance[attr.name] = attr.value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (webComp.parentNode) {\n\t\t\t\t\t\t\t\twebComp.parentNode.insertBefore(newInstance, webComp);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twebComp.remove();\n\t\t\t\t\t\t\twebComp.destructor();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (e) { console.log(e); }\n\t\t}\n\t\tsocket.onerror = function () {\n\t\t\twindow.close();\n\t\t}\n\t\t//onclose\n\t})();\n}\n<\/script>"},93401:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskInput=void 0;const r=n(24964),i=n(36790);t.AskInput=class{static waitingResponse={};static send(e){return new Promise((t=>{let n=(0,i.v4)();for(;null!=this.waitingResponse[n];)n=(0,i.v4)();this.waitingResponse[n]=e=>{t(e)},r.GenericServer.sendNotification("aventus/askinput",n,e)}))}static resolve(e,t){this.waitingResponse[e]&&(this.waitingResponse[e](t),delete this.waitingResponse[e])}}},64961:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskSelect=void 0;const r=n(24964),i=n(36790);t.AskSelect=class{static waitingResponse={};static waitingOptions={};static send(e,t){return new Promise((n=>{let s=(0,i.v4)();for(;null!=this.waitingResponse[s];)s=(0,i.v4)();this.waitingOptions[s]=e,this.waitingResponse[s]=e=>{n(e)},r.GenericServer.sendNotification("aventus/askselect",s,e,t)}))}static resolve(e,t){if(this.waitingResponse[e]){if(t)for(let n of this.waitingOptions[e])n.label==t.label&&(t=n);this.waitingResponse[e](t),delete this.waitingResponse[e],delete this.waitingOptions[e]}}}},39567:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AskSelectMultiple=void 0;const r=n(24964),i=n(36790);t.AskSelectMultiple=class{static waitingResponse={};static send(e,t){return new Promise((n=>{let s=(0,i.v4)();for(;null!=this.waitingResponse[s];)s=(0,i.v4)();this.waitingResponse[s]=e=>{n(e)},r.GenericServer.sendNotification("aventus/askselectmultiple",s,e,t)}))}static resolve(e,t){this.waitingResponse[e]&&(this.waitingResponse[e](t),delete this.waitingResponse[e])}}},64945:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CloseFile=void 0;const r=n(24964);t.CloseFile=class{static send(e){r.GenericServer.sendNotification("aventus/closefile",e)}}},49177:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Compiled=void 0;const r=n(24964);t.Compiled=class{static send(e,t){r.GenericServer.sendNotification("aventus/compiled",e,t)}static part(e){r.GenericServer.sendNotification("aventus/compiled/part",e)}}},49387:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DebugFileAdd=void 0;const r=n(24964);t.DebugFileAdd=class{static send(e,t){r.GenericServer.sendNotification("aventus/addDebugFile",e,t)}}},22296:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditFile=void 0;const r=n(24964);t.EditFile=class{static send(e,t){r.GenericServer.sendNotification("aventus/editFile",{uri:e,transformations:t})}}},16378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InitStep=void 0;const r=n(24964);class i{static isInit=!1;static send(e){r.GenericServer.sendNotification("aventus/initStep",e)}static sendDone(){r.GenericServer.sendNotification("aventus/initStep","Aventus : Done"),i.isInit=!0}}t.InitStep=i},49404:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OpenFile=void 0;const r=n(24964);t.OpenFile=class{static send(e){r.GenericServer.sendNotification("aventus/openfile",e)}}},43438:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Popup=void 0;const r=n(24964),i=n(36790);t.Popup=class{static waitingResponse={};static send(e,...t){return new Promise((n=>{let s=(0,i.v4)();for(;null!=this.waitingResponse[s];)s=(0,i.v4)();this.waitingResponse[s]=e=>{n(e)},r.GenericServer.sendNotification("aventus/popup",s,e,t)}))}static resolve(e,t){this.waitingResponse[e]&&(this.waitingResponse[e](t),delete this.waitingResponse[e])}}},80013:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RegisterBuild=void 0;const r=n(24964);t.RegisterBuild=class{static send(e,t){r.GenericServer.sendNotification("aventus/registerBuild",{pathConfig:e,buildName:t})}}},62814:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Statistics=void 0;const r=n(57147),i=n(24964),s=n(29495),a=n(1539);t.Statistics=class{static get isEnable(){return s.SettingsManager.getInstance().settings.useStats}static startSendLoadFile(){this.isEnable&&a.Timer.start("load_files")}static sendLoadFile(){this.isEnable&&i.GenericServer.sendNotification("aventus/statistics/loadFileTime",a.Timer.stop("load_files"))}static startSendBuildTime(e){this.isEnable&&a.Timer.start("full_build_"+e)}static sendBuildTime(e){this.isEnable&&i.GenericServer.sendNotification("aventus/statistics/buildTime",e,a.Timer.stop("full_build_"+e))}static startSendStaticTime(e){this.isEnable&&a.Timer.start("full_static_"+e)}static sendStaticTime(e){this.isEnable&&i.GenericServer.sendNotification("aventus/statistics/staticTime",e,a.Timer.stop("full_static_"+e))}static sendFileSize(e,t,n,s){if(this.isEnable){let a=0;a="string"==typeof t?Buffer.from(t).length:(0,r.statSync)(e).size,i.GenericServer.sendNotification("aventus/statistics/fileSize",e,a,n,s)}}}},91908:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnregisterBuild=void 0;const r=n(24964);t.UnregisterBuild=class{static send(e,t){r.GenericServer.sendNotification("aventus/unregisterBuild",{pathConfig:e,buildName:t})}}},97750:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerStart=void 0;const r=n(24964);t.ServerStart=class{static send(e,t){r.GenericServer.sendNotification("aventus/server/start","http://"+e+":"+t)}}},93035:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerStop=void 0;const r=n(24964);t.ServerStop=class{static send(){r.GenericServer.sendNotification("aventus/server/stop",{})}}},96693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Compiling=void 0;const r=n(24964);t.Compiling=class{static send(e,t,n){r.GenericServer.sendNotification("aventus/sharp/compiling",e,t,n)}}},3006:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Build=void 0;const r=n(57147),i=n(22037),s=n(71017),a=n(42374),o=n(19408),l=n(83693),c=n(95896),u=n(38344),p=n(56733),_=n(99007),d=n(16286),h=n(54145),f=n(56941),m=n(37439),g=n(60206),y=n(49177),v=n(80013),$=n(91908),b=n(1539),S=n(6268),x=n(19601),w=n(24964),C=n(79875),E=n(22163),k=n(49387),A=n(48703),T=n(62814);t.Build=class{project;buildConfig;stories;onNewFileUUID;onFileDeleteUUIDs={};globalComponentSCSSFiles={};scssFiles={};tsFiles={};noNamespaceUri={};htmlFiles={};wcFiles={};namespaces=[];externalPackageInformation=new I(this);dependanceNeedUris=[];dependanceFullUris=[];dependanceUris=[];diagnostics=new Map;tsLanguageService;get globalSCSSLanguageService(){return this.project.globalSCSSLanguageService}scssLanguageService;htmlLanguageService;allowBuild=!0;initDone=!1;_filesLoaded=!1;reloadPage=!1;_outputPathes=[];npmBuilder;get fullname(){return this.buildConfig.fullname}get module(){return this.buildConfig.module}get isCoreBuild(){return this.project.isCoreBuild}get hideWarnings(){return this.buildConfig.hideWarnings}get nodeModulesDir(){return this.buildConfig.nodeModulesDir}get outputPathes(){return this._outputPathes}_hasNpmOutput;get hasNpmOutput(){if(void 0===this._hasNpmOutput){const e=-1!=this.buildConfig.compile.findIndex((e=>e.outputNpm.path.length>0));this._hasNpmOutput=e||this.hasStories}return this._hasNpmOutput}get hasStories(){return void 0!==this.buildConfig.stories}get filesLoaded(){return this._filesLoaded}constructor(e,t){this.project=e,this.buildConfig=t,this.onNewFileUUID=l.FilesManager.getInstance().onNewFile(this.onNewFile.bind(this)),this.tsLanguageService=new m.AventusTsLanguageService(this),this.scssLanguageService=new _.AventusSCSSLanguageService(this),this.htmlLanguageService=new u.AventusHTMLLanguageService(this),this.stories=new A.Storie(this,t),this._outputPathes=[(0,s.join)(S.DependanceManager.getInstance().getPath(),"@locals",this.buildConfig.fullname+o.AventusExtension.Package).replace(/\\/g,"/")];for(let e of t.compile)for(let t of e.package)this._outputPathes.push(t.replace(/\\/g,"/"));this.npmBuilder=new C.NpmBuilder(this),v.RegisterBuild.send(e.getConfigFile().path,t.fullname)}async init(){await this.loadFiles(),this.initDone=!0}getComponentPrefix(){return this.buildConfig.componentPrefix}getAvoidParsingTags(){return this.buildConfig.avoidParsingInsideTags}getAliases(){return this.project.getConfig()?.aliases??{}}isFileInside(e){return null!=(0,b.uriToPath)(e).match(this.buildConfig.srcPathRegex)}getNamespace(e){return this.noNamespaceUri[e]?"":""!=this.buildConfig.module?this.buildConfig.module+".":""}enableBuild(){this.allowBuild=!0}disableBuild(){this.allowBuild=!1}get isBuildAllowed(){return this.allowBuild}timerBuild=void 0;insideRebuildAll=!1;async rebuildAll(e=!1){if(this.allowBuild=!1,this.insideRebuildAll=!0,e){for(let e in this.wcFiles)await this.wcFiles[e].init();for(let e in this.scssFiles)await this.scssFiles[e].init(),await this.scssFiles[e].validate();for(let e in this.htmlFiles)await this.htmlFiles[e].init(),await this.htmlFiles[e].validate();for(let e in this.tsFiles)await this.tsFiles[e].validate()}else{for(let e in this.scssFiles)await this.scssFiles[e].validate();for(let e in this.htmlFiles)await this.htmlFiles[e].validate();for(let e in this.tsFiles)await this.tsFiles[e].validate()}for(let e in this.scssFiles)await this.scssFiles[e].triggerSave();for(let e in this.htmlFiles)await this.htmlFiles[e].triggerSave();for(let e in this.wcFiles)await this.wcFiles[e].triggerSave();for(let e in this.tsFiles)await this.tsFiles[e].triggerSave();this.insideRebuildAll=!1,this.allowBuild=!0,this.npmBuilder.rebuildInfo(),this.initDone?await this.build():await this._build()}async build(){if(!this.initDone)return;let e=w.GenericServer.delayBetweenBuild();0==e?await this._build():(this.timerBuild&&clearTimeout(this.timerBuild),this.timerBuild=setTimeout((async()=>{await this._build()}),e))}addDiagnostic(e,t){this.diagnostics.has(e)||this.diagnostics.set(e,[]),this.diagnostics.get(e)?.push(t)}clearDiagnostics(){for(let[e,t]of this.diagnostics.entries())e instanceof h.AventusTsFile&&w.GenericServer.sendDiagnostics({uri:e.file.uri,diagnostics:e.getDiagnostics()},this);this.diagnostics.clear()}emitDiagnostics(){for(let[e,t]of this.diagnostics.entries())if(e instanceof h.AventusTsFile){let n=[...t,...e.getDiagnostics()];this.hideWarnings&&(n=n.filter((e=>e.severity!=a.DiagnosticSeverity.Warning))),w.GenericServer.sendDiagnostics({uri:e.file.uri,diagnostics:n},this)}}async _build(){if(!this.allowBuild)return;w.GenericServer.isDebug()&&console.log("building "+this.buildConfig.fullname),this.clearDiagnostics();let e=[];for(let t of this.buildConfig.compile){let n=await this.buildOrderCompilationInfo(t),r=await this.buildLocalCode(n.toCompile,this.buildConfig.module);e=await this.writeBuildCode(r,n.libSrc,t.output,t.compressed),e=[...e,...n.errors];let i={namespace:this.buildConfig.module,available:r.codeRenderInJs,existing:r.codeNotRenderInJs};this.writeBuildDocumentation(t.package,r,i,t.outputNpm),this.writeBuildNpm(t.outputNpm,r),this.buildConfig.stories&&this.buildConfig.stories.live&&(await this.stories.check(),this.writeBuildNpm({path:[(0,s.join)(this.buildConfig.stories.output,"generated")],packageJson:!1,npmName:""},r),this.stories.write(this.tsFiles))}y.Compiled.send(this.buildConfig.fullname,e),this.reloadPage&&(this.reloadPage=!1,g.HttpServer.getInstance().reload()),this.emitDiagnostics()}_buildStringModule(e,t,n,r,s,a){let o="",l=e.split(".");if(o+=t.join(i.EOL)+i.EOL,n.length>0){let t="";o+="var "+l[0]+";"+i.EOL;for(let e=0;e<l.length;e++)""!=t?t+="."+l[e]:t=l[e],o+="("+t+"||("+t+" = {}));"+i.EOL;let s=[],c=[],u=[];for(let e in r)if(""!=e){let n=e.split("."),r="";for(let e=0;e<n.length-1;e++)if(0==r.length?r=n[e]:r+="."+n[e],-1==u.indexOf(r)){u.push(r),r.includes(".")?s.push(`${r} = {};`):s.push(`let ${r} = {};`);const e=r.replace(/\./g,"?.");s.push(`_.${r} = ${t}.${e} ?? {};`)}}o+="(function ("+l[0]+") {"+i.EOL,o+="const moduleName = `"+t+"`;"+i.EOL,o+="const _ = {};"+i.EOL,o+=a.join(i.EOL)+i.EOL,o+=s.join(i.EOL)+i.EOL,o+="let _n;"+i.EOL,o+=n.join(i.EOL)+i.EOL,o+=c.join(i.EOL)+i.EOL,o+=`for(let key in _) { ${e}[key] = _[key] }`,o=o.trim()+i.EOL,o+="})("+l[0]+");"+i.EOL}return o+=s.join(i.EOL)+i.EOL,o=o.trim()+i.EOL,o}async buildStorybook(){if(this.buildConfig.stories){await this.stories.check();for(let e of this.buildConfig.compile){let t=await this.buildOrderCompilationInfo(e),n=await this.buildLocalCode(t.toCompile,this.buildConfig.module);this.writeBuildNpm({path:[(0,s.join)(this.buildConfig.stories.output,"generated")],packageJson:!1,npmName:""},n)}this.stories.write(this.tsFiles,!0)}}async writeBuildCode(e,t,n,s){let a=[];if(n&&n.length>0){let o="",l=await this.npmBuilder.compile();a=[...a,...l.errors],o+=l.result,o+=t+i.EOL;let c=[];for(let t in e.stylesheets)c.push(`Aventus.Style.store("${t}", \`${e.stylesheets[t]}\`)`);o+=this._buildStringModule(this.buildConfig.module,e.codeNoNamespaceBefore,e.code,e.classesName,e.codeNoNamespaceAfter,c);for(let e of n){let t=(0,b.getFolder)(e.replace(/\\/g,"/"));if((0,r.existsSync)(t)||(0,r.mkdirSync)(t,{recursive:!0}),s)try{o=(await(0,x.minify)({"file1.js":o},{compress:!1,format:{comments:!1}})).code??""}catch(e){console.log(e)}this.writeFile(e,o)}}return a}writeBuildDocumentation(e,t,n,a){let l="";l="declare global {"+i.EOL,l+="\nnamespace "+this.buildConfig.module+"{"+i.EOL,l+=t.doc.join(i.EOL)+i.EOL,l+="\t}",t.docNoNamespace.length>0?l+=i.EOL+t.docNoNamespace.join(i.EOL)+i.EOL:l+=i.EOL,l+="}"+i.EOL,t.docInvisible.length>0&&(l+="declare module ___"+this.buildConfig.module+" {"+i.EOL,l+=t.docInvisible.join(i.EOL),l+="}");let c="// "+this.buildConfig.fullname+":"+this.buildConfig.version+i.EOL;if(a.path.length>0){c+="// npm:"+(""==a.npmName?("@"+this.buildConfig.module+"/"+this.buildConfig.name).toLowerCase():a.npmName)+i.EOL}c+="//#region js def //"+i.EOL+l,c+="//#endregion js def //"+i.EOL,c+="//#region js src //"+i.EOL+JSON.stringify(n)+i.EOL,c+="//#endregion js src //"+i.EOL,c+="//#region css def //"+i.EOL,c+=JSON.stringify(this.scssLanguageService.getInternalDocumentation())+i.EOL,c+="//#endregion css def //"+i.EOL,c+="//#region css //"+i.EOL,c+=JSON.stringify(t.stylesheets)+i.EOL,c+="//#endregion css //"+i.EOL,c+="//#region html //"+i.EOL,c+=JSON.stringify(t.htmlDoc)+i.EOL,c+="//#endregion html //"+i.EOL,c+="//#region dependances //"+i.EOL,c+=JSON.stringify(this.buildConfig.dependances)+i.EOL,c+="//#endregion dependances //"+i.EOL;for(let t of e)t?this.writeFile(t,c):(0,r.existsSync)(t)&&(0,r.unlinkSync)(t);let u=(0,s.join)(S.DependanceManager.getInstance().getPath(),"@locals");(0,r.existsSync)(u)||(0,r.mkdirSync)(u,{recursive:!0}),this.writeFile((0,s.join)(u,this.buildConfig.fullname+o.AventusExtension.Package),c)}writeBuildNpm(e,t){let n=Object.keys(t.npm);n.includes("")||n.push("");for(let e of n){let t=e.split("."),r="";for(let e of t)r=r?`${r}.${e}`:e,n.includes(r)||n.push(r)}n.sort(((e,t)=>(e.match(/\./g)||[]).length-(t.match(/\./g)||[]).length));const a={};for(let n in t.npmsrc){let o="";for(let e in t.npmsrc[n].imports){const r=t.npmsrc[n].imports[e];r.length>0&&(o+=`import { ${r.join(", ")} } from "${e}";`+i.EOL)}""!=o&&(o+=i.EOL),o+=t.npmsrc[n].content.join(i.EOL),o=m.AventusTsLanguageService.removeUnusedImport(o,t.npmsrc[n].forcedDependances);for(let t of e.path){const e=(0,b.getFolder)(n),i=(0,s.join)(t,"__src",...e.split(s.sep)),a=(0,s.join)(t,"__src",...n.split(s.sep));(0,r.existsSync)(i)||(0,r.mkdirSync)(i,{recursive:!0}),this.writeFile(a,o)}for(let e of t.npmsrc[n].names){let t=e.split("."),r=t.pop()??"",i=[];for(let e=0;e<t.length;e++)i.push("..");i=[...i,"__src",...n.split(s.sep)];let o=t.join(".");a[o]||(a[o]={});let l=i.join("/");a[o][l]||(a[o][l]=[]),a[o][l].push(r)}}const o=(t,a)=>{a||(a={content:[],imports:{}});let o="",l="",c=""==t?0:t.split(".").length,u=[];for(let e of n)if(e.startsWith(t)&&e!=t){let t=e.split(".");if(t.length==c+1){const e=t[t.length-1];o+=`import * as ${e} from "./${e}";`+i.EOL,l+=`export { ${e} };`+i.EOL,u.push(`./${e}`)}}for(let e in a.imports){const t=a.imports[e];t.length>0&&(o+=`import { ${t.join(", ")} } from "${e}";`+i.EOL)}o+=i.EOL+a.content.join(i.EOL)+i.EOL,o+=l,o=o.replaceAll("globalThis.Aventus.",""),o=o.replaceAll("___Aventus.",""),o=m.AventusTsLanguageService.removeUnusedImport(o,[]);for(let n of e.path){const e=(0,s.join)(n,...t.split("."));(0,r.existsSync)(e)||(0,r.mkdirSync)(e,{recursive:!0});let i=(0,s.join)(e,"index.d.ts");this.writeFile(i,o)}},l=t=>{let o="",l="",c=""==t?0:t.split(".").length;for(let e of n)if(e.startsWith(t)&&e!=t){let t=e.split(".");if(t.length==c+1){const e=t[t.length-1];o+=`import * as ${e} from "./${e}/index.js";`+i.EOL,l+=`export { ${e} };`+i.EOL}}const u=a[t];if(u)for(let e in u){o+=`export { ${u[e].join(", ")} } from "${e}"`+i.EOL}o+=l,o=m.AventusTsLanguageService.removeUnusedImport(o,[]);for(let n of e.path){const e=(0,s.join)(n,...t.split("."));(0,r.existsSync)(e)||(0,r.mkdirSync)(e,{recursive:!0});let i=(0,s.join)(e,"index.js");this.writeFile(i,o)}};for(let e of n)o(e,t.npm[e]),l(e);if(e.packageJson){const t=(0,s.join)(this.project.getConfigFile().folderPath,"package.json");let n={};(0,r.existsSync)(t)&&(n=JSON.parse((0,r.readFileSync)(t,"utf-8")));const i={};for(let e of this.externalPackageInformation.filesUri){let t=this.externalPackageInformation.getByUri(e);t&&(t.npmUri&&t.name!=this.buildConfig.fullname&&(n.dependencies&&n.dependencies[t.npmUri]?i[t.npmUri]=n.dependencies[t.npmUri]:i[t.npmUri]="^"+t.versionTxt))}let a={name:""==e.npmName?("@"+this.buildConfig.module+"/"+this.buildConfig.name).toLowerCase():e.npmName,displayName:this.buildConfig.module+" "+this.buildConfig.name,description:"Aventus build for @"+this.buildConfig.module+"/"+this.buildConfig.name,version:this.buildConfig.version,author:{name:"Cobwebsite",email:"info@cobwebsite.ch",url:"https://cobwesbite.ch"},type:"module",main:"index.js",types:"index.d.ts",dependencies:i};for(let t of e.path)(0,r.existsSync)(t)||(0,r.mkdirSync)(t,{recursive:!0}),this.writeFile((0,s.join)(t,"package.json"),JSON.stringify(a,null,2))}}async buildLocalCode(e,t){let n={codeNoNamespaceBefore:[],code:[],codeNoNamespaceAfter:[],doc:[],docNoNamespace:[],docInvisible:[],classesName:{},stylesheets:{},codeRenderInJs:[],codeNotRenderInJs:[],npm:{},npmsrc:{},htmlDoc:{}},r={},i={},s=!1,a="";""!=t&&(a=t+".");const l=(e,t)=>{let n=[];for(let r of e){let e="";e="@local"==r.uri?this.noNamespaceUri[t]?r.fullName.replace("$namespace$",""):r.fullName.replace("$namespace$",a):"@external"==r.uri||"@npm"==r.uri?r.fullName:this.noNamespaceUri[r.uri]?r.fullName.replace("$namespace$",""):r.fullName.replace("$namespace$",a),n.push({fullName:e,isStrong:r.isStrong})}return n},c=(e,t)=>{let r=this.tsFiles[e.uri];if(r instanceof d.AventusWebComponentLogicalFile&&r.compilationResult)if(t){let e=JSON.parse(JSON.stringify(r.compilationResult.htmlDoc));for(let t in e)e[t].class=this.buildConfig.module+"."+e[t].class,n.htmlDoc[t]=e[t]}else n.htmlDoc={...n.htmlDoc,...r.compilationResult.htmlDoc}};for(let t of e)if(this.noNamespaceUri[t.uri]){if(""!=t.compiled){let e;t.compiled.startsWith("@After()")?(n.codeNoNamespaceAfter.push(t.compiled.slice(8)),e="after"):t.compiled.startsWith("@Before()")?(n.codeNoNamespaceBefore.push(t.compiled.slice(9)),e="before"):s?(n.codeNoNamespaceAfter.push(t.compiled),e="after"):(n.codeNoNamespaceBefore.push(t.compiled),e="before"),r[t.classScript]||(r[t.classScript]={code:(0,b.replaceNotImportAliases)(t.compiled,this.project.getConfig()),dependances:l(t.dependances,t.uri),fullName:t.classScript,required:t.required,noNamespace:e,type:t.type,isExported:t.isExported.external,convertibleName:t.convertibleName,tagName:t.tagName})}else""==t.classScript||i[t.classScript]||t.classScript.startsWith("!staticClass_")||(i[t.classScript]={fullName:t.classScript,dependances:l(t.dependances,t.uri)}),""==t.classDoc||i[t.classDoc]||t.classDoc.startsWith("!staticClass_")||(i[t.classDoc]={fullName:t.classScript,dependances:l(t.dependances,t.uri)});if(""!=t.docVisible&&n.docNoNamespace.push(t.docVisible),""!=t.docInvisible&&n.docInvisible.push(t.docInvisible),t.npm.defTs&&(n.npm[""]||(n.npm[""]={content:[],imports:{}}),n.npm[""].content.push(t.npm.defTs)),t.npm.src){n.npmsrc[t.npm.exportPath]||(n.npmsrc[t.npm.exportPath]={content:[],imports:{},names:[],forcedDependances:[]});const e=t.isExported.internal?"export "+t.npm.src:t.npm.src;n.npmsrc[t.npm.exportPath].content.push(e)}c(t,!1)}else{if(s=!0,""==t.classScript||t.classScript.startsWith("!staticClass_")||(n.classesName[t.classScript]={type:t.type,isExported:t.isExported.external,convertibleName:t.convertibleName}),""!=t.compiled){n.code.push((0,b.replaceNotImportAliases)(t.compiled,this.project.getConfig()));let e=a+t.classScript;r[e]||(r[e]={code:(0,b.replaceNotImportAliases)(t.compiled,this.project.getConfig()),dependances:l(t.dependances,t.uri),fullName:e,required:t.required,type:t.type,isExported:t.isExported.external,convertibleName:t.convertibleName,tagName:t.tagName})}else{if(""!=t.classScript&&!i[t.classScript]&&!t.classScript.startsWith("!staticClass_")){let e=a+t.classScript;i[t.classScript]={fullName:e,dependances:l(t.dependances,t.uri)}}if(""!=t.classDoc&&!i[t.classDoc]&&!t.classDoc.startsWith("!staticClass_")){let e=a+t.classDoc;i[t.classDoc]={fullName:e,dependances:l(t.dependances,t.uri)}}}if(""!=t.docVisible&&n.doc.push(t.docVisible),""!=t.docInvisible&&n.docInvisible.push(t.docInvisible),t.npm.defTs){n.npm[t.npm.namespace]||(n.npm[t.npm.namespace]={content:[],imports:{}});const e=t.isExported.external?"export "+t.npm.defTs:t.npm.defTs;n.npm[t.npm.namespace].content.push(e);let r=this.tsFiles[t.npm.uri].fileParsed?.npmGeneratedImport;if(r)for(let e in r){const i=n.npm[t.npm.namespace].imports;i[e]||(i[e]=[]);for(let t of r[e]){if(t.onlySrc)continue;const n=t.alias?t.name+" as "+t.alias:t.name;i[e].includes(n)||i[e].push(n)}}}if(t.npm.src){if(!n.npmsrc[t.npm.exportPath]){n.npmsrc[t.npm.exportPath]={content:[],imports:{},names:[],forcedDependances:[]};let e=this.tsFiles[t.npm.uri].fileParsed,r=e?.npmGeneratedImport;if(r)for(let i in r)if(i.startsWith(".")){let s=e?.importsLocal??{},a=e?.manualImportLocal??{};for(let e of r[i]){let r=s[e.name]??a[e.nameAlias??e.name];if(!r)continue;if(r.isTypeImport)continue;let i=r.info?.fileUri??"",l=t.npm.uri,c=(0,b.simplifyUri)(i,l);c=c.replace(o.AventusExtension.Base,".js"),n.npmsrc[t.npm.exportPath].imports[c]||(n.npmsrc[t.npm.exportPath].imports[c]=[]);const u=e.alias?e.name+" as "+e.alias:e.name;n.npmsrc[t.npm.exportPath].imports[c].push(u),e.forced&&n.npmsrc[t.npm.exportPath].forcedDependances.push(e.alias??e.name)}}else{n.npmsrc[t.npm.exportPath].imports[i+"/index.js"]||(n.npmsrc[t.npm.exportPath].imports[i+"/index.js"]=[]);for(let e of r[i])if(e.compiled){const r=e.alias?e.name+" as "+e.alias:e.name;n.npmsrc[t.npm.exportPath].imports[i+"/index.js"].push(r),e.forced&&n.npmsrc[t.npm.exportPath].forcedDependances.push(e.alias??e.name)}}}const e=t.isExported.internal?"export "+t.npm.src:t.npm.src;n.npmsrc[t.npm.exportPath].content.push(e),t.isExported.internal&&t.classScript&&n.npmsrc[t.npm.exportPath].names.push(this.module+"."+t.classScript)}c(t,!0)}n.codeRenderInJs=Object.values(r),n.codeNotRenderInJs=Object.values(i);for(let e in this.globalComponentSCSSFiles){let t=this.globalComponentSCSSFiles[e];n.stylesheets[t.globalName]=t.compileResult}return n}async buildOrderCompilationInfo(e){let t={toCompile:[],libSrc:"",errors:[]},n={},r=[],s={},a={};for(let e in this.tsFiles){let t=this.tsFiles[e];for(let e of t.compileResult){if(""!==e.classScript)if(a[e.classScript]){let n=!1,r="The name "+e.classScript+" is registered more than once.",i=t.fileParsed?.getBaseInfoFullName(e.classScript);i&&(this.addDiagnostic(t,(0,b.createErrorTsPos)(t.file.documentUser,r,i.nameStart,i.nameEnd,o.AventusErrorCode.SameNameFound)),n=!0);let s=this.tsFiles[a[e.classScript].uri];i=s.fileParsed?.getBaseInfoFullName(e.classScript),i&&(this.addDiagnostic(s,(0,b.createErrorTsPos)(s.file.documentUser,r,i.nameStart,i.nameEnd,o.AventusErrorCode.SameNameFound)),n=!0),n||w.GenericServer.showErrorMessage(r)}else s[e.classScript]=e,a[e.classScript]=e;""===e.classDoc||s[e.classDoc]||(s[e.classDoc]=e)}}let l=[],c=[],u={};const p=(e,i,a,o,_)=>{const d=e.fullName.replace("$namespace$","");let h="",f=null;if(i)h="@local";else{if(f=this.externalPackageInformation.getByFullName(d),!f)return a;h=f.uri}if(void 0!==o[d]){if(e.isStrong){if(void 0!==_[d])return r.push("You have an infinite loop with your strong dependance ["+d+"]"),a;const e=new Promise((e=>{o[d].push((()=>{e({[h]:d})}))}));return l.push(e),e}return a}o[d]=[],e.isStrong&&(_[d]=!0);const m=[];if((()=>{if(i){if(!s[d])return void(void 0===a[h]&&(a[h]=-1));let e=c.indexOf(d);if(-1!=e)return void(void 0===a[h]&&(a[h]=e+1));let i=s[d],l=0,u=[...i.dependances];if(d.includes(".")){const e=d.split(".");e.pop();const t=e.join("."),n=s[t];n&&n!=i&&u.push({fullName:n.classScript,isStrong:!0,uri:n.uri})}for(let e of u){if("@npm"==e.uri)continue;let n={...a};if("@external"==e.uri){const t=p(e,!1,a,o,{});t instanceof Promise?e.isStrong&&m.push(t):a=t}else if(e.isStrong){if(e.fullName.replace("$namespace$","")!=d){const t=p(e,!0,a,o,_);t instanceof Promise?m.push(t):(a=t)[h]&&a[h]>=0&&a[h]>l&&(l=a[h])}}else{let n=t.toCompile.length;const r=p(e,!0,a,o,{});r instanceof Promise||(a=r)[h]&&a[h]>=0&&a[h]>l&&(l=a[h]);let i=t.toCompile.length;a[h]&&a[h]>=0&&a[h]>l&&l>0&&(l+=i-n)}a=n}if(-1!=c.indexOf(d))return void(t[h]=c.indexOf(d));if(0==m.length){i.tagName&&(n[i.tagName]?r.push("The tag <"+i.tagName+"> is declared by "+n[i.tagName]+" and "+i.classScript):n[i.tagName]=i.classScript),t.toCompile.splice(l,0,i),c.splice(l,0,d);for(const e of o[d])e();o[d]=[]}a[h]=t.toCompile.length}else{if(!f)return;if(!this.dependanceUris.includes(h))return;u[h]||(u[h]=[]);let e=u[h].indexOf(d);if(-1!=e)return void(a[h]=e+1);let t=0;if("noCode"!=f.content)for(let e of f.content.dependances){let n={...a},r=e.isStrong?_:{};const i=p(e,!1,a,o,r);i instanceof Promise?e.isStrong&&m.push(i):(a=i)[h]&&a[h]>=0&&a[h]>t&&(t=a[h]),a=n}if(u[h].includes(d))return void(a[h]=u[h].indexOf(d));if(0==m.length){if("noCode"!=f.content&&f.content.tagName){let e=f.content.tagName;n[e]?r.push("The tag <"+f.content.tagName+"> is declared by "+n[e]+" and "+f.content.fullName):n[e]=f.content.fullName}u[h].splice(t,0,d),a[h]=u[h].length;for(const e of o[d])e();o[d]=[]}}})(),e.isStrong&&delete _[d],0==m.length)return o[d]&&0==o[d].length&&delete o[d],a;{const e=new Promise((async e=>{const n=await Promise.all(m);let r=a[h]??0;for(const e of n)if(e[h]){let t=e[h];if(i){let e=c.indexOf(t)+1;e>r&&(r=e)}else{let e=u[h].indexOf(t)+1;e>r&&(r=e)}}if(i){let e=s[d];c.includes(d)||(t.toCompile.splice(r,0,e),c.splice(r,0,d))}else u[h].includes(d)||u[h].splice(r,0,d);for(const e of o[d])e();delete o[d],e({[h]:d})}));return l.push(e),e}};for(let t in this.tsFiles){let n=this.tsFiles[t],r=n.file.path.match(e.inputPathRegex);for(let e of n.compileResult)(e.required||r)&&(""!==e.classScript&&p({fullName:e.classScript,isStrong:!0},!0,{},{},{}),""!==e.classDoc&&p({fullName:e.classDoc,isStrong:!0},!0,{},{},{}))}await Promise.all(l),l=[];for(let e of this.dependanceNeedUris){let t=this.externalPackageInformation.getInformationsRequired(e);u[e]||(u[e]=[]);for(let n of t)u[e].includes(n.fullName)||p({fullName:n.fullName,isStrong:!0},!1,{},{},{})}await Promise.all(l),l=[];for(let e of this.dependanceFullUris){u[e]||(u[e]=[]);let t=this.externalPackageInformation.getFullInformations(e);for(let n of t)u[e].includes(n.fullName)||p({fullName:n.fullName,isStrong:!0},!1,{},{},{})}await Promise.all(l),l=[];let _=[];for(let e of this.dependanceUris){let t={namespace:this.externalPackageInformation.getNamespaceByUri(e),before:[],code:[],after:[],classesName:{}};if(!u[e])continue;for(let n of u[e]){let e=this.externalPackageInformation.getByFullName(n);if("noCode"!=e.content){let n=(0,b.replaceNotImportAliases)(e.content.code,this.project.getConfig());if(e.content.noNamespace)"before"==e.content.noNamespace?t.before.push(n):"after"==e.content.noNamespace&&t.after.push(n);else{t.code.push(n);let r=new RegExp("^"+this.externalPackageInformation.getNamespaceByUri(e.uri)+"."),i=e.content.fullName.replace(r,"");t.classesName[i]={type:e.content.type,isExported:e.content.isExported,convertibleName:e.content.convertibleName}}}}let n=this.externalPackageInformation.getStyleByUri(e),r=[];for(let e in n)r.push(`Aventus.Style.store("${e}", \`${n[e]}\`)`);let i=this._buildStringModule(t.namespace,t.before,t.code,t.classesName,t.after,r);_.push(i)}if(t.libSrc=_.join(i.EOL),r.length>0){let e=this.buildConfig.fullname+"_dependanceErrors";k.DebugFileAdd.send(e,r.join("\r\n")),t.errors.push({title:"Dependances errors",file:e})}return t}getAllFullnames(){let e={};const t=t=>{if(t.startsWith("!staticClass_"))return;let n=t.split(".")[0];e[n]||(e[n]=[]),e[n].push(t)};for(let e in this.tsFiles){let n=this.tsFiles[e];for(let e of n.compileResult)""!==e.classScript&&t(e.classScript)}for(let e of this.dependanceNeedUris){let n=this.externalPackageInformation.getInformationsRequired(e);for(let e of n)e.code&&t(e.fullName)}for(let e of this.dependanceFullUris){let n=this.externalPackageInformation.getFullInformations(e);for(let e of n)e.code&&t(e.fullName)}return e}async onNewFile(e){this.buildConfig.srcPathRegex&&e.path.match(this.buildConfig.srcPathRegex)&&this.registerFile(e,!1),this.buildConfig.outsideModulePathRegex&&e.path.match(this.buildConfig.outsideModulePathRegex)&&(this.registerFile(e,!1),this.noNamespaceUri[e.uri]=!0)}async loadFiles(){T.Statistics.startSendBuildTime(this.buildConfig.name),this.allowBuild=!1;let e=await S.DependanceManager.getInstance().loadDependancesFromBuild(this.buildConfig,this);this.dependanceFullUris=e.dependanceFullUris,this.dependanceNeedUris=e.dependanceNeedUris,this.dependanceUris=e.dependanceUris,this.externalPackageInformation.init(e.files);let t=l.FilesManager.getInstance();if(this.buildConfig.srcPathRegex){let e=t.getFilesMatching(this.buildConfig.srcPathRegex);for(let t of e)this.registerFile(t,!0)}if(this.buildConfig.outsideModulePathRegex){let e=t.getFilesMatching(this.buildConfig.outsideModulePathRegex);for(let t of e)this.registerFile(t,!0),this.noNamespaceUri[t.uri]=!0}w.GenericServer.isDebug()&&console.log("loaded all files needed"),this.allowBuild=!0,this._filesLoaded=!0,await this.rebuildAll(!0),T.Statistics.sendBuildTime(this.buildConfig.name)}async registerFile(e,t){if(e.uri.endsWith(o.AventusExtension.ComponentStyle))this.scssFiles[e.uri]||(this.scssFiles[e.uri]=new p.AventusWebSCSSFile(e,this),t||await this.scssFiles[e.uri].init(),this.registerOnFileDelete(e),this.scssFiles[e.uri].isGlobal&&(this.globalComponentSCSSFiles[e.uri]=this.scssFiles[e.uri]));else if(e.uri.endsWith(o.AventusExtension.ComponentView))this.htmlFiles[e.uri]||(this.htmlFiles[e.uri]=new c.AventusHTMLFile(e,this),t||await this.htmlFiles[e.uri].init(),this.registerOnFileDelete(e));else if(e.uri.endsWith(o.AventusExtension.Component))this.wcFiles[e.uri]||(this.wcFiles[e.uri]=new E.AventusWebComponentSingleFile(e,this),t||await this.wcFiles[e.uri].init(),this.registerOnFileDelete(e));else if(!this.tsFiles[e.uri]){let t=(0,f.AventusTsFileSelector)(e,this);t&&(this.tsFiles[e.uri]=t,this.registerOnFileDelete(e))}}registerOnFileDelete(e){this.onFileDeleteUUIDs[e.uri]=e.onDelete(this.onFileDelete.bind(this))}async onFileDelete(e){e.removeOnDelete(this.onFileDeleteUUIDs[e.uri]),delete this.onFileDeleteUUIDs[e.uri],e.uri.endsWith(o.AventusExtension.ComponentStyle)?delete this.scssFiles[e.uri]:e.uri.endsWith(o.AventusExtension.ComponentView)?delete this.htmlFiles[e.uri]:e.uri.endsWith(o.AventusExtension.Component)?delete this.wcFiles[e.uri]:delete this.tsFiles[e.uri],await this.rebuildAll()}getLocalWebComponentDefinition(e,t=!1){let n=this.htmlLanguageService.getInternalDefinition(e);if(n&&n.fileParsed){let e=n.getComponentName();if(e){let t=n.fileParsed.classes[e];if(t)return t}}}getWebComponentTagDependance(e){let t=this.htmlLanguageService.getInternalTagUri(e);if(t)return{fullName:t.fullname,uri:t.uri,isStrong:!1};let n=this.getWebComponentDefinition(e);if(n){let e=n.class.fileUri;return n.isLocal||(e="@external"),{fullName:n.class.fullName,uri:e,isStrong:!1}}return null}getWebComponentDefinition(e,t=!1){let n=this.htmlLanguageService.getInternalDefinition(e);if(n&&n.fileParsed){let e=n.getComponentName();if(e){let t=n.fileParsed.classes[e];if(t)return{class:t,isLocal:!0}}}let r=this.htmlLanguageService.getClassByTag(e);if(r){let n=this.externalPackageInformation.getExternalWebComponentDefinition(r);if(n){if(t){let t=this.project.getInternalWebComponentDefinition((0,b.uriToPath)(n.fileUri),e);if(t)return{class:t,isLocal:!1}}return{class:n,isLocal:!1}}}}getWebComponentDefinitionFile(e){let t=this.htmlLanguageService.getInternalDefinition(e);if(t)return t;let n=this.htmlLanguageService.getClassByTag(e);return n?this.externalPackageInformation.getExternalWebComponentDefinitionFile(n):void 0}getNamespaceForUri(e,t){if("manual"==this.buildConfig.namespaceStrategy)return"";if("rules"==this.buildConfig.namespaceStrategy){let t=(0,b.uriToPath)(e);for(let e in this.buildConfig.namespaceRulesRegex){let n=this.buildConfig.namespaceRulesRegex[e];if(t.match(n))return e}}else if("followFolders"==this.buildConfig.namespaceStrategy||"followFoldersCamelCase"==this.buildConfig.namespaceStrategy){let n=(0,b.uriToPath)(e),r=n.split("/");r.pop(),t&&r.pop(),n=r.join("/")+"/";let i=n.replace(this.buildConfig.namespaceRoot,"").replace(/\//g,".");return i.endsWith(".")&&(i=i.slice(0,-1)),i.startsWith(".")&&(i=i.slice(1)),i.includes(":")?"":"followFoldersCamelCase"==this.buildConfig.namespaceStrategy?(i=i.slice(0,1).toUpperCase()+i.slice(1),i.replace(/(([-_\.]|^)[a-z])/g,(e=>e.toUpperCase().replace("-","").replace("_","")))):i}return""}addNamespace(e){if(!this.namespaces.includes(e)){const t=e.split(".");let n="";for(let e of t)n+=e,n&&!this.namespaces.includes(n)&&this.namespaces.push(n),n+="."}}async onRename(e){for(let t of e)if(t.oldUri.endsWith(o.AventusExtension.Component)||t.oldUri.endsWith(o.AventusExtension.ComponentLogic)||t.oldUri.endsWith(o.AventusExtension.Data)||t.oldUri.endsWith(o.AventusExtension.Lib)||t.oldUri.endsWith(o.AventusExtension.RAM))return await this.tsLanguageService.onRenameFile(t.oldUri,t.newUri);return{}}npmAliases={};npmNameCount={};getNpmReplacementName(e,t){if(!this.hasNpmOutput)return"";const n=t.split(".");let r=n.pop();const i=e.split(".");return i.pop(),n.join(".")==i.join(".")?r:(this.npmAliases[t]||(this.npmNameCount[r]||(this.npmNameCount[r]=0),this.npmNameCount[r]++,this.npmAliases[t]=r+this.npmNameCount[r]),this.npmAliases[t])}destroy(){l.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID);for(let e in this.scssFiles)this.scssFiles[e].removeEvents(),this.scssFiles[e].file.removeOnDelete(this.onFileDeleteUUIDs[e]);for(let e in this.htmlFiles)this.htmlFiles[e].removeEvents(),this.htmlFiles[e].file.removeOnDelete(this.onFileDeleteUUIDs[e]);for(let e in this.tsFiles)this.tsFiles[e].removeEvents(),this.tsFiles[e].file.removeOnDelete(this.onFileDeleteUUIDs[e]);$.UnregisterBuild.send(this.project.getConfigFile().path,this.buildConfig.fullname)}writeFile(e,t){(0,b.writeFile)(e,t,"build",this.buildConfig.name)}};class I{files={};informations={};informationsRequired={};webComponentByName={};build;constructor(e){this.build=e}get filesUri(){return Object.keys(this.files)}init(e){for(let t of e)this.files[t.file.uri]=t;this.rebuild()}getByFullName(e){return this.informations[e]}getByUri(e){return this.files[e]}getNpmUri(e){if(!this.build.hasNpmOutput)return null;if(this.informations[e]){let t=this.files[this.informations[e].uri];!t.npmUri&&this.build.initDone&&w.GenericServer.showErrorMessage("Can't find a npm package for "+t.name);const n=e.split(".");let r=n.pop();n.splice(0,0,t.npmUri);const i=t.fileParsed?.getBaseInfo(r);let s=i?.willBeCompiled??!1;return{name:r,uri:n.join("/"),compiled:s}}return null}getNamespaceByUri(e){return this.files[e].srcInfo.namespace}getInformationsRequired(e){return this.informationsRequired[e]}getFullInformations(e){return this.files[e]?.srcInfo.available||[]}getStyleByUri(e){return this.files[e]?this.files[e].externalCSS:{}}rebuild(){this.informations={},this.webComponentByName={};let e=[];for(let t in this.files){let n=this.files[t];this.informationsRequired[t]=[];for(let r of n.srcInfo.available)r.required&&this.informationsRequired[t].push(r),r.fullName&&(this.informations[r.fullName]?this.informations[r.fullName].uri!=t&&e.push({range:{start:{line:0,character:0},end:{line:0,character:0}},severity:a.DiagnosticSeverity.Error,source:o.AventusLanguageId.TypeScript,message:"The name "+r.fullName+" exist inside "+t+" and "+this.informations[r.fullName].uri}):this.informations[r.fullName]={content:r,uri:t});for(let r of n.srcInfo.existing)r.fullName&&(this.informations[r.fullName]?this.informations[r.fullName].uri!=t&&e.push({range:{start:{line:0,character:0},end:{line:0,character:0}},severity:a.DiagnosticSeverity.Error,source:o.AventusLanguageId.TypeScript,message:"The name "+r.fullName+" exist inside "+t+" and "+this.informations[r.fullName].uri}):this.informations[r.fullName]={content:"noCode",uri:t});this.webComponentByName={...this.webComponentByName,...n.classInfoByName}}w.GenericServer.sendDiagnostics({uri:"@Import lib",diagnostics:e},this.build)}getExternalWebComponentDefinition(e){return this.webComponentByName[e]}getExternalWebComponentDefinitionFile(e){let t=this.webComponentByName[e];if(t){let e=t.fileUri,n=this.files[e];if(n)return n}}}},79875:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NpmBuilder=void 0;const r=n(22037),i=n(11298),s=n(23240),a=n(81762),o=n(15100),l=(n(19601),n(61586)),c=n(49177),u=n(49387);t.NpmBuilder=class{infos={};lastInfo="";lastInfoToCompile="";internalNames=[];build;storedInfo={};constructor(e){this.build=e}getInternalName(e){if("default"==e&&(e="_default"),!this.internalNames.includes(e))return this.internalNames.push(e),e;let t=0,n=e+"_"+t;for(;this.internalNames.includes(n);)t++,n=e+"_"+t;return this.internalNames.push(n),n}register(e,t){this.storedInfo[e]||(this.storedInfo[e]=[]),this.storedInfo[e].push(t),this.rebuildInfo()}unregister(e){this.storedInfo[e]&&(delete this.storedInfo[e],this.rebuildInfo())}rebuildInfo(){if(this.build.isBuildAllowed){this.infos={},this.internalNames=[];for(let e in this.storedInfo)for(let t of this.storedInfo[e]){const n=t.uri;if(this.infos[n]||(this.infos[n]={md5:l(n),part:{}}),"*"==t.libName){if(!t.alias)throw`The lib ${n} inside the file ${e} has no alias => impossible`;let r=this.infos[n].all;r||(r={externalAlias:[],internalAlias:this.getInternalName("_default")},this.infos[n].all=r),r.externalAlias.includes(t.alias)||r.externalAlias.push(t.alias)}else{let e=this.infos[n].part;e[t.libName]||(e[t.libName]={externalAlias:[],internalAlias:this.getInternalName(t.libName)});let r=t.alias?t.alias:t.libName;e[t.libName].externalAlias.includes(r)||e[t.libName].externalAlias.push(r)}}}}npmBuildTxt="";npmDepBuildTxt={result:"",errors:[]};async compile(){if(0==Object.keys(this.infos).length)return{result:"",errors:[]};let e=JSON.stringify(this.infos);if(this.lastInfo!=e){this.lastInfo=e;let t=this.writeFileToCompile();this.lastInfoToCompile!=t.buildTxt&&(c.Compiled.part("Compiling node modules"),this.lastInfoToCompile=t.buildTxt,this.npmDepBuildTxt=await this.rollupBuild(this.lastInfoToCompile),c.Compiled.part("Compiling node modules done")),this.npmBuildTxt="var npmCompilation;"+r.EOL,this.npmBuildTxt+="(npmCompilation||(npmCompilation = {}));"+r.EOL,this.npmBuildTxt+=`(function (npmCompilation) {\n\t${this.npmDepBuildTxt.result+r.EOL}\n\t${t.toExport}\n})(npmCompilation);`+r.EOL}return{result:this.npmBuildTxt,errors:this.npmDepBuildTxt.errors}}writeFileToCompile(){let e="",t="",n=[],i=Object.keys(this.infos);i.sort();for(let s of i){let i=this.infos[s];if(t+=`npmCompilation['${i.md5}'] = {};`+r.EOL,i.all){e+=`import * as ${i.all.internalAlias} from "${s}";`+r.EOL,n.push(i.all.internalAlias);for(let e of i.all.externalAlias)t+=`npmCompilation['${i.md5}']['${e}'] = _['${i.all.internalAlias}'];`+r.EOL;for(let e in i.part)for(let n of i.part[e].externalAlias)t+=`npmCompilation['${i.md5}']['${n}'] = _['${i.all.internalAlias}'];`+r.EOL}else{let a=[],o=Object.keys(i.part);o.sort();for(let e of o){a.push(`${e} as ${i.part[e].internalAlias}`),n.push(i.part[e].internalAlias);for(let n of i.part[e].externalAlias)t+=`npmCompilation['${i.md5}']['${n}'] = _['${i.part[e].internalAlias}'];`+r.EOL}e+=`import {${Object.values(a).join(", ")}} from "${s}";`+r.EOL}}return e+=`export default { ${n.join(", ")} }`,{buildTxt:e,toExport:t}}async rollupBuild(e){let t="{}",n={result:"",errors:[]};try{let n=await(0,i.rollup)({input:"index.js",onwarn:e=>{},output:{format:"iife",name:"_",inlineDynamicImports:!0},plugins:[(0,s.default)({include:[this.build.nodeModulesDir+"/**"],ignoreGlobal:!0,sourceMap:!1}),(0,a.default)({"index.js":e}),(0,o.default)({rootDir:this.build.nodeModulesDir})]}),r=await n.generate({format:"iife",name:"_",inlineDynamicImports:!0});t="";for(let e of r.output)t+=e.code;t=t.replace(/process\.env\.NODE_ENV/g,'"production"')}catch(e){let t=this.build.fullname+"_npmErrors";u.DebugFileAdd.send(t,(e+"").replace(/\0/g,"")),n.errors.push({title:"Npm compilation errors",file:t})}return n.result=t,n}}},6268:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DependanceManager=void 0;const r=n(57147),i=n(61586),s=n(71017),a=n(12842),o=n(1539),l=n(19408),c=n(2044),u=n(13685),p=n(95687),_=n(24964),d=n(83693);class h{path;static instance;static getInstance(){return this.instance||(this.instance=new h),this.instance}getPath(){return this.path}constructor(){this.path=(0,s.join)(_.GenericServer.savePath,"packages"),(0,r.existsSync)(this.path)||(0,r.mkdirSync)(this.path,{recursive:!0})}predefinedPaths={"@Aventus":(0,a.AVENTUS_DEF_BASE_PATH)(),"@AventusUI":(0,a.AVENTUS_DEF_UI_PATH)(),"Aventus@UI":(0,a.AVENTUS_DEF_UI_PATH)(),"@AventusSharp":(0,a.AVENTUS_DEF_SHARP_PATH)(),"Aventus@Sharp":(0,a.AVENTUS_DEF_SHARP_PATH)()};predefinedNpm={[(0,a.AVENTUS_DEF_BASE_PATH)()]:"@aventusjs/main",[(0,a.AVENTUS_DEF_UI_PATH)()]:"@aventusjs/ui",[(0,a.AVENTUS_DEF_SHARP_PATH)()]:"@aventussharp/main"};aventusLoaded=!1;async loadDependancesFromBuild(e,t){this.aventusLoaded=!1;let n={files:[],dependanceNeedUris:[],dependanceFullUris:[],dependanceUris:[]},r={},i={};for(let n of e.dependances){let s=await this.loadDependance(n,e,t,r);s&&(i[s.name]=n.include),i={...i,...n.subDependancesInclude}}if(!this.aventusLoaded){let e=(0,o.pathToUri)((0,a.AVENTUS_DEF_BASE_PATH)()),n=await this.loadByUri(t,e);n.npmUri=this.predefinedNpm[(0,a.AVENTUS_DEF_BASE_PATH)()],r["Aventus@Main"]={dependances:[],file:n,uri:e,version:n.version}}let s=[];for(let e in r){let t=r[e];this.orderLoop(e,t,r,s)}for(let e of s){let t=r[e];t.file.loadWebComponents(),n.files.push(t.file);let s=i[e]?e:"*";i[s]?"full"==i[s]?(n.dependanceFullUris.push(t.uri),n.dependanceUris.push(t.uri)):"need"==i[s]&&(n.dependanceNeedUris.push(t.uri),n.dependanceUris.push(t.uri)):n.dependanceUris.push(t.uri)}return n}orderLoop(e,t,n,r){let i=r.indexOf(e);if(-1!=i)return i+1;let s=0;for(let e of t.dependances)if(n[e]){let t=this.orderLoop(e,n[e],n,r);t>=0&&t>s&&(s=t)}return r.splice(s,0,e),r.length}async loadDependance(e,t,n,r){let i,a;if(e.uri.match("^(@|&)")){let r;if(this.predefinedPaths[e.uri]){let t=(0,o.pathToUri)(this.predefinedPaths[e.uri]);i=await this.loadByUri(n,t),a=t,"@Aventus"==e.uri&&(this.aventusLoaded=!0)}else if(r=/@local:(\S+)/g.exec(e.uri)){let e=await this.loadLocal(r[1],n);i=e.file,a=e.uri}else if(r=/&:(\S+)/g.exec(e.uri)){let e=t.module+"@"+r[1]+l.AventusExtension.Package,s=await this.loadLocal(e,n);i=s.file,a=s.uri}else if(r=/@npm:(\S+)/g.exec(e.uri)){r[1]}}else if(e.uri.startsWith("http")){let t=await this.loadHttp(e.uri,e.version,n);t&&(i=t.file,a=t.uri)}else{let t=e.uri;e.uri.startsWith(".")&&(t=n.project.getConfigFile().folderPath+"/"+e.uri),t=(0,s.normalize)(t);let r=(0,o.pathToUri)(t);i=await this.loadByUri(n,r),a=r}if(a&&i){const s=this.parseVersion(e.version);if(e.npm)i.npmUri=e.npm;else if(this.predefinedNpm[e.uri])i.npmUri=this.predefinedNpm[e.uri];else{let e=/\/\/ npm:(.*)$/m.exec(i.file.contentUser);e&&(i.npmUri=e[1])}const o=async(e,i)=>{r[e.name]={file:e,uri:i,version:s,dependances:[]},"Aventus@Main"!=e.name&&(r[e.name].dependances=["Aventus@Main"]);for(let i of e.dependances){let s=await this.loadDependance(i,t,n,r);s&&(r[e.name].dependances.includes(s.name)||r[e.name].dependances.push(s.name))}};if(r[i.name]){let e=r[i.name].version;this.compareVersion(e,s,i.name)==s&&await o(i,a)}else await o(i,a)}return i}async loadByUri(e,t){let n=await d.FilesManager.getInstance().registerFilePackage(t);return new c.AventusPackageFile(n,e)}async loadLocal(e,t){let n=(0,o.pathToUri)((0,s.join)(this.path,"@locals",e));n.endsWith(l.AventusExtension.Package)||(n+=l.AventusExtension.Package);let r=await d.FilesManager.getInstance().registerFilePackage(n);return{uri:n,file:new c.AventusPackageFile(r,t)}}async loadHttp(e,t,n){try{let a=i(e),u=(0,s.join)(this.path,"http",a),p=(0,s.join)(u,"info.json"),_=(0,r.existsSync)(u);const{major:h,minor:f,patch:m}=this.parseVersion(t);if(!_||!(0,r.existsSync)(p))if(e.endsWith(l.AventusExtension.Package)){_||(0,r.mkdirSync)(u,{recursive:!0});let t=(0,s.join)(u,"temp.package.avt");if(!await this.downloadFile(t,e))return null;let n=await this.readFirstLine(t),i=/\/\/ (\S+):([0-9]+)\.([0-9]+)\.([0-9]+)/g.exec(n);if(i){let n=i[1],a=Number(i[2]),o=Number(i[3]),c=Number(i[4]),_={name:n,versions:{[a]:{[o]:{[c]:{uri:e,localUri:n+"#"+a+"."+o+"."+c+l.AventusExtension.Package}}}}};(0,r.writeFileSync)(p,JSON.stringify(_,null,4)),(0,r.renameSync)(t,(0,s.join)(u,n+"#"+a+"."+o+"."+c+l.AventusExtension.Package))}}else if(!await this.downloadFile(p,e))return null;let g=JSON.parse((0,r.readFileSync)(p,"utf8")),y=(e,t)=>{if(-1==e){let e=Math.max.apply(null,Object.keys(t));return{obj:t[e+""],v:e}}return{obj:t[e+""],v:e}},v=(()=>{let e=y(h,g.versions);if(void 0!==e.obj){let t=y(f,e.obj);if(void 0!==t.obj){let n=y(m,t.obj);if(void 0!==n.obj)return{info:n.obj,number:e.v+"."+t.v+"."+n.v}}}return null})();if(v){if(v.info.localUri&&(0,r.existsSync)((0,s.join)(u,v.info.localUri))){let e=(0,o.pathToUri)((0,s.join)(u,v.info.localUri)),t=await d.FilesManager.getInstance().registerFilePackage(e);return{uri:e,file:new c.AventusPackageFile(t,n)}}{let e=g.name+"#"+v.number+l.AventusExtension.Package,t=(0,o.pathToUri)((0,s.join)(u,e));if(!await this.downloadFile((0,s.join)(u,e),v.info.uri))return null;v.info.localUri=e;let i=await d.FilesManager.getInstance().registerFilePackage(t);return(0,r.writeFileSync)(p,JSON.stringify(g,null,4)),{uri:t,file:new c.AventusPackageFile(i,n)}}}}catch(e){}return null}downloadFile(e,t){return new Promise((n=>{const i=(0,r.createWriteStream)(e);try{(t.startsWith("https")?p.get:u.get)(t,(function(t){t.pipe(i),i.on("finish",(()=>{i.close(),n(!0)})),i.on("error",(()=>{i.close(),(0,r.unlinkSync)(e),n(!1)}))}))}catch(t){i.close(),(0,r.unlinkSync)(e),n(!1)}}))}readFirstLine(e){return new Promise((function(t,n){var i,s=(0,r.createReadStream)(e,{encoding:"utf8"}),a="",o=0;s.on("data",(function(e){i=e.indexOf("\n"),a+=e,-1!==i?s.close():o+=e.length})).on("close",(function(){t(a.slice(0,o+i))})).on("error",(function(e){n(e)}))}))}parseVersion(e){let t=/([0-9xX]+)\.([0-9xX]+)\.([0-9xX]+)/g.exec(e)??[0,-1,-1,-1];return{major:isNaN(Number(t[1]))?-1:Number(t[1]),minor:isNaN(Number(t[2]))?-1:Number(t[2]),patch:isNaN(Number(t[3]))?-1:Number(t[3])}}compareVersion(e,t,n){let r=r=>{if(-1==e[r])return-1==t[r]?null:t;if(-1==t[r])return e;if(e[r]==t[r])return null;{let r=Object.values(e).join("."),i=Object.values(t).join(".");return _.GenericServer.showErrorMessage(`Can't resolve version for dependance ${n} between ${r} and ${i}`),-1}},i=["major","minor","patch"];for(let e of i){let t=r(e);if("number"==typeof t)return null;if(t)return t}return e}}t.DependanceManager=h},50408:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Project=void 0;const r=n(71017),i=n(19408),s=n(50857),a=n(3006),o=n(3539),l=n(22399),c=n(83693),u=n(81940);t.Project=class{configFile;config=null;builds=[];statics=[];_isCoreBuild=!1;scssFiles={};onValidateUUID;onSaveUUID;onFormattingUUID;onCompletionUUID;onCompletionResolveUUID;onHoverUUID;onNewFileUUID;onFileDeleteUUIDs={};buildsAllowed;staticsAllowed;globalSCSSLanguageService;get isCoreBuild(){return this._isCoreBuild}getConfigFile(){return this.configFile}getConfig(){return this.config}resolveAlias(e,t){if(e.startsWith("@")){let n=e.split("/"),i=n[0],s=this.config?.aliases[i];if(s){let e=(0,r.normalize)(this.configFile.folderPath+"/"+s);"string"!=typeof t&&(t=t.folderPath);let i=(0,r.normalize)(t);e.endsWith(r.sep)&&(e=e.substring(0,e.length-1)),i.endsWith(r.sep)&&(i=i.substring(0,i.length-1));let a=e.split(r.sep),o=i.split(r.sep);for(let e=0;e<a.length;e++)if(o.length>e){if(a[e]!=o[e])break;a.splice(e,1),o.splice(e,1),e--}let l="";for(let e=0;e<o.length;e++)l+="../";return""==l&&(l+="./"),l+=a.join("/"),n.splice(0,1,l),n.join("/").replace(/\/\//g,"/")}}return e}getInternalWebComponentDefinition(e,t){for(let n of this.builds)if(n.outputPathes.includes(e))return n.getLocalWebComponentDefinition(t)}constructor(e,t){this.configFile=e,this.onValidateUUID=this.configFile.onValidate(this.onValidate.bind(this)),this.onSaveUUID=this.configFile.onSave(this.onConfigSave.bind(this)),this.onFormattingUUID=this.configFile.onFormatting(this.onFormatting.bind(this)),this.onCompletionUUID=this.configFile.onCompletion(this.onCompletion.bind(this)),this.onCompletionResolveUUID=this.configFile.onCompletionResolve(this.onCompletionResolve.bind(this)),this.onHoverUUID=this.configFile.onHover(this.onHover.bind(this)),this.onNewFileUUID=c.FilesManager.getInstance().onNewFile(this.onNewFile.bind(this)),e.folderUri.toLowerCase().endsWith("/aventus/base/src")&&(this._isCoreBuild=!0),this.globalSCSSLanguageService=new l.AventusGlobalSCSSLanguageService,t&&this.loadFiles(),e.validate()}async init(){await this.onConfigSave()}async onValidate(){return await s.AventusJSONLanguageService.getInstance().validate(this.configFile)}async loadConfig(){let e=await s.AventusJSONLanguageService.getInstance().getConfig(this.configFile);if(this.config){let t=JSON.stringify(this.config),n="";if(e&&(n=JSON.stringify(e)),t==n)return;for(let e of this.builds)e.destroy()}this.builds=[],this.config=e}async onConfigSave(){if(await this.loadConfig(),this.config){for(let e of this.config.build){if(this.buildsAllowed){if(!this.buildsAllowed.includes(e.name))continue}else if(e.disabled)continue;let t=new a.Build(this,e);this.builds.push(t),await t.init()}if(this.config.static)for(let e of this.config.static){if(this.staticsAllowed&&!this.staticsAllowed.includes(e.name))continue;let t=new o.Static(this,e);await t.export(),this.statics.push(t)}}}async onFormatting(e,t,n){return await s.AventusJSONLanguageService.getInstance().format(e,t,n)}async onCompletion(e,t){return await s.AventusJSONLanguageService.getInstance().doComplete(e,t)}async onCompletionResolve(e,t){return await s.AventusJSONLanguageService.getInstance().doResolve(t)}async onHover(e,t){return await s.AventusJSONLanguageService.getInstance().doHover(e,t)}getBuildsName(){let e=[];for(let t of this.builds)e.push(t.fullname);return e}getBuildsNameWithStory(){let e=[];for(let t of this.builds)t.hasStories&&e.push(t.fullname);return e}getBuild(e){for(let t of this.builds)if(t.fullname==e)return t}getBuilds(){return this.builds}getMatchingBuildsByUri(e){let t=[];for(let n of this.builds)n.isFileInside(e)&&t.push(n);return t}getStaticsName(){let e=[];for(let t of this.statics)e.push(t.name);return e}getStatic(e){for(let t of this.statics)if(t.name==e)return t}loadFiles(){let e=c.FilesManager.getInstance().getFilesWithExtension(i.AventusExtension.GlobalStyle);for(let t of e)this.onNewFile(t)}async onNewFile(e){e.path.endsWith(i.AventusExtension.GlobalStyle)&&(this.scssFiles[e.uri]||(this.scssFiles[e.uri]=new u.AventusGlobalSCSSFile(e,this),this.registerOnFileDelete(e)))}registerOnFileDelete(e){this.onFileDeleteUUIDs[e.uri]=e.onDelete(this.onFileDelete.bind(this))}async onFileDelete(e){e.removeOnDelete(this.onFileDeleteUUIDs[e.uri]),delete this.onFileDeleteUUIDs[e.uri],e.uri.endsWith(i.AventusExtension.GlobalStyle)&&delete this.scssFiles[e.uri]}async onRename(e){let t={};for(let n of this.builds){let r=await n.onRename(e);for(let e in r)t[e]||(t[e]=[]),t[e]=t[e].concat(r[e])}return t}destroy(){c.FilesManager.getInstance().removeOnNewFile(this.onNewFileUUID),this.configFile.removeOnSave(this.onSaveUUID),this.configFile.removeOnValidate(this.onValidateUUID),this.configFile.removeOnFormatting(this.onFormattingUUID),this.configFile.removeOnCompletion(this.onCompletionUUID),this.configFile.removeOnCompletionResolve(this.onCompletionResolveUUID),this.configFile.removeOnHover(this.onHoverUUID);for(let e of this.builds)e.destroy();for(let e of this.statics)e.destroy()}}},40529:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProjectManager=void 0;const r=n(19408),i=n(83693),s=n(50408);class a{static autoLoad=!0;static instance;static getInstance(){return this.instance||(this.instance=new a),this.instance}projects={};constructor(){i.FilesManager.getInstance().onNewFile(this.onNewFile.bind(this))}async onNewFile(e){if(e.documentUser.uri.endsWith(r.AventusExtension.Config)){let t=e.documentUser.uri.replace(r.AventusExtension.Config,r.AventusExtension.Template);if(i.FilesManager.getInstance().getByUri(t))return;this.projects[e.documentUser.uri]?console.error("a config file with the uri :"+e.documentUser.uri+" is already inside project manager"):(this.projects[e.documentUser.uri]=new s.Project(e,a.autoLoad),a.autoLoad&&await this.projects[e.documentUser.uri].init(),e.onDelete(this.onDeleteFile.bind(this)))}}async onDeleteFile(e){this.projects[e.documentUser.uri]&&(this.projects[e.documentUser.uri].destroy(),delete this.projects[e.documentUser.uri])}getProjectByUri(e){return this.projects[e]}getMatchingBuildsByUri(e){let t=[];for(let n in this.projects){let r=this.projects[n].getMatchingBuildsByUri(e);for(let e of r)t.push(e)}return t}destroyAll(){for(let e in this.projects)this.projects[e].destroy()}async onRename(e){let t={};for(let n in this.projects){let r=await this.projects[n].onRename(e);for(let e in r)t[e]||(t[e]=[]),t[e]=t[e].concat(r[e])}return t}getAllConfigFiles(){let e=[];for(let t in this.projects)e.push(this.projects[t].getConfigFile().uri);return e}getAllBuilds(){let e=[];for(let t in this.projects){let n=this.projects[t],r=n.getBuildsName();for(let t of r)e.push({name:t,uri:n.getConfigFile().uri})}return e}getAllBuildsWithStory(){let e=[];for(let t in this.projects){let n=this.projects[t],r=n.getBuildsNameWithStory();for(let t of r)e.push({name:t,uri:n.getConfigFile().uri})}return e}getAllStatics(){let e=[];for(let t in this.projects){let n=this.projects[t],r=n.getBuildsName();for(let t of r)e.push({name:t,uri:n.getConfigFile().uri})}return e}}t.ProjectManager=a},3539:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Static=void 0;const r=n(17452),i=n(71017),s=n(57147),a=n(69916),o=n(60206),l=n(19408),c=n(1539),u=n(29495),p=n(62814),_=n(83693),d=n(18952);t.Static=class{staticConfig;watcher;isReady=!1;project;get name(){return this.staticConfig.name}constructor(e,t){this.project=e,this.staticConfig=t,this.registerWatcher(),this.isReady=!0}async export(){if(this.isReady){p.Statistics.startSendStaticTime(this.name);const e=(e,t)=>{try{let n=(t=(0,i.normalize)(t)).split(i.sep),r=n.pop(),o=n.join(i.sep);if((0,s.existsSync)(o)||(0,s.mkdirSync)(o,{recursive:!0}),r.endsWith(".scss")){if(!r.startsWith("_")){let n=(0,a.compile)(e,{style:"compressed"}).css.toString().trim();(0,c.writeFile)(t.replace(".scss",".css"),n,"static",this.name)}}else(0,s.copyFileSync)(e,t),p.Statistics.sendFileSize(t,void 0,"static",this.name)}catch(e){console.log(e)}};let t=(e=>{var t=[],n=e=>{if((0,s.existsSync)(e)){(0,s.readdirSync)(e).forEach((r=>{let i=e+"/"+r;if((0,s.lstatSync)(i).isDirectory()){let e=n(i);e.length>0&&t.concat(e)}else t.push(i)}))}return t};return t=n(e)})(this.staticConfig.inputPathFolder);for(let n of t){n=n.replace(/\\/g,"/");for(let t of this.staticConfig.outputPathFolder){let r=n.replace(this.staticConfig.inputPathFolder,t);if(n.endsWith(l.AventusExtension.Base)){if(n.endsWith(l.AventusExtension.GlobalStyle)){r=r.replace(l.AventusExtension.GlobalStyle,".css");let e=this.project.scssFiles[(0,c.pathToUri)(n)];if(!e){const t=d.TextDocument.create((0,c.pathToUri)(n),l.AventusExtension.GlobalStyle,1,(0,s.readFileSync)(n,"utf8"));await _.FilesManager.getInstance().registerFile(t),e=this.project.scssFiles[(0,c.pathToUri)(n)]}e.addOutPath(r,this.name)}}else e(n,r)}}o.HttpServer.getInstance().reload(),p.Statistics.sendStaticTime(this.name)}}registerWatcher(){u.SettingsManager.getInstance().settings.onlyBuild||(this.watcher=(0,r.watch)(this.staticConfig.inputPathFolder,{ignored:/^\./,persistent:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:100},ignoreInitial:!0}),this.watcher.on("add",(e=>{this.export()})),this.watcher.on("change",(e=>{this.export()})),this.watcher.on("unlink",(e=>{this.export()})),this.watcher.on("error",(function(e){})))}destroy(){this.watcher&&this.watcher.close()}}},20239:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultMdxTempate=function(){return"import Meta from './$name$.stories'\n$blocks$\n$render$\n\n$tag$\n\n$live$\n"}},43150:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultStoryTempate=function(){return"import type { Meta, Story } from '@aventusjs/storybook'\nimport Template from './$name$_.mdx'\n\nconst meta: Meta = {\n\ttitle: '$fullname$',\n\tparameters: {\n docs: {\n page: Template,\n description: {\n component: `$description$`\n },\n }\n },\n $argTypes$\n $args$\n $aventus$\n}\n\nexport default meta;\n\n$defaultStory$\n"},t.defaultStoryTempateComponent=function(){return"import { type Meta, type Story, render } from '@aventusjs/storybook'\nimport Template from './$name$_.mdx'\n$importPathes$\n\nconst meta: Meta = {\n\ttitle: '$fullname$',\n render: (args) => render(args, $name$),\n\tparameters: {\n docs: {\n page: Template,\n description: {\n component: `$description$`\n },\n }\n },\n $argTypes$\n $args$\n $aventus$\n}\n\nexport default meta;\n\n$defaultStory$\n"}},7295:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mainTemplate=function(){return'import type { StorybookConfig } from "@storybook/web-components-vite";\nimport remarkGfm from \'remark-gfm\';\n\nconst config: StorybookConfig = {\n stories: ["$path$/**/!(*_).mdx", "$path$/**/*.stories.@(js|jsx|mjs|ts|tsx)"],\n addons: [\n "@storybook/addon-links",\n "@storybook/addon-essentials",\n "@storybook/addon-styling-webpack",\n {\n name: \'@storybook/addon-docs\',\n options: {\n csfPluginOptions: null,\n mdxPluginOptions: {\n mdxCompileOptions: {\n remarkPlugins: [remarkGfm],\n },\n },\n },\n },\n ],\n framework: {\n name: "@storybook/web-components-vite",\n options: {},\n },\n managerHead: (head) => `\n ${head}\n <style>.sidebar-item[data-item-id$="--default-story"] { display: none; }</style>\n `,\n staticDirs: [\'../static\'],\n docs: {\n autodocs: true\n }\n};\nexport default config;\n'}},80861:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.previewTemplate=function(){return"import { Preview } from '@storybook/web-components';\n \nconst preview: Preview = {\n parameters: {\n options: {\n storySort: (a, b) => a.title.localeCompare(b.title),\n },\n },\n};\n \nexport default preview;"}},48703:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Storie=void 0;const r=n(71017),i=n(57147),s=n(24964),a=n(22037),o=n(1539),l=n(7295),c=n(20239),u=n(43150),p=n(80861),_=n(16286);class d{static getFullname(e){let t=e.fullName.replace(/\./g,"/"),n=!1,r=e.build.buildConfig;const i=e=>{""===e||(t=e.endsWith("/")?e+t:e+"/"+t)};return e.storieDecorator&&(void 0!==e.storieDecorator.group&&(t=e.storieDecorator.group?e.storieDecorator.group+"/"+e.name:e.name),void 0!==e.storieDecorator.prefix&&(n=!0,i(e.storieDecorator.prefix))),n||void 0===r.stories?.prefix||i(r.stories.prefix),t}build;buildConfig;constructor(e,t){this.build=e,this.buildConfig=t}async check(){this.readEnvStoryBook()}write(e,t=!1){t&&this.clear();for(let t in e){let n=e[t];if(n.fileParsed){for(let e in n.fileParsed.classes){const t=n.fileParsed.classes[e];this.writeStory(t,n)}for(let e in n.fileParsed.aliases){const t=n.fileParsed.aliases[e];this.writeStory(t)}for(let e in n.fileParsed.enums){const t=n.fileParsed.enums[e];this.writeStory(t)}for(let e in n.fileParsed.functions){const t=n.fileParsed.functions[e];this.writeStory(t)}for(let e in n.fileParsed.variables){const t=n.fileParsed.variables[e];this.writeStory(t)}}}}clear(){if(!this.buildConfig.stories)return;(0,r.join)(this.buildConfig.stories.output,"auto")}writeStory(e,t){if(!e.storieContent)return;if(!this.buildConfig.stories)return;const n=e.storieContent;let s=(0,r.join)(this.buildConfig.stories.output,"generated"),l=(0,r.join)(this.buildConfig.stories.output,"auto",...e.fullName.split(".")),p=(0,o.uriToPath)((0,o.getFolder)((0,o.pathToUri)(l)));(0,i.existsSync)(p)||(0,i.mkdirSync)(p,{recursive:!0});const h=()=>{let n=!1;return e.storieDecorator&&(e.storieDecorator.noLive||e.storieDecorator.noDefaultStory)&&(n=!0),t instanceof _.AventusWebComponentLogicalFile&&t.fileParsed?.classes[t.componentClassName]&&!t.fileParsed.classes[t.componentClassName].isAbstract&&!n};(()=>{let t=(0,c.defaultMdxTempate)();t=this.replaceVariable(t,"name",e.name);let r=`<av-story-${n.kind}-render json={JSON.stringify(Meta.aventus)}></av-story-${n.kind}-render>`;t=this.replaceVariable(t,"tag",r),t=h()?this.replaceVariable(t,"live","\n<div>\n <Title>Live</Title>\n <Canvas />\n <Controls />\n</div>"):this.replaceVariable(t,"live",""),t=this.replaceVariable(t,"blocks","import { Canvas, Controls, Title } from '@storybook/blocks'");let i=n.kind[0].toUpperCase()+n.kind.slice(1);t=this.replaceVariable(t,"render",`import { Story${i}Render } from '@aventusjs/storybook-render/AventusStorybook'`),this.writeFile(l+"_.mdx",t)})(),(()=>{let i=!0;e.storieDecorator&&e.storieDecorator.noDefaultStory&&(i=!1);let c=h()?(0,u.defaultStoryTempateComponent)():(0,u.defaultStoryTempate)(),p=e.name,f=d.getFullname(e);if(c=this.replaceVariable(c,"name",p),c=this.replaceVariable(c,"fullname",f),c=this.replaceVariable(c,"description",e.documentation?.definitions.join("\n").replace(/`/g,"\\`")??""),c=this.replaceVariable(c,"aventus","aventus: "+JSON.stringify(n,null,2)+","),c=this.replaceVariable(c,"defaultStory",i?"export const DefaultStory: Story = {}":""),t instanceof _.AventusWebComponentLogicalFile){c=this.replaceVariable(c,"argTypes","argTypes: "+JSON.stringify(t.storyBookInfo.argsTypes,null,2)+","),c=this.replaceVariable(c,"args","args: "+(e=>{let t="{"+a.EOL;for(let n in e){let r=e[n];"string"==typeof r&&(r=r.replace(/\\"/g,"")),""==r&&(r='""'),t+='\t"'+n+'":'+r+","+a.EOL}return t+="}",t})(t.storyBookInfo.args)+",");let e=t.fileParsed?.classes[t.componentClassName].storieInject??{},i=(0,r.join)(s,...n.namespace.split(".")),u=(0,o.simplifyUri)((0,o.pathToUri)(i),(0,o.pathToUri)(l));e[u]?e[u].includes(p)||e[u].push(p):e[u]=[p];const _=[];for(let t in e)_.push(`import { ${e[t].join(", ")} } from '${t}';`);c=this.replaceVariable(c,"importPathes",_.join("\n"))}else c=this.replaceVariable(c,"argTypes",""),c=this.replaceVariable(c,"args","");this.writeFile(l+".stories.ts",c)})()}readEnvStoryBook(){if(!this.buildConfig.stories)return;(0,i.existsSync)(this.buildConfig.stories.output)||(0,i.mkdirSync)(this.buildConfig.stories.output,{recursive:!0});const e=this.buildConfig.stories.output,t={name:("@"+this.buildConfig.module+"/"+this.buildConfig.name+"_storybook").toLowerCase(),displayName:this.buildConfig.module+" "+this.buildConfig.name+"_storybook",description:"Aventus storybook for @"+this.buildConfig.module+"/"+this.buildConfig.name,version:this.buildConfig.version};if(0==(0,i.readdirSync)(this.buildConfig.stories.output).length){let n=s.GenericServer.extensionPath+r.sep+"templates"+r.sep+"storybook",a=(0,i.readdirSync)(n),o="";const l=n=>{let s=(0,i.readdirSync)(n);for(let a of s){let s=n+r.sep+a,c=s.replace(o,e);for(let e in t){const n=new RegExp("\\$\\{\\{"+e+"\\}\\}","gm");c=c.replace(n,t[e])}if(c=(0,r.normalize)(c),(0,i.statSync)(s).isDirectory()){if(".git"==a)continue;(0,i.mkdirSync)(c),l(s)}else if(/\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(s.toLowerCase()))(0,i.copyFileSync)(s,c);else{let e=(0,i.readFileSync)(s,"utf-8");for(let n in t){const r=new RegExp("\\$\\{\\{"+n+"\\}\\}","gm");e=e.replace(r,t[n])}if("package.json"==a){let t=JSON.parse(e);t.devDependencies||(t.devDependencies={});for(let e of this.build.externalPackageInformation.filesUri){let n=this.build.externalPackageInformation.getByUri(e);n&&(n.npmUri&&n.name!=this.buildConfig.fullname&&(t.devDependencies[n.npmUri]="^"+n.versionTxt))}const n=Object.keys(t.devDependencies).sort().reduce(((e,n)=>(e[n]=t.devDependencies[n],e)),{});t.devDependencies=n,e=JSON.stringify(t,null,4)}this.writeFile(c,e)}}};if(1!=a.length)throw"TODO code multiple template";o=n+r.sep+a[0],l(o)}const n=this.buildConfig.stories.workspace?(0,r.resolve)(this.build.project.getConfigFile().folderPath,this.buildConfig.stories.workspace):e,a=(0,r.join)(n,".storybook");(0,i.existsSync)(a)||(0,i.mkdirSync)(a,{recursive:!0});const c=(0,r.join)(a,"main.ts");if(!(0,i.existsSync)(c)){let e=(0,l.mainTemplate)(),t=(0,o.simplifyUri)((0,o.pathToUri)(this.buildConfig.stories.output),(0,o.pathToUri)(c));e=this.replaceVariable(e,"path",t),this.writeFile(c,e)}const u=(0,r.join)(a,"preview.ts");if(!(0,i.existsSync)(u)){let e=(0,p.previewTemplate)();this.writeFile(u,e)}}replaceVariable(e,t,n){let r=new RegExp("\\$"+t+"\\$","g");return e=e.replace(r,n)}writeFile(e,t){(0,o.writeFile)(e,t,"storybook")}}t.Storie=d},29495:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsManager=void 0;const n={liveserver:{host:"0.0.0.0",autoIncrementPort:!0,port:8080,rootFolder:"./dist",indexFile:"index.html",delay:200,launch_browser:!0,browser:"",auto_close:!0},updateImportOnRename:!0,readNodeModules:!1,templatePath:[],projectPath:[],readDirs:[],onlyBuild:!1,debug:!1,useStats:!1};function r(){return JSON.parse(JSON.stringify(n))}class i{static instance;_settings=r();get settings(){return this._settings}static getInstance(){return this.instance||(this.instance=new i),this.instance}constructor(){}setSettings(e){this._settings=this.mergeDeep(r(),e);let t=[...this.cbOnSettingsChange];for(let e of t)e()}cbOnSettingsChange=[];onSettingsChange(e){this.cbOnSettingsChange.push(e)}isObject(e){return e&&"object"==typeof e&&!Array.isArray(e)}mergeDeep(e,...t){if(!t.length)return e;const n=t.shift();if(this.isObject(e)&&this.isObject(n))for(const t in n)this.isObject(n[t])?(e[t]||Object.assign(e,{[t]:{}}),this.mergeDeep(e[t],n[t])):Object.assign(e,{[t]:n[t]});return this.mergeDeep(e,...t)}}t.SettingsManager=i},1539:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Timer=t.JS_WORD_REGEX=void 0,t.pathToUri=function(e){if(e.startsWith("file://"))return e;if("/"===r.sep)return"file://"+u(encodeURI(e.replace(/\\/g,"/")));return"file:///"+u(encodeURI(e.replace(/\\/g,"/")))},t.normalizeUri=u,t.normalizePath=function(e){return e.replace(/%3A/g,":").replace(/%40/g,"@")},t.uriToPath=function(e){if("/"===r.sep)return decodeURIComponent(e.replace("file://",""));return decodeURIComponent(e.replace("file:///",""))},t.reorderList=function(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1);e.splice(0,0,t)},t.getLanguageIdByUri=function(e){let t=Object.keys(a.AventusExtension).reverse();for(let n of t)if(e.endsWith(a.AventusExtension[n]))return p(a.AventusExtension[n]);return""},t.getLanguageIdByExtension=p,t.createErrorTs=_,t.createErrorTsSection=function(e,t,n,r,o){let l=new RegExp("//#region "+n+"(\\s|\\S)*?//#endregion").exec(e.getText());if(l){let c=l.index+10+n.length,u=l.index+l[0].length,p={range:s.Range.create(e.positionAt(c),e.positionAt(u)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,i.flattenDiagnosticMessageText)(t,"\n"),code:r};return o&&(p.data=o),p}return _(e,t,r)},t.createErrorTsPos=d,t.createErrorScss=function(e,t){return h(e,t,0,e.getText().length)},t.createErrorScssPos=h,t.createErrorHTMLPos=function(e,t,n,r){return{range:s.Range.create(e.positionAt(n),e.positionAt(r)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.HTML,message:(0,i.flattenDiagnosticMessageText)(t,"\n")}},t.getFolder=function(e){let t=e.split("/");return t.pop(),t.join("/")},t.convertRange=function(e,t){if(void 0===t.start){const t=e.positionAt(0);return s.Range.create(t,t)}const n=e.positionAt(t.start),r=e.positionAt(t.start+(t.length||0));return s.Range.create(n,r)},t.checkTxtBefore=function(e,t,n){let r=e.documentUser.offsetAt(t)-1,i=n.length-1,s=n[i];for(;r>0;)if(" "!=e.contentUser[r]){if(e.contentUser[r]!=s)return!1;if(i--,-1==i)return!0;s=n[i],r--}return!1},t.checkTxtAfter=function(e,t,n){let r=e.documentUser.offsetAt(t),i=e.documentUser.getText().length,s=0,a=n[s];for(;r<=i;)if(" "!=e.contentUser[r]){if(e.contentUser[r]!=a)return!1;if(s++,s==n.length)return!0;a=n[s],r++}return!1},t.replaceNotImportAliases=function(e,t){if(!t)return e;let n=t.aliases;for(let t in n)if(!t.startsWith("@")){let r=f(t),i=new RegExp("(?<!\\\\)"+r,"g");e=e.replace(i,n[t])}return e},t.escapeRegex=f,t.getWordAtText=function(e,n){let r=t.JS_WORD_REGEX,i=n;for(;i>0&&(s=e.charCodeAt(i-1),s!=="\r".charCodeAt(0)&&s!=="\n".charCodeAt(0));)i--;var s;const a=n-i,o=e.substr(i),l=r.ignoreCase?"gi":"g";r=new RegExp(r.source,l);let c=r.exec(o);for(;c&&c.index+c[0].length<a;)c=r.exec(o);if(c&&c.index<=a)return{start:c.index+i,length:c[0].length};return{start:n,length:0}},t.simplifyUri=function(e,t){e=decodeURIComponent(e);let n=(t=decodeURIComponent(t)).split("/");n.pop();let r=e.split("/");for(let e=0;e<n.length;e++)if(r.length>e){if(n[e]!=r[e])break;n.splice(e,1),r.splice(e,1),e--}let i="";for(let e=0;e<n.length;e++)i+="../";""==i&&(i+="./");return i+=r.join("/"),i},t.setValueToObject=function(e,t,n){e=e.replace(/\[(.*?)\]/g,".$1");let r=e.split(".");for(let e=0;e<r.length-1;e++){let n=r[e],s=(i=n,t instanceof Map?t.get(i):t[i]);s||(t[n]={},s=t[n]),t=s}var i;t instanceof Map?t.set(r[r.length-1],n):t[r[r.length-1]]=n},t.writeFile=function(e,t,n,r){let i=l(t),s=(0,o.existsSync)(e);m[e]&&m[e]==i&&s||(m[e]=i,c.Statistics.sendFileSize(e,t,n,r),(0,o.writeFileSync)(e,t))};const r=n(71017),i=n(94625),s=n(42374),a=n(19408),o=n(57147),l=n(61586),c=n(62814);function u(e){return e.replace(/:/g,"%3A").replace(/@/g,"%40")}function p(e){return".wcv.avt"==e?a.AventusLanguageId.HTML:".wcs.avt"==e?a.AventusLanguageId.SCSS:a.AventusLanguageId.TypeScript}function _(e,t,n,r){return d(e,t,0,e.getText().length,n,r)}function d(e,t,n,r,o,l){let c={range:s.Range.create(e.positionAt(n),e.positionAt(r)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.TypeScript,message:(0,i.flattenDiagnosticMessageText)(t,"\n"),code:o};return l&&(c.data=l),c}function h(e,t,n,r){return{range:s.Range.create(e.positionAt(n),e.positionAt(r)),severity:s.DiagnosticSeverity.Error,source:a.AventusLanguageId.SCSS,message:(0,i.flattenDiagnosticMessageText)(t,"\n")}}function f(e,t=!1){return t?e.replace(/[\\^$+?.()|[\]{}]/g,"\\$&"):e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}t.JS_WORD_REGEX=/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g;const m={};t.Timer=class{static timers={};static start(e){this.timers[e]=process.hrtime()}static stop(e){const t=process.hrtime(this.timers[e]),n=t[1]/1e6;return delete this.timers[e],1e3*t[0]+Math.round(n)}}},94625:(e,t,n)=>{
|
|
306
306
|
/*! *****************************************************************************
|
|
307
307
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
308
308
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|