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EAAE4B,CAAC,IAAIF,SAAS,EAAE;IAChDC,MAAM,CAAChC,IAAI,CAAC8B,KAAK,CAACI,KAAK,CAACD,CAAC,EAAEA,CAAC,GAAGF,SAAS,CAAC,CAAC;;EAE5C,OAAOC,MAAM;AACf;AAEE;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAG,eAAe,CAACC,SAAS,CAAC,OAAO,EAAEzF,KAAK,CAAC;;;;;;;UE7UzC;UACA;UACA;UACA;UACA","sources":["webpack:///./src/functions/functions.ts?./node_modules/custom-functions-metadata-plugin/lib/loader.js?{\"input\":\".\\src\\functions\\functions.ts\"}","webpack:///webpack/before-startup?","webpack:///webpack/startup?","webpack:///webpack/after-startup?"],"sourcesContent":["localStorage.setItem('countPerSecond', '0');\r\nvar access_token: string;\r\nconst pe_batching_url_local = \"https://fa-officeaddin-dev.azurewebsites.net/api/PrivateEquityBatching?code=ioZM3_wzrwn_X8-JDMRIDw2M-yE2fQ__rJ1TIsFfogQtAzFuVZiOhQ==\";\r\nconst pe_batching_url_stg = \"https://fa-officeaddin-dev.azurewebsites.net/api/PrivateEquityBatching?code=ioZM3_wzrwn_X8-JDMRIDw2M-yE2fQ__rJ1TIsFfogQtAzFuVZiOhQ==\";\r\nconst pe_batching_url_uat = \"https://fa-officeaddin-uat.azurewebsites.net/api/PrivateEquityBatching?code=pgoLq7N8UCxHIsxUJHmCfizQq8hJjhHCuUJhGgm4_Lp7AzFuIxetdQ==\";\r\nconst pe_batching_url_prod = \"https://fa-officeaddin.azurewebsites.net/api/PrivateEquityBatching?code=G9AQixXIvjOoDF-0WInavVMSEE7ek8OOMWM5i1K1el8ZAzFuakFboA==\";\r\nconst pe_batching_url = pe_batching_url_local;\r\n\r\n/**\r\n * Get Private Equity data.\r\n * @customfunction\r\n * @param measure measure string\r\n * @param currencyType currencyType any\r\n * @param fund fund string\r\n * @param fundGroup fundGroup any\r\n * @param company company any\r\n * @param transactionType transactionType any\r\n * @param investor investor any\r\n * @param glDate period(DD/MM/YYYY) any\r\n * @param effectiveDate effectiveDate any\r\n * @param glAccountCode glAccountCode string\r\n * @param glAccountName glAccountName string\r\n * @param fundPartnershipName fundPartnershipName any\r\n * @param investorGroup investorGroup any\r\n * @param periodLength periodLength any\r\n * @param investorType investorType any\r\n * @param investorAxiID investorAxiID any\r\n * @param investorGPCommitmentType investorGPCommitmentType any\r\n * @param investorGeography investorGeography any\r\n * @param investmentGeograpy investmentGeograpy any\r\n * @param periodQuarter periodQuarter any\r\n * @param effectiveQuarter effectiveQuarter any\r\n * @returns value.\r\n */\r\nexport async function PEDEV(measure: string, currencyType: any = null, fundGroup: any = null, fund: any = null, company: any = null, transactionType: any = null, investor: any = null, glDate: any = null, effectiveDate: any = null, glAccountCode: any = null, glAccountName: any = null, fundPartnershipName: any = null, investorGroup: any = null, periodLength: any = null, investorType: any = null, investorAxiID: any = null, investorGPCommitmentType: any = null, investorGeography: any = null, investmentGeograpy: any = null, periodQuarter: any = null, effectiveQuarter: any = null) {\r\n try {\r\n let generateAccessToken = false;\r\n if (access_token !== undefined && access_token !== null && access_token !== '') {\r\n let jwtPayload = JSON.parse(window.atob(access_token.split('.')[1]));\r\n if ((jwtPayload.exp * 10000) <= (new Date()).valueOf()) { generateAccessToken = true; }\r\n }\r\n if (access_token === undefined || access_token === null || access_token === '' || generateAccessToken) {\r\n access_token = await OfficeRuntime.auth.getAccessToken({\r\n allowSignInPrompt: true,\r\n allowConsentPrompt: true,\r\n forMSGraphAccess: true,\r\n });\r\n }\r\n return _pushOperation(\"PE\", { measure, currencyType, fundGroup, fund, company, transactionType, investor, glDate, effectiveDate, glAccountCode, glAccountName, fundPartnershipName, investorGroup, periodLength, investorType, investorAxiID, investorGPCommitmentType, investorGeography, investmentGeograpy, periodQuarter, effectiveQuarter});\r\n } catch (error) { return error; }\r\n}\r\nlet _batch = [];\r\nlet _isBatchedRequestScheduled = false;\r\n// This function encloses your custom functions as individual entries,\r\n// which have some additional properties so you can keep track of whether or not\r\n// a request has been resolved or rejected.\r\nfunction _pushOperation(op, args) {\r\n // Create an entry for your custom function.\r\n const invocationEntry = { operation: op, args: args, resolve: undefined, reject: undefined };\r\n\r\n // Create a unique promise for this invocation,\r\n // and save its resolve and reject functions into the invocation entry.\r\n const promise = new Promise((resolve, reject) => { invocationEntry.resolve = resolve; invocationEntry.reject = reject; });\r\n\r\n // Push the invocation entry into the next batch.\r\n _batch.push(invocationEntry);\r\n\r\n // If a remote request hasn't been scheduled yet,\r\n // schedule it after a certain timeout, e.g., 100 ms.\r\n if (!_isBatchedRequestScheduled) {\r\n _isBatchedRequestScheduled = true;\r\n setTimeout(_makeRemoteRequest, 100);\r\n }\r\n\r\n // Return the promise for this invocation.\r\n return promise;\r\n}\r\n\r\n// This is a private helper function, used only within your custom function add-in.\r\n// You wouldn't call _makeRemoteRequest in Excel, for example.\r\n// This function makes a request for remote processing of the whole batch,\r\n// and matches the response batch to the request batch.\r\nfunction _makeRemoteRequest() {\r\n // Copy the shared batch and allow the building of a new batch while you are waiting for a response.\r\n // Note the use of \"splice\" rather than \"slice\", which will modify the original _batch array\r\n // to empty it out.\r\n try {\r\n const batchCopy = _batch.splice(0, _batch.length);\r\n _isBatchedRequestScheduled = false;\r\n\r\n // Build a simpler request batch that only contains the arguments for each invocation.\r\n const requestBatch = batchCopy.map((item) => { return { operation: item.operation, args: item.args }; });\r\n let _chunkSize = batchCopy.length; //19000;\r\n splitArray(requestBatch, _chunkSize).forEach((chunk, index) => {\r\n // Make the remote request.\r\n _fetchFromRemoteService(chunk).then((responseBatch: any) => {\r\n if (responseBatch['token'] !== undefined) { localStorage.setItem('bcp_excel_platform_data_token', responseBatch['token']); }\r\n // Match each value from the response batch to its corresponding invocation entry from the request batch,\r\n // and resolve the invocation promise with its corresponding response value.\r\n responseBatch['data'].forEach((response) => {\r\n if (response.error) {\r\n batchCopy[(index * _chunkSize) + response[\"[index]\"]].reject(new Error(response.error));\r\n } else {\r\n batchCopy[(index * _chunkSize) + response[\"[index]\"]].resolve(response[\"[value]\"]);\r\n }\r\n });\r\n });\r\n });\r\n } catch (error) { console.log(error); }\r\n}\r\n\r\nasync function _fetchFromRemoteService(items) {\r\n return await fetch(pe_batching_url, {\r\n method: \"POST\",\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Authorization': localStorage.getItem('bcp_excel_platform_data_token'),\r\n 'UserToken': ('Bearer ' + access_token)\r\n },\r\n body: JSON.stringify(items)\r\n }).then((response) => { return response.json(); });\r\n}\r\n\r\nfunction splitArray(array, chunkSize) {\r\n const chunks = [];\r\n for (let i = 0; i < array.length; i += chunkSize) {\r\n chunks.push(array.slice(i, i + chunkSize));\r\n }\r\n return chunks;\r\n}\r\n\r\n // try {\r\n // // const access_token: string = \"Test\";\r\n // // var pe_url = \"https://fa-officeaddin-uat.azurewebsites.net/api/PrivateEquity?code=74a_CtvVcR13KRV7_ACdM1QfCGdPIyeWpbirXULM5hHbAzFuNHrWcQ==\";\r\n\r\n // localStorage.setItem('countPerSecond', (parseInt(localStorage.getItem('countPerSecond'), 10) + 1).toString());\r\n // var response = await new Promise(async function (resolve, reject) {\r\n // // await setTimeout(async () => {\r\n // let generateAccessToken;\r\n // if (access_token !== undefined && access_token !== null && access_token !== '') {\r\n // let jwtPayload = JSON.parse(window.atob(access_token.split('.')[1]));\r\n // if ((jwtPayload.exp * 1000) <= (new Date()).valueOf()) { generateAccessToken = true; }\r\n // }\r\n // if (access_token === undefined || access_token === null || access_token === '' || generateAccessToken) {\r\n // access_token = await OfficeRuntime.auth.getAccessToken({\r\n // allowSignInPrompt: true,\r\n // allowConsentPrompt: true,\r\n // forMSGraphAccess: true,\r\n // });\r\n // }\r\n // fetch(pe_url, {\r\n // method: \"POST\",\r\n // headers: {\r\n // 'Content-Type': 'application/json',\r\n // 'Authorization': localStorage.getItem('bcp_excel_platform_data_token'),\r\n // 'UserToken': ('Bearer ' + access_token)\r\n // },\r\n // body: JSON.stringify({\r\n // measure: measure,\r\n // fund: fund,\r\n // investor: investor,\r\n // company: company,\r\n // period: period,\r\n // fundgroup: fundGroup,\r\n // fundpartnershipname: fundPartnershipName,\r\n // investorgroup: investorGroup,\r\n // currencytype: currencyType,\r\n // periodlength: periodLength,\r\n // investortype: investorType,\r\n // effectivedate: effectiveDate,\r\n // investorgpcommitmenttype: investorGPCommitmentType,\r\n // investorGeography: investorGeography,\r\n // investmentGeograpy: investmentGeograpy,\r\n // transactionType: transactionType,\r\n // periodQuarter: periodQuarter\r\n // })\r\n // }).then((response) => {\r\n // localStorage.setItem('countPerSecond', (parseInt(localStorage.getItem('countPerSecond'), 10) - 1).toString());\r\n // return response.json();\r\n // }).then((json) => {\r\n // // console.log(json);\r\n // if (json.message !== undefined && json.message.length > 0) {\r\n // resolve(json['message']);\r\n // } else {\r\n // if (json['token'] !== undefined) {\r\n // localStorage.setItem('bcp_excel_platform_data_token', json['token']);\r\n // }\r\n // resolve(json['value']);\r\n // }\r\n // }).catch((error) => {\r\n // reject(error);\r\n // });\r\n // // }, 0);\r\n // // }, parseInt(localStorage.getItem('countPerSecond'), 10) * 600);\r\n // // }, (Math.floor(parseInt(localStorage.getItem('countPerSecond'), 10)/105)) * 1000*60);\r\n\r\n // // countPerSecond = countPerSecond - 1;\r\n // });\r\n // return response;\r\n\r\n // } catch (error) {\r\n // console.log(error, '------');\r\n // return JSON.stringify(error);\r\n // }\r\n// export async function getPEData(measure: string, fund: any = null, investor: any = null, company: any = null, period: any = null, fundgroup: any = null, fundpartnershipname: any = null, investorgroup: any = null, currencytype: any = null, periodlength: any = null, investortype: any = null, investoraxiid: any = null, effectivedate: any = null, investorgpcommitmenttype: any = null, iterationCount = 0) {\r\n// const _workspace_id = \"139e7d29-ce4e-4d0b-b3fd-0e00e4f0cffb\";\r\n// const _dataset_id = \"64de53a4-a63e-4a9c-bfd9-d3903ca87c17\";\r\n// const _access_token: string = await OfficeRuntime.auth.getAccessToken({\r\n// allowSignInPrompt: true,\r\n// allowConsentPrompt: true,\r\n// forMSGraphAccess: true,\r\n// });\r\n\r\n// // const _access_token = localStorage.getItem('bcp_excel_platform_data_token');\r\n// // const _access_token = \"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSJ9.eyJhdWQiOiI0MWUwMzk1MC1jOTI0LTQyYjYtOWYwNy04ODg1OTg4NDM5N2EiLCJpc3MiOiJodHRwczovL2xvZ2luLm1pY3Jvc29mdG9ubGluZS5jb20vNzkzYzkzMzgtZGM0YS00MDVhLWJkOWMtOGU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uShNArEhAfQP7xXel67ySXo16R33YsknLrgD9hlVmx7iR_8nX7s2ipxF47RXrg1sZvhgNkNOFGyw\"\r\n// let _url = `https://api.powerbi.com/v1.0/myorg/datasets/${_dataset_id}/executeQueries`;\r\n\r\n// let query = \"CALCULATE([\"\r\n// query = query + measure + \"]\";\r\n// if (fund !== null && fund !== undefined && fund.toString().length > 0) {\r\n// query = query + `,KEEPFILTERS( 'fund'[fUNDNAME]=\"` + fund + `\")`;\r\n// }\r\n// if (investor !== null && investor !== undefined && investor.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'investor'[iNVESTORNAME]=\"` + investor + `\")`;\r\n// }\r\n// if (company !== null && company !== undefined && company.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'Portfolio company'[cOMPANYNAME]=\"` + company + `\")`;\r\n// }\r\n// if (period !== null && period !== undefined && period.toString().length > 0) {\r\n// // let regix = /^([1-9]|0[1-9]|[12][0-9]|3[01])[/ /.]([1-9]|0[1-9]|1[012])[/ /.](19|20)\\d\\d$/gm;\r\n// // if (regix.test(period)) {\r\n// // let periodArr = period.split('/');\r\n// // var d = new Date(periodArr[2], parseInt(periodArr[1]) - 1, periodArr[0]);\r\n// // if (d.getFullYear() == periodArr[2] && d.getMonth() == (parseInt(periodArr[1]) - 1) && d.getDate() == periodArr[0]) {\r\n// // query = query + `,KEEPFILTERS( 'period'[pERIODDATE]={DATE(` + period[2] + ',' + (parseInt(period[1])) + ',' + period[0] + `)})`;\r\n// // } else {\r\n// // return 'Invalid Date Input';\r\n// // }\r\n// // } else {\r\n// // return 'Invalid Date format for period.';\r\n// // }\r\n\r\n\r\n// if(period.length >=8 && period.length <= 10) {\r\n// let periodArr = period.split('/');\r\n// if(periodArr.length === 3) {\r\n// let d = new Date(periodArr[2], parseInt(periodArr[1]) - 1, periodArr[0])\r\n// if (d.getFullYear() == periodArr[2] && d.getMonth() == (parseInt(periodArr[1]) - 1) && d.getDate() == periodArr[0]) {\r\n// query = query + `,KEEPFILTERS( 'period'[pERIODDATE]={DATE(` + periodArr[2] + ',' + periodArr[1] + ',' + periodArr[0] + `)})`;\r\n// } else {\r\n// return (\"Invalid Date for period\");\r\n// }\r\n// } else {\r\n// return ('Invalid date format for period(Expected DD/MM/YYY)');\r\n// }\r\n// } else {\r\n// return ('Invalid date format for period(Expected DD/MM/YYY)');\r\n// }\r\n\r\n// // if ((new Date(period)).toString() == \"Invalid Date\") {\r\n// // // context.res = { status: 400, body: { message: 'Invalid Date format for period.' } }\r\n// // return 'Invalid Date format for period.';\r\n// // }\r\n// // let d = new Date(period);\r\n// // query = query + `,KEEPFILTERS( 'period'[pERIODDATE]={DATE(` + d.getFullYear() + ',' + (d.getMonth() + 1) + ',' + d.getDate() + `)})`;\r\n// }\r\n// if (fundgroup !== null && fundgroup !== undefined && fundgroup.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'fund'[fUNDGROUP]=\"` + fundgroup + `\")`;\r\n// }\r\n// if (fundpartnershipname !== null && fundpartnershipname !== undefined && fundpartnershipname.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'fund'[fUNDPARTNERSHIPNAME]=\"` + fundpartnershipname + `\")`;\r\n// }\r\n// if (investorgroup !== null && investorgroup !== undefined && investorgroup.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'investor'[iNVESTORGROUP]=\"` + investorgroup + `\")`;\r\n// }\r\n// if (currencytype !== null && currencytype !== undefined && currencytype.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'source currency'[cURRENCYTYPE]=\"` + currencytype + `\")`;\r\n// }\r\n// if (periodlength !== null && periodlength !== undefined && periodlength.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'PortfolioFinancials'[pERIODLENGTH]=\"` + periodlength + `\")`;\r\n// }\r\n// if (investortype !== null && investortype !== undefined && investortype.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'investor'[iNVESTORTYPE]=\"` + investortype + `\")`;\r\n// }\r\n// if (investoraxiid !== null && investoraxiid !== undefined && investoraxiid.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'investor'[iNVESTORAXIID]=\"` + investoraxiid + `\")`;\r\n// }\r\n// if (investorgpcommitmenttype !== null && investorgpcommitmenttype !== undefined && investorgpcommitmenttype.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'investor'[iNVESTORGPCOMMITMENTTYPE]=\"` + investorgpcommitmenttype + `\")`;\r\n// }\r\n// if (effectivedate !== null && effectivedate !== undefined && effectivedate.toString().length >= 0) {\r\n// query = query + `,KEEPFILTERS( 'GL Financials'[eFFECTIVEDATE]=\"` + effectivedate + `\")`;\r\n// }\r\n// query = query + ')';\r\n// console.log(query);\r\n// return new Promise(function (resolve, reject) {\r\n// // let tokenUsedCount = localStorage.getItem('bcp_excel_platform_data_token_used_count') !== null ? parseInt(localStorage.getItem('bcp_excel_platform_data_token_used_count'), 10) : 0;\r\n// // tokenUsedCount = tokenUsedCount + 1;\r\n// // localStorage.setItem('bcp_excel_platform_data_token_used_count', tokenUsedCount.toString());\r\n// fetch(_url, {\r\n// method: \"POST\",\r\n// headers: {\r\n// 'Content-Type': 'application/json',\r\n// Authorization: `Bearer ${_access_token}`\r\n// },\r\n// body: JSON.stringify({\r\n// queries: [\r\n// {\r\n// \"query\": `EVALUATE ROW(\"Value\",` + query + `)`\r\n// }\r\n// ],\r\n// serializerSettings: {\r\n// \"includeNulls\": true\r\n// }\r\n// })\r\n// })\r\n// .then((response) => {\r\n// return response.json();\r\n// })\r\n// .then((json) => {\r\n// resolve(JSON.stringify(json[\"results\"][0][\"tables\"][0][\"rows\"][0][\"[Value]\"]));\r\n// }).catch(async (error) => {\r\n// if (iterationCount === 0) {\r\n// localStorage.setItem('bcp_excel_platform_data_token', '');\r\n// // await generateToken();\r\n// iterationCount = iterationCount + 1;\r\n// resolve(getPEData(measure, fund, investor, company, period, fundgroup, fundpartnershipname, investorgroup, currencytype, periodlength, investortype, investoraxiid, effectivedate, investorgpcommitmenttype, iterationCount));\r\n// } else {\r\n// resolve('Please check later');\r\n// }\r\n// });\r\n// });\r\n// }\nCustomFunctions.associate(\"PEDEV\", PEDEV);","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = {};\n__webpack_modules__[503](0, __webpack_exports__);\n",""],"names":["localStorage","setItem","access_token","pe_batching_url_local","pe_batching_url_stg","pe_batching_url_uat","pe_batching_url_prod","pe_batching_url","PEDEV","measure","currencyType","fundGroup","fund","company","transactionType","investor","glDate","effectiveDate","glAccountCode","glAccountName","fundPartnershipName","investorGroup","periodLength","investorType","investorAxiID","investorGPCommitmentType","investorGeography","investmentGeograpy","periodQuarter","effectiveQuarter","generateAccessToken","undefined","jwtPayload","JSON","parse","window","atob","split","exp","Date","valueOf","OfficeRuntime","auth","getAccessToken","allowSignInPrompt","allowConsentPrompt","forMSGraphAccess","_a","_pushOperation","error_1","exports","_batch","_isBatchedRequestScheduled","op","args","invocationEntry","operation","resolve","reject","promise","Promise","push","setTimeout","_makeRemoteRequest","batchCopy_1","splice","length","requestBatch","map","item","_chunkSize_1","splitArray","forEach","chunk","index","_fetchFromRemoteService","then","responseBatch","response","error","Error","console","log","items","fetch","method","headers","getItem","body","stringify","json","array","chunkSize","chunks","i","slice","CustomFunctions","associate"],"sourceRoot":""}