@metricinsights/pp-dev 1.5.0-beta.1 → 1.5.0-beta.3

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 (36) hide show
  1. package/README.md +6 -1
  2. package/dist/README.md +6 -1
  3. package/dist/cjs/cli.js +1 -1
  4. package/dist/cjs/{index-FgUi7Fqw.js → index-CCUrjlJE.js} +2 -2
  5. package/dist/cjs/{index-FgUi7Fqw.js.map → index-CCUrjlJE.js.map} +1 -1
  6. package/dist/cjs/index.js +1 -1
  7. package/dist/cjs/{migrate-pmX6NEmP.js → migrate-BYno__sx.js} +2 -2
  8. package/dist/cjs/{migrate-pmX6NEmP.js.map → migrate-BYno__sx.js.map} +1 -1
  9. package/dist/cjs/package.json +1 -1
  10. package/dist/cjs/plugin-D_RXI7ru.js +2 -0
  11. package/dist/cjs/plugin-D_RXI7ru.js.map +1 -0
  12. package/dist/cjs/plugin.js +1 -1
  13. package/dist/cjs/{version-plugin-0EjcUgtP.js → version-plugin-Bf4jLh17.js} +2 -2
  14. package/dist/cjs/{version-plugin-0EjcUgtP.js.map → version-plugin-Bf4jLh17.js.map} +1 -1
  15. package/dist/client/client.css +1 -1
  16. package/dist/client/client.css.map +1 -1
  17. package/dist/client/client.js +89 -8
  18. package/dist/client/client.js.map +1 -1
  19. package/dist/esm/cli.js +1 -1
  20. package/dist/esm/{index-BA9vecJD.js → index-BazQY12s.js} +2 -2
  21. package/dist/esm/{index-BA9vecJD.js.map → index-BazQY12s.js.map} +1 -1
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/{migrate-Dsd7Aqx-.js → migrate-B2gJ62fm.js} +2 -2
  24. package/dist/esm/{migrate-Dsd7Aqx-.js.map → migrate-B2gJ62fm.js.map} +1 -1
  25. package/dist/esm/package.json +1 -1
  26. package/dist/esm/plugin-NIWxLreC.js +2 -0
  27. package/dist/esm/plugin-NIWxLreC.js.map +1 -0
  28. package/dist/esm/plugin.js +1 -1
  29. package/dist/esm/{version-plugin-pYbaqnAH.js → version-plugin-DwuZCHob.js} +2 -2
  30. package/dist/esm/{version-plugin-pYbaqnAH.js.map → version-plugin-DwuZCHob.js.map} +1 -1
  31. package/docs/features.md +8 -5
  32. package/package.json +1 -1
  33. package/dist/cjs/plugin-yWlSj5sK.js +0 -2
  34. package/dist/cjs/plugin-yWlSj5sK.js.map +0 -1
  35. package/dist/esm/plugin-CFtRWPwU.js +0 -2
  36. package/dist/esm/plugin-CFtRWPwU.js.map +0 -1
