@sap-ux/generator-odata-downloader 0.3.52 → 0.3.53

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.
@@ -2469,7 +2469,7 @@ ${i}`),await C_(t,o.concat(i),n),!0}function U0s(t,e){let r=fa.create("","",0,t)
2469
2469
 
2470
2470
  specVersion: "2.5"`);return o.setMetadata({name:t}),o.setType("application"),o.addFioriToolsProxyMiddleware({ui5:{}}),o.addFioriToolsAppReloadMiddleware(),o.addMockServerMiddleware(e,r,n,i),o}async function Pgn(t,e,r,n){let i=await Vp.newInstance("");i.addMockServerMiddleware(t,e,r,n);let o=i.findCustomMiddleware("sap-fe-mockserver");if(!o)throw Error("Could not create new mockserver config");return o}async function WAe(t,e,r){return r||(r=(0,wgn.create)((0,xgn.create)())),e.packageJsonConfig?.skip||Ogn(r,t,e.packageJsonConfig),await Cgn(r,t,e.webappPath,e.ui5MockYamlConfig),r}var DMs=pe(Ma(),1),RMs=pe(la(),1);var Dgn={questions:{pathToMock:"Path to mocked service",overwrite:"Overwrite services"}};var zdt="mockserver-config-writer",Rgn;async function MMs(){Rgn=Dn.createInstance({resources:{en:{[zdt]:Dgn}},lng:"en",fallbackLng:"en",defaultNS:zdt,ns:[zdt]}),await Rgn.init()}MMs().catch(()=>{});var Ngn={error:{requiredProjectFileNotFound:"Invalid project structure. Cannot find the required file: {{-path}}.",requiredProjectPropertyNotFound:"The required project property: {{-property}} was not found in the file: {{-path}}.",requiredServiceAlreadyExists:"A service with the {{-uri}} URI already exists. Choose another service.",unparseableXML:"Unparseable XML was specified: {{-error}}."}};var Kdt="odata-service-writer",kMs=Dn.createInstance();async function FMs(){await kMs.init({resources:{en:{[Kdt]:Ngn}},lng:"en",fallbackLng:"en",defaultNS:Kdt,ns:[Kdt]})}FMs().catch(()=>{});var $s;(function(t){t.v2="2",t.v4="4"})($s||($s={}));var GJ;(function(t){t.EDMX="edmx",t.CDS="cds"})(GJ||(GJ={}));var Qdt="mainService";var gft=require("node:path"),e_n=require("node:path/posix"),t_n=pe(JAe(),1),r_n=pe(VC(),1),n_n=pe(yD(),1);var bks=t_n.default,Aks=4;function gOe(t,e,r,n=Qdt,i){if(!r.length||!i)return;let o=new Set;for(let s of r){let a=Oks(i,s.path),c=[e,ua.LocalService,n,a],u=s.path.split(";")[0];if(s.entityData&&!o.has(u)){for(let p of s.entityData){let d=(0,gft.join)(...c,`${p.entitySetName}.json`);t.write(d,JSON.stringify(p.items,void 0,Aks))}o.add(u)}s.type==="value-list"&&c.push(s.target),c.push("metadata.xml");let l=(0,gft.join)(...c);s.metadata&&t.write(l,bks(s.metadata,{indentation:" ",lineSeparator:`
2471
2471
  `,collapseContent:!0,throwOnFailure:!1}))}}function Oks(t,e){let[r]=e.split(";"),n=r.split("/"),i="/",o=n.shift();for(;o!==void 0;){let s=(0,e_n.join)(i,o);if(!t.startsWith(s))break;i=s,o=n.shift()}return r.replace(i,"")}var mft={valueListReferences:!0,codeLists:!0};function Cks(t){return t?{valueListReferences:t.valueListReferences??mft.valueListReferences,codeLists:t.codeLists??mft.codeLists}:{...mft}}function YJ(t,e,r=[],n){let i=Cks(n);if(!e)return[];let o=[e,...r.map(a=>a.Definitions)],s=[];for(let a of o){let c=typeof a=="string"?(0,r_n.convert)((0,n_n.parse)(a)):a;for(let u of Object.values(c.annotations))for(let l of u){let p=l.target.replace(c.namespace+".","");Pks(i,s,p,l,t)}}return s}function Pks(t,e,r,n,i){for(let o of n.annotations)xks(t,e,r,o,i),wks(t,e,o,i)}function xks(t,e,r,n,i){if(t.valueListReferences&&n.term==="com.sap.vocabularies.Common.v1.ValueListReferences"){for(let o of n.collection??[])if(o.type==="String"){let s=o;e.push({type:"value-list",serviceRootPath:i,target:r,value:s.String.replaceAll(`
2472
- `,"").trim()})}}}function wks(t,e,r,n){if(t.codeLists&&(r.term==="com.sap.vocabularies.CodeList.v1.CurrencyCodes"||r.term==="com.sap.vocabularies.CodeList.v1.UnitsOfMeasure")&&r.record){let i=Zyn(r.record,"CollectionPath"),o=Zyn(r.record,"Url");o&&e.push({type:"code-list",serviceRootPath:n,value:o,collectionPath:i??void 0})}}function Zyn(t,e){let r=t.propertyValues.find(n=>n.name===e);if(r?.value?.type==="String")return r.value.String}var Dks=pe(zo(),1);var NVc=(0,yOe.dirname)((0,i_n.fileURLToPath)(__importMetaUrl));var xk=require("node:path"),gqn=pe(JAe()),yqn=pe(bOn());var AOn={errors:{odataQueryError:"An error occurred when querying for odata: {{error}}. $t(texts.seeLogForDetails)",dataNotFetched:"Data was not fetched",entityModelLoading:"An error occurred when reading the data model: {{- error}}. $t(texts.seeLogForDetails)"},info:{loggingInitialised:"Logger has been configure with level: {{logLevel}}",noServiceEntityData:"No service entity data to write.",noValueHelpData:"No Value Help service data to write.",entityFilesToBeGenerated:"The following entity files will be created: {{entities}}",noListEntityDefined:"No list entity defined. A main list entity is required to download data.",hierarchyEntityQuery:"Fetching hierarchy data for entity set: {{entitySetName}}...",hierarchyFilesGenerated:"The following hierarchy data files were created: {{entities}}"},texts:{seeLogForDetails:"For more information, view the logs.",rows_one:"{{count}} row",rows_other:"{{count}} rows",generatorTitle:"SAP Fiori Elements Data Downloader"},prompts:{appSelection:{message:"Select an application as data download target",breadcrumb:"Selected App",validation:{specficationApiVersionOutdated:"The found version of @sap/ux-specification {{specApiVersion}} is too old. Data download cannot proceed.",selectedPathDoesNotContainValidApp:"The selected path does not contain a valid application. {{- error}}",appMainServiceOdataVersionNotSupported:"The selected apps main service odata version is '{{serviceOdataVersion}}'. Please select an app with a main service odata version '4'."}},relatedEntitySelection:{message:"Select entities for data download (pre-selected entities are referenced by the application)",openLogs:"Show Logs"},toggleSelection:{message:"Reset selection",labelTrue:"Clear selected",labelFalse:"Restore default selection"},entityKey:{message:"Enter values for: {{keyName}}",hint:"For range selection use '-' between values. Use commas to select non-contiguous values.",validation:{invalidKeyValueChars:"Invalid key value contain not allowed characters: {{chars}}",invalidRangeSpecified:"Invalid range specified, only the lowest and highest values allowed. e.g. '1-10'",invalidBooleanValue:"Invalid Boolean value entered. Please enter true or false.",invalidGuidValue:"Invalid GUID format. Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}},skipDataDownload:{message:"If data download is not required select this option and proceed to Value Help download",hint:"Use this to temporarily disable live queries when entering multiple inputs and re-enable when ready",labelTrue:"Execute the OData query (data files will be generated on finish)",labelFalse:"Suppress the OData query (prevents multiple queries during selections)",querySuccess:'OData query success. $t(texts.rows, {"count": "{{count}}") returned. $t(texts.seeLogForDetails)',validation:{keyRequired:"Please enter at least one key field value to run the OData query"},choiceLabel:"Skip data download"},updateMainServiceMetadata:{message:"Update local metadata file from backend (remote service metadata is always used for data download):",validation:{errorLoadingAppOrMainService:"An error occurred while loading the application. Please correct the issue to proceed: {{- error}}"}},valueHelpSelection:{message:"Select Value Help data"}},steps:{odataDownloader:{name:"Configure Data Download",description:"Download data from an OData service for use with the UX Tools Mockdata Server"},valueHelpSelection:{name:"Value Help selection",description:"Value Help selection"},addConstraints:{name:"Add Missing Constraints",description:"Add Missing Constraints"}},telemetry:{unknownOs:"Unknown"}};var OOn=Dn.createInstance(),mCe="odata-dowload-generator";async function fmt(){await OOn.init({resources:{en:{[mCe]:AOn}},lng:"en",fallbackLng:"en",defaultNS:mCe,ns:[mCe],missingInterpolationHandler:()=>""})}function vr(t,e){return e?.ns||(e=Object.assign(e??{},{ns:mCe})),OOn.t(t,e)}fmt().catch(t=>console.error("Failed to initialize i18n:",t));var _bt=require("@sap-devx/yeoman-ui-types");var hmt;(function(t){t.official="officialVersions",t.snapshot="snapshotsVersions",t.support="support"})(hmt||(hmt={}));var gCe="1.65.0";var yCe=pe(zo(),1);var OQ=pe(zo(),1);var nt={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},nGs=[{version:"1.149.*",support:nt.maintenance},{version:"1.148.*",support:nt.maintenance},{version:"1.147.*",support:nt.outOfMaintenance},{version:"1.146.*",support:nt.outOfMaintenance},{version:"1.145.*",support:nt.maintenance},{version:"1.144.*",support:nt.outOfMaintenance},{version:"1.143.*",support:nt.outOfMaintenance},{version:"1.142.*",support:nt.maintenance},{version:"1.141.*",support:nt.outOfMaintenance},{version:"1.140.*",support:nt.outOfMaintenance},{version:"1.139.*",support:nt.outOfMaintenance},{version:"1.138.*",support:nt.outOfMaintenance},{version:"1.136.*",support:nt.maintenance},{version:"1.135.*",support:nt.outOfMaintenance},{version:"1.134.*",support:nt.outOfMaintenance},{version:"1.133.*",support:nt.outOfMaintenance},{version:"1.132.*",support:nt.outOfMaintenance},{version:"1.131.*",support:nt.outOfMaintenance},{version:"1.130.*",support:nt.outOfMaintenance},{version:"1.129.*",support:nt.outOfMaintenance},{version:"1.128.*",support:nt.outOfMaintenance},{version:"1.127.*",support:nt.outOfMaintenance},{version:"1.126.*",support:nt.outOfMaintenance},{version:"1.125.*",support:nt.outOfMaintenance},{version:"1.124.*",support:nt.outOfMaintenance},{version:"1.123.*",support:nt.outOfMaintenance},{version:"1.122.*",support:nt.outOfMaintenance},{version:"1.121.*",support:nt.outOfMaintenance},{version:"1.120.*",support:nt.maintenance},{version:"1.119.*",support:nt.outOfMaintenance},{version:"1.118.*",support:nt.outOfMaintenance},{version:"1.117.*",support:nt.outOfMaintenance},{version:"1.116.*",support:nt.outOfMaintenance},{version:"1.115.*",support:nt.outOfMaintenance},{version:"1.114.*",support:nt.outOfMaintenance},{version:"1.113.*",support:nt.outOfMaintenance},{version:"1.112.*",support:nt.outOfMaintenance},{version:"1.111.*",support:nt.outOfMaintenance},{version:"1.110.*",support:nt.outOfMaintenance},{version:"1.109.*",support:nt.outOfMaintenance},{version:"1.108.*",support:nt.maintenance},{version:"1.107.*",support:nt.outOfMaintenance},{version:"1.106.*",support:nt.outOfMaintenance},{version:"1.105.*",support:nt.outOfMaintenance},{version:"1.104.*",support:nt.outOfMaintenance},{version:"1.103.*",support:nt.outOfMaintenance},{version:"1.102.*",support:nt.outOfMaintenance},{version:"1.101.*",support:nt.outOfMaintenance},{version:"1.100.*",support:nt.outOfMaintenance},{version:"1.99.*",support:nt.outOfMaintenance},{version:"1.98.*",support:nt.outOfMaintenance},{version:"1.97.*",support:nt.outOfMaintenance},{version:"1.96.*",support:nt.maintenance},{version:"1.95.*",support:nt.outOfMaintenance},{version:"1.94.*",support:nt.outOfMaintenance},{version:"1.93.*",support:nt.outOfMaintenance},{version:"1.92.*",support:nt.outOfMaintenance},{version:"1.91.*",support:nt.outOfMaintenance},{version:"1.90.*",support:nt.outOfMaintenance},{version:"1.89.*",support:nt.outOfMaintenance},{version:"1.88.*",support:nt.outOfMaintenance},{version:"1.87.*",support:nt.outOfMaintenance},{version:"1.86.*",support:nt.outOfMaintenance},{version:"1.85.*",support:nt.outOfMaintenance},{version:"1.84.*",support:nt.outOfMaintenance},{version:"1.82.*",support:nt.outOfMaintenance},{version:"1.81.*",support:nt.outOfMaintenance},{version:"1.80.*",support:nt.outOfMaintenance},{version:"1.79.*",support:nt.outOfMaintenance},{version:"1.78.*",support:nt.outOfMaintenance},{version:"1.77.*",support:nt.outOfMaintenance},{version:"1.76.*",support:nt.outOfMaintenance},{version:"1.75.*",support:nt.outOfMaintenance},{version:"1.74.*",support:nt.outOfMaintenance},{version:"1.73.*",support:nt.outOfMaintenance},{version:"1.72.*",support:nt.outOfMaintenance},{version:"1.71.*",support:nt.maintenance},{version:"1.70.*",support:nt.outOfMaintenance},{version:"1.69.*",support:nt.outOfMaintenance},{version:"1.68.*",support:nt.outOfMaintenance},{version:"1.67.*",support:nt.outOfMaintenance},{version:"1.66.*",support:nt.outOfMaintenance},{version:"1.65.*",support:nt.outOfMaintenance},{version:"1.64.*",support:nt.outOfMaintenance},{version:"1.63.*",support:nt.outOfMaintenance},{version:"1.62.*",support:nt.outOfMaintenance},{version:"1.61.*",support:nt.outOfMaintenance},{version:"1.60.*",support:nt.outOfMaintenance},{version:"1.58.*",support:nt.outOfMaintenance},{version:"1.56.*",support:nt.outOfMaintenance},{version:"1.54.*",support:nt.outOfMaintenance},{version:"1.52.*",support:nt.outOfMaintenance},{version:"1.50.*",support:nt.outOfMaintenance},{version:"1.48.*",support:nt.outOfMaintenance},{version:"1.46.*",support:nt.outOfMaintenance},{version:"1.44.*",support:nt.outOfMaintenance},{version:"1.42.*",support:nt.outOfMaintenance},{version:"1.40.*",support:nt.outOfMaintenance},{version:"1.38.*",support:nt.maintenance},{version:"1.36.*",support:nt.outOfMaintenance},{version:"1.34.*",support:nt.outOfMaintenance},{version:"1.32.*",support:nt.outOfMaintenance},{version:"1.30.*",support:nt.outOfMaintenance},{version:"1.28.*",support:nt.outOfMaintenance},{version:"1.26.*",support:nt.outOfMaintenance},{version:"1.24.*",support:nt.outOfMaintenance},{version:"1.22.*",support:nt.outOfMaintenance},{version:"*",support:nt.outOfMaintenance}],mmt=nGs.filter(t=>t.support===nt.maintenance&&(0,OQ.gte)((0,OQ.coerce)(t.version)??"0.0.0",gCe)).map(t=>({version:(0,OQ.coerce)(t.version)?.version??"0.0.0",support:nt.maintenance})),iGs=[...mmt].map(t=>t.version);var gmt=pe(zo(),1);var aGs="1.72.0",xOn="1.102.0",cGs="1.136.0",uGs="1.120.0",bg;(function(t){t.SAP_BELIZE="sap_belize",t.SAP_FIORI_3="sap_fiori_3",t.SAP_FIORI_3_DARK="sap_fiori_3_dark",t.SAP_HORIZON="sap_horizon",t.SAP_HORIZON_DARK="sap_horizon_dark"})(bg||(bg={}));var lGs={[bg.SAP_BELIZE]:{id:bg.SAP_BELIZE,label:"Belize",supportUntil:cGs,deprecateSince:uGs},[bg.SAP_FIORI_3]:{id:bg.SAP_FIORI_3,label:"Quartz Light"},[bg.SAP_FIORI_3_DARK]:{id:bg.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:aGs},[bg.SAP_HORIZON]:{id:bg.SAP_HORIZON,label:"Morning Horizon",supportSince:xOn},[bg.SAP_HORIZON_DARK]:{id:bg.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:xOn}};var UOn=pe(ROn(),1),ymt=pe(zo(),1);var NOn={prompts:{username:{message:"Username"},password:{message:"Password"}},ui5VersionLabels:{maintained:"Maintained",outOfMaintenance:"Out of maintenance",version_one:"version",version_other:"versions"},errors:{destination:{unavailable:"The selected destination references an instance that is not available. Please check your destination configuration and try again.",notFound:"The destination target URL cannot be found. The request failed with status code 404. Please check the destination target URL connectivity in your SAP BTP cockpit.",notReachable:"The selected system is not reachable. System Name: {{systemName}}, Error: {{- error}}.",misconfigured:'The destination is misconfigured. $t(errors.destination.missingPropMsg, {"destinationProperty": "{{destinationProperty}}" })',missingPropMsg:"The property: `{{destinationProperty}}` is missing.",httpConnectionError:"A connection error occurred with the selected destination. HTTP Code: {{- code}}. $t(texts.seeLogForDetails)"},unknownError:"An error occurred{{- error, addMsgWithColonFormatter}}",servicesUnavailable:"An error occurred retrieving services for the SAP System.",certificateError:"A certificate error has occurred{{- errorMsg, addMsgWithColonFormatter}}",urlCertValidationError:"The system URL is using {{certErrorReason}} security certificate.",authenticationFailed:"Authentication incorrect. {{- error}}",authenticationTimeout:"Authorization was not verified within the allowed time. Please ensure you have authenticated using the associated browser window.",invalidUrl:"Invalid URL{{-input, addMsgWithColonFormatter}}",connectionError:"A connection error occurred. Please ensure the target host is available on the network: {{- error}}",timeout:"A connection timeout error occurred{{- errorMsg, addMsgWithColonFormatter}}",serverReturnedAnError:"The server returned an error. {{- errorDesc}}",serverUnableToCompleteRequest:"The server was unable to complete the request. Please try again.",catalogServiceNotActive:"Catalog service is not active.",urlNotFound:"URL not found.",odataServiceUrlNotFound:"The service URL you have provided is not a valid OData Service. SAP Fiori applications require an OData service as the data source.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",redirectError:"A redirect response was received from the server",abapEnvsUnavailable:"ABAP environments unavailable.",noSuchHostError:"No such host is known. Ensure the host is available.",noAbapEnvsInCFSpace:"No ABAP environments in CF space found. Ensure an ABAP environment exists.",abapEnvsCFDiscoveryFailed:"Discovering ABAP Environments failed. Please ensure you are logged into Cloud Foundry. For more information, see https://docs.cloudfoundry.org/cf-cli/getting-started.html#login.",systemConnectionValidationFailed:"A connection to the selected system cannot be established. Ensure the credentials are valid.",internalServerError:"Internal server error{{-errorMsg, addMsgWithColonFormatter}}",badGateway:"Bad gateway{{- errorMsg, addMsgWithColonFormatter}}",badRequest:"Bad request{{- errorMsg, addMsgWithColonFormatter}}",cannotBeEmpty:"{{- field}} cannot be empty.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata."},guidedAnswers:{validationErrorHelpText:"Need help with this error?"},texts:{anExpiredCert:"an expired",aSelfSignedCert:"a self-signed",anUnknownOrInvalidCert:"an unknown or invalid",anUntrustedRootCert:"an untrusted root",suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, see the log.",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration."}};var IOn="inquirer-common",_Ce=Dn.createInstance();function ECe(){_Ce.addResourceBundle("en",IOn,NOn)}async function fGs(){await _Ce.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),_Ce.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),ECe()}function Yr(t,e){return e?.ns||(e=Object.assign(e??{},{ns:IOn})),_Ce.t(t,e)}fGs().catch(()=>{});var yGs=pe(SCe(),1);function gG(t,e){return t&&e?UOn.default.filter(t,e,{extract:r=>r.name??""}).map(r=>r.original):e}var bCe=class{message;link;constructor(e){Object.assign(this,e)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var CQ=pe(nre(),1);function _Gs(t,e,r){let n=t.additionalMessages;return(i,o)=>{let s={...(0,CQ.default)(o),...(0,CQ.default)(r)},a=e(i,s);return a||(typeof n=="function"?n(i,o):void 0)}}function EGs(t,e,r){let n=t.validate;return(i,o)=>{let s={...(0,CQ.default)(o),...(0,CQ.default)(r)},a=e?.(i,s);return a!==!0?a:typeof n=="function"?n(i,o):!0}}function vGs(t,e,r,n){let i;return r==="validate"&&e.validate&&(i=EGs(t,e.validate,n)),r==="additionalMessages"&&e.additionalMessages&&(i=_Gs(t,e.additionalMessages,n)),t=Object.assign(t,{[r]:i}),t}function pl(t,e){return t.forEach(r=>{if(r.when!==void 0)if(typeof r.when=="function"){let n=r.when;r.when=i=>e(i)?n(i):!1}else{let n=r.when;r.when=i=>e(i)&&n}else r.when=e}),t}function _mt(t,e,r){return t.forEach(n=>{let i=n.name,o=e[n.name];if(o){let s=Object.keys(o);for(let a of s){(a==="validate"||a==="additionalMessages")&&(n=vGs(n,o,a,r));let c=e[i].default;c&&(n.default=c)}}}),t}var Emt="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var vmt={FIORI_TOOLS:3046},Qp={FIORI_TOOLS:45995,DEV_PLATFORM:45996,FIORI_APP_GENERATOR:48363,BAS_CATALOG_SERVICES_REQUEST_FAILED:48366,APPLICATION_PREVIEW:52881,CERTIFICATE_ERROR:53643,DESTINATION_MISCONFIGURED:54336,DESTINATION_UNAVAILABLE:51208,DESTINATION_NOT_FOUND:51208,BAD_GATEWAY:48366,DESTINATION_SERVICE_UNAVAILBLE:52526,NO_V4_SERVICES:57573,NO_ADT_SERVICE_AUTH:57266,DESTINATION_CONNECTION_ERRORS:48366,UI_SERVICE_GENERATOR:63068,DESTINATION_GATEWAY_TIMEOUT:57914,ADT_APP_NOT_FOUND_ERROR:63911,DESTINATION_FULL_URL:68172,ABAP_REPO_APP_DOWNLOAD_FAILED:68669};var $On="sap.ux.guidedAnswer.openGuidedAnswer",TGs="https://ga.support.sap.com/dtp/viewer/index.html";function VOn(t,e){let r="";return e.length>0&&(r=`/actions/${e.join(":")}`),`${TGs}#/tree/${t}${r}`}var BOn=pe(yAe(),1);var Smt,Tmt;function jOn(){return Smt}function OL(t,e){let r=SGs(t,e);Smt&&Smt.reportEvent(r,lc.NoSampling)}function SGs(t,e){Tmt=Tmt??(0,BOn.default)();let r=Object.assign(e,{OperatingSystem:Tmt,Platform:e.Platform||hy().technical});return{eventName:t,properties:r,measurements:{}}}function ACe(t){return Roe(t)?"AbapODataCatalogDest":DP(t)?"GenericODataFullUrlDest":bE(t)?"GenericODataPartialUrlDest":"Unknown"}var bGs="GA_LINK_CREATED",AGs="SERVICE_INQUIRER_BAS_ERROR",Me;(function(t){t.AUTH="AUTH",t.AUTH_TIMEOUT="AUTH_TIMEOUT",t.REDIRECT="REDIRECT",t.CERT="CERT",t.CERT_SELF_SIGNED="CERT_SELF_SIGNED",t.CERT_UKNOWN_OR_INVALID="CERT_UKNOWN_OR_INVALID",t.CERT_EXPIRED="CERT_EXPIRED",t.CERT_SELF_SIGNED_CERT_IN_CHAIN="CERT_SELF_SIGNED_CERT_IN_CHAIN",t.INVALID_SSL_CERTIFICATE="INVALID_SSL_CERTIFICATE",t.UNKNOWN="UNKNOWN",t.INVALID_URL="INVALID_URL",t.TIMEOUT="TIMEOUT",t.CONNECTION="CONNECTION",t.SERVICES_UNAVAILABLE="SERVICES_UNAVAILABLE",t.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",t.NO_ABAP_ENVS="NO_ABAP_ENVS",t.CATALOG_SERVICE_NOT_ACTIVE="CATALOG_SERVICE_NOT_ACTIVE",t.NO_SUCH_HOST="NO_SUCH_HOST",t.NOT_FOUND="NOT_FOUND",t.ODATA_URL_NOT_FOUND="ODATA_URL_NOT_FOUND",t.BAD_GATEWAY="BAD_GATEWAY",t.GATEWAY_TIMEOUT="GATEWAY_TIMEOUT",t.INTERNAL_SERVER_ERROR="INTERNAL_SERVER_ERROR",t.DESTINATION_SERVICE_UNAVAILABLE="DESTINATION_SERVICE_UNAVAILABLE",t.DESTINATION_UNAVAILABLE="DESTINATION_UNAVAILABLE",t.DESTINATION_NOT_FOUND="DESTINATION_NOT_FOUND",t.DESTINATION_MISCONFIGURED="DESTINATION_MISCONFIGURED",t.NO_V2_SERVICES="NO_V2_SERVICES",t.NO_V4_SERVICES="NO_V4_SERVICES",t.BAD_REQUEST="BAD_REQUEST",t.DESTINATION_CONNECTION_ERROR="DESTINATION_CONNECTION_ERROR",t.SERVER_HTTP_ERROR="SERVER_HTTP_ERROR"})(Me||(Me={}));var OGs={[Me.AUTH]:[/401/,/403/,/Incorrect credentials were provided to login/,/Unable to retrieve SAP Business Accelerator Hub key/],[Me.AUTH_TIMEOUT]:[/UAATimeoutError/],[Me.TIMEOUT]:[/Timeout/],[Me.CERT]:[],[Me.CERT_UKNOWN_OR_INVALID]:[/UNABLE_TO_GET_ISSUER_CERT/,/UNABLE_TO_GET_ISSUER_CERT_LOCALLY/,/unable to get local issuer certificate/,/UNABLE_TO_VERIFY_LEAF_SIGNATURE/,/ERR_TLS_CERT_ALTNAME_INVALID/],[Me.CERT_EXPIRED]:[/CERT_HAS_EXPIRED/],[Me.CERT_SELF_SIGNED]:[/DEPTH_ZERO_SELF_SIGNED_CERT/],[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:[/SELF_SIGNED_CERT_IN_CHAIN/],[Me.INVALID_SSL_CERTIFICATE]:[/526/,/Invalid SSL Certificate/],[Me.UNKNOWN]:[],[Me.CONNECTION]:[/ENOTFOUND/,/ECONNRESET/,/ECONNREFUSED/,/EPROTO/,/ConnectionError/],[Me.SERVICES_UNAVAILABLE]:[],[Me.SERVICE_UNAVAILABLE]:[/503/],[Me.INVALID_URL]:[/Invalid URL/,/ERR_INVALID_URL/],[Me.REDIRECT]:[/3\d\d/],[Me.NO_ABAP_ENVS]:[],[Me.CATALOG_SERVICE_NOT_ACTIVE]:[/\/IWBEP\/CM_V4_COS\/014/,/\/IWFND\/CM_V4_COS\/021/,/Service group '\/IWFND\/CONFIG' not published/],[Me.NO_SUCH_HOST]:[/no such host/],[Me.NOT_FOUND]:[/404/],[Me.ODATA_URL_NOT_FOUND]:[],[Me.INTERNAL_SERVER_ERROR]:[/500/],[Me.BAD_GATEWAY]:[/502/],[Me.GATEWAY_TIMEOUT]:[/504/],[Me.DESTINATION_SERVICE_UNAVAILABLE]:[],[Me.DESTINATION_UNAVAILABLE]:[],[Me.DESTINATION_NOT_FOUND]:[],[Me.DESTINATION_MISCONFIGURED]:[],[Me.NO_V2_SERVICES]:[],[Me.NO_V4_SERVICES]:[],[Me.BAD_REQUEST]:[/400/],[Me.DESTINATION_CONNECTION_ERROR]:[],[Me.SERVER_HTTP_ERROR]:[/5\d\d/]},Oo=class t{currentErrorMsg;currentErrorType;static _guidedAnswersEnabled;static _logger;static _platform;static get platform(){return t._platform}static set platform(e){t._platform=e}static _guidedAnswersTrigger;static get guidedAnswersTrigger(){return t._guidedAnswersTrigger}static set guidedAnswersTrigger(e){t._guidedAnswersTrigger=e}static getMessageFromError=e=>e?.message||e?.status?.toString()||e?.response?.status?.toString()||(typeof e=="string"?e:JSON.stringify(e));static serverErrorMessage=(e,r)=>Yr("errors.serverReturnedAnError",{errorDesc:r?Yr(r,{errorMsg:t.getMessageFromError(e)}):t.getMessageFromError(e)});static _errorTypeToMsg={[Me.CERT]:e=>Yr("errors.certificateError",{errorMsg:t.getMessageFromError(e)}),[Me.CERT_EXPIRED]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anExpiredCert")}),[Me.CERT_SELF_SIGNED]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.aSelfSignedCert")}),[Me.CERT_UKNOWN_OR_INVALID]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anUnknownOrInvalidCert")}),[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anUntrustedRootCert")}),[Me.INVALID_SSL_CERTIFICATE]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anUnknownOrInvalidCert")}),[Me.AUTH]:e=>Yr("errors.authenticationFailed",{error:t.getMessageFromError(e)}),[Me.AUTH_TIMEOUT]:()=>Yr("errors.authenticationTimeout"),[Me.TIMEOUT]:e=>Yr("errors.timeout",{errorMsg:t.getMessageFromError(e)}),[Me.INVALID_URL]:()=>Yr("errors.invalidUrl"),[Me.CONNECTION]:e=>Yr("errors.connectionError",{error:t.getMessageFromError(e)}),[Me.UNKNOWN]:e=>Yr("errors.unknownError",{error:t.getMessageFromError(e)}),[Me.SERVICES_UNAVAILABLE]:()=>Yr("errors.servicesUnavailable"),[Me.SERVICE_UNAVAILABLE]:e=>t.serverErrorMessage(e),[Me.CATALOG_SERVICE_NOT_ACTIVE]:()=>Yr("errors.catalogServiceNotActive"),[Me.INTERNAL_SERVER_ERROR]:e=>t.serverErrorMessage(e,"errors.internalServerError"),[Me.NOT_FOUND]:()=>Yr("errors.urlNotFound"),[Me.ODATA_URL_NOT_FOUND]:()=>Yr("errors.odataServiceUrlNotFound"),[Me.BAD_GATEWAY]:e=>t.serverErrorMessage(e,"errors.badGateway"),[Me.DESTINATION_UNAVAILABLE]:()=>Yr("errors.destination.unavailable"),[Me.DESTINATION_NOT_FOUND]:()=>Yr("errors.destination.notFound"),[Me.DESTINATION_MISCONFIGURED]:e=>Yr("errors.destination.misconfigured",{destinationProperty:typeof e=="string"?e:""}),[Me.NO_V2_SERVICES]:()=>Yr("errors.noServicesAvailable",{version:"2"}),[Me.NO_V4_SERVICES]:()=>Yr("errors.noServicesAvailable",{version:"4"}),[Me.DESTINATION_SERVICE_UNAVAILABLE]:()=>Yr("errors.destination.unavailable"),[Me.REDIRECT]:()=>Yr("errors.redirectError"),[Me.NO_SUCH_HOST]:()=>Yr("errors.noSuchHostError"),[Me.NO_ABAP_ENVS]:()=>Yr("errors.abapEnvsUnavailable"),[Me.BAD_REQUEST]:e=>t.serverErrorMessage(e,"errors.badRequest"),[Me.DESTINATION_CONNECTION_ERROR]:()=>Yr("errors.systemConnectionValidationFailed"),[Me.SERVER_HTTP_ERROR]:e=>t.serverErrorMessage(e),[Me.GATEWAY_TIMEOUT]:e=>t.serverErrorMessage(e)};static _errorMsg=(e,r)=>t._errorTypeToMsg[e](r);static getHelpNode=e=>{let r=Si();return{[Me.SERVICES_UNAVAILABLE]:r?Qp.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[Me.CERT]:Qp.CERTIFICATE_ERROR,[Me.CERT_EXPIRED]:Qp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED]:Qp.CERTIFICATE_ERROR,[Me.CERT_UKNOWN_OR_INVALID]:Qp.CERTIFICATE_ERROR,[Me.INVALID_SSL_CERTIFICATE]:Qp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:Qp.CERTIFICATE_ERROR,[Me.DESTINATION_MISCONFIGURED]:Qp.DESTINATION_MISCONFIGURED,[Me.DESTINATION_UNAVAILABLE]:Qp.DESTINATION_UNAVAILABLE,[Me.DESTINATION_NOT_FOUND]:Qp.DESTINATION_NOT_FOUND,[Me.BAD_GATEWAY]:Qp.BAD_GATEWAY,[Me.DESTINATION_SERVICE_UNAVAILABLE]:Qp.DESTINATION_SERVICE_UNAVAILBLE,[Me.NO_V4_SERVICES]:Qp.NO_V4_SERVICES,[Me.GATEWAY_TIMEOUT]:r?Qp.DESTINATION_GATEWAY_TIMEOUT:void 0,[Me.AUTH]:void 0,[Me.AUTH_TIMEOUT]:void 0,[Me.REDIRECT]:void 0,[Me.UNKNOWN]:void 0,[Me.INVALID_URL]:void 0,[Me.CONNECTION]:void 0,[Me.SERVICE_UNAVAILABLE]:void 0,[Me.NO_ABAP_ENVS]:void 0,[Me.CATALOG_SERVICE_NOT_ACTIVE]:void 0,[Me.NO_SUCH_HOST]:void 0,[Me.NOT_FOUND]:void 0,[Me.ODATA_URL_NOT_FOUND]:void 0,[Me.INTERNAL_SERVER_ERROR]:void 0,[Me.NO_V2_SERVICES]:void 0,[Me.TIMEOUT]:void 0,[Me.BAD_REQUEST]:void 0,[Me.DESTINATION_CONNECTION_ERROR]:Qp.DESTINATION_CONNECTION_ERRORS,[Me.SERVER_HTTP_ERROR]:void 0}[e]};static findErrorValueForMapping=e=>e.response?.data?.error?.code||e.response?.status||e.response?.data||e.code||(["TypeError","Error"].includes(e.name)?e.message:e.name)||e.message||e;constructor(e,r=!1,n){t._logger=e??new vc({logPrefix:n??"@sap-ux/inquirer-common"}),t.guidedAnswersEnabled=r}static get guidedAnswersEnabled(){return t._guidedAnswersEnabled}static set guidedAnswersEnabled(e){t._guidedAnswersEnabled=e}static set logger(e){t._logger=e}static get logger(){return t._logger}static isCertError(e){return[Me.CERT,Me.CERT_EXPIRED,Me.CERT_SELF_SIGNED,Me.CERT_UKNOWN_OR_INVALID,Me.CERT_SELF_SIGNED_CERT_IN_CHAIN].includes(t.getErrorType(e))}static getErrorType(e){let r=e;return e instanceof Error&&(r=t.findErrorValueForMapping(e)),Object.keys(Me).find(n=>OGs[n].find(i=>i.test(r.toString())))}logErrorMsgs(e,r,n=!0){let i={errorMsg:"",errorType:Me.UNKNOWN};if(Object.values(Me).includes(e)){let o=e;i.errorMsg=t.getErrorMsgFromType(o)??o.toString(),i.errorType=o}else typeof e=="string"?i.errorMsg=e:i=t.mapErrorToMsg(e);return t._logger.error(r?`${r} ${i.errorMsg}`:i.errorMsg),n&&(this.currentErrorMsg=r??i.errorMsg,this.currentErrorType=i.errorType),i.errorMsg}static mapErrorToMsg(e){let r;return Object.values(Me).includes(e)?r=e:r=t.getErrorType(this.findErrorValueForMapping(e))??Me.UNKNOWN,{errorMsg:t._errorMsg(r,e),errorType:r}}getErrorMsg(e,r,n){let i;return e&&typeof e!="boolean"&&(i=t.mapErrorToMsg(e).errorMsg),i||(i=this.currentErrorMsg??(n?t.getErrorMsgFromType(n):void 0)),(e===!0||r)&&(this.currentErrorMsg=null,this.currentErrorType=null),i}resetErrorState(){this.currentErrorMsg=null,this.currentErrorType=null}getValidationErrorHelp(e,r=!1,n){let i,o,s;if(e?{errorMsg:o,errorType:s}=t.mapErrorToMsg(e):(o=this.currentErrorMsg??void 0,this.currentErrorType&&(s=this.currentErrorType)),s){if(n){let{errorType:a,errorMsg:c}=t.getDestinationSpecificError(s,n);o=c??o,s=a??s}s&&(i=t.getHelpForError(s,o))}return r&&(this.currentErrorMsg=null,this.currentErrorType=null),i??o}static getDestinationSpecificError(e,r){let n,i;return WHt(r)?e===Me.SERVICE_UNAVAILABLE?KHt(r)?n=Me.DESTINATION_SERVICE_UNAVAILABLE:n=Me.DESTINATION_CONNECTION_ERROR:e===Me.NOT_FOUND?(n=Me.DESTINATION_NOT_FOUND,i=this.getErrorMsgFromType(Me.DESTINATION_NOT_FOUND)):Me.INTERNAL_SERVER_ERROR===e||Me.SERVER_HTTP_ERROR===e?n=Me.DESTINATION_CONNECTION_ERROR:e===Me.AUTH&&r.Authentication!==$T.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(Me.AUTH,Yr("texts.checkDestinationAuthConfig"))):(n=Me.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),OL(AGs,{basErrorType:n??e,destODataType:ACe(r),Platform:this._platform??hy().technical}),{errorType:n??e,errorMsg:i}}static getErrorMsgFromType(e,r){if(Me[e])return t._errorMsg(Me[e],r)}hasError(e=!1){let r=!!this.currentErrorMsg;return e&&(this.currentErrorMsg=null,this.currentErrorType=null),r}setCurrentError(e,r){this.currentErrorMsg=t._errorMsg(Me[e],r),this.currentErrorType=e}getCurrentErrorType(e=!1){let r=this.currentErrorType;return e&&(this.currentErrorMsg=null,this.currentErrorType=null),r}static getHelpForError(e,r){let n=t.getHelpNode(e),i=r??t.getErrorMsgFromType(e);return n&&i?this.getHelpLink(n,e,i):i}static getHelpLink(e,r,n){let i={message:n,link:{text:Yr("guidedAnswers.validationErrorHelpText"),icon:Emt,url:VOn(vmt.FIORI_TOOLS,[e])}};return this.guidedAnswersEnabled&&(i.link.command={id:$On,params:{treeId:vmt.FIORI_TOOLS,nodeIdPath:[e],trigger:this.guidedAnswersTrigger}}),OL(bGs,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${e}`,Platform:this.platform??hy().technical}),new bCe(i)}};var qOn=pe(Ooe(),1);async function GOn(t){let e=[];try{let r=[qA.ABAP,qA.ABAP_TRIAL,qA.ABAP_CANARY,qA.ABAP_OEM,qA.ABAP_OEM_CANARY,qA.ABAP_HAAS,qA.ABAP_STAGING,qA.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(o=>o.trim()):[],i=await(0,qOn.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(o=>{e.push({name:o.label,value:o})}):t.logErrorMsgs(Me.NO_ABAP_ENVS,Yr("errors.noAbapEnvsInCFSpace"))}catch{t.logErrorMsgs(Me.NO_ABAP_ENVS,Yr("errors.abapEnvsCFDiscoveryFailed"))}return e.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var CGs=pe(VC(),1),PGs=pe(yD(),1);var vva=pe(QDn(),1);var ZDn={deploy:{abapAppDescLength:"The deployment description cannot exceed 60 characters.",abapTransportNumRequired:"Provide a transport request for your application.",abapPackageWarn:"Provide a package.",abapAppNameRequired:"The application name is required.",abapInvalidNamespace:"The namespace is invalid because there are too many forward slashes.",abapInvalidNamespaceLength:"The namespace is limited to 10 characters. Entered {{length}}.",abapInvalidAppNameLength:"The application name is limited to 15 characters. Entered {{length}}.",abapInvalidAppName:"The application name must be prefixed with [{{prefix}}].",charactersForbiddenInAppName:"Only alphanumeric, underscore, and slash characters are allowed.",invalidAppNameMultipleReason:"The application name is invalid for multiple reasons:"},ui5:{namespaceMustStartWithLetter:"The namespace must start with a letter.",namespaceEndInPeriod:"The namespace cannot end with a period.",namespaceCannotBeSap:"The namespace cannot be {{str}}.",namespaceStartsWithNew:"The namespace cannot start with {{str}}.",namespaceNumberAfterPeriod:"A number cannot follow a period in the namespace.",lowerAlphaNumericOnly:"Only use lowercase alphanumeric characters.",lowerAlphaNumericDotsOnly:"Only use lowercase alphanumeric characters and dots for the namespace.",namespaceSpecialCharacter:"The namespace can only contain letters, digits, dots, and underscores.",moduleNameMustStartWithLetter:"The module name must start with a letter.",nameCombinedTooLong:"The combined length of the namespace and module name must not exceed {{length}} characters.",folderDoesNotExist:"This folder does not exist. Please enter the root folder for your project.",folderDoesNotHaveCorrectPermissions:"The selected folder does not have the required permissions. Please ensure you have permission to write to the selected folder and try again.",enterProjectFolder:"Please enter a project folder.",nameNull:"The module name cannot be null.",nameUndefined:"The module name cannot be undefined.",nameNotString:"The module name must be a string.",nameLengthZero:"The module name's length must be greater than zero.",nameStartsWithPeriod:"The module name cannot start with a period.",nameStartsWithUnderscore:"The module name cannot start with an underscore.",nameStartsOrEndsWithSpace:"The module name cannot contain leading or trailing spaces.",nameBlocklisted:"{{modName}} is a blocklisted module name. Choose a different name.",nameIsCoreModule:"{{modName}} is a core module name. Choose a different name.",nameTooLong:"The module name cannot exceed {{length}} characters.",nameTooShort:"The module name must be at least {{length}} characters.",inputValueContainsCapital:"{{promptName}} cannot contain capital letters",nameContainsSpecialCharacters:`The module name cannot contain special characters: ("~'!()*)`,nameNotUrlFriendly:"The module name can only contain URL-friendly characters.",invalidModuleName:"Invalid module name.",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path.",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must use the local CAP project as the data source."},general:{invalidUrl:"Invalid URL: [{{-input}}]",invalidClient:"[{{client}}] is invalid. Leave this field empty or enter a value between 000-999.",inputCannotBeEmpty:"The input cannot be empty.",inputCannotHaveSpaces:"The input cannot contain spaces.",invalidJSON:"Invalid JSON.",invalidValueForSpecialChars:"The input must only contain Latin alphanumeric characters or the following symbols: '-','_','$' and '.'.",maxLength:"The maximum length is: {{maxLength}} characters.",supportedFormats:"Only alphanumeric and '{{allowedCharacters}}' characters are allowed.",nameContainsSpecialCharacters:`Module name cannot contain special characters ("~'!()*)`,nameNotUrlFriendly:"Module name can only contain URL-friendly characters",invalidModuleName:"Invalid module name",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must therefore use the local CAP project as the data source.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",windowsFolderPathTooLong:"The combined length {{length}} of the target folder and module name exceeds the default Windows path length. This can cause issues with project generation."},adp:{projectNameUppercaseError:"The project name cannot contain uppercase letters.",projectNameLengthErrorExt:"The project name cannot exceed 61 characters or end with the word 'component'.",projectNameValidationErrorExt:"The project name must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",projectNameLengthErrorInt:"The project name cannot start with the word 'customer', exceed 61 characters, or end with the word 'component'.",projectNameValidationErrorInt:"The project name must only contain Latin alphanumeric characters and it must have at least two parts. The different parts must be separated by a period and every part must start with a letter.",duplicatedProjectName:"A project with this name already exists in your workspace. Please choose another name.",differentNamespaceThanProjectName:"The namespace must be the same as the project name.",namespaceSameAsProjectNameError:"The namespace must be the same as the project name.",namespaceLengthError:"The namespace cannot exceed 61 characters or end with the word 'component'.",namespaceValidationError:"The namespace must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",achMandatoryError:"The Application Component Hierarchy must only contain capital letters, digits, and dashes."}};var eRn="project-input-validator",P_t=Dn.createInstance();function lwe(){P_t.addResourceBundle("en",eRn,ZDn)}async function tRn(){await P_t.init({lng:"en",fallbackLng:"en"}),lwe()}function UL(t,e){return e?.ns||(e=Object.assign(e??{},{ns:eRn})),P_t.t(t,e)}tRn().catch(()=>{});var uaa=pe(iRn(),1);function oRn(t){let e=t?.trim()||"";return e===""||/^\d{3}$/.test(e)?!0:UL("general.invalidClient",{client:t})}var sRn={prompts:{datasourceType:{message:"Data Source",projectSpecificDestName:"Project Specific Destination",businessHubName:"SAP Business Accelerator Hub",sapSystemName:"System",odataServiceUrlName:"OData Service",capProjectName:"Local CAP Project",metadataFileName:"Metadata Document",choiceNone:"$t(texts.choiceNameNone)",projectSpecificDestChoiceText:"Connect to a $t(prompts.datasourceType.projectSpecificDestName)",businessHubChoiceText:"Connect to $t(prompts.datasourceType.businessHubName)",sapSystemChoiceText:"Connect to a $t(prompts.datasourceType.sapSystemName)",odataServiceUrlChoiceText:"Connect to an $t(prompts.datasourceType.odataServiceUrlName)",capProjectChoiceText:"Use a $t(prompts.datasourceType.capProjectName)",metadataFileChoiceText:"Upload a $t(prompts.datasourceType.metadataFileName)",notYetImplementedWarningMessage:"The selected data source type: {{ datasourceType }} is not yet implemented."},metadataFile:{message:"Metadata File Path",description:"Upload a metadata file",placeholder_odata_service_url:"/here/goes/your/serviceurl/"},capProject:{message:"Choose a CAP Project",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capProjectPath:{message:"CAP Project Folder Path",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capService:{message:"OData Service",description:"Select a local CAP service",breadcrumb:"CAP Service",enterCapPathChoiceName:"Manually select CAP service folder path"},odataServiceUrl:{message:"OData{{odataVersion, odataVersionFormatter}} service URL"},ignoreCertErrors:{message:"Do you want to continue generation with the untrusted certificate?"},serviceUsername:{message:"Service username"},servicePassword:{message:"Service password"},validationMessages:{odataVersionMismatch:"The template you have chosen supports V{{requiredOdataVersion}} OData services only. The provided version is V{{providedOdataVersion}}.",metadataInvalid:"The service metadata is invalid.",metadataFilePathNotValid:"The metadata file does not exist or is not accessible. Please specify a valid file path.",capProjectNotFound:"The folder you have selected does not contain a valid CAP project. Please check and try again.",warningCertificateValidationDisabled:"Certificate validation has been disabled by the user.",annotationsNotFound:"Annotations not found for the specified service.",backendSystemExistsWarning:'A saved system connection entry: "{{- backendName}}" already exists with the same URL and client. Please reuse the existing entry or remove it, using the systems panel, before adding a new connection.',systemUrlOriginOnlyWarning:"System URLs must only contain the hostname and may also include the port, for example, 'https://abc.com:123/'."},warnings:{nonUIServiceTypeWarningMessage:"Services of service type: {{serviceType}} or without a service type are not intended to be used for generating SAP Fiori UI applications.",noServicesAvailable:"There are no services available for the selected system. For more information, see the logs.",noServicesAvailableForOdataVersion:"There are no OData V{{odataVersion}} services available from the selected system and the template you have chosen only supports OData V{{odataVersion}} services.",noAnnotations:"No back-end annotations associated with this service were retrieved. This can result in an invalid application.",collaborativeDraftMessage:"The selected service is draft-enabled but does not support collaborative draft."},systemUrl:{message:"System URL",description:"Enter the URL of the SAP System",placeholder:"https://<host>:<port>"},sapClient:{message:"SAP client (leave empty for default)",breadcrumb:"SAP Client"},systemUsername:{message:"Username"},systemPassword:{message:"Password"},storeSystemCredentials:{message:"Do you want to store the system credentials?",breadcrumb:"Store Credentials"},systemService:{message:"Service",breadcrumb:"Service",noServicesWarning:"No services available for the selected system. For more information, see the logs."},newSystemType:{choiceAbapOnPrem:"ABAP On Premise",choiceAbapOnBtp:"ABAP Environment on SAP Business Technology Platform",choiceCFAbapEnvServiceOnBtp:"Cloud Foundry ABAP environment on SAP Business Technology Platform",message:"System Type",notYetImplementedWarningMessage:"The selected system type: {{ systemType }} is not yet implemented."},systemName:{message:"System name",hint:"Entering a system name will save the connection for re-use.",systemNameExistsWarning:"A system with that name already exists in the secure storage. Please try a different name.",reservedSystemNameWarning:"'{{ systemName }}' is a reserved system name. Please try a different name.",emptySystemNameWarning:"System name cannot be empty."},systemSelection:{newSystemChoiceLabel:"New System",hint:"Select a system configuration.",message:"System",authenticationFailedUpdateCredentials:"$t(texts.authenticationFailed). Please try updating the credentials."},abapOnBTPType:{message:"ABAP environment definition source",choiceReentranceTicket:"Use Reentrance Ticket",choiceServiceKey:"Upload a Service Key File",choiceCloudFoundry:"Discover a Cloud Foundry Service"},serviceKey:{message:"Service Key File Path",hint:"Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",incompleteServiceKeyInfo:"The service keys file does not contain the required information. Check the file is valid and try again.",unparseableServiceKey:"The service keys file does not contain a valid JSON format. Check the formatting and try again."},cloudFoundryAbapSystem:{message:"ABAP environment",hint:"Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."},destinationServicePath:{message:"Service Path",hint:"Enter the path to the OData service relative to the selected destination URL.",invalidServicePathWarning:"Please enter a valid service path"},mainEntitySelection:{message:"Main Entity",defaultEntityNameNotFoundWarning:"The supplied entity cannot be found in the service. Please choose from the list above.",noDraftEnabledEntitiesError:"The CAP service you have chosen does not have any entities that are draft enabled. To generate an OData V4 SAP Fiori application using this floorplan for a CAP project, the entity selected must be draft enabled.",mainEntityParameterFoundInfo:"The selected entity '{{entityName}}' requires a parameter which is set by the application filters. Navigation entities are not supported.",noEntitiesError:"$t(errors.noRelevantEntities)",noEntitiesAlpV4Error:"The OData V4 service you have provided is not suitable for use in an analytical list page application. The service must contain aggregate-based entities for this template.",requiredError:"Please select a main entity to continue."},navigationEntitySelection:{message:"Navigation Entity",choiceNone:"$t(texts.choiceNameNone)"},filterEntitySet:{message:"Filter Entity",noEntitiesError:"$t(errors.noRelevantEntities)"},pageBuildingBlock:{message:"Add a Page Building Block to the Application?",tooltip:"The Page building block is supported from SAPUI5 version {{ minUi5VersionForPageBuildingBlock }}. By choosing this option, you are restricting the minimum SAPUI5 version to {{ minUi5VersionForPageBuildingBlock }} and above.",titleMessage:"Page Title",layoutMessage:"Page Building Block Layout",choiceFull:"Full Layout",choiceBasic:"Basic Layout",basicLayoutWarning:"The Page building block is supported with SAPUI5 version {{ minUi5VersionForPageBuildingBlock }} and above.",fullLayoutWarning:"Full Layout is supported with SAPUI5 version {{ minUi5VersionForFullLayout }} and above."},tableType:{message:"Table Type",hint:"Defines the table type for the list report page.",requiredError:"Please select a table type to continue.",choiceNone:"$t(texts.choiceNameNone)",choiceGrid:"Grid",choiceAnalytical:"Analytical",choiceResponsive:"Responsive",choiceTree:"Tree",analyticalTableDefault:"The 'Analytical' table type is chosen by default because the selected entity supports it.",treeTableDefault:"The 'Tree' table type is chosen by default because the selected entity supports it.",responsiveTableInfo:"Only use the responsive table if the total number of items in the table doesn't exceed 200."},hierarchyQualifier:{message:"Hierarchy Qualifier",hint:"Leading property that decides between either a recursive hierarchy or data aggregation.",qualifierRequiredForV4Warning:"Hierarchy qualifier is required for OData V4 services."},addFEOPAnnotations:{message:"Automatically add a form to the generated application if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations"},addLineItemAnnotations:{message:"Automatically add table columns to the list page and a section to the object page if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations",valueHelpsAnnotationsInfoMessage:"Basic value helps will also be created."},presentationQualifier:{message:"Qualifier",hint:"Represents the qualifier of the `SelectionPresentationVariant`. The analytical list page looks for a `SelectionPresentationVariant` with this qualifier and if not found, it looks for a `PresentationVariant` with this qualifier."},tableSelectionMode:{message:"Selection Mode",hint:"Defines different selection modes for the `SmartTable` in the analytical list page.",choiceNone:"$t(texts.choiceNameNone)",choiceSingle:"Single",choiceAuto:"Auto",choiceMulti:"Multi"},tableMultiSelect:{message:"Allow Multi Select",hint:"Allows you to show a checkbox for selecting multiple items in a table. This setting comes into effect only if there are actions defined either by using an annotation or a setting in the `manifest.json` file."},tableAutoHide:{message:"Auto Hide",hint:"Determines the chart or table interaction. If set to `true`, the chart acts as a filter for the table. If set to `false`, the matching table rows are highlighted but the table is not filtered."},smartVariantManagement:{message:"Enable Smart Variant Management",hint:"Enables page level variant."},valueHelpDownload:{message:"The service contains references to value help services. Do you want to download the associated metadata during generation? This may increase generation time.",hint:"Download metadata for value help to improve the user experience with dropdowns and search."}},errors:{destination:{authError:"The selected system: {{systemName}} returned an authentication error: {{- error}}.",listDestinations:"An error occurred when retrieving the list of destinations: {{- error}}."},cannotReadCapServiceMetadata:"An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails).",capModelAndServicesLoadError:"An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",capServiceUrlPathNotDefined:"An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",unknownError:"An error occurred: {{- error, addMsgWithColonFormatter}}.",authenticationFailed:"$t(texts.authenticationFailed): {{error}}.",authenticationFailedSpecificCatalog:"{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",authenticationFailedAllCatalogs:"{{authFailType}}: Unable to access any service catalogs",invalidUrl:"Invalid URL: {{-input, addMsgWithColonFormatter}}.",connectionError:"A connection error occurred. Ensure the target host is available on the network: {{- error}}",urlNotFound:"URL not found.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",abapEnvsUnavailable:"ABAP environments unavailable.",systemOrServiceUrlNotFound:"Please verify the URL: {{- url}}, target system configuration and network connectivity.",urlRedirect:"The service URL is redirecting.",certValidationRequired:"Certificate validation is required to continue.",exitingGeneration:"Exiting generation. Exit: {{exitReason}}.",serviceMetadataError:"An error occurred when reading the service metadata for service: {{- servicePath}}. Error: {{errorText}}",serviceMetadataErrorUI:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" }) $t(texts.seeLogForDetails)',serviceMetadataErrorLog:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" })',serviceTypeRequestError:"An error occurred when retrieving the service type: {{- error}}.",abapServiceAuthenticationFailed:"ABAP environment authentication using UAA failed.",serviceCatalogRequest:"An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}: {{error}}.",storedSystemConnectionError:"An error occurred when validating the stored system connection info. System Name: {{-systemName}}. Error: {{- error}}.",noCatalogOrServiceAvailable:"No active system or OData service endpoint connection available to retrieve the server.",allCatalogServiceRequestsFailed:"All catalog service requests failed for the selected system. OData version: V{{version}}.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata.",unparseableXML:"Unparseable XML was specified: {{-error}}.",noRelevantEntities:"The template and service selected have no relevant entities that you can use.",cfInstanceCredentialsNotReturned:"Cannot not retrieve credentials to access: {{serviceInstanceName}}.",v2CatalogServiceNoAnnotations:"An error occurred when creating an OData V2 catalog service object. Annotations will not be available: {{-error}}",backendSystemRetrieval:"An error occurred when retrieving the backend systems from the store: {{-error}}"},warnings:{largeMetadataDocument:"The metadata for this OData service is very large. It may take some time before this operation completes.",warningCertificateValidationDisabled:"User has disabled certificate validation",nonUIServiceTypeWarningMessage:"Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",noServicesAvailable:"No services available for the selected system, see logs for further details.",noServicesAvailableForOdataVersion:"There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",noAnnotations:"No backend annotations associated with this service were retrieved and may result in an invalid application being created",collaborativeDraftMessage:"The selected service is draft enabled but does not support collaborative draft.",certificateErrors:"A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",allowingUnauthorizedCertsNode:"Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",certErrorIgnoredByNodeSetting:"An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",noExternalServiceMetdataFetched:"No external service metadata was fetched. $t(texts.seeLogForDetails)",missingServices:"OData V{{odataVersion}} services are not available.",specifiedServicesNotAvailable_one:"The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",specifiedServicesNotAvailable_other:"The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)",storedSystemUrlPathNotSupported:"The stored cloud system URL '{{- systemUrl}}' contains a path which is not supported for reentrance ticket authentication. The path is ignored for this connection."},texts:{suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, view the logs.",forUserName:"(for user [{{username}}])",httpStatus:"HTTP Status {{httpStatus}}",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration.",choiceNameNone:"None",passwordStoreWarning:"Passwords are stored in your operating system's credential manager and are protected by its security policies.",authorizationFailed:"Authorization failed",authenticationFailed:"Authentication failed"}};var aRn="odata-service-inquirer";var YQ=Dn.createInstance();async function cRn(){await YQ.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),YQ.services.formatter?.add("odataVersionFormatter",t=>t?` V${t}`:""),YQ.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),YQ.addResourceBundle("en",aRn,sRn),ECe(),lwe()}function Ze(t,e){return e?.ns||(e=Object.assign(e??{},{ns:aRn})),YQ.t(t,e)}cRn().catch(()=>{});var XQ;(function(t){t.sapSystem="sapSystem",t.capProject="capProject",t.odataServiceUrl="odataServiceUrl",t.none="none",t.metadataFile="metadataFile",t.projectSpecificDestination="projectSpecificDestination",t.businessHub="businessHub"})(XQ||(XQ={}));var pwe="sap-client";var rs;(function(t){t.datasourceType="datasourceType",t.metadataFilePath="metadataFilePath",t.capProject="capProject",t.capService="capService",t.serviceUrl="serviceUrl",t.serviceUrlPassword="serviceUrlPassword",t.serviceSelection="serviceSelection",t.userSystemName="userSystemName",t.systemSelection="systemSelection",t.valueHelpDownload="valueHelpDownload"})(rs||(rs={}));var $L=pe(vRn(),1),Mt=class t{static _logger=new vc({logPrefix:"@sap-ux/odata-service-inquirer"});static get logger(){return t._logger}static set logger(e){t._logger=e}static attachAxiosLogger(e){let r=typeof t.logger.getLogLevel=="function"&&t.logger.getLogLevel()==="trace",n=t.logger.debug.bind(t.logger);e.request.use(i=>(i.url||n(`Request URL: ${i.baseURL}`),$L.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>$L.errorLogger(i,{logger:n})),e.response.use(i=>$L.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>$L.errorLogger(i,{logger:n}))}};var Xt=class t{static odataService={};static isYUI=!1;static backendSystemsCache=[];static reset(){Object.keys(t.odataService).forEach(e=>{t.odataService[e]=void 0})}static resetConnectedSystem(){t.odataService.connectedSystem=void 0}};var ORn=pe(VC(),1),CRn=pe(yD(),1),N_t=pe(ARn(),1);function ed(){return Xt.isYUI?Si()?mo.bas:mo.vscode:mo.cli}function PRn(t){try{let e=(0,ORn.convert)((0,CRn.parse)(t)),r=Number.parseInt(e?.version,10);if(Number.isNaN(r))throw Mt.logger.error(Ze("errors.unparseableOdataVersion")),new Error(Ze("errors.unparseableOdataVersion"));return{odataVersion:r===4?$s.v4:$s.v2,convertedMetadata:e}}catch(e){throw Mt.logger.error(e),new Error(Ze("prompts.validationMessages.metadataInvalid"))}}function XC(t){if(t)return t===$s.v2?xn.v2:xn.v4}function Ewe(t){if(t?.length===1)return 0}function JC(t){for(let e in t.services)t.services?.[e].log&&(t.services[e].log=(0,N_t.removeSync)(t.services[e]?.log,{setUndefined:!0}));return t.log&&(t.log=(0,N_t.removeSync)(t.log,{setUndefined:!0})),t}function mH(t,e,r){let n=new af({url:e,client:r}).getId();return t.find(i=>af.from(i).getId()===n)}function xRn(t,e){return!t&&!e||t?.length===0&&e?.length===0||t===e?!0:!t||!e?!1:[...t].sort().toString()===[...e].sort().toString()}var Ci=new Oo(void 0,void 0,"@sap-ux/odata-service-inquirer");var I_t;(function(t){t.capProjectPath="capProjectPath",t.capCliStateSetter="capCliStateSetter"})(I_t||(I_t={}));function vwe(t,e){try{let{convertedMetadata:r,odataVersion:n}=PRn(t);if(e&&e!==n){let i=Ze("prompts.validationMessages.odataVersionMismatch",{providedOdataVersion:n,requiredOdataVersion:e});return Mt.logger.error(i),{validationMsg:i}}return{version:n,convertedMetadata:r}}catch(r){return{validationMsg:r.message}}}var H_t=require("@sap-devx/yeoman-ui-types");var wRn=new Set([Me.CERT_SELF_SIGNED,Me.CERT_SELF_SIGNED_CERT_IN_CHAIN,Me.CERT_EXPIRED,Me.CERT_UKNOWN_OR_INVALID,Me.INVALID_SSL_CERTIFICATE]),$_=class{validity={};_validatedUrl;_destinationUrl;_destination;_validatedClient;_odataService;_serviceProvider;_axiosConfig;_catalogV2;_catalogV4;_systemAuthType;_serviceInfo;_connectedUserName;_connectedSystemName;_refreshToken;_ignoreCertError;_connectType="abap_catalog";get ignoreCertError(){return this._ignoreCertError}get axiosConfig(){return this._axiosConfig}get odataService(){return this._odataService}get catalogs(){return{[xn.v2]:this._catalogV2,[xn.v4]:this._catalogV4}}get serviceProvider(){return this._serviceProvider}get systemAuthType(){return this._systemAuthType}set systemAuthType(e){this._systemAuthType=e}get validatedUrl(){return this._validatedUrl}get validatedClient(){return this._validatedClient}get serviceInfo(){return this._serviceInfo}set serviceInfo(e){this._serviceInfo=e}get connectedUserName(){return this._connectedUserName}get refreshToken(){return this._refreshToken}get destinationUrl(){return this._destinationUrl}get destination(){return this._destination}get connectType(){return this._connectType}get connectedSystemName(){return this._connectedSystemName?this._connectedSystemName:this.systemAuthType==="serviceKey"?this.serviceInfo?.systemid:this.validatedUrl}set connectedSystemName(e){this._connectedSystemName=e}setConnectedSystem({serviceProvider:e,backendSystem:r}){if(!e.catalog){Mt.logger.debug("ConnectionValidator.setConnectedSystem(): Use of a cached connected system is only supported for AbapServiceProviders. Re-authorization will be required.");return}this._serviceProvider=e,this._catalogV2=this._serviceProvider.catalog(xn.v2),this._catalogV4=this._serviceProvider.catalog(xn.v4),this._validatedUrl=r?.serviceKeys?.url??r?.url,this._connectedUserName=r?.userDisplayName,this._validatedClient=r?.client,this._refreshToken=r?.refreshToken,this._serviceInfo=r?.serviceKeys,this.validity.authenticated=!0,this.validity.reachable=!0,this.validity.urlFormat=!0,this.validity.authRequired=!0,r?.authenticationType==="reentranceTicket"?this.systemAuthType="reentranceTicket":r?.serviceKeys?this.systemAuthType="serviceKey":this.systemAuthType="basic"}async checkUrl(e,r,n,{ignoreCertError:i=!1,isSystem:o=!1,odataVersion:s,connectType:a}={}){let c=Si();try{e.pathname=e.pathname?.endsWith("/")?e.pathname:`${e.pathname}/`,i===!0&&$j(!i),c&&e.searchParams.append("saml2","disabled");let u=this.createAxiosConfig(e,i,r,n);if(o){if(await this.createSystemConnection({axiosConfig:u,url:e,odataVersion:s,connectType:a}),a!=="odata_path"){let l=await this.serviceProvider.getSystemInfo();this._connectedUserName=l?.userName,this._connectedSystemName=l?.systemID}}else await this.createOdataServiceConnection(u,e.pathname);return this._validatedClient=e.searchParams.get(pwe)??void 0,200}catch(u){if(Mt.logger.debug(`ConnectionValidator.checkUrl() - error: ${u.message}`),u?.isAxiosError){if(u?.response?.status.toString().match(/5\d\d/)&&c)throw u;return u?.response?.status||u?.code}else throw u}}createAxiosConfig(e,r,n,i){let o={params:Object.fromEntries(e.searchParams),ignoreCertErrors:r,cookies:"",baseURL:e.origin,url:e.pathname,logger:Mt.logger};return n&&i&&(o=Object.assign(o,{auth:{username:n,password:i}})),o}async createOdataServiceConnection(e,r){await this.shouldIgnoreCertError(e)&&(this._ignoreCertError=!0,e.ignoreCertErrors=!0,$j(!1)),this._axiosConfig=e,this._serviceProvider=b3t(this._axiosConfig),this._odataService=this._serviceProvider.service(r),this._connectType="odata_path",Mt.attachAxiosLogger(this._serviceProvider.interceptors),await this._odataService.get("")}resetConnectionState(e=!1){this._serviceProvider=void 0,this._odataService=void 0,this._catalogV2=void 0,this._catalogV4=void 0,this._serviceInfo=void 0,this._connectedUserName=void 0,this._refreshToken=void 0,this._connectedSystemName=void 0,this._ignoreCertError=void 0,this._connectType="abap_catalog",e&&this.resetValidity(),Ci.resetErrorState()}async shouldIgnoreCertError(e,r){Mt.logger.debug(`ConnectionValidator.shouldIgnoreCertError() - url: ${e.baseURL}`);let n=!1;if(process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")try{let o=!r||r===xn.v2?xn.v2:xn.v4,s=GN(e);Mt.attachAxiosLogger(s.interceptors),await s.catalog(o).listServices()}catch(o){let s=Oo.getErrorType(o?.response?.status??o?.code);o?.isAxiosError&&wRn.has(s)&&(Mt.logger.warn(Ze("warnings.certificateErrors",{url:e?.baseURL,error:s})),Mt.logger.warn(Ze("warnings.allowingUnauthorizedCertsNode")),n=!0)}return n}async createSystemConnection({axiosConfig:e,url:r,serviceInfo:n,destination:i,odataVersion:o,connectType:s=this._connectType}){if(this.resetConnectionState(!0),this.systemAuthType==="reentranceTicket"||this.systemAuthType==="serviceKey")this._serviceProvider=this.getAbapOnCloudServiceProvider(r,n);else if(i){let a=r?r.pathname:void 0;this._validatedUrl=LU(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=A3t({},i)}else e&&(await this.shouldIgnoreCertError(e,o)&&(this._ignoreCertError=!0,e.ignoreCertErrors=!0,$j(!1)),this._axiosConfig=e,this._serviceProvider=GN(e));if(this._serviceProvider&&Mt.attachAxiosLogger(this._serviceProvider.interceptors),s==="abap_catalog"){(!o||o===xn.v2)&&(this._catalogV2=this._serviceProvider.catalog(xn.v2)),(!o||o===xn.v4)&&(this._catalogV4=this._serviceProvider.catalog(xn.v4));let a=!1;try{this._catalogV2?await this._catalogV2?.listServices():this._catalogV4&&(a=!0,await this._catalogV4?.listServices())}catch(c){await this.handleCatalogError(c,a)}}else s==="odata_path"&&r&&(Mt.logger.debug(`Using provided url path: ${r.pathname} to validate authentication.`),this._connectType="odata_path",this._odataService=this._serviceProvider.service(`${r?.pathname}`),await this._odataService.get(""))}async handleCatalogError(e,r){let n=e.response?.status,i=n?Oo.getErrorType(n):void 0,o=n&&!r&&(i===Me.NOT_FOUND||i===Me.AUTH);if(this._catalogV4&&o){this._axiosConfig&&await this.shouldIgnoreCertError(this._axiosConfig,xn.v4)&&(this._ignoreCertError=!0,$j(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=GN(this._axiosConfig),this._catalogV4=this._serviceProvider.catalog(xn.v4),Mt.attachAxiosLogger(this._serviceProvider.interceptors));try{await this._catalogV4.listServices()}catch(s){throw i===Me.AUTH?e:s}}else throw e}async refreshTokenChangedCb(e){Mt.logger.debug("ConnectionValidator.refreshTokenChangedCb()"),this._refreshToken=e}getAbapOnCloudServiceProvider(e,r,n){if(this.systemAuthType==="reentranceTicket"&&e)return NVe({environment:qN.EmbeddedSteampunk,url:e.origin,logger:Mt.logger});if(this.systemAuthType==="serviceKey"&&r)return NVe({environment:qN.Standalone,service:r,refreshToken:n,refreshTokenChangedCb:this.refreshTokenChangedCb.bind(this),logger:Mt.logger});throw new Error("Invalid system auth type")}async validateServiceInfo(e,r){if(!e)return!1;if(e.url===this.validatedUrl&&JSON.stringify(e.uaa)===JSON.stringify(this.serviceInfo?.uaa))return this.getValidationResultFromStatusCode(200);try{return this.systemAuthType="serviceKey",await this.createSystemConnection({serviceInfo:e,odataVersion:r}),this._connectedUserName=await this.serviceProvider.user(),this._serviceInfo=e,this._validatedUrl=e.url,this.getValidationResultFromStatusCode(200)}catch(n){return Mt.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${n.message}`),n?.isAxiosError&&this.getValidationResultFromStatusCode(n?.response?.status||n?.code),Ci.getErrorMsg(n)??!1}}async validateDestination(e,r,n){try{if(this.systemAuthType=e.Authentication===$T.NO_AUTHENTICATION?"basic":"unknown",DP(e)||bE(e))return await this.validateOdataServiceDestination(e,n);{let i;if(n){let o=LU(e.Name.toLowerCase(),n);i=new URL(o)}await this.createSystemConnection({destination:e,odataVersion:r,url:i,connectType:i?"odata_path":void 0})}return{valResult:this.getValidationResultFromStatusCode(200)}}catch(i){i?.isAxiosError&&this.getValidationResultFromStatusCode(i?.response?.status||i?.code);let o=Ci.logErrorMsgs(i);return{valResult:Ci.getValidationErrorHelp(i,!1,e)??o,errorType:Ci.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(e,r,n){this.resetConnectionState(!0);let i=LU(e.Name.toLowerCase(),r);this._destinationUrl=r?i.replace(`https://${e.Name.toLowerCase()}.dest`,e.Host.replace(/\/{1,10}$/,"")):e.Host,this._destination=e;let o=await this.checkUrl(new URL(i),void 0,void 0,{odataVersion:n}),s=this.getValidationResultFromStatusCode(o);if(this.validity.reachable&&(this._validatedUrl=i),!this.validity.reachable){let a=Ci.logErrorMsgs(o);return{valResult:Ci.getValidationErrorHelp(o,!1,e)??a,errorType:Ci.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:Oo.getErrorMsgFromType(Me.AUTH,e.Authentication!==$T.NO_AUTHENTICATION?Ze("texts.checkDestinationAuthConfig"):void 0),errorType:Me.AUTH}:{valResult:s}}async validateUrl(e,{ignoreCertError:r=!1,forceReValidation:n=!1,isSystem:i=!1,odataVersion:o,systemAuthType:s,connectType:a}={}){if(this.isEmptyString(e))return this.resetValidity(),this.validity.urlFormat=!1,!1;s&&(this.systemAuthType=s);let c;try{if(c=new URL(e),c.origin==="null")return Ze("errors.invalidUrl",{input:e});if(a!=="odata_path"&&(this.systemAuthType==="reentranceTicket"||i)&&!(c.pathname.length===0||c.pathname==="/"))return Ze("prompts.validationMessages.systemUrlOriginOnlyWarning")}catch{return Ze("errors.invalidUrl",{input:e})}try{if(!n&&this.isUrlValidated(e))return this.validity.reachable??!1;this.resetValidity();let u=await this.checkUrl(c,void 0,void 0,{ignoreCertError:r,isSystem:i,odataVersion:o,connectType:a});return Mt.logger.debug(`ConnectionValidator.validateUrl() - status: ${u}; url: ${e}`),this.validity.urlFormat=!0,this._validatedUrl=e,this.getValidationResultFromStatusCode(u)}catch(u){return this.resetValidity(),Oo.getErrorType(u)===Me.CONNECTION?(this.validity.reachable=!1,Ci.logErrorMsgs(Ze("errors.systemOrServiceUrlNotFound",{url:e}))):Ci.getErrorMsg(u)??u.message}}getValidationResultFromStatusCode(e){return e===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):Oo.getErrorType(e)===Me.NOT_FOUND?(this.validity.reachable=!1,Oo.getErrorMsgFromType(Me.NOT_FOUND)??!1):Oo.isCertError(e)?(this.validity.reachable=!0,this.validity.canSkipCertError=wRn.has(Oo.getErrorType(e)),this.validity.authenticated=!1,Ci.getValidationErrorHelp(e,!1)??!1):Oo.getErrorType(e)===Me.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):Oo.getErrorType(e)===Me.REDIRECT?(this.validity.reachable=!0,Ze("errors.urlRedirect")):Oo.getErrorType(e)===Me.CONNECTION?(this.validity.reachable=!1,Oo.getErrorMsgFromType(Me.CONNECTION,Ze("texts.httpStatus",{httpStatus:e}))??!1):Oo.getErrorType(e)===Me.BAD_REQUEST?(this.validity.reachable=!0,Oo.getErrorMsgFromType(Me.BAD_REQUEST,Ze("texts.httpStatus",{httpStatus:e}))??!1):Oo.getErrorType(e)===Me.BAD_GATEWAY?(this.validity.reachable=!1,Oo.getErrorMsgFromType(Me.BAD_GATEWAY,Ze("texts.httpStatus",{httpStatus:e}))??!1):(this.validity.reachable=!0,Oo.getErrorMsgFromType(Oo.getErrorType(e),Ze("texts.httpStatus",{httpStatus:e}))??!0)}isEmptyString(e){return!e||e.trim().length===0}isUrlValidated(e){return this._validatedUrl===e}async isAuthRequired(){return Mt.logger.debug(`ConnectionValidator.isAuthRequired() - validity: ${JSON.stringify(this.validity)}`),!this._validatedUrl||this.validity.authenticated?!1:this.validity.authRequired}async validateAuth(e,r,n,{ignoreCertError:i=!1,sapClient:o,odataVersion:s,isSystem:a=!1,connectType:c}={}){if(!e)return{valResult:!1};try{let u=new URL(e);o&&u.searchParams.append(pwe,o),this.systemAuthType="basic";let l=await this.checkUrl(u,r,n,{ignoreCertError:i,isSystem:a,odataVersion:s,connectType:c});Mt.logger.debug(`ConnectionValidator.validateAuth() - status: ${l}; url: ${e}`),this.validity.urlFormat=!0,this._validatedUrl=e;let p=this.getValidationResultFromStatusCode(l);if(p===!0){if(this.validity.authenticated===!0)return this._connectedUserName=r,{valResult:!0};if(this.validity.authenticated===!1)return{valResult:this.getAuthFailureReasonText(l,s),errorType:Me.AUTH}}return{valResult:p}}catch(u){return{valResult:Ci.getValidationErrorHelp(u,!1,this.destination)??Ci.getErrorMsg(u)??Ze("errors.unknownError"),errorType:Ci.getCurrentErrorType()??void 0}}}resetValidity(){delete this.validity.urlFormat,delete this.validity.reachable,delete this.validity.authRequired,delete this.validity.authenticated,delete this.validity.canSkipCertError,this._validatedUrl=void 0,this._destinationUrl=void 0,this._destination=void 0}getAuthFailureReasonText(e,r){let n;[403,"403"].includes(e)?n=Ze("texts.authorizationFailed"):[401,"401"].includes(e)&&(n=Ze("texts.authenticationFailed"));let i;return r?i=Ze("errors.authenticationFailedSpecificCatalog",{odataVersion:r,authFailType:n}):i=Ze("errors.authenticationFailedAllCatalogs",{authFailType:n}),i}};var HRn=pe(Ooe(),1);var WD={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var qaa="VALUE_HELP_DOWNLOAD_PROMPTED",Gaa="VALUE_HELP_DOWNLOAD_SUCCESS",Haa="VALUE_HELP_DOWNLOAD_FAILED";async function M_t(t,e,r){let n=oL.createTelemetryData(e)??{};if(r&&Object.keys(r).length>0){let i=jOn();i&&await i.reportEvent({eventName:t,properties:n,measurements:r},lc.NoSampling)}else OL(t,n)}async function DRn(t,e,r){if(delete Xt.odataService.valueListMetadata,await M_t(qaa,{userChoseToDownload:t}),t&&e.serviceProvider instanceof zf){let n=Date.now();try{let i=await e.serviceProvider.fetchExternalServices(r),o=Date.now()-n;i.length>0?Xt.odataService.valueListMetadata=i:Mt.logger.info(Ze("warnings.noExternalServiceMetdataFetched")),await M_t(Gaa,{userChoseToDownload:!0,valueHelpCount:i.length},{downloadTimeMs:o})}catch(i){let o=Date.now()-n;Mt.logger.error(`Failed to fetch external service metadata: ${i}`),await M_t(Haa,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:o})}}}function RRn(t,e,r){let n=`${e?e+":":""}`,i=`${n}${rs.valueHelpDownload}`,o=`${n}${rs.serviceSelection}`,s=`${n}cliValueHelpDownload`,a,u=[{when:l=>{let d=l?.[o]?.servicePath;return d&&r?.convertedMetadata?(a=YJ(d,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:Ze("prompts.valueHelpDownload.message"),validate:async l=>(ed()!==mo.cli&&await DRn(l,t,a),!0)}];return ed()===mo.cli&&u.push({when:async l=>{let p=l?.[i];return p!==void 0&&a&&await DRn(p,t,a),!1},name:s,type:"input"}),u}var YD=require("@sap-devx/yeoman-ui-types");var Kaa=pe(VC(),1),Waa=pe(yD(),1);function NRn(t){return t.filter(e=>!!e.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var IRn=pe(VC(),1),MRn=pe(yD(),1);function Yaa(t){return!!t.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function L_t(t){let e=!1;try{let r;typeof t=="string"?r=(0,IRn.convert)((0,MRn.parse)(t)):r=t;let n=NRn(r.entitySets)??[];n?.length>0&&(e=!Yaa(n))}catch(r){Mt.logger.error(Ze("errors.unparseableMetadata",{error:r.message}))}return e}var Xaa=["/IWBEP/COMMON"],Jaa="SERVICE_INQUIRER_BAS_SUCCESS",Qaa=t=>{let e=[],r=!1;return typeof Mt.logger.getLogLevel=="function"&&(r=Mt.logger.getLogLevel()==="trace"),t?.filter(n=>!Xaa.some(i=>n.id.includes(i))).forEach(n=>{let i=n.name,o=n.path;i=`${i} (${n.serviceVersion}) - OData V${n.odataVersion}`,r&&(i=`${i} Service Type: ${n.serviceType}`),e.push({name:i,value:{servicePath:o,serviceODataVersion:n.odataVersion,toString:()=>i,serviceType:n.serviceType,serviceId:n.id}})}),Mt.logger.debug(`Number of unique service choices: ${e.length}`),e.sort((n,i)=>n.name?n.name.localeCompare(i.name??""):0)};function Zaa(t,e){let r=Object.entries(t);r.forEach(([n,i])=>{Ci.logErrorMsgs(i,Ze("warnings.missingServices",{odataVersion:n}))}),e===r.length&&Ci.logErrorMsgs(Ze("errors.allCatalogServiceRequestsFailed",{version:Object.keys(t).join(", ")}))}async function LRn(t,e){let r={},n={},i=[];for(let s of t){let a=s instanceof gP?xn.v2:xn.v4;try{let c=Date.now(),u=await s.listServices(),l=Date.now(),p=l-c===0?"<1 ms":`${l-c}ms`;n[`v${a}`]={serviceCount:u.length,duration:p},Mt.logger.debug(`Number of service${a===xn.v4?" groups":"s"}: ${u.length} returned in: ${p}}`),i.push(u)}catch(c){Mt.logger.error(Ze("errors.serviceCatalogRequest",{catalogRequestUri:s.getUri(),entitySet:s.entitySet,error:c})),Object.assign(r,{[a]:c}),i.push([])}}Mt.logger.debug(`Service catalog request times: ${JSON.stringify(n,void 0," ")}`);let o=i?.flat()??[];return Mt.logger.debug(`Number of services available: ${o.length}`),(o.length===0||Object.keys(r).length>0)&&Zaa(r,t.length),e&&(o=o.filter(s=>e.includes(s.id)||e.includes(s.path))),Qaa(o)}function k_t(t){let e=oL.createTelemetryData({destODataType:ACe(t)})??{};OL(Jaa,e)}async function eca(t,e,r,n,i){let o=[];try{let s=await e.metadata(),{validationMsg:a,version:c,convertedMetadata:u}=vwe(s,i);if(a)return{validationMsg:a};if(!r&&c===$s.v2&&n)try{Mt.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=GN(n).catalog(xn.v2),Mt.attachAxiosLogger(r.interceptors)}catch(l){Mt.logger.warn(Ze("error.v2CatalogServiceNoAnnotations",l))}if(r)try{o=await r.getAnnotations({path:t})}catch{Mt.logger.info(Ze("prompts.validationMessages.noAnnotations"))}return{annotations:o,metadata:s,version:c,convertedMetadata:u}}catch(s){let a=Ci.getErrorMsg(s);return Mt.logger.error(Ze("errors.serviceMetadataErrorLog",{servicePath:t,errorText:a})),{validationMsg:Ze("errors.serviceMetadataErrorUI",{servicePath:t,errorText:a})}}}async function tca(t,e,r){let n;if(e===O4.NotDetermined)try{n=await r.getServiceType(t)??O4.NotDetermined}catch(i){Mt.logger.error(Ze("errors.serviceTypeRequestError",{error:i.message}))}return n??e}async function F_t(t,e,r){let n=e.catalogs?.[t.serviceODataVersion];if(!e.serviceProvider)return Mt.logger.error("ConnectionValidator connection is not initialized"),{validationResult:!1};let i=e.odataService;i||(i=e.serviceProvider.service(t.servicePath));let{validationMsg:o,version:s,convertedMetadata:a,annotations:c,metadata:u}=await eca(t.servicePath,i,n,e.axiosConfig,r);if(o)return{validationResult:o};let l=e.destinationUrl??e.validatedUrl,p;return l&&(p=new URL(l).origin),Xt.odataService.annotations=c,Xt.odataService.metadata=u,Xt.odataService.odataVersion=s??(t.serviceODataVersion===xn.v2?$s.v2:$s.v4),Xt.odataService.servicePath=t.servicePath,Xt.odataService.serviceId=t.serviceId,Xt.odataService.origin=p,Xt.odataService.sapClient=e.validatedClient,Xt.odataService.ignoreCertError=e.ignoreCertError,{validationResult:!0,hasAnnotations:!!Xt.odataService.annotations&&Xt.odataService.annotations.length>0,convertedMetadata:a}}function kRn(t){let e=Ze("prompts.systemService.message");return t&&(e=e.concat(` ${Ze("texts.forUserName",{username:t})}`)),e}async function FRn(t,e,r,{requiredOdataVersion:n,hasAnnotations:i=!0,showCollabDraftWarnOptions:o,serviceFilter:s}){if(t?.length===0)return s&&s.length>0?{message:Ze("warnings.specifiedServicesNotAvailable",{odataVersion:n?`V${n} `:void 0,service:s[0],count:s.length}),severity:YD.Severity.warning}:n?{message:Ze("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:YD.Severity.warning}:{message:Ze("warnings.noServicesAvailable"),severity:YD.Severity.warning};if(e){let a=e.serviceType;if(e.serviceODataVersion===xn.v2){if(!i)return{message:Ze("warnings.noAnnotations"),severity:YD.Severity.warning};a=await tca(e.servicePath,e.serviceType,r.catalogs[xn.v2])}else if(o?.showCollabDraftWarning&&e.serviceODataVersion===xn.v4&&L_t(o.edmx))return{message:Ze("warnings.collaborativeDraftMessage"),severity:YD.Severity.warning};if(a&&a!==O4.UI)return{message:Ze("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:YD.Severity.warning}}else if(Ci.getErrorMsg())return{message:`${Ci.getErrorMsg()} ${Ze("texts.seeLogForDetails")}`,severity:YD.Severity.information}}var rca="cliServiceSelection";function XD(t,e,r,n=!0){let i=[],o,s,a,c,u,l={convertedMetadata:void 0},p=r?.requiredOdataVersion,d=`${e}:${rs.serviceSelection}`,h={when:()=>t.validity.authenticated||t.validity.authRequired===!1,name:d,type:r?.useAutoComplete?"autocomplete":"list",message:()=>kRn(t.connectedUserName),guiOptions:{breadcrumb:Ze("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(m,_)=>gG(_,i),choices:async m=>{if(i.length===0||o!==t.validatedUrl||s!==t.validatedClient||!xRn(c,r?.serviceFilter))if(t.catalogs[$s.v2]||t.catalogs[$s.v4])i=await nca(t.catalogs,p,r?.serviceFilter),o=t.validatedUrl,s=t.validatedClient,c=r?.serviceFilter?[...r.serviceFilter]:void 0,m?.[`${rs.systemSelection}`]?.type==="destination"&&k_t(m?.[`${rs.systemSelection}`]?.system);else if(t.odataService&&t.validatedUrl&&!await t.isAuthRequired()){let _=new URL(t.destinationUrl??t.validatedUrl);i=[{name:_.toString(),value:{servicePath:_.pathname}}],m?.[`${rs.systemSelection}`]?.type==="destination"&&k_t(m?.[`${rs.systemSelection}`]?.system)}else Mt.logger.error(Ze("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:m=>FRn(i,m,t,{requiredOdataVersion:p,hasAnnotations:u,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>Ewe(i),validate:async m=>{let _=m;if(r?.useAutoComplete&&m.value&&(_=m.value),!t.validatedUrl)return!1;if(i.length===0&&Ci.hasError())return Oo.getHelpForError(Me.SERVICES_UNAVAILABLE)??!1;if(_&&(a?.servicePath!==_.servicePath||a?.servicePath!==Xt.odataService.servicePath)){u=void 0,l.convertedMetadata=void 0,a=_;let v=await F_t(_,t,p);return u=v.hasAnnotations,l.convertedMetadata=v.convertedMetadata,v.validationResult}return!0}};if(r?.additionalMessages){let m={[d]:{additionalMessages:r.additionalMessages}};h=_mt([h],m,Xt.odataService)[0]}let f=[h];return ed()===mo.cli&&!r?.useAutoComplete&&f.push({when:async m=>{let _=m?.[`${e}:${rs.serviceSelection}`];if(_&&t.validatedUrl){let{validationResult:v,hasAnnotations:b,convertedMetadata:S}=await F_t(_,t);if(typeof v=="string")throw Mt.logger.error(v),new Error(v);u=b,l.convertedMetadata=S}if(i.length===0&&Ci.hasError()){let v=Oo.getHelpForError(Me.SERVICES_UNAVAILABLE).toString();throw new Error(v)}return!1},name:`${e}:${rca}`}),n||f.push(...pl(RRn(t,e,l),m=>t.serviceProvider instanceof zf&&!!l.convertedMetadata&&m?.[d]?.serviceODataVersion===xn.v4)),f}async function nca(t,e,r){let n=[];return e&&t[e]?n.push(t[e]):n=Object.values(t).filter(i=>i!==void 0),await LRn(n,r)}var VRn=require("@sap-devx/yeoman-ui-types");var U_t=require("@sap-devx/yeoman-ui-types");var Og;(function(t){t.systemUsername="systemUsername",t.systemPassword="systemPassword",t.storeSystemCredentials="storeSystemCredentials"})(Og||(Og={}));function Twe(t,e,r,n){let i=`${e?e+":":""}${Og.systemUsername}`,o=`${e?e+":":""}${Og.systemPassword}`,s=`${e?e+":":""}${Og.storeSystemCredentials}`,a,c=[{when:async()=>(a=await t.isAuthRequired(),t.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"input",name:i,message:Ze("prompts.systemUsername.message"),guiOptions:{mandatory:!0},default:"",validate:l=>l?.length>0},{when:()=>!!(t.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"password",guiOptions:{mandatory:!0,applyDefaultWhenDirty:!0},guiType:"login",showOutputTabLink:"validationMessageOverflow",name:o,message:Ze("prompts.systemPassword.message"),mask:"*",default:"",validate:async(l,p)=>{if(!(t.validatedUrl&&p?.[i]&&l&&(!r||r.isValid)))return!1;let d=p?.[rs.systemSelection],h,f=!0;if(d?.type==="backendSystem")h=d.system?.client;else if(d?.type==="destination"){let _=d.system;(DP(_)||bE(_))&&(f=!1)}let{valResult:m}=await t.validateAuth(t.validatedUrl,p?.[i],l,{sapClient:r?.sapClient||h,isSystem:f,odataVersion:XC(n)});return m===!0&&t.serviceProvider?(ica(t.serviceProvider,d,{username:p?.[i],password:l}),!0):m},additionalMessages:(l,p)=>{if(t.ignoreCertError&&p?.newSystemType!=="abapOnPrem")return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:U_t.Severity.warning}}}],u={when:l=>!!(t.systemAuthType==="basic"&&a&&t.validity.authenticated&&l[o]),type:"confirm",name:s,message:Ze("prompts.storeSystemCredentials.message"),default:!1,guiOptions:{breadcrumb:Ze("prompts.storeSystemCredentials.breadcrumb")},validate:async l=>{if(Xt.odataService.connectedSystem?.backendSystem){let p=Xt.odataService.connectedSystem.backendSystem;Xt.odataService.connectedSystem.backendSystem=Object.assign(p,{newOrUpdated:l})}return!0},additionalMessages:l=>{if(l===!0)return{message:Ze("texts.passwordStoreWarning"),severity:U_t.Severity.warning}}};return Si()||c.push(u),c}function ica(t,e,{username:r,password:n}){if(Xt.odataService.connectedSystem={serviceProvider:JC(t)},e?.type==="backendSystem"){let i=e.system;(i.username!==r||i.password!==n)&&(Xt.odataService.connectedSystem.backendSystem=Object.assign(i,{username:r,password:n,userDisplayName:r}))}else e?.type==="destination"&&(Xt.odataService.connectedSystem.destination=e.system)}async function ZQ(t){return t?await cpt(t)?Ze("prompts.systemName.systemNameExistsWarning"):!0:Ze("prompts.systemName.emptySystemNameWarning")}function URn(t,e){try{return new URL(e,t),!0}catch{return Ze("errors.invalidUrl",{input:`${t}${e}`})}}async function $Rn(t,e){let r=t+(e?Ze("texts.suggestedSystemNameClient",{client:e}):"");return await ZQ(r)===!0?r:oca(r)}async function oca(t){let e=1,r=`${t} (${e})`;for(;await ZQ(r)!==!0;)r=`${t} (${e})`,e++;return r}function sca(t){switch(t){case"serviceKey":return ZX.ReentranceTicket;case"reentranceTicket":return ZX.ReentranceTicket;case"basic":return ZX.Basic;default:return}}function Swe(t,e,r,n,i=!0){return{type:"input",name:`${e?e+":":""}${WD.newSystemUrl}`,message:Ze("prompts.systemUrl.message"),guiOptions:{hint:Ze("prompts.systemUrl.description"),mandatory:!0,breadcrumb:!0},validate:async a=>{if(Xt.resetConnectedSystem(),n&&n.backendSystem?.url===a&&n.backendSystem?.authenticationType==="reentranceTicket")t.setConnectedSystem(n);else if(i){let u=mH(Xt.backendSystemsCache,a);if(u)return Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:u.name})}let c=await t.validateUrl(a,{isSystem:!0,odataVersion:XC(r),forceReValidation:!0});return c===!0&&(t.validity.authenticated&&t.serviceProvider?Xt.odataService.connectedSystem={serviceProvider:JC(t.serviceProvider)}:t.systemAuthType="basic"),c},additionalMessages:()=>{if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:VRn.Severity.warning}}}}function bwe(t,e){let r,n=!1,i=`${e?e+":":""}`,o=`${i}${rs.userSystemName}`;return{type:"input",guiOptions:{hint:Ze("prompts.systemName.hint"),applyDefaultWhenDirty:!0,breadcrumb:!0,mandatory:!0},name:o,message:Ze("prompts.systemName.message"),default:async()=>{let a=t.connectedSystemName;return a&&!n&&(r=await $Rn(a,t.validatedClient)),r},validate:async(a,c)=>{if(!a)return!1;let u=!1;a===r?u=!0:(n=!0,r=a,u=await ZQ(a));let l=!!c?.[`${i}${Og.storeSystemCredentials}`];if(u===!0&&t.validatedUrl&&Xt.odataService.connectedSystem){let p=new ha({authenticationType:sca(t.systemAuthType),name:a,url:t.validatedUrl,client:t.validatedClient,username:l?t.axiosConfig?.auth?.username:void 0,password:l?t.axiosConfig?.auth?.password:void 0,serviceKeys:t.serviceInfo,userDisplayName:t.connectedUserName,systemType:eJ({serviceKeys:t.serviceInfo,authenticationType:t.systemAuthType}),connectionType:"abap_catalog"});Xt.odataService.connectedSystem.backendSystem=p,Xt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return u}}}async function $_t(){return await xC({entityName:"system"})}async function BRn(t=!1,e){let r=[];try{r=await(await $_t()).getAll({includeSensitiveData:t,backendSystemFilter:e??{connectionType:["abap_catalog","odata_service"]}})}catch(n){Mt.logger.error(Ze("errors.backendSystemRetrieval",{error:n.message}))}return r}var V_t="!@\xA3*&937newSystem*X~qy^",Awe="cfAbapEnvService";async function jRn(t,e,r,n,i){Xt.resetConnectedSystem();let o=!1,a=await(await $_t()).read(t);if(a){n&&n.backendSystem?.url===a.url&&e.setConnectedSystem(n);let c=new URL(a.url),u=c.origin;if(i&&(u=new URL(i,c.origin).toString()),a.authenticationType==="reentranceTicket")c.pathname!=="/"&&Mt.logger.warn(Ze("warnings.storedSystemUrlPathNotSupported",{systemUrl:a.url})),o=await e.validateUrl(u,{isSystem:!0,odataVersion:XC(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":"abap_catalog"});else if(a.serviceKeys)o=await e.validateServiceInfo(a.serviceKeys,XC(r));else if(a.authenticationType==="basic"||!a.authenticationType){let l;if({valResult:o,errorType:l}=await e.validateAuth(u,a.username,a.password,{isSystem:!0,odataVersion:XC(r),sapClient:a.client,connectType:i?"odata_path":"abap_catalog"}),l===Me.AUTH)return Mt.logger.error(Ze("errors.storedSystemConnectionError",{systemName:a.name,error:o})),!0}o===!0&&e.serviceProvider&&(Xt.odataService.connectedSystem={serviceProvider:JC(e.serviceProvider),backendSystem:a})}return o}async function eZ(t,e,r,n){Xt.resetConnectedSystem();let{valResult:i,errorType:o}=await e.validateDestination(t,XC(r),n);return o===Me.AUTH&&e.systemAuthType==="basic"?(Mt.logger.error(Ze("errors.destination.authError",{systemName:t.Name,error:i})),!0):(i===!0&&e.serviceProvider&&(Xt.odataService.connectedSystem={serviceProvider:JC(e.serviceProvider),destination:t}),i)}function aca(t,e){return!e||e.odata_abap&&Roe(t)||e.odata_generic&&Doe(t)||e.full_service_url&&DP(t)||e.partial_service_url&&bE(t)?!0:(Mt.logger.debug(`Destination: ${t.Name} does not match any filters and will be excluded as a prompt choice. Destination configuration: ${JSON.stringify(t)}`),!1)}async function qRn(t,e=!1,r=!1,n){let i=[],o;if(Si()){let s={};try{s=await OVe({stripS4HCApiHosts:!0})}catch(a){Mt.logger.error(Ze("errors.destination.listDestinations",{error:a.message}))}i=Object.values(s).filter(a=>aca(a,t)).map(a=>({name:YHt(a),value:{type:"destination",system:a}})),e&&(o={name:Ze("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:Awe,system:Awe}})}else{let s=await BRn(!1,n);Xt.backendSystemsCache=s,i=s.map(a=>({name:j3t(a),value:{system:a,type:"backendSystem"}})),r||(o={name:Ze("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:V_t}})}return i.sort(({name:s},{name:a})=>s.localeCompare(a,void 0,{numeric:!0,caseFirst:"lower"})),o&&i.unshift(o),i}function B_t(t,e){let r=typeof e=="string"?e:e?.value;return r?t.findIndex(i=>{let{type:o,system:s}=i.value;if(o==="destination")return s.Name===r;if(o==="backendSystem")return s.name===r;if(o==="newSystemChoice")return r===V_t;if(o==="cfAbapEnvService")return r===Awe}):-1}var Owe="abapOnBtp",NYc=`${Owe}:${WD.newSystemUrl}`,cca="cliCfAbapService",j_t={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function zRn(t,e){Xt.reset();let r=new $_,n=[];return n.push({type:"list",name:j_t.abapOnBtpAuthType,choices:[{name:Ze("prompts.abapOnBTPType.choiceCloudFoundry"),value:"cloudFoundry"},{name:Ze("prompts.abapOnBTPType.choiceReentranceTicket"),value:"reentranceTicket"}],message:Ze("prompts.abapOnBTPType.message"),validate:()=>(r.resetConnectionState(!0),Xt.resetConnectedSystem(),!0)}),n.push(pl([Swe(r,Owe,t?.serviceSelection?.requiredOdataVersion,e)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...pl([...q_t(r,void 0,void 0,e)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),t?.userSystemName?.hide!==!0&&n.push(pl([bwe(r,Owe)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...XD(r,Owe,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}async function GRn(t,e,r,n=!1,i){Xt.resetConnectedSystem();let o=t.label,s=await(0,HRn.apiGetInstanceCredentials)(o);if(!s?.credentials?.uaa)return Ze("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:o});let a=!0,c;if(ed()===mo.bas)try{c=await ZHt(o,{uaaCredentials:s.credentials.uaa,hostUrl:s.credentials.url},Mt.logger),a=await eZ(c,e,r)}catch(u){a=u.message}else i&&i.backendSystem?.url===s.credentials.url&&JSON.stringify(i.backendSystem.serviceKeys?.uaa)===JSON.stringify(s.credentials.uaa)&&e.setConnectedSystem(i),a=await e.validateServiceInfo(s.credentials);if(!n&&a!==!0)return a;if(n&&typeof a=="string")throw Mt.logger.error(a),new Error(a);if(n&&a===!1)throw Mt.logger.error(Ci.getErrorMsg()??Ze("errors.abapServiceAuthenticationFailed")),new Error(Ze("errors.abapServiceAuthenticationFailed"));return e.serviceProvider&&ed()!==mo.bas&&(e.connectedSystemName=await CVe(o),Xt.odataService.connectedSystem={serviceProvider:JC(e.serviceProvider)}),!0}function q_t(t,e,r,n){let i=[],s=[{type:"list",name:`${e?e+":":""}${j_t.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await GOn(Ci),i.length===0&&ed()===mo.cli)throw new Error(Ze("errors.abapEnvsUnavailable"));return i},default:()=>Ewe(i),message:Ze("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let u=await GRn(a,t,r,ed()===mo.cli,n);if(!Si()&&u===!0&&t.validatedUrl){let l=mH(Xt.backendSystemsCache,t.validatedUrl,t.validatedClient);if(l)return t.resetConnectionState(!0),Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return u}if(Ci.getCurrentErrorType()===Me.NO_ABAP_ENVS){let u=Ci.getErrorMsg(!0),l=Ze("texts.seeLogForDetails");return`${u} ${l}`}return!1}}];return ed()===mo.cli&&s.push({when:async a=>{let c=a?.[j_t.cloudFoundryAbapSystem];return c&&await GRn(c,t,r,!0),!1},name:cca}),s}function KRn(t){let e="cfAbapBas",r=new $_;return[...q_t(r,e,t?.serviceSelection?.requiredOdataVersion),...XD(r,e,t?.serviceSelection,t?.valueHelpDownload?.hide)]}var VL="abapOnPrem",G_t=`${VL}:${WD.newSystemUrl}`,KYc=`${VL}:${Og.systemUsername}`,WYc=`${VL}:${Og.systemPassword}`,uca={sapClient:"sapClient"};function WRn(t){Xt.reset();let e=new $_,r=t?.serviceSelection?.requiredOdataVersion,n=lca(t?.userSystemName,e,r);return n.push(...XD(e,VL,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}function lca(t,e,r){let n=e??new $_,i={sapClient:void 0,isValid:!0},o=[Swe(n,VL,r,void 0,!1),{type:"input",name:uca.sapClient,message:Ze("prompts.sapClient.message"),guiOptions:{breadcrumb:Ze("prompts.sapClient.breadcrumb")},validate:(s,a)=>{let c=oRn(s);if(c===!0){if(i.sapClient=s,i.isValid=!0,a?.[G_t]){let u=mH(Xt.backendSystemsCache,a[G_t],s);if(u)return i.isValid=!1,Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:u.name})}return!0}return i.sapClient=void 0,i.isValid=!1,c}},...Twe(n,VL,i,r)];return t?.hide!==!0&&o.push(pl([bwe(n,VL)],s=>!!s?.[G_t]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),o}function YRn(t,e){let r=[{type:"list",name:WD.newSystemType,choices:[{name:Ze("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:Ze("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:Ze("prompts.newSystemType.message")}];return r.push(...pl(WRn(t),n=>n.newSystemType==="abapOnPrem")),r.push(...pl(zRn(t,e),n=>n.newSystemType==="abapOnBtp")),r}var Cwe="systemSelection",y9c=`${Cwe}:${Og.systemUsername}`,_9c=`${Cwe}:${Og.systemPassword}`,XRn={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function JRn(t,e,r,n,i){if(Xt.reset(),t.type==="newSystemChoice"||t.type==="cfAbapEnvService")return e.resetConnectionState(!0),!0;let o=!1;if(t.type==="backendSystem"){t.system.connectionType==="odata_service"&&(i=t.system.url);let s=af.from(t.system);o=await jRn(s,e,r,n,i)}else if(t.type==="destination"){if(bE(t.system))return!0;o=await eZ(t.system,e,r,i)}return o}async function z_t(t,e){Xt.reset();let r=new $_,n=await pca(r,t,e);return t?.serviceSelection?.hide||n.push(...pl(XD(r,Cwe,t?.serviceSelection,t?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),Si()?n.push(...pl(KRn(t),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...pl(YRn(t,e),i=>i.systemSelection?.type==="newSystemChoice")),n}async function pca(t,e,r){let n=e?.serviceSelection?.requiredOdataVersion,i=e?.systemSelection?.destinationFilters,o=await qRn(i,e?.systemSelection?.includeCloudFoundryAbapEnvChoice,e?.systemSelection?.hideNewSystem,e?.systemSelection?.backendSystemFilter),s=B_t(o,e?.systemSelection?.defaultChoice),a=e?.systemSelection?.connectPath,c=e?.systemSelection?.onlyShowDefaultChoice&&e?.systemSelection?.defaultChoice,u=[{type:e?.systemSelection?.useAutoComplete?"autocomplete":"list",name:rs.systemSelection,message:Ze("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:Ze("prompts.systemSelection.hint")},source:(l,p)=>gG(p,o),choices:c?[o[s]]:o,default:()=>c?0:(s=B_t(o,e?.systemSelection?.defaultChoice),typeof e?.systemSelection?.connectPath=="object"&&(a=e?.systemSelection.connectPath),s),validate:async l=>{if(!l)return!1;let p=l;return e?.systemSelection?.useAutoComplete&&l.value&&(p=l.value),JRn(p,t,n,r,a?.value)??!1},additionalMessages:async l=>{if(l.type==="backendSystem"&&t.systemAuthType==="basic"&&await t.isAuthRequired())return{message:Ze("prompts.systemSelection.authenticationFailedUpdateCredentials"),severity:H_t.Severity.information};if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:H_t.Severity.warning}}}];if(Si()){let l={when:p=>{let d=p?.[rs.systemSelection];return d?.type==="destination"?bE(d.system):!1},type:"input",name:XRn.destinationServicePath,message:Ze("prompts.destinationServicePath.message"),guiOptions:{hint:Ze("prompts.destinationServicePath.hint"),mandatory:!0,breadcrumb:!0,applyDefaultWhenDirty:!0},default:"",validate:async(p,d)=>{if(!p||p.trim().length<2||p.startsWith("//"))return t.resetConnectionState(!0),Ze("prompts.destinationServicePath.invalidServicePathWarning");let h=d?.[rs.systemSelection]?.system,f=URn(h.Host,p);return f!==!0?(t.resetConnectionState(!0),f):await eZ(h,t,n,p)}};u.push(l)}return ed()===mo.cli&&!e?.systemSelection?.useAutoComplete&&u.push({when:async l=>{let p=l?.[rs.systemSelection];if(!p)return!1;let d=await JRn(p,t,n,void 0,a?.value);if(d!==!0)throw Mt.logger.error(d.toString),new Error(d.toString());return!1},name:`${XRn.systemSelectionCli}`}),u.push(...Twe(t,Cwe,void 0,n)),u}var dca=require("@sap-devx/yeoman-ui-types");var K_t;(function(t){t.ignoreCertError="ignoreCertError",t.username="username",t.cliIgnoreCertValidate="cliIgnoreCertValidate"})(K_t||(K_t={}));var Eva=require("@sap-devx/yeoman-ui-types");var vca=pe(Ma(),1),Tca=pe(la(),1),Sca=pe(al(),1);var dNn=pe(Ma(),1),fNn=pe(la(),1),hNn=pe(zo(),1);var sNn=pe(require("node:os"),1),aNn=require("node:path"),cNn=pe(zo(),1);var Pwe=require("node:path"),QRn=require("node:url"),fca=(0,Pwe.dirname)((0,QRn.fileURLToPath)(__importMetaUrl));function Bs(t=""){return(0,Pwe.join)(fca,"../templates",t)}var gH=require("node:path");var ZRn=" ",tZ=" ",rZ={"page/custom/1.94/ext/View.xml":{getData:(t,e)=>({ids:{page:t(e?.name??"Page")}})},"page/custom/1.84/ext/View.xml":{getData:(t,e)=>({ids:{page:t(e?.name??"Page")}})},"common/FragmentWithForm.xml":{getData:t=>({ids:{formElement:t("FormElement")}})},"common/FragmentWithVBox.xml":{getData:t=>({ids:{vbox:t("VBox")}})},"view/ext/CustomViewWithTable.xml":{getData:t=>({ids:{table:t("Table")}})},"filter/fragment.xml":{getData:t=>{let e=t("Item"),r=t("Item",[e]),n=t("Item",[e,r]);return{ids:{comboBox:t("ComboBox"),item1:e,item2:r,item3:n}}}},"building-block/rich-text-editor-button-groups/View.xml":{getData:(t,e)=>{let r=e?.buttonGroups||e?.data?.buttonGroups||[],n={},i=[];return r.forEach((o,s)=>{let a=t("ButtonGroup",i);n[s]=o.id??a,o.id||i.push(a)}),{ids:n}}},"building-block/custom-column/View.xml":{getData:t=>({ids:{column:t("TableColumn")}})}};function hca(t,e,r=[]){if(!r.includes(t)&&XX(t,e))return t;for(let i=1;i<1e3;i++){let o=`${t}${i}`;if(!r.includes(o)&&XX(o,e))return o}throw new Error(`Failed to generate unique ID for base '${t}' after 1000 attempts`)}async function W_t(t,e){let r=await Yw(".xml",t,[".git","node_modules","dist","annotations","localService"],e),n=[".fragment.xml",".view.xml"];return r.filter(i=>n.some(o=>i.endsWith(o)))}function V_(t={}){let{basePath:e,fsEditor:r,fileContentCache:n=[]}=t,i=o=>(s,a=[])=>hca(s,o,a);return n.length>0?i(n):r&&e?W_t(e,r).then(o=>{let s=o.map(a=>r.read(a).toString());return i(s)}):i([])}var mca={noGlob:!0};function gca(t){let e,r=t.startsWith(tZ)?tZ:ZRn;for(let n=0;n<t.length;n++)if(t[n]!==r){e={size:n,useTabSymbol:r===tZ};break}return e}function Y_t(t){let e,r=new Set([ZRn,tZ]),i=t.split(/\r\n|\n/).find(o=>r.has(o[0]));return i&&(e=gca(i)),e}function xwe(t,e,r){if(!r){let i=t.read(e);r=Y_t(i)}let n;return r&&(r.useTabSymbol?n=tZ.repeat(r.size||1):n=r.size),n}function QC(t,e){let{filepath:r,content:n,replacer:i}=e,o=xwe(t,r,e.tabInfo);t.extendJSON(r,JSON.parse(n),i,o)}function B_(t,e,r,n,i){let o=wwe(e),s=rZ[o];if(i&&s?.getData){let a=s.getData(i,n);n={...n,...a}}t.copyTpl(e,r,n,void 0,mca)}function wwe(t){let e=(0,gH.normalize)(t),r=`${gH.sep}templates${gH.sep}`,n=e.indexOf(r);return n===-1?t:e.substring(n+r.length).split(gH.sep).join("/")}var uNn=pe(rU(),1);var Rwe=pe(rU(),1),tNn=pe(zF(),1);var j_={Full:"full",Basic:"basic"};var BL="1.145.0",pr;(function(t){t.FilterBar="filter-bar",t.Chart="chart",t.CustomFilterField="custom-filter-field",t.CustomFormField="custom-form-field",t.Field="field",t.Form="form",t.Page="page",t.Table="table",t.CustomColumn="custom-column",t.RichTextEditor="rich-text-editor",t.RichTextEditorButtonGroups="rich-text-editor-button-groups",t.Action="action"})(pr||(pr={}));var Vb="absolute",nZ="relative",Dwe=["breadcrumbs","navigationActions","titleContent","actions","headerContent","items","footer"],eNn="This is a sample template, event handlers should be added for implementation",X_t="sap.fe.macros";var iZ={"":"http://www.w3.org/1999/xhtml",mvc:"sap.ui.core.mvc",core:"sap.ui.core",macros:"sap.fe.macros",macrosTable:"sap.fe.macros.table",macrosChart:"sap.fe.macros.chart",richtexteditor:"sap.fe.macros.richtexteditor"};function Vv(t,e){return{onError:e??((n,i)=>{throw new Error(`Unable to parse template file with building block data. Details: [${n}] - ${i}`)}),xmlns:t}}var J_t=t=>{let e=[];for(let r of t.split("/"))e.push(r===""||r.includes(":")?r:`*[local-name()='${r}']`);return e.join("/")};function yca(t,e,r,n){if(t.localName!=="Page"||t.namespaceURI!==X_t)return;let i=r||"macros",o=`${i}:items`;if(!Array.from(t.childNodes).some(a=>a.nodeType===a.ELEMENT_NODE&&a.localName==="items")){let a=t.prefix?t.nodeName:`${i}:Page`,c=`${e}/${a}/${o}`;n[c]=J_t(c)}}function rNn(t,e){let r={},n;try{let i=e.read(t),o=new Rwe.DOMParser(Vv()).parseFromString(i,"text/xml"),s=[{parentNode:"",node:o.firstChild}],a=Cg(o);n=a?`${a}:Page`:"macros:Page";let c=!1;for(;s&&s.length>0;){let{parentNode:u,node:l}=s.shift();if(!l)continue;c=Array.from(l.childNodes).some(d=>d.nodeType===d.ELEMENT_NODE&&d.localName==="Page"&&d.namespaceURI===X_t),c||(r[`${u}/${l.nodeName}`]=J_t(`${u}/${l.nodeName}`)),yca(l,u,a||"macros",r);let p=Array.from(l.childNodes);for(let d of p)d.nodeType===d.ELEMENT_NODE&&s.push({parentNode:`${u}/${l.nodeName}`,node:d})}}catch(i){throw new Error(`An error occurred while parsing the view or fragment xml. Details: ${nNn(i)}`)}return{inputChoices:r,pageMacroDefinition:n}}function nNn(t){return t instanceof Error?t.message:String(t)}async function iNn(t,e){let r=[],n="macros:FilterBar",i=e.read(t),o=new Rwe.DOMParser(Vv()).parseFromString(i,"text/xml"),s=Array.from(o.getElementsByTagName(n));for(let a of s){let c=a.getAttributeNode("id")?.value;c&&r.push(c)}return r}async function oNn(t,e,r){let n=new Set;try{let i=r.read(t),o=new Rwe.DOMParser(Vv()).parseFromString(i,"text/xml"),s=o.firstChild?._nsMap||{},c=tNn.useNamespaces(s)(e,o);if(c.length===0)return n;let u=c[0],l=Array.from(u.childNodes).find(d=>d.nodeType===1&&d.localName==="buttonGroups");if(!l)return n;Array.from(l.childNodes).filter(d=>d.nodeType===1&&d.localName==="ButtonGroup").forEach(d=>{let h=d.getAttribute("name");h&&n.add(h)})}catch(i){throw new Error(`An error occurred while reading button groups. Details: ${nNn(i)}`)}return n}function _ca(t,e){for(let r of Array.from(t.attributes))if(r.value===e){if(r.name==="xmlns")return"";if(r.name.startsWith("xmlns:"))return r.name.split(":")[1]}return null}function Cg(t,e="sap.fe.macros",r="macros"){let n=t.documentElement,i=_ca(n,e);return i!==null?i:(n.setAttributeNS("http://www.w3.org/2000/xmlns/",r===""?"xmlns":`xmlns:${r}`,e),r)}function Q_t(t,e,r){if(r<0)return e;let n=Math.max(r-1,0);for(;n>0&&e[n]===void 0;)e+=" ";return`${e.slice(0,r)}${t}${e.slice(r)}`}function lNn(t,e,r){if(r.line<0||r.character<0)return e;let n=e.split(/\r\n|\n/),i=n[r.line];for(;i===void 0;)n.push(""),i=n[r.line];return n[r.line]=Q_t(t,n[r.line],r.character),n.join(sNn.default.EOL)}async function yH(t,e){return(0,aNn.join)(await Tu(t,e),"manifest.json")}async function td(t,e,r=!0){let n=await yH(t,e);if(r&&!e.exists(n))throw new Error(`Invalid project folder. Cannot find required file ${n}`);return{path:n,content:e.readJSON(n)}}function pNn(t,e,r){let n=t.read(e).toString(),i=new uNn.DOMParser(Vv(void 0,()=>{})).parseFromString(n,"text/xml");return i.documentElement?!i.getElementById(r):!0}function Nwe(t,e){let r=t["sap.ui5"]?.dependencies?.libs;return e.length?e.some(n=>r?.[n]!==void 0):!0}async function Pg(t,e,r=["sap.fe.templates"]){e||(e=(0,fNn.create)((0,dNn.create)()));let n=await yH(t,e);if(e.exists(n)){let i=e.readJSON(n);if(!Nwe(i,r))throw r.length===1?new Error(`Dependency ${r[0]} is missing in the manifest.json. Fiori elements FPM requires the SAP FE libraries.`):new Error(`All of the dependencies ${r.join(", ")} are missing in the manifest.json. Fiori elements FPM requires the SAP FE libraries.`)}else throw new Error(`Invalid project folder. Cannot find required file ${n}`);return!0}function oZ(t){return t instanceof Error?t.message:String(t)}var _H;(function(t){t.ListReport="ListReport",t.ObjectPage="ObjectPage",t.CustomPage="CustomPage"})(_H||(_H={}));var Iwe=require("node:path");function Bv(t,e,r){return t.folder=t.folder||`ext/${t.name[0].toLocaleLowerCase()+t.name.substring(1)}`,t.ns=`${r["sap.app"].id}.${t.folder.replace(/[/\\]/g,".")}`,t.path=(0,Iwe.join)((0,Iwe.dirname)(e),t.folder),t}function Z_t(t,e,r,n=!1,i=!1,o=!0){let s,a;if(r){let c=r.split("."),u=c.pop();a=`core:require="{ handler: '${`${c.join("/")}${n?".controller":""}`}'}"`;let p=[];o&&p.push(a),i?(p.push(`value="${t}"`),p.push(`change="handler.${u}"`),s=`<Input id="${e("Input")}" ${p.join(" ")} />`):(p.push(`text="${t}"`),p.push(`press="handler.${u}"`),s=`<Button id="${e("Button")}" ${p.join(" ")} />`)}else i?s=`<Input id="${e("Input")}" value="${t}" />`:s=`<Text id="${e("Text")}" text="${t}" />`;return{content:s,requireAttribute:a}}function EH(t,e,r,n=!1,i=!1){return Z_t(t,e,r,n,i).content}var mNn=pe(zo(),1);var AEa=pe(Ma(),1),OEa=pe(la(),1),CEa=pe(al(),1);var ebt=pe(zo(),1);var cEt=pe(Ma(),1),uEt=pe(la(),1),lEt=pe(al(),1),TH=pe(zo(),1),ZC=require("node:path"),qL=pe(rU(),1),pEt=pe(JAe(),1),ANn=pe(zF(),1);var ns;(function(t){t.FilterBar="filter-bar",t.Form="form",t.Chart="chart",t.Table="table",t.Page="page",t.BuildingBlocks="building-blocks",t.RichTextEditor="rich-text-editor",t.RichTextEditorButtonGroups="rich-text-editor-button-groups"})(ns||(ns={}));var sZ;(function(t){t.JSON="json",t.CDS="cds",t.XML="xml",t.JS="javascript",t.TS="typescript",t.ABAPCDS="abapCds"})(sZ||(sZ={}));var bca={prompts:{super:{buildingBlockType:{message:"Select a building block",choices:{chart:"Chart",filterBar:"Filter Bar",table:"Table"}},manifestGroup:{manifestLibrariesTitle:"Manifest Libraries",manifestLibrariesDescription:["In order for macros to work, we need to ensure that the sap.fe.macros library is maintained in manifest.json. Please see the code snippet."]}},common:{id:{existingIdValidation:"An element with this ID already exists",defaultPlaceholder:"Enter a building block ID"},service:{defaultPlaceholder:"Select a service"},entity:{defaultPlaceholder:"Select an entity"},aggregationPath:{defaultPlaceholder:"Select an aggregation path"},filterBar:{defaultPlaceholder:"Enter a new filter bar ID"},viewOrFragmentPath:{defaultPlaceholder:"Select a view or fragment file"},bindingContextType:{option:{relative:"Relative",absolute:"Absolute"}},validation:{errorMessage:{input:"Please enter a value",select:"Please select a value"}},targetProperty:{defaultPlaceholder:"Select a target property"}},chart:{chartBuildingBlockPropertiesTitle:"Chart Building Block Properties",chartBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you would like to insert the chart building block and provide a `Building Block ID` to identify the chart.","Select an `Entity Set`, and a `Chart Annotation` you would like to use for the chart building block.","Select an `Aggregation Path` to determine where you would like the chart to be placed on the page."],chartVisualizationPropertiesTitle:"Chart Visualization Properties",chartVisualizationPropertiesDescription:["Configure your chart using the properties below."],chartConfigureEventsTitle:"Configure Events",chartConfigureEventsDescription:["Configure the below properties to react to events. Event handler methods are invoked when an event occurs."],id:{message:"Building Block ID",validation:"An ID is required to generate the chart building block"},aggregation:"Aggregation Path",entity:"Entity",service:"Service",viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the chart building block"},contextPath:"Enter the context path used in the page",metaPath:"Enter the relative path of the property in the meta model",filterBar:{message:"Associated Filter Bar ID",validation:"Enter the ID of the filter bar building block associated with the chart",placeholder:"Select or enter a filter bar ID",inputPlaceholder:"Enter a new filter bar ID"},bindingContextType:"Binding Context Path Type",personalization:{message:"Chart Personalization",choices:{type:"Type",item:"Item",sort:"Sort"},placeholder:"Select chart personalization"},selectionMode:{message:"Selection Mode",choices:{single:"Single",multiple:"Multiple"}},selectionChange:"Selection Change Event",selectionChangePlaceholder:"Enter a function to be executed",qualifier:"Chart Annotation Path",qualifierPlaceholder:"Select a chart annotation path",valuesDependentOnEntityTypeInfo:"Values are dependent on entity set"},filterBar:{filterBarBuildingBlockPropertiesTitle:"Filter Bar Building Block Properties",filterBarBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you would like to insert the filter bar building block and provide a `Building Block ID` to identify the filter bar.","Select an `Entity Set`, and a `Selection Field Annotation` you would like to use for the filter bar building block.","Select an `Aggregation Path` to determine where you would like the filter bar to be placed on the page."],filterBarConfigureEventsTitle:"Configure Events",filterBarConfigureEventsDescription:["Configure the below properties to react to events. Event handler methods are invoked when an event occurs."],id:{message:"Building Block ID",validation:"An ID is required to generate the filter bar building block"},viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the filterbar building block"},entity:"Entity",service:"Service",metaPath:"Enter the relative path of the property in the meta model",filterChanged:"Filter Changed Event",filterChangedPlaceholder:"Enter a function to be executed",search:"Search Event",searchPlaceholder:"Enter a function to be executed",qualifier:"Selection Field Annotation Path",qualifierPlaceholder:"Select a selection field annotation path",aggregation:"Aggregation Path",valuesDependentOnEntityTypeInfo:"Values are dependent on entity set",bindingContextType:"Binding Context Path Type"},form:{aggregation:"Aggregation Path",bindingContextType:"Binding Context",entity:"Entity",formBuildingBlockPropertiesTitle:"Properties of the Form Building Block",formBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you want to insert the Form building block and provide a `Building Block ID` to identify the form.","Select an `Entity Set`, and a `Field Group Annotation` you want to use for the Form building block.","Select an `Aggregation Path` to determine where you want the form to appear on the page.","Provide a `Form Title` to be displayed."],formVisualizationPropertiesTitle:"Form Visualization Properties",formVisualizationPropertiesDescription:["Configure your form using the properties below."],id:{message:"Building Block ID",validation:"An ID is required to generate the Form building block."},qualifier:"FieldGroup Annotation Path",qualifierPlaceholder:"Select a FieldGroup annotation path",viewOrFragmentPath:{message:"View or Fragment File",validate:"A View or Fragment is required to generate the Form building block."},service:"Service",title:{message:"Form Title",validation:"Enter a Form Title",translationAnnotation:"Title of the Form"},valuesDependentOnEntityTypeInfo:"Values are dependent on entity set"},table:{tableBuildingBlockPropertiesTitle:"Table Building Block Properties",tableBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you would like to insert the table building block and provide a `Building Block ID` to identify the table.","Select an `Entity Set`, and a `Line Item Annotation` you would like to use for the table building block.","Select an `Aggregation Path` to determine where you would like the table to appear on the page.","Provide the Associated Filter Bar ID if you want to link the table to an existing filter bar."],tableVisualizationPropertiesTitle:"Table Visualization Properties",tableVisualizationPropertiesDescription:["Configure your table using the properties below."],viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the table building block"},id:{message:"Building Block ID",validation:"An ID is required to generate the table building block"},bindingContextType:"Binding Context Path Type",entity:"Entity",service:"Service",qualifier:"Line Item Annotation Path",qualifierPlaceholder:"Select a line item annotation path",aggregation:"Aggregation Path",filterBar:{message:"Associated Filter Bar ID",validation:"Enter the ID of the filter bar building block associated with the table",placeholder:"Select or enter a filter bar ID",inputPlaceholder:"Enter a new filter bar ID"},tableType:{message:"Table Type"},selectionMode:{message:"Select a Selection Mode",choices:{multiple:"Multiple",single:"Single",auto:"Auto",none:"None"}},headerVisible:"Display Header",header:{message:"Table Header Text",validation:"Enter a Table Header Text",translationAnnotation:"Header of the table"},personalization:{message:"Table Personalization",choices:{Sort:"Sort",Column:"Column",Filter:"Filter"}},tableVariantManagement:"Select a Table Variant Management",readOnlyMode:"Enable Read Only Mode",autoColumnWidth:"Enable Auto Column Width",dataExport:"Enable Data Export",fullScreenMode:"Enable Full Screen Mode",pasteFromClipboard:"Enable Paste From Clipboard",tableSearchableToggle:"Table Searchable Toggle",valuesDependentOnEntityTypeInfo:"Values are dependent on entity set"},richTextEditor:{id:{message:"Building Block ID",validation:"An ID is required to generate the Rich Text Editor building block."},viewOrFragmentPath:{message:"View or Fragment File",validation:"A view or fragment is required to generate the Rich Text Editor building block."},bindingContextType:"Binding Context",relativeBindingDisabledTooltip:"There are no suitable entities available for relative binding.",valueSource:"Value Source",entitySet:"Entity",targetProperty:"Target Property",aggregation:"Aggregation Path"},richTextEditorButtonGroups:{message:"Buttons",choices:{"font-style":"Font Style (Bold, Italic, Underline, and Strikethrough)",font:"Font Settings (Family, Size, and Colors)",clipboard:"Clipboard (Cut, Copy, and Paste)",structure:"List Structure (Bullets, Numbers, and Indentation)",undo:"Undo/Redo",insert:"Insert (Image, and Emoticons)",link:"Link (Add, and Remove Links)","text-align":"Text Alignment (Left, Center, Right, and Justify)",table:"Table",styleselect:"Style Select"},viewOrFragmentPath:{message:"View or Fragment File",validation:"A view or fragment is required to generate the Rich Text Editor Button Groups building block."},aggregation:"Aggregation Path",replaceDefaultButtonGroupsHint:"Adding button groups replaces the default button groups in the Rich Text Editor with your chosen configuration."},page:{templateType:{message:"Page Layout",basic:"Basic",full:"Full"},id:{message:"Building Block ID",validation:"An ID is required to generate the page building block."},viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the page building block."},aggregation:"Aggregation Path",title:{message:"Page Title",validation:"Enter a Page Title",translationAnnotation:"Title of the Page."},description:{message:"Page Description",validation:"Enter a Page Description",translationAnnotation:"Description of the Page."}}},pageBuildingBlock:{minUi5VersionRequirement:"The Page building block feature requires SAPUI5 {{ minUi5VersionForPageBuildingBlock }} or higher. The current version is {{ minUI5Version }}, so the Page building block will not be added.",minUi5VersionRequirementFullLayout:"Full Layout requires SAPUI5 {{ minUi5VersionForFullLayout }} or higher. The current version is {{ minUI5Version }}, so Basic Layout will be applied instead."},richTextEditorBuildingBlock:{minUi5VersionRequirement:"The Rich Text Editor building block feature requires SAPUI5 1.117.0 or higher. The current version is {{ minUI5Version }}, so the Rich Text Editor building block will not be added."}},gNn=bca;var Aca="fe-fpm-writer",ki={buildingBlock:`${Aca}-building-block`},yNn=Dn.createInstance();async function Mwe(){await yNn.init({resources:{en:{[ki.buildingBlock]:gNn}},lng:"en",fallbackLng:"en",defaultNS:ki.buildingBlock,ns:[ki.buildingBlock]})}function Po(t,e){return(r,n)=>yNn.t(`${t}:${e??""}${r}`,n)}var Lwe=require("node:path"),tEt=pe(zF(),1);var _Nn=require("node:path");var Oca={name:"event",jsName:"oEvent",description:"the event object provided by the event provider.",importType:"UI5Event",importSource:"sap/ui/base/Event"};function Cca(t,e){let r;return e&&t.endsWith(".controller")?r=t.replace(".controller",""):r=t,r}function jv(t,e,r,n,i=[Oca]){let{controllerSuffix:o,typescript:s,templatePath:a="common/EventHandler"}=n,{eventHandlerFnName:c="onPress"}=n;if(typeof r=="string")return r;let u,l="",p=e.name,d=p;typeof r=="object"&&(l=r.controllerPrefix,r.fnName&&(c=r.fnName),u=r.insertScript,r.fileName&&(p=r.fileName,d=Cca(p,l)));let h=s?"ts":"js",f=(0,_Nn.join)(e.path||"",`${p}${o?".controller":""}.${h}`);if(!t.exists(f))B_(t,Bs(`${a}.${h}`),f,{eventHandlerFnName:c,parameters:i,...e});else if(u){let _=t.read(f);typeof u.position=="object"?_=lNn(u.fragment,_,u.position):_=Q_t(u.fragment,_,u.position),t.write(f,_)}let m=`${e.ns}.${d}.${c}`;return l?`${l}.${m}`:`${m}`}var rEt=[{name:"font-style",buttons:"bold,italic,underline,strikethrough"},{name:"clipboard",buttons:"cut,copy,paste"},{name:"structure",buttons:"bullist,numlist,outdent,indent"},{name:"font",buttons:"fontfamily,fontsize,forecolor,backcolor"},{name:"undo",buttons:"undo,redo"},{name:"insert",buttons:"image,emoticons"},{name:"link",buttons:"link,unlink"},{name:"text-align",buttons:"alignleft,aligncenter,alignright,alignjustify"},{name:"table",buttons:"table"},{name:"styleselect",buttons:"styleselect"}],ENn={[pr.CustomColumn]:{aggregationConfig:{aggregationName:"columns",elementName:"Column"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Pca},[pr.CustomFilterField]:{aggregationConfig:{aggregationName:"filterFields",elementName:"FilterField"},templateFile:"filter/fragment.xml",namespace:{uri:"sap.fe.macros.filterBar",prefix:"macros"},processor:xca},[pr.CustomFormField]:{aggregationConfig:{aggregationName:"fields",elementName:"FormElement"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:wca},[pr.RichTextEditorButtonGroups]:{aggregationConfig:{aggregationName:"buttonGroups",elementName:"ButtonGroup"},namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:Ica},[pr.Action]:{aggregationConfig:{aggregationName:"actions",elementName:"Action"},namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Mca}};function kwe(t){let e=ENn[t];if(!e)throw new Error(`No configuration found for building block type: ${t}`);return e}function q_(t,e){return t.buildingBlockType===e}function Pca(t,e){let{fs:r,viewPath:n}=e;if(!q_(t,pr.CustomColumn))throw new Error("Expected CustomColumn building block data");let i=kwe(pr.CustomColumn),o=t.embededFragment,s;o.eventHandler&&(s=jv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content=EH("Sample Text",t.generateId,s),n&&!r.exists(n)&&r.copyTpl(Bs(i.templateFile),n,o)}function xca(t,e){let{fs:r,viewPath:n,embeddedFragment:i}=e;if(!q_(t,pr.CustomFilterField))throw new Error("Expected CustomFilterField building block data");if(!i)throw new Error("EmbeddedFragment is required for CustomFilterField");let o=kwe(pr.CustomFilterField),s={label:t.label,property:t.property,required:t.required??!1,position:t.position,eventHandler:t.embededFragment?.eventHandler,ns:i.ns,name:i.name,path:i.path};s.eventHandler&&(s.eventHandler=jv(r,s,s.eventHandler,{controllerSuffix:!1,typescript:t.embededFragment?.typescript,templatePath:"filter/Controller"}));let a=o.templateFile,c=rZ[a];if(c?.getData){let u=c.getData(t.generateId);s={...s,...u}}n&&!r.exists(n)&&r.copyTpl(Bs(o.templateFile),n,s)}function wca(t,e){let{fs:r,viewPath:n}=e;if(!q_(t,pr.CustomFormField))throw new Error("Expected CustomFormField building block data");if(!t.embededFragment)throw new Error("EmbeddedFragment is required for CustomFormField");let i=kwe(pr.CustomFormField),o=t.embededFragment,s;o.eventHandler&&(s=jv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content??=EH("Custom Form Field Content",t.generateId,s),n&&!r.exists(n)&&r.copyTpl(Bs(i.templateFile),n,o)}function Dca(t){let e=t.getAttribute("name"),r=t.getAttribute("buttons");if(!e||!r)return;let n={name:e,buttons:r};r&&(n.buttons=r);let i=t.getAttribute("visible");i&&(n.visible=i==="true");let o=t.getAttribute("priority");o&&(n.priority=Number.parseInt(o,10));let s=t.getAttribute("customToolbarPriority");s&&(n.customToolbarPriority=Number.parseInt(s,10));let a=t.getAttribute("row");a&&(n.row=Number.parseInt(a,10));let c=t.getAttribute("id");return c&&(n.id=c),n}function Rca(t){let e=Array.from(t.values()).map(r=>r.customToolbarPriority).filter(r=>typeof r=="number");return e.length>0?Math.max(...e)+1:1}function Nca(t,e){let r=Rca(t);return e.buttonGroups?.map(n=>{let i=rEt.find(c=>c.name===n.name);if(!i)throw new Error(`Unknown button group: ${n.name}`);let o=t.get(n.name),s=Object.keys(n).some(c=>c!=="name"&&n[c]!==void 0),a=n.customToolbarPriority;return a===void 0&&!o?a=r++:o?.customToolbarPriority!==void 0&&(a=o.customToolbarPriority),o&&!s?{...o,customToolbarPriority:a}:{name:n.name,buttons:n.buttons??i.buttons,visible:n.visible,priority:n.priority,customToolbarPriority:a,row:n.row,id:n.id}})}function Ica(t,e){let{xmlDocument:r,updatedAggregationPath:n,hasAggregation:i}=e;if(!q_(t,pr.RichTextEditorButtonGroups)&&!q_(t,pr.RichTextEditor))throw new Error("Expected RichTextEditorButtonGroups or RichTextEditor building block data");let o=new Map;if(i&&r&&n){let a=tEt.useNamespaces(r.documentElement?._nsMap??{})(n,r);if(a.length>0){let c=a[0],u=kwe(pr.RichTextEditorButtonGroups);Array.from(c.childNodes).filter(d=>d.nodeType===1&&d.localName===u.aggregationConfig.elementName).forEach(d=>{let h=Dca(d);h&&o.set(h.name,h)});let p=a[0];p.parentNode?.removeChild(p)}}t.buttonGroups=Nca(o,t)}function vH(t){return t.replace(/\/([A-Za-z_][A-Za-z0-9_.-]*)(?=\/|$)/g,(e,r)=>r.includes(":")?`/${r}`:`/*[local-name()='${r}']`)}function eEt(t,e,r,n){let i=t.documentElement?._nsMap??{},o=tEt.useNamespaces(i),s=vH(e),a=o(s,t);if(!a||!Array.isArray(a)||a.length===0)return{updatedAggregationPath:e,hasElement:!1};let c=a[0],u=o(`./*[local-name()='${r.aggregationName}']`,c);if(u&&Array.isArray(u)&&u.length>0)return{updatedAggregationPath:e+`/${Cg(t,n?.uri)}:${r.aggregationName}`,hasElement:!0};{let l=o(`./*[local-name()='${r.elementName}']`,c);if(l&&Array.isArray(l)&&l.length>0)return{updatedAggregationPath:e,hasElement:!0}}return{updatedAggregationPath:e,hasElement:!1}}function Mca(t,e){let{fs:r}=e;if(!q_(t,pr.Action))throw new Error("Expected Action building block data");let n=t.embeddedAction;if(typeof n.eventHandler=="object"){let i=jv(r,n,n.eventHandler,{typescript:n.typescript}),o=n.eventHandler?n.eventHandler.fnName:i;if(n.eventHandler.fileName?.includes(".controller"))n.eventHandler={fnName:`.${o}`};else{let s;if(n.eventHandler.fileName){let a=e.embeddedAction?.ns?.split(".").join("/");s=Lwe.posix.join(a??"",n.eventHandler.fileName)}n.eventHandler={fnName:`handler.${o}`,fileName:s}}}}function vNn(t,e,r,n,i,o){let s=i,a=!1,c="macrosTable",u,l,p=ENn[t.buildingBlockType];if(!p)return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c};if(q_(t,pr.RichTextEditorButtonGroups)||q_(t,pr.RichTextEditor)){let d=eEt(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName},{uri:p.namespace.uri,prefix:p.namespace.prefix}),h={fs:o,xmlDocument:e,updatedAggregationPath:d.updatedAggregationPath,hasAggregation:d.hasElement};p.processor(t,h),c=Cg(e,p.namespace.uri,p.namespace.prefix)}if((q_(t,pr.CustomColumn)||q_(t,pr.CustomFilterField)||q_(t,pr.CustomFormField))&&t.embededFragment){u=Bv(t.embededFragment,r,n),l=(0,Lwe.join)(u.path,`${u.fragmentFile??u.name}.fragment.xml`);let d={fs:o,viewPath:l,embeddedFragment:u};p.processor(t,d);let h=eEt(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName});s=h.updatedAggregationPath,a=h.hasElement,c=Cg(e,p.namespace.uri,p.namespace.prefix)}if(q_(t,pr.Action)&&t.embeddedAction){let d=eEt(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName}),h={fs:o,xmlDocument:e,updatedAggregationPath:d.updatedAggregationPath,hasAggregation:d.hasElement,embeddedAction:Bv(t.embeddedAction,r,n)};p.processor(t,h),s=d.updatedAggregationPath,a=d.hasElement,Cg(e,p.namespace.uri,p.namespace.prefix)}return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c}}var Lca=pe(Ma(),1),kca=pe(la(),1),TNn=pe(al(),1),SNn=require("node:path"),Fwe=pe(rU(),1);var nEt=pe(zF(),1),Uwe=pe(zo(),1);function $we(t,e,r){let n;try{n=r.read((0,SNn.join)(t,e))}catch(o){throw new Error(`Unable to read xml view file. Details: ${oZ(o)}`)}let i;try{i=new Fwe.DOMParser(Vv()).parseFromString(n,"text/xml")}catch(o){throw new Error(`Unable to parse xml view file. Details: ${oZ(o)}`)}return i}function iEt(t){if(t.buildingBlockType===pr.Page)return t.templateType===j_.Full?Dwe:void 0}function oEt(t){let e=t?(0,Uwe.coerce)(mg(t)):void 0;if(e&&(0,Uwe.lt)(e,BL)){let r=Po(ki.buildingBlock,"pageBuildingBlock.");throw new Error(`${r("fullTemplateMinUi5VersionRequirement",{minUI5Version:e.version})}`)}}function Fca(t){let e=Cg(t,"sap.fe.macros","macros");return e===""?(t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:macros","sap.fe.macros"),"macros"):e}var Uca={breadcrumbs:[{key:"Breadcrumbs",base:"breadcrumbs_breadcrumbs"},{key:"Link",base:"breadcrumbs_link"},{key:"Link1",base:"breadcrumbs_link"},{key:"Link2",base:"breadcrumbs_link"}],navigationActions:[{key:"Button",base:"navigationActions_button"}],titleContent:[{key:"GenericTag",base:"titleContent_genericTag"}],actions:[{key:"Button",base:"actions_button"},{key:"Button1",base:"actions_button"}],headerContent:[{key:"VBox",base:"headerContent_vbox"},{key:"Title",base:"headerContent_title"}],footer:[{key:"OverflowToolbar",base:"footer_overflowToolbar"},{key:"ToolbarSpacer",base:"footer_toolbarSpacer"},{key:"Button",base:"footer_button"},{key:"Button1",base:"footer_button"}]};function $ca(t,e,r=[]){let n=Uca[t]??[],i=[...r],o={};for(let{key:s,base:a}of n){let c=e(a,i);o[s]=c,i.push(c)}return o}function Vca(t,e,r,n,i){let o=Bs(`/building-block/page/${e}.xml`),s=(0,TNn.render)(t.read(o),r,{}),a=Array.from(i.documentElement.attributes).filter(u=>u.name.startsWith("xmlns:")&&u.name!==`xmlns:${n}`&&u.name!=="xmlns:m").map(u=>`${u.name}="${u.value}"`).join(" "),c=`<root xmlns:${n}="sap.fe.macros" xmlns="sap.m" xmlns:m="sap.m" ${a}>${s}</root>`;return new Fwe.DOMParser(Vv(iZ,(u,l)=>{throw new Error(`Unable to parse page aggregation fragment '${e}'. Details: [${u}] - ${l}`)})).parseFromString(c,"text/xml")}function sEt(t,e,r,n,i=Dwe,o=!0){let s=Fca(e),a=`${s}:`,c=r.documentElement;c.appendChild(r.createComment(eNn));for(let u of i){let l=n(u),p=u==="items"&&o,d=$ca(u,n),f=Vca(t,u,{macrosPrefix:a,aggId:l,showDefaultContent:p,ids:d,aggIndex:1},s,e);for(let m of Array.from(f.documentElement.childNodes))m.nodeType===1&&c.appendChild(r.importNode(m,!0))}}function bNn(t,e){let r=t.documentElement?._nsMap??{};if(nEt.useNamespaces(r)(vH(e),t).length>0)return;let i=e.lastIndexOf("/");if(i<=0)return;let o=e.slice(i+1),s=o.indexOf(":");if(s===-1)return;let a=o.slice(0,s),c=o.slice(s+1),u=r[a];if(!u&&a==="macros"&&(u="sap.fe.macros"),!u)return;Cg(t,u,a)===""&&a&&t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${a}`,u);let d=nEt.useNamespaces({...r,[a]:u})(vH(e.slice(0,i)),t);d.length!==0&&d[0].appendChild(t.createElementNS(u,`${a}:${c}`))}var jL={id:"REPLACE_WITH_BUILDING_BLOCK_ID",entitySet:"REPLACE_WITH_ENTITY",qualifier:"REPLACE_WITH_A_QUALIFIER"};function aEt(t){return t.buildingBlockType===pr.Page&&t.templateType===j_.Full}async function Bb(t,e,r){let{viewOrFragmentPath:n,aggregationPath:i,buildingBlockData:o,allowAutoAddDependencyLib:s=!0}=e;r??=(0,uEt.create)((0,cEt.create)()),await Pg(t,r,[]);let a=e.buildingBlockData.generateId??await V_({basePath:t,fsEditor:r});if(!r.exists((0,ZC.join)(t,n)))throw new Error(`Invalid view path ${n}.`);let{path:c,content:u}=await td(t,r),l=$we(t,n,r);i&&bNn(l,i);let{updatedAggregationPath:p,processedBuildingBlockData:d,hasAggregation:h,aggregationNamespace:f}=vNn({...o,generateId:a},l,c,u,i,r),m={hasAggregation:h,aggregationNamespace:f},_=Gca({...d,generateId:a},l,r,u,m),v=aEt(o),b=iEt(o);if(v&&oEt(u),b&&sEt(r,l,_,a,b,v),o.buildingBlockType===pr.RichTextEditor||o.buildingBlockType===pr.RichTextEditorButtonGroups){let S=u?(0,TH.coerce)(mg(u)):void 0;if(S&&(0,TH.lt)(S,"1.117.0")){let A=Po(ki.buildingBlock,"richTextEditorBuildingBlock.");throw new Error(`${A("minUi5VersionRequirement",{minUI5Version:S})}`)}Cg(l,"sap.fe.macros.richtexteditor","richtexteditor")}if(r=Hca(t,n,p,l,_,r,e.replace),s&&u&&!Nwe(u,["sap.fe.macros"])){let S=await yH(t,r),A=await CNn(r),C=r.read(S),D=Y_t(C);QC(r,{filepath:S,content:A,tabInfo:D})}return r}function jca(t,e){return t?{metaPath:e?`/${jL.qualifier}`:"",contextPath:e?jL.entitySet:""}:{metaPath:e?`/${jL.entitySet}/${jL.qualifier}`:""}}function qca(t,e,r,n){if(!e)return jca(t,r);let{bindingContextType:i=Vb,alwaysAbsolutePath:o=!0}=e,{entitySet:s,qualifier:a}=e;s=s||(r?jL.entitySet:"");let c=a||(r?jL.qualifier:"");if(t){let u=c.split("/");return a=u.pop(),{metaPath:a,contextPath:u.length?`/${s}/${u.join("/")}`:`/${s}`}}return n?{metaPath:`${i===Vb?"/":""}${s}/${n}`}:{metaPath:i===Vb||o?`/${s}/${c}`:c}}function ONn(t,e,r,n,i,o){let s=t.buildingBlockType,a=Bs(`/building-block/${s}/View.xml`);if(typeof t.metaPath=="object"||t.metaPath===void 0){let p=r?(0,TH.coerce)(mg(r)):void 0,d;(t.buildingBlockType===pr.RichTextEditor||t.buildingBlockType===pr.CustomFormField)&&"targetProperty"in t&&typeof t.targetProperty=="string"&&(d=t.targetProperty);let h=t.buildingBlockType===pr.Chart||!!(p&&(0,TH.lt)(p,"1.97.0")),f=qca(h,t.metaPath,i,d);t={...t,metaPath:f.metaPath},!t.contextPath&&f.contextPath&&(t.contextPath=f.contextPath)}t.id||(t.id=jL.id);let c=wwe(a),u=rZ[c],l={macrosNamespace:e?Cg(e,"sap.fe.macros","macros"):"macros",data:t,config:o};if(u?.getData){let p=u.getData(t.generateId,t);l={...l,...p}}return(0,lEt.render)(n.read(a),l,{})}async function CNn(t,e="sap.fe.macros"){let r=Bs("/building-block/common/manifest.json");return(0,lEt.render)(t.read(r),{libraries:{[e]:{}}})}function Gca(t,e,r,n,i){let o=ONn(t,e,n,r,void 0,i),s;try{s=new qL.DOMParser(Vv(iZ)).parseFromString(o,"text/xml")}catch(a){throw new Error(`Unable to parse template file with building block data. Details: ${oZ(a)}`)}return s}function Hca(t,e,r,n,i,o,s=!1){let a=n.documentElement??n.firstChild;if(!a)throw new Error(`Unable to read namespace map from view ${e}.`);let c=a?._nsMap??{},u=ANn.useNamespaces(c),l=vH(r),p=u(l,n);if(p&&Array.isArray(p)&&p.length>0){let d=p[0],h=n.importNode(i.documentElement,!0);s?d.parentNode?.replaceChild(h,d):d.appendChild(h);let f=new qL.XMLSerializer().serializeToString(n);o.write((0,ZC.join)(t,e),(0,pEt.default)(f))}else throw new Error(`Aggregation control not found ${r}.`);return o}function zca(t,e){return e?{fileName:(0,ZC.parse)(e).base,relativePath:e,fullPath:(0,ZC.join)(t,e)}:{}}async function e0(t,e,r){let n={},{buildingBlockData:i,viewOrFragmentPath:o,allowAutoAddDependencyLib:s=!0}=e;if(!i?.buildingBlockType)return{};r=r??(0,uEt.create)((0,cEt.create)());let a=o?$we(t,o,r):void 0,{content:c,path:u}=await td(t,r,!1),l=i.generateId??await V_({basePath:t,fsEditor:r}),p=ONn({...i,generateId:l},a,c,r,!0),d=p,h=iEt(i);if(h){aEt(i)&&oEt(c);let m=a??new qL.DOMParser().parseFromString('<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:macros="sap.fe.macros" xmlns="sap.m"/>',"text/xml"),_=Cg(m,"sap.fe.macros","macros")||"macros",v=`${p}`.replace(new RegExp(`^<(${_}:Page)`),`<$1 xmlns:${_}="sap.fe.macros"`),b=new qL.DOMParser(Vv(iZ,(A,C)=>{throw new Error(`Unable to parse Page building block snippet. Details: [${A}] - ${C}`)})).parseFromString(v,"text/xml");sEt(r,m,b,l,h,aEt(i));let S=b.documentElement;d=S?(0,pEt.default)(new qL.XMLSerializer().serializeToString(S)):p}let f=zca(t,o);if(n.viewOrFragmentPath={content:d,language:sZ.XML,filePathProps:f},s){let m=await CNn(r);n.manifest={content:m,language:sZ.JSON,filePathProps:{fileName:(0,ZC.parse)(u).base,relativePath:(0,ZC.relative)(t,u),fullPath:u}}}return n}function JD(t){return["CAPJava","CAPNodejs"].includes(t.projectType)}var y3=require("node:path");var l$n=pe(VC(),1);var o$n=pe(Ma(),1),s$n=pe(la(),1);var t0="attribute",Cr="text",aZ;(function(t){t.StripIndentation="StripIndentation",t.KeepIndentation="KeepIndentation"})(aZ||(aZ={}));var _t="element",GL="Edmx",QD="Edm",Vwe="reference",PNn="namespace",Jr="target",ZD="annotation-file";function wr(t,e,r,n){let i={type:t0,name:t,value:e};return r&&(i.nameRange=r),n&&(i.valueRange=n),i}function Kn(t,e,r,n){let i={type:Cr,text:t};return e&&(i.range=e),r&&(i.fragmentRanges=r),n&&(i.multilineType=n),i}function Et({name:t,range:e,nameRange:r,attributes:n,content:i,contentRange:o,namespace:s,namespaceAlias:a}){let c={type:_t,name:t,attributes:n??{},content:i??[]};return e&&(c.range=e),r&&(c.nameRange=r),o&&(c.contentRange=o),s&&(c.namespace=s),a&&(c.namespaceAlias=a),c}var eR="!";function Bwe(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function dEt(t,e,r,n){let{aliasRange:i,uriRange:o,nameRange:s,range:a}=n??{};return{type:"reference",name:t,alias:e,uri:r,range:a,nameRange:s,aliasRange:i,uriRange:o}}var cZ="TypeDefinition",HL="EnumType",G_="ComplexType",yf="Term";var xNn="Action",wNn="Function";var jwe="Property";var DNn="ActionImport",RNn="FunctionImport";var k;(function(t){t.Action="Action",t.ActionImport="ActionImport",t.Add="Add",t.Alias="Alias",t.And="And",t.Annotation="Annotation",t.Annotations="Annotations",t.AnnotationPath="AnnotationPath",t.Association="Association",t.AssociationSet="AssociationSet",t.Apply="Apply",t.Binary="Binary",t.Bool="Bool",t.Cast="Cast",t.Collection="Collection",t.ComplexType="ComplexType",t.ContainsTarget="ContainsTarget",t.Date="Date",t.DateTimeOffset="DateTimeOffset",t.Decimal="Decimal",t.DefaultValue="DefaultValue",t.Div="Div",t.Duration="Duration",t.EntityContainer="EntityContainer",t.EntitySet="EntitySet",t.EntityType="EntityType",t.EnumMember="EnumMember",t.EnumType="EnumType",t.Eq="Eq",t.Float="Float",t.Function="Function",t.FunctionImport="FunctionImport",t.Ge="Ge",t.Gt="Gt",t.Guid="Guid",t.If="If",t.In="In",t.Include="Include",t.Int="Int",t.IsOf="IsOf",t.LabeledElement="LabeledElement",t.Le="Le",t.Lt="Lt",t.MaxLength="MaxLength",t.Member="Member",t.ModelElementPath="ModelElementPath",t.Mul="Mul",t.Name="Name",t.Namespace="Namespace",t.NavigationProperty="NavigationProperty",t.NavigationPropertyPath="NavigationPropertyPath",t.Ne="Ne",t.Neg="Neg",t.Not="Not",t.Null="Null",t.Nullable="Nullable",t.OnDelete="OnDelete",t.Parameter="Parameter",t.Partner="Partner",t.Path="Path",t.Precision="Precision",t.Property="Property",t.PropertyPath="PropertyPath",t.PropertyValue="PropertyValue",t.Or="Or",t.Qualifier="Qualifier",t.Record="Record",t.Reference="Reference",t.ReferentialConstraint="ReferentialConstraint",t.ReferencedProperty="ReferencedProperty",t.ReturnType="ReturnType",t.Scale="Scale",t.Schema="Schema",t.Singleton="Singleton",t.SRID="SRID",t.String="String",t.Sub="Sub",t.Target="Target",t.Term="Term",t.TimeOfDay="TimeOfDay",t.Type="Type",t.TypeDefinition="TypeDefinition",t.Unicode="Unicode",t.UrlRef="UrlRef"})(k||(k={}));var NNn;(function(t){t.Binary="Edm.Binary",t.Boolean="Edm.Boolean",t.Byte="Edm.Byte",t.Date="Edm.Date",t.DateTimeOffset="Edm.DateTimeOffset",t.Decimal="Edm.Decimal",t.Double="Edm.Double",t.Duration="Edm.Duration",t.Guid="Edm.Guid",t.Int16="Edm.Int16",t.Int32="Edm.Int32",t.Int64="Edm.Int64",t.SByte="Edm.SByte",t.Single="Edm.Single",t.Stream="Edm.Stream",t.String="Edm.String",t.TimeOfDay="Edm.TimeOfDay",t.PrimitiveType="Edm.PrimitiveType",t.ComplexType="Edm.ComplexType",t.EntityType="Edm.EntityType",t.Untyped="Edm.Untyped",t.EntityTypeCollection="Edm.EntityTypeCollection",t.NonEntityTypeCollection="Edm.NonEntityTypeCollection",t.AnnotationPath="Edm.AnnotationPath",t.AnyPropertyPath="Edm.AnyPropertyPath",t.ModelElementPath="Edm.ModelElementPath",t.NavigationPropertyPath="Edm.NavigationPropertyPath",t.PropertyPath="Edm.PropertyPath",t.VirtualProperty="Edm.VirtualProperty",t.PrimitiveCollection="Edm.PrimitiveCollection",t.DataModelEnum="Edm.DataModelEnum"})(NNn||(NNn={}));var xo;(function(t){t.Alias="Alias",t.DataServices="DataServices",t.Edmx="Edmx",t.Import="Import",t.Include="Include",t.Namespace="Namespace",t.Reference="Reference",t.Uri="Uri",t.Version="Version"})(xo||(xo={}));var zL;(function(t){t.DataServices="DataServices",t.Edmx="Edmx",t.Include="Include",t.IncludeAnnotations="IncludeAnnotations",t.Reference="Reference"})(zL||(zL={}));var INn;(function(t){t.Uri="Uri"})(INn||(INn={}));var MNn;(function(t){t.Alias="Alias",t.Namespace="Namespace"})(MNn||(MNn={}));var EXc=new Set([zL.DataServices,zL.Edmx,zL.Include,zL.IncludeAnnotations,zL.Reference]);var zc={printWidth:300,tabWidth:4,useTabs:!1,useSnippetSyntax:!0};var LNn="missing-required-property";var qwe="common-case-issue",kNn="no-odata-path-separator";var FNn="deprecated-$value-syntax";var SH="Collection(";function Kc(t){if(t.startsWith(SH))return UNn(t);let e=t.indexOf("(")+1;if(e>0){let r=t.slice(0,e-1),n=t.slice(e,-1),i=Gwe(r),o=n.length>0?n.split(",").map(s=>s.startsWith(SH)?UNn(s):Gwe(s)):[];return{...i,type:"action-function",parameters:o}}return Gwe(t)}function UNn(t){let e=t.endsWith(")")?-1:void 0;return{...Gwe(t.slice(SH.length,e)),type:"collection"}}function Gwe(t){let e=t.split(".");return e.length>1?{type:"identifier",namespaceOrAlias:e.slice(0,-1).join("."),name:e.splice(-1)[0]}:{type:"identifier",name:t}}function rd(t,e,r){let n=r.namespaceOrAlias?t[r.namespaceOrAlias]:e;if(!n)return;if(r.type==="action-function"){let o=r.parameters.map(s=>rd(t,e,s)).filter(s=>!!s).join(",");return`${n}.${r.name}(${o})`}let i=`${n}.${r.name}`;return r.type==="collection"?`Collection(${i})`:i}function xg(t,e){let r={name:t,qName:t};if(t&&typeof t=="string"&&t.indexOf(".")){let n=t.indexOf("("),i=n>-1?t.slice(0,n):t,{name:o,namespaceOrAlias:s}=Kc(i);Kca(t,s,e,r,o),Wca(t,n,e,r,s)}return r}function _f(t,e){let r=xg(t,e.aliasMap),n=r.namespace?e.reverseAliasMap[r.namespace]:void 0,i=n?`${n}.${r.name}`:t,o=i.indexOf("(");if(o>-1){let s=i.slice(0,o),c=i.slice(o+1,i.lastIndexOf(")")).split(",");c=c.map(u=>_f(u,e)),i=s+"("+c.join(",")+")"}return i}function Kca(t,e,r,n,i){t.startsWith(SH)||(e&&r?.[e]?(r[e]&&r[e]!==e?(n.alias=e,n.namespace=r[e]):n.namespace=e,n.name=i,n.qName=n.namespace+"."+i):r||(n.name=i,n.namespace=e))}function Wca(t,e,r,n,i){if(e>-1){let o=t.slice(e+1,t.lastIndexOf(")")),s=Kc(t);if(s.type!=="collection"&&(n.name+="("+o+")"),i&&r?.[i]){if(s.type==="collection"){let a=`${s.namespaceOrAlias}.${s.name}`,c=VNn(s.type,a);c.name=xg(c.name,r).qName;let u=$Nn(c);n.qName=u}else if(s.type==="action-function"){let a=s.parameters.map(c=>{let u=`${c.namespaceOrAlias}.${c.name}`,l=VNn(c.type,u);return l.name=xg(l.name,r).qName,$Nn(l)});n.qName+="("+a.join(",")+")"}}else if(s.type==="collection"){let a=xg(o,r).qName;n.qName="Collection("+a+")"}}}function $Nn(t){return t?.asCollection?"Collection("+t.name+")":t?.name||""}function VNn(t,e){return{name:e,asCollection:t==="collection"}}function wg(t,e){let r={},n={},i={},o={},s="",a="";return t.forEach(c=>{let u={},l={};if(c?.name){u[c.name]=c.name,l[c.name]=c.name,c.alias&&(u[c.alias]=c.name,l[c.name]=c.alias),Object.assign(r,u),Object.assign(n,l);let p=e.has(c.name);c.type==="namespace"?(s=c.name,a=c.alias??"",p&&Object.assign(i,u)):Object.assign(p?i:o,u)}}),{currentFileNamespace:s,currentFileAlias:a,aliasMap:r,reverseAliasMap:n,aliasMapMetadata:i,aliasMapVocabulary:o}}function Dg(t,e){let r=[];return t?.name&&r.push(t),e?.length&&r.push(...e),r}var fEt="/";function tR(t){return{segments:t.split(fEt).map(r=>{let n=r.indexOf("@");if(n===0){let[o,s]=r.slice(1).split("#");return{...Kc(o),type:"term-cast",qualifier:s}}else if(n>0){let[o,s]=r.split("@"),a=Kc(o),[c,u]=s.split("#");return{...a,type:"navigation-property-annotation",term:{...Kc(c),type:"term-cast",qualifier:u}}}let i=Kc(r);if(i.type==="identifier"||i.type==="action-function")return i}).filter(r=>!!r)}}function bH(t,e,r){return r.segments.map(n=>Yca(t,e,n)).join(fEt)}function Yca(t,e,r){let n=r.namespaceOrAlias?t[r.namespaceOrAlias]:e;switch(r.type){case"action-function":{let i=r.parameters.map(o=>rd(t,e,o)).filter(o=>!!o).join(",");return`${n??r.namespaceOrAlias}.${r.name}(${i})`}case"identifier":return r.namespaceOrAlias===void 0?r.name:`${n??r.namespaceOrAlias}.${r.name}`;case"term-cast":return`@${rd(t,e,{...r,type:"identifier"})??""}${r.qualifier?"#"+r.qualifier:""}`;case"navigation-property-annotation":return`${rd(t,e,{type:"identifier",name:r.name,namespaceOrAlias:r.namespaceOrAlias})??""}@${rd(t,e,{...r.term,type:"identifier"})??""}${r.term.qualifier?"#"+r.term.qualifier:""}`;default:return""}}var hEt=class{forCompletion=!1;visit(e,r,n){let i=this[e.type];if(!(e.range&&!Ao(e.range,r))&&i)return i(e,r,n)}[ZD]=(e,r,n)=>this.visitChildren("references",e.references,e.range,r,n)??this.visitChildren("targets",e.targets,e.range,r,n)??this.visitChild(e.namespace,r,[...n,"namespace"]);[Jr]=(e,r,n)=>{let i=Ao(e.termsRange,r)?"terms":"";return this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitChildren("terms",e.terms,e.termsRange,r,n)??{path:[...n,i],range:e.termsRange}};[PNn]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("alias",e.alias,e.aliasRange,r,n)??{path:[...n,"targets"],range:e.range};[Vwe]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("alias",e.alias,e.aliasRange,r,n);[Cr]=(e,r,n)=>this.visitTextProperty("text",e.text,e.range,r,n);[t0]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("value",e.value,e.valueRange,r,n);[_t]=(e,r,n)=>{if(!e.range)return;let i=this.forCompletion?1:0,o=e.range.start.character+i,s=Ke.create(qt.create(e.range.start.line,o),e.range.end);if(!Ao(s,r))return;let a=Object.keys(e.attributes);if(Ao(e.nameRange,r))return this.visitTextProperty("name",e.name,e.nameRange,r,n);for(let c of a){let u=e.attributes[c],l=this.visit(u,r,[...n,"attributes",c]);if(l)return l}return Ao(e.contentRange,r)?this.visitContent(e,r,n):(e.attributes[""]=wr("",""),{path:[...n,"attributes","","name"],range:e.range})};visitContent(e,r,n){return this.visitChildren("content",e.content,e.contentRange,r,n)??this.findRelativePosition(e,r,n)}findRelativePosition(e,r,n){let i=e.content.findIndex(o=>o.range&&Xi(r,o.range.start,!0));return i===-1?(e.content.push(Kn("",e.contentRange)),{path:[...n,"content",0,"text"],range:e.contentRange}):{path:[...n,`$${i===-1?e.content.length:i}`],range:e.contentRange}}visitChildren(e,r,n,i,o){if(Ao(n,i))for(let s=0;s<r.length;s++){let a=r[s],c=this.visitChild(a,i,[...o,e,s]);if(c)return c}}visitChild(e,r,n){if(e===void 0)return;let i=this.visit(e,r,n);if(i)return i}visitTextProperty(e,r,n,i,o){if(r!==void 0&&Ao(n,i)){let s=Xca(r,n,i),a=i.character-n.start.character;return{path:[...o,e,`$${a}`],range:n,...s}}}},eJc=new hEt;function Xca(t,e,r){let n=r.character-e.start.character;return{startString:t.slice(0,n),remainingString:t.slice(n,e.end.character)}}var BNn=(t,e)=>(e.content||[]).filter(r=>r.type===_t&&(!t||t(r))),dl=(t,e)=>BNn(r=>r.name===t,e),qv=(t,e)=>t?.attributes?.[e],Vo=(t,e)=>qv(t,e)?.value??"";function KL(t,e){return t?.type===_t&&t.name===e}function Jca(t){return(t||"").replace(/\s/g,"").length===0}function AH(t){let e=!1,r=null;return(t.content||[]).forEach(n=>{e||(n.type===_t&&n.name!==k.Annotation?e=!0:n.type===Cr&&!Jca(n.text)&&(r?e=!0:r=n))}),e?null:r}function mEt(t,e,r){let i=(e.startsWith("/")?e.slice(1):e).split("/").map(c=>r?gEt(r,c):c),o=[],s=null,a=null;for(let c=0;c<i.length&&!s;c++){o.push(i[c]);let u=o.join("/"),l=t.getMetadataElement(u);l&&(a=l,(Qca(l)||Zca(t,u))&&(s=l))}return s??a}function Qca(t){return!!t.isEntityType||!!t.isComplexType||!!t.structuredType}function Zca(t,e){let r=t.getEdmTargetKinds(e),n=new Set([xNn,wNn,DNn,RNn]);return r.findIndex(i=>n.has(i))>=0}function gEt(t,e){let r="",n=e.indexOf("@");if(n>=0){let i=xg(e.substring(n+1),t.aliasMap).qName;r=e.substring(0,n)+"@"+i}else e.indexOf(".")>-1?r=xg(e,t.aliasMap).qName:r=e;return r}function Rg(t,e,r){let n=tR(r);return bH(t,e,n)}function WL(t,e,r){return r.split(" ").map(n=>Rg(t,e,n)).join(" ")}function Hwe(t,e){return e.split(" ").map(r=>_f(r,t)).join(" ")}function EEt(t,e,r){if(!t.references)return[];let n=[],i=nua(t.references),o=t.uri.startsWith(eR)||!t.namespace?e:t.namespace?.name??"",s=t.namespace?.alias??"";Object.freeze(i);for(let a=0;a<t.targets.length;a++){let c=t.targets[a],u=new Map,l=[],p=[],d={...i,[o]:o};s&&(d[s]=o);let h=Rg(d,o,c.name);for(let m=0;m<c.terms.length;m++){let _=c.terms[m],v=GNn(d,c.name,_,r),b=v.qualifier?"#"+v.qualifier:"",S=`${h}@${v.term}${b}`,A=u.get(S);r?.mergeSplitAnnotations&&A?vEt(r.mergeMap,`${S}/0/0`,`${S}/${a}/${m}`,A,v):(u.set(S,v),l.push(v)),p.push(_.range)}let f={target:h,annotations:l};r?.addOrigins&&(f.origins=p),n.push(f)}return n}function vEt(t,e,r,n,i){tua(t,e,r,n,i),i.record?n.record?qNn(t,e,r,n.record,i.record,!0):(n.record=i.record,n.origin=i.origin):i.value?(n.value=i.value,n.origin=i.origin):i.collection&&(n.origin=i.origin,n.collection=i.collection,n.collectionOrigins=i.collectionOrigins)}function qNn(t,e,r,n,i,o){rua(t,e,r,n,i,o);let s=n.propertyValues.length,a=o?"record":"Record",c={};for(let u=0;u<i.propertyValues.length;u++){let l=i.propertyValues[u];if(c[l.name])continue;let d=n.propertyValues.findIndex(h=>h.name===l.name);if(d!==-1){let h=`${e}/${a}/propertyValues/${d}`;c[l.name]=h}else if(l.value.type==="Record"){let h=`${e}/${a}/propertyValues/${u+s}`;c[l.name]=h}}eua(t,e,r,n,i,c,a,s)}function eua(t,e,r,n,i,o,s,a){for(let c=0;c<i.propertyValues.length;c++){let u=i.propertyValues[c],l=n.propertyValues.findIndex(h=>h.name===u.name),p=o[u.name]??`${e}/${s}/propertyValues/${c+a}`,d=`${r}/${s}/propertyValues/${c}`;if(l!==-1){let h=n.propertyValues[l];h.value.type==="Record"&&u.value.type==="Record"?qNn(t,`${p}/value`,`${d}/value`,h.value.Record,u.value.Record,!1):h.value=u.value}else t[p]=d,n.propertyValues.push(u),n.propertyValuesOrigins&&i.propertyValuesOrigins&&n.propertyValuesOrigins.push(i.propertyValuesOrigins[c])}}function tua(t,e,r,n,i){if(i.annotations){if(!n.annotations){n.annotations=[];for(let s=0;s<i.annotations.length;s++){let a=i.annotations[s],c=`${e}/annotations/${s}`,u=`${r}/annotations/${s}`;t[c]=u,n.annotations.push(a)}return}let o=n.annotations.length;for(let s=0;s<i.annotations.length;s++){let a=i.annotations[s],c=n.annotations.find(p=>p.term===a.term&&p.qualifier===a.qualifier),u=`${e}/annotations/${s+o}`,l=`${r}/annotations/${s}`;c?vEt(t,u,l,c,a):(t[u]=l,n.annotations.push(a))}}}function rua(t,e,r,n,i,o){if(i.annotations){let s=o?"record":"Record";if(!n.annotations){n.annotations=[];for(let c=0;c<i.annotations.length;c++){let u=i.annotations[c],l=`${e}/${s}/annotations/${c}`,p=`${r}/${s}/annotations/${c}`;t[l]=p,n.annotations.push(u)}return}let a=n.annotations.length;for(let c=0;c<i.annotations.length;c++){let u=i.annotations[c],l=n.annotations.find(h=>h.term===u.term&&h.qualifier===u.qualifier),p=`${e}/${s}/annotations/${c+a}`,d=`${r}/${s}/annotations/${c}`;l?vEt(t,p,d,l,u):(t[p]=d,n.annotations.push(u))}}}function nua(t){let e={};for(let r of t)e[r.name]=r.name,r.alias&&(e[r.alias]=r.name);return e.Edm="Edm",e}function GNn(t,e,r,n){let i=Vo(r,"Term"),o=Kc(i),s=rd(t,"",o),a=Vo(r,"Qualifier");if(s?.startsWith("com.sap.vocabularies.CDS.v1.")){let p=n?.vocabularyService?.cdsVocabulary.reverseNameMap.get(o.namespaceOrAlias+"."+o.name);p&&(s=p)}let c=TEt(t,e,r,n),u={term:s??i};c&&(u.value=c),n?.addOrigins&&(u.origin=r.range),a&&(u.qualifier=a),u.value?.type==="Record"?(u.record=u.value.Record,delete u.value):u.value?.type==="Collection"?(u.collection=u.value.Collection,n?.addOrigins&&(u.collectionOrigins=u.value.collectionOrigins),delete u.value):u.value?.type==="Unknown"&&Object.keys(u.value).length===1&&delete u.value;let l=_Et(t,e,r,n);return l.length&&(u.annotations=l),u}function _Et(t,e,r,n){return(r.content??[]).filter(i=>i.type===_t&&i.name===k.Annotation).map(i=>GNn(t,e,i,n))}var yEt=new Set([k.String,k.Bool,k.Decimal,k.Date,k.Float,k.Int,k.Path,k.PropertyPath,k.AnnotationPath,k.NavigationPropertyPath,k.EnumMember,k.Collection,k.Record,k.Apply,k.Null]);function TEt(t,e,r,n){let i=[];yEt.has(r.name)&&i.push(jNn(t,e,r,n));for(let s of Object.keys(r.attributes))if(yEt.has(s)){let a=qv(r,s);a&&i.push(HNn(t,e,a.name,a.value))}let o=(r.content??[]).filter(s=>s.type===_t&&yEt.has(s.name));for(let s of o)i.push(jNn(t,e,s,n));return i[0]}function HNn(t,e,r,n){switch(r){case"String":return{type:"String",String:n};case"Bool":return{type:"Bool",Bool:n==="true"};case"Decimal":return{type:"Decimal",Decimal:Number.parseFloat(n)};case"Date":return{type:"Date",Date:n};case"Int":return{type:"Int",Int:Number.parseInt(n,10)};case"Path":return{type:"Path",Path:Rg(t,e,n)};case"PropertyPath":return{type:"PropertyPath",PropertyPath:Rg(t,e,n)};case"AnnotationPath":return{type:"AnnotationPath",AnnotationPath:Rg(t,e,n)};case"NavigationPropertyPath":return{type:"NavigationPropertyPath",NavigationPropertyPath:Rg(t,e,n)};case"EnumMember":return{type:"EnumMember",EnumMember:WL(t,e,n)};case"Null":return{type:"Null"};default:return{type:"Unknown"}}}function jNn(t,e,r,n){switch(r.name){case"Collection":{let{collection:i,collectionOrigins:o}=oua(t,e,r,n),s={type:"Collection",Collection:i};return n?.addOrigins&&(s.collectionOrigins=o),s}case"Record":return{type:"Record",Record:iua(t,e,r,n)};case"Apply":return sua(t,e,r);default:{let o=AH(r)?.text??"";return HNn(t,e,r.name,o)}}}function iua(t,e,r,n){let i=[],o=Vo(r,"Type"),s;if(o){let l=Kc(o);s=rd(t,"",l)}let c={propertyValues:(r.content||[]).filter(l=>l.type===_t&&l.name===k.PropertyValue).map(l=>{n?.addOrigins&&i.push(l.range);let d={name:Vo(l,"Property"),value:TEt(t,e,l,n)||{type:"Unknown"}},h=_Et(t,e,l,n);return h?.length&&(d.annotations=h),d?.value?.type==="Unknown"&&Object.keys(d?.value).length===1&&(d.value={type:"Bool",Bool:!0}),d})};n?.addOrigins&&(c.propertyValuesOrigins=i),s&&(c.type=s);let u=_Et(t,e,r,n);return u.length&&(c.annotations=u),c}function oua(t,e,r,n){let i=[],o=[];return(r.content||[]).filter(s=>s.type===_t).forEach(s=>{let a=TEt(t,e,s,n),c=a;a&&typeof a=="object"&&"type"in a&&(a.type==="Record"&&"Record"in a?c=a.Record:a.type==="String"&&"String"in a&&(c=a.String)),i.push(c),n?.addOrigins&&s.range&&o.push(s.range)}),{collection:i,collectionOrigins:o}}function sua(t,e,r){let n=structuredClone(r);zNn(t,e,n);let i=Vo(r,k.Function);return{type:"Apply",$Apply:n,$Function:i}}function zNn(t,e,r){let n=r;return Object.keys(n.attributes||{}).forEach(i=>{let o=n.attributes[i];if(i===k.Term||i==="Type"){let s=Kc(o.value),a=rd(t,"",s);a&&(o.value=a)}else i==="EnumMember"?o.value=WL(t,e,o.value):i.endsWith("Path")&&(o.value=Rg(t,e,o.value))}),(n.content||[]).some(i=>i.type===_t)&&(n.content=n.content.filter(i=>!(i.type===Cr&&!(i.text||"").trim()))),aua(t,e,n),n}function aua(t,e,r){for(let n of r.content||[])if(n.type===_t)zNn(t,e,n);else if(n.type===Cr){let i=n.text;r.name==="EnumMember"?n.text=WL(t,e,i):n.type===Cr&&r.name.endsWith("Path")&&(n.text=Rg(t,e,i))}}var SEt=class{metadataService;entityTypes=[];complexTypes=[];entitySets=[];actions=[];actionImports=[];entityContainer={_type:"EntityContainer",fullyQualifiedName:""};singletons=[];constructor(e){this.metadataService=e}convert(){let e=this.metadataService.getRootMetadataElements();for(let[i,o]of e)this.convertAction(o.targetKinds,o),this.convertComplexType(o.targetKinds,o,i),this.convertEntityType(o.targetKinds,o,i),this.convertEntityContainer(o.targetKinds,o,i);let[r]=[...this.metadataService.getNamespaces()];if(this.entityContainer.fullyQualifiedName&&r){let i="EntityContainer";this.entityContainer={_type:"EntityContainer",name:i,fullyQualifiedName:r?`${r}.${i}`:i}}return{namespace:r,annotations:{},entitySets:this.entitySets,complexTypes:this.complexTypes,entityContainer:this.entityContainer,actions:this.actions,entityTypes:this.entityTypes,actionImports:this.actionImports,associations:[],singletons:this.singletons,associationSets:[],typeDefinitions:[],enumTypes:[]}}convertAction(e,r){if(!["Action","Function"].some(i=>e.includes(i)))return;let n={_type:"Action",name:r.name,fullyQualifiedName:r.path,parameters:[],returnCollection:!1,isBound:!1,sourceType:"",returnType:"",isFunction:r.kind==="Function"||r.kind==="function"};for(let i of r.content??[]){let o=this.metadataService.getEdmTargetKinds(i.path);if(KNn(o,i))n.returnType=i.structuredType??i.edmPrimitiveType??"",n.returnCollection=o.includes("Collection");else if(o.includes("Parameter")){let s={_type:"ActionParameter",isCollection:o.includes("Collection"),name:i.name,annotations:{},fullyQualifiedName:i.path,type:i.structuredType??i.edmPrimitiveType??""};i.name==="_it"&&(n.sourceType=i.structuredType??""),n.parameters.push(s)}}this.actions.push(n)}convertEntityContainer(e,r,n){if(e.includes("EntityContainer")){this.entityContainer={_type:"EntityContainer",name:r.name,fullyQualifiedName:n};for(let i of r.content??[]){let o=this.metadataService.getEdmTargetKinds(i.path);this.convertEntitySet(o,i),this.convertSingleton(o,i),this.convertFunctionImport(o,i)}}}convertFunctionImport(e,r){let n=this.metadataService.ODataVersion;if(e.includes("FunctionImport")||e.includes("ActionImport"))if(n?.startsWith("4")){let i={_type:"ActionImport",name:r.name,fullyQualifiedName:r.path,actionName:pua(r.structuredType??"")};this.actionImports.push(i)}else{let i=cua(r,e,this.metadataService);this.actions.push(i)}}convertEntitySet(e,r){if(e.includes("EntitySet")&&!e.includes("ComplexType"))if(r.isCollectionValued){let n={_type:"EntitySet",name:r.name,entityTypeName:r.structuredType??(e.includes("EntityType")?r.name:""),navigationPropertyBinding:{},fullyQualifiedName:r.path};this.entitySets.push(n)}else this.convertSingleton([...e,"Singleton"],r)}convertSingleton(e,r){if(e.includes("Singleton")){let n={_type:"Singleton",nullable:!1,name:r.name,entityTypeName:r.structuredType??(e.includes("EntityType")?r.name:""),navigationPropertyBinding:{},fullyQualifiedName:r.path};this.singletons.push(n)}}convertComplexType(e,r,n){if(e.includes("ComplexType")){let i=[],o=[];for(let a of r.content??[]){let c=this.metadataService.getEdmTargetKinds(a.path);if(c.includes("Property")){let u={_type:"Property",name:a.name,type:a.edmPrimitiveType??a.structuredType??"",fullyQualifiedName:a.path};i.push(u)}if(c.includes("NavigationProperty")){let u={_type:"NavigationProperty",name:a.name,fullyQualifiedName:a.path,targetTypeName:a.structuredType??"",isCollection:!!r.isCollectionValued,containsTarget:!1,partner:"",referentialConstraint:a.referentialConstraints??[]};o.push(u)}}let s={_type:"ComplexType",name:r.name,fullyQualifiedName:n,properties:i,navigationProperties:o};this.complexTypes.push(s)}}convertEntityType(e,r,n){if(e.includes("EntityType")&&!e.includes("ComplexType")){let i=[],o=[],s=[];for(let c of r.content??[]){let u=this.metadataService.getEdmTargetKinds(c.path);this.convertProperty(i,s,r,u,c),this.convertNavigationProperty(o,u,c)}let a={_type:"EntityType",name:r.name,fullyQualifiedName:n,entityProperties:i,keys:s,navigationProperties:o,actions:{}};this.entityTypes.push(a)}}convertProperty(e,r,n,i,o){if(i.includes("Property")&&!i.includes("NavigationProperty")){let s={_type:"Property",name:o.name,type:o.edmPrimitiveType??o.structuredType??"",fullyQualifiedName:o.path};e.push(s),n.keys?.includes(o.name)&&r.push(s)}}convertNavigationProperty(e,r,n){if(r.includes("NavigationProperty")){let i={_type:"NavigationProperty",name:n.name,fullyQualifiedName:n.path,targetTypeName:n.structuredType??"",isCollection:!!n.isCollectionValued,containsTarget:!1,partner:"",referentialConstraint:n.referentialConstraints??[]};e.push(i)}}};function cua(t,e,r){let n={_type:"Action",name:t.name,fullyQualifiedName:t.path,returnCollection:!1,parameters:[],isBound:!1,sourceType:"",returnType:"",isFunction:e.includes("FunctionImport")};for(let i of t.content){let o=r.getEdmTargetKinds(i.path);if(KNn(o,i))n.returnType=i.structuredType??i.edmPrimitiveType??"",n.returnCollection=o.includes("Collection");else if(o.includes("Parameter")){i.name==="_it"&&(n.sourceType=i.structuredType??"");let s={_type:"ActionParameter",isCollection:i.isCollectionValued??!1,fullyQualifiedName:i.path,annotations:{},name:i.name,type:i.structuredType??i.edmPrimitiveType??""};n.parameters.push(s)}}return n}function KNn(t,e){return t.includes("Parameter")&&e.name==="$Return"||t.includes("ReturnType")}var uua={},lua=new Set(["@","/","("]);function pua(t){if(!t)return t;let e=[],r=0;for(let n=0,i=!0;n<t.length;n++){let o=t[n];if(i&&o==="."){let s=t.substring(r,n);e.push(uua[s]??s),r=n,i=!1}lua.has(o)&&(e.push(t.substring(r,n+1)),r=n+1,i=!0)}return e.push(t.substring(r)),e.join("")}function zwe(t){return new SEt(t).convert()}var uZ={String:"string",Bool:"boolean",Decimal:"number",Date:"string",Float:"number",Int:"number",Path:"string",PropertyPath:"string",AnnotationPath:"string",NavigationPropertyPath:"string",EnumMember:"string",Collection:"array",Record:"object",Apply:"object",If:"object",And:"object",Or:"object",Le:"object",Lt:"object",Ge:"object",Gt:"object",Eq:"object",Ne:"object",Not:"object",Null:"null"};function bEt(t){return typeof t=="object"&&t.type!==void 0&&uZ[t.type]!==void 0}function AEt(t,e){let r=dua(Kwe(e,t.target));return r.terms=t.annotations.map(n=>r0(n,e)),r}function dua(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function r0(t,e){let r=Et({name:k.Annotation});return r.attributes[k.Term]=wr(k.Term,_f(t.term,e)),t.qualifier&&(r.attributes[k.Qualifier]=wr(k.Qualifier,t.qualifier)),t.collection?(r.content=r.content||[],r.content.push(OH(e,t.collection))):t.record?(r.content=r.content||[],r.content.push(YL(e,t.record))):t.value&&n0(e,t.value,r),t.annotations?.length&&t.annotations.forEach(n=>{r.content=r.content||[],r.content.push(r0(n,e))}),r}function OH(t,e){let r=Et({name:k.Collection});for(let n of e){let i=WNn(t,n);i&&r.content.push(i)}return r}function WNn(t,e){if(typeof e=="object")return bEt(e)?n0(t,e):YL(t,e);if(typeof e=="boolean")return Et({name:k.Bool,content:[Kn(e?"true":"false")]});if(typeof e=="string")return Et({name:k.String,content:[Kn(e)]})}function YL(t,e){let r=Et({name:k.Record});return e.type&&(r.attributes[k.Type]=wr(k.Type,_f(e.type,t))),e.propertyValues.forEach(n=>{let i=pZ(t,n);r.content.push(i)}),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(r0(n,t))})),r}function pZ(t,e){let r=Et({name:k.PropertyValue});return r.attributes[k.Property]=wr(k.Property,e.name),n0(t,e.value,r),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(r0(n,t))})),r}function n0(t,e,r){let n=uZ[e.type]?e.type:"",i=r??(n?Et({name:n}):void 0);if(i){switch(e.type){case"Collection":{let o=OH(t,e.Collection);return lZ(i,o,r)}case"Record":{let o=YL(t,e.Record);return lZ(i,o,r)}case"Apply":{let o=YNn(t,e.$Apply);return lZ(i,o,r)}case"If":case"And":case"Or":case"Le":case"Lt":case"Ge":case"Gt":case"Eq":case"Ne":case"Not":return lZ(i,Et({name:e.type}),r);case"Null":{let o=Et({name:n});return lZ(i,o,r)}case"Unknown":return;default:{let o=e[e.type],s=XL(e.type,o,t);r?(i.attributes=i.attributes||{},i.attributes[e.type]=wr(e.type,s)):i.content.push(Kn(s));break}}return i}}function YNn(t,e){let r=structuredClone(e);return XNn(r,t,!0)}function XL(t,e,r){let n=e===void 0?"":e.toString();return n&&(t===k.EnumMember?Hwe(r,n):t.indexOf("Path")>=0?Kwe(r,n):t===k.Type||t===k.Term?_f(n,r):n)}function lZ(t,e,r){return r?(t.content=t.content||[],t.content.push(e)):t=e,t}function XNn(t,e,r){let n=t;return mua(n),fua(n,e,r),hua(n,e,r),n}function fua(t,e,r){Object.keys(t.attributes||{}).forEach(n=>{let i=t.attributes[n];switch(n){case k.Term:case k.Type:i.value=r?_f(i.value,e):xg(i.value,e.aliasMap)?.qName;break;case k.EnumMember:i.value=r?Hwe(e,i.value):WL(e.aliasMap,e.currentFileNamespace,i.value);break;default:n.endsWith("Path")&&(i.value=r?Kwe(e,i.value):Rg(e.aliasMap,e.currentFileNamespace,i.value));break}})}function hua(t,e,r){for(let n of t.content??[])n.type===_t?XNn(n,e,r):n.type===Cr&&t.name===k.EnumMember?n.text=r?Hwe(e,n.text):WL(e.aliasMap,e.currentFileNamespace,n.text):n.type===Cr&&t.name.endsWith("Path")&&(n.text=r?Kwe(e,n.text):Rg(e.aliasMap,e.currentFileNamespace,n.text))}function mua(t){(t.content??[]).some(e=>e.type===_t)&&(t.content=t.content.filter(e=>!(e.type===Cr&&!(e.text??"").trim())))}function gua(t,e){let[r,n]=e.split("@");return n?`${r}@${_f(n,t)}`:e.indexOf(".")>-1?_f(e,t):e}function Kwe(t,e){return e.split("/").map(r=>gua(t,r)).join("/")}function JL(t,e,r){let n=[""],i=e.split("/").filter(a=>!!a),o=t,s;return i.forEach(a=>{if(!o||!n){n=[];return}let c={subElementIndex:-1};switch(a){case"annotations":s=k.Annotation;break;case"record":case"Record":c=Wwe(o,k.Record,0);break;case"propertyValues":s=k.PropertyValue;break;case"collection":case"Collection":c=Wwe(o,k.Collection,0),s="";break;case"value":n.push(...yua(o,r));break;case"type":n.push("attributes","Type","value");break;default:if(Number.isNaN(Number(a))){let{subElement:u,clearPath:l,pathSegments:p}=_ua(a,o);c.subElement=u,n=l?[]:[...n,...p??[]]}else s!==null&&(c=Wwe(o,s,Number(a)),s=void 0);break}c?.subElementIndex>=0&&n.push("content",c.subElementIndex.toString()),c?.subElement&&(o=c.subElement)}),n.join("/")}function yua(t,e){if(e===void 0)return[];if(t.attributes[e])return["attributes",e];let r=t.content.findIndex(n=>n.type===_t&&n.name===e);return r!==-1?["content",r.toString()]:[]}function _ua(t,e){return uZ[t]?Eua(e,t):e.attributes[QNn(t)]?{pathSegments:["attributes",QNn(t),"value"]}:t==="name"?{pathSegments:["attributes",k.Property,"value"]}:{clearPath:!0}}function Eua(t,e){if(t?.attributes[e])return{pathSegments:["attributes",e,"value"]};if(t.name===e){let s=JNn(t);return s<0?{clearPath:!0}:{pathSegments:["content",s.toString()]}}let{subElement:r,subElementIndex:n}=Wwe(t,e,0);if(n<0)return{clearPath:!0,subElement:r};let i=["content",n.toString()],o=JNn(t.content[n]);return o<0?{clearPath:!0,subElement:r}:(i.push("content",o.toString()),{subElement:r,pathSegments:i})}function JNn(t){return t.content.findIndex(e=>e.type===Cr)}function Wwe(t,e,r){let n={subElementIndex:-1},i=-1;for(let o=0;o<t.content.length;o++){let s=t.content[o];s.type===_t&&(!e||s.name===e)&&(i++,i===r&&(n.subElement=s,n.subElementIndex=o))}return n}function QNn(t){let e=t;return t&&(e=t.slice(0,1).toUpperCase()+t.slice(1)),e}var Fi;(function(t){t[t.General=1]="General",t[t.CompileError=2]="CompileError",t[t.ComplexityViolation=3]="ComplexityViolation",t[t.LocalAnnotationFileNotFound=4]="LocalAnnotationFileNotFound"})(Fi||(Fi={}));var Mn=class extends Error{errorCode;messageMap;constructor(e,r,n){super(e),this.messageMap=n??new Map,this.errorCode=r??Fi.General}toString(e=!1){let r=super.toString();if(e){let n=this.messageMap.size>0?this.convertMessages():"";return[r,`Error code: ${this.errorCode}`,n].join(". ")}return r}getExtendedMessage(){let e=this.message;return this.messageMap.size>0?[e,this.convertMessages()].join(". "):e}convertMessages(){let e="Other messages:";for(let[r,n]of this.messageMap.entries()){e+=`
2472
+ `,"").trim()})}}}function wks(t,e,r,n){if(t.codeLists&&(r.term==="com.sap.vocabularies.CodeList.v1.CurrencyCodes"||r.term==="com.sap.vocabularies.CodeList.v1.UnitsOfMeasure")&&r.record){let i=Zyn(r.record,"CollectionPath"),o=Zyn(r.record,"Url");o&&e.push({type:"code-list",serviceRootPath:n,value:o,collectionPath:i??void 0})}}function Zyn(t,e){let r=t.propertyValues.find(n=>n.name===e);if(r?.value?.type==="String")return r.value.String}var Dks=pe(zo(),1);var NVc=(0,yOe.dirname)((0,i_n.fileURLToPath)(__importMetaUrl));var xk=require("node:path"),gqn=pe(JAe()),yqn=pe(bOn());var AOn={errors:{odataQueryError:"An error occurred when querying for odata: {{error}}. $t(texts.seeLogForDetails)",dataNotFetched:"Data was not fetched",entityModelLoading:"An error occurred when reading the data model: {{- error}}. $t(texts.seeLogForDetails)"},info:{loggingInitialised:"Logger has been configure with level: {{logLevel}}",noServiceEntityData:"No service entity data to write.",noValueHelpData:"No Value Help service data to write.",entityFilesToBeGenerated:"The following entity files will be created: {{entities}}",noListEntityDefined:"No list entity defined. A main list entity is required to download data.",hierarchyEntityQuery:"Fetching hierarchy data for entity set: {{entitySetName}}...",hierarchyFilesGenerated:"The following hierarchy data files were created: {{entities}}"},texts:{seeLogForDetails:"For more information, view the logs.",rows_one:"{{count}} row",rows_other:"{{count}} rows",generatorTitle:"SAP Fiori Elements Data Downloader"},prompts:{appSelection:{message:"Select an application as data download target",breadcrumb:"Selected App",validation:{specficationApiVersionOutdated:"The found version of @sap/ux-specification {{specApiVersion}} is too old. Data download cannot proceed.",selectedPathDoesNotContainValidApp:"The selected path does not contain a valid application. {{- error}}",appMainServiceOdataVersionNotSupported:"The selected apps main service odata version is '{{serviceOdataVersion}}'. Please select an app with a main service odata version '4'."}},relatedEntitySelection:{message:"Select entities for data download (pre-selected entities are referenced by the application)",openLogs:"Show Logs"},toggleSelection:{message:"Reset selection",labelTrue:"Clear selected",labelFalse:"Restore default selection"},entityKey:{message:"Enter values for: {{keyName}}",hint:"For range selection use '-' between values. Use commas to select non-contiguous values.",validation:{invalidKeyValueChars:"Invalid key value contain not allowed characters: {{chars}}",invalidRangeSpecified:"Invalid range specified, only the lowest and highest values allowed. e.g. '1-10'",invalidBooleanValue:"Invalid Boolean value entered. Please enter true or false.",invalidGuidValue:"Invalid GUID format. Expected format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}},skipDataDownload:{message:"If data download is not required select this option and proceed to Value Help download",hint:"Use this to temporarily disable live queries when entering multiple inputs and re-enable when ready",labelTrue:"Execute the OData query (data files will be generated on finish)",labelFalse:"Suppress the OData query (prevents multiple queries during selections)",querySuccess:'OData query success. $t(texts.rows, {"count": "{{count}}") returned. $t(texts.seeLogForDetails)',validation:{keyRequired:"Please enter at least one key field value to run the OData query"},choiceLabel:"Skip data download"},updateMainServiceMetadata:{message:"Update local metadata file from backend (remote service metadata is always used for data download):",validation:{errorLoadingAppOrMainService:"An error occurred while loading the application. Please correct the issue to proceed: {{- error}}"}},valueHelpSelection:{message:"Select Value Help data"}},steps:{odataDownloader:{name:"Configure Data Download",description:"Download data from an OData service for use with the UX Tools Mockdata Server"},valueHelpSelection:{name:"Value Help selection",description:"Value Help selection"},addConstraints:{name:"Add Missing Constraints",description:"Add Missing Constraints"}},telemetry:{unknownOs:"Unknown"}};var OOn=Dn.createInstance(),mCe="odata-dowload-generator";async function fmt(){await OOn.init({resources:{en:{[mCe]:AOn}},lng:"en",fallbackLng:"en",defaultNS:mCe,ns:[mCe],missingInterpolationHandler:()=>""})}function vr(t,e){return e?.ns||(e=Object.assign(e??{},{ns:mCe})),OOn.t(t,e)}fmt().catch(t=>console.error("Failed to initialize i18n:",t));var _bt=require("@sap-devx/yeoman-ui-types");var hmt;(function(t){t.official="officialVersions",t.snapshot="snapshotsVersions",t.support="support"})(hmt||(hmt={}));var gCe="1.65.0";var yCe=pe(zo(),1);var OQ=pe(zo(),1);var nt={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},nGs=[{version:"1.149.*",support:nt.maintenance},{version:"1.148.*",support:nt.maintenance},{version:"1.147.*",support:nt.outOfMaintenance},{version:"1.146.*",support:nt.outOfMaintenance},{version:"1.145.*",support:nt.maintenance},{version:"1.144.*",support:nt.outOfMaintenance},{version:"1.143.*",support:nt.outOfMaintenance},{version:"1.142.*",support:nt.maintenance},{version:"1.141.*",support:nt.outOfMaintenance},{version:"1.140.*",support:nt.outOfMaintenance},{version:"1.139.*",support:nt.outOfMaintenance},{version:"1.138.*",support:nt.outOfMaintenance},{version:"1.136.*",support:nt.maintenance},{version:"1.135.*",support:nt.outOfMaintenance},{version:"1.134.*",support:nt.outOfMaintenance},{version:"1.133.*",support:nt.outOfMaintenance},{version:"1.132.*",support:nt.outOfMaintenance},{version:"1.131.*",support:nt.outOfMaintenance},{version:"1.130.*",support:nt.outOfMaintenance},{version:"1.129.*",support:nt.outOfMaintenance},{version:"1.128.*",support:nt.outOfMaintenance},{version:"1.127.*",support:nt.outOfMaintenance},{version:"1.126.*",support:nt.outOfMaintenance},{version:"1.125.*",support:nt.outOfMaintenance},{version:"1.124.*",support:nt.outOfMaintenance},{version:"1.123.*",support:nt.outOfMaintenance},{version:"1.122.*",support:nt.outOfMaintenance},{version:"1.121.*",support:nt.outOfMaintenance},{version:"1.120.*",support:nt.maintenance},{version:"1.119.*",support:nt.outOfMaintenance},{version:"1.118.*",support:nt.outOfMaintenance},{version:"1.117.*",support:nt.outOfMaintenance},{version:"1.116.*",support:nt.outOfMaintenance},{version:"1.115.*",support:nt.outOfMaintenance},{version:"1.114.*",support:nt.outOfMaintenance},{version:"1.113.*",support:nt.outOfMaintenance},{version:"1.112.*",support:nt.outOfMaintenance},{version:"1.111.*",support:nt.outOfMaintenance},{version:"1.110.*",support:nt.outOfMaintenance},{version:"1.109.*",support:nt.outOfMaintenance},{version:"1.108.*",support:nt.maintenance},{version:"1.107.*",support:nt.outOfMaintenance},{version:"1.106.*",support:nt.outOfMaintenance},{version:"1.105.*",support:nt.outOfMaintenance},{version:"1.104.*",support:nt.outOfMaintenance},{version:"1.103.*",support:nt.outOfMaintenance},{version:"1.102.*",support:nt.outOfMaintenance},{version:"1.101.*",support:nt.outOfMaintenance},{version:"1.100.*",support:nt.outOfMaintenance},{version:"1.99.*",support:nt.outOfMaintenance},{version:"1.98.*",support:nt.outOfMaintenance},{version:"1.97.*",support:nt.outOfMaintenance},{version:"1.96.*",support:nt.maintenance},{version:"1.95.*",support:nt.outOfMaintenance},{version:"1.94.*",support:nt.outOfMaintenance},{version:"1.93.*",support:nt.outOfMaintenance},{version:"1.92.*",support:nt.outOfMaintenance},{version:"1.91.*",support:nt.outOfMaintenance},{version:"1.90.*",support:nt.outOfMaintenance},{version:"1.89.*",support:nt.outOfMaintenance},{version:"1.88.*",support:nt.outOfMaintenance},{version:"1.87.*",support:nt.outOfMaintenance},{version:"1.86.*",support:nt.outOfMaintenance},{version:"1.85.*",support:nt.outOfMaintenance},{version:"1.84.*",support:nt.outOfMaintenance},{version:"1.82.*",support:nt.outOfMaintenance},{version:"1.81.*",support:nt.outOfMaintenance},{version:"1.80.*",support:nt.outOfMaintenance},{version:"1.79.*",support:nt.outOfMaintenance},{version:"1.78.*",support:nt.outOfMaintenance},{version:"1.77.*",support:nt.outOfMaintenance},{version:"1.76.*",support:nt.outOfMaintenance},{version:"1.75.*",support:nt.outOfMaintenance},{version:"1.74.*",support:nt.outOfMaintenance},{version:"1.73.*",support:nt.outOfMaintenance},{version:"1.72.*",support:nt.outOfMaintenance},{version:"1.71.*",support:nt.maintenance},{version:"1.70.*",support:nt.outOfMaintenance},{version:"1.69.*",support:nt.outOfMaintenance},{version:"1.68.*",support:nt.outOfMaintenance},{version:"1.67.*",support:nt.outOfMaintenance},{version:"1.66.*",support:nt.outOfMaintenance},{version:"1.65.*",support:nt.outOfMaintenance},{version:"1.64.*",support:nt.outOfMaintenance},{version:"1.63.*",support:nt.outOfMaintenance},{version:"1.62.*",support:nt.outOfMaintenance},{version:"1.61.*",support:nt.outOfMaintenance},{version:"1.60.*",support:nt.outOfMaintenance},{version:"1.58.*",support:nt.outOfMaintenance},{version:"1.56.*",support:nt.outOfMaintenance},{version:"1.54.*",support:nt.outOfMaintenance},{version:"1.52.*",support:nt.outOfMaintenance},{version:"1.50.*",support:nt.outOfMaintenance},{version:"1.48.*",support:nt.outOfMaintenance},{version:"1.46.*",support:nt.outOfMaintenance},{version:"1.44.*",support:nt.outOfMaintenance},{version:"1.42.*",support:nt.outOfMaintenance},{version:"1.40.*",support:nt.outOfMaintenance},{version:"1.38.*",support:nt.maintenance},{version:"1.36.*",support:nt.outOfMaintenance},{version:"1.34.*",support:nt.outOfMaintenance},{version:"1.32.*",support:nt.outOfMaintenance},{version:"1.30.*",support:nt.outOfMaintenance},{version:"1.28.*",support:nt.outOfMaintenance},{version:"1.26.*",support:nt.outOfMaintenance},{version:"1.24.*",support:nt.outOfMaintenance},{version:"1.22.*",support:nt.outOfMaintenance},{version:"*",support:nt.outOfMaintenance}],mmt=nGs.filter(t=>t.support===nt.maintenance&&(0,OQ.gte)((0,OQ.coerce)(t.version)??"0.0.0",gCe)).map(t=>({version:(0,OQ.coerce)(t.version)?.version??"0.0.0",support:nt.maintenance})),iGs=[...mmt].map(t=>t.version);var gmt=pe(zo(),1);var aGs="1.72.0",xOn="1.102.0",cGs="1.136.0",uGs="1.120.0",bg;(function(t){t.SAP_BELIZE="sap_belize",t.SAP_FIORI_3="sap_fiori_3",t.SAP_FIORI_3_DARK="sap_fiori_3_dark",t.SAP_HORIZON="sap_horizon",t.SAP_HORIZON_DARK="sap_horizon_dark"})(bg||(bg={}));var lGs={[bg.SAP_BELIZE]:{id:bg.SAP_BELIZE,label:"Belize",supportUntil:cGs,deprecateSince:uGs},[bg.SAP_FIORI_3]:{id:bg.SAP_FIORI_3,label:"Quartz Light"},[bg.SAP_FIORI_3_DARK]:{id:bg.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:aGs},[bg.SAP_HORIZON]:{id:bg.SAP_HORIZON,label:"Morning Horizon",supportSince:xOn},[bg.SAP_HORIZON_DARK]:{id:bg.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:xOn}};var UOn=pe(ROn(),1),ymt=pe(zo(),1);var NOn={prompts:{username:{message:"Username"},password:{message:"Password"}},ui5VersionLabels:{maintained:"Maintained",outOfMaintenance:"Out of maintenance",version_one:"version",version_other:"versions"},errors:{destination:{unavailable:"The selected destination references an instance that is not available. Please check your destination configuration and try again.",notFound:"The destination target URL cannot be found. The request failed with status code 404. Please check the destination target URL connectivity in your SAP BTP cockpit.",notReachable:"The selected system is not reachable. System Name: {{systemName}}, Error: {{- error}}.",misconfigured:'The destination is misconfigured. $t(errors.destination.missingPropMsg, {"destinationProperty": "{{destinationProperty}}" })',missingPropMsg:"The property: `{{destinationProperty}}` is missing.",httpConnectionError:"A connection error occurred with the selected destination. HTTP Code: {{- code}}. $t(texts.seeLogForDetails)"},unknownError:"An error occurred{{- error, addMsgWithColonFormatter}}",servicesUnavailable:"An error occurred retrieving services for the SAP System.",certificateError:"A certificate error has occurred{{- errorMsg, addMsgWithColonFormatter}}",urlCertValidationError:"The system URL is using {{certErrorReason}} security certificate.",authenticationFailed:"Authentication incorrect. {{- error}}",authenticationTimeout:"Authorization was not verified within the allowed time. Please ensure you have authenticated using the associated browser window.",invalidUrl:"Invalid URL{{-input, addMsgWithColonFormatter}}",connectionError:"A connection error occurred. Please ensure the target host is available on the network: {{- error}}",timeout:"A connection timeout error occurred{{- errorMsg, addMsgWithColonFormatter}}",serverReturnedAnError:"The server returned an error. {{- errorDesc}}",serverUnableToCompleteRequest:"The server was unable to complete the request. Please try again.",catalogServiceNotActive:"Catalog service is not active.",urlNotFound:"URL not found.",odataServiceUrlNotFound:"The service URL you have provided is not a valid OData Service. SAP Fiori applications require an OData service as the data source.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",redirectError:"A redirect response was received from the server",abapEnvsUnavailable:"ABAP environments unavailable.",noSuchHostError:"No such host is known. Ensure the host is available.",noAbapEnvsInCFSpace:"No ABAP environments in CF space found. Ensure an ABAP environment exists.",abapEnvsCFDiscoveryFailed:"Discovering ABAP Environments failed. Please ensure you are logged into Cloud Foundry. For more information, see https://docs.cloudfoundry.org/cf-cli/getting-started.html#login.",systemConnectionValidationFailed:"A connection to the selected system cannot be established. Ensure the credentials are valid.",internalServerError:"Internal server error{{-errorMsg, addMsgWithColonFormatter}}",badGateway:"Bad gateway{{- errorMsg, addMsgWithColonFormatter}}",badRequest:"Bad request{{- errorMsg, addMsgWithColonFormatter}}",cannotBeEmpty:"{{- field}} cannot be empty.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata."},guidedAnswers:{validationErrorHelpText:"Need help with this error?"},texts:{anExpiredCert:"an expired",aSelfSignedCert:"a self-signed",anUnknownOrInvalidCert:"an unknown or invalid",anUntrustedRootCert:"an untrusted root",suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, see the log.",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration."}};var IOn="inquirer-common",_Ce=Dn.createInstance();function ECe(){_Ce.addResourceBundle("en",IOn,NOn)}async function fGs(){await _Ce.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),_Ce.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),ECe()}function Yr(t,e){return e?.ns||(e=Object.assign(e??{},{ns:IOn})),_Ce.t(t,e)}fGs().catch(()=>{});var yGs=pe(SCe(),1);function gG(t,e){return t&&e?UOn.default.filter(t,e,{extract:r=>r.name??""}).map(r=>r.original):e}var bCe=class{message;link;constructor(e){Object.assign(this,e)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var CQ=pe(nre(),1);function _Gs(t,e,r){let n=t.additionalMessages;return(i,o)=>{let s={...(0,CQ.default)(o),...(0,CQ.default)(r)},a=e(i,s);return a||(typeof n=="function"?n(i,o):void 0)}}function EGs(t,e,r){let n=t.validate;return(i,o)=>{let s={...(0,CQ.default)(o),...(0,CQ.default)(r)},a=e?.(i,s);return a!==!0?a:typeof n=="function"?n(i,o):!0}}function vGs(t,e,r,n){let i;return r==="validate"&&e.validate&&(i=EGs(t,e.validate,n)),r==="additionalMessages"&&e.additionalMessages&&(i=_Gs(t,e.additionalMessages,n)),t=Object.assign(t,{[r]:i}),t}function pl(t,e){return t.forEach(r=>{if(r.when!==void 0)if(typeof r.when=="function"){let n=r.when;r.when=i=>e(i)?n(i):!1}else{let n=r.when;r.when=i=>e(i)&&n}else r.when=e}),t}function _mt(t,e,r){return t.forEach(n=>{let i=n.name,o=e[n.name];if(o){let s=Object.keys(o);for(let a of s){(a==="validate"||a==="additionalMessages")&&(n=vGs(n,o,a,r));let c=e[i].default;c&&(n.default=c)}}}),t}var Emt="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var vmt={FIORI_TOOLS:3046},Qp={FIORI_TOOLS:45995,DEV_PLATFORM:45996,FIORI_APP_GENERATOR:48363,BAS_CATALOG_SERVICES_REQUEST_FAILED:48366,APPLICATION_PREVIEW:52881,CERTIFICATE_ERROR:53643,DESTINATION_MISCONFIGURED:54336,DESTINATION_UNAVAILABLE:51208,DESTINATION_NOT_FOUND:51208,BAD_GATEWAY:48366,DESTINATION_SERVICE_UNAVAILBLE:52526,NO_V4_SERVICES:57573,NO_ADT_SERVICE_AUTH:57266,DESTINATION_CONNECTION_ERRORS:48366,UI_SERVICE_GENERATOR:63068,DESTINATION_GATEWAY_TIMEOUT:57914,ADT_APP_NOT_FOUND_ERROR:63911,DESTINATION_FULL_URL:68172,ABAP_REPO_APP_DOWNLOAD_FAILED:68669};var $On="sap.ux.guidedAnswer.openGuidedAnswer",TGs="https://ga.support.sap.com/dtp/viewer/index.html";function VOn(t,e){let r="";return e.length>0&&(r=`/actions/${e.join(":")}`),`${TGs}#/tree/${t}${r}`}var BOn=pe(yAe(),1);var Smt,Tmt;function jOn(){return Smt}function OL(t,e){let r=SGs(t,e);Smt&&Smt.reportEvent(r,lc.NoSampling)}function SGs(t,e){Tmt=Tmt??(0,BOn.default)();let r=Object.assign(e,{OperatingSystem:Tmt,Platform:e.Platform||hy().technical});return{eventName:t,properties:r,measurements:{}}}function ACe(t){return Roe(t)?"AbapODataCatalogDest":DP(t)?"GenericODataFullUrlDest":bE(t)?"GenericODataPartialUrlDest":"Unknown"}var bGs="GA_LINK_CREATED",AGs="SERVICE_INQUIRER_BAS_ERROR",Me;(function(t){t.AUTH="AUTH",t.AUTH_TIMEOUT="AUTH_TIMEOUT",t.REDIRECT="REDIRECT",t.CERT="CERT",t.CERT_SELF_SIGNED="CERT_SELF_SIGNED",t.CERT_UKNOWN_OR_INVALID="CERT_UKNOWN_OR_INVALID",t.CERT_EXPIRED="CERT_EXPIRED",t.CERT_SELF_SIGNED_CERT_IN_CHAIN="CERT_SELF_SIGNED_CERT_IN_CHAIN",t.INVALID_SSL_CERTIFICATE="INVALID_SSL_CERTIFICATE",t.UNKNOWN="UNKNOWN",t.INVALID_URL="INVALID_URL",t.TIMEOUT="TIMEOUT",t.CONNECTION="CONNECTION",t.SERVICES_UNAVAILABLE="SERVICES_UNAVAILABLE",t.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",t.NO_ABAP_ENVS="NO_ABAP_ENVS",t.CATALOG_SERVICE_NOT_ACTIVE="CATALOG_SERVICE_NOT_ACTIVE",t.NO_SUCH_HOST="NO_SUCH_HOST",t.NOT_FOUND="NOT_FOUND",t.ODATA_URL_NOT_FOUND="ODATA_URL_NOT_FOUND",t.BAD_GATEWAY="BAD_GATEWAY",t.GATEWAY_TIMEOUT="GATEWAY_TIMEOUT",t.INTERNAL_SERVER_ERROR="INTERNAL_SERVER_ERROR",t.DESTINATION_SERVICE_UNAVAILABLE="DESTINATION_SERVICE_UNAVAILABLE",t.DESTINATION_UNAVAILABLE="DESTINATION_UNAVAILABLE",t.DESTINATION_NOT_FOUND="DESTINATION_NOT_FOUND",t.DESTINATION_MISCONFIGURED="DESTINATION_MISCONFIGURED",t.NO_V2_SERVICES="NO_V2_SERVICES",t.NO_V4_SERVICES="NO_V4_SERVICES",t.BAD_REQUEST="BAD_REQUEST",t.DESTINATION_CONNECTION_ERROR="DESTINATION_CONNECTION_ERROR",t.SERVER_HTTP_ERROR="SERVER_HTTP_ERROR"})(Me||(Me={}));var OGs={[Me.AUTH]:[/401/,/403/,/Incorrect credentials were provided to login/,/Unable to retrieve SAP Business Accelerator Hub key/],[Me.AUTH_TIMEOUT]:[/UAATimeoutError/],[Me.TIMEOUT]:[/Timeout/],[Me.CERT]:[],[Me.CERT_UKNOWN_OR_INVALID]:[/UNABLE_TO_GET_ISSUER_CERT/,/UNABLE_TO_GET_ISSUER_CERT_LOCALLY/,/unable to get local issuer certificate/,/UNABLE_TO_VERIFY_LEAF_SIGNATURE/,/ERR_TLS_CERT_ALTNAME_INVALID/],[Me.CERT_EXPIRED]:[/CERT_HAS_EXPIRED/],[Me.CERT_SELF_SIGNED]:[/DEPTH_ZERO_SELF_SIGNED_CERT/],[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:[/SELF_SIGNED_CERT_IN_CHAIN/],[Me.INVALID_SSL_CERTIFICATE]:[/526/,/Invalid SSL Certificate/],[Me.UNKNOWN]:[],[Me.CONNECTION]:[/ENOTFOUND/,/ECONNRESET/,/ECONNREFUSED/,/EPROTO/,/ConnectionError/],[Me.SERVICES_UNAVAILABLE]:[],[Me.SERVICE_UNAVAILABLE]:[/503/],[Me.INVALID_URL]:[/Invalid URL/,/ERR_INVALID_URL/],[Me.REDIRECT]:[/3\d\d/],[Me.NO_ABAP_ENVS]:[],[Me.CATALOG_SERVICE_NOT_ACTIVE]:[/\/IWBEP\/CM_V4_COS\/014/,/\/IWFND\/CM_V4_COS\/021/,/Service group '\/IWFND\/CONFIG' not published/],[Me.NO_SUCH_HOST]:[/no such host/],[Me.NOT_FOUND]:[/404/],[Me.ODATA_URL_NOT_FOUND]:[],[Me.INTERNAL_SERVER_ERROR]:[/500/],[Me.BAD_GATEWAY]:[/502/],[Me.GATEWAY_TIMEOUT]:[/504/],[Me.DESTINATION_SERVICE_UNAVAILABLE]:[],[Me.DESTINATION_UNAVAILABLE]:[],[Me.DESTINATION_NOT_FOUND]:[],[Me.DESTINATION_MISCONFIGURED]:[],[Me.NO_V2_SERVICES]:[],[Me.NO_V4_SERVICES]:[],[Me.BAD_REQUEST]:[/400/],[Me.DESTINATION_CONNECTION_ERROR]:[],[Me.SERVER_HTTP_ERROR]:[/5\d\d/]},Oo=class t{currentErrorMsg;currentErrorType;static _guidedAnswersEnabled;static _logger;static _platform;static get platform(){return t._platform}static set platform(e){t._platform=e}static _guidedAnswersTrigger;static get guidedAnswersTrigger(){return t._guidedAnswersTrigger}static set guidedAnswersTrigger(e){t._guidedAnswersTrigger=e}static getMessageFromError=e=>e?.message||e?.status?.toString()||e?.response?.status?.toString()||(typeof e=="string"?e:JSON.stringify(e));static serverErrorMessage=(e,r)=>Yr("errors.serverReturnedAnError",{errorDesc:r?Yr(r,{errorMsg:t.getMessageFromError(e)}):t.getMessageFromError(e)});static _errorTypeToMsg={[Me.CERT]:e=>Yr("errors.certificateError",{errorMsg:t.getMessageFromError(e)}),[Me.CERT_EXPIRED]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anExpiredCert")}),[Me.CERT_SELF_SIGNED]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.aSelfSignedCert")}),[Me.CERT_UKNOWN_OR_INVALID]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anUnknownOrInvalidCert")}),[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anUntrustedRootCert")}),[Me.INVALID_SSL_CERTIFICATE]:()=>Yr("errors.urlCertValidationError",{certErrorReason:Yr("texts.anUnknownOrInvalidCert")}),[Me.AUTH]:e=>Yr("errors.authenticationFailed",{error:t.getMessageFromError(e)}),[Me.AUTH_TIMEOUT]:()=>Yr("errors.authenticationTimeout"),[Me.TIMEOUT]:e=>Yr("errors.timeout",{errorMsg:t.getMessageFromError(e)}),[Me.INVALID_URL]:()=>Yr("errors.invalidUrl"),[Me.CONNECTION]:e=>Yr("errors.connectionError",{error:t.getMessageFromError(e)}),[Me.UNKNOWN]:e=>Yr("errors.unknownError",{error:t.getMessageFromError(e)}),[Me.SERVICES_UNAVAILABLE]:()=>Yr("errors.servicesUnavailable"),[Me.SERVICE_UNAVAILABLE]:e=>t.serverErrorMessage(e),[Me.CATALOG_SERVICE_NOT_ACTIVE]:()=>Yr("errors.catalogServiceNotActive"),[Me.INTERNAL_SERVER_ERROR]:e=>t.serverErrorMessage(e,"errors.internalServerError"),[Me.NOT_FOUND]:()=>Yr("errors.urlNotFound"),[Me.ODATA_URL_NOT_FOUND]:()=>Yr("errors.odataServiceUrlNotFound"),[Me.BAD_GATEWAY]:e=>t.serverErrorMessage(e,"errors.badGateway"),[Me.DESTINATION_UNAVAILABLE]:()=>Yr("errors.destination.unavailable"),[Me.DESTINATION_NOT_FOUND]:()=>Yr("errors.destination.notFound"),[Me.DESTINATION_MISCONFIGURED]:e=>Yr("errors.destination.misconfigured",{destinationProperty:typeof e=="string"?e:""}),[Me.NO_V2_SERVICES]:()=>Yr("errors.noServicesAvailable",{version:"2"}),[Me.NO_V4_SERVICES]:()=>Yr("errors.noServicesAvailable",{version:"4"}),[Me.DESTINATION_SERVICE_UNAVAILABLE]:()=>Yr("errors.destination.unavailable"),[Me.REDIRECT]:()=>Yr("errors.redirectError"),[Me.NO_SUCH_HOST]:()=>Yr("errors.noSuchHostError"),[Me.NO_ABAP_ENVS]:()=>Yr("errors.abapEnvsUnavailable"),[Me.BAD_REQUEST]:e=>t.serverErrorMessage(e,"errors.badRequest"),[Me.DESTINATION_CONNECTION_ERROR]:()=>Yr("errors.systemConnectionValidationFailed"),[Me.SERVER_HTTP_ERROR]:e=>t.serverErrorMessage(e),[Me.GATEWAY_TIMEOUT]:e=>t.serverErrorMessage(e)};static _errorMsg=(e,r)=>t._errorTypeToMsg[e](r);static getHelpNode=e=>{let r=Si();return{[Me.SERVICES_UNAVAILABLE]:r?Qp.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[Me.CERT]:Qp.CERTIFICATE_ERROR,[Me.CERT_EXPIRED]:Qp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED]:Qp.CERTIFICATE_ERROR,[Me.CERT_UKNOWN_OR_INVALID]:Qp.CERTIFICATE_ERROR,[Me.INVALID_SSL_CERTIFICATE]:Qp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:Qp.CERTIFICATE_ERROR,[Me.DESTINATION_MISCONFIGURED]:Qp.DESTINATION_MISCONFIGURED,[Me.DESTINATION_UNAVAILABLE]:Qp.DESTINATION_UNAVAILABLE,[Me.DESTINATION_NOT_FOUND]:Qp.DESTINATION_NOT_FOUND,[Me.BAD_GATEWAY]:Qp.BAD_GATEWAY,[Me.DESTINATION_SERVICE_UNAVAILABLE]:Qp.DESTINATION_SERVICE_UNAVAILBLE,[Me.NO_V4_SERVICES]:Qp.NO_V4_SERVICES,[Me.GATEWAY_TIMEOUT]:r?Qp.DESTINATION_GATEWAY_TIMEOUT:void 0,[Me.AUTH]:void 0,[Me.AUTH_TIMEOUT]:void 0,[Me.REDIRECT]:void 0,[Me.UNKNOWN]:void 0,[Me.INVALID_URL]:void 0,[Me.CONNECTION]:void 0,[Me.SERVICE_UNAVAILABLE]:void 0,[Me.NO_ABAP_ENVS]:void 0,[Me.CATALOG_SERVICE_NOT_ACTIVE]:void 0,[Me.NO_SUCH_HOST]:void 0,[Me.NOT_FOUND]:void 0,[Me.ODATA_URL_NOT_FOUND]:void 0,[Me.INTERNAL_SERVER_ERROR]:void 0,[Me.NO_V2_SERVICES]:void 0,[Me.TIMEOUT]:void 0,[Me.BAD_REQUEST]:void 0,[Me.DESTINATION_CONNECTION_ERROR]:Qp.DESTINATION_CONNECTION_ERRORS,[Me.SERVER_HTTP_ERROR]:void 0}[e]};static findErrorValueForMapping=e=>e.response?.data?.error?.code||e.response?.status||e.response?.data||e.code||(["TypeError","Error"].includes(e.name)?e.message:e.name)||e.message||e;constructor(e,r=!1,n){t._logger=e??new vc({logPrefix:n??"@sap-ux/inquirer-common"}),t.guidedAnswersEnabled=r}static get guidedAnswersEnabled(){return t._guidedAnswersEnabled}static set guidedAnswersEnabled(e){t._guidedAnswersEnabled=e}static set logger(e){t._logger=e}static get logger(){return t._logger}static isCertError(e){return[Me.CERT,Me.CERT_EXPIRED,Me.CERT_SELF_SIGNED,Me.CERT_UKNOWN_OR_INVALID,Me.CERT_SELF_SIGNED_CERT_IN_CHAIN].includes(t.getErrorType(e))}static getErrorType(e){let r=e;return e instanceof Error&&(r=t.findErrorValueForMapping(e)),Object.keys(Me).find(n=>OGs[n].find(i=>i.test(r.toString())))}logErrorMsgs(e,r,n=!0){let i={errorMsg:"",errorType:Me.UNKNOWN};if(Object.values(Me).includes(e)){let o=e;i.errorMsg=t.getErrorMsgFromType(o)??o.toString(),i.errorType=o}else typeof e=="string"?i.errorMsg=e:i=t.mapErrorToMsg(e);return t._logger.error(r?`${r} ${i.errorMsg}`:i.errorMsg),n&&(this.currentErrorMsg=r??i.errorMsg,this.currentErrorType=i.errorType),i.errorMsg}static mapErrorToMsg(e){let r;return Object.values(Me).includes(e)?r=e:r=t.getErrorType(this.findErrorValueForMapping(e))??Me.UNKNOWN,{errorMsg:t._errorMsg(r,e),errorType:r}}getErrorMsg(e,r,n){let i;return e&&typeof e!="boolean"&&(i=t.mapErrorToMsg(e).errorMsg),i||(i=this.currentErrorMsg??(n?t.getErrorMsgFromType(n):void 0)),(e===!0||r)&&(this.currentErrorMsg=null,this.currentErrorType=null),i}resetErrorState(){this.currentErrorMsg=null,this.currentErrorType=null}getValidationErrorHelp(e,r=!1,n){let i,o,s;if(e?{errorMsg:o,errorType:s}=t.mapErrorToMsg(e):(o=this.currentErrorMsg??void 0,this.currentErrorType&&(s=this.currentErrorType)),s){if(n){let{errorType:a,errorMsg:c}=t.getDestinationSpecificError(s,n);o=c??o,s=a??s}s&&(i=t.getHelpForError(s,o))}return r&&(this.currentErrorMsg=null,this.currentErrorType=null),i??o}static getDestinationSpecificError(e,r){let n,i;return WHt(r)?e===Me.SERVICE_UNAVAILABLE?KHt(r)?n=Me.DESTINATION_SERVICE_UNAVAILABLE:n=Me.DESTINATION_CONNECTION_ERROR:e===Me.NOT_FOUND?(n=Me.DESTINATION_NOT_FOUND,i=this.getErrorMsgFromType(Me.DESTINATION_NOT_FOUND)):Me.INTERNAL_SERVER_ERROR===e||Me.SERVER_HTTP_ERROR===e?n=Me.DESTINATION_CONNECTION_ERROR:e===Me.AUTH&&r.Authentication!==$T.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(Me.AUTH,Yr("texts.checkDestinationAuthConfig"))):(n=Me.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),OL(AGs,{basErrorType:n??e,destODataType:ACe(r),Platform:this._platform??hy().technical}),{errorType:n??e,errorMsg:i}}static getErrorMsgFromType(e,r){if(Me[e])return t._errorMsg(Me[e],r)}hasError(e=!1){let r=!!this.currentErrorMsg;return e&&(this.currentErrorMsg=null,this.currentErrorType=null),r}setCurrentError(e,r){this.currentErrorMsg=t._errorMsg(Me[e],r),this.currentErrorType=e}getCurrentErrorType(e=!1){let r=this.currentErrorType;return e&&(this.currentErrorMsg=null,this.currentErrorType=null),r}static getHelpForError(e,r){let n=t.getHelpNode(e),i=r??t.getErrorMsgFromType(e);return n&&i?this.getHelpLink(n,e,i):i}static getHelpLink(e,r,n){let i={message:n,link:{text:Yr("guidedAnswers.validationErrorHelpText"),icon:Emt,url:VOn(vmt.FIORI_TOOLS,[e])}};return this.guidedAnswersEnabled&&(i.link.command={id:$On,params:{treeId:vmt.FIORI_TOOLS,nodeIdPath:[e],trigger:this.guidedAnswersTrigger}}),OL(bGs,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${e}`,Platform:this.platform??hy().technical}),new bCe(i)}};var qOn=pe(Ooe(),1);async function GOn(t){let e=[];try{let r=[qA.ABAP,qA.ABAP_TRIAL,qA.ABAP_CANARY,qA.ABAP_OEM,qA.ABAP_OEM_CANARY,qA.ABAP_HAAS,qA.ABAP_STAGING,qA.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(o=>o.trim()):[],i=await(0,qOn.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(o=>{e.push({name:o.label,value:o})}):t.logErrorMsgs(Me.NO_ABAP_ENVS,Yr("errors.noAbapEnvsInCFSpace"))}catch{t.logErrorMsgs(Me.NO_ABAP_ENVS,Yr("errors.abapEnvsCFDiscoveryFailed"))}return e.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var CGs=pe(VC(),1),PGs=pe(yD(),1);var vva=pe(QDn(),1);var ZDn={deploy:{abapAppDescLength:"The deployment description cannot exceed 60 characters.",abapTransportNumRequired:"Provide a transport request for your application.",abapPackageWarn:"Provide a package.",abapAppNameRequired:"The application name is required.",abapInvalidNamespace:"The namespace is invalid because there are too many forward slashes.",abapInvalidNamespaceLength:"The namespace is limited to 10 characters. Entered {{length}}.",abapInvalidAppNameLength:"The application name is limited to 15 characters. Entered {{length}}.",abapInvalidAppName:"The application name must be prefixed with [{{prefix}}].",charactersForbiddenInAppName:"Only alphanumeric, underscore, and slash characters are allowed.",invalidAppNameMultipleReason:"The application name is invalid for multiple reasons:"},ui5:{namespaceMustStartWithLetter:"The namespace must start with a letter.",namespaceEndInPeriod:"The namespace cannot end with a period.",namespaceCannotBeSap:"The namespace cannot be {{str}}.",namespaceStartsWithNew:"The namespace cannot start with {{str}}.",namespaceNumberAfterPeriod:"A number cannot follow a period in the namespace.",lowerAlphaNumericOnly:"Only use lowercase alphanumeric characters.",lowerAlphaNumericDotsOnly:"Only use lowercase alphanumeric characters and dots for the namespace.",namespaceSpecialCharacter:"The namespace can only contain letters, digits, dots, and underscores.",moduleNameMustStartWithLetter:"The module name must start with a letter.",nameCombinedTooLong:"The combined length of the namespace and module name must not exceed {{length}} characters.",folderDoesNotExist:"This folder does not exist. Please enter the root folder for your project.",folderDoesNotHaveCorrectPermissions:"The selected folder does not have the required permissions. Please ensure you have permission to write to the selected folder and try again.",enterProjectFolder:"Please enter a project folder.",nameNull:"The module name cannot be null.",nameUndefined:"The module name cannot be undefined.",nameNotString:"The module name must be a string.",nameLengthZero:"The module name's length must be greater than zero.",nameStartsWithPeriod:"The module name cannot start with a period.",nameStartsWithUnderscore:"The module name cannot start with an underscore.",nameStartsOrEndsWithSpace:"The module name cannot contain leading or trailing spaces.",nameBlocklisted:"{{modName}} is a blocklisted module name. Choose a different name.",nameIsCoreModule:"{{modName}} is a core module name. Choose a different name.",nameTooLong:"The module name cannot exceed {{length}} characters.",nameTooShort:"The module name must be at least {{length}} characters.",inputValueContainsCapital:"{{promptName}} cannot contain capital letters",nameContainsSpecialCharacters:`The module name cannot contain special characters: ("~'!()*)`,nameNotUrlFriendly:"The module name can only contain URL-friendly characters.",invalidModuleName:"Invalid module name.",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path.",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must use the local CAP project as the data source.",viewNameRequired:"You must provide a view name to continue.",viewNameTooLong:"The view name cannot contain more than {{maxLength}} characters.",viewNameInvalid:"The view name must start with a letter and may contain letters, digits, dashes, and underscores."},general:{invalidUrl:"Invalid URL: [{{-input}}]",invalidClient:"[{{client}}] is invalid. Leave this field empty or enter a value between 000-999.",inputCannotBeEmpty:"The input cannot be empty.",inputCannotHaveSpaces:"The input cannot contain spaces.",invalidJSON:"Invalid JSON.",invalidValueForSpecialChars:"The input must only contain Latin alphanumeric characters or the following symbols: '-','_','$' and '.'.",maxLength:"The maximum length is: {{maxLength}} characters.",supportedFormats:"Only alphanumeric and '{{allowedCharacters}}' characters are allowed.",nameContainsSpecialCharacters:`Module name cannot contain special characters ("~'!()*)`,nameNotUrlFriendly:"Module name can only contain URL-friendly characters",invalidModuleName:"Invalid module name",moduleAlreadyExists:"The module folder named: {{folderName}} already exists at the specified path",appFolderExistsAtPath:"A module with this name already exists in the folder: {{-path}}",folderContainsCapApp:"The selected project folder is part of an existing CAP project. This application must therefore use the local CAP project as the data source.",folderContainsFioriApp:"The project folder path already contains an SAP Fiori application in the folder: {{-path}}. Please choose a different folder and try again.",windowsFolderPathTooLong:"The combined length {{length}} of the target folder and module name exceeds the default Windows path length. This can cause issues with project generation."},adp:{projectNameUppercaseError:"The project name cannot contain uppercase letters.",projectNameLengthErrorExt:"The project name cannot exceed 61 characters or end with the word 'component'.",projectNameValidationErrorExt:"The project name must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",projectNameLengthErrorInt:"The project name cannot start with the word 'customer', exceed 61 characters, or end with the word 'component'.",projectNameValidationErrorInt:"The project name must only contain Latin alphanumeric characters and it must have at least two parts. The different parts must be separated by a period and every part must start with a letter.",duplicatedProjectName:"A project with this name already exists in your workspace. Please choose another name.",differentNamespaceThanProjectName:"The namespace must be the same as the project name.",namespaceSameAsProjectNameError:"The namespace must be the same as the project name.",namespaceLengthError:"The namespace cannot exceed 61 characters or end with the word 'component'.",namespaceValidationError:"The namespace must only contain alphanumeric characters. Every part must start with a letter and different parts can be separated by a period.",achMandatoryError:"The Application Component Hierarchy must only contain capital letters, digits, and dashes."}};var eRn="project-input-validator",P_t=Dn.createInstance();function lwe(){P_t.addResourceBundle("en",eRn,ZDn)}async function tRn(){await P_t.init({lng:"en",fallbackLng:"en"}),lwe()}function UL(t,e){return e?.ns||(e=Object.assign(e??{},{ns:eRn})),P_t.t(t,e)}tRn().catch(()=>{});var uaa=pe(iRn(),1);function oRn(t){let e=t?.trim()||"";return e===""||/^\d{3}$/.test(e)?!0:UL("general.invalidClient",{client:t})}var sRn={prompts:{datasourceType:{message:"Data Source",projectSpecificDestName:"Project Specific Destination",businessHubName:"SAP Business Accelerator Hub",sapSystemName:"System",odataServiceUrlName:"OData Service",capProjectName:"Local CAP Project",metadataFileName:"Metadata Document",choiceNone:"$t(texts.choiceNameNone)",projectSpecificDestChoiceText:"Connect to a $t(prompts.datasourceType.projectSpecificDestName)",businessHubChoiceText:"Connect to $t(prompts.datasourceType.businessHubName)",sapSystemChoiceText:"Connect to a $t(prompts.datasourceType.sapSystemName)",odataServiceUrlChoiceText:"Connect to an $t(prompts.datasourceType.odataServiceUrlName)",capProjectChoiceText:"Use a $t(prompts.datasourceType.capProjectName)",metadataFileChoiceText:"Upload a $t(prompts.datasourceType.metadataFileName)",notYetImplementedWarningMessage:"The selected data source type: {{ datasourceType }} is not yet implemented."},metadataFile:{message:"Metadata File Path",description:"Upload a metadata file",placeholder_odata_service_url:"/here/goes/your/serviceurl/"},capProject:{message:"Choose a CAP Project",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capProjectPath:{message:"CAP Project Folder Path",description:"Select a local CAP project",breadcrumb:"CAP Project",enterCapPathChoiceName:"Manually select CAP project folder path"},capService:{message:"OData Service",description:"Select a local CAP service",breadcrumb:"CAP Service",enterCapPathChoiceName:"Manually select CAP service folder path"},odataServiceUrl:{message:"OData{{odataVersion, odataVersionFormatter}} service URL"},ignoreCertErrors:{message:"Do you want to continue generation with the untrusted certificate?"},serviceUsername:{message:"Service username"},servicePassword:{message:"Service password"},validationMessages:{odataVersionMismatch:"The template you have chosen supports V{{requiredOdataVersion}} OData services only. The provided version is V{{providedOdataVersion}}.",metadataInvalid:"The service metadata is invalid.",metadataFilePathNotValid:"The metadata file does not exist or is not accessible. Please specify a valid file path.",capProjectNotFound:"The folder you have selected does not contain a valid CAP project. Please check and try again.",warningCertificateValidationDisabled:"Certificate validation has been disabled by the user.",annotationsNotFound:"Annotations not found for the specified service.",backendSystemExistsWarning:'A saved system connection entry: "{{- backendName}}" already exists with the same URL and client. Please reuse the existing entry or remove it, using the systems panel, before adding a new connection.',systemUrlOriginOnlyWarning:"System URLs must only contain the hostname and may also include the port, for example, 'https://abc.com:123/'."},warnings:{nonUIServiceTypeWarningMessage:"Services of service type: {{serviceType}} or without a service type are not intended to be used for generating SAP Fiori UI applications.",noServicesAvailable:"There are no services available for the selected system. For more information, see the logs.",noServicesAvailableForOdataVersion:"There are no OData V{{odataVersion}} services available from the selected system and the template you have chosen only supports OData V{{odataVersion}} services.",noAnnotations:"No back-end annotations associated with this service were retrieved. This can result in an invalid application.",collaborativeDraftMessage:"The selected service is draft-enabled but does not support collaborative draft."},systemUrl:{message:"System URL",description:"Enter the URL of the SAP System",placeholder:"https://<host>:<port>"},sapClient:{message:"SAP client (leave empty for default)",breadcrumb:"SAP Client"},systemUsername:{message:"Username"},systemPassword:{message:"Password"},storeSystemCredentials:{message:"Do you want to store the system credentials?",breadcrumb:"Store Credentials"},systemService:{message:"Service",breadcrumb:"Service",noServicesWarning:"No services available for the selected system. For more information, see the logs."},newSystemType:{choiceAbapOnPrem:"ABAP On Premise",choiceAbapOnBtp:"ABAP Environment on SAP Business Technology Platform",choiceCFAbapEnvServiceOnBtp:"Cloud Foundry ABAP environment on SAP Business Technology Platform",message:"System Type",notYetImplementedWarningMessage:"The selected system type: {{ systemType }} is not yet implemented."},systemName:{message:"System name",hint:"Entering a system name will save the connection for re-use.",systemNameExistsWarning:"A system with that name already exists in the secure storage. Please try a different name.",reservedSystemNameWarning:"'{{ systemName }}' is a reserved system name. Please try a different name.",emptySystemNameWarning:"System name cannot be empty."},systemSelection:{newSystemChoiceLabel:"New System",hint:"Select a system configuration.",message:"System",authenticationFailedUpdateCredentials:"$t(texts.authenticationFailed). Please try updating the credentials."},abapOnBTPType:{message:"ABAP environment definition source",choiceReentranceTicket:"Use Reentrance Ticket",choiceServiceKey:"Upload a Service Key File",choiceCloudFoundry:"Discover a Cloud Foundry Service"},serviceKey:{message:"Service Key File Path",hint:"Select a local file that defines the service connection for an ABAP Environment on SAP Business Technology Platform.",incompleteServiceKeyInfo:"The service keys file does not contain the required information. Check the file is valid and try again.",unparseableServiceKey:"The service keys file does not contain a valid JSON format. Check the formatting and try again."},cloudFoundryAbapSystem:{message:"ABAP environment",hint:"Enter the name of the Cloud Foundry service that contains the ABAP Environment instance."},destinationServicePath:{message:"Service Path",hint:"Enter the path to the OData service relative to the selected destination URL.",invalidServicePathWarning:"Please enter a valid service path"},mainEntitySelection:{message:"Main Entity",defaultEntityNameNotFoundWarning:"The supplied entity cannot be found in the service. Please choose from the list above.",noDraftEnabledEntitiesError:"The CAP service you have chosen does not have any entities that are draft enabled. To generate an OData V4 SAP Fiori application using this floorplan for a CAP project, the entity selected must be draft enabled.",mainEntityParameterFoundInfo:"The selected entity '{{entityName}}' requires a parameter which is set by the application filters. Navigation entities are not supported.",noEntitiesError:"$t(errors.noRelevantEntities)",noEntitiesAlpV4Error:"The OData V4 service you have provided is not suitable for use in an analytical list page application. The service must contain aggregate-based entities for this template.",requiredError:"Please select a main entity to continue."},navigationEntitySelection:{message:"Navigation Entity",choiceNone:"$t(texts.choiceNameNone)"},filterEntitySet:{message:"Filter Entity",noEntitiesError:"$t(errors.noRelevantEntities)"},pageBuildingBlock:{message:"Add a Page Building Block to the Application?",tooltip:"The Page building block is supported from SAPUI5 version {{ minUi5VersionForPageBuildingBlock }}. By choosing this option, you are restricting the minimum SAPUI5 version to {{ minUi5VersionForPageBuildingBlock }} and above.",titleMessage:"Page Title",layoutMessage:"Page Building Block Layout",choiceFull:"Full Layout",choiceBasic:"Basic Layout",basicLayoutWarning:"The Page building block is supported with SAPUI5 version {{ minUi5VersionForPageBuildingBlock }} and above.",fullLayoutWarning:"Full Layout is supported with SAPUI5 version {{ minUi5VersionForFullLayout }} and above."},tableType:{message:"Table Type",hint:"Defines the table type for the list report page.",requiredError:"Please select a table type to continue.",choiceNone:"$t(texts.choiceNameNone)",choiceGrid:"Grid",choiceAnalytical:"Analytical",choiceResponsive:"Responsive",choiceTree:"Tree",analyticalTableDefault:"The 'Analytical' table type is chosen by default because the selected entity supports it.",treeTableDefault:"The 'Tree' table type is chosen by default because the selected entity supports it.",responsiveTableInfo:"Only use the responsive table if the total number of items in the table doesn't exceed 200."},hierarchyQualifier:{message:"Hierarchy Qualifier",hint:"Leading property that decides between either a recursive hierarchy or data aggregation.",qualifierRequiredForV4Warning:"Hierarchy qualifier is required for OData V4 services."},addFEOPAnnotations:{message:"Automatically add a form to the generated application if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations"},addLineItemAnnotations:{message:"Automatically add table columns to the list page and a section to the object page if none already exists?",hint:"Choose the annotation generation method.",breadcrumb:"Generate Annotations",valueHelpsAnnotationsInfoMessage:"Basic value helps will also be created."},presentationQualifier:{message:"Qualifier",hint:"Represents the qualifier of the `SelectionPresentationVariant`. The analytical list page looks for a `SelectionPresentationVariant` with this qualifier and if not found, it looks for a `PresentationVariant` with this qualifier."},tableSelectionMode:{message:"Selection Mode",hint:"Defines different selection modes for the `SmartTable` in the analytical list page.",choiceNone:"$t(texts.choiceNameNone)",choiceSingle:"Single",choiceAuto:"Auto",choiceMulti:"Multi"},tableMultiSelect:{message:"Allow Multi Select",hint:"Allows you to show a checkbox for selecting multiple items in a table. This setting comes into effect only if there are actions defined either by using an annotation or a setting in the `manifest.json` file."},tableAutoHide:{message:"Auto Hide",hint:"Determines the chart or table interaction. If set to `true`, the chart acts as a filter for the table. If set to `false`, the matching table rows are highlighted but the table is not filtered."},smartVariantManagement:{message:"Enable Smart Variant Management",hint:"Enables page level variant."},valueHelpDownload:{message:"The service contains references to value help services. Do you want to download the associated metadata during generation? This may increase generation time.",hint:"Download metadata for value help to improve the user experience with dropdowns and search."}},errors:{destination:{authError:"The selected system: {{systemName}} returned an authentication error: {{- error}}.",listDestinations:"An error occurred when retrieving the list of destinations: {{- error}}."},cannotReadCapServiceMetadata:"An error occurred reading CAP service metadata: {{serviceName}}. $t(texts.seeLogForDetails).",capModelAndServicesLoadError:"An error occurred loading the CAP model and services: {{- error, addMsgWithColonFormatter}}.",capServiceUrlPathNotDefined:"An error occurred reading CAP service metadata: {{serviceName}}. The CAP service property: `urlPath` is not defined but it is required.",unknownError:"An error occurred: {{- error, addMsgWithColonFormatter}}.",authenticationFailed:"$t(texts.authenticationFailed): {{error}}.",authenticationFailedSpecificCatalog:"{{authFailType}}: Unable to access the OData V{{odataVersion}} service catalog",authenticationFailedAllCatalogs:"{{authFailType}}: Unable to access any service catalogs",invalidUrl:"Invalid URL: {{-input, addMsgWithColonFormatter}}.",connectionError:"A connection error occurred. Ensure the target host is available on the network: {{- error}}",urlNotFound:"URL not found.",noServicesAvailable:"There are no OData V{{version}} services available from the selected system and the template you have chosen only supports OData V{{version}} services.",abapEnvsUnavailable:"ABAP environments unavailable.",systemOrServiceUrlNotFound:"Please verify the URL: {{- url}}, target system configuration and network connectivity.",urlRedirect:"The service URL is redirecting.",certValidationRequired:"Certificate validation is required to continue.",exitingGeneration:"Exiting generation. Exit: {{exitReason}}.",serviceMetadataError:"An error occurred when reading the service metadata for service: {{- servicePath}}. Error: {{errorText}}",serviceMetadataErrorUI:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" }) $t(texts.seeLogForDetails)',serviceMetadataErrorLog:'$t(errors.serviceMetadataError, {"servicePath": "{{- servicePath}}", "errorText": "{{errorText}}" })',serviceTypeRequestError:"An error occurred when retrieving the service type: {{- error}}.",abapServiceAuthenticationFailed:"ABAP environment authentication using UAA failed.",serviceCatalogRequest:"An error occurred requesting services from: {{- catalogRequestUri }} and entity set: {{entitySet}}: {{error}}.",storedSystemConnectionError:"An error occurred when validating the stored system connection info. System Name: {{-systemName}}. Error: {{- error}}.",noCatalogOrServiceAvailable:"No active system or OData service endpoint connection available to retrieve the server.",allCatalogServiceRequestsFailed:"All catalog service requests failed for the selected system. OData version: V{{version}}.",unparseableMetadata:"Unable to parse entities from the metadata document: {{-error}}.",unparseableOdataVersion:"Unable to parse the OData version from the metadata.",unparseableXML:"Unparseable XML was specified: {{-error}}.",noRelevantEntities:"The template and service selected have no relevant entities that you can use.",cfInstanceCredentialsNotReturned:"Cannot not retrieve credentials to access: {{serviceInstanceName}}.",v2CatalogServiceNoAnnotations:"An error occurred when creating an OData V2 catalog service object. Annotations will not be available: {{-error}}",backendSystemRetrieval:"An error occurred when retrieving the backend systems from the store: {{-error}}"},warnings:{largeMetadataDocument:"The metadata for this OData service is very large. It may take some time before this operation completes.",warningCertificateValidationDisabled:"User has disabled certificate validation",nonUIServiceTypeWarningMessage:"Please note that {{serviceType}} services, or not classified services, are not intended to be used for the generation of SAP Fiori UI applications",noServicesAvailable:"No services available for the selected system, see logs for further details.",noServicesAvailableForOdataVersion:"There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only",noAnnotations:"No backend annotations associated with this service were retrieved and may result in an invalid application being created",collaborativeDraftMessage:"The selected service is draft enabled but does not support collaborative draft.",certificateErrors:"A certificate error occurred when connecting to the host: {{-url}}. Certificate error: {{error}}.",allowingUnauthorizedCertsNode:"Setting the `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `0` makes TLS connections and HTTPS requests insecure by disabling certificate verification. It is important to understand the security risks when using this setting.",certErrorIgnoredByNodeSetting:"An SSL certificate error is being ignored by the 'NODE_TLS_REJECT_UNAUTHORIZED=0' Node.js setting. This makes TLS connections and HTTPS requests insecure by disabling certificate verification. For details of the certification error, see the logs.",noExternalServiceMetdataFetched:"No external service metadata was fetched. $t(texts.seeLogForDetails)",missingServices:"OData V{{odataVersion}} services are not available.",specifiedServicesNotAvailable_one:"The required OData service: {{-service}} is not available from the {{odataVersion}}services catalog. Please ensure the service is available.",specifiedServicesNotAvailable_other:"The required OData services are not available from the {{odataVersion}}services catalog. Please ensure the services are available. $t(texts.seeLogForDetails)",storedSystemUrlPathNotSupported:"The stored cloud system URL '{{- systemUrl}}' contains a path which is not supported for reentrance ticket authentication. The path is ignored for this connection."},texts:{suggestedSystemNameClient:", client {{client}}",seeLogForDetails:"For more information, view the logs.",forUserName:"(for user [{{username}}])",httpStatus:"HTTP Status {{httpStatus}}",checkDestinationAuthConfig:"Please check the SAP BTP destination authentication configuration.",choiceNameNone:"None",passwordStoreWarning:"Passwords are stored in your operating system's credential manager and are protected by its security policies.",authorizationFailed:"Authorization failed",authenticationFailed:"Authentication failed"}};var aRn="odata-service-inquirer";var YQ=Dn.createInstance();async function cRn(){await YQ.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),YQ.services.formatter?.add("odataVersionFormatter",t=>t?` V${t}`:""),YQ.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),YQ.addResourceBundle("en",aRn,sRn),ECe(),lwe()}function Ze(t,e){return e?.ns||(e=Object.assign(e??{},{ns:aRn})),YQ.t(t,e)}cRn().catch(()=>{});var XQ;(function(t){t.sapSystem="sapSystem",t.capProject="capProject",t.odataServiceUrl="odataServiceUrl",t.none="none",t.metadataFile="metadataFile",t.projectSpecificDestination="projectSpecificDestination",t.businessHub="businessHub"})(XQ||(XQ={}));var pwe="sap-client";var rs;(function(t){t.datasourceType="datasourceType",t.metadataFilePath="metadataFilePath",t.capProject="capProject",t.capService="capService",t.serviceUrl="serviceUrl",t.serviceUrlPassword="serviceUrlPassword",t.serviceSelection="serviceSelection",t.userSystemName="userSystemName",t.systemSelection="systemSelection",t.valueHelpDownload="valueHelpDownload"})(rs||(rs={}));var $L=pe(vRn(),1),Mt=class t{static _logger=new vc({logPrefix:"@sap-ux/odata-service-inquirer"});static get logger(){return t._logger}static set logger(e){t._logger=e}static attachAxiosLogger(e){let r=typeof t.logger.getLogLevel=="function"&&t.logger.getLogLevel()==="trace",n=t.logger.debug.bind(t.logger);e.request.use(i=>(i.url||n(`Request URL: ${i.baseURL}`),$L.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>$L.errorLogger(i,{logger:n})),e.response.use(i=>$L.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>$L.errorLogger(i,{logger:n}))}};var Xt=class t{static odataService={};static isYUI=!1;static backendSystemsCache=[];static reset(){Object.keys(t.odataService).forEach(e=>{t.odataService[e]=void 0})}static resetConnectedSystem(){t.odataService.connectedSystem=void 0}};var ORn=pe(VC(),1),CRn=pe(yD(),1),N_t=pe(ARn(),1);function ed(){return Xt.isYUI?Si()?mo.bas:mo.vscode:mo.cli}function PRn(t){try{let e=(0,ORn.convert)((0,CRn.parse)(t)),r=Number.parseInt(e?.version,10);if(Number.isNaN(r))throw Mt.logger.error(Ze("errors.unparseableOdataVersion")),new Error(Ze("errors.unparseableOdataVersion"));return{odataVersion:r===4?$s.v4:$s.v2,convertedMetadata:e}}catch(e){throw Mt.logger.error(e),new Error(Ze("prompts.validationMessages.metadataInvalid"))}}function XC(t){if(t)return t===$s.v2?xn.v2:xn.v4}function Ewe(t){if(t?.length===1)return 0}function JC(t){for(let e in t.services)t.services?.[e].log&&(t.services[e].log=(0,N_t.removeSync)(t.services[e]?.log,{setUndefined:!0}));return t.log&&(t.log=(0,N_t.removeSync)(t.log,{setUndefined:!0})),t}function mH(t,e,r){let n=new af({url:e,client:r}).getId();return t.find(i=>af.from(i).getId()===n)}function xRn(t,e){return!t&&!e||t?.length===0&&e?.length===0||t===e?!0:!t||!e?!1:[...t].sort().toString()===[...e].sort().toString()}var Ci=new Oo(void 0,void 0,"@sap-ux/odata-service-inquirer");var I_t;(function(t){t.capProjectPath="capProjectPath",t.capCliStateSetter="capCliStateSetter"})(I_t||(I_t={}));function vwe(t,e){try{let{convertedMetadata:r,odataVersion:n}=PRn(t);if(e&&e!==n){let i=Ze("prompts.validationMessages.odataVersionMismatch",{providedOdataVersion:n,requiredOdataVersion:e});return Mt.logger.error(i),{validationMsg:i}}return{version:n,convertedMetadata:r}}catch(r){return{validationMsg:r.message}}}var H_t=require("@sap-devx/yeoman-ui-types");var wRn=new Set([Me.CERT_SELF_SIGNED,Me.CERT_SELF_SIGNED_CERT_IN_CHAIN,Me.CERT_EXPIRED,Me.CERT_UKNOWN_OR_INVALID,Me.INVALID_SSL_CERTIFICATE]),$_=class{validity={};_validatedUrl;_destinationUrl;_destination;_validatedClient;_odataService;_serviceProvider;_axiosConfig;_catalogV2;_catalogV4;_systemAuthType;_serviceInfo;_connectedUserName;_connectedSystemName;_refreshToken;_ignoreCertError;_connectType="abap_catalog";get ignoreCertError(){return this._ignoreCertError}get axiosConfig(){return this._axiosConfig}get odataService(){return this._odataService}get catalogs(){return{[xn.v2]:this._catalogV2,[xn.v4]:this._catalogV4}}get serviceProvider(){return this._serviceProvider}get systemAuthType(){return this._systemAuthType}set systemAuthType(e){this._systemAuthType=e}get validatedUrl(){return this._validatedUrl}get validatedClient(){return this._validatedClient}get serviceInfo(){return this._serviceInfo}set serviceInfo(e){this._serviceInfo=e}get connectedUserName(){return this._connectedUserName}get refreshToken(){return this._refreshToken}get destinationUrl(){return this._destinationUrl}get destination(){return this._destination}get connectType(){return this._connectType}get connectedSystemName(){return this._connectedSystemName?this._connectedSystemName:this.systemAuthType==="serviceKey"?this.serviceInfo?.systemid:this.validatedUrl}set connectedSystemName(e){this._connectedSystemName=e}setConnectedSystem({serviceProvider:e,backendSystem:r}){if(!e.catalog){Mt.logger.debug("ConnectionValidator.setConnectedSystem(): Use of a cached connected system is only supported for AbapServiceProviders. Re-authorization will be required.");return}this._serviceProvider=e,this._catalogV2=this._serviceProvider.catalog(xn.v2),this._catalogV4=this._serviceProvider.catalog(xn.v4),this._validatedUrl=r?.serviceKeys?.url??r?.url,this._connectedUserName=r?.userDisplayName,this._validatedClient=r?.client,this._refreshToken=r?.refreshToken,this._serviceInfo=r?.serviceKeys,this.validity.authenticated=!0,this.validity.reachable=!0,this.validity.urlFormat=!0,this.validity.authRequired=!0,r?.authenticationType==="reentranceTicket"?this.systemAuthType="reentranceTicket":r?.serviceKeys?this.systemAuthType="serviceKey":this.systemAuthType="basic"}async checkUrl(e,r,n,{ignoreCertError:i=!1,isSystem:o=!1,odataVersion:s,connectType:a}={}){let c=Si();try{e.pathname=e.pathname?.endsWith("/")?e.pathname:`${e.pathname}/`,i===!0&&$j(!i),c&&e.searchParams.append("saml2","disabled");let u=this.createAxiosConfig(e,i,r,n);if(o){if(await this.createSystemConnection({axiosConfig:u,url:e,odataVersion:s,connectType:a}),a!=="odata_path"){let l=await this.serviceProvider.getSystemInfo();this._connectedUserName=l?.userName,this._connectedSystemName=l?.systemID}}else await this.createOdataServiceConnection(u,e.pathname);return this._validatedClient=e.searchParams.get(pwe)??void 0,200}catch(u){if(Mt.logger.debug(`ConnectionValidator.checkUrl() - error: ${u.message}`),u?.isAxiosError){if(u?.response?.status.toString().match(/5\d\d/)&&c)throw u;return u?.response?.status||u?.code}else throw u}}createAxiosConfig(e,r,n,i){let o={params:Object.fromEntries(e.searchParams),ignoreCertErrors:r,cookies:"",baseURL:e.origin,url:e.pathname,logger:Mt.logger};return n&&i&&(o=Object.assign(o,{auth:{username:n,password:i}})),o}async createOdataServiceConnection(e,r){await this.shouldIgnoreCertError(e)&&(this._ignoreCertError=!0,e.ignoreCertErrors=!0,$j(!1)),this._axiosConfig=e,this._serviceProvider=b3t(this._axiosConfig),this._odataService=this._serviceProvider.service(r),this._connectType="odata_path",Mt.attachAxiosLogger(this._serviceProvider.interceptors),await this._odataService.get("")}resetConnectionState(e=!1){this._serviceProvider=void 0,this._odataService=void 0,this._catalogV2=void 0,this._catalogV4=void 0,this._serviceInfo=void 0,this._connectedUserName=void 0,this._refreshToken=void 0,this._connectedSystemName=void 0,this._ignoreCertError=void 0,this._connectType="abap_catalog",e&&this.resetValidity(),Ci.resetErrorState()}async shouldIgnoreCertError(e,r){Mt.logger.debug(`ConnectionValidator.shouldIgnoreCertError() - url: ${e.baseURL}`);let n=!1;if(process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0")try{let o=!r||r===xn.v2?xn.v2:xn.v4,s=GN(e);Mt.attachAxiosLogger(s.interceptors),await s.catalog(o).listServices()}catch(o){let s=Oo.getErrorType(o?.response?.status??o?.code);o?.isAxiosError&&wRn.has(s)&&(Mt.logger.warn(Ze("warnings.certificateErrors",{url:e?.baseURL,error:s})),Mt.logger.warn(Ze("warnings.allowingUnauthorizedCertsNode")),n=!0)}return n}async createSystemConnection({axiosConfig:e,url:r,serviceInfo:n,destination:i,odataVersion:o,connectType:s=this._connectType}){if(this.resetConnectionState(!0),this.systemAuthType==="reentranceTicket"||this.systemAuthType==="serviceKey")this._serviceProvider=this.getAbapOnCloudServiceProvider(r,n);else if(i){let a=r?r.pathname:void 0;this._validatedUrl=LU(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=A3t({},i)}else e&&(await this.shouldIgnoreCertError(e,o)&&(this._ignoreCertError=!0,e.ignoreCertErrors=!0,$j(!1)),this._axiosConfig=e,this._serviceProvider=GN(e));if(this._serviceProvider&&Mt.attachAxiosLogger(this._serviceProvider.interceptors),s==="abap_catalog"){(!o||o===xn.v2)&&(this._catalogV2=this._serviceProvider.catalog(xn.v2)),(!o||o===xn.v4)&&(this._catalogV4=this._serviceProvider.catalog(xn.v4));let a=!1;try{this._catalogV2?await this._catalogV2?.listServices():this._catalogV4&&(a=!0,await this._catalogV4?.listServices())}catch(c){await this.handleCatalogError(c,a)}}else s==="odata_path"&&r&&(Mt.logger.debug(`Using provided url path: ${r.pathname} to validate authentication.`),this._connectType="odata_path",this._odataService=this._serviceProvider.service(`${r?.pathname}`),await this._odataService.get(""))}async handleCatalogError(e,r){let n=e.response?.status,i=n?Oo.getErrorType(n):void 0,o=n&&!r&&(i===Me.NOT_FOUND||i===Me.AUTH);if(this._catalogV4&&o){this._axiosConfig&&await this.shouldIgnoreCertError(this._axiosConfig,xn.v4)&&(this._ignoreCertError=!0,$j(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=GN(this._axiosConfig),this._catalogV4=this._serviceProvider.catalog(xn.v4),Mt.attachAxiosLogger(this._serviceProvider.interceptors));try{await this._catalogV4.listServices()}catch(s){throw i===Me.AUTH?e:s}}else throw e}async refreshTokenChangedCb(e){Mt.logger.debug("ConnectionValidator.refreshTokenChangedCb()"),this._refreshToken=e}getAbapOnCloudServiceProvider(e,r,n){if(this.systemAuthType==="reentranceTicket"&&e)return NVe({environment:qN.EmbeddedSteampunk,url:e.origin,logger:Mt.logger});if(this.systemAuthType==="serviceKey"&&r)return NVe({environment:qN.Standalone,service:r,refreshToken:n,refreshTokenChangedCb:this.refreshTokenChangedCb.bind(this),logger:Mt.logger});throw new Error("Invalid system auth type")}async validateServiceInfo(e,r){if(!e)return!1;if(e.url===this.validatedUrl&&JSON.stringify(e.uaa)===JSON.stringify(this.serviceInfo?.uaa))return this.getValidationResultFromStatusCode(200);try{return this.systemAuthType="serviceKey",await this.createSystemConnection({serviceInfo:e,odataVersion:r}),this._connectedUserName=await this.serviceProvider.user(),this._serviceInfo=e,this._validatedUrl=e.url,this.getValidationResultFromStatusCode(200)}catch(n){return Mt.logger.debug(`ConnectionValidator.validateServiceInfo() - error: ${n.message}`),n?.isAxiosError&&this.getValidationResultFromStatusCode(n?.response?.status||n?.code),Ci.getErrorMsg(n)??!1}}async validateDestination(e,r,n){try{if(this.systemAuthType=e.Authentication===$T.NO_AUTHENTICATION?"basic":"unknown",DP(e)||bE(e))return await this.validateOdataServiceDestination(e,n);{let i;if(n){let o=LU(e.Name.toLowerCase(),n);i=new URL(o)}await this.createSystemConnection({destination:e,odataVersion:r,url:i,connectType:i?"odata_path":void 0})}return{valResult:this.getValidationResultFromStatusCode(200)}}catch(i){i?.isAxiosError&&this.getValidationResultFromStatusCode(i?.response?.status||i?.code);let o=Ci.logErrorMsgs(i);return{valResult:Ci.getValidationErrorHelp(i,!1,e)??o,errorType:Ci.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(e,r,n){this.resetConnectionState(!0);let i=LU(e.Name.toLowerCase(),r);this._destinationUrl=r?i.replace(`https://${e.Name.toLowerCase()}.dest`,e.Host.replace(/\/{1,10}$/,"")):e.Host,this._destination=e;let o=await this.checkUrl(new URL(i),void 0,void 0,{odataVersion:n}),s=this.getValidationResultFromStatusCode(o);if(this.validity.reachable&&(this._validatedUrl=i),!this.validity.reachable){let a=Ci.logErrorMsgs(o);return{valResult:Ci.getValidationErrorHelp(o,!1,e)??a,errorType:Ci.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:Oo.getErrorMsgFromType(Me.AUTH,e.Authentication!==$T.NO_AUTHENTICATION?Ze("texts.checkDestinationAuthConfig"):void 0),errorType:Me.AUTH}:{valResult:s}}async validateUrl(e,{ignoreCertError:r=!1,forceReValidation:n=!1,isSystem:i=!1,odataVersion:o,systemAuthType:s,connectType:a}={}){if(this.isEmptyString(e))return this.resetValidity(),this.validity.urlFormat=!1,!1;s&&(this.systemAuthType=s);let c;try{if(c=new URL(e),c.origin==="null")return Ze("errors.invalidUrl",{input:e});if(a!=="odata_path"&&(this.systemAuthType==="reentranceTicket"||i)&&!(c.pathname.length===0||c.pathname==="/"))return Ze("prompts.validationMessages.systemUrlOriginOnlyWarning")}catch{return Ze("errors.invalidUrl",{input:e})}try{if(!n&&this.isUrlValidated(e))return this.validity.reachable??!1;this.resetValidity();let u=await this.checkUrl(c,void 0,void 0,{ignoreCertError:r,isSystem:i,odataVersion:o,connectType:a});return Mt.logger.debug(`ConnectionValidator.validateUrl() - status: ${u}; url: ${e}`),this.validity.urlFormat=!0,this._validatedUrl=e,this.getValidationResultFromStatusCode(u)}catch(u){return this.resetValidity(),Oo.getErrorType(u)===Me.CONNECTION?(this.validity.reachable=!1,Ci.logErrorMsgs(Ze("errors.systemOrServiceUrlNotFound",{url:e}))):Ci.getErrorMsg(u)??u.message}}getValidationResultFromStatusCode(e){return e===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):Oo.getErrorType(e)===Me.NOT_FOUND?(this.validity.reachable=!1,Oo.getErrorMsgFromType(Me.NOT_FOUND)??!1):Oo.isCertError(e)?(this.validity.reachable=!0,this.validity.canSkipCertError=wRn.has(Oo.getErrorType(e)),this.validity.authenticated=!1,Ci.getValidationErrorHelp(e,!1)??!1):Oo.getErrorType(e)===Me.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):Oo.getErrorType(e)===Me.REDIRECT?(this.validity.reachable=!0,Ze("errors.urlRedirect")):Oo.getErrorType(e)===Me.CONNECTION?(this.validity.reachable=!1,Oo.getErrorMsgFromType(Me.CONNECTION,Ze("texts.httpStatus",{httpStatus:e}))??!1):Oo.getErrorType(e)===Me.BAD_REQUEST?(this.validity.reachable=!0,Oo.getErrorMsgFromType(Me.BAD_REQUEST,Ze("texts.httpStatus",{httpStatus:e}))??!1):Oo.getErrorType(e)===Me.BAD_GATEWAY?(this.validity.reachable=!1,Oo.getErrorMsgFromType(Me.BAD_GATEWAY,Ze("texts.httpStatus",{httpStatus:e}))??!1):(this.validity.reachable=!0,Oo.getErrorMsgFromType(Oo.getErrorType(e),Ze("texts.httpStatus",{httpStatus:e}))??!0)}isEmptyString(e){return!e||e.trim().length===0}isUrlValidated(e){return this._validatedUrl===e}async isAuthRequired(){return Mt.logger.debug(`ConnectionValidator.isAuthRequired() - validity: ${JSON.stringify(this.validity)}`),!this._validatedUrl||this.validity.authenticated?!1:this.validity.authRequired}async validateAuth(e,r,n,{ignoreCertError:i=!1,sapClient:o,odataVersion:s,isSystem:a=!1,connectType:c}={}){if(!e)return{valResult:!1};try{let u=new URL(e);o&&u.searchParams.append(pwe,o),this.systemAuthType="basic";let l=await this.checkUrl(u,r,n,{ignoreCertError:i,isSystem:a,odataVersion:s,connectType:c});Mt.logger.debug(`ConnectionValidator.validateAuth() - status: ${l}; url: ${e}`),this.validity.urlFormat=!0,this._validatedUrl=e;let p=this.getValidationResultFromStatusCode(l);if(p===!0){if(this.validity.authenticated===!0)return this._connectedUserName=r,{valResult:!0};if(this.validity.authenticated===!1)return{valResult:this.getAuthFailureReasonText(l,s),errorType:Me.AUTH}}return{valResult:p}}catch(u){return{valResult:Ci.getValidationErrorHelp(u,!1,this.destination)??Ci.getErrorMsg(u)??Ze("errors.unknownError"),errorType:Ci.getCurrentErrorType()??void 0}}}resetValidity(){delete this.validity.urlFormat,delete this.validity.reachable,delete this.validity.authRequired,delete this.validity.authenticated,delete this.validity.canSkipCertError,this._validatedUrl=void 0,this._destinationUrl=void 0,this._destination=void 0}getAuthFailureReasonText(e,r){let n;[403,"403"].includes(e)?n=Ze("texts.authorizationFailed"):[401,"401"].includes(e)&&(n=Ze("texts.authenticationFailed"));let i;return r?i=Ze("errors.authenticationFailedSpecificCatalog",{odataVersion:r,authFailType:n}):i=Ze("errors.authenticationFailedAllCatalogs",{authFailType:n}),i}};var HRn=pe(Ooe(),1);var WD={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var qaa="VALUE_HELP_DOWNLOAD_PROMPTED",Gaa="VALUE_HELP_DOWNLOAD_SUCCESS",Haa="VALUE_HELP_DOWNLOAD_FAILED";async function M_t(t,e,r){let n=oL.createTelemetryData(e)??{};if(r&&Object.keys(r).length>0){let i=jOn();i&&await i.reportEvent({eventName:t,properties:n,measurements:r},lc.NoSampling)}else OL(t,n)}async function DRn(t,e,r){if(delete Xt.odataService.valueListMetadata,await M_t(qaa,{userChoseToDownload:t}),t&&e.serviceProvider instanceof zf){let n=Date.now();try{let i=await e.serviceProvider.fetchExternalServices(r),o=Date.now()-n;i.length>0?Xt.odataService.valueListMetadata=i:Mt.logger.info(Ze("warnings.noExternalServiceMetdataFetched")),await M_t(Gaa,{userChoseToDownload:!0,valueHelpCount:i.length},{downloadTimeMs:o})}catch(i){let o=Date.now()-n;Mt.logger.error(`Failed to fetch external service metadata: ${i}`),await M_t(Haa,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:o})}}}function RRn(t,e,r){let n=`${e?e+":":""}`,i=`${n}${rs.valueHelpDownload}`,o=`${n}${rs.serviceSelection}`,s=`${n}cliValueHelpDownload`,a,u=[{when:l=>{let d=l?.[o]?.servicePath;return d&&r?.convertedMetadata?(a=YJ(d,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:Ze("prompts.valueHelpDownload.message"),validate:async l=>(ed()!==mo.cli&&await DRn(l,t,a),!0)}];return ed()===mo.cli&&u.push({when:async l=>{let p=l?.[i];return p!==void 0&&a&&await DRn(p,t,a),!1},name:s,type:"input"}),u}var YD=require("@sap-devx/yeoman-ui-types");var Kaa=pe(VC(),1),Waa=pe(yD(),1);function NRn(t){return t.filter(e=>!!e.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var IRn=pe(VC(),1),MRn=pe(yD(),1);function Yaa(t){return!!t.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function L_t(t){let e=!1;try{let r;typeof t=="string"?r=(0,IRn.convert)((0,MRn.parse)(t)):r=t;let n=NRn(r.entitySets)??[];n?.length>0&&(e=!Yaa(n))}catch(r){Mt.logger.error(Ze("errors.unparseableMetadata",{error:r.message}))}return e}var Xaa=["/IWBEP/COMMON"],Jaa="SERVICE_INQUIRER_BAS_SUCCESS",Qaa=t=>{let e=[],r=!1;return typeof Mt.logger.getLogLevel=="function"&&(r=Mt.logger.getLogLevel()==="trace"),t?.filter(n=>!Xaa.some(i=>n.id.includes(i))).forEach(n=>{let i=n.name,o=n.path;i=`${i} (${n.serviceVersion}) - OData V${n.odataVersion}`,r&&(i=`${i} Service Type: ${n.serviceType}`),e.push({name:i,value:{servicePath:o,serviceODataVersion:n.odataVersion,toString:()=>i,serviceType:n.serviceType,serviceId:n.id}})}),Mt.logger.debug(`Number of unique service choices: ${e.length}`),e.sort((n,i)=>n.name?n.name.localeCompare(i.name??""):0)};function Zaa(t,e){let r=Object.entries(t);r.forEach(([n,i])=>{Ci.logErrorMsgs(i,Ze("warnings.missingServices",{odataVersion:n}))}),e===r.length&&Ci.logErrorMsgs(Ze("errors.allCatalogServiceRequestsFailed",{version:Object.keys(t).join(", ")}))}async function LRn(t,e){let r={},n={},i=[];for(let s of t){let a=s instanceof gP?xn.v2:xn.v4;try{let c=Date.now(),u=await s.listServices(),l=Date.now(),p=l-c===0?"<1 ms":`${l-c}ms`;n[`v${a}`]={serviceCount:u.length,duration:p},Mt.logger.debug(`Number of service${a===xn.v4?" groups":"s"}: ${u.length} returned in: ${p}}`),i.push(u)}catch(c){Mt.logger.error(Ze("errors.serviceCatalogRequest",{catalogRequestUri:s.getUri(),entitySet:s.entitySet,error:c})),Object.assign(r,{[a]:c}),i.push([])}}Mt.logger.debug(`Service catalog request times: ${JSON.stringify(n,void 0," ")}`);let o=i?.flat()??[];return Mt.logger.debug(`Number of services available: ${o.length}`),(o.length===0||Object.keys(r).length>0)&&Zaa(r,t.length),e&&(o=o.filter(s=>e.includes(s.id)||e.includes(s.path))),Qaa(o)}function k_t(t){let e=oL.createTelemetryData({destODataType:ACe(t)})??{};OL(Jaa,e)}async function eca(t,e,r,n,i){let o=[];try{let s=await e.metadata(),{validationMsg:a,version:c,convertedMetadata:u}=vwe(s,i);if(a)return{validationMsg:a};if(!r&&c===$s.v2&&n)try{Mt.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=GN(n).catalog(xn.v2),Mt.attachAxiosLogger(r.interceptors)}catch(l){Mt.logger.warn(Ze("error.v2CatalogServiceNoAnnotations",l))}if(r)try{o=await r.getAnnotations({path:t})}catch{Mt.logger.info(Ze("prompts.validationMessages.noAnnotations"))}return{annotations:o,metadata:s,version:c,convertedMetadata:u}}catch(s){let a=Ci.getErrorMsg(s);return Mt.logger.error(Ze("errors.serviceMetadataErrorLog",{servicePath:t,errorText:a})),{validationMsg:Ze("errors.serviceMetadataErrorUI",{servicePath:t,errorText:a})}}}async function tca(t,e,r){let n;if(e===O4.NotDetermined)try{n=await r.getServiceType(t)??O4.NotDetermined}catch(i){Mt.logger.error(Ze("errors.serviceTypeRequestError",{error:i.message}))}return n??e}async function F_t(t,e,r){let n=e.catalogs?.[t.serviceODataVersion];if(!e.serviceProvider)return Mt.logger.error("ConnectionValidator connection is not initialized"),{validationResult:!1};let i=e.odataService;i||(i=e.serviceProvider.service(t.servicePath));let{validationMsg:o,version:s,convertedMetadata:a,annotations:c,metadata:u}=await eca(t.servicePath,i,n,e.axiosConfig,r);if(o)return{validationResult:o};let l=e.destinationUrl??e.validatedUrl,p;return l&&(p=new URL(l).origin),Xt.odataService.annotations=c,Xt.odataService.metadata=u,Xt.odataService.odataVersion=s??(t.serviceODataVersion===xn.v2?$s.v2:$s.v4),Xt.odataService.servicePath=t.servicePath,Xt.odataService.serviceId=t.serviceId,Xt.odataService.origin=p,Xt.odataService.sapClient=e.validatedClient,Xt.odataService.ignoreCertError=e.ignoreCertError,{validationResult:!0,hasAnnotations:!!Xt.odataService.annotations&&Xt.odataService.annotations.length>0,convertedMetadata:a}}function kRn(t){let e=Ze("prompts.systemService.message");return t&&(e=e.concat(` ${Ze("texts.forUserName",{username:t})}`)),e}async function FRn(t,e,r,{requiredOdataVersion:n,hasAnnotations:i=!0,showCollabDraftWarnOptions:o,serviceFilter:s}){if(t?.length===0)return s&&s.length>0?{message:Ze("warnings.specifiedServicesNotAvailable",{odataVersion:n?`V${n} `:void 0,service:s[0],count:s.length}),severity:YD.Severity.warning}:n?{message:Ze("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:YD.Severity.warning}:{message:Ze("warnings.noServicesAvailable"),severity:YD.Severity.warning};if(e){let a=e.serviceType;if(e.serviceODataVersion===xn.v2){if(!i)return{message:Ze("warnings.noAnnotations"),severity:YD.Severity.warning};a=await tca(e.servicePath,e.serviceType,r.catalogs[xn.v2])}else if(o?.showCollabDraftWarning&&e.serviceODataVersion===xn.v4&&L_t(o.edmx))return{message:Ze("warnings.collaborativeDraftMessage"),severity:YD.Severity.warning};if(a&&a!==O4.UI)return{message:Ze("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:YD.Severity.warning}}else if(Ci.getErrorMsg())return{message:`${Ci.getErrorMsg()} ${Ze("texts.seeLogForDetails")}`,severity:YD.Severity.information}}var rca="cliServiceSelection";function XD(t,e,r,n=!0){let i=[],o,s,a,c,u,l={convertedMetadata:void 0},p=r?.requiredOdataVersion,d=`${e}:${rs.serviceSelection}`,h={when:()=>t.validity.authenticated||t.validity.authRequired===!1,name:d,type:r?.useAutoComplete?"autocomplete":"list",message:()=>kRn(t.connectedUserName),guiOptions:{breadcrumb:Ze("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(m,_)=>gG(_,i),choices:async m=>{if(i.length===0||o!==t.validatedUrl||s!==t.validatedClient||!xRn(c,r?.serviceFilter))if(t.catalogs[$s.v2]||t.catalogs[$s.v4])i=await nca(t.catalogs,p,r?.serviceFilter),o=t.validatedUrl,s=t.validatedClient,c=r?.serviceFilter?[...r.serviceFilter]:void 0,m?.[`${rs.systemSelection}`]?.type==="destination"&&k_t(m?.[`${rs.systemSelection}`]?.system);else if(t.odataService&&t.validatedUrl&&!await t.isAuthRequired()){let _=new URL(t.destinationUrl??t.validatedUrl);i=[{name:_.toString(),value:{servicePath:_.pathname}}],m?.[`${rs.systemSelection}`]?.type==="destination"&&k_t(m?.[`${rs.systemSelection}`]?.system)}else Mt.logger.error(Ze("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:m=>FRn(i,m,t,{requiredOdataVersion:p,hasAnnotations:u,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>Ewe(i),validate:async m=>{let _=m;if(r?.useAutoComplete&&m.value&&(_=m.value),!t.validatedUrl)return!1;if(i.length===0&&Ci.hasError())return Oo.getHelpForError(Me.SERVICES_UNAVAILABLE)??!1;if(_&&(a?.servicePath!==_.servicePath||a?.servicePath!==Xt.odataService.servicePath)){u=void 0,l.convertedMetadata=void 0,a=_;let v=await F_t(_,t,p);return u=v.hasAnnotations,l.convertedMetadata=v.convertedMetadata,v.validationResult}return!0}};if(r?.additionalMessages){let m={[d]:{additionalMessages:r.additionalMessages}};h=_mt([h],m,Xt.odataService)[0]}let f=[h];return ed()===mo.cli&&!r?.useAutoComplete&&f.push({when:async m=>{let _=m?.[`${e}:${rs.serviceSelection}`];if(_&&t.validatedUrl){let{validationResult:v,hasAnnotations:b,convertedMetadata:S}=await F_t(_,t);if(typeof v=="string")throw Mt.logger.error(v),new Error(v);u=b,l.convertedMetadata=S}if(i.length===0&&Ci.hasError()){let v=Oo.getHelpForError(Me.SERVICES_UNAVAILABLE).toString();throw new Error(v)}return!1},name:`${e}:${rca}`}),n||f.push(...pl(RRn(t,e,l),m=>t.serviceProvider instanceof zf&&!!l.convertedMetadata&&m?.[d]?.serviceODataVersion===xn.v4)),f}async function nca(t,e,r){let n=[];return e&&t[e]?n.push(t[e]):n=Object.values(t).filter(i=>i!==void 0),await LRn(n,r)}var VRn=require("@sap-devx/yeoman-ui-types");var U_t=require("@sap-devx/yeoman-ui-types");var Og;(function(t){t.systemUsername="systemUsername",t.systemPassword="systemPassword",t.storeSystemCredentials="storeSystemCredentials"})(Og||(Og={}));function Twe(t,e,r,n){let i=`${e?e+":":""}${Og.systemUsername}`,o=`${e?e+":":""}${Og.systemPassword}`,s=`${e?e+":":""}${Og.storeSystemCredentials}`,a,c=[{when:async()=>(a=await t.isAuthRequired(),t.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"input",name:i,message:Ze("prompts.systemUsername.message"),guiOptions:{mandatory:!0},default:"",validate:l=>l?.length>0},{when:()=>!!(t.systemAuthType==="basic"&&a&&(!r||r.isValid)),type:"password",guiOptions:{mandatory:!0,applyDefaultWhenDirty:!0},guiType:"login",showOutputTabLink:"validationMessageOverflow",name:o,message:Ze("prompts.systemPassword.message"),mask:"*",default:"",validate:async(l,p)=>{if(!(t.validatedUrl&&p?.[i]&&l&&(!r||r.isValid)))return!1;let d=p?.[rs.systemSelection],h,f=!0;if(d?.type==="backendSystem")h=d.system?.client;else if(d?.type==="destination"){let _=d.system;(DP(_)||bE(_))&&(f=!1)}let{valResult:m}=await t.validateAuth(t.validatedUrl,p?.[i],l,{sapClient:r?.sapClient||h,isSystem:f,odataVersion:XC(n)});return m===!0&&t.serviceProvider?(ica(t.serviceProvider,d,{username:p?.[i],password:l}),!0):m},additionalMessages:(l,p)=>{if(t.ignoreCertError&&p?.newSystemType!=="abapOnPrem")return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:U_t.Severity.warning}}}],u={when:l=>!!(t.systemAuthType==="basic"&&a&&t.validity.authenticated&&l[o]),type:"confirm",name:s,message:Ze("prompts.storeSystemCredentials.message"),default:!1,guiOptions:{breadcrumb:Ze("prompts.storeSystemCredentials.breadcrumb")},validate:async l=>{if(Xt.odataService.connectedSystem?.backendSystem){let p=Xt.odataService.connectedSystem.backendSystem;Xt.odataService.connectedSystem.backendSystem=Object.assign(p,{newOrUpdated:l})}return!0},additionalMessages:l=>{if(l===!0)return{message:Ze("texts.passwordStoreWarning"),severity:U_t.Severity.warning}}};return Si()||c.push(u),c}function ica(t,e,{username:r,password:n}){if(Xt.odataService.connectedSystem={serviceProvider:JC(t)},e?.type==="backendSystem"){let i=e.system;(i.username!==r||i.password!==n)&&(Xt.odataService.connectedSystem.backendSystem=Object.assign(i,{username:r,password:n,userDisplayName:r}))}else e?.type==="destination"&&(Xt.odataService.connectedSystem.destination=e.system)}async function ZQ(t){return t?await cpt(t)?Ze("prompts.systemName.systemNameExistsWarning"):!0:Ze("prompts.systemName.emptySystemNameWarning")}function URn(t,e){try{return new URL(e,t),!0}catch{return Ze("errors.invalidUrl",{input:`${t}${e}`})}}async function $Rn(t,e){let r=t+(e?Ze("texts.suggestedSystemNameClient",{client:e}):"");return await ZQ(r)===!0?r:oca(r)}async function oca(t){let e=1,r=`${t} (${e})`;for(;await ZQ(r)!==!0;)r=`${t} (${e})`,e++;return r}function sca(t){switch(t){case"serviceKey":return ZX.ReentranceTicket;case"reentranceTicket":return ZX.ReentranceTicket;case"basic":return ZX.Basic;default:return}}function Swe(t,e,r,n,i=!0){return{type:"input",name:`${e?e+":":""}${WD.newSystemUrl}`,message:Ze("prompts.systemUrl.message"),guiOptions:{hint:Ze("prompts.systemUrl.description"),mandatory:!0,breadcrumb:!0},validate:async a=>{if(Xt.resetConnectedSystem(),n&&n.backendSystem?.url===a&&n.backendSystem?.authenticationType==="reentranceTicket")t.setConnectedSystem(n);else if(i){let u=mH(Xt.backendSystemsCache,a);if(u)return Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:u.name})}let c=await t.validateUrl(a,{isSystem:!0,odataVersion:XC(r),forceReValidation:!0});return c===!0&&(t.validity.authenticated&&t.serviceProvider?Xt.odataService.connectedSystem={serviceProvider:JC(t.serviceProvider)}:t.systemAuthType="basic"),c},additionalMessages:()=>{if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:VRn.Severity.warning}}}}function bwe(t,e){let r,n=!1,i=`${e?e+":":""}`,o=`${i}${rs.userSystemName}`;return{type:"input",guiOptions:{hint:Ze("prompts.systemName.hint"),applyDefaultWhenDirty:!0,breadcrumb:!0,mandatory:!0},name:o,message:Ze("prompts.systemName.message"),default:async()=>{let a=t.connectedSystemName;return a&&!n&&(r=await $Rn(a,t.validatedClient)),r},validate:async(a,c)=>{if(!a)return!1;let u=!1;a===r?u=!0:(n=!0,r=a,u=await ZQ(a));let l=!!c?.[`${i}${Og.storeSystemCredentials}`];if(u===!0&&t.validatedUrl&&Xt.odataService.connectedSystem){let p=new ha({authenticationType:sca(t.systemAuthType),name:a,url:t.validatedUrl,client:t.validatedClient,username:l?t.axiosConfig?.auth?.username:void 0,password:l?t.axiosConfig?.auth?.password:void 0,serviceKeys:t.serviceInfo,userDisplayName:t.connectedUserName,systemType:eJ({serviceKeys:t.serviceInfo,authenticationType:t.systemAuthType}),connectionType:"abap_catalog"});Xt.odataService.connectedSystem.backendSystem=p,Xt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return u}}}async function $_t(){return await xC({entityName:"system"})}async function BRn(t=!1,e){let r=[];try{r=await(await $_t()).getAll({includeSensitiveData:t,backendSystemFilter:e??{connectionType:["abap_catalog","odata_service"]}})}catch(n){Mt.logger.error(Ze("errors.backendSystemRetrieval",{error:n.message}))}return r}var V_t="!@\xA3*&937newSystem*X~qy^",Awe="cfAbapEnvService";async function jRn(t,e,r,n,i){Xt.resetConnectedSystem();let o=!1,a=await(await $_t()).read(t);if(a){n&&n.backendSystem?.url===a.url&&e.setConnectedSystem(n);let c=new URL(a.url),u=c.origin;if(i&&(u=new URL(i,c.origin).toString()),a.authenticationType==="reentranceTicket")c.pathname!=="/"&&Mt.logger.warn(Ze("warnings.storedSystemUrlPathNotSupported",{systemUrl:a.url})),o=await e.validateUrl(u,{isSystem:!0,odataVersion:XC(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":"abap_catalog"});else if(a.serviceKeys)o=await e.validateServiceInfo(a.serviceKeys,XC(r));else if(a.authenticationType==="basic"||!a.authenticationType){let l;if({valResult:o,errorType:l}=await e.validateAuth(u,a.username,a.password,{isSystem:!0,odataVersion:XC(r),sapClient:a.client,connectType:i?"odata_path":"abap_catalog"}),l===Me.AUTH)return Mt.logger.error(Ze("errors.storedSystemConnectionError",{systemName:a.name,error:o})),!0}o===!0&&e.serviceProvider&&(Xt.odataService.connectedSystem={serviceProvider:JC(e.serviceProvider),backendSystem:a})}return o}async function eZ(t,e,r,n){Xt.resetConnectedSystem();let{valResult:i,errorType:o}=await e.validateDestination(t,XC(r),n);return o===Me.AUTH&&e.systemAuthType==="basic"?(Mt.logger.error(Ze("errors.destination.authError",{systemName:t.Name,error:i})),!0):(i===!0&&e.serviceProvider&&(Xt.odataService.connectedSystem={serviceProvider:JC(e.serviceProvider),destination:t}),i)}function aca(t,e){return!e||e.odata_abap&&Roe(t)||e.odata_generic&&Doe(t)||e.full_service_url&&DP(t)||e.partial_service_url&&bE(t)?!0:(Mt.logger.debug(`Destination: ${t.Name} does not match any filters and will be excluded as a prompt choice. Destination configuration: ${JSON.stringify(t)}`),!1)}async function qRn(t,e=!1,r=!1,n){let i=[],o;if(Si()){let s={};try{s=await OVe({stripS4HCApiHosts:!0})}catch(a){Mt.logger.error(Ze("errors.destination.listDestinations",{error:a.message}))}i=Object.values(s).filter(a=>aca(a,t)).map(a=>({name:YHt(a),value:{type:"destination",system:a}})),e&&(o={name:Ze("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:Awe,system:Awe}})}else{let s=await BRn(!1,n);Xt.backendSystemsCache=s,i=s.map(a=>({name:j3t(a),value:{system:a,type:"backendSystem"}})),r||(o={name:Ze("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:V_t}})}return i.sort(({name:s},{name:a})=>s.localeCompare(a,void 0,{numeric:!0,caseFirst:"lower"})),o&&i.unshift(o),i}function B_t(t,e){let r=typeof e=="string"?e:e?.value;return r?t.findIndex(i=>{let{type:o,system:s}=i.value;if(o==="destination")return s.Name===r;if(o==="backendSystem")return s.name===r;if(o==="newSystemChoice")return r===V_t;if(o==="cfAbapEnvService")return r===Awe}):-1}var Owe="abapOnBtp",NYc=`${Owe}:${WD.newSystemUrl}`,cca="cliCfAbapService",j_t={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function zRn(t,e){Xt.reset();let r=new $_,n=[];return n.push({type:"list",name:j_t.abapOnBtpAuthType,choices:[{name:Ze("prompts.abapOnBTPType.choiceCloudFoundry"),value:"cloudFoundry"},{name:Ze("prompts.abapOnBTPType.choiceReentranceTicket"),value:"reentranceTicket"}],message:Ze("prompts.abapOnBTPType.message"),validate:()=>(r.resetConnectionState(!0),Xt.resetConnectedSystem(),!0)}),n.push(pl([Swe(r,Owe,t?.serviceSelection?.requiredOdataVersion,e)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...pl([...q_t(r,void 0,void 0,e)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),t?.userSystemName?.hide!==!0&&n.push(pl([bwe(r,Owe)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...XD(r,Owe,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}async function GRn(t,e,r,n=!1,i){Xt.resetConnectedSystem();let o=t.label,s=await(0,HRn.apiGetInstanceCredentials)(o);if(!s?.credentials?.uaa)return Ze("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:o});let a=!0,c;if(ed()===mo.bas)try{c=await ZHt(o,{uaaCredentials:s.credentials.uaa,hostUrl:s.credentials.url},Mt.logger),a=await eZ(c,e,r)}catch(u){a=u.message}else i&&i.backendSystem?.url===s.credentials.url&&JSON.stringify(i.backendSystem.serviceKeys?.uaa)===JSON.stringify(s.credentials.uaa)&&e.setConnectedSystem(i),a=await e.validateServiceInfo(s.credentials);if(!n&&a!==!0)return a;if(n&&typeof a=="string")throw Mt.logger.error(a),new Error(a);if(n&&a===!1)throw Mt.logger.error(Ci.getErrorMsg()??Ze("errors.abapServiceAuthenticationFailed")),new Error(Ze("errors.abapServiceAuthenticationFailed"));return e.serviceProvider&&ed()!==mo.bas&&(e.connectedSystemName=await CVe(o),Xt.odataService.connectedSystem={serviceProvider:JC(e.serviceProvider)}),!0}function q_t(t,e,r,n){let i=[],s=[{type:"list",name:`${e?e+":":""}${j_t.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await GOn(Ci),i.length===0&&ed()===mo.cli)throw new Error(Ze("errors.abapEnvsUnavailable"));return i},default:()=>Ewe(i),message:Ze("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let u=await GRn(a,t,r,ed()===mo.cli,n);if(!Si()&&u===!0&&t.validatedUrl){let l=mH(Xt.backendSystemsCache,t.validatedUrl,t.validatedClient);if(l)return t.resetConnectionState(!0),Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return u}if(Ci.getCurrentErrorType()===Me.NO_ABAP_ENVS){let u=Ci.getErrorMsg(!0),l=Ze("texts.seeLogForDetails");return`${u} ${l}`}return!1}}];return ed()===mo.cli&&s.push({when:async a=>{let c=a?.[j_t.cloudFoundryAbapSystem];return c&&await GRn(c,t,r,!0),!1},name:cca}),s}function KRn(t){let e="cfAbapBas",r=new $_;return[...q_t(r,e,t?.serviceSelection?.requiredOdataVersion),...XD(r,e,t?.serviceSelection,t?.valueHelpDownload?.hide)]}var VL="abapOnPrem",G_t=`${VL}:${WD.newSystemUrl}`,KYc=`${VL}:${Og.systemUsername}`,WYc=`${VL}:${Og.systemPassword}`,uca={sapClient:"sapClient"};function WRn(t){Xt.reset();let e=new $_,r=t?.serviceSelection?.requiredOdataVersion,n=lca(t?.userSystemName,e,r);return n.push(...XD(e,VL,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}function lca(t,e,r){let n=e??new $_,i={sapClient:void 0,isValid:!0},o=[Swe(n,VL,r,void 0,!1),{type:"input",name:uca.sapClient,message:Ze("prompts.sapClient.message"),guiOptions:{breadcrumb:Ze("prompts.sapClient.breadcrumb")},validate:(s,a)=>{let c=oRn(s);if(c===!0){if(i.sapClient=s,i.isValid=!0,a?.[G_t]){let u=mH(Xt.backendSystemsCache,a[G_t],s);if(u)return i.isValid=!1,Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:u.name})}return!0}return i.sapClient=void 0,i.isValid=!1,c}},...Twe(n,VL,i,r)];return t?.hide!==!0&&o.push(pl([bwe(n,VL)],s=>!!s?.[G_t]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),o}function YRn(t,e){let r=[{type:"list",name:WD.newSystemType,choices:[{name:Ze("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:Ze("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:Ze("prompts.newSystemType.message")}];return r.push(...pl(WRn(t),n=>n.newSystemType==="abapOnPrem")),r.push(...pl(zRn(t,e),n=>n.newSystemType==="abapOnBtp")),r}var Cwe="systemSelection",y9c=`${Cwe}:${Og.systemUsername}`,_9c=`${Cwe}:${Og.systemPassword}`,XRn={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function JRn(t,e,r,n,i){if(Xt.reset(),t.type==="newSystemChoice"||t.type==="cfAbapEnvService")return e.resetConnectionState(!0),!0;let o=!1;if(t.type==="backendSystem"){t.system.connectionType==="odata_service"&&(i=t.system.url);let s=af.from(t.system);o=await jRn(s,e,r,n,i)}else if(t.type==="destination"){if(bE(t.system))return!0;o=await eZ(t.system,e,r,i)}return o}async function z_t(t,e){Xt.reset();let r=new $_,n=await pca(r,t,e);return t?.serviceSelection?.hide||n.push(...pl(XD(r,Cwe,t?.serviceSelection,t?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),Si()?n.push(...pl(KRn(t),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...pl(YRn(t,e),i=>i.systemSelection?.type==="newSystemChoice")),n}async function pca(t,e,r){let n=e?.serviceSelection?.requiredOdataVersion,i=e?.systemSelection?.destinationFilters,o=await qRn(i,e?.systemSelection?.includeCloudFoundryAbapEnvChoice,e?.systemSelection?.hideNewSystem,e?.systemSelection?.backendSystemFilter),s=B_t(o,e?.systemSelection?.defaultChoice),a=e?.systemSelection?.connectPath,c=e?.systemSelection?.onlyShowDefaultChoice&&e?.systemSelection?.defaultChoice,u=[{type:e?.systemSelection?.useAutoComplete?"autocomplete":"list",name:rs.systemSelection,message:Ze("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:Ze("prompts.systemSelection.hint")},source:(l,p)=>gG(p,o),choices:c?[o[s]]:o,default:()=>c?0:(s=B_t(o,e?.systemSelection?.defaultChoice),typeof e?.systemSelection?.connectPath=="object"&&(a=e?.systemSelection.connectPath),s),validate:async l=>{if(!l)return!1;let p=l;return e?.systemSelection?.useAutoComplete&&l.value&&(p=l.value),JRn(p,t,n,r,a?.value)??!1},additionalMessages:async l=>{if(l.type==="backendSystem"&&t.systemAuthType==="basic"&&await t.isAuthRequired())return{message:Ze("prompts.systemSelection.authenticationFailedUpdateCredentials"),severity:H_t.Severity.information};if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:H_t.Severity.warning}}}];if(Si()){let l={when:p=>{let d=p?.[rs.systemSelection];return d?.type==="destination"?bE(d.system):!1},type:"input",name:XRn.destinationServicePath,message:Ze("prompts.destinationServicePath.message"),guiOptions:{hint:Ze("prompts.destinationServicePath.hint"),mandatory:!0,breadcrumb:!0,applyDefaultWhenDirty:!0},default:"",validate:async(p,d)=>{if(!p||p.trim().length<2||p.startsWith("//"))return t.resetConnectionState(!0),Ze("prompts.destinationServicePath.invalidServicePathWarning");let h=d?.[rs.systemSelection]?.system,f=URn(h.Host,p);return f!==!0?(t.resetConnectionState(!0),f):await eZ(h,t,n,p)}};u.push(l)}return ed()===mo.cli&&!e?.systemSelection?.useAutoComplete&&u.push({when:async l=>{let p=l?.[rs.systemSelection];if(!p)return!1;let d=await JRn(p,t,n,void 0,a?.value);if(d!==!0)throw Mt.logger.error(d.toString),new Error(d.toString());return!1},name:`${XRn.systemSelectionCli}`}),u.push(...Twe(t,Cwe,void 0,n)),u}var dca=require("@sap-devx/yeoman-ui-types");var K_t;(function(t){t.ignoreCertError="ignoreCertError",t.username="username",t.cliIgnoreCertValidate="cliIgnoreCertValidate"})(K_t||(K_t={}));var Eva=require("@sap-devx/yeoman-ui-types");var vca=pe(Ma(),1),Tca=pe(la(),1),Sca=pe(al(),1);var dNn=pe(Ma(),1),fNn=pe(la(),1),hNn=pe(zo(),1);var sNn=pe(require("node:os"),1),aNn=require("node:path"),cNn=pe(zo(),1);var Pwe=require("node:path"),QRn=require("node:url"),fca=(0,Pwe.dirname)((0,QRn.fileURLToPath)(__importMetaUrl));function Bs(t=""){return(0,Pwe.join)(fca,"../templates",t)}var gH=require("node:path");var ZRn=" ",tZ=" ",rZ={"page/custom/1.94/ext/View.xml":{getData:(t,e)=>({ids:{page:t(e?.name??"Page")}})},"page/custom/1.84/ext/View.xml":{getData:(t,e)=>({ids:{page:t(e?.name??"Page")}})},"common/FragmentWithForm.xml":{getData:t=>({ids:{formElement:t("FormElement")}})},"common/FragmentWithVBox.xml":{getData:t=>({ids:{vbox:t("VBox")}})},"view/ext/CustomViewWithTable.xml":{getData:t=>({ids:{table:t("Table")}})},"filter/fragment.xml":{getData:t=>{let e=t("Item"),r=t("Item",[e]),n=t("Item",[e,r]);return{ids:{comboBox:t("ComboBox"),item1:e,item2:r,item3:n}}}},"building-block/rich-text-editor-button-groups/View.xml":{getData:(t,e)=>{let r=e?.buttonGroups||e?.data?.buttonGroups||[],n={},i=[];return r.forEach((o,s)=>{let a=t("ButtonGroup",i);n[s]=o.id??a,o.id||i.push(a)}),{ids:n}}},"building-block/custom-column/View.xml":{getData:t=>({ids:{column:t("TableColumn")}})}};function hca(t,e,r=[]){if(!r.includes(t)&&XX(t,e))return t;for(let i=1;i<1e3;i++){let o=`${t}${i}`;if(!r.includes(o)&&XX(o,e))return o}throw new Error(`Failed to generate unique ID for base '${t}' after 1000 attempts`)}async function W_t(t,e){let r=await Yw(".xml",t,[".git","node_modules","dist","annotations","localService"],e),n=[".fragment.xml",".view.xml"];return r.filter(i=>n.some(o=>i.endsWith(o)))}function V_(t={}){let{basePath:e,fsEditor:r,fileContentCache:n=[]}=t,i=o=>(s,a=[])=>hca(s,o,a);return n.length>0?i(n):r&&e?W_t(e,r).then(o=>{let s=o.map(a=>r.read(a).toString());return i(s)}):i([])}var mca={noGlob:!0};function gca(t){let e,r=t.startsWith(tZ)?tZ:ZRn;for(let n=0;n<t.length;n++)if(t[n]!==r){e={size:n,useTabSymbol:r===tZ};break}return e}function Y_t(t){let e,r=new Set([ZRn,tZ]),i=t.split(/\r\n|\n/).find(o=>r.has(o[0]));return i&&(e=gca(i)),e}function xwe(t,e,r){if(!r){let i=t.read(e);r=Y_t(i)}let n;return r&&(r.useTabSymbol?n=tZ.repeat(r.size||1):n=r.size),n}function QC(t,e){let{filepath:r,content:n,replacer:i}=e,o=xwe(t,r,e.tabInfo);t.extendJSON(r,JSON.parse(n),i,o)}function B_(t,e,r,n,i){let o=wwe(e),s=rZ[o];if(i&&s?.getData){let a=s.getData(i,n);n={...n,...a}}t.copyTpl(e,r,n,void 0,mca)}function wwe(t){let e=(0,gH.normalize)(t),r=`${gH.sep}templates${gH.sep}`,n=e.indexOf(r);return n===-1?t:e.substring(n+r.length).split(gH.sep).join("/")}var uNn=pe(rU(),1);var Rwe=pe(rU(),1),tNn=pe(zF(),1);var j_={Full:"full",Basic:"basic"};var BL="1.145.0",pr;(function(t){t.FilterBar="filter-bar",t.Chart="chart",t.CustomFilterField="custom-filter-field",t.CustomFormField="custom-form-field",t.Field="field",t.Form="form",t.Page="page",t.Table="table",t.CustomColumn="custom-column",t.RichTextEditor="rich-text-editor",t.RichTextEditorButtonGroups="rich-text-editor-button-groups",t.Action="action"})(pr||(pr={}));var Vb="absolute",nZ="relative",Dwe=["breadcrumbs","navigationActions","titleContent","actions","headerContent","items","footer"],eNn="This is a sample template, event handlers should be added for implementation",X_t="sap.fe.macros";var iZ={"":"http://www.w3.org/1999/xhtml",mvc:"sap.ui.core.mvc",core:"sap.ui.core",macros:"sap.fe.macros",macrosTable:"sap.fe.macros.table",macrosChart:"sap.fe.macros.chart",richtexteditor:"sap.fe.macros.richtexteditor"};function Vv(t,e){return{onError:e??((n,i)=>{throw new Error(`Unable to parse template file with building block data. Details: [${n}] - ${i}`)}),xmlns:t}}var J_t=t=>{let e=[];for(let r of t.split("/"))e.push(r===""||r.includes(":")?r:`*[local-name()='${r}']`);return e.join("/")};function yca(t,e,r,n){if(t.localName!=="Page"||t.namespaceURI!==X_t)return;let i=r||"macros",o=`${i}:items`;if(!Array.from(t.childNodes).some(a=>a.nodeType===a.ELEMENT_NODE&&a.localName==="items")){let a=t.prefix?t.nodeName:`${i}:Page`,c=`${e}/${a}/${o}`;n[c]=J_t(c)}}function rNn(t,e){let r={},n;try{let i=e.read(t),o=new Rwe.DOMParser(Vv()).parseFromString(i,"text/xml"),s=[{parentNode:"",node:o.firstChild}],a=Cg(o);n=a?`${a}:Page`:"macros:Page";let c=!1;for(;s&&s.length>0;){let{parentNode:u,node:l}=s.shift();if(!l)continue;c=Array.from(l.childNodes).some(d=>d.nodeType===d.ELEMENT_NODE&&d.localName==="Page"&&d.namespaceURI===X_t),c||(r[`${u}/${l.nodeName}`]=J_t(`${u}/${l.nodeName}`)),yca(l,u,a||"macros",r);let p=Array.from(l.childNodes);for(let d of p)d.nodeType===d.ELEMENT_NODE&&s.push({parentNode:`${u}/${l.nodeName}`,node:d})}}catch(i){throw new Error(`An error occurred while parsing the view or fragment xml. Details: ${nNn(i)}`)}return{inputChoices:r,pageMacroDefinition:n}}function nNn(t){return t instanceof Error?t.message:String(t)}async function iNn(t,e){let r=[],n="macros:FilterBar",i=e.read(t),o=new Rwe.DOMParser(Vv()).parseFromString(i,"text/xml"),s=Array.from(o.getElementsByTagName(n));for(let a of s){let c=a.getAttributeNode("id")?.value;c&&r.push(c)}return r}async function oNn(t,e,r){let n=new Set;try{let i=r.read(t),o=new Rwe.DOMParser(Vv()).parseFromString(i,"text/xml"),s=o.firstChild?._nsMap||{},c=tNn.useNamespaces(s)(e,o);if(c.length===0)return n;let u=c[0],l=Array.from(u.childNodes).find(d=>d.nodeType===1&&d.localName==="buttonGroups");if(!l)return n;Array.from(l.childNodes).filter(d=>d.nodeType===1&&d.localName==="ButtonGroup").forEach(d=>{let h=d.getAttribute("name");h&&n.add(h)})}catch(i){throw new Error(`An error occurred while reading button groups. Details: ${nNn(i)}`)}return n}function _ca(t,e){for(let r of Array.from(t.attributes))if(r.value===e){if(r.name==="xmlns")return"";if(r.name.startsWith("xmlns:"))return r.name.split(":")[1]}return null}function Cg(t,e="sap.fe.macros",r="macros"){let n=t.documentElement,i=_ca(n,e);return i!==null?i:(n.setAttributeNS("http://www.w3.org/2000/xmlns/",r===""?"xmlns":`xmlns:${r}`,e),r)}function Q_t(t,e,r){if(r<0)return e;let n=Math.max(r-1,0);for(;n>0&&e[n]===void 0;)e+=" ";return`${e.slice(0,r)}${t}${e.slice(r)}`}function lNn(t,e,r){if(r.line<0||r.character<0)return e;let n=e.split(/\r\n|\n/),i=n[r.line];for(;i===void 0;)n.push(""),i=n[r.line];return n[r.line]=Q_t(t,n[r.line],r.character),n.join(sNn.default.EOL)}async function yH(t,e){return(0,aNn.join)(await Tu(t,e),"manifest.json")}async function td(t,e,r=!0){let n=await yH(t,e);if(r&&!e.exists(n))throw new Error(`Invalid project folder. Cannot find required file ${n}`);return{path:n,content:e.readJSON(n)}}function pNn(t,e,r){let n=t.read(e).toString(),i=new uNn.DOMParser(Vv(void 0,()=>{})).parseFromString(n,"text/xml");return i.documentElement?!i.getElementById(r):!0}function Nwe(t,e){let r=t["sap.ui5"]?.dependencies?.libs;return e.length?e.some(n=>r?.[n]!==void 0):!0}async function Pg(t,e,r=["sap.fe.templates"]){e||(e=(0,fNn.create)((0,dNn.create)()));let n=await yH(t,e);if(e.exists(n)){let i=e.readJSON(n);if(!Nwe(i,r))throw r.length===1?new Error(`Dependency ${r[0]} is missing in the manifest.json. Fiori elements FPM requires the SAP FE libraries.`):new Error(`All of the dependencies ${r.join(", ")} are missing in the manifest.json. Fiori elements FPM requires the SAP FE libraries.`)}else throw new Error(`Invalid project folder. Cannot find required file ${n}`);return!0}function oZ(t){return t instanceof Error?t.message:String(t)}var _H;(function(t){t.ListReport="ListReport",t.ObjectPage="ObjectPage",t.CustomPage="CustomPage"})(_H||(_H={}));var Iwe=require("node:path");function Bv(t,e,r){return t.folder=t.folder||`ext/${t.name[0].toLocaleLowerCase()+t.name.substring(1)}`,t.ns=`${r["sap.app"].id}.${t.folder.replace(/[/\\]/g,".")}`,t.path=(0,Iwe.join)((0,Iwe.dirname)(e),t.folder),t}function Z_t(t,e,r,n=!1,i=!1,o=!0){let s,a;if(r){let c=r.split("."),u=c.pop();a=`core:require="{ handler: '${`${c.join("/")}${n?".controller":""}`}'}"`;let p=[];o&&p.push(a),i?(p.push(`value="${t}"`),p.push(`change="handler.${u}"`),s=`<Input id="${e("Input")}" ${p.join(" ")} />`):(p.push(`text="${t}"`),p.push(`press="handler.${u}"`),s=`<Button id="${e("Button")}" ${p.join(" ")} />`)}else i?s=`<Input id="${e("Input")}" value="${t}" />`:s=`<Text id="${e("Text")}" text="${t}" />`;return{content:s,requireAttribute:a}}function EH(t,e,r,n=!1,i=!1){return Z_t(t,e,r,n,i).content}var mNn=pe(zo(),1);var AEa=pe(Ma(),1),OEa=pe(la(),1),CEa=pe(al(),1);var ebt=pe(zo(),1);var cEt=pe(Ma(),1),uEt=pe(la(),1),lEt=pe(al(),1),TH=pe(zo(),1),ZC=require("node:path"),qL=pe(rU(),1),pEt=pe(JAe(),1),ANn=pe(zF(),1);var ns;(function(t){t.FilterBar="filter-bar",t.Form="form",t.Chart="chart",t.Table="table",t.Page="page",t.BuildingBlocks="building-blocks",t.RichTextEditor="rich-text-editor",t.RichTextEditorButtonGroups="rich-text-editor-button-groups"})(ns||(ns={}));var sZ;(function(t){t.JSON="json",t.CDS="cds",t.XML="xml",t.JS="javascript",t.TS="typescript",t.ABAPCDS="abapCds"})(sZ||(sZ={}));var bca={prompts:{super:{buildingBlockType:{message:"Select a building block",choices:{chart:"Chart",filterBar:"Filter Bar",table:"Table"}},manifestGroup:{manifestLibrariesTitle:"Manifest Libraries",manifestLibrariesDescription:["In order for macros to work, we need to ensure that the sap.fe.macros library is maintained in manifest.json. Please see the code snippet."]}},common:{id:{existingIdValidation:"An element with this ID already exists",defaultPlaceholder:"Enter a building block ID"},service:{defaultPlaceholder:"Select a service"},entity:{defaultPlaceholder:"Select an entity"},aggregationPath:{defaultPlaceholder:"Select an aggregation path"},filterBar:{defaultPlaceholder:"Enter a new filter bar ID"},viewOrFragmentPath:{defaultPlaceholder:"Select a view or fragment file"},bindingContextType:{option:{relative:"Relative",absolute:"Absolute"}},validation:{errorMessage:{input:"Please enter a value",select:"Please select a value"}},targetProperty:{defaultPlaceholder:"Select a target property"}},chart:{chartBuildingBlockPropertiesTitle:"Chart Building Block Properties",chartBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you would like to insert the chart building block and provide a `Building Block ID` to identify the chart.","Select an `Entity Set`, and a `Chart Annotation` you would like to use for the chart building block.","Select an `Aggregation Path` to determine where you would like the chart to be placed on the page."],chartVisualizationPropertiesTitle:"Chart Visualization Properties",chartVisualizationPropertiesDescription:["Configure your chart using the properties below."],chartConfigureEventsTitle:"Configure Events",chartConfigureEventsDescription:["Configure the below properties to react to events. Event handler methods are invoked when an event occurs."],id:{message:"Building Block ID",validation:"An ID is required to generate the chart building block"},aggregation:"Aggregation Path",entity:"Entity",service:"Service",viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the chart building block"},contextPath:"Enter the context path used in the page",metaPath:"Enter the relative path of the property in the meta model",filterBar:{message:"Associated Filter Bar ID",validation:"Enter the ID of the filter bar building block associated with the chart",placeholder:"Select or enter a filter bar ID",inputPlaceholder:"Enter a new filter bar ID"},bindingContextType:"Binding Context Path Type",personalization:{message:"Chart Personalization",choices:{type:"Type",item:"Item",sort:"Sort"},placeholder:"Select chart personalization"},selectionMode:{message:"Selection Mode",choices:{single:"Single",multiple:"Multiple"}},selectionChange:"Selection Change Event",selectionChangePlaceholder:"Enter a function to be executed",qualifier:"Chart Annotation Path",qualifierPlaceholder:"Select a chart annotation path",valuesDependentOnEntityTypeInfo:"Values are dependent on entity set"},filterBar:{filterBarBuildingBlockPropertiesTitle:"Filter Bar Building Block Properties",filterBarBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you would like to insert the filter bar building block and provide a `Building Block ID` to identify the filter bar.","Select an `Entity Set`, and a `Selection Field Annotation` you would like to use for the filter bar building block.","Select an `Aggregation Path` to determine where you would like the filter bar to be placed on the page."],filterBarConfigureEventsTitle:"Configure Events",filterBarConfigureEventsDescription:["Configure the below properties to react to events. Event handler methods are invoked when an event occurs."],id:{message:"Building Block ID",validation:"An ID is required to generate the filter bar building block"},viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the filterbar building block"},entity:"Entity",service:"Service",metaPath:"Enter the relative path of the property in the meta model",filterChanged:"Filter Changed Event",filterChangedPlaceholder:"Enter a function to be executed",search:"Search Event",searchPlaceholder:"Enter a function to be executed",qualifier:"Selection Field Annotation Path",qualifierPlaceholder:"Select a selection field annotation path",aggregation:"Aggregation Path",valuesDependentOnEntityTypeInfo:"Values are dependent on entity set",bindingContextType:"Binding Context Path Type"},form:{aggregation:"Aggregation Path",bindingContextType:"Binding Context",entity:"Entity",formBuildingBlockPropertiesTitle:"Properties of the Form Building Block",formBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you want to insert the Form building block and provide a `Building Block ID` to identify the form.","Select an `Entity Set`, and a `Field Group Annotation` you want to use for the Form building block.","Select an `Aggregation Path` to determine where you want the form to appear on the page.","Provide a `Form Title` to be displayed."],formVisualizationPropertiesTitle:"Form Visualization Properties",formVisualizationPropertiesDescription:["Configure your form using the properties below."],id:{message:"Building Block ID",validation:"An ID is required to generate the Form building block."},qualifier:"FieldGroup Annotation Path",qualifierPlaceholder:"Select a FieldGroup annotation path",viewOrFragmentPath:{message:"View or Fragment File",validate:"A View or Fragment is required to generate the Form building block."},service:"Service",title:{message:"Form Title",validation:"Enter a Form Title",translationAnnotation:"Title of the Form"},valuesDependentOnEntityTypeInfo:"Values are dependent on entity set"},table:{tableBuildingBlockPropertiesTitle:"Table Building Block Properties",tableBuildingBlockPropertiesDescription:["Select the `View or Fragment File` where you would like to insert the table building block and provide a `Building Block ID` to identify the table.","Select an `Entity Set`, and a `Line Item Annotation` you would like to use for the table building block.","Select an `Aggregation Path` to determine where you would like the table to appear on the page.","Provide the Associated Filter Bar ID if you want to link the table to an existing filter bar."],tableVisualizationPropertiesTitle:"Table Visualization Properties",tableVisualizationPropertiesDescription:["Configure your table using the properties below."],viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the table building block"},id:{message:"Building Block ID",validation:"An ID is required to generate the table building block"},bindingContextType:"Binding Context Path Type",entity:"Entity",service:"Service",qualifier:"Line Item Annotation Path",qualifierPlaceholder:"Select a line item annotation path",aggregation:"Aggregation Path",filterBar:{message:"Associated Filter Bar ID",validation:"Enter the ID of the filter bar building block associated with the table",placeholder:"Select or enter a filter bar ID",inputPlaceholder:"Enter a new filter bar ID"},tableType:{message:"Table Type"},selectionMode:{message:"Select a Selection Mode",choices:{multiple:"Multiple",single:"Single",auto:"Auto",none:"None"}},headerVisible:"Display Header",header:{message:"Table Header Text",validation:"Enter a Table Header Text",translationAnnotation:"Header of the table"},personalization:{message:"Table Personalization",choices:{Sort:"Sort",Column:"Column",Filter:"Filter"}},tableVariantManagement:"Select a Table Variant Management",readOnlyMode:"Enable Read Only Mode",autoColumnWidth:"Enable Auto Column Width",dataExport:"Enable Data Export",fullScreenMode:"Enable Full Screen Mode",pasteFromClipboard:"Enable Paste From Clipboard",tableSearchableToggle:"Table Searchable Toggle",valuesDependentOnEntityTypeInfo:"Values are dependent on entity set"},richTextEditor:{id:{message:"Building Block ID",validation:"An ID is required to generate the Rich Text Editor building block."},viewOrFragmentPath:{message:"View or Fragment File",validation:"A view or fragment is required to generate the Rich Text Editor building block."},bindingContextType:"Binding Context",relativeBindingDisabledTooltip:"There are no suitable entities available for relative binding.",valueSource:"Value Source",entitySet:"Entity",targetProperty:"Target Property",aggregation:"Aggregation Path"},richTextEditorButtonGroups:{message:"Buttons",choices:{"font-style":"Font Style (Bold, Italic, Underline, and Strikethrough)",font:"Font Settings (Family, Size, and Colors)",clipboard:"Clipboard (Cut, Copy, and Paste)",structure:"List Structure (Bullets, Numbers, and Indentation)",undo:"Undo/Redo",insert:"Insert (Image, and Emoticons)",link:"Link (Add, and Remove Links)","text-align":"Text Alignment (Left, Center, Right, and Justify)",table:"Table",styleselect:"Style Select"},viewOrFragmentPath:{message:"View or Fragment File",validation:"A view or fragment is required to generate the Rich Text Editor Button Groups building block."},aggregation:"Aggregation Path",replaceDefaultButtonGroupsHint:"Adding button groups replaces the default button groups in the Rich Text Editor with your chosen configuration."},page:{templateType:{message:"Page Layout",basic:"Basic",full:"Full"},id:{message:"Building Block ID",validation:"An ID is required to generate the page building block."},viewOrFragmentPath:{message:"View or Fragment File",validation:"A View or Fragment is required to generate the page building block."},aggregation:"Aggregation Path",title:{message:"Page Title",validation:"Enter a Page Title",translationAnnotation:"Title of the Page."},description:{message:"Page Description",validation:"Enter a Page Description",translationAnnotation:"Description of the Page."}}},pageBuildingBlock:{minUi5VersionRequirement:"The Page building block feature requires SAPUI5 {{ minUi5VersionForPageBuildingBlock }} or higher. The current version is {{ minUI5Version }}, so the Page building block will not be added.",minUi5VersionRequirementFullLayout:"Full Layout requires SAPUI5 {{ minUi5VersionForFullLayout }} or higher. The current version is {{ minUI5Version }}, so Basic Layout will be applied instead."},richTextEditorBuildingBlock:{minUi5VersionRequirement:"The Rich Text Editor building block feature requires SAPUI5 1.117.0 or higher. The current version is {{ minUI5Version }}, so the Rich Text Editor building block will not be added."}},gNn=bca;var Aca="fe-fpm-writer",ki={buildingBlock:`${Aca}-building-block`},yNn=Dn.createInstance();async function Mwe(){await yNn.init({resources:{en:{[ki.buildingBlock]:gNn}},lng:"en",fallbackLng:"en",defaultNS:ki.buildingBlock,ns:[ki.buildingBlock]})}function Po(t,e){return(r,n)=>yNn.t(`${t}:${e??""}${r}`,n)}var Lwe=require("node:path"),tEt=pe(zF(),1);var _Nn=require("node:path");var Oca={name:"event",jsName:"oEvent",description:"the event object provided by the event provider.",importType:"UI5Event",importSource:"sap/ui/base/Event"};function Cca(t,e){let r;return e&&t.endsWith(".controller")?r=t.replace(".controller",""):r=t,r}function jv(t,e,r,n,i=[Oca]){let{controllerSuffix:o,typescript:s,templatePath:a="common/EventHandler"}=n,{eventHandlerFnName:c="onPress"}=n;if(typeof r=="string")return r;let u,l="",p=e.name,d=p;typeof r=="object"&&(l=r.controllerPrefix,r.fnName&&(c=r.fnName),u=r.insertScript,r.fileName&&(p=r.fileName,d=Cca(p,l)));let h=s?"ts":"js",f=(0,_Nn.join)(e.path||"",`${p}${o?".controller":""}.${h}`);if(!t.exists(f))B_(t,Bs(`${a}.${h}`),f,{eventHandlerFnName:c,parameters:i,...e});else if(u){let _=t.read(f);typeof u.position=="object"?_=lNn(u.fragment,_,u.position):_=Q_t(u.fragment,_,u.position),t.write(f,_)}let m=`${e.ns}.${d}.${c}`;return l?`${l}.${m}`:`${m}`}var rEt=[{name:"font-style",buttons:"bold,italic,underline,strikethrough"},{name:"clipboard",buttons:"cut,copy,paste"},{name:"structure",buttons:"bullist,numlist,outdent,indent"},{name:"font",buttons:"fontfamily,fontsize,forecolor,backcolor"},{name:"undo",buttons:"undo,redo"},{name:"insert",buttons:"image,emoticons"},{name:"link",buttons:"link,unlink"},{name:"text-align",buttons:"alignleft,aligncenter,alignright,alignjustify"},{name:"table",buttons:"table"},{name:"styleselect",buttons:"styleselect"}],ENn={[pr.CustomColumn]:{aggregationConfig:{aggregationName:"columns",elementName:"Column"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Pca},[pr.CustomFilterField]:{aggregationConfig:{aggregationName:"filterFields",elementName:"FilterField"},templateFile:"filter/fragment.xml",namespace:{uri:"sap.fe.macros.filterBar",prefix:"macros"},processor:xca},[pr.CustomFormField]:{aggregationConfig:{aggregationName:"fields",elementName:"FormElement"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:wca},[pr.RichTextEditorButtonGroups]:{aggregationConfig:{aggregationName:"buttonGroups",elementName:"ButtonGroup"},namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:Ica},[pr.Action]:{aggregationConfig:{aggregationName:"actions",elementName:"Action"},namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Mca}};function kwe(t){let e=ENn[t];if(!e)throw new Error(`No configuration found for building block type: ${t}`);return e}function q_(t,e){return t.buildingBlockType===e}function Pca(t,e){let{fs:r,viewPath:n}=e;if(!q_(t,pr.CustomColumn))throw new Error("Expected CustomColumn building block data");let i=kwe(pr.CustomColumn),o=t.embededFragment,s;o.eventHandler&&(s=jv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content=EH("Sample Text",t.generateId,s),n&&!r.exists(n)&&r.copyTpl(Bs(i.templateFile),n,o)}function xca(t,e){let{fs:r,viewPath:n,embeddedFragment:i}=e;if(!q_(t,pr.CustomFilterField))throw new Error("Expected CustomFilterField building block data");if(!i)throw new Error("EmbeddedFragment is required for CustomFilterField");let o=kwe(pr.CustomFilterField),s={label:t.label,property:t.property,required:t.required??!1,position:t.position,eventHandler:t.embededFragment?.eventHandler,ns:i.ns,name:i.name,path:i.path};s.eventHandler&&(s.eventHandler=jv(r,s,s.eventHandler,{controllerSuffix:!1,typescript:t.embededFragment?.typescript,templatePath:"filter/Controller"}));let a=o.templateFile,c=rZ[a];if(c?.getData){let u=c.getData(t.generateId);s={...s,...u}}n&&!r.exists(n)&&r.copyTpl(Bs(o.templateFile),n,s)}function wca(t,e){let{fs:r,viewPath:n}=e;if(!q_(t,pr.CustomFormField))throw new Error("Expected CustomFormField building block data");if(!t.embededFragment)throw new Error("EmbeddedFragment is required for CustomFormField");let i=kwe(pr.CustomFormField),o=t.embededFragment,s;o.eventHandler&&(s=jv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content??=EH("Custom Form Field Content",t.generateId,s),n&&!r.exists(n)&&r.copyTpl(Bs(i.templateFile),n,o)}function Dca(t){let e=t.getAttribute("name"),r=t.getAttribute("buttons");if(!e||!r)return;let n={name:e,buttons:r};r&&(n.buttons=r);let i=t.getAttribute("visible");i&&(n.visible=i==="true");let o=t.getAttribute("priority");o&&(n.priority=Number.parseInt(o,10));let s=t.getAttribute("customToolbarPriority");s&&(n.customToolbarPriority=Number.parseInt(s,10));let a=t.getAttribute("row");a&&(n.row=Number.parseInt(a,10));let c=t.getAttribute("id");return c&&(n.id=c),n}function Rca(t){let e=Array.from(t.values()).map(r=>r.customToolbarPriority).filter(r=>typeof r=="number");return e.length>0?Math.max(...e)+1:1}function Nca(t,e){let r=Rca(t);return e.buttonGroups?.map(n=>{let i=rEt.find(c=>c.name===n.name);if(!i)throw new Error(`Unknown button group: ${n.name}`);let o=t.get(n.name),s=Object.keys(n).some(c=>c!=="name"&&n[c]!==void 0),a=n.customToolbarPriority;return a===void 0&&!o?a=r++:o?.customToolbarPriority!==void 0&&(a=o.customToolbarPriority),o&&!s?{...o,customToolbarPriority:a}:{name:n.name,buttons:n.buttons??i.buttons,visible:n.visible,priority:n.priority,customToolbarPriority:a,row:n.row,id:n.id}})}function Ica(t,e){let{xmlDocument:r,updatedAggregationPath:n,hasAggregation:i}=e;if(!q_(t,pr.RichTextEditorButtonGroups)&&!q_(t,pr.RichTextEditor))throw new Error("Expected RichTextEditorButtonGroups or RichTextEditor building block data");let o=new Map;if(i&&r&&n){let a=tEt.useNamespaces(r.documentElement?._nsMap??{})(n,r);if(a.length>0){let c=a[0],u=kwe(pr.RichTextEditorButtonGroups);Array.from(c.childNodes).filter(d=>d.nodeType===1&&d.localName===u.aggregationConfig.elementName).forEach(d=>{let h=Dca(d);h&&o.set(h.name,h)});let p=a[0];p.parentNode?.removeChild(p)}}t.buttonGroups=Nca(o,t)}function vH(t){return t.replace(/\/([A-Za-z_][A-Za-z0-9_.-]*)(?=\/|$)/g,(e,r)=>r.includes(":")?`/${r}`:`/*[local-name()='${r}']`)}function eEt(t,e,r,n){let i=t.documentElement?._nsMap??{},o=tEt.useNamespaces(i),s=vH(e),a=o(s,t);if(!a||!Array.isArray(a)||a.length===0)return{updatedAggregationPath:e,hasElement:!1};let c=a[0],u=o(`./*[local-name()='${r.aggregationName}']`,c);if(u&&Array.isArray(u)&&u.length>0)return{updatedAggregationPath:e+`/${Cg(t,n?.uri)}:${r.aggregationName}`,hasElement:!0};{let l=o(`./*[local-name()='${r.elementName}']`,c);if(l&&Array.isArray(l)&&l.length>0)return{updatedAggregationPath:e,hasElement:!0}}return{updatedAggregationPath:e,hasElement:!1}}function Mca(t,e){let{fs:r}=e;if(!q_(t,pr.Action))throw new Error("Expected Action building block data");let n=t.embeddedAction;if(typeof n.eventHandler=="object"){let i=jv(r,n,n.eventHandler,{typescript:n.typescript}),o=n.eventHandler?n.eventHandler.fnName:i;if(n.eventHandler.fileName?.includes(".controller"))n.eventHandler={fnName:`.${o}`};else{let s;if(n.eventHandler.fileName){let a=e.embeddedAction?.ns?.split(".").join("/");s=Lwe.posix.join(a??"",n.eventHandler.fileName)}n.eventHandler={fnName:`handler.${o}`,fileName:s}}}}function vNn(t,e,r,n,i,o){let s=i,a=!1,c="macrosTable",u,l,p=ENn[t.buildingBlockType];if(!p)return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c};if(q_(t,pr.RichTextEditorButtonGroups)||q_(t,pr.RichTextEditor)){let d=eEt(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName},{uri:p.namespace.uri,prefix:p.namespace.prefix}),h={fs:o,xmlDocument:e,updatedAggregationPath:d.updatedAggregationPath,hasAggregation:d.hasElement};p.processor(t,h),c=Cg(e,p.namespace.uri,p.namespace.prefix)}if((q_(t,pr.CustomColumn)||q_(t,pr.CustomFilterField)||q_(t,pr.CustomFormField))&&t.embededFragment){u=Bv(t.embededFragment,r,n),l=(0,Lwe.join)(u.path,`${u.fragmentFile??u.name}.fragment.xml`);let d={fs:o,viewPath:l,embeddedFragment:u};p.processor(t,d);let h=eEt(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName});s=h.updatedAggregationPath,a=h.hasElement,c=Cg(e,p.namespace.uri,p.namespace.prefix)}if(q_(t,pr.Action)&&t.embeddedAction){let d=eEt(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName}),h={fs:o,xmlDocument:e,updatedAggregationPath:d.updatedAggregationPath,hasAggregation:d.hasElement,embeddedAction:Bv(t.embeddedAction,r,n)};p.processor(t,h),s=d.updatedAggregationPath,a=d.hasElement,Cg(e,p.namespace.uri,p.namespace.prefix)}return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c}}var Lca=pe(Ma(),1),kca=pe(la(),1),TNn=pe(al(),1),SNn=require("node:path"),Fwe=pe(rU(),1);var nEt=pe(zF(),1),Uwe=pe(zo(),1);function $we(t,e,r){let n;try{n=r.read((0,SNn.join)(t,e))}catch(o){throw new Error(`Unable to read xml view file. Details: ${oZ(o)}`)}let i;try{i=new Fwe.DOMParser(Vv()).parseFromString(n,"text/xml")}catch(o){throw new Error(`Unable to parse xml view file. Details: ${oZ(o)}`)}return i}function iEt(t){if(t.buildingBlockType===pr.Page)return t.templateType===j_.Full?Dwe:void 0}function oEt(t){let e=t?(0,Uwe.coerce)(mg(t)):void 0;if(e&&(0,Uwe.lt)(e,BL)){let r=Po(ki.buildingBlock,"pageBuildingBlock.");throw new Error(`${r("fullTemplateMinUi5VersionRequirement",{minUI5Version:e.version})}`)}}function Fca(t){let e=Cg(t,"sap.fe.macros","macros");return e===""?(t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:macros","sap.fe.macros"),"macros"):e}var Uca={breadcrumbs:[{key:"Breadcrumbs",base:"breadcrumbs_breadcrumbs"},{key:"Link",base:"breadcrumbs_link"},{key:"Link1",base:"breadcrumbs_link"},{key:"Link2",base:"breadcrumbs_link"}],navigationActions:[{key:"Button",base:"navigationActions_button"}],titleContent:[{key:"GenericTag",base:"titleContent_genericTag"}],actions:[{key:"Button",base:"actions_button"},{key:"Button1",base:"actions_button"}],headerContent:[{key:"VBox",base:"headerContent_vbox"},{key:"Title",base:"headerContent_title"}],footer:[{key:"OverflowToolbar",base:"footer_overflowToolbar"},{key:"ToolbarSpacer",base:"footer_toolbarSpacer"},{key:"Button",base:"footer_button"},{key:"Button1",base:"footer_button"}]};function $ca(t,e,r=[]){let n=Uca[t]??[],i=[...r],o={};for(let{key:s,base:a}of n){let c=e(a,i);o[s]=c,i.push(c)}return o}function Vca(t,e,r,n,i){let o=Bs(`/building-block/page/${e}.xml`),s=(0,TNn.render)(t.read(o),r,{}),a=Array.from(i.documentElement.attributes).filter(u=>u.name.startsWith("xmlns:")&&u.name!==`xmlns:${n}`&&u.name!=="xmlns:m").map(u=>`${u.name}="${u.value}"`).join(" "),c=`<root xmlns:${n}="sap.fe.macros" xmlns="sap.m" xmlns:m="sap.m" ${a}>${s}</root>`;return new Fwe.DOMParser(Vv(iZ,(u,l)=>{throw new Error(`Unable to parse page aggregation fragment '${e}'. Details: [${u}] - ${l}`)})).parseFromString(c,"text/xml")}function sEt(t,e,r,n,i=Dwe,o=!0){let s=Fca(e),a=`${s}:`,c=r.documentElement;c.appendChild(r.createComment(eNn));for(let u of i){let l=n(u),p=u==="items"&&o,d=$ca(u,n),f=Vca(t,u,{macrosPrefix:a,aggId:l,showDefaultContent:p,ids:d,aggIndex:1},s,e);for(let m of Array.from(f.documentElement.childNodes))m.nodeType===1&&c.appendChild(r.importNode(m,!0))}}function bNn(t,e){let r=t.documentElement?._nsMap??{};if(nEt.useNamespaces(r)(vH(e),t).length>0)return;let i=e.lastIndexOf("/");if(i<=0)return;let o=e.slice(i+1),s=o.indexOf(":");if(s===-1)return;let a=o.slice(0,s),c=o.slice(s+1),u=r[a];if(!u&&a==="macros"&&(u="sap.fe.macros"),!u)return;Cg(t,u,a)===""&&a&&t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${a}`,u);let d=nEt.useNamespaces({...r,[a]:u})(vH(e.slice(0,i)),t);d.length!==0&&d[0].appendChild(t.createElementNS(u,`${a}:${c}`))}var jL={id:"REPLACE_WITH_BUILDING_BLOCK_ID",entitySet:"REPLACE_WITH_ENTITY",qualifier:"REPLACE_WITH_A_QUALIFIER"};function aEt(t){return t.buildingBlockType===pr.Page&&t.templateType===j_.Full}async function Bb(t,e,r){let{viewOrFragmentPath:n,aggregationPath:i,buildingBlockData:o,allowAutoAddDependencyLib:s=!0}=e;r??=(0,uEt.create)((0,cEt.create)()),await Pg(t,r,[]);let a=e.buildingBlockData.generateId??await V_({basePath:t,fsEditor:r});if(!r.exists((0,ZC.join)(t,n)))throw new Error(`Invalid view path ${n}.`);let{path:c,content:u}=await td(t,r),l=$we(t,n,r);i&&bNn(l,i);let{updatedAggregationPath:p,processedBuildingBlockData:d,hasAggregation:h,aggregationNamespace:f}=vNn({...o,generateId:a},l,c,u,i,r),m={hasAggregation:h,aggregationNamespace:f},_=Gca({...d,generateId:a},l,r,u,m),v=aEt(o),b=iEt(o);if(v&&oEt(u),b&&sEt(r,l,_,a,b,v),o.buildingBlockType===pr.RichTextEditor||o.buildingBlockType===pr.RichTextEditorButtonGroups){let S=u?(0,TH.coerce)(mg(u)):void 0;if(S&&(0,TH.lt)(S,"1.117.0")){let A=Po(ki.buildingBlock,"richTextEditorBuildingBlock.");throw new Error(`${A("minUi5VersionRequirement",{minUI5Version:S})}`)}Cg(l,"sap.fe.macros.richtexteditor","richtexteditor")}if(r=Hca(t,n,p,l,_,r,e.replace),s&&u&&!Nwe(u,["sap.fe.macros"])){let S=await yH(t,r),A=await CNn(r),C=r.read(S),D=Y_t(C);QC(r,{filepath:S,content:A,tabInfo:D})}return r}function jca(t,e){return t?{metaPath:e?`/${jL.qualifier}`:"",contextPath:e?jL.entitySet:""}:{metaPath:e?`/${jL.entitySet}/${jL.qualifier}`:""}}function qca(t,e,r,n){if(!e)return jca(t,r);let{bindingContextType:i=Vb,alwaysAbsolutePath:o=!0}=e,{entitySet:s,qualifier:a}=e;s=s||(r?jL.entitySet:"");let c=a||(r?jL.qualifier:"");if(t){let u=c.split("/");return a=u.pop(),{metaPath:a,contextPath:u.length?`/${s}/${u.join("/")}`:`/${s}`}}return n?{metaPath:`${i===Vb?"/":""}${s}/${n}`}:{metaPath:i===Vb||o?`/${s}/${c}`:c}}function ONn(t,e,r,n,i,o){let s=t.buildingBlockType,a=Bs(`/building-block/${s}/View.xml`);if(typeof t.metaPath=="object"||t.metaPath===void 0){let p=r?(0,TH.coerce)(mg(r)):void 0,d;(t.buildingBlockType===pr.RichTextEditor||t.buildingBlockType===pr.CustomFormField)&&"targetProperty"in t&&typeof t.targetProperty=="string"&&(d=t.targetProperty);let h=t.buildingBlockType===pr.Chart||!!(p&&(0,TH.lt)(p,"1.97.0")),f=qca(h,t.metaPath,i,d);t={...t,metaPath:f.metaPath},!t.contextPath&&f.contextPath&&(t.contextPath=f.contextPath)}t.id||(t.id=jL.id);let c=wwe(a),u=rZ[c],l={macrosNamespace:e?Cg(e,"sap.fe.macros","macros"):"macros",data:t,config:o};if(u?.getData){let p=u.getData(t.generateId,t);l={...l,...p}}return(0,lEt.render)(n.read(a),l,{})}async function CNn(t,e="sap.fe.macros"){let r=Bs("/building-block/common/manifest.json");return(0,lEt.render)(t.read(r),{libraries:{[e]:{}}})}function Gca(t,e,r,n,i){let o=ONn(t,e,n,r,void 0,i),s;try{s=new qL.DOMParser(Vv(iZ)).parseFromString(o,"text/xml")}catch(a){throw new Error(`Unable to parse template file with building block data. Details: ${oZ(a)}`)}return s}function Hca(t,e,r,n,i,o,s=!1){let a=n.documentElement??n.firstChild;if(!a)throw new Error(`Unable to read namespace map from view ${e}.`);let c=a?._nsMap??{},u=ANn.useNamespaces(c),l=vH(r),p=u(l,n);if(p&&Array.isArray(p)&&p.length>0){let d=p[0],h=n.importNode(i.documentElement,!0);s?d.parentNode?.replaceChild(h,d):d.appendChild(h);let f=new qL.XMLSerializer().serializeToString(n);o.write((0,ZC.join)(t,e),(0,pEt.default)(f))}else throw new Error(`Aggregation control not found ${r}.`);return o}function zca(t,e){return e?{fileName:(0,ZC.parse)(e).base,relativePath:e,fullPath:(0,ZC.join)(t,e)}:{}}async function e0(t,e,r){let n={},{buildingBlockData:i,viewOrFragmentPath:o,allowAutoAddDependencyLib:s=!0}=e;if(!i?.buildingBlockType)return{};r=r??(0,uEt.create)((0,cEt.create)());let a=o?$we(t,o,r):void 0,{content:c,path:u}=await td(t,r,!1),l=i.generateId??await V_({basePath:t,fsEditor:r}),p=ONn({...i,generateId:l},a,c,r,!0),d=p,h=iEt(i);if(h){aEt(i)&&oEt(c);let m=a??new qL.DOMParser().parseFromString('<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:macros="sap.fe.macros" xmlns="sap.m"/>',"text/xml"),_=Cg(m,"sap.fe.macros","macros")||"macros",v=`${p}`.replace(new RegExp(`^<(${_}:Page)`),`<$1 xmlns:${_}="sap.fe.macros"`),b=new qL.DOMParser(Vv(iZ,(A,C)=>{throw new Error(`Unable to parse Page building block snippet. Details: [${A}] - ${C}`)})).parseFromString(v,"text/xml");sEt(r,m,b,l,h,aEt(i));let S=b.documentElement;d=S?(0,pEt.default)(new qL.XMLSerializer().serializeToString(S)):p}let f=zca(t,o);if(n.viewOrFragmentPath={content:d,language:sZ.XML,filePathProps:f},s){let m=await CNn(r);n.manifest={content:m,language:sZ.JSON,filePathProps:{fileName:(0,ZC.parse)(u).base,relativePath:(0,ZC.relative)(t,u),fullPath:u}}}return n}function JD(t){return["CAPJava","CAPNodejs"].includes(t.projectType)}var y3=require("node:path");var l$n=pe(VC(),1);var o$n=pe(Ma(),1),s$n=pe(la(),1);var t0="attribute",Cr="text",aZ;(function(t){t.StripIndentation="StripIndentation",t.KeepIndentation="KeepIndentation"})(aZ||(aZ={}));var _t="element",GL="Edmx",QD="Edm",Vwe="reference",PNn="namespace",Jr="target",ZD="annotation-file";function wr(t,e,r,n){let i={type:t0,name:t,value:e};return r&&(i.nameRange=r),n&&(i.valueRange=n),i}function Kn(t,e,r,n){let i={type:Cr,text:t};return e&&(i.range=e),r&&(i.fragmentRanges=r),n&&(i.multilineType=n),i}function Et({name:t,range:e,nameRange:r,attributes:n,content:i,contentRange:o,namespace:s,namespaceAlias:a}){let c={type:_t,name:t,attributes:n??{},content:i??[]};return e&&(c.range=e),r&&(c.nameRange=r),o&&(c.contentRange=o),s&&(c.namespace=s),a&&(c.namespaceAlias=a),c}var eR="!";function Bwe(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function dEt(t,e,r,n){let{aliasRange:i,uriRange:o,nameRange:s,range:a}=n??{};return{type:"reference",name:t,alias:e,uri:r,range:a,nameRange:s,aliasRange:i,uriRange:o}}var cZ="TypeDefinition",HL="EnumType",G_="ComplexType",yf="Term";var xNn="Action",wNn="Function";var jwe="Property";var DNn="ActionImport",RNn="FunctionImport";var k;(function(t){t.Action="Action",t.ActionImport="ActionImport",t.Add="Add",t.Alias="Alias",t.And="And",t.Annotation="Annotation",t.Annotations="Annotations",t.AnnotationPath="AnnotationPath",t.Association="Association",t.AssociationSet="AssociationSet",t.Apply="Apply",t.Binary="Binary",t.Bool="Bool",t.Cast="Cast",t.Collection="Collection",t.ComplexType="ComplexType",t.ContainsTarget="ContainsTarget",t.Date="Date",t.DateTimeOffset="DateTimeOffset",t.Decimal="Decimal",t.DefaultValue="DefaultValue",t.Div="Div",t.Duration="Duration",t.EntityContainer="EntityContainer",t.EntitySet="EntitySet",t.EntityType="EntityType",t.EnumMember="EnumMember",t.EnumType="EnumType",t.Eq="Eq",t.Float="Float",t.Function="Function",t.FunctionImport="FunctionImport",t.Ge="Ge",t.Gt="Gt",t.Guid="Guid",t.If="If",t.In="In",t.Include="Include",t.Int="Int",t.IsOf="IsOf",t.LabeledElement="LabeledElement",t.Le="Le",t.Lt="Lt",t.MaxLength="MaxLength",t.Member="Member",t.ModelElementPath="ModelElementPath",t.Mul="Mul",t.Name="Name",t.Namespace="Namespace",t.NavigationProperty="NavigationProperty",t.NavigationPropertyPath="NavigationPropertyPath",t.Ne="Ne",t.Neg="Neg",t.Not="Not",t.Null="Null",t.Nullable="Nullable",t.OnDelete="OnDelete",t.Parameter="Parameter",t.Partner="Partner",t.Path="Path",t.Precision="Precision",t.Property="Property",t.PropertyPath="PropertyPath",t.PropertyValue="PropertyValue",t.Or="Or",t.Qualifier="Qualifier",t.Record="Record",t.Reference="Reference",t.ReferentialConstraint="ReferentialConstraint",t.ReferencedProperty="ReferencedProperty",t.ReturnType="ReturnType",t.Scale="Scale",t.Schema="Schema",t.Singleton="Singleton",t.SRID="SRID",t.String="String",t.Sub="Sub",t.Target="Target",t.Term="Term",t.TimeOfDay="TimeOfDay",t.Type="Type",t.TypeDefinition="TypeDefinition",t.Unicode="Unicode",t.UrlRef="UrlRef"})(k||(k={}));var NNn;(function(t){t.Binary="Edm.Binary",t.Boolean="Edm.Boolean",t.Byte="Edm.Byte",t.Date="Edm.Date",t.DateTimeOffset="Edm.DateTimeOffset",t.Decimal="Edm.Decimal",t.Double="Edm.Double",t.Duration="Edm.Duration",t.Guid="Edm.Guid",t.Int16="Edm.Int16",t.Int32="Edm.Int32",t.Int64="Edm.Int64",t.SByte="Edm.SByte",t.Single="Edm.Single",t.Stream="Edm.Stream",t.String="Edm.String",t.TimeOfDay="Edm.TimeOfDay",t.PrimitiveType="Edm.PrimitiveType",t.ComplexType="Edm.ComplexType",t.EntityType="Edm.EntityType",t.Untyped="Edm.Untyped",t.EntityTypeCollection="Edm.EntityTypeCollection",t.NonEntityTypeCollection="Edm.NonEntityTypeCollection",t.AnnotationPath="Edm.AnnotationPath",t.AnyPropertyPath="Edm.AnyPropertyPath",t.ModelElementPath="Edm.ModelElementPath",t.NavigationPropertyPath="Edm.NavigationPropertyPath",t.PropertyPath="Edm.PropertyPath",t.VirtualProperty="Edm.VirtualProperty",t.PrimitiveCollection="Edm.PrimitiveCollection",t.DataModelEnum="Edm.DataModelEnum"})(NNn||(NNn={}));var xo;(function(t){t.Alias="Alias",t.DataServices="DataServices",t.Edmx="Edmx",t.Import="Import",t.Include="Include",t.Namespace="Namespace",t.Reference="Reference",t.Uri="Uri",t.Version="Version"})(xo||(xo={}));var zL;(function(t){t.DataServices="DataServices",t.Edmx="Edmx",t.Include="Include",t.IncludeAnnotations="IncludeAnnotations",t.Reference="Reference"})(zL||(zL={}));var INn;(function(t){t.Uri="Uri"})(INn||(INn={}));var MNn;(function(t){t.Alias="Alias",t.Namespace="Namespace"})(MNn||(MNn={}));var EXc=new Set([zL.DataServices,zL.Edmx,zL.Include,zL.IncludeAnnotations,zL.Reference]);var zc={printWidth:300,tabWidth:4,useTabs:!1,useSnippetSyntax:!0};var LNn="missing-required-property";var qwe="common-case-issue",kNn="no-odata-path-separator";var FNn="deprecated-$value-syntax";var SH="Collection(";function Kc(t){if(t.startsWith(SH))return UNn(t);let e=t.indexOf("(")+1;if(e>0){let r=t.slice(0,e-1),n=t.slice(e,-1),i=Gwe(r),o=n.length>0?n.split(",").map(s=>s.startsWith(SH)?UNn(s):Gwe(s)):[];return{...i,type:"action-function",parameters:o}}return Gwe(t)}function UNn(t){let e=t.endsWith(")")?-1:void 0;return{...Gwe(t.slice(SH.length,e)),type:"collection"}}function Gwe(t){let e=t.split(".");return e.length>1?{type:"identifier",namespaceOrAlias:e.slice(0,-1).join("."),name:e.splice(-1)[0]}:{type:"identifier",name:t}}function rd(t,e,r){let n=r.namespaceOrAlias?t[r.namespaceOrAlias]:e;if(!n)return;if(r.type==="action-function"){let o=r.parameters.map(s=>rd(t,e,s)).filter(s=>!!s).join(",");return`${n}.${r.name}(${o})`}let i=`${n}.${r.name}`;return r.type==="collection"?`Collection(${i})`:i}function xg(t,e){let r={name:t,qName:t};if(t&&typeof t=="string"&&t.indexOf(".")){let n=t.indexOf("("),i=n>-1?t.slice(0,n):t,{name:o,namespaceOrAlias:s}=Kc(i);Kca(t,s,e,r,o),Wca(t,n,e,r,s)}return r}function _f(t,e){let r=xg(t,e.aliasMap),n=r.namespace?e.reverseAliasMap[r.namespace]:void 0,i=n?`${n}.${r.name}`:t,o=i.indexOf("(");if(o>-1){let s=i.slice(0,o),c=i.slice(o+1,i.lastIndexOf(")")).split(",");c=c.map(u=>_f(u,e)),i=s+"("+c.join(",")+")"}return i}function Kca(t,e,r,n,i){t.startsWith(SH)||(e&&r?.[e]?(r[e]&&r[e]!==e?(n.alias=e,n.namespace=r[e]):n.namespace=e,n.name=i,n.qName=n.namespace+"."+i):r||(n.name=i,n.namespace=e))}function Wca(t,e,r,n,i){if(e>-1){let o=t.slice(e+1,t.lastIndexOf(")")),s=Kc(t);if(s.type!=="collection"&&(n.name+="("+o+")"),i&&r?.[i]){if(s.type==="collection"){let a=`${s.namespaceOrAlias}.${s.name}`,c=VNn(s.type,a);c.name=xg(c.name,r).qName;let u=$Nn(c);n.qName=u}else if(s.type==="action-function"){let a=s.parameters.map(c=>{let u=`${c.namespaceOrAlias}.${c.name}`,l=VNn(c.type,u);return l.name=xg(l.name,r).qName,$Nn(l)});n.qName+="("+a.join(",")+")"}}else if(s.type==="collection"){let a=xg(o,r).qName;n.qName="Collection("+a+")"}}}function $Nn(t){return t?.asCollection?"Collection("+t.name+")":t?.name||""}function VNn(t,e){return{name:e,asCollection:t==="collection"}}function wg(t,e){let r={},n={},i={},o={},s="",a="";return t.forEach(c=>{let u={},l={};if(c?.name){u[c.name]=c.name,l[c.name]=c.name,c.alias&&(u[c.alias]=c.name,l[c.name]=c.alias),Object.assign(r,u),Object.assign(n,l);let p=e.has(c.name);c.type==="namespace"?(s=c.name,a=c.alias??"",p&&Object.assign(i,u)):Object.assign(p?i:o,u)}}),{currentFileNamespace:s,currentFileAlias:a,aliasMap:r,reverseAliasMap:n,aliasMapMetadata:i,aliasMapVocabulary:o}}function Dg(t,e){let r=[];return t?.name&&r.push(t),e?.length&&r.push(...e),r}var fEt="/";function tR(t){return{segments:t.split(fEt).map(r=>{let n=r.indexOf("@");if(n===0){let[o,s]=r.slice(1).split("#");return{...Kc(o),type:"term-cast",qualifier:s}}else if(n>0){let[o,s]=r.split("@"),a=Kc(o),[c,u]=s.split("#");return{...a,type:"navigation-property-annotation",term:{...Kc(c),type:"term-cast",qualifier:u}}}let i=Kc(r);if(i.type==="identifier"||i.type==="action-function")return i}).filter(r=>!!r)}}function bH(t,e,r){return r.segments.map(n=>Yca(t,e,n)).join(fEt)}function Yca(t,e,r){let n=r.namespaceOrAlias?t[r.namespaceOrAlias]:e;switch(r.type){case"action-function":{let i=r.parameters.map(o=>rd(t,e,o)).filter(o=>!!o).join(",");return`${n??r.namespaceOrAlias}.${r.name}(${i})`}case"identifier":return r.namespaceOrAlias===void 0?r.name:`${n??r.namespaceOrAlias}.${r.name}`;case"term-cast":return`@${rd(t,e,{...r,type:"identifier"})??""}${r.qualifier?"#"+r.qualifier:""}`;case"navigation-property-annotation":return`${rd(t,e,{type:"identifier",name:r.name,namespaceOrAlias:r.namespaceOrAlias})??""}@${rd(t,e,{...r.term,type:"identifier"})??""}${r.term.qualifier?"#"+r.term.qualifier:""}`;default:return""}}var hEt=class{forCompletion=!1;visit(e,r,n){let i=this[e.type];if(!(e.range&&!Ao(e.range,r))&&i)return i(e,r,n)}[ZD]=(e,r,n)=>this.visitChildren("references",e.references,e.range,r,n)??this.visitChildren("targets",e.targets,e.range,r,n)??this.visitChild(e.namespace,r,[...n,"namespace"]);[Jr]=(e,r,n)=>{let i=Ao(e.termsRange,r)?"terms":"";return this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitChildren("terms",e.terms,e.termsRange,r,n)??{path:[...n,i],range:e.termsRange}};[PNn]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("alias",e.alias,e.aliasRange,r,n)??{path:[...n,"targets"],range:e.range};[Vwe]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("alias",e.alias,e.aliasRange,r,n);[Cr]=(e,r,n)=>this.visitTextProperty("text",e.text,e.range,r,n);[t0]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("value",e.value,e.valueRange,r,n);[_t]=(e,r,n)=>{if(!e.range)return;let i=this.forCompletion?1:0,o=e.range.start.character+i,s=Ke.create(qt.create(e.range.start.line,o),e.range.end);if(!Ao(s,r))return;let a=Object.keys(e.attributes);if(Ao(e.nameRange,r))return this.visitTextProperty("name",e.name,e.nameRange,r,n);for(let c of a){let u=e.attributes[c],l=this.visit(u,r,[...n,"attributes",c]);if(l)return l}return Ao(e.contentRange,r)?this.visitContent(e,r,n):(e.attributes[""]=wr("",""),{path:[...n,"attributes","","name"],range:e.range})};visitContent(e,r,n){return this.visitChildren("content",e.content,e.contentRange,r,n)??this.findRelativePosition(e,r,n)}findRelativePosition(e,r,n){let i=e.content.findIndex(o=>o.range&&Xi(r,o.range.start,!0));return i===-1?(e.content.push(Kn("",e.contentRange)),{path:[...n,"content",0,"text"],range:e.contentRange}):{path:[...n,`$${i===-1?e.content.length:i}`],range:e.contentRange}}visitChildren(e,r,n,i,o){if(Ao(n,i))for(let s=0;s<r.length;s++){let a=r[s],c=this.visitChild(a,i,[...o,e,s]);if(c)return c}}visitChild(e,r,n){if(e===void 0)return;let i=this.visit(e,r,n);if(i)return i}visitTextProperty(e,r,n,i,o){if(r!==void 0&&Ao(n,i)){let s=Xca(r,n,i),a=i.character-n.start.character;return{path:[...o,e,`$${a}`],range:n,...s}}}},eJc=new hEt;function Xca(t,e,r){let n=r.character-e.start.character;return{startString:t.slice(0,n),remainingString:t.slice(n,e.end.character)}}var BNn=(t,e)=>(e.content||[]).filter(r=>r.type===_t&&(!t||t(r))),dl=(t,e)=>BNn(r=>r.name===t,e),qv=(t,e)=>t?.attributes?.[e],Vo=(t,e)=>qv(t,e)?.value??"";function KL(t,e){return t?.type===_t&&t.name===e}function Jca(t){return(t||"").replace(/\s/g,"").length===0}function AH(t){let e=!1,r=null;return(t.content||[]).forEach(n=>{e||(n.type===_t&&n.name!==k.Annotation?e=!0:n.type===Cr&&!Jca(n.text)&&(r?e=!0:r=n))}),e?null:r}function mEt(t,e,r){let i=(e.startsWith("/")?e.slice(1):e).split("/").map(c=>r?gEt(r,c):c),o=[],s=null,a=null;for(let c=0;c<i.length&&!s;c++){o.push(i[c]);let u=o.join("/"),l=t.getMetadataElement(u);l&&(a=l,(Qca(l)||Zca(t,u))&&(s=l))}return s??a}function Qca(t){return!!t.isEntityType||!!t.isComplexType||!!t.structuredType}function Zca(t,e){let r=t.getEdmTargetKinds(e),n=new Set([xNn,wNn,DNn,RNn]);return r.findIndex(i=>n.has(i))>=0}function gEt(t,e){let r="",n=e.indexOf("@");if(n>=0){let i=xg(e.substring(n+1),t.aliasMap).qName;r=e.substring(0,n)+"@"+i}else e.indexOf(".")>-1?r=xg(e,t.aliasMap).qName:r=e;return r}function Rg(t,e,r){let n=tR(r);return bH(t,e,n)}function WL(t,e,r){return r.split(" ").map(n=>Rg(t,e,n)).join(" ")}function Hwe(t,e){return e.split(" ").map(r=>_f(r,t)).join(" ")}function EEt(t,e,r){if(!t.references)return[];let n=[],i=nua(t.references),o=t.uri.startsWith(eR)||!t.namespace?e:t.namespace?.name??"",s=t.namespace?.alias??"";Object.freeze(i);for(let a=0;a<t.targets.length;a++){let c=t.targets[a],u=new Map,l=[],p=[],d={...i,[o]:o};s&&(d[s]=o);let h=Rg(d,o,c.name);for(let m=0;m<c.terms.length;m++){let _=c.terms[m],v=GNn(d,c.name,_,r),b=v.qualifier?"#"+v.qualifier:"",S=`${h}@${v.term}${b}`,A=u.get(S);r?.mergeSplitAnnotations&&A?vEt(r.mergeMap,`${S}/0/0`,`${S}/${a}/${m}`,A,v):(u.set(S,v),l.push(v)),p.push(_.range)}let f={target:h,annotations:l};r?.addOrigins&&(f.origins=p),n.push(f)}return n}function vEt(t,e,r,n,i){tua(t,e,r,n,i),i.record?n.record?qNn(t,e,r,n.record,i.record,!0):(n.record=i.record,n.origin=i.origin):i.value?(n.value=i.value,n.origin=i.origin):i.collection&&(n.origin=i.origin,n.collection=i.collection,n.collectionOrigins=i.collectionOrigins)}function qNn(t,e,r,n,i,o){rua(t,e,r,n,i,o);let s=n.propertyValues.length,a=o?"record":"Record",c={};for(let u=0;u<i.propertyValues.length;u++){let l=i.propertyValues[u];if(c[l.name])continue;let d=n.propertyValues.findIndex(h=>h.name===l.name);if(d!==-1){let h=`${e}/${a}/propertyValues/${d}`;c[l.name]=h}else if(l.value.type==="Record"){let h=`${e}/${a}/propertyValues/${u+s}`;c[l.name]=h}}eua(t,e,r,n,i,c,a,s)}function eua(t,e,r,n,i,o,s,a){for(let c=0;c<i.propertyValues.length;c++){let u=i.propertyValues[c],l=n.propertyValues.findIndex(h=>h.name===u.name),p=o[u.name]??`${e}/${s}/propertyValues/${c+a}`,d=`${r}/${s}/propertyValues/${c}`;if(l!==-1){let h=n.propertyValues[l];h.value.type==="Record"&&u.value.type==="Record"?qNn(t,`${p}/value`,`${d}/value`,h.value.Record,u.value.Record,!1):h.value=u.value}else t[p]=d,n.propertyValues.push(u),n.propertyValuesOrigins&&i.propertyValuesOrigins&&n.propertyValuesOrigins.push(i.propertyValuesOrigins[c])}}function tua(t,e,r,n,i){if(i.annotations){if(!n.annotations){n.annotations=[];for(let s=0;s<i.annotations.length;s++){let a=i.annotations[s],c=`${e}/annotations/${s}`,u=`${r}/annotations/${s}`;t[c]=u,n.annotations.push(a)}return}let o=n.annotations.length;for(let s=0;s<i.annotations.length;s++){let a=i.annotations[s],c=n.annotations.find(p=>p.term===a.term&&p.qualifier===a.qualifier),u=`${e}/annotations/${s+o}`,l=`${r}/annotations/${s}`;c?vEt(t,u,l,c,a):(t[u]=l,n.annotations.push(a))}}}function rua(t,e,r,n,i,o){if(i.annotations){let s=o?"record":"Record";if(!n.annotations){n.annotations=[];for(let c=0;c<i.annotations.length;c++){let u=i.annotations[c],l=`${e}/${s}/annotations/${c}`,p=`${r}/${s}/annotations/${c}`;t[l]=p,n.annotations.push(u)}return}let a=n.annotations.length;for(let c=0;c<i.annotations.length;c++){let u=i.annotations[c],l=n.annotations.find(h=>h.term===u.term&&h.qualifier===u.qualifier),p=`${e}/${s}/annotations/${c+a}`,d=`${r}/${s}/annotations/${c}`;l?vEt(t,p,d,l,u):(t[p]=d,n.annotations.push(u))}}}function nua(t){let e={};for(let r of t)e[r.name]=r.name,r.alias&&(e[r.alias]=r.name);return e.Edm="Edm",e}function GNn(t,e,r,n){let i=Vo(r,"Term"),o=Kc(i),s=rd(t,"",o),a=Vo(r,"Qualifier");if(s?.startsWith("com.sap.vocabularies.CDS.v1.")){let p=n?.vocabularyService?.cdsVocabulary.reverseNameMap.get(o.namespaceOrAlias+"."+o.name);p&&(s=p)}let c=TEt(t,e,r,n),u={term:s??i};c&&(u.value=c),n?.addOrigins&&(u.origin=r.range),a&&(u.qualifier=a),u.value?.type==="Record"?(u.record=u.value.Record,delete u.value):u.value?.type==="Collection"?(u.collection=u.value.Collection,n?.addOrigins&&(u.collectionOrigins=u.value.collectionOrigins),delete u.value):u.value?.type==="Unknown"&&Object.keys(u.value).length===1&&delete u.value;let l=_Et(t,e,r,n);return l.length&&(u.annotations=l),u}function _Et(t,e,r,n){return(r.content??[]).filter(i=>i.type===_t&&i.name===k.Annotation).map(i=>GNn(t,e,i,n))}var yEt=new Set([k.String,k.Bool,k.Decimal,k.Date,k.Float,k.Int,k.Path,k.PropertyPath,k.AnnotationPath,k.NavigationPropertyPath,k.EnumMember,k.Collection,k.Record,k.Apply,k.Null]);function TEt(t,e,r,n){let i=[];yEt.has(r.name)&&i.push(jNn(t,e,r,n));for(let s of Object.keys(r.attributes))if(yEt.has(s)){let a=qv(r,s);a&&i.push(HNn(t,e,a.name,a.value))}let o=(r.content??[]).filter(s=>s.type===_t&&yEt.has(s.name));for(let s of o)i.push(jNn(t,e,s,n));return i[0]}function HNn(t,e,r,n){switch(r){case"String":return{type:"String",String:n};case"Bool":return{type:"Bool",Bool:n==="true"};case"Decimal":return{type:"Decimal",Decimal:Number.parseFloat(n)};case"Date":return{type:"Date",Date:n};case"Int":return{type:"Int",Int:Number.parseInt(n,10)};case"Path":return{type:"Path",Path:Rg(t,e,n)};case"PropertyPath":return{type:"PropertyPath",PropertyPath:Rg(t,e,n)};case"AnnotationPath":return{type:"AnnotationPath",AnnotationPath:Rg(t,e,n)};case"NavigationPropertyPath":return{type:"NavigationPropertyPath",NavigationPropertyPath:Rg(t,e,n)};case"EnumMember":return{type:"EnumMember",EnumMember:WL(t,e,n)};case"Null":return{type:"Null"};default:return{type:"Unknown"}}}function jNn(t,e,r,n){switch(r.name){case"Collection":{let{collection:i,collectionOrigins:o}=oua(t,e,r,n),s={type:"Collection",Collection:i};return n?.addOrigins&&(s.collectionOrigins=o),s}case"Record":return{type:"Record",Record:iua(t,e,r,n)};case"Apply":return sua(t,e,r);default:{let o=AH(r)?.text??"";return HNn(t,e,r.name,o)}}}function iua(t,e,r,n){let i=[],o=Vo(r,"Type"),s;if(o){let l=Kc(o);s=rd(t,"",l)}let c={propertyValues:(r.content||[]).filter(l=>l.type===_t&&l.name===k.PropertyValue).map(l=>{n?.addOrigins&&i.push(l.range);let d={name:Vo(l,"Property"),value:TEt(t,e,l,n)||{type:"Unknown"}},h=_Et(t,e,l,n);return h?.length&&(d.annotations=h),d?.value?.type==="Unknown"&&Object.keys(d?.value).length===1&&(d.value={type:"Bool",Bool:!0}),d})};n?.addOrigins&&(c.propertyValuesOrigins=i),s&&(c.type=s);let u=_Et(t,e,r,n);return u.length&&(c.annotations=u),c}function oua(t,e,r,n){let i=[],o=[];return(r.content||[]).filter(s=>s.type===_t).forEach(s=>{let a=TEt(t,e,s,n),c=a;a&&typeof a=="object"&&"type"in a&&(a.type==="Record"&&"Record"in a?c=a.Record:a.type==="String"&&"String"in a&&(c=a.String)),i.push(c),n?.addOrigins&&s.range&&o.push(s.range)}),{collection:i,collectionOrigins:o}}function sua(t,e,r){let n=structuredClone(r);zNn(t,e,n);let i=Vo(r,k.Function);return{type:"Apply",$Apply:n,$Function:i}}function zNn(t,e,r){let n=r;return Object.keys(n.attributes||{}).forEach(i=>{let o=n.attributes[i];if(i===k.Term||i==="Type"){let s=Kc(o.value),a=rd(t,"",s);a&&(o.value=a)}else i==="EnumMember"?o.value=WL(t,e,o.value):i.endsWith("Path")&&(o.value=Rg(t,e,o.value))}),(n.content||[]).some(i=>i.type===_t)&&(n.content=n.content.filter(i=>!(i.type===Cr&&!(i.text||"").trim()))),aua(t,e,n),n}function aua(t,e,r){for(let n of r.content||[])if(n.type===_t)zNn(t,e,n);else if(n.type===Cr){let i=n.text;r.name==="EnumMember"?n.text=WL(t,e,i):n.type===Cr&&r.name.endsWith("Path")&&(n.text=Rg(t,e,i))}}var SEt=class{metadataService;entityTypes=[];complexTypes=[];entitySets=[];actions=[];actionImports=[];entityContainer={_type:"EntityContainer",fullyQualifiedName:""};singletons=[];constructor(e){this.metadataService=e}convert(){let e=this.metadataService.getRootMetadataElements();for(let[i,o]of e)this.convertAction(o.targetKinds,o),this.convertComplexType(o.targetKinds,o,i),this.convertEntityType(o.targetKinds,o,i),this.convertEntityContainer(o.targetKinds,o,i);let[r]=[...this.metadataService.getNamespaces()];if(this.entityContainer.fullyQualifiedName&&r){let i="EntityContainer";this.entityContainer={_type:"EntityContainer",name:i,fullyQualifiedName:r?`${r}.${i}`:i}}return{namespace:r,annotations:{},entitySets:this.entitySets,complexTypes:this.complexTypes,entityContainer:this.entityContainer,actions:this.actions,entityTypes:this.entityTypes,actionImports:this.actionImports,associations:[],singletons:this.singletons,associationSets:[],typeDefinitions:[],enumTypes:[]}}convertAction(e,r){if(!["Action","Function"].some(i=>e.includes(i)))return;let n={_type:"Action",name:r.name,fullyQualifiedName:r.path,parameters:[],returnCollection:!1,isBound:!1,sourceType:"",returnType:"",isFunction:r.kind==="Function"||r.kind==="function"};for(let i of r.content??[]){let o=this.metadataService.getEdmTargetKinds(i.path);if(KNn(o,i))n.returnType=i.structuredType??i.edmPrimitiveType??"",n.returnCollection=o.includes("Collection");else if(o.includes("Parameter")){let s={_type:"ActionParameter",isCollection:o.includes("Collection"),name:i.name,annotations:{},fullyQualifiedName:i.path,type:i.structuredType??i.edmPrimitiveType??""};i.name==="_it"&&(n.sourceType=i.structuredType??""),n.parameters.push(s)}}this.actions.push(n)}convertEntityContainer(e,r,n){if(e.includes("EntityContainer")){this.entityContainer={_type:"EntityContainer",name:r.name,fullyQualifiedName:n};for(let i of r.content??[]){let o=this.metadataService.getEdmTargetKinds(i.path);this.convertEntitySet(o,i),this.convertSingleton(o,i),this.convertFunctionImport(o,i)}}}convertFunctionImport(e,r){let n=this.metadataService.ODataVersion;if(e.includes("FunctionImport")||e.includes("ActionImport"))if(n?.startsWith("4")){let i={_type:"ActionImport",name:r.name,fullyQualifiedName:r.path,actionName:pua(r.structuredType??"")};this.actionImports.push(i)}else{let i=cua(r,e,this.metadataService);this.actions.push(i)}}convertEntitySet(e,r){if(e.includes("EntitySet")&&!e.includes("ComplexType"))if(r.isCollectionValued){let n={_type:"EntitySet",name:r.name,entityTypeName:r.structuredType??(e.includes("EntityType")?r.name:""),navigationPropertyBinding:{},fullyQualifiedName:r.path};this.entitySets.push(n)}else this.convertSingleton([...e,"Singleton"],r)}convertSingleton(e,r){if(e.includes("Singleton")){let n={_type:"Singleton",nullable:!1,name:r.name,entityTypeName:r.structuredType??(e.includes("EntityType")?r.name:""),navigationPropertyBinding:{},fullyQualifiedName:r.path};this.singletons.push(n)}}convertComplexType(e,r,n){if(e.includes("ComplexType")){let i=[],o=[];for(let a of r.content??[]){let c=this.metadataService.getEdmTargetKinds(a.path);if(c.includes("Property")){let u={_type:"Property",name:a.name,type:a.edmPrimitiveType??a.structuredType??"",fullyQualifiedName:a.path};i.push(u)}if(c.includes("NavigationProperty")){let u={_type:"NavigationProperty",name:a.name,fullyQualifiedName:a.path,targetTypeName:a.structuredType??"",isCollection:!!r.isCollectionValued,containsTarget:!1,partner:"",referentialConstraint:a.referentialConstraints??[]};o.push(u)}}let s={_type:"ComplexType",name:r.name,fullyQualifiedName:n,properties:i,navigationProperties:o};this.complexTypes.push(s)}}convertEntityType(e,r,n){if(e.includes("EntityType")&&!e.includes("ComplexType")){let i=[],o=[],s=[];for(let c of r.content??[]){let u=this.metadataService.getEdmTargetKinds(c.path);this.convertProperty(i,s,r,u,c),this.convertNavigationProperty(o,u,c)}let a={_type:"EntityType",name:r.name,fullyQualifiedName:n,entityProperties:i,keys:s,navigationProperties:o,actions:{}};this.entityTypes.push(a)}}convertProperty(e,r,n,i,o){if(i.includes("Property")&&!i.includes("NavigationProperty")){let s={_type:"Property",name:o.name,type:o.edmPrimitiveType??o.structuredType??"",fullyQualifiedName:o.path};e.push(s),n.keys?.includes(o.name)&&r.push(s)}}convertNavigationProperty(e,r,n){if(r.includes("NavigationProperty")){let i={_type:"NavigationProperty",name:n.name,fullyQualifiedName:n.path,targetTypeName:n.structuredType??"",isCollection:!!n.isCollectionValued,containsTarget:!1,partner:"",referentialConstraint:n.referentialConstraints??[]};e.push(i)}}};function cua(t,e,r){let n={_type:"Action",name:t.name,fullyQualifiedName:t.path,returnCollection:!1,parameters:[],isBound:!1,sourceType:"",returnType:"",isFunction:e.includes("FunctionImport")};for(let i of t.content){let o=r.getEdmTargetKinds(i.path);if(KNn(o,i))n.returnType=i.structuredType??i.edmPrimitiveType??"",n.returnCollection=o.includes("Collection");else if(o.includes("Parameter")){i.name==="_it"&&(n.sourceType=i.structuredType??"");let s={_type:"ActionParameter",isCollection:i.isCollectionValued??!1,fullyQualifiedName:i.path,annotations:{},name:i.name,type:i.structuredType??i.edmPrimitiveType??""};n.parameters.push(s)}}return n}function KNn(t,e){return t.includes("Parameter")&&e.name==="$Return"||t.includes("ReturnType")}var uua={},lua=new Set(["@","/","("]);function pua(t){if(!t)return t;let e=[],r=0;for(let n=0,i=!0;n<t.length;n++){let o=t[n];if(i&&o==="."){let s=t.substring(r,n);e.push(uua[s]??s),r=n,i=!1}lua.has(o)&&(e.push(t.substring(r,n+1)),r=n+1,i=!0)}return e.push(t.substring(r)),e.join("")}function zwe(t){return new SEt(t).convert()}var uZ={String:"string",Bool:"boolean",Decimal:"number",Date:"string",Float:"number",Int:"number",Path:"string",PropertyPath:"string",AnnotationPath:"string",NavigationPropertyPath:"string",EnumMember:"string",Collection:"array",Record:"object",Apply:"object",If:"object",And:"object",Or:"object",Le:"object",Lt:"object",Ge:"object",Gt:"object",Eq:"object",Ne:"object",Not:"object",Null:"null"};function bEt(t){return typeof t=="object"&&t.type!==void 0&&uZ[t.type]!==void 0}function AEt(t,e){let r=dua(Kwe(e,t.target));return r.terms=t.annotations.map(n=>r0(n,e)),r}function dua(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function r0(t,e){let r=Et({name:k.Annotation});return r.attributes[k.Term]=wr(k.Term,_f(t.term,e)),t.qualifier&&(r.attributes[k.Qualifier]=wr(k.Qualifier,t.qualifier)),t.collection?(r.content=r.content||[],r.content.push(OH(e,t.collection))):t.record?(r.content=r.content||[],r.content.push(YL(e,t.record))):t.value&&n0(e,t.value,r),t.annotations?.length&&t.annotations.forEach(n=>{r.content=r.content||[],r.content.push(r0(n,e))}),r}function OH(t,e){let r=Et({name:k.Collection});for(let n of e){let i=WNn(t,n);i&&r.content.push(i)}return r}function WNn(t,e){if(typeof e=="object")return bEt(e)?n0(t,e):YL(t,e);if(typeof e=="boolean")return Et({name:k.Bool,content:[Kn(e?"true":"false")]});if(typeof e=="string")return Et({name:k.String,content:[Kn(e)]})}function YL(t,e){let r=Et({name:k.Record});return e.type&&(r.attributes[k.Type]=wr(k.Type,_f(e.type,t))),e.propertyValues.forEach(n=>{let i=pZ(t,n);r.content.push(i)}),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(r0(n,t))})),r}function pZ(t,e){let r=Et({name:k.PropertyValue});return r.attributes[k.Property]=wr(k.Property,e.name),n0(t,e.value,r),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(r0(n,t))})),r}function n0(t,e,r){let n=uZ[e.type]?e.type:"",i=r??(n?Et({name:n}):void 0);if(i){switch(e.type){case"Collection":{let o=OH(t,e.Collection);return lZ(i,o,r)}case"Record":{let o=YL(t,e.Record);return lZ(i,o,r)}case"Apply":{let o=YNn(t,e.$Apply);return lZ(i,o,r)}case"If":case"And":case"Or":case"Le":case"Lt":case"Ge":case"Gt":case"Eq":case"Ne":case"Not":return lZ(i,Et({name:e.type}),r);case"Null":{let o=Et({name:n});return lZ(i,o,r)}case"Unknown":return;default:{let o=e[e.type],s=XL(e.type,o,t);r?(i.attributes=i.attributes||{},i.attributes[e.type]=wr(e.type,s)):i.content.push(Kn(s));break}}return i}}function YNn(t,e){let r=structuredClone(e);return XNn(r,t,!0)}function XL(t,e,r){let n=e===void 0?"":e.toString();return n&&(t===k.EnumMember?Hwe(r,n):t.indexOf("Path")>=0?Kwe(r,n):t===k.Type||t===k.Term?_f(n,r):n)}function lZ(t,e,r){return r?(t.content=t.content||[],t.content.push(e)):t=e,t}function XNn(t,e,r){let n=t;return mua(n),fua(n,e,r),hua(n,e,r),n}function fua(t,e,r){Object.keys(t.attributes||{}).forEach(n=>{let i=t.attributes[n];switch(n){case k.Term:case k.Type:i.value=r?_f(i.value,e):xg(i.value,e.aliasMap)?.qName;break;case k.EnumMember:i.value=r?Hwe(e,i.value):WL(e.aliasMap,e.currentFileNamespace,i.value);break;default:n.endsWith("Path")&&(i.value=r?Kwe(e,i.value):Rg(e.aliasMap,e.currentFileNamespace,i.value));break}})}function hua(t,e,r){for(let n of t.content??[])n.type===_t?XNn(n,e,r):n.type===Cr&&t.name===k.EnumMember?n.text=r?Hwe(e,n.text):WL(e.aliasMap,e.currentFileNamespace,n.text):n.type===Cr&&t.name.endsWith("Path")&&(n.text=r?Kwe(e,n.text):Rg(e.aliasMap,e.currentFileNamespace,n.text))}function mua(t){(t.content??[]).some(e=>e.type===_t)&&(t.content=t.content.filter(e=>!(e.type===Cr&&!(e.text??"").trim())))}function gua(t,e){let[r,n]=e.split("@");return n?`${r}@${_f(n,t)}`:e.indexOf(".")>-1?_f(e,t):e}function Kwe(t,e){return e.split("/").map(r=>gua(t,r)).join("/")}function JL(t,e,r){let n=[""],i=e.split("/").filter(a=>!!a),o=t,s;return i.forEach(a=>{if(!o||!n){n=[];return}let c={subElementIndex:-1};switch(a){case"annotations":s=k.Annotation;break;case"record":case"Record":c=Wwe(o,k.Record,0);break;case"propertyValues":s=k.PropertyValue;break;case"collection":case"Collection":c=Wwe(o,k.Collection,0),s="";break;case"value":n.push(...yua(o,r));break;case"type":n.push("attributes","Type","value");break;default:if(Number.isNaN(Number(a))){let{subElement:u,clearPath:l,pathSegments:p}=_ua(a,o);c.subElement=u,n=l?[]:[...n,...p??[]]}else s!==null&&(c=Wwe(o,s,Number(a)),s=void 0);break}c?.subElementIndex>=0&&n.push("content",c.subElementIndex.toString()),c?.subElement&&(o=c.subElement)}),n.join("/")}function yua(t,e){if(e===void 0)return[];if(t.attributes[e])return["attributes",e];let r=t.content.findIndex(n=>n.type===_t&&n.name===e);return r!==-1?["content",r.toString()]:[]}function _ua(t,e){return uZ[t]?Eua(e,t):e.attributes[QNn(t)]?{pathSegments:["attributes",QNn(t),"value"]}:t==="name"?{pathSegments:["attributes",k.Property,"value"]}:{clearPath:!0}}function Eua(t,e){if(t?.attributes[e])return{pathSegments:["attributes",e,"value"]};if(t.name===e){let s=JNn(t);return s<0?{clearPath:!0}:{pathSegments:["content",s.toString()]}}let{subElement:r,subElementIndex:n}=Wwe(t,e,0);if(n<0)return{clearPath:!0,subElement:r};let i=["content",n.toString()],o=JNn(t.content[n]);return o<0?{clearPath:!0,subElement:r}:(i.push("content",o.toString()),{subElement:r,pathSegments:i})}function JNn(t){return t.content.findIndex(e=>e.type===Cr)}function Wwe(t,e,r){let n={subElementIndex:-1},i=-1;for(let o=0;o<t.content.length;o++){let s=t.content[o];s.type===_t&&(!e||s.name===e)&&(i++,i===r&&(n.subElement=s,n.subElementIndex=o))}return n}function QNn(t){let e=t;return t&&(e=t.slice(0,1).toUpperCase()+t.slice(1)),e}var Fi;(function(t){t[t.General=1]="General",t[t.CompileError=2]="CompileError",t[t.ComplexityViolation=3]="ComplexityViolation",t[t.LocalAnnotationFileNotFound=4]="LocalAnnotationFileNotFound"})(Fi||(Fi={}));var Mn=class extends Error{errorCode;messageMap;constructor(e,r,n){super(e),this.messageMap=n??new Map,this.errorCode=r??Fi.General}toString(e=!1){let r=super.toString();if(e){let n=this.messageMap.size>0?this.convertMessages():"";return[r,`Error code: ${this.errorCode}`,n].join(". ")}return r}getExtendedMessage(){let e=this.message;return this.messageMap.size>0?[e,this.convertMessages()].join(". "):e}convertMessages(){let e="Other messages:";for(let[r,n]of this.messageMap.entries()){e+=`
2473
2473
  [${r}]:`;for(let i of n)e+=`
2474
2474
  - ${i}`}return e}};var eIn=require("node:fs"),tIn=require("node:url"),ZNn=process.platform==="win32"?eIn.realpathSync.native("\\")[0]:"";function i0(t){let e=(0,tIn.fileURLToPath)(t);return process.platform==="win32"?vua(e.charAt(0))+e.slice(1):e}function vua(t){return ZNn===ZNn.toUpperCase()?t.toUpperCase():t.toLowerCase()}var QL=[k.Bool,k.String,k.Decimal,k.EnumMember,k.Binary,k.Date,k.DateTimeOffset,k.TimeOfDay,k.Duration,k.Float,k.Int,k.Null,k.Guid,k.ModelElementPath,k.NavigationPropertyPath,k.PropertyPath,k.Path,k.AnnotationPath];function qh(t,e){let r=e.slice(1).split("/"),n=t;for(let i of r){let o=n[i];if(o)n=o;else return}return n}function OEt(t,e=0,r=!1){if(e===0)return t;let n=t.split(`
2475
2475
  `),i=" ";for(let o=r?1:0;o<n.length;o++){let s=n[o];n[o]=Tua(i,e,s)}return n.join(`
@@ -3082,6 +3082,6 @@ ${JSON.stringify(this.changes,void 0,2)}`);let n=this.convertChanges(this.change
3082
3082
  ${i}`);let o=[" getReferentialConstraints: function (navigationProperty) {",`${i}`," return undefined;"," }"].join(`
3083
3083
  `),s=t.lastIndexOf(`
3084
3084
  };`);return s!==-1?`${t.slice(0,s)},
3085
- ${o}${t.slice(s)}`:t}var Wjn=require("node:fs/promises"),Yjn=require("node:path");var Fjn=require("node:crypto"),Ujn=pe(yAe());var kjn={name:"@sap-ux/generator-odata-downloader",displayName:"Fiori Elements Data Downloader",description:"Yeoman generator that supports download of app data, typically for mock data server use.",version:"0.3.52",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/generator-odata-downloader"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-download"},license:"Apache-2.0",main:"generators/app/index.js",keywords:["yeoman-generator"],scripts:{build:"npm-run-all clean bundle:prod",compile:"tsc --build",clean:"rimraf --glob generators prebuilds test/test-output coverage *.tsbuildinfo",watch:"tsc --watch",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",bundle:"node esbuild.mjs","bundle:dev":"pnpm clean && node esbuild.mjs --development && pnpm pack","bundle:prod":"node esbuild.mjs --production"},files:["LICENSE","generators","!generators/*.map","!generators/**/*.map","prebuilds","yeoman.png"],devDependencies:{"@jest/globals":"30.4.1"},dependencies:{"@sap-devx/yeoman-ui-types":"1.25.1","@sap-ux/annotation-converter":"0.10.22","@sap-ux/axios-extension":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-generator-shared":"workspace:*","@sap-ux/inquirer-common":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/mockserver-config-writer":"workspace:*","@sap-ux/odata-service-inquirer":"workspace:*","@sap-ux/odata-service-writer":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/store":"workspace:*","@sap-ux/telemetry":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/vocabularies-types":"0.16.0","@sap/ux-specification":"1.144.5","@types/inquirer":"8.2.6","@types/yeoman-generator":"5.2.14","@vscode-logging/logger":"2.0.9",deepmerge:"4.3.1",i18next:"26.3.6",inquirer:"8.2.7","odata-query":"8.1.0","os-name":"4.0.1",rimraf:"6.1.3","xml-formatter":"3.7.0","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var Yva="@sap-ux/odata-download-sub-generator",Xva="0a65e45d-6bf4-421d-b845-61e888c50e9e",bf=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(e){this._sessionId=(0,Fjn.randomUUID)(),yn.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:Yva,version:kjn.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:Xva,...e};try{await cJ(r)}catch(n){yn.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e){if(!this._telemetryData){let r=vr("telemetry.unknownOs");try{r=(0,Ujn.default)()}catch{}this._telemetryData={Platform:Si()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){return{eventName:e,properties:r,measurements:{}}}static async sendTelemetry(e,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(e,n);await sf.getTelemetryClient().reportEvent(i,lc.NoSampling)}};var Jva=["eq","ne","gt","ge","lt","le"],jjn=["and","or","not"],Qva=["any","all"],Zva=["startswith","endswith","contains","matchespattern"],eTa=["expand","levels","select","skip","top","count","orderby","filter"],$jn=/\((.*)\)/,Vjn=/(?!indexof)\((\w+)\)/;function tTa(t,e){if(e){let r=t==="",n=Vjn.test(t),i=$jn.test(t);return r?e:n?Bjn(t,e,Vjn):i?Bjn(t,e,$jn):`${e}/${t}`}return t}function qjn(t){return jjn.indexOf(t)!==-1}function mbt(t){return`not (${t.join(" and ")})`}function Bjn(t,e,r){return t.replace(r,(n,i)=>i.trim()===""?`(${e})`:`(${e}/${i.trim()})`)}function hbt(t,e,r=[]){return`${t} eq ${cA(e,r)}`}function rTa({key:t,value:e,aliases:r,propPrefix:n}){let i=[],o=t,s=qjn(o),a=e.map(c=>k0(c,r,n)).filter(c=>c).map(c=>s?`(${c})`:c);return a.length&&(s?o==="not"?i.push(mbt(a)):i.push(`(${a.join(` ${o} `)})`):i.push(a.join(` ${o} `))),i}function nTa({propName:t,value:e}){let r=[],n=t,i=Object.keys(e).map(o=>Gjn({[o]:e[o]}));return i.length&&(n==="not"?r.push(mbt(i)):r.push(`(${i.join(` ${n} `)})`)),r}function iTa({key:t,propName:e,value:r,aliases:n}){let i=[];return"type"in r?i.push(hbt(e,r,n)):Object.keys(r).forEach(o=>{if(r[o]!==void 0)if(Jva.indexOf(o)!==-1)i.push(`${e} ${o} ${cA(r[o],n)}`);else if(jjn.indexOf(o)!==-1)Array.isArray(r[o])?i.push(r[o].map(s=>"("+k0(s,n,e)+")").join(` ${o} `)):i.push("("+k0(r[o],n,e)+")");else if(Qva.indexOf(o)!==-1){let s=cTa({lambdaParameter:t.toLowerCase(),value:r[o],op:o,propName:e,aliases:n});s&&i.push(s)}else if(o==="has")i.push(`${e} ${o} ${cA(r[o],n)}`);else if(o==="in"){let s=Array.isArray(r[o])?r[o]:r[o].value.map(a=>({type:r[o].type,value:a}));i.push(e+" in ("+s.map(a=>cA(a,n)).join(",")+")")}else if(Zva.indexOf(o)!==-1)i.push(`${o}(${e},${cA(r[o],n)})`);else{let s=/\/not/g.test(e),a=s?e.replace(/\/not/g,""):e,c=s?mbt([k0({[o]:r[o]},n,a)]):k0({[o]:r[o]},n,a);c&&i.push(c)}}),i}function cA(t,e){if(typeof t=="string")return`'${aTa(t)}'`;if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return`[${t.map(r=>cA(r)).join(",")}]`;if(t===null)return t;if(typeof t=="object")switch(t.type){case"raw":case"guid":return t.value;case"duration":return`duration'${t.value}'`;case"binary":return`binary'${t.value}'`;case"alias":return Array.isArray(e)&&e.push(t),`@${t.name}`;case"json":return escape(JSON.stringify(t.value));case"decimal":return`${t.value}M`;default:return Object.entries(t).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${cA(n,e)}`).join(",")}return t}function oTa(t,e,r,n){return`${n}/${r}(${t}: ${t} ${r=="all"?"ne":"eq"} '${e}')`}function sTa(t){return t.replace(/'/g,"''")}function aTa(t){return encodeURIComponent(sTa(t))}function k0(t={},e=[],r=""){return(Array.isArray(t)?t:[t]).reduce((n,i)=>{if(i){let o=Gjn(i,e,r);o&&n.push(o)}return n},[]).join(" and ")}function Gjn(t={},e=[],r=""){let n="";return typeof t=="string"?n=t:t&&typeof t=="object"&&(n=Object.keys(t).reduce((i,o)=>{let s=t[o];if(s===void 0)return i;let a=o==="",c=tTa(o,r);if(a&&Array.isArray(s))return i.concat(s.map(d=>hbt(c,d)));let u=["number","string","boolean"].indexOf(typeof s)!==-1||s instanceof Date||s===null,l=Array.isArray(s),p=typeof s=="object";if(u)i.push(hbt(c,s,e));else if(l)i.push(...rTa({key:o,value:s,aliases:e,propPrefix:r}));else if(qjn(c))i.push(...nTa({propName:c,value:s}));else if(p)i.push(...iTa({key:o,propName:c,value:s,aliases:e}));else throw Error(`Unexpected value type: ${s}`);return i},[]).join(" and ")),n}function cTa({lambdaParameter:t,value:e,op:r,propName:n,aliases:i}){let o="";if(typeof e=="string"||e instanceof String)o=oTa(t,e,r,n);else if(e){let s=k0(Array.isArray(e)?e.reduce((a,c)=>c.hasOwnProperty("")?(a.hasOwnProperty("")||(a[""]=[]),a[""].push(c[""]),a):{...a,...c},{}):e,i,t);o=`${n}/${r}(${s?`${t}:${s}`:""})`}return o}function wNe(t){if(typeof t=="number")return t;if(typeof t=="string")return t.indexOf("/")===-1?t:t.split("/").reverse().reduce((e,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${e})`:`$expand=${r}(${e})`,"");if(Array.isArray(t))return`${t.map(e=>wNe(e)).join(",")}`;if(typeof t=="object"){let e=Object.keys(t);return e.some(r=>eTa.indexOf(r.toLowerCase())!==-1)?e.map(r=>{let n;switch(r){case"filter":n=k0(t[r]);break;case"orderBy":n=gbt(t[r]);break;case"levels":case"count":case"skip":case"top":n=`${t[r]}`;break;default:n=wNe(t[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):e.map(r=>{let n=wNe(t[r]);return n?`${r}(${n})`:r}).join(",")}return""}function Hjn(t){return(Array.isArray(t)?t:[t]).reduce((e,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&e.push(`aggregate(${uTa(i)})`);break}case"filter":{let i=r[n];if(i){let o=k0(i);o&&e.push(`filter(${o})`)}break}case"groupBy":{let i=r[n];i&&e.push(`groupby(${lTa(i)})`);break}default:throw Error(`Unsupported transform: ${n}`)}return e},[]).join("/")||void 0}function uTa(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?e:Object.keys(e).map(r=>{let n=e[r];if(!n.with&&n.as)return`${r} as ${n.as}`;if(!n.with)throw Error(`'with' property required for '${r}'`);if(!n.as)throw Error(`'as' property required for '${r}'`);return`${r} with ${n.with} as ${n.as}`})).join(",")}function lTa(t){if(!t.properties)throw Error("'properties' property required for groupBy");let e=`(${t.properties.join(",")})`;return t.transform&&(e+=`,${Hjn(t.transform)}`),e}function gbt(t,e=""){return Array.isArray(t)?t.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${e}${String(r)}`).join(","):typeof t=="object"?Object.entries(t).map(([r,n])=>gbt(n,`${r}/`)).map(r=>`${e}${r}`).join(","):`${e}${String(t)}`}function pTa(t,e){let r=Object.getOwnPropertyNames(e).filter(n=>e[n]!==void 0&&e[n]!=="").map(n=>`${n}=${e[n]}`);return r.length?`${t}?${r.join("&")}`:t}function ybt({select:t,search:e,skiptoken:r,format:n,top:i,skip:o,filter:s,transform:a,orderBy:c,key:u,count:l,expand:p,action:d,func:h}={}){let f="",m=[],_={};if(u!=null&&(f+=`(${cA(u,m)})`),(s||typeof l=="object")&&(_.$filter=k0(typeof l=="object"?l:s,m)),a&&(_.$apply=Hjn(a)),p&&(_.$expand=wNe(p)),c&&(_.$orderby=gbt(c)),l&&(typeof l=="boolean"?_.$count=!0:f+="/$count"),typeof i=="number"&&(_.$top=i),typeof o=="number"&&(_.$skip=o),d&&(f+=`/${d}`),h){if(typeof h=="string")f+=`/${h}`;else if(typeof h=="object"){let[v]=Object.keys(h),b=cA(h[v],m);f+=`/${v}`,b!==""&&(f+=`(${b})`)}}return m.length>0&&Object.assign(_,m.reduce((v,b)=>Object.assign(v,{[`@${b.name}`]:cA(b.value)}),{})),e&&(_.$search=encodeURIComponent(e)),pTa(f,{$select:t,$skiptoken:r,$format:n,..._})}function dTa(t){let e=[];return{expands:t.reduce((n,{entityPath:i})=>{let o=i.split("/"),s=n;return o.forEach((a,c)=>{s.expand||(s.expand={}),s.expand[a]??=c===o.length-1?{}:{expand:{}},s=s.expand[a],e.includes(a)||e.push(a)}),n},{expand:{}}),entityPathParts:e}}function fTa(t,e,r=1,n){let i=e?.map(h=>({entityPath:h.fullPath,entitySetName:h.entity.entitySetName})),{expands:o,entityPathParts:s}=dTa(i),a=s.map(h=>e.find(m=>h===m.entity.entityPath?m.entity.entitySetName:void 0)?.entity.entitySetName).filter(h=>h!==void 0);yn.logger.info(vr("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let c=t;if(n){let h=[];c.semanticKeys.forEach(C=>{if(C.value!==void 0&&C.value!=="")if(C.type==="Edm.Boolean")h.push(`${C.name} eq ${C.value}`);else{let D=String(C.value).split(","),M=["Edm.UUID","Edm.Guid"].includes(C.type),w=L=>M?L.trim():`'${L.trim()}'`;if(D.length===1)h.push(`${C.name} eq ${w(D[0])}`);else{let L=D.map(B=>`${C.name} eq ${w(B)}`);h.push(`(${L.join(" or ")})`)}}});let f=h.length>0?`,filter(${h.join(" and ")})`:"",m=`$root/${c.entitySetName},${n.qualifier},${n.nodeProperty}`,_=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${c.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,v=n.isDraft?`$apply=ancestors(${m}${f},keep start)/${_}`:`$apply=${_}`,b=o?ybt(o):"",S=b?`&${b.substring(1)}`:"",A=`${c.entitySetName}?${v}${S}`;return yn.logger.debug(`Query for odata: ${A}`),{query:A}}let u=[];c.semanticKeys.forEach(h=>{if(h.value!==void 0&&h.value!=="")if(["Edm.UUID","Edm.Guid"].includes(h.type)){let m=String(h.value).split(",").map(_=>({[h.name]:{type:"guid",value:_.trim()}}));u.push(m.length===1?m[0]:{or:m})}else if(h.type==="Edm.Boolean")u.push({[h.name]:String(h.value)==="true"});else if(h.type==="Edm.String"){let f=String(h.value).split(","),m=[];f.forEach(_=>{let v=_.trim().split("-");v.length===1?m.push({[h.name]:_.trim()}):v.length===2&&m.push({[h.name]:{ge:v[0].trim(),le:v[1].trim()}})}),u.push(m.length==1?m[0]:{or:m})}else u.push({[h.name]:h.value})});let l={};o&&Object.assign(l,o),u.length>0?Object.assign(l,{filter:u.length===1?u[0]:u,count:!0}):r&&Object.assign(l,{top:r});let p=ybt(l),d=`${c.entitySetName}${p}`;return yn.logger.debug(`Query for odata: ${d}`),{query:d}}function hTa(t,e,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let p of t.semanticKeys){if(p.value===void 0||p.value===""||n.has(p.name))continue;let d=p.keyName??p.name,h=String(p.value).split(",")[0].trim(),f=["Edm.UUID","Edm.Guid"].includes(p.type),m=p.type==="Edm.Boolean";i.push(`${d}=${f||m?h:`'${h}'`}`)}if(i.length===0){yn.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${t.entitySetName}', skipping nav-prop hierarchy query for '${e}'`);return}let o={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};t.entityType?.keys?.filter(p=>p.name in o).forEach(p=>i.push(`${p.name}=${o[p.name]}`)),yn.logger.debug(`buildNavPropHierarchyQuery: key segment for '${t.entitySetName}': (${i.join(",")})`);let a=`${`${t.entitySetName}(${i.join(",")})`}/${e}`,u=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${u}`;return yn.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function Kjn(t,e,r,n,i,o=[]){let s=fTa(t,r,n,i),a=await zjn(e,s.query);for(let c of o){let u=r.find(_=>_.entity.entitySetName===c.entitySetName);if(!u){yn.logger.debug(`fetchData: no selected entity matched hierarchy entity '${c.entitySetName}', skipping`);continue}let l=hTa(t,u.entity.entityPath,c);if(!l){yn.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${c.entitySetName}', skipping`);continue}let p=await zjn(e,l);if(!p.entityData||!a.entityData){yn.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${c.entitySetName}', skipping merge`);continue}yn.logger.debug(`fetchData: merging ${p.entityData.length} hierarchy records into '${u.entity.entityPath}' expanded items`);let d=u.entity.entityPath,h=c.nodeProperty.split("/")[0],f=p.entityData,m=0;for(let _ of a.entityData){let v=_[d];if(Array.isArray(v))for(let b of v){let S=f.find(A=>c.entityTypeKeys.every(C=>A[C]===b[C]));S&&(b[h]=S[h],m++)}}yn.logger.debug(`fetchData: patched '${h}' onto ${m} expanded '${d}' records`)}return{odataResult:a}}async function zjn(t,e){try{yn.logger.info(`OData query request: ${encodeURI(t.defaults.baseURL+e).replaceAll("'","%27")}`),yn.logger.debug(`OData query request headers: ${JSON.stringify(t.defaults.headers)}`);let r=await t.get(e),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return yn.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=vr("errors.odataQueryError",{error:r});return yn.logger.error(n),{error:n}}}var nm=class t{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(e){if(e){delete t.externalServiceRequestCache[e];return}t.externalServiceRequestCache={}}static resetRefFacetCache(){t.entityTypeRefFacetCache={}}static resetServiceCaches(){t.resetExternalServiceCache(),t.resetRefFacetCache()}};async function Xjn(t,e,r){if(t.metadata&&e.appAccess&&t.connectedSystem&&t.servicePath&&e.appAccess&&e.referencedEntities){t.connectedSystem.serviceProvider.log=yn.logger;let n=t.connectedSystem?.serviceProvider.service(t.servicePath);if(n){let i=Date.now();bf.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let o=e.referencedEntities.hierarchyEntities?.find(c=>c.entitySetName===e.referencedEntities.listEntity.entitySetName),s=e.referencedEntities.hierarchyEntities?.filter(c=>c.entitySetName!==e.referencedEntities.listEntity.entitySetName&&r.some(u=>u.entity.entitySetName===c.entitySetName))??[],{odataResult:a}=await Kjn(e.referencedEntities.listEntity,n,r,o?void 0:1,o,s);if(a.entityData)return bf.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),yn.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return bf.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return vr("errors.dataNotFetched")}function Jjn(t){let e=[];return t.Facets.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...Jjn(r))}),e}function mTa(t){if(nm.entityTypeRefFacetCache[t.name])return nm.entityTypeRefFacetCache[t.name];let e=[];return t.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...Jjn(r))}),nm.entityTypeRefFacetCache[t.name]=e,e??[]}function Qjn(t,e="",r=[],n,i){let o={},s=t.navPropEntities;if(s&&s.length>0){let a=t.entityType?mTa(t.entityType):[];for(let c of s){let u=c.entityPath,l=i??t;if(c.entityType?.name===l?.entityType?.name||e.includes(u))continue;let p=e.concat(`${e?"/":""}${u}`);c.navPropEntities&&c.navPropEntities.length>0&&Object.assign(o,Qjn(c,p,r,n,i??t).entitySetsFlat);let d={fullPath:p,entity:{entityPath:c.entityPath,entitySetName:c.entitySetName,defaultSelected:a.includes(c.entityPath)||!!n?.includes(p)}},h=`${p}`;r||(r=[]),r.push({name:h,value:d,checked:d.entity.defaultSelected}),o[p]=c.entitySetName}}return{entitySetsFlat:o,choices:r}}function Zjn(t,e){let r=e?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${t.entityPath}/`)?i.replace(`/${t.entityPath}/`,""):i}).filter(n=>n!==void 0);if(t.navPropEntities){let n=Qjn(t,void 0,void 0,r);return n.choices.sort((i,o)=>(i.name??"").localeCompare(o.name??"")),n}}async function eqn(t,e){let n=(await Vp.newInstance(await(0,Wjn.readFile)((0,Yjn.join)(t,Wt.Ui5Yaml),"utf-8"))).getBackendConfigsFromFioriToolsProxyMiddleware()[0],i;if(n){let o=n.url;if(n.connectPath){let s=n.connectPath.startsWith("/")?n.connectPath:`/${n.connectPath}`;o=new URL(s,n.url).href}i=Si()?n?.destination:await Rjn(o,n?.client)}return{servicePath:e.uri,systemName:i}}async function tqn(t){let e=await YX(t.app.appRoot),r=e.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(yn.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),vr("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):e}var rqn,gTa=(...t)=>new Promise(e=>{clearTimeout(rqn),rqn=setTimeout(async()=>e(await Xjn(...t)),1e3)}),iE={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},yTa=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,nqn=["."];async function iqn(t,e,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,c)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!t[`entityKeyIdx:${c}`]))||!n)return vr("prompts.skipDataDownload.validation.keyRequired");let o=[];r.relatedEntityChoices?.choices?.length&&(o=t[iE.relatedEntitySelection]);let s=await gTa(e,r,o);return s}function _Ta(t){return nm.resetServiceCaches(),t.appAccess=void 0,t.referencedEntities=void 0,t.servicePath=void 0,t.systemName&&(t.systemName.value=void 0),t.relatedEntityChoices.choices=[],t.relatedEntityChoices.entitySetsFlat={},t}async function oqn(t){let e=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=ETa(r,n,t?.appPath),o=await V$n({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:$s.v4}},hy()!==mo.cli,yn.logger);o.prompts=pl(o.prompts,()=>!!r.appAccess);let s={odata:[]},a=TTa(r,r.relatedEntityChoices),c=STa(5,r,o.answers,s),u=vTa(r.relatedEntityChoices,o.answers,r,s);return e.push(i,...o.prompts,ATa(o.answers,r),bTa(o.answers,r),...c,a,u),{questions:e,answers:{application:r,odataQueryResult:s,odataServiceAnswers:o.answers}}}function ETa(t,e,r){return{type:"input",guiType:"folder-browser",name:iE.appSelection,message:vr("prompts.appSelection.message"),default:n=>r??n.appSelection??t.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:vr("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===t.appAccess?.app.appRoot)return!0;e.length=0,_Ta(t);let i;try{i=await Rbe(n)}catch(u){let l=u;return u instanceof Error&&(l=u.message),yn.logger.error(vr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${vr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${vr("texts.seeLogForDetails")}`}let o=i.app.services[i.app.mainService??"mainService"];if(!o?.odataVersion?.startsWith("4."))return vr("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:o.odataVersion});let s=await tqn(i);if(typeof s=="string")return s;t.appAccess=i,t.specification=s;let{servicePath:a,systemName:c}=await eqn(i.app.appRoot,o);return a&&(t.servicePath=a,e.push(a)),t.systemName&&(t.systemName.value=c),t.connectPath&&(t.connectPath.value=a),!0}}}function vTa(t,e,r,n){let i;return{when:async o=>t.choices.length>0,name:iE.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:vr("prompts.relatedEntitySelection.message"),choices:()=>t.choices,validate:async(o,s)=>{if(t.choices.forEach(a=>{a.disabled||(a.checked=o.some(c=>c.fullPath===a.value.fullPath))}),s&&!s[iE.skipDataDownload]?.[0]){if(i=await iqn(s,e,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:vr("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:_bt.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:vr("prompts.relatedEntitySelection.openLogs")})}}function TTa(t,e){let r,n,i;return{when:()=>{if((n!==t.systemName?.value||t.servicePath!==r)&&t.referencedEntities?.listEntity){let s=Zjn(t.referencedEntities.listEntity,t.referencedEntities.pageObjectEntities);s&&(e.choices=s.choices,Object.assign(e.entitySetsFlat,s.entitySetsFlat)),r=t.servicePath,n=t.systemName?.value}return e.choices.length>0},name:iE.toggleSelection,type:"confirm",message:vr("prompts.toggleSelection.message"),labelTrue:vr("prompts.toggleSelection.labelTrue"),labelFalse:vr("prompts.toggleSelection.labelFalse"),default:!1,validate:s=>(s!==i&&(e.choices.forEach(a=>{if(a.disabled)return;let c=a.value;a.checked=s===!1?c.entity.defaultSelected:!1}),i=s),!0)}}function STa(t,e,r,n){let i=[],o,s=0,a=c=>({when:async()=>{let u=e.referencedEntities?.listEntity.semanticKeys[c],l=!!u?.name&&u.name!=="IsActiveEntity";return l&&c>s&&(s=c),l},name:`entityKeyIdx:${c}`,message:()=>vr("prompts.entityKey.message",{keyName:`${e.referencedEntities?.listEntity.semanticKeys[c]?.name} (${e.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:vr("prompts.entityKey.hint")},validate:async(u,l)=>{let p=e.referencedEntities?.listEntity.semanticKeys[c];if(p&&delete p.value,nqn.includes(u))return vr("prompts.entityKey.validation.invalidKeyValueChars",{chars:nqn.join()});if(u&&p)if(p.type==="Edm.Boolean")try{p.value=JSON.parse(u)}catch{return vr("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(p.type)){let h=u.split(",");for(let f of h)if(!yTa.test(f.trim()))return vr("prompts.entityKey.validation.invalidGuidValue");p.value=u.trim()}else p.value=u.trim();let d=u.split(",");if(p?.type&&!["Edm.UUID","Edm.Guid"].includes(p.type)){for(let h of d)if(h.split("-").length>2)return p&&delete p.value,vr("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!e.relatedEntityChoices?.choices?.length&&c===s&&!l[iE.skipDataDownload]?.[0]&&e.referencedEntities?.listEntity.semanticKeys[c]?.name){if(o=await iqn(l,r,e),typeof o=="string")return o;n.odata=o.odataQueryResult}return!0}});for(let c=0;c<t;c++)i.push(a(c));return i}function bTa(t,e){return{when:()=>!!t.metadata&&!!e.servicePath,name:iE.skipDataDownload,type:"checkbox",message:vr("prompts.skipDataDownload.message"),guiOptions:{hint:vr("prompts.skipDataDownload.hint")},default:!1,choices:[{name:vr("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function ATa(t,e){let r;return{when:async()=>e.appAccess&&e.specification&&t?.metadata?(r=await Ijn(e.appAccess,e.specification,t.metadata),typeof r=="object"&&(e.referencedEntities=r),!0):!1,name:iE.updateMainServiceMetadata,type:"confirm",message:vr("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:_bt.Severity.error}}}}function sqn(t){let e=[],r=n=>[{name:`${n.entitySetName}/${n.nodeProperty}/source`,type:"list",message:`Source: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))},{name:`${n.entitySetName}/${n.nodeProperty}/target`,type:"list",message:`Target: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))}];return t.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&e.push(...r(n))}),e}var pqn=pe(VC()),dqn=pe(yD());var fqn=pe(lqn()),hqn=require("node:path");function mqn(t,e,r){nm.resetExternalServiceCache();let n=VTa(t,e),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:vr("prompts.valueHelpSelection.message"),choices:()=>n,validate:async s=>{if(!s||s.length===0)return nm.resetExternalServiceCache(),!0;let a=await $Ta(s,r),c=(0,fqn.default)(i,a);return i.length=0,i.push(...c),await UTa(i,r),!0}}],valueHelpData:i}}async function UTa(t,e){let r=[],n={transformResponse:o=>typeof o=="string"?JSON.parse(o):o},i=t.map(async o=>{let s=o,[a]=s.path.split(";");nm.externalServiceRequestCache[a]??=[];let l=(0,pqn.convert)((0,dqn.parse)(o.metadata)).entitySets.map(async p=>{let d=p.name;if(nm.externalServiceRequestCache[a].includes(d))return;nm.externalServiceRequestCache[a].push(d);let h=await e.get((0,hqn.join)(s.path,d),n);s.entityData=s.entityData??[],s.entityData?.push({entitySetName:d,items:h.data.value})});await Promise.allSettled(l),s.entityData&&r.push(s)});return await Promise.allSettled(i),r}async function $Ta(t,e){let r=t.flat();return await e.fetchExternalServices(r)}function VTa(t,e){let r=YJ(t,e,[]),n={};for(let o of r)if(o.type==="value-list"){if(Cjn.includes(o.target))continue;let[s]=o.value.split(";"),a=o.target.split("/").pop();a&&(n[s]??={},n[s][a]??=[],n[s][a].push(o))}else o.type==="code-list"&&(n[o.value]??={},n[o.value]["Code list"]??=[],n[o.value]["Code list"].push(o));let i=[];for(let o of Object.values(n))for(let[s,a]of Object.entries(o)){let c=a.map(u=>{if(u.type==="value-list")return u.target.replace(/\/[^/]*$/,"");if(u.type==="code-list"&&u.collectionPath)return u.collectionPath}).filter(u=>u!==void 0);i.push({name:`${s} (${c.join()})`,value:a})}return i.sort((o,s)=>o.name.localeCompare(s.name))}var yn=class t extends yqn.default{vscode;appWizard;static _logger=zAe;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(e,r){super(e,{...r,skipInstall:!0},{unique:"namespace"}),Hdt(this.env,!0),this.options.force=!0,this.prompts=new DNe.Prompts([{description:vr("steps.odataDownloader.description"),name:vr("steps.odataDownloader.name")},{description:vr("steps.valueHelpSelection.description"),name:vr("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(vr("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return t._logger}async initializing(){await fmt(),t._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await bf.initTelemetrySettings(),bf.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:e,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await oqn(this.options?.data),o=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=e.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=e.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=e.appAccess?.app.mainService,this.state.appEntities=e.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await oq(this.state.appRootPath);let s;this.state.mockServerConfig?.services&&(t.logger.debug(`Mock config: ${JSON.stringify(this.state.mockServerConfig)}`),s=this.state.mockServerConfig.services.find(a=>a.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===this.state.mainServicePath?.replaceAll(/(^\/)|(\/$)/g,""))),this.state.mockDataRootPath=s?.mockdataPath??(0,xk.join)(ua.Webapp,ua.LocalService,ua.Mockdata)}if(this.state.updateMainServiceMetadata=o[iE.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,o[iE.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(e,o),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof zf){let{questions:s,valueHelpData:a}=mqn(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(s),this.state.valueHelpData=a}}catch(e){t.logger.error(e),this._exitOnError(e)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let e=Date.now();bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,xk.join)(this.state.appRootPath));let r=fbt(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);t.logger.info(vr("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,o])=>{this.writeDestinationJSON((0,xk.join)(this.state.mockDataRootPath,`${i}.json`),o)}),this.state.appEntities.hierarchyEntities?.filter(i=>i.missingReferentialConstraints&&n.some(([o])=>o===i.entitySetName))?.forEach(i=>{let o=(0,xk.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),s=this.destinationPath(o),{navPropName:a,constraints:c}=i.missingReferentialConstraints;if(this.fs.exists(s)){let u=this.fs.read(s),l=Ljn(u,a,c);l!==u?(this.writeDestination(o,l),t.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):t.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let u=Mjn(a,c);this.writeDestination(o,u),t.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfFiles:`${n.length}`})}catch(e){t.logger.error(e),bf.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(vr("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let e=Date.now();bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,xk.join)(this.state.appRootPath,ua.Webapp);if(await gOe(this.fs,r,this.state.valueHelpData,this.state.mainServiceName,this.state.mainServicePath),this.state.mockServerConfig){let n={webappPath:r,packageJsonConfig:{skip:!0},ui5MockYamlConfig:{overwrite:!0}};n.ui5MockYamlConfig&&this.state.mainServiceName&&(n.ui5MockYamlConfig.resolveExternalServiceReferences={[this.state.mainServiceName]:!0},await WAe(this.state.appRootPath,n,this.fs))}bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(e){t.logger.error(e),bf.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(vr("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let e=(0,xk.join)(this.state.appRootPath,ua.Webapp,ua.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(e,(0,gqn.default)(this.state.mainServiceMetadata,{indentation:" ",lineSeparator:`
3085
+ ${o}${t.slice(s)}`:t}var Wjn=require("node:fs/promises"),Yjn=require("node:path");var Fjn=require("node:crypto"),Ujn=pe(yAe());var kjn={name:"@sap-ux/generator-odata-downloader",displayName:"Fiori Elements Data Downloader",description:"Yeoman generator that supports download of app data, typically for mock data server use.",version:"0.3.53",repository:{type:"git",url:"https://github.com/SAP/open-ux-tools.git",directory:"packages/generator-odata-downloader"},bugs:{url:"https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-download"},license:"Apache-2.0",main:"generators/app/index.js",keywords:["yeoman-generator"],scripts:{build:"npm-run-all clean bundle:prod",compile:"tsc --build",clean:"rimraf --glob generators prebuilds test/test-output coverage *.tsbuildinfo",watch:"tsc --watch",lint:"eslint","lint:fix":"eslint --fix",test:"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors","test-u":"cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",link:"pnpm link --global",unlink:"pnpm unlink --global",bundle:"node esbuild.mjs","bundle:dev":"pnpm clean && node esbuild.mjs --development && pnpm pack","bundle:prod":"node esbuild.mjs --production"},files:["LICENSE","generators","!generators/*.map","!generators/**/*.map","prebuilds","yeoman.png"],devDependencies:{"@jest/globals":"30.4.1"},dependencies:{"@sap-devx/yeoman-ui-types":"1.25.1","@sap-ux/annotation-converter":"0.10.22","@sap-ux/axios-extension":"workspace:*","@sap-ux/btp-utils":"workspace:*","@sap-ux/edmx-parser":"0.10.0","@sap-ux/fiori-generator-shared":"workspace:*","@sap-ux/inquirer-common":"workspace:*","@sap-ux/logger":"workspace:*","@sap-ux/mockserver-config-writer":"workspace:*","@sap-ux/odata-service-inquirer":"workspace:*","@sap-ux/odata-service-writer":"workspace:*","@sap-ux/project-access":"workspace:*","@sap-ux/store":"workspace:*","@sap-ux/telemetry":"workspace:*","@sap-ux/ui5-config":"workspace:*","@sap-ux/vocabularies-types":"0.16.0","@sap/ux-specification":"1.144.5","@types/inquirer":"8.2.6","@types/yeoman-generator":"5.2.14","@vscode-logging/logger":"2.0.9",deepmerge:"4.3.1",i18next:"26.3.6",inquirer:"8.2.7","odata-query":"8.1.0","os-name":"4.0.1",rimraf:"6.1.3","xml-formatter":"3.7.0","yeoman-generator":"5.10.0"},engines:{node:">=22.x"}};var Yva="@sap-ux/odata-download-sub-generator",Xva="0a65e45d-6bf4-421d-b845-61e888c50e9e",bf=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(e){this._sessionId=(0,Fjn.randomUUID)(),yn.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:Yva,version:kjn.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:Xva,...e};try{await cJ(r)}catch(n){yn.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e){if(!this._telemetryData){let r=vr("telemetry.unknownOs");try{r=(0,Ujn.default)()}catch{}this._telemetryData={Platform:Si()?"SBAS":"VSCode",OperatingSystem:r,SessionId:this._sessionId}}return this._telemetryData=Object.assign(this._telemetryData,e),this._telemetryData}static prepareTelemetryEvent(e,r){return{eventName:e,properties:r,measurements:{}}}static async sendTelemetry(e,r){let n=this.createTelemetryData(r),i=this.prepareTelemetryEvent(e,n);await sf.getTelemetryClient().reportEvent(i,lc.NoSampling)}};var Jva=["eq","ne","gt","ge","lt","le"],jjn=["and","or","not"],Qva=["any","all"],Zva=["startswith","endswith","contains","matchespattern"],eTa=["expand","levels","select","skip","top","count","orderby","filter"],$jn=/\((.*)\)/,Vjn=/(?!indexof)\((\w+)\)/;function tTa(t,e){if(e){let r=t==="",n=Vjn.test(t),i=$jn.test(t);return r?e:n?Bjn(t,e,Vjn):i?Bjn(t,e,$jn):`${e}/${t}`}return t}function qjn(t){return jjn.indexOf(t)!==-1}function mbt(t){return`not (${t.join(" and ")})`}function Bjn(t,e,r){return t.replace(r,(n,i)=>i.trim()===""?`(${e})`:`(${e}/${i.trim()})`)}function hbt(t,e,r=[]){return`${t} eq ${cA(e,r)}`}function rTa({key:t,value:e,aliases:r,propPrefix:n}){let i=[],o=t,s=qjn(o),a=e.map(c=>k0(c,r,n)).filter(c=>c).map(c=>s?`(${c})`:c);return a.length&&(s?o==="not"?i.push(mbt(a)):i.push(`(${a.join(` ${o} `)})`):i.push(a.join(` ${o} `))),i}function nTa({propName:t,value:e}){let r=[],n=t,i=Object.keys(e).map(o=>Gjn({[o]:e[o]}));return i.length&&(n==="not"?r.push(mbt(i)):r.push(`(${i.join(` ${n} `)})`)),r}function iTa({key:t,propName:e,value:r,aliases:n}){let i=[];return"type"in r?i.push(hbt(e,r,n)):Object.keys(r).forEach(o=>{if(r[o]!==void 0)if(Jva.indexOf(o)!==-1)i.push(`${e} ${o} ${cA(r[o],n)}`);else if(jjn.indexOf(o)!==-1)Array.isArray(r[o])?i.push(r[o].map(s=>"("+k0(s,n,e)+")").join(` ${o} `)):i.push("("+k0(r[o],n,e)+")");else if(Qva.indexOf(o)!==-1){let s=cTa({lambdaParameter:t.toLowerCase(),value:r[o],op:o,propName:e,aliases:n});s&&i.push(s)}else if(o==="has")i.push(`${e} ${o} ${cA(r[o],n)}`);else if(o==="in"){let s=Array.isArray(r[o])?r[o]:r[o].value.map(a=>({type:r[o].type,value:a}));i.push(e+" in ("+s.map(a=>cA(a,n)).join(",")+")")}else if(Zva.indexOf(o)!==-1)i.push(`${o}(${e},${cA(r[o],n)})`);else{let s=/\/not/g.test(e),a=s?e.replace(/\/not/g,""):e,c=s?mbt([k0({[o]:r[o]},n,a)]):k0({[o]:r[o]},n,a);c&&i.push(c)}}),i}function cA(t,e){if(typeof t=="string")return`'${aTa(t)}'`;if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return`[${t.map(r=>cA(r)).join(",")}]`;if(t===null)return t;if(typeof t=="object")switch(t.type){case"raw":case"guid":return t.value;case"duration":return`duration'${t.value}'`;case"binary":return`binary'${t.value}'`;case"alias":return Array.isArray(e)&&e.push(t),`@${t.name}`;case"json":return escape(JSON.stringify(t.value));case"decimal":return`${t.value}M`;default:return Object.entries(t).filter(([,r])=>r!==void 0).map(([r,n])=>`${r}=${cA(n,e)}`).join(",")}return t}function oTa(t,e,r,n){return`${n}/${r}(${t}: ${t} ${r=="all"?"ne":"eq"} '${e}')`}function sTa(t){return t.replace(/'/g,"''")}function aTa(t){return encodeURIComponent(sTa(t))}function k0(t={},e=[],r=""){return(Array.isArray(t)?t:[t]).reduce((n,i)=>{if(i){let o=Gjn(i,e,r);o&&n.push(o)}return n},[]).join(" and ")}function Gjn(t={},e=[],r=""){let n="";return typeof t=="string"?n=t:t&&typeof t=="object"&&(n=Object.keys(t).reduce((i,o)=>{let s=t[o];if(s===void 0)return i;let a=o==="",c=tTa(o,r);if(a&&Array.isArray(s))return i.concat(s.map(d=>hbt(c,d)));let u=["number","string","boolean"].indexOf(typeof s)!==-1||s instanceof Date||s===null,l=Array.isArray(s),p=typeof s=="object";if(u)i.push(hbt(c,s,e));else if(l)i.push(...rTa({key:o,value:s,aliases:e,propPrefix:r}));else if(qjn(c))i.push(...nTa({propName:c,value:s}));else if(p)i.push(...iTa({key:o,propName:c,value:s,aliases:e}));else throw Error(`Unexpected value type: ${s}`);return i},[]).join(" and ")),n}function cTa({lambdaParameter:t,value:e,op:r,propName:n,aliases:i}){let o="";if(typeof e=="string"||e instanceof String)o=oTa(t,e,r,n);else if(e){let s=k0(Array.isArray(e)?e.reduce((a,c)=>c.hasOwnProperty("")?(a.hasOwnProperty("")||(a[""]=[]),a[""].push(c[""]),a):{...a,...c},{}):e,i,t);o=`${n}/${r}(${s?`${t}:${s}`:""})`}return o}function wNe(t){if(typeof t=="number")return t;if(typeof t=="string")return t.indexOf("/")===-1?t:t.split("/").reverse().reduce((e,r,n,i)=>n===0?`$expand=${r}`:n===i.length-1?`${r}(${e})`:`$expand=${r}(${e})`,"");if(Array.isArray(t))return`${t.map(e=>wNe(e)).join(",")}`;if(typeof t=="object"){let e=Object.keys(t);return e.some(r=>eTa.indexOf(r.toLowerCase())!==-1)?e.map(r=>{let n;switch(r){case"filter":n=k0(t[r]);break;case"orderBy":n=gbt(t[r]);break;case"levels":case"count":case"skip":case"top":n=`${t[r]}`;break;default:n=wNe(t[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):e.map(r=>{let n=wNe(t[r]);return n?`${r}(${n})`:r}).join(",")}return""}function Hjn(t){return(Array.isArray(t)?t:[t]).reduce((e,r)=>{for(let n of Object.keys(r))switch(n){case"aggregate":{let i=r[n];i&&e.push(`aggregate(${uTa(i)})`);break}case"filter":{let i=r[n];if(i){let o=k0(i);o&&e.push(`filter(${o})`)}break}case"groupBy":{let i=r[n];i&&e.push(`groupby(${lTa(i)})`);break}default:throw Error(`Unsupported transform: ${n}`)}return e},[]).join("/")||void 0}function uTa(t){return(Array.isArray(t)?t:[t]).map(e=>typeof e=="string"?e:Object.keys(e).map(r=>{let n=e[r];if(!n.with&&n.as)return`${r} as ${n.as}`;if(!n.with)throw Error(`'with' property required for '${r}'`);if(!n.as)throw Error(`'as' property required for '${r}'`);return`${r} with ${n.with} as ${n.as}`})).join(",")}function lTa(t){if(!t.properties)throw Error("'properties' property required for groupBy");let e=`(${t.properties.join(",")})`;return t.transform&&(e+=`,${Hjn(t.transform)}`),e}function gbt(t,e=""){return Array.isArray(t)?t.map(r=>Array.isArray(r)&&r.length===2&&["asc","desc"].indexOf(r[1])!==-1?r.join(" "):r).map(r=>`${e}${String(r)}`).join(","):typeof t=="object"?Object.entries(t).map(([r,n])=>gbt(n,`${r}/`)).map(r=>`${e}${r}`).join(","):`${e}${String(t)}`}function pTa(t,e){let r=Object.getOwnPropertyNames(e).filter(n=>e[n]!==void 0&&e[n]!=="").map(n=>`${n}=${e[n]}`);return r.length?`${t}?${r.join("&")}`:t}function ybt({select:t,search:e,skiptoken:r,format:n,top:i,skip:o,filter:s,transform:a,orderBy:c,key:u,count:l,expand:p,action:d,func:h}={}){let f="",m=[],_={};if(u!=null&&(f+=`(${cA(u,m)})`),(s||typeof l=="object")&&(_.$filter=k0(typeof l=="object"?l:s,m)),a&&(_.$apply=Hjn(a)),p&&(_.$expand=wNe(p)),c&&(_.$orderby=gbt(c)),l&&(typeof l=="boolean"?_.$count=!0:f+="/$count"),typeof i=="number"&&(_.$top=i),typeof o=="number"&&(_.$skip=o),d&&(f+=`/${d}`),h){if(typeof h=="string")f+=`/${h}`;else if(typeof h=="object"){let[v]=Object.keys(h),b=cA(h[v],m);f+=`/${v}`,b!==""&&(f+=`(${b})`)}}return m.length>0&&Object.assign(_,m.reduce((v,b)=>Object.assign(v,{[`@${b.name}`]:cA(b.value)}),{})),e&&(_.$search=encodeURIComponent(e)),pTa(f,{$select:t,$skiptoken:r,$format:n,..._})}function dTa(t){let e=[];return{expands:t.reduce((n,{entityPath:i})=>{let o=i.split("/"),s=n;return o.forEach((a,c)=>{s.expand||(s.expand={}),s.expand[a]??=c===o.length-1?{}:{expand:{}},s=s.expand[a],e.includes(a)||e.push(a)}),n},{expand:{}}),entityPathParts:e}}function fTa(t,e,r=1,n){let i=e?.map(h=>({entityPath:h.fullPath,entitySetName:h.entity.entitySetName})),{expands:o,entityPathParts:s}=dTa(i),a=s.map(h=>e.find(m=>h===m.entity.entityPath?m.entity.entitySetName:void 0)?.entity.entitySetName).filter(h=>h!==void 0);yn.logger.info(vr("info.entityFilesToBeGenerated",{entities:a.join(", ")}));let c=t;if(n){let h=[];c.semanticKeys.forEach(C=>{if(C.value!==void 0&&C.value!=="")if(C.type==="Edm.Boolean")h.push(`${C.name} eq ${C.value}`);else{let D=String(C.value).split(","),M=["Edm.UUID","Edm.Guid"].includes(C.type),w=L=>M?L.trim():`'${L.trim()}'`;if(D.length===1)h.push(`${C.name} eq ${w(D[0])}`);else{let L=D.map(B=>`${C.name} eq ${w(B)}`);h.push(`(${L.join(" or ")})`)}}});let f=h.length>0?`,filter(${h.join(" and ")})`:"",m=`$root/${c.entitySetName},${n.qualifier},${n.nodeProperty}`,_=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=$root/${c.entitySetName},HierarchyQualifier='${n.qualifier}',NodeProperty='${n.nodeProperty}')`,v=n.isDraft?`$apply=ancestors(${m}${f},keep start)/${_}`:`$apply=${_}`,b=o?ybt(o):"",S=b?`&${b.substring(1)}`:"",A=`${c.entitySetName}?${v}${S}`;return yn.logger.debug(`Query for odata: ${A}`),{query:A}}let u=[];c.semanticKeys.forEach(h=>{if(h.value!==void 0&&h.value!=="")if(["Edm.UUID","Edm.Guid"].includes(h.type)){let m=String(h.value).split(",").map(_=>({[h.name]:{type:"guid",value:_.trim()}}));u.push(m.length===1?m[0]:{or:m})}else if(h.type==="Edm.Boolean")u.push({[h.name]:String(h.value)==="true"});else if(h.type==="Edm.String"){let f=String(h.value).split(","),m=[];f.forEach(_=>{let v=_.trim().split("-");v.length===1?m.push({[h.name]:_.trim()}):v.length===2&&m.push({[h.name]:{ge:v[0].trim(),le:v[1].trim()}})}),u.push(m.length==1?m[0]:{or:m})}else u.push({[h.name]:h.value})});let l={};o&&Object.assign(l,o),u.length>0?Object.assign(l,{filter:u.length===1?u[0]:u,count:!0}):r&&Object.assign(l,{top:r});let p=ybt(l),d=`${c.entitySetName}${p}`;return yn.logger.debug(`Query for odata: ${d}`),{query:d}}function hTa(t,e,r){let n=new Set(["DraftUUID","IsActiveEntity"]),i=[];for(let p of t.semanticKeys){if(p.value===void 0||p.value===""||n.has(p.name))continue;let d=p.keyName??p.name,h=String(p.value).split(",")[0].trim(),f=["Edm.UUID","Edm.Guid"].includes(p.type),m=p.type==="Edm.Boolean";i.push(`${d}=${f||m?h:`'${h}'`}`)}if(i.length===0){yn.logger.debug(`buildNavPropHierarchyQuery: no key values available for '${t.entitySetName}', skipping nav-prop hierarchy query for '${e}'`);return}let o={DraftUUID:"00000000-0000-0000-0000-000000000000",IsActiveEntity:"true"};t.entityType?.keys?.filter(p=>p.name in o).forEach(p=>i.push(`${p.name}=${o[p.name]}`)),yn.logger.debug(`buildNavPropHierarchyQuery: key segment for '${t.entitySetName}': (${i.join(",")})`);let a=`${`${t.entitySetName}(${i.join(",")})`}/${e}`,u=`com.sap.vocabularies.Hierarchy.v1.TopLevels(HierarchyNodes=${`$root/${a}`},HierarchyQualifier='${r.qualifier}',NodeProperty='${r.nodeProperty}')`,l=`${a}?$apply=${u}`;return yn.logger.debug(`Nav-prop hierarchy query: ${l}`),l}async function Kjn(t,e,r,n,i,o=[]){let s=fTa(t,r,n,i),a=await zjn(e,s.query);for(let c of o){let u=r.find(_=>_.entity.entitySetName===c.entitySetName);if(!u){yn.logger.debug(`fetchData: no selected entity matched hierarchy entity '${c.entitySetName}', skipping`);continue}let l=hTa(t,u.entity.entityPath,c);if(!l){yn.logger.debug(`fetchData: could not build nav-prop hierarchy query for '${c.entitySetName}', skipping`);continue}let p=await zjn(e,l);if(!p.entityData||!a.entityData){yn.logger.debug(`fetchData: no data returned for nav-prop hierarchy query '${c.entitySetName}', skipping merge`);continue}yn.logger.debug(`fetchData: merging ${p.entityData.length} hierarchy records into '${u.entity.entityPath}' expanded items`);let d=u.entity.entityPath,h=c.nodeProperty.split("/")[0],f=p.entityData,m=0;for(let _ of a.entityData){let v=_[d];if(Array.isArray(v))for(let b of v){let S=f.find(A=>c.entityTypeKeys.every(C=>A[C]===b[C]));S&&(b[h]=S[h],m++)}}yn.logger.debug(`fetchData: patched '${h}' onto ${m} expanded '${d}' records`)}return{odataResult:a}}async function zjn(t,e){try{yn.logger.info(`OData query request: ${encodeURI(t.defaults.baseURL+e).replaceAll("'","%27")}`),yn.logger.debug(`OData query request headers: ${JSON.stringify(t.defaults.headers)}`);let r=await t.get(e),n=r?.data?.match(/"@odata\.count":(\d+)/)?.[1];return yn.logger.info(`OData query records count: ${n}`),{entityData:r?.odata()}}catch(r){let n=vr("errors.odataQueryError",{error:r});return yn.logger.error(n),{error:n}}}var nm=class t{static externalServiceRequestCache={};static entityTypeRefFacetCache={};static resetExternalServiceCache(e){if(e){delete t.externalServiceRequestCache[e];return}t.externalServiceRequestCache={}}static resetRefFacetCache(){t.entityTypeRefFacetCache={}}static resetServiceCaches(){t.resetExternalServiceCache(),t.resetRefFacetCache()}};async function Xjn(t,e,r){if(t.metadata&&e.appAccess&&t.connectedSystem&&t.servicePath&&e.appAccess&&e.referencedEntities){t.connectedSystem.serviceProvider.log=yn.logger;let n=t.connectedSystem?.serviceProvider.service(t.servicePath);if(n){let i=Date.now();bf.sendTelemetry("ODATA_DOWNLOAD_SEND_QUERY",{time:Date()});let o=e.referencedEntities.hierarchyEntities?.find(c=>c.entitySetName===e.referencedEntities.listEntity.entitySetName),s=e.referencedEntities.hierarchyEntities?.filter(c=>c.entitySetName!==e.referencedEntities.listEntity.entitySetName&&r.some(u=>u.entity.entitySetName===c.entitySetName))??[],{odataResult:a}=await Kjn(e.referencedEntities.listEntity,n,r,o?void 0:1,o,s);if(a.entityData)return bf.sendTelemetry("ODATA_DOWNLOAD_RECEIVED_QUERY_RESULT",{duration:`${Date.now()-i} ms`,resultSize:`${a.entityData.length} rows`}),yn.logger.debug(`Got result rows: ${a.entityData.length}`),{odataQueryResult:a.entityData};if(a.error)return bf.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return vr("errors.dataNotFetched")}function Jjn(t){let e=[];return t.Facets.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target.type==="AnnotationPath"){let n=r.Target.value;n.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}else r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...Jjn(r))}),e}function mTa(t){if(nm.entityTypeRefFacetCache[t.name])return nm.entityTypeRefFacetCache[t.name];let e=[];return t.annotations?.UI?.Facets?.forEach(r=>{if(r.$Type==="com.sap.vocabularies.UI.v1.ReferenceFacet"&&r.Target?.type==="AnnotationPath"){let n=r.Target.value;n?.lastIndexOf("/")>-1&&e.push(n.substring(0,n.lastIndexOf("/")))}r.$Type==="com.sap.vocabularies.UI.v1.CollectionFacet"&&e.push(...Jjn(r))}),nm.entityTypeRefFacetCache[t.name]=e,e??[]}function Qjn(t,e="",r=[],n,i){let o={},s=t.navPropEntities;if(s&&s.length>0){let a=t.entityType?mTa(t.entityType):[];for(let c of s){let u=c.entityPath,l=i??t;if(c.entityType?.name===l?.entityType?.name||e.includes(u))continue;let p=e.concat(`${e?"/":""}${u}`);c.navPropEntities&&c.navPropEntities.length>0&&Object.assign(o,Qjn(c,p,r,n,i??t).entitySetsFlat);let d={fullPath:p,entity:{entityPath:c.entityPath,entitySetName:c.entitySetName,defaultSelected:a.includes(c.entityPath)||!!n?.includes(p)}},h=`${p}`;r||(r=[]),r.push({name:h,value:d,checked:d.entity.defaultSelected}),o[p]=c.entitySetName}}return{entitySetsFlat:o,choices:r}}function Zjn(t,e){let r=e?.map(n=>{let i=n.page?.contextPath??n.page?.routePattern?.replace(":?query:","").replaceAll(/\(\{[^}]*\}\)/g,"");return i?.startsWith(`/${t.entityPath}/`)?i.replace(`/${t.entityPath}/`,""):i}).filter(n=>n!==void 0);if(t.navPropEntities){let n=Qjn(t,void 0,void 0,r);return n.choices.sort((i,o)=>(i.name??"").localeCompare(o.name??"")),n}}async function eqn(t,e){let n=(await Vp.newInstance(await(0,Wjn.readFile)((0,Yjn.join)(t,Wt.Ui5Yaml),"utf-8"))).getBackendConfigsFromFioriToolsProxyMiddleware()[0],i;if(n){let o=n.url;if(n.connectPath){let s=n.connectPath.startsWith("/")?n.connectPath:`/${n.connectPath}`;o=new URL(s,n.url).href}i=Si()?n?.destination:await Rjn(o,n?.client)}return{servicePath:e.uri,systemName:i}}async function tqn(t){let e=await YX(t.app.appRoot),r=e.getApiVersion(),n=typeof r?.version=="string"?Number.parseInt(r.version,10):0;return n<24?(yn.logger.debug(`@sap/ux-specification from module cache API version is: ${n}. API version '24' at least is required.`),vr("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):e}var rqn,gTa=(...t)=>new Promise(e=>{clearTimeout(rqn),rqn=setTimeout(async()=>e(await Xjn(...t)),1e3)}),iE={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},yTa=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,nqn=["."];async function iqn(t,e,r){let n=!1;if(!r.referencedEntities?.listEntity.semanticKeys.every((a,c)=>(a.name!=="IsActiveEntity"&&!n&&(n=!!a.value),a.value!==void 0&&a.value!==""||!t[`entityKeyIdx:${c}`]))||!n)return vr("prompts.skipDataDownload.validation.keyRequired");let o=[];r.relatedEntityChoices?.choices?.length&&(o=t[iE.relatedEntitySelection]);let s=await gTa(e,r,o);return s}function _Ta(t){return nm.resetServiceCaches(),t.appAccess=void 0,t.referencedEntities=void 0,t.servicePath=void 0,t.systemName&&(t.systemName.value=void 0),t.relatedEntityChoices.choices=[],t.relatedEntityChoices.entitySetsFlat={},t}async function oqn(t){let e=[],r={appAccess:void 0,referencedEntities:void 0,servicePath:void 0,systemName:{value:void 0},connectPath:{value:void 0},relatedEntityChoices:{choices:[],entitySetsFlat:{}}},n=[],i=ETa(r,n,t?.appPath),o=await V$n({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:$s.v4}},hy()!==mo.cli,yn.logger);o.prompts=pl(o.prompts,()=>!!r.appAccess);let s={odata:[]},a=TTa(r,r.relatedEntityChoices),c=STa(5,r,o.answers,s),u=vTa(r.relatedEntityChoices,o.answers,r,s);return e.push(i,...o.prompts,ATa(o.answers,r),bTa(o.answers,r),...c,a,u),{questions:e,answers:{application:r,odataQueryResult:s,odataServiceAnswers:o.answers}}}function ETa(t,e,r){return{type:"input",guiType:"folder-browser",name:iE.appSelection,message:vr("prompts.appSelection.message"),default:n=>r??n.appSelection??t.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:vr("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===t.appAccess?.app.appRoot)return!0;e.length=0,_Ta(t);let i;try{i=await Rbe(n)}catch(u){let l=u;return u instanceof Error&&(l=u.message),yn.logger.error(vr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${vr("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${vr("texts.seeLogForDetails")}`}let o=i.app.services[i.app.mainService??"mainService"];if(!o?.odataVersion?.startsWith("4."))return vr("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:o.odataVersion});let s=await tqn(i);if(typeof s=="string")return s;t.appAccess=i,t.specification=s;let{servicePath:a,systemName:c}=await eqn(i.app.appRoot,o);return a&&(t.servicePath=a,e.push(a)),t.systemName&&(t.systemName.value=c),t.connectPath&&(t.connectPath.value=a),!0}}}function vTa(t,e,r,n){let i;return{when:async o=>t.choices.length>0,name:iE.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:vr("prompts.relatedEntitySelection.message"),choices:()=>t.choices,validate:async(o,s)=>{if(t.choices.forEach(a=>{a.disabled||(a.checked=o.some(c=>c.fullPath===a.value.fullPath))}),s&&!s[iE.skipDataDownload]?.[0]){if(i=await iqn(s,e,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:vr("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:_bt.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:vr("prompts.relatedEntitySelection.openLogs")})}}function TTa(t,e){let r,n,i;return{when:()=>{if((n!==t.systemName?.value||t.servicePath!==r)&&t.referencedEntities?.listEntity){let s=Zjn(t.referencedEntities.listEntity,t.referencedEntities.pageObjectEntities);s&&(e.choices=s.choices,Object.assign(e.entitySetsFlat,s.entitySetsFlat)),r=t.servicePath,n=t.systemName?.value}return e.choices.length>0},name:iE.toggleSelection,type:"confirm",message:vr("prompts.toggleSelection.message"),labelTrue:vr("prompts.toggleSelection.labelTrue"),labelFalse:vr("prompts.toggleSelection.labelFalse"),default:!1,validate:s=>(s!==i&&(e.choices.forEach(a=>{if(a.disabled)return;let c=a.value;a.checked=s===!1?c.entity.defaultSelected:!1}),i=s),!0)}}function STa(t,e,r,n){let i=[],o,s=0,a=c=>({when:async()=>{let u=e.referencedEntities?.listEntity.semanticKeys[c],l=!!u?.name&&u.name!=="IsActiveEntity";return l&&c>s&&(s=c),l},name:`entityKeyIdx:${c}`,message:()=>vr("prompts.entityKey.message",{keyName:`${e.referencedEntities?.listEntity.semanticKeys[c]?.name} (${e.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:vr("prompts.entityKey.hint")},validate:async(u,l)=>{let p=e.referencedEntities?.listEntity.semanticKeys[c];if(p&&delete p.value,nqn.includes(u))return vr("prompts.entityKey.validation.invalidKeyValueChars",{chars:nqn.join()});if(u&&p)if(p.type==="Edm.Boolean")try{p.value=JSON.parse(u)}catch{return vr("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(p.type)){let h=u.split(",");for(let f of h)if(!yTa.test(f.trim()))return vr("prompts.entityKey.validation.invalidGuidValue");p.value=u.trim()}else p.value=u.trim();let d=u.split(",");if(p?.type&&!["Edm.UUID","Edm.Guid"].includes(p.type)){for(let h of d)if(h.split("-").length>2)return p&&delete p.value,vr("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!e.relatedEntityChoices?.choices?.length&&c===s&&!l[iE.skipDataDownload]?.[0]&&e.referencedEntities?.listEntity.semanticKeys[c]?.name){if(o=await iqn(l,r,e),typeof o=="string")return o;n.odata=o.odataQueryResult}return!0}});for(let c=0;c<t;c++)i.push(a(c));return i}function bTa(t,e){return{when:()=>!!t.metadata&&!!e.servicePath,name:iE.skipDataDownload,type:"checkbox",message:vr("prompts.skipDataDownload.message"),guiOptions:{hint:vr("prompts.skipDataDownload.hint")},default:!1,choices:[{name:vr("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function ATa(t,e){let r;return{when:async()=>e.appAccess&&e.specification&&t?.metadata?(r=await Ijn(e.appAccess,e.specification,t.metadata),typeof r=="object"&&(e.referencedEntities=r),!0):!1,name:iE.updateMainServiceMetadata,type:"confirm",message:vr("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:_bt.Severity.error}}}}function sqn(t){let e=[],r=n=>[{name:`${n.entitySetName}/${n.nodeProperty}/source`,type:"list",message:`Source: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))},{name:`${n.entitySetName}/${n.nodeProperty}/target`,type:"list",message:`Target: ${n.entitySetName} > ${n.missingReferentialConstraints?.navPropName}`,default:!1,choices:n.entityProperties.map(i=>({name:i,value:i}))}];return t.forEach(n=>{!n.parentProperty&&n.missingReferentialConstraints?.navPropName&&e.push(...r(n))}),e}var pqn=pe(VC()),dqn=pe(yD());var fqn=pe(lqn()),hqn=require("node:path");function mqn(t,e,r){nm.resetExternalServiceCache();let n=VTa(t,e),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:vr("prompts.valueHelpSelection.message"),choices:()=>n,validate:async s=>{if(!s||s.length===0)return nm.resetExternalServiceCache(),!0;let a=await $Ta(s,r),c=(0,fqn.default)(i,a);return i.length=0,i.push(...c),await UTa(i,r),!0}}],valueHelpData:i}}async function UTa(t,e){let r=[],n={transformResponse:o=>typeof o=="string"?JSON.parse(o):o},i=t.map(async o=>{let s=o,[a]=s.path.split(";");nm.externalServiceRequestCache[a]??=[];let l=(0,pqn.convert)((0,dqn.parse)(o.metadata)).entitySets.map(async p=>{let d=p.name;if(nm.externalServiceRequestCache[a].includes(d))return;nm.externalServiceRequestCache[a].push(d);let h=await e.get((0,hqn.join)(s.path,d),n);s.entityData=s.entityData??[],s.entityData?.push({entitySetName:d,items:h.data.value})});await Promise.allSettled(l),s.entityData&&r.push(s)});return await Promise.allSettled(i),r}async function $Ta(t,e){let r=t.flat();return await e.fetchExternalServices(r)}function VTa(t,e){let r=YJ(t,e,[]),n={};for(let o of r)if(o.type==="value-list"){if(Cjn.includes(o.target))continue;let[s]=o.value.split(";"),a=o.target.split("/").pop();a&&(n[s]??={},n[s][a]??=[],n[s][a].push(o))}else o.type==="code-list"&&(n[o.value]??={},n[o.value]["Code list"]??=[],n[o.value]["Code list"].push(o));let i=[];for(let o of Object.values(n))for(let[s,a]of Object.entries(o)){let c=a.map(u=>{if(u.type==="value-list")return u.target.replace(/\/[^/]*$/,"");if(u.type==="code-list"&&u.collectionPath)return u.collectionPath}).filter(u=>u!==void 0);i.push({name:`${s} (${c.join()})`,value:a})}return i.sort((o,s)=>o.name.localeCompare(s.name))}var yn=class t extends yqn.default{vscode;appWizard;static _logger=zAe;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(e,r){super(e,{...r,skipInstall:!0},{unique:"namespace"}),Hdt(this.env,!0),this.options.force=!0,this.prompts=new DNe.Prompts([{description:vr("steps.odataDownloader.description"),name:vr("steps.odataDownloader.name")},{description:vr("steps.valueHelpSelection.description"),name:vr("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(vr("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return t._logger}async initializing(){await fmt(),t._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await bf.initTelemetrySettings(),bf.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:e,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await oqn(this.options?.data),o=await this.prompt(i);if(this.state.entityOData=r.odata,this.state.entityPropertyToEntitySet=e.relatedEntityChoices.entitySetsFlat,this.state.appRootPath=e.appAccess?.getAppRoot(),this.state.mainServicePath=n.servicePath,this.state.mainServiceName=e.appAccess?.app.mainService,this.state.appEntities=e.referencedEntities,this.state.appRootPath){this.state.mockServerConfig=await oq(this.state.appRootPath);let s;this.state.mockServerConfig?.services&&(t.logger.debug(`Mock config: ${JSON.stringify(this.state.mockServerConfig)}`),s=this.state.mockServerConfig.services.find(a=>a.urlPath.replaceAll(/(^\/)|(\/$)/g,"")===this.state.mainServicePath?.replaceAll(/(^\/)|(\/$)/g,""))),this.state.mockDataRootPath=s?.mockdataPath??(0,xk.join)(ua.Webapp,ua.LocalService,ua.Mockdata)}if(this.state.updateMainServiceMetadata=o[iE.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,o[iE.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(e,o),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof zf){let{questions:s,valueHelpData:a}=mqn(n.servicePath,n.metadata,n.connectedSystem?.serviceProvider);await this.prompt(s),this.state.valueHelpData=a}}catch(e){t.logger.error(e),this._exitOnError(e)}}async writing(){if(this.state.appRootPath){if(this.state.entityOData&&this.state.entityPropertyToEntitySet&&this.state.appEntities)try{let e=Date.now();bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,xk.join)(this.state.appRootPath));let r=fbt(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);t.logger.info(vr("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,o])=>{this.writeDestinationJSON((0,xk.join)(this.state.mockDataRootPath,`${i}.json`),o)}),this.state.appEntities.hierarchyEntities?.filter(i=>i.missingReferentialConstraints&&n.some(([o])=>o===i.entitySetName))?.forEach(i=>{let o=(0,xk.join)(this.state.mockDataRootPath,`${i.entitySetName}.js`),s=this.destinationPath(o),{navPropName:a,constraints:c}=i.missingReferentialConstraints;if(this.fs.exists(s)){let u=this.fs.read(s),l=Ljn(u,a,c);l!==u?(this.writeDestination(o,l),t.logger.info(`Updated referential constraint file: ${i.entitySetName}.js`)):t.logger.debug(`Referential constraint for '${a}' already present in ${i.entitySetName}.js \u2014 skipping`)}else{let u=Mjn(a,c);this.writeDestination(o,u),t.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfFiles:`${n.length}`})}catch(e){t.logger.error(e),bf.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(vr("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let e=Date.now();bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,xk.join)(this.state.appRootPath,ua.Webapp);if(await gOe(this.fs,r,this.state.valueHelpData,this.state.mainServiceName,this.state.mainServicePath),this.state.mockServerConfig){let n={webappPath:r,packageJsonConfig:{skip:!0},ui5MockYamlConfig:{overwrite:!0}};n.ui5MockYamlConfig&&this.state.mainServiceName&&(n.ui5MockYamlConfig.resolveExternalServiceReferences={[this.state.mainServiceName]:!0},await WAe(this.state.appRootPath,n,this.fs))}bf.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfExternalServices:`${this.state.valueHelpData.length}`})}catch(e){t.logger.error(e),bf.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(vr("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let e=(0,xk.join)(this.state.appRootPath,ua.Webapp,ua.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(e,(0,gqn.default)(this.state.mainServiceMetadata,{indentation:" ",lineSeparator:`
3086
3086
  `,collapseContent:!0,throwOnFailure:!1}))}}}async _promptMissingReferentialConstraints(e,r){let n=e.referencedEntities?.listEntity.entitySetName,i=new Set([...n?[n]:[],...(r[iE.relatedEntitySelection]??[]).map(s=>s.entity.entitySetName)]),o=e.referencedEntities?.hierarchyEntities?.filter(s=>!s.parentProperty&&s.missingReferentialConstraints&&i.has(s.entitySetName))??[];if(o.length>0){this.prompts.splice(1,0,[{name:vr("steps.addConstraints.name"),description:vr("steps.addConstraints.description")}]);let s=sqn(o),a=await this.prompt(s),c=[e.referencedEntities?.listEntity,...e.referencedEntities?.pageObjectEntities??[]];o.forEach(u=>{let l=a[`${u.entitySetName}/${u.nodeProperty}/source`],p=a[`${u.entitySetName}/${u.nodeProperty}/target`];if(l&&p){u.missingReferentialConstraints.constraints=[{sourceProperty:l,targetProperty:p}],u.parentProperty=l;let d=c.find(h=>h?.entitySetName===u.entitySetName)?.entityType;u.parentPropertyType=d?.entityProperties.find(h=>h.name===l)?.type??"Edm.String"}})}}_exitOnError(e){throw hy()!==mo.cli&&this.appWizard?.showError(e,DNe.MessageType.notification),new Error(e)}_configureLogging(e,r,n){let i=new HAe(this.rootGeneratorName(),this.log,e,r,n);return i.info(vr("info.loggingInitialised",{logLevel:i.getLogLevel()})),i}};
3087
3087
  /*! For license information please see index.js.LEGAL.txt */
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sap-ux/generator-odata-downloader",
3
3
  "displayName": "Fiori Elements Data Downloader",
4
4
  "description": "Yeoman generator that supports download of app data, typically for mock data server use.",
5
- "version": "0.3.52",
5
+ "version": "0.3.53",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -45,17 +45,17 @@
45
45
  "xml-formatter": "3.7.0",
46
46
  "yeoman-generator": "5.10.0",
47
47
  "@sap-ux/axios-extension": "2.1.0",
48
+ "@sap-ux/btp-utils": "2.0.6",
48
49
  "@sap-ux/fiori-generator-shared": "1.2.18",
49
50
  "@sap-ux/inquirer-common": "1.0.44",
50
- "@sap-ux/btp-utils": "2.0.6",
51
51
  "@sap-ux/logger": "1.0.3",
52
52
  "@sap-ux/mockserver-config-writer": "1.0.20",
53
- "@sap-ux/odata-service-inquirer": "3.2.21",
53
+ "@sap-ux/odata-service-inquirer": "3.2.22",
54
54
  "@sap-ux/odata-service-writer": "1.0.23",
55
55
  "@sap-ux/project-access": "2.2.1",
56
56
  "@sap-ux/store": "2.0.7",
57
- "@sap-ux/ui5-config": "1.0.9",
58
- "@sap-ux/telemetry": "2.0.8"
57
+ "@sap-ux/telemetry": "2.0.8",
58
+ "@sap-ux/ui5-config": "1.0.9"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=22.x"