@sap-ux/generator-odata-downloader 0.3.48 → 0.3.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators/app/index.js +2 -2
- package/package.json +3 -3
package/generators/app/index.js
CHANGED
|
@@ -2469,7 +2469,7 @@ ${i}`),await A_(t,o.concat(i),n),!0}function D0s(t,e){let r=da.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 bgn(t,e,r,n){let i=await Up.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 qAe(t,e,r){return r||(r=(0,Ogn.create)((0,Agn.create)())),e.packageJsonConfig?.skip||Tgn(r,t,e.packageJsonConfig),await Sgn(r,t,e.webappPath,e.ui5MockYamlConfig),r}var SMs=pe(Ma(),1),bMs=pe(ua(),1);var Cgn={questions:{pathToMock:"Path to mocked service",overwrite:"Overwrite services"}};var Udt="mockserver-config-writer",Pgn;async function CMs(){Pgn=Dn.createInstance({resources:{en:{[Udt]:Cgn}},lng:"en",fallbackLng:"en",defaultNS:Udt,ns:[Udt]}),await Pgn.init()}CMs().catch(()=>{});var xgn={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 $dt="odata-service-writer",xMs=Dn.createInstance();async function wMs(){await xMs.init({resources:{en:{[$dt]:xgn}},lng:"en",fallbackLng:"en",defaultNS:$dt,ns:[$dt]})}wMs().catch(()=>{});var Fs;(function(t){t.v2="2",t.v4="4"})(Fs||(Fs={}));var $J;(function(t){t.EDMX="edmx",t.CDS="cds"})($J||($J={}));var Gdt="mainService";var cft=require("node:path"),Xyn=require("node:path/posix"),Jyn=pe(zAe(),1),Qyn=pe(kC(),1),Zyn=pe(dD(),1);var mks=Jyn.default,gks=4;function pOe(t,e,r,n=Gdt,i){if(!r.length||!i)return;let o=new Set;for(let s of r){let a=yks(i,s.path),c=[e,ca.LocalService,n,a],u=s.path.split(";")[0];if(s.entityData&&!o.has(u)){for(let p of s.entityData){let d=(0,cft.join)(...c,`${p.entitySetName}.json`);t.write(d,JSON.stringify(p.items,void 0,gks))}o.add(u)}s.type==="value-list"&&c.push(s.target),c.push("metadata.xml");let l=(0,cft.join)(...c);s.metadata&&t.write(l,mks(s.metadata,{indentation:" ",lineSeparator:`
|
|
2471
2471
|
`,collapseContent:!0,throwOnFailure:!1}))}}function yks(t,e){let[r]=e.split(";"),n=r.split("/"),i="/",o=n.shift();for(;o!==void 0;){let s=(0,Xyn.join)(i,o);if(!t.startsWith(s))break;i=s,o=n.shift()}return r.replace(i,"")}var aft={valueListReferences:!0,codeLists:!0};function _ks(t){return t?{valueListReferences:t.valueListReferences??aft.valueListReferences,codeLists:t.codeLists??aft.codeLists}:{...aft}}function GJ(t,e,r=[],n){let i=_ks(n);if(!e)return[];let o=[e,...r.map(a=>a.Definitions)],s=[];for(let a of o){let c=typeof a=="string"?(0,Qyn.convert)((0,Zyn.parse)(a)):a;for(let u of Object.values(c.annotations))for(let l of u){let p=l.target.replace(c.namespace+".","");Eks(i,s,p,l,t)}}return s}function Eks(t,e,r,n,i){for(let o of n.annotations)vks(t,e,r,o,i),Tks(t,e,o,i)}function vks(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 Tks(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=Yyn(r.record,"CollectionPath"),o=Yyn(r.record,"Url");o&&e.push({type:"code-list",serviceRootPath:n,value:o,collectionPath:i??void 0})}}function Yyn(t,e){let r=t.propertyValues.find(n=>n.name===e);if(r?.value?.type==="String")return r.value.String}var Sks=pe(Ho(),1);var bVc=(0,dOe.dirname)((0,e_n.fileURLToPath)(__importMetaUrl));var bk=require("node:path"),cqn=pe(zAe()),uqn=pe(EOn());var vOn={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 TOn=Dn.createInstance(),lCe="odata-dowload-generator";async function omt(){await TOn.init({resources:{en:{[lCe]:vOn}},lng:"en",fallbackLng:"en",defaultNS:lCe,ns:[lCe],missingInterpolationHandler:()=>""})}function Er(t,e){return e?.ns||(e=Object.assign(e??{},{ns:lCe})),TOn.t(t,e)}omt().catch(t=>console.error("Failed to initialize i18n:",t));var hbt=require("@sap-devx/yeoman-ui-types");var smt;(function(t){t.official="officialVersions",t.snapshot="snapshotsVersions",t.support="support"})(smt||(smt={}));var pCe="1.65.0";var dCe=pe(Ho(),1);var vQ=pe(Ho(),1);var nt={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},Yqs=[{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}],amt=Yqs.filter(t=>t.support===nt.maintenance&&(0,vQ.gte)((0,vQ.coerce)(t.version)??"0.0.0",pCe)).map(t=>({version:(0,vQ.coerce)(t.version)?.version??"0.0.0",support:nt.maintenance})),Xqs=[...amt].map(t=>t.version);var cmt=pe(Ho(),1);var Zqs="1.72.0",AOn="1.102.0",eGs="1.136.0",tGs="1.120.0",Tg;(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"})(Tg||(Tg={}));var rGs={[Tg.SAP_BELIZE]:{id:Tg.SAP_BELIZE,label:"Belize",supportUntil:eGs,deprecateSince:tGs},[Tg.SAP_FIORI_3]:{id:Tg.SAP_FIORI_3,label:"Quartz Light"},[Tg.SAP_FIORI_3_DARK]:{id:Tg.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:Zqs},[Tg.SAP_HORIZON]:{id:Tg.SAP_HORIZON,label:"Morning Horizon",supportSince:AOn},[Tg.SAP_HORIZON_DARK]:{id:Tg.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:AOn}};var MOn=pe(POn(),1),umt=pe(Ho(),1);var xOn={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 wOn="inquirer-common",fCe=Dn.createInstance();function hCe(){fCe.addResourceBundle("en",wOn,xOn)}async function oGs(){await fCe.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),fCe.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),hCe()}function Wr(t,e){return e?.ns||(e=Object.assign(e??{},{ns:wOn})),fCe.t(t,e)}oGs().catch(()=>{});var uGs=pe(yCe(),1);function pG(t,e){return t&&e?MOn.default.filter(t,e,{extract:r=>r.name??""}).map(r=>r.original):e}var _Ce=class{message;link;constructor(e){Object.assign(this,e)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var TQ=pe(Qte(),1);function lGs(t,e,r){let n=t.additionalMessages;return(i,o)=>{let s={...(0,TQ.default)(o),...(0,TQ.default)(r)},a=e(i,s);return a||(typeof n=="function"?n(i,o):void 0)}}function pGs(t,e,r){let n=t.validate;return(i,o)=>{let s={...(0,TQ.default)(o),...(0,TQ.default)(r)},a=e?.(i,s);return a!==!0?a:typeof n=="function"?n(i,o):!0}}function dGs(t,e,r,n){let i;return r==="validate"&&e.validate&&(i=pGs(t,e.validate,n)),r==="additionalMessages"&&e.additionalMessages&&(i=lGs(t,e.additionalMessages,n)),t=Object.assign(t,{[r]:i}),t}function ll(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 lmt(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=dGs(n,o,a,r));let c=e[i].default;c&&(n.default=c)}}}),t}var pmt="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var dmt={FIORI_TOOLS:3046},Xp={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};var LOn="sap.ux.guidedAnswer.openGuidedAnswer",fGs="https://ga.support.sap.com/dtp/viewer/index.html";function kOn(t,e){let r="";return e.length>0&&(r=`/actions/${e.join(":")}`),`${fGs}#/tree/${t}${r}`}var FOn=pe(dAe(),1);var hmt,fmt;function UOn(){return hmt}function vL(t,e){let r=hGs(t,e);hmt&&hmt.reportEvent(r,uc.NoSampling)}function hGs(t,e){fmt=fmt??(0,FOn.default)();let r=Object.assign(e,{OperatingSystem:fmt,Platform:e.Platform||dy().technical});return{eventName:t,properties:r,measurements:{}}}function ECe(t){return Coe(t)?"AbapODataCatalogDest":OP(t)?"GenericODataFullUrlDest":SE(t)?"GenericODataPartialUrlDest":"Unknown"}var mGs="GA_LINK_CREATED",gGs="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 yGs={[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/]},Co=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)=>Wr("errors.serverReturnedAnError",{errorDesc:r?Wr(r,{errorMsg:t.getMessageFromError(e)}):t.getMessageFromError(e)});static _errorTypeToMsg={[Me.CERT]:e=>Wr("errors.certificateError",{errorMsg:t.getMessageFromError(e)}),[Me.CERT_EXPIRED]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anExpiredCert")}),[Me.CERT_SELF_SIGNED]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.aSelfSignedCert")}),[Me.CERT_UKNOWN_OR_INVALID]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anUnknownOrInvalidCert")}),[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anUntrustedRootCert")}),[Me.INVALID_SSL_CERTIFICATE]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anUnknownOrInvalidCert")}),[Me.AUTH]:e=>Wr("errors.authenticationFailed",{error:t.getMessageFromError(e)}),[Me.AUTH_TIMEOUT]:()=>Wr("errors.authenticationTimeout"),[Me.TIMEOUT]:e=>Wr("errors.timeout",{errorMsg:t.getMessageFromError(e)}),[Me.INVALID_URL]:()=>Wr("errors.invalidUrl"),[Me.CONNECTION]:e=>Wr("errors.connectionError",{error:t.getMessageFromError(e)}),[Me.UNKNOWN]:e=>Wr("errors.unknownError",{error:t.getMessageFromError(e)}),[Me.SERVICES_UNAVAILABLE]:()=>Wr("errors.servicesUnavailable"),[Me.SERVICE_UNAVAILABLE]:e=>t.serverErrorMessage(e),[Me.CATALOG_SERVICE_NOT_ACTIVE]:()=>Wr("errors.catalogServiceNotActive"),[Me.INTERNAL_SERVER_ERROR]:e=>t.serverErrorMessage(e,"errors.internalServerError"),[Me.NOT_FOUND]:()=>Wr("errors.urlNotFound"),[Me.ODATA_URL_NOT_FOUND]:()=>Wr("errors.odataServiceUrlNotFound"),[Me.BAD_GATEWAY]:e=>t.serverErrorMessage(e,"errors.badGateway"),[Me.DESTINATION_UNAVAILABLE]:()=>Wr("errors.destination.unavailable"),[Me.DESTINATION_NOT_FOUND]:()=>Wr("errors.destination.notFound"),[Me.DESTINATION_MISCONFIGURED]:e=>Wr("errors.destination.misconfigured",{destinationProperty:typeof e=="string"?e:""}),[Me.NO_V2_SERVICES]:()=>Wr("errors.noServicesAvailable",{version:"2"}),[Me.NO_V4_SERVICES]:()=>Wr("errors.noServicesAvailable",{version:"4"}),[Me.DESTINATION_SERVICE_UNAVAILABLE]:()=>Wr("errors.destination.unavailable"),[Me.REDIRECT]:()=>Wr("errors.redirectError"),[Me.NO_SUCH_HOST]:()=>Wr("errors.noSuchHostError"),[Me.NO_ABAP_ENVS]:()=>Wr("errors.abapEnvsUnavailable"),[Me.BAD_REQUEST]:e=>t.serverErrorMessage(e,"errors.badRequest"),[Me.DESTINATION_CONNECTION_ERROR]:()=>Wr("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?Xp.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[Me.CERT]:Xp.CERTIFICATE_ERROR,[Me.CERT_EXPIRED]:Xp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED]:Xp.CERTIFICATE_ERROR,[Me.CERT_UKNOWN_OR_INVALID]:Xp.CERTIFICATE_ERROR,[Me.INVALID_SSL_CERTIFICATE]:Xp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:Xp.CERTIFICATE_ERROR,[Me.DESTINATION_MISCONFIGURED]:Xp.DESTINATION_MISCONFIGURED,[Me.DESTINATION_UNAVAILABLE]:Xp.DESTINATION_UNAVAILABLE,[Me.DESTINATION_NOT_FOUND]:Xp.DESTINATION_NOT_FOUND,[Me.BAD_GATEWAY]:Xp.BAD_GATEWAY,[Me.DESTINATION_SERVICE_UNAVAILABLE]:Xp.DESTINATION_SERVICE_UNAVAILBLE,[Me.NO_V4_SERVICES]:Xp.NO_V4_SERVICES,[Me.GATEWAY_TIMEOUT]:r?Xp.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]:Xp.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 Ec({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=>yGs[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 GHt(r)?e===Me.SERVICE_UNAVAILABLE?qHt(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!==UT.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(Me.AUTH,Wr("texts.checkDestinationAuthConfig"))):(n=Me.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),vL(gGs,{basErrorType:n??e,destODataType:ECe(r),Platform:this._platform??dy().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:Wr("guidedAnswers.validationErrorHelpText"),icon:pmt,url:kOn(dmt.FIORI_TOOLS,[e])}};return this.guidedAnswersEnabled&&(i.link.command={id:LOn,params:{treeId:dmt.FIORI_TOOLS,nodeIdPath:[e],trigger:this.guidedAnswersTrigger}}),vL(mGs,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${e}`,Platform:this.platform??dy().technical}),new _Ce(i)}};var $On=pe(voe(),1);async function VOn(t){let e=[];try{let r=[$A.ABAP,$A.ABAP_TRIAL,$A.ABAP_CANARY,$A.ABAP_OEM,$A.ABAP_OEM_CANARY,$A.ABAP_HAAS,$A.ABAP_STAGING,$A.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(o=>o.trim()):[],i=await(0,$On.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(o=>{e.push({name:o.label,value:o})}):t.logErrorMsgs(Me.NO_ABAP_ENVS,Wr("errors.noAbapEnvsInCFSpace"))}catch{t.logErrorMsgs(Me.NO_ABAP_ENVS,Wr("errors.abapEnvsCFDiscoveryFailed"))}return e.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var _Gs=pe(kC(),1),EGs=pe(dD(),1);var dva=pe(WDn(),1);var YDn={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 XDn="project-input-validator",E_t=Dn.createInstance();function owe(){E_t.addResourceBundle("en",XDn,YDn)}async function JDn(){await E_t.init({lng:"en",fallbackLng:"en"}),owe()}function IL(t,e){return e?.ns||(e=Object.assign(e??{},{ns:XDn})),E_t.t(t,e)}JDn().catch(()=>{});var taa=pe(eRn(),1);function tRn(t){let e=t?.trim()||"";return e===""||/^\d{3}$/.test(e)?!0:IL("general.invalidClient",{client:t})}var rRn={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 nRn="odata-service-inquirer";var GQ=Dn.createInstance();async function iRn(){await GQ.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),GQ.services.formatter?.add("odataVersionFormatter",t=>t?` V${t}`:""),GQ.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),GQ.addResourceBundle("en",nRn,rRn),hCe(),owe()}function Ze(t,e){return e?.ns||(e=Object.assign(e??{},{ns:nRn})),GQ.t(t,e)}iRn().catch(()=>{});var HQ;(function(t){t.sapSystem="sapSystem",t.capProject="capProject",t.odataServiceUrl="odataServiceUrl",t.none="none",t.metadataFile="metadataFile",t.projectSpecificDestination="projectSpecificDestination",t.businessHub="businessHub"})(HQ||(HQ={}));var swe="sap-client";var ts;(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"})(ts||(ts={}));var ML=pe(gRn(),1),Mt=class t{static _logger=new Ec({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}`),ML.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>ML.errorLogger(i,{logger:n})),e.response.use(i=>ML.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>ML.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 TRn=pe(kC(),1),SRn=pe(dD(),1),A_t=pe(vRn(),1);function Qp(){return Xt.isYUI?Si()?go.bas:go.vscode:go.cli}function bRn(t){try{let e=(0,TRn.convert)((0,SRn.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?Fs.v4:Fs.v2,convertedMetadata:e}}catch(e){throw Mt.logger.error(e),new Error(Ze("prompts.validationMessages.metadataInvalid"))}}function zC(t){if(t)return t===Fs.v2?xn.v2:xn.v4}function hwe(t){if(t?.length===1)return 0}function KC(t){for(let e in t.services)t.services?.[e].log&&(t.services[e].log=(0,A_t.removeSync)(t.services[e]?.log,{setUndefined:!0}));return t.log&&(t.log=(0,A_t.removeSync)(t.log,{setUndefined:!0})),t}function lH(t,e,r){let n=new rf({url:e,client:r}).getId();return t.find(i=>rf.from(i).getId()===n)}function ARn(t,e){return!t&&!e||t?.length===0&&e?.length===0||t===e?!0:!t||!e?!1:[...t].sort().toString()===[...e].sort().toString()}var Oi=new Co(void 0,void 0,"@sap-ux/odata-service-inquirer");var O_t;(function(t){t.capProjectPath="capProjectPath",t.capCliStateSetter="capCliStateSetter"})(O_t||(O_t={}));function mwe(t,e){try{let{convertedMetadata:r,odataVersion:n}=bRn(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 F_t=require("@sap-devx/yeoman-ui-types");var ORn=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]),F_=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&&Mj(!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(swe)??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,Mj(!1)),this._axiosConfig=e,this._serviceProvider=E3t(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(),Oi.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=$N(e);Mt.attachAxiosLogger(s.interceptors),await s.catalog(o).listServices()}catch(o){let s=Co.getErrorType(o?.response?.status??o?.code);o?.isAxiosError&&ORn.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=DU(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=v3t({},i)}else e&&(await this.shouldIgnoreCertError(e,o)&&(this._ignoreCertError=!0,e.ignoreCertErrors=!0,Mj(!1)),this._axiosConfig=e,this._serviceProvider=$N(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?Co.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,Mj(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=$N(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 AVe({environment:UN.EmbeddedSteampunk,url:e.origin,logger:Mt.logger});if(this.systemAuthType==="serviceKey"&&r)return AVe({environment:UN.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),Oi.getErrorMsg(n)??!1}}async validateDestination(e,r,n){try{if(this.systemAuthType=e.Authentication===UT.NO_AUTHENTICATION?"basic":"unknown",OP(e)||SE(e))return await this.validateOdataServiceDestination(e,n);{let i;if(n){let o=DU(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=Oi.logErrorMsgs(i);return{valResult:Oi.getValidationErrorHelp(i,!1,e)??o,errorType:Oi.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(e,r,n){this.resetConnectionState(!0);let i=DU(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=Oi.logErrorMsgs(o);return{valResult:Oi.getValidationErrorHelp(o,!1,e)??a,errorType:Oi.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:Co.getErrorMsgFromType(Me.AUTH,e.Authentication!==UT.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(),Co.getErrorType(u)===Me.CONNECTION?(this.validity.reachable=!1,Oi.logErrorMsgs(Ze("errors.systemOrServiceUrlNotFound",{url:e}))):Oi.getErrorMsg(u)??u.message}}getValidationResultFromStatusCode(e){return e===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):Co.getErrorType(e)===Me.NOT_FOUND?(this.validity.reachable=!1,Co.getErrorMsgFromType(Me.NOT_FOUND)??!1):Co.isCertError(e)?(this.validity.reachable=!0,this.validity.canSkipCertError=ORn.has(Co.getErrorType(e)),this.validity.authenticated=!1,Oi.getValidationErrorHelp(e,!1)??!1):Co.getErrorType(e)===Me.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):Co.getErrorType(e)===Me.REDIRECT?(this.validity.reachable=!0,Ze("errors.urlRedirect")):Co.getErrorType(e)===Me.CONNECTION?(this.validity.reachable=!1,Co.getErrorMsgFromType(Me.CONNECTION,Ze("texts.httpStatus",{httpStatus:e}))??!1):Co.getErrorType(e)===Me.BAD_REQUEST?(this.validity.reachable=!0,Co.getErrorMsgFromType(Me.BAD_REQUEST,Ze("texts.httpStatus",{httpStatus:e}))??!1):Co.getErrorType(e)===Me.BAD_GATEWAY?(this.validity.reachable=!1,Co.getErrorMsgFromType(Me.BAD_GATEWAY,Ze("texts.httpStatus",{httpStatus:e}))??!1):(this.validity.reachable=!0,Co.getErrorMsgFromType(Co.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(swe,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:Oi.getValidationErrorHelp(u,!1,this.destination)??Oi.getErrorMsg(u)??Ze("errors.unknownError"),errorType:Oi.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 BRn=pe(voe(),1);var qD={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var Laa="VALUE_HELP_DOWNLOAD_PROMPTED",kaa="VALUE_HELP_DOWNLOAD_SUCCESS",Faa="VALUE_HELP_DOWNLOAD_FAILED";async function C_t(t,e,r){let n=eL.createTelemetryData(e)??{};if(r&&Object.keys(r).length>0){let i=UOn();i&&await i.reportEvent({eventName:t,properties:n,measurements:r},uc.NoSampling)}else vL(t,n)}async function CRn(t,e,r){if(delete Xt.odataService.valueListMetadata,await C_t(Laa,{userChoseToDownload:t}),t&&e.serviceProvider instanceof Bf){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 C_t(kaa,{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 C_t(Faa,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:o})}}}function PRn(t,e,r){let n=`${e?e+":":""}`,i=`${n}${ts.valueHelpDownload}`,o=`${n}${ts.serviceSelection}`,s=`${n}cliValueHelpDownload`,a,u=[{when:l=>{let d=l?.[o]?.servicePath;return d&&r?.convertedMetadata?(a=GJ(d,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:Ze("prompts.valueHelpDownload.message"),validate:async l=>(Qp()!==go.cli&&await CRn(l,t,a),!0)}];return Qp()===go.cli&&u.push({when:async l=>{let p=l?.[i];return p!==void 0&&a&&await CRn(p,t,a),!1},name:s,type:"input"}),u}var GD=require("@sap-devx/yeoman-ui-types");var $aa=pe(kC(),1),Vaa=pe(dD(),1);function xRn(t){return t.filter(e=>!!e.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var wRn=pe(kC(),1),DRn=pe(dD(),1);function Baa(t){return!!t.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function P_t(t){let e=!1;try{let r;typeof t=="string"?r=(0,wRn.convert)((0,DRn.parse)(t)):r=t;let n=xRn(r.entitySets)??[];n?.length>0&&(e=!Baa(n))}catch(r){Mt.logger.error(Ze("errors.unparseableMetadata",{error:r.message}))}return e}var jaa=["/IWBEP/COMMON"],qaa="SERVICE_INQUIRER_BAS_SUCCESS",Gaa=t=>{let e=[],r=!1;return typeof Mt.logger.getLogLevel=="function"&&(r=Mt.logger.getLogLevel()==="trace"),t?.filter(n=>!jaa.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 Haa(t,e){let r=Object.entries(t);r.forEach(([n,i])=>{Oi.logErrorMsgs(i,Ze("warnings.missingServices",{odataVersion:n}))}),e===r.length&&Oi.logErrorMsgs(Ze("errors.allCatalogServiceRequestsFailed",{version:Object.keys(t).join(", ")}))}async function RRn(t,e){let r={},n={},i=[];for(let s of t){let a=s instanceof pP?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)&&Haa(r,t.length),e&&(o=o.filter(s=>e.includes(s.id)||e.includes(s.path))),Gaa(o)}function x_t(t){let e=eL.createTelemetryData({destODataType:ECe(t)})??{};vL(qaa,e)}async function zaa(t,e,r,n,i){let o=[];try{let s=await e.metadata(),{validationMsg:a,version:c,convertedMetadata:u}=mwe(s,i);if(a)return{validationMsg:a};if(!r&&c===Fs.v2&&n)try{Mt.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=$N(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=Oi.getErrorMsg(s);return Mt.logger.error(Ze("errors.serviceMetadataErrorLog",{servicePath:t,errorText:a})),{validationMsg:Ze("errors.serviceMetadataErrorUI",{servicePath:t,errorText:a})}}}async function Kaa(t,e,r){let n;if(e===v4.NotDetermined)try{n=await r.getServiceType(t)??v4.NotDetermined}catch(i){Mt.logger.error(Ze("errors.serviceTypeRequestError",{error:i.message}))}return n??e}async function w_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 zaa(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?Fs.v2:Fs.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 NRn(t){let e=Ze("prompts.systemService.message");return t&&(e=e.concat(` ${Ze("texts.forUserName",{username:t})}`)),e}async function IRn(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:GD.Severity.warning}:n?{message:Ze("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:GD.Severity.warning}:{message:Ze("warnings.noServicesAvailable"),severity:GD.Severity.warning};if(e){let a=e.serviceType;if(e.serviceODataVersion===xn.v2){if(!i)return{message:Ze("warnings.noAnnotations"),severity:GD.Severity.warning};a=await Kaa(e.servicePath,e.serviceType,r.catalogs[xn.v2])}else if(o?.showCollabDraftWarning&&e.serviceODataVersion===xn.v4&&P_t(o.edmx))return{message:Ze("warnings.collaborativeDraftMessage"),severity:GD.Severity.warning};if(a&&a!==v4.UI)return{message:Ze("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:GD.Severity.warning}}else if(Oi.getErrorMsg())return{message:`${Oi.getErrorMsg()} ${Ze("texts.seeLogForDetails")}`,severity:GD.Severity.information}}var Waa="cliServiceSelection";function HD(t,e,r,n=!0){let i=[],o,s,a,c,u,l={convertedMetadata:void 0},p=r?.requiredOdataVersion,d=`${e}:${ts.serviceSelection}`,h={when:()=>t.validity.authenticated||t.validity.authRequired===!1,name:d,type:r?.useAutoComplete?"autocomplete":"list",message:()=>NRn(t.connectedUserName),guiOptions:{breadcrumb:Ze("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(m,_)=>pG(_,i),choices:async m=>{if(i.length===0||o!==t.validatedUrl||s!==t.validatedClient||!ARn(c,r?.serviceFilter))if(t.catalogs[Fs.v2]||t.catalogs[Fs.v4])i=await Yaa(t.catalogs,p,r?.serviceFilter),o=t.validatedUrl,s=t.validatedClient,c=r?.serviceFilter?[...r.serviceFilter]:void 0,m?.[`${ts.systemSelection}`]?.type==="destination"&&x_t(m?.[`${ts.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?.[`${ts.systemSelection}`]?.type==="destination"&&x_t(m?.[`${ts.systemSelection}`]?.system)}else Mt.logger.error(Ze("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:m=>IRn(i,m,t,{requiredOdataVersion:p,hasAnnotations:u,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>hwe(i),validate:async m=>{let _=m;if(r?.useAutoComplete&&m.value&&(_=m.value),!t.validatedUrl)return!1;if(i.length===0&&Oi.hasError())return Co.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 w_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=lmt([h],m,Xt.odataService)[0]}let f=[h];return Qp()===go.cli&&!r?.useAutoComplete&&f.push({when:async m=>{let _=m?.[`${e}:${ts.serviceSelection}`];if(_&&t.validatedUrl){let{validationResult:v,hasAnnotations:b,convertedMetadata:S}=await w_t(_,t);if(typeof v=="string")throw Mt.logger.error(v),new Error(v);u=b,l.convertedMetadata=S}if(i.length===0&&Oi.hasError()){let v=Co.getHelpForError(Me.SERVICES_UNAVAILABLE).toString();throw new Error(v)}return!1},name:`${e}:${Waa}`}),n||f.push(...ll(PRn(t,e,l),m=>t.serviceProvider instanceof Bf&&!!l.convertedMetadata&&m?.[d]?.serviceODataVersion===xn.v4)),f}async function Yaa(t,e,r){let n=[];return e&&t[e]?n.push(t[e]):n=Object.values(t).filter(i=>i!==void 0),await RRn(n,r)}var kRn=require("@sap-devx/yeoman-ui-types");var D_t=require("@sap-devx/yeoman-ui-types");var bg;(function(t){t.systemUsername="systemUsername",t.systemPassword="systemPassword",t.storeSystemCredentials="storeSystemCredentials"})(bg||(bg={}));function gwe(t,e,r,n){let i=`${e?e+":":""}${bg.systemUsername}`,o=`${e?e+":":""}${bg.systemPassword}`,s=`${e?e+":":""}${bg.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?.[ts.systemSelection],h,f=!0;if(d?.type==="backendSystem")h=d.system?.client;else if(d?.type==="destination"){let _=d.system;(OP(_)||SE(_))&&(f=!1)}let{valResult:m}=await t.validateAuth(t.validatedUrl,p?.[i],l,{sapClient:r?.sapClient||h,isSystem:f,odataVersion:zC(n)});return m===!0&&t.serviceProvider?(Xaa(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:D_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:D_t.Severity.warning}}};return Si()||c.push(u),c}function Xaa(t,e,{username:r,password:n}){if(Xt.odataService.connectedSystem={serviceProvider:KC(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 WQ(t){return t?await ept(t)?Ze("prompts.systemName.systemNameExistsWarning"):!0:Ze("prompts.systemName.emptySystemNameWarning")}function MRn(t,e){try{return new URL(e,t),!0}catch{return Ze("errors.invalidUrl",{input:`${t}${e}`})}}async function LRn(t,e){let r=t+(e?Ze("texts.suggestedSystemNameClient",{client:e}):"");return await WQ(r)===!0?r:Jaa(r)}async function Jaa(t){let e=1,r=`${t} (${e})`;for(;await WQ(r)!==!0;)r=`${t} (${e})`,e++;return r}function Qaa(t){switch(t){case"serviceKey":return WX.ReentranceTicket;case"reentranceTicket":return WX.ReentranceTicket;case"basic":return WX.Basic;default:return}}function ywe(t,e,r,n,i=!0){return{type:"input",name:`${e?e+":":""}${qD.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=lH(Xt.backendSystemsCache,a);if(u)return Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:u.name})}let c=await t.validateUrl(a,{isSystem:!0,odataVersion:zC(r),forceReValidation:!0});return c===!0&&(t.validity.authenticated&&t.serviceProvider?Xt.odataService.connectedSystem={serviceProvider:KC(t.serviceProvider)}:t.systemAuthType="basic"),c},additionalMessages:()=>{if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:kRn.Severity.warning}}}}function _we(t,e){let r,n=!1,i=`${e?e+":":""}`,o=`${i}${ts.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 LRn(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 WQ(a));let l=!!c?.[`${i}${bg.storeSystemCredentials}`];if(u===!0&&t.validatedUrl&&Xt.odataService.connectedSystem){let p=new fa({authenticationType:Qaa(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:YX({serviceKeys:t.serviceInfo,authenticationType:t.systemAuthType}),connectionType:"abap_catalog"});Xt.odataService.connectedSystem.backendSystem=p,Xt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return u}}}async function R_t(){return await AC({entityName:"system"})}async function FRn(t=!1,e){let r=[];try{r=await(await R_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 N_t="!@\xA3*&937newSystem*X~qy^",Ewe="cfAbapEnvService";async function URn(t,e,r,n,i){Xt.resetConnectedSystem();let o=!1,a=await(await R_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:zC(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":"abap_catalog"});else if(a.serviceKeys)o=await e.validateServiceInfo(a.serviceKeys,zC(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:zC(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:KC(e.serviceProvider),backendSystem:a})}return o}async function YQ(t,e,r,n){Xt.resetConnectedSystem();let{valResult:i,errorType:o}=await e.validateDestination(t,zC(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:KC(e.serviceProvider),destination:t}),i)}function Zaa(t,e){return!e||e.odata_abap&&Coe(t)||e.odata_generic&&Ooe(t)||e.full_service_url&&OP(t)||e.partial_service_url&&SE(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 $Rn(t,e=!1,r=!1,n){let i=[],o;if(Si()){let s={};try{s=await yVe({stripS4HCApiHosts:!0})}catch(a){Mt.logger.error(Ze("errors.destination.listDestinations",{error:a.message}))}i=Object.values(s).filter(a=>Zaa(a,t)).map(a=>({name:HHt(a),value:{type:"destination",system:a}})),e&&(o={name:Ze("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:Ewe,system:Ewe}})}else{let s=await FRn(!1,n);Xt.backendSystemsCache=s,i=s.map(a=>({name:U3t(a),value:{system:a,type:"backendSystem"}})),r||(o={name:Ze("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:N_t}})}return i.sort(({name:s},{name:a})=>s.localeCompare(a,void 0,{numeric:!0,caseFirst:"lower"})),o&&i.unshift(o),i}function I_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===N_t;if(o==="cfAbapEnvService")return r===Ewe}):-1}var vwe="abapOnBtp",bYc=`${vwe}:${qD.newSystemUrl}`,eca="cliCfAbapService",M_t={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function jRn(t,e){Xt.reset();let r=new F_,n=[];return n.push({type:"list",name:M_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(ll([ywe(r,vwe,t?.serviceSelection?.requiredOdataVersion,e)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...ll([...L_t(r,void 0,void 0,e)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),t?.userSystemName?.hide!==!0&&n.push(ll([_we(r,vwe)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...HD(r,vwe,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}async function VRn(t,e,r,n=!1,i){Xt.resetConnectedSystem();let o=t.label,s=await(0,BRn.apiGetInstanceCredentials)(o);if(!s?.credentials?.uaa)return Ze("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:o});let a=!0,c;if(Qp()===go.bas)try{c=await YHt(o,{uaaCredentials:s.credentials.uaa,hostUrl:s.credentials.url},Mt.logger),a=await YQ(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(Oi.getErrorMsg()??Ze("errors.abapServiceAuthenticationFailed")),new Error(Ze("errors.abapServiceAuthenticationFailed"));return e.serviceProvider&&Qp()!==go.bas&&(e.connectedSystemName=await _Ve(o),Xt.odataService.connectedSystem={serviceProvider:KC(e.serviceProvider)}),!0}function L_t(t,e,r,n){let i=[],s=[{type:"list",name:`${e?e+":":""}${M_t.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await VOn(Oi),i.length===0&&Qp()===go.cli)throw new Error(Ze("errors.abapEnvsUnavailable"));return i},default:()=>hwe(i),message:Ze("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let u=await VRn(a,t,r,Qp()===go.cli,n);if(!Si()&&u===!0&&t.validatedUrl){let l=lH(Xt.backendSystemsCache,t.validatedUrl,t.validatedClient);if(l)return t.resetConnectionState(!0),Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return u}if(Oi.getCurrentErrorType()===Me.NO_ABAP_ENVS){let u=Oi.getErrorMsg(!0),l=Ze("texts.seeLogForDetails");return`${u} ${l}`}return!1}}];return Qp()===go.cli&&s.push({when:async a=>{let c=a?.[M_t.cloudFoundryAbapSystem];return c&&await VRn(c,t,r,!0),!1},name:eca}),s}function qRn(t){let e="cfAbapBas",r=new F_;return[...L_t(r,e,t?.serviceSelection?.requiredOdataVersion),...HD(r,e,t?.serviceSelection,t?.valueHelpDownload?.hide)]}var LL="abapOnPrem",k_t=`${LL}:${qD.newSystemUrl}`,UYc=`${LL}:${bg.systemUsername}`,$Yc=`${LL}:${bg.systemPassword}`,tca={sapClient:"sapClient"};function GRn(t){Xt.reset();let e=new F_,r=t?.serviceSelection?.requiredOdataVersion,n=rca(t?.userSystemName,e,r);return n.push(...HD(e,LL,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}function rca(t,e,r){let n=e??new F_,i={sapClient:void 0,isValid:!0},o=[ywe(n,LL,r,void 0,!1),{type:"input",name:tca.sapClient,message:Ze("prompts.sapClient.message"),guiOptions:{breadcrumb:Ze("prompts.sapClient.breadcrumb")},validate:(s,a)=>{let c=tRn(s);if(c===!0){if(i.sapClient=s,i.isValid=!0,a?.[k_t]){let u=lH(Xt.backendSystemsCache,a[k_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}},...gwe(n,LL,i,r)];return t?.hide!==!0&&o.push(ll([_we(n,LL)],s=>!!s?.[k_t]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),o}function HRn(t,e){let r=[{type:"list",name:qD.newSystemType,choices:[{name:Ze("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:Ze("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:Ze("prompts.newSystemType.message")}];return r.push(...ll(GRn(t),n=>n.newSystemType==="abapOnPrem")),r.push(...ll(jRn(t,e),n=>n.newSystemType==="abapOnBtp")),r}var Twe="systemSelection",c9c=`${Twe}:${bg.systemUsername}`,u9c=`${Twe}:${bg.systemPassword}`,zRn={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function KRn(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=rf.from(t.system);o=await URn(s,e,r,n,i)}else if(t.type==="destination"){if(SE(t.system))return!0;o=await YQ(t.system,e,r,i)}return o}async function U_t(t,e){Xt.reset();let r=new F_,n=await nca(r,t,e);return t?.serviceSelection?.hide||n.push(...ll(HD(r,Twe,t?.serviceSelection,t?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),Si()?n.push(...ll(qRn(t),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...ll(HRn(t,e),i=>i.systemSelection?.type==="newSystemChoice")),n}async function nca(t,e,r){let n=e?.serviceSelection?.requiredOdataVersion,i=e?.systemSelection?.destinationFilters,o=await $Rn(i,e?.systemSelection?.includeCloudFoundryAbapEnvChoice,e?.systemSelection?.hideNewSystem,e?.systemSelection?.backendSystemFilter),s=I_t(o,e?.systemSelection?.defaultChoice),a=e?.systemSelection?.connectPath,c=e?.systemSelection?.onlyShowDefaultChoice&&e?.systemSelection?.defaultChoice,u=[{type:e?.systemSelection?.useAutoComplete?"autocomplete":"list",name:ts.systemSelection,message:Ze("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:Ze("prompts.systemSelection.hint")},source:(l,p)=>pG(p,o),choices:c?[o[s]]:o,default:()=>c?0:(s=I_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),KRn(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:F_t.Severity.information};if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:F_t.Severity.warning}}}];if(Si()){let l={when:p=>{let d=p?.[ts.systemSelection];return d?.type==="destination"?SE(d.system):!1},type:"input",name:zRn.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?.[ts.systemSelection]?.system,f=MRn(h.Host,p);return f!==!0?(t.resetConnectionState(!0),f):await YQ(h,t,n,p)}};u.push(l)}return Qp()===go.cli&&!e?.systemSelection?.useAutoComplete&&u.push({when:async l=>{let p=l?.[ts.systemSelection];if(!p)return!1;let d=await KRn(p,t,n,void 0,a?.value);if(d!==!0)throw Mt.logger.error(d.toString),new Error(d.toString());return!1},name:`${zRn.systemSelectionCli}`}),u.push(...gwe(t,Twe,void 0,n)),u}var ica=require("@sap-devx/yeoman-ui-types");var $_t;(function(t){t.ignoreCertError="ignoreCertError",t.username="username",t.cliIgnoreCertValidate="cliIgnoreCertValidate"})($_t||($_t={}));var pva=require("@sap-devx/yeoman-ui-types");var dca=pe(Ma(),1),fca=pe(ua(),1),hca=pe(sl(),1);var cNn=pe(Ma(),1),uNn=pe(ua(),1),lNn=pe(Ho(),1);var rNn=pe(require("node:os"),1),nNn=require("node:path"),iNn=pe(Ho(),1);var Swe=require("node:path"),WRn=require("node:url"),oca=(0,Swe.dirname)((0,WRn.fileURLToPath)(__importMetaUrl));function $s(t=""){return(0,Swe.join)(oca,"../templates",t)}var pH=require("node:path");var YRn=" ",XQ=" ",JQ={"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 sca(t,e,r=[]){if(!r.includes(t)&&HX(t,e))return t;for(let i=1;i<1e3;i++){let o=`${t}${i}`;if(!r.includes(o)&&HX(o,e))return o}throw new Error(`Failed to generate unique ID for base '${t}' after 1000 attempts`)}async function V_t(t,e){let r=await Gw(".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 U_(t={}){let{basePath:e,fsEditor:r,fileContentCache:n=[]}=t,i=o=>(s,a=[])=>sca(s,o,a);return n.length>0?i(n):r&&e?V_t(e,r).then(o=>{let s=o.map(a=>r.read(a).toString());return i(s)}):i([])}var aca={noGlob:!0};function cca(t){let e,r=t.startsWith(XQ)?XQ:YRn;for(let n=0;n<t.length;n++)if(t[n]!==r){e={size:n,useTabSymbol:r===XQ};break}return e}function B_t(t){let e,r=new Set([YRn,XQ]),i=t.split(/\r\n|\n/).find(o=>r.has(o[0]));return i&&(e=cca(i)),e}function bwe(t,e,r){if(!r){let i=t.read(e);r=B_t(i)}let n;return r&&(r.useTabSymbol?n=XQ.repeat(r.size||1):n=r.size),n}function WC(t,e){let{filepath:r,content:n,replacer:i}=e,o=bwe(t,r,e.tabInfo);t.extendJSON(r,JSON.parse(n),i,o)}function $_(t,e,r,n,i){let o=Awe(e),s=JQ[o];if(i&&s?.getData){let a=s.getData(i,n);n={...n,...a}}t.copyTpl(e,r,n,void 0,aca)}function Awe(t){let e=(0,pH.normalize)(t),r=`${pH.sep}templates${pH.sep}`,n=e.indexOf(r);return n===-1?t:e.substring(n+r.length).split(pH.sep).join("/")}var oNn=pe(JF(),1);var Cwe=pe(JF(),1),JRn=pe(BF(),1);var V_={Full:"full",Basic:"basic"};var kL="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 Ub="absolute",QQ="relative",Owe=["breadcrumbs","navigationActions","titleContent","actions","headerContent","items","footer"],XRn="This is a sample template, event handlers should be added for implementation",j_t="sap.fe.macros";var ZQ={"":"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 $v(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 q_t=t=>{let e=[];for(let r of t.split("/"))e.push(r===""||r.includes(":")?r:`*[local-name()='${r}']`);return e.join("/")};function uca(t,e,r,n){if(t.localName!=="Page"||t.namespaceURI!==j_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]=q_t(c)}}function QRn(t,e){let r={},n;try{let i=e.read(t),o=new Cwe.DOMParser($v()).parseFromString(i,"text/xml"),s=[{parentNode:"",node:o.firstChild}],a=Ag(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===j_t),c||(r[`${u}/${l.nodeName}`]=q_t(`${u}/${l.nodeName}`)),uca(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: ${ZRn(i)}`)}return{inputChoices:r,pageMacroDefinition:n}}function ZRn(t){return t instanceof Error?t.message:String(t)}async function eNn(t,e){let r=[],n="macros:FilterBar",i=e.read(t),o=new Cwe.DOMParser($v()).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 tNn(t,e,r){let n=new Set;try{let i=r.read(t),o=new Cwe.DOMParser($v()).parseFromString(i,"text/xml"),s=o.firstChild?._nsMap||{},c=JRn.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: ${ZRn(i)}`)}return n}function lca(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 Ag(t,e="sap.fe.macros",r="macros"){let n=t.documentElement,i=lca(n,e);return i!==null?i:(n.setAttributeNS("http://www.w3.org/2000/xmlns/",r===""?"xmlns":`xmlns:${r}`,e),r)}function G_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 sNn(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]=G_t(t,n[r.line],r.character),n.join(rNn.default.EOL)}async function dH(t,e){return(0,nNn.join)(await vu(t,e),"manifest.json")}async function Zp(t,e,r=!0){let n=await dH(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 aNn(t,e,r){let n=t.read(e).toString(),i=new oNn.DOMParser($v(void 0,()=>{})).parseFromString(n,"text/xml");return i.documentElement?!i.getElementById(r):!0}function Pwe(t,e){let r=t["sap.ui5"]?.dependencies?.libs;return e.length?e.some(n=>r?.[n]!==void 0):!0}async function Og(t,e,r=["sap.fe.templates"]){e||(e=(0,uNn.create)((0,cNn.create)()));let n=await dH(t,e);if(e.exists(n)){let i=e.readJSON(n);if(!Pwe(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 eZ(t){return t instanceof Error?t.message:String(t)}var fH;(function(t){t.ListReport="ListReport",t.ObjectPage="ObjectPage",t.CustomPage="CustomPage"})(fH||(fH={}));var xwe=require("node:path");function Vv(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,xwe.join)((0,xwe.dirname)(e),t.folder),t}function H_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 hH(t,e,r,n=!1,i=!1){return H_t(t,e,r,n,i).content}var pNn=pe(Ho(),1);var gEa=pe(Ma(),1),yEa=pe(ua(),1),_Ea=pe(sl(),1);var XSt=pe(Ho(),1);var eEt=pe(Ma(),1),tEt=pe(ua(),1),rEt=pe(sl(),1),gH=pe(Ho(),1),YC=require("node:path"),UL=pe(JF(),1),nEt=pe(zAe(),1),vNn=pe(BF(),1);var rs;(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"})(rs||(rs={}));var tZ;(function(t){t.JSON="json",t.CDS="cds",t.XML="xml",t.JS="javascript",t.TS="typescript",t.ABAPCDS="abapCds"})(tZ||(tZ={}));var mca={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."}},dNn=mca;var gca="fe-fpm-writer",Mi={buildingBlock:`${gca}-building-block`},fNn=Dn.createInstance();async function wwe(){await fNn.init({resources:{en:{[Mi.buildingBlock]:dNn}},lng:"en",fallbackLng:"en",defaultNS:Mi.buildingBlock,ns:[Mi.buildingBlock]})}function xo(t,e){return(r,n)=>fNn.t(`${t}:${e??""}${r}`,n)}var Dwe=require("node:path"),K_t=pe(BF(),1);var hNn=require("node:path");var yca={name:"event",jsName:"oEvent",description:"the event object provided by the event provider.",importType:"UI5Event",importSource:"sap/ui/base/Event"};function _ca(t,e){let r;return e&&t.endsWith(".controller")?r=t.replace(".controller",""):r=t,r}function Bv(t,e,r,n,i=[yca]){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=_ca(p,l)));let h=s?"ts":"js",f=(0,hNn.join)(e.path||"",`${p}${o?".controller":""}.${h}`);if(!t.exists(f))$_(t,$s(`${a}.${h}`),f,{eventHandlerFnName:c,parameters:i,...e});else if(u){let _=t.read(f);typeof u.position=="object"?_=sNn(u.fragment,_,u.position):_=G_t(u.fragment,_,u.position),t.write(f,_)}let m=`${e.ns}.${d}.${c}`;return l?`${l}.${m}`:`${m}`}var W_t=[{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"}],mNn={[pr.CustomColumn]:{aggregationConfig:{aggregationName:"columns",elementName:"Column"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Eca},[pr.CustomFilterField]:{aggregationConfig:{aggregationName:"filterFields",elementName:"FilterField"},templateFile:"filter/fragment.xml",namespace:{uri:"sap.fe.macros.filterBar",prefix:"macros"},processor:vca},[pr.CustomFormField]:{aggregationConfig:{aggregationName:"fields",elementName:"FormElement"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:Tca},[pr.RichTextEditorButtonGroups]:{aggregationConfig:{aggregationName:"buttonGroups",elementName:"ButtonGroup"},namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:Oca},[pr.Action]:{aggregationConfig:{aggregationName:"actions",elementName:"Action"},namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Cca}};function Rwe(t){let e=mNn[t];if(!e)throw new Error(`No configuration found for building block type: ${t}`);return e}function B_(t,e){return t.buildingBlockType===e}function Eca(t,e){let{fs:r,viewPath:n}=e;if(!B_(t,pr.CustomColumn))throw new Error("Expected CustomColumn building block data");let i=Rwe(pr.CustomColumn),o=t.embededFragment,s;o.eventHandler&&(s=Bv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content=hH("Sample Text",t.generateId,s),n&&!r.exists(n)&&r.copyTpl($s(i.templateFile),n,o)}function vca(t,e){let{fs:r,viewPath:n,embeddedFragment:i}=e;if(!B_(t,pr.CustomFilterField))throw new Error("Expected CustomFilterField building block data");if(!i)throw new Error("EmbeddedFragment is required for CustomFilterField");let o=Rwe(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=Bv(r,s,s.eventHandler,{controllerSuffix:!1,typescript:t.embededFragment?.typescript,templatePath:"filter/Controller"}));let a=o.templateFile,c=JQ[a];if(c?.getData){let u=c.getData(t.generateId);s={...s,...u}}n&&!r.exists(n)&&r.copyTpl($s(o.templateFile),n,s)}function Tca(t,e){let{fs:r,viewPath:n}=e;if(!B_(t,pr.CustomFormField))throw new Error("Expected CustomFormField building block data");if(!t.embededFragment)throw new Error("EmbeddedFragment is required for CustomFormField");let i=Rwe(pr.CustomFormField),o=t.embededFragment,s;o.eventHandler&&(s=Bv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content??=hH("Custom Form Field Content",t.generateId,s),n&&!r.exists(n)&&r.copyTpl($s(i.templateFile),n,o)}function Sca(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 bca(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 Aca(t,e){let r=bca(t);return e.buttonGroups?.map(n=>{let i=W_t.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 Oca(t,e){let{xmlDocument:r,updatedAggregationPath:n,hasAggregation:i}=e;if(!B_(t,pr.RichTextEditorButtonGroups)&&!B_(t,pr.RichTextEditor))throw new Error("Expected RichTextEditorButtonGroups or RichTextEditor building block data");let o=new Map;if(i&&r&&n){let a=K_t.useNamespaces(r.documentElement?._nsMap??{})(n,r);if(a.length>0){let c=a[0],u=Rwe(pr.RichTextEditorButtonGroups);Array.from(c.childNodes).filter(d=>d.nodeType===1&&d.localName===u.aggregationConfig.elementName).forEach(d=>{let h=Sca(d);h&&o.set(h.name,h)});let p=a[0];p.parentNode?.removeChild(p)}}t.buttonGroups=Aca(o,t)}function mH(t){return t.replace(/\/([A-Za-z_][A-Za-z0-9_.-]*)(?=\/|$)/g,(e,r)=>r.includes(":")?`/${r}`:`/*[local-name()='${r}']`)}function z_t(t,e,r,n){let i=t.documentElement?._nsMap??{},o=K_t.useNamespaces(i),s=mH(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+`/${Ag(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 Cca(t,e){let{fs:r}=e;if(!B_(t,pr.Action))throw new Error("Expected Action building block data");let n=t.embeddedAction;if(typeof n.eventHandler=="object"){let i=Bv(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=Dwe.posix.join(a??"",n.eventHandler.fileName)}n.eventHandler={fnName:`handler.${o}`,fileName:s}}}}function gNn(t,e,r,n,i,o){let s=i,a=!1,c="macrosTable",u,l,p=mNn[t.buildingBlockType];if(!p)return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c};if(B_(t,pr.RichTextEditorButtonGroups)||B_(t,pr.RichTextEditor)){let d=z_t(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=Ag(e,p.namespace.uri,p.namespace.prefix)}if((B_(t,pr.CustomColumn)||B_(t,pr.CustomFilterField)||B_(t,pr.CustomFormField))&&t.embededFragment){u=Vv(t.embededFragment,r,n),l=(0,Dwe.join)(u.path,`${u.fragmentFile??u.name}.fragment.xml`);let d={fs:o,viewPath:l,embeddedFragment:u};p.processor(t,d);let h=z_t(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName});s=h.updatedAggregationPath,a=h.hasElement,c=Ag(e,p.namespace.uri,p.namespace.prefix)}if(B_(t,pr.Action)&&t.embeddedAction){let d=z_t(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName}),h={fs:o,xmlDocument:e,updatedAggregationPath:d.updatedAggregationPath,hasAggregation:d.hasElement,embeddedAction:Vv(t.embeddedAction,r,n)};p.processor(t,h),s=d.updatedAggregationPath,a=d.hasElement,Ag(e,p.namespace.uri,p.namespace.prefix)}return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c}}var Pca=pe(Ma(),1),xca=pe(ua(),1),yNn=pe(sl(),1),_Nn=require("node:path"),Nwe=pe(JF(),1);var Y_t=pe(BF(),1),Iwe=pe(Ho(),1);function Mwe(t,e,r){let n;try{n=r.read((0,_Nn.join)(t,e))}catch(o){throw new Error(`Unable to read xml view file. Details: ${eZ(o)}`)}let i;try{i=new Nwe.DOMParser($v()).parseFromString(n,"text/xml")}catch(o){throw new Error(`Unable to parse xml view file. Details: ${eZ(o)}`)}return i}function X_t(t){if(t.buildingBlockType===pr.Page)return t.templateType===V_.Full?Owe:void 0}function J_t(t){let e=t?(0,Iwe.coerce)(dg(t)):void 0;if(e&&(0,Iwe.lt)(e,kL)){let r=xo(Mi.buildingBlock,"pageBuildingBlock.");throw new Error(`${r("fullTemplateMinUi5VersionRequirement",{minUI5Version:e.version})}`)}}function wca(t){let e=Ag(t,"sap.fe.macros","macros");return e===""?(t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:macros","sap.fe.macros"),"macros"):e}var Dca={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 Rca(t,e,r=[]){let n=Dca[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 Nca(t,e,r,n,i){let o=$s(`/building-block/page/${e}.xml`),s=(0,yNn.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 Nwe.DOMParser($v(ZQ,(u,l)=>{throw new Error(`Unable to parse page aggregation fragment '${e}'. Details: [${u}] - ${l}`)})).parseFromString(c,"text/xml")}function Q_t(t,e,r,n,i=Owe,o=!0){let s=wca(e),a=`${s}:`,c=r.documentElement;c.appendChild(r.createComment(XRn));for(let u of i){let l=n(u),p=u==="items"&&o,d=Rca(u,n),f=Nca(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 ENn(t,e){let r=t.documentElement?._nsMap??{};if(Y_t.useNamespaces(r)(mH(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;Ag(t,u,a)===""&&a&&t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${a}`,u);let d=Y_t.useNamespaces({...r,[a]:u})(mH(e.slice(0,i)),t);d.length!==0&&d[0].appendChild(t.createElementNS(u,`${a}:${c}`))}var FL={id:"REPLACE_WITH_BUILDING_BLOCK_ID",entitySet:"REPLACE_WITH_ENTITY",qualifier:"REPLACE_WITH_A_QUALIFIER"};function Z_t(t){return t.buildingBlockType===pr.Page&&t.templateType===V_.Full}async function $b(t,e,r){let{viewOrFragmentPath:n,aggregationPath:i,buildingBlockData:o,allowAutoAddDependencyLib:s=!0}=e;r??=(0,tEt.create)((0,eEt.create)()),await Og(t,r,[]);let a=e.buildingBlockData.generateId??await U_({basePath:t,fsEditor:r});if(!r.exists((0,YC.join)(t,n)))throw new Error(`Invalid view path ${n}.`);let{path:c,content:u}=await Zp(t,r),l=Mwe(t,n,r);i&&ENn(l,i);let{updatedAggregationPath:p,processedBuildingBlockData:d,hasAggregation:h,aggregationNamespace:f}=gNn({...o,generateId:a},l,c,u,i,r),m={hasAggregation:h,aggregationNamespace:f},_=kca({...d,generateId:a},l,r,u,m),v=Z_t(o),b=X_t(o);if(v&&J_t(u),b&&Q_t(r,l,_,a,b,v),o.buildingBlockType===pr.RichTextEditor||o.buildingBlockType===pr.RichTextEditorButtonGroups){let S=u?(0,gH.coerce)(dg(u)):void 0;if(S&&(0,gH.lt)(S,"1.117.0")){let A=xo(Mi.buildingBlock,"richTextEditorBuildingBlock.");throw new Error(`${A("minUi5VersionRequirement",{minUI5Version:S})}`)}Ag(l,"sap.fe.macros.richtexteditor","richtexteditor")}if(r=Fca(t,n,p,l,_,r,e.replace),s&&u&&!Pwe(u,["sap.fe.macros"])){let S=await dH(t,r),A=await SNn(r),C=r.read(S),D=B_t(C);WC(r,{filepath:S,content:A,tabInfo:D})}return r}function Mca(t,e){return t?{metaPath:e?`/${FL.qualifier}`:"",contextPath:e?FL.entitySet:""}:{metaPath:e?`/${FL.entitySet}/${FL.qualifier}`:""}}function Lca(t,e,r,n){if(!e)return Mca(t,r);let{bindingContextType:i=Ub,alwaysAbsolutePath:o=!0}=e,{entitySet:s,qualifier:a}=e;s=s||(r?FL.entitySet:"");let c=a||(r?FL.qualifier:"");if(t){let u=c.split("/");return a=u.pop(),{metaPath:a,contextPath:u.length?`/${s}/${u.join("/")}`:`/${s}`}}return n?{metaPath:`${i===Ub?"/":""}${s}/${n}`}:{metaPath:i===Ub||o?`/${s}/${c}`:c}}function TNn(t,e,r,n,i,o){let s=t.buildingBlockType,a=$s(`/building-block/${s}/View.xml`);if(typeof t.metaPath=="object"||t.metaPath===void 0){let p=r?(0,gH.coerce)(dg(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,gH.lt)(p,"1.97.0")),f=Lca(h,t.metaPath,i,d);t={...t,metaPath:f.metaPath},!t.contextPath&&f.contextPath&&(t.contextPath=f.contextPath)}t.id||(t.id=FL.id);let c=Awe(a),u=JQ[c],l={macrosNamespace:e?Ag(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,rEt.render)(n.read(a),l,{})}async function SNn(t,e="sap.fe.macros"){let r=$s("/building-block/common/manifest.json");return(0,rEt.render)(t.read(r),{libraries:{[e]:{}}})}function kca(t,e,r,n,i){let o=TNn(t,e,n,r,void 0,i),s;try{s=new UL.DOMParser($v(ZQ)).parseFromString(o,"text/xml")}catch(a){throw new Error(`Unable to parse template file with building block data. Details: ${eZ(a)}`)}return s}function Fca(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=vNn.useNamespaces(c),l=mH(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 UL.XMLSerializer().serializeToString(n);o.write((0,YC.join)(t,e),(0,nEt.default)(f))}else throw new Error(`Aggregation control not found ${r}.`);return o}function Uca(t,e){return e?{fileName:(0,YC.parse)(e).base,relativePath:e,fullPath:(0,YC.join)(t,e)}:{}}async function XC(t,e,r){let n={},{buildingBlockData:i,viewOrFragmentPath:o,allowAutoAddDependencyLib:s=!0}=e;if(!i?.buildingBlockType)return{};r=r??(0,tEt.create)((0,eEt.create)());let a=o?Mwe(t,o,r):void 0,{content:c,path:u}=await Zp(t,r,!1),l=i.generateId??await U_({basePath:t,fsEditor:r}),p=TNn({...i,generateId:l},a,c,r,!0),d=p,h=X_t(i);if(h){Z_t(i)&&J_t(c);let m=a??new UL.DOMParser().parseFromString('<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:macros="sap.fe.macros" xmlns="sap.m"/>',"text/xml"),_=Ag(m,"sap.fe.macros","macros")||"macros",v=`${p}`.replace(new RegExp(`^<(${_}:Page)`),`<$1 xmlns:${_}="sap.fe.macros"`),b=new UL.DOMParser($v(ZQ,(A,C)=>{throw new Error(`Unable to parse Page building block snippet. Details: [${A}] - ${C}`)})).parseFromString(v,"text/xml");Q_t(r,m,b,l,h,Z_t(i));let S=b.documentElement;d=S?(0,nEt.default)(new UL.XMLSerializer().serializeToString(S)):p}let f=Uca(t,o);if(n.viewOrFragmentPath={content:d,language:tZ.XML,filePathProps:f},s){let m=await SNn(r);n.manifest={content:m,language:tZ.JSON,filePathProps:{fileName:(0,YC.parse)(u).base,relativePath:(0,YC.relative)(t,u),fullPath:u}}}return n}function zD(t){return["CAPJava","CAPNodejs"].includes(t.projectType)}var d3=require("node:path");var r$n=pe(kC(),1);var JUn=pe(Ma(),1),QUn=pe(ua(),1);var JC="attribute",xr="text",rZ;(function(t){t.StripIndentation="StripIndentation",t.KeepIndentation="KeepIndentation"})(rZ||(rZ={}));var vt="element",$L="Edmx",KD="Edm",Lwe="reference",bNn="namespace",on="target",WD="annotation-file";function wr(t,e,r,n){let i={type:JC,name:t,value:e};return r&&(i.nameRange=r),n&&(i.valueRange=n),i}function Kn(t,e,r,n){let i={type:xr,text:t};return e&&(i.range=e),r&&(i.fragmentRanges=r),n&&(i.multilineType=n),i}function gt({name:t,range:e,nameRange:r,attributes:n,content:i,contentRange:o,namespace:s,namespaceAlias:a}){let c={type:vt,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 YD="!";function kwe(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function iEt(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 nZ="TypeDefinition",VL="EnumType",j_="ComplexType",ff="Term";var ANn="Action",ONn="Function";var Fwe="Property";var CNn="ActionImport",PNn="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 xNn;(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"})(xNn||(xNn={}));var wo;(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"})(wo||(wo={}));var BL;(function(t){t.DataServices="DataServices",t.Edmx="Edmx",t.Include="Include",t.IncludeAnnotations="IncludeAnnotations",t.Reference="Reference"})(BL||(BL={}));var wNn;(function(t){t.Uri="Uri"})(wNn||(wNn={}));var DNn;(function(t){t.Alias="Alias",t.Namespace="Namespace"})(DNn||(DNn={}));var lXc=new Set([BL.DataServices,BL.Edmx,BL.Include,BL.IncludeAnnotations,BL.Reference]);var Hc={printWidth:300,tabWidth:4,useTabs:!1,useSnippetSyntax:!0};var RNn="missing-required-property";var Uwe="common-case-issue",NNn="no-odata-path-separator";var INn="deprecated-$value-syntax";var yH="Collection(";function zc(t){if(t.startsWith(yH))return MNn(t);let e=t.indexOf("(")+1;if(e>0){let r=t.slice(0,e-1),n=t.slice(e,-1),i=$we(r),o=n.length>0?n.split(",").map(s=>s.startsWith(yH)?MNn(s):$we(s)):[];return{...i,type:"action-function",parameters:o}}return $we(t)}function MNn(t){let e=t.endsWith(")")?-1:void 0;return{...$we(t.slice(yH.length,e)),type:"collection"}}function $we(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 ed(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=>ed(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 Cg(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}=zc(i);$ca(t,s,e,r,o),Vca(t,n,e,r,s)}return r}function hf(t,e){let r=Cg(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=>hf(u,e)),i=s+"("+c.join(",")+")"}return i}function $ca(t,e,r,n,i){t.startsWith(yH)||(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 Vca(t,e,r,n,i){if(e>-1){let o=t.slice(e+1,t.lastIndexOf(")")),s=zc(t);if(s.type!=="collection"&&(n.name+="("+o+")"),i&&r?.[i]){if(s.type==="collection"){let a=`${s.namespaceOrAlias}.${s.name}`,c=kNn(s.type,a);c.name=Cg(c.name,r).qName;let u=LNn(c);n.qName=u}else if(s.type==="action-function"){let a=s.parameters.map(c=>{let u=`${c.namespaceOrAlias}.${c.name}`,l=kNn(c.type,u);return l.name=Cg(l.name,r).qName,LNn(l)});n.qName+="("+a.join(",")+")"}}else if(s.type==="collection"){let a=Cg(o,r).qName;n.qName="Collection("+a+")"}}}function LNn(t){return t?.asCollection?"Collection("+t.name+")":t?.name||""}function kNn(t,e){return{name:e,asCollection:t==="collection"}}function Pg(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 xg(t,e){let r=[];return t?.name&&r.push(t),e?.length&&r.push(...e),r}var oEt="/";function XD(t){return{segments:t.split(oEt).map(r=>{let n=r.indexOf("@");if(n===0){let[o,s]=r.slice(1).split("#");return{...zc(o),type:"term-cast",qualifier:s}}else if(n>0){let[o,s]=r.split("@"),a=zc(o),[c,u]=s.split("#");return{...a,type:"navigation-property-annotation",term:{...zc(c),type:"term-cast",qualifier:u}}}let i=zc(r);if(i.type==="identifier"||i.type==="action-function")return i}).filter(r=>!!r)}}function _H(t,e,r){return r.segments.map(n=>Bca(t,e,n)).join(oEt)}function Bca(t,e,r){let n=r.namespaceOrAlias?t[r.namespaceOrAlias]:e;switch(r.type){case"action-function":{let i=r.parameters.map(o=>ed(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`@${ed(t,e,{...r,type:"identifier"})??""}${r.qualifier?"#"+r.qualifier:""}`;case"navigation-property-annotation":return`${ed(t,e,{type:"identifier",name:r.name,namespaceOrAlias:r.namespaceOrAlias})??""}@${ed(t,e,{...r.term,type:"identifier"})??""}${r.term.qualifier?"#"+r.term.qualifier:""}`;default:return""}}var sEt=class{forCompletion=!1;visit(e,r,n){let i=this[e.type];if(!(e.range&&!Oo(e.range,r))&&i)return i(e,r,n)}[WD]=(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"]);[on]=(e,r,n)=>{let i=Oo(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}};[bNn]=(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};[Lwe]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("alias",e.alias,e.aliasRange,r,n);[xr]=(e,r,n)=>this.visitTextProperty("text",e.text,e.range,r,n);[JC]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("value",e.value,e.valueRange,r,n);[vt]=(e,r,n)=>{if(!e.range)return;let i=this.forCompletion?1:0,o=e.range.start.character+i,s=Ke.create(zt.create(e.range.start.line,o),e.range.end);if(!Oo(s,r))return;let a=Object.keys(e.attributes);if(Oo(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 Oo(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(Oo(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&&Oo(n,i)){let s=jca(r,n,i),a=i.character-n.start.character;return{path:[...o,e,`$${a}`],range:n,...s}}}},HXc=new sEt;function jca(t,e,r){let n=r.character-e.start.character;return{startString:t.slice(0,n),remainingString:t.slice(n,e.end.character)}}var FNn=(t,e)=>(e.content||[]).filter(r=>r.type===vt&&(!t||t(r))),pl=(t,e)=>FNn(r=>r.name===t,e),jv=(t,e)=>t?.attributes?.[e],$o=(t,e)=>jv(t,e)?.value??"";function jL(t,e){return t?.type===vt&&t.name===e}function qca(t){return(t||"").replace(/\s/g,"").length===0}function EH(t){let e=!1,r=null;return(t.content||[]).forEach(n=>{e||(n.type===vt&&n.name!==k.Annotation?e=!0:n.type===xr&&!qca(n.text)&&(r?e=!0:r=n))}),e?null:r}function aEt(t,e,r){let i=(e.startsWith("/")?e.slice(1):e).split("/").map(c=>r?cEt(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,(Gca(l)||Hca(t,u))&&(s=l))}return s??a}function Gca(t){return!!t.isEntityType||!!t.isComplexType||!!t.structuredType}function Hca(t,e){let r=t.getEdmTargetKinds(e),n=new Set([ANn,ONn,CNn,PNn]);return r.findIndex(i=>n.has(i))>=0}function cEt(t,e){let r="",n=e.indexOf("@");if(n>=0){let i=Cg(e.substring(n+1),t.aliasMap).qName;r=e.substring(0,n)+"@"+i}else e.indexOf(".")>-1?r=Cg(e,t.aliasMap).qName:r=e;return r}function wg(t,e,r){let n=XD(r);return _H(t,e,n)}function qL(t,e,r){return r.split(" ").map(n=>wg(t,e,n)).join(" ")}function Vwe(t,e){return e.split(" ").map(r=>hf(r,t)).join(" ")}function pEt(t,e,r){if(!t.references)return[];let n=[],i=Yca(t.references),o=t.uri.startsWith(YD)||!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=wg(d,o,c.name);for(let m=0;m<c.terms.length;m++){let _=c.terms[m],v=VNn(d,c.name,_,r),b=v.qualifier?"#"+v.qualifier:"",S=`${h}@${v.term}${b}`,A=u.get(S);r?.mergeSplitAnnotations&&A?dEt(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 dEt(t,e,r,n,i){Kca(t,e,r,n,i),i.record?n.record?$Nn(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 $Nn(t,e,r,n,i,o){Wca(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}}zca(t,e,r,n,i,c,a,s)}function zca(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"?$Nn(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 Kca(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?dEt(t,u,l,c,a):(t[u]=l,n.annotations.push(a))}}}function Wca(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?dEt(t,p,d,l,u):(t[p]=d,n.annotations.push(u))}}}function Yca(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 VNn(t,e,r,n){let i=$o(r,"Term"),o=zc(i),s=ed(t,"",o),a=$o(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=fEt(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=lEt(t,e,r,n);return l.length&&(u.annotations=l),u}function lEt(t,e,r,n){return(r.content??[]).filter(i=>i.type===vt&&i.name===k.Annotation).map(i=>VNn(t,e,i,n))}var uEt=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 fEt(t,e,r,n){let i=[];uEt.has(r.name)&&i.push(UNn(t,e,r,n));for(let s of Object.keys(r.attributes))if(uEt.has(s)){let a=jv(r,s);a&&i.push(BNn(t,e,a.name,a.value))}let o=(r.content??[]).filter(s=>s.type===vt&&uEt.has(s.name));for(let s of o)i.push(UNn(t,e,s,n));return i[0]}function BNn(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:wg(t,e,n)};case"PropertyPath":return{type:"PropertyPath",PropertyPath:wg(t,e,n)};case"AnnotationPath":return{type:"AnnotationPath",AnnotationPath:wg(t,e,n)};case"NavigationPropertyPath":return{type:"NavigationPropertyPath",NavigationPropertyPath:wg(t,e,n)};case"EnumMember":return{type:"EnumMember",EnumMember:qL(t,e,n)};case"Null":return{type:"Null"};default:return{type:"Unknown"}}}function UNn(t,e,r,n){switch(r.name){case"Collection":{let{collection:i,collectionOrigins:o}=Jca(t,e,r,n),s={type:"Collection",Collection:i};return n?.addOrigins&&(s.collectionOrigins=o),s}case"Record":return{type:"Record",Record:Xca(t,e,r,n)};case"Apply":return Qca(t,e,r);default:{let o=EH(r)?.text??"";return BNn(t,e,r.name,o)}}}function Xca(t,e,r,n){let i=[],o=$o(r,"Type"),s;if(o){let l=zc(o);s=ed(t,"",l)}let c={propertyValues:(r.content||[]).filter(l=>l.type===vt&&l.name===k.PropertyValue).map(l=>{n?.addOrigins&&i.push(l.range);let d={name:$o(l,"Property"),value:fEt(t,e,l,n)||{type:"Unknown"}},h=lEt(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=lEt(t,e,r,n);return u.length&&(c.annotations=u),c}function Jca(t,e,r,n){let i=[],o=[];return(r.content||[]).filter(s=>s.type===vt).forEach(s=>{let a=fEt(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 Qca(t,e,r){let n=structuredClone(r);jNn(t,e,n);let i=$o(r,k.Function);return{type:"Apply",$Apply:n,$Function:i}}function jNn(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=zc(o.value),a=ed(t,"",s);a&&(o.value=a)}else i==="EnumMember"?o.value=qL(t,e,o.value):i.endsWith("Path")&&(o.value=wg(t,e,o.value))}),(n.content||[]).some(i=>i.type===vt)&&(n.content=n.content.filter(i=>!(i.type===xr&&!(i.text||"").trim()))),Zca(t,e,n),n}function Zca(t,e,r){for(let n of r.content||[])if(n.type===vt)jNn(t,e,n);else if(n.type===xr){let i=n.text;r.name==="EnumMember"?n.text=qL(t,e,i):n.type===xr&&r.name.endsWith("Path")&&(n.text=wg(t,e,i))}}var hEt=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(qNn(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:nua(r.structuredType??"")};this.actionImports.push(i)}else{let i=eua(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 eua(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(qNn(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 qNn(t,e){return t.includes("Parameter")&&e.name==="$Return"||t.includes("ReturnType")}var tua={},rua=new Set(["@","/","("]);function nua(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(tua[s]??s),r=n,i=!1}rua.has(o)&&(e.push(t.substring(r,n+1)),r=n+1,i=!0)}return e.push(t.substring(r)),e.join("")}function Bwe(t){return new hEt(t).convert()}var iZ={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 mEt(t){return typeof t=="object"&&t.type!==void 0&&iZ[t.type]!==void 0}function gEt(t,e){let r=iua(jwe(e,t.target));return r.terms=t.annotations.map(n=>QC(n,e)),r}function iua(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function QC(t,e){let r=gt({name:k.Annotation});return r.attributes[k.Term]=wr(k.Term,hf(t.term,e)),t.qualifier&&(r.attributes[k.Qualifier]=wr(k.Qualifier,t.qualifier)),t.collection?(r.content=r.content||[],r.content.push(vH(e,t.collection))):t.record?(r.content=r.content||[],r.content.push(GL(e,t.record))):t.value&&ZC(e,t.value,r),t.annotations?.length&&t.annotations.forEach(n=>{r.content=r.content||[],r.content.push(QC(n,e))}),r}function vH(t,e){let r=gt({name:k.Collection});for(let n of e){let i=GNn(t,n);i&&r.content.push(i)}return r}function GNn(t,e){if(typeof e=="object")return mEt(e)?ZC(t,e):GL(t,e);if(typeof e=="boolean")return gt({name:k.Bool,content:[Kn(e?"true":"false")]});if(typeof e=="string")return gt({name:k.String,content:[Kn(e)]})}function GL(t,e){let r=gt({name:k.Record});return e.type&&(r.attributes[k.Type]=wr(k.Type,hf(e.type,t))),e.propertyValues.forEach(n=>{let i=sZ(t,n);r.content.push(i)}),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(QC(n,t))})),r}function sZ(t,e){let r=gt({name:k.PropertyValue});return r.attributes[k.Property]=wr(k.Property,e.name),ZC(t,e.value,r),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(QC(n,t))})),r}function ZC(t,e,r){let n=iZ[e.type]?e.type:"",i=r??(n?gt({name:n}):void 0);if(i){switch(e.type){case"Collection":{let o=vH(t,e.Collection);return oZ(i,o,r)}case"Record":{let o=GL(t,e.Record);return oZ(i,o,r)}case"Apply":{let o=HNn(t,e.$Apply);return oZ(i,o,r)}case"If":case"And":case"Or":case"Le":case"Lt":case"Ge":case"Gt":case"Eq":case"Ne":case"Not":return oZ(i,gt({name:e.type}),r);case"Null":{let o=gt({name:n});return oZ(i,o,r)}case"Unknown":return;default:{let o=e[e.type],s=HL(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 HNn(t,e){let r=structuredClone(e);return zNn(r,t,!0)}function HL(t,e,r){let n=e===void 0?"":e.toString();return n&&(t===k.EnumMember?Vwe(r,n):t.indexOf("Path")>=0?jwe(r,n):t===k.Type||t===k.Term?hf(n,r):n)}function oZ(t,e,r){return r?(t.content=t.content||[],t.content.push(e)):t=e,t}function zNn(t,e,r){let n=t;return aua(n),oua(n,e,r),sua(n,e,r),n}function oua(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?hf(i.value,e):Cg(i.value,e.aliasMap)?.qName;break;case k.EnumMember:i.value=r?Vwe(e,i.value):qL(e.aliasMap,e.currentFileNamespace,i.value);break;default:n.endsWith("Path")&&(i.value=r?jwe(e,i.value):wg(e.aliasMap,e.currentFileNamespace,i.value));break}})}function sua(t,e,r){for(let n of t.content??[])n.type===vt?zNn(n,e,r):n.type===xr&&t.name===k.EnumMember?n.text=r?Vwe(e,n.text):qL(e.aliasMap,e.currentFileNamespace,n.text):n.type===xr&&t.name.endsWith("Path")&&(n.text=r?jwe(e,n.text):wg(e.aliasMap,e.currentFileNamespace,n.text))}function aua(t){(t.content??[]).some(e=>e.type===vt)&&(t.content=t.content.filter(e=>!(e.type===xr&&!(e.text??"").trim())))}function cua(t,e){let[r,n]=e.split("@");return n?`${r}@${hf(n,t)}`:e.indexOf(".")>-1?hf(e,t):e}function jwe(t,e){return e.split("/").map(r=>cua(t,r)).join("/")}function zL(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=qwe(o,k.Record,0);break;case"propertyValues":s=k.PropertyValue;break;case"collection":case"Collection":c=qwe(o,k.Collection,0),s="";break;case"value":n.push(...uua(o,r));break;case"type":n.push("attributes","Type","value");break;default:if(Number.isNaN(Number(a))){let{subElement:u,clearPath:l,pathSegments:p}=lua(a,o);c.subElement=u,n=l?[]:[...n,...p??[]]}else s!==null&&(c=qwe(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 uua(t,e){if(e===void 0)return[];if(t.attributes[e])return["attributes",e];let r=t.content.findIndex(n=>n.type===vt&&n.name===e);return r!==-1?["content",r.toString()]:[]}function lua(t,e){return iZ[t]?pua(e,t):e.attributes[WNn(t)]?{pathSegments:["attributes",WNn(t),"value"]}:t==="name"?{pathSegments:["attributes",k.Property,"value"]}:{clearPath:!0}}function pua(t,e){if(t?.attributes[e])return{pathSegments:["attributes",e,"value"]};if(t.name===e){let s=KNn(t);return s<0?{clearPath:!0}:{pathSegments:["content",s.toString()]}}let{subElement:r,subElementIndex:n}=qwe(t,e,0);if(n<0)return{clearPath:!0,subElement:r};let i=["content",n.toString()],o=KNn(t.content[n]);return o<0?{clearPath:!0,subElement:r}:(i.push("content",o.toString()),{subElement:r,pathSegments:i})}function KNn(t){return t.content.findIndex(e=>e.type===xr)}function qwe(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===vt&&(!e||s.name===e)&&(i++,i===r&&(n.subElement=s,n.subElementIndex=o))}return n}function WNn(t){let e=t;return t&&(e=t.slice(0,1).toUpperCase()+t.slice(1)),e}var Li;(function(t){t[t.General=1]="General",t[t.CompileError=2]="CompileError",t[t.ComplexityViolation=3]="ComplexityViolation",t[t.LocalAnnotationFileNotFound=4]="LocalAnnotationFileNotFound"})(Li||(Li={}));var Mn=class extends Error{errorCode;messageMap;constructor(e,r,n){super(e),this.messageMap=n??new Map,this.errorCode=r??Li.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 Tks(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=Yyn(r.record,"CollectionPath"),o=Yyn(r.record,"Url");o&&e.push({type:"code-list",serviceRootPath:n,value:o,collectionPath:i??void 0})}}function Yyn(t,e){let r=t.propertyValues.find(n=>n.name===e);if(r?.value?.type==="String")return r.value.String}var Sks=pe(Ho(),1);var bVc=(0,dOe.dirname)((0,e_n.fileURLToPath)(__importMetaUrl));var bk=require("node:path"),cqn=pe(zAe()),uqn=pe(EOn());var vOn={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 TOn=Dn.createInstance(),lCe="odata-dowload-generator";async function omt(){await TOn.init({resources:{en:{[lCe]:vOn}},lng:"en",fallbackLng:"en",defaultNS:lCe,ns:[lCe],missingInterpolationHandler:()=>""})}function Er(t,e){return e?.ns||(e=Object.assign(e??{},{ns:lCe})),TOn.t(t,e)}omt().catch(t=>console.error("Failed to initialize i18n:",t));var hbt=require("@sap-devx/yeoman-ui-types");var smt;(function(t){t.official="officialVersions",t.snapshot="snapshotsVersions",t.support="support"})(smt||(smt={}));var pCe="1.65.0";var dCe=pe(Ho(),1);var vQ=pe(Ho(),1);var nt={maintenance:"Maintenance",outOfMaintenance:"Out of maintenance",skipped:"Skipped"},Yqs=[{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}],amt=Yqs.filter(t=>t.support===nt.maintenance&&(0,vQ.gte)((0,vQ.coerce)(t.version)??"0.0.0",pCe)).map(t=>({version:(0,vQ.coerce)(t.version)?.version??"0.0.0",support:nt.maintenance})),Xqs=[...amt].map(t=>t.version);var cmt=pe(Ho(),1);var Zqs="1.72.0",AOn="1.102.0",eGs="1.136.0",tGs="1.120.0",Tg;(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"})(Tg||(Tg={}));var rGs={[Tg.SAP_BELIZE]:{id:Tg.SAP_BELIZE,label:"Belize",supportUntil:eGs,deprecateSince:tGs},[Tg.SAP_FIORI_3]:{id:Tg.SAP_FIORI_3,label:"Quartz Light"},[Tg.SAP_FIORI_3_DARK]:{id:Tg.SAP_FIORI_3_DARK,label:"Quartz Dark",supportSince:Zqs},[Tg.SAP_HORIZON]:{id:Tg.SAP_HORIZON,label:"Morning Horizon",supportSince:AOn},[Tg.SAP_HORIZON_DARK]:{id:Tg.SAP_HORIZON_DARK,label:"Evening Horizon",supportSince:AOn}};var MOn=pe(POn(),1),umt=pe(Ho(),1);var xOn={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 wOn="inquirer-common",fCe=Dn.createInstance();function hCe(){fCe.addResourceBundle("en",wOn,xOn)}async function oGs(){await fCe.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),fCe.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),hCe()}function Wr(t,e){return e?.ns||(e=Object.assign(e??{},{ns:wOn})),fCe.t(t,e)}oGs().catch(()=>{});var uGs=pe(yCe(),1);function pG(t,e){return t&&e?MOn.default.filter(t,e,{extract:r=>r.name??""}).map(r=>r.original):e}var _Ce=class{message;link;constructor(e){Object.assign(this,e)}toString(){return`${this.message} ${this.link.text}${this.link.url?" : "+this.link.url:""}`}};var TQ=pe(Qte(),1);function lGs(t,e,r){let n=t.additionalMessages;return(i,o)=>{let s={...(0,TQ.default)(o),...(0,TQ.default)(r)},a=e(i,s);return a||(typeof n=="function"?n(i,o):void 0)}}function pGs(t,e,r){let n=t.validate;return(i,o)=>{let s={...(0,TQ.default)(o),...(0,TQ.default)(r)},a=e?.(i,s);return a!==!0?a:typeof n=="function"?n(i,o):!0}}function dGs(t,e,r,n){let i;return r==="validate"&&e.validate&&(i=pGs(t,e.validate,n)),r==="additionalMessages"&&e.additionalMessages&&(i=lGs(t,e.additionalMessages,n)),t=Object.assign(t,{[r]:i}),t}function ll(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 lmt(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=dGs(n,o,a,r));let c=e[i].default;c&&(n.default=c)}}}),t}var pmt="data:image/svg+xml;base64, PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM0NTRfMTc4MDUpIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMSA3LjI0MjIzVjkuNUMxMSA5LjY4OTM5IDEwLjg5MyA5Ljg2MjUyIDEwLjcyMzYgOS45NDcyMUw3LjcyMzYxIDExLjQ0NzJDNy41OTkyNSAxMS41MDk0IDcuNDU0NjIgMTEuNTE3IDcuMzI0NDQgMTEuNDY4MkwzLjQ5MDE4IDEwLjAzMDNMMC42NTgxMTQgMTAuOTc0M0MwLjUwNTY0IDExLjAyNTIgMC4zMzgwMjkgMTAuOTk5NiAwLjIwNzY0NSAxMC45MDU2QzAuMDc3MjYwNiAxMC44MTE2IDAgMTAuNjYwNyAwIDEwLjVWMi41QzAgMi4yODQ3OCAwLjEzNzcxNSAyLjA5MzcyIDAuMzQxODg2IDIuMDI1NjZMMy4zNDE4OSAxLjAyNTY2QzMuNDQ3OTcgMC45OTAyOTYgMy41NjI4NiAwLjk5MTUxNyAzLjY2ODE3IDEuMDI5MTNMNC41NDkyNSAxLjM0MzhDNC4zOTAxOSAxLjYzNDYzIDQuMjYyMyAxLjk0NDk0IDQuMTcwMDkgMi4yNzAyNUw0IDIuMjA5NVY5LjE1MzVMNyAxMC4yNzg1VjcuNzQzOTRDNy4zMTg0MSA3Ljg1NjQ4IDcuNjUzMjcgNy45MzQyMSA4IDcuOTcyNTRWMTAuMTkxTDEwIDkuMTkwOThWNy43NDM5NEMxMC4zNTYgNy42MTgxIDEwLjY5MTUgNy40NDg3MyAxMSA3LjI0MjIzWk0xIDkuODA2MjlWMi44NjAzOEwzIDIuMTkzNzFWOS4xMzk2MkwxIDkuODA2MjlaIiBmaWxsPSIjMzc5NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNSAzLjQ2NjIyQzUgNC4yNTM4IDUuMjYyNjcgNC45ODAwMyA1LjcwNTE4IDUuNTYyMDlMNS4zNzc1OCA3LjQyTDcuMjg0NzEgNi43MjU4NkM3LjY1MzQ1IDYuODU5NTUgOC4wNTEzMiA2LjkzMjQ0IDguNDY2MjIgNi45MzI0NEMxMC4zODA2IDYuOTMyNDQgMTEuOTMyNCA1LjM4MDU2IDExLjkzMjQgMy40NjYyMkMxMS45MzI0IDEuNTUxODggMTAuMzgwNiAwIDguNDY2MjIgMEM2LjU1MTg4IDAgNSAxLjU1MTg4IDUgMy40NjYyMlpNOCAxLjVDOCAxLjIyMzg2IDguMjIzODYgMSA4LjUgMUM4Ljc3NjE0IDEgOSAxLjIyMzg2IDkgMS41QzkgMS43NzYxNCA4Ljc3NjE0IDIgOC41IDJDOC4yMjM4NiAyIDggMS43NzYxNCA4IDEuNVpNOC41IDNDOC4yMjM4NiAzIDggMy4yMjM4NiA4IDMuNVY1LjVDOCA1Ljc3NjE0IDguMjIzODYgNiA4LjUgNkM4Ljc3NjE0IDYgOSA1Ljc3NjE0IDkgNS41VjMuNUM5IDMuMjIzODYgOC43NzYxNCAzIDguNSAzWiIgZmlsbD0iIzM3OTRGRiIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzM0NTRfMTc4MDUiPgo8cmVjdCB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==";var dmt={FIORI_TOOLS:3046},Xp={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 LOn="sap.ux.guidedAnswer.openGuidedAnswer",fGs="https://ga.support.sap.com/dtp/viewer/index.html";function kOn(t,e){let r="";return e.length>0&&(r=`/actions/${e.join(":")}`),`${fGs}#/tree/${t}${r}`}var FOn=pe(dAe(),1);var hmt,fmt;function UOn(){return hmt}function vL(t,e){let r=hGs(t,e);hmt&&hmt.reportEvent(r,uc.NoSampling)}function hGs(t,e){fmt=fmt??(0,FOn.default)();let r=Object.assign(e,{OperatingSystem:fmt,Platform:e.Platform||dy().technical});return{eventName:t,properties:r,measurements:{}}}function ECe(t){return Coe(t)?"AbapODataCatalogDest":OP(t)?"GenericODataFullUrlDest":SE(t)?"GenericODataPartialUrlDest":"Unknown"}var mGs="GA_LINK_CREATED",gGs="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 yGs={[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/]},Co=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)=>Wr("errors.serverReturnedAnError",{errorDesc:r?Wr(r,{errorMsg:t.getMessageFromError(e)}):t.getMessageFromError(e)});static _errorTypeToMsg={[Me.CERT]:e=>Wr("errors.certificateError",{errorMsg:t.getMessageFromError(e)}),[Me.CERT_EXPIRED]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anExpiredCert")}),[Me.CERT_SELF_SIGNED]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.aSelfSignedCert")}),[Me.CERT_UKNOWN_OR_INVALID]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anUnknownOrInvalidCert")}),[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anUntrustedRootCert")}),[Me.INVALID_SSL_CERTIFICATE]:()=>Wr("errors.urlCertValidationError",{certErrorReason:Wr("texts.anUnknownOrInvalidCert")}),[Me.AUTH]:e=>Wr("errors.authenticationFailed",{error:t.getMessageFromError(e)}),[Me.AUTH_TIMEOUT]:()=>Wr("errors.authenticationTimeout"),[Me.TIMEOUT]:e=>Wr("errors.timeout",{errorMsg:t.getMessageFromError(e)}),[Me.INVALID_URL]:()=>Wr("errors.invalidUrl"),[Me.CONNECTION]:e=>Wr("errors.connectionError",{error:t.getMessageFromError(e)}),[Me.UNKNOWN]:e=>Wr("errors.unknownError",{error:t.getMessageFromError(e)}),[Me.SERVICES_UNAVAILABLE]:()=>Wr("errors.servicesUnavailable"),[Me.SERVICE_UNAVAILABLE]:e=>t.serverErrorMessage(e),[Me.CATALOG_SERVICE_NOT_ACTIVE]:()=>Wr("errors.catalogServiceNotActive"),[Me.INTERNAL_SERVER_ERROR]:e=>t.serverErrorMessage(e,"errors.internalServerError"),[Me.NOT_FOUND]:()=>Wr("errors.urlNotFound"),[Me.ODATA_URL_NOT_FOUND]:()=>Wr("errors.odataServiceUrlNotFound"),[Me.BAD_GATEWAY]:e=>t.serverErrorMessage(e,"errors.badGateway"),[Me.DESTINATION_UNAVAILABLE]:()=>Wr("errors.destination.unavailable"),[Me.DESTINATION_NOT_FOUND]:()=>Wr("errors.destination.notFound"),[Me.DESTINATION_MISCONFIGURED]:e=>Wr("errors.destination.misconfigured",{destinationProperty:typeof e=="string"?e:""}),[Me.NO_V2_SERVICES]:()=>Wr("errors.noServicesAvailable",{version:"2"}),[Me.NO_V4_SERVICES]:()=>Wr("errors.noServicesAvailable",{version:"4"}),[Me.DESTINATION_SERVICE_UNAVAILABLE]:()=>Wr("errors.destination.unavailable"),[Me.REDIRECT]:()=>Wr("errors.redirectError"),[Me.NO_SUCH_HOST]:()=>Wr("errors.noSuchHostError"),[Me.NO_ABAP_ENVS]:()=>Wr("errors.abapEnvsUnavailable"),[Me.BAD_REQUEST]:e=>t.serverErrorMessage(e,"errors.badRequest"),[Me.DESTINATION_CONNECTION_ERROR]:()=>Wr("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?Xp.BAS_CATALOG_SERVICES_REQUEST_FAILED:void 0,[Me.CERT]:Xp.CERTIFICATE_ERROR,[Me.CERT_EXPIRED]:Xp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED]:Xp.CERTIFICATE_ERROR,[Me.CERT_UKNOWN_OR_INVALID]:Xp.CERTIFICATE_ERROR,[Me.INVALID_SSL_CERTIFICATE]:Xp.CERTIFICATE_ERROR,[Me.CERT_SELF_SIGNED_CERT_IN_CHAIN]:Xp.CERTIFICATE_ERROR,[Me.DESTINATION_MISCONFIGURED]:Xp.DESTINATION_MISCONFIGURED,[Me.DESTINATION_UNAVAILABLE]:Xp.DESTINATION_UNAVAILABLE,[Me.DESTINATION_NOT_FOUND]:Xp.DESTINATION_NOT_FOUND,[Me.BAD_GATEWAY]:Xp.BAD_GATEWAY,[Me.DESTINATION_SERVICE_UNAVAILABLE]:Xp.DESTINATION_SERVICE_UNAVAILBLE,[Me.NO_V4_SERVICES]:Xp.NO_V4_SERVICES,[Me.GATEWAY_TIMEOUT]:r?Xp.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]:Xp.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 Ec({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=>yGs[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 GHt(r)?e===Me.SERVICE_UNAVAILABLE?qHt(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!==UT.NO_AUTHENTICATION&&(i=this.getErrorMsgFromType(Me.AUTH,Wr("texts.checkDestinationAuthConfig"))):(n=Me.DESTINATION_MISCONFIGURED,i=this.getErrorMsgFromType(n,"HTML5.DynamicDestination")),vL(gGs,{basErrorType:n??e,destODataType:ECe(r),Platform:this._platform??dy().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:Wr("guidedAnswers.validationErrorHelpText"),icon:pmt,url:kOn(dmt.FIORI_TOOLS,[e])}};return this.guidedAnswersEnabled&&(i.link.command={id:LOn,params:{treeId:dmt.FIORI_TOOLS,nodeIdPath:[e],trigger:this.guidedAnswersTrigger}}),vL(mGs,{errorType:r,isGuidedAnswersEnabled:this.guidedAnswersEnabled,nodeIdPath:`${e}`,Platform:this.platform??dy().technical}),new _Ce(i)}};var $On=pe(voe(),1);async function VOn(t){let e=[];try{let r=[$A.ABAP,$A.ABAP_TRIAL,$A.ABAP_CANARY,$A.ABAP_OEM,$A.ABAP_OEM_CANARY,$A.ABAP_HAAS,$A.ABAP_STAGING,$A.ABAP_INTERNAL_STAGING],n=process.env.ABAPEnvServiceTypes?process.env.ABAPEnvServiceTypes.split(",").map(o=>o.trim()):[],i=await(0,$On.apiGetServicesInstancesFilteredByType)([...r,...n]);i.length>0?i.forEach(o=>{e.push({name:o.label,value:o})}):t.logErrorMsgs(Me.NO_ABAP_ENVS,Wr("errors.noAbapEnvsInCFSpace"))}catch{t.logErrorMsgs(Me.NO_ABAP_ENVS,Wr("errors.abapEnvsCFDiscoveryFailed"))}return e.sort((r,n)=>r.name?r.name.localeCompare(n.name??""):0)}var _Gs=pe(kC(),1),EGs=pe(dD(),1);var dva=pe(WDn(),1);var YDn={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 XDn="project-input-validator",E_t=Dn.createInstance();function owe(){E_t.addResourceBundle("en",XDn,YDn)}async function JDn(){await E_t.init({lng:"en",fallbackLng:"en"}),owe()}function IL(t,e){return e?.ns||(e=Object.assign(e??{},{ns:XDn})),E_t.t(t,e)}JDn().catch(()=>{});var taa=pe(eRn(),1);function tRn(t){let e=t?.trim()||"";return e===""||/^\d{3}$/.test(e)?!0:IL("general.invalidClient",{client:t})}var rRn={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 nRn="odata-service-inquirer";var GQ=Dn.createInstance();async function iRn(){await GQ.init({lng:"en",fallbackLng:"en",missingInterpolationHandler:()=>"",interpolation:{escapeValue:!1}}),GQ.services.formatter?.add("odataVersionFormatter",t=>t?` V${t}`:""),GQ.services.formatter?.add("addMsgWithColonFormatter",t=>t?`: ${t}`:""),GQ.addResourceBundle("en",nRn,rRn),hCe(),owe()}function Ze(t,e){return e?.ns||(e=Object.assign(e??{},{ns:nRn})),GQ.t(t,e)}iRn().catch(()=>{});var HQ;(function(t){t.sapSystem="sapSystem",t.capProject="capProject",t.odataServiceUrl="odataServiceUrl",t.none="none",t.metadataFile="metadataFile",t.projectSpecificDestination="projectSpecificDestination",t.businessHub="businessHub"})(HQ||(HQ={}));var swe="sap-client";var ts;(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"})(ts||(ts={}));var ML=pe(gRn(),1),Mt=class t{static _logger=new Ec({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}`),ML.requestLogger(i,{url:!0,data:!0,params:!0,method:!0,headers:!0,logger:n})),i=>ML.errorLogger(i,{logger:n})),e.response.use(i=>ML.responseLogger(i,{data:r,status:!0,headers:!0,logger:n}),i=>ML.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 TRn=pe(kC(),1),SRn=pe(dD(),1),A_t=pe(vRn(),1);function Qp(){return Xt.isYUI?Si()?go.bas:go.vscode:go.cli}function bRn(t){try{let e=(0,TRn.convert)((0,SRn.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?Fs.v4:Fs.v2,convertedMetadata:e}}catch(e){throw Mt.logger.error(e),new Error(Ze("prompts.validationMessages.metadataInvalid"))}}function zC(t){if(t)return t===Fs.v2?xn.v2:xn.v4}function hwe(t){if(t?.length===1)return 0}function KC(t){for(let e in t.services)t.services?.[e].log&&(t.services[e].log=(0,A_t.removeSync)(t.services[e]?.log,{setUndefined:!0}));return t.log&&(t.log=(0,A_t.removeSync)(t.log,{setUndefined:!0})),t}function lH(t,e,r){let n=new rf({url:e,client:r}).getId();return t.find(i=>rf.from(i).getId()===n)}function ARn(t,e){return!t&&!e||t?.length===0&&e?.length===0||t===e?!0:!t||!e?!1:[...t].sort().toString()===[...e].sort().toString()}var Oi=new Co(void 0,void 0,"@sap-ux/odata-service-inquirer");var O_t;(function(t){t.capProjectPath="capProjectPath",t.capCliStateSetter="capCliStateSetter"})(O_t||(O_t={}));function mwe(t,e){try{let{convertedMetadata:r,odataVersion:n}=bRn(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 F_t=require("@sap-devx/yeoman-ui-types");var ORn=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]),F_=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&&Mj(!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(swe)??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,Mj(!1)),this._axiosConfig=e,this._serviceProvider=E3t(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(),Oi.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=$N(e);Mt.attachAxiosLogger(s.interceptors),await s.catalog(o).listServices()}catch(o){let s=Co.getErrorType(o?.response?.status??o?.code);o?.isAxiosError&&ORn.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=DU(i.Name,a),this._destinationUrl=a?this._validatedUrl.replace(`https://${i.Name.toLowerCase()}.dest`,i.Host.replace(/\/{1,10}$/,"")):i.Host,this._serviceProvider=v3t({},i)}else e&&(await this.shouldIgnoreCertError(e,o)&&(this._ignoreCertError=!0,e.ignoreCertErrors=!0,Mj(!1)),this._axiosConfig=e,this._serviceProvider=$N(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?Co.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,Mj(!1),this._axiosConfig={...this._axiosConfig,ignoreCertErrors:!0},this._serviceProvider=$N(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 AVe({environment:UN.EmbeddedSteampunk,url:e.origin,logger:Mt.logger});if(this.systemAuthType==="serviceKey"&&r)return AVe({environment:UN.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),Oi.getErrorMsg(n)??!1}}async validateDestination(e,r,n){try{if(this.systemAuthType=e.Authentication===UT.NO_AUTHENTICATION?"basic":"unknown",OP(e)||SE(e))return await this.validateOdataServiceDestination(e,n);{let i;if(n){let o=DU(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=Oi.logErrorMsgs(i);return{valResult:Oi.getValidationErrorHelp(i,!1,e)??o,errorType:Oi.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}}async validateOdataServiceDestination(e,r,n){this.resetConnectionState(!0);let i=DU(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=Oi.logErrorMsgs(o);return{valResult:Oi.getValidationErrorHelp(o,!1,e)??a,errorType:Oi.getCurrentErrorType()??Me.DESTINATION_CONNECTION_ERROR}}return this.validity.authRequired?{valResult:Co.getErrorMsgFromType(Me.AUTH,e.Authentication!==UT.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(),Co.getErrorType(u)===Me.CONNECTION?(this.validity.reachable=!1,Oi.logErrorMsgs(Ze("errors.systemOrServiceUrlNotFound",{url:e}))):Oi.getErrorMsg(u)??u.message}}getValidationResultFromStatusCode(e){return e===200?(this.validity.reachable=!0,this.validity.authenticated=!0,!0):Co.getErrorType(e)===Me.NOT_FOUND?(this.validity.reachable=!1,Co.getErrorMsgFromType(Me.NOT_FOUND)??!1):Co.isCertError(e)?(this.validity.reachable=!0,this.validity.canSkipCertError=ORn.has(Co.getErrorType(e)),this.validity.authenticated=!1,Oi.getValidationErrorHelp(e,!1)??!1):Co.getErrorType(e)===Me.AUTH?(this.validity.reachable=!0,this.validity.authRequired=!0,this.validity.authenticated=!1,!0):Co.getErrorType(e)===Me.REDIRECT?(this.validity.reachable=!0,Ze("errors.urlRedirect")):Co.getErrorType(e)===Me.CONNECTION?(this.validity.reachable=!1,Co.getErrorMsgFromType(Me.CONNECTION,Ze("texts.httpStatus",{httpStatus:e}))??!1):Co.getErrorType(e)===Me.BAD_REQUEST?(this.validity.reachable=!0,Co.getErrorMsgFromType(Me.BAD_REQUEST,Ze("texts.httpStatus",{httpStatus:e}))??!1):Co.getErrorType(e)===Me.BAD_GATEWAY?(this.validity.reachable=!1,Co.getErrorMsgFromType(Me.BAD_GATEWAY,Ze("texts.httpStatus",{httpStatus:e}))??!1):(this.validity.reachable=!0,Co.getErrorMsgFromType(Co.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(swe,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:Oi.getValidationErrorHelp(u,!1,this.destination)??Oi.getErrorMsg(u)??Ze("errors.unknownError"),errorType:Oi.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 BRn=pe(voe(),1);var qD={newSystemType:"newSystemType",newSystemUrl:"newSystemUrl",newSystemAuthType:"newSystemAuthType"};var Laa="VALUE_HELP_DOWNLOAD_PROMPTED",kaa="VALUE_HELP_DOWNLOAD_SUCCESS",Faa="VALUE_HELP_DOWNLOAD_FAILED";async function C_t(t,e,r){let n=eL.createTelemetryData(e)??{};if(r&&Object.keys(r).length>0){let i=UOn();i&&await i.reportEvent({eventName:t,properties:n,measurements:r},uc.NoSampling)}else vL(t,n)}async function CRn(t,e,r){if(delete Xt.odataService.valueListMetadata,await C_t(Laa,{userChoseToDownload:t}),t&&e.serviceProvider instanceof Bf){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 C_t(kaa,{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 C_t(Faa,{userChoseToDownload:!0,error:i instanceof Error?i.message:"Unknown error"},{downloadTimeMs:o})}}}function PRn(t,e,r){let n=`${e?e+":":""}`,i=`${n}${ts.valueHelpDownload}`,o=`${n}${ts.serviceSelection}`,s=`${n}cliValueHelpDownload`,a,u=[{when:l=>{let d=l?.[o]?.servicePath;return d&&r?.convertedMetadata?(a=GJ(d,r?.convertedMetadata),a.length>0):!1},name:i,type:"confirm",message:Ze("prompts.valueHelpDownload.message"),validate:async l=>(Qp()!==go.cli&&await CRn(l,t,a),!0)}];return Qp()===go.cli&&u.push({when:async l=>{let p=l?.[i];return p!==void 0&&a&&await CRn(p,t,a),!1},name:s,type:"input"}),u}var GD=require("@sap-devx/yeoman-ui-types");var $aa=pe(kC(),1),Vaa=pe(dD(),1);function xRn(t){return t.filter(e=>!!e.entityType.entityProperties.find(n=>n.name==="HasDraftEntity"))}var wRn=pe(kC(),1),DRn=pe(dD(),1);function Baa(t){return!!t.find(r=>r.annotations?.Common?.DraftRoot?!!r.annotations.Common.DraftRoot.ShareAction:!1)}function P_t(t){let e=!1;try{let r;typeof t=="string"?r=(0,wRn.convert)((0,DRn.parse)(t)):r=t;let n=xRn(r.entitySets)??[];n?.length>0&&(e=!Baa(n))}catch(r){Mt.logger.error(Ze("errors.unparseableMetadata",{error:r.message}))}return e}var jaa=["/IWBEP/COMMON"],qaa="SERVICE_INQUIRER_BAS_SUCCESS",Gaa=t=>{let e=[],r=!1;return typeof Mt.logger.getLogLevel=="function"&&(r=Mt.logger.getLogLevel()==="trace"),t?.filter(n=>!jaa.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 Haa(t,e){let r=Object.entries(t);r.forEach(([n,i])=>{Oi.logErrorMsgs(i,Ze("warnings.missingServices",{odataVersion:n}))}),e===r.length&&Oi.logErrorMsgs(Ze("errors.allCatalogServiceRequestsFailed",{version:Object.keys(t).join(", ")}))}async function RRn(t,e){let r={},n={},i=[];for(let s of t){let a=s instanceof pP?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)&&Haa(r,t.length),e&&(o=o.filter(s=>e.includes(s.id)||e.includes(s.path))),Gaa(o)}function x_t(t){let e=eL.createTelemetryData({destODataType:ECe(t)})??{};vL(qaa,e)}async function zaa(t,e,r,n,i){let o=[];try{let s=await e.metadata(),{validationMsg:a,version:c,convertedMetadata:u}=mwe(s,i);if(a)return{validationMsg:a};if(!r&&c===Fs.v2&&n)try{Mt.logger.debug("Creating a catalog service object for v2 service path to request annotations."),r=$N(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=Oi.getErrorMsg(s);return Mt.logger.error(Ze("errors.serviceMetadataErrorLog",{servicePath:t,errorText:a})),{validationMsg:Ze("errors.serviceMetadataErrorUI",{servicePath:t,errorText:a})}}}async function Kaa(t,e,r){let n;if(e===v4.NotDetermined)try{n=await r.getServiceType(t)??v4.NotDetermined}catch(i){Mt.logger.error(Ze("errors.serviceTypeRequestError",{error:i.message}))}return n??e}async function w_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 zaa(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?Fs.v2:Fs.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 NRn(t){let e=Ze("prompts.systemService.message");return t&&(e=e.concat(` ${Ze("texts.forUserName",{username:t})}`)),e}async function IRn(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:GD.Severity.warning}:n?{message:Ze("warnings.noServicesAvailableForOdataVersion",{odataVersion:n}),severity:GD.Severity.warning}:{message:Ze("warnings.noServicesAvailable"),severity:GD.Severity.warning};if(e){let a=e.serviceType;if(e.serviceODataVersion===xn.v2){if(!i)return{message:Ze("warnings.noAnnotations"),severity:GD.Severity.warning};a=await Kaa(e.servicePath,e.serviceType,r.catalogs[xn.v2])}else if(o?.showCollabDraftWarning&&e.serviceODataVersion===xn.v4&&P_t(o.edmx))return{message:Ze("warnings.collaborativeDraftMessage"),severity:GD.Severity.warning};if(a&&a!==v4.UI)return{message:Ze("warnings.nonUIServiceTypeWarningMessage",{serviceType:"A2X"}),severity:GD.Severity.warning}}else if(Oi.getErrorMsg())return{message:`${Oi.getErrorMsg()} ${Ze("texts.seeLogForDetails")}`,severity:GD.Severity.information}}var Waa="cliServiceSelection";function HD(t,e,r,n=!0){let i=[],o,s,a,c,u,l={convertedMetadata:void 0},p=r?.requiredOdataVersion,d=`${e}:${ts.serviceSelection}`,h={when:()=>t.validity.authenticated||t.validity.authRequired===!1,name:d,type:r?.useAutoComplete?"autocomplete":"list",message:()=>NRn(t.connectedUserName),guiOptions:{breadcrumb:Ze("prompts.systemService.breadcrumb"),mandatory:!0,applyDefaultWhenDirty:!0},showOutputTabLink:"validationMessageOverflow",source:(m,_)=>pG(_,i),choices:async m=>{if(i.length===0||o!==t.validatedUrl||s!==t.validatedClient||!ARn(c,r?.serviceFilter))if(t.catalogs[Fs.v2]||t.catalogs[Fs.v4])i=await Yaa(t.catalogs,p,r?.serviceFilter),o=t.validatedUrl,s=t.validatedClient,c=r?.serviceFilter?[...r.serviceFilter]:void 0,m?.[`${ts.systemSelection}`]?.type==="destination"&&x_t(m?.[`${ts.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?.[`${ts.systemSelection}`]?.type==="destination"&&x_t(m?.[`${ts.systemSelection}`]?.system)}else Mt.logger.error(Ze("errors.noCatalogOrServiceAvailable"));return i},additionalMessages:m=>IRn(i,m,t,{requiredOdataVersion:p,hasAnnotations:u,showCollabDraftWarnOptions:l.convertedMetadata?{showCollabDraftWarning:!!r?.showCollaborativeDraftWarning,edmx:l.convertedMetadata}:void 0,serviceFilter:r?.serviceFilter}),default:()=>hwe(i),validate:async m=>{let _=m;if(r?.useAutoComplete&&m.value&&(_=m.value),!t.validatedUrl)return!1;if(i.length===0&&Oi.hasError())return Co.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 w_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=lmt([h],m,Xt.odataService)[0]}let f=[h];return Qp()===go.cli&&!r?.useAutoComplete&&f.push({when:async m=>{let _=m?.[`${e}:${ts.serviceSelection}`];if(_&&t.validatedUrl){let{validationResult:v,hasAnnotations:b,convertedMetadata:S}=await w_t(_,t);if(typeof v=="string")throw Mt.logger.error(v),new Error(v);u=b,l.convertedMetadata=S}if(i.length===0&&Oi.hasError()){let v=Co.getHelpForError(Me.SERVICES_UNAVAILABLE).toString();throw new Error(v)}return!1},name:`${e}:${Waa}`}),n||f.push(...ll(PRn(t,e,l),m=>t.serviceProvider instanceof Bf&&!!l.convertedMetadata&&m?.[d]?.serviceODataVersion===xn.v4)),f}async function Yaa(t,e,r){let n=[];return e&&t[e]?n.push(t[e]):n=Object.values(t).filter(i=>i!==void 0),await RRn(n,r)}var kRn=require("@sap-devx/yeoman-ui-types");var D_t=require("@sap-devx/yeoman-ui-types");var bg;(function(t){t.systemUsername="systemUsername",t.systemPassword="systemPassword",t.storeSystemCredentials="storeSystemCredentials"})(bg||(bg={}));function gwe(t,e,r,n){let i=`${e?e+":":""}${bg.systemUsername}`,o=`${e?e+":":""}${bg.systemPassword}`,s=`${e?e+":":""}${bg.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?.[ts.systemSelection],h,f=!0;if(d?.type==="backendSystem")h=d.system?.client;else if(d?.type==="destination"){let _=d.system;(OP(_)||SE(_))&&(f=!1)}let{valResult:m}=await t.validateAuth(t.validatedUrl,p?.[i],l,{sapClient:r?.sapClient||h,isSystem:f,odataVersion:zC(n)});return m===!0&&t.serviceProvider?(Xaa(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:D_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:D_t.Severity.warning}}};return Si()||c.push(u),c}function Xaa(t,e,{username:r,password:n}){if(Xt.odataService.connectedSystem={serviceProvider:KC(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 WQ(t){return t?await ept(t)?Ze("prompts.systemName.systemNameExistsWarning"):!0:Ze("prompts.systemName.emptySystemNameWarning")}function MRn(t,e){try{return new URL(e,t),!0}catch{return Ze("errors.invalidUrl",{input:`${t}${e}`})}}async function LRn(t,e){let r=t+(e?Ze("texts.suggestedSystemNameClient",{client:e}):"");return await WQ(r)===!0?r:Jaa(r)}async function Jaa(t){let e=1,r=`${t} (${e})`;for(;await WQ(r)!==!0;)r=`${t} (${e})`,e++;return r}function Qaa(t){switch(t){case"serviceKey":return WX.ReentranceTicket;case"reentranceTicket":return WX.ReentranceTicket;case"basic":return WX.Basic;default:return}}function ywe(t,e,r,n,i=!0){return{type:"input",name:`${e?e+":":""}${qD.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=lH(Xt.backendSystemsCache,a);if(u)return Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:u.name})}let c=await t.validateUrl(a,{isSystem:!0,odataVersion:zC(r),forceReValidation:!0});return c===!0&&(t.validity.authenticated&&t.serviceProvider?Xt.odataService.connectedSystem={serviceProvider:KC(t.serviceProvider)}:t.systemAuthType="basic"),c},additionalMessages:()=>{if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:kRn.Severity.warning}}}}function _we(t,e){let r,n=!1,i=`${e?e+":":""}`,o=`${i}${ts.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 LRn(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 WQ(a));let l=!!c?.[`${i}${bg.storeSystemCredentials}`];if(u===!0&&t.validatedUrl&&Xt.odataService.connectedSystem){let p=new fa({authenticationType:Qaa(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:YX({serviceKeys:t.serviceInfo,authenticationType:t.systemAuthType}),connectionType:"abap_catalog"});Xt.odataService.connectedSystem.backendSystem=p,Xt.odataService.connectedSystem.backendSystem.newOrUpdated=!0}return u}}}async function R_t(){return await AC({entityName:"system"})}async function FRn(t=!1,e){let r=[];try{r=await(await R_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 N_t="!@\xA3*&937newSystem*X~qy^",Ewe="cfAbapEnvService";async function URn(t,e,r,n,i){Xt.resetConnectedSystem();let o=!1,a=await(await R_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:zC(r),systemAuthType:"reentranceTicket",connectType:i?"odata_path":"abap_catalog"});else if(a.serviceKeys)o=await e.validateServiceInfo(a.serviceKeys,zC(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:zC(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:KC(e.serviceProvider),backendSystem:a})}return o}async function YQ(t,e,r,n){Xt.resetConnectedSystem();let{valResult:i,errorType:o}=await e.validateDestination(t,zC(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:KC(e.serviceProvider),destination:t}),i)}function Zaa(t,e){return!e||e.odata_abap&&Coe(t)||e.odata_generic&&Ooe(t)||e.full_service_url&&OP(t)||e.partial_service_url&&SE(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 $Rn(t,e=!1,r=!1,n){let i=[],o;if(Si()){let s={};try{s=await yVe({stripS4HCApiHosts:!0})}catch(a){Mt.logger.error(Ze("errors.destination.listDestinations",{error:a.message}))}i=Object.values(s).filter(a=>Zaa(a,t)).map(a=>({name:HHt(a),value:{type:"destination",system:a}})),e&&(o={name:Ze("prompts.newSystemType.choiceCFAbapEnvServiceOnBtp"),value:{type:Ewe,system:Ewe}})}else{let s=await FRn(!1,n);Xt.backendSystemsCache=s,i=s.map(a=>({name:U3t(a),value:{system:a,type:"backendSystem"}})),r||(o={name:Ze("prompts.systemSelection.newSystemChoiceLabel"),value:{type:"newSystemChoice",system:N_t}})}return i.sort(({name:s},{name:a})=>s.localeCompare(a,void 0,{numeric:!0,caseFirst:"lower"})),o&&i.unshift(o),i}function I_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===N_t;if(o==="cfAbapEnvService")return r===Ewe}):-1}var vwe="abapOnBtp",bYc=`${vwe}:${qD.newSystemUrl}`,eca="cliCfAbapService",M_t={abapOnBtpAuthType:"abapOnBtpAuthType",cloudFoundryAbapSystem:"cloudFoundryAbapSystem"};function jRn(t,e){Xt.reset();let r=new F_,n=[];return n.push({type:"list",name:M_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(ll([ywe(r,vwe,t?.serviceSelection?.requiredOdataVersion,e)],i=>i?.abapOnBtpAuthType==="reentranceTicket"?(r.systemAuthType=i.abapOnBtpAuthType,!0):!1)[0],...ll([...L_t(r,void 0,void 0,e)],i=>i?.abapOnBtpAuthType==="cloudFoundry")),t?.userSystemName?.hide!==!0&&n.push(ll([_we(r,vwe)],()=>!!r.validatedUrl&&r.validity.reachable===!0&&(r.validity.authenticated??r.validity.authRequired!==!0))[0]),n.push(...HD(r,vwe,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}async function VRn(t,e,r,n=!1,i){Xt.resetConnectedSystem();let o=t.label,s=await(0,BRn.apiGetInstanceCredentials)(o);if(!s?.credentials?.uaa)return Ze("errors.cfInstanceCredentialsNotReturned",{serviceInstanceName:o});let a=!0,c;if(Qp()===go.bas)try{c=await YHt(o,{uaaCredentials:s.credentials.uaa,hostUrl:s.credentials.url},Mt.logger),a=await YQ(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(Oi.getErrorMsg()??Ze("errors.abapServiceAuthenticationFailed")),new Error(Ze("errors.abapServiceAuthenticationFailed"));return e.serviceProvider&&Qp()!==go.bas&&(e.connectedSystemName=await _Ve(o),Xt.odataService.connectedSystem={serviceProvider:KC(e.serviceProvider)}),!0}function L_t(t,e,r,n){let i=[],s=[{type:"list",name:`${e?e+":":""}${M_t.cloudFoundryAbapSystem}`,guiOptions:{breadcrumb:!0,applyDefaultWhenDirty:!0},choices:async()=>{if(i=await VOn(Oi),i.length===0&&Qp()===go.cli)throw new Error(Ze("errors.abapEnvsUnavailable"));return i},default:()=>hwe(i),message:Ze("prompts.cloudFoundryAbapSystem.message"),validate:async a=>{if(a){let u=await VRn(a,t,r,Qp()===go.cli,n);if(!Si()&&u===!0&&t.validatedUrl){let l=lH(Xt.backendSystemsCache,t.validatedUrl,t.validatedClient);if(l)return t.resetConnectionState(!0),Ze("prompts.validationMessages.backendSystemExistsWarning",{backendName:l.name})}return u}if(Oi.getCurrentErrorType()===Me.NO_ABAP_ENVS){let u=Oi.getErrorMsg(!0),l=Ze("texts.seeLogForDetails");return`${u} ${l}`}return!1}}];return Qp()===go.cli&&s.push({when:async a=>{let c=a?.[M_t.cloudFoundryAbapSystem];return c&&await VRn(c,t,r,!0),!1},name:eca}),s}function qRn(t){let e="cfAbapBas",r=new F_;return[...L_t(r,e,t?.serviceSelection?.requiredOdataVersion),...HD(r,e,t?.serviceSelection,t?.valueHelpDownload?.hide)]}var LL="abapOnPrem",k_t=`${LL}:${qD.newSystemUrl}`,UYc=`${LL}:${bg.systemUsername}`,$Yc=`${LL}:${bg.systemPassword}`,tca={sapClient:"sapClient"};function GRn(t){Xt.reset();let e=new F_,r=t?.serviceSelection?.requiredOdataVersion,n=rca(t?.userSystemName,e,r);return n.push(...HD(e,LL,t?.serviceSelection,t?.valueHelpDownload?.hide)),n}function rca(t,e,r){let n=e??new F_,i={sapClient:void 0,isValid:!0},o=[ywe(n,LL,r,void 0,!1),{type:"input",name:tca.sapClient,message:Ze("prompts.sapClient.message"),guiOptions:{breadcrumb:Ze("prompts.sapClient.breadcrumb")},validate:(s,a)=>{let c=tRn(s);if(c===!0){if(i.sapClient=s,i.isValid=!0,a?.[k_t]){let u=lH(Xt.backendSystemsCache,a[k_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}},...gwe(n,LL,i,r)];return t?.hide!==!0&&o.push(ll([_we(n,LL)],s=>!!s?.[k_t]&&n.validity.reachable===!0&&(n.validity.authenticated||n.validity.authRequired===!1))[0]),o}function HRn(t,e){let r=[{type:"list",name:qD.newSystemType,choices:[{name:Ze("prompts.newSystemType.choiceAbapOnBtp"),value:"abapOnBtp"},{name:Ze("prompts.newSystemType.choiceAbapOnPrem"),value:"abapOnPrem"}],message:Ze("prompts.newSystemType.message")}];return r.push(...ll(GRn(t),n=>n.newSystemType==="abapOnPrem")),r.push(...ll(jRn(t,e),n=>n.newSystemType==="abapOnBtp")),r}var Twe="systemSelection",c9c=`${Twe}:${bg.systemUsername}`,u9c=`${Twe}:${bg.systemPassword}`,zRn={systemSelectionCli:"systemSelectionCli",destinationServicePath:"destinationServicePath"};async function KRn(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=rf.from(t.system);o=await URn(s,e,r,n,i)}else if(t.type==="destination"){if(SE(t.system))return!0;o=await YQ(t.system,e,r,i)}return o}async function U_t(t,e){Xt.reset();let r=new F_,n=await nca(r,t,e);return t?.serviceSelection?.hide||n.push(...ll(HD(r,Twe,t?.serviceSelection,t?.valueHelpDownload?.hide),i=>i.systemSelection?.type!=="newSystemChoice")),Si()?n.push(...ll(qRn(t),i=>i.systemSelection?.type==="cfAbapEnvService")):n.push(...ll(HRn(t,e),i=>i.systemSelection?.type==="newSystemChoice")),n}async function nca(t,e,r){let n=e?.serviceSelection?.requiredOdataVersion,i=e?.systemSelection?.destinationFilters,o=await $Rn(i,e?.systemSelection?.includeCloudFoundryAbapEnvChoice,e?.systemSelection?.hideNewSystem,e?.systemSelection?.backendSystemFilter),s=I_t(o,e?.systemSelection?.defaultChoice),a=e?.systemSelection?.connectPath,c=e?.systemSelection?.onlyShowDefaultChoice&&e?.systemSelection?.defaultChoice,u=[{type:e?.systemSelection?.useAutoComplete?"autocomplete":"list",name:ts.systemSelection,message:Ze("prompts.systemSelection.message"),guiOptions:{breadcrumb:!0,hint:Ze("prompts.systemSelection.hint")},source:(l,p)=>pG(p,o),choices:c?[o[s]]:o,default:()=>c?0:(s=I_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),KRn(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:F_t.Severity.information};if(t.ignoreCertError)return{message:Ze("warnings.certErrorIgnoredByNodeSetting"),severity:F_t.Severity.warning}}}];if(Si()){let l={when:p=>{let d=p?.[ts.systemSelection];return d?.type==="destination"?SE(d.system):!1},type:"input",name:zRn.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?.[ts.systemSelection]?.system,f=MRn(h.Host,p);return f!==!0?(t.resetConnectionState(!0),f):await YQ(h,t,n,p)}};u.push(l)}return Qp()===go.cli&&!e?.systemSelection?.useAutoComplete&&u.push({when:async l=>{let p=l?.[ts.systemSelection];if(!p)return!1;let d=await KRn(p,t,n,void 0,a?.value);if(d!==!0)throw Mt.logger.error(d.toString),new Error(d.toString());return!1},name:`${zRn.systemSelectionCli}`}),u.push(...gwe(t,Twe,void 0,n)),u}var ica=require("@sap-devx/yeoman-ui-types");var $_t;(function(t){t.ignoreCertError="ignoreCertError",t.username="username",t.cliIgnoreCertValidate="cliIgnoreCertValidate"})($_t||($_t={}));var pva=require("@sap-devx/yeoman-ui-types");var dca=pe(Ma(),1),fca=pe(ua(),1),hca=pe(sl(),1);var cNn=pe(Ma(),1),uNn=pe(ua(),1),lNn=pe(Ho(),1);var rNn=pe(require("node:os"),1),nNn=require("node:path"),iNn=pe(Ho(),1);var Swe=require("node:path"),WRn=require("node:url"),oca=(0,Swe.dirname)((0,WRn.fileURLToPath)(__importMetaUrl));function $s(t=""){return(0,Swe.join)(oca,"../templates",t)}var pH=require("node:path");var YRn=" ",XQ=" ",JQ={"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 sca(t,e,r=[]){if(!r.includes(t)&&HX(t,e))return t;for(let i=1;i<1e3;i++){let o=`${t}${i}`;if(!r.includes(o)&&HX(o,e))return o}throw new Error(`Failed to generate unique ID for base '${t}' after 1000 attempts`)}async function V_t(t,e){let r=await Gw(".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 U_(t={}){let{basePath:e,fsEditor:r,fileContentCache:n=[]}=t,i=o=>(s,a=[])=>sca(s,o,a);return n.length>0?i(n):r&&e?V_t(e,r).then(o=>{let s=o.map(a=>r.read(a).toString());return i(s)}):i([])}var aca={noGlob:!0};function cca(t){let e,r=t.startsWith(XQ)?XQ:YRn;for(let n=0;n<t.length;n++)if(t[n]!==r){e={size:n,useTabSymbol:r===XQ};break}return e}function B_t(t){let e,r=new Set([YRn,XQ]),i=t.split(/\r\n|\n/).find(o=>r.has(o[0]));return i&&(e=cca(i)),e}function bwe(t,e,r){if(!r){let i=t.read(e);r=B_t(i)}let n;return r&&(r.useTabSymbol?n=XQ.repeat(r.size||1):n=r.size),n}function WC(t,e){let{filepath:r,content:n,replacer:i}=e,o=bwe(t,r,e.tabInfo);t.extendJSON(r,JSON.parse(n),i,o)}function $_(t,e,r,n,i){let o=Awe(e),s=JQ[o];if(i&&s?.getData){let a=s.getData(i,n);n={...n,...a}}t.copyTpl(e,r,n,void 0,aca)}function Awe(t){let e=(0,pH.normalize)(t),r=`${pH.sep}templates${pH.sep}`,n=e.indexOf(r);return n===-1?t:e.substring(n+r.length).split(pH.sep).join("/")}var oNn=pe(JF(),1);var Cwe=pe(JF(),1),JRn=pe(BF(),1);var V_={Full:"full",Basic:"basic"};var kL="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 Ub="absolute",QQ="relative",Owe=["breadcrumbs","navigationActions","titleContent","actions","headerContent","items","footer"],XRn="This is a sample template, event handlers should be added for implementation",j_t="sap.fe.macros";var ZQ={"":"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 $v(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 q_t=t=>{let e=[];for(let r of t.split("/"))e.push(r===""||r.includes(":")?r:`*[local-name()='${r}']`);return e.join("/")};function uca(t,e,r,n){if(t.localName!=="Page"||t.namespaceURI!==j_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]=q_t(c)}}function QRn(t,e){let r={},n;try{let i=e.read(t),o=new Cwe.DOMParser($v()).parseFromString(i,"text/xml"),s=[{parentNode:"",node:o.firstChild}],a=Ag(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===j_t),c||(r[`${u}/${l.nodeName}`]=q_t(`${u}/${l.nodeName}`)),uca(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: ${ZRn(i)}`)}return{inputChoices:r,pageMacroDefinition:n}}function ZRn(t){return t instanceof Error?t.message:String(t)}async function eNn(t,e){let r=[],n="macros:FilterBar",i=e.read(t),o=new Cwe.DOMParser($v()).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 tNn(t,e,r){let n=new Set;try{let i=r.read(t),o=new Cwe.DOMParser($v()).parseFromString(i,"text/xml"),s=o.firstChild?._nsMap||{},c=JRn.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: ${ZRn(i)}`)}return n}function lca(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 Ag(t,e="sap.fe.macros",r="macros"){let n=t.documentElement,i=lca(n,e);return i!==null?i:(n.setAttributeNS("http://www.w3.org/2000/xmlns/",r===""?"xmlns":`xmlns:${r}`,e),r)}function G_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 sNn(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]=G_t(t,n[r.line],r.character),n.join(rNn.default.EOL)}async function dH(t,e){return(0,nNn.join)(await vu(t,e),"manifest.json")}async function Zp(t,e,r=!0){let n=await dH(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 aNn(t,e,r){let n=t.read(e).toString(),i=new oNn.DOMParser($v(void 0,()=>{})).parseFromString(n,"text/xml");return i.documentElement?!i.getElementById(r):!0}function Pwe(t,e){let r=t["sap.ui5"]?.dependencies?.libs;return e.length?e.some(n=>r?.[n]!==void 0):!0}async function Og(t,e,r=["sap.fe.templates"]){e||(e=(0,uNn.create)((0,cNn.create)()));let n=await dH(t,e);if(e.exists(n)){let i=e.readJSON(n);if(!Pwe(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 eZ(t){return t instanceof Error?t.message:String(t)}var fH;(function(t){t.ListReport="ListReport",t.ObjectPage="ObjectPage",t.CustomPage="CustomPage"})(fH||(fH={}));var xwe=require("node:path");function Vv(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,xwe.join)((0,xwe.dirname)(e),t.folder),t}function H_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 hH(t,e,r,n=!1,i=!1){return H_t(t,e,r,n,i).content}var pNn=pe(Ho(),1);var gEa=pe(Ma(),1),yEa=pe(ua(),1),_Ea=pe(sl(),1);var XSt=pe(Ho(),1);var eEt=pe(Ma(),1),tEt=pe(ua(),1),rEt=pe(sl(),1),gH=pe(Ho(),1),YC=require("node:path"),UL=pe(JF(),1),nEt=pe(zAe(),1),vNn=pe(BF(),1);var rs;(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"})(rs||(rs={}));var tZ;(function(t){t.JSON="json",t.CDS="cds",t.XML="xml",t.JS="javascript",t.TS="typescript",t.ABAPCDS="abapCds"})(tZ||(tZ={}));var mca={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."}},dNn=mca;var gca="fe-fpm-writer",Mi={buildingBlock:`${gca}-building-block`},fNn=Dn.createInstance();async function wwe(){await fNn.init({resources:{en:{[Mi.buildingBlock]:dNn}},lng:"en",fallbackLng:"en",defaultNS:Mi.buildingBlock,ns:[Mi.buildingBlock]})}function xo(t,e){return(r,n)=>fNn.t(`${t}:${e??""}${r}`,n)}var Dwe=require("node:path"),K_t=pe(BF(),1);var hNn=require("node:path");var yca={name:"event",jsName:"oEvent",description:"the event object provided by the event provider.",importType:"UI5Event",importSource:"sap/ui/base/Event"};function _ca(t,e){let r;return e&&t.endsWith(".controller")?r=t.replace(".controller",""):r=t,r}function Bv(t,e,r,n,i=[yca]){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=_ca(p,l)));let h=s?"ts":"js",f=(0,hNn.join)(e.path||"",`${p}${o?".controller":""}.${h}`);if(!t.exists(f))$_(t,$s(`${a}.${h}`),f,{eventHandlerFnName:c,parameters:i,...e});else if(u){let _=t.read(f);typeof u.position=="object"?_=sNn(u.fragment,_,u.position):_=G_t(u.fragment,_,u.position),t.write(f,_)}let m=`${e.ns}.${d}.${c}`;return l?`${l}.${m}`:`${m}`}var W_t=[{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"}],mNn={[pr.CustomColumn]:{aggregationConfig:{aggregationName:"columns",elementName:"Column"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Eca},[pr.CustomFilterField]:{aggregationConfig:{aggregationName:"filterFields",elementName:"FilterField"},templateFile:"filter/fragment.xml",namespace:{uri:"sap.fe.macros.filterBar",prefix:"macros"},processor:vca},[pr.CustomFormField]:{aggregationConfig:{aggregationName:"fields",elementName:"FormElement"},templateFile:"common/Fragment.xml",namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:Tca},[pr.RichTextEditorButtonGroups]:{aggregationConfig:{aggregationName:"buttonGroups",elementName:"ButtonGroup"},namespace:{uri:"sap.fe.macros",prefix:"macros"},processor:Oca},[pr.Action]:{aggregationConfig:{aggregationName:"actions",elementName:"Action"},namespace:{uri:"sap.fe.macros.table",prefix:"macrosTable"},processor:Cca}};function Rwe(t){let e=mNn[t];if(!e)throw new Error(`No configuration found for building block type: ${t}`);return e}function B_(t,e){return t.buildingBlockType===e}function Eca(t,e){let{fs:r,viewPath:n}=e;if(!B_(t,pr.CustomColumn))throw new Error("Expected CustomColumn building block data");let i=Rwe(pr.CustomColumn),o=t.embededFragment,s;o.eventHandler&&(s=Bv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content=hH("Sample Text",t.generateId,s),n&&!r.exists(n)&&r.copyTpl($s(i.templateFile),n,o)}function vca(t,e){let{fs:r,viewPath:n,embeddedFragment:i}=e;if(!B_(t,pr.CustomFilterField))throw new Error("Expected CustomFilterField building block data");if(!i)throw new Error("EmbeddedFragment is required for CustomFilterField");let o=Rwe(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=Bv(r,s,s.eventHandler,{controllerSuffix:!1,typescript:t.embededFragment?.typescript,templatePath:"filter/Controller"}));let a=o.templateFile,c=JQ[a];if(c?.getData){let u=c.getData(t.generateId);s={...s,...u}}n&&!r.exists(n)&&r.copyTpl($s(o.templateFile),n,s)}function Tca(t,e){let{fs:r,viewPath:n}=e;if(!B_(t,pr.CustomFormField))throw new Error("Expected CustomFormField building block data");if(!t.embededFragment)throw new Error("EmbeddedFragment is required for CustomFormField");let i=Rwe(pr.CustomFormField),o=t.embededFragment,s;o.eventHandler&&(s=Bv(r,o,o.eventHandler,{controllerSuffix:!1,typescript:o.typescript}),o.eventHandler=s),o.content??=hH("Custom Form Field Content",t.generateId,s),n&&!r.exists(n)&&r.copyTpl($s(i.templateFile),n,o)}function Sca(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 bca(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 Aca(t,e){let r=bca(t);return e.buttonGroups?.map(n=>{let i=W_t.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 Oca(t,e){let{xmlDocument:r,updatedAggregationPath:n,hasAggregation:i}=e;if(!B_(t,pr.RichTextEditorButtonGroups)&&!B_(t,pr.RichTextEditor))throw new Error("Expected RichTextEditorButtonGroups or RichTextEditor building block data");let o=new Map;if(i&&r&&n){let a=K_t.useNamespaces(r.documentElement?._nsMap??{})(n,r);if(a.length>0){let c=a[0],u=Rwe(pr.RichTextEditorButtonGroups);Array.from(c.childNodes).filter(d=>d.nodeType===1&&d.localName===u.aggregationConfig.elementName).forEach(d=>{let h=Sca(d);h&&o.set(h.name,h)});let p=a[0];p.parentNode?.removeChild(p)}}t.buttonGroups=Aca(o,t)}function mH(t){return t.replace(/\/([A-Za-z_][A-Za-z0-9_.-]*)(?=\/|$)/g,(e,r)=>r.includes(":")?`/${r}`:`/*[local-name()='${r}']`)}function z_t(t,e,r,n){let i=t.documentElement?._nsMap??{},o=K_t.useNamespaces(i),s=mH(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+`/${Ag(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 Cca(t,e){let{fs:r}=e;if(!B_(t,pr.Action))throw new Error("Expected Action building block data");let n=t.embeddedAction;if(typeof n.eventHandler=="object"){let i=Bv(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=Dwe.posix.join(a??"",n.eventHandler.fileName)}n.eventHandler={fnName:`handler.${o}`,fileName:s}}}}function gNn(t,e,r,n,i,o){let s=i,a=!1,c="macrosTable",u,l,p=mNn[t.buildingBlockType];if(!p)return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c};if(B_(t,pr.RichTextEditorButtonGroups)||B_(t,pr.RichTextEditor)){let d=z_t(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=Ag(e,p.namespace.uri,p.namespace.prefix)}if((B_(t,pr.CustomColumn)||B_(t,pr.CustomFilterField)||B_(t,pr.CustomFormField))&&t.embededFragment){u=Vv(t.embededFragment,r,n),l=(0,Dwe.join)(u.path,`${u.fragmentFile??u.name}.fragment.xml`);let d={fs:o,viewPath:l,embeddedFragment:u};p.processor(t,d);let h=z_t(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName});s=h.updatedAggregationPath,a=h.hasElement,c=Ag(e,p.namespace.uri,p.namespace.prefix)}if(B_(t,pr.Action)&&t.embeddedAction){let d=z_t(e,i,{aggregationName:p.aggregationConfig.aggregationName,elementName:p.aggregationConfig.elementName}),h={fs:o,xmlDocument:e,updatedAggregationPath:d.updatedAggregationPath,hasAggregation:d.hasElement,embeddedAction:Vv(t.embeddedAction,r,n)};p.processor(t,h),s=d.updatedAggregationPath,a=d.hasElement,Ag(e,p.namespace.uri,p.namespace.prefix)}return{updatedAggregationPath:s,processedBuildingBlockData:t,hasAggregation:a,aggregationNamespace:c}}var Pca=pe(Ma(),1),xca=pe(ua(),1),yNn=pe(sl(),1),_Nn=require("node:path"),Nwe=pe(JF(),1);var Y_t=pe(BF(),1),Iwe=pe(Ho(),1);function Mwe(t,e,r){let n;try{n=r.read((0,_Nn.join)(t,e))}catch(o){throw new Error(`Unable to read xml view file. Details: ${eZ(o)}`)}let i;try{i=new Nwe.DOMParser($v()).parseFromString(n,"text/xml")}catch(o){throw new Error(`Unable to parse xml view file. Details: ${eZ(o)}`)}return i}function X_t(t){if(t.buildingBlockType===pr.Page)return t.templateType===V_.Full?Owe:void 0}function J_t(t){let e=t?(0,Iwe.coerce)(dg(t)):void 0;if(e&&(0,Iwe.lt)(e,kL)){let r=xo(Mi.buildingBlock,"pageBuildingBlock.");throw new Error(`${r("fullTemplateMinUi5VersionRequirement",{minUI5Version:e.version})}`)}}function wca(t){let e=Ag(t,"sap.fe.macros","macros");return e===""?(t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:macros","sap.fe.macros"),"macros"):e}var Dca={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 Rca(t,e,r=[]){let n=Dca[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 Nca(t,e,r,n,i){let o=$s(`/building-block/page/${e}.xml`),s=(0,yNn.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 Nwe.DOMParser($v(ZQ,(u,l)=>{throw new Error(`Unable to parse page aggregation fragment '${e}'. Details: [${u}] - ${l}`)})).parseFromString(c,"text/xml")}function Q_t(t,e,r,n,i=Owe,o=!0){let s=wca(e),a=`${s}:`,c=r.documentElement;c.appendChild(r.createComment(XRn));for(let u of i){let l=n(u),p=u==="items"&&o,d=Rca(u,n),f=Nca(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 ENn(t,e){let r=t.documentElement?._nsMap??{};if(Y_t.useNamespaces(r)(mH(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;Ag(t,u,a)===""&&a&&t.documentElement.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${a}`,u);let d=Y_t.useNamespaces({...r,[a]:u})(mH(e.slice(0,i)),t);d.length!==0&&d[0].appendChild(t.createElementNS(u,`${a}:${c}`))}var FL={id:"REPLACE_WITH_BUILDING_BLOCK_ID",entitySet:"REPLACE_WITH_ENTITY",qualifier:"REPLACE_WITH_A_QUALIFIER"};function Z_t(t){return t.buildingBlockType===pr.Page&&t.templateType===V_.Full}async function $b(t,e,r){let{viewOrFragmentPath:n,aggregationPath:i,buildingBlockData:o,allowAutoAddDependencyLib:s=!0}=e;r??=(0,tEt.create)((0,eEt.create)()),await Og(t,r,[]);let a=e.buildingBlockData.generateId??await U_({basePath:t,fsEditor:r});if(!r.exists((0,YC.join)(t,n)))throw new Error(`Invalid view path ${n}.`);let{path:c,content:u}=await Zp(t,r),l=Mwe(t,n,r);i&&ENn(l,i);let{updatedAggregationPath:p,processedBuildingBlockData:d,hasAggregation:h,aggregationNamespace:f}=gNn({...o,generateId:a},l,c,u,i,r),m={hasAggregation:h,aggregationNamespace:f},_=kca({...d,generateId:a},l,r,u,m),v=Z_t(o),b=X_t(o);if(v&&J_t(u),b&&Q_t(r,l,_,a,b,v),o.buildingBlockType===pr.RichTextEditor||o.buildingBlockType===pr.RichTextEditorButtonGroups){let S=u?(0,gH.coerce)(dg(u)):void 0;if(S&&(0,gH.lt)(S,"1.117.0")){let A=xo(Mi.buildingBlock,"richTextEditorBuildingBlock.");throw new Error(`${A("minUi5VersionRequirement",{minUI5Version:S})}`)}Ag(l,"sap.fe.macros.richtexteditor","richtexteditor")}if(r=Fca(t,n,p,l,_,r,e.replace),s&&u&&!Pwe(u,["sap.fe.macros"])){let S=await dH(t,r),A=await SNn(r),C=r.read(S),D=B_t(C);WC(r,{filepath:S,content:A,tabInfo:D})}return r}function Mca(t,e){return t?{metaPath:e?`/${FL.qualifier}`:"",contextPath:e?FL.entitySet:""}:{metaPath:e?`/${FL.entitySet}/${FL.qualifier}`:""}}function Lca(t,e,r,n){if(!e)return Mca(t,r);let{bindingContextType:i=Ub,alwaysAbsolutePath:o=!0}=e,{entitySet:s,qualifier:a}=e;s=s||(r?FL.entitySet:"");let c=a||(r?FL.qualifier:"");if(t){let u=c.split("/");return a=u.pop(),{metaPath:a,contextPath:u.length?`/${s}/${u.join("/")}`:`/${s}`}}return n?{metaPath:`${i===Ub?"/":""}${s}/${n}`}:{metaPath:i===Ub||o?`/${s}/${c}`:c}}function TNn(t,e,r,n,i,o){let s=t.buildingBlockType,a=$s(`/building-block/${s}/View.xml`);if(typeof t.metaPath=="object"||t.metaPath===void 0){let p=r?(0,gH.coerce)(dg(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,gH.lt)(p,"1.97.0")),f=Lca(h,t.metaPath,i,d);t={...t,metaPath:f.metaPath},!t.contextPath&&f.contextPath&&(t.contextPath=f.contextPath)}t.id||(t.id=FL.id);let c=Awe(a),u=JQ[c],l={macrosNamespace:e?Ag(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,rEt.render)(n.read(a),l,{})}async function SNn(t,e="sap.fe.macros"){let r=$s("/building-block/common/manifest.json");return(0,rEt.render)(t.read(r),{libraries:{[e]:{}}})}function kca(t,e,r,n,i){let o=TNn(t,e,n,r,void 0,i),s;try{s=new UL.DOMParser($v(ZQ)).parseFromString(o,"text/xml")}catch(a){throw new Error(`Unable to parse template file with building block data. Details: ${eZ(a)}`)}return s}function Fca(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=vNn.useNamespaces(c),l=mH(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 UL.XMLSerializer().serializeToString(n);o.write((0,YC.join)(t,e),(0,nEt.default)(f))}else throw new Error(`Aggregation control not found ${r}.`);return o}function Uca(t,e){return e?{fileName:(0,YC.parse)(e).base,relativePath:e,fullPath:(0,YC.join)(t,e)}:{}}async function XC(t,e,r){let n={},{buildingBlockData:i,viewOrFragmentPath:o,allowAutoAddDependencyLib:s=!0}=e;if(!i?.buildingBlockType)return{};r=r??(0,tEt.create)((0,eEt.create)());let a=o?Mwe(t,o,r):void 0,{content:c,path:u}=await Zp(t,r,!1),l=i.generateId??await U_({basePath:t,fsEditor:r}),p=TNn({...i,generateId:l},a,c,r,!0),d=p,h=X_t(i);if(h){Z_t(i)&&J_t(c);let m=a??new UL.DOMParser().parseFromString('<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:macros="sap.fe.macros" xmlns="sap.m"/>',"text/xml"),_=Ag(m,"sap.fe.macros","macros")||"macros",v=`${p}`.replace(new RegExp(`^<(${_}:Page)`),`<$1 xmlns:${_}="sap.fe.macros"`),b=new UL.DOMParser($v(ZQ,(A,C)=>{throw new Error(`Unable to parse Page building block snippet. Details: [${A}] - ${C}`)})).parseFromString(v,"text/xml");Q_t(r,m,b,l,h,Z_t(i));let S=b.documentElement;d=S?(0,nEt.default)(new UL.XMLSerializer().serializeToString(S)):p}let f=Uca(t,o);if(n.viewOrFragmentPath={content:d,language:tZ.XML,filePathProps:f},s){let m=await SNn(r);n.manifest={content:m,language:tZ.JSON,filePathProps:{fileName:(0,YC.parse)(u).base,relativePath:(0,YC.relative)(t,u),fullPath:u}}}return n}function zD(t){return["CAPJava","CAPNodejs"].includes(t.projectType)}var d3=require("node:path");var r$n=pe(kC(),1);var JUn=pe(Ma(),1),QUn=pe(ua(),1);var JC="attribute",xr="text",rZ;(function(t){t.StripIndentation="StripIndentation",t.KeepIndentation="KeepIndentation"})(rZ||(rZ={}));var vt="element",$L="Edmx",KD="Edm",Lwe="reference",bNn="namespace",on="target",WD="annotation-file";function wr(t,e,r,n){let i={type:JC,name:t,value:e};return r&&(i.nameRange=r),n&&(i.valueRange=n),i}function Kn(t,e,r,n){let i={type:xr,text:t};return e&&(i.range=e),r&&(i.fragmentRanges=r),n&&(i.multilineType=n),i}function gt({name:t,range:e,nameRange:r,attributes:n,content:i,contentRange:o,namespace:s,namespaceAlias:a}){let c={type:vt,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 YD="!";function kwe(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function iEt(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 nZ="TypeDefinition",VL="EnumType",j_="ComplexType",ff="Term";var ANn="Action",ONn="Function";var Fwe="Property";var CNn="ActionImport",PNn="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 xNn;(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"})(xNn||(xNn={}));var wo;(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"})(wo||(wo={}));var BL;(function(t){t.DataServices="DataServices",t.Edmx="Edmx",t.Include="Include",t.IncludeAnnotations="IncludeAnnotations",t.Reference="Reference"})(BL||(BL={}));var wNn;(function(t){t.Uri="Uri"})(wNn||(wNn={}));var DNn;(function(t){t.Alias="Alias",t.Namespace="Namespace"})(DNn||(DNn={}));var lXc=new Set([BL.DataServices,BL.Edmx,BL.Include,BL.IncludeAnnotations,BL.Reference]);var Hc={printWidth:300,tabWidth:4,useTabs:!1,useSnippetSyntax:!0};var RNn="missing-required-property";var Uwe="common-case-issue",NNn="no-odata-path-separator";var INn="deprecated-$value-syntax";var yH="Collection(";function zc(t){if(t.startsWith(yH))return MNn(t);let e=t.indexOf("(")+1;if(e>0){let r=t.slice(0,e-1),n=t.slice(e,-1),i=$we(r),o=n.length>0?n.split(",").map(s=>s.startsWith(yH)?MNn(s):$we(s)):[];return{...i,type:"action-function",parameters:o}}return $we(t)}function MNn(t){let e=t.endsWith(")")?-1:void 0;return{...$we(t.slice(yH.length,e)),type:"collection"}}function $we(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 ed(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=>ed(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 Cg(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}=zc(i);$ca(t,s,e,r,o),Vca(t,n,e,r,s)}return r}function hf(t,e){let r=Cg(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=>hf(u,e)),i=s+"("+c.join(",")+")"}return i}function $ca(t,e,r,n,i){t.startsWith(yH)||(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 Vca(t,e,r,n,i){if(e>-1){let o=t.slice(e+1,t.lastIndexOf(")")),s=zc(t);if(s.type!=="collection"&&(n.name+="("+o+")"),i&&r?.[i]){if(s.type==="collection"){let a=`${s.namespaceOrAlias}.${s.name}`,c=kNn(s.type,a);c.name=Cg(c.name,r).qName;let u=LNn(c);n.qName=u}else if(s.type==="action-function"){let a=s.parameters.map(c=>{let u=`${c.namespaceOrAlias}.${c.name}`,l=kNn(c.type,u);return l.name=Cg(l.name,r).qName,LNn(l)});n.qName+="("+a.join(",")+")"}}else if(s.type==="collection"){let a=Cg(o,r).qName;n.qName="Collection("+a+")"}}}function LNn(t){return t?.asCollection?"Collection("+t.name+")":t?.name||""}function kNn(t,e){return{name:e,asCollection:t==="collection"}}function Pg(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 xg(t,e){let r=[];return t?.name&&r.push(t),e?.length&&r.push(...e),r}var oEt="/";function XD(t){return{segments:t.split(oEt).map(r=>{let n=r.indexOf("@");if(n===0){let[o,s]=r.slice(1).split("#");return{...zc(o),type:"term-cast",qualifier:s}}else if(n>0){let[o,s]=r.split("@"),a=zc(o),[c,u]=s.split("#");return{...a,type:"navigation-property-annotation",term:{...zc(c),type:"term-cast",qualifier:u}}}let i=zc(r);if(i.type==="identifier"||i.type==="action-function")return i}).filter(r=>!!r)}}function _H(t,e,r){return r.segments.map(n=>Bca(t,e,n)).join(oEt)}function Bca(t,e,r){let n=r.namespaceOrAlias?t[r.namespaceOrAlias]:e;switch(r.type){case"action-function":{let i=r.parameters.map(o=>ed(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`@${ed(t,e,{...r,type:"identifier"})??""}${r.qualifier?"#"+r.qualifier:""}`;case"navigation-property-annotation":return`${ed(t,e,{type:"identifier",name:r.name,namespaceOrAlias:r.namespaceOrAlias})??""}@${ed(t,e,{...r.term,type:"identifier"})??""}${r.term.qualifier?"#"+r.term.qualifier:""}`;default:return""}}var sEt=class{forCompletion=!1;visit(e,r,n){let i=this[e.type];if(!(e.range&&!Oo(e.range,r))&&i)return i(e,r,n)}[WD]=(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"]);[on]=(e,r,n)=>{let i=Oo(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}};[bNn]=(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};[Lwe]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("alias",e.alias,e.aliasRange,r,n);[xr]=(e,r,n)=>this.visitTextProperty("text",e.text,e.range,r,n);[JC]=(e,r,n)=>this.visitTextProperty("name",e.name,e.nameRange,r,n)??this.visitTextProperty("value",e.value,e.valueRange,r,n);[vt]=(e,r,n)=>{if(!e.range)return;let i=this.forCompletion?1:0,o=e.range.start.character+i,s=Ke.create(zt.create(e.range.start.line,o),e.range.end);if(!Oo(s,r))return;let a=Object.keys(e.attributes);if(Oo(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 Oo(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(Oo(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&&Oo(n,i)){let s=jca(r,n,i),a=i.character-n.start.character;return{path:[...o,e,`$${a}`],range:n,...s}}}},HXc=new sEt;function jca(t,e,r){let n=r.character-e.start.character;return{startString:t.slice(0,n),remainingString:t.slice(n,e.end.character)}}var FNn=(t,e)=>(e.content||[]).filter(r=>r.type===vt&&(!t||t(r))),pl=(t,e)=>FNn(r=>r.name===t,e),jv=(t,e)=>t?.attributes?.[e],$o=(t,e)=>jv(t,e)?.value??"";function jL(t,e){return t?.type===vt&&t.name===e}function qca(t){return(t||"").replace(/\s/g,"").length===0}function EH(t){let e=!1,r=null;return(t.content||[]).forEach(n=>{e||(n.type===vt&&n.name!==k.Annotation?e=!0:n.type===xr&&!qca(n.text)&&(r?e=!0:r=n))}),e?null:r}function aEt(t,e,r){let i=(e.startsWith("/")?e.slice(1):e).split("/").map(c=>r?cEt(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,(Gca(l)||Hca(t,u))&&(s=l))}return s??a}function Gca(t){return!!t.isEntityType||!!t.isComplexType||!!t.structuredType}function Hca(t,e){let r=t.getEdmTargetKinds(e),n=new Set([ANn,ONn,CNn,PNn]);return r.findIndex(i=>n.has(i))>=0}function cEt(t,e){let r="",n=e.indexOf("@");if(n>=0){let i=Cg(e.substring(n+1),t.aliasMap).qName;r=e.substring(0,n)+"@"+i}else e.indexOf(".")>-1?r=Cg(e,t.aliasMap).qName:r=e;return r}function wg(t,e,r){let n=XD(r);return _H(t,e,n)}function qL(t,e,r){return r.split(" ").map(n=>wg(t,e,n)).join(" ")}function Vwe(t,e){return e.split(" ").map(r=>hf(r,t)).join(" ")}function pEt(t,e,r){if(!t.references)return[];let n=[],i=Yca(t.references),o=t.uri.startsWith(YD)||!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=wg(d,o,c.name);for(let m=0;m<c.terms.length;m++){let _=c.terms[m],v=VNn(d,c.name,_,r),b=v.qualifier?"#"+v.qualifier:"",S=`${h}@${v.term}${b}`,A=u.get(S);r?.mergeSplitAnnotations&&A?dEt(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 dEt(t,e,r,n,i){Kca(t,e,r,n,i),i.record?n.record?$Nn(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 $Nn(t,e,r,n,i,o){Wca(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}}zca(t,e,r,n,i,c,a,s)}function zca(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"?$Nn(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 Kca(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?dEt(t,u,l,c,a):(t[u]=l,n.annotations.push(a))}}}function Wca(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?dEt(t,p,d,l,u):(t[p]=d,n.annotations.push(u))}}}function Yca(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 VNn(t,e,r,n){let i=$o(r,"Term"),o=zc(i),s=ed(t,"",o),a=$o(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=fEt(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=lEt(t,e,r,n);return l.length&&(u.annotations=l),u}function lEt(t,e,r,n){return(r.content??[]).filter(i=>i.type===vt&&i.name===k.Annotation).map(i=>VNn(t,e,i,n))}var uEt=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 fEt(t,e,r,n){let i=[];uEt.has(r.name)&&i.push(UNn(t,e,r,n));for(let s of Object.keys(r.attributes))if(uEt.has(s)){let a=jv(r,s);a&&i.push(BNn(t,e,a.name,a.value))}let o=(r.content??[]).filter(s=>s.type===vt&&uEt.has(s.name));for(let s of o)i.push(UNn(t,e,s,n));return i[0]}function BNn(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:wg(t,e,n)};case"PropertyPath":return{type:"PropertyPath",PropertyPath:wg(t,e,n)};case"AnnotationPath":return{type:"AnnotationPath",AnnotationPath:wg(t,e,n)};case"NavigationPropertyPath":return{type:"NavigationPropertyPath",NavigationPropertyPath:wg(t,e,n)};case"EnumMember":return{type:"EnumMember",EnumMember:qL(t,e,n)};case"Null":return{type:"Null"};default:return{type:"Unknown"}}}function UNn(t,e,r,n){switch(r.name){case"Collection":{let{collection:i,collectionOrigins:o}=Jca(t,e,r,n),s={type:"Collection",Collection:i};return n?.addOrigins&&(s.collectionOrigins=o),s}case"Record":return{type:"Record",Record:Xca(t,e,r,n)};case"Apply":return Qca(t,e,r);default:{let o=EH(r)?.text??"";return BNn(t,e,r.name,o)}}}function Xca(t,e,r,n){let i=[],o=$o(r,"Type"),s;if(o){let l=zc(o);s=ed(t,"",l)}let c={propertyValues:(r.content||[]).filter(l=>l.type===vt&&l.name===k.PropertyValue).map(l=>{n?.addOrigins&&i.push(l.range);let d={name:$o(l,"Property"),value:fEt(t,e,l,n)||{type:"Unknown"}},h=lEt(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=lEt(t,e,r,n);return u.length&&(c.annotations=u),c}function Jca(t,e,r,n){let i=[],o=[];return(r.content||[]).filter(s=>s.type===vt).forEach(s=>{let a=fEt(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 Qca(t,e,r){let n=structuredClone(r);jNn(t,e,n);let i=$o(r,k.Function);return{type:"Apply",$Apply:n,$Function:i}}function jNn(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=zc(o.value),a=ed(t,"",s);a&&(o.value=a)}else i==="EnumMember"?o.value=qL(t,e,o.value):i.endsWith("Path")&&(o.value=wg(t,e,o.value))}),(n.content||[]).some(i=>i.type===vt)&&(n.content=n.content.filter(i=>!(i.type===xr&&!(i.text||"").trim()))),Zca(t,e,n),n}function Zca(t,e,r){for(let n of r.content||[])if(n.type===vt)jNn(t,e,n);else if(n.type===xr){let i=n.text;r.name==="EnumMember"?n.text=qL(t,e,i):n.type===xr&&r.name.endsWith("Path")&&(n.text=wg(t,e,i))}}var hEt=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(qNn(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:nua(r.structuredType??"")};this.actionImports.push(i)}else{let i=eua(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 eua(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(qNn(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 qNn(t,e){return t.includes("Parameter")&&e.name==="$Return"||t.includes("ReturnType")}var tua={},rua=new Set(["@","/","("]);function nua(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(tua[s]??s),r=n,i=!1}rua.has(o)&&(e.push(t.substring(r,n+1)),r=n+1,i=!0)}return e.push(t.substring(r)),e.join("")}function Bwe(t){return new hEt(t).convert()}var iZ={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 mEt(t){return typeof t=="object"&&t.type!==void 0&&iZ[t.type]!==void 0}function gEt(t,e){let r=iua(jwe(e,t.target));return r.terms=t.annotations.map(n=>QC(n,e)),r}function iua(t){return{type:"target",name:t,terms:[],range:void 0,nameRange:void 0,termsRange:void 0}}function QC(t,e){let r=gt({name:k.Annotation});return r.attributes[k.Term]=wr(k.Term,hf(t.term,e)),t.qualifier&&(r.attributes[k.Qualifier]=wr(k.Qualifier,t.qualifier)),t.collection?(r.content=r.content||[],r.content.push(vH(e,t.collection))):t.record?(r.content=r.content||[],r.content.push(GL(e,t.record))):t.value&&ZC(e,t.value,r),t.annotations?.length&&t.annotations.forEach(n=>{r.content=r.content||[],r.content.push(QC(n,e))}),r}function vH(t,e){let r=gt({name:k.Collection});for(let n of e){let i=GNn(t,n);i&&r.content.push(i)}return r}function GNn(t,e){if(typeof e=="object")return mEt(e)?ZC(t,e):GL(t,e);if(typeof e=="boolean")return gt({name:k.Bool,content:[Kn(e?"true":"false")]});if(typeof e=="string")return gt({name:k.String,content:[Kn(e)]})}function GL(t,e){let r=gt({name:k.Record});return e.type&&(r.attributes[k.Type]=wr(k.Type,hf(e.type,t))),e.propertyValues.forEach(n=>{let i=sZ(t,n);r.content.push(i)}),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(QC(n,t))})),r}function sZ(t,e){let r=gt({name:k.PropertyValue});return r.attributes[k.Property]=wr(k.Property,e.name),ZC(t,e.value,r),e.annotations?.length&&(r.content=r.content||[],e.annotations.forEach(n=>{r.content.push(QC(n,t))})),r}function ZC(t,e,r){let n=iZ[e.type]?e.type:"",i=r??(n?gt({name:n}):void 0);if(i){switch(e.type){case"Collection":{let o=vH(t,e.Collection);return oZ(i,o,r)}case"Record":{let o=GL(t,e.Record);return oZ(i,o,r)}case"Apply":{let o=HNn(t,e.$Apply);return oZ(i,o,r)}case"If":case"And":case"Or":case"Le":case"Lt":case"Ge":case"Gt":case"Eq":case"Ne":case"Not":return oZ(i,gt({name:e.type}),r);case"Null":{let o=gt({name:n});return oZ(i,o,r)}case"Unknown":return;default:{let o=e[e.type],s=HL(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 HNn(t,e){let r=structuredClone(e);return zNn(r,t,!0)}function HL(t,e,r){let n=e===void 0?"":e.toString();return n&&(t===k.EnumMember?Vwe(r,n):t.indexOf("Path")>=0?jwe(r,n):t===k.Type||t===k.Term?hf(n,r):n)}function oZ(t,e,r){return r?(t.content=t.content||[],t.content.push(e)):t=e,t}function zNn(t,e,r){let n=t;return aua(n),oua(n,e,r),sua(n,e,r),n}function oua(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?hf(i.value,e):Cg(i.value,e.aliasMap)?.qName;break;case k.EnumMember:i.value=r?Vwe(e,i.value):qL(e.aliasMap,e.currentFileNamespace,i.value);break;default:n.endsWith("Path")&&(i.value=r?jwe(e,i.value):wg(e.aliasMap,e.currentFileNamespace,i.value));break}})}function sua(t,e,r){for(let n of t.content??[])n.type===vt?zNn(n,e,r):n.type===xr&&t.name===k.EnumMember?n.text=r?Vwe(e,n.text):qL(e.aliasMap,e.currentFileNamespace,n.text):n.type===xr&&t.name.endsWith("Path")&&(n.text=r?jwe(e,n.text):wg(e.aliasMap,e.currentFileNamespace,n.text))}function aua(t){(t.content??[]).some(e=>e.type===vt)&&(t.content=t.content.filter(e=>!(e.type===xr&&!(e.text??"").trim())))}function cua(t,e){let[r,n]=e.split("@");return n?`${r}@${hf(n,t)}`:e.indexOf(".")>-1?hf(e,t):e}function jwe(t,e){return e.split("/").map(r=>cua(t,r)).join("/")}function zL(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=qwe(o,k.Record,0);break;case"propertyValues":s=k.PropertyValue;break;case"collection":case"Collection":c=qwe(o,k.Collection,0),s="";break;case"value":n.push(...uua(o,r));break;case"type":n.push("attributes","Type","value");break;default:if(Number.isNaN(Number(a))){let{subElement:u,clearPath:l,pathSegments:p}=lua(a,o);c.subElement=u,n=l?[]:[...n,...p??[]]}else s!==null&&(c=qwe(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 uua(t,e){if(e===void 0)return[];if(t.attributes[e])return["attributes",e];let r=t.content.findIndex(n=>n.type===vt&&n.name===e);return r!==-1?["content",r.toString()]:[]}function lua(t,e){return iZ[t]?pua(e,t):e.attributes[WNn(t)]?{pathSegments:["attributes",WNn(t),"value"]}:t==="name"?{pathSegments:["attributes",k.Property,"value"]}:{clearPath:!0}}function pua(t,e){if(t?.attributes[e])return{pathSegments:["attributes",e,"value"]};if(t.name===e){let s=KNn(t);return s<0?{clearPath:!0}:{pathSegments:["content",s.toString()]}}let{subElement:r,subElementIndex:n}=qwe(t,e,0);if(n<0)return{clearPath:!0,subElement:r};let i=["content",n.toString()],o=KNn(t.content[n]);return o<0?{clearPath:!0,subElement:r}:(i.push("content",o.toString()),{subElement:r,pathSegments:i})}function KNn(t){return t.content.findIndex(e=>e.type===xr)}function qwe(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===vt&&(!e||s.name===e)&&(i++,i===r&&(n.subElement=s,n.subElementIndex=o))}return n}function WNn(t){let e=t;return t&&(e=t.slice(0,1).toUpperCase()+t.slice(1)),e}var Li;(function(t){t[t.General=1]="General",t[t.CompileError=2]="CompileError",t[t.ComplexityViolation=3]="ComplexityViolation",t[t.LocalAnnotationFileNotFound=4]="LocalAnnotationFileNotFound"})(Li||(Li={}));var Mn=class extends Error{errorCode;messageMap;constructor(e,r,n){super(e),this.messageMap=n??new Map,this.errorCode=r??Li.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 XNn=require("node:fs"),JNn=require("node:url"),YNn=process.platform==="win32"?XNn.realpathSync.native("\\")[0]:"";function e0(t){let e=(0,JNn.fileURLToPath)(t);return process.platform==="win32"?dua(e.charAt(0))+e.slice(1):e}function dua(t){return YNn===YNn.toUpperCase()?t.toUpperCase():t.toLowerCase()}var KL=[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 Uh(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 yEt(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]=fua(i,e,s)}return n.join(`
|
|
@@ -3082,7 +3082,7 @@ ${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 Vjn=require("node:fs/promises"),Bjn=require("node:path");var wjn=require("node:crypto"),Djn=pe(dAe());var xjn={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.48",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 Bva="@sap-ux/odata-download-sub-generator",jva="0a65e45d-6bf4-421d-b845-61e888c50e9e",_f=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(e){this._sessionId=(0,wjn.randomUUID)(),yn.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:Bva,version:xjn.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:jva,...e};try{await nJ(r)}catch(n){yn.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e){if(!this._telemetryData){let r=Er("telemetry.unknownOs");try{r=(0,Djn.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 yg.getTelemetryClient().reportEvent(i,uc.NoSampling)}};var qva=["eq","ne","gt","ge","lt","le"],Mjn=["and","or","not"],Gva=["any","all"],Hva=["startswith","endswith","contains","matchespattern"],zva=["expand","levels","select","skip","top","count","orderby","filter"],Rjn=/\((.*)\)/,Njn=/(?!indexof)\((\w+)\)/;function Kva(t,e){if(e){let r=t==="",n=Njn.test(t),i=Rjn.test(t);return r?e:n?Ijn(t,e,Njn):i?Ijn(t,e,Rjn):`${e}/${t}`}return t}function Ljn(t){return Mjn.indexOf(t)!==-1}function pbt(t){return`not (${t.join(" and ")})`}function Ijn(t,e,r){return t.replace(r,(n,i)=>i.trim()===""?`(${e})`:`(${e}/${i.trim()})`)}function lbt(t,e,r=[]){return`${t} eq ${iA(e,r)}`}function Wva({key:t,value:e,aliases:r,propPrefix:n}){let i=[],o=t,s=Ljn(o),a=e.map(c=>R0(c,r,n)).filter(c=>c).map(c=>s?`(${c})`:c);return a.length&&(s?o==="not"?i.push(pbt(a)):i.push(`(${a.join(` ${o} `)})`):i.push(a.join(` ${o} `))),i}function Yva({propName:t,value:e}){let r=[],n=t,i=Object.keys(e).map(o=>kjn({[o]:e[o]}));return i.length&&(n==="not"?r.push(pbt(i)):r.push(`(${i.join(` ${n} `)})`)),r}function Xva({key:t,propName:e,value:r,aliases:n}){let i=[];return"type"in r?i.push(lbt(e,r,n)):Object.keys(r).forEach(o=>{if(r[o]!==void 0)if(qva.indexOf(o)!==-1)i.push(`${e} ${o} ${iA(r[o],n)}`);else if(Mjn.indexOf(o)!==-1)Array.isArray(r[o])?i.push(r[o].map(s=>"("+R0(s,n,e)+")").join(` ${o} `)):i.push("("+R0(r[o],n,e)+")");else if(Gva.indexOf(o)!==-1){let s=eTa({lambdaParameter:t.toLowerCase(),value:r[o],op:o,propName:e,aliases:n});s&&i.push(s)}else if(o==="has")i.push(`${e} ${o} ${iA(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=>iA(a,n)).join(",")+")")}else if(Hva.indexOf(o)!==-1)i.push(`${o}(${e},${iA(r[o],n)})`);else{let s=/\/not/g.test(e),a=s?e.replace(/\/not/g,""):e,c=s?pbt([R0({[o]:r[o]},n,a)]):R0({[o]:r[o]},n,a);c&&i.push(c)}}),i}function iA(t,e){if(typeof t=="string")return`'${Zva(t)}'`;if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return`[${t.map(r=>iA(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}=${iA(n,e)}`).join(",")}return t}function Jva(t,e,r,n){return`${n}/${r}(${t}: ${t} ${r=="all"?"ne":"eq"} '${e}')`}function Qva(t){return t.replace(/'/g,"''")}function Zva(t){return encodeURIComponent(Qva(t))}function R0(t={},e=[],r=""){return(Array.isArray(t)?t:[t]).reduce((n,i)=>{if(i){let o=kjn(i,e,r);o&&n.push(o)}return n},[]).join(" and ")}function kjn(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=Kva(o,r);if(a&&Array.isArray(s))return i.concat(s.map(d=>lbt(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(lbt(c,s,e));else if(l)i.push(...Wva({key:o,value:s,aliases:e,propPrefix:r}));else if(Ljn(c))i.push(...Yva({propName:c,value:s}));else if(p)i.push(...Xva({key:o,propName:c,value:s,aliases:e}));else throw Error(`Unexpected value type: ${s}`);return i},[]).join(" and ")),n}function eTa({lambdaParameter:t,value:e,op:r,propName:n,aliases:i}){let o="";if(typeof e=="string"||e instanceof String)o=Jva(t,e,r,n);else if(e){let s=R0(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 TNe(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=>TNe(e)).join(",")}`;if(typeof t=="object"){let e=Object.keys(t);return e.some(r=>zva.indexOf(r.toLowerCase())!==-1)?e.map(r=>{let n;switch(r){case"filter":n=R0(t[r]);break;case"orderBy":n=dbt(t[r]);break;case"levels":case"count":case"skip":case"top":n=`${t[r]}`;break;default:n=TNe(t[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):e.map(r=>{let n=TNe(t[r]);return n?`${r}(${n})`:r}).join(",")}return""}function Fjn(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(${tTa(i)})`);break}case"filter":{let i=r[n];if(i){let o=R0(i);o&&e.push(`filter(${o})`)}break}case"groupBy":{let i=r[n];i&&e.push(`groupby(${rTa(i)})`);break}default:throw Error(`Unsupported transform: ${n}`)}return e},[]).join("/")||void 0}function tTa(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 rTa(t){if(!t.properties)throw Error("'properties' property required for groupBy");let e=`(${t.properties.join(",")})`;return t.transform&&(e+=`,${Fjn(t.transform)}`),e}function dbt(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])=>dbt(n,`${r}/`)).map(r=>`${e}${r}`).join(","):`${e}${String(t)}`}function nTa(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 fbt({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+=`(${iA(u,m)})`),(s||typeof l=="object")&&(_.$filter=R0(typeof l=="object"?l:s,m)),a&&(_.$apply=Fjn(a)),p&&(_.$expand=TNe(p)),c&&(_.$orderby=dbt(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=iA(h[v],m);f+=`/${v}`,b!==""&&(f+=`(${b})`)}}return m.length>0&&Object.assign(_,m.reduce((v,b)=>Object.assign(v,{[`@${b.name}`]:iA(b.value)}),{})),e&&(_.$search=encodeURIComponent(e)),nTa(f,{$select:t,$skiptoken:r,$format:n,..._})}function iTa(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 oTa(t,e,r=1,n){let i=e?.map(h=>({entityPath:h.fullPath,entitySetName:h.entity.entitySetName})),{expands:o,entityPathParts:s}=iTa(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(Er("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?fbt(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=fbt(l),d=`${c.entitySetName}${p}`;return yn.logger.debug(`Query for odata: ${d}`),{query:d}}function sTa(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 $jn(t,e,r,n,i,o=[]){let s=oTa(t,r,n,i),a=await Ujn(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=sTa(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 Ujn(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 Ujn(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=Er("errors.odataQueryError",{error:r});return yn.logger.error(n),{error:n}}}var em=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 jjn(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();_f.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 $jn(e.referencedEntities.listEntity,n,r,o?void 0:1,o,s);if(a.entityData)return _f.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 _f.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return Er("errors.dataNotFetched")}function qjn(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(...qjn(r))}),e}function aTa(t){if(em.entityTypeRefFacetCache[t.name])return em.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(...qjn(r))}),em.entityTypeRefFacetCache[t.name]=e,e??[]}function Gjn(t,e="",r=[],n,i){let o={},s=t.navPropEntities;if(s&&s.length>0){let a=t.entityType?aTa(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,Gjn(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 Hjn(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=Gjn(t,void 0,void 0,r);return n.choices.sort((i,o)=>(i.name??"").localeCompare(o.name??"")),n}}async function zjn(t,e){let n=(await Up.newInstance(await(0,Vjn.readFile)((0,Bjn.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 bjn(o,n?.client)}return{servicePath:e.uri,systemName:i}}async function Kjn(t){let e=await GX(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.`),Er("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):e}var Wjn,cTa=(...t)=>new Promise(e=>{clearTimeout(Wjn),Wjn=setTimeout(async()=>e(await jjn(...t)),1e3)}),nE={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},uTa=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Yjn=["."];async function Xjn(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 Er("prompts.skipDataDownload.validation.keyRequired");let o=[];r.relatedEntityChoices?.choices?.length&&(o=t[nE.relatedEntitySelection]);let s=await cTa(e,r,o);return s}function lTa(t){return em.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 Jjn(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=pTa(r,n,t?.appPath),o=await N$n({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:Fs.v4}},dy()!==go.cli,yn.logger);o.prompts=ll(o.prompts,()=>!!r.appAccess);let s={odata:[]},a=fTa(r,r.relatedEntityChoices),c=hTa(5,r,o.answers,s),u=dTa(r.relatedEntityChoices,o.answers,r,s);return e.push(i,...o.prompts,gTa(o.answers,r),mTa(o.answers,r),...c,a,u),{questions:e,answers:{application:r,odataQueryResult:s,odataServiceAnswers:o.answers}}}function pTa(t,e,r){return{type:"input",guiType:"folder-browser",name:nE.appSelection,message:Er("prompts.appSelection.message"),default:n=>r??n.appSelection??t.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:Er("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===t.appAccess?.app.appRoot)return!0;e.length=0,lTa(t);let i;try{i=await Cbe(n)}catch(u){let l=u;return u instanceof Error&&(l=u.message),yn.logger.error(Er("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${Er("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${Er("texts.seeLogForDetails")}`}let o=i.app.services[i.app.mainService??"mainService"];if(!o?.odataVersion?.startsWith("4."))return Er("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:o.odataVersion});let s=await Kjn(i);if(typeof s=="string")return s;t.appAccess=i,t.specification=s;let{servicePath:a,systemName:c}=await zjn(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 dTa(t,e,r,n){let i;return{when:async o=>t.choices.length>0,name:nE.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:Er("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[nE.skipDataDownload]?.[0]){if(i=await Xjn(s,e,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:Er("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:hbt.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:Er("prompts.relatedEntitySelection.openLogs")})}}function fTa(t,e){let r,n,i;return{when:()=>{if((n!==t.systemName?.value||t.servicePath!==r)&&t.referencedEntities?.listEntity){let s=Hjn(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:nE.toggleSelection,type:"confirm",message:Er("prompts.toggleSelection.message"),labelTrue:Er("prompts.toggleSelection.labelTrue"),labelFalse:Er("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 hTa(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:()=>Er("prompts.entityKey.message",{keyName:`${e.referencedEntities?.listEntity.semanticKeys[c]?.name} (${e.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:Er("prompts.entityKey.hint")},validate:async(u,l)=>{let p=e.referencedEntities?.listEntity.semanticKeys[c];if(p&&delete p.value,Yjn.includes(u))return Er("prompts.entityKey.validation.invalidKeyValueChars",{chars:Yjn.join()});if(u&&p)if(p.type==="Edm.Boolean")try{p.value=JSON.parse(u)}catch{return Er("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(p.type)){let h=u.split(",");for(let f of h)if(!uTa.test(f.trim()))return Er("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,Er("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!e.relatedEntityChoices?.choices?.length&&c===s&&!l[nE.skipDataDownload]?.[0]&&e.referencedEntities?.listEntity.semanticKeys[c]?.name){if(o=await Xjn(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 mTa(t,e){return{when:()=>!!t.metadata&&!!e.servicePath,name:nE.skipDataDownload,type:"checkbox",message:Er("prompts.skipDataDownload.message"),guiOptions:{hint:Er("prompts.skipDataDownload.hint")},default:!1,choices:[{name:Er("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function gTa(t,e){let r;return{when:async()=>e.appAccess&&e.specification&&t?.metadata?(r=await Ojn(e.appAccess,e.specification,t.metadata),typeof r=="object"&&(e.referencedEntities=r),!0):!1,name:nE.updateMainServiceMetadata,type:"confirm",message:Er("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:hbt.Severity.error}}}}function Qjn(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 nqn=pe(kC()),iqn=pe(dD());var oqn=pe(rqn()),sqn=require("node:path");function aqn(t,e,r){em.resetExternalServiceCache();let n=NTa(t,e),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:Er("prompts.valueHelpSelection.message"),choices:()=>n,validate:async s=>{if(!s||s.length===0)return em.resetExternalServiceCache(),!0;let a=await RTa(s,r),c=(0,oqn.default)(i,a);return i.length=0,i.push(...c),await DTa(i,r),!0}}],valueHelpData:i}}async function DTa(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(";");em.externalServiceRequestCache[a]??=[];let l=(0,nqn.convert)((0,iqn.parse)(o.metadata)).entitySets.map(async p=>{let d=p.name;if(em.externalServiceRequestCache[a].includes(d))return;em.externalServiceRequestCache[a].push(d);let h=await e.get((0,sqn.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 RTa(t,e){let r=t.flat();return await e.fetchExternalServices(r)}function NTa(t,e){let r=GJ(t,e,[]),n={};for(let o of r)if(o.type==="value-list"){if(_jn.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 uqn.default{vscode;appWizard;static _logger=BAe;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(e,r){super(e,{...r,skipInstall:!0},{unique:"namespace"}),Fdt(this.env,!0),this.options.force=!0,this.prompts=new SNe.Prompts([{description:Er("steps.odataDownloader.description"),name:Er("steps.odataDownloader.name")},{description:Er("steps.valueHelpSelection.description"),name:Er("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(Er("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return t._logger}async initializing(){await omt(),t._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await _f.initTelemetrySettings(),_f.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:e,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await Jjn(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 eq(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,bk.join)(ca.Webapp,ca.LocalService,ca.Mockdata)}if(this.state.updateMainServiceMetadata=o[nE.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,o[nE.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(e,o),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof Bf){let{questions:s,valueHelpData:a}=aqn(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();_f.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,bk.join)(this.state.appRootPath));let r=ubt(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);t.logger.info(Er("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,o])=>{this.writeDestinationJSON((0,bk.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,bk.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=Pjn(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=Cjn(a,c);this.writeDestination(o,u),t.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),_f.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfFiles:`${n.length}`})}catch(e){t.logger.error(e),_f.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(Er("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let e=Date.now();_f.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,bk.join)(this.state.appRootPath,ca.Webapp);if(await pOe(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 qAe(this.state.appRootPath,n,this.fs))}_f.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),_f.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(Er("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let e=(0,bk.join)(this.state.appRootPath,ca.Webapp,ca.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(e,(0,cqn.default)(this.state.mainServiceMetadata,{indentation:" ",lineSeparator:`
|
|
3085
|
+
${o}${t.slice(s)}`:t}var Vjn=require("node:fs/promises"),Bjn=require("node:path");var wjn=require("node:crypto"),Djn=pe(dAe());var xjn={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.49",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 Bva="@sap-ux/odata-download-sub-generator",jva="0a65e45d-6bf4-421d-b845-61e888c50e9e",_f=class{static _telemetryData;static _sessionId;static async initTelemetrySettings(e){this._sessionId=(0,wjn.randomUUID)(),yn.logger.info(`Telemetry session initialized with ID: ${this._sessionId}`);let r={consumerModule:{name:Bva,version:xjn.version},watchTelemetrySettingStore:!1,internalFeature:!0,resourceId:jva,...e};try{await nJ(r)}catch(n){yn.logger.error(`Error initializing telemetry settings: ${n}`)}}static createTelemetryData(e){if(!this._telemetryData){let r=Er("telemetry.unknownOs");try{r=(0,Djn.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 yg.getTelemetryClient().reportEvent(i,uc.NoSampling)}};var qva=["eq","ne","gt","ge","lt","le"],Mjn=["and","or","not"],Gva=["any","all"],Hva=["startswith","endswith","contains","matchespattern"],zva=["expand","levels","select","skip","top","count","orderby","filter"],Rjn=/\((.*)\)/,Njn=/(?!indexof)\((\w+)\)/;function Kva(t,e){if(e){let r=t==="",n=Njn.test(t),i=Rjn.test(t);return r?e:n?Ijn(t,e,Njn):i?Ijn(t,e,Rjn):`${e}/${t}`}return t}function Ljn(t){return Mjn.indexOf(t)!==-1}function pbt(t){return`not (${t.join(" and ")})`}function Ijn(t,e,r){return t.replace(r,(n,i)=>i.trim()===""?`(${e})`:`(${e}/${i.trim()})`)}function lbt(t,e,r=[]){return`${t} eq ${iA(e,r)}`}function Wva({key:t,value:e,aliases:r,propPrefix:n}){let i=[],o=t,s=Ljn(o),a=e.map(c=>R0(c,r,n)).filter(c=>c).map(c=>s?`(${c})`:c);return a.length&&(s?o==="not"?i.push(pbt(a)):i.push(`(${a.join(` ${o} `)})`):i.push(a.join(` ${o} `))),i}function Yva({propName:t,value:e}){let r=[],n=t,i=Object.keys(e).map(o=>kjn({[o]:e[o]}));return i.length&&(n==="not"?r.push(pbt(i)):r.push(`(${i.join(` ${n} `)})`)),r}function Xva({key:t,propName:e,value:r,aliases:n}){let i=[];return"type"in r?i.push(lbt(e,r,n)):Object.keys(r).forEach(o=>{if(r[o]!==void 0)if(qva.indexOf(o)!==-1)i.push(`${e} ${o} ${iA(r[o],n)}`);else if(Mjn.indexOf(o)!==-1)Array.isArray(r[o])?i.push(r[o].map(s=>"("+R0(s,n,e)+")").join(` ${o} `)):i.push("("+R0(r[o],n,e)+")");else if(Gva.indexOf(o)!==-1){let s=eTa({lambdaParameter:t.toLowerCase(),value:r[o],op:o,propName:e,aliases:n});s&&i.push(s)}else if(o==="has")i.push(`${e} ${o} ${iA(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=>iA(a,n)).join(",")+")")}else if(Hva.indexOf(o)!==-1)i.push(`${o}(${e},${iA(r[o],n)})`);else{let s=/\/not/g.test(e),a=s?e.replace(/\/not/g,""):e,c=s?pbt([R0({[o]:r[o]},n,a)]):R0({[o]:r[o]},n,a);c&&i.push(c)}}),i}function iA(t,e){if(typeof t=="string")return`'${Zva(t)}'`;if(t instanceof Date)return t.toISOString();if(typeof t=="number")return t;if(Array.isArray(t))return`[${t.map(r=>iA(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}=${iA(n,e)}`).join(",")}return t}function Jva(t,e,r,n){return`${n}/${r}(${t}: ${t} ${r=="all"?"ne":"eq"} '${e}')`}function Qva(t){return t.replace(/'/g,"''")}function Zva(t){return encodeURIComponent(Qva(t))}function R0(t={},e=[],r=""){return(Array.isArray(t)?t:[t]).reduce((n,i)=>{if(i){let o=kjn(i,e,r);o&&n.push(o)}return n},[]).join(" and ")}function kjn(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=Kva(o,r);if(a&&Array.isArray(s))return i.concat(s.map(d=>lbt(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(lbt(c,s,e));else if(l)i.push(...Wva({key:o,value:s,aliases:e,propPrefix:r}));else if(Ljn(c))i.push(...Yva({propName:c,value:s}));else if(p)i.push(...Xva({key:o,propName:c,value:s,aliases:e}));else throw Error(`Unexpected value type: ${s}`);return i},[]).join(" and ")),n}function eTa({lambdaParameter:t,value:e,op:r,propName:n,aliases:i}){let o="";if(typeof e=="string"||e instanceof String)o=Jva(t,e,r,n);else if(e){let s=R0(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 TNe(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=>TNe(e)).join(",")}`;if(typeof t=="object"){let e=Object.keys(t);return e.some(r=>zva.indexOf(r.toLowerCase())!==-1)?e.map(r=>{let n;switch(r){case"filter":n=R0(t[r]);break;case"orderBy":n=dbt(t[r]);break;case"levels":case"count":case"skip":case"top":n=`${t[r]}`;break;default:n=TNe(t[r])}return`$${r.toLowerCase()}=${n}`}).join(";"):e.map(r=>{let n=TNe(t[r]);return n?`${r}(${n})`:r}).join(",")}return""}function Fjn(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(${tTa(i)})`);break}case"filter":{let i=r[n];if(i){let o=R0(i);o&&e.push(`filter(${o})`)}break}case"groupBy":{let i=r[n];i&&e.push(`groupby(${rTa(i)})`);break}default:throw Error(`Unsupported transform: ${n}`)}return e},[]).join("/")||void 0}function tTa(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 rTa(t){if(!t.properties)throw Error("'properties' property required for groupBy");let e=`(${t.properties.join(",")})`;return t.transform&&(e+=`,${Fjn(t.transform)}`),e}function dbt(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])=>dbt(n,`${r}/`)).map(r=>`${e}${r}`).join(","):`${e}${String(t)}`}function nTa(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 fbt({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+=`(${iA(u,m)})`),(s||typeof l=="object")&&(_.$filter=R0(typeof l=="object"?l:s,m)),a&&(_.$apply=Fjn(a)),p&&(_.$expand=TNe(p)),c&&(_.$orderby=dbt(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=iA(h[v],m);f+=`/${v}`,b!==""&&(f+=`(${b})`)}}return m.length>0&&Object.assign(_,m.reduce((v,b)=>Object.assign(v,{[`@${b.name}`]:iA(b.value)}),{})),e&&(_.$search=encodeURIComponent(e)),nTa(f,{$select:t,$skiptoken:r,$format:n,..._})}function iTa(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 oTa(t,e,r=1,n){let i=e?.map(h=>({entityPath:h.fullPath,entitySetName:h.entity.entitySetName})),{expands:o,entityPathParts:s}=iTa(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(Er("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?fbt(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=fbt(l),d=`${c.entitySetName}${p}`;return yn.logger.debug(`Query for odata: ${d}`),{query:d}}function sTa(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 $jn(t,e,r,n,i,o=[]){let s=oTa(t,r,n,i),a=await Ujn(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=sTa(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 Ujn(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 Ujn(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=Er("errors.odataQueryError",{error:r});return yn.logger.error(n),{error:n}}}var em=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 jjn(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();_f.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 $jn(e.referencedEntities.listEntity,n,r,o?void 0:1,o,s);if(a.entityData)return _f.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 _f.sendTelemetry("ODATA_DOWNLOAD_QUERY_ERRORED",{duration:`${Date.now()-i} ms`}),`${a.error}`}}return Er("errors.dataNotFetched")}function qjn(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(...qjn(r))}),e}function aTa(t){if(em.entityTypeRefFacetCache[t.name])return em.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(...qjn(r))}),em.entityTypeRefFacetCache[t.name]=e,e??[]}function Gjn(t,e="",r=[],n,i){let o={},s=t.navPropEntities;if(s&&s.length>0){let a=t.entityType?aTa(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,Gjn(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 Hjn(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=Gjn(t,void 0,void 0,r);return n.choices.sort((i,o)=>(i.name??"").localeCompare(o.name??"")),n}}async function zjn(t,e){let n=(await Up.newInstance(await(0,Vjn.readFile)((0,Bjn.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 bjn(o,n?.client)}return{servicePath:e.uri,systemName:i}}async function Kjn(t){let e=await GX(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.`),Er("prompts.appSelection.validation.specficationApiVersionOutdated",{specApiVersion:n})):e}var Wjn,cTa=(...t)=>new Promise(e=>{clearTimeout(Wjn),Wjn=setTimeout(async()=>e(await jjn(...t)),1e3)}),nE={appSelection:"appSelection",toggleSelection:"toggleSelection",relatedEntitySelection:"relatedEntitySelection",skipDataDownload:"skipDataDownload",updateMainServiceMetadata:"updateMainServiceMetadata"},uTa=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Yjn=["."];async function Xjn(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 Er("prompts.skipDataDownload.validation.keyRequired");let o=[];r.relatedEntityChoices?.choices?.length&&(o=t[nE.relatedEntitySelection]);let s=await cTa(e,r,o);return s}function lTa(t){return em.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 Jjn(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=pTa(r,n,t?.appPath),o=await N$n({datasourceType:{includeNone:!1},systemSelection:{includeCloudFoundryAbapEnvChoice:!1,defaultChoice:r.systemName,connectPath:r.connectPath,hideNewSystem:!0},serviceSelection:{serviceFilter:n,requiredOdataVersion:Fs.v4}},dy()!==go.cli,yn.logger);o.prompts=ll(o.prompts,()=>!!r.appAccess);let s={odata:[]},a=fTa(r,r.relatedEntityChoices),c=hTa(5,r,o.answers,s),u=dTa(r.relatedEntityChoices,o.answers,r,s);return e.push(i,...o.prompts,gTa(o.answers,r),mTa(o.answers,r),...c,a,u),{questions:e,answers:{application:r,odataQueryResult:s,odataServiceAnswers:o.answers}}}function pTa(t,e,r){return{type:"input",guiType:"folder-browser",name:nE.appSelection,message:Er("prompts.appSelection.message"),default:n=>r??n.appSelection??t.appAccess?.app.appRoot,guiOptions:{mandatory:!0,breadcrumb:Er("prompts.appSelection.breadcrumb")},validate:async n=>{if(!n)return!1;if(n===t.appAccess?.app.appRoot)return!0;e.length=0,lTa(t);let i;try{i=await Cbe(n)}catch(u){let l=u;return u instanceof Error&&(l=u.message),yn.logger.error(Er("prompts.appSelection.validation.selectedPathDoesNotContainValidApp",{error:l})),`${Er("prompts.appSelection.validation.selectedPathDoesNotContainValidApp")}${Er("texts.seeLogForDetails")}`}let o=i.app.services[i.app.mainService??"mainService"];if(!o?.odataVersion?.startsWith("4."))return Er("prompts.appSelection.validation.appMainServiceOdataVersionNotSupported",{serviceOdataVersion:o.odataVersion});let s=await Kjn(i);if(typeof s=="string")return s;t.appAccess=i,t.specification=s;let{servicePath:a,systemName:c}=await zjn(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 dTa(t,e,r,n){let i;return{when:async o=>t.choices.length>0,name:nE.relatedEntitySelection,type:"checkbox",guiOptions:{applyDefaultWhenDirty:!0},message:Er("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[nE.skipDataDownload]?.[0]){if(i=await Xjn(s,e,r),typeof i=="string")return i;n.odata=i.odataQueryResult}return!0},additionalMessages:()=>{if(i&&typeof i!="string")return{message:Er("prompts.skipDataDownload.querySuccess",{count:i.odataQueryResult.length}),severity:hbt.Severity.information}},showOutputTabLink:()=>({show:!!i,linkMessage:Er("prompts.relatedEntitySelection.openLogs")})}}function fTa(t,e){let r,n,i;return{when:()=>{if((n!==t.systemName?.value||t.servicePath!==r)&&t.referencedEntities?.listEntity){let s=Hjn(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:nE.toggleSelection,type:"confirm",message:Er("prompts.toggleSelection.message"),labelTrue:Er("prompts.toggleSelection.labelTrue"),labelFalse:Er("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 hTa(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:()=>Er("prompts.entityKey.message",{keyName:`${e.referencedEntities?.listEntity.semanticKeys[c]?.name} (${e.referencedEntities?.listEntity.entitySetName})`}),type:"input",guiOptions:{hint:Er("prompts.entityKey.hint")},validate:async(u,l)=>{let p=e.referencedEntities?.listEntity.semanticKeys[c];if(p&&delete p.value,Yjn.includes(u))return Er("prompts.entityKey.validation.invalidKeyValueChars",{chars:Yjn.join()});if(u&&p)if(p.type==="Edm.Boolean")try{p.value=JSON.parse(u)}catch{return Er("prompts.entityKey.validation.invalidBooleanValue")}else if(["Edm.UUID","Edm.Guid"].includes(p.type)){let h=u.split(",");for(let f of h)if(!uTa.test(f.trim()))return Er("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,Er("prompts.entityKey.validation.invalidRangeSpecified")}if(l&&!e.relatedEntityChoices?.choices?.length&&c===s&&!l[nE.skipDataDownload]?.[0]&&e.referencedEntities?.listEntity.semanticKeys[c]?.name){if(o=await Xjn(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 mTa(t,e){return{when:()=>!!t.metadata&&!!e.servicePath,name:nE.skipDataDownload,type:"checkbox",message:Er("prompts.skipDataDownload.message"),guiOptions:{hint:Er("prompts.skipDataDownload.hint")},default:!1,choices:[{name:Er("prompts.skipDataDownload.choiceLabel"),value:"skipDownload",checked:!1}]}}function gTa(t,e){let r;return{when:async()=>e.appAccess&&e.specification&&t?.metadata?(r=await Ojn(e.appAccess,e.specification,t.metadata),typeof r=="object"&&(e.referencedEntities=r),!0):!1,name:nE.updateMainServiceMetadata,type:"confirm",message:Er("prompts.updateMainServiceMetadata.message"),default:!1,additionalMessages:async()=>{if(typeof r=="string")return{message:r,severity:hbt.Severity.error}}}}function Qjn(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 nqn=pe(kC()),iqn=pe(dD());var oqn=pe(rqn()),sqn=require("node:path");function aqn(t,e,r){em.resetExternalServiceCache();let n=NTa(t,e),i=[];return{questions:[{name:"valueHelpSelection",type:"checkbox",message:Er("prompts.valueHelpSelection.message"),choices:()=>n,validate:async s=>{if(!s||s.length===0)return em.resetExternalServiceCache(),!0;let a=await RTa(s,r),c=(0,oqn.default)(i,a);return i.length=0,i.push(...c),await DTa(i,r),!0}}],valueHelpData:i}}async function DTa(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(";");em.externalServiceRequestCache[a]??=[];let l=(0,nqn.convert)((0,iqn.parse)(o.metadata)).entitySets.map(async p=>{let d=p.name;if(em.externalServiceRequestCache[a].includes(d))return;em.externalServiceRequestCache[a].push(d);let h=await e.get((0,sqn.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 RTa(t,e){let r=t.flat();return await e.fetchExternalServices(r)}function NTa(t,e){let r=GJ(t,e,[]),n={};for(let o of r)if(o.type==="value-list"){if(_jn.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 uqn.default{vscode;appWizard;static _logger=BAe;generatorVersion=this.rootGeneratorVersion();prompts;setPromptsCallback;state={};constructor(e,r){super(e,{...r,skipInstall:!0},{unique:"namespace"}),Fdt(this.env,!0),this.options.force=!0,this.prompts=new SNe.Prompts([{description:Er("steps.odataDownloader.description"),name:Er("steps.odataDownloader.name")},{description:Er("steps.valueHelpSelection.description"),name:Er("steps.valueHelpSelection.name")}]),this.setPromptsCallback=n=>{this.prompts&&this.prompts.setCallback(n)},typeof r.appWizard?.setHeaderTitle=="function"&&r.appWizard.setHeaderTitle(Er("texts.generatorTitle"),`${this.rootGeneratorName()}@${this.rootGeneratorVersion()}`)}static get logger(){return t._logger}async initializing(){await omt(),t._logger=this._configureLogging(this.options.logLevel,this.options.logger,this.options.vscode),await _f.initTelemetrySettings(),_f.sendTelemetry("ODATA_DOWNLOADER_STARTED",{startUpTime:Date()})}async prompting(){try{let{answers:{application:e,odataQueryResult:r,odataServiceAnswers:n},questions:i}=await Jjn(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 eq(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,bk.join)(ca.Webapp,ca.LocalService,ca.Mockdata)}if(this.state.updateMainServiceMetadata=o[nE.updateMainServiceMetadata],this.state.mainServiceMetadata=n.metadata,o[nE.skipDataDownload]?.[0]||await this._promptMissingReferentialConstraints(e,o),n.servicePath&&n.metadata&&n.connectedSystem?.serviceProvider instanceof Bf){let{questions:s,valueHelpData:a}=aqn(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();_f.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_START",{time:Date()}),this.destinationRoot((0,bk.join)(this.state.appRootPath));let r=ubt(this.state.entityOData,this.state.entityPropertyToEntitySet,this.state.appEntities.listEntity.entitySetName,this.state.appEntities.hierarchyEntities);t.logger.info(Er("info.entityFilesToBeGenerated",{entities:Object.keys(r).join(", ")}));let n=Object.entries(r);n.forEach(([i,o])=>{this.writeDestinationJSON((0,bk.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,bk.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=Pjn(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=Cjn(a,c);this.writeDestination(o,u),t.logger.info(`Written referential constraint file: ${i.entitySetName}.js`)}}),_f.sendTelemetry("ODATA_DOWNLOADER_WRITE_DATA_FILES_END",{writeFileDuration:`${Date.now()-e} ms`,numberOfFiles:`${n.length}`})}catch(e){t.logger.error(e),_f.sendTelemetry("ODATA_DOWNLOADER_WRITING_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(Er("info.noServiceEntityData"));if(this.state.valueHelpData?.length)try{let e=Date.now();_f.sendTelemetry("ODATA_DOWNLOADER_WRITE_VALUE_HELP_FILES_START",{time:Date()});let r=(0,bk.join)(this.state.appRootPath,ca.Webapp);if(await pOe(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 qAe(this.state.appRootPath,n,this.fs))}_f.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),_f.sendTelemetry("ODATA_DOWNLOADER_WRITING_BALUE_HELP_DATA_ERROR",{writeFileErrorTime:Date()})}else t.logger.info(Er("info.noValueHelpData"));if(this.state.updateMainServiceMetadata&&this.state.mainServiceMetadata&&this.state.mainServiceName){let e=(0,bk.join)(this.state.appRootPath,ca.Webapp,ca.LocalService,this.state.mainServiceName,"metadata.xml");this.writeDestination(e,(0,cqn.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[nE.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:Er("steps.addConstraints.name"),description:Er("steps.addConstraints.description")}]);let s=Qjn(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 dy()!==go.cli&&this.appWizard?.showError(e,SNe.MessageType.notification),new Error(e)}_configureLogging(e,r,n){let i=new VAe(this.rootGeneratorName(),this.log,e,r,n);return i.info(Er("info.loggingInitialised",{logLevel:i.getLogLevel()})),i}};
|
|
3087
3087
|
/*! Bundled license information:
|
|
3088
3088
|
|
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.
|
|
5
|
+
"version": "0.3.49",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@sap-ux/axios-extension": "2.1.0",
|
|
48
48
|
"@sap-ux/btp-utils": "2.0.6",
|
|
49
49
|
"@sap-ux/fiori-generator-shared": "1.2.16",
|
|
50
|
-
"@sap-ux/inquirer-common": "1.0.
|
|
50
|
+
"@sap-ux/inquirer-common": "1.0.42",
|
|
51
51
|
"@sap-ux/logger": "1.0.3",
|
|
52
52
|
"@sap-ux/mockserver-config-writer": "1.0.19",
|
|
53
|
-
"@sap-ux/odata-service-inquirer": "3.2.
|
|
53
|
+
"@sap-ux/odata-service-inquirer": "3.2.19",
|
|
54
54
|
"@sap-ux/odata-service-writer": "1.0.22",
|
|
55
55
|
"@sap-ux/project-access": "2.2.0",
|
|
56
56
|
"@sap-ux/store": "2.0.7",
|