@microsoft/cmr-cli 0.32.3 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +37 -14
  2. package/THIRD-PARTY-NOTICES.txt +287 -30
  3. package/dist/Add-4RULNL6A.js +11 -0
  4. package/dist/AddConfig-D2DCR3JH.js +12 -0
  5. package/dist/AddConnector-5ZR5AF6H.js +19 -0
  6. package/dist/AddDeployment-7U4I5IC4.js +11 -0
  7. package/dist/AddDeploymentBinding-BZVRRZ7H.js +18 -0
  8. package/dist/AddRayfin-45ASHNIX.js +87 -0
  9. package/dist/Alter-36TSNZ4M.js +11 -0
  10. package/dist/{AuthStatus-WCZYGI5G.js → AuthStatus-W5ZHOAVD.js} +2 -2
  11. package/dist/AuthSwitch-7HRPTGEG.js +13 -0
  12. package/dist/Bin.js +1 -1
  13. package/dist/BuildMaafApp-TLQXOVQC.js +11 -0
  14. package/dist/Clear-X55BZKYF.js +11 -0
  15. package/dist/Cli-EEO7V3MZ.js +47 -0
  16. package/dist/CloneMaafApp-4EHW3HE2.js +12 -0
  17. package/dist/CreateMaafApp-VNXWCAP4.js +23 -0
  18. package/dist/CreateMaafProject-WVBNZPVL.js +11 -0
  19. package/dist/DeleteMaafApp-UGUKARMO.js +11 -0
  20. package/dist/DeployMaafApp-GJO567TK.js +8 -0
  21. package/dist/DeployMaafProject-4TSW2SFJ.js +11 -0
  22. package/dist/DeploymentApprovals-SZKNJT76.js +11 -0
  23. package/dist/Dev-ZD3L6WYY.js +15 -0
  24. package/dist/{EnvironmentVariableAuthenticationProvider-EBRBQ5I2.js → EnvironmentVariableAuthenticationProvider-EURTERVX.js} +2 -2
  25. package/dist/FeatureSettings-GG7JGFIY.js +11 -0
  26. package/dist/{GenerateCode-UQCHTRGP.js → GenerateCode-PNYC45SK.js} +2 -2
  27. package/dist/GetMaafBuildStatus-UTPVWF5L.js +11 -0
  28. package/dist/GetMaafProjectDeployStatus-PLK52YC4.js +12 -0
  29. package/dist/{GetSettings-MVVEXMJC.js → GetSettings-RLRDJEC7.js} +2 -2
  30. package/dist/InfoMaafApp-CTB6IPRU.js +13 -0
  31. package/dist/InfoMaafProject-TULH566X.js +11 -0
  32. package/dist/Init-TYWP2E6U.js +11 -0
  33. package/dist/ListConnectorActions-UQS6D4UN.js +11 -0
  34. package/dist/ListConnectors-OCDO64AT.js +11 -0
  35. package/dist/ListDeployments-PDLJ3IEI.js +11 -0
  36. package/dist/ListMaafApps-UAWTTCGB.js +11 -0
  37. package/dist/ListMaafProjects-T3Q2GEDX.js +11 -0
  38. package/dist/{ListSchema-QKVHVPHB.js → ListSchema-G673LK5Q.js} +2 -2
  39. package/dist/{ListSettings-IIA5OGMP.js → ListSettings-EXCK5ZS6.js} +2 -2
  40. package/dist/{Login-BT6UTPCZ.js → Login-XZATPT4L.js} +2 -2
  41. package/dist/{Logout-FBJE35Q5.js → Logout-2XM4IMZF.js} +2 -2
  42. package/dist/{MockFetch-LQLQGTNT.js → MockFetch-LW3KYEGC.js} +2 -2
  43. package/dist/NodeMsalAuthenticationProvider-ALMFNUEV.js +17 -0
  44. package/dist/Pack-RH4D4C7W.js +8 -0
  45. package/dist/PackProject-5DUWSBFA.js +14 -0
  46. package/dist/PlayMaafApp-5BXGXE6O.js +8 -0
  47. package/dist/ProjectApprovals-K3JF6D72.js +13 -0
  48. package/dist/ProjectRoleAssignments-7IUDEVBN.js +11 -0
  49. package/dist/RefreshDataSource-CMHDF2GP.js +11 -0
  50. package/dist/RefreshGitAuth-4TRO5IOQ.js +11 -0
  51. package/dist/Remove-KZD3SDDC.js +11 -0
  52. package/dist/{RemoveDataSource-RRND46QZ.js → RemoveDataSource-C7UXOUNH.js} +3 -3
  53. package/dist/RemoveDeployment-ZQJWQPD6.js +11 -0
  54. package/dist/ServicePrincipalAuthenticationProvider-3NPJTLF5.js +11 -0
  55. package/dist/SetSetting-3XO6HPG7.js +11 -0
  56. package/dist/{SetSetting-Q7EQNOTI.js → SetSetting-ZW7F43GC.js} +2 -2
  57. package/dist/ShareLinkCreate-JXPW5H7A.js +11 -0
  58. package/dist/ShareLinkList-ICYPRIQV.js +11 -0
  59. package/dist/ShareLinkRevoke-JVMQZF7K.js +11 -0
  60. package/dist/ShareList-YGSTFMVE.js +11 -0
  61. package/dist/ShareMaafApp-ZCY72WHK.js +11 -0
  62. package/dist/{TelemetrySettings-XCT73DEI.js → TelemetrySettings-P6WYWGW4.js} +2 -2
  63. package/dist/UnshareMaafApp-N4UR6Q4A.js +11 -0
  64. package/dist/{chunk-QLK3ZVWP.js → chunk-2SRFM7D6.js} +2 -2
  65. package/dist/chunk-3YCPXSCO.js +11 -0
  66. package/dist/chunk-45EZLDPE.js +147 -0
  67. package/dist/{chunk-2LKCCYRF.js → chunk-4PI5THLA.js} +2 -2
  68. package/dist/{chunk-TMYOZDLM.js → chunk-6KOL66SF.js} +2 -2
  69. package/dist/{chunk-2VJIWD7V.js → chunk-74RNALDY.js} +2 -2
  70. package/dist/{chunk-SIEI2EB5.js → chunk-7AEULMP2.js} +2 -2
  71. package/dist/chunk-7LAMG4KK.js +12 -0
  72. package/dist/chunk-A5INC5TY.js +11 -0
  73. package/dist/chunk-AICYZHWK.js +11 -0
  74. package/dist/chunk-B4NTYKGH.js +12 -0
  75. package/dist/chunk-BAQPANON.js +11 -0
  76. package/dist/{chunk-DKSLWH4O.js → chunk-BMOTNINY.js} +6 -6
  77. package/dist/{chunk-OUKOEUZA.js → chunk-C7UWPNC3.js} +1 -1
  78. package/dist/{chunk-Q3ONTUZ7.js → chunk-CLY3OASM.js} +2 -2
  79. package/dist/chunk-DLUQVMUE.js +11 -0
  80. package/dist/{chunk-KT2SUHGM.js → chunk-ENDUKF4E.js} +2 -2
  81. package/dist/{chunk-UEZV46GZ.js → chunk-FESGOCAP.js} +7 -7
  82. package/dist/{chunk-BRRT2E75.js → chunk-GO22IDEN.js} +6 -6
  83. package/dist/{chunk-WTTK2GTG.js → chunk-HHW4SKVU.js} +2 -2
  84. package/dist/{chunk-PEZMQ2A3.js → chunk-HZGDQAKA.js} +2 -2
  85. package/dist/{chunk-HSNRWBA6.js → chunk-IMVZRBSQ.js} +2 -2
  86. package/dist/chunk-K77VBHFP.js +12 -0
  87. package/dist/{chunk-DGUO74I3.js → chunk-KD4NQIYX.js} +3 -3
  88. package/dist/{chunk-3E7QQ2BR.js → chunk-KN66FSQK.js} +2 -2
  89. package/dist/{chunk-UXKJNXTZ.js → chunk-KPKJZKWW.js} +2 -2
  90. package/dist/chunk-NMZFJESU.js +12 -0
  91. package/dist/{chunk-PZIEJEF5.js → chunk-NNYOT7IR.js} +2 -2
  92. package/dist/{chunk-EFY2BSWB.js → chunk-OH3TCDCC.js} +2 -2
  93. package/dist/{chunk-XIX2O22O.js → chunk-OHQNTYJG.js} +2 -2
  94. package/dist/{chunk-KKC5ZK4D.js → chunk-PYPCPMCR.js} +21 -21
  95. package/dist/{chunk-ZB6MB7GZ.js → chunk-R2IECDVU.js} +3 -3
  96. package/dist/{chunk-ADRQC63G.js → chunk-RA74M3YD.js} +2 -2
  97. package/dist/{chunk-4XKA5APP.js → chunk-RSHOMYG6.js} +228 -227
  98. package/dist/chunk-UHNOINTO.js +11 -0
  99. package/dist/{chunk-4U53RYJJ.js → chunk-WS6TGUH7.js} +2 -2
  100. package/dist/{chunk-6EF722GY.js → chunk-XC7Y6E2C.js} +11 -11
  101. package/dist/chunk-XJXWNOJR.js +11 -0
  102. package/dist/chunk-Y2D37EFX.js +13 -0
  103. package/dist/{chunk-RFLXPXBN.js → chunk-YEWRCEPT.js} +2 -2
  104. package/dist/chunk-Z4UX3JOS.js +12 -0
  105. package/dist/chunk-ZBQT5XZJ.js +32 -0
  106. package/dist/chunk-ZGBTKTTU.js +11 -0
  107. package/dist/{chunk-GE3UFHZ5.js → chunk-ZLK2CMMJ.js} +23 -23
  108. package/dist/chunk-ZWJ5T5VI.js +11 -0
  109. package/dist/node-PLZPXPD7.js +29 -0
  110. package/dist/typescript-6OTSQQEW.js +458 -0
  111. package/package.json +5 -4
  112. package/dist/Add-FU57YE5G.js +0 -11
  113. package/dist/AddConfig-CI7KNLIG.js +0 -12
  114. package/dist/AddConnector-WH4IU3ND.js +0 -16
  115. package/dist/AddDeployment-GWFCPAL5.js +0 -11
  116. package/dist/AddDeploymentBinding-RFLI6DKH.js +0 -18
  117. package/dist/AddRayfin-VRCFEOIL.js +0 -38
  118. package/dist/Alter-JFFT5JOA.js +0 -11
  119. package/dist/AuthSwitch-XJMG7IUR.js +0 -13
  120. package/dist/BuildMaafApp-7AUZHYOQ.js +0 -11
  121. package/dist/Clear-7B7CDIPV.js +0 -11
  122. package/dist/Cli-XZ4SJKBZ.js +0 -47
  123. package/dist/CloneMaafApp-7W246RZA.js +0 -12
  124. package/dist/CreateMaafApp-6MSPHUU4.js +0 -22
  125. package/dist/CreateMaafProject-JKMF5TH3.js +0 -11
  126. package/dist/DeleteMaafApp-TFGWGJO3.js +0 -11
  127. package/dist/DeployMaafApp-K2APWFOD.js +0 -8
  128. package/dist/DeployMaafProject-6WRKGIIW.js +0 -11
  129. package/dist/DeploymentApprovals-WTXBXCKE.js +0 -11
  130. package/dist/Dev-CIEWFRXR.js +0 -15
  131. package/dist/FeatureSettings-77LZQSKD.js +0 -11
  132. package/dist/GetMaafBuildStatus-6ZSLIZCH.js +0 -11
  133. package/dist/GetMaafProjectDeployStatus-NZEMVQGJ.js +0 -12
  134. package/dist/InfoMaafApp-7Z6OJCHD.js +0 -13
  135. package/dist/InfoMaafProject-SQYB736C.js +0 -11
  136. package/dist/Init-PBH2IXVK.js +0 -11
  137. package/dist/ListConnectorActions-UERYZ2C7.js +0 -11
  138. package/dist/ListConnectors-2FUTJMHY.js +0 -11
  139. package/dist/ListDeployments-4YWCHVKF.js +0 -11
  140. package/dist/ListMaafApps-ZATO77G3.js +0 -11
  141. package/dist/ListMaafProjects-GNUXZSYL.js +0 -11
  142. package/dist/NodeMsalAuthenticationProvider-5TJFMHR4.js +0 -17
  143. package/dist/Pack-TSFHSTB5.js +0 -8
  144. package/dist/PackProject-T575KJQ4.js +0 -14
  145. package/dist/PlayMaafApp-74TQEAO5.js +0 -8
  146. package/dist/ProjectApprovals-5KLYEM7V.js +0 -13
  147. package/dist/ProjectRoleAssignments-AI2FQ2VX.js +0 -11
  148. package/dist/RefreshDataSource-VARFN3IV.js +0 -11
  149. package/dist/RefreshGitAuth-DC5NAZBJ.js +0 -11
  150. package/dist/Remove-MCQZVI3K.js +0 -11
  151. package/dist/RemoveDeployment-STNFNNZF.js +0 -11
  152. package/dist/ServicePrincipalAuthenticationProvider-7RBHTYYY.js +0 -11
  153. package/dist/SetSetting-CEH44OT3.js +0 -11
  154. package/dist/ShareLinkCreate-ZUVHUQLH.js +0 -11
  155. package/dist/ShareLinkList-IEYU6NZW.js +0 -11
  156. package/dist/ShareLinkRevoke-22RFGOFJ.js +0 -11
  157. package/dist/ShareList-6UWIHPBM.js +0 -11
  158. package/dist/ShareMaafApp-SFNOOMOD.js +0 -11
  159. package/dist/UnshareMaafApp-TU7U3LQ3.js +0 -11
  160. package/dist/chunk-2LDU3F6O.js +0 -11
  161. package/dist/chunk-5MHBEEMZ.js +0 -11
  162. package/dist/chunk-A4PVXTJS.js +0 -13
  163. package/dist/chunk-BA52TY55.js +0 -12
  164. package/dist/chunk-FHE3OXIP.js +0 -11
  165. package/dist/chunk-HOIFXUTG.js +0 -11
  166. package/dist/chunk-NYPHWF7Q.js +0 -32
  167. package/dist/chunk-PLFDUGBA.js +0 -12
  168. package/dist/chunk-RDXQ3ZPT.js +0 -11
  169. package/dist/chunk-TXMTKOEJ.js +0 -12
  170. package/dist/chunk-WV7D7PTW.js +0 -12
  171. package/dist/chunk-WWVAS3DS.js +0 -11
  172. package/dist/chunk-YRPTITKD.js +0 -12
  173. package/dist/rayfin-pack-HOUOLOHQ.js +0 -164