package/README.md CHANGED
@@ -544,6 +544,8 @@ A standalone page at `/@pp-dev/variables-editor`, alongside the [Request Inspect
544
544
 
545
545
  - **Values** — edit the page's live variable values in place, with type-aware widgets (searchable select for `static` options, a per-item form for `list`, …). A JSON mode (`View/edit raw JSON`) shows/accepts the same values as plain JSON — list-type values as native arrays, not double-escaped strings — with **Save to JSON file…** / **Import from JSON file…** buttons, and flags values that don't match a declared option, changed since the last load, or aren't in the schema.
546
546
 
547
+ The pages the dev server serves substitute `[VarName]` from its own copy of the values, loaded from MI with the page data. **Save** updates that copy too, so every tab (any user) shows the saved values on its next load. When the values in MI change some other way (edited in MI itself, or the update after a save failed), the Values tab shows **Update local pages · N** in its bottom-right corner; its tooltip lists the values that differ, and a click updates the copy.
548
+
547
549
  ![Variables Editor — Values tab](./docs/screenshots/09-editor-values.png)
548
550
 
549
551
  Both the active tab and Values' JSON mode are reflected in the URL (`?tab=values&mode=json`), so a specific view can be bookmarked or shared.
@@ -576,7 +578,9 @@ Every saved user gets its own host: `<name>.localhost:<port>`. The browser sends
576
578
  - **API token**: the token is checked with MI before the user is added. SSO users can only be added this way.
577
579
  - **Username + password** (local MI users): pp-dev adds the user and opens MI's usual login page on the user's own host. You log in there as in MI — 2FA included — and pp-dev never sees the password. Until then the user is *not logged in yet*; once MI ends the session it is *session expired* and **Log in** opens the login page again.
578
580
 
579
- The name becomes the user's host, so it may contain only lowercase latin letters, digits and `-`, must start with a letter and be at most 32 characters long. Users can't be renamed: remove and add them again.
581
+ The name becomes the user's host, so it may contain only lowercase latin letters, digits and `-`, must start with a letter and be at most 32 characters long.
582
+
583
+ **Edit** on a user added with an API token renames it or replaces its token (a new token is checked with MI; left empty, the current one stays). While the dev server runs, a page load on its old host (an open tab, a bookmark) moves to the new one, and requests from tabs still open there keep working as the user. A user that logs in with a password can't be edited, since its MI session lives in its host's cookies: remove it and add it again.
580
584
 
581
585
  ### Logging out and removing
582
586
 
@@ -604,6 +608,7 @@ The popover uses a small JSON API:
604
608
  | `GET` | `/@api/users` | The users (name, kind, state, MI user, `origin`, `loginUrl`), the default user, and whether users are available |
605
609
  | `POST` | `/@api/users` | Add a user: `{ "name", "token" }`, or `{ "name", "kind": "session" }` to log in with a password |
606
610
  | `PUT` | `/@api/users/default` | Make a user the default: `{ "name" }`, or `{ "name": null }` for you |
611
+ | `PATCH` | `/@api/users/:name` | Edit a user added with an API token: `{ "name" }` to rename it, `{ "token" }` to replace its token |
607
612
  | `DELETE` | `/@api/users/:name` | Remove a user |
608
613
 
609
614
  Tokens and MI sessions are never sent back.
package/dist/README.md CHANGED
@@ -544,6 +544,8 @@ A standalone page at `/@pp-dev/variables-editor`, alongside the [Request Inspect
544
544
 
545
545
  - **Values** — edit the page's live variable values in place, with type-aware widgets (searchable select for `static` options, a per-item form for `list`, …). A JSON mode (`View/edit raw JSON`) shows/accepts the same values as plain JSON — list-type values as native arrays, not double-escaped strings — with **Save to JSON file…** / **Import from JSON file…** buttons, and flags values that don't match a declared option, changed since the last load, or aren't in the schema.
546
546
 
547
+ The pages the dev server serves substitute `[VarName]` from its own copy of the values, loaded from MI with the page data. **Save** updates that copy too, so every tab (any user) shows the saved values on its next load. When the values in MI change some other way (edited in MI itself, or the update after a save failed), the Values tab shows **Update local pages · N** in its bottom-right corner; its tooltip lists the values that differ, and a click updates the copy.
548
+
547
549
  ![Variables Editor — Values tab](./docs/screenshots/09-editor-values.png)
548
550
 
549
551
  Both the active tab and Values' JSON mode are reflected in the URL (`?tab=values&mode=json`), so a specific view can be bookmarked or shared.
@@ -576,7 +578,9 @@ Every saved user gets its own host: `<name>.localhost:<port>`. The browser sends
576
578
  - **API token**: the token is checked with MI before the user is added. SSO users can only be added this way.
577
579
  - **Username + password** (local MI users): pp-dev adds the user and opens MI's usual login page on the user's own host. You log in there as in MI — 2FA included — and pp-dev never sees the password. Until then the user is *not logged in yet*; once MI ends the session it is *session expired* and **Log in** opens the login page again.
578
580
 
579
- The name becomes the user's host, so it may contain only lowercase latin letters, digits and `-`, must start with a letter and be at most 32 characters long. Users can't be renamed: remove and add them again.
581
+ The name becomes the user's host, so it may contain only lowercase latin letters, digits and `-`, must start with a letter and be at most 32 characters long.
582
+
583
+ **Edit** on a user added with an API token renames it or replaces its token (a new token is checked with MI; left empty, the current one stays). While the dev server runs, a page load on its old host (an open tab, a bookmark) moves to the new one, and requests from tabs still open there keep working as the user. A user that logs in with a password can't be edited, since its MI session lives in its host's cookies: remove it and add it again.
580
584
 
581
585
  ### Logging out and removing
582
586
 
@@ -604,6 +608,7 @@ The popover uses a small JSON API:
604
608
  | `GET` | `/@api/users` | The users (name, kind, state, MI user, `origin`, `loginUrl`), the default user, and whether users are available |
605
609
  | `POST` | `/@api/users` | Add a user: `{ "name", "token" }`, or `{ "name", "kind": "session" }` to log in with a password |
606
610
  | `PUT` | `/@api/users/default` | Make a user the default: `{ "name" }`, or `{ "name": null }` for you |
611
+ | `PATCH` | `/@api/users/:name` | Edit a user added with an API token: `{ "name" }` to rename it, `{ "token" }` to replace its token |
607
612
  | `DELETE` | `/@api/users/:name` | Remove a user |
608
613
 
609
614
  Tokens and MI sessions are never sent back.
package/dist/cjs/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("path"),t=require("fs"),o=require("node:events"),n=require("node:perf_hooks"),i=require("chokidar"),r=require("cac"),s=require("./plugin-yWlSj5sK.js"),a=require("./index-FgUi7Fqw.js"),l=require("vite"),c=require("url"),d=require("dir-compare"),p=require("diff-match-patch"),f=require("isbinaryfile"),u=require("os"),g=require("crypto"),h=require("svgtofont"),m=require("ws");require("http-proxy-middleware"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("process"),require("child_process"),require("node:path"),require("jszip"),require("module"),require("zlib"),require("express"),require("node:crypto"),require("node:fs"),require("node:os"),require("./helpers.js"),require("ejs");const v=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function b(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const o in e)t[o]=e[o];return t.default=e,Object.freeze(t)}const w=b(e),y=b(t),P=b(d),x=v(p),S=b(u),E=b(g),T=v(h);function L(e){return null!=e&&!1!==e}let k=null;const D=[{key:"r",description:"restart the server",async action(e){await e.restart()}},{key:"u",description:"show server url",action(e){e.config.logger.info(""),e.printUrls()}},{key:"o",description:"open in browser",action(e){e.openBrowser()}},{key:"c",description:"clear console",action(e){e.config.logger.clearScreen("error")}},{key:"q",description:"quit",async action(e){await e.close().finally(()=>process.exit())}},{key:"C",description:"clear proxy cache",action(e){e.cache&&(e.cache.clear(),e.config.logger.info("Proxy cache cleared"))}}];const I=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class F{oldAssetsPath;newAssetsPath;destinationPath;changelogFilename;changelogTemplate='<!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Changelog Diff</title>\n <style>\n tr,\n td {\n padding: 0;\n }\n .diff-file {\n margin-top: 20px;\n border: 1px solid #e1e4e8;\n border-radius: 6px;\n }\n .diff-file-title {\n padding: 10px 20px;\n background-color: #f6f8fa;\n border-bottom: 1px solid #e1e4e8;\n border-radius: 6px 6px 0 0;\n font-weight: bold;\n }\n .diff-file-title .renamed {\n font-weight: normal;\n }\n .diff-file-title .renamed .from {\n color: #cb2431;\n }\n .diff-file-title .renamed .to {\n color: #22863a;\n }\n .diff-file-title .added {\n color: #22863a;\n }\n .diff-file-title .deleted {\n color: #cb2431;\n }\n .diff-file-content {\n }\n .diff-table {\n tab-size: 8;\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n }\n .blob-num {\n position: relative;\n color: #1f2328;\n width: 1%;\n min-width: 50px;\n padding: 0 10px;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n line-height: 20px;\n text-align: right;\n white-space: nowrap;\n vertical-align: top;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n }\n .blob-num.addition {\n background-color: #ccffd8;\n border-color: #1f883e;\n }\n .blob-num.deletion {\n background-color: #ffd7d5;\n border-color: #cf222e;\n }\n .blob-num::before {\n content: attr(data-line-number);\n }\n .blob-code {\n position: relative;\n padding: 0 10px 0 22px;\n vertical-align: top;\n color: #1f2329;\n }\n .blob-code.code-addition {\n background-color: #e6ffec;\n }\n .blob-code.code-deletion {\n background-color: #ffebe9;\n }\n .blob-code.skip,\n .blob-code.message {\n text-align: center;\n }\n .blob-code.skip .blob-code-inner,\n .blob-code.message .blob-code-inner {\n font-weight: bold;\n color: #6a737d;\n padding: 10px 0;\n }\n .blob-code-inner {\n display: table-cell;\n overflow: visible;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n word-wrap: anywhere;\n white-space: pre-wrap;\n }\n .blob-code-inner::before {\n content: attr(data-code-prefix);\n position: absolute;\n top: 1px;\n left: 8px;\n padding-right: 8px;\n }\n </style>\n </head>\n <body>\n <h1>Changelog Diff</h1>\n\n %FILES%\n </body>\n </html>';diffFileTemplateHandler;diffLineTemplateHandler;contextLines=3;logger;constructor(e){const{oldAssetsPath:t,newAssetsPath:o,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=e;if(this.logger=s.createLogger(),!t||!o||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(t===o)throw new Error("Previous and current assets paths must be different");if(!this.isExists(t))throw new Error(`Previous assets path ${t} does not exist`);if(!this.isExists(o))throw new Error(`Current assets path ${o} does not exist`);if(this.isZipFile(t)){const e=w.resolve(S.tmpdir(),E.createHash("md5").update(t).digest("hex"));this.oldAssetsPath=this.unzipFile(t,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(t))throw new Error(`Invalid previous assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(o)){const e=w.resolve(S.tmpdir(),E.createHash("md5").update(o).digest("hex"));this.newAssetsPath=this.unzipFile(o,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid current assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${o} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=n,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",i&&(this.templateIsValid(i)?this.changelogTemplate=i:this.logger.warn(s.colors.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof a&&(this.diffLineTemplateHandler=a),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return y.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return y.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===y.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){y.existsSync(e)||y.mkdirSync(e,{recursive:!0})}async unzipFile(e,t){y.rmSync(t,{force:!0,recursive:!0}),await s.extractZipSafe(e,t)}normalizeAssetFolderPath(e){const t=y.readdirSync(e);return 1===t.length&&y.lstatSync(w.join(e,t[0])).isDirectory()?this.normalizeAssetFolderPath(w.join(e,t[0])):e}pathToPosix(e){return e.replace(/\\/g,"/")}diffTableTemplate(e){return`<table class="diff-table">\n <tbody>\n ${e}\n </tbody>\n </table>`}getDiffTableHTML(e){const t=e.filter((e,t,o)=>0!==e.lineType||(t>=0&&t<this.contextLines||t>o.length-(this.contextLines+1)&&t<=o.length-1||o.slice(t-this.contextLines,t+this.contextLines+1).some(e=>0!==e.lineType))).map((e,t,o)=>{if(t>0){const n=o[t-1];if(e.lineNumber-n.lineNumber>1)return[{lineNumber:-1,lineContent:"",lineType:0},e]}return[e]}).flat().map(e=>this.diffLineHTML(e)).join("");return this.diffTableTemplate(t)}diffLineMessageTemplate(e){return`<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code message">\n <span class="blob-code-inner">${e}</span>\n </td>\n </tr>`}diffLineSkipTemplate(){return'<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code skip">\n <span class="blob-code-inner">Skip</span>\n </td>\n </tr>'}diffLineTemplate(e){const{lineNumber:t,lineContent:o,lineType:n}=e,i=1===n?"addition":-1===n?"deletion":"";return`<tr>\n <td\n class="blob-num ${i}${"addition"===i?" empty":""}"\n ${"addition"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td class="blob-code ${1===n?"code-addition":-1===n?"code-deletion":""}">\n <span class="blob-code-inner" data-code-prefix="${1===n?"+":-1===n?"-":" "}">${r=o??"",r.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var r}diffLineHTML(e){if(this.diffLineTemplateHandler)return this.diffLineTemplateHandler(e);const{lineNumber:t}=e;return-1===t?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,t){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,t):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${t}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(s.colors.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await P.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,t)=>(I.test(e)&&(e=e.replace(I,"$1$3")),I.test(t)&&(t=t.replace(I,"$1$3")),0===e.localeCompare(t)?0:e.localeCompare(t)>0?1:-1)});return e.diffSet?.filter(e=>"equal"!==e.state||e.name1!==e.name2)||[]}async generateAssetFilesDiff(e,t){const o=new x,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let r=0;return i.map(e=>{const[t,o]=e,n=o.endsWith("\n")?o.split("\n").length-1:o.split("\n").length,i=o.split("\n").map((e,o)=>({lineContent:e,lineNumber:r+o+1,lineType:t})).slice(0,n);return-1!==t&&(r+=n),i}).flat()}async generateFilesDiff(e){if("equal"===e.state){const t=this.pathToPosix(w.join(".",e.relativePath,e.name1??"")),o=this.pathToPosix(w.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${o}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const t=e.path1&&e.name1?w.join(e.path1,e.name1):null,o=e.path2&&e.name2?w.join(e.path2,e.name2):null,n=this.pathToPosix(w.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&t)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&o)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&t&&o){const i=this.pathToPosix(w.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(w.join(".",e.relativePath,e.name2??"")),s=e.name1!==e.name2?`<span class="renamed"\n >Renamed <span class="from">${i}</span> -> <span class="to">${r}</span></span\n >`:n;return this.diffFileTemplate(s,await f.isBinaryFile(t)||await f.isBinaryFile(o)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(y.readFileSync(t,"utf-8"),y.readFileSync(o,"utf-8"))))}return""}async generateChangelog(){this.logger.info(s.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),t=(await Promise.all(e.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(s.colors.green("Writing changelog file"));const o=this.changelogTemplate.split("%FILES%");o.splice(1,0,t);const n=o.join("");y.writeFileSync(w.join(this.destinationPath,this.changelogFilename),n),this.logger.info(s.colors.green(`Changelog file written to ${w.join(this.destinationPath,this.changelogFilename)}`))}}class _{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await T({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class ${wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new m.WebSocketServer({noServer:!0}),this.wss.on("connection",e=>this.onConnection(e)),this.wss.on("error",e=>this.fireLifecycle("error",e)),this.ws={on:(e,t)=>{"close"!==e&&"error"!==e?this.getEventSet(e).add(t):this.getLifecycleSet(e).add(t)},off:(e,t)=>{this.eventListeners.get(e)?.delete(t),"close"!==e&&"error"!==e||this.lifecycleListeners.get(e)?.delete(t)},send:(e,t)=>{if("string"==typeof e)for(const o of this.clients.keys())this.sendToSocket(o,e,t);else{const t=JSON.stringify(e);for(const e of this.clients.keys())e.readyState===m.WebSocket.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){return(e.url??"").split("?")[0]===s.PP_DEV_HMR_WS_PATH&&(this.wss.handleUpgrade(e,t,o,t=>{this.wss.emit("connection",t,e)}),!0)}async close(){this.fireLifecycle("close");for(const e of this.clients.keys())e.terminate();this.clients.clear(),await new Promise(e=>this.wss.close(()=>e()))}onConnection(e){const t={send:(t,o)=>this.sendToSocket(e,t,o)};this.clients.set(e,t),e.on("message",e=>this.onMessage(t,e)),e.on("close",()=>this.clients.delete(e)),e.on("error",()=>{})}onMessage(e,t){let o;try{o=JSON.parse(t.toString())}catch{return}if(!o||"custom"!==o.type||"string"!=typeof o.event)return;const n=this.eventListeners.get(o.event);if(n)for(const t of n)try{t(o.data,e)}catch(e){s.createLogger().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===m.WebSocket.OPEN&&e.send(JSON.stringify({type:"custom",event:t,data:o}))}fireLifecycle(e,t){for(const o of this.lifecycleListeners.get(e)??[])try{o(t)}catch{}}getEventSet(e){let t=this.eventListeners.get(e);return t||(t=new Set,this.eventListeners.set(e,t)),t}getLifecycleSet(e){let t=this.lifecycleListeners.get(e);return t||(t=new Set,this.lifecycleListeners.set(e,t)),t}}const j=r.cac("pp-dev");function A(e,t,o){const n=[...s.PP_DEV_CONFIG_NAMES,"package.json","next.config.js","next.config.mjs","next.config.ts","vite.config.js","vite.config.mjs","vite.config.ts",".env",".env.local",".env.development",".env.development.local"].map(t=>w.join(e,t)),r=i.watch(n,{ignored:e=>{const t=w.basename(e);return/(^|[\/\\])\../.test(e)&&!t.startsWith(".env")&&!t.startsWith(".pp-dev")&&!t.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",n=>{o(s.colors.blue(`🔧 Config file changed: ${w.relative(e,n)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{o(s.colors.yellow("🔄 Restarting dev server due to config change...")),await t()}catch(e){o(s.colors.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{o(s.colors.red(`❌ Config watcher error: ${e}`))}),{watcher:r,restartCallback:t,logger:o}}function C(e){e.watcher&&e.watcher.close()}function N(e){if(!e||"object"!=typeof e||!("message"in e))return!1;const t=String(e.message);return/Turbopack is not supported/i.test(t)||/native bindings are not available/i.test(t)||/Only WebAssembly \(WASM\) bindings were loaded/i.test(t)}async function R(e){const{changelog:t,executionRoot:o,newAssetsPath:n,backupsDirPath:i,changelogDestinationPath:r,logLevel:a}=e;let l;if("string"==typeof t)l=w.resolve(o,t);else{if(!y.existsSync(i))return void s.createLogger(a).warn(s.colors.yellow("backups directory not found, skipping changelog generation"));const e=y.readdirSync(i,{withFileTypes:!0});if(!e.length)return void s.createLogger(a).warn(s.colors.yellow("no backups found, skipping changelog generation"));const t=e.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!t.length)return void s.createLogger(a).warn(s.colors.yellow("no ZIP backups found, skipping changelog generation"));const o=t.reduce((e,t)=>y.statSync(w.resolve(i,e.name)).mtimeMs>y.statSync(w.resolve(i,t.name)).mtimeMs?e:t).name;l=w.resolve(i,o)}const c=new F({oldAssetsPath:l,newAssetsPath:n,destinationPath:r});await c.generateChangelog()}let M=global.__pp_dev_profile_session,q=0;const O=e=>{if(M)return new Promise((t,o)=>{M.post("Profiler.stop",(n,{profile:i})=>{if(n)o(n);else{const o=w.resolve(`./pp-dev-profile-${q++}.cpuprofile`);y.writeFileSync(o,JSON.stringify(i)),e(s.colors.yellow(`CPU profile written to ${s.colors.white(s.colors.dim(o))}`)),M=void 0,t()}})})},V=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};function H(e){const t={...e};return delete t["--"],delete t.c,delete t.config,delete t.base,delete t.l,delete t.logLevel,delete t.clearScreen,delete t.d,delete t.debug,delete t.f,delete t.filter,delete t.m,delete t.mode,t}j.option("-c, --config <file>","[string] use specified config file").option("--base <path>","[string] public base path (default: /)").option("-l, --logLevel <level>","[string] info | warn | error | silent").option("--clearScreen","[boolean] allow/disable clear screen when logging").option("-d, --debug [feat]","[string | boolean] show debug logs").option("-f, --filter <filter>","[string] filter debug logs").option("-m, --mode <mode>","[string] set env mode"),j.command("[root]","start dev server").alias("serve").alias("dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{V(t);let o=null,i=null,r=!1;const c=e?w.resolve(process.cwd(),e):process.cwd(),d=s.createLogger(t.logLevel),p=async()=>{if(!r){r=!0;try{o&&(d.info(s.colors.yellow("🛑 Stopping existing dev server...")),await o.close(),o=null);const{clearConfigCache:f,getConfig:u}=await Promise.resolve().then(()=>require("./index-FgUi7Fqw.js")).then(e=>e.config);f();const{createServer:g}=await(import("vite")),h=t.mode||"development",m=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(h,m);const v=await l.loadConfigFromFile({mode:h,command:"serve"},t.config,e,t.logLevel);let b=await a.getViteConfig(void 0,{mode:h,root:m});if(v){const{plugins:e,...t}=v.config;b=l.mergeConfig(b,t)}if(o=await g(l.mergeConfig(b,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},server:H(t),customLogger:d},!0)),!o.config.base||"/"===o.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!o.httpServer)throw new Error("HTTP server not available");await o.listen();const y=global.__pp_dev_start_time??!1,P=y?s.colors.dim(`ready in ${s.colors.reset(s.colors.bold(Math.ceil(n.performance.now()-y)))} ms`):"";d.info(`\n ${s.colors.green(`${s.colors.bold("PP-DEV")} v${s.VERSION}`)} ${P}\n`),o.printUrls();const x=await u(m);if(!1!==x.inspector?.enabled){const e=o.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${o.config.server.port??5173}`;d.info(`\n ${s.colors.cyan("🔍 Request Inspector")} ${s.colors.dim(t+s.INSPECTOR_PATH)}\n`)}!function(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=t;const o=s.createLogger();t.print&&o.info(s.colors.dim(s.colors.green(" ➜"))+s.colors.dim(" press ")+s.colors.bold("h")+s.colors.dim(" to show help"));const n=(t.customShortcuts??[]).filter(L).concat(D);k?.(),k=null;let i=!1;const r=process.stdin.isPaused(),a=process.stdin,l=Boolean(a.isRaw),c=async t=>{if(""===t)return void process.kill(process.pid,"SIGINT");if(""===t)return void await e.close().finally(()=>process.exit(0));if(i)return;"h"===t&&o.info(["",s.colors.bold(" Shortcuts"),...n.map(e=>s.colors.dim(" press ")+s.colors.bold(e.key)+s.colors.dim(` to ${e.description}`))].join("\n"));const r=n.find(e=>e.key===t);r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",c).setEncoding("utf8").resume();const d=e.httpServer,p=()=>{k===p&&(d.removeListener("close",p),process.stdin.off("data",c),l||process.stdin.setRawMode(!1),r&&process.stdin.pause(),k=null)};k=p,d.on("close",p)}(o,{print:!0,customShortcuts:[...M?[{key:"p",description:"start/stop the profiler",async action(e){if(M)await O(d.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{M=new e.Session,M.connect(),M.post("Profiler.enable",()=>{M?.post("Profiler.start",()=>{d.info("Profiler started"),t()})})})}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),i||(i=A(c,p,d.info),d.info(s.colors.blue("🔧 Config file watcher started"))),r=!1}catch(e){r=!1,d.error(s.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),O(d.info),process.exit(1)}}},f=async e=>{d.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(C(i),i=null),o&&(await o.close(),o=null),O(d.info),d.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>f("SIGINT")),process.on("SIGTERM",()=>f("SIGTERM")),process.on("uncaughtException",e=>{d.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),f("unhandledRejection")}),await p()}),j.command("next [root]","start Next.js development server with pp-dev integration").alias("next-serve").alias("next-dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port",{default:3e3}).option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").option("--webpack","[boolean] use Webpack for Next dev (use when Turbopack/native SWC is unavailable)").option("--turbopack","[boolean] use Turbopack for Next dev when native bindings work").action(async(e,t)=>{V(t);let n=null,i=null,r=null,l=null,d=!1;const p=s.createLogger(),f=async()=>{if(!d){d=!0;try{const{next:g,constants:h}=await a.safeNextImport(),{PHASE_DEVELOPMENT_SERVER:m}=h;r&&(await r.close(),r=null),i&&(p.info(s.colors.yellow("🛑 Stopping existing Next.js server...")),await new Promise(e=>{i.close(()=>{i=null,e()})})),n&&"function"==typeof n.close&&(await n.close(),n=null);const{clearConfigCache:v}=await Promise.resolve().then(()=>require("./index-FgUi7Fqw.js")).then(e=>e.config);v();const{join:b,basename:P}=await(import("path")),{createServer:x}=await(import("http")),S=await(import("next/dist/server/config.js")),E=S.default.default||S["module.exports"].default||S.default,T=H(t),L=e?b(process.cwd(),e):process.cwd();a.loadPPDevEnv(t.mode||"development",L),p.info(L);const k=await E(m,L);let D=k?.ppDev||{};if(0===Object.keys(D).length)try{const{getConfig:e}=await Promise.resolve().then(()=>require("./index-FgUi7Fqw.js")).then(e=>e.config),t=await e(L);Object.keys(t).length>0?(D=t,p.info(s.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):p.info(s.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){p.info(s.colors.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else p.info(s.colors.blue("🔧 Loaded pp-dev config from Next.js config"));let I=null;try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-FgUi7Fqw.js")).then(e=>e.config);I=e(L).name}catch{I=P(L)}s.validatePPDevConfig(D,I??"");const F=s.normalizePPDevConfig(D,I??""),_=F.backendBaseURL??"http://localhost:8080",j=F.templateLess,R=F.v7Features,M=F.disableSSLValidation,q=F.enableProxyCache,O=F.proxyCacheTTL,V=F.personalAccessToken,U=F.miHudLess,z=F.inspectorEnabled,W=F.inspectorMaxMemory,B=F.inspectorCaptureLimit,Z=F.appId??(process.env.MI_APP_ID&&parseInt(process.env.MI_APP_ID,10)||void 0)??(process.env.MI_PORTAL_PAGE_ID&&parseInt(process.env.MI_PORTAL_PAGE_ID,10)||void 0)??1,G=k?.basePath;let J="";G?J=G:(J=j?s.PATH_PAGE_PREFIX:R?s.PATH_TEMPLATE_LOCAL_PREFIX:s.PATH_TEMPLATE_PREFIX,J+=`/${I}`);const X=function(e){const t="1"===process.env.PP_DEV_NEXT_WEBPACK||"true"===process.env.PP_DEV_NEXT_WEBPACK;if(t&&(e.webpack||e.turbopack))throw new Error("Do not combine PP_DEV_NEXT_WEBPACK with --webpack or --turbopack");if(t)return{webpack:!0};if(e.webpack&&e.turbopack)throw new Error("Use only one of --webpack or --turbopack");return e.webpack?{webpack:!0}:e.turbopack?{turbopack:!0}:{}}(t),K=async e=>{delete process.env.TURBOPACK,n&&"function"==typeof n.close&&(await n.close(),n=null);const t={dev:!0,customServer:!0,hostname:T.host||"localhost",port:T.port,dir:L,conf:{...k,basePath:J,assetPrefix:J}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),n=g(t),await n.prepare()};if(X.webpack)await K({webpack:!0});else if(X.turbopack)try{await K({turbopack:!0})}catch(e){if(!N(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await K({webpack:!0})}else try{await K({})}catch(e){if(!N(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await K({webpack:!0})}if(!n)throw new Error("Next.js app failed to initialize");if(J.endsWith("/")||(J+="/"),"/"===J)throw new Error('basePath cannot be equal to "/" or equal to empty string');p.info(s.colors.green("✅ Next.js app prepared successfully")),p.info(s.colors.blue(`🔧 pp-dev plugin configured for template: ${I}`)),p.info(s.colors.blue(`🔧 Base path configured: ${J}`)),_&&(p.info(s.colors.blue(`🌐 Backend URL: ${_}`)),p.info(s.colors.blue(`🆔 Custom App ID: ${Z}`)));const Y=n.getRequestHandler(),Q="number"==typeof T.port?T.port:3e3,ee="string"==typeof T.host?T.host||"0.0.0.0":"localhost",te=new Set;i=x(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=c.parse(o,!0);if(ne.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(ie.length>0){let l=0;const d=()=>{if(l>=ie.length)return void r();const o=ie[l];l++,o(e,t,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=ne.length)return void r();const o=ne[s];s++,o(e,t,a)};return void a()}async function r(){if(n.startsWith(J))i=c.parse(o,!0);else{if(n===J.replace(/\/$/,"")){const e=o.replace(n,J);return t.writeHead(302,{Location:e}),void t.end()}if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return t.writeHead(302,{Location:J}),void t.end()}await Y(e,t,i)}r()}catch(f){p.error(`Error handling request: ${f instanceof Error?f.message:String(f)}`,{error:f instanceof Error?f:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let oe=null,ne=[],ie=[];if(!1!==z){const e=new s.RequestStore(W);s.registerInspectorRoutes(s.internalServer,e,B);const t=s.createRequestCaptureMiddleware(e,B);ne.push(t)}if(_){const e=new URL(_).host,t=s.createUserHostGuard();ie.unshift(t),ne.unshift(t),_.startsWith("https://")&&(o.EventEmitter.defaultMaxListeners=Math.max(o.EventEmitter.defaultMaxListeners,20));const l={headers:{host:e,referer:_,origin:_.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:Z,templateLess:j,disableSSLValidation:M,v7Features:R,personalAccessToken:V??process.env.MI_ACCESS_TOKEN};oe=new s.MiAPI(_,l);const c=s.initPPRedirect(J,I??void 0),d=(e,t,o)=>{c(e,t,o)};ie.push(d),ne.push(d);const f=a.createDevPanelAssetMiddleware(J);if(ie.push(f),ne.push(f),q){let e=+O;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},o=s.initProxyCache(t),n=(e,t,n)=>{o(e,t,n)};ne.push(n),p.info(s.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const g=new RegExp(`^((${u=J,u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),m=s.initLoadPPData(g,oe,Object.assign({base:J},l,{miHudLess:U})),v=(e,t,o)=>{m(e,t,o)};ne.push(v);const b=J.endsWith("/")?J.substring(0,J.length-1):J,x={middlewares:{use:e=>e},config:{logger:console}},S=s.initProxy({devServer:x,baseURL:_,proxyIgnore:["/@vite","/@metricinsights","/@",b,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:M,miAPI:oe,templateName:I??void 0}),T=(e,t,o)=>{S(e,t,o)};ne.push(T);const D=s.internalServer,A=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(s.INSPECTOR_PATH)||e.url?.startsWith(s.VARIABLES_EDITOR_PATH)){return void D(e,t,()=>{})}o()};ie.push(A),ne.push(A);const C=s.initRewriteResponse(e=>{const t=e.split("?")[0];return t.startsWith(J)&&!t.includes("/_next/")},(t,o)=>{const n=oe.buildPage(t,U),i=a.injectDevPanel(n,J,{backendBaseURL:_,templateLess:j,appId:Z,devPanelPosition:F.devPanelPosition,devPanelHidden:F.devPanelHidden,devPanelAutoHide:F.devPanelAutoHide});return Buffer.from(s.urlReplacer(e,o.headers.host??"",i))}),N=(e,t,o)=>{C(e,t,o)};ne.push(N),r=new $;let H=k?.distDir;try{process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";const e=await E(h.PHASE_PRODUCTION_BUILD,L);H=e?.distDir??H}catch{}const z=(H??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),W=z&&".next"!==z?z:"out";let B,G="0.0.0";try{const e=JSON.parse(y.readFileSync(w.join(L,"package.json"),"utf-8"));G="string"==typeof e.version?e.version:G,B="string"==typeof e.repository?e.repository:e.repository?.url}catch{}const X=new s.DistService(I??P(L),{root:L,backupFolder:w.resolve(L,F.syncBackupsDir),nextBuild:{projectRoot:L,distDir:W,packageVersion:G,packageRepositoryUrl:B}}),K={ws:r.ws,config:{clientInjectionPlugin:{v7Features:R}}};new s.ClientService(K,{distService:X,miAPI:oe}),s.registerVariablesEditorRoutes(s.internalServer,{distService:X,miAPI:oe}),s.registerUserRoutes(s.internalServer,{miAPI:oe}),s.startKeepingUsers({persist:F.persistUsers,miAPI:oe,projectRoot:L,miUrl:_});const Y="function"==typeof n?.getUpgradeHandler?n.getUpgradeHandler():null;i.on("upgrade",(e,t,o)=>{r?.handleUpgrade(e,t,o)||(Y?Y(e,t,o):t.destroy())}),p.info(s.colors.blue(`🔧 ${ne.length} pp-dev middlewares initialized`)),p.info(s.colors.blue(`🔧 ${ie.length} essential middlewares for internal routes`)),p.info(s.colors.blue(`🔧 MiAPI initialized for backend: ${_}`)),p.info(s.colors.blue(`🔧 Custom App ID: ${Z}`))}i.listen(Q,ee,()=>{p.info(s.colors.green(`✅ pp-dev Next.js server running at http://${ee}:${Q}`)),p.info(s.colors.blue(`📱 Next.js app accessible at http://${ee}:${Q}${J}`)),!1!==z&&p.info(s.colors.cyan(`🔍 Request Inspector: http://${ee}:${Q}${s.INSPECTOR_PATH}`)),p.info(s.colors.blue("🔧 Base path handling active")),l||(l=A(L,f,p.info),p.info(s.colors.blue("🔧 Config file watcher started"))),i.on("connection",e=>{te.add(e),e.on("close",()=>te.delete(e))});const e=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const t=setTimeout(()=>{p.info(s.colors.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)},5e3);try{l&&(C(l),l=null);for(const e of Array.from(te))e.destroy();te.clear(),r&&(await r.close(),r=null),await new Promise(e=>{i.close(()=>{p.info(s.colors.yellow("🛑 HTTP server closed")),e()})}),n&&"function"==typeof n.close&&(await n.close(),p.info(s.colors.yellow("🛑 Next.js app closed"))),clearTimeout(t),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(t),p.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};let t=process;if("function"!=typeof process.on){const e=globalThis.process||global.process;e&&"function"==typeof e.on&&(t=e,p.info(s.colors.green("✅ Using global process object for event handlers")))}if("function"==typeof t.on)try{t.on("SIGINT",()=>e("SIGINT")),t.on("SIGTERM",()=>e("SIGTERM")),t.on("uncaughtException",t=>{p.error(s.colors.red(`❌ Uncaught Exception: ${t}`)),e("uncaughtException")}),t.on("unhandledRejection",(t,o)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${t}`)),e("unhandledRejection")}),p.info(s.colors.green("✅ Process event handlers registered successfully"))}catch(e){p.warn(s.colors.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else p.warn(s.colors.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),p.info(s.colors.blue("💡 This might be due to bundling or environment constraints"))}),d=!1}catch(e){d=!1,p.error(s.colors.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(p.error(s.colors.red("❌ Next.js Peer Dependency Error:")),p.error(s.colors.red(e.message)),p.error(s.colors.yellow("\n💡 To fix this issue:")),p.error(s.colors.blue(" 1. Install Next.js in your project:")),p.error(s.colors.white(" npm install next@^16")),p.error(s.colors.blue(" 2. Or use yarn:")),p.error(s.colors.white(" yarn add next@^16")),p.error(s.colors.blue(" 3. Or use pnpm:")),p.error(s.colors.white(" pnpm add next@^16")),p.error(s.colors.yellow("\n📖 For more information, see:")),p.error(s.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var u}},u=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{l&&(C(l),l=null),r&&(await r.close(),r=null),i&&await new Promise(e=>{i.close(()=>{i=null,e()})}),n&&"function"==typeof n.close&&(await n.close(),n=null),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){p.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>u("SIGINT")),process.on("SIGTERM",()=>u("SIGTERM")),process.on("uncaughtException",e=>{p.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),u("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),u("unhandledRejection")}),await f()}),j.command("build [root]","build for production").option("--target <target>","[string] transpile target (default: 'modules')").option("--outDir <dir>","[string] output directory (default: dist)").option("--assetsDir <dir>","[string] directory under outDir to place assets in (default: assets)").option("--assetsInlineLimit <number>","[number] static asset base64 inline threshold in bytes (default: 4096)").option("--ssr [entry]","[string] build specified entry for server-side rendering").option("--sourcemap [output]",'[boolean | "inline" | "hidden"] output source maps for build (default: false)').option("--minify [minifier]",'[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)').option("--manifest [name]","[boolean | string] emit build manifest json").option("--ssrManifest [name]","[boolean | string] emit ssr manifest json").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle (experimental)").option("--emptyOutDir","[boolean] force empty outDir when it's outside of root").option("-w, --watch","[boolean] rebuilds when modules have changed on disk").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{V(t);const o=H(t),n=a.resolveBuildCliOverrides(t);try{const i=t.mode||"production",r=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(i,r);const s=await l.loadConfigFromFile({mode:i,command:"build"},t.config,e,t.logLevel);let c=await a.getViteConfig(n,{mode:i,root:r});if(s){const{plugins:e,...t}=s.config;c=l.mergeConfig(c,t)}const d=l.mergeConfig(c,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},build:o},!0);if(await l.build(d),o.changelog){const n=e||process.cwd(),i=d.build?.outDir||"dist";let r="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?r=i:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(r=d.ppDevConfig.distZip.outDir)),await R({changelog:o.changelog,executionRoot:n,newAssetsPath:w.resolve(n,i),backupsDirPath:w.resolve(n,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:w.resolve(n,r),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{O(e=>s.createLogger(t.logLevel).info(e))}}),j.command("next-build [root]","build a Next.js app for production (`next build`) and emit VERSION/BUILD-MANIFEST/zip in the same format as `pp-dev build`").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{V(t);const o=s.createLogger(t.logLevel),n=e?w.resolve(process.cwd(),e):process.cwd(),i=a.resolveBuildCliOverrides(t);process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{a.loadPPDevEnv(t.mode||"production",n);const{constants:e}=await a.safeNextImport(),r=await(import("next/dist/server/config.js")),l=r.default.default||r["module.exports"].default||r.default,c=await l(e.PHASE_PRODUCTION_BUILD,n);let d,p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await Promise.resolve().then(()=>require("./index-FgUi7Fqw.js")).then(e=>e.config);p=await e(n)}try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-FgUi7Fqw.js")).then(e=>e.config);d=e(n).name}catch{d=w.basename(n)}const f=s.normalizePPDevConfig(p,d),u=a.applyDistZipOverride(f.distZip,i,s.createDefaultZipFileName(d)),g=a.applyVersionManifestOverride(f.versionPlugin,i),h=s.removeStaleDevTypes(n,c);h&&o.info(s.colors.dim(`[pp-dev] Removed stale dev route types: ${w.relative(n,h)}`)),o.info(s.colors.cyan("[pp-dev] Running `next build`...")),await s.runNextBuildProcess(n);const m="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",v=".next"===m?"out":m,b=w.resolve(n,v);if(!y.existsSync(b)||!y.statSync(b).isDirectory())throw new Error(`Next.js build output directory not found: ${b}. "next-build" requires "output: 'export'" in next.config (static export).`);const P=JSON.parse(y.readFileSync(w.join(n,"package.json"),"utf-8"));if(!1!==g&&!1!==g.enabled&&(s.writeBuildVersionManifest({outDir:b,packageVersion:"string"==typeof P.version?P.version:"0.0.0",versionFileTemplate:g.versionFileTemplate,packageRepositoryUrl:"string"==typeof P.repository?P.repository:P.repository?.url,enabled:g.enabled}),o.info(s.colors.green(`✅ VERSION / BUILD-MANIFEST written to ${w.relative(n,b)}`))),!1!==u){const e=w.resolve(n,u.outDir),t=u.inDir?w.resolve(b,u.inDir):b,i=s.resolveOutputFilePath(e,u.outFileName,"ZIP output file name");y.mkdirSync(w.dirname(i),{recursive:!0});const r=await s.zipDirectoryToBuffer(t);y.writeFileSync(i,r),o.info(s.colors.green(`✅ Zip archive written to ${w.relative(n,i)}`))}if(t.changelog){const e=!1!==u?u.outDir:v;await R({changelog:t.changelog,executionRoot:n,newAssetsPath:b,backupsDirPath:w.resolve(n,f.syncBackupsDir),changelogDestinationPath:w.resolve(n,e),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{O(e=>s.createLogger(t.logLevel).info(e))}}),j.command("changelog [oldAssetPath] [newAssetPath]","generate changelog between two assets files/folders").option("--oldAssetsPath <oldAssetsPath>","[string] path to the old assets zip file or folder").option("--newAssetsPath <newAssetsPath>","[string] path to the new assets zip file or folder").option("--destination <destination>","[string] destination folder for the changelog (default: .)").option("--filename <filename>","[string] filename for the changelog (default: CHANGELOG.html)").action(async(e,t,o)=>{V(o);const{oldAssetsPath:n=e,newAssetsPath:i=t,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=o,c=process.cwd();n&&i||(s.createLogger(l).error(s.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=w.resolve(c,n),p=w.resolve(c,i),f=w.resolve(c,r),u=new F({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await u.generateChangelog()}),j.command("generate-icon-font [source] [destination]","generate icon font from SVG files").option("--source <source>","[string] path to the source directory with SVG files").option("--destination <destination>","[string] path to the destination directory to save the generated font files").option("--font-name, -n <fontName>","[string] name of the font to generate (default: 'icon-font')").action(async(e,t,o)=>{V(o);const{source:n=e,destination:i=t,fontName:r="icon-font"}=o,a=process.cwd(),l=w.resolve(a,n),c=w.resolve(a,i),d=new _({sourceDir:l,outputDir:c,fontName:r}),p=s.createLogger(o.logLevel);p.info(`Generating icon font from SVG files in ${s.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${s.colors.dim(c)}`)}),j.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{V(t);try{const o=t.mode||"production",n=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}const s=await l.resolveConfig(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await l.optimizeDeps(s,t.force,!0)}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),j.command("preview [root]","locally preview production build").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--strictPort","[boolean] exit if specified port is already in use").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--outDir <dir>","[string] output directory (default: dist)").action(async(e,t)=>{V(t);try{const o=t.mode||"production",n=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}(await l.preview(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode,build:{outDir:t.outDir},preview:{port:t.port,strictPort:t.strictPort,host:t.host,https:t.https,open:t.open}}))).printUrls()}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{O(e=>s.createLogger(t.logLevel).info(e))}}),j.command("migrate [config]","migrate pp-dev config from 0.x flat format to 1.0 grouped format").option("--dry-run","[boolean] print migrated config without writing any files").option("--format <format>","[string] output format: ts (default), js, json").option("--output <file>","[string] output file path (default: pp-dev.config.ts)").option("--no-backup","[boolean] skip backup of original config file").action(async(e,t)=>{const o=s.createLogger(t.logLevel),{isLegacyFlatConfig:n,isLegacyPPWatchConfig:i,isAlreadyMigrated:r,migrateLegacyFlatConfig:a,migratePPWatchConfig:l,generateConfigFileContent:c,discoverMigrateSource:d,loadPackageJsonMigrateConfig:p}=await Promise.resolve().then(()=>require("./migrate-pmX6NEmP.js")),f=t.format??"ts",u=!1!==t.backup,g=process.cwd(),h=d(g,e);h||(o.warn(s.colors.yellow("No pp-dev or pp-watch config file found in the current directory.")),o.info(s.colors.blue('Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}, or a "pp-dev" field in package.json')),process.exit(1));const{sourceFile:m,isWatchConfig:v,isPackageJsonConfig:b}=h;o.info(s.colors.blue(`Found config: ${w.relative(g,m)}`));const{getPkg:P}=await Promise.resolve().then(()=>require("./index-FgUi7Fqw.js")).then(e=>e.config),x=P();let S,E={};try{if(/\.[cm]?ts$/i.test(m)){const e=await(import("esbuild")),{pathToFileURL:t}=await(import("url")),o=(await e.build({absWorkingDir:g,entryPoints:[m],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,n=`pp-migrate-tmp-${Date.now()}.mjs`;y.writeFileSync(n,o);try{const e=await(import(t(w.resolve(g,n)).toString()));E=e.default?.default??e.default??e}finally{y.existsSync(n)&&y.unlinkSync(n)}}else if(/\.[cm]?js$/i.test(m)){const{pathToFileURL:e}=await(import("url")),t=await(import(e(w.resolve(g,m)).toString()));E=t.default?.default??t.default??t}else b?E=p(m):m.endsWith(".json")&&(E=JSON.parse(y.readFileSync(m,"utf-8")))}catch(e){o.error(s.colors.red(`Failed to load config file: ${e.message}`)),process.exit(1)}E&&"object"==typeof E||(o.error(s.colors.red("Config file did not export a valid object.")),process.exit(1)),r(E)?(o.info(s.colors.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):v||i(E)?(o.info(s.colors.blue("Detected pp-watch config format → migrating to 1.0")),S=l(E)):n(E)?(o.info(s.colors.blue("Detected 0.x flat config format → migrating to 1.0")),S=a(E,x.name)):(o.warn(s.colors.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=c(S,f),L=t.output??w.join(g,`pp-dev.config.${f}`);if(t.dryRun&&(o.info(s.colors.green(`\n--- Migrated config (dry-run) → ${w.relative(g,L)} ---\n`)),process.exit(0)),u&&!b&&y.existsSync(m)){const e=`${m}.bak`;y.copyFileSync(m,e),o.info(s.colors.blue(`Backed up original to: ${w.relative(g,e)}`))}y.writeFileSync(L,T,"utf-8"),o.info(s.colors.green(`✅ Migration complete → ${w.relative(g,L)}`)),b?o.info(s.colors.yellow('You can now remove the "pp-dev" field from package.json.')):m!==L&&y.existsSync(m)&&o.info(s.colors.yellow(`You can now delete the old config: ${w.relative(g,m)}`))}),j.help(),j.version(s.VERSION),j.parse(),exports.stopProfiler=O;
1
+ "use strict";const e=require("path"),t=require("fs"),o=require("node:events"),n=require("node:perf_hooks"),i=require("chokidar"),r=require("cac"),s=require("./plugin-D_RXI7ru.js"),a=require("./index-CCUrjlJE.js"),l=require("vite"),c=require("url"),d=require("dir-compare"),p=require("diff-match-patch"),f=require("isbinaryfile"),u=require("os"),g=require("crypto"),h=require("svgtofont"),m=require("ws");require("http-proxy-middleware"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("process"),require("child_process"),require("node:path"),require("jszip"),require("module"),require("zlib"),require("express"),require("node:crypto"),require("node:fs"),require("node:os"),require("./helpers.js"),require("ejs");const v=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function b(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const o in e)t[o]=e[o];return t.default=e,Object.freeze(t)}const w=b(e),y=b(t),P=b(d),x=v(p),S=b(u),E=b(g),T=v(h);function L(e){return null!=e&&!1!==e}let k=null;const D=[{key:"r",description:"restart the server",async action(e){await e.restart()}},{key:"u",description:"show server url",action(e){e.config.logger.info(""),e.printUrls()}},{key:"o",description:"open in browser",action(e){e.openBrowser()}},{key:"c",description:"clear console",action(e){e.config.logger.clearScreen("error")}},{key:"q",description:"quit",async action(e){await e.close().finally(()=>process.exit())}},{key:"C",description:"clear proxy cache",action(e){e.cache&&(e.cache.clear(),e.config.logger.info("Proxy cache cleared"))}}];const I=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class F{oldAssetsPath;newAssetsPath;destinationPath;changelogFilename;changelogTemplate='<!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Changelog Diff</title>\n <style>\n tr,\n td {\n padding: 0;\n }\n .diff-file {\n margin-top: 20px;\n border: 1px solid #e1e4e8;\n border-radius: 6px;\n }\n .diff-file-title {\n padding: 10px 20px;\n background-color: #f6f8fa;\n border-bottom: 1px solid #e1e4e8;\n border-radius: 6px 6px 0 0;\n font-weight: bold;\n }\n .diff-file-title .renamed {\n font-weight: normal;\n }\n .diff-file-title .renamed .from {\n color: #cb2431;\n }\n .diff-file-title .renamed .to {\n color: #22863a;\n }\n .diff-file-title .added {\n color: #22863a;\n }\n .diff-file-title .deleted {\n color: #cb2431;\n }\n .diff-file-content {\n }\n .diff-table {\n tab-size: 8;\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n }\n .blob-num {\n position: relative;\n color: #1f2328;\n width: 1%;\n min-width: 50px;\n padding: 0 10px;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n line-height: 20px;\n text-align: right;\n white-space: nowrap;\n vertical-align: top;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n }\n .blob-num.addition {\n background-color: #ccffd8;\n border-color: #1f883e;\n }\n .blob-num.deletion {\n background-color: #ffd7d5;\n border-color: #cf222e;\n }\n .blob-num::before {\n content: attr(data-line-number);\n }\n .blob-code {\n position: relative;\n padding: 0 10px 0 22px;\n vertical-align: top;\n color: #1f2329;\n }\n .blob-code.code-addition {\n background-color: #e6ffec;\n }\n .blob-code.code-deletion {\n background-color: #ffebe9;\n }\n .blob-code.skip,\n .blob-code.message {\n text-align: center;\n }\n .blob-code.skip .blob-code-inner,\n .blob-code.message .blob-code-inner {\n font-weight: bold;\n color: #6a737d;\n padding: 10px 0;\n }\n .blob-code-inner {\n display: table-cell;\n overflow: visible;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n word-wrap: anywhere;\n white-space: pre-wrap;\n }\n .blob-code-inner::before {\n content: attr(data-code-prefix);\n position: absolute;\n top: 1px;\n left: 8px;\n padding-right: 8px;\n }\n </style>\n </head>\n <body>\n <h1>Changelog Diff</h1>\n\n %FILES%\n </body>\n </html>';diffFileTemplateHandler;diffLineTemplateHandler;contextLines=3;logger;constructor(e){const{oldAssetsPath:t,newAssetsPath:o,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=e;if(this.logger=s.createLogger(),!t||!o||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(t===o)throw new Error("Previous and current assets paths must be different");if(!this.isExists(t))throw new Error(`Previous assets path ${t} does not exist`);if(!this.isExists(o))throw new Error(`Current assets path ${o} does not exist`);if(this.isZipFile(t)){const e=w.resolve(S.tmpdir(),E.createHash("md5").update(t).digest("hex"));this.oldAssetsPath=this.unzipFile(t,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(t))throw new Error(`Invalid previous assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(o)){const e=w.resolve(S.tmpdir(),E.createHash("md5").update(o).digest("hex"));this.newAssetsPath=this.unzipFile(o,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid current assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${o} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=n,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",i&&(this.templateIsValid(i)?this.changelogTemplate=i:this.logger.warn(s.colors.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof a&&(this.diffLineTemplateHandler=a),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return y.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return y.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===y.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){y.existsSync(e)||y.mkdirSync(e,{recursive:!0})}async unzipFile(e,t){y.rmSync(t,{force:!0,recursive:!0}),await s.extractZipSafe(e,t)}normalizeAssetFolderPath(e){const t=y.readdirSync(e);return 1===t.length&&y.lstatSync(w.join(e,t[0])).isDirectory()?this.normalizeAssetFolderPath(w.join(e,t[0])):e}pathToPosix(e){return e.replace(/\\/g,"/")}diffTableTemplate(e){return`<table class="diff-table">\n <tbody>\n ${e}\n </tbody>\n </table>`}getDiffTableHTML(e){const t=e.filter((e,t,o)=>0!==e.lineType||(t>=0&&t<this.contextLines||t>o.length-(this.contextLines+1)&&t<=o.length-1||o.slice(t-this.contextLines,t+this.contextLines+1).some(e=>0!==e.lineType))).map((e,t,o)=>{if(t>0){const n=o[t-1];if(e.lineNumber-n.lineNumber>1)return[{lineNumber:-1,lineContent:"",lineType:0},e]}return[e]}).flat().map(e=>this.diffLineHTML(e)).join("");return this.diffTableTemplate(t)}diffLineMessageTemplate(e){return`<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code message">\n <span class="blob-code-inner">${e}</span>\n </td>\n </tr>`}diffLineSkipTemplate(){return'<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code skip">\n <span class="blob-code-inner">Skip</span>\n </td>\n </tr>'}diffLineTemplate(e){const{lineNumber:t,lineContent:o,lineType:n}=e,i=1===n?"addition":-1===n?"deletion":"";return`<tr>\n <td\n class="blob-num ${i}${"addition"===i?" empty":""}"\n ${"addition"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td class="blob-code ${1===n?"code-addition":-1===n?"code-deletion":""}">\n <span class="blob-code-inner" data-code-prefix="${1===n?"+":-1===n?"-":" "}">${r=o??"",r.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var r}diffLineHTML(e){if(this.diffLineTemplateHandler)return this.diffLineTemplateHandler(e);const{lineNumber:t}=e;return-1===t?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,t){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,t):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${t}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(s.colors.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await P.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,t)=>(I.test(e)&&(e=e.replace(I,"$1$3")),I.test(t)&&(t=t.replace(I,"$1$3")),0===e.localeCompare(t)?0:e.localeCompare(t)>0?1:-1)});return e.diffSet?.filter(e=>"equal"!==e.state||e.name1!==e.name2)||[]}async generateAssetFilesDiff(e,t){const o=new x,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let r=0;return i.map(e=>{const[t,o]=e,n=o.endsWith("\n")?o.split("\n").length-1:o.split("\n").length,i=o.split("\n").map((e,o)=>({lineContent:e,lineNumber:r+o+1,lineType:t})).slice(0,n);return-1!==t&&(r+=n),i}).flat()}async generateFilesDiff(e){if("equal"===e.state){const t=this.pathToPosix(w.join(".",e.relativePath,e.name1??"")),o=this.pathToPosix(w.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${o}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const t=e.path1&&e.name1?w.join(e.path1,e.name1):null,o=e.path2&&e.name2?w.join(e.path2,e.name2):null,n=this.pathToPosix(w.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&t)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&o)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&t&&o){const i=this.pathToPosix(w.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(w.join(".",e.relativePath,e.name2??"")),s=e.name1!==e.name2?`<span class="renamed"\n >Renamed <span class="from">${i}</span> -> <span class="to">${r}</span></span\n >`:n;return this.diffFileTemplate(s,await f.isBinaryFile(t)||await f.isBinaryFile(o)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(y.readFileSync(t,"utf-8"),y.readFileSync(o,"utf-8"))))}return""}async generateChangelog(){this.logger.info(s.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),t=(await Promise.all(e.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(s.colors.green("Writing changelog file"));const o=this.changelogTemplate.split("%FILES%");o.splice(1,0,t);const n=o.join("");y.writeFileSync(w.join(this.destinationPath,this.changelogFilename),n),this.logger.info(s.colors.green(`Changelog file written to ${w.join(this.destinationPath,this.changelogFilename)}`))}}class _{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await T({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class ${wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new m.WebSocketServer({noServer:!0}),this.wss.on("connection",e=>this.onConnection(e)),this.wss.on("error",e=>this.fireLifecycle("error",e)),this.ws={on:(e,t)=>{"close"!==e&&"error"!==e?this.getEventSet(e).add(t):this.getLifecycleSet(e).add(t)},off:(e,t)=>{this.eventListeners.get(e)?.delete(t),"close"!==e&&"error"!==e||this.lifecycleListeners.get(e)?.delete(t)},send:(e,t)=>{if("string"==typeof e)for(const o of this.clients.keys())this.sendToSocket(o,e,t);else{const t=JSON.stringify(e);for(const e of this.clients.keys())e.readyState===m.WebSocket.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){return(e.url??"").split("?")[0]===s.PP_DEV_HMR_WS_PATH&&(this.wss.handleUpgrade(e,t,o,t=>{this.wss.emit("connection",t,e)}),!0)}async close(){this.fireLifecycle("close");for(const e of this.clients.keys())e.terminate();this.clients.clear(),await new Promise(e=>this.wss.close(()=>e()))}onConnection(e){const t={send:(t,o)=>this.sendToSocket(e,t,o)};this.clients.set(e,t),e.on("message",e=>this.onMessage(t,e)),e.on("close",()=>this.clients.delete(e)),e.on("error",()=>{})}onMessage(e,t){let o;try{o=JSON.parse(t.toString())}catch{return}if(!o||"custom"!==o.type||"string"!=typeof o.event)return;const n=this.eventListeners.get(o.event);if(n)for(const t of n)try{t(o.data,e)}catch(e){s.createLogger().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===m.WebSocket.OPEN&&e.send(JSON.stringify({type:"custom",event:t,data:o}))}fireLifecycle(e,t){for(const o of this.lifecycleListeners.get(e)??[])try{o(t)}catch{}}getEventSet(e){let t=this.eventListeners.get(e);return t||(t=new Set,this.eventListeners.set(e,t)),t}getLifecycleSet(e){let t=this.lifecycleListeners.get(e);return t||(t=new Set,this.lifecycleListeners.set(e,t)),t}}const j=r.cac("pp-dev");function A(e,t,o){const n=[...s.PP_DEV_CONFIG_NAMES,"package.json","next.config.js","next.config.mjs","next.config.ts","vite.config.js","vite.config.mjs","vite.config.ts",".env",".env.local",".env.development",".env.development.local"].map(t=>w.join(e,t)),r=i.watch(n,{ignored:e=>{const t=w.basename(e);return/(^|[\/\\])\../.test(e)&&!t.startsWith(".env")&&!t.startsWith(".pp-dev")&&!t.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",n=>{o(s.colors.blue(`🔧 Config file changed: ${w.relative(e,n)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{o(s.colors.yellow("🔄 Restarting dev server due to config change...")),await t()}catch(e){o(s.colors.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{o(s.colors.red(`❌ Config watcher error: ${e}`))}),{watcher:r,restartCallback:t,logger:o}}function C(e){e.watcher&&e.watcher.close()}function N(e){if(!e||"object"!=typeof e||!("message"in e))return!1;const t=String(e.message);return/Turbopack is not supported/i.test(t)||/native bindings are not available/i.test(t)||/Only WebAssembly \(WASM\) bindings were loaded/i.test(t)}async function R(e){const{changelog:t,executionRoot:o,newAssetsPath:n,backupsDirPath:i,changelogDestinationPath:r,logLevel:a}=e;let l;if("string"==typeof t)l=w.resolve(o,t);else{if(!y.existsSync(i))return void s.createLogger(a).warn(s.colors.yellow("backups directory not found, skipping changelog generation"));const e=y.readdirSync(i,{withFileTypes:!0});if(!e.length)return void s.createLogger(a).warn(s.colors.yellow("no backups found, skipping changelog generation"));const t=e.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!t.length)return void s.createLogger(a).warn(s.colors.yellow("no ZIP backups found, skipping changelog generation"));const o=t.reduce((e,t)=>y.statSync(w.resolve(i,e.name)).mtimeMs>y.statSync(w.resolve(i,t.name)).mtimeMs?e:t).name;l=w.resolve(i,o)}const c=new F({oldAssetsPath:l,newAssetsPath:n,destinationPath:r});await c.generateChangelog()}let M=global.__pp_dev_profile_session,q=0;const O=e=>{if(M)return new Promise((t,o)=>{M.post("Profiler.stop",(n,{profile:i})=>{if(n)o(n);else{const o=w.resolve(`./pp-dev-profile-${q++}.cpuprofile`);y.writeFileSync(o,JSON.stringify(i)),e(s.colors.yellow(`CPU profile written to ${s.colors.white(s.colors.dim(o))}`)),M=void 0,t()}})})},V=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};function H(e){const t={...e};return delete t["--"],delete t.c,delete t.config,delete t.base,delete t.l,delete t.logLevel,delete t.clearScreen,delete t.d,delete t.debug,delete t.f,delete t.filter,delete t.m,delete t.mode,t}j.option("-c, --config <file>","[string] use specified config file").option("--base <path>","[string] public base path (default: /)").option("-l, --logLevel <level>","[string] info | warn | error | silent").option("--clearScreen","[boolean] allow/disable clear screen when logging").option("-d, --debug [feat]","[string | boolean] show debug logs").option("-f, --filter <filter>","[string] filter debug logs").option("-m, --mode <mode>","[string] set env mode"),j.command("[root]","start dev server").alias("serve").alias("dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{V(t);let o=null,i=null,r=!1;const c=e?w.resolve(process.cwd(),e):process.cwd(),d=s.createLogger(t.logLevel),p=async()=>{if(!r){r=!0;try{o&&(d.info(s.colors.yellow("🛑 Stopping existing dev server...")),await o.close(),o=null);const{clearConfigCache:f,getConfig:u}=await Promise.resolve().then(()=>require("./index-CCUrjlJE.js")).then(e=>e.config);f();const{createServer:g}=await(import("vite")),h=t.mode||"development",m=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(h,m);const v=await l.loadConfigFromFile({mode:h,command:"serve"},t.config,e,t.logLevel);let b=await a.getViteConfig(void 0,{mode:h,root:m});if(v){const{plugins:e,...t}=v.config;b=l.mergeConfig(b,t)}if(o=await g(l.mergeConfig(b,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},server:H(t),customLogger:d},!0)),!o.config.base||"/"===o.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!o.httpServer)throw new Error("HTTP server not available");await o.listen();const y=global.__pp_dev_start_time??!1,P=y?s.colors.dim(`ready in ${s.colors.reset(s.colors.bold(Math.ceil(n.performance.now()-y)))} ms`):"";d.info(`\n ${s.colors.green(`${s.colors.bold("PP-DEV")} v${s.VERSION}`)} ${P}\n`),o.printUrls();const x=await u(m);if(!1!==x.inspector?.enabled){const e=o.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${o.config.server.port??5173}`;d.info(`\n ${s.colors.cyan("🔍 Request Inspector")} ${s.colors.dim(t+s.INSPECTOR_PATH)}\n`)}!function(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=t;const o=s.createLogger();t.print&&o.info(s.colors.dim(s.colors.green(" ➜"))+s.colors.dim(" press ")+s.colors.bold("h")+s.colors.dim(" to show help"));const n=(t.customShortcuts??[]).filter(L).concat(D);k?.(),k=null;let i=!1;const r=process.stdin.isPaused(),a=process.stdin,l=Boolean(a.isRaw),c=async t=>{if(""===t)return void process.kill(process.pid,"SIGINT");if(""===t)return void await e.close().finally(()=>process.exit(0));if(i)return;"h"===t&&o.info(["",s.colors.bold(" Shortcuts"),...n.map(e=>s.colors.dim(" press ")+s.colors.bold(e.key)+s.colors.dim(` to ${e.description}`))].join("\n"));const r=n.find(e=>e.key===t);r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",c).setEncoding("utf8").resume();const d=e.httpServer,p=()=>{k===p&&(d.removeListener("close",p),process.stdin.off("data",c),l||process.stdin.setRawMode(!1),r&&process.stdin.pause(),k=null)};k=p,d.on("close",p)}(o,{print:!0,customShortcuts:[...M?[{key:"p",description:"start/stop the profiler",async action(e){if(M)await O(d.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{M=new e.Session,M.connect(),M.post("Profiler.enable",()=>{M?.post("Profiler.start",()=>{d.info("Profiler started"),t()})})})}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),i||(i=A(c,p,d.info),d.info(s.colors.blue("🔧 Config file watcher started"))),r=!1}catch(e){r=!1,d.error(s.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),O(d.info),process.exit(1)}}},f=async e=>{d.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(C(i),i=null),o&&(await o.close(),o=null),O(d.info),d.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>f("SIGINT")),process.on("SIGTERM",()=>f("SIGTERM")),process.on("uncaughtException",e=>{d.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),f("unhandledRejection")}),await p()}),j.command("next [root]","start Next.js development server with pp-dev integration").alias("next-serve").alias("next-dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port",{default:3e3}).option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").option("--webpack","[boolean] use Webpack for Next dev (use when Turbopack/native SWC is unavailable)").option("--turbopack","[boolean] use Turbopack for Next dev when native bindings work").action(async(e,t)=>{V(t);let n=null,i=null,r=null,l=null,d=!1;const p=s.createLogger(),f=async()=>{if(!d){d=!0;try{const{next:g,constants:h}=await a.safeNextImport(),{PHASE_DEVELOPMENT_SERVER:m}=h;r&&(await r.close(),r=null),i&&(p.info(s.colors.yellow("🛑 Stopping existing Next.js server...")),await new Promise(e=>{i.close(()=>{i=null,e()})})),n&&"function"==typeof n.close&&(await n.close(),n=null);const{clearConfigCache:v}=await Promise.resolve().then(()=>require("./index-CCUrjlJE.js")).then(e=>e.config);v();const{join:b,basename:P}=await(import("path")),{createServer:x}=await(import("http")),S=await(import("next/dist/server/config.js")),E=S.default.default||S["module.exports"].default||S.default,T=H(t),L=e?b(process.cwd(),e):process.cwd();a.loadPPDevEnv(t.mode||"development",L),p.info(L);const k=await E(m,L);let D=k?.ppDev||{};if(0===Object.keys(D).length)try{const{getConfig:e}=await Promise.resolve().then(()=>require("./index-CCUrjlJE.js")).then(e=>e.config),t=await e(L);Object.keys(t).length>0?(D=t,p.info(s.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):p.info(s.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){p.info(s.colors.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else p.info(s.colors.blue("🔧 Loaded pp-dev config from Next.js config"));let I=null;try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-CCUrjlJE.js")).then(e=>e.config);I=e(L).name}catch{I=P(L)}s.validatePPDevConfig(D,I??"");const F=s.normalizePPDevConfig(D,I??""),_=F.backendBaseURL??"http://localhost:8080",j=F.templateLess,R=F.v7Features,M=F.disableSSLValidation,q=F.enableProxyCache,O=F.proxyCacheTTL,V=F.personalAccessToken,U=F.miHudLess,z=F.inspectorEnabled,W=F.inspectorMaxMemory,B=F.inspectorCaptureLimit,Z=F.appId??(process.env.MI_APP_ID&&parseInt(process.env.MI_APP_ID,10)||void 0)??(process.env.MI_PORTAL_PAGE_ID&&parseInt(process.env.MI_PORTAL_PAGE_ID,10)||void 0)??1,G=k?.basePath;let J="";G?J=G:(J=j?s.PATH_PAGE_PREFIX:R?s.PATH_TEMPLATE_LOCAL_PREFIX:s.PATH_TEMPLATE_PREFIX,J+=`/${I}`);const X=function(e){const t="1"===process.env.PP_DEV_NEXT_WEBPACK||"true"===process.env.PP_DEV_NEXT_WEBPACK;if(t&&(e.webpack||e.turbopack))throw new Error("Do not combine PP_DEV_NEXT_WEBPACK with --webpack or --turbopack");if(t)return{webpack:!0};if(e.webpack&&e.turbopack)throw new Error("Use only one of --webpack or --turbopack");return e.webpack?{webpack:!0}:e.turbopack?{turbopack:!0}:{}}(t),K=async e=>{delete process.env.TURBOPACK,n&&"function"==typeof n.close&&(await n.close(),n=null);const t={dev:!0,customServer:!0,hostname:T.host||"localhost",port:T.port,dir:L,conf:{...k,basePath:J,assetPrefix:J}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),n=g(t),await n.prepare()};if(X.webpack)await K({webpack:!0});else if(X.turbopack)try{await K({turbopack:!0})}catch(e){if(!N(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await K({webpack:!0})}else try{await K({})}catch(e){if(!N(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await K({webpack:!0})}if(!n)throw new Error("Next.js app failed to initialize");if(J.endsWith("/")||(J+="/"),"/"===J)throw new Error('basePath cannot be equal to "/" or equal to empty string');p.info(s.colors.green("✅ Next.js app prepared successfully")),p.info(s.colors.blue(`🔧 pp-dev plugin configured for template: ${I}`)),p.info(s.colors.blue(`🔧 Base path configured: ${J}`)),_&&(p.info(s.colors.blue(`🌐 Backend URL: ${_}`)),p.info(s.colors.blue(`🆔 Custom App ID: ${Z}`)));const Y=n.getRequestHandler(),Q="number"==typeof T.port?T.port:3e3,ee="string"==typeof T.host?T.host||"0.0.0.0":"localhost",te=new Set;i=x(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=c.parse(o,!0);if(ne.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(ie.length>0){let l=0;const d=()=>{if(l>=ie.length)return void r();const o=ie[l];l++,o(e,t,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=ne.length)return void r();const o=ne[s];s++,o(e,t,a)};return void a()}async function r(){if(n.startsWith(J))i=c.parse(o,!0);else{if(n===J.replace(/\/$/,"")){const e=o.replace(n,J);return t.writeHead(302,{Location:e}),void t.end()}if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return t.writeHead(302,{Location:J}),void t.end()}await Y(e,t,i)}r()}catch(f){p.error(`Error handling request: ${f instanceof Error?f.message:String(f)}`,{error:f instanceof Error?f:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let oe=null,ne=[],ie=[];if(!1!==z){const e=new s.RequestStore(W);s.registerInspectorRoutes(s.internalServer,e,B);const t=s.createRequestCaptureMiddleware(e,B);ne.push(t)}if(_){const e=new URL(_).host,t=s.createUserHostGuard();ie.unshift(t),ne.unshift(t),_.startsWith("https://")&&(o.EventEmitter.defaultMaxListeners=Math.max(o.EventEmitter.defaultMaxListeners,20));const l={headers:{host:e,referer:_,origin:_.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:Z,templateLess:j,disableSSLValidation:M,v7Features:R,personalAccessToken:V??process.env.MI_ACCESS_TOKEN};oe=new s.MiAPI(_,l);const c=s.initPPRedirect(J,I??void 0),d=(e,t,o)=>{c(e,t,o)};ie.push(d),ne.push(d);const f=a.createDevPanelAssetMiddleware(J);if(ie.push(f),ne.push(f),q){let e=+O;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},o=s.initProxyCache(t),n=(e,t,n)=>{o(e,t,n)};ne.push(n),p.info(s.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const g=new RegExp(`^((${u=J,u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),m=s.initLoadPPData(g,oe,Object.assign({base:J},l,{miHudLess:U})),v=(e,t,o)=>{m(e,t,o)};ne.push(v);const b=J.endsWith("/")?J.substring(0,J.length-1):J,x={middlewares:{use:e=>e},config:{logger:console}},S=s.initProxy({devServer:x,baseURL:_,proxyIgnore:["/@vite","/@metricinsights","/@",b,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:M,miAPI:oe,templateName:I??void 0}),T=(e,t,o)=>{S(e,t,o)};ne.push(T);const D=s.internalServer,A=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(s.INSPECTOR_PATH)||e.url?.startsWith(s.VARIABLES_EDITOR_PATH)){return void D(e,t,()=>{})}o()};ie.push(A),ne.push(A);const C=s.initRewriteResponse(e=>{const t=e.split("?")[0];return t.startsWith(J)&&!t.includes("/_next/")},(t,o)=>{const n=oe.buildPage(t,U),i=a.injectDevPanel(n,J,{backendBaseURL:_,templateLess:j,appId:Z,devPanelPosition:F.devPanelPosition,devPanelHidden:F.devPanelHidden,devPanelAutoHide:F.devPanelAutoHide});return Buffer.from(s.urlReplacer(e,o.headers.host??"",i))}),N=(e,t,o)=>{C(e,t,o)};ne.push(N),r=new $;let H=k?.distDir;try{process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";const e=await E(h.PHASE_PRODUCTION_BUILD,L);H=e?.distDir??H}catch{}const z=(H??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),W=z&&".next"!==z?z:"out";let B,G="0.0.0";try{const e=JSON.parse(y.readFileSync(w.join(L,"package.json"),"utf-8"));G="string"==typeof e.version?e.version:G,B="string"==typeof e.repository?e.repository:e.repository?.url}catch{}const X=new s.DistService(I??P(L),{root:L,backupFolder:w.resolve(L,F.syncBackupsDir),nextBuild:{projectRoot:L,distDir:W,packageVersion:G,packageRepositoryUrl:B}}),K={ws:r.ws,config:{clientInjectionPlugin:{v7Features:R}}};new s.ClientService(K,{distService:X,miAPI:oe}),s.registerVariablesEditorRoutes(s.internalServer,{distService:X,miAPI:oe}),s.registerUserRoutes(s.internalServer,{miAPI:oe}),s.startKeepingUsers({persist:F.persistUsers,miAPI:oe,projectRoot:L,miUrl:_});const Y="function"==typeof n?.getUpgradeHandler?n.getUpgradeHandler():null;i.on("upgrade",(e,t,o)=>{r?.handleUpgrade(e,t,o)||(Y?Y(e,t,o):t.destroy())}),p.info(s.colors.blue(`🔧 ${ne.length} pp-dev middlewares initialized`)),p.info(s.colors.blue(`🔧 ${ie.length} essential middlewares for internal routes`)),p.info(s.colors.blue(`🔧 MiAPI initialized for backend: ${_}`)),p.info(s.colors.blue(`🔧 Custom App ID: ${Z}`))}i.listen(Q,ee,()=>{p.info(s.colors.green(`✅ pp-dev Next.js server running at http://${ee}:${Q}`)),p.info(s.colors.blue(`📱 Next.js app accessible at http://${ee}:${Q}${J}`)),!1!==z&&p.info(s.colors.cyan(`🔍 Request Inspector: http://${ee}:${Q}${s.INSPECTOR_PATH}`)),p.info(s.colors.blue("🔧 Base path handling active")),l||(l=A(L,f,p.info),p.info(s.colors.blue("🔧 Config file watcher started"))),i.on("connection",e=>{te.add(e),e.on("close",()=>te.delete(e))});const e=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const t=setTimeout(()=>{p.info(s.colors.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)},5e3);try{l&&(C(l),l=null);for(const e of Array.from(te))e.destroy();te.clear(),r&&(await r.close(),r=null),await new Promise(e=>{i.close(()=>{p.info(s.colors.yellow("🛑 HTTP server closed")),e()})}),n&&"function"==typeof n.close&&(await n.close(),p.info(s.colors.yellow("🛑 Next.js app closed"))),clearTimeout(t),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(t),p.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};let t=process;if("function"!=typeof process.on){const e=globalThis.process||global.process;e&&"function"==typeof e.on&&(t=e,p.info(s.colors.green("✅ Using global process object for event handlers")))}if("function"==typeof t.on)try{t.on("SIGINT",()=>e("SIGINT")),t.on("SIGTERM",()=>e("SIGTERM")),t.on("uncaughtException",t=>{p.error(s.colors.red(`❌ Uncaught Exception: ${t}`)),e("uncaughtException")}),t.on("unhandledRejection",(t,o)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${t}`)),e("unhandledRejection")}),p.info(s.colors.green("✅ Process event handlers registered successfully"))}catch(e){p.warn(s.colors.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else p.warn(s.colors.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),p.info(s.colors.blue("💡 This might be due to bundling or environment constraints"))}),d=!1}catch(e){d=!1,p.error(s.colors.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(p.error(s.colors.red("❌ Next.js Peer Dependency Error:")),p.error(s.colors.red(e.message)),p.error(s.colors.yellow("\n💡 To fix this issue:")),p.error(s.colors.blue(" 1. Install Next.js in your project:")),p.error(s.colors.white(" npm install next@^16")),p.error(s.colors.blue(" 2. Or use yarn:")),p.error(s.colors.white(" yarn add next@^16")),p.error(s.colors.blue(" 3. Or use pnpm:")),p.error(s.colors.white(" pnpm add next@^16")),p.error(s.colors.yellow("\n📖 For more information, see:")),p.error(s.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var u}},u=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{l&&(C(l),l=null),r&&(await r.close(),r=null),i&&await new Promise(e=>{i.close(()=>{i=null,e()})}),n&&"function"==typeof n.close&&(await n.close(),n=null),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){p.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>u("SIGINT")),process.on("SIGTERM",()=>u("SIGTERM")),process.on("uncaughtException",e=>{p.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),u("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),u("unhandledRejection")}),await f()}),j.command("build [root]","build for production").option("--target <target>","[string] transpile target (default: 'modules')").option("--outDir <dir>","[string] output directory (default: dist)").option("--assetsDir <dir>","[string] directory under outDir to place assets in (default: assets)").option("--assetsInlineLimit <number>","[number] static asset base64 inline threshold in bytes (default: 4096)").option("--ssr [entry]","[string] build specified entry for server-side rendering").option("--sourcemap [output]",'[boolean | "inline" | "hidden"] output source maps for build (default: false)').option("--minify [minifier]",'[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)').option("--manifest [name]","[boolean | string] emit build manifest json").option("--ssrManifest [name]","[boolean | string] emit ssr manifest json").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle (experimental)").option("--emptyOutDir","[boolean] force empty outDir when it's outside of root").option("-w, --watch","[boolean] rebuilds when modules have changed on disk").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{V(t);const o=H(t),n=a.resolveBuildCliOverrides(t);try{const i=t.mode||"production",r=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(i,r);const s=await l.loadConfigFromFile({mode:i,command:"build"},t.config,e,t.logLevel);let c=await a.getViteConfig(n,{mode:i,root:r});if(s){const{plugins:e,...t}=s.config;c=l.mergeConfig(c,t)}const d=l.mergeConfig(c,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},build:o},!0);if(await l.build(d),o.changelog){const n=e||process.cwd(),i=d.build?.outDir||"dist";let r="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?r=i:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(r=d.ppDevConfig.distZip.outDir)),await R({changelog:o.changelog,executionRoot:n,newAssetsPath:w.resolve(n,i),backupsDirPath:w.resolve(n,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:w.resolve(n,r),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{O(e=>s.createLogger(t.logLevel).info(e))}}),j.command("next-build [root]","build a Next.js app for production (`next build`) and emit VERSION/BUILD-MANIFEST/zip in the same format as `pp-dev build`").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{V(t);const o=s.createLogger(t.logLevel),n=e?w.resolve(process.cwd(),e):process.cwd(),i=a.resolveBuildCliOverrides(t);process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{a.loadPPDevEnv(t.mode||"production",n);const{constants:e}=await a.safeNextImport(),r=await(import("next/dist/server/config.js")),l=r.default.default||r["module.exports"].default||r.default,c=await l(e.PHASE_PRODUCTION_BUILD,n);let d,p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await Promise.resolve().then(()=>require("./index-CCUrjlJE.js")).then(e=>e.config);p=await e(n)}try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-CCUrjlJE.js")).then(e=>e.config);d=e(n).name}catch{d=w.basename(n)}const f=s.normalizePPDevConfig(p,d),u=a.applyDistZipOverride(f.distZip,i,s.createDefaultZipFileName(d)),g=a.applyVersionManifestOverride(f.versionPlugin,i),h=s.removeStaleDevTypes(n,c);h&&o.info(s.colors.dim(`[pp-dev] Removed stale dev route types: ${w.relative(n,h)}`)),o.info(s.colors.cyan("[pp-dev] Running `next build`...")),await s.runNextBuildProcess(n);const m="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",v=".next"===m?"out":m,b=w.resolve(n,v);if(!y.existsSync(b)||!y.statSync(b).isDirectory())throw new Error(`Next.js build output directory not found: ${b}. "next-build" requires "output: 'export'" in next.config (static export).`);const P=JSON.parse(y.readFileSync(w.join(n,"package.json"),"utf-8"));if(!1!==g&&!1!==g.enabled&&(s.writeBuildVersionManifest({outDir:b,packageVersion:"string"==typeof P.version?P.version:"0.0.0",versionFileTemplate:g.versionFileTemplate,packageRepositoryUrl:"string"==typeof P.repository?P.repository:P.repository?.url,enabled:g.enabled}),o.info(s.colors.green(`✅ VERSION / BUILD-MANIFEST written to ${w.relative(n,b)}`))),!1!==u){const e=w.resolve(n,u.outDir),t=u.inDir?w.resolve(b,u.inDir):b,i=s.resolveOutputFilePath(e,u.outFileName,"ZIP output file name");y.mkdirSync(w.dirname(i),{recursive:!0});const r=await s.zipDirectoryToBuffer(t);y.writeFileSync(i,r),o.info(s.colors.green(`✅ Zip archive written to ${w.relative(n,i)}`))}if(t.changelog){const e=!1!==u?u.outDir:v;await R({changelog:t.changelog,executionRoot:n,newAssetsPath:b,backupsDirPath:w.resolve(n,f.syncBackupsDir),changelogDestinationPath:w.resolve(n,e),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{O(e=>s.createLogger(t.logLevel).info(e))}}),j.command("changelog [oldAssetPath] [newAssetPath]","generate changelog between two assets files/folders").option("--oldAssetsPath <oldAssetsPath>","[string] path to the old assets zip file or folder").option("--newAssetsPath <newAssetsPath>","[string] path to the new assets zip file or folder").option("--destination <destination>","[string] destination folder for the changelog (default: .)").option("--filename <filename>","[string] filename for the changelog (default: CHANGELOG.html)").action(async(e,t,o)=>{V(o);const{oldAssetsPath:n=e,newAssetsPath:i=t,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=o,c=process.cwd();n&&i||(s.createLogger(l).error(s.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=w.resolve(c,n),p=w.resolve(c,i),f=w.resolve(c,r),u=new F({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await u.generateChangelog()}),j.command("generate-icon-font [source] [destination]","generate icon font from SVG files").option("--source <source>","[string] path to the source directory with SVG files").option("--destination <destination>","[string] path to the destination directory to save the generated font files").option("--font-name, -n <fontName>","[string] name of the font to generate (default: 'icon-font')").action(async(e,t,o)=>{V(o);const{source:n=e,destination:i=t,fontName:r="icon-font"}=o,a=process.cwd(),l=w.resolve(a,n),c=w.resolve(a,i),d=new _({sourceDir:l,outputDir:c,fontName:r}),p=s.createLogger(o.logLevel);p.info(`Generating icon font from SVG files in ${s.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${s.colors.dim(c)}`)}),j.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{V(t);try{const o=t.mode||"production",n=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}const s=await l.resolveConfig(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await l.optimizeDeps(s,t.force,!0)}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),j.command("preview [root]","locally preview production build").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--strictPort","[boolean] exit if specified port is already in use").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--outDir <dir>","[string] output directory (default: dist)").action(async(e,t)=>{V(t);try{const o=t.mode||"production",n=w.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}(await l.preview(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode,build:{outDir:t.outDir},preview:{port:t.port,strictPort:t.strictPort,host:t.host,https:t.https,open:t.open}}))).printUrls()}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{O(e=>s.createLogger(t.logLevel).info(e))}}),j.command("migrate [config]","migrate pp-dev config from 0.x flat format to 1.0 grouped format").option("--dry-run","[boolean] print migrated config without writing any files").option("--format <format>","[string] output format: ts (default), js, json").option("--output <file>","[string] output file path (default: pp-dev.config.ts)").option("--no-backup","[boolean] skip backup of original config file").action(async(e,t)=>{const o=s.createLogger(t.logLevel),{isLegacyFlatConfig:n,isLegacyPPWatchConfig:i,isAlreadyMigrated:r,migrateLegacyFlatConfig:a,migratePPWatchConfig:l,generateConfigFileContent:c,discoverMigrateSource:d,loadPackageJsonMigrateConfig:p}=await Promise.resolve().then(()=>require("./migrate-BYno__sx.js")),f=t.format??"ts",u=!1!==t.backup,g=process.cwd(),h=d(g,e);h||(o.warn(s.colors.yellow("No pp-dev or pp-watch config file found in the current directory.")),o.info(s.colors.blue('Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}, or a "pp-dev" field in package.json')),process.exit(1));const{sourceFile:m,isWatchConfig:v,isPackageJsonConfig:b}=h;o.info(s.colors.blue(`Found config: ${w.relative(g,m)}`));const{getPkg:P}=await Promise.resolve().then(()=>require("./index-CCUrjlJE.js")).then(e=>e.config),x=P();let S,E={};try{if(/\.[cm]?ts$/i.test(m)){const e=await(import("esbuild")),{pathToFileURL:t}=await(import("url")),o=(await e.build({absWorkingDir:g,entryPoints:[m],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,n=`pp-migrate-tmp-${Date.now()}.mjs`;y.writeFileSync(n,o);try{const e=await(import(t(w.resolve(g,n)).toString()));E=e.default?.default??e.default??e}finally{y.existsSync(n)&&y.unlinkSync(n)}}else if(/\.[cm]?js$/i.test(m)){const{pathToFileURL:e}=await(import("url")),t=await(import(e(w.resolve(g,m)).toString()));E=t.default?.default??t.default??t}else b?E=p(m):m.endsWith(".json")&&(E=JSON.parse(y.readFileSync(m,"utf-8")))}catch(e){o.error(s.colors.red(`Failed to load config file: ${e.message}`)),process.exit(1)}E&&"object"==typeof E||(o.error(s.colors.red("Config file did not export a valid object.")),process.exit(1)),r(E)?(o.info(s.colors.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):v||i(E)?(o.info(s.colors.blue("Detected pp-watch config format → migrating to 1.0")),S=l(E)):n(E)?(o.info(s.colors.blue("Detected 0.x flat config format → migrating to 1.0")),S=a(E,x.name)):(o.warn(s.colors.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=c(S,f),L=t.output??w.join(g,`pp-dev.config.${f}`);if(t.dryRun&&(o.info(s.colors.green(`\n--- Migrated config (dry-run) → ${w.relative(g,L)} ---\n`)),process.exit(0)),u&&!b&&y.existsSync(m)){const e=`${m}.bak`;y.copyFileSync(m,e),o.info(s.colors.blue(`Backed up original to: ${w.relative(g,e)}`))}y.writeFileSync(L,T,"utf-8"),o.info(s.colors.green(`✅ Migration complete → ${w.relative(g,L)}`)),b?o.info(s.colors.yellow('You can now remove the "pp-dev" field from package.json.')):m!==L&&y.existsSync(m)&&o.info(s.colors.yellow(`You can now delete the old config: ${w.relative(g,m)}`))}),j.help(),j.version(s.VERSION),j.parse(),exports.stopProfiler=O;
2
2
  //# sourceMappingURL=cli.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("child_process"),t=require("./plugin-yWlSj5sK.js"),n=require("vite"),i=require("fs"),r=require("path"),s=require("url");require("./helpers.js");const o=require("ejs");var a="undefined"!=typeof document?document.currentScript:null;const c=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function l(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const n in e)t[n]=e[n];return t.default=e,Object.freeze(t)}const p=l(i),u=l(r),d=c(r),f=c(o),m=u.dirname(t.PP_DEV_CLIENT_ENTRY),P=u.join(m,"index.html");let v=null;function E(e){return{css:u.posix.join(e,t.PACKAGE_NAME,"client/client.css"),js:u.posix.join(e,t.PACKAGE_NAME,"client/client.js")}}function g(e){return function(){if(v)return v;const e=p.readFileSync(P,{encoding:"utf8"});return v=f.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),v}()({PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:e.backendBaseURL,templateLess:e.templateLess,appId:e.appId,canSync:e.canSync??!0,devPanelPosition:e.devPanelPosition??"bottom-right",devPanelHidden:e.devPanelHidden??!1,devPanelAutoHide:e.devPanelAutoHide??!1})}const _={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};let h;try{h="undefined"!=typeof __filename&&__filename?u.resolve(u.dirname(__filename),".."):void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-FgUi7Fqw.js",document.baseURI).href}&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-FgUi7Fqw.js",document.baseURI).href,1)&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-FgUi7Fqw.js",document.baseURI).href)?u.resolve(s.fileURLToPath(new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-FgUi7Fqw.js",document.baseURI).href)),".."):process.cwd()}catch{h=process.cwd()}const y=n.normalizePath(u.join(t.PP_DEV_PACKAGE_DIR,"dist/client")),T=new RegExp(`^\\/?${t.PACKAGE_NAME}\\/client\\/(.*)$`);let I=null,R=null;function j(e){return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t.PACKAGE_NAME}/client`),e),resolveId(e){const t=e.match(T);if(t){const e=n.normalizePath(u.join(y,t[1]));return e.startsWith(`${y}/`)?{id:e}:null}},transformIndexHtml:async(e,n)=>{const i=n.server?.config.base||"",r=function(){if(R)return R;const e=u.resolve(h,"client","index.html");return I||(I=p.readFileSync(e,{encoding:"utf8"})),R=f.compile(I,{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:e,rmWhitespace:!0,compileDebug:!1}),R}(),s=E(i),o={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:s.css}}]},{backendBaseURL:a,templateLess:c=!1,appId:l,canSync:d=!0,devPanelPosition:m="bottom-right",devPanelHidden:P=!1,devPanelAutoHide:v=!1}=n.server?.config.clientInjectionPlugin||{},g={PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:a,templateLess:c,appId:l,canSync:d,devPanelPosition:m,devPanelHidden:P,devPanelAutoHide:v};return o.tags.push({tag:"div",injectTo:"body-prepend",children:await r(g)}),o.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:s.js,type:"module"}}),o},configureServer(e){const i=n.normalizePath(u.resolve(e.config.root,u.dirname(t.PP_DEV_CLIENT_ENTRY)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(i)}}}const b=(e,t)=>` * ${t}`;function A(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,b)}\n */`}async function D(){try{const[e,t]=await Promise.all([import("next"),import("next/constants.js")]);return{next:e.default,constants:t}}catch(e){throw new Error(`Next.js is required but not available. Please install Next.js as a dependency:\nnpm install next@^15\n\nThis package requires Next.js >=15 <17 as a peer dependency.\n\nError: ${e}`)}}let w=new Set;function N(e="development",t=process.cwd()){for(const e of w)delete process.env[e];const i=new Set(Object.keys(process.env).filter(e=>e.startsWith("MI_"))),r=n.loadEnv(e,t,"MI_");for(const[e,t]of Object.entries(r))process.env[e]=t;return w=new Set(Object.keys(r).filter(e=>!i.has(e))),r}const S=new Map,L=3e4,F=new Map;function $(e=process.cwd()){const t=Date.now(),n=d.resolve(e),r=F.get(n);if(r&&t-r.timestamp<6e4)return r.data;try{const e=JSON.parse(i.readFileSync(d.resolve(n,"package.json"),{encoding:"utf-8",flag:"r"}));return F.set(n,{data:e,timestamp:t}),e}catch{const e={};return F.set(n,{data:e,timestamp:t}),e}}let C=null;async function x(e,t){const n=`ts:${e}`,r=S.get(n);if(r&&Date.now()-r.timestamp<L)return r.data;let o=!1;if(/\.m[jt]s$/.test(e))o=!0;else if(/\.c[jt]s$/.test(e))o=!1;else{const e=$(t);o=!!e&&"module"===e.type}const a=await async function(){return C||(C=await(import("esbuild"))),C}(),c=await a.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:o?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:l}=c.outputFiles[0],p=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,u=d.resolve(t,p),f=s.pathToFileURL(u).toString();i.writeFileSync(u,l);let m={};try{const t=(await(import(f))).default;m=t?.default||t,S.set(n,{data:m,timestamp:Date.now(),filePath:e})}finally{i.existsSync(u)&&i.unlink(u,()=>{})}return m}async function O(e){const t=`js:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const i=(await(import(s.pathToFileURL(e).toString()))).default;return S.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}async function U(e){const t=`json:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const r=JSON.parse(i.readFileSync(e,{encoding:"utf-8"}));return S.set(t,{data:r,timestamp:Date.now(),filePath:e}),r}const M=new Map;function V(e=process.cwd()){return $(e)}async function H(e=process.cwd()){const n=d.resolve(e),r=function(e){const t=Date.now(),n=M.get(e);if(n&&t-n.timestamp<1e4)return n.files;const r=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,s=i.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isFile()&&r.test(e.name)).map(e=>e.name);return M.set(e,{files:s,timestamp:t}),s}(n);let s={},o=!1;const a=await async function(e,t,n){for(const i of t)if(e.includes(i)){const e=d.resolve(n,i);if(/\.[cm]?ts$/i.test(i))return await x(e,n);if(/\.[cm]?js$/i.test(i))return await O(e);if(i.endsWith(".json"))return await U(e)}return null}(r,t.PP_DEV_CONFIG_NAMES,n);a&&(s=a,o=!0);const c=$(n)["pp-dev"];return o||!c||"object"!=typeof c||Array.isArray(c)||(s=c),s}const Z=Object.freeze({__proto__:null,clearConfigCache:function(){S.clear(),F.clear(),M.clear()},getConfig:H,getPkg:V});function G(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function k(e,n,i){if(!1===n.distZipEnabled)return!1;if(!0!==n.distZipEnabled&&void 0===n.distZipDir&&void 0===n.distZipFilename)return!1!==e&&{...e,outFileName:t.normalizeRelativeOutputPath(e.outFileName,"ZIP output file name")};const r=!1===e?{outFileName:i,outDir:"dist-zip"}:e,s=n.distZipFilename??r.outFileName;return{...r,...void 0!==n.distZipDir?{outDir:n.distZipDir}:{},outFileName:t.normalizeRelativeOutputPath(s,"ZIP output file name")}}function B(e,n){if(!1===n.versionManifestEnabled)return!1;if(!0!==n.versionManifestEnabled&&void 0===n.versionFileTemplate)return!1!==e&&void 0!==e.versionFileTemplate?{...e,versionFileTemplate:t.normalizeRelativeOutputPath(e.versionFileTemplate,"VERSION file name template")}:e;const i=!1===e?{enabled:!0}:e,r=n.versionFileTemplate??i.versionFileTemplate,s=void 0!==r?t.normalizeRelativeOutputPath(r,"VERSION file name template"):void 0;return{...i,enabled:!0,...void 0!==s?{versionFileTemplate:s}:{}}}const z=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function q(t){if("string"==typeof t)return t;if(t&&"object"==typeof t&&"url"in t&&"string"==typeof t.url)return t.url;const n=["CI_REPOSITORY_URL","GIT_URL","BUILD_REPOSITORY_URI","CI_PROJECT_URL","BITBUCKET_GIT_HTTP_ORIGIN","BUILDKITE_REPO"];for(const e of n){const t=process.env[e];if("string"==typeof t&&t.trim())return t}const i=process.env.GITHUB_REPOSITORY;if("string"==typeof i&&i.trim()){return`${(process.env.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,"")}/${i.replace(/^\/+/,"")}`}const r=process.env.CI_PROJECT_PATH;if("string"==typeof r&&r.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`}const s=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof s&&s.trim())return`https://bitbucket.org/${s.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e.execSync("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}function K(e){return e?.ppDev||{}}exports.applyDistZipOverride=k,exports.applyVersionManifestOverride=B,exports.config=Z,exports.createDevPanelAssetMiddleware=function(e){const n=u.posix.join(e,t.PACKAGE_NAME,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,r)=>{const s=(e.url??"").split("?")[0];if(!s.startsWith(n))return void r();const o=s.slice(n.length);if(!i.has(o))return void r();const a=u.join(m,o);p.readFile(a,(e,n)=>{e?r():(t.statusCode=200,t.setHeader("Content-Type",_[u.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}},exports.getNextVersion=async function(){try{return(await(import("next/package.json"))).version}catch{return null}},exports.getPPDevConfigFromNextConfig=K,exports.getViteConfig=async function(e,n={}){const i=n.root??process.cwd();N(n.mode,i);const r=V(i),s=r.name,o=await H(i);t.validatePPDevConfig(o,s);const a=t.normalizePPDevConfig(o,s);e&&(a.distZip=k(a.distZip,e,t.createDefaultZipFileName(s)),a.versionPlugin=B(a.versionPlugin,e));const{default:c}=await Promise.resolve().then(()=>require("./plugin.js")),l=[c(a),j()],{outDir:p,distZip:u,versionPlugin:d,imageOptimizer:f,templateLess:m,integrateMiTopBar:P}=a;if(P&&l.push(function(e){return{name:"mi-topbar-plugin",transformIndexHtml(){const t=[];return(!0===e||"object"==typeof e&&!0===e.addRootElement)&&t.push({tag:"div",injectTo:"body-prepend",attrs:{id:"mi-react-root"}}),(!0===e||"object"==typeof e&&!0===e.addSharedComponentsScripts)&&t.push({tag:"script",injectTo:"head-prepend",attrs:{src:"/auth/info.js"}},{tag:"script",injectTo:"head-prepend",attrs:{src:"/js/main.js",defer:"defer"}},{tag:"link",injectTo:"head-prepend",attrs:{href:"/css/main.css",rel:"stylesheet"}}),t}}}(P)),f){const{ViteImageOptimizer:e}=await(import("vite-plugin-image-optimizer"));l.push(e("object"==typeof f?f:void 0))}if(d){const{versionPlugin:e}=await Promise.resolve().then(()=>require("./version-plugin-0EjcUgtP.js"));l.push(e({outDir:p,packageVersion:r.version??"0.0.0",packageRepositoryUrl:q(r.repository),..."object"==typeof d?d:{}}))}if(u){const{default:e}=await(import("vite-plugin-zip-pack"));l.push({...e("object"==typeof u?u:{outFileName:t.createDefaultZipFileName(s)}),enforce:"post"})}return{base:m?`${t.PATH_PAGE_PREFIX}/${s}`:`${t.PATH_TEMPLATE_PREFIX}/${s}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:A}},outDir:p},css:{modules:{localsConvention:"dashes"}},ppDevConfig:a,plugins:l}},exports.injectDevPanel=function(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:r}=E(t),s=`<link rel="stylesheet" href="${i}">`,o=`${g(n)}${`<script type="module" src="${r}"><\/script>`}`;let a=e,c=!1;if(/<\/head>/i.test(a)&&(a=a.replace(/<\/head>/i,`${s}</head>`),c=!0),/<body[^>]*>/i.test(a)){const e=c?"":s;a=a.replace(/(<body[^>]*>)/i,`$1${e}${o}`)}else a=`${c?"":s}${a}${o}`;return a},exports.isNextAvailable=async function(){try{return await(import("next")),!0}catch{return!1}},exports.loadPPDevEnv=N,exports.resolveBuildCliOverrides=function(e){return{distZipEnabled:e.distZip??G(process.env.PP_DEV_DIST_ZIP),distZipDir:e.distZipDir??process.env.PP_DEV_DIST_ZIP_DIR,distZipFilename:e.distZipFilename??process.env.PP_DEV_DIST_ZIP_FILENAME,versionManifestEnabled:e.versionManifest??G(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}},exports.safeNextImport=D,exports.withPPDev=function(e,n){return async(i,r={})=>{try{const{constants:s}=await D(),{PHASE_DEVELOPMENT_SERVER:o,PHASE_PRODUCTION_BUILD:a}=s;i!==a||process.env[t.PP_DEV_NEXT_BUILD_ENV_VAR]||t.createLogger().warn(t.colors.yellow('⚠ Building with plain `next build`. Use `pp-dev next-build` instead to get VERSION/BUILD-MANIFEST/zip build output in the same format as `pp-dev build` (see the "Next.js Build" section in the pp-dev README).'));const c=await H(),l=V().name,p="function"==typeof e?await e(i,r):e,u=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(z.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(c,K(p),n);t.validatePPDevConfig(u,l);const d=t.normalizePPDevConfig(u,l),{templateLess:f,v7Features:m}=d,P=i===o,v=function(e,n,i,r){return i?r?n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_LOCAL_PREFIX}/${e}`:n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_PREFIX}/${e}`:`${t.PATH_PAGE_PREFIX}/${e}`}(d.templateName,f,P,m),E={basePath:v,trailingSlash:!!P||void 0};if(!f){const e=P&&m?t.PATH_TEMPLATE_LOCAL_PREFIX:t.PATH_TEMPLATE_PREFIX;E.assetPrefix=`${e}/${d.templateName}`}const g=Object.assign({},E,p);return Object.defineProperty(g,"ppDev",{value:u,enumerable:!1,configurable:!0}),g}catch(e){throw t.createLogger().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}};
2
- //# sourceMappingURL=index-FgUi7Fqw.js.map
1
+ "use strict";const e=require("child_process"),t=require("./plugin-D_RXI7ru.js"),n=require("vite"),i=require("fs"),r=require("path"),s=require("url");require("./helpers.js");const o=require("ejs");var a="undefined"!=typeof document?document.currentScript:null;const c=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function l(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const n in e)t[n]=e[n];return t.default=e,Object.freeze(t)}const p=l(i),u=l(r),d=c(r),f=c(o),m=u.dirname(t.PP_DEV_CLIENT_ENTRY),P=u.join(m,"index.html");let v=null;function E(e){return{css:u.posix.join(e,t.PACKAGE_NAME,"client/client.css"),js:u.posix.join(e,t.PACKAGE_NAME,"client/client.js")}}function g(e){return function(){if(v)return v;const e=p.readFileSync(P,{encoding:"utf8"});return v=f.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),v}()({PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:e.backendBaseURL,templateLess:e.templateLess,appId:e.appId,canSync:e.canSync??!0,devPanelPosition:e.devPanelPosition??"bottom-right",devPanelHidden:e.devPanelHidden??!1,devPanelAutoHide:e.devPanelAutoHide??!1})}const _={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};let h;try{h="undefined"!=typeof __filename&&__filename?u.resolve(u.dirname(__filename),".."):void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CCUrjlJE.js",document.baseURI).href}&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CCUrjlJE.js",document.baseURI).href,1)&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CCUrjlJE.js",document.baseURI).href)?u.resolve(s.fileURLToPath(new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CCUrjlJE.js",document.baseURI).href)),".."):process.cwd()}catch{h=process.cwd()}const y=n.normalizePath(u.join(t.PP_DEV_PACKAGE_DIR,"dist/client")),T=new RegExp(`^\\/?${t.PACKAGE_NAME}\\/client\\/(.*)$`);let I=null,R=null;function j(e){return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t.PACKAGE_NAME}/client`),e),resolveId(e){const t=e.match(T);if(t){const e=n.normalizePath(u.join(y,t[1]));return e.startsWith(`${y}/`)?{id:e}:null}},transformIndexHtml:async(e,n)=>{const i=n.server?.config.base||"",r=function(){if(R)return R;const e=u.resolve(h,"client","index.html");return I||(I=p.readFileSync(e,{encoding:"utf8"})),R=f.compile(I,{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:e,rmWhitespace:!0,compileDebug:!1}),R}(),s=E(i),o={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:s.css}}]},{backendBaseURL:a,templateLess:c=!1,appId:l,canSync:d=!0,devPanelPosition:m="bottom-right",devPanelHidden:P=!1,devPanelAutoHide:v=!1}=n.server?.config.clientInjectionPlugin||{},g={PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:a,templateLess:c,appId:l,canSync:d,devPanelPosition:m,devPanelHidden:P,devPanelAutoHide:v};return o.tags.push({tag:"div",injectTo:"body-prepend",children:await r(g)}),o.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:s.js,type:"module"}}),o},configureServer(e){const i=n.normalizePath(u.resolve(e.config.root,u.dirname(t.PP_DEV_CLIENT_ENTRY)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(i)}}}const b=(e,t)=>` * ${t}`;function A(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,b)}\n */`}async function D(){try{const[e,t]=await Promise.all([import("next"),import("next/constants.js")]);return{next:e.default,constants:t}}catch(e){throw new Error(`Next.js is required but not available. Please install Next.js as a dependency:\nnpm install next@^15\n\nThis package requires Next.js >=15 <17 as a peer dependency.\n\nError: ${e}`)}}let w=new Set;function N(e="development",t=process.cwd()){for(const e of w)delete process.env[e];const i=new Set(Object.keys(process.env).filter(e=>e.startsWith("MI_"))),r=n.loadEnv(e,t,"MI_");for(const[e,t]of Object.entries(r))process.env[e]=t;return w=new Set(Object.keys(r).filter(e=>!i.has(e))),r}const S=new Map,L=3e4,F=new Map;function $(e=process.cwd()){const t=Date.now(),n=d.resolve(e),r=F.get(n);if(r&&t-r.timestamp<6e4)return r.data;try{const e=JSON.parse(i.readFileSync(d.resolve(n,"package.json"),{encoding:"utf-8",flag:"r"}));return F.set(n,{data:e,timestamp:t}),e}catch{const e={};return F.set(n,{data:e,timestamp:t}),e}}let C=null;async function x(e,t){const n=`ts:${e}`,r=S.get(n);if(r&&Date.now()-r.timestamp<L)return r.data;let o=!1;if(/\.m[jt]s$/.test(e))o=!0;else if(/\.c[jt]s$/.test(e))o=!1;else{const e=$(t);o=!!e&&"module"===e.type}const a=await async function(){return C||(C=await(import("esbuild"))),C}(),c=await a.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:o?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:l}=c.outputFiles[0],p=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,u=d.resolve(t,p),f=s.pathToFileURL(u).toString();i.writeFileSync(u,l);let m={};try{const t=(await(import(f))).default;m=t?.default||t,S.set(n,{data:m,timestamp:Date.now(),filePath:e})}finally{i.existsSync(u)&&i.unlink(u,()=>{})}return m}async function O(e){const t=`js:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const i=(await(import(s.pathToFileURL(e).toString()))).default;return S.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}async function U(e){const t=`json:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const r=JSON.parse(i.readFileSync(e,{encoding:"utf-8"}));return S.set(t,{data:r,timestamp:Date.now(),filePath:e}),r}const M=new Map;function V(e=process.cwd()){return $(e)}async function H(e=process.cwd()){const n=d.resolve(e),r=function(e){const t=Date.now(),n=M.get(e);if(n&&t-n.timestamp<1e4)return n.files;const r=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,s=i.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isFile()&&r.test(e.name)).map(e=>e.name);return M.set(e,{files:s,timestamp:t}),s}(n);let s={},o=!1;const a=await async function(e,t,n){for(const i of t)if(e.includes(i)){const e=d.resolve(n,i);if(/\.[cm]?ts$/i.test(i))return await x(e,n);if(/\.[cm]?js$/i.test(i))return await O(e);if(i.endsWith(".json"))return await U(e)}return null}(r,t.PP_DEV_CONFIG_NAMES,n);a&&(s=a,o=!0);const c=$(n)["pp-dev"];return o||!c||"object"!=typeof c||Array.isArray(c)||(s=c),s}const Z=Object.freeze({__proto__:null,clearConfigCache:function(){S.clear(),F.clear(),M.clear()},getConfig:H,getPkg:V});function G(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function k(e,n,i){if(!1===n.distZipEnabled)return!1;if(!0!==n.distZipEnabled&&void 0===n.distZipDir&&void 0===n.distZipFilename)return!1!==e&&{...e,outFileName:t.normalizeRelativeOutputPath(e.outFileName,"ZIP output file name")};const r=!1===e?{outFileName:i,outDir:"dist-zip"}:e,s=n.distZipFilename??r.outFileName;return{...r,...void 0!==n.distZipDir?{outDir:n.distZipDir}:{},outFileName:t.normalizeRelativeOutputPath(s,"ZIP output file name")}}function B(e,n){if(!1===n.versionManifestEnabled)return!1;if(!0!==n.versionManifestEnabled&&void 0===n.versionFileTemplate)return!1!==e&&void 0!==e.versionFileTemplate?{...e,versionFileTemplate:t.normalizeRelativeOutputPath(e.versionFileTemplate,"VERSION file name template")}:e;const i=!1===e?{enabled:!0}:e,r=n.versionFileTemplate??i.versionFileTemplate,s=void 0!==r?t.normalizeRelativeOutputPath(r,"VERSION file name template"):void 0;return{...i,enabled:!0,...void 0!==s?{versionFileTemplate:s}:{}}}const z=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function q(t){if("string"==typeof t)return t;if(t&&"object"==typeof t&&"url"in t&&"string"==typeof t.url)return t.url;const n=["CI_REPOSITORY_URL","GIT_URL","BUILD_REPOSITORY_URI","CI_PROJECT_URL","BITBUCKET_GIT_HTTP_ORIGIN","BUILDKITE_REPO"];for(const e of n){const t=process.env[e];if("string"==typeof t&&t.trim())return t}const i=process.env.GITHUB_REPOSITORY;if("string"==typeof i&&i.trim()){return`${(process.env.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,"")}/${i.replace(/^\/+/,"")}`}const r=process.env.CI_PROJECT_PATH;if("string"==typeof r&&r.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`}const s=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof s&&s.trim())return`https://bitbucket.org/${s.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e.execSync("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}function K(e){return e?.ppDev||{}}exports.applyDistZipOverride=k,exports.applyVersionManifestOverride=B,exports.config=Z,exports.createDevPanelAssetMiddleware=function(e){const n=u.posix.join(e,t.PACKAGE_NAME,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,r)=>{const s=(e.url??"").split("?")[0];if(!s.startsWith(n))return void r();const o=s.slice(n.length);if(!i.has(o))return void r();const a=u.join(m,o);p.readFile(a,(e,n)=>{e?r():(t.statusCode=200,t.setHeader("Content-Type",_[u.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}},exports.getNextVersion=async function(){try{return(await(import("next/package.json"))).version}catch{return null}},exports.getPPDevConfigFromNextConfig=K,exports.getViteConfig=async function(e,n={}){const i=n.root??process.cwd();N(n.mode,i);const r=V(i),s=r.name,o=await H(i);t.validatePPDevConfig(o,s);const a=t.normalizePPDevConfig(o,s);e&&(a.distZip=k(a.distZip,e,t.createDefaultZipFileName(s)),a.versionPlugin=B(a.versionPlugin,e));const{default:c}=await Promise.resolve().then(()=>require("./plugin.js")),l=[c(a),j()],{outDir:p,distZip:u,versionPlugin:d,imageOptimizer:f,templateLess:m,integrateMiTopBar:P}=a;if(P&&l.push(function(e){return{name:"mi-topbar-plugin",transformIndexHtml(){const t=[];return(!0===e||"object"==typeof e&&!0===e.addRootElement)&&t.push({tag:"div",injectTo:"body-prepend",attrs:{id:"mi-react-root"}}),(!0===e||"object"==typeof e&&!0===e.addSharedComponentsScripts)&&t.push({tag:"script",injectTo:"head-prepend",attrs:{src:"/auth/info.js"}},{tag:"script",injectTo:"head-prepend",attrs:{src:"/js/main.js",defer:"defer"}},{tag:"link",injectTo:"head-prepend",attrs:{href:"/css/main.css",rel:"stylesheet"}}),t}}}(P)),f){const{ViteImageOptimizer:e}=await(import("vite-plugin-image-optimizer"));l.push(e("object"==typeof f?f:void 0))}if(d){const{versionPlugin:e}=await Promise.resolve().then(()=>require("./version-plugin-Bf4jLh17.js"));l.push(e({outDir:p,packageVersion:r.version??"0.0.0",packageRepositoryUrl:q(r.repository),..."object"==typeof d?d:{}}))}if(u){const{default:e}=await(import("vite-plugin-zip-pack"));l.push({...e("object"==typeof u?u:{outFileName:t.createDefaultZipFileName(s)}),enforce:"post"})}return{base:m?`${t.PATH_PAGE_PREFIX}/${s}`:`${t.PATH_TEMPLATE_PREFIX}/${s}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:A}},outDir:p},css:{modules:{localsConvention:"dashes"}},ppDevConfig:a,plugins:l}},exports.injectDevPanel=function(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:r}=E(t),s=`<link rel="stylesheet" href="${i}">`,o=`${g(n)}${`<script type="module" src="${r}"><\/script>`}`;let a=e,c=!1;if(/<\/head>/i.test(a)&&(a=a.replace(/<\/head>/i,`${s}</head>`),c=!0),/<body[^>]*>/i.test(a)){const e=c?"":s;a=a.replace(/(<body[^>]*>)/i,`$1${e}${o}`)}else a=`${c?"":s}${a}${o}`;return a},exports.isNextAvailable=async function(){try{return await(import("next")),!0}catch{return!1}},exports.loadPPDevEnv=N,exports.resolveBuildCliOverrides=function(e){return{distZipEnabled:e.distZip??G(process.env.PP_DEV_DIST_ZIP),distZipDir:e.distZipDir??process.env.PP_DEV_DIST_ZIP_DIR,distZipFilename:e.distZipFilename??process.env.PP_DEV_DIST_ZIP_FILENAME,versionManifestEnabled:e.versionManifest??G(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}},exports.safeNextImport=D,exports.withPPDev=function(e,n){return async(i,r={})=>{try{const{constants:s}=await D(),{PHASE_DEVELOPMENT_SERVER:o,PHASE_PRODUCTION_BUILD:a}=s;i!==a||process.env[t.PP_DEV_NEXT_BUILD_ENV_VAR]||t.createLogger().warn(t.colors.yellow('⚠ Building with plain `next build`. Use `pp-dev next-build` instead to get VERSION/BUILD-MANIFEST/zip build output in the same format as `pp-dev build` (see the "Next.js Build" section in the pp-dev README).'));const c=await H(),l=V().name,p="function"==typeof e?await e(i,r):e,u=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(z.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(c,K(p),n);t.validatePPDevConfig(u,l);const d=t.normalizePPDevConfig(u,l),{templateLess:f,v7Features:m}=d,P=i===o,v=function(e,n,i,r){return i?r?n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_LOCAL_PREFIX}/${e}`:n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_PREFIX}/${e}`:`${t.PATH_PAGE_PREFIX}/${e}`}(d.templateName,f,P,m),E={basePath:v,trailingSlash:!!P||void 0};if(!f){const e=P&&m?t.PATH_TEMPLATE_LOCAL_PREFIX:t.PATH_TEMPLATE_PREFIX;E.assetPrefix=`${e}/${d.templateName}`}const g=Object.assign({},E,p);return Object.defineProperty(g,"ppDev",{value:u,enumerable:!1,configurable:!0}),g}catch(e){throw t.createLogger().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}};
2
+ //# sourceMappingURL=index-CCUrjlJE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-FgUi7Fqw.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/lib/env.ts","../../../src/config.ts","../../../src/lib/build-cli-overrides.ts","../../../src/index.ts","../../../src/plugins/mi-topbar-plugin.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null],"names":["CLIENT_DIST_DIR","path","dirname","PP_DEV_CLIENT_ENTRY","TEMPLATE_PATH","join","compiledTemplate","getDevPanelAssetPaths","base","css","posix","PACKAGE_NAME","js","renderDevPanelMarkup","data","templateContent","fs","readFileSync","encoding","ejs","compile","openDelimiter","closeDelimiter","async","rmWhitespace","compileDebug","getTemplate","template","VERSION","backendBaseURL","templateLess","appId","canSync","devPanelPosition","devPanelHidden","devPanelAutoHide","CONTENT_TYPES","DIRNAME","__filename","resolve","url","document","require","pathToFileURL","href","_documentCurrentScript","tagName","toUpperCase","src","URL","baseURI","fileURLToPath","process","cwd","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","cachedTemplateContent","cachedTemplate","clientInjectionPlugin","opts","name","apply","config","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","startsWith","id","transformIndexHtml","html","ctx","server","templatePath","cache","filename","assetPaths","result","tags","tag","injectTo","attrs","rel","templateData","children","type","configureServer","clientDir","root","allow","replacer","substring","$1","header","_chunk","replace","safeNextImport","next","constants","Promise","all","default","error","Error","previouslyLoadedKeys","Set","loadPPDevEnv","mode","envDir","key","env","fromEnvironment","Object","keys","filter","loadEnv","value","entries","has","configCache","Map","CACHE_TTL","packageJsonCache","getPackageJson","projectRoot","now","Date","cached","get","timestamp","JSON","parse","flag","set","empty","esbuildModule","loadTsConfig","filePath","cacheKey","isESM","test","pkg","esbuild","getEsbuild","build","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","text","code","outputFiles","fileNameTmp","Math","random","toString","slice","tempFilePath","fileUrl","writeFileSync","conf","existsSync","unlink","loadJsConfig","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","configPath","endsWith","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","applyDistZipOverride","overrides","defaultFileName","distZipEnabled","distZipDir","distZipFilename","outFileName","normalizeRelativeOutputPath","baseConfig","outDir","applyVersionManifestOverride","versionManifestEnabled","versionFileTemplate","enabled","normalizedVersionFileTemplate","PP_DEV_CONFIG_GROUPS","resolveRepositoryUrl","repository","directCiRepositoryUrlEnvVars","variableName","ciRepositoryUrl","trim","githubRepository","GITHUB_REPOSITORY","GITHUB_SERVER_URL","gitlabProjectPath","CI_PROJECT_PATH","CI_SERVER_URL","bitbucketRepositoryFullName","BITBUCKET_REPO_FULL_NAME","travisRepositorySlug","TRAVIS_REPO_SLUG","gitRemoteOriginUrl","execSync","stdio","getPPDevConfigFromNextConfig","nextConfig","ppDev","assetPrefix","allowed","req","res","pathname","split","fileName","length","readFile","err","content","statusCode","setHeader","extname","end","version","environment","templateName","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","distZip","createDefaultZipFileName","versionPlugin","vitePPDev","then","plugins","imageOptimizer","integrateMiTopBar","addRootElement","addSharedComponentsScripts","defer","miTopBarPlugin","ViteImageOptimizer","versionPluginFn","packageVersion","packageRepositoryUrl","zipPack","enforce","PATH_PAGE_PREFIX","PATH_TEMPLATE_PREFIX","port","minify","assetsInlineLimit","rollupOptions","output","banner","modules","localsConvention","linkTag","bodyPrepend","linkInjected","head","options","PP_DEV_DIST_ZIP","PP_DEV_DIST_ZIP_DIR","PP_DEV_DIST_ZIP_FILENAME","versionManifest","PP_DEV_VERSION_MANIFEST","PP_DEV_VERSION_FILE_TEMPLATE","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"ggBA4BMA,EAAkBC,EAAKC,QAAQC,uBAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,oBAE5C,CAGM,SAAUE,EAAqBC,GAGnC,OA9BF,WACE,GAAIR,EACF,OAAOA,EAGT,MAAMS,EAAkBC,EAAGC,aAAab,EAAe,CAAEc,SAAU,SAUnE,OARAZ,EAAmBa,EAAIC,QAAQL,EAAiB,CAC9CM,cAAe,IACfC,eAAgB,IAChBC,OAAO,EACPC,cAAc,EACdC,cAAc,IAGTnB,CACT,CAYmBoB,EAEVC,CAAS,cACdhB,EAAAA,qBACAiB,EAAAA,QACAC,eAAgBf,EAAKe,eACrBC,aAAchB,EAAKgB,aACnBC,MAAOjB,EAAKiB,MACZC,QAASlB,EAAKkB,UAAW,EAGzBC,iBAAkBnB,EAAKmB,kBAAoB,eAC3CC,eAAgBpB,EAAKoB,iBAAkB,EACvCC,iBAAkBrB,EAAKqB,mBAAoB,GAE/C,CA0CA,MAAMC,EAAwC,CAC5C,MAAO,iCACP,OAAQ,0BACR,OAAQ,mCC5FV,IAAIC,EAEJ,IAIIA,EAFwB,oBAAfC,YAA8BA,WAE7BrC,EAAKsC,QAAQtC,EAAKC,QAAQoC,YAAa,WACjB,IAAhB,CAAAE,IAAA,oBAAAC,SAAAC,QAAA,OAAAC,cAAAL,YAAAM,KAAAC,GAAA,WAAAA,EAAAC,QAAAC,eAAAF,EAAAG,KAAA,IAAAC,IAAA,oBAAAR,SAAAS,SAAAN,QAA+B,oBAAAH,SA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AAUC,EAC1BgB,EA9EZ,SACE9D,EACAvO,EACAoS,EACAD,GAEA,OAAIC,EACED,EACEnS,EACK,GAAG8P,EAAAA,oBAAoBvB,IAEvB,GAAG+D,EAAAA,8BAA8B/D,IAGtCvO,EACK,GAAG8P,EAAAA,oBAAoBvB,IAEvB,GAAGwB,EAAAA,wBAAwBxB,IAKjC,GAAGuB,EAAAA,oBAAoBvB,GAChC,CAuDuBgE,CAAeL,EAAW3D,aAAcvO,EAAcoS,EAAeD,GAEhF3G,EAAyB,CAC7B6G,WACAG,gBAAeJ,QAAuBtH,GAGxC,IAAK9K,EAAc,CACjB,MAAMyS,EAASL,GAAiBD,EAAaG,EAAAA,2BAA6BvC,EAAAA,qBAE1EvE,EAAW8B,YAAc,GAAGmF,KAAUP,EAAW3D,cACnD,CAKA,MAAMnL,EAASmC,OAAOmN,OAAO,CAAA,EAAIlH,EAAYoG,GAQ7C,OANArM,OAAOoN,eAAevP,EAAQ,QAAS,CACrCuC,MAAOkM,EACPe,YAAY,EACZC,cAAc,IAGTzP,CACT,CAAE,MAAOyB,GAKP,MAJe2M,EAAAA,eAER3M,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAMgO,OAAOjO,MAEzFA,CACR,EAEJ"}
1
+ {"version":3,"file":"index-CCUrjlJE.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/lib/env.ts","../../../src/config.ts","../../../src/lib/build-cli-overrides.ts","../../../src/index.ts","../../../src/plugins/mi-topbar-plugin.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null],"names":["CLIENT_DIST_DIR","path","dirname","PP_DEV_CLIENT_ENTRY","TEMPLATE_PATH","join","compiledTemplate","getDevPanelAssetPaths","base","css","posix","PACKAGE_NAME","js","renderDevPanelMarkup","data","templateContent","fs","readFileSync","encoding","ejs","compile","openDelimiter","closeDelimiter","async","rmWhitespace","compileDebug","getTemplate","template","VERSION","backendBaseURL","templateLess","appId","canSync","devPanelPosition","devPanelHidden","devPanelAutoHide","CONTENT_TYPES","DIRNAME","__filename","resolve","url","document","require","pathToFileURL","href","_documentCurrentScript","tagName","toUpperCase","src","URL","baseURI","fileURLToPath","process","cwd","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","cachedTemplateContent","cachedTemplate","clientInjectionPlugin","opts","name","apply","config","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","startsWith","id","transformIndexHtml","html","ctx","server","templatePath","cache","filename","assetPaths","result","tags","tag","injectTo","attrs","rel","templateData","children","type","configureServer","clientDir","root","allow","replacer","substring","$1","header","_chunk","replace","safeNextImport","next","constants","Promise","all","default","error","Error","previouslyLoadedKeys","Set","loadPPDevEnv","mode","envDir","key","env","fromEnvironment","Object","keys","filter","loadEnv","value","entries","has","configCache","Map","CACHE_TTL","packageJsonCache","getPackageJson","projectRoot","now","Date","cached","get","timestamp","JSON","parse","flag","set","empty","esbuildModule","loadTsConfig","filePath","cacheKey","isESM","test","pkg","esbuild","getEsbuild","build","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","text","code","outputFiles","fileNameTmp","Math","random","toString","slice","tempFilePath","fileUrl","writeFileSync","conf","existsSync","unlink","loadJsConfig","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","configPath","endsWith","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","applyDistZipOverride","overrides","defaultFileName","distZipEnabled","distZipDir","distZipFilename","outFileName","normalizeRelativeOutputPath","baseConfig","outDir","applyVersionManifestOverride","versionManifestEnabled","versionFileTemplate","enabled","normalizedVersionFileTemplate","PP_DEV_CONFIG_GROUPS","resolveRepositoryUrl","repository","directCiRepositoryUrlEnvVars","variableName","ciRepositoryUrl","trim","githubRepository","GITHUB_REPOSITORY","GITHUB_SERVER_URL","gitlabProjectPath","CI_PROJECT_PATH","CI_SERVER_URL","bitbucketRepositoryFullName","BITBUCKET_REPO_FULL_NAME","travisRepositorySlug","TRAVIS_REPO_SLUG","gitRemoteOriginUrl","execSync","stdio","getPPDevConfigFromNextConfig","nextConfig","ppDev","assetPrefix","allowed","req","res","pathname","split","fileName","length","readFile","err","content","statusCode","setHeader","extname","end","version","environment","templateName","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","distZip","createDefaultZipFileName","versionPlugin","vitePPDev","then","plugins","imageOptimizer","integrateMiTopBar","addRootElement","addSharedComponentsScripts","defer","miTopBarPlugin","ViteImageOptimizer","versionPluginFn","packageVersion","packageRepositoryUrl","zipPack","enforce","PATH_PAGE_PREFIX","PATH_TEMPLATE_PREFIX","port","minify","assetsInlineLimit","rollupOptions","output","banner","modules","localsConvention","linkTag","bodyPrepend","linkInjected","head","options","PP_DEV_DIST_ZIP","PP_DEV_DIST_ZIP_DIR","PP_DEV_DIST_ZIP_FILENAME","versionManifest","PP_DEV_VERSION_MANIFEST","PP_DEV_VERSION_FILE_TEMPLATE","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"ggBA4BMA,EAAkBC,EAAKC,QAAQC,uBAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG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AGxC,IAAK9K,EAAc,CACjB,MAAMyS,EAASL,GAAiBD,EAAaG,EAAAA,2BAA6BvC,EAAAA,qBAE1EvE,EAAW8B,YAAc,GAAGmF,KAAUP,EAAW3D,cACnD,CAKA,MAAMnL,EAASmC,OAAOmN,OAAO,CAAA,EAAIlH,EAAYoG,GAQ7C,OANArM,OAAOoN,eAAevP,EAAQ,QAAS,CACrCuC,MAAOkM,EACPe,YAAY,EACZC,cAAc,IAGTzP,CACT,CAAE,MAAOyB,GAKP,MAJe2M,EAAAA,eAER3M,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAMgO,OAAOjO,MAEzFA,CACR,EAEJ"}
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";require("child_process");const e=require("./plugin-yWlSj5sK.js"),r=require("./index-FgUi7Fqw.js"),i=require("./helpers.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("path"),require("fs"),require("crypto"),require("process"),require("os"),require("node:path"),require("jszip"),require("module"),require("zlib"),require("express"),require("node:crypto"),require("node:fs"),require("node:os"),require("ejs"),exports.AuthProvider=e.AuthProvider,exports.authProvider=e.authProvider,exports.normalizePPDevConfig=e.normalizePPDevConfig,exports.validatePPDevConfig=e.validatePPDevConfig,exports.getNextVersion=r.getNextVersion,exports.getPPDevConfigFromNextConfig=r.getPPDevConfigFromNextConfig,exports.getViteConfig=r.getViteConfig,exports.isNextAvailable=r.isNextAvailable,exports.safeNextImport=r.safeNextImport,exports.withPPDev=r.withPPDev,exports.defineConfig=i.defineConfig;
1
+ "use strict";require("child_process");const e=require("./plugin-D_RXI7ru.js"),r=require("./index-CCUrjlJE.js"),i=require("./helpers.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("path"),require("fs"),require("crypto"),require("process"),require("os"),require("node:path"),require("jszip"),require("module"),require("zlib"),require("express"),require("node:crypto"),require("node:fs"),require("node:os"),require("ejs"),exports.AuthProvider=e.AuthProvider,exports.authProvider=e.authProvider,exports.normalizePPDevConfig=e.normalizePPDevConfig,exports.validatePPDevConfig=e.validatePPDevConfig,exports.getNextVersion=r.getNextVersion,exports.getPPDevConfigFromNextConfig=r.getPPDevConfigFromNextConfig,exports.getViteConfig=r.getViteConfig,exports.isNextAvailable=r.isNextAvailable,exports.safeNextImport=r.safeNextImport,exports.withPPDev=r.withPPDev,exports.defineConfig=i.defineConfig;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("fs"),i=require("path"),t=require("./plugin-yWlSj5sK.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("crypto"),require("process"),require("child_process"),require("os"),require("node:path"),require("jszip"),require("module"),require("zlib"),require("express"),require("node:crypto"),require("node:fs"),require("node:os");const n=(e=>e&&"object"==typeof e&&"default"in e?e.default:e)(i),r=new Set(["backendBaseURL","personalAccessToken","miHudLess","integrateMiTopBar","v7Features","appId","portalPageId","templateName","templateLess","enableProxyCache","proxyCacheTTL","disableSSLValidation","distZip","versionPlugin","imageOptimizer","outDir","syncBackupsDir"]);const o=[".pp-watch.config.ts",".pp-watch.config.js",".pp-watch.config.json","pp-watch.config.ts","pp-watch.config.js","pp-watch.config.json"];function s(e,i=0){const t=" ".repeat(i),n=" ".repeat(i+1);if(null===e)return"null";if("boolean"==typeof e)return String(e);if("number"==typeof e)return String(e);if("string"==typeof e)return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`;if(Array.isArray(e)){if(0===e.length)return"[]";return`[\n${e.map(e=>`${n}${s(e,i+1)}`).join(",\n")},\n${t}]`}if("object"==typeof e&&null!==e){const r=Object.entries(e).filter(([,e])=>void 0!==e);if(0===r.length)return"{}";return`{\n${r.map(([e,t])=>`${n}${e}: ${s(t,i+1)}`).join(",\n")},\n${t}}`}return String(e)}exports.discoverMigrateSource=function(i,r){let s=r??null,a=!1;if(!s){for(const r of t.PP_DEV_CONFIG_NAMES){const t=n.join(i,r);if(e.existsSync(t)){s=t;break}}if(!s)for(const t of o){const r=n.join(i,t);if(e.existsSync(r)){s=r,a=!0;break}}if(!s){const t=n.join(i,"package.json");if(e.existsSync(t))try{const i=JSON.parse(e.readFileSync(t,"utf-8"));i["pp-dev"]&&"object"==typeof i["pp-dev"]&&!Array.isArray(i["pp-dev"])&&(s=t)}catch{}}}return s?{sourceFile:s,isWatchConfig:a,isPackageJsonConfig:"package.json"===n.basename(s)}:null},exports.generateConfigFileContent=function(e,i="ts"){return"json"===i?JSON.stringify(e,null,2)+"\n":`${"ts"===i?"import { defineConfig } from '@metricinsights/pp-dev';":"const { defineConfig } = require('@metricinsights/pp-dev');"}\n\n${"ts"===i?"export default":"module.exports ="} defineConfig(${s(e)});\n`},exports.isAlreadyMigrated=function(e){const i=new Set(["mi","app","proxy","build","sync","inspector"]);return Object.keys(e).some(e=>i.has(e))},exports.isLegacyFlatConfig=function(e){return Object.keys(e).some(e=>r.has(e))},exports.isLegacyPPWatchConfig=function(e){return"baseURL"in e},exports.loadPackageJsonMigrateConfig=function(i){return JSON.parse(e.readFileSync(i,"utf-8"))["pp-dev"]},exports.migrateLegacyFlatConfig=function(e,i){const t={},n={};void 0!==e.backendBaseURL&&(n.url=e.backendBaseURL),void 0!==e.personalAccessToken&&(n.token=e.personalAccessToken),void 0!==e.miHudLess&&(n.mode=e.miHudLess?"standalone":"embedding"),e.integrateMiTopBar&&(!0===e.integrateMiTopBar?(n.mode||(n.mode="standalone"),n.include="top-bar"):"object"==typeof e.integrateMiTopBar&&(e.integrateMiTopBar.addRootElement||e.integrateMiTopBar.addSharedComponentsScripts)&&(n.mode||(n.mode="standalone"),n.include=e.integrateMiTopBar.addRootElement?"top-bar":"shared-components")),void 0!==e.v7Features&&(n.apiVersion=e.v7Features?7:6),Object.keys(n).length>0&&(t.mi=n);const r={},o=e.appId??e.portalPageId;void 0!==o&&(r.id=o),void 0!==e.templateName&&e.templateName!==i&&(r.name=e.templateName),void 0!==e.templateLess&&(r.type=e.templateLess?"page":"template"),Object.keys(r).length>0&&(t.app=r);const s={};void 0!==e.enableProxyCache&&(s.cache=e.enableProxyCache),void 0!==e.proxyCacheTTL&&(s.cacheTtl=e.proxyCacheTTL),void 0!==e.disableSSLValidation&&(s.tls={allowSelfSigned:e.disableSSLValidation}),Object.keys(s).length>0&&(t.proxy=s);const a={};if(void 0!==e.outDir&&(a.outDir=e.outDir),void 0!==e.distZip)if("object"==typeof e.distZip&&null!==e.distZip){const i={};void 0!==e.distZip.outFileName&&(i.fileName=e.distZip.outFileName),void 0!==e.distZip.outDir&&(i.outDir=e.distZip.outDir),void 0!==e.distZip.inDir&&(i.inDir=e.distZip.inDir),a.zip=!(Object.keys(i).length>0)||i}else a.zip=e.distZip;if(void 0!==e.versionPlugin)if("object"==typeof e.versionPlugin&&null!==e.versionPlugin){const i={};void 0!==e.versionPlugin.enabled&&(i.enabled=e.versionPlugin.enabled),void 0!==e.versionPlugin.versionFileTemplate&&(i.fileNameTemplate=e.versionPlugin.versionFileTemplate),a.versionFile=!(Object.keys(i).length>0)||i}else a.versionFile=e.versionPlugin;return void 0!==e.imageOptimizer&&(a.imageOptimisations=e.imageOptimizer),Object.keys(a).length>0&&(t.build=a),void 0!==e.syncBackupsDir&&(t.sync={backupsDir:e.syncBackupsDir}),t},exports.migratePPWatchConfig=function(e){const i={mi:{url:e.baseURL}};return void 0!==e.portalPageId&&(i.app={id:e.portalPageId}),i};
2
- //# sourceMappingURL=migrate-pmX6NEmP.js.map
1
+ "use strict";const e=require("fs"),i=require("path"),t=require("./plugin-D_RXI7ru.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("crypto"),require("process"),require("child_process"),require("os"),require("node:path"),require("jszip"),require("module"),require("zlib"),require("express"),require("node:crypto"),require("node:fs"),require("node:os");const n=(e=>e&&"object"==typeof e&&"default"in e?e.default:e)(i),r=new Set(["backendBaseURL","personalAccessToken","miHudLess","integrateMiTopBar","v7Features","appId","portalPageId","templateName","templateLess","enableProxyCache","proxyCacheTTL","disableSSLValidation","distZip","versionPlugin","imageOptimizer","outDir","syncBackupsDir"]);const o=[".pp-watch.config.ts",".pp-watch.config.js",".pp-watch.config.json","pp-watch.config.ts","pp-watch.config.js","pp-watch.config.json"];function s(e,i=0){const t=" ".repeat(i),n=" ".repeat(i+1);if(null===e)return"null";if("boolean"==typeof e)return String(e);if("number"==typeof e)return String(e);if("string"==typeof e)return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`;if(Array.isArray(e)){if(0===e.length)return"[]";return`[\n${e.map(e=>`${n}${s(e,i+1)}`).join(",\n")},\n${t}]`}if("object"==typeof e&&null!==e){const r=Object.entries(e).filter(([,e])=>void 0!==e);if(0===r.length)return"{}";return`{\n${r.map(([e,t])=>`${n}${e}: ${s(t,i+1)}`).join(",\n")},\n${t}}`}return String(e)}exports.discoverMigrateSource=function(i,r){let s=r??null,a=!1;if(!s){for(const r of t.PP_DEV_CONFIG_NAMES){const t=n.join(i,r);if(e.existsSync(t)){s=t;break}}if(!s)for(const t of o){const r=n.join(i,t);if(e.existsSync(r)){s=r,a=!0;break}}if(!s){const t=n.join(i,"package.json");if(e.existsSync(t))try{const i=JSON.parse(e.readFileSync(t,"utf-8"));i["pp-dev"]&&"object"==typeof i["pp-dev"]&&!Array.isArray(i["pp-dev"])&&(s=t)}catch{}}}return s?{sourceFile:s,isWatchConfig:a,isPackageJsonConfig:"package.json"===n.basename(s)}:null},exports.generateConfigFileContent=function(e,i="ts"){return"json"===i?JSON.stringify(e,null,2)+"\n":`${"ts"===i?"import { defineConfig } from '@metricinsights/pp-dev';":"const { defineConfig } = require('@metricinsights/pp-dev');"}\n\n${"ts"===i?"export default":"module.exports ="} defineConfig(${s(e)});\n`},exports.isAlreadyMigrated=function(e){const i=new Set(["mi","app","proxy","build","sync","inspector"]);return Object.keys(e).some(e=>i.has(e))},exports.isLegacyFlatConfig=function(e){return Object.keys(e).some(e=>r.has(e))},exports.isLegacyPPWatchConfig=function(e){return"baseURL"in e},exports.loadPackageJsonMigrateConfig=function(i){return JSON.parse(e.readFileSync(i,"utf-8"))["pp-dev"]},exports.migrateLegacyFlatConfig=function(e,i){const t={},n={};void 0!==e.backendBaseURL&&(n.url=e.backendBaseURL),void 0!==e.personalAccessToken&&(n.token=e.personalAccessToken),void 0!==e.miHudLess&&(n.mode=e.miHudLess?"standalone":"embedding"),e.integrateMiTopBar&&(!0===e.integrateMiTopBar?(n.mode||(n.mode="standalone"),n.include="top-bar"):"object"==typeof e.integrateMiTopBar&&(e.integrateMiTopBar.addRootElement||e.integrateMiTopBar.addSharedComponentsScripts)&&(n.mode||(n.mode="standalone"),n.include=e.integrateMiTopBar.addRootElement?"top-bar":"shared-components")),void 0!==e.v7Features&&(n.apiVersion=e.v7Features?7:6),Object.keys(n).length>0&&(t.mi=n);const r={},o=e.appId??e.portalPageId;void 0!==o&&(r.id=o),void 0!==e.templateName&&e.templateName!==i&&(r.name=e.templateName),void 0!==e.templateLess&&(r.type=e.templateLess?"page":"template"),Object.keys(r).length>0&&(t.app=r);const s={};void 0!==e.enableProxyCache&&(s.cache=e.enableProxyCache),void 0!==e.proxyCacheTTL&&(s.cacheTtl=e.proxyCacheTTL),void 0!==e.disableSSLValidation&&(s.tls={allowSelfSigned:e.disableSSLValidation}),Object.keys(s).length>0&&(t.proxy=s);const a={};if(void 0!==e.outDir&&(a.outDir=e.outDir),void 0!==e.distZip)if("object"==typeof e.distZip&&null!==e.distZip){const i={};void 0!==e.distZip.outFileName&&(i.fileName=e.distZip.outFileName),void 0!==e.distZip.outDir&&(i.outDir=e.distZip.outDir),void 0!==e.distZip.inDir&&(i.inDir=e.distZip.inDir),a.zip=!(Object.keys(i).length>0)||i}else a.zip=e.distZip;if(void 0!==e.versionPlugin)if("object"==typeof e.versionPlugin&&null!==e.versionPlugin){const i={};void 0!==e.versionPlugin.enabled&&(i.enabled=e.versionPlugin.enabled),void 0!==e.versionPlugin.versionFileTemplate&&(i.fileNameTemplate=e.versionPlugin.versionFileTemplate),a.versionFile=!(Object.keys(i).length>0)||i}else a.versionFile=e.versionPlugin;return void 0!==e.imageOptimizer&&(a.imageOptimisations=e.imageOptimizer),Object.keys(a).length>0&&(t.build=a),void 0!==e.syncBackupsDir&&(t.sync={backupsDir:e.syncBackupsDir}),t},exports.migratePPWatchConfig=function(e){const i={mi:{url:e.baseURL}};return void 0!==e.portalPageId&&(i.app={id:e.portalPageId}),i};
2
+ //# sourceMappingURL=migrate-BYno__sx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-pmX6NEmP.js","sources":["../../../src/lib/migrate.ts"],"sourcesContent":[null],"names":["LEGACY_FLAT_KEYS","Set","WATCH_CONFIG_NAMES","serializeValue","value","depth","indent","repeat","innerIndent","String","replace","Array","isArray","length","map","v","join","entries","Object","filter","undefined","k","projectRoot","configArg","sourceFile","isWatchConfig","name","PP_DEV_CONFIG_NAMES","candidate","path","existsSync","pkgJsonPath","pkgJson","JSON","parse","readFileSync","isPackageJsonConfig","basename","config","format","stringify","NEW_KEYS","keys","some","has","legacy","packageName","mi","backendBaseURL","url","personalAccessToken","token","miHudLess","mode","integrateMiTopBar","include","addRootElement","addSharedComponentsScripts","v7Features","apiVersion","app","appId","portalPageId","id","templateName","templateLess","type","proxy","enableProxyCache","cache","proxyCacheTTL","cacheTtl","disableSSLValidation","tls","allowSelfSigned","build","outDir","distZip","zip","outFileName","fileName","inDir","versionPlugin","vf","enabled","versionFileTemplate","fileNameTemplate","versionFile","imageOptimizer","imageOptimisations","syncBackupsDir","sync","backupsDir","watchCfg","baseURL"],"mappings":"8jBAmCMA,EAAmB,IAAIC,IAAI,CAC/B,iBACA,sBACA,YACA,oBACA,aACA,QACA,eACA,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,EAAIE,SAAWnC,EAAOgC,QAAQE,kBAGF3D,IAA1ByB,EAAOgC,QAAQD,SACjBE,EAAIF,OAAS/B,EAAOgC,QAAQD,aAGDxD,IAAzByB,EAAOgC,QAAQI,QACjBH,EAAIG,MAAQpC,EAAOgC,QAAQI,OAG7BN,EAAMG,MAAM5D,OAAOwB,KAAKoC,GAAKjE,OAAS,IAAKiE,CAC7C,MACEH,EAAMG,IAAMjC,EAAOgC,QAIvB,QAA6BzD,IAAzByB,EAAOqC,cACT,GAAoC,iBAAzBrC,EAAOqC,eAAuD,OAAzBrC,EAAOqC,cAAwB,CAC7E,MAAMC,EAAuD,CAAA,OAExB/D,IAAjCyB,EAAOqC,cAAcE,UACvBD,EAAGC,QAAUvC,EAAOqC,cAAcE,cAGahE,IAA7CyB,EAAOqC,cAAcG,sBACvBF,EAAGG,iBAAmBzC,EAAOqC,cAAcG,qBAG7CV,EAAMY,cAAcrE,OAAOwB,KAAKyC,GAAItE,OAAS,IAAIsE,CACnD,MACER,EAAMY,YAAc1C,EAAOqC,cAiB/B,YAb8B9D,IAA1ByB,EAAO2C,iBACTb,EAAMc,mBAAqB5C,EAAO2C,gBAGhCtE,OAAOwB,KAAKiC,GAAO9D,OAAS,IAC9ByB,EAAOqC,MAAQA,QAIavD,IAA1ByB,EAAO6C,iBACTpD,EAAOqD,KAAO,CAAEC,WAAY/C,EAAO6C,iBAG9BpD,CACT,+BAEM,SAA+BuD,GACnC,MAAMvD,EAAsB,CAAES,GAAI,CAAEE,IAAK4C,EAASC,UAMlD,YAJ8B1E,IAA1ByE,EAAS/B,eACXxB,EAAOsB,IAAM,CAAEG,GAAI8B,EAAS/B,eAGvBxB,CACT"}
1
+ {"version":3,"file":"migrate-BYno__sx.js","sources":["../../../src/lib/migrate.ts"],"sourcesContent":[null],"names":["LEGACY_FLAT_KEYS","Set","WATCH_CONFIG_NAMES","serializeValue","value","depth","indent","repeat","innerIndent","String","replace","Array","isArray","length","map","v","join","entries","Object","filter","undefined","k","projectRoot","configArg","sourceFile","isWatchConfig","name","PP_DEV_CONFIG_NAMES","candidate","path","existsSync","pkgJsonPath","pkgJson","JSON","parse","readFileSync","isPackageJsonConfig","basename","config","format","stringify","NEW_KEYS","keys","some","has","legacy","packageName","mi","backendBaseURL","url","personalAccessToken","token","miHudLess","mode","integrateMiTopBar","include","addRootElement","addSharedComponentsScripts","v7Features","apiVersion","app","appId","portalPageId","id","templateName","templateLess","type","proxy","enableProxyCache","cache","proxyCacheTTL","cacheTtl","disableSSLValidation","tls","allowSelfSigned","build","outDir","distZip","zip","outFileName","fileName","inDir","versionPlugin","vf","enabled","versionFileTemplate","fileNameTemplate","versionFile","imageOptimizer","imageOptimisations","syncBackupsDir","sync","backupsDir","watchCfg","baseURL"],"mappings":"8jBAmCMA,EAAmB,IAAIC,IAAI,CAC/B,iBACA,sBACA,YACA,oBACA,aACA,QACA,eACA,eACA,eACA,mBACA,gBACA,uBACA,UACA,gBACA,iBACA,SACA,mBAmBF,MAAMC,EAAqB,CACzB,sBACA,sBACA,wBACA,qBACA,qBACA,wBA2OF,SAASC,EAAeC,EAAgBC,EAAQ,GAC9C,MAAMC,EAAS,KAAKC,OAAOF,GACrBG,EAAc,KAAKD,OAAOF,EAAQ,GAExC,GAAc,OAAVD,EACF,MAAO,OAGT,GAAqB,kBAAVA,EACT,OAAOK,OAAOL,GAGhB,GAAqB,iBAAVA,EACT,OAAOK,OAAOL,GAGhB,GAAqB,iBAAVA,EACT,MAAO,IAAIA,EAAMM,QAAQ,MAAO,QAAQA,QAAQ,KAAM,UAGxD,GAAIC,MAAMC,QAAQR,GAAQ,CACxB,GAAqB,IAAjBA,EAAMS,OACR,MAAO,KAKT,MAAO,MAFOT,EAAMU,IAAKC,GAAM,GAAGP,IAAcL,EAAeY,EAAGV,EAAQ,MAAMW,KAAK,YAE7DV,IAC1B,CAEA,GAAqB,iBAAVF,GAAgC,OAAVA,EAAgB,CAC/C,MAAMa,EAAUC,OAAOD,QAAQb,GAAkCe,OAA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