@@ -0,0 +1,11 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{x as a,y as f}from"./chunk-RSHOMYG6.js";import*as u from"fs";var h=128;function l(t){for(let r=1;r<=h;r++){let e=r===1?"":`_${r}`,o=[...t],n=t;for(;n.length+e.length>255||Buffer.byteLength(n+e,"utf8")>255;)o.pop(),n=o.join("");let i=n+e;try{u.lstatSync(i)}catch(c){if(c instanceof Error&&"code"in c&&c.code==="ENOENT")return i;let s=new a("Unable to check available app directories. Check directory permissions or specify a target directory as the first argument.");throw s.cause=c,s}}throw new f(`No available app directory was found after checking the display name and suffixes _2 through _${h}. Specify a target directory as the first argument.`)}function d(t){let r=[...t].some(o=>o.charCodeAt(0)<32||'<>:"/\\|?*'.includes(o)),e=/^(con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\..*)?$/i.test(t);return t.length>0&&t!=="."&&t!==".."&&t.length<=255&&Buffer.byteLength(t,"utf8")<=255&&!r&&!/[. ]$/.test(t)&&!e}export{l as a,d as b};
8
+ /*!
9
+ * Copyright (C) Microsoft Corporation. All rights reserved.
10
+ */
11
+ //# sourceMappingURL=chunk-XJXWNOJR.js.map
@@ -0,0 +1,13 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{h as ve,i as De,k as Ae}from"./chunk-ZBQT5XZJ.js";import{b as be}from"./chunk-Z4UX3JOS.js";import{a as Ue}from"./chunk-XC7Y6E2C.js";import{e as we}from"./chunk-2SRFM7D6.js";import{b as he}from"./chunk-NNYOT7IR.js";import{a as X}from"./chunk-OL6CTXQR.js";import{b as Q}from"./chunk-4PI5THLA.js";import{a as ge}from"./chunk-3YCPXSCO.js";import{e as me,f as fe,m as ye}from"./chunk-R2IECDVU.js";import{b as K,l as ce}from"./chunk-ZLK2CMMJ.js";import{A as k,B as q,E as O,Fa as se,Ka as pe,La as le,Ob as M,Pb as H,Ra as Y,Sa as Z,da as re,l as ie,w as W,x as A,y as p}from"./chunk-RSHOMYG6.js";import{y as f,z as R}from"./chunk-WS6TGUH7.js";import{b as ue,n as z}from"./chunk-UHNOINTO.js";import{a as h}from"./chunk-AICYZHWK.js";import{H as x,I as U,J as de,N as m,P as $,a as C}from"./chunk-PYPCPMCR.js";import{d as xe}from"./chunk-UT667QSU.js";import{promises as Ne}from"node:fs";import*as j from"node:path";import*as Ie from"node:zlib";var Me=10*1024*1024;function Ce(e,t){try{return He(e,t)}catch{return}}function He(e,t){let o=Le(e);if(o<0)return;let a=33639248,n=e.readUInt16LE(o+10),r=e.readUInt32LE(o+16);for(let s=0;s<n;s++){if(e.readUInt32LE(r)!==a)return;let i=e.readUInt16LE(r+10),d=e.readUInt32LE(r+20),c=e.readUInt16LE(r+28),w=e.readUInt16LE(r+30),g=e.readUInt16LE(r+32),l=e.readUInt32LE(r+42);if(e.subarray(r+46,r+46+c).toString("utf8")===t){let I=e.readUInt16LE(l+26),E=e.readUInt16LE(l+28),S=l+30+I+E,u=e.subarray(S,S+d);return i===0?u.toString("utf8"):i===8?Ie.inflateRawSync(u,{maxOutputLength:Me}).toString("utf8"):void 0}r+=46+c+w+g}}function Le(e){let o=Math.max(0,e.length-22-65535);for(let a=e.length-22;a>=o;a--){if(e.readUInt32LE(a)!==101010256)continue;let n=e.readUInt16LE(a+20);if(a+22+n===e.length)return a}return-1}import{promises as ke}from"node:fs";var Ee=xe(Ue(),1);function _e(e){return e?.code==="ENOENT"?"continue":e instanceof Error?e:new Error(String(e))}function je(e){return`zipBuildArtifact: skipping missing entry: ${e?.path??"<unknown>"}`}async function Se(e,t,o){let a=await ke.stat(e).catch(()=>null);if(!a)throw new p(`buildPath not found: ${e}`);if(!a.isDirectory())throw new p(`buildPath is not a directory: ${e}`);let n=await ke.stat(t).catch(()=>null);if(!n||!n.isFile())throw new p(`appConfigPath does not point to a file: ${t}`);let r=o?.maxBytes;return new Promise((s,i)=>{let d=[],c=0,w=!1,g=(0,Ee.default)("zip",{zlib:{level:9}});g.on("data",l=>{if(!w){if(c+=l.length,r!==void 0&&c>r){w=!0,g.abort(),i(new O({capBytes:r,bytes:c}));return}d.push(l)}}),g.on("warning",l=>{if(w)return;let b=_e(l);if(b==="continue"){$(je(l));return}i(b)}),g.on("error",l=>{w||i(l)}),g.on("end",()=>{w||s(Buffer.concat(d))}),g.directory(e,!1),g.file(t,{name:C}),g.finalize()})}var Ge=1200*1e3,Ve=6e4,Je=2e3,We="--no-wait requires deployment tracking, which is not enabled.",Pe=`External artifact deployment is not enabled for this environment.
8
+ To enable it, contact your administrator to turn on the
9
+ AllowExternalArtifactDeployment environment setting.`;function ee(e){return`${(e/(1024*1024)).toFixed(1)} MB`}function te(e,t){return e!==void 0?`Build artifact is ${ee(e)}, which exceeds the ${ee(t)} limit.`:`Build artifact exceeds the ${ee(t)} limit.`}function qe(e){let t=e.id||e.name;if(!t)throw new A("Deploy succeeded but the server response did not include an app identifier.");return{appId:t,displayName:e.displayName,commitHash:e.commitHash??null,appPlayUri:e.appPlayUri??null}}function Re(e){return{appId:e.appId,displayName:e.name,commitHash:e.commitSha,appPlayUri:e.appPlayUri}}function oe(e,t=e.commitSha){return{deploymentId:e.deploymentId,appName:e.appName,commitHash:t}}function ne(e){let t,o;return{onProgress:a=>{e?.(a),a.type==="submitted"&&(o=a.commitSha),a.type==="status"&&a.deploymentStatus==="AwaitingApproval"&&(t=a.deploymentId)},getHandoff:()=>t?{deploymentId:t,commitHash:o}:void 0}}function N(e){if(e.body)try{let t=JSON.parse(e.body);if(typeof t?.error?.message=="string")return t.error.message}catch{}}var Ye={AwaitingApproval:"awaitingApproval",Pending:"inProgress",ValidatingAssets:"inProgress",ValidationCompleted:"inProgress",Running:"inProgress",RollingBack:"inProgress"};function Ze(e){let t=N(e);if(!t)return"unknown";for(let[o,a]of Object.entries(Ye))if(t.includes(`'${o}'`))return a;return"unknown"}function Ke(e,t){let{targetName:o}=t,a=o?` to target '${o}'`:"",n=` --project ${t.projectId??"<project-id>"} --environment-id ${t.environmentId}`,r=o?` --target ${o}`:"",s="The deployment could not be completed.";switch(e){case"awaitingApproval":return`${s} There is an existing deployment${a} awaiting approval. Wait for this deployment to complete or cancel the deployment before attempting to deploy again. Run \`${"ms"} deployment cancel${n}${r}\` to cancel it.`;case"inProgress":return`${s} There is an existing deployment${a} in progress. Wait for this deployment to complete before attempting to deploy again.`;case"unknown":return`${s} There is an existing deployment${a} that has not finished. Wait for this deployment to complete, or cancel it if it is awaiting approval, before attempting to deploy again. Run \`${"ms"} deployment list${n}\` to view it.`}}function ze(e){let t=e.reason==="resultUnavailable"?`Run \`${"ms"} app info\` to view the deployed app.`:e.operationId?`Run \`${"ms"} app info\` to check which commit is live before deploying again.`:void 0;return t&&(e.message=`${e.message} ${t}`),e}function Xe(e,t){if(e instanceof O)return new p(te(e.bytes,e.capBytes),e.errorData,{errorCode:"BuildArtifactTooLarge",telemetryDetails:e.errorData});if(e instanceof re)return ze(e);if(!(e instanceof ie))return null;let o={httpStatus:e.status,serverErrorCode:e.code},a=t.repoType!=="none";if(e.status===400&&e.code==="ArtifactNotAllowedForGitRepo"){let n=N(e);return new k(n?`Artifact upload rejected for this git-backed app: ${n}`:`The server reports this app is git-backed; --artifact uploads are not allowed. Update \`${C}\` so \`repoType\` matches the server's record, then re-run with --commit.`,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"DeploymentModeMismatch",exitCode:1,telemetryDetails:o})}if(e.status===400&&e.code==="CommitNotAllowedForArtifactDeploy")return new p("This app uses external artifact deployment. Pass --artifact <path> instead of --commit.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"DeploymentModeMismatch",telemetryDetails:o});if(e.status===400&&e.code==="InvalidRequestContent")return new p("Invalid deploy request \u2014 verify the environment and app id.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"InvalidDeployRequest",telemetryDetails:o});if(e.status===400&&e.code==="ServicePrincipalNotSupportedForMaafOperations")return new p("Service principal callers are not supported for `ms app deploy`. Use interactive auth.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"UnsupportedCallerType",telemetryDetails:o});if(e.status===400&&e.code==="BadRequest"){let n=N(e);return a?new p(n??"Invalid commit ID. Use a 40-character lowercase hex value.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"InvalidCommitSha",telemetryDetails:o}):new p(`Build artifact rejected: ${n??e.message}`,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"BuildArtifactRejected",telemetryDetails:o})}if(e.status===400&&e.code==="BuildNotAvailable")return new A("No completed build is available for this commit. Run `ms app build` first, or wait for the build to complete before retrying.",void 0,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"BuildNotAvailable",errorCategory:W.Platform,retryable:!0,telemetryDetails:o});if(e.status===403&&e.code==="ExternalArtifactDeploymentDisabled")return new k(Pe,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"ExternalArtifactDeploymentDisabled",exitCode:1,telemetryDetails:Q("deployment_configuration",o)});if(e.status===403&&e.code==="InsufficientPrivilege"){let n=N(e);return new k(n?`${n} Ask an admin to grant the required privilege.`:"You don't have the required privilege to deploy this app. Ask an admin to grant deploy permission on the environment.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"InsufficientPrivilege",exitCode:1,telemetryDetails:o})}if(e.status===403&&e.code==="CodeAppOperationNotAllowedInEnvironment")return new k(Pe,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"CodeAppOperationNotAllowedInEnvironment",exitCode:1,telemetryDetails:Q("environment_configuration",o)});if(e.status===403&&e.code==="Forbidden")return new k("You don't have permission to deploy this app. Ask an admin to grant you Contributor on the repo.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"RepositoryPermissionDenied",exitCode:1,telemetryDetails:o});if(e.status===404&&e.code==="ManagedAppBuildCommitNotFound")return new p("The selected commit was not found in the remote repository. Push the commit to that repository (for example, `git push`), then rerun the deploy command.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:e.code,telemetryDetails:o});if(e.status===404&&e.code==="CommitNotFound"){let n=N(e);return new p(n??"Commit not found on main.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"CommitNotFound",telemetryDetails:o})}if(e.status===404&&e.code==="ApplicationNotFound")return new p(`App '${t.appName}' not found in environment ${t.environmentId}.`);if(e.status===404&&e.code==="PowerConfigNotFound")return new A(`Build output is missing the app config (\`${C}\`). Ensure the config is present at the root of the build output and re-run the build.`);if(e.status===404&&e.code==="OperationNotFound")return new A("Build operation not found on the server. The operation may have been cleaned up; re-run `ms app deploy` to start a fresh build.");if(e.status===409&&e.code==="BuildInProgress")return new A("A build is currently in progress for this app. Run `ms app build-status` to check progress, then retry the deploy.");if(e.status===409&&e.code==="NoGreenBuildAvailable")return new A("No successful build is available to deploy. Push a commit and wait for the build to succeed before retrying.");if(e.status===409&&e.code==="DeploymentTargetBusy"){let n=Ze(e);return new A(Ke(n,t),void 0,{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"DeploymentTargetBusy",errorCategory:W.User,telemetryDetails:{...o,blockingDeploymentState:n}})}if(e.status===409&&e.code==="RepoTypeMismatch"){let n=N(e);return new p(n?`Repo type mismatch: ${n}`:"The app's repoType in ms.config.json doesn't match the server's record. Update ms.config.json to match.")}if(e.status===413)return new A(te(void 0,524288e3));if(e.status===422&&e.code==="ArtifactInvalid"){let n=N(e)??e.message;return new p(`Artifact validation failed: ${n}`)}return e.status===502&&e.code==="MaafBuildServiceUnavailable"?new q("Build service is temporarily unavailable. Try again.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"BuildServiceUnavailable",exitCode:1,retryable:!0,telemetryDetails:o}):e.status===503&&e.code==="AuthorizationCheckFailed"?new q("Authorization service is temporarily unavailable. Try again.",{httpStatus:e.status,serverErrorCode:e.code},{errorCode:"AuthorizationServiceUnavailable",exitCode:1,retryable:!0,telemetryDetails:o}):null}var Qe=3;async function et(e){let{provider:t,appName:o,force:a,forceReauth:n,waitForDeployment:r,onDeployProgress:s}=e,i=e.commitFromFlag,d,c=!1;if(!i){let u=me();if(!u)throw new p("Could not determine the latest commit ID. Use --commit or -c to specify it.");i=u.commitSha,d=u.detached?void 0:u.branch,c=!0}if(c&&!t.isJsonMode()&&m(d?`Using branch '${d}' at commit ${i}.`:`Detached HEAD at commit ${i}.`),!a){let u=ye();if(u&&H().interactive&&!t.isJsonMode()){if($(u),!await K({message:"Deploy anyway?",initialValue:!1}))return m("Deploy cancelled."),null}else if(u)throw new p(`${u} Run again with --force to deploy anyway.`)}let w=M(),g=await se({logger:w,actionsParams:{appName:o,commitSha:i,...n&&{forceReauth:!0}}});if(g===null)t.isJsonMode()||m(`A cached build exists for commit ${i}; `+(r?"deploying it.":"submitting its deployment."));else{t.isJsonMode()||m("Build queued; waiting for completion...");let u=await he({appName:o,commitSha:i,initialWaitMs:g.retryAfterMs??Je,isJsonMode:t.isJsonMode(),deadlineMs:Ge,maxIntervalMs:Ve,spinnerLabel:"Waiting for build..."});if(u.status!=="Succeeded")throw new A(`Unexpected terminal build status "${u.status}". Commit ID: ${i}.`)}let l={appName:o,commitSha:i,...e.targetName!==void 0&&{deploymentName:e.targetName},...n&&{forceReauth:!0},...e.projectId!==void 0&&{projectId:e.projectId}},b=e.projectId!==void 0?{managedDevOpsDeployVersion:Qe}:void 0;if(!r){let u=await le({logger:w,actionsParams:l,...b});return{kind:"submitted",value:oe(u)}}let I=e.useManagedDevOpsDeployment?ne(s):void 0,E;try{E=await pe({logger:w,actionsParams:l,...b,onProgress:I?.onProgress??s,onAppFrameworkProgress:e.onAppFrameworkProgress})}catch(u){let D=I?.getHandoff();if(!D)throw u;return{kind:"awaitingApproval",value:{deploymentId:D.deploymentId,appName:o,commitHash:i}}}let S=I?.getHandoff();return S?{kind:"awaitingApproval",value:{deploymentId:S.deploymentId,appName:o,commitHash:i}}:{kind:"deployed",value:qe(E)}}function tt(e){let t=Ce(e,"manifest.json");if(t===void 0)return;let o;try{o=JSON.parse(t)}catch{return}let a=o?.backends?.default?.kind;if(!(typeof a!="string"||a.toLowerCase()!=="rayfin")&&!z("rayfin"))throw new p(`This artifact packages a Rayfin backend (manifest.json "backends.default.kind": "rayfin"), but the rayfin CLI feature is not enabled in this environment. Enable it (${ue("rayfin")}=1 or \`ms feature enable rayfin\`) before deploying a pre-built Rayfin artifact, or rebuild the artifact without a Rayfin backend.`)}async function ot(e){let t=j.resolve(e.artifactPath);if(j.extname(t).toLowerCase()!==".zip")throw new p(`--artifact must point to a .zip file. Received: ${e.artifactPath}`);let o=await nt(t);if(!o||!o.isFile())throw new p(`--artifact file not found or not a regular file: ${e.artifactPath}`);if(o.size>524288e3)throw new p(te(o.size,524288e3));let a=await Ne.readFile(t);tt(a),e.provider.isJsonMode()||m(e.waitForDeployment?"Uploading artifact and deploying...":"Uploading artifact and submitting deployment...");let n={logger:M(),actionsParams:{appName:e.appName,zipBuffer:a,...e.targetName!==void 0&&{deploymentName:e.targetName}}};if(!e.waitForDeployment){let{commitSha:d,submission:c}=await Z(n);return{kind:"submitted",value:oe(c,d)}}let r=ne(e.onDeployProgress),s;try{s=await Y({...n,onProgress:r.onProgress,onAppFrameworkProgress:e.onAppFrameworkProgress})}catch(d){let c=r.getHandoff();if(!c?.commitHash)throw d;return{kind:"awaitingApproval",value:{deploymentId:c.deploymentId,appName:e.appName,commitHash:c.commitHash}}}let i=r.getHandoff();return i?{kind:"awaitingApproval",value:{deploymentId:i.deploymentId,appName:e.appName,commitHash:s.commitSha}}:{kind:"deployed",value:Re(s)}}async function nt(e){try{return await Ne.stat(e)}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return null;throw t}}async function at(e){if(ve(e.appConfig),!(e.provider.isJsonMode()||!H().interactive)){let d=e.appConfig.buildType==="none"?"package the prebuilt app assets and deploy the resulting artifact":"build the app and deploy the resulting artifact";if(!await K({message:`This will ${d} to environment ${e.environmentId}. Continue?`,initialValue:!1}))return m("Aborted."),null}let{packAppOutputDir:o}=await Ae({quiet:e.provider.isJsonMode()}),a=await Se(o,e.appConfigPath,{maxBytes:524288e3});e.provider.isJsonMode()||m(e.waitForDeployment?"Uploading build artifact and deploying...":"Uploading build artifact and submitting deployment...");let n={logger:M(),actionsParams:{appName:e.appName,zipBuffer:a,...e.targetName!==void 0&&{deploymentName:e.targetName}}};if(!e.waitForDeployment){let{commitSha:d,submission:c}=await Z(n);return{kind:"submitted",value:oe(c,d)}}let r=ne(e.onDeployProgress),s;try{s=await Y({...n,onProgress:r.onProgress,onAppFrameworkProgress:e.onAppFrameworkProgress})}catch(d){let c=r.getHandoff();if(!c?.commitHash)throw d;return{kind:"awaitingApproval",value:{deploymentId:c.deploymentId,appName:e.appName,commitHash:c.commitHash}}}let i=r.getHandoff();return i?{kind:"awaitingApproval",value:{deploymentId:i.deploymentId,appName:e.appName,commitHash:s.commitSha}}:{kind:"deployed",value:Re(s)}}async function _t(e){await it(e,!1,rt)}async function it(e,t,o){ct(e,t),await e.runVerb();let a=t||e.isManagedDevOpsDeploymentEnabled(),n=await e.getOption(f.NoWait.camelName,!0)!==!1;if(!n&&!a)throw new p(We);let r=await e.getOption("commit",!0),s=t?void 0:await e.getOption("artifact",!0);if(r&&s)throw new p("Pass either --commit or --artifact, not both. --commit triggers a build for the commit; --artifact deploys a pre-built zip.");let i=await o(e),{appName:d,tenantId:c,environmentId:w,projectId:g,repoType:l,externalRepoUrl:b,appConfig:I,appConfigPath:E,interactive:S}=i;if(t&&!g)throw new A("Unable to determine the managed project ID to deploy.");let u=t?g:void 0,D=(await e.getOption(f.Target.name,!0))?.trim();if(D!==void 0&&we(D,`--${f.Target.name}`),l==="none"&&r)throw new p("This app uses external artifact deployment. Pass --artifact <path> instead of --commit.");if(s&&l!=="none")throw new p(`--artifact is only valid for apps created with \`repoType: 'none'\`. This app's repoType is \`${l}\`; deploy via \`--commit\` (or omit it to use the current HEAD).`);let Fe=r&&l!=="none"?fe(r,!0):r,$e=await e.getOption(f.OpenBrowser.camelName,!0)??!1,Te=await e.getOption(f.ForceReauth.camelName,!0)??!1,Be=await e.getOption(f.Force.name,!0)??!1,P=e.isJsonMode(),ae=S&&process.stdout.isTTY===!0,G=a&&!P&&n?lt(ae):void 0,V=G?.onProgress,T=n?pt({print:!P,animate:ae}):void 0,J=T?.onProgress;P&&l==="github"&&de({phase:"deploy-validation"});let y;try{if(s)y=await ot({provider:e,appName:d,artifactPath:s,waitForDeployment:n,targetName:D,onDeployProgress:V,onAppFrameworkProgress:J});else if(l==="native"||l==="github")y=await ge(async({isRetry:B})=>{try{return await et({provider:e,appName:d,commitFromFlag:Fe,force:Be,forceReauth:Te&&!B&&l==="github",waitForDeployment:n,targetName:D,projectId:u,useManagedDevOpsDeployment:a,onDeployProgress:V,onAppFrameworkProgress:J})}catch(Oe){throw G?.stop(),T?.stop(),Oe}},{repoType:l,externalRepoUrl:b,tenantId:c,jsonMode:P,openBrowser:$e,verb:t?"project deploy":"app deploy"});else{if(!I||!E)throw new p("`ms project deploy` currently supports only git-backed managed projects.");y=await at({provider:e,appName:d,appConfig:I,appConfigPath:E,environmentId:w,waitForDeployment:n,targetName:D,onDeployProgress:V,onAppFrameworkProgress:J})}}catch(F){let B=Xe(F,{repoType:l,appName:d,environmentId:w,targetName:D,projectId:g});throw B||F}finally{G?.stop(),T?.stop()}if(y===null)return;if(y.kind==="submitted"){P?U({status:"submitted",deploymentId:y.value.deploymentId,appName:y.value.appName,commitHash:y.value.commitHash,repoType:l}):(x(`Deployment submitted for app '${y.value.appName}'.`),m(`Deployment ID: ${y.value.deploymentId}`),m(`Commit: ${y.value.commitHash}`));return}if(y.kind==="awaitingApproval"){P?U({status:"awaitingApproval",deploymentId:y.value.deploymentId,appName:y.value.appName,commitHash:y.value.commitHash,repoType:l}):(x(`Deployment is awaiting approval for app '${y.value.appName}'.`),m(`Deployment ID: ${y.value.deploymentId}`),m(`Commit: ${y.value.commitHash}`));return}let v=st(y.value,T?.getCompletion());if(D&&v.appPlayUri&&(v.appPlayUri=be(v.appPlayUri,"live",void 0,"main",D)??v.appPlayUri),P)U({...v,repoType:l});else{x(`Deployed app '${v.displayName}' (${v.appId}).`),v.commitHash&&m(`Commit: ${v.commitHash}`),v.appPlayUri&&m(`Play URL: ${v.appPlayUri}`),v.operationId&&m(`Operation: ${v.operationId}`);for(let F of v.warnings??[])$(F)}}async function rt(e){let{appConfig:t,fileConfig:o,interactive:a}=H();if(!t)throw new k(`${C} is required. Run this command from a directory created by \`ms app create\`.`);if(!o?.appConfigPath)throw new k(`${C} path is unavailable.`);De(t,s=>new p(s));let n=e.getEnvironmentId();if(!n)throw new p(`No environment ID found. Run this command from a directory with a ${C} (created by \`ms app create\`).`);let r=await e.getTenantIdAsync();if(!r)throw new p("Unable to determine tenant ID. Ensure you are logged in.");return{appName:await ce(e),tenantId:r,environmentId:n,projectId:t.projectId?.trim()||void 0,repoType:t.repoType??"native",externalRepoUrl:t.externalRepoUrl,appConfig:t,appConfigPath:o.appConfigPath,interactive:a}}function st(e,t){return t?{...e,commitHash:t.commitHash,operationId:t.operationId,...t.warnings.length>0&&{warnings:t.warnings}}:e}function pt(e){let t,o=!1,a,n=()=>{o&&(t?.stop(),o=!1)},r=()=>{e.animate&&(t??=new X,t.start("Waiting for deployment..."),o=!0)},s=i=>i==="Pending"||i==="Running"||i==="Recovering";return{onProgress:i=>{switch(i.type){case"accepted":if(a=void 0,!e.print||!s(i.operationStatus))return;n(),m(`Deployment accepted. The service is migrating app data; commit ${i.commitHash} goes live when the migration finishes.`),m(`Operation: ${i.operationId}`),r();return;case"status":if(!e.print)return;n(),m(`Deployment status: ${i.operationStatus}`),s(i.operationStatus)&&r();return;case"completed":n(),a=i;return}},getCompletion:()=>a,stop:n}}function lt(e){let t,o=!1,a,n=()=>{o&&(t?.stop(),o=!1)},r=()=>{e&&(t??=new X,t.start("Waiting for deployment..."),o=!0)};return{onProgress:i=>{let d=dt(i);if(d!==a)switch(a=d,i.type){case"submitting":n(),m("Submitting deployment...");break;case"submitted":n(),m(`Deployment ID: ${i.deploymentId}`),r();break;case"status":switch(n(),m(`Deployment status: ${i.deploymentStatus}`),i.deploymentStatus){case"Pending":case"AwaitingApproval":case"ValidatingAssets":case"ValidationCompleted":case"Running":case"RollingBack":r();break}break}},stop:()=>{n(),a=void 0}}}function dt(e){switch(e.type){case"submitting":return e.type;case"submitted":return`${e.type}:${e.deploymentId}`;case"status":return`${e.type}:${e.deploymentId}:${e.deploymentStatus}`}}function ct(e,t){let o=z("alm"),a=t?h.project.deploy:h.app.deploy;e.setDescription(a.description),e.addExamples(t?h.project.deploy.examples:o?h.app.deploy.examples:h.app.deploy.examples.filter(n=>!n.includes(" --target "))),e.addOptions([...t?[{flags:{key:R.ProjectId.name,alias:R.ProjectId.alias},description:h.project.deploy.options.projectId,optionalInNonInteractive:!0},{flags:{key:R.EnvironmentId.name,alias:R.EnvironmentId.alias},env:R.EnvironmentId.envVar,description:h.project.deploy.options.environmentId,optionalInNonInteractive:!0}]:[{flags:{key:f.AppName.name},env:f.AppName.envVar,description:h.app.deploy.options.app,optionalInNonInteractive:!0}],{flags:{key:f.CommitSha.name,alias:f.CommitSha.alias},env:f.CommitSha.envVar,description:h.app.deploy.options.commit,optionalInNonInteractive:!0},...t?[]:[{flags:{key:f.Artifact.name},env:f.Artifact.envVar,description:h.app.deploy.options.artifact,optionalInNonInteractive:!0}],...t||o?[{flags:{key:f.Target.name},env:f.Target.envVar,description:h.app.deploy.options.target,optionalInNonInteractive:!0}]:[]]),e.addSwitch({flags:{key:f.OpenBrowser.name},description:h.app.deploy.options.openBrowser}),e.addSwitch({flags:{key:f.Force.name},description:h.app.deploy.options.force}),e.addSwitch({flags:{key:f.NoWait.name},description:t?h.project.deploy.options.noWait:h.app.deploy.options.noWait}),e.addSwitch({flags:{key:f.ForceReauth.name},description:h.app.deploy.options.forceReauth})}export{_t as a,it as b};
10
+ /*!
11
+ * Copyright (C) Microsoft Corporation. All rights reserved.
12
+ */
13
+ //# sourceMappingURL=chunk-Y2D37EFX.js.map
@@ -4,8 +4,8 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{c as r,m as i}from"./chunk-FHE3OXIP.js";import{K as o}from"./chunk-KKC5ZK4D.js";import*as e from"fs";import*as u from"path";function s(){return u.join(r,i)}function g(){o(`The CLI's settings file is at ${s()}.`)}function f(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function a(){let t=s();if(!e.existsSync(t))return;let n=JSON.parse(e.readFileSync(t,"utf-8"));if(!f(n))throw new Error(`${i} must contain a JSON object.`);return n}function S(t){return{errorName:t instanceof Error?t.name:typeof t,errorCode:t?.code}}function d(t){let n=t(a()??{});return e.mkdirSync(r,{recursive:!0}),e.writeFileSync(s(),JSON.stringify(n,null,2),"utf-8"),n}export{s as a,g as b,f as c,a as d,S as e,d as f};
7
+ import{c as r,m as i}from"./chunk-DLUQVMUE.js";import{P as o}from"./chunk-PYPCPMCR.js";import*as e from"fs";import*as u from"path";function s(){return u.join(r,i)}function g(){o(`The CLI's settings file is at ${s()}.`)}function f(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function a(){let t=s();if(!e.existsSync(t))return;let n=JSON.parse(e.readFileSync(t,"utf-8"));if(!f(n))throw new Error(`${i} must contain a JSON object.`);return n}function S(t){return{errorName:t instanceof Error?t.name:typeof t,errorCode:t?.code}}function d(t){let n=t(a()??{});return e.mkdirSync(r,{recursive:!0}),e.writeFileSync(s(),JSON.stringify(n,null,2),"utf-8"),n}export{s as a,g as b,f as c,a as d,S as e,d as f};
8
8
  /*!
9
9
  * Copyright (C) Microsoft Corporation. All rights reserved.
10
10
  */
11
- //# sourceMappingURL=chunk-RFLXPXBN.js.map
11
+ //# sourceMappingURL=chunk-YEWRCEPT.js.map
@@ -0,0 +1,12 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{b as I,e as D}from"./chunk-2SRFM7D6.js";import{e as U}from"./chunk-R2IECDVU.js";import{l as L,m as R}from"./chunk-ZLK2CMMJ.js";import{Na as N,Ob as C,y as l}from"./chunk-RSHOMYG6.js";import{x as o}from"./chunk-WS6TGUH7.js";import{n as E}from"./chunk-UHNOINTO.js";import{a as r}from"./chunk-AICYZHWK.js";import{H as A,I as M,N as b,P as $}from"./chunk-PYPCPMCR.js";import x from"open";async function K(e){H(e),await e.runVerb();let t=await L(e),s=await R(e),d=await e.getTenantIdAsync();if(!d)throw new l("Unable to determine tenant ID. Ensure you are logged in.");let f=await e.getOption(o.NoBrowser.camelName,!0)===!1,g=e.isJsonMode(),a=await e.getOption(o.CommitSha.name,!0),i=await e.getOption(o.Branch.name,!0),w=await e.getOption(o.Mode.name,!0),n=await e.getOption(o.Target.name,!0),c=n===void 0?void 0:D(n);if(c&&(w||a||i))throw new l("--target cannot be used with --mode, --commit, or --branch.");let m=k(w);if(!c&&m==="live"&&(a||i))throw new l("--commit and --branch are only valid with --mode preview.");if(a&&i)throw new l("--commit and --branch cannot be used together.");let u=[];if(m==="preview"&&!a&&!i){let p=U();if(p&&!p.detached&&p.branch)i=p.branch;else{i="main";let y=p?.detached?"HEAD is detached":"Git is unavailable or the current directory has no readable Git HEAD";u.push(`Cannot identify the current branch because ${y}. Falling back to 'main'.`)}}await B({appName:t,environmentId:s,tenantId:d,noBrowser:f,isJson:g,mode:m,commitId:a,branch:i,target:c,warnings:u})}async function B(e){let{appName:t,environmentId:s,tenantId:d,noBrowser:f,isJson:g,mode:a,commitId:i,branch:w,target:n,warnings:c}=e,m=await N({tenantId:d,environmentId:s,logger:C(),actionsParams:{appName:t}}),u=n!==void 0&&n!==I,p=u?m.stages?.find(v=>v.stageName.toLowerCase()===n):void 0;if(u&&!p)throw new l(`Deployment target '${n}' does not exist for app '${t}'. Run 'ms app add config --target ${n}' to create it.`);let y=p?p.commitHash:m.commitHash,h=O(m.appPlayUri,a,i,w,u?n:void 0);if(!h)throw new l(!n&&a==="live"?`No live build is available for app '${t}' yet. Run 'ms app deploy' to deploy one, then re-run 'ms app play'.`:n?`No play URL is available for app '${t}' on target '${n}'.`:`No appPlayUri is available for app '${t}' in environment '${s}'.`);if(a==="live"&&!y&&c.push(`App '${t}' has not been deployed to target '${n??I}'. Run 'ms app deploy${n?` --target ${n}`:""}' to deploy it.`),g){M({appName:t,mode:n?"target":a,...n?{target:n}:{},url:h,commitHash:y??null,...c.length>0?{warnings:c}:{}});return}for(let v of c)$(v);let S=a==="preview"?i?` at commit '${i}'`:` at branch '${w}'`:"";A(`${n?"Target":a==="live"?"Live":"Preview"} URL for '${m.displayName??t}'${S}: ${h}`),!n&&a==="live"&&$("Live does not auto-update. Run 'ms app deploy' to publish a new version to the live URL."),await T(h,f)}function O(e,t,s,d="main",f){if(!e)return;if(f){let a;try{a=new URL(e)}catch{throw new l("The app play URL returned by the service is not a valid absolute URL.")}return a.pathname=`${a.pathname.replace(/\/$/,"")}/target/${encodeURIComponent(f)}`,a.toString()}if(t==="live")return e;let g=e.replace(/\/$/,"");return s?`${g}/commit/${s}`:`${g}/branch/${encodeURIComponent(d)}`}async function T(e,t){if(!t){b(`Opening browser at ${e}`);try{await x(e,{wait:!1})}catch{b(`Could not open browser automatically. Please navigate to:
8
+ ${e}`)}}}function k(e){let t=(e??o.Mode.defaultValue).trim().toLowerCase();if(t!=="live"&&t!=="preview")throw new l(`Invalid --mode value '${e}'. Expected 'live' or 'preview'.`);return t}function H(e){let t=E("alm");e.setDescription(r.app.play.description),e.addExamples(t?r.app.play.examples:r.app.play.examples.filter(s=>!s.includes(" --target "))),e.addSwitch({flags:{key:o.NoBrowser.name},description:r.app.play.options.noBrowser}),e.addOptions([{flags:{key:o.AppName.name},env:o.AppName.envVar,description:r.app.play.options.app,optionalInNonInteractive:!0},{flags:{key:o.Mode.name,alias:o.Mode.alias},env:o.Mode.envVar,description:r.app.play.options.mode,optionalInNonInteractive:!0},...t?[{flags:{key:o.Target.name},description:r.app.play.options.target,optionalInNonInteractive:!0}]:[],{flags:{key:o.CommitSha.name,alias:o.CommitSha.alias},env:o.CommitSha.envVar,description:r.app.play.options.commit,optionalInNonInteractive:!0},{flags:{key:o.Branch.name},description:r.app.play.options.branch,optionalInNonInteractive:!0}])}export{K as a,O as b};
9
+ /*!
10
+ * Copyright (C) Microsoft Corporation. All rights reserved.
11
+ */
12
+ //# sourceMappingURL=chunk-Z4UX3JOS.js.map
@@ -0,0 +1,32 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{a as gt,b as Ee,c as _u,d as pe,e as de,f as me,g as ge,h as Be,i as he,j as ye,k as we}from"./chunk-XC7Y6E2C.js";import{a as le}from"./chunk-OL6CTXQR.js";import{a as mt}from"./chunk-TYRVM4PP.js";import{a as Ce}from"./chunk-A5INC5TY.js";import{A as g,Pb as Fe,b as oe,x as K}from"./chunk-RSHOMYG6.js";import{n as fe}from"./chunk-UHNOINTO.js";import{a as Nu}from"./chunk-DLUQVMUE.js";import{k as se}from"./chunk-C7UWPNC3.js";import{a as Ou}from"./chunk-AICYZHWK.js";import{B as De,C as $u,H as ce,I as Ae,N as X,P as Fu,a as xu,d as H,l as ee,n as te,r as ne,v as re,w as ie,x as ae}from"./chunk-PYPCPMCR.js";import{b as tu,d as ku}from"./chunk-UT667QSU.js";var Se=tu((bn,Cu)=>{Cu.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;Cu.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;Cu.exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/});var Mu=tu((Sn,ve)=>{var Iu=Se();ve.exports={isSpaceSeparator(u){return typeof u=="string"&&Iu.Space_Separator.test(u)},isIdStartChar(u){return typeof u=="string"&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u==="$"||u==="_"||Iu.ID_Start.test(u))},isIdContinueChar(u){return typeof u=="string"&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||u==="$"||u==="_"||u==="\u200C"||u==="\u200D"||Iu.ID_Continue.test(u))},isDigit(u){return typeof u=="string"&&/[0-9]/.test(u)},isHexDigit(u){return typeof u=="string"&&/[0-9A-Fa-f]/.test(u)}}});var Oe=tu((vn,$e)=>{var N=Mu(),Tu,O,J,lu,W,R,x,Vu,ru;$e.exports=function(e,n){Tu=String(e),O="start",J=[],lu=0,W=1,R=0,x=void 0,Vu=void 0,ru=void 0;do x=yt(),bt[O]();while(x.type!=="eof");return typeof n=="function"?ju({"":ru},"",n):ru};function ju(u,e,n){let t=u[e];if(t!=null&&typeof t=="object")if(Array.isArray(t))for(let i=0;i<t.length;i++){let a=String(i),D=ju(t,a,n);D===void 0?delete t[a]:Object.defineProperty(t,a,{value:D,writable:!0,enumerable:!0,configurable:!0})}else for(let i in t){let a=ju(t,i,n);a===void 0?delete t[i]:Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0})}return n.call(u,e,t)}var F,s,nu,V,l;function yt(){for(F="default",s="",nu=!1,V=1;;){l=z();let u=Ne[F]();if(u)return u}}function z(){if(Tu[lu])return String.fromCodePoint(Tu.codePointAt(lu))}function r(){let u=z();return u===`
8
+ `?(W++,R=0):u?R+=u.length:R++,u&&(lu+=u.length),u}var Ne={default(){switch(l){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
9
+ `:case"\r":case"\u2028":case"\u2029":r();return;case"/":r(),F="comment";return;case void 0:return r(),y("eof")}if(N.isSpaceSeparator(l)){r();return}return Ne[O]()},comment(){switch(l){case"*":r(),F="multiLineComment";return;case"/":r(),F="singleLineComment";return}throw w(r())},multiLineComment(){switch(l){case"*":r(),F="multiLineCommentAsterisk";return;case void 0:throw w(r())}r()},multiLineCommentAsterisk(){switch(l){case"*":r();return;case"/":r(),F="default";return;case void 0:throw w(r())}r(),F="multiLineComment"},singleLineComment(){switch(l){case`
10
+ `:case"\r":case"\u2028":case"\u2029":r(),F="default";return;case void 0:return r(),y("eof")}r()},value(){switch(l){case"{":case"[":return y("punctuator",r());case"n":return r(),Z("ull"),y("null",null);case"t":return r(),Z("rue"),y("boolean",!0);case"f":return r(),Z("alse"),y("boolean",!1);case"-":case"+":r()==="-"&&(V=-1),F="sign";return;case".":s=r(),F="decimalPointLeading";return;case"0":s=r(),F="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":s=r(),F="decimalInteger";return;case"I":return r(),Z("nfinity"),y("numeric",1/0);case"N":return r(),Z("aN"),y("numeric",NaN);case'"':case"'":nu=r()==='"',s="",F="string";return}throw w(r())},identifierNameStartEscape(){if(l!=="u")throw w(r());r();let u=Lu();switch(u){case"$":case"_":break;default:if(!N.isIdStartChar(u))throw ke();break}s+=u,F="identifierName"},identifierName(){switch(l){case"$":case"_":case"\u200C":case"\u200D":s+=r();return;case"\\":r(),F="identifierNameEscape";return}if(N.isIdContinueChar(l)){s+=r();return}return y("identifier",s)},identifierNameEscape(){if(l!=="u")throw w(r());r();let u=Lu();switch(u){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!N.isIdContinueChar(u))throw ke();break}s+=u,F="identifierName"},sign(){switch(l){case".":s=r(),F="decimalPointLeading";return;case"0":s=r(),F="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":s=r(),F="decimalInteger";return;case"I":return r(),Z("nfinity"),y("numeric",V*(1/0));case"N":return r(),Z("aN"),y("numeric",NaN)}throw w(r())},zero(){switch(l){case".":s+=r(),F="decimalPoint";return;case"e":case"E":s+=r(),F="decimalExponent";return;case"x":case"X":s+=r(),F="hexadecimal";return}return y("numeric",V*0)},decimalInteger(){switch(l){case".":s+=r(),F="decimalPoint";return;case"e":case"E":s+=r(),F="decimalExponent";return}if(N.isDigit(l)){s+=r();return}return y("numeric",V*Number(s))},decimalPointLeading(){if(N.isDigit(l)){s+=r(),F="decimalFraction";return}throw w(r())},decimalPoint(){switch(l){case"e":case"E":s+=r(),F="decimalExponent";return}if(N.isDigit(l)){s+=r(),F="decimalFraction";return}return y("numeric",V*Number(s))},decimalFraction(){switch(l){case"e":case"E":s+=r(),F="decimalExponent";return}if(N.isDigit(l)){s+=r();return}return y("numeric",V*Number(s))},decimalExponent(){switch(l){case"+":case"-":s+=r(),F="decimalExponentSign";return}if(N.isDigit(l)){s+=r(),F="decimalExponentInteger";return}throw w(r())},decimalExponentSign(){if(N.isDigit(l)){s+=r(),F="decimalExponentInteger";return}throw w(r())},decimalExponentInteger(){if(N.isDigit(l)){s+=r();return}return y("numeric",V*Number(s))},hexadecimal(){if(N.isHexDigit(l)){s+=r(),F="hexadecimalInteger";return}throw w(r())},hexadecimalInteger(){if(N.isHexDigit(l)){s+=r();return}return y("numeric",V*Number(s))},string(){switch(l){case"\\":r(),s+=wt();return;case'"':if(nu)return r(),y("string",s);s+=r();return;case"'":if(!nu)return r(),y("string",s);s+=r();return;case`
11
+ `:case"\r":throw w(r());case"\u2028":case"\u2029":St(l);break;case void 0:throw w(r())}s+=r()},start(){switch(l){case"{":case"[":return y("punctuator",r())}F="value"},beforePropertyName(){switch(l){case"$":case"_":s=r(),F="identifierName";return;case"\\":r(),F="identifierNameStartEscape";return;case"}":return y("punctuator",r());case'"':case"'":nu=r()==='"',F="string";return}if(N.isIdStartChar(l)){s+=r(),F="identifierName";return}throw w(r())},afterPropertyName(){if(l===":")return y("punctuator",r());throw w(r())},beforePropertyValue(){F="value"},afterPropertyValue(){switch(l){case",":case"}":return y("punctuator",r())}throw w(r())},beforeArrayValue(){if(l==="]")return y("punctuator",r());F="value"},afterArrayValue(){switch(l){case",":case"]":return y("punctuator",r())}throw w(r())},end(){throw w(r())}};function y(u,e){return{type:u,value:e,line:W,column:R}}function Z(u){for(let e of u){if(z()!==e)throw w(r());r()}}function wt(){switch(z()){case"b":return r(),"\b";case"f":return r(),"\f";case"n":return r(),`
12
+ `;case"r":return r(),"\r";case"t":return r()," ";case"v":return r(),"\v";case"0":if(r(),N.isDigit(z()))throw w(r());return"\0";case"x":return r(),Pt();case"u":return r(),Lu();case`
13
+ `:case"\u2028":case"\u2029":return r(),"";case"\r":return r(),z()===`
14
+ `&&r(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw w(r());case void 0:throw w(r())}return r()}function Pt(){let u="",e=z();if(!N.isHexDigit(e)||(u+=r(),e=z(),!N.isHexDigit(e)))throw w(r());return u+=r(),String.fromCodePoint(parseInt(u,16))}function Lu(){let u="",e=4;for(;e-- >0;){let n=z();if(!N.isHexDigit(n))throw w(r());u+=r()}return String.fromCodePoint(parseInt(u,16))}var bt={start(){if(x.type==="eof")throw Q();Ru()},beforePropertyName(){switch(x.type){case"identifier":case"string":Vu=x.value,O="afterPropertyName";return;case"punctuator":fu();return;case"eof":throw Q()}},afterPropertyName(){if(x.type==="eof")throw Q();O="beforePropertyValue"},beforePropertyValue(){if(x.type==="eof")throw Q();Ru()},beforeArrayValue(){if(x.type==="eof")throw Q();if(x.type==="punctuator"&&x.value==="]"){fu();return}Ru()},afterPropertyValue(){if(x.type==="eof")throw Q();switch(x.value){case",":O="beforePropertyName";return;case"}":fu()}},afterArrayValue(){if(x.type==="eof")throw Q();switch(x.value){case",":O="beforeArrayValue";return;case"]":fu()}},end(){}};function Ru(){let u;switch(x.type){case"punctuator":switch(x.value){case"{":u={};break;case"[":u=[];break}break;case"null":case"boolean":case"numeric":case"string":u=x.value;break}if(ru===void 0)ru=u;else{let e=J[J.length-1];Array.isArray(e)?e.push(u):Object.defineProperty(e,Vu,{value:u,writable:!0,enumerable:!0,configurable:!0})}if(u!==null&&typeof u=="object")J.push(u),Array.isArray(u)?O="beforeArrayValue":O="beforePropertyName";else{let e=J[J.length-1];e==null?O="end":Array.isArray(e)?O="afterArrayValue":O="afterPropertyValue"}}function fu(){J.pop();let u=J[J.length-1];u==null?O="end":Array.isArray(u)?O="afterArrayValue":O="afterPropertyValue"}function w(u){return Eu(u===void 0?`JSON5: invalid end of input at ${W}:${R}`:`JSON5: invalid character '${xe(u)}' at ${W}:${R}`)}function Q(){return Eu(`JSON5: invalid end of input at ${W}:${R}`)}function ke(){return R-=5,Eu(`JSON5: invalid identifier character at ${W}:${R}`)}function St(u){console.warn(`JSON5: '${xe(u)}' in strings is not valid ECMAScript; consider escaping`)}function xe(u){let e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[u])return e[u];if(u<" "){let n=u.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return u}function Eu(u){let e=new SyntaxError(u);return e.lineNumber=W,e.columnNumber=R,e}});var Ie=tu((kn,_e)=>{var Ju=Mu();_e.exports=function(e,n,t){let i=[],a="",D,c,p="",E;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(t=n.space,E=n.quote,n=n.replacer),typeof n=="function")c=n;else if(Array.isArray(n)){D=[];for(let C of n){let h;typeof C=="string"?h=C:(typeof C=="number"||C instanceof String||C instanceof Number)&&(h=String(C)),h!==void 0&&D.indexOf(h)<0&&D.push(h)}}return t instanceof Number?t=Number(t):t instanceof String&&(t=String(t)),typeof t=="number"?t>0&&(t=Math.min(10,Math.floor(t)),p=" ".substr(0,t)):typeof t=="string"&&(p=t.substr(0,10)),B("",{"":e});function B(C,h){let o=h[C];switch(o!=null&&(typeof o.toJSON5=="function"?o=o.toJSON5(C):typeof o.toJSON=="function"&&(o=o.toJSON(C))),c&&(o=c.call(h,C,o)),o instanceof Number?o=Number(o):o instanceof String?o=String(o):o instanceof Boolean&&(o=o.valueOf()),o){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof o=="string")return b(o,!1);if(typeof o=="number")return String(o);if(typeof o=="object")return Array.isArray(o)?yu(o):M(o)}function b(C){let h={"'":.1,'"':.2},o={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},m="";for(let f=0;f<C.length;f++){let S=C[f];switch(S){case"'":case'"':h[S]++,m+=S;continue;case"\0":if(Ju.isDigit(C[f+1])){m+="\\x00";continue}}if(o[S]){m+=o[S];continue}if(S<" "){let U=S.charCodeAt(0).toString(16);m+="\\x"+("00"+U).substring(U.length);continue}m+=S}let v=E||Object.keys(h).reduce((f,S)=>h[f]<h[S]?f:S);return m=m.replace(new RegExp(v,"g"),o[v]),v+m+v}function M(C){if(i.indexOf(C)>=0)throw TypeError("Converting circular structure to JSON5");i.push(C);let h=a;a=a+p;let o=D||Object.keys(C),m=[];for(let f of o){let S=B(f,C);if(S!==void 0){let U=L(f)+":";p!==""&&(U+=" "),U+=S,m.push(U)}}let v;if(m.length===0)v="{}";else{let f;if(p==="")f=m.join(","),v="{"+f+"}";else{let S=`,
15
+ `+a;f=m.join(S),v=`{
16
+ `+a+f+`,
17
+ `+h+"}"}}return i.pop(),a=h,v}function L(C){if(C.length===0)return b(C,!0);let h=String.fromCodePoint(C.codePointAt(0));if(!Ju.isIdStartChar(h))return b(C,!0);for(let o=h.length;o<C.length;o++)if(!Ju.isIdContinueChar(String.fromCodePoint(C.codePointAt(o))))return b(C,!0);return C}function yu(C){if(i.indexOf(C)>=0)throw TypeError("Converting circular structure to JSON5");i.push(C);let h=a;a=a+p;let o=[];for(let v=0;v<C.length;v++){let f=B(String(v),C);o.push(f!==void 0?f:"null")}let m;if(o.length===0)m="[]";else if(p==="")m="["+o.join(",")+"]";else{let v=`,
18
+ `+a,f=o.join(v);m=`[
19
+ `+a+f+`,
20
+ `+h+"]"}return i.pop(),a=h,m}}});var Re=tu((Nn,Me)=>{var vt=Oe(),kt=Ie(),Nt={parse:vt,stringify:kt};Me.exports=Nt});import*as d from"node:fs/promises";import*as A from"node:path";var Pe="0.0",Bt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,be=H.object({appId:H.string().regex(Bt),path:H.string()}).refine(({appId:u,path:e})=>e===`apps/${u}`,{message:"Packed app path must be the portable relative path apps/<appId>.",path:["path"]}),ht=H.object({cliVersion:H.string(),manifestVersion:H.literal(Pe),apps:H.array(be)});var At=ku(Re(),1);import*as j from"node:path";var pu={"@microsoft/cmr-apps/data":"@microsoft/cmr-functions/data","@microsoft/managed-apps/data":"@microsoft/cmr-functions/data"},Te="@config/dataSources";async function je(u){let{projectRoot:e,functions:n}=u;if(n.length===0)return new Map;let t=await import("esbuild").catch(a=>{throw new K(`esbuild is required to pack functions but could not be loaded: ${a.message}`)}),i=await Promise.all(n.map(async a=>{let c=(await t.build({entryPoints:[a.absPath],bundle:!0,write:!1,format:"esm",platform:"neutral",target:"es2022",external:[...Object.values(pu),Te],alias:pu,plugins:[xt(e),$t(e)],logLevel:"silent"})).outputFiles?.[0];if(!c)throw new K(`Failed to bundle function ${a.relPath}: esbuild produced no output`);return[a.relPath,c.text]}));return new Map(i)}function xt(u){let e=j.resolve(u,"generated/dataSources.ts");return{name:"external-data-sources",setup(n){n.onResolve({filter:/(^|\/)dataSources$/},t=>!t.path.startsWith(".")||j.resolve(j.dirname(t.importer),t.path)+".ts"!==e?null:{path:Te,external:!0})}}}function $t(u){let e=j.resolve(u,"generated");return{name:"allowlist-imports",setup(n){n.onResolve({filter:/.*/},t=>{if(t.kind==="entry-point")return null;if(t.path.startsWith(".")){let i=j.resolve(j.dirname(t.importer),t.path);return i===e||i.startsWith(e+j.sep)?null:{errors:[{text:`Relative import '${t.path}' is outside the allowed 'generated/' folder`}]}}return pu[t.path]?null:{errors:[{text:`Import '${t.path}' is not on the allowlist. Allowed: relative imports into 'generated/' and ${Object.keys(pu).map(i=>`'${i}'`).join(", ")}.`}]}})}}}var Ve=ku(gt(),1);import*as du from"node:fs/promises";import*as Le from"node:path";var zu="functions.zip",Je={archive:"zip",compression:"deflate"};async function ze(u){let e=[];return await qe(u,"",e),e.sort((n,t)=>n.relPath.localeCompare(t.relPath)),e}async function qe(u,e,n){let t=await du.readdir(u,{withFileTypes:!0});for(let i of t){let a=e?`${e}/${i.name}`:i.name,D=Le.join(u,i.name);i.isDirectory()?await qe(D,a,n):i.isFile()&&Ot(i.name)&&n.push({relPath:a,absPath:D})}}function Ot(u){return u.endsWith(".ts")&&!u.endsWith(".d.ts")&&!u.endsWith(".test.ts")&&!u.endsWith(".spec.ts")}async function Ue(u){let e;try{e=await du.stat(u)}catch{throw new g(`functions.baseDirectory does not exist: ${u}`)}if(!e.isDirectory())throw new g(`functions.baseDirectory is not a directory: ${u}`)}function He(u,e){let n={};for(let t of u){let i=`${e}/${Ke(t.relPath)}`;n[`/${i}`]={type:"function",path:`${i}.js`}}return n}function Ke(u){return u.slice(0,-3)}async function We(u){let{baseDirName:e,functions:n,bundles:t,manifestContent:i,dataSourcesJson:a}=u;return new Promise((D,c)=>{let p=[],E=(0,Ve.default)("zip",{zlib:{level:9}});E.on("data",B=>p.push(B)),E.on("warning",c),E.on("error",c),E.on("end",()=>D(Buffer.concat(p)));for(let B of n){let b=t.get(B.relPath);if(b===void 0){c(new Error(`Missing bundled output for function ${B.relPath}`));return}let M=Ke(B.relPath);E.append(b,{name:`${e}/${M}.js`})}E.append(i,{name:"manifest.json"}),a!==void 0&&E.append(a,{name:"dataSources.json"}),E.finalize()})}import*as gu from"node:fs";import*as P from"node:path";var Ge="packed",Ye="apps",Uu="client",_t="project.manifest.json";function qu(u,e,n=!1){let t=P.relative(u,e);return t.length===0?n:t!==".."&&!t.startsWith(`..${P.sep}`)&&!P.isAbsolute(t)}function Xe(u,e,n=P.join(u,`.${"ms"}`)){if(!e)return P.join(Bu(u),Ge);let t=P.resolve(e),i=P.resolve(n),a=mu(t),D=mu(i);if(!qu(i,t)||!qu(D,a))throw new g(`Packed folder override must be inside ${i}: ${t}`);return t}function Bu(u){let e=mu(u),n=mu(P.join(u,`.${"ms"}`));if(!qu(e,n))throw new g(`The .${"ms"} directory must resolve inside the project root: ${u}`);return n}function mu(u){let e=P.resolve(u),n=[];for(;!It(e);){let t=P.dirname(e);if(t===e)break;n.unshift(P.basename(e)),e=t}return P.resolve(gu.realpathSync.native(e),...n)}function It(u){try{return gu.lstatSync(u),!0}catch(e){if(e.code==="ENOENT")return!1;throw e}}function Hu(u,e){return P.join(u,Ye,e)}function Ze(u,e){return P.join(Hu(u,e),Uu)}function Tn(u){return P.posix.join(Ye,u)}function jn(u){return P.join(u,_t)}function Ln(u,e){return P.join(Bu(u),`${Ge}-staging-${e}`)}function Qe(u,e){if(!u)throw new g(`appId is required in ${e}`);if(!ee(u))throw new g(`appId in ${e} must be a valid GUID`);return u.toLowerCase()}var nt=ku(mt(),1);import*as $ from"node:fs/promises";import*as q from"node:path";var ut="package-inventory.json",Mt=1024*1024,Rt=10*1024*1024,Tt=1e4,et=200,jt=64*1024,Lt=/^(?:@[a-z0-9~][a-z0-9._~-]*\/)?[a-z0-9~][a-z0-9._~-]*$/i,_=class extends Error{constructor(n){super(n);this.reason=n}reason};function Ku(u){return{schemaVersion:1,status:"unavailable",reason:u}}function au(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function rt(u){return typeof u=="string"&&u.length<=214&&Lt.test(u)}async function tt(u,e){if(!(await $.stat(u)).isFile())throw new _("invalid-package-manifest");let n=await $.open(u,"r");try{let t=await n.stat();if(!t.isFile())throw new _("invalid-package-manifest");if(t.size>Mt)throw new _("package-manifest-too-large");if(e.bytes+=t.size,e.bytes>Rt)throw new _("manifest-data-too-large");let i=Buffer.alloc(t.size+1),a=0;for(;a<i.length;){let{bytesRead:D}=await n.read(i,a,i.length-a,null);if(D===0)break;a+=D}if(a!==t.size)throw new _("read-failed");try{return JSON.parse(i.subarray(0,a).toString("utf8"))}catch{throw new _("invalid-package-manifest")}}finally{await n.close()}}function Vt(u){if(!au(u))throw new _("invalid-production-dependencies");let e=new Map;for(let n of["dependencies","optionalDependencies"]){let t=u[n];if(t!==void 0){if(!au(t))throw new _("invalid-production-dependencies");for(let[i,a]of Object.entries(t)){if(!rt(i)||typeof a!="string")throw new _("invalid-production-dependencies");if(e.set(i,n==="optionalDependencies"),e.size>Tt)throw new _("too-many-packages")}}}return e}async function Jt(u){try{let e=Vt(await tt(q.join(u,"package.json"),{bytes:0})),n=q.join(u,"node_modules");if(e.size>0)try{if(!(await $.stat(n)).isDirectory())return Ku("invalid-node-modules")}catch(c){return Ku(au(c)&&c.code==="ENOENT"?"missing-node-modules":"read-failed")}let t=new Map,i={bytes:0},a=0;for(let c of[...e.keys()].sort()){let p=e.get(c)===!0,E=q.join(n,c);try{await $.lstat(E)}catch(L){if(!au(L)||L.code!=="ENOENT")throw L;p||a++;continue}let B=await tt(q.join(E,"package.json"),i);if(!au(B)||!rt(B.name)||typeof B.version!="string"||B.version.length>256||(0,nt.valid)(B.version)===null)throw new _("invalid-package-manifest");let b=JSON.stringify([B.name,B.version]),M=t.get(b);M?M.optional=M.optional&&p:t.set(b,{name:B.name,version:B.version,optional:p})}let D={schemaVersion:1,status:"available",scope:"directProduction",totalPackageCount:t.size+a,truncated:t.size>et,unresolvedPackageCount:a,packages:[...t.values()].slice(0,et)};for(;Buffer.byteLength(JSON.stringify(D)+`
21
+ `)>jt;)D.packages.pop(),D.truncated=!0;return D}catch(e){return Ku(e instanceof _?e.reason:"read-failed")}}async function it(u,e){let n=await Jt(u);n.status==="unavailable"&&Fu(`Package inventory is unavailable (${n.reason}).`);let t;try{let i=q.join(u,`.${"ms"}`);await $.mkdir(i,{recursive:!0}),t=await $.mkdtemp(q.join(i,"package-inventory-"));let a=q.join(t,ut);await $.writeFile(a,JSON.stringify(n)+`
22
+ `),await $.rename(a,q.join(e,ut))}catch{Fu("Could not write package inventory; packing will continue.")}finally{if(t!==void 0)try{await $.rm(t,{recursive:!0,force:!0})}catch{Fu("Could not remove temporary package inventory outside the packed output.")}}}function zt(u,e,n){let t=0,i=!1,a=Promise.resolve();return{write(D){if(i)return;let c=e-t;if(c<=0)return;let p=Buffer.from(`${D}
23
+ `,"utf8"),E=p.length<=c?p:p.subarray(0,c);t+=E.length,a=a.then(async()=>{if(!i)try{await d.appendFile(u,E)}catch(B){i=!0,n?.(B)}})},drainAsync:()=>a}}async function qt(u,e){try{let n=(await d.stat(u)).size;return Math.max(0,e-n)}catch(n){if(typeof n=="object"&&n!==null&&"code"in n&&n.code==="ENOENT")return e;throw n}}function Ut(u,e,n){if(!e||!(u instanceof K))return u;let t=Be(ge(e),n);return t?new K(u.message,u.exitCode,u.errorData,{errorCode:u.errorCode,errorCategory:u.errorCategory,telemetryDetails:u.telemetryDetails,retryable:u.retryable,outputDetails:{...u.outputDetails,rayfinBuildOutputTail:t}}):u}var Ht="manifest.json",Kt="dataSources.json",at="dataSchema.json",Dt=10*1024*1024,Wt="For tabular data sources (allowedActions under dataSets), use only: get, post, patch, delete.";function Gt(u,e=xu){if(!u.buildPath)throw new g(`buildPath is required in ${e} to pack an app`);if(!u.buildEntryPoint)throw new g(`buildEntryPoint is required in ${e} to pack an app`);if(u.buildType!=="none"&&!u.buildCommand)throw new g(`buildCommand is required in ${e} to pack an app`)}function Yt(u,e=n=>new g(n)){let n=te.safeParse(u);if(n.success)return;let t=n.error.issues.map(D=>`${D.path.length>0?D.path.join("."):"(root)"}: ${D.message}`),a=n.error.issues.some(D=>{let c=D.path.map(String);return c.includes("dataSets")&&c.at(-1)==="allowedActions"})?`
24
+ ${Wt}`:"";throw e(`Invalid ${xu} for shared connection policy enforcement:
25
+ ${t.join(`
26
+ `)}${a}`)}async function Xt(u,e){let n=e.state!==void 0?"state":e.data!==void 0?"data":"db",t=e[n]?.schemaPath;if(t===void 0)return;let i=`${n}.schemaPath`;if(!t.trim())throw new g(`${i} must not be empty: "${t}"`);if(A.isAbsolute(t))throw new g(`${i} must be relative to the project root: "${t}"`);let a=A.resolve(u,t),D=A.relative(u,a);if(D===".."||D.startsWith(`..${A.sep}`)||A.isAbsolute(D))throw new g(`${i} must not resolve outside the project root: "${t}"`);let c;try{c=await d.stat(a)}catch(E){throw new g(`Unable to access ${i} "${t}": ${E.message}`)}if(!c.isFile())throw new g(`${i} must reference a regular file: "${t}"`);if(c.size>Dt)throw new g(`${i} "${t}" is ${c.size} bytes, which exceeds the ${Dt/(1024*1024)} MB limit`);let p;try{p=await d.readFile(a)}catch(E){throw new g(`Unable to read ${i} "${t}": ${E.message}`)}try{JSON.parse(p.toString("utf8"))}catch(E){throw new g(`${i} "${t}" must contain valid JSON: ${E.message}`)}return p}var ot="prod";function Wu(u,e){return{fileName:e,filePath:A.join(u,e)}}async function st(u){try{return(await d.stat(u)).isFile()}catch(e){if(typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT")return!1;throw e}}async function Zt(u,e){let n=A.basename(e);if(await st(A.resolve(e)))return Wu(u,n);for(let t of re)if(t!==n&&await st(A.join(u,t)))return Wu(u,t);return Wu(u,n)}async function Qt(u){let e;try{e=await d.readFile(u,"utf-8")}catch(n){throw new g(`Failed to read ${A.basename(u)}: ${n.message}`)}try{return JSON.parse(e)}catch(n){throw new g(`${A.basename(u)}: ${n.message}`)}}async function un(u,e,n){let i=(await d.readdir(u,{withFileTypes:!0})).filter(D=>D.isFile()&&D.name!==ne).map(D=>({fileName:D.name,stageName:ae(D.name,n.fileName)})).filter(D=>D.stageName!==void 0).sort((D,c)=>D.fileName.localeCompare(c.fileName)),a=[];for(let{fileName:D,stageName:c}of i){let p;try{p=await d.readFile(A.join(u,D),"utf-8")}catch(b){throw new g(`Failed to read stage config: ${D}: ${b.message}`)}let E;try{E=De(p)}catch(b){throw new g(`${D}: ${b.message}`)}let B;try{({config:B}=$u(e,E))}catch(b){throw new g(`${D} contains invalid overrides:
27
+ ${b.message}`)}a.push({stageName:c,resolvedConfig:B})}if(!a.some(({stageName:D})=>D===ot)){let{config:D}=$u(e);a.push({stageName:ot,resolvedConfig:D})}return a}async function en(u={}){let e=Date.now(),n=0,t=0,i=0,a=0,D=0,c=0,p=0,{quiet:E=!1,cleanPackedFolder:B=!0,commandLogFilePath:b,commandLogFileMaxBytes:M,onCommandLogError:L}=u,{appConfig:yu,fileConfig:C}=Fe(),h=u.appConfigPath??C.appConfigPath,o=A.dirname(A.resolve(h)),m=await Zt(o,h),v=A.resolve(m.filePath)===A.resolve(C.appConfigPath),f=v?yu:await Qt(m.filePath);if(!f)throw new g(`${m.fileName} is required to pack an app`);Yt(f);let S=Qe(v?await Ce():f.appId,m.fileName);Gt(f,m.fileName);let{buildPath:U,buildEntryPoint:Ft}=f,Ct=C.projectConfigPath?A.dirname(A.resolve(C.projectConfigPath)):o,ft=Bu(Ct),Du=Xe(o,u.packedFolder,ft),T=Hu(Du,S),wu=Ze(Du,S),Gu=f.state?.enabled??f.data?.enabled??f.db?.enabled,Pu=await Xt(o,f),G=f.functions?.baseDirectory?A.resolve(o,f.functions.baseDirectory):void 0;G!==void 0&&await Ue(G);let lt=await un(o,f,m),Et=A.resolve(o,U),uu=E?null:new le;try{if(f.buildType!=="none"){let{buildCommand:k}=f;E||X(`Running: ${k}`);let I=Date.now();try{await he(k,o,{quiet:E,...b?{logFilePath:b}:{},...M!==void 0?{logFileMaxBytes:M}:{},...L?{onLogError:L}:{}})}finally{n=Date.now()-I}}uu?.start("Packing client output...");let bu=Date.now();try{B&&await d.rm(Du,{recursive:!0,force:!0}),await d.mkdir(wu,{recursive:!0}),await d.cp(Et,wu,{recursive:!0}),await d.copyFile(m.filePath,A.join(T,m.fileName)),Pu!==void 0&&await d.writeFile(A.join(T,at),Pu);for(let{stageName:k,resolvedConfig:I}of lt)await d.writeFile(A.join(T,ie(k,m.fileName)),JSON.stringify(I,null,2))}finally{t=Date.now()-bu}let Yu=Date.now(),Su;try{Su=await rn(o,T,{quiet:E})}catch(k){throw i=Date.now()-Yu,k}Su!==void 0&&(i=Date.now()-Yu);let Xu=Date.now(),vu;if(fe("rayfin")&&await Ee(o)){uu?.update("Packing Rayfin backend...");let k=E&&b?zt(b,await qt(b,M??Number.POSITIVE_INFINITY),L):void 0,I=E&&!b?de():void 0,Au=E?k?.write??(I?eu=>me(I,Buffer.from(`${eu}
28
+ `,"utf8"),pe):void 0):X;try{vu=await we({projectRoot:o,packAppOutputDir:T,cliVersion:Nu.version,env:se(await ye(o)),...Au?{onDetail:Au}:{}}),await k?.drainAsync()}catch(eu){throw a=Date.now()-Xu,await k?.drainAsync(),Ut(eu,I,o)}a=Date.now()-Xu}let Zu=Date.now(),Y;try{Y=G!==void 0?await ze(G):[]}catch(k){throw D=Date.now()-Zu,k}G!==void 0&&(D=Date.now()-Zu);let ou=Y.length>0,su=G!==void 0?A.basename(G):void 0,Qu={"/":{type:"client",path:Ft}};ou&&su!==void 0&&Object.assign(Qu,He(Y,su));let cu;if(f.iconPath){let k=A.join(o,f.iconPath),I=A.extname(k).toLowerCase();if(I!==".png"&&I!==".jpg")throw new g(`iconPath in ${m.fileName} must reference a .png or .jpg file, but got "${A.basename(k)}".`);cu=A.basename(k),await d.copyFile(k,A.join(T,cu))}let pt={cliVersion:Nu.version,manifestVersion:_u,clientDirectory:Uu,hasCustomMiddleTier:ou,...ou?{functionsPackage:{path:zu,...Je}}:{},...cu?{iconPath:cu}:{},...Pu!==void 0?{dataSchemaPath:at}:{},...Gu!==void 0?{dataEnabled:Gu}:{},...vu?{rayfinPackage:vu,backends:{default:{kind:"rayfin"}}}:{},routes:Qu},ue=JSON.stringify(pt,null,2);if(await d.writeFile(A.join(T,Ht),ue),ou&&su!==void 0){uu?.update(`Bundling ${Y.length} function${Y.length===1?"":"s"}...`);let k=Date.now(),I;try{I=await je({projectRoot:o,functions:Y})}finally{c=Date.now()-k}uu?.update("Writing functions archive...");let Au=Date.now();try{let eu=await We({baseDirName:su,functions:Y,bundles:I,manifestContent:ue,dataSourcesJson:Su});await d.writeFile(A.join(T,zu),eu)}finally{p=Date.now()-Au}}await it(o,T);let dt=ct({startedAt:e,clientBuildMs:n,clientCopyMs:t,dataSourcesMs:i,rayfinPackMs:a,functionsDiscoveryMs:D,middletierBuildMs:c,functionsArchiveMs:p});return{success:!0,result:{appId:S,packedFolder:Du,packAppOutputDir:T,packClientOutputDir:wu,timings:dt}}}catch(bu){return{success:!1,appId:S,error:bu,timings:ct({startedAt:e,clientBuildMs:n,clientCopyMs:t,dataSourcesMs:i,rayfinPackMs:a,functionsDiscoveryMs:D,middletierBuildMs:c,functionsArchiveMs:p})}}finally{uu?.stop()}}function ct({startedAt:u,clientBuildMs:e,clientCopyMs:n,dataSourcesMs:t,rayfinPackMs:i,functionsDiscoveryMs:a,middletierBuildMs:D,functionsArchiveMs:c}){return{clientBuildMs:e,clientCopyMs:n,dataSourcesMs:t,rayfinPackMs:i,functionsDiscoveryMs:a,middletierBuildMs:D,functionsArchiveMs:c,totalMs:Date.now()-u}}async function tn(u={}){let e=await en(u);if(!e.success)throw e.error;return e.result}var hu=A.join(oe,"dataSources.ts"),nn=/export\s+default\s+(\{[\s\S]*\});/;async function rn(u,e,n){let t=A.join(u,hu);try{await d.access(t)}catch{n.quiet||X(`${hu} not found \u2014 dataSources.json will not be included in the pack.`);return}let i=await d.readFile(t,"utf-8"),a=nn.exec(i);if(!a?.[1])throw new K(`Could not extract dataSources from ${hu}`);let D;try{D=At.default.parse(a[1])}catch(p){throw new K(`${hu} has an unexpected format: ${p.message}`)}let c=JSON.stringify(D,null,2);return await d.writeFile(A.join(e,Kt),c),c}function an(u){return u<1e3?`${Math.round(u)}ms`:`${(u/1e3).toFixed(2)}s`}function Dn(u){let e=[["Client build",u.clientBuildMs],["Client copy",u.clientCopyMs]];u.dataSourcesMs>0&&e.push(["Data sources",u.dataSourcesMs]),u.rayfinPackMs>0&&e.push(["Rayfin pack",u.rayfinPackMs]),u.middletierBuildMs>0&&e.push(["Middletier build",u.middletierBuildMs]),u.functionsArchiveMs>0&&e.push(["Functions archive",u.functionsArchiveMs]),e.push(["Total",u.totalMs]);let n=Math.max(...e.map(([t])=>t.length));X(""),X("Timings:");for(let[t,i]of e)X(` ${t.padEnd(n)} ${an(i)}`)}async function cr(u){u.setDescription(Ou.app.pack.description),u.addExamples(Ou.app.pack.examples),await u.runVerb();let e=u.isJsonMode(),n=await tn({quiet:e});e?Ae(n):(ce("App successfully packed."),Dn(n.timings))}export{Pe as a,qu as b,Xe as c,Tn as d,jn as e,Ln as f,Qe as g,Gt as h,Yt as i,en as j,tn as k,cr as l};
29
+ /*!
30
+ * Copyright (C) Microsoft Corporation. All rights reserved.
31
+ */
32
+ //# sourceMappingURL=chunk-ZBQT5XZJ.js.map
@@ -0,0 +1,11 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{b as h,d as l}from"./chunk-7LAMG4KK.js";import{a as o}from"./chunk-BMOTNINY.js";import{a as I}from"./chunk-A5INC5TY.js";import{A as p,Na as d,Ob as u,Pb as w,gb as j,y as c}from"./chunk-RSHOMYG6.js";async function D(a,C=!0,m=u()){let e=w();if(e.projectConfig)return e.projectConfig;let n=e.appConfig;if(!n)throw new c("No managed project or app configuration was found. Run this command from a directory containing ms.project.config.json or ms.config.json.");let r=o(n.projectId),i=o(n.environmentId);if(!r){let t=o(await I());if(!t)throw new p("The current app does not specify an app ID.");let s=await a.getTenantIdAsync();if(!s)throw new c("Unable to determine tenant ID. Ensure you are logged in.");let g=await d({tenantId:s,environmentId:i,logger:m,actionsParams:{appName:t}});r=o(g.projectId),i=o(g.environmentId)}if(!r)throw new c("The current app is not associated with a managed project.");if(!i)throw new p("The current app does not specify an environment ID.");a.updateEnvironmentId(i);let y=await j({projectId:r,logger:m}),f=h(y,n.cloud);if(C){let t=e.fileConfig.projectConfigPath;if(!t)throw new p("Unable to determine where ms.project.config.json should be created.");l(t,f)}return f}export{D as a};
8
+ /*!
9
+ * Copyright (C) Microsoft Corporation. All rights reserved.
10
+ */
11
+ //# sourceMappingURL=chunk-ZGBTKTTU.js.map
@@ -4,42 +4,42 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __pathDirname(__filename);
7
- import{Ob as et,u as Q,w as tt,x as N}from"./chunk-4XKA5APP.js";import{K as D,a as j}from"./chunk-KKC5ZK4D.js";import{b as Ut,d as dt}from"./chunk-UT667QSU.js";var ot=Ut((Re,Mt)=>{"use strict";var nt={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let s="";return t<0?s+=`\x1B[${-t}D`:t>0&&(s+=`\x1B[${t}C`),e<0?s+=`\x1B[${-e}A`:e>0&&(s+=`\x1B[${e}B`),s},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},ie={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},re={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let s=0;s<t;s++)e+=this.line+(s<t-1?nt.up():"");return t&&(e+=nt.left),e}};Mt.exports={cursor:nt,scroll:ie,erase:re,beep:"\x07"}});import{styleText as at}from"node:util";import{stdout as Pt,stdin as ne}from"node:process";import oe from"node:readline";var mt=(()=>{let t=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return e=>{let s=0;for(t.lastIndex=0;t.test(e);)s+=1;return e.length-s}})(),gt=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,ft=t=>t===8987||t===9001||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t>=131072&&t<=196605||t>=196608&&t<=262141;var Bt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Kt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,$t=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Ht=/\t{1,1000}/y,vt=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),qt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,zt=new RegExp("\\p{M}+","gu"),Jt={limit:1/0,ellipsis:""},yt=(t,e={},s={})=>{let i=e.limit??1/0,r=e.ellipsis??"",o=e?.ellipsisWidth??(r?yt(r,Jt,s).width:0),n=0,a=s.controlWidth??0,l=s.tabWidth??8,h=s.emojiWidth??2,d=2,c=s.regularWidth??1,p=s.wideWidth??d,v=[[qt,c],[Bt,n],[Kt,a],[Ht,l],[vt,h],[$t,p]],f=0,$=0,I=t.length,S=0,P=!1,F=I,_=Math.max(0,i-o),y=0,b=0,w=0,x=0;t:for(;;){if(b>y||$>=I&&$>f){let C=t.slice(y,b)||t.slice(f,$);S=0;for(let O of C.replaceAll(zt,"")){let E=O.codePointAt(0)||0;if(gt(E)?x=d:ft(E)?x=p:x=c,w+x>_&&(F=Math.min(F,Math.max(y,f)+S)),w+x>i){P=!0;break t}S+=O.length,w+=x}y=b=0}if($>=I)break t;for(let C=0,O=v.length;C<O;C++){let[E,pt]=v[C];if(E.lastIndex=$,E.test(t)){if(S=E===$t?mt(t.slice($,E.lastIndex)):E===vt?1:E.lastIndex-$,x=S*pt,w+x>_&&(F=Math.min(F,$+Math.floor((_-w)/pt))),w+x>i){P=!0;break t}w+=x,y=f,b=$,$=f=E.lastIndex;continue t}}$+=1}return{width:P?_:w,index:P?F:I,truncated:P,ellipsed:P&&i>=o}},wt=yt;var Yt={limit:1/0,ellipsis:"",ellipsisWidth:0},Xt=(t,e={})=>wt(t,Yt,e).width,A=Xt;var U="\x1B",xt="\x9B",Zt=39,it="\x07",Ct="[",Qt="]",Et="m",rt=`${Qt}8;;`,It=new RegExp(`(?:\\${Ct}(?<code>\\d+)m|\\${rt}(?<uri>.*)${it})`,"y"),bt=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},St=t=>`${U}${Ct}${t}${Et}`,_t=t=>`${U}${rt}${t}${it}`,st=(t,e,s)=>{let i=e[Symbol.iterator](),r=!1,o=!1,n=t.at(-1),a=n===void 0?0:A(n),l=i.next(),h=i.next(),d=0;for(;!l.done;){let c=l.value,p=A(c);a+p<=s?t[t.length-1]+=c:(t.push(c),a=0),(c===U||c===xt)&&(r=!0,o=e.startsWith(rt,d+1)),r?o?c===it&&(r=!1,o=!1):c===Et&&(r=!1):(a+=p,a===s&&!h.done&&(t.push(""),a=0)),l=h,h=i.next(),d+=c.length}n=t.at(-1),!a&&n!==void 0&&n.length&&t.length>1&&(t[t.length-2]+=t.pop())},te=t=>{let e=t.split(" "),s=e.length;for(;s&&!A(e[s-1]);)s--;return s===e.length?t:e.slice(0,s).join(" ")+e.slice(s).join("")},ee=(t,e,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let i="",r,o,n=t.split(" "),a=[""],l=0;for(let c=0;c<n.length;c++){let p=n[c];if(s.trim!==!1){let f=a.at(-1)??"",$=f.trimStart();f.length!==$.length&&(a[a.length-1]=$,l=A($))}c!==0&&(l>=e&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),l=0),(l||s.trim===!1)&&(a[a.length-1]+=" ",l++));let v=A(p);if(s.hard&&v>e){let f=e-l,$=1+Math.floor((v-f-1)/e);Math.floor((v-1)/e)<$&&a.push(""),st(a,p,e),l=A(a.at(-1)??"");continue}if(l+v>e&&l&&v){if(s.wordWrap===!1&&l<e){st(a,p,e),l=A(a.at(-1)??"");continue}a.push(""),l=0}if(l+v>e&&s.wordWrap===!1){st(a,p,e),l=A(a.at(-1)??"");continue}a[a.length-1]+=p,l+=v}s.trim!==!1&&(a=a.map(c=>te(c)));let h=a.join(`
8
- `),d=!1;for(let c=0;c<h.length;c++){let p=h[c];if(i+=p,d)d=!1;else if(d=p>="\uD800"&&p<="\uDBFF",d)continue;if(p===U||p===xt){It.lastIndex=c+1;let f=It.exec(h)?.groups;if(f?.code!==void 0){let $=Number.parseFloat(f.code);r=$===Zt?void 0:$}else f?.uri!==void 0&&(o=f.uri.length===0?void 0:f.uri)}if(h[c+1]===`
9
- `){o&&(i+=_t(""));let v=r?bt(r):void 0;r&&v&&(i+=St(v))}else p===`
10
- `&&(r&&bt(r)&&(i+=St(r)),o&&(i+=_t(o)))}return i},se=/\r?\n/;function R(t,e,s){return String(t).normalize().split(se).map(i=>ee(i,e,s)).join(`
11
- `)}var M=dt(ot(),1);function L(t,e,s){if(!s.some(n=>!n.disabled))return t;let i=t+e,r=Math.max(s.length-1,0),o=i<0?r:i>r?0:i;return s[o].disabled?L(o,e<0?-1:1,s):o}var ae=["up","down","left","right","space","enter","cancel"],ue=["January","February","March","April","May","June","July","August","September","October","November","December"],V={actions:new Set(ae),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...ue],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(t,e)=>`There are only ${t} days in ${e}`,afterMin:t=>`Date must be on or after ${t.toISOString().slice(0,10)}`,beforeMax:t=>`Date must be on or before ${t.toISOString().slice(0,10)}`}}};function Tt(t,e){if(typeof t=="string")return V.aliases.get(t)===e;for(let s of t)if(s!==void 0&&Tt(s,e))return!0;return!1}function le(t,e){if(t===e)return;let s=t.split(`
7
+ import{a as dt}from"./chunk-A5INC5TY.js";import{Pb as mt,v as Q,x as tt,y as D}from"./chunk-RSHOMYG6.js";import{P as N,a as j}from"./chunk-PYPCPMCR.js";import{b as Bt,d as pt}from"./chunk-UT667QSU.js";var nt=Bt((Le,Pt)=>{"use strict";var rt={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let s="";return t<0?s+=`\x1B[${-t}D`:t>0&&(s+=`\x1B[${t}C`),e<0?s+=`\x1B[${-e}A`:e>0&&(s+=`\x1B[${e}B`),s},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},re={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},ne={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let s=0;s<t;s++)e+=this.line+(s<t-1?rt.up():"");return t&&(e+=rt.left),e}};Pt.exports={cursor:rt,scroll:re,erase:ne,beep:"\x07"}});import{styleText as ot}from"node:util";import{stdout as Tt,stdin as oe}from"node:process";import ae from"node:readline";var gt=(()=>{let t=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return e=>{let s=0;for(t.lastIndex=0;t.test(e);)s+=1;return e.length-s}})(),ft=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,$t=t=>t===8987||t===9001||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t>=131072&&t<=196605||t>=196608&&t<=262141;var Kt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ht=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,vt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,qt=/\t{1,1000}/y,yt=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),zt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Jt=new RegExp("\\p{M}+","gu"),Yt={limit:1/0,ellipsis:""},wt=(t,e={},s={})=>{let i=e.limit??1/0,r=e.ellipsis??"",o=e?.ellipsisWidth??(r?wt(r,Yt,s).width:0),n=0,a=s.controlWidth??0,l=s.tabWidth??8,h=s.emojiWidth??2,m=2,c=s.regularWidth??1,p=s.wideWidth??m,v=[[zt,c],[Kt,n],[Ht,a],[qt,l],[yt,h],[vt,p]],f=0,$=0,I=t.length,S=0,P=!1,V=I,_=Math.max(0,i-o),y=0,b=0,w=0,x=0;t:for(;;){if(b>y||$>=I&&$>f){let C=t.slice(y,b)||t.slice(f,$);S=0;for(let O of C.replaceAll(Jt,"")){let E=O.codePointAt(0)||0;if(ft(E)?x=m:$t(E)?x=p:x=c,w+x>_&&(V=Math.min(V,Math.max(y,f)+S)),w+x>i){P=!0;break t}S+=O.length,w+=x}y=b=0}if($>=I)break t;for(let C=0,O=v.length;C<O;C++){let[E,ht]=v[C];if(E.lastIndex=$,E.test(t)){if(S=E===vt?gt(t.slice($,E.lastIndex)):E===yt?1:E.lastIndex-$,x=S*ht,w+x>_&&(V=Math.min(V,$+Math.floor((_-w)/ht))),w+x>i){P=!0;break t}w+=x,y=f,b=$,$=f=E.lastIndex;continue t}}$+=1}return{width:P?_:w,index:P?V:I,truncated:P,ellipsed:P&&i>=o}},It=wt;var Xt={limit:1/0,ellipsis:"",ellipsisWidth:0},Zt=(t,e={})=>It(t,Xt,e).width,A=Zt;var U="\x1B",Ct="\x9B",Qt=39,st="\x07",Et="[",te="]",Mt="m",it=`${te}8;;`,bt=new RegExp(`(?:\\${Et}(?<code>\\d+)m|\\${it}(?<uri>.*)${st})`,"y"),St=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},_t=t=>`${U}${Et}${t}${Mt}`,xt=t=>`${U}${it}${t}${st}`,et=(t,e,s)=>{let i=e[Symbol.iterator](),r=!1,o=!1,n=t.at(-1),a=n===void 0?0:A(n),l=i.next(),h=i.next(),m=0;for(;!l.done;){let c=l.value,p=A(c);a+p<=s?t[t.length-1]+=c:(t.push(c),a=0),(c===U||c===Ct)&&(r=!0,o=e.startsWith(it,m+1)),r?o?c===st&&(r=!1,o=!1):c===Mt&&(r=!1):(a+=p,a===s&&!h.done&&(t.push(""),a=0)),l=h,h=i.next(),m+=c.length}n=t.at(-1),!a&&n!==void 0&&n.length&&t.length>1&&(t[t.length-2]+=t.pop())},ee=t=>{let e=t.split(" "),s=e.length;for(;s&&!A(e[s-1]);)s--;return s===e.length?t:e.slice(0,s).join(" ")+e.slice(s).join("")},se=(t,e,s={})=>{if(s.trim!==!1&&t.trim()==="")return"";let i="",r,o,n=t.split(" "),a=[""],l=0;for(let c=0;c<n.length;c++){let p=n[c];if(s.trim!==!1){let f=a.at(-1)??"",$=f.trimStart();f.length!==$.length&&(a[a.length-1]=$,l=A($))}c!==0&&(l>=e&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),l=0),(l||s.trim===!1)&&(a[a.length-1]+=" ",l++));let v=A(p);if(s.hard&&v>e){let f=e-l,$=1+Math.floor((v-f-1)/e);Math.floor((v-1)/e)<$&&a.push(""),et(a,p,e),l=A(a.at(-1)??"");continue}if(l+v>e&&l&&v){if(s.wordWrap===!1&&l<e){et(a,p,e),l=A(a.at(-1)??"");continue}a.push(""),l=0}if(l+v>e&&s.wordWrap===!1){et(a,p,e),l=A(a.at(-1)??"");continue}a[a.length-1]+=p,l+=v}s.trim!==!1&&(a=a.map(c=>ee(c)));let h=a.join(`
8
+ `),m=!1;for(let c=0;c<h.length;c++){let p=h[c];if(i+=p,m)m=!1;else if(m=p>="\uD800"&&p<="\uDBFF",m)continue;if(p===U||p===Ct){bt.lastIndex=c+1;let f=bt.exec(h)?.groups;if(f?.code!==void 0){let $=Number.parseFloat(f.code);r=$===Qt?void 0:$}else f?.uri!==void 0&&(o=f.uri.length===0?void 0:f.uri)}if(h[c+1]===`
9
+ `){o&&(i+=xt(""));let v=r?St(r):void 0;r&&v&&(i+=_t(v))}else p===`
10
+ `&&(r&&St(r)&&(i+=_t(r)),o&&(i+=xt(o)))}return i},ie=/\r?\n/;function R(t,e,s){return String(t).normalize().split(ie).map(i=>se(i,e,s)).join(`
11
+ `)}var M=pt(nt(),1);function L(t,e,s){if(!s.some(n=>!n.disabled))return t;let i=t+e,r=Math.max(s.length-1,0),o=i<0?r:i>r?0:i;return s[o].disabled?L(o,e<0?-1:1,s):o}var ue=["up","down","left","right","space","enter","cancel"],le=["January","February","March","April","May","June","July","August","September","October","November","December"],F={actions:new Set(ue),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...le],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(t,e)=>`There are only ${t} days in ${e}`,afterMin:t=>`Date must be on or after ${t.toISOString().slice(0,10)}`,beforeMax:t=>`Date must be on or before ${t.toISOString().slice(0,10)}`}}};function At(t,e){if(typeof t=="string")return F.aliases.get(t)===e;for(let s of t)if(s!==void 0&&At(s,e))return!0;return!1}function ce(t,e){if(t===e)return;let s=t.split(`
12
12
  `),i=e.split(`
13
- `),r=Math.max(s.length,i.length),o=[];for(let n=0;n<r;n++)s[n]!==i[n]&&o.push(n);return{lines:o,numLinesBefore:s.length,numLinesAfter:i.length,numLines:r}}var We=globalThis.process.platform.startsWith("win"),ut=Symbol("clack:cancel");function k(t){return t===ut}function B(t,e){let s=t;s.isTTY&&s.setRawMode(e)}var lt=t=>"columns"in t&&typeof t.columns=="number"?t.columns:80,ct=t=>"rows"in t&&typeof t.rows=="number"?t.rows:20;function G(t,e,s,i=s,r=s,o){let n=lt(t??Pt);return R(e,n-s.length,{hard:!0,trim:!1}).split(`
14
- `).map((a,l,h)=>{let d=o?o(a,l):a;return l===0?`${i}${d}`:l===h.length-1?`${r}${d}`:`${s}${d}`}).join(`
15
- `)}var z=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,e=!0){let{input:s=ne,output:i=Pt,render:r,signal:o,...n}=t;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=e,this._abortSignal=o,this.input=s,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,e){let s=this._subscribers.get(t)??[];s.push(e),this._subscribers.set(t,s)}on(t,e){this.setSubscriber(t,{cb:e})}once(t,e){this.setSubscriber(t,{cb:e,once:!0})}emit(t,...e){let s=this._subscribers.get(t)??[],i=[];for(let r of s)r.cb(...e),r.once&&i.push(()=>s.splice(s.indexOf(r),1));for(let r of i)r()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(ut);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=oe.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),B(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(M.cursor.show),this.output.off("resize",this.render),B(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(M.cursor.show),this.output.off("resize",this.render),B(this.input,!1),t(ut)})})}_isActionKey(t,e){return t===" "}_shouldSubmit(t,e){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,e){this.userInput=t??"",this.emit("userInput",this.userInput),e&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,e){if(this._track&&e.name!=="return"&&(e.name&&this._isActionKey(t,e)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),e?.name&&(!this._track&&V.aliases.has(e.name)&&this.emit("cursor",V.aliases.get(e.name)),V.actions.has(e.name)&&this.emit("cursor",e.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t?.toLowerCase(),e),e?.name==="return"&&this._shouldSubmit(t,e)){if(this.opts.validate){let s=this.opts.validate(this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}Tt([t,e?.name,e?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
13
+ `),r=Math.max(s.length,i.length),o=[];for(let n=0;n<r;n++)s[n]!==i[n]&&o.push(n);return{lines:o,numLinesBefore:s.length,numLinesAfter:i.length,numLines:r}}var je=globalThis.process.platform.startsWith("win"),at=Symbol("clack:cancel");function k(t){return t===at}function B(t,e){let s=t;s.isTTY&&s.setRawMode(e)}var ut=t=>"columns"in t&&typeof t.columns=="number"?t.columns:80,lt=t=>"rows"in t&&typeof t.rows=="number"?t.rows:20;function G(t,e,s,i=s,r=s,o){let n=ut(t??Tt);return R(e,n-s.length,{hard:!0,trim:!1}).split(`
14
+ `).map((a,l,h)=>{let m=o?o(a,l):a;return l===0?`${i}${m}`:l===h.length-1?`${r}${m}`:`${s}${m}`}).join(`
15
+ `)}var z=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,e=!0){let{input:s=oe,output:i=Tt,render:r,signal:o,...n}=t;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=e,this._abortSignal=o,this.input=s,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(t,e){let s=this._subscribers.get(t)??[];s.push(e),this._subscribers.set(t,s)}on(t,e){this.setSubscriber(t,{cb:e})}once(t,e){this.setSubscriber(t,{cb:e,once:!0})}emit(t,...e){let s=this._subscribers.get(t)??[],i=[];for(let r of s)r.cb(...e),r.once&&i.push(()=>s.splice(s.indexOf(r),1));for(let r of i)r()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(at);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=ae.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),B(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(M.cursor.show),this.output.off("resize",this.render),B(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(M.cursor.show),this.output.off("resize",this.render),B(this.input,!1),t(at)})})}_isActionKey(t,e){return t===" "}_shouldSubmit(t,e){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,e){this.userInput=t??"",this.emit("userInput",this.userInput),e&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,e){if(this._track&&e.name!=="return"&&(e.name&&this._isActionKey(t,e)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),e?.name&&(!this._track&&F.aliases.has(e.name)&&this.emit("cursor",F.aliases.get(e.name)),F.actions.has(e.name)&&this.emit("cursor",e.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t?.toLowerCase(),e),e?.name==="return"&&this._shouldSubmit(t,e)){if(this.opts.validate){let s=this.opts.validate(this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}At([t,e?.name,e?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
16
16
  `),B(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=R(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
17
- `).length-1;this.output.write(M.cursor.move(-999,t*-1))}render(){let t=R(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(M.cursor.hide);else{let e=le(this._prevFrame,t),s=ct(this.output);if(this.restoreCursor(),e){let i=Math.max(0,e.numLinesAfter-s),r=Math.max(0,e.numLinesBefore-s),o=e.lines.find(n=>n>=i);if(o===void 0){this._prevFrame=t;return}if(e.lines.length===1){this.output.write(M.cursor.move(0,o-r)),this.output.write(M.erase.lines(1));let n=t.split(`
17
+ `).length-1;this.output.write(M.cursor.move(-999,t*-1))}render(){let t=R(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(M.cursor.hide);else{let e=ce(this._prevFrame,t),s=lt(this.output);if(this.restoreCursor(),e){let i=Math.max(0,e.numLinesAfter-s),r=Math.max(0,e.numLinesBefore-s),o=e.lines.find(n=>n>=i);if(o===void 0){this._prevFrame=t;return}if(e.lines.length===1){this.output.write(M.cursor.move(0,o-r)),this.output.write(M.erase.lines(1));let n=t.split(`
18
18
  `);this.output.write(n[o]),this._prevFrame=t,this.output.write(M.cursor.move(0,n.length-o-1));return}else if(e.lines.length>1){if(i<r)o=i;else{let a=o-r;a>0&&this.output.write(M.cursor.move(0,a))}this.output.write(M.erase.down());let n=t.split(`
19
19
  `).slice(o);this.output.write(n.join(`
20
- `)),this._prevFrame=t;return}}this.output.write(M.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}};function ce(t,e){if(t===void 0||e.length===0)return 0;let s=e.findIndex(i=>i.value===t);return s!==-1?s:0}function he(t,e){return(e.label??String(e.value)).toLowerCase().includes(t.toLowerCase())}function pe(t,e){if(e)return t?e:e[0]}var At=class extends z{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#t=0;#i="";#e;#s;#r;get cursor(){return this.#t}get userInputWithCursor(){if(!this.userInput)return at(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let t=this.userInput.slice(0,this._cursor),[e,...s]=this.userInput.slice(this._cursor);return`${t}${at("inverse",e)}${s.join("")}`}get options(){return typeof this.#s=="function"?this.#s():this.#s}constructor(t){super(t),this.#s=t.options,this.#r=t.placeholder;let e=this.options;this.filteredOptions=[...e],this.multiple=t.multiple===!0,this.#e=typeof t.options=="function"?t.filter:t.filter??he;let s;if(t.initialValue&&Array.isArray(t.initialValue)?this.multiple?s=t.initialValue:s=t.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(s=[this.options[0].value]),s)for(let i of s){let r=e.findIndex(o=>o.value===i);r!==-1&&(this.toggleSelected(i),this.#t=r)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(i,r)=>this.#n(i,r)),this.on("userInput",i=>this.#o(i))}_isActionKey(t,e){return t===" "||this.multiple&&this.isNavigating&&e.name==="space"&&t!==void 0&&t!==""}#n(t,e){let s=e.name==="up",i=e.name==="down",r=e.name==="return",o=this.userInput===""||this.userInput===" ",n=this.#r,a=this.options,l=n!==void 0&&n!==""&&a.some(h=>!h.disabled&&(this.#e?this.#e(n,h):!0));if(e.name==="tab"&&o&&l){this.userInput===" "&&this._clearUserInput(),this._setUserInput(n,!0),this.isNavigating=!1;return}s||i?(this.#t=L(this.#t,s?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):r?this.value=pe(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(e.name==="tab"||this.isNavigating&&e.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(t){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(t)?this.selectedValues=this.selectedValues.filter(e=>e!==t):this.selectedValues=[...this.selectedValues,t]:this.selectedValues=[t])}#o(t){if(t!==this.#i){this.#i=t;let e=this.options;t&&this.#e?this.filteredOptions=e.filter(r=>this.#e?.(t,r)):this.filteredOptions=[...e];let s=ce(this.focusedValue,this.filteredOptions);this.#t=L(s,0,this.filteredOptions);let i=this.filteredOptions[this.#t];i&&!i.disabled?this.focusedValue=i.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}},K=class extends z{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(M.cursor.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var H=class extends z{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let s=this.options.findIndex(({value:r})=>r===e.initialValue),i=s===-1?0:s;this.cursor=this.options[i].disabled?L(i,1,this.options):i,this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=L(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=L(this.cursor,1,this.options);break}this.changeValue()})}};var q=class extends z{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let s=e.slice(0,this.cursor),[i,...r]=e.slice(this.cursor);return`${s}${at("inverse",i)}${r.join("")}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.value===void 0&&(this.value="")})}};import{styleText as u,stripVTControlCharacters as es}from"node:util";import T from"node:process";var Ot=dt(ot(),1);function de(){return T.platform!=="win32"?T.env.TERM!=="linux":!!T.env.CI||!!T.env.WT_SESSION||!!T.env.TERMINUS_SUBLIME||T.env.ConEmuTask==="{cmd::Cmder}"||T.env.TERM_PROGRAM==="Terminus-Sublime"||T.env.TERM_PROGRAM==="vscode"||T.env.TERM==="xterm-256color"||T.env.TERM==="alacritty"||T.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var me=de();var m=(t,e)=>me?t:e,ge=m("\u25C6","*"),fe=m("\u25A0","x"),$e=m("\u25B2","x"),ve=m("\u25C7","o"),ns=m("\u250C","T"),g=m("\u2502","|"),W=m("\u2514","\u2014"),os=m("\u2510","T"),as=m("\u2518","\u2014"),ht=m("\u25CF",">"),Y=m("\u25CB"," "),us=m("\u25FB","[\u2022]"),ye=m("\u25FC","[+]"),Vt=m("\u25FB","[ ]"),ls=m("\u25AA","\u2022"),cs=m("\u2500","-"),hs=m("\u256E","+"),ps=m("\u251C","+"),ds=m("\u256F","+"),ms=m("\u2570","+"),gs=m("\u256D","+"),fs=m("\u25CF","\u2022"),$s=m("\u25C6","*"),vs=m("\u25B2","!"),ys=m("\u25A0","x"),X=t=>{switch(t){case"initial":case"active":return u("cyan",ge);case"cancel":return u("red",fe);case"error":return u("yellow",$e);case"submit":return u("green",ve)}},we=t=>{switch(t){case"initial":case"active":return u("cyan",g);case"cancel":return u("red",g);case"error":return u("yellow",g);case"submit":return u("green",g)}},Ft=(t,e,s,i,r,o=!1)=>{let n=e,a=0;if(o)for(let l=i-1;l>=s&&(n-=t[l].length,a++,!(n<=r));l--);else for(let l=s;l<i&&(n-=t[l].length,a++,!(n<=r));l++);return{lineCount:n,removals:a}},kt=({cursor:t,options:e,style:s,output:i=process.stdout,maxItems:r=Number.POSITIVE_INFINITY,columnPadding:o=0,rowPadding:n=4})=>{let a=lt(i)-o,l=ct(i),h=u("dim","..."),d=Math.max(l-n,0),c=Math.max(Math.min(r,d),5),p=0;t>=c-3&&(p=Math.max(Math.min(t-c+3,e.length-c),0));let v=c<e.length&&p>0,f=c<e.length&&p+c<e.length,$=Math.min(p+c,e.length),I=[],S=0;v&&S++,f&&S++;let P=p+(v?1:0),F=$-(f?1:0);for(let y=P;y<F;y++){let b=R(s(e[y],y===t),a,{hard:!0,trim:!1}).split(`
21
- `);I.push(b),S+=b.length}if(S>d){let y=0,b=0,w=S,x=t-P,C=d,O=()=>Ft(I,w,0,x,C),E=()=>Ft(I,w,x+1,I.length,C,!0);v?({lineCount:w,removals:y}=O(),w>C&&(f||(C-=1),{lineCount:w,removals:b}=E())):(f||(C-=1),{lineCount:w,removals:b}=E(),w>C&&(C-=1,{lineCount:w,removals:y}=O())),y>0&&(v=!0,I.splice(0,y)),b>0&&(f=!0,I.splice(I.length-b,b))}let _=[];v&&_.push(h);for(let y of I)for(let b of y)_.push(b);return f&&_.push(h),_};function Ie(t,e){if(!t)return!0;let s=(e.label??String(e.value??"")).toLowerCase(),i=(e.hint??"").toLowerCase(),r=String(e.value).toLowerCase(),o=t.toLowerCase();return s.includes(o)||i.includes(o)||r.includes(o)}var Rt=t=>{let e=(i,r,o,n)=>{let a=o.includes(i.value),l=i.label??String(i.value??""),h=i.hint&&n!==void 0&&i.value===n?u("dim",` (${i.hint})`):"",d=a?u("green",ye):u("dim",Vt);return i.disabled?`${u("gray",Vt)} ${u(["strikethrough","gray"],l)}`:r?`${d} ${l}${h}`:`${d} ${u("dim",l)}`},s=new At({options:t.options,multiple:!0,placeholder:t.placeholder,filter:t.filter??((i,r)=>Ie(i,r)),validate:()=>{if(t.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:t.initialValues,signal:t.signal,input:t.input,output:t.output,render(){let i=t.withGuide??V.withGuide,r=`${i?`${u("gray",g)}
20
+ `)),this._prevFrame=t;return}}this.output.write(M.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}};function he(t,e){if(t===void 0||e.length===0)return 0;let s=e.findIndex(i=>i.value===t);return s!==-1?s:0}function pe(t,e){return(e.label??String(e.value)).toLowerCase().includes(t.toLowerCase())}function me(t,e){if(e)return t?e:e[0]}var Ft=class extends z{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#t=0;#i="";#e;#s;#r;get cursor(){return this.#t}get userInputWithCursor(){if(!this.userInput)return ot(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let t=this.userInput.slice(0,this._cursor),[e,...s]=this.userInput.slice(this._cursor);return`${t}${ot("inverse",e)}${s.join("")}`}get options(){return typeof this.#s=="function"?this.#s():this.#s}constructor(t){super(t),this.#s=t.options,this.#r=t.placeholder;let e=this.options;this.filteredOptions=[...e],this.multiple=t.multiple===!0,this.#e=typeof t.options=="function"?t.filter:t.filter??pe;let s;if(t.initialValue&&Array.isArray(t.initialValue)?this.multiple?s=t.initialValue:s=t.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(s=[this.options[0].value]),s)for(let i of s){let r=e.findIndex(o=>o.value===i);r!==-1&&(this.toggleSelected(i),this.#t=r)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(i,r)=>this.#n(i,r)),this.on("userInput",i=>this.#o(i))}_isActionKey(t,e){return t===" "||this.multiple&&this.isNavigating&&e.name==="space"&&t!==void 0&&t!==""}#n(t,e){let s=e.name==="up",i=e.name==="down",r=e.name==="return",o=this.userInput===""||this.userInput===" ",n=this.#r,a=this.options,l=n!==void 0&&n!==""&&a.some(h=>!h.disabled&&(this.#e?this.#e(n,h):!0));if(e.name==="tab"&&o&&l){this.userInput===" "&&this._clearUserInput(),this._setUserInput(n,!0),this.isNavigating=!1;return}s||i?(this.#t=L(this.#t,s?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):r?this.value=me(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(e.name==="tab"||this.isNavigating&&e.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(t){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(t)?this.selectedValues=this.selectedValues.filter(e=>e!==t):this.selectedValues=[...this.selectedValues,t]:this.selectedValues=[t])}#o(t){if(t!==this.#i){this.#i=t;let e=this.options;t&&this.#e?this.filteredOptions=e.filter(r=>this.#e?.(t,r)):this.filteredOptions=[...e];let s=he(this.focusedValue,this.filteredOptions);this.#t=L(s,0,this.filteredOptions);let i=this.filteredOptions[this.#t];i&&!i.disabled?this.focusedValue=i.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}},K=class extends z{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(M.cursor.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var H=class extends z{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let s=this.options.findIndex(({value:r})=>r===e.initialValue),i=s===-1?0:s;this.cursor=this.options[i].disabled?L(i,1,this.options):i,this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=L(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=L(this.cursor,1,this.options);break}this.changeValue()})}};var q=class extends z{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let s=e.slice(0,this.cursor),[i,...r]=e.slice(this.cursor);return`${s}${ot("inverse",i)}${r.join("")}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.value===void 0&&(this.value="")})}};import{styleText as u,stripVTControlCharacters as ss}from"node:util";import T from"node:process";var kt=pt(nt(),1);function de(){return T.platform!=="win32"?T.env.TERM!=="linux":!!T.env.CI||!!T.env.WT_SESSION||!!T.env.TERMINUS_SUBLIME||T.env.ConEmuTask==="{cmd::Cmder}"||T.env.TERM_PROGRAM==="Terminus-Sublime"||T.env.TERM_PROGRAM==="vscode"||T.env.TERM==="xterm-256color"||T.env.TERM==="alacritty"||T.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ge=de();var d=(t,e)=>ge?t:e,fe=d("\u25C6","*"),$e=d("\u25A0","x"),ve=d("\u25B2","x"),ye=d("\u25C7","o"),os=d("\u250C","T"),g=d("\u2502","|"),W=d("\u2514","\u2014"),as=d("\u2510","T"),us=d("\u2518","\u2014"),ct=d("\u25CF",">"),Y=d("\u25CB"," "),ls=d("\u25FB","[\u2022]"),we=d("\u25FC","[+]"),Vt=d("\u25FB","[ ]"),cs=d("\u25AA","\u2022"),hs=d("\u2500","-"),ps=d("\u256E","+"),ms=d("\u251C","+"),ds=d("\u256F","+"),gs=d("\u2570","+"),fs=d("\u256D","+"),$s=d("\u25CF","\u2022"),vs=d("\u25C6","*"),ys=d("\u25B2","!"),ws=d("\u25A0","x"),X=t=>{switch(t){case"initial":case"active":return u("cyan",fe);case"cancel":return u("red",$e);case"error":return u("yellow",ve);case"submit":return u("green",ye)}},Ie=t=>{switch(t){case"initial":case"active":return u("cyan",g);case"cancel":return u("red",g);case"error":return u("yellow",g);case"submit":return u("green",g)}},Ot=(t,e,s,i,r,o=!1)=>{let n=e,a=0;if(o)for(let l=i-1;l>=s&&(n-=t[l].length,a++,!(n<=r));l--);else for(let l=s;l<i&&(n-=t[l].length,a++,!(n<=r));l++);return{lineCount:n,removals:a}},Rt=({cursor:t,options:e,style:s,output:i=process.stdout,maxItems:r=Number.POSITIVE_INFINITY,columnPadding:o=0,rowPadding:n=4})=>{let a=ut(i)-o,l=lt(i),h=u("dim","..."),m=Math.max(l-n,0),c=Math.max(Math.min(r,m),5),p=0;t>=c-3&&(p=Math.max(Math.min(t-c+3,e.length-c),0));let v=c<e.length&&p>0,f=c<e.length&&p+c<e.length,$=Math.min(p+c,e.length),I=[],S=0;v&&S++,f&&S++;let P=p+(v?1:0),V=$-(f?1:0);for(let y=P;y<V;y++){let b=R(s(e[y],y===t),a,{hard:!0,trim:!1}).split(`
21
+ `);I.push(b),S+=b.length}if(S>m){let y=0,b=0,w=S,x=t-P,C=m,O=()=>Ot(I,w,0,x,C),E=()=>Ot(I,w,x+1,I.length,C,!0);v?({lineCount:w,removals:y}=O(),w>C&&(f||(C-=1),{lineCount:w,removals:b}=E())):(f||(C-=1),{lineCount:w,removals:b}=E(),w>C&&(C-=1,{lineCount:w,removals:y}=O())),y>0&&(v=!0,I.splice(0,y)),b>0&&(f=!0,I.splice(I.length-b,b))}let _=[];v&&_.push(h);for(let y of I)for(let b of y)_.push(b);return f&&_.push(h),_};function be(t,e){if(!t)return!0;let s=(e.label??String(e.value??"")).toLowerCase(),i=(e.hint??"").toLowerCase(),r=String(e.value).toLowerCase(),o=t.toLowerCase();return s.includes(o)||i.includes(o)||r.includes(o)}var Lt=t=>{let e=(i,r,o,n)=>{let a=o.includes(i.value),l=i.label??String(i.value??""),h=i.hint&&n!==void 0&&i.value===n?u("dim",` (${i.hint})`):"",m=a?u("green",we):u("dim",Vt);return i.disabled?`${u("gray",Vt)} ${u(["strikethrough","gray"],l)}`:r?`${m} ${l}${h}`:`${m} ${u("dim",l)}`},s=new Ft({options:t.options,multiple:!0,placeholder:t.placeholder,filter:t.filter??((i,r)=>be(i,r)),validate:()=>{if(t.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:t.initialValues,signal:t.signal,input:t.input,output:t.output,render(){let i=t.withGuide??F.withGuide,r=`${i?`${u("gray",g)}
22
22
  `:""}${X(this.state)} ${t.message}
23
- `,o=this.userInput,n=t.placeholder,a=o===""&&n!==void 0,l=this.isNavigating||a?u("dim",a?n:o):this.userInputWithCursor,h=this.options,d=this.filteredOptions.length!==h.length?u("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${r}${i?`${u("gray",g)} `:""}${u("dim",`${this.selectedValues.length} items selected`)}`;case"cancel":return`${r}${i?`${u("gray",g)} `:""}${u(["strikethrough","dim"],o)}`;default:{let c=this.state==="error"?"yellow":"cyan",p=i?`${u(c,g)} `:"",v=i?u(c,W):"",f=[`${u("dim","\u2191/\u2193")} to navigate`,`${u("dim",this.isNavigating?"Space/Tab:":"Tab:")} select`,`${u("dim","Enter:")} confirm`,`${u("dim","Type:")} to search`],$=this.filteredOptions.length===0&&o?[`${p}${u("yellow","No matches found")}`]:[],I=this.state==="error"?[`${p}${u("yellow",this.error)}`]:[],S=[...`${r}${i?u(c,g):""}`.split(`
24
- `),`${p}${u("dim","Search:")} ${l}${d}`,...$,...I],P=[`${p}${f.join(" \u2022 ")}`,v],F=kt({cursor:this.cursor,options:this.filteredOptions,style:(_,y)=>e(_,y,this.selectedValues,this.focusedValue),maxItems:t.maxItems,output:t.output,rowPadding:S.length+P.length});return[...S,...F.map(_=>`${p}${_}`),...P].join(`
25
- `)}}}});return s.prompt()};var Lt=t=>{let e=t.active??"Yes",s=t.inactive??"No";return new K({active:e,inactive:s,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue??!0,render(){let i=t.withGuide??V.withGuide,r=`${X(this.state)} `,o=i?`${u("gray",g)} `:"",n=G(t.output,t.message,o,r),a=`${i?`${u("gray",g)}
23
+ `,o=this.userInput,n=t.placeholder,a=o===""&&n!==void 0,l=this.isNavigating||a?u("dim",a?n:o):this.userInputWithCursor,h=this.options,m=this.filteredOptions.length!==h.length?u("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${r}${i?`${u("gray",g)} `:""}${u("dim",`${this.selectedValues.length} items selected`)}`;case"cancel":return`${r}${i?`${u("gray",g)} `:""}${u(["strikethrough","dim"],o)}`;default:{let c=this.state==="error"?"yellow":"cyan",p=i?`${u(c,g)} `:"",v=i?u(c,W):"",f=[`${u("dim","\u2191/\u2193")} to navigate`,`${u("dim",this.isNavigating?"Space/Tab:":"Tab:")} select`,`${u("dim","Enter:")} confirm`,`${u("dim","Type:")} to search`],$=this.filteredOptions.length===0&&o?[`${p}${u("yellow","No matches found")}`]:[],I=this.state==="error"?[`${p}${u("yellow",this.error)}`]:[],S=[...`${r}${i?u(c,g):""}`.split(`
24
+ `),`${p}${u("dim","Search:")} ${l}${m}`,...$,...I],P=[`${p}${f.join(" \u2022 ")}`,v],V=Rt({cursor:this.cursor,options:this.filteredOptions,style:(_,y)=>e(_,y,this.selectedValues,this.focusedValue),maxItems:t.maxItems,output:t.output,rowPadding:S.length+P.length});return[...S,...V.map(_=>`${p}${_}`),...P].join(`
25
+ `)}}}});return s.prompt()};var Dt=t=>{let e=t.active??"Yes",s=t.inactive??"No";return new K({active:e,inactive:s,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue??!0,render(){let i=t.withGuide??F.withGuide,r=`${X(this.state)} `,o=i?`${u("gray",g)} `:"",n=G(t.output,t.message,o,r),a=`${i?`${u("gray",g)}
26
26
  `:""}${n}
27
27
  `,l=this.value?e:s;switch(this.state){case"submit":{let h=i?`${u("gray",g)} `:"";return`${a}${h}${u("dim",l)}`}case"cancel":{let h=i?`${u("gray",g)} `:"";return`${a}${h}${u(["strikethrough","dim"],l)}${i?`
28
- ${u("gray",g)}`:""}`}default:{let h=i?`${u("cyan",g)} `:"",d=i?u("cyan",W):"";return`${a}${h}${this.value?`${u("green",ht)} ${e}`:`${u("dim",Y)} ${u("dim",e)}`}${t.vertical?i?`
28
+ ${u("gray",g)}`:""}`}default:{let h=i?`${u("cyan",g)} `:"",m=i?u("cyan",W):"";return`${a}${h}${this.value?`${u("green",ct)} ${e}`:`${u("dim",Y)} ${u("dim",e)}`}${t.vertical?i?`
29
29
  ${u("cyan",g)} `:`
30
- `:` ${u("dim","/")} `}${this.value?`${u("dim",Y)} ${u("dim",s)}`:`${u("green",ht)} ${s}`}
31
- ${d}
32
- `}}}}).prompt()};var ws={light:m("\u2500","-"),heavy:m("\u2501","="),block:m("\u2588","#")};var J=(t,e)=>t.includes(`
30
+ `:` ${u("dim","/")} `}${this.value?`${u("dim",Y)} ${u("dim",s)}`:`${u("green",ct)} ${s}`}
31
+ ${m}
32
+ `}}}}).prompt()};var Is={light:d("\u2500","-"),heavy:d("\u2501","="),block:d("\u2588","#")};var J=(t,e)=>t.includes(`
33
33
  `)?t.split(`
34
34
  `).map(s=>e(s)).join(`
35
- `):e(t),Dt=t=>{let e=(s,i)=>{let r=s.label??String(s.value);switch(i){case"disabled":return`${u("gray",Y)} ${J(r,o=>u("gray",o))}${s.hint?` ${u("dim",`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${J(r,o=>u("dim",o))}`;case"active":return`${u("green",ht)} ${r}${s.hint?` ${u("dim",`(${s.hint})`)}`:""}`;case"cancelled":return`${J(r,o=>u(["strikethrough","dim"],o))}`;default:return`${u("dim",Y)} ${J(r,o=>u("dim",o))}`}};return new H({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){let s=t.withGuide??V.withGuide,i=`${X(this.state)} `,r=`${we(this.state)} `,o=G(t.output,t.message,r,i),n=`${s?`${u("gray",g)}
35
+ `):e(t),Nt=t=>{let e=(s,i)=>{let r=s.label??String(s.value);switch(i){case"disabled":return`${u("gray",Y)} ${J(r,o=>u("gray",o))}${s.hint?` ${u("dim",`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${J(r,o=>u("dim",o))}`;case"active":return`${u("green",ct)} ${r}${s.hint?` ${u("dim",`(${s.hint})`)}`:""}`;case"cancelled":return`${J(r,o=>u(["strikethrough","dim"],o))}`;default:return`${u("dim",Y)} ${J(r,o=>u("dim",o))}`}};return new H({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){let s=t.withGuide??F.withGuide,i=`${X(this.state)} `,r=`${Ie(this.state)} `,o=G(t.output,t.message,r,i),n=`${s?`${u("gray",g)}
36
36
  `:""}${o}
37
37
  `;switch(this.state){case"submit":{let a=s?`${u("gray",g)} `:"",l=G(t.output,e(this.options[this.cursor],"selected"),a);return`${n}${l}`}case"cancel":{let a=s?`${u("gray",g)} `:"",l=G(t.output,e(this.options[this.cursor],"cancelled"),a);return`${n}${l}${s?`
38
38
  ${u("gray",g)}`:""}`}default:{let a=s?`${u("cyan",g)} `:"",l=s?u("cyan",W):"",h=n.split(`
39
- `).length,d=s?2:1;return`${n}${a}${kt({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:a.length,rowPadding:h+d,style:(c,p)=>e(c,c.disabled?"disabled":p?"active":"inactive")}).join(`
39
+ `).length,m=s?2:1;return`${n}${a}${Rt({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:a.length,rowPadding:h+m,style:(c,p)=>e(c,c.disabled?"disabled":p?"active":"inactive")}).join(`
40
40
  ${a}`)}
41
41
  ${l}
42
- `}}}}).prompt()};var Is=`${u("gray",g)} `;var Nt=t=>new q({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){let e=t?.withGuide??V.withGuide,s=`${`${e?`${u("gray",g)}
42
+ `}}}}).prompt()};var bs=`${u("gray",g)} `;var Gt=t=>new q({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){let e=t?.withGuide??F.withGuide,s=`${`${e?`${u("gray",g)}
43
43
  `:""}${X(this.state)} `}${t.message}
44
44
  `,i=t.placeholder?u("inverse",t.placeholder[0])+u("dim",t.placeholder.slice(1)):u(["inverse","hidden"],"_"),r=this.userInput?this.userInputWithCursor:i,o=this.value??"";switch(this.state){case"error":{let n=this.error?` ${u("yellow",this.error)}`:"",a=e?`${u("yellow",g)} `:"",l=e?u("yellow",W):"";return`${s.trim()}
45
45
  ${a}${r}
@@ -47,8 +47,8 @@ ${l}${n}
47
47
  `}case"submit":{let n=o?` ${u("dim",o)}`:"",a=e?u("gray",g):"";return`${s}${a}${n}`}case"cancel":{let n=o?` ${u(["strikethrough","dim"],o)}`:"",a=e?u("gray",g):"";return`${s}${a}${n}${o.trim()?`
48
48
  ${a}`:""}`}default:{let n=e?`${u("cyan",g)} `:"",a=e?u("cyan",W):"";return`${s}${n}${r}
49
49
  ${a}
50
- `}}}}).prompt();async function Z(t){let e=await Nt(t);return k(e)&&(D("Operation cancelled by user."),process.exit(0)),e}async function Ps(t){if(t.signal?.aborted)throw new tt("Operation cancelled by user.",Q.Interrupted);let e=await Lt(t);if(t.signal?.aborted)throw new tt("Operation cancelled by user.",Q.Interrupted);return k(e)&&(D("Operation cancelled by user."),process.exit(0)),e}async function _e(t){let e=await Dt(t);return k(e)&&(D("Operation cancelled by user."),process.exit(0)),e}var xe=new Set(["__enter_manually__","__prev_page__","__next_page__","__search_again__"]),Gt=10;function Ts(t,e){if(xe.has(t))throw new N(`${e} uses a reserved internal prompt value. Choose or enter a different value.`)}async function Wt(t){let e={enterManually:"(Enter manually...)",previousPage:"\u2190 Previous page",nextPage:"Next page \u2192",searchAgain:"(Search / filter...)"},s=await _e({message:t.message,options:[...t.items.map(i=>({...i,value:{kind:"value",value:i.value,source:"option"}})),...t.controls.map(({control:i,label:r})=>({value:{kind:"control",control:i},label:r??e[i]}))]});return s.kind==="control"&&s.control==="enterManually"?{kind:"value",value:await Z({message:t.manualPromptMessage??t.message}),source:"manual"}:s.kind==="control"?{kind:"control",control:s.control}:s}function As(t,e){return[...Array.isArray(e)?e:[],t]}async function Vs(t){let e=[...t.options.map(n=>({...n,value:{kind:"value",value:n.value}})),{value:{kind:"manual"},label:"(Enter a table name manually...)"}],s=await Rt({message:t.message,options:e,maxItems:t.maxItems??Gt,required:!0,filter:(n,a)=>{let l=n.toLowerCase(),h=a.value.kind==="value"?a.value.value:"";return[a.label??"",a.hint??"",h].some(d=>d.toLowerCase().includes(l))}});k(s)&&(D("Operation cancelled by user."),process.exit(0));let i=s,r=i.flatMap(n=>n.kind==="value"?[{value:n.value,source:"option"}]:[]);i.some(n=>n.kind==="manual")&&r.push({value:await Z({message:t.manualPromptMessage??t.message}),source:"manual"});let o=new Map;for(let n of r)o.has(n.value)||o.set(n.value,n);return[...o.values()]}async function Fs(t){return(await Ce(t)).value}async function Ce(t){let e=t.pageSize??Gt,s=t.options;if(s.length<=e){let o=await jt(t.message,s,t.manualPromptMessage,!1);if(o.kind!=="value")throw new Error("Prompt returned an unexpected control selection.");return{value:o.value,source:o.source}}let i="",r={kind:"control",control:"searchAgain"};for(;r.kind==="control"&&r.control==="searchAgain";){let o=i.toLowerCase(),n=i?s.filter(l=>l.label.toLowerCase().includes(o)||l.value.toLowerCase().includes(o)):s,a=i?` \u2014 filtering "${i}" (${n.length}/${s.length})`:` (${s.length} total)`;r=await Ee(`${t.message}${a}`,n,t.manualPromptMessage,e),r.kind==="control"&&r.control==="searchAgain"&&(i=await Z({message:"Filter (leave blank to show all):"}))}if(r.kind!=="value")throw new Error("Prompt returned an unexpected control selection.");return{value:r.value,source:r.source}}async function Ee(t,e,s,i){if(e.length<=i)return jt(t,e,s,!0);let r=Math.ceil(e.length/i),o=0,n={kind:"control",control:"previousPage"};for(;n.kind==="control"&&(n.control==="previousPage"||n.control==="nextPage");){let a=o*i,l=e.slice(a,a+i),h=[];if(o>0&&h.push({control:"previousPage"}),o<r-1){let c=e.length-(a+i);h.push({control:"nextPage",label:`Next page \u2192 (${c} more)`})}h.push({control:"searchAgain"},{control:"enterManually"});let d=`${t} [page ${o+1}/${r}]`;n=await Wt({message:d,items:l,controls:h,manualPromptMessage:s}),n.kind==="control"&&n.control==="previousPage"?o--:n.kind==="control"&&n.control==="nextPage"&&o++}return n}async function jt(t,e,s,i){return Wt({message:t,items:e,controls:i?[{control:"searchAgain"},{control:"enterManually"}]:[{control:"enterManually"}],manualPromptMessage:s})}function Os(t){let{flags:e,env:s,message:i,initialValue:r,description:o,default:n}=t;return{flags:e,env:s,description:o,default:n,customPrompt:async()=>await Z({message:i,initialValue:r})}}function Me(t){let e=t.match(/\/environments\/([^/]+)\/?$/);return e?e[1]:t}function ks(){if(!et().appConfig)throw new N(`No ${j} found in the current directory. Run \`${"ms"} app create\` to scaffold an app, or run this command from an existing app directory.`)}async function Rs(t){let e=await t.getOption("app",!0),s=et().appConfig?.appId,i=e??s;if(!i)throw new N(`Argument app is required. Use --app to specify it, or run this command from a directory with a ${j} (created by \`ms app create\`).`);return i}async function Ls(t,e={}){let{failIfMissing:s=!0}=e,i=e.overridesOnly?t.getEnvironmentId({overridesOnly:!0}):t.getEnvironmentId();if(!i){if(s)throw new N(`No environment ID found. Use --environment-id or -e to specify it, or run this command from a directory with a ${j} (created by \`ms app create\`).`);return}return Me(i)}function Ds(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function Ns(t,e){switch(t){case"gcchigh":case"dod":return`https://login.microsoftonline.us/${e||"organizations"}`;case"mooncake":return`https://login.partner.microsoftonline.cn/${e||"organizations"}`;default:return`https://login.microsoftonline.com/${e||"organizations"}`}}export{Z as a,Ps as b,_e as c,Ts as d,As as e,Vs as f,Fs as g,Ce as h,Os as i,Me as j,ks as k,Rs as l,Ls as m,Ds as n,Ns as o};
50
+ `}}}}).prompt();async function Z(t){let e=await Gt(t);return k(e)&&(N("Operation cancelled by user."),process.exit(0)),e}async function As(t){if(t.signal?.aborted)throw new tt("Operation cancelled by user.",Q.Interrupted);let e=await Dt(t);if(t.signal?.aborted)throw new tt("Operation cancelled by user.",Q.Interrupted);return k(e)&&(N("Operation cancelled by user."),process.exit(0)),e}async function xe(t){let e=await Nt(t);return k(e)&&(N("Operation cancelled by user."),process.exit(0)),e}var Ce=new Set(["__enter_manually__","__prev_page__","__next_page__","__search_again__"]),Wt=10;function Fs(t,e){if(Ce.has(t))throw new D(`${e} uses a reserved internal prompt value. Choose or enter a different value.`)}async function jt(t){let e={enterManually:"(Enter manually...)",previousPage:"\u2190 Previous page",nextPage:"Next page \u2192",searchAgain:"(Search / filter...)"},s=await xe({message:t.message,options:[...t.items.map(i=>({...i,value:{kind:"value",value:i.value,source:"option"}})),...t.controls.map(({control:i,label:r})=>({value:{kind:"control",control:i},label:r??e[i]}))]});return s.kind==="control"&&s.control==="enterManually"?{kind:"value",value:await Z({message:t.manualPromptMessage??t.message}),source:"manual"}:s.kind==="control"?{kind:"control",control:s.control}:s}function Vs(t,e){return[...Array.isArray(e)?e:[],t]}async function Os(t){let e=[...t.options.map(n=>({...n,value:{kind:"value",value:n.value}})),{value:{kind:"manual"},label:"(Enter a table name manually...)"}],s=await Lt({message:t.message,options:e,maxItems:t.maxItems??Wt,required:!0,filter:(n,a)=>{let l=n.toLowerCase(),h=a.value.kind==="value"?a.value.value:"";return[a.label??"",a.hint??"",h].some(m=>m.toLowerCase().includes(l))}});k(s)&&(N("Operation cancelled by user."),process.exit(0));let i=s,r=i.flatMap(n=>n.kind==="value"?[{value:n.value,source:"option"}]:[]);i.some(n=>n.kind==="manual")&&r.push({value:await Z({message:t.manualPromptMessage??t.message}),source:"manual"});let o=new Map;for(let n of r)o.has(n.value)||o.set(n.value,n);return[...o.values()]}async function ks(t){return(await Ee(t)).value}async function Ee(t){let e=t.pageSize??Wt,s=t.options;if(s.length<=e){let o=await Ut(t.message,s,t.manualPromptMessage,!1);if(o.kind!=="value")throw new Error("Prompt returned an unexpected control selection.");return{value:o.value,source:o.source}}let i="",r={kind:"control",control:"searchAgain"};for(;r.kind==="control"&&r.control==="searchAgain";){let o=i.toLowerCase(),n=i?s.filter(l=>l.label.toLowerCase().includes(o)||l.value.toLowerCase().includes(o)):s,a=i?` \u2014 filtering "${i}" (${n.length}/${s.length})`:` (${s.length} total)`;r=await Me(`${t.message}${a}`,n,t.manualPromptMessage,e),r.kind==="control"&&r.control==="searchAgain"&&(i=await Z({message:"Filter (leave blank to show all):"}))}if(r.kind!=="value")throw new Error("Prompt returned an unexpected control selection.");return{value:r.value,source:r.source}}async function Me(t,e,s,i){if(e.length<=i)return Ut(t,e,s,!0);let r=Math.ceil(e.length/i),o=0,n={kind:"control",control:"previousPage"};for(;n.kind==="control"&&(n.control==="previousPage"||n.control==="nextPage");){let a=o*i,l=e.slice(a,a+i),h=[];if(o>0&&h.push({control:"previousPage"}),o<r-1){let c=e.length-(a+i);h.push({control:"nextPage",label:`Next page \u2192 (${c} more)`})}h.push({control:"searchAgain"},{control:"enterManually"});let m=`${t} [page ${o+1}/${r}]`;n=await jt({message:m,items:l,controls:h,manualPromptMessage:s}),n.kind==="control"&&n.control==="previousPage"?o--:n.kind==="control"&&n.control==="nextPage"&&o++}return n}async function Ut(t,e,s,i){return jt({message:t,items:e,controls:i?[{control:"searchAgain"},{control:"enterManually"}]:[{control:"enterManually"}],manualPromptMessage:s})}function Rs(t){let{flags:e,env:s,message:i,initialValue:r,description:o,default:n}=t;return{flags:e,env:s,description:o,default:n,customPrompt:async()=>await Z({message:i,initialValue:r})}}function Pe(t){let e=t.match(/\/environments\/([^/]+)\/?$/);return e?e[1]:t}function Ls(){if(!mt().appConfig)throw new D(`No ${j} found in the current directory. Run \`${"ms"} app create\` to scaffold an app, or run this command from an existing app directory.`)}async function Ds(t){let s=await t.getOption("app",!0)??await dt();if(!s)throw new D(`Argument app is required. Use --app to specify it, or run this command from a directory with a ${j} (created by \`ms app create\`).`);return s}async function Ns(t,e={}){let{failIfMissing:s=!0}=e,i=e.overridesOnly?t.getEnvironmentId({overridesOnly:!0}):t.getEnvironmentId();if(!i){if(s)throw new D(`No environment ID found. Use --environment-id or -e to specify it, or run this command from a directory with a ${j} (created by \`ms app create\`).`);return}return Pe(i)}function Gs(t){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function Ws(t,e){switch(t){case"gcchigh":case"dod":return`https://login.microsoftonline.us/${e||"organizations"}`;case"mooncake":return`https://login.partner.microsoftonline.cn/${e||"organizations"}`;default:return`https://login.microsoftonline.com/${e||"organizations"}`}}export{Z as a,As as b,xe as c,Fs as d,Vs as e,Os as f,ks as g,Ee as h,Rs as i,Pe as j,Ls as k,Ds as l,Ns as m,Gs as n,Ws as o};
51
51
  /*!
52
52
  * Copyright (C) Microsoft Corporation. All rights reserved.
53
53
  */
54
- //# sourceMappingURL=chunk-GE3UFHZ5.js.map
54
+ //# sourceMappingURL=chunk-ZLK2CMMJ.js.map
@@ -0,0 +1,11 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __pathDirname(__filename);
7
+ import{f as o,h as s,i as n}from"./chunk-C7UWPNC3.js";var a=["LOG_STREAM","LOG_TOKENS"];async function f(r){let i=new Map(a.map(e=>[e,o(e)]));for(let e of a)n(e);try{return await r()}finally{for(let[e,t]of i)t===void 0?n(e):s(e,t)}}export{f as a};
8
+ /*!
9
+ * Copyright (C) Microsoft Corporation. All rights reserved.
10
+ */
11
+ //# sourceMappingURL=chunk-ZWJ5T5VI.js.map